@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
@@ -1,22 +1,21 @@
1
1
  'use strict';
2
2
 
3
- var chunk4DMDOSFN_js = require('./chunk-4DMDOSFN.js');
4
- var chunkFKETRWAF_js = require('./chunk-FKETRWAF.js');
5
- var chunkATA4XHB4_js = require('./chunk-ATA4XHB4.js');
6
- var chunkSTKN6A5M_js = require('./chunk-STKN6A5M.js');
7
- var chunkZWMMEQI7_js = require('./chunk-ZWMMEQI7.js');
8
- var chunkANP6HGMJ_js = require('./chunk-ANP6HGMJ.js');
9
- var chunkHJNLL34O_js = require('./chunk-HJNLL34O.js');
10
- var chunkOO2LJ6GP_js = require('./chunk-OO2LJ6GP.js');
11
- var chunkKC2FFNL4_js = require('./chunk-KC2FFNL4.js');
12
- var chunkUPEQEX2D_js = require('./chunk-UPEQEX2D.js');
13
- var chunk6IFD5732_js = require('./chunk-6IFD5732.js');
14
- var chunkQPDXDX7A_js = require('./chunk-QPDXDX7A.js');
15
- var chunkC7KW4NAD_js = require('./chunk-C7KW4NAD.js');
16
- var chunk5CBTJS7J_js = require('./chunk-5CBTJS7J.js');
17
- var chunkH3VBSMVW_js = require('./chunk-H3VBSMVW.js');
18
- var chunk5SQEKHPW_js = require('./chunk-5SQEKHPW.js');
19
- var chunkBEN6TE7Y_js = require('./chunk-BEN6TE7Y.js');
3
+ var chunkMAKSIK3P_js = require('./chunk-MAKSIK3P.js');
4
+ var chunkJ5HRK3WD_js = require('./chunk-J5HRK3WD.js');
5
+ var chunkTKN73433_js = require('./chunk-TKN73433.js');
6
+ var chunkD7WFIGXW_js = require('./chunk-D7WFIGXW.js');
7
+ var chunk3JINFUN3_js = require('./chunk-3JINFUN3.js');
8
+ var chunkQWZHR2OO_js = require('./chunk-QWZHR2OO.js');
9
+ var chunk56QI6UTK_js = require('./chunk-56QI6UTK.js');
10
+ var chunkVXOTYFEW_js = require('./chunk-VXOTYFEW.js');
11
+ var chunkOAQWRMTP_js = require('./chunk-OAQWRMTP.js');
12
+ var chunkACQ3TUFK_js = require('./chunk-ACQ3TUFK.js');
13
+ var chunkGCRHSPZN_js = require('./chunk-GCRHSPZN.js');
14
+ var chunkROAZLZA2_js = require('./chunk-ROAZLZA2.js');
15
+ var chunkRJ4LOX7P_js = require('./chunk-RJ4LOX7P.js');
16
+ var chunkN7T66JVY_js = require('./chunk-N7T66JVY.js');
17
+ var chunkP2BE2A2G_js = require('./chunk-P2BE2A2G.js');
18
+ var chunkT225DB55_js = require('./chunk-T225DB55.js');
20
19
  var zod = require('zod');
21
20
 
