@stndrds/schema 1.0.0-alpha.100 → 1.0.0-alpha.102

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 (142) hide show
  1. package/dist/{attributes-CH89Z_J-.d.mts → attributes-D7yQuTJK.d.mts} +1 -11
  2. package/dist/{attributes-dw-jLtYS.d.ts → attributes-DcbQC-4b.d.ts} +1 -11
  3. package/dist/chunk-3JINFUN3.js +81 -0
  4. package/dist/{chunk-BZTLI773.mjs → chunk-4KRLCWJM.mjs} +1 -1
  5. package/dist/{chunk-ERG77ADK.mjs → chunk-4TC27SMF.mjs} +1 -1
  6. package/dist/{chunk-OO2LJ6GP.js → chunk-56QI6UTK.js} +4 -4
  7. package/dist/{chunk-PGHTIMRD.mjs → chunk-5JVVPJJW.mjs} +28 -19
  8. package/dist/{chunk-P4NGPF5L.mjs → chunk-5XL3JP73.mjs} +3 -19
  9. package/dist/{chunk-ZJNX6UXB.mjs → chunk-7HFZ7MVR.mjs} +1 -1
  10. package/dist/{chunk-6IFD5732.js → chunk-ACQ3TUFK.js} +2 -2
  11. package/dist/{chunk-FKPYFM6G.mjs → chunk-AYCSVKI2.mjs} +1 -1
  12. package/dist/{chunk-ALV6GETG.mjs → chunk-BLXQGQLK.mjs} +1 -1
  13. package/dist/{chunk-STKN6A5M.js → chunk-D7WFIGXW.js} +2 -2
  14. package/dist/{chunk-E6XO2STS.js → chunk-FRCDMQER.js} +0 -14
  15. package/dist/{chunk-QPDXDX7A.js → chunk-GCRHSPZN.js} +2 -2
  16. package/dist/{chunk-TV4G2KMD.mjs → chunk-IRTRJH37.mjs} +1 -1
  17. package/dist/{chunk-3RFFA4EV.mjs → chunk-ITTQ4FGR.mjs} +1 -1
  18. package/dist/{chunk-FKETRWAF.js → chunk-J5HRK3WD.js} +2 -2
  19. package/dist/{chunk-6MXQAQBB.mjs → chunk-KNYZH2WD.mjs} +1 -1
  20. package/dist/chunk-KWVCGQ7N.mjs +78 -0
  21. package/dist/chunk-MAKSIK3P.js +10 -0
  22. package/dist/{chunk-H3VBSMVW.js → chunk-N7T66JVY.js} +2 -21
  23. package/dist/{chunk-UPEQEX2D.js → chunk-OAQWRMTP.js} +2 -2
  24. package/dist/{chunk-VC4E3OSZ.mjs → chunk-OLJLCVNY.mjs} +1 -1
  25. package/dist/{chunk-ANP6HGMJ.js → chunk-P2BE2A2G.js} +4 -4
  26. package/dist/{chunk-HJNLL34O.js → chunk-QWZHR2OO.js} +2 -2
  27. package/dist/{chunk-XAORXFAX.mjs → chunk-QY6QFRRV.mjs} +1 -12
  28. package/dist/{chunk-CE25ADK5.js → chunk-QYNPB37W.js} +51 -42
  29. package/dist/{chunk-XPFWKISJ.mjs → chunk-R4CJHCC4.mjs} +1 -1
  30. package/dist/{chunk-5CBTJS7J.js → chunk-RJ4LOX7P.js} +2 -2
  31. package/dist/{chunk-C7KW4NAD.js → chunk-ROAZLZA2.js} +2 -2
  32. package/dist/{chunk-4IVCBFJA.mjs → chunk-RUYUFXNW.mjs} +1 -1
  33. package/dist/{chunk-PZT3CIHD.mjs → chunk-SS2NR6DH.mjs} +2 -18
  34. package/dist/{chunk-5SQEKHPW.js → chunk-T225DB55.js} +7 -52
  35. package/dist/{chunk-ATA4XHB4.js → chunk-TKN73433.js} +2 -2
  36. package/dist/{chunk-2LUHLHLE.mjs → chunk-TMYBEXBT.mjs} +1 -1
  37. package/dist/{chunk-JEDANRCG.mjs → chunk-UQVW4KPP.mjs} +7 -51
  38. package/dist/{chunk-IMEPIVTR.js → chunk-V6DE3MXC.js} +1 -38
  39. package/dist/{chunk-KC2FFNL4.js → chunk-VXOTYFEW.js} +2 -2
  40. package/dist/{chunk-RDGBQM3N.mjs → chunk-WV4V64D5.mjs} +1 -1
  41. package/dist/helpers-DD6JzYfI.d.mts +860 -0
  42. package/dist/helpers-kMS5R7KX.d.ts +860 -0
  43. package/dist/index.d.mts +717 -2804
  44. package/dist/index.d.ts +717 -2804
  45. package/dist/index.js +2055 -3922
  46. package/dist/index.mjs +2467 -3985
  47. package/dist/{types-Ms3HtAmo.d.mts → types-BAPgWlpX.d.mts} +1 -1
  48. package/dist/{types-D-0QbsA9.d.ts → types-mZPUEZl0.d.ts} +1 -1
  49. package/dist/utils.d.mts +1 -55
  50. package/dist/utils.d.ts +1 -55
  51. package/dist/utils.js +6 -18
  52. package/dist/utils.mjs +1 -1
  53. package/dist/validation/all.d.mts +5 -20
  54. package/dist/validation/all.d.ts +5 -20
  55. package/dist/validation/all.js +29 -238
  56. package/dist/validation/all.mjs +19 -20
  57. package/dist/validation/complex/currency.d.mts +2 -2
  58. package/dist/validation/complex/currency.d.ts +2 -2
  59. package/dist/validation/complex/currency.js +3 -4
  60. package/dist/validation/complex/currency.mjs +2 -3
  61. package/dist/validation/complex/file.d.mts +2 -2
  62. package/dist/validation/complex/file.d.ts +2 -2
  63. package/dist/validation/complex/file.js +3 -4
  64. package/dist/validation/complex/file.mjs +2 -3
  65. package/dist/validation/complex/location.d.mts +2 -2
  66. package/dist/validation/complex/location.d.ts +2 -2
  67. package/dist/validation/complex/location.js +3 -4
  68. package/dist/validation/complex/location.mjs +2 -3
  69. package/dist/validation/complex/phone.d.mts +2 -2
  70. package/dist/validation/complex/phone.d.ts +2 -2
  71. package/dist/validation/complex/phone.js +3 -4
  72. package/dist/validation/complex/phone.mjs +2 -3
  73. package/dist/validation/complex/relation.d.mts +2 -2
  74. package/dist/validation/complex/relation.d.ts +2 -2
  75. package/dist/validation/complex/relation.js +5 -6
  76. package/dist/validation/complex/relation.mjs +2 -3
  77. package/dist/validation/complex/richtext.d.mts +2 -2
  78. package/dist/validation/complex/richtext.d.ts +2 -2
  79. package/dist/validation/complex/richtext.js +3 -4
  80. package/dist/validation/complex/richtext.mjs +2 -3
  81. package/dist/validation/complex/select.d.mts +2 -2
  82. package/dist/validation/complex/select.d.ts +2 -2
  83. package/dist/validation/complex/select.js +5 -6
  84. package/dist/validation/complex/select.mjs +2 -3
  85. package/dist/validation/complex/user.d.mts +2 -2
  86. package/dist/validation/complex/user.d.ts +2 -2
  87. package/dist/validation/complex/user.js +3 -4
  88. package/dist/validation/complex/user.mjs +2 -3
  89. package/dist/validation/computed/formula.d.mts +2 -2
  90. package/dist/validation/computed/formula.d.ts +2 -2
  91. package/dist/validation/computed/formula.js +3 -4
  92. package/dist/validation/computed/formula.mjs +2 -3
  93. package/dist/validation/computed/rollup.d.mts +2 -2
  94. package/dist/validation/computed/rollup.d.ts +2 -2
  95. package/dist/validation/computed/rollup.js +3 -4
  96. package/dist/validation/computed/rollup.mjs +2 -3
  97. package/dist/validation/config/index.d.mts +2 -403
  98. package/dist/validation/config/index.d.ts +2 -403
  99. package/dist/validation/config/index.js +4 -89
  100. package/dist/validation/config/index.mjs +1 -2
  101. package/dist/validation/core/index.d.mts +4 -53
  102. package/dist/validation/core/index.d.ts +4 -53
  103. package/dist/validation/core/index.js +3 -12
  104. package/dist/validation/core/index.mjs +1 -2
  105. package/dist/validation/object/index.d.mts +29 -4
  106. package/dist/validation/object/index.d.ts +29 -4
  107. package/dist/validation/object/index.js +29 -30
  108. package/dist/validation/object/index.mjs +17 -18
  109. package/dist/validation/primitives/checkbox.d.mts +2 -2
  110. package/dist/validation/primitives/checkbox.d.ts +2 -2
  111. package/dist/validation/primitives/checkbox.js +3 -4
  112. package/dist/validation/primitives/checkbox.mjs +2 -3
  113. package/dist/validation/primitives/date.d.mts +2 -2
  114. package/dist/validation/primitives/date.d.ts +2 -2
  115. package/dist/validation/primitives/date.js +3 -4
  116. package/dist/validation/primitives/date.mjs +2 -3
  117. package/dist/validation/primitives/number.d.mts +2 -2
  118. package/dist/validation/primitives/number.d.ts +2 -2
  119. package/dist/validation/primitives/number.js +3 -4
  120. package/dist/validation/primitives/number.mjs +2 -3
  121. package/dist/validation/primitives/rating.d.mts +2 -2
  122. package/dist/validation/primitives/rating.d.ts +2 -2
  123. package/dist/validation/primitives/rating.js +3 -4
  124. package/dist/validation/primitives/rating.mjs +2 -3
  125. package/dist/validation/primitives/text.d.mts +2 -2
  126. package/dist/validation/primitives/text.d.ts +2 -2
  127. package/dist/validation/primitives/text.js +4 -5
  128. package/dist/validation/primitives/text.mjs +2 -3
  129. package/package.json +2 -3
  130. package/dist/chunk-4DMDOSFN.js +0 -10
  131. package/dist/chunk-7FSIBNRH.mjs +0 -25
  132. package/dist/chunk-BEN6TE7Y.js +0 -11
  133. package/dist/chunk-RDXQ4CYT.mjs +0 -9
  134. package/dist/chunk-ZWMMEQI7.js +0 -28
  135. package/dist/index-CftmKoRP.d.mts +0 -2053
  136. package/dist/index-Dh_XiNFt.d.ts +0 -2053
  137. package/dist/validation/validators.d.mts +0 -23
  138. package/dist/validation/validators.d.ts +0 -23
  139. package/dist/validation/validators.js +0 -265
  140. package/dist/validation/validators.mjs +0 -20
  141. /package/dist/{chunk-R6JFUC32.js → chunk-PGERPYDR.js} +0 -0
  142. /package/dist/{chunk-EKG35CSO.mjs → chunk-SP3PNHYF.mjs} +0 -0
