@shaclmate/compiler 4.0.19 → 4.0.21

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.
Files changed (105) hide show
  1. package/dist/Compiler.d.ts +4 -1
  2. package/dist/Compiler.js +4 -1
  3. package/dist/ShapesGraphToAstTransformer.d.ts +4 -1
  4. package/dist/ShapesGraphToAstTransformer.js +9 -6
  5. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +1 -1
  6. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +1 -1
  7. package/dist/ast/AbstractCollectionType.d.ts +1 -1
  8. package/dist/ast/AbstractContainerType.d.ts +1 -1
  9. package/dist/ast/AbstractLazyObjectType.d.ts +19 -79
  10. package/dist/ast/AbstractTermType.d.ts +3 -33
  11. package/dist/ast/AbstractTermType.js +2 -3
  12. package/dist/ast/AbstractType.d.ts +1 -1
  13. package/dist/ast/AbstractType.js +1 -2
  14. package/dist/ast/BlankNodeType.d.ts +1 -1
  15. package/dist/ast/DefaultValueType.d.ts +2 -17
  16. package/dist/ast/DefaultValueType.js +1 -2
  17. package/dist/ast/IdentifierType.d.ts +1 -1
  18. package/dist/ast/LiteralType.d.ts +8 -98
  19. package/dist/ast/LiteralType.js +5 -7
  20. package/dist/ast/ObjectCompoundType.js +1 -2
  21. package/dist/ast/ObjectType.d.ts +9 -39
  22. package/dist/ast/ObjectType.js +9 -13
  23. package/dist/ast/SetType.d.ts +1 -1
  24. package/dist/ast/UnionType.d.ts +1 -1
  25. package/dist/generators/transformAstToLabeledPropertyGraph.js +3 -4
  26. package/dist/generators/ts/AbstractContainerType.d.ts +1 -0
  27. package/dist/generators/ts/AbstractContainerType.js +3 -0
  28. package/dist/generators/ts/AbstractDateType.js +1 -1
  29. package/dist/generators/ts/AbstractIdentifierType.d.ts +2 -2
  30. package/dist/generators/ts/AbstractIdentifierType.js +2 -5
  31. package/dist/generators/ts/AbstractLazyObjectType.d.ts +2 -1
  32. package/dist/generators/ts/AbstractLazyObjectType.js +6 -3
  33. package/dist/generators/ts/AbstractNamedUnionType.js +2 -2
  34. package/dist/generators/ts/AbstractNumericType.js +1 -1
  35. package/dist/generators/ts/AbstractTermType.d.ts +1 -0
  36. package/dist/generators/ts/AbstractTermType.js +8 -2
  37. package/dist/generators/ts/AbstractType.d.ts +21 -14
  38. package/dist/generators/ts/AbstractType.js +3 -1
  39. package/dist/generators/ts/AbstractUnionType.d.ts +5 -4
  40. package/dist/generators/ts/AbstractUnionType.js +83 -59
  41. package/dist/generators/ts/BlankNodeType.d.ts +2 -2
  42. package/dist/generators/ts/BlankNodeType.js +1 -1
  43. package/dist/generators/ts/BooleanType.js +1 -1
  44. package/dist/generators/ts/DefaultValueType.js +1 -1
  45. package/dist/generators/ts/IdentifierType.d.ts +2 -2
  46. package/dist/generators/ts/IdentifierType.js +1 -1
  47. package/dist/generators/ts/IriType.d.ts +1 -1
  48. package/dist/generators/ts/IriType.js +8 -13
  49. package/dist/generators/ts/LazyObjectOptionType.d.ts +1 -0
  50. package/dist/generators/ts/LazyObjectOptionType.js +1 -1
  51. package/dist/generators/ts/LazyObjectType.js +1 -1
  52. package/dist/generators/ts/ListType.js +5 -5
  53. package/dist/generators/ts/NamedObjectType.d.ts +1 -0
  54. package/dist/generators/ts/NamedObjectType.js +7 -0
  55. package/dist/generators/ts/NamedObjectUnionType.js +4 -1
  56. package/dist/generators/ts/SetType.js +1 -1
  57. package/dist/generators/ts/StringType.js +1 -1
  58. package/dist/generators/ts/TermType.js +3 -1
  59. package/dist/generators/ts/TsGenerator.d.ts +5 -0
  60. package/dist/generators/ts/TsGenerator.js +7 -1
  61. package/dist/generators/ts/TypeFactory.d.ts +5 -0
  62. package/dist/generators/ts/TypeFactory.js +35 -5
  63. package/dist/generators/ts/ZodGenerator.d.ts +4 -0
  64. package/dist/generators/ts/ZodGenerator.js +4 -1
  65. package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +4 -1
  66. package/dist/generators/ts/_NamedObjectType/AbstractProperty.js +3 -1
  67. package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +6 -5
  68. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +2 -2
  69. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +2 -2
  70. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js +1 -1
  71. package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.js +2 -2
  72. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js +1 -1
  73. package/dist/generators/ts/_NamedObjectType/ShaclProperty.d.ts +1 -0
  74. package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +16 -16
  75. package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.js +6 -2
  76. package/dist/generators/ts/_snippets/parseIri.d.ts +2 -0
  77. package/dist/generators/ts/_snippets/parseIri.js +12 -0
  78. package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.js +4 -3
  79. package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.js +7 -5
  80. package/dist/generators/ts/_snippets/snippets_parseBlankNode.d.ts +2 -0
  81. package/dist/generators/ts/_snippets/snippets_parseBlankNode.js +12 -0
  82. package/dist/generators/ts/_snippets/snippets_parseIdentifier.d.ts +2 -0
  83. package/dist/generators/ts/_snippets/snippets_parseIdentifier.js +6 -0
  84. package/dist/generators/ts/graphqlSchemaVariableStatement.js +3 -3
  85. package/dist/generators/ts/imports.d.ts +2 -0
  86. package/dist/generators/ts/imports.js +3 -1
  87. package/dist/generators/ts/rdfjsTermExpression.d.ts +4 -1
  88. package/dist/generators/ts/rdfjsTermExpression.js +2 -3
  89. package/dist/generators/ts/snippets.d.ts +3 -2
  90. package/dist/generators/ts/snippets.js +6 -4
  91. package/dist/generators/ts/synthesizeUberObjectUnionType.d.ts +2 -0
  92. package/dist/generators/ts/synthesizeUberObjectUnionType.js +4 -0
  93. package/dist/input/ShapesGraph.d.ts +4 -1
  94. package/dist/input/ShapesGraph.js +3 -2
  95. package/dist/input/generated.d.ts +323 -323
  96. package/dist/input/generated.js +19 -20
  97. package/package.json +6 -7
  98. package/dist/ast/termToJson.d.ts +0 -18
  99. package/dist/ast/termToJson.js +0 -18
  100. package/dist/generators/ts/_snippets/snippets_blankNodeFromString.d.ts +0 -2
  101. package/dist/generators/ts/_snippets/snippets_blankNodeFromString.js +0 -11
  102. package/dist/generators/ts/_snippets/snippets_identifierFromString.d.ts +0 -2
  103. package/dist/generators/ts/_snippets/snippets_identifierFromString.js +0 -8
  104. package/dist/logger.d.ts +0 -2
  105. package/dist/logger.js +0 -8
