@stndrds/schema 1.0.0-alpha.315 → 1.0.0-alpha.317

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 (67) hide show
  1. package/dist/{all-BGyE2RCe.d.ts → all-BsINIhT4.d.ts} +993 -618
  2. package/dist/{all--LbSrtzk.d.mts → all-Js3OaRJY.d.mts} +993 -618
  3. package/dist/{attributes-cBtnsK8O.d.mts → attributes-2ELU4S-n.d.mts} +2 -2
  4. package/dist/{attributes-cBtnsK8O.d.ts → attributes-2ELU4S-n.d.ts} +2 -2
  5. package/dist/chunk-3VONXKAN.js +2 -0
  6. package/dist/{chunk-D6LPMF5N.mjs → chunk-B2W4ZEO2.mjs} +1 -1
  7. package/dist/{chunk-WKDJGNVI.js → chunk-HS7IRPL2.js} +1 -1
  8. package/dist/chunk-MMOW6WTJ.mjs +2 -0
  9. package/dist/exceptions.d.mts +1 -1
  10. package/dist/exceptions.d.ts +1 -1
  11. package/dist/{objects-iPrveCDN.d.ts → helpers-CAOdIXNe.d.ts} +74 -2
  12. package/dist/{objects-kXaFEi-P.d.mts → helpers-CJpLZ8jG.d.mts} +74 -2
  13. package/dist/index-C6-AlR2_.d.mts +184 -0
  14. package/dist/index-iKNo_z7O.d.ts +184 -0
  15. package/dist/index.d.mts +4872 -3918
  16. package/dist/index.d.ts +4872 -3918
  17. package/dist/index.js +20 -20
  18. package/dist/index.mjs +20 -20
  19. package/dist/{types-DgPbxSij.d.mts → types-DFs7mc3G.d.mts} +1 -1
  20. package/dist/{types-CT0s-S_Y.d.ts → types-DjTB_kVH.d.ts} +1 -1
  21. package/dist/utils.d.mts +1 -1
  22. package/dist/utils.d.ts +1 -1
  23. package/dist/validation/all.d.mts +5 -6
  24. package/dist/validation/all.d.ts +5 -6
  25. package/dist/validation/all.js +1 -1
  26. package/dist/validation/all.mjs +1 -1
  27. package/dist/validation/complex/currency.d.mts +2 -2
  28. package/dist/validation/complex/currency.d.ts +2 -2
  29. package/dist/validation/complex/location.d.mts +2 -2
  30. package/dist/validation/complex/location.d.ts +2 -2
  31. package/dist/validation/complex/phone.d.mts +2 -2
  32. package/dist/validation/complex/phone.d.ts +2 -2
  33. package/dist/validation/complex/relation.d.mts +2 -2
  34. package/dist/validation/complex/relation.d.ts +2 -2
  35. package/dist/validation/complex/richtext.d.mts +2 -2
  36. package/dist/validation/complex/richtext.d.ts +2 -2
  37. package/dist/validation/complex/select.d.mts +2 -2
  38. package/dist/validation/complex/select.d.ts +2 -2
  39. package/dist/validation/complex/user.d.mts +2 -2
  40. package/dist/validation/complex/user.d.ts +2 -2
  41. package/dist/validation/computed/formula.d.mts +2 -2
  42. package/dist/validation/computed/formula.d.ts +2 -2
  43. package/dist/validation/computed/rollup.d.mts +2 -2
  44. package/dist/validation/computed/rollup.d.ts +2 -2
  45. package/dist/validation/config/index.d.mts +2 -3
  46. package/dist/validation/config/index.d.ts +2 -3
  47. package/dist/validation/config/index.js +1 -1
  48. package/dist/validation/config/index.mjs +1 -1
  49. package/dist/validation/core/index.d.mts +3 -3
  50. package/dist/validation/core/index.d.ts +3 -3
  51. package/dist/validation/object/index.d.mts +4 -4
  52. package/dist/validation/object/index.d.ts +4 -4
  53. package/dist/validation/primitives/checkbox.d.mts +2 -2
  54. package/dist/validation/primitives/checkbox.d.ts +2 -2
  55. package/dist/validation/primitives/date.d.mts +2 -2
  56. package/dist/validation/primitives/date.d.ts +2 -2
  57. package/dist/validation/primitives/number.d.mts +2 -2
  58. package/dist/validation/primitives/number.d.ts +2 -2
  59. package/dist/validation/primitives/text.d.mts +2 -2
  60. package/dist/validation/primitives/text.d.ts +2 -2
  61. package/package.json +2 -2
  62. package/dist/chunk-JRBNMHMY.js +0 -2
  63. package/dist/chunk-YFW2M45I.mjs +0 -2
  64. package/dist/helpers-BOtvDGN6.d.ts +0 -76
  65. package/dist/helpers-DrbRe4Xl.d.mts +0 -76
  66. package/dist/index-XQ-3wEYg.d.ts +0 -872
  67. package/dist/index-p0utq5vG.d.mts +0 -872