@@ -159,11 +159,6 @@ interface FeatureFlagsConfig {
159
159
  * are NOT supported to avoid duplicating backend behavior.
160
160
  */
161
161
  type PropertyType = "text" | "textarea" | "number" | "checkbox" | "date" | "phone" | "currency" | "status" | "select" | "multiselect" | "rating" | "location";
162
- /**
163
- * Forbidden property types that would require complex backend duplication
164
- */
165
- declare const FORBIDDEN_PROPERTY_TYPES: readonly ["formula", "rollup", "relation", "file", "user", "document", "richtext"];
166
- type ForbiddenPropertyType = (typeof FORBIDDEN_PROPERTY_TYPES)[number];
167
162
  /**
168
163
  * Union of attribute types allowed as qualified relation properties.
169
164
  *
@@ -660,11 +655,6 @@ interface DocumentAttribute extends BaseAttribute<string | string[]> {
660
655
  attributes?: Attribute[];
661
656
  }
662
657
  type Attribute = TextAttribute | TextAreaAttribute | RichtextAttribute | NumberAttribute | CheckboxAttribute | DateAttribute | PhoneAttribute | CurrencyAttribute | StatusAttribute | LocationAttribute | SelectAttribute | MultiselectAttribute | FileAttribute | UserAttribute | RelationAttribute | RatingAttribute | FormulaAttribute | RollupAttribute | DocumentAttribute;
663
- /**
664
- * Attribute types that are not sortable by default.
665
- * These types have complex/binary values without a meaningful natural order.
666
- */
667
- declare const NON_SORTABLE_TYPES: ReadonlySet<AttributeType>;
668
658
  /**
669
659
  * Check if an attribute supports sorting based on its type.
670
660
  */
@@ -672,4 +662,4 @@ declare function isAttributeSortable(attr: {
672
662
  type: AttributeType;
673
663
  }): boolean;
674
664
 
675
- export { type PropertyType as $, type Attribute as A, type BilateralConfig as B, type CurrencyAttribute as C, type DateAttribute as D, type AttributeGroup as E, type FileAttribute as F, type BaseAttribute as G, type DateFormat as H, type DateValue as I, FORBIDDEN_PROPERTY_TYPES as J, type FeatureFlagsConfig as K, type LocationAttribute as L, type MultiRelationAttribute as M, type NumberAttribute as N, type Option as O, type PhoneAttribute as P, type FlagOverride as Q, type RelationAttribute as R, type SingleRelationAttribute as S, type TextAreaAttribute as T, type UserAttribute as U, type ForbiddenPropertyType as V, NON_SORTABLE_TYPES as W, type NumberUnit as X, type OptionPropertyAttribute as Y, type PropertyAttribute as Z, type PropertySchema as _, type RichtextAttribute as a, RELATION_TARGET_ANY as a0, type StatusGroup as a1, hasOptions as a2, inferInverseCardinality as a3, isAttributeSortable as a4, isBilateralRelation as a5, isUniversalRelation as a6, type MultiselectAttribute as b, type SelectAttribute as c, type StatusAttribute as d, type FormulaAttribute as e, type RollupAttribute as f, type CheckboxAttribute as g, type RatingAttribute as h, type TextAttribute as i, type AttributeType as j, type LocationGranularity as k, type Location as l, type Phone as m, type Currency as n, type DocumentAttribute as o, type FeatureGate as p, type RichtextFeature as q, type RelationTarget as r, type FormulaReturnType as s, type RollupFunction as t, type FlagValueType as u, type FeatureFlagDefinition as v, type FlagLevel as w, type FeatureFlagsRepository as x, type StaticFlagDefault as y, type ResolvedFlag as z };
665
+ export { hasOptions as $, type Attribute as A, type BilateralConfig as B, type CurrencyAttribute as C, type DateAttribute as D, type AttributeGroup as E, type FileAttribute as F, type BaseAttribute as G, type DateFormat as H, type DateValue as I, type FeatureFlagsConfig as J, type FlagOverride as K, type LocationAttribute as L, type MultiRelationAttribute as M, type NumberAttribute as N, type Option as O, type PhoneAttribute as P, type NumberUnit as Q, type RelationAttribute as R, type SingleRelationAttribute as S, type TextAreaAttribute as T, type UserAttribute as U, type OptionPropertyAttribute as V, type PropertyAttribute as W, type PropertySchema as X, type PropertyType as Y, RELATION_TARGET_ANY as Z, type StatusGroup as _, type RichtextAttribute as a, inferInverseCardinality as a0, isAttributeSortable as a1, isBilateralRelation as a2, isUniversalRelation as a3, type MultiselectAttribute as b, type SelectAttribute as c, type StatusAttribute as d, type FormulaAttribute as e, type RollupAttribute as f, type CheckboxAttribute as g, type RatingAttribute as h, type TextAttribute as i, type AttributeType as j, type LocationGranularity as k, type Location as l, type Phone as m, type Currency as n, type DocumentAttribute as o, type FeatureGate as p, type FormulaReturnType as q, type RelationTarget as r, type RichtextFeature as s, type RollupFunction as t, type FlagValueType as u, type FeatureFlagDefinition as v, type FlagLevel as w, type FeatureFlagsRepository as x, type StaticFlagDefault as y, type ResolvedFlag as z };
@@ -159,11 +159,6 @@ interface FeatureFlagsConfig {
159
159
  * are NOT supported to avoid duplicating backend behavior.
160
160
  */
161
161
  type PropertyType = "text" | "textarea" | "number" | "checkbox" | "date" | "phone" | "currency" | "status" | "select" | "multiselect" | "rating" | "location";
162
- /**
163
- * Forbidden property types that would require complex backend duplication
164
- */
165
- declare const FORBIDDEN_PROPERTY_TYPES: readonly ["formula", "rollup", "relation", "file", "user", "document", "richtext"];
166
- type ForbiddenPropertyType = (typeof FORBIDDEN_PROPERTY_TYPES)[number];
167
162
  /**
168
163
  * Union of attribute types allowed as qualified relation properties.
169
164
  *
@@ -660,11 +655,6 @@ interface DocumentAttribute extends BaseAttribute<string | string[]> {
660
655
  attributes?: Attribute[];
661
656
  }
662
657
  type Attribute = TextAttribute | TextAreaAttribute | RichtextAttribute | NumberAttribute | CheckboxAttribute | DateAttribute | PhoneAttribute | CurrencyAttribute | StatusAttribute | LocationAttribute | SelectAttribute | MultiselectAttribute | FileAttribute | UserAttribute | RelationAttribute | RatingAttribute | FormulaAttribute | RollupAttribute | DocumentAttribute;
663
- /**
664
- * Attribute types that are not sortable by default.
665
- * These types have complex/binary values without a meaningful natural order.
666
- */
667
- declare const NON_SORTABLE_TYPES: ReadonlySet<AttributeType>;
668
658
  /**
669
659
  * Check if an attribute supports sorting based on its type.
670
660
  */
@@ -672,4 +662,4 @@ declare function isAttributeSortable(attr: {
672
662
  type: AttributeType;
673
663
  }): boolean;
674
664
 
675
- export { type PropertyType as $, type Attribute as A, type BilateralConfig as B, type CurrencyAttribute as C, type DateAttribute as D, type AttributeGroup as E, type FileAttribute as F, type BaseAttribute as G, type DateFormat as H, type DateValue as I, FORBIDDEN_PROPERTY_TYPES as J, type FeatureFlagsConfig as K, type LocationAttribute as L, type MultiRelationAttribute as M, type NumberAttribute as N, type Option as O, type PhoneAttribute as P, type FlagOverride as Q, type RelationAttribute as R, type SingleRelationAttribute as S, type TextAreaAttribute as T, type UserAttribute as U, type ForbiddenPropertyType as V, NON_SORTABLE_TYPES as W, type NumberUnit as X, type OptionPropertyAttribute as Y, type PropertyAttribute as Z, type PropertySchema as _, type RichtextAttribute as a, RELATION_TARGET_ANY as a0, type StatusGroup as a1, hasOptions as a2, inferInverseCardinality as a3, isAttributeSortable as a4, isBilateralRelation as a5, isUniversalRelation as a6, type MultiselectAttribute as b, type SelectAttribute as c, type StatusAttribute as d, type FormulaAttribute as e, type RollupAttribute as f, type CheckboxAttribute as g, type RatingAttribute as h, type TextAttribute as i, type AttributeType as j, type LocationGranularity as k, type Location as l, type Phone as m, type Currency as n, type DocumentAttribute as o, type FeatureGate as p, type RichtextFeature as q, type RelationTarget as r, type FormulaReturnType as s, type RollupFunction as t, type FlagValueType as u, type FeatureFlagDefinition as v, type FlagLevel as w, type FeatureFlagsRepository as x, type StaticFlagDefault as y, type ResolvedFlag as z };
665
+ export { hasOptions as $, type Attribute as A, type BilateralConfig as B, type CurrencyAttribute as C, type DateAttribute as D, type AttributeGroup as E, type FileAttribute as F, type BaseAttribute as G, type DateFormat as H, type DateValue as I, type FeatureFlagsConfig as J, type FlagOverride as K, type LocationAttribute as L, type MultiRelationAttribute as M, type NumberAttribute as N, type Option as O, type PhoneAttribute as P, type NumberUnit as Q, type RelationAttribute as R, type SingleRelationAttribute as S, type TextAreaAttribute as T, type UserAttribute as U, type OptionPropertyAttribute as V, type PropertyAttribute as W, type PropertySchema as X, type PropertyType as Y, RELATION_TARGET_ANY as Z, type StatusGroup as _, type RichtextAttribute as a, inferInverseCardinality as a0, isAttributeSortable as a1, isBilateralRelation as a2, isUniversalRelation as a3, type MultiselectAttribute as b, type SelectAttribute as c, type StatusAttribute as d, type FormulaAttribute as e, type RollupAttribute as f, type CheckboxAttribute as g, type RatingAttribute as h, type TextAttribute as i, type AttributeType as j, type LocationGranularity as k, type Location as l, type Phone as m, type Currency as n, type DocumentAttribute as o, type FeatureGate as p, type FormulaReturnType as q, type RelationTarget as r, type RichtextFeature as s, type RollupFunction as t, type FlagValueType as u, type FeatureFlagDefinition as v, type FlagLevel as w, type FeatureFlagsRepository as x, type StaticFlagDefault as y, type ResolvedFlag as z };
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ var chunkT225DB55_js = require('./chunk-T225DB55.js');
4
+ var zod = require('zod');
5
+
6
+ // src/lib/lru-cache.ts
7
+ var LRUCache = class {
8
+ constructor(capacity) {
9
+ if (capacity <= 0) {
10
+ throw new Error("LRU cache capacity must be greater than 0");
11
+ }
12
+ this.capacity = capacity;
13
+ this.cache = /* @__PURE__ */ new Map();
14
+ }
15
+ get(key) {
16
+ const value = this.cache.get(key);
17
+ if (value !== void 0) {
18
+ this.cache.delete(key);
19
+ this.cache.set(key, value);
20
+ }
21
+ return value;
22
+ }
23
+ set(key, value) {
24
+ if (this.cache.has(key)) {
25
+ this.cache.delete(key);
26
+ } else if (this.cache.size >= this.capacity) {
27
+ const firstKey = this.cache.keys().next().value;
28
+ if (firstKey !== void 0) {
29
+ this.cache.delete(firstKey);
30
+ }
31
+ }
32
+ this.cache.set(key, value);
33
+ }
34
+ has(key) {
35
+ return this.cache.has(key);
36
+ }
37
+ clear() {
38
+ this.cache.clear();
39
+ }
40
+ get size() {
41
+ return this.cache.size;
42
+ }
43
+ };
44
+
45
+ // src/validation/core/regex-cache.ts
46
+ function createRegexCache(capacity = 100) {
47
+ return new LRUCache(capacity);
48
+ }
49
+ function getCachedRegex(cache, pattern) {
50
+ let cached = cache.get(pattern);
51
+ if (!cached) {
52
+ cached = new RegExp(pattern);
53
+ cache.set(pattern, cached);
54
+ }
55
+ return cached;
56
+ }
57
+
58
+ // src/validation/primitives/text.ts
59
+ var textRegexCache = createRegexCache();
60
+ function createTextValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
61
+ let schema = zod.z.string();
62
+ if (attr.minLength !== void 0) {
63
+ schema = schema.min(attr.minLength, messages.minLength(attr, attr.minLength));
64
+ }
65
+ if (attr.maxLength !== void 0) {
66
+ schema = schema.max(attr.maxLength, messages.maxLength(attr, attr.maxLength));
67
+ }
68
+ if (attr.pattern) {
69
+ schema = schema.regex(
70
+ getCachedRegex(textRegexCache, attr.pattern),
71
+ messages.invalidPattern(attr)
72
+ );
73
+ }
74
+ return schema;
75
+ }
76
+ function createTextAreaValidator(_attr, _messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
77
+ return zod.z.string();
78
+ }
79
+
80
+ exports.createTextAreaValidator = createTextAreaValidator;
81
+ exports.createTextValidator = createTextValidator;
@@ -1,4 +1,4 @@
1
- import { DEFAULT_VALIDATION_MESSAGES } from './chunk-JEDANRCG.mjs';
1
+ import { DEFAULT_VALIDATION_MESSAGES } from './chunk-UQVW4KPP.mjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  function createDateValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
@@ -1,4 +1,4 @@
1
- import { DEFAULT_VALIDATION_MESSAGES } from './chunk-JEDANRCG.mjs';
1
+ import { DEFAULT_VALIDATION_MESSAGES } from './chunk-UQVW4KPP.mjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  function createFileValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var chunk5SQEKHPW_js = require('./chunk-5SQEKHPW.js');
3
+ var chunkT225DB55_js = require('./chunk-T225DB55.js');
4
4
  var zod = require('zod');
5
5
 
6
- function createSelectValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
6
+ function createSelectValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
7
7
  const validValues = attr.options.map((opt) => opt.value);
8
8
  const validLabels = attr.options.map((opt) => opt.label);
9
9
  return zod.z.enum(validValues, {
10
10
  message: messages.invalidOption(attr, validLabels)
11
11
  });
12
12
  }
