@forklaunch/implementation-worker-bullmq 0.7.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(schemas_exports);
28
28
  // domain/schemas/bullMqWorker.schema.ts
29
29
  var import_internal = require("@forklaunch/internal");
30
30
 
31
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.14/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
31
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.17/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.14/node_modules/@forklaunch/common/lib/index.mjs
71
+ // ../../../node_modules/.pnpm/@forklaunch+common@0.6.17/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,7 +148,7 @@ var InMemoryBlob = class extends Blob {
76
148
  }
77
149
  };
78
150
 
79
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.14/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
151
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.17/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");
@@ -273,14 +345,46 @@ var TypeboxSchemaValidator = class {
273
345
  return "";
274
346
  });
275
347
  file = import_typebox.Type.Transform(
276
- import_typebox.Type.Unsafe({
277
- errorType: "binary",
278
- format: "binary",
279
- example: "a raw buffer or file stream",
280
- title: "File"
281
- })
348
+ import_typebox.Type.Union([
349
+ import_typebox.Type.Unsafe({
350
+ errorType: "binary",
351
+ format: "binary",
352
+ example: "a raw buffer or file stream",
353
+ title: "File"
354
+ }),
355
+ import_typebox.Type.Unsafe({
356
+ errorType: "binary",
357
+ format: "binary",
358
+ example: "an array buffer",
359
+ title: "File"
360
+ }),
361
+ import_typebox.Type.Unsafe({
362
+ errorType: "binary",
363
+ format: "binary",
364
+ example: "a blob object",
365
+ title: "File"
366
+ }),
367
+ import_typebox.Type.String({
368
+ errorType: "binary",
369
+ format: "binary",
370
+ example: "a string content",
371
+ title: "File"
372
+ })
373
+ ])
282
374
  ).Decode((value) => {
283
- return new InMemoryBlob(value);
375
+ if (value instanceof Buffer) {
376
+ return new InMemoryBlob(value);
377
+ }
378
+ if (value instanceof ArrayBuffer) {
379
+ return new InMemoryBlob(Buffer.from(value));
380
+ }
381
+ if (value instanceof Blob) {
382
+ return value;
383
+ }
384
+ if (typeof value === "string") {
385
+ return new InMemoryBlob(Buffer.from(value));
386
+ }
387
+ return new InMemoryBlob(Buffer.from(value));
284
388
  }).Encode((value) => value.content);
285
389
  type = () => this.any;
286
390
  /**
@@ -320,7 +424,7 @@ var TypeboxSchemaValidator = class {
320
424
  }
321
425
  const newSchema = {};
322
426
  Object.getOwnPropertyNames(schema).forEach((key) => {
323
- if (import_typebox.KindGuard.IsSchema(schema[key])) {
427
+ if (import_typebox.KindGuard.IsSchema(schema[key]) || import_typebox.KindGuard.IsTransform(schema[key])) {
324
428
  newSchema[key] = schema[key];
325
429
  } else {
326
430
  const schemified = this.schemify(schema[key]);
@@ -538,20 +642,25 @@ var TypeboxSchemaValidator = class {
538
642
  * @returns {SchemaObject} The OpenAPI schema object.
539
643
  */
