@stndrds/schema 1.0.0-alpha.94 → 1.0.0-alpha.96

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 (137) hide show
  1. package/dist/attributes-Btn-GLvC.d.ts +674 -0
  2. package/dist/attributes-CeDp1IMp.d.mts +674 -0
  3. package/dist/chunk-2TEWGEUI.js +212 -0
  4. package/dist/chunk-4RGFTMQR.mjs +8 -0
  5. package/dist/chunk-5TLM4QXO.mjs +8 -0
  6. package/dist/chunk-67PQMHQA.mjs +199 -0
  7. package/dist/chunk-6HHSX6LP.js +64 -0
  8. package/dist/chunk-AHPXNPJC.js +105 -0
  9. package/dist/chunk-BEN6TE7Y.js +11 -0
  10. package/dist/chunk-BH3RPSC5.js +22 -0
  11. package/dist/chunk-BIQ35DLC.mjs +78 -0
  12. package/dist/chunk-CKZHFJQT.js +16 -0
  13. package/dist/chunk-E6XO2STS.js +11 -11
  14. package/dist/chunk-EIWGW2ML.mjs +99 -0
  15. package/dist/chunk-EKG35CSO.mjs +1 -0
  16. package/dist/chunk-IMEPIVTR.js +217 -0
  17. package/dist/chunk-J4ORNCAH.js +10 -0
  18. package/dist/chunk-KC4F3HB7.js +32 -0
  19. package/dist/chunk-LHXE7LLD.js +28 -0
  20. package/dist/chunk-MD6XGXTU.mjs +18 -0
  21. package/dist/chunk-N47XKY4R.js +14 -0
  22. package/dist/chunk-NXXSNUDI.mjs +8 -0
  23. package/dist/chunk-PKG3E5MW.mjs +18 -0
  24. package/dist/chunk-PZT3CIHD.mjs +192 -0
  25. package/dist/chunk-QL3UGPUG.mjs +60 -0
  26. package/dist/chunk-QY65ZSBL.js +16 -0
  27. package/dist/chunk-R6JFUC32.js +2 -0
  28. package/dist/chunk-RDXQ4CYT.mjs +9 -0
  29. package/dist/chunk-S5VJ2FZE.js +12 -0
  30. package/dist/chunk-SVII65W7.mjs +14 -0
  31. package/dist/chunk-U7VN3RUE.mjs +25 -0
  32. package/dist/chunk-VCPYYLCS.js +83 -0
  33. package/dist/chunk-VD3P2A6Q.js +10 -0
  34. package/dist/chunk-VPEV3W34.mjs +10 -0
  35. package/dist/chunk-WGFQMQMV.mjs +14 -0
  36. package/dist/chunk-X6VDDXG7.mjs +12 -0
  37. package/dist/chunk-XAORXFAX.mjs +1 -10
  38. package/dist/chunk-XEOG24K6.mjs +8 -0
  39. package/dist/chunk-XK6XC3V4.js +10 -0
  40. package/dist/chunk-XZ5B5MTG.js +20 -0
  41. package/dist/chunk-YKHC2AW6.js +10 -0
  42. package/dist/chunk-Z2T7ONKU.js +20 -0
  43. package/dist/chunk-ZFL7DXAE.mjs +28 -0
  44. package/dist/chunk-ZM7W2ZCF.mjs +20 -0
  45. package/dist/{validators-BCw4Sn01.d.mts → index-CvXnHxD2.d.mts} +12 -1359
  46. package/dist/{validators-5XMwJOlV.d.ts → index-telccAkt.d.ts} +12 -1359
  47. package/dist/index.d.mts +1295 -474
  48. package/dist/index.d.ts +1295 -474
  49. package/dist/index.js +1400 -831
  50. package/dist/index.mjs +583 -571
  51. package/dist/types-B5Zhhoev.d.ts +39 -0
  52. package/dist/types-C6naks1H.d.mts +39 -0
  53. package/dist/utils.js +38 -20
  54. package/dist/utils.mjs +1 -20
  55. package/dist/validation/all.d.mts +23 -0
  56. package/dist/validation/all.d.ts +23 -0
  57. package/dist/validation/all.js +265 -0
  58. package/dist/validation/all.mjs +20 -0
  59. package/dist/validation/complex/currency.d.mts +15 -0
  60. package/dist/validation/complex/currency.d.ts +15 -0
  61. package/dist/validation/complex/currency.js +12 -0
  62. package/dist/validation/complex/currency.mjs +3 -0
  63. package/dist/validation/complex/file.d.mts +13 -0
  64. package/dist/validation/complex/file.d.ts +13 -0
  65. package/dist/validation/complex/file.js +12 -0
  66. package/dist/validation/complex/file.mjs +3 -0
  67. package/dist/validation/complex/location.d.mts +22 -0
  68. package/dist/validation/complex/location.d.ts +22 -0
  69. package/dist/validation/complex/location.js +12 -0
  70. package/dist/validation/complex/location.mjs +3 -0
  71. package/dist/validation/complex/phone.d.mts +22 -0
  72. package/dist/validation/complex/phone.d.ts +22 -0
  73. package/dist/validation/complex/phone.js +12 -0
  74. package/dist/validation/complex/phone.mjs +3 -0
  75. package/dist/validation/complex/relation.d.mts +25 -0
  76. package/dist/validation/complex/relation.d.ts +25 -0
  77. package/dist/validation/complex/relation.js +20 -0
  78. package/dist/validation/complex/relation.mjs +3 -0
  79. package/dist/validation/complex/richtext.d.mts +13 -0
  80. package/dist/validation/complex/richtext.d.ts +13 -0
  81. package/dist/validation/complex/richtext.js +12 -0
  82. package/dist/validation/complex/richtext.mjs +3 -0
  83. package/dist/validation/complex/select.d.mts +20 -0
  84. package/dist/validation/complex/select.d.ts +20 -0
  85. package/dist/validation/complex/select.js +20 -0
  86. package/dist/validation/complex/select.mjs +3 -0
  87. package/dist/validation/complex/user.d.mts +13 -0
  88. package/dist/validation/complex/user.d.ts +13 -0
  89. package/dist/validation/complex/user.js +12 -0
  90. package/dist/validation/complex/user.mjs +3 -0
  91. package/dist/validation/computed/formula.d.mts +14 -0
  92. package/dist/validation/computed/formula.d.ts +14 -0
  93. package/dist/validation/computed/formula.js +12 -0
  94. package/dist/validation/computed/formula.mjs +3 -0
  95. package/dist/validation/computed/rollup.d.mts +14 -0
  96. package/dist/validation/computed/rollup.d.ts +14 -0
  97. package/dist/validation/computed/rollup.js +12 -0
  98. package/dist/validation/computed/rollup.mjs +3 -0
  99. package/dist/validation/config/index.d.mts +421 -0
  100. package/dist/validation/config/index.d.ts +421 -0
  101. package/dist/validation/config/index.js +103 -0
  102. package/dist/validation/config/index.mjs +2 -0
  103. package/dist/validation/core/index.d.mts +85 -0
  104. package/dist/validation/core/index.d.ts +85 -0
  105. package/dist/validation/core/index.js +27 -0
  106. package/dist/validation/core/index.mjs +2 -0
  107. package/dist/validation/object/index.d.mts +6 -0
  108. package/dist/validation/object/index.d.ts +6 -0
  109. package/dist/validation/object/index.js +71 -0
  110. package/dist/validation/object/index.mjs +18 -0
  111. package/dist/validation/primitives/checkbox.d.mts +12 -0
  112. package/dist/validation/primitives/checkbox.d.ts +12 -0
  113. package/dist/validation/primitives/checkbox.js +12 -0
  114. package/dist/validation/primitives/checkbox.mjs +3 -0
  115. package/dist/validation/primitives/date.d.mts +12 -0
  116. package/dist/validation/primitives/date.d.ts +12 -0
  117. package/dist/validation/primitives/date.js +12 -0
  118. package/dist/validation/primitives/date.mjs +3 -0
  119. package/dist/validation/primitives/number.d.mts +12 -0
  120. package/dist/validation/primitives/number.d.ts +12 -0
  121. package/dist/validation/primitives/number.js +12 -0
  122. package/dist/validation/primitives/number.mjs +3 -0
  123. package/dist/validation/primitives/rating.d.mts +12 -0
  124. package/dist/validation/primitives/rating.d.ts +12 -0
  125. package/dist/validation/primitives/rating.js +12 -0
  126. package/dist/validation/primitives/rating.mjs +3 -0
  127. package/dist/validation/primitives/text.d.mts +17 -0
  128. package/dist/validation/primitives/text.d.ts +17 -0
  129. package/dist/validation/primitives/text.js +16 -0
  130. package/dist/validation/primitives/text.mjs +3 -0
  131. package/dist/validation/validators.d.mts +21 -2
  132. package/dist/validation/validators.d.ts +21 -2
  133. package/dist/validation/validators.js +265 -120
  134. package/dist/validation/validators.mjs +20 -120
  135. package/package.json +108 -5
  136. package/dist/chunk-4362R5F2.mjs +0 -780
  137. package/dist/chunk-7QUI6TSO.js +0 -780
