@bentonow/bento-node-sdk 0.1.13 → 0.1.14

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 (56) hide show
  1. package/README.md +4 -0
  2. package/dist/bento-node-sdk.cjs.development.js +222 -332
  3. package/dist/bento-node-sdk.cjs.development.js.map +1 -1
  4. package/dist/bento-node-sdk.cjs.production.min.js +1 -1
  5. package/dist/bento-node-sdk.cjs.production.min.js.map +1 -1
  6. package/dist/bento-node-sdk.esm.js +222 -332
  7. package/dist/bento-node-sdk.esm.js.map +1 -1
  8. package/dist/index.d.ts +3 -3
  9. package/dist/sdk/batch/errors.d.ts +4 -0
  10. package/dist/sdk/batch/events.d.ts +71 -0
  11. package/dist/sdk/batch/index.d.ts +3 -3
  12. package/dist/sdk/batch/types.d.ts +21 -0
  13. package/dist/sdk/client/errors.d.ts +2 -0
  14. package/dist/sdk/client/index.d.ts +3 -3
  15. package/dist/sdk/client/types.d.ts +3 -0
  16. package/dist/sdk/commands/index.d.ts +3 -3
  17. package/dist/sdk/commands/types.d.ts +32 -0
  18. package/dist/sdk/experimental/index.d.ts +3 -3
  19. package/dist/sdk/experimental/types.d.ts +41 -0
  20. package/dist/sdk/fields/index.d.ts +2 -2
  21. package/dist/sdk/fields/types.d.ts +17 -0
  22. package/dist/sdk/forms/index.d.ts +2 -2
  23. package/dist/sdk/forms/types.d.ts +28 -0
  24. package/dist/sdk/interfaces.d.ts +13 -0
  25. package/dist/sdk/subscribers/index.d.ts +2 -2
  26. package/dist/sdk/subscribers/types.d.ts +25 -0
  27. package/dist/sdk/tags/index.d.ts +2 -2
  28. package/dist/sdk/tags/types.d.ts +17 -0
  29. package/dist/sdk/types.d.ts +41 -0
  30. package/dist/versions/v1/index.d.ts +4 -4
  31. package/dist/versions/v1/types.d.ts +31 -0
  32. package/package.json +5 -3
  33. package/src/index.ts +2 -2
  34. package/src/sdk/batch/errors.ts +27 -4
  35. package/src/sdk/batch/{events.d.ts → events.ts} +4 -5
  36. package/src/sdk/batch/index.ts +38 -50
  37. package/src/sdk/batch/{types.d.ts → types.ts} +2 -2
  38. package/src/sdk/client/errors.ts +13 -2
  39. package/src/sdk/client/index.ts +21 -15
  40. package/src/sdk/client/{types.d.ts → types.ts} +0 -0
  41. package/src/sdk/commands/index.ts +93 -121
  42. package/src/sdk/commands/{types.d.ts → types.ts} +1 -1
  43. package/src/sdk/experimental/index.ts +29 -45
  44. package/src/sdk/experimental/{types.d.ts → types.ts} +1 -1
  45. package/src/sdk/fields/index.ts +11 -19
  46. package/src/sdk/fields/{types.d.ts → types.ts} +1 -1
  47. package/src/sdk/forms/index.ts +11 -15
  48. package/src/sdk/forms/{types.d.ts → types.ts} +3 -3
  49. package/src/sdk/{interfaces.d.ts → interfaces.ts} +0 -0
  50. package/src/sdk/subscribers/index.ts +17 -25
  51. package/src/sdk/subscribers/{types.d.ts → types.ts} +1 -1
  52. package/src/sdk/tags/index.ts +11 -19
  53. package/src/sdk/tags/{types.d.ts → types.ts} +1 -1
  54. package/src/sdk/{types.d.ts → types.ts} +2 -0
  55. package/src/versions/v1/index.ts +65 -86
  56. package/src/versions/v1/{types.d.ts → types.ts} +4 -2
