@shaclmate/compiler 4.0.39 → 4.0.41

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 (211) hide show
  1. package/dist/ShapesGraphToAstTransformer.d.ts +0 -8
  2. package/dist/ShapesGraphToAstTransformer.js +5 -85
  3. package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.js +128 -160
  4. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.d.ts +1 -1
  5. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +0 -16
  6. package/dist/ast/AbstractCompoundType.d.ts +2 -1
  7. package/dist/ast/AbstractCompoundType.js +1 -1
  8. package/dist/ast/AbstractLazyObjectType.d.ts +0 -2
  9. package/dist/ast/Ast.d.ts +1 -3
  10. package/dist/ast/ListType.d.ts +1 -1
  11. package/dist/ast/ListType.js +1 -1
  12. package/dist/ast/ObjectType.d.ts +0 -12
  13. package/dist/ast/ObjectType.js +0 -78
  14. package/dist/generators/AstJsonGenerator.js +7 -3
  15. package/dist/generators/transformAstToLabeledPropertyGraph.js +59 -56
  16. package/dist/generators/ts/AbstractCollectionType.d.ts +5 -12
  17. package/dist/generators/ts/AbstractCollectionType.js +9 -68
  18. package/dist/generators/ts/AbstractContainerType.d.ts +4 -6
  19. package/dist/generators/ts/AbstractContainerType.js +5 -9
  20. package/dist/generators/ts/AbstractDateType.d.ts +6 -3
  21. package/dist/generators/ts/AbstractDateType.js +7 -2
  22. package/dist/generators/ts/AbstractIdentifierType.d.ts +4 -0
  23. package/dist/generators/ts/AbstractIdentifierType.js +3 -0
  24. package/dist/generators/ts/AbstractLazyObjectType.d.ts +9 -9
  25. package/dist/generators/ts/AbstractLazyObjectType.js +30 -19
  26. package/dist/generators/ts/AbstractLiteralType.d.ts +1 -0
  27. package/dist/generators/ts/AbstractNumericType.d.ts +1 -1
  28. package/dist/generators/ts/AbstractNumericType.js +9 -9
  29. package/dist/generators/ts/AbstractObjectSetType.d.ts +10 -9
  30. package/dist/generators/ts/AbstractObjectSetType.js +2 -2
  31. package/dist/generators/ts/AbstractPrimitiveType.d.ts +1 -0
  32. package/dist/generators/ts/AbstractPrimitiveType.js +2 -2
  33. package/dist/generators/ts/AbstractTermType.d.ts +1 -2
  34. package/dist/generators/ts/AbstractTermType.js +3 -5
  35. package/dist/generators/ts/AbstractType.d.ts +61 -26
  36. package/dist/generators/ts/AbstractType.js +37 -17
  37. package/dist/generators/ts/BigDecimalType.d.ts +5 -1
  38. package/dist/generators/ts/BigDecimalType.js +6 -3
  39. package/dist/generators/ts/BigIntType.d.ts +3 -1
  40. package/dist/generators/ts/BigIntType.js +3 -3
  41. package/dist/generators/ts/BlankNodeType.d.ts +3 -3
  42. package/dist/generators/ts/BlankNodeType.js +13 -13
  43. package/dist/generators/ts/BooleanType.d.ts +5 -3
  44. package/dist/generators/ts/BooleanType.js +11 -6
  45. package/dist/generators/ts/DefaultValueType.d.ts +40 -2
  46. package/dist/generators/ts/DefaultValueType.js +14 -12
  47. package/dist/generators/ts/FloatType.d.ts +3 -1
  48. package/dist/generators/ts/FloatType.js +1 -1
  49. package/dist/generators/ts/GraphqlSchema.d.ts +4 -4
  50. package/dist/generators/ts/GraphqlSchema.js +6 -6
  51. package/dist/generators/ts/IdentifierType.d.ts +3 -3
  52. package/dist/generators/ts/IdentifierType.js +19 -17
  53. package/dist/generators/ts/IntType.d.ts +3 -1
  54. package/dist/generators/ts/IntType.js +1 -1
  55. package/dist/generators/ts/IriType.d.ts +2 -2
  56. package/dist/generators/ts/IriType.js +21 -19
  57. package/dist/generators/ts/LazyObjectOptionType.d.ts +2 -0
  58. package/dist/generators/ts/LazyObjectOptionType.js +14 -10
  59. package/dist/generators/ts/LazyObjectSetType.js +14 -8
  60. package/dist/generators/ts/LazyObjectType.js +9 -6
  61. package/dist/generators/ts/ListType.d.ts +13 -5
  62. package/dist/generators/ts/ListType.js +48 -12
  63. package/dist/generators/ts/LiteralType.d.ts +5 -1
  64. package/dist/generators/ts/LiteralType.js +11 -8
  65. package/dist/generators/ts/{NamedObjectType.d.ts → ObjectType.d.ts} +19 -34
  66. package/dist/generators/ts/ObjectType.js +282 -0
  67. package/dist/generators/ts/ObjectUnionType.d.ts +20 -0
  68. package/dist/generators/ts/{NamedObjectUnionType.js → ObjectUnionType.js} +52 -60
  69. package/dist/generators/ts/OptionType.d.ts +6 -2
  70. package/dist/generators/ts/OptionType.js +20 -15
  71. package/dist/generators/ts/RdfjsDatasetObjectSetType.js +8 -11
  72. package/dist/generators/ts/SetType.d.ts +16 -1
  73. package/dist/generators/ts/SetType.js +80 -2
  74. package/dist/generators/ts/Snippets.d.ts +3 -1
  75. package/dist/generators/ts/Snippets.js +18 -4
  76. package/dist/generators/ts/SparqlObjectSetType.js +2 -2
  77. package/dist/generators/ts/StringType.d.ts +5 -3
  78. package/dist/generators/ts/StringType.js +15 -6
  79. package/dist/generators/ts/TermType.d.ts +6 -2
  80. package/dist/generators/ts/TermType.js +15 -12
  81. package/dist/generators/ts/TsGenerator.d.ts +1 -1
  82. package/dist/generators/ts/TsGenerator.js +60 -32
  83. package/dist/generators/ts/Type.d.ts +4 -5
  84. package/dist/generators/ts/TypeFactory.d.ts +7 -8
  85. package/dist/generators/ts/TypeFactory.js +62 -76
  86. package/dist/generators/ts/{AbstractUnionType.d.ts → UnionType.d.ts} +36 -11
  87. package/dist/generators/ts/{AbstractUnionType.js → UnionType.js} +296 -105
  88. package/dist/generators/ts/ZodGenerator.d.ts +1 -1
  89. package/dist/generators/ts/ZodGenerator.js +21 -16
  90. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.d.ts +9 -6
  91. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.js +3 -3
  92. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.d.ts +9 -13
  93. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.js +22 -39
  94. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.d.ts +1 -5
  95. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.js +18 -13
  96. package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +5 -0
  97. package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.js +44 -0
  98. package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.d.ts +5 -0
  99. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js → _ObjectType/ObjectType_equalsFunctionDeclaration.js} +3 -7
  100. package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +5 -0
  101. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js → _ObjectType/ObjectType_filterFunctionDeclaration.js} +3 -6
  102. package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +5 -0
  103. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterTypeDeclaration.js → _ObjectType/ObjectType_filterTypeDeclaration.js} +2 -5
  104. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
  105. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js} +2 -6
  106. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
  107. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.js} +5 -24
  108. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.d.ts +5 -0
  109. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.js +18 -0
  110. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +5 -0
  111. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.js +51 -0
  112. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +5 -0
  113. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.js +15 -0
  114. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.d.ts +5 -0
  115. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js → _ObjectType/ObjectType_fromRdfTypeVariableStatement.js} +2 -2
  116. package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeVariableStatement.d.ts +5 -0
  117. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js → _ObjectType/ObjectType_graphqlTypeVariableStatement.js} +4 -4
  118. package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.d.ts +4 -0
  119. package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.js +41 -0
  120. package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +4 -0
  121. package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.js +12 -0
  122. package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts +5 -0
  123. package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.js +20 -0
  124. package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.d.ts +5 -0
  125. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js → _ObjectType/ObjectType_jsonParseFunctionDeclaration.js} +2 -2
  126. package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +5 -0
  127. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js → _ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js} +5 -11
  128. package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +5 -0
  129. package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.js +9 -0
  130. package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +5 -0
  131. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js → _ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js} +4 -6
  132. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_objectSetMethodNames.d.ts → _ObjectType/ObjectType_objectSetMethodNames.d.ts} +3 -3
  133. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_objectSetMethodNames.js → _ObjectType/ObjectType_objectSetMethodNames.js} +4 -4
  134. package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +5 -0
  135. package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.js +12 -0
  136. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts → _ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts} +3 -3
  137. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js → _ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js} +5 -5
  138. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts → _ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts} +3 -3
  139. package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js +12 -0
  140. package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.d.ts +5 -0
  141. package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.js +20 -0
  142. package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionDeclaration.d.ts +5 -0
  143. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js → _ObjectType/ObjectType_toRdfResourceFunctionDeclaration.js} +4 -4
  144. package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionDeclarations.d.ts +4 -0
  145. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js → _ObjectType/ObjectType_toStringFunctionDeclarations.js} +7 -14
  146. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
  147. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js → _ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js} +3 -3
  148. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
  149. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js → _ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.js} +3 -3
  150. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/ShaclProperty.js +12 -12
  151. package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +4 -0
  152. package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.js +16 -0
  153. package/dist/generators/ts/_snippets/snippets_convertToArraySet.d.ts +3 -0
  154. package/dist/generators/ts/_snippets/snippets_convertToArraySet.js +8 -0
  155. package/dist/generators/ts/_snippets/snippets_convertToList.d.ts +3 -0
  156. package/dist/generators/ts/_snippets/snippets_convertToList.js +7 -0
  157. package/dist/generators/ts/_snippets/snippets_convertToScalarSet.d.ts +3 -0
  158. package/dist/generators/ts/_snippets/snippets_convertToScalarSet.js +15 -0
  159. package/dist/input/generated.d.ts +758 -117
  160. package/dist/input/generated.js +636 -128
  161. package/package.json +4 -6
  162. package/dist/generators/ts/AbstractNamedUnionType.d.ts +0 -30
  163. package/dist/generators/ts/AbstractNamedUnionType.js +0 -190
  164. package/dist/generators/ts/AnonymousUnionType.d.ts +0 -27
  165. package/dist/generators/ts/AnonymousUnionType.js +0 -59
  166. package/dist/generators/ts/NamedObjectType.js +0 -342
  167. package/dist/generators/ts/NamedObjectUnionType.d.ts +0 -37
  168. package/dist/generators/ts/NamedUnionType.d.ts +0 -11
  169. package/dist/generators/ts/NamedUnionType.js +0 -13
  170. package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.d.ts +0 -5
  171. package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.js +0 -65
  172. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.d.ts +0 -5
  173. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +0 -5
  174. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +0 -5
  175. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  176. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
  177. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.d.ts +0 -5
  178. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +0 -43
  179. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.d.ts +0 -5
  180. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +0 -80
  181. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +0 -5
  182. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +0 -15
  183. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.d.ts +0 -5
  184. package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.d.ts +0 -5
  185. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.d.ts +0 -4
  186. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +0 -45
  187. package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.d.ts +0 -4
  188. package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.js +0 -16
  189. package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +0 -5
  190. package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js +0 -17
  191. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.d.ts +0 -5
  192. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
  193. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
  194. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +0 -16
  195. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
  196. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +0 -5
  197. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +0 -12
  198. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +0 -12
  199. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.d.ts +0 -5
  200. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js +0 -41
  201. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.d.ts +0 -5
  202. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.d.ts +0 -4
  203. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  204. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
  205. package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.d.ts +0 -4
  206. package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.js +0 -25
  207. package/dist/generators/ts/_snippets/snippets_convertToArray.d.ts +0 -3
  208. package/dist/generators/ts/_snippets/snippets_convertToArray.js +0 -8
  209. /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.d.ts +0 -0
  210. /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.js +0 -0
  211. /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/ShaclProperty.d.ts +0 -0
