@wildo-ai/zod-decorators 1.0.1 → 1.1.0

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 (98) hide show
  1. package/LICENSE +34 -0
  2. package/dist/esm/.builder.pid +9 -0
  3. package/dist/esm/__mocks__/mime.d.ts.map +1 -1
  4. package/dist/esm/__mocks__/mime.js +1 -1
  5. package/dist/esm/__mocks__/mime.js.map +1 -1
  6. package/dist/esm/commons.d.ts.map +1 -1
  7. package/dist/esm/commons.js +1 -1
  8. package/dist/esm/commons.js.map +1 -1
  9. package/dist/esm/companion-exports.d.ts +8 -0
  10. package/dist/esm/companion-exports.d.ts.map +1 -0
  11. package/dist/esm/companion-exports.js +8 -0
  12. package/dist/esm/companion-exports.js.map +1 -0
  13. package/dist/esm/currencies.shared.schemas.d.ts.map +1 -1
  14. package/dist/esm/currencies.shared.schemas.js +1 -1
  15. package/dist/esm/currencies.shared.schemas.js.map +1 -1
  16. package/dist/esm/files/agent-file-formats.d.ts.map +1 -1
  17. package/dist/esm/files/agent-file-formats.js +1 -1
  18. package/dist/esm/files/agent-file-formats.js.map +1 -1
  19. package/dist/esm/files/extension-nature-map.d.ts +1 -1
  20. package/dist/esm/files/extension-nature-map.d.ts.map +1 -1
  21. package/dist/esm/files/extension-nature-map.js +1 -1
  22. package/dist/esm/files/extension-nature-map.js.map +1 -1
  23. package/dist/esm/files/file-extensions.enum.d.ts.map +1 -1
  24. package/dist/esm/files/file-extensions.enum.js +1 -1
  25. package/dist/esm/files/file-extensions.enum.js.map +1 -1
  26. package/dist/esm/files/mime-registry.d.ts +1 -1
  27. package/dist/esm/files/mime-registry.d.ts.map +1 -1
  28. package/dist/esm/files/mime-registry.js +1 -1
  29. package/dist/esm/files/mime-registry.js.map +1 -1
  30. package/dist/esm/files/unified-registry.d.ts +1 -1
  31. package/dist/esm/files/unified-registry.d.ts.map +1 -1
  32. package/dist/esm/files/unified-registry.js +1 -1
  33. package/dist/esm/files/unified-registry.js.map +1 -1
  34. package/dist/esm/index.d.ts +20 -19
  35. package/dist/esm/index.d.ts.map +1 -1
  36. package/dist/esm/index.js +10 -1
  37. package/dist/esm/index.js.map +1 -1
  38. package/dist/esm/install-bigint-json-encoding.d.ts +80 -0
  39. package/dist/esm/install-bigint-json-encoding.d.ts.map +1 -0
  40. package/dist/esm/install-bigint-json-encoding.js +85 -0
  41. package/dist/esm/install-bigint-json-encoding.js.map +1 -0
  42. package/dist/esm/testing/decorated-test-schemas.d.ts +8 -8
  43. package/dist/esm/testing/decorated-test-schemas.d.ts.map +1 -1
  44. package/dist/esm/testing/decorated-test-schemas.js +1 -1
  45. package/dist/esm/testing/decorated-test-schemas.js.map +1 -1
  46. package/dist/esm/testing.d.ts +1 -1
  47. package/dist/esm/testing.d.ts.map +1 -1
  48. package/dist/esm/testing.js +1 -1
  49. package/dist/esm/testing.js.map +1 -1
  50. package/dist/esm/zod-bigdecimal.d.ts +5 -1
  51. package/dist/esm/zod-bigdecimal.d.ts.map +1 -1
  52. package/dist/esm/zod-bigdecimal.js +4 -1
  53. package/dist/esm/zod-bigdecimal.js.map +1 -1
  54. package/dist/esm/zod-code.d.ts +4 -1
  55. package/dist/esm/zod-code.d.ts.map +1 -1
  56. package/dist/esm/zod-code.js +4 -1
  57. package/dist/esm/zod-code.js.map +1 -1
  58. package/dist/esm/zod-color.d.ts.map +1 -1
  59. package/dist/esm/zod-color.js +1 -1
  60. package/dist/esm/zod-color.js.map +1 -1
  61. package/dist/esm/zod-decorators.types.d.ts +1410 -56
  62. package/dist/esm/zod-decorators.types.d.ts.map +1 -1
  63. package/dist/esm/zod-decorators.types.js +662 -16
  64. package/dist/esm/zod-decorators.types.js.map +1 -1
  65. package/dist/esm/zod-duration.d.ts +8 -4
  66. package/dist/esm/zod-duration.d.ts.map +1 -1
  67. package/dist/esm/zod-duration.js +2 -1
  68. package/dist/esm/zod-duration.js.map +1 -1
  69. package/dist/esm/zod-file.d.ts +75 -14
  70. package/dist/esm/zod-file.d.ts.map +1 -1
  71. package/dist/esm/zod-file.js +151 -8
  72. package/dist/esm/zod-file.js.map +1 -1
  73. package/dist/esm/zod-money.d.ts +18 -3
  74. package/dist/esm/zod-money.d.ts.map +1 -1
  75. package/dist/esm/zod-money.js +4 -1
  76. package/dist/esm/zod-money.js.map +1 -1
  77. package/dist/esm/zod-phone.d.ts +37 -1
  78. package/dist/esm/zod-phone.d.ts.map +1 -1
  79. package/dist/esm/zod-phone.js +66 -5
  80. package/dist/esm/zod-phone.js.map +1 -1
  81. package/dist/esm/zod-range.d.ts +4 -1
  82. package/dist/esm/zod-range.d.ts.map +1 -1
  83. package/dist/esm/zod-range.js +4 -1
  84. package/dist/esm/zod-range.js.map +1 -1
  85. package/dist/esm/zod-utils.shared.d.ts +411 -6
  86. package/dist/esm/zod-utils.shared.d.ts.map +1 -1
  87. package/dist/esm/zod-utils.shared.js +624 -9
  88. package/dist/esm/zod-utils.shared.js.map +1 -1
  89. package/dist/esm/zod-versioned.d.ts +1 -1
  90. package/dist/esm/zod-versioned.d.ts.map +1 -1
  91. package/dist/esm/zod-versioned.js +1 -1
  92. package/dist/esm/zod-versioned.js.map +1 -1
  93. package/dist/esm/zod.module-override.d.ts +458 -68
  94. package/dist/esm/zod.module-override.d.ts.map +1 -1
  95. package/dist/esm/zod.module-override.js +1214 -195
  96. package/dist/esm/zod.module-override.js.map +1 -1
  97. package/dist/tsconfig.build.tsbuildinfo +1 -1
  98. package/package.json +20 -11
@@ -1,5 +1,15 @@
1
- // Symbol for storing metadata on Zod schemas. Uses Symbol.for() to ensure the same symbol is used across packages.
1
+ /**
2
+ * @wildo_source:part:start zod.decorators.schema-metadata
3
+ *
4
+ * Internal metadata key used by Wildo's schema decorators.
5
+ *
6
+ * Application schemas obtain this metadata by using the supported decorators
7
+ * and schema factories from `@wildo-ai/zod-decorators`; application code must
8
+ * not write this symbol directly. `Symbol.for()` keeps independently loaded
9
+ * package copies interoperable while the framework reads the schema contract.
10
+ */
2
11
  export const SCHEMA_METADATA = Symbol.for('schema_metadata');
12
+ /** @wildo_source:part:end zod.decorators.schema-metadata */
3
13
  // Schema type categories for component selection.
4
14
  // Represents the underlying Zod schema type detected from introspection.
5
15
  export var FieldSchemaType;
@@ -62,6 +72,86 @@ export var FormFieldComponent;
62
72
  FormFieldComponent["PHONE"] = "phone";
63
73
  })(FormFieldComponent || (FormFieldComponent = {}));
