@ai-sdk/gateway 4.0.141 → 4.0.143

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ai-sdk/gateway",
3
3
  "private": false,
4
- "version": "4.0.141",
4
+ "version": "4.0.143",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "sideEffects": false,
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@ai-sdk/provider": "4.0.37",
34
- "@ai-sdk/provider-utils": "5.0.78",
34
+ "@ai-sdk/provider-utils": "5.0.79",
35
35
  "@vercel/oidc": "3.2.0"
36
36
  },
37
37
  "devDependencies": {
@@ -42,7 +42,7 @@
42
42
  "tsdown": "^0.23.0",
43
43
  "tsx": "4.23.12",
44
44
  "typescript": "6.0.3",
45
- "zod": "3.25.76"
45
+ "zod": "4.6.7"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "zod": "^3.25.76 || ^4.1.8"
@@ -153,11 +153,11 @@ const gatewayErrorResponseSchema = lazySchema(() =>
153
153
  z.object({
154
154
  error: z.object({
155
155
  message: z.string(),
156
- type: z.string().nullish(),
157
- param: z.unknown().nullish(),
158
- code: z.union([z.string(), z.number()]).nullish(),
156
+ type: z.nullish(z.string()),
157
+ param: z.nullish(z.unknown()),
158
+ code: z.nullish(z.union([z.string(), z.number()])),
159
159
  }),
160
- generationId: z.string().nullish(),
160
+ generationId: z.nullish(z.string()),
161
161
  }),
162
162
  ),
163
163
  );
