@comunica/actor-function-factory-expression-extensions 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.
package/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright © 2017–now Ruben Taelman, Joachim Van Herwegen
4
+ Comunica Association and Ghent University – imec, Belgium
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Comunica Expression Function Extensions Function Factory Actor
2
+
3
+ [![npm version](https://badge.fury.io/js/%40comunica%2Factor-function-factory-expression-function-extensions.svg)](https://www.npmjs.com/package/@comunica/actor-function-factory-expression-extensions)
4
+
5
+ A comunica Expression Function Extensions Function Factory Actor.
6
+
7
+ This module is part of the [Comunica framework](https://github.com/comunica/comunica),
8
+ and should only be used by [developers that want to build their own query engine](https://comunica.dev/docs/modify/).
9
+
10
+ [Click here if you just want to query with Comunica](https://comunica.dev/docs/query/).
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ $ yarn add @comunica/actor-function-factory-expression-extensions
16
+ ```
17
+
18
+ ## Configure
19
+
20
+ After installing, this package can be added to your engine's configuration as follows:
21
+ ```text
22
+ {
23
+ "@context": [
24
+ ...
25
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-function-factory-expression-extensions/^3.0.0/components/context.jsonld"
26
+ ],
27
+ "actors": [
28
+ ...
29
+ {
30
+ "@id": "urn:comunica:default:function-factory/actors#expression-function-extensions",
31
+ "@type": "ActorFunctionFactoryExpressionExtensions"
32
+ }
33
+ ]
34
+ }
35
+ ```
@@ -0,0 +1,176 @@
1
+ {
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-function-factory-expression-extensions/^3.0.0/components/context.jsonld",
4
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-function-factory/^3.0.0/components/context.jsonld",
5
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/core/^3.0.0/components/context.jsonld"
6
+ ],
7
+ "@id": "npmd:@comunica/actor-function-factory-expression-extensions",
8
+ "components": [
9
+ {
10
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions",
11
+ "@type": "Class",
12
+ "requireElement": "ActorFunctionFactoryExpressionExtensions",
13
+ "extends": [
14
+ "cbff:components/ActorFunctionFactory.jsonld#ActorFunctionFactory"
15
+ ],
16
+ "comment": "A comunica Expression Function Extensions Function Factory Actor.",
17
+ "parameters": [
18
+ {
19
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_name",
20
+ "range": "xsd:string",
21
+ "default": {
22
+ "@id": "rdf:subject"
23
+ },
24
+ "comment": "The name for this actor."
25
+ },
26
+ {
27
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_bus",
28
+ "range": {
29
+ "@type": "ParameterRangeGenericComponent",
30
+ "component": "cc:components/Bus.jsonld#Bus",
31
+ "genericTypeInstances": [
32
+ {
33
+ "@type": "ParameterRangeGenericComponent",
34
+ "component": "cc:components/Actor.jsonld#Actor",
35
+ "genericTypeInstances": [
36
+ {
37
+ "@type": "ParameterRangeGenericTypeReference",
38
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
39
+ },
40
+ {
41
+ "@type": "ParameterRangeGenericTypeReference",
42
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
43
+ },
44
+ {
45
+ "@type": "ParameterRangeGenericTypeReference",
46
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
47
+ },
48
+ {
49
+ "@type": "ParameterRangeGenericTypeReference",
50
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
51
+ }
52
+ ]
53
+ },
54
+ {
55
+ "@type": "ParameterRangeGenericTypeReference",
56
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
57
+ },
58
+ {
59
+ "@type": "ParameterRangeGenericTypeReference",
60
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
61
+ },
62
+ {
63
+ "@type": "ParameterRangeGenericTypeReference",
64
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
65
+ },
66
+ {
67
+ "@type": "ParameterRangeGenericTypeReference",
68
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
69
+ }
70
+ ]
71
+ },
72
+ "default": {
73
+ "@id": "cbff:components/ActorFunctionFactory.jsonld#ActorFunctionFactory_default_bus",
74
+ "@type": "cbff:components/BusFunctionFactory.jsonld#BusFunctionFactory"
75
+ },
76
+ "comment": "The bus this actor subscribes to."
77
+ },
78
+ {
79
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_busFailMessage",
80
+ "range": {
81
+ "@type": "ParameterRangeUnion",
82
+ "parameterRangeElements": [
83
+ "xsd:string",
84
+ {
85
+ "@type": "ParameterRangeUndefined"
86
+ }
87
+ ]
88
+ },
89
+ "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}\""
90
+ },
91
+ {
92
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_beforeActors",
93
+ "range": {
94
+ "@type": "ParameterRangeUnion",
95
+ "parameterRangeElements": [
96
+ {
97
+ "@type": "ParameterRangeArray",
98
+ "parameterRangeValue": {
99
+ "@type": "ParameterRangeGenericComponent",
100
+ "component": "cc:components/Actor.jsonld#Actor",
101
+ "genericTypeInstances": [
102
+ {
103
+ "@type": "ParameterRangeGenericTypeReference",
104
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_I"
105
+ },
106
+ {
107
+ "@type": "ParameterRangeGenericTypeReference",
108
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_T"
109
+ },
110
+ {
111
+ "@type": "ParameterRangeGenericTypeReference",
112
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_O"
113
+ },
114
+ {
115
+ "@type": "ParameterRangeGenericTypeReference",
116
+ "parameterRangeGenericType": "npmd:@comunica/actor-abstract-mediatyped/^3.0.0/components/ActorAbstractMediaTyped.jsonld#ActorAbstractMediaTyped__generic_TS"
117
+ }
118
+ ]
119
+ }
120
+ },
121
+ {
122
+ "@type": "ParameterRangeUndefined"
123
+ }
124
+ ]
125
+ },
126
+ "comment": "Actor that must be registered in the bus before this actor."
127
+ }
128
+ ],
129
+ "memberFields": [
130
+ {
131
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions__member_constructor",
132
+ "memberFieldName": "constructor"
133
+ },
134
+ {
135
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions__member_test",
136
+ "memberFieldName": "test"
137
+ },
138
+ {
139
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions__member_run",
140
+ "memberFieldName": "run"
141
+ }
142
+ ],
143
+ "constructorArguments": [
144
+ {
145
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args__constructorArgument",
146
+ "fields": [
147
+ {
148
+ "keyRaw": "name",
149
+ "value": {
150
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_name"
151
+ }
152
+ },
153
+ {
154
+ "keyRaw": "bus",
155
+ "value": {
156
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_bus"
157
+ }
158
+ },
159
+ {
160
+ "keyRaw": "busFailMessage",
161
+ "value": {
162
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_busFailMessage"
163
+ }
164
+ },
165
+ {
166
+ "keyRaw": "beforeActors",
167
+ "value": {
168
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_beforeActors"
169
+ }
170
+ }
171
+ ]
172
+ }
173
+ ]
174
+ }
175
+ ]
176
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-function-factory-expression-extensions/^3.0.0/components/context.jsonld"
4
+ ],
5
+ "@id": "npmd:@comunica/actor-function-factory-expression-extensions",
6
+ "@type": "Module",
7
+ "requireName": "@comunica/actor-function-factory-expression-extensions",
8
+ "import": [
9
+ "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld"
10
+ ]
11
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "@context": [
3
+ "https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^6.0.0/components/context.jsonld",
4
+ {
5
+ "npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
6
+ "caffee": "npmd:@comunica/actor-function-factory-expression-extensions/^3.0.0/",
7
+ "ActorFunctionFactoryExpressionExtensions": {
8
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions",
9
+ "@prefix": true,
10
+ "@context": {
11
+ "args_name": {
12
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_name"
13
+ },
14
+ "args_bus": {
15
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_bus"
16
+ },
17
+ "args_busFailMessage": {
18
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_busFailMessage"
19
+ },
20
+ "args_beforeActors": {
21
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_beforeActors",
22
+ "@container": "@list"
23
+ },
24
+ "name": {
25
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_name"
26
+ },
27
+ "bus": {
28
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_bus"
29
+ },
30
+ "busFailMessage": {
31
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_busFailMessage"
32
+ },
33
+ "beforeActors": {
34
+ "@id": "caffee:components/ActorFunctionFactoryExpressionExtensions.jsonld#ActorFunctionFactoryExpressionExtensions_args_beforeActors",
35
+ "@container": "@list"
36
+ }
37
+ }
38
+ }
39
+ }
40
+ ]
41
+ }
@@ -0,0 +1,13 @@
1
+ import type { IActionFunctionFactory, IActorFunctionFactoryOutput, IActorFunctionFactoryArgs, IActorFunctionFactoryOutputTerm } from '@comunica/bus-function-factory';
2
+ import { ActorFunctionFactory } from '@comunica/bus-function-factory';
3
+ import type { IActorTest, TestResult } from '@comunica/core';
4
+ /**
5
+ * A comunica Expression Function Extensions Function Factory Actor.
6
+ */
7
+ export declare class ActorFunctionFactoryExpressionExtensions extends ActorFunctionFactory {
8
+ constructor(args: IActorFunctionFactoryArgs);
9
+ test({ context, functionName }: IActionFunctionFactory): Promise<TestResult<IActorTest>>;
10
+ run<T extends IActionFunctionFactory>({ context, functionName }: T): Promise<T extends {
11
+ requireTermExpression: true;
12
+ } ? IActorFunctionFactoryOutputTerm : IActorFunctionFactoryOutput>;
13
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActorFunctionFactoryExpressionExtensions = void 0;
4
+ const bus_function_factory_1 = require("@comunica/bus-function-factory");
5
+ const context_entries_1 = require("@comunica/context-entries");
6
+ const core_1 = require("@comunica/core");
7
+ const rdf_data_factory_1 = require("rdf-data-factory");
8
+ const NamedExtension_1 = require("./NamedExtension");
9
+ /**
10
+ * A comunica Expression Function Extensions Function Factory Actor.
11
+ */
12
+ class ActorFunctionFactoryExpressionExtensions extends bus_function_factory_1.ActorFunctionFactory {
13
+ constructor(args) {
14
+ super(args);
15
+ }
16
+ async test({ context, functionName }) {
17
+ const extensionFinder = context.getSafe(context_entries_1.KeysExpressionEvaluator.extensionFunctionCreator);
18
+ const definition = await extensionFinder(new rdf_data_factory_1.DataFactory().namedNode(functionName));
19
+ if (definition) {
20
+ return (0, core_1.passTestVoid)();
21
+ }
22
+ return (0, core_1.failTest)(`Actor ${this.name} can only provide non-termExpression implementations for functions that are provided through config entries like: ${context_entries_1.KeysInitQuery.extensionFunctionCreator.name} or ${context_entries_1.KeysInitQuery.extensionFunctions.name}`);
23
+ }
24
+ async run({ context, functionName }) {
25
+ const extensionFinder = context.getSafe(context_entries_1.KeysExpressionEvaluator.extensionFunctionCreator);
26
+ const definition = await extensionFinder(new rdf_data_factory_1.DataFactory().namedNode(functionName));
27
+ return new NamedExtension_1.NamedExtension({
28
+ operator: functionName,
29
+ functionDefinition: definition,
30
+ });
31
+ }
32
+ }
33
+ exports.ActorFunctionFactoryExpressionExtensions = ActorFunctionFactoryExpressionExtensions;
34
+ //# sourceMappingURL=ActorFunctionFactoryExpressionExtensions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActorFunctionFactoryExpressionExtensions.js","sourceRoot":"","sources":["ActorFunctionFactoryExpressionExtensions.ts"],"names":[],"mappings":";;;AAMA,yEAEwC;AACxC,+DAAmF;AAEnF,yCAAwD;AAGxD,uDAA+C;AAC/C,qDAAkD;AAElD;;GAEG;AACH,MAAa,wCAAyC,SAAQ,2CAAoB;IAChF,YAAmB,IAA+B;QAChD,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,YAAY,EAA0B;QACjE,MAAM,eAAe,GACnB,OAAO,CAAC,OAAO,CAAC,yCAAuB,CAAC,wBAAwB,CAAC,CAAC;QACpE,MAAM,UAAU,GAAG,MAAM,eAAe,CAAC,IAAI,8BAAW,EAAY,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;QAC9F,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,IAAA,mBAAY,GAAE,CAAC;QACxB,CAAC;QACD,OAAO,IAAA,eAAQ,EACb,SAAS,IAAI,CAAC,IAAI,qHAAqH,+BAAa,CAAC,wBAAwB,CAAC,IAAI,OAAO,+BAAa,CAAC,kBAAkB,CAAC,IAAI,EAAE,CACjO,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,GAAG,CAAmC,EAAE,OAAO,EAAE,YAAY,EAAK;QAE7E,MAAM,eAAe,GACnB,OAAO,CAAC,OAAO,CAAC,yCAAuB,CAAC,wBAAwB,CAAC,CAAC;QACpE,MAAM,UAAU,GAAG,MAAM,eAAe,CAAC,IAAI,8BAAW,EAAY,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;QAC9F,OACwC,IAAI,+BAAc,CAAC;YACvD,QAAQ,EAAE,YAAY;YACtB,kBAAkB,EAAE,UAAW;SAChC,CAAC,CAAC;IACP,CAAC;CACF;AA5BD,4FA4BC","sourcesContent":["import type {\n IActionFunctionFactory,\n IActorFunctionFactoryOutput,\n IActorFunctionFactoryArgs,\n IActorFunctionFactoryOutputTerm,\n} from '@comunica/bus-function-factory';\nimport {\n ActorFunctionFactory,\n} from '@comunica/bus-function-factory';\nimport { KeysExpressionEvaluator, KeysInitQuery } from '@comunica/context-entries';\nimport type { IActorTest, TestResult } from '@comunica/core';\nimport { failTest, passTestVoid } from '@comunica/core';\nimport type { AsyncExtensionFunctionCreator } from '@comunica/types';\nimport type * as RDF from '@rdfjs/types';\nimport { DataFactory } from 'rdf-data-factory';\nimport { NamedExtension } from './NamedExtension';\n\n/**\n * A comunica Expression Function Extensions Function Factory Actor.\n */\nexport class ActorFunctionFactoryExpressionExtensions extends ActorFunctionFactory {\n public constructor(args: IActorFunctionFactoryArgs) {\n super(args);\n }\n\n public async test({ context, functionName }: IActionFunctionFactory): Promise<TestResult<IActorTest>> {\n const extensionFinder: AsyncExtensionFunctionCreator =\n context.getSafe(KeysExpressionEvaluator.extensionFunctionCreator);\n const definition = await extensionFinder(new DataFactory<RDF.Quad>().namedNode(functionName));\n if (definition) {\n return passTestVoid();\n }\n return failTest(\n `Actor ${this.name} can only provide non-termExpression implementations for functions that are provided through config entries like: ${KeysInitQuery.extensionFunctionCreator.name} or ${KeysInitQuery.extensionFunctions.name}`,\n );\n }\n\n public async run<T extends IActionFunctionFactory>({ context, functionName }: T):\n Promise<T extends { requireTermExpression: true } ? IActorFunctionFactoryOutputTerm : IActorFunctionFactoryOutput> {\n const extensionFinder: AsyncExtensionFunctionCreator =\n context.getSafe(KeysExpressionEvaluator.extensionFunctionCreator);\n const definition = await extensionFinder(new DataFactory<RDF.Quad>().namedNode(functionName));\n return <T extends { requireTermExpression: true } ? IActorFunctionFactoryOutputTerm :\n IActorFunctionFactoryOutput><unknown> new NamedExtension({\n operator: functionName,\n functionDefinition: definition!,\n });\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { ExpressionFunctionBase } from '@comunica/bus-function-factory/lib/implementation/Core';
2
+ import type { AsyncExtensionFunction } from '@comunica/types';
3
+ interface NamedExtensionArgs {
4
+ operator: string;
5
+ functionDefinition: AsyncExtensionFunction;
6
+ }
7
+ export declare class NamedExtension extends ExpressionFunctionBase {
8
+ constructor({ operator, functionDefinition }: NamedExtensionArgs);
9
+ }
10
+ export {};
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NamedExtension = void 0;
4
+ const Core_1 = require("@comunica/bus-function-factory/lib/implementation/Core");
5
+ const context_entries_1 = require("@comunica/context-entries");
6
+ const utils_expression_evaluator_1 = require("@comunica/utils-expression-evaluator");
7
+ class NamedExtension extends Core_1.ExpressionFunctionBase {
8
+ constructor({ operator, functionDefinition }) {
9
+ super({
10
+ arity: Number.POSITIVE_INFINITY,
11
+ operator,
12
+ apply: async ({ args, exprEval, mapping }) => {
13
+ const evaluatedArgs = await Promise.all(args.map(arg => exprEval.evaluatorExpressionEvaluation(arg, mapping)));
14
+ try {
15
+ return new utils_expression_evaluator_1.TermTransformer(exprEval.context.getSafe(context_entries_1.KeysExpressionEvaluator.superTypeProvider))
16
+ .transformRDFTermUnsafe(await functionDefinition(evaluatedArgs.map(term => term.toRDF(exprEval.context.getSafe(context_entries_1.KeysInitQuery.dataFactory)))));
17
+ }
18
+ catch (error) {
19
+ throw new utils_expression_evaluator_1.ExtensionFunctionError(this.operator, error);
20
+ }
21
+ },
22
+ });
23
+ }
24
+ }
25
+ exports.NamedExtension = NamedExtension;
26
+ //# sourceMappingURL=NamedExtension.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NamedExtension.js","sourceRoot":"","sources":["NamedExtension.ts"],"names":[],"mappings":";;;AAAA,iFAAgG;AAChG,+DAAmF;AAEnF,qFAA+F;AAO/F,MAAa,cAAe,SAAQ,6BAAsB;IACxD,YAAmB,EAAE,QAAQ,EAAE,kBAAkB,EAAsB;QACrE,KAAK,CAAC;YACJ,KAAK,EAAE,MAAM,CAAC,iBAAiB;YAC/B,QAAQ;YACR,KAAK,EAAE,KAAK,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAgB,EAA2B,EAAE;gBACjF,MAAM,aAAa,GAAqB,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CACvE,QAAQ,CAAC,6BAA6B,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;gBACzD,IAAI,CAAC;oBACH,OAAO,IAAI,4CAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,yCAAuB,CAAC,iBAAiB,CAAC,CAAC;yBAC5F,sBAAsB,CACrB,MAAM,kBAAkB,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAChD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,+BAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CACpE,CAAC;gBACN,CAAC;gBAAC,OAAO,KAAc,EAAE,CAAC;oBACxB,MAAM,IAAI,mDAAsB,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;gBACzD,CAAC;YACH,CAAC;SAEF,CAAC,CAAC;IACL,CAAC;CACF;AArBD,wCAqBC","sourcesContent":["import { ExpressionFunctionBase } from '@comunica/bus-function-factory/lib/implementation/Core';\nimport { KeysExpressionEvaluator, KeysInitQuery } from '@comunica/context-entries';\nimport type { AsyncExtensionFunction, IEvalContext, TermExpression } from '@comunica/types';\nimport { ExtensionFunctionError, TermTransformer } from '@comunica/utils-expression-evaluator';\n\ninterface NamedExtensionArgs {\n operator: string;\n functionDefinition: AsyncExtensionFunction;\n}\n\nexport class NamedExtension extends ExpressionFunctionBase {\n public constructor({ operator, functionDefinition }: NamedExtensionArgs) {\n super({\n arity: Number.POSITIVE_INFINITY,\n operator,\n apply: async({ args, exprEval, mapping }: IEvalContext): Promise<TermExpression> => {\n const evaluatedArgs: TermExpression[] = await Promise.all(args.map(arg =>\n exprEval.evaluatorExpressionEvaluation(arg, mapping)));\n try {\n return new TermTransformer(exprEval.context.getSafe(KeysExpressionEvaluator.superTypeProvider))\n .transformRDFTermUnsafe(\n await functionDefinition(evaluatedArgs.map(term =>\n term.toRDF(exprEval.context.getSafe(KeysInitQuery.dataFactory)))),\n );\n } catch (error: unknown) {\n throw new ExtensionFunctionError(this.operator, error);\n }\n }\n ,\n });\n }\n}\n"]}
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './ActorFunctionFactoryExpressionExtensions';
package/lib/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ActorFunctionFactoryExpressionExtensions"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6EAA2D","sourcesContent":["export * from './ActorFunctionFactoryExpressionExtensions';\n"]}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@comunica/actor-function-factory-expression-extensions",
3
+ "version": "3.2.4-alpha.47.0",
4
+ "description": "A expression-extensions function-factory actor",
5
+ "lsd:module": true,
6
+ "license": "MIT",
7
+ "homepage": "https://comunica.dev/",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/comunica/comunica.git",
11
+ "directory": "packages/actor-function-factory-expression-extensions"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/comunica/comunica/issues"
15
+ },
16
+ "keywords": [
17
+ "comunica",
18
+ "actor",
19
+ "function-factory",
20
+ "expression-function-extensions"
21
+ ],
22
+ "sideEffects": false,
23
+ "main": "lib/index.js",
24
+ "typings": "lib/index",
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "files": [
29
+ "components",
30
+ "lib/**/*.d.ts",
31
+ "lib/**/*.js",
32
+ "lib/**/*.js.map"
33
+ ],
34
+ "scripts": {
35
+ "build": "yarn run build:ts && yarn run build:components",
36
+ "build:ts": "node \"../../node_modules/typescript/bin/tsc\"",
37
+ "build:components": "componentsjs-generator"
38
+ },
39
+ "dependencies": {
40
+ "@comunica/bus-function-factory": "3.2.4-alpha.47.0",
41
+ "@comunica/context-entries": "3.2.4-alpha.47.0",
42
+ "@comunica/core": "3.2.4-alpha.47.0",
43
+ "@comunica/types": "3.2.4-alpha.47.0",
44
+ "@comunica/utils-expression-evaluator": "3.2.4-alpha.47.0",
45
+ "rdf-data-factory": "^1.1.2"
46
+ },
47
+ "gitHead": "85bd4c5cf07dfc293ebbc3a1416b70e2db8bfc48"
48
+ }