@stndrds/schema 1.0.0-alpha.329 → 1.0.0-alpha.331

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 (165) hide show
  1. package/dist/all-CWDgBPuS.d.ts +1186 -0
  2. package/dist/all-DilIWUev.d.mts +1186 -0
  3. package/dist/capabilities.d.mts +94 -94
  4. package/dist/capabilities.d.ts +94 -94
  5. package/dist/capabilities.js +2 -2
  6. package/dist/capabilities.mjs +2 -2
  7. package/dist/checkbox-CjnTd8DE.d.ts +11 -0
  8. package/dist/checkbox-preO352q.d.mts +11 -0
  9. package/dist/config-BQJJHopR.js +13 -0
  10. package/dist/config-_sOeudpS.mjs +13 -0
  11. package/dist/core-397tQy5q.js +2 -0
  12. package/dist/core-BLHhNykL.mjs +2 -0
  13. package/dist/date-BL3UHIXs.d.mts +24 -0
  14. package/dist/date-CxwHkbid.d.ts +24 -0
  15. package/dist/exceptions-DGCzCc9t.d.mts +1405 -0
  16. package/dist/exceptions-DGCzCc9t.d.ts +1405 -0
  17. package/dist/exceptions.d.mts +3 -2
  18. package/dist/exceptions.d.ts +3 -2
  19. package/dist/exceptions.js +3 -1
  20. package/dist/exceptions.mjs +3 -1
  21. package/dist/index-B7HmBsUS.d.ts +53 -0
  22. package/dist/{helpers-qMMFwD1I.d.ts → index-BoUwfrDH.d.mts} +172 -145
  23. package/dist/index-C8M7Amy9.d.mts +254 -0
  24. package/dist/{helpers-lqSDjgQ1.d.mts → index-DqwNrDSp.d.ts} +172 -145
  25. package/dist/index-Uwy7CTKo.d.ts +254 -0
  26. package/dist/index-XtmC-C7J.d.mts +53 -0
  27. package/dist/index.d.mts +9151 -9136
  28. package/dist/index.d.ts +9151 -9136
  29. package/dist/index.js +21 -27
  30. package/dist/index.mjs +21 -27
  31. package/dist/number-Ddi_YYfm.d.mts +11 -0
  32. package/dist/number-GmD5PM5s.d.ts +11 -0
  33. package/dist/object-DGu0m2Y1.js +4 -0
  34. package/dist/object-DSRy1coV.mjs +4 -0
  35. package/dist/phone-BawtTYVi.mjs +2 -0
  36. package/dist/phone-DVaELsa3.js +2 -0
  37. package/dist/text-A9AJ1wUO.js +2 -0
  38. package/dist/text-C8Lb-NFo.mjs +2 -0
  39. package/dist/text-CxwF5K4k.d.mts +11 -0
  40. package/dist/text-D6UypN8p.d.ts +11 -0
  41. package/dist/utils-fXIvFFl6.mjs +2 -0
  42. package/dist/utils-gY3d9Dwp.js +2 -0
  43. package/dist/utils.d.mts +3 -2
  44. package/dist/utils.d.ts +3 -2
  45. package/dist/utils.js +2 -1
  46. package/dist/utils.mjs +2 -1
  47. package/dist/validation/all.d.mts +6 -8
  48. package/dist/validation/all.d.ts +6 -8
  49. package/dist/validation/all.js +2 -1
  50. package/dist/validation/all.mjs +2 -1
  51. package/dist/validation/complex/currency.d.mts +8 -9
  52. package/dist/validation/complex/currency.d.ts +8 -9
  53. package/dist/validation/complex/currency.js +2 -1
  54. package/dist/validation/complex/currency.mjs +2 -1
  55. package/dist/validation/complex/location.d.mts +14 -15
  56. package/dist/validation/complex/location.d.ts +14 -15
  57. package/dist/validation/complex/location.js +2 -1
  58. package/dist/validation/complex/location.mjs +2 -1
  59. package/dist/validation/complex/phone.d.mts +8 -9
  60. package/dist/validation/complex/phone.d.ts +8 -9
  61. package/dist/validation/complex/phone.js +2 -1
  62. package/dist/validation/complex/phone.mjs +2 -1
  63. package/dist/validation/complex/relation.d.mts +8 -9
  64. package/dist/validation/complex/relation.d.ts +8 -9
  65. package/dist/validation/complex/relation.js +2 -1
  66. package/dist/validation/complex/relation.mjs +2 -1
  67. package/dist/validation/complex/richtext.d.mts +6 -7
  68. package/dist/validation/complex/richtext.d.ts +6 -7
  69. package/dist/validation/complex/richtext.js +2 -1
  70. package/dist/validation/complex/richtext.mjs +2 -1
  71. package/dist/validation/complex/select.d.mts +8 -9
  72. package/dist/validation/complex/select.d.ts +8 -9
  73. package/dist/validation/complex/select.js +2 -1
  74. package/dist/validation/complex/select.mjs +2 -1
  75. package/dist/validation/complex/user.d.mts +6 -7
  76. package/dist/validation/complex/user.d.ts +6 -7
  77. package/dist/validation/complex/user.js +2 -1
  78. package/dist/validation/complex/user.mjs +2 -1
  79. package/dist/validation/computed/formula.d.mts +6 -7
  80. package/dist/validation/computed/formula.d.ts +6 -7
  81. package/dist/validation/computed/formula.js +2 -1
  82. package/dist/validation/computed/formula.mjs +2 -1
  83. package/dist/validation/computed/rollup.d.mts +6 -7
  84. package/dist/validation/computed/rollup.d.ts +6 -7
  85. package/dist/validation/computed/rollup.js +2 -1
  86. package/dist/validation/computed/rollup.mjs +2 -1
  87. package/dist/validation/config/index.d.mts +3 -4
  88. package/dist/validation/config/index.d.ts +3 -4
  89. package/dist/validation/config/index.js +2 -1
  90. package/dist/validation/config/index.mjs +2 -1
  91. package/dist/validation/core/index.d.mts +2 -17
  92. package/dist/validation/core/index.d.ts +2 -17
  93. package/dist/validation/core/index.js +2 -1
  94. package/dist/validation/core/index.mjs +2 -1
  95. package/dist/validation/object/index.d.mts +2 -29
  96. package/dist/validation/object/index.d.ts +2 -29
  97. package/dist/validation/object/index.js +2 -1
  98. package/dist/validation/object/index.mjs +2 -1
  99. package/dist/validation/primitives/checkbox.d.mts +2 -10
  100. package/dist/validation/primitives/checkbox.d.ts +2 -10
  101. package/dist/validation/primitives/checkbox.js +2 -1
  102. package/dist/validation/primitives/checkbox.mjs +2 -1
  103. package/dist/validation/primitives/date.d.mts +2 -23
  104. package/dist/validation/primitives/date.d.ts +2 -23
  105. package/dist/validation/primitives/date.js +2 -1
  106. package/dist/validation/primitives/date.mjs +2 -1
  107. package/dist/validation/primitives/number.d.mts +2 -10
  108. package/dist/validation/primitives/number.d.ts +2 -10
  109. package/dist/validation/primitives/number.js +2 -1
  110. package/dist/validation/primitives/number.mjs +2 -1
  111. package/dist/validation/primitives/text.d.mts +2 -10
  112. package/dist/validation/primitives/text.d.ts +2 -10
  113. package/dist/validation/primitives/text.js +2 -1
  114. package/dist/validation/primitives/text.mjs +2 -1
  115. package/dist/view-config.schema-B4AkqLKQ.mjs +2 -0
  116. package/dist/view-config.schema-to6p1m8L.js +2 -0
  117. package/package.json +7 -6
  118. package/dist/all-BgP-bB0i.d.mts +0 -1178
  119. package/dist/all-Cq8ZMfM4.d.ts +0 -1178
  120. package/dist/attributes-Cv6IP8-a.d.mts +0 -1365
  121. package/dist/attributes-Cv6IP8-a.d.ts +0 -1365
  122. package/dist/chunk-23KPS33D.js +0 -2
  123. package/dist/chunk-2M4YXNYZ.js +0 -15
  124. package/dist/chunk-47KVYDKG.js +0 -2
  125. package/dist/chunk-4OTKOCGB.mjs +0 -2
  126. package/dist/chunk-4VCADZK4.mjs +0 -2
  127. package/dist/chunk-53RAH3XB.mjs +0 -2
  128. package/dist/chunk-DPD6ZWL2.js +0 -2
  129. package/dist/chunk-EZCWO4XV.mjs +0 -15
  130. package/dist/chunk-GKXTXH4Y.mjs +0 -2
  131. package/dist/chunk-GXSNLYRR.js +0 -2
  132. package/dist/chunk-IBM4ID4Y.js +0 -6
  133. package/dist/chunk-JFSQ24XR.js +0 -2
  134. package/dist/chunk-JOS2XMXY.js +0 -2
  135. package/dist/chunk-JSKLP4GI.js +0 -12
  136. package/dist/chunk-JVLH3DVZ.js +0 -2
  137. package/dist/chunk-KG2ADZG6.mjs +0 -2
  138. package/dist/chunk-KLR22JMC.js +0 -2
  139. package/dist/chunk-KSPJP74K.mjs +0 -2
  140. package/dist/chunk-KYPEBOPW.mjs +0 -2
  141. package/dist/chunk-LB4TNMZU.mjs +0 -2
  142. package/dist/chunk-LSCBR4VS.js +0 -2
  143. package/dist/chunk-LWSOKXPF.js +0 -2
  144. package/dist/chunk-O34B5KOW.mjs +0 -2
  145. package/dist/chunk-PFO7NWQW.mjs +0 -2
  146. package/dist/chunk-Q7TQCRSD.mjs +0 -2
  147. package/dist/chunk-RTHLB6T6.js +0 -2
  148. package/dist/chunk-SLYRQ72J.js +0 -2
  149. package/dist/chunk-UKFOBZX2.js +0 -2
  150. package/dist/chunk-UXISKZ5Y.js +0 -2
  151. package/dist/chunk-VKFLXFPP.mjs +0 -2
  152. package/dist/chunk-WMQRTFOP.mjs +0 -2
  153. package/dist/chunk-XAVRKIBE.mjs +0 -6
  154. package/dist/chunk-XHEBV2HE.js +0 -2
  155. package/dist/chunk-XMQV2WFY.mjs +0 -2
  156. package/dist/chunk-XRDP2Y4J.mjs +0 -2
  157. package/dist/chunk-XRWRECDA.mjs +0 -12
  158. package/dist/chunk-XUAP7KWK.js +0 -2
  159. package/dist/chunk-XXTKNIBK.js +0 -2
  160. package/dist/chunk-YIXNAWH6.mjs +0 -2
  161. package/dist/chunk-YJSVWV3Z.mjs +0 -2
  162. package/dist/index-Comy7znP.d.ts +0 -252
  163. package/dist/index-D4XlMkLV.d.mts +0 -252
  164. package/dist/types-C5Bqalr9.d.ts +0 -38
  165. package/dist/types-CILLmEj-.d.mts +0 -38
