@shaclmate/compiler 4.0.8 → 4.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) hide show
  1. package/dist/Compiler.d.ts +1 -4
  2. package/dist/Compiler.js +1 -5
  3. package/dist/ShapesGraphToAstTransformer.d.ts +2 -11
  4. package/dist/ShapesGraphToAstTransformer.js +25 -27
  5. package/dist/_ShapesGraphToAstTransformer/defaultNodeShapeNodeKinds.d.ts +3 -0
  6. package/dist/_ShapesGraphToAstTransformer/defaultNodeShapeNodeKinds.js +5 -0
  7. package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.d.ts +4 -0
  8. package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.js +27 -0
  9. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +74 -19
  10. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.d.ts +1 -1
  11. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +45 -91
  12. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.d.ts +11 -0
  13. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +146 -0
  14. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.d.ts +7 -0
  15. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +182 -0
  16. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +9 -7
  17. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.d.ts +3 -5
  18. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +33 -10
  19. package/dist/ast/AbstractCompoundType.d.ts +26 -8
  20. package/dist/ast/AbstractCompoundType.js +84 -16
  21. package/dist/ast/AbstractContainerType.d.ts +2 -4
  22. package/dist/ast/AbstractContainerType.js +3 -4
  23. package/dist/ast/AbstractLazyObjectType.d.ts +1 -0
  24. package/dist/ast/AbstractLazyObjectType.js +3 -0
  25. package/dist/ast/AbstractTermType.d.ts +1 -0
  26. package/dist/ast/AbstractTermType.js +1 -0
  27. package/dist/ast/AbstractType.d.ts +16 -1
  28. package/dist/ast/AbstractType.js +11 -1
  29. package/dist/ast/Ast.d.ts +4 -4
  30. package/dist/ast/BlankNodeType.d.ts +1 -1
  31. package/dist/ast/DefaultValueType.d.ts +1 -2
  32. package/dist/ast/DefaultValueType.js +2 -0
  33. package/dist/ast/IdentifierType.d.ts +1 -1
  34. package/dist/ast/IntersectionType.d.ts +7 -2
  35. package/dist/ast/IntersectionType.js +8 -0
  36. package/dist/ast/ListType.d.ts +2 -9
  37. package/dist/ast/ListType.js +1 -9
  38. package/dist/ast/LiteralType.d.ts +1 -0
  39. package/dist/ast/LiteralType.js +26 -0
  40. package/dist/ast/ObjectCompoundType.d.ts +12 -0
  41. package/dist/ast/ObjectCompoundType.js +88 -0
  42. package/dist/ast/ObjectIntersectionType.d.ts +3 -7
  43. package/dist/ast/ObjectIntersectionType.js +1 -7
  44. package/dist/ast/ObjectType.d.ts +14 -31
  45. package/dist/ast/ObjectType.js +41 -73
  46. package/dist/ast/ObjectUnionType.d.ts +3 -7
  47. package/dist/ast/ObjectUnionType.js +1 -7
  48. package/dist/ast/OptionType.d.ts +1 -2
  49. package/dist/ast/OptionType.js +2 -0
  50. package/dist/ast/SetType.d.ts +1 -2
  51. package/dist/ast/SetType.js +2 -0
  52. package/dist/ast/Type.d.ts +1 -4
  53. package/dist/ast/Type.js +0 -6
  54. package/dist/ast/UnionType.d.ts +11 -6
  55. package/dist/ast/UnionType.js +6 -4
  56. package/dist/ast/index.d.ts +1 -2
  57. package/dist/ast/index.js +1 -2
  58. package/dist/generators/json/AstJsonGenerator.js +16 -14
  59. package/dist/generators/ts/AbstractCollectionType.js +8 -10
  60. package/dist/generators/ts/AbstractContainerType.d.ts +8 -3
  61. package/dist/generators/ts/AbstractContainerType.js +9 -2
  62. package/dist/generators/ts/AbstractDateType.d.ts +2 -2
  63. package/dist/generators/ts/AbstractDateType.js +2 -2
  64. package/dist/generators/ts/AbstractIdentifierType.d.ts +1 -1
  65. package/dist/generators/ts/AbstractIdentifierType.js +1 -1
  66. package/dist/generators/ts/AbstractLazyObjectType.d.ts +11 -8
  67. package/dist/generators/ts/AbstractLazyObjectType.js +19 -14
  68. package/dist/generators/ts/AbstractNamedUnionType.d.ts +33 -0
  69. package/dist/generators/ts/AbstractNamedUnionType.js +193 -0
  70. package/dist/generators/ts/AbstractNumericType.d.ts +2 -2
  71. package/dist/generators/ts/AbstractNumericType.js +3 -3
  72. package/dist/generators/ts/AbstractTermType.d.ts +7 -4
  73. package/dist/generators/ts/AbstractTermType.js +7 -4
  74. package/dist/generators/ts/AbstractType.d.ts +29 -14
  75. package/dist/generators/ts/AbstractUnionType.d.ts +80 -0
  76. package/dist/generators/ts/AbstractUnionType.js +514 -0
  77. package/dist/generators/ts/AnonymousUnionType.d.ts +26 -0
  78. package/dist/generators/ts/AnonymousUnionType.js +56 -0
  79. package/dist/generators/ts/BigDecimalType.d.ts +3 -3
  80. package/dist/generators/ts/BigDecimalType.js +3 -3
  81. package/dist/generators/ts/BlankNodeType.d.ts +1 -1
  82. package/dist/generators/ts/BlankNodeType.js +1 -1
  83. package/dist/generators/ts/BooleanType.d.ts +2 -2
  84. package/dist/generators/ts/BooleanType.js +2 -2
  85. package/dist/generators/ts/DefaultValueType.d.ts +4 -4
  86. package/dist/generators/ts/DefaultValueType.js +14 -13
  87. package/dist/generators/ts/IdentifierType.d.ts +1 -1
  88. package/dist/generators/ts/IdentifierType.js +1 -1
  89. package/dist/generators/ts/IriType.d.ts +1 -1
  90. package/dist/generators/ts/IriType.js +1 -1
  91. package/dist/generators/ts/LazyObjectOptionType.d.ts +1 -1
  92. package/dist/generators/ts/LazyObjectOptionType.js +9 -9
  93. package/dist/generators/ts/LazyObjectSetType.d.ts +1 -1
  94. package/dist/generators/ts/LazyObjectSetType.js +7 -7
  95. package/dist/generators/ts/LazyObjectType.d.ts +1 -1
  96. package/dist/generators/ts/LazyObjectType.js +7 -8
  97. package/dist/generators/ts/ListType.d.ts +8 -7
  98. package/dist/generators/ts/ListType.js +14 -13
  99. package/dist/generators/ts/LiteralType.d.ts +1 -1
  100. package/dist/generators/ts/LiteralType.js +2 -2
  101. package/dist/generators/ts/NamedObjectUnionType.d.ts +35 -0
  102. package/dist/generators/ts/NamedObjectUnionType.js +221 -0
  103. package/dist/generators/ts/NamedUnionType.d.ts +11 -0
  104. package/dist/generators/ts/NamedUnionType.js +13 -0
  105. package/dist/generators/ts/ObjectType.d.ts +34 -25
  106. package/dist/generators/ts/ObjectType.js +62 -52
  107. package/dist/generators/ts/OptionType.d.ts +4 -4
  108. package/dist/generators/ts/OptionType.js +10 -10
  109. package/dist/generators/ts/SetType.d.ts +4 -4
  110. package/dist/generators/ts/SetType.js +13 -11
  111. package/dist/generators/ts/StringType.d.ts +2 -2
  112. package/dist/generators/ts/StringType.js +2 -2
  113. package/dist/generators/ts/TermType.d.ts +1 -1
  114. package/dist/generators/ts/TermType.js +2 -2
  115. package/dist/generators/ts/TsGenerator.js +23 -15
  116. package/dist/generators/ts/Type.d.ts +4 -3
  117. package/dist/generators/ts/TypeFactory.d.ts +7 -5
  118. package/dist/generators/ts/TypeFactory.js +117 -90
  119. package/dist/generators/ts/ZodGenerator.js +6 -6
  120. package/dist/generators/ts/_ObjectType/AbstractProperty.d.ts +3 -3
  121. package/dist/generators/ts/_ObjectType/{TypeDiscriminantProperty.d.ts → DiscriminantProperty.d.ts} +14 -14
  122. package/dist/generators/ts/_ObjectType/{TypeDiscriminantProperty.js → DiscriminantProperty.js} +10 -10
  123. package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.d.ts +2 -2
  124. package/dist/generators/ts/_ObjectType/IdentifierPrefixProperty.js +2 -2
  125. package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +2 -2
  126. package/dist/generators/ts/_ObjectType/IdentifierProperty.js +7 -4
  127. package/dist/generators/ts/_ObjectType/ObjectType_classDeclaration.js +8 -8
  128. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
  129. package/dist/generators/ts/_ObjectType/{ObjectType_sparqlConstructTriplesFunctionDeclaration.js → ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js} +6 -5
  130. package/dist/generators/ts/_ObjectType/ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
  131. package/dist/generators/ts/_ObjectType/{ObjectType_sparqlWherePatternsFunctionDeclarations.js → ObjectType_focusSparqlWherePatternsFunctionDeclaration.js} +5 -5
  132. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.d.ts +5 -0
  133. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.js +20 -0
  134. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +5 -0
  135. package/dist/generators/ts/_ObjectType/{ObjectType_fromRdfFunctionDeclaration.js → ObjectType_fromRdfResourceFunctionDeclaration.js} +6 -7
  136. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +5 -0
  137. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.js +20 -0
  138. package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.js +2 -2
  139. package/dist/generators/ts/_ObjectType/ObjectType_parseJsonFunctionDeclaration.d.ts +5 -0
  140. package/dist/generators/ts/_ObjectType/ObjectType_parseJsonFunctionDeclaration.js +19 -0
  141. package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromJsonFunctionDeclaration.d.ts +5 -0
  142. package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromJsonFunctionDeclaration.js +38 -0
  143. package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromRdfResourceFunctionDeclaration.d.ts +5 -0
  144. package/dist/generators/ts/_ObjectType/{ObjectType_propertiesFromRdfFunctionDeclaration.js → ObjectType_propertiesFromRdfResourceFunctionDeclaration.js} +16 -15
  145. package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.js +1 -2
  146. package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js +2 -2
  147. package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionOrMethodDeclaration.d.ts +5 -0
  148. package/dist/generators/ts/_ObjectType/{ObjectType_toRdfFunctionOrMethodDeclaration.js → ObjectType_toRdfResourceFunctionOrMethodDeclaration.js} +10 -8
  149. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
  150. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +13 -0
  151. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
  152. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.js +15 -0
  153. package/dist/generators/ts/_ObjectType/Property.d.ts +2 -2
  154. package/dist/generators/ts/_ObjectType/ShaclProperty.d.ts +2 -2
  155. package/dist/generators/ts/_ObjectType/ShaclProperty.js +6 -6
  156. package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.d.ts +2 -0
  157. package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.js +12 -0
  158. package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.d.ts +2 -0
  159. package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.js +14 -0
  160. package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.d.ts +2 -0
  161. package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.js +15 -0
  162. package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.d.ts +2 -0
  163. package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.js +17 -0
  164. package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.d.ts +2 -0
  165. package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.js +15 -0
  166. package/dist/generators/ts/_snippets/snippets_PropertyPath.d.ts +5 -0
  167. package/dist/generators/ts/_snippets/snippets_PropertyPath.js +35 -0
  168. package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +2 -2
  169. package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.d.ts +2 -0
  170. package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.js +7 -0
  171. package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.d.ts +2 -0
  172. package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.js +16 -0
  173. package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.d.ts +2 -0
  174. package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.js +13 -0
  175. package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.d.ts +2 -0
  176. package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.js +16 -0
  177. package/dist/generators/ts/_snippets/snippets_bigDecimalSparqlWherePatterns.js +2 -2
  178. package/dist/generators/ts/_snippets/snippets_blankNodeSparqlWherePatterns.js +2 -2
  179. package/dist/generators/ts/_snippets/snippets_booleanEquals.js +1 -1
  180. package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.js +2 -2
  181. package/dist/generators/ts/_snippets/snippets_dateSparqlWherePatterns.js +2 -2
  182. package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +2 -2
  183. package/dist/generators/ts/_snippets/snippets_fromRdfLanguageIn.js +1 -1
  184. package/dist/generators/ts/_snippets/snippets_identifierSparqlWherePatterns.js +2 -2
  185. package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.js +2 -2
  186. package/dist/generators/ts/_snippets/snippets_listSparqlConstructTriples.js +2 -2
  187. package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.js +2 -2
  188. package/dist/generators/ts/_snippets/snippets_literalSparqlWherePatterns.js +2 -2
  189. package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.js +2 -2
  190. package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.js +2 -2
  191. package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.js +2 -3
  192. package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.js +2 -2
  193. package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.js +2 -2
  194. package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.js +4 -3
  195. package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.js +4 -3
  196. package/dist/generators/ts/_snippets/snippets_sparqlPropertyPath.js +3 -2
  197. package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.js +2 -2
  198. package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.js +2 -2
  199. package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +2 -2
  200. package/dist/generators/ts/graphqlSchemaVariableStatement.js +4 -4
  201. package/dist/generators/ts/imports.d.ts +1 -1
  202. package/dist/generators/ts/imports.js +1 -1
  203. package/dist/generators/ts/objectSetDeclarations.d.ts +3 -3
  204. package/dist/generators/ts/objectSetDeclarations.js +15 -15
  205. package/dist/generators/ts/objectSetInterfaceDeclaration.d.ts +3 -3
  206. package/dist/generators/ts/objectSetInterfaceDeclaration.js +2 -2
  207. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.d.ts +3 -3
  208. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +16 -17
  209. package/dist/generators/ts/snippets.d.ts +10 -6
  210. package/dist/generators/ts/snippets.js +20 -12
  211. package/dist/generators/ts/sparqlObjectSetClassDeclaration.d.ts +3 -3
  212. package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +7 -8
  213. package/dist/generators/ts/synthesizeUberObjectUnionType.d.ts +2 -2
  214. package/dist/generators/ts/synthesizeUberObjectUnionType.js +9 -4
  215. package/dist/input/NodeShape.d.ts +0 -1
  216. package/dist/input/NodeShape.js +0 -3
  217. package/dist/input/ShapesGraph.d.ts +3 -2
  218. package/dist/input/ShapesGraph.js +12 -7
  219. package/dist/input/generated.d.ts +1899 -88
  220. package/dist/input/generated.js +676 -564
  221. package/package.json +3 -5
  222. package/dist/_ShapesGraphToAstTransformer/CurieFactory.d.ts +0 -16
  223. package/dist/_ShapesGraphToAstTransformer/CurieFactory.js +0 -45
  224. package/dist/_ShapesGraphToAstTransformer/NodeShapeAstType.d.ts +0 -3
  225. package/dist/_ShapesGraphToAstTransformer/NodeShapeAstType.js +0 -2
  226. package/dist/_ShapesGraphToAstTransformer/index.d.ts +0 -6
  227. package/dist/_ShapesGraphToAstTransformer/index.js +0 -6
  228. package/dist/_ShapesGraphToAstTransformer/shapeIdentifier.d.ts +0 -5
  229. package/dist/_ShapesGraphToAstTransformer/shapeIdentifier.js +0 -9
  230. package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.d.ts +0 -11
  231. package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.js +0 -338
  232. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstAbstractTypeProperties.d.ts +0 -12
  233. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstAbstractTypeProperties.js +0 -31
  234. package/dist/ast/AbstractObjectCompoundType.d.ts +0 -45
  235. package/dist/ast/AbstractObjectCompoundType.js +0 -180
  236. package/dist/ast/Curie.d.ts +0 -21
  237. package/dist/ast/Curie.js +0 -29
  238. package/dist/ast/PlaceholderType.d.ts +0 -15
  239. package/dist/ast/PlaceholderType.js +0 -19
  240. package/dist/generators/codeName.d.ts +0 -6
  241. package/dist/generators/codeName.js +0 -66
  242. package/dist/generators/ts/AbstractDeclaredType.d.ts +0 -23
  243. package/dist/generators/ts/AbstractDeclaredType.js +0 -17
  244. package/dist/generators/ts/ObjectUnionType.d.ts +0 -65
  245. package/dist/generators/ts/ObjectUnionType.js +0 -257
  246. package/dist/generators/ts/UnionType.d.ts +0 -40
  247. package/dist/generators/ts/UnionType.js +0 -527
  248. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclarations.d.ts +0 -4
  249. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclarations.js +0 -66
  250. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfFunctionDeclaration.d.ts +0 -5
  251. package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromRdfFunctionDeclaration.d.ts +0 -5
  252. package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  253. package/dist/generators/ts/_ObjectType/ObjectType_sparqlWherePatternsFunctionDeclarations.d.ts +0 -5
  254. package/dist/generators/ts/_ObjectType/ObjectType_toRdfFunctionOrMethodDeclaration.d.ts +0 -5
  255. package/dist/generators/ts/_ObjectUnionType/MemberType.d.ts +0 -34
  256. package/dist/generators/ts/_ObjectUnionType/MemberType.js +0 -105
  257. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_equalsFunctionDeclaration.d.ts +0 -5
  258. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_equalsFunctionDeclaration.js +0 -29
  259. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterFunctionDeclaration.d.ts +0 -4
  260. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterFunctionDeclaration.js +0 -19
  261. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterTypeDeclaration.d.ts +0 -4
  262. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterTypeDeclaration.js +0 -10
  263. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromJsonFunctionDeclaration.d.ts +0 -5
  264. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromJsonFunctionDeclaration.js +0 -19
  265. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromRdfFunctionDeclarations.d.ts +0 -5
  266. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromRdfFunctionDeclarations.js +0 -20
  267. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_graphqlTypeVariableStatement.d.ts +0 -5
  268. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_graphqlTypeVariableStatement.js +0 -18
  269. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_hashFunctionDeclaration.d.ts +0 -5
  270. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_hashFunctionDeclaration.js +0 -28
  271. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_identifierTypeDeclarations.d.ts +0 -4
  272. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_identifierTypeDeclarations.js +0 -9
  273. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_isTypeFunctionDeclaration.d.ts +0 -5
  274. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_isTypeFunctionDeclaration.js +0 -13
  275. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonTypeAliasDeclaration.d.ts +0 -5
  276. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonTypeAliasDeclaration.js +0 -10
  277. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonZodSchemaFunctionDeclaration.d.ts +0 -5
  278. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonZodSchemaFunctionDeclaration.js +0 -14
  279. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_schemaVariableStatement.d.ts +0 -4
  280. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_schemaVariableStatement.js +0 -37
  281. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
  282. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.js +0 -15
  283. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlWherePatternsFunctionDeclaration.d.ts +0 -5
  284. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlWherePatternsFunctionDeclaration.js +0 -35
  285. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toJsonFunctionDeclaration.d.ts +0 -5
  286. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toJsonFunctionDeclaration.js +0 -26
  287. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toRdfFunctionDeclarations.d.ts +0 -5
  288. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toRdfFunctionDeclarations.js +0 -43
  289. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_typeAliasDeclaration.d.ts +0 -4
  290. package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_typeAliasDeclaration.js +0 -10
  291. package/dist/generators/ts/_snippets/snippets_FromRdfOptions.d.ts +0 -2
  292. package/dist/generators/ts/_snippets/snippets_FromRdfOptions.js +0 -5
  293. package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfParameters.d.ts +0 -2
  294. package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfParameters.js +0 -5
  295. package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunction.d.ts +0 -2
  296. package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunction.js +0 -6
  297. package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunctionParameters.d.ts +0 -2
  298. package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunctionParameters.js +0 -12
  299. package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunction.d.ts +0 -2
  300. package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunction.js +0 -6
  301. package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunctionParameters.d.ts +0 -2
  302. package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunctionParameters.js +0 -15
