Skip to content

Commit

Permalink
Update to Comunica v4 prerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Oct 8, 2024
1 parent 6b926ef commit e6a3e50
Show file tree
Hide file tree
Showing 17 changed files with 4,799 additions and 1,972 deletions.
6 changes: 0 additions & 6 deletions .github/get-next-alpha-version.sh

This file was deleted.

20 changes: 0 additions & 20 deletions .github/typedoc-json.sh

This file was deleted.

Empty file.
12 changes: 10 additions & 2 deletions engines/config-query-sparql-solid/config/config-default.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
{
"@context": [
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/config-query-sparql/^3.0.0/components/context.jsonld",
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/config-query-sparql/^4.0.0/components/context.jsonld",
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/config-query-sparql-solid/^3.0.0/components/context.jsonld"
],
"import": [
"ccqs:config/bindings-aggregator-factory/actors.json",
"ccqs:config/bindings-aggregator-factory/mediators.json",
"ccqs:config/context-preprocess/actors.json",
"ccqs:config/context-preprocess/mediators.json",
"ccqs:config/expression-evaluator-factory/actors.json",
"ccqs:config/expression-evaluator-factory/mediators.json",
"ccqs:config/function-factory/actors.json",
"ccqs:config/function-factory/mediators.json",
"ccqs:config/hash-bindings/actors.json",
"ccqs:config/hash-bindings/mediators.json",
"ccqs:config/hash-quads/actors.json",
Expand Down Expand Up @@ -59,6 +65,8 @@
"ccqs:config/rdf-update-hypermedia/actors.json",
"ccqs:config/rdf-update-hypermedia/mediators.json",
"ccqs:config/rdf-update-quads/actors.json",
"ccqs:config/rdf-update-quads/mediators.json"
"ccqs:config/rdf-update-quads/mediators.json",
"ccqs:config/term-comparator-factory/actors.json",
"ccqs:config/term-comparator-factory/mediators.json"
]
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"@context": [
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/runner/^3.0.0/components/context.jsonld",
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/runner/^4.0.0/components/context.jsonld",

"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-inrupt-solid-client-authn/^3.0.0/components/context.jsonld",
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-fetch/^3.0.0/components/context.jsonld",
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-proxy/^3.0.0/components/context.jsonld"
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-fetch/^4.0.0/components/context.jsonld",
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-proxy/^4.0.0/components/context.jsonld"
],
"@id": "urn:comunica:default:Runner",
"@type": "Runner",
Expand Down
2 changes: 1 addition & 1 deletion engines/config-query-sparql-solid/config/http/actors.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@context": [
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/config-query-sparql/^3.0.0/components/context.jsonld",
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/config-query-sparql/^4.0.0/components/context.jsonld",
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/config-query-sparql-solid/^3.0.0/components/context.jsonld"
],
"import": [
Expand Down
6 changes: 5 additions & 1 deletion engines/config-query-sparql-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"description": "default configuration files for Comunica SPARQL Solid",
"lsd:module": true,
"license": "MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/comunica-association"
},
"homepage": "https://comunica.dev/",
"repository": {
"type": "git",
Expand Down Expand Up @@ -41,6 +45,6 @@
"build:components": "componentsjs-generator"
},
"dependencies": {
"@comunica/config-query-sparql": "~3.2.1"
"@comunica/config-query-sparql": "~4.0.1-alpha.48.0"
}
}
Empty file.
396 changes: 247 additions & 149 deletions engines/query-sparql-solid/package.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
"npmClient": "yarn",
"npmClientArgs": [
"--frozen-lockfile"
]
],
"lerna-script-tasks": "./node_modules/@comunica/utils-monorepo/lib/depCheck.js"
}
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
"test-ci": "jest --ci --maxWorkers=4 --coverage",
"lint": "eslint . --cache",
"clean": "rm -rf ./node_modules && rm -rf ./packages/*/node_modules",
"depcheck": "lerna-script depcheckTask",
"depcheck:fix": "lerna-script depfixTask",
"ncu:all": "lerna-script updateTask",
"ncu:major:all": "lerna-script updateTaskMajor",
"build": "yarn run build:ts && yarn run build:components",
"build:ts": "tsc",
"build:components": "componentsjs-generator engines/* packages/*",
Expand All @@ -23,29 +27,34 @@
"publish": "yarn run build",
"publish-release": "lerna publish",
"publish-bare": "lerna exec -- npm publish --silent",
"publish-canary": "yarn run build && lerna version prerelease --preid alpha.$(.github/get-next-alpha-version.sh) --exact --ignore-scripts --force-publish --no-push --no-git-tag-version --yes && git update-index --assume-unchanged $(git ls-files | tr '\\n' ' ') && lerna publish from-package --no-git-reset --pre-dist-tag next --force-publish --no-push --no-git-tag-version --yes && git update-index --no-assume-unchanged $(git ls-files | tr '\\n' ' ') && git checkout .",
"doc": "./.github/typedoc-json.sh create && typedoc && ./.github/typedoc-json.sh remove",
"publish-canary": "yarn run build && lerna version prerelease --preid alpha.$(packages/utils-monorepo/sh/get-next-alpha-version.sh @comunica/core) --exact --ignore-scripts --force-publish --no-push --no-git-tag-version --yes && git update-index --assume-unchanged $(git ls-files | tr '\\n' ' ') && lerna publish from-package --no-git-reset --pre-dist-tag next --force-publish --no-push --no-git-tag-version --yes && git update-index --no-assume-unchanged $(git ls-files | tr '\\n' ' ') && git checkout .",
"doc": "packages/utils-monorepo/sh/typedoc-json.sh create && typedoc && packages/utils-monorepo/sh/typedoc-json.sh remove",
"postinstall": "yarn run build && lerna run prepare",
"version": "manual-git-changelog onversion"
},
"devDependencies": {
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.4",
"@comunica/utils-jest": "4.0.1-alpha.48.0",
"@comunica/utils-monorepo": "4.0.1-alpha.48.0",
"@rubensworks/eslint-config": "^3.0.0",
"@types/jest": "^29.0.0",
"@types/node": "^20.0.0",
"asynciterator": "^3.2.1",
"babel-loader": "^9.0.0",
"componentsjs-generator": "^4.0.1",
"cross-fetch": "^4.0.0",
"depcheck": "^1.4.3",
"eslint": "^8.57.0",
"husky": "^9.0.0",
"immutable": "^4.0.0",
"jest": "^29.0.0",
"jest-rdf": "^1.7.0",
"lerna": "^8.0.0",
"lerna-script": "^1.4.0",
"manual-git-changelog": "^1.0.0",
"nodemon": "^3.0.0",
"npm-check-updates": "^17.0.0",
"rdf-data-factory": "^1.1.0",
"rdf-quad": "^1.5.0",
"sparqlalgebrajs": "^4.0.0",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import type { IActionHttp, IActorHttpOutput } from '@comunica/bus-http';
import { ActorHttp } from '@comunica/bus-http';
import { KeysHttp } from '@comunica/context-entries';
import type { IActorArgs, IActorTest, Mediator } from '@comunica/core';
import { ActionContextKey } from '@comunica/core';
import { failTest, passTestVoid, ActionContextKey } from '@comunica/core';
import type { TestResult } from '@comunica/core/lib/TestResult';
import type { Session } from '@rubensworks/solid-client-authn-isomorphic';

/**
Expand All @@ -18,18 +19,18 @@ export class ActorHttpInruptSolidClientAuthn extends ActorHttp {
super(args);
}

public async test(action: IActionHttp): Promise<IActorTest> {
public async test(action: IActionHttp): Promise<TestResult<IActorTest>> {
if (!action.context || !action.context.has(ActorHttpInruptSolidClientAuthn.CONTEXT_KEY_SESSION)) {
throw new Error(`Unable to find Solid authn session in context with key '${ActorHttpInruptSolidClientAuthn.CONTEXT_KEY_SESSION.name}'`);
return failTest(`Unable to find Solid authn session in context with key '${ActorHttpInruptSolidClientAuthn.CONTEXT_KEY_SESSION.name}'`);
}
if (action.context.has(KeysHttp.fetch)) {
throw new Error(`Unable to run when a custom fetch function has been configured`);
return failTest(`Unable to run when a custom fetch function has been configured`);
}
const session: Session = action.context.get(ActorHttpInruptSolidClientAuthn.CONTEXT_KEY_SESSION)!;
if (!session.info.isLoggedIn) {
throw new Error(`The provided Solid authn session is not in a logged in state, make sure to call session.login() first`);
return failTest(`The provided Solid authn session is not in a logged in state, make sure to call session.login() first`);
}
return true;
return passTestVoid();
}

public async run(action: IActionHttp): Promise<IActorHttpOutput> {
Expand Down
10 changes: 7 additions & 3 deletions packages/actor-http-inrupt-solid-client-authn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"description": "A inrupt-solid-client-authn http actor",
"lsd:module": true,
"license": "MIT",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/comunica-association"
},
"homepage": "https://comunica.dev/",
"repository": {
"type": "git",
Expand Down Expand Up @@ -37,9 +41,9 @@
"build:components": "componentsjs-generator"
},
"dependencies": {
"@comunica/bus-http": "^3.2.1",
"@comunica/context-entries": "^3.2.1",
"@comunica/core": "^3.2.1",
"@comunica/bus-http": "4.0.1-alpha.48.0",
"@comunica/context-entries": "4.0.1-alpha.48.0",
"@comunica/core": "4.0.1-alpha.48.0",
"@rubensworks/solid-client-authn-isomorphic": "^2.0.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { KeysCore, KeysHttp } from '@comunica/context-entries';
import { ActionContext, Bus } from '@comunica/core';
import { LoggerVoid } from '@comunica/logger-void';
import type { Session } from '@rubensworks/solid-client-authn-isomorphic';
import '@comunica/utils-jest';
import { ActorHttpInruptSolidClientAuthn } from '../lib/ActorHttpInruptSolidClientAuthn';
import 'cross-fetch/polyfill';

Expand Down Expand Up @@ -40,29 +41,29 @@ describe('ActorHttpInruptSolidClientAuthn', () => {
});

it('should not test with empty context', async() => {
await expect(actor.test({ input: 'DUMMY', context: new ActionContext({}) })).rejects
.toThrow(`Unable to find Solid authn session in context with key '@comunica/actor-http-inrupt-solid-client-authn:session'`);
await expect(actor.test({ input: 'DUMMY', context: new ActionContext({}) })).resolves
.toFailTest(`Unable to find Solid authn session in context with key '@comunica/actor-http-inrupt-solid-client-authn:session'`);
});

it('should not test with non-logged in session', async() => {
await expect(actor.test({ input: 'DUMMY', context: new ActionContext({
'@comunica/actor-http-inrupt-solid-client-authn:session': sessionNotLoggedIn,
}) })).rejects
.toThrow(`The provided Solid authn session is not in a logged in state, make sure to call session.login() first`);
}) })).resolves
.toFailTest(`The provided Solid authn session is not in a logged in state, make sure to call session.login() first`);
});

it('should not test with a fetch method', async() => {
await expect(actor.test({ input: 'DUMMY', context: new ActionContext({
'@comunica/actor-http-inrupt-solid-client-authn:session': sessionNotLoggedIn,
[KeysHttp.fetch.name]: true,
}) })).rejects
.toThrow(`Unable to run when a custom fetch function has been configured`);
}) })).resolves
.toFailTest(`Unable to run when a custom fetch function has been configured`);
});

it('should test with logged in session', async() => {
await expect(actor.test({ input: 'DUMMY', context: new ActionContext({
'@comunica/actor-http-inrupt-solid-client-authn:session': sessionLoggedIn,
}) })).resolves.toBeTruthy();
}) })).resolves.toPassTestVoid();
});

it('should run', async() => {
Expand Down
15 changes: 0 additions & 15 deletions packages/actor-init-sparql-solid/package.json

This file was deleted.

Loading

0 comments on commit e6a3e50

Please sign in to comment.