@@ -0,0 +1,254 @@
1
+
2
+ import { Y as Attribute, Z as AttributeType } from "./exceptions-DGCzCc9t.mjs";
3
+ import { IconName } from "@stndrds/constants";
4
+ import { z as z$1 } from "zod";
5
+ //#region src/types/mutations.d.ts
6
+ interface AddAttributeInput {
7
+ name: string;
8
+ label: string;
9
+ type: AttributeType;
10
+ required?: boolean;
11
+ unique?: boolean;
12
+ description?: string;
13
+ placeholder?: string;
14
+ icon?: IconName;
15
+ defaultValue?: unknown;
16
+ metadata?: Record<string, unknown>;
17
+ [key: string]: unknown;
18
+ }
19
+ interface CreateCustomObjectInput {
20
+ name: string;
21
+ label: string;
22
+ pluralLabel?: string;
23
+ labelExpression: string;
24
+ embeddingExpression?: string;
25
+ description?: string;
26
+ icon?: IconName;
27
+ attributes?: (Attribute | {
28
+ build: () => Attribute;
29
+ })[];
30
+ metadata?: Record<string, unknown>;
31
+ }
32
+ interface UpdateObjectInput {
33
+ label?: string;
34
+ pluralLabel?: string;
35
+ description?: string;
36
+ icon?: IconName;
37
+ labelExpression?: string;
38
+ embeddingExpression?: string;
39
+ metadata?: Record<string, unknown>;
40
+ }
41
+ interface RelationOption {
42
+ id: string;
43
+ objectId: string;
44
+ objectName: string;
45
+ objectLabel: string;
46
+ objectIcon?: string;
47
+ label: string;
48
+ }
49
+ interface RelationOptionsResponse {
50
+ options: RelationOption[];
51
+ hasMore: boolean;
52
+ total: number;
53
+ nextOffset?: number;
54
+ }
55
+ //#endregion
56
+ //#region src/validation/config/schemas.d.ts
57
+ /**
58
+ * `baseConfigSchema`'s keys — the model never sets these directly, and the
59
+ * prompt (`attribute-reference.ts`'s `BASE_CONFIG_KEYS`) already hides them
60
+ * from every `<attribute_types>` line. `ADD_ATTRIBUTE_WIRE` omits them from
61
+ * each per-type wire config for the same reason, so the wire never offers a
62
+ * key the model was never told about — and never exposes `metadata`, the one
63
+ * genuine open record among them, on the wire. Single source: the runtime
64
+ * prompt imports this instead of keeping its own copy.
65
+ */
66
+ declare const WIRE_OMITTED_CONFIG_KEYS: readonly ["placeholder", "description", "defaultValue", "icon", "order", "hidden", "archived", "deprecated", "metadata"];
67
+ /**
68
+ * Builds the `superRefine` that refuses a key belonging to a DIFFERENT type
69
+ * than the one sent.
70
+ *
71
+ * Two wire shapes merge several types into one member for size — the nine
72
+ * simple attribute types of `ADD_ATTRIBUTE_WIRE`, and the seven simple
73
+ * qualified-property types below — so a merged member structurally accepts
74
+ * every merged type's keys. Without this, a `text`-only `format` sent on a
75
+ * `number` parses and is then silently `.strip()`-ped at store: a key lost
76
+ * with no feedback. Checked against the SENT type, and the message names the
77
+ * keys that type does accept so the next call is right. One factory rather
78
+ * than two near-identical loops — the second one drifted first.
79
+ */
80
+ declare function refuseForeignKeys<T extends string>(keysByType: Readonly<Record<T, ReadonlySet<string>>>, noun: string, alwaysAllowed?: readonly string[]): (type: T, subject: Record<string, unknown> | undefined, ctx: z$1.RefinementCtx, path?: readonly string[]) => void;
81
+ declare const statusGroupSchema: z$1.ZodEnum<{
82
+ idle: "idle";
83
+ in_progress: "in_progress";
84
+ finished: "finished";
85
+ }>;
86
+ declare const selectOptionWriteSchema: z$1.ZodObject<{
87
+ value: z$1.ZodString;
88
+ label: z$1.ZodString;
89
+ description: z$1.ZodOptional<z$1.ZodString>;
90
+ inverse: z$1.ZodOptional<z$1.ZodString>;
91
+ archived: z$1.ZodOptional<z$1.ZodBoolean>;
92
+ color: z$1.ZodEnum<{
93
+ gray: "gray";
94
+ slate: "slate";
95
+ blue: "blue";
96
+ sky: "sky";
97
+ indigo: "indigo";
98
+ green: "green";
99
+ emerald: "emerald";
100
+ teal: "teal";
101
+ red: "red";
102
+ rose: "rose";
103
+ yellow: "yellow";
104
+ amber: "amber";
105
+ orange: "orange";
106
+ purple: "purple";
107
+ violet: "violet";
108
+ fuchsia: "fuchsia";
109
+ pink: "pink";
110
+ cyan: "cyan";
111
+ lime: "lime";
112
+ }>;
113
+ }, z$1.core.$strict>;
114
+ declare const multiselectOptionWriteSchema: z$1.ZodObject<{
115
+ value: z$1.ZodString;
116
+ label: z$1.ZodString;
117
+ description: z$1.ZodOptional<z$1.ZodString>;
118
+ inverse: z$1.ZodOptional<z$1.ZodString>;
119
+ archived: z$1.ZodOptional<z$1.ZodBoolean>;
120
+ color: z$1.ZodEnum<{
121
+ gray: "gray";
122
+ slate: "slate";
123
+ blue: "blue";
124
+ sky: "sky";
125
+ indigo: "indigo";
126
+ green: "green";
127
+ emerald: "emerald";
128
+ teal: "teal";
129
+ red: "red";
130
+ rose: "rose";
131
+ yellow: "yellow";
132
+ amber: "amber";
133
+ orange: "orange";
134
+ purple: "purple";
135
+ violet: "violet";
136
+ fuchsia: "fuchsia";
137
+ pink: "pink";
138
+ cyan: "cyan";
139
+ lime: "lime";
140
+ }>;
141
+ }, z$1.core.$strict>;
142
+ declare const statusOptionWriteSchema: z$1.ZodObject<{
143
+ value: z$1.ZodString;
144
+ label: z$1.ZodString;
145
+ description: z$1.ZodOptional<z$1.ZodString>;
146
+ inverse: z$1.ZodOptional<z$1.ZodString>;
147
+ archived: z$1.ZodOptional<z$1.ZodBoolean>;
148
+ color: z$1.ZodEnum<{
149
+ gray: "gray";
150
+ slate: "slate";
151
+ blue: "blue";
152
+ sky: "sky";
153
+ indigo: "indigo";
154
+ green: "green";
155
+ emerald: "emerald";
156
+ teal: "teal";
157
+ red: "red";
158
+ rose: "rose";
159
+ yellow: "yellow";
160
+ amber: "amber";
161
+ orange: "orange";
162
+ purple: "purple";
163
+ violet: "violet";
164
+ fuchsia: "fuchsia";
165
+ pink: "pink";
166
+ cyan: "cyan";
167
+ lime: "lime";
168
+ }>;
169
+ group: z$1.ZodEnum<{
170
+ idle: "idle";
171
+ in_progress: "in_progress";
172
+ finished: "finished";
173
+ }>;
174
+ }, z$1.core.$strict>;
175
+ /**
176
+ * Property types whose config differs from `baseConfigSchema` only by
177
+ * independent optional scalars — no options array, no relation targets. Same
178
+ * shape as `SIMPLE_ATTRIBUTE_TYPES` in `architect/operations/schema.ts` minus
179
+ * `richtext`/`user` (not valid property types) — none of these seven types'
180
+ * keys collide, proven by `tests/validation/config/property-config.test.ts`.
181
+ * Merged into one wire member for the same reason `ADD_ATTRIBUTE_WIRE` merges
182
+ * its nine: the model reads one shape instead of seven near-identical ones,
183
+ * and this is also what keeps a qualified relation/document's `add_attribute`
184
+ * leaf under its wire-size cap (`tests/architect/wire-schema-size.test.ts`) —
185
+ * ten separate members, each paying its own JSON Schema object/`$defs`
186
+ * boilerplate, blew the budget even after the base config keys were omitted.
187
+ */
188
+ declare const SIMPLE_PROPERTY_TYPES: readonly ["text", "number", "checkbox", "date", "phone", "currency", "location"];
189
+ declare const propertyAttributeSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<Readonly<{
190
+ [k: string]: z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>;
191
+ }>, z$1.core.$strip>, ...z$1.ZodObject<Readonly<{
192
+ [k: string]: z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>;
193
+ }>, z$1.core.$strip>[]], "type">;
194
+ declare const propertySchemaSchema: z$1.ZodObject<{
195
+ definitions: z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<Readonly<{
196
+ [k: string]: z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>;
197
+ }>, z$1.core.$strip>, ...z$1.ZodObject<Readonly<{
198
+ [k: string]: z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>;
199
+ }>, z$1.core.$strip>[]], "type">>;
200
+ }, z$1.core.$strip>;
201
+ /**
202
+ * The wire-facing property union, derived from the stored one: the same seven
203
+ * simple types merged into one member, the option-carrying types alongside,
204
+ * everything the model never sets omitted, and `.strict()` so an invented key
205
+ * is refused by name instead of silently stripped at store.
206
+ */
207
+ declare const propertyAttributeWireSchema: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<Readonly<{
208
+ [k: string]: z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>;
209
+ }>, z$1.core.$strip>, ...z$1.ZodObject<Readonly<{
210
+ [k: string]: z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>;
211
+ }>, z$1.core.$strip>[]], "type">;
212
+ declare const propertySchemaWireSchema: z$1.ZodObject<{
213
+ definitions: z$1.ZodArray<z$1.ZodDiscriminatedUnion<[z$1.ZodObject<Readonly<{
214
+ [k: string]: z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>;
215
+ }>, z$1.core.$strip>, ...z$1.ZodObject<Readonly<{
216
+ [k: string]: z$1.core.$ZodType<unknown, unknown, z$1.core.$ZodTypeInternals<unknown, unknown>>;
217
+ }>, z$1.core.$strip>[]], "type">>;
218
+ }, z$1.core.$strict>;
219
+ /**
220
+ * Map of attribute type to config schema
221
+ */
222
+ declare const attributeConfigSchemas: Record<AttributeType, z$1.ZodObject<z$1.ZodRawShape>>;
223
+ /**
224
+ * Get the config schema for a specific attribute type
225
+ */
226
+ declare function getAttributeConfigSchema(type: AttributeType): z$1.ZodObject<z$1.ZodRawShape>;
227
+ /**
228
+ * Validate and strip unknown properties from attribute config
229
+ * This ensures only allowed properties are stored in the database
230
+ */
231
+ declare function parseAttributeConfig(type: AttributeType, config: Record<string, unknown>): Record<string, unknown>;
232
+ /**
233
+ * The config contract as a WRITE applies it: the stored schema plus the
234
+ * stricter option and icon rules newly written values must satisfy.
235
+ */
236
+ declare function getAttributeConfigWriteSchema(type: AttributeType): z$1.ZodObject<z$1.ZodRawShape>;
237
+ /**
238
+ * Strict parser for newly created attribute definitions.
239
+ *
240
+ * Top-level config remains strip-compatible with the historical config
241
+ * contract, while newly written icons and select-like option objects are
242
+ * validated strictly.
243
+ */
244
+ declare function parseAttributeConfigForCreate(type: AttributeType, input: unknown): Record<string, unknown>;
245
+ /**
246
+ * Patch-aware parser for persisted attributes.
247
+ *
248
+ * An explicit options patch owns and strictly validates the complete new
249
+ * list. Omission means the stored legacy list is preserved without
250
+ * reconstruction, including options that predate required colours/groups.
251
+ */
252
+ declare function parseAttributeConfigForUpdate(stored: Attribute, patch: Partial<AddAttributeInput>): Record<string, unknown>;
253
+ //#endregion
254
+ export { UpdateObjectInput as S, statusOptionWriteSchema as _, getAttributeConfigWriteSchema as a, RelationOption as b, parseAttributeConfigForCreate as c, propertyAttributeWireSchema as d, propertySchemaSchema as f, statusGroupSchema as g, selectOptionWriteSchema as h, getAttributeConfigSchema as i, parseAttributeConfigForUpdate as l, refuseForeignKeys as m, WIRE_OMITTED_CONFIG_KEYS as n, multiselectOptionWriteSchema as o, propertySchemaWireSchema as p, attributeConfigSchemas as r, parseAttributeConfig as s, SIMPLE_PROPERTY_TYPES as t, propertyAttributeSchema as u, AddAttributeInput as v, RelationOptionsResponse as x, CreateCustomObjectInput as y };
@@ -1,36 +1,38 @@
1
- import { z } from 'zod';
2
- import { g as Uuid, A as Attribute, h as MigrationDefinition } from './attributes-Cv6IP8-a.mjs';
3
- import { V as ValidationMessages, a as ValidationResult } from './types-CILLmEj-.mjs';
4
- import { IconName } from '@stndrds/constants';
5
1
 