@@ -2,6 +2,7 @@ import { rdf, rdfs } from "@tpluscode/rdf-ns-builders";
2
2
  import { Maybe } from "purify-ts";
3
3
  import { imports } from "../imports.js";
4
4
  import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
5
+ import { snippets } from "../snippets.js";
5
6
  import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
6
7
  import { code, joinCode } from "../ts-poet-wrapper.js";
7
8
  const variables = {
@@ -9,7 +10,7 @@ const variables = {
9
10
  focusIdentifier: code `parameters.focusIdentifier`,
10
11
  variablePrefix: code `parameters.variablePrefix`,
11
12
  };
12
- export function ObjectType_sparqlConstructTriplesFunctionDeclaration() {
13
+ export function ObjectType_focusSparqlConstructTriplesFunctionDeclaration() {
13
14
  if (!this.features.has("sparql")) {
14
15
  return Maybe.empty();
15
16
  }
@@ -18,7 +19,7 @@ export function ObjectType_sparqlConstructTriplesFunctionDeclaration() {
18
19
  let triplesVariableDeclarationKeyword = "const";
19
20
  const statements = [];
20
21
  for (const parentObjectType of this.parentObjectTypes) {
21
- statements.push(code `triples = triples.concat(${parentObjectType.staticModuleName}.${syntheticNamePrefix}sparqlConstructTriples(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, variablePrefix: variables.variablePrefix }}));`);
22
+ statements.push(code `triples = triples.concat(${parentObjectType.staticModuleName}.${syntheticNamePrefix}focusSparqlConstructTriples(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, variablePrefix: variables.variablePrefix }}));`);
22
23
  triplesVariableDeclarationKeyword = "let";
23
24
  }
24
25
  if (this.fromRdfType.isJust()) {
@@ -44,7 +45,7 @@ if (!parameters?.ignoreRdfType) {
44
45
  });
45
46
  }
46
47
  return Maybe.of(code `\
47
- export function ${syntheticNamePrefix}sparqlConstructTriples(${statements.length === 0 ? "_" : ""}parameters: { filter: ${this.filterType} | undefined; focusIdentifier: ${imports.NamedNode} | ${imports.Variable}; ignoreRdfType: boolean; variablePrefix: string }): readonly ${imports.sparqljs}.Triple[] {
48
+ export const ${syntheticNamePrefix}focusSparqlConstructTriples: ${snippets.FocusSparqlConstructTriplesFunction}<${this.filterType}> = (${statements.length === 0 ? "_" : ""}parameters) => {
48
49
  ${statements.length > 0
49
50
  ? joinCode([
50
51
  code `${triplesVariableDeclarationKeyword} triples: ${imports.sparqljs}.Triple[] = [];`,
@@ -52,6 +53,6 @@ ${statements.length > 0
52
53
  code `return triples;`,
53
54
  ])
54
55
  : "return [];"}
55
- }`);
56
+ };`);
56
57
  }
57
- //# sourceMappingURL=ObjectType_sparqlConstructTriplesFunctionDeclaration.js.map
58
+ //# sourceMappingURL=ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_focusSparqlWherePatternsFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts.map
@@ -11,7 +11,7 @@ const variables = {
11
11
  focusIdentifier: code `parameters.focusIdentifier`,
12
12
  variablePrefix: code `parameters.variablePrefix`,
13
13
  };
14
- export function ObjectType_sparqlWherePatternsFunctionDeclaration() {
14
+ export function ObjectType_focusSparqlWherePatternsFunctionDeclaration() {
15
15
  if (!this.features.has("sparql")) {
16
16
  return Maybe.empty();
17
17
  }
@@ -21,7 +21,7 @@ export function ObjectType_sparqlWherePatternsFunctionDeclaration() {
21
21
  const statements = [];
22
22
  for (const parentObjectType of this.parentObjectTypes) {
23
23
  statements.push(code `\
24
- patterns = patterns.concat(${parentObjectType.staticModuleName}.${syntheticNamePrefix}sparqlWherePatterns(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, preferredLanguages: variables.preferredLanguages, variablePrefix: variables.variablePrefix }}));`);
24
+ patterns = patterns.concat(${parentObjectType.staticModuleName}.${syntheticNamePrefix}focusSparqlWherePatterns(${{ filter: variables.filter, focusIdentifier: variables.focusIdentifier, ignoreRdfType: true, preferredLanguages: variables.preferredLanguages, variablePrefix: variables.variablePrefix }}));`);
25
25
  patternsVariableDeclarationKeyword = "let";
