@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
@@ -908,8 +908,16 @@ try {
908
908
  var TooFewSubscribersError = /*#__PURE__*/function (_Error) {
909
909
  _inheritsLoose(TooFewSubscribersError, _Error);
910
910
 
911
- function TooFewSubscribersError() {
912
- return _Error.apply(this, arguments) || this;
911
+ function TooFewSubscribersError(message) {
912
+ var _this;
913
+
914
+ if (message === void 0) {
915
+ message = 'Too few subscribers';
916
+ }
917
+
918
+ _this = _Error.call(this, message) || this;
919
+ _this.name = 'TooFewSubscribersError';
920
+ return _this;
913
921
  }
914
922
 
915
923
  return TooFewSubscribersError;
@@ -917,8 +925,16 @@ var TooFewSubscribersError = /*#__PURE__*/function (_Error) {
917
925
  var TooManySubscribersError = /*#__PURE__*/function (_Error2) {
918
926
  _inheritsLoose(TooManySubscribersError, _Error2);
919
927
 
920
- function TooManySubscribersError() {
921
- return _Error2.apply(this, arguments) || this;
928
+ function TooManySubscribersError(message) {
929
+ var _this2;
930
+
931
+ if (message === void 0) {
932
+ message = 'Too many subscribers';
933
+ }
934
+
935
+ _this2 = _Error2.call(this, message) || this;
936
+ _this2.name = 'TooManySubscribersError';
937
+ return _this2;
922
938
  }
923
939
 
924
940
  return TooManySubscribersError;
@@ -926,8 +942,16 @@ var TooManySubscribersError = /*#__PURE__*/function (_Error2) {
926
942
  var TooFewEventsError = /*#__PURE__*/function (_Error3) {
927
943
  _inheritsLoose(TooFewEventsError, _Error3);
928
944
 
929
- function TooFewEventsError() {
930
- return _Error3.apply(this, arguments) || this;
945
+ function TooFewEventsError(message) {
946
+ var _this3;
947
+
948
+ if (message === void 0) {
949
+ message = 'Too few events';
950
+ }
951
+
952
+ _this3 = _Error3.call(this, message) || this;
953
+ _this3.name = 'TooFewEventsError';
954
+ return _this3;
931
955
  }
932
956
 
933
957
  return TooFewEventsError;
@@ -935,8 +959,16 @@ var TooFewEventsError = /*#__PURE__*/function (_Error3) {
935
959
  var TooManyEventsError = /*#__PURE__*/function (_Error4) {
936
960
  _inheritsLoose(TooManyEventsError, _Error4);
937
961
 
938
- function TooManyEventsError() {
939
- return _Error4.apply(this, arguments) || this;
962
+ function TooManyEventsError(message) {
963
+ var _this4;
964
+
965
+ if (message === void 0) {
966
+ message = 'Too many events';
967
+ }
968
+
969
+ _this4 = _Error4.call(this, message) || this;
970
+ _this4.name = 'TooManyEventsError';
971
+ return _this4;
940
972
  }
941
973
 
942
974
  return TooManyEventsError;
@@ -980,44 +1012,37 @@ var BentoBatch = /*#__PURE__*/function () {
980
1012
  while (1) {
981
1013
  switch (_context.prev = _context.next) {
982
1014
  case 0:
983
- _context.prev = 0;
984
-
985
1015
  if (!(parameters.subscribers.length === 0)) {
986
- _context.next = 3;
1016
+ _context.next = 2;
987
1017
  break;
988
1018
  }
989
1019
 
990
1020
  throw new TooFewSubscribersError("You must send between 1 and 1,000 subscribers.");
991
1021
 
992
- case 3:
1022
+ case 2:
993
1023
  if (!(parameters.subscribers.length > this._maxBatchSize)) {
994
- _context.next = 5;
1024
+ _context.next = 4;
995
1025
  break;
996
1026
  }
997
1027
 
998
1028
  throw new TooManySubscribersError("You must send between 1 and 1,000 subscribers.");
999
1029
 
1000
- case 5:
1001
- _context.next = 7;
1030
+ case 4:
1031
+ _context.next = 6;
1002
1032
  return this._client.post(this._url + "/subscribers", {
1003
1033
  subscribers: parameters.subscribers
1004
1034
  });
1005
1035
 
1006
- case 7:
1036
+ case 6:
1007
1037
  result = _context.sent;
1008
1038
  return _context.abrupt("return", result.results);
1009
1039
 
1010
- case 11:
1011
- _context.prev = 11;
1012
- _context.t0 = _context["catch"](0);
1013
- throw _context.t0;
1014
-
1015
- case 14:
1040
+ case 8:
1016
1041
  case "end":
1017
1042
  return _context.stop();
1018
1043
  }
1019
1044
  }
1020
- }, _callee, this, [[0, 11]]);
1045
+ }, _callee, this);
1021
1046
  }));
1022
1047
 
1023
1048
  function importSubscribers(_x) {
@@ -1048,44 +1073,37 @@ var BentoBatch = /*#__PURE__*/function () {
1048
1073
  while (1) {
1049
1074
  switch (_context2.prev = _context2.next) {
1050
1075
  case 0:
1051
- _context2.prev = 0;
1052
-
1053
1076
  if (!(parameters.events.length === 0)) {
1054
- _context2.next = 3;
1077
+ _context2.next = 2;
1055
1078
  break;
1056
1079
  }
1057
1080
 
1058
1081
  throw new TooFewEventsError("You must send between 1 and 1,000 events.");
1059
1082
 
1060
- case 3:
1083
+ case 2:
1061
1084
  if (!(parameters.events.length > this._maxBatchSize)) {
1062
- _context2.next = 5;
1085
+ _context2.next = 4;
1063
1086
  break;
1064
1087
  }
1065
1088
 
1066
1089
  throw new TooManyEventsError("You must send between 1 and 1,000 events.");
1067
1090
 
1068
- case 5:
1069
- _context2.next = 7;
1091
+ case 4:
1092
+ _context2.next = 6;
1070
1093
  return this._client.post(this._url + "/events", {
1071
1094
  events: parameters.events
1072
1095
  });
1073
1096
 
1074
- case 7:
1097
+ case 6:
1075
1098
  result = _context2.sent;
1076
1099
  return _context2.abrupt("return", result.results);
1077
1100
 
1078
- case 11:
1079
- _context2.prev = 11;
1080
- _context2.t0 = _context2["catch"](0);
1081
- throw _context2.t0;
1082
-
1083
- case 14:
1101
+ case 8:
1084
1102
  case "end":
1085
1103
  return _context2.stop();
1086
1104
  }
1087
1105
  }
1088
- }, _callee2, this, [[0, 11]]);
1106
+ }, _callee2, this);
1089
1107
  }));
1090
1108
 
1091
1109
  function importEvents(_x2) {
@@ -1101,8 +1119,16 @@ var BentoBatch = /*#__PURE__*/function () {
1101
1119
  var NotAuthorizedError = /*#__PURE__*/function (_Error) {
1102
1120
  _inheritsLoose(NotAuthorizedError, _Error);
1103
1121
 
1104
- function NotAuthorizedError() {
1105
- return _Error.apply(this, arguments) || this;
1122
+ function NotAuthorizedError(message) {
1123
+ var _this;
1124
+
1125
+ if (message === void 0) {
1126
+ message = 'Not authorized';
1127
+ }
1128
+
1129
+ _this = _Error.call(this, message) || this;
1130
+ _this.name = 'NotAuthorizedError';
1131
+ return _this;
1106
1132
  }
1107
1133
 
1108
1134
  return NotAuthorizedError;
@@ -1110,8 +1136,16 @@ var NotAuthorizedError = /*#__PURE__*/function (_Error) {
1110
1136
  var RateLimitedError = /*#__PURE__*/function (_Error2) {
1111
1137
  _inheritsLoose(RateLimitedError, _Error2);
1112
1138
 
1113
- function RateLimitedError() {
1114
- return _Error2.apply(this, arguments) || this;
1139
+ function RateLimitedError(message) {
1140
+ var _this2;
1141
+
1142
+ if (message === void 0) {
1143
+ message = 'You are being rate limited';
1144
+ }
1145
+
1146
+ _this2 = _Error2.call(this, message) || this;
1147
+ _this2.name = 'RateLimitedError';
1148
+ return _this2;
1115
1149
  }
1116
1150
 
1117
1151
  return RateLimitedError;
@@ -1340,55 +1374,55 @@ var BentoClient = /*#__PURE__*/function () {
1340
1374
  while (1) {
1341
1375
  switch (_context3.prev = _context3.next) {
1342
1376
  case 0:
1377
+ if (this._logErrors) {
1378
+ console.error(response);
1379
+ }
1380
+
1343
1381
  if (!(response.status === 401)) {
1344
- _context3.next = 2;
1382
+ _context3.next = 3;
1345
1383
  break;
1346
1384
  }
1347
1385
 
1348
1386
  return _context3.abrupt("return", new NotAuthorizedError());
1349
1387
 
1350
- case 2:
1388
+ case 3:
1351
1389
  if (!(response.status === 429)) {
1352
- _context3.next = 4;
1390
+ _context3.next = 5;
1353
1391
  break;
1354
1392
  }
1355
1393
 
1356
1394
  return _context3.abrupt("return", new RateLimitedError());
1357
1395
 
1358
- case 4:
1396
+ case 5:
1359
1397
  contentType = response.headers.get('Content-Type');
1360
1398
  responseMessage = '';
1361
1399
  _context3.t0 = contentType == null ? void 0 : contentType.toLocaleLowerCase();
1362
- _context3.next = _context3.t0 === 'text/plain' ? 9 : _context3.t0 === 'application/json' ? 13 : 19;
1400
+ _context3.next = _context3.t0 === 'text/plain' ? 10 : _context3.t0 === 'application/json' ? 14 : 20;
1363
1401
  break;
1364
1402
 
1365
- case 9:
1366
- _context3.next = 11;
1403
+ case 10:
1404
+ _context3.next = 12;
1367
1405
  return response.text();
1368
1406
 
1369
- case 11:
1407
+ case 12:
1370
1408
  responseMessage = _context3.sent;
1371
- return _context3.abrupt("break", 21);
1409
+ return _context3.abrupt("break", 22);
1372
1410
 
1373
- case 13:
1411
+ case 14:
1374
1412
  _context3.t1 = JSON;
1375
- _context3.next = 16;
1413
+ _context3.next = 17;
1376
1414
  return response.json();
1377
1415
 
1378
- case 16:
1416
+ case 17:
1379
1417
  _context3.t2 = _context3.sent;
1380
1418
  responseMessage = _context3.t1.stringify.call(_context3.t1, _context3.t2);
1381
- return _context3.abrupt("break", 21);
1419
+ return _context3.abrupt("break", 22);
1382
1420
 
1383
- case 19:
1421
+ case 20:
1384
1422
  responseMessage = 'Unknown response from the Bento API.';
1385
- return _context3.abrupt("break", 21);
1386
-
1387
- case 21:
1388
- if (this._logErrors) {
1389
- console.error(response);
1390
- }
1423
+ return _context3.abrupt("break", 22);
1391
1424
 
1425
+ case 22:
1392
1426
  return _context3.abrupt("return", new Error("[" + response.status + "] - " + responseMessage));
1393
1427
 
1394
1428
  case 23:
@@ -1456,8 +1490,7 @@ var BentoCommands = /*#__PURE__*/function () {
1456
1490
  while (1) {
1457
1491
  switch (_context.prev = _context.next) {
1458
1492
  case 0:
1459
- _context.prev = 0;
1460
- _context.next = 3;
1493
+ _context.next = 2;
1461
1494
  return this._client.post(this._url, {
1462
1495
  command: {
1463
1496
  command: CommandTypes.ADD_TAG,
@@ -1466,30 +1499,25 @@ var BentoCommands = /*#__PURE__*/function () {
1466
1499
  }
1467
1500
  });
1468
1501
 
1469
- case 3:
1502
+ case 2:
1470
1503
  result = _context.sent;
1471
1504
 
1472
1505
  if (!(Object.keys(result).length === 0 || !result.data)) {
1473
- _context.next = 6;
1506
+ _context.next = 5;
1474
1507
  break;
1475
1508
  }
1476
1509
 
1477
1510
  return _context.abrupt("return", null);
1478
1511
 
1479
- case 6:
1512
+ case 5:
1480
1513
  return _context.abrupt("return", result.data);
1481
1514
 
1482
- case 9:
1483
- _context.prev = 9;
1484
- _context.t0 = _context["catch"](0);
1485
- throw _context.t0;
1486
-
1487
- case 12:
1515
+ case 6:
1488
1516
  case "end":
1489
1517
  return _context.stop();
1490
1518
  }
1491
1519
  }
1492
- }, _callee, this, [[0, 9]]);
1520
+ }, _callee, this);
1493
1521
  }));
1494
1522
 
1495
1523
  function addTag(_x) {
@@ -1515,8 +1543,7 @@ var BentoCommands = /*#__PURE__*/function () {
1515
1543
  while (1) {
1516
1544
  switch (_context2.prev = _context2.next) {
1517
1545
  case 0:
1518
- _context2.prev = 0;
1519
- _context2.next = 3;
1546
+ _context2.next = 2;
1520
1547
  return this._client.post(this._url, {
1521
1548
  command: {
1522
1549
  command: CommandTypes.REMOVE_TAG,
@@ -1525,30 +1552,25 @@ var BentoCommands = /*#__PURE__*/function () {
1525
1552
  }
1526
1553
  });
1527
1554
 
1528
- case 3:
1555
+ case 2:
1529
1556
  result = _context2.sent;
1530
1557
 
1531
1558
  if (!(Object.keys(result).length === 0 || !result.data)) {
1532
- _context2.next = 6;
1559
+ _context2.next = 5;
1533
1560
  break;
1534
1561
  }
1535
1562
 
1536
1563
  return _context2.abrupt("return", null);
1537
1564
 
1538
- case 6:
1565
+ case 5:
1539
1566
  return _context2.abrupt("return", result.data);
1540
1567
 
1541
- case 9:
1542
- _context2.prev = 9;
1543
- _context2.t0 = _context2["catch"](0);
1544
- throw _context2.t0;
1545
-
1546
- case 12:
1568
+ case 6:
1547
1569
  case "end":
1548
1570
  return _context2.stop();
1549
1571
  }
1550
1572
  }
1551
- }, _callee2, this, [[0, 9]]);
1573
+ }, _callee2, this);
1552
1574
  }));
1553
1575
 
1554
1576
  function removeTag(_x2) {
@@ -1580,8 +1602,7 @@ var BentoCommands = /*#__PURE__*/function () {
1580
1602
  while (1) {
1581
1603
  switch (_context3.prev = _context3.next) {
1582
1604
  case 0:
1583
- _context3.prev = 0;
1584
- _context3.next = 3;
1605
+ _context3.next = 2;
1585
1606
  return this._client.post(this._url, {
1586
1607
  command: {
1587
1608
  command: CommandTypes.ADD_FIELD,
@@ -1590,30 +1611,25 @@ var BentoCommands = /*#__PURE__*/function () {
1590
1611
  }
1591
1612
  });
1592
1613
 
1593
- case 3:
1614
+ case 2:
1594
1615
  result = _context3.sent;
1595
1616
 
1596
1617
  if (!(Object.keys(result).length === 0 || !result.data)) {
1597
- _context3.next = 6;
1618
+ _context3.next = 5;
1598
1619
  break;
1599
1620
  }
1600
1621
 
1601
1622
  return _context3.abrupt("return", null);
1602
1623
 
1603
- case 6:
1624
+ case 5:
1604
1625
  return _context3.abrupt("return", result.data);
1605
1626
 
1606
- case 9:
1607
- _context3.prev = 9;
1608
- _context3.t0 = _context3["catch"](0);
1609
- throw _context3.t0;
1610
-
1611
- case 12:
1627
+ case 6:
1612
1628
  case "end":
1613
1629
  return _context3.stop();
1614
1630
  }
1615
1631
  }
1616
- }, _callee3, this, [[0, 9]]);
1632
+ }, _callee3, this);
1617
1633
  }));
