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.
Files changed (159) hide show
  1. package/backendless.d.ts +5 -0
  2. package/dist/backendless.js +20966 -23929
  3. package/dist/backendless.js.map +1 -1
  4. package/dist/backendless.min.js +2 -2
  5. package/es/bl/constants.js +0 -2
  6. package/es/bl/custom-services.js +40 -65
  7. package/es/bl/events.js +30 -52
  8. package/es/bl/index.js +3 -9
  9. package/es/cache/index.js +125 -189
  10. package/es/commerce/index.js +78 -119
  11. package/es/counters/counter.js +0 -8
  12. package/es/counters/index.js +171 -258
  13. package/es/data/data-query-builder.js +2 -39
  14. package/es/data/geo/geo-constructor.js +5 -26
  15. package/es/data/geo/geo-json-parser.js +0 -7
  16. package/es/data/geo/geometry.js +4 -13
  17. package/es/data/geo/linestring.js +4 -21
  18. package/es/data/geo/point.js +4 -22
  19. package/es/data/geo/polygon.js +4 -30
  20. package/es/data/geo/spatial-reference-system.js +1 -7
  21. package/es/data/geo/wkt-parser.js +0 -10
  22. package/es/data/geo/wkt-to-geojson.js +4 -44
  23. package/es/data/group-query-builder.js +0 -23
  24. package/es/data/index.js +17 -54
  25. package/es/data/json-update-builder.js +0 -18
  26. package/es/data/load-relations-query-builder.js +0 -16
  27. package/es/data/persmission.js +0 -16
  28. package/es/data/rt-handlers.js +1 -46
  29. package/es/data/store.js +316 -518
  30. package/es/decorators/deprecated.js +2 -5
  31. package/es/decorators/index.js +0 -2
  32. package/es/device/index.js +3 -8
  33. package/es/expression.js +29 -0
  34. package/es/files/index.js +354 -493
  35. package/es/files/persmission.js +0 -15
  36. package/es/files/utils.js +32 -55
  37. package/es/hive/index.js +1 -13
  38. package/es/hive/stores/base-store.js +14 -50
  39. package/es/hive/stores/index.js +0 -10
  40. package/es/hive/stores/key-value.js +4 -37
  41. package/es/hive/stores/list.js +0 -32
  42. package/es/hive/stores/map.js +0 -34
  43. package/es/hive/stores/set.js +0 -29
  44. package/es/hive/stores/sorted-set.js +19 -94
  45. package/es/hive/utils.js +0 -2
  46. package/es/index.js +51 -71
  47. package/es/local-cache/index.js +0 -10
  48. package/es/local-cache/local-storage.js +1 -9
  49. package/es/local-cache/virtual-storage.js +0 -6
  50. package/es/logging/index.js +21 -46
  51. package/es/logging/logger.js +0 -6
  52. package/es/management/data.js +0 -8
  53. package/es/management/index.js +3 -7
  54. package/es/messaging/channel/index.js +0 -27
  55. package/es/messaging/helpers/body-parts.js +3 -6
  56. package/es/messaging/helpers/delivery-options.js +3 -6
  57. package/es/messaging/helpers/email-envelope.js +13 -25
  58. package/es/messaging/helpers/index.js +10 -16
  59. package/es/messaging/helpers/publish-options.js +3 -6
  60. package/es/messaging/index.js +213 -317
  61. package/es/persmission.js +7 -16
  62. package/es/request/index.js +2 -16
  63. package/es/rso/connection.js +3 -34
  64. package/es/rso/index.js +0 -7
  65. package/es/rt.js +21 -52
  66. package/es/unit-of-work/constants.js +1 -1
  67. package/es/unit-of-work/index.js +27 -145
  68. package/es/unit-of-work/json-adapter.js +14 -35
  69. package/es/unit-of-work/op-result-value-reference.js +1 -11
  70. package/es/unit-of-work/op-result.js +2 -13
  71. package/es/urls.js +18 -15
  72. package/es/user-agent.js +0 -7
  73. package/es/users/index.js +345 -552
  74. package/es/users/roles.js +79 -128
  75. package/es/users/social/container.js +0 -16
  76. package/es/users/social/index.js +166 -250
  77. package/es/users/user.js +2 -9
  78. package/es/users/utils.js +0 -3
  79. package/es/utils.js +0 -17
  80. package/lib/bl/constants.js +0 -2
  81. package/lib/bl/custom-services.js +40 -65
  82. package/lib/bl/events.js +30 -52
  83. package/lib/bl/index.js +3 -9
  84. package/lib/cache/index.js +125 -189
  85. package/lib/commerce/index.js +78 -119
  86. package/lib/counters/counter.js +0 -8
  87. package/lib/counters/index.js +171 -258
  88. package/lib/data/data-query-builder.js +2 -39
  89. package/lib/data/geo/geo-constructor.js +5 -26
  90. package/lib/data/geo/geo-json-parser.js +0 -7
  91. package/lib/data/geo/geometry.js +4 -13
  92. package/lib/data/geo/linestring.js +4 -21
  93. package/lib/data/geo/point.js +4 -22
  94. package/lib/data/geo/polygon.js +4 -30
  95. package/lib/data/geo/spatial-reference-system.js +1 -7
  96. package/lib/data/geo/wkt-parser.js +0 -10
  97. package/lib/data/geo/wkt-to-geojson.js +4 -44
  98. package/lib/data/group-query-builder.js +0 -23
  99. package/lib/data/index.js +17 -54
  100. package/lib/data/json-update-builder.js +0 -18
  101. package/lib/data/load-relations-query-builder.js +0 -16
  102. package/lib/data/persmission.js +0 -16
  103. package/lib/data/rt-handlers.js +1 -46
  104. package/lib/data/store.js +316 -518
  105. package/lib/decorators/deprecated.js +2 -5
  106. package/lib/decorators/index.js +0 -2
  107. package/lib/device/index.js +3 -8
  108. package/lib/expression.js +29 -0
  109. package/lib/files/index.js +354 -493
  110. package/lib/files/persmission.js +0 -15
  111. package/lib/files/utils.js +32 -55
  112. package/lib/hive/index.js +1 -13
  113. package/lib/hive/stores/base-store.js +14 -50
  114. package/lib/hive/stores/index.js +0 -10
  115. package/lib/hive/stores/key-value.js +4 -37
  116. package/lib/hive/stores/list.js +0 -32
  117. package/lib/hive/stores/map.js +0 -34
  118. package/lib/hive/stores/set.js +0 -29
  119. package/lib/hive/stores/sorted-set.js +19 -94
  120. package/lib/hive/utils.js +0 -2
  121. package/lib/index.js +51 -71
  122. package/lib/local-cache/index.js +0 -10
  123. package/lib/local-cache/local-storage.js +1 -9
  124. package/lib/local-cache/virtual-storage.js +0 -6
  125. package/lib/logging/index.js +21 -46
  126. package/lib/logging/logger.js +0 -6
  127. package/lib/management/data.js +0 -8
  128. package/lib/management/index.js +3 -7
  129. package/lib/messaging/channel/index.js +0 -27
  130. package/lib/messaging/helpers/body-parts.js +3 -6
  131. package/lib/messaging/helpers/delivery-options.js +3 -6
  132. package/lib/messaging/helpers/email-envelope.js +13 -25
  133. package/lib/messaging/helpers/index.js +10 -16
  134. package/lib/messaging/helpers/publish-options.js +3 -6
  135. package/lib/messaging/index.js +213 -317
  136. package/lib/persmission.js +7 -16
  137. package/lib/request/index.js +2 -16
  138. package/lib/rso/connection.js +3 -34
  139. package/lib/rso/index.js +0 -7
  140. package/lib/rt.js +21 -52
  141. package/lib/unit-of-work/constants.js +1 -1
  142. package/lib/unit-of-work/index.js +27 -145
  143. package/lib/unit-of-work/json-adapter.js +14 -35
  144. package/lib/unit-of-work/op-result-value-reference.js +1 -11
  145. package/lib/unit-of-work/op-result.js +2 -13
  146. package/lib/urls.js +18 -15
  147. package/lib/user-agent.js +0 -7
  148. package/lib/users/index.js +345 -552
  149. package/lib/users/roles.js +79 -128
  150. package/lib/users/social/container.js +0 -16
  151. package/lib/users/social/index.js +166 -250
  152. package/lib/users/user.js +2 -9
  153. package/lib/users/utils.js +0 -3
  154. package/lib/utils.js +0 -17
  155. package/package.json +16 -16
  156. package/src/data/store.js +3 -1
  157. package/src/expression.js +16 -0
  158. package/src/files/utils.js +1 -1
  159. package/src/index.js +5 -0