26
26
  }
27
27
  if (this.fromRdfType.isJust()) {
@@ -93,7 +93,7 @@ if (!parameters?.ignoreRdfType) {
93
93
  });
94
94
  }
95
95
  return Maybe.of(code `\
96
- export function ${syntheticNamePrefix}sparqlWherePatterns(${statements.length === 0 ? "_" : ""}parameters: { filter: ${this.filterType} | undefined; focusIdentifier: ${imports.NamedNode} | ${imports.Variable}; ignoreRdfType: boolean; preferredLanguages: readonly string[] | undefined; variablePrefix: string }): readonly ${snippets.SparqlPattern}[] {
96
+ export const ${syntheticNamePrefix}focusSparqlWherePatterns: ${snippets.FocusSparqlWherePatternsFunction}<${this.filterType}> = (${statements.length === 0 ? "_" : ""}parameters) => {
97
97
  ${statements.length > 0
98
98
  ? joinCode([
99
99
  code `${patternsVariableDeclarationKeyword} patterns: ${snippets.SparqlPattern}[] = [];`,
@@ -101,6 +101,6 @@ ${statements.length > 0
101
101
  code `return patterns;`,
102
102
  ])
103
103
  : "return [];"}
104
- }`);
104
+ };`);
105
105
  }
106
- //# sourceMappingURL=ObjectType_sparqlWherePatternsFunctionDeclarations.js.map
106
+ //# sourceMappingURL=ObjectType_focusSparqlWherePatternsFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_fromJsonFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_fromJsonFunctionDeclaration.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
3
+ import { code } from "../ts-poet-wrapper.js";
4
+ export function ObjectType_fromJsonFunctionDeclaration() {
5
+ if (!this.features.has("json")) {
6
+ return Maybe.empty();
7
+ }
8
+ if (this.abstract) {
9
+ return Maybe.empty();
10
+ }
11
+ let returnExpression = code `${syntheticNamePrefix}propertiesFromJson(json)`;
12
+ if (this.declarationType === "class") {
13
+ returnExpression = code `new ${this.name}(${returnExpression})`;
14
+ }
15
+ return Maybe.of(code `\
16
+ export function ${syntheticNamePrefix}fromJson(json: ${this.jsonType().name}): ${this.name} {
17
+ return ${returnExpression};
18
+ }`);
19
+ }
20
+ //# sourceMappingURL=ObjectType_fromJsonFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_fromRdfResourceFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_fromRdfResourceFunctionDeclaration.d.ts.map
@@ -1,9 +1,8 @@
1
1
  import { Maybe } from "purify-ts";
2
- import { imports } from "../imports.js";
3
2
  import { snippets } from "../snippets.js";
4
3
  import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
5
4
  import { code, joinCode } from "../ts-poet-wrapper.js";
6
- export function ObjectType_fromRdfFunctionDeclaration() {
5
+ export function ObjectType_fromRdfResourceFunctionDeclaration() {
7
6
  if (!this.features.has("rdf")) {
8
7
  return Maybe.empty();
9
8
  }
@@ -11,17 +10,17 @@ export function ObjectType_fromRdfFunctionDeclaration() {
11
10
  return Maybe.empty();
12
11
  }
13
12
  const statements = [
14
- code `let { context, ignoreRdfType = false, objectSet, preferredLanguages } = (options ?? {});`,
13
+ code `let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages } = (options ?? {});`,
15
14
  code `if (!objectSet) { objectSet = new ${syntheticNamePrefix}RdfjsDatasetObjectSet(resource.dataset); }`,
16
15
  ];
17
- let propertiesFromRdfExpression = code `${this.staticModuleName}.${syntheticNamePrefix}propertiesFromRdf({ context, ignoreRdfType, objectSet, preferredLanguages, resource })`;
16
+ let propertiesFromRdfExpression = code `${this.staticModuleName}.${syntheticNamePrefix}propertiesFromRdfResource(resource, { context, graph, ignoreRdfType, objectSet, preferredLanguages })`;
18
17
  if (this.declarationType === "class") {
19
18
  propertiesFromRdfExpression = code `${propertiesFromRdfExpression}.map(properties => new ${this.name}(properties))`;
20
19
  }
21
20
  statements.push(code `return ${propertiesFromRdfExpression};`);
22
21
  return Maybe.of(code `\
