@shaclmate/compiler 4.0.7 → 4.0.9

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 (306) hide show
  1. package/dist/Compiler.d.ts +1 -4
  2. package/dist/Compiler.js +1 -5
  3. package/dist/ShapesGraphToAstTransformer.d.ts +2 -11
  4. package/dist/ShapesGraphToAstTransformer.js +25 -27
  5. package/dist/_ShapesGraphToAstTransformer/defaultNodeShapeNodeKinds.d.ts +3 -0
  6. package/dist/_ShapesGraphToAstTransformer/defaultNodeShapeNodeKinds.js +5 -0
  7. package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.d.ts +4 -0
  8. package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.js +27 -0
  9. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +74 -19
  10. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.d.ts +1 -1
  11. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +45 -91
  12. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.d.ts +11 -0
  13. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +146 -0
  14. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.d.ts +7 -0
  15. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +182 -0
  16. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +9 -7
  17. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.d.ts +3 -5
  18. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +33 -10
  19. package/dist/ast/AbstractCompoundType.d.ts +26 -8
  20. package/dist/ast/AbstractCompoundType.js +84 -16
  21. package/dist/ast/AbstractContainerType.d.ts +2 -4
  22. package/dist/ast/AbstractContainerType.js +3 -4
  23. package/dist/ast/AbstractLazyObjectType.d.ts +1 -0
  24. package/dist/ast/AbstractLazyObjectType.js +3 -0
  25. package/dist/ast/AbstractTermType.d.ts +1 -0
  26. package/dist/ast/AbstractTermType.js +1 -0
  27. package/dist/ast/AbstractType.d.ts +16 -1
  28. package/dist/ast/AbstractType.js +11 -1
  29. package/dist/ast/Ast.d.ts +4 -4
  30. package/dist/ast/BlankNodeType.d.ts +1 -1
  31. package/dist/ast/DefaultValueType.d.ts +1 -2
  32. package/dist/ast/DefaultValueType.js +2 -0
  33. package/dist/ast/IdentifierType.d.ts +1 -1
  34. package/dist/ast/IntersectionType.d.ts +7 -2
  35. package/dist/ast/IntersectionType.js +8 -0
  36. package/dist/ast/ListType.d.ts +2 -9
  37. package/dist/ast/ListType.js +1 -9
  38. package/dist/ast/LiteralType.d.ts +1 -0
  39. package/dist/ast/LiteralType.js +26 -0
  40. package/dist/ast/ObjectCompoundType.d.ts +12 -0
  41. package/dist/ast/ObjectCompoundType.js +88 -0
  42. package/dist/ast/ObjectIntersectionType.d.ts +3 -7
  43. package/dist/ast/ObjectIntersectionType.js +1 -7
  44. package/dist/ast/ObjectType.d.ts +14 -31
  45. package/dist/ast/ObjectType.js +41 -73
  46. package/dist/ast/ObjectUnionType.d.ts +3 -7
  47. package/dist/ast/ObjectUnionType.js +1 -7
  48. package/dist/ast/OptionType.d.ts +1 -2
  49. package/dist/ast/OptionType.js +2 -0
  50. package/dist/ast/SetType.d.ts +1 -2
  51. package/dist/ast/SetType.js +2 -0
  52. package/dist/ast/Type.d.ts +1 -4
  53. package/dist/ast/Type.js +0 -6
  54. package/dist/ast/UnionType.d.ts +11 -6
  55. package/dist/ast/UnionType.js +6 -4
  56. package/dist/ast/index.d.ts +1 -2
  57. package/dist/ast/index.js +1 -2
  58. package/dist/generators/json/AstJsonGenerator.js +16 -14
  59. package/dist/generators/ts/AbstractCollectionType.js +8 -10
  60. package/dist/generators/ts/AbstractContainerType.d.ts +8 -3
  61. package/dist/generators/ts/AbstractContainerType.js +9 -2
  62. package/dist/generators/ts/AbstractDateType.d.ts +2 -2
  63. package/dist/generators/ts/AbstractDateType.js +2 -2
  64. package/dist/generators/ts/AbstractIdentifierType.d.ts +1 -1
  65. package/dist/generators/ts/AbstractIdentifierType.js +1 -1
  66. package/dist/generators/ts/AbstractLazyObjectType.d.ts +11 -8
  67. package/dist/generators/ts/AbstractLazyObjectType.js +19 -14
  68. package/dist/generators/ts/AbstractNamedUnionType.d.ts +33 -0
  69. package/dist/generators/ts/AbstractNamedUnionType.js +193 -0
  70. package/dist/generators/ts/AbstractNumericType.d.ts +2 -2
  71. package/dist/generators/ts/AbstractNumericType.js +3 -3
  72. package/dist/generators/ts/AbstractTermType.d.ts +7 -4
  73. package/dist/generators/ts/AbstractTermType.js +7 -4
  74. package/dist/generators/ts/AbstractType.d.ts +29 -14
  75. package/dist/generators/ts/AbstractUnionType.d.ts +80 -0
  76. package/dist/generators/ts/AbstractUnionType.js +514 -0
  77. package/dist/generators/ts/AnonymousUnionType.d.ts +26 -0
  78. package/dist/generators/ts/AnonymousUnionType.js +56 -0
  79. package/dist/generators/ts/BigDecimalType.d.ts +3 -3
  80. package/dist/generators/ts/BigDecimalType.js +3 -3
  81. package/dist/generators/ts/BlankNodeType.d.ts +1 -1
  82. package/dist/generators/ts/BlankNodeType.js +1 -1
  83. package/dist/generators/ts/BooleanType.d.ts +2 -2
  84. package/dist/generators/ts/BooleanType.js +2 -2
  85. package/dist/generators/ts/DefaultValueType.d.ts +4 -4
  86. package/dist/generators/ts/DefaultValueType.js +14 -13
  87. package/dist/generators/ts/IdentifierType.d.ts +1 -1
  88. package/dist/generators/ts/IdentifierType.js +1 -1
  89. package/dist/generators/ts/IriType.d.ts +1 -1
  90. package/dist/generators/ts/IriType.js +1 -1
  91. package/dist/generators/ts/LazyObjectOptionType.d.ts +1 -1
  92. package/dist/generators/ts/LazyObjectOptionType.js +9 -9
  93. package/dist/generators/ts/LazyObjectSetType.d.ts +1 -1
  94. package/dist/generators/ts/LazyObjectSetType.js +7 -7
  95. package/dist/generators/ts/LazyObjectType.d.ts +1 -1
  96. package/dist/generators/ts/LazyObjectType.js +7 -8
  97. package/dist/generators/ts/ListType.d.ts +8 -7
  98. package/dist/generators/ts/ListType.js +14 -13
  99. package/dist/generators/ts/LiteralType.d.ts +1 -1
  100. package/dist/generators/ts/LiteralType.js +2 -2
  101. package/dist/generators/ts/NamedObjectUnionType.d.ts +35 -0
  102. package/dist/generators/ts/NamedObjectUnionType.js +221 -0
  103. package/dist/generators/ts/NamedUnionType.d.ts +11 -0
  104. package/dist/generators/ts/NamedUnionType.js +13 -0
  105. package/dist/generators/ts/ObjectType.d.ts +34 -25
  106. package/dist/generators/ts/ObjectType.js +62 -52
  107. package/dist/generators/ts/OptionType.d.ts +4 -4
  108. package/dist/generators/ts/OptionType.js +10 -10
  109. package/dist/generators/ts/SetType.d.ts +4 -4
  110. package/dist/generators/ts/SetType.js +13 -11
  111. package/dist/generators/ts/StringType.d.ts +2 -2
  112. package/dist/generators/ts/StringType.js +2 -2
  113. package/dist/generators/ts/TermType.d.ts +1 -1
  114. package/dist/generators/ts/TermType.js +2 -2
  115. package/dist/generators/ts/TsGenerator.js +23 -15
  116. package/dist/generators/ts/Type.d.ts +4 -3
  117. package/dist/generators/ts/TypeFactory.d.ts +7 -5
  118. package/dist/generators/ts/TypeFactory.js +117 -90
  119. package/dist/generators/ts/ZodGenerator.js +6 -6
  120. package/dist/generators/ts/_ObjectType/AbstractProperty.d.ts +3 -3
  121. package/dist/generators/ts/_ObjectType/{TypeDiscriminantProperty.d.ts → DiscriminantProperty.d.ts} +14 -14
  122. package/dist/generators/ts/_ObjectType/{TypeDiscriminantProperty.js → DiscriminantProperty.js} +10 -10
  123. package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.d.ts +2 -2
  124. package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.js +2 -2
  125. package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +2 -2
  126. package/dist/generators/ts/_ObjectType/IdentifierProperty.js +7 -4
  127. package/dist/generators/ts/_ObjectType/ObjectType_classDeclaration.js +8 -8
  128. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
  129. package/dist/generators/ts/_ObjectType/{ObjectType_sparqlConstructTriplesFunctionDeclaration.js → ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js} +6 -5
  130. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
  131. package/dist/generators/ts/_ObjectType/{ObjectType_sparqlWherePatternsFunctionDeclarations.js → ObjectType_focusSparqlWherePatternsFunctionDeclaration.js} +5 -5
  132. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.d.ts +5 -0
  133. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.js +20 -0
  134. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +5 -0
  135. package/dist/generators/ts/_ObjectType/{ObjectType_fromRdfFunctionDeclaration.js → ObjectType_fromRdfResourceFunctionDeclaration.js} +6 -7
  136. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +5 -0
  137. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.js +20 -0
  138. package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.js +2 -2
  139. package/dist/generators/ts/_ObjectType/ObjectType_parseJsonFunctionDeclaration.d.ts +5 -0
  140. package/dist/generators/ts/_ObjectType/ObjectType_parseJsonFunctionDeclaration.js +19 -0
  141. package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromJsonFunctionDeclaration.d.ts +5 -0
  142. package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromJsonFunctionDeclaration.js +38 -0
  143. package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromRdfResourceFunctionDeclaration.d.ts +5 -0
  144. package/dist/generators/ts/_ObjectType/{ObjectType_propertiesFromRdfFunctionDeclaration.js → ObjectType_propertiesFromRdfResourceFunctionDeclaration.js} +16 -15
  145. package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.js +1 -2
  146. package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js +2 -2
  147. package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionOrMethodDeclaration.d.ts +5 -0
  148. package/dist/generators/ts/_ObjectType/{ObjectType_toRdfFunctionOrMethodDeclaration.js → ObjectType_toRdfResourceFunctionOrMethodDeclaration.js} +10 -8
  149. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
  150. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +13 -0
  151. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
  152. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.js +15 -0
  153. package/dist/generators/ts/_ObjectType/Property.d.ts +2 -2
  154. package/dist/generators/ts/_ObjectType/ShaclProperty.d.ts +2 -2
  155. package/dist/generators/ts/_ObjectType/ShaclProperty.js +6 -6
  156. package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.d.ts +2 -0
  157. package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.js +12 -0
  158. package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.d.ts +2 -0
  159. package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.js +14 -0
  160. package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.d.ts +2 -0
  161. package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.js +15 -0
  162. package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.d.ts +2 -0
  163. package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.js +17 -0
  164. package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.d.ts +2 -0
  165. package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.js +15 -0
  166. package/dist/generators/ts/_snippets/snippets_PropertyPath.d.ts +5 -0
  167. package/dist/generators/ts/_snippets/snippets_PropertyPath.js +35 -0
  168. package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +2 -2
  169. package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.d.ts +2 -0
  170. package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.js +7 -0
  171. package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.d.ts +2 -0
  172. package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.js +16 -0
  173. package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.d.ts +2 -0
  174. package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.js +13 -0
  175. package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.d.ts +2 -0
  176. package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.js +16 -0
  177. package/dist/generators/ts/_snippets/snippets_bigDecimalSparqlWherePatterns.js +2 -2
  178. package/dist/generators/ts/_snippets/snippets_blankNodeSparqlWherePatterns.js +2 -2
  179. package/dist/generators/ts/_snippets/snippets_booleanEquals.js +1 -1
  180. package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.js +2 -2
  181. package/dist/generators/ts/_snippets/snippets_dateSparqlWherePatterns.js +2 -2
  182. package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +2 -2
  183. package/dist/generators/ts/_snippets/snippets_fromRdfLanguageIn.js +1 -1
  184. package/dist/generators/ts/_snippets/snippets_identifierSparqlWherePatterns.js +2 -2
  185. package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.js +2 -2
  186. package/dist/generators/ts/_snippets/snippets_listSparqlConstructTriples.js +2 -2
  187. package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.js +2 -2
  188. package/dist/generators/ts/_snippets/snippets_literalSparqlWherePatterns.js +2 -2
  189. package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.js +2 -2
  190. package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.js +2 -2
  191. package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.js +2 -3
  192. package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.js +2 -2
  193. package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.js +2 -2
  194. package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.js +4 -3
  195. package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.js +4 -3
  196. package/dist/generators/ts/_snippets/snippets_sparqlPropertyPath.js +3 -2
  197. package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.js +2 -2
  198. package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.js +2 -2
  199. package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +2 -2
  200. package/dist/generators/ts/graphqlSchemaVariableStatement.js +4 -4
  201. package/dist/generators/ts/imports.d.ts +1 -1
  202. package/dist/generators/ts/imports.js +1 -1
  203. package/dist/generators/ts/objectSetDeclarations.d.ts +3 -3
  204. package/dist/generators/ts/objectSetDeclarations.js +15 -15
  205. package/dist/generators/ts/objectSetInterfaceDeclaration.d.ts +3 -3
  206. package/dist/generators/ts/objectSetInterfaceDeclaration.js +2 -2
  207. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.d.ts +3 -3
  208. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +16 -17
  209. package/dist/generators/ts/snippets.d.ts +10 -6
  210. package/dist/generators/ts/snippets.js +20 -12
  211. package/dist/generators/ts/sparqlObjectSetClassDeclaration.d.ts +3 -3
  212. package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +7 -8
  213. package/dist/generators/ts/synthesizeUberObjectUnionType.d.ts +2 -2
  214. package/dist/generators/ts/synthesizeUberObjectUnionType.js +9 -4
  215. package/dist/input/NodeShape.d.ts +5 -6
  216. package/dist/input/NodeShape.js +19 -22
  217. package/dist/input/Ontology.d.ts +4 -4
  218. package/dist/input/Ontology.js +10 -10
  219. package/dist/input/PropertyShape.d.ts +4 -4
  220. package/dist/input/PropertyShape.js +10 -10
  221. package/dist/input/ShapesGraph.d.ts +3 -2
  222. package/dist/input/ShapesGraph.js +13 -8
  223. package/dist/input/generated.d.ts +2551 -2040
  224. package/dist/input/generated.js +2806 -2346
  225. package/package.json +3 -5
  226. package/dist/_ShapesGraphToAstTransformer/CurieFactory.d.ts +0 -16
  227. package/dist/_ShapesGraphToAstTransformer/CurieFactory.js +0 -45
  228. package/dist/_ShapesGraphToAstTransformer/NodeShapeAstType.d.ts +0 -3
  229. package/dist/_ShapesGraphToAstTransformer/NodeShapeAstType.js +0 -2
  230. package/dist/_ShapesGraphToAstTransformer/index.d.ts +0 -6
  231. package/dist/_ShapesGraphToAstTransformer/index.js +0 -6
  232. package/dist/_ShapesGraphToAstTransformer/shapeIdentifier.d.ts +0 -5
  233. package/dist/_ShapesGraphToAstTransformer/shapeIdentifier.js +0 -9
  234. package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.d.ts +0 -11
  235. package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.js +0 -338
  236. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstAbstractTypeProperties.d.ts +0 -12
  237. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstAbstractTypeProperties.js +0 -31
  238. package/dist/ast/AbstractObjectCompoundType.d.ts +0 -45
  239. package/dist/ast/AbstractObjectCompoundType.js +0 -180
  240. package/dist/ast/Curie.d.ts +0 -21
  241. package/dist/ast/Curie.js +0 -29
  242. package/dist/ast/PlaceholderType.d.ts +0 -15
  243. package/dist/ast/PlaceholderType.js +0 -19
  244. package/dist/generators/codeName.d.ts +0 -6
  245. package/dist/generators/codeName.js +0 -66
  246. package/dist/generators/ts/AbstractDeclaredType.d.ts +0 -23
  247. package/dist/generators/ts/AbstractDeclaredType.js +0 -17
  248. package/dist/generators/ts/ObjectUnionType.d.ts +0 -65
  249. package/dist/generators/ts/ObjectUnionType.js +0 -257
  250. package/dist/generators/ts/UnionType.d.ts +0 -40
  251. package/dist/generators/ts/UnionType.js +0 -527
  252. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclarations.d.ts +0 -4
  253. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclarations.js +0 -66
  254. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfFunctionDeclaration.d.ts +0 -5
  255. package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromRdfFunctionDeclaration.d.ts +0 -5
  256. package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  257. package/dist/generators/ts/_ObjectType/ObjectType_sparqlWherePatternsFunctionDeclarations.d.ts +0 -5
  258. package/dist/generators/ts/_ObjectType/ObjectType_toRdfFunctionOrMethodDeclaration.d.ts +0 -5
  259. package/dist/generators/ts/_ObjectUnionType/MemberType.d.ts +0 -34
  260. package/dist/generators/ts/_ObjectUnionType/MemberType.js +0 -105
  261. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_equalsFunctionDeclaration.d.ts +0 -5
  262. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_equalsFunctionDeclaration.js +0 -29
  263. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterFunctionDeclaration.d.ts +0 -4
  264. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterFunctionDeclaration.js +0 -19
  265. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterTypeDeclaration.d.ts +0 -4
  266. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterTypeDeclaration.js +0 -10
  267. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromJsonFunctionDeclaration.d.ts +0 -5
  268. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromJsonFunctionDeclaration.js +0 -19
  269. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromRdfFunctionDeclarations.d.ts +0 -5
  270. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromRdfFunctionDeclarations.js +0 -20
  271. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_graphqlTypeVariableStatement.d.ts +0 -5
  272. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_graphqlTypeVariableStatement.js +0 -18
  273. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_hashFunctionDeclaration.d.ts +0 -5
  274. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_hashFunctionDeclaration.js +0 -28
  275. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_identifierTypeDeclarations.d.ts +0 -4
  276. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_identifierTypeDeclarations.js +0 -9
  277. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_isTypeFunctionDeclaration.d.ts +0 -5
  278. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_isTypeFunctionDeclaration.js +0 -13
  279. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonTypeAliasDeclaration.d.ts +0 -5
  280. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonTypeAliasDeclaration.js +0 -10
  281. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonZodSchemaFunctionDeclaration.d.ts +0 -5
  282. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonZodSchemaFunctionDeclaration.js +0 -14
  283. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_schemaVariableStatement.d.ts +0 -4
  284. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_schemaVariableStatement.js +0 -37
  285. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  286. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.js +0 -15
  287. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlWherePatternsFunctionDeclaration.d.ts +0 -5
  288. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlWherePatternsFunctionDeclaration.js +0 -35
  289. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toJsonFunctionDeclaration.d.ts +0 -5
  290. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toJsonFunctionDeclaration.js +0 -26
  291. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toRdfFunctionDeclarations.d.ts +0 -5
  292. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toRdfFunctionDeclarations.js +0 -43
  293. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_typeAliasDeclaration.d.ts +0 -4
  294. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_typeAliasDeclaration.js +0 -10
  295. package/dist/generators/ts/_snippets/snippets_FromRdfOptions.d.ts +0 -2
  296. package/dist/generators/ts/_snippets/snippets_FromRdfOptions.js +0 -5
  297. package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfParameters.d.ts +0 -2
  298. package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfParameters.js +0 -5
  299. package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunction.d.ts +0 -2
  300. package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunction.js +0 -6
  301. package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunctionParameters.d.ts +0 -2
  302. package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunctionParameters.js +0 -12
  303. package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunction.d.ts +0 -2
  304. package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunction.js +0 -6
  305. package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunctionParameters.d.ts +0 -2
  306. package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunctionParameters.js +0 -15
