rads-db 3.0.45 → 3.0.47
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 +6 -6
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +6 -6
- package/package.json +41 -41
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
|
-
|
|
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
|
|
70
|
-
let fieldSchema = getFieldZodSchemaBase(zodSchemas, schema, field
|
|
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
|
|
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
|
|
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.d.ts
CHANGED
|
@@ -53,15 +53,16 @@ type GetResponse<E, EN extends keyof EntityMeta, A extends GetArgs<E, EN, any>>
|
|
|
53
53
|
include: any;
|
|
54
54
|
} ? GetResponseInclude<E, EN, A['include']> : GetResponseNoInclude<E, EN>;
|
|
55
55
|
type RelationData<EN extends keyof EntityMeta, K extends keyof EntityMeta[EN]['relations']> = Pick<EntityMeta[EN]['relations'][K]['entity'], EntityMeta[EN]['relations'][K]['denormFields']>;
|
|
56
|
+
type KeepArray<TMaybeArray, TType> = NonNullable<TMaybeArray> extends any[] ? TType[] : TType;
|
|
56
57
|
type GetResponseInclude<E, EN extends keyof EntityMeta, I extends GetArgsInclude<E, EN>> = I extends {
|
|
57
58
|
_pick: string[];
|
|
58
59
|
} ? GetResponseIncludeSelect<E, I> : {
|
|
59
|
-
[K in keyof E]: K extends keyof EntityMeta[EN]['relations'] ? K extends keyof I ? GetResponseInclude<EntityMeta[EN]['relations'][K]['entity'], EntityMeta[EN]['relations'][K]['entityName'], I[K]
|
|
60
|
+
[K in keyof E]: K extends keyof EntityMeta[EN]['relations'] ? K extends keyof I ? KeepArray<E[K], GetResponseInclude<EntityMeta[EN]['relations'][K]['entity'], EntityMeta[EN]['relations'][K]['entityName'], I[K]>> : KeepArray<E[K], RelationData<EN, K>> : E[K];
|
|
60
61
|
};
|
|
61
62
|
interface GetResponseIncludeSelect<E, I> {
|
|
62
63
|
}
|
|
63
64
|
type GetResponseNoInclude<E, EN extends keyof EntityMeta> = {
|
|
64
|
-
[K in keyof E]: K extends keyof EntityMeta[EN]['relations'] ? E[K]
|
|
65
|
+
[K in keyof E]: K extends keyof EntityMeta[EN]['relations'] ? KeepArray<E[K], RelationData<EN, K>> : E[K];
|
|
65
66
|
};
|
|
66
67
|
type DeepPartial<T> = {
|
|
67
68
|
[K in keyof T]?: NonNullable<T[K]> extends any[] ? DeepPartial<NonNullable<T[K]>[number]>[] : NonNullable<T[K]> extends Record<string, any> ? DeepPartial<T[K]> | null : T[K] | null;
|
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
|
-
|
|
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
|
|
62
|
-
let fieldSchema = getFieldZodSchemaBase(zodSchemas, schema, field
|
|
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
|
|
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
|
|
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
|
}
|
package/package.json
CHANGED
|
@@ -1,50 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rads-db",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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.47",
|
|
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
|
-
"
|
|
21
|
-
"
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
|
+
"import": "./dist/index.mjs"
|
|
22
14
|
},
|
|
23
15
|
"./drivers/*": {
|
|
24
16
|
"types": "./drivers/*.d.ts",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
17
|
+
"require": "./drivers/*.cjs",
|
|
18
|
+
"import": "./drivers/*.mjs"
|
|
27
19
|
},
|
|
28
20
|
"./fileUploadDrivers/*": {
|
|
29
21
|
"types": "./fileUploadDrivers/*.d.ts",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
22
|
+
"require": "./fileUploadDrivers/*.cjs",
|
|
23
|
+
"import": "./fileUploadDrivers/*.mjs"
|
|
32
24
|
},
|
|
33
25
|
"./integrations/*": {
|
|
34
26
|
"types": "./integrations/*.d.ts",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
27
|
+
"require": "./integrations/*.cjs",
|
|
28
|
+
"import": "./integrations/*.mjs"
|
|
37
29
|
},
|
|
38
30
|
"./features/*": {
|
|
39
31
|
"types": "./features/*.d.ts",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
32
|
+
"require": "./features/*.cjs",
|
|
33
|
+
"import": "./features/*.mjs"
|
|
42
34
|
}
|
|
43
35
|
},
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
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
|
-
"
|
|
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": "^
|
|
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": "^
|
|
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",
|