@forklaunch/implementation-worker-kafka 0.6.0 → 0.6.2

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.
@@ -7,25 +7,19 @@ var __export = (target, all) => {
7
7
  __defProp(target, name, { get: all[name], enumerable: true });
8
8
  };
9
9
  var __copyProps = (to, from, except, desc) => {
10
- if ((from && typeof from === 'object') || typeof from === 'function') {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
11
  for (let key of __getOwnPropNames(from))
12
12
  if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, {
14
- get: () => from[key],
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
14
  }
18
15
  return to;
19
16
  };
20
- var __reExport = (target, mod, secondTarget) => (
21
- __copyProps(target, mod, 'default'),
22
- secondTarget && __copyProps(secondTarget, mod, 'default')
23
- );
17
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
24
18
 
25
19
  // domain/schemas/kafka.schema.ts
26
- import { serviceSchemaResolver } from '@forklaunch/internal';
20
+ import { serviceSchemaResolver } from "@forklaunch/internal";
27
21
 
28
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.3/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
22
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.5/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
29
23
  var typebox_exports = {};
30
24
  __export(typebox_exports, {
31
25
  SchemaValidator: () => SchemaValidator,
@@ -64,9 +58,9 @@ __export(typebox_exports, {
64
58
  void_: () => void_
65
59
  });
66
60
  __reExport(typebox_exports, typebox_star);
67
- import * as typebox_star from '@sinclair/typebox';
61
+ import * as typebox_star from "@sinclair/typebox";
68
62
 
69
- // ../../../node_modules/.pnpm/@forklaunch+common@0.6.3/node_modules/@forklaunch/common/lib/index.mjs
63
+ // ../../../node_modules/.pnpm/@forklaunch+common@0.6.5/node_modules/@forklaunch/common/lib/index.mjs
70
64
  var InMemoryBlob = class extends Blob {
71
65
  constructor(content) {
72
66
  super([content]);
@@ -74,229 +68,221 @@ var InMemoryBlob = class extends Blob {
74
68
  }
75
69
  };
76
70
 
77
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.3/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
78
- import { FormatRegistry, Kind, KindGuard, Type } from '@sinclair/typebox';
79
- import { TypeCheck, TypeCompiler } from '@sinclair/typebox/compiler';
71
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.5/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
72
+ import {
73
+ FormatRegistry,
74
+ Kind,
75
+ KindGuard,
76
+ Type
77
+ } from "@sinclair/typebox";
78
+ import { TypeCheck, TypeCompiler } from "@sinclair/typebox/compiler";
80
79
  import {
81
80
  DefaultErrorFunction,
82
81
  SetErrorFunction,
83
82
  ValueErrorType
84
- } from '@sinclair/typebox/errors';
85
- import { Value } from '@sinclair/typebox/value';
86
- FormatRegistry.Set('binary', (value) => typeof value === 'string');
83
+ } from "@sinclair/typebox/errors";
84
+ import { Value } from "@sinclair/typebox/value";
85
+ FormatRegistry.Set("binary", (value) => typeof value === "string");
87
86
  SetErrorFunction((params) => {
88
87
  switch (params.errorType) {
89
88
  case ValueErrorType.Union:
90
89
  case ValueErrorType.Array:
91
90
  case ValueErrorType.String:
92
91
  case ValueErrorType.Number:
93
- return params.schema.errorType
94
- ? `Expected ${params.schema.errorType} value${params.schema.errorSuffix ? 's' : ''}`
95
- : DefaultErrorFunction(params);
92
+ return params.schema.errorType ? `Expected ${params.schema.errorType} value${params.schema.errorSuffix ? "s" : ""}` : DefaultErrorFunction(params);
96
93
  default:
97
94
  return DefaultErrorFunction(params);
98
95
  }
99
96
  });
100
97
  var TypeboxSchemaValidator = class {
101
- _Type = 'TypeBox';
98
+ _Type = "TypeBox";
102
99
  _SchemaCatchall;
103
100
  _ValidSchemaObject;
104
101
  string = Type.String({
105
- example: 'a string',
106
- title: 'String'
102
+ example: "a string",
103
+ title: "String"
107
104
  });
108
105
  uuid = Type.String({
109
- pattern:
110
- '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$',
111
- errorType: 'uuid',
112
- example: 'a8b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6',
113
- title: 'UUID'
106
+ pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
107
+ errorType: "uuid",
108
+ example: "a8b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6",
109
+ title: "UUID"
114
110
  });
115
111
  email = Type.String({
116
- pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$',
117
- errorType: 'email',
118
- example: 'a@b.com',
119
- title: 'Email'
112
+ pattern: "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
113
+ errorType: "email",
114
+ example: "a@b.com",
115
+ title: "Email"
120
116
  });
121
117
  uri = Type.String({
122
- pattern: '^[a-zA-Z][a-zA-Z\\d+-.]*:[^\\s]*$',
123
- errorType: 'uri',
124
- example: 'https://forklaunch.com',
125
- title: 'URI'
118
+ pattern: "^[a-zA-Z][a-zA-Z\\d+-.]*:[^\\s]*$",
119
+ errorType: "uri",
120
+ example: "https://forklaunch.com",
121
+ title: "URI"
126
122
  });
127
123
  number = Type.Transform(
128
124
  Type.Union(
129
125
  [
130
126
  Type.Number(),
131
- Type.String({ pattern: '^[0-9]+$' }),
127
+ Type.String({ pattern: "^[0-9]+$" }),
132
128
  Type.Boolean(),
133
129
  Type.Null(),
134
130
  Type.BigInt(),
135
131
  Type.Date()
136
132
  ],
137
133
  {
138
- errorType: 'number-like',
134
+ errorType: "number-like",
139
135
  example: 123,
140
- title: 'Number'
136
+ title: "Number"
141
137
  }
142
138
  )
143
- )
144
- .Decode((value) => {
145
- if (typeof value !== 'number') {
146
- const num = Number(value);
147
- if (isNaN(num)) {
148
- throw new Error('Invalid number');
149
- } else {
150
- return num;
151
- }
139
+ ).Decode((value) => {
140
+ if (typeof value !== "number") {
141
+ const num = Number(value);
142
+ if (isNaN(num)) {
143
+ throw new Error("Invalid number");
144
+ } else {
145
+ return num;
152
146
  }
153
- return value;
154
- })
155
- .Encode(Number);
147
+ }
148
+ return value;
149
+ }).Encode(Number);
156
150
  bigint = Type.Transform(
157
151
  Type.Union(
158
152
  [
159
153
  Type.BigInt(),
160
154
  Type.Number(),
161
- Type.String({ pattern: '^[0-9]+n?$' }),
155
+ Type.String({ pattern: "^[0-9]+n?$" }),
162
156
  Type.Boolean(),
163
157
  Type.Date()
164
158
  ],
165
159
  {
166
- errorType: 'BigInt-like',
160
+ errorType: "BigInt-like",
167
161
  example: 123n,
168
- title: 'BigInt'
162
+ title: "BigInt"
169
163
  }
170
164
  )
171
- )
172
- .Decode((value) => {
173
- if (typeof value !== 'bigint') {
174
- try {
175
- if (value instanceof Date) {
176
- return BigInt(value.getTime());
177
- }
178
- return BigInt(value);
179
- } catch {
180
- throw new Error('Invalid bigint');
165
+ ).Decode((value) => {
166
+ if (typeof value !== "bigint") {
167
+ try {
168
+ if (value instanceof Date) {
169
+ return BigInt(value.getTime());
181
170
  }
171
+ return BigInt(value);
172
+ } catch {
173
+ throw new Error("Invalid bigint");
182
174
  }
183
- return value;
184
- })
185
- .Encode(BigInt);
175
+ }
176
+ return value;
177
+ }).Encode(BigInt);
186
178
  boolean = Type.Transform(
187
179
  Type.Union(
188
180
  [
189
181
  Type.Boolean(),
190
182
  Type.String({
191
- pattern: '^(t|T)(r|R)(u|U)(e|E)$|^(f|F)(a|A)(l|L)(s|S)(e|E)$'
183
+ pattern: "^(t|T)(r|R)(u|U)(e|E)$|^(f|F)(a|A)(l|L)(s|S)(e|E)$"
192
184
  })
193
185
  ],
194
186
  {
195
- errorType: 'boolean-like',
187
+ errorType: "boolean-like",
196
188
  example: true,
197
- title: 'Boolean'
189
+ title: "Boolean"
198
190
  }
199
191
  )
200
- )
201
- .Decode((value) => {
202
- if (typeof value === 'string') {
203
- if (value.toLowerCase() === 'true') return true;
204
- return false;
205
- } else {
206
- return value;
207
- }
208
- })
209
- .Encode(Boolean);
192
+ ).Decode((value) => {
193
+ if (typeof value === "string") {
194
+ if (value.toLowerCase() === "true") return true;
195
+ return false;
196
+ } else {
197
+ return value;
198
+ }
199
+ }).Encode(Boolean);
210
200
  date = Type.Transform(
211
201
  Type.Union(
212
202
  [
213
203
  Type.String({
214
- pattern:
215
- '^\\d{4}(-\\d{2}){0,2}(T\\d{2}:\\d{2}(:\\d{2}(\\.\\d{1,3})?)?(Z|([+-]\\d{2}:\\d{2}))?)?$|^\\d{1,2}\\/\\d{1,2}\\/\\d{4}$|^\\d{4}\\/\\d{1,2}\\/\\d{1,2}$|^\\d+$'
204
+ pattern: "^\\d{4}(-\\d{2}){0,2}(T\\d{2}:\\d{2}(:\\d{2}(\\.\\d{1,3})?)?(Z|([+-]\\d{2}:\\d{2}))?)?$|^\\d{1,2}\\/\\d{1,2}\\/\\d{4}$|^\\d{4}\\/\\d{1,2}\\/\\d{1,2}$|^\\d+$"
216
205
  }),
217
206
  Type.Number(),
218
207
  Type.Date()
219
208
  ],
220
209
  {
221
- errorType: 'date',
222
- example: '2025-05-16T21:13:04.123Z',
223
- title: 'Date'
210
+ errorType: "date",
211
+ example: "2025-05-16T21:13:04.123Z",
212
+ title: "Date"
224
213
  }
225
214
  )
226
- )
227
- .Decode((value) => {
228
- if (value === null || typeof value === 'boolean') {
229
- return /* @__PURE__ */ new Date(value ? 1 : 0);
230
- }
231
- return new Date(value);
232
- })
233
- .Encode((value) => new Date(value).toISOString());
215
+ ).Decode((value) => {
216
+ if (value === null || typeof value === "boolean") {
217
+ return /* @__PURE__ */ new Date(value ? 1 : 0);
218
+ }
219
+ return new Date(value);
220
+ }).Encode((value) => new Date(value).toISOString());
234
221
  symbol = Type.Symbol({
235
- title: 'Symbol'
236
- });
237
- nullish = Type.Union([Type.Void(), Type.Null(), Type.Undefined()], {
238
- errorType: 'nullish',
239
- type: 'null',
240
- example: 'null',
241
- title: 'Nullish'
222
+ title: "Symbol"
242
223
  });
224
+ nullish = Type.Union(
225
+ [Type.Void(), Type.Null(), Type.Undefined()],
226
+ {
227
+ errorType: "nullish",
228
+ type: "null",
229
+ example: "null",
230
+ title: "Nullish"
231
+ }
232
+ );
243
233
  void = Type.Void({
244
- type: 'null',
245
- example: 'void',
246
- title: 'Void'
234
+ type: "null",
235
+ example: "void",
236
+ title: "Void"
247
237
  });
248
238
  null = Type.Null({
249
- type: 'null',
250
- example: 'null',
251
- title: 'Null'
239
+ type: "null",
240
+ example: "null",
241
+ title: "Null"
252
242
  });
253
243
  undefined = Type.Undefined({
254
- type: 'null',
255
- example: 'undefined',
256
- title: 'Undefined'
244
+ type: "null",
245
+ example: "undefined",
246
+ title: "Undefined"
257
247
  });
258
248
  any = Type.Any({
259
- type: 'object',
260
- example: 'any',
261
- title: 'Any'
249
+ type: "object",
250
+ example: "any",
251
+ title: "Any"
262
252
  });
263
253
  unknown = Type.Unknown({
264
- type: 'object',
265
- example: 'unknown',
266
- title: 'Unknown'
254
+ type: "object",
255
+ example: "unknown",
256
+ title: "Unknown"
267
257
  });
268
258
  never = Type.Never({
269
- type: 'null',
270
- example: 'never',
271
- title: 'Never'
259
+ type: "null",
260
+ example: "never",
261
+ title: "Never"
272
262
  });
273
263
  binary = Type.Transform(
274
264
  Type.String({
275
- errorType: 'binary',
276
- format: 'binary',
277
- example: 'a base-64 encodable string',
278
- title: 'Binary'
265
+ errorType: "binary",
266
+ format: "binary",
267
+ example: "a base-64 encodable string",
268
+ title: "Binary"
279
269
  })
280
- )
281
- .Decode((value) => new Uint8Array(Buffer.from(value, 'base64')))
282
- .Encode((value) => {
283
- if (value instanceof Buffer) {
284
- return String.fromCharCode(...new Uint8Array(value));
285
- }
286
- return '';
287
- });
270
+ ).Decode((value) => new Uint8Array(Buffer.from(value, "base64"))).Encode((value) => {
271
+ if (value instanceof Buffer) {
272
+ return String.fromCharCode(...new Uint8Array(value));
273
+ }
274
+ return "";
275
+ });
288
276
  file = Type.Transform(
289
277
  Type.Unsafe({
290
- errorType: 'binary',
291
- format: 'binary',
292
- example: 'a raw buffer or file stream',
293
- title: 'File'
278
+ errorType: "binary",
279
+ format: "binary",
280
+ example: "a raw buffer or file stream",
281
+ title: "File"
294
282
  })
295
- )
296
- .Decode((value) => {
297
- return new InMemoryBlob(value);
298
- })
299
- .Encode((value) => value.content);
283
+ ).Decode((value) => {
284
+ return new InMemoryBlob(value);
285
+ }).Encode((value) => value.content);
300
286
  type = () => this.any;
301
287
  /**
302
288
  * Extracts the error type of a schema for error messages.
@@ -305,7 +291,7 @@ var TypeboxSchemaValidator = class {
305
291
  * @returns The type of the schema for error messages.
306
292
  */
307
293
  errorType(schema) {
308
- if (KindGuard.IsSchema(schema) && Object.hasOwn(schema, 'errorType')) {
294
+ if (KindGuard.IsSchema(schema) && Object.hasOwn(schema, "errorType")) {
309
295
  return schema.errorType;
310
296
  } else if (KindGuard.IsLiteral(schema)) {
311
297
  return schema.const;
@@ -327,11 +313,7 @@ var TypeboxSchemaValidator = class {
327
313
  * @returns {TResolve<T>} The resolved schema.
328
314
  */
329
315
  schemify(schema) {
330
- if (
331
- typeof schema === 'string' ||
332
- typeof schema === 'number' ||
333
- typeof schema === 'boolean'
334
- ) {
316
+ if (typeof schema === "string" || typeof schema === "number" || typeof schema === "boolean") {
335
317
  return Type.Literal(schema);
336
318
  }
337
319
  if (KindGuard.IsSchema(schema) || schema instanceof TypeCheck) {
@@ -381,7 +363,7 @@ var TypeboxSchemaValidator = class {
381
363
  return this.schemify(schema);
382
364
  });
383
365
  return Type.Union(unionTypes, {
384
- errorType: `any of ${unionTypes.map((s) => this.errorType(s)).join(', ')}`,
366
+ errorType: `any of ${unionTypes.map((s) => this.errorType(s)).join(", ")}`,
385
367
  errorSuffix: true
386
368
  });
387
369
  }
@@ -452,12 +434,7 @@ var TypeboxSchemaValidator = class {
452
434
  * @returns {boolean} True if the value is an instance of the schema.
453
435
  */
454
436
  isInstanceOf(value, type22) {
455
- return (
456
- typeof value === 'object' &&
457
- value != null &&
458
- Kind in value &&
459
- value[Kind] === type22[Kind]
460
- );
437
+ return typeof value === "object" && value != null && Kind in value && value[Kind] === type22[Kind];
461
438
  }
462
439
  /**
463
440
  * Validate a value against a schema.
@@ -492,7 +469,7 @@ var TypeboxSchemaValidator = class {
492
469
  }
493
470
  } else {
494
471
  const schemified = this.schemify(schema);
495
- if (schemified[Kind] === 'Unsafe') {
472
+ if (schemified[Kind] === "Unsafe") {
496
473
  try {
497
474
  if (value instanceof Buffer) {
498
475
  conversion = new InMemoryBlob(value);
@@ -501,7 +478,7 @@ var TypeboxSchemaValidator = class {
501
478
  {
502
479
  type: ValueErrorType.String,
503
480
  schema: schemified,
504
- path: '',
481
+ path: "",
505
482
  message: `Invalid file type: expected Buffer or string, got ${typeof value}`,
506
483
  value,
507
484
  errors: []
@@ -513,8 +490,8 @@ var TypeboxSchemaValidator = class {
513
490
  {
514
491
  type: ValueErrorType.String,
515
492
  schema: schemified,
516
- path: '',
517
- message: err instanceof Error ? err.message : 'Invalid file type',
493
+ path: "",
494
+ message: err instanceof Error ? err.message : "Invalid file type",
518
495
  value,
519
496
  errors: []
520
497
  }
@@ -528,38 +505,33 @@ var TypeboxSchemaValidator = class {
528
505
  }
529
506
  }
530
507
  }
531
- return errors != null && errors.length === 0
532
- ? {
533
- ok: true,
534
- value: conversion
535
- }
536
- : {
537
- ok: false,
538
- errors: errors.flatMap((error) => {
539
- if (
540
- error.type === ValueErrorType.Union &&
541
- error.schema.errorType.includes('any of')
542
- ) {
543
- return error.errors.flatMap((e, idx) =>
544
- Array.from(e).map((e2) => ({
545
- path: [
546
- `Union Schema Variant ${idx}`,
547
- ...error.path.split('/').slice(1),
548
- ...e2.path.split('/').slice(1)
549
- ],
550
- message: e2.message
551
- }))
552
- );
553
- } else {
554
- return [
555
- {
556
- path: error.path.split('/').slice(1),
557
- message: error.message
558
- }
559
- ];
508
+ return errors != null && errors.length === 0 ? {
509
+ ok: true,
510
+ value: conversion
511
+ } : {
512
+ ok: false,
513
+ errors: errors.flatMap((error) => {
514
+ if (error.type === ValueErrorType.Union && error.schema.errorType.includes("any of")) {
515
+ return error.errors.flatMap(
516
+ (e, idx) => Array.from(e).map((e2) => ({
517
+ path: [
518
+ `Union Schema Variant ${idx}`,
519
+ ...error.path.split("/").slice(1),
520
+ ...e2.path.split("/").slice(1)
521
+ ],
522
+ message: e2.message
523
+ }))
524
+ );
525
+ } else {
526
+ return [
527
+ {
528
+ path: error.path.split("/").slice(1),
529
+ message: error.message
560
530
  }
561
- })
562
- };
531
+ ];
532
+ }
533
+ })
534
+ };
563
535
  }
564
536
  /**
565
537
  * Convert a schema to an OpenAPI schema object.
@@ -570,11 +542,11 @@ var TypeboxSchemaValidator = class {
570
542
  let schemified = this.schemify(schema);
571
543
  if (KindGuard.IsDate(schemified)) {
572
544
  schemified = Type.String({
573
- format: 'date-time'
545
+ format: "date-time"
574
546
  });
575
547
  }
576
548
  const newSchema = Object.assign({}, schemified);
577
- if (Object.hasOwn(newSchema, 'properties')) {
549
+ if (Object.hasOwn(newSchema, "properties")) {
578
550
  if (newSchema.properties) {
579
551
  Object.entries({ ...schemified.properties }).forEach(([key, value]) => {
580
552
  if (KindGuard.IsSchema(value) && newSchema.properties) {
@@ -583,17 +555,21 @@ var TypeboxSchemaValidator = class {
583
555
  });
584
556
  }
585
557
  }
586
- if (Object.hasOwn(newSchema, 'items')) {
558
+ if (Object.hasOwn(newSchema, "items")) {
587
559
  newSchema.items = this.openapi(newSchema.items);
588
560
  }
589
561
  if (Array.isArray(newSchema.anyOf)) {
590
- newSchema.anyOf = newSchema.anyOf.map((item) => this.openapi(item));
562
+ newSchema.anyOf = newSchema.anyOf.map(
563
+ (item) => this.openapi(item)
564
+ );
591
565
  }
592
566
  if (Array.isArray(newSchema.oneOf)) {
593
- newSchema.oneOf = newSchema.oneOf.map((item) => this.openapi(item));
567
+ newSchema.oneOf = newSchema.oneOf.map(
568
+ (item) => this.openapi(item)
569
+ );
594
570
  }
595
- if ('errorType' in newSchema) {
596
- delete newSchema['errorType'];
571
+ if ("errorType" in newSchema) {
572
+ delete newSchema["errorType"];
597
573
  }
598
574
  return newSchema;
599
575
  }
@@ -643,55 +619,46 @@ var KafkaWorkerOptionsSchema = {
643
619
  peekCount: number
644
620
  };
645
621
 
646
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.3/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
647
- import { z as z2, ZodType } from 'zod/v3';
622
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.5/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
623
+ import {
624
+ z as z2,
625
+ ZodType
626
+ } from "zod/v3";
648
627
 
649
628
  // ../../../node_modules/.pnpm/ts-deepmerge@7.0.3/node_modules/ts-deepmerge/esm/index.js
650
629
  var isObject = (obj) => {
651
- if (typeof obj === 'object' && obj !== null) {
652
- if (typeof Object.getPrototypeOf === 'function') {
630
+ if (typeof obj === "object" && obj !== null) {
631
+ if (typeof Object.getPrototypeOf === "function") {
653
632
  const prototype = Object.getPrototypeOf(obj);
654
633
  return prototype === Object.prototype || prototype === null;
655
634
  }
656
- return Object.prototype.toString.call(obj) === '[object Object]';
635
+ return Object.prototype.toString.call(obj) === "[object Object]";
657
636
  }
658
637
  return false;
659
638
  };
660
- var merge = (...objects) =>
661
- objects.reduce((result, current) => {
662
- if (current === void 0) {
663
- return result;
639
+ var merge = (...objects) => objects.reduce((result, current) => {
640
+ if (current === void 0) {
641
+ return result;
642
+ }
643
+ if (Array.isArray(current)) {
644
+ throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
645
+ }
646
+ Object.keys(current).forEach((key) => {
647
+ if (["__proto__", "constructor", "prototype"].includes(key)) {
648
+ return;
664
649
  }
665
- if (Array.isArray(current)) {
666
- throw new TypeError(
667
- 'Arguments provided to ts-deepmerge must be objects, not arrays.'
668
- );
650
+ if (Array.isArray(result[key]) && Array.isArray(current[key])) {
651
+ result[key] = merge.options.mergeArrays ? merge.options.uniqueArrayItems ? Array.from(new Set(result[key].concat(current[key]))) : [...result[key], ...current[key]] : current[key];
652
+ } else if (isObject(result[key]) && isObject(current[key])) {
653
+ result[key] = merge(result[key], current[key]);
654
+ } else if (!isObject(result[key]) && isObject(current[key])) {
655
+ result[key] = merge(current[key], void 0);
656
+ } else {
657
+ result[key] = current[key] === void 0 ? merge.options.allowUndefinedOverrides ? current[key] : result[key] : current[key];
669
658
  }
670
- Object.keys(current).forEach((key) => {
671
- if (['__proto__', 'constructor', 'prototype'].includes(key)) {
672
- return;
673
- }
674
- if (Array.isArray(result[key]) && Array.isArray(current[key])) {
675
- result[key] = merge.options.mergeArrays
676
- ? merge.options.uniqueArrayItems
677
- ? Array.from(new Set(result[key].concat(current[key])))
678
- : [...result[key], ...current[key]]
679
- : current[key];
680
- } else if (isObject(result[key]) && isObject(current[key])) {
681
- result[key] = merge(result[key], current[key]);
682
- } else if (!isObject(result[key]) && isObject(current[key])) {
683
- result[key] = merge(current[key], void 0);
684
- } else {
685
- result[key] =
686
- current[key] === void 0
687
- ? merge.options.allowUndefinedOverrides
688
- ? current[key]
689
- : result[key]
690
- : current[key];
691
- }
692
- });
693
- return result;
694
- }, {});
659
+ });
660
+ return result;
661
+ }, {});
695
662
  var defaultOptions = {
696
663
  allowUndefinedOverrides: true,
697
664
  mergeArrays: true,
@@ -705,8 +672,8 @@ merge.withOptions = (options, ...objects) => {
705
672
  return result;
706
673
  };
707
674
 
708
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.3/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
709
- import { z } from 'zod/v3';
675
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.5/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
676
+ import { z } from "zod/v3";
710
677
  function extendApi(schema, schemaObject = {}) {
711
678
  const This = schema.constructor;
712
679
  const newSchema = new This(schema._def);
@@ -723,96 +690,89 @@ function iterateZodObject({
723
690
  hideDefinitions,
724
691
  openApiVersion
725
692
  }) {
726
- const reduced = Object.keys(zodRef.shape)
727
- .filter((key) => hideDefinitions?.includes(key) === false)
728
- .reduce(
729
- (carry, key) => ({
730
- ...carry,
731
- [key]: generateSchema(zodRef.shape[key], useOutput, openApiVersion)
732
- }),
733
- {}
734
- );
693
+ const reduced = Object.keys(zodRef.shape).filter((key) => hideDefinitions?.includes(key) === false).reduce(
694
+ (carry, key) => ({
695
+ ...carry,
696
+ [key]: generateSchema(zodRef.shape[key], useOutput, openApiVersion)
697
+ }),
698
+ {}
699
+ );
735
700
  return reduced;
736
701
  }
737
702
  function typeFormat(type22, openApiVersion) {
738
- return openApiVersion === '3.0' ? type22 : [type22];
703
+ return openApiVersion === "3.0" ? type22 : [type22];
739
704
  }
740
- function parseTransformation({ zodRef, schemas, useOutput, openApiVersion }) {
705
+ function parseTransformation({
706
+ zodRef,
707
+ schemas,
708
+ useOutput,
709
+ openApiVersion
710
+ }) {
741
711
  const input = generateSchema(zodRef._def.schema, useOutput, openApiVersion);
742
- let output = 'undefined';
712
+ let output = "undefined";
743
713
  if (useOutput && zodRef._def.effect) {
744
- const effect =
745
- zodRef._def.effect.type === 'transform' ? zodRef._def.effect : null;
746
- if (effect && 'transform' in effect) {
714
+ const effect = zodRef._def.effect.type === "transform" ? zodRef._def.effect : null;
715
+ if (effect && "transform" in effect) {
747
716
  try {
748
717
  const type22 = Array.isArray(input.type) ? input.type[0] : input.type;
749
718
  output = typeof effect.transform(
750
- ['integer', 'number'].includes(`${type22}`)
751
- ? 0
752
- : 'string' === type22
753
- ? ''
754
- : 'boolean' === type22
755
- ? false
756
- : 'object' === type22
757
- ? {}
758
- : 'null' === type22
759
- ? null
760
- : 'array' === type22
761
- ? []
762
- : void 0,
719
+ ["integer", "number"].includes(`${type22}`) ? 0 : "string" === type22 ? "" : "boolean" === type22 ? false : "object" === type22 ? {} : "null" === type22 ? null : "array" === type22 ? [] : void 0,
763
720
  { addIssue: () => void 0, path: [] }
764
721
  // TODO: Discover if context is necessary here
765
722
  );
766
- } catch {}
723
+ } catch {
724
+ }
767
725
  }
768
726
  }
769
727
  const outputType = output;
770
728
  return merge(
771
729
  {
772
- ...(zodRef.description ? { description: zodRef.description } : {}),
730
+ ...zodRef.description ? { description: zodRef.description } : {},
773
731
  ...input,
774
- ...(['number', 'string', 'boolean', 'null'].includes(output)
775
- ? {
776
- type: typeFormat(outputType, openApiVersion)
777
- }
778
- : {})
732
+ ...["number", "string", "boolean", "null"].includes(output) ? {
733
+ type: typeFormat(outputType, openApiVersion)
734
+ } : {}
779
735
  },
780
736
  ...schemas
781
737
  );
782
738
  }
783
- function parseString({ zodRef, schemas, openApiVersion }) {
739
+ function parseString({
740
+ zodRef,
741
+ schemas,
742
+ openApiVersion
743
+ }) {
784
744
  const baseSchema = {
785
- type: typeFormat('string', openApiVersion)
745
+ type: typeFormat("string", openApiVersion)
786
746
  };
787
747
  const { checks = [] } = zodRef._def;
788
748
  checks.forEach((item) => {
789
749
  switch (item.kind) {
790
- case 'email':
791
- baseSchema.format = 'email';
750
+ case "email":
751
+ baseSchema.format = "email";
792
752
  break;
793
- case 'uuid':
794
- baseSchema.format = 'uuid';
753
+ case "uuid":
754
+ baseSchema.format = "uuid";
795
755
  break;
796
- case 'cuid':
797
- baseSchema.format = 'cuid';
756
+ case "cuid":
757
+ baseSchema.format = "cuid";
798
758
  break;
799
- case 'url':
800
- baseSchema.format = 'uri';
759
+ case "url":
760
+ baseSchema.format = "uri";
801
761
  break;
802
- case 'datetime':
803
- baseSchema.format = 'date-time';
762
+ case "datetime":
763
+ baseSchema.format = "date-time";
804
764
  break;
805
- case 'length':
765
+ case "length":
806
766
  baseSchema.minLength = item.value;
807
767
  baseSchema.maxLength = item.value;
808
768
  break;
809
- case 'max':
769
+ case "max":
810
770
  baseSchema.maxLength = item.value;
811
771
  break;
812
- case 'min':
772
+ case "min":
813
773
  baseSchema.minLength = item.value;
814
774
  break;
815
- case 'regex':
775
+ case "regex":
816
776
  baseSchema.pattern = item.regex.source;
817
777
  break;
818
778
  }
@@ -823,41 +783,45 @@ function parseString({ zodRef, schemas, openApiVersion }) {
823
783
  ...schemas
824
784
  );
825
785
  }
826
- function parseNumber({ zodRef, schemas, openApiVersion }) {
786
+ function parseNumber({
787
+ zodRef,
788
+ schemas,
789
+ openApiVersion
790
+ }) {
827
791
  const baseSchema = {
828
- type: typeFormat('number', openApiVersion)
792
+ type: typeFormat("number", openApiVersion)
829
793
  };
830
794
  const { checks = [] } = zodRef._def;
831
795
  checks.forEach((item) => {
832
796
  switch (item.kind) {
833
- case 'max':
834
- if (item.inclusive || openApiVersion === '3.0') {
797
+ case "max":
798
+ if (item.inclusive || openApiVersion === "3.0") {
835
799
  baseSchema.maximum = item.value;
836
800
  }
837
801
  if (!item.inclusive) {
838
- if (openApiVersion === '3.0') {
802
+ if (openApiVersion === "3.0") {
839
803
  baseSchema.exclusiveMaximum = true;
840
804
  } else {
841
805
  baseSchema.exclusiveMaximum = item.value;
842
806
  }
843
807
  }
844
808
  break;
845
- case 'min':
846
- if (item.inclusive || openApiVersion === '3.0') {
809
+ case "min":
810
+ if (item.inclusive || openApiVersion === "3.0") {
847
811
  baseSchema.minimum = item.value;
848
812
  }
849
813
  if (!item.inclusive) {
850
- if (openApiVersion === '3.0') {
814
+ if (openApiVersion === "3.0") {
851
815
  baseSchema.exclusiveMinimum = true;
852
816
  } else {
853
817
  baseSchema.exclusiveMinimum = item.value;
854
818
  }
855
819
  }
856
820
  break;
857
- case 'int':
858
- baseSchema.type = typeFormat('integer', openApiVersion);
821
+ case "int":
822
+ baseSchema.type = typeFormat("integer", openApiVersion);
859
823
  break;
860
- case 'multipleOf':
824
+ case "multipleOf":
861
825
  baseSchema.multipleOf = item.value;
862
826
  break;
863
827
  }
@@ -885,37 +849,26 @@ function parseObject({
885
849
  openApiVersion
886
850
  }) {
887
851
  let additionalProperties;
888
- if (
889
- !(
890
- zodRef._def.catchall instanceof z.ZodNever ||
891
- zodRef._def.catchall?._def.typeName === 'ZodNever'
892
- )
893
- )
852
+ if (!(zodRef._def.catchall instanceof z.ZodNever || zodRef._def.catchall?._def.typeName === "ZodNever"))
894
853
  additionalProperties = generateSchema(
895
854
  zodRef._def.catchall,
896
855
  useOutput,
897
856
  openApiVersion
898
857
  );
899
- else if (zodRef._def.unknownKeys === 'passthrough')
858
+ else if (zodRef._def.unknownKeys === "passthrough")
900
859
  additionalProperties = true;
901
- else if (zodRef._def.unknownKeys === 'strict') additionalProperties = false;
902
- additionalProperties =
903
- additionalProperties != null ? { additionalProperties } : {};
904
- const requiredProperties = Object.keys(zodRef.shape).filter((key) => {
860
+ else if (zodRef._def.unknownKeys === "strict") additionalProperties = false;
861
+ additionalProperties = additionalProperties != null ? { additionalProperties } : {};
862
+ const requiredProperties = Object.keys(
863
+ zodRef.shape
864
+ ).filter((key) => {
905
865
  const item = zodRef.shape[key];
906
- return (
907
- !(
908
- item.isOptional() ||
909
- item instanceof z.ZodDefault ||
910
- item._def.typeName === 'ZodDefault'
911
- ) && !(item instanceof z.ZodNever || item._def.typeName === 'ZodDefault')
912
- );
866
+ return !(item.isOptional() || item instanceof z.ZodDefault || item._def.typeName === "ZodDefault") && !(item instanceof z.ZodNever || item._def.typeName === "ZodDefault");
913
867
  });
914
- const required =
915
- requiredProperties.length > 0 ? { required: requiredProperties } : {};
868
+ const required = requiredProperties.length > 0 ? { required: requiredProperties } : {};
916
869
  return merge(
917
870
  {
918
- type: typeFormat('object', openApiVersion),
871
+ type: typeFormat("object", openApiVersion),
919
872
  properties: iterateZodObject({
920
873
  zodRef,
921
874
  schemas,
@@ -927,83 +880,110 @@ function parseObject({
927
880
  ...additionalProperties,
928
881
  ...hideDefinitions
929
882
  },
930
- zodRef.description
931
- ? { description: zodRef.description, hideDefinitions }
932
- : {},
883
+ zodRef.description ? { description: zodRef.description, hideDefinitions } : {},
933
884
  ...schemas
934
885
  );
935
886
  }
936
- function parseRecord({ zodRef, schemas, useOutput, openApiVersion }) {
887
+ function parseRecord({
888
+ zodRef,
889
+ schemas,
890
+ useOutput,
891
+ openApiVersion
892
+ }) {
937
893
  return merge(
938
894
  {
939
- type: typeFormat('object', openApiVersion),
940
- additionalProperties:
941
- zodRef._def.valueType instanceof z.ZodUnknown
942
- ? {}
943
- : generateSchema(zodRef._def.valueType, useOutput, openApiVersion)
895
+ type: typeFormat("object", openApiVersion),
896
+ additionalProperties: zodRef._def.valueType instanceof z.ZodUnknown ? {} : generateSchema(zodRef._def.valueType, useOutput, openApiVersion)
944
897
  },
945
898
  zodRef.description ? { description: zodRef.description } : {},
946
899
  ...schemas
947
900
  );
948
901
  }
949
- function parseBigInt({ zodRef, schemas, openApiVersion }) {
902
+ function parseBigInt({
903
+ zodRef,
904
+ schemas,
905
+ openApiVersion
906
+ }) {
950
907
  return merge(
951
908
  {
952
- type: typeFormat('integer', openApiVersion),
953
- format: 'int64'
909
+ type: typeFormat("integer", openApiVersion),
910
+ format: "int64"
954
911
  },
955
912
  zodRef.description ? { description: zodRef.description } : {},
956
913
  ...schemas
957
914
  );
958
915
  }
959
- function parseBoolean({ zodRef, schemas, openApiVersion }) {
916
+ function parseBoolean({
917
+ zodRef,
918
+ schemas,
919
+ openApiVersion
920
+ }) {
960
921
  return merge(
961
- { type: typeFormat('boolean', openApiVersion) },
922
+ { type: typeFormat("boolean", openApiVersion) },
962
923
  zodRef.description ? { description: zodRef.description } : {},
963
924
  ...schemas
964
925
  );
965
926
  }
966
- function parseDate({ zodRef, schemas, openApiVersion }) {
927
+ function parseDate({
928
+ zodRef,
929
+ schemas,
930
+ openApiVersion
931
+ }) {
967
932
  return merge(
968
933
  {
969
- type: typeFormat('string', openApiVersion),
970
- format: 'date-time'
934
+ type: typeFormat("string", openApiVersion),
935
+ format: "date-time"
971
936
  },
972
937
  zodRef.description ? { description: zodRef.description } : {},
973
938
  ...schemas
974
939
  );
975
940
  }
976
- function parseNull({ zodRef, schemas, openApiVersion }) {
941
+ function parseNull({
942
+ zodRef,
943
+ schemas,
944
+ openApiVersion
945
+ }) {
977
946
  return merge(
978
- openApiVersion === '3.0'
979
- ? { type: 'null' }
980
- : {
981
- type: ['string', 'null'],
982
- enum: ['null']
983
- },
947
+ openApiVersion === "3.0" ? { type: "null" } : {
948
+ type: ["string", "null"],
949
+ enum: ["null"]
950
+ },
984
951
  zodRef.description ? { description: zodRef.description } : {},
985
952
  ...schemas
986
953
  );
987
954
  }
988
- function parseOptional({ schemas, zodRef, useOutput, openApiVersion }) {
955
+ function parseOptional({
956
+ schemas,
957
+ zodRef,
958
+ useOutput,
959
+ openApiVersion
960
+ }) {
989
961
  return merge(
990
962
  generateSchema(zodRef.unwrap(), useOutput, openApiVersion),
991
963
  zodRef.description ? { description: zodRef.description } : {},
992
964
  ...schemas
993
965
  );
994
966
  }
995
- function parseNullable({ schemas, zodRef, useOutput, openApiVersion }) {
967
+ function parseNullable({
968
+ schemas,
969
+ zodRef,
970
+ useOutput,
971
+ openApiVersion
972
+ }) {
996
973
  const schema = generateSchema(zodRef.unwrap(), useOutput, openApiVersion);
997
974
  return merge(
998
975
  schema,
999
- openApiVersion === '3.0'
1000
- ? { nullable: true }
1001
- : { type: typeFormat('null', openApiVersion) },
976
+ openApiVersion === "3.0" ? { nullable: true } : { type: typeFormat("null", openApiVersion) },
1002
977
  zodRef.description ? { description: zodRef.description } : {},
1003
978
  ...schemas
1004
979
  );
1005
980
  }
1006
- function parseDefault({ schemas, zodRef, useOutput, openApiVersion }) {
981
+ function parseDefault({
982
+ schemas,
983
+ zodRef,
984
+ useOutput,
985
+ openApiVersion
986
+ }) {
1007
987
  return merge(
1008
988
  {
1009
989
  default: zodRef._def.defaultValue(),
@@ -1013,7 +993,12 @@ function parseDefault({ schemas, zodRef, useOutput, openApiVersion }) {
1013
993
  ...schemas
1014
994
  );
1015
995
  }
1016
- function parseArray({ schemas, zodRef, useOutput, openApiVersion }) {
996
+ function parseArray({
997
+ schemas,
998
+ zodRef,
999
+ useOutput,
1000
+ openApiVersion
1001
+ }) {
1017
1002
  const constraints = {};
1018
1003
  if (zodRef._def.exactLength != null) {
1019
1004
  constraints.minItems = zodRef._def.exactLength.value;
@@ -1025,7 +1010,7 @@ function parseArray({ schemas, zodRef, useOutput, openApiVersion }) {
1025
1010
  constraints.maxItems = zodRef._def.maxLength.value;
1026
1011
  return merge(
1027
1012
  {
1028
- type: typeFormat('array', openApiVersion),
1013
+ type: typeFormat("array", openApiVersion),
1029
1014
  items: generateSchema(zodRef.element, useOutput, openApiVersion),
1030
1015
  ...constraints
1031
1016
  },
@@ -1033,7 +1018,11 @@ function parseArray({ schemas, zodRef, useOutput, openApiVersion }) {
1033
1018
  ...schemas
1034
1019
  );
1035
1020
  }
1036
- function parseLiteral({ schemas, zodRef, openApiVersion }) {
1021
+ function parseLiteral({
1022
+ schemas,
1023
+ zodRef,
1024
+ openApiVersion
1025
+ }) {
1037
1026
  const type22 = typeof zodRef._def.value;
1038
1027
  return merge(
1039
1028
  {
@@ -1044,7 +1033,11 @@ function parseLiteral({ schemas, zodRef, openApiVersion }) {
1044
1033
  ...schemas
1045
1034
  );
1046
1035
  }
1047
- function parseEnum({ schemas, zodRef, openApiVersion }) {
1036
+ function parseEnum({
1037
+ schemas,
1038
+ zodRef,
1039
+ openApiVersion
1040
+ }) {
1048
1041
  const type22 = typeof Object.values(zodRef._def.values)[0];
1049
1042
  return merge(
1050
1043
  {
@@ -1055,7 +1048,12 @@ function parseEnum({ schemas, zodRef, openApiVersion }) {
1055
1048
  ...schemas
1056
1049
  );
1057
1050
  }
1058
- function parseIntersection({ schemas, zodRef, useOutput, openApiVersion }) {
1051
+ function parseIntersection({
1052
+ schemas,
1053
+ zodRef,
1054
+ useOutput,
1055
+ openApiVersion
1056
+ }) {
1059
1057
  return merge(
1060
1058
  {
1061
1059
  allOf: [
@@ -1067,20 +1065,20 @@ function parseIntersection({ schemas, zodRef, useOutput, openApiVersion }) {
1067
1065
  ...schemas
1068
1066
  );
1069
1067
  }
1070
- function parseUnion({ schemas, zodRef, useOutput, openApiVersion }) {
1068
+ function parseUnion({
1069
+ schemas,
1070
+ zodRef,
1071
+ useOutput,
1072
+ openApiVersion
1073
+ }) {
1071
1074
  const contents = zodRef._def.options;
1072
- if (
1073
- contents.reduce(
1074
- (prev, content) => prev && content._def.typeName === 'ZodLiteral',
1075
- true
1076
- )
1077
- ) {
1075
+ if (contents.reduce(
1076
+ (prev, content) => prev && content._def.typeName === "ZodLiteral",
1077
+ true
1078
+ )) {
1078
1079
  const literals = contents;
1079
1080
  const type22 = literals.reduce(
1080
- (prev, content) =>
1081
- !prev || prev === typeof content._def.value
1082
- ? typeof content._def.value
1083
- : null,
1081
+ (prev, content) => !prev || prev === typeof content._def.value ? typeof content._def.value : null,
1084
1082
  null
1085
1083
  );
1086
1084
  if (type22) {
@@ -1094,15 +1092,12 @@ function parseUnion({ schemas, zodRef, useOutput, openApiVersion }) {
1094
1092
  );
1095
1093
  }
1096
1094
  }
1097
- const oneOfContents =
1098
- openApiVersion === '3.0'
1099
- ? contents.filter((content) => content._def.typeName !== 'ZodNull')
1100
- : contents;
1095
+ const oneOfContents = openApiVersion === "3.0" ? contents.filter((content) => content._def.typeName !== "ZodNull") : contents;
1101
1096
  const contentsHasNull = contents.length != oneOfContents.length;
1102
1097
  return merge(
1103
1098
  {
1104
- oneOf: oneOfContents.map((schema) =>
1105
- generateSchema(schema, useOutput, openApiVersion)
1099
+ oneOf: oneOfContents.map(
1100
+ (schema) => generateSchema(schema, useOutput, openApiVersion)
1106
1101
  )
1107
1102
  },
1108
1103
  contentsHasNull ? { nullable: true } : {},
@@ -1121,34 +1116,50 @@ function parseDiscriminatedUnion({
1121
1116
  discriminator: {
1122
1117
  propertyName: zodRef._def.discriminator
1123
1118
  },
1124
- oneOf: Array.from(zodRef._def.options.values()).map((schema) =>
1125
- generateSchema(schema, useOutput, openApiVersion)
1126
- )
1119
+ oneOf: Array.from(
1120
+ zodRef._def.options.values()
1121
+ ).map((schema) => generateSchema(schema, useOutput, openApiVersion))
1127
1122
  },
1128
1123
  zodRef.description ? { description: zodRef.description } : {},
1129
1124
  ...schemas
1130
1125
  );
1131
1126
  }
1132
- function parseNever({ zodRef, schemas }) {
1127
+ function parseNever({
1128
+ zodRef,
1129
+ schemas
1130
+ }) {
1133
1131
  return merge(
1134
1132
  { readOnly: true },
1135
1133
  zodRef.description ? { description: zodRef.description } : {},
1136
1134
  ...schemas
1137
1135
  );
1138
1136
  }
1139
- function parseBranded({ schemas, zodRef, useOutput, openApiVersion }) {
1137
+ function parseBranded({
1138
+ schemas,
1139
+ zodRef,
1140
+ useOutput,
1141
+ openApiVersion
1142
+ }) {
1140
1143
  return merge(
1141
1144
  generateSchema(zodRef._def.type, useOutput, openApiVersion),
1142
1145
  ...schemas
1143
1146
  );
1144
1147
  }
1145
- function catchAllParser({ zodRef, schemas }) {
1148
+ function catchAllParser({
1149
+ zodRef,
1150
+ schemas
1151
+ }) {
1146
1152
  return merge(
1147
1153
  zodRef.description ? { description: zodRef.description } : {},
1148
1154
  ...schemas
1149
1155
  );
1150
1156
  }
1151
- function parsePipeline({ schemas, zodRef, useOutput, openApiVersion }) {
1157
+ function parsePipeline({
1158
+ schemas,
1159
+ zodRef,
1160
+ useOutput,
1161
+ openApiVersion
1162
+ }) {
1152
1163
  return merge(
1153
1164
  generateSchema(
1154
1165
  useOutput ? zodRef._def.out : zodRef._def.in,
@@ -1158,7 +1169,12 @@ function parsePipeline({ schemas, zodRef, useOutput, openApiVersion }) {
1158
1169
  ...schemas
1159
1170
  );
1160
1171
  }
1161
- function parseReadonly({ zodRef, useOutput, schemas, openApiVersion }) {
1172
+ function parseReadonly({
1173
+ zodRef,
1174
+ useOutput,
1175
+ schemas,
1176
+ openApiVersion
1177
+ }) {
1162
1178
  return merge(
1163
1179
  generateSchema(zodRef._def.innerType, useOutput, openApiVersion),
1164
1180
  zodRef.description ? { description: zodRef.description } : {},
@@ -1202,10 +1218,10 @@ var workerMap = {
1202
1218
  ZodPipeline: parsePipeline,
1203
1219
  ZodReadonly: parseReadonly
1204
1220
  };
1205
- function generateSchema(zodRef, useOutput = false, openApiVersion = '3.1') {
1221
+ function generateSchema(zodRef, useOutput = false, openApiVersion = "3.1") {
1206
1222
  const { metaOpenApi = {} } = zodRef;
1207
1223
  const schemas = [
1208
- ...(Array.isArray(metaOpenApi) ? metaOpenApi : [metaOpenApi])
1224
+ ...Array.isArray(metaOpenApi) ? metaOpenApi : [metaOpenApi]
1209
1225
  ];
1210
1226
  try {
1211
1227
  const typeName = zodRef._def.typeName;
@@ -1224,173 +1240,155 @@ function generateSchema(zodRef, useOutput = false, openApiVersion = '3.1') {
1224
1240
  }
1225
1241
  }
1226
1242
  function extendZodWithOpenApi(zod, forceOverride = false) {
1227
- if (
1228
- !forceOverride &&
1229
- typeof zod.ZodSchema.prototype.openapi !== 'undefined'
1230
- ) {
1243
+ if (!forceOverride && typeof zod.ZodSchema.prototype.openapi !== "undefined") {
1231
1244
  return;
1232
1245
  }
1233
- zod.ZodSchema.prototype.openapi = function (metadata) {
1246
+ zod.ZodSchema.prototype.openapi = function(metadata) {
1234
1247
  return extendApi(this, metadata);
1235
1248
  };
1236
1249
  }
1237
1250
  extendZodWithOpenApi(z2);
1238
1251
  var ZodSchemaValidator = class {
1239
- _Type = 'Zod';
1252
+ _Type = "Zod";
1240
1253
  _SchemaCatchall;
1241
1254
  _ValidSchemaObject;
1242
1255
  string = z2.string().openapi({
1243
- title: 'String',
1244
- example: 'a string'
1256
+ title: "String",
1257
+ example: "a string"
1245
1258
  });
1246
1259
  uuid = z2.string().uuid().openapi({
1247
- title: 'UUID',
1248
- format: 'uuid',
1249
- pattern:
1250
- '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$',
1251
- example: 'a8b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6'
1260
+ title: "UUID",
1261
+ format: "uuid",
1262
+ pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
1263
+ example: "a8b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6"
1252
1264
  });
1253
1265
  email = z2.string().email().openapi({
1254
- title: 'Email',
1255
- format: 'email',
1256
- pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$',
1257
- example: 'a@b.com'
1266
+ title: "Email",
1267
+ format: "email",
1268
+ pattern: "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
1269
+ example: "a@b.com"
1258
1270
  });
1259
1271
  uri = z2.string().url().openapi({
1260
- title: 'URI',
1261
- format: 'uri',
1262
- pattern: '^[a-zA-Z][a-zA-Z\\d+-.]*:[^\\s]*$',
1263
- example: 'https://forklaunch.com'
1272
+ title: "URI",
1273
+ format: "uri",
1274
+ pattern: "^[a-zA-Z][a-zA-Z\\d+-.]*:[^\\s]*$",
1275
+ example: "https://forklaunch.com"
1264
1276
  });
1265
- number = z2
1266
- .preprocess((value) => {
1267
- try {
1268
- return Number(value);
1269
- } catch {
1270
- return value;
1271
- }
1272
- }, z2.number())
1273
- .openapi({
1274
- title: 'Number',
1275
- example: 123
1276
- });
1277
- bigint = z2
1278
- .preprocess((value) => {
1279
- try {
1280
- if (value instanceof Date) {
1281
- return BigInt(value.getTime());
1282
- }
1283
- switch (typeof value) {
1284
- case 'number':
1285
- case 'string':
1286
- return BigInt(value);
1287
- case 'boolean':
1288
- return BigInt(value ? 1 : 0);
1289
- default:
1290
- return value;
1291
- }
1292
- } catch {
1293
- return value;
1277
+ number = z2.preprocess((value) => {
1278
+ try {
1279
+ return Number(value);
1280
+ } catch {
1281
+ return value;
1282
+ }
1283
+ }, z2.number()).openapi({
1284
+ title: "Number",
1285
+ example: 123
1286
+ });
1287
+ bigint = z2.preprocess((value) => {
1288
+ try {
1289
+ if (value instanceof Date) {
1290
+ return BigInt(value.getTime());
1294
1291
  }
1295
- }, z2.bigint())
1296
- .openapi({
1297
- title: 'BigInt',
1298
- type: 'integer',
1299
- format: 'int64',
1300
- example: 123n
1301
- });
1302
- boolean = z2
1303
- .preprocess((val) => {
1304
- if (typeof val === 'string') {
1305
- if (val.toLowerCase() === 'true') return true;
1306
- if (val.toLowerCase() === 'false') return false;
1292
+ switch (typeof value) {
1293
+ case "number":
1294
+ case "string":
1295
+ return BigInt(value);
1296
+ case "boolean":
1297
+ return BigInt(value ? 1 : 0);
1298
+ default:
1299
+ return value;
1307
1300
  }
1308
- return val;
1309
- }, z2.boolean())
1310
- .openapi({
1311
- title: 'Boolean',
1312
- example: true
1313
- });
1314
- date = z2
1315
- .preprocess((value) => {
1316
- try {
1317
- switch (typeof value) {
1318
- case 'string':
1319
- return new Date(value);
1320
- case 'number':
1321
- return new Date(value);
1322
- default:
1323
- return value;
1324
- }
1325
- } catch {
1326
- return value;
1301
+ } catch {
1302
+ return value;
1303
+ }
1304
+ }, z2.bigint()).openapi({
1305
+ title: "BigInt",
1306
+ type: "integer",
1307
+ format: "int64",
1308
+ example: 123n
1309
+ });
1310
+ boolean = z2.preprocess((val) => {
1311
+ if (typeof val === "string") {
1312
+ if (val.toLowerCase() === "true") return true;
1313
+ if (val.toLowerCase() === "false") return false;
1314
+ }
1315
+ return val;
1316
+ }, z2.boolean()).openapi({
1317
+ title: "Boolean",
1318
+ example: true
1319
+ });
1320
+ date = z2.preprocess((value) => {
1321
+ try {
1322
+ switch (typeof value) {
1323
+ case "string":
1324
+ return new Date(value);
1325
+ case "number":
1326
+ return new Date(value);
1327
+ default:
1328
+ return value;
1327
1329
  }
1328
- }, z2.date())
1329
- .openapi({
1330
- title: 'Date',
1331
- type: 'string',
1332
- format: 'date-time',
1333
- example: '2025-05-16T21:13:04.123Z'
1334
- });
1330
+ } catch {
1331
+ return value;
1332
+ }
1333
+ }, z2.date()).openapi({
1334
+ title: "Date",
1335
+ type: "string",
1336
+ format: "date-time",
1337
+ example: "2025-05-16T21:13:04.123Z"
1338
+ });
1335
1339
  symbol = z2.symbol().openapi({
1336
- title: 'Symbol',
1337
- example: Symbol('symbol')
1340
+ title: "Symbol",
1341
+ example: Symbol("symbol")
1338
1342
  });
1339
1343
  nullish = z2.union([z2.void(), z2.null(), z2.undefined()]).openapi({
1340
- title: 'Nullish',
1341
- type: 'null',
1344
+ title: "Nullish",
1345
+ type: "null",
1342
1346
  example: null
1343
1347
  });
1344
1348
  void = z2.void().openapi({
1345
- title: 'Void',
1346
- type: 'null',
1349
+ title: "Void",
1350
+ type: "null",
1347
1351
  example: void 0
1348
1352
  });
1349
1353
  null = z2.null().openapi({
1350
- title: 'Null',
1351
- type: 'null',
1354
+ title: "Null",
1355
+ type: "null",
1352
1356
  example: null
1353
1357
  });
1354
1358
  undefined = z2.undefined().openapi({
1355
- title: 'Undefined',
1356
- type: 'null',
1359
+ title: "Undefined",
1360
+ type: "null",
1357
1361
  example: void 0
1358
1362
  });
1359
1363
  any = z2.any().openapi({
1360
- title: 'Any',
1361
- type: 'object',
1362
- example: 'any'
1364
+ title: "Any",
1365
+ type: "object",
1366
+ example: "any"
1363
1367
  });
1364
1368
  unknown = z2.unknown().openapi({
1365
- title: 'Unknown',
1366
- type: 'object',
1367
- example: 'unknown'
1369
+ title: "Unknown",
1370
+ type: "object",
1371
+ example: "unknown"
1368
1372
  });
1369
1373
  never = z2.never().openapi({
1370
- title: 'Never',
1371
- type: 'null',
1372
- example: 'never'
1374
+ title: "Never",
1375
+ type: "null",
1376
+ example: "never"
1377
+ });
1378
+ binary = z2.string().transform((val) => new Uint8Array(Buffer.from(val, "base64"))).openapi({
1379
+ title: "Binary",
1380
+ type: "string",
1381
+ format: "binary",
1382
+ example: "a base-64 encodable string"
1383
+ });
1384
+ file = z2.instanceof(Buffer).transform((val) => {
1385
+ return new Blob([val]);
1386
+ }).openapi({
1387
+ title: "File",
1388
+ type: "string",
1389
+ format: "binary",
1390
+ example: "a base-64 encodable blob or file"
1373
1391
  });
1374
- binary = z2
1375
- .string()
1376
- .transform((val) => new Uint8Array(Buffer.from(val, 'base64')))
1377
- .openapi({
1378
- title: 'Binary',
1379
- type: 'string',
1380
- format: 'binary',
1381
- example: 'a base-64 encodable string'
1382
- });
1383
- file = z2
1384
- .instanceof(Buffer)
1385
- .transform((val) => {
1386
- return new Blob([val]);
1387
- })
1388
- .openapi({
1389
- title: 'File',
1390
- type: 'string',
1391
- format: 'binary',
1392
- example: 'a base-64 encodable blob or file'
1393
- });
1394
1392
  type = () => this.any;
1395
1393
  /**
1396
1394
  * Compiles schema if this exists, for optimal performance.
@@ -1407,11 +1405,7 @@ var ZodSchemaValidator = class {
1407
1405
  * @returns {ZodResolve<T>} The resolved schema.
1408
1406
  */
1409
1407
  schemify(schema) {
1410
- if (
1411
- typeof schema === 'string' ||
1412
- typeof schema === 'number' ||
1413
- typeof schema === 'boolean'
1414
- ) {
1408
+ if (typeof schema === "string" || typeof schema === "number" || typeof schema === "boolean") {
1415
1409
  return z2.literal(schema);
1416
1410
  }
1417
1411
  if (schema instanceof ZodType) {
@@ -1452,7 +1446,9 @@ var ZodSchemaValidator = class {
1452
1446
  */
1453
1447
  union(schemas) {
1454
1448
  const resolvedSchemas = schemas.map((schema) => this.schemify(schema));
1455
- return z2.union(resolvedSchemas);
1449
+ return z2.union(
1450
+ resolvedSchemas
1451
+ );
1456
1452
  }
1457
1453
  /**
1458
1454
  * Create a literal schema.
@@ -1468,7 +1464,9 @@ var ZodSchemaValidator = class {
1468
1464
  * @returns {ZodUnion<UnionZodResolve<[T, T, ...T[]]>>} The enum schema.
1469
1465
  */
1470
1466
  enum_(schemaEnum) {
1471
- return this.union(Object.values(schemaEnum));
1467
+ return this.union(
1468
+ Object.values(schemaEnum)
1469
+ );
1472
1470
  }
1473
1471
  /**
1474
1472
  * Create a function schema.
@@ -1537,33 +1535,31 @@ var ZodSchemaValidator = class {
1537
1535
  parse(schema, value) {
1538
1536
  const resolvedSchema = this.schemify(schema);
1539
1537
  const result = resolvedSchema.safeParse(value);
1540
- return result.success
1541
- ? { ok: true, value: result.data }
1542
- : {
1543
- ok: false,
1544
- errors: result.error.errors.flatMap((error) => {
1545
- switch (error.code) {
1546
- case 'invalid_union':
1547
- return error.unionErrors.flatMap((unionError, idx) =>
1548
- unionError.errors.map((e) => ({
1549
- path: [
1550
- `Union Schema Variant ${idx}`,
1551
- ...error.path.map((p) => p.toString()),
1552
- ...e.path.map((p) => p.toString())
1553
- ],
1554
- message: e.message
1555
- }))
1556
- );
1557
- default:
1558
- return [
1559
- {
1560
- path: error.path.map((p) => p.toString()),
1561
- message: error.message
1562
- }
1563
- ];
1564
- }
1565
- })
1566
- };
1538
+ return result.success ? { ok: true, value: result.data } : {
1539
+ ok: false,
1540
+ errors: result.error.errors.flatMap((error) => {
1541
+ switch (error.code) {
1542
+ case "invalid_union":
1543
+ return error.unionErrors.flatMap(
1544
+ (unionError, idx) => unionError.errors.map((e) => ({
1545
+ path: [
1546
+ `Union Schema Variant ${idx}`,
1547
+ ...error.path.map((p) => p.toString()),
1548
+ ...e.path.map((p) => p.toString())
1549
+ ],
1550
+ message: e.message
1551
+ }))
1552
+ );
1553
+ default:
1554
+ return [
1555
+ {
1556
+ path: error.path.map((p) => p.toString()),
1557
+ message: error.message
1558
+ }
1559
+ ];
1560
+ }
1561
+ })
1562
+ };
1567
1563
  }
1568
1564
  /**
1569
1565
  * Convert a schema to an OpenAPI schema object.
@@ -1624,4 +1620,6 @@ var KafkaWorkerSchemas = serviceSchemaResolver(
1624
1620
  () => KafkaWorkerOptionsSchema,
1625
1621
  () => KafkaWorkerOptionsSchema2
1626
1622
  );
1627
- export { KafkaWorkerSchemas };
1623
+ export {
1624
+ KafkaWorkerSchemas
1625
+ };