mobx-tanstack-query-api 0.37.1 → 0.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli.d.ts CHANGED
@@ -184,6 +184,32 @@ interface GenerateQueryApiParams {
184
184
  * [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#nobarrelfiles)
185
185
  */
186
186
  noBarrelFiles?: boolean;
187
+ /**
188
+ * Generate Zod contracts (params + data schemas) for each endpoint and add `contracts` to the endpoint config.
189
+ * When truthy, can also enable validation via `validateContracts` in the endpoint config.
190
+ * Requires `zod` to be installed.
191
+ *
192
+ * - `true`: generate contracts and set `validateContracts: true` (validate params + data).
193
+ * - `false`: no contracts, no validation.
194
+ * - `{ validate: boolean }`: set `validateContracts` to that boolean.
195
+ * - `{ validate: string }`: set `validateContracts` to the expression (inserted as-is). E.g. `"process.env.NODE_ENV === 'development'"`.
196
+ * - `{ validate: { params?: boolean | string; data?: boolean | string } }`: set `validateContracts` to an object; each value is literal or expression (string inserted as-is).
197
+ *
198
+ * When using an object form, optional `throw` controls `throwContracts` (throw on validation errors vs warn):
199
+ * - `{ throw: boolean }`: set `throwContracts` to that boolean.
200
+ * - `{ throw: string }`: set `throwContracts` to the expression (inserted as-is).
201
+ * - `{ throw: { params?: boolean | string; data?: boolean | string } }`: set `throwContracts` to an object; each value is literal or expression (string inserted as-is).
202
+ */
203
+ zodContracts?: boolean | {
204
+ validate: boolean | string | {
205
+ params?: boolean | string;
206
+ data?: boolean | string;
207
+ };
208
+ throw?: boolean | string | {
209
+ params?: boolean | string;
210
+ data?: boolean | string;
211
+ };
212
+ };
187
213
  }
188
214
 
189
215
  type AllImportFileParams = Record<KeyOfByValue<Required<GenerateQueryApiParams>, 'builtin' | ImportFileParams>, ImportFileParams>;