@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
@@ -1,342 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { NodeKind } from "@shaclmate/shacl-ast";
8
- import { camelCase } from "change-case";
9
- import { Maybe } from "purify-ts";
10
- import { Memoize } from "typescript-memoize";
11
- import { DiscriminantProperty as _DiscriminantProperty } from "./_NamedObjectType/DiscriminantProperty.js";
12
- import { IdentifierProperty as _IdentifierProperty } from "./_NamedObjectType/IdentifierProperty.js";
13
- import { identifierTypeDeclarations } from "./_NamedObjectType/identifierTypeDeclarations.js";
14
- import { NamedObjectType_createFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_createFunctionDeclaration.js";
15
- import { NamedObjectType_equalsFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js";
16
- import { NamedObjectType_filterFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js";
17
- import { NamedObjectType_filterTypeDeclaration } from "./_NamedObjectType/NamedObjectType_filterTypeDeclaration.js";
18
- import { NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js";
19
- import { NamedObjectType_focusSparqlWherePatternsFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js";
20
- import { NamedObjectType_fromJsonFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js";
21
- import { NamedObjectType_fromRdfResourceFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js";
22
- import { NamedObjectType_fromRdfResourceValuesFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js";
23
- import { NamedObjectType_fromRdfTypeVariableStatement } from "./_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js";
24
- import { NamedObjectType_graphqlTypeVariableStatement } from "./_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js";
25
- import { NamedObjectType_hashFunctionDeclarations } from "./_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js";
26
- import { NamedObjectType_interfaceDeclaration } from "./_NamedObjectType/NamedObjectType_interfaceDeclaration.js";
27
- import { NamedObjectType_isTypeFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js";
28
- import { NamedObjectType_jsonParseFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js";
29
- import { NamedObjectType_jsonSchemaFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js";
30
- import { NamedObjectType_jsonTypeAliasDeclaration } from "./_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js";
31
- import { NamedObjectType_jsonUiSchemaFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js";
32
- import { NamedObjectType_objectSetMethodNames } from "./_NamedObjectType/NamedObjectType_objectSetMethodNames.js";
33
- import { NamedObjectType_schemaVariableStatement } from "./_NamedObjectType/NamedObjectType_schemaVariableStatement.js";
34
- import { NamedObjectType_sparqlConstructQueryFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js";
35
- import { NamedObjectType_sparqlConstructQueryStringFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js";
36
- import { NamedObjectType_toJsonFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js";
37
- import { NamedObjectType_toRdfResourceFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js";
38
- import { NamedObjectType_toStringFunctionDeclarations } from "./_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js";
39
- import { NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js";
40
- import { NamedObjectType_valueSparqlWherePatternsFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js";
41
- import { ShaclProperty as _ShaclProperty } from "./_NamedObjectType/ShaclProperty.js";
42
- import { AbstractType } from "./AbstractType.js";
43
- import { code, def, joinCode } from "./ts-poet-wrapper.js";
44
- export class NamedObjectType extends AbstractType {
45
- toRdfTypes;
46
- conversionFunction = Maybe.empty();
47
- extern;
48
- fromRdfType;
49
- graphqlArgs = Maybe.empty();
50
- identifierType;
51
- kind = "NamedObjectType";
52
- name;
53
- recursive;
54
- referencesObjectType = true;
55
- synthetic;
56
- typeofs = ["object"];
57
- validationFunction = Maybe.empty();
58
- constructor({ extern, fromRdfType, identifierType, lazyAncestorObjectTypes, lazyChildObjectTypes, lazyDescendantObjectTypes, lazyDiscriminantProperty, lazyParentObjectTypes, lazyProperties, name, recursive, synthetic, toRdfTypes, ...superParameters }) {
59
- super(superParameters);
60
- this.extern = extern;
61
- this.fromRdfType = fromRdfType;
62
- this.identifierType = identifierType;
63
- // Lazily initialize some members in getters to avoid recursive construction
64
- this.lazyAncestorObjectTypes = lazyAncestorObjectTypes;
65
- this.lazyChildObjectTypes = lazyChildObjectTypes;
66
- this.lazyDescendantObjectTypes = lazyDescendantObjectTypes;
67
- this.lazyDiscriminantProperty = lazyDiscriminantProperty;
68
- this.lazyParentObjectTypes = lazyParentObjectTypes;
69
- this.lazyProperties = lazyProperties;
70
- this.name = name;
71
- this.recursive = recursive;
72
- this.synthetic = synthetic;
73
- this.toRdfTypes = toRdfTypes;
74
- }
75
- get _discriminantProperty() {
76
- return this.lazyDiscriminantProperty(this);
77
- }
78
- get ancestorObjectTypes() {
79
- return this.lazyAncestorObjectTypes();
80
- }
81
- get childObjectTypes() {
82
- return this.lazyChildObjectTypes();
83
- }
84
- get declaration() {
85
- const declarations = [];
86
- if (!this.extern) {
87
- const staticModuleDeclarations = [];
88
- if (this.configuration.features.has("Object.type")) {
89
- declarations.push(NamedObjectType_interfaceDeclaration.call(this));
90
- }
91
- staticModuleDeclarations.push(...NamedObjectType_createFunctionDeclaration.call(this).toList(), ...NamedObjectType_equalsFunctionDeclaration.call(this).toList(), ...NamedObjectType_hashFunctionDeclarations.call(this));
92
- const jsonModuleDeclarations = [
93
- ...NamedObjectType_jsonParseFunctionDeclaration.call(this).toList(),
94
- ...NamedObjectType_jsonSchemaFunctionDeclaration.call(this).toList(),
95
- ...NamedObjectType_jsonUiSchemaFunctionDeclaration.call(this).toList(),
96
- ];
97
- staticModuleDeclarations.push(...NamedObjectType_graphqlTypeVariableStatement.call(this).toList(), ...identifierTypeDeclarations.call(this), ...NamedObjectType_jsonTypeAliasDeclaration.call(this).toList(), ...(jsonModuleDeclarations.length > 0
98
- ? [
99
- code `export namespace Json { ${joinCode(jsonModuleDeclarations, { on: "\n\n" })} }`,
100
- ]
101
- : []), ...NamedObjectType_filterFunctionDeclaration.call(this).toList(), ...NamedObjectType_filterTypeDeclaration.call(this).toList(), ...NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.call(this).toList(), ...NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromJsonFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromRdfResourceFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromRdfResourceValuesFunctionDeclaration.call(this).toList(), ...NamedObjectType_fromRdfTypeVariableStatement.call(this).toList(), ...NamedObjectType_isTypeFunctionDeclaration.call(this).toList(), ...NamedObjectType_schemaVariableStatement.call(this).toList(), ...NamedObjectType_sparqlConstructQueryFunctionDeclaration.call({
102
- configuration: this.configuration,
103
- filterType: this.filterType,
104
- name: this.name,
105
- reusables: this.reusables,
106
- }).toList(), ...NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.call({
107
- configuration: this.configuration,
108
- filterType: this.filterType,
109
- name: this.name,
110
- reusables: this.reusables,
111
- }).toList(), ...NamedObjectType_toJsonFunctionDeclaration.call(this).toList(), ...NamedObjectType_toRdfResourceFunctionDeclaration.call(this).toList(), ...NamedObjectType_toStringFunctionDeclarations.call(this), ...NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.call(this).toList(), ...NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.call(this).toList());
112
- if (staticModuleDeclarations.length > 0) {
113
- declarations.push(code `\
114
- export namespace ${def(this.name)} {
115
- ${joinCode(staticModuleDeclarations, { on: "\n\n" })}
116
- }`);
117
- }
118
- }
119
- if (declarations.length === 0) {
120
- return Maybe.empty();
121
- }
122
- return Maybe.of(joinCode(declarations, { on: "\n\n" }));
123
- }
124
- get descendantFromRdfTypeVariables() {
125
- return this.descendantObjectTypes.flatMap((descendantObjectType) => descendantObjectType.fromRdfTypeVariable.toList());
126
- }
127
- get descendantFromRdfTypes() {
128
- return this.descendantObjectTypes.flatMap((descendantObjectType) => descendantObjectType.fromRdfType.toList());
129
- }
130
- get descendantObjectTypes() {
131
- return this.lazyDescendantObjectTypes();
132
- }
133
- get discriminantProperty() {
134
- return Maybe.of({
135
- jsonName: this._discriminantProperty.jsonName,
136
- name: this._discriminantProperty.name,
137
- ownValues: this._discriminantProperty.type.ownValues,
138
- descendantValues: this._discriminantProperty.type.descendantValues,
139
- });
140
- }
141
- get discriminantValue() {
142
- return this.name;
143
- }
144
- get equalsFunction() {
145
- return code `${this.name}.equals`;
146
- }
147
- get filterFunction() {
148
- return code `${this.name}.filter`;
149
- }
150
- get filterType() {
151
- return code `${this.name}.Filter`;
152
- }
153
- get fromRdfTypeVariable() {
154
- return this.fromRdfType.map(() => code `${this.name}.fromRdfType`);
155
- }
156
- get graphqlType() {
157
- return new AbstractType.GraphqlType(code `${this.name}.GraphQL`, this.reusables);
158
- }
159
- get hashFunction() {
160
- return code `${this.name}.hash`;
161
- }
162
- get identifierTypeAlias() {
163
- return code `${this.name}.Identifier`;
164
- }
165
- get mutable() {
166
- return this.properties.some((property) => property.mutable);
167
- }
168
- get objectSetMethodNames() {
169
- return NamedObjectType_objectSetMethodNames.call({
170
- configuration: this.configuration,
171
- name: this.name,
172
- });
173
- }
174
- get parentObjectTypes() {
175
- return this.lazyParentObjectTypes();
176
- }
177
- get properties() {
178
- const properties = this.lazyProperties(this);
179
- const propertyNames = new Set();
180
- for (const property of properties) {
181
- if (propertyNames.has(property.name)) {
182
- throw new Error(`duplicate property '${property.name}'`);
183
- }
184
- }
185
- return properties;
186
- }
187
- get schema() {
188
- return code `${this.name}.schema`;
189
- }
190
- get schemaType() {
191
- return code `typeof ${this.schema}`;
192
- }
193
- get toRdfResourceValueTypes() {
194
- return new Set([...this.identifierType.nodeKinds].map(NodeKind.toTermType));
195
- }
196
- get toRdfjsResourceType() {
197
- if (this.parentObjectTypes.length > 0) {
198
- return this.parentObjectTypes[0].toRdfjsResourceType;
199
- }
200
- return code `${this.reusables.imports.Resource}${this.identifierType.kind === "Iri" ? code `<${this.reusables.imports.NamedNode}>` : ""}`;
201
- }
202
- get valueSparqlConstructTriplesFunction() {
203
- return code `${this.name}.valueSparqlConstructTriples`;
204
- }
205
- get valueSparqlWherePatternsFunction() {
206
- return code `${this.name}.valueSparqlWherePatterns`;
207
- }
208
- get thisVariable() {
209
- return code `_${camelCase(this.name)}`;
210
- }
211
- fromJsonExpression({ variables, }) {
212
- // Assumes the JSON object has been recursively validated already.
213
- return code `${this.name}.fromJson(${variables.value})`;
214
- }
215
- fromRdfResourceValuesExpression({ variables, }) {
216
- const { resourceValues: resourceValuesVariable, ...fromRdfResourceValuesOptionsTemp } = variables;
217
- const fromRdfResourceValuesOptions = fromRdfResourceValuesOptionsTemp;
218
- if (!this.configuration.features.has("ObjectSet")) {
219
- delete fromRdfResourceValuesOptions["objectSet"];
220
- }
221
- return code `${this.name}.fromRdfResourceValues(${resourceValuesVariable}, ${fromRdfResourceValuesOptions})`;
222
- }
223
- graphqlResolveExpression({ variables, }) {
224
- return variables.value;
225
- }
226
- jsonSchema({ context, }) {
227
- let expression = code `${this.name}.Json.schema()`;
228
- if (context === "property" &&
229
- this.properties.some((property) => property.recursive)) {
230
- expression = code `${this.reusables.imports.z}.lazy((): ${this.reusables.imports.z}.ZodType<${this.name}.Json> => ${expression})`;
231
- }
232
- return expression;
233
- }
234
- jsonType() {
235
- return new AbstractType.JsonType(code `${this.name}.Json`);
236
- }
237
- jsonUiSchemaElement({ variables, }) {
238
- return Maybe.of(code `${this.name}.Json.uiSchema({ scopePrefix: ${variables.scopePrefix} })`);
239
- }
240
- toJsonExpression({ variables, }) {
241
- return code `${this.name}.toJson(${variables.value})`;
242
- }
243
- toRdfResourceValuesExpression({ variables, }) {
244
- return code `[${this.name}.toRdfResource(${variables.value}, { graph: ${variables.graph}, resourceSet: ${variables.resourceSet} }).identifier]`;
245
- }
246
- toStringExpression({ variables, }) {
247
- return code `${this.name}.${this.configuration.syntheticNamePrefix}toString(${variables.value})`;
248
- }
249
- lazyAncestorObjectTypes;
250
- lazyChildObjectTypes;
251
- lazyDescendantObjectTypes;
252
- lazyDiscriminantProperty;
253
- lazyParentObjectTypes;
254
- lazyProperties;
255
- }
256
- __decorate([
257
- Memoize()
258
- ], NamedObjectType.prototype, "_discriminantProperty", null);
259
- __decorate([
260
- Memoize()
261
- ], NamedObjectType.prototype, "ancestorObjectTypes", null);
262
- __decorate([
263
- Memoize()
264
- ], NamedObjectType.prototype, "childObjectTypes", null);
265
- __decorate([
266
- Memoize()
267
- ], NamedObjectType.prototype, "descendantFromRdfTypeVariables", null);
268
- __decorate([
269
- Memoize()
270
- ], NamedObjectType.prototype, "descendantFromRdfTypes", null);
271
- __decorate([
272
- Memoize()
273
- ], NamedObjectType.prototype, "descendantObjectTypes", null);
274
- __decorate([
275
- Memoize()
276
- ], NamedObjectType.prototype, "discriminantProperty", null);
277
- __decorate([
278
- Memoize()
279
- ], NamedObjectType.prototype, "discriminantValue", null);
280
- __decorate([
281
- Memoize()
282
- ], NamedObjectType.prototype, "equalsFunction", null);
283
- __decorate([
284
- Memoize()
285
- ], NamedObjectType.prototype, "filterFunction", null);
286
- __decorate([
287
- Memoize()
288
- ], NamedObjectType.prototype, "filterType", null);
289
- __decorate([
290
- Memoize()
291
- ], NamedObjectType.prototype, "fromRdfTypeVariable", null);
292
- __decorate([
293
- Memoize()
294
- ], NamedObjectType.prototype, "graphqlType", null);
295
- __decorate([
296
- Memoize()
297
- ], NamedObjectType.prototype, "hashFunction", null);
298
- __decorate([
299
- Memoize()
300
- ], NamedObjectType.prototype, "identifierTypeAlias", null);
301
- __decorate([
302
- Memoize()
303
- ], NamedObjectType.prototype, "mutable", null);
304
- __decorate([
305
- Memoize()
306
- ], NamedObjectType.prototype, "objectSetMethodNames", null);
307
- __decorate([
308
- Memoize()
309
- ], NamedObjectType.prototype, "parentObjectTypes", null);
310
- __decorate([
311
- Memoize()
312
- ], NamedObjectType.prototype, "properties", null);
313
- __decorate([
314
- Memoize()
315
- ], NamedObjectType.prototype, "schema", null);
316
- __decorate([
317
- Memoize()
318
- ], NamedObjectType.prototype, "schemaType", null);
319
- __decorate([
320
- Memoize()
321
- ], NamedObjectType.prototype, "toRdfResourceValueTypes", null);
322
- __decorate([
323
- Memoize()
324
- ], NamedObjectType.prototype, "toRdfjsResourceType", null);
325
- __decorate([
326
- Memoize()
327
- ], NamedObjectType.prototype, "valueSparqlConstructTriplesFunction", null);
328
- __decorate([
329
- Memoize()
330
- ], NamedObjectType.prototype, "valueSparqlWherePatternsFunction", null);
331
- __decorate([
332
- Memoize()
333
- ], NamedObjectType.prototype, "thisVariable", null);
334
- __decorate([
335
- Memoize()
336
- ], NamedObjectType.prototype, "jsonType", null);
337
- (function (NamedObjectType) {
338
- NamedObjectType.IdentifierProperty = _IdentifierProperty;
339
- NamedObjectType.ShaclProperty = _ShaclProperty;
340
- NamedObjectType.DiscriminantProperty = _DiscriminantProperty;
341
- })(NamedObjectType || (NamedObjectType = {}));
342
- //# sourceMappingURL=NamedObjectType.js.map
@@ -1,37 +0,0 @@
1
- import { AbstractNamedUnionType } from "./AbstractNamedUnionType.js";
2
- import { AbstractType } from "./AbstractType.js";
3
- import type { BlankNodeType } from "./BlankNodeType.js";
4
- import type { IdentifierType } from "./IdentifierType.js";
5
- import type { IriType } from "./IriType.js";
6
- import type { NamedObjectType } from "./NamedObjectType.js";
7
- import { type Code } from "./ts-poet-wrapper.js";
8
- export declare class NamedObjectUnionType extends AbstractNamedUnionType<NamedObjectType> {
9
- #private;
10
- readonly graphqlArgs: AbstractType["graphqlArgs"];
11
- readonly kind = "NamedObjectUnion";
12
- readonly synthetic: boolean;
13
- constructor({ identifierType, synthetic, ...superParameters }: {
14
- identifierType: BlankNodeType | IdentifierType | IriType;
15
- synthetic: boolean;
16
- } & Omit<ConstructorParameters<typeof AbstractNamedUnionType<NamedObjectType>>[0], "identifierType">);
17
- get graphqlType(): AbstractType.GraphqlType;
18
- get identifierTypeAlias(): Code;
19
- get objectSetMethodNames(): NamedObjectType.ObjectSetMethodNames;
20
- get schema(): Code;
21
- get schemaType(): Code;
22
- protected get staticModuleDeclarations(): Record<string, Code>;
23
- private get focusSparqlConstructTriplesFunctionDeclaration();
24
- private get focusSparqlWherePatternsFunctionDeclaration();
25
- private get fromRdfResourceFunctionDeclaration();
26
- private get graphqlTypeVariableStatement();
27
- private get identifierTypeDeclarations();
28
- private get isTypeFunctionDeclaration();
29
- private get schemaVariableStatement();
30
- private get toRdfResourceFunctionDeclaration();
31
- graphqlResolveExpression({ variables, }: {
32
- variables: {
33
- value: Code;
34
- };
35
- }): Code;
36
- }
37
- //# sourceMappingURL=NamedObjectUnionType.d.ts.map
@@ -1,11 +0,0 @@
1
- import { AbstractNamedUnionType } from "./AbstractNamedUnionType.js";
2
- import type { AbstractType } from "./AbstractType.js";
3
- import type { Type } from "./Type.js";
4
- import type { Code } from "./ts-poet-wrapper.js";
5
- export declare class NamedUnionType extends AbstractNamedUnionType<Type> {
6
- readonly graphqlArgs: AbstractType["graphqlArgs"];
7
- readonly kind = "NamedUnion";
8
- graphqlResolveExpression(): Code;
9
- get graphqlType(): AbstractType.GraphqlType;
10
- }
11
- //# sourceMappingURL=NamedUnionType.d.ts.map
@@ -1,13 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import { AbstractNamedUnionType } from "./AbstractNamedUnionType.js";
3
- export class NamedUnionType extends AbstractNamedUnionType {
4
- graphqlArgs = Maybe.empty();
5
- kind = "NamedUnion";
6
- graphqlResolveExpression() {
7
- throw new Error("GraphQL doesn't support scalar unions");
8
- }
9
- get graphqlType() {
10
- throw new Error("GraphQL doesn't support scalar unions");
11
- }
12
- }
13
- //# sourceMappingURL=NamedUnionType.js.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { NamedObjectType } from "../NamedObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function NamedObjectType_createFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
5
- //# sourceMappingURL=NamedObjectType_createFunctionDeclaration.d.ts.map
@@ -1,65 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import { invariant } from "ts-invariant";
3
- import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
4
- export function NamedObjectType_createFunctionDeclaration() {
5
- if (!this.configuration.features.has("Object.create")) {
6
- return Maybe.empty();
7
- }
8
- const parametersPropertySignatures = this.properties.flatMap((property) => property.constructorParameter.toList());
9
- const parametersType = [];
10
- if (parametersPropertySignatures.length > 0) {
11
- parametersType.push(code `{ ${joinCode(parametersPropertySignatures)} }`);
12
- }
13
- for (const parentObjectType of this.parentObjectTypes) {
14
- parametersType.push(code `Parameters<typeof ${parentObjectType.name}.create>[0]`);
15
- }
16
- if (parametersType.length === 0) {
17
- parametersType.push(code `object`);
18
- }
19
- const parametersHasQuestionToken = this.parentObjectTypes.length === 0 &&
20
- parametersPropertySignatures.every((propertySignature) => propertySignature.toCodeString([]).indexOf("?:") !== -1);
21
- const parametersVariable = code `parameters${parametersHasQuestionToken ? "?" : ""}`;
22
- const parametersSignature = code `parameters${parametersHasQuestionToken ? "?" : ""}: ${joinCode(parametersType, { on: " & " })}`;
23
- const chains = [];
24
- this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
25
- chains.push({
26
- expression: code `${parentObjectType.name}.create(parameters)`,
27
- variable: `super${parentObjectTypeI}`,
28
- });
29
- });
30
- const propertyInitializers = this.properties.flatMap((property) => property
31
- .constructorInitializer({
32
- variables: { parameters: parametersVariable },
33
- })
34
- .toList());
35
- invariant(propertyInitializers.length > 0);
36
- chains.push({
37
- expression: code `${this.reusables.snippets.sequenceRecord}({ ${joinCode(propertyInitializers, { on: "," })} })`,
38
- variable: "properties",
39
- });
40
- let returnExpression = code `{ ${chains
41
- .map((chain) => `...${chain.variable}`)
42
- .join(", ")}, ${this._discriminantProperty.name}: ${literalOf(this.discriminantValue)} as const }`;
43
- const monkeyPatchMethods = [];
44
- if (this.configuration.features.has("Object.toJson")) {
45
- monkeyPatchMethods.push("toJson");
46
- }
47
- if (this.configuration.features.has("Object.toString")) {
48
- monkeyPatchMethods.push(`${this.configuration.syntheticNamePrefix}toString`);
49
- }
50
- if (monkeyPatchMethods.length > 0) {
51
- returnExpression = code `${this.reusables.snippets.monkeyPatchObject}(${returnExpression}, { ${monkeyPatchMethods.join(", ")} })`;
52
- }
53
- returnExpression = chains
54
- .toReversed()
55
- .reduce((acc, { expression, variable }, chainI) => code `(${expression}).${chainI === 0 ? "map" : "chain"}(${variable} => ${acc})`, returnExpression);
56
- return Maybe.of(code `\
57
- export function create(${parametersSignature}): ${this.reusables.imports.Either}<Error, ${this.name}> {
58
- return ${returnExpression};
59
- }
60
-
61
- export function createUnsafe(${parametersSignature}): ${this.name} {
62
- return create(parameters).unsafeCoerce();
63
- }`);
64
- }
65
- //# sourceMappingURL=NamedObjectType_createFunctionDeclaration.js.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { NamedObjectType } from "../NamedObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function NamedObjectType_equalsFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
5
- //# sourceMappingURL=NamedObjectType_equalsFunctionDeclaration.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { NamedObjectType } from "../NamedObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function NamedObjectType_filterFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
5
- //# sourceMappingURL=NamedObjectType_filterFunctionDeclaration.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { NamedObjectType } from "../NamedObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function NamedObjectType_filterTypeDeclaration(this: NamedObjectType): Maybe<Code>;
5
- //# sourceMappingURL=NamedObjectType_filterTypeDeclaration.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { NamedObjectType } from "../NamedObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
5
- //# sourceMappingURL=NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { NamedObjectType } from "../NamedObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function NamedObjectType_focusSparqlWherePatternsFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
5
- //# sourceMappingURL=NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { NamedObjectType } from "../NamedObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function NamedObjectType_fromJsonFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
5
- //# sourceMappingURL=NamedObjectType_fromJsonFunctionDeclaration.d.ts.map
@@ -1,43 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import { code, joinCode } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_fromJsonFunctionDeclaration() {
4
- if (!this.configuration.features.has("Object.fromJson")) {
5
- return Maybe.empty();
6
- }
7
- const variables = {
8
- jsonObject: code `${this.configuration.syntheticNamePrefix}json`,
9
- };
10
- const chains = [];
11
- this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
12
- chains.push({
13
- expression: code `${parentObjectType.name}.fromJson(${variables.jsonObject})`,
14
- variable: `super${parentObjectTypeI}`,
15
- });
16
- });
17
- const propertyInitializers = this.properties.flatMap((property) => property.fromJsonInitializer({ variables }).toList());
18
- if (propertyInitializers.length > 0) {
19
- chains.push({
20
- expression: code `${this.reusables.snippets.sequenceRecord}({ ${joinCode(propertyInitializers, { on: "," })} })`,
21
- variable: "properties",
22
- });
23
- }
24
- let returnExpression;
25
- switch (chains.length) {
26
- case 0:
27
- returnExpression = code `create({})`;
28
- break;
29
- case 1:
30
- returnExpression = code `(${chains[0].expression}).chain(create)`;
31
- break;
32
- default:
33
- returnExpression = code `${chains
34
- .reverse()
35
- .reduce((acc, { expression, variable }) => code `(${expression}).chain(${variable} => ${acc})`, code `(create({ ${chains.map((chain) => `...${chain.variable}`).join(", ")} }))`)}`;
36
- break;
37
- }
38
- return Maybe.of(code `\
39
- export function fromJson(${variables.jsonObject}: ${this.jsonType().name}): ${this.reusables.imports.Either}<Error, ${this.name}> {
40
- return ${returnExpression};
41
- }`);
42
- }
43
- //# sourceMappingURL=NamedObjectType_fromJsonFunctionDeclaration.js.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { NamedObjectType } from "../NamedObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function NamedObjectType_fromRdfResourceFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
5
- //# sourceMappingURL=NamedObjectType_fromRdfResourceFunctionDeclaration.d.ts.map
@@ -1,80 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import { arrayOf, code, joinCode } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_fromRdfResourceFunctionDeclaration() {
4
- if (!this.configuration.features.has("Object.fromRdf")) {
5
- return Maybe.empty();
6
- }
7
- const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
8
- const optionsVariable = `_${syntheticNamePrefix}options`;
9
- const variables = {
10
- context: code `${optionsVariable}.context`,
11
- graph: code `${optionsVariable}.graph`,
12
- ignoreRdfType: code `${optionsVariable}.ignoreRdfType`,
13
- objectSet: code `${optionsVariable}.objectSet`,
14
- preferredLanguages: code `${optionsVariable}.preferredLanguages`,
15
- resource: code `${syntheticNamePrefix}resource`,
16
- };
17
- const propertyFromRdfResourceValuesExpressionVariable = {
18
- context: variables.context,
19
- graph: variables.graph,
20
- objectSet: variables.objectSet,
21
- preferredLanguages: variables.preferredLanguages,
22
- resource: variables.resource,
23
- };
24
- const chains = [];
25
- const partials = [];
26
- this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
27
- chains.push({
28
- expression: code `${parentObjectType.name}._fromRdfResource(${variables.resource}, { ...${optionsVariable}, ignoreRdfType: true })`,
29
- variable: `super${parentObjectTypeI}`,
30
- });
31
- partials.push(`super${parentObjectTypeI}`);
32
- });
33
- this.fromRdfTypeVariable.ifJust((fromRdfTypeVariable) => {
34
- chains.push({
35
- expression: code `!${variables.ignoreRdfType} ? ${this.reusables.snippets.ensureRdfResourceType}(${variables.resource}, ${arrayOf(fromRdfTypeVariable, ...this.descendantFromRdfTypeVariables)}, ${{ graph: variables.graph }}) : ${this.reusables.imports.Right}(true as const)`,
36
- variable: `_rdfTypeCheck`,
37
- });
38
- });
39
- const propertyFromRdfResourceValuesInitializers = this.properties.flatMap((property) => property
40
- .fromRdfResourceValuesInitializer({
41
- variables: propertyFromRdfResourceValuesExpressionVariable,
42
- })
43
- .toList());
44
- if (Object.keys(propertyFromRdfResourceValuesInitializers).length > 0) {
45
- chains.push({
46
- expression: code `${this.reusables.snippets.sequenceRecord}({ ${joinCode(propertyFromRdfResourceValuesInitializers, { on: ", " })} })`,
47
- variable: "properties",
48
- });
49
- partials.push("properties");
50
- }
51
- let partialsJoined;
52
- switch (partials.length) {
53
- case 0:
54
- partialsJoined = code `{}`;
55
- break;
56
- case 1:
57
- partialsJoined = code `${partials[0]}`;
58
- break;
59
- default:
60
- partialsJoined = code `{ ${partials.map((partial) => `...${partial}`).join(", ")} }`;
61
- break;
62
- }
63
- let returnExpression;
64
- const resultExpression = code `create(${partialsJoined})`;
65
- if (chains.length === 0) {
66
- returnExpression = code `${this.reusables.imports.Right}(${resultExpression})`;
67
- }
68
- else {
69
- returnExpression = code `${chains
70
- .reverse()
71
- .reduce((acc, { expression, variable }) => code `(${expression}).chain(${variable} => ${acc})`, code `(${resultExpression})`)}`;
72
- }
73
- return Maybe.of(code `\
74
- export const _fromRdfResource: ${this.reusables.snippets._FromRdfResourceFunction}<${this.name}> = (${variables.resource}, ${optionsVariable}) => {
75
- return ${returnExpression};
76
- }
77
-
78
- export const fromRdfResource = ${this.reusables.snippets.wrap_FromRdfResourceFunction}(_fromRdfResource);`);
79
- }
80
- //# sourceMappingURL=NamedObjectType_fromRdfResourceFunctionDeclaration.js.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { NamedObjectType } from "../NamedObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function NamedObjectType_fromRdfResourceValuesFunctionDeclaration(this: NamedObjectType): Maybe<Code>;
5
- //# sourceMappingURL=NamedObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts.map