13
- function createMultiselectValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
13
+ function createMultiselectValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
14
14
  const validValues = attr.options.map((opt) => opt.value);
15
15
  const validLabels = attr.options.map((opt) => opt.label);
16
16
  return zod.z.array(
@@ -19,7 +19,7 @@ function createMultiselectValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VA
19
19
  })
20
20
  );
21
21
  }
22
- function createStatusValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
22
+ function createStatusValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
23
23
  const validValues = attr.options.map((opt) => opt.value);
24
24
  const validLabels = attr.options.map((opt) => opt.label);
25
25
  return zod.z.enum(validValues, {
@@ -1,20 +1,19 @@
1
- import { createCheckboxValidator } from './chunk-2LUHLHLE.mjs';
2
- import { createDateValidator } from './chunk-BZTLI773.mjs';
3
- import { createNumberValidator } from './chunk-6MXQAQBB.mjs';
4
- import { createRatingValidator } from './chunk-4IVCBFJA.mjs';
5
- import { createTextAreaValidator, createTextValidator } from './chunk-7FSIBNRH.mjs';
6
- import { createRelationValidator } from './chunk-XPFWKISJ.mjs';
7
- import { createRichtextValidator } from './chunk-ALV6GETG.mjs';
8
- import { createMultiselectValidator, createSelectValidator, createStatusValidator } from './chunk-ZJNX6UXB.mjs';
9
- import { createUserValidator } from './chunk-3RFFA4EV.mjs';
10
- import { createFormulaValidator } from './chunk-TV4G2KMD.mjs';
11
- import { createRollupValidator } from './chunk-VC4E3OSZ.mjs';
12
- import { createCurrencyValidator } from './chunk-FKPYFM6G.mjs';
13
- import { createFileValidator } from './chunk-ERG77ADK.mjs';
14
- import { createLocationValidator } from './chunk-RDGBQM3N.mjs';
15
- import { createPhoneValidator } from './chunk-P4NGPF5L.mjs';
16
- import { DEFAULT_VALIDATION_MESSAGES } from './chunk-JEDANRCG.mjs';
17
- import { formatZodErrors } from './chunk-RDXQ4CYT.mjs';
1
+ import { createCheckboxValidator } from './chunk-TMYBEXBT.mjs';
2
+ import { createDateValidator } from './chunk-4KRLCWJM.mjs';
3
+ import { createNumberValidator } from './chunk-KNYZH2WD.mjs';
4
+ import { createRatingValidator } from './chunk-RUYUFXNW.mjs';
5
+ import { createTextAreaValidator, createTextValidator } from './chunk-KWVCGQ7N.mjs';
6
+ import { createRichtextValidator } from './chunk-BLXQGQLK.mjs';
7
+ import { createMultiselectValidator, createSelectValidator, createStatusValidator } from './chunk-7HFZ7MVR.mjs';
8
+ import { createUserValidator } from './chunk-ITTQ4FGR.mjs';
9
+ import { createFormulaValidator } from './chunk-IRTRJH37.mjs';
10
+ import { createRollupValidator } from './chunk-OLJLCVNY.mjs';
11
+ import { createCurrencyValidator } from './chunk-AYCSVKI2.mjs';
12
+ import { createFileValidator } from './chunk-4TC27SMF.mjs';
13
+ import { createLocationValidator } from './chunk-WV4V64D5.mjs';
14
+ import { createPhoneValidator } from './chunk-5XL3JP73.mjs';
15
+ import { createRelationValidator } from './chunk-R4CJHCC4.mjs';
16
+ import { DEFAULT_VALIDATION_MESSAGES, formatZodErrors } from './chunk-UQVW4KPP.mjs';
18
17
  import { z } from 'zod';
19
18
 
20
19
  function isEmptyValue(value) {
@@ -82,21 +81,31 @@ function createFormAttributeValidator(attr, messages = DEFAULT_VALIDATION_MESSAG
82
81
  }
83
82
  return validator;
84
83
  }
84
+ var objectValidatorCache = /* @__PURE__ */ new WeakMap();
85
+ var draftValidatorCache = /* @__PURE__ */ new WeakMap();
85
86
  function createObjectValidator(objectDef) {
87
+ const cached = objectValidatorCache.get(objectDef);
88
+ if (cached) return cached;
86
89
  const shape = {};
87
90
  for (const attr of objectDef.attributes) {
88
91
  const validator = createAttributeValidator(attr);
89
92
  shape[attr.name] = attr.required ? validator : withEmptyToNull(validator);
90
93
  }
91
- return z.object(shape).passthrough();
94
+ const schema = z.object(shape).passthrough();
95
+ objectValidatorCache.set(objectDef, schema);
96
+ return schema;
92
97
  }
93
98
  function createDraftValidator(objectDef) {
99
+ const cached = draftValidatorCache.get(objectDef);
100
+ if (cached) return cached;
94
101
  const shape = {};
95
102
  for (const attr of objectDef.attributes) {
96
103
  const validator = createAttributeValidator(attr);
97
104
  shape[attr.name] = withEmptyToNull(validator);
98
105
  }
99
- return z.object(shape).passthrough();
106
+ const schema = z.object(shape).passthrough();
107
+ draftValidatorCache.set(objectDef, schema);
108
+ return schema;
100
109
  }
101
110
 
102
111
  // src/validation/object/helpers.ts
@@ -1,5 +1,5 @@
1
- import { DEFAULT_VALIDATION_MESSAGES } from './chunk-JEDANRCG.mjs';
2
- import { getCountryByIso3, stripTrunkPrefix, isValidIso3 } from '@stndrds/constants';
1
+ import { DEFAULT_VALIDATION_MESSAGES } from './chunk-UQVW4KPP.mjs';
2
+ import { getCountryByIso3, isValidIso3, stripTrunkPrefix } from '@stndrds/constants';
3
3
  import { z } from 'zod';
4
4
  import { parsePhoneNumberFromString } from 'libphonenumber-js';
5
5
 
@@ -61,22 +61,6 @@ function formatPhoneForDisplay(phone) {
61
61
  }
62
62
  return `${dial} ${phone.phoneNumber}`.trim();
63
63
  }
64
- function parseRawPhoneInput(rawInput, countryIso3) {
65
- if (!rawInput || rawInput.trim() === "") {
66
- return { success: false, error: "Phone number is empty" };
67
- }
68
- const normalized = normalizePhoneNumber(rawInput, countryIso3);
69
- if (!normalized) {
70
- return { success: false, error: "Could not extract digits from input" };
71
- }
72
- if (!validatePhoneNumber(normalized, countryIso3)) {
73
- return { success: false, error: "Invalid phone number for country" };
74
- }
75
- return {
76
- success: true,
77
- phone: { countryCode: countryIso3, phoneNumber: normalized }
78
- };
79
- }
80
64
 
81
65
  // src/validation/complex/phone.ts
82
66
  function createPhoneValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
@@ -96,4 +80,4 @@ function createPhoneValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
96
80
  });
