rads-db 3.2.7 → 3.2.9

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,4 @@
1
- import { g as RadsConfig, T as TypeDefinition } from './types-131986eb.js';
1
+ import { g as RadsConfig, T as TypeDefinition } from './types-98e90d7b.js';
2
2
  import 'mssql';
3
3
  import '_rads-db';
4
4
 
package/dist/index.cjs CHANGED
@@ -436,6 +436,9 @@ async function handlePrecomputed(context, docs, ctx) {
436
436
  const { precomputedFields, nestedTypeFields, fields } = schema[typeName];
437
437
  const computed = options.computed;
438
438
  for (const fieldName of precomputedFields || []) {
439
+ if (ctx.skipPrecomputed?.includes(fieldName)) {
440
+ continue;
441
+ }
439
442
  const typeComputed = computed[typeName];
440
443
  let handler = typeComputed?.[fieldName];
441
444
  if (!handler) {
@@ -578,12 +581,17 @@ async function handleEffectsAfterPut(context, docs, beforePutResults, ctx) {
578
581
  );
579
582
  }
580
583
 
581
- function cleanUndefinedAndNull(obj, isChange = false) {
584
+ function cleanEntity(obj, isChange = false) {
582
585
  for (const key in obj) {
583
586
  if (obj[key] == null && !isChange)
584
587
  delete obj[key];
588
+ if (key.endsWith("_replace")) {
589
+ obj[key.slice(0, -8)] = obj[key];
590
+ delete obj[key];
591
+ continue;
592
+ }
585
593
  if (___default.isPlainObject(obj[key]))
586
- cleanUndefinedAndNull(obj[key], isChange || key === "change");
594
+ cleanEntity(obj[key], isChange || key === "change");
587
595
  }
588
596
  }
589
597
 
@@ -869,7 +877,7 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
869
877
  const oldDoc = oldDocsById[doc.id];
870
878
  doc = merge(oldDoc, doc);
871
879
  if (!options.keepNulls)
872
- cleanUndefinedAndNull(doc);
880
+ cleanEntity(doc);
873
881
  return { oldDoc, doc };
874
882
  });
875
883
  await handlePrecomputed(computedContext, docArgsToSave, ctx);
@@ -912,7 +920,7 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
912
920
  }
913
921
  }
914
922
  if (!options.keepNulls)
915
- cleanUndefinedAndNull(doc);
923
+ cleanEntity(doc);
916
924
  return { oldDoc, doc, events: [] };
917
925
  });