package/dist/index.mjs CHANGED
@@ -1,77 +1,29 @@
1
- import {
2
- asTenantId,
3
- asUserId,
4
- deepEqual,
5
- generateId,
6
- generatePrefixedId,
7
- generateTemplateName,
8
- indexBy,
9
- slugify
10
- } from "./chunk-XAORXFAX.mjs";
11
- import {
12
- DEFAULT_VALIDATION_MESSAGES,
13
- attributeConfigSchemas,
14
- checkboxConfigSchema,
15
- computeRecordStatus,
16
- createAttributeValidator,
17
- createCheckboxValidator,
18
- createCurrencyValidator,
19
- createDateValidator,
20
- createDraftValidator,
21
- createFileValidator,
22
- createFormAttributeValidator,
23
- createFormulaValidator,
24
- createLocationValidator,
25
- createMultiRelationValidator,
26
- createMultiselectValidator,
27
- createNumberValidator,
28
- createObjectValidator,
29
- createPhoneValidator,
30
- createRatingValidator,
31
- createRelationValidator,
32
- createRichtextValidator,
33
- createRollupValidator,
34
- createSelectValidator,
35
- createSingleRelationValidator,
36
- createStatusValidator,
37
- createTextAreaValidator,
38
- createTextValidator,
39
- createUserValidator,
40
- currencyConfigSchema,
41
- dateConfigSchema,
42
- documentConfigSchema,
43
- fileConfigSchema,
44
- formatPhoneForDisplay,
45
- formatZodErrors,
46
- formulaConfigSchema,
47
- getAttributeConfigSchema,
48
- getMissingRequiredAttributes,
49
- isRecordComplete,
50
- locationConfigSchema,
51
- multiselectConfigSchema,
52
- normalizePhoneNumber,
53
- numberConfigSchema,
54
- parseAttributeConfig,
55
- parseRawPhoneInput,
56
- phoneConfigSchema,
57
- ratingConfigSchema,
58
- relationConfigSchema,
59
- richtextConfigSchema,
60
- rollupConfigSchema,
61
- safeParseAttributeConfig,
62
- selectConfigSchema,
63
- statusConfigSchema,
64
- textConfigSchema,
65
- textareaConfigSchema,
66
- userConfigSchema,
67
- validateAttribute,
68
- validateAttributeConfig,
69
- validateDraft,
70
- validateDraftOrThrow,
71
- validateObject,
72
- validateObjectOrThrow,
73
- validatePhoneNumber
74
- } from "./chunk-4362R5F2.mjs";
1
+ import { generateId } from './chunk-XAORXFAX.mjs';
2
+ export { asTenantId, asUserId, deepEqual, generateId, generatePrefixedId, generateTemplateName, indexBy, slugify } from './chunk-XAORXFAX.mjs';
3
+ import './chunk-EKG35CSO.mjs';
4
+ import { createObjectValidator, createAttributeValidator } from './chunk-67PQMHQA.mjs';
5
+ export { computeRecordStatus, createAttributeValidator, createDraftValidator, createFormAttributeValidator, createObjectValidator, getMissingRequiredAttributes, isRecordComplete, validateAttribute, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from './chunk-67PQMHQA.mjs';
6
+ export { createCheckboxValidator } from './chunk-5TLM4QXO.mjs';
7
+ export { createDateValidator } from './chunk-XEOG24K6.mjs';
8
+ export { createNumberValidator } from './chunk-PKG3E5MW.mjs';
9
+ export { createRatingValidator } from './chunk-X6VDDXG7.mjs';
10
+ export { createTextAreaValidator, createTextValidator } from './chunk-U7VN3RUE.mjs';
11
+ export { createMultiRelationValidator, createRelationValidator, createSingleRelationValidator } from './chunk-QL3UGPUG.mjs';
12
+ export { createRichtextValidator } from './chunk-VPEV3W34.mjs';
13
+ export { createMultiselectValidator, createSelectValidator, createStatusValidator } from './chunk-ZFL7DXAE.mjs';
14
+ export { createUserValidator } from './chunk-WGFQMQMV.mjs';
15
+ export { createFormulaValidator } from './chunk-4RGFTMQR.mjs';
16
+ export { createRollupValidator } from './chunk-NXXSNUDI.mjs';
17
+ export { attributeConfigSchemas, checkboxConfigSchema, currencyConfigSchema, dateConfigSchema, documentConfigSchema, fileConfigSchema, formulaConfigSchema, getAttributeConfigSchema, locationConfigSchema, multiselectConfigSchema, numberConfigSchema, parseAttributeConfig, phoneConfigSchema, ratingConfigSchema, relationConfigSchema, richtextConfigSchema, rollupConfigSchema, safeParseAttributeConfig, selectConfigSchema, statusConfigSchema, textConfigSchema, textareaConfigSchema, userConfigSchema, validateAttributeConfig } from './chunk-PZT3CIHD.mjs';
18
+ export { createCurrencyValidator } from './chunk-SVII65W7.mjs';
19
+ export { createFileValidator } from './chunk-MD6XGXTU.mjs';
20
+ export { createLocationValidator } from './chunk-ZM7W2ZCF.mjs';
21
+ import { formatPhoneForDisplay } from './chunk-EIWGW2ML.mjs';
22
+ export { createPhoneValidator, formatPhoneForDisplay, normalizePhoneNumber, parseRawPhoneInput, validatePhoneNumber } from './chunk-EIWGW2ML.mjs';
23
+ export { DEFAULT_VALIDATION_MESSAGES, createRegexCache, getCachedRegex } from './chunk-BIQ35DLC.mjs';
24
+ export { formatZodErrors } from './chunk-RDXQ4CYT.mjs';
25
+ import z3, { z } from 'zod';
26
+ import { ICONS, getCountryDisplayNameByIso3 } from '@stndrds/constants';
75
27
 
76
28
  // src/types/attribute-protection.ts
77
29
  var IDENTITY_PROPERTIES = ["name", "type"];
@@ -574,29 +526,39 @@ function isEndNode(node) {
574
526
  return node.type === "end";
575
527
  }
576
528
 
577
- // src/types/workflows/node-types/start.node-type.ts
578
- var startNodeType = {
579
- type: "start",
529
+ // src/types/workflows/node-types/ai.node-type.ts
530
+ var aiNodeType = {
531
+ type: "ai",
580
532
  isLinear: true,
581
- structural: true,
533
+ structural: false,
582
534
  getOutputs(node) {
583
535
  return node.next ? [node.next] : [];
584
536
  },
585
537
  setNext(node, targetId) {
586
538
  return { ...node, next: targetId };
587
539
  },
588
- getSlotIds() {
589
- return [];
540
+ getSlotIds(node) {
541
+ const slotIds = /* @__PURE__ */ new Set();
542
+ for (const id of node.inputSlotIds ?? []) slotIds.add(id);
543
+ for (const id of node.targetSlotIds ?? []) slotIds.add(id);
544
+ return [...slotIds];
590
545
  },
591
- validate() {
592
- return [];
546
+ validate(node) {
547
+ const errors = [];
548
+ if (!node.label) errors.push("AINode must have a label");
549
+ if (!node.mode) errors.push("AINode must have a mode (sync or async)");
550
+ if (!node.next) errors.push("AINode must have a 'next' target");
551
+ const hasAgentSource = !!node.definitionId || !!node.systemPrompt;
552
+ if (!hasAgentSource) {
553
+ errors.push("AINode must have either a definitionId or a systemPrompt");
554
+ }
555
+ return errors;
593
556
  }
594
557
  };
595
- nodeTypeRegistry.register(startNodeType);
596
558
 
597
- // src/types/workflows/node-types/form.node-type.ts
598
- var formNodeType = {
599
- type: "form",
559
+ // src/types/workflows/node-types/assign.node-type.ts
560
+ var assignNodeType = {
561
+ type: "assign",
600
562
  isLinear: true,
601
563
  structural: false,
602
564
  getOutputs(node) {
@@ -607,37 +569,36 @@ var formNodeType = {
607
569
  },
608
570
  getSlotIds(node) {
609
571
  const slotIds = /* @__PURE__ */ new Set();
610
- if (node.fields) {
611
- for (const field of node.fields) {
612
- if (field.slotId) {
613
- slotIds.add(field.slotId);
614
- }
615
- }
572
+ if (node.targetSlotId) {
573
+ slotIds.add(node.targetSlotId);
616
574
  }
617
- if (node.rows) {
618
- for (const row of node.rows) {
619
- if (isFlowFieldsRow(row)) {
620
- for (const field of row.fields) {
621
- if (field.slotId) {
622
- slotIds.add(field.slotId);
623
- }
624
- }
575
+ for (const assignment of node.assignments ?? []) {
576
+ const src = assignment.source;
577
+ if (src.type === "slot-ref") {
578
+ slotIds.add(src.slotId);
579
+ } else if (src.type === "expression") {
580
+ const matches = src.template.matchAll(/\{\{\s*([\w]+)\.\w+/g);
581
+ for (const match of matches) {
582
+ slotIds.add(match[1]);
625
583
  }
626
584
  }
627
585
  }
628
- return Array.from(slotIds);
586
+ return [...slotIds];
629
587
  },
630
588
  validate(node) {
631
589
  const errors = [];
632
- const hasFields = node.fields !== void 0 && node.fields.length > 0;
633
- const hasRows = node.rows !== void 0 && node.rows.length > 0;
634
- if (hasFields && hasRows) {
635
- errors.push("FormNode cannot have both 'fields' and 'rows'");
590
+ if (!node.targetSlotId) {
591
+ errors.push("AssignNode must have a target slot");
592
+ }
593
+ if (!node.assignments?.length) {
594
+ errors.push("AssignNode must have at least one assignment");
595
+ }
596
+ if (!node.next) {
597
+ errors.push("AssignNode must have a 'next' target");
636
598
  }
637
599
  return errors;
638
600
  }
639
601
  };
640
- nodeTypeRegistry.register(formNodeType);
641
602
 
642
603
  // src/types/workflows/node-types/condition.node-type.ts
643
604
  var conditionNodeType = {
@@ -663,11 +624,29 @@ var conditionNodeType = {
663
624
  return errors;
664
625
  }
665
626
  };
666
- nodeTypeRegistry.register(conditionNodeType);
667
627
 
668
- // src/types/workflows/node-types/assign.node-type.ts
669
- var assignNodeType = {
670
- type: "assign",
628
+ // src/types/workflows/node-types/end.node-type.ts
629
+ var endNodeType = {
630
+ type: "end",
631
+ isLinear: false,
632
+ structural: true,
633
+ getOutputs() {
634
+ return [];
635
+ },
636
+ setNext() {
637
+ throw new Error("[NodeTypeRegistry] EndNode does not support setNext.");
638
+ },
639
+ getSlotIds() {
640
+ return [];
641
+ },
642
+ validate() {
643
+ return [];
644
+ }
645
+ };
646
+
647
+ // src/types/workflows/node-types/form.node-type.ts
648
+ var formNodeType = {
649
+ type: "form",
671
650
  isLinear: true,
672
651
  structural: false,
673
652
  getOutputs(node) {
@@ -678,80 +657,48 @@ var assignNodeType = {
678
657
  },
679
658
  getSlotIds(node) {
680
659
  const slotIds = /* @__PURE__ */ new Set();
681
- if (node.targetSlotId) {
682
- slotIds.add(node.targetSlotId);
660
+ if (node.fields) {
661
+ for (const field of node.fields) {
662
+ if (field.slotId) {
663
+ slotIds.add(field.slotId);
664
+ }
665
+ }
683
666
  }
684
- for (const assignment of node.assignments ?? []) {
685
- const src = assignment.source;
686
- if (src.type === "slot-ref") {
687
- slotIds.add(src.slotId);
688
- } else if (src.type === "expression") {
689
- const matches = src.template.matchAll(/\{\{\s*([\w]+)\.\w+/g);
690
- for (const match of matches) {
691
- slotIds.add(match[1]);
667
+ if (node.rows) {
668
+ for (const row of node.rows) {
669
+ if (isFlowFieldsRow(row)) {
670
+ for (const field of row.fields) {
671
+ if (field.slotId) {
672
+ slotIds.add(field.slotId);
673
+ }
674
+ }
692
675
  }
693
676
  }
694
677
  }
695
- return [...slotIds];
678
+ return Array.from(slotIds);
696
679
  },
697
680
  validate(node) {
698
681
  const errors = [];
699
- if (!node.targetSlotId) {
700
- errors.push("AssignNode must have a target slot");
701
- }
702
- if (!node.assignments?.length) {
703
- errors.push("AssignNode must have at least one assignment");
704
- }
705
- if (!node.next) {
706
- errors.push("AssignNode must have a 'next' target");
682
+ const hasFields = node.fields !== void 0 && node.fields.length > 0;
683
+ const hasRows = node.rows !== void 0 && node.rows.length > 0;
684
+ if (hasFields && hasRows) {
685
+ errors.push("FormNode cannot have both 'fields' and 'rows'");
707
686
  }
708
687
  return errors;
709
688
  }
710
689
  };
711
- nodeTypeRegistry.register(assignNodeType);
712
690
 
713
- // src/types/workflows/node-types/ai.node-type.ts
714
- var aiNodeType = {
715
- type: "ai",
691
+ // src/types/workflows/node-types/start.node-type.ts
692
+ var startNodeType = {
693
+ type: "start",
716
694
  isLinear: true,
717
- structural: false,
695
+ structural: true,
718
696
  getOutputs(node) {
719
697
  return node.next ? [node.next] : [];
720
698
  },
721
699
  setNext(node, targetId) {
722
700
  return { ...node, next: targetId };
723
701
  },
724
- getSlotIds(node) {
725
- const slotIds = /* @__PURE__ */ new Set();
726
- for (const id of node.inputSlotIds ?? []) slotIds.add(id);
727
- for (const id of node.targetSlotIds ?? []) slotIds.add(id);
728
- return [...slotIds];
729
- },
730
- validate(node) {
731
- const errors = [];
732
- if (!node.label) errors.push("AINode must have a label");
733
- if (!node.mode) errors.push("AINode must have a mode (sync or async)");
734
- if (!node.next) errors.push("AINode must have a 'next' target");
735
- const hasAgentSource = !!node.definitionId || !!node.systemPrompt;
736
- if (!hasAgentSource) {
737
- errors.push("AINode must have either a definitionId or a systemPrompt");
738
- }
739
- return errors;
740
- }
741
- };
742
- nodeTypeRegistry.register(aiNodeType);
743
-
744
- // src/types/workflows/node-types/end.node-type.ts
745
- var endNodeType = {
746
- type: "end",
747
- isLinear: false,
748
- structural: true,
749
- getOutputs() {
750
- return [];
751
- },
752
- setNext() {
753
- throw new Error("[NodeTypeRegistry] EndNode does not support setNext.");
754
- },
755
702
  getSlotIds() {
756
703
  return [];
757
704
  },
@@ -759,7 +706,20 @@ var endNodeType = {
759
706
  return [];
760
707
  }
761
708
  };
762
- nodeTypeRegistry.register(endNodeType);
709
+
710
+ // src/types/workflows/node-types/index.ts
711
+ var registered = false;
712
+ function registerBuiltInNodeTypes() {
713
+ if (registered) return;
714
+ registered = true;
715
+ nodeTypeRegistry.register(startNodeType);
716
+ nodeTypeRegistry.register(formNodeType);
717
+ nodeTypeRegistry.register(conditionNodeType);
718
+ nodeTypeRegistry.register(assignNodeType);
719
+ nodeTypeRegistry.register(aiNodeType);
720
+ nodeTypeRegistry.register(endNodeType);
721
+ }
722
+ registerBuiltInNodeTypes();
763
723
 
764
724
  // src/types/workflows/conditions.ts
765
725
  function isConditionRule(item) {
@@ -1013,9 +973,7 @@ function groupNodesByZone(orderedNodes) {
1013
973
  function getZoneAllowedTypes(zone) {
1014
974
  return ZONE_CONFIG[zone].allowedNodeTypes;
1015
975
  }
1016
-
1017
- // src/types/workflows/validation.ts
1018
- import { z } from "zod";
976
+ registerBuiltInNodeTypes();
1019
977
  var ConditionOperatorSchema = z.enum([
1020
978
  "eq",
1021
979
  "neq",
@@ -1036,12 +994,12 @@ var ConditionRuleSchema = z.object({
1036
994
  operator: ConditionOperatorSchema,
1037
995
  value: z.unknown()
1038
996
  });
1039
- var ConditionGroupSchema = z.lazy(
1040
- () => z.object({
1041
- operator: z.enum(["and", "or"]),
1042
- rules: z.array(z.union([ConditionRuleSchema, ConditionGroupSchema])).min(1)
1043
- })
1044
- );
997
+ var ConditionGroupSchema = z.object({
998
+ operator: z.enum(["and", "or"]),
999
+ get rules() {
1000
+ return z.array(z.union([ConditionRuleSchema, ConditionGroupSchema])).min(1);
1001
+ }
1002
+ });
1045
1003
  var StartNodeSchema = z.object({
1046
1004
  type: z.literal("start"),
1047
1005
  id: z.string().min(1),
@@ -1187,9 +1145,9 @@ var WorkflowSlotSchema = z.object({
1187
1145
  var AuthMethodSchema = z.enum(["signed_link", "pin_code"]);
1188
1146
  var ShareStatusSchema = z.enum(["pending", "active", "expired", "revoked"]);
1189
1147
  var WorkflowShareSchema = z.object({
1190
- id: z.string().uuid(),
1191
- instanceId: z.string().uuid(),
1192
- email: z.string().email(),
1148
+ id: z.uuid(),
1149
+ instanceId: z.uuid(),
1150
+ email: z.email(),
1193
1151
  name: z.string().optional(),
1194
1152
  phone: z.string().optional(),
1195
1153
  authMethod: AuthMethodSchema,
@@ -1204,8 +1162,8 @@ var WorkflowShareSchema = z.object({
1204
1162
  lastAccessAt: z.coerce.date().optional()
1205
1163
  });
1206
1164
  var CreateShareInputSchema = z.object({
1207
- instanceId: z.string().uuid(),
1208
- email: z.string().email(),
1165
+ instanceId: z.uuid(),
1166
+ email: z.email(),
1209
1167
  name: z.string().optional(),
1210
1168
  phone: z.string().optional(),
1211
1169
  authMethod: AuthMethodSchema,
@@ -1235,7 +1193,7 @@ var ThemeColorsSchema = z.object({
1235
1193
  accent: z.string().optional()
1236
1194
  });
1237
1195
  var ThemeLogoSchema = z.object({
1238
- url: z.string().url(),
1196
+ url: z.url(),
1239
1197
  alt: z.string().optional(),
1240
1198
  maxHeight: z.number().positive().optional()
1241
1199
  });
@@ -1307,6 +1265,9 @@ var WorkflowDefinitionSchema = z.object({
1307
1265
  }
1308
1266
  );
1309
1267
 
1268
+ // src/types/workflows/index.ts
1269
+ registerBuiltInNodeTypes();
1270
+
1310
1271
  // src/types/migrations.ts
1311
1272
  var DEFAULT_RETENTION_POLICY = {
1312
1273
  attributeData: 30,
@@ -1334,9 +1295,6 @@ function toUndefinedIfEmpty(obj) {
1334
1295
  function hasProperties(obj) {
1335
1296
  return isNotEmpty2(obj);
1336
1297
  }
1337
-
1338
- // src/format.ts
1339
- import { getCountryDisplayNameByIso3 } from "@stndrds/constants";
1340
1298
  var EMPTY_VALUE_PLACEHOLDER = "\u2014";
1341
1299
  function formatText(value) {
1342
1300
  return String(value);
@@ -1465,7 +1423,7 @@ function formatAttributeValue(value, attribute) {
1465
1423
  case "number":
1466
1424
  return formatNumber(value, attribute);
1467
1425
  case "currency":
1468
- return formatCurrency(value, attribute);
1426
+ return formatCurrency(value);
1469
1427
  case "date":
1470
1428
  return formatDate(value);
1471
1429
  case "phone":
@@ -1495,8 +1453,46 @@ function formatAttributeValue(value, attribute) {
1495
1453
  }
1496
1454
  }
1497
1455
  }
1498
-
1499
- // src/lib/template.ts
1456
+ var SIMPLE_PIPES = ["UPPER", "LOWER", "capitalize", "trim"];
1457
+ var PIPES_WITH_ARGS = ["prefix", "suffix", "wrap", "default"];
1458
+ var ALL_PIPES = [...SIMPLE_PIPES, ...PIPES_WITH_ARGS];
1459
+ var labelExpressionSchema = z.string().min(1, "labelExpression cannot be empty").refine((val) => isLabelExpression(val), {
1460
+ message: "labelExpression must contain at least one {{ attribute }} interpolation"
1461
+ }).refine(
1462
+ (val) => {
1463
+ const emptyCheck = /\{\{\s*\}\}/;
1464
+ return !emptyCheck.test(val);
1465
+ },
1466
+ { message: "labelExpression contains empty {{ }} interpolation" }
1467
+ ).refine(
1468
+ (val) => {
1469
+ const pipePattern = /(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g;
1470
+ let match;
1471
+ while ((match = pipePattern.exec(val)) !== null) {
1472
+ const pipeName = match[1];
1473
+ if (!ALL_PIPES.includes(pipeName)) {
1474
+ return false;
1475
+ }
1476
+ }
1477
+ return true;
1478
+ },
1479
+ {
1480
+ message: `Invalid pipe name. Valid pipes: ${ALL_PIPES.join(", ")}`
1481
+ }
1482
+ );
1483
+ function validateLabelExpression(expression) {
1484
+ const result = labelExpressionSchema.safeParse(expression);
1485
+ if (!result.success) {
1486
+ return {
1487
+ success: false,
1488
+ error: result.error.issues[0]?.message ?? "Invalid labelExpression"
1489
+ };
1490
+ }
1491
+ return {
1492
+ success: true,
1493
+ attributes: extractAttributeNames(expression)
1494
+ };
1495
+ }
1500
1496
  var simplePipes = {
1501
1497
  /** Convert to uppercase */
1502
1498
  UPPER: (v) => String(v).toUpperCase(),
@@ -1682,6 +1678,8 @@ var SchemaErrorCode = {
1682
1678
  USER_PROFILE_NOT_FOUND: "SCHEMA_USER_PROFILE_NOT_FOUND",
1683
1679
  FILE_NOT_FOUND: "SCHEMA_FILE_NOT_FOUND",
1684
1680
  ROLE_NOT_FOUND: "SCHEMA_ROLE_NOT_FOUND",
1681
+ MEMORY_NOT_FOUND: "SCHEMA_MEMORY_NOT_FOUND",
1682
+ CONVERSATION_NOT_FOUND: "SCHEMA_CONVERSATION_NOT_FOUND",
1685
1683
  // Validation
1686
1684
  VALIDATION_FAILED: "SCHEMA_VALIDATION_FAILED",
1687
1685
  INVALID_ATTRIBUTE_NAME: "SCHEMA_INVALID_ATTRIBUTE_NAME",
@@ -1693,6 +1691,7 @@ var SchemaErrorCode = {
1693
1691
  PROTECTED_ROLE: "SCHEMA_PROTECTED_ROLE",
1694
1692
  // Permissions
1695
1693
  FORBIDDEN: "SCHEMA_FORBIDDEN",
1694
+ ACCESS_DENIED: "SCHEMA_ACCESS_DENIED",
1696
1695
  // Sync
1697
1696
  SYNC_FAILED: "SCHEMA_SYNC_FAILED",
1698
1697
  NOT_SYSTEM_OBJECT: "SCHEMA_NOT_SYSTEM_OBJECT",
@@ -1700,7 +1699,19 @@ var SchemaErrorCode = {
1700
1699
  DUPLICATE_OBJECT: "SCHEMA_DUPLICATE_OBJECT",
1701
1700
  DUPLICATE_ATTRIBUTE: "SCHEMA_DUPLICATE_ATTRIBUTE",
1702
1701
  // Concurrency
1703
- CONFLICT: "SCHEMA_CONFLICT"
1702
+ CONFLICT: "SCHEMA_CONFLICT",
1703
+ // Storage
1704
+ STORAGE_UPLOAD_FAILED: "SCHEMA_STORAGE_UPLOAD_FAILED",
1705
+ STORAGE_DOWNLOAD_FAILED: "SCHEMA_STORAGE_DOWNLOAD_FAILED",
1706
+ STORAGE_DELETE_FAILED: "SCHEMA_STORAGE_DELETE_FAILED",
1707
+ STORAGE_URL_FAILED: "SCHEMA_STORAGE_URL_FAILED",
1708
+ // Repository Operations
1709
+ REPOSITORY_CREATE_FAILED: "SCHEMA_REPOSITORY_CREATE_FAILED",
1710
+ REPOSITORY_UPDATE_FAILED: "SCHEMA_REPOSITORY_UPDATE_FAILED",
1711
+ REPOSITORY_DELETE_FAILED: "SCHEMA_REPOSITORY_DELETE_FAILED",
1712
+ REPOSITORY_QUERY_FAILED: "SCHEMA_REPOSITORY_QUERY_FAILED",
1713
+ // Not Implemented
1714
+ NOT_IMPLEMENTED: "SCHEMA_NOT_IMPLEMENTED"
1704
1715
  };
1705
1716
  var SchemaError = class extends Error {
1706
1717
  constructor(message, code = SchemaErrorCode.UNKNOWN, details) {
@@ -1881,9 +1892,107 @@ var ConcurrentModificationError = class extends SchemaError {
1881
1892
  );
1882
1893
  }
1883
1894
  };
1895
+ var StorageError = class extends SchemaError {
1896
+ constructor(operation, message, path, cause) {
1897
+ const code = operation === "upload" ? SchemaErrorCode.STORAGE_UPLOAD_FAILED : operation === "download" ? SchemaErrorCode.STORAGE_DOWNLOAD_FAILED : operation === "delete" ? SchemaErrorCode.STORAGE_DELETE_FAILED : SchemaErrorCode.STORAGE_URL_FAILED;
1898
+ super(`Storage ${operation} failed: ${message}`, code, {
1899
+ operation,
1900
+ path,
1901
+ cause
1902
+ });
1903
+ this.name = "StorageError";
1904
+ this.operation = operation;
1905
+ this.path = path;
1906
+ this.cause = cause;
1907
+ }
1908
+ };
1909
+ function isStorageError(error) {
1910
+ return error instanceof StorageError;
1911
+ }
1912
+ var AccessDeniedError = class extends SchemaError {
1913
+ constructor(resource, reason) {
1914
+ super(reason ?? `Access denied to resource: ${resource}`, SchemaErrorCode.ACCESS_DENIED, {
1915
+ resource,
1916
+ reason
1917
+ });
1918
+ this.name = "AccessDeniedError";
1919
+ this.resource = resource;
1920
+ this.reason = reason;
1921
+ }
1922
+ };
1923
+ function isAccessDeniedError(error) {
1924
+ return error instanceof AccessDeniedError;
1925
+ }
1926
+ var RepositoryError = class extends SchemaError {
1927
+ constructor(operation, entity, message, cause) {
1928
+ const code = operation === "create" ? SchemaErrorCode.REPOSITORY_CREATE_FAILED : operation === "update" ? SchemaErrorCode.REPOSITORY_UPDATE_FAILED : operation === "delete" ? SchemaErrorCode.REPOSITORY_DELETE_FAILED : SchemaErrorCode.REPOSITORY_QUERY_FAILED;
1929
+ super(`Failed to ${operation} ${entity}: ${message}`, code, {
1930
+ operation,
1931
+ entity,
1932
+ cause
1933
+ });
1934
+ this.name = "RepositoryError";
1935
+ this.operation = operation;
1936
+ this.entity = entity;
1937
+ this.cause = cause;
1938
+ }
1939
+ };
1940
+ function isRepositoryError(error) {
1941
+ return error instanceof RepositoryError;
1942
+ }
1943
+ var NotImplementedError = class extends SchemaError {
1944
+ constructor(feature, milestone) {
1945
+ const message = milestone ? `${feature}: not implemented (${milestone})` : `${feature}: not implemented`;
1946
+ super(message, SchemaErrorCode.NOT_IMPLEMENTED, {
1947
+ feature,
1948
+ milestone
1949
+ });
1950
+ this.name = "NotImplementedError";
1951
+ this.feature = feature;
1952
+ this.milestone = milestone;
1953
+ }
1954
+ };
1955
+ function isNotImplementedError(error) {
1956
+ return error instanceof NotImplementedError;
1957
+ }
1958
+ var MemoryNotFoundError = class extends NotFoundError {
1959
+ constructor(memoryId) {
1960
+ super("Memory", memoryId, SchemaErrorCode.MEMORY_NOT_FOUND);
1961
+ this.name = "MemoryNotFoundError";
1962
+ }
1963
+ };
1964
+ var ConversationNotFoundError = class extends NotFoundError {
1965
+ constructor(conversationId) {
1966
+ super("Conversation", conversationId, SchemaErrorCode.CONVERSATION_NOT_FOUND);
1967
+ this.name = "ConversationNotFoundError";
1968
+ }
1969
+ };
1884
1970
 
1885
- // src/builders/attribute-validators.ts
1886
- import { ICONS } from "@stndrds/constants";
1971
+ // src/standard-schema.ts
1972
+ var STANDARD_SCHEMA_VENDOR = "@stndrds/schema";
1973
+ function createStandardSchemaProps(zodSchema) {
1974
+ return {
1975
+ version: 1,
1976
+ vendor: STANDARD_SCHEMA_VENDOR,
1977
+ validate: (value) => {
1978
+ const result = zodSchema.safeParse(value);
1979
+ if (result.success) {
1980
+ return { value: result.data };
1981
+ }
1982
+ return {
1983
+ issues: result.error.issues.map((issue) => ({
1984
+ message: issue.message,
1985
+ // Zod path segments are string | number which are valid PropertyKey
1986
+ // for Standard Schema v1 (no conversion needed)
1987
+ path: issue.path
1988
+ }))
1989
+ };
1990
+ }
1991
+ };
1992
+ }
1993
+ function isStandardSchema(obj) {
1994
+ return typeof obj === "object" && obj !== null && "~standard" in obj && typeof obj["~standard"] === "object" && obj["~standard"].version === 1;
1995
+ }
1887
1996
  var VALID_ICONS = new Set(ICONS);
1888
1997
  var ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
1889
1998
  var MAX_NAME_LENGTH = 63;
@@ -1980,7 +2089,22 @@ function validateOptions(options, attributeName) {
1980
2089
  }
1981
2090
 
1982
2091
  // src/builders/attribute-builders.ts
2092
+ function asMutableArray(arr) {
2093
+ return arr;
2094
+ }
1983
2095
  var BaseAttributeBuilder = class {
2096
+ /**
2097
+ * Standard Schema v1 interface implementation.
2098
+ *
2099
+ * This property enables interoperability with libraries that support
2100
+ * Standard Schema (React Hook Form, tRPC, etc.).
2101
+ *
2102
+ * @see https://standardschema.dev/
2103
+ */
2104
+ get "~standard"() {
2105
+ const zodSchema = createAttributeValidator(this.build());
2106
+ return createStandardSchemaProps(zodSchema);
2107
+ }
1984
2108
  constructor(type, name, label) {
1985
2109
  validateAttributeName(name);
1986
2110
  validateLabel(label);
@@ -1994,6 +2118,41 @@ var BaseAttributeBuilder = class {
1994
2118
  setRequired(value) {
1995
2119
  this.attr.required = value;
1996
2120
  }
2121
+ /**
2122
+ * Type-safe method to return this builder with a different TRequired phantom type.
2123
+ *
2124
+ * This method centralizes the type assertion needed when transitioning between
2125
+ * required states. The assertion is safe because:
2126
+ * 1. The runtime representation is unchanged (same instance)
2127
+ * 2. Only the phantom _types.required property differs
2128
+ * 3. The class structure and all methods remain identical
2129
+ *
2130
+ * Using a single protected method for this pattern:
2131
+ * - Reduces scattered unsafe casts throughout the codebase
2132
+ * - Documents the safety reasoning in one place
2133
+ * - Makes the type transition explicit and auditable
2134
+ *
2135
+ * @internal
2136
+ */
2137
+ asRequiredState() {
2138
+ return this;
2139
+ }
2140
+ /**
2141
+ * Type-safe method to return this builder with different phantom type parameters.
2142
+ *
2143
+ * Used by builders with additional type parameters (like TOptions in Status/Select/Multiselect)
2144
+ * when those parameters need to change while preserving the builder instance.
2145
+ *
2146
+ * The assertion is safe because:
2147
+ * 1. The runtime representation is unchanged (same instance)
2148
+ * 2. Only phantom type parameters differ
2149
+ * 3. The class structure and all methods remain identical
2150
+ *
2151
+ * @internal
2152
+ */
2153
+ asPhantomState() {
2154
+ return this;
2155
+ }
1997
2156
  system() {
1998
2157
  this.attr.system = true;
1999
2158
  return this;
@@ -2081,11 +2240,11 @@ var TextAttributeBuilder = class extends BaseAttributeBuilder {
2081
2240
  }
2082
2241
  required() {
2083
2242
  this.setRequired(true);
2084
- return this;
2243
+ return this.asRequiredState();
2085
2244
  }
2086
2245
  optional() {
2087
2246
  this.setRequired(false);
2088
- return this;
2247
+ return this.asRequiredState();
2089
2248
  }
2090
2249
  /**
2091
2250
  * Set email validation pattern
@@ -2118,11 +2277,11 @@ var TextAreaAttributeBuilder = class extends BaseAttributeBuilder {
2118
2277
  }
2119
2278
  required() {
2120
2279
  this.setRequired(true);
2121
- return this;
2280
+ return this.asRequiredState();
2122
2281
  }
2123
2282
  optional() {
2124
2283
  this.setRequired(false);
2125
- return this;
2284
+ return this.asRequiredState();
2126
2285
  }
2127
2286
  };
2128
2287
  function textarea(config) {
@@ -2150,11 +2309,11 @@ var RichtextAttributeBuilder = class extends BaseAttributeBuilder {
2150
2309
  }
2151
2310
  required() {
2152
2311
  this.setRequired(true);
2153
- return this;
2312
+ return this.asRequiredState();
2154
2313
  }
2155
2314
  optional() {
2156
2315
  this.setRequired(false);
2157
- return this;
2316
+ return this.asRequiredState();
2158
2317
  }
2159
2318
  };
2160
2319
  function richtext(config) {
@@ -2188,11 +2347,11 @@ var NumberAttributeBuilder = class extends BaseAttributeBuilder {
2188
2347
  }
2189
2348
  required() {
2190
2349
  this.setRequired(true);
2191
- return this;
2350
+ return this.asRequiredState();
2192
2351
  }
2193
2352
  optional() {
2194
2353
  this.setRequired(false);
2195
- return this;
2354
+ return this.asRequiredState();
2196
2355
  }
2197
2356
  };
2198
2357
  function number(config) {
@@ -2204,11 +2363,11 @@ var CheckboxAttributeBuilder = class extends BaseAttributeBuilder {
2204
2363
  }
2205
2364
  required() {
2206
2365
  this.setRequired(true);
2207
- return this;
2366
+ return this.asRequiredState();
2208
2367
  }
2209
2368
  optional() {
2210
2369
  this.setRequired(false);
2211
- return this;
2370
+ return this.asRequiredState();
2212
2371
  }
2213
2372
  };
2214
2373
  function checkbox(config) {
@@ -2232,11 +2391,11 @@ var DateAttributeBuilder = class extends BaseAttributeBuilder {
2232
2391
  }
2233
2392
  required() {
2234
2393
  this.setRequired(true);
2235
- return this;
2394
+ return this.asRequiredState();
2236
2395
  }
2237
2396
  optional() {
2238
2397
  this.setRequired(false);
2239
- return this;
2398
+ return this.asRequiredState();
2240
2399
  }
2241
2400
  };
2242
2401
  function date(config) {
@@ -2252,11 +2411,11 @@ var PhoneAttributeBuilder = class extends BaseAttributeBuilder {
2252
2411
  }
2253
2412
  required() {
2254
2413
  this.setRequired(true);
2255
- return this;
2414
+ return this.asRequiredState();
2256
2415
  }
2257
2416
  optional() {
2258
2417
  this.setRequired(false);
2259
- return this;
2418
+ return this.asRequiredState();
2260
2419
  }
2261
2420
  };
2262
2421
  function phone(config) {
@@ -2276,11 +2435,11 @@ var CurrencyAttributeBuilder = class extends BaseAttributeBuilder {
2276
2435
  }
2277
2436
  required() {
2278
2437
  this.setRequired(true);
2279
- return this;
2438
+ return this.asRequiredState();
2280
2439
  }
2281
2440
  optional() {
2282
2441
  this.setRequired(false);
2283
- return this;
2442
+ return this.asRequiredState();
2284
2443
  }
2285
2444
  };
2286
2445
  function currency(config) {
@@ -2294,9 +2453,10 @@ var StatusAttributeBuilder = class extends BaseAttributeBuilder {
2294
2453
  * Set all options at once (preserves literal types for values)
2295
2454
  */
2296
2455
  options(value) {
2297
- validateOptions(value, this.attr.name ?? "unknown");
2298
- this.attr.options = value;
2299
- return this;
2456
+ const mutableOptions = asMutableArray(value);
2457
+ validateOptions(mutableOptions, this.attr.name ?? "unknown");
2458
+ this.attr.options = mutableOptions;
2459
+ return this.asPhantomState();
2300
2460
  }
2301
2461
  option(config) {
2302
2462
  if (!this.attr.options) {
@@ -2309,11 +2469,11 @@ var StatusAttributeBuilder = class extends BaseAttributeBuilder {
2309
2469
  }
2310
2470
  required() {
2311
2471
  this.setRequired(true);
2312
- return this;
2472
+ return this.asRequiredState();
2313
2473
  }
2314
2474
  optional() {
2315
2475
  this.setRequired(false);
2316
- return this;
2476
+ return this.asRequiredState();
2317
2477
  }
2318
2478
  };
2319
2479
  function status(config) {
@@ -2327,9 +2487,10 @@ var SelectAttributeBuilder = class extends BaseAttributeBuilder {
2327
2487
  * Set all options at once (preserves literal types for values)
2328
2488
  */
2329
2489
  options(value) {
2330
- validateOptions(value, this.attr.name ?? "unknown");
2331
- this.attr.options = value;
2332
- return this;
2490
+ const mutableOptions = asMutableArray(value);
2491
+ validateOptions(mutableOptions, this.attr.name ?? "unknown");
2492
+ this.attr.options = mutableOptions;
2493
+ return this.asPhantomState();
2333
2494
  }
2334
2495
  option(config) {
2335
2496
  if (!this.attr.options) {
@@ -2342,11 +2503,11 @@ var SelectAttributeBuilder = class extends BaseAttributeBuilder {
2342
2503
  }
2343
2504
  required() {
2344
2505
  this.setRequired(true);
2345
- return this;
2506
+ return this.asRequiredState();
2346
2507
  }
2347
2508
  optional() {
2348
2509
  this.setRequired(false);
2349
- return this;
2510
+ return this.asRequiredState();
2350
2511
  }
2351
2512
  };
2352
2513
  function select(config) {
@@ -2360,9 +2521,10 @@ var MultiselectAttributeBuilder = class extends BaseAttributeBuilder {
2360
2521
  * Set all options at once (preserves literal types for values)
2361
2522
  */
2362
2523
  options(value) {
2363
- validateOptions(value, this.attr.name ?? "unknown");
2364
- this.attr.options = value;
2365
- return this;
2524
+ const mutableOptions = asMutableArray(value);
2525
+ validateOptions(mutableOptions, this.attr.name ?? "unknown");
2526
+ this.attr.options = mutableOptions;
2527
+ return this.asPhantomState();
2366
2528
  }
2367
2529
  option(config) {
2368
2530
  if (!this.attr.options) {
@@ -2375,11 +2537,11 @@ var MultiselectAttributeBuilder = class extends BaseAttributeBuilder {
2375
2537
  }
2376
2538
  required() {
2377
2539
  this.setRequired(true);
2378
- return this;
2540
+ return this.asRequiredState();
2379
2541
  }
2380
2542
  optional() {
2381
2543
  this.setRequired(false);
2382
- return this;
2544
+ return this.asRequiredState();
2383
2545
  }
2384
2546
  };
2385
2547
  function multiselect(config) {
@@ -2415,11 +2577,11 @@ var LocationAttributeBuilder = class extends BaseAttributeBuilder {
2415
2577
  }
2416
2578
  required() {
2417
2579
  this.setRequired(true);
2418
- return this;
2580
+ return this.asRequiredState();
2419
2581
  }
2420
2582
  optional() {
2421
2583
  this.setRequired(false);
2422
- return this;
2584
+ return this.asRequiredState();
2423
2585
  }
2424
2586
  };
2425
2587
  function location(config) {
@@ -2438,7 +2600,7 @@ var FileAttributeBuilder = class extends BaseAttributeBuilder {
2438
2600
  return this;
2439
2601
  }
2440
2602
  allowedTypes(types) {
2441
- this.attr.allowedTypes = types;
2603
+ this.attr.allowedTypes = asMutableArray(types);
2442
2604
  return this;
2443
2605
  }
2444
2606
  /**
@@ -2450,11 +2612,11 @@ var FileAttributeBuilder = class extends BaseAttributeBuilder {
2450
2612
  }
2451
2613
  required() {
2452
2614
  this.setRequired(true);
2453
- return this;
2615
+ return this.asRequiredState();
2454
2616
  }
2455
2617
  optional() {
2456
2618
  this.setRequired(false);
2457
- return this;
2619
+ return this.asRequiredState();
2458
2620
  }
2459
2621
  };
2460
2622
  function file(config) {
@@ -2477,11 +2639,11 @@ var UserAttributeBuilder = class extends BaseAttributeBuilder {
2477
2639
  }
2478
2640
  required() {
2479
2641
  this.setRequired(true);
2480
- return this;
2642
+ return this.asRequiredState();
2481
2643
  }
2482
2644
  optional() {
2483
2645
  this.setRequired(false);
2484
- return this;
2646
+ return this.asRequiredState();
2485
2647
  }
2486
2648
  };
2487
2649
  function user(config) {
@@ -2599,11 +2761,11 @@ var SingleRelationAttributeBuilder = class extends BaseRelationAttributeBuilder
2599
2761
  }
2600
2762
  required() {
2601
2763
  this.setRequired(true);
2602
- return this;
2764
+ return this.asRequiredState();
2603
2765
  }
2604
2766
  optional() {
2605
2767
  this.setRequired(false);
2606
- return this;
2768
+ return this.asRequiredState();
2607
2769
  }
2608
2770
  };
2609
2771
  var MultiRelationAttributeBuilder = class extends BaseRelationAttributeBuilder {
@@ -2632,11 +2794,11 @@ var MultiRelationAttributeBuilder = class extends BaseRelationAttributeBuilder {
2632
2794
  }
2633
2795
  required() {
2634
2796
  this.setRequired(true);
2635
- return this;
2797
+ return this.asRequiredState();
2636
2798
  }
2637
2799
  optional() {
2638
2800
  this.setRequired(false);
2639
- return this;
2801
+ return this.asRequiredState();
2640
2802
  }
2641
2803
  };
2642
2804
  function relation(config) {
@@ -2656,11 +2818,11 @@ var RatingAttributeBuilder = class extends BaseAttributeBuilder {
2656
2818
  }
2657
2819
  required() {
2658
2820
  this.setRequired(true);
2659
- return this;
2821
+ return this.asRequiredState();
2660
2822
  }
2661
2823
  optional() {
2662
2824
  this.setRequired(false);
2663
- return this;
2825
+ return this.asRequiredState();
2664
2826
  }
2665
2827
  };
2666
2828
  function rating(config) {
@@ -2817,23 +2979,20 @@ var DocumentAttributeBuilder = class extends BaseAttributeBuilder {
2817
2979
  */
2818
2980
  required() {
2819
2981
  this.setRequired(true);
2820
- return this;
2982
+ return this.asRequiredState();
2821
2983
  }
2822
2984
  /**
2823
2985
  * Mark this attribute as optional (undo required).
2824
2986
  */
2825
2987
  optional() {
2826
2988
  this.setRequired(false);
2827
- return this;
2989
+ return this.asRequiredState();
2828
2990
  }
2829
2991
  };
2830
2992
  function document(config) {
2831
2993
  return new DocumentAttributeBuilder(config.name, config.label);
2832
2994
  }
2833
2995
 
2834
- // src/builders/object-builder.ts
2835
- import z2 from "zod";
2836
-
2837
2996
  // src/builders/migration-builder.ts
2838
2997
  function resolveBuiltInTransform(targetType) {
2839
2998
  const map = {
@@ -2981,6 +3140,18 @@ var ObjectBuilder = class {
2981
3140
  system: false
2982
3141
  };
2983
3142
  }
3143
+ /**
3144
+ * Standard Schema v1 interface implementation.
3145
+ *
3146
+ * This property enables interoperability with libraries that support
3147
+ * Standard Schema (React Hook Form, tRPC, etc.).
3148
+ *
3149
+ * @see https://standardschema.dev/
3150
+ */
3151
+ get "~standard"() {
3152
+ const zodSchema = createObjectValidator(this.build());
3153
+ return createStandardSchemaProps(zodSchema);
3154
+ }
2984
3155
  /**
2985
3156
  * Set object description
2986
3157
  */
@@ -3119,6 +3290,13 @@ The labelExpression defines how records are displayed in lists and relations.
3119
3290
  \u2705 Example: .labelExpression("{{ firstName }} {{ lastName }}")`
3120
3291
  );
3121
3292
  }
3293
+ const labelResult = labelExpressionSchema.safeParse(this._labelExpression);
3294
+ if (!labelResult.success) {
3295
+ const errorMsg = labelResult.error.issues[0]?.message ?? "Invalid labelExpression";
3296
+ throw new Error(
3297
+ `[ObjectBuilder] Invalid labelExpression for "${this.obj.name}": ${errorMsg}`
3298
+ );
3299
+ }
3122
3300
  const sortedVersions = [...this._migrations].sort((a, b) => a.version - b.version);
3123
3301
  for (let i = 0; i < sortedVersions.length; i++) {
3124
3302
  const expected = i + 2;
@@ -3146,13 +3324,13 @@ The labelExpression defines how records are displayed in lists and relations.
3146
3324
  if (name === void 0) {
3147
3325
  return;
3148
3326
  }
3149
- const objectNameSchema = z2.string().min(1, "Object name cannot be empty").max(63, "Object name is too long (max 63 characters)").regex(/^[a-z][a-z0-9-]*$/, {
3327
+ const objectNameSchema = z3.string().min(1, "Object name cannot be empty").max(63, "Object name is too long (max 63 characters)").regex(/^[a-z][a-z0-9-]*$/, {
3150
3328
  message: "Invalid object name format.\nName must be in kebab-case (slug format):\n \u2705 Valid: 'products', 'user-profiles', 'order-items'\n \u274C Invalid: 'Products', 'userProfiles', 'user_profiles'"
3151
3329
  });
3152
3330
  try {
3153
3331
  objectNameSchema.parse(name);
3154
3332
  } catch (error) {
3155
- if (error instanceof z2.ZodError) {
3333
+ if (error instanceof z3.ZodError) {
3156
3334
  throw new Error(`[ObjectBuilder] ${error.issues[0].message}`);
3157
3335
  }
3158
3336
  throw error;
@@ -3162,9 +3340,6 @@ The labelExpression defines how records are displayed in lists and relations.
3162
3340
  function object(config) {
3163
3341
  return new ObjectBuilder(config);
3164
3342
  }
3165
-
3166
- // src/builders/view-builder.ts
3167
- import { z as z3 } from "zod";
3168
3343
  var GroupBuilder = class {
3169
3344
  constructor(id, label) {
3170
3345
  this.data = { fields: [] };
@@ -3955,13 +4130,13 @@ var DetailViewBuilder = class {
3955
4130
  * Validate view name format (kebab-case)
3956
4131
  */
3957
4132
  validateName(name) {
3958
- const viewNameSchema = z3.string().min(1, "View name cannot be empty").max(63, "View name is too long (max 63 characters)").regex(/^[a-z][a-z0-9-]*$/, {
4133
+ const viewNameSchema = z.string().min(1, "View name cannot be empty").max(63, "View name is too long (max 63 characters)").regex(/^[a-z][a-z0-9-]*$/, {
3959
4134
  message: "Invalid view name format.\nName must be in kebab-case:\n \u2705 Valid: 'detail', 'list-view', 'company-detail'\n \u274C Invalid: 'Detail', 'listView', 'list_view'"
3960
4135
  });
3961
4136
  try {
3962
4137
  viewNameSchema.parse(name);
3963
4138
  } catch (error) {
3964
- if (error instanceof z3.ZodError) {
4139
+ if (error instanceof z.ZodError) {
3965
4140
  throw new Error(`[DetailViewBuilder] ${error.issues[0].message}`);
3966
4141
  }
3967
4142
  throw error;
@@ -4135,13 +4310,13 @@ var ListViewBuilder = class {
4135
4310
  * Validate view name format (kebab-case)
4136
4311
  */
4137
4312
  validateName(name) {
4138
- const viewNameSchema = z3.string().min(1, "View name cannot be empty").max(63, "View name is too long (max 63 characters)").regex(/^[a-z][a-z0-9-]*$/, {
4313
+ const viewNameSchema = z.string().min(1, "View name cannot be empty").max(63, "View name is too long (max 63 characters)").regex(/^[a-z][a-z0-9-]*$/, {
4139
4314
  message: "Invalid view name format.\nName must be in kebab-case:\n \u2705 Valid: 'default', 'list-view', 'active-contacts'\n \u274C Invalid: 'Default', 'listView', 'list_view'"
4140
4315
  });
4141
4316
  try {
4142
4317
  viewNameSchema.parse(name);
4143
4318
  } catch (error) {
4144
- if (error instanceof z3.ZodError) {
4319
+ if (error instanceof z.ZodError) {
4145
4320
  throw new Error(`[ListViewBuilder] ${error.issues[0].message}`);
4146
4321
  }
4147
4322
  throw error;
@@ -4319,9 +4494,6 @@ function group(id, label) {
4319
4494
  function relationGroup(id, label, attribute) {
4320
4495
  return new RelationGroupBuilder(id, label, attribute);
4321
4496
  }
4322
-
4323
- // src/builders/workflow-builder.ts
4324
- import { z as z4 } from "zod";
4325
4497
  var WorkflowFormRowBuilder = class {
4326
4498
  /** @internal */
4327
4499
  constructor(formBuilder, rowId, order) {
@@ -4991,13 +5163,13 @@ var WorkflowBuilder = class {
4991
5163
  // VALIDATION
4992
5164
  // ============================================================================
4993
5165
  validateName(name) {
4994
- const schema = z4.string().min(1, "Workflow name cannot be empty").max(63, "Workflow name is too long (max 63 characters)").regex(/^[a-z][a-z0-9-]*$/, {
5166
+ const schema = z.string().min(1, "Workflow name cannot be empty").max(63, "Workflow name is too long (max 63 characters)").regex(/^[a-z][a-z0-9-]*$/, {
4995
5167
  message: "Invalid workflow name format.\nName must be in kebab-case:\n \u2705 Valid: 'client-onboarding', 'contract-signature'\n \u274C Invalid: 'ClientOnboarding', 'contract_signature'"
4996
5168
  });
4997
5169
  try {
4998
5170
  schema.parse(name);
4999
5171
  } catch (error) {
5000
- if (error instanceof z4.ZodError) {
5172
+ if (error instanceof z.ZodError) {
5001
5173
  throw new Error(`[WorkflowBuilder] ${error.issues[0].message}`);
5002
5174
  }
5003
5175
  throw error;
@@ -6228,321 +6400,161 @@ function isViewCustomized(view2, object2) {
6228
6400
  }
6229
6401
  return true;
6230
6402
  }
6231
- export {
6232
- AINodeSchema,
6233
- ALL_ACTIONS,
6234
- ALL_SYSTEM_RESOURCES,
6235
- ActivityTabConfig,
6236
- AssignNodeSchema,
6237
- AssignmentMappingSchema,
6238
- AssignmentSourceSchema,
6239
- AttributeInUseError,
6240
- AttributeNotFoundError,
6241
- AuthMethodSchema,
6242
- BEHAVIOR_PROPERTIES,
6243
- ConcurrentModificationError,
6244
- ConditionGroupSchema,
6245
- ConditionNodeSchema,
6246
- ConditionOperatorSchema,
6247
- ConditionRuleSchema,
6248
- CreateShareInputSchema,
6249
- CustomTabConfig,
6250
- DEFAULT_LABEL_FALLBACK,
6251
- DEFAULT_RETENTION_POLICY,
6252
- DEFAULT_ROLES,
6253
- DEFAULT_ROLE_DESCRIPTIONS,
6254
- DEFAULT_ROLE_FOR_NEW_USERS,
6255
- DEFAULT_ROLE_LABELS,
6256
- DEFAULT_ROLE_PERMISSIONS,
6257
- DEFAULT_THEME,
6258
- DEFAULT_VALIDATION_MESSAGES,
6259
- DetailViewBuilder,
6260
- DocumentsTabConfig,
6261
- DuplicateError,
6262
- EMPTY_VALUE_PLACEHOLDER,
6263
- EndNodeSchema,
6264
- FORBIDDEN_PROPERTY_TYPES,
6265
- FileNotFoundError,
6266
- FlagRegistry,
6267
- FlagService,
6268
- FlowRowFieldSchema,
6269
- FlowRowSchema,
6270
- FlowsTabConfig,
6271
- ForbiddenError,
6272
- FormFieldRefSchema,
6273
- FormNodeSchema,
6274
- GroupBuilder,
6275
- IDENTITY_PROPERTIES,
6276
- ListViewBuilder,
6277
- ListViewTabConfigBuilder,
6278
- NON_SORTABLE_TYPES,
6279
- NO_VALUE_OPERATORS,
6280
- NodePositionSchema,
6281
- NoopGeocodingAdapter,
6282
- NotFoundError,
6283
- NotSystemObjectError,
6284
- OPERATORS_BY_TYPE,
6285
- ObjectBuilder,
6286
- ObjectNotFoundError,
6287
- ObjectReferencedError,
6288
- PRESENTATION_PROPERTIES,
6289
- PolicyViolationError,
6290
- ProtectedResourceError,
6291
- ProtectedRoleError,
6292
- RELATION_TARGET_ANY,
6293
- RESERVED_ATTRIBUTE_NAMES,
6294
- RecordNotFoundError,
6295
- RecordReferencedError,
6296
- RelationGroupBuilder,
6297
- RichtextTabConfig,
6298
- RoleNotFoundError,
6299
- SYSTEM_ATTRIBUTES,
6300
- SYSTEM_FIELD_NAMES,
6301
- SYSTEM_RESOURCES,
6302
- SYSTEM_RESOURCE_LABELS,
6303
- SchemaError,
6304
- SchemaErrorCode,
6305
- ShareStatusSchema,
6306
- SlotModeSchema,
6307
- StartNodeSchema,
6308
- SyncError,
6309
- TabBuilder,
6310
- TableTabConfig,
6311
- ThemeColorsSchema,
6312
- ThemeLogoSchema,
6313
- USER_STATUSES,
6314
- UserProfileNotFoundError,
6315
- ValidationError,
6316
- ViewBuilder,
6317
- ViewportSchema,
6318
- WorkflowAIBuilder,
6319
- WorkflowAssignBuilder,
6320
- WorkflowBuilder,
6321
- WorkflowConditionBuilder,
6322
- WorkflowConfigSchema,
6323
- WorkflowDefinitionSchema,
6324
- WorkflowEndBuilder,
6325
- WorkflowFormBuilder,
6326
- WorkflowFormRowBuilder,
6327
- WorkflowLayoutSchema,
6328
- WorkflowNodeSchema,
6329
- WorkflowShareSchema,
6330
- WorkflowSimpleFormBuilder,
6331
- WorkflowSlotSchema,
6332
- WorkflowStartBuilder,
6333
- WorkflowStatusSchema,
6334
- WorkflowThemeSchema,
6335
- ZONE_CONFIG,
6336
- ZONE_ORDER,
6337
- accessLevelToActions,
6338
- actionsToAccessLevel,
6339
- and,
6340
- applyRelationProps,
6341
- asTenantId,
6342
- asUserId,
6343
- assignNodeZones,
6344
- attributeConfigSchemas,
6345
- booleanFlag,
6346
- canAccessNode,
6347
- canResumeInstance,
6348
- checkbox,
6349
- checkboxConfigSchema,
6350
- computeRecordStatus,
6351
- createAttributeValidator,
6352
- createCheckboxValidator,
6353
- createCurrencyValidator,
6354
- createDateValidator,
6355
- createDraftValidator,
6356
- createEmptyContext,
6357
- createFileValidator,
6358
- createFlagRegistry,
6359
- createFlagService,
6360
- createFormAttributeValidator,
6361
- createFormulaValidator,
6362
- createLocationValidator,
6363
- createMultiRelationValidator,
6364
- createMultiselectValidator,
6365
- createNumberValidator,
6366
- createObjectValidator,
6367
- createPhoneValidator,
6368
- createRatingValidator,
6369
- createRelationValidator,
6370
- createRichtextValidator,
6371
- createRollupValidator,
6372
- createSelectValidator,
6373
- createSingleRelationValidator,
6374
- createStartTransition,
6375
- createStatusValidator,
6376
- createTextAreaValidator,
6377
- createTextValidator,
6378
- createUserValidator,
6379
- currency,
6380
- currencyConfigSchema,
6381
- date,
6382
- dateConfigSchema,
6383
- deepEqual,
6384
- detailView,
6385
- document,
6386
- documentConfigSchema,
6387
- eq,
6388
- extractAttributeNames,
6389
- file,
6390
- fileConfigSchema,
6391
- flagRegistry,
6392
- formatAttributeValue,
6393
- formatPhoneForDisplay,
6394
- formatZodErrors,
6395
- formula,
6396
- formulaConfigSchema,
6397
- generateCssVariables,
6398
- generateDefaultDetailView,
6399
- generateDefaultListView,
6400
- generateFallbackView,
6401
- generateId,
6402
- generatePrefixedId,
6403
- generateTemplateName,
6404
- getActiveTab,
6405
- getAttributeConfigSchema,
6406
- getContextValue,
6407
- getErrorMessage,
6408
- getFormFieldRefs,
6409
- getMissingRequiredAttributes,
6410
- getNodeOutputs,
6411
- getNodeSlotIds,
6412
- getRollupFilterOperators,
6413
- getSystemAttributeList,
6414
- getZoneAllowedTypes,
6415
- group,
6416
- groupNodesByZone,
6417
- hasOptions,
6418
- hasProperties,
6419
- inValues,
6420
- indexBy,
6421
- inferInverseCardinality,
6422
- isAINode,
6423
- isActivityTab,
6424
- isAdvancedFormNode,
6425
- isAssignNode,
6426
- isAttributeSortable,
6427
- isBehaviorProperty,
6428
- isBilateralRelation,
6429
- isCalendarView,
6430
- isConditionGroup,
6431
- isConditionNode,
6432
- isConditionRule,
6433
- isCustomTab,
6434
- isDefaultRole,
6435
- isDetailView,
6436
- isDocumentsTab,
6437
- isEmpty2 as isEmpty,
6438
- isEndNode,
6439
- isFieldGroup,
6440
- isFlowDefinition,
6441
- isFlowFieldsRow,
6442
- isFlowPublished,
6443
- isFlowRelationListRow,
6444
- isFlowsTab,
6445
- isForbiddenError,
6446
- isFormFieldsRow,
6447
- isFormNode,
6448
- isFormTab,
6449
- isGalleryView,
6450
- isGrantExpired,
6451
- isGrantRevoked,
6452
- isGrantValid,
6453
- isIdentityProperty,
6454
- isInstanceEvent,
6455
- isInstanceTerminal,
6456
- isInstanceWaiting,
6457
- isInverseSourceTab,
6458
- isInvitationAccepted,
6459
- isInvitationExpired,
6460
- isInvitationOrGrantEvent,
6461
- isInvitationValid,
6462
- isLabelExpression,
6463
- isLayoutRow,
6464
- isListView,
6465
- isNoValueOperator,
6466
- isNodeEvent,
6467
- isNotEmpty2 as isNotEmpty,
6468
- isNotFoundError,
6469
- isPresentationProperty,
6470
- isProtectedResourceError,
6471
- isRecordComplete,
6472
- isRelationGroup,
6473
- isRelationSourceTab,
6474
- isRichtextTab,
6475
- isSchemaError,
6476
- isSimpleFormNode,
6477
- isStartNode,
6478
- isSystemAttribute,
6479
- isSystemAttributeObject,
6480
- isSystemFlow,
6481
- isSystemWorkflow,
6482
- isTableTab,
6483
- isTimelineView,
6484
- isTokenRevoked,
6485
- isUniversalRelation,
6486
- isValidationError,
6487
- isViewCustomized,
6488
- isWorkflowDefinition,
6489
- isWorkflowPublished,
6490
- jsonFlag,
6491
- listView,
6492
- location,
6493
- locationConfigSchema,
6494
- mergeWithDefaults,
6495
- multiselect,
6496
- multiselectConfigSchema,
6497
- neq,
6498
- nodeTypeRegistry,
6499
- normalizePhoneNumber,
6500
- number,
6501
- numberConfigSchema,
6502
- numberFlag,
6503
- object,
6504
- or,
6505
- parseAttributeConfig,
6506
- parseRawPhoneInput,
6507
- phone,
6508
- phoneConfigSchema,
6509
- rating,
6510
- ratingConfigSchema,
6511
- registry,
6512
- relation,
6513
- relationConfigSchema,
6514
- relationGroup,
6515
- renderLabelExpression,
6516
- resetViewToDefault,
6517
- richtext,
6518
- richtextConfigSchema,
6519
- rollup,
6520
- rollupConfigSchema,
6521
- safeParseAttributeConfig,
6522
- select,
6523
- selectConfigSchema,
6524
- setContextValue,
6525
- setNodeNext,
6526
- slugify,
6527
- status,
6528
- statusConfigSchema,
6529
- stringFlag,
6530
- text,
6531
- textConfigSchema,
6532
- textarea,
6533
- textareaConfigSchema,
6534
- toUndefinedIfEmpty,
6535
- user,
6536
- userConfigSchema,
6537
- validateAttribute,
6538
- validateAttributeConfig,
6539
- validateDraft,
6540
- validateDraftOrThrow,
6541
- validateNode,
6542
- validateObject,
6543
- validateObjectOrThrow,
6544
- validatePhoneNumber,
6545
- view,
6546
- viewRegistry,
6547
- workflow
6548
- };
6403
+ function objectToJSONSchema(objectDef) {
6404
+ const properties = {};
6405
+ const required = [];
6406
+ for (const attr of objectDef.attributes) {
6407
+ properties[attr.name] = attributeToJSONSchema(attr);
6408
+ if (attr.required) {
6409
+ required.push(attr.name);
6410
+ }
6411
+ }
6412
+ return {
6413
+ type: "object",
6414
+ title: objectDef.label,
6415
+ properties,
6416
+ required
6417
+ };
6418
+ }
6419
+ function attributeToJSONSchema(attr) {
6420
+ const base = {
6421
+ type: "string",
6422
+ title: attr.label
6423
+ };
6424
+ if (attr.description) {
6425
+ base.description = attr.description;
6426
+ }
6427
+ if (attr.placeholder) {
6428
+ base.examples = [attr.placeholder];
6429
+ }
6430
+ switch (attr.type) {
6431
+ case "text":
6432
+ case "textarea":
6433
+ base.type = "string";
6434
+ if ("minLength" in attr && attr.minLength !== void 0) {
6435
+ base.minLength = attr.minLength;
6436
+ }
6437
+ if ("maxLength" in attr && attr.maxLength !== void 0) {
6438
+ base.maxLength = attr.maxLength;
6439
+ }
6440
+ if ("pattern" in attr && attr.pattern) {
6441
+ base.pattern = attr.pattern;
6442
+ }
6443
+ break;
6444
+ case "richtext":
6445
+ base.type = "string";
6446
+ base.format = "html";
6447
+ break;
6448
+ case "number":
6449
+ case "rating":
6450
+ base.type = "number";
6451
+ if ("min" in attr && attr.min !== void 0) {
6452
+ base.minimum = attr.min;
6453
+ }
6454
+ if ("max" in attr && attr.max !== void 0) {
6455
+ base.maximum = attr.max;
6456
+ }
6457
+ break;
6458
+ case "checkbox":
6459
+ base.type = "boolean";
6460
+ break;
6461
+ case "date":
6462
+ base.type = "string";
6463
+ base.format = "date-time";
6464
+ break;
6465
+ case "phone":
6466
+ base.type = "object";
6467
+ break;
6468
+ case "currency":
6469
+ base.type = "object";
6470
+ break;
6471
+ case "select":
6472
+ case "status":
6473
+ base.type = "string";
6474
+ if ("options" in attr && Array.isArray(attr.options)) {
6475
+ base.enum = attr.options.map((opt) => opt.value);
6476
+ }
6477
+ break;
6478
+ case "multiselect":
6479
+ base.type = "array";
6480
+ if ("options" in attr && Array.isArray(attr.options)) {
6481
+ base.items = {
6482
+ type: "string",
6483
+ enum: attr.options.map((opt) => opt.value)
6484
+ };
6485
+ }
6486
+ break;
6487
+ case "file":
6488
+ if ("multiple" in attr && attr.multiple) {
6489
+ base.type = "array";
6490
+ base.items = { type: "string", format: "uuid" };
6491
+ } else {
6492
+ base.type = "string";
6493
+ base.format = "uuid";
6494
+ }
6495
+ break;
6496
+ case "user":
6497
+ if ("multiple" in attr && attr.multiple) {
6498
+ base.type = "array";
6499
+ base.items = { type: "string", format: "uuid" };
6500
+ } else {
6501
+ base.type = "string";
6502
+ base.format = "uuid";
6503
+ }
6504
+ break;
6505
+ case "relation":
6506
+ if ("cardinality" in attr && attr.cardinality === "many") {
6507
+ base.type = "array";
6508
+ if ("targets" in attr && Array.isArray(attr.targets) && attr.targets.length > 0) {
6509
+ base.description ?? (base.description = `References to ${attr.targets[0].object}`);
6510
+ }
6511
+ base.items = { type: "string", format: "uuid" };
6512
+ } else {
6513
+ base.type = "string";
6514
+ base.format = "uuid";
6515
+ if ("targets" in attr && Array.isArray(attr.targets) && attr.targets.length > 0) {
6516
+ base.description ?? (base.description = `Reference to ${attr.targets[0].object}`);
6517
+ }
6518
+ }
6519
+ break;
6520
+ case "location":
6521
+ base.type = "object";
6522
+ break;
6523
+ case "formula":
6524
+ case "rollup":
6525
+ base.type = "string";
6526
+ if ("returnType" in attr) {
6527
+ switch (attr.returnType) {
6528
+ case "number":
6529
+ base.type = "number";
6530
+ break;
6531
+ case "boolean":
6532
+ base.type = "boolean";
6533
+ break;
6534
+ case "date":
6535
+ base.type = "string";
6536
+ base.format = "date-time";
6537
+ break;
6538
+ }
6539
+ }
6540
+ break;
6541
+ case "document":
6542
+ if ("multiple" in attr && attr.multiple) {
6543
+ base.type = "array";
6544
+ base.items = { type: "string", format: "uuid" };
6545
+ } else {
6546
+ base.type = "string";
6547
+ base.format = "uuid";
6548
+ }
6549
+ break;
6550
+ default:
6551
+ base.type = "string";
6552
+ }
6553
+ return base;
6554
+ }
6555
+ function objectValidatorToJSONSchema(objectDef) {
6556
+ const validator = createObjectValidator(objectDef);
6557
+ return z.toJSONSchema(validator);
6558
+ }
6559
+
6560
+ export { AINodeSchema, ALL_ACTIONS, ALL_PIPES, ALL_SYSTEM_RESOURCES, AccessDeniedError, ActivityTabConfig, AssignNodeSchema, AssignmentMappingSchema, AssignmentSourceSchema, AttributeInUseError, AttributeNotFoundError, AuthMethodSchema, BEHAVIOR_PROPERTIES, ConcurrentModificationError, ConditionGroupSchema, ConditionNodeSchema, ConditionOperatorSchema, ConditionRuleSchema, ConversationNotFoundError, CreateShareInputSchema, CustomTabConfig, DEFAULT_LABEL_FALLBACK, DEFAULT_RETENTION_POLICY, DEFAULT_ROLES, DEFAULT_ROLE_DESCRIPTIONS, DEFAULT_ROLE_FOR_NEW_USERS, DEFAULT_ROLE_LABELS, DEFAULT_ROLE_PERMISSIONS, DEFAULT_THEME, DetailViewBuilder, DocumentsTabConfig, DuplicateError, EMPTY_VALUE_PLACEHOLDER, EndNodeSchema, FORBIDDEN_PROPERTY_TYPES, FileNotFoundError, FlagRegistry, FlagService, FlowRowFieldSchema, FlowRowSchema, FlowsTabConfig, ForbiddenError, FormFieldRefSchema, FormNodeSchema, GroupBuilder, IDENTITY_PROPERTIES, ListViewBuilder, ListViewTabConfigBuilder, MemoryNotFoundError, NON_SORTABLE_TYPES, NO_VALUE_OPERATORS, NodePositionSchema, NoopGeocodingAdapter, NotFoundError, NotImplementedError, NotSystemObjectError, OPERATORS_BY_TYPE, ObjectBuilder, ObjectNotFoundError, ObjectReferencedError, PIPES_WITH_ARGS, PRESENTATION_PROPERTIES, PolicyViolationError, ProtectedResourceError, ProtectedRoleError, RELATION_TARGET_ANY, RESERVED_ATTRIBUTE_NAMES, RecordNotFoundError, RecordReferencedError, RelationGroupBuilder, RepositoryError, RichtextTabConfig, RoleNotFoundError, SIMPLE_PIPES, STANDARD_SCHEMA_VENDOR, SYSTEM_ATTRIBUTES, SYSTEM_FIELD_NAMES, SYSTEM_RESOURCES, SYSTEM_RESOURCE_LABELS, SchemaError, SchemaErrorCode, ShareStatusSchema, SlotModeSchema, StartNodeSchema, StorageError, SyncError, TabBuilder, TableTabConfig, ThemeColorsSchema, ThemeLogoSchema, USER_STATUSES, UserProfileNotFoundError, ValidationError, ViewBuilder, ViewportSchema, WorkflowAIBuilder, WorkflowAssignBuilder, WorkflowBuilder, WorkflowConditionBuilder, WorkflowConfigSchema, WorkflowDefinitionSchema, WorkflowEndBuilder, WorkflowFormBuilder, WorkflowFormRowBuilder, WorkflowLayoutSchema, WorkflowNodeSchema, WorkflowShareSchema, WorkflowSimpleFormBuilder, WorkflowSlotSchema, WorkflowStartBuilder, WorkflowStatusSchema, WorkflowThemeSchema, ZONE_CONFIG, ZONE_ORDER, accessLevelToActions, actionsToAccessLevel, and, applyRelationProps, assignNodeZones, booleanFlag, canAccessNode, canResumeInstance, checkbox, createEmptyContext, createFlagRegistry, createFlagService, createStandardSchemaProps, createStartTransition, currency, date, detailView, document, eq, extractAttributeNames, file, flagRegistry, formatAttributeValue, formula, generateCssVariables, generateDefaultDetailView, generateDefaultListView, generateFallbackView, getActiveTab, getContextValue, getErrorMessage, getFormFieldRefs, getNodeOutputs, getNodeSlotIds, getRollupFilterOperators, getSystemAttributeList, getZoneAllowedTypes, group, groupNodesByZone, hasOptions, hasProperties, inValues, inferInverseCardinality, isAINode, isAccessDeniedError, isActivityTab, isAdvancedFormNode, isAssignNode, isAttributeSortable, isBehaviorProperty, isBilateralRelation, isCalendarView, isConditionGroup, isConditionNode, isConditionRule, isCustomTab, isDefaultRole, isDetailView, isDocumentsTab, isEmpty2 as isEmpty, isEndNode, isFieldGroup, isFlowDefinition, isFlowFieldsRow, isFlowPublished, isFlowRelationListRow, isFlowsTab, isForbiddenError, isFormFieldsRow, isFormNode, isFormTab, isGalleryView, isGrantExpired, isGrantRevoked, isGrantValid, isIdentityProperty, isInstanceEvent, isInstanceTerminal, isInstanceWaiting, isInverseSourceTab, isInvitationAccepted, isInvitationExpired, isInvitationOrGrantEvent, isInvitationValid, isLabelExpression, isLayoutRow, isListView, isNoValueOperator, isNodeEvent, isNotEmpty2 as isNotEmpty, isNotFoundError, isNotImplementedError, isPresentationProperty, isProtectedResourceError, isRelationGroup, isRelationSourceTab, isRepositoryError, isRichtextTab, isSchemaError, isSimpleFormNode, isStandardSchema, isStartNode, isStorageError, isSystemAttribute, isSystemAttributeObject, isSystemFlow, isSystemWorkflow, isTableTab, isTimelineView, isTokenRevoked, isUniversalRelation, isValidationError, isViewCustomized, isWorkflowDefinition, isWorkflowPublished, jsonFlag, labelExpressionSchema, listView, location, mergeWithDefaults, multiselect, neq, nodeTypeRegistry, number, numberFlag, object, objectToJSONSchema, objectValidatorToJSONSchema, or, phone, rating, registerBuiltInNodeTypes, registry, relation, relationGroup, renderLabelExpression, resetViewToDefault, richtext, rollup, select, setContextValue, setNodeNext, status, stringFlag, text, textarea, toUndefinedIfEmpty, user, validateLabelExpression, validateNode, view, viewRegistry, workflow };