@shaclmate/shacl-ast 4.0.33 → 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.
package/dist/generated.js CHANGED
@@ -15,6 +15,71 @@ function $compactRecord(record) {
15
15
  return definedProperties;
16
16
  }, {});
17
17
  }
18
+ function $convertToArray(convertToItem, _readonly) {
19
+ return (value) => (typeof value === "undefined"
20
+ ? Either.of([])
21
+ : Either.sequence(value.map(convertToItem)));
22
+ }
23
+ function $convertToIdentifier(value) {
24
+ switch (typeof value) {
25
+ case "object":
26
+ return Either.of(value);
27
+ case "string":
28
+ return Either.of(dataFactory.namedNode(value));
29
+ case "undefined":
30
+ return Either.of(dataFactory.blankNode());
31
+ }
32
+ }
33
+ function $convertToIdentifierProperty(identifier) {
34
+ switch (typeof identifier) {
35
+ case "function":
36
+ return Either.of(identifier);
37
+ case "object": {
38
+ const captureIdentifier = identifier;
39
+ return Either.of(() => captureIdentifier);
40
+ }
41
+ case "string": {
42
+ const captureIdentifier = dataFactory.namedNode(identifier);
43
+ return Either.of(() => captureIdentifier);
44
+ }
45
+ case "undefined": {
46
+ const captureIdentifier = dataFactory.blankNode();
47
+ return Either.of(() => captureIdentifier);
48
+ }
49
+ }
50
+ }
51
+ function $convertToIri(value) {
52
+ switch (typeof value) {
53
+ case "object":
54
+ return Either.of(value);
55
+ case "string":
56
+ return Either.of(dataFactory.namedNode(value));
57
+ }
58
+ }
59
+ function $convertToLiteral(value) {
60
+ if (typeof value === "object") {
61
+ if (value instanceof Date) {
62
+ return Either.of($literalFactory.date(value));
63
+ }
64
+ return Either.of(value);
65
+ }
66
+ return Either.of($literalFactory.primitive(value));
67
+ }
68
+ function $convertToMaybe(convertToItem) {
69
+ return (value) => {
70
+ switch (typeof value) {
71
+ case "object": {
72
+ if (Maybe.isMaybe(value)) {
73
+ return Either.of(value);
74
+ }
75
+ break;
76
+ }
77
+ case "undefined":
78
+ return Either.of(Maybe.empty());
79
+ }
80
+ return convertToItem(value).map(Maybe.of);
81
+ };
82
+ }
18
83
  function $filterArray(filterItem) {
19
84
  return (filter, values) => {
20
85
  for (const value of values) {
@@ -172,20 +237,11 @@ class $IdentifierSet {
172
237
  }
173
238
  }
174
239
  }
175
- function $isReadonlyBigIntArray(x) {
176
- return Array.isArray(x) && x.every((z) => typeof z === "bigint");
177
- }
178
- function $isReadonlyBooleanArray(x) {
179
- return Array.isArray(x) && x.every((z) => typeof z === "boolean");
180
- }
181
- function $isReadonlyNumberArray(x) {
182
- return Array.isArray(x) && x.every((z) => typeof z === "number");
183
- }
184
- function $isReadonlyObjectArray(x) {
185
- return Array.isArray(x) && x.every((z) => typeof z === "object");
240
+ function $identityConversionFunction(value) {
241
+ return Either.of(value);
186
242
  }
187
- function $isReadonlyStringArray(x) {
188
- return Array.isArray(x) && x.every((z) => typeof z === "string");
243
+ function $identityValidationFunction(_schema, value) {
244
+ return Either.of(value);
189
245
  }
190
246
  const $literalFactory = new LiteralFactory({ dataFactory: dataFactory });
191
247
  const $parseIdentifier = NTriplesIdentifier.parser(dataFactory);
@@ -255,6 +311,19 @@ function $sequenceRecord(record) {
255
311
  function $shaclPropertyFromRdf({ graph, propertySchema, resource, typeFromRdf, }) {
256
312
  return typeFromRdf(Right(resource.values(propertySchema.path, { graph, unique: true }))).chain((values) => values.head());
257
313
  }
314
+ function $validateArray(validateItem, _readonly) {
315
+ return (schema, valueArray) => {
316
+ if (schema.minCount !== undefined && valueArray.length < schema.minCount) {
317
+ return Left(new Error(`value array has length (${valueArray.length}) less than minCount (${schema.minCount})`));
318
+ }
319
+ return Either.sequence(valueArray.map((value) => validateItem(schema.item(), value)));
320
+ };
321
+ }
322
+ function $validateMaybe(validateItem) {
323
+ return (schema, valueMaybe) => valueMaybe
324
+ .map((value) => validateItem(schema.item(), value).map(() => valueMaybe))
325
+ .orDefault(Either.of(valueMaybe));
326
+ }
258
327
  function $wrap_FromRdfResourceFunction(_fromRdfResourceFunction) {
259
328
  return (resource, options) => {
260
329
  let { context, graph, ignoreRdfType = false, objectSet, preferredLanguages, } = options ?? {};
@@ -293,599 +362,53 @@ function $wrap_ToRdfResourceFunction(_toRdfResourceFunction) {
293
362
  export var PropertyShape;
294
363
  (function (PropertyShape) {
295
364
  function create(parameters) {
296
- const $identifierParameter = parameters.$identifier;
297
- let $identifier;
298
- if (typeof $identifierParameter === "function") {
299
- $identifier = $identifierParameter;
300
- }
301
- else if (typeof $identifierParameter === "object") {
302
- $identifier = () => $identifierParameter;
303
- }
304
- else if (typeof $identifierParameter === "string") {
305
- $identifier = () => dataFactory.namedNode($identifierParameter);
306
- }
307
- else if ($identifierParameter === undefined) {
308
- const $eagerIdentifier = dataFactory.blankNode();
309
- $identifier = () => $eagerIdentifier;
310
- }
311
- else {
312
- $identifier = $identifierParameter;
313
- }
314
- const $type = "PropertyShape";
315
- let and;
316
- if (Maybe.isMaybe(parameters.and)) {
317
- and = parameters.and;
318
- }
319
- else if ($isReadonlyObjectArray(parameters.and)) {
320
- and = Maybe.of(parameters.and);
321
- }
322
- else if ($isReadonlyStringArray(parameters.and)) {
323
- and = Maybe.of(parameters.and.map((item) => dataFactory.namedNode(item)));
324
- }
325
- else if (parameters.and === undefined) {
326
- and = Maybe.empty();
327
- }
328
- else {
329
- and = parameters.and;
330
- }
331
- let classes;
332
- if (parameters.classes === undefined) {
333
- classes = [];
334
- }
335
- else if ($isReadonlyObjectArray(parameters.classes)) {
336
- classes = parameters.classes;
337
- }
338
- else if ($isReadonlyStringArray(parameters.classes)) {
339
- classes = parameters.classes.map((item) => dataFactory.namedNode(item));
340
- }
341
- else {
342
- classes = parameters.classes;
343
- }
344
- let comment;
345
- if (Maybe.isMaybe(parameters.comment)) {
346
- comment = parameters.comment;
347
- }
348
- else if (typeof parameters.comment === "string") {
349
- comment = Maybe.of(parameters.comment);
350
- }
351
- else if (parameters.comment === undefined) {
352
- comment = Maybe.empty();
353
- }
354
- else {
355
- comment = parameters.comment;
356
- }
357
- let datatype;
358
- if (Maybe.isMaybe(parameters.datatype)) {
359
- datatype = parameters.datatype;
360
- }
361
- else if (typeof parameters.datatype === "object") {
362
- datatype = Maybe.of(parameters.datatype);
363
- }
364
- else if (typeof parameters.datatype === "string") {
365
- datatype = Maybe.of(dataFactory.namedNode(parameters.datatype));
366
- }
367
- else if (parameters.datatype === undefined) {
368
- datatype = Maybe.empty();
369
- }
370
- else {
371
- datatype = parameters.datatype;
372
- }
373
- let deactivated;
374
- if (Maybe.isMaybe(parameters.deactivated)) {
375
- deactivated = parameters.deactivated;
376
- }
377
- else if (typeof parameters.deactivated === "boolean") {
378
- deactivated = Maybe.of(parameters.deactivated);
379
- }
380
- else if (parameters.deactivated === undefined) {
381
- deactivated = Maybe.empty();
382
- }
383
- else {
384
- deactivated = parameters.deactivated;
385
- }
386
- let defaultValue;
387
- if (Maybe.isMaybe(parameters.defaultValue)) {
388
- defaultValue = parameters.defaultValue;
389
- }
390
- else if (typeof parameters.defaultValue === "bigint") {
391
- defaultValue = Maybe.of($literalFactory.bigint(parameters.defaultValue));
392
- }
393
- else if (typeof parameters.defaultValue === "boolean") {
394
- defaultValue = Maybe.of($literalFactory.boolean(parameters.defaultValue));
395
- }
396
- else if (typeof parameters.defaultValue === "object" &&
397
- parameters.defaultValue instanceof Date) {
398
- defaultValue = Maybe.of($literalFactory.date(parameters.defaultValue));
399
- }
400
- else if (typeof parameters.defaultValue === "number") {
401
- defaultValue = Maybe.of($literalFactory.number(parameters.defaultValue));
402
- }
403
- else if (typeof parameters.defaultValue === "string") {
404
- defaultValue = Maybe.of($literalFactory.string(parameters.defaultValue));
405
- }
406
- else if (typeof parameters.defaultValue === "object") {
407
- defaultValue = Maybe.of(parameters.defaultValue);
408
- }
409
- else if (parameters.defaultValue === undefined) {
410
- defaultValue = Maybe.empty();
411
- }
412
- else {
413
- defaultValue = parameters.defaultValue;
414
- }
415
- let description;
416
- if (Maybe.isMaybe(parameters.description)) {
417
- description = parameters.description;
418
- }
419
- else if (typeof parameters.description === "string") {
420
- description = Maybe.of(parameters.description);
421
- }
422
- else if (parameters.description === undefined) {
423
- description = Maybe.empty();
424
- }
425
- else {
426
- description = parameters.description;
427
- }
428
- let flags;
429
- if (parameters.flags === undefined) {
430
- flags = [];
431
- }
432
- else if (typeof parameters.flags === "object") {
433
- flags = parameters.flags;
434
- }
435
- else {
436
- flags = parameters.flags;
437
- }
438
- let groups;
439
- if (parameters.groups === undefined) {
440
- groups = [];
441
- }
442
- else if ($isReadonlyObjectArray(parameters.groups)) {
443
- groups = parameters.groups;
444
- }
445
- else if ($isReadonlyStringArray(parameters.groups)) {
446
- groups = parameters.groups.map((item) => dataFactory.namedNode(item));
447
- }
448
- else {
449
- groups = parameters.groups;
450
- }
451
- let hasValues;
452
- if (parameters.hasValues === undefined) {
453
- hasValues = [];
454
- }
455
- else if ($isReadonlyObjectArray(parameters.hasValues)) {
456
- hasValues = parameters.hasValues;
457
- }
458
- else if ($isReadonlyBigIntArray(parameters.hasValues)) {
459
- hasValues = parameters.hasValues.map((item) => $literalFactory.bigint(item));
460
- }
461
- else if ($isReadonlyBooleanArray(parameters.hasValues)) {
462
- hasValues = parameters.hasValues.map((item) => $literalFactory.boolean(item));
463
- }
464
- else if ($isReadonlyNumberArray(parameters.hasValues)) {
465
- hasValues = parameters.hasValues.map((item) => $literalFactory.number(item));
466
- }
467
- else if ($isReadonlyStringArray(parameters.hasValues)) {
468
- hasValues = parameters.hasValues.map((item) => $literalFactory.string(item));
469
- }
470
- else {
471
- hasValues = parameters.hasValues;
472
- }
473
- let in_;
474
- if (Maybe.isMaybe(parameters.in_)) {
475
- in_ = parameters.in_;
476
- }
477
- else if ($isReadonlyObjectArray(parameters.in_)) {
478
- in_ = Maybe.of(parameters.in_);
479
- }
480
- else if ($isReadonlyBigIntArray(parameters.in_)) {
481
- in_ = Maybe.of(parameters.in_.map((item) => $literalFactory.bigint(item)));
482
- }
483
- else if ($isReadonlyBooleanArray(parameters.in_)) {
484
- in_ = Maybe.of(parameters.in_.map((item) => $literalFactory.boolean(item)));
485
- }
486
- else if ($isReadonlyNumberArray(parameters.in_)) {
487
- in_ = Maybe.of(parameters.in_.map((item) => $literalFactory.number(item)));
488
- }
489
- else if ($isReadonlyStringArray(parameters.in_)) {
490
- in_ = Maybe.of(parameters.in_.map((item) => $literalFactory.string(item)));
491
- }
492
- else if (parameters.in_ === undefined) {
493
- in_ = Maybe.empty();
494
- }
495
- else {
496
- in_ = parameters.in_;
497
- }
498
- let isDefinedBy;
499
- if (Maybe.isMaybe(parameters.isDefinedBy)) {
500
- isDefinedBy = parameters.isDefinedBy;
501
- }
502
- else if (typeof parameters.isDefinedBy === "object") {
503
- isDefinedBy = Maybe.of(parameters.isDefinedBy);
504
- }
505
- else if (typeof parameters.isDefinedBy === "string") {
506
- isDefinedBy = Maybe.of(dataFactory.namedNode(parameters.isDefinedBy));
507
- }
508
- else if (parameters.isDefinedBy === undefined) {
509
- isDefinedBy = Maybe.empty();
510
- }
511
- else {
512
- isDefinedBy = parameters.isDefinedBy;
513
- }
514
- let label;
515
- if (Maybe.isMaybe(parameters.label)) {
516
- label = parameters.label;
517
- }
518
- else if (typeof parameters.label === "string") {
519
- label = Maybe.of(parameters.label);
520
- }
521
- else if (parameters.label === undefined) {
522
- label = Maybe.empty();
523
- }
524
- else {
525
- label = parameters.label;
526
- }
527
- let languageIn;
528
- if (Maybe.isMaybe(parameters.languageIn)) {
529
- languageIn = parameters.languageIn;
530
- }
531
- else if (typeof parameters.languageIn === "object") {
532
- languageIn = Maybe.of(parameters.languageIn);
533
- }
534
- else if (parameters.languageIn === undefined) {
535
- languageIn = Maybe.empty();
536
- }
537
- else {
538
- languageIn = parameters.languageIn;
539
- }
540
- let maxCount;
541
- if (Maybe.isMaybe(parameters.maxCount)) {
542
- maxCount = parameters.maxCount;
543
- }
544
- else if (typeof parameters.maxCount === "bigint") {
545
- maxCount = Maybe.of(parameters.maxCount);
546
- }
547
- else if (typeof parameters.maxCount === "number") {
548
- maxCount = Maybe.of(BigInt(parameters.maxCount));
549
- }
550
- else if (parameters.maxCount === undefined) {
551
- maxCount = Maybe.empty();
552
- }
553
- else {
554
- maxCount = parameters.maxCount;
555
- }
556
- let maxExclusive;
557
- if (Maybe.isMaybe(parameters.maxExclusive)) {
558
- maxExclusive = parameters.maxExclusive;
559
- }
560
- else if (typeof parameters.maxExclusive === "bigint") {
561
- maxExclusive = Maybe.of($literalFactory.bigint(parameters.maxExclusive));
562
- }
563
- else if (typeof parameters.maxExclusive === "boolean") {
564
- maxExclusive = Maybe.of($literalFactory.boolean(parameters.maxExclusive));
565
- }
566
- else if (typeof parameters.maxExclusive === "object" &&
567
- parameters.maxExclusive instanceof Date) {
568
- maxExclusive = Maybe.of($literalFactory.date(parameters.maxExclusive));
569
- }
570
- else if (typeof parameters.maxExclusive === "number") {
571
- maxExclusive = Maybe.of($literalFactory.number(parameters.maxExclusive));
572
- }
573
- else if (typeof parameters.maxExclusive === "string") {
574
- maxExclusive = Maybe.of($literalFactory.string(parameters.maxExclusive));
575
- }
576
- else if (typeof parameters.maxExclusive === "object") {
577
- maxExclusive = Maybe.of(parameters.maxExclusive);
578
- }
579
- else if (parameters.maxExclusive === undefined) {
580
- maxExclusive = Maybe.empty();
581
- }
582
- else {
583
- maxExclusive = parameters.maxExclusive;
584
- }
585
- let maxInclusive;
586
- if (Maybe.isMaybe(parameters.maxInclusive)) {
587
- maxInclusive = parameters.maxInclusive;
588
- }
589
- else if (typeof parameters.maxInclusive === "bigint") {
590
- maxInclusive = Maybe.of($literalFactory.bigint(parameters.maxInclusive));
591
- }
592
- else if (typeof parameters.maxInclusive === "boolean") {
593
- maxInclusive = Maybe.of($literalFactory.boolean(parameters.maxInclusive));
594
- }
595
- else if (typeof parameters.maxInclusive === "object" &&
596
- parameters.maxInclusive instanceof Date) {
597
- maxInclusive = Maybe.of($literalFactory.date(parameters.maxInclusive));
598
- }
599
- else if (typeof parameters.maxInclusive === "number") {
600
- maxInclusive = Maybe.of($literalFactory.number(parameters.maxInclusive));
601
- }
602
- else if (typeof parameters.maxInclusive === "string") {
603
- maxInclusive = Maybe.of($literalFactory.string(parameters.maxInclusive));
604
- }
605
- else if (typeof parameters.maxInclusive === "object") {
606
- maxInclusive = Maybe.of(parameters.maxInclusive);
607
- }
608
- else if (parameters.maxInclusive === undefined) {
609
- maxInclusive = Maybe.empty();
610
- }
611
- else {
612
- maxInclusive = parameters.maxInclusive;
613
- }
614
- let maxLength;
615
- if (Maybe.isMaybe(parameters.maxLength)) {
616
- maxLength = parameters.maxLength;
617
- }
618
- else if (typeof parameters.maxLength === "bigint") {
619
- maxLength = Maybe.of(parameters.maxLength);
620
- }
621
- else if (typeof parameters.maxLength === "number") {
622
- maxLength = Maybe.of(BigInt(parameters.maxLength));
623
- }
624
- else if (parameters.maxLength === undefined) {
625
- maxLength = Maybe.empty();
626
- }
627
- else {
628
- maxLength = parameters.maxLength;
629
- }
630
- let minCount;
631
- if (Maybe.isMaybe(parameters.minCount)) {
632
- minCount = parameters.minCount;
633
- }
634
- else if (typeof parameters.minCount === "bigint") {
635
- minCount = Maybe.of(parameters.minCount);
636
- }
637
- else if (typeof parameters.minCount === "number") {
638
- minCount = Maybe.of(BigInt(parameters.minCount));
639
- }
640
- else if (parameters.minCount === undefined) {
641
- minCount = Maybe.empty();
642
- }
643
- else {
644
- minCount = parameters.minCount;
645
- }
646
- let minExclusive;
647
- if (Maybe.isMaybe(parameters.minExclusive)) {
648
- minExclusive = parameters.minExclusive;
649
- }
650
- else if (typeof parameters.minExclusive === "bigint") {
651
- minExclusive = Maybe.of($literalFactory.bigint(parameters.minExclusive));
652
- }
653
- else if (typeof parameters.minExclusive === "boolean") {
654
- minExclusive = Maybe.of($literalFactory.boolean(parameters.minExclusive));
655
- }
656
- else if (typeof parameters.minExclusive === "object" &&
657
- parameters.minExclusive instanceof Date) {
658
- minExclusive = Maybe.of($literalFactory.date(parameters.minExclusive));
659
- }
660
- else if (typeof parameters.minExclusive === "number") {
661
- minExclusive = Maybe.of($literalFactory.number(parameters.minExclusive));
662
- }
663
- else if (typeof parameters.minExclusive === "string") {
664
- minExclusive = Maybe.of($literalFactory.string(parameters.minExclusive));
665
- }
666
- else if (typeof parameters.minExclusive === "object") {
667
- minExclusive = Maybe.of(parameters.minExclusive);
668
- }
669
- else if (parameters.minExclusive === undefined) {
670
- minExclusive = Maybe.empty();
671
- }
672
- else {
673
- minExclusive = parameters.minExclusive;
674
- }
675
- let minInclusive;
676
- if (Maybe.isMaybe(parameters.minInclusive)) {
677
- minInclusive = parameters.minInclusive;
678
- }
679
- else if (typeof parameters.minInclusive === "bigint") {
680
- minInclusive = Maybe.of($literalFactory.bigint(parameters.minInclusive));
681
- }
682
- else if (typeof parameters.minInclusive === "boolean") {
683
- minInclusive = Maybe.of($literalFactory.boolean(parameters.minInclusive));
684
- }
685
- else if (typeof parameters.minInclusive === "object" &&
686
- parameters.minInclusive instanceof Date) {
687
- minInclusive = Maybe.of($literalFactory.date(parameters.minInclusive));
688
- }
689
- else if (typeof parameters.minInclusive === "number") {
690
- minInclusive = Maybe.of($literalFactory.number(parameters.minInclusive));
691
- }
692
- else if (typeof parameters.minInclusive === "string") {
693
- minInclusive = Maybe.of($literalFactory.string(parameters.minInclusive));
694
- }
695
- else if (typeof parameters.minInclusive === "object") {
696
- minInclusive = Maybe.of(parameters.minInclusive);
697
- }
698
- else if (parameters.minInclusive === undefined) {
699
- minInclusive = Maybe.empty();
700
- }
701
- else {
702
- minInclusive = parameters.minInclusive;
703
- }
704
- let minLength;
705
- if (Maybe.isMaybe(parameters.minLength)) {
706
- minLength = parameters.minLength;
707
- }
708
- else if (typeof parameters.minLength === "bigint") {
709
- minLength = Maybe.of(parameters.minLength);
710
- }
711
- else if (typeof parameters.minLength === "number") {
712
- minLength = Maybe.of(BigInt(parameters.minLength));
713
- }
714
- else if (parameters.minLength === undefined) {
715
- minLength = Maybe.empty();
716
- }
717
- else {
718
- minLength = parameters.minLength;
719
- }
720
- let name;
721
- if (Maybe.isMaybe(parameters.name)) {
722
- name = parameters.name;
723
- }
724
- else if (typeof parameters.name === "string") {
725
- name = Maybe.of(parameters.name);
726
- }
727
- else if (parameters.name === undefined) {
728
- name = Maybe.empty();
729
- }
730
- else {
731
- name = parameters.name;
732
- }
733
- let node;
734
- if (Maybe.isMaybe(parameters.node)) {
735
- node = parameters.node;
736
- }
737
- else if (typeof parameters.node === "object") {
738
- node = Maybe.of(parameters.node);
739
- }
740
- else if (typeof parameters.node === "string") {
741
- node = Maybe.of(dataFactory.namedNode(parameters.node));
742
- }
743
- else if (parameters.node === undefined) {
744
- node = Maybe.empty();
745
- }
746
- else {
747
- node = parameters.node;
748
- }
749
- let nodeKind;
750
- if (Maybe.isMaybe(parameters.nodeKind)) {
751
- nodeKind = parameters.nodeKind;
752
- }
753
- else if (typeof parameters.nodeKind === "object") {
754
- nodeKind = Maybe.of(parameters.nodeKind);
755
- }
756
- else if (typeof parameters.nodeKind === "string") {
757
- nodeKind = Maybe.of(dataFactory.namedNode(parameters.nodeKind));
758
- }
759
- else if (parameters.nodeKind === undefined) {
760
- nodeKind = Maybe.empty();
761
- }
762
- else {
763
- nodeKind = parameters.nodeKind;
764
- }
765
- let not;
766
- if (parameters.not === undefined) {
767
- not = [];
768
- }
769
- else if ($isReadonlyObjectArray(parameters.not)) {
770
- not = parameters.not;
771
- }
772
- else if ($isReadonlyStringArray(parameters.not)) {
773
- not = parameters.not.map((item) => dataFactory.namedNode(item));
774
- }
775
- else {
776
- not = parameters.not;
777
- }
778
- let or;
779
- if (Maybe.isMaybe(parameters.or)) {
780
- or = parameters.or;
781
- }
782
- else if ($isReadonlyObjectArray(parameters.or)) {
783
- or = Maybe.of(parameters.or);
784
- }
785
- else if ($isReadonlyStringArray(parameters.or)) {
786
- or = Maybe.of(parameters.or.map((item) => dataFactory.namedNode(item)));
787
- }
788
- else if (parameters.or === undefined) {
789
- or = Maybe.empty();
790
- }
791
- else {
792
- or = parameters.or;
793
- }
794
- let order;
795
- if (Maybe.isMaybe(parameters.order)) {
796
- order = parameters.order;
797
- }
798
- else if (typeof parameters.order === "number") {
799
- order = Maybe.of(parameters.order);
800
- }
801
- else if (parameters.order === undefined) {
802
- order = Maybe.empty();
803
- }
804
- else {
805
- order = parameters.order;
806
- }
807
- const path = parameters.path;
808
- let patterns;
809
- if (parameters.patterns === undefined) {
810
- patterns = [];
811
- }
812
- else if (typeof parameters.patterns === "object") {
813
- patterns = parameters.patterns;
814
- }
815
- else {
816
- patterns = parameters.patterns;
817
- }
818
- let uniqueLang;
819
- if (Maybe.isMaybe(parameters.uniqueLang)) {
820
- uniqueLang = parameters.uniqueLang;
821
- }
822
- else if (typeof parameters.uniqueLang === "boolean") {
823
- uniqueLang = Maybe.of(parameters.uniqueLang);
824
- }
825
- else if (parameters.uniqueLang === undefined) {
826
- uniqueLang = Maybe.empty();
827
- }
828
- else {
829
- uniqueLang = parameters.uniqueLang;
830
- }
831
- let xone;
832
- if (Maybe.isMaybe(parameters.xone)) {
833
- xone = parameters.xone;
834
- }
835
- else if ($isReadonlyObjectArray(parameters.xone)) {
836
- xone = Maybe.of(parameters.xone);
837
- }
838
- else if ($isReadonlyStringArray(parameters.xone)) {
839
- xone = Maybe.of(parameters.xone.map((item) => dataFactory.namedNode(item)));
840
- }
841
- else if (parameters.xone === undefined) {
842
- xone = Maybe.empty();
843
- }
844
- else {
845
- xone = parameters.xone;
846
- }
847
- const $object = {
848
- $identifier,
849
- $type,
850
- and,
851
- classes,
852
- comment,
853
- datatype,
854
- deactivated,
855
- defaultValue,
856
- description,
857
- flags,
858
- groups,
859
- hasValues,
860
- in_,
861
- isDefinedBy,
862
- label,
863
- languageIn,
864
- maxCount,
865
- maxExclusive,
866
- maxInclusive,
867
- maxLength,
868
- minCount,
869
- minExclusive,
870
- minInclusive,
871
- minLength,
872
- name,
873
- node,
874
- nodeKind,
875
- not,
876
- or,
877
- order,
878
- path,
879
- patterns,
880
- uniqueLang,
881
- xone,
882
- };
883
- if (!globalThis.Object.prototype.hasOwnProperty.call($object, "toString")) {
884
- $object.toString = $toString;
885
- }
886
- return $object;
365
+ return $sequenceRecord({
366
+ $identifier: $convertToIdentifierProperty(parameters.$identifier),
367
+ and: $convertToMaybe($convertToArray($convertToIdentifier, true))(parameters.and).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.and.type(), value)),
368
+ classes: $convertToArray(($convertToIri), true)(parameters.classes).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.classes.type(), value)),
369
+ comment: $convertToMaybe($identityConversionFunction)(parameters.comment).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.comment.type(), value)),
370
+ datatype: $convertToMaybe(($convertToIri))(parameters.datatype).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.datatype.type(), value)),
371
+ deactivated: $convertToMaybe($identityConversionFunction)(parameters.deactivated).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.deactivated.type(), value)),
372
+ defaultValue: $convertToMaybe($identityConversionFunction)(parameters.defaultValue).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.defaultValue.type(), value)),
373
+ description: $convertToMaybe($identityConversionFunction)(parameters.description).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.description.type(), value)),
374
+ flags: $convertToArray($identityConversionFunction, true)(parameters.flags).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.flags.type(), value)),
375
+ groups: $convertToArray($convertToIdentifier, true)(parameters.groups).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.groups.type(), value)),
376
+ hasValues: $convertToArray($identityConversionFunction, true)(parameters.hasValues).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.hasValues.type(), value)),
377
+ in_: $convertToMaybe($convertToArray($identityConversionFunction, true))(parameters.in_).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.in_.type(), value)),
378
+ isDefinedBy: $convertToMaybe($convertToIdentifier)(parameters.isDefinedBy).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.isDefinedBy.type(), value)),
379
+ label: $convertToMaybe($identityConversionFunction)(parameters.label).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.label.type(), value)),
380
+ languageIn: $convertToMaybe($convertToArray($identityConversionFunction, true))(parameters.languageIn).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.languageIn.type(), value)),
381
+ maxCount: $convertToMaybe($identityConversionFunction)(parameters.maxCount).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxCount.type(), value)),
382
+ maxExclusive: $convertToMaybe($convertToLiteral)(parameters.maxExclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxExclusive.type(), value)),
383
+ maxInclusive: $convertToMaybe($convertToLiteral)(parameters.maxInclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxInclusive.type(), value)),
384
+ maxLength: $convertToMaybe($identityConversionFunction)(parameters.maxLength).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxLength.type(), value)),
385
+ minCount: $convertToMaybe($identityConversionFunction)(parameters.minCount).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minCount.type(), value)),
386
+ minExclusive: $convertToMaybe($convertToLiteral)(parameters.minExclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minExclusive.type(), value)),
387
+ minInclusive: $convertToMaybe($convertToLiteral)(parameters.minInclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minInclusive.type(), value)),
388
+ minLength: $convertToMaybe($identityConversionFunction)(parameters.minLength).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minLength.type(), value)),
389
+ name: $convertToMaybe($identityConversionFunction)(parameters.name).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.name.type(), value)),
390
+ node: $convertToMaybe($convertToIdentifier)(parameters.node).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.node.type(), value)),
391
+ nodeKind: $convertToMaybe(($convertToIri))(parameters.nodeKind).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.nodeKind.type(), value)),
392
+ not: $convertToArray($convertToIdentifier, true)(parameters.not).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.not.type(), value)),
393
+ or: $convertToMaybe($convertToArray($convertToIdentifier, true))(parameters.or).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.or.type(), value)),
394
+ order: $convertToMaybe($identityConversionFunction)(parameters.order).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.order.type(), value)),
395
+ path: Either.of(parameters.path),
396
+ patterns: $convertToArray($identityConversionFunction, true)(parameters.patterns).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.patterns.type(), value)),
397
+ uniqueLang: $convertToMaybe($identityConversionFunction)(parameters.uniqueLang).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.uniqueLang.type(), value)),
398
+ xone: $convertToMaybe($convertToArray($convertToIdentifier, true))(parameters.xone).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.xone.type(), value)),
399
+ }).map((properties) => {
400
+ const finalObject = { ...properties, $type: "PropertyShape" };
401
+ if (!globalThis.Object.prototype.hasOwnProperty.call(finalObject, "toString")) {
402
+ finalObject.toString = $toString;
403
+ }
404
+ return finalObject;
405
+ });
887
406
  }