2
+ import { Jt as Uuid, K as MigrationDefinition, Y as Attribute } from "./exceptions-DGCzCc9t.js";
3
+ import { i as ValidationResult, r as ValidationMessages } from "./index-B7HmBsUS.js";
4
+ import { z as z$1 } from "zod";
5
+ import { IconName } from "@stndrds/constants";
6
+ //#region src/types/document-layout.d.ts
6
7
  interface DocumentLayout {
7
- /** Named sub-folders auto-created at the top of the record's drive when first used via attach --variant. */
8
- variants?: Record<string, DocumentLayoutVariant>;
9
- /** Dev-declared folder structures the user can instantiate via the UI inside a record's drive. */
10
- presets?: FolderPreset[];
8
+ /** Named sub-folders auto-created at the top of the record's drive when first used via attach --variant. */
9
+ variants?: Record<string, DocumentLayoutVariant>;
10
+ /** Dev-declared folder structures the user can instantiate via the UI inside a record's drive. */
11
+ presets?: FolderPreset[];
11
12
  }
12
13
  interface DocumentLayoutVariant {
13
- /** Display title for the auto-created sub-folder. */
14
- title: string;
15
- description?: string;
14
+ /** Display title for the auto-created sub-folder. */
15
+ title: string;
16
+ description?: string;
16
17
  }
