@thescaffold/jsx-blobs 0.2.21 → 0.2.30

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.
@@ -78,306 +78,113 @@ function _extends() {
78
78
  return n;
79
79
  }, _extends.apply(null, arguments);
80
80
  }
81
- function _regeneratorRuntime() {
82
- _regeneratorRuntime = function () {
83
- return e;
84
- };
85
- var t,
86
- e = {},
87
- r = Object.prototype,
88
- n = r.hasOwnProperty,
89
- o = Object.defineProperty || function (t, e, r) {
90
- t[e] = r.value;
91
- },
92
- i = "function" == typeof Symbol ? Symbol : {},
93
- a = i.iterator || "@@iterator",
94
- c = i.asyncIterator || "@@asyncIterator",
95
- u = i.toStringTag || "@@toStringTag";
96
- function define(t, e, r) {
97
- return Object.defineProperty(t, e, {
98
- value: r,
99
- enumerable: !0,
100
- configurable: !0,
101
- writable: !0
102
- }), t[e];
103
- }
104
- try {
105
- define({}, "");
106
- } catch (t) {
107
- define = function (t, e, r) {
108
- return t[e] = r;
109
- };
110
- }
111
- function wrap(t, e, r, n) {
112
- var i = e && e.prototype instanceof Generator ? e : Generator,
113
- a = Object.create(i.prototype),
114
- c = new Context(n || []);
115
- return o(a, "_invoke", {
116
- value: makeInvokeMethod(t, r, c)
117
- }), a;
118
- }
119
- function tryCatch(t, e, r) {
120
- try {
121
- return {
122
- type: "normal",
123
- arg: t.call(e, r)
124
- };
125
- } catch (t) {
126
- return {
127
- type: "throw",
128
- arg: t
129
- };
130
- }
131
- }
132
- e.wrap = wrap;
133
- var h = "suspendedStart",
134
- l = "suspendedYield",
135
- f = "executing",
136
- s = "completed",
137
- y = {};
138
- function Generator() {}
139
- function GeneratorFunction() {}
140
- function GeneratorFunctionPrototype() {}
141
- var p = {};
142
- define(p, a, function () {
143
- return this;
144
- });
145
- var d = Object.getPrototypeOf,
146
- v = d && d(d(values([])));
147
- v && v !== r && n.call(v, a) && (p = v);
148
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
149
- function defineIteratorMethods(t) {
150
- ["next", "throw", "return"].forEach(function (e) {
151
- define(t, e, function (t) {
152
- return this._invoke(e, t);
153
- });
154
- });
155
- }
156
- function AsyncIterator(t, e) {
157
- function invoke(r, o, i, a) {
158
- var c = tryCatch(t[r], t, o);
159
- if ("throw" !== c.type) {
160
- var u = c.arg,
161
- h = u.value;
162
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
163
- invoke("next", t, i, a);
164
- }, function (t) {
165
- invoke("throw", t, i, a);
166
- }) : e.resolve(h).then(function (t) {
167
- u.value = t, i(u);
168
- }, function (t) {
169
- return invoke("throw", t, i, a);
170
- });
171
- }
172
- a(c.arg);
173
- }
174
- var r;
175
- o(this, "_invoke", {
176
- value: function (t, n) {
177
- function callInvokeWithMethodAndArg() {
178
- return new e(function (e, r) {
179
- invoke(t, n, e, r);
180
- });
81
+ function _regenerator() {
82
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
83
+ var e,
84
+ t,
85
+ r = "function" == typeof Symbol ? Symbol : {},
86
+ n = r.iterator || "@@iterator",
87
+ o = r.toStringTag || "@@toStringTag";
88
+ function i(r, n, o, i) {
89
+ var c = n && n.prototype instanceof Generator ? n : Generator,
90
+ u = Object.create(c.prototype);
91
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
92
+ var i,
93
+ c,
94
+ u,
95
+ f = 0,
96
+ p = o || [],
97
+ y = !1,
98
+ G = {
99
+ p: 0,
100
+ n: 0,
101
+ v: e,
102
+ a: d,
103
+ f: d.bind(e, 4),
104
+ d: function (t, r) {
105
+ return i = t, c = 0, u = e, G.n = r, a;
106
+ }
107
+ };
108
+ function d(r, n) {
109
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
110
+ var o,
111
+ i = p[t],
112
+ d = G.p,
113
+ l = i[2];
114
+ r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
181
115
  }
182
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
116
+ if (o || r > 1) return a;
117
+ throw y = !0, n;
183
118
  }
184
- });
185
- }
186
- function makeInvokeMethod(e, r, n) {
187
- var o = h;
188
- return function (i, a) {
189
- if (o === f) throw Error("Generator is already running");
190
- if (o === s) {
191
- if ("throw" === i) throw a;
119
+ return function (o, p, l) {
120
+ if (f > 1) throw TypeError("Generator is already running");
121
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
122
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
123
+ try {
124
+ if (f = 2, i) {
125
+ if (c || (o = "next"), t = i[o]) {
126
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
127
+ if (!t.done) return t;
128
+ u = t.value, c < 2 && (c = 0);
129
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
130
+ i = e;
131
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
132
+ } catch (t) {
133
+ i = e, c = 1, u = t;
134
+ } finally {
135
+ f = 1;
136
+ }
137
+ }
192
138
  return {
193
139
  value: t,
194
- done: !0
140
+ done: y
195
141
  };
196
- }
197
- for (n.method = i, n.arg = a;;) {
198
- var c = n.delegate;
199
- if (c) {
200
- var u = maybeInvokeDelegate(c, n);
201
- if (u) {
202
- if (u === y) continue;
203
- return u;
204
- }
205
- }
206
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
207
- if (o === h) throw o = s, n.arg;
208
- n.dispatchException(n.arg);
209
- } else "return" === n.method && n.abrupt("return", n.arg);
210
- o = f;
211
- var p = tryCatch(e, r, n);
212
- if ("normal" === p.type) {
213
- if (o = n.done ? s : l, p.arg === y) continue;
214
- return {
215
- value: p.arg,
216
- done: n.done
217
- };
218
- }
219
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
220
- }
221
- };
222
- }
223
- function maybeInvokeDelegate(e, r) {
224
- var n = r.method,
225
- o = e.iterator[n];
226
- 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;
227
- var i = tryCatch(o, e.iterator, r.arg);
228
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
229
- var a = i.arg;
230
- 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);
231
- }
232
- function pushTryEntry(t) {
233
- var e = {
234
- tryLoc: t[0]
235
- };
236
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
237
- }
238
- function resetTryEntry(t) {
239
- var e = t.completion || {};
240
- e.type = "normal", delete e.arg, t.completion = e;
241
- }
242
- function Context(t) {
243
- this.tryEntries = [{
244
- tryLoc: "root"
245
- }], t.forEach(pushTryEntry, this), this.reset(!0);
142
+ };
143
+ }(r, o, i), !0), u;
246
144
  }
