rads-db 3.0.44 → 3.0.46

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/dist/index.cjs CHANGED
@@ -61,13 +61,12 @@ function getZodSchema(zodSchemas, schema, key) {
61
61
  if (f.decorators?.computed || f.decorators?.precomputed) {
62
62
  continue;
63
63
  }
64
- const shouldBeLazy = f.type === type.name;
65
- objectSchema[fieldName] = getFieldZodSchema(zodSchemas, schema, f, shouldBeLazy);
64
+ objectSchema[fieldName] = getFieldZodSchema(zodSchemas, schema, f);
66
65
  }
67
66
  return zod.z.object(objectSchema);
68
67
  }
69
- function getFieldZodSchema(zodSchemas, schema, field, shouldBeLazy) {
70
- let fieldSchema = getFieldZodSchemaBase(zodSchemas, schema, field, shouldBeLazy);
68
+ function getFieldZodSchema(zodSchemas, schema, field) {
69
+ let fieldSchema = getFieldZodSchemaBase(zodSchemas, schema, field);
71
70
  if (field.isArray)
72
71
  fieldSchema = fieldSchema.array();
73
72
  if (!field.isRequired)
@@ -78,7 +77,7 @@ function getFieldZodSchema(zodSchemas, schema, field, shouldBeLazy) {
78
77
  fieldSchema = fieldSchema.optional();
79
78
  return fieldSchema;
80
79
  }
81
- function getFieldZodSchemaBase(zodSchemas, schema, field, shouldBeLazy) {
80
+ function getFieldZodSchemaBase(zodSchemas, schema, field) {
82
81
  if (field.isChange) {
83
82
  const zodSchema = getZodSchema(zodSchemas, schema, field.type);
84
83
  if (!zodSchema)
@@ -103,7 +102,7 @@ function getFieldZodSchemaBase(zodSchemas, schema, field, shouldBeLazy) {
103
102
  }
104
103
  return zodSchema;
105
104
  };
106
- return shouldBeLazy ? zod.z.lazy(getSchema) : getSchema();
105
+ return zod.z.lazy(getSchema);
107
106
  }
108
107
  throw new Error(`Unknown type: ${field.type}`);
109
108
  }
@@ -689,6 +688,7 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
689
688
  return docsToSave;
690
689
  }
691
690
  async function verifyMany(args, ctx) {
691
+ console.log("verMany");
692
692
  if (driverInstance.verifyMany) {
693
693
  return driverInstance.verifyMany(args, ctx);
694
694
  }
package/dist/index.mjs CHANGED
@@ -53,13 +53,12 @@ function getZodSchema(zodSchemas, schema, key) {
53
53
  if (f.decorators?.computed || f.decorators?.precomputed) {
54
54
  continue;
55
55
  }
56
- const shouldBeLazy = f.type === type.name;
57
- objectSchema[fieldName] = getFieldZodSchema(zodSchemas, schema, f, shouldBeLazy);
56
+ objectSchema[fieldName] = getFieldZodSchema(zodSchemas, schema, f);
58
57
  }
59
58
  return z.object(objectSchema);
60
59
  }
61
- function getFieldZodSchema(zodSchemas, schema, field, shouldBeLazy) {
62
- let fieldSchema = getFieldZodSchemaBase(zodSchemas, schema, field, shouldBeLazy);
60
+ function getFieldZodSchema(zodSchemas, schema, field) {
61
+ let fieldSchema = getFieldZodSchemaBase(zodSchemas, schema, field);
63
62
  if (field.isArray)
64
63
  fieldSchema = fieldSchema.array();
65
64
  if (!field.isRequired)
@@ -70,7 +69,7 @@ function getFieldZodSchema(zodSchemas, schema, field, shouldBeLazy) {
70
69
  fieldSchema = fieldSchema.optional();
71
70
  return fieldSchema;
72
71
  }
73
- function getFieldZodSchemaBase(zodSchemas, schema, field, shouldBeLazy) {
72
+ function getFieldZodSchemaBase(zodSchemas, schema, field) {
74
73
  if (field.isChange) {
75
74
  const zodSchema = getZodSchema(zodSchemas, schema, field.type);
76
75
  if (!zodSchema)
@@ -95,7 +94,7 @@ function getFieldZodSchemaBase(zodSchemas, schema, field, shouldBeLazy) {
95
94
  }
96
95
  return zodSchema;
97
96
  };
98
- return shouldBeLazy ? z.lazy(getSchema) : getSchema();
97
+ return z.lazy(getSchema);
99
98
  }
100
99
  throw new Error(`Unknown type: ${field.type}`);
101
100
  }
@@ -681,6 +680,7 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
681
680
  return docsToSave;
682
681
  }
683
682
  async function verifyMany(args, ctx) {
683
+ console.log("verMany");
684
684
  if (driverInstance.verifyMany) {
685
685
  return driverInstance.verifyMany(args, ctx);
686
686
  }
@@ -26,22 +26,18 @@ function getRadsUiUser(radsAuthHeader, apiKey) {
26
26
  message: `Unauthorized - malformed authHeader`
27
27
  });
28
28
  }
29
- if (apiKey === key) {
29
+ if (key === apiKey) {
30
30
  return {
31
31
  email,
32
32
  pretendAsUserId
33
33
  };
34
34
  }
35
- if (apiKey === "dev" && process.env.NODE_ENV === "development") {
35
+ if (key === "dev" && process.env.NODE_ENV === "development") {
36
36
  return {
37
37
  email,
38
38
  pretendAsUserId
39
39
  };
40
40
  }
41
- throw (0, _h.createError)({
42
- statusCode: 401,
43
- message: `Unauthorized`
44
- });
45
41
  }
46
42
  function getRestRoutes(options) {
47
43
  const {
@@ -12,13 +12,12 @@ export function getRadsUiUser(radsAuthHeader, apiKey) {
12
12
  if (!email || !keyType || !key || keyType !== "ApiKey") {
13
13
  throw createError({ statusCode: 401, message: `Unauthorized - malformed authHeader` });
14
14
  }
15
- if (apiKey === key) {
15
+ if (key === apiKey) {
16
16
  return { email, pretendAsUserId };
17
17
  }
18
- if (apiKey === "dev" && process.env.NODE_ENV === "development") {
18
+ if (key === "dev" && process.env.NODE_ENV === "development") {
19
19
  return { email, pretendAsUserId };
20
20
  }
21
- throw createError({ statusCode: 401, message: `Unauthorized` });
22
21
  }
23
22
  export function getRestRoutes(options) {
24
23
  const { db, prefix = "/api/" } = options;
package/package.json CHANGED
@@ -1,50 +1,51 @@
1
1
  {
2
2
  "name": "rads-db",
3
- "version": "3.0.44",
4
- "files": [
5
- "dist",
6
- "drivers",
7
- "fileUploadDrivers",
8
- "integrations",
9
- "features"
10
- ],
11
- "bin": {
12
- "rads-db": "integrations/cli.cjs"
13
- },
14
- "main": "./dist/index.cjs",
15
- "module": "./dist/index.mjs",
16
- "types": "./dist/index.d.ts",
3
+ "version": "3.0.46",
4
+ "packageManager": "pnpm@8.6.1",
5
+ "description": "Say goodbye to boilerplate code and hello to efficient and elegant syntax.",
6
+ "author": "",
7
+ "license": "ISC",
8
+ "keywords": [],
17
9
  "exports": {
18
10
  ".": {
19
11
  "types": "./dist/index.d.ts",
20
- "import": "./dist/index.mjs",
21
- "require": "./dist/index.cjs"
12
+ "require": "./dist/index.cjs",
13
+ "import": "./dist/index.mjs"
22
14
  },
23
15
  "./drivers/*": {
24
16
  "types": "./drivers/*.d.ts",
25
- "import": "./drivers/*.mjs",
26
- "require": "./drivers/*.cjs"
17
+ "require": "./drivers/*.cjs",
18
+ "import": "./drivers/*.mjs"
27
19
  },
28
20
  "./fileUploadDrivers/*": {
29
21
  "types": "./fileUploadDrivers/*.d.ts",
30
- "import": "./fileUploadDrivers/*.mjs",
31
- "require": "./fileUploadDrivers/*.cjs"
22
+ "require": "./fileUploadDrivers/*.cjs",
23
+ "import": "./fileUploadDrivers/*.mjs"
32
24
  },
33
25
  "./integrations/*": {
34
26
  "types": "./integrations/*.d.ts",
35
- "import": "./integrations/*.mjs",
36
- "require": "./integrations/*.cjs"
27
+ "require": "./integrations/*.cjs",
28
+ "import": "./integrations/*.mjs"
37
29
  },
38
30
  "./features/*": {
39
31
  "types": "./features/*.d.ts",
40
- "import": "./features/*.mjs",
41
- "require": "./features/*.cjs"
32
+ "require": "./features/*.cjs",
33
+ "import": "./features/*.mjs"
42
34
  }
43
35
  },
44
- "description": "Say goodbye to boilerplate code and hello to efficient and elegant syntax.",
45
- "keywords": [],
46
- "author": "",
47
- "license": "ISC",
36
+ "main": "./dist/index.cjs",
37
+ "module": "./dist/index.mjs",
38
+ "types": "./dist/index.d.ts",
39
+ "bin": {
40
+ "rads-db": "integrations/cli.cjs"
41
+ },
42
+ "files": [
43
+ "dist",
44
+ "drivers",
45
+ "fileUploadDrivers",
46
+ "integrations",
47
+ "features"
48
+ ],
48
49
  "peerDependencies": {
49
50
  "@azure/cosmos": ">=3",
50
51
  "@azure/storage-blob": ">=12",
@@ -70,7 +71,16 @@
70
71
  "optional": true
71
72
  }
72
73
  },
73
- "packageManager": "pnpm@8.6.1",
74
+ "dependencies": {
75
+ "@fastify/deepmerge": "^1.3.0",
76
+ "dataloader": "^2.2.2",
77
+ "ignore": "^5.2.4",
78
+ "klaw": "^4.1.0",
79
+ "lodash": "^4.17.21",
80
+ "pluralize": "^8.0.0",
81
+ "uuid": ">=8",
82
+ "zod": "^3.21.4"
83
+ },
74
84
  "devDependencies": {
75
85
  "@azure/cosmos": "^3.17.3",
76
86
  "@supabase/supabase-js": "^2.39.0",
@@ -79,7 +89,7 @@
79
89
  "@types/lodash": "4.14.191",
80
90
  "@types/pluralize": "^0.0.29",
81
91
  "@types/uuid": "^9.0.2",
82
- "@vitest/ui": "^0.31.0",
92
+ "@vitest/ui": "^1.6.0",
83
93
  "cross-env": "^7.0.3",
84
94
  "dexie": "^3.2.4",
85
95
  "eslint-plugin-tyrecheck": "^2.54.4",
@@ -91,17 +101,7 @@
91
101
  "tsup": "^6.7.0",
92
102
  "unbuild": "^1.2.1",
93
103
  "vite": "^4.0.0",
94
- "vitest": "^0.31.0"
95
- },
96
- "dependencies": {
97
- "@fastify/deepmerge": "^1.3.0",
98
- "dataloader": "^2.2.2",
99
- "ignore": "^5.2.4",
100
- "klaw": "^4.1.0",
101
- "lodash": "^4.17.21",
102
- "pluralize": "^8.0.0",
103
- "uuid": ">=8",
104
- "zod": "^3.21.4"
104
+ "vitest": "^1.6.0"
105
105
  },
106
106
  "scripts": {
107
107
  "test": "vitest --run && vitest typecheck --run",