17
18
  interface FolderPreset {
18
- id: string;
19
- label: string;
20
- icon?: IconName;
21
- description?: string;
22
- structure: PresetNode[];
23
- /** When true, this preset is auto-instantiated on every new record's drive for the owning object. */
24
- autoInstantiate?: boolean;
19
+ id: string;
20
+ label: string;
21
+ icon?: IconName;
22
+ description?: string;
23
+ structure: PresetNode[];
24
+ /** When true, this preset is auto-instantiated on every new record's drive for the owning object. */
25
+ autoInstantiate?: boolean;
25
26
  }
26
27
  interface PresetNode {
27
- title: string;
28
- description?: string;
29
- children?: PresetNode[];
28
+ title: string;
29
+ description?: string;
30
+ children?: PresetNode[];
30
31
  }
31
32
  /** Max depth allowed for preset.structure to keep instantiation predictable. */
32
33
  declare const MAX_PRESET_DEPTH = 5;
33
-
34
+ //#endregion
35
+ //#region src/types/objects.d.ts
34
36
  /** Visibility scopes shared by resources that can be workspace-wide or actor-private. */
35
37
  declare const RESOURCE_VISIBILITIES: readonly ["workspace", "private"];
36
38
  type ResourceVisibility = (typeof RESOURCE_VISIBILITIES)[number];
