@stemy/backend 3.1.7 → 3.2.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.
- package/bundles/stemy-backend.umd.js +32 -6
- package/bundles/stemy-backend.umd.js.map +1 -1
- package/bundles/stemy-backend.umd.min.js +1 -1
- package/bundles/stemy-backend.umd.min.js.map +1 -1
- package/common-types.d.ts +2 -1
- package/esm2015/common-types.js +1 -1
- package/esm2015/public_api.js +2 -2
- package/esm2015/utils.js +26 -6
- package/fesm2015/stemy-backend.js +26 -6
- package/fesm2015/stemy-backend.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +2 -2
- package/stemy-backend.metadata.json +1 -1
- package/utils.d.ts +11 -1
|
@@ -480,6 +480,9 @@
|
|
|
480
480
|
});
|
|
481
481
|
return result;
|
|
482
482
|
}
|
|
483
|
+
function uniqueItems(value) {
|
|
484
|
+
return value.filter(function (v, ix) { return value.indexOf(v) === ix; });
|
|
485
|
+
}
|
|
483
486
|
function getValue(obj, key, defaultValue, treeFallback) {
|
|
484
487
|
if (treeFallback === void 0) { treeFallback = false; }
|
|
485
488
|
key = key || "";
|
|
@@ -556,7 +559,7 @@
|
|
|
556
559
|
});
|
|
557
560
|
});
|
|
558
561
|
}
|
|
559
|
-
function
|
|
562
|
+
function lookupStages(from, localField, as, foreignField, shouldUnwind) {
|
|
560
563
|
if (as === void 0) { as = null; }
|
|
561
564
|
if (foreignField === void 0) { foreignField = "_id"; }
|
|
562
565
|
if (shouldUnwind === void 0) { shouldUnwind = true; }
|
|
@@ -569,15 +572,31 @@
|
|
|
569
572
|
foreignField: foreignField,
|
|
570
573
|
as: as
|
|
571
574
|
}
|
|
572
|
-
}
|
|
573
|
-
|
|
575
|
+
}
|
|
576
|
+
];
|
|
577
|
+
if (shouldUnwind) {
|
|
578
|
+
pipelines.push({
|
|
574
579
|
$unwind: {
|
|
575
580
|
path: "$" + as,
|
|
576
581
|
preserveNullAndEmptyArrays: true
|
|
577
582
|
}
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
return pipelines;
|
|
586
|
+
}
|
|
587
|
+
function letsLookupStage(from, pipeline, as, letFields) {
|
|
588
|
+
if (as === void 0) { as = null; }
|
|
589
|
+
if (letFields === void 0) { letFields = null; }
|
|
590
|
+
as = as || from;
|
|
591
|
+
letFields = letFields || { id: "$_id" };
|
|
592
|
+
return {
|
|
593
|
+
$lookup: {
|
|
594
|
+
from: from,
|
|
595
|
+
let: letFields,
|
|
596
|
+
pipeline: pipeline,
|
|
597
|
+
as: as
|
|
578
598
|
}
|
|
579
|
-
|
|
580
|
-
return shouldUnwind ? pipelines : pipelines.slice(0, 0);
|
|
599
|
+
};
|
|
581
600
|
}
|
|
582
601
|
function hydratePopulated(modelType, json) {
|
|
583
602
|
var e_2, _a;
|
|
@@ -1152,6 +1171,10 @@
|
|
|
1152
1171
|
}
|
|
1153
1172
|
return "" + color + match + exports.ConsoleColor.Reset;
|
|
1154
1173
|
});
|
|
1174
|
+
}
|
|
1175
|
+
function replaceSpecialChars(str, to) {
|
|
1176
|
+
if (to === void 0) { to = "-"; }
|
|
1177
|
+
return ("" + str).replace(/[&\/\\#, +()$~%.@'":*?<>{}]/g, to);
|
|
1155
1178
|
}
|
|
1156
1179
|
|
|
1157
1180
|
var __decorate$x = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -6247,7 +6270,8 @@
|
|
|
6247
6270
|
exports.jsonHighlight = jsonHighlight;
|
|
6248
6271
|
exports.lastItem = lastItem;
|
|
6249
6272
|
exports.lcFirst = lcFirst;
|
|
6250
|
-
exports.
|
|
6273
|
+
exports.letsLookupStage = letsLookupStage;
|
|
6274
|
+
exports.lookupStages = lookupStages;
|
|
6251
6275
|
exports.md5 = md5;
|
|
6252
6276
|
exports.mkdirRecursive = mkdirRecursive;
|
|
6253
6277
|
exports.multiSubscription = multiSubscription;
|
|
@@ -6264,10 +6288,12 @@
|
|
|
6264
6288
|
exports.readAndDeleteFile = readAndDeleteFile;
|
|
6265
6289
|
exports.readFile = readFile;
|
|
6266
6290
|
exports.regroup = regroup;
|
|
6291
|
+
exports.replaceSpecialChars = replaceSpecialChars;
|
|
6267
6292
|
exports.runCommand = runCommand;
|
|
6268
6293
|
exports.setupBackend = setupBackend;
|
|
6269
6294
|
exports.streamToBuffer = streamToBuffer;
|
|
6270
6295
|
exports.ucFirst = ucFirst;
|
|
6296
|
+
exports.uniqueItems = uniqueItems;
|
|
6271
6297
|
exports.valueToPromise = valueToPromise;
|
|
6272
6298
|
exports.writeFile = writeFile;
|
|
6273
6299
|
|