@shaclmate/compiler 4.0.29 → 4.0.30

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 (339) hide show
  1. package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.js +0 -4
  2. package/dist/generators/ts/AbstractCollectionType.js +13 -15
  3. package/dist/generators/ts/AbstractDateType.js +6 -8
  4. package/dist/generators/ts/AbstractIdentifierType.d.ts +1 -1
  5. package/dist/generators/ts/AbstractIdentifierType.js +9 -5
  6. package/dist/generators/ts/AbstractLazyObjectType.d.ts +2 -3
  7. package/dist/generators/ts/AbstractLazyObjectType.js +2 -5
  8. package/dist/generators/ts/AbstractLiteralType.js +2 -3
  9. package/dist/generators/ts/AbstractNamedUnionType.js +39 -41
  10. package/dist/generators/ts/AbstractNumericType.js +8 -11
  11. package/dist/generators/ts/AbstractPrimitiveType.js +1 -2
  12. package/dist/generators/ts/AbstractTermType.js +10 -13
  13. package/dist/generators/ts/AbstractType.d.ts +8 -2
  14. package/dist/generators/ts/AbstractType.js +15 -5
  15. package/dist/generators/ts/AbstractUnionType.js +17 -19
  16. package/dist/generators/ts/BigDecimalType.d.ts +3 -3
  17. package/dist/generators/ts/BigDecimalType.js +24 -21
  18. package/dist/generators/ts/BigIntType.d.ts +1 -1
  19. package/dist/generators/ts/BigIntType.js +9 -5
  20. package/dist/generators/ts/BlankNodeType.js +9 -11
  21. package/dist/generators/ts/BooleanType.d.ts +1 -1
  22. package/dist/generators/ts/BooleanType.js +13 -11
  23. package/dist/generators/ts/DateTimeType.d.ts +1 -1
  24. package/dist/generators/ts/DateTimeType.js +14 -3
  25. package/dist/generators/ts/DateType.d.ts +1 -1
  26. package/dist/generators/ts/DateType.js +14 -3
  27. package/dist/generators/ts/DefaultValueType.js +5 -8
  28. package/dist/generators/ts/FloatType.d.ts +1 -1
  29. package/dist/generators/ts/FloatType.js +13 -2
  30. package/dist/generators/ts/IdentifierType.js +9 -11
  31. package/dist/generators/ts/{imports.d.ts → Imports.d.ts} +3 -3
  32. package/dist/generators/ts/Imports.js +41 -0
  33. package/dist/generators/ts/IntType.d.ts +1 -1
  34. package/dist/generators/ts/IntType.js +13 -2
  35. package/dist/generators/ts/IriType.js +15 -20
  36. package/dist/generators/ts/LazyObjectOptionType.d.ts +8 -8
  37. package/dist/generators/ts/LazyObjectOptionType.js +21 -26
  38. package/dist/generators/ts/LazyObjectSetType.d.ts +5 -1
  39. package/dist/generators/ts/LazyObjectSetType.js +12 -20
  40. package/dist/generators/ts/LazyObjectType.d.ts +5 -1
  41. package/dist/generators/ts/LazyObjectType.js +20 -18
  42. package/dist/generators/ts/ListType.js +11 -14
  43. package/dist/generators/ts/LiteralType.js +8 -10
  44. package/dist/generators/ts/NamedObjectType.d.ts +1 -3
  45. package/dist/generators/ts/NamedObjectType.js +32 -30
  46. package/dist/generators/ts/NamedObjectUnionType.js +37 -29
  47. package/dist/generators/ts/OptionType.js +13 -15
  48. package/dist/generators/ts/Reusables.d.ts +11 -0
  49. package/dist/generators/ts/Reusables.js +14 -0
  50. package/dist/generators/ts/SetType.js +4 -6
  51. package/dist/generators/ts/Snippet.d.ts +3 -0
  52. package/dist/generators/ts/Snippet.js +2 -0
  53. package/dist/generators/ts/SnippetFactory.d.ts +14 -0
  54. package/dist/generators/ts/SnippetFactory.js +2 -0
  55. package/dist/generators/ts/Snippets.d.ts +123 -0
  56. package/dist/generators/ts/Snippets.js +804 -0
  57. package/dist/generators/ts/StringType.d.ts +2 -2
  58. package/dist/generators/ts/StringType.js +14 -12
  59. package/dist/generators/ts/TermType.js +14 -17
  60. package/dist/generators/ts/TsGenerator.d.ts +7 -1
  61. package/dist/generators/ts/TsGenerator.js +90 -14
  62. package/dist/generators/ts/TypeFactory.d.ts +4 -1
  63. package/dist/generators/ts/TypeFactory.js +29 -3
  64. package/dist/generators/ts/ZodGenerator.d.ts +1 -0
  65. package/dist/generators/ts/ZodGenerator.js +10 -8
  66. package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +6 -1
  67. package/dist/generators/ts/_NamedObjectType/AbstractProperty.js +10 -1
  68. package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.js +3 -4
  69. package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +6 -10
  70. package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.js +3 -4
  71. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js +2 -4
  72. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.js +1 -2
  73. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.js +2 -3
  74. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +7 -11
  75. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +11 -15
  76. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +2 -3
  77. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +2 -3
  78. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +2 -4
  79. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js +1 -4
  80. package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js +1 -2
  81. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +4 -6
  82. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +3 -5
  83. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js +1 -3
  84. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +1 -2
  85. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +1 -2
  86. package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.js +3 -3
  87. package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.js +9 -12
  88. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +2 -3
  89. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts +2 -0
  90. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js +4 -7
  91. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts +2 -0
  92. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +2 -4
  93. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js +2 -3
  94. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js +4 -7
  95. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js +4 -5
  96. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +2 -4
  97. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js +3 -5
  98. package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +8 -11
  99. package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.js +4 -5
  100. package/dist/generators/ts/_snippets/snippets_BlankNodeFilter.d.ts +2 -1
  101. package/dist/generators/ts/_snippets/snippets_BlankNodeFilter.js +1 -2
  102. package/dist/generators/ts/_snippets/snippets_BlankNodeSchema.d.ts +2 -1
  103. package/dist/generators/ts/_snippets/snippets_BlankNodeSchema.js +1 -2
  104. package/dist/generators/ts/_snippets/snippets_BooleanFilter.d.ts +2 -1
  105. package/dist/generators/ts/_snippets/snippets_BooleanFilter.js +1 -2
  106. package/dist/generators/ts/_snippets/snippets_BooleanSchema.d.ts +2 -1
  107. package/dist/generators/ts/_snippets/snippets_BooleanSchema.js +1 -2
  108. package/dist/generators/ts/_snippets/snippets_CollectionFilter.d.ts +2 -1
  109. package/dist/generators/ts/_snippets/snippets_CollectionFilter.js +1 -2
  110. package/dist/generators/ts/_snippets/snippets_CollectionSchema.d.ts +2 -1
  111. package/dist/generators/ts/_snippets/snippets_CollectionSchema.js +1 -2
  112. package/dist/generators/ts/_snippets/snippets_DateFilter.d.ts +2 -1
  113. package/dist/generators/ts/_snippets/snippets_DateFilter.js +1 -2
  114. package/dist/generators/ts/_snippets/snippets_DateSchema.d.ts +2 -1
  115. package/dist/generators/ts/_snippets/snippets_DateSchema.js +1 -2
  116. package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.d.ts +2 -1
  117. package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.js +1 -3
  118. package/dist/generators/ts/_snippets/snippets_EqualsResult.d.ts +2 -1
  119. package/dist/generators/ts/_snippets/snippets_EqualsResult.js +1 -3
  120. package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.d.ts +2 -1
  121. package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.js +1 -3
  122. package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.d.ts +2 -1
  123. package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.js +2 -5
  124. package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.d.ts +2 -1
  125. package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.js +1 -3
  126. package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.d.ts +2 -1
  127. package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.js +1 -3
  128. package/dist/generators/ts/_snippets/snippets_Hasher.d.ts +2 -1
  129. package/dist/generators/ts/_snippets/snippets_Hasher.js +1 -2
  130. package/dist/generators/ts/_snippets/snippets_IdentifierFilter.d.ts +2 -1
  131. package/dist/generators/ts/_snippets/snippets_IdentifierFilter.js +1 -3
  132. package/dist/generators/ts/_snippets/snippets_IdentifierSchema.d.ts +2 -1
  133. package/dist/generators/ts/_snippets/snippets_IdentifierSchema.js +1 -2
  134. package/dist/generators/ts/_snippets/snippets_IdentifierSet.d.ts +2 -1
  135. package/dist/generators/ts/_snippets/snippets_IdentifierSet.js +1 -3
  136. package/dist/generators/ts/_snippets/snippets_IriFilter.d.ts +2 -1
  137. package/dist/generators/ts/_snippets/snippets_IriFilter.js +1 -3
  138. package/dist/generators/ts/_snippets/snippets_IriSchema.d.ts +2 -1
  139. package/dist/generators/ts/_snippets/snippets_IriSchema.js +1 -3
  140. package/dist/generators/ts/_snippets/snippets_LazyObject.d.ts +2 -1
  141. package/dist/generators/ts/_snippets/snippets_LazyObject.js +1 -3
  142. package/dist/generators/ts/_snippets/snippets_LazyObjectOption.d.ts +2 -1
  143. package/dist/generators/ts/_snippets/snippets_LazyObjectOption.js +1 -3
  144. package/dist/generators/ts/_snippets/snippets_LazyObjectSet.d.ts +2 -1
  145. package/dist/generators/ts/_snippets/snippets_LazyObjectSet.js +1 -3
  146. package/dist/generators/ts/_snippets/snippets_LiteralFilter.d.ts +2 -1
  147. package/dist/generators/ts/_snippets/snippets_LiteralFilter.js +2 -5
  148. package/dist/generators/ts/_snippets/snippets_LiteralSchema.d.ts +2 -1
  149. package/dist/generators/ts/_snippets/snippets_LiteralSchema.js +1 -3
  150. package/dist/generators/ts/_snippets/snippets_MaybeFilter.d.ts +2 -1
  151. package/dist/generators/ts/_snippets/snippets_MaybeFilter.js +1 -2
  152. package/dist/generators/ts/_snippets/snippets_MaybeSchema.d.ts +2 -1
  153. package/dist/generators/ts/_snippets/snippets_MaybeSchema.js +1 -2
  154. package/dist/generators/ts/_snippets/snippets_NumericFilter.d.ts +2 -1
  155. package/dist/generators/ts/_snippets/snippets_NumericFilter.js +1 -2
  156. package/dist/generators/ts/_snippets/snippets_NumericSchema.d.ts +2 -1
  157. package/dist/generators/ts/_snippets/snippets_NumericSchema.js +1 -2
  158. package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.d.ts +2 -1
  159. package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.js +1 -3
  160. package/dist/generators/ts/_snippets/snippets_PropertyPath.d.ts +2 -1
  161. package/dist/generators/ts/_snippets/snippets_PropertyPath.js +8 -13
  162. package/dist/generators/ts/_snippets/snippets_RdfVocabularies.d.ts +2 -1
  163. package/dist/generators/ts/_snippets/snippets_RdfVocabularies.js +1 -3
  164. package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.d.ts +2 -1
  165. package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +2 -4
  166. package/dist/generators/ts/_snippets/snippets_SparqlFilterPattern.d.ts +2 -1
  167. package/dist/generators/ts/_snippets/snippets_SparqlFilterPattern.js +1 -3
  168. package/dist/generators/ts/_snippets/snippets_SparqlPattern.d.ts +2 -1
  169. package/dist/generators/ts/_snippets/snippets_SparqlPattern.js +1 -4
  170. package/dist/generators/ts/_snippets/snippets_SparqlPattern_isSolutionGenerating.d.ts +2 -1
  171. package/dist/generators/ts/_snippets/snippets_SparqlPattern_isSolutionGenerating.js +2 -4
  172. package/dist/generators/ts/_snippets/snippets_StringFilter.d.ts +2 -1
  173. package/dist/generators/ts/_snippets/snippets_StringFilter.js +1 -2
  174. package/dist/generators/ts/_snippets/snippets_StringSchema.d.ts +2 -1
  175. package/dist/generators/ts/_snippets/snippets_StringSchema.js +1 -2
  176. package/dist/generators/ts/_snippets/snippets_TermFilter.d.ts +2 -1
  177. package/dist/generators/ts/_snippets/snippets_TermFilter.js +1 -3
  178. package/dist/generators/ts/_snippets/snippets_TermSchema.d.ts +2 -1
  179. package/dist/generators/ts/_snippets/snippets_TermSchema.js +1 -3
  180. package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.d.ts +2 -1
  181. package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.js +1 -3
  182. package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.d.ts +2 -1
  183. package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.js +5 -6
  184. package/dist/generators/ts/_snippets/snippets_UnwrapR.d.ts +2 -1
  185. package/dist/generators/ts/_snippets/snippets_UnwrapR.js +1 -3
  186. package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.d.ts +2 -1
  187. package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.js +1 -3
  188. package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.d.ts +2 -1
  189. package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.js +3 -6
  190. package/dist/generators/ts/_snippets/snippets_arrayEquals.d.ts +2 -1
  191. package/dist/generators/ts/_snippets/snippets_arrayEquals.js +7 -10
  192. package/dist/generators/ts/_snippets/snippets_arrayIntersection.d.ts +2 -1
  193. package/dist/generators/ts/_snippets/snippets_arrayIntersection.js +1 -2
  194. package/dist/generators/ts/_snippets/snippets_bigDecimalLiteral.d.ts +2 -1
  195. package/dist/generators/ts/_snippets/snippets_bigDecimalLiteral.js +2 -5
  196. package/dist/generators/ts/_snippets/snippets_bigDecimalSparqlWherePatterns.d.ts +2 -1
  197. package/dist/generators/ts/_snippets/snippets_bigDecimalSparqlWherePatterns.js +11 -19
  198. package/dist/generators/ts/_snippets/snippets_blankNodeSparqlWherePatterns.d.ts +2 -1
  199. package/dist/generators/ts/_snippets/snippets_blankNodeSparqlWherePatterns.js +2 -6
  200. package/dist/generators/ts/_snippets/snippets_booleanEquals.d.ts +2 -1
  201. package/dist/generators/ts/_snippets/snippets_booleanEquals.js +4 -6
  202. package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.d.ts +2 -1
  203. package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.js +5 -12
  204. package/dist/generators/ts/_snippets/snippets_compactRecord.d.ts +2 -1
  205. package/dist/generators/ts/_snippets/snippets_compactRecord.js +1 -2
  206. package/dist/generators/ts/_snippets/snippets_dateEquals.d.ts +2 -1
  207. package/dist/generators/ts/_snippets/snippets_dateEquals.js +4 -6
  208. package/dist/generators/ts/_snippets/snippets_dateSparqlWherePatterns.d.ts +2 -1
  209. package/dist/generators/ts/_snippets/snippets_dateSparqlWherePatterns.js +9 -17
  210. package/dist/generators/ts/_snippets/snippets_decodeBigDecimalLiteral.d.ts +2 -1
  211. package/dist/generators/ts/_snippets/snippets_decodeBigDecimalLiteral.js +1 -3
  212. package/dist/generators/ts/_snippets/snippets_deduplicateSparqlPatterns.d.ts +2 -1
  213. package/dist/generators/ts/_snippets/snippets_deduplicateSparqlPatterns.js +3 -5
  214. package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.d.ts +2 -1
  215. package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +3 -7
  216. package/dist/generators/ts/_snippets/snippets_filterArray.d.ts +2 -1
  217. package/dist/generators/ts/_snippets/snippets_filterArray.js +2 -4
  218. package/dist/generators/ts/_snippets/snippets_filterBigDecimal.d.ts +2 -1
  219. package/dist/generators/ts/_snippets/snippets_filterBigDecimal.js +2 -5
  220. package/dist/generators/ts/_snippets/snippets_filterBlankNode.d.ts +2 -1
  221. package/dist/generators/ts/_snippets/snippets_filterBlankNode.js +2 -5
  222. package/dist/generators/ts/_snippets/snippets_filterBoolean.d.ts +2 -1
  223. package/dist/generators/ts/_snippets/snippets_filterBoolean.js +2 -4
  224. package/dist/generators/ts/_snippets/snippets_filterDate.d.ts +2 -1
  225. package/dist/generators/ts/_snippets/snippets_filterDate.js +2 -4
  226. package/dist/generators/ts/_snippets/snippets_filterIdentifier.d.ts +2 -1
  227. package/dist/generators/ts/_snippets/snippets_filterIdentifier.js +2 -5
  228. package/dist/generators/ts/_snippets/snippets_filterIri.d.ts +2 -1
  229. package/dist/generators/ts/_snippets/snippets_filterIri.js +2 -5
  230. package/dist/generators/ts/_snippets/snippets_filterLiteral.d.ts +2 -1
  231. package/dist/generators/ts/_snippets/snippets_filterLiteral.js +3 -7
  232. package/dist/generators/ts/_snippets/snippets_filterMaybe.d.ts +2 -1
  233. package/dist/generators/ts/_snippets/snippets_filterMaybe.js +2 -5
  234. package/dist/generators/ts/_snippets/snippets_filterNumeric.d.ts +2 -1
  235. package/dist/generators/ts/_snippets/snippets_filterNumeric.js +2 -4
  236. package/dist/generators/ts/_snippets/snippets_filterString.d.ts +2 -1
  237. package/dist/generators/ts/_snippets/snippets_filterString.js +2 -4
  238. package/dist/generators/ts/_snippets/snippets_filterTerm.d.ts +2 -1
  239. package/dist/generators/ts/_snippets/snippets_filterTerm.js +2 -5
  240. package/dist/generators/ts/_snippets/snippets_fromRdfLanguageIn.d.ts +2 -1
  241. package/dist/generators/ts/_snippets/snippets_fromRdfLanguageIn.js +1 -3
  242. package/dist/generators/ts/_snippets/snippets_fromRdfPreferredLanguages.d.ts +2 -1
  243. package/dist/generators/ts/_snippets/snippets_fromRdfPreferredLanguages.js +1 -3
  244. package/dist/generators/ts/_snippets/snippets_identifierSparqlWherePatterns.d.ts +2 -1
  245. package/dist/generators/ts/_snippets/snippets_identifierSparqlWherePatterns.js +4 -10
  246. package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.d.ts +2 -1
  247. package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.js +5 -12
  248. package/dist/generators/ts/_snippets/snippets_isReadonlyBigIntArray.d.ts +2 -1
  249. package/dist/generators/ts/_snippets/snippets_isReadonlyBigIntArray.js +1 -2
  250. package/dist/generators/ts/_snippets/snippets_isReadonlyBooleanArray.d.ts +2 -1
  251. package/dist/generators/ts/_snippets/snippets_isReadonlyBooleanArray.js +1 -2
  252. package/dist/generators/ts/_snippets/snippets_isReadonlyNumberArray.d.ts +2 -1
  253. package/dist/generators/ts/_snippets/snippets_isReadonlyNumberArray.js +1 -2
  254. package/dist/generators/ts/_snippets/snippets_isReadonlyObjectArray.d.ts +2 -1
  255. package/dist/generators/ts/_snippets/snippets_isReadonlyObjectArray.js +1 -2
  256. package/dist/generators/ts/_snippets/snippets_isReadonlyStringArray.d.ts +2 -1
  257. package/dist/generators/ts/_snippets/snippets_isReadonlyStringArray.js +1 -2
  258. package/dist/generators/ts/_snippets/snippets_liftSparqlPatterns.d.ts +2 -1
  259. package/dist/generators/ts/_snippets/snippets_liftSparqlPatterns.js +4 -7
  260. package/dist/generators/ts/_snippets/snippets_listSparqlConstructTriples.d.ts +2 -1
  261. package/dist/generators/ts/_snippets/snippets_listSparqlConstructTriples.js +6 -12
  262. package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.d.ts +2 -1
  263. package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.js +9 -18
  264. package/dist/generators/ts/_snippets/snippets_literalFactory.d.ts +2 -1
  265. package/dist/generators/ts/_snippets/snippets_literalFactory.js +1 -3
  266. package/dist/generators/ts/_snippets/snippets_literalSchemaSparqlPatterns.d.ts +2 -1
  267. package/dist/generators/ts/_snippets/snippets_literalSchemaSparqlPatterns.js +7 -13
  268. package/dist/generators/ts/_snippets/snippets_literalSparqlWherePatterns.d.ts +2 -1
  269. package/dist/generators/ts/_snippets/snippets_literalSparqlWherePatterns.js +3 -8
  270. package/dist/generators/ts/_snippets/snippets_maybeEquals.d.ts +2 -1
  271. package/dist/generators/ts/_snippets/snippets_maybeEquals.js +5 -8
  272. package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.d.ts +2 -1
  273. package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.js +2 -6
  274. package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.d.ts +2 -1
  275. package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.js +4 -9
  276. package/dist/generators/ts/_snippets/snippets_normalizeSparqlWherePatterns.d.ts +2 -1
  277. package/dist/generators/ts/_snippets/snippets_normalizeSparqlWherePatterns.js +9 -14
  278. package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.d.ts +2 -1
  279. package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.js +9 -17
  280. package/dist/generators/ts/_snippets/snippets_parseBlankNode.d.ts +2 -1
  281. package/dist/generators/ts/_snippets/snippets_parseBlankNode.js +2 -5
  282. package/dist/generators/ts/_snippets/snippets_parseIdentifier.d.ts +2 -1
  283. package/dist/generators/ts/_snippets/snippets_parseIdentifier.js +1 -3
  284. package/dist/generators/ts/_snippets/snippets_parseIri.d.ts +2 -1
  285. package/dist/generators/ts/_snippets/snippets_parseIri.js +2 -5
  286. package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.d.ts +2 -1
  287. package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.js +2 -6
  288. package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.d.ts +2 -1
  289. package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.js +3 -8
  290. package/dist/generators/ts/_snippets/snippets_shaclPropertyFromRdf.d.ts +2 -1
  291. package/dist/generators/ts/_snippets/snippets_shaclPropertyFromRdf.js +2 -5
  292. package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.d.ts +2 -1
  293. package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.js +4 -9
  294. package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.d.ts +2 -1
  295. package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.js +8 -15
  296. package/dist/generators/ts/_snippets/snippets_sortSparqlPatterns.d.ts +2 -1
  297. package/dist/generators/ts/_snippets/snippets_sortSparqlPatterns.js +5 -7
  298. package/dist/generators/ts/_snippets/snippets_sparqlInstancesOfPattern.d.ts +2 -1
  299. package/dist/generators/ts/_snippets/snippets_sparqlInstancesOfPattern.js +3 -6
  300. package/dist/generators/ts/_snippets/snippets_sparqlPropertyPath.d.ts +2 -1
  301. package/dist/generators/ts/_snippets/snippets_sparqlPropertyPath.js +3 -6
  302. package/dist/generators/ts/_snippets/snippets_sparqlValueInPattern.d.ts +2 -1
  303. package/dist/generators/ts/_snippets/snippets_sparqlValueInPattern.js +3 -7
  304. package/dist/generators/ts/_snippets/snippets_strictEquals.d.ts +2 -1
  305. package/dist/generators/ts/_snippets/snippets_strictEquals.js +4 -6
  306. package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.d.ts +2 -1
  307. package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.js +7 -15
  308. package/dist/generators/ts/_snippets/snippets_termFilterSparqlPatterns.d.ts +2 -1
  309. package/dist/generators/ts/_snippets/snippets_termFilterSparqlPatterns.js +4 -9
  310. package/dist/generators/ts/_snippets/snippets_termSchemaSparqlPatterns.d.ts +2 -1
  311. package/dist/generators/ts/_snippets/snippets_termSchemaSparqlPatterns.js +6 -11
  312. package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.d.ts +2 -1
  313. package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.js +3 -9
  314. package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +2 -1
  315. package/dist/generators/ts/graphqlSchemaVariableStatement.js +13 -14
  316. package/dist/generators/ts/objectSetDeclarations.d.ts +2 -1
  317. package/dist/generators/ts/objectSetDeclarations.js +3 -3
  318. package/dist/generators/ts/objectSetInterfaceDeclaration.d.ts +2 -1
  319. package/dist/generators/ts/objectSetInterfaceDeclaration.js +4 -5
  320. package/dist/generators/ts/objectSetMethodSignatures.d.ts +2 -1
  321. package/dist/generators/ts/objectSetMethodSignatures.js +4 -5
  322. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.d.ts +2 -1
  323. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +49 -51
  324. package/dist/generators/ts/rdfjsTermExpression.d.ts +6 -2
  325. package/dist/generators/ts/rdfjsTermExpression.js +13 -15
  326. package/dist/generators/ts/sparqlObjectSetClassDeclaration.d.ts +2 -1
  327. package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +43 -45
  328. package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +2 -1
  329. package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +6 -7
  330. package/dist/input/ShapesGraph.d.ts +4 -4
  331. package/dist/input/ShapesGraph.js +4 -4
  332. package/dist/input/generated.d.ts +162 -163
  333. package/dist/input/generated.js +410 -416
  334. package/package.json +2 -2
  335. package/dist/generators/ts/imports.js +0 -41
  336. package/dist/generators/ts/snippets.d.ts +0 -110
  337. package/dist/generators/ts/snippets.js +0 -217
  338. package/dist/generators/ts/synthesizeUberObjectUnionType.d.ts +0 -11
  339. package/dist/generators/ts/synthesizeUberObjectUnionType.js +0 -68
