@forklaunch/implementation-worker-kafka 0.7.3 → 0.8.1
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/domain/schemas/index.js +161 -23
- package/lib/domain/schemas/index.mjs +163 -24
- package/package.json +8 -8
|
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(schemas_exports);
|
|
|
28
28
|
// domain/schemas/kafka.schema.ts
|
|
29
29
|
var import_internal = require("@forklaunch/internal");
|
|
30
30
|
|
|
31
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.
|
|
31
|
+
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.18/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
|
|
32
32
|
var typebox_exports = {};
|
|
33
33
|
__export(typebox_exports, {
|
|
34
34
|
SchemaValidator: () => SchemaValidator,
|
|
@@ -68,7 +68,79 @@ __export(typebox_exports, {
|
|
|
68
68
|
});
|
|
69
69
|
__reExport(typebox_exports, require("@sinclair/typebox"));
|
|
70
70
|
|
|
71
|
-
// ../../../node_modules/.pnpm/@forklaunch+common@0.6.
|
|
71
|
+
// ../../../node_modules/.pnpm/@forklaunch+common@0.6.18/node_modules/@forklaunch/common/lib/index.mjs
|
|
72
|
+
function deepCloneWithoutUndefined(obj, seen = /* @__PURE__ */ new WeakMap()) {
|
|
73
|
+
if (obj === null || obj === void 0) {
|
|
74
|
+
return obj;
|
|
75
|
+
}
|
|
76
|
+
if (typeof obj !== "object" && typeof obj !== "function") {
|
|
77
|
+
return obj;
|
|
78
|
+
}
|
|
79
|
+
if (seen.has(obj)) {
|
|
80
|
+
return seen.get(obj);
|
|
81
|
+
}
|
|
82
|
+
if (obj instanceof Date) {
|
|
83
|
+
return new Date(obj.getTime());
|
|
84
|
+
}
|
|
85
|
+
if (obj instanceof RegExp) {
|
|
86
|
+
return new RegExp(obj.source, obj.flags);
|
|
87
|
+
}
|
|
88
|
+
if (obj instanceof Map) {
|
|
89
|
+
const clonedMap = /* @__PURE__ */ new Map();
|
|
90
|
+
seen.set(obj, clonedMap);
|
|
91
|
+
obj.forEach((value, key) => {
|
|
92
|
+
if (value !== void 0) {
|
|
93
|
+
clonedMap.set(key, deepCloneWithoutUndefined(value, seen));
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return clonedMap;
|
|
97
|
+
}
|
|
98
|
+
if (obj instanceof Set) {
|
|
99
|
+
const clonedSet = /* @__PURE__ */ new Set();
|
|
100
|
+
seen.set(obj, clonedSet);
|
|
101
|
+
obj.forEach((value) => {
|
|
102
|
+
if (value !== void 0) {
|
|
103
|
+
clonedSet.add(deepCloneWithoutUndefined(value, seen));
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return clonedSet;
|
|
107
|
+
}
|
|
108
|
+
if (Array.isArray(obj)) {
|
|
109
|
+
const clonedArray = [];
|
|
110
|
+
seen.set(obj, clonedArray);
|
|
111
|
+
for (const item of obj) {
|
|
112
|
+
if (item !== void 0) {
|
|
113
|
+
clonedArray.push(deepCloneWithoutUndefined(item, seen));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return clonedArray;
|
|
117
|
+
}
|
|
118
|
+
if (typeof obj === "function") {
|
|
119
|
+
return obj;
|
|
120
|
+
}
|
|
121
|
+
const proto = Object.getPrototypeOf(obj);
|
|
122
|
+
const cloned = Object.create(proto);
|
|
123
|
+
seen.set(obj, cloned);
|
|
124
|
+
const allKeys = [
|
|
125
|
+
...Object.getOwnPropertyNames(obj),
|
|
126
|
+
...Object.getOwnPropertySymbols(obj)
|
|
127
|
+
];
|
|
128
|
+
for (const key of allKeys) {
|
|
129
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, key);
|
|
130
|
+
if (!descriptor) continue;
|
|
131
|
+
if ("value" in descriptor) {
|
|
132
|
+
if (descriptor.value !== void 0) {
|
|
133
|
+
Object.defineProperty(cloned, key, {
|
|
134
|
+
...descriptor,
|
|
135
|
+
value: deepCloneWithoutUndefined(descriptor.value, seen)
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
Object.defineProperty(cloned, key, descriptor);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return cloned;
|
|
143
|
+
}
|
|
72
144
|
var InMemoryBlob = class extends Blob {
|
|
73
145
|
constructor(content) {
|
|
74
146
|
super([content]);
|
|
@@ -76,12 +148,18 @@ var InMemoryBlob = class extends Blob {
|
|
|
76
148
|
}
|
|
77
149
|
};
|
|
78
150
|
|
|
79
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.
|
|
151
|
+
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.18/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
|
|
80
152
|
var import_typebox = require("@sinclair/typebox");
|
|
81
153
|
var import_compiler = require("@sinclair/typebox/compiler");
|
|
82
154
|
var import_errors = require("@sinclair/typebox/errors");
|
|
83
155
|
var import_value = require("@sinclair/typebox/value");
|
|
84
156
|
import_typebox.FormatRegistry.Set("binary", (value) => typeof value === "string");
|
|
157
|
+
import_typebox.TypeRegistry.Set("Blob", (_schema, value) => value instanceof Blob);
|
|
158
|
+
import_typebox.TypeRegistry.Set(
|
|
159
|
+
"ArrayBuffer",
|
|
160
|
+
(_schema, value) => value instanceof ArrayBuffer
|
|
161
|
+
);
|
|
162
|
+
import_typebox.TypeRegistry.Set("Buffer", (_schema, value) => value instanceof Buffer);
|
|
85
163
|
(0, import_errors.SetErrorFunction)((params) => {
|
|
86
164
|
switch (params.errorType) {
|
|
87
165
|
case import_errors.ValueErrorType.Union:
|
|
@@ -273,14 +351,49 @@ var TypeboxSchemaValidator = class {
|
|
|
273
351
|
return "";
|
|
274
352
|
});
|
|
275
353
|
file = import_typebox.Type.Transform(
|
|
276
|
-
import_typebox.Type.
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
354
|
+
import_typebox.Type.Union([
|
|
355
|
+
import_typebox.Type.Unsafe({
|
|
356
|
+
[import_typebox.Kind]: "Buffer",
|
|
357
|
+
errorType: "binary",
|
|
358
|
+
format: "binary",
|
|
359
|
+
example: "a raw buffer or file stream",
|
|
360
|
+
title: "File"
|
|
361
|
+
}),
|
|
362
|
+
import_typebox.Type.Unsafe({
|
|
363
|
+
[import_typebox.Kind]: "ArrayBuffer",
|
|
364
|
+
errorType: "binary",
|
|
365
|
+
format: "binary",
|
|
366
|
+
example: "an array buffer",
|
|
367
|
+
title: "File"
|
|
368
|
+
}),
|
|
369
|
+
import_typebox.Type.Unsafe({
|
|
370
|
+
[import_typebox.Kind]: "Blob",
|
|
371
|
+
errorType: "binary",
|
|
372
|
+
format: "binary",
|
|
373
|
+
example: "a blob object",
|
|
374
|
+
title: "File"
|
|
375
|
+
}),
|
|
376
|
+
import_typebox.Type.String({
|
|
377
|
+
errorType: "binary",
|
|
378
|
+
format: "binary",
|
|
379
|
+
example: "a string content",
|
|
380
|
+
title: "File"
|
|
381
|
+
})
|
|
382
|
+
])
|
|
282
383
|
).Decode((value) => {
|
|
283
|
-
|
|
384
|
+
if (value instanceof Buffer) {
|
|
385
|
+
return new InMemoryBlob(value);
|
|
386
|
+
}
|
|
387
|
+
if (value instanceof ArrayBuffer) {
|
|
388
|
+
return new InMemoryBlob(Buffer.from(value));
|
|
389
|
+
}
|
|
390
|
+
if (value instanceof Blob) {
|
|
391
|
+
return value;
|
|
392
|
+
}
|
|
393
|
+
if (typeof value === "string") {
|
|
394
|
+
return new InMemoryBlob(Buffer.from(value));
|
|
395
|
+
}
|
|
396
|
+
return new InMemoryBlob(Buffer.from(value));
|
|
284
397
|
}).Encode((value) => value.content);
|
|
285
398
|
type = () => this.any;
|
|
286
399
|
/**
|
|
@@ -320,7 +433,7 @@ var TypeboxSchemaValidator = class {
|
|
|
320
433
|
}
|
|
321
434
|
const newSchema = {};
|
|
322
435
|
Object.getOwnPropertyNames(schema).forEach((key) => {
|
|
323
|
-
if (import_typebox.KindGuard.IsSchema(schema[key])) {
|
|
436
|
+
if (import_typebox.KindGuard.IsSchema(schema[key]) || import_typebox.KindGuard.IsTransform(schema[key])) {
|
|
324
437
|
newSchema[key] = schema[key];
|
|
325
438
|
} else {
|
|
326
439
|
const schemified = this.schemify(schema[key]);
|
|
@@ -510,7 +623,7 @@ var TypeboxSchemaValidator = class {
|
|
|
510
623
|
} : {
|
|
511
624
|
ok: false,
|
|
512
625
|
errors: errors.flatMap((error) => {
|
|
513
|
-
if (error.type === import_errors.ValueErrorType.Union && error.schema.errorType
|
|
626
|
+
if (error.type === import_errors.ValueErrorType.Union && error.schema.errorType?.includes("any of")) {
|
|
514
627
|
return error.errors.flatMap(
|
|
515
628
|
(e, idx) => Array.from(e).map((e2) => ({
|
|
516
629
|
path: [
|
|
@@ -538,20 +651,25 @@ var TypeboxSchemaValidator = class {
|
|
|
538
651
|
* @returns {SchemaObject} The OpenAPI schema object.
|
|
539
652
|
*/
|
|
540
653
|
openapi(schema) {
|
|
541
|
-
|
|
654
|
+
const schemified = this.schemify(schema);
|
|
655
|
+
let processedSchema;
|
|
542
656
|
if (import_typebox.KindGuard.IsDate(schemified)) {
|
|
543
|
-
|
|
657
|
+
processedSchema = import_typebox.Type.String({
|
|
544
658
|
format: "date-time"
|
|
545
659
|
});
|
|
660
|
+
} else {
|
|
661
|
+
processedSchema = deepCloneWithoutUndefined(schemified);
|
|
546
662
|
}
|
|
547
|
-
const newSchema = Object.assign({},
|
|
663
|
+
const newSchema = Object.assign({}, processedSchema);
|
|
548
664
|
if (Object.hasOwn(newSchema, "properties")) {
|
|
549
665
|
if (newSchema.properties) {
|
|
550
|
-
Object.entries({ ...
|
|
551
|
-
|
|
552
|
-
|
|
666
|
+
Object.entries({ ...processedSchema.properties }).forEach(
|
|
667
|
+
([key, value]) => {
|
|
668
|
+
if (import_typebox.KindGuard.IsSchema(value) && newSchema.properties) {
|
|
669
|
+
newSchema.properties[key] = this.openapi(value);
|
|
670
|
+
}
|
|
553
671
|
}
|
|
554
|
-
|
|
672
|
+
);
|
|
555
673
|
}
|
|
556
674
|
}
|
|
557
675
|
if (Object.hasOwn(newSchema, "items")) {
|
|
@@ -618,7 +736,7 @@ var KafkaWorkerOptionsSchema = {
|
|
|
618
736
|
peekCount: number
|
|
619
737
|
};
|
|
620
738
|
|
|
621
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.
|
|
739
|
+
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.18/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
|
|
622
740
|
var import_v3 = require("zod/v3");
|
|
623
741
|
|
|
624
742
|
// ../../../node_modules/.pnpm/ts-deepmerge@7.0.3/node_modules/ts-deepmerge/esm/index.js
|
|
@@ -668,7 +786,7 @@ merge.withOptions = (options, ...objects) => {
|
|
|
668
786
|
return result;
|
|
669
787
|
};
|
|
670
788
|
|
|
671
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.
|
|
789
|
+
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.18/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
|
|
672
790
|
var import_v32 = require("zod/v3");
|
|
673
791
|
function extendApi(schema, schemaObject = {}) {
|
|
674
792
|
const This = schema.constructor;
|
|
@@ -1377,8 +1495,27 @@ var ZodSchemaValidator = class {
|
|
|
1377
1495
|
format: "binary",
|
|
1378
1496
|
example: "a base-64 encodable string"
|
|
1379
1497
|
});
|
|
1380
|
-
file = import_v3.z.
|
|
1498
|
+
file = import_v3.z.union([
|
|
1499
|
+
import_v3.z.instanceof(Buffer),
|
|
1500
|
+
import_v3.z.instanceof(ArrayBuffer),
|
|
1501
|
+
import_v3.z.instanceof(Blob),
|
|
1502
|
+
import_v3.z.string()
|
|
1503
|
+
]).transform((val) => {
|
|
1504
|
+
if (val instanceof Buffer) {
|
|
1505
|
+
return new Blob([val]);
|
|
1506
|
+
}
|
|
1507
|
+
if (val instanceof ArrayBuffer) {
|
|
1508
|
+
return new Blob([val]);
|
|
1509
|
+
}
|
|
1510
|
+
if (val instanceof Blob) {
|
|
1511
|
+
return val;
|
|
1512
|
+
}
|
|
1513
|
+
if (typeof val === "string") {
|
|
1514
|
+
return new Blob([val]);
|
|
1515
|
+
}
|
|
1381
1516
|
return new Blob([val]);
|
|
1517
|
+
}).refine((val) => val instanceof Blob, {
|
|
1518
|
+
message: "Invalid file type: expected Buffer, ArrayBuffer, Blob, or string"
|
|
1382
1519
|
}).openapi({
|
|
1383
1520
|
title: "File",
|
|
1384
1521
|
type: "string",
|
|
@@ -1563,7 +1700,8 @@ var ZodSchemaValidator = class {
|
|
|
1563
1700
|
* @returns {SchemaObject} The OpenAPI schema object.
|
|
1564
1701
|
*/
|
|
1565
1702
|
openapi(schema) {
|
|
1566
|
-
|
|
1703
|
+
const schemified = this.schemify(schema);
|
|
1704
|
+
return generateSchema(deepCloneWithoutUndefined(schemified));
|
|
1567
1705
|
}
|
|
1568
1706
|
};
|
|
1569
1707
|
var SchemaValidator2 = () => new ZodSchemaValidator();
|
|
@@ -19,7 +19,7 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
19
19
|
// domain/schemas/kafka.schema.ts
|
|
20
20
|
import { serviceSchemaResolver } from "@forklaunch/internal";
|
|
21
21
|
|
|
22
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.
|
|
22
|
+
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.18/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
|
|
23
23
|
var typebox_exports = {};
|
|
24
24
|
__export(typebox_exports, {
|
|
25
25
|
SchemaValidator: () => SchemaValidator,
|
|
@@ -60,7 +60,79 @@ __export(typebox_exports, {
|
|
|
60
60
|
__reExport(typebox_exports, typebox_star);
|
|
61
61
|
import * as typebox_star from "@sinclair/typebox";
|
|
62
62
|
|
|
63
|
-
// ../../../node_modules/.pnpm/@forklaunch+common@0.6.
|
|
63
|
+
// ../../../node_modules/.pnpm/@forklaunch+common@0.6.18/node_modules/@forklaunch/common/lib/index.mjs
|
|
64
|
+
function deepCloneWithoutUndefined(obj, seen = /* @__PURE__ */ new WeakMap()) {
|
|
65
|
+
if (obj === null || obj === void 0) {
|
|
66
|
+
return obj;
|
|
67
|
+
}
|
|
68
|
+
if (typeof obj !== "object" && typeof obj !== "function") {
|
|
69
|
+
return obj;
|
|
70
|
+
}
|
|
71
|
+
if (seen.has(obj)) {
|
|
72
|
+
return seen.get(obj);
|
|
73
|
+
}
|
|
74
|
+
if (obj instanceof Date) {
|
|
75
|
+
return new Date(obj.getTime());
|
|
76
|
+
}
|
|
77
|
+
if (obj instanceof RegExp) {
|
|
78
|
+
return new RegExp(obj.source, obj.flags);
|
|
79
|
+
}
|
|
80
|
+
if (obj instanceof Map) {
|
|
81
|
+
const clonedMap = /* @__PURE__ */ new Map();
|
|
82
|
+
seen.set(obj, clonedMap);
|
|
83
|
+
obj.forEach((value, key) => {
|
|
84
|
+
if (value !== void 0) {
|
|
85
|
+
clonedMap.set(key, deepCloneWithoutUndefined(value, seen));
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return clonedMap;
|
|
89
|
+
}
|
|
90
|
+
if (obj instanceof Set) {
|
|
91
|
+
const clonedSet = /* @__PURE__ */ new Set();
|
|
92
|
+
seen.set(obj, clonedSet);
|
|
93
|
+
obj.forEach((value) => {
|
|
94
|
+
if (value !== void 0) {
|
|
95
|
+
clonedSet.add(deepCloneWithoutUndefined(value, seen));
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return clonedSet;
|
|
99
|
+
}
|
|
100
|
+
if (Array.isArray(obj)) {
|
|
101
|
+
const clonedArray = [];
|
|
102
|
+
seen.set(obj, clonedArray);
|
|
103
|
+
for (const item of obj) {
|
|
104
|
+
if (item !== void 0) {
|
|
105
|
+
clonedArray.push(deepCloneWithoutUndefined(item, seen));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return clonedArray;
|
|
109
|
+
}
|
|
110
|
+
if (typeof obj === "function") {
|
|
111
|
+
return obj;
|
|
112
|
+
}
|
|
113
|
+
const proto = Object.getPrototypeOf(obj);
|
|
114
|
+
const cloned = Object.create(proto);
|
|
115
|
+
seen.set(obj, cloned);
|
|
116
|
+
const allKeys = [
|
|
117
|
+
...Object.getOwnPropertyNames(obj),
|
|
118
|
+
...Object.getOwnPropertySymbols(obj)
|
|
119
|
+
];
|
|
120
|
+
for (const key of allKeys) {
|
|
121
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, key);
|
|
122
|
+
if (!descriptor) continue;
|
|
123
|
+
if ("value" in descriptor) {
|
|
124
|
+
if (descriptor.value !== void 0) {
|
|
125
|
+
Object.defineProperty(cloned, key, {
|
|
126
|
+
...descriptor,
|
|
127
|
+
value: deepCloneWithoutUndefined(descriptor.value, seen)
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
} else {
|
|
131
|
+
Object.defineProperty(cloned, key, descriptor);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return cloned;
|
|
135
|
+
}
|
|
64
136
|
var InMemoryBlob = class extends Blob {
|
|
65
137
|
constructor(content) {
|
|
66
138
|
super([content]);
|
|
@@ -68,12 +140,13 @@ var InMemoryBlob = class extends Blob {
|
|
|
68
140
|
}
|
|
69
141
|
};
|
|
70
142
|
|
|
71
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.
|
|
143
|
+
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.18/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
|
|
72
144
|
import {
|
|
73
145
|
FormatRegistry,
|
|
74
146
|
Kind,
|
|
75
147
|
KindGuard,
|
|
76
|
-
Type
|
|
148
|
+
Type,
|
|
149
|
+
TypeRegistry
|
|
77
150
|
} from "@sinclair/typebox";
|
|
78
151
|
import { TypeCheck, TypeCompiler } from "@sinclair/typebox/compiler";
|
|
79
152
|
import {
|
|
@@ -83,6 +156,12 @@ import {
|
|
|
83
156
|
} from "@sinclair/typebox/errors";
|
|
84
157
|
import { Value } from "@sinclair/typebox/value";
|
|
85
158
|
FormatRegistry.Set("binary", (value) => typeof value === "string");
|
|
159
|
+
TypeRegistry.Set("Blob", (_schema, value) => value instanceof Blob);
|
|
160
|
+
TypeRegistry.Set(
|
|
161
|
+
"ArrayBuffer",
|
|
162
|
+
(_schema, value) => value instanceof ArrayBuffer
|
|
163
|
+
);
|
|
164
|
+
TypeRegistry.Set("Buffer", (_schema, value) => value instanceof Buffer);
|
|
86
165
|
SetErrorFunction((params) => {
|
|
87
166
|
switch (params.errorType) {
|
|
88
167
|
case ValueErrorType.Union:
|
|
@@ -274,14 +353,49 @@ var TypeboxSchemaValidator = class {
|
|
|
274
353
|
return "";
|
|
275
354
|
});
|
|
276
355
|
file = Type.Transform(
|
|
277
|
-
Type.
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
356
|
+
Type.Union([
|
|
357
|
+
Type.Unsafe({
|
|
358
|
+
[Kind]: "Buffer",
|
|
359
|
+
errorType: "binary",
|
|
360
|
+
format: "binary",
|
|
361
|
+
example: "a raw buffer or file stream",
|
|
362
|
+
title: "File"
|
|
363
|
+
}),
|
|
364
|
+
Type.Unsafe({
|
|
365
|
+
[Kind]: "ArrayBuffer",
|
|
366
|
+
errorType: "binary",
|
|
367
|
+
format: "binary",
|
|
368
|
+
example: "an array buffer",
|
|
369
|
+
title: "File"
|
|
370
|
+
}),
|
|
371
|
+
Type.Unsafe({
|
|
372
|
+
[Kind]: "Blob",
|
|
373
|
+
errorType: "binary",
|
|
374
|
+
format: "binary",
|
|
375
|
+
example: "a blob object",
|
|
376
|
+
title: "File"
|
|
377
|
+
}),
|
|
378
|
+
Type.String({
|
|
379
|
+
errorType: "binary",
|
|
380
|
+
format: "binary",
|
|
381
|
+
example: "a string content",
|
|
382
|
+
title: "File"
|
|
383
|
+
})
|
|
384
|
+
])
|
|
283
385
|
).Decode((value) => {
|
|
284
|
-
|
|
386
|
+
if (value instanceof Buffer) {
|
|
387
|
+
return new InMemoryBlob(value);
|
|
388
|
+
}
|
|
389
|
+
if (value instanceof ArrayBuffer) {
|
|
390
|
+
return new InMemoryBlob(Buffer.from(value));
|
|
391
|
+
}
|
|
392
|
+
if (value instanceof Blob) {
|
|
393
|
+
return value;
|
|
394
|
+
}
|
|
395
|
+
if (typeof value === "string") {
|
|
396
|
+
return new InMemoryBlob(Buffer.from(value));
|
|
397
|
+
}
|
|
398
|
+
return new InMemoryBlob(Buffer.from(value));
|
|
285
399
|
}).Encode((value) => value.content);
|
|
286
400
|
type = () => this.any;
|
|
287
401
|
/**
|
|
@@ -321,7 +435,7 @@ var TypeboxSchemaValidator = class {
|
|
|
321
435
|
}
|
|
322
436
|
const newSchema = {};
|
|
323
437
|
Object.getOwnPropertyNames(schema).forEach((key) => {
|
|
324
|
-
if (KindGuard.IsSchema(schema[key])) {
|
|
438
|
+
if (KindGuard.IsSchema(schema[key]) || KindGuard.IsTransform(schema[key])) {
|
|
325
439
|
newSchema[key] = schema[key];
|
|
326
440
|
} else {
|
|
327
441
|
const schemified = this.schemify(schema[key]);
|
|
@@ -511,7 +625,7 @@ var TypeboxSchemaValidator = class {
|
|
|
511
625
|
} : {
|
|
512
626
|
ok: false,
|
|
513
627
|
errors: errors.flatMap((error) => {
|
|
514
|
-
if (error.type === ValueErrorType.Union && error.schema.errorType
|
|
628
|
+
if (error.type === ValueErrorType.Union && error.schema.errorType?.includes("any of")) {
|
|
515
629
|
return error.errors.flatMap(
|
|
516
630
|
(e, idx) => Array.from(e).map((e2) => ({
|
|
517
631
|
path: [
|
|
@@ -539,20 +653,25 @@ var TypeboxSchemaValidator = class {
|
|
|
539
653
|
* @returns {SchemaObject} The OpenAPI schema object.
|
|
540
654
|
*/
|
|
541
655
|
openapi(schema) {
|
|
542
|
-
|
|
656
|
+
const schemified = this.schemify(schema);
|
|
657
|
+
let processedSchema;
|
|
543
658
|
if (KindGuard.IsDate(schemified)) {
|
|
544
|
-
|
|
659
|
+
processedSchema = Type.String({
|
|
545
660
|
format: "date-time"
|
|
546
661
|
});
|
|
662
|
+
} else {
|
|
663
|
+
processedSchema = deepCloneWithoutUndefined(schemified);
|
|
547
664
|
}
|
|
548
|
-
const newSchema = Object.assign({},
|
|
665
|
+
const newSchema = Object.assign({}, processedSchema);
|
|
549
666
|
if (Object.hasOwn(newSchema, "properties")) {
|
|
550
667
|
if (newSchema.properties) {
|
|
551
|
-
Object.entries({ ...
|
|
552
|
-
|
|
553
|
-
|
|
668
|
+
Object.entries({ ...processedSchema.properties }).forEach(
|
|
669
|
+
([key, value]) => {
|
|
670
|
+
if (KindGuard.IsSchema(value) && newSchema.properties) {
|
|
671
|
+
newSchema.properties[key] = this.openapi(value);
|
|
672
|
+
}
|
|
554
673
|
}
|
|
555
|
-
|
|
674
|
+
);
|
|
556
675
|
}
|
|
557
676
|
}
|
|
558
677
|
if (Object.hasOwn(newSchema, "items")) {
|
|
@@ -619,7 +738,7 @@ var KafkaWorkerOptionsSchema = {
|
|
|
619
738
|
peekCount: number
|
|
620
739
|
};
|
|
621
740
|
|
|
622
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.
|
|
741
|
+
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.18/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
|
|
623
742
|
import {
|
|
624
743
|
z as z2,
|
|
625
744
|
ZodType
|
|
@@ -672,7 +791,7 @@ merge.withOptions = (options, ...objects) => {
|
|
|
672
791
|
return result;
|
|
673
792
|
};
|
|
674
793
|
|
|
675
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.
|
|
794
|
+
// ../../../node_modules/.pnpm/@forklaunch+validator@0.10.18/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
|
|
676
795
|
import { z } from "zod/v3";
|
|
677
796
|
function extendApi(schema, schemaObject = {}) {
|
|
678
797
|
const This = schema.constructor;
|
|
@@ -1381,8 +1500,27 @@ var ZodSchemaValidator = class {
|
|
|
1381
1500
|
format: "binary",
|
|
1382
1501
|
example: "a base-64 encodable string"
|
|
1383
1502
|
});
|
|
1384
|
-
file = z2.
|
|
1503
|
+
file = z2.union([
|
|
1504
|
+
z2.instanceof(Buffer),
|
|
1505
|
+
z2.instanceof(ArrayBuffer),
|
|
1506
|
+
z2.instanceof(Blob),
|
|
1507
|
+
z2.string()
|
|
1508
|
+
]).transform((val) => {
|
|
1509
|
+
if (val instanceof Buffer) {
|
|
1510
|
+
return new Blob([val]);
|
|
1511
|
+
}
|
|
1512
|
+
if (val instanceof ArrayBuffer) {
|
|
1513
|
+
return new Blob([val]);
|
|
1514
|
+
}
|
|
1515
|
+
if (val instanceof Blob) {
|
|
1516
|
+
return val;
|
|
1517
|
+
}
|
|
1518
|
+
if (typeof val === "string") {
|
|
1519
|
+
return new Blob([val]);
|
|
1520
|
+
}
|
|
1385
1521
|
return new Blob([val]);
|
|
1522
|
+
}).refine((val) => val instanceof Blob, {
|
|
1523
|
+
message: "Invalid file type: expected Buffer, ArrayBuffer, Blob, or string"
|
|
1386
1524
|
}).openapi({
|
|
1387
1525
|
title: "File",
|
|
1388
1526
|
type: "string",
|
|
@@ -1567,7 +1705,8 @@ var ZodSchemaValidator = class {
|
|
|
1567
1705
|
* @returns {SchemaObject} The OpenAPI schema object.
|
|
1568
1706
|
*/
|
|
1569
1707
|
openapi(schema) {
|
|
1570
|
-
|
|
1708
|
+
const schemified = this.schemify(schema);
|
|
1709
|
+
return generateSchema(deepCloneWithoutUndefined(schemified));
|
|
1571
1710
|
}
|
|
1572
1711
|
};
|
|
1573
1712
|
var SchemaValidator2 = () => new ZodSchemaValidator();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/implementation-worker-kafka",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Kafka implementation for forklaunch workers",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -42,20 +42,20 @@
|
|
|
42
42
|
"lib/**"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@forklaunch/core": "^0.15.
|
|
46
|
-
"@forklaunch/internal": "^0.3.
|
|
45
|
+
"@forklaunch/core": "^0.15.7",
|
|
46
|
+
"@forklaunch/internal": "^0.3.18",
|
|
47
47
|
"@sinclair/typebox": "^0.34.41",
|
|
48
48
|
"kafkajs": "^2.2.4",
|
|
49
|
-
"zod": "^4.1.
|
|
50
|
-
"@forklaunch/interfaces-worker": "0.
|
|
49
|
+
"zod": "^4.1.12",
|
|
50
|
+
"@forklaunch/interfaces-worker": "0.7.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
53
|
+
"@typescript/native-preview": "7.0.0-dev.20251008.1",
|
|
54
54
|
"depcheck": "^1.4.7",
|
|
55
|
-
"eslint": "^9.
|
|
55
|
+
"eslint": "^9.37.0",
|
|
56
56
|
"prettier": "^3.6.2",
|
|
57
57
|
"typedoc": "^0.28.13",
|
|
58
|
-
"typescript-eslint": "^8.
|
|
58
|
+
"typescript-eslint": "^8.46.0"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsc --noEmit && tsup producers/index.ts consumers/index.ts domain/schemas/index.ts domain/types/index.ts --format cjs,esm --no-splitting --dts --tsconfig tsconfig.json --out-dir lib --clean && if [ -f eject-package.bash ]; then pnpm package:eject; fi",
|