rads-db 3.1.16 → 3.2.1
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/config.d.ts +1 -1
- package/dist/index.cjs +4 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +4 -1
- package/dist/{types-9cb9d6e7.d.ts → types-dd50fa7e.d.ts} +9 -8
- package/drivers/azureCosmos.cjs +3 -3
- package/drivers/azureCosmos.mjs +3 -3
- package/drivers/azureStorageBlob.cjs +4 -4
- package/drivers/azureStorageBlob.mjs +4 -4
- package/drivers/sql.cjs +847 -0
- package/drivers/sql.d.ts +12 -0
- package/drivers/sql.mjs +704 -0
- package/package.json +6 -1
package/dist/config.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1195,7 +1195,10 @@ function getDriverInstanceInner(schema, key, driverConstructor) {
|
|
|
1195
1195
|
deleteMany(args, ctx) {
|
|
1196
1196
|
throw new Error(`"deleteMany" not supported for driver "${driverInstance.driverName}"`);
|
|
1197
1197
|
},
|
|
1198
|
-
...driverInstance
|
|
1198
|
+
...driverInstance,
|
|
1199
|
+
get client() {
|
|
1200
|
+
return driverInstance.client;
|
|
1201
|
+
}
|
|
1199
1202
|
};
|
|
1200
1203
|
}
|
|
1201
1204
|
function addDryRunSupport(driverInstance, entity) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EntityDecoratorArgs, U as UiDecoratorArgs, a as UiFieldDecoratorArgs, V as ValidateEntityDecoratorArgs, b as ValidateFieldDecoratorArgs, F as FieldDecoratorArgs, C as ComputedDecoratorArgs, S as Schema, D as DriverConstructor, c as Driver, d as ComputedContext, R as RadsRequestContext, e as CreateRadsDbArgs, f as CreateRadsDbClientArgs } from './types-
|
|
2
|
-
export { N as Change, x as ComputedContextGlobal, k as CreateRadsArgsDrivers, m as CreateRadsDbArgsNormalized, aj as DeepKeys, ae as DeepPartial, ac as DeepPartialWithNulls, ad as DeepPartialWithNullsItem, ak as EntityMethods, w as EnumDefinition, v as FieldDefinition, I as FileSystemNode, u as FileUploadArgs, q as FileUploadDriver, p as FileUploadResult, B as GenerateClientNormalizedOptions, A as GenerateClientOptions, a8 as Get, _ as GetAggArgs, $ as GetAggArgsAgg, a2 as GetAggArgsAny, a5 as GetAggResponse, Z as GetArgs, a1 as GetArgsAny, a4 as GetArgsInclude, O as GetManyArgs, a0 as GetManyArgsAny, a6 as GetManyResponse, a7 as GetResponse, a9 as GetResponseInclude, aa as GetResponseIncludeSelect, ab as GetResponseNoInclude, s as GetRestRoutesArgs, G as GetRestRoutesOptions, t as GetRestRoutesResponse, ag as InverseRelation, M as MinimalDriver, ai as Put, ah as PutArgs, P as PutEffect, g as RadsConfig, h as RadsConfigDataSource, r as RadsDbInstance, L as RadsFeature, y as RadsHookDoc, K as RadsUiSlotDefinition, J as RadsUiSlotName, H as RadsVitePluginOptions, af as Relation, i as RequiredFields, l as RestDriverOptions, z as RestFileUploadDriverOptions, n as SchemaLoadResult, o as SchemaValidators, T as TypeDefinition, j as ValidateStringDecoratorArgs, Q as VerifyManyArgs, a3 as VerifyManyArgsAny, X as VerifyManyResponse, Y as Where, W as WhereJsonContains } from './types-
|
|
1
|
+
import { E as EntityDecoratorArgs, U as UiDecoratorArgs, a as UiFieldDecoratorArgs, V as ValidateEntityDecoratorArgs, b as ValidateFieldDecoratorArgs, F as FieldDecoratorArgs, C as ComputedDecoratorArgs, S as Schema, D as DriverConstructor, c as Driver, d as ComputedContext, R as RadsRequestContext, e as CreateRadsDbArgs, f as CreateRadsDbClientArgs } from './types-dd50fa7e.js';
|
|
2
|
+
export { N as Change, x as ComputedContextGlobal, k as CreateRadsArgsDrivers, m as CreateRadsDbArgsNormalized, aj as DeepKeys, ae as DeepPartial, ac as DeepPartialWithNulls, ad as DeepPartialWithNullsItem, ak as EntityMethods, w as EnumDefinition, v as FieldDefinition, I as FileSystemNode, u as FileUploadArgs, q as FileUploadDriver, p as FileUploadResult, B as GenerateClientNormalizedOptions, A as GenerateClientOptions, a8 as Get, _ as GetAggArgs, $ as GetAggArgsAgg, a2 as GetAggArgsAny, a5 as GetAggResponse, Z as GetArgs, a1 as GetArgsAny, a4 as GetArgsInclude, O as GetManyArgs, a0 as GetManyArgsAny, a6 as GetManyResponse, a7 as GetResponse, a9 as GetResponseInclude, aa as GetResponseIncludeSelect, ab as GetResponseNoInclude, s as GetRestRoutesArgs, G as GetRestRoutesOptions, t as GetRestRoutesResponse, ag as InverseRelation, M as MinimalDriver, ai as Put, ah as PutArgs, P as PutEffect, g as RadsConfig, h as RadsConfigDataSource, r as RadsDbInstance, L as RadsFeature, y as RadsHookDoc, K as RadsUiSlotDefinition, J as RadsUiSlotName, H as RadsVitePluginOptions, af as Relation, i as RequiredFields, l as RestDriverOptions, z as RestFileUploadDriverOptions, n as SchemaLoadResult, o as SchemaValidators, T as TypeDefinition, j as ValidateStringDecoratorArgs, Q as VerifyManyArgs, a3 as VerifyManyArgsAny, X as VerifyManyResponse, Y as Where, W as WhereJsonContains } from './types-dd50fa7e.js';
|
|
3
3
|
import { RadsDb } from '_rads-db';
|
|
4
4
|
export { RadsDb } from '_rads-db';
|
|
5
5
|
|
package/dist/index.mjs
CHANGED
|
@@ -1188,7 +1188,10 @@ function getDriverInstanceInner(schema, key, driverConstructor) {
|
|
|
1188
1188
|
deleteMany(args, ctx) {
|
|
1189
1189
|
throw new Error(`"deleteMany" not supported for driver "${driverInstance.driverName}"`);
|
|
1190
1190
|
},
|
|
1191
|
-
...driverInstance
|
|
1191
|
+
...driverInstance,
|
|
1192
|
+
get client() {
|
|
1193
|
+
return driverInstance.client;
|
|
1194
|
+
}
|
|
1192
1195
|
};
|
|
1193
1196
|
}
|
|
1194
1197
|
function addDryRunSupport(driverInstance, entity) {
|
|
@@ -5,7 +5,7 @@ type Change<T> = {
|
|
|
5
5
|
[K in keyof T]?: T[K] extends any[] ? T[K] : T[K] extends {} ? Change<T[K]> : T[K];
|
|
6
6
|
};
|
|
7
7
|
interface GetManyArgs<EN extends keyof EntityMeta> extends GetArgs<EN> {
|
|
8
|
-
cursor?: string |
|
|
8
|
+
cursor?: string | undefined;
|
|
9
9
|
maxItemCount?: number;
|
|
10
10
|
orderBy?: string;
|
|
11
11
|
orderByArray?: OrderBy<EntityMeta[EN]>;
|
|
@@ -15,7 +15,7 @@ interface VerifyManyArgs<EN extends keyof EntityMeta> extends GetManyArgs<EN> {
|
|
|
15
15
|
dryRun?: boolean;
|
|
16
16
|
}
|
|
17
17
|
interface VerifyManyResponse {
|
|
18
|
-
cursor: string |
|
|
18
|
+
cursor: string | undefined;
|
|
19
19
|
correctCount: number;
|
|
20
20
|
incorrectCount: number;
|
|
21
21
|
incorrectDocs: {
|
|
@@ -55,7 +55,7 @@ type GetAggResponse<EN extends keyof EntityMeta, A extends GetAggArgs<EN>> = {
|
|
|
55
55
|
};
|
|
56
56
|
interface GetManyResponse<EN extends keyof EntityMeta, A extends GetArgs<EN>> {
|
|
57
57
|
nodes: GetResponse<EN, A>[];
|
|
58
|
-
cursor: string |
|
|
58
|
+
cursor: string | undefined;
|
|
59
59
|
}
|
|
60
60
|
type GetResponse<EN extends keyof EntityMeta, A extends GetArgs<EN>> = A extends {
|
|
61
61
|
include: any;
|
|
@@ -309,23 +309,24 @@ interface MinimalDriver {
|
|
|
309
309
|
driverName: string;
|
|
310
310
|
/** raw underlying data access service - e.g. sql client or azure storage client */
|
|
311
311
|
client?: any;
|
|
312
|
-
putMany: (
|
|
312
|
+
putMany: (items: Record<string, any>[], ctx?: RadsRequestContext) => MaybePromise<void>;
|
|
313
313
|
getMany: (args?: GetManyArgsAny, ctx?: RadsRequestContext) => MaybePromise<{
|
|
314
314
|
nodes: Record<string, any>[];
|
|
315
|
-
cursor: string |
|
|
315
|
+
cursor: string | undefined;
|
|
316
316
|
}>;
|
|
317
|
-
get?: (args: GetArgsAny, ctx?: RadsRequestContext) => MaybePromise<Record<string, any> |
|
|
317
|
+
get?: (args: GetArgsAny, ctx?: RadsRequestContext) => MaybePromise<Record<string, any> | undefined>;
|
|
318
318
|
getAll?: (args: GetManyArgsAny, ctx?: RadsRequestContext) => MaybePromise<Record<string, any>[]>;
|
|
319
319
|
getAgg?: (args: GetAggArgsAny, ctx?: RadsRequestContext) => MaybePromise<Record<string, any>>;
|
|
320
320
|
deleteMany?: (args: GetManyArgsAny, ctx?: RadsRequestContext) => MaybePromise<{
|
|
321
321
|
nodes: Record<string, any>[];
|
|
322
|
-
cursor: string |
|
|
322
|
+
cursor: string | undefined;
|
|
323
323
|
}>;
|
|
324
324
|
deleteAll?: (args: GetManyArgsAny, ctx?: RadsRequestContext) => MaybePromise<Record<string, any>[]>;
|
|
325
325
|
put?: (data: Record<string, any>, ctx?: RadsRequestContext) => MaybePromise<void>;
|
|
326
326
|
verifyMany?: (args?: VerifyManyArgsAny, ctx?: RadsRequestContext) => MaybePromise<VerifyManyResponse>;
|
|
327
|
+
generateMigrationScript?: () => MaybePromise<string | undefined>;
|
|
327
328
|
}
|
|
328
|
-
type Driver = Required<Omit<MinimalDriver, 'verifyMany' | 'client'>> & Pick<MinimalDriver, 'verifyMany' | 'client'>;
|
|
329
|
+
type Driver = Required<Omit<MinimalDriver, 'verifyMany' | 'client' | 'generateMigrationScript'>> & Pick<MinimalDriver, 'verifyMany' | 'client' | 'generateMigrationScript'>;
|
|
329
330
|
interface FieldDefinition {
|
|
330
331
|
name: string;
|
|
331
332
|
type: string;
|
package/drivers/azureCosmos.cjs
CHANGED
|
@@ -57,14 +57,14 @@ var _default = options => (schema, entity) => {
|
|
|
57
57
|
const items = await getItemByIds([where.id], ctx, args.include);
|
|
58
58
|
return {
|
|
59
59
|
nodes: [items[0]].filter(x => x),
|
|
60
|
-
cursor:
|
|
60
|
+
cursor: void 0
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
if (whereKeys[0] === "id_in" && where.id_in != null) {
|
|
64
64
|
const items = await getItemByIds(where.id_in, ctx, args.include);
|
|
65
65
|
return {
|
|
66
66
|
nodes: items.filter(x => x),
|
|
67
|
-
cursor:
|
|
67
|
+
cursor: void 0
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -90,7 +90,7 @@ var _default = options => (schema, entity) => {
|
|
|
90
90
|
});
|
|
91
91
|
return {
|
|
92
92
|
nodes: page.resources,
|
|
93
|
-
cursor: page.continuationToken ||
|
|
93
|
+
cursor: page.continuationToken || void 0
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
const instance = {
|
package/drivers/azureCosmos.mjs
CHANGED
|
@@ -34,11 +34,11 @@ export default (options) => (schema, entity) => {
|
|
|
34
34
|
if (whereKeys.length === 1) {
|
|
35
35
|
if (whereKeys[0] === "id" && where.id != null) {
|
|
36
36
|
const items = await getItemByIds([where.id], ctx, args.include);
|
|
37
|
-
return { nodes: [items[0]].filter((x) => x), cursor:
|
|
37
|
+
return { nodes: [items[0]].filter((x) => x), cursor: void 0 };
|
|
38
38
|
}
|
|
39
39
|
if (whereKeys[0] === "id_in" && where.id_in != null) {
|
|
40
40
|
const items = await getItemByIds(where.id_in, ctx, args.include);
|
|
41
|
-
return { nodes: items.filter((x) => x), cursor:
|
|
41
|
+
return { nodes: items.filter((x) => x), cursor: void 0 };
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
const { query, parameters } = getCosmosQuery(schema, entity, args);
|
|
@@ -57,7 +57,7 @@ export default (options) => (schema, entity) => {
|
|
|
57
57
|
ctx?.log?.({ charge: page.requestCharge, request: query });
|
|
58
58
|
return {
|
|
59
59
|
nodes: page.resources,
|
|
60
|
-
cursor: page.continuationToken ||
|
|
60
|
+
cursor: page.continuationToken || void 0
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
const instance = {
|
|
@@ -43,14 +43,14 @@ var _default = options => (schema, entity) => {
|
|
|
43
43
|
const items = await getItemByIds([where.id], ctx);
|
|
44
44
|
return {
|
|
45
45
|
nodes: [items[0]].filter(x => x),
|
|
46
|
-
cursor:
|
|
46
|
+
cursor: void 0
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
if (whereKeys[0] === "id_in" && where.id_in != null) {
|
|
50
50
|
const items = await getItemByIds(where.id_in, ctx);
|
|
51
51
|
return {
|
|
52
52
|
nodes: items.filter(x => x),
|
|
53
|
-
cursor:
|
|
53
|
+
cursor: void 0
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -69,12 +69,12 @@ var _default = options => (schema, entity) => {
|
|
|
69
69
|
const nodes = await getBlobsByNames(ids, ctx);
|
|
70
70
|
return {
|
|
71
71
|
nodes,
|
|
72
|
-
cursor: page.continuationToken ||
|
|
72
|
+
cursor: page.continuationToken || void 0
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
return {
|
|
76
76
|
nodes: [],
|
|
77
|
-
cursor:
|
|
77
|
+
cursor: void 0
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
const instance = {
|
|
@@ -33,11 +33,11 @@ export default (options) => (schema, entity) => {
|
|
|
33
33
|
if (whereKeys.length === 1) {
|
|
34
34
|
if (whereKeys[0] === "id" && where.id != null) {
|
|
35
35
|
const items = await getItemByIds([where.id], ctx);
|
|
36
|
-
return { nodes: [items[0]].filter((x) => x), cursor:
|
|
36
|
+
return { nodes: [items[0]].filter((x) => x), cursor: void 0 };
|
|
37
37
|
}
|
|
38
38
|
if (whereKeys[0] === "id_in" && where.id_in != null) {
|
|
39
39
|
const items = await getItemByIds(where.id_in, ctx);
|
|
40
|
-
return { nodes: items.filter((x) => x), cursor:
|
|
40
|
+
return { nodes: items.filter((x) => x), cursor: void 0 };
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
if (whereKeys.length > 1) throw new Error("Complex queries are not supported by azureStorageBlob");
|
|
@@ -52,12 +52,12 @@ export default (options) => (schema, entity) => {
|
|
|
52
52
|
const nodes = await getBlobsByNames(ids, ctx);
|
|
53
53
|
return {
|
|
54
54
|
nodes,
|
|
55
|
-
cursor: page.continuationToken ||
|
|
55
|
+
cursor: page.continuationToken || void 0
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
return {
|
|
59
59
|
nodes: [],
|
|
60
|
-
cursor:
|
|
60
|
+
cursor: void 0
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
const instance = {
|