@shaclmate/compiler 4.0.40 → 4.0.42

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 (344) hide show
  1. package/dist/ShapesGraphToAstTransformer.d.ts +1 -8
  2. package/dist/ShapesGraphToAstTransformer.js +11 -126
  3. package/dist/_ShapesGraphToAstTransformer/shapeNodeKinds.js +128 -160
  4. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstStructTypeField.d.ts +17 -0
  5. package/dist/_ShapesGraphToAstTransformer/{transformPropertyShapeToAstObjectTypeProperty.js → transformPropertyShapeToAstStructTypeField.js} +71 -48
  6. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.d.ts +1 -1
  7. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +29 -20
  8. package/dist/_ShapesGraphToAstTransformer/{transformShapeToAstObjectType.d.ts → transformShapeToAstStructType.d.ts} +3 -3
  9. package/dist/_ShapesGraphToAstTransformer/{transformShapeToAstObjectType.js → transformShapeToAstStructType.js} +35 -45
  10. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +2 -1
  11. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.d.ts +1 -1
  12. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +3 -3
  13. package/dist/ast/AbstractCompoundType.d.ts +3 -2
  14. package/dist/ast/AbstractCompoundType.js +5 -5
  15. package/dist/ast/AbstractContainerType.d.ts +2 -2
  16. package/dist/ast/AbstractContainerType.js +4 -4
  17. package/dist/ast/{AbstractLazyObjectType.d.ts → AbstractLazyType.d.ts} +10 -12
  18. package/dist/ast/{AbstractLazyObjectType.js → AbstractLazyType.js} +3 -3
  19. package/dist/ast/AbstractType.d.ts +1 -1
  20. package/dist/ast/AbstractType.js +3 -0
  21. package/dist/ast/Ast.d.ts +2 -6
  22. package/dist/ast/DefaultValueType.js +2 -1
  23. package/dist/ast/IntersectionType.d.ts +2 -2
  24. package/dist/ast/IntersectionType.js +3 -3
  25. package/dist/ast/LazyOptionType.d.ts +6 -0
  26. package/dist/ast/LazyOptionType.js +5 -0
  27. package/dist/ast/LazySetType.d.ts +6 -0
  28. package/dist/ast/LazySetType.js +5 -0
  29. package/dist/ast/LazyType.d.ts +5 -0
  30. package/dist/ast/LazyType.js +5 -0
  31. package/dist/ast/ListType.d.ts +2 -2
  32. package/dist/ast/ListType.js +5 -5
  33. package/dist/ast/OptionType.js +2 -1
  34. package/dist/ast/SetType.js +2 -1
  35. package/dist/ast/StructCompoundType.d.ts +12 -0
  36. package/dist/ast/{ObjectCompoundType.js → StructCompoundType.js} +18 -18
  37. package/dist/ast/StructIntersectionType.d.ts +4 -0
  38. package/dist/ast/StructIntersectionType.js +2 -0
  39. package/dist/ast/{ObjectType.d.ts → StructType.d.ts} +28 -39
  40. package/dist/ast/{ObjectType.js → StructType.js} +81 -156
  41. package/dist/ast/StructUnionType.d.ts +4 -0
  42. package/dist/ast/StructUnionType.js +2 -0
  43. package/dist/ast/Type.d.ts +5 -5
  44. package/dist/ast/Type.js +4 -4
  45. package/dist/ast/UnionType.d.ts +2 -2
  46. package/dist/ast/UnionType.js +3 -3
  47. package/dist/ast/index.d.ts +7 -7
  48. package/dist/ast/index.js +7 -7
  49. package/dist/generators/AstJsonGenerator.js +7 -3
  50. package/dist/generators/transformAstToLabeledPropertyGraph.js +59 -56
  51. package/dist/generators/ts/AbstractCollectionType.d.ts +4 -11
  52. package/dist/generators/ts/AbstractCollectionType.js +3 -62
  53. package/dist/generators/ts/AbstractContainerType.d.ts +1 -2
  54. package/dist/generators/ts/AbstractContainerType.js +7 -10
  55. package/dist/generators/ts/AbstractDateType.d.ts +5 -8
  56. package/dist/generators/ts/AbstractDateType.js +7 -12
  57. package/dist/generators/ts/AbstractIdentifierType.d.ts +4 -0
  58. package/dist/generators/ts/AbstractIdentifierType.js +3 -0
  59. package/dist/generators/ts/{AbstractLazyObjectType.d.ts → AbstractLazyType.d.ts} +8 -8
  60. package/dist/generators/ts/{AbstractLazyObjectType.js → AbstractLazyType.js} +30 -17
  61. package/dist/generators/ts/AbstractLiteralType.d.ts +3 -5
  62. package/dist/generators/ts/AbstractLiteralType.js +0 -21
  63. package/dist/generators/ts/AbstractNumericType.d.ts +1 -7
  64. package/dist/generators/ts/AbstractNumericType.js +17 -27
  65. package/dist/generators/ts/AbstractObjectSetType.d.ts +1 -1
  66. package/dist/generators/ts/AbstractObjectSetType.js +2 -2
  67. package/dist/generators/ts/AbstractPrimitiveType.d.ts +2 -1
  68. package/dist/generators/ts/AbstractPrimitiveType.js +1 -1
  69. package/dist/generators/ts/AbstractTermType.d.ts +7 -23
  70. package/dist/generators/ts/AbstractTermType.js +27 -58
  71. package/dist/generators/ts/AbstractType.d.ts +86 -63
  72. package/dist/generators/ts/AbstractType.js +48 -22
  73. package/dist/generators/ts/BigDecimalType.d.ts +7 -3
  74. package/dist/generators/ts/BigDecimalType.js +7 -9
  75. package/dist/generators/ts/BigIntType.d.ts +5 -3
  76. package/dist/generators/ts/BigIntType.js +8 -5
  77. package/dist/generators/ts/BlankNodeType.d.ts +2 -7
  78. package/dist/generators/ts/BlankNodeType.js +4 -9
  79. package/dist/generators/ts/BooleanType.d.ts +6 -4
  80. package/dist/generators/ts/BooleanType.js +13 -15
  81. package/dist/generators/ts/DateTimeType.d.ts +2 -2
  82. package/dist/generators/ts/DateTimeType.js +14 -4
  83. package/dist/generators/ts/DateType.d.ts +2 -2
  84. package/dist/generators/ts/DateType.js +14 -4
  85. package/dist/generators/ts/DefaultValueType.d.ts +40 -2
  86. package/dist/generators/ts/DefaultValueType.js +15 -14
  87. package/dist/generators/ts/FloatType.d.ts +5 -3
  88. package/dist/generators/ts/FloatType.js +8 -5
  89. package/dist/generators/ts/GraphqlSchema.js +2 -2
  90. package/dist/generators/ts/IdentifierType.d.ts +2 -2
  91. package/dist/generators/ts/IdentifierType.js +8 -11
  92. package/dist/generators/ts/IntType.d.ts +5 -3
  93. package/dist/generators/ts/IntType.js +8 -5
  94. package/dist/generators/ts/IriType.d.ts +2 -2
  95. package/dist/generators/ts/IriType.js +16 -16
  96. package/dist/generators/ts/{LazyObjectOptionType.d.ts → LazyOptionType.d.ts} +13 -11
  97. package/dist/generators/ts/LazyOptionType.js +75 -0
  98. package/dist/generators/ts/LazySetType.d.ts +20 -0
  99. package/dist/generators/ts/LazySetType.js +76 -0
  100. package/dist/generators/ts/LazyType.d.ts +19 -0
  101. package/dist/generators/ts/LazyType.js +65 -0
  102. package/dist/generators/ts/ListType.d.ts +11 -2
  103. package/dist/generators/ts/ListType.js +53 -26
  104. package/dist/generators/ts/LiteralType.d.ts +7 -2
  105. package/dist/generators/ts/LiteralType.js +12 -5
  106. package/dist/generators/ts/ObjectType.d.ts +24 -25
  107. package/dist/generators/ts/ObjectType.js +303 -161
  108. package/dist/generators/ts/ObjectUnionType.js +42 -42
  109. package/dist/generators/ts/OptionType.d.ts +6 -2
  110. package/dist/generators/ts/OptionType.js +16 -9
  111. package/dist/generators/ts/RdfjsDatasetObjectSetType.js +1 -4
  112. package/dist/generators/ts/SetType.d.ts +17 -2
  113. package/dist/generators/ts/SetType.js +85 -9
  114. package/dist/generators/ts/Snippets.d.ts +29 -9
  115. package/dist/generators/ts/Snippets.js +179 -39
  116. package/dist/generators/ts/StringType.d.ts +7 -4
  117. package/dist/generators/ts/StringType.js +23 -12
  118. package/dist/generators/ts/TermType.d.ts +9 -3
  119. package/dist/generators/ts/TermType.js +29 -7
  120. package/dist/generators/ts/TsGenerator.d.ts +1 -1
  121. package/dist/generators/ts/TsGenerator.js +62 -32
  122. package/dist/generators/ts/Type.d.ts +4 -4
  123. package/dist/generators/ts/TypeFactory.d.ts +5 -5
  124. package/dist/generators/ts/TypeFactory.js +90 -82
  125. package/dist/generators/ts/UnionType.d.ts +25 -23
  126. package/dist/generators/ts/UnionType.js +254 -261
  127. package/dist/generators/ts/ZodGenerator.d.ts +1 -1
  128. package/dist/generators/ts/ZodGenerator.js +29 -14
  129. package/dist/generators/ts/_ObjectType/AbstractProperty.d.ts +28 -16
  130. package/dist/generators/ts/_ObjectType/AbstractProperty.js +1 -24
  131. package/dist/generators/ts/_ObjectType/DiscriminantProperty.d.ts +15 -17
  132. package/dist/generators/ts/_ObjectType/DiscriminantProperty.js +24 -54
  133. package/dist/generators/ts/_ObjectType/IdentifierProperty.d.ts +8 -2
  134. package/dist/generators/ts/_ObjectType/IdentifierProperty.js +48 -20
  135. package/dist/generators/ts/_ObjectType/ObjectType_createFunctionExpression.d.ts +4 -0
  136. package/dist/generators/ts/_ObjectType/ObjectType_createFunctionExpression.js +28 -0
  137. package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionExpression.d.ts +4 -0
  138. package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionExpression.js +15 -0
  139. package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionExpression.d.ts +4 -0
  140. package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionExpression.js +12 -0
  141. package/dist/generators/ts/_ObjectType/ObjectType_filterTypeExpression.d.ts +4 -0
  142. package/dist/generators/ts/_ObjectType/{ObjectType_filterTypeDeclaration.js → ObjectType_filterTypeExpression.js} +5 -10
  143. package/dist/generators/ts/_ObjectType/{ObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts → ObjectType_focusSparqlConstructTriplesFunctionExpression.d.ts} +2 -3
  144. package/dist/generators/ts/_ObjectType/{ObjectType_focusSparqlConstructTriplesFunctionDeclaration.js → ObjectType_focusSparqlConstructTriplesFunctionExpression.js} +5 -13
  145. package/dist/generators/ts/_ObjectType/{ObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts → ObjectType_focusSparqlWherePatternsFunctionExpression.d.ts} +2 -3
  146. package/dist/generators/ts/_ObjectType/{ObjectType_focusSparqlWherePatternsFunctionDeclaration.js → ObjectType_focusSparqlWherePatternsFunctionExpression.js} +8 -31
  147. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionExpression.d.ts +4 -0
  148. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionExpression.js +12 -0
  149. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionExpression.d.ts +4 -0
  150. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionExpression.js +43 -0
  151. package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeExpression.d.ts +4 -0
  152. package/dist/generators/ts/_ObjectType/{ObjectType_graphqlTypeVariableStatement.js → ObjectType_graphqlTypeExpression.js} +6 -13
  153. package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionExpression.d.ts +4 -0
  154. package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionExpression.js +30 -0
  155. package/dist/generators/ts/_ObjectType/ObjectType_identifierTypeDeclarations.d.ts +4 -0
  156. package/dist/generators/ts/_ObjectType/ObjectType_identifierTypeDeclarations.js +13 -0
  157. package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.js +11 -8
  158. package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.d.ts +1 -2
  159. package/dist/generators/ts/_ObjectType/ObjectType_jsonParseFunctionDeclaration.js +2 -6
  160. package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaExpression.d.ts +4 -0
  161. package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaExpression.js +18 -0
  162. package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeExpression.d.ts +4 -0
  163. package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeExpression.js +5 -0
  164. package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionExpression.d.ts +4 -0
  165. package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionExpression.js +17 -0
  166. package/dist/generators/ts/_ObjectType/ObjectType_objectSetMethodNames.d.ts +1 -1
  167. package/dist/generators/ts/_ObjectType/ObjectType_objectSetMethodNames.js +2 -2
  168. package/dist/generators/ts/_ObjectType/ObjectType_schemaExpression.d.ts +4 -0
  169. package/dist/generators/ts/_ObjectType/ObjectType_schemaExpression.js +18 -0
  170. package/dist/generators/ts/_ObjectType/ObjectType_schemaTypeExpression.d.ts +4 -0
  171. package/dist/generators/ts/_ObjectType/ObjectType_schemaTypeExpression.js +18 -0
  172. package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts +2 -3
  173. package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js +5 -9
  174. package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts +2 -3
  175. package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js +4 -8
  176. package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionExpression.d.ts +4 -0
  177. package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionExpression.js +14 -0
  178. package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionExpression.d.ts +4 -0
  179. package/dist/generators/ts/_ObjectType/{ObjectType_toRdfResourceFunctionDeclaration.js → ObjectType_toRdfResourceFunctionExpression.js} +7 -13
  180. package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionExpression.d.ts +4 -0
  181. package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionExpression.js +7 -0
  182. package/dist/generators/ts/_ObjectType/ObjectType_toStringRecordFunctionExpression.d.ts +4 -0
  183. package/dist/generators/ts/_ObjectType/ObjectType_toStringRecordFunctionExpression.js +5 -0
  184. package/dist/generators/ts/_ObjectType/{ObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts → ObjectType_valueSparqlConstructTriplesFunctionExpression.d.ts} +2 -3
  185. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionExpression.js +8 -0
  186. package/dist/generators/ts/_ObjectType/{ObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts → ObjectType_valueSparqlWherePatternsFunctionExpression.d.ts} +2 -3
  187. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionExpression.js +10 -0
  188. package/dist/generators/ts/_ObjectType/ShaclProperty.d.ts +9 -2
  189. package/dist/generators/ts/_ObjectType/ShaclProperty.js +70 -38
  190. package/dist/generators/ts/_snippets/snippets_BooleanSchema.js +4 -3
  191. package/dist/generators/ts/_snippets/snippets_DateSchema.js +4 -3
  192. package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.js +3 -3
  193. package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.js +6 -5
  194. package/dist/generators/ts/_snippets/snippets_IdentifierSchema.js +2 -1
  195. package/dist/generators/ts/_snippets/snippets_IriSchema.js +1 -0
  196. package/dist/generators/ts/_snippets/snippets_Lazy.d.ts +3 -0
  197. package/dist/generators/ts/_snippets/snippets_Lazy.js +22 -0
  198. package/dist/generators/ts/_snippets/snippets_LazyOption.d.ts +3 -0
  199. package/dist/generators/ts/_snippets/snippets_LazyOption.js +25 -0
  200. package/dist/generators/ts/_snippets/snippets_LazySet.d.ts +3 -0
  201. package/dist/generators/ts/_snippets/snippets_LazySet.js +40 -0
  202. package/dist/generators/ts/_snippets/snippets_LiteralFilter.js +1 -3
  203. package/dist/generators/ts/_snippets/snippets_LiteralSchema.js +1 -0
  204. package/dist/generators/ts/_snippets/snippets_NumericSchema.js +2 -1
  205. package/dist/generators/ts/_snippets/snippets_PropertyPath.js +6 -8
  206. package/dist/generators/ts/_snippets/snippets_RdfVocabularies.js +32 -32
  207. package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +1 -1
  208. package/dist/generators/ts/_snippets/snippets_StringSchema.js +5 -3
  209. package/dist/generators/ts/_snippets/snippets_TermFilter.js +3 -3
  210. package/dist/generators/ts/_snippets/snippets_TermSchema.js +4 -2
  211. package/dist/generators/ts/_snippets/snippets_bigDecimalFromRdfResourceValues.d.ts +3 -0
  212. package/dist/generators/ts/_snippets/snippets_bigDecimalFromRdfResourceValues.js +6 -0
  213. package/dist/generators/ts/_snippets/snippets_bigIntFromRdfResourceValues.d.ts +3 -0
  214. package/dist/generators/ts/_snippets/snippets_bigIntFromRdfResourceValues.js +6 -0
  215. package/dist/generators/ts/_snippets/snippets_blankNodeFromRdfResourceValues.d.ts +3 -0
  216. package/dist/generators/ts/_snippets/snippets_blankNodeFromRdfResourceValues.js +6 -0
  217. package/dist/generators/ts/_snippets/snippets_booleanFromRdfResourceValues.d.ts +3 -0
  218. package/dist/generators/ts/_snippets/snippets_booleanFromRdfResourceValues.js +6 -0
  219. package/dist/generators/ts/_snippets/snippets_convertToArraySet.d.ts +3 -0
  220. package/dist/generators/ts/_snippets/snippets_convertToArraySet.js +8 -0
  221. package/dist/generators/ts/_snippets/snippets_convertToLazy.d.ts +3 -0
  222. package/dist/generators/ts/_snippets/snippets_convertToLazy.js +15 -0
  223. package/dist/generators/ts/_snippets/snippets_convertToLazyOption.d.ts +3 -0
  224. package/dist/generators/ts/_snippets/snippets_convertToLazyOption.js +33 -0
  225. package/dist/generators/ts/_snippets/snippets_convertToLazySet.d.ts +3 -0
  226. package/dist/generators/ts/_snippets/snippets_convertToLazySet.js +27 -0
  227. package/dist/generators/ts/_snippets/snippets_convertToList.d.ts +3 -0
  228. package/dist/generators/ts/_snippets/snippets_convertToList.js +7 -0
  229. package/dist/generators/ts/_snippets/snippets_convertToScalarSet.d.ts +3 -0
  230. package/dist/generators/ts/_snippets/snippets_convertToScalarSet.js +15 -0
  231. package/dist/generators/ts/_snippets/snippets_dateFromRdfResourceValues.d.ts +3 -0
  232. package/dist/generators/ts/_snippets/snippets_dateFromRdfResourceValues.js +6 -0
  233. package/dist/generators/ts/_snippets/snippets_dateTimeFromRdfResourceValues.d.ts +3 -0
  234. package/dist/generators/ts/_snippets/snippets_dateTimeFromRdfResourceValues.js +6 -0
  235. package/dist/generators/ts/_snippets/snippets_defaultValueFromRdfResourceValues.d.ts +3 -0
  236. package/dist/generators/ts/_snippets/snippets_defaultValueFromRdfResourceValues.js +10 -0
  237. package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +1 -1
  238. package/dist/generators/ts/_snippets/snippets_filterNumeric.js +1 -1
  239. package/dist/generators/ts/_snippets/snippets_filterTerm.js +1 -2
  240. package/dist/generators/ts/_snippets/snippets_floatFromRdfResourceValues.d.ts +3 -0
  241. package/dist/generators/ts/_snippets/snippets_floatFromRdfResourceValues.js +6 -0
  242. package/dist/generators/ts/_snippets/snippets_identifierFromRdfResourceValues.d.ts +3 -0
  243. package/dist/generators/ts/_snippets/snippets_identifierFromRdfResourceValues.js +6 -0
  244. package/dist/generators/ts/_snippets/snippets_intFromRdfResourceValues.d.ts +3 -0
  245. package/dist/generators/ts/_snippets/snippets_intFromRdfResourceValues.js +6 -0
  246. package/dist/generators/ts/_snippets/snippets_iriFromRdfResourceValues.d.ts +3 -0
  247. package/dist/generators/ts/_snippets/snippets_iriFromRdfResourceValues.js +6 -0
  248. package/dist/generators/ts/_snippets/snippets_listFromRdfResourceValues.d.ts +3 -0
  249. package/dist/generators/ts/_snippets/snippets_listFromRdfResourceValues.js +15 -0
  250. package/dist/generators/ts/_snippets/snippets_literalFromRdfResourceValues.d.ts +3 -0
  251. package/dist/generators/ts/_snippets/snippets_literalFromRdfResourceValues.js +6 -0
  252. package/dist/generators/ts/_snippets/snippets_maybeFromRdfResourceValues.d.ts +3 -0
  253. package/dist/generators/ts/_snippets/snippets_maybeFromRdfResourceValues.js +11 -0
  254. package/dist/generators/ts/_snippets/snippets_mutableListFromRdfResourceValues.d.ts +3 -0
  255. package/dist/generators/ts/_snippets/snippets_mutableListFromRdfResourceValues.js +8 -0
  256. package/dist/generators/ts/_snippets/snippets_mutableSetFromRdfResourceValues.d.ts +3 -0
  257. package/dist/generators/ts/_snippets/snippets_mutableSetFromRdfResourceValues.js +8 -0
  258. package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.js +1 -1
  259. package/dist/generators/ts/_snippets/snippets_setFromRdfResourceValues.d.ts +3 -0
  260. package/dist/generators/ts/_snippets/snippets_setFromRdfResourceValues.js +9 -0
  261. package/dist/generators/ts/_snippets/snippets_shaclPropertyFromRdf.js +13 -7
  262. package/dist/generators/ts/_snippets/snippets_stringFromRdfResourceValues.d.ts +3 -0
  263. package/dist/generators/ts/_snippets/snippets_stringFromRdfResourceValues.js +6 -0
  264. package/dist/generators/ts/_snippets/snippets_termFilterSparqlPatterns.js +1 -1
  265. package/dist/generators/ts/_snippets/snippets_termFromRdfResourceValues.d.ts +3 -0
  266. package/dist/generators/ts/_snippets/snippets_termFromRdfResourceValues.js +17 -0
  267. package/dist/generators/ts/_snippets/snippets_termLikeFromRdfResourceValues.d.ts +3 -0
  268. package/dist/generators/ts/_snippets/snippets_termLikeFromRdfResourceValues.js +60 -0
  269. package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.js +2 -2
  270. package/dist/input/generated.d.ts +1116 -400
  271. package/dist/input/generated.js +1879 -1917
  272. package/package.json +2 -4
  273. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.d.ts +0 -9
  274. package/dist/ast/LazyObjectOptionType.d.ts +0 -6
  275. package/dist/ast/LazyObjectOptionType.js +0 -5
  276. package/dist/ast/LazyObjectSetType.d.ts +0 -6
  277. package/dist/ast/LazyObjectSetType.js +0 -5
  278. package/dist/ast/LazyObjectType.d.ts +0 -5
  279. package/dist/ast/LazyObjectType.js +0 -5
  280. package/dist/ast/ObjectCompoundType.d.ts +0 -12
  281. package/dist/ast/ObjectIntersectionType.d.ts +0 -4
  282. package/dist/ast/ObjectIntersectionType.js +0 -2
  283. package/dist/ast/ObjectUnionType.d.ts +0 -4
  284. package/dist/ast/ObjectUnionType.js +0 -2
  285. package/dist/generators/ts/LazyObjectOptionType.js +0 -62
  286. package/dist/generators/ts/LazyObjectSetType.d.ts +0 -20
  287. package/dist/generators/ts/LazyObjectSetType.js +0 -61
  288. package/dist/generators/ts/LazyObjectType.d.ts +0 -19
  289. package/dist/generators/ts/LazyObjectType.js +0 -53
  290. package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +0 -5
  291. package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.js +0 -65
  292. package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.d.ts +0 -5
  293. package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionDeclaration.js +0 -23
  294. package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +0 -5
  295. package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.js +0 -24
  296. package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +0 -5
  297. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.d.ts +0 -5
  298. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclaration.js +0 -43
  299. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.d.ts +0 -5
  300. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceFunctionDeclaration.js +0 -80
  301. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +0 -5
  302. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfResourceValuesFunctionDeclaration.js +0 -15
  303. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.d.ts +0 -5
  304. package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.js +0 -10
  305. package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeVariableStatement.d.ts +0 -5
  306. package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.d.ts +0 -4
  307. package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionDeclarations.js +0 -45
  308. package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +0 -4
  309. package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.js +0 -16
  310. package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
  311. package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js +0 -31
  312. package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
  313. package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.js +0 -16
  314. package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
  315. package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js +0 -17
  316. package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +0 -5
  317. package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.js +0 -14
  318. package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.d.ts +0 -5
  319. package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionDeclaration.js +0 -41
  320. package/dist/generators/ts/_ObjectType/ObjectType_toRdfResourceFunctionDeclaration.d.ts +0 -5
  321. package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionDeclarations.d.ts +0 -4
  322. package/dist/generators/ts/_ObjectType/ObjectType_toStringFunctionDeclarations.js +0 -36
  323. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +0 -11
  324. package/dist/generators/ts/_ObjectType/ObjectType_valueSparqlWherePatternsFunctionDeclaration.js +0 -13
  325. package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +0 -4
  326. package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.js +0 -27
  327. package/dist/generators/ts/_snippets/snippets_LazyObject.d.ts +0 -3
  328. package/dist/generators/ts/_snippets/snippets_LazyObject.js +0 -22
  329. package/dist/generators/ts/_snippets/snippets_LazyObjectOption.d.ts +0 -3
  330. package/dist/generators/ts/_snippets/snippets_LazyObjectOption.js +0 -25
  331. package/dist/generators/ts/_snippets/snippets_LazyObjectSet.d.ts +0 -3
  332. package/dist/generators/ts/_snippets/snippets_LazyObjectSet.js +0 -40
  333. package/dist/generators/ts/_snippets/snippets_convertToArray.d.ts +0 -3
  334. package/dist/generators/ts/_snippets/snippets_convertToArray.js +0 -8
  335. package/dist/generators/ts/_snippets/snippets_convertToLazyObject.d.ts +0 -3
  336. package/dist/generators/ts/_snippets/snippets_convertToLazyObject.js +0 -15
  337. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectOption.d.ts +0 -3
  338. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectOption.js +0 -31
  339. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectSet.d.ts +0 -3
  340. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectSet.js +0 -25
  341. package/dist/generators/ts/_snippets/snippets_fromRdfLanguageIn.d.ts +0 -3
  342. package/dist/generators/ts/_snippets/snippets_fromRdfLanguageIn.js +0 -15
  343. package/dist/generators/ts/_snippets/snippets_fromRdfPreferredLanguages.d.ts +0 -3
  344. package/dist/generators/ts/_snippets/snippets_fromRdfPreferredLanguages.js +0 -23
