@wildo-ai/zod-decorators 1.1.10 → 1.1.11
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/esm/commons.d.ts.map +1 -1
- package/dist/esm/commons.js.map +1 -1
- package/dist/esm/currencies.shared.schemas.d.ts.map +1 -1
- package/dist/esm/currencies.shared.schemas.js.map +1 -1
- package/dist/esm/files/agent-file-formats.d.ts.map +1 -1
- package/dist/esm/files/agent-file-formats.js.map +1 -1
- package/dist/esm/files/extension-nature-map.d.ts.map +1 -1
- package/dist/esm/files/extension-nature-map.js.map +1 -1
- package/dist/esm/files/file-extensions.enum.d.ts.map +1 -1
- package/dist/esm/files/file-extensions.enum.js.map +1 -1
- package/dist/esm/files/mime-registry.d.ts.map +1 -1
- package/dist/esm/files/mime-registry.js.map +1 -1
- package/dist/esm/files/unified-registry.d.ts.map +1 -1
- package/dist/esm/files/unified-registry.js.map +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/install-bigint-json-encoding.d.ts.map +1 -1
- package/dist/esm/install-bigint-json-encoding.js.map +1 -1
- package/dist/esm/testing/decorated-test-schemas.d.ts +1 -1
- package/dist/esm/testing/decorated-test-schemas.d.ts.map +1 -1
- package/dist/esm/testing/decorated-test-schemas.js.map +1 -1
- package/dist/esm/testing.d.ts.map +1 -1
- package/dist/esm/testing.js.map +1 -1
- package/dist/esm/zod-address.d.ts.map +1 -1
- package/dist/esm/zod-address.js.map +1 -1
- package/dist/esm/zod-bigdecimal.d.ts +16 -8
- package/dist/esm/zod-bigdecimal.d.ts.map +1 -1
- package/dist/esm/zod-bigdecimal.js.map +1 -1
- package/dist/esm/zod-code.d.ts +17 -9
- package/dist/esm/zod-code.d.ts.map +1 -1
- package/dist/esm/zod-code.js.map +1 -1
- package/dist/esm/zod-color.d.ts.map +1 -1
- package/dist/esm/zod-color.js.map +1 -1
- package/dist/esm/zod-decorators.types.d.ts +330 -39
- package/dist/esm/zod-decorators.types.d.ts.map +1 -1
- package/dist/esm/zod-decorators.types.js +150 -13
- package/dist/esm/zod-decorators.types.js.map +1 -1
- package/dist/esm/zod-document-sequence.d.ts.map +1 -1
- package/dist/esm/zod-document-sequence.js.map +1 -1
- package/dist/esm/zod-duration.d.ts +22 -14
- package/dist/esm/zod-duration.d.ts.map +1 -1
- package/dist/esm/zod-duration.js.map +1 -1
- package/dist/esm/zod-file.d.ts +0 -4
- package/dist/esm/zod-file.d.ts.map +1 -1
- package/dist/esm/zod-file.js +9 -20
- package/dist/esm/zod-file.js.map +1 -1
- package/dist/esm/zod-money.d.ts +22 -14
- package/dist/esm/zod-money.d.ts.map +1 -1
- package/dist/esm/zod-money.js.map +1 -1
- package/dist/esm/zod-phone.d.ts +22 -14
- package/dist/esm/zod-phone.d.ts.map +1 -1
- package/dist/esm/zod-phone.js.map +1 -1
- package/dist/esm/zod-range.d.ts.map +1 -1
- package/dist/esm/zod-range.js +5 -1
- package/dist/esm/zod-range.js.map +1 -1
- package/dist/esm/zod-utils.shared.d.ts +102 -2
- package/dist/esm/zod-utils.shared.d.ts.map +1 -1
- package/dist/esm/zod-utils.shared.js +220 -10
- package/dist/esm/zod-utils.shared.js.map +1 -1
- package/dist/esm/zod-versioned.d.ts.map +1 -1
- package/dist/esm/zod-versioned.js.map +1 -1
- package/dist/esm/zod.module-override.d.ts +174 -53
- package/dist/esm/zod.module-override.d.ts.map +1 -1
- package/dist/esm/zod.module-override.js +433 -61
- package/dist/esm/zod.module-override.js.map +1 -1
- package/package.json +1 -1
|
@@ -147,9 +147,14 @@ export declare enum AutocompleteModifier {
|
|
|
147
147
|
PAGER = "pager",
|
|
148
148
|
WEBAUTHN = "webauthn"
|
|
149
149
|
}
|
|
150
|
+
/** @wildo_source:part:start zod.decorators.chrome-modes facet:layer:frontend facet:family:ui facet:surface:form facet:surface:display facet:audience:app-developer */
|
|
150
151
|
/**
|
|
151
152
|
* Chrome layout mode for display context (detail/read-only views).
|
|
152
153
|
* Controls how the field wrapper (label, value, description) is arranged.
|
|
154
|
+
*
|
|
155
|
+
* Import from `@wildo-ai/zod-decorators`. Declared per field (`display.chromeMode` in its `…UI()`), per
|
|
156
|
+
* layout (`layout.defaultChromeMode.display`) or per section; a `<FieldTiles>` host sets TILE for the fields
|
|
157
|
+
* placed in it. Every mode may be given per breakpoint ({@link ResponsiveAware}).
|
|
153
158
|
*/
|
|
154
159
|
export declare const DisplayChromeMode: {
|
|
155
160
|
/** Label above, value below, description below value (default). */
|
|
@@ -167,11 +172,32 @@ export declare const DisplayChromeMode: {
|
|
|
167
172
|
readonly COMPACT: "compact";
|
|
168
173
|
/** No chrome at all — bare value output. */
|
|
169
174
|
readonly HIDDEN: "hidden";
|
|
175
|
+
/**
|
|
176
|
+
* A FACT TILE: the name small and quiet above, the value below, on a bounded tile
|
|
177
|
+
* (`SurfaceVariant.TILE`) — the shape of a record's facts laid out as a grid, which is how they are
|
|
178
|
+
* read: scanned by name, compared by value.
|
|
179
|
+
*
|
|
180
|
+
* Hosted by `<FieldTiles>`, which lays the tiles on a grid and gives its fields this chrome by
|
|
181
|
+
* default; a field that declares its own `chromeMode` (a description declaring HIDDEN) keeps it and
|
|
182
|
+
* takes a whole row of the grid in that chrome. Wide values — lists, objects, files, long text, a
|
|
183
|
+
* reference shown as its record's summary card — take a whole row. A tile shows no description line;
|
|
184
|
+
* a description the field declares rides in the tile's tooltip.
|
|
185
|
+
*
|
|
186
|
+
* Not the SETTINGS_ROW read chrome, which stays the shape of a SETTINGS pane: there the value sits
|
|
187
|
+
* where its control will appear. On a record the row placed a value up to 300px from its name, and a
|
|
188
|
+
* record is not a settings pane.
|
|
189
|
+
*/
|
|
190
|
+
readonly TILE: "tile";
|
|
170
191
|
};
|
|
171
192
|
export type DisplayChromeMode = typeof DisplayChromeMode[keyof typeof DisplayChromeMode];
|
|
172
193
|
/**
|
|
173
194
|
* Chrome layout mode for edit context (forms).
|
|
174
|
-
*
|
|
195
|
+
*
|
|
196
|
+
* NOT a superset of {@link DisplayChromeMode}, though most members share a name and a value: RELAXED
|
|
197
|
+
* exists only here (a form's generous onboarding spacing), and TILE exists only on the display side (a
|
|
198
|
+
* record's facts read as tiles; a form control is never a tile). A shared name is not always a shared
|
|
199
|
+
* geometry — edit INLINE puts the control BEFORE its label (a switch, a checkbox), display INLINE puts the
|
|
200
|
+
* name before its value — so read each member's own line.
|
|
175
201
|
*/
|
|
176
202
|
export declare const EditChromeMode: {
|
|
177
203
|
/** Label above, control below, description + error below control (default). */
|
|
@@ -199,6 +225,7 @@ export type ResponsiveChromeMode = EditChromeMode | Partial<Record<ViewportBreak
|
|
|
199
225
|
* Used for chromeMode, forceHide, and other properties that may vary by viewport.
|
|
200
226
|
*/
|
|
201
227
|
export type ResponsiveAware<T> = T | Partial<Record<ViewportBreakpoint, T>>;
|
|
228
|
+
/** @wildo_source:part:end zod.decorators.chrome-modes */
|
|
202
229
|
export type FormFieldSchemaTypeComponents = {
|
|
203
230
|
[K in FieldSchemaType]: K extends FieldSchemaType.STRING ? FormFieldComponent.INPUT | FormFieldComponent.TEXTAREA | FormFieldComponent.SELECT | FormFieldComponent.RADIO_GROUP | FormFieldComponent.DATE | FormFieldComponent.TIME | FormFieldComponent.DATETIME : K extends FieldSchemaType.NUMBER ? FormFieldComponent.INPUT | FormFieldComponent.SLIDER | FormFieldComponent.SELECT | FormFieldComponent.RADIO_GROUP : K extends FieldSchemaType.BIGINT ? FormFieldComponent.INPUT : K extends FieldSchemaType.BOOLEAN ? FormFieldComponent.SWITCH | FormFieldComponent.CHECKBOX | FormFieldComponent.SELECT | FormFieldComponent.RADIO_GROUP : K extends FieldSchemaType.ENUM ? FormFieldComponent.SELECT | FormFieldComponent.RADIO_GROUP : K extends FieldSchemaType.DATE ? FormFieldComponent.DATE | FormFieldComponent.DATETIME | FormFieldComponent.INPUT : K extends FieldSchemaType.TIME ? FormFieldComponent.TIME | FormFieldComponent.INPUT : K extends FieldSchemaType.DATETIME ? FormFieldComponent.DATETIME | FormFieldComponent.INPUT : K extends FieldSchemaType.RANGE_NUMBER ? FormFieldComponent.RANGE_SLIDER : K extends FieldSchemaType.RANGE_DATE ? FormFieldComponent.DATE_RANGE : K extends FieldSchemaType.RANGE_DATETIME ? FormFieldComponent.DATETIME_RANGE : K extends FieldSchemaType.RANGE_TIME ? FormFieldComponent.TIME_RANGE : K extends FieldSchemaType.RANGE_BIGDECIMAL ? FormFieldComponent.BIGDECIMAL_RANGE : K extends FieldSchemaType.RANGE_MONEY ? FormFieldComponent.MONEY_RANGE : K extends FieldSchemaType.MONEY ? FormFieldComponent.INPUT : K extends FieldSchemaType.DURATION ? FormFieldComponent.DURATION : K extends FieldSchemaType.PHONE ? FormFieldComponent.PHONE : K extends FieldSchemaType.ADDRESS ? FormFieldComponent.ADDRESS : K extends FieldSchemaType.BIGDECIMAL ? FormFieldComponent.INPUT : K extends FieldSchemaType.CODE ? FormFieldComponent.TEXTAREA : K extends FieldSchemaType.FILE ? FormFieldComponent.INPUT : K extends FieldSchemaType.ARRAY ? FormFieldComponent.CHECKBOX_GROUP | FormFieldComponent.SELECT : K extends FieldSchemaType.SET ? FormFieldComponent.INPUT | FormFieldComponent.CHECKBOX_GROUP | FormFieldComponent.SELECT : K extends FieldSchemaType.TUPLE ? FormFieldComponent.INPUT : K extends FieldSchemaType.UNKNOWN ? FormFieldComponent.INPUT : never;
|
|
204
231
|
};
|
|
@@ -250,7 +277,8 @@ export type DefaultDisplayComponentForSchemaType<T extends FieldSchemaType> = Di
|
|
|
250
277
|
* - DEFAULT: Standard section with border and padding
|
|
251
278
|
* - CARD: Wrapped in a card container with shadow
|
|
252
279
|
* - GHOST: Minimal container without visual styling
|
|
253
|
-
* - COLLAPSIBLE:
|
|
280
|
+
* - COLLAPSIBLE: ONE section behind its own open/close trigger. `defaultFocus={false}` starts it
|
|
281
|
+
* closed — the mode for an aside a reader reveals on request
|
|
254
282
|
*
|
|
255
283
|
* **Container modes** (sections sharing the same mode are grouped together,
|
|
256
284
|
* rendered at the position of the first occurrence):
|
|
@@ -265,9 +293,12 @@ export type DefaultDisplayComponentForSchemaType<T extends FieldSchemaType> = Di
|
|
|
265
293
|
* - VERTICAL_TABS: Vertical tabs (side navigation)
|
|
266
294
|
* - PILLS: Pill/segment navigation (compact)
|
|
267
295
|
*
|
|
268
|
-
* @category
|
|
269
|
-
* - ACCORDION:
|
|
270
|
-
* - EXPANDABLE:
|
|
296
|
+
* @category Disclosure over a GROUP of sections
|
|
297
|
+
* - ACCORDION: one trigger per section; single-open unless `allowMultiple`
|
|
298
|
+
* - EXPANDABLE: truncation, not a toggle — the first `initialVisibleCount` (default 3) sections of
|
|
299
|
+
* the group show, and one "Show more" button reveals the rest. A group of `initialVisibleCount`
|
|
300
|
+
* sections or fewer never truncates, so EXPANDABLE over a single section renders it always open
|
|
301
|
+
* with no button: to hide one section until asked, use COLLAPSIBLE (#2197)
|
|
271
302
|
*
|
|
272
303
|
* @category Guided (sequential, with indicators)
|
|
273
304
|
* - STEPPER: Step-by-step with step indicators
|
|
@@ -499,11 +530,32 @@ export declare const StringEditMode: {
|
|
|
499
530
|
* `/application-config` (`organizationRoles`). Each option reads as the role's word from the `roles` labels. Use it
|
|
500
531
|
* for any string field that names ONE role a setting admits (a reader role, a routing role), so an administrator
|
|
501
532
|
* picks a role that exists instead of typing a key exactly. Falls back to a text input when the backend publishes no
|
|
502
|
-
* table.
|
|
533
|
+
* table. An operation's `requestFieldOffers` narrows the roles further (#2778), and `organizationRoleTable:
|
|
534
|
+
* ANOTHER_ORGANIZATION` (see {@link OrganizationRoleTable}) makes it a role held in another organization, offered from
|
|
535
|
+
* the operation's offer alone. The server remains the control: it decides what holding the role grants.
|
|
503
536
|
*/
|
|
504
537
|
readonly ORGANIZATION_ROLE: "organization_role";
|
|
505
538
|
};
|
|
506
539
|
export type StringEditMode = typeof StringEditMode[keyof typeof StringEditMode];
|
|
540
|
+
/**
|
|
541
|
+
* WHOSE role table an `ORGANIZATION_ROLE` picker reads (#2778).
|
|
542
|
+
*
|
|
543
|
+
* - `CURRENT_ORGANIZATION` (the default): the role is one of the organization being administered, so the picker offers
|
|
544
|
+
* that organization's table (the application's organization roles as its type narrows them).
|
|
545
|
+
* - `ANOTHER_ORGANIZATION`: the role names a role in ANOTHER organization, such as the role a representing organization
|
|
546
|
+
* proposes to hold in the granting one. The current organization's table is then the wrong population, so the picker
|
|
547
|
+
* offers only the values its operation's request field offer gives (`requestFieldOffers`), and is a text input
|
|
548
|
+
* while there is no offer.
|
|
549
|
+
*
|
|
550
|
+
* A const object, not an enum, like every edit- and display-mode vocabulary it sits among (`StringEditMode` above):
|
|
551
|
+
* these values are written inside `stringUI({ edit })` literals, and one vocabulary of the family declared differently
|
|
552
|
+
* would be the one a reader trips on. Converting the family is one decision for all of them, not a per-member one.
|
|
553
|
+
*/
|
|
554
|
+
export declare const OrganizationRoleTable: {
|
|
555
|
+
readonly CURRENT_ORGANIZATION: "current_organization";
|
|
556
|
+
readonly ANOTHER_ORGANIZATION: "another_organization";
|
|
557
|
+
};
|
|
558
|
+
export type OrganizationRoleTable = typeof OrganizationRoleTable[keyof typeof OrganizationRoleTable];
|
|
507
559
|
/**
|
|
508
560
|
* Number display modes for rendering number values
|
|
509
561
|
*/
|
|
@@ -560,10 +612,28 @@ export type BigDecimalEditMode = typeof BigDecimalEditMode[keyof typeof BigDecim
|
|
|
560
612
|
* Enum display modes for rendering enum values
|
|
561
613
|
*/
|
|
562
614
|
export declare const EnumDisplayMode: {
|
|
615
|
+
/** The value's word alone, in the voice of the text around it — for a value with no colour to carry. */
|
|
563
616
|
readonly TEXT: "text";
|
|
617
|
+
/** A soft pill in the value's colour. A value with no icon of its own leads with a state dot. */
|
|
564
618
|
readonly BADGE: "badge";
|
|
619
|
+
/**
|
|
620
|
+
* The value's icon alone, on a pill in its colour; the word is read to assistive technology and shown on
|
|
621
|
+
* hover. The compact form for a summary line (`summaryOverride: { displayMode: ICON }`) where the icon is
|
|
622
|
+
* already known to the reader. A value with no `icon` of its own shows a dot in its colour instead.
|
|
623
|
+
*/
|
|
565
624
|
readonly ICON: "icon";
|
|
625
|
+
/** The word on a small card of its own — for a value that is the subject of a surface, not one fact among several. */
|
|
566
626
|
readonly CARD: "card";
|
|
627
|
+
/**
|
|
628
|
+
* A tone dot and the label, with no chip around them — the QUIET form of a coloured value.
|
|
629
|
+
*
|
|
630
|
+
* For the second coloured value beside a status: priority next to status, severity next to state.
|
|
631
|
+
* Two filled pills side by side compete for the same attention; one pill and one dot keep the
|
|
632
|
+
* status as the thing that is read first. The dot fills with the value's colour at full strength and
|
|
633
|
+
* the label takes the same tone, so the value still reads without the chip. A value whose colour is
|
|
634
|
+
* the neutral one renders its dot and label muted.
|
|
635
|
+
*/
|
|
636
|
+
readonly DOT: "dot";
|
|
567
637
|
};
|
|
568
638
|
export type EnumDisplayMode = typeof EnumDisplayMode[keyof typeof EnumDisplayMode];
|
|
569
639
|
/**
|
|
@@ -860,7 +930,7 @@ export declare enum RangeType {
|
|
|
860
930
|
export type RangeTypeMapping = {
|
|
861
931
|
[RangeType.NUMBER]: number;
|
|
862
932
|
[RangeType.DATE]: Date;
|
|
863
|
-
[RangeType.DATETIME]:
|
|
933
|
+
[RangeType.DATETIME]: Date;
|
|
864
934
|
[RangeType.TIME]: string;
|
|
865
935
|
[RangeType.BIGDECIMAL]: string;
|
|
866
936
|
[RangeType.MONEY]: {
|
|
@@ -1373,10 +1443,15 @@ export interface FileMultipleFilePolicy {
|
|
|
1373
1443
|
* <scope>/<scopeId>/ ← the tenant segments (organizations/<id>, user_self/<id>,
|
|
1374
1444
|
* or application/<applicationId>)
|
|
1375
1445
|
* [folderPath(ctx)/] ← dynamic folder path
|
|
1376
|
-
* <fileName(ctx) | fileId>
|
|
1446
|
+
* [<fileId>/]<fileName(ctx)> | <fileId> ← explicit name under the file's own id, or the id alone
|
|
1377
1447
|
* ```
|
|
1378
1448
|
*
|
|
1379
|
-
*
|
|
1449
|
+
* A name is display metadata, never the identity of the stored object (#2901): when a name is resolved, the file's id
|
|
1450
|
+
* is the level directly above it, so two files of one field never share a key, whatever the name says. A static
|
|
1451
|
+
* `fileName` once gave every file of the field one key, and a regenerated file was written over the bytes its
|
|
1452
|
+
* predecessor still pointed at.
|
|
1453
|
+
*
|
|
1454
|
+
* Only `folderPath` and the name are authored here. Everything above them is derived by the framework and
|
|
1380
1455
|
* is identical on every path-based provider, because `<scope>/<scopeId>` is what makes one tenant's
|
|
1381
1456
|
* blobs a PREFIX — the unit erasure, orphan sweeps and per-tenant listing operate on.
|
|
1382
1457
|
*
|
|
@@ -1421,8 +1496,8 @@ export interface FilePathBinding {
|
|
|
1421
1496
|
*/
|
|
1422
1497
|
folderPath?: string | ((context: FilePathBindingContext) => string);
|
|
1423
1498
|
/**
|
|
1424
|
-
* File name for single `z_file()` fields (non-multiple)
|
|
1425
|
-
* When omitted,
|
|
1499
|
+
* File name for single `z_file()` fields (non-multiple): the stored object's last segment, placed under the file's own
|
|
1500
|
+
* id, so a static name is safe (#2901). When omitted, the key is the fileId alone.
|
|
1426
1501
|
*
|
|
1427
1502
|
* - `string` — static name; can include `{ext}` placeholder.
|
|
1428
1503
|
* - `function` — receives binding context and returns the file name.
|
|
@@ -2164,6 +2239,44 @@ export interface ImpersonalizeFieldParams {
|
|
|
2164
2239
|
*/
|
|
2165
2240
|
maskValue?: string;
|
|
2166
2241
|
}
|
|
2242
|
+
/**
|
|
2243
|
+
* The optional second argument of `.dataCategories(categories, options)` (#2119).
|
|
2244
|
+
*
|
|
2245
|
+
* Kept as an options bag, like `impersonalizeWith(treatment, options)`, so a second qualifier lands
|
|
2246
|
+
* here instead of as a new positional argument.
|
|
2247
|
+
*/
|
|
2248
|
+
export interface DataCategoriesOptions {
|
|
2249
|
+
/**
|
|
2250
|
+
* The condition under which this field's value is personal data at all — a `PersonalDataCondition`
|
|
2251
|
+
* value carried as an opaque string (zod-decorators sits below saas-models and cannot reference
|
|
2252
|
+
* the enum). Absent means the field is personal data on every row.
|
|
2253
|
+
*
|
|
2254
|
+
* The case it exists for: a field naming the PARTY a row describes — a tenant organization, a
|
|
2255
|
+
* customer account — is a natural person's data when that party is an individual (a sole trader)
|
|
2256
|
+
* and not when it is a company. Declaring the categories with this condition lets a privacy
|
|
2257
|
+
* notice say "where the customer is an individual" instead of choosing between two false
|
|
2258
|
+
* sentences. Whether the value is a real member is checked by the saas-models boot guard.
|
|
2259
|
+
*/
|
|
2260
|
+
personalOnlyWhen?: string;
|
|
2261
|
+
/**
|
|
2262
|
+
* `true` when the field names a party OTHER than the one the row is about: a copy of another organization's name kept
|
|
2263
|
+
* on a cost aggregate, a relationship, a membership or an access grant (#2535). Absent on a field naming the row's own
|
|
2264
|
+
* party, such as an organization's or a customer account's own name.
|
|
2265
|
+
*
|
|
2266
|
+
* WHOSE data a field is, which is a different question from WHEN it is personal (`personalOnlyWhen`), so it is
|
|
2267
|
+
* declared separately. Only one reader asks it: the `RETAIN_ONLY` contradiction guard, which admits a conditional copy
|
|
2268
|
+
* of another party's name on a resource stating "no personal data about its own subject", and still refuses the row's
|
|
2269
|
+
* own party's name there. Every other reader (erasure, export, the notice) counts the field exactly as before.
|
|
2270
|
+
*/
|
|
2271
|
+
aboutAnotherParty?: boolean;
|
|
2272
|
+
}
|
|
2273
|
+
/**
|
|
2274
|
+
* What `.dataCategories()` STORES: the normalized form of either authoring shape. The categories
|
|
2275
|
+
* are always a deduped, non-empty array; the condition is present only when one was declared.
|
|
2276
|
+
*/
|
|
2277
|
+
export interface DataCategoriesFieldParams extends DataCategoriesOptions {
|
|
2278
|
+
categories: readonly string[];
|
|
2279
|
+
}
|
|
2167
2280
|
/**
|
|
2168
2281
|
* Parameters passed to virtual field calculation functions.
|
|
2169
2282
|
* The `utils` is typed as `any` in shared-lib but will be properly typed at runtime in backend-lib.
|
|
@@ -2188,16 +2301,56 @@ export interface VirtualFieldCalculationParams<TObject = any, TContext = any, TU
|
|
|
2188
2301
|
*/
|
|
2189
2302
|
utils: any;
|
|
2190
2303
|
}
|
|
2304
|
+
/**
|
|
2305
|
+
* Parameters passed to a virtual field's BATCHED calculation ({@link VirtualFieldParams.calculateMany}): the rows of
|
|
2306
|
+
* one list, in the order the list returns them.
|
|
2307
|
+
*/
|
|
2308
|
+
export interface VirtualFieldBatchCalculationParams<TObject = any> {
|
|
2309
|
+
/** The rows to compute the field for, in list order. */
|
|
2310
|
+
currentObjects: readonly TObject[];
|
|
2311
|
+
/** The execution context of the request listing them. */
|
|
2312
|
+
executionContext: any;
|
|
2313
|
+
/** The same utility services as {@link VirtualFieldCalculationParams.utils}. */
|
|
2314
|
+
utils: any;
|
|
2315
|
+
}
|
|
2191
2316
|
/**
|
|
2192
2317
|
* Parameters for the isVirtual decorator.
|
|
2193
2318
|
* Virtual fields are computed at runtime and not stored in the database.
|
|
2194
2319
|
*/
|
|
2195
2320
|
export interface VirtualFieldParams<TObject = any, TResult = any> {
|
|
2196
2321
|
/**
|
|
2197
|
-
* The calculation function that computes this virtual field's value.
|
|
2198
|
-
* Called at runtime by VirtualFieldsBackendService with injected utilities
|
|
2322
|
+
* The calculation function that computes this virtual field's value for ONE row.
|
|
2323
|
+
* Called at runtime by VirtualFieldsBackendService with injected utilities: on a READ, and on a list row when the
|
|
2324
|
+
* field declares no {@link calculateMany}.
|
|
2199
2325
|
*/
|
|
2200
2326
|
calculate: (params: VirtualFieldCalculationParams<TObject>) => TResult | Promise<TResult>;
|
|
2327
|
+
/**
|
|
2328
|
+
* The BATCHED form: computes the field for every row of a list in ONE call (#2631). Declare it when the field reads
|
|
2329
|
+
* another resource, so a page of N rows reads that resource once (one query over the rows' keys) instead of N times.
|
|
2330
|
+
*
|
|
2331
|
+
* - Return one value per row, in the same order: an array exactly as long as `currentObjects`. Any other length is
|
|
2332
|
+
* treated as a failure of the whole batch, like a throw.
|
|
2333
|
+
* - A failing batch gives every row `undefined` when the computation is fault-tolerant (the list default) and throws
|
|
2334
|
+
* otherwise, exactly as a failing `calculate` does for its one row.
|
|
2335
|
+
* - Used wherever several rows are computed together: a LIST or SEARCH page, and a relationship's children in a
|
|
2336
|
+
* resource context. One row (a READ) still goes through `calculate`, so the two must give the same value for the same row:
|
|
2337
|
+
* write the derivation once and call it from both.
|
|
2338
|
+
* - Ignored for a field that declares `needsObjectContext` or `needsUserContext`: those contexts are resolved per
|
|
2339
|
+
* row, so such a field is computed by `calculate` alone.
|
|
2340
|
+
*
|
|
2341
|
+
* @example
|
|
2342
|
+
* ```ts
|
|
2343
|
+
* tenantStatus: z.string().optional().isVirtual({
|
|
2344
|
+
* dependencies: ['organizationId'],
|
|
2345
|
+
* calculate: async ({ currentObject, utils }) => (await statusesOf(utils, [currentObject.organizationId])).get(currentObject.organizationId),
|
|
2346
|
+
* calculateMany: async ({ currentObjects, utils }) => {
|
|
2347
|
+
* const statuses = await statusesOf(utils, currentObjects.map((row) => row.organizationId));
|
|
2348
|
+
* return currentObjects.map((row) => statuses.get(row.organizationId));
|
|
2349
|
+
* },
|
|
2350
|
+
* }),
|
|
2351
|
+
* ```
|
|
2352
|
+
*/
|
|
2353
|
+
calculateMany?: (params: VirtualFieldBatchCalculationParams<TObject>) => readonly TResult[] | Promise<readonly TResult[]>;
|
|
2201
2354
|
/**
|
|
2202
2355
|
* If true, the objectContext (parent/child relationships) will be passed to calculate().
|
|
2203
2356
|
* Setting this to true has a performance cost as it requires fetching related resources.
|
|
@@ -2209,8 +2362,8 @@ export interface VirtualFieldParams<TObject = any, TResult = any> {
|
|
|
2209
2362
|
*/
|
|
2210
2363
|
needsUserContext?: boolean;
|
|
2211
2364
|
/**
|
|
2212
|
-
*
|
|
2213
|
-
*
|
|
2365
|
+
* The stored fields this virtual field reads from its row. The repository adds them to the read projection, so
|
|
2366
|
+
* `calculate` / `calculateMany` receive them even on a SUMMARY row where they are not themselves summary fields.
|
|
2214
2367
|
*/
|
|
2215
2368
|
dependencies?: string[];
|
|
2216
2369
|
}
|
|
@@ -2266,8 +2419,14 @@ export interface UniqueFieldParams {
|
|
|
2266
2419
|
*/
|
|
2267
2420
|
compoundWith?: string;
|
|
2268
2421
|
/**
|
|
2269
|
-
* Whether
|
|
2270
|
-
*
|
|
2422
|
+
* Whether a row WITHOUT a value (the field absent or `null`) is left out of the uniqueness, so any number of such rows
|
|
2423
|
+
* may coexist. PostgreSQL plans it as a unique constraint whose NULLs are distinct. MongoDB builds it as a partial
|
|
2424
|
+
* filter that bounds the field from below in its own type (`{ field: { $gte: '' } }` for a string), which leaves out a
|
|
2425
|
+
* null as well as a missing value (#2582): MongoDB's own `sparse: true` would still index a stored null. The one
|
|
2426
|
+
* exception is a field whose type has no lowest value (an array, a free-form value), whose filter is
|
|
2427
|
+
* `{ $exists: true }` and so indexes a stored null.
|
|
2428
|
+
*
|
|
2429
|
+
* `false` makes rows without a value collide with each other on both stores (`NULLS NOT DISTINCT` on PostgreSQL).
|
|
2271
2430
|
* @default true
|
|
2272
2431
|
*/
|
|
2273
2432
|
sparse?: boolean;
|
|
@@ -2337,6 +2496,29 @@ export interface BusinessKeySetParams {
|
|
|
2337
2496
|
*/
|
|
2338
2497
|
conflictMessageReference?: string;
|
|
2339
2498
|
}
|
|
2499
|
+
/**
|
|
2500
|
+
* Parameters for the object-level `isResourceReference({ targetSet })` decorator (#2471).
|
|
2501
|
+
*
|
|
2502
|
+
* The decorated object names ONE row of a resource whose type is not fixed: its `resourceType` member is the
|
|
2503
|
+
* resource's name and its `resourceId` member the row's id. Unlike `.isForeignKey()` it declares no relationship
|
|
2504
|
+
* and changes nothing about storage: the two members stay plain strings, and the referenced resource is only
|
|
2505
|
+
* known at run time. It is what lets a form offer the resource types first and then the rows of the chosen one.
|
|
2506
|
+
*
|
|
2507
|
+
* `targetSet` names WHICH resource types the reference may name. It is a member of a vocabulary owned by the
|
|
2508
|
+
* layer that knows the types (`ResourceReferenceTargetSet` in `@wildo-ai/saas-models`), and the backend publishes
|
|
2509
|
+
* each set's members on `/application-config` (`resourceReferenceTargets`), derived from what the application
|
|
2510
|
+
* declares. A string here because this package sits below that vocabulary, as `dataCategories` does.
|
|
2511
|
+
*
|
|
2512
|
+
* The server stays the control: a reference is accepted only where the service that owns the field admits it.
|
|
2513
|
+
*
|
|
2514
|
+
* @example
|
|
2515
|
+
* export const WorkUnitRefSchema = z.strictObject({ resourceType: z.string(), resourceId: z.string() })
|
|
2516
|
+
* .isResourceReference({ targetSet: ResourceReferenceTargetSet.WORK_UNIT_CASES });
|
|
2517
|
+
*/
|
|
2518
|
+
export interface ResourceReferenceParams {
|
|
2519
|
+
/** The set of resource types the reference may name. */
|
|
2520
|
+
targetSet: string;
|
|
2521
|
+
}
|
|
2340
2522
|
/** @wildo_source:part:end zod.decorators.shared-structural-params */
|
|
2341
2523
|
/**
|
|
2342
2524
|
* @wildo_source:part:start zod.decorators.shared-structural-params facet:layer:shared facet:family:decorator facet:family:param-surface
|
|
@@ -2355,7 +2537,7 @@ export interface BusinessKeySetParams {
|
|
|
2355
2537
|
* enforced on both. Do NOT read the MongoDB index as the mechanism and conclude the declaration is
|
|
2356
2538
|
* inert elsewhere.
|
|
2357
2539
|
*
|
|
2358
|
-
*
|
|
2540
|
+
* Consequences worth knowing before you declare one:
|
|
2359
2541
|
* - the sweep is deliberately bounded per run, so a table receiving rows faster than they expire
|
|
2360
2542
|
* stays above its target until the rate changes; it reports when it stops early;
|
|
2361
2543
|
* - a resource CANNOT declare both a lifetime and retrieval-source fields (`.ragSource()`). That
|
|
@@ -2364,7 +2546,16 @@ export interface BusinessKeySetParams {
|
|
|
2364
2546
|
* - a resource scoped to an ORGANIZATION cannot declare a lifetime at all. For the same reason
|
|
2365
2547
|
* no legal hold could suspend the deletion, and a hold on an organization covers every row of
|
|
2366
2548
|
* it. A lifetime is for application-level plumbing; tenant data binds a retention class
|
|
2367
|
-
* (`retentionBinding`), whose sweep deletes through the service layer and skips held rows
|
|
2549
|
+
* (`retentionBinding`), whose sweep deletes through the service layer and skips held rows;
|
|
2550
|
+
* - a resource that another resource's ENABLED `onParentDelete` edge points at cannot declare a lifetime, whatever the
|
|
2551
|
+
* strategy (DELETE, IMPERSONALIZE_AND_RETAIN, REFUSE_WHILE_CHILDREN_EXIST) or mode (IMMEDIATE, LAZY). It is refused at startup: an expired
|
|
2552
|
+
* row leaves with none of its lifecycle running, so its children would outlive it, keep their personal data, or be
|
|
2553
|
+
* walked past. Bind a retention class instead; its sweep deletes through the service layer, which runs the edges;
|
|
2554
|
+
* - the field must be a TOP-LEVEL field of the main schema (always an object) or of an inheritance level: a lifetime on
|
|
2555
|
+
* a nested field is refused, since every guard above reads top-level fields while MongoDB would expire rows by the
|
|
2556
|
+
* nested path natively. An inheritance variant MAY give its rows their own lifetime, on a field only it declares;
|
|
2557
|
+
* one field has one lifetime, so a field declared with a `.ttl()` in one schema and differently in another (another
|
|
2558
|
+
* window, or none) is refused (MongoDB keeps one TTL index per path).
|
|
2368
2559
|
*
|
|
2369
2560
|
* This is unrelated to `retentionPolicy`, which decides what an ERASURE does to a row that must
|
|
2370
2561
|
* SURVIVE. This one decides whether the row lives at all.
|
|
@@ -2435,7 +2626,7 @@ export interface SummaryFieldParams {
|
|
|
2435
2626
|
* // Field definition:
|
|
2436
2627
|
* userId: z.string().isForeignKey().isSummaryField({ populate: true })
|
|
2437
2628
|
*
|
|
2438
|
-
* // LIST
|
|
2629
|
+
* // A LIST or SEARCH response will include:
|
|
2439
2630
|
* {
|
|
2440
2631
|
* _id: "123",
|
|
2441
2632
|
* userId: "user-456",
|
|
@@ -2666,9 +2857,9 @@ export interface PrimitiveUIBaseDisplayParams {
|
|
|
2666
2857
|
tooltip?: boolean;
|
|
2667
2858
|
/**
|
|
2668
2859
|
* When `true`, the field is omitted entirely from the DISPLAY (read) surface
|
|
2669
|
-
* whenever its value is empty — null, undefined,
|
|
2670
|
-
*
|
|
2671
|
-
* just the value.
|
|
2860
|
+
* whenever its value is empty — null, undefined, a blank string, an empty array or
|
|
2861
|
+
* an empty plain object. `false` and `0` are answers, never empty, and so is a date.
|
|
2862
|
+
* The whole row (label + chrome + em-dash placeholder) is removed, not just the value.
|
|
2672
2863
|
*
|
|
2673
2864
|
* DISPLAY-ONLY: the edit form always renders the field so an empty value can
|
|
2674
2865
|
* still be filled in. This is the field-level counterpart to the section-level
|
|
@@ -2676,9 +2867,21 @@ export interface PrimitiveUIBaseDisplayParams {
|
|
|
2676
2867
|
* `AutoEmptyValue.HIDDEN` — use it to keep optional metadata (a job title, a
|
|
2677
2868
|
* secondary contact) from cluttering a read view when unset.
|
|
2678
2869
|
*
|
|
2870
|
+
* UNSET means `true` inside a `<FieldTiles>` host (a record's facts — an empty tile
|
|
2871
|
+
* is clutter there, and the generated read view uses the host when the layout
|
|
2872
|
+
* declares no `defaultChromeMode.display`) and `false` everywhere else. So a field
|
|
2873
|
+
* whose emptiness is itself worth seeing on a record ("this contact has no email")
|
|
2874
|
+
* declares `hideWhenEmpty: false` explicitly. A field the reader can edit IN PLACE
|
|
2875
|
+
* keeps its empty tile without saying so — hiding it would remove the only way to
|
|
2876
|
+
* fill it there. And the default reaches only the fields placed in the host: the
|
|
2877
|
+
* items of a list and the members of an object a tile shows are its content, not
|
|
2878
|
+
* facts of the grid, and follow their own decorators.
|
|
2879
|
+
*
|
|
2679
2880
|
* @example
|
|
2680
2881
|
* // Hide the "Title" row on the profile read view until the user sets one:
|
|
2681
2882
|
* schemaShape.title.stringUI({ display: { hideWhenEmpty: true } })
|
|
2883
|
+
* // Keep an empty email visible as a tile — the gap is the information:
|
|
2884
|
+
* schemaShape.email.stringUI({ display: { hideWhenEmpty: false } })
|
|
2682
2885
|
*/
|
|
2683
2886
|
hideWhenEmpty?: boolean;
|
|
2684
2887
|
/**
|
|
@@ -2812,6 +3015,8 @@ export interface StringUIEditParams extends PrimitiveUIBaseEditParams {
|
|
|
2812
3015
|
editMode?: StringEditMode;
|
|
2813
3016
|
/** Number of rows for TEXTAREA editMode. */
|
|
2814
3017
|
textareaRows?: number;
|
|
3018
|
+
/** ORGANIZATION_ROLE editMode: whose role table the picker reads. Default `CURRENT_ORGANIZATION`. See {@link OrganizationRoleTable}. */
|
|
3019
|
+
organizationRoleTable?: OrganizationRoleTable;
|
|
2815
3020
|
}
|
|
2816
3021
|
export interface StringUIParams {
|
|
2817
3022
|
display?: StringUIDisplayParams;
|
|
@@ -2848,7 +3053,7 @@ export interface NumberUIParams {
|
|
|
2848
3053
|
edit?: NumberUIEditParams;
|
|
2849
3054
|
}
|
|
2850
3055
|
export interface EnumUIDisplayParams extends PrimitiveUIBaseDisplayParams {
|
|
2851
|
-
/** Display renderer
|
|
3056
|
+
/** Display renderer — one of {@link EnumDisplayMode}, whose members each say when they are the right one. */
|
|
2852
3057
|
displayMode?: EnumDisplayMode;
|
|
2853
3058
|
}
|
|
2854
3059
|
export interface EnumUIEditParams extends PrimitiveUIBaseEditParams {
|
|
@@ -3103,12 +3308,15 @@ export interface ForeignKeyUIParams {
|
|
|
3103
3308
|
edit?: ForeignKeyUIEditParams;
|
|
3104
3309
|
}
|
|
3105
3310
|
/**
|
|
3106
|
-
*
|
|
3311
|
+
* How each item of an array's display announces itself as one of several: bare lines, bullets, a rule
|
|
3312
|
+
* between object entries, or a wrapping row of chips. The members apply to different entries (primitive
|
|
3313
|
+
* lines, object entries, strings), which each member's own line states.
|
|
3107
3314
|
*
|
|
3108
|
-
* Its own enum rather than a new `DisplayDirection` member on purpose: direction answers "which
|
|
3109
|
-
*
|
|
3110
|
-
*
|
|
3111
|
-
*
|
|
3315
|
+
* Its own enum rather than a new `DisplayDirection` member on purpose: direction answers "which axis do
|
|
3316
|
+
* items flow on", list style answers "how is each item set apart" — merging them would make
|
|
3317
|
+
* `BULLETS × horizontal` an unrepresentable-but-meaningful combination and overload an enum that
|
|
3318
|
+
* alignment code also reads. The one member that decides the flow itself is CHIPS: chips always wrap on
|
|
3319
|
+
* a line, so it ignores `displayMode`.
|
|
3112
3320
|
*/
|
|
3113
3321
|
export declare enum ArrayListStyle {
|
|
3114
3322
|
/** Bare stacked values — the historical default. */
|
|
@@ -3124,7 +3332,17 @@ export declare enum ArrayListStyle {
|
|
|
3124
3332
|
* bounded region, a card per entry is a third frame around content that has two. Unlike
|
|
3125
3333
|
* {@link ArrayListStyle.BULLETS}, which is for primitive lines, this is for entries.
|
|
3126
3334
|
*/
|
|
3127
|
-
SEPARATED = "separated"
|
|
3335
|
+
SEPARATED = "separated",
|
|
3336
|
+
/**
|
|
3337
|
+
* Each entry a small neutral chip, the chips wrapping on one line — the shape of TAGS, labels and
|
|
3338
|
+
* keywords: short, unordered, read as a set.
|
|
3339
|
+
*
|
|
3340
|
+
* Applies to STRING entries. A list of enum values already renders each value in its own display
|
|
3341
|
+
* mode (a badge, a dot), so a chip around it would be a frame around a frame; any other entry type
|
|
3342
|
+
* falls back to the horizontal flow. Without it, two tags under `SEPARATED` stacked one above the
|
|
3343
|
+
* other at the right edge of a settings row, 81px tall for two words.
|
|
3344
|
+
*/
|
|
3345
|
+
CHIPS = "chips"
|
|
3128
3346
|
}
|
|
3129
3347
|
export interface ArrayUIDisplayParams extends PrimitiveUIBaseDisplayParams {
|
|
3130
3348
|
/** Direction for rendering items in display context. */
|
|
@@ -3132,9 +3350,10 @@ export interface ArrayUIDisplayParams extends PrimitiveUIBaseDisplayParams {
|
|
|
3132
3350
|
/** Max items shown in display (rest truncated). */
|
|
3133
3351
|
maxItems?: number;
|
|
3134
3352
|
/**
|
|
3135
|
-
*
|
|
3136
|
-
*
|
|
3137
|
-
*
|
|
3353
|
+
* How each item announces itself as one of several (see {@link ArrayListStyle}, whose members each
|
|
3354
|
+
* state the entries they apply to): PLAIN and BULLETS mark primitive lines, SEPARATED rules object
|
|
3355
|
+
* entries, CHIPS renders string entries as a wrapping row of chips and so decides the flow itself.
|
|
3356
|
+
* The line markers have no effect on horizontal flow, where there is no line to anchor to.
|
|
3138
3357
|
*/
|
|
3139
3358
|
listStyle?: ArrayListStyle;
|
|
3140
3359
|
}
|
|
@@ -3549,6 +3768,11 @@ export declare enum ZodDecorator {
|
|
|
3549
3768
|
* WHETHER each value is a real `PersonalDataCategory` member is checked by the resource factory's
|
|
3550
3769
|
* boot guard, which owns the enum — this layer knows only that non-empty strings were declared.
|
|
3551
3770
|
*
|
|
3771
|
+
* An optional second argument, `{ personalOnlyWhen }` ({@link DataCategoriesOptions}), says the
|
|
3772
|
+
* field is personal data only under a `PersonalDataCondition` — the field naming a customer
|
|
3773
|
+
* organization, which is a person's data only when that customer is a sole trader (#2119). The
|
|
3774
|
+
* field still counts as personal for every guard; only the privacy notice words it conditionally.
|
|
3775
|
+
*
|
|
3552
3776
|
* ⚠️ Four adjacent axes, none of them this one. {@link ZodDecorator.IMPERSONALIZE_WITH} says what
|
|
3553
3777
|
* happens to the value on ERASURE; {@link ZodDecorator.PORTABILITY_PROVENANCE} says where it CAME
|
|
3554
3778
|
* FROM; `Compliance_DataClassification` is a SENSITIVITY ladder for flows-actors config; a
|
|
@@ -3594,6 +3818,35 @@ export declare enum ZodDecorator {
|
|
|
3594
3818
|
* assurance-control: WILDO.SECRETS.DISCLOSURE_AUDIT
|
|
3595
3819
|
*/
|
|
3596
3820
|
IS_AUDIT_EVIDENCE = "isAuditEvidence",
|
|
3821
|
+
/**
|
|
3822
|
+
* Last-action record: this field holds what the MOST RECENT action on the row said about ITSELF — the
|
|
3823
|
+
* reason a person gave for a decision, the justification typed for a reassignment — not state the next
|
|
3824
|
+
* action starts from.
|
|
3825
|
+
*
|
|
3826
|
+
* Authored fluently on the ROW schema: `decisionReason: z.string().optional().isLastActionRecord()`. A pure
|
|
3827
|
+
* marker. Read it back with `isLastActionRecordField(schema)`.
|
|
3828
|
+
*
|
|
3829
|
+
* What it changes: a form that starts from the row (an update-like verb's form starts from the record it
|
|
3830
|
+
* acts on, so "Set disclosure" opens on the current disclosure) never offers this field's value as the
|
|
3831
|
+
* starting value of the next action. Without it, a verb whose request names the same field opened with the
|
|
3832
|
+
* previous decision's words already typed in: "Suspend" prefilled with the reason an acceptance was given,
|
|
3833
|
+
* which a person who submits without reading records as the reason for the suspension (#2192).
|
|
3834
|
+
*
|
|
3835
|
+
* Mark a field when an action REPLACES it with words about that action. Do not mark a setting an action
|
|
3836
|
+
* edits from its current value (a disclosure level, a list of admitted agents): starting from the current
|
|
3837
|
+
* value is what makes such a form safe to submit.
|
|
3838
|
+
*/
|
|
3839
|
+
IS_LAST_ACTION_RECORD = "isLastActionRecord",
|
|
3840
|
+
/**
|
|
3841
|
+
* Decider: this field records WHICH PERSON decided something on the row: who approved, accepted, placed or released
|
|
3842
|
+
* (`decidedByUserId`, `acceptedByUserId`, `placedByUserId`). A pure marker, read back with `isDeciderField(schema)`.
|
|
3843
|
+
*
|
|
3844
|
+
* What it changes: a decider field records a person's decision, so the declaration of a verb that writes it names it
|
|
3845
|
+
* (`approvalSeal.decides`, CAPTURED or NONE with a reason, #2906). The engine's source check, a test over the
|
|
3846
|
+
* engine's own resources, refuses a decider field no declaration names and flags a field NAMED like a decider that is
|
|
3847
|
+
* not marked. No check runs over an application's resources yet: there the marker documents the field.
|
|
3848
|
+
*/
|
|
3849
|
+
IS_DECIDER = "isDecider",
|
|
3597
3850
|
/**
|
|
3598
3851
|
* RAG source: this field's TEXT is a retrieval-corpus source. The framework chunks the value
|
|
3599
3852
|
* (extracting text first for file fields), stores the chunks in the application's OWN datastore
|
|
@@ -3664,6 +3917,11 @@ export declare enum ZodDecorator {
|
|
|
3664
3917
|
* (single field vs composite). Mixing is rejected at decoration time.
|
|
3665
3918
|
*/
|
|
3666
3919
|
OBJECT_BUSINESS_KEY_SET = "businessKeySet",
|
|
3920
|
+
/**
|
|
3921
|
+
* Object-level: the object (`{ resourceType, resourceId }`) names one row of a resource whose type is chosen at
|
|
3922
|
+
* run time from a published target set. See {@link ResourceReferenceParams}.
|
|
3923
|
+
*/
|
|
3924
|
+
RESOURCE_REFERENCE = "isResourceReference",
|
|
3667
3925
|
TTL = "ttl",
|
|
3668
3926
|
IS_PASSWORD = "isPassword",
|
|
3669
3927
|
IS_OTP = "isOtp",
|
|
@@ -3678,6 +3936,23 @@ export declare enum ZodDecorator {
|
|
|
3678
3936
|
NUMBER_UI = "numberUI",
|
|
3679
3937
|
ENUM_UI = "enumUI",
|
|
3680
3938
|
DATE_UI = "dateUI",
|
|
3939
|
+
/**
|
|
3940
|
+
* A `Date` field that holds a CALENDAR DAY — a due date, a birthday, an invoice date — rather than an
|
|
3941
|
+
* instant. Declared with `z.date().isCalendarDate()`; read with `isCalendarDateSchema()`.
|
|
3942
|
+
*
|
|
3943
|
+
* A JavaScript `Date` is an instant, and an instant falls on different days in different time zones: a due
|
|
3944
|
+
* date picked as 3 Oct in Paris, stored as that browser's midnight, read 2 Oct in New York. A calendar day
|
|
3945
|
+
* has no zone. So a calendar date is held as UTC MIDNIGHT of its day, every reader sees that same day, and
|
|
3946
|
+
* the picker writes and reads the day itself. "Tomorrow" still means tomorrow in the READER's zone.
|
|
3947
|
+
*
|
|
3948
|
+
* Undeclared, a `Date` stays an instant (`createdAt`, `expiresAt`, `completedAt`…), shown in the reader's
|
|
3949
|
+
* configured time zone. A date RANGE (`z_range('date')`) is a range of calendar days without declaring it.
|
|
3950
|
+
*
|
|
3951
|
+
* It cannot be combined with `dateTimeUI()`, which declares a moment with a time of day: applying the second of
|
|
3952
|
+
* the two throws. "Today" for a calendar day, in its relative words, its picker, a new item's default and a
|
|
3953
|
+
* preset filter window alike, is today in the reader's resolved time zone.
|
|
3954
|
+
*/
|
|
3955
|
+
IS_CALENDAR_DATE = "isCalendarDate",
|
|
3681
3956
|
DATETIME_UI = "dateTimeUI",
|
|
3682
3957
|
TIME_UI = "timeUI",
|
|
3683
3958
|
MONEY_UI = "moneyUI",
|
|
@@ -3732,10 +4007,14 @@ export type ZodDecorator_ParamsType = {
|
|
|
3732
4007
|
/**
|
|
3733
4008
|
* The field's personal-data categories — `PersonalDataCategory` values, typed as plain strings at
|
|
3734
4009
|
* this layer (zod-decorators sits below saas-models and cannot import the enum). Accepts a single
|
|
3735
|
-
* value (the common case) or an array
|
|
4010
|
+
* value (the common case) or an array, or the full {@link DataCategoriesFieldParams} object when
|
|
4011
|
+
* the fluent method's `options` argument was given; the chokepoint normalizes all three to that
|
|
4012
|
+
* object.
|
|
3736
4013
|
*/
|
|
3737
|
-
[ZodDecorator.DATA_CATEGORIES]: string | readonly string[];
|
|
4014
|
+
[ZodDecorator.DATA_CATEGORIES]: string | readonly string[] | DataCategoriesFieldParams;
|
|
3738
4015
|
[ZodDecorator.IS_AUDIT_EVIDENCE]: undefined;
|
|
4016
|
+
[ZodDecorator.IS_LAST_ACTION_RECORD]: undefined;
|
|
4017
|
+
[ZodDecorator.IS_DECIDER]: undefined;
|
|
3739
4018
|
/**
|
|
3740
4019
|
* RAG-source declaration. The config object is optional — `.ragSource()` with no argument is a
|
|
3741
4020
|
* complete declaration — and the chokepoint normalizes an omitted config to `{}` so every reader
|
|
@@ -3751,6 +4030,7 @@ export type ZodDecorator_ParamsType = {
|
|
|
3751
4030
|
[ZodDecorator.IS_BUSINESS_KEY]: undefined;
|
|
3752
4031
|
[ZodDecorator.DOCUMENT_SEQUENCE]: DocumentSequenceParams;
|
|
3753
4032
|
[ZodDecorator.OBJECT_BUSINESS_KEY_SET]: BusinessKeySetParams | DecoratorUpdater<BusinessKeySetParams>;
|
|
4033
|
+
[ZodDecorator.RESOURCE_REFERENCE]: ResourceReferenceParams;
|
|
3754
4034
|
[ZodDecorator.TTL]: TtlFieldParams | DecoratorUpdater<TtlFieldParams>;
|
|
3755
4035
|
[ZodDecorator.IS_PASSWORD]: undefined;
|
|
3756
4036
|
[ZodDecorator.IS_OTP]: OtpFieldParams | DecoratorUpdater<OtpFieldParams> | undefined;
|
|
@@ -3765,6 +4045,7 @@ export type ZodDecorator_ParamsType = {
|
|
|
3765
4045
|
[ZodDecorator.NUMBER_UI]: NumberUIParams | DecoratorUpdater<NumberUIParams> | undefined;
|
|
3766
4046
|
[ZodDecorator.ENUM_UI]: EnumUIParams | DecoratorUpdater<EnumUIParams> | undefined;
|
|
3767
4047
|
[ZodDecorator.DATE_UI]: DateUIParams | DecoratorUpdater<DateUIParams> | undefined;
|
|
4048
|
+
[ZodDecorator.IS_CALENDAR_DATE]: undefined;
|
|
3768
4049
|
[ZodDecorator.DATETIME_UI]: DateTimeUIParams | DecoratorUpdater<DateTimeUIParams> | undefined;
|
|
3769
4050
|
[ZodDecorator.TIME_UI]: TimeUIParams | DecoratorUpdater<TimeUIParams> | undefined;
|
|
3770
4051
|
[ZodDecorator.MONEY_UI]: MoneyUIParams | DecoratorUpdater<MoneyUIParams> | undefined;
|
|
@@ -3811,12 +4092,16 @@ export type ZodDecorator_Types = {
|
|
|
3811
4092
|
* rejects blanks. */
|
|
3812
4093
|
[ZodDecorator.PORTABILITY_PROVENANCE]: string;
|
|
3813
4094
|
/** Personal-data categories — `PersonalDataCategory` values carried as opaque `string`s
|
|
3814
|
-
* (zod-decorators sits below saas-models)
|
|
3815
|
-
* the
|
|
3816
|
-
*
|
|
3817
|
-
|
|
4095
|
+
* (zod-decorators sits below saas-models), plus the optional `personalOnlyWhen` condition (#2119).
|
|
4096
|
+
* ALWAYS the normalized object, its `categories` deduped and non-empty: the chokepoint widens the
|
|
4097
|
+
* bare-value and array authoring forms on the way in, so every reader sees one shape and
|
|
4098
|
+
* `getDataCategories` can answer "is this field categorized?" by presence alone. */
|
|
4099
|
+
[ZodDecorator.DATA_CATEGORIES]: DataCategoriesFieldParams;
|
|
3818
4100
|
/** Audit-evidence marker — stored as the bare `true` sentinel (parameterless, like IS_BUSINESS_KEY). */
|
|
3819
4101
|
[ZodDecorator.IS_AUDIT_EVIDENCE]: true;
|
|
4102
|
+
/** Last-action-record marker — stored as the bare `true` sentinel (parameterless, like IS_AUDIT_EVIDENCE). */
|
|
4103
|
+
[ZodDecorator.IS_LAST_ACTION_RECORD]: true;
|
|
4104
|
+
[ZodDecorator.IS_DECIDER]: true;
|
|
3820
4105
|
/** RAG-source config — ALWAYS the normalized object ( `{}` when authored with no argument): the
|
|
3821
4106
|
* chokepoint validates and normalizes on the way in, so every reader sees one shape and
|
|
3822
4107
|
* `getRagSourceConfig` can answer "is this field a source?" by presence alone. */
|
|
@@ -3830,6 +4115,7 @@ export type ZodDecorator_Types = {
|
|
|
3830
4115
|
[ZodDecorator.IS_BUSINESS_KEY]: true;
|
|
3831
4116
|
[ZodDecorator.DOCUMENT_SEQUENCE]: DocumentSequenceParams;
|
|
3832
4117
|
[ZodDecorator.OBJECT_BUSINESS_KEY_SET]: BusinessKeySetParams;
|
|
4118
|
+
[ZodDecorator.RESOURCE_REFERENCE]: ResourceReferenceParams;
|
|
3833
4119
|
[ZodDecorator.TTL]: TtlFieldParams;
|
|
3834
4120
|
[ZodDecorator.IS_PASSWORD]: true;
|
|
3835
4121
|
[ZodDecorator.IS_OTP]: OtpFieldParams | true;
|
|
@@ -3844,6 +4130,7 @@ export type ZodDecorator_Types = {
|
|
|
3844
4130
|
[ZodDecorator.NUMBER_UI]: NumberUIParams;
|
|
3845
4131
|
[ZodDecorator.ENUM_UI]: EnumUIParams;
|
|
3846
4132
|
[ZodDecorator.DATE_UI]: DateUIParams;
|
|
4133
|
+
[ZodDecorator.IS_CALENDAR_DATE]: true;
|
|
3847
4134
|
[ZodDecorator.DATETIME_UI]: DateTimeUIParams;
|
|
3848
4135
|
[ZodDecorator.TIME_UI]: TimeUIParams;
|
|
3849
4136
|
[ZodDecorator.MONEY_UI]: MoneyUIParams;
|
|
@@ -3890,6 +4177,8 @@ export interface CustomFieldMetadata {
|
|
|
3890
4177
|
[ZodDecorator.PORTABILITY_PROVENANCE]?: ZodDecorator_Types[ZodDecorator.PORTABILITY_PROVENANCE];
|
|
3891
4178
|
[ZodDecorator.DATA_CATEGORIES]?: ZodDecorator_Types[ZodDecorator.DATA_CATEGORIES];
|
|
3892
4179
|
[ZodDecorator.IS_AUDIT_EVIDENCE]?: ZodDecorator_Types[ZodDecorator.IS_AUDIT_EVIDENCE];
|
|
4180
|
+
[ZodDecorator.IS_LAST_ACTION_RECORD]?: ZodDecorator_Types[ZodDecorator.IS_LAST_ACTION_RECORD];
|
|
4181
|
+
[ZodDecorator.IS_DECIDER]?: ZodDecorator_Types[ZodDecorator.IS_DECIDER];
|
|
3893
4182
|
[ZodDecorator.RAG_SOURCE]?: ZodDecorator_Types[ZodDecorator.RAG_SOURCE];
|
|
3894
4183
|
[ZodDecorator.IS_VIRTUAL]?: ZodDecorator_Types[ZodDecorator.IS_VIRTUAL];
|
|
3895
4184
|
[ZodDecorator.IS_DISCRIMINATOR]?: ZodDecorator_Types[ZodDecorator.IS_DISCRIMINATOR];
|
|
@@ -3900,6 +4189,7 @@ export interface CustomFieldMetadata {
|
|
|
3900
4189
|
[ZodDecorator.IS_BUSINESS_KEY]?: ZodDecorator_Types[ZodDecorator.IS_BUSINESS_KEY];
|
|
3901
4190
|
[ZodDecorator.DOCUMENT_SEQUENCE]?: ZodDecorator_Types[ZodDecorator.DOCUMENT_SEQUENCE];
|
|
3902
4191
|
[ZodDecorator.OBJECT_BUSINESS_KEY_SET]?: ZodDecorator_Types[ZodDecorator.OBJECT_BUSINESS_KEY_SET];
|
|
4192
|
+
[ZodDecorator.RESOURCE_REFERENCE]?: ZodDecorator_Types[ZodDecorator.RESOURCE_REFERENCE];
|
|
3903
4193
|
[ZodDecorator.TTL]?: ZodDecorator_Types[ZodDecorator.TTL];
|
|
3904
4194
|
[ZodDecorator.IS_PASSWORD]?: ZodDecorator_Types[ZodDecorator.IS_PASSWORD];
|
|
3905
4195
|
[ZodDecorator.IS_OTP]?: ZodDecorator_Types[ZodDecorator.IS_OTP];
|
|
@@ -3914,6 +4204,7 @@ export interface CustomFieldMetadata {
|
|
|
3914
4204
|
[ZodDecorator.NUMBER_UI]?: ZodDecorator_Types[ZodDecorator.NUMBER_UI];
|
|
3915
4205
|
[ZodDecorator.ENUM_UI]?: ZodDecorator_Types[ZodDecorator.ENUM_UI];
|
|
3916
4206
|
[ZodDecorator.DATE_UI]?: ZodDecorator_Types[ZodDecorator.DATE_UI];
|
|
4207
|
+
[ZodDecorator.IS_CALENDAR_DATE]?: ZodDecorator_Types[ZodDecorator.IS_CALENDAR_DATE];
|
|
3917
4208
|
[ZodDecorator.DATETIME_UI]?: ZodDecorator_Types[ZodDecorator.DATETIME_UI];
|
|
3918
4209
|
[ZodDecorator.TIME_UI]?: ZodDecorator_Types[ZodDecorator.TIME_UI];
|
|
3919
4210
|
[ZodDecorator.MONEY_UI]?: ZodDecorator_Types[ZodDecorator.MONEY_UI];
|