backendless 6.3.0 → 6.3.4

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/es/files/index.js CHANGED
@@ -66,7 +66,7 @@ var Files = /*#__PURE__*/function () {
66
66
  query.overwrite = overwrite;
67
67
  }
68
68
 
69
- filePath = _utils["default"].preventSlashInPath(filePath);
69
+ filePath = _utils["default"].trimSlashesInPath(filePath);
70
70
  fileName = _utils["default"].sanitizeFileName(fileName);
71
71
  return _context.abrupt("return", this.app.request.put({
72
72
  url: "".concat(this.app.urls.fileBinaryPath(filePath), "/").concat(fileName),
@@ -106,7 +106,7 @@ var Files = /*#__PURE__*/function () {
106
106
  query.overwrite = overwrite;
107
107
  }
108
108
 
109
- filePath = _utils["default"].preventSlashInPath(filePath);
109
+ filePath = _utils["default"].trimSlashesInPath(filePath);
110
110
  pathTokens = _utils["default"].parseFilePath(filePath);
111
111
 
112
112
  if (pathTokens.fileName) {
@@ -125,7 +125,7 @@ var Files = /*#__PURE__*/function () {
125
125
  }
126
126
 
127
127
  return _context2.abrupt("return", this.app.request.post({
128
- url: "".concat(this.app.urls.filePath(filePath), "/").concat(fileName || ''),
128
+ url: "".concat(this.app.urls.filePath(filePath), "/").concat(fileName),
129
129
  query: query,
130
130
  data: {
131
131
  url: file
@@ -169,25 +169,189 @@ var Files = /*#__PURE__*/function () {
169
169
  return upload;
170
170
  }()
171
171
  }, {
172
- key: "listing",
172
+ key: "append",
173
173
  value: function () {
174
- var _listing = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(filePath, pattern, sub, pagesize, offset) {
175
- var query;
174
+ var _append = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(filePath, fileName, fileContent) {
175
+ var pathTokens,
176
+ _args3 = arguments;
176
177
  return _regenerator["default"].wrap(function _callee3$(_context3) {
177
178
  while (1) {
178
179
  switch (_context3.prev = _context3.next) {
180
+ case 0:
181
+ if (!(!filePath || typeof filePath !== 'string')) {
182
+ _context3.next = 2;
183
+ break;
184
+ }
185
+
186
+ throw new Error('"filePath" must be provided and must be a string.');
187
+
188
+ case 2:
189
+ filePath = _utils["default"].trimSlashesInPath(filePath);
190
+
191
+ if (_args3.length === 2) {
192
+ fileContent = fileName;
193
+ fileName = undefined;
194
+ pathTokens = _utils["default"].parseFilePath(filePath);
195
+
196
+ if (pathTokens.fileName) {
197
+ filePath = pathTokens.filePath;
198
+ fileName = pathTokens.fileName;
199
+ }
200
+ }
201
+
202
+ if (fileName) {
203
+ _context3.next = 6;
204
+ break;
205
+ }
206
+
207
+ throw new Error('Can not resolve target file name');
208
+
209
+ case 6:
210
+ fileName = _utils["default"].sanitizeFileName(fileName);
211
+
212
+ if (!(typeof fileContent === 'string')) {
213
+ _context3.next = 9;
214
+ break;
215
+ }
216
+
217
+ return _context3.abrupt("return", this.app.request.post({
218
+ url: "".concat(this.app.urls.fileAppendPath(filePath), "/").concat(fileName),
219
+ data: {
220
+ url: fileContent
221
+ }
222
+ }));
223
+
224
+ case 9:
225
+ if (!_utils["default"].isBytesArray(fileContent)) {
226
+ _context3.next = 14;
227
+ break;
228
+ }
229
+
230
+ _context3.next = 12;
231
+ return _utils["default"].toBase64(fileContent);
232
+
233
+ case 12:
234
+ fileContent = _context3.sent;
235
+ return _context3.abrupt("return", this.app.request.put({
236
+ url: "".concat(this.app.urls.fileAppendBinaryPath(filePath), "/").concat(fileName),
237
+ headers: {
238
+ 'Content-Type': 'text/plain'
239
+ },
240
+ data: fileContent
241
+ }));
242
+
243
+ case 14:
244
+ return _context3.abrupt("return", this.app.request.post({
245
+ url: "".concat(this.app.urls.fileAppendPath(filePath), "/").concat(fileName),
246
+ form: {
247
+ file: fileContent
248
+ }
249
+ }));
250
+
251
+ case 15:
252
+ case "end":
253
+ return _context3.stop();
254
+ }
255
+ }
256
+ }, _callee3, this);
257
+ }));
258
+
259
+ function append(_x8, _x9, _x10) {
260
+ return _append.apply(this, arguments);
261
+ }
262
+
263
+ return append;
264
+ }()
265
+ }, {
266
+ key: "appendText",
267
+ value: function () {
268
+ var _appendText = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(filePath, fileName, textContent) {
269
+ var pathTokens,
270
+ _args4 = arguments;
271
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
272
+ while (1) {
273
+ switch (_context4.prev = _context4.next) {
274
+ case 0:
275
+ if (!(!filePath || typeof filePath !== 'string')) {
276
+ _context4.next = 2;
277
+ break;
278
+ }
279
+
280
+ throw new Error('"filePath" must be provided and must be a string.');
281
+
282
+ case 2:
283
+ filePath = _utils["default"].trimSlashesInPath(filePath);
284
+
285
+ if (_args4.length === 2) {
286
+ textContent = fileName;
287
+ fileName = undefined;
288
+ pathTokens = _utils["default"].parseFilePath(filePath);
289
+
290
+ if (pathTokens.fileName) {
291
+ filePath = pathTokens.filePath;
292
+ fileName = pathTokens.fileName;
293
+ }
294
+ }
295
+
296
+ if (fileName) {
297
+ _context4.next = 6;
298
+ break;
299
+ }
300
+
301
+ throw new Error('Can not resolve target file name');
302
+
303
+ case 6:
304
+ if (!(typeof textContent !== 'string')) {
305
+ _context4.next = 8;
306
+ break;
307
+ }
308
+
309
+ throw new Error('"textContent" must be a string');
310
+
311
+ case 8:
312
+ fileName = _utils["default"].sanitizeFileName(fileName);
313
+ return _context4.abrupt("return", this.app.request.put({
314
+ url: "".concat(this.app.urls.fileAppendPath(filePath), "/").concat(fileName),
315
+ headers: {
316
+ 'Content-Type': 'text/plain'
317
+ },
318
+ data: textContent
319
+ }));
320
+
321
+ case 10:
322
+ case "end":
323
+ return _context4.stop();
324
+ }
325
+ }
326
+ }, _callee4, this);
327
+ }));
328
+
329
+ function appendText(_x11, _x12, _x13) {
330
+ return _appendText.apply(this, arguments);
331
+ }
332
+
333
+ return appendText;
334
+ }()
335
+ }, {
336
+ key: "listing",
337
+ value: function () {
338
+ var _listing = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(filePath, pattern, sub, pagesize, offset) {
339
+ var query;
340
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
341
+ while (1) {
342
+ switch (_context5.prev = _context5.next) {
179
343
  case 0:
180
344
  query = {};
181
345
 
182
346
  if (!(!filePath || typeof filePath !== 'string')) {
183
- _context3.next = 3;
347
+ _context5.next = 3;
184
348
  break;
185
349
  }
186
350
 
187
351
  throw new Error('"filePath" must be provided and must be a string.');
188
352
 
189
353
  case 3:
190
- filePath = _utils["default"].preventSlashInPath(filePath);
354
+ filePath = _utils["default"].trimSlashesInPath(filePath);
191
355
 
192
356
  if (pattern && typeof pattern === 'string') {
193
357
  query.pattern = pattern;
@@ -205,20 +369,20 @@ var Files = /*#__PURE__*/function () {
205
369
  query.offset = offset;
206
370
  }
207
371
 
208
- return _context3.abrupt("return", this.app.request.get({
372
+ return _context5.abrupt("return", this.app.request.get({
209
373
  url: this.app.urls.filePath(filePath),
210
374
  query: query
211
375
  }));
212
376
 
213
377
  case 9:
214
378
  case "end":
215
- return _context3.stop();
379
+ return _context5.stop();
216
380
  }
217
381
  }
218
- }, _callee3, this);
382
+ }, _callee5, this);
219
383
  }));
220
384
 
221
- function listing(_x8, _x9, _x10, _x11, _x12) {
385
+ function listing(_x14, _x15, _x16, _x17, _x18) {
222
386
  return _listing.apply(this, arguments);
223
387
  }
224
388
 
@@ -227,13 +391,13 @@ var Files = /*#__PURE__*/function () {
227
391
  }, {
228
392
  key: "renameFile",
229
393
  value: function () {
230
- var _renameFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(oldPathName, newName) {
231
- return _regenerator["default"].wrap(function _callee4$(_context4) {
394
+ var _renameFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(oldPathName, newName) {
395
+ return _regenerator["default"].wrap(function _callee6$(_context6) {
232
396
  while (1) {
233
- switch (_context4.prev = _context4.next) {
397
+ switch (_context6.prev = _context6.next) {
234
398
  case 0:
235
399
  if (!(!oldPathName || typeof oldPathName !== 'string')) {
236
- _context4.next = 2;
400
+ _context6.next = 2;
237
401
  break;
238
402
  }
239
403
 
@@ -241,14 +405,14 @@ var Files = /*#__PURE__*/function () {
241
405
 
242
406
  case 2:
243
407
  if (!(!newName || typeof newName !== 'string')) {
244
- _context4.next = 4;
408
+ _context6.next = 4;
245
409
  break;
246
410
  }
247
411
 
248
412
  throw new Error('New File Name must be provided and must be a string.');
249
413
 
250
414
  case 4:
251
- return _context4.abrupt("return", this.app.request.put({
415
+ return _context6.abrupt("return", this.app.request.put({
252
416
  url: this.app.urls.fileRename(),
253
417
  data: {
254
418
  oldPathName: _utils["default"].ensureSlashInPath(oldPathName),
@@ -258,13 +422,13 @@ var Files = /*#__PURE__*/function () {
258
422
 
259
423
  case 5:
260
424
  case "end":
261
- return _context4.stop();
425
+ return _context6.stop();
262
426
  }
263
427
  }
264
- }, _callee4, this);
428
+ }, _callee6, this);
265
429
  }));
266
430
 
267
- function renameFile(_x13, _x14) {
431
+ function renameFile(_x19, _x20) {
268
432
  return _renameFile.apply(this, arguments);
269
433
  }
270
434
 
@@ -273,12 +437,12 @@ var Files = /*#__PURE__*/function () {
273
437
  }, {
274
438
  key: "moveFile",
275
439
  value: function () {
276
- var _moveFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(sourcePath, targetPath) {
277
- return _regenerator["default"].wrap(function _callee5$(_context5) {
440
+ var _moveFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(sourcePath, targetPath) {
441
+ return _regenerator["default"].wrap(function _callee7$(_context7) {
278
442
  while (1) {
279
- switch (_context5.prev = _context5.next) {
443
+ switch (_context7.prev = _context7.next) {
280
444
  case 0:
281
- return _context5.abrupt("return", this.app.request.put({
445
+ return _context7.abrupt("return", this.app.request.put({
282
446
  url: this.app.urls.fileMove(),
283
447
  data: {
284
448
  sourcePath: _utils["default"].ensureSlashInPath(sourcePath),
@@ -288,13 +452,13 @@ var Files = /*#__PURE__*/function () {
288
452
 
289
453
  case 1:
290
454
  case "end":
291
- return _context5.stop();
455
+ return _context7.stop();
292
456
  }
293
457
  }
294
- }, _callee5, this);
458
+ }, _callee7, this);
295
459
  }));
296
460
 
297
- function moveFile(_x15, _x16) {
461
+ function moveFile(_x21, _x22) {
298
462
  return _moveFile.apply(this, arguments);
299
463
  }
300
464
 
@@ -303,12 +467,12 @@ var Files = /*#__PURE__*/function () {
303
467
  }, {
304
468
  key: "copyFile",
305
469
  value: function () {
306
- var _copyFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(sourcePath, targetPath) {
307
- return _regenerator["default"].wrap(function _callee6$(_context6) {
470
+ var _copyFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(sourcePath, targetPath) {
471
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
308
472
  while (1) {
309
- switch (_context6.prev = _context6.next) {
473
+ switch (_context8.prev = _context8.next) {
310
474
  case 0:
311
- return _context6.abrupt("return", this.app.request.put({
475
+ return _context8.abrupt("return", this.app.request.put({
312
476
  url: this.app.urls.fileCopy(),
313
477
  data: {
314
478
  sourcePath: _utils["default"].ensureSlashInPath(sourcePath),
@@ -318,13 +482,13 @@ var Files = /*#__PURE__*/function () {
318
482
 
319
483
  case 1:
320
484
  case "end":
321
- return _context6.stop();
485
+ return _context8.stop();
322
486
  }
323
487
  }
324
- }, _callee6, this);
488
+ }, _callee8, this);
325
489
  }));
326
490
 
327
- function copyFile(_x17, _x18) {
491
+ function copyFile(_x23, _x24) {
328
492
  return _copyFile.apply(this, arguments);
329
493
  }
330
494
 
@@ -333,13 +497,13 @@ var Files = /*#__PURE__*/function () {
333
497
  }, {
334
498
  key: "remove",
335
499
  value: function () {
336
- var _remove = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(filePath) {
337
- return _regenerator["default"].wrap(function _callee7$(_context7) {
500
+ var _remove = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(filePath) {
501
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
338
502
  while (1) {
339
- switch (_context7.prev = _context7.next) {
503
+ switch (_context9.prev = _context9.next) {
340
504
  case 0:
341
505
  if (!(!filePath || typeof filePath !== 'string')) {
342
- _context7.next = 2;
506
+ _context9.next = 2;
343
507
  break;
344
508
  }
345
509
 
@@ -350,19 +514,19 @@ var Files = /*#__PURE__*/function () {
350
514
  filePath = this.app.urls.filePath(filePath);
351
515
  }
352
516
 
353
- return _context7.abrupt("return", this.app.request["delete"]({
517
+ return _context9.abrupt("return", this.app.request["delete"]({
354
518
  url: filePath
355
519
  }));
356
520
 
357
521
  case 4:
358
522
  case "end":
359
- return _context7.stop();
523
+ return _context9.stop();
360
524
  }
361
525
  }
362
- }, _callee7, this);
526
+ }, _callee9, this);
363
527
  }));
364
528
 
365
- function remove(_x19) {
529
+ function remove(_x25) {
366
530
  return _remove.apply(this, arguments);
367
531
  }
368
532
 
@@ -371,21 +535,21 @@ var Files = /*#__PURE__*/function () {
371
535
  }, {
372
536
  key: "exists",
373
537
  value: function () {
374
- var _exists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(filePath) {
375
- return _regenerator["default"].wrap(function _callee8$(_context8) {
538
+ var _exists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(filePath) {
539
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
376
540
  while (1) {
377
- switch (_context8.prev = _context8.next) {
541
+ switch (_context10.prev = _context10.next) {
378
542
  case 0:
379
543
  if (!(!filePath || typeof filePath !== 'string')) {
380
- _context8.next = 2;
544
+ _context10.next = 2;
381
545
  break;
382
546
  }
383
547
 
384
548
  throw new Error('"filePath" must be provided and must be a string.');
385
549
 
386
550
  case 2:
387
- filePath = _utils["default"].preventSlashInPath(filePath);
388
- return _context8.abrupt("return", this.app.request.get({
551
+ filePath = _utils["default"].trimSlashesInPath(filePath);
552
+ return _context10.abrupt("return", this.app.request.get({
389
553
  url: this.app.urls.filePath(filePath),
390
554
  query: {
391
555
  action: 'exists'
@@ -394,13 +558,13 @@ var Files = /*#__PURE__*/function () {
394
558
 
395
559
  case 4:
396
560
  case "end":
397
- return _context8.stop();
561
+ return _context10.stop();
398
562
  }
399
563
  }
400
- }, _callee8, this);
564
+ }, _callee10, this);
401
565
  }));
402
566
 
403
- function exists(_x20) {
567
+ function exists(_x26) {
404
568
  return _exists.apply(this, arguments);
405
569
  }
406
570
 
@@ -409,33 +573,33 @@ var Files = /*#__PURE__*/function () {
409
573
  }, {
410
574
  key: "removeDirectory",
411
575
  value: function () {
412
- var _removeDirectory = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(directoryPath) {
413
- return _regenerator["default"].wrap(function _callee9$(_context9) {
576
+ var _removeDirectory = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(directoryPath) {
577
+ return _regenerator["default"].wrap(function _callee11$(_context11) {
414
578
  while (1) {
415
- switch (_context9.prev = _context9.next) {
579
+ switch (_context11.prev = _context11.next) {
416
580
  case 0:
417
581
  if (!(!directoryPath || typeof directoryPath !== 'string')) {
418
- _context9.next = 2;
582
+ _context11.next = 2;
419
583
  break;
420
584
  }
421
585
 
422
586
  throw new Error('Directory "path" must be provided and must be a string.');
423
587
 
424
588
  case 2:
425
- directoryPath = _utils["default"].preventSlashInPath(directoryPath);
426
- return _context9.abrupt("return", this.app.request["delete"]({
589
+ directoryPath = _utils["default"].trimSlashesInPath(directoryPath);
590
+ return _context11.abrupt("return", this.app.request["delete"]({
427
591
  url: this.app.urls.filePath(directoryPath)
428
592
  }));
429
593
 
430
594
  case 4:
431
595
  case "end":
432
- return _context9.stop();
596
+ return _context11.stop();
433
597
  }
434
598
  }
435
- }, _callee9, this);
599
+ }, _callee11, this);
436
600
  }));
437
601
 
438
- function removeDirectory(_x21) {
602
+ function removeDirectory(_x27) {
439
603
  return _removeDirectory.apply(this, arguments);
440
604
  }
441
605
 
@@ -444,13 +608,13 @@ var Files = /*#__PURE__*/function () {
444
608
  }, {
445
609
  key: "getFileCount",
446
610
  value: function () {
447
- var _getFileCount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(filesPath, pattern, sub, countDirectories) {
448
- return _regenerator["default"].wrap(function _callee10$(_context10) {
611
+ var _getFileCount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(filesPath, pattern, sub, countDirectories) {
612
+ return _regenerator["default"].wrap(function _callee12$(_context12) {
449
613
  while (1) {
450
- switch (_context10.prev = _context10.next) {
614
+ switch (_context12.prev = _context12.next) {
451
615
  case 0:
452
616
  if (!(!filesPath || typeof filesPath !== 'string')) {
453
- _context10.next = 2;
617
+ _context12.next = 2;
454
618
  break;
455
619
  }
456
620
 
@@ -458,15 +622,15 @@ var Files = /*#__PURE__*/function () {
458
622
 
459
623
  case 2:
460
624
  if (!(pattern && typeof pattern !== 'string')) {
461
- _context10.next = 4;
625
+ _context12.next = 4;
462
626
  break;
463
627
  }
464
628
 
465
629
  throw new Error('Files Pattern must be provided and must be a string.');
466
630
 
467
631
  case 4:
468
- filesPath = _utils["default"].preventSlashInPath(filesPath);
469
- return _context10.abrupt("return", this.app.request.get({
632
+ filesPath = _utils["default"].trimSlashesInPath(filesPath);
633
+ return _context12.abrupt("return", this.app.request.get({
470
634
  url: this.app.urls.filePath(filesPath),
471
635
  query: {
472
636
  action: 'count',
@@ -478,13 +642,13 @@ var Files = /*#__PURE__*/function () {
478
642
 
479
643
  case 6:
480
644
  case "end":
481
- return _context10.stop();
645
+ return _context12.stop();
482
646
  }
483
647
  }
484
- }, _callee10, this);
648
+ }, _callee12, this);
485
649
  }));
486
650
 
487
- function getFileCount(_x22, _x23, _x24, _x25) {
651
+ function getFileCount(_x28, _x29, _x30, _x31) {
488
652
  return _getFileCount.apply(this, arguments);
489
653
  }
490
654
 
package/es/files/utils.js CHANGED
@@ -12,11 +12,32 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
12
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
13
 
14
14
  var FilesUtils = {
15
+ isBytesArray: function isBytesArray(data) {
16
+ if (typeof Buffer !== 'undefined' && data instanceof Buffer) {
17
+ return true;
18
+ }
19
+
20
+ if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) {
21
+ return true;
22
+ }
23
+
24
+ return Array.isArray(data);
25
+ },
15
26
  ensureSlashInPath: function ensureSlashInPath(path) {
16
27
  return !path.startsWith('/') ? "/".concat(path) : path;
17
28
  },
18
- preventSlashInPath: function preventSlashInPath(path) {
19
- return path && path.startsWith('/') ? path.slice(1) : path;
29
+ trimSlashesInPath: function trimSlashesInPath(path) {
30
+ if (path) {
31
+ if (path.startsWith('/')) {
32
+ path = path.slice(1);
33
+ }
34
+
35
+ if (path.endsWith('/')) {
36
+ path = path.slice(0, path.length - 1);
37
+ }
38
+ }
39
+
40
+ return path;
20
41
  },
21
42
  parseFilePath: function parseFilePath(path) {
22
43
  var result = {
package/es/index.js CHANGED
@@ -466,7 +466,8 @@ var Backendless = /*#__PURE__*/function () {
466
466
  key: "applicationId",
467
467
  get: function get() {
468
468
  // eslint-disable-next-line no-console
469
- console.warn('getter/setter for Backendless.applicationId is deprecated, instead use Backendless.appId');
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')
470
471
  return this.appId;
471
472
  }
472
473
  /** @deprecated */
@@ -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
  }], [{
@@ -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 9:
267
+ case 10:
264
268
  case "end":
265
269
  return _context4.stop();
266
270
  }
@@ -11,6 +11,8 @@ var OperationType = {
11
11
  UPDATE_BULK: 'UPDATE_BULK',
12
12
  DELETE: 'DELETE',
13
13
  DELETE_BULK: 'DELETE_BULK',
14
+ UPSERT: 'UPSERT',
15
+ UPSERT_BULK: 'UPSERT_BULK',
14
16
  FIND: 'FIND',
15
17
  ADD_RELATION: 'ADD_RELATION',
16
18
  SET_RELATION: 'SET_RELATION',