97
81
  }
98
82
 
99
- export { createPhoneValidator, formatPhoneForDisplay, normalizePhoneNumber, parseRawPhoneInput, validatePhoneNumber };
83
+ export { createPhoneValidator, formatPhoneForDisplay };
@@ -1,4 +1,4 @@
1
- import { DEFAULT_VALIDATION_MESSAGES } from './chunk-JEDANRCG.mjs';
1
+ import { DEFAULT_VALIDATION_MESSAGES } from './chunk-UQVW4KPP.mjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  function createSelectValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunk5SQEKHPW_js = require('./chunk-5SQEKHPW.js');
3
+ var chunkT225DB55_js = require('./chunk-T225DB55.js');
4
4
  var zod = require('zod');
5
5
 
6
- function createRollupValidator(_attr, _messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
6
+ function createRollupValidator(_attr, _messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
7
7
  return zod.z.unknown();
8
8
  }
9
9
 
@@ -1,4 +1,4 @@
1
- import { DEFAULT_VALIDATION_MESSAGES } from './chunk-JEDANRCG.mjs';
1
+ import { DEFAULT_VALIDATION_MESSAGES } from './chunk-UQVW4KPP.mjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  function createCurrencyValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
@@ -1,4 +1,4 @@
1
- import { DEFAULT_VALIDATION_MESSAGES } from './chunk-JEDANRCG.mjs';
1
+ import { DEFAULT_VALIDATION_MESSAGES } from './chunk-UQVW4KPP.mjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  function createRichtextValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunk5SQEKHPW_js = require('./chunk-5SQEKHPW.js');
3
+ var chunkT225DB55_js = require('./chunk-T225DB55.js');
4
4
  var zod = require('zod');
5
5
 
6
- function createRatingValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
6
+ function createRatingValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
7
7
  let schema = zod.z.number().min(0);
8
8
  if (attr.max !== void 0) {
9
9
  schema = schema.max(attr.max, messages.maxValue(attr, attr.max));
@@ -17,17 +17,6 @@ function generateId() {
17
17
  return v.toString(16);
18
18
  });
19
19
  }