540
644
  openapi(schema) {
541
- let schemified = this.schemify(schema);
645
+ const schemified = this.schemify(schema);
646
+ let processedSchema;
542
647
  if (import_typebox.KindGuard.IsDate(schemified)) {
543
- schemified = import_typebox.Type.String({
648
+ processedSchema = import_typebox.Type.String({
544
649
  format: "date-time"
545
650
  });
651
+ } else {
652
+ processedSchema = deepCloneWithoutUndefined(schemified);
546
653
  }
547
- const newSchema = Object.assign({}, schemified);
654
+ const newSchema = Object.assign({}, processedSchema);
548
655
  if (Object.hasOwn(newSchema, "properties")) {
549
656
  if (newSchema.properties) {
550
- Object.entries({ ...schemified.properties }).forEach(([key, value]) => {
551
- if (import_typebox.KindGuard.IsSchema(value) && newSchema.properties) {
552
- newSchema.properties[key] = this.openapi(value);
657
+ Object.entries({ ...processedSchema.properties }).forEach(
658
+ ([key, value]) => {
659
+ if (import_typebox.KindGuard.IsSchema(value) && newSchema.properties) {
660
+ newSchema.properties[key] = this.openapi(value);
661
+ }
553
662
  }
554
- });
663
+ );
555
664
  }
556
665
  }
557
666
  if (Object.hasOwn(newSchema, "items")) {
@@ -616,7 +725,7 @@ var BullMqWorkerOptionsSchema = {
616
725
  interval: number
617
726
  };
618
727
 
619
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.14/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
728
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.17/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
620
729
  var import_v3 = require("zod/v3");
621
730
 
622
731
  // ../../../node_modules/.pnpm/ts-deepmerge@7.0.3/node_modules/ts-deepmerge/esm/index.js
@@ -666,7 +775,7 @@ merge.withOptions = (options, ...objects) => {
666
775
  return result;
667
776
  };
668
777
 
669
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.14/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
778
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.17/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
670
779
  var import_v32 = require("zod/v3");
671
780
  function extendApi(schema, schemaObject = {}) {
672
781
  const This = schema.constructor;
@@ -1375,8 +1484,27 @@ var ZodSchemaValidator = class {
1375
1484
  format: "binary",
1376
1485
  example: "a base-64 encodable string"
1377
1486
  });
1378
- file = import_v3.z.instanceof(Buffer).transform((val) => {
1487
+ file = import_v3.z.union([
1488
+ import_v3.z.instanceof(Buffer),
1489
+ import_v3.z.instanceof(ArrayBuffer),
1490
+ import_v3.z.instanceof(Blob),
1491
+ import_v3.z.string()
1492
+ ]).transform((val) => {
1493
+ if (val instanceof Buffer) {
1494
+ return new Blob([val]);
1495
+ }
1496
+ if (val instanceof ArrayBuffer) {
1497
+ return new Blob([val]);
1498
+ }
1499
+ if (val instanceof Blob) {
1500
+ return val;
1501
+ }
1502
+ if (typeof val === "string") {
1503
+ return new Blob([val]);
1504
+ }
1379
1505
  return new Blob([val]);
1506
+ }).refine((val) => val instanceof Blob, {
1507
+ message: "Invalid file type: expected Buffer, ArrayBuffer, Blob, or string"
1380
1508
  }).openapi({
1381
1509
  title: "File",
1382
1510
  type: "string",
@@ -1561,7 +1689,8 @@ var ZodSchemaValidator = class {
1561
1689
  * @returns {SchemaObject} The OpenAPI schema object.
1562
1690
  */
1563
1691
  openapi(schema) {
1564
- return generateSchema(this.schemify(schema));
1692
+ const schemified = this.schemify(schema);
1693
+ return generateSchema(deepCloneWithoutUndefined(schemified));
1565
1694
  }
1566
1695
  };
1567
1696
  var SchemaValidator2 = () => new ZodSchemaValidator();
@@ -19,7 +19,7 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
19
19
  // domain/schemas/bullMqWorker.schema.ts
20
20
  import { serviceSchemaResolver } from "@forklaunch/internal";
21
21
 
22
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.14/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
22
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.17/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.14/node_modules/@forklaunch/common/lib/index.mjs
63
+ // ../../../node_modules/.pnpm/@forklaunch+common@0.6.17/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,7 +140,7 @@ var InMemoryBlob = class extends Blob {
68
140
  }
69
141
  };
70
142
 
71
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.14/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
143
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.17/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
72
144
  import {
73
145
  FormatRegistry,
74
146
  Kind,
@@ -274,14 +346,46 @@ var TypeboxSchemaValidator = class {
274
346
  return "";
275
347
  });
276
348
  file = Type.Transform(
277
- Type.Unsafe({
278
- errorType: "binary",
279
- format: "binary",
280
- example: "a raw buffer or file stream",
281
- title: "File"
282
- })
349
+ Type.Union([
350
+ Type.Unsafe({
351
+ errorType: "binary",
352
+ format: "binary",
353
+ example: "a raw buffer or file stream",
354
+ title: "File"
355
+ }),
356
+ Type.Unsafe({
357
+ errorType: "binary",
358
+ format: "binary",
359
+ example: "an array buffer",
360
+ title: "File"
361
+ }),
362
+ Type.Unsafe({
363
+ errorType: "binary",
364
+ format: "binary",
365
+ example: "a blob object",
366
+ title: "File"
367
+ }),
368
+ Type.String({
369
+ errorType: "binary",
370
+ format: "binary",
371
+ example: "a string content",
372
+ title: "File"
373
+ })
374
+ ])
283
375
  ).Decode((value) => {
284
- return new InMemoryBlob(value);
376
+ if (value instanceof Buffer) {
377
+ return new InMemoryBlob(value);
378
+ }
379
+ if (value instanceof ArrayBuffer) {
380
+ return new InMemoryBlob(Buffer.from(value));
381
+ }
382
+ if (value instanceof Blob) {
383
+ return value;
384
+ }
385
+ if (typeof value === "string") {
386
+ return new InMemoryBlob(Buffer.from(value));
387
+ }
388
+ return new InMemoryBlob(Buffer.from(value));
285
389
  }).Encode((value) => value.content);
286
390
  type = () => this.any;
287
391
  /**
@@ -321,7 +425,7 @@ var TypeboxSchemaValidator = class {
321
425
  }
322
426
  const newSchema = {};
323
427
  Object.getOwnPropertyNames(schema).forEach((key) => {
324
- if (KindGuard.IsSchema(schema[key])) {
428
+ if (KindGuard.IsSchema(schema[key]) || KindGuard.IsTransform(schema[key])) {
325
429
  newSchema[key] = schema[key];
326
430
  } else {
327
431
  const schemified = this.schemify(schema[key]);
@@ -539,20 +643,25 @@ var TypeboxSchemaValidator = class {
539
643
  * @returns {SchemaObject} The OpenAPI schema object.
540
644
  */
541
645
  openapi(schema) {
542
- let schemified = this.schemify(schema);
646
+ const schemified = this.schemify(schema);
647
+ let processedSchema;
543
648
  if (KindGuard.IsDate(schemified)) {
544
- schemified = Type.String({
649
+ processedSchema = Type.String({
545
650
  format: "date-time"
546
651
  });
652
+ } else {
653
+ processedSchema = deepCloneWithoutUndefined(schemified);
547
654
  }
548
- const newSchema = Object.assign({}, schemified);
655
+ const newSchema = Object.assign({}, processedSchema);
549
656
  if (Object.hasOwn(newSchema, "properties")) {
550
657
  if (newSchema.properties) {
551
- Object.entries({ ...schemified.properties }).forEach(([key, value]) => {
552
- if (KindGuard.IsSchema(value) && newSchema.properties) {
553
- newSchema.properties[key] = this.openapi(value);
658
+ Object.entries({ ...processedSchema.properties }).forEach(
659
+ ([key, value]) => {
660
+ if (KindGuard.IsSchema(value) && newSchema.properties) {
661
+ newSchema.properties[key] = this.openapi(value);
662
+ }
554
663
  }
555
- });
664
+ );
556
665
  }
557
666
  }
558
667
  if (Object.hasOwn(newSchema, "items")) {
@@ -617,7 +726,7 @@ var BullMqWorkerOptionsSchema = {
617
726
  interval: number
618
727
  };
619
728
 
620
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.14/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
729
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.17/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
621
730
  import {
622
731
  z as z2,
623
732
  ZodType
@@ -670,7 +779,7 @@ merge.withOptions = (options, ...objects) => {
670
779
  return result;
671
780
  };
672
781
 
673
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.14/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
782
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.17/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
674
783
  import { z } from "zod/v3";
675
784
  function extendApi(schema, schemaObject = {}) {
676
785
  const This = schema.constructor;
@@ -1379,8 +1488,27 @@ var ZodSchemaValidator = class {
1379
1488
  format: "binary",
1380
1489
  example: "a base-64 encodable string"
1381
1490
  });
1382
- file = z2.instanceof(Buffer).transform((val) => {
1491
+ file = z2.union([
1492
+ z2.instanceof(Buffer),
1493
+ z2.instanceof(ArrayBuffer),
1494
+ z2.instanceof(Blob),
1495
+ z2.string()
1496
+ ]).transform((val) => {
1497
+ if (val instanceof Buffer) {
1498
+ return new Blob([val]);
1499
+ }
1500
+ if (val instanceof ArrayBuffer) {
1501
+ return new Blob([val]);
1502
+ }
1503
+ if (val instanceof Blob) {
1504
+ return val;
1505
+ }
1506
+ if (typeof val === "string") {
1507
+ return new Blob([val]);
1508
+ }
1383
1509
  return new Blob([val]);
1510
+ }).refine((val) => val instanceof Blob, {
1511
+ message: "Invalid file type: expected Buffer, ArrayBuffer, Blob, or string"
1384
1512
  }).openapi({
1385
1513
  title: "File",
1386
1514
  type: "string",
@@ -1565,7 +1693,8 @@ var ZodSchemaValidator = class {
1565
1693
  * @returns {SchemaObject} The OpenAPI schema object.
1566
1694
  */
1567
1695
  openapi(schema) {
1568
- return generateSchema(this.schemify(schema));
1696
+ const schemified = this.schemify(schema);
1697
+ return generateSchema(deepCloneWithoutUndefined(schemified));
1569
1698
  }
1570
1699
  };
1571
1700
  var SchemaValidator2 = () => new ZodSchemaValidator();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/implementation-worker-bullmq",
3
- "version": "0.7.2",
3
+ "version": "0.8.0",
4
4
  "description": "BullMQ 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.3",
46
- "@forklaunch/internal": "^0.3.14",
45
+ "@forklaunch/core": "^0.15.6",
46
+ "@forklaunch/internal": "^0.3.17",
47
47
  "@sinclair/typebox": "^0.34.41",
48
- "bullmq": "^5.59.0",
49
- "zod": "^4.1.11",
50
- "@forklaunch/interfaces-worker": "0.6.2"
48
+ "bullmq": "^5.61.0",
49
+ "zod": "^4.1.12",
50
+ "@forklaunch/interfaces-worker": "0.7.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@typescript/native-preview": "7.0.0-dev.20250930.1",
53
+ "@typescript/native-preview": "7.0.0-dev.20251007.1",
54
54
  "depcheck": "^1.4.7",
55
- "eslint": "^9.36.0",
55
+ "eslint": "^9.37.0",
56
56
  "prettier": "^3.6.2",
57
57
  "typedoc": "^0.28.13",
58
- "typescript-eslint": "^8.45.0"
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",