22
21
  function isEmptyValue(value) {
@@ -35,70 +34,80 @@ function withEmptyToNull(validator) {
35
34
  }
36
35
 
37
36
  // src/validation/object/attribute-factory.ts
38
- function createAttributeValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
37
+ function createAttributeValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
39
38
  switch (attr.type) {
40
39
  case "text":
41
- return chunkZWMMEQI7_js.createTextValidator(attr, messages);
40
+ return chunk3JINFUN3_js.createTextValidator(attr, messages);
42
41
  case "textarea":
43
- return chunkZWMMEQI7_js.createTextAreaValidator(attr, messages);
42
+ return chunk3JINFUN3_js.createTextAreaValidator(attr, messages);
44
43
  case "richtext":
45
- return chunkHJNLL34O_js.createRichtextValidator(attr, messages);
44
+ return chunkQWZHR2OO_js.createRichtextValidator(attr, messages);
46
45
  case "number":
47
- return chunkATA4XHB4_js.createNumberValidator(attr, messages);
46
+ return chunkTKN73433_js.createNumberValidator(attr, messages);
48
47
  case "checkbox":
49
- return chunk4DMDOSFN_js.createCheckboxValidator(attr, messages);
48
+ return chunkMAKSIK3P_js.createCheckboxValidator(attr, messages);
50
49
  case "date":
51
- return chunkFKETRWAF_js.createDateValidator(attr, messages);
50
+ return chunkJ5HRK3WD_js.createDateValidator(attr, messages);
52
51
  case "phone":
53
- return chunkH3VBSMVW_js.createPhoneValidator(attr, messages);
52
+ return chunkN7T66JVY_js.createPhoneValidator(attr, messages);
54
53
  case "currency":
55
- return chunkQPDXDX7A_js.createCurrencyValidator(attr, messages);
54
+ return chunkGCRHSPZN_js.createCurrencyValidator(attr, messages);
56
55
  case "status":
57
- return chunkOO2LJ6GP_js.createStatusValidator(attr, messages);
56
+ return chunk56QI6UTK_js.createStatusValidator(attr, messages);
58
57
  case "location":
59
- return chunk5CBTJS7J_js.createLocationValidator(attr, messages);
58
+ return chunkRJ4LOX7P_js.createLocationValidator(attr, messages);
60
59
  case "select":
61
- return chunkOO2LJ6GP_js.createSelectValidator(attr, messages);
60
+ return chunk56QI6UTK_js.createSelectValidator(attr, messages);
62
61
  case "multiselect":
63
- return chunkOO2LJ6GP_js.createMultiselectValidator(attr, messages);
62
+ return chunk56QI6UTK_js.createMultiselectValidator(attr, messages);
64
63
  case "file":
65
- return chunkC7KW4NAD_js.createFileValidator(attr, messages);
64
+ return chunkROAZLZA2_js.createFileValidator(attr, messages);
66
65
  case "user":
67
- return chunkKC2FFNL4_js.createUserValidator(attr, messages);
66
+ return chunkVXOTYFEW_js.createUserValidator(attr, messages);
68
67
  case "relation":
69
- return chunkANP6HGMJ_js.createRelationValidator(attr, messages);
68
+ return chunkP2BE2A2G_js.createRelationValidator(attr, messages);
70
69
  case "rating":
71
- return chunkSTKN6A5M_js.createRatingValidator(attr, messages);
70
+ return chunkD7WFIGXW_js.createRatingValidator(attr, messages);
72
71
  case "formula":
73
- return chunkUPEQEX2D_js.createFormulaValidator(attr, messages);
72
+ return chunkOAQWRMTP_js.createFormulaValidator(attr, messages);
74
73
  case "rollup":
75
- return chunk6IFD5732_js.createRollupValidator(attr, messages);
74
+ return chunkACQ3TUFK_js.createRollupValidator(attr, messages);
76
75
  default:
77
76
  return zod.z.unknown();
78
77
  }
79
78
  }
80
- function createFormAttributeValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
79
+ function createFormAttributeValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
81
80
  const validator = createAttributeValidator(attr, messages);
82
81
  if (!attr.required) {
83
82
  return withEmptyToNull(validator);
84
83
  }
85
84
  return validator;
86
85
  }
86
+ var objectValidatorCache = /* @__PURE__ */ new WeakMap();
87
+ var draftValidatorCache = /* @__PURE__ */ new WeakMap();
87
88
  function createObjectValidator(objectDef) {
89
+ const cached = objectValidatorCache.get(objectDef);
90
+ if (cached) return cached;
88
91
  const shape = {};
89
92
  for (const attr of objectDef.attributes) {
90
93
  const validator = createAttributeValidator(attr);
91
94
  shape[attr.name] = attr.required ? validator : withEmptyToNull(validator);
92
95
  }
93
- return zod.z.object(shape).passthrough();
96
+ const schema = zod.z.object(shape).passthrough();
97
+ objectValidatorCache.set(objectDef, schema);
98
+ return schema;
94
99
  }
