@wildo-ai/zod-decorators 1.1.11 → 1.1.13

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 (78) hide show
  1. package/dist/esm/commons.d.ts.map +1 -1
  2. package/dist/esm/commons.js.map +1 -1
  3. package/dist/esm/currencies.shared.schemas.d.ts.map +1 -1
  4. package/dist/esm/currencies.shared.schemas.js.map +1 -1
  5. package/dist/esm/files/agent-file-formats.d.ts.map +1 -1
  6. package/dist/esm/files/agent-file-formats.js.map +1 -1
  7. package/dist/esm/files/extension-nature-map.d.ts.map +1 -1
  8. package/dist/esm/files/extension-nature-map.js.map +1 -1
  9. package/dist/esm/files/file-extensions.enum.d.ts.map +1 -1
  10. package/dist/esm/files/file-extensions.enum.js.map +1 -1
  11. package/dist/esm/files/mime-registry.d.ts.map +1 -1
  12. package/dist/esm/files/mime-registry.js.map +1 -1
  13. package/dist/esm/files/unified-registry.d.ts.map +1 -1
  14. package/dist/esm/files/unified-registry.js.map +1 -1
  15. package/dist/esm/index.d.ts +2 -0
  16. package/dist/esm/index.d.ts.map +1 -1
  17. package/dist/esm/index.js +2 -0
  18. package/dist/esm/index.js.map +1 -1
  19. package/dist/esm/install-bigint-json-encoding.d.ts +1 -1
  20. package/dist/esm/install-bigint-json-encoding.d.ts.map +1 -1
  21. package/dist/esm/install-bigint-json-encoding.js +1 -1
  22. package/dist/esm/install-bigint-json-encoding.js.map +1 -1
  23. package/dist/esm/testing/decorated-test-schemas.d.ts +7 -7
  24. package/dist/esm/testing/decorated-test-schemas.d.ts.map +1 -1
  25. package/dist/esm/testing/decorated-test-schemas.js.map +1 -1
  26. package/dist/esm/testing.d.ts.map +1 -1
  27. package/dist/esm/testing.js.map +1 -1
  28. package/dist/esm/zod-address.d.ts.map +1 -1
  29. package/dist/esm/zod-address.js.map +1 -1
  30. package/dist/esm/zod-bigdecimal.d.ts +4 -4
  31. package/dist/esm/zod-bigdecimal.d.ts.map +1 -1
  32. package/dist/esm/zod-bigdecimal.js.map +1 -1
  33. package/dist/esm/zod-code.d.ts +4 -4
  34. package/dist/esm/zod-code.d.ts.map +1 -1
  35. package/dist/esm/zod-code.js.map +1 -1
  36. package/dist/esm/zod-color.d.ts.map +1 -1
  37. package/dist/esm/zod-color.js.map +1 -1
  38. package/dist/esm/zod-decorators.types.d.ts +116 -9
  39. package/dist/esm/zod-decorators.types.d.ts.map +1 -1
  40. package/dist/esm/zod-decorators.types.js +40 -1
  41. package/dist/esm/zod-decorators.types.js.map +1 -1
  42. package/dist/esm/zod-document-sequence.d.ts.map +1 -1
  43. package/dist/esm/zod-document-sequence.js.map +1 -1
  44. package/dist/esm/zod-duration.d.ts +6 -6
  45. package/dist/esm/zod-duration.d.ts.map +1 -1
  46. package/dist/esm/zod-duration.js.map +1 -1
  47. package/dist/esm/zod-file.d.ts +5 -4
  48. package/dist/esm/zod-file.d.ts.map +1 -1
  49. package/dist/esm/zod-file.js +1 -1
  50. package/dist/esm/zod-file.js.map +1 -1
  51. package/dist/esm/zod-money.d.ts +4 -4
  52. package/dist/esm/zod-money.d.ts.map +1 -1
  53. package/dist/esm/zod-money.js.map +1 -1
  54. package/dist/esm/zod-phone.d.ts +4 -4
  55. package/dist/esm/zod-phone.d.ts.map +1 -1
  56. package/dist/esm/zod-phone.js.map +1 -1
  57. package/dist/esm/zod-range.d.ts.map +1 -1
  58. package/dist/esm/zod-range.js.map +1 -1
  59. package/dist/esm/zod-utils.shared.d.ts +47 -12
  60. package/dist/esm/zod-utils.shared.d.ts.map +1 -1
  61. package/dist/esm/zod-utils.shared.js +143 -40
  62. package/dist/esm/zod-utils.shared.js.map +1 -1
  63. package/dist/esm/zod-versioned.d.ts.map +1 -1
  64. package/dist/esm/zod-versioned.js.map +1 -1
  65. package/dist/esm/zod-wire-date.d.ts +107 -0
  66. package/dist/esm/zod-wire-date.d.ts.map +1 -0
  67. package/dist/esm/zod-wire-date.js +162 -0
  68. package/dist/esm/zod-wire-date.js.map +1 -0
  69. package/dist/esm/zod-year-month.d.ts +76 -0
  70. package/dist/esm/zod-year-month.d.ts.map +1 -0
  71. package/dist/esm/zod-year-month.js +115 -0
  72. package/dist/esm/zod-year-month.js.map +1 -0
  73. package/dist/esm/zod.module-override.d.ts +139 -156
  74. package/dist/esm/zod.module-override.d.ts.map +1 -1
  75. package/dist/esm/zod.module-override.js +176 -6
  76. package/dist/esm/zod.module-override.js.map +1 -1
  77. package/dist/tsconfig.build.tsbuildinfo +1 -1
  78. package/package.json +5 -5