20
- function generatePrefixedId(prefix) {
21
- return `${prefix}_${generateId()}`;
22
- }
23
- function slugify(input) {
24
- return input.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase().replace(/[^a-z0-9\s_-]/g, "").trim().replace(/\s+/g, "-").replace(/-+/g, "-");
25
- }
26
- function generateTemplateName(label) {
27
- const slug = slugify(label) || "template";
28
- const suffix = generateId().slice(0, 8);
29
- return `${slug}-${suffix}`;
30
- }
31
20
  function indexBy(items, keyFn) {
32
21
  return new Map(items.map((item) => [keyFn(item), item]));
33
22
  }
@@ -55,7 +44,4 @@ exports.asTenantId = asTenantId;
55
44
  exports.asUserId = asUserId;
56
45
  exports.deepEqual = deepEqual;
57
46
  exports.generateId = generateId;
58
- exports.generatePrefixedId = generatePrefixedId;
59
- exports.generateTemplateName = generateTemplateName;
60
47
  exports.indexBy = indexBy;
61
- exports.slugify = slugify;
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunk5SQEKHPW_js = require('./chunk-5SQEKHPW.js');
3
+ var chunkT225DB55_js = require('./chunk-T225DB55.js');
4
4
  var zod = require('zod');
5
5
 
