@shaclmate/compiler 4.0.97 → 4.0.98

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 (92) hide show
  1. package/dist/generators/ts/AbstractLazyType.js +4 -4
  2. package/dist/generators/ts/AbstractStructuredType.js +2 -2
  3. package/dist/generators/ts/Imports.d.ts +1 -0
  4. package/dist/generators/ts/Imports.js +1 -0
  5. package/dist/generators/ts/IriType.js +13 -3
  6. package/dist/generators/ts/Snippets.d.ts +7 -6
  7. package/dist/generators/ts/Snippets.js +41 -34
  8. package/dist/generators/ts/_ObjectIntersectionType/ObjectIntersectionType_fromJsonObjectFunction.js +1 -1
  9. package/dist/generators/ts/_ObjectType/ObjectType_IdentifierProperty.js +1 -1
  10. package/dist/generators/ts/_ObjectType/ObjectType_fromJsonObjectFunction.js +7 -2
  11. package/dist/generators/ts/_ObjectType/ObjectType_toJsonObjectFunction.js +1 -1
  12. package/dist/generators/ts/_snippets/snippets_FromJsonFunction.d.ts +3 -0
  13. package/dist/generators/ts/_snippets/snippets_FromJsonFunction.js +28 -0
  14. package/dist/generators/ts/_snippets/snippets_ToJsonFunction.d.ts +3 -0
  15. package/dist/generators/ts/_snippets/snippets_ToJsonFunction.js +3 -0
  16. package/dist/generators/ts/_snippets/snippets_arrayFromJsonArray.js +1 -1
  17. package/dist/generators/ts/_snippets/snippets_arrayToJsonArray.js +1 -1
  18. package/dist/generators/ts/_snippets/snippets_bigDecimalFromJsonObject.js +1 -1
  19. package/dist/generators/ts/_snippets/snippets_bigDecimalFromJsonString.js +1 -1
  20. package/dist/generators/ts/_snippets/snippets_bigDecimalToJsonObject.js +1 -1
  21. package/dist/generators/ts/_snippets/snippets_bigDecimalToJsonString.js +1 -1
  22. package/dist/generators/ts/_snippets/snippets_bigIntFromJsonObject.js +1 -1
  23. package/dist/generators/ts/_snippets/snippets_bigIntFromJsonString.js +1 -1
  24. package/dist/generators/ts/_snippets/snippets_bigIntToJsonObject.js +1 -1
  25. package/dist/generators/ts/_snippets/snippets_bigIntToJsonString.js +1 -1
  26. package/dist/generators/ts/_snippets/snippets_blankNodeFromJsonObject.js +1 -1
  27. package/dist/generators/ts/_snippets/snippets_blankNodeFromJsonString.js +1 -1
  28. package/dist/generators/ts/_snippets/snippets_blankNodeToJsonObject.js +1 -1
  29. package/dist/generators/ts/_snippets/snippets_blankNodeToJsonString.js +1 -1
  30. package/dist/generators/ts/_snippets/snippets_booleanFromJsonBoolean.js +1 -1
  31. package/dist/generators/ts/_snippets/snippets_booleanFromJsonObject.js +1 -1
  32. package/dist/generators/ts/_snippets/snippets_convertToIdentifier.js +1 -1
  33. package/dist/generators/ts/_snippets/snippets_convertToIdentifierProperty.js +2 -4
  34. package/dist/generators/ts/_snippets/snippets_convertToIri.js +1 -1
  35. package/dist/generators/ts/_snippets/snippets_convertToIriIdentifierProperty.js +1 -2
  36. package/dist/generators/ts/_snippets/snippets_convertToIriLiteral.d.ts +3 -0
  37. package/dist/generators/ts/_snippets/snippets_convertToIriLiteral.js +11 -0
  38. package/dist/generators/ts/_snippets/snippets_convertToIriLiteralIdentifierProperty.d.ts +3 -0
  39. package/dist/generators/ts/_snippets/snippets_convertToIriLiteralIdentifierProperty.js +17 -0
  40. package/dist/generators/ts/_snippets/snippets_dateFromJsonObject.js +1 -1
  41. package/dist/generators/ts/_snippets/snippets_dateFromJsonString.js +1 -1
  42. package/dist/generators/ts/_snippets/snippets_dateTimeFromJsonObject.js +1 -1
  43. package/dist/generators/ts/_snippets/snippets_dateTimeToJsonString.js +1 -1
  44. package/dist/generators/ts/_snippets/snippets_dateToJsonObject.js +1 -1
  45. package/dist/generators/ts/_snippets/snippets_dateToJsonString.js +1 -1
  46. package/dist/generators/ts/_snippets/snippets_defaultValueFromJsonObject.js +1 -1
  47. package/dist/generators/ts/_snippets/snippets_defaultValueFromJsonValue.js +1 -1
  48. package/dist/generators/ts/_snippets/snippets_floatFromJsonNumber.js +1 -1
  49. package/dist/generators/ts/_snippets/snippets_floatFromJsonObject.js +1 -1
  50. package/dist/generators/ts/_snippets/snippets_identifierFromJsonObject.js +1 -1
  51. package/dist/generators/ts/_snippets/snippets_identifierFromJsonString.js +1 -1
  52. package/dist/generators/ts/_snippets/snippets_identifierToJsonObject.js +1 -1
  53. package/dist/generators/ts/_snippets/snippets_identifierToJsonString.js +1 -1
  54. package/dist/generators/ts/_snippets/snippets_intFromJsonNumber.js +1 -1
  55. package/dist/generators/ts/_snippets/snippets_intFromJsonObject.js +1 -1
  56. package/dist/generators/ts/_snippets/snippets_iriFromJsonObject.js +1 -1
  57. package/dist/generators/ts/_snippets/snippets_iriFromJsonString.js +2 -2
  58. package/dist/generators/ts/_snippets/snippets_iriFromString.d.ts +3 -0
  59. package/dist/generators/ts/_snippets/snippets_iriFromString.js +76 -0
  60. package/dist/generators/ts/_snippets/snippets_iriLiteralFromJsonObject.d.ts +3 -0
  61. package/dist/generators/ts/_snippets/snippets_iriLiteralFromJsonObject.js +6 -0
  62. package/dist/generators/ts/_snippets/snippets_iriLiteralFromJsonString.d.ts +3 -0
  63. package/dist/generators/ts/_snippets/snippets_iriLiteralFromJsonString.js +6 -0
  64. package/dist/generators/ts/_snippets/snippets_langStringFromJsonObject.js +1 -1
  65. package/dist/generators/ts/_snippets/snippets_langStringToJsonObject.js +1 -1
  66. package/dist/generators/ts/_snippets/snippets_listFromJsonObject.js +1 -1
  67. package/dist/generators/ts/_snippets/snippets_listToJsonObject.js +1 -1
  68. package/dist/generators/ts/_snippets/snippets_literalFromJsonObject.js +1 -1
  69. package/dist/generators/ts/_snippets/snippets_literalToJsonObject.js +1 -1
  70. package/dist/generators/ts/_snippets/snippets_maybeFromJsonObject.js +1 -1
  71. package/dist/generators/ts/_snippets/snippets_maybeFromJsonValue.js +1 -1
  72. package/dist/generators/ts/_snippets/snippets_maybeToJsonObject.js +1 -1
  73. package/dist/generators/ts/_snippets/snippets_maybeToJsonValue.js +1 -1
  74. package/dist/generators/ts/_snippets/snippets_primitiveToJsonObject.js +1 -1
  75. package/dist/generators/ts/_snippets/snippets_stringFromJsonObject.js +1 -1
  76. package/dist/generators/ts/_snippets/snippets_stringFromJsonString.js +1 -1
  77. package/dist/generators/ts/_snippets/snippets_termFromJsonObject.js +1 -1
  78. package/dist/generators/ts/_snippets/snippets_termToJsonObject.js +1 -1
  79. package/dist/generators/ts/_snippets/snippets_typedLiteralToJsonObject.js +1 -1
  80. package/package.json +16 -14
  81. package/dist/generators/ts/_snippets/snippets_FromJsonObjectFunction.d.ts +0 -3
  82. package/dist/generators/ts/_snippets/snippets_FromJsonObjectFunction.js +0 -21
  83. package/dist/generators/ts/_snippets/snippets_FromJsonValueFunction.d.ts +0 -3
  84. package/dist/generators/ts/_snippets/snippets_FromJsonValueFunction.js +0 -21
  85. package/dist/generators/ts/_snippets/snippets_ToJsonObjectFunction.d.ts +0 -3
  86. package/dist/generators/ts/_snippets/snippets_ToJsonObjectFunction.js +0 -3
  87. package/dist/generators/ts/_snippets/snippets_ToJsonValueFunction.d.ts +0 -3
  88. package/dist/generators/ts/_snippets/snippets_ToJsonValueFunction.js +0 -3
  89. package/dist/generators/ts/_snippets/snippets_convertToInIri.d.ts +0 -3
  90. package/dist/generators/ts/_snippets/snippets_convertToInIri.js +0 -11
  91. package/dist/generators/ts/_snippets/snippets_convertToInIriIdentifierProperty.d.ts +0 -3
  92. package/dist/generators/ts/_snippets/snippets_convertToInIriIdentifierProperty.js +0 -17