@@ -66,138 +68,138 @@ declare function parseResourceVisibility(value: unknown): ResourceVisibility;
66
68
  * Timestamps for tracking creation and updates
67
69
  */
68
70
  interface Timestamps {
69
- createdAt: Date;
70
- updatedAt: Date;
71
+ createdAt: Date;
72
+ updatedAt: Date;
71
73
  }
72
74
  /**
73
75
  * Object definition - Represents a database table/entity
74
76
  */
75
77
  interface ObjectDefinition {
76
- id?: Uuid;
77
- name: string;
78
- label: string;
79
- pluralLabel?: string;
80
- description?: string;
81
- icon?: IconName;
82
- /**
83
- * Template expression used to compute the object's display label.
84
- * Supports variable interpolation and pipes for formatting.
85
- *
86
- * @example
87
- * ```typescript
88
- * // Simple attribute reference
89
- * labelExpression: "{{ name }}"
90
- *
91
- * // Multiple attributes
92
- * labelExpression: "{{ firstName }} {{ lastName }}"
93
- *
94
- * // With pipes for formatting
95
- * labelExpression: "{{ code | UPPER }} - {{ name | capitalize }}"
96
- * ```
97
- *
98
- * Available pipes: UPPER, LOWER, capitalize, trim
99
- */
100
- labelExpression: string;
101
- /**
102
- * Optional template expression used to compute the semantic text sent to
103
- * Meilisearch for vector generation. When absent, records opt out of semantic
104
- * embedding generation.
105
- */
106
- embeddingExpression?: string;
107
- attributes: Attribute[];
108
- system?: boolean;
109
- /**
110
- * If true, no custom (user-created) attributes are allowed on this object.
111
- * `standards diff` will report an error if any custom attribute is found.
112
- * Use .sealed() on the ObjectBuilder to set this.
113
- */
114
- sealed?: boolean;
115
- /**
116
- * List of custom attribute names explicitly acknowledged by the developer.
117
- * On a sealed object, these names will NOT trigger a CI failure.
118
- * On an extensible object, this is purely documentary.
119
- * Use .tolerate(["name"]) on the ObjectBuilder to set this.
120
- */
121
- toleratedAttributes?: string[];
122
- metadata?: Record<string, unknown>;
123
- /** Current schema version (incremented with each migration) */
124
- schema_version: number;
125
- /** Ordered list of migrations applied to this object's schema */
126
- migrations: MigrationDefinition[];
127
- /** Smart-folder layout convention for documents attached to records of this object. */
128
- documentLayout?: DocumentLayout;
78
+ id?: Uuid;
79
+ name: string;
80
+ label: string;
81
+ pluralLabel?: string;
82
+ description?: string;
83
+ icon?: IconName;
84
+ /**
85
+ * Template expression used to compute the object's display label.
86
+ * Supports variable interpolation and pipes for formatting.
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * // Simple attribute reference
91
+ * labelExpression: "{{ name }}"
92
+ *
93
+ * // Multiple attributes
94
+ * labelExpression: "{{ firstName }} {{ lastName }}"
95
+ *
96
+ * // With pipes for formatting
97
+ * labelExpression: "{{ code | UPPER }} - {{ name | capitalize }}"
98
+ * ```
99
+ *
100
+ * Available pipes: UPPER, LOWER, capitalize, trim
101
+ */
102
+ labelExpression: string;
103
+ /**
104
+ * Optional template expression used to compute the semantic text sent to
105
+ * Meilisearch for vector generation. When absent, records opt out of semantic
106
+ * embedding generation.
107
+ */
108
+ embeddingExpression?: string;
109
+ attributes: Attribute[];
110
+ system?: boolean;
111
+ /**
112
+ * If true, no custom (user-created) attributes are allowed on this object.
113
+ * `standards diff` will report an error if any custom attribute is found.
114
+ * Use .sealed() on the ObjectBuilder to set this.
115
+ */
116
+ sealed?: boolean;
117
+ /**
118
+ * List of custom attribute names explicitly acknowledged by the developer.
119
+ * On a sealed object, these names will NOT trigger a CI failure.
120
+ * On an extensible object, this is purely documentary.
121
+ * Use .tolerate(["name"]) on the ObjectBuilder to set this.
122
+ */
123
+ toleratedAttributes?: string[];
124
+ metadata?: Record<string, unknown>;
125
+ /** Current schema version (incremented with each migration) */
126
+ schema_version: number;
127
+ /** Ordered list of migrations applied to this object's schema */
128
+ migrations: MigrationDefinition[];
129
+ /** Smart-folder layout convention for documents attached to records of this object. */
130
+ documentLayout?: DocumentLayout;
129
131
  }