6
- function createCurrencyValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
6
+ function createCurrencyValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
7
7
  return zod.z.object(
8
8
  {
9
9
  code: zod.z.string().length(3),
@@ -1,4 +1,4 @@
1
- import { DEFAULT_VALIDATION_MESSAGES } from './chunk-JEDANRCG.mjs';
1
+ import { DEFAULT_VALIDATION_MESSAGES } from './chunk-UQVW4KPP.mjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  function createFormulaValidator(_attr, _messages = DEFAULT_VALIDATION_MESSAGES) {
@@ -1,4 +1,4 @@
1
- import { DEFAULT_VALIDATION_MESSAGES } from './chunk-JEDANRCG.mjs';
1
+ import { DEFAULT_VALIDATION_MESSAGES } from './chunk-UQVW4KPP.mjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  function createUserValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunk5SQEKHPW_js = require('./chunk-5SQEKHPW.js');
3
+ var chunkT225DB55_js = require('./chunk-T225DB55.js');
4
4
  var zod = require('zod');
5
5
 
6
- function createDateValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
6
+ function createDateValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
7
7
  return zod.z.coerce.date({ message: messages.invalidDate(attr) });
8
8
  }
9
9
 
@@ -1,4 +1,4 @@
1
- import { DEFAULT_VALIDATION_MESSAGES } from './chunk-JEDANRCG.mjs';
1
+ import { DEFAULT_VALIDATION_MESSAGES } from './chunk-UQVW4KPP.mjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  function createNumberValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
@@ -0,0 +1,78 @@
1
+ import { DEFAULT_VALIDATION_MESSAGES } from './chunk-UQVW4KPP.mjs';
2
+ import { z } from 'zod';
3
+
4
+ // src/lib/lru-cache.ts
5
+ var LRUCache = class {
6
+ constructor(capacity) {
7
+ if (capacity <= 0) {
8
+ throw new Error("LRU cache capacity must be greater than 0");
9
+ }
10
+ this.capacity = capacity;
11
+ this.cache = /* @__PURE__ */ new Map();
12
+ }
13
+ get(key) {
14
+ const value = this.cache.get(key);
15
+ if (value !== void 0) {
16
+ this.cache.delete(key);
17
+ this.cache.set(key, value);
18
+ }
19
+ return value;
20
+ }
21
+ set(key, value) {
22
+ if (this.cache.has(key)) {
23
+ this.cache.delete(key);
24
+ } else if (this.cache.size >= this.capacity) {
25
+ const firstKey = this.cache.keys().next().value;
26
+ if (firstKey !== void 0) {
27
+ this.cache.delete(firstKey);
28
+ }
29
+ }
30
+ this.cache.set(key, value);
31
+ }
32
+ has(key) {
33
+ return this.cache.has(key);
34
+ }
35
+ clear() {
36
+ this.cache.clear();
37
+ }
38
+ get size() {
39
+ return this.cache.size;
40
+ }
41
+ };
42
+
43
+ // src/validation/core/regex-cache.ts
44
+ function createRegexCache(capacity = 100) {
45
+ return new LRUCache(capacity);
46
+ }
47
+ function getCachedRegex(cache, pattern) {
48
+ let cached = cache.get(pattern);
49
+ if (!cached) {
50
+ cached = new RegExp(pattern);
51
+ cache.set(pattern, cached);
52
+ }
53
+ return cached;
54
+ }
55
+
56
+ // src/validation/primitives/text.ts
57
+ var textRegexCache = createRegexCache();
58
+ function createTextValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
59
+ let schema = z.string();
60
+ if (attr.minLength !== void 0) {
61
+ schema = schema.min(attr.minLength, messages.minLength(attr, attr.minLength));
62
+ }
63
+ if (attr.maxLength !== void 0) {
64
+ schema = schema.max(attr.maxLength, messages.maxLength(attr, attr.maxLength));
65
+ }
66
+ if (attr.pattern) {
67
+ schema = schema.regex(
68
+ getCachedRegex(textRegexCache, attr.pattern),
69
+ messages.invalidPattern(attr)
70
+ );
71
+ }
72
+ return schema;
73
+ }
74
+ function createTextAreaValidator(_attr, _messages = DEFAULT_VALIDATION_MESSAGES) {
75
+ return z.string();
76
+ }
77
+
78
+ export { createTextAreaValidator, createTextValidator };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var chunkT225DB55_js = require('./chunk-T225DB55.js');
4
+ var zod = require('zod');
5
+
6
+ function createCheckboxValidator(_attr, _messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
7
+ return zod.z.boolean();
8
+ }
9
+
10
+ exports.createCheckboxValidator = createCheckboxValidator;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk5SQEKHPW_js = require('./chunk-5SQEKHPW.js');
3
+ var chunkT225DB55_js = require('./chunk-T225DB55.js');
4
4
  var constants = require('@stndrds/constants');