@@ -914,8 +914,16 @@ try {
914
914
  var TooFewSubscribersError = /*#__PURE__*/function (_Error) {
915
915
  _inheritsLoose(TooFewSubscribersError, _Error);
916
916
 
917
- function TooFewSubscribersError() {
918
- return _Error.apply(this, arguments) || this;
917
+ function TooFewSubscribersError(message) {
918
+ var _this;
919
+
920
+ if (message === void 0) {
921
+ message = 'Too few subscribers';
922
+ }
923
+
924
+ _this = _Error.call(this, message) || this;
925
+ _this.name = 'TooFewSubscribersError';
926
+ return _this;
919
927
  }
920
928
 
921
929
  return TooFewSubscribersError;
@@ -923,8 +931,16 @@ var TooFewSubscribersError = /*#__PURE__*/function (_Error) {
923
931
  var TooManySubscribersError = /*#__PURE__*/function (_Error2) {
924
932
  _inheritsLoose(TooManySubscribersError, _Error2);
925
933
 
926
- function TooManySubscribersError() {
927
- return _Error2.apply(this, arguments) || this;
934
+ function TooManySubscribersError(message) {
935
+ var _this2;
936
+
937
+ if (message === void 0) {
938
+ message = 'Too many subscribers';
939
+ }
940
+
941
+ _this2 = _Error2.call(this, message) || this;
942
+ _this2.name = 'TooManySubscribersError';
943
+ return _this2;
928
944
  }
929
945
 
930
946
  return TooManySubscribersError;
@@ -932,8 +948,16 @@ var TooManySubscribersError = /*#__PURE__*/function (_Error2) {
932
948
  var TooFewEventsError = /*#__PURE__*/function (_Error3) {
933
949
  _inheritsLoose(TooFewEventsError, _Error3);
934
950
 
935
- function TooFewEventsError() {
936
- return _Error3.apply(this, arguments) || this;
951
+ function TooFewEventsError(message) {
952
+ var _this3;
953
+
954
+ if (message === void 0) {
955
+ message = 'Too few events';
956
+ }
957
+
958
+ _this3 = _Error3.call(this, message) || this;
959
+ _this3.name = 'TooFewEventsError';
960
+ return _this3;
937
961
  }
938
962
 
939
963
  return TooFewEventsError;
@@ -941,8 +965,16 @@ var TooFewEventsError = /*#__PURE__*/function (_Error3) {
941
965
  var TooManyEventsError = /*#__PURE__*/function (_Error4) {
942
966
  _inheritsLoose(TooManyEventsError, _Error4);
943
967
 
944
- function TooManyEventsError() {
945
- return _Error4.apply(this, arguments) || this;
968
+ function TooManyEventsError(message) {
969
+ var _this4;
970
+
971
+ if (message === void 0) {
972
+ message = 'Too many events';
973
+ }
974
+
975
+ _this4 = _Error4.call(this, message) || this;
976
+ _this4.name = 'TooManyEventsError';
977
+ return _this4;
946
978
  }
947
979
 
948
980
  return TooManyEventsError;
@@ -986,44 +1018,37 @@ var BentoBatch = /*#__PURE__*/function () {
986
1018
  while (1) {
987
1019
  switch (_context.prev = _context.next) {
988
1020
  case 0:
989
- _context.prev = 0;
990
-
991
1021
  if (!(parameters.subscribers.length === 0)) {
992
- _context.next = 3;
1022
+ _context.next = 2;
993
1023
  break;
994
1024
  }
995
1025
 
996
1026
  throw new TooFewSubscribersError("You must send between 1 and 1,000 subscribers.");
997
1027
 
998
- case 3:
1028
+ case 2:
999
1029
  if (!(parameters.subscribers.length > this._maxBatchSize)) {
1000
- _context.next = 5;
1030
+ _context.next = 4;
1001
1031
  break;
1002
1032
  }
1003
1033
 
1004
1034
  throw new TooManySubscribersError("You must send between 1 and 1,000 subscribers.");
1005
1035
 
1006
- case 5:
1007
- _context.next = 7;
1036
+ case 4:
1037
+ _context.next = 6;
1008
1038
  return this._client.post(this._url + "/subscribers", {
1009
1039
  subscribers: parameters.subscribers
1010
1040
  });
1011
1041
 
1012
- case 7:
1042
+ case 6:
1013
1043
  result = _context.sent;
1014
1044
  return _context.abrupt("return", result.results);
1015
1045
 
1016
- case 11:
1017
- _context.prev = 11;
1018
- _context.t0 = _context["catch"](0);
1019
- throw _context.t0;
1020
-
1021
- case 14:
1046
+ case 8:
1022
1047
  case "end":
1023
1048
  return _context.stop();
1024
1049
  }
1025
1050
  }
1026
- }, _callee, this, [[0, 11]]);
1051
+ }, _callee, this);
1027
1052
  }));
1028
1053
 
1029
1054
  function importSubscribers(_x) {
@@ -1054,44 +1079,37 @@ var BentoBatch = /*#__PURE__*/function () {
1054
1079
  while (1) {
1055
1080
  switch (_context2.prev = _context2.next) {
1056
1081
  case 0:
1057
- _context2.prev = 0;
1058
-
1059
1082
  if (!(parameters.events.length === 0)) {
1060
- _context2.next = 3;
1083
+ _context2.next = 2;
1061
1084
  break;
1062
1085
  }
1063
1086
 
1064
1087
  throw new TooFewEventsError("You must send between 1 and 1,000 events.");
1065
1088
 
1066
- case 3:
1089
+ case 2:
1067
1090
  if (!(parameters.events.length > this._maxBatchSize)) {
1068
- _context2.next = 5;
1091
+ _context2.next = 4;
1069
1092
  break;
1070
1093
  }
1071
1094
 
1072
1095
  throw new TooManyEventsError("You must send between 1 and 1,000 events.");
1073
1096
 
1074
- case 5:
1075
- _context2.next = 7;
1097
+ case 4:
1098
+ _context2.next = 6;
1076
1099
  return this._client.post(this._url + "/events", {
1077
1100
  events: parameters.events
1078
1101
  });
1079
1102
 
1080
- case 7:
1103
+ case 6:
1081
1104
  result = _context2.sent;
1082
1105
  return _context2.abrupt("return", result.results);
1083
1106
 
1084
- case 11:
1085
- _context2.prev = 11;
1086
- _context2.t0 = _context2["catch"](0);
1087
- throw _context2.t0;
1088
-
1089
- case 14:
1107
+ case 8:
1090
1108
  case "end":
1091
1109
  return _context2.stop();
1092
1110
  }
1093
1111
  }
1094
- }, _callee2, this, [[0, 11]]);
1112
+ }, _callee2, this);
1095
1113
  }));
1096
1114
 
1097
1115
  function importEvents(_x2) {
@@ -1107,8 +1125,16 @@ var BentoBatch = /*#__PURE__*/function () {
1107
1125
  var NotAuthorizedError = /*#__PURE__*/function (_Error) {
1108
1126
  _inheritsLoose(NotAuthorizedError, _Error);
1109
1127
 
1110
- function NotAuthorizedError() {
1111
- return _Error.apply(this, arguments) || this;
1128
+ function NotAuthorizedError(message) {
1129
+ var _this;
1130
+
1131
+ if (message === void 0) {
1132
+ message = 'Not authorized';
1133
+ }
1134
+
1135
+ _this = _Error.call(this, message) || this;
1136
+ _this.name = 'NotAuthorizedError';
1137
+ return _this;
1112
1138
  }
1113
1139
 
1114
1140
  return NotAuthorizedError;
@@ -1116,8 +1142,16 @@ var NotAuthorizedError = /*#__PURE__*/function (_Error) {
1116
1142
  var RateLimitedError = /*#__PURE__*/function (_Error2) {
1117
1143
  _inheritsLoose(RateLimitedError, _Error2);
1118
1144
 
1119
- function RateLimitedError() {
1120
- return _Error2.apply(this, arguments) || this;
1145
+ function RateLimitedError(message) {
1146
+ var _this2;
1147
+
1148
+ if (message === void 0) {
1149
+ message = 'You are being rate limited';
1150
+ }
1151
+
1152
+ _this2 = _Error2.call(this, message) || this;
1153
+ _this2.name = 'RateLimitedError';
1154
+ return _this2;
1121
1155
  }
1122
1156
 
1123
1157
  return RateLimitedError;
@@ -1346,55 +1380,55 @@ var BentoClient = /*#__PURE__*/function () {
1346
1380
  while (1) {
1347
1381
  switch (_context3.prev = _context3.next) {
1348
1382
  case 0:
1383
+ if (this._logErrors) {
1384
+ console.error(response);
1385
+ }
1386
+
1349
1387
  if (!(response.status === 401)) {
1350
- _context3.next = 2;
1388
+ _context3.next = 3;
1351
1389
  break;
1352
1390
  }
1353
1391
 
1354
1392
  return _context3.abrupt("return", new NotAuthorizedError());
1355
1393
 
1356
- case 2:
1394
+ case 3:
1357
1395
  if (!(response.status === 429)) {
1358
- _context3.next = 4;
1396
+ _context3.next = 5;
1359
1397
  break;
1360
1398
  }
1361
1399
 
1362
1400
  return _context3.abrupt("return", new RateLimitedError());
1363
1401
 
1364
- case 4:
1402
+ case 5:
1365
1403
  contentType = response.headers.get('Content-Type');
1366
1404
  responseMessage = '';
1367
1405
  _context3.t0 = contentType == null ? void 0 : contentType.toLocaleLowerCase();
1368
- _context3.next = _context3.t0 === 'text/plain' ? 9 : _context3.t0 === 'application/json' ? 13 : 19;
1406
+ _context3.next = _context3.t0 === 'text/plain' ? 10 : _context3.t0 === 'application/json' ? 14 : 20;
1369
1407
  break;
1370
1408
 
1371
- case 9:
1372
- _context3.next = 11;
1409
+ case 10:
1410
+ _context3.next = 12;
1373
1411
  return response.text();
1374
1412
 
1375
- case 11:
1413
+ case 12:
1376
1414
  responseMessage = _context3.sent;
1377
- return _context3.abrupt("break", 21);
1415
+ return _context3.abrupt("break", 22);
1378
1416
 
1379
- case 13:
1417
+ case 14:
1380
1418
  _context3.t1 = JSON;
1381
- _context3.next = 16;
1419
+ _context3.next = 17;
1382
1420
  return response.json();
1383
1421
 
1384
- case 16:
1422
+ case 17:
1385
1423
  _context3.t2 = _context3.sent;
1386
1424
  responseMessage = _context3.t1.stringify.call(_context3.t1, _context3.t2);
1387
- return _context3.abrupt("break", 21);
1425
+ return _context3.abrupt("break", 22);
1388
1426
 
1389
- case 19:
1427
+ case 20:
1390
1428
  responseMessage = 'Unknown response from the Bento API.';
1391
- return _context3.abrupt("break", 21);
1392
-
1393
- case 21:
1394
- if (this._logErrors) {
1395
- console.error(response);
1396
- }
1429
+ return _context3.abrupt("break", 22);
1397
1430
 
1431
+ case 22:
1398
1432
  return _context3.abrupt("return", new Error("[" + response.status + "] - " + responseMessage));
1399
1433
 
1400
1434
  case 23:
@@ -1462,8 +1496,7 @@ var BentoCommands = /*#__PURE__*/function () {
1462
1496
  while (1) {
1463
1497
  switch (_context.prev = _context.next) {
1464
1498
  case 0:
1465
- _context.prev = 0;
1466
- _context.next = 3;
1499
+ _context.next = 2;
1467
1500
  return this._client.post(this._url, {
1468
1501
  command: {
1469
1502
  command: CommandTypes.ADD_TAG,
@@ -1472,30 +1505,25 @@ var BentoCommands = /*#__PURE__*/function () {
1472
1505
  }
1473
1506
  });
1474
1507
 
1475
- case 3:
1508
+ case 2:
1476
1509
  result = _context.sent;
1477
1510
 
1478
1511
  if (!(Object.keys(result).length === 0 || !result.data)) {
1479
- _context.next = 6;
1512
+ _context.next = 5;
1480
1513
  break;
1481
1514
  }
1482
1515
 
1483
1516
  return _context.abrupt("return", null);
1484
1517
 
1485
- case 6:
1518
+ case 5:
1486
1519
  return _context.abrupt("return", result.data);
1487
1520
 
1488
- case 9:
1489
- _context.prev = 9;
1490
- _context.t0 = _context["catch"](0);
1491
- throw _context.t0;
1492
-
1493
- case 12:
1521
+ case 6:
1494
1522
  case "end":
1495
1523
  return _context.stop();
1496
1524
  }
1497
1525
  }
1498
- }, _callee, this, [[0, 9]]);
1526
+ }, _callee, this);
1499
1527
  }));
1500
1528
 
1501
1529
  function addTag(_x) {
@@ -1521,8 +1549,7 @@ var BentoCommands = /*#__PURE__*/function () {
1521
1549
  while (1) {
1522
1550
  switch (_context2.prev = _context2.next) {
1523
1551
  case 0:
1524
- _context2.prev = 0;
1525
- _context2.next = 3;
1552
+ _context2.next = 2;
1526
1553
  return this._client.post(this._url, {
1527
1554
  command: {
1528
1555
  command: CommandTypes.REMOVE_TAG,
@@ -1531,30 +1558,25 @@ var BentoCommands = /*#__PURE__*/function () {
1531
1558
  }
1532
1559
  });
1533
1560
 
1534
- case 3:
1561
+ case 2:
1535
1562
  result = _context2.sent;
1536
1563
 
1537
1564
  if (!(Object.keys(result).length === 0 || !result.data)) {
1538
- _context2.next = 6;
1565
+ _context2.next = 5;
1539
1566
  break;
1540
1567
  }
1541
1568
 
1542
1569
  return _context2.abrupt("return", null);
1543
1570
 
1544
- case 6:
1571
+ case 5:
1545
1572
  return _context2.abrupt("return", result.data);
1546
1573
 
1547
- case 9:
1548
- _context2.prev = 9;
1549
- _context2.t0 = _context2["catch"](0);
1550
- throw _context2.t0;
1551
-
1552
- case 12:
1574
+ case 6:
1553
1575
  case "end":
1554
1576
  return _context2.stop();
1555
1577
  }
1556
1578
  }
1557
- }, _callee2, this, [[0, 9]]);
1579
+ }, _callee2, this);
1558
1580
  }));
1559
1581
 
1560
1582
  function removeTag(_x2) {
@@ -1586,8 +1608,7 @@ var BentoCommands = /*#__PURE__*/function () {
1586
1608
  while (1) {
1587
1609
  switch (_context3.prev = _context3.next) {
1588
1610
  case 0:
1589
- _context3.prev = 0;
1590
- _context3.next = 3;
1611
+ _context3.next = 2;
1591
1612
  return this._client.post(this._url, {
1592
1613
  command: {
1593
1614
  command: CommandTypes.ADD_FIELD,
@@ -1596,30 +1617,25 @@ var BentoCommands = /*#__PURE__*/function () {
1596
1617
  }
1597
1618
  });
1598
1619
 
1599
- case 3:
1620
+ case 2:
1600
1621
  result = _context3.sent;
1601
1622
 
1602
1623
  if (!(Object.keys(result).length === 0 || !result.data)) {
1603
- _context3.next = 6;
1624
+ _context3.next = 5;
1604
1625
  break;
1605
1626
  }
1606
1627
 
1607
1628
  return _context3.abrupt("return", null);
1608
1629
 
1609
- case 6:
1630
+ case 5:
1610
1631
  return _context3.abrupt("return", result.data);
1611
1632
 
1612
- case 9:
1613
- _context3.prev = 9;
1614
- _context3.t0 = _context3["catch"](0);
1615
- throw _context3.t0;
1616
-
1617
- case 12:
1633
+ case 6:
1618
1634
  case "end":
1619
1635
  return _context3.stop();
1620
1636
  }
1621
1637
  }
1622
- }, _callee3, this, [[0, 9]]);
1638
+ }, _callee3, this);
1623
1639
  }));
