@forklaunch/implementation-worker-redis 0.7.3 → 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/redisWorker.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")) {
@@ -615,7 +724,7 @@ var RedisWorkerOptionsSchema = {
615
724
  interval: number
616
725
  };
617
726
 
618
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.14/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
727
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.17/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
619
728
  var import_v3 = require("zod/v3");
620
729
 
621
730
  // ../../../node_modules/.pnpm/ts-deepmerge@7.0.3/node_modules/ts-deepmerge/esm/index.js
@@ -665,7 +774,7 @@ merge.withOptions = (options, ...objects) => {
665
774
  return result;
666
775
  };
667
776
 
668
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.14/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
777
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.17/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
669
778
  var import_v32 = require("zod/v3");
670
779
  function extendApi(schema, schemaObject = {}) {
671
780
  const This = schema.constructor;
@@ -1374,8 +1483,27 @@ var ZodSchemaValidator = class {
1374
1483
  format: "binary",
1375
1484
  example: "a base-64 encodable string"
1376
1485
  });
1377
- file = import_v3.z.instanceof(Buffer).transform((val) => {
1486
+ file = import_v3.z.union([
1487
+ import_v3.z.instanceof(Buffer),
1488
+ import_v3.z.instanceof(ArrayBuffer),
1489
+ import_v3.z.instanceof(Blob),
1490
+ import_v3.z.string()
1491
+ ]).transform((val) => {
1492
+ if (val instanceof Buffer) {
1493
+ return new Blob([val]);
1494
+ }
1495
+ if (val instanceof ArrayBuffer) {
1496
+ return new Blob([val]);
1497
+ }
1498
+ if (val instanceof Blob) {
1499
+ return val;
1500
+ }
1501
+ if (typeof val === "string") {
1502
+ return new Blob([val]);
1503
+ }
1378
1504
  return new Blob([val]);
1505
+ }).refine((val) => val instanceof Blob, {
1506
+ message: "Invalid file type: expected Buffer, ArrayBuffer, Blob, or string"
1379
1507
  }).openapi({
1380
1508
  title: "File",
1381
1509
  type: "string",
@@ -1560,7 +1688,8 @@ var ZodSchemaValidator = class {
1560
1688
  * @returns {SchemaObject} The OpenAPI schema object.
1561
1689
  */
1562
1690
  openapi(schema) {
1563
- return generateSchema(this.schemify(schema));
1691
+ const schemified = this.schemify(schema);
1692
+ return generateSchema(deepCloneWithoutUndefined(schemified));
1564
1693
  }
1565
1694
  };
1566
1695
  var SchemaValidator2 = () => new ZodSchemaValidator();
@@ -19,7 +19,7 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
19
19
  // domain/schemas/redisWorker.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")) {
@@ -616,7 +725,7 @@ var RedisWorkerOptionsSchema = {
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
  import {
621
730
  z as z2,
622
731
  ZodType
@@ -669,7 +778,7 @@ merge.withOptions = (options, ...objects) => {
669
778
  return result;
670
779
  };
671
780
 
672
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.14/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
781
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.17/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
673
782
  import { z } from "zod/v3";
674
783
  function extendApi(schema, schemaObject = {}) {
675
784
  const This = schema.constructor;
@@ -1378,8 +1487,27 @@ var ZodSchemaValidator = class {
1378
1487
  format: "binary",
1379
1488
  example: "a base-64 encodable string"
1380
1489
  });
1381
- file = z2.instanceof(Buffer).transform((val) => {
1490
+ file = z2.union([
1491
+ z2.instanceof(Buffer),
1492
+ z2.instanceof(ArrayBuffer),
1493
+ z2.instanceof(Blob),
1494
+ z2.string()
1495
+ ]).transform((val) => {
1496
+ if (val instanceof Buffer) {
1497
+ return new Blob([val]);
1498
+ }
1499
+ if (val instanceof ArrayBuffer) {
1500
+ return new Blob([val]);
1501
+ }
1502
+ if (val instanceof Blob) {
1503
+ return val;
1504
+ }
1505
+ if (typeof val === "string") {
1506
+ return new Blob([val]);
1507
+ }
1382
1508
  return new Blob([val]);
1509
+ }).refine((val) => val instanceof Blob, {
1510
+ message: "Invalid file type: expected Buffer, ArrayBuffer, Blob, or string"
1383
1511
  }).openapi({
1384
1512
  title: "File",
1385
1513
  type: "string",
@@ -1564,7 +1692,8 @@ var ZodSchemaValidator = class {
1564
1692
  * @returns {SchemaObject} The OpenAPI schema object.
1565
1693
  */
1566
1694
  openapi(schema) {
1567
- return generateSchema(this.schemify(schema));
1695
+ const schemified = this.schemify(schema);
1696
+ return generateSchema(deepCloneWithoutUndefined(schemified));
1568
1697
  }
1569
1698
  };
1570
1699
  var SchemaValidator2 = () => new ZodSchemaValidator();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/implementation-worker-redis",
3
- "version": "0.7.3",
3
+ "version": "0.8.0",
4
4
  "description": "Redis implementation for forklaunch workers",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {
@@ -42,19 +42,19 @@
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
- "zod": "^4.1.11",
49
- "@forklaunch/interfaces-worker": "0.6.3"
48
+ "zod": "^4.1.12",
49
+ "@forklaunch/interfaces-worker": "0.7.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@typescript/native-preview": "7.0.0-dev.20250930.1",
52
+ "@typescript/native-preview": "7.0.0-dev.20251007.1",
53
53
  "depcheck": "^1.4.7",
54
- "eslint": "^9.36.0",
54
+ "eslint": "^9.37.0",
55
55
  "prettier": "^3.6.2",
56
56
  "typedoc": "^0.28.13",
57
- "typescript-eslint": "^8.45.0"
57
+ "typescript-eslint": "^8.46.0"
58
58
  },
59
59
  "scripts": {
60
60
  "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",