1618
1634
 
1619
1635
  function addField(_x3) {
@@ -1639,8 +1655,7 @@ var BentoCommands = /*#__PURE__*/function () {
1639
1655
  while (1) {
1640
1656
  switch (_context4.prev = _context4.next) {
1641
1657
  case 0:
1642
- _context4.prev = 0;
1643
- _context4.next = 3;
1658
+ _context4.next = 2;
1644
1659
  return this._client.post(this._url, {
1645
1660
  command: {
1646
1661
  command: CommandTypes.REMOVE_FIELD,
@@ -1649,30 +1664,25 @@ var BentoCommands = /*#__PURE__*/function () {
1649
1664
  }
1650
1665
  });
1651
1666
 
1652
- case 3:
1667
+ case 2:
1653
1668
  result = _context4.sent;
1654
1669
 
1655
1670
  if (!(Object.keys(result).length === 0 || !result.data)) {
1656
- _context4.next = 6;
1671
+ _context4.next = 5;
1657
1672
  break;
1658
1673
  }
1659
1674
 
1660
1675
  return _context4.abrupt("return", null);
1661
1676
 
1662
- case 6:
1677
+ case 5:
1663
1678
  return _context4.abrupt("return", result.data);
1664
1679
 
1665
- case 9:
1666
- _context4.prev = 9;
1667
- _context4.t0 = _context4["catch"](0);
1668
- throw _context4.t0;
1669
-
1670
- case 12:
1680
+ case 6:
1671
1681
  case "end":
1672
1682
  return _context4.stop();
1673
1683
  }
1674
1684
  }
1675
- }, _callee4, this, [[0, 9]]);
1685
+ }, _callee4, this);
1676
1686
  }));