1624
1640
 
1625
1641
  function addField(_x3) {
@@ -1645,8 +1661,7 @@ var BentoCommands = /*#__PURE__*/function () {
1645
1661
  while (1) {
1646
1662
  switch (_context4.prev = _context4.next) {
1647
1663
  case 0:
1648
- _context4.prev = 0;
1649
- _context4.next = 3;
1664
+ _context4.next = 2;
1650
1665
  return this._client.post(this._url, {
1651
1666
  command: {
1652
1667
  command: CommandTypes.REMOVE_FIELD,
@@ -1655,30 +1670,25 @@ var BentoCommands = /*#__PURE__*/function () {
1655
1670
  }
1656
1671
  });
1657
1672
 
1658
- case 3:
1673
+ case 2:
1659
1674
  result = _context4.sent;
1660
1675
 
1661
1676
  if (!(Object.keys(result).length === 0 || !result.data)) {
1662
- _context4.next = 6;
1677
+ _context4.next = 5;
1663
1678
  break;
1664
1679
  }
1665
1680
 
1666
1681
  return _context4.abrupt("return", null);
1667
1682
 
1668
- case 6:
1683
+ case 5:
1669
1684
  return _context4.abrupt("return", result.data);
1670
1685
 
1671
- case 9:
1672
- _context4.prev = 9;
1673
- _context4.t0 = _context4["catch"](0);
1674
- throw _context4.t0;
1675
-
1676
- case 12:
1686
+ case 6:
1677
1687
  case "end":
1678
1688
  return _context4.stop();
1679
1689
  }
1680
1690
  }
1681
- }, _callee4, this, [[0, 9]]);
1691
+ }, _callee4, this);
1682
1692
  }));
