@shaclmate/compiler 4.0.38 → 4.0.40

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 (256) hide show
  1. package/dist/ShapesGraphToAstTransformer.js +12 -12
  2. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +24 -24
  3. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +4 -4
  4. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +1 -1
  5. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +16 -16
  6. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +1 -1
  7. package/dist/ast/AbstractCollectionType.d.ts +1 -1
  8. package/dist/ast/AbstractCompoundType.d.ts +1 -1
  9. package/dist/ast/AbstractCompoundType.js +15 -15
  10. package/dist/ast/AbstractContainerType.d.ts +1 -1
  11. package/dist/ast/AbstractContainerType.js +15 -15
  12. package/dist/ast/AbstractLazyObjectType.d.ts +1 -1
  13. package/dist/ast/AbstractTermType.d.ts +1 -1
  14. package/dist/ast/BlankNodeType.d.ts +1 -1
  15. package/dist/ast/BlankNodeType.js +1 -1
  16. package/dist/ast/DefaultValueType.d.ts +1 -1
  17. package/dist/ast/DefaultValueType.js +2 -2
  18. package/dist/ast/IdentifierType.d.ts +1 -1
  19. package/dist/ast/IdentifierType.js +1 -1
  20. package/dist/ast/IntersectionType.d.ts +1 -1
  21. package/dist/ast/IntersectionType.js +3 -3
  22. package/dist/ast/IriType.d.ts +1 -1
  23. package/dist/ast/IriType.js +1 -1
  24. package/dist/ast/LazyObjectOptionType.d.ts +1 -1
  25. package/dist/ast/LazyObjectOptionType.js +1 -1
  26. package/dist/ast/LazyObjectSetType.d.ts +1 -1
  27. package/dist/ast/LazyObjectSetType.js +1 -1
  28. package/dist/ast/LazyObjectType.d.ts +1 -1
  29. package/dist/ast/LazyObjectType.js +1 -1
  30. package/dist/ast/ListType.d.ts +1 -1
  31. package/dist/ast/ListType.js +16 -16
  32. package/dist/ast/LiteralType.d.ts +1 -1
  33. package/dist/ast/LiteralType.js +1 -1
  34. package/dist/ast/ObjectCompoundType.js +3 -3
  35. package/dist/ast/ObjectType.d.ts +1 -1
  36. package/dist/ast/ObjectType.js +16 -16
  37. package/dist/ast/OptionType.d.ts +1 -1
  38. package/dist/ast/OptionType.js +1 -1
  39. package/dist/ast/SetType.d.ts +1 -1
  40. package/dist/ast/SetType.js +1 -1
  41. package/dist/ast/TermType.d.ts +1 -1
  42. package/dist/ast/TermType.js +1 -1
  43. package/dist/ast/Type.js +15 -15
  44. package/dist/ast/UnionType.d.ts +1 -1
  45. package/dist/ast/UnionType.js +3 -3
  46. package/dist/generators/transformAstToLabeledPropertyGraph.js +10 -10
  47. package/dist/generators/ts/AbstractCollectionType.d.ts +2 -6
  48. package/dist/generators/ts/AbstractCollectionType.js +16 -15
  49. package/dist/generators/ts/AbstractContainerType.d.ts +7 -11
  50. package/dist/generators/ts/AbstractContainerType.js +35 -36
  51. package/dist/generators/ts/AbstractDateType.d.ts +4 -4
  52. package/dist/generators/ts/AbstractDateType.js +2 -2
  53. package/dist/generators/ts/AbstractIdentifierType.d.ts +1 -1
  54. package/dist/generators/ts/AbstractLazyObjectType.d.ts +14 -17
  55. package/dist/generators/ts/AbstractLazyObjectType.js +26 -38
  56. package/dist/generators/ts/AbstractLiteralType.d.ts +1 -5
  57. package/dist/generators/ts/AbstractLiteralType.js +7 -6
  58. package/dist/generators/ts/AbstractNumericType.d.ts +2 -2
  59. package/dist/generators/ts/AbstractNumericType.js +3 -3
  60. package/dist/generators/ts/AbstractObjectSetType.d.ts +10 -9
  61. package/dist/generators/ts/AbstractObjectSetType.js +2 -2
  62. package/dist/generators/ts/AbstractPrimitiveType.d.ts +2 -6
  63. package/dist/generators/ts/AbstractPrimitiveType.js +9 -10
  64. package/dist/generators/ts/AbstractTermType.d.ts +1 -5
  65. package/dist/generators/ts/AbstractTermType.js +3 -17
  66. package/dist/generators/ts/AbstractType.d.ts +22 -15
  67. package/dist/generators/ts/AbstractType.js +18 -8
  68. package/dist/generators/ts/BigDecimalType.d.ts +2 -2
  69. package/dist/generators/ts/BigDecimalType.js +3 -3
  70. package/dist/generators/ts/BigIntType.d.ts +1 -1
  71. package/dist/generators/ts/BigIntType.js +3 -3
  72. package/dist/generators/ts/BlankNodeType.d.ts +4 -4
  73. package/dist/generators/ts/BlankNodeType.js +12 -12
  74. package/dist/generators/ts/BooleanType.d.ts +3 -3
  75. package/dist/generators/ts/BooleanType.js +11 -6
  76. package/dist/generators/ts/DateTimeType.d.ts +1 -1
  77. package/dist/generators/ts/DateTimeType.js +1 -1
  78. package/dist/generators/ts/DateType.d.ts +1 -1
  79. package/dist/generators/ts/DateType.js +1 -1
  80. package/dist/generators/ts/DefaultValueType.d.ts +3 -7
  81. package/dist/generators/ts/DefaultValueType.js +17 -21
  82. package/dist/generators/ts/FloatType.d.ts +1 -1
  83. package/dist/generators/ts/FloatType.js +1 -1
  84. package/dist/generators/ts/GraphqlSchema.d.ts +4 -4
  85. package/dist/generators/ts/GraphqlSchema.js +4 -4
  86. package/dist/generators/ts/IdentifierType.d.ts +4 -4
  87. package/dist/generators/ts/IdentifierType.js +14 -14
  88. package/dist/generators/ts/IntType.d.ts +1 -1
  89. package/dist/generators/ts/IntType.js +1 -1
  90. package/dist/generators/ts/IriType.d.ts +4 -2
  91. package/dist/generators/ts/IriType.js +27 -22
  92. package/dist/generators/ts/LazyObjectOptionType.d.ts +2 -1
  93. package/dist/generators/ts/LazyObjectOptionType.js +7 -7
  94. package/dist/generators/ts/LazyObjectSetType.d.ts +1 -1
  95. package/dist/generators/ts/LazyObjectSetType.js +6 -6
  96. package/dist/generators/ts/LazyObjectType.d.ts +1 -1
  97. package/dist/generators/ts/LazyObjectType.js +5 -5
  98. package/dist/generators/ts/ListType.d.ts +5 -6
  99. package/dist/generators/ts/ListType.js +24 -25
  100. package/dist/generators/ts/LiteralType.d.ts +3 -2
  101. package/dist/generators/ts/LiteralType.js +14 -7
  102. package/dist/generators/ts/{NamedObjectType.d.ts → ObjectType.d.ts} +24 -24
  103. package/dist/generators/ts/ObjectType.js +350 -0
  104. package/dist/generators/ts/ObjectUnionType.d.ts +20 -0
  105. package/dist/generators/ts/{NamedObjectUnionType.js → ObjectUnionType.js} +54 -64
  106. package/dist/generators/ts/OptionType.d.ts +2 -6
  107. package/dist/generators/ts/OptionType.js +12 -18
  108. package/dist/generators/ts/RdfjsDatasetObjectSetType.js +8 -8
  109. package/dist/generators/ts/SetType.d.ts +1 -1
  110. package/dist/generators/ts/SetType.js +1 -1
  111. package/dist/generators/ts/Snippets.d.ts +1 -0
  112. package/dist/generators/ts/Snippets.js +7 -0
  113. package/dist/generators/ts/SparqlObjectSetType.js +2 -2
  114. package/dist/generators/ts/StringType.d.ts +3 -3
  115. package/dist/generators/ts/StringType.js +11 -6
  116. package/dist/generators/ts/TermType.d.ts +3 -3
  117. package/dist/generators/ts/TermType.js +13 -13
  118. package/dist/generators/ts/TsGenerator.js +12 -9
  119. package/dist/generators/ts/Type.d.ts +4 -5
  120. package/dist/generators/ts/TypeFactory.d.ts +7 -8
  121. package/dist/generators/ts/TypeFactory.js +79 -80
  122. package/dist/generators/ts/{AbstractUnionType.d.ts → UnionType.d.ts} +40 -15
  123. package/dist/generators/ts/{AbstractUnionType.js → UnionType.js} +328 -135
  124. package/dist/generators/ts/ZodGenerator.js +7 -9
  125. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.d.ts +13 -13
  126. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/AbstractProperty.js +11 -14
  127. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.d.ts +3 -2
  128. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/DiscriminantProperty.js +24 -15
  129. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.d.ts +3 -6
  130. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/IdentifierProperty.js +20 -12
  131. package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +5 -0
  132. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_createFunctionDeclaration.js → _ObjectType/ObjectType_createFunctionDeclaration.js} +6 -6
  133. package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.d.ts +5 -0
  134. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js → _ObjectType/ObjectType_equalsFunctionDeclaration.js} +5 -5
  135. package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +5 -0
  136. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js → _ObjectType/ObjectType_filterFunctionDeclaration.js} +3 -3
  137. package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +5 -0
  138. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_filterTypeDeclaration.js → _ObjectType/ObjectType_filterTypeDeclaration.js} +3 -3
  139. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
  140. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js} +3 -3
  141. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
  142. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js → _ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.js} +3 -3
  143. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.d.ts +5 -0
  144. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js → _ObjectType/ObjectType_fromJsonFunctionDeclaration.js} +4 -4
  145. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +5 -0
  146. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js → _ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.js} +7 -31
  147. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +5 -0
  148. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.js +15 -0
  149. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.d.ts +5 -0
  150. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js → _ObjectType/ObjectType_fromRdfTypeVariableStatement.js} +2 -2
  151. package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeVariableStatement.d.ts +5 -0
  152. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js → _ObjectType/ObjectType_graphqlTypeVariableStatement.js} +4 -4
  153. package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.d.ts +4 -0
  154. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js → _ObjectType/ObjectType_hashFunctionDeclarations.js} +8 -8
  155. package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +4 -0
  156. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_interfaceDeclaration.js → _ObjectType/ObjectType_interfaceDeclaration.js} +5 -5
  157. package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts +5 -0
  158. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js → _ObjectType/ObjectType_isTypeFunctionDeclaration.js} +3 -3
  159. package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.d.ts +5 -0
  160. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js → _ObjectType/ObjectType_jsonParseFunctionDeclaration.js} +2 -2
  161. package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +5 -0
  162. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js → _ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js} +2 -2
  163. package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +5 -0
  164. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js → _ObjectType/ObjectType_jsonTypeAliasDeclaration.js} +2 -2
  165. package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +5 -0
  166. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js → _ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js} +4 -4
  167. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_objectSetMethodNames.d.ts → _ObjectType/ObjectType_objectSetMethodNames.d.ts} +3 -3
  168. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_objectSetMethodNames.js → _ObjectType/ObjectType_objectSetMethodNames.js} +4 -4
  169. package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +5 -0
  170. package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.js +14 -0
  171. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts → _ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts} +3 -3
  172. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js → _ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js} +5 -5
  173. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts → _ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts} +3 -3
  174. package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js +12 -0
  175. package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.d.ts +5 -0
  176. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js → _ObjectType/ObjectType_toJsonFunctionDeclaration.js} +4 -4
  177. package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionDeclaration.d.ts +5 -0
  178. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js → _ObjectType/ObjectType_toRdfResourceFunctionDeclaration.js} +4 -4
  179. package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionDeclarations.d.ts +4 -0
  180. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js → _ObjectType/ObjectType_toStringFunctionDeclarations.js} +6 -6
  181. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
  182. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js → _ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js} +3 -3
  183. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
  184. package/dist/generators/ts/{_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js → _ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.js} +3 -3
  185. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/ShaclProperty.d.ts +2 -6
  186. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/ShaclProperty.js +24 -28
  187. package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +4 -0
  188. package/dist/generators/ts/{_NamedObjectType → _ObjectType}/identifierTypeDeclarations.js +4 -2
  189. package/dist/generators/ts/_snippets/snippets_BooleanSchema.js +2 -2
  190. package/dist/generators/ts/_snippets/snippets_CollectionSchema.js +1 -1
  191. package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.js +1 -1
  192. package/dist/generators/ts/_snippets/snippets_IriSchema.js +2 -2
  193. package/dist/generators/ts/_snippets/snippets_MaybeSchema.js +2 -2
  194. package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +1 -1
  195. package/dist/generators/ts/_snippets/snippets_StringSchema.js +2 -2
  196. package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.js +1 -1
  197. package/dist/generators/ts/_snippets/snippets_convertToIri.js +1 -1
  198. package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +1 -1
  199. package/dist/generators/ts/_snippets/snippets_ensureRdfResourceType.d.ts +3 -0
  200. package/dist/generators/ts/_snippets/snippets_ensureRdfResourceType.js +16 -0
  201. package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.js +1 -1
  202. package/dist/generators/ts/_snippets/snippets_listSparqlConstructTriples.js +2 -2
  203. package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.js +2 -2
  204. package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.js +1 -1
  205. package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.js +3 -3
  206. package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.js +1 -1
  207. package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.js +1 -1
  208. package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.js +1 -1
  209. package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.js +1 -1
  210. package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.js +1 -1
  211. package/dist/generators/ts/_snippets/snippets_validateArray.js +1 -1
  212. package/dist/generators/ts/_snippets/snippets_validateMaybe.js +1 -1
  213. package/dist/generators/ts/tsComment.js +1 -1
  214. package/dist/input/generated.d.ts +1399 -1468
  215. package/dist/input/generated.js +518 -655
  216. package/package.json +4 -4
  217. package/dist/generators/ts/AbstractNamedUnionType.d.ts +0 -30
  218. package/dist/generators/ts/AbstractNamedUnionType.js +0 -190
  219. package/dist/generators/ts/AnonymousUnionType.d.ts +0 -27
  220. package/dist/generators/ts/AnonymousUnionType.js +0 -59
  221. package/dist/generators/ts/NamedObjectType.js +0 -341
  222. package/dist/generators/ts/NamedObjectUnionType.d.ts +0 -37
  223. package/dist/generators/ts/NamedUnionType.d.ts +0 -11
  224. package/dist/generators/ts/NamedUnionType.js +0 -13
  225. package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.d.ts +0 -5
  226. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.d.ts +0 -5
  227. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +0 -5
  228. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +0 -5
  229. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  230. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
  231. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.d.ts +0 -5
  232. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.d.ts +0 -5
  233. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +0 -5
  234. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +0 -15
  235. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.d.ts +0 -5
  236. package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.d.ts +0 -5
  237. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.d.ts +0 -4
  238. package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.d.ts +0 -4
  239. package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +0 -5
  240. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.d.ts +0 -5
  241. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
  242. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
  243. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
  244. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +0 -5
  245. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +0 -12
  246. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +0 -12
  247. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.d.ts +0 -5
  248. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.d.ts +0 -5
  249. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.d.ts +0 -4
  250. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  251. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +0 -5
  252. package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.d.ts +0 -4
  253. package/dist/generators/ts/removeUndefined.d.ts +0 -2
  254. package/dist/generators/ts/removeUndefined.js +0 -17
  255. /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.d.ts +0 -0
  256. /package/dist/generators/ts/{_NamedObjectType → _ObjectType}/Property.js +0 -0