1677
1687
 
1678
1688
  function removeField(_x4) {
@@ -1702,8 +1712,7 @@ var BentoCommands = /*#__PURE__*/function () {
1702
1712
  while (1) {
1703
1713
  switch (_context5.prev = _context5.next) {
1704
1714
  case 0:
1705
- _context5.prev = 0;
1706
- _context5.next = 3;
1715
+ _context5.next = 2;
1707
1716
  return this._client.post(this._url, {
1708
1717
  command: {
1709
1718
  command: CommandTypes.SUBSCRIBE,
@@ -1711,30 +1720,25 @@ var BentoCommands = /*#__PURE__*/function () {
1711
1720
  }
1712
1721
  });
1713
1722
 
1714
- case 3:
1723
+ case 2:
1715
1724
  result = _context5.sent;
1716
1725
 
1717
1726
  if (!(Object.keys(result).length === 0 || !result.data)) {
1718
- _context5.next = 6;
1727
+ _context5.next = 5;
1719
1728
  break;
1720
1729
  }
1721
1730
 
1722
1731
  return _context5.abrupt("return", null);
1723
1732
 
1724
- case 6:
1733
+ case 5:
1725
1734
  return _context5.abrupt("return", result.data);
1726
1735
 
1727
- case 9:
1728
- _context5.prev = 9;
1729
- _context5.t0 = _context5["catch"](0);
1730
- throw _context5.t0;
1731
-
1732
- case 12:
1736
+ case 6:
1733
1737
  case "end":
1734
1738
  return _context5.stop();
1735
1739
  }
1736
1740
  }
1737
- }, _callee5, this, [[0, 9]]);
1741
+ }, _callee5, this);
1738
1742
  }));