1683
1693
 
1684
1694
  function removeField(_x4) {
@@ -1708,8 +1718,7 @@ var BentoCommands = /*#__PURE__*/function () {
1708
1718
  while (1) {
1709
1719
  switch (_context5.prev = _context5.next) {
1710
1720
  case 0:
1711
- _context5.prev = 0;
1712
- _context5.next = 3;
1721
+ _context5.next = 2;
1713
1722
  return this._client.post(this._url, {
1714
1723
  command: {
1715
1724
  command: CommandTypes.SUBSCRIBE,
@@ -1717,30 +1726,25 @@ var BentoCommands = /*#__PURE__*/function () {
1717
1726
  }
1718
1727
  });
1719
1728
 
1720
- case 3:
1729
+ case 2:
1721
1730
  result = _context5.sent;
1722
1731
 
1723
1732
  if (!(Object.keys(result).length === 0 || !result.data)) {
1724
- _context5.next = 6;
1733
+ _context5.next = 5;
1725
1734
  break;
1726
1735
  }
1727
1736
 
1728
1737
  return _context5.abrupt("return", null);
1729
1738
 
1730
- case 6:
1739
+ case 5:
1731
1740
  return _context5.abrupt("return", result.data);
1732
1741
 
1733
- case 9:
1734
- _context5.prev = 9;
1735
- _context5.t0 = _context5["catch"](0);
1736
- throw _context5.t0;
1737
-
1738
- case 12:
1742
+ case 6:
1739
1743
  case "end":
1740
1744
  return _context5.stop();
1741
1745
  }
1742
1746
  }
1743
- }, _callee5, this, [[0, 9]]);
1747
+ }, _callee5, this);
1744
1748
  }));
1745
1749
 
1746
1750
  function subscribe(_x5) {
@@ -1771,8 +1775,7 @@ var BentoCommands = /*#__PURE__*/function () {
1771
1775
  while (1) {
1772
1776
  switch (_context6.prev = _context6.next) {
1773
1777
  case 0:
1774
- _context6.prev = 0;
1775
- _context6.next = 3;
1778
+ _context6.next = 2;
1776
1779
  return this._client.post(this._url, {
1777
1780
  command: {
1778
1781
  command: CommandTypes.UNSUBSCRIBE,
@@ -1780,30 +1783,25 @@ var BentoCommands = /*#__PURE__*/function () {
1780
1783
  }
1781
1784
  });
1782
1785
 
1783
- case 3:
1786
+ case 2:
1784
1787
  result = _context6.sent;
1785
1788
 
1786
1789
  if (!(Object.keys(result).length === 0 || !result.data)) {
1787
- _context6.next = 6;
1790
+ _context6.next = 5;
1788
1791
  break;
1789
1792
  }
1790
1793
 
1791
1794
  return _context6.abrupt("return", null);
1792
1795
 
1793
- case 6:
1796
+ case 5:
1794
1797
  return _context6.abrupt("return", result.data);
1795
1798
 
1796
- case 9:
1797
- _context6.prev = 9;
1798
- _context6.t0 = _context6["catch"](0);
1799
- throw _context6.t0;
1800
-
1801
- case 12:
1799
+ case 6:
1802
1800
  case "end":
1803
1801
  return _context6.stop();
1804
1802
  }
1805
1803
  }
1806
- }, _callee6, this, [[0, 9]]);
1804
+ }, _callee6, this);
1807
1805
  }));
