blixify-server 0.2.24 → 0.3.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.
|
@@ -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,mBA0DD;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"}
|
|
@@ -1093,12 +1093,13 @@ class MongoWrapper {
|
|
|
1093
1093
|
pipeline.forEach((link) => {
|
|
1094
1094
|
const { condition, referenceSpaceLabel, spaceReferenceId, spaceReferenceAs, sort: referenceSort, } = link;
|
|
1095
1095
|
if (spaceReferenceId) {
|
|
1096
|
+
const defaultReferenceAs = spaceReferenceAs || "linkedData";
|
|
1096
1097
|
const lookupStage = {
|
|
1097
1098
|
$lookup: {
|
|
1098
1099
|
from: spaceReferenceId,
|
|
1099
1100
|
let: {},
|
|
1100
1101
|
pipeline: [],
|
|
1101
|
-
as:
|
|
1102
|
+
as: defaultReferenceAs,
|
|
1102
1103
|
},
|
|
1103
1104
|
};
|
|
1104
1105
|
if (condition && condition.length > 0) {
|
|
@@ -1158,20 +1159,20 @@ class MongoWrapper {
|
|
|
1158
1159
|
if (referenceSort && referenceSort.sortId) {
|
|
1159
1160
|
pipelineList.push({
|
|
1160
1161
|
$sort: {
|
|
1161
|
-
[`${
|
|
1162
|
+
[`${defaultReferenceAs}.${referenceSort.sortId}`]: referenceSort.type === "asc" ? 1 : -1,
|
|
1162
1163
|
},
|
|
1163
1164
|
});
|
|
1164
1165
|
}
|
|
1165
1166
|
pipelineList.push({
|
|
1166
1167
|
$unwind: {
|
|
1167
|
-
path: `$${
|
|
1168
|
+
path: `$${defaultReferenceAs}`,
|
|
1168
1169
|
preserveNullAndEmptyArrays: true,
|
|
1169
1170
|
},
|
|
1170
1171
|
});
|
|
1171
1172
|
if (referenceSpaceLabel && referenceSpaceLabel.length > 0) {
|
|
1172
1173
|
const addFieldsStage = { $addFields: {} };
|
|
1173
1174
|
referenceSpaceLabel.forEach((field) => {
|
|
1174
|
-
addFieldsStage.$addFields[field] = `$${
|
|
1175
|
+
addFieldsStage.$addFields[`${defaultReferenceAs}_${field}`] = `$${defaultReferenceAs}.${field}`;
|
|
1175
1176
|
});
|
|
1176
1177
|
pipelineList.push(addFieldsStage);
|
|
1177
1178
|
}
|
|
@@ -1182,7 +1183,9 @@ class MongoWrapper {
|
|
|
1182
1183
|
},
|
|
1183
1184
|
};
|
|
1184
1185
|
referenceSpaceLabel === null || referenceSpaceLabel === void 0 ? void 0 : referenceSpaceLabel.forEach((field) => {
|
|
1185
|
-
groupStage.$group[
|
|
1186
|
+
groupStage.$group[`${defaultReferenceAs}_${field}`] = {
|
|
1187
|
+
$push: `$${defaultReferenceAs}_${field}`,
|
|
1188
|
+
};
|
|
1186
1189
|
});
|
|
1187
1190
|
pipelineList.push(groupStage);
|
|
1188
1191
|
// Merge back and remove 'originalData' and 'spaceReferenceAs'
|