@@ -6,13 +6,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { invariant } from "ts-invariant";
8
8
  import { Memoize } from "typescript-memoize";
9
- import { imports } from "./imports.js";
9
+ import { rdfjsTermExpression } from "./rdfjsTermExpression.js";
10
10
  import { code, literalOf } from "./ts-poet-wrapper.js";
11
11
  /**
12
12
  * Abstract base class all types.
13
13
  */
14
14
  export class AbstractType {
15
15
  logger;
16
+ reusables;
17
+ rdfjsTermExpression;
16
18
  /**
17
19
  * Comment from rdfs:comment.
18
20
  */
@@ -21,10 +23,16 @@ export class AbstractType {
21
23
  * Label from rdfs:label.
22
24
  */
23
25
  label;
24
- constructor({ comment, label, logger, }) {
26
+ constructor({ comment, label, logger, reusables, }) {
25
27
  this.comment = comment;
26
28
  this.label = label;
27
29
  this.logger = logger;
30
+ this.reusables = reusables;
31
+ this.rdfjsTermExpression = rdfjsTermExpression.bind({
32
+ imports: this.reusables.imports,
33
+ logger: this.logger,
34
+ snippets: this.reusables.snippets,
35
+ });
28
36
  }
29
37
  /**
30
38
  * Helper to compose the result of schema along the type hierarchy.
@@ -46,14 +54,16 @@ export class AbstractType {
46
54
  * The name of the type when it's nullable -- so it should never include "new graphql.GraphQLNonNull(...)" around it.
47
55
  */
48
56
  nullableName;
49
- constructor(nullableName, parameters) {
50
- this.nullable = !!parameters?.nullable;
57
+ reusables;
58
+ constructor(nullableName, reusables, options) {
59
+ this.nullable = !!options?.nullable;
51
60
  this.nullableName = nullableName;
61
+ this.reusables = reusables;
52
62
  }
53
63
  get name() {
54
64
  return this.nullable
55
65
  ? this.nullableName
56
- : code `new ${imports.GraphQLNonNull}(${this.nullableName})`;
66
+ : code `new ${this.reusables.imports.GraphQLNonNull}(${this.nullableName})`;
57
67
  }
58
68
  }
59
69
  __decorate([
@@ -8,9 +8,7 @@ import { Maybe, NonEmptyList } from "purify-ts";
8
8
  import { invariant } from "ts-invariant";
9
9
  import { Memoize } from "typescript-memoize";
10
10
  import { AbstractType } from "./AbstractType.js";
11
- import { imports } from "./imports.js";
12
11
  import { removeUndefined } from "./removeUndefined.js";
13
- import { snippets } from "./snippets.js";
14
12
  import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
15
13
  import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
16
14
  export class AbstractUnionType extends AbstractType {
@@ -220,7 +218,7 @@ ${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeChe
220
218
  return ${type.equalsFunction}(${unwrap(code `left`)} as ${type.name}, ${unwrap(code `right`)} as ${type.name});
221
219
  }`))}
222
220
 
223
- return ${imports.Left}({ left, right, propertyName: "type", propertyValuesUnequal: { left: typeof left, right: typeof right, type: "boolean" as const }, type: "property" as const });
221
+ return ${this.reusables.imports.Left}({ left, right, propertyName: "type", propertyValuesUnequal: { left: typeof left, right: typeof right, type: "boolean" as const }, type: "property" as const });
224
222
  })`;
225
223
  }
226
224
  get inlineFilterFunction() {
@@ -276,7 +274,7 @@ ${joinCode(this.members.map(({ jsonType, jsonTypeCheck, type, unwrap, wrap }) =>
276
274
  return code `\
277
275
  (((values, _options) =>
278
276
  values.chain(values => values.chainMap(value => {
279
- const valueAsValues = ${imports.Right}(value.toValues());
277
+ const valueAsValues = ${this.reusables.imports.Right}(value.toValues());
280
278
  return ${this.members.reduce((expression, { type, primaryDiscriminantValue }, memberI) => {
281
279
  let typeExpression = type.fromRdfResourceValuesExpression({
282
280
  variables: {
@@ -295,24 +293,24 @@ ${joinCode(this.members.map(({ jsonType, jsonTypeCheck, type, unwrap, wrap }) =>
295
293
  this.discriminant.memberValues[memberI].kind === "extrinsic")) {
296
294
  typeExpression = code `${typeExpression}.map(values => values.map(value => ({ ${this.discriminant.name}: ${literalOf(primaryDiscriminantValue)} as const, value }) as (${this.name})))`;
297
295
  }
298
- typeExpression = code `(${typeExpression} as ${imports.Either}<Error, ${imports.Resource}.Values<${this.name}>>)`;
296
+ typeExpression = code `(${typeExpression} as ${this.reusables.imports.Either}<Error, ${this.reusables.imports.Resource}.Values<${this.name}>>)`;
299
297
  return expression !== null
300
298
  ? code `${expression}.altLazy(() => ${typeExpression})`
301
299
  : typeExpression;
302
300
  }, null)}.chain(values => values.head());
303
301
  }))
304
- ) satisfies ${snippets.FromRdfResourceValuesFunction}<${this.name}>)`;
302
+ ) satisfies ${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.name}>)`;
305
303
  }
306
304
  get inlineJsonSchema() {
307
305
  const discriminant = this.discriminant; // To get type narrowing to work
308
306
  switch (discriminant.kind) {
309
307
  case "extrinsic":
310
- return code `${imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `${imports.z}.object({ ${discriminant.name}: ${imports.z}.literal(${literalOf(primaryDiscriminantValue)}), value: ${type.jsonSchema({ context: "type" })} })`), { on: "," })}]).readonly()`;
308
+ return code `${this.reusables.imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `${this.reusables.imports.z}.object({ ${discriminant.name}: ${this.reusables.imports.z}.literal(${literalOf(primaryDiscriminantValue)}), value: ${type.jsonSchema({ context: "type" })} })`), { on: "," })}]).readonly()`;
311
309
  case "hybrid":
312
- return code `${imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ primaryDiscriminantValue, type }, memberI) => {
310
+ return code `${this.reusables.imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ primaryDiscriminantValue, type }, memberI) => {
313
311
  switch (discriminant.memberValues[memberI].kind) {
314
312
  case "extrinsic":
315
- return code `${imports.z}.object({ ${discriminant.name}: ${imports.z}.literal(${literalOf(primaryDiscriminantValue)}), value: ${type.jsonSchema({ context: "type" })} })`;
313
+ return code `${this.reusables.imports.z}.object({ ${discriminant.name}: ${this.reusables.imports.z}.literal(${literalOf(primaryDiscriminantValue)}), value: ${type.jsonSchema({ context: "type" })} })`;
316
314
  case "intrinsic":
317
315
  return type.jsonSchema({
318
316
  includeDiscriminantProperty: true,
@@ -323,12 +321,12 @@ ${joinCode(this.members.map(({ jsonType, jsonTypeCheck, type, unwrap, wrap }) =>
323
321
  }
324
322
  }), { on: "," })}]).readonly()`;
325
323
  case "intrinsic":
326
- return code `${imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ type }) => type.jsonSchema({
324
+ return code `${this.reusables.imports.z}.discriminatedUnion("${discriminant.name}", [${joinCode(this.members.map(({ type }) => type.jsonSchema({
327
325
  includeDiscriminantProperty: true,
328
326
  context: "type",
329
327
  })), { on: "," })}]).readonly()`;
330
328
  case "typeof":
331
- return code `${imports.z}.union([${joinCode(this.members.map(({ type }) => type.jsonSchema({ context: "type" })), { on: "," })}]).readonly()`;
329
+ return code `${this.reusables.imports.z}.union([${joinCode(this.members.map(({ type }) => type.jsonSchema({ context: "type" })), { on: "," })}]).readonly()`;
332
330
  default:
333
331
  throw discriminant;
334
332
  }
@@ -398,11 +396,11 @@ ${joinCode(this.members.map(({ typeCheck, typeToJsonExpression, unwrap, wrap })
398
396
  (((value, _options): (${joinCode([...this.toRdfResourceValueTypes].map((toRdfResourceValueType) => {
399
397
  switch (toRdfResourceValueType) {
400
398
  case "BlankNode":
401
- return code `${imports.BlankNode}`;
399
+ return code `${this.reusables.imports.BlankNode}`;
402
400
  case "Literal":
403
- return code `${imports.Literal}`;
401
+ return code `${this.reusables.imports.Literal}`;
404
402
  case "NamedNode":
405
- return code `${imports.NamedNode}`;
403
+ return code `${this.reusables.imports.NamedNode}`;
406
404
  default:
407
405
  toRdfResourceValueType;
408
406
  throw new Error();
@@ -419,7 +417,7 @@ ${joinCode(this.members.map(({ type, unwrap, typeCheck }) => code `if (${typeChe
419
417
  })}; }`))}
420
418
 
421
419
  throw new Error("unable to serialize to RDF");
422
- }) satisfies ${snippets.ToRdfResourceValuesFunction}<${this.name}>)`;
420
+ }) satisfies ${this.reusables.snippets.ToRdfResourceValuesFunction}<${this.name}>)`;
423
421
  }
424
422
  get inlineToStringFunction() {
425
423
  return code `\