@@ -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
- switch (_context.prev = _context.next) {
53
- case 0:
54
- validateChannelName(channelName);
55
- data = {
56
- message: message
57
- };
58
-
59
- if (!publishOptions) {
60
- _context.next = 6;
61
- break;
62
- }
63
-
64
- if (!(Array.isArray(publishOptions) || (0, _typeof2["default"])(publishOptions) !== 'object')) {
65
- _context.next = 5;
66
- break;
67
- }
68
-
69
- throw new Error('"publishOptions" argument must be an object.');
70
-
71
- case 5:
72
- (0, _extends2["default"])(data, publishOptions);
73
-
74
- case 6:
75
- if (!deliveryOptions) {
76
- _context.next = 10;
77
- break;
78
- }
79
-
80
- if (!(Array.isArray(deliveryOptions) || (0, _typeof2["default"])(deliveryOptions) !== 'object')) {
81
- _context.next = 9;
82
- break;
83
- }
84
-
85
- throw new Error('"deliveryOptions" argument must be an object.');
86
-
87
- case 9:
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
- switch (_context2.prev = _context2.next) {
118
- case 0:
119
- if (!(!templateName || typeof templateName !== 'string')) {
120
- _context2.next = 2;
121
- break;
122
- }
123
-
124
- throw new Error('Push Template Name must be provided and must be a string.');
125
-
126
- case 2:
127
- data = {};
128
-
129
- if (templateValues) {
130
- data.templateValues = templateValues;
131
- }
132
-
133
- return _context2.abrupt("return", this.app.request.post({
134
- url: this.app.urls.messagingPushWithTemplate(templateName),
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
- switch (_context3.prev = _context3.next) {
160
- case 0:
161
- if (!(!subject || typeof subject !== 'string')) {
162
- _context3.next = 2;
163
- break;
164
- }
165
-
166
- throw new Error('Email Subject must be provided and must be a string.');
167
-
168
- case 2:
169
- if (!(!bodyParts || Array.isArray(bodyParts) || (0, _typeof2["default"])(bodyParts) !== 'object')) {
170
- _context3.next = 4;
171
- break;
172
- }
173
-
174
- throw new Error('BodyParts must be an object');
175
-
176
- case 4:
177
- if (!(!bodyParts.textmessage && !bodyParts.htmlmessage)) {
178
- _context3.next = 6;
179
- break;
180
- }
181
-
182
- throw new Error('BodyParts must contain at least one property of [ textmessage | htmlmessage ]');
183
-
184
- case 6:
185
- if (!(!Array.isArray(recipients) || !recipients.length)) {
186
- _context3.next = 8;
187
- break;
188
- }
189
-
190
- throw new Error('Recipients must be a non empty array.');
191
-
192
- case 8:
193
- data = {
194
- subject: subject,
195
- bodyparts: bodyParts,
196
- to: recipients
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
- switch (_context4.prev = _context4.next) {
230
- case 0:
231
- if (!(!templateName || typeof templateName !== 'string')) {
232
- _context4.next = 2;
233
- break;
234
- }
235
-
236
- throw new Error('Email Template Name must be provided and must be a string.');
237
-
238
- case 2:
239
- if (envelopeObject instanceof _helpers.EmailEnvelope) {
240
- _context4.next = 4;
241
- break;
242
- }
243
-
244
- throw new Error('EmailEnvelope is required and should be instance of Backendless.Messaging.EmailEnvelope');
245
-
246
- case 4:
247
- data = envelopeObject.toJSON();
248
- data['template-name'] = templateName;
249
-
250
- if (templateValues && !Array.isArray(templateValues)) {
251
- data['template-values'] = templateValues;
252
- }
253
-
254
- if (Array.isArray(templateValues) && !attachments) {
255
- attachments = templateValues;
256
- }
257
-
258
- if (attachments) {
259
- data.attachment = attachments;
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
- switch (_context5.prev = _context5.next) {
288
- case 0:
289
- if (!(!messageId || typeof messageId !== 'string')) {
290
- _context5.next = 2;
291
- break;
292
- }
293
-
294
- throw new Error('Message ID must be provided and must be a string.');
295
-
296
- case 2:
297
- return _context5.abrupt("return", this.app.request["delete"]({
298
- url: this.app.urls.messagingMessage(messageId)
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
- switch (_context6.prev = _context6.next) {
323
- case 0:
324
- device = this.app.device;
325
- data = {
326
- deviceToken: deviceToken,
327
- deviceId: device.uuid,
328
- os: device.platform,
329
- osVersion: device.version
330
- };
331
-
332
- if (Array.isArray(channels)) {
333
- data.channels = channels;
334
- }
335
-
336
- if (typeof expiration === 'number') {
337
- data.expiration = expiration;
338
- } else if (expiration instanceof Date) {
339
- data.expiration = expiration.getTime() / 1000;
340
- }
341
-
342
- return _context6.abrupt("return", this.app.request.post({
343
- url: this.app.urls.messagingRegistrations(),
344
- data: data
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
- switch (_context7.prev = _context7.next) {
369
- case 0:
370
- device = this.app.device;
371
- return _context7.abrupt("return", this.app.request.get({
372
- url: this.app.urls.messagingRegistrationDevice(device.uuid)
373
- }));
374
-
375
- case 2:
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
- switch (_context8.prev = _context8.next) {
397
- case 0:
398
- device = this.app.device;
399
- return _context8.abrupt("return", this.app.request["delete"]({
400
- url: this.app.urls.messagingRegistrationDevice(device.uuid)
401
- }));
402
-
403
- case 2:
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
- switch (_context9.prev = _context9.next) {
424
- case 0:
425
- if (!(!messageId || typeof messageId !== 'string')) {
426
- _context9.next = 2;
427
- break;
428
- }
429
-
430
- throw new Error('Message ID must be provided and must be a string.');
431
-
432
- case 2:
433
- return _context9.abrupt("return", this.app.request.get({
434
- url: this.app.urls.messagingMessage(messageId)
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
- switch (_context10.prev = _context10.next) {
458
- case 0:
459
- if (!(!deviceType || typeof deviceType !== 'string')) {
460
- _context10.next = 2;
461
- break;
462
- }
463
-
464
- throw new Error('Device Type must be provided and must be a string.');
465
-
466
- case 2:
467
- return _context10.abrupt("return", this.app.request.get({
468
- url: this.app.urls.messagingPushTemplates(deviceType)
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
  }