@forklaunch/implementation-worker-database 0.3.8 → 0.4.0

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.
@@ -1,18 +1,7 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
- }) : x)(function(x) {
10
- if (typeof require !== "undefined") return require.apply(this, arguments);
11
- throw Error('Dynamic require of "' + x + '" is not supported');
12
- });
13
- var __commonJS = (cb, mod) => function __require2() {
14
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
- };
16
5
  var __export = (target, all) => {
17
6
  for (var name in all)
18
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -26,443 +15,11 @@ var __copyProps = (to, from, except, desc) => {
26
15
  return to;
27
16
  };
28
17
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
-
38
- // ../../../node_modules/.pnpm/ts-deepmerge@6.2.1/node_modules/ts-deepmerge/cjs/index.js
39
- var require_cjs = __commonJS({
40
- "../../../node_modules/.pnpm/ts-deepmerge@6.2.1/node_modules/ts-deepmerge/cjs/index.js"(exports) {
41
- "use strict";
42
- Object.defineProperty(exports, "__esModule", { value: true });
43
- var isObject = (obj) => {
44
- if (typeof obj === "object" && obj !== null) {
45
- if (typeof Object.getPrototypeOf === "function") {
46
- const prototype = Object.getPrototypeOf(obj);
47
- return prototype === Object.prototype || prototype === null;
48
- }
49
- return Object.prototype.toString.call(obj) === "[object Object]";
50
- }
51
- return false;
52
- };
53
- var merge = (...objects) => objects.reduce((result, current) => {
54
- if (Array.isArray(current)) {
55
- throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
56
- }
57
- Object.keys(current).forEach((key) => {
58
- if (["__proto__", "constructor", "prototype"].includes(key)) {
59
- return;
60
- }
61
- if (Array.isArray(result[key]) && Array.isArray(current[key])) {
62
- result[key] = merge.options.mergeArrays ? merge.options.uniqueArrayItems ? Array.from(new Set(result[key].concat(current[key]))) : [...result[key], ...current[key]] : current[key];
63
- } else if (isObject(result[key]) && isObject(current[key])) {
64
- result[key] = merge(result[key], current[key]);
65
- } else {
66
- result[key] = current[key] === void 0 ? merge.options.allowUndefinedOverrides ? current[key] : result[key] : current[key];
67
- }
68
- });
69
- return result;
70
- }, {});
71
- var defaultOptions = {
72
- allowUndefinedOverrides: true,
73
- mergeArrays: true,
74
- uniqueArrayItems: true
75
- };
76
- merge.options = defaultOptions;
77
- merge.withOptions = (options, ...objects) => {
78
- merge.options = Object.assign(Object.assign({}, defaultOptions), options);
79
- const result = merge(...objects);
80
- merge.options = defaultOptions;
81
- return result;
82
- };
83
- exports.default = merge;
84
- }
85
- });
86
-
87
- // ../../../node_modules/.pnpm/@anatine+zod-openapi@2.2.8_openapi3-ts@4.5.0_zod@3.25.76/node_modules/@anatine/zod-openapi/src/lib/zod-openapi.js
88
- var require_zod_openapi = __commonJS({
89
- "../../../node_modules/.pnpm/@anatine+zod-openapi@2.2.8_openapi3-ts@4.5.0_zod@3.25.76/node_modules/@anatine/zod-openapi/src/lib/zod-openapi.js"(exports) {
90
- "use strict";
91
- Object.defineProperty(exports, "__esModule", { value: true });
92
- exports.generateSchema = exports.extendApi = void 0;
93
- var ts_deepmerge_1 = require_cjs();
94
- var zod_1 = __require("zod");
95
- function extendApi(schema, schemaObject = {}) {
96
- const This = schema.constructor;
97
- const newSchema = new This(schema._def);
98
- newSchema.metaOpenApi = Object.assign({}, schema.metaOpenApi || {}, schemaObject);
99
- return newSchema;
100
- }
101
- exports.extendApi = extendApi;
102
- function iterateZodObject({ zodRef, useOutput, hideDefinitions, openApiVersion }) {
103
- const reduced = Object.keys(zodRef.shape).filter((key) => (hideDefinitions === null || hideDefinitions === void 0 ? void 0 : hideDefinitions.includes(key)) === false).reduce((carry, key) => Object.assign(Object.assign({}, carry), { [key]: generateSchema2(zodRef.shape[key], useOutput, openApiVersion) }), {});
104
- return reduced;
105
- }
106
- function typeFormat(type3, openApiVersion) {
107
- return openApiVersion === "3.0" ? type3 : [type3];
108
- }
109
- function parseTransformation({ zodRef, schemas, useOutput, openApiVersion }) {
110
- const input = generateSchema2(zodRef._def.schema, useOutput, openApiVersion);
111
- let output = "undefined";
112
- if (useOutput && zodRef._def.effect) {
113
- const effect = zodRef._def.effect.type === "transform" ? zodRef._def.effect : null;
114
- if (effect && "transform" in effect) {
115
- try {
116
- const type3 = Array.isArray(input.type) ? input.type[0] : input.type;
117
- output = typeof effect.transform(
118
- ["integer", "number"].includes(`${type3}`) ? 0 : "string" === type3 ? "" : "boolean" === type3 ? false : "object" === type3 ? {} : "null" === type3 ? null : "array" === type3 ? [] : void 0,
119
- { addIssue: () => void 0, path: [] }
120
- // TODO: Discover if context is necessary here
121
- );
122
- } catch (e) {
123
- }
124
- }
125
- }
126
- const outputType = output;
127
- return (0, ts_deepmerge_1.default)(Object.assign(Object.assign(Object.assign({}, zodRef.description ? { description: zodRef.description } : {}), input), ["number", "string", "boolean", "null"].includes(output) ? {
128
- type: typeFormat(outputType, openApiVersion)
129
- } : {}), ...schemas);
130
- }
131
- function parseString({ zodRef, schemas, openApiVersion }) {
132
- const baseSchema = {
133
- type: typeFormat("string", openApiVersion)
134
- };
135
- const { checks = [] } = zodRef._def;
136
- checks.forEach((item) => {
137
- switch (item.kind) {
138
- case "email":
139
- baseSchema.format = "email";
140
- break;
141
- case "uuid":
142
- baseSchema.format = "uuid";
143
- break;
144
- case "cuid":
145
- baseSchema.format = "cuid";
146
- break;
147
- case "url":
148
- baseSchema.format = "uri";
149
- break;
150
- case "datetime":
151
- baseSchema.format = "date-time";
152
- break;
153
- case "length":
154
- baseSchema.minLength = item.value;
155
- baseSchema.maxLength = item.value;
156
- break;
157
- case "max":
158
- baseSchema.maxLength = item.value;
159
- break;
160
- case "min":
161
- baseSchema.minLength = item.value;
162
- break;
163
- case "regex":
164
- baseSchema.pattern = item.regex.source;
165
- break;
166
- }
167
- });
168
- return (0, ts_deepmerge_1.default)(baseSchema, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
169
- }
170
- function parseNumber({ zodRef, schemas, openApiVersion }) {
171
- const baseSchema = {
172
- type: typeFormat("number", openApiVersion)
173
- };
174
- const { checks = [] } = zodRef._def;
175
- checks.forEach((item) => {
176
- switch (item.kind) {
177
- case "max":
178
- if (item.inclusive || openApiVersion === "3.0") {
179
- baseSchema.maximum = item.value;
180
- }
181
- if (!item.inclusive) {
182
- if (openApiVersion === "3.0") {
183
- baseSchema.exclusiveMaximum = true;
184
- } else {
185
- baseSchema.exclusiveMaximum = item.value;
186
- }
187
- }
188
- break;
189
- case "min":
190
- if (item.inclusive || openApiVersion === "3.0") {
191
- baseSchema.minimum = item.value;
192
- }
193
- if (!item.inclusive) {
194
- if (openApiVersion === "3.0") {
195
- baseSchema.exclusiveMinimum = true;
196
- } else {
197
- baseSchema.exclusiveMinimum = item.value;
198
- }
199
- }
200
- break;
201
- case "int":
202
- baseSchema.type = typeFormat("integer", openApiVersion);
203
- break;
204
- case "multipleOf":
205
- baseSchema.multipleOf = item.value;
206
- break;
207
- }
208
- });
209
- return (0, ts_deepmerge_1.default)(baseSchema, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
210
- }
211
- function getExcludedDefinitionsFromSchema(schemas) {
212
- const excludedDefinitions = [];
213
- for (const schema of schemas) {
214
- if (Array.isArray(schema.hideDefinitions)) {
215
- excludedDefinitions.push(...schema.hideDefinitions);
216
- }
217
- }
218
- return excludedDefinitions;
219
- }
220
- function parseObject({ zodRef, schemas, useOutput, hideDefinitions, openApiVersion }) {
221
- var _a;
222
- let additionalProperties;
223
- if (!(zodRef._def.catchall instanceof zod_1.z.ZodNever || ((_a = zodRef._def.catchall) === null || _a === void 0 ? void 0 : _a._def.typeName) === "ZodNever"))
224
- additionalProperties = generateSchema2(zodRef._def.catchall, useOutput, openApiVersion);
225
- else if (zodRef._def.unknownKeys === "passthrough")
226
- additionalProperties = true;
227
- else if (zodRef._def.unknownKeys === "strict")
228
- additionalProperties = false;
229
- additionalProperties = additionalProperties != null ? { additionalProperties } : {};
230
- const requiredProperties = Object.keys(zodRef.shape).filter((key) => {
231
- const item = zodRef.shape[key];
232
- return !(item.isOptional() || item instanceof zod_1.z.ZodDefault || item._def.typeName === "ZodDefault") && !(item instanceof zod_1.z.ZodNever || item._def.typeName === "ZodDefault");
233
- });
234
- const required = requiredProperties.length > 0 ? { required: requiredProperties } : {};
235
- return (0, ts_deepmerge_1.default)(Object.assign(Object.assign(Object.assign({ type: typeFormat("object", openApiVersion), properties: iterateZodObject({
236
- zodRef,
237
- schemas,
238
- useOutput,
239
- hideDefinitions: getExcludedDefinitionsFromSchema(schemas),
240
- openApiVersion
241
- }) }, required), additionalProperties), hideDefinitions), zodRef.description ? { description: zodRef.description, hideDefinitions } : {}, ...schemas);
242
- }
243
- function parseRecord({ zodRef, schemas, useOutput, openApiVersion }) {
244
- return (0, ts_deepmerge_1.default)({
245
- type: typeFormat("object", openApiVersion),
246
- additionalProperties: zodRef._def.valueType instanceof zod_1.z.ZodUnknown ? {} : generateSchema2(zodRef._def.valueType, useOutput, openApiVersion)
247
- }, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
248
- }
249
- function parseBigInt({ zodRef, schemas, openApiVersion }) {
250
- return (0, ts_deepmerge_1.default)({
251
- type: typeFormat("integer", openApiVersion),
252
- format: "int64"
253
- }, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
254
- }
255
- function parseBoolean({ zodRef, schemas, openApiVersion }) {
256
- return (0, ts_deepmerge_1.default)({ type: typeFormat("boolean", openApiVersion) }, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
257
- }
258
- function parseDate({ zodRef, schemas, openApiVersion }) {
259
- return (0, ts_deepmerge_1.default)({
260
- type: typeFormat("string", openApiVersion),
261
- format: "date-time"
262
- }, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
263
- }
264
- function parseNull({ zodRef, schemas, openApiVersion }) {
265
- return (0, ts_deepmerge_1.default)(openApiVersion === "3.0" ? { type: "null" } : {
266
- type: ["string", "null"],
267
- enum: ["null"]
268
- }, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
269
- }
270
- function parseOptional({ schemas, zodRef, useOutput, openApiVersion }) {
271
- return (0, ts_deepmerge_1.default)(generateSchema2(zodRef.unwrap(), useOutput, openApiVersion), zodRef.description ? { description: zodRef.description } : {}, ...schemas);
272
- }
273
- function parseNullable({ schemas, zodRef, useOutput, openApiVersion }) {
274
- const schema = generateSchema2(zodRef.unwrap(), useOutput, openApiVersion);
275
- return (0, ts_deepmerge_1.default)(schema, openApiVersion === "3.0" ? { nullable: true } : { type: typeFormat("null", openApiVersion) }, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
276
- }
277
- function parseDefault({ schemas, zodRef, useOutput, openApiVersion }) {
278
- return (0, ts_deepmerge_1.default)(Object.assign({ default: zodRef._def.defaultValue() }, generateSchema2(zodRef._def.innerType, useOutput, openApiVersion)), zodRef.description ? { description: zodRef.description } : {}, ...schemas);
279
- }
280
- function parseArray({ schemas, zodRef, useOutput, openApiVersion }) {
281
- const constraints = {};
282
- if (zodRef._def.exactLength != null) {
283
- constraints.minItems = zodRef._def.exactLength.value;
284
- constraints.maxItems = zodRef._def.exactLength.value;
285
- }
286
- if (zodRef._def.minLength != null)
287
- constraints.minItems = zodRef._def.minLength.value;
288
- if (zodRef._def.maxLength != null)
289
- constraints.maxItems = zodRef._def.maxLength.value;
290
- return (0, ts_deepmerge_1.default)(Object.assign({ type: typeFormat("array", openApiVersion), items: generateSchema2(zodRef.element, useOutput, openApiVersion) }, constraints), zodRef.description ? { description: zodRef.description } : {}, ...schemas);
291
- }
292
- function parseLiteral({ schemas, zodRef, openApiVersion }) {
293
- const type3 = typeof zodRef._def.value;
294
- return (0, ts_deepmerge_1.default)({
295
- type: typeFormat(type3, openApiVersion),
296
- enum: [zodRef._def.value]
297
- }, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
298
- }
299
- function parseEnum({ schemas, zodRef, openApiVersion }) {
300
- const type3 = typeof Object.values(zodRef._def.values)[0];
301
- return (0, ts_deepmerge_1.default)({
302
- type: typeFormat(type3, openApiVersion),
303
- enum: Object.values(zodRef._def.values)
304
- }, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
305
- }
306
- function parseIntersection({ schemas, zodRef, useOutput, openApiVersion }) {
307
- return (0, ts_deepmerge_1.default)({
308
- allOf: [
309
- generateSchema2(zodRef._def.left, useOutput, openApiVersion),
310
- generateSchema2(zodRef._def.right, useOutput, openApiVersion)
311
- ]
312
- }, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
313
- }
314
- function parseUnion({ schemas, zodRef, useOutput, openApiVersion }) {
315
- const contents = zodRef._def.options;
316
- if (contents.reduce((prev, content) => prev && content._def.typeName === "ZodLiteral", true)) {
317
- const literals = contents;
318
- const type3 = literals.reduce((prev, content) => !prev || prev === typeof content._def.value ? typeof content._def.value : null, null);
319
- if (type3) {
320
- return (0, ts_deepmerge_1.default)({
321
- type: typeFormat(type3, openApiVersion),
322
- enum: literals.map((literal3) => literal3._def.value)
323
- }, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
324
- }
325
- }
326
- const oneOfContents = openApiVersion === "3.0" ? contents.filter((content) => content._def.typeName !== "ZodNull") : contents;
327
- const contentsHasNull = contents.length != oneOfContents.length;
328
- return (0, ts_deepmerge_1.default)({
329
- oneOf: oneOfContents.map((schema) => generateSchema2(schema, useOutput, openApiVersion))
330
- }, contentsHasNull ? { nullable: true } : {}, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
331
- }
332
- function parseDiscriminatedUnion({ schemas, zodRef, useOutput, openApiVersion }) {
333
- return (0, ts_deepmerge_1.default)({
334
- discriminator: {
335
- propertyName: zodRef._def.discriminator
336
- },
337
- oneOf: Array.from(zodRef._def.options.values()).map((schema) => generateSchema2(schema, useOutput, openApiVersion))
338
- }, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
339
- }
340
- function parseNever({ zodRef, schemas }) {
341
- return (0, ts_deepmerge_1.default)({ readOnly: true }, zodRef.description ? { description: zodRef.description } : {}, ...schemas);
342
- }
343
- function parseBranded({ schemas, zodRef, useOutput, openApiVersion }) {
344
- return (0, ts_deepmerge_1.default)(generateSchema2(zodRef._def.type, useOutput, openApiVersion), ...schemas);
345
- }
346
- function catchAllParser({ zodRef, schemas }) {
347
- return (0, ts_deepmerge_1.default)(zodRef.description ? { description: zodRef.description } : {}, ...schemas);
348
- }
349
- function parsePipeline({ schemas, zodRef, useOutput, openApiVersion }) {
350
- return (0, ts_deepmerge_1.default)(generateSchema2(useOutput ? zodRef._def.out : zodRef._def.in, useOutput, openApiVersion), ...schemas);
351
- }
352
- function parseReadonly({ zodRef, useOutput, schemas, openApiVersion }) {
353
- return (0, ts_deepmerge_1.default)(generateSchema2(zodRef._def.innerType, useOutput, openApiVersion), zodRef.description ? { description: zodRef.description } : {}, ...schemas);
354
- }
355
- var workerMap = {
356
- ZodObject: parseObject,
357
- ZodRecord: parseRecord,
358
- ZodString: parseString,
359
- ZodNumber: parseNumber,
360
- ZodBigInt: parseBigInt,
361
- ZodBoolean: parseBoolean,
362
- ZodDate: parseDate,
363
- ZodNull: parseNull,
364
- ZodOptional: parseOptional,
365
- ZodNullable: parseNullable,
366
- ZodDefault: parseDefault,
367
- ZodArray: parseArray,
368
- ZodLiteral: parseLiteral,
369
- ZodEnum: parseEnum,
370
- ZodNativeEnum: parseEnum,
371
- ZodTransformer: parseTransformation,
372
- ZodEffects: parseTransformation,
373
- ZodIntersection: parseIntersection,
374
- ZodUnion: parseUnion,
375
- ZodDiscriminatedUnion: parseDiscriminatedUnion,
376
- ZodNever: parseNever,
377
- ZodBranded: parseBranded,
378
- // TODO Transform the rest to schemas
379
- ZodUndefined: catchAllParser,
380
- // TODO: `prefixItems` is allowed in OpenAPI 3.1 which can be used to create tuples
381
- ZodTuple: catchAllParser,
382
- ZodMap: catchAllParser,
383
- ZodFunction: catchAllParser,
384
- ZodLazy: catchAllParser,
385
- ZodPromise: catchAllParser,
386
- ZodAny: catchAllParser,
387
- ZodUnknown: catchAllParser,
388
- ZodVoid: catchAllParser,
389
- ZodPipeline: parsePipeline,
390
- ZodReadonly: parseReadonly
391
- };
392
- function generateSchema2(zodRef, useOutput = false, openApiVersion = "3.1") {
393
- const { metaOpenApi = {} } = zodRef;
394
- const schemas = [
395
- ...Array.isArray(metaOpenApi) ? metaOpenApi : [metaOpenApi]
396
- ];
397
- try {
398
- const typeName = zodRef._def.typeName;
399
- if (typeName in workerMap) {
400
- return workerMap[typeName]({
401
- zodRef,
402
- schemas,
403
- useOutput,
404
- openApiVersion
405
- });
406
- }
407
- return catchAllParser({ zodRef, schemas, openApiVersion });
408
- } catch (err) {
409
- console.error(err);
410
- return catchAllParser({ zodRef, schemas, openApiVersion });
411
- }
412
- }
413
- exports.generateSchema = generateSchema2;
414
- }
415
- });
416
-
417
- // ../../../node_modules/.pnpm/@anatine+zod-openapi@2.2.8_openapi3-ts@4.5.0_zod@3.25.76/node_modules/@anatine/zod-openapi/src/lib/zod-extensions.js
418
- var require_zod_extensions = __commonJS({
419
- "../../../node_modules/.pnpm/@anatine+zod-openapi@2.2.8_openapi3-ts@4.5.0_zod@3.25.76/node_modules/@anatine/zod-openapi/src/lib/zod-extensions.js"(exports) {
420
- "use strict";
421
- Object.defineProperty(exports, "__esModule", { value: true });
422
- exports.extendZodWithOpenApi = void 0;
423
- var zod_openapi_1 = require_zod_openapi();
424
- function extendZodWithOpenApi2(zod, forceOverride = false) {
425
- if (!forceOverride && typeof zod.ZodSchema.prototype.openapi !== "undefined") {
426
- return;
427
- }
428
- zod.ZodSchema.prototype.openapi = function(metadata) {
429
- return (0, zod_openapi_1.extendApi)(this, metadata);
430
- };
431
- }
432
- exports.extendZodWithOpenApi = extendZodWithOpenApi2;
433
- }
434
- });
435
-
436
- // ../../../node_modules/.pnpm/@anatine+zod-openapi@2.2.8_openapi3-ts@4.5.0_zod@3.25.76/node_modules/@anatine/zod-openapi/src/index.js
437
- var require_src = __commonJS({
438
- "../../../node_modules/.pnpm/@anatine+zod-openapi@2.2.8_openapi3-ts@4.5.0_zod@3.25.76/node_modules/@anatine/zod-openapi/src/index.js"(exports) {
439
- "use strict";
440
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
441
- if (k2 === void 0) k2 = k;
442
- var desc = Object.getOwnPropertyDescriptor(m, k);
443
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
444
- desc = { enumerable: true, get: function() {
445
- return m[k];
446
- } };
447
- }
448
- Object.defineProperty(o, k2, desc);
449
- } : function(o, m, k, k2) {
450
- if (k2 === void 0) k2 = k;
451
- o[k2] = m[k];
452
- });
453
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
454
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
455
- };
456
- Object.defineProperty(exports, "__esModule", { value: true });
457
- __exportStar(require_zod_openapi(), exports);
458
- __exportStar(require_zod_extensions(), exports);
459
- }
460
- });
461
18
 
462
19
  // domain/schemas/databaseWorker.schema.ts
463
20
  import { serviceSchemaResolver } from "@forklaunch/internal";
464
21
 
465
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.7.5_openapi3-ts@4.5.0/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
22
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.7.7/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
466
23
  var typebox_exports = {};
467
24
  __export(typebox_exports, {
468
25
  SchemaValidator: () => SchemaValidator,
@@ -503,7 +60,7 @@ __export(typebox_exports, {
503
60
  __reExport(typebox_exports, typebox_star);
504
61
  import * as typebox_star from "@sinclair/typebox";
505
62
 
506
- // ../../../node_modules/.pnpm/@forklaunch+common@0.4.3/node_modules/@forklaunch/common/lib/index.mjs
63
+ // ../../../node_modules/.pnpm/@forklaunch+common@0.4.5/node_modules/@forklaunch/common/lib/index.mjs
507
64
  var InMemoryBlob = class extends Blob {
508
65
  constructor(content) {
509
66
  super([Buffer.from(content)]);
@@ -511,7 +68,7 @@ var InMemoryBlob = class extends Blob {
511
68
  }
512
69
  };
513
70
 
514
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.7.5_openapi3-ts@4.5.0/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
71
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.7.7/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
515
72
  import {
516
73
  FormatRegistry,
517
74
  Kind,
@@ -1026,50 +583,672 @@ var DatabaseWorkerOptionsSchema = {
1026
583
  interval: number
1027
584
  };
1028
585
 
1029
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.7.5_openapi3-ts@4.5.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
1030
- var import_zod_openapi = __toESM(require_src(), 1);
586
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.7.7/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
1031
587
  import {
1032
- z,
588
+ z as z2,
1033
589
  ZodType
1034
590
  } from "zod/v3";
1035
- (0, import_zod_openapi.extendZodWithOpenApi)(z);
591
+
592
+ // ../../../node_modules/.pnpm/ts-deepmerge@7.0.3/node_modules/ts-deepmerge/esm/index.js
593
+ var isObject = (obj) => {
594
+ if (typeof obj === "object" && obj !== null) {
595
+ if (typeof Object.getPrototypeOf === "function") {
596
+ const prototype = Object.getPrototypeOf(obj);
597
+ return prototype === Object.prototype || prototype === null;
598
+ }
599
+ return Object.prototype.toString.call(obj) === "[object Object]";
600
+ }
601
+ return false;
602
+ };
603
+ var merge = (...objects) => objects.reduce((result, current) => {
604
+ if (current === void 0) {
605
+ return result;
606
+ }
607
+ if (Array.isArray(current)) {
608
+ throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
609
+ }
610
+ Object.keys(current).forEach((key) => {
611
+ if (["__proto__", "constructor", "prototype"].includes(key)) {
612
+ return;
613
+ }
614
+ if (Array.isArray(result[key]) && Array.isArray(current[key])) {
615
+ result[key] = merge.options.mergeArrays ? merge.options.uniqueArrayItems ? Array.from(new Set(result[key].concat(current[key]))) : [...result[key], ...current[key]] : current[key];
616
+ } else if (isObject(result[key]) && isObject(current[key])) {
617
+ result[key] = merge(result[key], current[key]);
618
+ } else if (!isObject(result[key]) && isObject(current[key])) {
619
+ result[key] = merge(current[key], void 0);
620
+ } else {
621
+ result[key] = current[key] === void 0 ? merge.options.allowUndefinedOverrides ? current[key] : result[key] : current[key];
622
+ }
623
+ });
624
+ return result;
625
+ }, {});
626
+ var defaultOptions = {
627
+ allowUndefinedOverrides: true,
628
+ mergeArrays: true,
629
+ uniqueArrayItems: true
630
+ };
631
+ merge.options = defaultOptions;
632
+ merge.withOptions = (options, ...objects) => {
633
+ merge.options = Object.assign(Object.assign({}, defaultOptions), options);
634
+ const result = merge(...objects);
635
+ merge.options = defaultOptions;
636
+ return result;
637
+ };
638
+
639
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.7.7/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
640
+ import { z } from "zod/v3";
641
+ function extendApi(schema, schemaObject = {}) {
642
+ const This = schema.constructor;
643
+ const newSchema = new This(schema._def);
644
+ newSchema.metaOpenApi = Object.assign(
645
+ {},
646
+ schema.metaOpenApi || {},
647
+ schemaObject
648
+ );
649
+ return newSchema;
650
+ }
651
+ function iterateZodObject({
652
+ zodRef,
653
+ useOutput,
654
+ hideDefinitions,
655
+ openApiVersion
656
+ }) {
657
+ const reduced = Object.keys(zodRef.shape).filter((key) => hideDefinitions?.includes(key) === false).reduce(
658
+ (carry, key) => ({
659
+ ...carry,
660
+ [key]: generateSchema(zodRef.shape[key], useOutput, openApiVersion)
661
+ }),
662
+ {}
663
+ );
664
+ return reduced;
665
+ }
666
+ function typeFormat(type22, openApiVersion) {
667
+ return openApiVersion === "3.0" ? type22 : [type22];
668
+ }
669
+ function parseTransformation({
670
+ zodRef,
671
+ schemas,
672
+ useOutput,
673
+ openApiVersion
674
+ }) {
675
+ const input = generateSchema(zodRef._def.schema, useOutput, openApiVersion);
676
+ let output = "undefined";
677
+ if (useOutput && zodRef._def.effect) {
678
+ const effect = zodRef._def.effect.type === "transform" ? zodRef._def.effect : null;
679
+ if (effect && "transform" in effect) {
680
+ try {
681
+ const type22 = Array.isArray(input.type) ? input.type[0] : input.type;
682
+ output = typeof effect.transform(
683
+ ["integer", "number"].includes(`${type22}`) ? 0 : "string" === type22 ? "" : "boolean" === type22 ? false : "object" === type22 ? {} : "null" === type22 ? null : "array" === type22 ? [] : void 0,
684
+ { addIssue: () => void 0, path: [] }
685
+ // TODO: Discover if context is necessary here
686
+ );
687
+ } catch {
688
+ }
689
+ }
690
+ }
691
+ const outputType = output;
692
+ return merge(
693
+ {
694
+ ...zodRef.description ? { description: zodRef.description } : {},
695
+ ...input,
696
+ ...["number", "string", "boolean", "null"].includes(output) ? {
697
+ type: typeFormat(outputType, openApiVersion)
698
+ } : {}
699
+ },
700
+ ...schemas
701
+ );
702
+ }
703
+ function parseString({
704
+ zodRef,
705
+ schemas,
706
+ openApiVersion
707
+ }) {
708
+ const baseSchema = {
709
+ type: typeFormat("string", openApiVersion)
710
+ };
711
+ const { checks = [] } = zodRef._def;
712
+ checks.forEach((item) => {
713
+ switch (item.kind) {
714
+ case "email":
715
+ baseSchema.format = "email";
716
+ break;
717
+ case "uuid":
718
+ baseSchema.format = "uuid";
719
+ break;
720
+ case "cuid":
721
+ baseSchema.format = "cuid";
722
+ break;
723
+ case "url":
724
+ baseSchema.format = "uri";
725
+ break;
726
+ case "datetime":
727
+ baseSchema.format = "date-time";
728
+ break;
729
+ case "length":
730
+ baseSchema.minLength = item.value;
731
+ baseSchema.maxLength = item.value;
732
+ break;
733
+ case "max":
734
+ baseSchema.maxLength = item.value;
735
+ break;
736
+ case "min":
737
+ baseSchema.minLength = item.value;
738
+ break;
739
+ case "regex":
740
+ baseSchema.pattern = item.regex.source;
741
+ break;
742
+ }
743
+ });
744
+ return merge(
745
+ baseSchema,
746
+ zodRef.description ? { description: zodRef.description } : {},
747
+ ...schemas
748
+ );
749
+ }
750
+ function parseNumber({
751
+ zodRef,
752
+ schemas,
753
+ openApiVersion
754
+ }) {
755
+ const baseSchema = {
756
+ type: typeFormat("number", openApiVersion)
757
+ };
758
+ const { checks = [] } = zodRef._def;
759
+ checks.forEach((item) => {
760
+ switch (item.kind) {
761
+ case "max":
762
+ if (item.inclusive || openApiVersion === "3.0") {
763
+ baseSchema.maximum = item.value;
764
+ }
765
+ if (!item.inclusive) {
766
+ if (openApiVersion === "3.0") {
767
+ baseSchema.exclusiveMaximum = true;
768
+ } else {
769
+ baseSchema.exclusiveMaximum = item.value;
770
+ }
771
+ }
772
+ break;
773
+ case "min":
774
+ if (item.inclusive || openApiVersion === "3.0") {
775
+ baseSchema.minimum = item.value;
776
+ }
777
+ if (!item.inclusive) {
778
+ if (openApiVersion === "3.0") {
779
+ baseSchema.exclusiveMinimum = true;
780
+ } else {
781
+ baseSchema.exclusiveMinimum = item.value;
782
+ }
783
+ }
784
+ break;
785
+ case "int":
786
+ baseSchema.type = typeFormat("integer", openApiVersion);
787
+ break;
788
+ case "multipleOf":
789
+ baseSchema.multipleOf = item.value;
790
+ break;
791
+ }
792
+ });
793
+ return merge(
794
+ baseSchema,
795
+ zodRef.description ? { description: zodRef.description } : {},
796
+ ...schemas
797
+ );
798
+ }
799
+ function getExcludedDefinitionsFromSchema(schemas) {
800
+ const excludedDefinitions = [];
801
+ for (const schema of schemas) {
802
+ if (Array.isArray(schema.hideDefinitions)) {
803
+ excludedDefinitions.push(...schema.hideDefinitions);
804
+ }
805
+ }
806
+ return excludedDefinitions;
807
+ }
808
+ function parseObject({
809
+ zodRef,
810
+ schemas,
811
+ useOutput,
812
+ hideDefinitions,
813
+ openApiVersion
814
+ }) {
815
+ let additionalProperties;
816
+ if (!(zodRef._def.catchall instanceof z.ZodNever || zodRef._def.catchall?._def.typeName === "ZodNever"))
817
+ additionalProperties = generateSchema(
818
+ zodRef._def.catchall,
819
+ useOutput,
820
+ openApiVersion
821
+ );
822
+ else if (zodRef._def.unknownKeys === "passthrough")
823
+ additionalProperties = true;
824
+ else if (zodRef._def.unknownKeys === "strict") additionalProperties = false;
825
+ additionalProperties = additionalProperties != null ? { additionalProperties } : {};
826
+ const requiredProperties = Object.keys(
827
+ zodRef.shape
828
+ ).filter((key) => {
829
+ const item = zodRef.shape[key];
830
+ return !(item.isOptional() || item instanceof z.ZodDefault || item._def.typeName === "ZodDefault") && !(item instanceof z.ZodNever || item._def.typeName === "ZodDefault");
831
+ });
832
+ const required = requiredProperties.length > 0 ? { required: requiredProperties } : {};
833
+ return merge(
834
+ {
835
+ type: typeFormat("object", openApiVersion),
836
+ properties: iterateZodObject({
837
+ zodRef,
838
+ schemas,
839
+ useOutput,
840
+ hideDefinitions: getExcludedDefinitionsFromSchema(schemas),
841
+ openApiVersion
842
+ }),
843
+ ...required,
844
+ ...additionalProperties,
845
+ ...hideDefinitions
846
+ },
847
+ zodRef.description ? { description: zodRef.description, hideDefinitions } : {},
848
+ ...schemas
849
+ );
850
+ }
851
+ function parseRecord({
852
+ zodRef,
853
+ schemas,
854
+ useOutput,
855
+ openApiVersion
856
+ }) {
857
+ return merge(
858
+ {
859
+ type: typeFormat("object", openApiVersion),
860
+ additionalProperties: zodRef._def.valueType instanceof z.ZodUnknown ? {} : generateSchema(zodRef._def.valueType, useOutput, openApiVersion)
861
+ },
862
+ zodRef.description ? { description: zodRef.description } : {},
863
+ ...schemas
864
+ );
865
+ }
866
+ function parseBigInt({
867
+ zodRef,
868
+ schemas,
869
+ openApiVersion
870
+ }) {
871
+ return merge(
872
+ {
873
+ type: typeFormat("integer", openApiVersion),
874
+ format: "int64"
875
+ },
876
+ zodRef.description ? { description: zodRef.description } : {},
877
+ ...schemas
878
+ );
879
+ }
880
+ function parseBoolean({
881
+ zodRef,
882
+ schemas,
883
+ openApiVersion
884
+ }) {
885
+ return merge(
886
+ { type: typeFormat("boolean", openApiVersion) },
887
+ zodRef.description ? { description: zodRef.description } : {},
888
+ ...schemas
889
+ );
890
+ }
891
+ function parseDate({
892
+ zodRef,
893
+ schemas,
894
+ openApiVersion
895
+ }) {
896
+ return merge(
897
+ {
898
+ type: typeFormat("string", openApiVersion),
899
+ format: "date-time"
900
+ },
901
+ zodRef.description ? { description: zodRef.description } : {},
902
+ ...schemas
903
+ );
904
+ }
905
+ function parseNull({
906
+ zodRef,
907
+ schemas,
908
+ openApiVersion
909
+ }) {
910
+ return merge(
911
+ openApiVersion === "3.0" ? { type: "null" } : {
912
+ type: ["string", "null"],
913
+ enum: ["null"]
914
+ },
915
+ zodRef.description ? { description: zodRef.description } : {},
916
+ ...schemas
917
+ );
918
+ }
919
+ function parseOptional({
920
+ schemas,
921
+ zodRef,
922
+ useOutput,
923
+ openApiVersion
924
+ }) {
925
+ return merge(
926
+ generateSchema(zodRef.unwrap(), useOutput, openApiVersion),
927
+ zodRef.description ? { description: zodRef.description } : {},
928
+ ...schemas
929
+ );
930
+ }
931
+ function parseNullable({
932
+ schemas,
933
+ zodRef,
934
+ useOutput,
935
+ openApiVersion
936
+ }) {
937
+ const schema = generateSchema(zodRef.unwrap(), useOutput, openApiVersion);
938
+ return merge(
939
+ schema,
940
+ openApiVersion === "3.0" ? { nullable: true } : { type: typeFormat("null", openApiVersion) },
941
+ zodRef.description ? { description: zodRef.description } : {},
942
+ ...schemas
943
+ );
944
+ }
945
+ function parseDefault({
946
+ schemas,
947
+ zodRef,
948
+ useOutput,
949
+ openApiVersion
950
+ }) {
951
+ return merge(
952
+ {
953
+ default: zodRef._def.defaultValue(),
954
+ ...generateSchema(zodRef._def.innerType, useOutput, openApiVersion)
955
+ },
956
+ zodRef.description ? { description: zodRef.description } : {},
957
+ ...schemas
958
+ );
959
+ }
960
+ function parseArray({
961
+ schemas,
962
+ zodRef,
963
+ useOutput,
964
+ openApiVersion
965
+ }) {
966
+ const constraints = {};
967
+ if (zodRef._def.exactLength != null) {
968
+ constraints.minItems = zodRef._def.exactLength.value;
969
+ constraints.maxItems = zodRef._def.exactLength.value;
970
+ }
971
+ if (zodRef._def.minLength != null)
972
+ constraints.minItems = zodRef._def.minLength.value;
973
+ if (zodRef._def.maxLength != null)
974
+ constraints.maxItems = zodRef._def.maxLength.value;
975
+ return merge(
976
+ {
977
+ type: typeFormat("array", openApiVersion),
978
+ items: generateSchema(zodRef.element, useOutput, openApiVersion),
979
+ ...constraints
980
+ },
981
+ zodRef.description ? { description: zodRef.description } : {},
982
+ ...schemas
983
+ );
984
+ }
985
+ function parseLiteral({
986
+ schemas,
987
+ zodRef,
988
+ openApiVersion
989
+ }) {
990
+ const type22 = typeof zodRef._def.value;
991
+ return merge(
992
+ {
993
+ type: typeFormat(type22, openApiVersion),
994
+ enum: [zodRef._def.value]
995
+ },
996
+ zodRef.description ? { description: zodRef.description } : {},
997
+ ...schemas
998
+ );
999
+ }
1000
+ function parseEnum({
1001
+ schemas,
1002
+ zodRef,
1003
+ openApiVersion
1004
+ }) {
1005
+ const type22 = typeof Object.values(zodRef._def.values)[0];
1006
+ return merge(
1007
+ {
1008
+ type: typeFormat(type22, openApiVersion),
1009
+ enum: Object.values(zodRef._def.values)
1010
+ },
1011
+ zodRef.description ? { description: zodRef.description } : {},
1012
+ ...schemas
1013
+ );
1014
+ }
1015
+ function parseIntersection({
1016
+ schemas,
1017
+ zodRef,
1018
+ useOutput,
1019
+ openApiVersion
1020
+ }) {
1021
+ return merge(
1022
+ {
1023
+ allOf: [
1024
+ generateSchema(zodRef._def.left, useOutput, openApiVersion),
1025
+ generateSchema(zodRef._def.right, useOutput, openApiVersion)
1026
+ ]
1027
+ },
1028
+ zodRef.description ? { description: zodRef.description } : {},
1029
+ ...schemas
1030
+ );
1031
+ }
1032
+ function parseUnion({
1033
+ schemas,
1034
+ zodRef,
1035
+ useOutput,
1036
+ openApiVersion
1037
+ }) {
1038
+ const contents = zodRef._def.options;
1039
+ if (contents.reduce(
1040
+ (prev, content) => prev && content._def.typeName === "ZodLiteral",
1041
+ true
1042
+ )) {
1043
+ const literals = contents;
1044
+ const type22 = literals.reduce(
1045
+ (prev, content) => !prev || prev === typeof content._def.value ? typeof content._def.value : null,
1046
+ null
1047
+ );
1048
+ if (type22) {
1049
+ return merge(
1050
+ {
1051
+ type: typeFormat(type22, openApiVersion),
1052
+ enum: literals.map((literal22) => literal22._def.value)
1053
+ },
1054
+ zodRef.description ? { description: zodRef.description } : {},
1055
+ ...schemas
1056
+ );
1057
+ }
1058
+ }
1059
+ const oneOfContents = openApiVersion === "3.0" ? contents.filter((content) => content._def.typeName !== "ZodNull") : contents;
1060
+ const contentsHasNull = contents.length != oneOfContents.length;
1061
+ return merge(
1062
+ {
1063
+ oneOf: oneOfContents.map(
1064
+ (schema) => generateSchema(schema, useOutput, openApiVersion)
1065
+ )
1066
+ },
1067
+ contentsHasNull ? { nullable: true } : {},
1068
+ zodRef.description ? { description: zodRef.description } : {},
1069
+ ...schemas
1070
+ );
1071
+ }
1072
+ function parseDiscriminatedUnion({
1073
+ schemas,
1074
+ zodRef,
1075
+ useOutput,
1076
+ openApiVersion
1077
+ }) {
1078
+ return merge(
1079
+ {
1080
+ discriminator: {
1081
+ propertyName: zodRef._def.discriminator
1082
+ },
1083
+ oneOf: Array.from(
1084
+ zodRef._def.options.values()
1085
+ ).map((schema) => generateSchema(schema, useOutput, openApiVersion))
1086
+ },
1087
+ zodRef.description ? { description: zodRef.description } : {},
1088
+ ...schemas
1089
+ );
1090
+ }
1091
+ function parseNever({
1092
+ zodRef,
1093
+ schemas
1094
+ }) {
1095
+ return merge(
1096
+ { readOnly: true },
1097
+ zodRef.description ? { description: zodRef.description } : {},
1098
+ ...schemas
1099
+ );
1100
+ }
1101
+ function parseBranded({
1102
+ schemas,
1103
+ zodRef,
1104
+ useOutput,
1105
+ openApiVersion
1106
+ }) {
1107
+ return merge(
1108
+ generateSchema(zodRef._def.type, useOutput, openApiVersion),
1109
+ ...schemas
1110
+ );
1111
+ }
1112
+ function catchAllParser({
1113
+ zodRef,
1114
+ schemas
1115
+ }) {
1116
+ return merge(
1117
+ zodRef.description ? { description: zodRef.description } : {},
1118
+ ...schemas
1119
+ );
1120
+ }
1121
+ function parsePipeline({
1122
+ schemas,
1123
+ zodRef,
1124
+ useOutput,
1125
+ openApiVersion
1126
+ }) {
1127
+ return merge(
1128
+ generateSchema(
1129
+ useOutput ? zodRef._def.out : zodRef._def.in,
1130
+ useOutput,
1131
+ openApiVersion
1132
+ ),
1133
+ ...schemas
1134
+ );
1135
+ }
1136
+ function parseReadonly({
1137
+ zodRef,
1138
+ useOutput,
1139
+ schemas,
1140
+ openApiVersion
1141
+ }) {
1142
+ return merge(
1143
+ generateSchema(zodRef._def.innerType, useOutput, openApiVersion),
1144
+ zodRef.description ? { description: zodRef.description } : {},
1145
+ ...schemas
1146
+ );
1147
+ }
1148
+ var workerMap = {
1149
+ ZodObject: parseObject,
1150
+ ZodRecord: parseRecord,
1151
+ ZodString: parseString,
1152
+ ZodNumber: parseNumber,
1153
+ ZodBigInt: parseBigInt,
1154
+ ZodBoolean: parseBoolean,
1155
+ ZodDate: parseDate,
1156
+ ZodNull: parseNull,
1157
+ ZodOptional: parseOptional,
1158
+ ZodNullable: parseNullable,
1159
+ ZodDefault: parseDefault,
1160
+ ZodArray: parseArray,
1161
+ ZodLiteral: parseLiteral,
1162
+ ZodEnum: parseEnum,
1163
+ ZodNativeEnum: parseEnum,
1164
+ ZodTransformer: parseTransformation,
1165
+ ZodEffects: parseTransformation,
1166
+ ZodIntersection: parseIntersection,
1167
+ ZodUnion: parseUnion,
1168
+ ZodDiscriminatedUnion: parseDiscriminatedUnion,
1169
+ ZodNever: parseNever,
1170
+ ZodBranded: parseBranded,
1171
+ // TODO Transform the rest to schemas
1172
+ ZodUndefined: catchAllParser,
1173
+ // TODO: `prefixItems` is allowed in OpenAPI 3.1 which can be used to create tuples
1174
+ ZodTuple: catchAllParser,
1175
+ ZodMap: catchAllParser,
1176
+ ZodFunction: catchAllParser,
1177
+ ZodLazy: catchAllParser,
1178
+ ZodPromise: catchAllParser,
1179
+ ZodAny: catchAllParser,
1180
+ ZodUnknown: catchAllParser,
1181
+ ZodVoid: catchAllParser,
1182
+ ZodPipeline: parsePipeline,
1183
+ ZodReadonly: parseReadonly
1184
+ };
1185
+ function generateSchema(zodRef, useOutput = false, openApiVersion = "3.1") {
1186
+ const { metaOpenApi = {} } = zodRef;
1187
+ const schemas = [
1188
+ ...Array.isArray(metaOpenApi) ? metaOpenApi : [metaOpenApi]
1189
+ ];
1190
+ try {
1191
+ const typeName = zodRef._def.typeName;
1192
+ if (typeName in workerMap) {
1193
+ return workerMap[typeName]({
1194
+ zodRef,
1195
+ schemas,
1196
+ useOutput,
1197
+ openApiVersion
1198
+ });
1199
+ }
1200
+ return catchAllParser({ zodRef, schemas, openApiVersion });
1201
+ } catch (err) {
1202
+ console.error(err);
1203
+ return catchAllParser({ zodRef, schemas, openApiVersion });
1204
+ }
1205
+ }
1206
+ function extendZodWithOpenApi(zod, forceOverride = false) {
1207
+ if (!forceOverride && typeof zod.ZodSchema.prototype.openapi !== "undefined") {
1208
+ return;
1209
+ }
1210
+ zod.ZodSchema.prototype.openapi = function(metadata) {
1211
+ return extendApi(this, metadata);
1212
+ };
1213
+ }
1214
+ extendZodWithOpenApi(z2);
1036
1215
  var ZodSchemaValidator = class {
1037
1216
  _Type = "Zod";
1038
1217
  _SchemaCatchall;
1039
1218
  _ValidSchemaObject;
1040
- string = z.string().openapi({
1219
+ string = z2.string().openapi({
1041
1220
  title: "String",
1042
1221
  example: "a string"
1043
1222
  });
1044
- uuid = z.string().uuid().openapi({
1223
+ uuid = z2.string().uuid().openapi({
1045
1224
  title: "UUID",
1046
1225
  format: "uuid",
1047
1226
  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}$",
1048
1227
  example: "a8b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6"
1049
1228
  });
1050
- email = z.string().email().openapi({
1229
+ email = z2.string().email().openapi({
1051
1230
  title: "Email",
1052
1231
  format: "email",
1053
1232
  pattern: `(?:[a-z0-9!#$%&'*+/=?^_{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_{|}~-]+)*|"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)])`,
1054
1233
  example: "a@b.com"
1055
1234
  });
1056
- uri = z.string().url().openapi({
1235
+ uri = z2.string().url().openapi({
1057
1236
  title: "URI",
1058
1237
  format: "uri",
1059
1238
  pattern: "^[a-zA-Z][a-zA-Z\\d+-.]*:[^\\s]*$",
1060
1239
  example: "https://forklaunch.com"
1061
1240
  });
1062
- number = z.preprocess((value) => {
1241
+ number = z2.preprocess((value) => {
1063
1242
  try {
1064
1243
  return Number(value);
1065
1244
  } catch {
1066
1245
  return value;
1067
1246
  }
1068
- }, z.number()).openapi({
1247
+ }, z2.number()).openapi({
1069
1248
  title: "Number",
1070
1249
  example: 123
1071
1250
  });
1072
- bigint = z.preprocess((value) => {
1251
+ bigint = z2.preprocess((value) => {
1073
1252
  try {
1074
1253
  if (value instanceof Date) {
1075
1254
  return BigInt(value.getTime());
@@ -1086,23 +1265,23 @@ var ZodSchemaValidator = class {
1086
1265
  } catch {
1087
1266
  return value;
1088
1267
  }
1089
- }, z.bigint()).openapi({
1268
+ }, z2.bigint()).openapi({
1090
1269
  title: "BigInt",
1091
1270
  type: "integer",
1092
1271
  format: "int64",
1093
1272
  example: 123n
1094
1273
  });
1095
- boolean = z.preprocess((val) => {
1274
+ boolean = z2.preprocess((val) => {
1096
1275
  if (typeof val === "string") {
1097
1276
  if (val.toLowerCase() === "true") return true;
1098
1277
  if (val.toLowerCase() === "false") return false;
1099
1278
  }
1100
1279
  return val;
1101
- }, z.boolean()).openapi({
1280
+ }, z2.boolean()).openapi({
1102
1281
  title: "Boolean",
1103
1282
  example: true
1104
1283
  });
1105
- date = z.preprocess((value) => {
1284
+ date = z2.preprocess((value) => {
1106
1285
  try {
1107
1286
  switch (typeof value) {
1108
1287
  case "string":
@@ -1115,58 +1294,58 @@ var ZodSchemaValidator = class {
1115
1294
  } catch {
1116
1295
  return value;
1117
1296
  }
1118
- }, z.date()).openapi({
1297
+ }, z2.date()).openapi({
1119
1298
  title: "Date",
1120
1299
  type: "string",
1121
1300
  format: "date-time",
1122
1301
  example: "2025-05-16T21:13:04.123Z"
1123
1302
  });
1124
- symbol = z.symbol().openapi({
1303
+ symbol = z2.symbol().openapi({
1125
1304
  title: "Symbol",
1126
1305
  example: Symbol("symbol")
1127
1306
  });
1128
- nullish = z.union([z.void(), z.null(), z.undefined()]).openapi({
1307
+ nullish = z2.union([z2.void(), z2.null(), z2.undefined()]).openapi({
1129
1308
  title: "Nullish",
1130
1309
  type: "null",
1131
1310
  example: null
1132
1311
  });
1133
- void = z.void().openapi({
1312
+ void = z2.void().openapi({
1134
1313
  title: "Void",
1135
1314
  type: "null",
1136
1315
  example: void 0
1137
1316
  });
1138
- null = z.null().openapi({
1317
+ null = z2.null().openapi({
1139
1318
  title: "Null",
1140
1319
  type: "null",
1141
1320
  example: null
1142
1321
  });
1143
- undefined = z.undefined().openapi({
1322
+ undefined = z2.undefined().openapi({
1144
1323
  title: "Undefined",
1145
1324
  type: "null",
1146
1325
  example: void 0
1147
1326
  });
1148
- any = z.any().openapi({
1327
+ any = z2.any().openapi({
1149
1328
  title: "Any",
1150
1329
  type: "object",
1151
1330
  example: "any"
1152
1331
  });
1153
- unknown = z.unknown().openapi({
1332
+ unknown = z2.unknown().openapi({
1154
1333
  title: "Unknown",
1155
1334
  type: "object",
1156
1335
  example: "unknown"
1157
1336
  });
1158
- never = z.never().openapi({
1337
+ never = z2.never().openapi({
1159
1338
  title: "Never",
1160
1339
  type: "null",
1161
1340
  example: "never"
1162
1341
  });
1163
- binary = z.string().transform((v) => new TextEncoder().encode(v)).openapi({
1342
+ binary = z2.string().transform((v) => new TextEncoder().encode(v)).openapi({
1164
1343
  title: "Binary",
1165
1344
  type: "string",
1166
1345
  format: "binary",
1167
1346
  example: "a utf-8 encodable string"
1168
1347
  });
1169
- file = z.string().transform((val) => {
1348
+ file = z2.string().transform((val) => {
1170
1349
  return new Blob([val]);
1171
1350
  }).openapi({
1172
1351
  title: "File",
@@ -1191,7 +1370,7 @@ var ZodSchemaValidator = class {
1191
1370
  */
1192
1371
  schemify(schema) {
1193
1372
  if (typeof schema === "string" || typeof schema === "number" || typeof schema === "boolean") {
1194
- return z.literal(schema);
1373
+ return z2.literal(schema);
1195
1374
  }
1196
1375
  if (schema instanceof ZodType) {
1197
1376
  return schema;
@@ -1204,7 +1383,7 @@ var ZodSchemaValidator = class {
1204
1383
  newSchema[key] = this.schemify(schema[key]);
1205
1384
  }
1206
1385
  });
1207
- return z.object(newSchema);
1386
+ return z2.object(newSchema);
1208
1387
  }
1209
1388
  /**
1210
1389
  * Make a schema optional.
@@ -1231,7 +1410,7 @@ var ZodSchemaValidator = class {
1231
1410
  */
1232
1411
  union(schemas) {
1233
1412
  const resolvedSchemas = schemas.map((schema) => this.schemify(schema));
1234
- return z.union(
1413
+ return z2.union(
1235
1414
  resolvedSchemas
1236
1415
  );
1237
1416
  }
@@ -1241,7 +1420,7 @@ var ZodSchemaValidator = class {
1241
1420
  * @returns {ZodLiteral<ZodResolve<T>>} The literal schema.
1242
1421
  */
1243
1422
  literal(value) {
1244
- return z.literal(value);
1423
+ return z2.literal(value);
1245
1424
  }
1246
1425
  /**
1247
1426
  * Create an enum schema.
@@ -1262,7 +1441,7 @@ var ZodSchemaValidator = class {
1262
1441
  function_(args, returnType) {
1263
1442
  const schemaArgs = args.map((schema) => this.schemify(schema));
1264
1443
  const schemaReturnType = this.schemify(returnType);
1265
- return z.function(z.tuple(schemaArgs), schemaReturnType);
1444
+ return z2.function(z2.tuple(schemaArgs), schemaReturnType);
1266
1445
  }
1267
1446
  /**
1268
1447
  * Create a record schema.
@@ -1273,7 +1452,7 @@ var ZodSchemaValidator = class {
1273
1452
  record(key, value) {
1274
1453
  const keySchema = this.schemify(key);
1275
1454
  const valueSchema = this.schemify(value);
1276
- return z.record(keySchema, valueSchema);
1455
+ return z2.record(keySchema, valueSchema);
1277
1456
  }
1278
1457
  /**
1279
1458
  * Create a promise schema.
@@ -1281,7 +1460,7 @@ var ZodSchemaValidator = class {
1281
1460
  * @returns {ZodPromise<ZodResolve<T>>} The promise schema.
1282
1461
  */
1283
1462
  promise(schema) {
1284
- return z.promise(this.schemify(schema));
1463
+ return z2.promise(this.schemify(schema));
1285
1464
  }
1286
1465
  /**
1287
1466
  * Checks if a value is a Zod schema.
@@ -1352,7 +1531,7 @@ var ZodSchemaValidator = class {
1352
1531
  * @returns {SchemaObject} The OpenAPI schema object.
1353
1532
  */
1354
1533
  openapi(schema) {
1355
- return (0, import_zod_openapi.generateSchema)(this.schemify(schema));
1534
+ return generateSchema(this.schemify(schema));
1356
1535
  }
1357
1536
  };
1358
1537
  var SchemaValidator2 = () => new ZodSchemaValidator();