@@ -37,13 +37,13 @@ export class AbstractLazyType extends AbstractType {
37
37
  get fromJsonObjectFunction() {
38
38
  return new InlineCallable(code `(jsonObject, fromJsonObjectOptions) => ${this.partialType.fromJsonObjectFunction.annotatedUsage}(jsonObject, { ...fromJsonObjectOptions, schema: fromJsonObjectOptions.schema.partialType })
39
39
  .map(${this.runtimeClass.partialPropertyName} => new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}, resolver: ${this.resolverFunctionExpression({ variables: { factoryFunctionOptions: code `fromJsonObjectOptions` } })} }))`, {
40
- type: code `${this.reusables.snippets.FromJsonObjectFunction}<${this.jsonObjectType.expression}, ${this.expression}, ${this.schema}>`,
40
+ type: code `${this.reusables.snippets.FromJsonFunction}<${this.jsonObjectType.expression}, ${this.expression}, ${this.schema}>`,
41
41
  });
42
42
  }
43
43
  get fromJsonValueFunction() {
44
44
  return new InlineCallable(code `(jsonValue, fromJsonValueOptions) => ${this.partialType.fromJsonValueFunction.annotatedUsage}(jsonValue, { ...fromJsonValueOptions, schema: fromJsonValueOptions.schema.partialType })
45
45
  .map(${this.runtimeClass.partialPropertyName} => new ${this.runtimeClass.name}({ ${this.runtimeClass.partialPropertyName}, resolver: ${this.resolverFunctionExpression({ variables: { factoryFunctionOptions: code `fromJsonValueOptions` } })} }))`, {
46
- type: code `${this.reusables.snippets.FromJsonValueFunction}<${this.jsonValueType.expression}, ${this.expression}, ${this.schema}>`,
46
+ type: code `${this.reusables.snippets.FromJsonFunction}<${this.jsonValueType.expression}, ${this.expression}, ${this.schema}>`,
47
47
  });
48
48
  }
49
49
  get fromRdfResourceValuesFunction() {
@@ -92,12 +92,12 @@ export class AbstractLazyType extends AbstractType {
92
92
  }
93
93
  get toJsonObjectFunction() {
94
94
  return new InlineCallable(code `(value) => ${this.partialType.toJsonObjectFunction.unannotatedUsage}(value.${this.runtimeClass.partialPropertyName})`, {
95
- type: code `${this.reusables.snippets.ToJsonObjectFunction}<${this.expression}, ${this.jsonValueType.expression}>`,
95
+ type: code `${this.reusables.snippets.ToJsonFunction}<${this.expression}, ${this.jsonValueType.expression}>`,
96
96
  });
97
97
  }
98
98
  get toJsonValueFunction() {
99
99
  return new InlineCallable(code `(value) => ${this.partialType.toJsonValueFunction.unannotatedUsage}(value.${this.runtimeClass.partialPropertyName})`, {
100
- type: code `${this.reusables.snippets.ToJsonValueFunction}<${this.expression}, ${this.jsonValueType.expression}>`,
100
+ type: code `${this.reusables.snippets.ToJsonFunction}<${this.expression}, ${this.jsonValueType.expression}>`,
101
101
  });
102
102
  }
103
103
  get toRdfResourceValueTypes() {
@@ -151,7 +151,7 @@ export class AbstractStructuredType extends AbstractType {
151
151
  return code `${this.reusables.snippets.FilterFunction}<${this.filterType}, ${this.expression}>`;
152
152
  }
153
153
  fromJsonObjectFunctionType() {
154
- return code `${this.reusables.snippets.FromJsonObjectFunction}<${this.jsonObjectType.expression}, ${this.expression}, undefined>`;
154
+ return code `${this.reusables.snippets.FromJsonFunction}<${this.jsonObjectType.expression}, ${this.expression}, undefined>`;
155
155
  }
156
156
  fromRdfResourceValuesFunctionType() {
157
157
  return code `${this.reusables.snippets.FromRdfResourceValuesFunction}<${this.expression}, ${this.schemaType}>`;
@@ -210,7 +210,7 @@ export class AbstractStructuredType extends AbstractType {
210
210
  return staticModuleDeclarations;
211
211
  }
212
212
  toJsonObjectFunctionType() {
213
- return code `${this.reusables.snippets.ToJsonObjectFunction}<${this.expression}, ${this.jsonObjectType.expression}>`;
213
+ return code `${this.reusables.snippets.ToJsonFunction}<${this.expression}, ${this.jsonObjectType.expression}>`;
214
214
  }
215
215
  toLoggableFunctionType() {
216
216
  return code `${this.reusables.snippets.ToLoggableFunction}<${this.expression}>`;
@@ -36,6 +36,7 @@ export declare class Imports {
36
36
  readonly NTriplesTerm: import("ts-poet/build/Import.js").Import;
37
37
  readonly Quad: import("ts-poet/build/Import.js").Import;
38
38
  readonly Quad_Graph: import("ts-poet/build/Import.js").Import;
39
+ readonly PrefixMap: import("ts-poet/build/Import.js").Import;
39
40
  readonly RdfxResourcePropertyPath: import("ts-poet/build/Import.js").Import;
40
41
  readonly Resource: import("ts-poet/build/Import.js").Import;
41
42
  readonly ResourceSet: import("ts-poet/build/Import.js").Import;
@@ -37,6 +37,7 @@ export class Imports {
37
37
  NTriplesTerm = imp("NTriplesTerm@@rdfx/string");
38
38
  Quad = imp("t:Quad@@rdfjs/types");
39
39
  Quad_Graph = imp("t:Quad_Graph@@rdfjs/types");
40
+ PrefixMap = imp("t:PrefixMap@@rdfx/collection");
40
41
  RdfxResourcePropertyPath = imp("PropertyPath:RdfxResourcePropertyPath@@rdfx/resource");
41
42
  Resource = imp("Resource@@rdfx/resource");
42
43
  ResourceSet = imp("ResourceSet@@rdfx/resource");
@@ -19,10 +19,20 @@ export class IriType extends AbstractIdentifierType {
19
19
  schemaType = code `${this.reusables.snippets.IriSchema}<${this.valueTypeExpression}>`;
20
20
  valueSparqlWherePatternsFunction = new ReferenceCallable(this.reusables.snippets.iriSparqlWherePatterns);
21
21
  get fromJsonValueFunction() {
22
- return new ReferenceCallable(code `${this.reusables.snippets.iriFromJsonString}<${this.valueTypeExpression}>`);
22
+ if (this.in_.length > 0) {
23
+ return new ReferenceCallable(code `${this.reusables.snippets.iriLiteralFromJsonString}<${this.valueTypeExpression}>`);
24
+ }
25
+ else {
26
+ return new ReferenceCallable(this.reusables.snippets.iriFromJsonString);
27
+ }
23
28
  }
24
29
  get fromJsonObjectFunction() {
25
- return new ReferenceCallable(code `${this.reusables.snippets.iriFromJsonObject}<${this.valueTypeExpression}>`);
30
+ if (this.in_.length > 0) {
31
+ return new ReferenceCallable(code `${this.reusables.snippets.iriLiteralFromJsonObject}<${this.valueTypeExpression}>`);
32
+ }
33
+ else {
34
+ return new ReferenceCallable(this.reusables.snippets.iriFromJsonObject);
35
+ }
26
36
  }
27
37
  get toJsonValueFunction() {
28
38
  return new ReferenceCallable(code `${this.reusables.snippets.iriToJsonString}<${this.valueTypeExpression}>`);
@@ -53,7 +63,7 @@ export class IriType extends AbstractIdentifierType {
53
63
  invariant(this.jsTypes.length === 1);
54
64
  return Maybe.of({
55
65
  code: this.in_.length > 0
56
- ? code `${this.reusables.snippets.convertToInIri}<${this.valueTypeExpression}>`
66
+ ? code `${this.reusables.snippets.convertToIriLiteral}<${this.valueTypeExpression}>`
57
67
  : code `${this.reusables.snippets.convertToIri}`,
58
68
  sourceTypes: [
59
69
  {
@@ -30,8 +30,7 @@ export declare class Snippets {
30
30
  get FilterFunction(): Snippet;
31
31
  get FocusSparqlConstructTriplesFunction(): Snippet;
32
32
  get FocusSparqlWherePatternsFunction(): Snippet;
33
- get FromJsonObjectFunction(): Snippet;
34
- get FromJsonValueFunction(): Snippet;
33
+ get FromJsonFunction(): Snippet;
35
34
  get FromRdfResourceFunction(): Snippet;
36
35
  get FromRdfResourceValuesFunction(): Snippet;
37
36
  get HashFunction(): Snippet;
@@ -70,8 +69,7 @@ export declare class Snippets {
70
69
  get TermFilter(): Snippet;
71
70
  get TermJsonObject(): Snippet;
72
71
  get TermSchema(): Snippet;
73
- get ToJsonObjectFunction(): Snippet;
74
- get ToJsonValueFunction(): Snippet;
72
+ get ToJsonFunction(): Snippet;
75
73
  get ToLoggableFunction(): Snippet;
76
74
  get ToRdfResourceFunction(): Snippet;
77
75
  get ToRdfResourceValuesFunction(): Snippet;
@@ -120,10 +118,10 @@ export declare class Snippets {
120
118
  get convertToBlankNodeIdentifierProperty(): Snippet;
121
119
  get convertToIdentifier(): Snippet;
122
120
  get convertToIdentifierProperty(): Snippet;
123
- get convertToInIri(): Snippet;
124
- get convertToInIriIdentifierProperty(): Snippet;
125
121
  get convertToIri(): Snippet;
126
122
  get convertToIriIdentifierProperty(): Snippet;
123
+ get convertToIriLiteral(): Snippet;
124
+ get convertToIriLiteralIdentifierProperty(): Snippet;
127
125
  get convertToLangString(): Snippet;
128
126
  get convertToLazy(): Snippet;
129
127
  get convertToLazyOption(): Snippet;
@@ -191,6 +189,9 @@ export declare class Snippets {
191
189
  get iriFromJsonObject(): Snippet;
192
190
  get iriFromJsonString(): Snippet;
193
191
  get iriFromRdfResourceValues(): Snippet;
192
+ get iriFromString(): Snippet;
193
+ get iriLiteralFromJsonObject(): Snippet;
194
+ get iriLiteralFromJsonString(): Snippet;
194
195
  get iriSparqlWherePatterns(): Snippet;
195
196
  get iriToJsonObject(): Snippet;
196
197
  get iriToJsonString(): Snippet;
@@ -24,8 +24,7 @@ import { snippets_EqualsResult } from "./_snippets/snippets_EqualsResult.js";
24
24
  import { snippets_FilterFunction } from "./_snippets/snippets_FilterFunction.js";
25
25
  import { snippets_FocusSparqlConstructTriplesFunction } from "./_snippets/snippets_FocusSparqlConstructTriplesFunction.js";
26
26
  import { snippets_FocusSparqlWherePatternsFunction } from "./_snippets/snippets_FocusSparqlWherePatternsFunction.js";
27
- import { snippets_FromJsonObjectFunction } from "./_snippets/snippets_FromJsonObjectFunction.js";
28
- import { snippets_FromJsonValueFunction } from "./_snippets/snippets_FromJsonValueFunction.js";
27
+ import { snippets_FromJsonFunction } from "./_snippets/snippets_FromJsonFunction.js";
29
28
  import { snippets_FromRdfResourceFunction } from "./_snippets/snippets_FromRdfResourceFunction.js";
30
29
  import { snippets_FromRdfResourceValuesFunction } from "./_snippets/snippets_FromRdfResourceValuesFunction.js";
31
30
  import { snippets_HashFunction } from "./_snippets/snippets_HashFunction.js";
@@ -64,8 +63,7 @@ import { snippets_StringSchema } from "./_snippets/snippets_StringSchema.js";
64
63
  import { snippets_TermFilter } from "./_snippets/snippets_TermFilter.js";
65
64
  import { snippets_TermJsonObject } from "./_snippets/snippets_TermJsonObject.js";
66
65
  import { snippets_TermSchema } from "./_snippets/snippets_TermSchema.js";
67
- import { snippets_ToJsonObjectFunction } from "./_snippets/snippets_ToJsonObjectFunction.js";
68
- import { snippets_ToJsonValueFunction } from "./_snippets/snippets_ToJsonValueFunction.js";
66
+ import { snippets_ToJsonFunction } from "./_snippets/snippets_ToJsonFunction.js";
69
67
  import { snippets_ToLoggableFunction } from "./_snippets/snippets_ToLoggableFunction.js";
70
68
  import { snippets_ToRdfResourceFunction } from "./_snippets/snippets_ToRdfResourceFunction.js";
71
69
  import { snippets_ToRdfResourceValuesFunction } from "./_snippets/snippets_ToRdfResourceValuesFunction.js";
@@ -114,10 +112,10 @@ import { snippets_convertToBlankNode } from "./_snippets/snippets_convertToBlank
114
112
  import { snippets_convertToBlankNodeIdentifierProperty } from "./_snippets/snippets_convertToBlankNodeIdentifierProperty.js";
115
113
  import { snippets_convertToIdentifier } from "./_snippets/snippets_convertToIdentifier.js";
116
114
  import { snippets_convertToIdentifierProperty } from "./_snippets/snippets_convertToIdentifierProperty.js";
117
- import { snippets_convertToInIri } from "./_snippets/snippets_convertToInIri.js";
118
- import { snippets_convertToInIriIdentifierProperty } from "./_snippets/snippets_convertToInIriIdentifierProperty.js";
119
115
  import { snippets_convertToIri } from "./_snippets/snippets_convertToIri.js";
120
116
  import { snippets_convertToIriIdentifierProperty } from "./_snippets/snippets_convertToIriIdentifierProperty.js";
117
+ import { snippets_convertToIriLiteral } from "./_snippets/snippets_convertToIriLiteral.js";
118
+ import { snippets_convertToIriLiteralIdentifierProperty } from "./_snippets/snippets_convertToIriLiteralIdentifierProperty.js";
121
119
  import { snippets_convertToLangString } from "./_snippets/snippets_convertToLangString.js";
122
120
  import { snippets_convertToLazy } from "./_snippets/snippets_convertToLazy.js";
123
121
  import { snippets_convertToLazyOption } from "./_snippets/snippets_convertToLazyOption.js";
@@ -185,6 +183,9 @@ import { snippets_intFromRdfResourceValues } from "./_snippets/snippets_intFromR
185
183
  import { snippets_iriFromJsonObject } from "./_snippets/snippets_iriFromJsonObject.js";
186
184
  import { snippets_iriFromJsonString } from "./_snippets/snippets_iriFromJsonString.js";
187
185
  import { snippets_iriFromRdfResourceValues } from "./_snippets/snippets_iriFromRdfResourceValues.js";
186
+ import { snippets_iriFromString } from "./_snippets/snippets_iriFromString.js";
187
+ import { snippets_iriLiteralFromJsonObject } from "./_snippets/snippets_iriLiteralFromJsonObject.js";
188
+ import { snippets_iriLiteralFromJsonString } from "./_snippets/snippets_iriLiteralFromJsonString.js";
188
189
  import { snippets_iriSparqlWherePatterns } from "./_snippets/snippets_iriSparqlWherePatterns.js";
189
190
  import { snippets_iriToJsonObject } from "./_snippets/snippets_iriToJsonObject.js";
190
191
  import { snippets_iriToJsonString } from "./_snippets/snippets_iriToJsonString.js";
@@ -313,11 +314,8 @@ export class Snippets {
313
314
  get FocusSparqlWherePatternsFunction() {
314
315
  return this.snippet(snippets_FocusSparqlWherePatternsFunction);
315
316
  }
316
- get FromJsonObjectFunction() {
317
- return this.snippet(snippets_FromJsonObjectFunction);
318
- }
319
- get FromJsonValueFunction() {
320
- return this.snippet(snippets_FromJsonValueFunction);
317
+ get FromJsonFunction() {
318
+ return this.snippet(snippets_FromJsonFunction);
321
319
  }
322
320
  get FromRdfResourceFunction() {
323
321
  return this.snippet(snippets_FromRdfResourceFunction);
@@ -433,11 +431,8 @@ export class Snippets {
433
431
  get TermSchema() {
434
432
  return this.snippet(snippets_TermSchema);
435
433
  }
436
- get ToJsonObjectFunction() {
437
- return this.snippet(snippets_ToJsonObjectFunction);
438
- }
439
- get ToJsonValueFunction() {
440
- return this.snippet(snippets_ToJsonValueFunction);
434
+ get ToJsonFunction() {
435
+ return this.snippet(snippets_ToJsonFunction);
441
436
  }
442
437
  get ToLoggableFunction() {
443
438
  return this.snippet(snippets_ToLoggableFunction);
@@ -583,18 +578,18 @@ export class Snippets {
583
578
  get convertToIdentifierProperty() {
584
579
  return this.snippet(snippets_convertToIdentifierProperty);
585
580
  }
586
- get convertToInIri() {
587
- return this.snippet(snippets_convertToInIri);
588
- }
589
- get convertToInIriIdentifierProperty() {
590
- return this.snippet(snippets_convertToInIriIdentifierProperty);
591
- }
592
581
  get convertToIri() {
593
582
  return this.snippet(snippets_convertToIri);
594
583
  }
595
584
  get convertToIriIdentifierProperty() {
596
585
  return this.snippet(snippets_convertToIriIdentifierProperty);
597
586
  }
587
+ get convertToIriLiteral() {
588
+ return this.snippet(snippets_convertToIriLiteral);
589
+ }
590
+ get convertToIriLiteralIdentifierProperty() {
591
+ return this.snippet(snippets_convertToIriLiteralIdentifierProperty);
592
+ }
598
593
  get convertToLangString() {
599
594
  return this.snippet(snippets_convertToLangString);
600
595
  }
@@ -796,6 +791,15 @@ export class Snippets {
796
791
  get iriFromRdfResourceValues() {
797
792
  return this.snippet(snippets_iriFromRdfResourceValues);
798
793
  }
794
+ get iriFromString() {
795
+ return this.snippet(snippets_iriFromString);
796
+ }
797
+ get iriLiteralFromJsonObject() {
798
+ return this.snippet(snippets_iriLiteralFromJsonObject);
799
+ }
800
+ get iriLiteralFromJsonString() {
801
+ return this.snippet(snippets_iriLiteralFromJsonString);
802
+ }
799
803
  get iriSparqlWherePatterns() {
800
804
  return this.snippet(snippets_iriSparqlWherePatterns);
801
805
  }
@@ -1119,10 +1123,7 @@ __decorate([
1119
1123
  ], Snippets.prototype, "FocusSparqlWherePatternsFunction", null);
1120
1124
  __decorate([
1121
1125
  Memoize()
1122
- ], Snippets.prototype, "FromJsonObjectFunction", null);
1123
- __decorate([
1124
- Memoize()
1125
- ], Snippets.prototype, "FromJsonValueFunction", null);
1126
+ ], Snippets.prototype, "FromJsonFunction", null);
1126
1127
  __decorate([
1127
1128
  Memoize()
1128
1129
  ], Snippets.prototype, "FromRdfResourceFunction", null);
@@ -1239,10 +1240,7 @@ __decorate([
1239
1240
  ], Snippets.prototype, "TermSchema", null);
1240
1241
  __decorate([
1241
1242
  Memoize()
1242
- ], Snippets.prototype, "ToJsonObjectFunction", null);
1243
- __decorate([
1244
- Memoize()
1245
- ], Snippets.prototype, "ToJsonValueFunction", null);
1243
+ ], Snippets.prototype, "ToJsonFunction", null);
1246
1244
  __decorate([
1247
1245
  Memoize()
1248
1246
  ], Snippets.prototype, "ToLoggableFunction", null);
@@ -1389,16 +1387,16 @@ __decorate([
1389
1387
  ], Snippets.prototype, "convertToIdentifierProperty", null);
1390
1388
  __decorate([
1391
1389
  Memoize()
1392
- ], Snippets.prototype, "convertToInIri", null);
1390
+ ], Snippets.prototype, "convertToIri", null);
1393
1391
  __decorate([
1394
1392
  Memoize()
1395
- ], Snippets.prototype, "convertToInIriIdentifierProperty", null);
1393
+ ], Snippets.prototype, "convertToIriIdentifierProperty", null);
1396
1394
  __decorate([
1397
1395
  Memoize()
1398
- ], Snippets.prototype, "convertToIri", null);
1396
+ ], Snippets.prototype, "convertToIriLiteral", null);
1399
1397
  __decorate([
1400
1398
  Memoize()
1401
- ], Snippets.prototype, "convertToIriIdentifierProperty", null);
1399
+ ], Snippets.prototype, "convertToIriLiteralIdentifierProperty", null);
1402
1400
  __decorate([
1403
1401
  Memoize()
1404
1402
  ], Snippets.prototype, "convertToLangString", null);
@@ -1600,6 +1598,15 @@ __decorate([
1600
1598
  __decorate([
1601
1599
  Memoize()
1602
1600
  ], Snippets.prototype, "iriFromRdfResourceValues", null);
1601
+ __decorate([
1602
+ Memoize()
1603
+ ], Snippets.prototype, "iriFromString", null);
1604
+ __decorate([
1605
+ Memoize()
1606
+ ], Snippets.prototype, "iriLiteralFromJsonObject", null);
1607
+ __decorate([
1608
+ Memoize()
1609
+ ], Snippets.prototype, "iriLiteralFromJsonString", null);
1603
1610
  __decorate([
1604
1611
  Memoize()
1605
1612
  ], Snippets.prototype, "iriSparqlWherePatterns", null);
@@ -10,6 +10,6 @@ ${member.type.fromJsonObjectFunction.unannotatedUsage}(jsonObject).${memberI + 1
10
10
  .toList()), { on: "," })} }) ${")".repeat(this.members.length)}`;
11
11
  }
12
12
  export function ObjectIntersectionType_fromJsonObjectFunctionType() {
13
- return code `${this.reusables.snippets.FromJsonObjectFunction}<${this.jsonObjectType.expression}, ${this.discriminatedType.map((discriminatedType) => discriminatedType.expression).orDefault(this.expression)}, undefined>`;
13
+ return code `${this.reusables.snippets.FromJsonFunction}<${this.jsonObjectType.expression}, ${this.discriminatedType.map((discriminatedType) => discriminatedType.expression).orDefault(this.expression)}, undefined>`;
14
14
  }
15
15
  //# sourceMappingURL=ObjectIntersectionType_fromJsonObjectFunction.js.map
@@ -108,7 +108,7 @@ export class ObjectType_IdentifierProperty extends ObjectType_AbstractProperty {
108
108
  conversionFunction = code `${this.reusables.snippets.convertToBlankNodeIdentifierProperty}`;
109
109
  }
110
110
  else if (this.type.in_.length > 0) {
111
- conversionFunction = code `${this.reusables.snippets.convertToInIriIdentifierProperty}<${joinCode(this.type.in_.map((in_) => code `${literalOf(in_.value)}`), { on: " | " })}>`;
111
+ conversionFunction = code `${this.reusables.snippets.convertToIriLiteralIdentifierProperty}<${joinCode(this.type.in_.map((in_) => code `${literalOf(in_.value)}`), { on: " | " })}>`;
112
112
  }
113
113
  else {
114
114
  conversionFunction = code `${this.reusables.snippets.convertToIriIdentifierProperty}`;
@@ -10,10 +10,15 @@ export function ObjectType_fromJsonObjectFunctionExpression() {
10
10
  };
11
11
  const propertyInitializers = this.properties.flatMap((property) => property.fromJsonObjectInitializer({ variables }).toList());
12
12
  invariant(propertyInitializers.length > 0);
13
+ let optionsParameter = optionsVariable;
14
+ this.name.ifNothing(() => {
15
+ optionsParameter = code `${optionsParameter}: Parameters<${ObjectType_fromJsonObjectFunctionType.call(this)}>[1]`;
16
+ });
17
+ optionsParameter = code `${optionsParameter} = {}`;
13
18
  return code `\
14
- (${variables.jsonObject}, ${variables.options} = {}) => ${this.reusables.snippets.sequenceRecord}({ ${joinCode(propertyInitializers, { on: "," })} }).chain(${this.createFunction.annotatedUsage})`;
19
+ (${variables.jsonObject}, ${optionsParameter}) => ${this.reusables.snippets.sequenceRecord}({ ${joinCode(propertyInitializers, { on: "," })} }).chain(${this.createFunction.annotatedUsage})`;
15
20
  }
16
21
  export function ObjectType_fromJsonObjectFunctionType() {
17
- return code `${this.reusables.snippets.FromJsonObjectFunction}<${this.jsonObjectType.expression}, ${this.discriminatedType.map((discriminatedType) => discriminatedType.expression).orDefault(this.expression)}, undefined>`;
22
+ return code `${this.reusables.snippets.FromJsonFunction}<${this.jsonObjectType.expression}, ${this.discriminatedType.map((discriminatedType) => discriminatedType.expression).orDefault(this.expression)}, undefined>`;
18
23
  }
19
24
  //# sourceMappingURL=ObjectType_fromJsonObjectFunction.js.map
@@ -11,6 +11,6 @@ export function ObjectType_toJsonObjectFunctionExpression() {
11
11
  .toList()), { on: "," })} }))`;
12
12
  }
13
13
  export function ObjectType_toJsonObjectFunctionType() {
14
- return code `${this.reusables.snippets.ToJsonObjectFunction}<${this.expression}, ${this.jsonObjectType.expression}>`;
14
+ return code `${this.reusables.snippets.ToJsonFunction}<${this.expression}, ${this.jsonObjectType.expression}>`;
15
15
  }
16
16
  //# sourceMappingURL=ObjectType_toJsonObjectFunction.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_FromJsonFunction: SnippetFactory;
3
+ //# sourceMappingURL=snippets_FromJsonFunction.d.ts.map
@@ -0,0 +1,28 @@
1
+ import { code, conditionalOutput, joinCode, } from "../ts-poet-wrapper.js";
2
+ export const snippets_FromJsonFunction = ({ configuration, imports, snippets, syntheticNamePrefix, }) => {
3
+ const options = [code `context?: unknown;`];
4
+ options.push(code `defaultNamespace?: ${snippets.NamespaceBuilder};`);
5
+ if (configuration.features.has("ObjectSet")) {
6
+ options.push(code `objectSet?: ${syntheticNamePrefix}ObjectSet;`);
7
+ }
8
+ options.push(code `prefixMap?: ${imports.PrefixMap};`);
9
+ const joinedOptions = joinCode(options.map((option) => code ` ${option}`), { on: "\n" });
10
+ return conditionalOutput(`${syntheticNamePrefix}FromJsonFunction`, code `\
11
+ export type ${syntheticNamePrefix}FromJsonFunction<JsonValueT, ValueT, ValueSchemaT> =
12
+ [ValueSchemaT] extends [undefined]
13
+ ? (
14
+ jsonValue: JsonValueT,
15
+ options?: {
16
+ ${joinedOptions}
17
+ schema?: unknown;
18
+ },
19
+ ) => ${imports.Either}<Error, ValueT>
20
+ : (
21
+ jsonValue: JsonValueT,
22
+ options: {
23
+ ${joinedOptions}
24
+ schema: ValueSchemaT;
25
+ },
26
+ ) => ${imports.Either}<Error, ValueT>;`);
27
+ };
28
+ //# sourceMappingURL=snippets_FromJsonFunction.js.map
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_ToJsonFunction: SnippetFactory;
3
+ //# sourceMappingURL=snippets_ToJsonFunction.d.ts.map
@@ -0,0 +1,3 @@
1
+ import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
+ export const snippets_ToJsonFunction = ({ syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}ToJsonFunction`, code `export type ${syntheticNamePrefix}ToJsonFunction<T, JsonT> = (value: T) => JsonT;`);
3
+ //# sourceMappingURL=snippets_ToJsonFunction.js.map
@@ -1,6 +1,6 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_arrayFromJsonArray = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}arrayFromJsonArray`, code `\
3
- function ${syntheticNamePrefix}arrayFromJsonArray<ItemJsonValueT, ItemT, ItemSchemaT>(itemFromJsonValue: ${snippets.FromJsonValueFunction}<ItemJsonValueT, ItemT, ItemSchemaT>): ${snippets.FromJsonValueFunction}<ItemJsonValueT[] | undefined, ItemT[], ${snippets.CollectionSchema}<ItemSchemaT>> {
3
+ function ${syntheticNamePrefix}arrayFromJsonArray<ItemJsonValueT, ItemT, ItemSchemaT>(itemFromJsonValue: ${snippets.FromJsonFunction}<ItemJsonValueT, ItemT, ItemSchemaT>): ${snippets.FromJsonFunction}<ItemJsonValueT[] | undefined, ItemT[], ${snippets.CollectionSchema}<ItemSchemaT>> {
4
4
  return (jsonArray, options) => {
5
5
  if (jsonArray === undefined) {
6
6
  return ${imports.Either}.of([]);
@@ -1,6 +1,6 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_arrayToJsonArray = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}arrayToJsonArray`, code `\
3
- function ${syntheticNamePrefix}arrayToJsonArray<ItemT, ItemJsonValueT>(itemToJsonValue: ${snippets.ToJsonValueFunction}<ItemT, ItemJsonValueT>): ${snippets.ToJsonValueFunction}<readonly ItemT[], ItemJsonValueT[]> {
3
+ function ${syntheticNamePrefix}arrayToJsonArray<ItemT, ItemJsonValueT>(itemToJsonValue: ${snippets.ToJsonFunction}<ItemT, ItemJsonValueT>): ${snippets.ToJsonFunction}<readonly ItemT[], ItemJsonValueT[]> {
4
4
  return (array) => array.map(itemToJsonValue);
5
5
  }`);
6
6
  //# sourceMappingURL=snippets_arrayToJsonArray.js.map
@@ -1,5 +1,5 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_bigDecimalFromJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigDecimalFromJsonObject`, code `\
3
- const ${syntheticNamePrefix}bigDecimalFromJsonObject: ${snippets.FromJsonObjectFunction}<${snippets.TypedLiteralJsonObject}, ${imports.BigDecimal}, ${snippets.NumericSchema}<${imports.BigDecimal}>> =
3
+ const ${syntheticNamePrefix}bigDecimalFromJsonObject: ${snippets.FromJsonFunction}<${snippets.TypedLiteralJsonObject}, ${imports.BigDecimal}, ${snippets.NumericSchema}<${imports.BigDecimal}>> =
4
4
  (jsonObject, options) => ${snippets.literalFromJsonObject}(jsonObject, options).chain(${imports.LiteralDecoder}.decodeBigDecimalLiteral);`);
5
5
  //# sourceMappingURL=snippets_bigDecimalFromJsonObject.js.map
@@ -1,5 +1,5 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_bigDecimalFromJsonString = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigDecimalFromJsonString`, code `\
3
- const ${syntheticNamePrefix}bigDecimalFromJsonString: ${snippets.FromJsonValueFunction}<string, ${imports.BigDecimal}, ${snippets.NumericSchema}<${imports.BigDecimal}>> =
3
+ const ${syntheticNamePrefix}bigDecimalFromJsonString: ${snippets.FromJsonFunction}<string, ${imports.BigDecimal}, ${snippets.NumericSchema}<${imports.BigDecimal}>> =
4
4
  (jsonValue) => ${imports.Either}.encase(() => new ${imports.BigDecimal}(jsonValue));`);
5
5
  //# sourceMappingURL=snippets_bigDecimalFromJsonString.js.map
@@ -1,6 +1,6 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_bigDecimalToJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigDecimalToJsonObject`, code `\
3
- function ${syntheticNamePrefix}bigDecimalToJsonObject(datatype: ${imports.NamedNode}): ${snippets.ToJsonObjectFunction}<${imports.BigDecimal}, ${snippets.TypedLiteralJsonObject}> {
3
+ function ${syntheticNamePrefix}bigDecimalToJsonObject(datatype: ${imports.NamedNode}): ${snippets.ToJsonFunction}<${imports.BigDecimal}, ${snippets.TypedLiteralJsonObject}> {
4
4
  return (value) => ${snippets.typedLiteralToJsonObject}(${snippets.literalFactory}.bigdecimal(value, datatype));
5
5
  }`);
6
6
  //# sourceMappingURL=snippets_bigDecimalToJsonObject.js.map
@@ -1,5 +1,5 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_bigDecimalToJsonString = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigDecimalToJsonString`, code `\
3
- const ${syntheticNamePrefix}bigDecimalToJsonString: ${snippets.ToJsonValueFunction}<${imports.BigDecimal}, string> =
3
+ const ${syntheticNamePrefix}bigDecimalToJsonString: ${snippets.ToJsonFunction}<${imports.BigDecimal}, string> =
4
4
  (bigDecimal) => bigDecimal.toFixed();`);
5
5
  //# sourceMappingURL=snippets_bigDecimalToJsonString.js.map
@@ -1,6 +1,6 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_bigIntFromJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigIntFromJsonObject`, code `\
3
- function ${syntheticNamePrefix}bigIntFromJsonObject<BigIntT extends bigint>(jsonObject: ${snippets.TypedLiteralJsonObject}, options: Parameters<${snippets.FromJsonObjectFunction}<${snippets.TypedLiteralJsonObject}, BigIntT, ${snippets.NumericSchema}<BigIntT>>>[1]): ${imports.Either}<Error, BigIntT> {
3
+ function ${syntheticNamePrefix}bigIntFromJsonObject<BigIntT extends bigint>(jsonObject: ${snippets.TypedLiteralJsonObject}, options: Parameters<${snippets.FromJsonFunction}<${snippets.TypedLiteralJsonObject}, BigIntT, ${snippets.NumericSchema}<BigIntT>>>[1]): ${imports.Either}<Error, BigIntT> {
4
4
  const { schema } = options;
5
5
  return ${snippets.literalFromJsonObject}(jsonObject)
6
6
  .chain(${imports.LiteralDecoder}.decodeBigIntLiteral)
@@ -1,6 +1,6 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_bigIntFromJsonString = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigIntFromJsonString`, code `\
3
- function ${syntheticNamePrefix}bigIntFromJsonString<JsonValueT extends string, BigIntT extends bigint>(jsonValue: JsonValueT, options: Parameters<${snippets.FromJsonValueFunction}<string, BigIntT, ${snippets.NumericSchema}<BigIntT>>>[1]): ${imports.Either}<Error, BigIntT> {
3
+ function ${syntheticNamePrefix}bigIntFromJsonString<JsonValueT extends string, BigIntT extends bigint>(jsonValue: JsonValueT, options: Parameters<${snippets.FromJsonFunction}<string, BigIntT, ${snippets.NumericSchema}<BigIntT>>>[1]): ${imports.Either}<Error, BigIntT> {
4
4
  const { schema } = options;
5
5
  return ${imports.Either}.encase(() => BigInt(jsonValue) as BigIntT)
6
6
  .chain(value => ${snippets.constrainPrimitive}<BigIntT, bigint>(value, schema.in)) as ${imports.Either}<Error, BigIntT>;
@@ -1,6 +1,6 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_bigIntToJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigIntToJsonObject`, code `\
3
- function ${syntheticNamePrefix}bigIntToJsonObject(datatype: ${imports.NamedNode}): ${snippets.ToJsonObjectFunction}<bigint, ${snippets.TypedLiteralJsonObject}> {
3
+ function ${syntheticNamePrefix}bigIntToJsonObject(datatype: ${imports.NamedNode}): ${snippets.ToJsonFunction}<bigint, ${snippets.TypedLiteralJsonObject}> {
4
4
  return (value) => ${snippets.typedLiteralToJsonObject}(${snippets.literalFactory}.bigint(value, datatype));
5
5
  }`);
6
6
  //# sourceMappingURL=snippets_bigIntToJsonObject.js.map
@@ -1,5 +1,5 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_bigIntToJsonString = ({ snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}bigIntToJsonString`, code `\
3
- const ${syntheticNamePrefix}bigIntToJsonString: ${snippets.ToJsonValueFunction}<bigint, string> =
3
+ const ${syntheticNamePrefix}bigIntToJsonString: ${snippets.ToJsonFunction}<bigint, string> =
4
4
  (bigInt) => bigInt.toString();`);
5
5
  //# sourceMappingURL=snippets_bigIntToJsonString.js.map
@@ -1,5 +1,5 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_blankNodeFromJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}blankNodeFromJsonObject`, code `\
3
- const ${syntheticNamePrefix}blankNodeFromJsonObject: ${snippets.FromJsonObjectFunction}<${snippets.IdentifierJsonObject}, ${imports.BlankNode}, undefined> =
3
+ const ${syntheticNamePrefix}blankNodeFromJsonObject: ${snippets.FromJsonFunction}<${snippets.IdentifierJsonObject}, ${imports.BlankNode}, undefined> =
4
4
  (jsonObject) => ${snippets.blankNodeFromJsonString}(jsonObject["@id"]);`);
5
5
  //# sourceMappingURL=snippets_blankNodeFromJsonObject.js.map
@@ -1,5 +1,5 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_blankNodeFromJsonString = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}blankNodeFromJsonString`, code `\
3
- const ${syntheticNamePrefix}blankNodeFromJsonString: ${snippets.FromJsonValueFunction}<string, ${imports.BlankNode}, undefined> =
3
+ const ${syntheticNamePrefix}blankNodeFromJsonString: ${snippets.FromJsonFunction}<string, ${imports.BlankNode}, undefined> =
4
4
  (jsonValue) => ${imports.Right}(${imports.dataFactory}.blankNode(jsonValue.substring(2)));`);
5
5
  //# sourceMappingURL=snippets_blankNodeFromJsonString.js.map
@@ -1,5 +1,5 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_blankNodeToJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}blankNodeToJsonObject`, code `\
3
- const ${syntheticNamePrefix}blankNodeToJsonObject: ${snippets.ToJsonObjectFunction}<${imports.BlankNode}, ${snippets.IdentifierJsonObject}> =
3
+ const ${syntheticNamePrefix}blankNodeToJsonObject: ${snippets.ToJsonFunction}<${imports.BlankNode}, ${snippets.IdentifierJsonObject}> =
4
4
  (blankNode) => ({ "@id": ${snippets.blankNodeToJsonString}(blankNode) });`);
5
5
  //# sourceMappingURL=snippets_blankNodeToJsonObject.js.map
@@ -1,5 +1,5 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_blankNodeToJsonString = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}blankNodeToJsonString`, code `\
3
- const ${syntheticNamePrefix}blankNodeToJsonString: ${snippets.ToJsonValueFunction}<${imports.BlankNode}, string> =
3
+ const ${syntheticNamePrefix}blankNodeToJsonString: ${snippets.ToJsonFunction}<${imports.BlankNode}, string> =
4
4
  (blankNode) => \`_:\${blankNode.value}\`;`);
5
5
  //# sourceMappingURL=snippets_blankNodeToJsonString.js.map
@@ -1,6 +1,6 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_booleanFromJsonBoolean = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}booleanFromJsonBoolean`, code `\
3
- function ${syntheticNamePrefix}booleanFromJsonBoolean<BooleanT extends boolean>(jsonBoolean: BooleanT, _options: Parameters<${snippets.FromJsonValueFunction}<BooleanT, BooleanT, ${snippets.BooleanSchema}<BooleanT>>>[1]): ${imports.Either}<Error, BooleanT> {
3
+ function ${syntheticNamePrefix}booleanFromJsonBoolean<BooleanT extends boolean>(jsonBoolean: BooleanT, _options: Parameters<${snippets.FromJsonFunction}<BooleanT, BooleanT, ${snippets.BooleanSchema}<BooleanT>>>[1]): ${imports.Either}<Error, BooleanT> {
4
4
  return ${imports.Either}.of(jsonBoolean);
5
5
  }`);
6
6
  //# sourceMappingURL=snippets_booleanFromJsonBoolean.js.map
@@ -1,6 +1,6 @@
1
1
  import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
2
  export const snippets_booleanFromJsonObject = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}booleanFromJsonObject`, code `\
3
- function ${syntheticNamePrefix}booleanFromJsonObject<BooleanT extends boolean>(jsonObject: ${snippets.TypedLiteralJsonObject}, options: Parameters<${snippets.FromJsonObjectFunction}<${snippets.TypedLiteralJsonObject}, BooleanT, ${snippets.BooleanSchema}<BooleanT>>>[1]): ${imports.Either}<Error, BooleanT> {
3
+ function ${syntheticNamePrefix}booleanFromJsonObject<BooleanT extends boolean>(jsonObject: ${snippets.TypedLiteralJsonObject}, options: Parameters<${snippets.FromJsonFunction}<${snippets.TypedLiteralJsonObject}, BooleanT, ${snippets.BooleanSchema}<BooleanT>>>[1]): ${imports.Either}<Error, BooleanT> {
4
4
  const { schema } = options;
5
5
  return ${snippets.literalFromJsonObject}(jsonObject)
6
6
  .chain(${imports.LiteralDecoder}.decodeBooleanLiteral)
@@ -5,7 +5,7 @@ function ${syntheticNamePrefix}convertToIdentifier<DefaultNamespaceT extends ${s
5
5
  case "object":
6
6
  return ${imports.Either}.of(value);
7
7
  case "string":
8
- return ${imports.Either}.of(defaultNamespace ? defaultNamespace(value) : ${imports.dataFactory}.namedNode(value));
8
+ return ${snippets.iriFromString}(value, { defaultNamespace });
9
9
  case "undefined":
10
10
  return ${imports.Either}.of(${imports.dataFactory}.blankNode());
11
11
  }
@@ -8,10 +8,8 @@ function ${syntheticNamePrefix}convertToIdentifierProperty<DefaultNamespaceT ext
8
8
  const captureIdentifier = identifier;
9
9
  return ${imports.Either}.of(() => captureIdentifier);
10
10
  }
11
- case "string": {
12
- const captureIdentifier = defaultNamespace ? defaultNamespace(identifier) : ${imports.dataFactory}.namedNode(identifier);
13
- return ${imports.Either}.of(() => captureIdentifier);
14
- }
11
+ case "string":
12
+ return ${snippets.iriFromString}(identifier, { defaultNamespace }).map(iri => (() => iri));
15
13
  case "undefined": {
16
14
  const captureIdentifier = ${imports.dataFactory}.blankNode();
17
15
  return ${imports.Either}.of(() => captureIdentifier);
@@ -5,7 +5,7 @@ function ${syntheticNamePrefix}convertToIri<DefaultNamespaceT extends ${snippets
5
5
  case "object":
6
6
  return ${imports.Either}.of(value);
7
7
  case "string":
8
- return ${imports.Either}.of(defaultNamespace ? defaultNamespace(value) : ${imports.dataFactory}.namedNode(value));
8
+ return ${snippets.iriFromString}(value, { defaultNamespace });
9
9
  }
10
10
  }`);
11
11
  //# sourceMappingURL=snippets_convertToIri.js.map
@@ -9,8 +9,7 @@ function ${syntheticNamePrefix}convertToIriIdentifierProperty<DefaultNamespaceT
9
9
  return ${imports.Either}.of(() => captureIdentifier);
10
10
  }
11
11
  case "string": {
12
- const captureIdentifier = defaultNamespace ? defaultNamespace(identifier) : ${imports.dataFactory}.namedNode(identifier);
13
- return ${imports.Either}.of(() => captureIdentifier);
12
+ return ${snippets.iriFromString}(identifier, { defaultNamespace }).map(iri => (() => iri));
14
13
  }
15
14
  }
16
15
  }`);
@@ -0,0 +1,3 @@
1
+ import type { SnippetFactory } from "../SnippetFactory.js";
2
+ export declare const snippets_convertToIriLiteral: SnippetFactory;
3
+ //# sourceMappingURL=snippets_convertToIriLiteral.d.ts.map