918
926
  if (entitySchema.decorators.precomputed?.preset === "eventSourcing") {
@@ -1042,10 +1050,11 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
1042
1050
  throw new Error("Id is required");
1043
1051
  ctx = { ...options.context, ...ctx };
1044
1052
  const oldDoc = await driverInstance.get({ where: { id: doc.id } }, ctx);
1053
+ console.log(___default.cloneDeep(doc), oldDoc, merge(oldDoc || {}, doc));
1045
1054
  if (oldDoc)
1046
1055
  doc = merge(oldDoc, doc);
1047
1056
  if (!options.keepNulls)
1048
- cleanUndefinedAndNull(doc);
1057
+ cleanEntity(doc);
1049
1058
  const docArgsToSave = [{ doc, oldDoc }];
1050
1059
  await handlePrecomputed(computedContext, docArgsToSave, ctx);
1051
1060
  await beforePut(docArgsToSave, ctx, computedContext);
@@ -1415,7 +1424,7 @@ function createRadsDbClient(dataSourceKey, args) {
1415
1424
  return generateMethods(s, validators, radsDbArgs);
1416
1425
  }
1417
1426
 
1418
- exports.cleanUndefinedAndNull = cleanUndefinedAndNull;
1427
+ exports.cleanEntity = cleanEntity;
1419
1428
  exports.computed = computed;
1420
1429
  exports.createRadsDb = createRadsDb;
1421
1430
  exports.createRadsDbClient = createRadsDbClient;
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-131986eb.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-131986eb.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-98e90d7b.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, aj as JsonPutOperations, M as MinimalDriver, ai as Put, 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-98e90d7b.js';
3
3
  import { RadsDb } from '_rads-db';
4
4
  export { RadsDb } from '_rads-db';
5
5
  import 'mssql';
@@ -21,7 +21,7 @@ declare function merge<T extends Record<string, any>>(target: T, source: any): T
21
21
 
22
22
  declare function diff(object: any, base: any, includeDenormFields?: boolean): any;
23
23
 
24
- declare function cleanUndefinedAndNull(obj: Record<string, any>, isChange?: boolean): void;
24
+ declare function cleanEntity(obj: Record<string, any>, isChange?: boolean): void;
25
25
 
26
26
  /**
27
27
  * Creates instance of rads db - object that provides access to all entities.
@@ -35,4 +35,4 @@ declare function createRadsDb<T extends keyof RadsDb>(dataSourceKey: T, args?: C
35
35
  */
36
36
  declare function createRadsDbClient<T extends keyof RadsDb>(dataSourceKey: T, args?: CreateRadsDbClientArgs): RadsDb[T];
37
37
 
38
- export { ComputedContext, ComputedDecoratorArgs, CreateRadsDbArgs, CreateRadsDbClientArgs, Driver, DriverConstructor, EntityDecoratorArgs, FieldDecoratorArgs, RadsRequestContext, Schema, UiDecoratorArgs, UiFieldDecoratorArgs, ValidateEntityDecoratorArgs, ValidateFieldDecoratorArgs, cleanUndefinedAndNull, computed, createRadsDb, createRadsDbClient, diff, entity, field, getDriverInstance, handlePrecomputed, keepHistory, merge, precomputed, ui, validate };
38
+ export { ComputedContext, ComputedDecoratorArgs, CreateRadsDbArgs, CreateRadsDbClientArgs, Driver, DriverConstructor, EntityDecoratorArgs, FieldDecoratorArgs, RadsRequestContext, Schema, UiDecoratorArgs, UiFieldDecoratorArgs, ValidateEntityDecoratorArgs, ValidateFieldDecoratorArgs, cleanEntity, computed, createRadsDb, createRadsDbClient, diff, entity, field, getDriverInstance, handlePrecomputed, keepHistory, merge, precomputed, ui, validate };
package/dist/index.mjs CHANGED
@@ -429,6 +429,9 @@ async function handlePrecomputed(context, docs, ctx) {
429
429
  const { precomputedFields, nestedTypeFields, fields } = schema[typeName];
430
430
  const computed = options.computed;
431
431
  for (const fieldName of precomputedFields || []) {
432
+ if (ctx.skipPrecomputed?.includes(fieldName)) {
433
+ continue;
434
+ }
432
435
  const typeComputed = computed[typeName];
433
436
  let handler = typeComputed?.[fieldName];
434
437
  if (!handler) {
@@ -571,12 +574,17 @@ async function handleEffectsAfterPut(context, docs, beforePutResults, ctx) {
571
574
  );
572
575
  }
573
576
 
574
- function cleanUndefinedAndNull(obj, isChange = false) {
577
+ function cleanEntity(obj, isChange = false) {
575
578
  for (const key in obj) {
576
579
  if (obj[key] == null && !isChange)
577
580
  delete obj[key];
581
+ if (key.endsWith("_replace")) {
582
+ obj[key.slice(0, -8)] = obj[key];
583
+ delete obj[key];
584
+ continue;
585
+ }
578
586
  if (_.isPlainObject(obj[key]))
579
- cleanUndefinedAndNull(obj[key], isChange || key === "change");
587
+ cleanEntity(obj[key], isChange || key === "change");
580
588
  }
581
589
  }
582
590
 
@@ -862,7 +870,7 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
862
870
  const oldDoc = oldDocsById[doc.id];
863
871
  doc = merge(oldDoc, doc);
864
872
  if (!options.keepNulls)
865
- cleanUndefinedAndNull(doc);
873
+ cleanEntity(doc);
866
874
  return { oldDoc, doc };
867
875
  });
868
876
  await handlePrecomputed(computedContext, docArgsToSave, ctx);
@@ -905,7 +913,7 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
905
913
  }
906
914
  }
907
915
  if (!options.keepNulls)
908
- cleanUndefinedAndNull(doc);
916
+ cleanEntity(doc);
909
917
  return { oldDoc, doc, events: [] };
910
918
  });
