diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d60219aef..d7cdfe299 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,6 @@ jobs: strategy: matrix: node-version: - - 10.x - 12.x - 14.x env: diff --git a/src/ldp/http/SparqlUpdateBodyParser.ts b/src/ldp/http/SparqlUpdateBodyParser.ts index 0f5ca0027..225f8ab9f 100644 --- a/src/ldp/http/SparqlUpdateBodyParser.ts +++ b/src/ldp/http/SparqlUpdateBodyParser.ts @@ -26,8 +26,6 @@ export class SparqlUpdateBodyParser extends BodyParser { } public async handle({ request, metadata }: BodyParserArgs): Promise { - // Note that readableObjectMode is only defined starting from Node 12 - // It is impossible to check if object mode is enabled in Node 10 (without accessing private variables) const options = { objectMode: request.readableObjectMode }; const toAlgebraStream = pipeSafely(request, new PassThrough(options)); const dataCopy = pipeSafely(request, new PassThrough(options)); diff --git a/src/storage/conversion/RdfToQuadConverter.ts b/src/storage/conversion/RdfToQuadConverter.ts index d798ca647..ddfe3f6c2 100644 --- a/src/storage/conversion/RdfToQuadConverter.ts +++ b/src/storage/conversion/RdfToQuadConverter.ts @@ -37,9 +37,7 @@ export class RdfToQuadConverter extends TypedRepresentationConverter { baseIRI, }); - // Wrap the stream such that errors are transformed - // (Node 10 requires both writableObjectMode and readableObjectMode) - const pass = new PassThrough({ writableObjectMode: true, readableObjectMode: true }); + const pass = new PassThrough({ objectMode: true }); const data = pipeSafely(rawQuads, pass, (error): Error => new UnsupportedHttpError(error.message)); return { diff --git a/test/unit/ldp/http/SparqlUpdateBodyParser.test.ts b/test/unit/ldp/http/SparqlUpdateBodyParser.test.ts index 18b9b96e4..5731f6d1e 100644 --- a/test/unit/ldp/http/SparqlUpdateBodyParser.test.ts +++ b/test/unit/ldp/http/SparqlUpdateBodyParser.test.ts @@ -1,4 +1,5 @@ import { namedNode, quad } from '@rdfjs/data-model'; +import arrayifyStream from 'arrayify-stream'; import { Algebra } from 'sparqlalgebrajs'; import * as algebra from 'sparqlalgebrajs'; import streamifyArray from 'streamify-array'; @@ -8,7 +9,6 @@ import { RepresentationMetadata } from '../../../../src/ldp/representation/Repre import type { HttpRequest } from '../../../../src/server/HttpRequest'; import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError'; import { UnsupportedMediaTypeHttpError } from '../../../../src/util/errors/UnsupportedMediaTypeHttpError'; -import { readableToString } from '../../../../src/util/StreamUtil'; describe('A SparqlUpdateBodyParser', (): void => { const bodyParser = new SparqlUpdateBodyParser(); @@ -56,9 +56,8 @@ describe('A SparqlUpdateBodyParser', (): void => { expect(result.binary).toBe(true); expect(result.metadata).toBe(input.metadata); - // Workaround for Node 10 not exposing objectMode - expect(await readableToString(result.data)).toEqual( - 'DELETE DATA { }', + expect(await arrayifyStream(result.data)).toEqual( + [ 'DELETE DATA { }' ], ); }); });