@forklaunch/implementation-worker-bullmq 0.3.1 → 0.3.3

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.
@@ -0,0 +1,1717 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) =>
8
+ typeof require !== 'undefined'
9
+ ? require
10
+ : typeof Proxy !== 'undefined'
11
+ ? new Proxy(x, {
12
+ get: (a, b) => (typeof require !== 'undefined' ? require : a)[b]
13
+ })
14
+ : x)(function (x) {
15
+ if (typeof require !== 'undefined') return require.apply(this, arguments);
16
+ throw Error('Dynamic require of "' + x + '" is not supported');
17
+ });
18
+ var __commonJS = (cb, mod) =>
19
+ function __require2() {
20
+ return (
21
+ mod ||
22
+ (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod),
23
+ mod.exports
24
+ );
25
+ };
26
+ var __copyProps = (to, from, except, desc) => {
27
+ if ((from && typeof from === 'object') || typeof from === 'function') {
28
+ for (let key of __getOwnPropNames(from))
29
+ if (!__hasOwnProp.call(to, key) && key !== except)
30
+ __defProp(to, key, {
31
+ get: () => from[key],
32
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
33
+ });
34
+ }
35
+ return to;
36
+ };
37
+ var __toESM = (mod, isNodeMode, target) => (
38
+ (target = mod != null ? __create(__getProtoOf(mod)) : {}),
39
+ __copyProps(
40
+ // If the importer is in node compatibility mode or this is not an ESM
41
+ // file that has been converted to a CommonJS file using a Babel-
42
+ // compatible transform (i.e. "__esModule" has not been set), then set
43
+ // "default" to the CommonJS "module.exports" for node compatibility.
44
+ isNodeMode || !mod || !mod.__esModule
45
+ ? __defProp(target, 'default', { value: mod, enumerable: true })
46
+ : target,
47
+ mod
48
+ )
49
+ );
50
+
51
+ // ../../../node_modules/.pnpm/ts-deepmerge@6.2.1/node_modules/ts-deepmerge/cjs/index.js
52
+ var require_cjs = __commonJS({
53
+ '../../../node_modules/.pnpm/ts-deepmerge@6.2.1/node_modules/ts-deepmerge/cjs/index.js'(
54
+ exports
55
+ ) {
56
+ 'use strict';
57
+ Object.defineProperty(exports, '__esModule', { value: true });
58
+ var isObject = (obj) => {
59
+ if (typeof obj === 'object' && obj !== null) {
60
+ if (typeof Object.getPrototypeOf === 'function') {
61
+ const prototype = Object.getPrototypeOf(obj);
62
+ return prototype === Object.prototype || prototype === null;
63
+ }
64
+ return Object.prototype.toString.call(obj) === '[object Object]';
65
+ }
66
+ return false;
67
+ };
68
+ var merge = (...objects) =>
69
+ objects.reduce((result, current) => {
70
+ if (Array.isArray(current)) {
71
+ throw new TypeError(
72
+ 'Arguments provided to ts-deepmerge must be objects, not arrays.'
73
+ );
74
+ }
75
+ Object.keys(current).forEach((key) => {
76
+ if (['__proto__', 'constructor', 'prototype'].includes(key)) {
77
+ return;
78
+ }
79
+ if (Array.isArray(result[key]) && Array.isArray(current[key])) {
80
+ result[key] = merge.options.mergeArrays
81
+ ? merge.options.uniqueArrayItems
82
+ ? Array.from(new Set(result[key].concat(current[key])))
83
+ : [...result[key], ...current[key]]
84
+ : current[key];
85
+ } else if (isObject(result[key]) && isObject(current[key])) {
86
+ result[key] = merge(result[key], current[key]);
87
+ } else {
88
+ result[key] =
89
+ current[key] === void 0
90
+ ? merge.options.allowUndefinedOverrides
91
+ ? current[key]
92
+ : result[key]
93
+ : current[key];
94
+ }
95
+ });
96
+ return result;
97
+ }, {});
98
+ var defaultOptions = {
99
+ allowUndefinedOverrides: true,
100
+ mergeArrays: true,
101
+ uniqueArrayItems: true
102
+ };
103
+ merge.options = defaultOptions;
104
+ merge.withOptions = (options, ...objects) => {
105
+ merge.options = Object.assign(Object.assign({}, defaultOptions), options);
106
+ const result = merge(...objects);
107
+ merge.options = defaultOptions;
108
+ return result;
109
+ };
110
+ exports.default = merge;
111
+ }
112
+ });
113
+
114
+ // ../../../node_modules/.pnpm/@anatine+zod-openapi@2.2.8_openapi3-ts@4.4.0_zod@3.25.67/node_modules/@anatine/zod-openapi/src/lib/zod-openapi.js
115
+ var require_zod_openapi = __commonJS({
116
+ '../../../node_modules/.pnpm/@anatine+zod-openapi@2.2.8_openapi3-ts@4.4.0_zod@3.25.67/node_modules/@anatine/zod-openapi/src/lib/zod-openapi.js'(
117
+ exports
118
+ ) {
119
+ 'use strict';
120
+ Object.defineProperty(exports, '__esModule', { value: true });
121
+ exports.generateSchema = exports.extendApi = void 0;
122
+ var ts_deepmerge_1 = require_cjs();
123
+ var zod_1 = __require('zod');
124
+ function extendApi(schema, schemaObject = {}) {
125
+ const This = schema.constructor;
126
+ const newSchema = new This(schema._def);
127
+ newSchema.metaOpenApi = Object.assign(
128
+ {},
129
+ schema.metaOpenApi || {},
130
+ schemaObject
131
+ );
132
+ return newSchema;
133
+ }
134
+ exports.extendApi = extendApi;
135
+ function iterateZodObject({
136
+ zodRef,
137
+ useOutput,
138
+ hideDefinitions,
139
+ openApiVersion
140
+ }) {
141
+ const reduced = Object.keys(zodRef.shape)
142
+ .filter(
143
+ (key) =>
144
+ (hideDefinitions === null || hideDefinitions === void 0
145
+ ? void 0
146
+ : hideDefinitions.includes(key)) === false
147
+ )
148
+ .reduce(
149
+ (carry, key) =>
150
+ Object.assign(Object.assign({}, carry), {
151
+ [key]: generateSchema2(
152
+ zodRef.shape[key],
153
+ useOutput,
154
+ openApiVersion
155
+ )
156
+ }),
157
+ {}
158
+ );
159
+ return reduced;
160
+ }
161
+ function typeFormat(type3, openApiVersion) {
162
+ return openApiVersion === '3.0' ? type3 : [type3];
163
+ }
164
+ function parseTransformation({
165
+ zodRef,
166
+ schemas,
167
+ useOutput,
168
+ openApiVersion
169
+ }) {
170
+ const input = generateSchema2(
171
+ zodRef._def.schema,
172
+ useOutput,
173
+ openApiVersion
174
+ );
175
+ let output = 'undefined';
176
+ if (useOutput && zodRef._def.effect) {
177
+ const effect =
178
+ zodRef._def.effect.type === 'transform' ? zodRef._def.effect : null;
179
+ if (effect && 'transform' in effect) {
180
+ try {
181
+ const type3 = Array.isArray(input.type)
182
+ ? input.type[0]
183
+ : input.type;
184
+ output = typeof effect.transform(
185
+ ['integer', 'number'].includes(`${type3}`)
186
+ ? 0
187
+ : 'string' === type3
188
+ ? ''
189
+ : 'boolean' === type3
190
+ ? false
191
+ : 'object' === type3
192
+ ? {}
193
+ : 'null' === type3
194
+ ? null
195
+ : 'array' === type3
196
+ ? []
197
+ : void 0,
198
+ { addIssue: () => void 0, path: [] }
199
+ // TODO: Discover if context is necessary here
200
+ );
201
+ } catch (e) {}
202
+ }
203
+ }
204
+ const outputType = output;
205
+ return (0, ts_deepmerge_1.default)(
206
+ Object.assign(
207
+ Object.assign(
208
+ Object.assign(
209
+ {},
210
+ zodRef.description ? { description: zodRef.description } : {}
211
+ ),
212
+ input
213
+ ),
214
+ ['number', 'string', 'boolean', 'null'].includes(output)
215
+ ? {
216
+ type: typeFormat(outputType, openApiVersion)
217
+ }
218
+ : {}
219
+ ),
220
+ ...schemas
221
+ );
222
+ }
223
+ function parseString({ zodRef, schemas, openApiVersion }) {
224
+ const baseSchema = {
225
+ type: typeFormat('string', openApiVersion)
226
+ };
227
+ const { checks = [] } = zodRef._def;
228
+ checks.forEach((item) => {
229
+ switch (item.kind) {
230
+ case 'email':
231
+ baseSchema.format = 'email';
232
+ break;
233
+ case 'uuid':
234
+ baseSchema.format = 'uuid';
235
+ break;
236
+ case 'cuid':
237
+ baseSchema.format = 'cuid';
238
+ break;
239
+ case 'url':
240
+ baseSchema.format = 'uri';
241
+ break;
242
+ case 'datetime':
243
+ baseSchema.format = 'date-time';
244
+ break;
245
+ case 'length':
246
+ baseSchema.minLength = item.value;
247
+ baseSchema.maxLength = item.value;
248
+ break;
249
+ case 'max':
250
+ baseSchema.maxLength = item.value;
251
+ break;
252
+ case 'min':
253
+ baseSchema.minLength = item.value;
254
+ break;
255
+ case 'regex':
256
+ baseSchema.pattern = item.regex.source;
257
+ break;
258
+ }
259
+ });
260
+ return (0, ts_deepmerge_1.default)(
261
+ baseSchema,
262
+ zodRef.description ? { description: zodRef.description } : {},
263
+ ...schemas
264
+ );
265
+ }
266
+ function parseNumber({ zodRef, schemas, openApiVersion }) {
267
+ const baseSchema = {
268
+ type: typeFormat('number', openApiVersion)
269
+ };
270
+ const { checks = [] } = zodRef._def;
271
+ checks.forEach((item) => {
272
+ switch (item.kind) {
273
+ case 'max':
274
+ if (item.inclusive || openApiVersion === '3.0') {
275
+ baseSchema.maximum = item.value;
276
+ }
277
+ if (!item.inclusive) {
278
+ if (openApiVersion === '3.0') {
279
+ baseSchema.exclusiveMaximum = true;
280
+ } else {
281
+ baseSchema.exclusiveMaximum = item.value;
282
+ }
283
+ }
284
+ break;
285
+ case 'min':
286
+ if (item.inclusive || openApiVersion === '3.0') {
287
+ baseSchema.minimum = item.value;
288
+ }
289
+ if (!item.inclusive) {
290
+ if (openApiVersion === '3.0') {
291
+ baseSchema.exclusiveMinimum = true;
292
+ } else {
293
+ baseSchema.exclusiveMinimum = item.value;
294
+ }
295
+ }
296
+ break;
297
+ case 'int':
298
+ baseSchema.type = typeFormat('integer', openApiVersion);
299
+ break;
300
+ case 'multipleOf':
301
+ baseSchema.multipleOf = item.value;
302
+ break;
303
+ }
304
+ });
305
+ return (0, ts_deepmerge_1.default)(
306
+ baseSchema,
307
+ zodRef.description ? { description: zodRef.description } : {},
308
+ ...schemas
309
+ );
310
+ }
311
+ function getExcludedDefinitionsFromSchema(schemas) {
312
+ const excludedDefinitions = [];
313
+ for (const schema of schemas) {
314
+ if (Array.isArray(schema.hideDefinitions)) {
315
+ excludedDefinitions.push(...schema.hideDefinitions);
316
+ }
317
+ }
318
+ return excludedDefinitions;
319
+ }
320
+ function parseObject({
321
+ zodRef,
322
+ schemas,
323
+ useOutput,
324
+ hideDefinitions,
325
+ openApiVersion
326
+ }) {
327
+ var _a;
328
+ let additionalProperties;
329
+ if (
330
+ !(
331
+ zodRef._def.catchall instanceof zod_1.z.ZodNever ||
332
+ ((_a = zodRef._def.catchall) === null || _a === void 0
333
+ ? void 0
334
+ : _a._def.typeName) === 'ZodNever'
335
+ )
336
+ )
337
+ additionalProperties = generateSchema2(
338
+ zodRef._def.catchall,
339
+ useOutput,
340
+ openApiVersion
341
+ );
342
+ else if (zodRef._def.unknownKeys === 'passthrough')
343
+ additionalProperties = true;
344
+ else if (zodRef._def.unknownKeys === 'strict')
345
+ additionalProperties = false;
346
+ additionalProperties =
347
+ additionalProperties != null ? { additionalProperties } : {};
348
+ const requiredProperties = Object.keys(zodRef.shape).filter((key) => {
349
+ const item = zodRef.shape[key];
350
+ return (
351
+ !(
352
+ item.isOptional() ||
353
+ item instanceof zod_1.z.ZodDefault ||
354
+ item._def.typeName === 'ZodDefault'
355
+ ) &&
356
+ !(
357
+ item instanceof zod_1.z.ZodNever ||
358
+ item._def.typeName === 'ZodDefault'
359
+ )
360
+ );
361
+ });
362
+ const required =
363
+ requiredProperties.length > 0 ? { required: requiredProperties } : {};
364
+ return (0, ts_deepmerge_1.default)(
365
+ Object.assign(
366
+ Object.assign(
367
+ Object.assign(
368
+ {
369
+ type: typeFormat('object', openApiVersion),
370
+ properties: iterateZodObject({
371
+ zodRef,
372
+ schemas,
373
+ useOutput,
374
+ hideDefinitions: getExcludedDefinitionsFromSchema(schemas),
375
+ openApiVersion
376
+ })
377
+ },
378
+ required
379
+ ),
380
+ additionalProperties
381
+ ),
382
+ hideDefinitions
383
+ ),
384
+ zodRef.description
385
+ ? { description: zodRef.description, hideDefinitions }
386
+ : {},
387
+ ...schemas
388
+ );
389
+ }
390
+ function parseRecord({ zodRef, schemas, useOutput, openApiVersion }) {
391
+ return (0, ts_deepmerge_1.default)(
392
+ {
393
+ type: typeFormat('object', openApiVersion),
394
+ additionalProperties:
395
+ zodRef._def.valueType instanceof zod_1.z.ZodUnknown
396
+ ? {}
397
+ : generateSchema2(
398
+ zodRef._def.valueType,
399
+ useOutput,
400
+ openApiVersion
401
+ )
402
+ },
403
+ zodRef.description ? { description: zodRef.description } : {},
404
+ ...schemas
405
+ );
406
+ }
407
+ function parseBigInt({ zodRef, schemas, openApiVersion }) {
408
+ return (0, ts_deepmerge_1.default)(
409
+ {
410
+ type: typeFormat('integer', openApiVersion),
411
+ format: 'int64'
412
+ },
413
+ zodRef.description ? { description: zodRef.description } : {},
414
+ ...schemas
415
+ );
416
+ }
417
+ function parseBoolean({ zodRef, schemas, openApiVersion }) {
418
+ return (0, ts_deepmerge_1.default)(
419
+ { type: typeFormat('boolean', openApiVersion) },
420
+ zodRef.description ? { description: zodRef.description } : {},
421
+ ...schemas
422
+ );
423
+ }
424
+ function parseDate({ zodRef, schemas, openApiVersion }) {
425
+ return (0, ts_deepmerge_1.default)(
426
+ {
427
+ type: typeFormat('string', openApiVersion),
428
+ format: 'date-time'
429
+ },
430
+ zodRef.description ? { description: zodRef.description } : {},
431
+ ...schemas
432
+ );
433
+ }
434
+ function parseNull({ zodRef, schemas, openApiVersion }) {
435
+ return (0, ts_deepmerge_1.default)(
436
+ openApiVersion === '3.0'
437
+ ? { type: 'null' }
438
+ : {
439
+ type: ['string', 'null'],
440
+ enum: ['null']
441
+ },
442
+ zodRef.description ? { description: zodRef.description } : {},
443
+ ...schemas
444
+ );
445
+ }
446
+ function parseOptional({ schemas, zodRef, useOutput, openApiVersion }) {
447
+ return (0, ts_deepmerge_1.default)(
448
+ generateSchema2(zodRef.unwrap(), useOutput, openApiVersion),
449
+ zodRef.description ? { description: zodRef.description } : {},
450
+ ...schemas
451
+ );
452
+ }
453
+ function parseNullable({ schemas, zodRef, useOutput, openApiVersion }) {
454
+ const schema = generateSchema2(
455
+ zodRef.unwrap(),
456
+ useOutput,
457
+ openApiVersion
458
+ );
459
+ return (0, ts_deepmerge_1.default)(
460
+ schema,
461
+ openApiVersion === '3.0'
462
+ ? { nullable: true }
463
+ : { type: typeFormat('null', openApiVersion) },
464
+ zodRef.description ? { description: zodRef.description } : {},
465
+ ...schemas
466
+ );
467
+ }
468
+ function parseDefault({ schemas, zodRef, useOutput, openApiVersion }) {
469
+ return (0, ts_deepmerge_1.default)(
470
+ Object.assign(
471
+ { default: zodRef._def.defaultValue() },
472
+ generateSchema2(zodRef._def.innerType, useOutput, openApiVersion)
473
+ ),
474
+ zodRef.description ? { description: zodRef.description } : {},
475
+ ...schemas
476
+ );
477
+ }
478
+ function parseArray({ schemas, zodRef, useOutput, openApiVersion }) {
479
+ const constraints = {};
480
+ if (zodRef._def.exactLength != null) {
481
+ constraints.minItems = zodRef._def.exactLength.value;
482
+ constraints.maxItems = zodRef._def.exactLength.value;
483
+ }
484
+ if (zodRef._def.minLength != null)
485
+ constraints.minItems = zodRef._def.minLength.value;
486
+ if (zodRef._def.maxLength != null)
487
+ constraints.maxItems = zodRef._def.maxLength.value;
488
+ return (0, ts_deepmerge_1.default)(
489
+ Object.assign(
490
+ {
491
+ type: typeFormat('array', openApiVersion),
492
+ items: generateSchema2(zodRef.element, useOutput, openApiVersion)
493
+ },
494
+ constraints
495
+ ),
496
+ zodRef.description ? { description: zodRef.description } : {},
497
+ ...schemas
498
+ );
499
+ }
500
+ function parseLiteral({ schemas, zodRef, openApiVersion }) {
501
+ const type3 = typeof zodRef._def.value;
502
+ return (0, ts_deepmerge_1.default)(
503
+ {
504
+ type: typeFormat(type3, openApiVersion),
505
+ enum: [zodRef._def.value]
506
+ },
507
+ zodRef.description ? { description: zodRef.description } : {},
508
+ ...schemas
509
+ );
510
+ }
511
+ function parseEnum({ schemas, zodRef, openApiVersion }) {
512
+ const type3 = typeof Object.values(zodRef._def.values)[0];
513
+ return (0, ts_deepmerge_1.default)(
514
+ {
515
+ type: typeFormat(type3, openApiVersion),
516
+ enum: Object.values(zodRef._def.values)
517
+ },
518
+ zodRef.description ? { description: zodRef.description } : {},
519
+ ...schemas
520
+ );
521
+ }
522
+ function parseIntersection({ schemas, zodRef, useOutput, openApiVersion }) {
523
+ return (0, ts_deepmerge_1.default)(
524
+ {
525
+ allOf: [
526
+ generateSchema2(zodRef._def.left, useOutput, openApiVersion),
527
+ generateSchema2(zodRef._def.right, useOutput, openApiVersion)
528
+ ]
529
+ },
530
+ zodRef.description ? { description: zodRef.description } : {},
531
+ ...schemas
532
+ );
533
+ }
534
+ function parseUnion({ schemas, zodRef, useOutput, openApiVersion }) {
535
+ const contents = zodRef._def.options;
536
+ if (
537
+ contents.reduce(
538
+ (prev, content) => prev && content._def.typeName === 'ZodLiteral',
539
+ true
540
+ )
541
+ ) {
542
+ const literals = contents;
543
+ const type3 = literals.reduce(
544
+ (prev, content) =>
545
+ !prev || prev === typeof content._def.value
546
+ ? typeof content._def.value
547
+ : null,
548
+ null
549
+ );
550
+ if (type3) {
551
+ return (0, ts_deepmerge_1.default)(
552
+ {
553
+ type: typeFormat(type3, openApiVersion),
554
+ enum: literals.map((literal3) => literal3._def.value)
555
+ },
556
+ zodRef.description ? { description: zodRef.description } : {},
557
+ ...schemas
558
+ );
559
+ }
560
+ }
561
+ const oneOfContents =
562
+ openApiVersion === '3.0'
563
+ ? contents.filter((content) => content._def.typeName !== 'ZodNull')
564
+ : contents;
565
+ const contentsHasNull = contents.length != oneOfContents.length;
566
+ return (0, ts_deepmerge_1.default)(
567
+ {
568
+ oneOf: oneOfContents.map((schema) =>
569
+ generateSchema2(schema, useOutput, openApiVersion)
570
+ )
571
+ },
572
+ contentsHasNull ? { nullable: true } : {},
573
+ zodRef.description ? { description: zodRef.description } : {},
574
+ ...schemas
575
+ );
576
+ }
577
+ function parseDiscriminatedUnion({
578
+ schemas,
579
+ zodRef,
580
+ useOutput,
581
+ openApiVersion
582
+ }) {
583
+ return (0, ts_deepmerge_1.default)(
584
+ {
585
+ discriminator: {
586
+ propertyName: zodRef._def.discriminator
587
+ },
588
+ oneOf: Array.from(zodRef._def.options.values()).map((schema) =>
589
+ generateSchema2(schema, useOutput, openApiVersion)
590
+ )
591
+ },
592
+ zodRef.description ? { description: zodRef.description } : {},
593
+ ...schemas
594
+ );
595
+ }
596
+ function parseNever({ zodRef, schemas }) {
597
+ return (0, ts_deepmerge_1.default)(
598
+ { readOnly: true },
599
+ zodRef.description ? { description: zodRef.description } : {},
600
+ ...schemas
601
+ );
602
+ }
603
+ function parseBranded({ schemas, zodRef, useOutput, openApiVersion }) {
604
+ return (0, ts_deepmerge_1.default)(
605
+ generateSchema2(zodRef._def.type, useOutput, openApiVersion),
606
+ ...schemas
607
+ );
608
+ }
609
+ function catchAllParser({ zodRef, schemas }) {
610
+ return (0, ts_deepmerge_1.default)(
611
+ zodRef.description ? { description: zodRef.description } : {},
612
+ ...schemas
613
+ );
614
+ }
615
+ function parsePipeline({ schemas, zodRef, useOutput, openApiVersion }) {
616
+ return (0, ts_deepmerge_1.default)(
617
+ generateSchema2(
618
+ useOutput ? zodRef._def.out : zodRef._def.in,
619
+ useOutput,
620
+ openApiVersion
621
+ ),
622
+ ...schemas
623
+ );
624
+ }
625
+ function parseReadonly({ zodRef, useOutput, schemas, openApiVersion }) {
626
+ return (0, ts_deepmerge_1.default)(
627
+ generateSchema2(zodRef._def.innerType, useOutput, openApiVersion),
628
+ zodRef.description ? { description: zodRef.description } : {},
629
+ ...schemas
630
+ );
631
+ }
632
+ var workerMap = {
633
+ ZodObject: parseObject,
634
+ ZodRecord: parseRecord,
635
+ ZodString: parseString,
636
+ ZodNumber: parseNumber,
637
+ ZodBigInt: parseBigInt,
638
+ ZodBoolean: parseBoolean,
639
+ ZodDate: parseDate,
640
+ ZodNull: parseNull,
641
+ ZodOptional: parseOptional,
642
+ ZodNullable: parseNullable,
643
+ ZodDefault: parseDefault,
644
+ ZodArray: parseArray,
645
+ ZodLiteral: parseLiteral,
646
+ ZodEnum: parseEnum,
647
+ ZodNativeEnum: parseEnum,
648
+ ZodTransformer: parseTransformation,
649
+ ZodEffects: parseTransformation,
650
+ ZodIntersection: parseIntersection,
651
+ ZodUnion: parseUnion,
652
+ ZodDiscriminatedUnion: parseDiscriminatedUnion,
653
+ ZodNever: parseNever,
654
+ ZodBranded: parseBranded,
655
+ // TODO Transform the rest to schemas
656
+ ZodUndefined: catchAllParser,
657
+ // TODO: `prefixItems` is allowed in OpenAPI 3.1 which can be used to create tuples
658
+ ZodTuple: catchAllParser,
659
+ ZodMap: catchAllParser,
660
+ ZodFunction: catchAllParser,
661
+ ZodLazy: catchAllParser,
662
+ ZodPromise: catchAllParser,
663
+ ZodAny: catchAllParser,
664
+ ZodUnknown: catchAllParser,
665
+ ZodVoid: catchAllParser,
666
+ ZodPipeline: parsePipeline,
667
+ ZodReadonly: parseReadonly
668
+ };
669
+ function generateSchema2(
670
+ zodRef,
671
+ useOutput = false,
672
+ openApiVersion = '3.1'
673
+ ) {
674
+ const { metaOpenApi = {} } = zodRef;
675
+ const schemas = [
676
+ ...(Array.isArray(metaOpenApi) ? metaOpenApi : [metaOpenApi])
677
+ ];
678
+ try {
679
+ const typeName = zodRef._def.typeName;
680
+ if (typeName in workerMap) {
681
+ return workerMap[typeName]({
682
+ zodRef,
683
+ schemas,
684
+ useOutput,
685
+ openApiVersion
686
+ });
687
+ }
688
+ return catchAllParser({ zodRef, schemas, openApiVersion });
689
+ } catch (err) {
690
+ console.error(err);
691
+ return catchAllParser({ zodRef, schemas, openApiVersion });
692
+ }
693
+ }
694
+ exports.generateSchema = generateSchema2;
695
+ }
696
+ });
697
+
698
+ // ../../../node_modules/.pnpm/@anatine+zod-openapi@2.2.8_openapi3-ts@4.4.0_zod@3.25.67/node_modules/@anatine/zod-openapi/src/lib/zod-extensions.js
699
+ var require_zod_extensions = __commonJS({
700
+ '../../../node_modules/.pnpm/@anatine+zod-openapi@2.2.8_openapi3-ts@4.4.0_zod@3.25.67/node_modules/@anatine/zod-openapi/src/lib/zod-extensions.js'(
701
+ exports
702
+ ) {
703
+ 'use strict';
704
+ Object.defineProperty(exports, '__esModule', { value: true });
705
+ exports.extendZodWithOpenApi = void 0;
706
+ var zod_openapi_1 = require_zod_openapi();
707
+ function extendZodWithOpenApi2(zod, forceOverride = false) {
708
+ if (
709
+ !forceOverride &&
710
+ typeof zod.ZodSchema.prototype.openapi !== 'undefined'
711
+ ) {
712
+ return;
713
+ }
714
+ zod.ZodSchema.prototype.openapi = function (metadata) {
715
+ return (0, zod_openapi_1.extendApi)(this, metadata);
716
+ };
717
+ }
718
+ exports.extendZodWithOpenApi = extendZodWithOpenApi2;
719
+ }
720
+ });
721
+
722
+ // ../../../node_modules/.pnpm/@anatine+zod-openapi@2.2.8_openapi3-ts@4.4.0_zod@3.25.67/node_modules/@anatine/zod-openapi/src/index.js
723
+ var require_src = __commonJS({
724
+ '../../../node_modules/.pnpm/@anatine+zod-openapi@2.2.8_openapi3-ts@4.4.0_zod@3.25.67/node_modules/@anatine/zod-openapi/src/index.js'(
725
+ exports
726
+ ) {
727
+ 'use strict';
728
+ var __createBinding =
729
+ (exports && exports.__createBinding) ||
730
+ (Object.create
731
+ ? function (o, m, k, k2) {
732
+ if (k2 === void 0) k2 = k;
733
+ var desc = Object.getOwnPropertyDescriptor(m, k);
734
+ if (
735
+ !desc ||
736
+ ('get' in desc
737
+ ? !m.__esModule
738
+ : desc.writable || desc.configurable)
739
+ ) {
740
+ desc = {
741
+ enumerable: true,
742
+ get: function () {
743
+ return m[k];
744
+ }
745
+ };
746
+ }
747
+ Object.defineProperty(o, k2, desc);
748
+ }
749
+ : function (o, m, k, k2) {
750
+ if (k2 === void 0) k2 = k;
751
+ o[k2] = m[k];
752
+ });
753
+ var __exportStar =
754
+ (exports && exports.__exportStar) ||
755
+ function (m, exports2) {
756
+ for (var p in m)
757
+ if (
758
+ p !== 'default' &&
759
+ !Object.prototype.hasOwnProperty.call(exports2, p)
760
+ )
761
+ __createBinding(exports2, m, p);
762
+ };
763
+ Object.defineProperty(exports, '__esModule', { value: true });
764
+ __exportStar(require_zod_openapi(), exports);
765
+ __exportStar(require_zod_extensions(), exports);
766
+ }
767
+ });
768
+
769
+ // domain/schemas/bullMqWorker.schema.ts
770
+ import { serviceSchemaResolver } from '@forklaunch/internal';
771
+
772
+ // ../../../node_modules/.pnpm/@forklaunch+common@0.3.14/node_modules/@forklaunch/common/lib/index.mjs
773
+ var InMemoryFile = class extends File {
774
+ constructor(content, name, { type: type3, endings, lastModified }) {
775
+ super([Buffer.from(content)], name, {
776
+ type: type3,
777
+ endings,
778
+ lastModified
779
+ });
780
+ this.content = content;
781
+ }
782
+ };
783
+
784
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.6.16_openapi3-ts@4.4.0/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
785
+ import { FormatRegistry, Kind, KindGuard, Type } from '@sinclair/typebox';
786
+ import { TypeCheck, TypeCompiler } from '@sinclair/typebox/compiler';
787
+ import {
788
+ DefaultErrorFunction,
789
+ SetErrorFunction,
790
+ ValueErrorType
791
+ } from '@sinclair/typebox/errors';
792
+ import { Value } from '@sinclair/typebox/value';
793
+ FormatRegistry.Set('binary', (value) => typeof value === 'string');
794
+ SetErrorFunction((params) => {
795
+ switch (params.errorType) {
796
+ case ValueErrorType.Union:
797
+ case ValueErrorType.Array:
798
+ case ValueErrorType.String:
799
+ case ValueErrorType.Number:
800
+ return params.schema.errorType
801
+ ? `Expected ${params.schema.errorType} value${params.schema.errorSuffix ? 's' : ''}`
802
+ : DefaultErrorFunction(params);
803
+ default:
804
+ return DefaultErrorFunction(params);
805
+ }
806
+ });
807
+ var TypeboxSchemaValidator = class {
808
+ _Type = 'TypeBox';
809
+ _SchemaCatchall;
810
+ _ValidSchemaObject;
811
+ string = Type.String({
812
+ example: 'a string',
813
+ title: 'String'
814
+ });
815
+ uuid = Type.String({
816
+ pattern:
817
+ '^[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}$',
818
+ errorType: 'uuid',
819
+ example: 'a8b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6',
820
+ title: 'UUID'
821
+ });
822
+ email = Type.String({
823
+ 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])+)])`,
824
+ errorType: 'email',
825
+ example: 'a@b.com',
826
+ title: 'Email'
827
+ });
828
+ uri = Type.String({
829
+ pattern: '^[a-zA-Z][a-zA-Z\\d+-.]*:[^\\s]*$',
830
+ errorType: 'uri',
831
+ example: 'https://forklaunch.com',
832
+ title: 'URI'
833
+ });
834
+ number = Type.Transform(
835
+ Type.Union(
836
+ [
837
+ Type.Number(),
838
+ Type.String({ pattern: '^[0-9]+$' }),
839
+ Type.Boolean(),
840
+ Type.Null(),
841
+ Type.BigInt(),
842
+ Type.Date()
843
+ ],
844
+ {
845
+ errorType: 'number-like',
846
+ example: 123,
847
+ title: 'Number'
848
+ }
849
+ )
850
+ )
851
+ .Decode((value) => {
852
+ if (typeof value !== 'number') {
853
+ const num = Number(value);
854
+ if (isNaN(num)) {
855
+ throw new Error('Invalid number');
856
+ } else {
857
+ return num;
858
+ }
859
+ }
860
+ return value;
861
+ })
862
+ .Encode(Number);
863
+ bigint = Type.Transform(
864
+ Type.Union(
865
+ [
866
+ Type.BigInt(),
867
+ Type.Number(),
868
+ Type.String({ pattern: '^[0-9]+n?$' }),
869
+ Type.Boolean(),
870
+ Type.Date()
871
+ ],
872
+ {
873
+ errorType: 'BigInt-like',
874
+ example: 123n,
875
+ title: 'BigInt'
876
+ }
877
+ )
878
+ )
879
+ .Decode((value) => {
880
+ if (typeof value !== 'bigint') {
881
+ try {
882
+ if (value instanceof Date) {
883
+ return BigInt(value.getTime());
884
+ }
885
+ return BigInt(value);
886
+ } catch {
887
+ throw new Error('Invalid bigint');
888
+ }
889
+ }
890
+ return value;
891
+ })
892
+ .Encode(BigInt);
893
+ boolean = Type.Transform(
894
+ Type.Union(
895
+ [
896
+ Type.Boolean(),
897
+ Type.String({
898
+ pattern: '^(t|T)(r|R)(u|U)(e|E)$|^(f|F)(a|A)(l|L)(s|S)(e|E)$'
899
+ })
900
+ ],
901
+ {
902
+ errorType: 'boolean-like',
903
+ example: true,
904
+ title: 'Boolean'
905
+ }
906
+ )
907
+ )
908
+ .Decode((value) => {
909
+ if (typeof value === 'string') {
910
+ if (value.toLowerCase() === 'true') return true;
911
+ return false;
912
+ } else {
913
+ return value;
914
+ }
915
+ })
916
+ .Encode(Boolean);
917
+ date = Type.Transform(
918
+ Type.Union(
919
+ [
920
+ Type.String({
921
+ pattern:
922
+ '^\\d{4}(-\\d{2}){0,2}(T\\d{2}:\\d{2}(:\\d{2}(\\.\\d{1,3})?)?(Z|([+-]\\d{2}:\\d{2}))?)?$|^\\d{1,2}\\/\\d{1,2}\\/\\d{4}$|^\\d{4}\\/\\d{1,2}\\/\\d{1,2}$|^\\d+$'
923
+ }),
924
+ Type.Number(),
925
+ Type.Date()
926
+ ],
927
+ {
928
+ errorType: 'date',
929
+ example: '2025-05-16T21:13:04.123Z',
930
+ title: 'Date'
931
+ }
932
+ )
933
+ )
934
+ .Decode((value) => {
935
+ if (value === null || typeof value === 'boolean') {
936
+ return /* @__PURE__ */ new Date(value ? 1 : 0);
937
+ }
938
+ return new Date(value);
939
+ })
940
+ .Encode((value) => new Date(value).toISOString());
941
+ symbol = Type.Symbol({
942
+ title: 'Symbol'
943
+ });
944
+ nullish = Type.Union([Type.Void(), Type.Null(), Type.Undefined()], {
945
+ errorType: 'nullish',
946
+ type: 'null',
947
+ example: 'null',
948
+ title: 'Nullish'
949
+ });
950
+ void = Type.Void({
951
+ type: 'null',
952
+ example: 'void',
953
+ title: 'Void'
954
+ });
955
+ null = Type.Null({
956
+ type: 'null',
957
+ example: 'null',
958
+ title: 'Null'
959
+ });
960
+ undefined = Type.Undefined({
961
+ type: 'null',
962
+ example: 'undefined',
963
+ title: 'Undefined'
964
+ });
965
+ any = Type.Any({
966
+ type: 'object',
967
+ example: 'any',
968
+ title: 'Any'
969
+ });
970
+ unknown = Type.Unknown({
971
+ type: 'object',
972
+ example: 'unknown',
973
+ title: 'Unknown'
974
+ });
975
+ never = Type.Never({
976
+ type: 'null',
977
+ example: 'never',
978
+ title: 'Never'
979
+ });
980
+ binary = Type.Transform(
981
+ Type.String({
982
+ errorType: 'binary',
983
+ format: 'binary',
984
+ example: 'a utf-8 encodable string',
985
+ title: 'Binary'
986
+ })
987
+ )
988
+ .Decode((value) => new TextEncoder().encode(value))
989
+ .Encode((value) => {
990
+ if (value instanceof ArrayBuffer) {
991
+ return String.fromCharCode(...new Uint8Array(value));
992
+ }
993
+ return '';
994
+ });
995
+ file = Type.Transform(
996
+ Type.String({
997
+ errorType: 'binary',
998
+ format: 'binary',
999
+ example: 'a utf-8 encodable string',
1000
+ title: 'File'
1001
+ })
1002
+ )
1003
+ .Decode(
1004
+ (value) => (name, type22) =>
1005
+ new InMemoryFile(value, name, { type: type22 })
1006
+ )
1007
+ .Encode((value) => value('name', 'type').content);
1008
+ type = () => this.any;
1009
+ /**
1010
+ * Extracts the error type of a schema for error messages.
1011
+ *
1012
+ * @param {TCatchall} schema - A schema that contains some type information.
1013
+ * @returns The type of the schema for error messages.
1014
+ */
1015
+ errorType(schema) {
1016
+ if (KindGuard.IsSchema(schema) && Object.hasOwn(schema, 'errorType')) {
1017
+ return schema.errorType;
1018
+ } else if (KindGuard.IsLiteral(schema)) {
1019
+ return schema.const;
1020
+ }
1021
+ return schema[Kind].toLowerCase();
1022
+ }
1023
+ /**
1024
+ * Compiles schema if this exists, for optimal performance.
1025
+ *
1026
+ * @param {TObject<TProperties>} schema - The schema to compile.
1027
+ * @returns {TypeCheck<T>} - The compiled schema.
1028
+ */
1029
+ compile(schema) {
1030
+ return TypeCompiler.Compile(schema);
1031
+ }
1032
+ /**
1033
+ * Convert a schema to a TypeBox schema.
1034
+ * @param {TIdiomaticSchema} schema - The schema to convert.
1035
+ * @returns {TResolve<T>} The resolved schema.
1036
+ */
1037
+ schemify(schema) {
1038
+ if (KindGuard.IsSchema(schema) || schema instanceof TypeCheck) {
1039
+ return schema;
1040
+ }
1041
+ if (
1042
+ typeof schema === 'string' ||
1043
+ typeof schema === 'number' ||
1044
+ typeof schema === 'boolean'
1045
+ ) {
1046
+ return Type.Literal(schema);
1047
+ }
1048
+ const newSchema = {};
1049
+ Object.getOwnPropertyNames(schema).forEach((key) => {
1050
+ if (KindGuard.IsSchema(schema[key])) {
1051
+ newSchema[key] = schema[key];
1052
+ } else {
1053
+ const schemified = this.schemify(schema[key]);
1054
+ newSchema[key] = schemified;
1055
+ }
1056
+ });
1057
+ return Type.Object(newSchema);
1058
+ }
1059
+ /**
1060
+ * Make a schema optional.
1061
+ * @param {TIdiomaticSchema} schema - The schema to make optional.
1062
+ * @returns {TOptional<TResolve<T>>} The optional schema.
1063
+ */
1064
+ optional(schema) {
1065
+ const schemified = this.schemify(schema);
1066
+ return Type.Optional(schemified);
1067
+ }
1068
+ /**
1069
+ * Create an array schema.
1070
+ * @param {TIdiomaticSchema} schema - The schema to use for array items.
1071
+ * @returns {TArray<TResolve<T>>} The array schema.
1072
+ */
1073
+ array(schema) {
1074
+ const schemified = this.schemify(schema);
1075
+ return Type.Array(schemified, {
1076
+ errorType: `array of ${this.errorType(schemified)}`
1077
+ });
1078
+ }
1079
+ /**
1080
+ * Create a union schema.
1081
+ * @param {TUnionTupleContainer} schemas - The schemas to union.
1082
+ * @returns {TUnion<UnionTupleTResolve<T>>} The union schema.
1083
+ *
1084
+ * WARNING: If "nullish" or TUndefined is included in the union, the key will still be expected.
1085
+ * This is a limitation of TypeBox. Consider using "optional" instead.
1086
+ */
1087
+ union(schemas) {
1088
+ const unionTypes = schemas.map((schema) => {
1089
+ return this.schemify(schema);
1090
+ });
1091
+ return Type.Union(unionTypes, {
1092
+ errorType: `any of ${unionTypes.map((s) => this.errorType(s)).join(', ')}`,
1093
+ errorSuffix: true
1094
+ });
1095
+ }
1096
+ /**
1097
+ * Create a literal schema.
1098
+ * @param {LiteralSchema} value - The literal value.
1099
+ * @returns {TLiteral<T>} The literal schema.
1100
+ */
1101
+ literal(value) {
1102
+ return Type.Literal(value, {
1103
+ errorType: value
1104
+ });
1105
+ }
1106
+ /**
1107
+ * Create an enum schema.
1108
+ * @param {Record<string, LiteralSchema>} schemaEnum - The enum schema.
1109
+ * @returns {TUnion<UnionTupleTResolve<T[]>>} The enum schema.
1110
+ */
1111
+ enum_(schemaEnum) {
1112
+ return this.union(
1113
+ Object.values(schemaEnum).map((value) => this.literal(value))
1114
+ );
1115
+ }
1116
+ /**
1117
+ * Create a function schema.
1118
+ * @param {TSchema[]} args - The arguments of the function.
1119
+ * @param {TAny} returnType - The return type of the function.
1120
+ * @returns {TFunction<Args, ReturnType>} The function schema.
1121
+ */
1122
+ function_(args, returnType) {
1123
+ const schemaArgs = args.map((schema) => {
1124
+ return this.schemify(schema);
1125
+ });
1126
+ const schemaReturnType = this.schemify(returnType);
1127
+ return Type.Function(schemaArgs, schemaReturnType);
1128
+ }
1129
+ /**
1130
+ * Create a record schema.
1131
+ * @param {TIdiomaticSchema} key - The key schema.
1132
+ * @param {TIdiomaticSchema} value - The value schema.
1133
+ * @returns {TRecord<TResolve<Key>, TResolve<Value>>} The record schema.
1134
+ */
1135
+ record(key, value) {
1136
+ const keySchema = this.schemify(key);
1137
+ const valueSchema = this.schemify(value);
1138
+ return Type.Record(keySchema, valueSchema);
1139
+ }
1140
+ /**
1141
+ * Create a promise schema.
1142
+ * @param {TIdiomaticSchema} schema - The schema to use for the promise.
1143
+ * @returns {TPromise<TResolve<T>>} The promise schema.
1144
+ */
1145
+ promise(schema) {
1146
+ return Type.Promise(this.schemify(schema));
1147
+ }
1148
+ /**
1149
+ * Check if a value is a TypeBox object schema.
1150
+ * @param {unknown} value - The value to check.
1151
+ * @returns {boolean} True if the value is a TypeBox object schema.
1152
+ */
1153
+ isSchema(value) {
1154
+ return KindGuard.IsSchema(value);
1155
+ }
1156
+ /**
1157
+ * Check if a value is an instance of a TypeBox schema.
1158
+ * @param {object} value - The value to check.
1159
+ * @param {TCatchall} type - The schema to check against.
1160
+ * @returns {boolean} True if the value is an instance of the schema.
1161
+ */
1162
+ isInstanceOf(value, type22) {
1163
+ return (
1164
+ typeof value === 'object' &&
1165
+ value != null &&
1166
+ Kind in value &&
1167
+ value[Kind] === type22[Kind]
1168
+ );
1169
+ }
1170
+ /**
1171
+ * Validate a value against a schema.
1172
+ *
1173
+ * @param {TSchema} schema - The schema to validate against.
1174
+ * @param {unknown} value - The value to validate.
1175
+ * @returns {boolean} True if valid, otherwise false.
1176
+ */
1177
+ validate(schema, value) {
1178
+ if (schema instanceof TypeCheck) {
1179
+ return schema.Check(value);
1180
+ } else {
1181
+ const schemified = this.schemify(schema);
1182
+ return Value.Check(schemified, value);
1183
+ }
1184
+ }
1185
+ /**
1186
+ * Parse a value against a schema.
1187
+ *
1188
+ * @param {TSchema} schema - The schema to validate against.
1189
+ * @param {unknown} value - The value to validate.
1190
+ * @returns {ParseResult<TResolve<T>>} The parsing result.
1191
+ */
1192
+ parse(schema, value) {
1193
+ let errors = [];
1194
+ let conversion;
1195
+ if (schema instanceof TypeCheck) {
1196
+ if (schema.Check(value)) {
1197
+ conversion = schema.Decode(value);
1198
+ } else {
1199
+ errors = Array.from(schema.Errors(value));
1200
+ }
1201
+ } else {
1202
+ const schemified = this.schemify(schema);
1203
+ if (Value.Check(schemified, value)) {
1204
+ conversion = Value.Decode(schemified, value);
1205
+ } else {
1206
+ errors = Array.from(Value.Errors(schemified, value));
1207
+ }
1208
+ }
1209
+ return errors != null && errors.length === 0
1210
+ ? {
1211
+ ok: true,
1212
+ value: conversion
1213
+ }
1214
+ : {
1215
+ ok: false,
1216
+ errors: errors.flatMap((error) => {
1217
+ if (
1218
+ error.type === ValueErrorType.Union &&
1219
+ error.schema.errorType.includes('any of')
1220
+ ) {
1221
+ return error.errors.flatMap((e, idx) =>
1222
+ Array.from(e).map((e2) => ({
1223
+ path: [
1224
+ `Union Schema Variant ${idx}`,
1225
+ ...error.path.split('/').slice(1),
1226
+ ...e2.path.split('/').slice(1)
1227
+ ],
1228
+ message: e2.message
1229
+ }))
1230
+ );
1231
+ } else {
1232
+ return [
1233
+ {
1234
+ path: error.path.split('/').slice(1),
1235
+ message: error.message
1236
+ }
1237
+ ];
1238
+ }
1239
+ })
1240
+ };
1241
+ }
1242
+ /**
1243
+ * Convert a schema to an OpenAPI schema object.
1244
+ * @param {TIdiomaticSchema | TCatchall} schema - The schema to convert.
1245
+ * @returns {SchemaObject} The OpenAPI schema object.
1246
+ */
1247
+ openapi(schema) {
1248
+ let schemified = this.schemify(schema);
1249
+ if (KindGuard.IsDate(schemified)) {
1250
+ schemified = Type.String({
1251
+ format: 'date-time'
1252
+ });
1253
+ }
1254
+ const newSchema = Object.assign({}, schemified);
1255
+ if (Object.hasOwn(newSchema, 'properties')) {
1256
+ if (newSchema.properties) {
1257
+ Object.entries({ ...schemified.properties }).forEach(([key, value]) => {
1258
+ if (KindGuard.IsSchema(value) && newSchema.properties) {
1259
+ newSchema.properties[key] = this.openapi(value);
1260
+ }
1261
+ });
1262
+ }
1263
+ }
1264
+ if (Object.hasOwn(newSchema, 'items')) {
1265
+ newSchema.items = this.openapi(newSchema.items);
1266
+ }
1267
+ if (Array.isArray(newSchema.anyOf)) {
1268
+ newSchema.anyOf = newSchema.anyOf.map((item) => this.openapi(item));
1269
+ }
1270
+ if (Array.isArray(newSchema.oneOf)) {
1271
+ newSchema.oneOf = newSchema.oneOf.map((item) => this.openapi(item));
1272
+ }
1273
+ if ('errorType' in newSchema) {
1274
+ delete newSchema['errorType'];
1275
+ }
1276
+ return newSchema;
1277
+ }
1278
+ };
1279
+ var SchemaValidator = () => new TypeboxSchemaValidator();
1280
+ var StaticSchemaValidator = SchemaValidator();
1281
+ var string = StaticSchemaValidator.string;
1282
+ var uuid = StaticSchemaValidator.uuid;
1283
+ var uri = StaticSchemaValidator.uri;
1284
+ var email = StaticSchemaValidator.email;
1285
+ var number = StaticSchemaValidator.number;
1286
+ var bigint = StaticSchemaValidator.bigint;
1287
+ var boolean = StaticSchemaValidator.boolean;
1288
+ var date = StaticSchemaValidator.date;
1289
+ var symbol = StaticSchemaValidator.symbol;
1290
+ var nullish = StaticSchemaValidator.nullish;
1291
+ var void_ = StaticSchemaValidator.void;
1292
+ var null_ = StaticSchemaValidator.null;
1293
+ var undefined_ = StaticSchemaValidator.undefined;
1294
+ var any = StaticSchemaValidator.any;
1295
+ var unknown = StaticSchemaValidator.unknown;
1296
+ var never = StaticSchemaValidator.never;
1297
+ var binary = StaticSchemaValidator.binary;
1298
+ var file = StaticSchemaValidator.file;
1299
+ var type = StaticSchemaValidator.type;
1300
+ var schemify = StaticSchemaValidator.schemify.bind(StaticSchemaValidator);
1301
+ var optional = StaticSchemaValidator.optional.bind(StaticSchemaValidator);
1302
+ var array = StaticSchemaValidator.array.bind(StaticSchemaValidator);
1303
+ var union = StaticSchemaValidator.union.bind(StaticSchemaValidator);
1304
+ var literal = StaticSchemaValidator.literal.bind(StaticSchemaValidator);
1305
+ var enum_ = StaticSchemaValidator.enum_.bind(StaticSchemaValidator);
1306
+ var function_ = StaticSchemaValidator.function_.bind(StaticSchemaValidator);
1307
+ var record = StaticSchemaValidator.record.bind(StaticSchemaValidator);
1308
+ var promise = StaticSchemaValidator.promise.bind(StaticSchemaValidator);
1309
+ var isSchema = StaticSchemaValidator.isSchema.bind(StaticSchemaValidator);
1310
+ var validate = StaticSchemaValidator.validate.bind(StaticSchemaValidator);
1311
+ var parse = StaticSchemaValidator.parse.bind(StaticSchemaValidator);
1312
+ var openapi = StaticSchemaValidator.openapi.bind(StaticSchemaValidator);
1313
+
1314
+ // domain/schemas/typebox/bullMqWorker.schema.ts
1315
+ var BullMqWorkerOptionsSchema = {
1316
+ queueOptions: type(),
1317
+ backoffType: union([literal('exponential'), literal('fixed')]),
1318
+ retries: number,
1319
+ interval: number
1320
+ };
1321
+
1322
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.6.16_openapi3-ts@4.4.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
1323
+ var import_zod_openapi = __toESM(require_src(), 1);
1324
+ import { z, ZodType } from 'zod';
1325
+ (0, import_zod_openapi.extendZodWithOpenApi)(z);
1326
+ var ZodSchemaValidator = class {
1327
+ _Type = 'Zod';
1328
+ _SchemaCatchall;
1329
+ _ValidSchemaObject;
1330
+ string = z.string().openapi({
1331
+ title: 'String',
1332
+ example: 'a string'
1333
+ });
1334
+ uuid = z.string().uuid().openapi({
1335
+ title: 'UUID',
1336
+ format: 'uuid',
1337
+ pattern:
1338
+ '^[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}$',
1339
+ example: 'a8b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6'
1340
+ });
1341
+ email = z.string().email().openapi({
1342
+ title: 'Email',
1343
+ format: 'email',
1344
+ 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])+)])`,
1345
+ example: 'a@b.com'
1346
+ });
1347
+ uri = z.string().url().openapi({
1348
+ title: 'URI',
1349
+ format: 'uri',
1350
+ pattern: '^[a-zA-Z][a-zA-Z\\d+-.]*:[^\\s]*$',
1351
+ example: 'https://forklaunch.com'
1352
+ });
1353
+ number = z
1354
+ .preprocess((value) => {
1355
+ try {
1356
+ return Number(value);
1357
+ } catch {
1358
+ return value;
1359
+ }
1360
+ }, z.number())
1361
+ .openapi({
1362
+ title: 'Number',
1363
+ example: 123
1364
+ });
1365
+ bigint = z
1366
+ .preprocess((value) => {
1367
+ try {
1368
+ if (value instanceof Date) {
1369
+ return BigInt(value.getTime());
1370
+ }
1371
+ switch (typeof value) {
1372
+ case 'number':
1373
+ case 'string':
1374
+ return BigInt(value);
1375
+ case 'boolean':
1376
+ return BigInt(value ? 1 : 0);
1377
+ default:
1378
+ return value;
1379
+ }
1380
+ } catch {
1381
+ return value;
1382
+ }
1383
+ }, z.bigint())
1384
+ .openapi({
1385
+ title: 'BigInt',
1386
+ type: 'integer',
1387
+ format: 'int64',
1388
+ example: 123n
1389
+ });
1390
+ boolean = z
1391
+ .preprocess((val) => {
1392
+ if (typeof val === 'string') {
1393
+ if (val.toLowerCase() === 'true') return true;
1394
+ if (val.toLowerCase() === 'false') return false;
1395
+ }
1396
+ return val;
1397
+ }, z.boolean())
1398
+ .openapi({
1399
+ title: 'Boolean',
1400
+ example: true
1401
+ });
1402
+ date = z
1403
+ .preprocess((value) => {
1404
+ try {
1405
+ switch (typeof value) {
1406
+ case 'string':
1407
+ return new Date(value);
1408
+ case 'number':
1409
+ return new Date(value);
1410
+ default:
1411
+ return value;
1412
+ }
1413
+ } catch {
1414
+ return value;
1415
+ }
1416
+ }, z.date())
1417
+ .openapi({
1418
+ title: 'Date',
1419
+ type: 'string',
1420
+ format: 'date-time',
1421
+ example: '2025-05-16T21:13:04.123Z'
1422
+ });
1423
+ symbol = z.symbol().openapi({
1424
+ title: 'Symbol',
1425
+ example: Symbol('symbol')
1426
+ });
1427
+ nullish = z.union([z.void(), z.null(), z.undefined()]).openapi({
1428
+ title: 'Nullish',
1429
+ type: 'null',
1430
+ example: null
1431
+ });
1432
+ void = z.void().openapi({
1433
+ title: 'Void',
1434
+ type: 'null',
1435
+ example: void 0
1436
+ });
1437
+ null = z.null().openapi({
1438
+ title: 'Null',
1439
+ type: 'null',
1440
+ example: null
1441
+ });
1442
+ undefined = z.undefined().openapi({
1443
+ title: 'Undefined',
1444
+ type: 'null',
1445
+ example: void 0
1446
+ });
1447
+ any = z.any().openapi({
1448
+ title: 'Any',
1449
+ type: 'object',
1450
+ example: 'any'
1451
+ });
1452
+ unknown = z.unknown().openapi({
1453
+ title: 'Unknown',
1454
+ type: 'object',
1455
+ example: 'unknown'
1456
+ });
1457
+ never = z.never().openapi({
1458
+ title: 'Never',
1459
+ type: 'null',
1460
+ example: 'never'
1461
+ });
1462
+ binary = z
1463
+ .string()
1464
+ .transform((v) => new TextEncoder().encode(v))
1465
+ .openapi({
1466
+ title: 'Binary',
1467
+ type: 'string',
1468
+ format: 'binary',
1469
+ example: 'a utf-8 encodable string'
1470
+ });
1471
+ file = z
1472
+ .string()
1473
+ .transform((val) => {
1474
+ return (name, type22) =>
1475
+ new File([val], name, {
1476
+ type: type22,
1477
+ lastModified: Date.now()
1478
+ });
1479
+ })
1480
+ .openapi({
1481
+ title: 'File',
1482
+ type: 'string',
1483
+ format: 'binary',
1484
+ example: 'a utf-8 encodable string'
1485
+ });
1486
+ type = () => this.any;
1487
+ /**
1488
+ * Compiles schema if this exists, for optimal performance.
1489
+ *
1490
+ * @param {ZodObject<ZodRawShape>} schema - The schema to compile.
1491
+ * @returns {ZodResolve<T>} - The compiled schema.
1492
+ */
1493
+ compile(schema) {
1494
+ return schema;
1495
+ }
1496
+ /**
1497
+ * Convert a schema to a Zod schema.
1498
+ * @param {ZodIdiomaticSchema} schema - The schema to convert.
1499
+ * @returns {ZodResolve<T>} The resolved schema.
1500
+ */
1501
+ schemify(schema) {
1502
+ if (
1503
+ typeof schema === 'string' ||
1504
+ typeof schema === 'number' ||
1505
+ typeof schema === 'boolean'
1506
+ ) {
1507
+ return z.literal(schema);
1508
+ }
1509
+ if (schema instanceof ZodType) {
1510
+ return schema;
1511
+ }
1512
+ const newSchema = {};
1513
+ Object.getOwnPropertyNames(schema).forEach((key) => {
1514
+ if (schema[key] instanceof ZodType) {
1515
+ newSchema[key] = schema[key];
1516
+ } else {
1517
+ newSchema[key] = this.schemify(schema[key]);
1518
+ }
1519
+ });
1520
+ return z.object(newSchema);
1521
+ }
1522
+ /**
1523
+ * Make a schema optional.
1524
+ * @param {ZodIdiomaticSchema} schema - The schema to make optional.
1525
+ * @returns {ZodOptional<ZodResolve<T>>} The optional schema.
1526
+ */
1527
+ optional(schema) {
1528
+ const resolvedSchema = this.schemify(schema);
1529
+ return resolvedSchema.optional();
1530
+ }
1531
+ /**
1532
+ * Create an array schema.
1533
+ * @param {ZodIdiomaticSchema} schema - The schema to use for array items.
1534
+ * @returns {ZodArray<ZodResolve<T>>} The array schema.
1535
+ */
1536
+ array(schema) {
1537
+ const resolvedSchema = this.schemify(schema);
1538
+ return resolvedSchema.array();
1539
+ }
1540
+ /**
1541
+ * Create a union schema.
1542
+ * @param {ZodUnionContainer} schemas - The schemas to union.
1543
+ * @returns {ZodUnion<UnionZodResolve<T>>} The union schema.
1544
+ */
1545
+ union(schemas) {
1546
+ const resolvedSchemas = schemas.map((schema) => this.schemify(schema));
1547
+ return z.union(resolvedSchemas);
1548
+ }
1549
+ /**
1550
+ * Create a literal schema.
1551
+ * @param {LiteralSchema} value - The literal value.
1552
+ * @returns {ZodLiteral<ZodResolve<T>>} The literal schema.
1553
+ */
1554
+ literal(value) {
1555
+ return z.literal(value);
1556
+ }
1557
+ /**
1558
+ * Create an enum schema.
1559
+ * @param {Record<string, LiteralSchema>} schemaEnum - The enum schema.
1560
+ * @returns {ZodUnion<UnionZodResolve<[T, T, ...T[]]>>} The enum schema.
1561
+ */
1562
+ enum_(schemaEnum) {
1563
+ return this.union(Object.values(schemaEnum));
1564
+ }
1565
+ /**
1566
+ * Create a function schema.
1567
+ * @param {ZodTuple} args - The arguments of the function.
1568
+ * @param {ZodAny} returnType - The return type of the function.
1569
+ * @returns {ZodFunction<Args, ReturnType>} The function schema.
1570
+ */
1571
+ function_(args, returnType) {
1572
+ const schemaArgs = args.map((schema) => this.schemify(schema));
1573
+ const schemaReturnType = this.schemify(returnType);
1574
+ return z.function(z.tuple(schemaArgs), schemaReturnType);
1575
+ }
1576
+ /**
1577
+ * Create a record schema.
1578
+ * @param {ZodIdiomaticSchema} key - The key schema.
1579
+ * @param {ZodIdiomaticSchema} value - The value schema.
1580
+ * @returns {ZodRecord<ZodResolve<Key>, ZodResolve<Value>>} The record schema.
1581
+ */
1582
+ record(key, value) {
1583
+ const keySchema = this.schemify(key);
1584
+ const valueSchema = this.schemify(value);
1585
+ return z.record(keySchema, valueSchema);
1586
+ }
1587
+ /**
1588
+ * Create a promise schema.
1589
+ * @param {ZodIdiomaticSchema} schema - The schema to use for the promise.
1590
+ * @returns {ZodPromise<ZodResolve<T>>} The promise schema.
1591
+ */
1592
+ promise(schema) {
1593
+ return z.promise(this.schemify(schema));
1594
+ }
1595
+ /**
1596
+ * Checks if a value is a Zod schema.
1597
+ * @param {unknown} value - The value to check.
1598
+ * @returns {boolean} True if the value is a Zod schema.
1599
+ */
1600
+ isSchema(value) {
1601
+ return value instanceof ZodType;
1602
+ }
1603
+ /**
1604
+ * Checks if a value is an instance of a Zod schema.
1605
+ * @param {object} value - The value to check.
1606
+ * @param {ZodType} type - The schema to check against.
1607
+ * @returns {boolean} True if the value is an instance of the schema.
1608
+ */
1609
+ isInstanceOf(value, type22) {
1610
+ return this.isSchema(value) && type22._def.typeName === value._def.typeName;
1611
+ }
1612
+ /**
1613
+ * Validate a value against a schema.
1614
+ * @param {ZodCatchall} schema - The schema to validate against.
1615
+ * @param {unknown} value - The value to validate.
1616
+ * @returns {boolean} True if valid, otherwise false.
1617
+ */
1618
+ validate(schema, value) {
1619
+ const resolvedSchema = this.schemify(schema);
1620
+ return resolvedSchema.safeParse(value).success;
1621
+ }
1622
+ /**
1623
+ * Parses a value to a schema validation.
1624
+ *
1625
+ * @param {ZodCatchall} schema - The schema to validate against.
1626
+ * @param {unknown} value - The value to validate.
1627
+ * @returns {ParseResult} - The discrimintated parsed value if successful, the error if unsuccessful.
1628
+ */
1629
+ parse(schema, value) {
1630
+ const resolvedSchema = this.schemify(schema);
1631
+ const result = resolvedSchema.safeParse(value);
1632
+ return result.success
1633
+ ? { ok: true, value: result.data }
1634
+ : {
1635
+ ok: false,
1636
+ errors: result.error.errors.flatMap((error) => {
1637
+ switch (error.code) {
1638
+ case 'invalid_union':
1639
+ return error.unionErrors.flatMap((unionError, idx) =>
1640
+ unionError.errors.map((e) => ({
1641
+ path: [
1642
+ `Union Schema Variant ${idx}`,
1643
+ ...error.path.map((p) => p.toString()),
1644
+ ...e.path.map((p) => p.toString())
1645
+ ],
1646
+ message: e.message
1647
+ }))
1648
+ );
1649
+ default:
1650
+ return [
1651
+ {
1652
+ path: error.path.map((p) => p.toString()),
1653
+ message: error.message
1654
+ }
1655
+ ];
1656
+ }
1657
+ })
1658
+ };
1659
+ }
1660
+ /**
1661
+ * Convert a schema to an OpenAPI schema object.
1662
+ * @param {ZodIdiomaticSchema} schema - The schema to convert.
1663
+ * @returns {SchemaObject} The OpenAPI schema object.
1664
+ */
1665
+ openapi(schema) {
1666
+ return (0, import_zod_openapi.generateSchema)(this.schemify(schema));
1667
+ }
1668
+ };
1669
+ var SchemaValidator2 = () => new ZodSchemaValidator();
1670
+ var StaticSchemaValidator2 = SchemaValidator2();
1671
+ var string2 = StaticSchemaValidator2.string;
1672
+ var uuid2 = StaticSchemaValidator2.uuid;
1673
+ var email2 = StaticSchemaValidator2.email;
1674
+ var uri2 = StaticSchemaValidator2.uri;
1675
+ var number2 = StaticSchemaValidator2.number;
1676
+ var bigint2 = StaticSchemaValidator2.bigint;
1677
+ var boolean2 = StaticSchemaValidator2.boolean;
1678
+ var date2 = StaticSchemaValidator2.date;
1679
+ var symbol2 = StaticSchemaValidator2.symbol;
1680
+ var nullish2 = StaticSchemaValidator2.nullish;
1681
+ var void_2 = StaticSchemaValidator2.void;
1682
+ var null_2 = StaticSchemaValidator2.null;
1683
+ var undefined_2 = StaticSchemaValidator2.undefined;
1684
+ var any2 = StaticSchemaValidator2.any;
1685
+ var unknown2 = StaticSchemaValidator2.unknown;
1686
+ var never2 = StaticSchemaValidator2.never;
1687
+ var binary2 = StaticSchemaValidator2.binary;
1688
+ var file2 = StaticSchemaValidator2.file;
1689
+ var type2 = StaticSchemaValidator2.type;
1690
+ var schemify2 = StaticSchemaValidator2.schemify.bind(StaticSchemaValidator2);
1691
+ var optional2 = StaticSchemaValidator2.optional.bind(StaticSchemaValidator2);
1692
+ var array2 = StaticSchemaValidator2.array.bind(StaticSchemaValidator2);
1693
+ var union2 = StaticSchemaValidator2.union.bind(StaticSchemaValidator2);
1694
+ var literal2 = StaticSchemaValidator2.literal.bind(StaticSchemaValidator2);
1695
+ var enum_2 = StaticSchemaValidator2.enum_.bind(StaticSchemaValidator2);
1696
+ var function_2 = StaticSchemaValidator2.function_.bind(StaticSchemaValidator2);
1697
+ var record2 = StaticSchemaValidator2.record.bind(StaticSchemaValidator2);
1698
+ var promise2 = StaticSchemaValidator2.promise.bind(StaticSchemaValidator2);
1699
+ var isSchema2 = StaticSchemaValidator2.isSchema.bind(StaticSchemaValidator2);
1700
+ var validate2 = StaticSchemaValidator2.validate.bind(StaticSchemaValidator2);
1701
+ var parse2 = StaticSchemaValidator2.parse.bind(StaticSchemaValidator2);
1702
+ var openapi2 = StaticSchemaValidator2.openapi.bind(StaticSchemaValidator2);
1703
+
1704
+ // domain/schemas/zod/bullMqWorker.schema.ts
1705
+ var BullMqWorkerOptionsSchema2 = {
1706
+ queueOptions: type2(),
1707
+ backoffType: union2([literal2('exponential'), literal2('fixed')]),
1708
+ retries: number2,
1709
+ interval: number2
1710
+ };
1711
+
1712
+ // domain/schemas/bullMqWorker.schema.ts
1713
+ var BullMqWorkerSchemas = serviceSchemaResolver(
1714
+ () => BullMqWorkerOptionsSchema,
1715
+ () => BullMqWorkerOptionsSchema2
1716
+ );
1717
+ export { BullMqWorkerSchemas };