@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
@@ -4,10 +4,9 @@ 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";
8
7
  import { Memoize } from "typescript-memoize";
9
8
  import { rdfjsTermExpression } from "./rdfjsTermExpression.js";
10
- import { code, literalOf } from "./ts-poet-wrapper.js";
9
+ import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
11
10
  /**
12
11
  * Abstract base class all types.
13
12
  */
@@ -15,6 +14,10 @@ export class AbstractType {
15
14
  configuration;
16
15
  logger;
17
16
  reusables;
17
+ /**
18
+ * Alias for this type.
19
+ */
20
+ alias;
18
21
  /**
19
22
  * Comment from rdfs:comment.
20
23
  */
@@ -23,7 +26,8 @@ export class AbstractType {
23
26
  * Label from rdfs:label.
24
27
  */
25
28
  label;
26
- constructor({ comment, configuration, label, logger, reusables, }) {
29
+ constructor({ alias, comment, configuration, label, logger, reusables, }) {
30
+ this.alias = alias;
27
31
  this.comment = comment;
28
32
  this.configuration = configuration;
29
33
  this.label = label;
@@ -35,17 +39,23 @@ export class AbstractType {
35
39
  snippets: this.reusables.snippets,
36
40
  });
37
41
  }
42
+ /**
43
+ * TypeScript object describing this type, for runtime use.
44
+ */
45
+ get schema() {
46
+ return code `{ ${joinCode(this.schemaInitializers.concat(), { on: ", " })} }`;
47
+ }
38
48
  /**
39
49
  * Helper to compose the result of schema along the type hierarchy.
40
50
  */
41
- get schemaObject() {
42
- invariant(this.kind.endsWith("Type"));
43
- return {
44
- kind: code `${literalOf(this.kind.substring(0, this.kind.length - "Type".length))} as const`,
45
- };
51
+ get schemaInitializers() {
52
+ return [code `kind: ${literalOf(this.kind)} as const`];
46
53
  }
47
54
  rdfjsTermExpression;
48
55
  }
56
+ __decorate([
57
+ Memoize()
58
+ ], AbstractType.prototype, "schema", null);
49
59
  (function (AbstractType) {
50
60
  class GraphqlType {
51
61
  /**
@@ -3,12 +3,12 @@ import { Maybe } from "purify-ts";
3
3
  import { AbstractLiteralType } from "./AbstractLiteralType.js";
4
4
  import { type Code } from "./ts-poet-wrapper.js";
5
5
  export declare class BigDecimalType extends AbstractLiteralType {
6
- readonly name: Code;
7
6
  readonly conversionFunction: Maybe<AbstractLiteralType.ConversionFunction>;
7
+ readonly expression: Code;
8
8
  readonly filterFunction: Code;
9
9
  readonly filterType: Code;
10
10
  readonly hashFunction: Code;
11
- readonly kind = "BigDecimalType";
11
+ readonly kind = "BigDecimal";
12
12
  readonly schemaType: Code;
13
13
  readonly valueSparqlWherePatternsFunction: Code;
14
14
  get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
@@ -9,19 +9,19 @@ import { Memoize } from "typescript-memoize";
9
9
  import { AbstractLiteralType } from "./AbstractLiteralType.js";
10
10
  import { code, literalOf } from "./ts-poet-wrapper.js";
11
11
  export class BigDecimalType extends AbstractLiteralType {
12
- name = code `${this.reusables.imports.BigDecimal}`;
13
12
  conversionFunction = Maybe.empty();
13
+ expression = code `${this.reusables.imports.BigDecimal}`;
14
14
  filterFunction = code `${this.reusables.snippets.filterBigDecimal}`;
15
15
  filterType = code `${this.reusables.snippets.NumericFilter}<${this.reusables.imports.BigDecimal}>`;
16
16
  hashFunction = code `${this.reusables.snippets.hashBigDecimal}`;
17
- kind = "BigDecimalType";
17
+ kind = "BigDecimal";
18
18
  schemaType = code `${this.reusables.snippets.NumericSchema}<${this.reusables.imports.BigDecimal}>`;
19
19
  valueSparqlWherePatternsFunction = code `${this.reusables.snippets.bigDecimalSparqlWherePatterns}`;
20
20
  get graphqlType() {
21
21
  return new AbstractLiteralType.GraphqlType(code `${this.reusables.imports.GraphQLString}`, this.reusables);
22
22
  }
23
23
  fromJsonExpression({ variables, }) {
24
- return code `${this.reusables.imports.Either}.encase<Error, ${this.name}>(() => new ${this.name}(${variables.value}))`;
24
+ return code `${this.reusables.imports.Either}.encase<Error, ${this.expression}>(() => new ${this.expression}(${variables.value}))`;
25
25
  }
26
26
  graphqlResolveExpression({ variables, }) {
27
27
  return code `${variables.value}.toFixed()`;
@@ -2,7 +2,7 @@ import type { Literal } from "@rdfjs/types";
2
2
  import { AbstractNumericType } from "./AbstractNumericType.js";
3
3
  import { type Code } from "./ts-poet-wrapper.js";
4
4
  export declare class BigIntType extends AbstractNumericType<bigint> {
5
- readonly kind = "BigIntType";
5
+ readonly kind = "BigInt";
6
6
  readonly typeofs: "bigint"[];
7
7
  get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
8
8
  fromJsonExpression({ variables, }: Parameters<AbstractNumericType<bigint>["fromJsonExpression"]>[0]): Code;
@@ -9,7 +9,7 @@ import { Memoize } from "typescript-memoize";
9
9
  import { AbstractNumericType } from "./AbstractNumericType.js";
10
10
  import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
11
11
  export class BigIntType extends AbstractNumericType {
12
- kind = "BigIntType";
12
+ kind = "BigInt";
13
13
  typeofs = ["bigint"];
14
14
  get graphqlType() {
15
15
  return new AbstractNumericType.GraphqlType(code `${this.reusables.imports.GraphQLBigInt}`, this.reusables);
@@ -17,9 +17,9 @@ export class BigIntType extends AbstractNumericType {
17
17
  fromJsonExpression({ variables, }) {
18
18
  let expression = code `BigInt(${variables.value})`;
19
19
  if (this.primitiveIn.length > 0) {
20
- expression = code `${expression} as ${this.name}`;
20
+ expression = code `${expression} as ${this.expression}`;
21
21
  }
22
- return code `${this.reusables.imports.Either}.encase<Error, ${this.name}>(() => ${expression})`;
22
+ return code `${this.reusables.imports.Either}.encase<Error, ${this.expression}>(() => ${expression})`;
23
23
  }
24
24
  jsonSchema(_parameters) {
25
25
  switch (this.primitiveIn.length) {
@@ -4,18 +4,18 @@ import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
4
4
  import { type Code } from "./ts-poet-wrapper.js";
5
5
  export declare class BlankNodeType extends AbstractIdentifierType<BlankNode> {
6
6
  readonly conversionFunction: Maybe<AbstractIdentifierType.ConversionFunction>;
7
+ readonly expression: Code;
7
8
  readonly filterFunction: Code;
8
9
  readonly filterType: Code;
9
- readonly parseFunction: Code;
10
- readonly kind = "BlankNodeType";
11
- readonly name: Code;
10
+ readonly kind = "BlankNode";
12
11
  readonly nodeKinds: ReadonlySet<"BlankNode">;
12
+ readonly parseFunction: Code;
13
13
  readonly schemaType: Code;
14
14
  readonly valueSparqlWherePatternsFunction: Code;
15
15
  constructor(superParameters: Omit<ConstructorParameters<typeof AbstractIdentifierType<BlankNode>>[0], "hasValues" | "in_">);
16
16
  fromJsonExpression({ variables, }: Parameters<AbstractIdentifierType<BlankNode>["fromJsonExpression"]>[0]): Code;
17
- jsonType(parameters?: Parameters<AbstractIdentifierType<BlankNode>["jsonType"]>[0]): AbstractIdentifierType.JsonType;
18
17
  jsonSchema({ includeDiscriminantProperty, }: Parameters<AbstractIdentifierType<BlankNode>["jsonSchema"]>[0]): Code;
18
+ jsonType(parameters?: Parameters<AbstractIdentifierType<BlankNode>["jsonType"]>[0]): AbstractIdentifierType.JsonType;
19
19
  toJsonExpression({ includeDiscriminantProperty, variables, }: Parameters<AbstractIdentifierType<BlankNode>["toJsonExpression"]>[0]): Code;
20
20
  protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<AbstractIdentifierType<BlankNode>["fromRdfResourceValuesExpressionChain"]>[0]): {
21
21
  valueTo: Code;
@@ -13,21 +13,21 @@ export class BlankNodeType extends AbstractIdentifierType {
13
13
  code: code `${this.reusables.snippets.convertToBlankNode}`,
14
14
  sourceTypes: [
15
15
  {
16
- name: code `${this.reusables.imports.BlankNode}`,
16
+ expression: code `${this.reusables.imports.BlankNode}`,
17
17
  typeof: "object",
18
18
  },
19
19
  {
20
- name: "undefined",
20
+ expression: code `undefined`,
21
21
  typeof: "undefined",
22
22
  },
23
23
  ],
24
24
  });
25
+ expression = code `${this.reusables.imports.BlankNode}`;
25
26
  filterFunction = code `${this.reusables.snippets.filterBlankNode}`;
26
27
  filterType = code `${this.reusables.snippets.BlankNodeFilter}`;
27
- parseFunction = code `${this.reusables.snippets.parseBlankNode};`;
28
- kind = "BlankNodeType";
29
- name = code `${this.reusables.imports.BlankNode}`;
28
+ kind = "BlankNode";
30
29
  nodeKinds = nodeKinds;
30
+ parseFunction = code `${this.reusables.snippets.parseBlankNode};`;
31
31
  schemaType = code `${this.reusables.snippets.BlankNodeSchema}`;
32
32
  valueSparqlWherePatternsFunction = code `${this.reusables.snippets.blankNodeSparqlWherePatterns}`;
33
33
  constructor(superParameters) {
@@ -38,13 +38,7 @@ export class BlankNodeType extends AbstractIdentifierType {
38
38
  });
39
39
  }
40
40
  fromJsonExpression({ variables, }) {
41
- return code `${this.reusables.imports.Either}.of<Error, ${this.name}>(${this.reusables.imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2)))`;
42
- }
43
- jsonType(parameters) {
44
- const discriminantProperty = parameters?.includeDiscriminantProperty
45
- ? `, readonly termType: "BlankNode"`
46
- : "";
47
- return new AbstractIdentifierType.JsonType(code `{ readonly "@id": string${discriminantProperty} }`);
41
+ return code `${this.reusables.imports.Either}.of<Error, ${this.expression}>(${this.reusables.imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2)))`;
48
42
  }
49
43
  jsonSchema({ includeDiscriminantProperty, }) {
50
44
  const discriminantProperty = includeDiscriminantProperty
@@ -52,6 +46,12 @@ export class BlankNodeType extends AbstractIdentifierType {
52
46
  : "";
53
47
  return code `${this.reusables.imports.z}.object({ "@id": ${this.reusables.imports.z}.string().min(1)${discriminantProperty} })`;
54
48
  }
49
+ jsonType(parameters) {
50
+ const discriminantProperty = parameters?.includeDiscriminantProperty
51
+ ? `, readonly termType: "BlankNode"`
52
+ : "";
53
+ return new AbstractIdentifierType.JsonType(code `{ readonly "@id": string${discriminantProperty} }`);
54
+ }
55
55
  toJsonExpression({ includeDiscriminantProperty, variables, }) {
56
56
  const discriminantProperty = includeDiscriminantProperty
57
57
  ? code `, termType: ${variables.value}.termType`
@@ -6,11 +6,11 @@ export declare class BooleanType extends AbstractPrimitiveType<boolean> {
6
6
  readonly filterType: Code;
7
7
  readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
8
8
  readonly hashFunction: Code;
9
- readonly kind = "BooleanType";
10
- readonly schemaType: Code;
9
+ readonly kind = "Boolean";
11
10
  readonly typeofs: "boolean"[];
12
11
  readonly valueSparqlWherePatternsFunction: Code;
13
- get name(): string;
12
+ get expression(): Code;
13
+ get schemaType(): Code;
14
14
  jsonSchema(_parameters: Parameters<AbstractPrimitiveType<number>["jsonSchema"]>[0]): Code;
15
15
  literalExpression(literal: boolean | Literal): Code;
16
16
  toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<boolean>["toRdfResourceValuesExpression"]>[0]): Code;
@@ -13,15 +13,17 @@ export class BooleanType extends AbstractPrimitiveType {
13
13
  filterType = code `${this.reusables.snippets.BooleanFilter}`;
14
14
  graphqlType = new AbstractPrimitiveType.GraphqlType(code `${this.reusables.imports.GraphQLBoolean}`, this.reusables);
15
15
  hashFunction = code `${this.reusables.snippets.hashBoolean}`;
16
- kind = "BooleanType";
17
- schemaType = code `${this.reusables.snippets.BooleanSchema}`;
16
+ kind = "Boolean";
18
17
  typeofs = ["boolean"];
19
18
  valueSparqlWherePatternsFunction = code `${this.reusables.snippets.booleanSparqlWherePatterns}`;
20
- get name() {
19
+ get expression() {
21
20
  if (this.primitiveIn.length > 0) {
22
- return `${this.primitiveIn.map((value) => value.toString()).join(" | ")}`;
21
+ return code `${this.primitiveIn.map((value) => value.toString()).join(" | ")}`;
23
22
  }
24
- return `boolean`;
23
+ return code `boolean`;
24
+ }
25
+ get schemaType() {
26
+ return code `${this.reusables.snippets.BooleanSchema}<${this.expression}>`;
25
27
  }
26
28
  jsonSchema(_parameters) {
27
29
  if (this.primitiveIn.length === 1) {
@@ -46,5 +48,8 @@ export class BooleanType extends AbstractPrimitiveType {
46
48
  }
47
49
  __decorate([
48
50
  Memoize()
49
- ], BooleanType.prototype, "name", null);
51
+ ], BooleanType.prototype, "expression", null);
52
+ __decorate([
53
+ Memoize()
54
+ ], BooleanType.prototype, "schemaType", null);
50
55
  //# sourceMappingURL=BooleanType.js.map
@@ -4,7 +4,7 @@ import { type Code } from "./ts-poet-wrapper.js";
4
4
  export declare class DateTimeType extends AbstractDateType {
5
5
  readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
6
6
  readonly hashFunction: Code;
7
- readonly kind = "DateTimeType";
7
+ readonly kind = "DateTime";
8
8
  jsonSchema(_parameters: Parameters<AbstractDateType["jsonSchema"]>[0]): Code;
9
9
  literalExpression(literal: Date | Literal): Code;
10
10
  toJsonExpression({ variables, }: Parameters<AbstractDateType["toJsonExpression"]>[0]): Code;
@@ -4,7 +4,7 @@ import { code } from "./ts-poet-wrapper.js";
4
4
  export class DateTimeType extends AbstractDateType {
5
5
  graphqlType = new DateTimeType.GraphqlType(code `${this.reusables.imports.GraphQLDateTime}`, this.reusables);
6
6
  hashFunction = code `${this.reusables.snippets.hashDateTime}`;
7
- kind = "DateTimeType";
7
+ kind = "DateTime";
8
8
  jsonSchema(_parameters) {
9
9
  return code `${this.reusables.imports.z}.iso.datetime()`;
10
10
  }
@@ -5,7 +5,7 @@ import { type Code } from "./ts-poet-wrapper.js";
5
5
  export declare class DateType extends AbstractDateType {
6
6
  readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
7
7
  readonly hashFunction: Code;
8
- readonly kind = "DateType";
8
+ readonly kind = "Date";
9
9
  jsonSchema(_parameters: Parameters<DateTimeType["jsonSchema"]>[0]): Code;
10
10
  literalExpression(literal: Date | Literal): Code;
11
11
  toJsonExpression({ variables, }: Parameters<AbstractDateType["toJsonExpression"]>[0]): Code;
@@ -5,7 +5,7 @@ import { code } from "./ts-poet-wrapper.js";
5
5
  export class DateType extends AbstractDateType {
6
6
  graphqlType = new DateTimeType.GraphqlType(code `${this.reusables.imports.GraphQLDate}`, this.reusables);
7
7
  hashFunction = code `${this.reusables.snippets.hashDate}`;
8
- kind = "DateType";
8
+ kind = "Date";
9
9
  jsonSchema(_parameters) {
10
10
  return code `${this.reusables.imports.z}.iso.date()`;
11
11
  }
@@ -9,7 +9,7 @@ export declare class DefaultValueType<ItemTypeT extends DefaultValueType.ItemTyp
9
9
  readonly defaultValue: Literal | NamedNode;
10
10
  readonly discriminantProperty: Maybe<AbstractType.DiscriminantProperty>;
11
11
  readonly graphqlArgs: AbstractType["graphqlArgs"];
12
- readonly kind = "DefaultValueType";
12
+ readonly kind = "DefaultValue";
13
13
  readonly typeofs: "object"[];
14
14
  readonly validationFunction: Maybe<Code>;
15
15
  constructor({ defaultValue, ...superParameters }: {
@@ -17,20 +17,16 @@ export declare class DefaultValueType<ItemTypeT extends DefaultValueType.ItemTyp
17
17
  } & ConstructorParameters<typeof AbstractContainerType<ItemTypeT>>[0]);
18
18
  get conversionFunction(): Maybe<AbstractContainerType.ConversionFunction>;
19
19
  get equalsFunction(): Code;
20
+ get expression(): Code;
20
21
  get filterFunction(): Code;
21
22
  get filterType(): Code;
22
23
  get graphqlType(): AbstractContainerType.GraphqlType;
23
24
  get hashFunction(): Code;
24
25
  get mutable(): boolean;
25
- get name(): Code | string;
26
26
  get schemaType(): Code;
27
27
  get valueSparqlConstructTriplesFunction(): Code;
28
28
  get valueSparqlWherePatternsFunction(): Code;
29
- protected get schemaObject(): {
30
- defaultValue: Code;
31
- item: Code;
32
- kind: Code;
33
- };
29
+ protected get schemaInitializers(): Code[];
34
30
  private get defaultValueExpression();
35
31
  fromJsonExpression(parameters: Parameters<AbstractType["fromJsonExpression"]>[0]): Code;
36
32
  fromRdfResourceValuesExpression({ variables, }: Parameters<AbstractContainerType<ItemTypeT>["fromRdfResourceValuesExpression"]>[0]): Code;
@@ -13,7 +13,7 @@ export class DefaultValueType extends AbstractContainerType {
13
13
  defaultValue;
14
14
  discriminantProperty = Maybe.empty();
15
15
  graphqlArgs = Maybe.empty();
16
- kind = "DefaultValueType";
16
+ kind = "DefaultValue";
17
17
  typeofs = ["object"];
18
18
  validationFunction = this.itemType.validationFunction;
19
19
  constructor({ defaultValue, ...superParameters }) {
@@ -27,7 +27,7 @@ export class DefaultValueType extends AbstractContainerType {
27
27
  sourceTypes: itemConversionFunction.sourceTypes
28
28
  .filter((sourceType) => sourceType.typeof !== "undefined")
29
29
  .concat({
30
- name: "undefined",
30
+ expression: code `undefined`,
31
31
  typeof: "undefined",
32
32
  }),
33
33
  });
@@ -35,6 +35,9 @@ export class DefaultValueType extends AbstractContainerType {
35
35
  get equalsFunction() {
36
36
  return this.itemType.equalsFunction;
37
37
  }
38
+ get expression() {
39
+ return this.itemType.expression;
40
+ }
38
41
  get filterFunction() {
39
42
  return this.itemType.filterFunction;
40
43
  }
@@ -50,11 +53,8 @@ export class DefaultValueType extends AbstractContainerType {
50
53
  get mutable() {
51
54
  return this.itemType.mutable;
52
55
  }
53
- get name() {
54
- return this.itemType.name;
55
- }
56
56
  get schemaType() {
57
- return code `${this.reusables.snippets.DefaultValueSchema}<${this.itemType.name}, ${this.itemType.schemaType}>`;
57
+ return code `${this.reusables.snippets.DefaultValueSchema}<${this.itemType.expression}, ${this.itemType.schemaType}>`;
58
58
  }
59
59
  get valueSparqlConstructTriplesFunction() {
60
60
  return this.itemType.valueSparqlConstructTriplesFunction;
@@ -62,24 +62,20 @@ export class DefaultValueType extends AbstractContainerType {
62
62
  get valueSparqlWherePatternsFunction() {
63
63
  return code `${this.reusables.snippets.defaultValueSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction})`;
64
64
  }
65
- get schemaObject() {
66
- return {
67
- ...super.schemaObject,
68
- defaultValue: this.defaultValueExpression,
69
- };
65
+ get schemaInitializers() {
66
+ return super.schemaInitializers.concat(code `defaultValue: ${this.defaultValueExpression}`);
70
67
  }
71
68
  get defaultValueExpression() {
72
69
  switch (this.itemType.kind) {
73
- case "IdentifierType":
74
- case "IriType":
75
- case "LiteralType":
76
- case "TermType":
70
+ case "Identifier":
71
+ case "Iri":
72
+ case "Literal":
73
+ case "Term":
77
74
  return this.rdfjsTermExpression(this.defaultValue);
78
- case "AnonymousUnionType":
79
- case "ListType":
80
- case "NamedObjectType":
81
- case "NamedObjectUnionType":
82
- case "NamedUnionType":
75
+ case "List":
76
+ case "Object":
77
+ case "ObjectUnion":
78
+ case "Union":
83
79
  throw new RangeError(`not implemented ${this.itemType.kind}`);
84
80
  }
85
81
  invariant(this.defaultValue.termType === "Literal");
@@ -136,7 +132,7 @@ __decorate([
136
132
  ], DefaultValueType.prototype, "defaultValueExpression", null);
137
133
  (function (DefaultValueType) {
138
134
  function isItemType(type) {
139
- if (type.kind === "BlankNodeType") {
135
+ if (type.kind === "BlankNode") {
140
136
  return false;
141
137
  }
142
138
  return AbstractContainerType.isItemType(type);
@@ -2,7 +2,7 @@ import type { Literal } from "@rdfjs/types";
2
2
  import { AbstractNumericType } from "./AbstractNumericType.js";
3
3
  import { type Code } from "./ts-poet-wrapper.js";
4
4
  export declare class FloatType extends AbstractNumericType<number> {
5
- readonly kind = "FloatType";
5
+ readonly kind = "Float";
6
6
  readonly typeofs: "number"[];
7
7
  get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
8
8
  literalExpression(literal: Literal | number): Code;
@@ -9,7 +9,7 @@ import { Memoize } from "typescript-memoize";
9
9
  import { AbstractNumericType } from "./AbstractNumericType.js";
10
10
  import { code } from "./ts-poet-wrapper.js";
11
11
  export class FloatType extends AbstractNumericType {
12
- kind = "FloatType";
12
+ kind = "Float";
13
13
  typeofs = ["number"];
14
14
  get graphqlType() {
15
15
  return new AbstractNumericType.GraphqlType(code `${this.reusables.imports.GraphQLFloat}`, this.reusables);
@@ -1,6 +1,6 @@
1
1
  import type { Logger } from "ts-log";
2
- import type { NamedObjectType } from "./NamedObjectType.js";
3
- import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
2
+ import type { ObjectType } from "./ObjectType.js";
3
+ import type { ObjectUnionType } from "./ObjectUnionType.js";
4
4
  import type { Reusables } from "./Reusables.js";
5
5
  import type { TsGenerator } from "./TsGenerator.js";
6
6
  import { type Code } from "./ts-poet-wrapper.js";
@@ -12,8 +12,8 @@ export declare class GraphqlSchema {
12
12
  constructor({ configuration, namedObjectTypes, namedObjectUnionTypes, reusables, }: {
13
13
  configuration: TsGenerator.Configuration;
14
14
  logger: Logger;
15
- namedObjectTypes: readonly NamedObjectType[];
16
- namedObjectUnionTypes: readonly NamedObjectUnionType[];
15
+ namedObjectTypes: readonly ObjectType[];
16
+ namedObjectUnionTypes: readonly ObjectUnionType[];
17
17
  reusables: Reusables;
18
18
  });
19
19
  get declaration(): Code;
@@ -28,8 +28,8 @@ export const graphqlSchema = new ${this.reusables.imports.GraphQLSchema}({ query
28
28
  },
29
29
  },
30
30
  resolve: code `\
31
- async (_source, args: { identifier: string }, { objectSet }): Promise<${namedObjectType.name}> =>
32
- (await ${this.reusables.imports.EitherAsync}<Error, ${namedObjectType.name}>(async ({ liftEither }) =>
31
+ async (_source, args: { identifier: string }, { objectSet }): Promise<${namedObjectType.expression}> =>
32
+ (await ${this.reusables.imports.EitherAsync}<Error, ${namedObjectType.expression}>(async ({ liftEither }) =>
33
33
  liftEither(await objectSet.${namedObjectType.objectSetMethodNames.object}(await liftEither(${namedObjectType.identifierTypeAlias}.parse(args.identifier))))
34
34
  )).unsafeCoerce()`,
35
35
  type: namedObjectType.graphqlType.name,
@@ -61,8 +61,8 @@ export const graphqlSchema = new ${this.reusables.imports.GraphQLSchema}({ query
61
61
  },
62
62
  },
63
63
  resolve: code `\
64
- async (_source, args: { identifiers: readonly string[] | null; limit: number | null; offset: number | null; }, { objectSet }): Promise<readonly ${namedObjectType.name}[]> =>
65
- (await ${this.reusables.imports.EitherAsync}<Error, readonly ${namedObjectType.name}[]>(async ({ liftEither }) => {
64
+ async (_source, args: { identifiers: readonly string[] | null; limit: number | null; offset: number | null; }, { objectSet }): Promise<readonly ${namedObjectType.expression}[]> =>
65
+ (await ${this.reusables.imports.EitherAsync}<Error, readonly ${namedObjectType.expression}[]>(async ({ liftEither }) => {
66
66
  let filter: ${namedObjectType.filterType} | undefined;
67
67
  if (args.identifiers) {
68
68
  const identifiers: ${namedObjectType.identifierTypeAlias}[] = [];
@@ -5,18 +5,18 @@ import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
5
5
  import { type Code } from "./ts-poet-wrapper.js";
6
6
  export declare class IdentifierType extends AbstractIdentifierType<BlankNode | NamedNode> {
7
7
  readonly conversionFunction: Maybe<AbstractIdentifierType.ConversionFunction>;
8
+ readonly expression: Code;
8
9
  readonly filterFunction: Code;
9
10
  readonly filterType: Code;
10
- readonly parseFunction: Code;
11
- readonly kind = "IdentifierType";
12
- readonly name: Code;
11
+ readonly kind = "Identifier";
13
12
  readonly nodeKinds: ReadonlySet<IdentifierNodeKind>;
13
+ readonly parseFunction: Code;
14
14
  readonly schemaType: Code;
15
15
  readonly valueSparqlWherePatternsFunction: Code;
16
16
  constructor(parameters: Omit<ConstructorParameters<typeof AbstractIdentifierType<BlankNode | NamedNode>>[0], "hasValues" | "in_">);
17
17
  fromJsonExpression({ variables, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["fromJsonExpression"]>[0]): Code;
18
- jsonType(parameters?: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["jsonType"]>[0]): AbstractIdentifierType.JsonType;
19
18
  jsonSchema({ includeDiscriminantProperty, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["jsonSchema"]>[0]): Code;
19
+ jsonType(parameters?: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["jsonType"]>[0]): AbstractIdentifierType.JsonType;
20
20
  toJsonExpression({ includeDiscriminantProperty, variables, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["toJsonExpression"]>[0]): Code;
21
21
  protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<AbstractIdentifierType<BlankNode | NamedNode>["fromRdfResourceValuesExpressionChain"]>[0]): ReturnType<AbstractIdentifierType<BlankNode | NamedNode>["fromRdfResourceValuesExpressionChain"]>;
22
22
  }
@@ -14,29 +14,29 @@ export class IdentifierType extends AbstractIdentifierType {
14
14
  code: code `${this.reusables.snippets.convertToIdentifier}`,
15
15
  sourceTypes: [
16
16
  {
17
- name: code `${this.reusables.imports.BlankNode}`,
17
+ expression: code `${this.reusables.imports.BlankNode}`,
18
18
  typeof: "object",
19
19
  },
20
20
  {
21
- name: code `${this.reusables.imports.NamedNode}`,
21
+ expression: code `${this.reusables.imports.NamedNode}`,
22
22
  typeof: "object",
23
23
  },
24
24
  {
25
- name: "string",
25
+ expression: code `string`,
26
26
  typeof: "string",
27
27
  },
28
28
  {
29
- name: "undefined",
29
+ expression: code `undefined`,
30
30
  typeof: "undefined",
31
31
  },
32
32
  ],
33
33
  });
34
+ expression = code `(${this.reusables.imports.BlankNode} | ${this.reusables.imports.NamedNode})`;
34
35
  filterFunction = code `${this.reusables.snippets.filterIdentifier}`;
35
36
  filterType = code `${this.reusables.snippets.IdentifierFilter}`;
36
- parseFunction = code `${this.reusables.snippets.parseIdentifier};`;
37
- kind = "IdentifierType";
38
- name = code `(${this.reusables.imports.BlankNode} | ${this.reusables.imports.NamedNode})`;
37
+ kind = "Identifier";
39
38
  nodeKinds = nodeKinds;
39
+ parseFunction = code `${this.reusables.snippets.parseIdentifier};`;
40
40
  schemaType = code `${this.reusables.snippets.IdentifierSchema}`;
41
41
  valueSparqlWherePatternsFunction = code `${this.reusables.snippets.identifierSparqlWherePatterns}`;
42
42
  constructor(parameters) {
@@ -47,13 +47,7 @@ export class IdentifierType extends AbstractIdentifierType {
47
47
  });
48
48
  }
49
49
  fromJsonExpression({ variables, }) {
50
- return code `${this.reusables.imports.Either}.of<Error, ${this.name}>((${variables.value}["@id"].startsWith("_:") ? ${this.reusables.imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2)) : ${this.reusables.imports.dataFactory}.namedNode(${variables.value}["@id"])))`;
51
- }
52
- jsonType(parameters) {
53
- const discriminantProperty = parameters?.includeDiscriminantProperty
54
- ? `, readonly termType: "BlankNode" | "NamedNode"`
55
- : "";
56
- return new AbstractIdentifierType.JsonType(code `{ readonly "@id": string${discriminantProperty} }`);
50
+ return code `${this.reusables.imports.Either}.of<Error, ${this.expression}>((${variables.value}["@id"].startsWith("_:") ? ${this.reusables.imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2)) : ${this.reusables.imports.dataFactory}.namedNode(${variables.value}["@id"])))`;
57
51
  }
58
52
  jsonSchema({ includeDiscriminantProperty, }) {
59
53
  const discriminantProperty = includeDiscriminantProperty
@@ -61,6 +55,12 @@ export class IdentifierType extends AbstractIdentifierType {
61
55
  : "";
62
56
  return code `${this.reusables.imports.z}.object({ "@id": ${this.reusables.imports.z}.string().min(1)${discriminantProperty} })`;
63
57
  }
58
+ jsonType(parameters) {
59
+ const discriminantProperty = parameters?.includeDiscriminantProperty
60
+ ? `, readonly termType: "BlankNode" | "NamedNode"`
61
+ : "";
62
+ return new AbstractIdentifierType.JsonType(code `{ readonly "@id": string${discriminantProperty} }`);
63
+ }
64
64
  toJsonExpression({ includeDiscriminantProperty, variables, }) {
65
65
  const discriminantProperty = includeDiscriminantProperty
66
66
  ? code `, termType: ${variables.value}.termType as ${[...this.nodeKinds].map((nodeKind) => `"${NodeKind.toTermType(nodeKind)}"`).join(" | ")}`
@@ -2,7 +2,7 @@ import type { Literal } from "@rdfjs/types";
2
2
  import { AbstractNumericType } from "./AbstractNumericType.js";
3
3
  import { type Code } from "./ts-poet-wrapper.js";
4
4
  export declare class IntType extends AbstractNumericType<number> {
5
- readonly kind = "IntType";
5
+ readonly kind = "Int";
6
6
  readonly typeofs: "number"[];
7
7
  get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
8
8
  literalExpression(literal: Literal | number): Code;
@@ -9,7 +9,7 @@ import { Memoize } from "typescript-memoize";
9
9
  import { AbstractNumericType } from "./AbstractNumericType.js";
10
10
  import { code } from "./ts-poet-wrapper.js";
11
11
  export class IntType extends AbstractNumericType {
12
- kind = "IntType";
12
+ kind = "Int";
13
13
  typeofs = ["number"];
14
14
  get graphqlType() {
15
15
  return new AbstractNumericType.GraphqlType(code `${this.reusables.imports.GraphQLInt}`, this.reusables);
@@ -5,13 +5,15 @@ import { type Code } from "./ts-poet-wrapper.js";
5
5
  export declare class IriType extends AbstractIdentifierType<NamedNode> {
6
6
  readonly filterFunction: Code;
7
7
  readonly filterType: Code;
8
- readonly kind = "IriType";
8
+ readonly kind = "Iri";
9
9
  readonly nodeKinds: ReadonlySet<"IRI">;
10
10
  readonly schemaType: Code;
11
11
  readonly valueSparqlWherePatternsFunction: Code;
12
12
  get conversionFunction(): Maybe<AbstractIdentifierType.ConversionFunction>;
13
- get name(): Code;
13
+ get expression(): Code;
14
14
  get parseFunction(): Code;
15
+ protected get schemaInitializers(): readonly Code[];
16
+ private get valueTypeExpression();
15
17
  fromJsonExpression({ variables, }: Parameters<AbstractIdentifierType<NamedNode>["fromJsonExpression"]>[0]): Code;
16
18
  jsonSchema({ includeDiscriminantProperty, }: Parameters<AbstractIdentifierType<NamedNode>["jsonSchema"]>[0]): Code;
17
19
  jsonType(parameters?: Parameters<AbstractIdentifierType<NamedNode>["jsonType"]>[0]): AbstractIdentifierType.JsonType;