1739
1743
 
1740
1744
  function subscribe(_x5) {
@@ -1765,8 +1769,7 @@ var BentoCommands = /*#__PURE__*/function () {
1765
1769
  while (1) {
1766
1770
  switch (_context6.prev = _context6.next) {
1767
1771
  case 0:
1768
- _context6.prev = 0;
1769
- _context6.next = 3;
1772
+ _context6.next = 2;
1770
1773
  return this._client.post(this._url, {
1771
1774
  command: {
1772
1775
  command: CommandTypes.UNSUBSCRIBE,
@@ -1774,30 +1777,25 @@ var BentoCommands = /*#__PURE__*/function () {
1774
1777
  }
1775
1778
  });
1776
1779
 
1777
- case 3:
1780
+ case 2:
1778
1781
  result = _context6.sent;
1779
1782
 
1780
1783
  if (!(Object.keys(result).length === 0 || !result.data)) {
1781
- _context6.next = 6;
1784
+ _context6.next = 5;
1782
1785
  break;
1783
1786
  }
1784
1787
 
1785
1788
  return _context6.abrupt("return", null);
1786
1789
 
1787
- case 6:
1790
+ case 5:
1788
1791
  return _context6.abrupt("return", result.data);
1789
1792
 
1790
- case 9:
1791
- _context6.prev = 9;
1792
- _context6.t0 = _context6["catch"](0);
1793
- throw _context6.t0;
1794
-
1795
- case 12:
1793
+ case 6:
1796
1794
  case "end":
1797
1795
  return _context6.stop();
1798
1796
  }
1799
1797
  }
1800
- }, _callee6, this, [[0, 9]]);
1798
+ }, _callee6, this);
1801
1799
  }));
1802
1800
 
1803
1801
  function unsubscribe(_x6) {
@@ -1823,8 +1821,7 @@ var BentoCommands = /*#__PURE__*/function () {
1823
1821
  while (1) {
1824
1822
  switch (_context7.prev = _context7.next) {
1825
1823
  case 0:
1826
- _context7.prev = 0;
1827
- _context7.next = 3;
1824
+ _context7.next = 2;
1828
1825
  return this._client.post(this._url, {
1829
1826
  command: {
1830
1827
  command: CommandTypes.CHANGE_EMAIL,
@@ -1833,30 +1830,25 @@ var BentoCommands = /*#__PURE__*/function () {
1833
1830
  }
1834
1831
  });
1835
1832
 
1836
- case 3:
1833
+ case 2:
1837
1834
  result = _context7.sent;
1838
1835
 
1839
1836
  if (!(Object.keys(result).length === 0 || !result.data)) {
1840
- _context7.next = 6;
1837
+ _context7.next = 5;
1841
1838
  break;
1842
1839
  }
1843
1840
 
1844
1841
  return _context7.abrupt("return", null);
1845
1842
 
1846
- case 6:
1843
+ case 5:
1847
1844
  return _context7.abrupt("return", result.data);
1848
1845
 
1849
- case 9:
1850
- _context7.prev = 9;
1851
- _context7.t0 = _context7["catch"](0);
1852
- throw _context7.t0;
1853
-
1854
- case 12:
1846
+ case 6:
1855
1847
  case "end":
1856
1848
  return _context7.stop();
1857
1849
  }
1858
1850
  }
1859
- }, _callee7, this, [[0, 9]]);
1851
+ }, _callee7, this);
1860
1852
  }));
