@shaclmate/compiler 4.0.34 → 4.0.35

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 (106) hide show
  1. package/dist/generators/ts/AbstractCollectionType.d.ts +2 -1
  2. package/dist/generators/ts/AbstractCollectionType.js +14 -13
  3. package/dist/generators/ts/AbstractContainerType.d.ts +2 -0
  4. package/dist/generators/ts/AbstractContainerType.js +20 -0
  5. package/dist/generators/ts/AbstractDateType.d.ts +1 -1
  6. package/dist/generators/ts/AbstractDateType.js +3 -3
  7. package/dist/generators/ts/AbstractLazyObjectType.d.ts +1 -0
  8. package/dist/generators/ts/AbstractLazyObjectType.js +1 -0
  9. package/dist/generators/ts/AbstractLiteralType.d.ts +1 -1
  10. package/dist/generators/ts/AbstractLiteralType.js +2 -2
  11. package/dist/generators/ts/AbstractNumericType.d.ts +1 -8
  12. package/dist/generators/ts/AbstractNumericType.js +2 -16
  13. package/dist/generators/ts/AbstractPrimitiveType.d.ts +1 -0
  14. package/dist/generators/ts/AbstractPrimitiveType.js +2 -1
  15. package/dist/generators/ts/AbstractTermType.d.ts +2 -1
  16. package/dist/generators/ts/AbstractTermType.js +3 -2
  17. package/dist/generators/ts/AbstractType.d.ts +19 -8
  18. package/dist/generators/ts/AbstractUnionType.d.ts +3 -2
  19. package/dist/generators/ts/AbstractUnionType.js +14 -13
  20. package/dist/generators/ts/BigDecimalType.d.ts +3 -2
  21. package/dist/generators/ts/BigDecimalType.js +5 -12
  22. package/dist/generators/ts/BigIntType.js +1 -1
  23. package/dist/generators/ts/BlankNodeType.d.ts +3 -2
  24. package/dist/generators/ts/BlankNodeType.js +6 -5
  25. package/dist/generators/ts/BooleanType.d.ts +1 -2
  26. package/dist/generators/ts/BooleanType.js +2 -16
  27. package/dist/generators/ts/DateTimeType.d.ts +0 -1
  28. package/dist/generators/ts/DateTimeType.js +0 -9
  29. package/dist/generators/ts/DateType.d.ts +0 -1
  30. package/dist/generators/ts/DateType.js +0 -9
  31. package/dist/generators/ts/DefaultValueType.d.ts +2 -1
  32. package/dist/generators/ts/DefaultValueType.js +5 -4
  33. package/dist/generators/ts/IdentifierType.d.ts +3 -2
  34. package/dist/generators/ts/IdentifierType.js +6 -5
  35. package/dist/generators/ts/IriType.d.ts +3 -11
  36. package/dist/generators/ts/IriType.js +6 -5
  37. package/dist/generators/ts/LazyObjectOptionType.d.ts +1 -1
  38. package/dist/generators/ts/LazyObjectOptionType.js +3 -3
  39. package/dist/generators/ts/LazyObjectSetType.d.ts +2 -1
  40. package/dist/generators/ts/LazyObjectSetType.js +3 -3
  41. package/dist/generators/ts/LazyObjectType.d.ts +2 -1
  42. package/dist/generators/ts/LazyObjectType.js +3 -3
  43. package/dist/generators/ts/LiteralType.d.ts +2 -1
  44. package/dist/generators/ts/LiteralType.js +4 -3
  45. package/dist/generators/ts/NamedObjectType.d.ts +2 -1
  46. package/dist/generators/ts/NamedObjectType.js +2 -14
  47. package/dist/generators/ts/OptionType.d.ts +4 -3
  48. package/dist/generators/ts/OptionType.js +20 -17
  49. package/dist/generators/ts/Snippets.d.ts +7 -11
  50. package/dist/generators/ts/Snippets.js +46 -74
  51. package/dist/generators/ts/StringType.d.ts +1 -2
  52. package/dist/generators/ts/StringType.js +2 -16
  53. package/dist/generators/ts/TermType.d.ts +2 -1
  54. package/dist/generators/ts/TermType.js +6 -16
  55. package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +2 -1
  56. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +29 -8
  57. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +5 -5
  58. package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +22 -2
  59. package/dist/generators/ts/_snippets/snippets_ConversionFunction.d.ts +3 -0
  60. package/dist/generators/ts/_snippets/snippets_ConversionFunction.js +4 -0
  61. package/dist/generators/ts/_snippets/snippets_ValidationFunction.d.ts +3 -0
  62. package/dist/generators/ts/_snippets/snippets_ValidationFunction.js +4 -0
  63. package/dist/generators/ts/_snippets/snippets_convertToArray.d.ts +3 -0
  64. package/dist/generators/ts/_snippets/snippets_convertToArray.js +8 -0
  65. package/dist/generators/ts/_snippets/snippets_convertToBlankNode.js +2 -2
  66. package/dist/generators/ts/_snippets/snippets_convertToIdentifier.js +2 -2
  67. package/dist/generators/ts/_snippets/snippets_convertToIri.js +2 -2
  68. package/dist/generators/ts/_snippets/snippets_convertToLazyObject.js +1 -1
  69. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectOption.js +1 -1
  70. package/dist/generators/ts/_snippets/snippets_convertToLazyObjectSet.js +1 -1
  71. package/dist/generators/ts/_snippets/snippets_convertToLiteral.js +1 -1
  72. package/dist/generators/ts/_snippets/snippets_convertToMaybe.js +3 -3
  73. package/dist/generators/ts/_snippets/snippets_convertWithDefaultValue.js +4 -4
  74. package/dist/generators/ts/_snippets/snippets_identityConversionFunction.d.ts +3 -0
  75. package/dist/generators/ts/_snippets/snippets_identityConversionFunction.js +6 -0
  76. package/dist/generators/ts/_snippets/snippets_identityValidationFunction.d.ts +3 -0
  77. package/dist/generators/ts/_snippets/snippets_identityValidationFunction.js +6 -0
  78. package/dist/generators/ts/_snippets/snippets_validateArray.d.ts +3 -0
  79. package/dist/generators/ts/_snippets/snippets_validateArray.js +13 -0
  80. package/dist/generators/ts/_snippets/snippets_validateMaybe.d.ts +3 -0
  81. package/dist/generators/ts/_snippets/snippets_validateMaybe.js +7 -0
  82. package/dist/input/generated.d.ts +8 -8
  83. package/dist/input/generated.js +110 -113
  84. package/package.json +2 -2
  85. package/dist/generators/ts/_snippets/snippets_convertToBigDecimal.d.ts +0 -3
  86. package/dist/generators/ts/_snippets/snippets_convertToBigDecimal.js +0 -6
  87. package/dist/generators/ts/_snippets/snippets_convertToBoolean.d.ts +0 -3
  88. package/dist/generators/ts/_snippets/snippets_convertToBoolean.js +0 -6
  89. package/dist/generators/ts/_snippets/snippets_convertToDate.d.ts +0 -3
  90. package/dist/generators/ts/_snippets/snippets_convertToDate.js +0 -6
  91. package/dist/generators/ts/_snippets/snippets_convertToDateTime.d.ts +0 -3
  92. package/dist/generators/ts/_snippets/snippets_convertToDateTime.js +0 -6
  93. package/dist/generators/ts/_snippets/snippets_convertToMutableArray.d.ts +0 -3
  94. package/dist/generators/ts/_snippets/snippets_convertToMutableArray.js +0 -14
  95. package/dist/generators/ts/_snippets/snippets_convertToNumeric.d.ts +0 -3
  96. package/dist/generators/ts/_snippets/snippets_convertToNumeric.js +0 -6
  97. package/dist/generators/ts/_snippets/snippets_convertToObject.d.ts +0 -3
  98. package/dist/generators/ts/_snippets/snippets_convertToObject.js +0 -6
  99. package/dist/generators/ts/_snippets/snippets_convertToReadonlyArray.d.ts +0 -3
  100. package/dist/generators/ts/_snippets/snippets_convertToReadonlyArray.js +0 -14
  101. package/dist/generators/ts/_snippets/snippets_convertToString.d.ts +0 -3
  102. package/dist/generators/ts/_snippets/snippets_convertToString.js +0 -6
  103. package/dist/generators/ts/_snippets/snippets_convertToTerm.d.ts +0 -3
  104. package/dist/generators/ts/_snippets/snippets_convertToTerm.js +0 -6
  105. package/dist/generators/ts/_snippets/snippets_convertToUnion.d.ts +0 -3
  106. package/dist/generators/ts/_snippets/snippets_convertToUnion.js +0 -6