130
132
  /**
131
133
  * Links an attribute to an object
132
134
  */
133
135
  interface ObjectAttribute {
134
- objectId: Uuid;
135
- attributeId: Uuid;
136
- order?: number;
137
- required?: boolean;
136
+ objectId: Uuid;
137
+ attributeId: Uuid;
138
+ order?: number;
139
+ required?: boolean;
138
140
  }
139
141
  /**
140
142
  * Record - Instance of an Object (a row in the database)
141
143
  */
142
144
  interface ObjectRecord<TValues extends Record<string, unknown> = Record<string, unknown>> extends Timestamps {
143
- id: Uuid;
144
- objectId: Uuid;
145
- /**
146
- * Name of the owning object. Present on every row read through the repository
147
- * (`object_records.object_name` is denormalized and always selected), absent
148
- * on records built in memory before a write.
149
- */
150
- objectName?: string;
151
- /** Workspace-wide or owner-private visibility enforced by repository queries. */
152
- visibility: ResourceVisibility;
153
- /** Owning actor for private records; always null for workspace records. */
154
- ownedBy: Uuid | null;
155
- /**
156
- * Display label computed from the object's labelExpression.
157
- * Computed dynamically based on record values.
158
- *
159
- * @example "John Doe" (from "{{ firstName }} {{ lastName }}")
160
- */
161
- label: string;
162
- /**
163
- * Semantic text computed from the object's embeddingExpression and persisted
164
- * for Meilisearch documentTemplate-based vector generation.
165
- */
166
- embeddingText?: string;
167
- values: TValues;
168
- /**
169
- * Custom metadata for the record.
170
- * Use this for UI/UX state, feature flags, or any application-specific data.
171
- * Unlike system fields (id, createdAt, updatedAt), metadata can be updated.
172
- */
173
- metadata?: Record<string, unknown>;
174
- /**
175
- * Soft delete timestamp.
176
- * If set, the record is considered deleted but can be restored.
177
- * Queries exclude soft-deleted records by default.
178
- */
179
- deletedAt?: Date | null;
180
- /**
181
- * Actor ID who soft-deleted this record.
182
- * Set alongside deletedAt when a record is soft-deleted.
183
- */
184
- deletedBy?: string | null;
185
- /**
186
- * Actor ID who created this record.
187
- * Automatically set by RecordService when actorId is configured.
188
- * Optional for backward compatibility with existing records.
189
- */
190
- createdBy?: string;
191
- /**
192
- * Actor ID who last updated this record.
193
- * Automatically set by RecordService when actorId is configured.
194
- * Optional for backward compatibility with existing records.
195
- */
196
- lastUpdatedBy?: string;
197
- /** Storage-managed exact optimistic-lock token for atomic record writes. */
198
- writeVersion?: number;
199
- /** Schema version at the time this record was last migrated */
200
- schemaVersion: number;
145
+ id: Uuid;
146
+ objectId: Uuid;
147
+ /**
148
+ * Name of the owning object. Present on every row read through the repository
149
+ * (`object_records.object_name` is denormalized and always selected), absent
150
+ * on records built in memory before a write.
151
+ */
152
+ objectName?: string;
153
+ /** Workspace-wide or owner-private visibility enforced by repository queries. */
154
+ visibility: ResourceVisibility;
155
+ /** Owning actor for private records; always null for workspace records. */
156
+ ownedBy: Uuid | null;
157
+ /**
158
+ * Display label computed from the object's labelExpression.
159
+ * Computed dynamically based on record values.
160
+ *
161
+ * @example "John Doe" (from "{{ firstName }} {{ lastName }}")
162
+ */
163
+ label: string;
164
+ /**
165
+ * Semantic text computed from the object's embeddingExpression and persisted
166
+ * for Meilisearch documentTemplate-based vector generation.
167
+ */
168
+ embeddingText?: string;
169
+ values: TValues;
170
+ /**
171
+ * Custom metadata for the record.
172
+ * Use this for UI/UX state, feature flags, or any application-specific data.
173
+ * Unlike system fields (id, createdAt, updatedAt), metadata can be updated.
174
+ */
175
+ metadata?: Record<string, unknown>;
176
+ /**
177
+ * Soft delete timestamp.
178
+ * If set, the record is considered deleted but can be restored.
179
+ * Queries exclude soft-deleted records by default.
180
+ */
181
+ deletedAt?: Date | null;
182
+ /**
183
+ * Actor ID who soft-deleted this record.
184
+ * Set alongside deletedAt when a record is soft-deleted.
185
+ */
186
+ deletedBy?: string | null;
187
+ /**
188
+ * Actor ID who created this record.
189
+ * Automatically set by RecordService when actorId is configured.
190
+ * Optional for backward compatibility with existing records.
191
+ */
192
+ createdBy?: string;
193
+ /**
194
+ * Actor ID who last updated this record.
195
+ * Automatically set by RecordService when actorId is configured.
196
+ * Optional for backward compatibility with existing records.
197
+ */
198
+ lastUpdatedBy?: string;
199
+ /** Storage-managed exact optimistic-lock token for atomic record writes. */
200
+ writeVersion?: number;
201
+ /** Schema version at the time this record was last migrated */
202
+ schemaVersion: number;
201
203
  }