1808
1806
 
1809
1807
  function unsubscribe(_x6) {
@@ -1829,8 +1827,7 @@ var BentoCommands = /*#__PURE__*/function () {
1829
1827
  while (1) {
1830
1828
  switch (_context7.prev = _context7.next) {
1831
1829
  case 0:
1832
- _context7.prev = 0;
1833
- _context7.next = 3;
1830
+ _context7.next = 2;
1834
1831
  return this._client.post(this._url, {
1835
1832
  command: {
1836
1833
  command: CommandTypes.CHANGE_EMAIL,
@@ -1839,30 +1836,25 @@ var BentoCommands = /*#__PURE__*/function () {
1839
1836
  }
1840
1837
  });
1841
1838
 
1842
- case 3:
1839
+ case 2:
1843
1840
  result = _context7.sent;
1844
1841
 
1845
1842
  if (!(Object.keys(result).length === 0 || !result.data)) {
1846
- _context7.next = 6;
1843
+ _context7.next = 5;
1847
1844
  break;
1848
1845
  }
1849
1846
 
1850
1847
  return _context7.abrupt("return", null);
1851
1848
 
1852
- case 6:
1849
+ case 5:
1853
1850
  return _context7.abrupt("return", result.data);
1854
1851
 
1855
- case 9:
1856
- _context7.prev = 9;
1857
- _context7.t0 = _context7["catch"](0);
1858
- throw _context7.t0;
1859
-
1860
- case 12:
1852
+ case 6:
1861
1853
  case "end":
1862
1854
  return _context7.stop();
1863
1855
  }
1864
1856
  }
1865
- }, _callee7, this, [[0, 9]]);
1857
+ }, _callee7, this);
1866
1858
  }));
1867
1859
 
1868
1860
  function changeEmail(_x7) {
@@ -1907,8 +1899,7 @@ var BentoExperimental = /*#__PURE__*/function () {
1907
1899
  while (1) {
1908
1900
  switch (_context.prev = _context.next) {
1909
1901
  case 0:
1910
- _context.prev = 0;
1911
- _context.next = 3;
1902
+ _context.next = 2;
1912
1903
  return this._client.post(this._url + "/validation", {
1913
1904
  email: parameters.email,
1914
1905
  ip: parameters.ip,
@@ -1916,21 +1907,16 @@ var BentoExperimental = /*#__PURE__*/function () {
1916
1907
  user_agent: parameters.userAgent
1917
1908
  });
1918
1909
 
1919
- case 3:
1910
+ case 2:
1920
1911
  result = _context.sent;
1921
1912
  return _context.abrupt("return", result.valid);
1922
1913
 
1923
- case 7:
1924
- _context.prev = 7;
1925
- _context.t0 = _context["catch"](0);
1926
- throw _context.t0;
1927
-
1928
- case 10:
1914
+ case 4:
1929
1915
  case "end":
1930
1916
  return _context.stop();
1931
1917
  }
1932
1918
  }
1933
- }, _callee, this, [[0, 7]]);
1919
+ }, _callee, this);
1934
1920
  }));
1935
1921
 
1936
1922
  function validateEmail(_x) {
@@ -1963,25 +1949,19 @@ var BentoExperimental = /*#__PURE__*/function () {
1963
1949
  while (1) {
1964
1950
  switch (_context2.prev = _context2.next) {
1965
1951
  case 0:
1966
- _context2.prev = 0;
1967
- _context2.next = 3;
1952
+ _context2.next = 2;
1968
1953
  return this._client.post(this._url + "/gender", parameters);
1969
1954
 
1970
- case 3:
1955
+ case 2:
1971
1956
  result = _context2.sent;
1972
1957
  return _context2.abrupt("return", result);
1973
1958
 
1974
- case 7:
1975
- _context2.prev = 7;
1976
- _context2.t0 = _context2["catch"](0);
1977
- throw _context2.t0;
1978
-
1979
- case 10:
1959
+ case 4:
1980
1960
  case "end":
1981
1961
  return _context2.stop();
1982
1962
  }
1983
1963
  }
1984
- }, _callee2, this, [[0, 7]]);
1964
+ }, _callee2, this);
1985
1965
  }));
1986
1966
 
1987
1967
  function guessGender(_x2) {
@@ -2010,34 +1990,28 @@ var BentoExperimental = /*#__PURE__*/function () {
2010
1990
  while (1) {
2011
1991
  switch (_context3.prev = _context3.next) {
2012
1992
  case 0:
2013
- _context3.prev = 0;
2014
- _context3.next = 3;
1993
+ _context3.next = 2;
2015
1994
  return this._client.get(this._url + "/geolocation", parameters);
2016
1995
 
2017
- case 3:
1996
+ case 2:
2018
1997
  result = _context3.sent;
2019
1998
 
2020
1999
  if (!(Object.keys(result).length === 0)) {
2021
- _context3.next = 6;
2000
+ _context3.next = 5;
2022
2001
  break;
2023
2002
  }
2024
2003
 
2025
2004
  return _context3.abrupt("return", null);
2026
2005
 
2027
- case 6:
2006
+ case 5:
2028
2007
  return _context3.abrupt("return", result);
2029
2008
 
2030
- case 9:
2031
- _context3.prev = 9;
2032
- _context3.t0 = _context3["catch"](0);
2033
- throw _context3.t0;
2034
-
2035
- case 12:
2009
+ case 6:
2036
2010
  case "end":
2037
2011
  return _context3.stop();
2038
2012
  }
2039
2013
  }
2040
- }, _callee3, this, [[0, 9]]);
2014
+ }, _callee3, this);
2041
2015
  }));
