remult 3.3.3 → 3.3.4-next.0
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.
|
@@ -175,6 +175,8 @@ export class Filter {
|
|
|
175
175
|
}
|
|
176
176
|
else {
|
|
177
177
|
const field = entity.fields[key];
|
|
178
|
+
if (!field)
|
|
179
|
+
throw new Error(`Field ${key} not found in entity ${entity.key}`);
|
|
178
180
|
const rel = getRelationFieldInfo(field);
|
|
179
181
|
const op = field.options;
|
|
180
182
|
let fh = rel?.type === 'toOne'
|
|
@@ -698,10 +698,12 @@ export class RepositoryImplementation {
|
|
|
698
698
|
if (incl) {
|
|
699
699
|
const otherRepo = rel.toRepo;
|
|
700
700
|
for (const row of result) {
|
|
701
|
-
let { findOptions, returnNull } = this._findOptionsBasedOnRelation(rel, col, incl, row, otherRepo);
|
|
701
|
+
let { findOptions, returnNull, returnUndefined } = this._findOptionsBasedOnRelation(rel, col, incl, row, otherRepo);
|
|
702
702
|
const colKey = col.key;
|
|
703
703
|
if (returnNull)
|
|
704
704
|
row[colKey] = null;
|
|
705
|
+
else if (returnUndefined)
|
|
706
|
+
row[colKey] = undefined;
|
|
705
707
|
else {
|
|
706
708
|
const entityType = rel.toEntity;
|
|
707
709
|
const toRepo = otherRepo;
|
|
@@ -797,7 +799,13 @@ export class RepositoryImplementation {
|
|
|
797
799
|
}
|
|
798
800
|
for (const key in relFields.fields) {
|
|
799
801
|
if (Object.prototype.hasOwnProperty.call(relFields.fields, key)) {
|
|
800
|
-
|
|
802
|
+
const val = getFieldValue(relFields.fields[key]);
|
|
803
|
+
if (val === null)
|
|
804
|
+
returnNull = true;
|
|
805
|
+
else if (val === undefined)
|
|
806
|
+
returnUndefined = true;
|
|
807
|
+
else
|
|
808
|
+
where.push({ [key]: val });
|
|
801
809
|
}
|
|
802
810
|
}
|
|
803
811
|
findOptions.where = { $and: where };
|
|
@@ -2076,7 +2084,7 @@ export class columnDefsImpl {
|
|
|
2076
2084
|
displayValue(item) {
|
|
2077
2085
|
return this.entityDefs
|
|
2078
2086
|
.getEntityMetadataWithoutBreakingTheEntity(item)
|
|
2079
|
-
.fields.find(this.key)
|
|
2087
|
+
.fields.find(this.key)?.displayValue;
|
|
2080
2088
|
}
|
|
2081
2089
|
includedInApi(item) {
|
|
2082
2090
|
if (this.options.includeInApi === undefined)
|
package/package.json
CHANGED
|
@@ -231,6 +231,8 @@ var Filter = /** @class */ (function () {
|
|
|
231
231
|
}
|
|
232
232
|
else {
|
|
233
233
|
var field = entity.fields[key];
|
|
234
|
+
if (!field)
|
|
235
|
+
throw new Error("Field ".concat(key, " not found in entity ").concat(entity.key));
|
|
234
236
|
var rel = (0, relationInfoMember_js_1.getRelationFieldInfo)(field);
|
|
235
237
|
var op = field.options;
|
|
236
238
|
var fh = (rel === null || rel === void 0 ? void 0 : rel.type) === 'toOne'
|
|
@@ -1183,10 +1183,12 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
1183
1183
|
if (incl) {
|
|
1184
1184
|
var otherRepo = rel.toRepo;
|
|
1185
1185
|
var _loop_2 = function (row) {
|
|
1186
|
-
var _e = this_1._findOptionsBasedOnRelation(rel, col, incl, row, otherRepo), findOptions = _e.findOptions, returnNull = _e.returnNull;
|
|
1186
|
+
var _e = this_1._findOptionsBasedOnRelation(rel, col, incl, row, otherRepo), findOptions = _e.findOptions, returnNull = _e.returnNull, returnUndefined = _e.returnUndefined;
|
|
1187
1187
|
var colKey = col.key;
|
|
1188
1188
|
if (returnNull)
|
|
1189
1189
|
row[colKey] = null;
|
|
1190
|
+
else if (returnUndefined)
|
|
1191
|
+
row[colKey] = undefined;
|
|
1190
1192
|
else {
|
|
1191
1193
|
var entityType = rel.toEntity;
|
|
1192
1194
|
var toRepo_1 = otherRepo;
|
|
@@ -1345,7 +1347,13 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
1345
1347
|
}
|
|
1346
1348
|
for (var key in relFields.fields) {
|
|
1347
1349
|
if (Object.prototype.hasOwnProperty.call(relFields.fields, key)) {
|
|
1348
|
-
|
|
1350
|
+
var val = getFieldValue(relFields.fields[key]);
|
|
1351
|
+
if (val === null)
|
|
1352
|
+
returnNull = true;
|
|
1353
|
+
else if (val === undefined)
|
|
1354
|
+
returnUndefined = true;
|
|
1355
|
+
else
|
|
1356
|
+
where.push((_d = {}, _d[key] = val, _d));
|
|
1349
1357
|
}
|
|
1350
1358
|
}
|
|
1351
1359
|
findOptions.where = { $and: where };
|
|
@@ -3497,9 +3505,10 @@ var columnDefsImpl = /** @class */ (function () {
|
|
|
3497
3505
|
return this.remult.isAllowedForInstance(item, this.options.allowApiUpdate);
|
|
3498
3506
|
};
|
|
3499
3507
|
columnDefsImpl.prototype.displayValue = function (item) {
|
|
3500
|
-
|
|
3508
|
+
var _a;
|
|
3509
|
+
return (_a = this.entityDefs
|
|
3501
3510
|
.getEntityMetadataWithoutBreakingTheEntity(item)
|
|
3502
|
-
.fields.find(this.key).displayValue;
|
|
3511
|
+
.fields.find(this.key)) === null || _a === void 0 ? void 0 : _a.displayValue;
|
|
3503
3512
|
};
|
|
3504
3513
|
columnDefsImpl.prototype.includedInApi = function (item) {
|
|
3505
3514
|
if (this.options.includeInApi === undefined)
|