c2-mongoose 2.1.463 → 2.1.465
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.
|
@@ -84,6 +84,16 @@ var BuildConditionFlowItem = /** @class */ (function () {
|
|
|
84
84
|
key = key.replace("IsEmpty", "");
|
|
85
85
|
condition[key] = value ? { $size: 0 } : { $not: { $size: 0 } };
|
|
86
86
|
}
|
|
87
|
+
else if (key.endsWith("NotIn")) {
|
|
88
|
+
key = key.replace("NotIn", "");
|
|
89
|
+
var valuesArr = value === null || value === void 0 ? void 0 : value.trim().split(',').map(function (v) { return v.trim(); });
|
|
90
|
+
condition[key] = { $nin: valuesArr };
|
|
91
|
+
}
|
|
92
|
+
else if (key.endsWith("In")) {
|
|
93
|
+
key = key.replace("In", "");
|
|
94
|
+
var valuesArr = value === null || value === void 0 ? void 0 : value.trim().split(',').map(function (v) { return v.trim(); });
|
|
95
|
+
condition[key] = { $in: valuesArr };
|
|
96
|
+
}
|
|
87
97
|
else {
|
|
88
98
|
if (((_c = (_b = model === null || model === void 0 ? void 0 : model.schema) === null || _b === void 0 ? void 0 : _b.paths[key]) === null || _c === void 0 ? void 0 : _c.instance) === 'Array') {
|
|
89
99
|
if (!Array.isArray(value)) {
|
|
@@ -25,8 +25,8 @@ var PopulateV3FlowItem = /** @class */ (function () {
|
|
|
25
25
|
var populateClauses = [];
|
|
26
26
|
populatesFields === null || populatesFields === void 0 ? void 0 : populatesFields.forEach(function (populateField) {
|
|
27
27
|
var _a, _b;
|
|
28
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
29
|
-
var
|
|
28
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
29
|
+
var _o = populateField.split('.'), first = _o[0], rest = _o.slice(1);
|
|
30
30
|
var fieldDefinition = GetFieldDefinitionFlowItem_1.default.execute(modelRoot, first);
|
|
31
31
|
if (!fieldDefinition)
|
|
32
32
|
return;
|
|
@@ -82,13 +82,13 @@ var PopulateV3FlowItem = /** @class */ (function () {
|
|
|
82
82
|
break;
|
|
83
83
|
}
|
|
84
84
|
fieldDefinition = refModel.schema.path(nextField);
|
|
85
|
-
if (!fieldDefinition ||
|
|
85
|
+
if (!((_h = fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.options) === null || _h === void 0 ? void 0 : _h.ref) && !((_k = (_j = fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.options) === null || _j === void 0 ? void 0 : _j.type[0]) === null || _k === void 0 ? void 0 : _k.ref)) {
|
|
86
86
|
throw new Error("[1]No reference found for populate field: ".concat(populateField));
|
|
87
87
|
}
|
|
88
88
|
if (!fieldDefinition)
|
|
89
89
|
return;
|
|
90
90
|
typeFirst = fieldDefinition.instance;
|
|
91
|
-
modelName = (
|
|
91
|
+
modelName = (_l = fieldDefinition.options.ref) !== null && _l !== void 0 ? _l : (_m = fieldDefinition.options.type[0]) === null || _m === void 0 ? void 0 : _m.ref;
|
|
92
92
|
refModel = global.connectionMongoose.model(modelName);
|
|
93
93
|
collectionName = refModel.collection.name;
|
|
94
94
|
var populateClauseLookup = [
|
package/package.json
CHANGED
|
@@ -80,6 +80,14 @@ class BuildConditionFlowItem {
|
|
|
80
80
|
} else if (key.endsWith("IsEmpty")) {
|
|
81
81
|
key = key.replace("IsEmpty", "");
|
|
82
82
|
condition[key] = value ? { $size: 0 } : { $not: { $size: 0 } };
|
|
83
|
+
} else if (key.endsWith("NotIn")) {
|
|
84
|
+
key = key.replace("NotIn", "");
|
|
85
|
+
var valuesArr = value?.trim().split(',').map((v: string) => v.trim());
|
|
86
|
+
condition[key] = { $nin: valuesArr };
|
|
87
|
+
} else if (key.endsWith("In")) {
|
|
88
|
+
key = key.replace("In", "");
|
|
89
|
+
var valuesArr = value?.trim().split(',').map((v: string) => v.trim());
|
|
90
|
+
condition[key] = { $in: valuesArr };
|
|
83
91
|
} else {
|
|
84
92
|
if (model?.schema?.paths[key]?.instance === 'Array') {
|
|
85
93
|
if (!Array.isArray(value)) {
|
|
@@ -81,13 +81,13 @@ class PopulateV3FlowItem {
|
|
|
81
81
|
}
|
|
82
82
|
fieldDefinition = refModel.schema.path(nextField);
|
|
83
83
|
|
|
84
|
-
if (!fieldDefinition
|
|
84
|
+
if (!fieldDefinition?.options?.ref && !fieldDefinition?.options?.type[0]?.ref) {
|
|
85
85
|
throw new Error(`[1]No reference found for populate field: ${populateField}`);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
if (!fieldDefinition) return;
|
|
89
89
|
typeFirst = fieldDefinition.instance
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
modelName = fieldDefinition.options.ref ?? fieldDefinition.options.type[0]?.ref;
|
|
92
92
|
refModel = (global as any).connectionMongoose.model(modelName);
|
|
93
93
|
collectionName = refModel.collection.name;
|