23
- export function ${syntheticNamePrefix}fromRdf(resource: ${imports.Resource}, options?: ${snippets.FromRdfOptions}): ${imports.Either}<Error, ${this.name}> {
22
+ export const ${syntheticNamePrefix}fromRdfResource: ${snippets.FromRdfResourceFunction}<${this.name}> = (resource, options) => {
24
23
  ${joinCode(statements)}
25
- }`);
24
+ };`);
26
25
  }
27
- //# sourceMappingURL=ObjectType_fromRdfFunctionDeclaration.js.map
26
+ //# sourceMappingURL=ObjectType_fromRdfResourceFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_fromRdfResourceValuesFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { snippets } from "../snippets.js";
3
+ import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
4
+ import { code } from "../ts-poet-wrapper.js";
5
+ export function ObjectType_fromRdfResourceValuesFunctionDeclaration() {
6
+ if (!this.features.has("rdf")) {
7
+ return Maybe.empty();
8
+ }
9
+ if (this.abstract) {
10
+ return Maybe.empty();
11
+ }
12
+ return Maybe.of(code `\
13
+ export const ${syntheticNamePrefix}fromRdfResourceValues: ${snippets.FromRdfResourceValuesFunction}<${this.name}> = (values, options) =>
14
+ values.chain(
15
+ values => values.chainMap(
16
+ value => value.toResource().chain(resource => ${this.staticModuleName}.${syntheticNamePrefix}fromRdfResource(resource, options))
17
+ )
18
+ );`);
19
+ }
20
+ //# sourceMappingURL=ObjectType_fromRdfResourceValuesFunctionDeclaration.js.map
@@ -4,8 +4,8 @@ export function ObjectType_isTypeFunctionDeclaration() {
4
4
  return code `\
5
5
  export function is${this.name}(object: ${syntheticNamePrefix}Object): object is ${this.name} {
6
6
  switch (object.${this._discriminantProperty.name}) {
7
- ${this._discriminantProperty.descendantValues
8
- .concat(this._discriminantProperty.ownValues)
7
+ ${this._discriminantProperty.type.descendantValues
8
+ .concat(this._discriminantProperty.type.ownValues)
9
9
  .map((value) => `case "${value}":`)
10
10
  .join("\n")} return true; default: return false;
11
11
  }
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_parseJsonFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_parseJsonFunctionDeclaration.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { imports } from "../imports.js";
3
+ import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
4
+ import { code } from "../ts-poet-wrapper.js";
5
+ export function ObjectType_parseJsonFunctionDeclaration() {
6
+ if (!this.features.has("json")) {
7
+ return Maybe.empty();
8
+ }
9
+ if (this.abstract) {
10
+ return Maybe.empty();
11
+ }
12
+ return Maybe.of(code `\
13
+ export function ${syntheticNamePrefix}parseJson(json: unknown): ${imports.Either}<Error, ${this.name}> {
14
+ const ${syntheticNamePrefix}jsonSafeParseResult = ${syntheticNamePrefix}jsonZodSchema().safeParse(json);
15
+ if (!${syntheticNamePrefix}jsonSafeParseResult.success) { return ${imports.Left}(${syntheticNamePrefix}jsonSafeParseResult.error); }
16
+ return ${imports.Right}(${syntheticNamePrefix}fromJson(${syntheticNamePrefix}jsonSafeParseResult.data));
17
+ }`);
18
+ }
19
+ //# sourceMappingURL=ObjectType_parseJsonFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_propertiesFromJsonFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_propertiesFromJsonFunctionDeclaration.d.ts.map
@@ -0,0 +1,38 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
3
+ import { code, joinCode } from "../ts-poet-wrapper.js";
4
+ const variables = {
5
+ jsonObject: code `${syntheticNamePrefix}json`,
6
+ };
7
+ export function ObjectType_propertiesFromJsonFunctionDeclaration() {
8
+ if (!this.features.has("json")) {
9
+ return Maybe.empty();
10
+ }
11
+ const initializers = [];
12
+ const statements = [];
13
+ const propertyReturnTypeSignatures = [];
14
+ const returnType = [];
15
+ this.parentObjectTypes.forEach((parentObjectType) => {
16
+ initializers.push(code `...${parentObjectType.staticModuleName}.${syntheticNamePrefix}propertiesFromJson(${variables.jsonObject})`);
17
+ returnType.push(code `ReturnType<typeof ${parentObjectType.staticModuleName}.${syntheticNamePrefix}propertiesFromJson>`);
18
+ });
19
+ for (const property of this.properties) {
20
+ const propertyFromJsonStatements = property.fromJsonStatements({
21
+ variables,
22
+ });
23
+ if (propertyFromJsonStatements.length > 0) {
24
+ propertyReturnTypeSignatures.push(code `${property.name}: ${property.type.name};`);
25
+ initializers.push(code `${property.name}`);
26
+ statements.push(...propertyFromJsonStatements);
27
+ }
28
+ }
29
+ statements.push(code `return { ${joinCode(initializers, { on: ", " })} };`);
30
+ if (propertyReturnTypeSignatures.length > 0) {
31
+ returnType.splice(0, 0, code `{ ${joinCode(propertyReturnTypeSignatures, { on: " " })} }`);
32
+ }
33
+ return Maybe.of(code `\
34
+ export function ${syntheticNamePrefix}propertiesFromJson(${variables.jsonObject}: ${this.jsonType().name}): ${joinCode(returnType, { on: " & " })} {
35
+ ${joinCode(statements)}
36
+ }`);
37
+ }
38
+ //# sourceMappingURL=ObjectType_propertiesFromJsonFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_propertiesFromRdfResourceFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_propertiesFromRdfResourceFunctionDeclaration.d.ts.map
@@ -5,7 +5,16 @@ import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
5
5
  import { snippets } from "../snippets.js";
6
6
  import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
7
7
  import { code, joinCode } from "../ts-poet-wrapper.js";
8
- export function ObjectType_propertiesFromRdfFunctionDeclaration() {
8
+ const optionsVariable = `_${syntheticNamePrefix}options`;
9
+ const variables = {
10
+ context: code `${optionsVariable}.context`,
11
+ graph: code `${optionsVariable}.graph`,
12
+ ignoreRdfType: code `${optionsVariable}.ignoreRdfType`,
13
+ objectSet: code `${optionsVariable}.objectSet`,
14
+ preferredLanguages: code `${optionsVariable}.preferredLanguages`,
15
+ resource: code `${syntheticNamePrefix}resource`,
16
+ };
17
+ export function ObjectType_propertiesFromRdfResourceFunctionDeclaration() {
9
18
  if (!this.features.has("rdf")) {
10
19
  return Maybe.empty();
11
20
  }
@@ -13,21 +22,13 @@ export function ObjectType_propertiesFromRdfFunctionDeclaration() {
13
22
  const initializers = [];
14
23
  const propertySignatures = [];
15
24
  const returnType = [];
16
- const variables = {
17
- context: code `${syntheticNamePrefix}parameters.context`,
18
- graph: code `${syntheticNamePrefix}parameters.graph`,
19
- ignoreRdfType: code `${syntheticNamePrefix}parameters.ignoreRdfType`,
20
- objectSet: code `${syntheticNamePrefix}parameters.objectSet`,
21
- preferredLanguages: code `${syntheticNamePrefix}parameters.preferredLanguages`,
22
- resource: code `${syntheticNamePrefix}parameters.resource`,
23
- };
24
25
  this.parentObjectTypes.forEach((parentObjectType, parentObjectTypeI) => {
25
26
  chains.push({
26
- expression: code `${parentObjectType.staticModuleName}.${syntheticNamePrefix}propertiesFromRdf({ ...${syntheticNamePrefix}parameters, ignoreRdfType: true })`,
27
+ expression: code `${parentObjectType.staticModuleName}.${syntheticNamePrefix}propertiesFromRdfResource(${variables.resource}, { ...${optionsVariable}, ignoreRdfType: true })`,
27
28
  variable: `${syntheticNamePrefix}super${parentObjectTypeI}`,
28
29
  });
29
30
  initializers.push(code `...${syntheticNamePrefix}super${parentObjectTypeI}`);
30
- returnType.push(code `${snippets.UnwrapR}<ReturnType<typeof ${parentObjectType.staticModuleName}.${syntheticNamePrefix}propertiesFromRdf>>`);
31
+ returnType.push(code `${snippets.UnwrapR}<ReturnType<typeof ${parentObjectType.staticModuleName}.${syntheticNamePrefix}propertiesFromRdfResource>>`);
31
32
  });
32
33
  this.fromRdfType.ifJust((fromRdfType) => {
33
34
  const fromRdfTypeVariable = this.fromRdfTypeVariable.unsafeCoerce();
@@ -67,7 +68,7 @@ export function ObjectType_propertiesFromRdfFunctionDeclaration() {
67
68
  };
68
69
  for (const property of this.properties) {
69
70
  property
70
- .fromRdfExpression({
71
+ .fromRdfResourceValuesExpression({
71
72
  variables: propertyFromRdfVariables,
72
73
  })
73
74
  .ifJust((propertyFromRdfExpression) => {
@@ -93,8 +94,8 @@ export function ObjectType_propertiesFromRdfFunctionDeclaration() {
93
94
  returnType.splice(0, 0, code `{ ${joinCode(propertySignatures, { on: " " })} }`);
94
95
  }
95
96
  return Maybe.of(code `\
96
- export function ${syntheticNamePrefix}propertiesFromRdf(${syntheticNamePrefix}parameters: ${snippets.PropertiesFromRdfParameters}): ${imports.Either}<Error, ${joinCode(returnType, { on: " & " })}> {
97
+ export const ${syntheticNamePrefix}propertiesFromRdfResource: ${snippets.PropertiesFromRdfResourceFunction}<${joinCode(returnType, { on: " & " })}> = (${syntheticNamePrefix}resource, ${optionsVariable}) => {
97
98
  ${joinCode(statements)}
98
- }`);
99
+ };`);
99
100
  }
