blixify-server 0.2.24 → 0.3.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongoWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/mongoWrapper.ts"],"names":[],"mappings":"AASA,OAAO,cAAc,MAAM,yBAAyB,CAAC;AAGrD,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"mongoWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/mongoWrapper.ts"],"names":[],"mappings":"AASA,OAAO,cAAc,MAAM,yBAAyB,CAAC;AAGrD,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;AAiJD;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,EAAE,GAAG,CAAM;IAClB,UAAU,SAAM;IAChB,MAAM,UAAS;IACf,MAAM,EAAE,cAAc,CAQpB;IACF,GAAG,EAAE,UAAU,CAAC;IAChB,OAAO,SAAM;IACb,KAAK,SAAM;IACX,WAAW,EAAE,GAAG,CAAC;IACjB,aAAa,EAAE,MAAM,EAAE,CAAM;IAC7B,KAAK,EAAE,GAAG,CAAC;IAEX,YAAY,QAAS,GAAG,aAEtB;gBAGA,OAAO,EAAE,GAAG,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,OAAO,EACrD,GAAG,EAAE,UAAU,EACf,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,EACzC,aAAa,CAAC,EAAE,MAAM,EAAE,EACxB,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,IAAI;IAgB3D,UAAU,SAAU,GAAG,SAIrB;IAEF,aAAa,YACF,GAAG,QACN,QAAQ,GAAG,QAAQ,GAAG,QAAQ,OAC/B,GAAG,UACA;QACN,GAAG,CAAC,EAAE,GAAG,CAAC;QACV,GAAG,CAAC,EAAE,GAAG,CAAC;KACX,mBA4DD;IAEF,eAAe,QACR,GAAG,OACH,GAAG,yBACc,GAAG,EAAE,KAAK,QAAQ,GAAG,CAAC;;mBAyE5C;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAkDtC;IAEF,OAAO,QAAe,GAAG,OAAO,GAAG;;mBAuCjC;IAEF,eAAe,QACR,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAgKtC;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAqGtC;IAEF,eAAe,QACR,GAAG,OACH,GAAG,yBACc,GAAG,EAAE,KAAK,QAAQ,GAAG,CAAC;;mBA0I5C;IAEF,UAAU,QACH,GAAG,OACH,GAAG,qBACU,GAAG,KAAK,QAAQ,GAAG,CAAC;;mBAwCtC;IAEF,mBAAmB,CAAC,GAAG,EAAE,GAAG;IA8N5B,QAAQ,QAAe,GAAG,OAAO,GAAG;;;;;mBAgQlC;IAEF,IAAI,YAgFF;CACH"}
|
|
@@ -218,6 +218,8 @@ class MongoWrapper {
|
|
|
218
218
|
if (eachKey !== "_id" && !eachKey.startsWith("base"))
|
|
219
219
|
changeValueList.push(eachChangeValue);
|
|
220
220
|
});
|
|
221
|
+
if (type === "update" && changeValueList.length === 0)
|
|
222
|
+
return;
|
|
221
223
|
const logItem = {
|
|
222
224
|
_id: (0, uuid_1.v4)(),
|
|
223
225
|
type,
|
|
@@ -1093,12 +1095,13 @@ class MongoWrapper {
|
|
|
1093
1095
|
pipeline.forEach((link) => {
|
|
1094
1096
|
const { condition, referenceSpaceLabel, spaceReferenceId, spaceReferenceAs, sort: referenceSort, } = link;
|
|
1095
1097
|
if (spaceReferenceId) {
|
|
1098
|
+
const defaultReferenceAs = spaceReferenceAs || "linkedData";
|
|
1096
1099
|
const lookupStage = {
|
|
1097
1100
|
$lookup: {
|
|
1098
1101
|
from: spaceReferenceId,
|
|
1099
1102
|
let: {},
|
|
1100
1103
|
pipeline: [],
|
|
1101
|
-
as:
|
|
1104
|
+
as: defaultReferenceAs,
|
|
1102
1105
|
},
|
|
1103
1106
|
};
|
|
1104
1107
|
if (condition && condition.length > 0) {
|
|
@@ -1158,20 +1161,20 @@ class MongoWrapper {
|
|
|
1158
1161
|
if (referenceSort && referenceSort.sortId) {
|
|
1159
1162
|
pipelineList.push({
|
|
1160
1163
|
$sort: {
|
|
1161
|
-
[`${
|
|
1164
|
+
[`${defaultReferenceAs}.${referenceSort.sortId}`]: referenceSort.type === "asc" ? 1 : -1,
|
|
1162
1165
|
},
|
|
1163
1166
|
});
|
|
1164
1167
|
}
|
|
1165
1168
|
pipelineList.push({
|
|
1166
1169
|
$unwind: {
|
|
1167
|
-
path: `$${
|
|
1170
|
+
path: `$${defaultReferenceAs}`,
|
|
1168
1171
|
preserveNullAndEmptyArrays: true,
|
|
1169
1172
|
},
|
|
1170
1173
|
});
|
|
1171
1174
|
if (referenceSpaceLabel && referenceSpaceLabel.length > 0) {
|
|
1172
1175
|
const addFieldsStage = { $addFields: {} };
|
|
1173
1176
|
referenceSpaceLabel.forEach((field) => {
|
|
1174
|
-
addFieldsStage.$addFields[field] = `$${
|
|
1177
|
+
addFieldsStage.$addFields[`${defaultReferenceAs}_${field}`] = `$${defaultReferenceAs}.${field}`;
|
|
1175
1178
|
});
|
|
1176
1179
|
pipelineList.push(addFieldsStage);
|
|
1177
1180
|
}
|
|
@@ -1182,7 +1185,9 @@ class MongoWrapper {
|
|
|
1182
1185
|
},
|
|
1183
1186
|
};
|
|
1184
1187
|
referenceSpaceLabel === null || referenceSpaceLabel === void 0 ? void 0 : referenceSpaceLabel.forEach((field) => {
|
|
1185
|
-
groupStage.$group[
|
|
1188
|
+
groupStage.$group[`${defaultReferenceAs}_${field}`] = {
|
|
1189
|
+
$push: `$${defaultReferenceAs}_${field}`,
|
|
1190
|
+
};
|
|
1186
1191
|
});
|
|
1187
1192
|
pipelineList.push(groupStage);
|
|
1188
1193
|
// Merge back and remove 'originalData' and 'spaceReferenceAs'
|