@forklaunch/implementation-worker-database 0.5.7 → 0.6.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.
@@ -35,7 +35,7 @@ module.exports = __toCommonJS(schemas_exports);
35
35
  // domain/schemas/databaseWorker.schema.ts
36
36
  var import_internal = require('@forklaunch/internal');
37
37
 
38
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.4/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
38
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.3/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
39
39
  var typebox_exports = {};
40
40
  __export(typebox_exports, {
41
41
  SchemaValidator: () => SchemaValidator,
@@ -75,7 +75,7 @@ __export(typebox_exports, {
75
75
  });
76
76
  __reExport(typebox_exports, require('@sinclair/typebox'));
77
77
 
78
- // ../../../node_modules/.pnpm/@forklaunch+common@0.5.3/node_modules/@forklaunch/common/lib/index.mjs
78
+ // ../../../node_modules/.pnpm/@forklaunch+common@0.6.3/node_modules/@forklaunch/common/lib/index.mjs
79
79
  var InMemoryBlob = class extends Blob {
80
80
  constructor(content) {
81
81
  super([content]);
@@ -83,7 +83,7 @@ var InMemoryBlob = class extends Blob {
83
83
  }
84
84
  };
85
85
 
86
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.4/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
86
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.3/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
87
87
  var import_typebox = require('@sinclair/typebox');
88
88
  var import_compiler = require('@sinclair/typebox/compiler');
89
89
  var import_errors = require('@sinclair/typebox/errors');
@@ -121,7 +121,7 @@ var TypeboxSchemaValidator = class {
121
121
  title: 'UUID'
122
122
  });
123
123
  email = import_typebox.Type.String({
124
- 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\\x5b-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)])`,
124
+ pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$',
125
125
  errorType: 'email',
126
126
  example: 'a@b.com',
127
127
  title: 'Email'
@@ -308,7 +308,9 @@ var TypeboxSchemaValidator = class {
308
308
  title: 'File'
309
309
  })
310
310
  )
311
- .Decode((value) => new InMemoryBlob(value))
311
+ .Decode((value) => {
312
+ return new InMemoryBlob(value);
313
+ })
312
314
  .Encode((value) => value.content);
313
315
  type = () => this.any;
314
316
  /**
@@ -511,10 +513,40 @@ var TypeboxSchemaValidator = class {
511
513
  }
512
514
  } else {
513
515
  const schemified = this.schemify(schema);
514
- if (import_value.Value.Check(schemified, value)) {
515
- conversion = import_value.Value.Decode(schemified, value);
516
+ if (schemified[import_typebox.Kind] === 'Unsafe') {
517
+ try {
518
+ if (value instanceof Buffer) {
519
+ conversion = new InMemoryBlob(value);
520
+ } else {
521
+ errors = [
522
+ {
523
+ type: import_errors.ValueErrorType.String,
524
+ schema: schemified,
525
+ path: '',
526
+ message: `Invalid file type: expected Buffer or string, got ${typeof value}`,
527
+ value,
528
+ errors: []
529
+ }
530
+ ];
531
+ }
532
+ } catch (err) {
533
+ errors = [
534
+ {
535
+ type: import_errors.ValueErrorType.String,
536
+ schema: schemified,
537
+ path: '',
538
+ message: err instanceof Error ? err.message : 'Invalid file type',
539
+ value,
540
+ errors: []
541
+ }
542
+ ];
543
+ }
516
544
  } else {
517
- errors = Array.from(import_value.Value.Errors(schemified, value));
545
+ if (import_value.Value.Check(schemified, value)) {
546
+ conversion = import_value.Value.Decode(schemified, value);
547
+ } else {
548
+ errors = Array.from(import_value.Value.Errors(schemified, value));
549
+ }
518
550
  }
519
551
  }
520
552
  return errors != null && errors.length === 0
@@ -631,7 +663,7 @@ var DatabaseWorkerOptionsSchema = {
631
663
  interval: number
632
664
  };
633
665
 
634
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.4/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
666
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.3/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
635
667
  var import_v3 = require('zod/v3');
636
668
 
637
669
  // ../../../node_modules/.pnpm/ts-deepmerge@7.0.3/node_modules/ts-deepmerge/esm/index.js
@@ -693,7 +725,7 @@ merge.withOptions = (options, ...objects) => {
693
725
  return result;
694
726
  };
695
727
 
696
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.4/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
728
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.3/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
697
729
  var import_v32 = require('zod/v3');
698
730
  function extendApi(schema, schemaObject = {}) {
699
731
  const This = schema.constructor;
@@ -1245,7 +1277,7 @@ var ZodSchemaValidator = class {
1245
1277
  email = import_v3.z.string().email().openapi({
1246
1278
  title: 'Email',
1247
1279
  format: 'email',
1248
- 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\\x5b-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)])`,
1280
+ pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$',
1249
1281
  example: 'a@b.com'
1250
1282
  });