1861
1853
 
1862
1854
  function changeEmail(_x7) {
@@ -1901,8 +1893,7 @@ var BentoExperimental = /*#__PURE__*/function () {
1901
1893
  while (1) {
1902
1894
  switch (_context.prev = _context.next) {
1903
1895
  case 0:
1904
- _context.prev = 0;
1905
- _context.next = 3;
1896
+ _context.next = 2;
1906
1897
  return this._client.post(this._url + "/validation", {
1907
1898
  email: parameters.email,
1908
1899
  ip: parameters.ip,
@@ -1910,21 +1901,16 @@ var BentoExperimental = /*#__PURE__*/function () {
1910
1901
  user_agent: parameters.userAgent
1911
1902
  });
1912
1903
 
1913
- case 3:
1904
+ case 2:
1914
1905
  result = _context.sent;
1915
1906
  return _context.abrupt("return", result.valid);
1916
1907
 
1917
- case 7:
1918
- _context.prev = 7;
1919
- _context.t0 = _context["catch"](0);
1920
- throw _context.t0;
1921
-
1922
- case 10:
1908
+ case 4:
1923
1909
  case "end":
1924
1910
  return _context.stop();
1925
1911
  }
1926
1912
  }
1927
- }, _callee, this, [[0, 7]]);
1913
+ }, _callee, this);
1928
1914
  }));
1929
1915
 
1930
1916
  function validateEmail(_x) {
@@ -1957,25 +1943,19 @@ var BentoExperimental = /*#__PURE__*/function () {
1957
1943
  while (1) {
1958
1944
  switch (_context2.prev = _context2.next) {
1959
1945
  case 0:
1960
- _context2.prev = 0;
1961
- _context2.next = 3;
1946
+ _context2.next = 2;
1962
1947
  return this._client.post(this._url + "/gender", parameters);
1963
1948
 
1964
- case 3:
1949
+ case 2:
1965
1950
  result = _context2.sent;
1966
1951
  return _context2.abrupt("return", result);
1967
1952
 
1968
- case 7:
1969
- _context2.prev = 7;
1970
- _context2.t0 = _context2["catch"](0);
1971
- throw _context2.t0;
1972
-
1973
- case 10:
1953
+ case 4:
1974
1954
  case "end":
1975
1955
  return _context2.stop();
1976
1956
  }
1977
1957
  }
1978
- }, _callee2, this, [[0, 7]]);
1958
+ }, _callee2, this);
1979
1959
  }));
1980
1960
 
1981
1961
  function guessGender(_x2) {
@@ -2004,34 +1984,28 @@ var BentoExperimental = /*#__PURE__*/function () {
2004
1984
  while (1) {
2005
1985
  switch (_context3.prev = _context3.next) {
2006
1986
  case 0:
2007
- _context3.prev = 0;
2008
- _context3.next = 3;
1987
+ _context3.next = 2;
2009
1988
  return this._client.get(this._url + "/geolocation", parameters);
2010
1989
 
2011
- case 3:
1990
+ case 2:
2012
1991
  result = _context3.sent;
2013
1992
 
2014
1993
  if (!(Object.keys(result).length === 0)) {
2015
- _context3.next = 6;
1994
+ _context3.next = 5;
2016
1995
  break;
2017
1996
  }
2018
1997
 
2019
1998
  return _context3.abrupt("return", null);
2020
1999
 
2021
- case 6:
2000
+ case 5:
2022
2001
  return _context3.abrupt("return", result);
2023
2002
 
2024
- case 9:
2025
- _context3.prev = 9;
2026
- _context3.t0 = _context3["catch"](0);
2027
- throw _context3.t0;
2028
-
2029
- case 12:
2003
+ case 6:
2030
2004
  case "end":
2031
2005
  return _context3.stop();
2032
2006
  }
2033
2007
  }
2034
- }, _callee3, this, [[0, 9]]);
2008
+ }, _callee3, this);
2035
2009
  }));
2036
2010
 
2037
2011
  function geolocate(_x3) {
@@ -2061,25 +2035,19 @@ var BentoExperimental = /*#__PURE__*/function () {
2061
2035
  while (1) {
2062
2036
  switch (_context4.prev = _context4.next) {
2063
2037
  case 0:
2064
- _context4.prev = 0;
2065
- _context4.next = 3;
2038
+ _context4.next = 2;
2066
2039
  return this._client.get(this._url + "/blacklist.json", parameters);
2067
2040
 
2068
- case 3:
2041
+ case 2:
2069
2042
  result = _context4.sent;
2070
2043
  return _context4.abrupt("return", result);
2071
2044
 
2072
- case 7:
2073
- _context4.prev = 7;
2074
- _context4.t0 = _context4["catch"](0);
2075
- throw _context4.t0;
2076
-
2077
- case 10:
2045
+ case 4:
2078
2046
  case "end":
2079
2047
  return _context4.stop();
2080
2048
  }
2081
2049
  }
2082
- }, _callee4, this, [[0, 7]]);
2050
+ }, _callee4, this);
2083
2051
  }));
2084
2052
 
