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