@@ -9,162 +9,31 @@ export type EnumStringValues<T extends EnumLikeType> = EnumValues<T> extends str
9
9
  export declare const ZodDecorator_ApplyableType: Record<ZodDecorator, string[]>;
10
10
  type DecoratorFn = (this: z.ZodTypeAny, ...args: any[]) => DecoratedPrimitiveZodType<z.ZodTypeAny>;
11
11
  export declare const ZodDecorator_FunctionType: Record<string, DecoratorFn>;
12
- export type DecoratedPrimitiveZodType<T extends z.ZodTypeAny = z.ZodTypeAny> = T & {
13
- /** @wildo_source:part:start zod.decorators.shared-structural-methods facet:layer:shared facet:family:decorator facet:family:method-surface */
14
- [ZodDecorator.IS_DB_INDEXED](): DecoratedPrimitiveZodType<T>;
15
- [ZodDecorator.IS_FOREIGN_KEY](params?: ZodDecorator_ParamsType[ZodDecorator.IS_FOREIGN_KEY]): DecoratedPrimitiveZodType<T>;
16
- [ZodDecorator.IS_SUMMARY_FIELD](params?: ZodDecorator_ParamsType[ZodDecorator.IS_SUMMARY_FIELD]): DecoratedPrimitiveZodType<T>;
17
- [ZodDecorator.IS_BACKEND_ONLY](params?: ZodDecorator_ParamsType[ZodDecorator.IS_BACKEND_ONLY]): DecoratedPrimitiveZodType<T>;
18
- [ZodDecorator.IS_WRITE_ONLY_SECRET](params?: ZodDecorator_ParamsType[ZodDecorator.IS_WRITE_ONLY_SECRET]): DecoratedPrimitiveZodType<T>;
19
- [ZodDecorator.IS_DISCRIMINATOR](params?: ZodDecorator_ParamsType[ZodDecorator.IS_DISCRIMINATOR]): DecoratedPrimitiveZodType<T>;
20
- [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedPrimitiveZodType<T>;
21
- [ZodDecorator.EXCLUDE_FROM_UPDATE](): DecoratedPrimitiveZodType<T>;
22
- [ZodDecorator.IS_UNIQUE](params?: ZodDecorator_ParamsType[ZodDecorator.IS_UNIQUE]): DecoratedPrimitiveZodType<T>;
23
- [ZodDecorator.IS_PRIMARY_KEY](): DecoratedPrimitiveZodType<T>;
24
- [ZodDecorator.IS_BUSINESS_KEY](): DecoratedPrimitiveZodType<T>;
25
- [ZodDecorator.DOCUMENT_SEQUENCE](params: DocumentSequenceParams): DecoratedPrimitiveZodType<T>;
26
- [ZodDecorator.OBJECT_BUSINESS_KEY_SET](fields: string[], params?: Omit<BusinessKeySetParams, 'fields'>): DecoratedPrimitiveZodType<T>;
27
- [ZodDecorator.RESOURCE_REFERENCE](params: ResourceReferenceParams): DecoratedPrimitiveZodType<T>;
28
- [ZodDecorator.TTL](params: ZodDecorator_ParamsType[ZodDecorator.TTL]): DecoratedPrimitiveZodType<T>;
29
- /**
30
- * `z.date().isCalendarDate()` — the date is a CALENDAR DAY (a due date, a birthday, an invoice date), not an
31
- * instant. It is held as UTC midnight of the day and shown and picked as that day for every reader, whatever
32
- * their time zone; "tomorrow" is still measured from the reader's today. Leave it off a moment in time
33
- * (`createdAt`, `expiresAt`, `completedAt`): an undeclared date is an instant, shown in the reader's zone.
34
- * A day has no time of day, so it cannot also declare `dateTimeUI()`: combining the two throws when the schema
35
- * loads. Use `dateUI()` to style a calendar date's display, and `dateTimeUI()` alone for a moment.
36
- */
37
- [ZodDecorator.IS_CALENDAR_DATE](): DecoratedPrimitiveZodType<T>;
38
- /** @wildo_source:part:end zod.decorators.shared-structural-methods */
39
- [ZodDecorator.IMPERSONALIZE_WITH](treatment: string, options?: Omit<ImpersonalizeFieldParams, 'treatment'>): DecoratedPrimitiveZodType<T>;
40
- [ZodDecorator.PORTABILITY_PROVENANCE](provenance: string): DecoratedPrimitiveZodType<T>;
41
- /**
42
- * @wildo_source:part:start zod.decorators.data-categories facet:layer:shared facet:family:decorator facet:kind:api facet:audience:app-developer facet:family:method-surface
43
- *
44
- * Declare WHICH KINDS of personal data this field holds — the vocabulary a privacy notice
45
- * enumerates. Import `PersonalDataCategory` from `@wildo-ai/saas-models`.
46
- *
47
- * Accepts a single category (the common case) or an array when a field genuinely spans two. At
48
- * least one is required: a field that holds NO personal data carries no declaration at all, and
49
- * that absence is exactly what the compliance gap report reads.
50
- *
51
- * Declare it on the field that holds the value. Never on a field merely because its NAME suggests
52
- * a category — `credentials` is the one category the framework derives for you, and it derives it
53
- * from `.isPassword()` / `.isOtp()` / `.isWriteOnlySecret()`, never from an identifier.
54
- *
55
- * `options.personalOnlyWhen` takes a `PersonalDataCondition` (also from `@wildo-ai/saas-models`)
56
- * for a field that is personal data only on some rows. The case it exists for is a field naming
57
- * the PARTY a row describes — a customer account, a supplier: it is an individual's data when that
58
- * party is a sole trader, and a company's when it is not. The field still counts as personal data
59
- * for erasure, export and every guard; the privacy notice lists it as held "where the customer is
60
- * an individual" instead of claiming it about every customer. Do not use it for a field naming a
61
- * person AT a company (a contact's email): that is personal on every row.
62
- *
63
- * `options.aboutAnotherParty: true` says the field names a party OTHER than the one the row is about: a
64
- * copy of another organization's name kept on a cost record or a relationship. It decides only one thing:
65
- * a resource declaring `retentionPolicy: RETAIN_ONLY` ("no personal data about its own subject") may keep
66
- * such a copy. Leave it off the row's own party's name (a customer account's own name), which that
67
- * resource may not keep.
68
- *
69
- * @example
70
- * fullName: z.string().dataCategories(PersonalDataCategory.IDENTITY)
71
- * @example
72
- * email: z.email().nullish().dataCategories(PersonalDataCategory.CONTACT_DETAILS)
73
- * @example
74
- * // A field that genuinely spans two — an array never forces you to pick a lie.
75
- * dietaryNotes: z.string().dataCategories([PersonalDataCategory.USER_CONTENT, PersonalDataCategory.SPECIAL_CATEGORY_HEALTH])
76
- * @example
77
- * // A customer account's name: a person's data only when the customer is a sole trader.
78
- * accountName: z.string().dataCategories(PersonalDataCategory.IDENTITY, { personalOnlyWhen: PersonalDataCondition.DESCRIBED_PARTY_IS_A_NATURAL_PERSON })
79
- * @example
80
- * // The billed customer's name copied onto an invoice line: another party's name, not the line's subject.
81
- * customerName: z.string().dataCategories(PersonalDataCategory.IDENTITY, { personalOnlyWhen: PersonalDataCondition.DESCRIBED_PARTY_IS_A_NATURAL_PERSON, aboutAnotherParty: true })
82
- */
83
- [ZodDecorator.DATA_CATEGORIES](categories: string | readonly string[], options?: DataCategoriesOptions): DecoratedPrimitiveZodType<T>;
84
- /** @wildo_source:part:end zod.decorators.data-categories */
85
- [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<T>;
86
- /**
87
- * `.isLastActionRecord()` — this row field holds what the most recent action said about itself (the reason
88
- * given for a decision), so a form that starts from the row never offers it as the next action's starting
89
- * value. Mark it where an action REPLACES the field with words about that action; never on a setting an
90
- * action edits from its current value. Read back with `isLastActionRecordField(schema)`.
91
- *
92
- * @example
93
- * decisionReason: z.string().max(1000).optional().excludeFromCreate().excludeFromUpdate().isLastActionRecord()
94
- */
95
- [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<T>;
96
- /**
97
- * `.isDecider()` — this row field records which person decided something on the row (who approved, accepted,
98
- * placed, released). The declaration of the verb that writes it names it (`approvalSeal.decides`, #2906); the engine
99
- * checks that over its own resources. Read back with `isDeciderField(schema)`.
100
- *
101
- * @example
102
- * decidedByUserId: z.string().optional().excludeFromCreate().excludeFromUpdate().isDecider()
103
- */
104
- [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<T>;
105
- /**
106
- * @wildo_source:part:start zod.decorators.rag-source facet:layer:shared facet:family:decorator facet:family:method-surface facet:kind:api facet:audience:app-developer
107
- *
108
- * `.ragSource(config?)` — declare this field's text a source of the application's retrieval
109
- * corpus. Live on every string-backed schema (`z.string()` and every string FORMAT such as
110
- * `z.email()` / `z.url()`) and carried across the `.optional()` / `.nullable()` / `.default()`
111
- * wrappers, so it composes anywhere in a decorator chain.
112
- *
113
- * The config is OPTIONAL and there is no `enabled` flag: a bare `.ragSource()` is a complete
114
- * declaration that accepts the framework chunking defaults. Presence IS enablement.
115
- *
116
- * @example
117
- * z.string().ragSource()
118
- * @example
119
- * z.string().ragSource({ chunkingStrategy: RAGChunkingStrategy.MARKDOWN, chunkSize: 1200, chunkOverlap: 150 }).optional()
120
- */
121
- [ZodDecorator.RAG_SOURCE](config?: RagSourceConfiguration): DecoratedPrimitiveZodType<T>;
122
- /** @wildo_source:part:end zod.decorators.rag-source */
123
- [ZodDecorator.IS_HIDDEN](params?: ZodDecorator_ParamsType[ZodDecorator.IS_HIDDEN]): DecoratedPrimitiveZodType<T>;
124
- [ZodDecorator.IS_NOT_EDITABLE](params?: ZodDecorator_ParamsType[ZodDecorator.IS_NOT_EDITABLE]): DecoratedPrimitiveZodType<T>;
125
- [ZodDecorator.IS_VIRTUAL](params: ZodDecorator_ParamsType[ZodDecorator.IS_VIRTUAL]): DecoratedPrimitiveZodType<T>;
126
- [ZodDecorator.IS_PASSWORD](): DecoratedPrimitiveZodType<T>;
127
- [ZodDecorator.IS_OTP](params?: ZodDecorator_ParamsType[ZodDecorator.IS_OTP]): DecoratedPrimitiveZodType<T>;
128
- [ZodDecorator.IS_COLOR](): DecoratedPrimitiveZodType<T>;
129
- [ZodDecorator.IS_DRAFT_RELAXED](): DecoratedPrimitiveZodType<T>;
130
- [ZodDecorator.SHOW_WHEN](params: ZodDecorator_ParamsType[ZodDecorator.SHOW_WHEN]): DecoratedPrimitiveZodType<T>;
131
- [ZodDecorator.SYSTEM_ENUM](name: string): DecoratedPrimitiveZodType<T>;
132
- [ZodDecorator.IS_EPHEMERAL](): DecoratedPrimitiveZodType<T>;
133
- [ZodDecorator.IS_CRDT](): DecoratedPrimitiveZodType<T>;
134
- [ZodDecorator.BOOLEAN_UI](params?: ZodDecorator_ParamsType[ZodDecorator.BOOLEAN_UI]): DecoratedPrimitiveZodType<T>;
135
- [ZodDecorator.STRING_UI](params?: ZodDecorator_ParamsType[ZodDecorator.STRING_UI]): DecoratedPrimitiveZodType<T>;
136
- [ZodDecorator.NUMBER_UI](params?: ZodDecorator_ParamsType[ZodDecorator.NUMBER_UI]): DecoratedPrimitiveZodType<T>;
137
- [ZodDecorator.ENUM_UI](params?: ZodDecorator_ParamsType[ZodDecorator.ENUM_UI]): DecoratedPrimitiveZodType<T>;
138
- [ZodDecorator.DATE_UI](params?: ZodDecorator_ParamsType[ZodDecorator.DATE_UI]): DecoratedPrimitiveZodType<T>;
139
- [ZodDecorator.DATETIME_UI](params?: ZodDecorator_ParamsType[ZodDecorator.DATETIME_UI]): DecoratedPrimitiveZodType<T>;
140
- [ZodDecorator.TIME_UI](params?: ZodDecorator_ParamsType[ZodDecorator.TIME_UI]): DecoratedPrimitiveZodType<T>;
141
- [ZodDecorator.MONEY_UI](params?: ZodDecorator_ParamsType[ZodDecorator.MONEY_UI]): DecoratedPrimitiveZodType<T>;
142
- [ZodDecorator.CODE_UI](params?: ZodDecorator_ParamsType[ZodDecorator.CODE_UI]): DecoratedPrimitiveZodType<T>;
143
- [ZodDecorator.FILE_UI](params?: ZodDecorator_ParamsType[ZodDecorator.FILE_UI]): DecoratedPrimitiveZodType<T>;
144
- [ZodDecorator.DURATION_UI](params?: ZodDecorator_ParamsType[ZodDecorator.DURATION_UI]): DecoratedPrimitiveZodType<T>;
145
- [ZodDecorator.PHONE_UI](params?: ZodDecorator_ParamsType[ZodDecorator.PHONE_UI]): DecoratedPrimitiveZodType<T>;
146
- [ZodDecorator.BIGDECIMAL_UI](params?: ZodDecorator_ParamsType[ZodDecorator.BIGDECIMAL_UI]): DecoratedPrimitiveZodType<T>;
147
- [ZodDecorator.FOREIGN_KEY_UI](params?: ZodDecorator_ParamsType[ZodDecorator.FOREIGN_KEY_UI]): DecoratedPrimitiveZodType<T>;
148
- [ZodDecorator.ARRAY_UI](params?: ZodDecorator_ParamsType[ZodDecorator.ARRAY_UI]): DecoratedPrimitiveZodType<T>;
149
- [ZodDecorator.OBJECT_UI](params?: ZodDecorator_ParamsType[ZodDecorator.OBJECT_UI]): DecoratedPrimitiveZodType<T>;
150
- [ZodDecorator.STRING_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.STRING_SPEC]): DecoratedPrimitiveZodType<T>;
151
- [ZodDecorator.NUMBER_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.NUMBER_SPEC]): DecoratedPrimitiveZodType<T>;
152
- [ZodDecorator.BOOLEAN_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.BOOLEAN_SPEC]): DecoratedPrimitiveZodType<T>;
153
- [ZodDecorator.ENUM_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.ENUM_SPEC]): DecoratedPrimitiveZodType<T>;
154
- [ZodDecorator.DATE_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.DATE_SPEC]): DecoratedPrimitiveZodType<T>;
155
- [ZodDecorator.DATETIME_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.DATETIME_SPEC]): DecoratedPrimitiveZodType<T>;
156
- [ZodDecorator.TIME_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.TIME_SPEC]): DecoratedPrimitiveZodType<T>;
157
- [ZodDecorator.MONEY_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.MONEY_SPEC]): DecoratedPrimitiveZodType<T>;
158
- [ZodDecorator.CODE_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.CODE_SPEC]): DecoratedPrimitiveZodType<T>;
159
- [ZodDecorator.FILE_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.FILE_SPEC]): DecoratedPrimitiveZodType<T>;
160
- [ZodDecorator.DURATION_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.DURATION_SPEC]): DecoratedPrimitiveZodType<T>;
161
- [ZodDecorator.PHONE_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.PHONE_SPEC]): DecoratedPrimitiveZodType<T>;
162
- [ZodDecorator.BIGDECIMAL_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.BIGDECIMAL_SPEC]): DecoratedPrimitiveZodType<T>;
163
- [ZodDecorator.FOREIGN_KEY_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.FOREIGN_KEY_SPEC]): DecoratedPrimitiveZodType<T>;
164
- [ZodDecorator.ARRAY_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.ARRAY_SPEC]): DecoratedPrimitiveZodType<T>;
165
- [ZodDecorator.OBJECT_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.OBJECT_SPEC]): DecoratedPrimitiveZodType<T>;
166
- addDecorators(decorators: DecoratorInput[]): DecoratedPrimitiveZodType<T>;
167
- };
12
+ /**
13
+ * The type every decorator returns: the schema's OWN type, and nothing more (#3031).
14
+ *
15
+ * A decorated schema keeps exactly the chainable surface its `declare module 'zod'` interface declares
16
+ * below, because every declared member returns `DecoratedPrimitiveZodType<this>`. So
17
+ * `z.enum(X).isDBIndexed()` is a `ZodEnum<…>` and offers what `ZodEnum` declares; `.isUnique()` on it is a
18
+ * compile error, as it is on the bare enum.
19
+ *
20
+ * WHY NOT `T & { …every decorator… }`, which this was until 2026-11-06. That intersection declared all of
21
+ * them on every schema after its first decoration, while the runtime installs each one only where its
22
+ * interface declares it (`declared-decorator-surface-parity.contract.test.ts` holds the two equal). Measured
23
+ * on 2026-10-21: 569 (type, decorator) pairs typechecked after one decoration and threw at load, such as
24
+ * `z.enum(ModelUsageUnit).isDBIndexed().isUnique()` (TypeError while loading saas-models, `tsc` clean).
25
+ * Narrowing it broke no chain anywhere in the repository (measured 2026-11-06 over every package that
26
+ * authors one), which is what the old type was hiding: only the wrong chains needed it.
27
+ *
28
+ * REJECTED: installing the missing decorators so the old promise came true. Most of the 569 are refused on
29
+ * purpose by `ZodDecorator_ApplyableType` (`isPrimaryKey` on a boolean, `stringUI` on a number), so the
30
+ * promise was the defect, not the install. A decorator a type should carry is added to that type's
31
+ * interface and installed on its prototype, as one change.
32
+ *
33
+ * Factory schemas (`z_money()`, `z_file()`, …) keep their extra members because `this` is the factory's
34
+ * own intersection or interface, which already carries them.
35
+ */
36
+ export type DecoratedPrimitiveZodType<T extends z.ZodTypeAny = z.ZodTypeAny> = T;
168
37
  export declare function ZodDecorator_FunctionAddDecorators(this: z.ZodTypeAny, decorators: DecoratorInput[]): DecoratedPrimitiveZodType<z.ZodTypeAny>;