@@ -12,12 +12,6 @@ import { AbstractType } from "./AbstractType.js";
12
12
  import { arrayEquals } from "./equals.js";
13
13
  import { Type } from "./Type.js";
14
14
  export class ObjectType extends AbstractType {
15
- /**
16
- * Classes generated from this type are abstract / cannot be instantiated themselves.
17
- *
18
- * Defaults to false.
19
- */
20
- abstract;
21
15
  /**
22
16
  * Ancestor (parents, their parents, ad nauseum) ObjectTypes of this ObjectType.
23
17
  *
@@ -37,11 +31,23 @@ export class ObjectType extends AbstractType {
37
31
  */
38
32
  #descendantObjectTypes = [];
39
33
  /**
40
- * Should generated code derived from this ObjectType be visible outside its module?
34
+ * Immediate parent ObjectTypes of this Object types.
41
35
  *
42
- * Defaults to true.
36
+ * Mutable to support cycle-handling logic in the compiler.
43
37
  */
44
- export;
38
+ #parentObjectTypes = [];
39
+ /**
40
+ * Properties of this ObjectType.
41
+ *
42
+ * Mutable to support cycle-handling logic in the compiler.
43
+ */
44
+ #properties = [];
45
+ /**
46
+ * Classes generated from this type are abstract / cannot be instantiated themselves.
47
+ *
48
+ * Defaults to false.
49
+ */
50
+ abstract;
45
51
  /**
46
52
  * If true, the code for this ObjectType is defined externally and should not be generated.
47
53
  *
@@ -67,26 +73,6 @@ export class ObjectType extends AbstractType {
67
73
  * Type discriminant.
68
74
  */
69
75
  kind = "ObjectType";
70
- /**
71
- * Name of this type, from shaclmate:name.
72
- */
73
- name;
74
- /**
75
- * Immediate parent ObjectTypes of this Object types.
76
- *
77
- * Mutable to support cycle-handling logic in the compiler.
78
- */
79
- #parentObjectTypes = [];
80
- /**
81
- * Properties of this ObjectType.
82
- *
83
- * Mutable to support cycle-handling logic in the compiler.
84
- */
85
- #properties = [];
86
- /**
87
- * Identifier of the shape this ObjectType was derived from.
88
- */
89
- shapeIdentifier;
90
76
  /**
91
77
  * Was this type synthesized or did it come from SHACL?
92
78
  */
@@ -115,22 +101,37 @@ export class ObjectType extends AbstractType {
115
101
  * Whether to generate a TypeScript class or interface for this type.
116
102
  */
117
103
  tsObjectDeclarationType;
118
- constructor({ abstract, export_, extern, fromRdfType, identifierMintingStrategy, identifierType, name, shapeIdentifier, synthetic, toRdfTypes, tsFeatures, tsImports, tsObjectDeclarationType, ...superParameters }) {
104
+ constructor({ abstract, extern, fromRdfType, identifierMintingStrategy, identifierType, synthetic, toRdfTypes, tsFeatures, tsImports, tsObjectDeclarationType, ...superParameters }) {
119
105
  super(superParameters);
120
106
  this.abstract = abstract;
121
- this.export = export_;
122
107
  this.extern = extern;
123
108
  this.fromRdfType = fromRdfType;
124
109
  this.identifierMintingStrategy = identifierMintingStrategy;
125
110
  this.identifierType = identifierType;
126
- this.name = name;
127
- this.shapeIdentifier = shapeIdentifier;
128
111
  this.synthetic = synthetic;
129
112
  this.toRdfTypes = toRdfTypes;
130
113
  this.tsFeatures = tsFeatures;
131
114
  this.tsImports = tsImports;
132
115
  this.tsObjectDeclarationType = tsObjectDeclarationType;
133
116
  }
117
+ get ancestorObjectTypes() {
118
+ return this.#ancestorObjectTypes;
119
+ }
120
+ get childObjectTypes() {
121
+ return this.#childObjectTypes;
122
+ }
123
+ get descendantObjectTypes() {
124
+ return this.#descendantObjectTypes;
125
+ }
126
+ get parentObjectTypes() {
127
+ return this.#parentObjectTypes;
128
+ }
129
+ get properties() {
130
+ return this.#properties;
131
+ }
132
+ get recursive() {
133
+ return this.properties.some((property) => property.recursive);
134
+ }
134
135
  addAncestorObjectTypes(...ancestorObjectTypes) {
135
136
  this.#ancestorObjectTypes.push(...ancestorObjectTypes);
136
137
  }
@@ -149,21 +150,6 @@ export class ObjectType extends AbstractType {
149
150
  invariant(Object.is(property.objectType, this));
150
151
  }
151
152
  }
152
- get ancestorObjectTypes() {
153
- return this.#ancestorObjectTypes;
154
- }
155
- get childObjectTypes() {
156
- return this.#childObjectTypes;
157
- }
158
- get descendantObjectTypes() {
159
- return this.#descendantObjectTypes;
160
- }
161
- get parentObjectTypes() {
162
- return this.#parentObjectTypes;
163
- }
164
- get properties() {
165
- return this.#properties;
166
- }
167
153
  equals(other) {
168
154
  // Don't recurse
169
155
  return this.shapeIdentifier.equals(other.shapeIdentifier);
@@ -202,14 +188,14 @@ export class ObjectType extends AbstractType {
202
188
  * not be mutable.
203
189
  */
204
190
  mutable;
205
- /**
206
- * Object type this property belongs to.
207
- */
208
- objectType;
209
191
  /**
210
192
  * Name of this property, derived from sh:name or shaclmate:name.
211
193
  */
212
194
  name;
195
+ /**
196
+ * Object type this property belongs to.
197
+ */
198
+ objectType;
213
199
  /**
214
200
  * Relative order of this property, derived from sh:order.
215
201
  */
@@ -298,7 +284,6 @@ export class ObjectType extends AbstractType {
298
284
  case "IdentifierType":
299
285
  case "IriType":
300
286
  case "LiteralType":
301
- case "PlaceholderType":
302
287
  case "TermType":
303
288
  return false;
304
289
  case "LazyObjectOptionType":
@@ -339,34 +324,17 @@ export class ObjectType extends AbstractType {
339
324
  if (DEBUG) {
340
325
  process.stderr.write(`recurse into ${currentPropertyType}`);
341
326
  }
342
- for (const memberType of currentPropertyType.memberTypes) {
327
+ for (const member of currentPropertyType.members) {
343
328
  if (helper(stack.concat({
344
329
  objectType,
345
330
  property,
346
- propertyType: propertyType.concat(memberType),
331
+ propertyType: propertyType.concat(member.type),
347
332
  }))) {
348
333
  return true;
349
334
  }
350
335
  }
351
336
  return false;
352
337
  }
353
- case "ObjectIntersectionType":
354
- case "ObjectUnionType": {
355
- if (DEBUG) {
356
- process.stderr.write(`recurse into ${currentPropertyType}`);
357
- }
358
- for (const memberType of currentPropertyType.memberObjectTypes) {
359
- for (const property of memberType.properties) {
360
- if (helper(stack.concat({
361
- objectType: memberType,
362
- property,
363
- }))) {
364
- return true;
365
- }
366
- }
367
- }
368
- return false;
369
- }
370
338
  case "DefaultValueType":
371
339
  case "ListType":
372
340
  case "OptionType":
@@ -381,7 +349,7 @@ export class ObjectType extends AbstractType {
381
349
  return helper([{ objectType: rootObjectType, property: rootProperty }]);
382
350
  }
383
351
  toString() {
384
- return `${this.name.orDefault(Resource.Identifier.toString(this.shapeIdentifier))}(path=${PropertyPath.$toString(this.path)})`;
352
+ return `${this.name}(path=${PropertyPath.toString(this.path)})`;
385
353
  }
386
354
  }
387
355
  __decorate([
@@ -1,8 +1,4 @@
1
- import { AbstractObjectCompoundType } from "./AbstractObjectCompoundType.js";
2
- /**
3
- * A disjunction/union of object types, corresponding to an sh:xone on a node shape.
4
- */
5
- export declare class ObjectUnionType extends AbstractObjectCompoundType<ObjectUnionType> {
6
- readonly kind = "ObjectUnionType";
7
- }
1
+ import type { ObjectType } from "./ObjectType.js";
2
+ import type { UnionType } from "./UnionType.js";
3
+ export type ObjectUnionType = UnionType<UnionType<ObjectType> | ObjectType>;
8
4
  //# sourceMappingURL=ObjectUnionType.d.ts.map
@@ -1,8 +1,2 @@
1
- import { AbstractObjectCompoundType } from "./AbstractObjectCompoundType.js";
2
- /**
3
- * A disjunction/union of object types, corresponding to an sh:xone on a node shape.
4
- */
5
- export class ObjectUnionType extends AbstractObjectCompoundType {
6
- kind = "ObjectUnionType";
7
- }
1
+ export {};
8
2
  //# sourceMappingURL=ObjectUnionType.js.map
@@ -1,5 +1,4 @@
1
1
  import { AbstractContainerType } from "./AbstractContainerType.js";
2
- import type { PlaceholderType } from "./PlaceholderType.js";
3
2
  /**
4
3
  * A type with zero or one values of an item type.
5
4
  */
@@ -8,7 +7,7 @@ export declare class OptionType<ItemTypeT extends OptionType.ItemType = OptionTy
8
7
  constructor({ itemType, }: Pick<ConstructorParameters<typeof AbstractContainerType<ItemTypeT>>[0], "itemType">);
9
8
  }
10
9
  export declare namespace OptionType {
11
- type ItemType = Exclude<AbstractContainerType.ItemType, PlaceholderType>;
10
+ type ItemType = AbstractContainerType.ItemType;
12
11
  const isItemType: typeof AbstractContainerType.isItemType;
13
12
  }
14
13
  //# sourceMappingURL=OptionType.d.ts.map
@@ -9,6 +9,8 @@ export class OptionType extends AbstractContainerType {
9
9
  comment: itemType.comment,
10
10
  itemType,
11
11
  label: itemType.label,
12
+ name: itemType.name,
13
+ shapeIdentifier: itemType.shapeIdentifier,
12
14
  });
13
15
  }
14
16
  }
@@ -1,5 +1,4 @@
1
1
  import { AbstractCollectionType } from "./AbstractCollectionType.js";
2
- import type { PlaceholderType } from "./PlaceholderType.js";
3
2
  /**
4
3
  * An unordered set of items of a specific type.
5
4
  */
@@ -15,7 +14,7 @@ export declare class SetType<ItemTypeT extends SetType.ItemType = SetType.ItemTy
15
14
  equals(other: SetType<ItemTypeT>): boolean;
16
15
  }
17
16
  export declare namespace SetType {
18
- type ItemType = Exclude<AbstractCollectionType.ItemType, PlaceholderType>;
17
+ type ItemType = AbstractCollectionType.ItemType;
19
18
  const isItemType: typeof import("./AbstractContainerType.js").AbstractContainerType.isItemType;
20
19
  }
21
20
  //# sourceMappingURL=SetType.d.ts.map
@@ -14,6 +14,8 @@ export class SetType extends AbstractCollectionType {
14
14
  comment: itemType.comment,
15
15
  itemType,
16
16
  label: itemType.label,
17
+ name: itemType.name,
18
+ shapeIdentifier: itemType.shapeIdentifier,
17
19
  });
18
20
  this.minCount = minCount;
19
21
  }