@@ -489,30 +489,31 @@ async function* convertGatewayBatchResultLines(
489
489
 
490
490
  const gatewayBatchItemResultLineSchema = lazySchema(() =>
491
491
  zodSchema(
492
- z
493
- .object({
492
+ z.catchall(
493
+ z.object({
494
494
  type: z.literal('text'),
495
495
  id: z.string(),
496
496
  status: z.enum(['cancelled', 'expired', 'failed', 'succeeded']),
497
- })
498
- .catchall(z.unknown()),
497
+ }),
498
+ z.unknown(),
499
+ ),
499
500
  ),
500
501
  );
501
502
 
502
503
  const gatewayBatchErrorSchema = () =>
503
504
  z.object({
504
505
  message: z.string(),
505
- type: z.string().nullish(),
506
- code: z.string().nullish(),
507
- statusCode: z.number().nullish(),
506
+ type: z.nullish(z.string()),
507
+ code: z.nullish(z.string()),
508
+ statusCode: z.nullish(z.number()),
508
509
  });
509
510
 
510
511
  const gatewayBatchRequestCountsSchema = () =>
511
512
  z.object({
512
- total: z.number().nullish(),
513
- pending: z.number().nullish(),
514
- completed: z.number().nullish(),
515
- failed: z.number().nullish(),
513
+ total: z.nullish(z.number()),
514
+ pending: z.nullish(z.number()),
515
+ completed: z.nullish(z.number()),
516
+ failed: z.nullish(z.number()),
516
517
  });
517
518
 
518
519
  const gatewayBatchProviderMetadataSchema = () =>
@@ -521,28 +522,29 @@ const gatewayBatchProviderMetadataSchema = () =>
521
522
  const gatewayBatchStatusFieldsSchema = () =>
522
523
  z.object({
523
524
  status: z.enum(['completed', 'failed', 'pending']),
524
- rawStatus: z.string().nullish(),
525
- requestCounts: gatewayBatchRequestCountsSchema().nullish(),
526
- error: gatewayBatchErrorSchema().nullish(),
527
- createdAt: z.string().nullish(),
528
- expiresAt: z.string().nullish(),
529
- providerMetadata: gatewayBatchProviderMetadataSchema().nullish(),
525
+ rawStatus: z.nullish(z.string()),
526
+ requestCounts: z.nullish(gatewayBatchRequestCountsSchema()),
527
+ error: z.nullish(gatewayBatchErrorSchema()),
528
+ createdAt: z.nullish(z.string()),
529
+ expiresAt: z.nullish(z.string()),
530
+ providerMetadata: z.nullish(gatewayBatchProviderMetadataSchema()),
530
531
  });
531
532
 
532
533
  const gatewayBatchStartResponseSchema = lazySchema(() =>
533
534
  zodSchema(
534
- gatewayBatchStatusFieldsSchema().extend({
535
+ z.extend(gatewayBatchStatusFieldsSchema(), {
535
536
  batchId: z.string(),
536
- warnings: z
537
- .array(
538
- z
539
- .object({
540
- requestId: z.string().nullish(),
537
+ warnings: z.nullish(
538
+ z.array(
539
+ z.catchall(
540
+ z.object({
541
+ requestId: z.nullish(z.string()),
541
542
  warning: z.unknown(),
542
- })
543
- .catchall(z.unknown()),
544
- )
545
- .nullish(),
543
+ }),
544
+ z.unknown(),
545
+ ),
546
+ ),
547
+ ),
546
548
  }),
547
549
  ),
548
550
  );
@@ -6,6 +6,9 @@ export type GatewayDecisionModelId =
6
6
  | 'liquid/d1'
7
7
  | 'liquid/d1-ultra'
8
8
  | 'microsoft/microsoft-decision-1'
9
+ | 'nace-ai/drex-max-finance'
10
+ | 'nace-ai/drex-max-v1.1'
11
+ | 'nace-ai/drex-v2.0'
9
12
  | 'openai/gpt-6-luna-decisions'
10
13
  | 'parallel/parallel-decisions-fast'
11
14
  | 'perplexity/pplx-decider-flash-v1.2'
@@ -140,12 +140,12 @@ const gatewayDecisionAnswerSchema = () =>
140
140
  z.object({
141
141
  type: z.literal('choice'),
142
142
  choice: z.string(),
143
- probabilities: z.record(z.string(), z.number()).optional(),
143
+ probabilities: z.optional(z.record(z.string(), z.number())),
144
144
  }),
145
145
  z.object({
146
146
  type: z.literal('score'),
147
147
  score: z.number(),
148
- probabilities: z.record(z.string(), z.number()).optional(),
148
+ probabilities: z.optional(z.record(z.string(), z.number())),
149
149
  }),
150
150
  z.object({
151
151
  type: z.literal('boolean'),
@@ -161,12 +161,12 @@ const gatewayDecisionWarningSchema = () =>
161
161
  z.object({
162
162
  type: z.literal('unsupported'),
163
163
  feature: z.string(),
164
- details: z.string().optional(),
164
+ details: z.optional(z.string()),
165
165
  }),
166
166
  z.object({
167
167
  type: z.literal('compatibility'),
168
168
  feature: z.string(),
169
- details: z.string().optional(),
169
+ details: z.optional(z.string()),
170
170
  }),
171
171
  z.object({
172
172
  type: z.literal('deprecated'),
@@ -183,23 +183,23 @@ const gatewayDecisionResponseSchema = lazySchema(() =>
183
183
  zodSchema(
184
184
  z.object({
185
185
  answers: z.record(z.string(), gatewayDecisionAnswerSchema()),
186
- model: z.string().optional(),
187
- rounding: z
188
- .object({
189
- probabilityDecimals: z.number().optional(),
190
- scoreDecimals: z.number().optional(),
191
- })
192
- .optional(),
193
- usage: z
194
- .object({
195
- inputTokens: z.number().optional(),
196
- outputTokens: z.number().optional(),
197
- })
198
- .optional(),
199
- warnings: z.array(gatewayDecisionWarningSchema()).optional(),
200
- providerMetadata: z
201
- .record(z.string(), z.record(z.string(), z.unknown()))
202
- .optional(),
186
+ model: z.optional(z.string()),
187
+ rounding: z.optional(
188
+ z.object({
189
+ probabilityDecimals: z.optional(z.number()),
190
+ scoreDecimals: z.optional(z.number()),
191
+ }),
192
+ ),
193
+ usage: z.optional(
194
+ z.object({
195
+ inputTokens: z.optional(z.number()),
196
+ outputTokens: z.optional(z.number()),
197
+ }),
198
+ ),
199
+ warnings: z.optional(z.array(gatewayDecisionWarningSchema())),
200
+ providerMetadata: z.optional(
201
+ z.record(z.string(), z.record(z.string(), z.unknown())),
202
+ ),
203
203
  }),
204
204
  ),
205
205
  );
@@ -128,12 +128,12 @@ const gatewayEmbeddingWarningSchema = () =>
128
128
  z.object({
129
129
  type: z.literal('unsupported'),
130
130
  feature: z.string(),
131
- details: z.string().optional(),
131
+ details: z.optional(z.string()),
132
132
  }),
133
133
  z.object({
134
134
  type: z.literal('compatibility'),
135
135
  feature: z.string(),
136
- details: z.string().optional(),
136
+ details: z.optional(z.string()),
137
137
  }),
138
138
  z.object({
139
139
  type: z.literal('deprecated'),
@@ -150,11 +150,11 @@ const gatewayEmbeddingResponseSchema = lazySchema(() =>
150
150
  zodSchema(
151
151
  z.object({
152
152
  embeddings: z.array(z.array(z.number())),
153
- usage: z.object({ tokens: z.number() }).nullish(),
154
- warnings: z.array(gatewayEmbeddingWarningSchema()).optional(),
155
- providerMetadata: z
156
- .record(z.string(), z.record(z.string(), z.unknown()))
157
- .optional(),
153
+ usage: z.nullish(z.object({ tokens: z.number() })),
154
+ warnings: z.optional(z.array(gatewayEmbeddingWarningSchema())),
155
+ providerMetadata: z.optional(
156
+ z.record(z.string(), z.record(z.string(), z.unknown())),
157
+ ),
158
158
  }),
159
159
  ),
160
160
  );
@@ -112,61 +112,65 @@ function getTeamIdOrSlug(
112
112
  const gatewayAvailableModelsResponseSchema = lazySchema(() =>
113
113
  zodSchema(
114
114
  z.object({
115
- models: z
116
- .array(
115
+ models: z.pipe(
116
+ z.array(
117
117
  z.object({
118
118
  id: z.string(),
119
119
  name: z.string(),
120
- description: z.string().nullish(),
121
- pricing: z
122
- .object({
123
- input: z.string(),
124
- output: z.string(),
125
- input_cache_read: z.string().nullish(),
126
- input_cache_write: z.string().nullish(),
127
- })
128
- .transform(
129
- ({ input, output, input_cache_read, input_cache_write }) => ({
130
- input,
131
- output,
132
- ...(input_cache_read
133
- ? { cachedInputTokens: input_cache_read }
134
- : {}),
135
- ...(input_cache_write
136
- ? { cacheCreationInputTokens: input_cache_write }
137
- : {}),
120
+ description: z.nullish(z.string()),
121
+ pricing: z.nullish(
122
+ z.pipe(
123
+ z.object({
124
+ input: z.string(),
125
+ output: z.string(),
126
+ input_cache_read: z.nullish(z.string()),
127
+ input_cache_write: z.nullish(z.string()),
138
128
  }),
139
- )
140
- .nullish(),
129
+ z.transform(
130
+ ({ input, output, input_cache_read, input_cache_write }) => ({
131
+ input,
132
+ output,
133
+ ...(input_cache_read
134
+ ? { cachedInputTokens: input_cache_read }
135
+ : {}),
136
+ ...(input_cache_write
137
+ ? { cacheCreationInputTokens: input_cache_write }
138
+ : {}),
139
+ }),
140
+ ),
141
+ ),
142
+ ),
141
143
  specification: z.object({
142
144
  specificationVersion: z.literal('v4'),
143
145
  provider: z.string(),
144
146
  modelId: z.string(),
145
147
  }),
146
- modelType: z.string().nullish(),
148
+ modelType: z.nullish(z.string()),
147
149
  }),
148
- )
149
- .transform(models =>
150
+ ),
151
+ z.transform(models =>
150
152
  models.filter(
151
153
  (m): m is typeof m & { modelType?: KnownModelType | null } =>
152
154
  m.modelType == null ||
153
155
  KNOWN_MODEL_TYPES.includes(m.modelType as KnownModelType),
154
156
  ),
155
157
  ),
158
+ ),
156
159
  }),
157
160
  ),
158
161
  );
159
162
 
160
163
  const gatewayCreditsResponseSchema = lazySchema(() =>
161
164
  zodSchema(
162
- z
163
- .object({
165
+ z.pipe(
166
+ z.object({
164
167
  balance: z.string(),
165
168
  total_used: z.string(),
166
- })
167
- .transform(({ balance, total_used }) => ({
169
+ }),
170
+ z.transform(({ balance, total_used }) => ({
168
171
  balance,
169
172
  totalUsed: total_used,
170
173
  })),
174
+ ),
171
175
  ),
172
176
  );
@@ -95,15 +95,15 @@ export class GatewayGenerationInfoFetcher {
95
95
 
96
96
  const gatewayGenerationInfoResponseSchema = lazySchema(() =>
97
97
  zodSchema(
98
- z
99
- .object({
100
- data: z
101
- .object({
98
+ z.pipe(
99
+ z.object({
100
+ data: z.pipe(
101
+ z.object({
102
102
  id: z.string(),
103
103
  total_cost: z.number(),
104
- market_cost: z.number().nullish(),
105
- surcharge_cost: z.number().nullish(),
106
- gateway_cost: z.number().nullish(),
104
+ market_cost: z.nullish(z.number()),
105
+ surcharge_cost: z.nullish(z.number()),
106
+ gateway_cost: z.nullish(z.number()),
107
107
  upstream_inference_cost: z.number(),
108
108
  usage: z.number(),
109
109
  created_at: z.string(),
@@ -120,8 +120,8 @@ const gatewayGenerationInfoResponseSchema = lazySchema(() =>
120
120
  native_tokens_cached: z.number(),
121
121
  native_tokens_cache_creation: z.number(),
122
122
  billable_web_search_calls: z.number(),
123
- })
124
- .transform(
123
+ }),
124
+ z.transform(
125
125
  ({
126
126
  total_cost,
127
127
  market_cost,
@@ -162,7 +162,9 @@ const gatewayGenerationInfoResponseSchema = lazySchema(() =>
162
162
  billableWebSearchCalls: billable_web_search_calls,
163
163
  }),
164
164
  ),
165
- })
166
- .transform(({ data }) => data),
165
+ ),
166
+ }),
167
+ z.transform(({ data }) => data),
168
+ ),
167
169
  ),
168
170
  );
@@ -199,23 +199,24 @@ function toImageModelImages(
199
199
  }
200
200
 
201
201
  const providerMetadataEntrySchema = () =>
202
- z
203
- .object({
204
- images: z.array(z.unknown()).optional(),
205
- })
206
- .catchall(z.unknown());
202
+ z.catchall(
203
+ z.object({
204
+ images: z.optional(z.array(z.unknown())),
205
+ }),
206
+ z.unknown(),
207
+ );
207
208
 
208
209
  const gatewayImageWarningSchema = () =>
209
210
  z.discriminatedUnion('type', [
210
211
  z.object({
211
212
  type: z.literal('unsupported'),
212
213
  feature: z.string(),
213
- details: z.string().optional(),
214
+ details: z.optional(z.string()),
214
215
  }),
215
216
  z.object({
216
217
  type: z.literal('compatibility'),
217
218
  feature: z.string(),
218
- details: z.string().optional(),
219
+ details: z.optional(z.string()),
219
220
  }),
220
221
  z.object({
221
222
  type: z.literal('deprecated'),
@@ -230,9 +231,9 @@ const gatewayImageWarningSchema = () =>
230
231
 
231
232
  const gatewayImageUsageSchema = () =>
232
233
  z.object({
233
- inputTokens: z.number().nullish(),
234
- outputTokens: z.number().nullish(),
235
- totalTokens: z.number().nullish(),
234
+ inputTokens: z.nullish(z.number()),
235
+ outputTokens: z.nullish(z.number()),
236
+ totalTokens: z.nullish(z.number()),
236
237
  });
237
238
 
238
239
  const gatewayImageResponseSchema = lazySchema(() =>
@@ -242,12 +243,12 @@ const gatewayImageResponseSchema = lazySchema(() =>
242
243
  // response is read (`experimental_binaryFields`), see
243
244
  // `toImageModelImages`.
244
245
  images: z.array(z.union([z.string(), z.instanceof(Uint8Array)])),
245
- isRetryable: z.boolean().optional(),
246
- warnings: z.array(gatewayImageWarningSchema()).optional(),
247
- providerMetadata: z
248
- .record(z.string(), providerMetadataEntrySchema())
249
- .optional(),
250
- usage: gatewayImageUsageSchema().optional(),
246
+ isRetryable: z.optional(z.boolean()),
247
+ warnings: z.optional(z.array(gatewayImageWarningSchema())),
248
+ providerMetadata: z.optional(
249
+ z.record(z.string(), providerMetadataEntrySchema()),
250
+ ),
251
+ usage: z.optional(gatewayImageUsageSchema()),
251
252
  }),
252
253
  ),
253
254
  );
@@ -31,9 +31,10 @@ export type GatewayModelId =
31
31
  | 'anthropic/claude-fable-5'
32
32
  | 'anthropic/claude-fable-5-batch'
33
33
  | 'anthropic/claude-fable-5.1'
34
- | 'anthropic/claude-fable-5.2'
35
34
  | 'anthropic/claude-fable-5.1-batch'
35
+ | 'anthropic/claude-fable-5.2'
36
36
  | 'anthropic/claude-fable-5.2-batch'
37
+ | 'anthropic/claude-fable-5.2-fast'
37
38
  | 'anthropic/claude-haiku-4.5'
38
39
  | 'anthropic/claude-haiku-4.5-batch'
39
40
  | 'anthropic/claude-haiku-5.5'
@@ -106,6 +107,7 @@ export type GatewayModelId =
106
107
  | 'google/gemini-3.7-flash'
107
108
  | 'google/gemini-3.8-flash'
108
109
  | 'google/gemini-4-argon'
110
+ | 'google/gemini-4-carbon'
109
111
  | 'google/gemini-nano-banana-2.1'
110
112
  | 'google/gemini-omni-1.2-flash'
111
113
  | 'google/gemini-omni-flash-preview'
@@ -1,5 +1,5 @@
1
1
  import { lazySchema, zodSchema } from '@ai-sdk/provider-utils';
2
- import type { ZodType } from 'zod/v4';
2
+ import type { ZodMiniType as ZodType } from 'zod/v4/mini';
3
3
  import { z } from './zod';
4
4
 
5
5
  // https://vercel.com/docs/ai-gateway/provider-options
@@ -9,11 +9,12 @@ export const DECISION_FALLBACK_MAX_QUESTION_LENGTH = 256;
9
9
 
10
10
  export const gatewayDecisionProviderOptionsSchema = lazySchema(() =>
11
11
  zodSchema(
12
- z
13
- .object({
14
- models: gatewayModelFallbacksSchema().optional(),
15
- })
16
- .catchall(z.unknown()),
12
+ z.catchall(
13
+ z.object({
14
+ models: z.optional(gatewayModelFallbacksSchema()),
15
+ }),
16
+ z.unknown(),
17
+ ),
17
18
  ),
18
19
  );
19
20
 
@@ -171,29 +172,37 @@ type GatewayModelFallbackList<QUESTION_ID extends string> =
171
172
  | string[]
172
173
  | [ConditionalGatewayModelFallback<QUESTION_ID>, ...string[]];
173
174
 
174
- const probabilitySchema = () => z.number().finite().min(0).max(1);
175
+ const probabilitySchema = () =>
176
+ z.number().check(z.minimum(0)).check(z.maximum(1));
175
177
  const questionSchema = () =>
176
- z.string().min(1).max(DECISION_FALLBACK_MAX_QUESTION_LENGTH);
178
+ z
179
+ .string()
180
+ .check(z.minLength(1))
181
+ .check(z.maxLength(DECISION_FALLBACK_MAX_QUESTION_LENGTH));
177
182
  const directConditionSchema = () =>
178
183
  z.union([
179
- z
180
- .object({
181
- question: questionSchema().optional(),
184
+ z.catchall(
185
+ z.object({
186
+ question: z.optional(questionSchema()),
182
187
  confidenceBelow: probabilitySchema(),
183
- })
184
- .strict(),
185
- z
186
- .object({
187
- question: questionSchema().optional(),
188
+ }),
189
+ z.never(),
190
+ ),
191
+ z.catchall(
192
+ z.object({
193
+ question: z.optional(questionSchema()),
188
194
  probabilityBetween: z
189
195
  .array(probabilitySchema())
190
- .length(2)
191
- .refine(([minimum, maximum]) => minimum <= maximum, {
192
- message:
193
- 'probabilityBetween minimum must be less than or equal to maximum',
194
- }),
195
- })
196
- .strict(),
196
+ .check(z.length(2))
197
+ .check(
198
+ z.refine(([minimum, maximum]) => minimum <= maximum, {
199
+ message:
200
+ 'probabilityBetween minimum must be less than or equal to maximum',
201
+ }),
202
+ ),
203
+ }),
204
+ z.never(),
205
+ ),
197
206
  ]) as ZodType<DecisionFallbackCondition>;
198
207
 
199
208
  const groupBeyondMaxDepthSchema = () =>
@@ -203,36 +212,44 @@ const groupBeyondMaxDepthSchema = () =>
203
212
  z.object({ all: z.unknown() }),
204
213
  z.object({ atLeast: z.unknown() }),
205
214
  ])
206
- .superRefine((_, context) => {
207
- context.addIssue({
215
+ .check(context => {
216
+ context.issues.push({
217
+ input: context.value,
218
+ continue: true,
208
219
  code: 'custom',
209
220
  message: `conditions can be nested at most ${DECISION_FALLBACK_MAX_CONDITION_DEPTH} levels deep`,
210
221
  });
211
222
  });
212
223
 
213
224
  const conditionalModelFallbackSchema = () =>
214
- z
215
- .object({
216
- model: z.string().min(1),
225
+ z.catchall(
226
+ z.object({
227
+ model: z.string().check(z.minLength(1)),
217
228
  when: conditionSchema(1),
218
- })
219
- .strict();
229
+ }),
230
+ z.never(),
231
+ );
220
232
 
221
233
  const gatewayModelFallbacksSchema = () =>
222
234
  z
223
235
  .array(z.union([z.string(), conditionalModelFallbackSchema()]))
224
- .superRefine((entries, context) => {
236
+ .check(context => {
237
+ const entries = context.value;
225
238
  const conditionalIndexes = entries.flatMap((entry, index) =>
226
239
  typeof entry === 'string' ? [] : [index],
227
240
  );
228
241
  if (conditionalIndexes.length > 1) {
229
- context.addIssue({
242
+ context.issues.push({
243
+ input: context.value,
244
+ continue: true,
230
245
  code: 'custom',
231
246
  message: 'models supports at most one conditional decision fallback',
232
247
  });
233
248
  }
234
249
  if (conditionalIndexes[0] !== undefined && conditionalIndexes[0] !== 0) {
235
- context.addIssue({
250
+ context.issues.push({
251
+ input: context.value,
252
+ continue: true,
236
253
  code: 'custom',
237
254
  message:
238
255
  'a conditional decision fallback must be the first models entry',
@@ -252,26 +269,31 @@ function conditionSchema(depth: number): ZodType<DecisionFallbackCondition> {
252
269
  const childConditionSchema = conditionSchema(depth + 1);
253
270
  const conditionListSchema = z
254
271
  .array(childConditionSchema)
255
- .min(1)
256
- .max(DECISION_FALLBACK_MAX_CONDITIONS_PER_LIST);
272
+ .check(z.minLength(1))
273
+ .check(z.maxLength(DECISION_FALLBACK_MAX_CONDITIONS_PER_LIST));
257
274
 
258
275
  return z.union([
259
276
  directConditionSchema(),
260
- z.object({ any: conditionListSchema }).strict(),
261
- z.object({ all: conditionListSchema }).strict(),
262
- z
263
- .object({
277
+ z.catchall(z.object({ any: conditionListSchema }), z.never()),
278
+ z.catchall(z.object({ all: conditionListSchema }), z.never()),
279
+ z.catchall(
280
+ z.object({
264
281
  atLeast: z
265
- .object({
266
- count: z.number().int().min(1),
267
- conditions: conditionListSchema,
268
- })
269
- .strict()
270
- .refine(({ count, conditions }) => count <= conditions.length, {
271
- message: 'atLeast count cannot exceed the number of conditions',
272
- path: ['count'],
273
- }),
274
- })
275
- .strict(),
282
+ .catchall(
283
+ z.object({
284
+ count: z.number().check(z.int()).check(z.minimum(1)),
285
+ conditions: conditionListSchema,
286
+ }),
287
+ z.never(),
288
+ )
289
+ .check(
290
+ z.refine(({ count, conditions }) => count <= conditions.length, {
291
+ message: 'atLeast count cannot exceed the number of conditions',
292
+ path: ['count'],
293
+ }),
294
+ ),
295
+ }),
296
+ z.never(),
297
+ ),
276
298
  ]) as ZodType<DecisionFallbackCondition>;
277
299
  }
@@ -366,7 +366,7 @@ const gatewayClientSecretResponseSchema = lazySchema(() =>
366
366
  zodSchema(
367
367
  z.object({
368
368
  token: z.string(),
369
- expiresAt: z.number().nullish(),
369
+ expiresAt: z.nullish(z.number()),
370
370
  }),
371
371
  ),
372
372
  );