@forklaunch/implementation-worker-redis 0.6.3 → 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/redisWorker.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
  }
@@ -616,46 +640,55 @@ var RedisWorkerOptionsSchema = {
616
640
  interval: number
617
641
  };
618
642
 
619
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.5/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
620
- import {
621
- z as z2,
622
- ZodType
623
- } from "zod/v3";
643
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.7/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
644
+ import { z as z2, ZodType } from 'zod/v3';
624
645
 
625
646
  // ../../../node_modules/.pnpm/ts-deepmerge@7.0.3/node_modules/ts-deepmerge/esm/index.js
626
647
  var isObject = (obj) => {
627
- if (typeof obj === "object" && obj !== null) {
628
- if (typeof Object.getPrototypeOf === "function") {
648
+ if (typeof obj === 'object' && obj !== null) {
649
+ if (typeof Object.getPrototypeOf === 'function') {
629
650
  const prototype = Object.getPrototypeOf(obj);
630
651
  return prototype === Object.prototype || prototype === null;
631
652
  }
632
- return Object.prototype.toString.call(obj) === "[object Object]";
653
+ return Object.prototype.toString.call(obj) === '[object Object]';
633
654
  }
634
655
  return false;
635
656
  };
636
- var merge = (...objects) => objects.reduce((result, current) => {
637
- if (current === void 0) {
638
- return result;
639
- }
640
- if (Array.isArray(current)) {
641
- throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
642
- }
643
- Object.keys(current).forEach((key) => {
644
- if (["__proto__", "constructor", "prototype"].includes(key)) {
645
- return;
657
+ var merge = (...objects) =>
658
+ objects.reduce((result, current) => {
659
+ if (current === void 0) {
660
+ return result;
646
661
  }
647
- if (Array.isArray(result[key]) && Array.isArray(current[key])) {
648
- result[key] = merge.options.mergeArrays ? merge.options.uniqueArrayItems ? Array.from(new Set(result[key].concat(current[key]))) : [...result[key], ...current[key]] : current[key];
649
- } else if (isObject(result[key]) && isObject(current[key])) {
650
- result[key] = merge(result[key], current[key]);
651
- } else if (!isObject(result[key]) && isObject(current[key])) {
652
- result[key] = merge(current[key], void 0);
653
- } else {
654
- result[key] = current[key] === void 0 ? merge.options.allowUndefinedOverrides ? current[key] : result[key] : current[key];
662
+ if (Array.isArray(current)) {
663
+ throw new TypeError(
664
+ 'Arguments provided to ts-deepmerge must be objects, not arrays.'
665
+ );
655
666
  }
656
- });
657
- return result;
658
- }, {});
667
+ Object.keys(current).forEach((key) => {
668
+ if (['__proto__', 'constructor', 'prototype'].includes(key)) {
669
+ return;
670
+ }
671
+ if (Array.isArray(result[key]) && Array.isArray(current[key])) {
672
+ result[key] = merge.options.mergeArrays
673
+ ? merge.options.uniqueArrayItems
674
+ ? Array.from(new Set(result[key].concat(current[key])))
675
+ : [...result[key], ...current[key]]
676
+ : current[key];
677
+ } else if (isObject(result[key]) && isObject(current[key])) {
678
+ result[key] = merge(result[key], current[key]);
679
+ } else if (!isObject(result[key]) && isObject(current[key])) {
680
+ result[key] = merge(current[key], void 0);
681
+ } else {
682
+ result[key] =
683
+ current[key] === void 0
684
+ ? merge.options.allowUndefinedOverrides
685
+ ? current[key]
686
+ : result[key]
687
+ : current[key];
688
+ }
689
+ });
690
+ return result;
691
+ }, {});
659
692
  var defaultOptions = {
660
693
  allowUndefinedOverrides: true,
661
694
  mergeArrays: true,
@@ -669,8 +702,8 @@ merge.withOptions = (options, ...objects) => {
669
702
  return result;
670
703
  };
671
704
 
672
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.5/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
673
- import { z } from "zod/v3";
705
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.7/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
706
+ import { z } from 'zod/v3';
674
707
  function extendApi(schema, schemaObject = {}) {
675
708
  const This = schema.constructor;
676
709
  const newSchema = new This(schema._def);
@@ -687,89 +720,96 @@ function iterateZodObject({
687
720
  hideDefinitions,
688
721
  openApiVersion
689
722
  }) {
690
- const reduced = Object.keys(zodRef.shape).filter((key) => hideDefinitions?.includes(key) === false).reduce(
691
- (carry, key) => ({
692
- ...carry,
693
- [key]: generateSchema(zodRef.shape[key], useOutput, openApiVersion)
694
- }),
695
- {}
696
- );
723
+ const reduced = Object.keys(zodRef.shape)
724
+ .filter((key) => hideDefinitions?.includes(key) === false)
725
+ .reduce(
726
+ (carry, key) => ({
727
+ ...carry,
728
+ [key]: generateSchema(zodRef.shape[key], useOutput, openApiVersion)
729
+ }),
730
+ {}
731
+ );
697
732
  return reduced;
698
733
  }
699
734
  function typeFormat(type22, openApiVersion) {
700
- return openApiVersion === "3.0" ? type22 : [type22];
735
+ return openApiVersion === '3.0' ? type22 : [type22];
701
736
  }
702
- function parseTransformation({
703
- zodRef,
704
- schemas,
705
- useOutput,
706
- openApiVersion
707
- }) {
737
+ function parseTransformation({ zodRef, schemas, useOutput, openApiVersion }) {
708
738
  const input = generateSchema(zodRef._def.schema, useOutput, openApiVersion);
709
- let output = "undefined";
739
+ let output = 'undefined';
710
740
  if (useOutput && zodRef._def.effect) {
711
- const effect = zodRef._def.effect.type === "transform" ? zodRef._def.effect : null;
712
- if (effect && "transform" in effect) {
741
+ const effect =
742
+ zodRef._def.effect.type === 'transform' ? zodRef._def.effect : null;
743
+ if (effect && 'transform' in effect) {
713
744
  try {
714
745
  const type22 = Array.isArray(input.type) ? input.type[0] : input.type;
715
746
  output = typeof effect.transform(
716
- ["integer", "number"].includes(`${type22}`) ? 0 : "string" === type22 ? "" : "boolean" === type22 ? false : "object" === type22 ? {} : "null" === type22 ? null : "array" === type22 ? [] : void 0,
747
+ ['integer', 'number'].includes(`${type22}`)
748
+ ? 0
749
+ : 'string' === type22
750
+ ? ''
751
+ : 'boolean' === type22
752
+ ? false
753
+ : 'object' === type22
754
+ ? {}
755
+ : 'null' === type22
756
+ ? null
757
+ : 'array' === type22
758
+ ? []
759
+ : void 0,
717
760
  { addIssue: () => void 0, path: [] }
718
761
  // TODO: Discover if context is necessary here
719
762
  );
720
- } catch {
721
- }
763
+ } catch {}
722
764
  }
723
765
  }
724
766
  const outputType = output;
725
767
  return merge(
726
768
  {
727
- ...zodRef.description ? { description: zodRef.description } : {},
769
+ ...(zodRef.description ? { description: zodRef.description } : {}),
728
770
  ...input,
729
- ...["number", "string", "boolean", "null"].includes(output) ? {
730
- type: typeFormat(outputType, openApiVersion)
731
- } : {}
771
+ ...(['number', 'string', 'boolean', 'null'].includes(output)
772
+ ? {
773
+ type: typeFormat(outputType, openApiVersion)
774
+ }
775
+ : {})
732
776
  },
733
777
  ...schemas
734
778
  );
735
779
  }
736
- function parseString({
737
- zodRef,
738
- schemas,
739
- openApiVersion
740
- }) {
780
+ function parseString({ zodRef, schemas, openApiVersion }) {
741
781
  const baseSchema = {
742
- type: typeFormat("string", openApiVersion)
782
+ type: typeFormat('string', openApiVersion)
743
783
  };
744
784
  const { checks = [] } = zodRef._def;
745
785
  checks.forEach((item) => {
746
786
  switch (item.kind) {
747
- case "email":
748
- baseSchema.format = "email";
787
+ case 'email':
788
+ baseSchema.format = 'email';
749
789
  break;
750
- case "uuid":
751
- baseSchema.format = "uuid";
790
+ case 'uuid':
791
+ baseSchema.format = 'uuid';
752
792
  break;
753
- case "cuid":
754
- baseSchema.format = "cuid";
793
+ case 'cuid':
794
+ baseSchema.format = 'cuid';
755
795
  break;
756
- case "url":
757
- baseSchema.format = "uri";
796
+ case 'url':
797
+ baseSchema.format = 'uri';
758
798
  break;
759
- case "datetime":
760
- baseSchema.format = "date-time";
799
+ case 'datetime':
800
+ baseSchema.format = 'date-time';
761
801
  break;
762
- case "length":
802
+ case 'length':
763
803
  baseSchema.minLength = item.value;
764
804
  baseSchema.maxLength = item.value;
765
805
  break;
766
- case "max":
806
+ case 'max':
767
807
  baseSchema.maxLength = item.value;
768
808
  break;
769
- case "min":
809
+ case 'min':
770
810
  baseSchema.minLength = item.value;
771
811
  break;
772
- case "regex":
812
+ case 'regex':
773
813
  baseSchema.pattern = item.regex.source;
774
814
  break;
775
815
  }
@@ -780,45 +820,41 @@ function parseString({
780
820
  ...schemas
781
821
  );
782
822
  }
783
- function parseNumber({
784
- zodRef,
785
- schemas,
786
- openApiVersion
787
- }) {
823
+ function parseNumber({ zodRef, schemas, openApiVersion }) {
788
824
  const baseSchema = {
789
- type: typeFormat("number", openApiVersion)
825
+ type: typeFormat('number', openApiVersion)
790
826
  };
791
827
  const { checks = [] } = zodRef._def;
792
828
  checks.forEach((item) => {
793
829
  switch (item.kind) {
794
- case "max":
795
- if (item.inclusive || openApiVersion === "3.0") {
830
+ case 'max':
831
+ if (item.inclusive || openApiVersion === '3.0') {
796
832
  baseSchema.maximum = item.value;
797
833
  }
798
834
  if (!item.inclusive) {
799
- if (openApiVersion === "3.0") {
835
+ if (openApiVersion === '3.0') {
800
836
  baseSchema.exclusiveMaximum = true;
801
837
  } else {
802
838
  baseSchema.exclusiveMaximum = item.value;
803
839
  }
804
840
  }
805
841
  break;
806
- case "min":
807
- if (item.inclusive || openApiVersion === "3.0") {
842
+ case 'min':
843
+ if (item.inclusive || openApiVersion === '3.0') {
808
844
  baseSchema.minimum = item.value;
809
845
  }
810
846
  if (!item.inclusive) {
811
- if (openApiVersion === "3.0") {
847
+ if (openApiVersion === '3.0') {
812
848
  baseSchema.exclusiveMinimum = true;
813
849
  } else {
814
850
  baseSchema.exclusiveMinimum = item.value;
815
851
  }
816
852
  }
817
853
  break;
818
- case "int":
819
- baseSchema.type = typeFormat("integer", openApiVersion);
854
+ case 'int':
855
+ baseSchema.type = typeFormat('integer', openApiVersion);
820
856
  break;
821
- case "multipleOf":
857
+ case 'multipleOf':
822
858
  baseSchema.multipleOf = item.value;
823
859
  break;
824
860
  }
@@ -846,26 +882,37 @@ function parseObject({
846
882
  openApiVersion
847
883
  }) {
848
884
  let additionalProperties;
849
- if (!(zodRef._def.catchall instanceof z.ZodNever || zodRef._def.catchall?._def.typeName === "ZodNever"))
885
+ if (
886
+ !(
887
+ zodRef._def.catchall instanceof z.ZodNever ||
888
+ zodRef._def.catchall?._def.typeName === 'ZodNever'
889
+ )
890
+ )
850
891
  additionalProperties = generateSchema(
851
892
  zodRef._def.catchall,
852
893
  useOutput,
853
894
  openApiVersion
854
895
  );
855
- else if (zodRef._def.unknownKeys === "passthrough")
896
+ else if (zodRef._def.unknownKeys === 'passthrough')
856
897
  additionalProperties = true;
857
- else if (zodRef._def.unknownKeys === "strict") additionalProperties = false;
858
- additionalProperties = additionalProperties != null ? { additionalProperties } : {};
859
- const requiredProperties = Object.keys(
860
- zodRef.shape
861
- ).filter((key) => {
898
+ else if (zodRef._def.unknownKeys === 'strict') additionalProperties = false;
899
+ additionalProperties =
900
+ additionalProperties != null ? { additionalProperties } : {};
901
+ const requiredProperties = Object.keys(zodRef.shape).filter((key) => {
862
902
  const item = zodRef.shape[key];
863
- return !(item.isOptional() || item instanceof z.ZodDefault || item._def.typeName === "ZodDefault") && !(item instanceof z.ZodNever || item._def.typeName === "ZodDefault");
903
+ return (
904
+ !(
905
+ item.isOptional() ||
906
+ item instanceof z.ZodDefault ||
907
+ item._def.typeName === 'ZodDefault'
908
+ ) && !(item instanceof z.ZodNever || item._def.typeName === 'ZodDefault')
909
+ );
864
910
  });
865
- const required = requiredProperties.length > 0 ? { required: requiredProperties } : {};
911
+ const required =
912
+ requiredProperties.length > 0 ? { required: requiredProperties } : {};
866
913
  return merge(
867
914
  {
868
- type: typeFormat("object", openApiVersion),
915
+ type: typeFormat('object', openApiVersion),
869
916
  properties: iterateZodObject({
870
917
  zodRef,
871
918
  schemas,
@@ -877,110 +924,83 @@ function parseObject({
877
924
  ...additionalProperties,
878
925
  ...hideDefinitions
879
926
  },
880
- zodRef.description ? { description: zodRef.description, hideDefinitions } : {},
927
+ zodRef.description
928
+ ? { description: zodRef.description, hideDefinitions }
929
+ : {},
881
930
  ...schemas
882
931
  );
883
932
  }
884
- function parseRecord({
885
- zodRef,
886
- schemas,
887
- useOutput,
888
- openApiVersion
889
- }) {
933
+ function parseRecord({ zodRef, schemas, useOutput, openApiVersion }) {
890
934
  return merge(
891
935
  {
892
- type: typeFormat("object", openApiVersion),
893
- additionalProperties: zodRef._def.valueType instanceof z.ZodUnknown ? {} : generateSchema(zodRef._def.valueType, useOutput, openApiVersion)
936
+ type: typeFormat('object', openApiVersion),
937
+ additionalProperties:
938
+ zodRef._def.valueType instanceof z.ZodUnknown
939
+ ? {}
940
+ : generateSchema(zodRef._def.valueType, useOutput, openApiVersion)
894
941
  },
895
942
  zodRef.description ? { description: zodRef.description } : {},
896
943
  ...schemas
897
944
  );
898
945
  }
899
- function parseBigInt({
900
- zodRef,
901
- schemas,
902
- openApiVersion
903
- }) {
946
+ function parseBigInt({ zodRef, schemas, openApiVersion }) {
904
947
  return merge(
905
948
  {
906
- type: typeFormat("integer", openApiVersion),
907
- format: "int64"
949
+ type: typeFormat('integer', openApiVersion),
950
+ format: 'int64'
908
951
  },
909
952
  zodRef.description ? { description: zodRef.description } : {},
910
953
  ...schemas
911
954
  );
912
955
  }
913
- function parseBoolean({
914
- zodRef,
915
- schemas,
916
- openApiVersion
917
- }) {
956
+ function parseBoolean({ zodRef, schemas, openApiVersion }) {
918
957
  return merge(
919
- { type: typeFormat("boolean", openApiVersion) },
958
+ { type: typeFormat('boolean', openApiVersion) },
920
959
  zodRef.description ? { description: zodRef.description } : {},
921
960
  ...schemas
922
961
  );
923
962
  }
924
- function parseDate({
925
- zodRef,
926
- schemas,
927
- openApiVersion
928
- }) {
963
+ function parseDate({ zodRef, schemas, openApiVersion }) {
929
964
  return merge(
930
965
  {
931
- type: typeFormat("string", openApiVersion),
932
- format: "date-time"
966
+ type: typeFormat('string', openApiVersion),
967
+ format: 'date-time'
933
968
  },
934
969
  zodRef.description ? { description: zodRef.description } : {},
935
970
  ...schemas
936
971
  );
937
972
  }
938
- function parseNull({
939
- zodRef,
940
- schemas,
941
- openApiVersion
942
- }) {
973
+ function parseNull({ zodRef, schemas, openApiVersion }) {
943
974
  return merge(
944
- openApiVersion === "3.0" ? { type: "null" } : {
945
- type: ["string", "null"],
946
- enum: ["null"]
947
- },
975
+ openApiVersion === '3.0'
976
+ ? { type: 'null' }
977
+ : {
978
+ type: ['string', 'null'],
979
+ enum: ['null']
980
+ },
948
981
  zodRef.description ? { description: zodRef.description } : {},
949
982
  ...schemas
950
983
  );
951
984
  }
952
- function parseOptional({
953
- schemas,
954
- zodRef,
955
- useOutput,
956
- openApiVersion
957
- }) {
985
+ function parseOptional({ schemas, zodRef, useOutput, openApiVersion }) {
958
986
  return merge(
959
987
  generateSchema(zodRef.unwrap(), useOutput, openApiVersion),
960
988
  zodRef.description ? { description: zodRef.description } : {},
961
989
  ...schemas
962
990
  );
963
991
  }
964
- function parseNullable({
965
- schemas,
966
- zodRef,
967
- useOutput,
968
- openApiVersion
969
- }) {
992
+ function parseNullable({ schemas, zodRef, useOutput, openApiVersion }) {
970
993
  const schema = generateSchema(zodRef.unwrap(), useOutput, openApiVersion);
971
994
  return merge(
972
995
  schema,
973
- openApiVersion === "3.0" ? { nullable: true } : { type: typeFormat("null", openApiVersion) },
996
+ openApiVersion === '3.0'
997
+ ? { nullable: true }
998
+ : { type: typeFormat('null', openApiVersion) },
974
999
  zodRef.description ? { description: zodRef.description } : {},
975
1000
  ...schemas
976
1001
  );
977
1002
  }
978
- function parseDefault({
979
- schemas,
980
- zodRef,
981
- useOutput,
982
- openApiVersion
983
- }) {
1003
+ function parseDefault({ schemas, zodRef, useOutput, openApiVersion }) {
984
1004
  return merge(
985
1005
  {
986
1006
  default: zodRef._def.defaultValue(),
@@ -990,12 +1010,7 @@ function parseDefault({
990
1010
  ...schemas
991
1011
  );
992
1012
  }
993
- function parseArray({
994
- schemas,
995
- zodRef,
996
- useOutput,
997
- openApiVersion
998
- }) {
1013
+ function parseArray({ schemas, zodRef, useOutput, openApiVersion }) {
999
1014
  const constraints = {};
1000
1015
  if (zodRef._def.exactLength != null) {
1001
1016
  constraints.minItems = zodRef._def.exactLength.value;
@@ -1007,7 +1022,7 @@ function parseArray({
1007
1022
  constraints.maxItems = zodRef._def.maxLength.value;
1008
1023
  return merge(
1009
1024
  {
1010
- type: typeFormat("array", openApiVersion),
1025
+ type: typeFormat('array', openApiVersion),
1011
1026
  items: generateSchema(zodRef.element, useOutput, openApiVersion),
1012
1027
  ...constraints
1013
1028
  },
@@ -1015,11 +1030,7 @@ function parseArray({
1015
1030
  ...schemas
1016
1031
  );
1017
1032
  }
1018
- function parseLiteral({
1019
- schemas,
1020
- zodRef,
1021
- openApiVersion
1022
- }) {
1033
+ function parseLiteral({ schemas, zodRef, openApiVersion }) {
1023
1034
  const type22 = typeof zodRef._def.value;
1024
1035
  return merge(
1025
1036
  {
@@ -1030,11 +1041,7 @@ function parseLiteral({
1030
1041
  ...schemas
1031
1042
  );
1032
1043
  }
1033
- function parseEnum({
1034
- schemas,
1035
- zodRef,
1036
- openApiVersion
1037
- }) {
1044
+ function parseEnum({ schemas, zodRef, openApiVersion }) {
1038
1045
  const type22 = typeof Object.values(zodRef._def.values)[0];
1039
1046
  return merge(
1040
1047
  {
@@ -1045,12 +1052,7 @@ function parseEnum({
1045
1052
  ...schemas
1046
1053
  );
1047
1054
  }
1048
- function parseIntersection({
1049
- schemas,
1050
- zodRef,
1051
- useOutput,
1052
- openApiVersion
1053
- }) {
1055
+ function parseIntersection({ schemas, zodRef, useOutput, openApiVersion }) {
1054
1056
  return merge(
1055
1057
  {
1056
1058
  allOf: [
@@ -1062,20 +1064,20 @@ function parseIntersection({
1062
1064
  ...schemas
1063
1065
  );
1064
1066
  }
1065
- function parseUnion({
1066
- schemas,
1067
- zodRef,
1068
- useOutput,
1069
- openApiVersion
1070
- }) {
1067
+ function parseUnion({ schemas, zodRef, useOutput, openApiVersion }) {
1071
1068
  const contents = zodRef._def.options;
1072
- if (contents.reduce(
1073
- (prev, content) => prev && content._def.typeName === "ZodLiteral",
1074
- true
1075
- )) {
1069
+ if (
1070
+ contents.reduce(
1071
+ (prev, content) => prev && content._def.typeName === 'ZodLiteral',
1072
+ true
1073
+ )
1074
+ ) {
1076
1075
  const literals = contents;
1077
1076
  const type22 = literals.reduce(
1078
- (prev, content) => !prev || prev === typeof content._def.value ? typeof content._def.value : null,
1077
+ (prev, content) =>
1078
+ !prev || prev === typeof content._def.value
1079
+ ? typeof content._def.value
1080
+ : null,
1079
1081
  null
1080
1082
  );
1081
1083
  if (type22) {
@@ -1089,12 +1091,15 @@ function parseUnion({
1089
1091
  );
1090
1092
  }
1091
1093
  }
1092
- const oneOfContents = openApiVersion === "3.0" ? contents.filter((content) => content._def.typeName !== "ZodNull") : contents;
1094
+ const oneOfContents =
1095
+ openApiVersion === '3.0'
1096
+ ? contents.filter((content) => content._def.typeName !== 'ZodNull')
1097
+ : contents;
1093
1098
  const contentsHasNull = contents.length != oneOfContents.length;
1094
1099
  return merge(
1095
1100
  {
1096
- oneOf: oneOfContents.map(
1097
- (schema) => generateSchema(schema, useOutput, openApiVersion)
1101
+ oneOf: oneOfContents.map((schema) =>
1102
+ generateSchema(schema, useOutput, openApiVersion)
1098
1103
  )
1099
1104
  },
1100
1105
  contentsHasNull ? { nullable: true } : {},
@@ -1113,50 +1118,34 @@ function parseDiscriminatedUnion({
1113
1118
  discriminator: {
1114
1119
  propertyName: zodRef._def.discriminator
1115
1120
  },
1116
- oneOf: Array.from(
1117
- zodRef._def.options.values()
1118
- ).map((schema) => generateSchema(schema, useOutput, openApiVersion))
1121
+ oneOf: Array.from(zodRef._def.options.values()).map((schema) =>
1122
+ generateSchema(schema, useOutput, openApiVersion)
1123
+ )
1119
1124
  },
1120
1125
  zodRef.description ? { description: zodRef.description } : {},
1121
1126
  ...schemas
1122
1127
  );
1123
1128
  }
1124
- function parseNever({
1125
- zodRef,
1126
- schemas
1127
- }) {
1129
+ function parseNever({ zodRef, schemas }) {
1128
1130
  return merge(
1129
1131
  { readOnly: true },
1130
1132
  zodRef.description ? { description: zodRef.description } : {},
1131
1133
  ...schemas
1132
1134
  );
1133
1135
  }
1134
- function parseBranded({
1135
- schemas,
1136
- zodRef,
1137
- useOutput,
1138
- openApiVersion
1139
- }) {
1136
+ function parseBranded({ schemas, zodRef, useOutput, openApiVersion }) {
1140
1137
  return merge(
1141
1138
  generateSchema(zodRef._def.type, useOutput, openApiVersion),
1142
1139
  ...schemas
1143
1140
  );
1144
1141
  }
1145
- function catchAllParser({
1146
- zodRef,
1147
- schemas
1148
- }) {
1142
+ function catchAllParser({ zodRef, schemas }) {
1149
1143
  return merge(
1150
1144
  zodRef.description ? { description: zodRef.description } : {},
1151
1145
  ...schemas
1152
1146
  );
1153
1147
  }
1154
- function parsePipeline({
1155
- schemas,
1156
- zodRef,
1157
- useOutput,
1158
- openApiVersion
1159
- }) {
1148
+ function parsePipeline({ schemas, zodRef, useOutput, openApiVersion }) {
1160
1149
  return merge(
1161
1150
  generateSchema(
1162
1151
  useOutput ? zodRef._def.out : zodRef._def.in,
@@ -1166,12 +1155,7 @@ function parsePipeline({
1166
1155
  ...schemas
1167
1156
  );
1168
1157
  }
1169
- function parseReadonly({
1170
- zodRef,
1171
- useOutput,
1172
- schemas,
1173
- openApiVersion
1174
- }) {
1158
+ function parseReadonly({ zodRef, useOutput, schemas, openApiVersion }) {
1175
1159
  return merge(
1176
1160
  generateSchema(zodRef._def.innerType, useOutput, openApiVersion),
1177
1161
  zodRef.description ? { description: zodRef.description } : {},
@@ -1215,10 +1199,10 @@ var workerMap = {
1215
1199
  ZodPipeline: parsePipeline,
1216
1200
  ZodReadonly: parseReadonly
1217
1201
  };
1218
- function generateSchema(zodRef, useOutput = false, openApiVersion = "3.1") {
1202
+ function generateSchema(zodRef, useOutput = false, openApiVersion = '3.1') {
1219
1203
  const { metaOpenApi = {} } = zodRef;
1220
1204
  const schemas = [
1221
- ...Array.isArray(metaOpenApi) ? metaOpenApi : [metaOpenApi]
1205
+ ...(Array.isArray(metaOpenApi) ? metaOpenApi : [metaOpenApi])
1222
1206
  ];
1223
1207
  try {
1224
1208
  const typeName = zodRef._def.typeName;
@@ -1237,155 +1221,173 @@ function generateSchema(zodRef, useOutput = false, openApiVersion = "3.1") {
1237
1221
  }
1238
1222
  }
1239
1223
  function extendZodWithOpenApi(zod, forceOverride = false) {
1240
- if (!forceOverride && typeof zod.ZodSchema.prototype.openapi !== "undefined") {
1224
+ if (
1225
+ !forceOverride &&
1226
+ typeof zod.ZodSchema.prototype.openapi !== 'undefined'
1227
+ ) {
1241
1228
  return;
1242
1229
  }
1243
- zod.ZodSchema.prototype.openapi = function(metadata) {
1230
+ zod.ZodSchema.prototype.openapi = function (metadata) {
1244
1231
  return extendApi(this, metadata);
1245
1232
  };
1246
1233
  }
1247
1234
  extendZodWithOpenApi(z2);
1248
1235
  var ZodSchemaValidator = class {
1249
- _Type = "Zod";
1236
+ _Type = 'Zod';
1250
1237
  _SchemaCatchall;
1251
1238
  _ValidSchemaObject;
1252
1239
  string = z2.string().openapi({
1253
- title: "String",
1254
- example: "a string"
1240
+ title: 'String',
1241
+ example: 'a string'
1255
1242
  });
1256
1243
  uuid = z2.string().uuid().openapi({
1257
- title: "UUID",
1258
- format: "uuid",
1259
- 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}$",
1260
- example: "a8b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6"
1244
+ title: 'UUID',
1245
+ format: 'uuid',
1246
+ pattern:
1247
+ '^[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}$',
1248
+ example: 'a8b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6'
1261
1249
  });
1262
1250
  email = z2.string().email().openapi({
1263
- title: "Email",
1264
- format: "email",
1265
- pattern: "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
1266
- example: "a@b.com"
1251
+ title: 'Email',
1252
+ format: 'email',
1253
+ pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$',
1254
+ example: 'a@b.com'
1267
1255
  });
1268
1256
  uri = z2.string().url().openapi({
1269
- title: "URI",
1270
- format: "uri",
1271
- pattern: "^[a-zA-Z][a-zA-Z\\d+-.]*:[^\\s]*$",
1272
- example: "https://forklaunch.com"
1257
+ title: 'URI',
1258
+ format: 'uri',
1259
+ pattern: '^[a-zA-Z][a-zA-Z\\d+-.]*:[^\\s]*$',
1260
+ example: 'https://forklaunch.com'
1273
1261
  });
1274
- number = z2.preprocess((value) => {
1275
- try {
1276
- return Number(value);
1277
- } catch {
1278
- return value;
1279
- }
1280
- }, z2.number()).openapi({
1281
- title: "Number",
1282
- example: 123
1283
- });
1284
- bigint = z2.preprocess((value) => {
1285
- try {
1286
- if (value instanceof Date) {
1287
- return BigInt(value.getTime());
1262
+ number = z2
1263
+ .preprocess((value) => {
1264
+ try {
1265
+ return Number(value);
1266
+ } catch {
1267
+ return value;
1288
1268
  }
1289
- switch (typeof value) {
1290
- case "number":
1291
- case "string":
1292
- return BigInt(value);
1293
- case "boolean":
1294
- return BigInt(value ? 1 : 0);
1295
- default:
1296
- return value;
1269
+ }, z2.number())
1270
+ .openapi({
1271
+ title: 'Number',
1272
+ example: 123
1273
+ });
1274
+ bigint = z2
1275
+ .preprocess((value) => {
1276
+ try {
1277
+ if (value instanceof Date) {
1278
+ return BigInt(value.getTime());
1279
+ }
1280
+ switch (typeof value) {
1281
+ case 'number':
1282
+ case 'string':
1283
+ return BigInt(value);
1284
+ case 'boolean':
1285
+ return BigInt(value ? 1 : 0);
1286
+ default:
1287
+ return value;
1288
+ }
1289
+ } catch {
1290
+ return value;
1297
1291
  }
1298
- } catch {
1299
- return value;
1300
- }
1301
- }, z2.bigint()).openapi({
1302
- title: "BigInt",
1303
- type: "integer",
1304
- format: "int64",
1305
- example: 123n
1306
- });
1307
- boolean = z2.preprocess((val) => {
1308
- if (typeof val === "string") {
1309
- if (val.toLowerCase() === "true") return true;
1310
- if (val.toLowerCase() === "false") return false;
1311
- }
1312
- return val;
1313
- }, z2.boolean()).openapi({
1314
- title: "Boolean",
1315
- example: true
1316
- });
1317
- date = z2.preprocess((value) => {
1318
- try {
1319
- switch (typeof value) {
1320
- case "string":
1321
- return new Date(value);
1322
- case "number":
1323
- return new Date(value);
1324
- default:
1325
- return value;
1292
+ }, z2.bigint())
1293
+ .openapi({
1294
+ title: 'BigInt',
1295
+ type: 'integer',
1296
+ format: 'int64',
1297
+ example: 123n
1298
+ });
1299
+ boolean = z2
1300
+ .preprocess((val) => {
1301
+ if (typeof val === 'string') {
1302
+ if (val.toLowerCase() === 'true') return true;
1303
+ if (val.toLowerCase() === 'false') return false;
1326
1304
  }
1327
- } catch {
1328
- return value;
1329
- }
1330
- }, z2.date()).openapi({
1331
- title: "Date",
1332
- type: "string",
1333
- format: "date-time",
1334
- example: "2025-05-16T21:13:04.123Z"
1335
- });
1305
+ return val;
1306
+ }, z2.boolean())
1307
+ .openapi({
1308
+ title: 'Boolean',
1309
+ example: true
1310
+ });
1311
+ date = z2
1312
+ .preprocess((value) => {
1313
+ try {
1314
+ switch (typeof value) {
1315
+ case 'string':
1316
+ return new Date(value);
1317
+ case 'number':
1318
+ return new Date(value);
1319
+ default:
1320
+ return value;
1321
+ }
1322
+ } catch {
1323
+ return value;
1324
+ }
1325
+ }, z2.date())
1326
+ .openapi({
1327
+ title: 'Date',
1328
+ type: 'string',
1329
+ format: 'date-time',
1330
+ example: '2025-05-16T21:13:04.123Z'
1331
+ });
1336
1332
  symbol = z2.symbol().openapi({
1337
- title: "Symbol",
1338
- example: Symbol("symbol")
1333
+ title: 'Symbol',
1334
+ example: Symbol('symbol')
1339
1335
  });
1340
1336
  nullish = z2.union([z2.void(), z2.null(), z2.undefined()]).openapi({
1341
- title: "Nullish",
1342
- type: "null",
1337
+ title: 'Nullish',
1338
+ type: 'null',
1343
1339
  example: null
1344
1340
  });
1345
1341
  void = z2.void().openapi({
1346
- title: "Void",
1347
- type: "null",
1342
+ title: 'Void',
1343
+ type: 'null',
1348
1344
  example: void 0
1349
1345
  });
1350
1346
  null = z2.null().openapi({
1351
- title: "Null",
1352
- type: "null",
1347
+ title: 'Null',
1348
+ type: 'null',
1353
1349
  example: null
1354
1350
  });
1355
1351
  undefined = z2.undefined().openapi({
1356
- title: "Undefined",
1357
- type: "null",
1352
+ title: 'Undefined',
1353
+ type: 'null',
1358
1354
  example: void 0
1359
1355
  });
1360
1356
  any = z2.any().openapi({
1361
- title: "Any",
1362
- type: "object",
1363
- example: "any"
1357
+ title: 'Any',
1358
+ type: 'object',
1359
+ example: 'any'
1364
1360
  });
1365
1361
  unknown = z2.unknown().openapi({
1366
- title: "Unknown",
1367
- type: "object",
1368
- example: "unknown"
1362
+ title: 'Unknown',
1363
+ type: 'object',
1364
+ example: 'unknown'
1369
1365
  });
1370
1366
  never = z2.never().openapi({
1371
- title: "Never",
1372
- type: "null",
1373
- example: "never"
1374
- });
1375
- binary = z2.string().transform((val) => new Uint8Array(Buffer.from(val, "base64"))).openapi({
1376
- title: "Binary",
1377
- type: "string",
1378
- format: "binary",
1379
- example: "a base-64 encodable string"
1380
- });
1381
- file = z2.instanceof(Buffer).transform((val) => {
1382
- return new Blob([val]);
1383
- }).openapi({
1384
- title: "File",
1385
- type: "string",
1386
- format: "binary",
1387
- example: "a base-64 encodable blob or file"
1367
+ title: 'Never',
1368
+ type: 'null',
1369
+ example: 'never'
1388
1370
  });
1371
+ binary = z2
1372
+ .string()
1373
+ .transform((val) => new Uint8Array(Buffer.from(val, 'base64')))
1374
+ .openapi({
1375
+ title: 'Binary',
1376
+ type: 'string',
1377
+ format: 'binary',
1378
+ example: 'a base-64 encodable string'
1379
+ });
1380
+ file = z2
1381
+ .instanceof(Buffer)
1382
+ .transform((val) => {
1383
+ return new Blob([val]);
1384
+ })
1385
+ .openapi({
1386
+ title: 'File',
1387
+ type: 'string',
1388
+ format: 'binary',
1389
+ example: 'a base-64 encodable blob or file'
1390
+ });
1389
1391
  type = () => this.any;
1390
1392
  /**
1391
1393
  * Compiles schema if this exists, for optimal performance.
@@ -1402,7 +1404,11 @@ var ZodSchemaValidator = class {
1402
1404
  * @returns {ZodResolve<T>} The resolved schema.
1403
1405
  */
1404
1406
  schemify(schema) {
1405
- if (typeof schema === "string" || typeof schema === "number" || typeof schema === "boolean") {
1407
+ if (
1408
+ typeof schema === 'string' ||
1409
+ typeof schema === 'number' ||
1410
+ typeof schema === 'boolean'
1411
+ ) {
1406
1412
  return z2.literal(schema);
1407
1413
  }
1408
1414
  if (schema instanceof ZodType) {
@@ -1443,9 +1449,7 @@ var ZodSchemaValidator = class {
1443
1449
  */
1444
1450
  union(schemas) {
1445
1451
  const resolvedSchemas = schemas.map((schema) => this.schemify(schema));
1446
- return z2.union(
1447
- resolvedSchemas
1448
- );
1452
+ return z2.union(resolvedSchemas);
1449
1453
  }
1450
1454
  /**
1451
1455
  * Create a literal schema.
@@ -1461,9 +1465,7 @@ var ZodSchemaValidator = class {
1461
1465
  * @returns {ZodUnion<UnionZodResolve<[T, T, ...T[]]>>} The enum schema.
1462
1466
  */
1463
1467
  enum_(schemaEnum) {
1464
- return this.union(
1465
- Object.values(schemaEnum)
1466
- );
1468
+ return this.union(Object.values(schemaEnum));
1467
1469
  }
1468
1470
  /**
1469
1471
  * Create a function schema.
@@ -1532,31 +1534,33 @@ var ZodSchemaValidator = class {
1532
1534
  parse(schema, value) {
1533
1535
  const resolvedSchema = this.schemify(schema);
1534
1536
  const result = resolvedSchema.safeParse(value);
1535
- return result.success ? { ok: true, value: result.data } : {
1536
- ok: false,
1537
- errors: result.error.errors.flatMap((error) => {
1538
- switch (error.code) {
1539
- case "invalid_union":
1540
- return error.unionErrors.flatMap(
1541
- (unionError, idx) => unionError.errors.map((e) => ({
1542
- path: [
1543
- `Union Schema Variant ${idx}`,
1544
- ...error.path.map((p) => p.toString()),
1545
- ...e.path.map((p) => p.toString())
1546
- ],
1547
- message: e.message
1548
- }))
1549
- );
1550
- default:
1551
- return [
1552
- {
1553
- path: error.path.map((p) => p.toString()),
1554
- message: error.message
1555
- }
1556
- ];
1557
- }
1558
- })
1559
- };
1537
+ return result.success
1538
+ ? { ok: true, value: result.data }
1539
+ : {
1540
+ ok: false,
1541
+ errors: result.error.errors.flatMap((error) => {
1542
+ switch (error.code) {
1543
+ case 'invalid_union':
1544
+ return error.unionErrors.flatMap((unionError, idx) =>
1545
+ unionError.errors.map((e) => ({
1546
+ path: [
1547
+ `Union Schema Variant ${idx}`,
1548
+ ...error.path.map((p) => p.toString()),
1549
+ ...e.path.map((p) => p.toString())
1550
+ ],
1551
+ message: e.message
1552
+ }))
1553
+ );
1554
+ default:
1555
+ return [
1556
+ {
1557
+ path: error.path.map((p) => p.toString()),
1558
+ message: error.message
1559
+ }
1560
+ ];
1561
+ }
1562
+ })
1563
+ };
1560
1564
  }
1561
1565
  /**
1562
1566
  * Convert a schema to an OpenAPI schema object.
@@ -1614,6 +1618,4 @@ var RedisWorkerSchemas = serviceSchemaResolver(
1614
1618
  () => RedisWorkerOptionsSchema,
1615
1619
  () => RedisWorkerOptionsSchema2
1616
1620
  );
1617
- export {
1618
- RedisWorkerSchemas
1619
- };
1621
+ export { RedisWorkerSchemas };