2085
2053
  function checkBlacklist(_x4) {
@@ -2116,34 +2084,28 @@ var BentoFields = /*#__PURE__*/function () {
2116
2084
  while (1) {
2117
2085
  switch (_context.prev = _context.next) {
2118
2086
  case 0:
2119
- _context.prev = 0;
2120
- _context.next = 3;
2087
+ _context.next = 2;
2121
2088
  return this._client.get(this._url);
2122
2089
 
2123
- case 3:
2090
+ case 2:
2124
2091
  result = _context.sent;
2125
2092
 
2126
2093
  if (!(Object.keys(result).length === 0 || !result.data)) {
2127
- _context.next = 6;
2094
+ _context.next = 5;
2128
2095
  break;
2129
2096
  }
2130
2097
 
2131
2098
  return _context.abrupt("return", null);
2132
2099
 
2133
- case 6:
2100
+ case 5:
2134
2101
  return _context.abrupt("return", result.data);
2135
2102
 
2136
- case 9:
2137
- _context.prev = 9;
2138
- _context.t0 = _context["catch"](0);
2139
- throw _context.t0;
2140
-
2141
- case 12:
2103
+ case 6:
2142
2104
  case "end":
2143
2105
  return _context.stop();
2144
2106
  }
2145
2107
  }
2146
- }, _callee, this, [[0, 9]]);
2108
+ }, _callee, this);
2147
2109
  }));
2148
2110
 
2149
2111
  function getFields() {
@@ -2178,36 +2140,30 @@ var BentoFields = /*#__PURE__*/function () {
2178
2140
  while (1) {
2179
2141
  switch (_context2.prev = _context2.next) {
2180
2142
  case 0:
2181
- _context2.prev = 0;
2182
- _context2.next = 3;
2143
+ _context2.next = 2;
2183
2144
  return this._client.post(this._url, {
2184
2145
  field: parameters
2185
2146
  });
2186
2147
 
2187
- case 3:
2148
+ case 2:
2188
2149
  result = _context2.sent;
2189
2150
 
2190
2151
  if (!(Object.keys(result).length === 0 || !result.data)) {
2191
- _context2.next = 6;
2152
+ _context2.next = 5;
2192
2153
  break;
2193
2154
  }
2194
2155
 
2195
2156
  return _context2.abrupt("return", null);
2196
2157
 
2197
- case 6:
2158
+ case 5:
2198
2159
  return _context2.abrupt("return", result.data);
2199
2160
 
2200
- case 9:
2201
- _context2.prev = 9;
2202
- _context2.t0 = _context2["catch"](0);
2203
- throw _context2.t0;
2204
-
2205
- case 12:
2161
+ case 6:
2206
2162
  case "end":
2207
2163
  return _context2.stop();
2208
2164
  }
2209
2165
  }
2210
- }, _callee2, this, [[0, 9]]);
2166
+ }, _callee2, this);
2211
2167
  }));
2212
2168
 
2213
2169
  function createField(_x) {
@@ -2245,36 +2201,30 @@ var BentoForms = /*#__PURE__*/function () {
2245
2201
  while (1) {
2246
2202
  switch (_context.prev = _context.next) {
2247
2203
  case 0:
2248
- _context.prev = 0;
2249
- _context.next = 3;
2204
+ _context.next = 2;
2250
2205
  return this._client.get(this._url, {
2251
2206
  id: formIdentifier
2252
2207
  });
2253
2208
 
2254
- case 3:
2209
+ case 2:
2255
2210
  result = _context.sent;
2256
2211
 
2257
2212
  if (!(Object.keys(result).length === 0 || !result.data)) {
2258
- _context.next = 6;
2213
+ _context.next = 5;
2259
2214
  break;
2260
2215
  }
2261
2216
 
2262
2217
  return _context.abrupt("return", null);
2263
2218
 
2264
- case 6:
2219
+ case 5:
2265
2220
  return _context.abrupt("return", result.data);
2266
2221
 
2267
- case 9:
2268
- _context.prev = 9;
2269
- _context.t0 = _context["catch"](0);
2270
- throw _context.t0;
2271
-
2272
- case 12:
2222
+ case 6:
2273
2223
  case "end":
2274
2224
  return _context.stop();
2275
2225
  }
2276
2226
  }
2277
- }, _callee, this, [[0, 9]]);
2227
+ }, _callee, this);
2278
2228
  }));
2279
2229
 
2280
2230
  function getResponses(_x) {
@@ -2311,34 +2261,28 @@ var BentoSubscribers = /*#__PURE__*/function () {
2311
2261
  while (1) {
2312
2262
  switch (_context.prev = _context.next) {
2313
2263
  case 0:
2314
- _context.prev = 0;
2315
- _context.next = 3;
2264
+ _context.next = 2;
2316
2265
  return this._client.get(this._url, parameters);
2317
2266
 
2318
- case 3:
2267
+ case 2:
2319
2268
  result = _context.sent;
2320
2269
 
2321
2270
  if (!(Object.keys(result).length === 0 || !result.data)) {
2322
- _context.next = 6;
2271
+ _context.next = 5;
2323
2272
  break;
2324
2273
  }
2325
2274
 
2326
2275
  return _context.abrupt("return", null);
2327
2276
 
2328
- case 6:
2277
+ case 5:
2329
2278
  return _context.abrupt("return", result.data);
2330
2279
 
2331
- case 9:
2332
- _context.prev = 9;
2333
- _context.t0 = _context["catch"](0);
2334
- throw _context.t0;
2335
-
2336
- case 12:
2280
+ case 6:
2337
2281
  case "end":
2338
2282
  return _context.stop();
2339
2283
  }
2340
2284
  }
2341
- }, _callee, this, [[0, 9]]);
2285
+ }, _callee, this);
2342
2286
  }));
2343
2287
 
