@forklaunch/implementation-worker-kafka 0.6.2 → 0.6.4

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