@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
@@ -7,9 +7,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { rdf } from "@tpluscode/rdf-ns-builders";
8
8
  import { Memoize } from "typescript-memoize";
9
9
  import { AbstractCollectionType } from "./AbstractCollectionType.js";
10
- import { imports } from "./imports.js";
11
- import { rdfjsTermExpression } from "./rdfjsTermExpression.js";
12
- import { snippets } from "./snippets.js";
13
10
  import { code, joinCode } from "./ts-poet-wrapper.js";
14
11
  export class ListType extends AbstractCollectionType {
15
12
  identifierNodeKind;
@@ -21,10 +18,10 @@ export class ListType extends AbstractCollectionType {
21
18
  this.toRdfTypes = toRdfTypes;
22
19
  }
23
20
  get valueSparqlConstructTriplesFunction() {
24
- return code `${snippets.listSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlConstructTriplesFunction})`;
21
+ return code `${this.reusables.snippets.listSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlConstructTriplesFunction})`;
25
22
  }
26
23
  get valueSparqlWherePatternsFunction() {
27
- return code `${snippets.listSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction})`;
24
+ return code `${this.reusables.snippets.listSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction})`;
28
25
  }
29
26
  fromRdfResourceValuesExpression({ variables, }) {
30
27
  return joinCode([
@@ -35,7 +32,7 @@ export class ListType extends AbstractCollectionType {
35
32
  valueList => ${this.itemType.fromRdfResourceValuesExpression({
36
33
  variables: {
37
34
  ...variables,
38
- resourceValues: code `${imports.Right}(${imports.Resource}.Values.fromArray({ focusResource: ${variables.resource}, propertyPath: ${variables.propertyPath}, values: valueList.toArray() }))`,
35
+ resourceValues: code `${this.reusables.imports.Right}(${this.reusables.imports.Resource}.Values.fromArray({ focusResource: ${variables.resource}, propertyPath: ${variables.propertyPath}, values: valueList.toArray() }))`,
39
36
  },
40
37
  })}
41
38
  ))`, // Resource.Values<Resource.Values> to Resource.Values<item type arrays>
@@ -52,12 +49,12 @@ export class ListType extends AbstractCollectionType {
52
49
  switch (this.identifierNodeKind) {
53
50
  case "BlankNode": {
54
51
  mintListIdentifierFunction =
55
- mintSubListIdentifierFunction = code `(() => ${imports.dataFactory}.blankNode())`;
56
- resourceTypeName = code `${imports.Resource}<${imports.BlankNode}>`;
52
+ mintSubListIdentifierFunction = code `(() => ${this.reusables.imports.dataFactory}.blankNode())`;
53
+ resourceTypeName = code `${this.reusables.imports.Resource}<${this.reusables.imports.BlankNode}>`;
57
54
  break;
58
55
  }
59
56
  case "IRI": {
60
- resourceTypeName = code `${imports.Resource}<${imports.NamedNode}>`;
57
+ resourceTypeName = code `${this.reusables.imports.Resource}<${this.reusables.imports.NamedNode}>`;
61
58
  throw new RangeError("list IRI minting is unsupported");
62
59
  }
63
60
  }
@@ -66,16 +63,16 @@ export class ListType extends AbstractCollectionType {
66
63
  currentSubListResource = listResource;
67
64
  } else {
68
65
  const newSubListResource = ${variables.resourceSet}.resource(${mintSubListIdentifierFunction}());
69
- currentSubListResource!.add(${rdfjsTermExpression(rdf.rest, { logger: this.logger })}, newSubListResource.identifier, ${variables.graph});
66
+ currentSubListResource!.add(${this.rdfjsTermExpression(rdf.rest)}, newSubListResource.identifier, ${variables.graph});
70
67
  currentSubListResource = newSubListResource;
71
68
  }
72
69
 
73
- ${joinCode(this.toRdfTypes.map((rdfType) => code `currentSubListResource.add(${rdfjsTermExpression(rdf.type, { logger: this.logger })}, ${imports.dataFactory}.namedNode("${rdfType.value}"), ${variables.graph})`))}
70
+ ${joinCode(this.toRdfTypes.map((rdfType) => code `currentSubListResource.add(${this.rdfjsTermExpression(rdf.type)}, ${this.reusables.imports.dataFactory}.namedNode("${rdfType.value}"), ${variables.graph})`))}
74
71
 
75
- currentSubListResource.add(${rdfjsTermExpression(rdf.first, { logger: this.logger })}, ${this.itemType.toRdfResourceValuesExpression({ variables: { graph: variables.graph, propertyPath: rdfjsTermExpression(rdf.first, { logger: this.logger }), resource: code `currentSubListResource`, resourceSet: variables.resourceSet, value: code `item` } })}, ${variables.graph});
72
+ currentSubListResource.add(${this.rdfjsTermExpression(rdf.first)}, ${this.itemType.toRdfResourceValuesExpression({ variables: { graph: variables.graph, propertyPath: this.rdfjsTermExpression(rdf.first), resource: code `currentSubListResource`, resourceSet: variables.resourceSet, value: code `item` } })}, ${variables.graph});
76
73
 
77
74
  if (itemIndex + 1 === list.length) {
78
- currentSubListResource.add(${rdfjsTermExpression(rdf.rest, { logger: this.logger })}, ${rdfjsTermExpression(rdf.nil, { logger: this.logger })}, ${variables.graph});
75
+ currentSubListResource.add(${this.rdfjsTermExpression(rdf.rest)}, ${this.rdfjsTermExpression(rdf.nil)}, ${variables.graph});
79
76
  }
80
77
 
81
78
  return { currentSubListResource, listResource };
@@ -87,7 +84,7 @@ export class ListType extends AbstractCollectionType {
87
84
  currentSubListResource: ${resourceTypeName} | null;
88
85
  listResource: ${resourceTypeName};
89
86
  },
90
- ).listResource.identifier : ${rdfjsTermExpression(rdf.nil, { logger: this.logger })}]`;
87
+ ).listResource.identifier : ${this.rdfjsTermExpression(rdf.nil)}]`;
91
88
  }
92
89
  toStringExpression({ variables, }) {
93
90
  return code `\`[\${${variables.value}.map(item => (${this.itemType.toStringExpression({ variables: { value: code `item` } })}))}]\``;
@@ -1,20 +1,18 @@
1
1
  import { xsd } from "@tpluscode/rdf-ns-builders";
2
2
  import { AbstractLiteralType } from "./AbstractLiteralType.js";
3
- import { imports } from "./imports.js";
4
- import { snippets } from "./snippets.js";
5
3
  import { code } from "./ts-poet-wrapper.js";
6
4
  export class LiteralType extends AbstractLiteralType {
7
- filterFunction = code `${snippets.filterLiteral}`;
8
- filterType = code `${snippets.LiteralFilter}`;
5
+ filterFunction = code `${this.reusables.snippets.filterLiteral}`;
6
+ filterType = code `${this.reusables.snippets.LiteralFilter}`;
9
7
  kind = "LiteralType";
10
- name = code `${imports.Literal}`;
11
- schemaType = code `${snippets.LiteralSchema}`;
12
- valueSparqlWherePatternsFunction = code `${snippets.literalSparqlWherePatterns}`;
8
+ name = code `${this.reusables.imports.Literal}`;
9
+ schemaType = code `${this.reusables.snippets.LiteralSchema}`;
10
+ valueSparqlWherePatternsFunction = code `${this.reusables.snippets.literalSparqlWherePatterns}`;
13
11
  get graphqlType() {
14
12
  throw new Error("not implemented");
15
13
  }
16
14
  fromJsonExpression({ variables, }) {
17
- return code `${imports.dataFactory}.literal(${variables.value}["@value"], ${variables.value}["@language"] !== undefined ? ${variables.value}["@language"] : (${variables.value}["@type"] !== undefined ? ${imports.dataFactory}.namedNode(${variables.value}["@type"]!) : undefined))`;
15
+ return code `${this.reusables.imports.dataFactory}.literal(${variables.value}["@value"], ${variables.value}["@language"] !== undefined ? ${variables.value}["@language"] : (${variables.value}["@type"] !== undefined ? ${this.reusables.imports.dataFactory}.namedNode(${variables.value}["@type"]!) : undefined))`;
18
16
  }
19
17
  graphqlResolveExpression(_parameters) {
20
18
  throw new Error("not implemented");
@@ -34,9 +32,9 @@ export class LiteralType extends AbstractLiteralType {
34
32
  }
35
33
  jsonSchema({ includeDiscriminantProperty, }) {
36
34
  const discriminantProperty = includeDiscriminantProperty
37
- ? code `, termType: ${imports.z}.literal("Literal")`
35
+ ? code `, termType: ${this.reusables.imports.z}.literal("Literal")`
38
36
  : "";
39
- return code `${imports.z}.object({ "@language": ${imports.z}.string().optional()${discriminantProperty}, "@type": ${imports.z}.string().optional(), "@value": ${imports.z}.string() })`;
37
+ return code `${this.reusables.imports.z}.object({ "@language": ${this.reusables.imports.z}.string().optional()${discriminantProperty}, "@type": ${this.reusables.imports.z}.string().optional(), "@value": ${this.reusables.imports.z}.string() })`;
40
38
  }
41
39
  toJsonExpression({ includeDiscriminantProperty, variables, }) {
42
40
  return code `{ "@language": ${variables.value}.language.length > 0 ? ${variables.value}.language : undefined${includeDiscriminantProperty ? `, "termType": "Literal" as const` : ""}, "@type": ${variables.value}.datatype.value !== "${xsd.string.value}" ? ${variables.value}.datatype.value : undefined, "@value": ${variables.value}.value }`;
@@ -12,7 +12,6 @@ import type { TsFeature } from "./TsFeature.js";
12
12
  import type { Type } from "./Type.js";
13
13
  import { type Code } from "./ts-poet-wrapper.js";
14
14
  export declare class NamedObjectType extends AbstractType {
15
- private readonly imports;
16
15
  protected readonly toRdfTypes: readonly NamedNode[];
17
16
  readonly extern: boolean;
18
17
  readonly features: ReadonlySet<TsFeature>;
@@ -24,13 +23,12 @@ export declare class NamedObjectType extends AbstractType {
24
23
  readonly recursive: boolean;
25
24
  readonly synthetic: boolean;
26
25
  readonly typeofs: NonEmptyList<"object">;
27
- constructor({ extern, features, fromRdfType, identifierType, imports, lazyAncestorObjectTypes, lazyChildObjectTypes, lazyDescendantObjectTypes, lazyDiscriminantProperty, lazyParentObjectTypes, lazyProperties, name, recursive, synthetic, toRdfTypes, ...superParameters }: {
26
+ constructor({ extern, features, fromRdfType, identifierType, lazyAncestorObjectTypes, lazyChildObjectTypes, lazyDescendantObjectTypes, lazyDiscriminantProperty, lazyParentObjectTypes, lazyProperties, name, recursive, synthetic, toRdfTypes, ...superParameters }: {
28
27
  comment: Maybe<string>;
29
28
  extern: boolean;
30
29
  features: ReadonlySet<TsFeature>;
31
30
  fromRdfType: Maybe<NamedNode>;
32
31
  identifierType: BlankNodeType | IdentifierType | IriType;
33
- imports: readonly string[];
34
32
  label: Maybe<string>;
35
33
  lazyAncestorObjectTypes: () => readonly NamedObjectType[];
36
34
  lazyChildObjectTypes: () => readonly NamedObjectType[];
@@ -42,11 +42,9 @@ import { NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration } from "
42
42
  import { NamedObjectType_valueSparqlWherePatternsFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js";
43
43
  import { ShaclProperty as _ShaclProperty } from "./_NamedObjectType/ShaclProperty.js";
44
44
  import { AbstractType } from "./AbstractType.js";
45
- import { imports } from "./imports.js";
46
45
  import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
47
46
  import { code, def, joinCode } from "./ts-poet-wrapper.js";
48
47
  export class NamedObjectType extends AbstractType {
49
- imports;
50
48
  toRdfTypes;
51
49
  extern;
52
50
  features;
@@ -58,13 +56,12 @@ export class NamedObjectType extends AbstractType {
58
56
  recursive;
59
57
  synthetic;
60
58
  typeofs = NonEmptyList(["object"]);
61
- constructor({ extern, features, fromRdfType, identifierType, imports, lazyAncestorObjectTypes, lazyChildObjectTypes, lazyDescendantObjectTypes, lazyDiscriminantProperty, lazyParentObjectTypes, lazyProperties, name, recursive, synthetic, toRdfTypes, ...superParameters }) {
59
+ constructor({ extern, features, fromRdfType, identifierType, lazyAncestorObjectTypes, lazyChildObjectTypes, lazyDescendantObjectTypes, lazyDiscriminantProperty, lazyParentObjectTypes, lazyProperties, name, recursive, synthetic, toRdfTypes, ...superParameters }) {
62
60
  super(superParameters);
63
61
  this.extern = extern;
64
62
  this.features = features;
65
63
  this.fromRdfType = fromRdfType;
66
64
  this.identifierType = identifierType;
67
- this.imports = imports;
68
65
  // Lazily initialize some members in getters to avoid recursive construction
69
66
  this.lazyAncestorObjectTypes = lazyAncestorObjectTypes;
70
67
  this.lazyChildObjectTypes = lazyChildObjectTypes;
@@ -98,9 +95,6 @@ export class NamedObjectType extends AbstractType {
98
95
  }
99
96
  get declaration() {
100
97
  const declarations = [];
101
- for (const import_ of this.imports) {
102
- declarations.push(code `${import_}`);
103
- }
104
98
  if (!this.extern) {
105
99
  const staticModuleDeclarations = [];
106
100
  declarations.push(NamedObjectType_interfaceDeclaration.call(this));
@@ -112,9 +106,19 @@ export class NamedObjectType extends AbstractType {
112
106
  ];
113
107
  staticModuleDeclarations.push(...NamedObjectType_graphqlTypeVariableStatement.call(this).toList(), ...identifierTypeDeclarations.call(this), ...NamedObjectType_jsonTypeAliasDeclaration.call(this).toList(), ...(jsonModuleDeclarations.length > 0
114
108
  ? [
115
- code `export namespace ${syntheticNamePrefix}Json { ${joinCode(jsonModuleDeclarations, { on: "\n\n" })} }`,
109
+ code `export namespace Json { ${joinCode(jsonModuleDeclarations, { on: "\n\n" })} }`,
116
110
  ]
117
- : []), NamedObjectType_filterFunctionDeclaration.call(this), NamedObjectType_filterTypeDeclaration.call(this), ...NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.bind(this)().toList(), ...NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.bind(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), ...NamedObjectType_propertiesFromJsonFunctionDeclaration.bind(this)().toList(), ...NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.bind(this)().toList(), NamedObjectType_schemaVariableStatement.call(this), ...NamedObjectType_sparqlConstructQueryFunctionDeclaration.bind(this)().toList(), ...NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.bind(this)().toList(), ...NamedObjectType_toJsonFunctionDeclaration.call(this).toList(), ...NamedObjectType_toRdfResourceFunctionDeclaration.call(this).toList(), ...NamedObjectType_toStringFunctionDeclarations.call(this), ...NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.bind(this)().toList(), ...NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.bind(this)().toList());
111
+ : []), NamedObjectType_filterFunctionDeclaration.call(this), NamedObjectType_filterTypeDeclaration.call(this), ...NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.bind(this)().toList(), ...NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.bind(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), ...NamedObjectType_propertiesFromJsonFunctionDeclaration.bind(this)().toList(), ...NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.bind(this)().toList(), NamedObjectType_schemaVariableStatement.call(this), ...NamedObjectType_sparqlConstructQueryFunctionDeclaration.bind({
112
+ features: this.features,
113
+ filterType: this.filterType,
114
+ name: this.name,
115
+ reusables: this.reusables,
116
+ })().toList(), ...NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.bind({
117
+ features: this.features,
118
+ filterType: this.filterType,
119
+ name: this.name,
120
+ reusables: this.reusables,
121
+ })().toList(), ...NamedObjectType_toJsonFunctionDeclaration.call(this).toList(), ...NamedObjectType_toRdfResourceFunctionDeclaration.call(this).toList(), ...NamedObjectType_toStringFunctionDeclarations.call(this), ...NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.bind(this)().toList(), ...NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.bind(this)().toList());
118
122
  if (staticModuleDeclarations.length > 0) {
119
123
  declarations.push(code `\
120
124
  export namespace ${def(this.name)} {
@@ -144,22 +148,22 @@ ${joinCode(staticModuleDeclarations, { on: "\n\n" })}
144
148
  return this.name;
145
149
  }
146
150
  get equalsFunction() {
147
- return code `${this.name}.${syntheticNamePrefix}equals`;
151
+ return code `${this.name}.equals`;
148
152
  }
149
153
  get filterFunction() {
150
- return code `${this.name}.${syntheticNamePrefix}filter`;
154
+ return code `${this.name}.filter`;
151
155
  }
152
156
  get filterType() {
153
- return code `${this.name}.${syntheticNamePrefix}Filter`;
157
+ return code `${this.name}.Filter`;
154
158
  }
155
159
  get fromRdfTypeVariable() {
156
- return this.fromRdfType.map(() => code `${this.name}.${syntheticNamePrefix}fromRdfType`);
160
+ return this.fromRdfType.map(() => code `${this.name}.fromRdfType`);
157
161
  }
158
162
  get graphqlType() {
159
- return new AbstractType.GraphqlType(code `${this.name}.${syntheticNamePrefix}GraphQL`);
163
+ return new AbstractType.GraphqlType(code `${this.name}.GraphQL`, this.reusables);
160
164
  }
161
165
  get identifierTypeAlias() {
162
- return code `${this.name}.${syntheticNamePrefix}Identifier`;
166
+ return code `${this.name}.Identifier`;
163
167
  }
164
168
  get mutable() {
165
169
  return this.properties.some((property) => property.mutable);
@@ -181,7 +185,7 @@ ${joinCode(staticModuleDeclarations, { on: "\n\n" })}
181
185
  return properties;
182
186
  }
183
187
  get schema() {
184
- return code `${this.name}.${syntheticNamePrefix}schema`;
188
+ return code `${this.name}.schema`;
185
189
  }
186
190
  get schemaType() {
187
191
  return code `typeof ${this.schema}`;
@@ -193,55 +197,53 @@ ${joinCode(staticModuleDeclarations, { on: "\n\n" })}
193
197
  if (this.parentObjectTypes.length > 0) {
194
198
  return this.parentObjectTypes[0].toRdfjsResourceType;
195
199
  }
196
- return code `${imports.Resource}${this.identifierType.kind === "IriType" ? code `<${imports.NamedNode}>` : ""}`;
200
+ return code `${this.reusables.imports.Resource}${this.identifierType.kind === "IriType" ? code `<${this.reusables.imports.NamedNode}>` : ""}`;
197
201
  }
198
202
  get valueSparqlConstructTriplesFunction() {
199
- return code `${this.name}.${syntheticNamePrefix}valueSparqlConstructTriples`;
203
+ return code `${this.name}.valueSparqlConstructTriples`;
200
204
  }
201
205
  get valueSparqlWherePatternsFunction() {
202
- return code `${this.name}.${syntheticNamePrefix}valueSparqlWherePatterns`;
206
+ return code `${this.name}.valueSparqlWherePatterns`;
203
207
  }
204
208
  get thisVariable() {
205
209
  return code `_${camelCase(this.name)}`;
206
210
  }
207
211
  fromJsonExpression({ variables, }) {
208
212
  // Assumes the JSON object has been recursively validated already.
209
- return code `${this.name}.${syntheticNamePrefix}fromJson(${variables.value})`;
213
+ return code `${this.name}.fromJson(${variables.value})`;
210
214
  }
211
215
  fromRdfResourceValuesExpression({ variables, }) {
212
216
  const { resourceValues, ...options } = variables;
213
- return code `${this.name}.${syntheticNamePrefix}fromRdfResourceValues(${resourceValues}, ${options})`;
217
+ return code `${this.name}.fromRdfResourceValues(${resourceValues}, ${options})`;
214
218
  }
215
219
  graphqlResolveExpression({ variables, }) {
216
220
  return variables.value;
217
221
  }
218
222
  hashStatements({ variables, }) {
219
- return [
220
- code `${this.name}.${syntheticNamePrefix}hash(${variables.value}, ${variables.hasher});`,
221
- ];
223
+ return [code `${this.name}.hash(${variables.value}, ${variables.hasher});`];
222
224
  }
223
225
  jsonSchema({ context, }) {
224
- let expression = code `${this.name}.${syntheticNamePrefix}Json.schema()`;
226
+ let expression = code `${this.name}.Json.schema()`;
225
227
  if (context === "property" &&
226
228
  this.properties.some((property) => property.recursive)) {
227
- expression = code `${imports.z}.lazy((): ${imports.z}.ZodType<${this.name}.${syntheticNamePrefix}Json> => ${expression})`;
229
+ expression = code `${this.reusables.imports.z}.lazy((): ${this.reusables.imports.z}.ZodType<${this.name}.Json> => ${expression})`;
228
230
  }
229
231
  return expression;
230
232
  }
231
233
  jsonType() {
232
- return new AbstractType.JsonType(code `${this.name}.${syntheticNamePrefix}Json`);
234
+ return new AbstractType.JsonType(code `${this.name}.Json`);
233
235
  }
234
236
  jsonUiSchemaElement({ variables, }) {
235
- return Maybe.of(code `${this.name}.${syntheticNamePrefix}Json.uiSchema({ scopePrefix: ${variables.scopePrefix} })`);
237
+ return Maybe.of(code `${this.name}.Json.uiSchema({ scopePrefix: ${variables.scopePrefix} })`);
236
238
  }
237
239
  toJsonExpression({ variables, }) {
238
- return code `${this.name}.${syntheticNamePrefix}toJson(${variables.value})`;
240
+ return code `${this.name}.toJson(${variables.value})`;
239
241
  }
240
242
  toStringExpression({ variables, }) {
241
243
  return code `${this.name}.${syntheticNamePrefix}toString(${variables.value})`;
242
244
  }
243
245
  toRdfResourceValuesExpression({ variables, }) {
244
- return code `[${this.name}.${syntheticNamePrefix}toRdfResource(${variables.value}, { graph: ${variables.graph}, resourceSet: ${variables.resourceSet} }).identifier]`;
246
+ return code `[${this.name}.toRdfResource(${variables.value}, { graph: ${variables.graph}, resourceSet: ${variables.resourceSet} }).identifier]`;
245
247
  }
246
248
  lazyAncestorObjectTypes;
247
249
  lazyChildObjectTypes;
@@ -13,9 +13,7 @@ import { NamedObjectType_sparqlConstructQueryFunctionDeclaration } from "./_Name
13
13
  import { NamedObjectType_sparqlConstructQueryStringFunctionDeclaration } from "./_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js";
14
14
  import { AbstractNamedUnionType } from "./AbstractNamedUnionType.js";
15
15
  import { AbstractType } from "./AbstractType.js";
16
- import { imports } from "./imports.js";
17
16
  import { singleEntryRecord } from "./singleEntryRecord.js";
18
- import { snippets } from "./snippets.js";
19
17
  import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
20
18
  import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
21
19
  export class NamedObjectUnionType extends AbstractNamedUnionType {
@@ -27,16 +25,16 @@ export class NamedObjectUnionType extends AbstractNamedUnionType {
27
25
  this.#identifierType = identifierType;
28
26
  }
29
27
  get graphqlType() {
30
- return new AbstractType.GraphqlType(code `${this._name}.${syntheticNamePrefix}GraphQL`);
28
+ return new AbstractType.GraphqlType(code `${this._name}.GraphQL`, this.reusables);
31
29
  }
32
30
  get identifierTypeAlias() {
33
- return code `${this.name}.${syntheticNamePrefix}Identifier`;
31
+ return code `${this.name}.Identifier`;
34
32
  }
35
33
  get objectSetMethodNames() {
36
34
  return NamedObjectType_objectSetMethodNames.call(this);
37
35
  }
38
36
  get schema() {
39
- return code `${this.name}.${syntheticNamePrefix}schema`;
37
+ return code `${this.name}.schema`;
40
38
  }
41
39
  get schemaType() {
42
40
  return code `typeof ${this.schema}`;
@@ -51,11 +49,21 @@ export class NamedObjectUnionType extends AbstractNamedUnionType {
51
49
  ...this.graphqlTypeVariableStatement,
52
50
  ...this.isTypeFunctionDeclaration,
53
51
  ...this.schemaVariableStatement,
54
- ...NamedObjectType_sparqlConstructQueryFunctionDeclaration.call(this)
55
- .map((code_) => singleEntryRecord(`${syntheticNamePrefix}sparqlConstructQuery`, code_))
52
+ ...NamedObjectType_sparqlConstructQueryFunctionDeclaration.call({
53
+ features: this.features,
54
+ filterType: this.filterType,
55
+ name: this.name,
56
+ reusables: this.reusables,
57
+ })
58
+ .map((code_) => singleEntryRecord(`sparqlConstructQuery`, code_))
56
59
  .orDefault({}),
57
- ...NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.call(this)
58
- .map((code_) => singleEntryRecord(`${syntheticNamePrefix}sparqlConstructQueryString`, code_))
60
+ ...NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.call({
61
+ features: this.features,
62
+ filterType: this.filterType,
63
+ name: this.name,
64
+ reusables: this.reusables,
65
+ })
66
+ .map((code_) => singleEntryRecord(`sparqlConstructQueryString`, code_))
59
67
  .orDefault({}),
60
68
  ...this.toRdfResourceFunctionDeclaration,
61
69
  };
@@ -64,19 +72,19 @@ export class NamedObjectUnionType extends AbstractNamedUnionType {
64
72
  if (!this.features.has("sparql")) {
65
73
  return {};
66
74
  }
67
- return singleEntryRecord(`${syntheticNamePrefix}focusSparqlConstructTriples`, code `\
68
- export function ${syntheticNamePrefix}focusSparqlConstructTriples({ filter, focusIdentifier, variablePrefix }: { filter: ${this.filterType} | undefined; focusIdentifier: ${imports.NamedNode} | ${imports.Variable}; ignoreRdfType: boolean; variablePrefix: string }): readonly ${imports.sparqljs}.Triple[] {
69
- return [${joinCode(this.members.map((member) => code `...${member.type.name}.${syntheticNamePrefix}focusSparqlConstructTriples({ filter: filter?.on?.${member.type.name}, focusIdentifier, ignoreRdfType: false, variablePrefix: \`\${variablePrefix}${pascalCase(member.type.name)}\` }).concat()`), { on: ", " })}];
75
+ return singleEntryRecord(`focusSparqlConstructTriples`, code `\
76
+ export function focusSparqlConstructTriples({ filter, focusIdentifier, variablePrefix }: { filter: ${this.filterType} | undefined; focusIdentifier: ${this.reusables.imports.NamedNode} | ${this.reusables.imports.Variable}; ignoreRdfType: boolean; variablePrefix: string }): readonly ${this.reusables.imports.sparqljs}.Triple[] {
77
+ return [${joinCode(this.members.map((member) => code `...${member.type.name}.focusSparqlConstructTriples({ filter: filter?.on?.${member.type.name}, focusIdentifier, ignoreRdfType: false, variablePrefix: \`\${variablePrefix}${pascalCase(member.type.name)}\` }).concat()`), { on: ", " })}];
70
78
  }`);
71
79
  }
72
80
  get focusSparqlWherePatternsFunctionDeclaration() {
73
81
  if (!this.features.has("sparql")) {
74
82
  return {};
75
83
  }
76
- return singleEntryRecord(`${syntheticNamePrefix}focusSparqlWherePatterns`, code `\
77
- export function ${syntheticNamePrefix}focusSparqlWherePatterns({ filter, focusIdentifier, preferredLanguages, variablePrefix }: { filter: ${this.filterType} | undefined; focusIdentifier: ${imports.NamedNode} | ${imports.Variable}; ignoreRdfType: boolean; preferredLanguages: readonly string[] | undefined; variablePrefix: string }): readonly ${snippets.SparqlPattern}[] {
84
+ return singleEntryRecord(`focusSparqlWherePatterns`, code `\
85
+ export function focusSparqlWherePatterns({ filter, focusIdentifier, preferredLanguages, variablePrefix }: { filter: ${this.filterType} | undefined; focusIdentifier: ${this.reusables.imports.NamedNode} | ${this.reusables.imports.Variable}; ignoreRdfType: boolean; preferredLanguages: readonly string[] | undefined; variablePrefix: string }): readonly ${this.reusables.snippets.SparqlPattern}[] {
78
86
  ${joinCode([
79
- code `let patterns: ${snippets.SparqlPattern}[] = [];`,
87
+ code `let patterns: ${this.reusables.snippets.SparqlPattern}[] = [];`,
80
88
  code `\
81
89
  if (focusIdentifier.termType === "Variable") {
82
90
  patterns = patterns.concat(${this.#identifierType.valueSparqlWherePatternsFunction}({
@@ -90,7 +98,7 @@ if (focusIdentifier.termType === "Variable") {
90
98
  }));
91
99
  }`,
92
100
  code `patterns.push({ patterns: [${joinCode(this.members.map((member) => code `${{
93
- patterns: code `${member.type.name}.${syntheticNamePrefix}focusSparqlWherePatterns({ filter: filter?.on?.${member.type.name}, focusIdentifier, ignoreRdfType: false, preferredLanguages, variablePrefix: \`\${variablePrefix}${pascalCase(member.type.name)}\` }).concat()`,
101
+ patterns: code `${member.type.name}.focusSparqlWherePatterns({ filter: filter?.on?.${member.type.name}, focusIdentifier, ignoreRdfType: false, preferredLanguages, variablePrefix: \`\${variablePrefix}${pascalCase(member.type.name)}\` }).concat()`,
94
102
  type: literalOf("group"),
95
103
  }}`), { on: ", " })}], type: "union" });`,
96
104
  code `return patterns;`,
@@ -101,10 +109,10 @@ if (focusIdentifier.termType === "Variable") {
101
109
  if (!this.features.has("rdf")) {
102
110
  return {};
103
111
  }
104
- return singleEntryRecord(`${syntheticNamePrefix}fromRdfResource`, code `\
105
- export const ${syntheticNamePrefix}fromRdfResource: ${snippets.FromRdfResourceFunction}<${this.name}> = (resource, options) =>
112
+ return singleEntryRecord(`fromRdfResource`, code `\
113
+ export const fromRdfResource: ${this.reusables.snippets.FromRdfResourceFunction}<${this.name}> = (resource, options) =>
106
114
  ${this.members.reduce((expression, member) => {
107
- const memberTypeExpression = code `(${member.type.name}.${syntheticNamePrefix}fromRdfResource(resource, { ...options, ignoreRdfType: false }) as ${imports.Either}<Error, ${this.name}>)`;
115
+ const memberTypeExpression = code `(${member.type.name}.fromRdfResource(resource, { ...options, ignoreRdfType: false }) as ${this.reusables.imports.Either}<Error, ${this.name}>)`;
108
116
  return expression !== null
109
117
  ? code `${expression}.altLazy(() => ${memberTypeExpression})`
110
118
  : memberTypeExpression;
@@ -114,8 +122,8 @@ export const ${syntheticNamePrefix}fromRdfResource: ${snippets.FromRdfResourceFu
114
122
  if (!this.features.has("graphql")) {
115
123
  return {};
116
124
  }
117
- return singleEntryRecord(`${syntheticNamePrefix}GraphQL`, code `\
118
- export const ${syntheticNamePrefix}GraphQL = new ${imports.GraphQLUnionType}(${{
125
+ return singleEntryRecord(`GraphQL`, code `\
126
+ export const GraphQL = new ${this.reusables.imports.GraphQLUnionType}(${{
119
127
  description: this.comment.map(JSON.stringify).extract(),
120
128
  name: this.name,
121
129
  resolveType: code `(value: ${this.name}) => value.${syntheticNamePrefix}type`,
@@ -123,9 +131,9 @@ export const ${syntheticNamePrefix}GraphQL = new ${imports.GraphQLUnionType}(${{
123
131
  }});`);
124
132
  }
125
133
  get identifierTypeDeclarations() {
126
- return singleEntryRecord(`${syntheticNamePrefix}Identifier`, code `\
127
- export type ${syntheticNamePrefix}Identifier = ${this.#identifierType.name};
128
- export namespace ${syntheticNamePrefix}Identifier {
134
+ return singleEntryRecord(`Identifier`, code `\
135
+ export type Identifier = ${this.#identifierType.name};
136
+ export namespace Identifier {
129
137
  export const parse = ${this.#identifierType.parseFunction};
130
138
  export const stringify = ${this.#identifierType.stringifyFunction};
131
139
  }`);
@@ -169,8 +177,8 @@ export namespace ${syntheticNamePrefix}Identifier {
169
177
  }
170
178
  propertiesObject.push(code `${property.name}: ${property.schema}`);
171
179
  }
172
- return singleEntryRecord(`${syntheticNamePrefix}schema`, code `\
173
- export const ${syntheticNamePrefix}schema =
180
+ return singleEntryRecord(`schema`, code `\
181
+ export const schema =
174
182
  ${{
175
183
  ...super.schemaObject,
176
184
  properties: code `{ ${joinCode(propertiesObject, { on: ", " })} }`,
@@ -180,10 +188,10 @@ ${{
180
188
  if (!this.features.has("rdf")) {
181
189
  return {};
182
190
  }
183
- return singleEntryRecord(`${syntheticNamePrefix}toRdfResource`, code `\
184
- export const ${syntheticNamePrefix}toRdfResource: ${snippets.ToRdfResourceFunction}<${this.name}> = (value, options) => {
191
+ return singleEntryRecord(`toRdfResource`, code `\
192
+ export const toRdfResource: ${this.reusables.snippets.ToRdfResourceFunction}<${this.name}> = (value, options) => {
185
193
  ${joinCode(this.members
186
- .map((member) => code `if (${member.type.name}.is${member.type.name}(value)) { return ${member.type.name}.${syntheticNamePrefix}toRdfResource(value, options); }`)
194
+ .map((member) => code `if (${member.type.name}.is${member.type.name}(value)) { return ${member.type.name}.toRdfResource(value, options); }`)
187
195
  .concat(code `throw new Error("unrecognized type");`))}
188
196
  };`);
189
197
  }
@@ -10,8 +10,6 @@ import { Memoize } from "typescript-memoize";
10
10
  import { AbstractCollectionType } from "./AbstractCollectionType.js";
11
11
  import { AbstractContainerType } from "./AbstractContainerType.js";
12
12
  import { codeEquals } from "./codeEquals.js";
13
- import { imports } from "./imports.js";
14
- import { snippets } from "./snippets.js";
15
13
  import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
16
14
  export class OptionType extends AbstractContainerType {
17
15
  discriminantProperty = Maybe.empty();
@@ -22,14 +20,14 @@ export class OptionType extends AbstractContainerType {
22
20
  const conversions = [];
23
21
  conversions.push({
24
22
  conversionExpression: (value) => value,
25
- sourceTypeCheckExpression: (value) => code `${imports.Maybe}.isMaybe(${value})`,
23
+ sourceTypeCheckExpression: (value) => code `${this.reusables.imports.Maybe}.isMaybe(${value})`,
26
24
  sourceTypeName: this.name,
27
25
  sourceTypeof: "object",
28
26
  });
29
27
  for (const itemTypeConversion of this.itemType.conversions) {
30
28
  conversions.push({
31
29
  ...itemTypeConversion,
32
- conversionExpression: (value) => code `${imports.Maybe}.of(${itemTypeConversion.conversionExpression(value)})`,
30
+ conversionExpression: (value) => code `${this.reusables.imports.Maybe}.of(${itemTypeConversion.conversionExpression(value)})`,
33
31
  });
34
32
  }
35
33
  // Unless itemType is a list, it should only have a conversion from undefined if it has a
@@ -38,7 +36,7 @@ export class OptionType extends AbstractContainerType {
38
36
  invariant(!conversions.some((conversion) => conversion.sourceTypeof === "undefined") || this.itemType instanceof AbstractCollectionType);
39
37
  if (!conversions.some((conversion) => conversion.sourceTypeof === "undefined")) {
40
38
  conversions.push({
41
- conversionExpression: () => code `${imports.Maybe}.empty()`,
39
+ conversionExpression: () => code `${this.reusables.imports.Maybe}.empty()`,
42
40
  sourceTypeCheckExpression: (value) => code `${value} === undefined`,
43
41
  sourceTypeName: code `undefined`,
44
42
  sourceTypeof: "undefined",
@@ -47,17 +45,17 @@ export class OptionType extends AbstractContainerType {
47
45
  return conversions;
48
46
  }
49
47
  get equalsFunction() {
50
- return code `((left, right) => ${snippets.maybeEquals}(left, right, ${this.itemType.equalsFunction}))`;
48
+ return code `((left, right) => ${this.reusables.snippets.maybeEquals}(left, right, ${this.itemType.equalsFunction}))`;
51
49
  }
52
50
  get filterFunction() {
53
- return code `${snippets.filterMaybe}<${this.itemType.name}, ${this.itemType.filterType}>(${this.itemType.filterFunction})`;
51
+ return code `${this.reusables.snippets.filterMaybe}<${this.itemType.name}, ${this.itemType.filterType}>(${this.itemType.filterFunction})`;
54
52
  }
55
53
  get filterType() {
56
- return code `${snippets.MaybeFilter}<${this.itemType.filterType}>`;
54
+ return code `${this.reusables.snippets.MaybeFilter}<${this.itemType.filterType}>`;
57
55
  }
58
56
  get graphqlType() {
59
57
  invariant(!this.itemType.graphqlType.nullable);
60
- return new AbstractContainerType.GraphqlType(this.itemType.graphqlType.name, {
58
+ return new AbstractContainerType.GraphqlType(this.itemType.graphqlType.name, this.reusables, {
61
59
  nullable: true,
62
60
  });
63
61
  }
@@ -65,16 +63,16 @@ export class OptionType extends AbstractContainerType {
65
63
  return this.itemType.mutable;
66
64
  }
67
65
  get name() {
68
- return code `${imports.Maybe}<${this.itemType.name}>`;
66
+ return code `${this.reusables.imports.Maybe}<${this.itemType.name}>`;
69
67
  }
70
68
  get schemaType() {
71
- return code `${snippets.MaybeSchema}<${this.itemType.schemaType}>`;
69
+ return code `${this.reusables.snippets.MaybeSchema}<${this.itemType.schemaType}>`;
72
70
  }
73
71
  get valueSparqlConstructTriplesFunction() {
74
- return code `${snippets.maybeSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlConstructTriplesFunction})`;
72
+ return code `${this.reusables.snippets.maybeSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlConstructTriplesFunction})`;
75
73
  }
76
74
  get valueSparqlWherePatternsFunction() {
77
- return code `${snippets.maybeSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction})`;
75
+ return code `${this.reusables.snippets.maybeSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction})`;
78
76
  }
79
77
  get schemaObject() {
80
78
  return {
@@ -83,7 +81,7 @@ export class OptionType extends AbstractContainerType {
83
81
  };
84
82
  }
85
83
  fromJsonExpression({ variables, }) {
86
- const expression = code `${imports.Maybe}.fromNullable(${variables.value})`;
84
+ const expression = code `${this.reusables.imports.Maybe}.fromNullable(${variables.value})`;
87
85
  const valueVariable = code `item`;
88
86
  const itemFromJsonExpression = this.itemType.fromJsonExpression({
89
87
  variables: { value: valueVariable },
@@ -94,7 +92,7 @@ export class OptionType extends AbstractContainerType {
94
92
  }
95
93
  fromRdfResourceValuesExpression(parameters) {
96
94
  const { variables } = parameters;
97
- return code `${this.itemType.fromRdfResourceValuesExpression(parameters)}.map(values => values.length > 0 ? values.map(value => ${imports.Maybe}.of(value)) : ${imports.Resource}.Values.fromValue<${imports.Maybe}<${this.itemType.name}>>({ focusResource: ${variables.resource}, propertyPath: ${variables.propertyPath}, value: ${imports.Maybe}.empty() }))`;
95
+ return code `${this.itemType.fromRdfResourceValuesExpression(parameters)}.map(values => values.length > 0 ? values.map(value => ${this.reusables.imports.Maybe}.of(value)) : ${this.reusables.imports.Resource}.Values.fromValue<${this.reusables.imports.Maybe}<${this.itemType.name}>>({ focusResource: ${variables.resource}, propertyPath: ${variables.propertyPath}, value: ${this.reusables.imports.Maybe}.empty() }))`;
98
96
  }
99
97
  graphqlResolveExpression(parameters) {
100
98
  return code `${this.itemType.graphqlResolveExpression(parameters)}.extractNullable()`;
@@ -0,0 +1,11 @@
1
+ import type { Logger } from "ts-log";
2
+ import { Imports } from "./Imports.js";
3
+ import { Snippets } from "./Snippets.js";
4
+ export declare class Reusables {
5
+ readonly imports: Imports;
6
+ readonly snippets: Snippets;
7
+ constructor({ logger }: {
8
+ logger: Logger;
9
+ });
10
+ }
11
+ //# sourceMappingURL=Reusables.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { Imports } from "./Imports.js";
2
+ import { Snippets } from "./Snippets.js";
3
+ export class Reusables {
4
+ imports;
5
+ snippets;
6
+ constructor({ logger }) {
7
+ this.imports = new Imports();
8
+ this.snippets = new Snippets({
9
+ imports: this.imports,
10
+ logger,
11
+ });
12
+ }
13
+ }
14
+ //# sourceMappingURL=Reusables.js.map
@@ -7,8 +7,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { Maybe } from "purify-ts";
8
8
  import { Memoize } from "typescript-memoize";
9
9
  import { AbstractCollectionType } from "./AbstractCollectionType.js";
10
- import { imports } from "./imports.js";
11
- import { snippets } from "./snippets.js";
12
10
  import { code, joinCode } from "./ts-poet-wrapper.js";
13
11
  export class SetType extends AbstractCollectionType {
14
12
  graphqlArgs = Maybe.empty();
@@ -26,10 +24,10 @@ export class SetType extends AbstractCollectionType {
26
24
  return conversions.concat(super.conversions);
27
25
  }
28
26
  get valueSparqlConstructTriplesFunction() {
29
- return code `${snippets.setSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlConstructTriplesFunction})`;
27
+ return code `${this.reusables.snippets.setSparqlConstructTriples}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlConstructTriplesFunction})`;
30
28
  }
31
29
  get valueSparqlWherePatternsFunction() {
32
- return code `${snippets.setSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction})`;
30
+ return code `${this.reusables.snippets.setSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction})`;
33
31
  }
34
32
  fromRdfResourceValuesExpression(parameters) {
35
33
  const { variables } = parameters;
@@ -40,9 +38,9 @@ export class SetType extends AbstractCollectionType {
40
38
  chain.push(code `map(values => values.toArray()${this._mutable ? ".concat()" : ""})`);
41
39
  }
42
40
  else {
43
- chain.push(code `chain(values => ${imports.NonEmptyList}.fromArray(values.toArray()).toEither(new Error(\`\${${variables.resource}.identifier} is an empty set\`)))`);
41
+ chain.push(code `chain(values => ${this.reusables.imports.NonEmptyList}.fromArray(values.toArray()).toEither(new Error(\`\${${variables.resource}.identifier} is an empty set\`)))`);
44
42
  }
45
- chain.push(code `map(valuesArray => ${imports.Resource}.Values.fromValue({ focusResource: ${variables.resource}, propertyPath: ${variables.propertyPath}, value: valuesArray }))`);
43
+ chain.push(code `map(valuesArray => ${this.reusables.imports.Resource}.Values.fromValue({ focusResource: ${variables.resource}, propertyPath: ${variables.propertyPath}, value: valuesArray }))`);
46
44
  return joinCode(chain, { on: "." });
47
45
  }
48
46
  jsonType() {
@@ -0,0 +1,3 @@
1
+ import type { conditionalOutput } from "./ts-poet-wrapper.js";
2
+ export type Snippet = ReturnType<typeof conditionalOutput>;
3
+ //# sourceMappingURL=Snippet.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Snippet.js.map