2344
2288
  function getSubscribers(_x) {
@@ -2364,36 +2308,30 @@ var BentoSubscribers = /*#__PURE__*/function () {
2364
2308
  while (1) {
2365
2309
  switch (_context2.prev = _context2.next) {
2366
2310
  case 0:
2367
- _context2.prev = 0;
2368
- _context2.next = 3;
2311
+ _context2.next = 2;
2369
2312
  return this._client.post(this._url, {
2370
2313
  subscriber: parameters
2371
2314
  });
2372
2315
 
2373
- case 3:
2316
+ case 2:
2374
2317
  result = _context2.sent;
2375
2318
 
2376
2319
  if (!(Object.keys(result).length === 0 || !result.data)) {
2377
- _context2.next = 6;
2320
+ _context2.next = 5;
2378
2321
  break;
2379
2322
  }
2380
2323
 
2381
2324
  return _context2.abrupt("return", null);
2382
2325
 
2383
- case 6:
2326
+ case 5:
2384
2327
  return _context2.abrupt("return", result.data);
2385
2328
 
2386
- case 9:
2387
- _context2.prev = 9;
2388
- _context2.t0 = _context2["catch"](0);
2389
- throw _context2.t0;
2390
-
2391
- case 12:
2329
+ case 6:
2392
2330
  case "end":
2393
2331
  return _context2.stop();
2394
2332
  }
2395
2333
  }
2396
- }, _callee2, this, [[0, 9]]);
2334
+ }, _callee2, this);
2397
2335
  }));
2398
2336
 
2399
2337
  function createSubscriber(_x2) {
@@ -2430,34 +2368,28 @@ var BentoTags = /*#__PURE__*/function () {
2430
2368
  while (1) {
2431
2369
  switch (_context.prev = _context.next) {
2432
2370
  case 0:
2433
- _context.prev = 0;
2434
- _context.next = 3;
2371
+ _context.next = 2;
2435
2372
  return this._client.get(this._url);
2436
2373
 
2437
- case 3:
2374
+ case 2:
2438
2375
  result = _context.sent;
2439
2376
 
2440
2377
  if (!(Object.keys(result).length === 0 || !result.data)) {
2441
- _context.next = 6;
2378
+ _context.next = 5;
2442
2379
  break;
2443
2380
  }
2444
2381
 
2445
2382
  return _context.abrupt("return", null);
2446
2383
 
2447
- case 6:
2384
+ case 5:
2448
2385
  return _context.abrupt("return", result.data);
2449
2386
 
2450
- case 9:
2451
- _context.prev = 9;
2452
- _context.t0 = _context["catch"](0);
2453
- throw _context.t0;
2454
-
2455
- case 12:
2387
+ case 6:
2456
2388
  case "end":
2457
2389
  return _context.stop();
2458
2390
  }
2459
2391
  }
2460
- }, _callee, this, [[0, 9]]);
2392
+ }, _callee, this);
2461
2393
  }));
2462
2394
 
2463
2395
  function getTags() {
@@ -2483,36 +2415,30 @@ var BentoTags = /*#__PURE__*/function () {
2483
2415
  while (1) {
2484
2416
  switch (_context2.prev = _context2.next) {
2485
2417
  case 0:
2486
- _context2.prev = 0;
2487
- _context2.next = 3;
2418
+ _context2.next = 2;
2488
2419
  return this._client.post(this._url, {
2489
2420
  tag: parameters
2490
2421
  });
2491
2422
 
2492
- case 3:
2423
+ case 2:
2493
2424
  result = _context2.sent;
2494
2425
 
2495
2426
  if (!(Object.keys(result).length === 0 || !result.data)) {
2496
- _context2.next = 6;
2427
+ _context2.next = 5;
2497
2428
  break;
2498
2429
  }
2499
2430
 
2500
2431
  return _context2.abrupt("return", null);
2501
2432
 
2502
- case 6:
2433
+ case 5:
2503
2434
  return _context2.abrupt("return", result.data);
2504
2435
 
2505
- case 9:
2506
- _context2.prev = 9;
2507
- _context2.t0 = _context2["catch"](0);
2508
- throw _context2.t0;
2509
-
2510
- case 12:
2436
+ case 6:
2511
2437
  case "end":
2512
2438
  return _context2.stop();
2513
2439
  }
2514
2440
  }
2515
- }, _callee2, this, [[0, 9]]);
2441
+ }, _callee2, this);
2516
2442
  }));
2517
2443
 
2518
2444
  function createTag(_x) {
@@ -2585,8 +2511,7 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2585
2511
  while (1) {
2586
2512
  switch (_context.prev = _context.next) {
2587
2513
  case 0:
2588
- _context.prev = 0;
2589
- _context.next = 3;
2514
+ _context.next = 2;
2590
2515
  return this.Batch.importEvents({
2591
2516
  events: [{
2592
2517
  date: parameters.date,
@@ -2598,21 +2523,16 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2598
2523
  }]
2599
2524
  });
2600
2525
 
2601
- case 3:
2526
+ case 2:
2602
2527
  result = _context.sent;
2603
2528
  return _context.abrupt("return", result === 1);
2604
2529
 
2605
- case 7:
2606
- _context.prev = 7;
2607
- _context.t0 = _context["catch"](0);
2608
- throw _context.t0;
2609
-
2610
- case 10:
2530
+ case 4:
2611
2531
  case "end":
2612
2532
  return _context.stop();
2613
2533
  }
2614
2534
  }
2615
- }, _callee, this, [[0, 7]]);
2535
+ }, _callee, this);
2616
2536
  }));
2617
2537
 
