@shaclmate/compiler 4.0.33 → 4.0.34

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 (220) hide show
  1. package/dist/Compiler.d.ts +0 -3
  2. package/dist/Compiler.js +0 -2
  3. package/dist/ShapesGraphToAstTransformer.d.ts +1 -4
  4. package/dist/ShapesGraphToAstTransformer.js +1 -5
  5. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +1 -3
  6. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +4 -7
  7. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +0 -1
  8. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +1 -3
  9. package/dist/ast/AbstractCompoundType.d.ts +6 -4
  10. package/dist/ast/AbstractCompoundType.js +4 -37
  11. package/dist/ast/ObjectType.d.ts +1 -7
  12. package/dist/ast/ObjectType.js +1 -6
  13. package/dist/generators/ts/AbstractCollectionType.d.ts +8 -8
  14. package/dist/generators/ts/AbstractCollectionType.js +28 -111
  15. package/dist/generators/ts/AbstractContainerType.d.ts +1 -1
  16. package/dist/generators/ts/AbstractDateType.d.ts +4 -9
  17. package/dist/generators/ts/AbstractDateType.js +2 -29
  18. package/dist/generators/ts/AbstractIdentifierType.d.ts +4 -1
  19. package/dist/generators/ts/AbstractIdentifierType.js +0 -17
  20. package/dist/generators/ts/AbstractLazyObjectType.d.ts +8 -5
  21. package/dist/generators/ts/AbstractLazyObjectType.js +21 -21
  22. package/dist/generators/ts/AbstractLiteralType.d.ts +11 -3
  23. package/dist/generators/ts/AbstractLiteralType.js +1 -1
  24. package/dist/generators/ts/AbstractNamedUnionType.d.ts +2 -5
  25. package/dist/generators/ts/AbstractNamedUnionType.js +27 -58
  26. package/dist/generators/ts/AbstractNumericType.d.ts +9 -8
  27. package/dist/generators/ts/AbstractNumericType.js +18 -11
  28. package/dist/generators/ts/AbstractPrimitiveType.d.ts +8 -4
  29. package/dist/generators/ts/AbstractPrimitiveType.js +9 -17
  30. package/dist/generators/ts/AbstractTermType.d.ts +8 -4
  31. package/dist/generators/ts/AbstractTermType.js +11 -51
  32. package/dist/generators/ts/AbstractType.d.ts +26 -22
  33. package/dist/generators/ts/AbstractType.js +4 -2
  34. package/dist/generators/ts/AbstractUnionType.d.ts +2 -2
  35. package/dist/generators/ts/AbstractUnionType.js +25 -36
  36. package/dist/generators/ts/AnonymousUnionType.d.ts +1 -1
  37. package/dist/generators/ts/AnonymousUnionType.js +3 -3
  38. package/dist/generators/ts/BigDecimalType.d.ts +5 -3
  39. package/dist/generators/ts/BigDecimalType.js +15 -42
  40. package/dist/generators/ts/BigIntType.d.ts +3 -4
  41. package/dist/generators/ts/BigIntType.js +5 -16
  42. package/dist/generators/ts/BlankNodeType.d.ts +7 -7
  43. package/dist/generators/ts/BlankNodeType.js +14 -2
  44. package/dist/generators/ts/BooleanType.d.ts +6 -8
  45. package/dist/generators/ts/BooleanType.js +18 -11
  46. package/dist/generators/ts/DateTimeType.d.ts +5 -1
  47. package/dist/generators/ts/DateTimeType.js +15 -13
  48. package/dist/generators/ts/DateType.d.ts +5 -1
  49. package/dist/generators/ts/DateType.js +16 -14
  50. package/dist/generators/ts/DefaultValueType.d.ts +5 -6
  51. package/dist/generators/ts/DefaultValueType.js +30 -64
  52. package/dist/generators/ts/FloatType.d.ts +3 -3
  53. package/dist/generators/ts/FloatType.js +5 -5
  54. package/dist/generators/ts/IdentifierType.d.ts +6 -6
  55. package/dist/generators/ts/IdentifierType.js +22 -2
  56. package/dist/generators/ts/IntType.d.ts +3 -3
  57. package/dist/generators/ts/IntType.js +5 -5
  58. package/dist/generators/ts/IriType.d.ts +17 -12
  59. package/dist/generators/ts/IriType.js +39 -29
  60. package/dist/generators/ts/LazyObjectOptionType.d.ts +2 -1
  61. package/dist/generators/ts/LazyObjectOptionType.js +23 -44
  62. package/dist/generators/ts/LazyObjectSetType.d.ts +1 -1
  63. package/dist/generators/ts/LazyObjectSetType.js +19 -29
  64. package/dist/generators/ts/LazyObjectType.d.ts +1 -1
  65. package/dist/generators/ts/LazyObjectType.js +17 -25
  66. package/dist/generators/ts/LiteralType.d.ts +5 -3
  67. package/dist/generators/ts/LiteralType.js +25 -12
  68. package/dist/generators/ts/NamedObjectType.d.ts +6 -9
  69. package/dist/generators/ts/NamedObjectType.js +33 -29
  70. package/dist/generators/ts/NamedObjectUnionType.d.ts +3 -1
  71. package/dist/generators/ts/NamedObjectUnionType.js +21 -14
  72. package/dist/generators/ts/OptionType.d.ts +4 -4
  73. package/dist/generators/ts/OptionType.js +22 -45
  74. package/dist/generators/ts/Reusables.d.ts +3 -1
  75. package/dist/generators/ts/Reusables.js +2 -1
  76. package/dist/generators/ts/SetType.d.ts +0 -1
  77. package/dist/generators/ts/SetType.js +4 -22
  78. package/dist/generators/ts/SnippetFactory.d.ts +2 -0
  79. package/dist/generators/ts/Snippets.d.ts +40 -8
  80. package/dist/generators/ts/Snippets.js +235 -30
  81. package/dist/generators/ts/StringType.d.ts +6 -9
  82. package/dist/generators/ts/StringType.js +17 -16
  83. package/dist/generators/ts/TermType.d.ts +1 -4
  84. package/dist/generators/ts/TermType.js +14 -8
  85. package/dist/generators/ts/TsGenerator.d.ts +14 -1
  86. package/dist/generators/ts/TsGenerator.js +41 -12
  87. package/dist/generators/ts/TypeFactory.d.ts +8 -4
  88. package/dist/generators/ts/TypeFactory.js +73 -49
  89. package/dist/generators/ts/ZodGenerator.js +6 -3
  90. package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +27 -20
  91. package/dist/generators/ts/_NamedObjectType/AbstractProperty.js +4 -2
  92. package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.d.ts +7 -7
  93. package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.js +9 -9
  94. package/dist/generators/ts/_NamedObjectType/IdentifierProperty.d.ts +6 -6
  95. package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +35 -39
  96. package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.js +34 -31
  97. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js +1 -1
  98. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +1 -1
  99. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +1 -1
  100. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +7 -16
  101. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +26 -32
  102. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +1 -1
  103. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js +1 -1
  104. package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js +2 -3
  105. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +6 -8
  106. package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js +1 -2
  107. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +1 -1
  108. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js +1 -1
  109. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js +1 -1
  110. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +1 -1
  111. package/dist/generators/ts/_NamedObjectType/NamedObjectType_objectSetMethodNames.d.ts +2 -0
  112. package/dist/generators/ts/_NamedObjectType/NamedObjectType_objectSetMethodNames.js +1 -1
  113. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts +2 -2
  114. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js +1 -1
  115. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts +2 -2
  116. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +1 -1
  117. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.js +2 -2
  118. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.js +1 -1
  119. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js +14 -18
  120. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +1 -1
  121. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js +1 -1
  122. package/dist/generators/ts/_NamedObjectType/ShaclProperty.d.ts +7 -7
  123. package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +22 -30
  124. package/dist/generators/ts/_snippets/snippets_DefaultValueSchema.js +3 -3
  125. package/dist/generators/ts/_snippets/snippets_HashFunction.d.ts +3 -0
  126. package/dist/generators/ts/_snippets/snippets_HashFunction.js +4 -0
  127. package/dist/generators/ts/_snippets/snippets_PropertyPath.js +34 -24
  128. package/dist/generators/ts/_snippets/snippets_convertToBigDecimal.d.ts +3 -0
  129. package/dist/generators/ts/_snippets/snippets_convertToBigDecimal.js +6 -0
  130. package/dist/generators/ts/_snippets/snippets_convertToBlankNode.d.ts +3 -0
  131. package/dist/generators/ts/_snippets/snippets_convertToBlankNode.js +11 -0
  132. package/dist/generators/ts/_snippets/snippets_convertToBlankNodeIdentifierProperty.d.ts +3 -0
  133. package/dist/generators/ts/_snippets/snippets_convertToBlankNodeIdentifierProperty.js +17 -0
  134. package/dist/generators/ts/_snippets/snippets_convertToBoolean.d.ts +3 -0
  135. package/dist/generators/ts/_snippets/snippets_convertToBoolean.js +6 -0
  136. package/dist/generators/ts/_snippets/snippets_convertToDate.d.ts +3 -0
  137. package/dist/generators/ts/_snippets/snippets_convertToDate.js +6 -0
  138. package/dist/generators/ts/_snippets/snippets_convertToDateTime.d.ts +3 -0
  139. package/dist/generators/ts/_snippets/snippets_convertToDateTime.js +6 -0
  140. package/dist/generators/ts/_snippets/snippets_convertToIdentifier.d.ts +3 -0
  141. package/dist/generators/ts/_snippets/snippets_convertToIdentifier.js +13 -0
  142. package/dist/generators/ts/_snippets/snippets_convertToIdentifierProperty.d.ts +3 -0
  143. package/dist/generators/ts/_snippets/snippets_convertToIdentifierProperty.js +21 -0
  144. package/dist/generators/ts/_snippets/snippets_convertToIri.d.ts +3 -0
  145. package/dist/generators/ts/_snippets/snippets_convertToIri.js +11 -0
  146. package/dist/generators/ts/_snippets/snippets_convertToIriIdentifierProperty.d.ts +3 -0
  147. package/dist/generators/ts/_snippets/snippets_convertToIriIdentifierProperty.js +17 -0
  148. package/dist/generators/ts/_snippets/snippets_convertToLazyObject.d.ts +3 -0
  149. package/dist/generators/ts/_snippets/snippets_convertToLazyObject.js +15 -0
  150. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectOption.d.ts +3 -0
  151. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectOption.js +31 -0
  152. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectSet.d.ts +3 -0
  153. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectSet.js +25 -0
  154. package/dist/generators/ts/_snippets/snippets_convertToLiteral.d.ts +3 -0
  155. package/dist/generators/ts/_snippets/snippets_convertToLiteral.js +13 -0
  156. package/dist/generators/ts/_snippets/snippets_convertToMaybe.d.ts +3 -0
  157. package/dist/generators/ts/_snippets/snippets_convertToMaybe.js +19 -0
  158. package/dist/generators/ts/_snippets/snippets_convertToMutableArray.d.ts +3 -0
  159. package/dist/generators/ts/_snippets/snippets_convertToMutableArray.js +14 -0
  160. package/dist/generators/ts/_snippets/snippets_convertToNumeric.d.ts +3 -0
  161. package/dist/generators/ts/_snippets/snippets_convertToNumeric.js +6 -0
  162. package/dist/generators/ts/_snippets/snippets_convertToObject.d.ts +3 -0
  163. package/dist/generators/ts/_snippets/snippets_convertToObject.js +6 -0
  164. package/dist/generators/ts/_snippets/snippets_convertToReadonlyArray.d.ts +3 -0
  165. package/dist/generators/ts/_snippets/snippets_convertToReadonlyArray.js +14 -0
  166. package/dist/generators/ts/_snippets/snippets_convertToString.d.ts +3 -0
  167. package/dist/generators/ts/_snippets/snippets_convertToString.js +6 -0
  168. package/dist/generators/ts/_snippets/snippets_convertToTerm.d.ts +3 -0
  169. package/dist/generators/ts/_snippets/snippets_convertToTerm.js +6 -0
  170. package/dist/generators/ts/_snippets/snippets_convertToUnion.d.ts +3 -0
  171. package/dist/generators/ts/_snippets/snippets_convertToUnion.js +6 -0
  172. package/dist/generators/ts/_snippets/snippets_convertWithDefaultValue.d.ts +3 -0
  173. package/dist/generators/ts/_snippets/snippets_convertWithDefaultValue.js +11 -0
  174. package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +1 -1
  175. package/dist/generators/ts/_snippets/snippets_hashArray.d.ts +3 -0
  176. package/dist/generators/ts/_snippets/snippets_hashArray.js +11 -0
  177. package/dist/generators/ts/_snippets/snippets_hashBigDecimal.d.ts +3 -0
  178. package/dist/generators/ts/_snippets/snippets_hashBigDecimal.js +7 -0
  179. package/dist/generators/ts/_snippets/snippets_hashBoolean.d.ts +3 -0
  180. package/dist/generators/ts/_snippets/snippets_hashBoolean.js +7 -0
  181. package/dist/generators/ts/_snippets/snippets_hashDate.d.ts +3 -0
  182. package/dist/generators/ts/_snippets/snippets_hashDate.js +7 -0
  183. package/dist/generators/ts/_snippets/snippets_hashDateTime.d.ts +3 -0
  184. package/dist/generators/ts/_snippets/snippets_hashDateTime.js +7 -0
  185. package/dist/generators/ts/_snippets/snippets_hashMaybe.d.ts +3 -0
  186. package/dist/generators/ts/_snippets/snippets_hashMaybe.js +11 -0
  187. package/dist/generators/ts/_snippets/snippets_hashNumeric.d.ts +3 -0
  188. package/dist/generators/ts/_snippets/snippets_hashNumeric.js +7 -0
  189. package/dist/generators/ts/_snippets/snippets_hashString.d.ts +3 -0
  190. package/dist/generators/ts/_snippets/snippets_hashString.js +7 -0
  191. package/dist/generators/ts/_snippets/snippets_hashTerm.d.ts +3 -0
  192. package/dist/generators/ts/_snippets/snippets_hashTerm.js +12 -0
  193. package/dist/generators/ts/_snippets/snippets_toIsoDateString.d.ts +3 -0
  194. package/dist/generators/ts/_snippets/snippets_toIsoDateString.js +6 -0
  195. package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +1 -1
  196. package/dist/generators/ts/graphqlSchemaVariableStatement.js +7 -4
  197. package/dist/generators/ts/objectSetDeclarations.js +4 -34
  198. package/dist/generators/ts/objectSetInterfaceDeclaration.js +1 -1
  199. package/dist/generators/ts/objectSetMethodSignatures.js +2 -2
  200. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +2 -2
  201. package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +2 -2
  202. package/dist/input/ShapesGraph.d.ts +5 -8
  203. package/dist/input/ShapesGraph.js +5 -6
  204. package/dist/input/generated.d.ts +171 -226
  205. package/dist/input/generated.js +563 -2082
  206. package/package.json +2 -2
  207. package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.d.ts +0 -6
  208. package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.js +0 -67
  209. package/dist/generators/ts/_snippets/snippets_isReadonlyBigIntArray.d.ts +0 -3
  210. package/dist/generators/ts/_snippets/snippets_isReadonlyBigIntArray.js +0 -6
  211. package/dist/generators/ts/_snippets/snippets_isReadonlyBooleanArray.d.ts +0 -3
  212. package/dist/generators/ts/_snippets/snippets_isReadonlyBooleanArray.js +0 -6
  213. package/dist/generators/ts/_snippets/snippets_isReadonlyNumberArray.d.ts +0 -3
  214. package/dist/generators/ts/_snippets/snippets_isReadonlyNumberArray.js +0 -6
  215. package/dist/generators/ts/_snippets/snippets_isReadonlyObjectArray.d.ts +0 -3
  216. package/dist/generators/ts/_snippets/snippets_isReadonlyObjectArray.js +0 -6
  217. package/dist/generators/ts/_snippets/snippets_isReadonlyStringArray.d.ts +0 -3
  218. package/dist/generators/ts/_snippets/snippets_isReadonlyStringArray.js +0 -6
  219. package/dist/generators/ts/syntheticNamePrefix.d.ts +0 -2
  220. package/dist/generators/ts/syntheticNamePrefix.js +0 -2