100
- //# sourceMappingURL=ObjectType_propertiesFromRdfFunctionDeclaration.js.map
101
+ //# sourceMappingURL=ObjectType_propertiesFromRdfResourceFunctionDeclaration.js.map
@@ -4,7 +4,6 @@ export function ObjectType_schemaVariableStatement() {
4
4
  return code `\
5
5
  export const ${syntheticNamePrefix}schema = { properties: { ${joinCode(this.parentObjectTypes
6
6
  .map((parentObjectType) => code `...${parentObjectType.staticModuleName}.${syntheticNamePrefix}schema.properties`)
7
- .concat(this.ownProperties.map((property) => code `${property.name}: ${property.schema}`)), { on: ", " })} } } as const;
8
- `;
7
+ .concat(this.ownProperties.map((property) => code `${property.name}: ${property.schema}`)), { on: ", " })} } } as const;`;
9
8
  }
10
9
  //# sourceMappingURL=ObjectType_schemaVariableStatement.js.map
@@ -17,7 +17,7 @@ export function ${syntheticNamePrefix}sparqlConstructQuery({ filter, ignoreRdfTy
17
17
  prefixes: prefixes ?? {},
18
18
  queryType: "CONSTRUCT",
19
19
  template: (queryParameters.template ?? []).concat(
20
- ${this.staticModuleName}.${syntheticNamePrefix}sparqlConstructTriples({
20
+ ${this.staticModuleName}.${syntheticNamePrefix}focusSparqlConstructTriples({
21
21
  filter,
22
22
  focusIdentifier: subject,
23
23
  ignoreRdfType: !!ignoreRdfType,
@@ -27,7 +27,7 @@ export function ${syntheticNamePrefix}sparqlConstructQuery({ filter, ignoreRdfTy
27
27
  type: "query",
28
28
  where: (queryParameters.where ?? []).concat(
29
29
  ${snippets.normalizeSparqlWherePatterns}(
30
- ${this.staticModuleName}.${syntheticNamePrefix}sparqlWherePatterns({
30
+ ${this.staticModuleName}.${syntheticNamePrefix}focusSparqlWherePatterns({
31
31
  filter,
32
32
  focusIdentifier: subject,
33
33
  ignoreRdfType: !!ignoreRdfType,
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_toRdfResourceFunctionOrMethodDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_toRdfResourceFunctionOrMethodDeclaration.d.ts.map
@@ -2,9 +2,10 @@ import { rdf } from "@tpluscode/rdf-ns-builders";
2
2
  import { Maybe } from "purify-ts";
3
3
  import { imports } from "../imports.js";
4
4
  import { rdfjsTermExpression } from "../rdfjsTermExpression.js";
5
+ import { snippets } from "../snippets.js";
5
6
  import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
6
7
  import { code, joinCode } from "../ts-poet-wrapper.js";
7
- export function ObjectType_toRdfFunctionOrMethodDeclaration() {
8
+ export function ObjectType_toRdfResourceFunctionOrMethodDeclaration() {
8
9
  if (!this.features.has("rdf")) {
9
10
  return Maybe.empty();
10
11
  }
@@ -17,7 +18,7 @@ export function ObjectType_toRdfFunctionOrMethodDeclaration() {
17
18
  if (this.declarationType === "interface") {
18
19
  parameters.push(code `${this.thisVariable}: ${this.name}`);
19
20
  }
20
- parameters.push(code `options?: { ${variables.ignoreRdfType}?: boolean; ${variables.graph}?: Exclude<${imports.Quad_Graph}, ${imports.Variable}>, ${variables.resourceSet}?: ${imports.ResourceSet} }`);
21
+ parameters.push(code `options?: Parameters<${snippets.ToRdfResourceFunction}<${this.name}>>[1]`);
21
22
  const statements = [
22
23
  code `const ${variables.resourceSet} = options?.${variables.resourceSet} ?? new ${imports.ResourceSet}(${imports.datasetFactory}.dataset(), { dataFactory: ${imports.dataFactory} });`,
23
24
  ];
@@ -27,10 +28,10 @@ export function ObjectType_toRdfFunctionOrMethodDeclaration() {
27
28
  switch (this.declarationType) {
28
29
  case "class":
29
30
  preamble = "override ";
30
- superToRdfCall = code `super.${syntheticNamePrefix}toRdf(${superToRdfOptions})`;
31
+ superToRdfCall = code `super.${syntheticNamePrefix}toRdfResource(${superToRdfOptions})`;
31
32
  break;
32
33
  case "interface":
33
- superToRdfCall = code `${this.parentObjectTypes[0].staticModuleName}.${syntheticNamePrefix}toRdf(${this.thisVariable}, ${superToRdfOptions})`;
34
+ superToRdfCall = code `${this.parentObjectTypes[0].staticModuleName}.${syntheticNamePrefix}toRdfResource(${this.thisVariable}, ${superToRdfOptions})`;
34
35
  break;
35
36
  }
36
37
  statements.push(code `const ${variables.resource} = ${superToRdfCall};`);
@@ -42,17 +43,18 @@ export function ObjectType_toRdfFunctionOrMethodDeclaration() {
42
43
  statements.push(code `if (!options?.${variables.ignoreRdfType}) { ${joinCode(this.toRdfTypes.map((toRdfType) => code `${variables.resource}.add(${rdfjsTermExpression(rdf.type)}, ${imports.dataFactory}.namedNode("${toRdfType.value}"), options?.${variables.graph});`), { on: " " })} }`);
43
44
  }
44
45
  for (const property of this.properties) {
45
- statements.push(...property.toRdfStatements({
46
+ statements.push(...property.toRdfRdfResourceValuesStatements({
46
47
  variables: {
47
- ...variables,
48
48
  graph: code `options?.${variables.graph}`,
49
+ resource: variables.resource,
50
+ resourceSet: variables.resourceSet,
49
51
  value: code `${this.thisVariable}.${property.name}`,
50
52
  },
51
53
  }));
52
54
  }
53
55
  statements.push(code `return ${variables.resource};`);
54
56
  return Maybe.of(code `\
