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