2618
2538
  function tagSubscriber(_x) {
@@ -2652,8 +2572,7 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2652
2572
  while (1) {
2653
2573
  switch (_context2.prev = _context2.next) {
2654
2574
  case 0:
2655
- _context2.prev = 0;
2656
- _context2.next = 3;
2575
+ _context2.next = 2;
2657
2576
  return this.Batch.importEvents({
2658
2577
  events: [{
2659
2578
  date: parameters.date,
@@ -2663,21 +2582,16 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2663
2582
  }]
2664
2583
  });
2665
2584
 
2666
- case 3:
2585
+ case 2:
2667
2586
  result = _context2.sent;
2668
2587
  return _context2.abrupt("return", result === 1);
2669
2588
 
2670
- case 7:
2671
- _context2.prev = 7;
2672
- _context2.t0 = _context2["catch"](0);
2673
- throw _context2.t0;
2674
-
2675
- case 10:
2589
+ case 4:
2676
2590
  case "end":
2677
2591
  return _context2.stop();
2678
2592
  }
2679
2593
  }
2680
- }, _callee2, this, [[0, 7]]);
2594
+ }, _callee2, this);
2681
2595
  }));
2682
2596
 
2683
2597
  function addSubscriber(_x2) {
@@ -2716,8 +2630,7 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2716
2630
  while (1) {
2717
2631
  switch (_context3.prev = _context3.next) {
2718
2632
  case 0:
2719
- _context3.prev = 0;
2720
- _context3.next = 3;
2633
+ _context3.next = 2;
2721
2634
  return this.Batch.importEvents({
2722
2635
  events: [{
2723
2636
  date: parameters.date,
@@ -2726,21 +2639,16 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2726
2639
  }]
2727
2640
  });
2728
2641
 
2729
- case 3:
2642
+ case 2:
2730
2643
  result = _context3.sent;
2731
2644
  return _context3.abrupt("return", result === 1);
2732
2645
 
2733
- case 7:
2734
- _context3.prev = 7;
2735
- _context3.t0 = _context3["catch"](0);
2736
- throw _context3.t0;
2737
-
2738
- case 10:
2646
+ case 4:
2739
2647
  case "end":
2740
2648
  return _context3.stop();
2741
2649
  }
2742
2650
  }
2743
- }, _callee3, this, [[0, 7]]);
2651
+ }, _callee3, this);
2744
2652
  }));
2745
2653
 
2746
2654
  function removeSubscriber(_x3) {
@@ -2779,8 +2687,7 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2779
2687
  while (1) {
2780
2688
  switch (_context4.prev = _context4.next) {
2781
2689
  case 0:
2782
- _context4.prev = 0;
2783
- _context4.next = 3;
2690
+ _context4.next = 2;
2784
2691
  return this.Batch.importEvents({
2785
2692
  events: [{
2786
2693
  date: parameters.date,
@@ -2790,21 +2697,16 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2790
2697
  }]
2791
2698
  });
2792
2699
 
2793
- case 3:
2700
+ case 2:
2794
2701
  result = _context4.sent;
2795
2702
  return _context4.abrupt("return", result === 1);
2796
2703
 
2797
- case 7:
2798
- _context4.prev = 7;
2799
- _context4.t0 = _context4["catch"](0);
2800
- throw _context4.t0;
2801
-
2802
- case 10:
2704
+ case 4:
2803
2705
  case "end":
2804
2706
  return _context4.stop();
2805
2707
  }
2806
2708
  }
2807
- }, _callee4, this, [[0, 7]]);
2709
+ }, _callee4, this);
2808
2710
  }));
2809
2711
 
2810
2712
  function updateFields(_x4) {
@@ -2842,8 +2744,7 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2842
2744
  while (1) {
2843
2745
  switch (_context5.prev = _context5.next) {
2844
2746
  case 0:
2845
- _context5.prev = 0;
2846
- _context5.next = 3;
2747
+ _context5.next = 2;
2847
2748
  return this.Batch.importEvents({
2848
2749
  events: [{
2849
2750
  date: parameters.date,
@@ -2853,21 +2754,16 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2853
2754
  }]
2854
2755
  });
2855
2756
 
2856
- case 3:
2757
+ case 2:
2857
2758
  result = _context5.sent;
2858
2759
  return _context5.abrupt("return", result === 1);
2859
2760
 
2860
- case 7:
2861
- _context5.prev = 7;
2862
- _context5.t0 = _context5["catch"](0);
2863
- throw _context5.t0;
2864
-
2865
- case 10:
2761
+ case 4:
2866
2762
  case "end":
2867
2763
  return _context5.stop();
2868
2764
  }
2869
2765
  }
2870
- }, _callee5, this, [[0, 7]]);
2766
+ }, _callee5, this);
2871
2767
  }));
2872
2768
 
2873
2769
  function trackPurchase(_x5) {
@@ -2904,27 +2800,21 @@ var BentoAPIV1 = /*#__PURE__*/function () {
2904
2800
  while (1) {
2905
2801
  switch (_context6.prev = _context6.next) {
2906
2802
  case 0:
2907
- _context6.prev = 0;
2908
- _context6.next = 3;
2803
+ _context6.next = 2;
2909
2804
  return this.Batch.importEvents({
2910
2805
  events: [parameters]
2911
2806
  });
2912
2807
 
2913
- case 3:
2808
+ case 2:
2914
2809
  result = _context6.sent;
2915
2810
  return _context6.abrupt("return", result === 1);
2916
2811
 
2917
- case 7:
2918
- _context6.prev = 7;
2919
- _context6.t0 = _context6["catch"](0);
2920
- throw _context6.t0;
2921
-
2922
- case 10:
2812
+ case 4:
2923
2813
  case "end":
2924
2814
  return _context6.stop();
2925
2815
  }
2926
2816
  }
2927
- }, _callee6, this, [[0, 7]]);
2817
+ }, _callee6, this);
2928
2818
  }));
2929
2819
 
2930
2820
  function track(_x6) {