Skip to content

Commit

Permalink
Merge branch 'main' of github.com:solid/community-server into feat/st…
Browse files Browse the repository at this point in the history
…orage-modification-type
  • Loading branch information
ixuz committed Feb 14, 2022
2 parents 949a9ed + d2870e5 commit 92bc844
Show file tree
Hide file tree
Showing 25 changed files with 5,341 additions and 6,335 deletions.
11,478 changes: 5,231 additions & 6,247 deletions package-lock.json

Large diffs are not rendered by default.

97 changes: 48 additions & 49 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,94 +75,93 @@
"templates"
],
"dependencies": {
"@comunica/actor-init-sparql": "^1.21.3",
"@rdfjs/data-model": "^1.2.0",
"@solid/access-token-verifier": "^1.1.2",
"@comunica/actor-init-sparql": "^1.22.3",
"@solid/access-token-verifier": "^1.1.3",
"@types/arrayify-stream": "^1.0.0",
"@types/async-lock": "^1.1.2",
"@types/async-lock": "^1.1.3",
"@types/bcrypt": "^5.0.0",
"@types/cors": "^2.8.10",
"@types/end-of-stream": "^1.4.0",
"@types/cors": "^2.8.12",
"@types/end-of-stream": "^1.4.1",
"@types/lodash.orderby": "^4.6.6",
"@types/marked": "^3.0.0",
"@types/mime-types": "^2.1.0",
"@types/n3": "^1.10.0",
"@types/marked": "^4.0.2",
"@types/mime-types": "^2.1.1",
"@types/n3": "^1.10.4",
"@types/node": "^14.18.0",
"@types/nodemailer": "^6.4.2",
"@types/nodemailer": "^6.4.4",
"@types/pump": "^1.1.1",
"@types/punycode": "^2.1.0",
"@types/redis": "^2.8.30",
"@types/redlock": "^4.0.1",
"@types/sparqljs": "^3.1.2",
"@types/url-join": "^4.0.0",
"@types/uuid": "^8.3.0",
"@types/ws": "^8.2.0",
"@types/yargs": "^17.0.0",
"@types/sparqljs": "^3.1.3",
"@types/url-join": "^4.0.1",
"@types/uuid": "^8.3.4",
"@types/ws": "^8.2.2",
"@types/yargs": "^17.0.8",
"arrayify-stream": "^1.0.0",
"async-lock": "^1.3.0",
"bcrypt": "^5.0.1",
"componentsjs": "^4.4.1",
"componentsjs": "^4.5.0",
"cors": "^2.8.5",
"cross-fetch": "^3.1.4",
"cross-fetch": "^3.1.5",
"ejs": "^3.1.6",
"end-of-stream": "^1.4.4",
"escape-string-regexp": "^4.0.0",
"fetch-sparql-endpoint": "^2.0.1",
"fetch-sparql-endpoint": "^2.4.0",
"handlebars": "^4.7.7",
"jose": "^4.3.7",
"jose": "^4.4.0",
"lodash.orderby": "^4.6.0",
"marked": "^3.0.0",
"mime-types": "^2.1.32",
"n3": "^1.12.2",
"nodemailer": "^6.6.2",
"marked": "^4.0.12",
"mime-types": "^2.1.34",
"n3": "^1.13.0",
"nodemailer": "^6.7.2",
"oidc-provider": "^6.31.1",
"pump": "^3.0.0",
"punycode": "^2.1.1",
"rdf-parse": "^1.8.1",
"rdf-serialize": "^1.1.0",
"rdf-parse": "^1.9.1",
"rdf-serialize": "^1.2.0",
"redis": "^3.1.2",
"redlock": "^4.2.0",
"sparqlalgebrajs": "^4.0.1",
"sparqljs": "^3.4.2",
"sparqlalgebrajs": "^4.0.2",
"sparqljs": "^3.5.1",
"url-join": "^4.0.1",
"uuid": "^8.3.2",
"winston": "^3.3.3",
"winston-transport": "^4.4.0",
"ws": "^8.2.3",
"yargs": "^17.0.1"
"winston": "^3.5.1",
"winston-transport": "^4.4.2",
"ws": "^8.4.2",
"yargs": "^17.3.1"
},
"devDependencies": {
"@inrupt/solid-client-authn-node": "^1.9.1",
"@inrupt/solid-client-authn-node": "^1.11.3",
"@microsoft/tsdoc-config": "^0.15.2",
"@tsconfig/node12": "^1.0.9",
"@types/cheerio": "^0.22.29",
"@types/ejs": "^3.0.6",
"@types/fs-extra": "^9.0.12",
"@types/jest": "^27.0.0",
"@types/set-cookie-parser": "^2.4.0",
"@types/cheerio": "^0.22.30",
"@types/ejs": "^3.1.0",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^27.4.0",
"@types/set-cookie-parser": "^2.4.2",
"@types/supertest": "^2.0.11",
"@typescript-eslint/eslint-plugin": "^5.3.0",
"@typescript-eslint/parser": "^5.3.0",
"cheerio": "^1.0.0-rc.10",
"componentsjs-generator": "^2.6.0",
"eslint": "^8.4.1",
"componentsjs-generator": "^2.6.1",
"eslint": "^8.8.0",
"eslint-config-es": "4.1.0",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jest": "^25.3.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^26.0.0",
"eslint-plugin-tsdoc": "^0.2.14",
"eslint-plugin-unused-imports": "^2.0.0",
"fs-extra": "^10.0.0",
"husky": "^4.3.8",
"jest": "^27.0.6",
"jest-rdf": "^1.6.0",
"jest": "^27.4.7",
"jest-rdf": "^1.7.0",
"manual-git-changelog": "^1.0.1",
"node-mocks-http": "^1.10.1",
"nodemon": "^2.0.7",
"node-mocks-http": "^1.11.0",
"nodemon": "^2.0.15",
"set-cookie-parser": "^2.4.8",
"supertest": "^6.1.3",
"ts-jest": "^27.0.3",
"typedoc": "^0.22.0",
"typescript": "^4.3.4"
"supertest": "^6.2.2",
"ts-jest": "^27.1.3",
"typedoc": "^0.22.11",
"typescript": "^4.5.5"
}
}
4 changes: 2 additions & 2 deletions src/http/auxiliary/LinkMetadataGenerator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { namedNode } from '@rdfjs/data-model';
import { DataFactory } from 'n3';
import { SOLID_META } from '../../util/Vocabularies';
import type { RepresentationMetadata } from '../representation/RepresentationMetadata';
import type { AuxiliaryIdentifierStrategy } from './AuxiliaryIdentifierStrategy';
Expand All @@ -24,7 +24,7 @@ export class LinkMetadataGenerator extends MetadataGenerator {
const identifier = { path: metadata.identifier.value };
if (!this.identifierStrategy.isAuxiliaryIdentifier(identifier)) {
metadata.add(this.link,
namedNode(this.identifierStrategy.getAuxiliaryIdentifier(identifier).path),
DataFactory.namedNode(this.identifierStrategy.getAuxiliaryIdentifier(identifier).path),
SOLID_META.terms.ResponseMetadata);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/storage/conversion/MarkdownToHtmlConverter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import marked from 'marked';
import { marked } from 'marked';
import { BasicRepresentation } from '../../http/representation/BasicRepresentation';
import type { Representation } from '../../http/representation/Representation';
import { TEXT_HTML, TEXT_MARKDOWN } from '../../util/ContentTypes';
Expand Down
5 changes: 2 additions & 3 deletions src/storage/patch/SparqlUpdatePatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import type { Readable } from 'stream';
import type { ActorInitSparql } from '@comunica/actor-init-sparql';
import { newEngine } from '@comunica/actor-init-sparql';
import type { IQueryResultUpdate } from '@comunica/actor-init-sparql/lib/ActorInitSparql-browser';
import { defaultGraph } from '@rdfjs/data-model';
import { Store } from 'n3';
import { DataFactory, Store } from 'n3';
import type { BaseQuad } from 'rdf-js';
import { Algebra } from 'sparqlalgebrajs';
import { BasicRepresentation } from '../../http/representation/BasicRepresentation';
Expand Down Expand Up @@ -86,7 +85,7 @@ export class SparqlUpdatePatcher extends RepresentationPatcher {
* This means: no GRAPH statements, no DELETE WHERE containing terms of type Variable.
*/
private validateDeleteInsert(op: Algebra.DeleteInsert): void {
const def = defaultGraph();
const def = DataFactory.defaultGraph();
const deletes = op.delete ?? [];
const inserts = op.insert ?? [];
if (!deletes.every((pattern): boolean => pattern.graph.equals(def))) {
Expand Down
4 changes: 2 additions & 2 deletions src/util/Vocabularies.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable function-paren-newline */
import { namedNode } from '@rdfjs/data-model';
import { DataFactory } from 'n3';
import type { NamedNode } from 'rdf-js';

type RecordOf<TKey extends any[], TValue> = Record<TKey[number], TValue>;
Expand Down Expand Up @@ -41,7 +41,7 @@ Namespace<typeof localNames, string> {
*/
export function createTermNamespace<T extends string>(baseUri: string, ...localNames: T[]):
Namespace<typeof localNames, NamedNode> {
return createNamespace(baseUri, namedNode, ...localNames);
return createNamespace(baseUri, DataFactory.namedNode, ...localNames);
}

/**
Expand Down
12 changes: 12 additions & 0 deletions test/integration/Identity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ describe('A Solid server with IDP', (): void => {
});
});

afterAll(async(): Promise<void> => {
await state.session.logout();
});

it('initializes the session and logs in.', async(): Promise<void> => {
const url = await state.startSession();
await state.parseLoginPage(url);
Expand Down Expand Up @@ -226,6 +230,10 @@ describe('A Solid server with IDP', (): void => {
state = new IdentityTestState(baseUrl, redirectUrl, oidcIssuer);
});

afterAll(async(): Promise<void> => {
await state.session.logout();
});

it('can not log in with the old password anymore.', async(): Promise<void> => {
const url = await state.startSession();
nextUrl = url;
Expand Down Expand Up @@ -293,6 +301,10 @@ describe('A Solid server with IDP', (): void => {
email: newMail, password, confirmPassword: password, podName, createWebId: 'ok', register: 'ok', createPod: 'ok',
});

afterAll(async(): Promise<void> => {
await state.session.logout();
});

it('sends the form to create the WebID and register.', async(): Promise<void> => {
const res = await postForm(`${baseUrl}idp/register/`, formBody);
expect(res.status).toBe(200);
Expand Down
2 changes: 2 additions & 0 deletions test/integration/RestrictedIdentity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,7 @@ describe('A server with restricted IDP access', (): void => {
expect(res.status).toBe(200);
const body = await res.json();
expect(body.webId).toBe(joinUrl(baseUrl, 'bob/profile/card#me'));

await state.session.logout();
});
});
4 changes: 2 additions & 2 deletions test/unit/authorization/WebAclReader.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { namedNode, quad } from '@rdfjs/data-model';
import { DataFactory } from 'n3';
import { CredentialGroup } from '../../../src/authentication/Credentials';
import type { CredentialSet } from '../../../src/authentication/Credentials';
import type { AccessChecker } from '../../../src/authorization/access/AccessChecker';
Expand All @@ -15,7 +15,7 @@ import { NotFoundHttpError } from '../../../src/util/errors/NotFoundHttpError';
import { SingleRootIdentifierStrategy } from '../../../src/util/identifiers/SingleRootIdentifierStrategy';
import { guardedStreamFrom } from '../../../src/util/StreamUtil';

const nn = namedNode;
const { namedNode: nn, quad } = DataFactory;

const acl = 'http://www.w3.org/ns/auth/acl#';
const rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
Expand Down
3 changes: 2 additions & 1 deletion test/unit/http/input/body/SparqlUpdateBodyParser.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'jest-rdf';
import { namedNode, quad } from '@rdfjs/data-model';
import arrayifyStream from 'arrayify-stream';
import { DataFactory } from 'n3';
import { Algebra } from 'sparqlalgebrajs';
import * as algebra from 'sparqlalgebrajs';
import type { BodyParserArgs } from '../../../../../src/http/input/body/BodyParser';
Expand All @@ -10,6 +10,7 @@ import type { HttpRequest } from '../../../../../src/server/HttpRequest';
import { BadRequestHttpError } from '../../../../../src/util/errors/BadRequestHttpError';
import { UnsupportedMediaTypeHttpError } from '../../../../../src/util/errors/UnsupportedMediaTypeHttpError';
import { guardedStreamFrom } from '../../../../../src/util/StreamUtil';
const { namedNode, quad } = DataFactory;

describe('A SparqlUpdateBodyParser', (): void => {
const bodyParser = new SparqlUpdateBodyParser();
Expand Down
3 changes: 2 additions & 1 deletion test/unit/http/representation/BasicRepresentation.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import 'jest-rdf';
import { Readable } from 'stream';
import { namedNode } from '@rdfjs/data-model';
import arrayifyStream from 'arrayify-stream';
import { DataFactory } from 'n3';
import { BasicRepresentation } from '../../../../src/http/representation/BasicRepresentation';
import { RepresentationMetadata } from '../../../../src/http/representation/RepresentationMetadata';
import { INTERNAL_QUADS } from '../../../../src/util/ContentTypes';
import { guardedStreamFrom } from '../../../../src/util/StreamUtil';
import { CONTENT_TYPE } from '../../../../src/util/Vocabularies';
const { namedNode } = DataFactory;

describe('BasicRepresentation', (): void => {
it('creates a representation with (data, metadata, binary).', (): void => {
Expand Down
3 changes: 2 additions & 1 deletion test/unit/http/representation/RepresentationMetadata.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import 'jest-rdf';
import { defaultGraph, literal, namedNode, quad } from '@rdfjs/data-model';
import { DataFactory } from 'n3';
import type { NamedNode, Quad } from 'rdf-js';
import { RepresentationMetadata } from '../../../../src/http/representation/RepresentationMetadata';
import { CONTENT_TYPE } from '../../../../src/util/Vocabularies';
const { defaultGraph, literal, namedNode, quad } = DataFactory;

// Helper functions to filter quads
function getQuads(quads: Quad[], subject?: string, predicate?: string, object?: string, graph?: string): Quad[] {
Expand Down
5 changes: 3 additions & 2 deletions test/unit/init/AppRunner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,9 @@ describe('AppRunner', (): void => {
setImmediate(resolve);
});

expect(error).toHaveBeenCalledWith('Unsupported positional arguments: "foo", "bar", "foo.txt", "bar.txt"');
expect(exit).toHaveBeenCalledTimes(1);
expect(error).toHaveBeenCalledWith('Unknown arguments: foo, bar, foo.txt, bar.txt');
// Yargs also calls process.exit in this case
expect(exit).toHaveBeenCalledTimes(2);
expect(exit).toHaveBeenCalledWith(1);
});

Expand Down
4 changes: 2 additions & 2 deletions test/unit/pods/generate/TemplatedResourcesGenerator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('A TemplatedResourcesGenerator', (): void => {
expect(representation.binary).toBe(true);
expect(representation.metadata.contentType).toBe('text/turtle');
await expect(readableToString(representation.data)).resolves
.toEqual(`<${webId}> a <http://xmlns.com/foaf/0.1/Person>.`);
.toBe(`<${webId}> a <http://xmlns.com/foaf/0.1/Person>.`);
});

it('creates the necessary containers.', async(): Promise<void> => {
Expand All @@ -83,7 +83,7 @@ describe('A TemplatedResourcesGenerator', (): void => {

const { representation } = result[3];
await expect(readableToString(representation.data)).resolves
.toEqual(`<${webId}> a <http://xmlns.com/foaf/0.1/Person>.`);
.toBe(`<${webId}> a <http://xmlns.com/foaf/0.1/Person>.`);
});

it('copies the file stream directly if no template extension is found.', async(): Promise<void> => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/storage/DataAccessorBasedStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ describe('A DataAccessorBasedStore', (): void => {
const result = await store.getRepresentation(resourceID);
const contains = result.metadata.getAll(LDP.terms.contains);
expect(contains).toHaveLength(1);
expect(contains[0].value).toEqual(`${resourceID.path}resource`);
expect(contains[0].value).toBe(`${resourceID.path}resource`);
});
});

Expand Down
6 changes: 3 additions & 3 deletions test/unit/storage/accessors/FileDataAccessor.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'jest-rdf';
import type { Readable } from 'stream';
import { namedNode } from '@rdfjs/data-model';
import { DataFactory } from 'n3';
import type { Representation } from '../../../../src/http/representation/Representation';
import { RepresentationMetadata } from '../../../../src/http/representation/RepresentationMetadata';
import { FileDataAccessor } from '../../../../src/storage/accessors/FileDataAccessor';
Expand Down Expand Up @@ -277,7 +277,7 @@ describe('A FileDataAccessor', (): void => {

it('updates the filename if the content-type gets updated.', async(): Promise<void> => {
cache.data = { 'resource$.ttl': '<this> <is> <data>.', 'resource.meta': '<this> <is> <metadata>.' };
metadata.identifier = namedNode(`${base}resource`);
metadata.identifier = DataFactory.namedNode(`${base}resource`);
metadata.contentType = 'text/plain';
metadata.add('new', 'metadata');
await expect(accessor.writeDocument({ path: `${base}resource` }, data, metadata))
Expand All @@ -289,7 +289,7 @@ describe('A FileDataAccessor', (): void => {
});

it('does not try to update the content-type if there is no original file.', async(): Promise<void> => {
metadata.identifier = namedNode(`${base}resource.txt`);
metadata.identifier = DataFactory.namedNode(`${base}resource.txt`);
metadata.contentType = 'text/turtle';
metadata.add('new', 'metadata');
await expect(accessor.writeDocument({ path: `${base}resource.txt` }, data, metadata))
Expand Down
8 changes: 4 additions & 4 deletions test/unit/storage/accessors/InMemoryDataAccessor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ describe('An InMemoryDataAccessor', (): void => {
children.push(child);
}
expect(children).toHaveLength(2);
expect(children[0].identifier.value).toEqual(`${base}container/resource`);
expect(children[1].identifier.value).toEqual(`${base}container/container2/`);
expect(children[0].identifier.value).toBe(`${base}container/resource`);
expect(children[1].identifier.value).toBe(`${base}container/container2/`);
});

it('adds stored metadata when requesting document metadata.', async(): Promise<void> => {
Expand Down Expand Up @@ -148,7 +148,7 @@ describe('An InMemoryDataAccessor', (): void => {
children.push(child);
}
expect(children).toHaveLength(1);
expect(children[0].identifier.value).toEqual(`${base}container/resource`);
expect(children[0].identifier.value).toBe(`${base}container/resource`);

await expect(accessor.getMetadata({ path: `${base}container/resource` }))
.resolves.toBeInstanceOf(RepresentationMetadata);
Expand All @@ -175,7 +175,7 @@ describe('An InMemoryDataAccessor', (): void => {
children.push(child);
}
expect(children).toHaveLength(1);
expect(children[0].identifier.value).toEqual(`${base}resource`);
expect(children[0].identifier.value).toBe(`${base}resource`);

await expect(accessor.getMetadata({ path: `${base}resource` }))
.resolves.toBeInstanceOf(RepresentationMetadata);
Expand Down
Loading

0 comments on commit 92bc844

Please sign in to comment.