rads-db 3.2.8 → 3.2.10
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 +15 -6
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +15 -6
- package/dist/{types-efed26f9.d.ts → types-98e90d7b.d.ts} +8 -6
- package/features/eventSourcing.cjs +1 -1
- package/features/eventSourcing.mjs +2 -2
- package/integrations/node.cjs +3 -1
- package/integrations/node.mjs +3 -1
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -60,6 +60,9 @@ function getZodSchema(zodSchemas, schema, key) {
|
|
|
60
60
|
continue;
|
|
61
61
|
}
|
|
62
62
|
objectSchema[fieldName] = getFieldZodSchema(zodSchemas, schema, f);
|
|
63
|
+
if (f.isChange) {
|
|
64
|
+
objectSchema[`${fieldName}_replace`] = getFieldZodSchema(zodSchemas, schema, f);
|
|
65
|
+
}
|
|
63
66
|
}
|
|
64
67
|
return zod.z.object(objectSchema);
|
|
65
68
|
}
|
|
@@ -581,12 +584,17 @@ async function handleEffectsAfterPut(context, docs, beforePutResults, ctx) {
|
|
|
581
584
|
);
|
|
582
585
|
}
|
|
583
586
|
|
|
584
|
-
function
|
|
587
|
+
function cleanEntity(obj, isChange = false) {
|
|
585
588
|
for (const key in obj) {
|
|
586
589
|
if (obj[key] == null && !isChange)
|
|
587
590
|
delete obj[key];
|
|
591
|
+
if (key.endsWith("_replace")) {
|
|
592
|
+
obj[key.slice(0, -8)] = obj[key];
|
|
593
|
+
delete obj[key];
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
588
596
|
if (___default.isPlainObject(obj[key]))
|
|
589
|
-
|
|
597
|
+
cleanEntity(obj[key], isChange || key === "change");
|
|
590
598
|
}
|
|
591
599
|
}
|
|
592
600
|
|
|
@@ -872,7 +880,7 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
|
|
|
872
880
|
const oldDoc = oldDocsById[doc.id];
|
|
873
881
|
doc = merge(oldDoc, doc);
|
|
874
882
|
if (!options.keepNulls)
|
|
875
|
-
|
|
883
|
+
cleanEntity(doc);
|
|
876
884
|
return { oldDoc, doc };
|
|
877
885
|
});
|
|
878
886
|
await handlePrecomputed(computedContext, docArgsToSave, ctx);
|
|
@@ -915,7 +923,7 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
|
|
|
915
923
|
}
|
|
916
924
|
}
|
|
917
925
|
if (!options.keepNulls)
|
|
918
|
-
|
|
926
|
+
cleanEntity(doc);
|
|
919
927
|
return { oldDoc, doc, events: [] };
|
|
920
928
|
});
|
|
921
929
|
if (entitySchema.decorators.precomputed?.preset === "eventSourcing") {
|
|
@@ -1045,10 +1053,11 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
|
|
|
1045
1053
|
throw new Error("Id is required");
|
|
1046
1054
|
ctx = { ...options.context, ...ctx };
|
|
1047
1055
|
const oldDoc = await driverInstance.get({ where: { id: doc.id } }, ctx);
|
|
1056
|
+
console.log(___default.cloneDeep(doc), oldDoc, merge(oldDoc || {}, doc));
|
|
1048
1057
|
if (oldDoc)
|
|
1049
1058
|
doc = merge(oldDoc, doc);
|
|
1050
1059
|
if (!options.keepNulls)
|
|
1051
|
-
|
|
1060
|
+
cleanEntity(doc);
|
|
1052
1061
|
const docArgsToSave = [{ doc, oldDoc }];
|
|
1053
1062
|
await handlePrecomputed(computedContext, docArgsToSave, ctx);
|
|
1054
1063
|
await beforePut(docArgsToSave, ctx, computedContext);
|
|
@@ -1418,7 +1427,7 @@ function createRadsDbClient(dataSourceKey, args) {
|
|
|
1418
1427
|
return generateMethods(s, validators, radsDbArgs);
|
|
1419
1428
|
}
|
|
1420
1429
|
|
|
1421
|
-
exports.
|
|
1430
|
+
exports.cleanEntity = cleanEntity;
|
|
1422
1431
|
exports.computed = computed;
|
|
1423
1432
|
exports.createRadsDb = createRadsDb;
|
|
1424
1433
|
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-
|
|
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,
|
|
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
|
|
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,
|
|
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
|
@@ -53,6 +53,9 @@ function getZodSchema(zodSchemas, schema, key) {
|
|
|
53
53
|
continue;
|
|
54
54
|
}
|
|
55
55
|
objectSchema[fieldName] = getFieldZodSchema(zodSchemas, schema, f);
|
|
56
|
+
if (f.isChange) {
|
|
57
|
+
objectSchema[`${fieldName}_replace`] = getFieldZodSchema(zodSchemas, schema, f);
|
|
58
|
+
}
|
|
56
59
|
}
|
|
57
60
|
return z.object(objectSchema);
|
|
58
61
|
}
|
|
@@ -574,12 +577,17 @@ async function handleEffectsAfterPut(context, docs, beforePutResults, ctx) {
|
|
|
574
577
|
);
|
|
575
578
|
}
|
|
576
579
|
|
|
577
|
-
function
|
|
580
|
+
function cleanEntity(obj, isChange = false) {
|
|
578
581
|
for (const key in obj) {
|
|
579
582
|
if (obj[key] == null && !isChange)
|
|
580
583
|
delete obj[key];
|
|
584
|
+
if (key.endsWith("_replace")) {
|
|
585
|
+
obj[key.slice(0, -8)] = obj[key];
|
|
586
|
+
delete obj[key];
|
|
587
|
+
continue;
|
|
588
|
+
}
|
|
581
589
|
if (_.isPlainObject(obj[key]))
|
|
582
|
-
|
|
590
|
+
cleanEntity(obj[key], isChange || key === "change");
|
|
583
591
|
}
|
|
584
592
|
}
|
|
585
593
|
|
|
@@ -865,7 +873,7 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
|
|
|
865
873
|
const oldDoc = oldDocsById[doc.id];
|
|
866
874
|
doc = merge(oldDoc, doc);
|
|
867
875
|
if (!options.keepNulls)
|
|
868
|
-
|
|
876
|
+
cleanEntity(doc);
|
|
869
877
|
return { oldDoc, doc };
|
|
870
878
|
});
|
|
871
879
|
await handlePrecomputed(computedContext, docArgsToSave, ctx);
|
|
@@ -908,7 +916,7 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
|
|
|
908
916
|
}
|
|
909
917
|
}
|
|
910
918
|
if (!options.keepNulls)
|
|
911
|
-
|
|
919
|
+
cleanEntity(doc);
|
|
912
920
|
return { oldDoc, doc, events: [] };
|
|
913
921
|
});
|
|
914
922
|
if (entitySchema.decorators.precomputed?.preset === "eventSourcing") {
|
|
@@ -1038,10 +1046,11 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
|
|
|
1038
1046
|
throw new Error("Id is required");
|
|
1039
1047
|
ctx = { ...options.context, ...ctx };
|
|
1040
1048
|
const oldDoc = await driverInstance.get({ where: { id: doc.id } }, ctx);
|
|
1049
|
+
console.log(_.cloneDeep(doc), oldDoc, merge(oldDoc || {}, doc));
|
|
1041
1050
|
if (oldDoc)
|
|
1042
1051
|
doc = merge(oldDoc, doc);
|
|
1043
1052
|
if (!options.keepNulls)
|
|
1044
|
-
|
|
1053
|
+
cleanEntity(doc);
|
|
1045
1054
|
const docArgsToSave = [{ doc, oldDoc }];
|
|
1046
1055
|
await handlePrecomputed(computedContext, docArgsToSave, ctx);
|
|
1047
1056
|
await beforePut(docArgsToSave, ctx, computedContext);
|
|
@@ -1411,4 +1420,4 @@ function createRadsDbClient(dataSourceKey, args) {
|
|
|
1411
1420
|
return generateMethods(s, validators, radsDbArgs);
|
|
1412
1421
|
}
|
|
1413
1422
|
|
|
1414
|
-
export {
|
|
1423
|
+
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
|
|
104
|
+
type Put<EN extends keyof EntityMeta> = {
|
|
105
105
|
id: string;
|
|
106
|
-
} & DeepPartialWithNulls<
|
|
107
|
-
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:
|
|
122
|
-
putMany(data:
|
|
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
|
}
|
|
@@ -476,4 +478,4 @@ interface RadsFeature {
|
|
|
476
478
|
afterUploadFile?: (result: FileUploadResult, args: FileUploadArgs) => MaybePromise<void>;
|
|
477
479
|
}
|
|
478
480
|
|
|
479
|
-
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,
|
|
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.
|
|
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 {
|
|
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)
|
|
73
|
+
if (!context.options.keepNulls) cleanEntity(aggDoc);
|
|
74
74
|
}
|
|
75
75
|
if (aggDoc) {
|
|
76
76
|
result.push({
|
package/integrations/node.cjs
CHANGED
|
@@ -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 `
|
package/integrations/node.mjs
CHANGED
|
@@ -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");
|