911
919
  if (entitySchema.decorators.precomputed?.preset === "eventSourcing") {
@@ -1035,10 +1043,11 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
1035
1043
  throw new Error("Id is required");
1036
1044
  ctx = { ...options.context, ...ctx };
1037
1045
  const oldDoc = await driverInstance.get({ where: { id: doc.id } }, ctx);
1046
+ console.log(_.cloneDeep(doc), oldDoc, merge(oldDoc || {}, doc));
1038
1047
  if (oldDoc)
1039
1048
  doc = merge(oldDoc, doc);
1040
1049
  if (!options.keepNulls)
1041
- cleanUndefinedAndNull(doc);
1050
+ cleanEntity(doc);
1042
1051
  const docArgsToSave = [{ doc, oldDoc }];
1043
1052
  await handlePrecomputed(computedContext, docArgsToSave, ctx);
1044
1053
  await beforePut(docArgsToSave, ctx, computedContext);
@@ -1408,4 +1417,4 @@ function createRadsDbClient(dataSourceKey, args) {
1408
1417
  return generateMethods(s, validators, radsDbArgs);
1409
1418
  }
1410
1419
 
1411
- export { cleanUndefinedAndNull, computed, createRadsDb, createRadsDbClient, diff, entity, field, getDriverInstance, handlePrecomputed, keepHistory, merge, precomputed, ui, validate };
1420
+ export { cleanEntity, computed, createRadsDb, createRadsDbClient, diff, entity, field, getDriverInstance, handlePrecomputed, keepHistory, merge, precomputed, ui, validate };
@@ -101,10 +101,12 @@ type Relation<T extends {
101
101
  * If you need more control, please, use separate request instead.
102
102
  */
103
103
  type InverseRelation<EN extends keyof EntityMeta> = EntityMeta[EN]['type'];
104
- type PutArgs<T> = {
104
+ type Put<EN extends keyof EntityMeta> = {
105
105
  id: string;
106
- } & DeepPartialWithNulls<T>;
107
- type Put<EntityName extends keyof EntityMeta> = PutArgs<EntityMeta[EntityName]['type']>;
106
+ } & JsonPutOperations<EN> & DeepPartialWithNulls<EntityMeta[EN]['type']>;
107
+ type JsonPutOperations<EN extends keyof EntityMeta> = {
108
+ [K in EntityMeta[EN]['jsonFields'] as `${K & string}_replace`]?: EntityMeta[EN]['type'][K] | string;
109
+ };
108
110
  type DeepKeys<T> = T extends object ? {
109
111
  [K in (string | number) & keyof T]: `${`.${K}` | (`${K}` extends `${number}` ? `[${K}]` : never)}${'' | DeepKeys<T[K]>}`;
110
112
  }[(string | number) & keyof T] : never;
@@ -118,8 +120,8 @@ interface EntityMethods<E, EN extends keyof EntityMeta> {
118
120
  getMany<A extends GetManyArgs<EN>>(args?: A, ctx?: RadsRequestContext): MaybePromise$1<GetManyResponse<EN, A>>;
119
121
  getAgg<A extends GetAggArgs<EN>>(args: A, ctx?: RadsRequestContext): MaybePromise$1<GetAggResponse<EN, A>>;
120
122
  getAll<A extends GetManyArgs<EN>>(args?: A, ctx?: RadsRequestContext): MaybePromise$1<GetManyResponse<EN, A>['nodes']>;
121
- put(data: PutArgs<E>, ctx?: RadsRequestContext): MaybePromise$1<GetResponseNoInclude<EN>>;
122
- putMany(data: PutArgs<E>[], ctx?: RadsRequestContext): MaybePromise$1<GetResponseNoInclude<EN>[]>;
123
+ put(data: Put<EN>, ctx?: RadsRequestContext): MaybePromise$1<GetResponseNoInclude<EN>>;
124
+ putMany(data: Put<EN>[], ctx?: RadsRequestContext): MaybePromise$1<GetResponseNoInclude<EN>[]>;
123
125
  verifyMany<A extends VerifyManyArgs<EN>>(args?: A, ctx?: RadsRequestContext): MaybePromise$1<VerifyManyResponse>;
124
126
  verifyAll<A extends VerifyManyArgs<EN>>(args?: A, ctx?: RadsRequestContext): MaybePromise$1<Pick<VerifyManyResponse, 'correctCount' | 'incorrectCount'>>;
125
127
  }
@@ -425,6 +427,8 @@ interface RadsRequestContext {
425
427
  silent?: boolean;
426
428
  /** Mostly for internal use. When entity name is specified, indicates that calling put* on this entity is allowed, even if it's marked as @precomputed or @readonly */
427
429
  skipPrecomputedCheckFor?: string;
430
+ /** Skip precomputed calculation for these fields and use provided values instead */
431
+ skipPrecomputed?: string[];
428
432
  /** Method that was called - get, getAll, getMany, getAgg, put, putMany, etc */
429
433
  method?: 'get' | 'getAll' | 'getMany' | 'getAgg' | 'put' | 'putMany' | 'deleteMany' | 'deleteAll';
430
434
  /** if true, all cache layers will be bypassed */
@@ -474,4 +478,4 @@ interface RadsFeature {
474
478
  afterUploadFile?: (result: FileUploadResult, args: FileUploadArgs) => MaybePromise<void>;
475
479
  }
476
480
 
477
- 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 };
481
+ 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, Put as ai, JsonPutOperations 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 };
@@ -81,7 +81,7 @@ function getEffectFor(entityName, aggregateRelationField, eventEntityName, schem
81
81
  continue;
82
82
  }
83
83
  aggDoc = newAggDoc;
84
- if (!context.options.keepNulls) (0, _radsDb.cleanUndefinedAndNull)(aggDoc);
84
+ if (!context.options.keepNulls) (0, _radsDb.cleanEntity)(aggDoc);
85
85
  }
