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