64
74
  // ================================
75
+ // HTML AUTOCOMPLETE TOKENS
76
+ // ================================
77
+ /**
78
+ * Official HTML autocomplete field identifiers.
79
+ * Excludes `section-*`, `on`, and `off` because the decorator contract here is
80
+ * focused on typed semantic field tokens rather than raw form-level switches.
81
+ */
82
+ export var AutocompleteFieldIdentifier;
83
+ (function (AutocompleteFieldIdentifier) {
84
+ AutocompleteFieldIdentifier["NAME"] = "name";
85
+ AutocompleteFieldIdentifier["HONORIFIC_PREFIX"] = "honorific-prefix";
86
+ AutocompleteFieldIdentifier["GIVEN_NAME"] = "given-name";
87
+ AutocompleteFieldIdentifier["ADDITIONAL_NAME"] = "additional-name";
88
+ AutocompleteFieldIdentifier["FAMILY_NAME"] = "family-name";
89
+ AutocompleteFieldIdentifier["HONORIFIC_SUFFIX"] = "honorific-suffix";
90
+ AutocompleteFieldIdentifier["NICKNAME"] = "nickname";
91
+ AutocompleteFieldIdentifier["USERNAME"] = "username";
92
+ AutocompleteFieldIdentifier["NEW_PASSWORD"] = "new-password";
93
+ AutocompleteFieldIdentifier["CURRENT_PASSWORD"] = "current-password";
94
+ AutocompleteFieldIdentifier["ONE_TIME_CODE"] = "one-time-code";
95
+ AutocompleteFieldIdentifier["ORGANIZATION_TITLE"] = "organization-title";
96
+ AutocompleteFieldIdentifier["ORGANIZATION"] = "organization";
97
+ AutocompleteFieldIdentifier["STREET_ADDRESS"] = "street-address";
98
+ AutocompleteFieldIdentifier["ADDRESS_LINE_1"] = "address-line1";
99
+ AutocompleteFieldIdentifier["ADDRESS_LINE_2"] = "address-line2";
100
+ AutocompleteFieldIdentifier["ADDRESS_LINE_3"] = "address-line3";
101
+ AutocompleteFieldIdentifier["ADDRESS_LEVEL_4"] = "address-level4";
102
+ AutocompleteFieldIdentifier["ADDRESS_LEVEL_3"] = "address-level3";
103
+ AutocompleteFieldIdentifier["ADDRESS_LEVEL_2"] = "address-level2";
104
+ AutocompleteFieldIdentifier["ADDRESS_LEVEL_1"] = "address-level1";
105
+ AutocompleteFieldIdentifier["COUNTRY"] = "country";
106
+ AutocompleteFieldIdentifier["COUNTRY_NAME"] = "country-name";
107
+ AutocompleteFieldIdentifier["POSTAL_CODE"] = "postal-code";
108
+ AutocompleteFieldIdentifier["CC_NAME"] = "cc-name";
109
+ AutocompleteFieldIdentifier["CC_GIVEN_NAME"] = "cc-given-name";
110
+ AutocompleteFieldIdentifier["CC_ADDITIONAL_NAME"] = "cc-additional-name";
111
+ AutocompleteFieldIdentifier["CC_FAMILY_NAME"] = "cc-family-name";
112
+ AutocompleteFieldIdentifier["CC_NUMBER"] = "cc-number";
113
+ AutocompleteFieldIdentifier["CC_EXP"] = "cc-exp";
114
+ AutocompleteFieldIdentifier["CC_EXP_MONTH"] = "cc-exp-month";
115
+ AutocompleteFieldIdentifier["CC_EXP_YEAR"] = "cc-exp-year";
116
+ AutocompleteFieldIdentifier["CC_CSC"] = "cc-csc";
117
+ AutocompleteFieldIdentifier["CC_TYPE"] = "cc-type";
118
+ AutocompleteFieldIdentifier["TRANSACTION_CURRENCY"] = "transaction-currency";
119
+ AutocompleteFieldIdentifier["TRANSACTION_AMOUNT"] = "transaction-amount";
120
+ AutocompleteFieldIdentifier["LANGUAGE"] = "language";
121
+ AutocompleteFieldIdentifier["BDAY"] = "bday";
122
+ AutocompleteFieldIdentifier["BDAY_DAY"] = "bday-day";
123
+ AutocompleteFieldIdentifier["BDAY_MONTH"] = "bday-month";
124
+ AutocompleteFieldIdentifier["BDAY_YEAR"] = "bday-year";
125
+ AutocompleteFieldIdentifier["SEX"] = "sex";
126
+ AutocompleteFieldIdentifier["URL"] = "url";
127
+ AutocompleteFieldIdentifier["PHOTO"] = "photo";
128
+ AutocompleteFieldIdentifier["TEL"] = "tel";
129
+ AutocompleteFieldIdentifier["TEL_COUNTRY_CODE"] = "tel-country-code";
130
+ AutocompleteFieldIdentifier["TEL_NATIONAL"] = "tel-national";
131
+ AutocompleteFieldIdentifier["TEL_AREA_CODE"] = "tel-area-code";
132
+ AutocompleteFieldIdentifier["TEL_LOCAL"] = "tel-local";
133
+ AutocompleteFieldIdentifier["TEL_LOCAL_PREFIX"] = "tel-local-prefix";
134
+ AutocompleteFieldIdentifier["TEL_LOCAL_SUFFIX"] = "tel-local-suffix";
135
+ AutocompleteFieldIdentifier["TEL_EXTENSION"] = "tel-extension";
136
+ AutocompleteFieldIdentifier["EMAIL"] = "email";
137
+ AutocompleteFieldIdentifier["IMPP"] = "impp";
138
+ })(AutocompleteFieldIdentifier || (AutocompleteFieldIdentifier = {}));
139
+ /**
140
+ * Official non-`section-*` HTML autocomplete modifiers.
141
+ * Rendering code is responsible for placing them in spec order.
142
+ */
143
+ export var AutocompleteModifier;
144
+ (function (AutocompleteModifier) {
145
+ AutocompleteModifier["SHIPPING"] = "shipping";
146
+ AutocompleteModifier["BILLING"] = "billing";
147
+ AutocompleteModifier["HOME"] = "home";
148
+ AutocompleteModifier["WORK"] = "work";
149
+ AutocompleteModifier["MOBILE"] = "mobile";
150
+ AutocompleteModifier["FAX"] = "fax";
151
+ AutocompleteModifier["PAGER"] = "pager";
152
+ AutocompleteModifier["WEBAUTHN"] = "webauthn";
153
+ })(AutocompleteModifier || (AutocompleteModifier = {}));
154
+ // ================================
65
155
  // FORM FIELD CHROME MODES
66
156
  // ================================
67
157
  //------------------------------------------------------------------------------------------------