55
- ${preamble}${syntheticNamePrefix}toRdf(${joinCode(parameters, { on: "," })}): ${this.toRdfjsResourceType} {
57
+ ${preamble}${syntheticNamePrefix}toRdfResource(${joinCode(parameters, { on: "," })}): ${this.toRdfjsResourceType} {
56
58
  ${joinCode(statements)}
57
59
  }`);
58
60
  }
@@ -62,4 +64,4 @@ const variables = {
62
64
  resource: code `resource`,
63
65
  resourceSet: code `resourceSet`,
64
66
  };
65
- //# sourceMappingURL=ObjectType_toRdfFunctionOrMethodDeclaration.js.map
67
+ //# sourceMappingURL=ObjectType_toRdfResourceFunctionOrMethodDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_valueSparqlConstructTriplesFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { snippets } from "../snippets.js";
3
+ import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
4
+ import { code } from "../ts-poet-wrapper.js";
5
+ export function ObjectType_valueSparqlConstructTriplesFunctionDeclaration() {
6
+ if (!this.features.has("sparql")) {
7
+ return Maybe.empty();
8
+ }
9
+ return Maybe.of(code `\
10
+ export const ${syntheticNamePrefix}valueSparqlConstructTriples: ${snippets.ValueSparqlConstructTriplesFunction}<${this.filterType}, ${this.schemaType}> = ({ filter, ignoreRdfType, valueVariable, variablePrefix }) =>
11
+ ${this.staticModuleName}.${syntheticNamePrefix}focusSparqlConstructTriples({ filter, focusIdentifier: valueVariable, ignoreRdfType, variablePrefix });`);
12
+ }
13
+ //# sourceMappingURL=ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js.map
@@ -0,0 +1,5 @@
1
+ import { Maybe } from "purify-ts";
2
+ import type { ObjectType } from "../ObjectType.js";
3
+ import { type Code } from "../ts-poet-wrapper.js";
4
+ export declare function ObjectType_valueSparqlWherePatternsFunctionDeclaration(this: ObjectType): Maybe<Code>;
5
+ //# sourceMappingURL=ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { Maybe } from "purify-ts";
2
+ import { snippets } from "../snippets.js";
3
+ import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
4
+ import { code } from "../ts-poet-wrapper.js";
5
+ export function ObjectType_valueSparqlWherePatternsFunctionDeclaration() {
6
+ if (!this.features.has("sparql")) {
7
+ return Maybe.empty();
8
+ }
9
+ return Maybe.of(code `\
10
+ export const ${syntheticNamePrefix}valueSparqlWherePatterns: ${snippets.ValueSparqlWherePatternsFunction}<${this.filterType}, ${this.schemaType}> = ({ filter, ignoreRdfType, preferredLanguages, propertyPatterns, valueVariable, variablePrefix }) =>
11
+ (propertyPatterns as readonly ${snippets.SparqlPattern}[]).concat(
12
+ ${this.staticModuleName}.${syntheticNamePrefix}focusSparqlWherePatterns({ filter, focusIdentifier: valueVariable, ignoreRdfType, preferredLanguages, variablePrefix })
13
+ );`);
14
+ }
15
+ //# sourceMappingURL=ObjectType_valueSparqlWherePatternsFunctionDeclaration.js.map
@@ -1,7 +1,7 @@
1
1
  import type { Type } from "../Type.js";
2
+ import type { DiscriminantProperty } from "./DiscriminantProperty.js";
2
3
  import type { IdentifierPrefixProperty } from "./IdentifierPrefixProperty.js";
3
4
  import type { IdentifierProperty } from "./IdentifierProperty.js";
4
5
  import type { ShaclProperty } from "./ShaclProperty.js";
5
- import type { TypeDiscriminantProperty } from "./TypeDiscriminantProperty.js";
6
- export type Property = IdentifierProperty | IdentifierPrefixProperty | ShaclProperty<Type> | TypeDiscriminantProperty;
6
+ export type Property = IdentifierProperty | IdentifierPrefixProperty | ShaclProperty<Type> | DiscriminantProperty;
7
7
  //# sourceMappingURL=Property.d.ts.map
@@ -37,12 +37,12 @@ export declare class ShaclProperty<TypeT extends Type> extends AbstractProperty<
37
37
  };
38
38
  constructorStatements({ variables, }: Parameters<AbstractProperty<TypeT>["constructorStatements"]>[0]): readonly Code[];
39
39
  fromJsonStatements({ variables, }: Parameters<AbstractProperty<TypeT>["fromJsonStatements"]>[0]): readonly Code[];
40
- fromRdfExpression({ variables, }: Parameters<AbstractProperty<TypeT>["fromRdfExpression"]>[0]): Maybe<Code>;
40
+ fromRdfResourceValuesExpression({ variables, }: Parameters<AbstractProperty<TypeT>["fromRdfResourceValuesExpression"]>[0]): Maybe<Code>;
41
41
  hashStatements(parameters: Parameters<AbstractProperty<TypeT>["hashStatements"]>[0]): readonly Code[];
42
42
  jsonUiSchemaElement({ variables, }: Parameters<AbstractProperty<TypeT>["jsonUiSchemaElement"]>[0]): Maybe<Code>;
43
43
  sparqlConstructTriplesExpression({ variables, }: Parameters<AbstractProperty<TypeT>["sparqlConstructTriplesExpression"]>[0]): Maybe<Code>;
44
44
  sparqlWherePatternsExpression({ variables, }: Parameters<AbstractProperty<TypeT>["sparqlWherePatternsExpression"]>[0]): ReturnType<AbstractProperty<TypeT>["sparqlWherePatternsExpression"]>;
45
45
  toJsonObjectMemberExpression(parameters: Parameters<AbstractProperty<TypeT>["toJsonObjectMemberExpression"]>[0]): Maybe<Code>;
46
- toRdfStatements({ variables, }: Parameters<AbstractProperty<TypeT>["toRdfStatements"]>[0]): readonly Code[];
46
+ toRdfRdfResourceValuesStatements({ variables, }: Parameters<AbstractProperty<TypeT>["toRdfRdfResourceValuesStatements"]>[0]): readonly Code[];
47
47
  }
48
48
  //# sourceMappingURL=ShaclProperty.d.ts.map
@@ -164,7 +164,7 @@ export class ShaclProperty extends AbstractProperty {
164
164
  code `const ${this.name} = ${this.type.fromJsonExpression({ variables: { value: code `${variables.jsonObject}["${this.name}"]` } })};`,
165
165
  ];
166
166
  }
167
- fromRdfExpression({ variables, }) {
167
+ fromRdfResourceValuesExpression({ variables, }) {
168
168
  // Assume the property has the correct range and ignore the object's RDF type.
169
169
  // This also accommodates the case where the object of a property is a dangling identifier that's not the
170
170
  // subject of any statements.
@@ -172,7 +172,7 @@ export class ShaclProperty extends AbstractProperty {
172
172
  graph: variables.graph,
173
173
  resource: variables.resource,
174
174
  propertySchema: code `${syntheticNamePrefix}schema.properties.${this.name}`,
175
- typeFromRdf: code `((resourceValues) => ${this.type.fromRdfExpression({
175
+ typeFromRdf: code `((resourceValues) => ${this.type.fromRdfResourceValuesExpression({
176
176
  variables: {
177
177
  ...variables,
178
178
  ignoreRdfType: true,
@@ -200,7 +200,7 @@ export class ShaclProperty extends AbstractProperty {
200
200
  ignoreRdfType: true,
201
201
  propertyName: this.name,
202
202
  propertySchema: code `${syntheticNamePrefix}schema.properties.${this.name}`,
203
- typeSparqlConstructTriples: this.type.sparqlConstructTriplesFunction,
203
+ typeSparqlConstructTriples: this.type.valueSparqlConstructTriplesFunction,
204
204
  variablePrefix: variables.variablePrefix,
205
205
  }})`);
206
206
  }
@@ -215,7 +215,7 @@ export class ShaclProperty extends AbstractProperty {
215
215
  preferredLanguages: variables.preferredLanguages,
216
216
  propertyName: this.name,
217
217
  propertySchema: code `${syntheticNamePrefix}schema.properties.${this.name}`,
218
- typeSparqlWherePatterns: this.type.sparqlWherePatternsFunction,
218
+ typeSparqlWherePatterns: this.type.valueSparqlWherePatternsFunction,
219
219
  variablePrefix: variables.variablePrefix,
220
220
  }})`,
221
221
  });
@@ -223,7 +223,7 @@ export class ShaclProperty extends AbstractProperty {
223
223
  toJsonObjectMemberExpression(parameters) {
224
224
  return Maybe.of(code `${this.name}: ${this.type.toJsonExpression(parameters)}`);
225
225
  }
226
- toRdfStatements({ variables, }) {
226
+ toRdfRdfResourceValuesStatements({ variables, }) {
227
227
  switch (this.path.termType) {
228
228
  case "NamedNode":
229
229
  break;
@@ -237,7 +237,7 @@ export class ShaclProperty extends AbstractProperty {
237
237
  }
238
238
  const propertyPath = propertyPathToCode(this.path);
239
239
  return [
240
- code `${variables.resource}.add(${propertyPath}, ${this.type.toRdfExpression({
240
+ code `${variables.resource}.add(${propertyPath}, ${this.type.toRdfResourceValuesExpression({
241
241
  variables: { ...variables, propertyPath },
242
242
  })}, ${variables.graph});`,
243
243
  ];
@@ -0,0 +1,2 @@
1
+ export declare const snippets_FocusSparqlConstructTriplesFunction: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
2
+ //# sourceMappingURL=snippets_FocusSparqlConstructTriplesFunction.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { imports } from "../imports.js";
2
+ import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
3
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
4
+ export const snippets_FocusSparqlConstructTriplesFunction = conditionalOutput(`${syntheticNamePrefix}FocusSparqlConstructTriplesFunction`, code `\
5
+ type ${syntheticNamePrefix}FocusSparqlConstructTriplesFunction<FilterT> =
6
+ (parameters: {
7
+ filter: FilterT | undefined;
8
+ focusIdentifier: ${imports.NamedNode} | ${imports.Variable};
9
+ ignoreRdfType: boolean;
10
+ variablePrefix: string;
11
+ }) => readonly ${imports.sparqljs}.Triple[];`);
12
+ //# sourceMappingURL=snippets_FocusSparqlConstructTriplesFunction.js.map
@@ -0,0 +1,2 @@
1
+ export declare const snippets_FocusSparqlWherePatternsFunction: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
2
+ //# sourceMappingURL=snippets_FocusSparqlWherePatternsFunction.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { imports } from "../imports.js";
2
+ import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
3
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
4
+ import { snippets_SparqlPattern } from "./snippets_SparqlPattern.js";
5
+ export const snippets_FocusSparqlWherePatternsFunction = conditionalOutput(`${syntheticNamePrefix}FocusSparqlWherePatternsFunction`, code `\
6
+ type ${syntheticNamePrefix}FocusSparqlWherePatternsFunction<FilterT> =
7
+ (parameters: {
8
+ filter: FilterT | undefined;
9
+ focusIdentifier: ${imports.NamedNode} | ${imports.Variable};
10
+ ignoreRdfType: boolean;
11
+ preferredLanguages: readonly string[] | undefined;
12
+ variablePrefix: string;
13
+ }) => readonly ${snippets_SparqlPattern}[];`);
14
+ //# sourceMappingURL=snippets_FocusSparqlWherePatternsFunction.js.map
@@ -0,0 +1,2 @@
1
+ export declare const snippets_FromRdfResourceFunction: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
2
+ //# sourceMappingURL=snippets_FromRdfResourceFunction.d.ts.map