@forklaunch/implementation-worker-kafka 0.3.7 → 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/kafka.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,
@@ -1030,50 +587,672 @@ var KafkaWorkerOptionsSchema = {
1030
587
  peekCount: number
1031
588
  };
1032
589
 
1033
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.7.5_openapi3-ts@4.5.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
1034
- var import_zod_openapi = __toESM(require_src(), 1);
590
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.7.7/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
1035
591
  import {
1036
- z,
592
+ z as z2,
1037
593
  ZodType
1038
594
  } from "zod/v3";
1039
- (0, import_zod_openapi.extendZodWithOpenApi)(z);
595
+
596
+ // ../../../node_modules/.pnpm/ts-deepmerge@7.0.3/node_modules/ts-deepmerge/esm/index.js
597
+ var isObject = (obj) => {
598
+ if (typeof obj === "object" && obj !== null) {
599
+ if (typeof Object.getPrototypeOf === "function") {
600
+ const prototype = Object.getPrototypeOf(obj);
601
+ return prototype === Object.prototype || prototype === null;
602
+ }
603
+ return Object.prototype.toString.call(obj) === "[object Object]";
604
+ }
605
+ return false;
606
+ };
607
+ var merge = (...objects) => objects.reduce((result, current) => {
608
+ if (current === void 0) {
609
+ return result;
610
+ }
611
+ if (Array.isArray(current)) {
612
+ throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");
613
+ }
614
+ Object.keys(current).forEach((key) => {
615
+ if (["__proto__", "constructor", "prototype"].includes(key)) {
616
+ return;
617
+ }
618
+ if (Array.isArray(result[key]) && Array.isArray(current[key])) {
619
+ result[key] = merge.options.mergeArrays ? merge.options.uniqueArrayItems ? Array.from(new Set(result[key].concat(current[key]))) : [...result[key], ...current[key]] : current[key];
620
+ } else if (isObject(result[key]) && isObject(current[key])) {
621
+ result[key] = merge(result[key], current[key]);
622
+ } else if (!isObject(result[key]) && isObject(current[key])) {
623
+ result[key] = merge(current[key], void 0);
624
+ } else {
625
+ result[key] = current[key] === void 0 ? merge.options.allowUndefinedOverrides ? current[key] : result[key] : current[key];
626
+ }
627
+ });
628
+ return result;
629
+ }, {});
630
+ var defaultOptions = {
631
+ allowUndefinedOverrides: true,
632
+ mergeArrays: true,
633
+ uniqueArrayItems: true
634
+ };
635
+ merge.options = defaultOptions;
636
+ merge.withOptions = (options, ...objects) => {
637
+ merge.options = Object.assign(Object.assign({}, defaultOptions), options);
638
+ const result = merge(...objects);
639
+ merge.options = defaultOptions;
640
+ return result;
641
+ };
642
+
643
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.7.7/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
644
+ import { z } from "zod/v3";
645
+ function extendApi(schema, schemaObject = {}) {
646
+ const This = schema.constructor;
647
+ const newSchema = new This(schema._def);
648
+ newSchema.metaOpenApi = Object.assign(
649
+ {},
650
+ schema.metaOpenApi || {},
651
+ schemaObject
652
+ );
653
+ return newSchema;
654
+ }
655
+ function iterateZodObject({
656
+ zodRef,
657
+ useOutput,
658
+ hideDefinitions,
659
+ openApiVersion
660
+ }) {
661
+ const reduced = Object.keys(zodRef.shape).filter((key) => hideDefinitions?.includes(key) === false).reduce(
662
+ (carry, key) => ({
663
+ ...carry,
664
+ [key]: generateSchema(zodRef.shape[key], useOutput, openApiVersion)
665
+ }),
666
+ {}
667
+ );
668
+ return reduced;
669
+ }
670
+ function typeFormat(type22, openApiVersion) {
671
+ return openApiVersion === "3.0" ? type22 : [type22];
672
+ }
673
+ function parseTransformation({
674
+ zodRef,
675
+ schemas,
676
+ useOutput,
677
+ openApiVersion
678
+ }) {
679
+ const input = generateSchema(zodRef._def.schema, useOutput, openApiVersion);
680
+ let output = "undefined";
681
+ if (useOutput && zodRef._def.effect) {
682
+ const effect = zodRef._def.effect.type === "transform" ? zodRef._def.effect : null;
683
+ if (effect && "transform" in effect) {
684
+ try {
685
+ const type22 = Array.isArray(input.type) ? input.type[0] : input.type;
686
+ output = typeof effect.transform(
687
+ ["integer", "number"].includes(`${type22}`) ? 0 : "string" === type22 ? "" : "boolean" === type22 ? false : "object" === type22 ? {} : "null" === type22 ? null : "array" === type22 ? [] : void 0,
688
+ { addIssue: () => void 0, path: [] }
689
+ // TODO: Discover if context is necessary here
690
+ );
691
+ } catch {
692
+ }
693
+ }
694
+ }
695
+ const outputType = output;
696
+ return merge(
697
+ {
698
+ ...zodRef.description ? { description: zodRef.description } : {},
699
+ ...input,
700
+ ...["number", "string", "boolean", "null"].includes(output) ? {
701
+ type: typeFormat(outputType, openApiVersion)
702
+ } : {}
703
+ },
704
+ ...schemas
705
+ );
706
+ }
707
+ function parseString({
708
+ zodRef,
709
+ schemas,
710
+ openApiVersion
711
+ }) {
712
+ const baseSchema = {
713
+ type: typeFormat("string", openApiVersion)
714
+ };
715
+ const { checks = [] } = zodRef._def;
716
+ checks.forEach((item) => {
717
+ switch (item.kind) {
718
+ case "email":
719
+ baseSchema.format = "email";
720
+ break;
721
+ case "uuid":
722
+ baseSchema.format = "uuid";
723
+ break;
724
+ case "cuid":
725
+ baseSchema.format = "cuid";
726
+ break;
727
+ case "url":
728
+ baseSchema.format = "uri";
729
+ break;
730
+ case "datetime":
731
+ baseSchema.format = "date-time";
732
+ break;
733
+ case "length":
734
+ baseSchema.minLength = item.value;
735
+ baseSchema.maxLength = item.value;
736
+ break;
737
+ case "max":
738
+ baseSchema.maxLength = item.value;
739
+ break;
740
+ case "min":
741
+ baseSchema.minLength = item.value;
742
+ break;
743
+ case "regex":
744
+ baseSchema.pattern = item.regex.source;
745
+ break;
746
+ }
747
+ });
748
+ return merge(
749
+ baseSchema,
750
+ zodRef.description ? { description: zodRef.description } : {},
751
+ ...schemas
752
+ );
753
+ }
754
+ function parseNumber({
755
+ zodRef,
756
+ schemas,
757
+ openApiVersion
758
+ }) {
759
+ const baseSchema = {
760
+ type: typeFormat("number", openApiVersion)
761
+ };
762
+ const { checks = [] } = zodRef._def;
763
+ checks.forEach((item) => {
764
+ switch (item.kind) {
765
+ case "max":
766
+ if (item.inclusive || openApiVersion === "3.0") {
767
+ baseSchema.maximum = item.value;
768
+ }
769
+ if (!item.inclusive) {
770
+ if (openApiVersion === "3.0") {
771
+ baseSchema.exclusiveMaximum = true;
772
+ } else {
773
+ baseSchema.exclusiveMaximum = item.value;
774
+ }
775
+ }
776
+ break;
777
+ case "min":
778
+ if (item.inclusive || openApiVersion === "3.0") {
779
+ baseSchema.minimum = item.value;
780
+ }
781
+ if (!item.inclusive) {
782
+ if (openApiVersion === "3.0") {
783
+ baseSchema.exclusiveMinimum = true;
784
+ } else {
785
+ baseSchema.exclusiveMinimum = item.value;
786
+ }
787
+ }
788
+ break;
789
+ case "int":
790
+ baseSchema.type = typeFormat("integer", openApiVersion);
791
+ break;
792
+ case "multipleOf":
793
+ baseSchema.multipleOf = item.value;
794
+ break;
795
+ }
796
+ });
797
+ return merge(
798
+ baseSchema,
799
+ zodRef.description ? { description: zodRef.description } : {},
800
+ ...schemas
801
+ );
802
+ }
803
+ function getExcludedDefinitionsFromSchema(schemas) {
804
+ const excludedDefinitions = [];
805
+ for (const schema of schemas) {
806
+ if (Array.isArray(schema.hideDefinitions)) {
807
+ excludedDefinitions.push(...schema.hideDefinitions);
808
+ }
809
+ }
810
+ return excludedDefinitions;
811
+ }
812
+ function parseObject({
813
+ zodRef,
814
+ schemas,
815
+ useOutput,
816
+ hideDefinitions,
817
+ openApiVersion
818
+ }) {
819
+ let additionalProperties;
820
+ if (!(zodRef._def.catchall instanceof z.ZodNever || zodRef._def.catchall?._def.typeName === "ZodNever"))
821
+ additionalProperties = generateSchema(
822
+ zodRef._def.catchall,
823
+ useOutput,
824
+ openApiVersion
825
+ );
826
+ else if (zodRef._def.unknownKeys === "passthrough")
827
+ additionalProperties = true;
828
+ else if (zodRef._def.unknownKeys === "strict") additionalProperties = false;
829
+ additionalProperties = additionalProperties != null ? { additionalProperties } : {};
830
+ const requiredProperties = Object.keys(
831
+ zodRef.shape
832
+ ).filter((key) => {
833
+ const item = zodRef.shape[key];
834
+ return !(item.isOptional() || item instanceof z.ZodDefault || item._def.typeName === "ZodDefault") && !(item instanceof z.ZodNever || item._def.typeName === "ZodDefault");
835
+ });
836
+ const required = requiredProperties.length > 0 ? { required: requiredProperties } : {};
837
+ return merge(
838
+ {
839
+ type: typeFormat("object", openApiVersion),
840
+ properties: iterateZodObject({
841
+ zodRef,
842
+ schemas,
843
+ useOutput,
844
+ hideDefinitions: getExcludedDefinitionsFromSchema(schemas),
845
+ openApiVersion
846
+ }),
847
+ ...required,
848
+ ...additionalProperties,
849
+ ...hideDefinitions
850
+ },
851
+ zodRef.description ? { description: zodRef.description, hideDefinitions } : {},
852
+ ...schemas
853
+ );
854
+ }
855
+ function parseRecord({
856
+ zodRef,
857
+ schemas,
858
+ useOutput,
859
+ openApiVersion
860
+ }) {
861
+ return merge(
862
+ {
863
+ type: typeFormat("object", openApiVersion),
864
+ additionalProperties: zodRef._def.valueType instanceof z.ZodUnknown ? {} : generateSchema(zodRef._def.valueType, useOutput, openApiVersion)
865
+ },
866
+ zodRef.description ? { description: zodRef.description } : {},
867
+ ...schemas
868
+ );
869
+ }
870
+ function parseBigInt({
871
+ zodRef,
872
+ schemas,
873
+ openApiVersion
874
+ }) {
875
+ return merge(
876
+ {
877
+ type: typeFormat("integer", openApiVersion),
878
+ format: "int64"
879
+ },
880
+ zodRef.description ? { description: zodRef.description } : {},
881
+ ...schemas
882
+ );
883
+ }
884
+ function parseBoolean({
885
+ zodRef,
886
+ schemas,
887
+ openApiVersion
888
+ }) {
889
+ return merge(
890
+ { type: typeFormat("boolean", openApiVersion) },
891
+ zodRef.description ? { description: zodRef.description } : {},
892
+ ...schemas
893
+ );
894
+ }
895
+ function parseDate({
896
+ zodRef,
897
+ schemas,
898
+ openApiVersion
899
+ }) {
900
+ return merge(
901
+ {
902
+ type: typeFormat("string", openApiVersion),
903
+ format: "date-time"
904
+ },
905
+ zodRef.description ? { description: zodRef.description } : {},
906
+ ...schemas
907
+ );
908
+ }
909
+ function parseNull({
910
+ zodRef,
911
+ schemas,
912
+ openApiVersion
913
+ }) {
914
+ return merge(
915
+ openApiVersion === "3.0" ? { type: "null" } : {
916
+ type: ["string", "null"],
917
+ enum: ["null"]
918
+ },
919
+ zodRef.description ? { description: zodRef.description } : {},
920
+ ...schemas
921
+ );
922
+ }
923
+ function parseOptional({
924
+ schemas,
925
+ zodRef,
926
+ useOutput,
927
+ openApiVersion
928
+ }) {
929
+ return merge(
930
+ generateSchema(zodRef.unwrap(), useOutput, openApiVersion),
931
+ zodRef.description ? { description: zodRef.description } : {},
932
+ ...schemas
933
+ );
934
+ }
935
+ function parseNullable({
936
+ schemas,
937
+ zodRef,
938
+ useOutput,
939
+ openApiVersion
940
+ }) {
941
+ const schema = generateSchema(zodRef.unwrap(), useOutput, openApiVersion);
942
+ return merge(
943
+ schema,
944
+ openApiVersion === "3.0" ? { nullable: true } : { type: typeFormat("null", openApiVersion) },
945
+ zodRef.description ? { description: zodRef.description } : {},
946
+ ...schemas
947
+ );
948
+ }
949
+ function parseDefault({
950
+ schemas,
951
+ zodRef,
952
+ useOutput,
953
+ openApiVersion
954
+ }) {
955
+ return merge(
956
+ {
957
+ default: zodRef._def.defaultValue(),
958
+ ...generateSchema(zodRef._def.innerType, useOutput, openApiVersion)
959
+ },
960
+ zodRef.description ? { description: zodRef.description } : {},
961
+ ...schemas
962
+ );
963
+ }
964
+ function parseArray({
965
+ schemas,
966
+ zodRef,
967
+ useOutput,
968
+ openApiVersion
969
+ }) {
970
+ const constraints = {};
971
+ if (zodRef._def.exactLength != null) {
972
+ constraints.minItems = zodRef._def.exactLength.value;
973
+ constraints.maxItems = zodRef._def.exactLength.value;
974
+ }
975
+ if (zodRef._def.minLength != null)
976
+ constraints.minItems = zodRef._def.minLength.value;
977
+ if (zodRef._def.maxLength != null)
978
+ constraints.maxItems = zodRef._def.maxLength.value;
979
+ return merge(
980
+ {
981
+ type: typeFormat("array", openApiVersion),
982
+ items: generateSchema(zodRef.element, useOutput, openApiVersion),
983
+ ...constraints
984
+ },
985
+ zodRef.description ? { description: zodRef.description } : {},
986
+ ...schemas
987
+ );
988
+ }
989
+ function parseLiteral({
990
+ schemas,
991
+ zodRef,
992
+ openApiVersion
993
+ }) {
994
+ const type22 = typeof zodRef._def.value;
995
+ return merge(
996
+ {
997
+ type: typeFormat(type22, openApiVersion),
998
+ enum: [zodRef._def.value]
999
+ },
1000
+ zodRef.description ? { description: zodRef.description } : {},
1001
+ ...schemas
1002
+ );
1003
+ }
1004
+ function parseEnum({
1005
+ schemas,
1006
+ zodRef,
1007
+ openApiVersion
1008
+ }) {
1009
+ const type22 = typeof Object.values(zodRef._def.values)[0];
1010
+ return merge(
1011
+ {
1012
+ type: typeFormat(type22, openApiVersion),
1013
+ enum: Object.values(zodRef._def.values)
1014
+ },
1015
+ zodRef.description ? { description: zodRef.description } : {},
1016
+ ...schemas
1017
+ );
1018
+ }
1019
+ function parseIntersection({
1020
+ schemas,
1021
+ zodRef,
1022
+ useOutput,
1023
+ openApiVersion
1024
+ }) {
1025
+ return merge(
1026
+ {
1027
+ allOf: [
1028
+ generateSchema(zodRef._def.left, useOutput, openApiVersion),
1029
+ generateSchema(zodRef._def.right, useOutput, openApiVersion)
1030
+ ]
1031
+ },
1032
+ zodRef.description ? { description: zodRef.description } : {},
1033
+ ...schemas
1034
+ );
1035
+ }
1036
+ function parseUnion({
1037
+ schemas,
1038
+ zodRef,
1039
+ useOutput,
1040
+ openApiVersion
1041
+ }) {
1042
+ const contents = zodRef._def.options;
1043
+ if (contents.reduce(
1044
+ (prev, content) => prev && content._def.typeName === "ZodLiteral",
1045
+ true
1046
+ )) {
1047
+ const literals = contents;
1048
+ const type22 = literals.reduce(
1049
+ (prev, content) => !prev || prev === typeof content._def.value ? typeof content._def.value : null,
1050
+ null
1051
+ );
1052
+ if (type22) {
1053
+ return merge(
1054
+ {
1055
+ type: typeFormat(type22, openApiVersion),
1056
+ enum: literals.map((literal22) => literal22._def.value)
1057
+ },
1058
+ zodRef.description ? { description: zodRef.description } : {},
1059
+ ...schemas
1060
+ );
1061
+ }
1062
+ }
1063
+ const oneOfContents = openApiVersion === "3.0" ? contents.filter((content) => content._def.typeName !== "ZodNull") : contents;
1064
+ const contentsHasNull = contents.length != oneOfContents.length;
1065
+ return merge(
1066
+ {
1067
+ oneOf: oneOfContents.map(
1068
+ (schema) => generateSchema(schema, useOutput, openApiVersion)
1069
+ )
1070
+ },
1071
+ contentsHasNull ? { nullable: true } : {},
1072
+ zodRef.description ? { description: zodRef.description } : {},
1073
+ ...schemas
1074
+ );
1075
+ }
1076
+ function parseDiscriminatedUnion({
1077
+ schemas,
1078
+ zodRef,
1079
+ useOutput,
1080
+ openApiVersion
1081
+ }) {
1082
+ return merge(
1083
+ {
1084
+ discriminator: {
1085
+ propertyName: zodRef._def.discriminator
1086
+ },
1087
+ oneOf: Array.from(
1088
+ zodRef._def.options.values()
1089
+ ).map((schema) => generateSchema(schema, useOutput, openApiVersion))
1090
+ },
1091
+ zodRef.description ? { description: zodRef.description } : {},
1092
+ ...schemas
1093
+ );
1094
+ }
1095
+ function parseNever({
1096
+ zodRef,
1097
+ schemas
1098
+ }) {
1099
+ return merge(
1100
+ { readOnly: true },
1101
+ zodRef.description ? { description: zodRef.description } : {},
1102
+ ...schemas
1103
+ );
1104
+ }
1105
+ function parseBranded({
1106
+ schemas,
1107
+ zodRef,
1108
+ useOutput,
1109
+ openApiVersion
1110
+ }) {
1111
+ return merge(
1112
+ generateSchema(zodRef._def.type, useOutput, openApiVersion),
1113
+ ...schemas
1114
+ );
1115
+ }
1116
+ function catchAllParser({
1117
+ zodRef,
1118
+ schemas
1119
+ }) {
1120
+ return merge(
1121
+ zodRef.description ? { description: zodRef.description } : {},
1122
+ ...schemas
1123
+ );
1124
+ }
1125
+ function parsePipeline({
1126
+ schemas,
1127
+ zodRef,
1128
+ useOutput,
1129
+ openApiVersion
1130
+ }) {
1131
+ return merge(
1132
+ generateSchema(
1133
+ useOutput ? zodRef._def.out : zodRef._def.in,
1134
+ useOutput,
1135
+ openApiVersion
1136
+ ),
1137
+ ...schemas
1138
+ );
1139
+ }
1140
+ function parseReadonly({
1141
+ zodRef,
1142
+ useOutput,
1143
+ schemas,
1144
+ openApiVersion
1145
+ }) {
1146
+ return merge(
1147
+ generateSchema(zodRef._def.innerType, useOutput, openApiVersion),
1148
+ zodRef.description ? { description: zodRef.description } : {},
1149
+ ...schemas
1150
+ );
1151
+ }
1152
+ var workerMap = {
1153
+ ZodObject: parseObject,
1154
+ ZodRecord: parseRecord,
1155
+ ZodString: parseString,
1156
+ ZodNumber: parseNumber,
1157
+ ZodBigInt: parseBigInt,
1158
+ ZodBoolean: parseBoolean,
1159
+ ZodDate: parseDate,
1160
+ ZodNull: parseNull,
1161
+ ZodOptional: parseOptional,
1162
+ ZodNullable: parseNullable,
1163
+ ZodDefault: parseDefault,
1164
+ ZodArray: parseArray,
1165
+ ZodLiteral: parseLiteral,
1166
+ ZodEnum: parseEnum,
1167
+ ZodNativeEnum: parseEnum,
1168
+ ZodTransformer: parseTransformation,
1169
+ ZodEffects: parseTransformation,
1170
+ ZodIntersection: parseIntersection,
1171
+ ZodUnion: parseUnion,
1172
+ ZodDiscriminatedUnion: parseDiscriminatedUnion,
1173
+ ZodNever: parseNever,
1174
+ ZodBranded: parseBranded,
1175
+ // TODO Transform the rest to schemas
1176
+ ZodUndefined: catchAllParser,
1177
+ // TODO: `prefixItems` is allowed in OpenAPI 3.1 which can be used to create tuples
1178
+ ZodTuple: catchAllParser,
1179
+ ZodMap: catchAllParser,
1180
+ ZodFunction: catchAllParser,
1181
+ ZodLazy: catchAllParser,
1182
+ ZodPromise: catchAllParser,
1183
+ ZodAny: catchAllParser,
1184
+ ZodUnknown: catchAllParser,
1185
+ ZodVoid: catchAllParser,
1186
+ ZodPipeline: parsePipeline,
1187
+ ZodReadonly: parseReadonly
1188
+ };
1189
+ function generateSchema(zodRef, useOutput = false, openApiVersion = "3.1") {
1190
+ const { metaOpenApi = {} } = zodRef;
1191
+ const schemas = [
1192
+ ...Array.isArray(metaOpenApi) ? metaOpenApi : [metaOpenApi]
1193
+ ];
1194
+ try {
1195
+ const typeName = zodRef._def.typeName;
1196
+ if (typeName in workerMap) {
1197
+ return workerMap[typeName]({
1198
+ zodRef,
1199
+ schemas,
1200
+ useOutput,
1201
+ openApiVersion
1202
+ });
1203
+ }
1204
+ return catchAllParser({ zodRef, schemas, openApiVersion });
1205
+ } catch (err) {
1206
+ console.error(err);
1207
+ return catchAllParser({ zodRef, schemas, openApiVersion });
1208
+ }
1209
+ }
1210
+ function extendZodWithOpenApi(zod, forceOverride = false) {
1211
+ if (!forceOverride && typeof zod.ZodSchema.prototype.openapi !== "undefined") {
1212
+ return;
1213
+ }
1214
+ zod.ZodSchema.prototype.openapi = function(metadata) {
1215
+ return extendApi(this, metadata);
1216
+ };
1217
+ }
1218
+ extendZodWithOpenApi(z2);
1040
1219
  var ZodSchemaValidator = class {
1041
1220
  _Type = "Zod";
1042
1221
  _SchemaCatchall;
1043
1222
  _ValidSchemaObject;
1044
- string = z.string().openapi({
1223
+ string = z2.string().openapi({
1045
1224
  title: "String",
1046
1225
  example: "a string"
1047
1226
  });
1048
- uuid = z.string().uuid().openapi({
1227
+ uuid = z2.string().uuid().openapi({
1049
1228
  title: "UUID",
1050
1229
  format: "uuid",
1051
1230
  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}$",
1052
1231
  example: "a8b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6"
1053
1232
  });
1054
- email = z.string().email().openapi({
1233
+ email = z2.string().email().openapi({
1055
1234
  title: "Email",
1056
1235
  format: "email",
1057
1236
  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])+)])`,
1058
1237
  example: "a@b.com"
1059
1238
  });
1060
- uri = z.string().url().openapi({
1239
+ uri = z2.string().url().openapi({
1061
1240
  title: "URI",
1062
1241
  format: "uri",
1063
1242
  pattern: "^[a-zA-Z][a-zA-Z\\d+-.]*:[^\\s]*$",
1064
1243
  example: "https://forklaunch.com"
1065
1244
  });
1066
- number = z.preprocess((value) => {
1245
+ number = z2.preprocess((value) => {
1067
1246
  try {
1068
1247
  return Number(value);
1069
1248
  } catch {
1070
1249
  return value;
1071
1250
  }
1072
- }, z.number()).openapi({
1251
+ }, z2.number()).openapi({
1073
1252
  title: "Number",
1074
1253
  example: 123
1075
1254
  });
1076
- bigint = z.preprocess((value) => {
1255
+ bigint = z2.preprocess((value) => {
1077
1256
  try {
1078
1257
  if (value instanceof Date) {
1079
1258
  return BigInt(value.getTime());
@@ -1090,23 +1269,23 @@ var ZodSchemaValidator = class {
1090
1269
  } catch {
1091
1270
  return value;
1092
1271
  }
1093
- }, z.bigint()).openapi({
1272
+ }, z2.bigint()).openapi({
1094
1273
  title: "BigInt",
1095
1274
  type: "integer",
1096
1275
  format: "int64",
1097
1276
  example: 123n
1098
1277
  });
1099
- boolean = z.preprocess((val) => {
1278
+ boolean = z2.preprocess((val) => {
1100
1279
  if (typeof val === "string") {
1101
1280
  if (val.toLowerCase() === "true") return true;
1102
1281
  if (val.toLowerCase() === "false") return false;
1103
1282
  }
1104
1283
  return val;
1105
- }, z.boolean()).openapi({
1284
+ }, z2.boolean()).openapi({
1106
1285
  title: "Boolean",
1107
1286
  example: true
1108
1287
  });
1109
- date = z.preprocess((value) => {
1288
+ date = z2.preprocess((value) => {
1110
1289
  try {
1111
1290
  switch (typeof value) {
1112
1291
  case "string":
@@ -1119,58 +1298,58 @@ var ZodSchemaValidator = class {
1119
1298
  } catch {
1120
1299
  return value;
1121
1300
  }
1122
- }, z.date()).openapi({
1301
+ }, z2.date()).openapi({
1123
1302
  title: "Date",
1124
1303
  type: "string",
1125
1304
  format: "date-time",
1126
1305
  example: "2025-05-16T21:13:04.123Z"
1127
1306
  });
1128
- symbol = z.symbol().openapi({
1307
+ symbol = z2.symbol().openapi({
1129
1308
  title: "Symbol",
1130
1309
  example: Symbol("symbol")
1131
1310
  });
1132
- nullish = z.union([z.void(), z.null(), z.undefined()]).openapi({
1311
+ nullish = z2.union([z2.void(), z2.null(), z2.undefined()]).openapi({
1133
1312
  title: "Nullish",
1134
1313
  type: "null",
1135
1314
  example: null
1136
1315
  });
1137
- void = z.void().openapi({
1316
+ void = z2.void().openapi({
1138
1317
  title: "Void",
1139
1318
  type: "null",
1140
1319
  example: void 0
1141
1320
  });
1142
- null = z.null().openapi({
1321
+ null = z2.null().openapi({
1143
1322
  title: "Null",
1144
1323
  type: "null",
1145
1324
  example: null
1146
1325
  });
1147
- undefined = z.undefined().openapi({
1326
+ undefined = z2.undefined().openapi({
1148
1327
  title: "Undefined",
1149
1328
  type: "null",
1150
1329
  example: void 0
1151
1330
  });
1152
- any = z.any().openapi({
1331
+ any = z2.any().openapi({
1153
1332
  title: "Any",
1154
1333
  type: "object",
1155
1334
  example: "any"
1156
1335
  });
1157
- unknown = z.unknown().openapi({
1336
+ unknown = z2.unknown().openapi({
1158
1337
  title: "Unknown",
1159
1338
  type: "object",
1160
1339
  example: "unknown"
1161
1340
  });
1162
- never = z.never().openapi({
1341
+ never = z2.never().openapi({
1163
1342
  title: "Never",
1164
1343
  type: "null",
1165
1344
  example: "never"
1166
1345
  });
1167
- binary = z.string().transform((v) => new TextEncoder().encode(v)).openapi({
1346
+ binary = z2.string().transform((v) => new TextEncoder().encode(v)).openapi({
1168
1347
  title: "Binary",
1169
1348
  type: "string",
1170
1349
  format: "binary",
1171
1350
  example: "a utf-8 encodable string"
1172
1351
  });
1173
- file = z.string().transform((val) => {
1352
+ file = z2.string().transform((val) => {
1174
1353
  return new Blob([val]);
1175
1354
  }).openapi({
1176
1355
  title: "File",
@@ -1195,7 +1374,7 @@ var ZodSchemaValidator = class {
1195
1374
  */
1196
1375
  schemify(schema) {
1197
1376
  if (typeof schema === "string" || typeof schema === "number" || typeof schema === "boolean") {
1198
- return z.literal(schema);
1377
+ return z2.literal(schema);
1199
1378
  }
1200
1379
  if (schema instanceof ZodType) {
1201
1380
  return schema;
@@ -1208,7 +1387,7 @@ var ZodSchemaValidator = class {
1208
1387
  newSchema[key] = this.schemify(schema[key]);
1209
1388
  }
1210
1389
  });
1211
- return z.object(newSchema);
1390
+ return z2.object(newSchema);
1212
1391
  }
1213
1392
  /**
1214
1393
  * Make a schema optional.
@@ -1235,7 +1414,7 @@ var ZodSchemaValidator = class {
1235
1414
  */
1236
1415
  union(schemas) {
1237
1416
  const resolvedSchemas = schemas.map((schema) => this.schemify(schema));
1238
- return z.union(
1417
+ return z2.union(
1239
1418
  resolvedSchemas
1240
1419
  );
1241
1420
  }
@@ -1245,7 +1424,7 @@ var ZodSchemaValidator = class {
1245
1424
  * @returns {ZodLiteral<ZodResolve<T>>} The literal schema.
1246
1425
  */
1247
1426
  literal(value) {
1248
- return z.literal(value);
1427
+ return z2.literal(value);
1249
1428
  }
1250
1429
  /**
1251
1430
  * Create an enum schema.
@@ -1266,7 +1445,7 @@ var ZodSchemaValidator = class {
1266
1445
  function_(args, returnType) {
1267
1446
  const schemaArgs = args.map((schema) => this.schemify(schema));
1268
1447
  const schemaReturnType = this.schemify(returnType);
1269
- return z.function(z.tuple(schemaArgs), schemaReturnType);
1448
+ return z2.function(z2.tuple(schemaArgs), schemaReturnType);
1270
1449
  }
1271
1450
  /**
1272
1451
  * Create a record schema.
@@ -1277,7 +1456,7 @@ var ZodSchemaValidator = class {
1277
1456
  record(key, value) {
1278
1457
  const keySchema = this.schemify(key);
1279
1458
  const valueSchema = this.schemify(value);
1280
- return z.record(keySchema, valueSchema);
1459
+ return z2.record(keySchema, valueSchema);
1281
1460
  }
1282
1461
  /**
1283
1462
  * Create a promise schema.
@@ -1285,7 +1464,7 @@ var ZodSchemaValidator = class {
1285
1464
  * @returns {ZodPromise<ZodResolve<T>>} The promise schema.
1286
1465
  */
1287
1466
  promise(schema) {
1288
- return z.promise(this.schemify(schema));
1467
+ return z2.promise(this.schemify(schema));
1289
1468
  }
1290
1469
  /**
1291
1470
  * Checks if a value is a Zod schema.
@@ -1356,7 +1535,7 @@ var ZodSchemaValidator = class {
1356
1535
  * @returns {SchemaObject} The OpenAPI schema object.
1357
1536
  */
1358
1537
  openapi(schema) {
1359
- return (0, import_zod_openapi.generateSchema)(this.schemify(schema));
1538
+ return generateSchema(this.schemify(schema));
1360
1539
  }
1361
1540
  };
1362
1541
  var SchemaValidator2 = () => new ZodSchemaValidator();