5
5
  var zod = require('zod');
6
6
  var libphonenumberJs = require('libphonenumber-js');
@@ -63,25 +63,9 @@ function formatPhoneForDisplay(phone) {
63
63
  }
64
64
  return `${dial} ${phone.phoneNumber}`.trim();
65
65
  }
66
- function parseRawPhoneInput(rawInput, countryIso3) {
67
- if (!rawInput || rawInput.trim() === "") {
68
- return { success: false, error: "Phone number is empty" };
69
- }
70
- const normalized = normalizePhoneNumber(rawInput, countryIso3);
71
- if (!normalized) {
72
- return { success: false, error: "Could not extract digits from input" };
73
- }
74
- if (!validatePhoneNumber(normalized, countryIso3)) {
75
- return { success: false, error: "Invalid phone number for country" };
76
- }
77
- return {
78
- success: true,
79
- phone: { countryCode: countryIso3, phoneNumber: normalized }
80
- };
81
- }
82
66
 
83
67
  // src/validation/complex/phone.ts
84
- function createPhoneValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
68
+ function createPhoneValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
85
69
  return zod.z.object(
86
70
  {
87
71
  countryCode: zod.z.string().length(3),
@@ -100,6 +84,3 @@ function createPhoneValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATI
100
84
 
101
85
  exports.createPhoneValidator = createPhoneValidator;
102
86
  exports.formatPhoneForDisplay = formatPhoneForDisplay;
103
- exports.normalizePhoneNumber = normalizePhoneNumber;
104
- exports.parseRawPhoneInput = parseRawPhoneInput;
105
- exports.validatePhoneNumber = validatePhoneNumber;
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunk5SQEKHPW_js = require('./chunk-5SQEKHPW.js');
3
+ var chunkT225DB55_js = require('./chunk-T225DB55.js');
4
4
  var zod = require('zod');
5
5
 
6
- function createFormulaValidator(_attr, _messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
6
+ function createFormulaValidator(_attr, _messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
7
7
  return zod.z.unknown();
8
8
  }
9
9
 
@@ -1,4 +1,4 @@
1
- import { DEFAULT_VALIDATION_MESSAGES } from './chunk-JEDANRCG.mjs';
1
+ import { DEFAULT_VALIDATION_MESSAGES } from './chunk-UQVW4KPP.mjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  function createRollupValidator(_attr, _messages = DEFAULT_VALIDATION_MESSAGES) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunk5SQEKHPW_js = require('./chunk-5SQEKHPW.js');
3
+ var chunkT225DB55_js = require('./chunk-T225DB55.js');
4
4
  var zod = require('zod');
5
5
 
6
6
  function extractRelationId(item) {
@@ -9,7 +9,7 @@ function extractRelationId(item) {
9
9
  }
10
10
  return item;
11
11
  }
12
- function createSingleRelationValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
12
+ function createSingleRelationValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
13
13
  const uuidSchema = zod.z.uuid({
14
14
  message: messages.invalidId(attr)
15
15
  });
@@ -23,7 +23,7 @@ function createSingleRelationValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT
23
23
  // Allow additional properties (bilateral relations may have extra metadata)
24
24
  ]);
25
25
  }