@@ -1,7 +1,7 @@
1
1
  import { camelCase, trainCase } from "change-case";
2
2
  import plur from "plur";
3
- import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
4
3
  export function NamedObjectType_objectSetMethodNames() {
4
+ const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
5
5
  const prefixSingular = camelCase(this.name, {
6
6
  prefixCharacters: syntheticNamePrefix,
7
7
  });
@@ -1,9 +1,9 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import type { Reusables } from "../Reusables.js";
3
- import type { TsFeature } from "../TsFeature.js";
3
+ import type { TsGenerator } from "../TsGenerator.js";
4
4
  import { type Code } from "../ts-poet-wrapper.js";
5
5
  export declare function NamedObjectType_sparqlConstructQueryFunctionDeclaration(this: {
6
- readonly features: ReadonlySet<TsFeature>;
6
+ readonly configuration: TsGenerator.Configuration;
7
7
  readonly filterType: Code;
8
8
  readonly name: string;
9
9
  readonly reusables: Reusables;
@@ -2,7 +2,7 @@ import { camelCase } from "change-case";
2
2
  import { Maybe } from "purify-ts";
3
3
  import { code } from "../ts-poet-wrapper.js";
4
4
  export function NamedObjectType_sparqlConstructQueryFunctionDeclaration() {
5
- if (!this.features.has("sparql")) {
5
+ if (!this.configuration.features.has("sparql")) {
6
6
  return Maybe.empty();
7
7
  }
8
8
  return Maybe.of(code `\
@@ -1,9 +1,9 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import type { Reusables } from "../Reusables.js";
3
- import type { TsFeature } from "../TsFeature.js";
3
+ import type { TsGenerator } from "../TsGenerator.js";
4
4
  import { type Code } from "../ts-poet-wrapper.js";
5
5
  export declare function NamedObjectType_sparqlConstructQueryStringFunctionDeclaration(this: {
6
- readonly features: ReadonlySet<TsFeature>;
6
+ readonly configuration: TsGenerator.Configuration;
7
7
  readonly filterType: Code;
8
8
  readonly name: string;
9
9
  readonly reusables: Reusables;
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code } from "../ts-poet-wrapper.js";
3
3
  export function NamedObjectType_sparqlConstructQueryStringFunctionDeclaration() {
4
- if (!this.features.has("sparql")) {
4
+ if (!this.configuration.features.has("sparql")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  return Maybe.of(code `\
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code, joinCode } from "../ts-poet-wrapper.js";
3
3
  export function NamedObjectType_toJsonFunctionDeclaration() {
4
- if (!this.features.has("json")) {
4
+ if (!this.configuration.features.has("json")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  const jsonObjectMembers = [];
@@ -10,7 +10,7 @@ export function NamedObjectType_toJsonFunctionDeclaration() {
10
10
  }
11
11
  if (this.properties.length > 0) {
12
12
  jsonObjectMembers.push(...this.properties.flatMap((property) => property
13
- .toJsonObjectMemberExpression({
13
+ .toJsonInitializer({
14
14
  variables: {
15
15
  value: property.accessExpression({
16
16
  variables: { object: this.thisVariable },
@@ -2,7 +2,7 @@ import { rdf } from "@tpluscode/rdf-ns-builders";
2
2
  import { Maybe } from "purify-ts";
3
3
  import { code, joinCode } from "../ts-poet-wrapper.js";
4
4
  export function NamedObjectType_toRdfResourceFunctionDeclaration() {
5
- if (!this.features.has("rdf")) {
5
+ if (!this.configuration.features.has("rdf")) {
6
6
  return Maybe.empty();
7
7
  }
8
8
  const statements = this.parentObjectTypes.map((parentObjectType) => code `${parentObjectType.name}._toRdfResource({ ...parameters, ignoreRdfType: true });`);
@@ -1,27 +1,23 @@
1
- import { syntheticNamePrefix } from "../syntheticNamePrefix.js";
2
- import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
1
+ import { code, joinCode } from "../ts-poet-wrapper.js";
3
2
  export function NamedObjectType_toStringFunctionDeclarations() {
4
- const propertiesToStringRecordProperties = [];
3
+ let propertiesToStringInitializers = [];
5
4
  if (this.parentObjectTypes.length > 0) {
6
5
  for (const parentObjectType of this.parentObjectTypes) {
7
- propertiesToStringRecordProperties.push(code `...${parentObjectType.name}._propertiesToStrings(${this.thisVariable})`);
6
+ propertiesToStringInitializers.push(code `...${parentObjectType.name}._propertiesToStrings(${this.thisVariable})`);
8
7
  }
9
8
  }
10
- for (const property of this.properties) {
11
- property
12
- .toStringExpression({
13
- variables: {
14
- value: property.accessExpression({
15
- variables: { object: this.thisVariable },
16
- }),
17
- },
18
- })
19
- .ifJust((propertyToStringExpression) => {
20
- propertiesToStringRecordProperties.push(code `${literalOf(property.name)}: ${propertyToStringExpression}`);
21
- });
22
- }
23
- const propertiesToStringsReturnExpression = code `${this.reusables.snippets.compactRecord}({${joinCode(propertiesToStringRecordProperties, { on: "," })}})`;
9
+ propertiesToStringInitializers = propertiesToStringInitializers.concat(this.properties.flatMap((property) => property
10
+ .toStringInitializer({
11
+ variables: {
12
+ value: property.accessExpression({
13
+ variables: { object: this.thisVariable },
14
+ }),
15
+ },
16
+ })
17
+ .toList()));
18
+ const propertiesToStringsReturnExpression = code `${this.reusables.snippets.compactRecord}({${joinCode(propertiesToStringInitializers, { on: "," })}})`;
24
19
  const toStringReturnExpression = (propertiesToStrings) => code `\`${this.name}(\${JSON.stringify(${propertiesToStrings})})\``;
20
+ const syntheticNamePrefix = this.configuration.syntheticNamePrefix;
25
21
  return [
26
22
  // Use overloads to allow the function to be attached to an instance or used freestanding
27
23
  code `\
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code } from "../ts-poet-wrapper.js";
3
3
  export function NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration() {
4
- if (!this.features.has("sparql")) {
4
+ if (!this.configuration.features.has("sparql")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  return Maybe.of(code `\
@@ -1,7 +1,7 @@
1
1
  import { Maybe } from "purify-ts";
2
2
  import { code } from "../ts-poet-wrapper.js";
3
3
  export function NamedObjectType_valueSparqlWherePatternsFunctionDeclaration() {
4
- if (!this.features.has("sparql")) {
4
+ if (!this.configuration.features.has("sparql")) {
5
5
  return Maybe.empty();
6
6
  }
7
7
  return Maybe.of(code `\
@@ -21,7 +21,7 @@ export declare class ShaclProperty<TypeT extends Type> extends AbstractProperty<
21
21
  path: PropertyPath;
22
22
  recursive: boolean;
23
23
  } & ConstructorParameters<typeof AbstractProperty<TypeT>>[0]);
24
- get constructorParametersSignature(): Maybe<Code>;
24
+ get constructorParameter(): Maybe<Code>;
25
25
  get declaration(): Code;
26
26
  get filterProperty(): Maybe<{
27
27
  name: string;
@@ -35,16 +35,16 @@ export declare class ShaclProperty<TypeT extends Type> extends AbstractProperty<
35
35
  kind: Code;
36
36
  type: Code;
37
37
  };
38
- constructorStatements({ variables, }: Parameters<AbstractProperty<TypeT>["constructorStatements"]>[0]): readonly Code[];
39
- fromJsonExpression({ variables, }: Parameters<AbstractProperty<TypeT>["fromJsonExpression"]>[0]): Maybe<Code>;
40
- fromRdfResourceValuesExpression({ variables, }: Parameters<AbstractProperty<TypeT>["fromRdfResourceValuesExpression"]>[0]): Maybe<Code>;
41
- hashStatements(parameters: Parameters<AbstractProperty<TypeT>["hashStatements"]>[0]): readonly Code[];
38
+ constructorInitializer({ variables, }: Parameters<AbstractProperty<TypeT>["constructorInitializer"]>[0]): Maybe<Code>;
39
+ fromJsonInitializer({ variables, }: Parameters<AbstractProperty<TypeT>["fromJsonInitializer"]>[0]): Maybe<Code>;
40
+ fromRdfResourceValuesInitializer({ variables, }: Parameters<AbstractProperty<TypeT>["fromRdfResourceValuesInitializer"]>[0]): Maybe<Code>;
41
+ hashStatements({ variables, }: 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
- toJsonObjectMemberExpression(parameters: Parameters<AbstractProperty<TypeT>["toJsonObjectMemberExpression"]>[0]): Maybe<Code>;
45
+ toJsonInitializer(parameters: Parameters<AbstractProperty<TypeT>["toJsonInitializer"]>[0]): Maybe<Code>;
46
46
  toRdfRdfResourceValuesStatements({ variables, }: Parameters<AbstractProperty<TypeT>["toRdfRdfResourceValuesStatements"]>[0]): readonly Code[];
47
- toStringExpression(parameters: Parameters<AbstractProperty<TypeT>["toStringExpression"]>[0]): Maybe<Code>;
47
+ toStringInitializer(parameters: Parameters<AbstractProperty<TypeT>["toStringInitializer"]>[0]): Maybe<Code>;
48
48
  private propertyPathToCode;
49
49
  }
50
50
  //# sourceMappingURL=ShaclProperty.d.ts.map
@@ -6,7 +6,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { Maybe } from "purify-ts";
8
8
  import { Memoize } from "typescript-memoize";
9
- import { codeEquals } from "../codeEquals.js";
10
9
  import { code, joinCode, literalOf } from "../ts-poet-wrapper.js";
11
10
  import { tsComment } from "../tsComment.js";
12
11
  import { AbstractProperty } from "./AbstractProperty.js";
@@ -29,15 +28,15 @@ export class ShaclProperty extends AbstractProperty {
29
28
  this.path = path;
30
29
  this.recursive = recursive;
31
30
  }
32
- get constructorParametersSignature() {
31
+ get constructorParameter() {
33
32
  let hasQuestionToken = false;
34
33
  const typeNames = [];
35
- for (const conversion of this.type.conversions) {
36
- if (conversion.sourceTypeof === "undefined") {
34
+ for (const type of this.type.conversionFunction.sourceTypes) {
35
+ if (type.typeof === "undefined") {
37
36
  hasQuestionToken = true;
38
37
  }
39
- else if (!typeNames.some((typeName) => codeEquals(typeName, conversion.sourceTypeName))) {
40
- typeNames.push(code `${conversion.sourceTypeName}`);
38
+ else {
39
+ typeNames.push(code `${type.name}`);
41
40
  }
42
41
  }
43
42
  return Maybe.of(code `readonly ${this.name}${hasQuestionToken ? "?" : ""}: ${joinCode(typeNames, { on: "|" })};`);
@@ -99,7 +98,7 @@ export class ShaclProperty extends AbstractProperty {
99
98
  ...super.schemaObject,
100
99
  // comment: this.comment.map(JSON.stringify).extract(),
101
100
  // description: this.description.map(JSON.stringify).extract(),
102
- path: this.namedObjectType.features.has("rdf")
101
+ path: this.configuration.features.has("rdf")
103
102
  ? this.propertyPathToCode(this.path)
104
103
  : undefined,
105
104
  // label: this.label.map(JSON.stringify).extract(),
@@ -111,28 +110,19 @@ export class ShaclProperty extends AbstractProperty {
111
110
  // : undefined,
112
111
  };
113
112
  }
114
- constructorStatements({ variables, }) {
115
- const typeConversions = this.type.conversions;
116
- if (typeConversions.length === 1) {
117
- return [code `const ${this.name} = ${variables.parameter};`];
118
- }
119
- const statements = [code `let ${this.name}: ${this.type.name};`];
120
- statements.push(joinCode(typeConversions
121
- .map((conversion) => code `if (${conversion.sourceTypeCheckExpression(variables.parameter)}) { ${this.name} = ${conversion.conversionExpression(variables.parameter)}; }`)
122
- // We shouldn't need this else, since the parameter now has the never type, but have to add it to appease the TypeScript compiler
123
- .concat(code `{ ${this.name} = (${variables.parameter}) satisfies never; }`), { on: " else " }));
124
- return statements;
125
- }
126
- fromJsonExpression({ variables, }) {
127
- return Maybe.of(this.type.fromJsonExpression({
113
+ constructorInitializer({ variables, }) {
114
+ return Maybe.of(code `${this.name}: ${this.type.conversionFunction.code}(schema.properties.${this.name}.type(), ${variables.parameters}.${this.name})`);
115
+ }
116
+ fromJsonInitializer({ variables, }) {
117
+ return Maybe.of(code `${this.name}: ${this.type.fromJsonExpression({
128
118
  variables: { value: code `${variables.jsonObject}["${this.name}"]` },
129
- }));
119
+ })}`);
130
120
  }
131
- fromRdfResourceValuesExpression({ variables, }) {
121
+ fromRdfResourceValuesInitializer({ variables, }) {
132
122
  // Assume the property has the correct range and ignore the object's RDF type.
133
123
  // This also accommodates the case where the object of a property is a dangling identifier that's not the
134
124
  // subject of any statements.
135
- return Maybe.of(code `${this.reusables.snippets.shaclPropertyFromRdf}(${{
125
+ return Maybe.of(code `${this.name}: ${this.reusables.snippets.shaclPropertyFromRdf}(${{
136
126
  graph: variables.graph,
137
127
  resource: variables.resource,
138
128
  propertySchema: code `schema.properties.${this.name}`,
@@ -146,8 +136,10 @@ export class ShaclProperty extends AbstractProperty {
146
136
  })})`,
147
137
  }})`);
148
138
  }
149
- hashStatements(parameters) {
150
- return this.type.hashStatements(parameters);
139
+ hashStatements({ variables, }) {
140
+ return [
141
+ code `${this.type.hashFunction}(${variables.hasher}, ${variables.value});`,
142
+ ];
151
143
  }
152
144
  jsonUiSchemaElement({ variables, }) {
153
145
  const scope = code `\`\${${variables.scopePrefix}}/properties/${this.name}\``;
@@ -184,7 +176,7 @@ export class ShaclProperty extends AbstractProperty {
184
176
  }})`,
185
177
  });
186
178
  }
187
- toJsonObjectMemberExpression(parameters) {
179
+ toJsonInitializer(parameters) {
188
180
  return Maybe.of(code `${this.name}: ${this.type.toJsonExpression(parameters)}`);
189
181
  }
190
182
  toRdfRdfResourceValuesStatements({ variables, }) {
@@ -206,11 +198,11 @@ export class ShaclProperty extends AbstractProperty {
206
198
  })}, ${variables.graph});`,
207
199
  ];
208
200
  }
209
- toStringExpression(parameters) {
201
+ toStringInitializer(parameters) {
210
202
  if (!this.display) {
211
203
  return Maybe.empty();
212
204
  }
213
- return Maybe.of(this.type.toStringExpression(parameters));
205
+ return Maybe.of(code `${literalOf(this.name)}: ${this.type.toStringExpression(parameters)}`);
214
206
  }
215
207
  propertyPathToCode(propertyPath) {
216
208
  switch (propertyPath.termType) {
@@ -229,7 +221,7 @@ export class ShaclProperty extends AbstractProperty {
229
221
  }
230
222
  __decorate([
231
223
  Memoize()
232
- ], ShaclProperty.prototype, "constructorParametersSignature", null);
224
+ ], ShaclProperty.prototype, "constructorParameter", null);
233
225
  __decorate([
234
226
  Memoize()
235
227
  ], ShaclProperty.prototype, "declaration", null);
@@ -1,7 +1,7 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
- export const snippets_DefaultValueSchema = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}DefaultValueSchema`, code `\
3
- interface ${syntheticNamePrefix}DefaultValueSchema<ItemSchemaT> {
4
- readonly defaultValue: ${imports.Literal} | ${imports.NamedNode};
2
+ export const snippets_DefaultValueSchema = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}DefaultValueSchema`, code `\
3
+ interface ${syntheticNamePrefix}DefaultValueSchema<DefaultValueT, ItemSchemaT> {
4
+ readonly defaultValue: DefaultValueT;
5
5
  readonly item: () => ItemSchemaT;
6
6
  readonly kind: "DefaultValue";
7
7
  }`);
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_HashFunction: SnippetFactory;
3
+ //# sourceMappingURL=snippets_HashFunction.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_HashFunction = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}HashFunction`, code `\
3
+ export type ${syntheticNamePrefix}HashFunction<HasherT extends ${snippets.Hasher}, ValueT> = (hasher: HasherT, value: ValueT) => HasherT;`);
4
+ //# sourceMappingURL=snippets_HashFunction.js.map
@@ -1,32 +1,42 @@
1
- import { code, conditionalOutput } from "../ts-poet-wrapper.js";
1
+ import { code, conditionalOutput, joinCode, } from "../ts-poet-wrapper.js";
2
2
  /**
3
3
  * Adapter between generated code and the rdfjs-resource PropertyPath.
4
4
  */
5
- export const snippets_PropertyPath = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}PropertyPath`, code `\
5
+ export const snippets_PropertyPath = ({ configuration, imports, snippets, syntheticNamePrefix, }) => {
6
+ const companionDeclarations = [];
7
+ if (configuration.features.has("equals")) {
8
+ companionDeclarations.push(code `\
9
+ export function equals(left: ${syntheticNamePrefix}PropertyPath, right: ${syntheticNamePrefix}PropertyPath): ${snippets.EqualsResult} {
10
+ return ${snippets.EqualsResult}.fromBooleanEqualsResult(left, right, ${imports.RdfxResourcePropertyPath}.equals(left, right));
11
+ }`);
12
+ }
13
+ companionDeclarations.push(code `export type Filter = object`, code `\
14
+ export function filter(_filter: Filter, _value: ${syntheticNamePrefix}PropertyPath): boolean {
15
+ return true;
16
+ }`);
17
+ if (configuration.features.has("rdf")) {
18
+ companionDeclarations.push(code `\
19
+ export const fromRdfResource: ${snippets.FromRdfResourceFunction}<${syntheticNamePrefix}PropertyPath> = ${imports.RdfxResourcePropertyPath}.fromResource;`, code `\
20
+ export const fromRdfResourceValues: ${snippets.FromRdfResourceValuesFunction}<${syntheticNamePrefix}PropertyPath> = (values, options) =>
21
+ values.chain((values) =>
22
+ values.chainMap((value) =>
23
+ value
24
+ .toResource()
25
+ .chain((resource) => fromRdfResource(resource, options)),
26
+ ),
27
+ );`);
28
+ }
29
+ companionDeclarations.push(code `export const schema: Readonly<object> = {}`);
30
+ if (configuration.features.has("rdf")) {
31
+ companionDeclarations.push(code `\
32
+ export const toRdfResource: ${snippets.ToRdfResourceFunction}<${syntheticNamePrefix}PropertyPath> = ${imports.RdfxResourcePropertyPath}.toResource;`);
33
+ }
34
+ companionDeclarations.push(code `export const ${syntheticNamePrefix}toString = ${imports.RdfxResourcePropertyPath}.toString;`);
35
+ return conditionalOutput(`${syntheticNamePrefix}PropertyPath`, code `\
6
36
  export type ${syntheticNamePrefix}PropertyPath = ${imports.RdfxResourcePropertyPath};
7
37
 
8
38
  export namespace ${syntheticNamePrefix}PropertyPath {
9
- export type Filter = object;
10
-
11
- export function filter(_filter: Filter, _value: ${syntheticNamePrefix}PropertyPath): boolean {
12
- return true;
13
- }
14
-
15
- export const fromRdfResource: ${snippets.FromRdfResourceFunction}<${syntheticNamePrefix}PropertyPath> = ${imports.RdfxResourcePropertyPath}.fromResource;
16
-
17
- export const fromRdfResourceValues: ${snippets.FromRdfResourceValuesFunction}<${syntheticNamePrefix}PropertyPath> = (values, options) =>
18
- values.chain((values) =>
19
- values.chainMap((value) =>
20
- value
21
- .toResource()
22
- .chain((resource) => fromRdfResource(resource, options)),
23
- ),
24
- );
25
-
26
- export const schema: Readonly<object> = {};
27
-
28
- export const toRdfResource: ${snippets.ToRdfResourceFunction}<${syntheticNamePrefix}PropertyPath> = ${imports.RdfxResourcePropertyPath}.toResource;
29
-
30
- export const ${syntheticNamePrefix}toString = ${imports.RdfxResourcePropertyPath}.toString;
39
+ ${joinCode(companionDeclarations, { on: "\n\n" })}
31
40
  }`);
41
+ };
32
42
  //# sourceMappingURL=snippets_PropertyPath.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToBigDecimal: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToBigDecimal.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToBigDecimal = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToBigDecimal`, code `\
3
+ function ${syntheticNamePrefix}convertToBigDecimal(_schema: ${snippets.NumericSchema}<${imports.BigDecimal}>, value: ${imports.BigDecimal}): ${imports.Either}<Error, ${imports.BigDecimal}> {
4
+ return ${imports.Either}.of(value);
5
+ }`);
6
+ //# sourceMappingURL=snippets_convertToBigDecimal.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToBlankNode: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToBlankNode.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToBlankNode = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToBlankNode`, code `\
3
+ function ${syntheticNamePrefix}convertToBlankNode(_schema: ${snippets.BlankNodeSchema}, value: ${imports.BlankNode} | undefined): ${imports.Either}<Error, ${imports.BlankNode}> {
4
+ switch (typeof value) {
5
+ case "object":
6
+ return ${imports.Either}.of(value);
7
+ case "undefined":
8
+ return ${imports.Either}.of(${imports.dataFactory}.blankNode());
9
+ }
10
+ }`);
11
+ //# sourceMappingURL=snippets_convertToBlankNode.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToBlankNodeIdentifierProperty: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToBlankNodeIdentifierProperty.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToBlankNodeIdentifierProperty = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToBlankNodeIdentifierProperty`, code `\
3
+ function ${syntheticNamePrefix}convertToBlankNodeIdentifierProperty(identifier: (() => ${imports.BlankNode}) | ${imports.BlankNode} | undefined): ${imports.Either}<Error, (() => ${imports.BlankNode})> {
4
+ switch (typeof identifier) {
5
+ case "function":
6
+ return ${imports.Either}.of(identifier);
7
+ case "object": {
8
+ const captureIdentifier = identifier;
9
+ return ${imports.Either}.of(() => captureIdentifier);
10
+ }
11
+ case "undefined": {
12
+ const captureIdentifier = ${imports.dataFactory}.blankNode();
13
+ return ${imports.Either}.of(() => captureIdentifier);
14
+ }
15
+ }
16
+ }`);
17
+ //# sourceMappingURL=snippets_convertToBlankNodeIdentifierProperty.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToBoolean: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToBoolean.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToBoolean = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToBoolean`, code `\
3
+ function ${syntheticNamePrefix}convertToBoolean<ValueT extends boolean>(_schema: ${snippets.BooleanSchema}, value: ValueT): ${imports.Either}<Error, ValueT> {
4
+ return ${imports.Either}.of(value);
5
+ }`);
6
+ //# sourceMappingURL=snippets_convertToBoolean.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToDate: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToDate.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToDate = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToDate`, code `\
3
+ function ${syntheticNamePrefix}convertToDate(_schema: ${snippets.DateSchema}, value: Date): ${imports.Either}<Error, Date> {
4
+ return ${imports.Either}.of(value);
5
+ }`);
6
+ //# sourceMappingURL=snippets_convertToDate.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToDateTime: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToDateTime.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToDateTime = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToDateTime`, code `\
3
+ function ${syntheticNamePrefix}convertToDateTime(_schema: ${snippets.DateSchema}, value: Date): ${imports.Either}<Error, Date> {
4
+ return ${imports.Either}.of(value);
5
+ }`);
6
+ //# sourceMappingURL=snippets_convertToDateTime.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToIdentifier: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToIdentifier.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToIdentifier = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToIdentifier`, code `\
3
+ function ${syntheticNamePrefix}convertToIdentifier(_schema: ${snippets.IdentifierSchema}, value: ${imports.BlankNode} | ${imports.NamedNode} | string | undefined): ${imports.Either}<Error, ${imports.BlankNode} | ${imports.NamedNode}> {
4
+ switch (typeof value) {
5
+ case "object":
6
+ return ${imports.Either}.of(value);
7
+ case "string":
8
+ return ${imports.Either}.of(${imports.dataFactory}.namedNode(value));
9
+ case "undefined":
10
+ return ${imports.Either}.of(${imports.dataFactory}.blankNode());
11
+ }
12
+ }`);
13
+ //# sourceMappingURL=snippets_convertToIdentifier.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToIdentifierProperty: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToIdentifierProperty.d.ts.map
@@ -0,0 +1,21 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToIdentifierProperty = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToIdentifierProperty`, code `\
3
+ function ${syntheticNamePrefix}convertToIdentifierProperty(identifier: (() => ${imports.BlankNode} | ${imports.NamedNode}) | ${imports.BlankNode} | ${imports.NamedNode} | string | undefined): ${imports.Either}<Error, (() => ${imports.BlankNode} | ${imports.NamedNode})> {
4
+ switch (typeof identifier) {
5
+ case "function":
6
+ return ${imports.Either}.of(identifier);
7
+ case "object": {
8
+ const captureIdentifier = identifier;
9
+ return ${imports.Either}.of(() => captureIdentifier);
10
+ }
11
+ case "string": {
12
+ const captureIdentifier = ${imports.dataFactory}.namedNode(identifier);
13
+ return ${imports.Either}.of(() => captureIdentifier);
14
+ }
15
+ case "undefined": {
16
+ const captureIdentifier = ${imports.dataFactory}.blankNode();
17
+ return ${imports.Either}.of(() => captureIdentifier);
18
+ }
19
+ }
20
+ }`);
21
+ //# sourceMappingURL=snippets_convertToIdentifierProperty.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToIri: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToIri.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToIri = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToIri`, code `\
3
+ function ${syntheticNamePrefix}convertToIri<IriT extends string = string>(_schema: ${snippets.IriSchema}, value: IriT | ${imports.NamedNode}<IriT>): ${imports.Either}<Error, ${imports.NamedNode}<IriT>> {
4
+ switch (typeof value) {
5
+ case "object":
6
+ return ${imports.Either}.of(value);
7
+ case "string":
8
+ return ${imports.Either}.of(${imports.dataFactory}.namedNode<IriT>(value));
9
+ }
10
+ }`);
11
+ //# sourceMappingURL=snippets_convertToIri.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToIriIdentifierProperty: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToIriIdentifierProperty.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToIriIdentifierProperty = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToIriIdentifierProperty`, code `\
3
+ function ${syntheticNamePrefix}convertToIriIdentifierProperty<IriT extends string = string>(identifier: (() => ${imports.NamedNode}<IriT>) | ${imports.NamedNode}<IriT> | IriT): ${imports.Either}<Error, (() => ${imports.NamedNode}<IriT>)> {
4
+ switch (typeof identifier) {
5
+ case "function":
6
+ return ${imports.Either}.of(identifier);
7
+ case "object": {
8
+ const captureIdentifier = identifier;
9
+ return ${imports.Either}.of(() => captureIdentifier);
10
+ }
11
+ case "string": {
12
+ const captureIdentifier = ${imports.dataFactory}.namedNode<IriT>(identifier);
13
+ return ${imports.Either}.of(() => captureIdentifier);
14
+ }
15
+ }
16
+ }`);
17
+ //# sourceMappingURL=snippets_convertToIriIdentifierProperty.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToLazyObject: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToLazyObject.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_convertToLazyObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToLazyObject`, code `\
3
+ function ${syntheticNamePrefix}convertToLazyObject<ObjectIdentifierT extends ${imports.BlankNode} | ${imports.NamedNode}, PartialObjectT extends { ${syntheticNamePrefix}identifier: () => ObjectIdentifierT }, ResolvedObjectT extends { ${syntheticNamePrefix}identifier: () => ObjectIdentifierT }>(resolvedToPartial: (resolved: ResolvedObjectT) => PartialObjectT) {
4
+ return (_schema: unknown, value: ${snippets.LazyObject}<ObjectIdentifierT, PartialObjectT, ResolvedObjectT> | ResolvedObjectT): ${imports.Either}<Error, ${snippets.LazyObject}<ObjectIdentifierT, PartialObjectT, ResolvedObjectT>> => {
5
+ if (value instanceof ${snippets.LazyObject}) {
6
+ return ${imports.Either}.of(value);
7
+ }
8
+
9
+ return ${imports.Either}.of(new ${snippets.LazyObject}({
10
+ partial: resolvedToPartial(value),
11
+ resolver: async () => ${imports.Right}(value)
12
+ }));
13
+ };
14
+ }`);
15
+ //# sourceMappingURL=snippets_convertToLazyObject.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToLazyObjectOption: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToLazyObjectOption.d.ts.map