888
407
  PropertyShape.create = create;
408
+ function createUnsafe(parameters) {
409
+ return create(parameters).unsafeCoerce();
410
+ }
411
+ PropertyShape.createUnsafe = createUnsafe;
889
412
  let Identifier;
890
413
  (function (Identifier) {
891
414
  Identifier.parse = $parseIdentifier;
@@ -1585,7 +1108,7 @@ export var PropertyShape;
1585
1108
  value: Maybe.empty(),
1586
1109
  })),
1587
1110
  }),
1588
- }).map((properties) => create(properties)));
1111
+ }).chain((properties) => create(properties)));
1589
1112
  };
1590
1113
  PropertyShape.fromRdfResource = $wrap_FromRdfResourceFunction(PropertyShape._fromRdfResource);
1591
1114
  PropertyShape.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
@@ -2098,58 +1621,23 @@ export var PropertyShape;
2098
1621
  export var PropertyGroup;
2099
1622
  (function (PropertyGroup) {
2100
1623
  function create(parameters) {
2101
- const $identifierParameter = parameters?.$identifier;
2102
- let $identifier;
2103
- if (typeof $identifierParameter === "function") {
2104
- $identifier = $identifierParameter;
2105
- }
2106
- else if (typeof $identifierParameter === "object") {
2107
- $identifier = () => $identifierParameter;
2108
- }
2109
- else if (typeof $identifierParameter === "string") {
2110
- $identifier = () => dataFactory.namedNode($identifierParameter);
2111
- }
2112
- else if ($identifierParameter === undefined) {
2113
- const $eagerIdentifier = dataFactory.blankNode();
2114
- $identifier = () => $eagerIdentifier;
2115
- }
2116
- else {
2117
- $identifier = $identifierParameter;
2118
- }
2119
- const $type = "PropertyGroup";
2120
- let comment;
2121
- if (Maybe.isMaybe(parameters?.comment)) {
2122
- comment = parameters?.comment;
2123
- }
2124
- else if (typeof parameters?.comment === "string") {
2125
- comment = Maybe.of(parameters?.comment);
2126
- }
2127
- else if (parameters?.comment === undefined) {
2128
- comment = Maybe.empty();
2129
- }
2130
- else {
2131
- comment = parameters?.comment;
2132
- }
2133
- let label;
2134
- if (Maybe.isMaybe(parameters?.label)) {
2135
- label = parameters?.label;
2136
- }
2137
- else if (typeof parameters?.label === "string") {
2138
- label = Maybe.of(parameters?.label);
2139
- }
2140
- else if (parameters?.label === undefined) {
2141
- label = Maybe.empty();
2142
- }
2143
- else {
2144
- label = parameters?.label;
2145
- }
2146
- const $object = { $identifier, $type, comment, label };
2147
- if (!globalThis.Object.prototype.hasOwnProperty.call($object, "toString")) {
2148
- $object.toString = $toString;
2149
- }
2150
- return $object;
1624
+ return $sequenceRecord({
1625
+ $identifier: $convertToIdentifierProperty(parameters?.$identifier),
1626
+ comment: $convertToMaybe($identityConversionFunction)(parameters?.comment).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.comment.type(), value)),
1627
+ label: $convertToMaybe($identityConversionFunction)(parameters?.label).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.label.type(), value)),
1628
+ }).map((properties) => {
1629
+ const finalObject = { ...properties, $type: "PropertyGroup" };
1630
+ if (!globalThis.Object.prototype.hasOwnProperty.call(finalObject, "toString")) {
1631
+ finalObject.toString = $toString;
1632
+ }
1633
+ return finalObject;
1634
+ });
2151
1635
  }
