@stndrds/schema 1.0.0-alpha.328 → 1.0.0-alpha.330
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-CWDgBPuS.d.ts +1186 -0
- package/dist/all-DilIWUev.d.mts +1186 -0
- package/dist/capabilities.d.mts +94 -94
- package/dist/capabilities.d.ts +94 -94
- package/dist/capabilities.js +2 -2
- package/dist/capabilities.mjs +2 -2
- package/dist/checkbox-CjnTd8DE.d.ts +11 -0
- package/dist/checkbox-preO352q.d.mts +11 -0
- package/dist/config-BQJJHopR.js +13 -0
- package/dist/config-_sOeudpS.mjs +13 -0
- package/dist/core-397tQy5q.js +2 -0
- package/dist/core-BLHhNykL.mjs +2 -0
- package/dist/date-BL3UHIXs.d.mts +24 -0
- package/dist/date-CxwHkbid.d.ts +24 -0
- package/dist/exceptions-DGCzCc9t.d.mts +1405 -0
- package/dist/exceptions-DGCzCc9t.d.ts +1405 -0
- package/dist/exceptions.d.mts +3 -2
- package/dist/exceptions.d.ts +3 -2
- package/dist/exceptions.js +3 -1
- package/dist/exceptions.mjs +3 -1
- package/dist/index-B7HmBsUS.d.ts +53 -0
- package/dist/{helpers-JGJLPkwG.d.ts → index-BoUwfrDH.d.mts} +172 -145
- package/dist/index-C8M7Amy9.d.mts +254 -0
- package/dist/{helpers-Cic6nWBr.d.mts → index-DqwNrDSp.d.ts} +172 -145
- package/dist/index-Uwy7CTKo.d.ts +254 -0
- package/dist/index-XtmC-C7J.d.mts +53 -0
- package/dist/index.d.mts +9203 -9111
- package/dist/index.d.ts +9203 -9111
- package/dist/index.js +21 -27
- package/dist/index.mjs +21 -27
- package/dist/number-Ddi_YYfm.d.mts +11 -0
- package/dist/number-GmD5PM5s.d.ts +11 -0
- package/dist/object-BQuWeYKA.js +4 -0
- package/dist/object-tz3P8Pgh.mjs +4 -0
- package/dist/phone-C0QEfySq.js +2 -0
- package/dist/phone-DHUJN7SI.mjs +2 -0
- package/dist/text-A9AJ1wUO.js +2 -0
- package/dist/text-C8Lb-NFo.mjs +2 -0
- package/dist/text-CxwF5K4k.d.mts +11 -0
- package/dist/text-D6UypN8p.d.ts +11 -0
- package/dist/utils-fXIvFFl6.mjs +2 -0
- package/dist/utils-gY3d9Dwp.js +2 -0
- package/dist/utils.d.mts +3 -2
- package/dist/utils.d.ts +3 -2
- package/dist/utils.js +2 -1
- package/dist/utils.mjs +2 -1
- package/dist/validation/all.d.mts +6 -8
- package/dist/validation/all.d.ts +6 -8
- package/dist/validation/all.js +2 -1
- package/dist/validation/all.mjs +2 -1
- package/dist/validation/complex/currency.d.mts +8 -9
- package/dist/validation/complex/currency.d.ts +8 -9
- package/dist/validation/complex/currency.js +2 -1
- package/dist/validation/complex/currency.mjs +2 -1
- package/dist/validation/complex/location.d.mts +14 -15
- package/dist/validation/complex/location.d.ts +14 -15
- package/dist/validation/complex/location.js +2 -1
- package/dist/validation/complex/location.mjs +2 -1
- package/dist/validation/complex/phone.d.mts +8 -9
- package/dist/validation/complex/phone.d.ts +8 -9
- package/dist/validation/complex/phone.js +2 -1
- package/dist/validation/complex/phone.mjs +2 -1
- package/dist/validation/complex/relation.d.mts +8 -9
- package/dist/validation/complex/relation.d.ts +8 -9
- package/dist/validation/complex/relation.js +2 -1
- package/dist/validation/complex/relation.mjs +2 -1
- package/dist/validation/complex/richtext.d.mts +6 -7
- package/dist/validation/complex/richtext.d.ts +6 -7
- package/dist/validation/complex/richtext.js +2 -1
- package/dist/validation/complex/richtext.mjs +2 -1
- package/dist/validation/complex/select.d.mts +8 -9
- package/dist/validation/complex/select.d.ts +8 -9
- package/dist/validation/complex/select.js +2 -1
- package/dist/validation/complex/select.mjs +2 -1
- package/dist/validation/complex/user.d.mts +6 -7
- package/dist/validation/complex/user.d.ts +6 -7
- package/dist/validation/complex/user.js +2 -1
- package/dist/validation/complex/user.mjs +2 -1
- package/dist/validation/computed/formula.d.mts +6 -7
- package/dist/validation/computed/formula.d.ts +6 -7
- package/dist/validation/computed/formula.js +2 -1
- package/dist/validation/computed/formula.mjs +2 -1
- package/dist/validation/computed/rollup.d.mts +6 -7
- package/dist/validation/computed/rollup.d.ts +6 -7
- package/dist/validation/computed/rollup.js +2 -1
- package/dist/validation/computed/rollup.mjs +2 -1
- package/dist/validation/config/index.d.mts +3 -4
- package/dist/validation/config/index.d.ts +3 -4
- package/dist/validation/config/index.js +2 -1
- package/dist/validation/config/index.mjs +2 -1
- package/dist/validation/core/index.d.mts +2 -17
- package/dist/validation/core/index.d.ts +2 -17
- package/dist/validation/core/index.js +2 -1
- package/dist/validation/core/index.mjs +2 -1
- package/dist/validation/object/index.d.mts +2 -29
- package/dist/validation/object/index.d.ts +2 -29
- package/dist/validation/object/index.js +2 -1
- package/dist/validation/object/index.mjs +2 -1
- package/dist/validation/primitives/checkbox.d.mts +2 -10
- package/dist/validation/primitives/checkbox.d.ts +2 -10
- package/dist/validation/primitives/checkbox.js +2 -1
- package/dist/validation/primitives/checkbox.mjs +2 -1
- package/dist/validation/primitives/date.d.mts +2 -23
- package/dist/validation/primitives/date.d.ts +2 -23
- package/dist/validation/primitives/date.js +2 -1
- package/dist/validation/primitives/date.mjs +2 -1
- package/dist/validation/primitives/number.d.mts +2 -10
- package/dist/validation/primitives/number.d.ts +2 -10
- package/dist/validation/primitives/number.js +2 -1
- package/dist/validation/primitives/number.mjs +2 -1
- package/dist/validation/primitives/text.d.mts +2 -10
- package/dist/validation/primitives/text.d.ts +2 -10
- package/dist/validation/primitives/text.js +2 -1
- package/dist/validation/primitives/text.mjs +2 -1
- package/dist/view-config.schema-B4AkqLKQ.mjs +2 -0
- package/dist/view-config.schema-to6p1m8L.js +2 -0
- package/package.json +11 -9
- package/dist/all-DPW8A7kG.d.ts +0 -1178
- package/dist/all-yrWOkrj0.d.mts +0 -1178
- package/dist/attributes-B9zZJdoT.d.mts +0 -1365
- package/dist/attributes-B9zZJdoT.d.ts +0 -1365
- package/dist/chunk-23KPS33D.js +0 -2
- package/dist/chunk-2FJ45VYQ.js +0 -2
- package/dist/chunk-2M4YXNYZ.js +0 -15
- package/dist/chunk-47KVYDKG.js +0 -2
- package/dist/chunk-4OTKOCGB.mjs +0 -2
- package/dist/chunk-4VCADZK4.mjs +0 -2
- package/dist/chunk-DPD6ZWL2.js +0 -2
- package/dist/chunk-EZCWO4XV.mjs +0 -15
- package/dist/chunk-GKXTXH4Y.mjs +0 -2
- package/dist/chunk-GXSNLYRR.js +0 -2
- package/dist/chunk-IBM4ID4Y.js +0 -6
- package/dist/chunk-JFSQ24XR.js +0 -2
- package/dist/chunk-JOS2XMXY.js +0 -2
- package/dist/chunk-JSKLP4GI.js +0 -12
- package/dist/chunk-JVLH3DVZ.js +0 -2
- package/dist/chunk-KG2ADZG6.mjs +0 -2
- package/dist/chunk-KLR22JMC.js +0 -2
- package/dist/chunk-KSPJP74K.mjs +0 -2
- package/dist/chunk-KYPEBOPW.mjs +0 -2
- package/dist/chunk-LB4TNMZU.mjs +0 -2
- package/dist/chunk-LSCBR4VS.js +0 -2
- package/dist/chunk-LWSOKXPF.js +0 -2
- package/dist/chunk-O34B5KOW.mjs +0 -2
- package/dist/chunk-PFO7NWQW.mjs +0 -2
- package/dist/chunk-Q7TQCRSD.mjs +0 -2
- package/dist/chunk-RTHLB6T6.js +0 -2
- package/dist/chunk-SLYRQ72J.js +0 -2
- package/dist/chunk-UXISKZ5Y.js +0 -2
- package/dist/chunk-VKFLXFPP.mjs +0 -2
- package/dist/chunk-WMQRTFOP.mjs +0 -2
- package/dist/chunk-WUFUIJRX.mjs +0 -2
- package/dist/chunk-XAVRKIBE.mjs +0 -6
- package/dist/chunk-XHEBV2HE.js +0 -2
- package/dist/chunk-XMQV2WFY.mjs +0 -2
- package/dist/chunk-XRDP2Y4J.mjs +0 -2
- package/dist/chunk-XRWRECDA.mjs +0 -12
- package/dist/chunk-XUAP7KWK.js +0 -2
- package/dist/chunk-XXTKNIBK.js +0 -2
- package/dist/chunk-YIXNAWH6.mjs +0 -2
- package/dist/chunk-YJSVWV3Z.mjs +0 -2
- package/dist/index-BbYKy1fQ.d.mts +0 -252
- package/dist/index-BjKaOUx3.d.ts +0 -252
- package/dist/types-BpuX5PuM.d.mts +0 -38
- package/dist/types-DLwv9Jgf.d.ts +0 -38
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
|
|
2
|
+
import { Y as Attribute, Z as AttributeType } from "./exceptions-DGCzCc9t.js";
|
|
3
|
+
import { z as z$1 } from "zod";
|
|
4
|
+
import { IconName } from "@stndrds/constants";
|
|
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 };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
import { Y as Attribute } from "./exceptions-DGCzCc9t.mjs";
|
|
3
|
+
import { z as z$1 } from "zod";
|
|
4
|
+
//#region src/validation/core/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Validation messages for Zod validators.
|
|
7
|
+
* All functions receive the full Attribute to access label, type, etc.
|
|
8
|
+
* Can be customized for i18n support.
|
|
9
|
+
*/
|
|
10
|
+
interface ValidationMessages {
|
|
11
|
+
required: (attr: Attribute) => string;
|
|
12
|
+
invalidType: (attr: Attribute, expected: string) => string;
|
|
13
|
+
minLength: (attr: Attribute, min: number) => string;
|
|
14
|
+
maxLength: (attr: Attribute, max: number) => string;
|
|
15
|
+
invalidPattern: (attr: Attribute) => string;
|
|
16
|
+
minValue: (attr: Attribute, min: number) => string;
|
|
17
|
+
maxValue: (attr: Attribute, max: number) => string;
|
|
18
|
+
mustBeInteger: (attr: Attribute) => string;
|
|
19
|
+
invalidDate: (attr: Attribute) => string;
|
|
20
|
+
invalidOption: (attr: Attribute, options: string[]) => string;
|
|
21
|
+
invalidId: (attr: Attribute) => string;
|
|
22
|
+
maxItems: (attr: Attribute, max: number) => string;
|
|
23
|
+
invalidRichtext: (attr: Attribute) => string;
|
|
24
|
+
invalidPhone: (attr: Attribute) => string;
|
|
25
|
+
invalidCurrency: (attr: Attribute) => string;
|
|
26
|
+
invalidLocation: (attr: Attribute) => string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Validation result
|
|
30
|
+
*/
|
|
31
|
+
interface ValidationResult {
|
|
32
|
+
success: boolean;
|
|
33
|
+
data?: Record<string, unknown>;
|
|
34
|
+
errors?: Array<{
|
|
35
|
+
path: string[];
|
|
36
|
+
message: string;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/validation/core/messages.d.ts
|
|
41
|
+
declare const DEFAULT_VALIDATION_MESSAGES: ValidationMessages;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/validation/core/errors.d.ts
|
|
44
|
+
/**
|
|
45
|
+
* Format Zod validation errors into a consistent structure.
|
|
46
|
+
* This eliminates code duplication across multiple validation functions.
|
|
47
|
+
*/
|
|
48
|
+
declare function formatZodErrors(error: z$1.ZodError): Array<{
|
|
49
|
+
path: string[];
|
|
50
|
+
message: string;
|
|
51
|
+
}>;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { ValidationResult as i, DEFAULT_VALIDATION_MESSAGES as n, ValidationMessages as r, formatZodErrors as t };
|