@shaclmate/compiler 4.0.33 → 4.0.34

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 (220) hide show
  1. package/dist/Compiler.d.ts +0 -3
  2. package/dist/Compiler.js +0 -2
  3. package/dist/ShapesGraphToAstTransformer.d.ts +1 -4
  4. package/dist/ShapesGraphToAstTransformer.js +1 -5
  5. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +1 -3
  6. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +4 -7
  7. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +0 -1
  8. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +1 -3
  9. package/dist/ast/AbstractCompoundType.d.ts +6 -4
  10. package/dist/ast/AbstractCompoundType.js +4 -37
  11. package/dist/ast/ObjectType.d.ts +1 -7
  12. package/dist/ast/ObjectType.js +1 -6
  13. package/dist/generators/ts/AbstractCollectionType.d.ts +8 -8
  14. package/dist/generators/ts/AbstractCollectionType.js +28 -111
  15. package/dist/generators/ts/AbstractContainerType.d.ts +1 -1
  16. package/dist/generators/ts/AbstractDateType.d.ts +4 -9
  17. package/dist/generators/ts/AbstractDateType.js +2 -29
  18. package/dist/generators/ts/AbstractIdentifierType.d.ts +4 -1
  19. package/dist/generators/ts/AbstractIdentifierType.js +0 -17
  20. package/dist/generators/ts/AbstractLazyObjectType.d.ts +8 -5
  21. package/dist/generators/ts/AbstractLazyObjectType.js +21 -21
  22. package/dist/generators/ts/AbstractLiteralType.d.ts +11 -3
  23. package/dist/generators/ts/AbstractLiteralType.js +1 -1
  24. package/dist/generators/ts/AbstractNamedUnionType.d.ts +2 -5
  25. package/dist/generators/ts/AbstractNamedUnionType.js +27 -58
  26. package/dist/generators/ts/AbstractNumericType.d.ts +9 -8
  27. package/dist/generators/ts/AbstractNumericType.js +18 -11
  28. package/dist/generators/ts/AbstractPrimitiveType.d.ts +8 -4
  29. package/dist/generators/ts/AbstractPrimitiveType.js +9 -17
  30. package/dist/generators/ts/AbstractTermType.d.ts +8 -4
  31. package/dist/generators/ts/AbstractTermType.js +11 -51
  32. package/dist/generators/ts/AbstractType.d.ts +26 -22
  33. package/dist/generators/ts/AbstractType.js +4 -2
  34. package/dist/generators/ts/AbstractUnionType.d.ts +2 -2
  35. package/dist/generators/ts/AbstractUnionType.js +25 -36
  36. package/dist/generators/ts/AnonymousUnionType.d.ts +1 -1
  37. package/dist/generators/ts/AnonymousUnionType.js +3 -3
  38. package/dist/generators/ts/BigDecimalType.d.ts +5 -3
  39. package/dist/generators/ts/BigDecimalType.js +15 -42
  40. package/dist/generators/ts/BigIntType.d.ts +3 -4
  41. package/dist/generators/ts/BigIntType.js +5 -16
  42. package/dist/generators/ts/BlankNodeType.d.ts +7 -7
  43. package/dist/generators/ts/BlankNodeType.js +14 -2
  44. package/dist/generators/ts/BooleanType.d.ts +6 -8
  45. package/dist/generators/ts/BooleanType.js +18 -11
  46. package/dist/generators/ts/DateTimeType.d.ts +5 -1
  47. package/dist/generators/ts/DateTimeType.js +15 -13
  48. package/dist/generators/ts/DateType.d.ts +5 -1
  49. package/dist/generators/ts/DateType.js +16 -14
  50. package/dist/generators/ts/DefaultValueType.d.ts +5 -6
  51. package/dist/generators/ts/DefaultValueType.js +30 -64
  52. package/dist/generators/ts/FloatType.d.ts +3 -3
  53. package/dist/generators/ts/FloatType.js +5 -5
  54. package/dist/generators/ts/IdentifierType.d.ts +6 -6
  55. package/dist/generators/ts/IdentifierType.js +22 -2
  56. package/dist/generators/ts/IntType.d.ts +3 -3
  57. package/dist/generators/ts/IntType.js +5 -5
  58. package/dist/generators/ts/IriType.d.ts +17 -12
  59. package/dist/generators/ts/IriType.js +39 -29
  60. package/dist/generators/ts/LazyObjectOptionType.d.ts +2 -1
  61. package/dist/generators/ts/LazyObjectOptionType.js +23 -44
  62. package/dist/generators/ts/LazyObjectSetType.d.ts +1 -1
  63. package/dist/generators/ts/LazyObjectSetType.js +19 -29
  64. package/dist/generators/ts/LazyObjectType.d.ts +1 -1
  65. package/dist/generators/ts/LazyObjectType.js +17 -25
  66. package/dist/generators/ts/LiteralType.d.ts +5 -3
  67. package/dist/generators/ts/LiteralType.js +25 -12
  68. package/dist/generators/ts/NamedObjectType.d.ts +6 -9
  69. package/dist/generators/ts/NamedObjectType.js +33 -29
  70. package/dist/generators/ts/NamedObjectUnionType.d.ts +3 -1
  71. package/dist/generators/ts/NamedObjectUnionType.js +21 -14
  72. package/dist/generators/ts/OptionType.d.ts +4 -4
  73. package/dist/generators/ts/OptionType.js +22 -45
  74. package/dist/generators/ts/Reusables.d.ts +3 -1
  75. package/dist/generators/ts/Reusables.js +2 -1
  76. package/dist/generators/ts/SetType.d.ts +0 -1
  77. package/dist/generators/ts/SetType.js +4 -22
  78. package/dist/generators/ts/SnippetFactory.d.ts +2 -0
  79. package/dist/generators/ts/Snippets.d.ts +40 -8
  80. package/dist/generators/ts/Snippets.js +235 -30
  81. package/dist/generators/ts/StringType.d.ts +6 -9
  82. package/dist/generators/ts/StringType.js +17 -16
  83. package/dist/generators/ts/TermType.d.ts +1 -4
  84. package/dist/generators/ts/TermType.js +14 -8
  85. package/dist/generators/ts/TsGenerator.d.ts +14 -1
  86. package/dist/generators/ts/TsGenerator.js +41 -12
  87. package/dist/generators/ts/TypeFactory.d.ts +8 -4
  88. package/dist/generators/ts/TypeFactory.js +73 -49
  89. package/dist/generators/ts/ZodGenerator.js +6 -3
  90. package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +27 -20
  91. package/dist/generators/ts/_NamedObjectType/AbstractProperty.js +4 -2
  92. package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.d.ts +7 -7
  93. package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.js +9 -9
  94. package/dist/generators/ts/_NamedObjectType/IdentifierProperty.d.ts +6 -6
  95. package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +35 -39
  96. package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.js +34 -31
  97. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js +1 -1
  98. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +1 -1
  99. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +1 -1
  100. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +7 -16
  101. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +26 -32
  102. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +1 -1
  103. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js +1 -1
  104. package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js +2 -3
  105. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +6 -8
  106. package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js +1 -2
  107. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +1 -1
  108. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js +1 -1
  109. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +1 -1
  110. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +1 -1
  111. package/dist/generators/ts/_NamedObjectType/NamedObjectType_objectSetMethodNames.d.ts +2 -0
  112. package/dist/generators/ts/_NamedObjectType/NamedObjectType_objectSetMethodNames.js +1 -1
  113. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts +2 -2
  114. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js +1 -1
  115. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts +2 -2
  116. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +1 -1
  117. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js +2 -2
  118. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js +1 -1
  119. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js +14 -18
  120. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +1 -1
  121. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js +1 -1
  122. package/dist/generators/ts/_NamedObjectType/ShaclProperty.d.ts +7 -7
  123. package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +22 -30
  124. package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.js +3 -3
  125. package/dist/generators/ts/_snippets/snippets_HashFunction.d.ts +3 -0
  126. package/dist/generators/ts/_snippets/snippets_HashFunction.js +4 -0
  127. package/dist/generators/ts/_snippets/snippets_PropertyPath.js +34 -24
  128. package/dist/generators/ts/_snippets/snippets_convertToBigDecimal.d.ts +3 -0
  129. package/dist/generators/ts/_snippets/snippets_convertToBigDecimal.js +6 -0
  130. package/dist/generators/ts/_snippets/snippets_convertToBlankNode.d.ts +3 -0
  131. package/dist/generators/ts/_snippets/snippets_convertToBlankNode.js +11 -0
  132. package/dist/generators/ts/_snippets/snippets_convertToBlankNodeIdentifierProperty.d.ts +3 -0
  133. package/dist/generators/ts/_snippets/snippets_convertToBlankNodeIdentifierProperty.js +17 -0
  134. package/dist/generators/ts/_snippets/snippets_convertToBoolean.d.ts +3 -0
  135. package/dist/generators/ts/_snippets/snippets_convertToBoolean.js +6 -0
  136. package/dist/generators/ts/_snippets/snippets_convertToDate.d.ts +3 -0
  137. package/dist/generators/ts/_snippets/snippets_convertToDate.js +6 -0
  138. package/dist/generators/ts/_snippets/snippets_convertToDateTime.d.ts +3 -0
  139. package/dist/generators/ts/_snippets/snippets_convertToDateTime.js +6 -0
  140. package/dist/generators/ts/_snippets/snippets_convertToIdentifier.d.ts +3 -0
  141. package/dist/generators/ts/_snippets/snippets_convertToIdentifier.js +13 -0
  142. package/dist/generators/ts/_snippets/snippets_convertToIdentifierProperty.d.ts +3 -0
  143. package/dist/generators/ts/_snippets/snippets_convertToIdentifierProperty.js +21 -0
  144. package/dist/generators/ts/_snippets/snippets_convertToIri.d.ts +3 -0
  145. package/dist/generators/ts/_snippets/snippets_convertToIri.js +11 -0
  146. package/dist/generators/ts/_snippets/snippets_convertToIriIdentifierProperty.d.ts +3 -0
  147. package/dist/generators/ts/_snippets/snippets_convertToIriIdentifierProperty.js +17 -0
  148. package/dist/generators/ts/_snippets/snippets_convertToLazyObject.d.ts +3 -0
  149. package/dist/generators/ts/_snippets/snippets_convertToLazyObject.js +15 -0
  150. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectOption.d.ts +3 -0
  151. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectOption.js +31 -0
  152. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectSet.d.ts +3 -0
  153. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectSet.js +25 -0
  154. package/dist/generators/ts/_snippets/snippets_convertToLiteral.d.ts +3 -0
  155. package/dist/generators/ts/_snippets/snippets_convertToLiteral.js +13 -0
  156. package/dist/generators/ts/_snippets/snippets_convertToMaybe.d.ts +3 -0
  157. package/dist/generators/ts/_snippets/snippets_convertToMaybe.js +19 -0
  158. package/dist/generators/ts/_snippets/snippets_convertToMutableArray.d.ts +3 -0
  159. package/dist/generators/ts/_snippets/snippets_convertToMutableArray.js +14 -0
  160. package/dist/generators/ts/_snippets/snippets_convertToNumeric.d.ts +3 -0
  161. package/dist/generators/ts/_snippets/snippets_convertToNumeric.js +6 -0
  162. package/dist/generators/ts/_snippets/snippets_convertToObject.d.ts +3 -0
  163. package/dist/generators/ts/_snippets/snippets_convertToObject.js +6 -0
  164. package/dist/generators/ts/_snippets/snippets_convertToReadonlyArray.d.ts +3 -0
  165. package/dist/generators/ts/_snippets/snippets_convertToReadonlyArray.js +14 -0
  166. package/dist/generators/ts/_snippets/snippets_convertToString.d.ts +3 -0
  167. package/dist/generators/ts/_snippets/snippets_convertToString.js +6 -0
  168. package/dist/generators/ts/_snippets/snippets_convertToTerm.d.ts +3 -0
  169. package/dist/generators/ts/_snippets/snippets_convertToTerm.js +6 -0
  170. package/dist/generators/ts/_snippets/snippets_convertToUnion.d.ts +3 -0
  171. package/dist/generators/ts/_snippets/snippets_convertToUnion.js +6 -0
  172. package/dist/generators/ts/_snippets/snippets_convertWithDefaultValue.d.ts +3 -0
  173. package/dist/generators/ts/_snippets/snippets_convertWithDefaultValue.js +11 -0
  174. package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +1 -1
  175. package/dist/generators/ts/_snippets/snippets_hashArray.d.ts +3 -0
  176. package/dist/generators/ts/_snippets/snippets_hashArray.js +11 -0
  177. package/dist/generators/ts/_snippets/snippets_hashBigDecimal.d.ts +3 -0
  178. package/dist/generators/ts/_snippets/snippets_hashBigDecimal.js +7 -0
  179. package/dist/generators/ts/_snippets/snippets_hashBoolean.d.ts +3 -0
  180. package/dist/generators/ts/_snippets/snippets_hashBoolean.js +7 -0
  181. package/dist/generators/ts/_snippets/snippets_hashDate.d.ts +3 -0
  182. package/dist/generators/ts/_snippets/snippets_hashDate.js +7 -0
  183. package/dist/generators/ts/_snippets/snippets_hashDateTime.d.ts +3 -0
  184. package/dist/generators/ts/_snippets/snippets_hashDateTime.js +7 -0
  185. package/dist/generators/ts/_snippets/snippets_hashMaybe.d.ts +3 -0
  186. package/dist/generators/ts/_snippets/snippets_hashMaybe.js +11 -0
  187. package/dist/generators/ts/_snippets/snippets_hashNumeric.d.ts +3 -0
  188. package/dist/generators/ts/_snippets/snippets_hashNumeric.js +7 -0
  189. package/dist/generators/ts/_snippets/snippets_hashString.d.ts +3 -0
  190. package/dist/generators/ts/_snippets/snippets_hashString.js +7 -0
  191. package/dist/generators/ts/_snippets/snippets_hashTerm.d.ts +3 -0
  192. package/dist/generators/ts/_snippets/snippets_hashTerm.js +12 -0
  193. package/dist/generators/ts/_snippets/snippets_toIsoDateString.d.ts +3 -0
  194. package/dist/generators/ts/_snippets/snippets_toIsoDateString.js +6 -0
  195. package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +1 -1
  196. package/dist/generators/ts/graphqlSchemaVariableStatement.js +7 -4
  197. package/dist/generators/ts/objectSetDeclarations.js +4 -34
  198. package/dist/generators/ts/objectSetInterfaceDeclaration.js +1 -1
  199. package/dist/generators/ts/objectSetMethodSignatures.js +2 -2
  200. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +2 -2
  201. package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +2 -2
  202. package/dist/input/ShapesGraph.d.ts +5 -8
  203. package/dist/input/ShapesGraph.js +5 -6
  204. package/dist/input/generated.d.ts +171 -226
  205. package/dist/input/generated.js +563 -2082
  206. package/package.json +2 -2
  207. package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.d.ts +0 -6
  208. package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.js +0 -67
  209. package/dist/generators/ts/_snippets/snippets_isReadonlyBigIntArray.d.ts +0 -3
  210. package/dist/generators/ts/_snippets/snippets_isReadonlyBigIntArray.js +0 -6
  211. package/dist/generators/ts/_snippets/snippets_isReadonlyBooleanArray.d.ts +0 -3
  212. package/dist/generators/ts/_snippets/snippets_isReadonlyBooleanArray.js +0 -6
  213. package/dist/generators/ts/_snippets/snippets_isReadonlyNumberArray.d.ts +0 -3
  214. package/dist/generators/ts/_snippets/snippets_isReadonlyNumberArray.js +0 -6
  215. package/dist/generators/ts/_snippets/snippets_isReadonlyObjectArray.d.ts +0 -3
  216. package/dist/generators/ts/_snippets/snippets_isReadonlyObjectArray.js +0 -6
  217. package/dist/generators/ts/_snippets/snippets_isReadonlyStringArray.d.ts +0 -3
  218. package/dist/generators/ts/_snippets/snippets_isReadonlyStringArray.js +0 -6
  219. package/dist/generators/ts/syntheticNamePrefix.d.ts +0 -2
  220. package/dist/generators/ts/syntheticNamePrefix.js +0 -2