2152
1636
  PropertyGroup.create = create;
1637
+ function createUnsafe(parameters) {
1638
+ return create(parameters).unsafeCoerce();
1639
+ }
1640
+ PropertyGroup.createUnsafe = createUnsafe;
2153
1641
  let Identifier;
2154
1642
  (function (Identifier) {
2155
1643
  Identifier.parse = $parseIdentifier;
@@ -2229,7 +1717,7 @@ export var PropertyGroup;
2229
1717
  value: Maybe.empty(),
2230
1718
  })),
2231
1719
  }),
2232
- }).map((properties) => create(properties)));
1720
+ }).chain((properties) => create(properties)));
2233
1721
  };
2234
1722
  PropertyGroup.fromRdfResource = $wrap_FromRdfResourceFunction(PropertyGroup._fromRdfResource);
2235
1723
  PropertyGroup.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
@@ -2304,58 +1792,23 @@ export var PropertyGroup;
2304
1792
  export var Ontology;
2305
1793
  (function (Ontology) {
2306
1794
  function create(parameters) {
2307
- const $identifierParameter = parameters?.$identifier;
2308
- let $identifier;
2309
- if (typeof $identifierParameter === "function") {
2310
- $identifier = $identifierParameter;
2311
- }
2312
- else if (typeof $identifierParameter === "object") {
2313
- $identifier = () => $identifierParameter;
2314
- }
2315
- else if (typeof $identifierParameter === "string") {
2316
- $identifier = () => dataFactory.namedNode($identifierParameter);
2317
- }
2318
- else if ($identifierParameter === undefined) {
2319
- const $eagerIdentifier = dataFactory.blankNode();
2320
- $identifier = () => $eagerIdentifier;
2321
- }
2322
- else {
2323
- $identifier = $identifierParameter;
2324
- }
2325
- const $type = "Ontology";
2326
- let comment;
2327
- if (Maybe.isMaybe(parameters?.comment)) {
2328
- comment = parameters?.comment;
2329
- }
2330
- else if (typeof parameters?.comment === "string") {
2331
- comment = Maybe.of(parameters?.comment);
2332
- }
2333
- else if (parameters?.comment === undefined) {
2334
- comment = Maybe.empty();
2335
- }
2336
- else {
2337
- comment = parameters?.comment;
2338
- }
2339
- let label;
2340
- if (Maybe.isMaybe(parameters?.label)) {
2341
- label = parameters?.label;
2342
- }
2343
- else if (typeof parameters?.label === "string") {
2344
- label = Maybe.of(parameters?.label);
2345
- }
2346
- else if (parameters?.label === undefined) {
2347
- label = Maybe.empty();
2348
- }
2349
- else {
2350
- label = parameters?.label;
2351
- }
2352
- const $object = { $identifier, $type, comment, label };
2353
- if (!globalThis.Object.prototype.hasOwnProperty.call($object, "toString")) {
2354
- $object.toString = $toString;
2355
- }
2356
- return $object;
1795
+ return $sequenceRecord({
1796
+ $identifier: $convertToIdentifierProperty(parameters?.$identifier),
1797
+ comment: $convertToMaybe($identityConversionFunction)(parameters?.comment).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.comment.type(), value)),
1798
+ label: $convertToMaybe($identityConversionFunction)(parameters?.label).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.label.type(), value)),
1799
+ }).map((properties) => {
1800
+ const finalObject = { ...properties, $type: "Ontology" };
1801
+ if (!globalThis.Object.prototype.hasOwnProperty.call(finalObject, "toString")) {
1802
+ finalObject.toString = $toString;
1803
+ }
1804
+ return finalObject;
1805
+ });
2357
1806
  }