202
204
  /**
203
205
  * System-managed field names on ObjectRecord.
@@ -247,7 +249,8 @@ type ReservedAttributeName = (typeof RESERVED_ATTRIBUTE_NAMES)[number];
247
249
  */
248
250
  declare const RESERVED_OBJECT_NAMES: readonly ["skill", "memory", "drives", "artifact", "meeting"];
249
251
  type ReservedObjectName = (typeof RESERVED_OBJECT_NAMES)[number];
250
-
252
+ //#endregion
253
+ //#region src/validation/object/attribute-factory.d.ts
251
254
  /**
252
255
  * Create a Zod schema for any attribute type.
253
256
  * Returns a strict validator that does NOT handle optional fields.
@@ -256,7 +259,7 @@ type ReservedObjectName = (typeof RESERVED_OBJECT_NAMES)[number];
256
259
  * @param attr - The attribute to create a validator for
257
260
  * @param messages - Custom validation messages for i18n support
258
261
  */
259
- declare function createAttributeValidator(attr: Attribute, messages?: ValidationMessages): z.ZodTypeAny;
262
+ declare function createAttributeValidator(attr: Attribute, messages?: ValidationMessages): z$1.ZodTypeAny;
260
263
  /**
261
264
  * Create a Zod schema for form validation.
262
265
  * - Normalizes empty values (empty strings, empty objects) to null for optional fields
@@ -267,8 +270,32 @@ declare function createAttributeValidator(attr: Attribute, messages?: Validation
267
270
  * @param attr - The attribute to create a validator for
268
271
  * @param messages - Custom validation messages for i18n support
269
272
  */
