@shaclmate/compiler 4.0.8 → 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 (302) 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 +0 -1
  216. package/dist/input/NodeShape.js +0 -3
  217. package/dist/input/ShapesGraph.d.ts +3 -2
  218. package/dist/input/ShapesGraph.js +12 -7
  219. package/dist/input/generated.d.ts +1899 -88
  220. package/dist/input/generated.js +676 -564
  221. package/package.json +3 -5
  222. package/dist/_ShapesGraphToAstTransformer/CurieFactory.d.ts +0 -16
  223. package/dist/_ShapesGraphToAstTransformer/CurieFactory.js +0 -45
  224. package/dist/_ShapesGraphToAstTransformer/NodeShapeAstType.d.ts +0 -3
  225. package/dist/_ShapesGraphToAstTransformer/NodeShapeAstType.js +0 -2
  226. package/dist/_ShapesGraphToAstTransformer/index.d.ts +0 -6
  227. package/dist/_ShapesGraphToAstTransformer/index.js +0 -6
  228. package/dist/_ShapesGraphToAstTransformer/shapeIdentifier.d.ts +0 -5
  229. package/dist/_ShapesGraphToAstTransformer/shapeIdentifier.js +0 -9
  230. package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.d.ts +0 -11
  231. package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.js +0 -338
  232. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstAbstractTypeProperties.d.ts +0 -12
  233. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstAbstractTypeProperties.js +0 -31
  234. package/dist/ast/AbstractObjectCompoundType.d.ts +0 -45
  235. package/dist/ast/AbstractObjectCompoundType.js +0 -180
  236. package/dist/ast/Curie.d.ts +0 -21
  237. package/dist/ast/Curie.js +0 -29
  238. package/dist/ast/PlaceholderType.d.ts +0 -15
  239. package/dist/ast/PlaceholderType.js +0 -19
  240. package/dist/generators/codeName.d.ts +0 -6
  241. package/dist/generators/codeName.js +0 -66
  242. package/dist/generators/ts/AbstractDeclaredType.d.ts +0 -23
  243. package/dist/generators/ts/AbstractDeclaredType.js +0 -17
  244. package/dist/generators/ts/ObjectUnionType.d.ts +0 -65
  245. package/dist/generators/ts/ObjectUnionType.js +0 -257
  246. package/dist/generators/ts/UnionType.d.ts +0 -40
  247. package/dist/generators/ts/UnionType.js +0 -527
  248. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclarations.d.ts +0 -4
  249. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclarations.js +0 -66
  250. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfFunctionDeclaration.d.ts +0 -5
  251. package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromRdfFunctionDeclaration.d.ts +0 -5
  252. package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  253. package/dist/generators/ts/_ObjectType/ObjectType_sparqlWherePatternsFunctionDeclarations.d.ts +0 -5
  254. package/dist/generators/ts/_ObjectType/ObjectType_toRdfFunctionOrMethodDeclaration.d.ts +0 -5
  255. package/dist/generators/ts/_ObjectUnionType/MemberType.d.ts +0 -34
  256. package/dist/generators/ts/_ObjectUnionType/MemberType.js +0 -105
  257. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_equalsFunctionDeclaration.d.ts +0 -5
  258. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_equalsFunctionDeclaration.js +0 -29
  259. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterFunctionDeclaration.d.ts +0 -4
  260. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterFunctionDeclaration.js +0 -19
  261. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterTypeDeclaration.d.ts +0 -4
  262. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterTypeDeclaration.js +0 -10
  263. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromJsonFunctionDeclaration.d.ts +0 -5
  264. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromJsonFunctionDeclaration.js +0 -19
  265. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromRdfFunctionDeclarations.d.ts +0 -5
  266. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromRdfFunctionDeclarations.js +0 -20
  267. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_graphqlTypeVariableStatement.d.ts +0 -5
  268. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_graphqlTypeVariableStatement.js +0 -18
  269. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_hashFunctionDeclaration.d.ts +0 -5
  270. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_hashFunctionDeclaration.js +0 -28
  271. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_identifierTypeDeclarations.d.ts +0 -4
  272. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_identifierTypeDeclarations.js +0 -9
  273. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_isTypeFunctionDeclaration.d.ts +0 -5
  274. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_isTypeFunctionDeclaration.js +0 -13
  275. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonTypeAliasDeclaration.d.ts +0 -5
  276. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonTypeAliasDeclaration.js +0 -10
  277. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonZodSchemaFunctionDeclaration.d.ts +0 -5
  278. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonZodSchemaFunctionDeclaration.js +0 -14
  279. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_schemaVariableStatement.d.ts +0 -4
  280. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_schemaVariableStatement.js +0 -37
  281. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  282. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.js +0 -15
  283. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlWherePatternsFunctionDeclaration.d.ts +0 -5
  284. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlWherePatternsFunctionDeclaration.js +0 -35
  285. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toJsonFunctionDeclaration.d.ts +0 -5
  286. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toJsonFunctionDeclaration.js +0 -26
  287. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toRdfFunctionDeclarations.d.ts +0 -5
  288. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toRdfFunctionDeclarations.js +0 -43
  289. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_typeAliasDeclaration.d.ts +0 -4
  290. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_typeAliasDeclaration.js +0 -10
  291. package/dist/generators/ts/_snippets/snippets_FromRdfOptions.d.ts +0 -2
  292. package/dist/generators/ts/_snippets/snippets_FromRdfOptions.js +0 -5
  293. package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfParameters.d.ts +0 -2
  294. package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfParameters.js +0 -5
  295. package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunction.d.ts +0 -2
  296. package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunction.js +0 -6
  297. package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunctionParameters.d.ts +0 -2
  298. package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunctionParameters.js +0 -12
  299. package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunction.d.ts +0 -2
  300. package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunction.js +0 -6
  301. package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunctionParameters.d.ts +0 -2
  302. package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunctionParameters.js +0 -15