2358
1807
  Ontology.create = create;
1808
+ function createUnsafe(parameters) {
1809
+ return create(parameters).unsafeCoerce();
1810
+ }
1811
+ Ontology.createUnsafe = createUnsafe;
2359
1812
  let Identifier;
2360
1813
  (function (Identifier) {
2361
1814
  Identifier.parse = $parseIdentifier;
@@ -2435,7 +1888,7 @@ export var Ontology;
2435
1888
  value: Maybe.empty(),
2436
1889
  })),
2437
1890
  }),
2438
- }).map((properties) => create(properties)));
1891
+ }).chain((properties) => create(properties)));
2439
1892
  };
2440
1893
  Ontology.fromRdfResource = $wrap_FromRdfResourceFunction(Ontology._fromRdfResource);
2441
1894
  Ontology.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value
@@ -2510,570 +1963,51 @@ export var Ontology;
2510
1963
  export var NodeShape;
2511
1964
  (function (NodeShape) {
2512
1965
  function create(parameters) {
2513
- const $identifierParameter = parameters?.$identifier;
2514
- let $identifier;
2515
- if (typeof $identifierParameter === "function") {
2516
- $identifier = $identifierParameter;
2517
- }
2518
- else if (typeof $identifierParameter === "object") {
2519
- $identifier = () => $identifierParameter;
2520
- }
2521
- else if (typeof $identifierParameter === "string") {
2522
- $identifier = () => dataFactory.namedNode($identifierParameter);
2523
- }
2524
- else if ($identifierParameter === undefined) {
2525
- const $eagerIdentifier = dataFactory.blankNode();
2526
- $identifier = () => $eagerIdentifier;
2527
- }
2528
- else {
2529
- $identifier = $identifierParameter;
2530
- }
2531
- const $type = "NodeShape";
2532
- let and;
2533
- if (Maybe.isMaybe(parameters?.and)) {
2534
- and = parameters?.and;
2535
- }
2536
- else if ($isReadonlyObjectArray(parameters?.and)) {
2537
- and = Maybe.of(parameters?.and);
2538
- }
2539
- else if ($isReadonlyStringArray(parameters?.and)) {
2540
- and = Maybe.of(parameters?.and.map((item) => dataFactory.namedNode(item)));
2541
- }
2542
- else if (parameters?.and === undefined) {
2543
- and = Maybe.empty();
2544
- }
2545
- else {
2546
- and = parameters?.and;
2547
- }
2548
- let classes;
2549
- if (parameters?.classes === undefined) {
2550
- classes = [];
2551
- }
2552
- else if ($isReadonlyObjectArray(parameters?.classes)) {
2553
- classes = parameters?.classes;
2554
- }
2555
- else if ($isReadonlyStringArray(parameters?.classes)) {
2556
- classes = parameters?.classes.map((item) => dataFactory.namedNode(item));
2557
- }
2558
- else {
2559
- classes = parameters?.classes;
2560
- }
2561
- let closed;
2562
- if (Maybe.isMaybe(parameters?.closed)) {
2563
- closed = parameters?.closed;
2564
- }
2565
- else if (typeof parameters?.closed === "boolean") {
2566
- closed = Maybe.of(parameters?.closed);
2567
- }
2568
- else if (parameters?.closed === undefined) {
2569
- closed = Maybe.empty();
2570
- }
2571
- else {
2572
- closed = parameters?.closed;
2573
- }
2574
- let comment;
2575
- if (Maybe.isMaybe(parameters?.comment)) {
2576
- comment = parameters?.comment;
2577
- }
2578
- else if (typeof parameters?.comment === "string") {
2579
- comment = Maybe.of(parameters?.comment);
2580
- }
2581
- else if (parameters?.comment === undefined) {
2582
- comment = Maybe.empty();
2583
- }
2584
- else {
2585
- comment = parameters?.comment;
2586
- }
2587
- let datatype;
2588
- if (Maybe.isMaybe(parameters?.datatype)) {
2589
- datatype = parameters?.datatype;
2590
- }
2591
- else if (typeof parameters?.datatype === "object") {
2592
- datatype = Maybe.of(parameters?.datatype);
2593
- }
2594
- else if (typeof parameters?.datatype === "string") {
2595
- datatype = Maybe.of(dataFactory.namedNode(parameters?.datatype));
2596
- }
2597
- else if (parameters?.datatype === undefined) {
2598
- datatype = Maybe.empty();
2599
- }
2600
- else {
2601
- datatype = parameters?.datatype;
2602
- }
2603
- let deactivated;
2604
- if (Maybe.isMaybe(parameters?.deactivated)) {
2605
- deactivated = parameters?.deactivated;
2606
- }
2607
- else if (typeof parameters?.deactivated === "boolean") {
2608
- deactivated = Maybe.of(parameters?.deactivated);
2609
- }
2610
- else if (parameters?.deactivated === undefined) {
2611
- deactivated = Maybe.empty();
2612
- }
2613
- else {
2614
- deactivated = parameters?.deactivated;
2615
- }
2616
- let flags;
2617
- if (parameters?.flags === undefined) {
2618
- flags = [];
2619
- }
2620
- else if (typeof parameters?.flags === "object") {
2621
- flags = parameters?.flags;
2622
- }
2623
- else {
2624
- flags = parameters?.flags;
2625
- }
2626
- let hasValues;
2627
- if (parameters?.hasValues === undefined) {
2628
- hasValues = [];
2629
- }
2630
- else if ($isReadonlyObjectArray(parameters?.hasValues)) {
2631
- hasValues = parameters?.hasValues;
2632
- }
2633
- else if ($isReadonlyBigIntArray(parameters?.hasValues)) {
2634
- hasValues = parameters?.hasValues.map((item) => $literalFactory.bigint(item));
2635
- }
2636
- else if ($isReadonlyBooleanArray(parameters?.hasValues)) {
2637
- hasValues = parameters?.hasValues.map((item) => $literalFactory.boolean(item));
2638
- }
2639
- else if ($isReadonlyNumberArray(parameters?.hasValues)) {
2640
- hasValues = parameters?.hasValues.map((item) => $literalFactory.number(item));
2641
- }
2642
- else if ($isReadonlyStringArray(parameters?.hasValues)) {
2643
- hasValues = parameters?.hasValues.map((item) => $literalFactory.string(item));
2644
- }
2645
- else {
2646
- hasValues = parameters?.hasValues;
2647
- }
2648
- let ignoredProperties;
2649
- if (Maybe.isMaybe(parameters?.ignoredProperties)) {
2650
- ignoredProperties = parameters?.ignoredProperties;
2651
- }
2652
- else if ($isReadonlyObjectArray(parameters?.ignoredProperties)) {
2653
- ignoredProperties = Maybe.of(parameters?.ignoredProperties);
2654
- }
2655
- else if ($isReadonlyStringArray(parameters?.ignoredProperties)) {
2656
- ignoredProperties = Maybe.of(parameters?.ignoredProperties.map((item) => dataFactory.namedNode(item)));
2657
- }
2658
- else if (parameters?.ignoredProperties === undefined) {
2659
- ignoredProperties = Maybe.empty();
2660
- }
2661
- else {
2662
- ignoredProperties = parameters?.ignoredProperties;
2663
- }
2664
- let in_;
2665
- if (Maybe.isMaybe(parameters?.in_)) {
2666
- in_ = parameters?.in_;
2667
- }
2668
- else if ($isReadonlyObjectArray(parameters?.in_)) {
2669
- in_ = Maybe.of(parameters?.in_);
2670
- }
2671
- else if ($isReadonlyBigIntArray(parameters?.in_)) {
2672
- in_ = Maybe.of(parameters?.in_.map((item) => $literalFactory.bigint(item)));
2673
- }
2674
- else if ($isReadonlyBooleanArray(parameters?.in_)) {
2675
- in_ = Maybe.of(parameters?.in_.map((item) => $literalFactory.boolean(item)));
2676
- }
2677
- else if ($isReadonlyNumberArray(parameters?.in_)) {
2678
- in_ = Maybe.of(parameters?.in_.map((item) => $literalFactory.number(item)));
2679
- }
2680
- else if ($isReadonlyStringArray(parameters?.in_)) {
2681
- in_ = Maybe.of(parameters?.in_.map((item) => $literalFactory.string(item)));
2682
- }
2683
- else if (parameters?.in_ === undefined) {
2684
- in_ = Maybe.empty();
2685
- }
2686
- else {
2687
- in_ = parameters?.in_;
2688
- }
2689
- let isDefinedBy;
2690
- if (Maybe.isMaybe(parameters?.isDefinedBy)) {
2691
- isDefinedBy = parameters?.isDefinedBy;
2692
- }
2693
- else if (typeof parameters?.isDefinedBy === "object") {
2694
- isDefinedBy = Maybe.of(parameters?.isDefinedBy);
2695
- }
2696
- else if (typeof parameters?.isDefinedBy === "string") {
2697
- isDefinedBy = Maybe.of(dataFactory.namedNode(parameters?.isDefinedBy));
2698
- }
2699
- else if (parameters?.isDefinedBy === undefined) {
2700
- isDefinedBy = Maybe.empty();
2701
- }
2702
- else {
2703
- isDefinedBy = parameters?.isDefinedBy;
2704
- }
2705
- let label;
2706
- if (Maybe.isMaybe(parameters?.label)) {
2707
- label = parameters?.label;
2708
- }
2709
- else if (typeof parameters?.label === "string") {
2710
- label = Maybe.of(parameters?.label);
2711
- }
2712
- else if (parameters?.label === undefined) {
2713
- label = Maybe.empty();
2714
- }
2715
- else {
2716
- label = parameters?.label;
2717
- }
2718
- let languageIn;
2719
- if (Maybe.isMaybe(parameters?.languageIn)) {
2720
- languageIn = parameters?.languageIn;
2721
- }
2722
- else if (typeof parameters?.languageIn === "object") {
2723
- languageIn = Maybe.of(parameters?.languageIn);
2724
- }
2725
- else if (parameters?.languageIn === undefined) {
2726
- languageIn = Maybe.empty();
2727
- }
2728
- else {
2729
- languageIn = parameters?.languageIn;
2730
- }
2731
- let maxCount;
2732
- if (Maybe.isMaybe(parameters?.maxCount)) {
2733
- maxCount = parameters?.maxCount;
2734
- }
2735
- else if (typeof parameters?.maxCount === "bigint") {
2736
- maxCount = Maybe.of(parameters?.maxCount);
2737
- }
2738
- else if (typeof parameters?.maxCount === "number") {
2739
- maxCount = Maybe.of(BigInt(parameters?.maxCount));
2740
- }
2741
- else if (parameters?.maxCount === undefined) {
2742
- maxCount = Maybe.empty();
2743
- }
2744
- else {
2745
- maxCount = parameters?.maxCount;
2746
- }
2747
- let maxExclusive;
2748
- if (Maybe.isMaybe(parameters?.maxExclusive)) {
2749
- maxExclusive = parameters?.maxExclusive;
2750
- }
2751
- else if (typeof parameters?.maxExclusive === "bigint") {
2752
- maxExclusive = Maybe.of($literalFactory.bigint(parameters?.maxExclusive));
2753
- }
2754
- else if (typeof parameters?.maxExclusive === "boolean") {
2755
- maxExclusive = Maybe.of($literalFactory.boolean(parameters?.maxExclusive));
2756
- }
2757
- else if (typeof parameters?.maxExclusive === "object" &&
2758
- parameters?.maxExclusive instanceof Date) {
2759
- maxExclusive = Maybe.of($literalFactory.date(parameters?.maxExclusive));
2760
- }
2761
- else if (typeof parameters?.maxExclusive === "number") {
2762
- maxExclusive = Maybe.of($literalFactory.number(parameters?.maxExclusive));
2763
- }
2764
- else if (typeof parameters?.maxExclusive === "string") {
2765
- maxExclusive = Maybe.of($literalFactory.string(parameters?.maxExclusive));
2766
- }
2767
- else if (typeof parameters?.maxExclusive === "object") {
2768
- maxExclusive = Maybe.of(parameters?.maxExclusive);
2769
- }
2770
- else if (parameters?.maxExclusive === undefined) {
2771
- maxExclusive = Maybe.empty();
2772
- }
2773
- else {
2774
- maxExclusive = parameters?.maxExclusive;
2775
- }
2776
- let maxInclusive;
2777
- if (Maybe.isMaybe(parameters?.maxInclusive)) {
2778
- maxInclusive = parameters?.maxInclusive;
2779
- }
2780
- else if (typeof parameters?.maxInclusive === "bigint") {
2781
- maxInclusive = Maybe.of($literalFactory.bigint(parameters?.maxInclusive));
2782
- }
2783
- else if (typeof parameters?.maxInclusive === "boolean") {
2784
- maxInclusive = Maybe.of($literalFactory.boolean(parameters?.maxInclusive));
2785
- }
2786
- else if (typeof parameters?.maxInclusive === "object" &&
2787
- parameters?.maxInclusive instanceof Date) {
2788
- maxInclusive = Maybe.of($literalFactory.date(parameters?.maxInclusive));
2789
- }
2790
- else if (typeof parameters?.maxInclusive === "number") {
2791
- maxInclusive = Maybe.of($literalFactory.number(parameters?.maxInclusive));
2792
- }
2793
- else if (typeof parameters?.maxInclusive === "string") {
2794
- maxInclusive = Maybe.of($literalFactory.string(parameters?.maxInclusive));
2795
- }
2796
- else if (typeof parameters?.maxInclusive === "object") {
2797
- maxInclusive = Maybe.of(parameters?.maxInclusive);
2798
- }
2799
- else if (parameters?.maxInclusive === undefined) {
2800
- maxInclusive = Maybe.empty();
2801
- }
2802
- else {
2803
- maxInclusive = parameters?.maxInclusive;
2804
- }
2805
- let maxLength;
2806
- if (Maybe.isMaybe(parameters?.maxLength)) {
2807
- maxLength = parameters?.maxLength;
2808
- }
2809
- else if (typeof parameters?.maxLength === "bigint") {
2810
- maxLength = Maybe.of(parameters?.maxLength);
2811
- }
2812
- else if (typeof parameters?.maxLength === "number") {
2813
- maxLength = Maybe.of(BigInt(parameters?.maxLength));
2814
- }
2815
- else if (parameters?.maxLength === undefined) {
2816
- maxLength = Maybe.empty();
2817
- }
2818
- else {
2819
- maxLength = parameters?.maxLength;
2820
- }
2821
- let minCount;
2822
- if (Maybe.isMaybe(parameters?.minCount)) {
2823
- minCount = parameters?.minCount;
2824
- }
2825
- else if (typeof parameters?.minCount === "bigint") {
2826
- minCount = Maybe.of(parameters?.minCount);
2827
- }
2828
- else if (typeof parameters?.minCount === "number") {
2829
- minCount = Maybe.of(BigInt(parameters?.minCount));
2830
- }
2831
- else if (parameters?.minCount === undefined) {
2832
- minCount = Maybe.empty();
2833
- }
2834
- else {
2835
- minCount = parameters?.minCount;
2836
- }
2837
- let minExclusive;
2838
- if (Maybe.isMaybe(parameters?.minExclusive)) {
2839
- minExclusive = parameters?.minExclusive;
2840
- }
2841
- else if (typeof parameters?.minExclusive === "bigint") {
2842
- minExclusive = Maybe.of($literalFactory.bigint(parameters?.minExclusive));
2843
- }
2844
- else if (typeof parameters?.minExclusive === "boolean") {
2845
- minExclusive = Maybe.of($literalFactory.boolean(parameters?.minExclusive));
2846
- }
2847
- else if (typeof parameters?.minExclusive === "object" &&
2848
- parameters?.minExclusive instanceof Date) {
2849
- minExclusive = Maybe.of($literalFactory.date(parameters?.minExclusive));
2850
- }
2851
- else if (typeof parameters?.minExclusive === "number") {
2852
- minExclusive = Maybe.of($literalFactory.number(parameters?.minExclusive));
2853
- }
2854
- else if (typeof parameters?.minExclusive === "string") {
2855
- minExclusive = Maybe.of($literalFactory.string(parameters?.minExclusive));
2856
- }
2857
- else if (typeof parameters?.minExclusive === "object") {
2858
- minExclusive = Maybe.of(parameters?.minExclusive);
2859
- }
2860
- else if (parameters?.minExclusive === undefined) {
2861
- minExclusive = Maybe.empty();
2862
- }
2863
- else {
2864
- minExclusive = parameters?.minExclusive;
2865
- }
2866
- let minInclusive;
2867
- if (Maybe.isMaybe(parameters?.minInclusive)) {
2868
- minInclusive = parameters?.minInclusive;
2869
- }
2870
- else if (typeof parameters?.minInclusive === "bigint") {
2871
- minInclusive = Maybe.of($literalFactory.bigint(parameters?.minInclusive));
2872
- }
2873
- else if (typeof parameters?.minInclusive === "boolean") {
2874
- minInclusive = Maybe.of($literalFactory.boolean(parameters?.minInclusive));
2875
- }
2876
- else if (typeof parameters?.minInclusive === "object" &&
2877
- parameters?.minInclusive instanceof Date) {
2878
- minInclusive = Maybe.of($literalFactory.date(parameters?.minInclusive));
2879
- }
2880
- else if (typeof parameters?.minInclusive === "number") {
2881
- minInclusive = Maybe.of($literalFactory.number(parameters?.minInclusive));
2882
- }
2883
- else if (typeof parameters?.minInclusive === "string") {
2884
- minInclusive = Maybe.of($literalFactory.string(parameters?.minInclusive));
2885
- }
2886
- else if (typeof parameters?.minInclusive === "object") {
2887
- minInclusive = Maybe.of(parameters?.minInclusive);
2888
- }
2889
- else if (parameters?.minInclusive === undefined) {
2890
- minInclusive = Maybe.empty();
2891
- }
2892
- else {
2893
- minInclusive = parameters?.minInclusive;
2894
- }
2895
- let minLength;
2896
- if (Maybe.isMaybe(parameters?.minLength)) {
2897
- minLength = parameters?.minLength;
2898
- }
2899
- else if (typeof parameters?.minLength === "bigint") {
2900
- minLength = Maybe.of(parameters?.minLength);
2901
- }
2902
- else if (typeof parameters?.minLength === "number") {
2903
- minLength = Maybe.of(BigInt(parameters?.minLength));
2904
- }
2905
- else if (parameters?.minLength === undefined) {
2906
- minLength = Maybe.empty();
2907
- }
2908
- else {
2909
- minLength = parameters?.minLength;
2910
- }
2911
- let node;
2912
- if (Maybe.isMaybe(parameters?.node)) {
2913
- node = parameters?.node;
2914
- }
2915
- else if (typeof parameters?.node === "object") {
2916
- node = Maybe.of(parameters?.node);
2917
- }
2918
- else if (typeof parameters?.node === "string") {
2919
- node = Maybe.of(dataFactory.namedNode(parameters?.node));
2920
- }
2921
- else if (parameters?.node === undefined) {
2922
- node = Maybe.empty();
2923
- }
2924
- else {
2925
- node = parameters?.node;
2926
- }
2927
- let nodeKind;
2928
- if (Maybe.isMaybe(parameters?.nodeKind)) {
2929
- nodeKind = parameters?.nodeKind;
2930
- }
2931
- else if (typeof parameters?.nodeKind === "object") {
2932
- nodeKind = Maybe.of(parameters?.nodeKind);
2933
- }
2934
- else if (typeof parameters?.nodeKind === "string") {
2935
- nodeKind = Maybe.of(dataFactory.namedNode(parameters?.nodeKind));
2936
- }
2937
- else if (parameters?.nodeKind === undefined) {
2938
- nodeKind = Maybe.empty();
2939
- }
2940
- else {
2941
- nodeKind = parameters?.nodeKind;
2942
- }
2943
- let not;
2944
- if (parameters?.not === undefined) {
2945
- not = [];
2946
- }
2947
- else if ($isReadonlyObjectArray(parameters?.not)) {
2948
- not = parameters?.not;
2949
- }
2950
- else if ($isReadonlyStringArray(parameters?.not)) {
2951
- not = parameters?.not.map((item) => dataFactory.namedNode(item));
2952
- }
2953
- else {
2954
- not = parameters?.not;
2955
- }
2956
- let or;
2957
- if (Maybe.isMaybe(parameters?.or)) {
2958
- or = parameters?.or;
2959
- }
2960
- else if ($isReadonlyObjectArray(parameters?.or)) {
2961
- or = Maybe.of(parameters?.or);
2962
- }
2963
- else if ($isReadonlyStringArray(parameters?.or)) {
2964
- or = Maybe.of(parameters?.or.map((item) => dataFactory.namedNode(item)));
2965
- }
2966
- else if (parameters?.or === undefined) {
2967
- or = Maybe.empty();
2968
- }
2969
- else {
2970
- or = parameters?.or;
2971
- }
2972
- let patterns;
2973
- if (parameters?.patterns === undefined) {
2974
- patterns = [];
2975
- }
2976
- else if (typeof parameters?.patterns === "object") {
2977
- patterns = parameters?.patterns;
2978
- }
2979
- else {
2980
- patterns = parameters?.patterns;
2981
- }
2982
- let properties;
2983
- if (parameters?.properties === undefined) {
2984
- properties = [];
2985
- }
2986
- else if ($isReadonlyObjectArray(parameters?.properties)) {
2987
- properties = parameters?.properties;
2988
- }
2989
- else if ($isReadonlyStringArray(parameters?.properties)) {
2990
- properties = parameters?.properties.map((item) => dataFactory.namedNode(item));
2991
- }
2992
- else {
2993
- properties = parameters?.properties;
2994
- }
2995
- let subClassOf;
2996
- if (parameters?.subClassOf === undefined) {
2997
- subClassOf = [];
2998
- }
2999
- else if ($isReadonlyObjectArray(parameters?.subClassOf)) {
3000
- subClassOf = parameters?.subClassOf;
3001
- }
3002
- else if ($isReadonlyStringArray(parameters?.subClassOf)) {
3003
- subClassOf = parameters?.subClassOf.map((item) => dataFactory.namedNode(item));
3004
- }
3005
- else {
3006
- subClassOf = parameters?.subClassOf;
3007
- }
3008
- let types;
3009
- if (parameters?.types === undefined) {
3010
- types = [];
3011
- }
3012
- else if ($isReadonlyObjectArray(parameters?.types)) {
3013
- types = parameters?.types;
3014
- }
3015
- else if ($isReadonlyStringArray(parameters?.types)) {
3016
- types = parameters?.types.map((item) => dataFactory.namedNode(item));
3017
- }
3018
- else {
3019
- types = parameters?.types;
3020
- }
3021
- let xone;
3022
- if (Maybe.isMaybe(parameters?.xone)) {
3023
- xone = parameters?.xone;
3024
- }
3025
- else if ($isReadonlyObjectArray(parameters?.xone)) {
3026
- xone = Maybe.of(parameters?.xone);
3027
- }
3028
- else if ($isReadonlyStringArray(parameters?.xone)) {
3029
- xone = Maybe.of(parameters?.xone.map((item) => dataFactory.namedNode(item)));
3030
- }
3031
- else if (parameters?.xone === undefined) {
3032
- xone = Maybe.empty();
3033
- }
3034
- else {
3035
- xone = parameters?.xone;
3036
- }
3037
- const $object = {
3038
- $identifier,
3039
- $type,
3040
- and,
3041
- classes,
3042
- closed,
3043
- comment,
3044
- datatype,
3045
- deactivated,
3046
- flags,
3047
- hasValues,
3048
- ignoredProperties,
3049
- in_,
3050
- isDefinedBy,
3051
- label,
3052
- languageIn,
3053
- maxCount,
3054
- maxExclusive,
3055
- maxInclusive,
3056
- maxLength,
3057
- minCount,
3058
- minExclusive,
3059
- minInclusive,
3060
- minLength,
3061
- node,
3062
- nodeKind,
3063
- not,
3064
- or,
3065
- patterns,
3066
- properties,
3067
- subClassOf,
3068
- types,
3069
- xone,
3070
- };
3071
- if (!globalThis.Object.prototype.hasOwnProperty.call($object, "toString")) {
3072
- $object.toString = $toString;
3073
- }
3074
- return $object;
1966
+ return $sequenceRecord({
1967
+ $identifier: $convertToIdentifierProperty(parameters?.$identifier),
1968
+ and: $convertToMaybe($convertToArray($convertToIdentifier, true))(parameters?.and).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.and.type(), value)),
1969
+ classes: $convertToArray(($convertToIri), true)(parameters?.classes).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.classes.type(), value)),
1970
+ closed: $convertToMaybe($identityConversionFunction)(parameters?.closed).chain((value) => $validateMaybe($identityValidationFunction)(NodeShape.schema.properties.closed.type(), value)),
1971
+ comment: $convertToMaybe($identityConversionFunction)(parameters?.comment).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.comment.type(), value)),
1972
+ datatype: $convertToMaybe(($convertToIri))(parameters?.datatype).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.datatype.type(), value)),
1973
+ deactivated: $convertToMaybe($identityConversionFunction)(parameters?.deactivated).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.deactivated.type(), value)),
1974
+ flags: $convertToArray($identityConversionFunction, true)(parameters?.flags).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.flags.type(), value)),
1975
+ hasValues: $convertToArray($identityConversionFunction, true)(parameters?.hasValues).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.hasValues.type(), value)),
1976
+ ignoredProperties: $convertToMaybe($convertToArray(($convertToIri), true))(parameters?.ignoredProperties).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(NodeShape.schema.properties.ignoredProperties.type(), value)),
1977
+ in_: $convertToMaybe($convertToArray($identityConversionFunction, true))(parameters?.in_).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.in_.type(), value)),
1978
+ isDefinedBy: $convertToMaybe($convertToIdentifier)(parameters?.isDefinedBy).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.isDefinedBy.type(), value)),
1979
+ label: $convertToMaybe($identityConversionFunction)(parameters?.label).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.label.type(), value)),
1980
+ languageIn: $convertToMaybe($convertToArray($identityConversionFunction, true))(parameters?.languageIn).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.languageIn.type(), value)),
1981
+ maxCount: $convertToMaybe($identityConversionFunction)(parameters?.maxCount).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxCount.type(), value)),
1982
+ maxExclusive: $convertToMaybe($convertToLiteral)(parameters?.maxExclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxExclusive.type(), value)),
1983
+ maxInclusive: $convertToMaybe($convertToLiteral)(parameters?.maxInclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxInclusive.type(), value)),
1984
+ maxLength: $convertToMaybe($identityConversionFunction)(parameters?.maxLength).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.maxLength.type(), value)),
1985
+ minCount: $convertToMaybe($identityConversionFunction)(parameters?.minCount).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minCount.type(), value)),
1986
+ minExclusive: $convertToMaybe($convertToLiteral)(parameters?.minExclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minExclusive.type(), value)),
1987
+ minInclusive: $convertToMaybe($convertToLiteral)(parameters?.minInclusive).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minInclusive.type(), value)),
1988
+ minLength: $convertToMaybe($identityConversionFunction)(parameters?.minLength).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.minLength.type(), value)),
1989
+ node: $convertToMaybe($convertToIdentifier)(parameters?.node).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.node.type(), value)),
1990
+ nodeKind: $convertToMaybe(($convertToIri))(parameters?.nodeKind).chain((value) => $validateMaybe($identityValidationFunction)(PropertyShape.schema.properties.nodeKind.type(), value)),
1991
+ not: $convertToArray($convertToIdentifier, true)(parameters?.not).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.not.type(), value)),
1992
+ or: $convertToMaybe($convertToArray($convertToIdentifier, true))(parameters?.or).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.or.type(), value)),
1993
+ patterns: $convertToArray($identityConversionFunction, true)(parameters?.patterns).chain((value) => $validateArray($identityValidationFunction, true)(PropertyShape.schema.properties.patterns.type(), value)),
1994
+ properties: $convertToArray($convertToIdentifier, true)(parameters?.properties).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.properties.type(), value)),
1995
+ subClassOf: $convertToArray(($convertToIri), true)(parameters?.subClassOf).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.subClassOf.type(), value)),
1996
+ types: $convertToArray(($convertToIri), true)(parameters?.types).chain((value) => $validateArray($identityValidationFunction, true)(NodeShape.schema.properties.types.type(), value)),
1997
+ xone: $convertToMaybe($convertToArray($convertToIdentifier, true))(parameters?.xone).chain((value) => $validateMaybe($validateArray($identityValidationFunction, true))(PropertyShape.schema.properties.xone.type(), value)),
1998
+ }).map((properties) => {
1999
+ const finalObject = { ...properties, $type: "NodeShape" };
2000
+ if (!globalThis.Object.prototype.hasOwnProperty.call(finalObject, "toString")) {
2001
+ finalObject.toString = $toString;
2002
+ }
2003
+ return finalObject;
2004
+ });
3075
2005
  }
3076
2006
  NodeShape.create = create;
2007
+ function createUnsafe(parameters) {
2008
+ return create(parameters).unsafeCoerce();
2009
+ }
2010
+ NodeShape.createUnsafe = createUnsafe;
3077
2011
  let Identifier;
3078
2012
  (function (Identifier) {
3079
2013
  Identifier.parse = $parseIdentifier;
@@ -3726,7 +2660,7 @@ export var NodeShape;
3726
2660
  value: Maybe.empty(),
3727
2661
  })),
3728
2662
  }),
3729
- }).map((properties) => create(properties)));
2663
+ }).chain((properties) => create(properties)));
3730
2664
  };
3731
2665
  NodeShape.fromRdfResource = $wrap_FromRdfResourceFunction(NodeShape._fromRdfResource);
3732
2666
  NodeShape.fromRdfResourceValues = (values, options) => values.chain((values) => values.chainMap((value) => value