270
- declare function createFormAttributeValidator(attr: Attribute, messages?: ValidationMessages): z.ZodTypeAny;
271
-
273
+ declare function createFormAttributeValidator(attr: Attribute, messages?: ValidationMessages): z$1.ZodTypeAny;
274
+ //#endregion
275
+ //#region src/validation/object/object-validator.d.ts
276
+ /**
277
+ * Create a Zod schema for an entire object
278
+ *
279
+ * Uses passthrough mode to allow computed fields (formula, rollup) that may be
280
+ * present in record data but are not part of the mutable schema.
281
+ *
282
+ * Result is cached per ObjectDefinition instance — safe because ObjectDefinitions
283
+ * are stable after module load and never mutated at runtime.
284
+ */
285
+ declare function createObjectValidator(objectDef: ObjectDefinition): z$1.ZodType<Record<string, unknown>>;
286
+ /**
287
+ * Create a Zod schema for draft validation.
288
+ * All attributes become optional, but provided values are still validated.
289
+ *
290
+ * Uses passthrough mode to allow computed fields (formula, rollup) that may be
291
+ * present in record data but are not part of the mutable schema.
292
+ *
293
+ * Result is cached per ObjectDefinition instance — safe because ObjectDefinitions
294
+ * are stable after module load and never mutated at runtime.
295
+ */
296
+ declare function createDraftValidator(objectDef: ObjectDefinition): z$1.ZodType<Record<string, unknown>>;
297
+ //#endregion
298
+ //#region src/validation/object/helpers.d.ts
272
299
  /**
273
300
  * Validate data against an attribute schema
274
301
  */
@@ -317,5 +344,5 @@ declare function getMissingRequiredAttributes(objectDef: ObjectDefinition, data:
317
344
  * Check if a record is complete (all required attributes have valid values).
318
345
  */
319
346
  declare function isRecordComplete(objectDef: ObjectDefinition, data: Record<string, unknown>): boolean;
320
-
321
- export { type DocumentLayout as D, type FolderPreset as F, type ListViewTabVisibility as L, MAX_PRESET_DEPTH as M, type ObjectDefinition as O, type PresetNode as P, type ResourceVisibility as R, SYSTEM_FIELD_NAMES as S, type Timestamps as T, createFormAttributeValidator as a, validateDraft as b, createAttributeValidator as c, validateDraftOrThrow as d, validateObject as e, validateObjectOrThrow as f, getMissingRequiredAttributes as g, type ObjectRecord as h, isRecordComplete as i, type DocumentLayoutVariant as j, LIST_VIEW_TAB_VISIBILITIES as k, type ObjectAttribute as l, RESERVED_ATTRIBUTE_NAMES as m, RESERVED_OBJECT_NAMES as n, RESOURCE_VISIBILITIES as o, type ReservedAttributeName as p, type ReservedObjectName as q, rejectUnknownAttributesOrThrow as r, type SystemFieldName as s, parseResourceVisibility as t, validateAttribute as v };
347
+ //#endregion
348
+ export { FolderPreset as A, ResourceVisibility as C, parseResourceVisibility as D, Timestamps as E, PresetNode as M, DocumentLayout as O, ReservedObjectName as S, SystemFieldName as T, ObjectRecord as _, validateDraft as a, RESOURCE_VISIBILITIES as b, validateObjectOrThrow as c, createAttributeValidator as d, createFormAttributeValidator as f, ObjectDefinition as g, ObjectAttribute as h, validateAttribute as i, MAX_PRESET_DEPTH as j, DocumentLayoutVariant as k, createDraftValidator as l, ListViewTabVisibility as m, isRecordComplete as n, validateDraftOrThrow as o, LIST_VIEW_TAB_VISIBILITIES as p, rejectUnknownAttributesOrThrow as r, validateObject as s, getMissingRequiredAttributes as t, createObjectValidator as u, RESERVED_ATTRIBUTE_NAMES as v, SYSTEM_FIELD_NAMES as w, ReservedAttributeName as x, RESERVED_OBJECT_NAMES as y };