backendless 6.7.0 → 6.7.1-dev.2
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 +5 -0
- package/dist/backendless.js +20966 -23929
- package/dist/backendless.js.map +1 -1
- package/dist/backendless.min.js +2 -2
- package/es/bl/constants.js +0 -2
- package/es/bl/custom-services.js +40 -65
- package/es/bl/events.js +30 -52
- package/es/bl/index.js +3 -9
- package/es/cache/index.js +125 -189
- package/es/commerce/index.js +78 -119
- package/es/counters/counter.js +0 -8
- package/es/counters/index.js +171 -258
- package/es/data/data-query-builder.js +2 -39
- package/es/data/geo/geo-constructor.js +5 -26
- package/es/data/geo/geo-json-parser.js +0 -7
- package/es/data/geo/geometry.js +4 -13
- package/es/data/geo/linestring.js +4 -21
- package/es/data/geo/point.js +4 -22
- package/es/data/geo/polygon.js +4 -30
- package/es/data/geo/spatial-reference-system.js +1 -7
- package/es/data/geo/wkt-parser.js +0 -10
- package/es/data/geo/wkt-to-geojson.js +4 -44
- package/es/data/group-query-builder.js +0 -23
- package/es/data/index.js +17 -54
- package/es/data/json-update-builder.js +0 -18
- package/es/data/load-relations-query-builder.js +0 -16
- package/es/data/persmission.js +0 -16
- package/es/data/rt-handlers.js +1 -46
- package/es/data/store.js +316 -518
- package/es/decorators/deprecated.js +2 -5
- package/es/decorators/index.js +0 -2
- package/es/device/index.js +3 -8
- package/es/expression.js +29 -0
- package/es/files/index.js +354 -493
- package/es/files/persmission.js +0 -15
- package/es/files/utils.js +32 -55
- package/es/hive/index.js +1 -13
- package/es/hive/stores/base-store.js +14 -50
- package/es/hive/stores/index.js +0 -10
- package/es/hive/stores/key-value.js +4 -37
- package/es/hive/stores/list.js +0 -32
- package/es/hive/stores/map.js +0 -34
- package/es/hive/stores/set.js +0 -29
- package/es/hive/stores/sorted-set.js +19 -94
- package/es/hive/utils.js +0 -2
- package/es/index.js +51 -71
- package/es/local-cache/index.js +0 -10
- package/es/local-cache/local-storage.js +1 -9
- package/es/local-cache/virtual-storage.js +0 -6
- package/es/logging/index.js +21 -46
- package/es/logging/logger.js +0 -6
- package/es/management/data.js +0 -8
- package/es/management/index.js +3 -7
- package/es/messaging/channel/index.js +0 -27
- package/es/messaging/helpers/body-parts.js +3 -6
- package/es/messaging/helpers/delivery-options.js +3 -6
- package/es/messaging/helpers/email-envelope.js +13 -25
- package/es/messaging/helpers/index.js +10 -16
- package/es/messaging/helpers/publish-options.js +3 -6
- package/es/messaging/index.js +213 -317
- package/es/persmission.js +7 -16
- package/es/request/index.js +2 -16
- package/es/rso/connection.js +3 -34
- package/es/rso/index.js +0 -7
- package/es/rt.js +21 -52
- package/es/unit-of-work/constants.js +1 -1
- package/es/unit-of-work/index.js +27 -145
- package/es/unit-of-work/json-adapter.js +14 -35
- package/es/unit-of-work/op-result-value-reference.js +1 -11
- package/es/unit-of-work/op-result.js +2 -13
- package/es/urls.js +18 -15
- package/es/user-agent.js +0 -7
- package/es/users/index.js +345 -552
- package/es/users/roles.js +79 -128
- package/es/users/social/container.js +0 -16
- package/es/users/social/index.js +166 -250
- package/es/users/user.js +2 -9
- package/es/users/utils.js +0 -3
- package/es/utils.js +0 -17
- package/lib/bl/constants.js +0 -2
- package/lib/bl/custom-services.js +40 -65
- package/lib/bl/events.js +30 -52
- package/lib/bl/index.js +3 -9
- package/lib/cache/index.js +125 -189
- package/lib/commerce/index.js +78 -119
- package/lib/counters/counter.js +0 -8
- package/lib/counters/index.js +171 -258
- package/lib/data/data-query-builder.js +2 -39
- package/lib/data/geo/geo-constructor.js +5 -26
- package/lib/data/geo/geo-json-parser.js +0 -7
- package/lib/data/geo/geometry.js +4 -13
- package/lib/data/geo/linestring.js +4 -21
- package/lib/data/geo/point.js +4 -22
- package/lib/data/geo/polygon.js +4 -30
- package/lib/data/geo/spatial-reference-system.js +1 -7
- package/lib/data/geo/wkt-parser.js +0 -10
- package/lib/data/geo/wkt-to-geojson.js +4 -44
- package/lib/data/group-query-builder.js +0 -23
- package/lib/data/index.js +17 -54
- package/lib/data/json-update-builder.js +0 -18
- package/lib/data/load-relations-query-builder.js +0 -16
- package/lib/data/persmission.js +0 -16
- package/lib/data/rt-handlers.js +1 -46
- package/lib/data/store.js +316 -518
- package/lib/decorators/deprecated.js +2 -5
- package/lib/decorators/index.js +0 -2
- package/lib/device/index.js +3 -8
- package/lib/expression.js +29 -0
- package/lib/files/index.js +354 -493
- package/lib/files/persmission.js +0 -15
- package/lib/files/utils.js +32 -55
- package/lib/hive/index.js +1 -13
- package/lib/hive/stores/base-store.js +14 -50
- package/lib/hive/stores/index.js +0 -10
- package/lib/hive/stores/key-value.js +4 -37
- package/lib/hive/stores/list.js +0 -32
- package/lib/hive/stores/map.js +0 -34
- package/lib/hive/stores/set.js +0 -29
- package/lib/hive/stores/sorted-set.js +19 -94
- package/lib/hive/utils.js +0 -2
- package/lib/index.js +51 -71
- package/lib/local-cache/index.js +0 -10
- package/lib/local-cache/local-storage.js +1 -9
- package/lib/local-cache/virtual-storage.js +0 -6
- package/lib/logging/index.js +21 -46
- package/lib/logging/logger.js +0 -6
- package/lib/management/data.js +0 -8
- package/lib/management/index.js +3 -7
- package/lib/messaging/channel/index.js +0 -27
- package/lib/messaging/helpers/body-parts.js +3 -6
- package/lib/messaging/helpers/delivery-options.js +3 -6
- package/lib/messaging/helpers/email-envelope.js +13 -25
- package/lib/messaging/helpers/index.js +10 -16
- package/lib/messaging/helpers/publish-options.js +3 -6
- package/lib/messaging/index.js +213 -317
- package/lib/persmission.js +7 -16
- package/lib/request/index.js +2 -16
- package/lib/rso/connection.js +3 -34
- package/lib/rso/index.js +0 -7
- package/lib/rt.js +21 -52
- package/lib/unit-of-work/constants.js +1 -1
- package/lib/unit-of-work/index.js +27 -145
- package/lib/unit-of-work/json-adapter.js +14 -35
- package/lib/unit-of-work/op-result-value-reference.js +1 -11
- package/lib/unit-of-work/op-result.js +2 -13
- package/lib/urls.js +18 -15
- package/lib/user-agent.js +0 -7
- package/lib/users/index.js +345 -552
- package/lib/users/roles.js +79 -128
- package/lib/users/social/container.js +0 -16
- package/lib/users/social/index.js +166 -250
- package/lib/users/user.js +2 -9
- package/lib/users/utils.js +0 -3
- package/lib/utils.js +0 -17
- package/package.json +16 -16
- package/src/data/store.js +3 -1
- package/src/expression.js +16 -0
- package/src/files/utils.js +1 -1
- package/src/index.js +5 -0
package/lib/messaging/index.js
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
|
-
|
|
16
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
|
-
|
|
18
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
19
|
-
|
|
20
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
21
|
-
|
|
22
14
|
var _channel = _interopRequireDefault(require("./channel"));
|
|
23
|
-
|
|
24
15
|
var _helpers = require("./helpers");
|
|
25
|
-
|
|
26
16
|
var Messaging = /*#__PURE__*/function () {
|
|
27
17
|
function Messaging(app) {
|
|
28
18
|
(0, _classCallCheck2["default"])(this, Messaging);
|
|
@@ -33,7 +23,6 @@ var Messaging = /*#__PURE__*/function () {
|
|
|
33
23
|
this.PublishOptionsHeaders = _helpers.PublishOptionsHeaders;
|
|
34
24
|
this.EmailEnvelope = _helpers.EmailEnvelope;
|
|
35
25
|
}
|
|
36
|
-
|
|
37
26
|
(0, _createClass2["default"])(Messaging, [{
|
|
38
27
|
key: "subscribe",
|
|
39
28
|
value: function subscribe(channelName) {
|
|
@@ -48,63 +37,49 @@ var Messaging = /*#__PURE__*/function () {
|
|
|
48
37
|
var _publish = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(channelName, message, publishOptions, deliveryOptions) {
|
|
49
38
|
var data;
|
|
50
39
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
51
|
-
while (1) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
(0, _extends2["default"])(data, deliveryOptions);
|
|
89
|
-
|
|
90
|
-
case 10:
|
|
91
|
-
return _context.abrupt("return", this.app.request.post({
|
|
92
|
-
url: this.app.urls.messagingChannel(channelName),
|
|
93
|
-
data: data
|
|
94
|
-
}));
|
|
95
|
-
|
|
96
|
-
case 11:
|
|
97
|
-
case "end":
|
|
98
|
-
return _context.stop();
|
|
99
|
-
}
|
|
40
|
+
while (1) switch (_context.prev = _context.next) {
|
|
41
|
+
case 0:
|
|
42
|
+
validateChannelName(channelName);
|
|
43
|
+
data = {
|
|
44
|
+
message: message
|
|
45
|
+
};
|
|
46
|
+
if (!publishOptions) {
|
|
47
|
+
_context.next = 6;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
if (!(Array.isArray(publishOptions) || (0, _typeof2["default"])(publishOptions) !== 'object')) {
|
|
51
|
+
_context.next = 5;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
throw new Error('"publishOptions" argument must be an object.');
|
|
55
|
+
case 5:
|
|
56
|
+
(0, _extends2["default"])(data, publishOptions);
|
|
57
|
+
case 6:
|
|
58
|
+
if (!deliveryOptions) {
|
|
59
|
+
_context.next = 10;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
if (!(Array.isArray(deliveryOptions) || (0, _typeof2["default"])(deliveryOptions) !== 'object')) {
|
|
63
|
+
_context.next = 9;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
throw new Error('"deliveryOptions" argument must be an object.');
|
|
67
|
+
case 9:
|
|
68
|
+
(0, _extends2["default"])(data, deliveryOptions);
|
|
69
|
+
case 10:
|
|
70
|
+
return _context.abrupt("return", this.app.request.post({
|
|
71
|
+
url: this.app.urls.messagingChannel(channelName),
|
|
72
|
+
data: data
|
|
73
|
+
}));
|
|
74
|
+
case 11:
|
|
75
|
+
case "end":
|
|
76
|
+
return _context.stop();
|
|
100
77
|
}
|
|
101
78
|
}, _callee, this);
|
|
102
79
|
}));
|
|
103
|
-
|
|
104
80
|
function publish(_x, _x2, _x3, _x4) {
|
|
105
81
|
return _publish.apply(this, arguments);
|
|
106
82
|
}
|
|
107
|
-
|
|
108
83
|
return publish;
|
|
109
84
|
}()
|
|
110
85
|
}, {
|
|
@@ -113,40 +88,31 @@ var Messaging = /*#__PURE__*/function () {
|
|
|
113
88
|
var _pushWithTemplate = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(templateName, templateValues) {
|
|
114
89
|
var data;
|
|
115
90
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
116
|
-
while (1) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
data: data
|
|
136
|
-
}));
|
|
137
|
-
|
|
138
|
-
case 5:
|
|
139
|
-
case "end":
|
|
140
|
-
return _context2.stop();
|
|
141
|
-
}
|
|
91
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
92
|
+
case 0:
|
|
93
|
+
if (!(!templateName || typeof templateName !== 'string')) {
|
|
94
|
+
_context2.next = 2;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
throw new Error('Push Template Name must be provided and must be a string.');
|
|
98
|
+
case 2:
|
|
99
|
+
data = {};
|
|
100
|
+
if (templateValues) {
|
|
101
|
+
data.templateValues = templateValues;
|
|
102
|
+
}
|
|
103
|
+
return _context2.abrupt("return", this.app.request.post({
|
|
104
|
+
url: this.app.urls.messagingPushWithTemplate(templateName),
|
|
105
|
+
data: data
|
|
106
|
+
}));
|
|
107
|
+
case 5:
|
|
108
|
+
case "end":
|
|
109
|
+
return _context2.stop();
|
|
142
110
|
}
|
|
143
111
|
}, _callee2, this);
|
|
144
112
|
}));
|
|
145
|
-
|
|
146
113
|
function pushWithTemplate(_x5, _x6) {
|
|
147
114
|
return _pushWithTemplate.apply(this, arguments);
|
|
148
115
|
}
|
|
149
|
-
|
|
150
116
|
return pushWithTemplate;
|
|
151
117
|
}()
|
|
152
118
|
}, {
|
|
@@ -155,68 +121,53 @@ var Messaging = /*#__PURE__*/function () {
|
|
|
155
121
|
var _sendEmail = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(subject, bodyParts, recipients, attachments) {
|
|
156
122
|
var data;
|
|
157
123
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
158
|
-
while (1) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (Array.isArray(attachments) && attachments.length) {
|
|
200
|
-
data.attachment = attachments;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return _context3.abrupt("return", this.app.request.post({
|
|
204
|
-
url: this.app.urls.messagingEmail(),
|
|
205
|
-
data: data
|
|
206
|
-
}));
|
|
207
|
-
|
|
208
|
-
case 11:
|
|
209
|
-
case "end":
|
|
210
|
-
return _context3.stop();
|
|
211
|
-
}
|
|
124
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
125
|
+
case 0:
|
|
126
|
+
if (!(!subject || typeof subject !== 'string')) {
|
|
127
|
+
_context3.next = 2;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
throw new Error('Email Subject must be provided and must be a string.');
|
|
131
|
+
case 2:
|
|
132
|
+
if (!(!bodyParts || Array.isArray(bodyParts) || (0, _typeof2["default"])(bodyParts) !== 'object')) {
|
|
133
|
+
_context3.next = 4;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
throw new Error('BodyParts must be an object');
|
|
137
|
+
case 4:
|
|
138
|
+
if (!(!bodyParts.textmessage && !bodyParts.htmlmessage)) {
|
|
139
|
+
_context3.next = 6;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
throw new Error('BodyParts must contain at least one property of [ textmessage | htmlmessage ]');
|
|
143
|
+
case 6:
|
|
144
|
+
if (!(!Array.isArray(recipients) || !recipients.length)) {
|
|
145
|
+
_context3.next = 8;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
throw new Error('Recipients must be a non empty array.');
|
|
149
|
+
case 8:
|
|
150
|
+
data = {
|
|
151
|
+
subject: subject,
|
|
152
|
+
bodyparts: bodyParts,
|
|
153
|
+
to: recipients
|
|
154
|
+
};
|
|
155
|
+
if (Array.isArray(attachments) && attachments.length) {
|
|
156
|
+
data.attachment = attachments;
|
|
157
|
+
}
|
|
158
|
+
return _context3.abrupt("return", this.app.request.post({
|
|
159
|
+
url: this.app.urls.messagingEmail(),
|
|
160
|
+
data: data
|
|
161
|
+
}));
|
|
162
|
+
case 11:
|
|
163
|
+
case "end":
|
|
164
|
+
return _context3.stop();
|
|
212
165
|
}
|
|
213
166
|
}, _callee3, this);
|
|
214
167
|
}));
|
|
215
|
-
|
|
216
168
|
function sendEmail(_x7, _x8, _x9, _x10) {
|
|
217
169
|
return _sendEmail.apply(this, arguments);
|
|
218
170
|
}
|
|
219
|
-
|
|
220
171
|
return sendEmail;
|
|
221
172
|
}()
|
|
222
173
|
}, {
|
|
@@ -225,57 +176,44 @@ var Messaging = /*#__PURE__*/function () {
|
|
|
225
176
|
var _sendEmailFromTemplate = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(templateName, envelopeObject, templateValues, attachments) {
|
|
226
177
|
var data;
|
|
227
178
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
228
|
-
while (1) {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
return _context4.abrupt("return", this.app.request.post({
|
|
263
|
-
url: this.app.urls.emailTemplateSend(),
|
|
264
|
-
data: data
|
|
265
|
-
}));
|
|
266
|
-
|
|
267
|
-
case 10:
|
|
268
|
-
case "end":
|
|
269
|
-
return _context4.stop();
|
|
270
|
-
}
|
|
179
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
180
|
+
case 0:
|
|
181
|
+
if (!(!templateName || typeof templateName !== 'string')) {
|
|
182
|
+
_context4.next = 2;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
throw new Error('Email Template Name must be provided and must be a string.');
|
|
186
|
+
case 2:
|
|
187
|
+
if (envelopeObject instanceof _helpers.EmailEnvelope) {
|
|
188
|
+
_context4.next = 4;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
throw new Error('EmailEnvelope is required and should be instance of Backendless.Messaging.EmailEnvelope');
|
|
192
|
+
case 4:
|
|
193
|
+
data = envelopeObject.toJSON();
|
|
194
|
+
data['template-name'] = templateName;
|
|
195
|
+
if (templateValues && !Array.isArray(templateValues)) {
|
|
196
|
+
data['template-values'] = templateValues;
|
|
197
|
+
}
|
|
198
|
+
if (Array.isArray(templateValues) && !attachments) {
|
|
199
|
+
attachments = templateValues;
|
|
200
|
+
}
|
|
201
|
+
if (attachments) {
|
|
202
|
+
data.attachment = attachments;
|
|
203
|
+
}
|
|
204
|
+
return _context4.abrupt("return", this.app.request.post({
|
|
205
|
+
url: this.app.urls.emailTemplateSend(),
|
|
206
|
+
data: data
|
|
207
|
+
}));
|
|
208
|
+
case 10:
|
|
209
|
+
case "end":
|
|
210
|
+
return _context4.stop();
|
|
271
211
|
}
|
|
272
212
|
}, _callee4, this);
|
|
273
213
|
}));
|
|
274
|
-
|
|
275
214
|
function sendEmailFromTemplate(_x11, _x12, _x13, _x14) {
|
|
276
215
|
return _sendEmailFromTemplate.apply(this, arguments);
|
|
277
216
|
}
|
|
278
|
-
|
|
279
217
|
return sendEmailFromTemplate;
|
|
280
218
|
}()
|
|
281
219
|
}, {
|
|
@@ -283,33 +221,26 @@ var Messaging = /*#__PURE__*/function () {
|
|
|
283
221
|
value: function () {
|
|
284
222
|
var _cancel = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(messageId) {
|
|
285
223
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
286
|
-
while (1) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
case 3:
|
|
302
|
-
case "end":
|
|
303
|
-
return _context5.stop();
|
|
304
|
-
}
|
|
224
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
225
|
+
case 0:
|
|
226
|
+
if (!(!messageId || typeof messageId !== 'string')) {
|
|
227
|
+
_context5.next = 2;
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
throw new Error('Message ID must be provided and must be a string.');
|
|
231
|
+
case 2:
|
|
232
|
+
return _context5.abrupt("return", this.app.request["delete"]({
|
|
233
|
+
url: this.app.urls.messagingMessage(messageId)
|
|
234
|
+
}));
|
|
235
|
+
case 3:
|
|
236
|
+
case "end":
|
|
237
|
+
return _context5.stop();
|
|
305
238
|
}
|
|
306
239
|
}, _callee5, this);
|
|
307
240
|
}));
|
|
308
|
-
|
|
309
241
|
function cancel(_x15) {
|
|
310
242
|
return _cancel.apply(this, arguments);
|
|
311
243
|
}
|
|
312
|
-
|
|
313
244
|
return cancel;
|
|
314
245
|
}()
|
|
315
246
|
}, {
|
|
@@ -318,44 +249,36 @@ var Messaging = /*#__PURE__*/function () {
|
|
|
318
249
|
var _registerDevice = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(deviceToken, channels, expiration) {
|
|
319
250
|
var device, data;
|
|
320
251
|
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
321
|
-
while (1) {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
}));
|
|
346
|
-
|
|
347
|
-
case 5:
|
|
348
|
-
case "end":
|
|
349
|
-
return _context6.stop();
|
|
350
|
-
}
|
|
252
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
253
|
+
case 0:
|
|
254
|
+
device = this.app.device;
|
|
255
|
+
data = {
|
|
256
|
+
deviceToken: deviceToken,
|
|
257
|
+
deviceId: device.uuid,
|
|
258
|
+
os: device.platform,
|
|
259
|
+
osVersion: device.version
|
|
260
|
+
};
|
|
261
|
+
if (Array.isArray(channels)) {
|
|
262
|
+
data.channels = channels;
|
|
263
|
+
}
|
|
264
|
+
if (typeof expiration === 'number') {
|
|
265
|
+
data.expiration = expiration;
|
|
266
|
+
} else if (expiration instanceof Date) {
|
|
267
|
+
data.expiration = expiration.getTime() / 1000;
|
|
268
|
+
}
|
|
269
|
+
return _context6.abrupt("return", this.app.request.post({
|
|
270
|
+
url: this.app.urls.messagingRegistrations(),
|
|
271
|
+
data: data
|
|
272
|
+
}));
|
|
273
|
+
case 5:
|
|
274
|
+
case "end":
|
|
275
|
+
return _context6.stop();
|
|
351
276
|
}
|
|
352
277
|
}, _callee6, this);
|
|
353
278
|
}));
|
|
354
|
-
|
|
355
279
|
function registerDevice(_x16, _x17, _x18) {
|
|
356
280
|
return _registerDevice.apply(this, arguments);
|
|
357
281
|
}
|
|
358
|
-
|
|
359
282
|
return registerDevice;
|
|
360
283
|
}()
|
|
361
284
|
}, {
|
|
@@ -364,26 +287,21 @@ var Messaging = /*#__PURE__*/function () {
|
|
|
364
287
|
var _getRegistrations = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
365
288
|
var device;
|
|
366
289
|
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
367
|
-
while (1) {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
case "end":
|
|
377
|
-
return _context7.stop();
|
|
378
|
-
}
|
|
290
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
291
|
+
case 0:
|
|
292
|
+
device = this.app.device;
|
|
293
|
+
return _context7.abrupt("return", this.app.request.get({
|
|
294
|
+
url: this.app.urls.messagingRegistrationDevice(device.uuid)
|
|
295
|
+
}));
|
|
296
|
+
case 2:
|
|
297
|
+
case "end":
|
|
298
|
+
return _context7.stop();
|
|
379
299
|
}
|
|
380
300
|
}, _callee7, this);
|
|
381
301
|
}));
|
|
382
|
-
|
|
383
302
|
function getRegistrations() {
|
|
384
303
|
return _getRegistrations.apply(this, arguments);
|
|
385
304
|
}
|
|
386
|
-
|
|
387
305
|
return getRegistrations;
|
|
388
306
|
}()
|
|
389
307
|
}, {
|
|
@@ -392,26 +310,21 @@ var Messaging = /*#__PURE__*/function () {
|
|
|
392
310
|
var _unregisterDevice = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
393
311
|
var device;
|
|
394
312
|
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
395
|
-
while (1) {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
case "end":
|
|
405
|
-
return _context8.stop();
|
|
406
|
-
}
|
|
313
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
314
|
+
case 0:
|
|
315
|
+
device = this.app.device;
|
|
316
|
+
return _context8.abrupt("return", this.app.request["delete"]({
|
|
317
|
+
url: this.app.urls.messagingRegistrationDevice(device.uuid)
|
|
318
|
+
}));
|
|
319
|
+
case 2:
|
|
320
|
+
case "end":
|
|
321
|
+
return _context8.stop();
|
|
407
322
|
}
|
|
408
323
|
}, _callee8, this);
|
|
409
324
|
}));
|
|
410
|
-
|
|
411
325
|
function unregisterDevice() {
|
|
412
326
|
return _unregisterDevice.apply(this, arguments);
|
|
413
327
|
}
|
|
414
|
-
|
|
415
328
|
return unregisterDevice;
|
|
416
329
|
}()
|
|
417
330
|
}, {
|
|
@@ -419,33 +332,26 @@ var Messaging = /*#__PURE__*/function () {
|
|
|
419
332
|
value: function () {
|
|
420
333
|
var _getMessageStatus = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(messageId) {
|
|
421
334
|
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
422
|
-
while (1) {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
case 3:
|
|
438
|
-
case "end":
|
|
439
|
-
return _context9.stop();
|
|
440
|
-
}
|
|
335
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
336
|
+
case 0:
|
|
337
|
+
if (!(!messageId || typeof messageId !== 'string')) {
|
|
338
|
+
_context9.next = 2;
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
throw new Error('Message ID must be provided and must be a string.');
|
|
342
|
+
case 2:
|
|
343
|
+
return _context9.abrupt("return", this.app.request.get({
|
|
344
|
+
url: this.app.urls.messagingMessage(messageId)
|
|
345
|
+
}));
|
|
346
|
+
case 3:
|
|
347
|
+
case "end":
|
|
348
|
+
return _context9.stop();
|
|
441
349
|
}
|
|
442
350
|
}, _callee9, this);
|
|
443
351
|
}));
|
|
444
|
-
|
|
445
352
|
function getMessageStatus(_x19) {
|
|
446
353
|
return _getMessageStatus.apply(this, arguments);
|
|
447
354
|
}
|
|
448
|
-
|
|
449
355
|
return getMessageStatus;
|
|
450
356
|
}()
|
|
451
357
|
}, {
|
|
@@ -453,46 +359,36 @@ var Messaging = /*#__PURE__*/function () {
|
|
|
453
359
|
value: function () {
|
|
454
360
|
var _getPushTemplates = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(deviceType) {
|
|
455
361
|
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
456
|
-
while (1) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
case 3:
|
|
472
|
-
case "end":
|
|
473
|
-
return _context10.stop();
|
|
474
|
-
}
|
|
362
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
363
|
+
case 0:
|
|
364
|
+
if (!(!deviceType || typeof deviceType !== 'string')) {
|
|
365
|
+
_context10.next = 2;
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
throw new Error('Device Type must be provided and must be a string.');
|
|
369
|
+
case 2:
|
|
370
|
+
return _context10.abrupt("return", this.app.request.get({
|
|
371
|
+
url: this.app.urls.messagingPushTemplates(deviceType)
|
|
372
|
+
}));
|
|
373
|
+
case 3:
|
|
374
|
+
case "end":
|
|
375
|
+
return _context10.stop();
|
|
475
376
|
}
|
|
476
377
|
}, _callee10, this);
|
|
477
378
|
}));
|
|
478
|
-
|
|
479
379
|
function getPushTemplates(_x20) {
|
|
480
380
|
return _getPushTemplates.apply(this, arguments);
|
|
481
381
|
}
|
|
482
|
-
|
|
483
382
|
return getPushTemplates;
|
|
484
383
|
}()
|
|
485
384
|
}]);
|
|
486
385
|
return Messaging;
|
|
487
386
|
}();
|
|
488
|
-
|
|
489
387
|
exports["default"] = Messaging;
|
|
490
|
-
|
|
491
388
|
function validateChannelName(channelName) {
|
|
492
389
|
if (!channelName || typeof channelName !== 'string') {
|
|
493
390
|
throw new Error('Channel Name must be provided and must be a string.');
|
|
494
391
|
}
|
|
495
|
-
|
|
496
392
|
if (channelName.indexOf('/') >= 0) {
|
|
497
393
|
throw new Error('Channel Name can not contain slash chars');
|
|
498
394
|
}
|