26
- function createMultiRelationValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
26
+ function createMultiRelationValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
27
27
  const uuidSchema = zod.z.uuid({
28
28
  message: messages.invalidId(attr)
29
29
  });
@@ -52,7 +52,7 @@ function createMultiRelationValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_
52
52
  { message: messages.invalidId(attr) }
53
53
  );
54
54
  }
55
- function createRelationValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
55
+ function createRelationValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
56
56
  if (attr.cardinality === "many") {
57
57
  return createMultiRelationValidator(attr, messages);
58
58
  }
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunk5SQEKHPW_js = require('./chunk-5SQEKHPW.js');
3
+ var chunkT225DB55_js = require('./chunk-T225DB55.js');
4
4
  var zod = require('zod');
5
5
 
6
- function createRichtextValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
6
+ function createRichtextValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
7
7
  return zod.z.string({
8
8
  message: messages.invalidRichtext(attr)
9
9
  });
@@ -15,17 +15,6 @@ function generateId() {
15
15
  return v.toString(16);
16
16
  });
17
17
  }
18
- function generatePrefixedId(prefix) {
19
- return `${prefix}_${generateId()}`;
20
- }
21
- function slugify(input) {
22
- return input.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase().replace(/[^a-z0-9\s_-]/g, "").trim().replace(/\s+/g, "-").replace(/-+/g, "-");
23
- }
24
- function generateTemplateName(label) {
25
- const slug = slugify(label) || "template";
26
- const suffix = generateId().slice(0, 8);
27
- return `${slug}-${suffix}`;
28
- }
29
18
  function indexBy(items, keyFn) {
30
19
  return new Map(items.map((item) => [keyFn(item), item]));
31
20
  }
@@ -49,4 +38,4 @@ function deepEqual(a, b) {
49
38
  return false;
50
39
  }
51
40
 
52
- export { asTenantId, asUserId, deepEqual, generateId, generatePrefixedId, generateTemplateName, indexBy, slugify };
41
+ export { asTenantId, asUserId, deepEqual, generateId, indexBy };