@comunica/actor-init-query 2.2.0 → 2.2.2-alpha.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ActorInitQuery.jsonld +6 -2
- package/components/ActorInitQueryBase.jsonld +7 -3
- package/components/HttpServiceSparqlEndpoint.jsonld +4 -0
- package/lib/ActorInitQueryBase.d.ts +6 -2
- package/lib/HttpServiceSparqlEndpoint.d.ts +5 -0
- package/lib/HttpServiceSparqlEndpoint.js +10 -0
- package/lib/cli/CliArgsHandlerBase.js +27 -0
- package/lib/cli/CliArgsHandlerHttp.js +5 -0
- package/package.json +16 -18
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"@context": [
|
|
3
3
|
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-init-query/^2.0.0/components/context.jsonld",
|
|
4
4
|
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^2.0.0/components/context.jsonld",
|
|
5
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/types/^2.0.0/components/context.jsonld",
|
|
5
6
|
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-init/^2.0.0/components/context.jsonld"
|
|
6
7
|
],
|
|
7
8
|
"@id": "npmd:@comunica/actor-init-query",
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
},
|
|
58
59
|
{
|
|
59
60
|
"@id": "caiq:components/ActorInitQuery.jsonld#ActorInitQuery_args_logger",
|
|
60
|
-
"range": "
|
|
61
|
+
"range": "ct:components/Logger.jsonld#Logger",
|
|
61
62
|
"default": {
|
|
62
63
|
"@type": "npmd:@comunica/logger-void/^2.0.0/components/LoggerVoid.jsonld#LoggerVoid"
|
|
63
64
|
},
|
|
@@ -122,11 +123,14 @@
|
|
|
122
123
|
"lenient": "@comunica/actor-init-query:lenient",
|
|
123
124
|
"httpIncludeCredentials": "@comunica/bus-http:include-credentials",
|
|
124
125
|
"httpAuth": "@comunica/bus-http:auth",
|
|
126
|
+
"httpTimeout": "@comunica/bus-http:http-timeout",
|
|
127
|
+
"httpBodyTimeout": "@comunica/bus-http:http-body-timeout",
|
|
125
128
|
"fetch": "@comunica/bus-http:fetch",
|
|
126
129
|
"readOnly": "@comunica/bus-query-operation:readOnly",
|
|
127
130
|
"extensionFunctions": "@comunica/actor-init-query:extensionFunctions",
|
|
128
131
|
"extensionFunctionCreator": "@comunica/actor-init-query:extensionFunctionCreator",
|
|
129
|
-
"explain": "@comunica/actor-init-query:explain"
|
|
132
|
+
"explain": "@comunica/actor-init-query:explain",
|
|
133
|
+
"unionDefaultGraph": "@comunica/bus-query-operation:unionDefaultGraph"
|
|
130
134
|
}
|
|
131
135
|
},
|
|
132
136
|
"comment": "A record of context shortcuts to full context keys (as defined in @comunica/context-entries)."
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"@context": [
|
|
3
3
|
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-init-query/^2.0.0/components/context.jsonld",
|
|
4
4
|
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^2.0.0/components/context.jsonld",
|
|
5
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/types/^2.0.0/components/context.jsonld",
|
|
5
6
|
"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-init/^2.0.0/components/context.jsonld"
|
|
6
7
|
],
|
|
7
8
|
"@id": "npmd:@comunica/actor-init-query",
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
},
|
|
59
60
|
{
|
|
60
61
|
"@id": "caiq:components/ActorInitQueryBase.jsonld#ActorInitQueryBase_args_logger",
|
|
61
|
-
"range": "
|
|
62
|
+
"range": "ct:components/Logger.jsonld#Logger",
|
|
62
63
|
"default": {
|
|
63
64
|
"@type": "npmd:@comunica/logger-void/^2.0.0/components/LoggerVoid.jsonld#LoggerVoid"
|
|
64
65
|
},
|
|
@@ -123,11 +124,14 @@
|
|
|
123
124
|
"lenient": "@comunica/actor-init-query:lenient",
|
|
124
125
|
"httpIncludeCredentials": "@comunica/bus-http:include-credentials",
|
|
125
126
|
"httpAuth": "@comunica/bus-http:auth",
|
|
127
|
+
"httpTimeout": "@comunica/bus-http:http-timeout",
|
|
128
|
+
"httpBodyTimeout": "@comunica/bus-http:http-body-timeout",
|
|
126
129
|
"fetch": "@comunica/bus-http:fetch",
|
|
127
130
|
"readOnly": "@comunica/bus-query-operation:readOnly",
|
|
128
131
|
"extensionFunctions": "@comunica/actor-init-query:extensionFunctions",
|
|
129
132
|
"extensionFunctionCreator": "@comunica/actor-init-query:extensionFunctionCreator",
|
|
130
|
-
"explain": "@comunica/actor-init-query:explain"
|
|
133
|
+
"explain": "@comunica/actor-init-query:explain",
|
|
134
|
+
"unionDefaultGraph": "@comunica/bus-query-operation:unionDefaultGraph"
|
|
131
135
|
}
|
|
132
136
|
},
|
|
133
137
|
"comment": "A record of context shortcuts to full context keys (as defined in @comunica/context-entries)."
|
|
@@ -262,7 +266,7 @@
|
|
|
262
266
|
{
|
|
263
267
|
"@id": "caiq:components/ActorInitQueryBase.jsonld#ActorInitQueryBase__member_logger",
|
|
264
268
|
"memberFieldName": "logger",
|
|
265
|
-
"range": "
|
|
269
|
+
"range": "ct:components/Logger.jsonld#Logger"
|
|
266
270
|
},
|
|
267
271
|
{
|
|
268
272
|
"@id": "caiq:components/ActorInitQueryBase.jsonld#ActorInitQueryBase__member_queryString",
|
|
@@ -47,6 +47,10 @@
|
|
|
47
47
|
"@id": "caiq:components/HttpServiceSparqlEndpoint.jsonld#IHttpServiceSparqlEndpointArgs__member_invalidateCacheBeforeQuery",
|
|
48
48
|
"memberFieldName": "invalidateCacheBeforeQuery"
|
|
49
49
|
},
|
|
50
|
+
{
|
|
51
|
+
"@id": "caiq:components/HttpServiceSparqlEndpoint.jsonld#IHttpServiceSparqlEndpointArgs__member_freshWorkerPerQuery",
|
|
52
|
+
"memberFieldName": "freshWorkerPerQuery"
|
|
53
|
+
},
|
|
50
54
|
{
|
|
51
55
|
"@id": "caiq:components/HttpServiceSparqlEndpoint.jsonld#IHttpServiceSparqlEndpointArgs__member_moduleRootPath",
|
|
52
56
|
"memberFieldName": "moduleRootPath"
|
|
@@ -6,7 +6,8 @@ import type { MediatorOptimizeQueryOperation } from '@comunica/bus-optimize-quer
|
|
|
6
6
|
import type { MediatorQueryOperation } from '@comunica/bus-query-operation';
|
|
7
7
|
import type { MediatorQueryParse } from '@comunica/bus-query-parse';
|
|
8
8
|
import type { MediatorQueryResultSerializeHandle, MediatorQueryResultSerializeMediaTypes, MediatorQueryResultSerializeMediaTypeFormats } from '@comunica/bus-query-result-serialize';
|
|
9
|
-
import type { IActorTest
|
|
9
|
+
import type { IActorTest } from '@comunica/core';
|
|
10
|
+
import type { Logger } from '@comunica/types';
|
|
10
11
|
/**
|
|
11
12
|
* A browser-safe comunica Query Init Actor.
|
|
12
13
|
*/
|
|
@@ -96,11 +97,14 @@ export interface IActorInitQueryBaseArgs extends IActorInitArgs {
|
|
|
96
97
|
* "lenient": "@comunica/actor-init-query:lenient",
|
|
97
98
|
* "httpIncludeCredentials": "@comunica/bus-http:include-credentials",
|
|
98
99
|
* "httpAuth": "@comunica/bus-http:auth",
|
|
100
|
+
* "httpTimeout": "@comunica/bus-http:http-timeout",
|
|
101
|
+
* "httpBodyTimeout": "@comunica/bus-http:http-body-timeout",
|
|
99
102
|
* "fetch": "@comunica/bus-http:fetch",
|
|
100
103
|
* "readOnly": "@comunica/bus-query-operation:readOnly",
|
|
101
104
|
* "extensionFunctions": "@comunica/actor-init-query:extensionFunctions",
|
|
102
105
|
* "extensionFunctionCreator": "@comunica/actor-init-query:extensionFunctionCreator",
|
|
103
|
-
* "explain": "@comunica/actor-init-query:explain"
|
|
106
|
+
* "explain": "@comunica/actor-init-query:explain",
|
|
107
|
+
* "unionDefaultGraph": "@comunica/bus-query-operation:unionDefaultGraph"
|
|
104
108
|
* }}
|
|
105
109
|
*/
|
|
106
110
|
contextKeyShortcuts: Record<string, string>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
/// <reference types="node" />
|
|
2
5
|
import type { EventEmitter } from 'events';
|
|
3
6
|
import * as http from 'http';
|
|
4
7
|
import type { Writable } from 'stream';
|
|
@@ -17,6 +20,7 @@ export declare class HttpServiceSparqlEndpoint {
|
|
|
17
20
|
readonly port: number;
|
|
18
21
|
readonly workers: number;
|
|
19
22
|
readonly invalidateCacheBeforeQuery: boolean;
|
|
23
|
+
readonly freshWorkerPerQuery: boolean;
|
|
20
24
|
constructor(args: IHttpServiceSparqlEndpointArgs);
|
|
21
25
|
/**
|
|
22
26
|
* Starts the server
|
|
@@ -108,6 +112,7 @@ export interface IHttpServiceSparqlEndpointArgs extends IDynamicQueryEngineOptio
|
|
|
108
112
|
port?: number;
|
|
109
113
|
workers?: number;
|
|
110
114
|
invalidateCacheBeforeQuery?: boolean;
|
|
115
|
+
freshWorkerPerQuery?: boolean;
|
|
111
116
|
moduleRootPath: string;
|
|
112
117
|
defaultConfigPath: string;
|
|
113
118
|
}
|
|
@@ -23,6 +23,7 @@ class HttpServiceSparqlEndpoint {
|
|
|
23
23
|
this.port = args.port ?? 3000;
|
|
24
24
|
this.workers = args.workers ?? 1;
|
|
25
25
|
this.invalidateCacheBeforeQuery = Boolean(args.invalidateCacheBeforeQuery);
|
|
26
|
+
this.freshWorkerPerQuery = Boolean(args.freshWorkerPerQuery);
|
|
26
27
|
this.engine = new __1.QueryEngineFactoryBase(args.moduleRootPath, args.defaultConfigPath, actorInitQuery => new __1.QueryEngineBase(actorInitQuery)).create(args);
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
@@ -90,6 +91,7 @@ class HttpServiceSparqlEndpoint {
|
|
|
90
91
|
exit(1);
|
|
91
92
|
}
|
|
92
93
|
const invalidateCacheBeforeQuery = args.invalidateCache;
|
|
94
|
+
const freshWorkerPerQuery = args.freshWorker;
|
|
93
95
|
const port = args.port;
|
|
94
96
|
const timeout = args.timeout * 1000;
|
|
95
97
|
const workers = args.workers;
|
|
@@ -100,6 +102,7 @@ class HttpServiceSparqlEndpoint {
|
|
|
100
102
|
configPath,
|
|
101
103
|
context,
|
|
102
104
|
invalidateCacheBeforeQuery,
|
|
105
|
+
freshWorkerPerQuery,
|
|
103
106
|
moduleRootPath,
|
|
104
107
|
mainModulePath: moduleRootPath,
|
|
105
108
|
port,
|
|
@@ -383,6 +386,8 @@ class HttpServiceSparqlEndpoint {
|
|
|
383
386
|
*/
|
|
384
387
|
stopResponse(response, eventEmitter) {
|
|
385
388
|
response.on('close', killClient);
|
|
389
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias,consistent-this
|
|
390
|
+
const self = this;
|
|
386
391
|
function killClient() {
|
|
387
392
|
if (eventEmitter) {
|
|
388
393
|
// Remove all listeners so we are sure no more write calls are made
|
|
@@ -395,6 +400,11 @@ class HttpServiceSparqlEndpoint {
|
|
|
395
400
|
catch {
|
|
396
401
|
// Do nothing
|
|
397
402
|
}
|
|
403
|
+
// Kill the worker if we want fresh workers per query
|
|
404
|
+
if (self.freshWorkerPerQuery) {
|
|
405
|
+
// eslint-disable-next-line unicorn/no-process-exit
|
|
406
|
+
process.exit(9);
|
|
407
|
+
}
|
|
398
408
|
}
|
|
399
409
|
}
|
|
400
410
|
/**
|
|
@@ -103,6 +103,18 @@ class CliArgsHandlerBase {
|
|
|
103
103
|
type: 'boolean',
|
|
104
104
|
describe: 'Prints the full stacktrace when errors are thrown',
|
|
105
105
|
},
|
|
106
|
+
httpTimeout: {
|
|
107
|
+
type: 'number',
|
|
108
|
+
describe: 'HTTP requests timeout in milliseconds',
|
|
109
|
+
},
|
|
110
|
+
httpBodyTimeout: {
|
|
111
|
+
type: 'boolean',
|
|
112
|
+
describe: 'Makes the HTTP timeout take into account the response body stream read',
|
|
113
|
+
},
|
|
114
|
+
unionDefaultGraph: {
|
|
115
|
+
type: 'boolean',
|
|
116
|
+
describe: 'If the default graph should also contain the union of all named graphs',
|
|
117
|
+
},
|
|
106
118
|
})
|
|
107
119
|
.exitProcess(false)
|
|
108
120
|
.fail(false)
|
|
@@ -164,6 +176,21 @@ class CliArgsHandlerBase {
|
|
|
164
176
|
if (args.lenient) {
|
|
165
177
|
context[context_entries_1.KeysInitQuery.lenient.name] = true;
|
|
166
178
|
}
|
|
179
|
+
// Define HTTP timeout
|
|
180
|
+
if (args.httpTimeout) {
|
|
181
|
+
context[context_entries_1.KeysHttp.httpTimeout.name] = args.httpTimeout;
|
|
182
|
+
}
|
|
183
|
+
// Define HTTP body timeout
|
|
184
|
+
if (args.httpBodyTimeout) {
|
|
185
|
+
if (!args.httpTimeout) {
|
|
186
|
+
throw new Error('The --httpBodyTimeout option requires the --httpTimeout option to be set');
|
|
187
|
+
}
|
|
188
|
+
context[context_entries_1.KeysHttp.httpBodyTimeout.name] = args.httpBodyTimeout;
|
|
189
|
+
}
|
|
190
|
+
// Define union default graph
|
|
191
|
+
if (args.unionDefaultGraph) {
|
|
192
|
+
context[context_entries_1.KeysQueryOperation.unionDefaultGraph.name] = true;
|
|
193
|
+
}
|
|
167
194
|
}
|
|
168
195
|
}
|
|
169
196
|
exports.CliArgsHandlerBase = CliArgsHandlerBase;
|
|
@@ -48,6 +48,11 @@ class CliArgsHandlerHttp {
|
|
|
48
48
|
describe: 'Enable cache invalidation before each query execution',
|
|
49
49
|
default: false,
|
|
50
50
|
},
|
|
51
|
+
freshWorker: {
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
describe: 'Kills the worker after each query execution',
|
|
54
|
+
default: false,
|
|
55
|
+
},
|
|
51
56
|
})
|
|
52
57
|
.check(args => {
|
|
53
58
|
if (args.version) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-init-query",
|
|
3
|
-
"version": "2.2.0",
|
|
3
|
+
"version": "2.2.2-alpha.13.0",
|
|
4
4
|
"description": "A query init actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -31,27 +31,25 @@
|
|
|
31
31
|
"lib/**/*.js"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@comunica/actor-http-proxy": "
|
|
35
|
-
"@comunica/
|
|
36
|
-
"@comunica/bus-
|
|
37
|
-
"@comunica/bus-
|
|
38
|
-
"@comunica/bus-
|
|
39
|
-
"@comunica/bus-
|
|
40
|
-
"@comunica/bus-query-
|
|
41
|
-
"@comunica/bus-query-
|
|
42
|
-
"@comunica/
|
|
43
|
-
"@comunica/
|
|
44
|
-
"@comunica/
|
|
45
|
-
"@comunica/
|
|
46
|
-
"@comunica/
|
|
47
|
-
"@comunica/types": "^2.2.0",
|
|
34
|
+
"@comunica/actor-http-proxy": "2.2.2-alpha.13.0",
|
|
35
|
+
"@comunica/bus-context-preprocess": "2.2.2-alpha.13.0",
|
|
36
|
+
"@comunica/bus-http-invalidate": "2.2.2-alpha.13.0",
|
|
37
|
+
"@comunica/bus-init": "2.2.2-alpha.13.0",
|
|
38
|
+
"@comunica/bus-optimize-query-operation": "2.2.2-alpha.13.0",
|
|
39
|
+
"@comunica/bus-query-operation": "2.2.2-alpha.13.0",
|
|
40
|
+
"@comunica/bus-query-parse": "2.2.2-alpha.13.0",
|
|
41
|
+
"@comunica/bus-query-result-serialize": "2.2.2-alpha.13.0",
|
|
42
|
+
"@comunica/context-entries": "2.2.2-alpha.13.0",
|
|
43
|
+
"@comunica/core": "2.2.2-alpha.13.0",
|
|
44
|
+
"@comunica/logger-pretty": "2.2.2-alpha.13.0",
|
|
45
|
+
"@comunica/runner": "2.2.2-alpha.13.0",
|
|
46
|
+
"@comunica/types": "2.2.2-alpha.13.0",
|
|
48
47
|
"@rdfjs/types": "*",
|
|
49
48
|
"@types/yargs": "^17.0.2",
|
|
50
|
-
"asynciterator": "^3.
|
|
49
|
+
"asynciterator": "^3.4.2",
|
|
51
50
|
"negotiate": "^1.0.1",
|
|
52
51
|
"rdf-quad": "^1.4.0",
|
|
53
52
|
"rdf-string": "^1.5.0",
|
|
54
|
-
"rdf-terms": "^1.6.2",
|
|
55
53
|
"sparqlalgebrajs": "^4.0.0",
|
|
56
54
|
"streamify-string": "^1.0.1",
|
|
57
55
|
"yargs": "^17.1.1"
|
|
@@ -64,5 +62,5 @@
|
|
|
64
62
|
"browser": {
|
|
65
63
|
"./lib/index.js": "./lib/index-browser.js"
|
|
66
64
|
},
|
|
67
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "f3a79b04bcf5f96767847cc335145491ccba68ff"
|
|
68
66
|
}
|