@bentonow/bento-node-sdk 0.1.14 → 0.2.1
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/README.md +56 -21
- package/dist/bento-node-sdk.cjs.development.js +1000 -1773
- package/dist/bento-node-sdk.cjs.development.js.map +1 -1
- package/dist/bento-node-sdk.cjs.production.min.js +1 -1
- package/dist/bento-node-sdk.cjs.production.min.js.map +1 -1
- package/dist/bento-node-sdk.esm.js +1000 -1773
- package/dist/bento-node-sdk.esm.js.map +1 -1
- package/dist/sdk/batch/errors.d.ts +6 -0
- package/dist/sdk/batch/events.d.ts +12 -12
- package/dist/sdk/batch/index.d.ts +17 -1
- package/dist/sdk/batch/types.d.ts +20 -4
- package/dist/sdk/client/types.d.ts +1 -1
- package/dist/sdk/commands/types.d.ts +7 -7
- package/dist/sdk/experimental/types.d.ts +8 -8
- package/dist/sdk/fields/types.d.ts +3 -3
- package/dist/sdk/forms/types.d.ts +3 -3
- package/dist/sdk/subscribers/types.d.ts +4 -4
- package/dist/sdk/tags/types.d.ts +3 -3
- package/dist/sdk/types.d.ts +5 -5
- package/dist/versions/v1/types.d.ts +6 -6
- package/package.json +3 -9
- package/src/sdk/batch/errors.ts +14 -0
- package/src/sdk/batch/index.ts +41 -0
- package/src/sdk/batch/types.ts +19 -0
- package/src/sdk/client/index.ts +7 -7
|
@@ -4,985 +4,484 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
|
-
var fetch = _interopDefault(require('
|
|
7
|
+
var fetch = _interopDefault(require('cross-fetch'));
|
|
8
8
|
|
|
9
|
-
function asyncGeneratorStep(
|
|
9
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
10
10
|
try {
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
} catch (
|
|
14
|
-
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (info.done) {
|
|
19
|
-
resolve(value);
|
|
20
|
-
} else {
|
|
21
|
-
Promise.resolve(value).then(_next, _throw);
|
|
11
|
+
var i = n[a](c),
|
|
12
|
+
u = i.value;
|
|
13
|
+
} catch (n) {
|
|
14
|
+
return void e(n);
|
|
22
15
|
}
|
|
16
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
23
17
|
}
|
|
24
|
-
|
|
25
|
-
function _asyncToGenerator(fn) {
|
|
18
|
+
function _asyncToGenerator(n) {
|
|
26
19
|
return function () {
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
return new Promise(function (
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
20
|
+
var t = this,
|
|
21
|
+
e = arguments;
|
|
22
|
+
return new Promise(function (r, o) {
|
|
23
|
+
var a = n.apply(t, e);
|
|
24
|
+
function _next(n) {
|
|
25
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
34
26
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
27
|
+
function _throw(n) {
|
|
28
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
38
29
|
}
|
|
39
|
-
|
|
40
|
-
_next(undefined);
|
|
30
|
+
_next(void 0);
|
|
41
31
|
});
|
|
42
32
|
};
|
|
43
33
|
}
|
|
44
|
-
|
|
34
|
+
function _construct(t, e, r) {
|
|
35
|
+
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
36
|
+
var o = [null];
|
|
37
|
+
o.push.apply(o, e);
|
|
38
|
+
var p = new (t.bind.apply(t, o))();
|
|
39
|
+
return r && _setPrototypeOf(p, r.prototype), p;
|
|
40
|
+
}
|
|
45
41
|
function _extends() {
|
|
46
|
-
_extends = Object.assign
|
|
47
|
-
for (var
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
for (var key in source) {
|
|
51
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
52
|
-
target[key] = source[key];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
42
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
43
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
44
|
+
var t = arguments[e];
|
|
45
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
55
46
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
return _extends.apply(this, arguments);
|
|
47
|
+
return n;
|
|
48
|
+
}, _extends.apply(null, arguments);
|
|
61
49
|
}
|
|
62
|
-
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
_setPrototypeOf(subClass, superClass);
|
|
50
|
+
function _getPrototypeOf(t) {
|
|
51
|
+
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
52
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
53
|
+
}, _getPrototypeOf(t);
|
|
68
54
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
72
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
73
|
-
};
|
|
74
|
-
return _getPrototypeOf(o);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function _setPrototypeOf(o, p) {
|
|
78
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
79
|
-
o.__proto__ = p;
|
|
80
|
-
return o;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
return _setPrototypeOf(o, p);
|
|
55
|
+
function _inheritsLoose(t, o) {
|
|
56
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
84
57
|
}
|
|
85
|
-
|
|
86
|
-
function _isNativeReflectConstruct() {
|
|
87
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
88
|
-
if (Reflect.construct.sham) return false;
|
|
89
|
-
if (typeof Proxy === "function") return true;
|
|
90
|
-
|
|
58
|
+
function _isNativeFunction(t) {
|
|
91
59
|
try {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function _construct(Parent, args, Class) {
|
|
100
|
-
if (_isNativeReflectConstruct()) {
|
|
101
|
-
_construct = Reflect.construct;
|
|
102
|
-
} else {
|
|
103
|
-
_construct = function _construct(Parent, args, Class) {
|
|
104
|
-
var a = [null];
|
|
105
|
-
a.push.apply(a, args);
|
|
106
|
-
var Constructor = Function.bind.apply(Parent, a);
|
|
107
|
-
var instance = new Constructor();
|
|
108
|
-
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
109
|
-
return instance;
|
|
110
|
-
};
|
|
60
|
+
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
61
|
+
} catch (n) {
|
|
62
|
+
return "function" == typeof t;
|
|
111
63
|
}
|
|
112
|
-
|
|
113
|
-
return _construct.apply(null, arguments);
|
|
114
64
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
65
|
+
function _isNativeReflectConstruct() {
|
|
66
|
+
try {
|
|
67
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
68
|
+
} catch (t) {}
|
|
69
|
+
return (_isNativeReflectConstruct = function () {
|
|
70
|
+
return !!t;
|
|
71
|
+
})();
|
|
118
72
|
}
|
|
119
|
-
|
|
120
|
-
function
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
124
|
-
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
125
|
-
|
|
126
|
-
if (typeof Class !== "function") {
|
|
127
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (typeof _cache !== "undefined") {
|
|
131
|
-
if (_cache.has(Class)) return _cache.get(Class);
|
|
132
|
-
|
|
133
|
-
_cache.set(Class, Wrapper);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function Wrapper() {
|
|
137
|
-
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
Wrapper.prototype = Object.create(Class.prototype, {
|
|
141
|
-
constructor: {
|
|
142
|
-
value: Wrapper,
|
|
143
|
-
enumerable: false,
|
|
144
|
-
writable: true,
|
|
145
|
-
configurable: true
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
return _setPrototypeOf(Wrapper, Class);
|
|
73
|
+
function _regeneratorRuntime() {
|
|
74
|
+
_regeneratorRuntime = function () {
|
|
75
|
+
return e;
|
|
149
76
|
};
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
function
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
var Op = Object.prototype;
|
|
169
|
-
var hasOwn = Op.hasOwnProperty;
|
|
170
|
-
var undefined$1; // More compressible than void 0.
|
|
171
|
-
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
172
|
-
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
173
|
-
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
174
|
-
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
175
|
-
|
|
176
|
-
function define(obj, key, value) {
|
|
177
|
-
Object.defineProperty(obj, key, {
|
|
178
|
-
value: value,
|
|
179
|
-
enumerable: true,
|
|
180
|
-
configurable: true,
|
|
181
|
-
writable: true
|
|
182
|
-
});
|
|
183
|
-
return obj[key];
|
|
77
|
+
var t,
|
|
78
|
+
e = {},
|
|
79
|
+
r = Object.prototype,
|
|
80
|
+
n = r.hasOwnProperty,
|
|
81
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
82
|
+
t[e] = r.value;
|
|
83
|
+
},
|
|
84
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
85
|
+
a = i.iterator || "@@iterator",
|
|
86
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
87
|
+
u = i.toStringTag || "@@toStringTag";
|
|
88
|
+
function define(t, e, r) {
|
|
89
|
+
return Object.defineProperty(t, e, {
|
|
90
|
+
value: r,
|
|
91
|
+
enumerable: !0,
|
|
92
|
+
configurable: !0,
|
|
93
|
+
writable: !0
|
|
94
|
+
}), t[e];
|
|
184
95
|
}
|
|
185
96
|
try {
|
|
186
|
-
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
187
97
|
define({}, "");
|
|
188
|
-
} catch (
|
|
189
|
-
define = function(
|
|
190
|
-
return
|
|
98
|
+
} catch (t) {
|
|
99
|
+
define = function (t, e, r) {
|
|
100
|
+
return t[e] = r;
|
|
191
101
|
};
|
|
192
102
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
// The ._invoke method unifies the implementations of the .next,
|
|
201
|
-
// .throw, and .return methods.
|
|
202
|
-
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
203
|
-
|
|
204
|
-
return generator;
|
|
103
|
+
function wrap(t, e, r, n) {
|
|
104
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
105
|
+
a = Object.create(i.prototype),
|
|
106
|
+
c = new Context(n || []);
|
|
107
|
+
return o(a, "_invoke", {
|
|
108
|
+
value: makeInvokeMethod(t, r, c)
|
|
109
|
+
}), a;
|
|
205
110
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
209
|
-
// record like context.tryEntries[i].completion. This interface could
|
|
210
|
-
// have been (and was previously) designed to take a closure to be
|
|
211
|
-
// invoked without arguments, but in all the cases we care about we
|
|
212
|
-
// already have an existing method we want to call, so there's no need
|
|
213
|
-
// to create a new function object. We can even get away with assuming
|
|
214
|
-
// the method takes exactly one argument, since that happens to be true
|
|
215
|
-
// in every case, so we don't have to touch the arguments object. The
|
|
216
|
-
// only additional allocation required is the completion record, which
|
|
217
|
-
// has a stable shape and so hopefully should be cheap to allocate.
|
|
218
|
-
function tryCatch(fn, obj, arg) {
|
|
111
|
+
function tryCatch(t, e, r) {
|
|
219
112
|
try {
|
|
220
|
-
return {
|
|
221
|
-
|
|
222
|
-
|
|
113
|
+
return {
|
|
114
|
+
type: "normal",
|
|
115
|
+
arg: t.call(e, r)
|
|
116
|
+
};
|
|
117
|
+
} catch (t) {
|
|
118
|
+
return {
|
|
119
|
+
type: "throw",
|
|
120
|
+
arg: t
|
|
121
|
+
};
|
|
223
122
|
}
|
|
224
123
|
}
|
|
225
|
-
|
|
226
|
-
var
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
// Returning this object from the innerFn has the same effect as
|
|
232
|
-
// breaking out of the dispatch switch statement.
|
|
233
|
-
var ContinueSentinel = {};
|
|
234
|
-
|
|
235
|
-
// Dummy constructor functions that we use as the .constructor and
|
|
236
|
-
// .constructor.prototype properties for functions that return Generator
|
|
237
|
-
// objects. For full spec compliance, you may wish to configure your
|
|
238
|
-
// minifier not to mangle the names of these two functions.
|
|
124
|
+
e.wrap = wrap;
|
|
125
|
+
var h = "suspendedStart",
|
|
126
|
+
l = "suspendedYield",
|
|
127
|
+
f = "executing",
|
|
128
|
+
s = "completed",
|
|
129
|
+
y = {};
|
|
239
130
|
function Generator() {}
|
|
240
131
|
function GeneratorFunction() {}
|
|
241
132
|
function GeneratorFunctionPrototype() {}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
// don't natively support it.
|
|
245
|
-
var IteratorPrototype = {};
|
|
246
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
133
|
+
var p = {};
|
|
134
|
+
define(p, a, function () {
|
|
247
135
|
return this;
|
|
248
136
|
});
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
IteratorPrototype = NativeIteratorPrototype;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
var Gp = GeneratorFunctionPrototype.prototype =
|
|
261
|
-
Generator.prototype = Object.create(IteratorPrototype);
|
|
262
|
-
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
263
|
-
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
264
|
-
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
265
|
-
GeneratorFunction.displayName = define(
|
|
266
|
-
GeneratorFunctionPrototype,
|
|
267
|
-
toStringTagSymbol,
|
|
268
|
-
"GeneratorFunction"
|
|
269
|
-
);
|
|
270
|
-
|
|
271
|
-
// Helper for defining the .next, .throw, and .return methods of the
|
|
272
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
273
|
-
function defineIteratorMethods(prototype) {
|
|
274
|
-
["next", "throw", "return"].forEach(function(method) {
|
|
275
|
-
define(prototype, method, function(arg) {
|
|
276
|
-
return this._invoke(method, arg);
|
|
137
|
+
var d = Object.getPrototypeOf,
|
|
138
|
+
v = d && d(d(values([])));
|
|
139
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
140
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
141
|
+
function defineIteratorMethods(t) {
|
|
142
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
143
|
+
define(t, e, function (t) {
|
|
144
|
+
return this._invoke(e, t);
|
|
277
145
|
});
|
|
278
146
|
});
|
|
279
147
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
} else {
|
|
295
|
-
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
296
|
-
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
297
|
-
}
|
|
298
|
-
genFun.prototype = Object.create(Gp);
|
|
299
|
-
return genFun;
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
// Within the body of any async function, `await x` is transformed to
|
|
303
|
-
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
304
|
-
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
305
|
-
// meant to be awaited.
|
|
306
|
-
exports.awrap = function(arg) {
|
|
307
|
-
return { __await: arg };
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
311
|
-
function invoke(method, arg, resolve, reject) {
|
|
312
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
313
|
-
if (record.type === "throw") {
|
|
314
|
-
reject(record.arg);
|
|
315
|
-
} else {
|
|
316
|
-
var result = record.arg;
|
|
317
|
-
var value = result.value;
|
|
318
|
-
if (value &&
|
|
319
|
-
typeof value === "object" &&
|
|
320
|
-
hasOwn.call(value, "__await")) {
|
|
321
|
-
return PromiseImpl.resolve(value.__await).then(function(value) {
|
|
322
|
-
invoke("next", value, resolve, reject);
|
|
323
|
-
}, function(err) {
|
|
324
|
-
invoke("throw", err, resolve, reject);
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return PromiseImpl.resolve(value).then(function(unwrapped) {
|
|
329
|
-
// When a yielded Promise is resolved, its final value becomes
|
|
330
|
-
// the .value of the Promise<{value,done}> result for the
|
|
331
|
-
// current iteration.
|
|
332
|
-
result.value = unwrapped;
|
|
333
|
-
resolve(result);
|
|
334
|
-
}, function(error) {
|
|
335
|
-
// If a rejected Promise was yielded, throw the rejection back
|
|
336
|
-
// into the async generator function so it can be handled there.
|
|
337
|
-
return invoke("throw", error, resolve, reject);
|
|
148
|
+
function AsyncIterator(t, e) {
|
|
149
|
+
function invoke(r, o, i, a) {
|
|
150
|
+
var c = tryCatch(t[r], t, o);
|
|
151
|
+
if ("throw" !== c.type) {
|
|
152
|
+
var u = c.arg,
|
|
153
|
+
h = u.value;
|
|
154
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
155
|
+
invoke("next", t, i, a);
|
|
156
|
+
}, function (t) {
|
|
157
|
+
invoke("throw", t, i, a);
|
|
158
|
+
}) : e.resolve(h).then(function (t) {
|
|
159
|
+
u.value = t, i(u);
|
|
160
|
+
}, function (t) {
|
|
161
|
+
return invoke("throw", t, i, a);
|
|
338
162
|
});
|
|
339
163
|
}
|
|
164
|
+
a(c.arg);
|
|
340
165
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
166
|
+
var r;
|
|
167
|
+
o(this, "_invoke", {
|
|
168
|
+
value: function (t, n) {
|
|
169
|
+
function callInvokeWithMethodAndArg() {
|
|
170
|
+
return new e(function (e, r) {
|
|
171
|
+
invoke(t, n, e, r);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
349
175
|
}
|
|
350
|
-
|
|
351
|
-
return previousPromise =
|
|
352
|
-
// If enqueue has been called before, then we want to wait until
|
|
353
|
-
// all previous Promises have been resolved before calling invoke,
|
|
354
|
-
// so that results are always delivered in the correct order. If
|
|
355
|
-
// enqueue has not been called before, then it is important to
|
|
356
|
-
// call invoke immediately, without waiting on a callback to fire,
|
|
357
|
-
// so that the async generator function has the opportunity to do
|
|
358
|
-
// any necessary setup in a predictable way. This predictability
|
|
359
|
-
// is why the Promise constructor synchronously invokes its
|
|
360
|
-
// executor callback, and why async functions synchronously
|
|
361
|
-
// execute code before the first await. Since we implement simple
|
|
362
|
-
// async functions in terms of async generators, it is especially
|
|
363
|
-
// important to get this right, even though it requires care.
|
|
364
|
-
previousPromise ? previousPromise.then(
|
|
365
|
-
callInvokeWithMethodAndArg,
|
|
366
|
-
// Avoid propagating failures to Promises returned by later
|
|
367
|
-
// invocations of the iterator.
|
|
368
|
-
callInvokeWithMethodAndArg
|
|
369
|
-
) : callInvokeWithMethodAndArg();
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
// Define the unified helper method that is used to implement .next,
|
|
373
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
374
|
-
this._invoke = enqueue;
|
|
176
|
+
});
|
|
375
177
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
387
|
-
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
388
|
-
|
|
389
|
-
var iter = new AsyncIterator(
|
|
390
|
-
wrap(innerFn, outerFn, self, tryLocsList),
|
|
391
|
-
PromiseImpl
|
|
392
|
-
);
|
|
393
|
-
|
|
394
|
-
return exports.isGeneratorFunction(outerFn)
|
|
395
|
-
? iter // If outerFn is a generator, return the full iterator.
|
|
396
|
-
: iter.next().then(function(result) {
|
|
397
|
-
return result.done ? result.value : iter.next();
|
|
398
|
-
});
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
402
|
-
var state = GenStateSuspendedStart;
|
|
403
|
-
|
|
404
|
-
return function invoke(method, arg) {
|
|
405
|
-
if (state === GenStateExecuting) {
|
|
406
|
-
throw new Error("Generator is already running");
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
if (state === GenStateCompleted) {
|
|
410
|
-
if (method === "throw") {
|
|
411
|
-
throw arg;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
415
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
416
|
-
return doneResult();
|
|
178
|
+
function makeInvokeMethod(e, r, n) {
|
|
179
|
+
var o = h;
|
|
180
|
+
return function (i, a) {
|
|
181
|
+
if (o === f) throw Error("Generator is already running");
|
|
182
|
+
if (o === s) {
|
|
183
|
+
if ("throw" === i) throw a;
|
|
184
|
+
return {
|
|
185
|
+
value: t,
|
|
186
|
+
done: !0
|
|
187
|
+
};
|
|
417
188
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
426
|
-
if (delegateResult) {
|
|
427
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
428
|
-
return delegateResult;
|
|
189
|
+
for (n.method = i, n.arg = a;;) {
|
|
190
|
+
var c = n.delegate;
|
|
191
|
+
if (c) {
|
|
192
|
+
var u = maybeInvokeDelegate(c, n);
|
|
193
|
+
if (u) {
|
|
194
|
+
if (u === y) continue;
|
|
195
|
+
return u;
|
|
429
196
|
}
|
|
430
197
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
if (
|
|
439
|
-
state = GenStateCompleted;
|
|
440
|
-
throw context.arg;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
context.dispatchException(context.arg);
|
|
444
|
-
|
|
445
|
-
} else if (context.method === "return") {
|
|
446
|
-
context.abrupt("return", context.arg);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
state = GenStateExecuting;
|
|
450
|
-
|
|
451
|
-
var record = tryCatch(innerFn, self, context);
|
|
452
|
-
if (record.type === "normal") {
|
|
453
|
-
// If an exception is thrown from innerFn, we leave state ===
|
|
454
|
-
// GenStateExecuting and loop back for another invocation.
|
|
455
|
-
state = context.done
|
|
456
|
-
? GenStateCompleted
|
|
457
|
-
: GenStateSuspendedYield;
|
|
458
|
-
|
|
459
|
-
if (record.arg === ContinueSentinel) {
|
|
460
|
-
continue;
|
|
461
|
-
}
|
|
462
|
-
|
|
198
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
199
|
+
if (o === h) throw o = s, n.arg;
|
|
200
|
+
n.dispatchException(n.arg);
|
|
201
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
202
|
+
o = f;
|
|
203
|
+
var p = tryCatch(e, r, n);
|
|
204
|
+
if ("normal" === p.type) {
|
|
205
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
463
206
|
return {
|
|
464
|
-
value:
|
|
465
|
-
done:
|
|
207
|
+
value: p.arg,
|
|
208
|
+
done: n.done
|
|
466
209
|
};
|
|
467
|
-
|
|
468
|
-
} else if (record.type === "throw") {
|
|
469
|
-
state = GenStateCompleted;
|
|
470
|
-
// Dispatch the exception by looping back around to the
|
|
471
|
-
// context.dispatchException(context.arg) call above.
|
|
472
|
-
context.method = "throw";
|
|
473
|
-
context.arg = record.arg;
|
|
474
210
|
}
|
|
211
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
475
212
|
}
|
|
476
213
|
};
|
|
477
214
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
var
|
|
485
|
-
|
|
486
|
-
// A .throw or .return when the delegate iterator has no .throw
|
|
487
|
-
// method always terminates the yield* loop.
|
|
488
|
-
context.delegate = null;
|
|
489
|
-
|
|
490
|
-
if (context.method === "throw") {
|
|
491
|
-
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
492
|
-
if (delegate.iterator["return"]) {
|
|
493
|
-
// If the delegate iterator has a return method, give it a
|
|
494
|
-
// chance to clean up.
|
|
495
|
-
context.method = "return";
|
|
496
|
-
context.arg = undefined$1;
|
|
497
|
-
maybeInvokeDelegate(delegate, context);
|
|
498
|
-
|
|
499
|
-
if (context.method === "throw") {
|
|
500
|
-
// If maybeInvokeDelegate(context) changed context.method from
|
|
501
|
-
// "return" to "throw", let that override the TypeError below.
|
|
502
|
-
return ContinueSentinel;
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
context.method = "throw";
|
|
507
|
-
context.arg = new TypeError(
|
|
508
|
-
"The iterator does not provide a 'throw' method");
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
return ContinueSentinel;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
515
|
-
|
|
516
|
-
if (record.type === "throw") {
|
|
517
|
-
context.method = "throw";
|
|
518
|
-
context.arg = record.arg;
|
|
519
|
-
context.delegate = null;
|
|
520
|
-
return ContinueSentinel;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
var info = record.arg;
|
|
524
|
-
|
|
525
|
-
if (! info) {
|
|
526
|
-
context.method = "throw";
|
|
527
|
-
context.arg = new TypeError("iterator result is not an object");
|
|
528
|
-
context.delegate = null;
|
|
529
|
-
return ContinueSentinel;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
if (info.done) {
|
|
533
|
-
// Assign the result of the finished delegate to the temporary
|
|
534
|
-
// variable specified by delegate.resultName (see delegateYield).
|
|
535
|
-
context[delegate.resultName] = info.value;
|
|
536
|
-
|
|
537
|
-
// Resume execution at the desired location (see delegateYield).
|
|
538
|
-
context.next = delegate.nextLoc;
|
|
539
|
-
|
|
540
|
-
// If context.method was "throw" but the delegate handled the
|
|
541
|
-
// exception, let the outer generator proceed normally. If
|
|
542
|
-
// context.method was "next", forget context.arg since it has been
|
|
543
|
-
// "consumed" by the delegate iterator. If context.method was
|
|
544
|
-
// "return", allow the original .return call to continue in the
|
|
545
|
-
// outer generator.
|
|
546
|
-
if (context.method !== "return") {
|
|
547
|
-
context.method = "next";
|
|
548
|
-
context.arg = undefined$1;
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
} else {
|
|
552
|
-
// Re-yield the result returned by the delegate method.
|
|
553
|
-
return info;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
// The delegate iterator is finished, so forget it and continue with
|
|
557
|
-
// the outer generator.
|
|
558
|
-
context.delegate = null;
|
|
559
|
-
return ContinueSentinel;
|
|
215
|
+
function maybeInvokeDelegate(e, r) {
|
|
216
|
+
var n = r.method,
|
|
217
|
+
o = e.iterator[n];
|
|
218
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
219
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
220
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
221
|
+
var a = i.arg;
|
|
222
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
560
223
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
define(Gp, toStringTagSymbol, "Generator");
|
|
567
|
-
|
|
568
|
-
// A Generator should always return itself as the iterator object when the
|
|
569
|
-
// @@iterator function is called on it. Some browsers' implementations of the
|
|
570
|
-
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
571
|
-
// object to not be returned from this call. This ensures that doesn't happen.
|
|
572
|
-
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
573
|
-
define(Gp, iteratorSymbol, function() {
|
|
574
|
-
return this;
|
|
575
|
-
});
|
|
576
|
-
|
|
577
|
-
define(Gp, "toString", function() {
|
|
578
|
-
return "[object Generator]";
|
|
579
|
-
});
|
|
580
|
-
|
|
581
|
-
function pushTryEntry(locs) {
|
|
582
|
-
var entry = { tryLoc: locs[0] };
|
|
583
|
-
|
|
584
|
-
if (1 in locs) {
|
|
585
|
-
entry.catchLoc = locs[1];
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
if (2 in locs) {
|
|
589
|
-
entry.finallyLoc = locs[2];
|
|
590
|
-
entry.afterLoc = locs[3];
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
this.tryEntries.push(entry);
|
|
224
|
+
function pushTryEntry(t) {
|
|
225
|
+
var e = {
|
|
226
|
+
tryLoc: t[0]
|
|
227
|
+
};
|
|
228
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
594
229
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
record.type = "normal";
|
|
599
|
-
delete record.arg;
|
|
600
|
-
entry.completion = record;
|
|
230
|
+
function resetTryEntry(t) {
|
|
231
|
+
var e = t.completion || {};
|
|
232
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
601
233
|
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
// locations where there is no enclosing try statement.
|
|
607
|
-
this.tryEntries = [{ tryLoc: "root" }];
|
|
608
|
-
tryLocsList.forEach(pushTryEntry, this);
|
|
609
|
-
this.reset(true);
|
|
234
|
+
function Context(t) {
|
|
235
|
+
this.tryEntries = [{
|
|
236
|
+
tryLoc: "root"
|
|
237
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
610
238
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
var key = keys.pop();
|
|
624
|
-
if (key in object) {
|
|
625
|
-
next.value = key;
|
|
626
|
-
next.done = false;
|
|
627
|
-
return next;
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
// To avoid creating an additional object, we just hang the .value
|
|
632
|
-
// and .done properties off the next function object itself. This
|
|
633
|
-
// also ensures that the minifier will not anonymize the function.
|
|
634
|
-
next.done = true;
|
|
635
|
-
return next;
|
|
636
|
-
};
|
|
637
|
-
};
|
|
638
|
-
|
|
639
|
-
function values(iterable) {
|
|
640
|
-
if (iterable) {
|
|
641
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
642
|
-
if (iteratorMethod) {
|
|
643
|
-
return iteratorMethod.call(iterable);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
if (typeof iterable.next === "function") {
|
|
647
|
-
return iterable;
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
if (!isNaN(iterable.length)) {
|
|
651
|
-
var i = -1, next = function next() {
|
|
652
|
-
while (++i < iterable.length) {
|
|
653
|
-
if (hasOwn.call(iterable, i)) {
|
|
654
|
-
next.value = iterable[i];
|
|
655
|
-
next.done = false;
|
|
656
|
-
return next;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
next.value = undefined$1;
|
|
661
|
-
next.done = true;
|
|
662
|
-
|
|
663
|
-
return next;
|
|
664
|
-
};
|
|
665
|
-
|
|
666
|
-
return next.next = next;
|
|
239
|
+
function values(e) {
|
|
240
|
+
if (e || "" === e) {
|
|
241
|
+
var r = e[a];
|
|
242
|
+
if (r) return r.call(e);
|
|
243
|
+
if ("function" == typeof e.next) return e;
|
|
244
|
+
if (!isNaN(e.length)) {
|
|
245
|
+
var o = -1,
|
|
246
|
+
i = function next() {
|
|
247
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
248
|
+
return next.value = t, next.done = !0, next;
|
|
249
|
+
};
|
|
250
|
+
return i.next = i;
|
|
667
251
|
}
|
|
668
252
|
}
|
|
669
|
-
|
|
670
|
-
// Return an iterator with no values.
|
|
671
|
-
return { next: doneResult };
|
|
253
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
672
254
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
constructor
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
255
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
256
|
+
value: GeneratorFunctionPrototype,
|
|
257
|
+
configurable: !0
|
|
258
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
259
|
+
value: GeneratorFunction,
|
|
260
|
+
configurable: !0
|
|
261
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
262
|
+
var e = "function" == typeof t && t.constructor;
|
|
263
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
264
|
+
}, e.mark = function (t) {
|
|
265
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
266
|
+
}, e.awrap = function (t) {
|
|
267
|
+
return {
|
|
268
|
+
__await: t
|
|
269
|
+
};
|
|
270
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
271
|
+
return this;
|
|
272
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
273
|
+
void 0 === i && (i = Promise);
|
|
274
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
275
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
276
|
+
return t.done ? t.value : a.next();
|
|
277
|
+
});
|
|
278
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
279
|
+
return this;
|
|
280
|
+
}), define(g, "toString", function () {
|
|
281
|
+
return "[object Generator]";
|
|
282
|
+
}), e.keys = function (t) {
|
|
283
|
+
var e = Object(t),
|
|
284
|
+
r = [];
|
|
285
|
+
for (var n in e) r.push(n);
|
|
286
|
+
return r.reverse(), function next() {
|
|
287
|
+
for (; r.length;) {
|
|
288
|
+
var t = r.pop();
|
|
289
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
705
290
|
}
|
|
291
|
+
return next.done = !0, next;
|
|
292
|
+
};
|
|
293
|
+
}, e.values = values, Context.prototype = {
|
|
294
|
+
constructor: Context,
|
|
295
|
+
reset: function (e) {
|
|
296
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
706
297
|
},
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
var rootEntry = this.tryEntries[0];
|
|
712
|
-
var rootRecord = rootEntry.completion;
|
|
713
|
-
if (rootRecord.type === "throw") {
|
|
714
|
-
throw rootRecord.arg;
|
|
715
|
-
}
|
|
716
|
-
|
|
298
|
+
stop: function () {
|
|
299
|
+
this.done = !0;
|
|
300
|
+
var t = this.tryEntries[0].completion;
|
|
301
|
+
if ("throw" === t.type) throw t.arg;
|
|
717
302
|
return this.rval;
|
|
718
303
|
},
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
var context = this;
|
|
726
|
-
function handle(loc, caught) {
|
|
727
|
-
record.type = "throw";
|
|
728
|
-
record.arg = exception;
|
|
729
|
-
context.next = loc;
|
|
730
|
-
|
|
731
|
-
if (caught) {
|
|
732
|
-
// If the dispatched exception was caught by a catch block,
|
|
733
|
-
// then let that catch block handle the exception normally.
|
|
734
|
-
context.method = "next";
|
|
735
|
-
context.arg = undefined$1;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
return !! caught;
|
|
304
|
+
dispatchException: function (e) {
|
|
305
|
+
if (this.done) throw e;
|
|
306
|
+
var r = this;
|
|
307
|
+
function handle(n, o) {
|
|
308
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
739
309
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
if (entry.tryLoc <= this.prev) {
|
|
753
|
-
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
754
|
-
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
755
|
-
|
|
756
|
-
if (hasCatch && hasFinally) {
|
|
757
|
-
if (this.prev < entry.catchLoc) {
|
|
758
|
-
return handle(entry.catchLoc, true);
|
|
759
|
-
} else if (this.prev < entry.finallyLoc) {
|
|
760
|
-
return handle(entry.finallyLoc);
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
} else if (hasCatch) {
|
|
764
|
-
if (this.prev < entry.catchLoc) {
|
|
765
|
-
return handle(entry.catchLoc, true);
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
} else if (hasFinally) {
|
|
769
|
-
if (this.prev < entry.finallyLoc) {
|
|
770
|
-
return handle(entry.finallyLoc);
|
|
771
|
-
}
|
|
772
|
-
|
|
310
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
311
|
+
var i = this.tryEntries[o],
|
|
312
|
+
a = i.completion;
|
|
313
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
314
|
+
if (i.tryLoc <= this.prev) {
|
|
315
|
+
var c = n.call(i, "catchLoc"),
|
|
316
|
+
u = n.call(i, "finallyLoc");
|
|
317
|
+
if (c && u) {
|
|
318
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
319
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
320
|
+
} else if (c) {
|
|
321
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
773
322
|
} else {
|
|
774
|
-
throw
|
|
323
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
324
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
775
325
|
}
|
|
776
326
|
}
|
|
777
327
|
}
|
|
778
328
|
},
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
hasOwn.call(entry, "finallyLoc") &&
|
|
785
|
-
this.prev < entry.finallyLoc) {
|
|
786
|
-
var finallyEntry = entry;
|
|
329
|
+
abrupt: function (t, e) {
|
|
330
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
331
|
+
var o = this.tryEntries[r];
|
|
332
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
333
|
+
var i = o;
|
|
787
334
|
break;
|
|
788
335
|
}
|
|
789
336
|
}
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
type === "continue") &&
|
|
794
|
-
finallyEntry.tryLoc <= arg &&
|
|
795
|
-
arg <= finallyEntry.finallyLoc) {
|
|
796
|
-
// Ignore the finally entry if control is not jumping to a
|
|
797
|
-
// location outside the try/catch block.
|
|
798
|
-
finallyEntry = null;
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
802
|
-
record.type = type;
|
|
803
|
-
record.arg = arg;
|
|
804
|
-
|
|
805
|
-
if (finallyEntry) {
|
|
806
|
-
this.method = "next";
|
|
807
|
-
this.next = finallyEntry.finallyLoc;
|
|
808
|
-
return ContinueSentinel;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
return this.complete(record);
|
|
337
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
338
|
+
var a = i ? i.completion : {};
|
|
339
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
812
340
|
},
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
throw record.arg;
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
if (record.type === "break" ||
|
|
820
|
-
record.type === "continue") {
|
|
821
|
-
this.next = record.arg;
|
|
822
|
-
} else if (record.type === "return") {
|
|
823
|
-
this.rval = this.arg = record.arg;
|
|
824
|
-
this.method = "return";
|
|
825
|
-
this.next = "end";
|
|
826
|
-
} else if (record.type === "normal" && afterLoc) {
|
|
827
|
-
this.next = afterLoc;
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
return ContinueSentinel;
|
|
341
|
+
complete: function (t, e) {
|
|
342
|
+
if ("throw" === t.type) throw t.arg;
|
|
343
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
831
344
|
},
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
if (entry.finallyLoc === finallyLoc) {
|
|
837
|
-
this.complete(entry.completion, entry.afterLoc);
|
|
838
|
-
resetTryEntry(entry);
|
|
839
|
-
return ContinueSentinel;
|
|
840
|
-
}
|
|
345
|
+
finish: function (t) {
|
|
346
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
347
|
+
var r = this.tryEntries[e];
|
|
348
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
841
349
|
}
|
|
842
350
|
},
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
resetTryEntry(entry);
|
|
351
|
+
catch: function (t) {
|
|
352
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
353
|
+
var r = this.tryEntries[e];
|
|
354
|
+
if (r.tryLoc === t) {
|
|
355
|
+
var n = r.completion;
|
|
356
|
+
if ("throw" === n.type) {
|
|
357
|
+
var o = n.arg;
|
|
358
|
+
resetTryEntry(r);
|
|
852
359
|
}
|
|
853
|
-
return
|
|
360
|
+
return o;
|
|
854
361
|
}
|
|
855
362
|
}
|
|
856
|
-
|
|
857
|
-
// The context.catch method must only be called with a location
|
|
858
|
-
// argument that corresponds to a known catch block.
|
|
859
|
-
throw new Error("illegal catch attempt");
|
|
363
|
+
throw Error("illegal catch attempt");
|
|
860
364
|
},
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
};
|
|
868
|
-
|
|
869
|
-
if (this.method === "next") {
|
|
870
|
-
// Deliberately forget the last sent value so that we don't
|
|
871
|
-
// accidentally pass it on to the delegate.
|
|
872
|
-
this.arg = undefined$1;
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
return ContinueSentinel;
|
|
365
|
+
delegateYield: function (e, r, n) {
|
|
366
|
+
return this.delegate = {
|
|
367
|
+
iterator: values(e),
|
|
368
|
+
resultName: r,
|
|
369
|
+
nextLoc: n
|
|
370
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
876
371
|
}
|
|
877
|
-
};
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
)
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
// problems, please detail your unique predicament in a GitHub issue.
|
|
906
|
-
if (typeof globalThis === "object") {
|
|
907
|
-
globalThis.regeneratorRuntime = runtime;
|
|
908
|
-
} else {
|
|
909
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
910
|
-
}
|
|
372
|
+
}, e;
|
|
373
|
+
}
|
|
374
|
+
function _setPrototypeOf(t, e) {
|
|
375
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
376
|
+
return t.__proto__ = e, t;
|
|
377
|
+
}, _setPrototypeOf(t, e);
|
|
378
|
+
}
|
|
379
|
+
function _wrapNativeSuper(t) {
|
|
380
|
+
var r = "function" == typeof Map ? new Map() : void 0;
|
|
381
|
+
return _wrapNativeSuper = function (t) {
|
|
382
|
+
if (null === t || !_isNativeFunction(t)) return t;
|
|
383
|
+
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
384
|
+
if (void 0 !== r) {
|
|
385
|
+
if (r.has(t)) return r.get(t);
|
|
386
|
+
r.set(t, Wrapper);
|
|
387
|
+
}
|
|
388
|
+
function Wrapper() {
|
|
389
|
+
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
390
|
+
}
|
|
391
|
+
return Wrapper.prototype = Object.create(t.prototype, {
|
|
392
|
+
constructor: {
|
|
393
|
+
value: Wrapper,
|
|
394
|
+
enumerable: !1,
|
|
395
|
+
writable: !0,
|
|
396
|
+
configurable: !0
|
|
397
|
+
}
|
|
398
|
+
}), _setPrototypeOf(Wrapper, t);
|
|
399
|
+
}, _wrapNativeSuper(t);
|
|
911
400
|
}
|
|
912
|
-
});
|
|
913
401
|
|
|
914
402
|
var TooFewSubscribersError = /*#__PURE__*/function (_Error) {
|
|
915
|
-
_inheritsLoose(TooFewSubscribersError, _Error);
|
|
916
|
-
|
|
917
403
|
function TooFewSubscribersError(message) {
|
|
918
404
|
var _this;
|
|
919
|
-
|
|
920
405
|
if (message === void 0) {
|
|
921
406
|
message = 'Too few subscribers';
|
|
922
407
|
}
|
|
923
|
-
|
|
924
408
|
_this = _Error.call(this, message) || this;
|
|
925
409
|
_this.name = 'TooFewSubscribersError';
|
|
926
410
|
return _this;
|
|
927
411
|
}
|
|
928
|
-
|
|
412
|
+
_inheritsLoose(TooFewSubscribersError, _Error);
|
|
929
413
|
return TooFewSubscribersError;
|
|
930
414
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
931
415
|
var TooManySubscribersError = /*#__PURE__*/function (_Error2) {
|
|
932
|
-
_inheritsLoose(TooManySubscribersError, _Error2);
|
|
933
|
-
|
|
934
416
|
function TooManySubscribersError(message) {
|
|
935
417
|
var _this2;
|
|
936
|
-
|
|
937
418
|
if (message === void 0) {
|
|
938
419
|
message = 'Too many subscribers';
|
|
939
420
|
}
|
|
940
|
-
|
|
941
421
|
_this2 = _Error2.call(this, message) || this;
|
|
942
422
|
_this2.name = 'TooManySubscribersError';
|
|
943
423
|
return _this2;
|
|
944
424
|
}
|
|
945
|
-
|
|
425
|
+
_inheritsLoose(TooManySubscribersError, _Error2);
|
|
946
426
|
return TooManySubscribersError;
|
|
947
427
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
948
428
|
var TooFewEventsError = /*#__PURE__*/function (_Error3) {
|
|
949
|
-
_inheritsLoose(TooFewEventsError, _Error3);
|
|
950
|
-
|
|
951
429
|
function TooFewEventsError(message) {
|
|
952
430
|
var _this3;
|
|
953
|
-
|
|
954
431
|
if (message === void 0) {
|
|
955
432
|
message = 'Too few events';
|
|
956
433
|
}
|
|
957
|
-
|
|
958
434
|
_this3 = _Error3.call(this, message) || this;
|
|
959
435
|
_this3.name = 'TooFewEventsError';
|
|
960
436
|
return _this3;
|
|
961
437
|
}
|
|
962
|
-
|
|
438
|
+
_inheritsLoose(TooFewEventsError, _Error3);
|
|
963
439
|
return TooFewEventsError;
|
|
964
440
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
965
441
|
var TooManyEventsError = /*#__PURE__*/function (_Error4) {
|
|
966
|
-
_inheritsLoose(TooManyEventsError, _Error4);
|
|
967
|
-
|
|
968
442
|
function TooManyEventsError(message) {
|
|
969
443
|
var _this4;
|
|
970
|
-
|
|
971
444
|
if (message === void 0) {
|
|
972
445
|
message = 'Too many events';
|
|
973
446
|
}
|
|
974
|
-
|
|
975
447
|
_this4 = _Error4.call(this, message) || this;
|
|
976
448
|
_this4.name = 'TooManyEventsError';
|
|
977
449
|
return _this4;
|
|
978
450
|
}
|
|
979
|
-
|
|
451
|
+
_inheritsLoose(TooManyEventsError, _Error4);
|
|
980
452
|
return TooManyEventsError;
|
|
981
453
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
454
|
+
var TooFewEmailsError = /*#__PURE__*/function (_Error5) {
|
|
455
|
+
function TooFewEmailsError(message) {
|
|
456
|
+
var _this5;
|
|
457
|
+
if (message === void 0) {
|
|
458
|
+
message = 'Too few emails';
|
|
459
|
+
}
|
|
460
|
+
_this5 = _Error5.call(this, message) || this;
|
|
461
|
+
_this5.name = 'TooFewEmailsError';
|
|
462
|
+
return _this5;
|
|
463
|
+
}
|
|
464
|
+
_inheritsLoose(TooFewEmailsError, _Error5);
|
|
465
|
+
return TooFewEmailsError;
|
|
466
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
467
|
+
var TooManyEmailsError = /*#__PURE__*/function (_Error6) {
|
|
468
|
+
function TooManyEmailsError(message) {
|
|
469
|
+
var _this6;
|
|
470
|
+
if (message === void 0) {
|
|
471
|
+
message = 'Too many emails';
|
|
472
|
+
}
|
|
473
|
+
_this6 = _Error6.call(this, message) || this;
|
|
474
|
+
_this6.name = 'TooManyEmailsError';
|
|
475
|
+
return _this6;
|
|
476
|
+
}
|
|
477
|
+
_inheritsLoose(TooManyEmailsError, _Error6);
|
|
478
|
+
return TooManyEmailsError;
|
|
479
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
982
480
|
|
|
983
481
|
var BentoBatch = /*#__PURE__*/function () {
|
|
984
482
|
function BentoBatch(_client) {
|
|
985
483
|
this._client = void 0;
|
|
484
|
+
this._maxEmailBatchSize = 100;
|
|
986
485
|
this._maxBatchSize = 1000;
|
|
987
486
|
this._url = '/batch';
|
|
988
487
|
this._client = _client;
|
|
@@ -1005,56 +504,43 @@ var BentoBatch = /*#__PURE__*/function () {
|
|
|
1005
504
|
* @param parameters
|
|
1006
505
|
* @returns Promise\<number\>
|
|
1007
506
|
*/
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
507
|
var _proto = BentoBatch.prototype;
|
|
1011
|
-
|
|
1012
508
|
_proto.importSubscribers =
|
|
1013
509
|
/*#__PURE__*/
|
|
1014
510
|
function () {
|
|
1015
|
-
var _importSubscribers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
511
|
+
var _importSubscribers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(parameters) {
|
|
1016
512
|
var result;
|
|
1017
|
-
return
|
|
1018
|
-
while (1) {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
case 6:
|
|
1043
|
-
result = _context.sent;
|
|
1044
|
-
return _context.abrupt("return", result.results);
|
|
1045
|
-
|
|
1046
|
-
case 8:
|
|
1047
|
-
case "end":
|
|
1048
|
-
return _context.stop();
|
|
1049
|
-
}
|
|
513
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
514
|
+
while (1) switch (_context.prev = _context.next) {
|
|
515
|
+
case 0:
|
|
516
|
+
if (!(parameters.subscribers.length === 0)) {
|
|
517
|
+
_context.next = 2;
|
|
518
|
+
break;
|
|
519
|
+
}
|
|
520
|
+
throw new TooFewSubscribersError("You must send between 1 and 1,000 subscribers.");
|
|
521
|
+
case 2:
|
|
522
|
+
if (!(parameters.subscribers.length > this._maxBatchSize)) {
|
|
523
|
+
_context.next = 4;
|
|
524
|
+
break;
|
|
525
|
+
}
|
|
526
|
+
throw new TooManySubscribersError("You must send between 1 and 1,000 subscribers.");
|
|
527
|
+
case 4:
|
|
528
|
+
_context.next = 6;
|
|
529
|
+
return this._client.post(this._url + "/subscribers", {
|
|
530
|
+
subscribers: parameters.subscribers
|
|
531
|
+
});
|
|
532
|
+
case 6:
|
|
533
|
+
result = _context.sent;
|
|
534
|
+
return _context.abrupt("return", result.results);
|
|
535
|
+
case 8:
|
|
536
|
+
case "end":
|
|
537
|
+
return _context.stop();
|
|
1050
538
|
}
|
|
1051
539
|
}, _callee, this);
|
|
1052
540
|
}));
|
|
1053
|
-
|
|
1054
541
|
function importSubscribers(_x) {
|
|
1055
542
|
return _importSubscribers.apply(this, arguments);
|
|
1056
543
|
}
|
|
1057
|
-
|
|
1058
544
|
return importSubscribers;
|
|
1059
545
|
}()
|
|
1060
546
|
/**
|
|
@@ -1069,98 +555,130 @@ var BentoBatch = /*#__PURE__*/function () {
|
|
|
1069
555
|
* @returns Promise\<number\>
|
|
1070
556
|
*/
|
|
1071
557
|
;
|
|
1072
|
-
|
|
1073
558
|
_proto.importEvents =
|
|
1074
559
|
/*#__PURE__*/
|
|
1075
560
|
function () {
|
|
1076
|
-
var _importEvents = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
561
|
+
var _importEvents = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(parameters) {
|
|
1077
562
|
var result;
|
|
1078
|
-
return
|
|
1079
|
-
while (1) {
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
case 6:
|
|
1104
|
-
result = _context2.sent;
|
|
1105
|
-
return _context2.abrupt("return", result.results);
|
|
1106
|
-
|
|
1107
|
-
case 8:
|
|
1108
|
-
case "end":
|
|
1109
|
-
return _context2.stop();
|
|
1110
|
-
}
|
|
563
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
564
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
565
|
+
case 0:
|
|
566
|
+
if (!(parameters.events.length === 0)) {
|
|
567
|
+
_context2.next = 2;
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
570
|
+
throw new TooFewEventsError("You must send between 1 and 1,000 events.");
|
|
571
|
+
case 2:
|
|
572
|
+
if (!(parameters.events.length > this._maxBatchSize)) {
|
|
573
|
+
_context2.next = 4;
|
|
574
|
+
break;
|
|
575
|
+
}
|
|
576
|
+
throw new TooManyEventsError("You must send between 1 and 1,000 events.");
|
|
577
|
+
case 4:
|
|
578
|
+
_context2.next = 6;
|
|
579
|
+
return this._client.post(this._url + "/events", {
|
|
580
|
+
events: parameters.events
|
|
581
|
+
});
|
|
582
|
+
case 6:
|
|
583
|
+
result = _context2.sent;
|
|
584
|
+
return _context2.abrupt("return", result.results);
|
|
585
|
+
case 8:
|
|
586
|
+
case "end":
|
|
587
|
+
return _context2.stop();
|
|
1111
588
|
}
|
|
1112
589
|
}, _callee2, this);
|
|
1113
590
|
}));
|
|
1114
|
-
|
|
1115
591
|
function importEvents(_x2) {
|
|
1116
592
|
return _importEvents.apply(this, arguments);
|
|
1117
593
|
}
|
|
1118
|
-
|
|
1119
594
|
return importEvents;
|
|
595
|
+
}()
|
|
596
|
+
/**
|
|
597
|
+
* Creates a batch job to send transactional emails from Bento's infrastructure. You can pass in
|
|
598
|
+
* between 1 and 100 emails to send.
|
|
599
|
+
*
|
|
600
|
+
* Each email must have a `to` address, a `from` address, a `subject`, an `html_body`
|
|
601
|
+
* and `transactional: true`.
|
|
602
|
+
* In addition you can add a `personalizations` object to provide
|
|
603
|
+
* liquid tsags that will be injected into the email.
|
|
604
|
+
*
|
|
605
|
+
* Returns the number of events that were imported.
|
|
606
|
+
*
|
|
607
|
+
* @param parameters
|
|
608
|
+
* @returns Promise\<number\>
|
|
609
|
+
*/
|
|
610
|
+
;
|
|
611
|
+
_proto.sendTransactionalEmails =
|
|
612
|
+
/*#__PURE__*/
|
|
613
|
+
function () {
|
|
614
|
+
var _sendTransactionalEmails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(parameters) {
|
|
615
|
+
var result;
|
|
616
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
617
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
618
|
+
case 0:
|
|
619
|
+
if (!(parameters.emails.length === 0)) {
|
|
620
|
+
_context3.next = 2;
|
|
621
|
+
break;
|
|
622
|
+
}
|
|
623
|
+
throw new TooFewEmailsError("You must send between 1 and 100 emails.");
|
|
624
|
+
case 2:
|
|
625
|
+
if (!(parameters.emails.length > this._maxEmailBatchSize)) {
|
|
626
|
+
_context3.next = 4;
|
|
627
|
+
break;
|
|
628
|
+
}
|
|
629
|
+
throw new TooManyEmailsError("You must send between 1 and 100 emails.");
|
|
630
|
+
case 4:
|
|
631
|
+
_context3.next = 6;
|
|
632
|
+
return this._client.post(this._url + "/emails", {
|
|
633
|
+
emails: parameters.emails
|
|
634
|
+
});
|
|
635
|
+
case 6:
|
|
636
|
+
result = _context3.sent;
|
|
637
|
+
return _context3.abrupt("return", result.results);
|
|
638
|
+
case 8:
|
|
639
|
+
case "end":
|
|
640
|
+
return _context3.stop();
|
|
641
|
+
}
|
|
642
|
+
}, _callee3, this);
|
|
643
|
+
}));
|
|
644
|
+
function sendTransactionalEmails(_x3) {
|
|
645
|
+
return _sendTransactionalEmails.apply(this, arguments);
|
|
646
|
+
}
|
|
647
|
+
return sendTransactionalEmails;
|
|
1120
648
|
}();
|
|
1121
|
-
|
|
1122
649
|
return BentoBatch;
|
|
1123
650
|
}();
|
|
1124
651
|
|
|
1125
652
|
var NotAuthorizedError = /*#__PURE__*/function (_Error) {
|
|
1126
|
-
_inheritsLoose(NotAuthorizedError, _Error);
|
|
1127
|
-
|
|
1128
653
|
function NotAuthorizedError(message) {
|
|
1129
654
|
var _this;
|
|
1130
|
-
|
|
1131
655
|
if (message === void 0) {
|
|
1132
656
|
message = 'Not authorized';
|
|
1133
657
|
}
|
|
1134
|
-
|
|
1135
658
|
_this = _Error.call(this, message) || this;
|
|
1136
659
|
_this.name = 'NotAuthorizedError';
|
|
1137
660
|
return _this;
|
|
1138
661
|
}
|
|
1139
|
-
|
|
662
|
+
_inheritsLoose(NotAuthorizedError, _Error);
|
|
1140
663
|
return NotAuthorizedError;
|
|
1141
664
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
1142
665
|
var RateLimitedError = /*#__PURE__*/function (_Error2) {
|
|
1143
|
-
_inheritsLoose(RateLimitedError, _Error2);
|
|
1144
|
-
|
|
1145
666
|
function RateLimitedError(message) {
|
|
1146
667
|
var _this2;
|
|
1147
|
-
|
|
1148
668
|
if (message === void 0) {
|
|
1149
669
|
message = 'You are being rate limited';
|
|
1150
670
|
}
|
|
1151
|
-
|
|
1152
671
|
_this2 = _Error2.call(this, message) || this;
|
|
1153
672
|
_this2.name = 'RateLimitedError';
|
|
1154
673
|
return _this2;
|
|
1155
674
|
}
|
|
1156
|
-
|
|
675
|
+
_inheritsLoose(RateLimitedError, _Error2);
|
|
1157
676
|
return RateLimitedError;
|
|
1158
677
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
1159
678
|
|
|
1160
679
|
var BentoClient = /*#__PURE__*/function () {
|
|
1161
680
|
function BentoClient(options) {
|
|
1162
681
|
var _options$clientOption;
|
|
1163
|
-
|
|
1164
682
|
this._headers = {};
|
|
1165
683
|
this._baseUrl = 'https://app.bentonow.com/api/v1';
|
|
1166
684
|
this._siteUuid = '';
|
|
@@ -1178,51 +696,38 @@ var BentoClient = /*#__PURE__*/function () {
|
|
|
1178
696
|
* @param payload object
|
|
1179
697
|
* @returns Promise\<T\>
|
|
1180
698
|
* */
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
699
|
var _proto = BentoClient.prototype;
|
|
1184
|
-
|
|
1185
700
|
_proto.get = function get(endpoint, payload) {
|
|
1186
701
|
var _this = this;
|
|
1187
|
-
|
|
1188
702
|
if (payload === void 0) {
|
|
1189
703
|
payload = {};
|
|
1190
704
|
}
|
|
1191
|
-
|
|
1192
705
|
return new Promise(function (resolve, reject) {
|
|
1193
706
|
var queryParameters = _this._getQueryParameters(payload);
|
|
1194
|
-
|
|
1195
707
|
fetch("" + _this._baseUrl + endpoint + "?" + queryParameters, {
|
|
1196
708
|
method: 'GET',
|
|
1197
709
|
headers: _this._headers
|
|
1198
710
|
}).then( /*#__PURE__*/function () {
|
|
1199
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/
|
|
1200
|
-
return
|
|
1201
|
-
while (1) {
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
throw _context.sent;
|
|
1217
|
-
|
|
1218
|
-
case 5:
|
|
1219
|
-
case "end":
|
|
1220
|
-
return _context.stop();
|
|
1221
|
-
}
|
|
711
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(result) {
|
|
712
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
713
|
+
while (1) switch (_context.prev = _context.next) {
|
|
714
|
+
case 0:
|
|
715
|
+
if (!_this._isSuccessfulStatus(result.status)) {
|
|
716
|
+
_context.next = 2;
|
|
717
|
+
break;
|
|
718
|
+
}
|
|
719
|
+
return _context.abrupt("return", result.json());
|
|
720
|
+
case 2:
|
|
721
|
+
_context.next = 4;
|
|
722
|
+
return _this._getErrorForResponse(result);
|
|
723
|
+
case 4:
|
|
724
|
+
throw _context.sent;
|
|
725
|
+
case 5:
|
|
726
|
+
case "end":
|
|
727
|
+
return _context.stop();
|
|
1222
728
|
}
|
|
1223
729
|
}, _callee);
|
|
1224
730
|
}));
|
|
1225
|
-
|
|
1226
731
|
return function (_x) {
|
|
1227
732
|
return _ref.apply(this, arguments);
|
|
1228
733
|
};
|
|
@@ -1240,19 +745,14 @@ var BentoClient = /*#__PURE__*/function () {
|
|
|
1240
745
|
* @param endpoint string
|
|
1241
746
|
* @param payload object
|
|
1242
747
|
* @returns Promise\<T\>
|
|
1243
|
-
*
|
|
1244
|
-
;
|
|
1245
|
-
|
|
748
|
+
* */;
|
|
1246
749
|
_proto.post = function post(endpoint, payload) {
|
|
1247
750
|
var _this2 = this;
|
|
1248
|
-
|
|
1249
751
|
if (payload === void 0) {
|
|
1250
752
|
payload = {};
|
|
1251
753
|
}
|
|
1252
|
-
|
|
1253
754
|
return new Promise(function (resolve, reject) {
|
|
1254
755
|
var body = _this2._getBody(payload);
|
|
1255
|
-
|
|
1256
756
|
fetch("" + _this2._baseUrl + endpoint, {
|
|
1257
757
|
method: 'POST',
|
|
1258
758
|
headers: _extends({}, _this2._headers, {
|
|
@@ -1260,33 +760,26 @@ var BentoClient = /*#__PURE__*/function () {
|
|
|
1260
760
|
}),
|
|
1261
761
|
body: body
|
|
1262
762
|
}).then( /*#__PURE__*/function () {
|
|
1263
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/
|
|
1264
|
-
return
|
|
1265
|
-
while (1) {
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
throw _context2.sent;
|
|
1281
|
-
|
|
1282
|
-
case 5:
|
|
1283
|
-
case "end":
|
|
1284
|
-
return _context2.stop();
|
|
1285
|
-
}
|
|
763
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(result) {
|
|
764
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
765
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
766
|
+
case 0:
|
|
767
|
+
if (!_this2._isSuccessfulStatus(result.status)) {
|
|
768
|
+
_context2.next = 2;
|
|
769
|
+
break;
|
|
770
|
+
}
|
|
771
|
+
return _context2.abrupt("return", result.json());
|
|
772
|
+
case 2:
|
|
773
|
+
_context2.next = 4;
|
|
774
|
+
return _this2._getErrorForResponse(result);
|
|
775
|
+
case 4:
|
|
776
|
+
throw _context2.sent;
|
|
777
|
+
case 5:
|
|
778
|
+
case "end":
|
|
779
|
+
return _context2.stop();
|
|
1286
780
|
}
|
|
1287
781
|
}, _callee2);
|
|
1288
782
|
}));
|
|
1289
|
-
|
|
1290
783
|
return function (_x2) {
|
|
1291
784
|
return _ref2.apply(this, arguments);
|
|
1292
785
|
};
|
|
@@ -1303,9 +796,7 @@ var BentoClient = /*#__PURE__*/function () {
|
|
|
1303
796
|
*
|
|
1304
797
|
* @param authentication AuthenticationOptions
|
|
1305
798
|
* @returns HeadersInit
|
|
1306
|
-
|
|
1307
|
-
;
|
|
1308
|
-
|
|
799
|
+
*/;
|
|
1309
800
|
_proto._extractHeaders = function _extractHeaders(authentication) {
|
|
1310
801
|
var authenticationKey = Buffer.from(authentication.publishableKey + ":" + authentication.secretKey).toString('base64');
|
|
1311
802
|
return {
|
|
@@ -1318,9 +809,7 @@ var BentoClient = /*#__PURE__*/function () {
|
|
|
1318
809
|
*
|
|
1319
810
|
* @param payload object
|
|
1320
811
|
* @returns string
|
|
1321
|
-
|
|
1322
|
-
;
|
|
1323
|
-
|
|
812
|
+
*/;
|
|
1324
813
|
_proto._getBody = function _getBody(payload) {
|
|
1325
814
|
return JSON.stringify(_extends({}, payload, {
|
|
1326
815
|
site_uuid: this._siteUuid
|
|
@@ -1332,23 +821,18 @@ var BentoClient = /*#__PURE__*/function () {
|
|
|
1332
821
|
*
|
|
1333
822
|
* @param payload object
|
|
1334
823
|
* @returns string
|
|
1335
|
-
|
|
1336
|
-
;
|
|
1337
|
-
|
|
824
|
+
*/;
|
|
1338
825
|
_proto._getQueryParameters = function _getQueryParameters(payload) {
|
|
1339
826
|
var body = _extends({}, payload, {
|
|
1340
827
|
site_uuid: this._siteUuid
|
|
1341
828
|
});
|
|
1342
|
-
|
|
1343
829
|
var queryParameters = new URLSearchParams();
|
|
1344
|
-
|
|
1345
830
|
for (var _i = 0, _Object$entries = Object.entries(body); _i < _Object$entries.length; _i++) {
|
|
1346
831
|
var _Object$entries$_i = _Object$entries[_i],
|
|
1347
|
-
|
|
1348
|
-
|
|
832
|
+
key = _Object$entries$_i[0],
|
|
833
|
+
value = _Object$entries$_i[1];
|
|
1349
834
|
queryParameters.append(key, value);
|
|
1350
835
|
}
|
|
1351
|
-
|
|
1352
836
|
return queryParameters.toString();
|
|
1353
837
|
}
|
|
1354
838
|
/**
|
|
@@ -1356,9 +840,7 @@ var BentoClient = /*#__PURE__*/function () {
|
|
|
1356
840
|
*
|
|
1357
841
|
* @param statusCode number
|
|
1358
842
|
* @returns boolean
|
|
1359
|
-
|
|
1360
|
-
;
|
|
1361
|
-
|
|
843
|
+
*/;
|
|
1362
844
|
_proto._isSuccessfulStatus = function _isSuccessfulStatus(statusCode) {
|
|
1363
845
|
var validStatusCodes = [200, 201];
|
|
1364
846
|
return validStatusCodes.includes(statusCode);
|
|
@@ -1368,84 +850,65 @@ var BentoClient = /*#__PURE__*/function () {
|
|
|
1368
850
|
*
|
|
1369
851
|
* @param response Response
|
|
1370
852
|
* @returns Error
|
|
1371
|
-
|
|
1372
|
-
;
|
|
1373
|
-
|
|
853
|
+
*/;
|
|
1374
854
|
_proto._getErrorForResponse =
|
|
1375
855
|
/*#__PURE__*/
|
|
1376
856
|
function () {
|
|
1377
|
-
var _getErrorForResponse2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
857
|
+
var _getErrorForResponse2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(response) {
|
|
1378
858
|
var contentType, responseMessage;
|
|
1379
|
-
return
|
|
1380
|
-
while (1) {
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
if (!(response.status === 401)) {
|
|
1388
|
-
_context3.next = 3;
|
|
1389
|
-
break;
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
return _context3.abrupt("return", new NotAuthorizedError());
|
|
1393
|
-
|
|
1394
|
-
case 3:
|
|
1395
|
-
if (!(response.status === 429)) {
|
|
1396
|
-
_context3.next = 5;
|
|
1397
|
-
break;
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
return _context3.abrupt("return", new RateLimitedError());
|
|
1401
|
-
|
|
1402
|
-
case 5:
|
|
1403
|
-
contentType = response.headers.get('Content-Type');
|
|
1404
|
-
responseMessage = '';
|
|
1405
|
-
_context3.t0 = contentType == null ? void 0 : contentType.toLocaleLowerCase();
|
|
1406
|
-
_context3.next = _context3.t0 === 'text/plain' ? 10 : _context3.t0 === 'application/json' ? 14 : 20;
|
|
859
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
860
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
861
|
+
case 0:
|
|
862
|
+
if (this._logErrors) {
|
|
863
|
+
console.error(response);
|
|
864
|
+
}
|
|
865
|
+
if (!(response.status === 401)) {
|
|
866
|
+
_context3.next = 3;
|
|
1407
867
|
break;
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
868
|
+
}
|
|
869
|
+
return _context3.abrupt("return", new NotAuthorizedError());
|
|
870
|
+
case 3:
|
|
871
|
+
if (!(response.status === 429)) {
|
|
872
|
+
_context3.next = 5;
|
|
873
|
+
break;
|
|
874
|
+
}
|
|
875
|
+
return _context3.abrupt("return", new RateLimitedError());
|
|
876
|
+
case 5:
|
|
877
|
+
contentType = response.headers.get('Content-Type');
|
|
878
|
+
responseMessage = '';
|
|
879
|
+
_context3.t0 = contentType == null ? void 0 : contentType.toLocaleLowerCase();
|
|
880
|
+
_context3.next = _context3.t0 === 'text/plain' ? 10 : _context3.t0 === 'application/json' ? 14 : 20;
|
|
881
|
+
break;
|
|
882
|
+
case 10:
|
|
883
|
+
_context3.next = 12;
|
|
884
|
+
return response.text();
|
|
885
|
+
case 12:
|
|
886
|
+
responseMessage = _context3.sent;
|
|
887
|
+
return _context3.abrupt("break", 22);
|
|
888
|
+
case 14:
|
|
889
|
+
_context3.t1 = JSON;
|
|
890
|
+
_context3.next = 17;
|
|
891
|
+
return response.json();
|
|
892
|
+
case 17:
|
|
893
|
+
_context3.t2 = _context3.sent;
|
|
894
|
+
responseMessage = _context3.t1.stringify.call(_context3.t1, _context3.t2);
|
|
895
|
+
return _context3.abrupt("break", 22);
|
|
896
|
+
case 20:
|
|
897
|
+
responseMessage = 'Unknown response from the Bento API.';
|
|
898
|
+
return _context3.abrupt("break", 22);
|
|
899
|
+
case 22:
|
|
900
|
+
return _context3.abrupt("return", new Error("[" + response.status + "] - " + responseMessage));
|
|
901
|
+
case 23:
|
|
902
|
+
case "end":
|
|
903
|
+
return _context3.stop();
|
|
1438
904
|
}
|
|
1439
905
|
}, _callee3, this);
|
|
1440
906
|
}));
|
|
1441
|
-
|
|
1442
907
|
function _getErrorForResponse(_x3) {
|
|
1443
908
|
return _getErrorForResponse2.apply(this, arguments);
|
|
1444
909
|
}
|
|
1445
|
-
|
|
1446
910
|
return _getErrorForResponse;
|
|
1447
911
|
}();
|
|
1448
|
-
|
|
1449
912
|
return BentoClient;
|
|
1450
913
|
}();
|
|
1451
914
|
|
|
@@ -1453,7 +916,6 @@ var BentoClient = /*#__PURE__*/function () {
|
|
|
1453
916
|
* Command Enums
|
|
1454
917
|
*/
|
|
1455
918
|
var CommandTypes;
|
|
1456
|
-
|
|
1457
919
|
(function (CommandTypes) {
|
|
1458
920
|
CommandTypes["ADD_FIELD"] = "add_field";
|
|
1459
921
|
CommandTypes["ADD_TAG"] = "add_tag";
|
|
@@ -1483,53 +945,41 @@ var BentoCommands = /*#__PURE__*/function () {
|
|
|
1483
945
|
* @param parameters \{ email: string, tagName: string \}
|
|
1484
946
|
* @returns Promise\<Subscriber | null\>
|
|
1485
947
|
*/
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
948
|
var _proto = BentoCommands.prototype;
|
|
1489
|
-
|
|
1490
949
|
_proto.addTag =
|
|
1491
950
|
/*#__PURE__*/
|
|
1492
951
|
function () {
|
|
1493
|
-
var _addTag = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
952
|
+
var _addTag = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(parameters) {
|
|
1494
953
|
var result;
|
|
1495
|
-
return
|
|
1496
|
-
while (1) {
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
command:
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
query: parameters.tagName
|
|
1505
|
-
}
|
|
1506
|
-
});
|
|
1507
|
-
|
|
1508
|
-
case 2:
|
|
1509
|
-
result = _context.sent;
|
|
1510
|
-
|
|
1511
|
-
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1512
|
-
_context.next = 5;
|
|
1513
|
-
break;
|
|
954
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
955
|
+
while (1) switch (_context.prev = _context.next) {
|
|
956
|
+
case 0:
|
|
957
|
+
_context.next = 2;
|
|
958
|
+
return this._client.post(this._url, {
|
|
959
|
+
command: {
|
|
960
|
+
command: CommandTypes.ADD_TAG,
|
|
961
|
+
email: parameters.email,
|
|
962
|
+
query: parameters.tagName
|
|
1514
963
|
}
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
964
|
+
});
|
|
965
|
+
case 2:
|
|
966
|
+
result = _context.sent;
|
|
967
|
+
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
968
|
+
_context.next = 5;
|
|
969
|
+
break;
|
|
970
|
+
}
|
|
971
|
+
return _context.abrupt("return", null);
|
|
972
|
+
case 5:
|
|
973
|
+
return _context.abrupt("return", result.data);
|
|
974
|
+
case 6:
|
|
975
|
+
case "end":
|
|
976
|
+
return _context.stop();
|
|
1525
977
|
}
|
|
1526
978
|
}, _callee, this);
|
|
1527
979
|
}));
|
|
1528
|
-
|
|
1529
980
|
function addTag(_x) {
|
|
1530
981
|
return _addTag.apply(this, arguments);
|
|
1531
982
|
}
|
|
1532
|
-
|
|
1533
983
|
return addTag;
|
|
1534
984
|
}()
|
|
1535
985
|
/**
|
|
@@ -1539,50 +989,40 @@ var BentoCommands = /*#__PURE__*/function () {
|
|
|
1539
989
|
* @returns Promise\<Subscriber | null\>
|
|
1540
990
|
*/
|
|
1541
991
|
;
|
|
1542
|
-
|
|
1543
992
|
_proto.removeTag =
|
|
1544
993
|
/*#__PURE__*/
|
|
1545
994
|
function () {
|
|
1546
|
-
var _removeTag = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
995
|
+
var _removeTag = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(parameters) {
|
|
1547
996
|
var result;
|
|
1548
|
-
return
|
|
1549
|
-
while (1) {
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
command:
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
query: parameters.tagName
|
|
1558
|
-
}
|
|
1559
|
-
});
|
|
1560
|
-
|
|
1561
|
-
case 2:
|
|
1562
|
-
result = _context2.sent;
|
|
1563
|
-
|
|
1564
|
-
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1565
|
-
_context2.next = 5;
|
|
1566
|
-
break;
|
|
997
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
998
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
999
|
+
case 0:
|
|
1000
|
+
_context2.next = 2;
|
|
1001
|
+
return this._client.post(this._url, {
|
|
1002
|
+
command: {
|
|
1003
|
+
command: CommandTypes.REMOVE_TAG,
|
|
1004
|
+
email: parameters.email,
|
|
1005
|
+
query: parameters.tagName
|
|
1567
1006
|
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1007
|
+
});
|
|
1008
|
+
case 2:
|
|
1009
|
+
result = _context2.sent;
|
|
1010
|
+
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1011
|
+
_context2.next = 5;
|
|
1012
|
+
break;
|
|
1013
|
+
}
|
|
1014
|
+
return _context2.abrupt("return", null);
|
|
1015
|
+
case 5:
|
|
1016
|
+
return _context2.abrupt("return", result.data);
|
|
1017
|
+
case 6:
|
|
1018
|
+
case "end":
|
|
1019
|
+
return _context2.stop();
|
|
1578
1020
|
}
|
|
1579
1021
|
}, _callee2, this);
|
|
1580
1022
|
}));
|
|
1581
|
-
|
|
1582
1023
|
function removeTag(_x2) {
|
|
1583
1024
|
return _removeTag.apply(this, arguments);
|
|
1584
1025
|
}
|
|
1585
|
-
|
|
1586
1026
|
return removeTag;
|
|
1587
1027
|
}()
|
|
1588
1028
|
/**
|
|
@@ -1598,50 +1038,40 @@ var BentoCommands = /*#__PURE__*/function () {
|
|
|
1598
1038
|
* @returns Promise\<Subscriber | null\>
|
|
1599
1039
|
*/
|
|
1600
1040
|
;
|
|
1601
|
-
|
|
1602
1041
|
_proto.addField =
|
|
1603
1042
|
/*#__PURE__*/
|
|
1604
1043
|
function () {
|
|
1605
|
-
var _addField = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1044
|
+
var _addField = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(parameters) {
|
|
1606
1045
|
var result;
|
|
1607
|
-
return
|
|
1608
|
-
while (1) {
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
command:
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
query: parameters.field
|
|
1617
|
-
}
|
|
1618
|
-
});
|
|
1619
|
-
|
|
1620
|
-
case 2:
|
|
1621
|
-
result = _context3.sent;
|
|
1622
|
-
|
|
1623
|
-
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1624
|
-
_context3.next = 5;
|
|
1625
|
-
break;
|
|
1046
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1047
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
1048
|
+
case 0:
|
|
1049
|
+
_context3.next = 2;
|
|
1050
|
+
return this._client.post(this._url, {
|
|
1051
|
+
command: {
|
|
1052
|
+
command: CommandTypes.ADD_FIELD,
|
|
1053
|
+
email: parameters.email,
|
|
1054
|
+
query: parameters.field
|
|
1626
1055
|
}
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1056
|
+
});
|
|
1057
|
+
case 2:
|
|
1058
|
+
result = _context3.sent;
|
|
1059
|
+
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1060
|
+
_context3.next = 5;
|
|
1061
|
+
break;
|
|
1062
|
+
}
|
|
1063
|
+
return _context3.abrupt("return", null);
|
|
1064
|
+
case 5:
|
|
1065
|
+
return _context3.abrupt("return", result.data);
|
|
1066
|
+
case 6:
|
|
1067
|
+
case "end":
|
|
1068
|
+
return _context3.stop();
|
|
1637
1069
|
}
|
|
1638
1070
|
}, _callee3, this);
|
|
1639
1071
|
}));
|
|
1640
|
-
|
|
1641
1072
|
function addField(_x3) {
|
|
1642
1073
|
return _addField.apply(this, arguments);
|
|
1643
1074
|
}
|
|
1644
|
-
|
|
1645
1075
|
return addField;
|
|
1646
1076
|
}()
|
|
1647
1077
|
/**
|
|
@@ -1651,50 +1081,40 @@ var BentoCommands = /*#__PURE__*/function () {
|
|
|
1651
1081
|
* @returns Promise\<Subscriber | null\>
|
|
1652
1082
|
*/
|
|
1653
1083
|
;
|
|
1654
|
-
|
|
1655
1084
|
_proto.removeField =
|
|
1656
1085
|
/*#__PURE__*/
|
|
1657
1086
|
function () {
|
|
1658
|
-
var _removeField = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1087
|
+
var _removeField = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(parameters) {
|
|
1659
1088
|
var result;
|
|
1660
|
-
return
|
|
1661
|
-
while (1) {
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
command:
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
query: parameters.fieldName
|
|
1670
|
-
}
|
|
1671
|
-
});
|
|
1672
|
-
|
|
1673
|
-
case 2:
|
|
1674
|
-
result = _context4.sent;
|
|
1675
|
-
|
|
1676
|
-
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1677
|
-
_context4.next = 5;
|
|
1678
|
-
break;
|
|
1089
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1090
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
1091
|
+
case 0:
|
|
1092
|
+
_context4.next = 2;
|
|
1093
|
+
return this._client.post(this._url, {
|
|
1094
|
+
command: {
|
|
1095
|
+
command: CommandTypes.REMOVE_FIELD,
|
|
1096
|
+
email: parameters.email,
|
|
1097
|
+
query: parameters.fieldName
|
|
1679
1098
|
}
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1099
|
+
});
|
|
1100
|
+
case 2:
|
|
1101
|
+
result = _context4.sent;
|
|
1102
|
+
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1103
|
+
_context4.next = 5;
|
|
1104
|
+
break;
|
|
1105
|
+
}
|
|
1106
|
+
return _context4.abrupt("return", null);
|
|
1107
|
+
case 5:
|
|
1108
|
+
return _context4.abrupt("return", result.data);
|
|
1109
|
+
case 6:
|
|
1110
|
+
case "end":
|
|
1111
|
+
return _context4.stop();
|
|
1690
1112
|
}
|
|
1691
1113
|
}, _callee4, this);
|
|
1692
1114
|
}));
|
|
1693
|
-
|
|
1694
1115
|
function removeField(_x4) {
|
|
1695
1116
|
return _removeField.apply(this, arguments);
|
|
1696
1117
|
}
|
|
1697
|
-
|
|
1698
1118
|
return removeField;
|
|
1699
1119
|
}()
|
|
1700
1120
|
/**
|
|
@@ -1708,49 +1128,39 @@ var BentoCommands = /*#__PURE__*/function () {
|
|
|
1708
1128
|
* @returns Promise\<Subscriber | null\>
|
|
1709
1129
|
*/
|
|
1710
1130
|
;
|
|
1711
|
-
|
|
1712
1131
|
_proto.subscribe =
|
|
1713
1132
|
/*#__PURE__*/
|
|
1714
1133
|
function () {
|
|
1715
|
-
var _subscribe = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1134
|
+
var _subscribe = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(parameters) {
|
|
1716
1135
|
var result;
|
|
1717
|
-
return
|
|
1718
|
-
while (1) {
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
command:
|
|
1724
|
-
|
|
1725
|
-
email: parameters.email
|
|
1726
|
-
}
|
|
1727
|
-
});
|
|
1728
|
-
|
|
1729
|
-
case 2:
|
|
1730
|
-
result = _context5.sent;
|
|
1731
|
-
|
|
1732
|
-
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1733
|
-
_context5.next = 5;
|
|
1734
|
-
break;
|
|
1136
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1137
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
1138
|
+
case 0:
|
|
1139
|
+
_context5.next = 2;
|
|
1140
|
+
return this._client.post(this._url, {
|
|
1141
|
+
command: {
|
|
1142
|
+
command: CommandTypes.SUBSCRIBE,
|
|
1143
|
+
email: parameters.email
|
|
1735
1144
|
}
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1145
|
+
});
|
|
1146
|
+
case 2:
|
|
1147
|
+
result = _context5.sent;
|
|
1148
|
+
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1149
|
+
_context5.next = 5;
|
|
1150
|
+
break;
|
|
1151
|
+
}
|
|
1152
|
+
return _context5.abrupt("return", null);
|
|
1153
|
+
case 5:
|
|
1154
|
+
return _context5.abrupt("return", result.data);
|
|
1155
|
+
case 6:
|
|
1156
|
+
case "end":
|
|
1157
|
+
return _context5.stop();
|
|
1746
1158
|
}
|
|
1747
1159
|
}, _callee5, this);
|
|
1748
1160
|
}));
|
|
1749
|
-
|
|
1750
1161
|
function subscribe(_x5) {
|
|
1751
1162
|
return _subscribe.apply(this, arguments);
|
|
1752
1163
|
}
|
|
1753
|
-
|
|
1754
1164
|
return subscribe;
|
|
1755
1165
|
}()
|
|
1756
1166
|
/**
|
|
@@ -1765,49 +1175,39 @@ var BentoCommands = /*#__PURE__*/function () {
|
|
|
1765
1175
|
* @returns Promise\<Subscriber | null\>
|
|
1766
1176
|
*/
|
|
1767
1177
|
;
|
|
1768
|
-
|
|
1769
1178
|
_proto.unsubscribe =
|
|
1770
1179
|
/*#__PURE__*/
|
|
1771
1180
|
function () {
|
|
1772
|
-
var _unsubscribe = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1181
|
+
var _unsubscribe = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(parameters) {
|
|
1773
1182
|
var result;
|
|
1774
|
-
return
|
|
1775
|
-
while (1) {
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
command:
|
|
1781
|
-
|
|
1782
|
-
email: parameters.email
|
|
1783
|
-
}
|
|
1784
|
-
});
|
|
1785
|
-
|
|
1786
|
-
case 2:
|
|
1787
|
-
result = _context6.sent;
|
|
1788
|
-
|
|
1789
|
-
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1790
|
-
_context6.next = 5;
|
|
1791
|
-
break;
|
|
1183
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
1184
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
1185
|
+
case 0:
|
|
1186
|
+
_context6.next = 2;
|
|
1187
|
+
return this._client.post(this._url, {
|
|
1188
|
+
command: {
|
|
1189
|
+
command: CommandTypes.UNSUBSCRIBE,
|
|
1190
|
+
email: parameters.email
|
|
1792
1191
|
}
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1192
|
+
});
|
|
1193
|
+
case 2:
|
|
1194
|
+
result = _context6.sent;
|
|
1195
|
+
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1196
|
+
_context6.next = 5;
|
|
1197
|
+
break;
|
|
1198
|
+
}
|
|
1199
|
+
return _context6.abrupt("return", null);
|
|
1200
|
+
case 5:
|
|
1201
|
+
return _context6.abrupt("return", result.data);
|
|
1202
|
+
case 6:
|
|
1203
|
+
case "end":
|
|
1204
|
+
return _context6.stop();
|
|
1803
1205
|
}
|
|
1804
1206
|
}, _callee6, this);
|
|
1805
1207
|
}));
|
|
1806
|
-
|
|
1807
1208
|
function unsubscribe(_x6) {
|
|
1808
1209
|
return _unsubscribe.apply(this, arguments);
|
|
1809
1210
|
}
|
|
1810
|
-
|
|
1811
1211
|
return unsubscribe;
|
|
1812
1212
|
}()
|
|
1813
1213
|
/**
|
|
@@ -1817,53 +1217,42 @@ var BentoCommands = /*#__PURE__*/function () {
|
|
|
1817
1217
|
* @returns Promise\<Subscriber | null\>
|
|
1818
1218
|
*/
|
|
1819
1219
|
;
|
|
1820
|
-
|
|
1821
1220
|
_proto.changeEmail =
|
|
1822
1221
|
/*#__PURE__*/
|
|
1823
1222
|
function () {
|
|
1824
|
-
var _changeEmail = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1223
|
+
var _changeEmail = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(parameters) {
|
|
1825
1224
|
var result;
|
|
1826
|
-
return
|
|
1827
|
-
while (1) {
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
command:
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
query: parameters.newEmail
|
|
1836
|
-
}
|
|
1837
|
-
});
|
|
1838
|
-
|
|
1839
|
-
case 2:
|
|
1840
|
-
result = _context7.sent;
|
|
1841
|
-
|
|
1842
|
-
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1843
|
-
_context7.next = 5;
|
|
1844
|
-
break;
|
|
1225
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
1226
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1227
|
+
case 0:
|
|
1228
|
+
_context7.next = 2;
|
|
1229
|
+
return this._client.post(this._url, {
|
|
1230
|
+
command: {
|
|
1231
|
+
command: CommandTypes.CHANGE_EMAIL,
|
|
1232
|
+
email: parameters.oldEmail,
|
|
1233
|
+
query: parameters.newEmail
|
|
1845
1234
|
}
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1235
|
+
});
|
|
1236
|
+
case 2:
|
|
1237
|
+
result = _context7.sent;
|
|
1238
|
+
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1239
|
+
_context7.next = 5;
|
|
1240
|
+
break;
|
|
1241
|
+
}
|
|
1242
|
+
return _context7.abrupt("return", null);
|
|
1243
|
+
case 5:
|
|
1244
|
+
return _context7.abrupt("return", result.data);
|
|
1245
|
+
case 6:
|
|
1246
|
+
case "end":
|
|
1247
|
+
return _context7.stop();
|
|
1856
1248
|
}
|
|
1857
1249
|
}, _callee7, this);
|
|
1858
1250
|
}));
|
|
1859
|
-
|
|
1860
1251
|
function changeEmail(_x7) {
|
|
1861
1252
|
return _changeEmail.apply(this, arguments);
|
|
1862
1253
|
}
|
|
1863
|
-
|
|
1864
1254
|
return changeEmail;
|
|
1865
1255
|
}();
|
|
1866
|
-
|
|
1867
1256
|
return BentoCommands;
|
|
1868
1257
|
}();
|
|
1869
1258
|
|
|
@@ -1886,43 +1275,34 @@ var BentoExperimental = /*#__PURE__*/function () {
|
|
|
1886
1275
|
* @param parameters
|
|
1887
1276
|
* @returns Promise\<boolean\>
|
|
1888
1277
|
*/
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
1278
|
var _proto = BentoExperimental.prototype;
|
|
1892
|
-
|
|
1893
1279
|
_proto.validateEmail =
|
|
1894
1280
|
/*#__PURE__*/
|
|
1895
1281
|
function () {
|
|
1896
|
-
var _validateEmail = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1282
|
+
var _validateEmail = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(parameters) {
|
|
1897
1283
|
var result;
|
|
1898
|
-
return
|
|
1899
|
-
while (1) {
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
case 4:
|
|
1915
|
-
case "end":
|
|
1916
|
-
return _context.stop();
|
|
1917
|
-
}
|
|
1284
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1285
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1286
|
+
case 0:
|
|
1287
|
+
_context.next = 2;
|
|
1288
|
+
return this._client.post(this._url + "/validation", {
|
|
1289
|
+
email: parameters.email,
|
|
1290
|
+
ip: parameters.ip,
|
|
1291
|
+
name: parameters.name,
|
|
1292
|
+
user_agent: parameters.userAgent
|
|
1293
|
+
});
|
|
1294
|
+
case 2:
|
|
1295
|
+
result = _context.sent;
|
|
1296
|
+
return _context.abrupt("return", result.valid);
|
|
1297
|
+
case 4:
|
|
1298
|
+
case "end":
|
|
1299
|
+
return _context.stop();
|
|
1918
1300
|
}
|
|
1919
1301
|
}, _callee, this);
|
|
1920
1302
|
}));
|
|
1921
|
-
|
|
1922
1303
|
function validateEmail(_x) {
|
|
1923
1304
|
return _validateEmail.apply(this, arguments);
|
|
1924
1305
|
}
|
|
1925
|
-
|
|
1926
1306
|
return validateEmail;
|
|
1927
1307
|
}()
|
|
1928
1308
|
/**
|
|
@@ -1939,35 +1319,28 @@ var BentoExperimental = /*#__PURE__*/function () {
|
|
|
1939
1319
|
* @returns Promise\<GuessGenderResponse\>
|
|
1940
1320
|
*/
|
|
1941
1321
|
;
|
|
1942
|
-
|
|
1943
1322
|
_proto.guessGender =
|
|
1944
1323
|
/*#__PURE__*/
|
|
1945
1324
|
function () {
|
|
1946
|
-
var _guessGender = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1325
|
+
var _guessGender = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(parameters) {
|
|
1947
1326
|
var result;
|
|
1948
|
-
return
|
|
1949
|
-
while (1) {
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
case 4:
|
|
1960
|
-
case "end":
|
|
1961
|
-
return _context2.stop();
|
|
1962
|
-
}
|
|
1327
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1328
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1329
|
+
case 0:
|
|
1330
|
+
_context2.next = 2;
|
|
1331
|
+
return this._client.post(this._url + "/gender", parameters);
|
|
1332
|
+
case 2:
|
|
1333
|
+
result = _context2.sent;
|
|
1334
|
+
return _context2.abrupt("return", result);
|
|
1335
|
+
case 4:
|
|
1336
|
+
case "end":
|
|
1337
|
+
return _context2.stop();
|
|
1963
1338
|
}
|
|
1964
1339
|
}, _callee2, this);
|
|
1965
1340
|
}));
|
|
1966
|
-
|
|
1967
1341
|
function guessGender(_x2) {
|
|
1968
1342
|
return _guessGender.apply(this, arguments);
|
|
1969
1343
|
}
|
|
1970
|
-
|
|
1971
1344
|
return guessGender;
|
|
1972
1345
|
}()
|
|
1973
1346
|
/**
|
|
@@ -1980,44 +1353,34 @@ var BentoExperimental = /*#__PURE__*/function () {
|
|
|
1980
1353
|
* @returns Promise\<GeolocateResponse\>
|
|
1981
1354
|
*/
|
|
1982
1355
|
;
|
|
1983
|
-
|
|
1984
1356
|
_proto.geolocate =
|
|
1985
1357
|
/*#__PURE__*/
|
|
1986
1358
|
function () {
|
|
1987
|
-
var _geolocate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1359
|
+
var _geolocate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(parameters) {
|
|
1988
1360
|
var result;
|
|
1989
|
-
return
|
|
1990
|
-
while (1) {
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
case 5:
|
|
2007
|
-
return _context3.abrupt("return", result);
|
|
2008
|
-
|
|
2009
|
-
case 6:
|
|
2010
|
-
case "end":
|
|
2011
|
-
return _context3.stop();
|
|
2012
|
-
}
|
|
1361
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1362
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
1363
|
+
case 0:
|
|
1364
|
+
_context3.next = 2;
|
|
1365
|
+
return this._client.get(this._url + "/geolocation", parameters);
|
|
1366
|
+
case 2:
|
|
1367
|
+
result = _context3.sent;
|
|
1368
|
+
if (!(Object.keys(result).length === 0)) {
|
|
1369
|
+
_context3.next = 5;
|
|
1370
|
+
break;
|
|
1371
|
+
}
|
|
1372
|
+
return _context3.abrupt("return", null);
|
|
1373
|
+
case 5:
|
|
1374
|
+
return _context3.abrupt("return", result);
|
|
1375
|
+
case 6:
|
|
1376
|
+
case "end":
|
|
1377
|
+
return _context3.stop();
|
|
2013
1378
|
}
|
|
2014
1379
|
}, _callee3, this);
|
|
2015
1380
|
}));
|
|
2016
|
-
|
|
2017
1381
|
function geolocate(_x3) {
|
|
2018
1382
|
return _geolocate.apply(this, arguments);
|
|
2019
1383
|
}
|
|
2020
|
-
|
|
2021
1384
|
return geolocate;
|
|
2022
1385
|
}()
|
|
2023
1386
|
/**
|
|
@@ -2031,38 +1394,30 @@ var BentoExperimental = /*#__PURE__*/function () {
|
|
|
2031
1394
|
* @returns Promise\<BlacklistResponse\>
|
|
2032
1395
|
*/
|
|
2033
1396
|
;
|
|
2034
|
-
|
|
2035
1397
|
_proto.checkBlacklist =
|
|
2036
1398
|
/*#__PURE__*/
|
|
2037
1399
|
function () {
|
|
2038
|
-
var _checkBlacklist = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1400
|
+
var _checkBlacklist = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(parameters) {
|
|
2039
1401
|
var result;
|
|
2040
|
-
return
|
|
2041
|
-
while (1) {
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
case 4:
|
|
2052
|
-
case "end":
|
|
2053
|
-
return _context4.stop();
|
|
2054
|
-
}
|
|
1402
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1403
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
1404
|
+
case 0:
|
|
1405
|
+
_context4.next = 2;
|
|
1406
|
+
return this._client.get(this._url + "/blacklist.json", parameters);
|
|
1407
|
+
case 2:
|
|
1408
|
+
result = _context4.sent;
|
|
1409
|
+
return _context4.abrupt("return", result);
|
|
1410
|
+
case 4:
|
|
1411
|
+
case "end":
|
|
1412
|
+
return _context4.stop();
|
|
2055
1413
|
}
|
|
2056
1414
|
}, _callee4, this);
|
|
2057
1415
|
}));
|
|
2058
|
-
|
|
2059
1416
|
function checkBlacklist(_x4) {
|
|
2060
1417
|
return _checkBlacklist.apply(this, arguments);
|
|
2061
1418
|
}
|
|
2062
|
-
|
|
2063
1419
|
return checkBlacklist;
|
|
2064
1420
|
}();
|
|
2065
|
-
|
|
2066
1421
|
return BentoExperimental;
|
|
2067
1422
|
}();
|
|
2068
1423
|
|
|
@@ -2077,47 +1432,35 @@ var BentoFields = /*#__PURE__*/function () {
|
|
|
2077
1432
|
*
|
|
2078
1433
|
* @returns Promise<Field[]>
|
|
2079
1434
|
*/
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
1435
|
var _proto = BentoFields.prototype;
|
|
2083
|
-
|
|
2084
1436
|
_proto.getFields =
|
|
2085
1437
|
/*#__PURE__*/
|
|
2086
1438
|
function () {
|
|
2087
|
-
var _getFields = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1439
|
+
var _getFields = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
2088
1440
|
var result;
|
|
2089
|
-
return
|
|
2090
|
-
while (1) {
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
case 5:
|
|
2107
|
-
return _context.abrupt("return", result.data);
|
|
2108
|
-
|
|
2109
|
-
case 6:
|
|
2110
|
-
case "end":
|
|
2111
|
-
return _context.stop();
|
|
2112
|
-
}
|
|
1441
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1442
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1443
|
+
case 0:
|
|
1444
|
+
_context.next = 2;
|
|
1445
|
+
return this._client.get(this._url);
|
|
1446
|
+
case 2:
|
|
1447
|
+
result = _context.sent;
|
|
1448
|
+
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1449
|
+
_context.next = 5;
|
|
1450
|
+
break;
|
|
1451
|
+
}
|
|
1452
|
+
return _context.abrupt("return", null);
|
|
1453
|
+
case 5:
|
|
1454
|
+
return _context.abrupt("return", result.data);
|
|
1455
|
+
case 6:
|
|
1456
|
+
case "end":
|
|
1457
|
+
return _context.stop();
|
|
2113
1458
|
}
|
|
2114
1459
|
}, _callee, this);
|
|
2115
1460
|
}));
|
|
2116
|
-
|
|
2117
1461
|
function getFields() {
|
|
2118
1462
|
return _getFields.apply(this, arguments);
|
|
2119
1463
|
}
|
|
2120
|
-
|
|
2121
1464
|
return getFields;
|
|
2122
1465
|
}()
|
|
2123
1466
|
/**
|
|
@@ -2136,49 +1479,38 @@ var BentoFields = /*#__PURE__*/function () {
|
|
|
2136
1479
|
* @returns Promise<Field[]>
|
|
2137
1480
|
*/
|
|
2138
1481
|
;
|
|
2139
|
-
|
|
2140
1482
|
_proto.createField =
|
|
2141
1483
|
/*#__PURE__*/
|
|
2142
1484
|
function () {
|
|
2143
|
-
var _createField = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1485
|
+
var _createField = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(parameters) {
|
|
2144
1486
|
var result;
|
|
2145
|
-
return
|
|
2146
|
-
while (1) {
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
case 5:
|
|
2165
|
-
return _context2.abrupt("return", result.data);
|
|
2166
|
-
|
|
2167
|
-
case 6:
|
|
2168
|
-
case "end":
|
|
2169
|
-
return _context2.stop();
|
|
2170
|
-
}
|
|
1487
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1488
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1489
|
+
case 0:
|
|
1490
|
+
_context2.next = 2;
|
|
1491
|
+
return this._client.post(this._url, {
|
|
1492
|
+
field: parameters
|
|
1493
|
+
});
|
|
1494
|
+
case 2:
|
|
1495
|
+
result = _context2.sent;
|
|
1496
|
+
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1497
|
+
_context2.next = 5;
|
|
1498
|
+
break;
|
|
1499
|
+
}
|
|
1500
|
+
return _context2.abrupt("return", null);
|
|
1501
|
+
case 5:
|
|
1502
|
+
return _context2.abrupt("return", result.data);
|
|
1503
|
+
case 6:
|
|
1504
|
+
case "end":
|
|
1505
|
+
return _context2.stop();
|
|
2171
1506
|
}
|
|
2172
1507
|
}, _callee2, this);
|
|
2173
1508
|
}));
|
|
2174
|
-
|
|
2175
1509
|
function createField(_x) {
|
|
2176
1510
|
return _createField.apply(this, arguments);
|
|
2177
1511
|
}
|
|
2178
|
-
|
|
2179
1512
|
return createField;
|
|
2180
1513
|
}();
|
|
2181
|
-
|
|
2182
1514
|
return BentoFields;
|
|
2183
1515
|
}();
|
|
2184
1516
|
|
|
@@ -2194,52 +1526,39 @@ var BentoForms = /*#__PURE__*/function () {
|
|
|
2194
1526
|
* @param formIdentifier string
|
|
2195
1527
|
* @returns Promise\<FormResponse[] | null\>
|
|
2196
1528
|
*/
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
1529
|
var _proto = BentoForms.prototype;
|
|
2200
|
-
|
|
2201
1530
|
_proto.getResponses =
|
|
2202
1531
|
/*#__PURE__*/
|
|
2203
1532
|
function () {
|
|
2204
|
-
var _getResponses = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1533
|
+
var _getResponses = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(formIdentifier) {
|
|
2205
1534
|
var result;
|
|
2206
|
-
return
|
|
2207
|
-
while (1) {
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
case 5:
|
|
2226
|
-
return _context.abrupt("return", result.data);
|
|
2227
|
-
|
|
2228
|
-
case 6:
|
|
2229
|
-
case "end":
|
|
2230
|
-
return _context.stop();
|
|
2231
|
-
}
|
|
1535
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1536
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1537
|
+
case 0:
|
|
1538
|
+
_context.next = 2;
|
|
1539
|
+
return this._client.get(this._url, {
|
|
1540
|
+
id: formIdentifier
|
|
1541
|
+
});
|
|
1542
|
+
case 2:
|
|
1543
|
+
result = _context.sent;
|
|
1544
|
+
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1545
|
+
_context.next = 5;
|
|
1546
|
+
break;
|
|
1547
|
+
}
|
|
1548
|
+
return _context.abrupt("return", null);
|
|
1549
|
+
case 5:
|
|
1550
|
+
return _context.abrupt("return", result.data);
|
|
1551
|
+
case 6:
|
|
1552
|
+
case "end":
|
|
1553
|
+
return _context.stop();
|
|
2232
1554
|
}
|
|
2233
1555
|
}, _callee, this);
|
|
2234
1556
|
}));
|
|
2235
|
-
|
|
2236
1557
|
function getResponses(_x) {
|
|
2237
1558
|
return _getResponses.apply(this, arguments);
|
|
2238
1559
|
}
|
|
2239
|
-
|
|
2240
1560
|
return getResponses;
|
|
2241
1561
|
}();
|
|
2242
|
-
|
|
2243
1562
|
return BentoForms;
|
|
2244
1563
|
}();
|
|
2245
1564
|
|
|
@@ -2254,47 +1573,35 @@ var BentoSubscribers = /*#__PURE__*/function () {
|
|
|
2254
1573
|
*
|
|
2255
1574
|
* @returns Promise\<Subscriber\<S\> | null\>
|
|
2256
1575
|
*/
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
1576
|
var _proto = BentoSubscribers.prototype;
|
|
2260
|
-
|
|
2261
1577
|
_proto.getSubscribers =
|
|
2262
1578
|
/*#__PURE__*/
|
|
2263
1579
|
function () {
|
|
2264
|
-
var _getSubscribers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1580
|
+
var _getSubscribers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(parameters) {
|
|
2265
1581
|
var result;
|
|
2266
|
-
return
|
|
2267
|
-
while (1) {
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
case 5:
|
|
2284
|
-
return _context.abrupt("return", result.data);
|
|
2285
|
-
|
|
2286
|
-
case 6:
|
|
2287
|
-
case "end":
|
|
2288
|
-
return _context.stop();
|
|
2289
|
-
}
|
|
1582
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1583
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1584
|
+
case 0:
|
|
1585
|
+
_context.next = 2;
|
|
1586
|
+
return this._client.get(this._url, parameters);
|
|
1587
|
+
case 2:
|
|
1588
|
+
result = _context.sent;
|
|
1589
|
+
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1590
|
+
_context.next = 5;
|
|
1591
|
+
break;
|
|
1592
|
+
}
|
|
1593
|
+
return _context.abrupt("return", null);
|
|
1594
|
+
case 5:
|
|
1595
|
+
return _context.abrupt("return", result.data);
|
|
1596
|
+
case 6:
|
|
1597
|
+
case "end":
|
|
1598
|
+
return _context.stop();
|
|
2290
1599
|
}
|
|
2291
1600
|
}, _callee, this);
|
|
2292
1601
|
}));
|
|
2293
|
-
|
|
2294
1602
|
function getSubscribers(_x) {
|
|
2295
1603
|
return _getSubscribers.apply(this, arguments);
|
|
2296
1604
|
}
|
|
2297
|
-
|
|
2298
1605
|
return getSubscribers;
|
|
2299
1606
|
}()
|
|
2300
1607
|
/**
|
|
@@ -2304,49 +1611,38 @@ var BentoSubscribers = /*#__PURE__*/function () {
|
|
|
2304
1611
|
* @returns Promise\<Subscriber\<S\> | null\>
|
|
2305
1612
|
*/
|
|
2306
1613
|
;
|
|
2307
|
-
|
|
2308
1614
|
_proto.createSubscriber =
|
|
2309
1615
|
/*#__PURE__*/
|
|
2310
1616
|
function () {
|
|
2311
|
-
var _createSubscriber = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1617
|
+
var _createSubscriber = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(parameters) {
|
|
2312
1618
|
var result;
|
|
2313
|
-
return
|
|
2314
|
-
while (1) {
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
case 5:
|
|
2333
|
-
return _context2.abrupt("return", result.data);
|
|
2334
|
-
|
|
2335
|
-
case 6:
|
|
2336
|
-
case "end":
|
|
2337
|
-
return _context2.stop();
|
|
2338
|
-
}
|
|
1619
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1620
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1621
|
+
case 0:
|
|
1622
|
+
_context2.next = 2;
|
|
1623
|
+
return this._client.post(this._url, {
|
|
1624
|
+
subscriber: parameters
|
|
1625
|
+
});
|
|
1626
|
+
case 2:
|
|
1627
|
+
result = _context2.sent;
|
|
1628
|
+
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1629
|
+
_context2.next = 5;
|
|
1630
|
+
break;
|
|
1631
|
+
}
|
|
1632
|
+
return _context2.abrupt("return", null);
|
|
1633
|
+
case 5:
|
|
1634
|
+
return _context2.abrupt("return", result.data);
|
|
1635
|
+
case 6:
|
|
1636
|
+
case "end":
|
|
1637
|
+
return _context2.stop();
|
|
2339
1638
|
}
|
|
2340
1639
|
}, _callee2, this);
|
|
2341
1640
|
}));
|
|
2342
|
-
|
|
2343
1641
|
function createSubscriber(_x2) {
|
|
2344
1642
|
return _createSubscriber.apply(this, arguments);
|
|
2345
1643
|
}
|
|
2346
|
-
|
|
2347
1644
|
return createSubscriber;
|
|
2348
1645
|
}();
|
|
2349
|
-
|
|
2350
1646
|
return BentoSubscribers;
|
|
2351
1647
|
}();
|
|
2352
1648
|
|
|
@@ -2361,47 +1657,35 @@ var BentoTags = /*#__PURE__*/function () {
|
|
|
2361
1657
|
*
|
|
2362
1658
|
* @returns Promise\<Tag[] | null\>
|
|
2363
1659
|
*/
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
1660
|
var _proto = BentoTags.prototype;
|
|
2367
|
-
|
|
2368
1661
|
_proto.getTags =
|
|
2369
1662
|
/*#__PURE__*/
|
|
2370
1663
|
function () {
|
|
2371
|
-
var _getTags = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1664
|
+
var _getTags = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
2372
1665
|
var result;
|
|
2373
|
-
return
|
|
2374
|
-
while (1) {
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
case 5:
|
|
2391
|
-
return _context.abrupt("return", result.data);
|
|
2392
|
-
|
|
2393
|
-
case 6:
|
|
2394
|
-
case "end":
|
|
2395
|
-
return _context.stop();
|
|
2396
|
-
}
|
|
1666
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1667
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1668
|
+
case 0:
|
|
1669
|
+
_context.next = 2;
|
|
1670
|
+
return this._client.get(this._url);
|
|
1671
|
+
case 2:
|
|
1672
|
+
result = _context.sent;
|
|
1673
|
+
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1674
|
+
_context.next = 5;
|
|
1675
|
+
break;
|
|
1676
|
+
}
|
|
1677
|
+
return _context.abrupt("return", null);
|
|
1678
|
+
case 5:
|
|
1679
|
+
return _context.abrupt("return", result.data);
|
|
1680
|
+
case 6:
|
|
1681
|
+
case "end":
|
|
1682
|
+
return _context.stop();
|
|
2397
1683
|
}
|
|
2398
1684
|
}, _callee, this);
|
|
2399
1685
|
}));
|
|
2400
|
-
|
|
2401
1686
|
function getTags() {
|
|
2402
1687
|
return _getTags.apply(this, arguments);
|
|
2403
1688
|
}
|
|
2404
|
-
|
|
2405
1689
|
return getTags;
|
|
2406
1690
|
}()
|
|
2407
1691
|
/**
|
|
@@ -2411,54 +1695,42 @@ var BentoTags = /*#__PURE__*/function () {
|
|
|
2411
1695
|
* @returns Promise\<Tag[] | null\>
|
|
2412
1696
|
*/
|
|
2413
1697
|
;
|
|
2414
|
-
|
|
2415
1698
|
_proto.createTag =
|
|
2416
1699
|
/*#__PURE__*/
|
|
2417
1700
|
function () {
|
|
2418
|
-
var _createTag = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1701
|
+
var _createTag = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(parameters) {
|
|
2419
1702
|
var result;
|
|
2420
|
-
return
|
|
2421
|
-
while (1) {
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
case 5:
|
|
2440
|
-
return _context2.abrupt("return", result.data);
|
|
2441
|
-
|
|
2442
|
-
case 6:
|
|
2443
|
-
case "end":
|
|
2444
|
-
return _context2.stop();
|
|
2445
|
-
}
|
|
1703
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1704
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1705
|
+
case 0:
|
|
1706
|
+
_context2.next = 2;
|
|
1707
|
+
return this._client.post(this._url, {
|
|
1708
|
+
tag: parameters
|
|
1709
|
+
});
|
|
1710
|
+
case 2:
|
|
1711
|
+
result = _context2.sent;
|
|
1712
|
+
if (!(Object.keys(result).length === 0 || !result.data)) {
|
|
1713
|
+
_context2.next = 5;
|
|
1714
|
+
break;
|
|
1715
|
+
}
|
|
1716
|
+
return _context2.abrupt("return", null);
|
|
1717
|
+
case 5:
|
|
1718
|
+
return _context2.abrupt("return", result.data);
|
|
1719
|
+
case 6:
|
|
1720
|
+
case "end":
|
|
1721
|
+
return _context2.stop();
|
|
2446
1722
|
}
|
|
2447
1723
|
}, _callee2, this);
|
|
2448
1724
|
}));
|
|
2449
|
-
|
|
2450
1725
|
function createTag(_x) {
|
|
2451
1726
|
return _createTag.apply(this, arguments);
|
|
2452
1727
|
}
|
|
2453
|
-
|
|
2454
1728
|
return createTag;
|
|
2455
1729
|
}();
|
|
2456
|
-
|
|
2457
1730
|
return BentoTags;
|
|
2458
1731
|
}();
|
|
2459
1732
|
|
|
2460
1733
|
var BentoEvents;
|
|
2461
|
-
|
|
2462
1734
|
(function (BentoEvents) {
|
|
2463
1735
|
BentoEvents["PURCHASE"] = "$purchase";
|
|
2464
1736
|
BentoEvents["SUBSCRIBE"] = "$subscribe";
|
|
@@ -2504,47 +1776,38 @@ var BentoAPIV1 = /*#__PURE__*/function () {
|
|
|
2504
1776
|
* @param parameters TagSubscriberParameters
|
|
2505
1777
|
* @returns Promise\<boolean\>
|
|
2506
1778
|
*/
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
1779
|
var _proto = BentoAPIV1.prototype;
|
|
2510
|
-
|
|
2511
1780
|
_proto.tagSubscriber =
|
|
2512
1781
|
/*#__PURE__*/
|
|
2513
1782
|
function () {
|
|
2514
|
-
var _tagSubscriber = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1783
|
+
var _tagSubscriber = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(parameters) {
|
|
2515
1784
|
var result;
|
|
2516
|
-
return
|
|
2517
|
-
while (1) {
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
case 4:
|
|
2537
|
-
case "end":
|
|
2538
|
-
return _context.stop();
|
|
2539
|
-
}
|
|
1785
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1786
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1787
|
+
case 0:
|
|
1788
|
+
_context.next = 2;
|
|
1789
|
+
return this.Batch.importEvents({
|
|
1790
|
+
events: [{
|
|
1791
|
+
date: parameters.date,
|
|
1792
|
+
details: {
|
|
1793
|
+
tag: parameters.tagName
|
|
1794
|
+
},
|
|
1795
|
+
email: parameters.email,
|
|
1796
|
+
type: BentoEvents.TAG
|
|
1797
|
+
}]
|
|
1798
|
+
});
|
|
1799
|
+
case 2:
|
|
1800
|
+
result = _context.sent;
|
|
1801
|
+
return _context.abrupt("return", result === 1);
|
|
1802
|
+
case 4:
|
|
1803
|
+
case "end":
|
|
1804
|
+
return _context.stop();
|
|
2540
1805
|
}
|
|
2541
1806
|
}, _callee, this);
|
|
2542
1807
|
}));
|
|
2543
|
-
|
|
2544
1808
|
function tagSubscriber(_x) {
|
|
2545
1809
|
return _tagSubscriber.apply(this, arguments);
|
|
2546
1810
|
}
|
|
2547
|
-
|
|
2548
1811
|
return tagSubscriber;
|
|
2549
1812
|
}()
|
|
2550
1813
|
/**
|
|
@@ -2568,42 +1831,35 @@ var BentoAPIV1 = /*#__PURE__*/function () {
|
|
|
2568
1831
|
* @returns Promise\<boolean\>
|
|
2569
1832
|
*/
|
|
2570
1833
|
;
|
|
2571
|
-
|
|
2572
1834
|
_proto.addSubscriber =
|
|
2573
1835
|
/*#__PURE__*/
|
|
2574
1836
|
function () {
|
|
2575
|
-
var _addSubscriber = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1837
|
+
var _addSubscriber = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(parameters) {
|
|
2576
1838
|
var result;
|
|
2577
|
-
return
|
|
2578
|
-
while (1) {
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
case 4:
|
|
2596
|
-
case "end":
|
|
2597
|
-
return _context2.stop();
|
|
2598
|
-
}
|
|
1839
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1840
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1841
|
+
case 0:
|
|
1842
|
+
_context2.next = 2;
|
|
1843
|
+
return this.Batch.importEvents({
|
|
1844
|
+
events: [{
|
|
1845
|
+
date: parameters.date,
|
|
1846
|
+
email: parameters.email,
|
|
1847
|
+
type: BentoEvents.SUBSCRIBE,
|
|
1848
|
+
fields: parameters.fields || {}
|
|
1849
|
+
}]
|
|
1850
|
+
});
|
|
1851
|
+
case 2:
|
|
1852
|
+
result = _context2.sent;
|
|
1853
|
+
return _context2.abrupt("return", result === 1);
|
|
1854
|
+
case 4:
|
|
1855
|
+
case "end":
|
|
1856
|
+
return _context2.stop();
|
|
2599
1857
|
}
|
|
2600
1858
|
}, _callee2, this);
|
|
2601
1859
|
}));
|
|
2602
|
-
|
|
2603
1860
|
function addSubscriber(_x2) {
|
|
2604
1861
|
return _addSubscriber.apply(this, arguments);
|
|
2605
1862
|
}
|
|
2606
|
-
|
|
2607
1863
|
return addSubscriber;
|
|
2608
1864
|
}()
|
|
2609
1865
|
/**
|
|
@@ -2626,41 +1882,34 @@ var BentoAPIV1 = /*#__PURE__*/function () {
|
|
|
2626
1882
|
* @returns Promise\<boolean\>
|
|
2627
1883
|
*/
|
|
2628
1884
|
;
|
|
2629
|
-
|
|
2630
1885
|
_proto.removeSubscriber =
|
|
2631
1886
|
/*#__PURE__*/
|
|
2632
1887
|
function () {
|
|
2633
|
-
var _removeSubscriber = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1888
|
+
var _removeSubscriber = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(parameters) {
|
|
2634
1889
|
var result;
|
|
2635
|
-
return
|
|
2636
|
-
while (1) {
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
case 4:
|
|
2653
|
-
case "end":
|
|
2654
|
-
return _context3.stop();
|
|
2655
|
-
}
|
|
1890
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1891
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
1892
|
+
case 0:
|
|
1893
|
+
_context3.next = 2;
|
|
1894
|
+
return this.Batch.importEvents({
|
|
1895
|
+
events: [{
|
|
1896
|
+
date: parameters.date,
|
|
1897
|
+
email: parameters.email,
|
|
1898
|
+
type: BentoEvents.UNSUBSCRIBE
|
|
1899
|
+
}]
|
|
1900
|
+
});
|
|
1901
|
+
case 2:
|
|
1902
|
+
result = _context3.sent;
|
|
1903
|
+
return _context3.abrupt("return", result === 1);
|
|
1904
|
+
case 4:
|
|
1905
|
+
case "end":
|
|
1906
|
+
return _context3.stop();
|
|
2656
1907
|
}
|
|
2657
1908
|
}, _callee3, this);
|
|
2658
1909
|
}));
|
|
2659
|
-
|
|
2660
1910
|
function removeSubscriber(_x3) {
|
|
2661
1911
|
return _removeSubscriber.apply(this, arguments);
|
|
2662
1912
|
}
|
|
2663
|
-
|
|
2664
1913
|
return removeSubscriber;
|
|
2665
1914
|
}()
|
|
2666
1915
|
/**
|
|
@@ -2683,42 +1932,35 @@ var BentoAPIV1 = /*#__PURE__*/function () {
|
|
|
2683
1932
|
* @returns Promise\<boolean\>
|
|
2684
1933
|
*/
|
|
2685
1934
|
;
|
|
2686
|
-
|
|
2687
1935
|
_proto.updateFields =
|
|
2688
1936
|
/*#__PURE__*/
|
|
2689
1937
|
function () {
|
|
2690
|
-
var _updateFields = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1938
|
+
var _updateFields = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(parameters) {
|
|
2691
1939
|
var result;
|
|
2692
|
-
return
|
|
2693
|
-
while (1) {
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
case 4:
|
|
2711
|
-
case "end":
|
|
2712
|
-
return _context4.stop();
|
|
2713
|
-
}
|
|
1940
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1941
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
1942
|
+
case 0:
|
|
1943
|
+
_context4.next = 2;
|
|
1944
|
+
return this.Batch.importEvents({
|
|
1945
|
+
events: [{
|
|
1946
|
+
date: parameters.date,
|
|
1947
|
+
email: parameters.email,
|
|
1948
|
+
type: BentoEvents.UPDATE_FIELDS,
|
|
1949
|
+
fields: parameters.fields
|
|
1950
|
+
}]
|
|
1951
|
+
});
|
|
1952
|
+
case 2:
|
|
1953
|
+
result = _context4.sent;
|
|
1954
|
+
return _context4.abrupt("return", result === 1);
|
|
1955
|
+
case 4:
|
|
1956
|
+
case "end":
|
|
1957
|
+
return _context4.stop();
|
|
2714
1958
|
}
|
|
2715
1959
|
}, _callee4, this);
|
|
2716
1960
|
}));
|
|
2717
|
-
|
|
2718
1961
|
function updateFields(_x4) {
|
|
2719
1962
|
return _updateFields.apply(this, arguments);
|
|
2720
1963
|
}
|
|
2721
|
-
|
|
2722
1964
|
return updateFields;
|
|
2723
1965
|
}()
|
|
2724
1966
|
/**
|
|
@@ -2740,42 +1982,35 @@ var BentoAPIV1 = /*#__PURE__*/function () {
|
|
|
2740
1982
|
* @returns Promise\<boolean\>
|
|
2741
1983
|
*/
|
|
2742
1984
|
;
|
|
2743
|
-
|
|
2744
1985
|
_proto.trackPurchase =
|
|
2745
1986
|
/*#__PURE__*/
|
|
2746
1987
|
function () {
|
|
2747
|
-
var _trackPurchase = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1988
|
+
var _trackPurchase = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(parameters) {
|
|
2748
1989
|
var result;
|
|
2749
|
-
return
|
|
2750
|
-
while (1) {
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
case 4:
|
|
2768
|
-
case "end":
|
|
2769
|
-
return _context5.stop();
|
|
2770
|
-
}
|
|
1990
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1991
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
1992
|
+
case 0:
|
|
1993
|
+
_context5.next = 2;
|
|
1994
|
+
return this.Batch.importEvents({
|
|
1995
|
+
events: [{
|
|
1996
|
+
date: parameters.date,
|
|
1997
|
+
email: parameters.email,
|
|
1998
|
+
type: BentoEvents.PURCHASE,
|
|
1999
|
+
details: parameters.purchaseDetails
|
|
2000
|
+
}]
|
|
2001
|
+
});
|
|
2002
|
+
case 2:
|
|
2003
|
+
result = _context5.sent;
|
|
2004
|
+
return _context5.abrupt("return", result === 1);
|
|
2005
|
+
case 4:
|
|
2006
|
+
case "end":
|
|
2007
|
+
return _context5.stop();
|
|
2771
2008
|
}
|
|
2772
2009
|
}, _callee5, this);
|
|
2773
2010
|
}));
|
|
2774
|
-
|
|
2775
2011
|
function trackPurchase(_x5) {
|
|
2776
2012
|
return _trackPurchase.apply(this, arguments);
|
|
2777
2013
|
}
|
|
2778
|
-
|
|
2779
2014
|
return trackPurchase;
|
|
2780
2015
|
}()
|
|
2781
2016
|
/**
|
|
@@ -2796,40 +2031,32 @@ var BentoAPIV1 = /*#__PURE__*/function () {
|
|
|
2796
2031
|
* @returns Promise\<boolean\>
|
|
2797
2032
|
*/
|
|
2798
2033
|
;
|
|
2799
|
-
|
|
2800
2034
|
_proto.track =
|
|
2801
2035
|
/*#__PURE__*/
|
|
2802
2036
|
function () {
|
|
2803
|
-
var _track = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
2037
|
+
var _track = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(parameters) {
|
|
2804
2038
|
var result;
|
|
2805
|
-
return
|
|
2806
|
-
while (1) {
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
case 4:
|
|
2819
|
-
case "end":
|
|
2820
|
-
return _context6.stop();
|
|
2821
|
-
}
|
|
2039
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
2040
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
2041
|
+
case 0:
|
|
2042
|
+
_context6.next = 2;
|
|
2043
|
+
return this.Batch.importEvents({
|
|
2044
|
+
events: [parameters]
|
|
2045
|
+
});
|
|
2046
|
+
case 2:
|
|
2047
|
+
result = _context6.sent;
|
|
2048
|
+
return _context6.abrupt("return", result === 1);
|
|
2049
|
+
case 4:
|
|
2050
|
+
case "end":
|
|
2051
|
+
return _context6.stop();
|
|
2822
2052
|
}
|
|
2823
2053
|
}, _callee6, this);
|
|
2824
2054
|
}));
|
|
2825
|
-
|
|
2826
2055
|
function track(_x6) {
|
|
2827
2056
|
return _track.apply(this, arguments);
|
|
2828
2057
|
}
|
|
2829
|
-
|
|
2830
2058
|
return track;
|
|
2831
2059
|
}();
|
|
2832
|
-
|
|
2833
2060
|
return BentoAPIV1;
|
|
2834
2061
|
}();
|
|
2835
2062
|
|