@@ -14,10 +14,6 @@ export class AbstractType {
14
14
  configuration;
15
15
  logger;
16
16
  reusables;
17
- /**
18
- * Alias for this type.
19
- */
20
- alias;
21
17
  /**
22
18
  * Comment from rdfs:comment.
23
19
  */
@@ -26,23 +22,35 @@ export class AbstractType {
26
22
  * Label from rdfs:label.
27
23
  */
28
24
  label;
29
- constructor({ alias, comment, configuration, label, logger, reusables, }) {
30
- this.alias = alias;
25
+ /**
26
+ * Name for this type.
27
+ */
28
+ name;
29
+ /**
30
+ * Identifier of the shape this type was derived from.
31
+ */
32
+ shapeIdentifier;
33
+ constructor({ comment, configuration, label, logger, name, reusables, shapeIdentifier, }) {
31
34
  this.comment = comment;
32
35
  this.configuration = configuration;
33
36
  this.label = label;
34
37
  this.logger = logger;
38
+ this.name = name;
35
39
  this.reusables = reusables;
36
40
  this.rdfjsTermExpression = rdfjsTermExpression.bind({
37
41
  imports: this.reusables.imports,
38
42
  logger: this.logger,
39
43
  snippets: this.reusables.snippets,
40
44
  });
45
+ this.shapeIdentifier = shapeIdentifier;
41
46
  }
42
47
  /**
43
48
  * TypeScript object describing this type, for runtime use.
44
49
  */
45
50
  get schema() {
51
+ return this.schemaExpression;
52
+ }
53
+ get schemaExpression() {
46
54
  return code `{ ${joinCode(this.schemaInitializers.concat(), { on: ", " })} }`;
47
55
  }
48
56
  /**
@@ -56,6 +64,9 @@ export class AbstractType {
56
64
  __decorate([
57
65
  Memoize()
58
66
  ], AbstractType.prototype, "schema", null);
67
+ __decorate([
68
+ Memoize()
69
+ ], AbstractType.prototype, "schemaExpression", null);
59
70
  (function (AbstractType) {
60
71
  class GraphqlType {
61
72
  /**
@@ -63,47 +74,62 @@ __decorate([
63
74
  */
64
75
  nullable;
65
76
  /**
66
- * The name of the type when it's nullable -- so it should never include "new graphql.GraphQLNonNull(...)" around it.
77
+ * The expression of the type when it's nullable -- so it should never include "new graphql.GraphQLNonNull(...)" around it.
67
78
  */
68
- nullableName;
79
+ nullableExpression;
69
80
  reusables;
70
- constructor(nullableName, reusables, options) {
81
+ constructor(nullableExpression, reusables, options) {
71
82
  this.nullable = !!options?.nullable;
72
- this.nullableName = nullableName;
83
+ this.nullableExpression = nullableExpression;
73
84
  this.reusables = reusables;
74
85
  }
75
- get name() {
86
+ get expression() {
76
87
  return this.nullable
77
- ? this.nullableName
78
- : code `new ${this.reusables.imports.GraphQLNonNull}(${this.nullableName})`;
88
+ ? this.nullableExpression
89
+ : code `new ${this.reusables.imports.GraphQLNonNull}(${this.nullableExpression})`;
79
90
  }
80
91
  }
81
92
  __decorate([
82
93
  Memoize()
83
- ], GraphqlType.prototype, "name", null);
94
+ ], GraphqlType.prototype, "expression", null);
84
95
  AbstractType.GraphqlType = GraphqlType;
96
+ let JsType;
97
+ (function (JsType) {
98
+ function equals(left, right) {
99
+ if (left.typeof !== right.typeof) {
100
+ return false;
101
+ }
102
+ if (left.typeof === "object" &&
103
+ right.typeof === "object" &&
104
+ left.instanceof !== right.instanceof) {
105
+ return false;
106
+ }
107
+ return true;
108
+ }
109
+ JsType.equals = equals;
110
+ })(JsType = AbstractType.JsType || (AbstractType.JsType = {}));
85
111
  class JsonType {
86
112
  /**
87
113
  * Is the type optional in JSON? Equivalent to ? in TypeScript or | undefined.
88
114
  */
89
115
  optional;
90
116
  /**
91
- * The name of the type when it's required i.e. -- so it should never include "| undefined".
117
+ * The expression of the type when it's required i.e. -- so it should never include "| undefined".
92
118
  */
93
- requiredName;
94
- constructor(requiredName, parameters) {
119
+ requiredExpression;
120
+ constructor(requiredExpression, parameters) {
95
121
  this.optional = !!parameters?.optional;
96
- this.requiredName = requiredName;
122
+ this.requiredExpression = requiredExpression;
97
123
  }
98
- get name() {
124
+ get expression() {
99
125
  return this.optional
100
- ? code `(${this.requiredName}) | undefined`
101
- : this.requiredName;
126
+ ? code `(${this.requiredExpression}) | undefined`
127
+ : this.requiredExpression;
102
128
  }
103
129
  }
104
130
  __decorate([
105
131
  Memoize()
106
- ], JsonType.prototype, "name", null);
132
+ ], JsonType.prototype, "expression", null);
107
133
  AbstractType.JsonType = JsonType;
108
134
  })(AbstractType || (AbstractType = {}));