2042
2016
 
2043
2017
  function geolocate(_x3) {
@@ -2067,25 +2041,19 @@ var BentoExperimental = /*#__PURE__*/function () {
2067
2041
  while (1) {
2068
2042
  switch (_context4.prev = _context4.next) {
2069
2043
  case 0:
2070
- _context4.prev = 0;
2071
- _context4.next = 3;
2044
+ _context4.next = 2;
2072
2045
  return this._client.get(this._url + "/blacklist.json", parameters);
2073
2046
 
2074
- case 3:
2047
+ case 2:
2075
2048
  result = _context4.sent;
2076
2049
  return _context4.abrupt("return", result);
2077
2050
 
2078
- case 7:
2079
- _context4.prev = 7;
2080
- _context4.t0 = _context4["catch"](0);
2081
- throw _context4.t0;
2082
-
2083
- case 10:
2051
+ case 4:
2084
2052
  case "end":
2085
2053
  return _context4.stop();
2086
2054
  }
2087
2055
  }
2088
- }, _callee4, this, [[0, 7]]);
2056
+ }, _callee4, this);
2089
2057
  }));
2090
2058
 
2091
2059
  function checkBlacklist(_x4) {
@@ -2122,34 +2090,28 @@ var BentoFields = /*#__PURE__*/function () {
2122
2090
  while (1) {
2123
2091
  switch (_context.prev = _context.next) {
2124
2092
  case 0:
2125
- _context.prev = 0;
2126
- _context.next = 3;
2093
+ _context.next = 2;
2127
2094
  return this._client.get(this._url);
2128
2095
 
2129
- case 3:
2096
+ case 2:
2130
2097
  result = _context.sent;
2131
2098
 
2132
2099
  if (!(Object.keys(result).length === 0 || !result.data)) {
2133
- _context.next = 6;
2100
+ _context.next = 5;
2134
2101
  break;
2135
2102
  }
2136
2103
 
2137
2104
  return _context.abrupt("return", null);
2138
2105
 
2139
- case 6:
2106
+ case 5:
2140
2107
  return _context.abrupt("return", result.data);
2141
2108
 
2142
- case 9:
2143
- _context.prev = 9;
2144
- _context.t0 = _context["catch"](0);
2145
- throw _context.t0;
2146
-
2147
- case 12:
2109
+ case 6:
2148
2110
  case "end":
2149
2111
  return _context.stop();
2150
2112
  }
2151
2113
  }
2152
- }, _callee, this, [[0, 9]]);
2114
+ }, _callee, this);
2153
2115
  }));
2154
2116
 
2155
2117
  function getFields() {
@@ -2184,36 +2146,30 @@ var BentoFields = /*#__PURE__*/function () {
2184
2146
  while (1) {
2185
2147
  switch (_context2.prev = _context2.next) {
2186
2148
  case 0:
2187
- _context2.prev = 0;
2188
- _context2.next = 3;
2149
+ _context2.next = 2;
2189
2150
  return this._client.post(this._url, {
2190
2151
  field: parameters
2191
2152
  });
2192
2153
 
2193
- case 3:
2154
+ case 2:
2194
2155
  result = _context2.sent;
2195
2156
 
2196
2157
  if (!(Object.keys(result).length === 0 || !result.data)) {
2197
- _context2.next = 6;
2158
+ _context2.next = 5;
2198
2159
  break;
2199
2160
  }
2200
2161
 
2201
2162
  return _context2.abrupt("return", null);
2202
2163
 
2203
- case 6:
2164
+ case 5:
2204
2165
  return _context2.abrupt("return", result.data);
2205
2166
 
2206
- case 9:
2207
- _context2.prev = 9;
2208
- _context2.t0 = _context2["catch"](0);
2209
- throw _context2.t0;
2210
-
2211
- case 12:
2167
+ case 6:
2212
2168
  case "end":
2213
2169
  return _context2.stop();
2214
2170
  }
2215
2171
  }
2216
- }, _callee2, this, [[0, 9]]);
2172
+ }, _callee2, this);
2217
2173
  }));
2218
2174
 
2219
2175
  function createField(_x) {
@@ -2251,36 +2207,30 @@ var BentoForms = /*#__PURE__*/function () {
2251
2207
  while (1) {
2252
2208
  switch (_context.prev = _context.next) {
2253
2209
  case 0:
2254
- _context.prev = 0;
2255
- _context.next = 3;
2210
+ _context.next = 2;
2256
2211
  return this._client.get(this._url, {
2257
2212
  id: formIdentifier
2258
2213
  });
2259
2214
 
2260
- case 3:
2215
+ case 2:
2261
2216
  result = _context.sent;
2262
2217
 
2263
2218
  if (!(Object.keys(result).length === 0 || !result.data)) {
2264
- _context.next = 6;
2219
+ _context.next = 5;
2265
2220
  break;
2266
2221
  }
2267
2222
 
2268
2223
  return _context.abrupt("return", null);
2269
2224
 
2270
- case 6:
2225
+ case 5:
2271
2226
  return _context.abrupt("return", result.data);
2272
2227
 
2273
- case 9:
2274
- _context.prev = 9;
2275
- _context.t0 = _context["catch"](0);
2276
- throw _context.t0;
2277
-
2278
- case 12:
2228
+ case 6:
2279
2229
  case "end":
2280
2230
  return _context.stop();
2281
2231
  }
2282
2232
  }
2283
- }, _callee, this, [[0, 9]]);
2233
+ }, _callee, this);
2284
2234
  }));
2285
2235
 