@@ -0,0 +1,31 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToLazyObjectOption = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToLazyObjectOption`, code `\
3
+ function ${syntheticNamePrefix}convertToLazyObjectOption<ObjectIdentifierT extends ${imports.BlankNode} | ${imports.NamedNode}, PartialObjectT extends { ${syntheticNamePrefix}identifier: () => ObjectIdentifierT }, ResolvedObjectT extends { ${syntheticNamePrefix}identifier: () => ObjectIdentifierT }>(resolvedToPartial: (resolved: ResolvedObjectT) => PartialObjectT) {
4
+ return (_schema: unknown, value: ${snippets.LazyObjectOption}<ObjectIdentifierT, PartialObjectT, ResolvedObjectT> | ${imports.Maybe}<ResolvedObjectT> | ResolvedObjectT | undefined): ${imports.Either}<Error, ${snippets.LazyObjectOption}<ObjectIdentifierT, PartialObjectT, ResolvedObjectT>> => {
5
+ switch (typeof value) {
6
+ case "object": {
7
+ if (value instanceof ${snippets.LazyObjectOption}) {
8
+ return ${imports.Either}.of(value);
9
+ }
10
+
11
+ if (${imports.Maybe}.isMaybe(value)) {
12
+ return ${imports.Either}.of(new ${snippets.LazyObjectOption}<ObjectIdentifierT, PartialObjectT, ResolvedObjectT>({
13
+ partial: value.map(resolvedToPartial),
14
+ resolver: async () => ${imports.Right}(value.unsafeCoerce())
15
+ }));
16
+ }
17
+
18
+ return ${imports.Either}.of(new ${snippets.LazyObjectOption}<ObjectIdentifierT, PartialObjectT, ResolvedObjectT>({
19
+ partial: ${imports.Maybe}.of(resolvedToPartial(value)),
20
+ resolver: async () => ${imports.Right}(value)
21
+ }));
22
+ }
23
+ case "undefined":
24
+ return ${imports.Either}.of(new ${snippets.LazyObjectOption}<ObjectIdentifierT, PartialObjectT, ResolvedObjectT>({
25
+ partial: ${imports.Maybe}.empty(),
26
+ resolver: async () => { throw new Error("should never be called"); }
27
+ }));
28
+ }
29
+ };
30
+ }`);
31
+ //# sourceMappingURL=snippets_convertToLazyObjectOption.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToLazyObjectSet: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToLazyObjectSet.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToLazyObjectSet = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToLazyObjectSet`, code `\
3
+ function ${syntheticNamePrefix}convertToLazyObjectSet<ObjectIdentifierT extends ${imports.BlankNode} | ${imports.NamedNode}, PartialObjectT extends { ${syntheticNamePrefix}identifier: () => ObjectIdentifierT }, ResolvedObjectT extends { ${syntheticNamePrefix}identifier: () => ObjectIdentifierT }>(resolvedToPartial: (resolved: ResolvedObjectT) => PartialObjectT) {
4
+ return (_schema: unknown, value: ${snippets.LazyObjectSet}<ObjectIdentifierT, PartialObjectT, ResolvedObjectT> | readonly ResolvedObjectT[] | undefined): ${imports.Either}<Error, ${snippets.LazyObjectSet}<ObjectIdentifierT, PartialObjectT, ResolvedObjectT>> => {
5
+ switch (typeof value) {
6
+ case "object": {
7
+ if (value instanceof ${snippets.LazyObjectSet}) {
8
+ return ${imports.Either}.of(value);
9
+ }
10
+
11
+ const captureValue = value;
12
+ return ${imports.Either}.of(new ${snippets.LazyObjectSet}<ObjectIdentifierT, PartialObjectT, ResolvedObjectT>({
13
+ partials: value.map(resolvedToPartial),
14
+ resolver: async () => ${imports.Right}(captureValue)
15
+ }));
16
+ }
17
+ case "undefined":
18
+ return ${imports.Either}.of(new ${snippets.LazyObjectSet}<ObjectIdentifierT, PartialObjectT, ResolvedObjectT>({
19
+ partials: [],
20
+ resolver: async () => ${imports.Right}([])
21
+ }));
22
+ }
23
+ };
24
+ }`);
25
+ //# sourceMappingURL=snippets_convertToLazyObjectSet.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToLiteral: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToLiteral.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToLiteral = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToLiteral`, code `\
3
+ function ${syntheticNamePrefix}convertToLiteral(_schema: ${snippets.LiteralSchema}, value: bigint | boolean | Date | number | string | ${imports.Literal}): ${imports.Either}<Error, ${imports.Literal}> {
4
+ if (typeof value === "object") {
5
+ if (value instanceof Date) {
6
+ return ${imports.Either}.of(${snippets.literalFactory}.date(value));
7
+ }
8
+ return ${imports.Either}.of(value);
9
+ }
10
+
11
+ return ${imports.Either}.of(${snippets.literalFactory}.primitive(value));
12
+ }`);
13
+ //# sourceMappingURL=snippets_convertToLiteral.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToMaybe: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToMaybe.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToMaybe = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToMaybe`, code `\
3
+ function ${syntheticNamePrefix}convertToMaybe<ItemSchemaT, ItemSourceT, ItemTargetT>(convertToItem: (schema: ItemSchemaT, value: ItemSourceT) => ${imports.Either}<Error, ItemTargetT>) {
4
+ return (schema: ${snippets.MaybeSchema}<ItemSchemaT>, value: ItemSourceT | ${imports.Maybe}<ItemTargetT> | undefined): ${imports.Either}<Error, ${imports.Maybe}<ItemTargetT>> => {
5
+ switch (typeof value) {
6
+ case "object": {
7
+ if (${imports.Maybe}.isMaybe(value)) {
8
+ return ${imports.Either}.of(value as ${imports.Maybe}<ItemTargetT>);
9
+ }
10
+ break;
11
+ }
12
+ case "undefined":
13
+ return ${imports.Either}.of(${imports.Maybe}.empty());
14
+ }
15
+
16
+ return convertToItem(schema.item(), value).map(${imports.Maybe}.of);
17
+ }
18
+ }`);
19
+ //# sourceMappingURL=snippets_convertToMaybe.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToMutableArray: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToMutableArray.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToMutableArray = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToMutableArray`, code `\
3
+ function ${syntheticNamePrefix}convertToMutableArray<ItemSchemaT, ItemSourceT, ItemTargetT>(convertToItem: (schema: ItemSchemaT, value: ItemSourceT) => ${imports.Either}<Error, ItemTargetT>) {
4
+ return (schema: ${snippets.CollectionSchema}<ItemSchemaT>, value: readonly ItemSourceT[] | undefined): ${imports.Either}<Error, ItemTargetT[]> => {
5
+ return (typeof value === "undefined" ? ${imports.Either}.of<Error, ItemTargetT[]>([]) : ${imports.Either}.sequence(value.map(item => convertToItem(schema.item(), item))))
6
+ .chain(array => {
7
+ if (schema.minCount !== undefined && array.length < schema.minCount) {
8
+ return ${imports.Left}(new Error(\`array has length (\${array.length}) less than minCount (\${schema.minCount})\`));
9
+ }
10
+ return ${imports.Either}.of(array);
11
+ });
12
+ }
13
+ }`);
14
+ //# sourceMappingURL=snippets_convertToMutableArray.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToNumeric: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToNumeric.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToNumeric = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToNumeric`, code `\
3
+ function ${syntheticNamePrefix}convertToNumeric<ValueT extends bigint | number>(_schema: ${snippets.NumericSchema}<ValueT>, value: ValueT): ${imports.Either}<Error, ValueT> {
4
+ return ${imports.Either}.of(value);
5
+ }`);
6
+ //# sourceMappingURL=snippets_convertToNumeric.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToObject: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToObject.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToObject = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToObject`, code `\
3
+ function ${syntheticNamePrefix}convertToObject<ValueT extends object>(_schema: unknown, value: ValueT): ${imports.Either}<Error, ValueT> {
4
+ return ${imports.Either}.of(value);
5
+ }`);
6
+ //# sourceMappingURL=snippets_convertToObject.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToReadonlyArray: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToReadonlyArray.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToReadonlyArray = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToReadonlyArray`, code `\
3
+ function ${syntheticNamePrefix}convertToReadonlyArray<ItemSchemaT, ItemSourceT, ItemTargetT>(convertToItem: (schema: ItemSchemaT, value: ItemSourceT) => ${imports.Either}<Error, ItemTargetT>) {
4
+ return (schema: ${snippets.CollectionSchema}<ItemSchemaT>, value: readonly ItemSourceT[] | undefined): ${imports.Either}<Error, readonly ItemTargetT[]> => {
5
+ return (typeof value === "undefined" ? ${imports.Either}.of<Error, readonly ItemTargetT[]>([]) : ${imports.Either}.sequence(value.map(item => convertToItem(schema.item(), item))))
6
+ .chain(array => {
7
+ if (schema.minCount !== undefined && array.length < schema.minCount) {
8
+ return ${imports.Left}(new Error(\`array has length (\${array.length}) less than minCount (\${schema.minCount})\`));
9
+ }
10
+ return ${imports.Either}.of(array);
11
+ });
12
+ }
13
+ }`);
14
+ //# sourceMappingURL=snippets_convertToReadonlyArray.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToString: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToString.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToString = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToString`, code `\
3
+ function ${syntheticNamePrefix}convertToString<ValueT extends string>(_schema: ${snippets.StringSchema}, value: ValueT): ${imports.Either}<Error, ValueT> {
4
+ return ${imports.Either}.of(value);
5
+ }`);
6
+ //# sourceMappingURL=snippets_convertToString.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToTerm: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToTerm.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToTerm = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToTerm`, code `\
3
+ function ${syntheticNamePrefix}convertToTerm<ValueT extends ${imports.BlankNode} | ${imports.Literal} | ${imports.NamedNode}>(_schema: ${snippets.TermSchema}, value: ValueT): ${imports.Either}<Error, ValueT> {
4
+ return ${imports.Either}.of(value);
5
+ }`);
6
+ //# sourceMappingURL=snippets_convertToTerm.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToUnion: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToUnion.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToUnion = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToUnion`, code `\
3
+ function ${syntheticNamePrefix}convertToUnion<ValueT>(_schema: unknown, value: ValueT): ${imports.Either}<Error, ValueT> {
4
+ return ${imports.Either}.of(value);
5
+ }`);
6
+ //# sourceMappingURL=snippets_convertToUnion.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertWithDefaultValue: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertWithDefaultValue.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertWithDefaultValue = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertWithDefaultValue`, code `\
3
+ function ${syntheticNamePrefix}convertWithDefaultValue<DefaultValueT extends ItemSourceT, ItemSchemaT, ItemSourceT, ItemTargetT>(convertToItem: (schema: ItemSchemaT, value: ItemSourceT) => ${imports.Either}<Error, ItemTargetT>) {
4
+ return (schema: ${snippets.DefaultValueSchema}<DefaultValueT, ItemSchemaT>, value: ItemSourceT | undefined): ${imports.Either}<Error, ItemTargetT> => {
5
+ if (typeof value === "undefined") {
6
+ return convertToItem(schema.item(), schema.defaultValue);
7
+ }
8
+ return convertToItem(schema.item(), value);
9
+ }
10
+ }`);
11
+ //# sourceMappingURL=snippets_convertWithDefaultValue.js.map
@@ -1,6 +1,6 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_defaultValueSparqlWherePatterns = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}defaultValueSparqlWherePatterns`, code `\
3
- function ${syntheticNamePrefix}defaultValueSparqlWherePatterns<ItemFilterT, ItemSchemaT>(itemSparqlWherePatternsFunction: ${snippets.ValueSparqlWherePatternsFunction}<ItemFilterT, ItemSchemaT>): ${snippets.ValueSparqlWherePatternsFunction}<ItemFilterT, ${snippets.DefaultValueSchema}<ItemSchemaT>> {
3
+ function ${syntheticNamePrefix}defaultValueSparqlWherePatterns<ItemFilterT, ItemSchemaT>(itemSparqlWherePatternsFunction: ${snippets.ValueSparqlWherePatternsFunction}<ItemFilterT, ItemSchemaT>): ${snippets.ValueSparqlWherePatternsFunction}<ItemFilterT, ${snippets.DefaultValueSchema}<unknown, ItemSchemaT>> {
4
4
  return ({ schema, ...otherParameters }) => {
5
5
  const [itemSparqlWherePatterns, liftSparqlPatterns] = ${snippets.liftSparqlPatterns}(itemSparqlWherePatternsFunction({ ...otherParameters, schema: schema.item() }));
6
6
  return [{ patterns: itemSparqlWherePatterns.concat(), type: "optional" }, ...liftSparqlPatterns];
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_hashArray: SnippetFactory;
3
+ //# sourceMappingURL=snippets_hashArray.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_hashArray = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}hashArray`, code `\
3
+ function ${syntheticNamePrefix}hashArray<HasherT extends ${snippets.Hasher}, ItemT>(hashItem: ${snippets.HashFunction}<HasherT, ItemT>): ${snippets.HashFunction}<HasherT, readonly ItemT[]> {
4
+ return (hasher, value) => {
5
+ for (const item of value) {
6
+ hashItem(hasher, item);
7
+ }
8
+ return hasher;
9
+ }
10
+ }`);
11
+ //# sourceMappingURL=snippets_hashArray.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_hashBigDecimal: SnippetFactory;
3
+ //# sourceMappingURL=snippets_hashBigDecimal.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_hashBigDecimal = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}hashBigDecimal`, code `\
3
+ function ${syntheticNamePrefix}hashBigDecimal<HasherT extends ${snippets.Hasher}>(hasher: HasherT, value: ${imports.BigDecimal}): HasherT {
4
+ hasher.update(value.toFixed());
5
+ return hasher;
6
+ }`);
7
+ //# sourceMappingURL=snippets_hashBigDecimal.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_hashBoolean: SnippetFactory;
3
+ //# sourceMappingURL=snippets_hashBoolean.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_hashBoolean = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}hashBoolean`, code `\
3
+ function ${syntheticNamePrefix}hashBoolean<HasherT extends ${snippets.Hasher}>(hasher: HasherT, value: boolean): HasherT {
4
+ hasher.update(value.toString());
5
+ return hasher;
6
+ }`);
7
+ //# sourceMappingURL=snippets_hashBoolean.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_hashDate: SnippetFactory;
3
+ //# sourceMappingURL=snippets_hashDate.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_hashDate = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}hashDate`, code `\
3
+ function ${syntheticNamePrefix}hashDate<HasherT extends ${snippets.Hasher}>(hasher: HasherT, value: Date): HasherT {
4
+ hasher.update(${snippets.toIsoDateString}(value));
5
+ return hasher;
6
+ }`);
7
+ //# sourceMappingURL=snippets_hashDate.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_hashDateTime: SnippetFactory;
3
+ //# sourceMappingURL=snippets_hashDateTime.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_hashDateTime = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}hashDateTime`, code `\
3
+ function ${syntheticNamePrefix}hashDateTime<HasherT extends ${snippets.Hasher}>(hasher: HasherT, value: Date): HasherT {
4
+ hasher.update(value.toISOString());
5
+ return hasher;
6
+ }`);
7
+ //# sourceMappingURL=snippets_hashDateTime.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_hashMaybe: SnippetFactory;
3
+ //# sourceMappingURL=snippets_hashMaybe.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_hashMaybe = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}hashMaybe`, code `\
3
+ function ${syntheticNamePrefix}hashMaybe<HasherT extends ${snippets.Hasher}, ItemT>(hashItem: ${snippets.HashFunction}<HasherT, ItemT>): ${snippets.HashFunction}<HasherT, ${imports.Maybe}<ItemT>> {
4
+ return (hasher, value) => {
5
+ value.ifJust(value => {
6
+ hashItem(hasher, value);
7
+ });
8
+ return hasher;
9
+ }
10
+ }`);
11
+ //# sourceMappingURL=snippets_hashMaybe.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_hashNumeric: SnippetFactory;
3
+ //# sourceMappingURL=snippets_hashNumeric.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_hashNumeric = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}hashNumeric`, code `\
3
+ function ${syntheticNamePrefix}hashNumeric<HasherT extends ${snippets.Hasher}>(hasher: HasherT, value: bigint | number): HasherT {
4
+ hasher.update(value.toString());
5
+ return hasher;
6
+ }`);
7
+ //# sourceMappingURL=snippets_hashNumeric.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_hashString: SnippetFactory;
3
+ //# sourceMappingURL=snippets_hashString.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_hashString = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}hashString`, code `\
3
+ function ${syntheticNamePrefix}hashString<HasherT extends ${snippets.Hasher}>(hasher: HasherT, value: string): HasherT {
4
+ hasher.update(value);
5
+ return hasher;
6
+ }`);
7
+ //# sourceMappingURL=snippets_hashString.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_hashTerm: SnippetFactory;
3
+ //# sourceMappingURL=snippets_hashTerm.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_hashTerm = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}hashTerm`, code `\
3
+ function ${syntheticNamePrefix}hashTerm<HasherT extends ${snippets.Hasher}>(hasher: HasherT, value: ${imports.BlankNode} | ${imports.Literal} | ${imports.NamedNode}): HasherT {
4
+ hasher.update(value.termType);
5
+ hasher.update(value.value);
6
+ if (value.termType === "Literal") {
7
+ hasher.update(value.datatype.value);
8
+ hasher.update(value.language);
9
+ }
10
+ return hasher;
11
+ }`);
12
+ //# sourceMappingURL=snippets_hashTerm.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_toIsoDateString: SnippetFactory;
3
+ //# sourceMappingURL=snippets_toIsoDateString.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_toIsoDateString = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}toIsoDateString`, code `\
3
+ export function ${syntheticNamePrefix}toIsoDateString(date: Date): string {
4
+ return date.toISOString().replace(/T.*$/, '')
5
+ }`);
6
+ //# sourceMappingURL=snippets_toIsoDateString.js.map
@@ -3,7 +3,7 @@ import type { NamedObjectType } from "./NamedObjectType.js";
3
3
  import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
4
4
  import type { TsGenerator } from "./TsGenerator.js";
5
5
  import { type Code } from "./ts-poet-wrapper.js";
6
- export declare function graphqlSchemaVariableStatement(this: TsGenerator, parameters: {
6
+ export declare function graphqlSchemaVariableStatement(this: TsGenerator, { namedObjectTypes, namedObjectUnionTypes, }: {
7
7
  namedObjectTypes: readonly NamedObjectType[];
8
8
  namedObjectUnionTypes: NamedObjectUnionType[];
9
9
  }): Maybe<Code>;
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
- import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
3
2
  import { code } from "./ts-poet-wrapper.js";
4
3
  function graphqlQueryObjectType({ namedObjectTypes, namedObjectUnionTypes, }) {
4
+ const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
5
5
  return code `new ${this.reusables.imports.GraphQLObjectType}<null, { objectSet: ${syntheticNamePrefix}ObjectSet }>({ name: "Query", fields: ${[
6
6
  ...namedObjectTypes,
7
7
  ...namedObjectUnionTypes,
@@ -68,12 +68,15 @@ async (_source, _args, { objectSet }): Promise<number> => (await objectSet.${nam
68
68
  return fields;
69
69
  }, {})} })`;
70
70
  }
71
- export function graphqlSchemaVariableStatement(parameters) {
72
- const namedObjectTypes = parameters.namedObjectTypes.filter((namedObjectType) => namedObjectType.features.has("graphql") && !namedObjectType.synthetic);
73
- const namedObjectUnionTypes = parameters.namedObjectUnionTypes.filter((namedObjectUnionType) => namedObjectUnionType.features.has("graphql"));
71
+ export function graphqlSchemaVariableStatement({ namedObjectTypes, namedObjectUnionTypes, }) {
72
+ if (!this.configuration.features.has("graphql")) {
73
+ return Maybe.empty();
74
+ }
75
+ namedObjectTypes = namedObjectTypes.filter((namedObjectType) => !namedObjectType.synthetic);
74
76
  if (namedObjectTypes.length === 0) {
75
77
  return Maybe.empty();
76
78
  }
79
+ namedObjectUnionTypes = namedObjectUnionTypes.filter((namedObjectUnionType) => !namedObjectUnionType.synthetic);
77
80
  return Maybe.of(code `\
78
81
  export const graphqlSchema = new ${this.reusables.imports.GraphQLSchema}({ query: ${graphqlQueryObjectType.call(this, { namedObjectTypes: namedObjectTypes, namedObjectUnionTypes })} });
79
82
  `);
@@ -3,38 +3,8 @@ import { rdfjsDatasetObjectSetClassDeclaration } from "./rdfjsDatasetObjectSetCl
3
3
  import { sparqlObjectSetClassDeclaration } from "./sparqlObjectSetClassDeclaration.js";
4
4
  export function objectSetDeclarations({ namedObjectUnionTypes, ...parameters }) {
5
5
  const namedObjectTypes = parameters.namedObjectTypes.filter((namedObjectType) => !namedObjectType.extern && !namedObjectType.synthetic);
6
- let namedObjectTypesWithRdfFeatureCount = 0;
7
- let namedObjectTypesWithSparqlFeatureCount = 0;
8
- for (const namedObjectType of namedObjectTypes) {
9
- if (!namedObjectType.features.has("rdf") &&
10
- !namedObjectType.features.has("sparql")) {
11
- continue;
12
- }
13
- if (namedObjectType.features.has("rdf")) {
14
- namedObjectTypesWithRdfFeatureCount++;
15
- }
16
- if (namedObjectType.features.has("sparql")) {
17
- namedObjectTypesWithSparqlFeatureCount++;
18
- }
19
- }
20
- let namedObjectUnionTypesWithRdfFeatureCount = 0;
21
- let namedObjectUnionTypesWithSparqlFeatureCount = 0;
22
- for (const namedObjectUnionType of namedObjectUnionTypes) {
23
- if (!namedObjectUnionType.features.has("rdf") &&
24
- !namedObjectUnionType.features.has("sparql")) {
25
- continue;
26
- }
27
- if (namedObjectUnionType.features.has("rdf")) {
28
- namedObjectUnionTypesWithRdfFeatureCount++;
29
- }
30
- if (namedObjectUnionType.features.has("sparql")) {
31
- namedObjectUnionTypesWithSparqlFeatureCount++;
32
- }
33
- }
34
- if (namedObjectTypesWithRdfFeatureCount === 0 &&
35
- namedObjectTypesWithSparqlFeatureCount === 0 &&
36
- namedObjectUnionTypesWithRdfFeatureCount === 0 &&
37
- namedObjectUnionTypesWithSparqlFeatureCount === 0) {
6
+ if (!this.configuration.features.has("rdf") &&
7
+ !this.configuration.features.has("sparql")) {
38
8
  return [];
39
9
  }
40
10
  const declarations = [
@@ -43,13 +13,13 @@ export function objectSetDeclarations({ namedObjectUnionTypes, ...parameters })
43
13
  namedObjectUnionTypes,
44
14
  }),
45
15
  ];
46
- if (namedObjectTypesWithRdfFeatureCount > 0) {
16
+ if (this.configuration.features.has("rdf")) {
47
17
  declarations.push(rdfjsDatasetObjectSetClassDeclaration.call(this, {
48
18
  namedObjectTypes: namedObjectTypes,
49
19
  namedObjectUnionTypes,
50
20
  }));
51
21
  }
52
- if (namedObjectTypesWithSparqlFeatureCount > 0) {
22
+ if (this.configuration.features.has("sparql")) {
53
23
  declarations.push(sparqlObjectSetClassDeclaration.call(this, {
54
24
  namedObjectTypes: namedObjectTypes,
55
25
  namedObjectUnionTypes,
@@ -1,7 +1,7 @@
1
1
  import { objectSetMethodSignatures } from "./objectSetMethodSignatures.js";
2
- import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
3
2
  import { code, joinCode } from "./ts-poet-wrapper.js";
4
3
  export function objectSetInterfaceDeclaration({ namedObjectTypes, namedObjectUnionTypes, }) {
4
+ const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
5
5
  return code `\
6
6
  export interface ${syntheticNamePrefix}ObjectSet {
7
7
  ${joinCode(namedObjectTypes
@@ -1,9 +1,9 @@
1
- import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
2
1
  import { code } from "./ts-poet-wrapper.js";
3
2
  export function objectSetMethodSignatures(parameters) {
4
3
  const { namedObjectType } = parameters;
5
4
  const parameterNamePrefix = parameters?.parameterNamePrefix ?? "";
6
- const queryT = parameters.queryT ?? `${syntheticNamePrefix}ObjectSet.Query`;
5
+ const queryT = parameters.queryT ??
6
+ `${this.configuration.syntheticNamePrefix}ObjectSet.Query`;
7
7
  const methodNames = namedObjectType.objectSetMethodNames;
8
8
  return {
9
9
  object: {
@@ -1,8 +1,8 @@
1
1
  import { objectSetMethodSignatures } from "./objectSetMethodSignatures.js";
2
- import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
3
2
  import { code, joinCode } from "./ts-poet-wrapper.js";
4
3
  import { unsupportedObjectSetMethodDeclarations } from "./unsupportedObjectSetMethodDeclarations.js";
5
4
  export function rdfjsDatasetObjectSetClassDeclaration({ namedObjectTypes, namedObjectUnionTypes, }) {
5
+ const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
6
6
  const namedObjectTypeType = code `\
7
7
  {
8
8
  filter: (filter: ObjectFilterT, value: ObjectT) => boolean;
@@ -40,7 +40,7 @@ export class ${syntheticNamePrefix}RdfjsDatasetObjectSet implements ${syntheticN
40
40
 
41
41
  ${joinCode([
42
42
  ...[...namedObjectTypes, ...namedObjectUnionTypes].flatMap((namedObjectType) => {
43
- if (!namedObjectType.features.has("rdf")) {
43
+ if (!this.configuration.features.has("rdf")) {
44
44
  return Object.values(unsupportedObjectSetMethodDeclarations.call(this, {
45
45
  namedObjectType,
46
46
  }));
@@ -1,8 +1,8 @@
1
1
  import { objectSetMethodSignatures } from "./objectSetMethodSignatures.js";
2
- import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
3
2
  import { code, joinCode } from "./ts-poet-wrapper.js";
4
3
  import { unsupportedObjectSetMethodDeclarations } from "./unsupportedObjectSetMethodDeclarations.js";
5
4
  export function sparqlObjectSetClassDeclaration({ namedObjectTypes, namedObjectUnionTypes, }) {
5
+ const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
6
6
  const parameters = {
7
7
  constructObjectType: code `namedObjectType: {\
8
8
  focusSparqlWherePatterns: ${this.reusables.snippets.FocusSparqlWherePatternsFunction}<ObjectFilterT>;
@@ -32,7 +32,7 @@ export class ${syntheticNamePrefix}SparqlObjectSet implements ${syntheticNamePre
32
32
  }
33
33
 
34
34
  ${joinCode([...namedObjectTypes, ...namedObjectUnionTypes].flatMap((namedObjectType) => {
35
- if (!namedObjectType.features.has("sparql")) {
35
+ if (!this.configuration.features.has("sparql")) {
36
36
  return Object.values(unsupportedObjectSetMethodDeclarations.call(this, {
37
37
  namedObjectType,
38
38
  }));
@@ -3,7 +3,6 @@ import type { Either } from "purify-ts";
3
3
  import type { Logger } from "ts-log";
4
4
  import type { Ast } from "../ast/Ast.js";
5
5
  import type { Generator } from "../generators/Generator.js";
6
- import type { TsFeature } from "../generators/ts/TsFeature.js";
7
6
  import * as generated from "./generated.js";
8
7
  export declare class ShapesGraph extends AbstractShapesGraph<generated.NodeShape, generated.Ontology, generated.PropertyGroup, generated.PropertyShape> {
9
8
  protected readonly typeFunctions: {
@@ -18,15 +17,13 @@ export declare class ShapesGraph extends AbstractShapesGraph<generated.NodeShape
18
17
  compile(parameters: {
19
18
  generator: Generator;
20
19
  logger: Logger;
21
- tsFeaturesDefault?: ReadonlySet<TsFeature>;
22
20
  }): Either<Error, string>;
23
21
  static builder(): ShapesGraph.Builder;
24
22
  /**
25
23
  * Transform the shapes graph to an AST.
26
24
  */
27
- toAst({ logger, tsFeaturesDefault, }: {
25
+ toAst({ logger }: {
28
26
  logger: Logger;
29
- tsFeaturesDefault?: ReadonlySet<TsFeature>;
30
27
  }): Either<Error, Ast>;
31
28
  }
32
29
  export declare namespace ShapesGraph {
@@ -38,10 +35,10 @@ export declare namespace ShapesGraph {
38
35
  readonly PropertyShape: typeof generated.PropertyShape;
39
36
  };
40
37
  build(): ShapesGraph;
41
- nodeShape(parameters?: Parameters<typeof generated.NodeShape.create>[0]): generated.NodeShape;
42
- ontology(parameters?: Parameters<typeof generated.Ontology.create>[0]): generated.Ontology;
43
- propertyGroup(parameters?: Parameters<typeof generated.PropertyGroup.create>[0]): generated.PropertyGroup;
44
- propertyShape(parameters: Parameters<typeof generated.PropertyShape.create>[0]): generated.PropertyShape;
38
+ nodeShape(parameters?: Parameters<typeof generated.NodeShape.createUnsafe>[0]): generated.NodeShape;
39
+ ontology(parameters?: Parameters<typeof generated.Ontology.createUnsafe>[0]): generated.Ontology;
40
+ propertyGroup(parameters?: Parameters<typeof generated.PropertyGroup.createUnsafe>[0]): generated.PropertyGroup;
41
+ propertyShape(parameters: Parameters<typeof generated.PropertyShape.createUnsafe>[0]): generated.PropertyShape;
45
42
  }
46
43
  }
47
44
  //# sourceMappingURL=ShapesGraph.d.ts.map