109
135
  //# sourceMappingURL=AbstractType.js.map
@@ -3,11 +3,16 @@ import { Maybe } from "purify-ts";
3
3
  import { AbstractLiteralType } from "./AbstractLiteralType.js";
4
4
  import { type Code } from "./ts-poet-wrapper.js";
5
5
  export declare class BigDecimalType extends AbstractLiteralType {
6
+ protected readonly inlineExpression: Code;
6
7
  readonly conversionFunction: Maybe<AbstractLiteralType.ConversionFunction>;
7
- readonly expression: Code;
8
8
  readonly filterFunction: Code;
9
9
  readonly filterType: Code;
10
+ readonly fromRdfResourceValuesFunction: Code;
10
11
  readonly hashFunction: Code;
12
+ readonly jsTypes: readonly [{
13
+ readonly instanceof: "Object";
14
+ readonly typeof: "object";
15
+ }];
11
16
  readonly kind = "BigDecimal";
12
17
  readonly schemaType: Code;
13
18
  readonly valueSparqlWherePatternsFunction: Code;
@@ -16,9 +21,8 @@ export declare class BigDecimalType extends AbstractLiteralType {
16
21
  graphqlResolveExpression({ variables, }: Parameters<AbstractLiteralType["graphqlResolveExpression"]>[0]): Code;
17
22
  jsonSchema(): Code;
18
23
  jsonType(): AbstractLiteralType.JsonType;
19
- literalExpression(literal: Literal): Code;
24
+ literalValueExpression(literal: Literal): Code;
20
25
  toJsonExpression({ variables, }: Parameters<AbstractLiteralType["toJsonExpression"]>[0]): Code;
21
26
  toRdfResourceValuesExpression({ variables, }: Parameters<AbstractLiteralType["toRdfResourceValuesExpression"]>[0]): Code;
22
- protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<AbstractLiteralType["fromRdfResourceValuesExpressionChain"]>[0]): ReturnType<AbstractLiteralType["fromRdfResourceValuesExpressionChain"]>;
23
27
  }
