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