@traqula/rules-sparql-1-1 0.0.22 → 0.0.24
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/dist/cjs/lib/MinimalSparqlParser.js +35 -58
- package/dist/cjs/lib/MinimalSparqlParser.js.map +1 -0
- package/dist/cjs/lib/Sparql11types.js +2 -15
- package/dist/cjs/lib/Sparql11types.js.map +1 -0
- package/dist/cjs/lib/astFactory.js +107 -119
- package/dist/cjs/lib/astFactory.js.map +1 -0
- package/dist/cjs/lib/expressionHelpers.js +181 -191
- package/dist/cjs/lib/expressionHelpers.js.map +1 -0
- package/dist/cjs/lib/factoryMixins/ContextFactory.js +30 -52
- package/dist/cjs/lib/factoryMixins/ContextFactory.js.map +1 -0
- package/dist/cjs/lib/factoryMixins/ExpressionFactory.js +83 -102
- package/dist/cjs/lib/factoryMixins/ExpressionFactory.js.map +1 -0
- package/dist/cjs/lib/factoryMixins/GraphRefFactory.js +51 -73
- package/dist/cjs/lib/factoryMixins/GraphRefFactory.js.map +1 -0
- package/dist/cjs/lib/factoryMixins/PathFactory.js +68 -87
- package/dist/cjs/lib/factoryMixins/PathFactory.js.map +1 -0
- package/dist/cjs/lib/factoryMixins/Patternfactory.js +98 -120
- package/dist/cjs/lib/factoryMixins/Patternfactory.js.map +1 -0
- package/dist/cjs/lib/factoryMixins/QueryFactory.js +43 -65
- package/dist/cjs/lib/factoryMixins/QueryFactory.js.map +1 -0
- package/dist/cjs/lib/factoryMixins/SolutionModifiersFactory.js +55 -77
- package/dist/cjs/lib/factoryMixins/SolutionModifiersFactory.js.map +1 -0
- package/dist/cjs/lib/factoryMixins/TermFactory.js +81 -102
- package/dist/cjs/lib/factoryMixins/TermFactory.js.map +1 -0
- package/dist/cjs/lib/factoryMixins/UpdateOperationFactory.js +126 -147
- package/dist/cjs/lib/factoryMixins/UpdateOperationFactory.js.map +1 -0
- package/dist/cjs/lib/factoryMixins/mixins.js +21 -38
- package/dist/cjs/lib/factoryMixins/mixins.js.map +1 -0
- package/dist/cjs/lib/grammar/builtIn.js +277 -377
- package/dist/cjs/lib/grammar/builtIn.js.map +1 -0
- package/dist/cjs/lib/grammar/dataSetClause.js +110 -109
- package/dist/cjs/lib/grammar/dataSetClause.js.map +1 -0
- package/dist/cjs/lib/grammar/expression.js +387 -358
- package/dist/cjs/lib/grammar/expression.js.map +1 -0
- package/dist/cjs/lib/grammar/general.js +173 -158
- package/dist/cjs/lib/grammar/general.js.map +1 -0
- package/dist/cjs/lib/grammar/index.js +94 -111
- package/dist/cjs/lib/grammar/index.js.map +1 -0
- package/dist/cjs/lib/grammar/literals.js +282 -266
- package/dist/cjs/lib/grammar/literals.js.map +1 -0
- package/dist/cjs/lib/grammar/propertyPaths.js +206 -193
- package/dist/cjs/lib/grammar/propertyPaths.js.map +1 -0
- package/dist/cjs/lib/grammar/queryUnit.js +395 -372
- package/dist/cjs/lib/grammar/queryUnit.js.map +1 -0
- package/dist/cjs/lib/grammar/solutionModifier.js +281 -265
- package/dist/cjs/lib/grammar/solutionModifier.js.map +1 -0
- package/dist/cjs/lib/grammar/tripleBlock.js +390 -355
- package/dist/cjs/lib/grammar/tripleBlock.js.map +1 -0
- package/dist/cjs/lib/grammar/updateUnit.js +551 -519
- package/dist/cjs/lib/grammar/updateUnit.js.map +1 -0
- package/dist/cjs/lib/grammar/whereClause.js +486 -459
- package/dist/cjs/lib/grammar/whereClause.js.map +1 -0
- package/dist/cjs/lib/index.js +47 -54
- package/dist/cjs/lib/index.js.map +1 -0
- package/dist/cjs/lib/lexer/BuiltInCalls.js +188 -333
- package/dist/cjs/lib/lexer/BuiltInCalls.js.map +1 -0
- package/dist/cjs/lib/lexer/graph.js +10 -40
- package/dist/cjs/lib/lexer/graph.js.map +1 -0
- package/dist/cjs/lib/lexer/index.js +43 -48
- package/dist/cjs/lib/lexer/index.js.map +1 -0
- package/dist/cjs/lib/lexer/lexer.js +84 -195
- package/dist/cjs/lib/lexer/lexer.js.map +1 -0
- package/dist/cjs/lib/lexer/lexerPatterns.js +40 -132
- package/dist/cjs/lib/lexer/lexerPatterns.js.map +1 -0
- package/dist/cjs/lib/lexer/symbols.js +31 -106
- package/dist/cjs/lib/lexer/symbols.js.map +1 -0
- package/dist/cjs/lib/lexer/terminals.js +100 -102
- package/dist/cjs/lib/lexer/terminals.js.map +1 -0
- package/dist/cjs/lib/sparql11HelperTypes.js +2 -15
- package/dist/cjs/lib/sparql11HelperTypes.js.map +1 -0
- package/dist/cjs/lib/utils.js +40 -58
- package/dist/cjs/lib/utils.js.map +1 -0
- package/dist/cjs/lib/validation/validators.js +197 -186
- package/dist/cjs/lib/validation/validators.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/package.json +10 -9
|
@@ -1,105 +1,84 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var TermFactory_exports = {};
|
|
20
|
-
__export(TermFactory_exports, {
|
|
21
|
-
TermFactoryMixin: () => TermFactoryMixin
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(TermFactory_exports);
|
|
24
|
-
const nodeType = "term";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TermFactoryMixin = TermFactoryMixin;
|
|
4
|
+
const nodeType = 'term';
|
|
5
|
+
// eslint-disable-next-line ts/explicit-function-return-type
|
|
25
6
|
function TermFactoryMixin(Base) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
7
|
+
return class TermFactory extends Base {
|
|
8
|
+
__blankNodeCounter = 0;
|
|
9
|
+
resetBlankNodeCounter() {
|
|
10
|
+
this.__blankNodeCounter = 0;
|
|
11
|
+
}
|
|
12
|
+
isTerm(x) {
|
|
13
|
+
return this.isOfType(x, 'term');
|
|
14
|
+
}
|
|
15
|
+
termBlank(label, loc) {
|
|
16
|
+
const base = {
|
|
17
|
+
type: 'term',
|
|
18
|
+
subType: 'blankNode',
|
|
19
|
+
loc,
|
|
20
|
+
};
|
|
21
|
+
if (label === undefined) {
|
|
22
|
+
return { ...base, label: `g_${this.__blankNodeCounter++}` };
|
|
23
|
+
}
|
|
24
|
+
return { ...base, label: `e_${label}` };
|
|
25
|
+
}
|
|
26
|
+
isTermBlank(obj) {
|
|
27
|
+
return this.isOfSubType(obj, nodeType, 'blankNode');
|
|
28
|
+
}
|
|
29
|
+
termLiteral(loc, value, langOrIri) {
|
|
30
|
+
return {
|
|
31
|
+
type: nodeType,
|
|
32
|
+
subType: 'literal',
|
|
33
|
+
value,
|
|
34
|
+
langOrIri,
|
|
35
|
+
loc,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
isTermLiteral(obj) {
|
|
39
|
+
return this.isOfSubType(obj, nodeType, 'literal');
|
|
40
|
+
}
|
|
41
|
+
isTermLiteralLangStr(obj) {
|
|
42
|
+
return this.isTermLiteral(obj) && typeof obj.langOrIri === 'string';
|
|
43
|
+
}
|
|
44
|
+
isTermLiteralStr(obj) {
|
|
45
|
+
return this.isTermLiteral(obj) && typeof obj.langOrIri === 'undefined';
|
|
46
|
+
}
|
|
47
|
+
isTermLiteralTyped(obj) {
|
|
48
|
+
const casted = obj;
|
|
49
|
+
return this.isTermLiteral(obj) && typeof casted.langOrIri === 'object' &&
|
|
50
|
+
casted.langOrIri !== null && this.isTermNamed(casted.langOrIri);
|
|
51
|
+
}
|
|
52
|
+
termVariable(value, loc) {
|
|
53
|
+
return {
|
|
54
|
+
type: nodeType,
|
|
55
|
+
subType: 'variable',
|
|
56
|
+
value,
|
|
57
|
+
loc,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
isTermVariable(obj) {
|
|
61
|
+
return this.isOfSubType(obj, nodeType, 'variable');
|
|
62
|
+
}
|
|
63
|
+
termNamed(loc, value, prefix) {
|
|
64
|
+
const base = {
|
|
65
|
+
type: nodeType,
|
|
66
|
+
subType: 'namedNode',
|
|
67
|
+
value,
|
|
68
|
+
loc,
|
|
69
|
+
};
|
|
70
|
+
if (prefix === undefined) {
|
|
71
|
+
return base;
|
|
72
|
+
}
|
|
73
|
+
return { ...base, prefix };
|
|
74
|
+
}
|
|
75
|
+
isTermNamed(obj) {
|
|
76
|
+
return this.isOfSubType(obj, nodeType, 'namedNode');
|
|
77
|
+
}
|
|
78
|
+
isTermNamedPrefixed(obj) {
|
|
79
|
+
const casted = obj;
|
|
80
|
+
return this.isTermNamed(obj) && typeof casted.prefix === 'string';
|
|
81
|
+
}
|
|
82
|
+
};
|
|
101
83
|
}
|
|
102
|
-
|
|
103
|
-
0 && (module.exports = {
|
|
104
|
-
TermFactoryMixin
|
|
105
|
-
});
|
|
84
|
+
//# sourceMappingURL=TermFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TermFactory.js","sourceRoot":"","sources":["../../../../lib/factoryMixins/TermFactory.ts"],"names":[],"mappings":";;AAkBA,4CAiHC;AApHD,MAAM,QAAQ,GAAa,MAAM,CAAC;AAElC,4DAA4D;AAC5D,SAAgB,gBAAgB,CAA4C,IAAW;IACrF,OAAO,MAAM,WAAY,SAAQ,IAAI;QAC5B,kBAAkB,GAAG,CAAC,CAAC;QAEvB,qBAAqB;YAC1B,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC;QAC9B,CAAC;QAEM,MAAM,CAAC,CAAS;YACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QAClC,CAAC;QAEM,SAAS,CAAC,KAAyB,EAAE,GAAmB;YAC7D,MAAM,IAAI,GAAU;gBAClB,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,WAAW;gBACpB,GAAG;aACJ,CAAC;YACF,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,OAAO,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,IAAI,CA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C;QAEM,cAAc,CAAC,GAAW;YAC/B,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;QACrD,CAAC;QAUM,SAAS,CAAC,GAAmB,EAAE,KAAa,EAAE,MAAe;YAClE,MAAM,IAAI,GAAU;gBAClB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,WAAW;gBACpB,KAAK;gBACL,GAAG;aACJ,CAAC;YACF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC;QAC7B,CAAC;QAEM,WAAW,CAAC,GAAW;YAC5B,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;QACtD,CAAC;QAEM,mBAAmB,CAAC,GAAW;YACpC,MAAM,MAAM,GAAyB,GAAG,CAAC;YACzC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC;QACpE,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { AstCoreFactory, SourceLocation, Typed, SubTyped } from '@traqula/core';\nimport type {\n TermBlank,\n TermIri,\n TermIriFull,\n TermIriPrefixed,\n TermLiteral,\n TermLiteralLangStr,\n TermLiteralStr,\n TermLiteralTyped,\n TermVariable,\n} from '../Sparql11types.js';\nimport type { Constructor } from './mixins.js';\n\ntype NodeType = 'term';\nconst nodeType: NodeType = 'term';\n\n// eslint-disable-next-line ts/explicit-function-return-type\nexport function TermFactoryMixin<TBase extends Constructor<AstCoreFactory>>(Base: TBase) {\n return class TermFactory extends Base {\n public __blankNodeCounter = 0;\n\n public resetBlankNodeCounter(): void {\n this.__blankNodeCounter = 0;\n }\n\n public isTerm(x: object): x is Typed<'term'> {\n return this.isOfType(x, 'term');\n }\n\n public termBlank(label: undefined | string, loc: SourceLocation): TermBlank {\n const base = <const>{\n type: 'term',\n subType: 'blankNode',\n loc,\n };\n if (label === undefined) {\n return { ...base, label: `g_${this.__blankNodeCounter++}` };\n }\n return { ...base, label: `e_${label}` };\n }\n\n public isTermBlank(obj: object): obj is SubTyped<NodeType, 'blankNode'> {\n return this.isOfSubType(obj, nodeType, 'blankNode');\n }\n\n /**\n * String, no lang, no type\n */\n public termLiteral(loc: SourceLocation, value: string, lang?: undefined): TermLiteralStr;\n /**\n * String with a language tag\n */\n public termLiteral(loc: SourceLocation, value: string, lang: string): TermLiteralLangStr;\n /**\n * Lexical form with a type\n */\n public termLiteral(loc: SourceLocation, value: string, iri: TermIri): TermLiteralTyped;\n public termLiteral(loc: SourceLocation, value: string, langOrIri?: string | TermIri): TermLiteral;\n public termLiteral(loc: SourceLocation, value: string, langOrIri?: string | TermIri): TermLiteral {\n return {\n type: nodeType,\n subType: 'literal',\n value,\n langOrIri,\n loc,\n };\n }\n\n public isTermLiteral(obj: object): obj is SubTyped<NodeType, 'literal'> {\n return this.isOfSubType(obj, nodeType, 'literal');\n }\n\n public isTermLiteralLangStr(obj: object): obj is SubTyped<NodeType, 'literal'> & { langOrIri: string } {\n return this.isTermLiteral(obj) && typeof (<{ langOrIri?: unknown }>obj).langOrIri === 'string';\n }\n\n public isTermLiteralStr(obj: object): obj is SubTyped<NodeType, 'literal'> & { langOrIri: undefined } {\n return this.isTermLiteral(obj) && typeof (<{ langOrIri?: unknown }>obj).langOrIri === 'undefined';\n }\n\n public isTermLiteralTyped(obj: object):\n obj is SubTyped<NodeType, 'literal'> & { langOrIri: SubTyped<NodeType, 'namedNode'> } {\n const casted = <{ langOrIri?: unknown }>obj;\n return this.isTermLiteral(obj) && typeof casted.langOrIri === 'object' &&\n casted.langOrIri !== null && this.isTermNamed(casted.langOrIri);\n }\n\n public termVariable(value: string, loc: SourceLocation): TermVariable {\n return {\n type: nodeType,\n subType: 'variable',\n value,\n loc,\n };\n }\n\n public isTermVariable(obj: object): obj is SubTyped<NodeType, 'variable'> {\n return this.isOfSubType(obj, nodeType, 'variable');\n }\n\n /**\n * A namednode with fully defined with a uri.\n */\n public termNamed(loc: SourceLocation, value: string, prefix?: undefined): TermIriFull;\n /**\n * A namednode defined using a prefix\n */\n public termNamed(loc: SourceLocation, value: string, prefix: string): TermIriPrefixed;\n public termNamed(loc: SourceLocation, value: string, prefix?: string): TermIriFull | TermIriPrefixed {\n const base = <const>{\n type: nodeType,\n subType: 'namedNode',\n value,\n loc,\n };\n if (prefix === undefined) {\n return base;\n }\n return { ...base, prefix };\n }\n\n public isTermNamed(obj: object): obj is SubTyped<NodeType, 'namedNode'> {\n return this.isOfSubType(obj, nodeType, 'namedNode');\n }\n\n public isTermNamedPrefixed(obj: object): obj is SubTyped<NodeType, 'namedNode'> & { prefix: string } {\n const casted = <{ prefix?: unknown }>obj;\n return this.isTermNamed(obj) && typeof casted.prefix === 'string';\n }\n };\n}\n"]}
|
|
@@ -1,150 +1,129 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var UpdateOperationFactory_exports = {};
|
|
20
|
-
__export(UpdateOperationFactory_exports, {
|
|
21
|
-
UpdateOperationFactoryMixin: () => UpdateOperationFactoryMixin
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(UpdateOperationFactory_exports);
|
|
24
|
-
const nodeType = "updateOperation";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateOperationFactoryMixin = UpdateOperationFactoryMixin;
|
|
4
|
+
const nodeType = 'updateOperation';
|
|
5
|
+
// eslint-disable-next-line ts/explicit-function-return-type
|
|
25
6
|
function UpdateOperationFactoryMixin(Base) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
7
|
+
return class UpdateOperationFactory extends Base {
|
|
8
|
+
isUpdateOperation(obj) {
|
|
9
|
+
return this.isOfType(obj, nodeType);
|
|
10
|
+
}
|
|
11
|
+
updateOperationLoad(loc, source, silent, destination) {
|
|
12
|
+
return {
|
|
13
|
+
type: nodeType,
|
|
14
|
+
subType: 'load',
|
|
15
|
+
silent,
|
|
16
|
+
source,
|
|
17
|
+
...(destination && { destination }),
|
|
18
|
+
loc,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
isUpdateOperationLoad(obj) {
|
|
22
|
+
return this.isOfSubType(obj, nodeType, 'load');
|
|
23
|
+
}
|
|
24
|
+
updateOperationClearDrop(subType, silent, destination, loc) {
|
|
25
|
+
return {
|
|
26
|
+
type: 'updateOperation',
|
|
27
|
+
subType,
|
|
28
|
+
silent,
|
|
29
|
+
destination,
|
|
30
|
+
loc,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
updateOperationClear(destination, silent, loc) {
|
|
34
|
+
return this.updateOperationClearDrop('clear', silent, destination, loc);
|
|
35
|
+
}
|
|
36
|
+
;
|
|
37
|
+
isUpdateOperationClear(obj) {
|
|
38
|
+
return this.isOfSubType(obj, nodeType, 'clear');
|
|
39
|
+
}
|
|
40
|
+
updateOperationDrop(destination, silent, loc) {
|
|
41
|
+
return this.updateOperationClearDrop('drop', silent, destination, loc);
|
|
42
|
+
}
|
|
43
|
+
isUpdateOperationDrop(obj) {
|
|
44
|
+
return this.isOfSubType(obj, nodeType, 'drop');
|
|
45
|
+
}
|
|
46
|
+
updateOperationCreate(destination, silent, loc) {
|
|
47
|
+
return {
|
|
48
|
+
type: 'updateOperation',
|
|
49
|
+
subType: 'create',
|
|
50
|
+
silent,
|
|
51
|
+
destination,
|
|
52
|
+
loc,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
isUpdateOperationCreate(obj) {
|
|
56
|
+
return this.isOfSubType(obj, nodeType, 'create');
|
|
57
|
+
}
|
|
58
|
+
updateOperationAddMoveCopy(subType, source, destination, silent, loc) {
|
|
59
|
+
return {
|
|
60
|
+
type: 'updateOperation',
|
|
61
|
+
subType,
|
|
62
|
+
silent,
|
|
63
|
+
source,
|
|
64
|
+
destination,
|
|
65
|
+
loc,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
updateOperationAdd(source, destination, silent, loc) {
|
|
69
|
+
return this.updateOperationAddMoveCopy('add', source, destination, silent, loc);
|
|
70
|
+
}
|
|
71
|
+
isUpdateOperationAdd(obj) {
|
|
72
|
+
return this.isOfSubType(obj, nodeType, 'add');
|
|
73
|
+
}
|
|
74
|
+
updateOperationMove(source, destination, silent, loc) {
|
|
75
|
+
return this.updateOperationAddMoveCopy('move', source, destination, silent, loc);
|
|
76
|
+
}
|
|
77
|
+
isUpdateOperationMove(obj) {
|
|
78
|
+
return this.isOfSubType(obj, nodeType, 'move');
|
|
79
|
+
}
|
|
80
|
+
updateOperationCopy(source, destination, silent, loc) {
|
|
81
|
+
return this.updateOperationAddMoveCopy('copy', source, destination, silent, loc);
|
|
82
|
+
}
|
|
83
|
+
isUpdateOperationCopy(obj) {
|
|
84
|
+
return this.isOfSubType(obj, nodeType, 'copy');
|
|
85
|
+
}
|
|
86
|
+
updateOperationInsDelDataWhere(subType, data, loc) {
|
|
87
|
+
return {
|
|
88
|
+
type: 'updateOperation',
|
|
89
|
+
subType,
|
|
90
|
+
data,
|
|
91
|
+
loc,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
updateOperationInsertData(data, loc) {
|
|
95
|
+
return this.updateOperationInsDelDataWhere('insertdata', data, loc);
|
|
96
|
+
}
|
|
97
|
+
isUpdateOperationInsertData(obj) {
|
|
98
|
+
return this.isOfSubType(obj, nodeType, 'insertdata');
|
|
99
|
+
}
|
|
100
|
+
updateOperationDeleteData(data, loc) {
|
|
101
|
+
return this.updateOperationInsDelDataWhere('deletedata', data, loc);
|
|
102
|
+
}
|
|
103
|
+
isUpdateOperationDeleteData(obj) {
|
|
104
|
+
return this.isOfSubType(obj, nodeType, 'deletedata');
|
|
105
|
+
}
|
|
106
|
+
updateOperationDeleteWhere(data, loc) {
|
|
107
|
+
return this.updateOperationInsDelDataWhere('deletewhere', data, loc);
|
|
108
|
+
}
|
|
109
|
+
isUpdateOperationDeleteWhere(obj) {
|
|
110
|
+
return this.isOfSubType(obj, nodeType, 'deletewhere');
|
|
111
|
+
}
|
|
112
|
+
updateOperationModify(loc, insert, del, where, from, graph) {
|
|
113
|
+
return {
|
|
114
|
+
type: 'updateOperation',
|
|
115
|
+
subType: 'modify',
|
|
116
|
+
insert: insert ?? [],
|
|
117
|
+
delete: del ?? [],
|
|
118
|
+
graph,
|
|
119
|
+
where,
|
|
120
|
+
from,
|
|
121
|
+
loc,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
isUpdateOperationModify(obj) {
|
|
125
|
+
return this.isOfSubType(obj, nodeType, 'modify');
|
|
126
|
+
}
|
|
127
|
+
};
|
|
146
128
|
}
|
|
147
|
-
|
|
148
|
-
0 && (module.exports = {
|
|
149
|
-
UpdateOperationFactoryMixin
|
|
150
|
-
});
|
|
129
|
+
//# sourceMappingURL=UpdateOperationFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpdateOperationFactory.js","sourceRoot":"","sources":["../../../../lib/factoryMixins/UpdateOperationFactory.ts"],"names":[],"mappings":";;AA2BA,kEAyPC;AA5PD,MAAM,QAAQ,GAAa,iBAAiB,CAAC;AAE7C,4DAA4D;AAC5D,SAAgB,2BAA2B,CAA4C,IAAW;IAChG,OAAO,MAAM,sBAAuB,SAAQ,IAAI;QACvC,iBAAiB,CAAC,GAAW;YAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACtC,CAAC;QAEM,mBAAmB,CACxB,GAAmB,EACnB,MAAe,EACf,MAAe,EACf,WAA0C;YAE1C,OAAO;gBACL,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,MAAM;gBACf,MAAM;gBACN,MAAM;gBACN,GAAG,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,CAAC;gBACnC,GAAG;aACJ,CAAC;QACJ,CAAC;QAEM,qBAAqB,CAAC,GAAW;YACtC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QACjD,CAAC;QAYM,wBAAwB,CAC7B,OAAyB,EACzB,MAAe,EACf,WAAqB,EACrB,GAAmB;YAEnB,OAAO;gBACL,IAAI,EAAE,iBAAiB;gBACvB,OAAO;gBACP,MAAM;gBACN,WAAW;gBACX,GAAG;aACJ,CAAC;QACJ,CAAC;QAEM,oBAAoB,CACzB,WAAqB,EACrB,MAAe,EACf,GAAmB;YAEnB,OAAO,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC;QAC1E,CAAC;QAAA,CAAC;QAEK,sBAAsB,CAAC,GAAW;YACvC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC;QA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AAC;QACvE,CAAC;QAEM,4BAA4B,CAAC,GAAW;YAC7C,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;QACxD,CAAC;QAEM,qBAAqB,CAC1B,GAAmB,EACnB,MAA2B,EAC3B,GAAwB,EACxB,KAAmB,EACnB,IAAoB,EACpB,KAA2B;YAE3B,OAAO;gBACL,IAAI,EAAE,iBAAiB;gBACvB,OAAO,EAAE,QAAQ;gBACjB,MAAM,EAAE,MAAM,IAAI,EAAE;gBACpB,MAAM,EAAE,GAAG,IAAI,EAAE;gBACjB,KAAK;gBACL,KAAK;gBACL,IAAI;gBACJ,GAAG;aACJ,CAAC;QACJ,CAAC;QAEM,uBAAuB,CAAC,GAAW;YACxC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACnD,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { AstCoreFactory, SourceLocation, SubTyped, Typed } from '@traqula/core';\nimport type {\n DatasetClauses,\n GraphRef,\n GraphRefDefault,\n GraphRefSpecific,\n PatternGroup,\n Quads,\n TermIri,\n UpdateOperationAdd,\n UpdateOperationClear,\n UpdateOperationCopy,\n UpdateOperationCreate,\n UpdateOperationDeleteData,\n UpdateOperationDeleteWhere,\n UpdateOperationDrop,\n UpdateOperationInsertData,\n UpdateOperationLoad,\n UpdateOperationModify,\n UpdateOperationMove,\n} from '../Sparql11types.js';\nimport type { Constructor } from './mixins.js';\n\ntype NodeType = 'updateOperation';\nconst nodeType: NodeType = 'updateOperation';\n\n// eslint-disable-next-line ts/explicit-function-return-type\nexport function UpdateOperationFactoryMixin<TBase extends Constructor<AstCoreFactory>>(Base: TBase) {\n return class UpdateOperationFactory extends Base {\n public isUpdateOperation(obj: object): obj is Typed<NodeType> {\n return this.isOfType(obj, nodeType);\n }\n\n public updateOperationLoad(\n loc: SourceLocation,\n source: TermIri,\n silent: boolean,\n destination?: GraphRefSpecific | undefined,\n ): UpdateOperationLoad {\n return {\n type: nodeType,\n subType: 'load',\n silent,\n source,\n ...(destination && { destination }),\n loc,\n };\n }\n\n public isUpdateOperationLoad(obj: object): obj is SubTyped<NodeType, 'load'> {\n return this.isOfSubType(obj, nodeType, 'load');\n }\n\n public updateOperationClearDrop(subType: 'clear', silent: boolean, destination: GraphRef, loc: SourceLocation):\n UpdateOperationClear;\n public updateOperationClearDrop(subType: 'drop', silent: boolean, destination: GraphRef, loc: SourceLocation):\n UpdateOperationDrop;\n public updateOperationClearDrop(\n subType: 'clear' | 'drop',\n silent: boolean,\n destination: GraphRef,\n loc: SourceLocation\n ): UpdateOperationClear | UpdateOperationDrop;\n public updateOperationClearDrop(\n subType: 'clear' | 'drop',\n silent: boolean,\n destination: GraphRef,\n loc: SourceLocation,\n ): UpdateOperationClear | UpdateOperationDrop {\n return {\n type: 'updateOperation',\n subType,\n silent,\n destination,\n loc,\n };\n }\n\n public updateOperationClear(\n destination: GraphRef,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationClear {\n return this.updateOperationClearDrop('clear', silent, destination, loc);\n };\n\n public isUpdateOperationClear(obj: object): obj is SubTyped<NodeType, 'clear'> {\n return this.isOfSubType(obj, nodeType, 'clear');\n }\n\n public updateOperationDrop(\n destination: GraphRef,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationDrop {\n return this.updateOperationClearDrop('drop', silent, destination, loc);\n }\n\n public isUpdateOperationDrop(obj: object): obj is SubTyped<NodeType, 'drop'> {\n return this.isOfSubType(obj, nodeType, 'drop');\n }\n\n public updateOperationCreate(\n destination: GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationCreate {\n return {\n type: 'updateOperation',\n subType: 'create',\n silent,\n destination,\n loc,\n };\n }\n\n public isUpdateOperationCreate(obj: object): obj is SubTyped<NodeType, 'create'> {\n return this.isOfSubType(obj, nodeType, 'create');\n }\n\n public updateOperationAddMoveCopy(\n subType: 'add',\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationAdd;\n public updateOperationAddMoveCopy(\n subType: 'move',\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationMove ;\n public updateOperationAddMoveCopy(\n subType: 'copy',\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationCopy;\n public updateOperationAddMoveCopy(\n subType: 'add' | 'move' | 'copy',\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationAdd | UpdateOperationMove | UpdateOperationCopy;\n public updateOperationAddMoveCopy(\n subType: 'add' | 'move' | 'copy',\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationAdd | UpdateOperationMove | UpdateOperationCopy {\n return {\n type: 'updateOperation',\n subType,\n silent,\n source,\n destination,\n loc,\n };\n }\n\n public updateOperationAdd(\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationAdd {\n return this.updateOperationAddMoveCopy('add', source, destination, silent, loc);\n }\n\n public isUpdateOperationAdd(obj: object): obj is SubTyped<NodeType, 'add'> {\n return this.isOfSubType(obj, nodeType, 'add');\n }\n\n public updateOperationMove(\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationMove {\n return this.updateOperationAddMoveCopy('move', source, destination, silent, loc);\n }\n\n public isUpdateOperationMove(obj: object): obj is SubTyped<NodeType, 'move'> {\n return this.isOfSubType(obj, nodeType, 'move');\n }\n\n public updateOperationCopy(\n source: GraphRefDefault | GraphRefSpecific,\n destination: GraphRefDefault | GraphRefSpecific,\n silent: boolean,\n loc: SourceLocation,\n ): UpdateOperationCopy {\n return this.updateOperationAddMoveCopy('copy', source, destination, silent, loc);\n }\n\n public isUpdateOperationCopy(obj: object): obj is SubTyped<NodeType, 'copy'> {\n return this.isOfSubType(obj, nodeType, 'copy');\n }\n\n public updateOperationInsDelDataWhere(subType: 'insertdata', data: Quads[], loc: SourceLocation):\n UpdateOperationInsertData;\n public updateOperationInsDelDataWhere(subType: 'deletedata', data: Quads[], loc: SourceLocation):\n UpdateOperationDeleteData;\n public updateOperationInsDelDataWhere(subType: 'deletewhere', data: Quads[], loc: SourceLocation):\n UpdateOperationDeleteWhere;\n public updateOperationInsDelDataWhere(\n subType: 'insertdata' | 'deletedata' | 'deletewhere',\n data: Quads[],\n loc: SourceLocation,\n ): UpdateOperationInsertData | UpdateOperationDeleteData | UpdateOperationDeleteWhere;\n public updateOperationInsDelDataWhere(\n subType: 'insertdata' | 'deletedata' | 'deletewhere',\n data: Quads[],\n loc: SourceLocation,\n ): UpdateOperationInsertData | UpdateOperationDeleteData | UpdateOperationDeleteWhere {\n return {\n type: 'updateOperation',\n subType,\n data,\n loc,\n };\n }\n\n public updateOperationInsertData(data: Quads[], loc: SourceLocation): UpdateOperationInsertData {\n return this.updateOperationInsDelDataWhere('insertdata', data, loc);\n }\n\n public isUpdateOperationInsertData(obj: object): obj is SubTyped<NodeType, 'insertdata'> {\n return this.isOfSubType(obj, nodeType, 'insertdata');\n }\n\n public updateOperationDeleteData(data: Quads[], loc: SourceLocation): UpdateOperationDeleteData {\n return this.updateOperationInsDelDataWhere('deletedata', data, loc);\n }\n\n public isUpdateOperationDeleteData(obj: object): obj is SubTyped<NodeType, 'deletedata'> {\n return this.isOfSubType(obj, nodeType, 'deletedata');\n }\n\n public updateOperationDeleteWhere(data: Quads[], loc: SourceLocation): UpdateOperationDeleteWhere {\n return this.updateOperationInsDelDataWhere('deletewhere', data, loc);\n }\n\n public isUpdateOperationDeleteWhere(obj: object): obj is SubTyped<NodeType, 'deletewhere'> {\n return this.isOfSubType(obj, nodeType, 'deletewhere');\n }\n\n public updateOperationModify(\n loc: SourceLocation,\n insert: Quads[] | undefined,\n del: Quads[] | undefined,\n where: PatternGroup,\n from: DatasetClauses,\n graph?: TermIri | undefined,\n ): UpdateOperationModify {\n return {\n type: 'updateOperation',\n subType: 'modify',\n insert: insert ?? [],\n delete: del ?? [],\n graph,\n where,\n from,\n loc,\n };\n }\n\n public isUpdateOperationModify(obj: object): obj is SubTyped<NodeType, 'modify'> {\n return this.isOfSubType(obj, nodeType, 'modify');\n }\n };\n}\n"]}
|
|
@@ -1,43 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var mixins_exports = {};
|
|
20
|
-
__export(mixins_exports, {
|
|
21
|
-
asArg: () => asArg
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(mixins_exports);
|
|
2
|
+
/**
|
|
3
|
+
* We use mixins as explained by the official TypeScript documentation:
|
|
4
|
+
* https://www.typescriptlang.org/docs/handbook/mixins.html
|
|
5
|
+
* Mixins are used so we can split into many files.
|
|
6
|
+
* Additionally, it allows type guards and generics, which the is not possible using the indirection builder.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.asArg = asArg;
|
|
24
10
|
function asArg(arg) {
|
|
25
|
-
|
|
11
|
+
return new FlatCall(arg);
|
|
26
12
|
}
|
|
27
13
|
class FlatCall {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
14
|
+
input;
|
|
15
|
+
constructor(input) {
|
|
16
|
+
this.input = input;
|
|
17
|
+
}
|
|
18
|
+
call(func) {
|
|
19
|
+
this.input = func(this.input);
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
returns() {
|
|
23
|
+
return this.input;
|
|
24
|
+
}
|
|
39
25
|
}
|
|
40
|
-
|
|
41
|
-
0 && (module.exports = {
|
|
42
|
-
asArg
|
|
43
|
-
});
|
|
26
|
+
//# sourceMappingURL=mixins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixins.js","sourceRoot":"","sources":["../../../../lib/factoryMixins/mixins.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAMH,sBAEC;AAFD,SAAgB,KAAK,CAAI,GAAM;IAC7B,OAAO,IAAI,QAAQ,CAAI,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,QAAQ;IACe;IAA3B,YAA2B,KAAY;QAAZ,UAAK,GAAL,KAAK,CAAO;IAAG,CAAC;IACpC,IAAI,CAAM,IAA2B;QAC1C,IAAI,CAAC,KAAK,GAAqB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChD,OAAiC,IAAI,CAAC;IACxC,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF","sourcesContent":["/**\n * We use mixins as explained by the official TypeScript documentation:\n * https://www.typescriptlang.org/docs/handbook/mixins.html\n * Mixins are used so we can split into many files.\n * Additionally, it allows type guards and generics, which the is not possible using the indirection builder.\n */\n\nexport type Constructor<T = object> = new (...args: any[]) => T;\n\nexport type Mixin<Base = object, U extends Base = Base> = (superclass: Constructor<Base>) => Constructor<U>;\n\nexport function asArg<T>(arg: T): FlatCall<T> {\n return new FlatCall<T>(arg);\n}\n\nclass FlatCall<Input> {\n public constructor(private input: Input) {}\n public call<Out>(func: (input: Input) => Out): FlatCall<Out> {\n this.input = <Input> <unknown> func(this.input);\n return <FlatCall<Out>> <unknown> this;\n }\n\n public returns(): Input {\n return this.input;\n }\n}\n"]}
|