@@ -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.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
873
- $Identifier.toString = Resource.Identifier.toString;
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(`${Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyShape)`));
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.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
2416
- $Identifier.toString = Resource.Identifier.toString;
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(`${Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#PropertyGroup)`));
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.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
2676
- $Identifier.toString = Resource.Identifier.toString;
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(`${Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/2002/07/owl#Ontology)`));
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.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
3736
- $Identifier.toString = Resource.Identifier.toString;
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(`${Resource.Identifier.toString($resource.identifier)} has unexpected RDF type (actual: ${actualRdfType.value}, expected: http://www.w3.org/ns/shacl#NodeShape)`));
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.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
5594
- $Identifier.toString = Resource.Identifier.toString;
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.fromString = $identifierFromString; // biome-ignore lint/suspicious/noShadowRestrictedNames: allow toString
5973
- $Identifier.toString = Resource.Identifier.toString;
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.19",
4
- "@rdfjs/data-model": "~2.1.1",
3
+ "@shaclmate/shacl-ast": "4.0.21",
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/literal": "0.0.7",
11
- "@rdfx/resource": "0.0.7",
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",
@@ -71,5 +70,5 @@
71
70
  },
72
71
  "type": "module",
73
72
  "types": "./dist/index.d.ts",
74
- "version": "4.0.19"
73
+ "version": "4.0.21"
75
74
  }
@@ -1,18 +0,0 @@
1
- import type { Term } from "@rdfjs/types";
2
- export declare function termToJson(term: Term): {
3
- termType: "BlankNode";
4
- value: string;
5
- datatype?: undefined;
6
- language?: undefined;
7
- } | {
8
- datatype: string;
9
- language: string;
10
- termType: "Literal";
11
- value: string;
12
- } | {
13
- termType: "NamedNode";
14
- value: string;
15
- datatype?: undefined;
16
- language?: undefined;
17
- };
18
- //# sourceMappingURL=termToJson.d.ts.map
@@ -1,18 +0,0 @@
1
- export function termToJson(term) {
2
- switch (term.termType) {
3
- case "BlankNode":
4
- return { termType: term.termType, value: term.value };
5
- case "Literal":
6
- return {
7
- datatype: term.datatype.value,
8
- language: term.language,
9
- termType: term.termType,
10
- value: term.value,
11
- };
12
- case "NamedNode":
13
- return { termType: term.termType, value: term.value };
14
- default:
15
- throw new Error(`unsupported term type: ${term.termType}`);
16
- }
17
- }
18
- //# sourceMappingURL=termToJson.js.map
@@ -1,2 +0,0 @@
1
- export declare const snippets_blankNodeFromString: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
2
- //# sourceMappingURL=snippets_blankNodeFromString.d.ts.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,2 +0,0 @@
1
- export declare const snippets_identifierFromString: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
2
- //# sourceMappingURL=snippets_identifierFromString.d.ts.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
@@ -1,2 +0,0 @@
1
- export declare const logger: import("pino").Logger<never>;
2
- //# sourceMappingURL=logger.d.ts.map
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