@@ -74,6 +164,13 @@ export var FormFieldComponent;
74
164
  export const DisplayChromeMode = {
75
165
  /** Label above, value below, description below value (default). */
76
166
  STACKED: 'stacked',
167
+ /**
168
+ * Label + description inline-start, value inline-end (settings page style).
169
+ * The read-mode counterpart of `EditChromeMode.SETTINGS_ROW` — pairing the two
170
+ * keeps a view→edit drill (e.g. inside the Settings Hub) visually coherent: the
171
+ * value sits where its control will appear.
172
+ */
173
+ SETTINGS_ROW: 'settings_row',
77
174
  /** Label and value on the same line. */
78
175
  INLINE: 'inline',
79
176
  /** No label/description, just value (dense mode). */
@@ -84,8 +181,6 @@ export const DisplayChromeMode = {
84
181
  /**
85
182
  * Chrome layout mode for edit context (forms).
86
183
  * Superset of DisplayChromeMode with form-specific modes (SETTINGS_ROW, RELAXED).
87
- *
88
- * Also exported as `FormFieldChromeMode` for backward compatibility.
89
184
  */
90
185
  export const EditChromeMode = {
91
186
  /** Label above, control below, description + error below control (default). */
@@ -101,8 +196,6 @@ export const EditChromeMode = {
101
196
  /** No chrome at all — bare control output. */
102
197
  HIDDEN: 'hidden',
103
198
  };
104
- /** @deprecated Use `EditChromeMode` directly. Kept as alias for backward compatibility. */
105
- export const FormFieldChromeMode = EditChromeMode;
106
199
  ///=======================================================================================================================
107
200
  /// DISPLAY FIELD COMPONENT TYPES
108
201
  ///=======================================================================================================================
@@ -253,6 +346,22 @@ export var HorizontalAlign;
253
346
  HorizontalAlign["END"] = "end";
254
347
  })(HorizontalAlign || (HorizontalAlign = {}));
255
348
  //------------------------------------------------------------------------------------------------
349
+ /**
350
+ * @wildo_source:part:start zod.decorators.display-edit-modes facet:layer:frontend facet:family:ui facet:surface:form facet:surface:display
351
+ *
352
+ * Frontend UI vocabulary for choosing how a field renders and edits.
353
+ *
354
+ * These values are not the persisted resource semantics themselves. They are
355
+ * consumed by the frontend resource UI behavior layer, typically in
356
+ * files like `frontend/src/modules/<module>/resources/<resource>/<resource>.ui-behavior.tsx`, where the AI
357
+ * calls decorators like `.stringUI()`, `.enumUI()`, `.booleanUI()`, etc. on the
358
+ * schema shape exposed to `resourceUIBehavior(...)`.
359
+ *
360
+ * Keep these mode enums in the framework source as the canonical list of
361
+ * supported display/edit behaviors. Authoring skills and generated knowledge
362
+ * should reference these definitions instead of copying literal mode tables
363
+ * into markdown by hand.
364
+ */
256
365
  // BOOLEAN DISPLAY POLICY
257
366
  //------------------------------------------------------------------------------------------------
258
367
  /**
@@ -292,6 +401,16 @@ export const StringDisplayMode = {
292
401
  TEXT: 'text',
293
402
  TRUNCATE: 'truncate',
294
403
  MULTILINE: 'multiline',
404
+ /**
405
+ * Render the value as rich markdown (GFM: headings, lists, tables, links,
406
+ * task lists, fenced code). For long-form authored content — descriptions,
407
+ * notes, documentation fields. Headings are demoted for embedded context
408
+ * (a `#` inside a field body never competes with the page title) and every
409
+ * element is styled through the active theme's typography recipes. Pair
410
+ * with `edit.editMode: MARKDOWN` (syntax-tinted source editor) — or plain
411
+ * `TEXTAREA` — the edit side stays markdown SOURCE either way.
412
+ */
413
+ MARKDOWN: 'markdown',
295
414
  COLOR: 'color',
296
415
  LINK: 'link',
297
416
  EMAIL: 'email',
@@ -308,6 +427,14 @@ export const StringEditMode = {
308
427
  COLOR: 'color',
309
428
  PASSWORD: 'password',
310
429
  OTP: 'otp',
430
+ /**
431
+ * Markdown SOURCE editor (CodeMirror-backed, syntax-tinted, theme-token
432
+ * styled). The stored value stays plain markdown source — display-side
433
+ * rendering remains owned by `StringDisplayMode.MARKDOWN` (Streamdown).
434
+ * This is deliberately NOT a WYSIWYG mode; a rich visual editor is a
435
+ * separate future edit mode/component.
436
+ */
437
+ MARKDOWN: 'markdown',
311
438
  };
312
439
  //------------------------------------------------------------------------------------------------
313
440
  // NUMBER DISPLAY POLICY
@@ -359,10 +486,13 @@ export const BigDecimalDisplayMode = {
359
486
  export const BigDecimalEditMode = {
360
487
  INPUT: 'input',
361
488
  };
489
+ /** @wildo_source:part:end zod.decorators.display-edit-modes */
362
490
  //------------------------------------------------------------------------------------------------
363
491
  // ENUM DISPLAY POLICY
364
492
  //------------------------------------------------------------------------------------------------
365
493
  /**
494
+ * @wildo_source:part:start zod.decorators.enums.frontend-handling facet:layer:frontend facet:layer:shared facet:family:enum facet:family:ui facet:surface:form facet:surface:display
495
+ *
366
496
  * Enum display modes for rendering enum values
367
497
  */
368
498
  export const EnumDisplayMode = {
@@ -408,19 +538,75 @@ export const BadgeSemanticVariant = {
408
538
  // FOREIGN KEY DISPLAY PARAMS
409
539
  //------------------------------------------------------------------------------------------------
410
540
  /**
411
- * Foreign key display mode options
412
- * - ID: Show raw FK ID value
413
- * - LABEL: Show resolved label via getFrontendResourceLabel
414
- * - SUMMARY: Show the referenced resource's summary view (compact card) (default)
541
+ * @wildo_source:part:start zod.decorators.foreign-key-display-mode facet:layer:frontend facet:family:ui facet:surface:display facet:surface:picker
415
542
  *
416
- * Note: "summary" here is about *FK rendering*, not API data shape (see DataMode.SUMMARY)
417
- * or operation bar density (see ResourceOperationDisplayMode.SUMMARY).
543
+ * Foreign-key reference display vocabulary — how a foreign-key field renders, both
544
+ * as a stored VALUE in read views and as each ROW in the reference picker's
545
+ * dropdown (the picker is shared by forms and collection filters). Authored via
546
+ * `.foreignKeyUI(...)` from `@wildo-ai/zod-decorators` on the FK field:
547
+ * - `display.mode` — how the saved FK value renders in a read view.
548
+ * - `edit.optionDisplayMode` — how each picker dropdown ROW renders while selecting.
549
+ *
550
+ * Modes:
551
+ * - `ID`: the raw FK id string. As a picker row this is treated as `LABEL`.
552
+ * - `LABEL`: a one-line resolved label via `getFrontendResourceLabel`. The default on
553
+ * BOTH surfaces — see {@link DEFAULT_FOREIGN_KEY_DISPLAY_MODE} and
554
+ * {@link DEFAULT_FOREIGN_KEY_OPTION_DISPLAY_MODE}.
555
+ * - `SUMMARY`: the referenced resource's summary view — its summary fields with NO
556
+ * action bar (a compact card). Always an opt-in, on both surfaces.
557
+ *
558
+ * "summary" here is about FK RENDERING, not API data shape (`DataMode.SUMMARY`) or
559
+ * operation-bar density (`ResourceOperationDisplayMode.SUMMARY`).
560
+ *
561
+ * @example
562
+ * // Make the picker dropdown rows show the referenced resource's summary card:
563
+ * assigneeUserId: z.string().isForeignKey().foreignKeyUI({
564
+ * edit: { optionDisplayMode: ForeignKeyDisplayMode.SUMMARY },
565
+ * })
418
566
  */
419
567
  export const ForeignKeyDisplayMode = {
420
568
  ID: 'id',
421
569
  LABEL: 'label',
422
570
  SUMMARY: 'summary',
423
571
  };
572
+ /**
573
+ * The mode an FK's stored VALUE renders in when the field authors no
574
+ * `.foreignKeyUI({ display: { mode } })`.
575
+ *
576
+ * **This is the single source for that default.** Every site that has to supply a
577
+ * fallback display mode derives from this constant rather than restating a member of
578
+ * {@link ForeignKeyDisplayMode}. It exists because the default was previously declared
579
+ * twice and the two declarations DISAGREED — the metadata reader said `LABEL`, the
580
+ * display preset said `SUMMARY` — so the answer an app author got depended on which
581
+ * resolution path happened to run, and the prose above this enum documented the losing
582
+ * one.
583
+ *
584
+ * `LABEL` is the default because it is the cheap, composable rendering: one resolved
585
+ * line that fits a table cell, a detail row and a dense list alike. `SUMMARY` renders a
586
+ * card of the referenced record's summary fields — appropriate when the parent's
587
+ * details matter AT the point of reference, which is a per-field authoring judgement,
588
+ * not something a framework can assume for every FK in an application.
589
+ *
590
+ * @example
591
+ * // Opt a single field into the card rendering:
592
+ * todoListId: z.string().isForeignKey().foreignKeyUI({
593
+ * display: { mode: ForeignKeyDisplayMode.SUMMARY },
594
+ * })
595
+ */
596
+ export const DEFAULT_FOREIGN_KEY_DISPLAY_MODE = ForeignKeyDisplayMode.LABEL;
597
+ /**
598
+ * The mode each ROW of the reference picker's dropdown renders in when the field
599
+ * authors no `.foreignKeyUI({ edit: { optionDisplayMode } })`.
600
+ *
601
+ * **This is the single source for that default**, and it is deliberately a SEPARATE
602
+ * constant from {@link DEFAULT_FOREIGN_KEY_DISPLAY_MODE}. The two answer different
603
+ * questions — "how does a stored reference read?" versus "how does a candidate read
604
+ * while I am choosing one?" — and a framework that collapsed them would make one
605
+ * surface's default un-tunable without moving the other. They currently coincide on
606
+ * `LABEL`; that agreement is a fact about today's values, not a shared identity.
607
+ */
608
+ export const DEFAULT_FOREIGN_KEY_OPTION_DISPLAY_MODE = ForeignKeyDisplayMode.LABEL;
609
+ /** @wildo_source:part:end zod.decorators.shared-structural-params */
424
610
  //------------------------------------------------------------------------------------------------
425
611
  // RANGE SCHEMA TYPES
426
612
  //------------------------------------------------------------------------------------------------
@@ -568,6 +754,80 @@ export var FileDisplayNature;
568
754
  FileDisplayNature["DOCUMENT"] = "document";
569
755
  FileDisplayNature["GENERIC"] = "generic";
570
756
  })(FileDisplayNature || (FileDisplayNature = {}));
757
+ /**
758
+ * Frame shape for an inline media (image) preview — see `FileUIDisplayParams.preview`.
759
+ * - `ROUNDED` (default): rounded-corner rectangle, aspect preserved (`object-contain`).
760
+ * - `SQUARE`: sharp-corner rectangle, aspect preserved.
761
+ * - `CIRCLE`: circular frame; the image is cropped to fill (`object-cover`). Typical
762
+ * for avatars / profile pictures.
763
+ */
764
+ export var FileMediaShape;
765
+ (function (FileMediaShape) {
766
+ FileMediaShape["ROUNDED"] = "rounded";
767
+ FileMediaShape["SQUARE"] = "square";
768
+ FileMediaShape["CIRCLE"] = "circle";
769
+ })(FileMediaShape || (FileMediaShape = {}));
770
+ /**
771
+ * Rendered size tier for an inline media (image) preview — see
772
+ * `FileUIDisplayParams.preview`. `XS`–`XL` are fixed dimensions (a `CIRCLE` uses the
773
+ * value as its diameter; a rectangle uses it as the max width). `FULL` fills the
774
+ * available column width (the default, container-responsive) — best for cover images,
775
+ * not avatars.
776
+ */
777
+ export var FileMediaSize;
778
+ (function (FileMediaSize) {
779
+ FileMediaSize["XS"] = "xs";
780
+ FileMediaSize["SM"] = "sm";
781
+ FileMediaSize["MD"] = "md";
782
+ FileMediaSize["LG"] = "lg";
783
+ FileMediaSize["XL"] = "xl";
784
+ FileMediaSize["FULL"] = "full";
785
+ })(FileMediaSize || (FileMediaSize = {}));
786
+ /**
787
+ * How a file field renders AT REST, before any interaction — one of the two
788
+ * orthogonal axes of the file display policy (the other is
789
+ * {@link FileActivationPolicy}, what a click does).
790
+ *
791
+ * - `CARD` (default): the neutral file card — icon + filename + size. Compact and
792
+ * nature-agnostic, so a detail view holding several documents stays scannable.
793
+ * - `THUMBNAIL`: a small rendered preview of the media beside the title (an image
794
+ * thumbnail, a PDF's rasterised first page). Informative but still compact.
795
+ * - `FULL`: the media rendered inline at full width — an image, a video player, a
796
+ * paginated PDF viewer. The heaviest option: for documents it downloads and mounts
797
+ * the viewer on first paint, so prefer `CARD` + an `OVERLAY` activation unless the
798
+ * document IS the page.
799
+ *
800
+ * `THUMBNAIL` and `FULL` require a displayer for the file's resolved nature; a
801
+ * request the nature cannot satisfy is refused at registry build (narrow declared
802
+ * nature) or degraded to `CARD` at runtime (open nature) — never a broken render.
803
+ */
804
+ export var FileDisplayPresentation;
805
+ (function (FileDisplayPresentation) {
806
+ FileDisplayPresentation["CARD"] = "card";
807
+ FileDisplayPresentation["THUMBNAIL"] = "thumbnail";
808
+ FileDisplayPresentation["FULL"] = "full";
809
+ })(FileDisplayPresentation || (FileDisplayPresentation = {}));
810
+ /**
811
+ * What activating (clicking / Enter) a displayed file does — the second axis of the
812
+ * file display policy. Applies to EVERY file nature, not just images.
813
+ *
814
+ * - `NONE`: inert. No cursor affordance, no handler, not focusable as a control.
815
+ * - `OVERLAY`: open the nature's displayer in an overlay (the generalisation of the
816
+ * old image-only lightbox). Requires a displayer for the resolved nature.
817
+ * - `DOWNLOAD`: fetch the bytes over the authenticated serve route and save them.
818
+ * - `NEW_TAB`: open the authenticated serve URL in a new tab (the browser's own
819
+ * viewer, with its native print/save affordances).
820
+ * - `CUSTOM`: run an operation declared on the resource that OWNS this file field —
821
+ * see {@link FileActivationConfig}.
822
+ */
823
+ export var FileActivationPolicy;
824
+ (function (FileActivationPolicy) {
825
+ FileActivationPolicy["NONE"] = "none";
826
+ FileActivationPolicy["OVERLAY"] = "overlay";
827
+ FileActivationPolicy["DOWNLOAD"] = "download";
828
+ FileActivationPolicy["NEW_TAB"] = "new_tab";
829
+ FileActivationPolicy["CUSTOM"] = "custom";
830
+ })(FileActivationPolicy || (FileActivationPolicy = {}));
571
831
  /**
572
832
  * Storage providers accepted for file uploads.
573
833
  */
@@ -583,8 +843,13 @@ export var FileUploaderEntityType;
583
843
  (function (FileUploaderEntityType) {
584
844
  FileUploaderEntityType["USER"] = "user";
585
845
  FileUploaderEntityType["ANONYMOUS_USER"] = "anonymous_user";
586
- FileUploaderEntityType["ORGANIZATION_API_KEY"] = "organization_api_key";
587
- FileUploaderEntityType["APPLICATION_API_KEY"] = "application_api_key";
846
+ // Machine (non-human) uploaders. The value is the PRINCIPAL kind (org/app machine), NOT the
847
+ // credential kind — an api-key AND an OAuth client both authenticate the same machine principal,
848
+ // and the specific credential (api-key vs OAuth client) + its id are recorded on
849
+ // `initiatorIds.machineCredential` (authMethod + credentialId). Keeping this enum principal-keyed
850
+ // (matching USER / ANONYMOUS_USER) avoids mislabelling an OAuth-client upload as an "api key".
851
+ FileUploaderEntityType["ORGANIZATION_MACHINE"] = "organization_machine";
852
+ FileUploaderEntityType["APPLICATION_MACHINE"] = "application_machine";
588
853
  })(FileUploaderEntityType || (FileUploaderEntityType = {}));
589
854
  /**
590
855
  * Image format options for file validation.
@@ -614,14 +879,53 @@ export const AudioFormat = {
614
879
  AAC: 'aac',
615
880
  };
616
881
  /**
617
- * RAG chunking strategy options for file content indexing.
882
+ * @wildo_source:part:start zod.decorators.rag-source facet:layer:shared facet:family:decorator facet:family:param-surface facet:kind:api facet:audience:app-developer
883
+ *
884
+ * How a RAG-source field's text is split into retrieval chunks.
885
+ *
886
+ * Import from `@wildo-ai/zod-decorators`. Every member is a chunking STRATEGY — pick the one that
887
+ * matches the field's real content shape, because chunk boundaries decide what a retrieval hit can
888
+ * quote: a heading-aware split over markdown returns a coherent section, while a fixed-size split
889
+ * over the same text returns whatever fell inside the window.
890
+ *
891
+ * **This is the single named home for the chunking vocabulary** (semantic-string-literals rule).
892
+ * It lives in `zod-decorators` — not `saas-models` — because the dependency arrow points the other
893
+ * way: `saas-models` depends on this package, while the `.ragSource()` decorator params below could
894
+ * never import a `saas-models` enum. Chunking is authored ON THE FIELD, through `.ragSource()`;
895
+ * there is no separate agent-level chunking configuration to keep in step with it.
896
+ *
897
+ * - `FIXED_SIZE` — split every `chunkSize` characters/tokens regardless of structure.
898
+ * - `RECURSIVE` — split on a separator hierarchy (paragraph → sentence → word) down to `chunkSize`.
899
+ * - `SEMANTIC` — split at embedding-detected topic boundaries.
900
+ * - `MARKDOWN` — split on markdown structure (headings, lists, code fences).
901
+ * - `CODE` — split on source-code structure (functions, classes, blocks). Unified in (2026-08-26)
902
+ * from a second copy of this vocabulary that `saas-models` then carried: the member sets differed
903
+ * only by this entry, and shrinking the vocabulary to fit the field decorator would have silently
904
+ * invalidated configurations authored against the wider one — so the union won. That second copy,
905
+ * and the agent-level RAG configuration schemas around it, were retired on 2026-08-27 as a
906
+ * pre-capability design the shipped capability superseded; this object is now the only home.
618
907
  */
619
908
  export const RAGChunkingStrategy = {
620
909
  FIXED_SIZE: 'fixed_size',
621
910
  RECURSIVE: 'recursive',
622
911
  SEMANTIC: 'semantic',
623
912
  MARKDOWN: 'markdown',
913
+ CODE: 'code',
624
914
  };
915
+ /** @wildo_source:part:end zod.decorators.rag-source */
916
+ /**
917
+ * @wildo_source:part:start zod.decorators.file-generation facet:layer:schema facet:family:pdf-templates
918
+ *
919
+ * Generation sources supported by `z_file()`.
920
+ *
921
+ * Keep this enum in `zod-decorators` instead of `saas-models` so shared schemas
922
+ * can mark generated files without creating a dependency cycle back into the
923
+ * resource/model packages that already consume decorators.
924
+ */
925
+ export var FileGenerationSource;
926
+ (function (FileGenerationSource) {
927
+ FileGenerationSource["PDF_TEMPLATE"] = "pdfTemplate";
928
+ })(FileGenerationSource || (FileGenerationSource = {}));
625
929
  /**
626
930
  * File behavior when parent resource is deleted.
627
931
  * - CASCADE: Mark the file deleted as part of parent removal; physical storage cleanup is deferred to the cleanup batch
@@ -651,10 +955,13 @@ export const InlineEditSaveOn = {
651
955
  /** Save only on explicit button click */
652
956
  EXPLICIT: 'explicit',
653
957
  };
958
+ /** @wildo_source:part:end zod.decorators.shared-structural-params */
654
959
  //------------------------------------------------------------------------------------------------
655
960
  // UNIQUE FIELD PARAMS
656
961
  //------------------------------------------------------------------------------------------------
657
962
  /**
963
+ * @wildo_source:part:start zod.decorators.shared-structural-params facet:layer:shared facet:family:decorator facet:family:param-surface
964
+ *
658
965
  * Scope for unique constraint enforcement.
659
966
  * - 'global': Unique across the entire collection (default)
660
967
  * - 'organization': Unique within an organization (compound index with organizationId)
@@ -665,6 +972,7 @@ export const UniqueScope = {
665
972
  ORGANIZATION: 'organization',
666
973
  USER: 'user',
667
974
  };
975
+ /** @wildo_source:part:end zod.decorators.shared-structural-params */
668
976
  //------------------------------------------------------------------------------------------------
669
977
  // FORM VALIDATION DECORATOR PARAMS
670
978
  //------------------------------------------------------------------------------------------------
@@ -695,10 +1003,13 @@ export var AutosaveTrigger;
695
1003
  AutosaveTrigger["BLUR"] = "blur";
696
1004
  AutosaveTrigger["NONE"] = "none";
697
1005
  })(AutosaveTrigger || (AutosaveTrigger = {}));
