backendless 6.3.2 → 6.3.6

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,6 +1,6 @@
1
1
  /*
2
2
  * ********************************************************************************************************************
3
- * Backendless SDK for JavaScript. Version: 6.3.2
3
+ * Backendless SDK for JavaScript. Version: 6.3.6
4
4
  *
5
5
  * Copyright 2012-2021 BACKENDLESS.COM. All Rights Reserved.
6
6
  *
@@ -15466,16 +15466,18 @@ var ChangesTypes = {
15466
15466
  CREATED: 'created',
15467
15467
  UPDATED: 'updated',
15468
15468
  DELETED: 'deleted',
15469
+ UPSERTED: 'upserted',
15469
15470
  BULK_CREATED: 'bulk-created',
15470
15471
  BULK_UPDATED: 'bulk-updated',
15471
- BULK_DELETED: 'bulk-deleted'
15472
+ BULK_DELETED: 'bulk-deleted',
15473
+ BULK_UPSERTED: 'bulk-upserted'
15472
15474
  };
15473
15475
  var RelationsChangesTypes = {
15474
15476
  ADD: 'add',
15475
15477
  SET: 'set',
15476
15478
  DELETE: 'delete'
15477
15479
  };
15478
- var SingleChangesTypes = [ChangesTypes.CREATED, ChangesTypes.UPDATED, ChangesTypes.DELETED];
15480
+ var SingleChangesTypes = [ChangesTypes.CREATED, ChangesTypes.UPDATED, ChangesTypes.DELETED, ChangesTypes.UPSERTED];
15479
15481
 
15480
15482
  var RTHandlers = /*#__PURE__*/function (_RTListeners) {
15481
15483
  (0, _inherits2["default"])(RTHandlers, _RTListeners);
@@ -15518,6 +15520,25 @@ var RTHandlers = /*#__PURE__*/function (_RTListeners) {
15518
15520
 
15519
15521
  this.removeCreateListeners(undefined, callback);
15520
15522
  }
15523
+ }, {
15524
+ key: "addUpsertListener",
15525
+ value: function addUpsertListener(whereClause, callback, onError) {
15526
+ this.addChangesListener(ChangesTypes.UPSERTED, whereClause, callback, onError);
15527
+ }
15528
+ }, {
15529
+ key: "removeUpsertListeners",
15530
+ value: function removeUpsertListeners(whereClause, callback) {
15531
+ this.removeChangesListeners(ChangesTypes.UPSERTED, whereClause, callback);
15532
+ }
15533
+ }, {
15534
+ key: "removeUpsertListener",
15535
+ value: function removeUpsertListener(callback) {
15536
+ if (!callback || typeof callback !== 'function') {
15537
+ throw new Error('Listener Function must be passed.');
15538
+ }
15539
+
15540
+ this.removeUpsertListeners(undefined, callback);
15541
+ }
15521
15542
  }, {
15522
15543
  key: "addUpdateListener",
15523
15544
  value: function addUpdateListener(whereClause, callback, onError) {
@@ -15613,6 +15634,25 @@ var RTHandlers = /*#__PURE__*/function (_RTListeners) {
15613
15634
 
15614
15635
  this.removeBulkDeleteListeners(undefined, callback);
15615
15636
  }
15637
+ }, {
15638
+ key: "addBulkUpsertListener",
15639
+ value: function addBulkUpsertListener(whereClause, callback, onError) {
15640
+ this.addChangesListener(ChangesTypes.BULK_UPSERTED, whereClause, callback, onError);
15641
+ }
15642
+ }, {
15643
+ key: "removeBulkUpsertListeners",
15644
+ value: function removeBulkUpsertListeners() {
15645
+ this.removeChangesListeners(ChangesTypes.BULK_UPSERTED);
15646
+ }
15647
+ }, {
15648
+ key: "removeBulkUpsertListener",
15649
+ value: function removeBulkUpsertListener(callback) {
15650
+ if (!callback || typeof callback !== 'function') {
15651
+ throw new Error('Listener Function must be passed.');
15652
+ }
15653
+
15654
+ this.removeChangesListeners(ChangesTypes.BULK_UPSERTED, undefined, callback);
15655
+ }
15616
15656
  }, {
15617
15657
  key: "addSetRelationListener",
15618
15658
  value: function addSetRelationListener(relationColumnName, parentObjects, callback, onError) {
@@ -15903,21 +15943,23 @@ var DataStore = /*#__PURE__*/function () {
15903
15943
  }, {
15904
15944
  key: "save",
15905
15945
  value: function () {
15906
- var _save = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(object) {
15946
+ var _save = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(object, isUpsert) {
15907
15947
  var _this = this;
15908
15948
 
15949
+ var url;
15909
15950
  return _regenerator["default"].wrap(function _callee$(_context) {
15910
15951
  while (1) {
15911
15952
  switch (_context.prev = _context.next) {
15912
15953
  case 0:
15954
+ url = isUpsert ? this.app.urls.dataTableUpsert(this.className) : this.app.urls.dataTable(this.className);
15913
15955
  return _context.abrupt("return", this.app.request.put({
15914
- url: this.app.urls.dataTable(this.className),
15956
+ url: url,
15915
15957
  data: convertToServerRecord(object)
15916
15958
  }).then(function (result) {
15917
15959
  return _this.parseResponse(result);
15918
15960
  }));
15919
15961
 
15920
- case 1:
15962
+ case 2:
15921
15963
  case "end":
15922
15964
  return _context.stop();
15923
15965
  }
@@ -15925,7 +15967,7 @@ var DataStore = /*#__PURE__*/function () {
15925
15967
  }, _callee, this);
15926
15968
  }));
15927
15969
 
15928
- function save(_x) {
15970
+ function save(_x, _x2) {
15929
15971
  return _save.apply(this, arguments);
15930
15972
  }
15931
15973
 
@@ -15956,7 +15998,7 @@ var DataStore = /*#__PURE__*/function () {
15956
15998
  }, _callee2, this);
15957
15999
  }));
15958
16000
 
15959
- function deepSave(_x2) {
16001
+ function deepSave(_x3) {
15960
16002
  return _deepSave.apply(this, arguments);
15961
16003
  }
15962
16004
 
@@ -15993,7 +16035,7 @@ var DataStore = /*#__PURE__*/function () {
15993
16035
  }, _callee3, this);
15994
16036
  }));
15995
16037
 
15996
- function remove(_x3) {
16038
+ function remove(_x4) {
15997
16039
  return _remove.apply(this, arguments);
15998
16040
  }
15999
16041
 
@@ -16024,7 +16066,7 @@ var DataStore = /*#__PURE__*/function () {
16024
16066
  }, _callee4, this);
16025
16067
  }));
16026
16068
 
16027
- function find(_x4) {
16069
+ function find(_x5) {
16028
16070
  return _find.apply(this, arguments);
16029
16071
  }
16030
16072
 
@@ -16051,7 +16093,7 @@ var DataStore = /*#__PURE__*/function () {
16051
16093
  }, _callee5, this);
16052
16094
  }));
16053
16095
 
16054
- function group(_x5) {
16096
+ function group(_x6) {
16055
16097
  return _group.apply(this, arguments);
16056
16098
  }
16057
16099
 
@@ -16086,7 +16128,7 @@ var DataStore = /*#__PURE__*/function () {
16086
16128
  }, _callee6, this);
16087
16129
  }));
16088
16130
 
16089
- function countInGroup(_x6) {
16131
+ function countInGroup(_x7) {
16090
16132
  return _countInGroup.apply(this, arguments);
16091
16133
  }
16092
16134
 
@@ -16154,7 +16196,7 @@ var DataStore = /*#__PURE__*/function () {
16154
16196
  }, _callee7, this);
16155
16197
  }));
16156
16198
 
16157
- function findById(_x7, _x8) {
16199
+ function findById(_x8, _x9) {
16158
16200
  return _findById.apply(this, arguments);
16159
16201
  }
16160
16202
 
@@ -16185,7 +16227,7 @@ var DataStore = /*#__PURE__*/function () {
16185
16227
  }, _callee8, this);
16186
16228
  }));
16187
16229
 
16188
- function findFirst(_x9) {
16230
+ function findFirst(_x10) {
16189
16231
  return _findFirst.apply(this, arguments);
16190
16232
  }
16191
16233
 
@@ -16216,7 +16258,7 @@ var DataStore = /*#__PURE__*/function () {
16216
16258
  }, _callee9, this);
16217
16259
  }));
16218
16260
 
16219
- function findLast(_x10) {
16261
+ function findLast(_x11) {
16220
16262
  return _findLast.apply(this, arguments);
16221
16263
  }
16222
16264
 
@@ -16273,7 +16315,7 @@ var DataStore = /*#__PURE__*/function () {
16273
16315
  }, _callee10, this);
16274
16316
  }));
16275
16317
 
16276
- function getObjectCount(_x11) {
16318
+ function getObjectCount(_x12) {
16277
16319
  return _getObjectCount.apply(this, arguments);
16278
16320
  }
16279
16321
 
@@ -16326,7 +16368,7 @@ var DataStore = /*#__PURE__*/function () {
16326
16368
  }, _callee11, this);
16327
16369
  }));
16328
16370
 
16329
- function loadRelations(_x12, _x13) {
16371
+ function loadRelations(_x13, _x14) {
16330
16372
  return _loadRelations.apply(this, arguments);
16331
16373
  }
16332
16374
 
@@ -16350,7 +16392,7 @@ var DataStore = /*#__PURE__*/function () {
16350
16392
  }, _callee12, this);
16351
16393
  }));
16352
16394
 
16353
- function setRelation(_x14, _x15, _x16) {
16395
+ function setRelation(_x15, _x16, _x17) {
16354
16396
  return _setRelation.apply(this, arguments);
16355
16397
  }
16356
16398
 
@@ -16374,7 +16416,7 @@ var DataStore = /*#__PURE__*/function () {
16374
16416
  }, _callee13, this);
16375
16417
  }));
16376
16418
 
16377
- function addRelation(_x17, _x18, _x19) {
16419
+ function addRelation(_x18, _x19, _x20) {
16378
16420
  return _addRelation.apply(this, arguments);
16379
16421
  }
16380
16422
 
@@ -16398,7 +16440,7 @@ var DataStore = /*#__PURE__*/function () {
16398
16440
  }, _callee14, this);
16399
16441
  }));
16400
16442
 
16401
- function deleteRelation(_x20, _x21, _x22) {
16443
+ function deleteRelation(_x21, _x22, _x23) {
16402
16444
  return _deleteRelation.apply(this, arguments);
16403
16445
  }
16404
16446
 
@@ -16443,22 +16485,67 @@ var DataStore = /*#__PURE__*/function () {
16443
16485
  }, _callee15, this);
16444
16486
  }));
16445
16487
 
16446
- function bulkCreate(_x23) {
16488
+ function bulkCreate(_x24) {
16447
16489
  return _bulkCreate.apply(this, arguments);
16448
16490
  }
16449
16491
 
16450
16492
  return bulkCreate;
16451
16493
  }()
16452
16494
  }, {
16453
- key: "bulkUpdate",
16495
+ key: "bulkUpsert",
16454
16496
  value: function () {
16455
- var _bulkUpdate = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(condition, changes) {
16497
+ var _bulkUpsert = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(objects) {
16498
+ var errorMessage;
16456
16499
  return _regenerator["default"].wrap(function _callee16$(_context16) {
16457
16500
  while (1) {
16458
16501
  switch (_context16.prev = _context16.next) {
16502
+ case 0:
16503
+ errorMessage = 'Objects must be provided and must be an array of objects.';
16504
+
16505
+ if (!(!objects || !Array.isArray(objects) || !objects.length)) {
16506
+ _context16.next = 3;
16507
+ break;
16508
+ }
16509
+
16510
+ throw new Error(errorMessage);
16511
+
16512
+ case 3:
16513
+ objects = objects.map(function (object) {
16514
+ if (!object || (0, _typeof2["default"])(object) !== 'object' || Array.isArray(object)) {
16515
+ throw new Error(errorMessage);
16516
+ }
16517
+
16518
+ return object;
16519
+ });
16520
+ return _context16.abrupt("return", this.app.request.put({
16521
+ url: this.app.urls.dataBulkTableUpsert(this.className),
16522
+ data: objects
16523
+ }));
16524
+
16525
+ case 5:
16526
+ case "end":
16527
+ return _context16.stop();
16528
+ }
16529
+ }
16530
+ }, _callee16, this);
16531
+ }));
16532
+
16533
+ function bulkUpsert(_x25) {
16534
+ return _bulkUpsert.apply(this, arguments);
16535
+ }
16536
+
16537
+ return bulkUpsert;
16538
+ }()
16539
+ }, {
16540
+ key: "bulkUpdate",
16541
+ value: function () {
16542
+ var _bulkUpdate = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee17(condition, changes) {
16543
+ return _regenerator["default"].wrap(function _callee17$(_context17) {
16544
+ while (1) {
16545
+ switch (_context17.prev = _context17.next) {
16459
16546
  case 0:
16460
16547
  if (!(!condition || typeof condition !== 'string')) {
16461
- _context16.next = 2;
16548
+ _context17.next = 2;
16462
16549
  break;
16463
16550
  }
16464
16551
 
@@ -16466,14 +16553,14 @@ var DataStore = /*#__PURE__*/function () {
16466
16553
 
16467
16554
  case 2:
16468
16555
  if (!(!changes || (0, _typeof2["default"])(changes) !== 'object' || Array.isArray(changes))) {
16469
- _context16.next = 4;
16556
+ _context17.next = 4;
16470
16557
  break;
16471
16558
  }
16472
16559
 
16473
16560
  throw new Error('Changes must be provided and must be an object.');
16474
16561
 
16475
16562
  case 4:
16476
- return _context16.abrupt("return", this.app.request.put({
16563
+ return _context17.abrupt("return", this.app.request.put({
16477
16564
  url: this.app.urls.dataBulkTable(this.className),
16478
16565
  query: {
16479
16566
  where: condition
@@ -16483,13 +16570,13 @@ var DataStore = /*#__PURE__*/function () {
16483
16570
 
16484
16571
  case 5:
16485
16572
  case "end":
16486
- return _context16.stop();
16573
+ return _context17.stop();
16487
16574
  }
16488
16575
  }
16489
- }, _callee16, this);
16576
+ }, _callee17, this);
16490
16577
  }));
16491
16578
 
16492
- function bulkUpdate(_x24, _x25) {
16579
+ function bulkUpdate(_x26, _x27) {
16493
16580
  return _bulkUpdate.apply(this, arguments);
16494
16581
  }
16495
16582
 
@@ -16498,14 +16585,14 @@ var DataStore = /*#__PURE__*/function () {
16498
16585
  }, {
16499
16586
  key: "bulkDelete",
16500
16587
  value: function () {
16501
- var _bulkDelete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee17(condition) {
16588
+ var _bulkDelete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee18(condition) {
16502
16589
  var queryData, objectIds;
16503
- return _regenerator["default"].wrap(function _callee17$(_context17) {
16590
+ return _regenerator["default"].wrap(function _callee18$(_context18) {
16504
16591
  while (1) {
16505
- switch (_context17.prev = _context17.next) {
16592
+ switch (_context18.prev = _context18.next) {
16506
16593
  case 0:
16507
16594
  if (!(!condition || typeof condition !== 'string' && !Array.isArray(condition))) {
16508
- _context17.next = 2;
16595
+ _context18.next = 2;
16509
16596
  break;
16510
16597
  }
16511
16598
 
@@ -16529,20 +16616,20 @@ var DataStore = /*#__PURE__*/function () {
16529
16616
  queryData.where = "objectId in (".concat(objectIds.join(','), ")");
16530
16617
  }
16531
16618
 
16532
- return _context17.abrupt("return", this.app.request.post({
16619
+ return _context18.abrupt("return", this.app.request.post({
16533
16620
  url: this.app.urls.dataBulkTableDelete(this.className),
16534
16621
  data: queryData
16535
16622
  }));
16536
16623
 
16537
16624
  case 5:
16538
16625
  case "end":
16539
- return _context17.stop();
16626
+ return _context18.stop();
16540
16627
  }
16541
16628
  }
16542
- }, _callee17, this);
16629
+ }, _callee18, this);
16543
16630
  }));
16544
16631
 
16545
- function bulkDelete(_x26) {
16632
+ function bulkDelete(_x28) {
16546
16633
  return _bulkDelete.apply(this, arguments);
16547
16634
  }
16548
16635
 
@@ -16864,7 +16951,7 @@ var Files = /*#__PURE__*/function () {
16864
16951
  query.overwrite = overwrite;
16865
16952
  }
16866
16953
 
16867
- filePath = _utils["default"].preventSlashInPath(filePath);
16954
+ filePath = _utils["default"].trimSlashesInPath(filePath);
16868
16955
  fileName = _utils["default"].sanitizeFileName(fileName);
16869
16956
  return _context.abrupt("return", this.app.request.put({
16870
16957
  url: "".concat(this.app.urls.fileBinaryPath(filePath), "/").concat(fileName),
@@ -16904,7 +16991,7 @@ var Files = /*#__PURE__*/function () {
16904
16991
  query.overwrite = overwrite;
16905
16992
  }
16906
16993
 
16907
- filePath = _utils["default"].preventSlashInPath(filePath);
16994
+ filePath = _utils["default"].trimSlashesInPath(filePath);
16908
16995
  pathTokens = _utils["default"].parseFilePath(filePath);
16909
16996
 
16910
16997
  if (pathTokens.fileName) {
@@ -16923,7 +17010,7 @@ var Files = /*#__PURE__*/function () {
16923
17010
  }
16924
17011
 
16925
17012
  return _context2.abrupt("return", this.app.request.post({
16926
- url: "".concat(this.app.urls.filePath(filePath), "/").concat(fileName || ''),
17013
+ url: "".concat(this.app.urls.filePath(filePath), "/").concat(fileName),
16927
17014
  query: query,
16928
17015
  data: {
16929
17016
  url: file
@@ -16967,25 +17054,189 @@ var Files = /*#__PURE__*/function () {
16967
17054
  return upload;
16968
17055
  }()
16969
17056
  }, {
16970
- key: "listing",
17057
+ key: "append",
16971
17058
  value: function () {
16972
- var _listing = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(filePath, pattern, sub, pagesize, offset) {
16973
- var query;
17059
+ var _append = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(filePath, fileName, fileContent) {
17060
+ var pathTokens,
17061
+ _args3 = arguments;
16974
17062
  return _regenerator["default"].wrap(function _callee3$(_context3) {
16975
17063
  while (1) {
16976
17064
  switch (_context3.prev = _context3.next) {
17065
+ case 0:
17066
+ if (!(!filePath || typeof filePath !== 'string')) {
17067
+ _context3.next = 2;
17068
+ break;
17069
+ }
17070
+
17071
+ throw new Error('"filePath" must be provided and must be a string.');
17072
+
17073
+ case 2:
17074
+ filePath = _utils["default"].trimSlashesInPath(filePath);
17075
+
17076
+ if (_args3.length === 2) {
17077
+ fileContent = fileName;
17078
+ fileName = undefined;
17079
+ pathTokens = _utils["default"].parseFilePath(filePath);
17080
+
17081
+ if (pathTokens.fileName) {
17082
+ filePath = pathTokens.filePath;
17083
+ fileName = pathTokens.fileName;
17084
+ }
17085
+ }
17086
+
17087
+ if (fileName) {
17088
+ _context3.next = 6;
17089
+ break;
17090
+ }
17091
+
17092
+ throw new Error('Can not resolve target file name');
17093
+
17094
+ case 6:
17095
+ fileName = _utils["default"].sanitizeFileName(fileName);
17096
+
17097
+ if (!(typeof fileContent === 'string')) {
17098
+ _context3.next = 9;
17099
+ break;
17100
+ }
17101
+
17102
+ return _context3.abrupt("return", this.app.request.post({
17103
+ url: "".concat(this.app.urls.fileAppendPath(filePath), "/").concat(fileName),
17104
+ data: {
17105
+ url: fileContent
17106
+ }
17107
+ }));
17108
+
17109
+ case 9:
17110
+ if (!_utils["default"].isBytesArray(fileContent)) {
17111
+ _context3.next = 14;
17112
+ break;
17113
+ }
17114
+
17115
+ _context3.next = 12;
17116
+ return _utils["default"].toBase64(fileContent);
17117
+
17118
+ case 12:
17119
+ fileContent = _context3.sent;
17120
+ return _context3.abrupt("return", this.app.request.put({
17121
+ url: "".concat(this.app.urls.fileAppendBinaryPath(filePath), "/").concat(fileName),
17122
+ headers: {
17123
+ 'Content-Type': 'text/plain'
17124
+ },
17125
+ data: fileContent
17126
+ }));
17127
+
17128
+ case 14:
17129
+ return _context3.abrupt("return", this.app.request.post({
17130
+ url: "".concat(this.app.urls.fileAppendPath(filePath), "/").concat(fileName),
17131
+ form: {
17132
+ file: fileContent
17133
+ }
17134
+ }));
17135
+
17136
+ case 15:
17137
+ case "end":
17138
+ return _context3.stop();
17139
+ }
17140
+ }
17141
+ }, _callee3, this);
17142
+ }));
17143
+
17144
+ function append(_x8, _x9, _x10) {
17145
+ return _append.apply(this, arguments);
17146
+ }
17147
+
17148
+ return append;
17149
+ }()
17150
+ }, {
17151
+ key: "appendText",
17152
+ value: function () {
17153
+ var _appendText = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(filePath, fileName, textContent) {
17154
+ var pathTokens,
17155
+ _args4 = arguments;
17156
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
17157
+ while (1) {
17158
+ switch (_context4.prev = _context4.next) {
17159
+ case 0:
17160
+ if (!(!filePath || typeof filePath !== 'string')) {
17161
+ _context4.next = 2;
17162
+ break;
17163
+ }
17164
+
17165
+ throw new Error('"filePath" must be provided and must be a string.');
17166
+
17167
+ case 2:
17168
+ filePath = _utils["default"].trimSlashesInPath(filePath);
17169
+
17170
+ if (_args4.length === 2) {
17171
+ textContent = fileName;
17172
+ fileName = undefined;
17173
+ pathTokens = _utils["default"].parseFilePath(filePath);
17174
+
17175
+ if (pathTokens.fileName) {
17176
+ filePath = pathTokens.filePath;
17177
+ fileName = pathTokens.fileName;
17178
+ }
17179
+ }
17180
+
17181
+ if (fileName) {
17182
+ _context4.next = 6;
17183
+ break;
17184
+ }
17185
+
17186
+ throw new Error('Can not resolve target file name');
17187
+
17188
+ case 6:
17189
+ if (!(typeof textContent !== 'string')) {
17190
+ _context4.next = 8;
17191
+ break;
17192
+ }
17193
+
17194
+ throw new Error('"textContent" must be a string');
17195
+
17196
+ case 8:
17197
+ fileName = _utils["default"].sanitizeFileName(fileName);
17198
+ return _context4.abrupt("return", this.app.request.put({
17199
+ url: "".concat(this.app.urls.fileAppendPath(filePath), "/").concat(fileName),
17200
+ headers: {
17201
+ 'Content-Type': 'text/plain'
17202
+ },
17203
+ data: textContent
17204
+ }));
17205
+
17206
+ case 10:
17207
+ case "end":
17208
+ return _context4.stop();
17209
+ }
17210
+ }
17211
+ }, _callee4, this);
17212
+ }));
17213
+
17214
+ function appendText(_x11, _x12, _x13) {
17215
+ return _appendText.apply(this, arguments);
17216
+ }
17217
+
17218
+ return appendText;
17219
+ }()
17220
+ }, {
17221
+ key: "listing",
17222
+ value: function () {
17223
+ var _listing = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(filePath, pattern, sub, pagesize, offset) {
17224
+ var query;
17225
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
17226
+ while (1) {
17227
+ switch (_context5.prev = _context5.next) {
16977
17228
  case 0:
16978
17229
  query = {};
16979
17230
 
16980
17231
  if (!(!filePath || typeof filePath !== 'string')) {
16981
- _context3.next = 3;
17232
+ _context5.next = 3;
16982
17233
  break;
16983
17234
  }
16984
17235
 
16985
17236
  throw new Error('"filePath" must be provided and must be a string.');
16986
17237
 
16987
17238
  case 3:
16988
- filePath = _utils["default"].preventSlashInPath(filePath);
17239
+ filePath = _utils["default"].trimSlashesInPath(filePath);
16989
17240
 
16990
17241
  if (pattern && typeof pattern === 'string') {
16991
17242
  query.pattern = pattern;
@@ -17003,20 +17254,20 @@ var Files = /*#__PURE__*/function () {
17003
17254
  query.offset = offset;
17004
17255
  }
17005
17256
 
17006
- return _context3.abrupt("return", this.app.request.get({
17257
+ return _context5.abrupt("return", this.app.request.get({
17007
17258
  url: this.app.urls.filePath(filePath),
17008
17259
  query: query
17009
17260
  }));
17010
17261
 
17011
17262
  case 9:
17012
17263
  case "end":
17013
- return _context3.stop();
17264
+ return _context5.stop();
17014
17265
  }
17015
17266
  }
17016
- }, _callee3, this);
17267
+ }, _callee5, this);
17017
17268
  }));
17018
17269
 
17019
- function listing(_x8, _x9, _x10, _x11, _x12) {
17270
+ function listing(_x14, _x15, _x16, _x17, _x18) {
17020
17271
  return _listing.apply(this, arguments);
17021
17272
  }
17022
17273
 
@@ -17025,13 +17276,13 @@ var Files = /*#__PURE__*/function () {
17025
17276
  }, {
17026
17277
  key: "renameFile",
17027
17278
  value: function () {
17028
- var _renameFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(oldPathName, newName) {
17029
- return _regenerator["default"].wrap(function _callee4$(_context4) {
17279
+ var _renameFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(oldPathName, newName) {
17280
+ return _regenerator["default"].wrap(function _callee6$(_context6) {
17030
17281
  while (1) {
17031
- switch (_context4.prev = _context4.next) {
17282
+ switch (_context6.prev = _context6.next) {
17032
17283
  case 0:
17033
17284
  if (!(!oldPathName || typeof oldPathName !== 'string')) {
17034
- _context4.next = 2;
17285
+ _context6.next = 2;
17035
17286
  break;
17036
17287
  }
17037
17288
 
@@ -17039,14 +17290,14 @@ var Files = /*#__PURE__*/function () {
17039
17290
 
17040
17291
  case 2:
17041
17292
  if (!(!newName || typeof newName !== 'string')) {
17042
- _context4.next = 4;
17293
+ _context6.next = 4;
17043
17294
  break;
17044
17295
  }
17045
17296
 
17046
17297
  throw new Error('New File Name must be provided and must be a string.');
17047
17298
 
17048
17299
  case 4:
17049
- return _context4.abrupt("return", this.app.request.put({
17300
+ return _context6.abrupt("return", this.app.request.put({
17050
17301
  url: this.app.urls.fileRename(),
17051
17302
  data: {
17052
17303
  oldPathName: _utils["default"].ensureSlashInPath(oldPathName),
@@ -17056,13 +17307,13 @@ var Files = /*#__PURE__*/function () {
17056
17307
 
17057
17308
  case 5:
17058
17309
  case "end":
17059
- return _context4.stop();
17310
+ return _context6.stop();
17060
17311
  }
17061
17312
  }
17062
- }, _callee4, this);
17313
+ }, _callee6, this);
17063
17314
  }));
17064
17315
 
17065
- function renameFile(_x13, _x14) {
17316
+ function renameFile(_x19, _x20) {
17066
17317
  return _renameFile.apply(this, arguments);
17067
17318
  }
17068
17319
 
@@ -17071,12 +17322,12 @@ var Files = /*#__PURE__*/function () {
17071
17322
  }, {
17072
17323
  key: "moveFile",
17073
17324
  value: function () {
17074
- var _moveFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(sourcePath, targetPath) {
17075
- return _regenerator["default"].wrap(function _callee5$(_context5) {
17325
+ var _moveFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(sourcePath, targetPath) {
17326
+ return _regenerator["default"].wrap(function _callee7$(_context7) {
17076
17327
  while (1) {
17077
- switch (_context5.prev = _context5.next) {
17328
+ switch (_context7.prev = _context7.next) {
17078
17329
  case 0:
17079
- return _context5.abrupt("return", this.app.request.put({
17330
+ return _context7.abrupt("return", this.app.request.put({
17080
17331
  url: this.app.urls.fileMove(),
17081
17332
  data: {
17082
17333
  sourcePath: _utils["default"].ensureSlashInPath(sourcePath),
@@ -17086,13 +17337,13 @@ var Files = /*#__PURE__*/function () {
17086
17337
 
17087
17338
  case 1:
17088
17339
  case "end":
17089
- return _context5.stop();
17340
+ return _context7.stop();
17090
17341
  }
17091
17342
  }
17092
- }, _callee5, this);
17343
+ }, _callee7, this);
17093
17344
  }));
17094
17345
 
17095
- function moveFile(_x15, _x16) {
17346
+ function moveFile(_x21, _x22) {
17096
17347
  return _moveFile.apply(this, arguments);
17097
17348
  }
17098
17349
 
@@ -17101,12 +17352,12 @@ var Files = /*#__PURE__*/function () {
17101
17352
  }, {
17102
17353
  key: "copyFile",
17103
17354
  value: function () {
17104
- var _copyFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(sourcePath, targetPath) {
17105
- return _regenerator["default"].wrap(function _callee6$(_context6) {
17355
+ var _copyFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(sourcePath, targetPath) {
17356
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
17106
17357
  while (1) {
17107
- switch (_context6.prev = _context6.next) {
17358
+ switch (_context8.prev = _context8.next) {
17108
17359
  case 0:
17109
- return _context6.abrupt("return", this.app.request.put({
17360
+ return _context8.abrupt("return", this.app.request.put({
17110
17361
  url: this.app.urls.fileCopy(),
17111
17362
  data: {
17112
17363
  sourcePath: _utils["default"].ensureSlashInPath(sourcePath),
@@ -17116,13 +17367,13 @@ var Files = /*#__PURE__*/function () {
17116
17367
 
17117
17368
  case 1:
17118
17369
  case "end":
17119
- return _context6.stop();
17370
+ return _context8.stop();
17120
17371
  }
17121
17372
  }
17122
- }, _callee6, this);
17373
+ }, _callee8, this);
17123
17374
  }));
17124
17375
 
17125
- function copyFile(_x17, _x18) {
17376
+ function copyFile(_x23, _x24) {
17126
17377
  return _copyFile.apply(this, arguments);
17127
17378
  }
17128
17379
 
@@ -17131,13 +17382,13 @@ var Files = /*#__PURE__*/function () {
17131
17382
  }, {
17132
17383
  key: "remove",
17133
17384
  value: function () {
17134
- var _remove = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(filePath) {
17135
- return _regenerator["default"].wrap(function _callee7$(_context7) {
17385
+ var _remove = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(filePath) {
17386
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
17136
17387
  while (1) {
17137
- switch (_context7.prev = _context7.next) {
17388
+ switch (_context9.prev = _context9.next) {
17138
17389
  case 0:
17139
17390
  if (!(!filePath || typeof filePath !== 'string')) {
17140
- _context7.next = 2;
17391
+ _context9.next = 2;
17141
17392
  break;
17142
17393
  }
17143
17394
 
@@ -17148,19 +17399,19 @@ var Files = /*#__PURE__*/function () {
17148
17399
  filePath = this.app.urls.filePath(filePath);
17149
17400
  }
17150
17401
 
17151
- return _context7.abrupt("return", this.app.request["delete"]({
17402
+ return _context9.abrupt("return", this.app.request["delete"]({
17152
17403
  url: filePath
17153
17404
  }));
17154
17405
 
17155
17406
  case 4:
17156
17407
  case "end":
17157
- return _context7.stop();
17408
+ return _context9.stop();
17158
17409
  }
17159
17410
  }
17160
- }, _callee7, this);
17411
+ }, _callee9, this);
17161
17412
  }));
17162
17413
 
17163
- function remove(_x19) {
17414
+ function remove(_x25) {
17164
17415
  return _remove.apply(this, arguments);
17165
17416
  }
17166
17417
 
@@ -17169,21 +17420,21 @@ var Files = /*#__PURE__*/function () {
17169
17420
  }, {
17170
17421
  key: "exists",
17171
17422
  value: function () {
17172
- var _exists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(filePath) {
17173
- return _regenerator["default"].wrap(function _callee8$(_context8) {
17423
+ var _exists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(filePath) {
17424
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
17174
17425
  while (1) {
17175
- switch (_context8.prev = _context8.next) {
17426
+ switch (_context10.prev = _context10.next) {
17176
17427
  case 0:
17177
17428
  if (!(!filePath || typeof filePath !== 'string')) {
17178
- _context8.next = 2;
17429
+ _context10.next = 2;
17179
17430
  break;
17180
17431
  }
17181
17432
 
17182
17433
  throw new Error('"filePath" must be provided and must be a string.');
17183
17434
 
17184
17435
  case 2:
17185
- filePath = _utils["default"].preventSlashInPath(filePath);
17186
- return _context8.abrupt("return", this.app.request.get({
17436
+ filePath = _utils["default"].trimSlashesInPath(filePath);
17437
+ return _context10.abrupt("return", this.app.request.get({
17187
17438
  url: this.app.urls.filePath(filePath),
17188
17439
  query: {
17189
17440
  action: 'exists'
@@ -17192,13 +17443,13 @@ var Files = /*#__PURE__*/function () {
17192
17443
 
17193
17444
  case 4:
17194
17445
  case "end":
17195
- return _context8.stop();
17446
+ return _context10.stop();
17196
17447
  }
17197
17448
  }
17198
- }, _callee8, this);
17449
+ }, _callee10, this);
17199
17450
  }));
17200
17451
 
17201
- function exists(_x20) {
17452
+ function exists(_x26) {
17202
17453
  return _exists.apply(this, arguments);
17203
17454
  }
17204
17455
 
@@ -17207,33 +17458,33 @@ var Files = /*#__PURE__*/function () {
17207
17458
  }, {
17208
17459
  key: "removeDirectory",
17209
17460
  value: function () {
17210
- var _removeDirectory = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(directoryPath) {
17211
- return _regenerator["default"].wrap(function _callee9$(_context9) {
17461
+ var _removeDirectory = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(directoryPath) {
17462
+ return _regenerator["default"].wrap(function _callee11$(_context11) {
17212
17463
  while (1) {
17213
- switch (_context9.prev = _context9.next) {
17464
+ switch (_context11.prev = _context11.next) {
17214
17465
  case 0:
17215
17466
  if (!(!directoryPath || typeof directoryPath !== 'string')) {
17216
- _context9.next = 2;
17467
+ _context11.next = 2;
17217
17468
  break;
17218
17469
  }
17219
17470
 
17220
17471
  throw new Error('Directory "path" must be provided and must be a string.');
17221
17472
 
17222
17473
  case 2:
17223
- directoryPath = _utils["default"].preventSlashInPath(directoryPath);
17224
- return _context9.abrupt("return", this.app.request["delete"]({
17474
+ directoryPath = _utils["default"].trimSlashesInPath(directoryPath);
17475
+ return _context11.abrupt("return", this.app.request["delete"]({
17225
17476
  url: this.app.urls.filePath(directoryPath)
17226
17477
  }));
17227
17478
 
17228
17479
  case 4:
17229
17480
  case "end":
17230
- return _context9.stop();
17481
+ return _context11.stop();
17231
17482
  }
17232
17483
  }
17233
- }, _callee9, this);
17484
+ }, _callee11, this);
17234
17485
  }));
17235
17486
 
17236
- function removeDirectory(_x21) {
17487
+ function removeDirectory(_x27) {
17237
17488
  return _removeDirectory.apply(this, arguments);
17238
17489
  }
17239
17490
 
@@ -17242,13 +17493,13 @@ var Files = /*#__PURE__*/function () {
17242
17493
  }, {
17243
17494
  key: "getFileCount",
17244
17495
  value: function () {
17245
- var _getFileCount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(filesPath, pattern, sub, countDirectories) {
17246
- return _regenerator["default"].wrap(function _callee10$(_context10) {
17496
+ var _getFileCount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(filesPath, pattern, sub, countDirectories) {
17497
+ return _regenerator["default"].wrap(function _callee12$(_context12) {
17247
17498
  while (1) {
17248
- switch (_context10.prev = _context10.next) {
17499
+ switch (_context12.prev = _context12.next) {
17249
17500
  case 0:
17250
17501
  if (!(!filesPath || typeof filesPath !== 'string')) {
17251
- _context10.next = 2;
17502
+ _context12.next = 2;
17252
17503
  break;
17253
17504
  }
17254
17505
 
@@ -17256,15 +17507,15 @@ var Files = /*#__PURE__*/function () {
17256
17507
 
17257
17508
  case 2:
17258
17509
  if (!(pattern && typeof pattern !== 'string')) {
17259
- _context10.next = 4;
17510
+ _context12.next = 4;
17260
17511
  break;
17261
17512
  }
17262
17513
 
17263
17514
  throw new Error('Files Pattern must be provided and must be a string.');
17264
17515
 
17265
17516
  case 4:
17266
- filesPath = _utils["default"].preventSlashInPath(filesPath);
17267
- return _context10.abrupt("return", this.app.request.get({
17517
+ filesPath = _utils["default"].trimSlashesInPath(filesPath);
17518
+ return _context12.abrupt("return", this.app.request.get({
17268
17519
  url: this.app.urls.filePath(filesPath),
17269
17520
  query: {
17270
17521
  action: 'count',
@@ -17276,13 +17527,13 @@ var Files = /*#__PURE__*/function () {
17276
17527
 
17277
17528
  case 6:
17278
17529
  case "end":
17279
- return _context10.stop();
17530
+ return _context12.stop();
17280
17531
  }
17281
17532
  }
17282
- }, _callee10, this);
17533
+ }, _callee12, this);
17283
17534
  }));
17284
17535
 
17285
- function getFileCount(_x22, _x23, _x24, _x25) {
17536
+ function getFileCount(_x28, _x29, _x30, _x31) {
17286
17537
  return _getFileCount.apply(this, arguments);
17287
17538
  }
17288
17539
 
@@ -17377,11 +17628,32 @@ var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime
17377
17628
  var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
17378
17629
 
17379
17630
  var FilesUtils = {
17631
+ isBytesArray: function isBytesArray(data) {
17632
+ if (typeof Buffer !== 'undefined' && data instanceof Buffer) {
17633
+ return true;
17634
+ }
17635
+
17636
+ if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) {
17637
+ return true;
17638
+ }
17639
+
17640
+ return Array.isArray(data);
17641
+ },
17380
17642
  ensureSlashInPath: function ensureSlashInPath(path) {
17381
17643
  return !path.startsWith('/') ? "/".concat(path) : path;
17382
17644
  },
17383
- preventSlashInPath: function preventSlashInPath(path) {
17384
- return path && path.startsWith('/') ? path.slice(1) : path;
17645
+ trimSlashesInPath: function trimSlashesInPath(path) {
17646
+ if (path) {
17647
+ if (path.startsWith('/')) {
17648
+ path = path.slice(1);
17649
+ }
17650
+
17651
+ if (path.endsWith('/')) {
17652
+ path = path.slice(0, path.length - 1);
17653
+ }
17654
+ }
17655
+
17656
+ return path;
17385
17657
  },
17386
17658
  parseFilePath: function parseFilePath(path) {
17387
17659
  var result = {
@@ -18077,7 +18349,7 @@ var LocalCache = /*#__PURE__*/function () {
18077
18349
  function LocalCache(app) {
18078
18350
  (0, _classCallCheck2["default"])(this, LocalCache);
18079
18351
  this.app = app;
18080
- this.storageName = "".concat(STORAGE_KEY_NAMESPACE, "_").concat(this.app.appId);
18352
+ this.storageName = this.app.appId ? "".concat(STORAGE_KEY_NAMESPACE, "_").concat(this.app.appId) : STORAGE_KEY_NAMESPACE;
18081
18353
  var Storage = _utils["default"].isLocalStorageSupported ? _localStorage["default"] : _virtualStorage["default"];
18082
18354
  this.setStorage(Storage);
18083
18355
  this.Keys = {
@@ -18344,6 +18616,10 @@ var Logging = /*#__PURE__*/function () {
18344
18616
  }, {
18345
18617
  key: "push",
18346
18618
  value: function push(logger, logLevel, message, exception) {
18619
+ if (typeof message !== 'string') {
18620
+ throw new Error('"message" must be a string');
18621
+ }
18622
+
18347
18623
  this.pool.push({
18348
18624
  logger: logger,
18349
18625
  message: message,
@@ -20346,6 +20622,8 @@ var OperationType = {
20346
20622
  UPDATE_BULK: 'UPDATE_BULK',
20347
20623
  DELETE: 'DELETE',
20348
20624
  DELETE_BULK: 'DELETE_BULK',
20625
+ UPSERT: 'UPSERT',
20626
+ UPSERT_BULK: 'UPSERT_BULK',
20349
20627
  FIND: 'FIND',
20350
20628
  ADD_RELATION: 'ADD_RELATION',
20351
20629
  SET_RELATION: 'SET_RELATION',
@@ -20680,6 +20958,37 @@ var UnitOfWork = /*#__PURE__*/function () {
20680
20958
 
20681
20959
  return this.addOperations(_constants.OperationType.FIND, tableName, payload);
20682
20960
  }
20961
+ /**
20962
+ * upsert(object: object): OpResult;
20963
+ * upsert(tableName: string, object: object): OpResult;
20964
+ * **/
20965
+
20966
+ }, {
20967
+ key: "upsert",
20968
+ value: function upsert() {
20969
+ var tableName;
20970
+ var changes;
20971
+
20972
+ if (arguments.length === 1) {
20973
+ tableName = _utils["default"].getClassName(arguments.length <= 0 ? undefined : arguments[0]);
20974
+ changes = arguments.length <= 0 ? undefined : arguments[0];
20975
+ } else if (arguments.length === 2) {
20976
+ tableName = arguments.length <= 0 ? undefined : arguments[0];
20977
+ changes = arguments.length <= 1 ? undefined : arguments[1];
20978
+ } else {
20979
+ throw new Error('Invalid arguments');
20980
+ }
20981
+
20982
+ if (!tableName || typeof tableName !== 'string') {
20983
+ throw new Error('Invalid arguments');
20984
+ }
20985
+
20986
+ if (!changes || (0, _typeof2["default"])(changes) !== 'object' || Array.isArray(changes)) {
20987
+ throw new Error('Invalid arguments');
20988
+ }
20989
+
20990
+ return this.addOperations(_constants.OperationType.UPSERT, tableName, changes);
20991
+ }
20683
20992
  /**
20684
20993
  * create(object: object): OpResult;
20685
20994
  * create(tableName: string, object: object): OpResult;
@@ -20808,6 +21117,29 @@ var UnitOfWork = /*#__PURE__*/function () {
20808
21117
 
20809
21118
  return this.addOperations(_constants.OperationType.DELETE, tableName, object);
20810
21119
  }
21120
+ /**
21121
+ * bulkUpsert(tableName: string, objects: object[]): OpResult;
21122
+ * bulkUpsert(objects: object[]): OpResult;
21123
+ * **/
21124
+
21125
+ }, {
21126
+ key: "bulkUpsert",
21127
+ value: function bulkUpsert(tableName, objects) {
21128
+ if (Array.isArray(tableName)) {
21129
+ objects = tableName;
21130
+ tableName = _utils["default"].getClassName(objects[0]);
21131
+ }
21132
+
21133
+ if (!objects || !Array.isArray(objects)) {
21134
+ throw new Error('Objects must be an array of objects.');
21135
+ }
21136
+
21137
+ if (!tableName || typeof tableName !== 'string') {
21138
+ throw new Error('Table Name must be a string.');
21139
+ }
21140
+
21141
+ return this.addOperations(_constants.OperationType.UPSERT_BULK, tableName, objects);
21142
+ }
20811
21143
  /**
20812
21144
  * bulkCreate(tableName: string, objects: object[]): OpResult;
20813
21145
  * bulkCreate(objects: object[]): OpResult;
@@ -21184,9 +21516,14 @@ var OperationJSONAdapter = {
21184
21516
  payload = _ref3.payload;
21185
21517
  return uow.update.call(uow, table, resolveOpResultValueReference(uow, payload));
21186
21518
  },
21187
- UPDATE_BULK: function UPDATE_BULK(uow, _ref4) {
21519
+ UPSERT: function UPSERT(uow, _ref4) {
21188
21520
  var table = _ref4.table,
21189
21521
  payload = _ref4.payload;
21522
+ return uow.upsert.call(uow, table, resolveOpResultValueReference(uow, payload));
21523
+ },
21524
+ UPDATE_BULK: function UPDATE_BULK(uow, _ref5) {
21525
+ var table = _ref5.table,
21526
+ payload = _ref5.payload;
21190
21527
  var args = baseBulkArgs(uow, {
21191
21528
  table: table,
21192
21529
  payload: payload
@@ -21194,55 +21531,60 @@ var OperationJSONAdapter = {
21194
21531
  args.push(resolveOpResultValueReference(uow, payload.changes));
21195
21532
  return uow.bulkUpdate.apply(uow, args);
21196
21533
  },
21197
- DELETE_BULK: function DELETE_BULK(uow, _ref5) {
21198
- var table = _ref5.table,
21199
- payload = _ref5.payload;
21534
+ DELETE_BULK: function DELETE_BULK(uow, _ref6) {
21535
+ var table = _ref6.table,
21536
+ payload = _ref6.payload;
21200
21537
  var args = baseBulkArgs(uow, {
21201
21538
  table: table,
21202
21539
  payload: payload
21203
21540
  });
21204
21541
  return uow.bulkDelete.apply(uow, args);
21205
21542
  },
21206
- CREATE_BULK: function CREATE_BULK(uow, _ref6) {
21207
- var table = _ref6.table,
21208
- payload = _ref6.payload;
21209
- return uow.bulkCreate.call(uow, table, resolveOpResultValueReference(uow, payload));
21210
- },
21211
- SET_RELATION: function SET_RELATION(uow, _ref7) {
21543
+ CREATE_BULK: function CREATE_BULK(uow, _ref7) {
21212
21544
  var table = _ref7.table,
21213
21545
  payload = _ref7.payload;
21546
+ return uow.bulkCreate.call(uow, table, resolveOpResultValueReference(uow, payload));
21547
+ },
21548
+ UPSERT_BULK: function UPSERT_BULK(uow, _ref8) {
21549
+ var table = _ref8.table,
21550
+ payload = _ref8.payload;
21551
+ return uow.bulkUpsert.call(uow, table, resolveOpResultValueReference(uow, payload));
21552
+ },
21553
+ SET_RELATION: function SET_RELATION(uow, _ref9) {
21554
+ var table = _ref9.table,
21555
+ payload = _ref9.payload;
21214
21556
  return updateRelations(uow, 'setRelation', {
21215
21557
  table: table,
21216
21558
  payload: payload
21217
21559
  });
21218
21560
  },
21219
- DELETE_RELATION: function DELETE_RELATION(uow, _ref8) {
21220
- var table = _ref8.table,
21221
- payload = _ref8.payload;
21561
+ DELETE_RELATION: function DELETE_RELATION(uow, _ref10) {
21562
+ var table = _ref10.table,
21563
+ payload = _ref10.payload;
21222
21564
  return updateRelations(uow, 'deleteRelation', {
21223
21565
  table: table,
21224
21566
  payload: payload
21225
21567
  });
21226
21568
  },
21227
- ADD_RELATION: function ADD_RELATION(uow, _ref9) {
21228
- var table = _ref9.table,
21229
- payload = _ref9.payload;
21569
+ ADD_RELATION: function ADD_RELATION(uow, _ref11) {
21570
+ var table = _ref11.table,
21571
+ payload = _ref11.payload;
21230
21572
  return updateRelations(uow, 'addToRelation', {
21231
21573
  table: table,
21232
21574
  payload: payload
21233
21575
  });
21234
21576
  },
21235
- FIND: function FIND(uow, _ref10) {
21236
- var table = _ref10.table,
21237
- payload = _ref10.payload;
21577
+ FIND: function FIND(uow, _ref12) {
21578
+ var table = _ref12.table,
21579
+ payload = _ref12.payload;
21238
21580
  return uow.addOperations(_constants.OperationType.FIND, table, payload);
21239
21581
  }
21240
21582
  };
21241
21583
  exports.OperationJSONAdapter = OperationJSONAdapter;
21242
21584
 
21243
- function baseBulkArgs(uow, _ref11) {
21244
- var table = _ref11.table,
21245
- payload = _ref11.payload;
21585
+ function baseBulkArgs(uow, _ref13) {
21586
+ var table = _ref13.table,
21587
+ payload = _ref13.payload;
21246
21588
  var args = [];
21247
21589
 
21248
21590
  if (payload.conditional) {
@@ -21262,9 +21604,9 @@ function baseBulkArgs(uow, _ref11) {
21262
21604
  return args;
21263
21605
  }
21264
21606
 
21265
- function updateRelations(uow, method, _ref12) {
21266
- var table = _ref12.table,
21267
- payload = _ref12.payload;
21607
+ function updateRelations(uow, method, _ref14) {
21608
+ var table = _ref14.table,
21609
+ payload = _ref14.payload;
21268
21610
  var args = [table];
21269
21611
 
21270
21612
  if (typeof payload.parentObject === 'string') {
@@ -21629,6 +21971,11 @@ var Urls = /*#__PURE__*/function () {
21629
21971
  value: function dataTable(tableName) {
21630
21972
  return "".concat(this.data(), "/").concat(tableName);
21631
21973
  }
21974
+ }, {
21975
+ key: "dataTableUpsert",
21976
+ value: function dataTableUpsert(tableName) {
21977
+ return "".concat(this.data(), "/").concat(tableName, "/upsert");
21978
+ }
21632
21979
  }, {
21633
21980
  key: "dataTableDeepSave",
21634
21981
  value: function dataTableDeepSave(tableName) {
@@ -21669,6 +22016,11 @@ var Urls = /*#__PURE__*/function () {
21669
22016
  value: function dataBulkTable(tableName) {
21670
22017
  return "".concat(this.data(), "/bulk/").concat(tableName);
21671
22018
  }
22019
+ }, {
22020
+ key: "dataBulkTableUpsert",
22021
+ value: function dataBulkTableUpsert(tableName) {
22022
+ return "".concat(this.data(), "/bulkupsert/").concat(tableName);
22023
+ }
21672
22024
  }, {
21673
22025
  key: "dataBulkTableDelete",
21674
22026
  value: function dataBulkTableDelete(tableName) {
@@ -21801,6 +22153,16 @@ var Urls = /*#__PURE__*/function () {
21801
22153
  key: "fileBinaryPath",
21802
22154
  value: function fileBinaryPath(path) {
21803
22155
  return "".concat(this.files(), "/binary/").concat(path);
22156
+ }
22157
+ }, {
22158
+ key: "fileAppendPath",
22159
+ value: function fileAppendPath(path) {
22160
+ return "".concat(this.files(), "/append/").concat(path);
22161
+ }
22162
+ }, {
22163
+ key: "fileAppendBinaryPath",
22164
+ value: function fileAppendBinaryPath(path) {
22165
+ return "".concat(this.files(), "/append/binary/").concat(path);
21804
22166
  } //users
21805
22167
 
21806
22168
  }, {