@@ -1,257 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { camelCase } from "change-case";
8
- import { Maybe, NonEmptyList } from "purify-ts";
9
- import { invariant } from "ts-invariant";
10
- import { Memoize } from "typescript-memoize";
11
- import { ObjectType_objectSetMethodNames } from "./_ObjectType/ObjectType_objectSetMethodNames.js";
12
- import { ObjectType_sparqlConstructQueryFunctionDeclaration } from "./_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js";
13
- import { ObjectType_sparqlConstructQueryStringFunctionDeclaration } from "./_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js";
14
- import { MemberType } from "./_ObjectUnionType/MemberType.js";
15
- import { ObjectUnionType_equalsFunctionDeclaration } from "./_ObjectUnionType/ObjectUnionType_equalsFunctionDeclaration.js";
16
- import { ObjectUnionType_filterFunctionDeclaration } from "./_ObjectUnionType/ObjectUnionType_filterFunctionDeclaration.js";
17
- import { ObjectUnionType_filterTypeDeclaration } from "./_ObjectUnionType/ObjectUnionType_filterTypeDeclaration.js";
18
- import { ObjectUnionType_fromJsonFunctionDeclaration } from "./_ObjectUnionType/ObjectUnionType_fromJsonFunctionDeclaration.js";
19
- import { ObjectUnionType_fromRdfFunctionDeclaration } from "./_ObjectUnionType/ObjectUnionType_fromRdfFunctionDeclarations.js";
20
- import { ObjectUnionType_graphqlTypeVariableStatement } from "./_ObjectUnionType/ObjectUnionType_graphqlTypeVariableStatement.js";
21
- import { ObjectUnionType_hashFunctionDeclaration } from "./_ObjectUnionType/ObjectUnionType_hashFunctionDeclaration.js";
22
- import { ObjectUnionType_identifierTypeDeclarations } from "./_ObjectUnionType/ObjectUnionType_identifierTypeDeclarations.js";
23
- import { ObjectUnionType_isTypeFunctionDeclaration } from "./_ObjectUnionType/ObjectUnionType_isTypeFunctionDeclaration.js";
24
- import { ObjectUnionType_jsonTypeAliasDeclaration } from "./_ObjectUnionType/ObjectUnionType_jsonTypeAliasDeclaration.js";
25
- import { ObjectUnionType_jsonZodSchemaFunctionDeclaration } from "./_ObjectUnionType/ObjectUnionType_jsonZodSchemaFunctionDeclaration.js";
26
- import { ObjectUnionType_schemaVariableStatement } from "./_ObjectUnionType/ObjectUnionType_schemaVariableStatement.js";
27
- import { ObjectUnionType_sparqlConstructTriplesFunctionDeclaration } from "./_ObjectUnionType/ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.js";
28
- import { ObjectUnionType_sparqlWherePatternsFunctionDeclaration } from "./_ObjectUnionType/ObjectUnionType_sparqlWherePatternsFunctionDeclaration.js";
29
- import { ObjectUnionType_toJsonFunctionDeclaration } from "./_ObjectUnionType/ObjectUnionType_toJsonFunctionDeclaration.js";
30
- import { ObjectUnionType_toRdfFunctionDeclaration } from "./_ObjectUnionType/ObjectUnionType_toRdfFunctionDeclarations.js";
31
- import { ObjectUnionType_typeAliasDeclaration } from "./_ObjectUnionType/ObjectUnionType_typeAliasDeclaration.js";
32
- import { AbstractDeclaredType } from "./AbstractDeclaredType.js";
33
- import { imports } from "./imports.js";
34
- import { snippets } from "./snippets.js";
35
- import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
36
- import { code, def, joinCode } from "./ts-poet-wrapper.js";
37
- /**
38
- * A union of object types, generated as a type alias
39
- *
40
- * type SomeUnion = Member1 | Member2 | ...
41
- *
42
- * with associated functions that switch on the type discriminant property and delegate to the appropriate
43
- * member type code.
44
- *
45
- * It also generates SPARQL graph patterns that UNION the member object types.
46
- */
47
- export class ObjectUnionType extends AbstractDeclaredType {
48
- graphqlArgs = Maybe.empty();
49
- identifierType;
50
- kind = "ObjectUnionType";
51
- memberTypes;
52
- typeofs = NonEmptyList(["object"]);
53
- constructor({ identifierType, memberTypes, ...superParameters }) {
54
- super(superParameters);
55
- this.identifierType = identifierType;
56
- invariant(memberTypes.length > 0);
57
- this.memberTypes = memberTypes.map((memberType) => new MemberType({
58
- delegate: memberType,
59
- universe: memberTypes,
60
- }));
61
- }
62
- get conversions() {
63
- return [
64
- {
65
- conversionExpression: (value) => value,
66
- sourceTypeCheckExpression: (value) => code `typeof ${value} === "object"`,
67
- sourceTypeName: this.name,
68
- sourceTypeof: "object",
69
- },
70
- ];
71
- }
72
- get declaration() {
73
- const declarations = [
74
- ObjectUnionType_typeAliasDeclaration.bind(this)(),
75
- ];
76
- const staticModuleDeclarations = [
77
- ...ObjectUnionType_graphqlTypeVariableStatement.bind(this)().toList(),
78
- ...ObjectUnionType_identifierTypeDeclarations.bind(this)(),
79
- ...ObjectUnionType_jsonTypeAliasDeclaration.bind(this)().toList(),
80
- ...ObjectUnionType_equalsFunctionDeclaration.bind(this)().toList(),
81
- ObjectUnionType_filterFunctionDeclaration.bind(this)(),
82
- ObjectUnionType_filterTypeDeclaration.bind(this)(),
83
- ...ObjectUnionType_hashFunctionDeclaration.bind(this)().toList(),
84
- ...ObjectUnionType_fromJsonFunctionDeclaration.bind(this)().toList(),
85
- ...ObjectUnionType_fromRdfFunctionDeclaration.bind(this)().toList(),
86
- ...ObjectUnionType_isTypeFunctionDeclaration.bind(this)().toList(),
87
- ...ObjectUnionType_jsonZodSchemaFunctionDeclaration.bind(this)().toList(),
88
- ObjectUnionType_schemaVariableStatement.bind(this)(),
89
- ...ObjectType_sparqlConstructQueryFunctionDeclaration.bind(this)().toList(),
90
- ...ObjectType_sparqlConstructQueryStringFunctionDeclaration.bind(this)().toList(),
91
- ...ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.bind(this)().toList(),
92
- ...ObjectUnionType_sparqlWherePatternsFunctionDeclaration.bind(this)().toList(),
93
- ...ObjectUnionType_toJsonFunctionDeclaration.bind(this)().toList(),
94
- ...ObjectUnionType_toRdfFunctionDeclaration.bind(this)().toList(),
95
- ];
96
- if (staticModuleDeclarations.length > 0) {
97
- declarations.push(code `\
98
- export namespace ${def(this.staticModuleName)} {
99
- ${joinCode(staticModuleDeclarations, { on: "\n\n" })}
100
- }`);
101
- }
102
- return joinCode(declarations, { on: "\n\n" });
103
- }
104
- get discriminantProperty() {
105
- return Maybe.of(this._discriminantProperty);
106
- }
107
- get equalsFunction() {
108
- return code `${this.staticModuleName}.${syntheticNamePrefix}equals`;
109
- }
110
- get filterFunction() {
111
- return code `${this.staticModuleName}.${syntheticNamePrefix}filter`;
112
- }
113
- get filterType() {
114
- return code `${this.staticModuleName}.${syntheticNamePrefix}Filter`;
115
- }
116
- get graphqlType() {
117
- return new AbstractDeclaredType.GraphqlType(code `${this.staticModuleName}.${syntheticNamePrefix}GraphQL`);
118
- }
119
- get identifierTypeAlias() {
120
- return code `${this.staticModuleName}.${syntheticNamePrefix}Identifier`;
121
- }
122
- get mutable() {
123
- return this.memberTypes.some((memberType) => memberType.mutable);
124
- }
125
- get objectSetMethodNames() {
126
- return ObjectType_objectSetMethodNames.bind(this)();
127
- }
128
- get schema() {
129
- return code `${this.staticModuleName}.${syntheticNamePrefix}schema`;
130
- }
131
- get schemaType() {
132
- return code `typeof ${this.schema}`;
133
- }
134
- get sparqlConstructTriplesFunction() {
135
- return code `(({ ignoreRdfType, schema, valueVariable, ...otherParameters }: ${snippets.SparqlConstructTriplesFunctionParameters}<${this.filterType}, ${this.schemaType}>) => ${this.staticModuleName}.${syntheticNamePrefix}sparqlConstructTriples({ ...otherParameters, focusIdentifier: valueVariable, ignoreRdfType: false }))`;
136
- }
137
- get sparqlWherePatternsFunction() {
138
- return code `(({ ignoreRdfType, propertyPatterns, schema, valueVariable, ...otherParameters }: ${snippets.SparqlWherePatternsFunctionParameters}<${this.filterType}, ${this.schemaType}>) => (propertyPatterns as readonly ${snippets.SparqlPattern}[]).concat(${this.staticModuleName}.${syntheticNamePrefix}sparqlWherePatterns({ ...otherParameters, focusIdentifier: valueVariable, ignoreRdfType: false })))`;
139
- }
140
- get staticModuleName() {
141
- return this.name;
142
- }
143
- get _discriminantProperty() {
144
- const discriminantPropertyDescendantValues = [];
145
- const discriminantPropertyName = this.memberTypes[0]._discriminantProperty.name;
146
- const discriminantPropertyOwnValues = [];
147
- for (const memberType of this.memberTypes) {
148
- // invariant(
149
- // memberType.declarationType === this.memberTypes[0].declarationType,
150
- // );
151
- invariant(memberType._discriminantProperty.name === discriminantPropertyName);
152
- discriminantPropertyDescendantValues.push(...memberType._discriminantProperty.descendantValues);
153
- discriminantPropertyOwnValues.push(...memberType._discriminantProperty.ownValues);
154
- }
155
- return {
156
- descendantValues: discriminantPropertyDescendantValues,
157
- name: discriminantPropertyName,
158
- ownValues: discriminantPropertyOwnValues,
159
- };
160
- }
161
- get concreteMemberTypes() {
162
- return this.memberTypes.filter((memberType) => !memberType.abstract);
163
- }
164
- get thisVariable() {
165
- return code `_${camelCase(this.name)}`;
166
- }
167
- fromJsonExpression({ variables, }) {
168
- // Assumes the JSON object has been recursively validated already.
169
- return code `${this.staticModuleName}.${syntheticNamePrefix}fromJson(${variables.value}).unsafeCoerce()`;
170
- }
171
- fromRdfExpression({ variables, }) {
172
- // Don't ignoreRdfType, we may need it to distinguish the union members
173
- return code `${variables.resourceValues}.chain(values => values.chainMap(value => value.toResource().chain(resource => ${this.staticModuleName}.${syntheticNamePrefix}fromRdf(resource, { context: ${variables.context}, ignoreRdfType: false, objectSet: ${variables.objectSet}, preferredLanguages: ${variables.preferredLanguages} }))))`;
174
- }
175
- graphqlResolveExpression({ variables, }) {
176
- return variables.value;
177
- }
178
- hashStatements({ variables, }) {
179
- return [
180
- code `${this.staticModuleName}.${syntheticNamePrefix}hash(${variables.value}, ${variables.hasher});`,
181
- ];
182
- }
183
- jsonType() {
184
- return new AbstractDeclaredType.JsonType(joinCode(this.memberTypes.map((memberType) => code `${memberType.jsonType().name}`), { on: "|" }));
185
- }
186
- jsonUiSchemaElement() {
187
- return Maybe.empty();
188
- }
189
- jsonZodSchema({ context, }) {
190
- const expression = code `${this.staticModuleName}.${syntheticNamePrefix}jsonZodSchema()`;
191
- for (const memberType of this.memberTypes) {
192
- if (context === "property" &&
193
- memberType.properties.some((property) => property.recursive)) {
194
- return code `${imports.z}.lazy((): ${imports.z}.ZodType<${this.staticModuleName}.${syntheticNamePrefix}Json> => ${expression})`;
195
- }
196
- }
197
- return expression;
198
- }
199
- toJsonExpression({ variables, }) {
200
- return code `${this.staticModuleName}.${syntheticNamePrefix}toJson(${variables.value})`;
201
- }
202
- toRdfExpression({ variables, }) {
203
- return code `[${this.staticModuleName}.${syntheticNamePrefix}toRdf(${variables.value}, ${{ graph: variables.graph, resourceSet: variables.resourceSet }}).identifier]`;
204
- }
205
- }
206
- __decorate([
207
- Memoize()
208
- ], ObjectUnionType.prototype, "conversions", null);
209
- __decorate([
210
- Memoize()
211
- ], ObjectUnionType.prototype, "discriminantProperty", null);
212
- __decorate([
213
- Memoize()
214
- ], ObjectUnionType.prototype, "equalsFunction", null);
215
- __decorate([
216
- Memoize()
217
- ], ObjectUnionType.prototype, "filterFunction", null);
218
- __decorate([
219
- Memoize()
220
- ], ObjectUnionType.prototype, "filterType", null);
221
- __decorate([
222
- Memoize()
223
- ], ObjectUnionType.prototype, "graphqlType", null);
224
- __decorate([
225
- Memoize()
226
- ], ObjectUnionType.prototype, "identifierTypeAlias", null);
227
- __decorate([
228
- Memoize()
229
- ], ObjectUnionType.prototype, "mutable", null);
230
- __decorate([
231
- Memoize()
232
- ], ObjectUnionType.prototype, "objectSetMethodNames", null);
233
- __decorate([
234
- Memoize()
235
- ], ObjectUnionType.prototype, "schema", null);
236
- __decorate([
237
- Memoize()
238
- ], ObjectUnionType.prototype, "schemaType", null);
239
- __decorate([
240
- Memoize()
241
- ], ObjectUnionType.prototype, "sparqlConstructTriplesFunction", null);
242
- __decorate([
243
- Memoize()
244
- ], ObjectUnionType.prototype, "sparqlWherePatternsFunction", null);
245
- __decorate([
246
- Memoize()
247
- ], ObjectUnionType.prototype, "_discriminantProperty", null);
248
- __decorate([
249
- Memoize()
250
- ], ObjectUnionType.prototype, "concreteMemberTypes", null);
251
- __decorate([
252
- Memoize()
253
- ], ObjectUnionType.prototype, "thisVariable", null);
254
- __decorate([
255
- Memoize()
256
- ], ObjectUnionType.prototype, "jsonType", null);
257
- //# sourceMappingURL=ObjectUnionType.js.map
@@ -1,40 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import { AbstractType } from "./AbstractType.js";
3
- import type { Type } from "./Type.js";
4
- import { type Code } from "./ts-poet-wrapper.js";
5
- export declare class UnionType extends AbstractType {
6
- #private;
7
- private readonly discriminant;
8
- private readonly memberTypes;
9
- readonly graphqlArgs: AbstractType["graphqlArgs"];
10
- readonly kind = "UnionType";
11
- constructor({ memberDiscriminantValues, memberTypes, ...superParameters }: {
12
- memberDiscriminantValues: readonly string[];
13
- memberTypes: readonly Type[];
14
- } & ConstructorParameters<typeof AbstractType>[0]);
15
- get conversions(): readonly AbstractType.Conversion[];
16
- get discriminantProperty(): Maybe<AbstractType.DiscriminantProperty>;
17
- get equalsFunction(): Code;
18
- get filterFunction(): Code;
19
- get filterType(): Code;
20
- get graphqlType(): AbstractType.GraphqlType;
21
- get mutable(): boolean;
22
- get name(): Code;
23
- get schema(): Code;
24
- get schemaType(): Code;
25
- get sparqlConstructTriplesFunction(): Code;
26
- get sparqlWherePatternsFunction(): Code;
27
- get typeofs(): AbstractType["typeofs"];
28
- fromJsonExpression({ variables, }: Parameters<AbstractType["fromJsonExpression"]>[0]): Code;
29
- fromRdfExpression({ variables, }: Parameters<AbstractType["fromRdfExpression"]>[0]): Code;
30
- graphqlResolveExpression(_parameters: Parameters<AbstractType["graphqlResolveExpression"]>[0]): Code;
31
- hashStatements({ depth, variables, }: Parameters<AbstractType["hashStatements"]>[0]): readonly Code[];
32
- jsonType(): AbstractType.JsonType;
33
- jsonUiSchemaElement(): Maybe<Code>;
34
- jsonZodSchema(_parameters: Parameters<AbstractType["jsonZodSchema"]>[0]): Code;
35
- toJsonExpression({ variables, }: Parameters<AbstractType["toJsonExpression"]>[0]): Code;
36
- toRdfExpression({ variables, }: Parameters<AbstractType["toRdfExpression"]>[0]): Code;
37
- private discriminantVariable;
38
- private ternaryExpression;
39
- }
40
- //# sourceMappingURL=UnionType.d.ts.map