rads-db 3.2.1 → 3.2.3
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 +2 -1
- package/dist/index.d.ts +3 -2
- package/dist/{types-dd50fa7e.d.ts → types-9a0ba02b.d.ts} +10 -1
- package/drivers/sql.cjs +5 -4
- package/drivers/sql.d.ts +1 -9
- package/drivers/sql.mjs +5 -4
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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 {
|
|
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-9a0ba02b.js';
|
|
2
|
+
export { O as Change, x as ComputedContextGlobal, k as CreateRadsArgsDrivers, m as CreateRadsDbArgsNormalized, ak as DeepKeys, af as DeepPartial, ad as DeepPartialWithNulls, ae as DeepPartialWithNullsItem, al as EntityMethods, w as EnumDefinition, v as FieldDefinition, J as FileSystemNode, u as FileUploadArgs, q as FileUploadDriver, p as FileUploadResult, H as GenerateClientNormalizedOptions, B as GenerateClientOptions, a9 as Get, $ as GetAggArgs, a0 as GetAggArgsAgg, a3 as GetAggArgsAny, a6 as GetAggResponse, _ as GetArgs, a2 as GetArgsAny, a5 as GetArgsInclude, Q as GetManyArgs, a1 as GetManyArgsAny, a7 as GetManyResponse, a8 as GetResponse, aa as GetResponseInclude, ab as GetResponseIncludeSelect, ac as GetResponseNoInclude, s as GetRestRoutesArgs, G as GetRestRoutesOptions, t as GetRestRoutesResponse, ah as InverseRelation, M as MinimalDriver, aj as Put, ai as PutArgs, P as PutEffect, g as RadsConfig, h as RadsConfigDataSource, r as RadsDbInstance, N as RadsFeature, y as RadsHookDoc, L as RadsUiSlotDefinition, K as RadsUiSlotName, I as RadsVitePluginOptions, ag as Relation, i as RequiredFields, l as RestDriverOptions, A as RestFileUploadDriverOptions, n as SchemaLoadResult, o as SchemaValidators, z as SqlDriverOptions, T as TypeDefinition, j as ValidateStringDecoratorArgs, X as VerifyManyArgs, a4 as VerifyManyArgsAny, Y as VerifyManyResponse, Z as Where, W as WhereJsonContains } from './types-9a0ba02b.js';
|
|
3
3
|
import { RadsDb } from '_rads-db';
|
|
4
4
|
export { RadsDb } from '_rads-db';
|
|
5
|
+
import 'mssql';
|
|
5
6
|
|
|
6
7
|
declare function entity<T>(meta?: EntityDecoratorArgs): (classConstructor: new () => T, _ctx?: ClassDecoratorContext<any>) => void;
|
|
7
8
|
declare function ui<T>(args: T extends new () => any ? UiDecoratorArgs<InstanceType<T>> : UiFieldDecoratorArgs): (classConstructor: T, _ctx?: ClassDecoratorContext | ClassFieldDecoratorContext) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { config } from 'mssql';
|
|
1
2
|
import { EntityMeta, RadsDb } from '_rads-db';
|
|
2
3
|
|
|
3
4
|
type MaybePromise$1<T> = Promise<T> | T;
|
|
@@ -373,6 +374,14 @@ interface PutEffect {
|
|
|
373
374
|
beforePut?: (computedContext: ComputedContext, docs: RadsHookDoc[], ctx: RadsRequestContext) => MaybePromise<any>;
|
|
374
375
|
afterPut: (computedContext: ComputedContext, docs: RadsHookDoc[], beforePutResult: any, ctx: RadsRequestContext) => MaybePromise<any>;
|
|
375
376
|
}
|
|
377
|
+
interface SqlDriverOptions {
|
|
378
|
+
authentication: config['authentication'];
|
|
379
|
+
server: config['server'];
|
|
380
|
+
database: config['database'];
|
|
381
|
+
options?: Omit<config, 'authentication' | 'server' | 'database'>;
|
|
382
|
+
tablePrefix?: string;
|
|
383
|
+
stagingTablePrefix?: string;
|
|
384
|
+
}
|
|
376
385
|
interface RestFileUploadDriverOptions {
|
|
377
386
|
/** @default '/api' */
|
|
378
387
|
baseUrl?: string;
|
|
@@ -458,4 +467,4 @@ interface RadsFeature {
|
|
|
458
467
|
afterUploadFile?: (result: FileUploadResult, args: FileUploadArgs) => MaybePromise<void>;
|
|
459
468
|
}
|
|
460
469
|
|
|
461
|
-
export {
|
|
470
|
+
export { GetAggArgs as $, RestFileUploadDriverOptions as A, GenerateClientOptions as B, ComputedDecoratorArgs as C, DriverConstructor as D, EntityDecoratorArgs as E, FieldDecoratorArgs as F, GetRestRoutesOptions as G, GenerateClientNormalizedOptions as H, RadsVitePluginOptions as I, FileSystemNode as J, RadsUiSlotName as K, RadsUiSlotDefinition as L, MinimalDriver as M, RadsFeature as N, Change as O, PutEffect as P, GetManyArgs as Q, RadsRequestContext as R, Schema as S, TypeDefinition as T, UiDecoratorArgs as U, ValidateEntityDecoratorArgs as V, WhereJsonContains as W, VerifyManyArgs as X, VerifyManyResponse as Y, Where as Z, GetArgs as _, UiFieldDecoratorArgs as a, GetAggArgsAgg as a0, GetManyArgsAny as a1, GetArgsAny as a2, GetAggArgsAny as a3, VerifyManyArgsAny as a4, GetArgsInclude as a5, GetAggResponse as a6, GetManyResponse as a7, GetResponse as a8, Get as a9, GetResponseInclude as aa, GetResponseIncludeSelect as ab, GetResponseNoInclude as ac, DeepPartialWithNulls as ad, DeepPartialWithNullsItem as ae, DeepPartial as af, Relation as ag, InverseRelation as ah, PutArgs as ai, Put as aj, DeepKeys as ak, EntityMethods as al, ValidateFieldDecoratorArgs as b, Driver as c, ComputedContext as d, CreateRadsDbArgs as e, CreateRadsDbClientArgs as f, RadsConfig as g, RadsConfigDataSource as h, RequiredFields as i, ValidateStringDecoratorArgs as j, CreateRadsArgsDrivers as k, RestDriverOptions as l, CreateRadsDbArgsNormalized as m, SchemaLoadResult as n, SchemaValidators as o, FileUploadResult as p, FileUploadDriver as q, RadsDbInstance as r, GetRestRoutesArgs as s, GetRestRoutesResponse as t, FileUploadArgs as u, FieldDefinition as v, EnumDefinition as w, ComputedContextGlobal as x, RadsHookDoc as y, SqlDriverOptions as z };
|
package/drivers/sql.cjs
CHANGED
|
@@ -314,10 +314,10 @@ var _default = options => {
|
|
|
314
314
|
for (const p in parameters) {
|
|
315
315
|
req.input(p, parameters[p]);
|
|
316
316
|
}
|
|
317
|
-
|
|
317
|
+
ctx?.log?.(query);
|
|
318
318
|
const result2 = await req.query(query);
|
|
319
319
|
const nodes = result2.recordset || [];
|
|
320
|
-
|
|
320
|
+
ctx?.log?.(result2);
|
|
321
321
|
return nodes[0];
|
|
322
322
|
},
|
|
323
323
|
async putMany(items, ctx) {
|
|
@@ -366,6 +366,7 @@ var _default = options => {
|
|
|
366
366
|
console.error(`\u274C Failed insert into ${realTable} [${valuesChunk.length} rows]`);
|
|
367
367
|
console.error(`First 300 chars of query:
|
|
368
368
|
${insertQuery.slice(0, 300)}...`);
|
|
369
|
+
console.error(e);
|
|
369
370
|
throw e;
|
|
370
371
|
}
|
|
371
372
|
}
|
|
@@ -657,10 +658,10 @@ END;
|
|
|
657
658
|
for (const p in parameters) {
|
|
658
659
|
req.input(p, parameters[p]);
|
|
659
660
|
}
|
|
660
|
-
|
|
661
|
+
ctx?.log?.(query);
|
|
661
662
|
const result2 = await req.query(query);
|
|
662
663
|
const nodes = result2.recordset || [];
|
|
663
|
-
|
|
664
|
+
ctx?.log?.(result2);
|
|
664
665
|
return {
|
|
665
666
|
nodes,
|
|
666
667
|
cursor: nodes.length === maxItemCount ? String((Number(args.cursor || "0") || 0) + nodes.length) : void 0
|
package/drivers/sql.d.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SqlDriverOptions } from '@/types';
|
|
2
2
|
import type { Schema } from 'rads-db';
|
|
3
|
-
interface SqlDriverOptions {
|
|
4
|
-
authentication: config['authentication'];
|
|
5
|
-
server: config['server'];
|
|
6
|
-
database: config['database'];
|
|
7
|
-
options?: Omit<config, 'authentication' | 'server' | 'database'>;
|
|
8
|
-
tablePrefix?: string;
|
|
9
|
-
stagingTablePrefix?: string;
|
|
10
|
-
}
|
|
11
3
|
declare const _default: (options: SqlDriverOptions) => (schema: Schema, entity: string) => MinimalDriver;
|
|
12
4
|
export default _default;
|
package/drivers/sql.mjs
CHANGED
|
@@ -183,10 +183,10 @@ export default (options) => {
|
|
|
183
183
|
for (const p in parameters) {
|
|
184
184
|
req.input(p, parameters[p]);
|
|
185
185
|
}
|
|
186
|
-
|
|
186
|
+
ctx?.log?.(query);
|
|
187
187
|
const result2 = await req.query(query);
|
|
188
188
|
const nodes = result2.recordset || [];
|
|
189
|
-
|
|
189
|
+
ctx?.log?.(result2);
|
|
190
190
|
return nodes[0];
|
|
191
191
|
},
|
|
192
192
|
async putMany(items, ctx) {
|
|
@@ -237,6 +237,7 @@ export default (options) => {
|
|
|
237
237
|
console.error(`\u274C Failed insert into ${realTable} [${valuesChunk.length} rows]`);
|
|
238
238
|
console.error(`First 300 chars of query:
|
|
239
239
|
${insertQuery.slice(0, 300)}...`);
|
|
240
|
+
console.error(e);
|
|
240
241
|
throw e;
|
|
241
242
|
}
|
|
242
243
|
}
|
|
@@ -531,10 +532,10 @@ END;
|
|
|
531
532
|
for (const p in parameters) {
|
|
532
533
|
req.input(p, parameters[p]);
|
|
533
534
|
}
|
|
534
|
-
|
|
535
|
+
ctx?.log?.(query);
|
|
535
536
|
const result2 = await req.query(query);
|
|
536
537
|
const nodes = result2.recordset || [];
|
|
537
|
-
|
|
538
|
+
ctx?.log?.(result2);
|
|
538
539
|
return {
|
|
539
540
|
nodes,
|
|
540
541
|
cursor: nodes.length === maxItemCount ? String((Number(args.cursor || "0") || 0) + nodes.length) : void 0
|