@@ -8,15 +8,12 @@ import type { LazyObjectSetType } from "./LazyObjectSetType.js";
8
8
  import type { LazyObjectType } from "./LazyObjectType.js";
9
9
  import type { ListType } from "./ListType.js";
10
10
  import type { LiteralType } from "./LiteralType.js";
11
- import type { ObjectIntersectionType } from "./ObjectIntersectionType.js";
12
11
  import type { ObjectType } from "./ObjectType.js";
13
- import type { ObjectUnionType } from "./ObjectUnionType.js";
14
12
  import type { OptionType } from "./OptionType.js";
15
- import type { PlaceholderType } from "./PlaceholderType.js";
16
13
  import type { SetType } from "./SetType.js";
17
14
  import type { TermType } from "./TermType.js";
18
15
  import type { UnionType } from "./UnionType.js";
19
- export type Type = BlankNodeType | DefaultValueType | IdentifierType | IntersectionType | IriType | LazyObjectOptionType | LazyObjectSetType | LazyObjectType | ListType | LiteralType | ObjectIntersectionType | ObjectType | ObjectUnionType | OptionType | PlaceholderType | SetType | TermType | UnionType;
16
+ export type Type = BlankNodeType | DefaultValueType | IdentifierType | IntersectionType | IriType | LazyObjectOptionType | LazyObjectSetType | LazyObjectType | ListType | LiteralType | ObjectType | OptionType | SetType | TermType | UnionType;
20
17
  export declare namespace Type {
21
18
  function equals(left: Type, right: Type): boolean;
22
19
  }