95
100
  function createDraftValidator(objectDef) {
101
+ const cached = draftValidatorCache.get(objectDef);
102
+ if (cached) return cached;
96
103
  const shape = {};
97
104
  for (const attr of objectDef.attributes) {
98
105
  const validator = createAttributeValidator(attr);
99
106
  shape[attr.name] = withEmptyToNull(validator);
100
107
  }
101
- return zod.z.object(shape).passthrough();
108
+ const schema = zod.z.object(shape).passthrough();
109
+ draftValidatorCache.set(objectDef, schema);
110
+ return schema;
102
111
  }
103
112
 
104
113
  // src/validation/object/helpers.ts
@@ -116,7 +125,7 @@ function validateAttribute(attr, value) {
116
125
  }
117
126
  return {
118
127
  success: false,
119
- errors: chunkBEN6TE7Y_js.formatZodErrors(result.error).map((err) => ({
128
+ errors: chunkT225DB55_js.formatZodErrors(result.error).map((err) => ({
120
129
  path: [attr.name, ...err.path],
121
130
  message: err.message
122
131
  }))
@@ -133,7 +142,7 @@ function validateObject(objectDef, data) {
133
142
  }
134
143
  return {
135
144
  success: false,
136
- errors: chunkBEN6TE7Y_js.formatZodErrors(result.error)
145
+ errors: chunkT225DB55_js.formatZodErrors(result.error)
137
146
  };
138
147
  }
139
148
  function validateObjectOrThrow(objectDef, data) {
@@ -156,7 +165,7 @@ function validateDraft(objectDef, data) {
156
165
  }
157
166
  return {
158
167
  success: false,
159
- errors: chunkBEN6TE7Y_js.formatZodErrors(result.error)
168
+ errors: chunkT225DB55_js.formatZodErrors(result.error)
160
169
  };
161
170
  }
162
171
  function validateDraftOrThrow(objectDef, data) {
@@ -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 extractRelationId(item) {
@@ -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 createLocationValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
6
+ function createLocationValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
7
7
  return zod.z.object(
8
8
  {
9
9
  address: zod.z.string().optional(),
@@ -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 createFileValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
6
+ function createFileValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
7
7
  const uuidSchema = zod.z.uuid({
8
8
  message: messages.invalidId(attr)
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 createRatingValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
@@ -1,6 +1,6 @@
1
- import { formatZodErrors } from './chunk-RDXQ4CYT.mjs';
2
1
  import { z } from 'zod';
3
2
 
3
+ // src/validation/config/schemas.ts
4
4
  var baseConfigSchema = z.object({
5
5
  disabled: z.boolean().optional(),
6
6
  placeholder: z.string().optional(),
@@ -168,25 +168,9 @@ var attributeConfigSchemas = {
168
168
  function getAttributeConfigSchema(type) {
169
169
  return attributeConfigSchemas[type];
170
170
  }
171
- function validateAttributeConfig(type, config) {
172
- const schema = getAttributeConfigSchema(type);
173
- const result = schema.safeParse(config);
174
- if (result.success) {
175
- return { success: true, data: result.data };
176
- }
177
- return {
178
- success: false,
179
- errors: formatZodErrors(result.error).map((err) => `${err.path.join(".")}: ${err.message}`)
180
- };
181
- }
182
171
  function parseAttributeConfig(type, config) {
183
172
  const schema = getAttributeConfigSchema(type);
184
173
  return schema.strip().parse(config);
185
174
  }
186
- function safeParseAttributeConfig(type, config) {
187
- const schema = getAttributeConfigSchema(type);
188
- const result = schema.strip().safeParse(config);
189
- return result.success ? result.data : void 0;
190
- }
191
175
 
192
- 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 };
176
+ export { attributeConfigSchemas, getAttributeConfigSchema, parseAttributeConfig };
@@ -21,58 +21,13 @@ var DEFAULT_VALIDATION_MESSAGES = {
21
21
  invalidLocation: (attr) => `${attr.label} must be a valid location`
22
22
  };
23
23
 
24
- // src/lib/lru-cache.ts
25
- var LRUCache = class {
26
- constructor(capacity) {
27
- if (capacity <= 0) {
28
- throw new Error("LRU cache capacity must be greater than 0");
29
- }
30
- this.capacity = capacity;
31
- this.cache = /* @__PURE__ */ new Map();
32
- }
33
- get(key) {
34
- const value = this.cache.get(key);
35
- if (value !== void 0) {
36
- this.cache.delete(key);
37
- this.cache.set(key, value);
38
- }
39
- return value;
40
- }
41
- set(key, value) {
42
- if (this.cache.has(key)) {
43
- this.cache.delete(key);
44
- } else if (this.cache.size >= this.capacity) {
45
- const firstKey = this.cache.keys().next().value;
46
- if (firstKey !== void 0) {
47
- this.cache.delete(firstKey);
48
- }
49
- }
50
- this.cache.set(key, value);
51
- }
52
- has(key) {
53
- return this.cache.has(key);
54
- }
55
- clear() {
56
- this.cache.clear();
57
- }
58
- get size() {
59
- return this.cache.size;
60
- }
61
- };
62
-
63
- // src/validation/core/regex-cache.ts
64
- function createRegexCache(capacity = 100) {
65
- return new LRUCache(capacity);
66
- }
67
- function getCachedRegex(cache, pattern) {
68
- let cached = cache.get(pattern);
69
- if (!cached) {
70
- cached = new RegExp(pattern);
71
- cache.set(pattern, cached);
72
- }
73
- return cached;
24
+ // src/validation/core/errors.ts
25
+ function formatZodErrors(error) {
26
+ return error.issues.map((err) => ({
27
+ path: err.path.map(String),
28
+ message: err.message
29
+ }));
74
30
  }
75
31
 
76
32
  exports.DEFAULT_VALIDATION_MESSAGES = DEFAULT_VALIDATION_MESSAGES;
77
- exports.createRegexCache = createRegexCache;
78
- exports.getCachedRegex = getCachedRegex;
33
+ exports.formatZodErrors = formatZodErrors;
@@ -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 createNumberValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
6
+ function createNumberValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
7
7
  let schema = zod.z.number();
8
8
  if (attr.min !== void 0) {
9
9
  schema = schema.min(attr.min, messages.minValue(attr, attr.min));
@@ -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 createCheckboxValidator(_attr, _messages = DEFAULT_VALIDATION_MESSAGES) {
@@ -19,56 +19,12 @@ var DEFAULT_VALIDATION_MESSAGES = {
19
19
  invalidLocation: (attr) => `${attr.label} must be a valid location`
20
20
  };
21
21
 
22
- // src/lib/lru-cache.ts
23
- var LRUCache = class {
24
- constructor(capacity) {
25
- if (capacity <= 0) {
26
- throw new Error("LRU cache capacity must be greater than 0");
27
- }
28
- this.capacity = capacity;
29
- this.cache = /* @__PURE__ */ new Map();
30
- }
31
- get(key) {
32
- const value = this.cache.get(key);
33
- if (value !== void 0) {
34
- this.cache.delete(key);
35
- this.cache.set(key, value);
36
- }
37
- return value;
38
- }
39
- set(key, value) {
40
- if (this.cache.has(key)) {
41
- this.cache.delete(key);
42
- } else if (this.cache.size >= this.capacity) {
43
- const firstKey = this.cache.keys().next().value;
44
- if (firstKey !== void 0) {
45
- this.cache.delete(firstKey);
46
- }
47
- }
48
- this.cache.set(key, value);
49
- }
50
- has(key) {
51
- return this.cache.has(key);
52
- }
53
- clear() {
54
- this.cache.clear();
55
- }
56
- get size() {
57
- return this.cache.size;
58
- }
59
- };
60
-
61
- // src/validation/core/regex-cache.ts
62
- function createRegexCache(capacity = 100) {
63
- return new LRUCache(capacity);
64
- }
65
- function getCachedRegex(cache, pattern) {
66
- let cached = cache.get(pattern);
67
- if (!cached) {
68
- cached = new RegExp(pattern);
69
- cache.set(pattern, cached);
70
- }
71
- return cached;
22
+ // src/validation/core/errors.ts
23
+ function formatZodErrors(error) {
24
+ return error.issues.map((err) => ({
25
+ path: err.path.map(String),
26
+ message: err.message
27
+ }));
72
28
  }
73
29
 
74
- export { DEFAULT_VALIDATION_MESSAGES, createRegexCache, getCachedRegex };
30
+ export { DEFAULT_VALIDATION_MESSAGES, formatZodErrors };
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkBEN6TE7Y_js = require('./chunk-BEN6TE7Y.js');
4
3
  var zod = require('zod');
5
4
 
5
+ // src/validation/config/schemas.ts
6
6
  var baseConfigSchema = zod.z.object({
7
7
  disabled: zod.z.boolean().optional(),
8
8
  placeholder: zod.z.string().optional(),
@@ -170,48 +170,11 @@ var attributeConfigSchemas = {
170
170
  function getAttributeConfigSchema(type) {
171
171
  return attributeConfigSchemas[type];
172
172
  }
173
- function validateAttributeConfig(type, config) {
174
- const schema = getAttributeConfigSchema(type);
175
- const result = schema.safeParse(config);
176
- if (result.success) {
177
- return { success: true, data: result.data };
178
- }
179
- return {
180
- success: false,
181
- errors: chunkBEN6TE7Y_js.formatZodErrors(result.error).map((err) => `${err.path.join(".")}: ${err.message}`)
182
- };
183
- }
184
173
  function parseAttributeConfig(type, config) {
185
174
  const schema = getAttributeConfigSchema(type);
186
175
  return schema.strip().parse(config);
187
176
  }
188
- function safeParseAttributeConfig(type, config) {
189
- const schema = getAttributeConfigSchema(type);
190
- const result = schema.strip().safeParse(config);
191
- return result.success ? result.data : void 0;
192
- }
193
177
 
194
178
  exports.attributeConfigSchemas = attributeConfigSchemas;
195
- exports.checkboxConfigSchema = checkboxConfigSchema;
196
- exports.currencyConfigSchema = currencyConfigSchema;
197
- exports.dateConfigSchema = dateConfigSchema;
198
- exports.documentConfigSchema = documentConfigSchema;
199
- exports.fileConfigSchema = fileConfigSchema;
200
- exports.formulaConfigSchema = formulaConfigSchema;
201
179
  exports.getAttributeConfigSchema = getAttributeConfigSchema;
202
- exports.locationConfigSchema = locationConfigSchema;
203
- exports.multiselectConfigSchema = multiselectConfigSchema;
204
- exports.numberConfigSchema = numberConfigSchema;
205
180
  exports.parseAttributeConfig = parseAttributeConfig;
206
- exports.phoneConfigSchema = phoneConfigSchema;
207
- exports.ratingConfigSchema = ratingConfigSchema;
208
- exports.relationConfigSchema = relationConfigSchema;
209
- exports.richtextConfigSchema = richtextConfigSchema;
210
- exports.rollupConfigSchema = rollupConfigSchema;
211
- exports.safeParseAttributeConfig = safeParseAttributeConfig;
212
- exports.selectConfigSchema = selectConfigSchema;
213
- exports.statusConfigSchema = statusConfigSchema;
214
- exports.textConfigSchema = textConfigSchema;
215
- exports.textareaConfigSchema = textareaConfigSchema;
216
- exports.userConfigSchema = userConfigSchema;
217
- exports.validateAttributeConfig = validateAttributeConfig;
@@ -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 createUserValidator(attr, messages = chunk5SQEKHPW_js.DEFAULT_VALIDATION_MESSAGES) {
6
+ function createUserValidator(attr, messages = chunkT225DB55_js.DEFAULT_VALIDATION_MESSAGES) {
7
7
  const uuidSchema = zod.z.uuid({
8
8
  message: messages.invalidId(attr)
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 createLocationValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {