backendless 6.2.25 → 6.3.3
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/backendless.d.ts +48 -6
- package/dist/backendless.js +473 -100
- package/dist/backendless.js.map +1 -1
- package/dist/backendless.min.js +2 -2
- package/es/data/rt-handlers.js +42 -2
- package/es/data/store.js +81 -34
- package/es/index.js +63 -11
- package/es/local-cache/index.js +1 -1
- package/es/messaging/helpers/email-envelope.js +22 -0
- package/es/messaging/index.js +6 -2
- package/es/rt.js +53 -5
- package/es/unit-of-work/constants.js +2 -0
- package/es/unit-of-work/index.js +54 -0
- package/es/unit-of-work/json-adapter.js +35 -25
- package/es/urls.js +10 -0
- package/lib/data/rt-handlers.js +42 -2
- package/lib/data/store.js +81 -34
- package/lib/index.js +63 -11
- package/lib/local-cache/index.js +1 -1
- package/lib/messaging/helpers/email-envelope.js +22 -0
- package/lib/messaging/index.js +6 -2
- package/lib/rt.js +53 -5
- package/lib/unit-of-work/constants.js +2 -0
- package/lib/unit-of-work/index.js +54 -0
- package/lib/unit-of-work/json-adapter.js +35 -25
- package/lib/urls.js +10 -0
- package/package.json +2 -2
- package/src/data/rt-handlers.js +42 -7
- package/src/data/store.js +27 -2
- package/src/index.js +60 -11
- package/src/local-cache/index.js +1 -1
- package/src/messaging/helpers/email-envelope.js +20 -0
- package/src/messaging/index.js +5 -1
- package/src/rt.js +20 -3
- package/src/unit-of-work/constants.js +2 -0
- package/src/unit-of-work/index.js +51 -1
- package/src/unit-of-work/json-adapter.js +6 -0
- package/src/urls.js +8 -0
package/es/data/rt-handlers.js
CHANGED
|
@@ -29,16 +29,18 @@ var ChangesTypes = {
|
|
|
29
29
|
CREATED: 'created',
|
|
30
30
|
UPDATED: 'updated',
|
|
31
31
|
DELETED: 'deleted',
|
|
32
|
+
UPSERTED: 'upserted',
|
|
32
33
|
BULK_CREATED: 'bulk-created',
|
|
33
34
|
BULK_UPDATED: 'bulk-updated',
|
|
34
|
-
BULK_DELETED: 'bulk-deleted'
|
|
35
|
+
BULK_DELETED: 'bulk-deleted',
|
|
36
|
+
BULK_UPSERTED: 'bulk-upserted'
|
|
35
37
|
};
|
|
36
38
|
var RelationsChangesTypes = {
|
|
37
39
|
ADD: 'add',
|
|
38
40
|
SET: 'set',
|
|
39
41
|
DELETE: 'delete'
|
|
40
42
|
};
|
|
41
|
-
var SingleChangesTypes = [ChangesTypes.CREATED, ChangesTypes.UPDATED, ChangesTypes.DELETED];
|
|
43
|
+
var SingleChangesTypes = [ChangesTypes.CREATED, ChangesTypes.UPDATED, ChangesTypes.DELETED, ChangesTypes.UPSERTED];
|
|
42
44
|
|
|
43
45
|
var RTHandlers = /*#__PURE__*/function (_RTListeners) {
|
|
44
46
|
(0, _inherits2["default"])(RTHandlers, _RTListeners);
|
|
@@ -81,6 +83,25 @@ var RTHandlers = /*#__PURE__*/function (_RTListeners) {
|
|
|
81
83
|
|
|
82
84
|
this.removeCreateListeners(undefined, callback);
|
|
83
85
|
}
|
|
86
|
+
}, {
|
|
87
|
+
key: "addUpsertListener",
|
|
88
|
+
value: function addUpsertListener(whereClause, callback, onError) {
|
|
89
|
+
this.addChangesListener(ChangesTypes.UPSERTED, whereClause, callback, onError);
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
key: "removeUpsertListeners",
|
|
93
|
+
value: function removeUpsertListeners(whereClause, callback) {
|
|
94
|
+
this.removeChangesListeners(ChangesTypes.UPSERTED, whereClause, callback);
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "removeUpsertListener",
|
|
98
|
+
value: function removeUpsertListener(callback) {
|
|
99
|
+
if (!callback || typeof callback !== 'function') {
|
|
100
|
+
throw new Error('Listener Function must be passed.');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
this.removeUpsertListeners(undefined, callback);
|
|
104
|
+
}
|
|
84
105
|
}, {
|
|
85
106
|
key: "addUpdateListener",
|
|
86
107
|
value: function addUpdateListener(whereClause, callback, onError) {
|
|
@@ -176,6 +197,25 @@ var RTHandlers = /*#__PURE__*/function (_RTListeners) {
|
|
|
176
197
|
|
|
177
198
|
this.removeBulkDeleteListeners(undefined, callback);
|
|
178
199
|
}
|
|
200
|
+
}, {
|
|
201
|
+
key: "addBulkUpsertListener",
|
|
202
|
+
value: function addBulkUpsertListener(whereClause, callback, onError) {
|
|
203
|
+
this.addChangesListener(ChangesTypes.BULK_UPSERTED, whereClause, callback, onError);
|
|
204
|
+
}
|
|
205
|
+
}, {
|
|
206
|
+
key: "removeBulkUpsertListeners",
|
|
207
|
+
value: function removeBulkUpsertListeners() {
|
|
208
|
+
this.removeChangesListeners(ChangesTypes.BULK_UPSERTED);
|
|
209
|
+
}
|
|
210
|
+
}, {
|
|
211
|
+
key: "removeBulkUpsertListener",
|
|
212
|
+
value: function removeBulkUpsertListener(callback) {
|
|
213
|
+
if (!callback || typeof callback !== 'function') {
|
|
214
|
+
throw new Error('Listener Function must be passed.');
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
this.removeChangesListeners(ChangesTypes.BULK_UPSERTED, undefined, callback);
|
|
218
|
+
}
|
|
179
219
|
}, {
|
|
180
220
|
key: "addSetRelationListener",
|
|
181
221
|
value: function addSetRelationListener(relationColumnName, parentObjects, callback, onError) {
|
package/es/data/store.js
CHANGED
|
@@ -89,21 +89,23 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
89
89
|
}, {
|
|
90
90
|
key: "save",
|
|
91
91
|
value: function () {
|
|
92
|
-
var _save = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(object) {
|
|
92
|
+
var _save = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(object, isUpsert) {
|
|
93
93
|
var _this = this;
|
|
94
94
|
|
|
95
|
+
var url;
|
|
95
96
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
96
97
|
while (1) {
|
|
97
98
|
switch (_context.prev = _context.next) {
|
|
98
99
|
case 0:
|
|
100
|
+
url = isUpsert ? this.app.urls.dataTableUpsert(this.className) : this.app.urls.dataTable(this.className);
|
|
99
101
|
return _context.abrupt("return", this.app.request.put({
|
|
100
|
-
url:
|
|
102
|
+
url: url,
|
|
101
103
|
data: convertToServerRecord(object)
|
|
102
104
|
}).then(function (result) {
|
|
103
105
|
return _this.parseResponse(result);
|
|
104
106
|
}));
|
|
105
107
|
|
|
106
|
-
case
|
|
108
|
+
case 2:
|
|
107
109
|
case "end":
|
|
108
110
|
return _context.stop();
|
|
109
111
|
}
|
|
@@ -111,7 +113,7 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
111
113
|
}, _callee, this);
|
|
112
114
|
}));
|
|
113
115
|
|
|
114
|
-
function save(_x) {
|
|
116
|
+
function save(_x, _x2) {
|
|
115
117
|
return _save.apply(this, arguments);
|
|
116
118
|
}
|
|
117
119
|
|
|
@@ -142,7 +144,7 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
142
144
|
}, _callee2, this);
|
|
143
145
|
}));
|
|
144
146
|
|
|
145
|
-
function deepSave(
|
|
147
|
+
function deepSave(_x3) {
|
|
146
148
|
return _deepSave.apply(this, arguments);
|
|
147
149
|
}
|
|
148
150
|
|
|
@@ -179,7 +181,7 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
179
181
|
}, _callee3, this);
|
|
180
182
|
}));
|
|
181
183
|
|
|
182
|
-
function remove(
|
|
184
|
+
function remove(_x4) {
|
|
183
185
|
return _remove.apply(this, arguments);
|
|
184
186
|
}
|
|
185
187
|
|
|
@@ -210,7 +212,7 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
210
212
|
}, _callee4, this);
|
|
211
213
|
}));
|
|
212
214
|
|
|
213
|
-
function find(
|
|
215
|
+
function find(_x5) {
|
|
214
216
|
return _find.apply(this, arguments);
|
|
215
217
|
}
|
|
216
218
|
|
|
@@ -237,7 +239,7 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
237
239
|
}, _callee5, this);
|
|
238
240
|
}));
|
|
239
241
|
|
|
240
|
-
function group(
|
|
242
|
+
function group(_x6) {
|
|
241
243
|
return _group.apply(this, arguments);
|
|
242
244
|
}
|
|
243
245
|
|
|
@@ -272,7 +274,7 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
272
274
|
}, _callee6, this);
|
|
273
275
|
}));
|
|
274
276
|
|
|
275
|
-
function countInGroup(
|
|
277
|
+
function countInGroup(_x7) {
|
|
276
278
|
return _countInGroup.apply(this, arguments);
|
|
277
279
|
}
|
|
278
280
|
|
|
@@ -340,7 +342,7 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
340
342
|
}, _callee7, this);
|
|
341
343
|
}));
|
|
342
344
|
|
|
343
|
-
function findById(
|
|
345
|
+
function findById(_x8, _x9) {
|
|
344
346
|
return _findById.apply(this, arguments);
|
|
345
347
|
}
|
|
346
348
|
|
|
@@ -371,7 +373,7 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
371
373
|
}, _callee8, this);
|
|
372
374
|
}));
|
|
373
375
|
|
|
374
|
-
function findFirst(
|
|
376
|
+
function findFirst(_x10) {
|
|
375
377
|
return _findFirst.apply(this, arguments);
|
|
376
378
|
}
|
|
377
379
|
|
|
@@ -402,7 +404,7 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
402
404
|
}, _callee9, this);
|
|
403
405
|
}));
|
|
404
406
|
|
|
405
|
-
function findLast(
|
|
407
|
+
function findLast(_x11) {
|
|
406
408
|
return _findLast.apply(this, arguments);
|
|
407
409
|
}
|
|
408
410
|
|
|
@@ -459,7 +461,7 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
459
461
|
}, _callee10, this);
|
|
460
462
|
}));
|
|
461
463
|
|
|
462
|
-
function getObjectCount(
|
|
464
|
+
function getObjectCount(_x12) {
|
|
463
465
|
return _getObjectCount.apply(this, arguments);
|
|
464
466
|
}
|
|
465
467
|
|
|
@@ -512,7 +514,7 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
512
514
|
}, _callee11, this);
|
|
513
515
|
}));
|
|
514
516
|
|
|
515
|
-
function loadRelations(
|
|
517
|
+
function loadRelations(_x13, _x14) {
|
|
516
518
|
return _loadRelations.apply(this, arguments);
|
|
517
519
|
}
|
|
518
520
|
|
|
@@ -536,7 +538,7 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
536
538
|
}, _callee12, this);
|
|
537
539
|
}));
|
|
538
540
|
|
|
539
|
-
function setRelation(
|
|
541
|
+
function setRelation(_x15, _x16, _x17) {
|
|
540
542
|
return _setRelation.apply(this, arguments);
|
|
541
543
|
}
|
|
542
544
|
|
|
@@ -560,7 +562,7 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
560
562
|
}, _callee13, this);
|
|
561
563
|
}));
|
|
562
564
|
|
|
563
|
-
function addRelation(
|
|
565
|
+
function addRelation(_x18, _x19, _x20) {
|
|
564
566
|
return _addRelation.apply(this, arguments);
|
|
565
567
|
}
|
|
566
568
|
|
|
@@ -584,7 +586,7 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
584
586
|
}, _callee14, this);
|
|
585
587
|
}));
|
|
586
588
|
|
|
587
|
-
function deleteRelation(
|
|
589
|
+
function deleteRelation(_x21, _x22, _x23) {
|
|
588
590
|
return _deleteRelation.apply(this, arguments);
|
|
589
591
|
}
|
|
590
592
|
|
|
@@ -629,22 +631,67 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
629
631
|
}, _callee15, this);
|
|
630
632
|
}));
|
|
631
633
|
|
|
632
|
-
function bulkCreate(
|
|
634
|
+
function bulkCreate(_x24) {
|
|
633
635
|
return _bulkCreate.apply(this, arguments);
|
|
634
636
|
}
|
|
635
637
|
|
|
636
638
|
return bulkCreate;
|
|
637
639
|
}()
|
|
638
640
|
}, {
|
|
639
|
-
key: "
|
|
641
|
+
key: "bulkUpsert",
|
|
640
642
|
value: function () {
|
|
641
|
-
var
|
|
643
|
+
var _bulkUpsert = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(objects) {
|
|
644
|
+
var errorMessage;
|
|
642
645
|
return _regenerator["default"].wrap(function _callee16$(_context16) {
|
|
643
646
|
while (1) {
|
|
644
647
|
switch (_context16.prev = _context16.next) {
|
|
648
|
+
case 0:
|
|
649
|
+
errorMessage = 'Objects must be provided and must be an array of objects.';
|
|
650
|
+
|
|
651
|
+
if (!(!objects || !Array.isArray(objects) || !objects.length)) {
|
|
652
|
+
_context16.next = 3;
|
|
653
|
+
break;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
throw new Error(errorMessage);
|
|
657
|
+
|
|
658
|
+
case 3:
|
|
659
|
+
objects = objects.map(function (object) {
|
|
660
|
+
if (!object || (0, _typeof2["default"])(object) !== 'object' || Array.isArray(object)) {
|
|
661
|
+
throw new Error(errorMessage);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
return object;
|
|
665
|
+
});
|
|
666
|
+
return _context16.abrupt("return", this.app.request.put({
|
|
667
|
+
url: this.app.urls.dataBulkTableUpsert(this.className),
|
|
668
|
+
data: objects
|
|
669
|
+
}));
|
|
670
|
+
|
|
671
|
+
case 5:
|
|
672
|
+
case "end":
|
|
673
|
+
return _context16.stop();
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}, _callee16, this);
|
|
677
|
+
}));
|
|
678
|
+
|
|
679
|
+
function bulkUpsert(_x25) {
|
|
680
|
+
return _bulkUpsert.apply(this, arguments);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
return bulkUpsert;
|
|
684
|
+
}()
|
|
685
|
+
}, {
|
|
686
|
+
key: "bulkUpdate",
|
|
687
|
+
value: function () {
|
|
688
|
+
var _bulkUpdate = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee17(condition, changes) {
|
|
689
|
+
return _regenerator["default"].wrap(function _callee17$(_context17) {
|
|
690
|
+
while (1) {
|
|
691
|
+
switch (_context17.prev = _context17.next) {
|
|
645
692
|
case 0:
|
|
646
693
|
if (!(!condition || typeof condition !== 'string')) {
|
|
647
|
-
|
|
694
|
+
_context17.next = 2;
|
|
648
695
|
break;
|
|
649
696
|
}
|
|
650
697
|
|
|
@@ -652,14 +699,14 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
652
699
|
|
|
653
700
|
case 2:
|
|
654
701
|
if (!(!changes || (0, _typeof2["default"])(changes) !== 'object' || Array.isArray(changes))) {
|
|
655
|
-
|
|
702
|
+
_context17.next = 4;
|
|
656
703
|
break;
|
|
657
704
|
}
|
|
658
705
|
|
|
659
706
|
throw new Error('Changes must be provided and must be an object.');
|
|
660
707
|
|
|
661
708
|
case 4:
|
|
662
|
-
return
|
|
709
|
+
return _context17.abrupt("return", this.app.request.put({
|
|
663
710
|
url: this.app.urls.dataBulkTable(this.className),
|
|
664
711
|
query: {
|
|
665
712
|
where: condition
|
|
@@ -669,13 +716,13 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
669
716
|
|
|
670
717
|
case 5:
|
|
671
718
|
case "end":
|
|
672
|
-
return
|
|
719
|
+
return _context17.stop();
|
|
673
720
|
}
|
|
674
721
|
}
|
|
675
|
-
},
|
|
722
|
+
}, _callee17, this);
|
|
676
723
|
}));
|
|
677
724
|
|
|
678
|
-
function bulkUpdate(
|
|
725
|
+
function bulkUpdate(_x26, _x27) {
|
|
679
726
|
return _bulkUpdate.apply(this, arguments);
|
|
680
727
|
}
|
|
681
728
|
|
|
@@ -684,14 +731,14 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
684
731
|
}, {
|
|
685
732
|
key: "bulkDelete",
|
|
686
733
|
value: function () {
|
|
687
|
-
var _bulkDelete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
734
|
+
var _bulkDelete = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee18(condition) {
|
|
688
735
|
var queryData, objectIds;
|
|
689
|
-
return _regenerator["default"].wrap(function
|
|
736
|
+
return _regenerator["default"].wrap(function _callee18$(_context18) {
|
|
690
737
|
while (1) {
|
|
691
|
-
switch (
|
|
738
|
+
switch (_context18.prev = _context18.next) {
|
|
692
739
|
case 0:
|
|
693
740
|
if (!(!condition || typeof condition !== 'string' && !Array.isArray(condition))) {
|
|
694
|
-
|
|
741
|
+
_context18.next = 2;
|
|
695
742
|
break;
|
|
696
743
|
}
|
|
697
744
|
|
|
@@ -715,20 +762,20 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
715
762
|
queryData.where = "objectId in (".concat(objectIds.join(','), ")");
|
|
716
763
|
}
|
|
717
764
|
|
|
718
|
-
return
|
|
765
|
+
return _context18.abrupt("return", this.app.request.post({
|
|
719
766
|
url: this.app.urls.dataBulkTableDelete(this.className),
|
|
720
767
|
data: queryData
|
|
721
768
|
}));
|
|
722
769
|
|
|
723
770
|
case 5:
|
|
724
771
|
case "end":
|
|
725
|
-
return
|
|
772
|
+
return _context18.stop();
|
|
726
773
|
}
|
|
727
774
|
}
|
|
728
|
-
},
|
|
775
|
+
}, _callee18, this);
|
|
729
776
|
}));
|
|
730
777
|
|
|
731
|
-
function bulkDelete(
|
|
778
|
+
function bulkDelete(_x28) {
|
|
732
779
|
return _bulkDelete.apply(this, arguments);
|
|
733
780
|
}
|
|
734
781
|
|
package/es/index.js
CHANGED
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
10
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
13
|
|
|
12
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -21,6 +23,10 @@ var _urls = _interopRequireDefault(require("./urls"));
|
|
|
21
23
|
|
|
22
24
|
var _utils = _interopRequireDefault(require("./utils"));
|
|
23
25
|
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
+
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
29
|
+
|
|
24
30
|
var DEFAULT_PROPS = {
|
|
25
31
|
appId: null,
|
|
26
32
|
apiKey: null,
|
|
@@ -71,6 +77,14 @@ var parseInitConfig = function parseInitConfig() {
|
|
|
71
77
|
};
|
|
72
78
|
};
|
|
73
79
|
|
|
80
|
+
var validateConfig = function validateConfig(config) {
|
|
81
|
+
if (config.domain) {
|
|
82
|
+
if (!config.domain.startsWith('https://') && !config.domain.startsWith('http://')) {
|
|
83
|
+
throw new Error('When initialize the SDK with a custom domain it should start with http:// or https://, ' + 'for example: Backendless.initApp(\'https://foobar.com\')');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
74
88
|
var SERVICES = {
|
|
75
89
|
'Logging': function Logging() {
|
|
76
90
|
return require('./logging')["default"];
|
|
@@ -129,6 +143,13 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
129
143
|
(0, _createClass2["default"])(Backendless, [{
|
|
130
144
|
key: "initConfig",
|
|
131
145
|
value: function initConfig(config) {
|
|
146
|
+
config = _objectSpread({}, config);
|
|
147
|
+
|
|
148
|
+
if (config.domain) {
|
|
149
|
+
delete config.appId;
|
|
150
|
+
delete config.apiKey;
|
|
151
|
+
}
|
|
152
|
+
|
|
132
153
|
for (var key in DEFAULT_PROPS) {
|
|
133
154
|
if (DEFAULT_PROPS.hasOwnProperty(key)) {
|
|
134
155
|
var privateKey = "__".concat(key);
|
|
@@ -144,7 +165,7 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
144
165
|
}
|
|
145
166
|
/**
|
|
146
167
|
* @param {string|Object} appId|domain|config
|
|
147
|
-
* @param {string} [
|
|
168
|
+
* @param {string} [apiKey]
|
|
148
169
|
* @returns {Backendless}
|
|
149
170
|
*/
|
|
150
171
|
|
|
@@ -152,6 +173,7 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
152
173
|
key: "initApp",
|
|
153
174
|
value: function initApp() {
|
|
154
175
|
var config = parseInitConfig.apply(void 0, arguments);
|
|
176
|
+
validateConfig(config);
|
|
155
177
|
var app = config.standalone ? new Backendless(this) : this;
|
|
156
178
|
app.initConfig(config);
|
|
157
179
|
app.resetRT();
|
|
@@ -200,24 +222,22 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
200
222
|
},
|
|
201
223
|
set: function set(standalone) {
|
|
202
224
|
throw new Error('Setting value to Backendless.standalone directly is not possible, ' + "instead you must use Backendless.initApp({ appId: [APP_ID], apiKey: [API_KEY], standalone: ".concat(standalone, " })"));
|
|
203
|
-
}
|
|
204
|
-
|
|
225
|
+
}
|
|
205
226
|
}, {
|
|
206
|
-
key: "
|
|
227
|
+
key: "appId",
|
|
207
228
|
get: function get() {
|
|
208
229
|
return this.__appId;
|
|
209
230
|
},
|
|
210
231
|
set: function set(appId) {
|
|
211
|
-
throw new Error("Setting '".concat(appId, "' value to Backendless.
|
|
212
|
-
}
|
|
213
|
-
|
|
232
|
+
throw new Error("Setting '".concat(appId, "' value to Backendless.appId directly is not possible, ") + "instead you must use Backendless.initApp('".concat(appId, "', API_KEY)"));
|
|
233
|
+
}
|
|
214
234
|
}, {
|
|
215
|
-
key: "
|
|
235
|
+
key: "apiKey",
|
|
216
236
|
get: function get() {
|
|
217
237
|
return this.__apiKey;
|
|
218
238
|
},
|
|
219
239
|
set: function set(apiKey) {
|
|
220
|
-
throw new Error("Setting '".concat(apiKey, "' value to Backendless.
|
|
240
|
+
throw new Error("Setting '".concat(apiKey, "' value to Backendless.apiKey directly is not possible, ") + "instead you must use Backendless.initApp(APP_ID, '".concat(apiKey, "')"));
|
|
221
241
|
} ///--------serverURL-------///
|
|
222
242
|
|
|
223
243
|
}, {
|
|
@@ -254,7 +274,7 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
254
274
|
return this.domain + this.apiURI;
|
|
255
275
|
}
|
|
256
276
|
|
|
257
|
-
return [this.serverURL, this.
|
|
277
|
+
return [this.serverURL, this.appId, this.apiKey].join('/');
|
|
258
278
|
},
|
|
259
279
|
set: function set(appPath) {
|
|
260
280
|
throw new Error("Setting '".concat(appPath, "' value to Backendless.appPath directly is not possible, ") + 'instead you must use Backendless.initApp(APP_ID, API_KEY) for setup the value');
|
|
@@ -439,10 +459,42 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
439
459
|
///-------------------------------------///
|
|
440
460
|
///-------------------------------------///
|
|
441
461
|
///--------BACKWARD COMPATIBILITY-------///
|
|
442
|
-
//TODO: do we need to remove it?
|
|
443
462
|
|
|
444
463
|
/** @deprecated */
|
|
445
464
|
|
|
465
|
+
}, {
|
|
466
|
+
key: "applicationId",
|
|
467
|
+
get: function get() {
|
|
468
|
+
// eslint-disable-next-line no-console
|
|
469
|
+
// temporary comment it because it breaks JS-CodeRunner version less than 6.3.0
|
|
470
|
+
// console.warn('getter/setter for Backendless.applicationId is deprecated, instead use Backendless.appId')
|
|
471
|
+
return this.appId;
|
|
472
|
+
}
|
|
473
|
+
/** @deprecated */
|
|
474
|
+
,
|
|
475
|
+
set: function set(appId) {
|
|
476
|
+
// eslint-disable-next-line no-console
|
|
477
|
+
console.warn('getter/setter for Backendless.applicationId is deprecated, instead use Backendless.appId');
|
|
478
|
+
this.appId = appId;
|
|
479
|
+
}
|
|
480
|
+
/** @deprecated */
|
|
481
|
+
|
|
482
|
+
}, {
|
|
483
|
+
key: "secretKey",
|
|
484
|
+
get: function get() {
|
|
485
|
+
// eslint-disable-next-line no-console
|
|
486
|
+
console.warn('getter/setter for Backendless.secretKey is deprecated, instead use Backendless.apiKey');
|
|
487
|
+
return this.apiKey;
|
|
488
|
+
}
|
|
489
|
+
/** @deprecated */
|
|
490
|
+
,
|
|
491
|
+
set: function set(apiKey) {
|
|
492
|
+
// eslint-disable-next-line no-console
|
|
493
|
+
console.warn('getter/setter for Backendless.secretKey is deprecated, instead use Backendless.apiKey');
|
|
494
|
+
this.apiKey = apiKey;
|
|
495
|
+
}
|
|
496
|
+
/** @deprecated */
|
|
497
|
+
|
|
446
498
|
}, {
|
|
447
499
|
key: "Persistence",
|
|
448
500
|
get: function get() {
|
package/es/local-cache/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var LocalCache = /*#__PURE__*/function () {
|
|
|
23
23
|
function LocalCache(app) {
|
|
24
24
|
(0, _classCallCheck2["default"])(this, LocalCache);
|
|
25
25
|
this.app = app;
|
|
26
|
-
this.storageName = "".concat(STORAGE_KEY_NAMESPACE, "_").concat(this.app.
|
|
26
|
+
this.storageName = "".concat(STORAGE_KEY_NAMESPACE, "_").concat(this.app.appId);
|
|
27
27
|
var Storage = _utils["default"].isLocalStorageSupported ? _localStorage["default"] : _virtualStorage["default"];
|
|
28
28
|
this.setStorage(Storage);
|
|
29
29
|
this.Keys = {
|
|
@@ -21,6 +21,7 @@ var EmailEnvelope = /*#__PURE__*/function () {
|
|
|
21
21
|
this.ccAddresses = _utils["default"].castArray(data.ccAddresses);
|
|
22
22
|
this.bccAddresses = _utils["default"].castArray(data.bccAddresses);
|
|
23
23
|
this.query = data.query || null;
|
|
24
|
+
this.uniqueEmails = data.uniqueEmails || false;
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
27
|
*
|
|
@@ -147,6 +148,26 @@ var EmailEnvelope = /*#__PURE__*/function () {
|
|
|
147
148
|
value: function getQuery() {
|
|
148
149
|
return this.query;
|
|
149
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* @param {boolean} uniqueEmails
|
|
153
|
+
* @returns {EmailEnvelope}
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
}, {
|
|
157
|
+
key: "setUniqueEmails",
|
|
158
|
+
value: function setUniqueEmails(uniqueEmails) {
|
|
159
|
+
this.uniqueEmails = uniqueEmails;
|
|
160
|
+
return this;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* @returns {uniqueEmails|boolean}
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
}, {
|
|
167
|
+
key: "getUniqueEmails",
|
|
168
|
+
value: function getUniqueEmails() {
|
|
169
|
+
return this.uniqueEmails;
|
|
170
|
+
}
|
|
150
171
|
}, {
|
|
151
172
|
key: "toJSON",
|
|
152
173
|
value: function toJSON() {
|
|
@@ -168,6 +189,7 @@ var EmailEnvelope = /*#__PURE__*/function () {
|
|
|
168
189
|
data.criteria = this.query;
|
|
169
190
|
}
|
|
170
191
|
|
|
192
|
+
data.uniqueEmails = this.uniqueEmails;
|
|
171
193
|
return data;
|
|
172
194
|
}
|
|
173
195
|
}], [{
|
package/es/messaging/index.js
CHANGED
|
@@ -247,10 +247,14 @@ var Messaging = /*#__PURE__*/function () {
|
|
|
247
247
|
data = envelopeObject.toJSON();
|
|
248
248
|
data['template-name'] = templateName;
|
|
249
249
|
|
|
250
|
-
if (templateValues) {
|
|
250
|
+
if (templateValues && !Array.isArray(templateValues)) {
|
|
251
251
|
data['template-values'] = templateValues;
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
+
if (Array.isArray(templateValues) && !attachments) {
|
|
255
|
+
attachments = templateValues;
|
|
256
|
+
}
|
|
257
|
+
|
|
254
258
|
if (attachments) {
|
|
255
259
|
data.attachment = attachments;
|
|
256
260
|
}
|
|
@@ -260,7 +264,7 @@ var Messaging = /*#__PURE__*/function () {
|
|
|
260
264
|
data: data
|
|
261
265
|
}));
|
|
262
266
|
|
|
263
|
-
case
|
|
267
|
+
case 10:
|
|
264
268
|
case "end":
|
|
265
269
|
return _context4.stop();
|
|
266
270
|
}
|