@shaclmate/compiler 4.0.18 → 4.0.20
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/Compiler.d.ts +4 -1
- package/dist/Compiler.js +4 -1
- package/dist/ShapesGraphToAstTransformer.d.ts +4 -1
- package/dist/ShapesGraphToAstTransformer.js +9 -6
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +1 -1
- package/dist/ast/AbstractCollectionType.d.ts +10 -0
- package/dist/ast/AbstractCollectionType.js +6 -0
- package/dist/ast/AbstractCompoundType.d.ts +0 -1
- package/dist/ast/AbstractCompoundType.js +0 -3
- package/dist/ast/AbstractContainerType.d.ts +9 -1
- package/dist/ast/AbstractContainerType.js +5 -2
- package/dist/ast/AbstractLazyObjectType.d.ts +94 -1
- package/dist/ast/AbstractLazyObjectType.js +6 -2
- package/dist/ast/AbstractTermType.d.ts +11 -1
- package/dist/ast/AbstractTermType.js +7 -2
- package/dist/ast/AbstractType.d.ts +13 -1
- package/dist/ast/AbstractType.js +13 -0
- package/dist/ast/BlankNodeType.d.ts +1 -1
- package/dist/ast/DefaultValueType.d.ts +10 -0
- package/dist/ast/DefaultValueType.js +6 -0
- package/dist/ast/IdentifierType.d.ts +1 -1
- package/dist/ast/LiteralType.d.ts +17 -1
- package/dist/ast/LiteralType.js +10 -2
- package/dist/ast/ObjectCompoundType.js +1 -2
- package/dist/ast/ObjectType.d.ts +44 -1
- package/dist/ast/ObjectType.js +33 -10
- package/dist/ast/SetType.d.ts +11 -0
- package/dist/ast/SetType.js +6 -0
- package/dist/ast/UnionType.d.ts +12 -0
- package/dist/ast/UnionType.js +11 -0
- package/dist/generators/AstJsonGenerator.d.ts +6 -0
- package/dist/generators/AstJsonGenerator.js +11 -0
- package/dist/generators/Cx2Generator.d.ts +10 -0
- package/dist/generators/Cx2Generator.js +140 -0
- package/dist/generators/LabeledPropertyGraph.d.ts +42 -0
- package/dist/generators/LabeledPropertyGraph.js +2 -0
- package/dist/generators/index.d.ts +4 -2
- package/dist/generators/index.js +4 -2
- package/dist/generators/transformAstToLabeledPropertyGraph.d.ts +4 -0
- package/dist/generators/transformAstToLabeledPropertyGraph.js +75 -0
- package/dist/generators/ts/AbstractDateType.js +1 -1
- package/dist/generators/ts/AbstractIdentifierType.d.ts +2 -2
- package/dist/generators/ts/AbstractIdentifierType.js +2 -5
- package/dist/generators/ts/AbstractNamedUnionType.js +1 -1
- package/dist/generators/ts/AbstractNumericType.js +1 -1
- package/dist/generators/ts/AbstractTermType.js +2 -2
- package/dist/generators/ts/AbstractType.d.ts +17 -14
- package/dist/generators/ts/AbstractType.js +3 -1
- package/dist/generators/ts/BlankNodeType.d.ts +2 -2
- package/dist/generators/ts/BlankNodeType.js +1 -1
- package/dist/generators/ts/BooleanType.js +1 -1
- package/dist/generators/ts/DefaultValueType.js +1 -1
- package/dist/generators/ts/IdentifierType.d.ts +2 -2
- package/dist/generators/ts/IdentifierType.js +1 -1
- package/dist/generators/ts/IriType.d.ts +1 -1
- package/dist/generators/ts/IriType.js +8 -13
- package/dist/generators/ts/LazyObjectOptionType.d.ts +1 -0
- package/dist/generators/ts/LazyObjectOptionType.js +1 -1
- package/dist/generators/ts/LazyObjectType.js +1 -1
- package/dist/generators/ts/ListType.js +5 -5
- package/dist/generators/ts/NamedObjectUnionType.js +4 -1
- package/dist/generators/ts/SetType.js +1 -1
- package/dist/generators/ts/StringType.js +1 -1
- package/dist/generators/ts/TermType.js +3 -1
- package/dist/generators/ts/TsGenerator.d.ts +5 -0
- package/dist/generators/ts/TsGenerator.js +7 -1
- package/dist/generators/ts/TypeFactory.d.ts +5 -0
- package/dist/generators/ts/TypeFactory.js +35 -5
- package/dist/generators/ts/ZodGenerator.d.ts +4 -0
- package/dist/generators/ts/ZodGenerator.js +4 -1
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +4 -1
- package/dist/generators/ts/_NamedObjectType/AbstractProperty.js +3 -1
- package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +6 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js +1 -1
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.js +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js +1 -1
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.d.ts +1 -0
- package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +16 -16
- package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.js +6 -2
- package/dist/generators/ts/_snippets/parseIri.d.ts +2 -0
- package/dist/generators/ts/_snippets/parseIri.js +12 -0
- package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.js +7 -5
- package/dist/generators/ts/_snippets/snippets_parseBlankNode.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_parseBlankNode.js +12 -0
- package/dist/generators/ts/_snippets/snippets_parseIdentifier.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_parseIdentifier.js +6 -0
- package/dist/generators/ts/graphqlSchemaVariableStatement.js +3 -3
- package/dist/generators/ts/imports.d.ts +2 -0
- package/dist/generators/ts/imports.js +3 -1
- package/dist/generators/ts/rdfjsTermExpression.d.ts +4 -1
- package/dist/generators/ts/rdfjsTermExpression.js +2 -3
- package/dist/generators/ts/snippets.d.ts +3 -2
- package/dist/generators/ts/snippets.js +6 -4
- package/dist/generators/ts/synthesizeUberObjectUnionType.d.ts +2 -0
- package/dist/generators/ts/synthesizeUberObjectUnionType.js +4 -0
- package/dist/index.d.ts +1 -4
- package/dist/index.js +1 -3
- package/dist/input/ShapesGraph.d.ts +4 -1
- package/dist/input/ShapesGraph.js +3 -2
- package/dist/input/generated.d.ts +323 -323
- package/dist/input/generated.js +19 -20
- package/package.json +6 -9
- package/dist/generators/json/AstJsonGenerator.d.ts +0 -6
- package/dist/generators/json/AstJsonGenerator.js +0 -144
- package/dist/generators/json/index.d.ts +0 -2
- package/dist/generators/json/index.js +0 -2
- package/dist/generators/ts/_snippets/snippets_blankNodeFromString.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_blankNodeFromString.js +0 -11
- package/dist/generators/ts/_snippets/snippets_identifierFromString.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_identifierFromString.js +0 -8
- package/dist/generators/ts/index.d.ts +0 -2
- package/dist/generators/ts/index.js +0 -2
- package/dist/logger.d.ts +0 -2
- package/dist/logger.js +0 -8
package/dist/input/generated.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import dataFactory from "@rdfjs/data-model";
|
|
2
1
|
import datasetFactory from "@rdfjs/dataset";
|
|
2
|
+
import dataFactory from "@rdfx/data-factory";
|
|
3
3
|
import { LiteralFactory } from "@rdfx/literal";
|
|
4
4
|
import { PropertyPath as RdfjsResourcePropertyPath, Resource, ResourceSet, } from "@rdfx/resource";
|
|
5
|
+
import { NTriplesIdentifier, NTriplesTerm } from "@rdfx/string";
|
|
5
6
|
import { Either, Left, Maybe, Right } from "purify-ts";
|
|
6
7
|
function $filterArray(filterItem) {
|
|
7
8
|
return (filter, values) => {
|
|
@@ -138,9 +139,6 @@ function $fromRdfPreferredLanguages(values, preferredLanguages) {
|
|
|
138
139
|
values: filteredValues,
|
|
139
140
|
}));
|
|
140
141
|
}
|
|
141
|
-
function $identifierFromString(identifier) {
|
|
142
|
-
return Either.encase(() => Resource.Identifier.fromString({ dataFactory, identifier }));
|
|
143
|
-
}
|
|
144
142
|
class $IdentifierSet {
|
|
145
143
|
blankNodeValues = new Set();
|
|
146
144
|
namedNodeValues = new Set();
|
|
@@ -179,6 +177,7 @@ function $isReadonlyStringArray(x) {
|
|
|
179
177
|
return Array.isArray(x) && x.every((z) => typeof z === "string");
|
|
180
178
|
}
|
|
181
179
|
const $literalFactory = new LiteralFactory({ dataFactory: dataFactory });
|
|
180
|
+
const $parseIdentifier = NTriplesIdentifier.parser(dataFactory);
|
|
182
181
|
export var $PropertyPath;
|
|
183
182
|
(function ($PropertyPath) {
|
|
184
183
|
function $filter(_filter, _value) {
|
|
@@ -869,8 +868,8 @@ export var PropertyShape;
|
|
|
869
868
|
PropertyShape.$create = $create;
|
|
870
869
|
let $Identifier;
|
|
871
870
|
(function ($Identifier) {
|
|
872
|
-
$Identifier.
|
|
873
|
-
$Identifier.
|
|
871
|
+
$Identifier.parse = $parseIdentifier;
|
|
872
|
+
$Identifier.stringify = NTriplesTerm.stringify;
|
|
874
873
|
})($Identifier = PropertyShape.$Identifier || (PropertyShape.$Identifier = {}));
|
|
875
874
|
function $filter(filter, value) {
|
|
876
875
|
if (filter.$identifier !== undefined &&
|
|
@@ -1067,7 +1066,7 @@ export var PropertyShape;
|
|
|
1067
1066
|
})) {
|
|
1068
1067
|
return Right(true);
|
|
1069
1068
|
}
|
|
1070
|
-
return Left(new Error(`${
|
|
1069
|
+
return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyShape)`));
|
|
1071
1070
|
})
|
|
1072
1071
|
: Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
|
|
1073
1072
|
dataFactory: dataFactory,
|
|
@@ -2412,8 +2411,8 @@ export var PropertyGroup;
|
|
|
2412
2411
|
PropertyGroup.$create = $create;
|
|
2413
2412
|
let $Identifier;
|
|
2414
2413
|
(function ($Identifier) {
|
|
2415
|
-
$Identifier.
|
|
2416
|
-
$Identifier.
|
|
2414
|
+
$Identifier.parse = $parseIdentifier;
|
|
2415
|
+
$Identifier.stringify = NTriplesTerm.stringify;
|
|
2417
2416
|
})($Identifier = PropertyGroup.$Identifier || (PropertyGroup.$Identifier = {}));
|
|
2418
2417
|
function $filter(filter, value) {
|
|
2419
2418
|
if (filter.$identifier !== undefined &&
|
|
@@ -2474,7 +2473,7 @@ export var PropertyGroup;
|
|
|
2474
2473
|
})) {
|
|
2475
2474
|
return Right(true);
|
|
2476
2475
|
}
|
|
2477
|
-
return Left(new Error(`${
|
|
2476
|
+
return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyGroup)`));
|
|
2478
2477
|
})
|
|
2479
2478
|
: Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
|
|
2480
2479
|
dataFactory: dataFactory,
|
|
@@ -2672,8 +2671,8 @@ export var Ontology;
|
|
|
2672
2671
|
Ontology.$create = $create;
|
|
2673
2672
|
let $Identifier;
|
|
2674
2673
|
(function ($Identifier) {
|
|
2675
|
-
$Identifier.
|
|
2676
|
-
$Identifier.
|
|
2674
|
+
$Identifier.parse = $parseIdentifier;
|
|
2675
|
+
$Identifier.stringify = NTriplesTerm.stringify;
|
|
2677
2676
|
})($Identifier = Ontology.$Identifier || (Ontology.$Identifier = {}));
|
|
2678
2677
|
function $filter(filter, value) {
|
|
2679
2678
|
if (filter.$identifier !== undefined &&
|
|
@@ -2750,7 +2749,7 @@ export var Ontology;
|
|
|
2750
2749
|
})) {
|
|
2751
2750
|
return Right(true);
|
|
2752
2751
|
}
|
|
2753
|
-
return Left(new Error(`${
|
|
2752
|
+
return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/2002/07/owl#Ontology)`));
|
|
2754
2753
|
})
|
|
2755
2754
|
: Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
|
|
2756
2755
|
dataFactory: dataFactory,
|
|
@@ -3732,8 +3731,8 @@ export var NodeShape;
|
|
|
3732
3731
|
NodeShape.$create = $create;
|
|
3733
3732
|
let $Identifier;
|
|
3734
3733
|
(function ($Identifier) {
|
|
3735
|
-
$Identifier.
|
|
3736
|
-
$Identifier.
|
|
3734
|
+
$Identifier.parse = $parseIdentifier;
|
|
3735
|
+
$Identifier.stringify = NTriplesTerm.stringify;
|
|
3737
3736
|
})($Identifier = NodeShape.$Identifier || (NodeShape.$Identifier = {}));
|
|
3738
3737
|
function $filter(filter, value) {
|
|
3739
3738
|
if (filter.$identifier !== undefined &&
|
|
@@ -3958,7 +3957,7 @@ export var NodeShape;
|
|
|
3958
3957
|
})) {
|
|
3959
3958
|
return Right(true);
|
|
3960
3959
|
}
|
|
3961
|
-
return Left(new Error(`${
|
|
3960
|
+
return Left(new Error(`${$resource.identifier} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#NodeShape)`));
|
|
3962
3961
|
})
|
|
3963
3962
|
: Right(true)).chain((_rdfTypeCheck) => Right(new Resource.Value({
|
|
3964
3963
|
dataFactory: dataFactory,
|
|
@@ -5590,8 +5589,8 @@ export var Shape;
|
|
|
5590
5589
|
})));
|
|
5591
5590
|
let $Identifier;
|
|
5592
5591
|
(function ($Identifier) {
|
|
5593
|
-
$Identifier.
|
|
5594
|
-
$Identifier.
|
|
5592
|
+
$Identifier.parse = $parseIdentifier;
|
|
5593
|
+
$Identifier.stringify = NTriplesTerm.stringify;
|
|
5595
5594
|
})($Identifier = Shape.$Identifier || (Shape.$Identifier = {}));
|
|
5596
5595
|
Shape.$schema = {
|
|
5597
5596
|
kind: "NamedObjectUnion",
|
|
@@ -5969,8 +5968,8 @@ export var $Object;
|
|
|
5969
5968
|
})));
|
|
5970
5969
|
let $Identifier;
|
|
5971
5970
|
(function ($Identifier) {
|
|
5972
|
-
$Identifier.
|
|
5973
|
-
$Identifier.
|
|
5971
|
+
$Identifier.parse = $parseIdentifier;
|
|
5972
|
+
$Identifier.stringify = NTriplesTerm.stringify;
|
|
5974
5973
|
})($Identifier = $Object.$Identifier || ($Object.$Identifier = {}));
|
|
5975
5974
|
$Object.$schema = {
|
|
5976
5975
|
kind: "NamedObjectUnion",
|
package/package.json
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@shaclmate/shacl-ast": "4.0.
|
|
4
|
-
"@rdfjs/data-model": "~2.1.1",
|
|
3
|
+
"@shaclmate/shacl-ast": "4.0.20",
|
|
5
4
|
"@rdfjs/dataset": "~2.0.2",
|
|
6
5
|
"@rdfjs/prefix-map": "~0.1.2",
|
|
7
6
|
"@rdfjs/term-map": "~2.0.2",
|
|
8
7
|
"@rdfjs/term-set": "~2.0.3",
|
|
9
8
|
"@rdfjs/types": "~2.0.1",
|
|
10
|
-
"@rdfx/
|
|
11
|
-
"@rdfx/
|
|
9
|
+
"@rdfx/data-factory": "0.0.11",
|
|
10
|
+
"@rdfx/literal": "0.0.11",
|
|
11
|
+
"@rdfx/resource": "0.0.11",
|
|
12
|
+
"@rdfx/string": "0.0.11",
|
|
12
13
|
"@sindresorhus/base62": "~0.1.0",
|
|
13
14
|
"@tpluscode/rdf-ns-builders": "~4.3.0",
|
|
14
|
-
"@types/rdfjs__data-model": "~2.0.9",
|
|
15
15
|
"@types/rdfjs__dataset": "~2.0.7",
|
|
16
16
|
"@types/rdfjs__prefix-map": "~0.1.5",
|
|
17
17
|
"@types/rdfjs__term-map": "~2.0.10",
|
|
18
18
|
"@types/rdfjs__term-set": "~2.0.9",
|
|
19
19
|
"@types/toposort": "2.0.7",
|
|
20
20
|
"change-case": "~5.4.4",
|
|
21
|
-
"pino": "~9.1.0",
|
|
22
21
|
"plur": "~5.1.0",
|
|
23
22
|
"purify-ts": "~2.1.4",
|
|
24
23
|
"reserved-identifiers": "~1.0.0",
|
|
@@ -42,8 +41,6 @@
|
|
|
42
41
|
"dist/enums/*.js",
|
|
43
42
|
"dist/generators/*.d.ts",
|
|
44
43
|
"dist/generators/*.js",
|
|
45
|
-
"dist/generators/json/*.d.ts",
|
|
46
|
-
"dist/generators/json/*.js",
|
|
47
44
|
"dist/generators/ts/*.d.ts",
|
|
48
45
|
"dist/generators/ts/*.js",
|
|
49
46
|
"dist/generators/ts/_NamedObjectType/*.d.ts",
|
|
@@ -73,5 +70,5 @@
|
|
|
73
70
|
},
|
|
74
71
|
"type": "module",
|
|
75
72
|
"types": "./dist/index.d.ts",
|
|
76
|
-
"version": "4.0.
|
|
73
|
+
"version": "4.0.20"
|
|
77
74
|
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { Resource } from "@rdfx/resource";
|
|
2
|
-
function termToJson(term) {
|
|
3
|
-
switch (term.termType) {
|
|
4
|
-
case "BlankNode":
|
|
5
|
-
return { termType: term.termType, value: term.value };
|
|
6
|
-
case "Literal":
|
|
7
|
-
return {
|
|
8
|
-
datatype: term.datatype.value,
|
|
9
|
-
language: term.language,
|
|
10
|
-
termType: term.termType,
|
|
11
|
-
value: term.value,
|
|
12
|
-
};
|
|
13
|
-
case "NamedNode":
|
|
14
|
-
return { termType: term.termType, value: term.value };
|
|
15
|
-
default:
|
|
16
|
-
throw new Error(`unsupported term type: ${term.termType}`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function typeToJson(type) {
|
|
20
|
-
const common = {
|
|
21
|
-
kind: type.kind,
|
|
22
|
-
comment: type.comment.extract(),
|
|
23
|
-
label: type.label.extract(),
|
|
24
|
-
};
|
|
25
|
-
switch (type.kind) {
|
|
26
|
-
case "BlankNodeType":
|
|
27
|
-
case "IdentifierType":
|
|
28
|
-
case "IriType":
|
|
29
|
-
return {
|
|
30
|
-
...common,
|
|
31
|
-
hasValue: type.hasValues.length > 0
|
|
32
|
-
? type.hasValues.map(termToJson)
|
|
33
|
-
: undefined,
|
|
34
|
-
nodeKinds: [...type.nodeKinds],
|
|
35
|
-
};
|
|
36
|
-
case "IntersectionType":
|
|
37
|
-
return {
|
|
38
|
-
...common,
|
|
39
|
-
members: type.members.map((member) => ({
|
|
40
|
-
type: typeToJson(member.type),
|
|
41
|
-
})),
|
|
42
|
-
name: type.name.extract(),
|
|
43
|
-
shapeIdentifier: Resource.Identifier.toString(type.shapeIdentifier),
|
|
44
|
-
};
|
|
45
|
-
case "LazyObjectOptionType":
|
|
46
|
-
case "LazyObjectSetType":
|
|
47
|
-
case "LazyObjectType":
|
|
48
|
-
return {
|
|
49
|
-
...common,
|
|
50
|
-
partialType: typeToJson(type.partialType),
|
|
51
|
-
resolveType: typeToJson(type.resolveType),
|
|
52
|
-
};
|
|
53
|
-
case "ListType": {
|
|
54
|
-
return {
|
|
55
|
-
...common,
|
|
56
|
-
itemType: typeToJson(type.itemType),
|
|
57
|
-
mutable: type.mutable,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
case "LiteralType": {
|
|
61
|
-
return {
|
|
62
|
-
...common,
|
|
63
|
-
datatype: type.datatype.extract(),
|
|
64
|
-
hasValue: type.hasValues.length > 0
|
|
65
|
-
? type.hasValues.map(termToJson)
|
|
66
|
-
: undefined,
|
|
67
|
-
maxExclusive: type.maxExclusive.map(termToJson).extract(),
|
|
68
|
-
maxInclusive: type.maxInclusive.map(termToJson).extract(),
|
|
69
|
-
minExclusive: type.minExclusive.map(termToJson).extract(),
|
|
70
|
-
minInclusive: type.minInclusive.map(termToJson).extract(),
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
case "ObjectType":
|
|
74
|
-
return {
|
|
75
|
-
...common,
|
|
76
|
-
name: type.name.extract(),
|
|
77
|
-
shapeIdentifier: Resource.Identifier.toString(type.shapeIdentifier),
|
|
78
|
-
fromRdfType: type.fromRdfType.map(termToJson).extract(),
|
|
79
|
-
parentObjectTypes: type.parentObjectTypes.length > 0
|
|
80
|
-
? type.parentObjectTypes.map((type) => Resource.Identifier.toString(type.shapeIdentifier))
|
|
81
|
-
: undefined,
|
|
82
|
-
identifierMintingStrategy: type.identifierMintingStrategy.extract(),
|
|
83
|
-
identifierType: typeToJson(type.identifierType),
|
|
84
|
-
synthetic: type.synthetic ? true : undefined,
|
|
85
|
-
toRdfTypes: type.toRdfTypes.length > 0
|
|
86
|
-
? type.toRdfTypes.map(termToJson)
|
|
87
|
-
: undefined,
|
|
88
|
-
};
|
|
89
|
-
case "DefaultValueType":
|
|
90
|
-
case "OptionType":
|
|
91
|
-
return {
|
|
92
|
-
...common,
|
|
93
|
-
itemType: typeToJson(type.itemType),
|
|
94
|
-
};
|
|
95
|
-
case "SetType":
|
|
96
|
-
return {
|
|
97
|
-
...common,
|
|
98
|
-
itemType: typeToJson(type.itemType),
|
|
99
|
-
};
|
|
100
|
-
case "TermType":
|
|
101
|
-
return {
|
|
102
|
-
...common,
|
|
103
|
-
};
|
|
104
|
-
case "UnionType":
|
|
105
|
-
return {
|
|
106
|
-
...common,
|
|
107
|
-
members: type.members.map((member) => ({
|
|
108
|
-
discriminantValue: member.discriminantValue.extract(),
|
|
109
|
-
type: typeToJson(member.type),
|
|
110
|
-
})),
|
|
111
|
-
name: type.name.extract(),
|
|
112
|
-
shapeIdentifier: Resource.Identifier.toString(type.shapeIdentifier),
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
export class AstJsonGenerator {
|
|
117
|
-
generate(ast) {
|
|
118
|
-
return JSON.stringify({
|
|
119
|
-
objectTypes: ast.namedObjectTypes.map((objectType) => ({
|
|
120
|
-
kind: objectType.kind,
|
|
121
|
-
comment: objectType.comment.extract(),
|
|
122
|
-
identifierMintingStrategy: objectType.identifierMintingStrategy.extract(),
|
|
123
|
-
identifierType: typeToJson(objectType.identifierType),
|
|
124
|
-
label: objectType.label.extract(),
|
|
125
|
-
name: objectType.name.extract(),
|
|
126
|
-
shapeIdentifier: Resource.Identifier.toString(objectType.shapeIdentifier),
|
|
127
|
-
properties: objectType.properties.map((property) => ({
|
|
128
|
-
comment: property.comment.extract(),
|
|
129
|
-
description: property.description.extract(),
|
|
130
|
-
label: property.label.extract(),
|
|
131
|
-
mutable: property.mutable,
|
|
132
|
-
name: property.name,
|
|
133
|
-
order: property.order,
|
|
134
|
-
path: property.path,
|
|
135
|
-
recursive: property.recursive ? true : undefined,
|
|
136
|
-
shapeIdentifier: Resource.Identifier.toString(property.shapeIdentifier),
|
|
137
|
-
type: typeToJson(property.type),
|
|
138
|
-
visibility: property.visibility,
|
|
139
|
-
})),
|
|
140
|
-
})),
|
|
141
|
-
}, undefined, 2);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
//# sourceMappingURL=AstJsonGenerator.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { imports } from "../imports.js";
|
|
2
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
3
|
-
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
4
|
-
export const snippets_blankNodeFromString = conditionalOutput(`${syntheticNamePrefix}blankNodeFromString`, code `\
|
|
5
|
-
export function ${syntheticNamePrefix}blankNodeFromString(identifier: string): ${imports.Either}<Error, ${imports.BlankNode}> {
|
|
6
|
-
return \
|
|
7
|
-
${imports.Either}.encase(() => ${imports.Resource}.Identifier.fromString({ ${imports.dataFactory}, identifier }))
|
|
8
|
-
.chain((identifier) => (identifier.termType === "BlankNode") ? ${imports.Right}(identifier) : ${imports.Left}(new Error("expected identifier to be BlankNode"))) \
|
|
9
|
-
as ${imports.Either}<Error, ${imports.BlankNode}>;
|
|
10
|
-
}`);
|
|
11
|
-
//# sourceMappingURL=snippets_blankNodeFromString.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { imports } from "../imports.js";
|
|
2
|
-
import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
|
|
3
|
-
import { code, conditionalOutput } from "../ts-poet-wrapper.js";
|
|
4
|
-
export const snippets_identifierFromString = conditionalOutput(`${syntheticNamePrefix}identifierFromString`, code `\
|
|
5
|
-
function ${syntheticNamePrefix}identifierFromString(identifier: string): ${imports.Either}<Error, ${imports.BlankNode} | ${imports.NamedNode}> {
|
|
6
|
-
return ${imports.Either}.encase(() => ${imports.Resource}.Identifier.fromString({ ${imports.dataFactory}, identifier }));
|
|
7
|
-
}`);
|
|
8
|
-
//# sourceMappingURL=snippets_identifierFromString.js.map
|
package/dist/logger.d.ts
DELETED
package/dist/logger.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { pino } from "pino";
|
|
2
|
-
export const logger = pino({
|
|
3
|
-
level: process.env["NODE_ENV"] === "development" ||
|
|
4
|
-
process.env["NODE_ENV"] === "test"
|
|
5
|
-
? "debug"
|
|
6
|
-
: "info",
|
|
7
|
-
}, pino["destination"] ? pino.destination(2) : undefined);
|
|
8
|
-
//# sourceMappingURL=logger.js.map
|