2286
2236
  function getResponses(_x) {
@@ -2317,34 +2267,28 @@ var BentoSubscribers = /*#__PURE__*/function () {
2317
2267
  while (1) {
2318
2268
  switch (_context.prev = _context.next) {
2319
2269
  case 0:
2320
- _context.prev = 0;
2321
- _context.next = 3;
2270
+ _context.next = 2;
2322
2271
  return this._client.get(this._url, parameters);
2323
2272
 
2324
- case 3:
2273
+ case 2:
2325
2274
  result = _context.sent;
2326
2275
 
2327
2276
  if (!(Object.keys(result).length === 0 || !result.data)) {
2328
- _context.next = 6;
2277
+ _context.next = 5;
2329
2278
  break;
2330
2279
  }
2331
2280
 
2332
2281
  return _context.abrupt("return", null);
2333
2282
 
2334
- case 6:
2283
+ case 5:
2335
2284
  return _context.abrupt("return", result.data);
2336
2285
 
2337
- case 9:
2338
- _context.prev = 9;
2339
- _context.t0 = _context["catch"](0);
2340
- throw _context.t0;
2341
-
2342
- case 12:
2286
+ case 6:
2343
2287
  case "end":
2344
2288
  return _context.stop();
2345
2289
  }
2346
2290
  }
2347
- }, _callee, this, [[0, 9]]);
2291
+ }, _callee, this);
2348
2292
  }));
2349
2293
 
2350
2294
  function getSubscribers(_x) {
@@ -2370,36 +2314,30 @@ var BentoSubscribers = /*#__PURE__*/function () {
2370
2314
  while (1) {
2371
2315
  switch (_context2.prev = _context2.next) {
2372
2316
  case 0:
2373
- _context2.prev = 0;
2374
- _context2.next = 3;
2317
+ _context2.next = 2;
2375
2318
  return this._client.post(this._url, {
2376
2319
  subscriber: parameters
2377
2320
  });
2378
2321
 
2379
- case 3:
2322
+ case 2:
2380
2323
  result = _context2.sent;
2381
2324
 
2382
2325
  if (!(Object.keys(result).length === 0 || !result.data)) {
2383
- _context2.next = 6;
2326
+ _context2.next = 5;
2384
2327
  break;
2385
2328
  }
2386
2329
 
2387
2330
  return _context2.abrupt("return", null);
2388
2331
 
2389
- case 6:
2332
+ case 5:
2390
2333
  return _context2.abrupt("return", result.data);
2391
2334
 
2392
- case 9:
2393
- _context2.prev = 9;
2394
- _context2.t0 = _context2["catch"](0);
2395
- throw _context2.t0;
2396
-
2397
- case 12:
2335
+ case 6:
2398
2336
  case "end":
2399
2337
  return _context2.stop();
2400
2338
  }
2401
2339
  }
2402
- }, _callee2, this, [[0, 9]]);
2340
+ }, _callee2, this);
2403
2341
  }));
2404
2342
 
2405
2343
  function createSubscriber(_x2) {
@@ -2436,34 +2374,28 @@ var BentoTags = /*#__PURE__*/function () {
2436
2374
  while (1) {
2437
2375
  switch (_context.prev = _context.next) {
2438
2376
  case 0:
2439
- _context.prev = 0;
2440
- _context.next = 3;
2377
+ _context.next = 2;
2441
2378
  return this._client.get(this._url);
2442
2379
 
2443
- case 3:
2380
+ case 2:
2444
2381
  result = _context.sent;
2445
2382
 
2446
2383
  if (!(Object.keys(result).length === 0 || !result.data)) {
2447
- _context.next = 6;
2384
+ _context.next = 5;
2448
2385
  break;
2449
2386
  }
2450
2387
 
2451
2388
  return _context.abrupt("return", null);
2452
2389
 
2453
- case 6:
2390
+ case 5:
2454
2391
  return _context.abrupt("return", result.data);
2455
2392
 
2456
- case 9:
2457
- _context.prev = 9;
2458
- _context.t0 = _context["catch"](0);
2459
- throw _context.t0;
2460
-
2461
- case 12:
2393
+ case 6:
2462
2394
  case "end":
2463
2395
  return _context.stop();
2464
2396
  }
2465
2397
  }
2466
- }, _callee, this, [[0, 9]]);
2398
+ }, _callee, this);
2467
2399
  }));
2468
2400
 
2469
2401
  function getTags() {
@@ -2489,36 +2421,30 @@ var BentoTags = /*#__PURE__*/function () {
2489
2421
  while (1) {
2490
2422
  switch (_context2.prev = _context2.next) {
2491
2423
  case 0:
2492
- _context2.prev = 0;
2493
- _context2.next = 3;
2424
+ _context2.next = 2;
2494
2425
  return this._client.post(this._url, {
2495
2426
  tag: parameters
2496
2427
  });
2497
2428
 
2498
- case 3:
2429
+ case 2:
2499
2430
  result = _context2.sent;
2500
2431
 
2501
2432
  if (!(Object.keys(result).length === 0 || !result.data)) {
2502
- _context2.next = 6;
2433
+ _context2.next = 5;
2503
2434
  break;
2504
2435
  }
2505
2436
 
2506
2437
  return _context2.abrupt("return", null);
2507
2438
 
2508
- case 6:
2439
+ case 5:
2509
2440
  return _context2.abrupt("return", result.data);
2510
2441
 
2511
- case 9:
2512
- _context2.prev = 9;
2513
- _context2.t0 = _context2["catch"](0);
2514
- throw _context2.t0;
2515
-
2516
- case 12:
2442
+ case 6:
2517
2443
  case "end":
2518
2444
  return _context2.stop();
2519
2445
  }
2520
2446
  }
2521
- }, _callee2, this, [[0, 9]]);
2447
+ }, _callee2, this);
2522
2448
  }));
2523
2449
 
2524
2450
  function createTag(_x) {
@@ -2591,8 +2517,7 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2591
2517
  while (1) {
2592
2518
  switch (_context.prev = _context.next) {
2593
2519
  case 0:
2594
- _context.prev = 0;
2595
- _context.next = 3;
2520
+ _context.next = 2;
2596
2521
  return this.Batch.importEvents({
2597
2522
  events: [{
2598
2523
  date: parameters.date,
@@ -2604,21 +2529,16 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2604
2529
  }]
2605
2530
  });
2606
2531
 
2607
- case 3:
2532
+ case 2:
2608
2533
  result = _context.sent;
2609
2534
  return _context.abrupt("return", result === 1);
2610
2535
 
2611
- case 7:
2612
- _context.prev = 7;
2613
- _context.t0 = _context["catch"](0);
2614
- throw _context.t0;
2615
-
2616
- case 10:
2536
+ case 4:
2617
2537
  case "end":
2618
2538
  return _context.stop();
2619
2539
  }
2620
2540
  }
2621
- }, _callee, this, [[0, 7]]);
2541
+ }, _callee, this);
2622
2542
  }));