package/dist/ast/Type.js CHANGED
@@ -25,16 +25,10 @@ export var Type;
25
25
  return left.equals(right);
26
26
  case "ListType":
27
27
  return left.equals(right);
28
- case "ObjectIntersectionType":
29
- return left.equals(right);
30
28
  case "ObjectType":
31
29
  return left.equals(right);
32
- case "ObjectUnionType":
33
- return left.equals(right);
34
30
  case "OptionType":
35
31
  return left.equals(right);
36
- case "PlaceholderType":
37
- return left.equals(right);
38
32
  case "TermType":
39
33
  return left.equals(right);
40
34
  case "UnionType":
@@ -1,13 +1,18 @@
1
+ import type { Maybe } from "purify-ts";
1
2
  import { AbstractCompoundType } from "./AbstractCompoundType.js";
2
- import type { Type } from "./Type.js";
3
+ import type { ObjectUnionType } from "./ObjectUnionType.js";
3
4
  /**
4
5
  * A disjunction/union of types, corresponding to an sh:xone.
5
6
  */
6
- export declare class UnionType extends AbstractCompoundType<Type> {
7
+ export declare class UnionType<MemberTypeT extends UnionType.MemberType = UnionType.MemberType> extends AbstractCompoundType<UnionType.Member<MemberTypeT>, MemberTypeT> {
7
8
  readonly kind = "UnionType";
8
- readonly memberDiscriminantValues: readonly string[];
9
- constructor({ memberDiscriminantValues, ...superParameters }: {
10
- memberDiscriminantValues: readonly string[];
11
- } & ConstructorParameters<typeof AbstractCompoundType<Type>>[0]);
9
+ isObjectUnionType(): this is ObjectUnionType;
10
+ }
11
+ export declare namespace UnionType {
12
+ interface Member<TypeT extends UnionType.MemberType> extends AbstractCompoundType.Member<TypeT> {
13
+ readonly discriminantValue: Maybe<number | string>;
14
+ }
15
+ type MemberType = AbstractCompoundType.MemberType;
16
+ const isMemberType: typeof AbstractCompoundType.isMemberType;
12
17
  }
13
18
  //# sourceMappingURL=UnionType.d.ts.map
@@ -4,10 +4,12 @@ import { AbstractCompoundType } from "./AbstractCompoundType.js";
4
4
  */
5
5
  export class UnionType extends AbstractCompoundType {
6
6
  kind = "UnionType";
7
- memberDiscriminantValues;
8
- constructor({ memberDiscriminantValues, ...superParameters }) {
9
- super(superParameters);
10
- this.memberDiscriminantValues = memberDiscriminantValues;
7
+ isObjectUnionType() {
8
+ return this.members.every((member) => member.type.kind === "ObjectType" ||
9
+ (member.type.kind === "UnionType" && member.type.isObjectUnionType()));
11
10
  }
12
11
  }
12
+ (function (UnionType) {
13
+ UnionType.isMemberType = AbstractCompoundType.isMemberType;
14
+ })(UnionType || (UnionType = {}));
13
15
  //# sourceMappingURL=UnionType.js.map
@@ -1,6 +1,5 @@
1
1
  export * from "./Ast.js";
2
2
  export * from "./BlankNodeType.js";
3
- export * from "./Curie.js";
4
3
  export * from "./DefaultValueType.js";
5
4
  export * from "./IdentifierType.js";
6
5
  export * from "./IntersectionType.js";
@@ -10,11 +9,11 @@ export * from "./LazyObjectSetType.js";
10
9
  export * from "./LazyObjectType.js";
11
10
  export * from "./ListType.js";
12
11
  export * from "./LiteralType.js";
12
+ export * from "./ObjectCompoundType.js";
13
13
  export * from "./ObjectIntersectionType.js";
14
14
  export * from "./ObjectType.js";
15
15
  export * from "./ObjectUnionType.js";
16
16
  export * from "./OptionType.js";
17
- export * from "./PlaceholderType.js";
18
17
  export * from "./SetType.js";
19
18
  export * from "./TermType.js";
20
19
  export * from "./Type.js";
package/dist/ast/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from "./Ast.js";
2
2
  export * from "./BlankNodeType.js";
3
- export * from "./Curie.js";
4
3
  export * from "./DefaultValueType.js";
5
4
  export * from "./IdentifierType.js";
6
5
  export * from "./IntersectionType.js";
@@ -10,11 +9,11 @@ export * from "./LazyObjectSetType.js";
10
9
  export * from "./LazyObjectType.js";
11
10
  export * from "./ListType.js";
12
11
  export * from "./LiteralType.js";
12
+ export * from "./ObjectCompoundType.js";
13
13
  export * from "./ObjectIntersectionType.js";
14
14
  export * from "./ObjectType.js";
15
15
  export * from "./ObjectUnionType.js";
16
16
  export * from "./OptionType.js";
17
- export * from "./PlaceholderType.js";
18
17
  export * from "./SetType.js";
19
18
  export * from "./TermType.js";
20
19
  export * from "./Type.js";
@@ -34,11 +34,13 @@ function typeToJson(type) {
34
34
  nodeKinds: [...type.nodeKinds],
35
35
  };
36
36
  case "IntersectionType":
37
- case "UnionType":
38
37
  return {
39
38
  ...common,
40
- memberDiscriminantValues: type.kind === "UnionType" ? type.memberDiscriminantValues : undefined,
41
- memberTypes: type.memberTypes.map((type) => typeToJson(type)),
39
+ members: type.members.map((member) => ({
40
+ type: typeToJson(member.type),
41
+ })),
42
+ name: type.name.extract(),
43
+ shapeIdentifier: Resource.Identifier.toString(type.shapeIdentifier),
42
44
  };
43
45
  case "LazyObjectOptionType":
44
46
  case "LazyObjectSetType":
@@ -68,14 +70,6 @@ function typeToJson(type) {
68
70
  minInclusive: type.minInclusive.map(termToJson).extract(),
69
71
  };
70
72
  }
71
- case "ObjectIntersectionType":
72
- case "ObjectUnionType":
73
- return {
74
- ...common,
75
- name: type.name.extract(),
76
- memberTypes: type.memberTypes.map((type) => typeToJson(type)),
77
- shapeIdentifier: Resource.Identifier.toString(type.shapeIdentifier),
78
- };
79
73
  case "ObjectType":
80
74
  return {
81
75
  ...common,
@@ -98,8 +92,6 @@ function typeToJson(type) {
98
92
  ...common,
99
93
  itemType: typeToJson(type.itemType),
100
94
  };
101
- case "PlaceholderType":
102
- throw new Error(type.kind);
103
95
  case "SetType":
104
96
  return {
105
97
  ...common,
@@ -109,6 +101,16 @@ function typeToJson(type) {
109
101
  return {
110
102
  ...common,
111
103
  };
104
+ case "UnionType":
105
+ return {
106
+ ...common,
107
+ members: type.members.map((member) => ({
108
+ discriminantValue: member.discriminantValue.extract(),
109
+ type: typeToJson(member.type),
110
+ })),
111
+ name: type.name.extract(),
112
+ shapeIdentifier: Resource.Identifier.toString(type.shapeIdentifier),
113
+ };
112
114
  }
113
115
  }
114
116
  export class AstJsonGenerator {
@@ -127,7 +129,7 @@ export class AstJsonGenerator {
127
129
  description: property.description.extract(),
128
130
  label: property.label.extract(),
129
131
  mutable: property.mutable,
130
- name: property.name.extract(),
132
+ name: property.name,
131
133
  order: property.order,
132
134
  path: property.path,
133
135
  recursive: property.recursive ? true : undefined,
@@ -7,11 +7,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { Maybe, NonEmptyList } from "purify-ts";
8
8
  import { invariant } from "ts-invariant";
9
9
  import { Memoize } from "typescript-memoize";
10
- import { snippets_isReadonlyBigIntArray } from "./_snippets/snippets_isReadonlyBigIntArray.js";
11
- import { snippets_isReadonlyBooleanArray } from "./_snippets/snippets_isReadonlyBooleanArray.js";
12
- import { snippets_isReadonlyNumberArray } from "./_snippets/snippets_isReadonlyNumberArray.js";
13
- import { snippets_isReadonlyObjectArray } from "./_snippets/snippets_isReadonlyObjectArray.js";
14
- import { snippets_isReadonlyStringArray } from "./_snippets/snippets_isReadonlyStringArray.js";
15
10
  import { AbstractContainerType } from "./AbstractContainerType.js";
16
11
  import { codeEquals } from "./codeEquals.js";
17
12
  import { imports } from "./imports.js";
@@ -94,15 +89,15 @@ export class AbstractCollectionType extends AbstractContainerType {
94
89
  sourceTypeCheckExpression: (value) => {
95
90
  switch (itemTypeof) {
96
91
  case "bigint":
97
- return code `${snippets_isReadonlyBigIntArray}(${value})`;
92
+ return code `${snippets.isReadonlyBigIntArray}(${value})`;
98
93
  case "boolean":
99
- return code `${snippets_isReadonlyBooleanArray}(${value})`;
94
+ return code `${snippets.isReadonlyBooleanArray}(${value})`;
100
95
  case "number":
101
- return code `${snippets_isReadonlyNumberArray}(${value})`;
96
+ return code `${snippets.isReadonlyNumberArray}(${value})`;
102
97
  case "object":
103
- return code `${snippets_isReadonlyObjectArray}(${value})`;
98
+ return code `${snippets.isReadonlyObjectArray}(${value})`;
104
99
  case "string":
105
- return code `${snippets_isReadonlyStringArray}(${value})`;
100
+ return code `${snippets.isReadonlyStringArray}(${value})`;
106
101
  case "function":
107
102
  case "symbol":
108
103
  case "undefined":
@@ -165,6 +160,9 @@ export class AbstractCollectionType extends AbstractContainerType {
165
160
  if (!this._mutable && this.minCount > 0) {
166
161
  expression = code `${imports.NonEmptyList}.fromArray(${expression}).unsafeCoerce()`;
167
162
  }
163
+ if (this.minCount === 0) {
164
+ expression = code `(${expression} ?? [])`;
165
+ }
168
166
  const valueVariable = code `item`;
169
167
  const itemFromJsonExpression = this.itemType.fromJsonExpression({
170
168
  variables: { value: valueVariable },
@@ -1,4 +1,6 @@
1
+ import { Maybe } from "purify-ts";
1
2
  import { AbstractType } from "./AbstractType.js";
3
+ import type { AnonymousUnionType } from "./AnonymousUnionType.js";
2
4
  import type { BigDecimalType } from "./BigDecimalType.js";
3
5
  import type { BigIntType } from "./BigIntType.js";
4
6
  import type { BlankNodeType } from "./BlankNodeType.js";
@@ -11,17 +13,19 @@ import type { IntType } from "./IntType.js";
11
13
  import type { IriType } from "./IriType.js";
12
14
  import type { ListType } from "./ListType.js";
13
15
  import type { LiteralType } from "./LiteralType.js";
16
+ import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
17
+ import type { NamedUnionType } from "./NamedUnionType.js";
14
18
  import type { ObjectType } from "./ObjectType.js";
15
- import type { ObjectUnionType } from "./ObjectUnionType.js";
16
19
  import type { StringType } from "./StringType.js";
17
20
  import type { TermType } from "./TermType.js";
18
21
  import type { Type } from "./Type.js";
19
22
  import { type Code } from "./ts-poet-wrapper.js";
20
- import type { UnionType } from "./UnionType.js";
21
23
  /**
22
24
  * Abstract base class for types that contain other types e.g., ListType, OptionType, SetType.
23
25
  */
24
26
  export declare abstract class AbstractContainerType<ItemTypeT extends AbstractContainerType.ItemType> extends AbstractType {
27
+ readonly abstract = false;
28
+ readonly declaration: Maybe<Code>;
25
29
  abstract readonly kind: "DefaultValueType" | "ListType" | "OptionType" | "SetType";
26
30
  /**
27
31
  * Container item type.
@@ -32,6 +36,7 @@ export declare abstract class AbstractContainerType<ItemTypeT extends AbstractCo
32
36
  constructor({ itemType, ...superParameters }: {
33
37
  itemType: ItemTypeT;
34
38
  } & ConstructorParameters<typeof AbstractType>[0]);
39
+ get recursive(): boolean;
35
40
  get schema(): Code;
36
41
  protected get schemaObject(): {
37
42
  item: Code;
@@ -43,7 +48,7 @@ export declare namespace AbstractContainerType {
43
48
  type DiscriminantProperty = AbstractType.DiscriminantProperty;
44
49
  const GraphqlType: typeof AbstractType.GraphqlType;
45
50
  type GraphqlType = AbstractType.GraphqlType;
46
- type ItemType = BigDecimalType | BigIntType | BlankNodeType | BooleanType | DateTimeType | DateType | FloatType | IdentifierType | IntType | IriType | ListType<ListType.ItemType> | LiteralType | ObjectType | ObjectUnionType | StringType | TermType | UnionType;
51
+ type ItemType = AnonymousUnionType | BigDecimalType | BigIntType | BlankNodeType | BooleanType | DateTimeType | DateType | FloatType | IdentifierType | IntType | IriType | ListType<ListType.ItemType> | LiteralType | NamedObjectUnionType | NamedUnionType | ObjectType | StringType | TermType;
47
52
  function isItemType(type: Type): type is ItemType;
48
53
  const JsonType: typeof AbstractType.JsonType;
49
54
  type JsonType = AbstractType.JsonType;
@@ -4,6 +4,7 @@ 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 { Maybe } from "purify-ts";
7
8
  import { Memoize } from "typescript-memoize";
8
9
  import { AbstractType } from "./AbstractType.js";
9
10
  import { removeUndefined } from "./removeUndefined.js";
@@ -12,6 +13,8 @@ import { code } from "./ts-poet-wrapper.js";
12
13
  * Abstract base class for types that contain other types e.g., ListType, OptionType, SetType.
13
14
  */
14
15
  export class AbstractContainerType extends AbstractType {
16
+ abstract = false;
17
+ declaration = Maybe.empty();
15
18
  /**
16
19
  * Container item type.
17
20
  *
@@ -22,6 +25,9 @@ export class AbstractContainerType extends AbstractType {
22
25
  super(superParameters);
23
26
  this.itemType = itemType;
24
27
  }
28
+ get recursive() {
29
+ return this.itemType.recursive;
30
+ }
25
31
  get schema() {
26
32
  return code `${removeUndefined(this.schemaObject)}`;
27
33
  }
@@ -39,6 +45,7 @@ __decorate([
39
45
  AbstractContainerType.GraphqlType = AbstractType.GraphqlType;
40
46
  function isItemType(type) {
41
47
  switch (type.kind) {
48
+ case "AnonymousUnionType":
42
49
  case "BigDecimalType":
43
50
  case "BigIntType":
44
51
  case "BlankNodeType":
@@ -51,11 +58,11 @@ __decorate([
51
58
  case "IriType":
52
59
  case "ListType":
53
60
  case "LiteralType":
61
+ case "NamedObjectUnionType":
62
+ case "NamedUnionType":
54
63
  case "ObjectType":
55
- case "ObjectUnionType":
56
64
  case "StringType":
57
65
  case "TermType":
58
- case "UnionType":
59
66
  return true;
60
67
  case "DefaultValueType":
61
68
  case "LazyObjectOptionType":
@@ -9,7 +9,7 @@ export declare abstract class AbstractDateType extends AbstractPrimitiveType<Dat
9
9
  readonly mutable = false;
10
10
  readonly name = "Date";
11
11
  readonly schemaType: Code;
12
- readonly sparqlWherePatternsFunction: Code;
12
+ readonly valueSparqlWherePatternsFunction: Code;
13
13
  readonly typeofs: NonEmptyList<"object">;
14
14
  get conversions(): readonly AbstractPrimitiveType.Conversion[];
15
15
  protected get schemaObject(): {
@@ -20,7 +20,7 @@ export declare abstract class AbstractDateType extends AbstractPrimitiveType<Dat
20
20
  fromJsonExpression({ variables, }: Parameters<AbstractPrimitiveType<Date>["fromJsonExpression"]>[0]): Code;
21
21
  hashStatements({ variables, }: Parameters<AbstractPrimitiveType<Date>["hashStatements"]>[0]): readonly Code[];
22
22
  jsonType(): AbstractPrimitiveType.JsonType;
23
- toRdfExpression({ variables, }: Parameters<AbstractPrimitiveType<Date>["toRdfExpression"]>[0]): Code;
23
+ toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<Date>["toRdfResourceValuesExpression"]>[0]): Code;
24
24
  protected fromRdfExpressionChain({ variables, }: Parameters<AbstractPrimitiveType<Date>["fromRdfExpressionChain"]>[0]): ReturnType<AbstractPrimitiveType<Date>["fromRdfExpressionChain"]>;
25
25
  protected abstract fromRdfResourceValueExpression(variables: {
26
26
  variables: {
@@ -17,7 +17,7 @@ export class AbstractDateType extends AbstractPrimitiveType {
17
17
  mutable = false;
18
18
  name = "Date";
19
19
  schemaType = code `${snippets.DateSchema}`;
20
- sparqlWherePatternsFunction = code `${snippets.dateSparqlWherePatterns}`;
20
+ valueSparqlWherePatternsFunction = code `${snippets.dateSparqlWherePatterns}`;
21
21
  typeofs = NonEmptyList(["object"]);
22
22
  get conversions() {
23
23
  return [
@@ -48,7 +48,7 @@ export class AbstractDateType extends AbstractPrimitiveType {
48
48
  jsonType() {
49
49
  return new AbstractPrimitiveType.JsonType(code `string`);
50
50
  }
51
- toRdfExpression({ variables, }) {
51
+ toRdfResourceValuesExpression({ variables, }) {
52
52
  return code `[${snippets.literalFactory}.date(${variables.value}, ${rdfjsTermExpression(this.datatype)})]`;
53
53
  }
54
54
  fromRdfExpressionChain({ variables, }) {
@@ -1,7 +1,7 @@
1
1
  import type { BlankNode, NamedNode } from "@rdfjs/types";
2
2
  import type { IdentifierNodeKind } from "@shaclmate/shacl-ast";
3
- import { type Code } from "ts-poet";
4
3
  import { AbstractTermType } from "./AbstractTermType.js";
4
+ import { type Code } from "./ts-poet-wrapper.js";
5
5
  export declare abstract class AbstractIdentifierType<IdentifierT extends BlankNode | NamedNode> extends AbstractTermType<NamedNode, IdentifierT> {
6
6
  abstract readonly fromStringFunction: Code;
7
7
  readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;