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 CHANGED
@@ -1,4 +1,5 @@
1
- import { g as RadsConfig, T as TypeDefinition } from './types-dd50fa7e.js';
1
+ import { g as RadsConfig, T as TypeDefinition } from './types-9a0ba02b.js';
2
+ import 'mssql';
2
3
  import '_rads-db';
3
4
 
4
5
  declare function defineRadsConfig(config: RadsConfig): RadsConfig;
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-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';
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 { GetAggArgsAgg as $, GenerateClientOptions as A, GenerateClientNormalizedOptions as B, ComputedDecoratorArgs as C, DriverConstructor as D, EntityDecoratorArgs as E, FieldDecoratorArgs as F, GetRestRoutesOptions as G, RadsVitePluginOptions as H, FileSystemNode as I, RadsUiSlotName as J, RadsUiSlotDefinition as K, RadsFeature as L, MinimalDriver as M, Change as N, GetManyArgs as O, PutEffect as P, VerifyManyArgs as Q, RadsRequestContext as R, Schema as S, TypeDefinition as T, UiDecoratorArgs as U, ValidateEntityDecoratorArgs as V, WhereJsonContains as W, VerifyManyResponse as X, Where as Y, GetArgs as Z, GetAggArgs as _, UiFieldDecoratorArgs as a, GetManyArgsAny as a0, GetArgsAny as a1, GetAggArgsAny as a2, VerifyManyArgsAny as a3, GetArgsInclude as a4, GetAggResponse as a5, GetManyResponse as a6, GetResponse as a7, Get as a8, GetResponseInclude as a9, GetResponseIncludeSelect as aa, GetResponseNoInclude as ab, DeepPartialWithNulls as ac, DeepPartialWithNullsItem as ad, DeepPartial as ae, Relation as af, InverseRelation as ag, PutArgs as ah, Put as ai, DeepKeys as aj, EntityMethods as ak, 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, RestFileUploadDriverOptions as z };
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
- console.log(query);
317
+ ctx?.log?.(query);
318
318
  const result2 = await req.query(query);
319
319
  const nodes = result2.recordset || [];
320
- console.log(result2);
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
- console.log(query);
661
+ ctx?.log?.(query);
661
662
  const result2 = await req.query(query);
662
663
  const nodes = result2.recordset || [];
663
- console.log(result2);
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 { config } from 'mssql';
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
- console.log(query);
186
+ ctx?.log?.(query);
187
187
  const result2 = await req.query(query);
188
188
  const nodes = result2.recordset || [];
189
- console.log(result2);
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
- console.log(query);
535
+ ctx?.log?.(query);
535
536
  const result2 = await req.query(query);
536
537
  const nodes = result2.recordset || [];
537
- console.log(result2);
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rads-db",
3
- "version": "3.2.1",
3
+ "version": "3.2.3",
4
4
  "description": "Say goodbye to boilerplate code and hello to efficient and elegant syntax.",
5
5
  "author": "",
6
6
  "license": "ISC",