2623
2543
 
2624
2544
  function tagSubscriber(_x) {
@@ -2658,8 +2578,7 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2658
2578
  while (1) {
2659
2579
  switch (_context2.prev = _context2.next) {
2660
2580
  case 0:
2661
- _context2.prev = 0;
2662
- _context2.next = 3;
2581
+ _context2.next = 2;
2663
2582
  return this.Batch.importEvents({
2664
2583
  events: [{
2665
2584
  date: parameters.date,
@@ -2669,21 +2588,16 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2669
2588
  }]
2670
2589
  });
2671
2590
 
2672
- case 3:
2591
+ case 2:
2673
2592
  result = _context2.sent;
2674
2593
  return _context2.abrupt("return", result === 1);
2675
2594
 
2676
- case 7:
2677
- _context2.prev = 7;
2678
- _context2.t0 = _context2["catch"](0);
2679
- throw _context2.t0;
2680
-
2681
- case 10:
2595
+ case 4:
2682
2596
  case "end":
2683
2597
  return _context2.stop();
2684
2598
  }
2685
2599
  }
2686
- }, _callee2, this, [[0, 7]]);
2600
+ }, _callee2, this);
2687
2601
  }));
2688
2602
 
2689
2603
  function addSubscriber(_x2) {
@@ -2722,8 +2636,7 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2722
2636
  while (1) {
2723
2637
  switch (_context3.prev = _context3.next) {
2724
2638
  case 0:
2725
- _context3.prev = 0;
2726
- _context3.next = 3;
2639
+ _context3.next = 2;
2727
2640
  return this.Batch.importEvents({
2728
2641
  events: [{
2729
2642
  date: parameters.date,
@@ -2732,21 +2645,16 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2732
2645
  }]
2733
2646
  });
2734
2647
 
2735
- case 3:
2648
+ case 2:
2736
2649
  result = _context3.sent;
2737
2650
  return _context3.abrupt("return", result === 1);
2738
2651
 
2739
- case 7:
2740
- _context3.prev = 7;
2741
- _context3.t0 = _context3["catch"](0);
2742
- throw _context3.t0;
2743
-
2744
- case 10:
2652
+ case 4:
2745
2653
  case "end":
2746
2654
  return _context3.stop();
2747
2655
  }
2748
2656
  }
2749
- }, _callee3, this, [[0, 7]]);
2657
+ }, _callee3, this);
2750
2658
  }));
2751
2659
 
2752
2660
  function removeSubscriber(_x3) {
@@ -2785,8 +2693,7 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2785
2693
  while (1) {
2786
2694
  switch (_context4.prev = _context4.next) {
2787
2695
  case 0:
2788
- _context4.prev = 0;
2789
- _context4.next = 3;
2696
+ _context4.next = 2;
2790
2697
  return this.Batch.importEvents({
2791
2698
  events: [{
2792
2699
  date: parameters.date,
@@ -2796,21 +2703,16 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2796
2703
  }]
2797
2704
  });
2798
2705
 
2799
- case 3:
2706
+ case 2:
2800
2707
  result = _context4.sent;
2801
2708
  return _context4.abrupt("return", result === 1);
2802
2709
 
2803
- case 7:
2804
- _context4.prev = 7;
2805
- _context4.t0 = _context4["catch"](0);
2806
- throw _context4.t0;
2807
-
2808
- case 10:
2710
+ case 4:
2809
2711
  case "end":
2810
2712
  return _context4.stop();
2811
2713
  }
2812
2714
  }
2813
- }, _callee4, this, [[0, 7]]);
2715
+ }, _callee4, this);
2814
2716
  }));
2815
2717
 
2816
2718
  function updateFields(_x4) {
@@ -2848,8 +2750,7 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2848
2750
  while (1) {
2849
2751
  switch (_context5.prev = _context5.next) {
2850
2752
  case 0:
2851
- _context5.prev = 0;
2852
- _context5.next = 3;
2753
+ _context5.next = 2;
2853
2754
  return this.Batch.importEvents({
2854
2755
  events: [{
2855
2756
  date: parameters.date,
@@ -2859,21 +2760,16 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2859
2760
  }]
2860
2761
  });
2861
2762
 
2862
- case 3:
2763
+ case 2:
2863
2764
  result = _context5.sent;
2864
2765
  return _context5.abrupt("return", result === 1);
2865
2766
 
2866
- case 7:
2867
- _context5.prev = 7;
2868
- _context5.t0 = _context5["catch"](0);
2869
- throw _context5.t0;
2870
-
2871
- case 10:
2767
+ case 4:
2872
2768
  case "end":
2873
2769
  return _context5.stop();
2874
2770
  }
2875
2771
  }
2876
- }, _callee5, this, [[0, 7]]);
2772
+ }, _callee5, this);
2877
2773
  }));
2878
2774
 
2879
2775
  function trackPurchase(_x5) {
@@ -2910,27 +2806,21 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2910
2806
  while (1) {
2911
2807
  switch (_context6.prev = _context6.next) {
2912
2808
  case 0:
2913
- _context6.prev = 0;
2914
- _context6.next = 3;
2809
+ _context6.next = 2;
2915
2810
  return this.Batch.importEvents({
2916
2811
  events: [parameters]
2917
2812
  });
2918
2813
 
2919
- case 3:
2814
+ case 2:
2920
2815
  result = _context6.sent;
2921
2816
  return _context6.abrupt("return", result === 1);
2922
2817
 
2923
- case 7:
2924
- _context6.prev = 7;
2925
- _context6.t0 = _context6["catch"](0);
2926
- throw _context6.t0;
2927
-
2928
- case 10:
2818
+ case 4:
2929
2819
  case "end":
2930
2820
  return _context6.stop();
2931
2821
  }
2932
2822
  }
2933
- }, _callee6, this, [[0, 7]]);
2823
+ }, _callee6, this);
2934
2824
  }));
2935
2825
 
2936
2826
  function track(_x6) {