@@ -1,7 +1,6 @@
1
- import { invariant } from "ts-invariant";
2
1
  import * as ast from "../../ast/index.js";
3
- import { NamedObjectType_jsonSchemaFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js";
4
- import { NamedObjectType_jsonTypeAliasDeclaration } from "./_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js";
2
+ import { ObjectType_jsonSchemaFunctionDeclaration } from "./_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js";
3
+ import { ObjectType_jsonTypeAliasDeclaration } from "./_ObjectType/ObjectType_jsonTypeAliasDeclaration.js";
5
4
  import { Reusables } from "./Reusables.js";
6
5
  import { TsGenerator } from "./TsGenerator.js";
7
6
  import { TypeFactory } from "./TypeFactory.js";
@@ -20,20 +19,19 @@ export class ZodGenerator {
20
19
  reusables,
21
20
  });
22
21
  const declarations = [];
23
- for (const namedObjectType of ast.ObjectType.toposort(ast_.namedObjectTypes).map((astObjectType) => typeFactory.createNamedObjectType(astObjectType))) {
22
+ for (const namedObjectType of ast.ObjectType.toposort(ast_.namedObjectTypes).map((astObjectType) => typeFactory.createObjectType(astObjectType))) {
24
23
  declarations.push(code `\
25
- export namespace ${namedObjectType.name} {
26
- ${joinCode(NamedObjectType_jsonTypeAliasDeclaration.call(namedObjectType).toList())}
24
+ export namespace ${namedObjectType.alias.unsafeCoerce()} {
25
+ ${joinCode(ObjectType_jsonTypeAliasDeclaration.call(namedObjectType).toList())}
27
26
 
28
27
  export namespace Json {
29
- ${joinCode(NamedObjectType_jsonSchemaFunctionDeclaration.call(namedObjectType).toList())}
28
+ ${joinCode(ObjectType_jsonSchemaFunctionDeclaration.call(namedObjectType).toList())}
30
29
  }
31
30
  }`);
32
31
  }
33
32
  for (const astNamedUnionType of ast_.namedUnionTypes.map((astNamedUnionType) => typeFactory.createUnionType(astNamedUnionType))) {
34
- invariant(astNamedUnionType.kind !== "AnonymousUnionType");
35
33
  declarations.push(code `\
36
- export namespace ${astNamedUnionType.name} {
34
+ export namespace ${astNamedUnionType.alias.unsafeCoerce()} {
37
35
  ${astNamedUnionType.jsonTypeAliasDeclaration}
38
36
  export namespace Json {
39
37
  ${astNamedUnionType.jsonSchemaFunctionDeclaration}
@@ -1,15 +1,15 @@
1
- import type { Maybe } from "purify-ts";
1
+ import { Maybe } from "purify-ts";
2
2
  import type { Logger } from "ts-log";
3
- import type { NamedObjectType } from "../NamedObjectType.js";
3
+ import type { ObjectType } from "../ObjectType.js";
4
4
  import type { Reusables } from "../Reusables.js";
5
5
  import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
6
6
  import type { TsGenerator } from "../TsGenerator.js";
7
7
  import type { Type } from "../Type.js";
8
8
  import { type Code } from "../ts-poet-wrapper.js";
9
- export declare abstract class AbstractProperty<TypeT extends Pick<Type, "filterFunction" | "mutable" | "name" | "schema">> {
9
+ export declare abstract class AbstractProperty<TypeT extends Pick<Type, "expression" | "filterFunction" | "mutable" | "schema">> {
10
10
  protected readonly configuration: TsGenerator.Configuration;
11
11
  protected readonly logger: Logger;
12
- protected readonly namedObjectType: NamedObjectType;
12
+ protected readonly objectType: ObjectType;
13
13
  protected readonly reusables: Reusables;
14
14
  /**
15
15
  * Optional parameter to include in the parameters object of constructor function.
@@ -50,7 +50,7 @@ export declare abstract class AbstractProperty<TypeT extends Pick<Type, "filterF
50
50
  */
51
51
  abstract readonly jsonSignature: Maybe<Code>;
52
52
  /**
53
- * Property type discriminant e.g., "ShaclProperty".
53
+ * Property type discriminant e.g., "Shacl".
54
54
  */
55
55
  abstract readonly kind: string;
56
56
  /**
@@ -62,29 +62,29 @@ export declare abstract class AbstractProperty<TypeT extends Pick<Type, "filterF
62
62
  */
63
63
  readonly name: string;
64
64
  /**
65
- * Is the property's type the NamedObjectType or does its type indirectly reference the NamedObjectType?
65
+ * Is the property's type the ObjectType or does its type indirectly reference the ObjectType?
66
66
  */
67
67
  abstract readonly recursive: boolean;
68
68
  /**
69
69
  * Property type
70
70
  . */
71
71
  readonly type: TypeT;
72
- constructor({ configuration, logger, name, namedObjectType, reusables, type, }: {
72
+ constructor({ configuration, logger, name, objectType, reusables, type, }: {
73
73
  configuration: TsGenerator.Configuration;
74
74
  logger: Logger;
75
75
  name: string;
76
- namedObjectType: NamedObjectType;
76
+ objectType: ObjectType;
77
77
  reusables: Reusables;
78
78
  type: TypeT;
79
79
  });
80
80
  /**
81
81
  * TypeScript object describing this type, for runtime use.
82
82
  */
83
- get schema(): Code;
84
- protected get schemaObject(): {
85
- kind: Code;
86
- type: Code;
87
- };
83
+ get schema(): Maybe<Code>;
84
+ /**
85
+ * Helper to compose the result of schema along the type hierarchy.
86
+ */
87
+ protected get schemaInitializers(): readonly Code[];
88
88
  /**
89
89
  * Expression to access the value of this property on an object instance. May evaluate a thunk.
90
90
  */
@@ -4,15 +4,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
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
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { invariant } from "ts-invariant";
7
+ import { Maybe } from "purify-ts";
8
8
  import { Memoize } from "typescript-memoize";
9
9
  import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
10
- import { removeUndefined } from "../removeUndefined.js";
11
- import { code, literalOf } from "../ts-poet-wrapper.js";
10
+ import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
12
11
  export class AbstractProperty {
13
12
  configuration;
14
13
  logger;
15
- namedObjectType;
14
+ objectType;
16
15
  reusables;
17
16
  /**
18
17
  * TypeScript identifier-safe name of the property.
@@ -22,11 +21,11 @@ export class AbstractProperty {
22
21
  * Property type
23
22
  . */
24
23
  type;
25
- constructor({ configuration, logger, name, namedObjectType, reusables, type, }) {
24
+ constructor({ configuration, logger, name, objectType, reusables, type, }) {
26
25
  this.configuration = configuration;
27
26
  this.logger = logger;
28
27
  this.name = name;
29
- this.namedObjectType = namedObjectType;
28
+ this.objectType = objectType;
30
29
  this.reusables = reusables;
31
30
  this.type = type;
32
31
  this.rdfjsTermExpression = rdfjsTermExpression.bind({
@@ -39,15 +38,13 @@ export class AbstractProperty {
39
38
  * TypeScript object describing this type, for runtime use.
40
39
  */
41
40
  get schema() {
42
- return code `${removeUndefined(this.schemaObject)}`;
41
+ return Maybe.of(code `{ ${joinCode(this.schemaInitializers.concat(), { on: ", " })} }`);
43
42
  }
44
- get schemaObject() {
45
- invariant(this.kind.endsWith("Property"));
46
- return {
47
- kind: code `${literalOf(this.kind.substring(0, this.kind.length - "Property".length))} as const`,
48
- // name: literalOf(this.name),
49
- type: code `() => (${this.type.schema})`,
50
- };
43
+ /**
44
+ * Helper to compose the result of schema along the type hierarchy.
45
+ */
46
+ get schemaInitializers() {
47
+ return [code `kind: ${literalOf(this.kind)}`];
51
48
  }
52
49
  /**
53
50
  * Expression to access the value of this property on an object instance. May evaluate a thunk.
@@ -5,7 +5,7 @@ export declare class DiscriminantProperty extends AbstractProperty<DiscriminantP
5
5
  readonly constructorParameter: Maybe<Code>;
6
6
  readonly filterProperty: AbstractProperty<DiscriminantProperty.Type>["filterProperty"];
7
7
  readonly graphqlField: AbstractProperty<DiscriminantProperty.Type>["graphqlField"];
8
- readonly kind = "DiscriminantProperty";
8
+ readonly kind = "Discriminant";
9
9
  readonly mutable = false;
10
10
  readonly recursive = false;
11
11
  constructor({ type, ...superParameters }: {
@@ -15,6 +15,7 @@ export declare class DiscriminantProperty extends AbstractProperty<DiscriminantP
15
15
  get jsonName(): string;
16
16
  get jsonSchema(): AbstractProperty<DiscriminantProperty.Type>["jsonSchema"];
17
17
  get jsonSignature(): Maybe<Code>;
18
+ get schema(): Maybe<Code>;
18
19
  private get constValue();
19
20
  constructorInitializer(): Maybe<Code>;
20
21
  fromJsonInitializer(): Maybe<Code>;
@@ -38,7 +39,7 @@ export declare namespace DiscriminantProperty {
38
39
  mutable: boolean;
39
40
  ownValues: readonly string[];
40
41
  });
41
- get name(): string;
42
+ get expression(): Code;
42
43
  get schema(): Code;
43
44
  get values(): string[];
44
45
  }
@@ -6,21 +6,20 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { Maybe } from "purify-ts";
8
8
  import { Memoize } from "typescript-memoize";
9
- import { removeUndefined } from "../removeUndefined.js";
10
9
  import { arrayOf, code, literalOf } from "../ts-poet-wrapper.js";
11
10
  import { AbstractProperty } from "./AbstractProperty.js";
12
11
  export class DiscriminantProperty extends AbstractProperty {
13
12
  constructorParameter = Maybe.empty();
14
13
  filterProperty = Maybe.empty();
15
14
  graphqlField = Maybe.empty();
16
- kind = "DiscriminantProperty";
15
+ kind = "Discriminant";
17
16
  mutable = false;
18
17
  recursive = false;
19
18
  constructor({ type, ...superParameters }) {
20
19
  super({ ...superParameters, type });
21
20
  }
22
21
  get declaration() {
23
- return code `readonly ${this.name}: ${this.type.name};`;
22
+ return code `readonly ${this.name}: ${this.type.expression};`;
24
23
  }
25
24
  get jsonName() {
26
25
  return "@type";
@@ -34,10 +33,16 @@ export class DiscriminantProperty extends AbstractProperty {
34
33
  });
35
34
  }
36
35
  get jsonSignature() {
37
- return Maybe.of(code `readonly "${this.jsonName}": ${this.type.name}`);
36
+ return Maybe.of(code `readonly "${this.jsonName}": ${this.type.expression}`);
38
37
  }
38
+ get schema() {
39
+ return Maybe.empty();
40
+ }
41
+ // protected override get schemaInitializers(): readonly Code[] {
42
+ // return super.schemaInitializers.concat(code`type: ${this.type.schema}`);
43
+ // }
39
44
  get constValue() {
40
- return code `${literalOf(this.namedObjectType.discriminantValue)} as const`;
45
+ return code `${literalOf(this.objectType.discriminantValue)} as const`;
41
46
  }
42
47
  constructorInitializer() {
43
48
  return Maybe.empty();
@@ -49,13 +54,13 @@ export class DiscriminantProperty extends AbstractProperty {
49
54
  return Maybe.empty();
50
55
  }
51
56
  hashStatements({ variables, }) {
52
- if (this.namedObjectType.parentObjectTypes.length > 0) {
57
+ if (this.objectType.parentObjectTypes.length > 0) {
53
58
  return [];
54
59
  }
55
60
  return [code `${variables.hasher}.update(${variables.value});`];
56
61
  }
57
62
  jsonUiSchemaElement({ variables, }) {
58
- if (this.namedObjectType.parentObjectTypes.length > 0) {
63
+ if (this.objectType.parentObjectTypes.length > 0) {
59
64
  return Maybe.empty();
60
65
  }
61
66
  const scope = code `\`\${${variables.scopePrefix}}/properties/${this.jsonName}\``;
@@ -97,15 +102,19 @@ __decorate([
97
102
  this.mutable = mutable;
98
103
  this.ownValues = ownValues;
99
104
  }
100
- get name() {
101
- return `${this.values.map((name) => `"${name}"`).join(" | ")}`;
105
+ get expression() {
106
+ return code `${this.values.map((name) => `"${name}"`).join(" | ")}`;
102
107
  }
103
108
  get schema() {
104
- return code `${removeUndefined({
105
- descendantValues: this.descendantValues.length > 0 ? this.descendantValues : undefined,
106
- kind: code `${literalOf("TypeDiscriminant")} as const`,
107
- ownValues: this.ownValues.length > 0 ? this.ownValues : undefined,
108
- })}`;
109
+ throw new Error("should never be called");
110
+ // const initializers: Record<string, unknown> = {};
111
+ // if (this.descendantValues.length > 0) {
112
+ // initializers["descendantValues"] = this.descendantValues;
113
+ // }
114
+ // if (this.ownValues.length > 0) {
115
+ // initializers["ownValues"] = this.ownValues;
116
+ // }
117
+ // return code`${initializers}`;
109
118
  }
110
119
  get values() {
111
120
  return this.ownValues.concat(this.descendantValues);
@@ -113,7 +122,7 @@ __decorate([
113
122
  }
114
123
  __decorate([
115
124
  Memoize()
116
- ], Type.prototype, "name", null);
125
+ ], Type.prototype, "expression", null);
117
126
  __decorate([
118
127
  Memoize()
119
128
  ], Type.prototype, "schema", null);
@@ -5,14 +5,9 @@ import type { IriType } from "../IriType.js";
5
5
  import { type Code } from "../ts-poet-wrapper.js";
6
6
  import { AbstractProperty } from "./AbstractProperty.js";
7
7
  export declare class IdentifierProperty extends AbstractProperty<BlankNodeType | IdentifierType | IriType> {
8
- private readonly typeAlias;
9
- readonly kind = "IdentifierProperty";
8
+ readonly kind = "Identifier";
10
9
  readonly mutable = false;
11
10
  readonly recursive = false;
12
- constructor({ typeAlias, ...superParameters }: {
13
- type: BlankNodeType | IdentifierType | IriType;
14
- typeAlias: Code;
15
- } & ConstructorParameters<typeof AbstractProperty>[0]);
16
11
  get constructorParameter(): Maybe<Code>;
17
12
  get declaration(): Code;
18
13
  get filterProperty(): Maybe<{
@@ -22,6 +17,8 @@ export declare class IdentifierProperty extends AbstractProperty<BlankNodeType |
22
17
  get graphqlField(): AbstractProperty<IdentifierType>["graphqlField"];
23
18
  get jsonSchema(): AbstractProperty<IdentifierType>["jsonSchema"];
24
19
  get jsonSignature(): Maybe<Code>;
20
+ protected get schemaInitializers(): readonly Code[];
21
+ private get typeExpression();
25
22
  accessExpression({ variables, }: Parameters<AbstractProperty<BlankNodeType | IdentifierType | IriType>["accessExpression"]>[0]): Code;
26
23
  constructorInitializer({ variables, }: Parameters<AbstractProperty<IdentifierType>["constructorInitializer"]>[0]): Maybe<Code>;
27
24
  fromJsonInitializer({ variables, }: Parameters<AbstractProperty<IdentifierType>["fromJsonInitializer"]>[0]): Maybe<Code>;
@@ -12,30 +12,25 @@ import { Memoize } from "typescript-memoize";
12
12
  import { arrayOf, code, joinCode, literalOf, } from "../ts-poet-wrapper.js";
13
13
  import { AbstractProperty } from "./AbstractProperty.js";
14
14
  export class IdentifierProperty extends AbstractProperty {
15
- typeAlias;
16
- kind = "IdentifierProperty";
15
+ kind = "Identifier";
17
16
  mutable = false;
18
17
  recursive = false;
19
- constructor({ typeAlias, ...superParameters }) {
20
- super(superParameters);
21
- this.typeAlias = typeAlias;
22
- }
23
18
  get constructorParameter() {
24
19
  let hasQuestionToken = false;
25
- const typeNames = [code `(() => ${this.typeAlias})`];
20
+ const typeNames = [code `(() => ${this.typeExpression})`];
26
21
  for (const type of this.type.conversionFunction.unsafeCoerce()
27
22
  .sourceTypes) {
28
23
  if (type.typeof === "undefined") {
29
24
  hasQuestionToken = true;
30
25
  }
31
26
  else {
32
- typeNames.push(code `${type.name}`);
27
+ typeNames.push(code `${type.expression}`);
33
28
  }
34
29
  }
35
30
  return Maybe.of(code `readonly ${this.name}${hasQuestionToken ? "?" : ""}: ${joinCode(typeNames, { on: "|" })};`);
36
31
  }
37
32
  get declaration() {
38
- return code `readonly ${this.name}: () => ${this.typeAlias};`;
33
+ return code `readonly ${this.name}: () => ${this.typeExpression};`;
39
34
  }
40
35
  get filterProperty() {
41
36
  return Maybe.of({
@@ -50,13 +45,13 @@ export class IdentifierProperty extends AbstractProperty {
50
45
  args: Maybe.empty(),
51
46
  description: Maybe.empty(),
52
47
  name: `_${this.name.substring(syntheticNamePrefix.length)}`,
53
- resolve: code `(source) => ${this.typeAlias}.stringify(${this.accessExpression({ variables: { object: code `source` } })})`,
48
+ resolve: code `(source) => ${this.typeExpression}.stringify(${this.accessExpression({ variables: { object: code `source` } })})`,
54
49
  type: this.type.graphqlType.name,
55
50
  });
56
51
  }
57
52
  get jsonSchema() {
58
53
  let schema;
59
- if (this.type.in_.length > 0 && this.type.kind === "IriType") {
54
+ if (this.type.in_.length > 0 && this.type.kind === "Iri") {
60
55
  // Treat sh:in as a union of the IRIs
61
56
  // rdfjs.NamedNode<"http://example.com/1" | "http://example.com/2">
62
57
  schema = code `${this.reusables.imports.z}.enum(${arrayOf(...this.type.in_.map((iri) => iri.value))})`;
@@ -75,6 +70,14 @@ export class IdentifierProperty extends AbstractProperty {
75
70
  }
76
71
  return Maybe.of(code `readonly "@id": string`);
77
72
  }
73
+ get schemaInitializers() {
74
+ return super.schemaInitializers.concat(code `type: ${this.type.schema}`);
75
+ }
76
+ get typeExpression() {
77
+ return this.objectType.alias
78
+ .map((objectTypeAlias) => code `${objectTypeAlias}.Identifier`)
79
+ .orDefault(this.type.expression);
80
+ }
78
81
  accessExpression({ variables, }) {
79
82
  return code `${variables.object}.${this.name}()`;
80
83
  }
@@ -128,7 +131,9 @@ export class IdentifierProperty extends AbstractProperty {
128
131
  ignoreRdfType: true, // Unused
129
132
  preferredLanguages: variables.preferredLanguages,
130
133
  propertyPatterns: code `[]`,
131
- schema: code `${this.namedObjectType.name}.schema.properties.${this.name}.type()`,
134
+ schema: this.objectType.alias
135
+ .map((objectTypeAlias) => code `${objectTypeAlias}.schema.properties.${this.name}.type`)
136
+ .orDefault(this.type.schema),
132
137
  valueVariable: variables.focusIdentifier,
133
138
  variablePrefix: variables.variablePrefix, // Unused
134
139
  }})`,
@@ -177,4 +182,7 @@ __decorate([
177
182
  __decorate([
178
183
  Memoize()
179
184
  ], IdentifierProperty.prototype, "jsonSignature", null);
185
+ __decorate([
186
+ Memoize()
187
+ ], IdentifierProperty.prototype, "typeExpression", null);
180
188
  //# sourceMappingURL=IdentifierProperty.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_createFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_createFunctionDeclaration.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { invariant } from "ts-invariant";
3
3
  import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
4
- export function NamedObjectType_createFunctionDeclaration() {
4
+ export function ObjectType_createFunctionDeclaration() {
5
5
  if (!this.configuration.features.has("Object.create")) {
6
6
  return Maybe.empty();
7
7
  }
@@ -11,7 +11,7 @@ export function NamedObjectType_createFunctionDeclaration() {
11
11
  parametersType.push(code `{ ${joinCode(parametersPropertySignatures)} }`);
12
12
  }
13
13
  for (const parentObjectType of this.parentObjectTypes) {
14
- parametersType.push(code `Parameters<typeof ${parentObjectType.name}.create>[0]`);
14
+ parametersType.push(code `Parameters<typeof ${parentObjectType.alias.unsafeCoerce()}.create>[0]`);
15
15
  }
16
16
  if (parametersType.length === 0) {
17
17
  parametersType.push(code `object`);
@@ -23,7 +23,7 @@ export function NamedObjectType_createFunctionDeclaration() {
23
23
  const chains = [];
24
24
  this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
25
25
  chains.push({
26
- expression: code `${parentObjectType.name}.create(parameters)`,
26
+ expression: code `${parentObjectType.alias.unsafeCoerce()}.create(parameters)`,
27
27
  variable: `super${parentObjectTypeI}`,
28
28
  });
29
29
  });
@@ -54,12 +54,12 @@ export function NamedObjectType_createFunctionDeclaration() {
54
54
  .toReversed()
55
55
  .reduce((acc, { expression, variable }, chainI) => code `(${expression}).${chainI === 0 ? "map" : "chain"}(${variable} => ${acc})`, returnExpression);
56
56
  return Maybe.of(code `\
57
- export function create(${parametersSignature}): ${this.reusables.imports.Either}<Error, ${this.name}> {
57
+ export function create(${parametersSignature}): ${this.reusables.imports.Either}<Error, ${this.expression}> {
58
58
  return ${returnExpression};
59
59
  }
60
60
 
61
- export function createUnsafe(${parametersSignature}): ${this.name} {
61
+ export function createUnsafe(${parametersSignature}): ${this.expression} {
62
62
  return create(parameters).unsafeCoerce();
63
63
  }`);
64
64
  }
65
- //# sourceMappingURL=NamedObjectType_createFunctionDeclaration.js.map
65
+ //# sourceMappingURL=ObjectType_createFunctionDeclaration.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_equalsFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_equalsFunctionDeclaration.d.ts.map
@@ -1,23 +1,23 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_equalsFunctionDeclaration() {
3
+ export function ObjectType_equalsFunctionDeclaration() {
4
4
  if (!this.configuration.features.has("Object.equals")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  const chain = [];
8
8
  // For every parent, find the nearest equals implementation
9
9
  for (const parentObjectType of this.parentObjectTypes) {
10
- chain.push(code `${parentObjectType.name}.equals(left, right)`);
10
+ chain.push(code `${parentObjectType.equalsFunction}(left, right)`);
11
11
  }
12
12
  for (const property of this.properties) {
13
- if (property.kind === "DiscriminantProperty") {
13
+ if (property.kind === "Discriminant") {
14
14
  continue;
15
15
  }
16
16
  chain.push(code `(${property.type.equalsFunction})(${property.accessExpression({ variables: { object: code `left` } })}, ${property.accessExpression({ variables: { object: code `right` } })}).mapLeft(propertyValuesUnequal => ({ left, right, propertyName: "${property.name}", propertyValuesUnequal, type: "property" as const }))`);
17
17
  }
18
18
  return Maybe.of(code `\
19
- export function equals(left: ${this.name}, right: ${this.name}): ${this.reusables.snippets.EqualsResult} {
19
+ export function equals(left: ${this.expression}, right: ${this.expression}): ${this.reusables.snippets.EqualsResult} {
20
20
  return ${joinCode(chain.map((chainPart, chainPartI) => chainPartI === 0 ? chainPart : code `chain(() => ${chainPart})`), { on: "." })}
21
21
  }`);
22
22
  }
23
- //# sourceMappingURL=NamedObjectType_equalsFunctionDeclaration.js.map
23
+ //# sourceMappingURL=ObjectType_equalsFunctionDeclaration.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_filterFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_filterFunctionDeclaration.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_filterFunctionDeclaration() {
3
+ export function ObjectType_filterFunctionDeclaration() {
4
4
  if (!this.configuration.features.has("Object.filter")) {
5
5
  return Maybe.empty();
6
6
  }
@@ -17,8 +17,8 @@ export function NamedObjectType_filterFunctionDeclaration() {
17
17
  }
18
18
  statements.push(code `return true;`);
19
19
  return Maybe.of(code `\
20
- export function filter(filter: ${this.filterType}, value: ${this.name}): boolean {
20
+ export function filter(filter: ${this.filterType}, value: ${this.expression}): boolean {
21
21
  ${joinCode(statements)}
22
22
  }`);
23
23
  }
24
- //# sourceMappingURL=NamedObjectType_filterFunctionDeclaration.js.map
24
+ //# sourceMappingURL=ObjectType_filterFunctionDeclaration.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_filterTypeDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_filterTypeDeclaration.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_filterTypeDeclaration() {
3
+ export function ObjectType_filterTypeDeclaration() {
4
4
  if (!this.configuration.features.has("Object.filter")) {
5
5
  return Maybe.empty();
6
6
  }
@@ -17,9 +17,9 @@ export function NamedObjectType_filterTypeDeclaration() {
17
17
  }
18
18
  }
19
19
  for (const parentObjectType of this.parentObjectTypes) {
20
- members.push(code `${parentObjectType.name}.Filter`);
20
+ members.push(code `${parentObjectType.alias.unsafeCoerce()}.Filter`);
21
21
  }
22
22
  return Maybe.of(code `\
23
23
  export type Filter = ${members.length > 0 ? joinCode(members, { on: " & " }) : "object"};`);
24
24
  }
25
- //# sourceMappingURL=NamedObjectType_filterTypeDeclaration.js.map
25
+ //# sourceMappingURL=ObjectType_filterTypeDeclaration.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_focusSparqlConstructTriplesFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts.map
@@ -6,7 +6,7 @@ const variables = {
6
6
  focusIdentifier: code `parameters.focusIdentifier`,
7
7
  variablePrefix: code `parameters.variablePrefix`,
8
8
  };
9
- export function NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration() {
9
+ export function ObjectType_focusSparqlConstructTriplesFunctionDeclaration() {
10
10
  if (!this.configuration.features.has("Object.SPARQL")) {
11
11
  return Maybe.empty();
12
12
  }
@@ -15,7 +15,7 @@ export function NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration()
15
15
  let triplesVariableDeclarationKeyword = "const";
16
16
  const statements = [];
17
17
  for (const parentObjectType of this.parentObjectTypes) {
18
- statements.push(code `triples = triples.concat(${parentObjectType.name}.focusSparqlConstructTriples(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, variablePrefix: variables.variablePrefix }}));`);
18
+ statements.push(code `triples = triples.concat(${parentObjectType.alias.unsafeCoerce()}.focusSparqlConstructTriples(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, variablePrefix: variables.variablePrefix }}));`);
19
19
  triplesVariableDeclarationKeyword = "let";
20
20
  }
21
21
  if (this.fromRdfType.isJust()) {
@@ -51,4 +51,4 @@ ${statements.length > 0
51
51
  : "return [];"}
52
52
  };`);
53
53
  }
54
- //# sourceMappingURL=NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js.map
54
+ //# sourceMappingURL=ObjectType_focusSparqlConstructTriplesFunctionDeclaration.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_focusSparqlWherePatternsFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts.map
@@ -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
  }
@@ -17,7 +17,7 @@ export function NamedObjectType_focusSparqlWherePatternsFunctionDeclaration() {
17
17
  const statements = [];
18
18
  for (const parentObjectType of this.parentObjectTypes) {
19
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 }}));`);
20
+ patterns = patterns.concat(${parentObjectType.alias.unsafeCoerce()}.focusSparqlWherePatterns(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, preferredLanguages: variables.preferredLanguages, variablePrefix: variables.variablePrefix }}));`);
21
21
  patternsVariableDeclarationKeyword = "let";
22
22
  }
23
23
  if (this.fromRdfType.isJust()) {
@@ -99,4 +99,4 @@ ${statements.length > 0
99
99
  : "return [];"}
100
100
  };`);
101
101
  }
102
- //# sourceMappingURL=NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js.map
102
+ //# 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
@@ -1,6 +1,6 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
- export function NamedObjectType_fromJsonFunctionDeclaration() {
3
+ export function ObjectType_fromJsonFunctionDeclaration() {
4
4
  if (!this.configuration.features.has("Object.fromJson")) {
5
5
  return Maybe.empty();
6
6
  }
@@ -10,7 +10,7 @@ export function NamedObjectType_fromJsonFunctionDeclaration() {
10
10
  const chains = [];
11
11
  this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
12
12
  chains.push({
13
- expression: code `${parentObjectType.name}.fromJson(${variables.jsonObject})`,
13
+ expression: code `${parentObjectType.alias.unsafeCoerce()}.fromJson(${variables.jsonObject})`,
14
14
  variable: `super${parentObjectTypeI}`,
15
15
  });
16
16
  });
@@ -36,8 +36,8 @@ export function NamedObjectType_fromJsonFunctionDeclaration() {
36
36
  break;
37
37
  }
38
38
  return Maybe.of(code `\
39
- export function fromJson(${variables.jsonObject}: ${this.jsonType().name}): ${this.reusables.imports.Either}<Error, ${this.name}> {
39
+ export function fromJson(${variables.jsonObject}: ${this.jsonType().name}): ${this.reusables.imports.Either}<Error, ${this.expression}> {
40
40
  return ${returnExpression};
41
41
  }`);
42
42
  }
43
- //# sourceMappingURL=NamedObjectType_fromJsonFunctionDeclaration.js.map
43
+ //# 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