@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
|
@@ -4,65 +4,97 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __require = /* @__PURE__ */ ((x) =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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);
|
|
11
16
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
17
|
});
|
|
13
|
-
var __commonJS = (cb, mod) =>
|
|
14
|
-
|
|
15
|
-
|
|
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
|
+
};
|
|
16
26
|
var __copyProps = (to, from, except, desc) => {
|
|
17
|
-
if (from && typeof from ===
|
|
27
|
+
if ((from && typeof from === 'object') || typeof from === 'function') {
|
|
18
28
|
for (let key of __getOwnPropNames(from))
|
|
19
29
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
-
__defProp(to, key, {
|
|
30
|
+
__defProp(to, key, {
|
|
31
|
+
get: () => from[key],
|
|
32
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
33
|
+
});
|
|
21
34
|
}
|
|
22
35
|
return to;
|
|
23
36
|
};
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
);
|
|
32
50
|
|
|
33
51
|
// ../../../node_modules/.pnpm/ts-deepmerge@6.2.1/node_modules/ts-deepmerge/cjs/index.js
|
|
34
52
|
var require_cjs = __commonJS({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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 });
|
|
38
58
|
var isObject = (obj) => {
|
|
39
|
-
if (typeof obj ===
|
|
40
|
-
if (typeof Object.getPrototypeOf ===
|
|
59
|
+
if (typeof obj === 'object' && obj !== null) {
|
|
60
|
+
if (typeof Object.getPrototypeOf === 'function') {
|
|
41
61
|
const prototype = Object.getPrototypeOf(obj);
|
|
42
62
|
return prototype === Object.prototype || prototype === null;
|
|
43
63
|
}
|
|
44
|
-
return Object.prototype.toString.call(obj) ===
|
|
64
|
+
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
45
65
|
}
|
|
46
66
|
return false;
|
|
47
67
|
};
|
|
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];
|
|
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
|
+
);
|
|
62
74
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
+
}, {});
|
|
66
98
|
var defaultOptions = {
|
|
67
99
|
allowUndefinedOverrides: true,
|
|
68
100
|
mergeArrays: true,
|
|
@@ -79,129 +111,202 @@ var require_cjs = __commonJS({
|
|
|
79
111
|
}
|
|
80
112
|
});
|
|
81
113
|
|
|
82
|
-
// ../../../node_modules/.pnpm/@anatine+zod-openapi@2.2.8_openapi3-ts@4.4.0_zod@3.25.
|
|
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
|
|
83
115
|
var require_zod_openapi = __commonJS({
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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 });
|
|
87
121
|
exports.generateSchema = exports.extendApi = void 0;
|
|
88
122
|
var ts_deepmerge_1 = require_cjs();
|
|
89
|
-
var zod_1 = __require(
|
|
123
|
+
var zod_1 = __require('zod');
|
|
90
124
|
function extendApi(schema, schemaObject = {}) {
|
|
91
125
|
const This = schema.constructor;
|
|
92
126
|
const newSchema = new This(schema._def);
|
|
93
|
-
newSchema.metaOpenApi = Object.assign(
|
|
127
|
+
newSchema.metaOpenApi = Object.assign(
|
|
128
|
+
{},
|
|
129
|
+
schema.metaOpenApi || {},
|
|
130
|
+
schemaObject
|
|
131
|
+
);
|
|
94
132
|
return newSchema;
|
|
95
133
|
}
|
|
96
134
|
exports.extendApi = extendApi;
|
|
97
|
-
function iterateZodObject({
|
|
98
|
-
|
|
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
|
+
);
|
|
99
159
|
return reduced;
|
|
100
160
|
}
|
|
101
161
|
function typeFormat(type3, openApiVersion) {
|
|
102
|
-
return openApiVersion ===
|
|
162
|
+
return openApiVersion === '3.0' ? type3 : [type3];
|
|
103
163
|
}
|
|
104
|
-
function parseTransformation({
|
|
105
|
-
|
|
106
|
-
|
|
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';
|
|
107
176
|
if (useOutput && zodRef._def.effect) {
|
|
108
|
-
const effect =
|
|
109
|
-
|
|
177
|
+
const effect =
|
|
178
|
+
zodRef._def.effect.type === 'transform' ? zodRef._def.effect : null;
|
|
179
|
+
if (effect && 'transform' in effect) {
|
|
110
180
|
try {
|
|
111
|
-
const type3 = Array.isArray(input.type)
|
|
181
|
+
const type3 = Array.isArray(input.type)
|
|
182
|
+
? input.type[0]
|
|
183
|
+
: input.type;
|
|
112
184
|
output = typeof effect.transform(
|
|
113
|
-
[
|
|
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,
|
|
114
198
|
{ addIssue: () => void 0, path: [] }
|
|
115
199
|
// TODO: Discover if context is necessary here
|
|
116
200
|
);
|
|
117
|
-
} catch (e) {
|
|
118
|
-
}
|
|
201
|
+
} catch (e) {}
|
|
119
202
|
}
|
|
120
203
|
}
|
|
121
204
|
const outputType = output;
|
|
122
|
-
return (0, ts_deepmerge_1.default)(
|
|
123
|
-
|
|
124
|
-
|
|
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
|
+
);
|
|
125
222
|
}
|
|
126
223
|
function parseString({ zodRef, schemas, openApiVersion }) {
|
|
127
224
|
const baseSchema = {
|
|
128
|
-
type: typeFormat(
|
|
225
|
+
type: typeFormat('string', openApiVersion)
|
|
129
226
|
};
|
|
130
227
|
const { checks = [] } = zodRef._def;
|
|
131
228
|
checks.forEach((item) => {
|
|
132
229
|
switch (item.kind) {
|
|
133
|
-
case
|
|
134
|
-
baseSchema.format =
|
|
230
|
+
case 'email':
|
|
231
|
+
baseSchema.format = 'email';
|
|
135
232
|
break;
|
|
136
|
-
case
|
|
137
|
-
baseSchema.format =
|
|
233
|
+
case 'uuid':
|
|
234
|
+
baseSchema.format = 'uuid';
|
|
138
235
|
break;
|
|
139
|
-
case
|
|
140
|
-
baseSchema.format =
|
|
236
|
+
case 'cuid':
|
|
237
|
+
baseSchema.format = 'cuid';
|
|
141
238
|
break;
|
|
142
|
-
case
|
|
143
|
-
baseSchema.format =
|
|
239
|
+
case 'url':
|
|
240
|
+
baseSchema.format = 'uri';
|
|
144
241
|
break;
|
|
145
|
-
case
|
|
146
|
-
baseSchema.format =
|
|
242
|
+
case 'datetime':
|
|
243
|
+
baseSchema.format = 'date-time';
|
|
147
244
|
break;
|
|
148
|
-
case
|
|
245
|
+
case 'length':
|
|
149
246
|
baseSchema.minLength = item.value;
|
|
150
247
|
baseSchema.maxLength = item.value;
|
|
151
248
|
break;
|
|
152
|
-
case
|
|
249
|
+
case 'max':
|
|
153
250
|
baseSchema.maxLength = item.value;
|
|
154
251
|
break;
|
|
155
|
-
case
|
|
252
|
+
case 'min':
|
|
156
253
|
baseSchema.minLength = item.value;
|
|
157
254
|
break;
|
|
158
|
-
case
|
|
255
|
+
case 'regex':
|
|
159
256
|
baseSchema.pattern = item.regex.source;
|
|
160
257
|
break;
|
|
161
258
|
}
|
|
162
259
|
});
|
|
163
|
-
return (0, ts_deepmerge_1.default)(
|
|
260
|
+
return (0, ts_deepmerge_1.default)(
|
|
261
|
+
baseSchema,
|
|
262
|
+
zodRef.description ? { description: zodRef.description } : {},
|
|
263
|
+
...schemas
|
|
264
|
+
);
|
|
164
265
|
}
|
|
165
266
|
function parseNumber({ zodRef, schemas, openApiVersion }) {
|
|
166
267
|
const baseSchema = {
|
|
167
|
-
type: typeFormat(
|
|
268
|
+
type: typeFormat('number', openApiVersion)
|
|
168
269
|
};
|
|
169
270
|
const { checks = [] } = zodRef._def;
|
|
170
271
|
checks.forEach((item) => {
|
|
171
272
|
switch (item.kind) {
|
|
172
|
-
case
|
|
173
|
-
if (item.inclusive || openApiVersion ===
|
|
273
|
+
case 'max':
|
|
274
|
+
if (item.inclusive || openApiVersion === '3.0') {
|
|
174
275
|
baseSchema.maximum = item.value;
|
|
175
276
|
}
|
|
176
277
|
if (!item.inclusive) {
|
|
177
|
-
if (openApiVersion ===
|
|
278
|
+
if (openApiVersion === '3.0') {
|
|
178
279
|
baseSchema.exclusiveMaximum = true;
|
|
179
280
|
} else {
|
|
180
281
|
baseSchema.exclusiveMaximum = item.value;
|
|
181
282
|
}
|
|
182
283
|
}
|
|
183
284
|
break;
|
|
184
|
-
case
|
|
185
|
-
if (item.inclusive || openApiVersion ===
|
|
285
|
+
case 'min':
|
|
286
|
+
if (item.inclusive || openApiVersion === '3.0') {
|
|
186
287
|
baseSchema.minimum = item.value;
|
|
187
288
|
}
|
|
188
289
|
if (!item.inclusive) {
|
|
189
|
-
if (openApiVersion ===
|
|
290
|
+
if (openApiVersion === '3.0') {
|
|
190
291
|
baseSchema.exclusiveMinimum = true;
|
|
191
292
|
} else {
|
|
192
293
|
baseSchema.exclusiveMinimum = item.value;
|
|
193
294
|
}
|
|
194
295
|
}
|
|
195
296
|
break;
|
|
196
|
-
case
|
|
197
|
-
baseSchema.type = typeFormat(
|
|
297
|
+
case 'int':
|
|
298
|
+
baseSchema.type = typeFormat('integer', openApiVersion);
|
|
198
299
|
break;
|
|
199
|
-
case
|
|
300
|
+
case 'multipleOf':
|
|
200
301
|
baseSchema.multipleOf = item.value;
|
|
201
302
|
break;
|
|
202
303
|
}
|
|
203
304
|
});
|
|
204
|
-
return (0, ts_deepmerge_1.default)(
|
|
305
|
+
return (0, ts_deepmerge_1.default)(
|
|
306
|
+
baseSchema,
|
|
307
|
+
zodRef.description ? { description: zodRef.description } : {},
|
|
308
|
+
...schemas
|
|
309
|
+
);
|
|
205
310
|
}
|
|
206
311
|
function getExcludedDefinitionsFromSchema(schemas) {
|
|
207
312
|
const excludedDefinitions = [];
|
|
@@ -212,65 +317,163 @@ var require_zod_openapi = __commonJS({
|
|
|
212
317
|
}
|
|
213
318
|
return excludedDefinitions;
|
|
214
319
|
}
|
|
215
|
-
function parseObject({
|
|
320
|
+
function parseObject({
|
|
321
|
+
zodRef,
|
|
322
|
+
schemas,
|
|
323
|
+
useOutput,
|
|
324
|
+
hideDefinitions,
|
|
325
|
+
openApiVersion
|
|
326
|
+
}) {
|
|
216
327
|
var _a;
|
|
217
328
|
let additionalProperties;
|
|
218
|
-
if (
|
|
219
|
-
|
|
220
|
-
|
|
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')
|
|
221
343
|
additionalProperties = true;
|
|
222
|
-
else if (zodRef._def.unknownKeys ===
|
|
344
|
+
else if (zodRef._def.unknownKeys === 'strict')
|
|
223
345
|
additionalProperties = false;
|
|
224
|
-
additionalProperties =
|
|
346
|
+
additionalProperties =
|
|
347
|
+
additionalProperties != null ? { additionalProperties } : {};
|
|
225
348
|
const requiredProperties = Object.keys(zodRef.shape).filter((key) => {
|
|
226
349
|
const item = zodRef.shape[key];
|
|
227
|
-
return
|
|
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
|
+
);
|
|
228
361
|
});
|
|
229
|
-
const required =
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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
|
+
);
|
|
237
389
|
}
|
|
238
390
|
function parseRecord({ zodRef, schemas, useOutput, openApiVersion }) {
|
|
239
|
-
return (0, ts_deepmerge_1.default)(
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
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
|
+
);
|
|
243
406
|
}
|
|
244
407
|
function parseBigInt({ zodRef, schemas, openApiVersion }) {
|
|
245
|
-
return (0, ts_deepmerge_1.default)(
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
+
);
|
|
249
416
|
}
|
|
250
417
|
function parseBoolean({ zodRef, schemas, openApiVersion }) {
|
|
251
|
-
return (0, ts_deepmerge_1.default)(
|
|
418
|
+
return (0, ts_deepmerge_1.default)(
|
|
419
|
+
{ type: typeFormat('boolean', openApiVersion) },
|
|
420
|
+
zodRef.description ? { description: zodRef.description } : {},
|
|
421
|
+
...schemas
|
|
422
|
+
);
|
|
252
423
|
}
|
|
253
424
|
function parseDate({ zodRef, schemas, openApiVersion }) {
|
|
254
|
-
return (0, ts_deepmerge_1.default)(
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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
|
+
);
|
|
258
433
|
}
|
|
259
434
|
function parseNull({ zodRef, schemas, openApiVersion }) {
|
|
260
|
-
return (0, ts_deepmerge_1.default)(
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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
|
+
);
|
|
264
445
|
}
|
|
265
446
|
function parseOptional({ schemas, zodRef, useOutput, openApiVersion }) {
|
|
266
|
-
return (0, ts_deepmerge_1.default)(
|
|
447
|
+
return (0, ts_deepmerge_1.default)(
|
|
448
|
+
generateSchema2(zodRef.unwrap(), useOutput, openApiVersion),
|
|
449
|
+
zodRef.description ? { description: zodRef.description } : {},
|
|
450
|
+
...schemas
|
|
451
|
+
);
|
|
267
452
|
}
|
|
268
453
|
function parseNullable({ schemas, zodRef, useOutput, openApiVersion }) {
|
|
269
|
-
const schema = generateSchema2(
|
|
270
|
-
|
|
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
|
+
);
|
|
271
467
|
}
|
|
272
468
|
function parseDefault({ schemas, zodRef, useOutput, openApiVersion }) {
|
|
273
|
-
return (0, ts_deepmerge_1.default)(
|
|
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
|
+
);
|
|
274
477
|
}
|
|
275
478
|
function parseArray({ schemas, zodRef, useOutput, openApiVersion }) {
|
|
276
479
|
const constraints = {};
|
|
@@ -282,70 +485,149 @@ var require_zod_openapi = __commonJS({
|
|
|
282
485
|
constraints.minItems = zodRef._def.minLength.value;
|
|
283
486
|
if (zodRef._def.maxLength != null)
|
|
284
487
|
constraints.maxItems = zodRef._def.maxLength.value;
|
|
285
|
-
return (0, ts_deepmerge_1.default)(
|
|
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
|
+
);
|
|
286
499
|
}
|
|
287
500
|
function parseLiteral({ schemas, zodRef, openApiVersion }) {
|
|
288
501
|
const type3 = typeof zodRef._def.value;
|
|
289
|
-
return (0, ts_deepmerge_1.default)(
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
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
|
+
);
|
|
293
510
|
}
|
|
294
511
|
function parseEnum({ schemas, zodRef, openApiVersion }) {
|
|
295
512
|
const type3 = typeof Object.values(zodRef._def.values)[0];
|
|
296
|
-
return (0, ts_deepmerge_1.default)(
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
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
|
+
);
|
|
300
521
|
}
|
|
301
522
|
function parseIntersection({ schemas, zodRef, useOutput, openApiVersion }) {
|
|
302
|
-
return (0, ts_deepmerge_1.default)(
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
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
|
+
);
|
|
308
533
|
}
|
|
309
534
|
function parseUnion({ schemas, zodRef, useOutput, openApiVersion }) {
|
|
310
535
|
const contents = zodRef._def.options;
|
|
311
|
-
if (
|
|
536
|
+
if (
|
|
537
|
+
contents.reduce(
|
|
538
|
+
(prev, content) => prev && content._def.typeName === 'ZodLiteral',
|
|
539
|
+
true
|
|
540
|
+
)
|
|
541
|
+
) {
|
|
312
542
|
const literals = contents;
|
|
313
|
-
const type3 = literals.reduce(
|
|
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
|
+
);
|
|
314
550
|
if (type3) {
|
|
315
|
-
return (0, ts_deepmerge_1.default)(
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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
|
+
);
|
|
319
559
|
}
|
|
320
560
|
}
|
|
321
|
-
const oneOfContents =
|
|
561
|
+
const oneOfContents =
|
|
562
|
+
openApiVersion === '3.0'
|
|
563
|
+
? contents.filter((content) => content._def.typeName !== 'ZodNull')
|
|
564
|
+
: contents;
|
|
322
565
|
const contentsHasNull = contents.length != oneOfContents.length;
|
|
323
|
-
return (0, ts_deepmerge_1.default)(
|
|
324
|
-
|
|
325
|
-
|
|
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
|
+
);
|
|
326
576
|
}
|
|
327
|
-
function parseDiscriminatedUnion({
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
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
|
+
)
|
|
331
591
|
},
|
|
332
|
-
|
|
333
|
-
|
|
592
|
+
zodRef.description ? { description: zodRef.description } : {},
|
|
593
|
+
...schemas
|
|
594
|
+
);
|
|
334
595
|
}
|
|
335
596
|
function parseNever({ zodRef, schemas }) {
|
|
336
|
-
return (0, ts_deepmerge_1.default)(
|
|
597
|
+
return (0, ts_deepmerge_1.default)(
|
|
598
|
+
{ readOnly: true },
|
|
599
|
+
zodRef.description ? { description: zodRef.description } : {},
|
|
600
|
+
...schemas
|
|
601
|
+
);
|
|
337
602
|
}
|
|
338
603
|
function parseBranded({ schemas, zodRef, useOutput, openApiVersion }) {
|
|
339
|
-
return (0, ts_deepmerge_1.default)(
|
|
604
|
+
return (0, ts_deepmerge_1.default)(
|
|
605
|
+
generateSchema2(zodRef._def.type, useOutput, openApiVersion),
|
|
606
|
+
...schemas
|
|
607
|
+
);
|
|
340
608
|
}
|
|
341
609
|
function catchAllParser({ zodRef, schemas }) {
|
|
342
|
-
return (0, ts_deepmerge_1.default)(
|
|
610
|
+
return (0, ts_deepmerge_1.default)(
|
|
611
|
+
zodRef.description ? { description: zodRef.description } : {},
|
|
612
|
+
...schemas
|
|
613
|
+
);
|
|
343
614
|
}
|
|
344
615
|
function parsePipeline({ schemas, zodRef, useOutput, openApiVersion }) {
|
|
345
|
-
return (0, ts_deepmerge_1.default)(
|
|
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
|
+
);
|
|
346
624
|
}
|
|
347
625
|
function parseReadonly({ zodRef, useOutput, schemas, openApiVersion }) {
|
|
348
|
-
return (0, ts_deepmerge_1.default)(
|
|
626
|
+
return (0, ts_deepmerge_1.default)(
|
|
627
|
+
generateSchema2(zodRef._def.innerType, useOutput, openApiVersion),
|
|
628
|
+
zodRef.description ? { description: zodRef.description } : {},
|
|
629
|
+
...schemas
|
|
630
|
+
);
|
|
349
631
|
}
|
|
350
632
|
var workerMap = {
|
|
351
633
|
ZodObject: parseObject,
|
|
@@ -384,10 +666,14 @@ var require_zod_openapi = __commonJS({
|
|
|
384
666
|
ZodPipeline: parsePipeline,
|
|
385
667
|
ZodReadonly: parseReadonly
|
|
386
668
|
};
|
|
387
|
-
function generateSchema2(
|
|
669
|
+
function generateSchema2(
|
|
670
|
+
zodRef,
|
|
671
|
+
useOutput = false,
|
|
672
|
+
openApiVersion = '3.1'
|
|
673
|
+
) {
|
|
388
674
|
const { metaOpenApi = {} } = zodRef;
|
|
389
675
|
const schemas = [
|
|
390
|
-
...Array.isArray(metaOpenApi) ? metaOpenApi : [metaOpenApi]
|
|
676
|
+
...(Array.isArray(metaOpenApi) ? metaOpenApi : [metaOpenApi])
|
|
391
677
|
];
|
|
392
678
|
try {
|
|
393
679
|
const typeName = zodRef._def.typeName;
|
|
@@ -409,18 +695,23 @@ var require_zod_openapi = __commonJS({
|
|
|
409
695
|
}
|
|
410
696
|
});
|
|
411
697
|
|
|
412
|
-
// ../../../node_modules/.pnpm/@anatine+zod-openapi@2.2.8_openapi3-ts@4.4.0_zod@3.25.
|
|
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
|
|
413
699
|
var require_zod_extensions = __commonJS({
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
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 });
|
|
417
705
|
exports.extendZodWithOpenApi = void 0;
|
|
418
706
|
var zod_openapi_1 = require_zod_openapi();
|
|
419
707
|
function extendZodWithOpenApi2(zod, forceOverride = false) {
|
|
420
|
-
if (
|
|
708
|
+
if (
|
|
709
|
+
!forceOverride &&
|
|
710
|
+
typeof zod.ZodSchema.prototype.openapi !== 'undefined'
|
|
711
|
+
) {
|
|
421
712
|
return;
|
|
422
713
|
}
|
|
423
|
-
zod.ZodSchema.prototype.openapi = function(metadata) {
|
|
714
|
+
zod.ZodSchema.prototype.openapi = function (metadata) {
|
|
424
715
|
return (0, zod_openapi_1.extendApi)(this, metadata);
|
|
425
716
|
};
|
|
426
717
|
}
|
|
@@ -428,42 +719,59 @@ var require_zod_extensions = __commonJS({
|
|
|
428
719
|
}
|
|
429
720
|
});
|
|
430
721
|
|
|
431
|
-
// ../../../node_modules/.pnpm/@anatine+zod-openapi@2.2.8_openapi3-ts@4.4.0_zod@3.25.
|
|
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
|
|
432
723
|
var require_src = __commonJS({
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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 });
|
|
452
764
|
__exportStar(require_zod_openapi(), exports);
|
|
453
765
|
__exportStar(require_zod_extensions(), exports);
|
|
454
766
|
}
|
|
455
767
|
});
|
|
456
768
|
|
|
457
|
-
// schemas/redisWorker.schema.ts
|
|
458
|
-
import { serviceSchemaResolver } from
|
|
769
|
+
// domain/schemas/redisWorker.schema.ts
|
|
770
|
+
import { serviceSchemaResolver } from '@forklaunch/internal';
|
|
459
771
|
|
|
460
|
-
// ../../../node_modules/.pnpm/@forklaunch+common@0.3.
|
|
772
|
+
// ../../../node_modules/.pnpm/@forklaunch+common@0.3.14/node_modules/@forklaunch/common/lib/index.mjs
|
|
461
773
|
var InMemoryFile = class extends File {
|
|
462
|
-
constructor(content, name, {
|
|
463
|
-
type: type3,
|
|
464
|
-
endings,
|
|
465
|
-
lastModified
|
|
466
|
-
}) {
|
|
774
|
+
constructor(content, name, { type: type3, endings, lastModified }) {
|
|
467
775
|
super([Buffer.from(content)], name, {
|
|
468
776
|
type: type3,
|
|
469
777
|
endings,
|
|
@@ -473,221 +781,230 @@ var InMemoryFile = class extends File {
|
|
|
473
781
|
}
|
|
474
782
|
};
|
|
475
783
|
|
|
476
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.6.
|
|
477
|
-
import {
|
|
478
|
-
|
|
479
|
-
Kind,
|
|
480
|
-
KindGuard,
|
|
481
|
-
Type
|
|
482
|
-
} from "@sinclair/typebox";
|
|
483
|
-
import { TypeCheck, TypeCompiler } from "@sinclair/typebox/compiler";
|
|
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';
|
|
484
787
|
import {
|
|
485
788
|
DefaultErrorFunction,
|
|
486
789
|
SetErrorFunction,
|
|
487
790
|
ValueErrorType
|
|
488
|
-
} from
|
|
489
|
-
import { Value } from
|
|
490
|
-
FormatRegistry.Set(
|
|
791
|
+
} from '@sinclair/typebox/errors';
|
|
792
|
+
import { Value } from '@sinclair/typebox/value';
|
|
793
|
+
FormatRegistry.Set('binary', (value) => typeof value === 'string');
|
|
491
794
|
SetErrorFunction((params) => {
|
|
492
795
|
switch (params.errorType) {
|
|
493
796
|
case ValueErrorType.Union:
|
|
494
797
|
case ValueErrorType.Array:
|
|
495
798
|
case ValueErrorType.String:
|
|
496
799
|
case ValueErrorType.Number:
|
|
497
|
-
return params.schema.errorType
|
|
800
|
+
return params.schema.errorType
|
|
801
|
+
? `Expected ${params.schema.errorType} value${params.schema.errorSuffix ? 's' : ''}`
|
|
802
|
+
: DefaultErrorFunction(params);
|
|
498
803
|
default:
|
|
499
804
|
return DefaultErrorFunction(params);
|
|
500
805
|
}
|
|
501
806
|
});
|
|
502
807
|
var TypeboxSchemaValidator = class {
|
|
503
|
-
_Type =
|
|
808
|
+
_Type = 'TypeBox';
|
|
504
809
|
_SchemaCatchall;
|
|
505
810
|
_ValidSchemaObject;
|
|
506
811
|
string = Type.String({
|
|
507
|
-
example:
|
|
508
|
-
title:
|
|
812
|
+
example: 'a string',
|
|
813
|
+
title: 'String'
|
|
509
814
|
});
|
|
510
815
|
uuid = Type.String({
|
|
511
|
-
pattern:
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
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'
|
|
515
821
|
});
|
|
516
822
|
email = Type.String({
|
|
517
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])+)])`,
|
|
518
|
-
errorType:
|
|
519
|
-
example:
|
|
520
|
-
title:
|
|
824
|
+
errorType: 'email',
|
|
825
|
+
example: 'a@b.com',
|
|
826
|
+
title: 'Email'
|
|
521
827
|
});
|
|
522
828
|
uri = Type.String({
|
|
523
|
-
pattern:
|
|
524
|
-
errorType:
|
|
525
|
-
example:
|
|
526
|
-
title:
|
|
829
|
+
pattern: '^[a-zA-Z][a-zA-Z\\d+-.]*:[^\\s]*$',
|
|
830
|
+
errorType: 'uri',
|
|
831
|
+
example: 'https://forklaunch.com',
|
|
832
|
+
title: 'URI'
|
|
527
833
|
});
|
|
528
834
|
number = Type.Transform(
|
|
529
835
|
Type.Union(
|
|
530
836
|
[
|
|
531
837
|
Type.Number(),
|
|
532
|
-
Type.String({ pattern:
|
|
838
|
+
Type.String({ pattern: '^[0-9]+$' }),
|
|
533
839
|
Type.Boolean(),
|
|
534
840
|
Type.Null(),
|
|
535
841
|
Type.BigInt(),
|
|
536
842
|
Type.Date()
|
|
537
843
|
],
|
|
538
844
|
{
|
|
539
|
-
errorType:
|
|
845
|
+
errorType: 'number-like',
|
|
540
846
|
example: 123,
|
|
541
|
-
title:
|
|
847
|
+
title: 'Number'
|
|
542
848
|
}
|
|
543
849
|
)
|
|
544
|
-
)
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
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
|
+
}
|
|
551
859
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
860
|
+
return value;
|
|
861
|
+
})
|
|
862
|
+
.Encode(Number);
|
|
555
863
|
bigint = Type.Transform(
|
|
556
864
|
Type.Union(
|
|
557
865
|
[
|
|
558
866
|
Type.BigInt(),
|
|
559
867
|
Type.Number(),
|
|
560
|
-
Type.String({ pattern:
|
|
868
|
+
Type.String({ pattern: '^[0-9]+n?$' }),
|
|
561
869
|
Type.Boolean(),
|
|
562
870
|
Type.Date()
|
|
563
871
|
],
|
|
564
872
|
{
|
|
565
|
-
errorType:
|
|
873
|
+
errorType: 'BigInt-like',
|
|
566
874
|
example: 123n,
|
|
567
|
-
title:
|
|
875
|
+
title: 'BigInt'
|
|
568
876
|
}
|
|
569
877
|
)
|
|
570
|
-
)
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
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');
|
|
575
888
|
}
|
|
576
|
-
return BigInt(value);
|
|
577
|
-
} catch {
|
|
578
|
-
throw new Error("Invalid bigint");
|
|
579
889
|
}
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
890
|
+
return value;
|
|
891
|
+
})
|
|
892
|
+
.Encode(BigInt);
|
|
583
893
|
boolean = Type.Transform(
|
|
584
894
|
Type.Union(
|
|
585
895
|
[
|
|
586
896
|
Type.Boolean(),
|
|
587
897
|
Type.String({
|
|
588
|
-
pattern:
|
|
898
|
+
pattern: '^(t|T)(r|R)(u|U)(e|E)$|^(f|F)(a|A)(l|L)(s|S)(e|E)$'
|
|
589
899
|
})
|
|
590
900
|
],
|
|
591
901
|
{
|
|
592
|
-
errorType:
|
|
902
|
+
errorType: 'boolean-like',
|
|
593
903
|
example: true,
|
|
594
|
-
title:
|
|
904
|
+
title: 'Boolean'
|
|
595
905
|
}
|
|
596
906
|
)
|
|
597
|
-
)
|
|
598
|
-
|
|
599
|
-
if (value
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
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);
|
|
605
917
|
date = Type.Transform(
|
|
606
918
|
Type.Union(
|
|
607
919
|
[
|
|
608
920
|
Type.String({
|
|
609
|
-
pattern:
|
|
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+$'
|
|
610
923
|
}),
|
|
611
924
|
Type.Number(),
|
|
612
925
|
Type.Date()
|
|
613
926
|
],
|
|
614
927
|
{
|
|
615
|
-
errorType:
|
|
616
|
-
example:
|
|
617
|
-
title:
|
|
928
|
+
errorType: 'date',
|
|
929
|
+
example: '2025-05-16T21:13:04.123Z',
|
|
930
|
+
title: 'Date'
|
|
618
931
|
}
|
|
619
932
|
)
|
|
620
|
-
)
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
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());
|
|
626
941
|
symbol = Type.Symbol({
|
|
627
|
-
title:
|
|
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'
|
|
628
949
|
});
|
|
629
|
-
nullish = Type.Union(
|
|
630
|
-
[Type.Void(), Type.Null(), Type.Undefined()],
|
|
631
|
-
{
|
|
632
|
-
errorType: "nullish",
|
|
633
|
-
type: "null",
|
|
634
|
-
example: "null",
|
|
635
|
-
title: "Nullish"
|
|
636
|
-
}
|
|
637
|
-
);
|
|
638
950
|
void = Type.Void({
|
|
639
|
-
type:
|
|
640
|
-
example:
|
|
641
|
-
title:
|
|
951
|
+
type: 'null',
|
|
952
|
+
example: 'void',
|
|
953
|
+
title: 'Void'
|
|
642
954
|
});
|
|
643
955
|
null = Type.Null({
|
|
644
|
-
type:
|
|
645
|
-
example:
|
|
646
|
-
title:
|
|
956
|
+
type: 'null',
|
|
957
|
+
example: 'null',
|
|
958
|
+
title: 'Null'
|
|
647
959
|
});
|
|
648
960
|
undefined = Type.Undefined({
|
|
649
|
-
type:
|
|
650
|
-
example:
|
|
651
|
-
title:
|
|
961
|
+
type: 'null',
|
|
962
|
+
example: 'undefined',
|
|
963
|
+
title: 'Undefined'
|
|
652
964
|
});
|
|
653
965
|
any = Type.Any({
|
|
654
|
-
type:
|
|
655
|
-
example:
|
|
656
|
-
title:
|
|
966
|
+
type: 'object',
|
|
967
|
+
example: 'any',
|
|
968
|
+
title: 'Any'
|
|
657
969
|
});
|
|
658
970
|
unknown = Type.Unknown({
|
|
659
|
-
type:
|
|
660
|
-
example:
|
|
661
|
-
title:
|
|
971
|
+
type: 'object',
|
|
972
|
+
example: 'unknown',
|
|
973
|
+
title: 'Unknown'
|
|
662
974
|
});
|
|
663
975
|
never = Type.Never({
|
|
664
|
-
type:
|
|
665
|
-
example:
|
|
666
|
-
title:
|
|
976
|
+
type: 'null',
|
|
977
|
+
example: 'never',
|
|
978
|
+
title: 'Never'
|
|
667
979
|
});
|
|
668
980
|
binary = Type.Transform(
|
|
669
981
|
Type.String({
|
|
670
|
-
errorType:
|
|
671
|
-
format:
|
|
672
|
-
example:
|
|
673
|
-
title:
|
|
982
|
+
errorType: 'binary',
|
|
983
|
+
format: 'binary',
|
|
984
|
+
example: 'a utf-8 encodable string',
|
|
985
|
+
title: 'Binary'
|
|
674
986
|
})
|
|
675
|
-
)
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
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
|
+
});
|
|
681
995
|
file = Type.Transform(
|
|
682
996
|
Type.String({
|
|
683
|
-
errorType:
|
|
684
|
-
format:
|
|
685
|
-
example:
|
|
686
|
-
title:
|
|
997
|
+
errorType: 'binary',
|
|
998
|
+
format: 'binary',
|
|
999
|
+
example: 'a utf-8 encodable string',
|
|
1000
|
+
title: 'File'
|
|
687
1001
|
})
|
|
688
|
-
)
|
|
689
|
-
(
|
|
690
|
-
|
|
1002
|
+
)
|
|
1003
|
+
.Decode(
|
|
1004
|
+
(value) => (name, type22) =>
|
|
1005
|
+
new InMemoryFile(value, name, { type: type22 })
|
|
1006
|
+
)
|
|
1007
|
+
.Encode((value) => value('name', 'type').content);
|
|
691
1008
|
type = () => this.any;
|
|
692
1009
|
/**
|
|
693
1010
|
* Extracts the error type of a schema for error messages.
|
|
@@ -696,7 +1013,7 @@ var TypeboxSchemaValidator = class {
|
|
|
696
1013
|
* @returns The type of the schema for error messages.
|
|
697
1014
|
*/
|
|
698
1015
|
errorType(schema) {
|
|
699
|
-
if (KindGuard.IsSchema(schema) && Object.hasOwn(schema,
|
|
1016
|
+
if (KindGuard.IsSchema(schema) && Object.hasOwn(schema, 'errorType')) {
|
|
700
1017
|
return schema.errorType;
|
|
701
1018
|
} else if (KindGuard.IsLiteral(schema)) {
|
|
702
1019
|
return schema.const;
|
|
@@ -721,7 +1038,11 @@ var TypeboxSchemaValidator = class {
|
|
|
721
1038
|
if (KindGuard.IsSchema(schema) || schema instanceof TypeCheck) {
|
|
722
1039
|
return schema;
|
|
723
1040
|
}
|
|
724
|
-
if (
|
|
1041
|
+
if (
|
|
1042
|
+
typeof schema === 'string' ||
|
|
1043
|
+
typeof schema === 'number' ||
|
|
1044
|
+
typeof schema === 'boolean'
|
|
1045
|
+
) {
|
|
725
1046
|
return Type.Literal(schema);
|
|
726
1047
|
}
|
|
727
1048
|
const newSchema = {};
|
|
@@ -768,7 +1089,7 @@ var TypeboxSchemaValidator = class {
|
|
|
768
1089
|
return this.schemify(schema);
|
|
769
1090
|
});
|
|
770
1091
|
return Type.Union(unionTypes, {
|
|
771
|
-
errorType: `any of ${unionTypes.map((s) => this.errorType(s)).join(
|
|
1092
|
+
errorType: `any of ${unionTypes.map((s) => this.errorType(s)).join(', ')}`,
|
|
772
1093
|
errorSuffix: true
|
|
773
1094
|
});
|
|
774
1095
|
}
|
|
@@ -839,7 +1160,12 @@ var TypeboxSchemaValidator = class {
|
|
|
839
1160
|
* @returns {boolean} True if the value is an instance of the schema.
|
|
840
1161
|
*/
|
|
841
1162
|
isInstanceOf(value, type22) {
|
|
842
|
-
return
|
|
1163
|
+
return (
|
|
1164
|
+
typeof value === 'object' &&
|
|
1165
|
+
value != null &&
|
|
1166
|
+
Kind in value &&
|
|
1167
|
+
value[Kind] === type22[Kind]
|
|
1168
|
+
);
|
|
843
1169
|
}
|
|
844
1170
|
/**
|
|
845
1171
|
* Validate a value against a schema.
|
|
@@ -880,33 +1206,38 @@ var TypeboxSchemaValidator = class {
|
|
|
880
1206
|
errors = Array.from(Value.Errors(schemified, value));
|
|
881
1207
|
}
|
|
882
1208
|
}
|
|
883
|
-
return errors != null && errors.length === 0
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
ok: false,
|
|
888
|
-
errors: errors.flatMap((error) => {
|
|
889
|
-
if (error.type === ValueErrorType.Union && error.schema.errorType.includes("any of")) {
|
|
890
|
-
return error.errors.flatMap(
|
|
891
|
-
(e, idx) => Array.from(e).map((e2) => ({
|
|
892
|
-
path: [
|
|
893
|
-
`Union Schema Variant ${idx}`,
|
|
894
|
-
...error.path.split("/").slice(1),
|
|
895
|
-
...e2.path.split("/").slice(1)
|
|
896
|
-
],
|
|
897
|
-
message: e2.message
|
|
898
|
-
}))
|
|
899
|
-
);
|
|
900
|
-
} else {
|
|
901
|
-
return [
|
|
902
|
-
{
|
|
903
|
-
path: error.path.split("/").slice(1),
|
|
904
|
-
message: error.message
|
|
905
|
-
}
|
|
906
|
-
];
|
|
1209
|
+
return errors != null && errors.length === 0
|
|
1210
|
+
? {
|
|
1211
|
+
ok: true,
|
|
1212
|
+
value: conversion
|
|
907
1213
|
}
|
|
908
|
-
|
|
909
|
-
|
|
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
|
+
};
|
|
910
1241
|
}
|
|
911
1242
|
/**
|
|
912
1243
|
* Convert a schema to an OpenAPI schema object.
|
|
@@ -917,11 +1248,11 @@ var TypeboxSchemaValidator = class {
|
|
|
917
1248
|
let schemified = this.schemify(schema);
|
|
918
1249
|
if (KindGuard.IsDate(schemified)) {
|
|
919
1250
|
schemified = Type.String({
|
|
920
|
-
format:
|
|
1251
|
+
format: 'date-time'
|
|
921
1252
|
});
|
|
922
1253
|
}
|
|
923
1254
|
const newSchema = Object.assign({}, schemified);
|
|
924
|
-
if (Object.hasOwn(newSchema,
|
|
1255
|
+
if (Object.hasOwn(newSchema, 'properties')) {
|
|
925
1256
|
if (newSchema.properties) {
|
|
926
1257
|
Object.entries({ ...schemified.properties }).forEach(([key, value]) => {
|
|
927
1258
|
if (KindGuard.IsSchema(value) && newSchema.properties) {
|
|
@@ -930,21 +1261,17 @@ var TypeboxSchemaValidator = class {
|
|
|
930
1261
|
});
|
|
931
1262
|
}
|
|
932
1263
|
}
|
|
933
|
-
if (Object.hasOwn(newSchema,
|
|
1264
|
+
if (Object.hasOwn(newSchema, 'items')) {
|
|
934
1265
|
newSchema.items = this.openapi(newSchema.items);
|
|
935
1266
|
}
|
|
936
1267
|
if (Array.isArray(newSchema.anyOf)) {
|
|
937
|
-
newSchema.anyOf = newSchema.anyOf.map(
|
|
938
|
-
(item) => this.openapi(item)
|
|
939
|
-
);
|
|
1268
|
+
newSchema.anyOf = newSchema.anyOf.map((item) => this.openapi(item));
|
|
940
1269
|
}
|
|
941
1270
|
if (Array.isArray(newSchema.oneOf)) {
|
|
942
|
-
newSchema.oneOf = newSchema.oneOf.map(
|
|
943
|
-
(item) => this.openapi(item)
|
|
944
|
-
);
|
|
1271
|
+
newSchema.oneOf = newSchema.oneOf.map((item) => this.openapi(item));
|
|
945
1272
|
}
|
|
946
|
-
if (
|
|
947
|
-
delete newSchema[
|
|
1273
|
+
if ('errorType' in newSchema) {
|
|
1274
|
+
delete newSchema['errorType'];
|
|
948
1275
|
}
|
|
949
1276
|
return newSchema;
|
|
950
1277
|
}
|
|
@@ -984,164 +1311,177 @@ var validate = StaticSchemaValidator.validate.bind(StaticSchemaValidator);
|
|
|
984
1311
|
var parse = StaticSchemaValidator.parse.bind(StaticSchemaValidator);
|
|
985
1312
|
var openapi = StaticSchemaValidator.openapi.bind(StaticSchemaValidator);
|
|
986
1313
|
|
|
987
|
-
// schemas/typebox/redisWorker.schema.ts
|
|
1314
|
+
// domain/schemas/typebox/redisWorker.schema.ts
|
|
988
1315
|
var RedisWorkerOptionsSchema = {
|
|
989
1316
|
pageSize: number,
|
|
990
1317
|
retries: number,
|
|
991
1318
|
interval: number
|
|
992
1319
|
};
|
|
993
1320
|
|
|
994
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.6.
|
|
1321
|
+
// ../../../node_modules/.pnpm/@forklaunch+validator@0.6.16_openapi3-ts@4.4.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
|
|
995
1322
|
var import_zod_openapi = __toESM(require_src(), 1);
|
|
996
|
-
import {
|
|
997
|
-
z,
|
|
998
|
-
ZodType
|
|
999
|
-
} from "zod";
|
|
1323
|
+
import { z, ZodType } from 'zod';
|
|
1000
1324
|
(0, import_zod_openapi.extendZodWithOpenApi)(z);
|
|
1001
1325
|
var ZodSchemaValidator = class {
|
|
1002
|
-
_Type =
|
|
1326
|
+
_Type = 'Zod';
|
|
1003
1327
|
_SchemaCatchall;
|
|
1004
1328
|
_ValidSchemaObject;
|
|
1005
1329
|
string = z.string().openapi({
|
|
1006
|
-
title:
|
|
1007
|
-
example:
|
|
1330
|
+
title: 'String',
|
|
1331
|
+
example: 'a string'
|
|
1008
1332
|
});
|
|
1009
1333
|
uuid = z.string().uuid().openapi({
|
|
1010
|
-
title:
|
|
1011
|
-
format:
|
|
1012
|
-
pattern:
|
|
1013
|
-
|
|
1334
|
+
title: 'UUID',
|
|
1335
|
+
format: 'uuid',
|
|
1336
|
+
pattern:
|
|
1337
|
+
'^[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}$',
|
|
1338
|
+
example: 'a8b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6'
|
|
1014
1339
|
});
|
|
1015
1340
|
email = z.string().email().openapi({
|
|
1016
|
-
title:
|
|
1017
|
-
format:
|
|
1341
|
+
title: 'Email',
|
|
1342
|
+
format: 'email',
|
|
1018
1343
|
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])+)])`,
|
|
1019
|
-
example:
|
|
1344
|
+
example: 'a@b.com'
|
|
1020
1345
|
});
|
|
1021
1346
|
uri = z.string().url().openapi({
|
|
1022
|
-
title:
|
|
1023
|
-
format:
|
|
1024
|
-
pattern:
|
|
1025
|
-
example:
|
|
1347
|
+
title: 'URI',
|
|
1348
|
+
format: 'uri',
|
|
1349
|
+
pattern: '^[a-zA-Z][a-zA-Z\\d+-.]*:[^\\s]*$',
|
|
1350
|
+
example: 'https://forklaunch.com'
|
|
1026
1351
|
});
|
|
1027
|
-
number = z
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
}, z.number()).openapi({
|
|
1034
|
-
title: "Number",
|
|
1035
|
-
example: 123
|
|
1036
|
-
});
|
|
1037
|
-
bigint = z.preprocess((value) => {
|
|
1038
|
-
try {
|
|
1039
|
-
if (value instanceof Date) {
|
|
1040
|
-
return BigInt(value.getTime());
|
|
1352
|
+
number = z
|
|
1353
|
+
.preprocess((value) => {
|
|
1354
|
+
try {
|
|
1355
|
+
return Number(value);
|
|
1356
|
+
} catch {
|
|
1357
|
+
return value;
|
|
1041
1358
|
}
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1359
|
+
}, z.number())
|
|
1360
|
+
.openapi({
|
|
1361
|
+
title: 'Number',
|
|
1362
|
+
example: 123
|
|
1363
|
+
});
|
|
1364
|
+
bigint = z
|
|
1365
|
+
.preprocess((value) => {
|
|
1366
|
+
try {
|
|
1367
|
+
if (value instanceof Date) {
|
|
1368
|
+
return BigInt(value.getTime());
|
|
1369
|
+
}
|
|
1370
|
+
switch (typeof value) {
|
|
1371
|
+
case 'number':
|
|
1372
|
+
case 'string':
|
|
1373
|
+
return BigInt(value);
|
|
1374
|
+
case 'boolean':
|
|
1375
|
+
return BigInt(value ? 1 : 0);
|
|
1376
|
+
default:
|
|
1377
|
+
return value;
|
|
1378
|
+
}
|
|
1379
|
+
} catch {
|
|
1380
|
+
return value;
|
|
1050
1381
|
}
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
if (val.toLowerCase() === "false") return false;
|
|
1064
|
-
}
|
|
1065
|
-
return val;
|
|
1066
|
-
}, z.boolean()).openapi({
|
|
1067
|
-
title: "Boolean",
|
|
1068
|
-
example: true
|
|
1069
|
-
});
|
|
1070
|
-
date = z.preprocess((value) => {
|
|
1071
|
-
try {
|
|
1072
|
-
switch (typeof value) {
|
|
1073
|
-
case "string":
|
|
1074
|
-
return new Date(value);
|
|
1075
|
-
case "number":
|
|
1076
|
-
return new Date(value);
|
|
1077
|
-
default:
|
|
1078
|
-
return value;
|
|
1382
|
+
}, z.bigint())
|
|
1383
|
+
.openapi({
|
|
1384
|
+
title: 'BigInt',
|
|
1385
|
+
type: 'integer',
|
|
1386
|
+
format: 'int64',
|
|
1387
|
+
example: 123n
|
|
1388
|
+
});
|
|
1389
|
+
boolean = z
|
|
1390
|
+
.preprocess((val) => {
|
|
1391
|
+
if (typeof val === 'string') {
|
|
1392
|
+
if (val.toLowerCase() === 'true') return true;
|
|
1393
|
+
if (val.toLowerCase() === 'false') return false;
|
|
1079
1394
|
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1395
|
+
return val;
|
|
1396
|
+
}, z.boolean())
|
|
1397
|
+
.openapi({
|
|
1398
|
+
title: 'Boolean',
|
|
1399
|
+
example: true
|
|
1400
|
+
});
|
|
1401
|
+
date = z
|
|
1402
|
+
.preprocess((value) => {
|
|
1403
|
+
try {
|
|
1404
|
+
switch (typeof value) {
|
|
1405
|
+
case 'string':
|
|
1406
|
+
return new Date(value);
|
|
1407
|
+
case 'number':
|
|
1408
|
+
return new Date(value);
|
|
1409
|
+
default:
|
|
1410
|
+
return value;
|
|
1411
|
+
}
|
|
1412
|
+
} catch {
|
|
1413
|
+
return value;
|
|
1414
|
+
}
|
|
1415
|
+
}, z.date())
|
|
1416
|
+
.openapi({
|
|
1417
|
+
title: 'Date',
|
|
1418
|
+
type: 'string',
|
|
1419
|
+
format: 'date-time',
|
|
1420
|
+
example: '2025-05-16T21:13:04.123Z'
|
|
1421
|
+
});
|
|
1089
1422
|
symbol = z.symbol().openapi({
|
|
1090
|
-
title:
|
|
1091
|
-
example: Symbol(
|
|
1423
|
+
title: 'Symbol',
|
|
1424
|
+
example: Symbol('symbol')
|
|
1092
1425
|
});
|
|
1093
1426
|
nullish = z.union([z.void(), z.null(), z.undefined()]).openapi({
|
|
1094
|
-
title:
|
|
1095
|
-
type:
|
|
1427
|
+
title: 'Nullish',
|
|
1428
|
+
type: 'null',
|
|
1096
1429
|
example: null
|
|
1097
1430
|
});
|
|
1098
1431
|
void = z.void().openapi({
|
|
1099
|
-
title:
|
|
1100
|
-
type:
|
|
1432
|
+
title: 'Void',
|
|
1433
|
+
type: 'null',
|
|
1101
1434
|
example: void 0
|
|
1102
1435
|
});
|
|
1103
1436
|
null = z.null().openapi({
|
|
1104
|
-
title:
|
|
1105
|
-
type:
|
|
1437
|
+
title: 'Null',
|
|
1438
|
+
type: 'null',
|
|
1106
1439
|
example: null
|
|
1107
1440
|
});
|
|
1108
1441
|
undefined = z.undefined().openapi({
|
|
1109
|
-
title:
|
|
1110
|
-
type:
|
|
1442
|
+
title: 'Undefined',
|
|
1443
|
+
type: 'null',
|
|
1111
1444
|
example: void 0
|
|
1112
1445
|
});
|
|
1113
1446
|
any = z.any().openapi({
|
|
1114
|
-
title:
|
|
1115
|
-
type:
|
|
1116
|
-
example:
|
|
1447
|
+
title: 'Any',
|
|
1448
|
+
type: 'object',
|
|
1449
|
+
example: 'any'
|
|
1117
1450
|
});
|
|
1118
1451
|
unknown = z.unknown().openapi({
|
|
1119
|
-
title:
|
|
1120
|
-
type:
|
|
1121
|
-
example:
|
|
1452
|
+
title: 'Unknown',
|
|
1453
|
+
type: 'object',
|
|
1454
|
+
example: 'unknown'
|
|
1122
1455
|
});
|
|
1123
1456
|
never = z.never().openapi({
|
|
1124
|
-
title:
|
|
1125
|
-
type:
|
|
1126
|
-
example:
|
|
1457
|
+
title: 'Never',
|
|
1458
|
+
type: 'null',
|
|
1459
|
+
example: 'never'
|
|
1127
1460
|
});
|
|
1128
|
-
binary = z
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1461
|
+
binary = z
|
|
1462
|
+
.string()
|
|
1463
|
+
.transform((v) => new TextEncoder().encode(v))
|
|
1464
|
+
.openapi({
|
|
1465
|
+
title: 'Binary',
|
|
1466
|
+
type: 'string',
|
|
1467
|
+
format: 'binary',
|
|
1468
|
+
example: 'a utf-8 encodable string'
|
|
1469
|
+
});
|
|
1470
|
+
file = z
|
|
1471
|
+
.string()
|
|
1472
|
+
.transform((val) => {
|
|
1473
|
+
return (name, type22) =>
|
|
1474
|
+
new File([val], name, {
|
|
1475
|
+
type: type22,
|
|
1476
|
+
lastModified: Date.now()
|
|
1477
|
+
});
|
|
1478
|
+
})
|
|
1479
|
+
.openapi({
|
|
1480
|
+
title: 'File',
|
|
1481
|
+
type: 'string',
|
|
1482
|
+
format: 'binary',
|
|
1483
|
+
example: 'a utf-8 encodable string'
|
|
1138
1484
|
});
|
|
1139
|
-
}).openapi({
|
|
1140
|
-
title: "File",
|
|
1141
|
-
type: "string",
|
|
1142
|
-
format: "binary",
|
|
1143
|
-
example: "a utf-8 encodable string"
|
|
1144
|
-
});
|
|
1145
1485
|
type = () => this.any;
|
|
1146
1486
|
/**
|
|
1147
1487
|
* Compiles schema if this exists, for optimal performance.
|
|
@@ -1158,7 +1498,11 @@ var ZodSchemaValidator = class {
|
|
|
1158
1498
|
* @returns {ZodResolve<T>} The resolved schema.
|
|
1159
1499
|
*/
|
|
1160
1500
|
schemify(schema) {
|
|
1161
|
-
if (
|
|
1501
|
+
if (
|
|
1502
|
+
typeof schema === 'string' ||
|
|
1503
|
+
typeof schema === 'number' ||
|
|
1504
|
+
typeof schema === 'boolean'
|
|
1505
|
+
) {
|
|
1162
1506
|
return z.literal(schema);
|
|
1163
1507
|
}
|
|
1164
1508
|
if (schema instanceof ZodType) {
|
|
@@ -1199,9 +1543,7 @@ var ZodSchemaValidator = class {
|
|
|
1199
1543
|
*/
|
|
1200
1544
|
union(schemas) {
|
|
1201
1545
|
const resolvedSchemas = schemas.map((schema) => this.schemify(schema));
|
|
1202
|
-
return z.union(
|
|
1203
|
-
resolvedSchemas
|
|
1204
|
-
);
|
|
1546
|
+
return z.union(resolvedSchemas);
|
|
1205
1547
|
}
|
|
1206
1548
|
/**
|
|
1207
1549
|
* Create a literal schema.
|
|
@@ -1217,9 +1559,7 @@ var ZodSchemaValidator = class {
|
|
|
1217
1559
|
* @returns {ZodUnion<UnionZodResolve<[T, T, ...T[]]>>} The enum schema.
|
|
1218
1560
|
*/
|
|
1219
1561
|
enum_(schemaEnum) {
|
|
1220
|
-
return this.union(
|
|
1221
|
-
Object.values(schemaEnum)
|
|
1222
|
-
);
|
|
1562
|
+
return this.union(Object.values(schemaEnum));
|
|
1223
1563
|
}
|
|
1224
1564
|
/**
|
|
1225
1565
|
* Create a function schema.
|
|
@@ -1288,31 +1628,33 @@ var ZodSchemaValidator = class {
|
|
|
1288
1628
|
parse(schema, value) {
|
|
1289
1629
|
const resolvedSchema = this.schemify(schema);
|
|
1290
1630
|
const result = resolvedSchema.safeParse(value);
|
|
1291
|
-
return result.success
|
|
1292
|
-
ok:
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1631
|
+
return result.success
|
|
1632
|
+
? { ok: true, value: result.data }
|
|
1633
|
+
: {
|
|
1634
|
+
ok: false,
|
|
1635
|
+
errors: result.error.errors.flatMap((error) => {
|
|
1636
|
+
switch (error.code) {
|
|
1637
|
+
case 'invalid_union':
|
|
1638
|
+
return error.unionErrors.flatMap((unionError, idx) =>
|
|
1639
|
+
unionError.errors.map((e) => ({
|
|
1640
|
+
path: [
|
|
1641
|
+
`Union Schema Variant ${idx}`,
|
|
1642
|
+
...error.path.map((p) => p.toString()),
|
|
1643
|
+
...e.path.map((p) => p.toString())
|
|
1644
|
+
],
|
|
1645
|
+
message: e.message
|
|
1646
|
+
}))
|
|
1647
|
+
);
|
|
1648
|
+
default:
|
|
1649
|
+
return [
|
|
1650
|
+
{
|
|
1651
|
+
path: error.path.map((p) => p.toString()),
|
|
1652
|
+
message: error.message
|
|
1653
|
+
}
|
|
1654
|
+
];
|
|
1655
|
+
}
|
|
1656
|
+
})
|
|
1657
|
+
};
|
|
1316
1658
|
}
|
|
1317
1659
|
/**
|
|
1318
1660
|
* Convert a schema to an OpenAPI schema object.
|
|
@@ -1358,18 +1700,16 @@ var validate2 = StaticSchemaValidator2.validate.bind(StaticSchemaValidator2);
|
|
|
1358
1700
|
var parse2 = StaticSchemaValidator2.parse.bind(StaticSchemaValidator2);
|
|
1359
1701
|
var openapi2 = StaticSchemaValidator2.openapi.bind(StaticSchemaValidator2);
|
|
1360
1702
|
|
|
1361
|
-
// schemas/zod/redisWorker.schema.ts
|
|
1703
|
+
// domain/schemas/zod/redisWorker.schema.ts
|
|
1362
1704
|
var RedisWorkerOptionsSchema2 = {
|
|
1363
1705
|
pageSize: number2,
|
|
1364
1706
|
retries: number2,
|
|
1365
1707
|
interval: number2
|
|
1366
1708
|
};
|
|
1367
1709
|
|
|
1368
|
-
// schemas/redisWorker.schema.ts
|
|
1710
|
+
// domain/schemas/redisWorker.schema.ts
|
|
1369
1711
|
var RedisWorkerSchemas = serviceSchemaResolver(
|
|
1370
1712
|
() => RedisWorkerOptionsSchema,
|
|
1371
1713
|
() => RedisWorkerOptionsSchema2
|
|
1372
1714
|
);
|
|
1373
|
-
export {
|
|
1374
|
-
RedisWorkerSchemas
|
|
1375
|
-
};
|
|
1715
|
+
export { RedisWorkerSchemas };
|