86
86
  if (aggDoc) {
87
87
  result.push({
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash";
2
- import { cleanUndefinedAndNull, diff, handlePrecomputed, merge } from "rads-db";
2
+ import { cleanEntity, diff, handlePrecomputed, merge } from "rads-db";
3
3
  export default (options) => {
4
4
  return {
5
5
  name: "eventSourcing",
@@ -70,7 +70,7 @@ function getEffectFor(entityName, aggregateRelationField, eventEntityName, schem
70
70
  continue;
71
71
  }
72
72
  aggDoc = newAggDoc;
73
- if (!context.options.keepNulls) cleanUndefinedAndNull(aggDoc);
73
+ if (!context.options.keepNulls) cleanEntity(aggDoc);
74
74
  }
75
75
  if (aggDoc) {
76
76
  result.push({
@@ -115,7 +115,8 @@ function getIndexDtsInner(schema, rootTypeName, entitiesDir) {
115
115
  relationsStr: _lodash.default.keys(relations).map(k => `${k}: { entityName: '${relations[k].entity}', entity: ${relations[k].entity}, denormFields: ${relations[k].denormFields} }`),
116
116
  nestedObjectsStr: fieldsArray.filter(f => schema[f.type]?.fields && !f.isRelation && !f.isChange && !f.isInverseRelation).map(f => `${f.name}: { entityName: '${f.type}' }`),
117
117
  aggregates: fieldsArray.filter(f => f.type === "number" && !f.isArray).map(x => `'${x.name}'`).join(" | "),
118
- primitives: fieldsArray.filter(f => !schema[f.type]?.decorators?.entity).map(x => `'${x.name}'`).join(" | ")
118
+ primitives: fieldsArray.filter(f => !schema[f.type]?.decorators?.entity).map(x => `'${x.name}'`).join(" | "),
119
+ jsonFields: fieldsArray.filter(f => !f.isArray && (f.type === "Record<string, any>" || f.isChange)).map(x => `'${x.name}'`).join(" | ")
119
120
  });
120
121
  }
121
122
  for (const key in schema) {
@@ -135,6 +136,7 @@ ${whereFields.join("\n")}
135
136
  aggregates: ${x.aggregates || "never"}
136
137
  nestedObjects: {${x.nestedObjectsStr}}
137
138
  relations: {${x.relationsStr}}
139
+ jsonFields: ${x.jsonFields || "never"}
138
140
  }
139
141
  `.trim()).join("\n");
140
142
  return `
@@ -120,7 +120,8 @@ export function getIndexDtsInner(schema, rootTypeName, entitiesDir) {
120
120
  ),
121
121
  nestedObjectsStr: fieldsArray.filter((f) => schema[f.type]?.fields && !f.isRelation && !f.isChange && !f.isInverseRelation).map((f) => `${f.name}: { entityName: '${f.type}' }`),
122
122
  aggregates: fieldsArray.filter((f) => f.type === "number" && !f.isArray).map((x) => `'${x.name}'`).join(" | "),
123
- primitives: fieldsArray.filter((f) => !schema[f.type]?.decorators?.entity).map((x) => `'${x.name}'`).join(" | ")
123
+ primitives: fieldsArray.filter((f) => !schema[f.type]?.decorators?.entity).map((x) => `'${x.name}'`).join(" | "),
124
+ jsonFields: fieldsArray.filter((f) => !f.isArray && (f.type === "Record<string, any>" || f.isChange)).map((x) => `'${x.name}'`).join(" | ")
124
125
  });
125
126
  }
126
127
  for (const key in schema) {
@@ -143,6 +144,7 @@ ${whereFields.join("\n")}
143
144
  aggregates: ${x.aggregates || "never"}
144
145
  nestedObjects: {${x.nestedObjectsStr}}
145
146
  relations: {${x.relationsStr}}
147
+ jsonFields: ${x.jsonFields || "never"}
146
148
  }
147
149
  `.trim()
148
150
  ).join("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rads-db",
3
- "version": "3.2.7",
3
+ "version": "3.2.9",
4
4
  "description": "Say goodbye to boilerplate code and hello to efficient and elegant syntax.",
5
5
  "author": "",
6
6
  "license": "ISC",