1006
+ /** @wildo_source:part:end zod.decorators.structural-lifecycle-params */
698
1007
  // ==========================================================================================================================================================
699
1008
  // SHOW WHEN TYPES (FIX-P5-H1)
700
1009
  // ==========================================================================================================================================================
701
1010
  /**
1011
+ * @wildo_source:part:start zod.decorators.conditional-visibility facet:layer:frontend facet:family:form facet:surface:conditional
1012
+ *
702
1013
  * FIX-P5-H1: Operator for showWhen condition comparison.
703
1014
  * - EQUALS: Field value equals the specified value
704
1015
  * - NOT_EQUALS: Field value does not equal the specified value
@@ -716,9 +1027,171 @@ export var ShowWhenOperator;
716
1027
  ShowWhenOperator["EXISTS"] = "exists";
717
1028
  ShowWhenOperator["NOT_EXISTS"] = "notExists";
718
1029
  })(ShowWhenOperator || (ShowWhenOperator = {}));
1030
+ /**
1031
+ * How NEW items are added to an array field in an edit / inline-edit surface.
1032
+ *
1033
+ * When unset, the renderer resolves a default by item shape: a SIMPLE item
1034
+ * (a primitive, or an object with a single prominent authored field — e.g. a
1035
+ * checklist `{ label, done }`) defaults to {@link ArrayAddMode.QUICK_ADD}; a
1036
+ * MULTI-field object defaults to {@link ArrayAddMode.APPEND_INLINE}.
1037
+ *
1038
+ * The key distinction is WHEN the new item is validated:
1039
+ * - `APPEND_INLINE` validates AFTER append (a freshly-added required field shows
1040
+ * its error until filled);
1041
+ * - `QUICK_ADD` / `DIALOG` validate BEFORE append (the list never holds a blank
1042
+ * or invalid item).
1043
+ */
1044
+ export var ArrayAddMode;
1045
+ (function (ArrayAddMode) {
1046
+ /**
1047
+ * "+ Add" appends a blank, in-place editable item card/row; validated AFTER
1048
+ * it is added. Best for rich objects the author edits in place.
1049
+ */
1050
+ ArrayAddMode["APPEND_INLINE"] = "append-inline";
1051
+ /**
1052
+ * A single inline add-row (the item's primary field + Enter / "+"). The item
1053
+ * is built from the row and validated BEFORE it is appended, so the list never
1054
+ * holds a blank/invalid item. Best for simple items — checklists.
1055
+ */
1056
+ ArrayAddMode["QUICK_ADD"] = "quick-add";
1057
+ /**
1058
+ * "+ Add" opens a dialog with the item's form; the item is validated on submit
1059
+ * and then appended. Best for complex, multi-field items.
1060
+ */
1061
+ ArrayAddMode["DIALOG"] = "dialog";
1062
+ })(ArrayAddMode || (ArrayAddMode = {}));
1063
+ /**
1064
+ * How each item of an OBJECT array (`z.array(z.object({...}))`) is framed in
1065
+ * BOTH display and edit surfaces.
1066
+ *
1067
+ * - `CARD` (default) — each item is a framed card (border + padding) with a
1068
+ * floating summary chip and a stacked column of its sub-fields. Best for
1069
+ * rich, multi-field items the author edits in place.
1070
+ * - `ROW` — each item is a compact single-row: its sub-fields render inline
1071
+ * (boolean fields lead as compact toggles — the "☐" of a checklist — then
1072
+ * the primary field fills the row), reorder/remove controls inline, NO card
1073
+ * frame or floating chip. Best for lists of small objects — checklists,
1074
+ * tag/value pairs, key-value rows.
1075
+ *
1076
+ * Applies to object-array items only; primitive arrays already render as rows.
1077
+ */
1078
+ export var ArrayObjectItemLayout;
1079
+ (function (ArrayObjectItemLayout) {
1080
+ ArrayObjectItemLayout["CARD"] = "card";
1081
+ ArrayObjectItemLayout["ROW"] = "row";
1082
+ })(ArrayObjectItemLayout || (ArrayObjectItemLayout = {}));
1083
+ /** @wildo_source:part:end zod.decorators.per-primitive-ui */
1084
+ //================================================================================================
1085
+ // FIELD SPEC — Per-primitive business semantics decorators (companion-only at runtime)
1086
+ //================================================================================================
1087
+ /**
1088
+ * @wildo_source:part:start zod.decorators.field-spec-params facet:layer:specification facet:family:companion facet:family:semantics
1089
+ *
1090
+ * Semantic specification parameter types for companion/specification overlays.
1091
+ *
1092
+ * These types are intentionally separate from both:
1093
+ * - shared schema structural decorators (`*.schemas.ts`)
1094
+ * - frontend UI decorators (`*.ui-behavior.tsx`)
1095
+ *
1096
+ * `{primitive}Spec()` calls belong in specification-side files such as
1097
+ * `specifications/src/modules/<module>/resources/<resource>.resource.specification.ts`.
1098
+ * They enrich schema fields with business meaning, importance, enum value
1099
+ * semantics, relationship context, and import-oriented symbol references used by
1100
+ * companion-time reasoning and code generation.
1101
+ *
1102
+ * These params should carry meaning that cannot be deterministically inferred
1103
+ * from the Zod type, requiredness, or structural decorators alone.
1104
+ */
1105
+ /**
1106
+ * Relative weight of a semantic entry inside its owning resource.
1107
+ *
1108
+ * Not about technical optionality — tells the AI how central a field is
1109
+ * to understanding the resource:
1110
+ * - PRIMARY: core to understanding or using the resource correctly.
1111
+ * The AI should prioritize these in summaries, forms, and behavior generation.
1112
+ * - CONTEXTUAL: provides useful context but is not central.
1113
+ * The AI can include or omit based on available space/attention.
1114
+ *
1115
+ * Default is CONTEXTUAL — only genuinely important fields should be explicitly
1116
+ * flagged as PRIMARY.
1117
+ */
1118
+ export var FieldSemanticImportance;
1119
+ (function (FieldSemanticImportance) {
1120
+ FieldSemanticImportance["PRIMARY"] = "primary";
1121
+ FieldSemanticImportance["CONTEXTUAL"] = "contextual";
1122
+ })(FieldSemanticImportance || (FieldSemanticImportance = {}));
1123
+ /**
1124
+ * Base field specification parameters shared by all `{primitive}Spec()` decorators.
1125
+ *
1126
+ * Carries the semantic delta that the Zod schema definition alone cannot convey:
1127
+ * domain meaning, business relevance, and guidance for the AI companion.
1128
+ *
1129
+ * These values are **never rendered in the frontend UI** — they exist on the
1130
+ * schema metadata for companion-time extraction only. The `{primitive}Spec()` calls
1131
+ * happen in the specification overlay (which the frontend never imports), so
1132
+ * the prose is attached to schema instances only in companion/test contexts.
1133
+ *
1134
+ * Do not duplicate information already expressed by the schema type, requiredness,
1135
+ * enum values, or structural decorators. This is for meaning that is not derivable.
1136
+ */
1137
+ export var CodeSymbolKind;
1138
+ (function (CodeSymbolKind) {
1139
+ CodeSymbolKind["SCHEMA"] = "schema";
1140
+ CodeSymbolKind["ENUM"] = "enum";
1141
+ CodeSymbolKind["FACTORY"] = "factory";
1142
+ CodeSymbolKind["FUNCTION"] = "function";
1143
+ CodeSymbolKind["CONFIG"] = "config";
1144
+ CodeSymbolKind["TYPE"] = "type";
1145
+ CodeSymbolKind["COMPONENT"] = "component";
1146
+ CodeSymbolKind["UI_BEHAVIOR"] = "uiBehavior";
1147
+ })(CodeSymbolKind || (CodeSymbolKind = {}));
1148
+ export var CodeDeclarationKind;
1149
+ (function (CodeDeclarationKind) {
1150
+ CodeDeclarationKind["TYPESCRIPT_ENUM"] = "typescriptEnum";
1151
+ CodeDeclarationKind["CONST_OBJECT"] = "constObject";
1152
+ CodeDeclarationKind["ZOD_ENUM"] = "zodEnum";
1153
+ CodeDeclarationKind["LITERAL_UNION"] = "literalUnion";
1154
+ CodeDeclarationKind["ZOD_SCHEMA"] = "zodSchema";
1155
+ CodeDeclarationKind["FUNCTION"] = "function";
1156
+ CodeDeclarationKind["INTERFACE"] = "interface";
1157
+ CodeDeclarationKind["TYPE_ALIAS"] = "typeAlias";
1158
+ CodeDeclarationKind["UNKNOWN"] = "unknown";
1159
+ })(CodeDeclarationKind || (CodeDeclarationKind = {}));
1160
+ export var CollectionElementKind;
1161
+ (function (CollectionElementKind) {
1162
+ CollectionElementKind["PRIMITIVE"] = "primitive";
1163
+ CollectionElementKind["ENUM"] = "enum";
1164
+ CollectionElementKind["FOREIGN_KEY"] = "foreignKey";
1165
+ CollectionElementKind["OBJECT"] = "object";
1166
+ CollectionElementKind["SCHEMA_REF"] = "schemaRef";
1167
+ CollectionElementKind["UNION"] = "union";
1168
+ CollectionElementKind["UNKNOWN"] = "unknown";
1169
+ })(CollectionElementKind || (CollectionElementKind = {}));
1170
+ export var CodePrimitiveKind;
1171
+ (function (CodePrimitiveKind) {
1172
+ CodePrimitiveKind["STRING"] = "string";
1173
+ CodePrimitiveKind["NUMBER"] = "number";
1174
+ CodePrimitiveKind["BOOLEAN"] = "boolean";
1175
+ CodePrimitiveKind["DATE"] = "date";
1176
+ CodePrimitiveKind["DATETIME"] = "datetime";
1177
+ CodePrimitiveKind["TIME"] = "time";
1178
+ CodePrimitiveKind["MONEY"] = "money";
1179
+ CodePrimitiveKind["CODE"] = "code";
1180
+ CodePrimitiveKind["FILE"] = "file";
1181
+ CodePrimitiveKind["DURATION"] = "duration";
1182
+ CodePrimitiveKind["PHONE"] = "phone";
1183
+ CodePrimitiveKind["BIGDECIMAL"] = "bigdecimal";
1184
+ CodePrimitiveKind["UNKNOWN"] = "unknown";
1185
+ })(CodePrimitiveKind || (CodePrimitiveKind = {}));
1186
+ /** @wildo_source:part:end zod.decorators.field-spec-params */
719
1187
  // ==========================================================================================================================================================
