@comunica/actor-query-result-serialize-simple 3.2.0 → 3.2.4-alpha.47.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.
|
@@ -79,6 +79,10 @@
|
|
|
79
79
|
{
|
|
80
80
|
"@type": "ParameterRangeGenericTypeReference",
|
|
81
81
|
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
85
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
82
86
|
}
|
|
83
87
|
]
|
|
84
88
|
},
|
|
@@ -93,6 +97,10 @@
|
|
|
93
97
|
{
|
|
94
98
|
"@type": "ParameterRangeGenericTypeReference",
|
|
95
99
|
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
103
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
96
104
|
}
|
|
97
105
|
]
|
|
98
106
|
},
|
|
@@ -102,6 +110,20 @@
|
|
|
102
110
|
},
|
|
103
111
|
"comment": "The bus this actor subscribes to."
|
|
104
112
|
},
|
|
113
|
+
{
|
|
114
|
+
"@id": "caqrss:components/ActorQueryResultSerializeSimple.jsonld#ActorQueryResultSerializeSimple_args_busFailMessage",
|
|
115
|
+
"range": {
|
|
116
|
+
"@type": "ParameterRangeUnion",
|
|
117
|
+
"parameterRangeElements": [
|
|
118
|
+
"xsd:string",
|
|
119
|
+
{
|
|
120
|
+
"@type": "ParameterRangeUndefined"
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
"default": "Query result serialization failed: none of the configured actors were able to serialize for type ${action.handle.type}",
|
|
125
|
+
"comment": "The message that will be configured in the bus for reporting failures. This message may be a template string that contains references to the executed `action`. For example, the following templated string is allowed: \"RDF dereferencing failed: no actors could handle ${action.handle.mediaType}\""
|
|
126
|
+
},
|
|
105
127
|
{
|
|
106
128
|
"@id": "caqrss:components/ActorQueryResultSerializeSimple.jsonld#ActorQueryResultSerializeSimple_args_beforeActors",
|
|
107
129
|
"range": {
|
|
@@ -124,6 +146,10 @@
|
|
|
124
146
|
{
|
|
125
147
|
"@type": "ParameterRangeGenericTypeReference",
|
|
126
148
|
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"@type": "ParameterRangeGenericTypeReference",
|
|
152
|
+
"parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
|
|
127
153
|
}
|
|
128
154
|
]
|
|
129
155
|
}
|
|
@@ -188,6 +214,12 @@
|
|
|
188
214
|
"@id": "caqrss:components/ActorQueryResultSerializeSimple.jsonld#ActorQueryResultSerializeSimple_args_bus"
|
|
189
215
|
}
|
|
190
216
|
},
|
|
217
|
+
{
|
|
218
|
+
"keyRaw": "busFailMessage",
|
|
219
|
+
"value": {
|
|
220
|
+
"@id": "caqrss:components/ActorQueryResultSerializeSimple.jsonld#ActorQueryResultSerializeSimple_args_busFailMessage"
|
|
221
|
+
}
|
|
222
|
+
},
|
|
191
223
|
{
|
|
192
224
|
"keyRaw": "beforeActors",
|
|
193
225
|
"value": {
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
"args_bus": {
|
|
26
26
|
"@id": "caqrss:components/ActorQueryResultSerializeSimple.jsonld#ActorQueryResultSerializeSimple_args_bus"
|
|
27
27
|
},
|
|
28
|
+
"args_busFailMessage": {
|
|
29
|
+
"@id": "caqrss:components/ActorQueryResultSerializeSimple.jsonld#ActorQueryResultSerializeSimple_args_busFailMessage"
|
|
30
|
+
},
|
|
28
31
|
"args_beforeActors": {
|
|
29
32
|
"@id": "caqrss:components/ActorQueryResultSerializeSimple.jsonld#ActorQueryResultSerializeSimple_args_beforeActors",
|
|
30
33
|
"@container": "@list"
|
|
@@ -46,6 +49,9 @@
|
|
|
46
49
|
"bus": {
|
|
47
50
|
"@id": "caqrss:components/ActorQueryResultSerializeSimple.jsonld#ActorQueryResultSerializeSimple_args_bus"
|
|
48
51
|
},
|
|
52
|
+
"busFailMessage": {
|
|
53
|
+
"@id": "caqrss:components/ActorQueryResultSerializeSimple.jsonld#ActorQueryResultSerializeSimple_args_busFailMessage"
|
|
54
|
+
},
|
|
49
55
|
"beforeActors": {
|
|
50
56
|
"@id": "caqrss:components/ActorQueryResultSerializeSimple.jsonld#ActorQueryResultSerializeSimple_args_beforeActors",
|
|
51
57
|
"@container": "@list"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IActionSparqlSerialize, IActorQueryResultSerializeFixedMediaTypesArgs, IActorQueryResultSerializeOutput } from '@comunica/bus-query-result-serialize';
|
|
2
2
|
import { ActorQueryResultSerializeFixedMediaTypes } from '@comunica/bus-query-result-serialize';
|
|
3
|
+
import type { TestResult } from '@comunica/core';
|
|
3
4
|
import type { IActionContext } from '@comunica/types';
|
|
4
5
|
import type * as RDF from '@rdfjs/types';
|
|
5
6
|
/**
|
|
@@ -12,7 +13,7 @@ export declare class ActorQueryResultSerializeSimple extends ActorQueryResultSer
|
|
|
12
13
|
* \ @defaultNested {{ "simple": "https://comunica.linkeddatafragments.org/#results_simple" }} mediaTypeFormats
|
|
13
14
|
*/
|
|
14
15
|
constructor(args: IActorQueryResultSerializeFixedMediaTypesArgs);
|
|
15
|
-
testHandleChecked(action: IActionSparqlSerialize, _context: IActionContext): Promise<boolean
|
|
16
|
+
testHandleChecked(action: IActionSparqlSerialize, _context: IActionContext): Promise<TestResult<boolean>>;
|
|
16
17
|
protected static termToString(term: RDF.Term): string;
|
|
17
18
|
runHandle(action: IActionSparqlSerialize, _mediaType: string, _context: IActionContext): Promise<IActorQueryResultSerializeOutput>;
|
|
18
19
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ActorQueryResultSerializeSimple = void 0;
|
|
4
4
|
const bus_query_result_serialize_1 = require("@comunica/bus-query-result-serialize");
|
|
5
|
+
const core_1 = require("@comunica/core");
|
|
5
6
|
const asynciterator_1 = require("asynciterator");
|
|
6
7
|
const rdf_string_1 = require("rdf-string");
|
|
7
8
|
const readable_stream_1 = require("readable-stream");
|
|
@@ -19,9 +20,9 @@ class ActorQueryResultSerializeSimple extends bus_query_result_serialize_1.Actor
|
|
|
19
20
|
}
|
|
20
21
|
async testHandleChecked(action, _context) {
|
|
21
22
|
if (!['bindings', 'quads', 'boolean', 'void'].includes(action.type)) {
|
|
22
|
-
|
|
23
|
+
return (0, core_1.failTest)('This actor can only handle bindings streams, quad streams, booleans, or updates.');
|
|
23
24
|
}
|
|
24
|
-
return
|
|
25
|
+
return (0, core_1.passTestVoid)();
|
|
25
26
|
}
|
|
26
27
|
static termToString(term) {
|
|
27
28
|
return term.termType === 'Quad' ? (0, rdf_string_1.termToString)(term) : term.value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActorQueryResultSerializeSimple.js","sourceRoot":"","sources":["ActorQueryResultSerializeSimple.ts"],"names":[],"mappings":";;;AAKA,qFAAgG;
|
|
1
|
+
{"version":3,"file":"ActorQueryResultSerializeSimple.js","sourceRoot":"","sources":["ActorQueryResultSerializeSimple.ts"],"names":[],"mappings":";;;AAKA,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AAK,OAAO,EAAE,CAAC;YACnC,IAAI,CAAC,IAAI,CAAoC,MAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CACzE,YAAY,+BAA+B,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI;gBAC1E,cAAc,+BAA+B,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI;gBAC9E,WAAW,+BAA+B,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;gBACxE,UAAU,+BAA+B,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAC/E,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAO,IAAA,oBAAI,EAClB,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;gBACS,MAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAE,GAAG,KAAK,IAAI,CAAE,CAAC,CAAC,CAAC;gBACvD,MAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAE,MAAM,CAAE,CAAC,CACzE,CAAC,CAAC;QACL,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,CAAC;IAClB,CAAC;CACF;AA/CD,0EA+CC","sourcesContent":["import type {\n IActionSparqlSerialize,\n IActorQueryResultSerializeFixedMediaTypesArgs,\n IActorQueryResultSerializeOutput,\n} from '@comunica/bus-query-result-serialize';\nimport { ActorQueryResultSerializeFixedMediaTypes } from '@comunica/bus-query-result-serialize';\nimport type { TestResult } from '@comunica/core';\nimport { failTest, passTestVoid } from '@comunica/core';\nimport type {\n IActionContext,\n IQueryOperationResultBindings,\n IQueryOperationResultBoolean,\n IQueryOperationResultQuads,\n IQueryOperationResultVoid,\n} from '@comunica/types';\nimport type * as RDF from '@rdfjs/types';\nimport { wrap } from 'asynciterator';\nimport { termToString } from 'rdf-string';\nimport { Readable } from 'readable-stream';\n\n/**\n * A comunica Simple Sparql Serialize Actor.\n */\nexport class ActorQueryResultSerializeSimple extends ActorQueryResultSerializeFixedMediaTypes {\n /**\n * @param args -\n * \\ @defaultNested {{ \"simple\": 0.9 }} mediaTypePriorities\n * \\ @defaultNested {{ \"simple\": \"https://comunica.linkeddatafragments.org/#results_simple\" }} mediaTypeFormats\n */\n public constructor(args: IActorQueryResultSerializeFixedMediaTypesArgs) {\n super(args);\n }\n\n public override async testHandleChecked(\n action: IActionSparqlSerialize,\n _context: IActionContext,\n ): Promise<TestResult<boolean>> {\n if (![ 'bindings', 'quads', 'boolean', 'void' ].includes(action.type)) {\n return failTest('This actor can only handle bindings streams, quad streams, booleans, or updates.');\n }\n return passTestVoid();\n }\n\n protected static termToString(term: RDF.Term): string {\n return term.termType === 'Quad' ? termToString(term) : term.value;\n }\n\n public async runHandle(action: IActionSparqlSerialize, _mediaType: string, _context: IActionContext):\n Promise<IActorQueryResultSerializeOutput> {\n const data = new Readable();\n if (action.type === 'bindings') {\n data.wrap(<any> (<IQueryOperationResultBindings>action).bindingsStream.map((bindings: RDF.Bindings) => `${[ ...bindings ].map(\n ([ key, value ]) => `?${key.value}: ${ActorQueryResultSerializeSimple.termToString(value)}`,\n ).join('\\n')}\\n\\n`));\n } else if (action.type === 'quads') {\n data.wrap(<any> (<IQueryOperationResultQuads>action).quadStream.map(quad =>\n `subject: ${ActorQueryResultSerializeSimple.termToString(quad.subject)}\\n` +\n `predicate: ${ActorQueryResultSerializeSimple.termToString(quad.predicate)}\\n` +\n `object: ${ActorQueryResultSerializeSimple.termToString(quad.object)}\\n` +\n `graph: ${ActorQueryResultSerializeSimple.termToString(quad.graph)}\\n\\n`));\n } else {\n data.wrap(<any> wrap(\n action.type === 'boolean' ?\n (<IQueryOperationResultBoolean> action).execute().then(value => [ `${value}\\n` ]) :\n (<IQueryOperationResultVoid>action).execute().then(() => [ 'ok\\n' ]),\n ));\n }\n\n return { data };\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comunica/actor-query-result-serialize-simple",
|
|
3
|
-
"version": "3.2.0",
|
|
3
|
+
"version": "3.2.4-alpha.47.0",
|
|
4
4
|
"description": "A simple query-result-serialize actor",
|
|
5
5
|
"lsd:module": true,
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"funding": {
|
|
8
|
+
"type": "opencollective",
|
|
9
|
+
"url": "https://opencollective.com/comunica-association"
|
|
10
|
+
},
|
|
7
11
|
"homepage": "https://comunica.dev/",
|
|
8
12
|
"repository": {
|
|
9
13
|
"type": "git",
|
|
@@ -37,12 +41,13 @@
|
|
|
37
41
|
"build:components": "componentsjs-generator"
|
|
38
42
|
},
|
|
39
43
|
"dependencies": {
|
|
40
|
-
"@comunica/bus-query-result-serialize": "
|
|
41
|
-
"@comunica/
|
|
44
|
+
"@comunica/bus-query-result-serialize": "3.2.4-alpha.47.0",
|
|
45
|
+
"@comunica/core": "3.2.4-alpha.47.0",
|
|
46
|
+
"@comunica/types": "3.2.4-alpha.47.0",
|
|
42
47
|
"@rdfjs/types": "*",
|
|
43
48
|
"asynciterator": "^3.9.0",
|
|
44
49
|
"rdf-string": "^1.6.3",
|
|
45
|
-
"readable-stream": "^4.
|
|
50
|
+
"readable-stream": "^4.5.2"
|
|
46
51
|
},
|
|
47
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "85bd4c5cf07dfc293ebbc3a1416b70e2db8bfc48"
|
|
48
53
|
}
|