@@ -434,24 +432,24 @@ ${joinCode(this.members.map(({ type, typeCheck, unwrap }) => code `if (${typeChe
434
432
  get inlineValueSparqlConstructTriplesFunction() {
435
433
  return code `\
436
434
  ((({ ignoreRdfType, filter, schema, ...otherParameters }) => {
437
- let triples: ${imports.sparqljs}.Triple[] = [];
435
+ let triples: ${this.reusables.imports.sparqljs}.Triple[] = [];
438
436
 
439
437
  ${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `\
440
438
  triples = triples.concat(${type.valueSparqlConstructTriplesFunction}({ ...otherParameters, filter: filter?.on?.[${literalOf(primaryDiscriminantValue)}], ignoreRdfType: false, schema: schema.members[${literalOf(primaryDiscriminantValue)}].type }));`))}
441
439
 
442
440
  return triples;
443
- }) satisfies ${snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schemaType}>)`;
441
+ }) satisfies ${this.reusables.snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schemaType}>)`;
444
442
  }
445
443
  get inlineValueSparqlWherePatternsFunction() {
446
444
  return code `\
447
445
  ((({ filter, schema, ...otherParameters }) => {
448
- const unionPatterns: ${imports.sparqljs}.GroupPattern[] = [];
446
+ const unionPatterns: ${this.reusables.imports.sparqljs}.GroupPattern[] = [];
449
447
 
450
448
  ${joinCode(this.members.map(({ type, primaryDiscriminantValue }) => code `\
451
449
  unionPatterns.push({ patterns: ${type.valueSparqlWherePatternsFunction}({ ...otherParameters, filter: filter?.on?.[${literalOf(primaryDiscriminantValue)}], ignoreRdfType: false, schema: schema.members[${literalOf(primaryDiscriminantValue)}].type }).concat(), type: "group" });`))}
452
450
 
453
451
  return [{ patterns: unionPatterns, type: "union" }];
454
- }) satisfies ${snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schemaType}>)`;
452
+ }) satisfies ${this.reusables.snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schemaType}>)`;
455
453
  }
456
454
  get schemaObject() {
457
455
  return {
@@ -3,19 +3,19 @@ import { type Code } from "./ts-poet-wrapper.js";
3
3
  export declare class BigDecimalType extends AbstractLiteralType {
4
4
  readonly filterFunction: Code;
5
5
  readonly filterType: Code;
6
- readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
7
6
  readonly kind = "BigDecimalType";
8
7
  readonly name: Code;
9
8
  readonly schemaType: Code;
10
9
  readonly valueSparqlWherePatternsFunction: Code;
11
10
  get conversions(): readonly AbstractLiteralType.Conversion[];
11
+ get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
12
12
  fromJsonExpression({ variables, }: Parameters<AbstractLiteralType["fromJsonExpression"]>[0]): Code;
13
13
  graphqlResolveExpression({ variables, }: Parameters<AbstractLiteralType["graphqlResolveExpression"]>[0]): Code;
14
14
  hashStatements({ variables, }: Parameters<AbstractLiteralType["hashStatements"]>[0]): readonly Code[];
15
- jsonType(): AbstractLiteralType.JsonType;
16
15
  jsonSchema(): Code;
16
+ jsonType(): AbstractLiteralType.JsonType;
17
17
  toJsonExpression({ variables, }: Parameters<AbstractLiteralType["toJsonExpression"]>[0]): Code;
18
- protected fromRdfExpressionChain({ variables, }: Parameters<AbstractLiteralType["fromRdfExpressionChain"]>[0]): ReturnType<AbstractLiteralType["fromRdfExpressionChain"]>;
19
18
  toRdfResourceValuesExpression({ variables, }: Parameters<AbstractLiteralType["toRdfResourceValuesExpression"]>[0]): Code;
19
+ protected fromRdfExpressionChain({ variables, }: Parameters<AbstractLiteralType["fromRdfExpressionChain"]>[0]): ReturnType<AbstractLiteralType["fromRdfExpressionChain"]>;
20
20
  }
21
21
  //# sourceMappingURL=BigDecimalType.d.ts.map
@@ -6,22 +6,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { Memoize } from "typescript-memoize";
8
8
  import { AbstractLiteralType } from "./AbstractLiteralType.js";
9
- import { imports } from "./imports.js";
10
- import { snippets } from "./snippets.js";
11
9
  import { code } from "./ts-poet-wrapper.js";
12
10
  export class BigDecimalType extends AbstractLiteralType {
13
- filterFunction = code `${snippets.filterBigDecimal}`;
14
- filterType = code `${snippets.NumericFilter}<${imports.BigDecimal}>`;
15
- graphqlType = new AbstractLiteralType.GraphqlType(code `${imports.GraphQLString}`);
11
+ filterFunction = code `${this.reusables.snippets.filterBigDecimal}`;
12
+ filterType = code `${this.reusables.snippets.NumericFilter}<${this.reusables.imports.BigDecimal}>`;
16
13
  kind = "BigDecimalType";
17
- name = code `${imports.BigDecimal}`;
18
- schemaType = code `${snippets.NumericSchema}<${imports.BigDecimal}>`;
19
- valueSparqlWherePatternsFunction = code `${snippets.bigDecimalSparqlWherePatterns}`;
14
+ name = code `${this.reusables.imports.BigDecimal}`;
15
+ schemaType = code `${this.reusables.snippets.NumericSchema}<${this.reusables.imports.BigDecimal}>`;
16
+ valueSparqlWherePatternsFunction = code `${this.reusables.snippets.bigDecimalSparqlWherePatterns}`;
20
17
  get conversions() {
21
18
  return [
22
19
  // {
23
20
  // conversionExpression: (value) =>
24
- // code`new ${imports.BigDecimal}(${value}.toString())`,
21
+ // code`new ${this.reusables.imports.BigDecimal}(${value}.toString())`,
25
22
  // sourceTypeCheckExpression: (value) =>
26
23
  // code`typeof ${value} === "bigint"`,
27
24
  // sourceTypeName: code`bigint`,
@@ -30,12 +27,12 @@ export class BigDecimalType extends AbstractLiteralType {
30
27
  {
31
28
  conversionExpression: (value) => value,
32
29
  sourceTypeCheckExpression: (value) => code `typeof ${value} === "object"`,
33
- sourceTypeName: code `${imports.BigDecimal}`,
30
+ sourceTypeName: code `${this.reusables.imports.BigDecimal}`,
34
31
  sourceTypeof: "object",
35
32
  },
36
33
  // {
37
34
  // conversionExpression: (value) =>
38
- // code`new ${imports.BigDecimal}(${value})`,
35
+ // code`new ${this.reusables.imports.BigDecimal}(${value})`,
39
36
  // sourceTypeCheckExpression: (value) =>
40
37
  // code`typeof ${value} === "number"`,
41
38
  // sourceTypeName: code`number`,
@@ -43,7 +40,7 @@ export class BigDecimalType extends AbstractLiteralType {
43
40
  // },
44
41
  // {
45
42
  // conversionExpression: (value) =>
46
- // code`new ${imports.BigDecimal}(${value})`,
43
+ // code`new ${this.reusables.imports.BigDecimal}(${value})`,
47
44
  // sourceTypeCheckExpression: (value) =>
48
45
  // code`typeof ${value} === "string"`,
49
46
  // sourceTypeName: code`string`,
@@ -51,8 +48,11 @@ export class BigDecimalType extends AbstractLiteralType {
51
48
  // },
52
49
  ];
53
50
  }
51
+ get graphqlType() {
52
+ return new AbstractLiteralType.GraphqlType(code `${this.reusables.imports.GraphQLString}`, this.reusables);
53
+ }
54
54
  fromJsonExpression({ variables, }) {
55
- return code `new ${imports.BigDecimal}(${variables.value})`;
55
+ return code `new ${this.reusables.imports.BigDecimal}(${variables.value})`;
56
56
  }
57
57
  graphqlResolveExpression({ variables, }) {
58
58
  return code `${variables.value}.toFixed()`;
@@ -60,32 +60,35 @@ export class BigDecimalType extends AbstractLiteralType {
60
60
  hashStatements({ variables, }) {
61
61
  return [code `${variables.hasher}.update(${variables.value}.toFixed());`];
62
62
  }
63
+ jsonSchema() {
64
+ return code `${this.reusables.imports.z}.string()`;
65
+ }
63
66
  jsonType() {
64
67
  return new AbstractLiteralType.JsonType("string");
65
68
  }
66
- jsonSchema() {
67
- return code `${imports.z}.string()`;
68
- }
69
69
  toJsonExpression({ variables, }) {
70
70
  return code `${variables.value}.toFixed()`;
71
71
  }
72
+ toRdfResourceValuesExpression({ variables, }) {
73
+ return code `[${this.reusables.snippets.bigDecimalLiteral}(${variables.value})]`;
74
+ }
72
75
  fromRdfExpressionChain({ variables, }) {
73
76
  return {
74
77
  ...super.fromRdfExpressionChain({ variables }),
75
- valueTo: code `chain(values => values.chainMap(value => value.toLiteral().chain(${snippets.decodeBigDecimalLiteral})))`,
78
+ valueTo: code `chain(values => values.chainMap(value => value.toLiteral().chain(${this.reusables.snippets.decodeBigDecimalLiteral})))`,
76
79
  };
77
80
  }
78
- toRdfResourceValuesExpression({ variables, }) {
79
- return code `[${snippets.bigDecimalLiteral}(${variables.value})]`;
80
- }
81
81
  }
82
82
  __decorate([
83
83
  Memoize()
84
84
  ], BigDecimalType.prototype, "conversions", null);
85
85
  __decorate([
86
86
  Memoize()
87
- ], BigDecimalType.prototype, "jsonType", null);
87
+ ], BigDecimalType.prototype, "graphqlType", null);
88
88
  __decorate([
89
89
  Memoize()
90
90
  ], BigDecimalType.prototype, "jsonSchema", null);
91
+ __decorate([
92
+ Memoize()
93
+ ], BigDecimalType.prototype, "jsonType", null);
91
94
  //# sourceMappingURL=BigDecimalType.js.map
@@ -2,9 +2,9 @@ import { NonEmptyList } from "purify-ts";
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 graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
6
5
  readonly kind = "BigIntType";
7
6
  readonly typeofs: NonEmptyList<"bigint">;
7
+ get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
8
8
  get conversions(): readonly AbstractNumericType.Conversion[];
9
9
  fromJsonExpression({ variables, }: Parameters<AbstractNumericType<bigint>["fromJsonExpression"]>[0]): Code;
10
10
  jsonSchema(_parameters: Parameters<AbstractNumericType<bigint>["jsonSchema"]>[0]): Code;
@@ -7,12 +7,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { NonEmptyList } from "purify-ts";
8
8
  import { Memoize } from "typescript-memoize";
9
9
  import { AbstractNumericType } from "./AbstractNumericType.js";
10
- import { imports } from "./imports.js";
11
10
  import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
12
11
  export class BigIntType extends AbstractNumericType {
13
- graphqlType = new AbstractNumericType.GraphqlType(code `${imports.GraphQLBigInt}`);
14
12
  kind = "BigIntType";
15
13
  typeofs = NonEmptyList(["bigint"]);
14
+ get graphqlType() {
15
+ return new AbstractNumericType.GraphqlType(code `${this.reusables.imports.GraphQLBigInt}`, this.reusables);
16
+ }
16
17
  get conversions() {
17
18
  if (this.in_.length > 0) {
18
19
  return super.conversions;
@@ -34,11 +35,11 @@ export class BigIntType extends AbstractNumericType {
34
35
  jsonSchema(_parameters) {
35
36
  switch (this.primitiveIn.length) {
36
37
  case 0:
37
- return code `${imports.z}.string()`;
38
+ return code `${this.reusables.imports.z}.string()`;
38
39
  case 1:
39
- return code `${imports.z}.literal(${literalOf(this.primitiveIn[0].toString())})`;
40
+ return code `${this.reusables.imports.z}.literal(${literalOf(this.primitiveIn[0].toString())})`;
40
41
  default:
41
- return code `${imports.z}.enum([${joinCode(this.primitiveIn.map((value) => code `${literalOf(value.toString())}`), { on: "," })}])`;
42
+ return code `${this.reusables.imports.z}.enum([${joinCode(this.primitiveIn.map((value) => code `${literalOf(value.toString())}`), { on: "," })}])`;
42
43
  }
43
44
  }
44
45
  jsonType() {
@@ -54,6 +55,9 @@ export class BigIntType extends AbstractNumericType {
54
55
  return `${value.toString()}n`;
55
56
  }
56
57
  }
58
+ __decorate([
59
+ Memoize()
60
+ ], BigIntType.prototype, "graphqlType", null);
57
61
  __decorate([
58
62
  Memoize()
59
63
  ], BigIntType.prototype, "jsonType", null);
@@ -7,18 +7,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { Memoize } from "typescript-memoize";
8
8
  import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
9
9
  import { AbstractTermType } from "./AbstractTermType.js";
10
- import { imports } from "./imports.js";
11
- import { snippets } from "./snippets.js";
12
10
  import { code } from "./ts-poet-wrapper.js";
13
11
  export class BlankNodeType extends AbstractIdentifierType {
14
- filterFunction = code `${snippets.filterBlankNode}`;
15
- filterType = code `${snippets.BlankNodeFilter}`;
16
- parseFunction = code `${snippets.parseBlankNode};`;
12
+ filterFunction = code `${this.reusables.snippets.filterBlankNode}`;
13
+ filterType = code `${this.reusables.snippets.BlankNodeFilter}`;
14
+ parseFunction = code `${this.reusables.snippets.parseBlankNode};`;
17
15
  kind = "BlankNodeType";
18
- name = code `${imports.BlankNode}`;
16
+ name = code `${this.reusables.imports.BlankNode}`;
19
17
  nodeKinds = nodeKinds;
20
- schemaType = code `${snippets.BlankNodeSchema}`;
21
- valueSparqlWherePatternsFunction = code `${snippets.blankNodeSparqlWherePatterns}`;
18
+ schemaType = code `${this.reusables.snippets.BlankNodeSchema}`;
19
+ valueSparqlWherePatternsFunction = code `${this.reusables.snippets.blankNodeSparqlWherePatterns}`;
22
20
  constructor(superParameters) {
23
21
  super({
24
22
  ...superParameters,
@@ -27,7 +25,7 @@ export class BlankNodeType extends AbstractIdentifierType {
27
25
  });
28
26
  }
29
27
  fromJsonExpression({ variables, }) {
30
- return code `${imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2))`;
28
+ return code `${this.reusables.imports.dataFactory}.blankNode(${variables.value}["@id"].substring(2))`;
31
29
  }
32
30
  jsonType(parameters) {
33
31
  const discriminantProperty = parameters?.includeDiscriminantProperty
@@ -37,9 +35,9 @@ export class BlankNodeType extends AbstractIdentifierType {
37
35
  }
38
36
  jsonSchema({ includeDiscriminantProperty, }) {
39
37
  const discriminantProperty = includeDiscriminantProperty
40
- ? code `, termType: ${imports.z}.literal("BlankNode")`
38
+ ? code `, termType: ${this.reusables.imports.z}.literal("BlankNode")`
41
39
  : "";
42
- return code `${imports.z}.object({ "@id": ${imports.z}.string().min(1)${discriminantProperty} })`;
40
+ return code `${this.reusables.imports.z}.object({ "@id": ${this.reusables.imports.z}.string().min(1)${discriminantProperty} })`;
43
41
  }
44
42
  toJsonExpression({ includeDiscriminantProperty, variables, }) {
45
43
  const discriminantProperty = includeDiscriminantProperty
@@ -4,11 +4,11 @@ import { type Code } from "./ts-poet-wrapper.js";
4
4
  export declare class BooleanType extends AbstractPrimitiveType<boolean> {
5
5
  readonly filterFunction: Code;
6
6
  readonly filterType: Code;
7
- readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
8
7
  readonly kind = "BooleanType";
9
8
  readonly schemaType: Code;
10
9
  readonly valueSparqlWherePatternsFunction: Code;
11
10
  readonly typeofs: NonEmptyList<"boolean">;
11
+ get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
12
12
  get name(): string;
13
13
  protected get schemaObject(): {
14
14
  in: boolean[] | undefined;
@@ -7,18 +7,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { NonEmptyList } from "purify-ts";
8
8
  import { Memoize } from "typescript-memoize";
9
9
  import { AbstractPrimitiveType } from "./AbstractPrimitiveType.js";
10
- import { imports } from "./imports.js";
11
- import { rdfjsTermExpression } from "./rdfjsTermExpression.js";
12
- import { snippets } from "./snippets.js";
13
10
  import { code } from "./ts-poet-wrapper.js";
14
11
  export class BooleanType extends AbstractPrimitiveType {
15
- filterFunction = code `${snippets.filterBoolean}`;
16
- filterType = code `${snippets.BooleanFilter}`;
17
- graphqlType = new AbstractPrimitiveType.GraphqlType(code `${imports.GraphQLBoolean}`);
12
+ filterFunction = code `${this.reusables.snippets.filterBoolean}`;
13
+ filterType = code `${this.reusables.snippets.BooleanFilter}`;
18
14
  kind = "BooleanType";
19
- schemaType = code `${snippets.BooleanSchema}`;
20
- valueSparqlWherePatternsFunction = code `${snippets.booleanSparqlWherePatterns}`;
15
+ schemaType = code `${this.reusables.snippets.BooleanSchema}`;
16
+ valueSparqlWherePatternsFunction = code `${this.reusables.snippets.booleanSparqlWherePatterns}`;
21
17
  typeofs = NonEmptyList(["boolean"]);
18
+ get graphqlType() {
19
+ return new AbstractPrimitiveType.GraphqlType(code `${this.reusables.imports.GraphQLBoolean}`, this.reusables);
20
+ }
22
21
  get name() {
23
22
  if (this.primitiveIn.length > 0) {
24
23
  return `${this.primitiveIn.map((value) => value.toString()).join(" | ")}`;
@@ -33,12 +32,12 @@ export class BooleanType extends AbstractPrimitiveType {
33
32
  }
34
33
  jsonSchema(_parameters) {
35
34
  if (this.primitiveIn.length === 1) {
36
- return code `${imports.z}.literal(${this.primitiveIn[0]})`;
35
+ return code `${this.reusables.imports.z}.literal(${this.primitiveIn[0]})`;
37
36
  }
38
- return code `${imports.z}.boolean()`;
37
+ return code `${this.reusables.imports.z}.boolean()`;
39
38
  }
40
39
  toRdfResourceValuesExpression({ variables, }) {
41
- return code `[${snippets.literalFactory}.boolean(${variables.value}, ${rdfjsTermExpression(this.datatype, { logger: this.logger })})]`;
40
+ return code `[${this.reusables.snippets.literalFactory}.boolean(${variables.value}, ${this.rdfjsTermExpression(this.datatype)})]`;
42
41
  }
43
42
  fromRdfExpressionChain({ variables, }) {
44
43
  return {
@@ -49,6 +48,9 @@ export class BooleanType extends AbstractPrimitiveType {
49
48
  };
50
49
  }
51
50
  }
51
+ __decorate([
52
+ Memoize()
53
+ ], BooleanType.prototype, "graphqlType", null);
52
54
  __decorate([
53
55
  Memoize()
54
56
  ], BooleanType.prototype, "name", null);
@@ -1,8 +1,8 @@
1
1
  import { AbstractDateType } from "./AbstractDateType.js";
2
2
  import { type Code } from "./ts-poet-wrapper.js";
3
3
  export declare class DateTimeType extends AbstractDateType {
4
- readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
5
4
  readonly kind = "DateTimeType";
5
+ get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
6
6
  jsonSchema(_parameters: Parameters<AbstractDateType["jsonSchema"]>[0]): Code;
7
7
  toJsonExpression({ variables, }: Parameters<AbstractDateType["toJsonExpression"]>[0]): Code;
8
8
  protected fromRdfResourceValueExpression({ variables, }: Parameters<AbstractDateType["fromRdfResourceValueExpression"]>[0]): Code;
@@ -1,11 +1,19 @@
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 { Memoize } from "typescript-memoize";
1
8
  import { AbstractDateType } from "./AbstractDateType.js";
2
- import { imports } from "./imports.js";
3
9
  import { code } from "./ts-poet-wrapper.js";
4
10
  export class DateTimeType extends AbstractDateType {
5
- graphqlType = new AbstractDateType.GraphqlType(code `${imports.GraphQLDateTime}`);
6
11
  kind = "DateTimeType";
12
+ get graphqlType() {
13
+ return new DateTimeType.GraphqlType(code `${this.reusables.imports.GraphQLDateTime}`, this.reusables);
14
+ }
7
15
  jsonSchema(_parameters) {
8
- return code `${imports.z}.iso.datetime()`;
16
+ return code `${this.reusables.imports.z}.iso.datetime()`;
9
17
  }
10
18
  toJsonExpression({ variables, }) {
11
19
  return code `${variables.value}.toISOString()`;
@@ -14,4 +22,7 @@ export class DateTimeType extends AbstractDateType {
14
22
  return code `${variables.value}.toDateTime(${this.primitiveIn.length > 0 ? `[${this.primitiveIn.map((_) => `new Date(${_.getTime()})`).join(", ")}]` : ""})`;
15
23
  }
16
24
  }
25
+ __decorate([
26
+ Memoize()
27
+ ], DateTimeType.prototype, "graphqlType", null);
17
28
  //# sourceMappingURL=DateTimeType.js.map
@@ -2,8 +2,8 @@ import { AbstractDateType } from "./AbstractDateType.js";
2
2
  import { DateTimeType } from "./DateTimeType.js";
3
3
  import { type Code } from "./ts-poet-wrapper.js";
4
4
  export declare class DateType extends AbstractDateType {
5
- readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
6
5
  readonly kind = "DateType";
6
+ get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
7
7
  jsonSchema(_parameters: Parameters<DateTimeType["jsonSchema"]>[0]): Code;
8
8
  toJsonExpression({ variables, }: Parameters<AbstractDateType["toJsonExpression"]>[0]): Code;
9
9
  protected fromRdfResourceValueExpression({ variables, }: Parameters<AbstractDateType["fromRdfResourceValueExpression"]>[0]): Code;
@@ -1,12 +1,20 @@
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 { Memoize } from "typescript-memoize";
1
8
  import { AbstractDateType } from "./AbstractDateType.js";
2
9
  import { DateTimeType } from "./DateTimeType.js";
3
- import { imports } from "./imports.js";
4
10
  import { code } from "./ts-poet-wrapper.js";
5
11
  export class DateType extends AbstractDateType {
6
- graphqlType = new DateTimeType.GraphqlType(code `${imports.GraphQLDate}`);
7
12
  kind = "DateType";
13
+ get graphqlType() {
14
+ return new DateTimeType.GraphqlType(code `${this.reusables.imports.GraphQLDate}`, this.reusables);
15
+ }
8
16
  jsonSchema(_parameters) {
9
- return code `${imports.z}.iso.date()`;
17
+ return code `${this.reusables.imports.z}.iso.date()`;
10
18
  }
11
19
  toJsonExpression({ variables, }) {
12
20
  return code `${variables.value}.toISOString().replace(/T.*$/, '')`;
@@ -15,4 +23,7 @@ export class DateType extends AbstractDateType {
15
23
  return code `${variables.value}.toDate(${this.primitiveIn.length > 0 ? `[${this.primitiveIn.map((_) => `new Date(${_.getTime()})`).join(", ")}]` : ""})`;
16
24
  }
17
25
  }
26
+ __decorate([
27
+ Memoize()
28
+ ], DateType.prototype, "graphqlType", null);
18
29
  //# sourceMappingURL=DateType.js.map
@@ -9,9 +9,6 @@ import { Maybe, NonEmptyList } from "purify-ts";
9
9
  import { invariant } from "ts-invariant";
10
10
  import { Memoize } from "typescript-memoize";
11
11
  import { AbstractContainerType } from "./AbstractContainerType.js";
12
- import { imports } from "./imports.js";
13
- import { rdfjsTermExpression } from "./rdfjsTermExpression.js";
14
- import { snippets } from "./snippets.js";
15
12
  import { code, literalOf } from "./ts-poet-wrapper.js";
16
13
  export class DefaultValueType extends AbstractContainerType {
17
14
  defaultValue;
@@ -54,13 +51,13 @@ export class DefaultValueType extends AbstractContainerType {
54
51
  return this.itemType.name;
55
52
  }
56
53
  get schemaType() {
57
- return code `${snippets.DefaultValueSchema}`;
54
+ return code `${this.reusables.snippets.DefaultValueSchema}`;
58
55
  }
59
56
  get valueSparqlConstructTriplesFunction() {
60
57
  return this.itemType.valueSparqlConstructTriplesFunction;
61
58
  }
62
59
  get valueSparqlWherePatternsFunction() {
63
- return code `${snippets.defaultValueSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction})`;
60
+ return code `${this.reusables.snippets.defaultValueSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction})`;
64
61
  }
65
62
  get schemaObject() {
66
63
  return {
@@ -72,7 +69,7 @@ export class DefaultValueType extends AbstractContainerType {
72
69
  switch (this.itemType.kind) {
73
70
  case "BigDecimalType":
74
71
  invariant(this.defaultValue.termType === "Literal");
75
- return Maybe.of(code `new ${imports.BigDecimal}(${literalOf(this.defaultValue.value)})`);
72
+ return Maybe.of(code `new ${this.reusables.imports.BigDecimal}(${literalOf(this.defaultValue.value)})`);
76
73
  case "BigIntType":
77
74
  invariant(this.defaultValue.termType === "Literal");
78
75
  return Maybe.of(code `${LiteralDecoder.decodeBigIntLiteral(this.defaultValue).unsafeCoerce()}n`);
@@ -114,7 +111,7 @@ export class DefaultValueType extends AbstractContainerType {
114
111
  }
115
112
  }
116
113
  get defaultValueTermExpression() {
117
- return rdfjsTermExpression(this.defaultValue, { logger: this.logger });
114
+ return this.rdfjsTermExpression(this.defaultValue);
118
115
  }
119
116
  fromJsonExpression(parameters) {
120
117
  return this.itemType.fromJsonExpression(parameters);
@@ -123,7 +120,7 @@ export class DefaultValueType extends AbstractContainerType {
123
120
  return this.itemType.fromRdfResourceValuesExpression({
124
121
  variables: {
125
122
  ...variables,
126
- resourceValues: code `${variables.resourceValues}.map(values => values.length > 0 ? values : new ${imports.Resource}.Value(${{ dataFactory: imports.dataFactory, focusResource: variables.resource, propertyPath: variables.propertyPath, term: this.defaultValueTermExpression }}).toValues())`,
123
+ resourceValues: code `${variables.resourceValues}.map(values => values.length > 0 ? values : new ${this.reusables.imports.Resource}.Value(${{ dataFactory: this.reusables.imports.dataFactory, focusResource: variables.resource, propertyPath: variables.propertyPath, term: this.defaultValueTermExpression }}).toValues())`,
127
124
  },
128
125
  });
129
126
  }
@@ -3,8 +3,8 @@ 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
5
  readonly kind = "FloatType";
6
- readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
7
6
  readonly typeofs: NonEmptyList<"number">;
7
+ get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
8
8
  protected fromRdfResourceValueExpression({ variables, }: Parameters<AbstractNumericType<number>["fromRdfResourceValueExpression"]>[0]): Code;
9
9
  protected literalOf(value: number): string;
10
10
  }