247
- function values(e) {
248
- if (e || "" === e) {
249
- var r = e[a];
250
- if (r) return r.call(e);
251
- if ("function" == typeof e.next) return e;
252
- if (!isNaN(e.length)) {
253
- var o = -1,
254
- i = function next() {
255
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
256
- return next.value = t, next.done = !0, next;
257
- };
258
- return i.next = i;
259
- }
260
- }
261
- throw new TypeError(typeof e + " is not iterable");
145
+ var a = {};
146
+ function Generator() {}
147
+ function GeneratorFunction() {}
148
+ function GeneratorFunctionPrototype() {}
149
+ t = Object.getPrototypeOf;
150
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
151
+ return this;
152
+ }), t),
153
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
154
+ function f(e) {
155
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
262
156
  }
263
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
264
- value: GeneratorFunctionPrototype,
265
- configurable: !0
266
- }), o(GeneratorFunctionPrototype, "constructor", {
267
- value: GeneratorFunction,
268
- configurable: !0
269
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
270
- var e = "function" == typeof t && t.constructor;
271
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
272
- }, e.mark = function (t) {
273
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
274
- }, e.awrap = function (t) {
275
- return {
276
- __await: t
277
- };
278
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
157
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
279
158
  return this;
280
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
281
- void 0 === i && (i = Promise);
282
- var a = new AsyncIterator(wrap(t, r, n, o), i);
283
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
284
- return t.done ? t.value : a.next();
285
- });
286
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
287
- return this;
288
- }), define(g, "toString", function () {
159
+ }), _regeneratorDefine(u, "toString", function () {
289
160
  return "[object Generator]";
290
- }), e.keys = function (t) {
291
- var e = Object(t),
292
- r = [];
293
- for (var n in e) r.push(n);
294
- return r.reverse(), function next() {
295
- for (; r.length;) {
296
- var t = r.pop();
297
- if (t in e) return next.value = t, next.done = !1, next;
298
- }
299
- return next.done = !0, next;
161
+ }), (_regenerator = function () {
162
+ return {
163
+ w: i,
164
+ m: f
300
165
  };
301
- }, e.values = values, Context.prototype = {
302
- constructor: Context,
303
- reset: function (e) {
304
- 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);
305
- },
306
- stop: function () {
307
- this.done = !0;
308
- var t = this.tryEntries[0].completion;
309
- if ("throw" === t.type) throw t.arg;
310
- return this.rval;
311
- },
312
- dispatchException: function (e) {
313
- if (this.done) throw e;
314
- var r = this;
315
- function handle(n, o) {
316
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
317
- }
318
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
319
- var i = this.tryEntries[o],
320
- a = i.completion;
321
- if ("root" === i.tryLoc) return handle("end");
322
- if (i.tryLoc <= this.prev) {
323
- var c = n.call(i, "catchLoc"),
324
- u = n.call(i, "finallyLoc");
325
- if (c && u) {
326
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
327
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
328
- } else if (c) {
329
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
330
- } else {
331
- if (!u) throw Error("try statement without catch or finally");
332
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
333
- }
334
- }
335
- }
336
- },
337
- abrupt: function (t, e) {
338
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
339
- var o = this.tryEntries[r];
340
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
341
- var i = o;
342
- break;
343
- }
344
- }
345
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
346
- var a = i ? i.completion : {};
347
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
348
- },
349
- complete: function (t, e) {
350
- if ("throw" === t.type) throw t.arg;
351
- 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;
352
- },
353
- finish: function (t) {
354
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
355
- var r = this.tryEntries[e];
356
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
357
- }
358
- },
359
- catch: function (t) {
360
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
361
- var r = this.tryEntries[e];
362
- if (r.tryLoc === t) {
363
- var n = r.completion;
364
- if ("throw" === n.type) {
365
- var o = n.arg;
366
- resetTryEntry(r);
367
- }
368
- return o;
369
- }
370
- }
371
- throw Error("illegal catch attempt");
372
- },
373
- delegateYield: function (e, r, n) {
374
- return this.delegate = {
375
- iterator: values(e),
376
- resultName: r,
377
- nextLoc: n
378
- }, "next" === this.method && (this.arg = t), y;
166
+ })();
167
+ }
168
+ function _regeneratorDefine(e, r, n, t) {
169
+ var i = Object.defineProperty;
170
+ try {
171
+ i({}, "", {});
172
+ } catch (e) {
173
+ i = 0;
174
+ }
175
+ _regeneratorDefine = function (e, r, n, t) {
176
+ function o(r, n) {
177
+ _regeneratorDefine(e, r, function (e) {
178
+ return this._invoke(r, n, e);
179
+ });
379
180
  }
380
- }, e;
181
+ r ? i ? i(e, r, {
182
+ value: n,
183
+ enumerable: !t,
184
+ configurable: !t,
185
+ writable: !t
186
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
187
+ }, _regeneratorDefine(e, r, n, t);
381
188
  }
382
189
 
383
190
  var config = {
@@ -388,6 +195,9 @@ var config = {
388
195
  var getConfig = function getConfig() {
389
196
  return config;
390
197
  };
198
+ var setConfig = function setConfig(newConfig) {
199
+ config = newConfig;
200
+ };
391
201
 
392
202
  exports.CategoryType = void 0;
393
203
  (function (CategoryType) {
@@ -536,30 +346,27 @@ var isFunction = function isFunction(value) {
536
346
  return typeof value === 'function';
537
347
  };
538
348
  var streamFileChunks = /*#__PURE__*/function () {
539
- var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(input, callback, chunkSize) {
540
- return _regeneratorRuntime().wrap(function _callee$(_context) {
541
- while (1) switch (_context.prev = _context.next) {
349
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(input, callback, chunkSize) {
350
+ return _regenerator().w(function (_context) {
351
+ while (1) switch (_context.n) {
542
352
  case 0:
543
353
  if (chunkSize === void 0) {
544
354
  chunkSize = 512 * 1024;
545
355
  }
546
356
  if (!isNode()) {
547
- _context.next = 3;
357
+ _context.n = 1;
548
358
  break;
549
359
  }
550
- return _context.abrupt("return", streamFileChunksForNode(input, callback, chunkSize));
551
- case 3:
360
+ return _context.a(2, streamFileChunksForNode(input, callback, chunkSize));
361
+ case 1:
552
362
  if (!isBrowser()) {
553
- _context.next = 5;
363
+ _context.n = 2;
554
364
  break;
555
365
  }
556
- return _context.abrupt("return", streamFileChunksForBrowser(input, callback, chunkSize));
557
- case 5:
366
+ return _context.a(2, streamFileChunksForBrowser(input, callback, chunkSize));
367
+ case 2:
558
368
  console.error('Unknown environment for streamChunks');
559
- return _context.abrupt("return", 0);
560
- case 7:
561
- case "end":
562
- return _context.stop();
369
+ return _context.a(2, 0);
563
370
  }
564
371
  }, _callee);
565
372
  }));
@@ -568,153 +375,147 @@ var streamFileChunks = /*#__PURE__*/function () {
568
375
  };
569
376
  }();
570
377
  var streamFileChunksForNode = /*#__PURE__*/function () {
571
- var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(path, callback, chunkSize) {
572
- var fs, stream, index, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, base64;
573
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
574
- while (1) switch (_context2.prev = _context2.next) {
378
+ var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(path, callback, chunkSize) {
379
+ var fs, stream, index, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, base64, _t;
380
+ return _regenerator().w(function (_context2) {
381
+ while (1) switch (_context2.p = _context2.n) {
575
382
  case 0:
576
383
  if (chunkSize === void 0) {
577
384
  chunkSize = 512 * 1024;
578
385
  }
579
386
  if (!(typeof path !== 'string' || path.length < 1)) {
580
- _context2.next = 3;
387
+ _context2.n = 1;
581
388
  break;
582
389
  }
583
- return _context2.abrupt("return", 0);
584
- case 3:
585
- _context2.next = 5;
390
+ return _context2.a(2, 0);
391
+ case 1:
392
+ _context2.n = 2;
586
393
  return import('fs');
587
- case 5:
588
- fs = _context2.sent;
394
+ case 2:
395
+ fs = _context2.v;
589
396
  stream = fs.createReadStream(path, {
590
397
  highWaterMark: chunkSize
591
398
  });
592
399
  index = 0;
593
400
  _iteratorAbruptCompletion = false;
594
401
  _didIteratorError = false;
595
- _context2.prev = 10;
402
+ _context2.p = 3;
596
403
  _iterator = _asyncIterator(stream);
597
- case 12:
598
- _context2.next = 14;
404
+ case 4:
405
+ _context2.n = 5;
599
406
  return _iterator.next();
600
- case 14:
601
- if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
602
- _context2.next = 22;
407
+ case 5:
408
+ if (!(_iteratorAbruptCompletion = !(_step = _context2.v).done)) {
409
+ _context2.n = 7;
603
410
  break;
604
411
  }
605
412
  chunk = _step.value;
606
413
  base64 = chunk.toString('base64');
607
- _context2.next = 19;
414
+ _context2.n = 6;
608
415
  return callback(base64, index++);
609
- case 19:
416
+ case 6:
610
417
  _iteratorAbruptCompletion = false;
611
- _context2.next = 12;
418
+ _context2.n = 4;
612
419
  break;
613
- case 22:
614
- _context2.next = 28;
420
+ case 7:
421
+ _context2.n = 9;
615
422
  break;
616
- case 24:
617
- _context2.prev = 24;
618
- _context2.t0 = _context2["catch"](10);
423
+ case 8:
424
+ _context2.p = 8;
425
+ _t = _context2.v;
619
426
  _didIteratorError = true;
620
- _iteratorError = _context2.t0;
621
- case 28:
622
- _context2.prev = 28;
623
- _context2.prev = 29;
427
+ _iteratorError = _t;
428
+ case 9:
429
+ _context2.p = 9;
430
+ _context2.p = 10;
624
431
  if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
625
- _context2.next = 33;
432
+ _context2.n = 11;
626
433
  break;
627
434
  }
628
- _context2.next = 33;
435
+ _context2.n = 11;
629
436
  return _iterator["return"]();
630
- case 33:
631
- _context2.prev = 33;
437
+ case 11:
438
+ _context2.p = 11;
632
439
  if (!_didIteratorError) {
633
- _context2.next = 36;
440
+ _context2.n = 12;
634
441
  break;
635
442
  }
636
443
  throw _iteratorError;
637
- case 36:
638
- return _context2.finish(33);
639
- case 37:
640
- return _context2.finish(28);
641
- case 38:
642
- return _context2.abrupt("return", index);
643
- case 39:
644
- case "end":
645
- return _context2.stop();
444
+ case 12:
445
+ return _context2.f(11);
446
+ case 13:
447
+ return _context2.f(9);
448
+ case 14:
449
+ return _context2.a(2, index);
646
450
  }
647
- }, _callee2, null, [[10, 24, 28, 38], [29,, 33, 37]]);
451
+ }, _callee2, null, [[10,, 11, 13], [3, 8, 9, 14]]);
648
452
  }));
649
453
  return function streamFileChunksForNode(_x4, _x5, _x6) {
650
454
  return _ref2.apply(this, arguments);
651
455
  };
652
456
  }();
653
457
  var streamFileChunksForBrowser = /*#__PURE__*/function () {
654
- var _ref3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(files, callback, chunkSize) {
458
+ var _ref3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(files, callback, chunkSize) {
655
459
  var file, reader, index, buffer, _yield$reader$read, done, value, combined, chunk, base64, _base;
656
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
657
- while (1) switch (_context3.prev = _context3.next) {
460
+ return _regenerator().w(function (_context3) {
461
+ while (1) switch (_context3.n) {
658
462
  case 0:
659
463
  if (chunkSize === void 0) {
660
464
  chunkSize = 512 * 1024;
661
465
  }
662
466
  if (!(!(files instanceof FileList) || files.length < 1)) {
663
- _context3.next = 3;
467
+ _context3.n = 1;
664
468
  break;
665
469
  }
666
- return _context3.abrupt("return", 0);
667
- case 3:
470
+ return _context3.a(2, 0);
471
+ case 1:
668
472
  file = files[0];
669
473
  reader = file.stream().getReader();
670
474
  index = 0;
671
475
  buffer = new Uint8Array();
672
- case 7:
673
- _context3.next = 10;
476
+ case 2:
477
+ _context3.n = 3;
674
478
  return reader.read();
675
- case 10:
676
- _yield$reader$read = _context3.sent;
479
+ case 3:
480
+ _yield$reader$read = _context3.v;
677
481
  done = _yield$reader$read.done;
678
482
  value = _yield$reader$read.value;
679
483
  if (!done) {
680
- _context3.next = 15;
484
+ _context3.n = 4;
681
485
  break;
682
486
  }
683
- return _context3.abrupt("break", 29);
684
- case 15:
487
+ return _context3.a(3, 8);
488
+ case 4:
685
489
  combined = new Uint8Array(buffer.length + value.length);
686
490
  combined.set(buffer);
687
491
  combined.set(value, buffer.length);
688
492
  buffer = combined;
689
- case 19:
493
+ case 5:
690
494
  if (!(buffer.length >= chunkSize)) {
691
- _context3.next = 27;
495
+ _context3.n = 7;
692
496
  break;
693
497
  }
694
498
  chunk = buffer.slice(0, chunkSize);
695
499
  buffer = buffer.slice(chunkSize);
696
500
  base64 = uint8ToBase64(chunk);
697
- _context3.next = 25;
501
+ _context3.n = 6;
698
502
  return callback(base64, index++);
699
- case 25:
700
- _context3.next = 19;
503
+ case 6:
504
+ _context3.n = 5;
701
505
  break;
702
- case 27:
703
- _context3.next = 7;
506
+ case 7:
507
+ _context3.n = 2;
704
508
  break;
705
- case 29:
509
+ case 8:
706
510
  if (!(buffer.length > 0)) {
707
- _context3.next = 33;
511
+ _context3.n = 9;
708
512
  break;
709
513
  }
710
514
  _base = uint8ToBase64(buffer);
711
- _context3.next = 33;
515
+ _context3.n = 9;
712
516
  return callback(_base, index++);
713
- case 33:
714
- return _context3.abrupt("return", index);
715
- case 34:
716
- case "end":
717
- return _context3.stop();
517
+ case 9:
518
+ return _context3.a(2, index);
718
519
  }
719
520
  }, _callee3);
720
521
  }));
@@ -723,105 +524,96 @@ var streamFileChunksForBrowser = /*#__PURE__*/function () {
723
524
  };
724
525
  }();
725
526
  var getFileMeta = /*#__PURE__*/function () {
726
- var _ref4 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(input) {
727
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
728
- while (1) switch (_context4.prev = _context4.next) {
527
+ var _ref4 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(input) {
528
+ return _regenerator().w(function (_context4) {
529
+ while (1) switch (_context4.n) {
729
530
  case 0:
730
531
  if (!isNode()) {
731
- _context4.next = 2;
532
+ _context4.n = 1;
732
533
  break;
733
534
  }
734
- return _context4.abrupt("return", getFileMetaForNode(input));
735
- case 2:
535
+ return _context4.a(2, getFileMetaForNode(input));
536
+ case 1:
736
537
  if (!isBrowser()) {
737
- _context4.next = 4;
538
+ _context4.n = 2;
738
539
  break;
739
540
  }
740
- return _context4.abrupt("return", getFileMetaForBrowser(input));
741
- case 4:
541
+ return _context4.a(2, getFileMetaForBrowser(input));
542
+ case 2:
742
543
  console.error('Unknown environment for getFileMeta');
743
- return _context4.abrupt("return", []);
744
- case 6:
745
- case "end":
746
- return _context4.stop();
544
+ return _context4.a(2, []);
747
545
  }
748
546
  }, _callee4);
749
547
  }));
750
- return function getFileMeta(_x10) {
548
+ return function getFileMeta(_x0) {
751
549
  return _ref4.apply(this, arguments);
752
550
  };
753
551
  }();
754
552
  var getFileMetaForNode = /*#__PURE__*/function () {
755
- var _ref5 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(path) {
756
- var fs, p, stats, size, ext, name, mimeType;
757
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
758
- while (1) switch (_context5.prev = _context5.next) {
553
+ var _ref5 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(path) {
554
+ var fs, p, stats, size, ext, name, mimeType, _t2;
555
+ return _regenerator().w(function (_context5) {
556
+ while (1) switch (_context5.p = _context5.n) {
759
557
  case 0:
760
558
  if (!(typeof path !== 'string' || path.length < 1)) {
761
- _context5.next = 2;
559
+ _context5.n = 1;
762
560
  break;
763
561
  }
764
- return _context5.abrupt("return", []);
765
- case 2:
766
- _context5.next = 4;
562
+ return _context5.a(2, []);
563
+ case 1:
564
+ _context5.n = 2;
767
565
  return import('fs');
768
- case 4:
769
- fs = _context5.sent;
770
- _context5.next = 7;
566
+ case 2:
567
+ fs = _context5.v;
568
+ _context5.n = 3;
771
569
  return import('path');
772
- case 7:
773
- p = _context5.sent;
774
- _context5.prev = 8;
775
- _context5.next = 11;
570
+ case 3:
571
+ p = _context5.v;
572
+ _context5.p = 4;
573
+ _context5.n = 5;
776
574
  return fs.promises.stat(path);
777
- case 11:
778
- stats = _context5.sent;
575
+ case 5:
576
+ stats = _context5.v;
779
577
  size = stats.size;
780
578
  ext = p.extname(path).replace('.', '').toLowerCase();
781
579
  name = p.basename(path);
782
580
  mimeType = mimeMap[ext] || 'application/octet-stream';
783
- return _context5.abrupt("return", [ext, mimeType, size, name]);
784
- case 19:
785
- _context5.prev = 19;
786
- _context5.t0 = _context5["catch"](8);
787
- console.error("Error getting file meta for " + path + ":", _context5.t0);
788
- return _context5.abrupt("return", []);
789
- case 23:
790
- case "end":
791
- return _context5.stop();
581
+ return _context5.a(2, [ext, mimeType, size, name]);
582
+ case 6:
583
+ _context5.p = 6;
584
+ _t2 = _context5.v;
585
+ console.error("Error getting file meta for " + path + ":", _t2);
586
+ return _context5.a(2, []);
792
587
  }
793
- }, _callee5, null, [[8, 19]]);
588
+ }, _callee5, null, [[4, 6]]);
794
589
  }));
795
- return function getFileMetaForNode(_x11) {
590
+ return function getFileMetaForNode(_x1) {
796
591
  return _ref5.apply(this, arguments);
797
592
  };
798
593
  }();
799
594
  var getFileMetaForBrowser = /*#__PURE__*/function () {
800
- var _ref6 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(files) {
595
+ var _ref6 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(files) {
801
596
  var _file$name$split$pop;
802
597
  var file, ext, mimeType, size, name;
803
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
804
- while (1) switch (_context6.prev = _context6.next) {
598
+ return _regenerator().w(function (_context6) {
599
+ while (1) switch (_context6.n) {
805
600
  case 0:
806
601
  if (!(!(files instanceof FileList) || files.length < 1)) {
807
- _context6.next = 2;
602
+ _context6.n = 1;
808
603
  break;
809
604
  }
810
- return _context6.abrupt("return", []);
811
- case 2:
605
+ return _context6.a(2, []);
606
+ case 1:
812
607
  file = files[0];
813
608
  ext = ((_file$name$split$pop = file.name.split('.').pop()) == null ? void 0 : _file$name$split$pop.toLowerCase()) || '';
814
609
  mimeType = file.type || "application/" + (ext || 'octet-stream');
815
610
  size = file.size;
816
611
  name = file.name;
817
- return _context6.abrupt("return", [ext, mimeType, size, name]);
818
- case 8:
819
- case "end":
820
- return _context6.stop();
612
+ return _context6.a(2, [ext, mimeType, size, name]);
821
613
  }
822
614
  }, _callee6);
823
615
  }));
824
- return function getFileMetaForBrowser(_x12) {
616
+ return function getFileMetaForBrowser(_x10) {
825
617
  return _ref6.apply(this, arguments);
826
618
  };
827
619
  }();
@@ -839,13 +631,13 @@ var uint8ToBase64 = function uint8ToBase64(bytes) {
839
631
  var axios = /*#__PURE__*/require('axios');
840
632
  var raw = axios;
841
633
  var request = /*#__PURE__*/function () {
842
- var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(method, url, body, queries, headers) {
843
- var config, _request, response, _response;
844
- return _regeneratorRuntime().wrap(function _callee$(_context) {
845
- while (1) switch (_context.prev = _context.next) {
634
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(method, url, body, queries, headers) {
635
+ var config, _request, response, _response, _t;
636
+ return _regenerator().w(function (_context) {
637
+ while (1) switch (_context.p = _context.n) {
846
638
  case 0:
847
639
  config = getConfig();
848
- _context.prev = 1;
640
+ _context.p = 1;
849
641
  _request = {
850
642
  method: method,
851
643
  url: url,
@@ -857,75 +649,71 @@ var request = /*#__PURE__*/function () {
857
649
  params: queries
858
650
  };
859
651
  managedLog('BATCH REQUEST', _request, config, exports.LogType.INFO);
860
- _context.next = 6;
652
+ _context.n = 2;
861
653
  return raw.request(_request, {
862
654
  validateStatus: function validateStatus(status) {
863
655
  return status < 500;
864
656
  }
865
657
  });
866
- case 6:
867
- response = _context.sent;
658
+ case 2:
659
+ response = _context.v;
868
660
  managedLog('BATCH RESPONSE', response.data, config, exports.LogType.INFO);
869
- return _context.abrupt("return", [true, response.status, response.statusText, null, response.data]);
870
- case 11:
871
- _context.prev = 11;
872
- _context.t0 = _context["catch"](1);
873
- managedLog('BATCH ERROR', _context.t0, config, exports.LogType.ERROR);
874
- if (!_context.t0.response) {
875
- _context.next = 19;
661
+ return _context.a(2, [true, response.status, response.statusText, null, response.data]);
662
+ case 3:
663
+ _context.p = 3;
664
+ _t = _context.v;
665
+ managedLog('BATCH ERROR', _t, config, exports.LogType.ERROR);
666
+ if (!_t.response) {
667
+ _context.n = 4;
876
668
  break;
877
669
  }
878
670
  // The request was made and the server responded with a status code
879
671
  // that falls out of the range of 2xx
880
- _response = _context.t0.response;
881
- return _context.abrupt("return", [false, _response.status, _response.statusText, null, _response.data]);
882
- case 19:
883
- if (!_context.t0.request) {
884
- _context.next = 23;
672
+ _response = _t.response;
673
+ return _context.a(2, [false, _response.status, _response.statusText, null, _response.data]);
674
+ case 4:
675
+ if (!_t.request) {
676
+ _context.n = 5;
885
677
  break;
886
678
  }
887
- return _context.abrupt("return", [false, 503, 'Service is Down', 'Unable to get any response from the ', _context.t0]);
888
- case 23:
889
- return _context.abrupt("return", [false, 403, 'Service is Down', 'Could not make the request, check and try again.', _context.t0]);
890
- case 24:
891
- case "end":
892
- return _context.stop();
679
+ return _context.a(2, [false, 503, 'Service is Down', 'Unable to get any response from the ', _t]);
680
+ case 5:
681
+ return _context.a(2, [false, 403, 'Service is Down', 'Could not make the request, check and try again.', _t]);
682
+ case 6:
683
+ return _context.a(2);
893
684
  }
894
- }, _callee, null, [[1, 11]]);
685
+ }, _callee, null, [[1, 3]]);
895
686
  }));
896
687
  return function request(_x, _x2, _x3, _x4, _x5) {
897
688
  return _ref.apply(this, arguments);
898
689
  };
899
690
  }();
900
691
  var requestWithError = /*#__PURE__*/function () {
901
- var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(method, url, body, queries, headers) {
692
+ var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(method, url, body, queries, headers) {
902
693
  var _yield$request, status, httpStatus, title, message, response, _response$message;
903
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
904
- while (1) switch (_context2.prev = _context2.next) {
694
+ return _regenerator().w(function (_context2) {
695
+ while (1) switch (_context2.n) {
905
696
  case 0:
906
- _context2.next = 2;
697
+ _context2.n = 1;
907
698
  return request(method, url, body, queries, headers);
908
- case 2:
909
- _yield$request = _context2.sent;
699
+ case 1:
700
+ _yield$request = _context2.v;
910
701
  status = _yield$request[0];
911
702
  httpStatus = _yield$request[1];
912
703
  title = _yield$request[2];
913
704
  message = _yield$request[3];
914
705
  response = _yield$request[4];
915
706
  if (!(status !== true)) {
916
- _context2.next = 10;
707
+ _context2.n = 2;
917
708
  break;
918
709
  }
919
710
  throw new Error(httpStatus + ": " + title + " " + ((_response$message = response == null ? void 0 : response.message) != null ? _response$message : message));
920
- case 10:
921
- return _context2.abrupt("return", response);
922
- case 11:
923
- case "end":
924
- return _context2.stop();
711
+ case 2:
712
+ return _context2.a(2, response);
925
713
  }
926
714
  }, _callee2);
927
715
  }));
928
- return function requestWithError(_x6, _x7, _x8, _x9, _x10) {
716
+ return function requestWithError(_x6, _x7, _x8, _x9, _x0) {
929
717
  return _ref2.apply(this, arguments);
930
718
  };
931
719
  }();
@@ -946,32 +734,29 @@ var remove = function remove(url, body, queries, headers) {
946
734
  };
947
735
 
948
736
  var init$1 = /*#__PURE__*/function () {
949
- var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
737
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(file) {
950
738
  var config, _yield$post, status, httpStatus, title, message, response;
951
- return _regeneratorRuntime().wrap(function _callee$(_context) {
952
- while (1) switch (_context.prev = _context.next) {
739
+ return _regenerator().w(function (_context) {
740
+ while (1) switch (_context.n) {
953
741
  case 0:
954
742
  config = getConfig();
955
- _context.next = 3;
743
+ _context.n = 1;
956
744
  return post(config.server + "/apps/blobs/upload/init", _extends({}, file));
957
- case 3:
958
- _yield$post = _context.sent;
745
+ case 1:
746
+ _yield$post = _context.v;
959
747
  status = _yield$post[0];
960
748
  httpStatus = _yield$post[1];
961
749
  title = _yield$post[2];
962
750
  message = _yield$post[3];
963
751
  response = _yield$post[4];
964
752
  if (!(status !== true)) {
965
- _context.next = 12;
753
+ _context.n = 2;
966
754
  break;
967
755
  }
968
756
  console.error('INIT ERROR', title, message, httpStatus);
969
- return _context.abrupt("return", null);
970
- case 12:
971
- return _context.abrupt("return", response);
972
- case 13:
973
- case "end":
974
- return _context.stop();
757
+ return _context.a(2, null);
758
+ case 2:
759
+ return _context.a(2, response);
975
760
  }
976
761
  }, _callee);
977
762
  }));
@@ -980,34 +765,31 @@ var init$1 = /*#__PURE__*/function () {
980
765
  };
981
766
  }();
982
767
  var batch = /*#__PURE__*/function () {
983
- var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(pages) {
768
+ var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(pages) {
984
769
  var config, _yield$post2, status, httpStatus, title, message, response;
985
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
986
- while (1) switch (_context2.prev = _context2.next) {
770
+ return _regenerator().w(function (_context2) {
771
+ while (1) switch (_context2.n) {
987
772
  case 0:
988
773
  config = getConfig();
989
- _context2.next = 3;
774
+ _context2.n = 1;
990
775
  return post(config.server + "/apps/blobs/upload/batch", {
991
776
  pages: pages
992
777
  });
993
- case 3:
994
- _yield$post2 = _context2.sent;
778
+ case 1:
779
+ _yield$post2 = _context2.v;
995
780
  status = _yield$post2[0];
996
781
  httpStatus = _yield$post2[1];
997
782
  title = _yield$post2[2];
998
783
  message = _yield$post2[3];
999
784
  response = _yield$post2[4];
1000
785
  if (!(status !== true)) {
1001
- _context2.next = 12;
786
+ _context2.n = 2;
1002
787
  break;
1003
788
  }
1004
789
  console.error('BATCH ERROR', title, message, httpStatus);
1005
- return _context2.abrupt("return", null);
1006
- case 12:
1007
- return _context2.abrupt("return", response);
1008
- case 13:
1009
- case "end":
1010
- return _context2.stop();
790
+ return _context2.a(2, null);
791
+ case 2:
792
+ return _context2.a(2, response);
1011
793
  }
1012
794
  }, _callee2);
1013
795
  }));
@@ -1016,32 +798,29 @@ var batch = /*#__PURE__*/function () {
1016
798
  };
1017
799
  }();
1018
800
  var verify = /*#__PURE__*/function () {
1019
- var _ref3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(file) {
801
+ var _ref3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(file) {
1020
802
  var config, _yield$post3, status, httpStatus, title, message, response;
1021
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1022
- while (1) switch (_context3.prev = _context3.next) {
803
+ return _regenerator().w(function (_context3) {
804
+ while (1) switch (_context3.n) {
1023
805
  case 0:
1024
806
  config = getConfig();
1025
- _context3.next = 3;
807
+ _context3.n = 1;
1026
808
  return post(config.server + "/apps/blobs/upload/verify", _extends({}, file));
1027
- case 3:
1028
- _yield$post3 = _context3.sent;
809
+ case 1:
810
+ _yield$post3 = _context3.v;
1029
811
  status = _yield$post3[0];
1030
812
  httpStatus = _yield$post3[1];
1031
813
  title = _yield$post3[2];
1032
814
  message = _yield$post3[3];
1033
815
  response = _yield$post3[4];
1034
816
  if (!(status !== true)) {
1035
- _context3.next = 12;
817
+ _context3.n = 2;
1036
818
  break;
1037
819
  }
1038
820
  console.error('VERIFY ERROR', title, message, httpStatus);
1039
- return _context3.abrupt("return", null);
1040
- case 12:
1041
- return _context3.abrupt("return", response);
1042
- case 13:
1043
- case "end":
1044
- return _context3.stop();
821
+ return _context3.a(2, null);
822
+ case 2:
823
+ return _context3.a(2, response);
1045
824
  }
1046
825
  }, _callee3);
1047
826
  }));
@@ -1050,29 +829,29 @@ var verify = /*#__PURE__*/function () {
1050
829
  };
1051
830
  }();
1052
831
  var upload = /*#__PURE__*/function () {
1053
- var _ref4 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(input, parentId, tags) {
832
+ var _ref4 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(input, parentId, tags) {
1054
833
  var meta, ext, mimeType, size, name, file, totalChunks, nFile;
1055
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1056
- while (1) switch (_context5.prev = _context5.next) {
834
+ return _regenerator().w(function (_context5) {
835
+ while (1) switch (_context5.n) {
1057
836
  case 0:
1058
- _context5.next = 2;
837
+ _context5.n = 1;
1059
838
  return getFileMeta(input);
1060
- case 2:
1061
- meta = _context5.sent;
839
+ case 1:
840
+ meta = _context5.v;
1062
841
  if (meta) {
1063
- _context5.next = 5;
842
+ _context5.n = 2;
1064
843
  break;
1065
844
  }
1066
- return _context5.abrupt("return", [false, 'Failed to read file metadata']);
1067
- case 5:
845
+ return _context5.a(2, [false, 'Failed to read file metadata']);
846
+ case 2:
1068
847
  ext = meta[0], mimeType = meta[1], size = meta[2], name = meta[3];
1069
848
  if (!(!ext || !mimeType || !size || !name)) {
1070
- _context5.next = 8;
849
+ _context5.n = 3;
1071
850
  break;
1072
851
  }
1073
- return _context5.abrupt("return", [false, 'Invalid file metadata']);
1074
- case 8:
1075
- _context5.next = 10;
852
+ return _context5.a(2, [false, 'Invalid file metadata']);
853
+ case 3:
854
+ _context5.n = 4;
1076
855
  return init$1({
1077
856
  type: ext,
1078
857
  parentId: parentId,
@@ -1081,29 +860,28 @@ var upload = /*#__PURE__*/function () {
1081
860
  size: size,
1082
861
  mime: mimeType
1083
862
  });
1084
- case 10:
1085
- file = _context5.sent;
863
+ case 4:
864
+ file = _context5.v;
1086
865
  if (!(!file || !file.id)) {
1087
- _context5.next = 13;
866
+ _context5.n = 5;
1088
867
  break;
1089
868
  }
1090
- return _context5.abrupt("return", [false, 'Failed to init file upload']);
1091
- case 13:
1092
- _context5.next = 15;
869
+ return _context5.a(2, [false, 'Failed to init file upload']);
870
+ case 5:
871
+ _context5.n = 6;
1093
872
  return streamFileChunks(input, /*#__PURE__*/function () {
1094
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(chunk, index) {
1095
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1096
- while (1) switch (_context4.prev = _context4.next) {
873
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(chunk, index) {
874
+ return _regenerator().w(function (_context4) {
875
+ while (1) switch (_context4.n) {
1097
876
  case 0:
1098
- _context4.next = 2;
877
+ _context4.n = 1;
1099
878
  return batch([{
1100
879
  fileId: file.id,
1101
880
  index: index,
1102
881
  raw: chunk
1103
882
  }]);
1104
- case 2:
1105
- case "end":
1106
- return _context4.stop();
883
+ case 1:
884
+ return _context4.a(2);
1107
885
  }
1108
886
  }, _callee4);
1109
887
  }));
@@ -1111,15 +889,15 @@ var upload = /*#__PURE__*/function () {
1111
889
  return _ref5.apply(this, arguments);
1112
890
  };
1113
891
  }());
1114
- case 15:
1115
- totalChunks = _context5.sent;
892
+ case 6:
893
+ totalChunks = _context5.v;
1116
894
  if (totalChunks) {
1117
- _context5.next = 18;
895
+ _context5.n = 7;
1118
896
  break;
1119
897
  }
1120
- return _context5.abrupt("return", [false, 'Failed to upload file chunks']);
1121
- case 18:
1122
- _context5.next = 20;
898
+ return _context5.a(2, [false, 'Failed to upload file chunks']);
899
+ case 7:
900
+ _context5.n = 8;
1123
901
  return verify({
1124
902
  type: ext,
1125
903
  parentId: parentId,
@@ -1128,24 +906,21 @@ var upload = /*#__PURE__*/function () {
1128
906
  size: size,
1129
907
  mime: mimeType
1130
908
  });
1131
- case 20:
1132
- nFile = _context5.sent;
909
+ case 8:
910
+ nFile = _context5.v;
1133
911
  if (!(!nFile || !nFile.url)) {
1134
- _context5.next = 23;
912
+ _context5.n = 9;
1135
913
  break;
1136
914
  }
1137
- return _context5.abrupt("return", [false, 'Failed to verify file upload']);
1138
- case 23:
915
+ return _context5.a(2, [false, 'Failed to verify file upload']);
916
+ case 9:
1139
917
  if (!((nFile == null ? void 0 : nFile.pagesCount) !== totalChunks)) {
1140
- _context5.next = 25;
918
+ _context5.n = 10;
1141
919
  break;
1142
920
  }
1143
- return _context5.abrupt("return", [false, 'Uploaded chunks count does not match']);
1144
- case 25:
1145
- return _context5.abrupt("return", [true, nFile.url]);
1146
- case 26:
1147
- case "end":
1148
- return _context5.stop();
921
+ return _context5.a(2, [false, 'Uploaded chunks count does not match']);
922
+ case 10:
923
+ return _context5.a(2, [true, nFile.url]);
1149
924
  }
1150
925
  }, _callee5);
1151
926
  }));
@@ -1174,6 +949,7 @@ var init = function init(c) {
1174
949
  throw new Error('Invalid configuration - sourceId not defined');
1175
950
  }
1176
951
  managedLog('INIT ACTIVE CONFIG', config, config, exports.LogType.INFO);
952
+ setConfig(config);
1177
953
  // register SDK as source
1178
954
  // push({
1179
955
  // category: CategoryType.Event,