720
1188
  // ZOD DECORATOR TYPES
721
1189
  // ==========================================================================================================================================================
1190
+ /**
1191
+ * @wildo_source:part:start zod.decorators.decorator-vocabulary
1192
+ *
1193
+ * Canonical string identifiers for framework Zod field decorators (`ZodDecorator` enum).
1194
+ */
722
1195
  export var ZodDecorator;
723
1196
  (function (ZodDecorator) {
724
1197
  ZodDecorator["IS_DB_INDEXED"] = "isDBIndexed";
@@ -728,6 +1201,136 @@ export var ZodDecorator;
728
1201
  // New decorators for resource derived objects rationalization
729
1202
  ZodDecorator["IS_SUMMARY_FIELD"] = "isSummaryField";
730
1203
  ZodDecorator["IS_BACKEND_ONLY"] = "isBackendOnly";
1204
+ ZodDecorator["IS_WRITE_ONLY_SECRET"] = "isWriteOnlySecret";
1205
+ /**
1206
+ * Impersonalization: per-field erasure-scrub treatment — a `RedactionType` value (string),
1207
+ * read by the saas-models impersonalize writer. NOT the anonymous-user concept.
1208
+ *
1209
+ * Authored fluently: `z.string().nullish().impersonalizeWith(RedactionType.REMOVE)`. The
1210
+ * treatment is REQUIRED and must be a non-empty string — a blank/missing value throws at
1211
+ * decoration time rather than silently leaving the field untreated (an unscrubbed personal
1212
+ * field). `addImpersonalizeWith(schema, treatment)` is the equivalent programmatic escape hatch;
1213
+ * read the treatment back with `getImpersonalizeTreatment(schema)`.
1214
+ *
1215
+ * A `MASK` treatment may carry a field-specific mask value —
1216
+ * `addImpersonalizeWith(schema, RedactionType.MASK, { maskValue: 'erased@erased.invalid' })` —
1217
+ * for a CONSTRAINED string the default mask constant cannot satisfy; read it back with
1218
+ * `getImpersonalizeMaskValue(schema)`. Both authoring doors normalize to
1219
+ * {@link ImpersonalizeFieldParams}, which is what this decorator stores.
1220
+ */
1221
+ ZodDecorator["IMPERSONALIZE_WITH"] = "impersonalizeWith";
1222
+ /**
1223
+ * Portability: where this field's value CAME FROM — a `DataPortabilityProvenance` value (string),
1224
+ * read by the subject-export orchestrator to decide GDPR Art. 20 scope.
1225
+ *
1226
+ * Authored fluently: `z.string().portabilityProvenance(DataPortabilityProvenance.SUBJECT_PROVIDED)`.
1227
+ * The value is REQUIRED and must be a non-empty string — a blank/missing value throws at
1228
+ * decoration time rather than storing an undeclared provenance, which an Art. 20 export treats as
1229
+ * a REFUSAL rather than guessing. `addPortabilityProvenance(schema, provenance)` is the equivalent
1230
+ * programmatic escape hatch; read it back with `getPortabilityProvenance(schema)`.
1231
+ *
1232
+ * A field that carries no declaration inherits its resource's `portabilityPolicy.defaultProvenance`;
1233
+ * only fields differing from that default need this decorator.
1234
+ *
1235
+ * ⚠️ NOT a redaction or scrub concept, and NOT the anonymous-user concept. This says where a value
1236
+ * ORIGINATED, for a DISCLOSURE decision. What happens to a value on ERASURE is
1237
+ * {@link ZodDecorator.IMPERSONALIZE_WITH}, an orthogonal axis — a field is commonly both
1238
+ * `SUBJECT_PROVIDED` and masked on erasure.
1239
+ */
1240
+ ZodDecorator["PORTABILITY_PROVENANCE"] = "portabilityProvenance";
1241
+ /**
1242
+ * Data categories: WHICH KINDS of personal data this field holds — one or more
1243
+ * `PersonalDataCategory` values (strings), read by the compliance fact producer to answer the
1244
+ * privacy-notice question "which categories of personal data do you process".
1245
+ *
1246
+ * Authored fluently: `email: z.email().dataCategories(PersonalDataCategory.CONTACT_DETAILS)`, or
1247
+ * with an array when a field genuinely spans two —
1248
+ * `.dataCategories([PersonalDataCategory.USER_CONTENT, PersonalDataCategory.SPECIAL_CATEGORY_HEALTH])`.
1249
+ * The chokepoint normalizes either form to a deduped array, so every reader sees one shape.
1250
+ * At least one category is REQUIRED and each must be a non-empty string: a blank declaration
1251
+ * would read back as declared-but-meaningless, which is worse than absent, because absence is
1252
+ * what the gap report is looking for. `addDataCategories(schema, categories)` is the equivalent
1253
+ * programmatic escape hatch; read them back with `getDataCategories(schema)`.
1254
+ *
1255
+ * WHETHER each value is a real `PersonalDataCategory` member is checked by the resource factory's
1256
+ * boot guard, which owns the enum — this layer knows only that non-empty strings were declared.
1257
+ *
1258
+ * ⚠️ Four adjacent axes, none of them this one. {@link ZodDecorator.IMPERSONALIZE_WITH} says what
1259
+ * happens to the value on ERASURE; {@link ZodDecorator.PORTABILITY_PROVENANCE} says where it CAME
1260
+ * FROM; `Compliance_DataClassification` is a SENSITIVITY ladder for flows-actors config; a
1261
+ * retention class says HOW LONG it is kept. A single field is routinely all five at once, and
1262
+ * none of the other four can answer "what kind of personal data is this".
1263
+ *
1264
+ * ⚠️ Do NOT declare a category on a field merely because its NAME suggests one. The decorator
1265
+ * exists precisely so categories are never derived from identifiers: `email`, `phone` and
1266
+ * `dateOfBirth` are suggestive while `notes` is not, and an inventory assembled by
1267
+ * pattern-matching names is a guess whose misses are silently undisclosed. `CREDENTIALS` is the
1268
+ * one category the producer derives, and it derives it from `.isPassword()` / `.isOtp()` /
1269
+ * `.isWriteOnlySecret()` — markers the author wrote, not names it read.
1270
+ *
1271
+ * assurance-control: WILDO.PRIVACY.PERSONAL_DATA_INVENTORY — the application declares which
1272
+ * categories of personal data each field holds
1273
+ */
1274
+ ZodDecorator["DATA_CATEGORIES"] = "dataCategories";
1275
+ /**
1276
+ * Audit evidence: this field's BEFORE/AFTER VALUES are recorded when a resource operation
1277
+ * mutates it, on the `resource_operation_performed` audit event.
1278
+ *
1279
+ * Authored fluently: `appRoles: z.array(z.string()).isAuditEvidence()`. A pure marker — no
1280
+ * parameters, no implied decorators. `addAuditEvidence(schema)` is the equivalent programmatic
1281
+ * escape hatch; read it back with `isAuditEvidenceField(schema)`.
1282
+ *
1283
+ * **Mark the fields whose VALUES are the evidence, and only those.** The audit event always
1284
+ * records the NAMES of every changed field (a field name is not personal data). This marker adds
1285
+ * the values, and values are the part that must be justified: audit rows replicate to the per-org
1286
+ * SIEM and to the immutable ledger, and the ledger cannot be scrubbed — so marking a personal-data
1287
+ * field manufactures an unerasable copy of it, defeating the impersonalization/retention
1288
+ * capability. Mark authority (`appRoles`, `roles`), lifecycle state (`status`), and scope-bearing
1289
+ * fields; do NOT mark names, contact details, addresses, free text, or anything a data subject
1290
+ * could ask to have erased.
1291
+ *
1292
+ * ⚠️ This is a WRITE-side claim — "when this field CHANGES, the change itself is evidence" — and
1293
+ * is independent of the READ-side disclosure trail. The only disclosure trigger the framework has
1294
+ * is `isBackendOnly({ isReturnedAtCreation: true })`, which fires one `FIELD_ACCESS` event when a
1295
+ * server-minted secret is first exposed. A field can carry either, both, or neither. There is no
1296
+ * general "audit every read of this field" marker — do not go looking for one.
1297
+ *
1298
+ * assurance-control: WILDO.SECRETS.DISCLOSURE_AUDIT
1299
+ */
1300
+ ZodDecorator["IS_AUDIT_EVIDENCE"] = "isAuditEvidence";
1301
+ /**
1302
+ * RAG source: this field's TEXT is a retrieval-corpus source. The framework chunks the value
1303
+ * (extracting text first for file fields), stores the chunks in the application's OWN datastore
1304
+ * (pgvector on PostgreSQL, `$vectorSearch` on MongoDB — never a third store), and erases them
1305
+ * with the row: chunks are a derived-data tier keyed `(resourceType, resourceId, fieldName)`,
1306
+ * so row deletion, field impersonalization, and subject erasure all reach them.
1307
+ *
1308
+ * Authored fluently: `z.string().ragSource()` or `z.string().ragSource({ chunkingStrategy:
1309
+ * RAGChunkingStrategy.MARKDOWN, chunkSize: 1200, chunkOverlap: 150 })`. All params are optional
1310
+ * and there is NO `enabled` flag — presence of the decorator IS the declaration (see
1311
+ * {@link RagSourceConfiguration}). `addRagSource(schema, config?)` is the equivalent programmatic
1312
+ * escape hatch; read the config back with `getRagSourceConfig(schema)`.
1313
+ *
1314
+ * **File fields are one text provider, not a separate mechanism.** `z_file({ ragSource: {...} })`
1315
+ * registers THIS decorator on the schema it returns, so detection is uniform across plain-text
1316
+ * and file-backed sources; file-only extraction knobs (OCR) live file-side in
1317
+ * `FileSchemaOptions.textExtraction`, never here.
1318
+ *
1319
+ * **Refused companions, enforced in BOTH application orders at the decorator chokepoint:**
1320
+ * - {@link ZodDecorator.IS_PASSWORD}, {@link ZodDecorator.IS_OTP},
1321
+ * {@link ZodDecorator.IS_WRITE_ONLY_SECRET}, {@link ZodDecorator.IS_EPHEMERAL} — a secret or
1322
+ * ephemeral value must never enter a retrieval corpus.
1323
+ * - {@link ZodDecorator.TTL} — MongoDB honours `.ttl()` natively: rows vanish with NO application
1324
+ * code running, so derived chunks of a TTL row could never be erased with their parent (plan
1325
+ * `resource-rag-capability` DL3). The refusal lifts when a sweep-cascade reconciles chunk rows
1326
+ * against vanished parents.
1327
+ *
1328
+ * {@link ZodDecorator.IS_BACKEND_ONLY} composes: a backend-only field can be a corpus source —
1329
+ * retrieval access is governed by the resource's own access binding, not by field visibility.
1330
+ * {@link ZodDecorator.IMPERSONALIZE_WITH} composes too: an impersonalize decision deletes the
1331
+ * field's chunks in the same decision.
1332
+ */
1333
+ ZodDecorator["RAG_SOURCE"] = "ragSource";
731
1334
  ZodDecorator["IS_VIRTUAL"] = "isVirtual";
732
1335
  ZodDecorator["IS_DISCRIMINATOR"] = "isDiscriminator";
733
1336
  ZodDecorator["EXCLUDE_FROM_CREATE"] = "excludeFromCreate";
@@ -735,6 +1338,32 @@ export var ZodDecorator;
735
1338
  // Database constraint decorators
736
1339
  ZodDecorator["IS_UNIQUE"] = "isUnique";
737
1340
  ZodDecorator["IS_PRIMARY_KEY"] = "isPrimaryKey";
1341
+ /**
1342
+ * Marks a field as a stable, declaration-side **business key** —
1343
+ * an identity independent from the random `_id` (`isPrimaryKey`).
1344
+ *
1345
+ * Used by data seeding to safely upsert, upgrade and synchronize seeded rows.
1346
+ * Unlike `isPrimaryKey`,
1347
+ * a business key is mutable by users (renames are handled by a per-seed
1348
+ * `renames: [{ from, to }]` migrator), and it carries no implicit
1349
+ * decorators (`isPrimaryKey` is composite — `isBusinessKey` is purely
1350
+ * a marker so it can co-exist with whatever editing semantics the field
1351
+ * already has).
1352
+ *
1353
+ * Composite scope-aware identity uses the object-level
1354
+ * `OBJECT_BUSINESS_KEY_SET` decorator on the schema root.
1355
+ */
1356
+ ZodDecorator["IS_BUSINESS_KEY"] = "isBusinessKey";
1357
+ /**
1358
+ * Object-level decorator declaring a **composite business key** for the
1359
+ * schema (e.g. `(organizationId, templateKey)`). Schema-level analog of
1360
+ * `IS_BUSINESS_KEY`. Used by the data-seeding subsystem.
1361
+ *
1362
+ * Field-level `IS_BUSINESS_KEY` and object-level `OBJECT_BUSINESS_KEY_SET`
1363
+ * are **mutually exclusive** on the same schema — pick one identity model
1364
+ * (single field vs composite). Mixing is rejected at decoration time.
1365
+ */
1366
+ ZodDecorator["OBJECT_BUSINESS_KEY_SET"] = "businessKeySet";
738
1367
  ZodDecorator["TTL"] = "ttl";
739
1368
  // String edit mode convenience decorators (shorthand for STRING_UI with specific editMode)
740
1369
  ZodDecorator["IS_PASSWORD"] = "isPassword";
@@ -748,7 +1377,7 @@ export var ZodDecorator;
748
1377
  ZodDecorator["SYSTEM_ENUM"] = "systemEnum";
749
1378
  // Ephemeral field decorator - marks a field as transient response-only data (shown once, then gone)
750
1379
  ZodDecorator["IS_EPHEMERAL"] = "isEphemeral";
751
- // CRDT field decorator - marks a field for future field-level LWW merge (Phase 3C)
1380
+ // CRDT field decorator — marks a field for future field-level LWW merge.
752
1381
  ZodDecorator["IS_CRDT"] = "isCRDT";
753
1382
  // Unified {primitive}UI decorators — new API replacing display policy + formField decomposition
754
1383
  ZodDecorator["BOOLEAN_UI"] = "booleanUI";
@@ -767,5 +1396,22 @@ export var ZodDecorator;
767
1396
  ZodDecorator["FOREIGN_KEY_UI"] = "foreignKeyUI";
768
1397
  ZodDecorator["ARRAY_UI"] = "arrayUI";
769
1398
  ZodDecorator["OBJECT_UI"] = "objectUI";
1399
+ // Per-primitive field specification decorators — business semantics (companion-only)
1400
+ ZodDecorator["STRING_SPEC"] = "stringSpec";
1401
+ ZodDecorator["NUMBER_SPEC"] = "numberSpec";
1402
+ ZodDecorator["BOOLEAN_SPEC"] = "booleanSpec";
1403
+ ZodDecorator["DATE_SPEC"] = "dateSpec";
1404
+ ZodDecorator["DATETIME_SPEC"] = "dateTimeSpec";
1405
+ ZodDecorator["TIME_SPEC"] = "timeSpec";
1406
+ ZodDecorator["ENUM_SPEC"] = "enumSpec";
1407
+ ZodDecorator["MONEY_SPEC"] = "moneySpec";
1408
+ ZodDecorator["CODE_SPEC"] = "codeSpec";
1409
+ ZodDecorator["FILE_SPEC"] = "fileSpec";
1410
+ ZodDecorator["DURATION_SPEC"] = "durationSpec";
1411
+ ZodDecorator["PHONE_SPEC"] = "phoneSpec";
1412
+ ZodDecorator["BIGDECIMAL_SPEC"] = "bigDecimalSpec";
1413
+ ZodDecorator["FOREIGN_KEY_SPEC"] = "foreignKeySpec";
1414
+ ZodDecorator["ARRAY_SPEC"] = "arraySpec";
1415
+ ZodDecorator["OBJECT_SPEC"] = "objectSpec";
770
1416
  })(ZodDecorator || (ZodDecorator = {}));
771
- //# sourceMappingURL=zod-decorators.types.js.map
1417
+ //# sourceMappingURL=zod-decorators.types.js.map