@sdflc/backend-helpers 1.0.33 → 1.0.34
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/build/BaseGateway.js +16 -15
- package/package.json +1 -1
package/build/BaseGateway.js
CHANGED
|
@@ -285,27 +285,28 @@ var BaseGateway = /** @class */ (function () {
|
|
|
285
285
|
BaseGateway.prototype.create = function (args) {
|
|
286
286
|
var _a;
|
|
287
287
|
return __awaiter(this, void 0, void 0, function () {
|
|
288
|
-
var objects, idx, len,
|
|
289
|
-
return __generator(this, function (
|
|
290
|
-
switch (
|
|
288
|
+
var objects, idx, len, object, id, _b, _c, result, chunks, idx, len, items;
|
|
289
|
+
return __generator(this, function (_d) {
|
|
290
|
+
switch (_d.label) {
|
|
291
291
|
case 0:
|
|
292
292
|
objects = (0, lodash_1.castArray)(args);
|
|
293
293
|
if (!args || objects.length === 0) {
|
|
294
294
|
return [2 /*return*/, []];
|
|
295
295
|
}
|
|
296
|
-
idx = 0, len =
|
|
297
|
-
|
|
296
|
+
idx = 0, len = objects.length;
|
|
297
|
+
_d.label = 1;
|
|
298
298
|
case 1:
|
|
299
299
|
if (!(idx < len)) return [3 /*break*/, 5];
|
|
300
|
-
|
|
301
|
-
return [4 /*yield*/, this.generateId(
|
|
300
|
+
object = objects[idx];
|
|
301
|
+
return [4 /*yield*/, this.generateId(object)];
|
|
302
302
|
case 2:
|
|
303
|
-
id =
|
|
304
|
-
|
|
303
|
+
id = _d.sent();
|
|
304
|
+
_b = objects;
|
|
305
|
+
_c = idx;
|
|
306
|
+
return [4 /*yield*/, this.transformOnCreate(__assign({ id: id }, object))];
|
|
305
307
|
case 3:
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
_b.label = 4;
|
|
308
|
+
_b[_c] = _d.sent();
|
|
309
|
+
_d.label = 4;
|
|
309
310
|
case 4:
|
|
310
311
|
++idx;
|
|
311
312
|
return [3 /*break*/, 1];
|
|
@@ -313,14 +314,14 @@ var BaseGateway = /** @class */ (function () {
|
|
|
313
314
|
result = [];
|
|
314
315
|
chunks = (0, utils_1.arrToChunks)(objects, ((_a = this.config) === null || _a === void 0 ? void 0 : _a.insertChunkSize) || DEFAULT_CHUNCK_SIZE);
|
|
315
316
|
idx = 0, len = chunks.length;
|
|
316
|
-
|
|
317
|
+
_d.label = 6;
|
|
317
318
|
case 6:
|
|
318
319
|
if (!(idx < len)) return [3 /*break*/, 9];
|
|
319
320
|
return [4 /*yield*/, this.getBuilder().insert(chunks[idx]).returning(this.config.returnFields)];
|
|
320
321
|
case 7:
|
|
321
|
-
items =
|
|
322
|
+
items = _d.sent();
|
|
322
323
|
result.push.apply(result, items);
|
|
323
|
-
|
|
324
|
+
_d.label = 8;
|
|
324
325
|
case 8:
|
|
325
326
|
++idx;
|
|
326
327
|
return [3 /*break*/, 6];
|
package/package.json
CHANGED