1251
1283
  uri = import_v3.z.string().url().openapi({
@@ -25,7 +25,7 @@ var __reExport = (target, mod, secondTarget) => (
25
25
  // domain/schemas/databaseWorker.schema.ts
26
26
  import { serviceSchemaResolver } from '@forklaunch/internal';
27
27
 
28
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.4/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
28
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.3/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
29
29
  var typebox_exports = {};
30
30
  __export(typebox_exports, {
31
31
  SchemaValidator: () => SchemaValidator,
@@ -66,7 +66,7 @@ __export(typebox_exports, {
66
66
  __reExport(typebox_exports, typebox_star);
67
67
  import * as typebox_star from '@sinclair/typebox';
68
68
 
69
- // ../../../node_modules/.pnpm/@forklaunch+common@0.5.3/node_modules/@forklaunch/common/lib/index.mjs
69
+ // ../../../node_modules/.pnpm/@forklaunch+common@0.6.3/node_modules/@forklaunch/common/lib/index.mjs
70
70
  var InMemoryBlob = class extends Blob {
71
71
  constructor(content) {
72
72
  super([content]);
@@ -74,7 +74,7 @@ var InMemoryBlob = class extends Blob {
74
74
  }
75
75
  };
76
76
 
77
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.4/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
77
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.3/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
78
78
  import { FormatRegistry, Kind, KindGuard, Type } from '@sinclair/typebox';
79
79
  import { TypeCheck, TypeCompiler } from '@sinclair/typebox/compiler';
80
80
  import {
@@ -113,7 +113,7 @@ var TypeboxSchemaValidator = class {
113
113
  title: 'UUID'
114
114
  });
115
115
  email = Type.String({
116
- 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\\x5b-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)])`,
116
+ pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$',
117
117
  errorType: 'email',
118
118
  example: 'a@b.com',
119
119
  title: 'Email'
@@ -293,7 +293,9 @@ var TypeboxSchemaValidator = class {
293
293
  title: 'File'
294
294
  })
295
295
  )
296
- .Decode((value) => new InMemoryBlob(value))
296
+ .Decode((value) => {
297
+ return new InMemoryBlob(value);
298
+ })
297
299
  .Encode((value) => value.content);
298
300
  type = () => this.any;
299
301
  /**
@@ -490,10 +492,40 @@ var TypeboxSchemaValidator = class {
490
492
  }
491
493
  } else {
492
494
  const schemified = this.schemify(schema);
493
- if (Value.Check(schemified, value)) {
494
- conversion = Value.Decode(schemified, value);
495
+ if (schemified[Kind] === 'Unsafe') {
496
+ try {
497
+ if (value instanceof Buffer) {
498
+ conversion = new InMemoryBlob(value);
499
+ } else {
500
+ errors = [
501
+ {
502
+ type: ValueErrorType.String,
503
+ schema: schemified,
504
+ path: '',
505
+ message: `Invalid file type: expected Buffer or string, got ${typeof value}`,
506
+ value,
507
+ errors: []
508
+ }
509
+ ];
510
+ }
511
+ } catch (err) {
512
+ errors = [
513
+ {
514
+ type: ValueErrorType.String,
515
+ schema: schemified,
516
+ path: '',
517
+ message: err instanceof Error ? err.message : 'Invalid file type',
518
+ value,
519
+ errors: []
520
+ }
521
+ ];
522
+ }
495
523
  } else {
496
- errors = Array.from(Value.Errors(schemified, value));
524
+ if (Value.Check(schemified, value)) {
525
+ conversion = Value.Decode(schemified, value);
526
+ } else {
527
+ errors = Array.from(Value.Errors(schemified, value));
528
+ }
497
529
  }
498
530
  }
499
531
  return errors != null && errors.length === 0
@@ -607,7 +639,7 @@ var DatabaseWorkerOptionsSchema = {
607
639
  interval: number
608
640
  };
609
641
 
610
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.4/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
642
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.3/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
611
643
  import { z as z2, ZodType } from 'zod/v3';
612
644
 
613
645
  // ../../../node_modules/.pnpm/ts-deepmerge@7.0.3/node_modules/ts-deepmerge/esm/index.js
@@ -669,7 +701,7 @@ merge.withOptions = (options, ...objects) => {
669
701
  return result;
670
702
  };
671
703
 
672
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.4/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
704
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.10.3/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
673
705
  import { z } from 'zod/v3';
674
706
  function extendApi(schema, schemaObject = {}) {
675
707
  const This = schema.constructor;
@@ -1217,7 +1249,7 @@ var ZodSchemaValidator = class {
1217
1249
  email = z2.string().email().openapi({
1218
1250
  title: 'Email',
1219
1251
  format: 'email',
1220
- 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\\x5b-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)])`,
1252
+ pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$',
1221
1253
  example: 'a@b.com'
1222
1254
  });
1223
1255
  uri = z2.string().url().openapi({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/implementation-worker-database",
3
- "version": "0.5.7",
3
+ "version": "0.6.0",
4
4
  "description": "Database 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.13.4",
46
- "@forklaunch/internal": "^0.2.4",
47
- "@mikro-orm/core": "^6.4.16",
45
+ "@forklaunch/core": "^0.14.3",
46
+ "@forklaunch/internal": "^0.3.3",
47
+ "@mikro-orm/core": "^6.5.1",
48
48
  "@sinclair/typebox": "^0.34.40",
49
- "zod": "^4.1.1",
50
- "@forklaunch/interfaces-worker": "0.4.6"
49
+ "zod": "^4.1.5",
50
+ "@forklaunch/interfaces-worker": "0.5.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@typescript/native-preview": "7.0.0-dev.20250824.1",
53
+ "@typescript/native-preview": "7.0.0-dev.20250828.1",
54
54
  "depcheck": "^1.4.7",
55
55
  "eslint": "^9.34.0",
56
56
  "prettier": "^3.6.2",
57
- "typedoc": "^0.28.10",
58
- "typescript-eslint": "^8.40.0"
57
+ "typedoc": "^0.28.11",
58
+ "typescript-eslint": "^8.41.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",