@@ -0,0 +1,184 @@
1
+ import { z } from 'zod';
2
+ import { k as AttributeType, A as Attribute } from './attributes-2ELU4S-n.mjs';
3
+ import { IconName } from '@stndrds/constants';
4
+
5
+ interface AddAttributeInput {
6
+ name: string;
7
+ label: string;
8
+ type: AttributeType;
9
+ required?: boolean;
10
+ unique?: boolean;
11
+ description?: string;
12
+ placeholder?: string;
13
+ icon?: IconName;
14
+ defaultValue?: unknown;
15
+ metadata?: Record<string, unknown>;
16
+ [key: string]: unknown;
17
+ }
18
+ interface CreateCustomObjectInput {
19
+ name: string;
20
+ label: string;
21
+ pluralLabel?: string;
22
+ labelExpression: string;
23
+ embeddingExpression?: string;
24
+ description?: string;
25
+ icon?: IconName;
26
+ attributes?: (Attribute | {
27
+ build: () => Attribute;
28
+ })[];
29
+ metadata?: Record<string, unknown>;
30
+ }
31
+ interface UpdateObjectInput {
32
+ label?: string;
33
+ pluralLabel?: string;
34
+ description?: string;
35
+ icon?: IconName;
36
+ labelExpression?: string;
37
+ embeddingExpression?: string;
38
+ metadata?: Record<string, unknown>;
39
+ }
40
+ interface RelationOption {
41
+ id: string;
42
+ objectId: string;
43
+ objectName: string;
44
+ objectLabel: string;
45
+ objectIcon?: string;
46
+ label: string;
47
+ }
48
+ interface RelationOptionsResponse {
49
+ options: RelationOption[];
50
+ hasMore: boolean;
51
+ total: number;
52
+ nextOffset?: number;
53
+ }
54
+
55
+ declare const statusGroupSchema: z.ZodEnum<{
56
+ idle: "idle";
57
+ in_progress: "in_progress";
58
+ finished: "finished";
59
+ }>;
60
+ declare const selectOptionWriteSchema: z.ZodObject<{
61
+ value: z.ZodString;
62
+ label: z.ZodString;
63
+ description: z.ZodOptional<z.ZodString>;
64
+ inverse: z.ZodOptional<z.ZodString>;
65
+ archived: z.ZodOptional<z.ZodBoolean>;
66
+ color: z.ZodEnum<{
67
+ gray: "gray";
68
+ slate: "slate";
69
+ blue: "blue";
70
+ sky: "sky";
71
+ indigo: "indigo";
72
+ green: "green";
73
+ emerald: "emerald";
74
+ teal: "teal";
75
+ red: "red";
76
+ rose: "rose";
77
+ yellow: "yellow";
78
+ amber: "amber";
79
+ orange: "orange";
80
+ purple: "purple";
81
+ violet: "violet";
82
+ fuchsia: "fuchsia";
83
+ pink: "pink";
84
+ cyan: "cyan";
85
+ lime: "lime";
86
+ }>;
87
+ }, z.core.$strict>;
88
+ declare const multiselectOptionWriteSchema: z.ZodObject<{
89
+ value: z.ZodString;
90
+ label: z.ZodString;
91
+ description: z.ZodOptional<z.ZodString>;
92
+ inverse: z.ZodOptional<z.ZodString>;
93
+ archived: z.ZodOptional<z.ZodBoolean>;
94
+ color: z.ZodEnum<{
95
+ gray: "gray";
96
+ slate: "slate";
97
+ blue: "blue";
98
+ sky: "sky";
99
+ indigo: "indigo";
100
+ green: "green";
101
+ emerald: "emerald";
102
+ teal: "teal";
103
+ red: "red";
104
+ rose: "rose";
105
+ yellow: "yellow";
106
+ amber: "amber";
107
+ orange: "orange";
108
+ purple: "purple";
109
+ violet: "violet";
110
+ fuchsia: "fuchsia";
111
+ pink: "pink";
112
+ cyan: "cyan";
113
+ lime: "lime";
114
+ }>;
115
+ }, z.core.$strict>;
116
+ declare const statusOptionWriteSchema: z.ZodObject<{
117
+ value: z.ZodString;
118
+ label: z.ZodString;
119
+ description: z.ZodOptional<z.ZodString>;
120
+ inverse: z.ZodOptional<z.ZodString>;
121
+ archived: z.ZodOptional<z.ZodBoolean>;
122
+ color: z.ZodEnum<{
123
+ gray: "gray";
124
+ slate: "slate";
125
+ blue: "blue";
126
+ sky: "sky";
127
+ indigo: "indigo";
128
+ green: "green";
129
+ emerald: "emerald";
130
+ teal: "teal";
131
+ red: "red";
132
+ rose: "rose";
133
+ yellow: "yellow";
134
+ amber: "amber";
135
+ orange: "orange";
136
+ purple: "purple";
137
+ violet: "violet";
138
+ fuchsia: "fuchsia";
139
+ pink: "pink";
140
+ cyan: "cyan";
141
+ lime: "lime";
142
+ }>;
143
+ group: z.ZodEnum<{
144
+ idle: "idle";
145
+ in_progress: "in_progress";
146
+ finished: "finished";
147
+ }>;
148
+ }, z.core.$strict>;
149
+ /**
150
+ * Map of attribute type to config schema
151
+ */
152
+ declare const attributeConfigSchemas: Record<AttributeType, z.ZodObject<z.ZodRawShape>>;
153
+ /**
154
+ * Get the config schema for a specific attribute type
155
+ */
156
+ declare function getAttributeConfigSchema(type: AttributeType): z.ZodObject<z.ZodRawShape>;
157
+ /**
158
+ * Validate and strip unknown properties from attribute config
159
+ * This ensures only allowed properties are stored in the database
160
+ */
161
+ declare function parseAttributeConfig(type: AttributeType, config: Record<string, unknown>): Record<string, unknown>;
162
+ /**
163
+ * The config contract as a WRITE applies it: the stored schema plus the
164
+ * stricter option and icon rules newly written values must satisfy.
165
+ */
166
+ declare function getAttributeConfigWriteSchema(type: AttributeType): z.ZodObject<z.ZodRawShape>;
167
+ /**
168
+ * Strict parser for newly created attribute definitions.
169
+ *
170
+ * Top-level config remains strip-compatible with the historical config
171
+ * contract, while newly written icons and select-like option objects are
172
+ * validated strictly.
173
+ */
174
+ declare function parseAttributeConfigForCreate(type: AttributeType, input: unknown): Record<string, unknown>;
175
+ /**
176
+ * Patch-aware parser for persisted attributes.
177
+ *
178
+ * An explicit options patch owns and strictly validates the complete new
179
+ * list. Omission means the stored legacy list is preserved without
180
+ * reconstruction, including options that predate required colours/groups.
181
+ */
182
+ declare function parseAttributeConfigForUpdate(stored: Attribute, patch: Partial<AddAttributeInput>): Record<string, unknown>;
183
+
184
+ export { type AddAttributeInput as A, type CreateCustomObjectInput as C, type RelationOption as R, type UpdateObjectInput as U, type RelationOptionsResponse as a, attributeConfigSchemas as b, parseAttributeConfigForCreate as c, parseAttributeConfigForUpdate as d, statusGroupSchema as e, statusOptionWriteSchema as f, getAttributeConfigSchema as g, getAttributeConfigWriteSchema as h, multiselectOptionWriteSchema as m, parseAttributeConfig as p, selectOptionWriteSchema as s };
@@ -0,0 +1,184 @@
1
+ import { z } from 'zod';
2
+ import { k as AttributeType, A as Attribute } from './attributes-2ELU4S-n.js';
3
+ import { IconName } from '@stndrds/constants';
4
+
5
+ interface AddAttributeInput {
6
+ name: string;
7
+ label: string;
8
+ type: AttributeType;
9
+ required?: boolean;
10
+ unique?: boolean;
11
+ description?: string;
12
+ placeholder?: string;
13
+ icon?: IconName;
14
+ defaultValue?: unknown;
15
+ metadata?: Record<string, unknown>;
16
+ [key: string]: unknown;
17
+ }
18
+ interface CreateCustomObjectInput {
19
+ name: string;
20
+ label: string;
21
+ pluralLabel?: string;
22
+ labelExpression: string;
23
+ embeddingExpression?: string;
24
+ description?: string;
25
+ icon?: IconName;
26
+ attributes?: (Attribute | {
27
+ build: () => Attribute;
28
+ })[];
29
+ metadata?: Record<string, unknown>;
30
+ }
31
+ interface UpdateObjectInput {
32
+ label?: string;
33
+ pluralLabel?: string;
34
+ description?: string;
35
+ icon?: IconName;
36
+ labelExpression?: string;
37
+ embeddingExpression?: string;
38
+ metadata?: Record<string, unknown>;
39
+ }
40
+ interface RelationOption {
41
+ id: string;
42
+ objectId: string;
43
+ objectName: string;
44
+ objectLabel: string;
45
+ objectIcon?: string;
46
+ label: string;
47
+ }
48
+ interface RelationOptionsResponse {
49
+ options: RelationOption[];
50
+ hasMore: boolean;
51
+ total: number;
52
+ nextOffset?: number;
53
+ }
54
+
55
+ declare const statusGroupSchema: z.ZodEnum<{
56
+ idle: "idle";
57
+ in_progress: "in_progress";
58
+ finished: "finished";
59
+ }>;
60
+ declare const selectOptionWriteSchema: z.ZodObject<{
61
+ value: z.ZodString;
62
+ label: z.ZodString;
63
+ description: z.ZodOptional<z.ZodString>;
64
+ inverse: z.ZodOptional<z.ZodString>;
65
+ archived: z.ZodOptional<z.ZodBoolean>;
66
+ color: z.ZodEnum<{
67
+ gray: "gray";
68
+ slate: "slate";
69
+ blue: "blue";
70
+ sky: "sky";
71
+ indigo: "indigo";
72
+ green: "green";
73
+ emerald: "emerald";
74
+ teal: "teal";
75
+ red: "red";
76
+ rose: "rose";
77
+ yellow: "yellow";
78
+ amber: "amber";
79
+ orange: "orange";
80
+ purple: "purple";
81
+ violet: "violet";
82
+ fuchsia: "fuchsia";
83
+ pink: "pink";
84
+ cyan: "cyan";
85
+ lime: "lime";
86
+ }>;
87
+ }, z.core.$strict>;
88
+ declare const multiselectOptionWriteSchema: z.ZodObject<{
89
+ value: z.ZodString;
90
+ label: z.ZodString;
91
+ description: z.ZodOptional<z.ZodString>;
92
+ inverse: z.ZodOptional<z.ZodString>;
93
+ archived: z.ZodOptional<z.ZodBoolean>;
94
+ color: z.ZodEnum<{
95
+ gray: "gray";
96
+ slate: "slate";
97
+ blue: "blue";
98
+ sky: "sky";
99
+ indigo: "indigo";
100
+ green: "green";
101
+ emerald: "emerald";
102
+ teal: "teal";
103
+ red: "red";
104
+ rose: "rose";
105
+ yellow: "yellow";
106
+ amber: "amber";
107
+ orange: "orange";
108
+ purple: "purple";
109
+ violet: "violet";
110
+ fuchsia: "fuchsia";
111
+ pink: "pink";
112
+ cyan: "cyan";
113
+ lime: "lime";
114
+ }>;
115
+ }, z.core.$strict>;
116
+ declare const statusOptionWriteSchema: z.ZodObject<{
117
+ value: z.ZodString;
118
+ label: z.ZodString;
119
+ description: z.ZodOptional<z.ZodString>;
120
+ inverse: z.ZodOptional<z.ZodString>;
121
+ archived: z.ZodOptional<z.ZodBoolean>;
122
+ color: z.ZodEnum<{
123
+ gray: "gray";
124
+ slate: "slate";
125
+ blue: "blue";
126
+ sky: "sky";
127
+ indigo: "indigo";
128
+ green: "green";
129
+ emerald: "emerald";
130
+ teal: "teal";
131
+ red: "red";
132
+ rose: "rose";
133
+ yellow: "yellow";
134
+ amber: "amber";
135
+ orange: "orange";
136
+ purple: "purple";
137
+ violet: "violet";
138
+ fuchsia: "fuchsia";
139
+ pink: "pink";
140
+ cyan: "cyan";
141
+ lime: "lime";
142
+ }>;
143
+ group: z.ZodEnum<{
144
+ idle: "idle";
145
+ in_progress: "in_progress";
146
+ finished: "finished";
147
+ }>;
148
+ }, z.core.$strict>;
149
+ /**
150
+ * Map of attribute type to config schema
151
+ */
152
+ declare const attributeConfigSchemas: Record<AttributeType, z.ZodObject<z.ZodRawShape>>;
153
+ /**
154
+ * Get the config schema for a specific attribute type
155
+ */
156
+ declare function getAttributeConfigSchema(type: AttributeType): z.ZodObject<z.ZodRawShape>;
157
+ /**
158
+ * Validate and strip unknown properties from attribute config
159
+ * This ensures only allowed properties are stored in the database
160
+ */
161
+ declare function parseAttributeConfig(type: AttributeType, config: Record<string, unknown>): Record<string, unknown>;
162
+ /**
163
+ * The config contract as a WRITE applies it: the stored schema plus the
164
+ * stricter option and icon rules newly written values must satisfy.
165
+ */
166
+ declare function getAttributeConfigWriteSchema(type: AttributeType): z.ZodObject<z.ZodRawShape>;
167
+ /**
168
+ * Strict parser for newly created attribute definitions.
169
+ *
170
+ * Top-level config remains strip-compatible with the historical config
171
+ * contract, while newly written icons and select-like option objects are
172
+ * validated strictly.
173
+ */
174
+ declare function parseAttributeConfigForCreate(type: AttributeType, input: unknown): Record<string, unknown>;
175
+ /**
176
+ * Patch-aware parser for persisted attributes.
177
+ *
178
+ * An explicit options patch owns and strictly validates the complete new
179
+ * list. Omission means the stored legacy list is preserved without
180
+ * reconstruction, including options that predate required colours/groups.
181
+ */
182
+ declare function parseAttributeConfigForUpdate(stored: Attribute, patch: Partial<AddAttributeInput>): Record<string, unknown>;
183
+
184
+ export { type AddAttributeInput as A, type CreateCustomObjectInput as C, type RelationOption as R, type UpdateObjectInput as U, type RelationOptionsResponse as a, attributeConfigSchemas as b, parseAttributeConfigForCreate as c, parseAttributeConfigForUpdate as d, statusGroupSchema as e, statusOptionWriteSchema as f, getAttributeConfigSchema as g, getAttributeConfigWriteSchema as h, multiselectOptionWriteSchema as m, parseAttributeConfig as p, selectOptionWriteSchema as s };