24
28
  //# sourceMappingURL=BigDecimalType.d.ts.map
@@ -9,11 +9,15 @@ import { Memoize } from "typescript-memoize";
9
9
  import { AbstractLiteralType } from "./AbstractLiteralType.js";
10
10
  import { code, literalOf } from "./ts-poet-wrapper.js";
11
11
  export class BigDecimalType extends AbstractLiteralType {
12
+ inlineExpression = code `${this.reusables.imports.BigDecimal}`;
12
13
  conversionFunction = Maybe.empty();
13
- expression = code `${this.reusables.imports.BigDecimal}`;
14
14
  filterFunction = code `${this.reusables.snippets.filterBigDecimal}`;
15
15
  filterType = code `${this.reusables.snippets.NumericFilter}<${this.reusables.imports.BigDecimal}>`;
16
+ fromRdfResourceValuesFunction = code `${this.reusables.snippets.bigDecimalFromRdfResourceValues}`;
16
17
  hashFunction = code `${this.reusables.snippets.hashBigDecimal}`;
18
+ jsTypes = [
19
+ { instanceof: "Object", typeof: "object" },
20
+ ];
17
21
  kind = "BigDecimal";
18
22
  schemaType = code `${this.reusables.snippets.NumericSchema}<${this.reusables.imports.BigDecimal}>`;
19
23
  valueSparqlWherePatternsFunction = code `${this.reusables.snippets.bigDecimalSparqlWherePatterns}`;
@@ -30,9 +34,9 @@ export class BigDecimalType extends AbstractLiteralType {
30
34
  return code `${this.reusables.imports.z}.string()`;
31
35
  }
32
36
  jsonType() {
33
- return new AbstractLiteralType.JsonType("string");
37
+ return new AbstractLiteralType.JsonType(code `string`);
34
38
  }
35
- literalExpression(literal) {
39
+ literalValueExpression(literal) {
36
40
  return code `new ${this.reusables.imports.BigDecimal}(${literalOf(literal.value)})`;
37
41
  }
38
42
  toJsonExpression({ variables, }) {
@@ -41,12 +45,6 @@ export class BigDecimalType extends AbstractLiteralType {
41
45
  toRdfResourceValuesExpression({ variables, }) {
42
46
  return code `[${this.reusables.snippets.bigDecimalLiteral}(${variables.value})]`;
43
47
  }
44
- fromRdfResourceValuesExpressionChain({ variables, }) {
45
- return {
46
- ...super.fromRdfResourceValuesExpressionChain({ variables }),
47
- valueTo: code `chain(values => values.chainMap(value => value.toLiteral().chain(${this.reusables.snippets.decodeBigDecimalLiteral})))`,
48
- };
49
- }
50
48
  }
51
49
  __decorate([
52
50
  Memoize()
@@ -2,14 +2,16 @@ import type { Literal } from "@rdfjs/types";
2
2
  import { AbstractNumericType } from "./AbstractNumericType.js";
3
3
  import { type Code } from "./ts-poet-wrapper.js";
4
4
  export declare class BigIntType extends AbstractNumericType<bigint> {
5
+ readonly jsTypes: {
6
+ readonly typeof: "bigint";
7
+ }[];
5
8
  readonly kind = "BigInt";
6
- readonly typeofs: "bigint"[];
9
+ get fromRdfResourceValuesFunction(): Code;
7
10
  get graphqlType(): import("./AbstractType.js").AbstractType.GraphqlType;
8
11
  fromJsonExpression({ variables, }: Parameters<AbstractNumericType<bigint>["fromJsonExpression"]>[0]): Code;
9
12
  jsonSchema(_parameters: Parameters<AbstractNumericType<bigint>["jsonSchema"]>[0]): Code;
10
13
  jsonType(): AbstractNumericType.JsonType;
11
- literalExpression(literal: bigint | Literal): Code;
14
+ literalValueExpression(literal: bigint | Literal): Code;
12
15
  toJsonExpression({ variables, }: Parameters<AbstractNumericType<bigint>["toJsonExpression"]>[0]): Code;
13
- protected fromRdfResourceValueExpression({ variables, }: Parameters<AbstractNumericType<bigint>["fromRdfResourceValueExpression"]>[0]): Code;
14
16
  }
15
17
  //# sourceMappingURL=BigIntType.d.ts.map
@@ -9,8 +9,11 @@ import { Memoize } from "typescript-memoize";
9
9
  import { AbstractNumericType } from "./AbstractNumericType.js";
10
10
  import { code, joinCode, literalOf } from "./ts-poet-wrapper.js";
11
11
  export class BigIntType extends AbstractNumericType {
12
+ jsTypes = [{ typeof: "bigint" }];
12
13
  kind = "BigInt";
13
- typeofs = ["bigint"];
14
+ get fromRdfResourceValuesFunction() {
15
+ return code `${this.reusables.snippets.bigIntFromRdfResourceValues}<${this.expression}>`;
16
+ }
14
17
  get graphqlType() {
15
18
  return new AbstractNumericType.GraphqlType(code `${this.reusables.imports.GraphQLBigInt}`, this.reusables);
16
19
  }
@@ -34,16 +37,16 @@ export class BigIntType extends AbstractNumericType {
34
37
  jsonType() {
35
38
  return new AbstractNumericType.JsonType(code `string`);
36
39
  }
37
- literalExpression(literal) {
40
+ literalValueExpression(literal) {
38
41
  return code `${typeof literal === "bigint" ? literal : LiteralDecoder.decodeBigIntLiteral(literal).unsafeCoerce()}n`;
39
42
  }
40
43
  toJsonExpression({ variables, }) {
41
44
  return code `${variables.value}.toString()`;
42
45
  }
43
- fromRdfResourceValueExpression({ variables, }) {
44
- return code `${variables.value}.toBigInt(${this.primitiveIn.length > 0 ? `[${this.primitiveIn.map((_) => `${_}n`).join(", ")}] as const` : ""})`;
45
- }
46
46
  }
47
+ __decorate([
48
+ Memoize()
49
+ ], BigIntType.prototype, "fromRdfResourceValuesFunction", null);
47
50
  __decorate([
48
51
  Memoize()
49
52
  ], BigIntType.prototype, "graphqlType", null);
@@ -3,10 +3,11 @@ import { Maybe } from "purify-ts";
3
3
  import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
4
4
  import { type Code } from "./ts-poet-wrapper.js";
5
5
  export declare class BlankNodeType extends AbstractIdentifierType<BlankNode> {
6
+ protected readonly inlineExpression: Code;
6
7
  readonly conversionFunction: Maybe<AbstractIdentifierType.ConversionFunction>;
7
- readonly expression: Code;
8
8
  readonly filterFunction: Code;
9
9
  readonly filterType: Code;
10
+ readonly fromRdfResourceValuesFunction: Code;
10
11
  readonly kind = "BlankNode";
11
12
  readonly nodeKinds: ReadonlySet<"BlankNode">;
12
13
  readonly parseFunction: Code;
@@ -17,11 +18,5 @@ export declare class BlankNodeType extends AbstractIdentifierType<BlankNode> {
17
18
  jsonSchema({ includeDiscriminantProperty, }: Parameters<AbstractIdentifierType<BlankNode>["jsonSchema"]>[0]): Code;
18
19
  jsonType(parameters?: Parameters<AbstractIdentifierType<BlankNode>["jsonType"]>[0]): AbstractIdentifierType.JsonType;
19
20
  toJsonExpression({ includeDiscriminantProperty, variables, }: Parameters<AbstractIdentifierType<BlankNode>["toJsonExpression"]>[0]): Code;
20
- protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<AbstractIdentifierType<BlankNode>["fromRdfResourceValuesExpressionChain"]>[0]): {
21
- valueTo: Code;
22
- hasValues?: Code;
23
- languageIn?: Code;
24
- preferredLanguages?: Code;
25
- };
26
21
  }
27
22
  //# sourceMappingURL=BlankNodeType.d.ts.map
@@ -9,22 +9,23 @@ import { Memoize } from "typescript-memoize";
9
9
  import { AbstractIdentifierType } from "./AbstractIdentifierType.js";
10
10
  import { code } from "./ts-poet-wrapper.js";
11
11
  export class BlankNodeType extends AbstractIdentifierType {
12
+ inlineExpression = code `${this.reusables.imports.BlankNode}`;
12
13
  conversionFunction = Maybe.of({
13
14
  code: code `${this.reusables.snippets.convertToBlankNode}`,
14
15
  sourceTypes: [
15
16
  {
16
17
  expression: code `${this.reusables.imports.BlankNode}`,
17
- typeof: "object",
18
+ jsType: this.jsTypes[0],
18
19
  },
19
20
  {
20
21
  expression: code `undefined`,
21
- typeof: "undefined",
22
+ jsType: { typeof: "undefined" },
22
23
  },
23
24
  ],
24
25
  });
25
- expression = code `${this.reusables.imports.BlankNode}`;
26
26
  filterFunction = code `${this.reusables.snippets.filterBlankNode}`;
27
27
  filterType = code `${this.reusables.snippets.BlankNodeFilter}`;
28
+ fromRdfResourceValuesFunction = code `${this.reusables.snippets.blankNodeFromRdfResourceValues}`;
28
29
  kind = "BlankNode";
29
30
  nodeKinds = nodeKinds;
30
31
  parseFunction = code `${this.reusables.snippets.parseBlankNode};`;
@@ -58,12 +59,6 @@ export class BlankNodeType extends AbstractIdentifierType {
58
59
  : "";
59
60
  return code `{ "@id": \`_:\${${variables.value}.value}\`${discriminantProperty} }`;
60
61
  }
61
- fromRdfResourceValuesExpressionChain({ variables, }) {
62
- return {
63
- ...super.fromRdfResourceValuesExpressionChain({ variables }),
64
- valueTo: code `chain(values => values.chainMap(value => value.toBlankNode()))`,
65
- };
66
- }
67
62
  }
68
63
  __decorate([
69
64
  Memoize()
@@ -6,14 +6,16 @@ export declare class BooleanType extends AbstractPrimitiveType<boolean> {
6
6
  readonly filterType: Code;
7
7
  readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
8
8
  readonly hashFunction: Code;
9
+ readonly jsTypes: readonly [{
10
+ readonly typeof: "boolean";
11
+ }];
9
12
  readonly kind = "Boolean";
10
- readonly typeofs: "boolean"[];
11
13
  readonly valueSparqlWherePatternsFunction: Code;
12
- get expression(): Code;
14
+ get fromRdfResourceValuesFunction(): Code;
13
15
  get schemaType(): Code;
16
+ protected get inlineExpression(): Code;
14
17
  jsonSchema(_parameters: Parameters<AbstractPrimitiveType<number>["jsonSchema"]>[0]): Code;
15
- literalExpression(literal: boolean | Literal): Code;
18
+ literalValueExpression(literal: boolean | Literal): Code;
16
19
  toRdfResourceValuesExpression({ variables, }: Parameters<AbstractPrimitiveType<boolean>["toRdfResourceValuesExpression"]>[0]): Code;
17
- protected fromRdfResourceValuesExpressionChain({ variables, }: Parameters<AbstractPrimitiveType<boolean>["fromRdfResourceValuesExpressionChain"]>[0]): ReturnType<AbstractPrimitiveType<boolean>["fromRdfResourceValuesExpressionChain"]>;
18
20
  }
19
21
  //# sourceMappingURL=BooleanType.d.ts.map
@@ -13,43 +13,41 @@ export class BooleanType extends AbstractPrimitiveType {
13
13
  filterType = code `${this.reusables.snippets.BooleanFilter}`;
14
14
  graphqlType = new AbstractPrimitiveType.GraphqlType(code `${this.reusables.imports.GraphQLBoolean}`, this.reusables);
15
15
  hashFunction = code `${this.reusables.snippets.hashBoolean}`;
16
+ jsTypes = [{ typeof: "boolean" }];
16
17
  kind = "Boolean";
17
- typeofs = ["boolean"];
18
18
  valueSparqlWherePatternsFunction = code `${this.reusables.snippets.booleanSparqlWherePatterns}`;
19
- get expression() {
19
+ get fromRdfResourceValuesFunction() {
20
+ return code `${this.reusables.snippets.booleanFromRdfResourceValues}<${this.expression}>`;
21
+ }
22
+ get schemaType() {
23
+ return code `${this.reusables.snippets.BooleanSchema}<${this.expression}>`;
24
+ }
25
+ get inlineExpression() {
20
26
  if (this.primitiveIn.length > 0) {
21
27
  return code `${this.primitiveIn.map((value) => value.toString()).join(" | ")}`;
22
28
  }
23
29
  return code `boolean`;
24
30
  }
25
- get schemaType() {
26
- return code `${this.reusables.snippets.BooleanSchema}<${this.expression}>`;
27
- }
28
31
  jsonSchema(_parameters) {
29
32
  if (this.primitiveIn.length === 1) {
30
33
  return code `${this.reusables.imports.z}.literal(${this.primitiveIn[0]})`;
31
34
  }
32
35
  return code `${this.reusables.imports.z}.boolean()`;
33
36
  }
34
- literalExpression(literal) {
37
+ literalValueExpression(literal) {
35
38
  return code `${typeof literal === "boolean" ? literal : LiteralDecoder.decodeBooleanLiteral(literal).unsafeCoerce()}`;
36
39
  }
37
40
  toRdfResourceValuesExpression({ variables, }) {
38
41
  return code `[${this.reusables.snippets.literalFactory}.boolean(${variables.value}, ${this.rdfjsTermExpression(this.datatype)})]`;
39
42
  }
40
- fromRdfResourceValuesExpressionChain({ variables, }) {
41
- return {
42
- ...super.fromRdfResourceValuesExpressionChain({ variables }),
43
- languageIn: undefined,
44
- preferredLanguages: undefined,
45
- valueTo: code `chain(values => values.chainMap(value => value.toBoolean(${this.primitiveIn.length === 1 ? `[${this.primitiveIn[0]}] as const` : ""})))`,
46
- };
47
- }
48
43
  }
49
44
  __decorate([
50
45
  Memoize()
51
- ], BooleanType.prototype, "expression", null);
46
+ ], BooleanType.prototype, "fromRdfResourceValuesFunction", null);
52
47
  __decorate([
53
48
  Memoize()
54
49
  ], BooleanType.prototype, "schemaType", null);
50
+ __decorate([
51
+ Memoize()
52
+ ], BooleanType.prototype, "inlineExpression", null);
55
53
  //# sourceMappingURL=BooleanType.js.map
@@ -5,9 +5,9 @@ export declare class DateTimeType extends AbstractDateType {
5
5
  readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
6
6
  readonly hashFunction: Code;
7
7
  readonly kind = "DateTime";
8
+ get fromRdfResourceValuesFunction(): Code;
8
9
  jsonSchema(_parameters: Parameters<AbstractDateType["jsonSchema"]>[0]): Code;
9
- literalExpression(literal: Date | Literal): Code;
10
+ literalValueExpression(literal: Date | Literal): Code;
10
11
  toJsonExpression({ variables, }: Parameters<AbstractDateType["toJsonExpression"]>[0]): Code;
11
- protected fromRdfResourceValueExpression({ variables, }: Parameters<AbstractDateType["fromRdfResourceValueExpression"]>[0]): Code;
12
12
  }
13
13
  //# sourceMappingURL=DateTimeType.d.ts.map
@@ -1,21 +1,31 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
1
7
  import { LiteralDecoder } from "@rdfx/literal";
8
+ import { Memoize } from "typescript-memoize";
2
9
  import { AbstractDateType } from "./AbstractDateType.js";
3
10
  import { code } from "./ts-poet-wrapper.js";
4
11
  export class DateTimeType extends AbstractDateType {
5
12
  graphqlType = new DateTimeType.GraphqlType(code `${this.reusables.imports.GraphQLDateTime}`, this.reusables);
6
13
  hashFunction = code `${this.reusables.snippets.hashDateTime}`;
7
14
  kind = "DateTime";
15
+ get fromRdfResourceValuesFunction() {
16
+ return code `${this.reusables.snippets.dateTimeFromRdfResourceValues}`;
17
+ }
8
18
  jsonSchema(_parameters) {
9
19
  return code `${this.reusables.imports.z}.iso.datetime()`;
10
20
  }
11
- literalExpression(literal) {
21
+ literalValueExpression(literal) {
12
22
  return code `new Date("${(literal instanceof Date ? literal : LiteralDecoder.decodeDateTimeLiteral(literal).unsafeCoerce()).toISOString()}")`;
13
23
  }
14
24
  toJsonExpression({ variables, }) {
15
25
  return code `${variables.value}.toISOString()`;
16
26
  }
17
- fromRdfResourceValueExpression({ variables, }) {
18
- return code `${variables.value}.toDateTime(${this.primitiveIn.length > 0 ? `[${this.primitiveIn.map((_) => `new Date(${_.getTime()})`).join(", ")}]` : ""})`;
19
- }
20
27
  }
28
+ __decorate([
29
+ Memoize()
30
+ ], DateTimeType.prototype, "fromRdfResourceValuesFunction", null);
21
31
  //# sourceMappingURL=DateTimeType.js.map
@@ -6,9 +6,9 @@ export declare class DateType extends AbstractDateType {
6
6
  readonly graphqlType: import("./AbstractType.js").AbstractType.GraphqlType;
7
7
  readonly hashFunction: Code;
8
8
  readonly kind = "Date";
9
+ get fromRdfResourceValuesFunction(): Code;
9
10
  jsonSchema(_parameters: Parameters<DateTimeType["jsonSchema"]>[0]): Code;
10
- literalExpression(literal: Date | Literal): Code;
11
+ literalValueExpression(literal: Date | Literal): Code;
11
12
  toJsonExpression({ variables, }: Parameters<AbstractDateType["toJsonExpression"]>[0]): Code;
12
- protected fromRdfResourceValueExpression({ variables, }: Parameters<AbstractDateType["fromRdfResourceValueExpression"]>[0]): Code;
13
13
  }
14
14
  //# sourceMappingURL=DateType.d.ts.map
@@ -1,4 +1,11 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
1
7
  import { LiteralDecoder } from "@rdfx/literal";
8
+ import { Memoize } from "typescript-memoize";
2
9
  import { AbstractDateType } from "./AbstractDateType.js";
3
10
  import { DateTimeType } from "./DateTimeType.js";
4
11
  import { code } from "./ts-poet-wrapper.js";
@@ -6,17 +13,20 @@ export class DateType extends AbstractDateType {
6
13
  graphqlType = new DateTimeType.GraphqlType(code `${this.reusables.imports.GraphQLDate}`, this.reusables);
7
14
  hashFunction = code `${this.reusables.snippets.hashDate}`;
8
15
  kind = "Date";
16
+ get fromRdfResourceValuesFunction() {
17
+ return code `${this.reusables.snippets.dateFromRdfResourceValues}`;
18
+ }
9
19
  jsonSchema(_parameters) {
10
20
  return code `${this.reusables.imports.z}.iso.date()`;
11
21
  }
12
- literalExpression(literal) {
22
+ literalValueExpression(literal) {
13
23
  return code `new Date("${(literal instanceof Date ? literal : LiteralDecoder.decodeDateLiteral(literal).unsafeCoerce()).toISOString()}")`;
14
24
  }
15
25
  toJsonExpression({ variables, }) {
16
26
  return code `${this.reusables.snippets.toIsoDateString}(${variables.value})`;
17
27
  }
18
- fromRdfResourceValueExpression({ variables, }) {
19
- return code `${variables.value}.toDate(${this.primitiveIn.length > 0 ? `[${this.primitiveIn.map((_) => `new Date(${_.getTime()})`).join(", ")}]` : ""})`;
20
- }
21
28
  }
29
+ __decorate([
30
+ Memoize()
31
+ ], DateType.prototype, "fromRdfResourceValuesFunction", null);
22
32
  //# sourceMappingURL=DateType.js.map
@@ -9,8 +9,45 @@ export declare class DefaultValueType<ItemTypeT extends DefaultValueType.ItemTyp
9
9
  readonly defaultValue: Literal | NamedNode;
10
10
  readonly discriminantProperty: Maybe<AbstractType.DiscriminantProperty>;
11
11
  readonly graphqlArgs: AbstractType["graphqlArgs"];
12
+ readonly jsTypes: readonly AbstractType.JsType[] | readonly [{
13
+ readonly instanceof: "Object";
14
+ readonly typeof: "object";
15
+ }] | readonly [{
16
+ readonly instanceof: "Object";
17
+ readonly typeof: "object";
18
+ }] | readonly [{
19
+ readonly instanceof: "Object";
20
+ readonly typeof: "object";
21
+ }] | {
22
+ readonly typeof: "bigint";
23
+ }[] | readonly [{
24
+ readonly typeof: "boolean";
25
+ }] | readonly [{
26
+ readonly instanceof: "Date";
27
+ readonly typeof: "object";
28
+ }] | readonly [{
29
+ readonly instanceof: "Date";
30
+ readonly typeof: "object";
31
+ }] | readonly [{
32
+ readonly typeof: "number";
33
+ }] | readonly [{
34
+ readonly typeof: "number";
35
+ }] | readonly [{
36
+ readonly instanceof: "Object";
37
+ readonly typeof: "object";
38
+ }] | readonly [{
39
+ readonly instanceof: "Object";
40
+ readonly typeof: "object";
41
+ }] | readonly [{
42
+ readonly typeof: "string";
43
+ }] | readonly [{
44
+ readonly instanceof: "Array";
45
+ readonly typeof: "object";
46
+ }] | readonly [{
47
+ readonly instanceof: "Object";
48
+ readonly typeof: "object";
49
+ }];
12
50
  readonly kind = "DefaultValue";
13
- readonly typeofs: "object"[];
14
51
  readonly validationFunction: Maybe<Code>;
15
52
  constructor({ defaultValue, ...superParameters }: {
16
53
  defaultValue: Literal | NamedNode;
@@ -20,16 +57,17 @@ export declare class DefaultValueType<ItemTypeT extends DefaultValueType.ItemTyp
20
57
  get expression(): Code;
21
58
  get filterFunction(): Code;
22
59
  get filterType(): Code;
60
+ get fromRdfResourceValuesFunction(): Code;
23
61
  get graphqlType(): AbstractContainerType.GraphqlType;
24
62
  get hashFunction(): Code;
25
63
  get mutable(): boolean;
26
64
  get schemaType(): Code;
65
+ get toRdfResourceValueTypes(): AbstractContainerType<ItemTypeT>["toRdfResourceValueTypes"];
27
66
  get valueSparqlConstructTriplesFunction(): Code;
28
67
  get valueSparqlWherePatternsFunction(): Code;
29
68
  protected get schemaInitializers(): Code[];
30
69
  private get defaultValueExpression();
31
70
  fromJsonExpression(parameters: Parameters<AbstractType["fromJsonExpression"]>[0]): Code;
32
- fromRdfResourceValuesExpression({ variables, }: Parameters<AbstractContainerType<ItemTypeT>["fromRdfResourceValuesExpression"]>[0]): Code;
33
71
  graphqlResolveExpression(parameters: Parameters<AbstractContainerType<ItemTypeT>["graphqlResolveExpression"]>[0]): Code;
34
72
  jsonSchema(parameters: Parameters<AbstractContainerType<ItemTypeT>["jsonSchema"]>[0]): Code;
35
73
  jsonType(parameters?: Parameters<AbstractContainerType<ItemTypeT>["jsonType"]>[0]): AbstractType.JsonType;
@@ -13,8 +13,8 @@ export class DefaultValueType extends AbstractContainerType {
13
13
  defaultValue;
14
14
  discriminantProperty = Maybe.empty();
15
15
  graphqlArgs = Maybe.empty();
16
+ jsTypes = this.itemType.jsTypes;
16
17
  kind = "DefaultValue";
17
- typeofs = ["object"];
18
18
  validationFunction = this.itemType.validationFunction;
19
19
  constructor({ defaultValue, ...superParameters }) {
20
20
  super(superParameters);
@@ -25,10 +25,10 @@ export class DefaultValueType extends AbstractContainerType {
25
25
  return Maybe.of({
26
26
  code: code `${this.reusables.snippets.convertWithDefaultValue}(${itemConversionFunction.code}, ${this.defaultValueExpression})`,
27
27
  sourceTypes: itemConversionFunction.sourceTypes
28
- .filter((sourceType) => sourceType.typeof !== "undefined")
28
+ .filter((sourceType) => sourceType.jsType.typeof !== "undefined")
29
29
  .concat({
30
30
  expression: code `undefined`,
31
- typeof: "undefined",
31
+ jsType: { typeof: "undefined" },
32
32
  }),
33
33
  });
34
34
  }
@@ -44,6 +44,9 @@ export class DefaultValueType extends AbstractContainerType {
44
44
  get filterType() {
45
45
  return this.itemType.filterType;
46
46
  }
47
+ get fromRdfResourceValuesFunction() {
48
+ return code `${this.reusables.snippets.defaultValueFromRdfResourceValues}<${this.itemType.expression}, ${this.itemType.schemaType}>(${this.itemType.fromRdfResourceValuesFunction})`;
49
+ }
47
50
  get graphqlType() {
48
51
  return this.itemType.graphqlType;
49
52
  }
@@ -54,7 +57,10 @@ export class DefaultValueType extends AbstractContainerType {
54
57
  return this.itemType.mutable;
55
58
  }
56
59
  get schemaType() {
57
- return code `${this.reusables.snippets.DefaultValueSchema}<${this.itemType.expression}, ${this.itemType.schemaType}>`;
60
+ return code `${this.reusables.snippets.DefaultValueSchema}<${this.itemType.schemaType}>`;
61
+ }
62
+ get toRdfResourceValueTypes() {
63
+ return this.itemType.toRdfResourceValueTypes;
58
64
  }
59
65
  get valueSparqlConstructTriplesFunction() {
60
66
  return this.itemType.valueSparqlConstructTriplesFunction;
@@ -63,7 +69,7 @@ export class DefaultValueType extends AbstractContainerType {
63
69
  return code `${this.reusables.snippets.defaultValueSparqlWherePatterns}<${this.itemType.filterType}, ${this.itemType.schemaType}>(${this.itemType.valueSparqlWherePatternsFunction})`;
64
70
  }
65
71
  get schemaInitializers() {
66
- return super.schemaInitializers.concat(code `defaultValue: ${this.defaultValueExpression}`);
72
+ return super.schemaInitializers.concat(code `defaultValue: ${this.rdfjsTermExpression(this.defaultValue)}`);
67
73
  }
68
74
  get defaultValueExpression() {
69
75
  switch (this.itemType.kind) {
@@ -79,19 +85,11 @@ export class DefaultValueType extends AbstractContainerType {
79
85
  throw new RangeError(`not implemented ${this.itemType.kind}`);
80
86
  }
81
87
  invariant(this.defaultValue.termType === "Literal");
82
- return this.itemType.literalExpression(this.defaultValue);
88
+ return this.itemType.literalValueExpression(this.defaultValue);
83
89
  }
84
90
  fromJsonExpression(parameters) {
85
91
  return this.itemType.fromJsonExpression(parameters);
86
92
  }
87
- fromRdfResourceValuesExpression({ variables, }) {
88
- return this.itemType.fromRdfResourceValuesExpression({
89
- variables: {
90
- ...variables,
91
- resourceValues: code `${variables.resourceValues}.map(values => values.length > 0 ? values : new ${this.reusables.imports.Resource}.Value(${{ dataFactory: this.reusables.imports.dataFactory, focusResource: variables.resource, propertyPath: variables.propertyPath, term: this.rdfjsTermExpression(this.defaultValue) }}).toValues())`,
92
- },
93
- });
94
- }
95
93
  graphqlResolveExpression(parameters) {
96
94
  return this.itemType.graphqlResolveExpression(parameters);
97
95
  }
@@ -118,6 +116,9 @@ export class DefaultValueType extends AbstractContainerType {
118
116
  __decorate([
119
117
  Memoize()
120
118
  ], DefaultValueType.prototype, "conversionFunction", null);
119
+ __decorate([
120
+ Memoize()
121
+ ], DefaultValueType.prototype, "fromRdfResourceValuesFunction", null);
121
122
  __decorate([
122
123
  Memoize()
123
124
  ], DefaultValueType.prototype, "schemaType", null);