@@ -7,7 +7,7 @@ const variables = {
7
7
  focusIdentifier: code `parameters.focusIdentifier`,
8
8
  variablePrefix: code `parameters.variablePrefix`,
9
9
  };
10
- export function NamedObjectType_focusSparqlWherePatternsFunctionDeclaration() {
10
+ export function ObjectType_focusSparqlWherePatternsFunctionDeclaration() {
11
11
  if (!this.configuration.features.has("Object.SPARQL")) {
12
12
  return Maybe.empty();
13
13
  }
@@ -15,30 +15,11 @@ export function NamedObjectType_focusSparqlWherePatternsFunctionDeclaration() {
15
15
  const rdfTypeVariable = code `${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}RdfType\`)`;
16
16
  let patternsVariableDeclarationKeyword = "const";
17
17
  const statements = [];
18
- for (const parentObjectType of this.parentObjectTypes) {
19
- statements.push(code `\
20
- patterns = patterns.concat(${parentObjectType.name}.focusSparqlWherePatterns(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, preferredLanguages: variables.preferredLanguages, variablePrefix: variables.variablePrefix }}));`);
21
- patternsVariableDeclarationKeyword = "let";
22
- }
23
- if (this.fromRdfType.isJust()) {
24
- const fromRdfTypeVariables = this.fromRdfTypeVariable
25
- .toList()
26
- .concat(this.descendantFromRdfTypeVariables);
18
+ this.fromRdfTypeVariable.ifJust((fromRdfTypeVariable) => {
27
19
  statements.push(code `const rdfTypeVariable = ${rdfTypeVariable};`, code `\
28
20
  if (!parameters?.ignoreRdfType) {
29
21
  patterns.push(
30
- ${fromRdfTypeVariables.length > 1
31
- ? code `\
32
- {
33
- type: "values" as const,
34
- values: [${joinCode(fromRdfTypeVariables, { on: "," })}].map((identifier) => {
35
- const valuePatternRow: ${this.reusables.imports.sparqljs}.ValuePatternRow = {};
36
- valuePatternRow[\`?\${${variables.variablePrefix}}FromRdfType\`] = identifier as ${this.reusables.imports.NamedNode};
37
- return valuePatternRow;
38
- }),
39
- },
40
- ${this.reusables.snippets.sparqlInstancesOfPattern}({ rdfType: ${this.reusables.imports.dataFactory}.variable!(\`\${${variables.variablePrefix}}FromRdfType\`), subject: ${variables.focusIdentifier} }),`
41
- : code `${this.reusables.snippets.sparqlInstancesOfPattern}({ rdfType: ${fromRdfTypeVariables[0]}, subject: ${variables.focusIdentifier} }),`}
22
+ ${code `${this.reusables.snippets.sparqlInstancesOfPattern}({ rdfType: ${fromRdfTypeVariable}, subject: ${variables.focusIdentifier} }),`}
42
23
  {
43
24
  triples: [
44
25
  {
@@ -70,7 +51,7 @@ if (!parameters?.ignoreRdfType) {
70
51
  }
71
52
  );
72
53
  }`);
73
- }
54
+ });
74
55
  for (const property of this.properties) {
75
56
  if (property.recursive) {
76
57
  continue;
@@ -99,4 +80,4 @@ ${statements.length > 0
99
80
  : "return [];"}
100
81
  };`);
101
82
  }
102
- //# sourceMappingURL=NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js.map
83
+ //# sourceMappingURL=ObjectType_focusSparqlWherePatternsFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_fromJsonFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_fromJsonFunctionDeclaration.d.ts.map
@@ -0,0 +1,18 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { invariant } from "ts-invariant";
3
+ import { code, joinCode } from "../ts-poet-wrapper.js";
4
+ export function ObjectType_fromJsonFunctionDeclaration() {
5
+ if (!this.configuration.features.has("Object.fromJson")) {
6
+ return Maybe.empty();
7
+ }
8
+ const variables = {
9
+ jsonObject: code `${this.configuration.syntheticNamePrefix}json`,
10
+ };
11
+ const propertyInitializers = this.properties.flatMap((property) => property.fromJsonInitializer({ variables }).toList());
12
+ invariant(propertyInitializers.length > 0);
13
+ return Maybe.of(code `\
14
+ export function fromJson(${variables.jsonObject}: ${this.jsonType().expression}): ${this.reusables.imports.Either}<Error, ${this.expression}> {
15
+ return ${this.reusables.snippets.sequenceRecord}({ ${joinCode(propertyInitializers, { on: "," })} }).chain(create);
16
+ }`);
17
+ }
18
+ //# sourceMappingURL=ObjectType_fromJsonFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_fromRdfResourceFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_fromRdfResourceFunctionDeclaration.d.ts.map
@@ -0,0 +1,51 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { invariant } from "ts-invariant";
3
+ import { arrayOf, code, joinCode } from "../ts-poet-wrapper.js";
4
+ export function ObjectType_fromRdfResourceFunctionDeclaration() {
5
+ if (!this.configuration.features.has("Object.fromRdf")) {
6
+ return Maybe.empty();
7
+ }
8
+ const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
9
+ const optionsVariable = `_${syntheticNamePrefix}options`;
10
+ const variables = {
11
+ context: code `${optionsVariable}.context`,
12
+ graph: code `${optionsVariable}.graph`,
13
+ ignoreRdfType: code `${optionsVariable}.ignoreRdfType`,
14
+ objectSet: code `${optionsVariable}.objectSet`,
15
+ preferredLanguages: code `${optionsVariable}.preferredLanguages`,
16
+ resource: code `${syntheticNamePrefix}resource`,
17
+ };
18
+ const propertyFromRdfResourceValuesExpressionVariable = {
19
+ context: variables.context,
20
+ graph: variables.graph,
21
+ objectSet: variables.objectSet,
22
+ preferredLanguages: variables.preferredLanguages,
23
+ resource: variables.resource,
24
+ };
25
+ const chains = [];
26
+ this.fromRdfTypeVariable.ifJust((fromRdfTypeVariable) => {
27
+ chains.push({
28
+ expression: code `!${variables.ignoreRdfType} ? ${this.reusables.snippets.ensureRdfResourceType}(${variables.resource}, ${arrayOf(fromRdfTypeVariable)}, ${{ graph: variables.graph }}) : ${this.reusables.imports.Right}(true as const)`,
29
+ variable: `_rdfTypeCheck`,
30
+ });
31
+ });
32
+ const propertyFromRdfResourceValuesInitializers = this.properties.flatMap((property) => property
33
+ .fromRdfResourceValuesInitializer({
34
+ variables: propertyFromRdfResourceValuesExpressionVariable,
35
+ })
36
+ .toList());
37
+ invariant(Object.keys(propertyFromRdfResourceValuesInitializers).length > 0);
38
+ chains.push({
39
+ expression: code `${this.reusables.snippets.sequenceRecord}({ ${joinCode(propertyFromRdfResourceValuesInitializers, { on: ", " })} })`,
40
+ variable: "properties",
41
+ });
42
+ return Maybe.of(code `\
43
+ export const _fromRdfResource: ${this.reusables.snippets._FromRdfResourceFunction}<${this.expression}> = (${variables.resource}, ${optionsVariable}) => {
44
+ return ${chains
45
+ .reverse()
46
+ .reduce((acc, { expression, variable }) => code `(${expression}).chain(${variable} => ${acc})`, code `(create(properties))`)};
47
+ }
48
+
49
+ export const fromRdfResource = ${this.reusables.snippets.wrap_FromRdfResourceFunction}(_fromRdfResource);`);
50
+ }
51
+ //# sourceMappingURL=ObjectType_fromRdfResourceFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_fromRdfResourceValuesFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { code } from "../ts-poet-wrapper.js";
3
+ export function ObjectType_fromRdfResourceValuesFunctionDeclaration() {
4
+ if (!this.configuration.features.has("Object.fromRdf")) {
5
+ return Maybe.empty();
6
+ }
7
+ return Maybe.of(code `\
8
+ export const fromRdfResourceValues: ${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.alias.unsafeCoerce()}> = (values, options) =>
9
+ values.chain(
10
+ values => values.chainMap(
11
+ value => value.toResource().chain(resource => ${this.alias.unsafeCoerce()}.fromRdfResource(resource, options))
12
+ )
13
+ );`);
14
+ }
15
+ //# sourceMappingURL=ObjectType_fromRdfResourceValuesFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_fromRdfTypeVariableStatement(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_fromRdfTypeVariableStatement.d.ts.map
@@ -1,10 +1,10 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_fromRdfTypeVariableStatement() {
3
+ export function ObjectType_fromRdfTypeVariableStatement() {
4
4
  if (!this.configuration.features.has("Object.fromRdf")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  return this.fromRdfType.map((fromRdfType) => code `\
8
8
  export const fromRdfType: ${this.reusables.imports.NamedNode}<string> = ${this.rdfjsTermExpression(fromRdfType)};`);
9
9
  }
10
- //# sourceMappingURL=NamedObjectType_fromRdfTypeVariableStatement.js.map
10
+ //# sourceMappingURL=ObjectType_fromRdfTypeVariableStatement.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_graphqlTypeVariableStatement(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_graphqlTypeVariableStatement.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_graphqlTypeVariableStatement() {
3
+ export function ObjectType_graphqlTypeVariableStatement() {
4
4
  if (!this.configuration.features.has("GraphQL")) {
5
5
  return Maybe.empty();
6
6
  }
@@ -8,7 +8,7 @@ export function NamedObjectType_graphqlTypeVariableStatement() {
8
8
  return Maybe.empty();
9
9
  }
10
10
  return Maybe.of(code `\
11
- export const GraphQL = new ${this.reusables.imports.GraphQLObjectType}<${this.name}, { objectSet: ${this.configuration.syntheticNamePrefix}ObjectSet }>(${{
11
+ export const GraphQL = new ${this.reusables.imports.GraphQLObjectType}<${this.expression}, { objectSet: ${this.configuration.syntheticNamePrefix}ObjectSet }>(${{
12
12
  description: this.comment.extract(),
13
13
  fields: code `() => (${this.properties.reduce((fields, property) => {
14
14
  property.graphqlField.ifJust((field) => {
@@ -27,7 +27,7 @@ export const GraphQL = new ${this.reusables.imports.GraphQLObjectType}<${this.na
27
27
  });
28
28
  return fields;
29
29
  }, {})})`,
30
- name: this.name,
30
+ name: this.alias.unsafeCoerce(),
31
31
  }});`);
32
32
  }
33
- //# sourceMappingURL=NamedObjectType_graphqlTypeVariableStatement.js.map
33
+ //# sourceMappingURL=ObjectType_graphqlTypeVariableStatement.js.map
@@ -0,0 +1,4 @@
1
+ import type { ObjectType } from "../ObjectType.js";
2
+ import { type Code } from "../ts-poet-wrapper.js";
3
+ export declare function ObjectType_hashFunctionDeclarations(this: ObjectType): readonly Code[];
4
+ //# sourceMappingURL=ObjectType_hashFunctionDeclarations.d.ts.map
@@ -0,0 +1,41 @@
1
+ import { code, joinCode } from "../ts-poet-wrapper.js";
2
+ const hasherVariable = code `hasher`;
3
+ export function ObjectType_hashFunctionDeclarations() {
4
+ if (!this.configuration.features.has("Object.hash")) {
5
+ return [];
6
+ }
7
+ return [
8
+ code `\
9
+ export function hash<HasherT extends ${this.reusables.snippets.Hasher}>(${hasherVariable}: HasherT, ${this.thisVariable}: ${this.expression}): HasherT {
10
+ ${joinCode([
11
+ code `${this.alias.unsafeCoerce()}.hashShaclProperties(${hasherVariable}, ${this.thisVariable});`,
12
+ ...this.properties
13
+ .filter((property) => property.kind !== "Shacl")
14
+ .flatMap((property) => property.hashStatements({
15
+ variables: {
16
+ hasher: hasherVariable,
17
+ value: code `${property.accessExpression({ variables: { object: this.thisVariable } })}`,
18
+ },
19
+ })),
20
+ code `return ${hasherVariable};`,
21
+ ])}
22
+ }`,
23
+ code `\
24
+ export function hashShaclProperties<HasherT extends ${this.reusables.snippets.Hasher}>(${hasherVariable}: HasherT, ${this.thisVariable}: ${this.expression}): HasherT {
25
+ ${joinCode([
26
+ ...this.properties.flatMap((property) => property.kind === "Shacl"
27
+ ? property.hashStatements({
28
+ variables: {
29
+ hasher: hasherVariable,
30
+ value: property.accessExpression({
31
+ variables: { object: this.thisVariable },
32
+ }),
33
+ },
34
+ })
35
+ : []),
36
+ code `return ${hasherVariable};`,
37
+ ])}
38
+ }`,
39
+ ];
40
+ }
41
+ //# sourceMappingURL=ObjectType_hashFunctionDeclarations.js.map
@@ -0,0 +1,4 @@
1
+ import type { ObjectType } from "../ObjectType.js";
2
+ import { type Code } from "../ts-poet-wrapper.js";
3
+ export declare function ObjectType_interfaceDeclaration(this: ObjectType): Code;
4
+ //# sourceMappingURL=ObjectType_interfaceDeclaration.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { code, joinCode } from "../ts-poet-wrapper.js";
2
+ import { tsComment } from "../tsComment.js";
3
+ export function ObjectType_interfaceDeclaration() {
4
+ return code `\
5
+ ${this.comment
6
+ .alt(this.label)
7
+ .map(tsComment)
8
+ .orDefault("")}export interface ${this.alias.unsafeCoerce()} {
9
+ ${joinCode(this.properties.map((property) => property.declaration), { on: "\n\n" })}
10
+ }`;
11
+ }
12
+ //# sourceMappingURL=ObjectType_interfaceDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_isTypeFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_isTypeFunctionDeclaration.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { code, literalOf } from "../ts-poet-wrapper.js";
3
+ export function ObjectType_isTypeFunctionDeclaration() {
4
+ if (!this.configuration.features.has("Object.type")) {
5
+ return Maybe.empty();
6
+ }
7
+ if (this.synthetic) {
8
+ return Maybe.empty();
9
+ }
10
+ const alias = this.alias.extract();
11
+ const discriminantProperty = this.discriminantProperty.extract();
12
+ if (!alias || !discriminantProperty) {
13
+ return Maybe.empty();
14
+ }
15
+ return Maybe.of(code `\
16
+ export function is${alias}(object: ${this.configuration.syntheticNamePrefix}Object): object is ${alias} {
17
+ return object.${discriminantProperty.name} === ${literalOf(discriminantProperty.value)};
18
+ }`);
19
+ }
20
+ //# sourceMappingURL=ObjectType_isTypeFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_jsonParseFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_jsonParseFunctionDeclaration.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_jsonParseFunctionDeclaration() {
3
+ export function ObjectType_jsonParseFunctionDeclaration() {
4
4
  if (!this.configuration.features.has("Object.JSON.parse")) {
5
5
  return Maybe.empty();
6
6
  }
@@ -11,4 +11,4 @@ export function parse(json: unknown): ${this.reusables.imports.Either}<Error, Js
11
11
  return ${this.reusables.imports.Right}(jsonSafeParseResult.data);
12
12
  }`);
13
13
  }
14
- //# sourceMappingURL=NamedObjectType_jsonParseFunctionDeclaration.js.map
14
+ //# sourceMappingURL=ObjectType_jsonParseFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_jsonSchemaFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_jsonSchemaFunctionDeclaration.d.ts.map
@@ -1,18 +1,12 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_jsonSchemaFunctionDeclaration() {
3
+ export function ObjectType_jsonSchemaFunctionDeclaration() {
4
4
  if (!this.configuration.features.has("Object.JSON.schema")) {
5
5
  return Maybe.empty();
6
6
  }
7
- let properties = [];
8
- for (const parentObjectType of this.parentObjectTypes) {
9
- properties.push(code `...${parentObjectType.jsonSchema({ context: "type" })}.shape`);
10
- }
11
- if (this.properties.length > 0) {
12
- properties = properties.concat(this.properties
13
- .flatMap((property) => property.jsonSchema.toList())
14
- .map(({ key, schema }) => code `"${key}": ${schema}`));
15
- }
7
+ const properties = this.properties
8
+ .flatMap((property) => property.jsonSchema.toList())
9
+ .map(({ key, schema }) => code `"${key}": ${schema}`);
16
10
  const meta = {
17
11
  // id: this.name,
18
12
  };
@@ -28,4 +22,4 @@ export function schema() {
28
22
  return ${this.reusables.imports.z}.object({${joinCode(properties, { on: "," })}}).meta(${meta}) satisfies ${this.reusables.imports.z}.ZodType<Json>;
29
23
  }`);
30
24
  }
31
- //# sourceMappingURL=NamedObjectType_jsonSchemaFunctionDeclaration.js.map
25
+ //# sourceMappingURL=ObjectType_jsonSchemaFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_jsonTypeAliasDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_jsonTypeAliasDeclaration.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { code, joinCode } from "../ts-poet-wrapper.js";
3
+ export function ObjectType_jsonTypeAliasDeclaration() {
4
+ if (!this.configuration.features.has("Object.JSON.type")) {
5
+ return Maybe.empty();
6
+ }
7
+ return Maybe.of(code `export type Json = { ${joinCode(this.properties.flatMap((property) => property.jsonSignature.toList()), { on: ";" })} }`);
8
+ }
9
+ //# sourceMappingURL=ObjectType_jsonTypeAliasDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_jsonUiSchemaFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_jsonUiSchemaFunctionDeclaration.d.ts.map
@@ -1,17 +1,15 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_jsonUiSchemaFunctionDeclaration() {
3
+ export function ObjectType_jsonUiSchemaFunctionDeclaration() {
4
4
  if (!this.configuration.features.has("Object.JSON.uiSchema")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  const variables = { scopePrefix: code `scopePrefix` };
8
- const elements = this.parentObjectTypes
9
- .map((parentObjectType) => code `${parentObjectType.name}.Json.uiSchema({ scopePrefix })`)
10
- .concat(this.properties.flatMap((property) => property.jsonUiSchemaElement({ variables }).toList()));
8
+ const elements = this.properties.flatMap((property) => property.jsonUiSchemaElement({ variables }).toList());
11
9
  return Maybe.of(code `\
12
10
  export function uiSchema(parameters?: { scopePrefix?: string }): any {
13
11
  const scopePrefix = parameters?.scopePrefix ?? "#";
14
- return { "elements": [ ${joinCode(elements, { on: "," })} ], label: "${this.label.orDefault(this.name)}", type: "Group" };
12
+ return { "elements": [ ${joinCode(elements, { on: "," })} ], label: "${this.label.orDefault(this.alias.unsafeCoerce())}", type: "Group" };
15
13
  }`);
16
14
  }
17
- //# sourceMappingURL=NamedObjectType_jsonUiSchemaFunctionDeclaration.js.map
15
+ //# sourceMappingURL=ObjectType_jsonUiSchemaFunctionDeclaration.js.map
@@ -1,11 +1,11 @@
1
1
  import type { TsGenerator } from "../TsGenerator.js";
2
- export declare function NamedObjectType_objectSetMethodNames(this: {
2
+ export declare function ObjectType_objectSetMethodNames(this: {
3
+ readonly alias: string;
3
4
  readonly configuration: TsGenerator.Configuration;
4
- readonly name: string;
5
5
  }): {
6
6
  object: string;
7
7
  objectCount: string;
8
8
  objectIdentifiers: string;
9
9
  objects: string;
10
10
  };
11
- //# sourceMappingURL=NamedObjectType_objectSetMethodNames.d.ts.map
11
+ //# sourceMappingURL=ObjectType_objectSetMethodNames.d.ts.map
@@ -1,11 +1,11 @@
1
1
  import { camelCase, trainCase } from "change-case";
2
2
  import plur from "plur";
3
- export function NamedObjectType_objectSetMethodNames() {
3
+ export function ObjectType_objectSetMethodNames() {
4
4
  const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
5
- const prefixSingular = camelCase(this.name, {
5
+ const prefixSingular = camelCase(this.alias, {
6
6
  prefixCharacters: syntheticNamePrefix,
7
7
  });
8
- const thisNameParts = trainCase(this.name, {
8
+ const thisNameParts = trainCase(this.alias, {
9
9
  prefixCharacters: syntheticNamePrefix,
10
10
  }).split("-");
11
11
  let prefixPlural = camelCase(`${thisNameParts.slice(0, thisNameParts.length - 1).join("")}${plur(thisNameParts[thisNameParts.length - 1])}`, { prefixCharacters: syntheticNamePrefix });
@@ -20,4 +20,4 @@ export function NamedObjectType_objectSetMethodNames() {
20
20
  objects: prefixPlural,
21
21
  };
22
22
  }
23
- //# sourceMappingURL=NamedObjectType_objectSetMethodNames.js.map
23
+ //# sourceMappingURL=ObjectType_objectSetMethodNames.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_schemaVariableStatement(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_schemaVariableStatement.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { code, joinCode } from "../ts-poet-wrapper.js";
3
+ export function ObjectType_schemaVariableStatement() {
4
+ if (!this.configuration.features.has("Object.schema")) {
5
+ return Maybe.empty();
6
+ }
7
+ return Maybe.of(code `\
8
+ export const schema = { properties: { ${joinCode(this.properties.flatMap((property) => property.schema
9
+ .toList()
10
+ .map((propertySchema) => code `${property.name}: ${propertySchema}`)), { on: ", " })} } } as const;`);
11
+ }
12
+ //# sourceMappingURL=ObjectType_schemaVariableStatement.js.map
@@ -2,10 +2,10 @@ import { Maybe } from "purify-ts";
2
2
  import type { Reusables } from "../Reusables.js";
3
3
  import type { TsGenerator } from "../TsGenerator.js";
4
4
  import { type Code } from "../ts-poet-wrapper.js";
5
- export declare function NamedObjectType_sparqlConstructQueryFunctionDeclaration(this: {
5
+ export declare function ObjectType_sparqlConstructQueryFunctionDeclaration(this: {
6
+ readonly alias: string;
6
7
  readonly configuration: TsGenerator.Configuration;
7
8
  readonly filterType: Code;
8
- readonly name: string;
9
9
  readonly reusables: Reusables;
10
10
  }): Maybe<Code>;
11
- //# sourceMappingURL=NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts.map
11
+ //# sourceMappingURL=ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts.map
@@ -1,20 +1,20 @@
1
1
  import { camelCase } from "change-case";
2
2
  import { Maybe } from "purify-ts";
3
3
  import { code } from "../ts-poet-wrapper.js";
4
- export function NamedObjectType_sparqlConstructQueryFunctionDeclaration() {
4
+ export function ObjectType_sparqlConstructQueryFunctionDeclaration() {
5
5
  if (!this.configuration.features.has("Object.SPARQL")) {
6
6
  return Maybe.empty();
7
7
  }
8
8
  return Maybe.of(code `\
9
9
  export function sparqlConstructQuery({ filter, ignoreRdfType, preferredLanguages, prefixes, subject, ...queryParameters }: { filter?: ${this.filterType}; ignoreRdfType?: boolean; prefixes?: { [prefix: string]: string }; preferredLanguages?: readonly string[]; subject: ${this.reusables.imports.NamedNode} | ${this.reusables.imports.Variable} } & Omit<${this.reusables.imports.sparqljs}.ConstructQuery, "prefixes" | "queryType" | "type">): ${this.reusables.imports.sparqljs}.ConstructQuery {
10
- const variablePrefix = subject.termType === "Variable" ? subject.value : "${camelCase(this.name)}";
10
+ const variablePrefix = subject.termType === "Variable" ? subject.value : "${camelCase(this.alias)}";
11
11
 
12
12
  return {
13
13
  ...queryParameters,
14
14
  prefixes: prefixes ?? {},
15
15
  queryType: "CONSTRUCT",
16
16
  template: (queryParameters.template ?? []).concat(
17
- ${this.name}.focusSparqlConstructTriples({
17
+ ${this.alias}.focusSparqlConstructTriples({
18
18
  filter,
19
19
  focusIdentifier: subject,
20
20
  ignoreRdfType: !!ignoreRdfType,
@@ -24,7 +24,7 @@ export function sparqlConstructQuery({ filter, ignoreRdfType, preferredLanguages
24
24
  type: "query",
25
25
  where: (queryParameters.where ?? []).concat(
26
26
  ${this.reusables.snippets.normalizeSparqlWherePatterns}(
27
- ${this.name}.focusSparqlWherePatterns({
27
+ ${this.alias}.focusSparqlWherePatterns({
28
28
  filter,
29
29
  focusIdentifier: subject,
30
30
  ignoreRdfType: !!ignoreRdfType,
@@ -36,4 +36,4 @@ export function sparqlConstructQuery({ filter, ignoreRdfType, preferredLanguages
36
36
  };
37
37
  }`);
38
38
  }
39
- //# sourceMappingURL=NamedObjectType_sparqlConstructQueryFunctionDeclaration.js.map
39
+ //# sourceMappingURL=ObjectType_sparqlConstructQueryFunctionDeclaration.js.map
@@ -2,10 +2,10 @@ import { Maybe } from "purify-ts";
2
2
  import type { Reusables } from "../Reusables.js";
3
3
  import type { TsGenerator } from "../TsGenerator.js";
4
4
  import { type Code } from "../ts-poet-wrapper.js";
5
- export declare function NamedObjectType_sparqlConstructQueryStringFunctionDeclaration(this: {
5
+ export declare function ObjectType_sparqlConstructQueryStringFunctionDeclaration(this: {
6
+ readonly alias: string;
6
7
  readonly configuration: TsGenerator.Configuration;
7
8
  readonly filterType: Code;
8
- readonly name: string;
9
9
  readonly reusables: Reusables;
10
10
  }): Maybe<Code>;
11
- //# sourceMappingURL=NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts.map
11
+ //# sourceMappingURL=ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { code } from "../ts-poet-wrapper.js";
3
+ export function ObjectType_sparqlConstructQueryStringFunctionDeclaration() {
4
+ if (!this.configuration.features.has("Object.SPARQL")) {
5
+ return Maybe.empty();
6
+ }
7
+ return Maybe.of(code `\
8
+ export function sparqlConstructQueryString(parameters: Parameters<typeof ${this.alias}.sparqlConstructQuery>[0] & ${this.reusables.imports.sparqljs}.GeneratorOptions): string {
9
+ return new ${this.reusables.imports.sparqljs}.Generator(parameters).stringify(${this.alias}.sparqlConstructQuery(parameters));
10
+ }`);
11
+ }
12
+ //# sourceMappingURL=ObjectType_sparqlConstructQueryStringFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_toJsonFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_toJsonFunctionDeclaration.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { code, joinCode } from "../ts-poet-wrapper.js";
3
+ export function ObjectType_toJsonFunctionDeclaration() {
4
+ if (!this.configuration.features.has("Object.toJson")) {
5
+ return Maybe.empty();
6
+ }
7
+ return Maybe.of(code `\
8
+ export function toJson(${this.thisVariable}: ${this.expression}): ${this.jsonType().expression} {
9
+ return JSON.parse(JSON.stringify({ ${joinCode(this.properties.flatMap((property) => property
10
+ .toJsonInitializer({
11
+ variables: {
12
+ value: property.accessExpression({
13
+ variables: { object: this.thisVariable },
14
+ }),
15
+ },
16
+ })
17
+ .toList()), { on: "," })} } satisfies ${this.jsonType().expression}));
18
+ }`);
19
+ }
20
+ //# sourceMappingURL=ObjectType_toJsonFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_toRdfResourceFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_toRdfResourceFunctionDeclaration.d.ts.map