@@ -15,10 +15,12 @@ function $compactRecord(record) {
15
15
  return definedProperties;
16
16
  }, {});
17
17
  }
18
- function $convertToBoolean(_schema, value) {
19
- return Either.of(value);
18
+ function $convertToArray(convertToItem, _readonly) {
19
+ return (value) => (typeof value === "undefined"
20
+ ? Either.of([])
21
+ : Either.sequence(value.map(convertToItem)));
20
22
  }
21
- function $convertToIdentifier(_schema, value) {
23
+ function $convertToIdentifier(value) {
22
24
  switch (typeof value) {
23
25
  case "object":
24
26
  return Either.of(value);
@@ -46,7 +48,7 @@ function $convertToIdentifierProperty(identifier) {
46
48
  }
47
49
  }
48
50
  }
49
- function $convertToIri(_schema, value) {
51
+ function $convertToIri(value) {
50
52
  switch (typeof value) {
51
53
  case "object":
52
54
  return Either.of(value);
@@ -54,7 +56,7 @@ function $convertToIri(_schema, value) {
54
56
  return Either.of(dataFactory.namedNode(value));
55
57
  }
56
58
  }
57
- function $convertToLiteral(_schema, value) {
59
+ function $convertToLiteral(value) {
58
60
  if (typeof value === "object") {
59
61
  if (value instanceof Date) {
60
62
  return Either.of($literalFactory.date(value));
@@ -64,7 +66,7 @@ function $convertToLiteral(_schema, value) {
64
66
  return Either.of($literalFactory.primitive(value));
65
67
  }
66
68
  function $convertToMaybe(convertToItem) {
67
- return (schema, value) => {
69
+ return (value) => {
68
70
  switch (typeof value) {
69
71
  case "object": {
70
72
  if (Maybe.isMaybe(value)) {
@@ -75,39 +77,15 @@ function $convertToMaybe(convertToItem) {
75
77
  case "undefined":
76
78
  return Either.of(Maybe.empty());
77
79
  }
78
- return convertToItem(schema.item(), value).map(Maybe.of);
80
+ return convertToItem(value).map(Maybe.of);
79
81
  };
80
82
  }
81
- function $convertToNumeric(_schema, value) {
82
- return Either.of(value);
83
- }
84
- function $convertToObject(_schema, value) {
85
- return Either.of(value);
86
- }
87
- function $convertToReadonlyArray(convertToItem) {
88
- return (schema, value) => {
89
- return (typeof value === "undefined"
90
- ? Either.of([])
91
- : Either.sequence(value.map((item) => convertToItem(schema.item(), item)))).chain((array) => {
92
- if (schema.minCount !== undefined && array.length < schema.minCount) {
93
- return Left(new Error(`array has length (${array.length}) less than minCount (${schema.minCount})`));
94
- }
95
- return Either.of(array);
96
- });
97
- };
98
- }
99
- function $convertToString(_schema, value) {
100
- return Either.of(value);
101
- }
102
- function $convertToTerm(_schema, value) {
103
- return Either.of(value);
104
- }
105
- function $convertWithDefaultValue(convertToItem) {
106
- return (schema, value) => {
83
+ function $convertWithDefaultValue(convertToItem, defaultValue) {
84
+ return (value) => {
107
85
  if (typeof value === "undefined") {
108
- return convertToItem(schema.item(), schema.defaultValue);
86
+ return convertToItem(defaultValue);
109
87
  }
110
- return convertToItem(schema.item(), value);
88
+ return convertToItem(value);
111
89
  };
112
90
  }
113
91
  export var $EqualsResult;
@@ -281,6 +259,12 @@ class $IdentifierSet {
281
259
  }
282
260
  }
283
261
  }
262
+ function $identityConversionFunction(value) {
263
+ return Either.of(value);
264
+ }
265
+ function $identityValidationFunction(_schema, value) {
266
+ return Either.of(value);
267
+ }
284
268
  const $literalFactory = new LiteralFactory({ dataFactory: dataFactory });
285
269
  const $parseIdentifier = NTriplesIdentifier.parser(dataFactory);
286
270
  export var $PropertyPath;
@@ -355,6 +339,19 @@ function $shaclPropertyFromRdf({ graph, propertySchema, resource, typeFromRdf, }
355
339
  function $strictEquals(left, right) {
356
340
  return $EqualsResult.fromBooleanEqualsResult(left, right, left === right);
357
341
  }
342
+ function $validateArray(validateItem, _readonly) {
343
+ return (schema, valueArray) => {
344
+ if (schema.minCount !== undefined && valueArray.length < schema.minCount) {
345
+ return Left(new Error(`value array has length (${valueArray.length}) less than minCount (${schema.minCount})`));
346
+ }
347
+ return Either.sequence(valueArray.map((value) => validateItem(schema.item(), value)));
348
+ };
349
+ }
350
+ function $validateMaybe(validateItem) {
351
+ return (schema, valueMaybe) => valueMaybe
352
+ .map((value) => validateItem(schema.item(), value).map(() => valueMaybe))
353
+ .orDefault(Either.of(valueMaybe));
354
+ }
358
355
  function $wrap_FromRdfResourceFunction(_fromRdfResourceFunction) {
359
356
  return (resource, options) => {
360
357
  let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
@@ -395,42 +392,42 @@ export var PropertyShape;
395
392
  function create(parameters) {
396
393
  return $sequenceRecord({
397
394
  $identifier: $convertToIdentifierProperty(parameters.$identifier),
398
- and: $convertToMaybe($convertToReadonlyArray($convertToIdentifier))(PropertyShape.schema.properties.and.type(), parameters.and),
399
- classes: $convertToReadonlyArray(($convertToIri))(PropertyShape.schema.properties.classes.type(), parameters.classes),
400
- comment: $convertToMaybe(($convertToString))(PropertyShape.schema.properties.comment.type(), parameters.comment),
401
- datatype: $convertToMaybe(($convertToIri))(PropertyShape.schema.properties.datatype.type(), parameters.datatype),
402
- deactivated: $convertToMaybe(($convertToBoolean))(PropertyShape.schema.properties.deactivated.type(), parameters.deactivated),
403
- defaultValue: $convertToMaybe(($convertToTerm))(PropertyShape.schema.properties.defaultValue.type(), parameters.defaultValue),
404
- description: $convertToMaybe(($convertToString))(PropertyShape.schema.properties.description.type(), parameters.description),
405
- display: $convertWithDefaultValue(($convertToBoolean))(PropertyShape.schema.properties.display.type(), parameters.display),
406
- flags: $convertToReadonlyArray(($convertToString))(PropertyShape.schema.properties.flags.type(), parameters.flags),
407
- groups: $convertToReadonlyArray($convertToIdentifier)(PropertyShape.schema.properties.groups.type(), parameters.groups),
408
- hasValues: $convertToReadonlyArray(($convertToTerm))(PropertyShape.schema.properties.hasValues.type(), parameters.hasValues),
409
- in_: $convertToMaybe($convertToReadonlyArray(($convertToTerm)))(PropertyShape.schema.properties.in_.type(), parameters.in_),
410
- isDefinedBy: $convertToMaybe($convertToIdentifier)(PropertyShape.schema.properties.isDefinedBy.type(), parameters.isDefinedBy),
411
- label: $convertToMaybe(($convertToString))(PropertyShape.schema.properties.label.type(), parameters.label),
412
- languageIn: $convertToMaybe($convertToReadonlyArray(($convertToString)))(PropertyShape.schema.properties.languageIn.type(), parameters.languageIn),
413
- maxCount: $convertToMaybe(($convertToNumeric))(PropertyShape.schema.properties.maxCount.type(), parameters.maxCount),
414
- maxExclusive: $convertToMaybe($convertToLiteral)(PropertyShape.schema.properties.maxExclusive.type(), parameters.maxExclusive),
415
- maxInclusive: $convertToMaybe($convertToLiteral)(PropertyShape.schema.properties.maxInclusive.type(), parameters.maxInclusive),
416
- maxLength: $convertToMaybe(($convertToNumeric))(PropertyShape.schema.properties.maxLength.type(), parameters.maxLength),
417
- minCount: $convertToMaybe(($convertToNumeric))(PropertyShape.schema.properties.minCount.type(), parameters.minCount),
418
- minExclusive: $convertToMaybe($convertToLiteral)(PropertyShape.schema.properties.minExclusive.type(), parameters.minExclusive),
419
- minInclusive: $convertToMaybe($convertToLiteral)(PropertyShape.schema.properties.minInclusive.type(), parameters.minInclusive),
420
- minLength: $convertToMaybe(($convertToNumeric))(PropertyShape.schema.properties.minLength.type(), parameters.minLength),
421
- mutable: $convertToMaybe(($convertToBoolean))(PropertyShape.schema.properties.mutable.type(), parameters.mutable),
422
- name: $convertToMaybe(($convertToString))(PropertyShape.schema.properties.name.type(), parameters.name),
423
- node: $convertToMaybe($convertToIdentifier)(PropertyShape.schema.properties.node.type(), parameters.node),
424
- nodeKind: $convertToMaybe(($convertToIri))(PropertyShape.schema.properties.nodeKind.type(), parameters.nodeKind),
425
- not: $convertToReadonlyArray($convertToIdentifier)(PropertyShape.schema.properties.not.type(), parameters.not),
426
- or: $convertToMaybe($convertToReadonlyArray($convertToIdentifier))(PropertyShape.schema.properties.or.type(), parameters.or),
427
- order: $convertToMaybe(($convertToNumeric))(PropertyShape.schema.properties.order.type(), parameters.order),
428
- path: $convertToObject(PropertyShape.schema.properties.path.type(), parameters.path),
429
- patterns: $convertToReadonlyArray(($convertToString))(PropertyShape.schema.properties.patterns.type(), parameters.patterns),
430
- resolve: $convertToMaybe($convertToIdentifier)(PropertyShape.schema.properties.resolve.type(), parameters.resolve),
431
- shaclmateName: $convertToMaybe(($convertToString))(PropertyShape.schema.properties.shaclmateName.type(), parameters.shaclmateName),
432
- uniqueLang: $convertToMaybe(($convertToBoolean))(PropertyShape.schema.properties.uniqueLang.type(), parameters.uniqueLang),
433
- xone: $convertToMaybe($convertToReadonlyArray($convertToIdentifier))(PropertyShape.schema.properties.xone.type(), parameters.xone),
395
+ and: $convertToMaybe($convertToArray($convertToIdentifier, true))(parameters.and).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.and.type(), value)),
396
+ classes: $convertToArray(($convertToIri), true)(parameters.classes).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.classes.type(), value)),
397
+ comment: $convertToMaybe($identityConversionFunction)(parameters.comment).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.comment.type(), value)),
398
+ datatype: $convertToMaybe(($convertToIri))(parameters.datatype).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.datatype.type(), value)),
399
+ deactivated: $convertToMaybe($identityConversionFunction)(parameters.deactivated).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.deactivated.type(), value)),
400
+ defaultValue: $convertToMaybe($identityConversionFunction)(parameters.defaultValue).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.defaultValue.type(), value)),
401
+ description: $convertToMaybe($identityConversionFunction)(parameters.description).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.description.type(), value)),
402
+ display: $convertWithDefaultValue($identityConversionFunction, false)(parameters.display),
403
+ flags: $convertToArray($identityConversionFunction, true)(parameters.flags).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.flags.type(), value)),
404
+ groups: $convertToArray($convertToIdentifier, true)(parameters.groups).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.groups.type(), value)),
405
+ hasValues: $convertToArray($identityConversionFunction, true)(parameters.hasValues).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.hasValues.type(), value)),
406
+ in_: $convertToMaybe($convertToArray($identityConversionFunction, true))(parameters.in_).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.in_.type(), value)),
407
+ isDefinedBy: $convertToMaybe($convertToIdentifier)(parameters.isDefinedBy).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.isDefinedBy.type(), value)),
408
+ label: $convertToMaybe($identityConversionFunction)(parameters.label).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.label.type(), value)),
409
+ languageIn: $convertToMaybe($convertToArray($identityConversionFunction, true))(parameters.languageIn).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.languageIn.type(), value)),
410
+ maxCount: $convertToMaybe($identityConversionFunction)(parameters.maxCount).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxCount.type(), value)),
411
+ maxExclusive: $convertToMaybe($convertToLiteral)(parameters.maxExclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxExclusive.type(), value)),
412
+ maxInclusive: $convertToMaybe($convertToLiteral)(parameters.maxInclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxInclusive.type(), value)),
413
+ maxLength: $convertToMaybe($identityConversionFunction)(parameters.maxLength).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxLength.type(), value)),
414
+ minCount: $convertToMaybe($identityConversionFunction)(parameters.minCount).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minCount.type(), value)),
415
+ minExclusive: $convertToMaybe($convertToLiteral)(parameters.minExclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minExclusive.type(), value)),
416
+ minInclusive: $convertToMaybe($convertToLiteral)(parameters.minInclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minInclusive.type(), value)),
417
+ minLength: $convertToMaybe($identityConversionFunction)(parameters.minLength).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minLength.type(), value)),
418
+ mutable: $convertToMaybe($identityConversionFunction)(parameters.mutable).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.mutable.type(), value)),
419
+ name: $convertToMaybe($identityConversionFunction)(parameters.name).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.name.type(), value)),
420
+ node: $convertToMaybe($convertToIdentifier)(parameters.node).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.node.type(), value)),
421
+ nodeKind: $convertToMaybe(($convertToIri))(parameters.nodeKind).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.nodeKind.type(), value)),
422
+ not: $convertToArray($convertToIdentifier, true)(parameters.not).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.not.type(), value)),
423
+ or: $convertToMaybe($convertToArray($convertToIdentifier, true))(parameters.or).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.or.type(), value)),
424
+ order: $convertToMaybe($identityConversionFunction)(parameters.order).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.order.type(), value)),
425
+ path: Either.of(parameters.path),
426
+ patterns: $convertToArray($identityConversionFunction, true)(parameters.patterns).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.patterns.type(), value)),
427
+ resolve: $convertToMaybe($convertToIdentifier)(parameters.resolve).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.resolve.type(), value)),
428
+ shaclmateName: $convertToMaybe($identityConversionFunction)(parameters.shaclmateName).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.shaclmateName.type(), value)),
429
+ uniqueLang: $convertToMaybe($identityConversionFunction)(parameters.uniqueLang).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.uniqueLang.type(), value)),
430
+ xone: $convertToMaybe($convertToArray($convertToIdentifier, true))(parameters.xone).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.xone.type(), value)),
434
431
  }).map((properties) => {
435
432
  const finalObject = { ...properties, $type: "PropertyShape" };
436
433
  if (!globalThis.Object.prototype.hasOwnProperty.call(finalObject, "toString")) {
@@ -1782,8 +1779,8 @@ export var PropertyGroup;
1782
1779
  function create(parameters) {
1783
1780
  return $sequenceRecord({
1784
1781
  $identifier: $convertToIdentifierProperty(parameters?.$identifier),
1785
- comment: $convertToMaybe(($convertToString))(PropertyGroup.schema.properties.comment.type(), parameters?.comment),
1786
- label: $convertToMaybe(($convertToString))(PropertyGroup.schema.properties.label.type(), parameters?.label),
1782
+ comment: $convertToMaybe($identityConversionFunction)(parameters?.comment).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.comment.type(), value)),
1783
+ label: $convertToMaybe($identityConversionFunction)(parameters?.label).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.label.type(), value)),
1787
1784
  }).map((properties) => {
1788
1785
  const finalObject = { ...properties, $type: "PropertyGroup" };
1789
1786
  if (!globalThis.Object.prototype.hasOwnProperty.call(finalObject, "toString")) {
@@ -1953,8 +1950,8 @@ export var Ontology;
1953
1950
  function create(parameters) {
1954
1951
  return $sequenceRecord({
1955
1952
  $identifier: $convertToIdentifierProperty(parameters?.$identifier),
1956
- comment: $convertToMaybe(($convertToString))(Ontology.schema.properties.comment.type(), parameters?.comment),
1957
- label: $convertToMaybe(($convertToString))(Ontology.schema.properties.label.type(), parameters?.label),
1953
+ comment: $convertToMaybe($identityConversionFunction)(parameters?.comment).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.comment.type(), value)),
1954
+ label: $convertToMaybe($identityConversionFunction)(parameters?.label).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.label.type(), value)),
1958
1955
  }).map((properties) => {
1959
1956
  const finalObject = { ...properties, $type: "Ontology" };
1960
1957
  if (!globalThis.Object.prototype.hasOwnProperty.call(finalObject, "toString")) {
@@ -2124,44 +2121,44 @@ export var NodeShape;
2124
2121
  function create(parameters) {
2125
2122
  return $sequenceRecord({
2126
2123
  $identifier: $convertToIdentifierProperty(parameters?.$identifier),
2127
- and: $convertToMaybe($convertToReadonlyArray($convertToIdentifier))(NodeShape.schema.properties.and.type(), parameters?.and),
2128
- classes: $convertToReadonlyArray(($convertToIri))(NodeShape.schema.properties.classes.type(), parameters?.classes),
2129
- closed: $convertToMaybe(($convertToBoolean))(NodeShape.schema.properties.closed.type(), parameters?.closed),
2130
- comment: $convertToMaybe(($convertToString))(NodeShape.schema.properties.comment.type(), parameters?.comment),
2131
- datatype: $convertToMaybe(($convertToIri))(NodeShape.schema.properties.datatype.type(), parameters?.datatype),
2132
- deactivated: $convertToMaybe(($convertToBoolean))(NodeShape.schema.properties.deactivated.type(), parameters?.deactivated),
2133
- discriminantValue: $convertToMaybe(($convertToString))(NodeShape.schema.properties.discriminantValue.type(), parameters?.discriminantValue),
2134
- extern: $convertToMaybe(($convertToBoolean))(NodeShape.schema.properties.extern.type(), parameters?.extern),
2135
- flags: $convertToReadonlyArray(($convertToString))(NodeShape.schema.properties.flags.type(), parameters?.flags),
2136
- fromRdfType: $convertToMaybe(($convertToIri))(NodeShape.schema.properties.fromRdfType.type(), parameters?.fromRdfType),
2137
- hasValues: $convertToReadonlyArray(($convertToTerm))(NodeShape.schema.properties.hasValues.type(), parameters?.hasValues),
2138
- ignoredProperties: $convertToMaybe($convertToReadonlyArray(($convertToIri)))(NodeShape.schema.properties.ignoredProperties.type(), parameters?.ignoredProperties),
2139
- in_: $convertToMaybe($convertToReadonlyArray(($convertToTerm)))(NodeShape.schema.properties.in_.type(), parameters?.in_),
2140
- isDefinedBy: $convertToMaybe($convertToIdentifier)(NodeShape.schema.properties.isDefinedBy.type(), parameters?.isDefinedBy),
2141
- label: $convertToMaybe(($convertToString))(NodeShape.schema.properties.label.type(), parameters?.label),
2142
- languageIn: $convertToMaybe($convertToReadonlyArray(($convertToString)))(NodeShape.schema.properties.languageIn.type(), parameters?.languageIn),
2143
- maxCount: $convertToMaybe(($convertToNumeric))(NodeShape.schema.properties.maxCount.type(), parameters?.maxCount),
2144
- maxExclusive: $convertToMaybe($convertToLiteral)(NodeShape.schema.properties.maxExclusive.type(), parameters?.maxExclusive),
2145
- maxInclusive: $convertToMaybe($convertToLiteral)(NodeShape.schema.properties.maxInclusive.type(), parameters?.maxInclusive),
2146
- maxLength: $convertToMaybe(($convertToNumeric))(NodeShape.schema.properties.maxLength.type(), parameters?.maxLength),
2147
- minCount: $convertToMaybe(($convertToNumeric))(NodeShape.schema.properties.minCount.type(), parameters?.minCount),
2148
- minExclusive: $convertToMaybe($convertToLiteral)(NodeShape.schema.properties.minExclusive.type(), parameters?.minExclusive),
2149
- minInclusive: $convertToMaybe($convertToLiteral)(NodeShape.schema.properties.minInclusive.type(), parameters?.minInclusive),
2150
- minLength: $convertToMaybe(($convertToNumeric))(NodeShape.schema.properties.minLength.type(), parameters?.minLength),
2151
- mutable: $convertToMaybe(($convertToBoolean))(NodeShape.schema.properties.mutable.type(), parameters?.mutable),
2152
- node: $convertToMaybe($convertToIdentifier)(NodeShape.schema.properties.node.type(), parameters?.node),
2153
- nodeKind: $convertToMaybe(($convertToIri))(NodeShape.schema.properties.nodeKind.type(), parameters?.nodeKind),
2154
- not: $convertToReadonlyArray($convertToIdentifier)(NodeShape.schema.properties.not.type(), parameters?.not),
2155
- or: $convertToMaybe($convertToReadonlyArray($convertToIdentifier))(NodeShape.schema.properties.or.type(), parameters?.or),
2156
- patterns: $convertToReadonlyArray(($convertToString))(NodeShape.schema.properties.patterns.type(), parameters?.patterns),
2157
- properties: $convertToReadonlyArray($convertToIdentifier)(NodeShape.schema.properties.properties.type(), parameters?.properties),
2158
- rdfType: $convertToMaybe(($convertToIri))(NodeShape.schema.properties.rdfType.type(), parameters?.rdfType),
2159
- shaclmateName: $convertToMaybe(($convertToString))(NodeShape.schema.properties.shaclmateName.type(), parameters?.shaclmateName),
2160
- subClassOf: $convertToReadonlyArray(($convertToIri))(NodeShape.schema.properties.subClassOf.type(), parameters?.subClassOf),
2161
- toRdfTypes: $convertToReadonlyArray(($convertToIri))(NodeShape.schema.properties.toRdfTypes.type(), parameters?.toRdfTypes),
2162
- tsImports: $convertToReadonlyArray(($convertToString))(NodeShape.schema.properties.tsImports.type(), parameters?.tsImports),
2163
- types: $convertToReadonlyArray(($convertToIri))(NodeShape.schema.properties.types.type(), parameters?.types),
2164
- xone: $convertToMaybe($convertToReadonlyArray($convertToIdentifier))(NodeShape.schema.properties.xone.type(), parameters?.xone),
2124
+ and: $convertToMaybe($convertToArray($convertToIdentifier, true))(parameters?.and).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.and.type(), value)),
2125
+ classes: $convertToArray(($convertToIri), true)(parameters?.classes).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.classes.type(), value)),
2126
+ closed: $convertToMaybe($identityConversionFunction)(parameters?.closed).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.closed.type(), value)),
2127
+ comment: $convertToMaybe($identityConversionFunction)(parameters?.comment).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.comment.type(), value)),
2128
+ datatype: $convertToMaybe(($convertToIri))(parameters?.datatype).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.datatype.type(), value)),
2129
+ deactivated: $convertToMaybe($identityConversionFunction)(parameters?.deactivated).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.deactivated.type(), value)),
2130
+ discriminantValue: $convertToMaybe($identityConversionFunction)(parameters?.discriminantValue).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.discriminantValue.type(), value)),
2131
+ extern: $convertToMaybe($identityConversionFunction)(parameters?.extern).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.extern.type(), value)),
2132
+ flags: $convertToArray($identityConversionFunction, true)(parameters?.flags).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.flags.type(), value)),
2133
+ fromRdfType: $convertToMaybe(($convertToIri))(parameters?.fromRdfType).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.fromRdfType.type(), value)),
2134
+ hasValues: $convertToArray($identityConversionFunction, true)(parameters?.hasValues).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.hasValues.type(), value)),
2135
+ ignoredProperties: $convertToMaybe($convertToArray(($convertToIri), true))(parameters?.ignoredProperties).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(NodeShape.schema.properties.ignoredProperties.type(), value)),
2136
+ in_: $convertToMaybe($convertToArray($identityConversionFunction, true))(parameters?.in_).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.in_.type(), value)),
2137
+ isDefinedBy: $convertToMaybe($convertToIdentifier)(parameters?.isDefinedBy).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.isDefinedBy.type(), value)),
2138
+ label: $convertToMaybe($identityConversionFunction)(parameters?.label).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.label.type(), value)),
2139
+ languageIn: $convertToMaybe($convertToArray($identityConversionFunction, true))(parameters?.languageIn).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.languageIn.type(), value)),
2140
+ maxCount: $convertToMaybe($identityConversionFunction)(parameters?.maxCount).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxCount.type(), value)),
2141
+ maxExclusive: $convertToMaybe($convertToLiteral)(parameters?.maxExclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxExclusive.type(), value)),
2142
+ maxInclusive: $convertToMaybe($convertToLiteral)(parameters?.maxInclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxInclusive.type(), value)),
2143
+ maxLength: $convertToMaybe($identityConversionFunction)(parameters?.maxLength).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxLength.type(), value)),
2144
+ minCount: $convertToMaybe($identityConversionFunction)(parameters?.minCount).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minCount.type(), value)),
2145
+ minExclusive: $convertToMaybe($convertToLiteral)(parameters?.minExclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minExclusive.type(), value)),
2146
+ minInclusive: $convertToMaybe($convertToLiteral)(parameters?.minInclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minInclusive.type(), value)),
2147
+ minLength: $convertToMaybe($identityConversionFunction)(parameters?.minLength).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minLength.type(), value)),
2148
+ mutable: $convertToMaybe($identityConversionFunction)(parameters?.mutable).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.mutable.type(), value)),
2149
+ node: $convertToMaybe($convertToIdentifier)(parameters?.node).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.node.type(), value)),
2150
+ nodeKind: $convertToMaybe(($convertToIri))(parameters?.nodeKind).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.nodeKind.type(), value)),
2151
+ not: $convertToArray($convertToIdentifier, true)(parameters?.not).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.not.type(), value)),
2152
+ or: $convertToMaybe($convertToArray($convertToIdentifier, true))(parameters?.or).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.or.type(), value)),
2153
+ patterns: $convertToArray($identityConversionFunction, true)(parameters?.patterns).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.patterns.type(), value)),
2154
+ properties: $convertToArray($convertToIdentifier, true)(parameters?.properties).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.properties.type(), value)),
2155
+ rdfType: $convertToMaybe(($convertToIri))(parameters?.rdfType).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.rdfType.type(), value)),
2156
+ shaclmateName: $convertToMaybe($identityConversionFunction)(parameters?.shaclmateName).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.shaclmateName.type(), value)),
2157
+ subClassOf: $convertToArray(($convertToIri), true)(parameters?.subClassOf).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.subClassOf.type(), value)),
2158
+ toRdfTypes: $convertToArray(($convertToIri), true)(parameters?.toRdfTypes).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.toRdfTypes.type(), value)),
2159
+ tsImports: $convertToArray($identityConversionFunction, true)(parameters?.tsImports).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.tsImports.type(), value)),
2160
+ types: $convertToArray(($convertToIri), true)(parameters?.types).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.types.type(), value)),
2161
+ xone: $convertToMaybe($convertToArray($convertToIdentifier, true))(parameters?.xone).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.xone.type(), value)),
2165
2162
  }).map((properties) => {
2166
2163
  const finalObject = { ...properties, $type: "NodeShape" };
2167
2164
  if (!globalThis.Object.prototype.hasOwnProperty.call(finalObject, "toString")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "@shaclmate/shacl-ast": "4.0.34",
3
+ "@shaclmate/shacl-ast": "4.0.35",
4
4
  "@rdfjs/dataset": "~2.0.2",
5
5
  "@rdfjs/prefix-map": "~0.1.2",
6
6
  "@rdfjs/term-map": "~2.0.2",
@@ -68,5 +68,5 @@
68
68
  },
69
69
  "type": "module",
70
70
  "types": "./dist/index.d.ts",
71
- "version": "4.0.34"
71
+ "version": "4.0.35"
72
72
  }
@@ -1,3 +0,0 @@
1
- import type { SnippetFactory } from "../SnippetFactory.js";
2
- export declare const snippets_convertToBigDecimal: SnippetFactory;
3
- //# sourceMappingURL=snippets_convertToBigDecimal.d.ts.map
@@ -1,6 +0,0 @@
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
@@ -1,3 +0,0 @@
1
- import type { SnippetFactory } from "../SnippetFactory.js";
2
- export declare const snippets_convertToBoolean: SnippetFactory;
3
- //# sourceMappingURL=snippets_convertToBoolean.d.ts.map
@@ -1,6 +0,0 @@
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
@@ -1,3 +0,0 @@
1
- import type { SnippetFactory } from "../SnippetFactory.js";
2
- export declare const snippets_convertToDate: SnippetFactory;
3
- //# sourceMappingURL=snippets_convertToDate.d.ts.map
@@ -1,6 +0,0 @@
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
@@ -1,3 +0,0 @@
1
- import type { SnippetFactory } from "../SnippetFactory.js";
2
- export declare const snippets_convertToDateTime: SnippetFactory;
3
- //# sourceMappingURL=snippets_convertToDateTime.d.ts.map
@@ -1,6 +0,0 @@
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
@@ -1,3 +0,0 @@
1
- import type { SnippetFactory } from "../SnippetFactory.js";
2
- export declare const snippets_convertToMutableArray: SnippetFactory;
3
- //# sourceMappingURL=snippets_convertToMutableArray.d.ts.map
@@ -1,14 +0,0 @@
1
- import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
- export const snippets_convertToMutableArray = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToMutableArray`, code `\
3
- function ${syntheticNamePrefix}convertToMutableArray<ItemSchemaT, ItemSourceT, ItemTargetT>(convertToItem: (schema: ItemSchemaT, value: ItemSourceT) => ${imports.Either}<Error, ItemTargetT>) {
4
- return (schema: ${snippets.CollectionSchema}<ItemSchemaT>, value: readonly ItemSourceT[] | undefined): ${imports.Either}<Error, ItemTargetT[]> => {
5
- return (typeof value === "undefined" ? ${imports.Either}.of<Error, ItemTargetT[]>([]) : ${imports.Either}.sequence(value.map(item => convertToItem(schema.item(), item))))
6
- .chain(array => {
7
- if (schema.minCount !== undefined && array.length < schema.minCount) {
8
- return ${imports.Left}(new Error(\`array has length (\${array.length}) less than minCount (\${schema.minCount})\`));
9
- }
10
- return ${imports.Either}.of(array);
11
- });
12
- }
13
- }`);
14
- //# sourceMappingURL=snippets_convertToMutableArray.js.map
@@ -1,3 +0,0 @@
1
- import type { SnippetFactory } from "../SnippetFactory.js";
2
- export declare const snippets_convertToNumeric: SnippetFactory;
3
- //# sourceMappingURL=snippets_convertToNumeric.d.ts.map
@@ -1,6 +0,0 @@
1
- import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
- export const snippets_convertToNumeric = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToNumeric`, code `\
3
- function ${syntheticNamePrefix}convertToNumeric<ValueT extends bigint | number>(_schema: ${snippets.NumericSchema}<ValueT>, value: ValueT): ${imports.Either}<Error, ValueT> {
4
- return ${imports.Either}.of(value);
5
- }`);
6
- //# sourceMappingURL=snippets_convertToNumeric.js.map
@@ -1,3 +0,0 @@
1
- import type { SnippetFactory } from "../SnippetFactory.js";
2
- export declare const snippets_convertToObject: SnippetFactory;
3
- //# sourceMappingURL=snippets_convertToObject.d.ts.map
@@ -1,6 +0,0 @@
1
- import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
- export const snippets_convertToObject = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToObject`, code `\
3
- function ${syntheticNamePrefix}convertToObject<ValueT extends object>(_schema: unknown, value: ValueT): ${imports.Either}<Error, ValueT> {
4
- return ${imports.Either}.of(value);
5
- }`);
6
- //# sourceMappingURL=snippets_convertToObject.js.map
@@ -1,3 +0,0 @@
1
- import type { SnippetFactory } from "../SnippetFactory.js";
2
- export declare const snippets_convertToReadonlyArray: SnippetFactory;
3
- //# sourceMappingURL=snippets_convertToReadonlyArray.d.ts.map
@@ -1,14 +0,0 @@
1
- import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
- export const snippets_convertToReadonlyArray = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToReadonlyArray`, code `\
3
- function ${syntheticNamePrefix}convertToReadonlyArray<ItemSchemaT, ItemSourceT, ItemTargetT>(convertToItem: (schema: ItemSchemaT, value: ItemSourceT) => ${imports.Either}<Error, ItemTargetT>) {
4
- return (schema: ${snippets.CollectionSchema}<ItemSchemaT>, value: readonly ItemSourceT[] | undefined): ${imports.Either}<Error, readonly ItemTargetT[]> => {
5
- return (typeof value === "undefined" ? ${imports.Either}.of<Error, readonly ItemTargetT[]>([]) : ${imports.Either}.sequence(value.map(item => convertToItem(schema.item(), item))))
6
- .chain(array => {
7
- if (schema.minCount !== undefined && array.length < schema.minCount) {
8
- return ${imports.Left}(new Error(\`array has length (\${array.length}) less than minCount (\${schema.minCount})\`));
9
- }
10
- return ${imports.Either}.of(array);
11
- });
12
- }
13
- }`);
14
- //# sourceMappingURL=snippets_convertToReadonlyArray.js.map
@@ -1,3 +0,0 @@
1
- import type { SnippetFactory } from "../SnippetFactory.js";
2
- export declare const snippets_convertToString: SnippetFactory;
3
- //# sourceMappingURL=snippets_convertToString.d.ts.map
@@ -1,6 +0,0 @@
1
- import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
- export const snippets_convertToString = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToString`, code `\
3
- function ${syntheticNamePrefix}convertToString<ValueT extends string>(_schema: ${snippets.StringSchema}, value: ValueT): ${imports.Either}<Error, ValueT> {
4
- return ${imports.Either}.of(value);
5
- }`);
6
- //# sourceMappingURL=snippets_convertToString.js.map
@@ -1,3 +0,0 @@
1
- import type { SnippetFactory } from "../SnippetFactory.js";
2
- export declare const snippets_convertToTerm: SnippetFactory;
3
- //# sourceMappingURL=snippets_convertToTerm.d.ts.map
@@ -1,6 +0,0 @@
1
- import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
- export const snippets_convertToTerm = ({ imports, snippets, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToTerm`, code `\
3
- function ${syntheticNamePrefix}convertToTerm<ValueT extends ${imports.BlankNode} | ${imports.Literal} | ${imports.NamedNode}>(_schema: ${snippets.TermSchema}, value: ValueT): ${imports.Either}<Error, ValueT> {
4
- return ${imports.Either}.of(value);
5
- }`);
6
- //# sourceMappingURL=snippets_convertToTerm.js.map
@@ -1,3 +0,0 @@
1
- import type { SnippetFactory } from "../SnippetFactory.js";
2
- export declare const snippets_convertToUnion: SnippetFactory;
3
- //# sourceMappingURL=snippets_convertToUnion.d.ts.map
@@ -1,6 +0,0 @@
1
- import { code, conditionalOutput } from "../ts-poet-wrapper.js";
2
- export const snippets_convertToUnion = ({ imports, syntheticNamePrefix, }) => conditionalOutput(`${syntheticNamePrefix}convertToUnion`, code `\
3
- function ${syntheticNamePrefix}convertToUnion<ValueT>(_schema: unknown, value: ValueT): ${imports.Either}<Error, ValueT> {
4
- return ${imports.Either}.of(value);
5
- }`);
6
- //# sourceMappingURL=snippets_convertToUnion.js.map