169
38
  export declare const defaultZodDecoSchemaProperties: {
170
39
  enumerable: boolean;
@@ -460,11 +329,89 @@ declare module 'zod' {
460
329
  [ZodDecorator.IS_WRITE_ONLY_SECRET](params?: WriteOnlySecretFieldParams): DecoratedPrimitiveZodType<this>;
461
330
  [ZodDecorator.IMPERSONALIZE_WITH](treatment: string, options?: Omit<ImpersonalizeFieldParams, 'treatment'>): DecoratedPrimitiveZodType<this>;
462
331
  [ZodDecorator.PORTABILITY_PROVENANCE](provenance: string): DecoratedPrimitiveZodType<this>;
332
+ /**
333
+ * @wildo_source:part:start zod.decorators.data-categories facet:layer:shared facet:family:decorator facet:kind:api facet:audience:app-developer facet:family:method-surface
334
+ *
335
+ * Declare WHICH KINDS of personal data this field holds — the vocabulary a privacy notice
336
+ * enumerates. Import `PersonalDataCategory` from `@wildo-ai/saas-models`.
337
+ *
338
+ * Accepts a single category (the common case) or an array when a field genuinely spans two. At
339
+ * least one is required: a field that holds NO personal data carries no declaration at all, and
340
+ * that absence is exactly what the compliance gap report reads.
341
+ *
342
+ * Declare it on the field that holds the value. Never on a field merely because its NAME suggests
343
+ * a category — `credentials` is the one category the framework derives for you, and it derives it
344
+ * from `.isPassword()` / `.isOtp()` / `.isWriteOnlySecret()`, never from an identifier.
345
+ *
346
+ * `options.personalOnlyWhen` takes a `PersonalDataCondition` (also from `@wildo-ai/saas-models`)
347
+ * for a field that is personal data only on some rows. The case it exists for is a field naming
348
+ * the PARTY a row describes — a customer account, a supplier: it is an individual's data when that
349
+ * party is a sole trader, and a company's when it is not. The field still counts as personal data
350
+ * for erasure, export and every guard; the privacy notice lists it as held "where the customer is
351
+ * an individual" instead of claiming it about every customer. Do not use it for a field naming a
352
+ * person AT a company (a contact's email): that is personal on every row.
353
+ *
354
+ * `options.aboutAnotherParty: true` says the field names a party OTHER than the one the row is about: a
355
+ * copy of another organization's name kept on a cost record or a relationship. It decides only one thing:
356
+ * a resource declaring `retentionPolicy: RETAIN_ONLY` ("no personal data about its own subject") may keep
357
+ * such a copy. Leave it off the row's own party's name (a customer account's own name), which that
358
+ * resource may not keep.
359
+ *
360
+ * @example
361
+ * fullName: z.string().dataCategories(PersonalDataCategory.IDENTITY)
362
+ * @example
363
+ * email: z.email().nullish().dataCategories(PersonalDataCategory.CONTACT_DETAILS)
364
+ * @example
365
+ * // A field that genuinely spans two — an array never forces you to pick a lie.
366
+ * dietaryNotes: z.string().dataCategories([PersonalDataCategory.USER_CONTENT, PersonalDataCategory.SPECIAL_CATEGORY_HEALTH])
367
+ * @example
368
+ * // A customer account's name: a person's data only when the customer is a sole trader.
369
+ * accountName: z.string().dataCategories(PersonalDataCategory.IDENTITY, { personalOnlyWhen: PersonalDataCondition.DESCRIBED_PARTY_IS_A_NATURAL_PERSON })
370
+ * @example
371
+ * // The billed customer's name copied onto an invoice line: another party's name, not the line's subject.
372
+ * customerName: z.string().dataCategories(PersonalDataCategory.IDENTITY, { personalOnlyWhen: PersonalDataCondition.DESCRIBED_PARTY_IS_A_NATURAL_PERSON, aboutAnotherParty: true })
373
+ */
463
374
  [ZodDecorator.DATA_CATEGORIES](categories: string | readonly string[], options?: DataCategoriesOptions): DecoratedPrimitiveZodType<this>;
375
+ /** @wildo_source:part:end zod.decorators.data-categories */
464
376
  [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<this>;
377
+ /**
378
+ * `.isLastActionRecord()` — this row field holds what the most recent action said about itself (the reason
379
+ * given for a decision), so a form that starts from the row never offers it as the next action's starting
380
+ * value. Mark it where an action REPLACES the field with words about that action; never on a setting an
381
+ * action edits from its current value. Read back with `isLastActionRecordField(schema)`.
382
+ *
383
+ * @example
384
+ * decisionReason: z.string().max(1000).optional().excludeFromCreate().excludeFromUpdate().isLastActionRecord()
385
+ */
465
386
  [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<this>;
387
+ /**
388
+ * `.isDecider()` — this row field records which person decided something on the row (who approved, accepted,
389
+ * placed, released). The declaration of the verb that writes it names it (`approvalSeal.decides`, #2906); the engine
390
+ * checks that over its own resources. Read back with `isDeciderField(schema)`.
391
+ *
392
+ * @example
393
+ * decidedByUserId: z.string().optional().excludeFromCreate().excludeFromUpdate().isDecider()
394
+ */
466
395
  [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<this>;
396
+ [ZodDecorator.IS_ROLE_GRANT](): DecoratedPrimitiveZodType<this>;
397
+ /**
398
+ * @wildo_source:part:start zod.decorators.rag-source facet:layer:shared facet:family:decorator facet:family:method-surface facet:kind:api facet:audience:app-developer
399
+ *
400
+ * `.ragSource(config?)` — declare this field's text a source of the application's retrieval
401
+ * corpus. Live on every string-backed schema (`z.string()` and every string FORMAT such as
402
+ * `z.email()` / `z.url()`) and carried across the `.optional()` / `.nullable()` / `.default()`
403
+ * wrappers, so it composes anywhere in a decorator chain.
404
+ *
405
+ * The config is OPTIONAL and there is no `enabled` flag: a bare `.ragSource()` is a complete
406
+ * declaration that accepts the framework chunking defaults. Presence IS enablement.
407
+ *
408
+ * @example
409
+ * z.string().ragSource()
410
+ * @example
411
+ * z.string().ragSource({ chunkingStrategy: RAGChunkingStrategy.MARKDOWN, chunkSize: 1200, chunkOverlap: 150 }).optional()
412
+ */
467
413
  [ZodDecorator.RAG_SOURCE](config?: RagSourceConfiguration): DecoratedPrimitiveZodType<this>;
414
+ /** @wildo_source:part:end zod.decorators.rag-source */
468
415
  [ZodDecorator.IS_VIRTUAL](params: VirtualFieldParams): DecoratedPrimitiveZodType<this>;
469
416
  [ZodDecorator.IS_DISCRIMINATOR](params?: DiscriminatorFieldParams): DecoratedPrimitiveZodType<this>;
470
417
  [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedPrimitiveZodType<this>;
@@ -503,6 +450,7 @@ declare module 'zod' {
503
450
  [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<this>;
504
451
  [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<this>;
505
452
  [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<this>;
453
+ [ZodDecorator.IS_ROLE_GRANT](): DecoratedPrimitiveZodType<this>;
506
454
  [ZodDecorator.RAG_SOURCE](config?: RagSourceConfiguration): DecoratedPrimitiveZodType<this>;
507
455
  [ZodDecorator.IS_VIRTUAL](params: VirtualFieldParams): DecoratedPrimitiveZodType<this>;
508
456
  [ZodDecorator.IS_DISCRIMINATOR](params?: DiscriminatorFieldParams): DecoratedPrimitiveZodType<this>;
@@ -539,6 +487,7 @@ declare module 'zod' {
539
487
  [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<this>;
540
488
  [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<this>;
541
489
  [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<this>;
490
+ [ZodDecorator.IS_ROLE_GRANT](): DecoratedPrimitiveZodType<this>;
542
491
  [ZodDecorator.IS_VIRTUAL](params: VirtualFieldParams): DecoratedPrimitiveZodType<this>;
543
492
  [ZodDecorator.IS_DISCRIMINATOR](params?: DiscriminatorFieldParams): DecoratedPrimitiveZodType<this>;
544
493
  [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedPrimitiveZodType<this>;
@@ -565,6 +514,7 @@ declare module 'zod' {
565
514
  [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<this>;
566
515
  [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<this>;
567
516
  [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<this>;
517
+ [ZodDecorator.IS_ROLE_GRANT](): DecoratedPrimitiveZodType<this>;
568
518
  [ZodDecorator.IS_VIRTUAL](params: VirtualFieldParams): DecoratedPrimitiveZodType<this>;
569
519
  [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedPrimitiveZodType<this>;
570
520
  [ZodDecorator.EXCLUDE_FROM_UPDATE](): DecoratedPrimitiveZodType<this>;
@@ -588,6 +538,7 @@ declare module 'zod' {
588
538
  [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<this>;
589
539
  [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<this>;
590
540
  [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<this>;
541
+ [ZodDecorator.IS_ROLE_GRANT](): DecoratedPrimitiveZodType<this>;
591
542
  [ZodDecorator.IS_VIRTUAL](params: VirtualFieldParams): DecoratedPrimitiveZodType<this>;
592
543
  [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedPrimitiveZodType<this>;
593
544
  [ZodDecorator.EXCLUDE_FROM_UPDATE](): DecoratedPrimitiveZodType<this>;
@@ -613,13 +564,24 @@ declare module 'zod' {
613
564
  [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<this>;
614
565
  [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<this>;
615
566
  [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<this>;
567
+ [ZodDecorator.IS_ROLE_GRANT](): DecoratedPrimitiveZodType<this>;
616
568
  [ZodDecorator.IS_VIRTUAL](params: VirtualFieldParams): DecoratedPrimitiveZodType<this>;
617
569
  [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedPrimitiveZodType<this>;
618
570
  [ZodDecorator.EXCLUDE_FROM_UPDATE](): DecoratedPrimitiveZodType<this>;
619
571
  [ZodDecorator.TTL](params: TtlFieldParams): DecoratedPrimitiveZodType<this>;
620
572
  [ZodDecorator.IS_CRDT](): DecoratedPrimitiveZodType<this>;
621
573
  [ZodDecorator.DATE_UI](params?: ZodDecorator_ParamsType[ZodDecorator.DATE_UI]): DecoratedPrimitiveZodType<this>;
574
+ /** @wildo_source:part:start zod.decorators.shared-structural-methods facet:layer:shared facet:family:decorator facet:family:method-surface */
575
+ /**
576
+ * `z.date().isCalendarDate()` — the date is a CALENDAR DAY (a due date, a birthday, an invoice date), not an
577
+ * instant. It is held as UTC midnight of the day and shown and picked as that day for every reader, whatever
578
+ * their time zone; "tomorrow" is still measured from the reader's today. Leave it off a moment in time
579
+ * (`createdAt`, `expiresAt`, `completedAt`): an undeclared date is an instant, shown in the reader's zone.
580
+ * A day has no time of day, so it cannot also declare `dateTimeUI()`: combining the two throws when the schema
581
+ * loads. Use `dateUI()` to style a calendar date's display, and `dateTimeUI()` alone for a moment.
582
+ */
622
583
  [ZodDecorator.IS_CALENDAR_DATE](): DecoratedPrimitiveZodType<this>;
584
+ /** @wildo_source:part:end zod.decorators.shared-structural-methods */
623
585
  [ZodDecorator.DATE_SPEC](params?: ZodDecorator_ParamsType[ZodDecorator.DATE_SPEC]): DecoratedPrimitiveZodType<this>;
624
586
  [ZodDecorator.SHOW_WHEN](params: ZodDecorator_ParamsType[ZodDecorator.SHOW_WHEN]): DecoratedPrimitiveZodType<this>;
625
587
  [ZodDecorator.IS_DRAFT_RELAXED](): DecoratedPrimitiveZodType<this>;
@@ -642,6 +604,7 @@ declare module 'zod' {
642
604
  [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<this>;
643
605
  [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<this>;
644
606
  [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<this>;
607
+ [ZodDecorator.IS_ROLE_GRANT](): DecoratedPrimitiveZodType<this>;
645
608
  [ZodDecorator.IS_VIRTUAL](params: VirtualFieldParams): DecoratedPrimitiveZodType<this>;
646
609
  [ZodDecorator.IS_DISCRIMINATOR](params?: DiscriminatorFieldParams): DecoratedPrimitiveZodType<this>;
647
610
  [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedPrimitiveZodType<this>;
@@ -675,6 +638,15 @@ declare module 'zod' {
675
638
  [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<this>;
676
639
  [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<this>;
677
640
  [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<this>;
641
+ /**
642
+ * `.isRoleGrant()` — this field's values are roles the writer grants, so a form offers only the roles the person
643
+ * filling it may grant, plus any the record already holds (#3248). Mark a field a form offers roles in, where the
644
+ * write is checked against the writer's role ceiling. Read back with `isRoleGrantField(schema)`.
645
+ *
646
+ * @example
647
+ * roles: z.array(OrgRolesSchema).default([]).isRoleGrant()
648
+ */
649
+ [ZodDecorator.IS_ROLE_GRANT](): DecoratedPrimitiveZodType<this>;
678
650
  [ZodDecorator.IS_VIRTUAL](params: VirtualFieldParams): DecoratedPrimitiveZodType<this>;
679
651
  [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedPrimitiveZodType<this>;
680
652
  [ZodDecorator.EXCLUDE_FROM_UPDATE](): DecoratedPrimitiveZodType<this>;
@@ -702,6 +674,8 @@ declare module 'zod' {
702
674
  [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<this>;
703
675
  [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<this>;
704
676
  [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<this>;
677
+ /** `.isRoleGrant()`: the field's values are roles the writer grants. Documented on `ZodArray`. */
678
+ [ZodDecorator.IS_ROLE_GRANT](): DecoratedPrimitiveZodType<this>;
705
679
  [ZodDecorator.RAG_SOURCE](config?: RagSourceConfiguration): DecoratedPrimitiveZodType<this>;
706
680
  [ZodDecorator.IS_HIDDEN](params?: ZodDecorator_ParamsType[ZodDecorator.IS_HIDDEN]): DecoratedPrimitiveZodType<this>;
707
681
  [ZodDecorator.IS_NOT_EDITABLE](params?: ZodDecorator_ParamsType[ZodDecorator.IS_NOT_EDITABLE]): DecoratedPrimitiveZodType<this>;
@@ -769,8 +743,11 @@ declare module 'zod' {
769
743
  [ZodDecorator.PORTABILITY_PROVENANCE](provenance: string): DecoratedPrimitiveZodType<this>;
770
744
  [ZodDecorator.DATA_CATEGORIES](categories: string | readonly string[], options?: DataCategoriesOptions): DecoratedPrimitiveZodType<this>;
771
745
  [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<this>;
746
+ /** `.isLastActionRecord()`: the field holds what the most recent action said about itself. Documented on `ZodString`. */
772
747
  [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<this>;
748
+ /** `.isDecider()`: the field records which person decided something on the row. Documented on `ZodString`. */
773
749
  [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<this>;
750
+ [ZodDecorator.IS_ROLE_GRANT](): DecoratedPrimitiveZodType<this>;
774
751
  [ZodDecorator.RAG_SOURCE](config?: RagSourceConfiguration): DecoratedPrimitiveZodType<this>;
775
752
  [ZodDecorator.IS_HIDDEN](params?: ZodDecorator_ParamsType[ZodDecorator.IS_HIDDEN]): DecoratedPrimitiveZodType<this>;
776
753
  [ZodDecorator.IS_NOT_EDITABLE](params?: ZodDecorator_ParamsType[ZodDecorator.IS_NOT_EDITABLE]): DecoratedPrimitiveZodType<this>;
@@ -835,6 +812,7 @@ declare module 'zod' {
835
812
  [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<this>;
836
813
  [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<this>;
837
814
  [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<this>;
815
+ [ZodDecorator.IS_ROLE_GRANT](): DecoratedPrimitiveZodType<this>;
838
816
  [ZodDecorator.RAG_SOURCE](config?: RagSourceConfiguration): DecoratedPrimitiveZodType<this>;
839
817
  [ZodDecorator.IS_VIRTUAL](params: VirtualFieldParams): DecoratedPrimitiveZodType<this>;
840
818
  [ZodDecorator.IS_DISCRIMINATOR](params?: DiscriminatorFieldParams): DecoratedPrimitiveZodType<this>;
@@ -901,6 +879,7 @@ declare module 'zod' {
901
879
  [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<this>;
902
880
  [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<this>;
903
881
  [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<this>;
882
+ [ZodDecorator.IS_ROLE_GRANT](): DecoratedPrimitiveZodType<this>;
904
883
  [ZodDecorator.IS_VIRTUAL](params: VirtualFieldParams): DecoratedPrimitiveZodType<this>;
905
884
  [ZodDecorator.IS_DISCRIMINATOR](params?: DiscriminatorFieldParams): DecoratedPrimitiveZodType<this>;
906
885
  [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedPrimitiveZodType<this>;
@@ -921,11 +900,13 @@ declare module 'zod' {
921
900
  [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<this>;
922
901
  [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<this>;
923
902
  [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<this>;
903
+ [ZodDecorator.IS_ROLE_GRANT](): DecoratedPrimitiveZodType<this>;
924
904
  [ZodDecorator.IS_VIRTUAL](params: VirtualFieldParams): DecoratedPrimitiveZodType<this>;
925
905
  [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedPrimitiveZodType<this>;
926
906
  [ZodDecorator.EXCLUDE_FROM_UPDATE](): DecoratedPrimitiveZodType<this>;
927
907
  [ZodDecorator.IS_CRDT](): DecoratedPrimitiveZodType<this>;
928
908
  [ZodDecorator.OBJECT_BUSINESS_KEY_SET](fields: string[], params?: Omit<BusinessKeySetParams, 'fields'>): DecoratedPrimitiveZodType<this>;
909
+ [ZodDecorator.OBJECT_COMPOUND_INDEX](fields: string[]): DecoratedPrimitiveZodType<this>;
929
910
  [ZodDecorator.RESOURCE_REFERENCE](params: ResourceReferenceParams): DecoratedPrimitiveZodType<this>;
930
911
  [ZodDecorator.SHOW_WHEN](params: ZodDecorator_ParamsType[ZodDecorator.SHOW_WHEN]): DecoratedPrimitiveZodType<this>;
931
912
  [ZodDecorator.IS_DRAFT_RELAXED](): DecoratedPrimitiveZodType<this>;
@@ -946,6 +927,7 @@ declare module 'zod' {
946
927
  [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<this>;
947
928
  [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<this>;
948
929
  [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<this>;
930
+ [ZodDecorator.IS_ROLE_GRANT](): DecoratedPrimitiveZodType<this>;
949
931
  [ZodDecorator.IS_VIRTUAL](params: VirtualFieldParams): DecoratedPrimitiveZodType<this>;
950
932
  [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedPrimitiveZodType<this>;
951
933
  [ZodDecorator.EXCLUDE_FROM_UPDATE](): DecoratedPrimitiveZodType<this>;
@@ -968,6 +950,7 @@ declare module 'zod' {
968
950
  [ZodDecorator.IS_AUDIT_EVIDENCE](): DecoratedPrimitiveZodType<this>;
969
951
  [ZodDecorator.IS_LAST_ACTION_RECORD](): DecoratedPrimitiveZodType<this>;
970
952
  [ZodDecorator.IS_DECIDER](): DecoratedPrimitiveZodType<this>;
953
+ [ZodDecorator.IS_ROLE_GRANT](): DecoratedPrimitiveZodType<this>;
971
954
  [ZodDecorator.IS_VIRTUAL](params: VirtualFieldParams): DecoratedPrimitiveZodType<this>;
972
955
  [ZodDecorator.EXCLUDE_FROM_CREATE](): DecoratedPrimitiveZodType<this>;
973
956
  [ZodDecorator.EXCLUDE_FROM_UPDATE](): DecoratedPrimitiveZodType<this>;