@orioro/util 0.11.2 → 0.13.0

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/dist/index.js CHANGED
@@ -10,6 +10,7 @@ var memoizeOne = require('memoize-one');
10
10
  var queryString = require('query-string');
11
11
 
12
12
  function arrayChunk(array, chunkSize) {
13
+ console.warn('arrayChunk is deprecated, prefer lodash-es chunk');
13
14
  var chunks = [];
14
15
  for (var i = 0; i < array.length; i += chunkSize) {
15
16
  chunks.push(array.slice(i, i + chunkSize));
@@ -17,6 +18,366 @@ function arrayChunk(array, chunkSize) {
17
18
  return chunks;
18
19
  }
19
20
 
21
+ function _callSuper(t, o, e) {
22
+ return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
23
+ }
24
+ function _construct(t, e, r) {
25
+ if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
26
+ var o = [null];
27
+ o.push.apply(o, e);
28
+ var p = new (t.bind.apply(t, o))();
29
+ return r && _setPrototypeOf(p, r.prototype), p;
30
+ }
31
+ function _isNativeReflectConstruct() {
32
+ try {
33
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
34
+ } catch (t) {}
35
+ return (_isNativeReflectConstruct = function () {
36
+ return !!t;
37
+ })();
38
+ }
39
+ function _iterableToArrayLimit(r, l) {
40
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
41
+ if (null != t) {
42
+ var e,
43
+ n,
44
+ i,
45
+ u,
46
+ a = [],
47
+ f = !0,
48
+ o = !1;
49
+ try {
50
+ if (i = (t = t.call(r)).next, 0 === l) {
51
+ if (Object(t) !== t) return;
52
+ f = !1;
53
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
54
+ } catch (r) {
55
+ o = !0, n = r;
56
+ } finally {
57
+ try {
58
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
59
+ } finally {
60
+ if (o) throw n;
61
+ }
62
+ }
63
+ return a;
64
+ }
65
+ }
66
+ function _regeneratorRuntime() {
67
+ _regeneratorRuntime = function () {
68
+ return e;
69
+ };
70
+ var t,
71
+ e = {},
72
+ r = Object.prototype,
73
+ n = r.hasOwnProperty,
74
+ o = Object.defineProperty || function (t, e, r) {
75
+ t[e] = r.value;
76
+ },
77
+ i = "function" == typeof Symbol ? Symbol : {},
78
+ a = i.iterator || "@@iterator",
79
+ c = i.asyncIterator || "@@asyncIterator",
80
+ u = i.toStringTag || "@@toStringTag";
81
+ function define(t, e, r) {
82
+ return Object.defineProperty(t, e, {
83
+ value: r,
84
+ enumerable: !0,
85
+ configurable: !0,
86
+ writable: !0
87
+ }), t[e];
88
+ }
89
+ try {
90
+ define({}, "");
91
+ } catch (t) {
92
+ define = function (t, e, r) {
93
+ return t[e] = r;
94
+ };
95
+ }
96
+ function wrap(t, e, r, n) {
97
+ var i = e && e.prototype instanceof Generator ? e : Generator,
98
+ a = Object.create(i.prototype),
99
+ c = new Context(n || []);
100
+ return o(a, "_invoke", {
101
+ value: makeInvokeMethod(t, r, c)
102
+ }), a;
103
+ }
104
+ function tryCatch(t, e, r) {
105
+ try {
106
+ return {
107
+ type: "normal",
108
+ arg: t.call(e, r)
109
+ };
110
+ } catch (t) {
111
+ return {
112
+ type: "throw",
113
+ arg: t
114
+ };
115
+ }
116
+ }
117
+ e.wrap = wrap;
118
+ var h = "suspendedStart",
119
+ l = "suspendedYield",
120
+ f = "executing",
121
+ s = "completed",
122
+ y = {};
123
+ function Generator() {}
124
+ function GeneratorFunction() {}
125
+ function GeneratorFunctionPrototype() {}
126
+ var p = {};
127
+ define(p, a, function () {
128
+ return this;
129
+ });
130
+ var d = Object.getPrototypeOf,
131
+ v = d && d(d(values([])));
132
+ v && v !== r && n.call(v, a) && (p = v);
133
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
134
+ function defineIteratorMethods(t) {
135
+ ["next", "throw", "return"].forEach(function (e) {
136
+ define(t, e, function (t) {
137
+ return this._invoke(e, t);
138
+ });
139
+ });
140
+ }
141
+ function AsyncIterator(t, e) {
142
+ function invoke(r, o, i, a) {
143
+ var c = tryCatch(t[r], t, o);
144
+ if ("throw" !== c.type) {
145
+ var u = c.arg,
146
+ h = u.value;
147
+ return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
148
+ invoke("next", t, i, a);
149
+ }, function (t) {
150
+ invoke("throw", t, i, a);
151
+ }) : e.resolve(h).then(function (t) {
152
+ u.value = t, i(u);
153
+ }, function (t) {
154
+ return invoke("throw", t, i, a);
155
+ });
156
+ }
157
+ a(c.arg);
158
+ }
159
+ var r;
160
+ o(this, "_invoke", {
161
+ value: function (t, n) {
162
+ function callInvokeWithMethodAndArg() {
163
+ return new e(function (e, r) {
164
+ invoke(t, n, e, r);
165
+ });
166
+ }
167
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
168
+ }
169
+ });
170
+ }
171
+ function makeInvokeMethod(e, r, n) {
172
+ var o = h;
173
+ return function (i, a) {
174
+ if (o === f) throw new Error("Generator is already running");
175
+ if (o === s) {
176
+ if ("throw" === i) throw a;
177
+ return {
178
+ value: t,
179
+ done: !0
180
+ };
181
+ }
182
+ for (n.method = i, n.arg = a;;) {
183
+ var c = n.delegate;
184
+ if (c) {
185
+ var u = maybeInvokeDelegate(c, n);
186
+ if (u) {
187
+ if (u === y) continue;
188
+ return u;
189
+ }
190
+ }
191
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
192
+ if (o === h) throw o = s, n.arg;
193
+ n.dispatchException(n.arg);
194
+ } else "return" === n.method && n.abrupt("return", n.arg);
195
+ o = f;
196
+ var p = tryCatch(e, r, n);
197
+ if ("normal" === p.type) {
198
+ if (o = n.done ? s : l, p.arg === y) continue;
199
+ return {
200
+ value: p.arg,
201
+ done: n.done
202
+ };
203
+ }
204
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
205
+ }
206
+ };
207
+ }
208
+ function maybeInvokeDelegate(e, r) {
209
+ var n = r.method,
210
+ o = e.iterator[n];
211
+ 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;
212
+ var i = tryCatch(o, e.iterator, r.arg);
213
+ if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
214
+ var a = i.arg;
215
+ 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);
216
+ }
217
+ function pushTryEntry(t) {
218
+ var e = {
219
+ tryLoc: t[0]
220
+ };
221
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
222
+ }
223
+ function resetTryEntry(t) {
224
+ var e = t.completion || {};
225
+ e.type = "normal", delete e.arg, t.completion = e;
226
+ }
227
+ function Context(t) {
228
+ this.tryEntries = [{
229
+ tryLoc: "root"
230
+ }], t.forEach(pushTryEntry, this), this.reset(!0);
231
+ }
232
+ function values(e) {
233
+ if (e || "" === e) {
234
+ var r = e[a];
235
+ if (r) return r.call(e);
236
+ if ("function" == typeof e.next) return e;
237
+ if (!isNaN(e.length)) {
238
+ var o = -1,
239
+ i = function next() {
240
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
241
+ return next.value = t, next.done = !0, next;
242
+ };
243
+ return i.next = i;
244
+ }
245
+ }
246
+ throw new TypeError(typeof e + " is not iterable");
247
+ }
248
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
249
+ value: GeneratorFunctionPrototype,
250
+ configurable: !0
251
+ }), o(GeneratorFunctionPrototype, "constructor", {
252
+ value: GeneratorFunction,
253
+ configurable: !0
254
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
255
+ var e = "function" == typeof t && t.constructor;
256
+ return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
257
+ }, e.mark = function (t) {
258
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
259
+ }, e.awrap = function (t) {
260
+ return {
261
+ __await: t
262
+ };
263
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
264
+ return this;
265
+ }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
266
+ void 0 === i && (i = Promise);
267
+ var a = new AsyncIterator(wrap(t, r, n, o), i);
268
+ return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
269
+ return t.done ? t.value : a.next();
270
+ });
271
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
272
+ return this;
273
+ }), define(g, "toString", function () {
274
+ return "[object Generator]";
275
+ }), e.keys = function (t) {
276
+ var e = Object(t),
277
+ r = [];
278
+ for (var n in e) r.push(n);
279
+ return r.reverse(), function next() {
280
+ for (; r.length;) {
281
+ var t = r.pop();
282
+ if (t in e) return next.value = t, next.done = !1, next;
283
+ }
284
+ return next.done = !0, next;
285
+ };
286
+ }, e.values = values, Context.prototype = {
287
+ constructor: Context,
288
+ reset: function (e) {
289
+ 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);
290
+ },
291
+ stop: function () {
292
+ this.done = !0;
293
+ var t = this.tryEntries[0].completion;
294
+ if ("throw" === t.type) throw t.arg;
295
+ return this.rval;
296
+ },
297
+ dispatchException: function (e) {
298
+ if (this.done) throw e;
299
+ var r = this;
300
+ function handle(n, o) {
301
+ return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
302
+ }
303
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
304
+ var i = this.tryEntries[o],
305
+ a = i.completion;
306
+ if ("root" === i.tryLoc) return handle("end");
307
+ if (i.tryLoc <= this.prev) {
308
+ var c = n.call(i, "catchLoc"),
309
+ u = n.call(i, "finallyLoc");
310
+ if (c && u) {
311
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
312
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
313
+ } else if (c) {
314
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
315
+ } else {
316
+ if (!u) throw new Error("try statement without catch or finally");
317
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
318
+ }
319
+ }
320
+ }
321
+ },
322
+ abrupt: function (t, e) {
323
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
324
+ var o = this.tryEntries[r];
325
+ if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
326
+ var i = o;
327
+ break;
328
+ }
329
+ }
330
+ i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
331
+ var a = i ? i.completion : {};
332
+ return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
333
+ },
334
+ complete: function (t, e) {
335
+ if ("throw" === t.type) throw t.arg;
336
+ 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;
337
+ },
338
+ finish: function (t) {
339
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
340
+ var r = this.tryEntries[e];
341
+ if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
342
+ }
343
+ },
344
+ catch: function (t) {
345
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
346
+ var r = this.tryEntries[e];
347
+ if (r.tryLoc === t) {
348
+ var n = r.completion;
349
+ if ("throw" === n.type) {
350
+ var o = n.arg;
351
+ resetTryEntry(r);
352
+ }
353
+ return o;
354
+ }
355
+ }
356
+ throw new Error("illegal catch attempt");
357
+ },
358
+ delegateYield: function (e, r, n) {
359
+ return this.delegate = {
360
+ iterator: values(e),
361
+ resultName: r,
362
+ nextLoc: n
363
+ }, "next" === this.method && (this.arg = t), y;
364
+ }
365
+ }, e;
366
+ }
367
+ function _toPrimitive(t, r) {
368
+ if ("object" != typeof t || !t) return t;
369
+ var e = t[Symbol.toPrimitive];
370
+ if (void 0 !== e) {
371
+ var i = e.call(t, r || "default");
372
+ if ("object" != typeof i) return i;
373
+ throw new TypeError("@@toPrimitive must return a primitive value.");
374
+ }
375
+ return ("string" === r ? String : Number)(t);
376
+ }
377
+ function _toPropertyKey(t) {
378
+ var i = _toPrimitive(t, "string");
379
+ return "symbol" == typeof i ? i : String(i);
380
+ }
20
381
  function _typeof(o) {
21
382
  "@babel/helpers - typeof";
22
383
 
@@ -26,175 +387,206 @@ function _typeof(o) {
26
387
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
27
388
  }, _typeof(o);
28
389
  }
29
-
30
- /******************************************************************************
31
- Copyright (c) Microsoft Corporation.
32
-
33
- Permission to use, copy, modify, and/or distribute this software for any
34
- purpose with or without fee is hereby granted.
35
-
36
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
37
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
38
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
39
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
40
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
41
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
42
- PERFORMANCE OF THIS SOFTWARE.
43
- ***************************************************************************** */
44
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
45
-
46
- var _extendStatics = function extendStatics(d, b) {
47
- _extendStatics = Object.setPrototypeOf || {
48
- __proto__: []
49
- } instanceof Array && function (d, b) {
50
- d.__proto__ = b;
51
- } || function (d, b) {
52
- for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
53
- };
54
- return _extendStatics(d, b);
55
- };
56
- function __extends(d, b) {
57
- if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
58
- _extendStatics(d, b);
59
- function __() {
60
- this.constructor = d;
390
+ function _classCallCheck(instance, Constructor) {
391
+ if (!(instance instanceof Constructor)) {
392
+ throw new TypeError("Cannot call a class as a function");
393
+ }
394
+ }
395
+ function _defineProperties(target, props) {
396
+ for (var i = 0; i < props.length; i++) {
397
+ var descriptor = props[i];
398
+ descriptor.enumerable = descriptor.enumerable || false;
399
+ descriptor.configurable = true;
400
+ if ("value" in descriptor) descriptor.writable = true;
401
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
402
+ }
403
+ }
404
+ function _createClass(Constructor, protoProps, staticProps) {
405
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
406
+ if (staticProps) _defineProperties(Constructor, staticProps);
407
+ Object.defineProperty(Constructor, "prototype", {
408
+ writable: false
409
+ });
410
+ return Constructor;
411
+ }
412
+ function _defineProperty(obj, key, value) {
413
+ key = _toPropertyKey(key);
414
+ if (key in obj) {
415
+ Object.defineProperty(obj, key, {
416
+ value: value,
417
+ enumerable: true,
418
+ configurable: true,
419
+ writable: true
420
+ });
421
+ } else {
422
+ obj[key] = value;
61
423
  }
62
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
424
+ return obj;
63
425
  }
64
- var _assign = function __assign() {
65
- _assign = Object.assign || function __assign(t) {
66
- for (var s, i = 1, n = arguments.length; i < n; i++) {
67
- s = arguments[i];
68
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
426
+ function _inherits(subClass, superClass) {
427
+ if (typeof superClass !== "function" && superClass !== null) {
428
+ throw new TypeError("Super expression must either be null or a function");
429
+ }
430
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
431
+ constructor: {
432
+ value: subClass,
433
+ writable: true,
434
+ configurable: true
69
435
  }
70
- return t;
436
+ });
437
+ Object.defineProperty(subClass, "prototype", {
438
+ writable: false
439
+ });
440
+ if (superClass) _setPrototypeOf(subClass, superClass);
441
+ }
442
+ function _getPrototypeOf(o) {
443
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
444
+ return o.__proto__ || Object.getPrototypeOf(o);
71
445
  };
72
- return _assign.apply(this, arguments);
73
- };
74
- function __awaiter(thisArg, _arguments, P, generator) {
75
- function adopt(value) {
76
- return value instanceof P ? value : new P(function (resolve) {
77
- resolve(value);
78
- });
446
+ return _getPrototypeOf(o);
447
+ }
448
+ function _setPrototypeOf(o, p) {
449
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
450
+ o.__proto__ = p;
451
+ return o;
452
+ };
453
+ return _setPrototypeOf(o, p);
454
+ }
455
+ function _isNativeFunction(fn) {
456
+ try {
457
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
458
+ } catch (e) {
459
+ return typeof fn === "function";
79
460
  }
80
- return new (P || (P = Promise))(function (resolve, reject) {
81
- function fulfilled(value) {
82
- try {
83
- step(generator.next(value));
84
- } catch (e) {
85
- reject(e);
86
- }
461
+ }
462
+ function _wrapNativeSuper(Class) {
463
+ var _cache = typeof Map === "function" ? new Map() : undefined;
464
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
465
+ if (Class === null || !_isNativeFunction(Class)) return Class;
466
+ if (typeof Class !== "function") {
467
+ throw new TypeError("Super expression must either be null or a function");
87
468
  }
88
- function rejected(value) {
89
- try {
90
- step(generator["throw"](value));
91
- } catch (e) {
92
- reject(e);
93
- }
469
+ if (typeof _cache !== "undefined") {
470
+ if (_cache.has(Class)) return _cache.get(Class);
471
+ _cache.set(Class, Wrapper);
94
472
  }
95
- function step(result) {
96
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
473
+ function Wrapper() {
474
+ return _construct(Class, arguments, _getPrototypeOf(this).constructor);
97
475
  }
98
- step((generator = generator.apply(thisArg, _arguments || [])).next());
99
- });
476
+ Wrapper.prototype = Object.create(Class.prototype, {
477
+ constructor: {
478
+ value: Wrapper,
479
+ enumerable: false,
480
+ writable: true,
481
+ configurable: true
482
+ }
483
+ });
484
+ return _setPrototypeOf(Wrapper, Class);
485
+ };
486
+ return _wrapNativeSuper(Class);
100
487
  }
101
- function __generator(thisArg, body) {
102
- var _ = {
103
- label: 0,
104
- sent: function sent() {
105
- if (t[0] & 1) throw t[1];
106
- return t[1];
107
- },
108
- trys: [],
109
- ops: []
110
- },
111
- f,
112
- y,
113
- t,
114
- g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
115
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () {
116
- return this;
117
- }), g;
118
- function verb(n) {
119
- return function (v) {
120
- return step([n, v]);
121
- };
488
+ function _assertThisInitialized(self) {
489
+ if (self === void 0) {
490
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
122
491
  }
123
- function step(op) {
124
- if (f) throw new TypeError("Generator is already executing.");
125
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
126
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
127
- if (y = 0, t) op = [op[0] & 2, t.value];
128
- switch (op[0]) {
129
- case 0:
130
- case 1:
131
- t = op;
132
- break;
133
- case 4:
134
- _.label++;
492
+ return self;
493
+ }
494
+ function _possibleConstructorReturn(self, call) {
495
+ if (call && (typeof call === "object" || typeof call === "function")) {
496
+ return call;
497
+ } else if (call !== void 0) {
498
+ throw new TypeError("Derived constructors may only return object or undefined");
499
+ }
500
+ return _assertThisInitialized(self);
501
+ }
502
+ function _slicedToArray(arr, i) {
503
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
504
+ }
505
+ function _toArray(arr) {
506
+ return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
507
+ }
508
+ function _toConsumableArray(arr) {
509
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
510
+ }
511
+ function _arrayWithoutHoles(arr) {
512
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
513
+ }
514
+ function _arrayWithHoles(arr) {
515
+ if (Array.isArray(arr)) return arr;
516
+ }
517
+ function _iterableToArray(iter) {
518
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
519
+ }
520
+ function _unsupportedIterableToArray(o, minLen) {
521
+ if (!o) return;
522
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
523
+ var n = Object.prototype.toString.call(o).slice(8, -1);
524
+ if (n === "Object" && o.constructor) n = o.constructor.name;
525
+ if (n === "Map" || n === "Set") return Array.from(o);
526
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
527
+ }
528
+ function _arrayLikeToArray(arr, len) {
529
+ if (len == null || len > arr.length) len = arr.length;
530
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
531
+ return arr2;
532
+ }
533
+ function _nonIterableSpread() {
534
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
535
+ }
536
+ function _nonIterableRest() {
537
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
538
+ }
539
+ function _createForOfIteratorHelper(o, allowArrayLike) {
540
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
541
+ if (!it) {
542
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
543
+ if (it) o = it;
544
+ var i = 0;
545
+ var F = function () {};
546
+ return {
547
+ s: F,
548
+ n: function () {
549
+ if (i >= o.length) return {
550
+ done: true
551
+ };
135
552
  return {
136
- value: op[1],
137
- done: false
553
+ done: false,
554
+ value: o[i++]
138
555
  };
139
- case 5:
140
- _.label++;
141
- y = op[1];
142
- op = [0];
143
- continue;
144
- case 7:
145
- op = _.ops.pop();
146
- _.trys.pop();
147
- continue;
148
- default:
149
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
150
- _ = 0;
151
- continue;
152
- }
153
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
154
- _.label = op[1];
155
- break;
156
- }
157
- if (op[0] === 6 && _.label < t[1]) {
158
- _.label = t[1];
159
- t = op;
160
- break;
161
- }
162
- if (t && _.label < t[2]) {
163
- _.label = t[2];
164
- _.ops.push(op);
165
- break;
166
- }
167
- if (t[2]) _.ops.pop();
168
- _.trys.pop();
169
- continue;
170
- }
171
- op = body.call(thisArg, _);
172
- } catch (e) {
173
- op = [6, e];
174
- y = 0;
175
- } finally {
176
- f = t = 0;
556
+ },
557
+ e: function (e) {
558
+ throw e;
559
+ },
560
+ f: F
561
+ };
177
562
  }
178
- if (op[0] & 5) throw op[1];
179
- return {
180
- value: op[0] ? op[1] : void 0,
181
- done: true
182
- };
563
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
183
564
  }
184
- }
185
- function __spreadArray(to, from, pack) {
186
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
187
- if (ar || !(i in from)) {
188
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
189
- ar[i] = from[i];
565
+ var normalCompletion = true,
566
+ didErr = false,
567
+ err;
568
+ return {
569
+ s: function () {
570
+ it = it.call(o);
571
+ },
572
+ n: function () {
573
+ var step = it.next();
574
+ normalCompletion = step.done;
575
+ return step;
576
+ },
577
+ e: function (e) {
578
+ didErr = true;
579
+ err = e;
580
+ },
581
+ f: function () {
582
+ try {
583
+ if (!normalCompletion && it.return != null) it.return();
584
+ } finally {
585
+ if (didErr) throw err;
586
+ }
190
587
  }
191
- }
192
- return to.concat(ar || Array.prototype.slice.call(from));
588
+ };
193
589
  }
194
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
195
- var e = new Error(message);
196
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
197
- };
198
590
 
199
591
  function _isTupleDatasetInput(input) {
200
592
  return Array.isArray(input) && typeof input[0] === 'string' && Array.isArray(input[1]);
@@ -210,10 +602,15 @@ function _parseDatasetInput(defaultOnKey, datasetInput) {
210
602
  if (keySplit.length === 1) {
211
603
  srcKey = null;
212
604
  key = keyInput;
213
- } else {
605
+ } else if (keySplit.length === 2) {
214
606
  srcKey = keySplit[0];
215
607
  key = keySplit[1];
608
+ } else {
609
+ throw new Error("Invalid keyInput: ".concat(keyInput, " - contains too many colons (:)"));
216
610
  }
611
+ } else if (Array.isArray(keyInput)) {
612
+ srcKey = keyInput[0];
613
+ key = keyInput[1];
217
614
  }
218
615
  return {
219
616
  srcKey: srcKey,
@@ -229,14 +626,15 @@ function _parseDatasetInput(defaultOnKey, datasetInput) {
229
626
  path: null
230
627
  };
231
628
  }
232
- function dataJoin(datasets, _a) {
233
- var _b = _a === void 0 ? {} : _a,
234
- _c = _b.key,
235
- defaultOnKey = _c === void 0 ? 'id' : _c,
236
- _d = _b.mode,
237
- mode = _d === void 0 ? 'left' : _d;
238
- var base = datasets[0],
239
- others = datasets.slice(1);
629
+ function dataJoin(datasets) {
630
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
631
+ _ref$key = _ref.key,
632
+ defaultOnKey = _ref$key === void 0 ? 'id' : _ref$key,
633
+ _ref$mode = _ref.mode,
634
+ mode = _ref$mode === void 0 ? 'left' : _ref$mode;
635
+ var _datasets = _toArray(datasets),
636
+ base = _datasets[0],
637
+ others = _datasets.slice(1);
240
638
  //
241
639
  // Base dataset requires no byKey dict
242
640
  //
@@ -246,7 +644,7 @@ function dataJoin(datasets, _a) {
246
644
  //
247
645
  var otherSets = others.map(function (setInput) {
248
646
  var parsed = _parseDatasetInput(defaultOnKey, setInput);
249
- return _assign(_assign({}, parsed), {
647
+ return Object.assign(Object.assign({}, parsed), {
250
648
  byKey: lodashEs.keyBy(parsed.entries, parsed.key)
251
649
  });
252
650
  });
@@ -256,35 +654,36 @@ function dataJoin(datasets, _a) {
256
654
  // to another dataset
257
655
  //
258
656
  function _entryKey(entry, otherSet) {
259
- var _a;
260
- return ((_a = otherSet.srcKey ? lodashEs.get(entry, otherSet.srcKey) : lodashEs.get(entry, baseDataset.key)) !== null && _a !== void 0 ? _a : '').toString();
657
+ var key = otherSet.srcKey ? lodashEs.get(entry, otherSet.srcKey) : lodashEs.get(entry, baseDataset.key);
658
+ return typeof key === 'string' || typeof key === 'number' ? key : null;
261
659
  }
262
660
  //
263
661
  // If mode === inner, filter out missing data
264
662
  //
265
663
  var baseEntries = mode === 'inner' ? baseDataset.entries.filter(function (entry) {
266
664
  return otherSets.every(function (set) {
267
- return set.byKey[_entryKey(entry, set)];
665
+ var entryKey = _entryKey(entry, set);
666
+ return entryKey === null ? false : typeof set.byKey[entryKey] !== 'undefined';
268
667
  });
269
668
  }) : baseDataset.entries;
270
669
  //
271
670
  // Loop over baseDataset.entries joining it with other data
272
671
  //
273
672
  return baseEntries.map(function (entry) {
274
- var _a;
275
673
  //
276
674
  // Setup a base entry over which data will be set
277
675
  //
278
- var baseEntry = baseDataset.path ? (_a = {}, _a[baseDataset.path] = entry, _a) : Object.assign({}, entry);
676
+ var baseEntry = baseDataset.path ? _defineProperty({}, baseDataset.path, entry) : Object.assign({}, entry);
279
677
  //
280
678
  // Loop over all other sets to pick up data
281
679
  //
282
680
  return otherSets.reduce(function (acc, otherSet) {
283
681
  var entryKey = _entryKey(entry, otherSet);
284
- var otherEntry = otherSet.byKey[entryKey];
682
+ var otherEntry = entryKey === null ? null : otherSet.byKey[entryKey];
285
683
  if (otherEntry) {
286
684
  if (otherSet.path) {
287
- lodashEs.set(acc, otherSet.path, otherEntry);
685
+ var currVal = lodashEs.get(acc, otherSet.path) || {};
686
+ lodashEs.set(acc, otherSet.path, Object.assign({}, _typeof(currVal) === 'object' ? currVal : {}, otherEntry));
288
687
  } else {
289
688
  Object.assign(acc, otherEntry);
290
689
  }
@@ -294,46 +693,161 @@ function dataJoin(datasets, _a) {
294
693
  });
295
694
  }
296
695
 
297
- var PromiseLikeEventEmitter = /** @class */function (_super) {
298
- __extends(PromiseLikeEventEmitter, _super);
696
+ function arrayLikeIterable(makeIterable) {
697
+ return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, Symbol.iterator, function () {
698
+ return makeIterable()[Symbol.iterator]();
699
+ }), "map", function map(fn) {
700
+ var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
701
+ var result = [];
702
+ var _iterator = _createForOfIteratorHelper(makeIterable()),
703
+ _step;
704
+ try {
705
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
706
+ var item = _step.value;
707
+ result.push(fn(item, i++));
708
+ }
709
+ } catch (err) {
710
+ _iterator.e(err);
711
+ } finally {
712
+ _iterator.f();
713
+ }
714
+ return result;
715
+ }), "forEach", function forEach(fn) {
716
+ var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
717
+ var _iterator2 = _createForOfIteratorHelper(makeIterable()),
718
+ _step2;
719
+ try {
720
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
721
+ var item = _step2.value;
722
+ fn(item, i++);
723
+ }
724
+ } catch (err) {
725
+ _iterator2.e(err);
726
+ } finally {
727
+ _iterator2.f();
728
+ }
729
+ }), "reduce", function reduce(fn, acc) {
730
+ var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
731
+ var _iterator3 = _createForOfIteratorHelper(makeIterable()),
732
+ _step3;
733
+ try {
734
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
735
+ var item = _step3.value;
736
+ acc = fn(acc, item, i++);
737
+ }
738
+ } catch (err) {
739
+ _iterator3.e(err);
740
+ } finally {
741
+ _iterator3.f();
742
+ }
743
+ return acc;
744
+ }), "toArray", function toArray() {
745
+ return _toConsumableArray(makeIterable());
746
+ }), "filter", function filter(fn) {
747
+ var i = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
748
+ var result = [];
749
+ var _iterator4 = _createForOfIteratorHelper(makeIterable()),
750
+ _step4;
751
+ try {
752
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
753
+ var item = _step4.value;
754
+ if (fn(item, i++)) result.push(item);
755
+ }
756
+ } catch (err) {
757
+ _iterator4.e(err);
758
+ } finally {
759
+ _iterator4.f();
760
+ }
761
+ return result;
762
+ });
763
+ }
764
+
765
+ var PromiseLikeEventEmitter = /*#__PURE__*/function (_EventEmitter) {
766
+ _inherits(PromiseLikeEventEmitter, _EventEmitter);
299
767
  function PromiseLikeEventEmitter() {
300
- var _this = _super.call(this) || this;
768
+ var _this;
769
+ _classCallCheck(this, PromiseLikeEventEmitter);
770
+ _this = _callSuper(this, PromiseLikeEventEmitter);
301
771
  _this.promise = new Promise(function (resolve, reject) {
302
772
  _this.resolve = resolve;
303
773
  _this.reject = reject;
304
774
  });
305
775
  return _this;
306
776
  }
307
- PromiseLikeEventEmitter.prototype.then = function (onFulfilled, onRejected) {
308
- return this.promise.then(onFulfilled, onRejected);
309
- };
310
- PromiseLikeEventEmitter.prototype["catch"] = function (onRejected) {
311
- return this.promise["catch"](onRejected);
312
- };
313
- PromiseLikeEventEmitter.prototype["finally"] = function (onFinally) {
314
- return this.promise["finally"](onFinally);
315
- };
777
+ _createClass(PromiseLikeEventEmitter, [{
778
+ key: "then",
779
+ value: function then(onFulfilled, onRejected) {
780
+ return this.promise.then(onFulfilled, onRejected);
781
+ }
782
+ }, {
783
+ key: "catch",
784
+ value: function _catch(onRejected) {
785
+ return this.promise["catch"](onRejected);
786
+ }
787
+ }, {
788
+ key: "finally",
789
+ value: function _finally(onFinally) {
790
+ return this.promise["finally"](onFinally);
791
+ }
792
+ }]);
316
793
  return PromiseLikeEventEmitter;
317
794
  }(EventEmitter);
318
795
 
319
- function wait(ms, result) {
320
- if (ms === void 0) {
321
- ms = 1000;
322
- }
323
- return __awaiter(this, void 0, void 0, function () {
324
- return __generator(this, function (_a) {
325
- return [2 /*return*/, new Promise(function (resolve, reject) {
326
- setTimeout(function () {
327
- if (result instanceof Error) {
328
- reject(result);
329
- } else {
330
- resolve(result);
331
- }
332
- }, ms);
333
- })];
796
+ function __awaiter(thisArg, _arguments, P, generator) {
797
+ function adopt(value) {
798
+ return value instanceof P ? value : new P(function (resolve) {
799
+ resolve(value);
334
800
  });
801
+ }
802
+ return new (P || (P = Promise))(function (resolve, reject) {
803
+ function fulfilled(value) {
804
+ try {
805
+ step(generator.next(value));
806
+ } catch (e) {
807
+ reject(e);
808
+ }
809
+ }
810
+ function rejected(value) {
811
+ try {
812
+ step(generator["throw"](value));
813
+ } catch (e) {
814
+ reject(e);
815
+ }
816
+ }
817
+ function step(result) {
818
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
819
+ }
820
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
335
821
  });
336
822
  }
823
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
824
+ var e = new Error(message);
825
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
826
+ };
827
+
828
+ function wait() {
829
+ var ms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1000;
830
+ var result = arguments.length > 1 ? arguments[1] : undefined;
831
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
832
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
833
+ while (1) switch (_context.prev = _context.next) {
834
+ case 0:
835
+ return _context.abrupt("return", new Promise(function (resolve, reject) {
836
+ setTimeout(function () {
837
+ if (result instanceof Error) {
838
+ reject(result);
839
+ } else {
840
+ resolve(result);
841
+ }
842
+ }, ms);
843
+ }));
844
+ case 1:
845
+ case "end":
846
+ return _context.stop();
847
+ }
848
+ }, _callee);
849
+ }));
850
+ }
337
851
 
338
852
  function deepFreeze(object) {
339
853
  Object.freeze(object);
@@ -387,16 +901,13 @@ function sequentialCallIdGenerator() {
387
901
  return count += 1;
388
902
  };
389
903
  }
390
- function debugFn(fnName, fn, logCall, logResult, generateCallId) {
391
- if (generateCallId === void 0) {
392
- generateCallId = generateDeterministicId;
393
- }
904
+ function debugFn(fnName, fn, logCall, logResult) {
905
+ var generateCallId = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : generateDeterministicId;
394
906
  return function () {
395
- var args = [];
396
- for (var _i = 0; _i < arguments.length; _i++) {
397
- args[_i] = arguments[_i];
907
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
908
+ args[_key] = arguments[_key];
398
909
  }
399
- var callId = generateCallId(__spreadArray([fnName, fn], args, true));
910
+ var callId = generateCallId([fnName, fn].concat(args));
400
911
  if (typeof logCall === 'function') {
401
912
  // Deep clone args, so that we may detect mutations later on
402
913
  logCall({
@@ -458,18 +969,19 @@ function _parsePathExpr(pathExpr) {
458
969
  * supported: loops, conditionals, etc.
459
970
  * @param {Object | Array} data Data context to be used for interpolation
460
971
  */
461
- function interpolate(template, data, _a) {
462
- var _b = _a === void 0 ? {} : _a,
463
- _c = _b.maxLength,
464
- maxLength = _c === void 0 ? 10000 : _c;
972
+ function interpolate(template, data) {
973
+ var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
974
+ _ref$maxLength = _ref.maxLength,
975
+ maxLength = _ref$maxLength === void 0 ? 10000 : _ref$maxLength;
465
976
  if (template.length > maxLength) {
466
977
  throw new Error("Template exceeds maxLength ".concat(maxLength));
467
978
  }
468
979
  data = _typeof(data) === 'object' ? data : [data];
469
980
  return template.replace(INTERPOLATION_REGEXP, function (_, pathExpr) {
470
- var _a = _parsePathExpr(pathExpr),
471
- path = _a[0],
472
- defaultValue = _a[1];
981
+ var _parsePathExpr2 = _parsePathExpr(pathExpr),
982
+ _parsePathExpr3 = _slicedToArray(_parsePathExpr2, 2),
983
+ path = _parsePathExpr3[0],
984
+ defaultValue = _parsePathExpr3[1];
473
985
  var value = lodashEs.get(data, path);
474
986
  switch (_typeof(value)) {
475
987
  case 'number':
@@ -494,19 +1006,19 @@ function interpolate(template, data, _a) {
494
1006
  }
495
1007
 
496
1008
  function maybeFn(input) {
497
- var args = [];
498
- for (var _i = 1; _i < arguments.length; _i++) {
499
- args[_i - 1] = arguments[_i];
1009
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1010
+ args[_key - 1] = arguments[_key];
500
1011
  }
501
1012
  return typeof input === 'function' ? input.apply(void 0, args) : input;
502
1013
  }
503
1014
 
504
1015
  function pickPaths(sourceObj, paths) {
505
1016
  return paths.reduce(function (acc, path) {
506
- var _a = Array.isArray(path) ? path : [path, path],
507
- targetPath = _a[0],
508
- resolver = _a[1],
509
- defaultValue = _a[2];
1017
+ var _ref = Array.isArray(path) ? path : [path, path],
1018
+ _ref2 = _slicedToArray(_ref, 3),
1019
+ targetPath = _ref2[0],
1020
+ resolver = _ref2[1],
1021
+ defaultValue = _ref2[2];
510
1022
  var value = typeof resolver === 'string' ? lodashEs.get(sourceObj, resolver) : resolver(sourceObj);
511
1023
  var valueAfterDefault = typeof value === 'undefined' ? defaultValue : value;
512
1024
  //
@@ -533,89 +1045,107 @@ var DEFAULT_OPTIONS = {
533
1045
  function _echo(input) {
534
1046
  return input;
535
1047
  }
536
- function resolveNestedPromises(node, options, ctx) {
537
- if (options === void 0) {
538
- options = {};
539
- }
540
- if (ctx === void 0) {
541
- ctx = {
542
- root: node,
543
- depth: 0
544
- };
545
- }
546
- return __awaiter(this, void 0, void 0, function () {
1048
+ function resolveNestedPromises(node) {
1049
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1050
+ var ctx = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
1051
+ root: node,
1052
+ depth: 0
1053
+ };
1054
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
547
1055
  var opts, promises, _cloneFn, clonedNode, resolved;
548
- return __generator(this, function (_a) {
549
- opts = _assign(_assign({}, DEFAULT_OPTIONS), options);
550
- promises = [];
551
- _cloneFn = opts.clone || _echo;
552
- clonedNode = _cloneFn(node);
553
- resolved = traverse(clonedNode).forEach(function (value) {
554
- var _this = this;
555
- var depth = ctx.depth + this.path.length;
556
- if (depth > opts.maxDepth) {
557
- throw new Error("Max depth exceeded: { depth: ".concat(depth, ", maxDepth: ").concat(opts.maxDepth, " }"));
558
- }
559
- if (value instanceof Promise) {
560
- var updatePromise = value.then(function (resolvedValue) {
561
- return __awaiter(_this, void 0, void 0, function () {
562
- var _a, _b;
563
- return __generator(this, function (_c) {
564
- switch (_c.label) {
565
- case 0:
566
- // Arrow function;
567
- // this refers to outside this ctx
568
- _a = this.update;
569
- if (!(opts.mode === 'eager')) return [3 /*break*/, 2];
570
- return [4 /*yield*/, resolveNestedPromises(resolvedValue, opts, _assign(_assign({}, ctx), {
571
- // pass the base depth of the current value
572
- depth: depth
573
- }))];
574
- case 1:
575
- _b = _c.sent();
576
- return [3 /*break*/, 3];
577
- case 2:
578
- _b = resolvedValue;
579
- _c.label = 3;
580
- case 3:
581
- // Arrow function;
582
- // this refers to outside this ctx
583
- _a.apply(this, [_b]);
584
- return [2 /*return*/];
585
- }
1056
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1057
+ while (1) switch (_context2.prev = _context2.next) {
1058
+ case 0:
1059
+ opts = Object.assign(Object.assign({}, DEFAULT_OPTIONS), options);
1060
+ promises = []; //
1061
+ // Allow consumers to provide a clone function.
1062
+ // There are multiple nuances regarding cloning. Here are some
1063
+ // we've faced:
1064
+ // - clone-deep (https://www.npmjs.com/package/clone-deep) does
1065
+ // creates new versions of symbols
1066
+ // - fast-copy (default export) does not clone array custom properties
1067
+ // (but allows for creating a copier function that does)
1068
+ //
1069
+ // It would be incorrect to use copyStrict (from fast-copy) by default, thus
1070
+ // we allow consumers to provide their copy functions
1071
+ //
1072
+ // If opts.clone is set to false, use the _echo function
1073
+ //
1074
+ _cloneFn = opts.clone || _echo;
1075
+ clonedNode = _cloneFn(node);
1076
+ resolved = traverse(clonedNode).forEach(function (value) {
1077
+ var _this = this;
1078
+ var depth = ctx.depth + this.path.length;
1079
+ if (depth > opts.maxDepth) {
1080
+ throw new Error("Max depth exceeded: { depth: ".concat(depth, ", maxDepth: ").concat(opts.maxDepth, " }"));
1081
+ }
1082
+ if (value instanceof Promise) {
1083
+ var updatePromise = value.then(function (resolvedValue) {
1084
+ return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1085
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1086
+ while (1) switch (_context.prev = _context.next) {
1087
+ case 0:
1088
+ _context.t0 = this;
1089
+ if (!(opts.mode === 'eager')) {
1090
+ _context.next = 7;
1091
+ break;
1092
+ }
1093
+ _context.next = 4;
1094
+ return resolveNestedPromises(resolvedValue, opts, Object.assign(Object.assign({}, ctx), {
1095
+ // pass the base depth of the current value
1096
+ depth: depth
1097
+ }));
1098
+ case 4:
1099
+ _context.t1 = _context.sent;
1100
+ _context.next = 8;
1101
+ break;
1102
+ case 7:
1103
+ _context.t1 = resolvedValue;
1104
+ case 8:
1105
+ _context.t2 = _context.t1;
1106
+ _context.t0.update.call(_context.t0, _context.t2);
1107
+ case 10:
1108
+ case "end":
1109
+ return _context.stop();
1110
+ }
1111
+ }, _callee, this);
1112
+ }));
586
1113
  });
587
- });
1114
+ promises = [].concat(_toConsumableArray(promises), [updatePromise]);
1115
+ }
588
1116
  });
589
- promises = __spreadArray(__spreadArray([], promises, true), [updatePromise], false);
590
- }
591
- });
592
- return [2 /*return*/, Promise.all(promises).then(function () {
593
- return resolved;
594
- })];
595
- });
596
- });
1117
+ return _context2.abrupt("return", Promise.all(promises).then(function () {
1118
+ return resolved;
1119
+ }));
1120
+ case 6:
1121
+ case "end":
1122
+ return _context2.stop();
1123
+ }
1124
+ }, _callee2);
1125
+ }));
597
1126
  }
598
1127
 
599
- var TimeoutError = /** @class */function (_super) {
600
- __extends(TimeoutError, _super);
1128
+ var TimeoutError = /*#__PURE__*/function (_Error) {
1129
+ _inherits(TimeoutError, _Error);
601
1130
  function TimeoutError(message) {
602
- var _this = _super.call(this, message) || this;
1131
+ var _this;
1132
+ _classCallCheck(this, TimeoutError);
1133
+ _this = _callSuper(this, TimeoutError, [message]);
603
1134
  _this.name = 'TimeoutError';
604
1135
  _this.code = 'ETIMEDOUT';
605
1136
  _this.timestamp = new Date();
606
1137
  // Maintain proper stack trace (only available in V8 engines, e.g., Chrome and Node.js)
607
1138
  if (Error.captureStackTrace) {
608
- Error.captureStackTrace(_this, TimeoutError);
1139
+ Error.captureStackTrace(_assertThisInitialized(_this), TimeoutError);
609
1140
  }
610
1141
  return _this;
611
1142
  }
612
- return TimeoutError;
613
- }(Error);
1143
+ return _createClass(TimeoutError);
1144
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
614
1145
  function withTimeout(fn, timeout) {
615
1146
  return function () {
616
- var args = [];
617
- for (var _i = 0; _i < arguments.length; _i++) {
618
- args[_i] = arguments[_i];
1147
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1148
+ args[_key] = arguments[_key];
619
1149
  }
620
1150
  return new Promise(function (resolve, reject) {
621
1151
  var timer = setTimeout(function () {
@@ -629,15 +1159,15 @@ function withTimeout(fn, timeout) {
629
1159
  }
630
1160
 
631
1161
  var SKIPPED = Symbol();
632
- function batchFn(itemFn, _a) {
633
- var _b = _a === void 0 ? {} : _a,
634
- _c = _b.batchSize,
635
- batchSize = _c === void 0 ? 10 : _c,
636
- skip = _b.skip,
637
- _d = _b.retry,
638
- retry = _d === void 0 ? false : _d,
639
- timeout = _b.timeout,
640
- rollback = _b.rollback;
1162
+ function batchFn(itemFn) {
1163
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
1164
+ _ref$batchSize = _ref.batchSize,
1165
+ batchSize = _ref$batchSize === void 0 ? 10 : _ref$batchSize,
1166
+ skip = _ref.skip,
1167
+ _ref$retry = _ref.retry,
1168
+ retry = _ref$retry === void 0 ? false : _ref$retry,
1169
+ timeout = _ref.timeout,
1170
+ rollback = _ref.rollback;
641
1171
  //
642
1172
  // Optionally wrap itemFn into timeout
643
1173
  //
@@ -649,11 +1179,11 @@ function batchFn(itemFn, _a) {
649
1179
  // const events = new EventEmitter<EventTypes>()
650
1180
  var progressCount = 0;
651
1181
  var resultsPromise = promiseReduce(batches, function (acc, batchItems, index) {
652
- return __awaiter(_this, void 0, void 0, function () {
1182
+ return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
1183
+ var _this2 = this;
653
1184
  var batch, batchResults;
654
- var _this = this;
655
- return __generator(this, function (_a) {
656
- switch (_a.label) {
1185
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1186
+ while (1) switch (_context2.prev = _context2.next) {
657
1187
  case 0:
658
1188
  batch = {
659
1189
  index: index,
@@ -662,40 +1192,49 @@ function batchFn(itemFn, _a) {
662
1192
  promise.emit('batchStart', {
663
1193
  batch: batch
664
1194
  });
665
- return [4 /*yield*/, Promise.all(batchItems.map(function (item) {
666
- return __awaiter(_this, void 0, void 0, function () {
667
- var itemSkip, itemResult, _a, err_1, rollbackErr_1;
668
- return __generator(this, function (_b) {
669
- switch (_b.label) {
1195
+ //
1196
+ // A batch items are executed in parallell
1197
+ //
1198
+ _context2.next = 4;
1199
+ return Promise.all(batchItems.map(function (item) {
1200
+ return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1201
+ var itemSkip, itemResult;
1202
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1203
+ while (1) switch (_context.prev = _context.next) {
670
1204
  case 0:
671
- _b.trys.push([0, 5,, 10]);
1205
+ _context.prev = 0;
672
1206
  promise.emit('itemStart', {
673
1207
  batch: batch,
674
1208
  item: item
675
1209
  });
676
- return [4 /*yield*/, typeof skip === 'function' && skip(item)];
677
- case 1:
678
- itemSkip = _b.sent();
1210
+ _context.next = 4;
1211
+ return typeof skip === 'function' && skip(item);
1212
+ case 4:
1213
+ itemSkip = _context.sent;
679
1214
  if (itemSkip) {
680
1215
  promise.emit('itemSkip', {
681
1216
  batch: batch,
682
1217
  item: item
683
1218
  });
684
1219
  }
685
- if (!itemSkip) return [3 /*break*/, 2];
686
- _a = SKIPPED;
687
- return [3 /*break*/, 4];
688
- case 2:
689
- return [4 /*yield*/, retry === true ? exponentialBackoff.backOff(function () {
1220
+ if (!itemSkip) {
1221
+ _context.next = 10;
1222
+ break;
1223
+ }
1224
+ _context.t0 = SKIPPED;
1225
+ _context.next = 13;
1226
+ break;
1227
+ case 10:
1228
+ _context.next = 12;
1229
+ return retry === true ? exponentialBackoff.backOff(function () {
690
1230
  return itemFn(item);
691
1231
  }) : _typeof(retry) === 'object' && retry !== null ? exponentialBackoff.backOff(function () {
692
1232
  return itemFn(item);
693
- }, retry) : itemFn(item)];
694
- case 3:
695
- _a = _b.sent();
696
- _b.label = 4;
697
- case 4:
698
- itemResult = _a;
1233
+ }, retry) : itemFn(item);
1234
+ case 12:
1235
+ _context.t0 = _context.sent;
1236
+ case 13:
1237
+ itemResult = _context.t0;
699
1238
  progressCount += 1;
700
1239
  promise.emit('progress', {
701
1240
  type: itemSkip ? 'skip' : 'data',
@@ -704,48 +1243,55 @@ function batchFn(itemFn, _a) {
704
1243
  item: item,
705
1244
  result: itemResult
706
1245
  });
707
- return [2 /*return*/, itemResult];
708
- case 5:
709
- err_1 = _b.sent();
1246
+ return _context.abrupt("return", itemResult);
1247
+ case 19:
1248
+ _context.prev = 19;
1249
+ _context.t1 = _context["catch"](0);
710
1250
  progressCount += 1;
711
1251
  promise.emit('progress', {
712
1252
  type: 'error',
713
1253
  batch: batch,
714
1254
  progress: progressCount / items.length,
715
1255
  item: item,
716
- result: err_1
1256
+ result: _context.t1
717
1257
  });
718
- if (!(typeof rollback === 'function')) return [3 /*break*/, 9];
719
- _b.label = 6;
720
- case 6:
721
- _b.trys.push([6, 8,, 9]);
722
- return [4 /*yield*/, rollback(item, err_1)];
723
- case 7:
724
- _b.sent();
725
- return [3 /*break*/, 9];
726
- case 8:
727
- rollbackErr_1 = _b.sent();
728
- console.error('Failure rolling back', rollbackErr_1);
729
- return [3 /*break*/, 9];
730
- case 9:
731
- return [2 /*return*/, err_1];
732
- case 10:
733
- return [2 /*return*/];
1258
+ if (!(typeof rollback === 'function')) {
1259
+ _context.next = 32;
1260
+ break;
1261
+ }
1262
+ _context.prev = 24;
1263
+ _context.next = 27;
1264
+ return rollback(item, _context.t1);
1265
+ case 27:
1266
+ _context.next = 32;
1267
+ break;
1268
+ case 29:
1269
+ _context.prev = 29;
1270
+ _context.t2 = _context["catch"](24);
1271
+ console.error('Failure rolling back', _context.t2);
1272
+ case 32:
1273
+ return _context.abrupt("return", _context.t1);
1274
+ case 33:
1275
+ case "end":
1276
+ return _context.stop();
734
1277
  }
735
- });
736
- });
737
- }))];
738
- case 1:
739
- batchResults = _a.sent();
1278
+ }, _callee, null, [[0, 19], [24, 29]]);
1279
+ }));
1280
+ }));
1281
+ case 4:
1282
+ batchResults = _context2.sent;
740
1283
  promise.emit('batchProgress', {
741
1284
  batch: batch,
742
1285
  progress: batch.index + 1 / batches.length,
743
1286
  results: batchResults
744
1287
  });
745
- return [2 /*return*/, __spreadArray(__spreadArray([], acc, true), batchResults, true)];
1288
+ return _context2.abrupt("return", [].concat(_toConsumableArray(acc), _toConsumableArray(batchResults)));
1289
+ case 7:
1290
+ case "end":
1291
+ return _context2.stop();
746
1292
  }
747
- });
748
- });
1293
+ }, _callee2);
1294
+ }));
749
1295
  }, []);
750
1296
  resultsPromise.then(function (results) {
751
1297
  promise.resolve(results);
@@ -762,16 +1308,16 @@ function batchFn(itemFn, _a) {
762
1308
  function parseBatchedResults(inputs, results) {
763
1309
  return results.reduce(function (acc, result, index) {
764
1310
  if (result === SKIPPED) {
765
- return _assign(_assign({}, acc), {
766
- skipped: __spreadArray(__spreadArray([], acc.skipped, true), [inputs[index]], false)
1311
+ return Object.assign(Object.assign({}, acc), {
1312
+ skipped: [].concat(_toConsumableArray(acc.skipped), [inputs[index]])
767
1313
  });
768
1314
  } else if (result instanceof Error) {
769
- return _assign(_assign({}, acc), {
770
- errors: __spreadArray(__spreadArray([], acc.errors, true), [result], false)
1315
+ return Object.assign(Object.assign({}, acc), {
1316
+ errors: [].concat(_toConsumableArray(acc.errors), [result])
771
1317
  });
772
1318
  } else {
773
- return _assign(_assign({}, acc), {
774
- results: __spreadArray(__spreadArray([], acc.results, true), [result], false)
1319
+ return Object.assign(Object.assign({}, acc), {
1320
+ results: [].concat(_toConsumableArray(acc.results), [result])
775
1321
  });
776
1322
  }
777
1323
  }, {
@@ -838,24 +1384,27 @@ function hasNestedPromises(input) {
838
1384
  }
839
1385
  function _makeDefaultAsyncExpFn(syncFn) {
840
1386
  return function defaultAsyncExpFn() {
841
- var args = [];
842
- for (var _i = 0; _i < arguments.length; _i++) {
843
- args[_i] = arguments[_i];
1387
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1388
+ args[_key] = arguments[_key];
844
1389
  }
845
- return __awaiter(this, void 0, void 0, function () {
1390
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
846
1391
  var resolvedArgs;
847
- return __generator(this, function (_a) {
848
- switch (_a.label) {
1392
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1393
+ while (1) switch (_context.prev = _context.next) {
849
1394
  case 0:
850
- return [4 /*yield*/, Promise.all(args.map(function (arg) {
1395
+ _context.next = 2;
1396
+ return Promise.all(args.map(function (arg) {
851
1397
  return resolveNestedPromises(arg);
852
- }))];
853
- case 1:
854
- resolvedArgs = _a.sent();
855
- return [2 /*return*/, syncFn.apply(void 0, resolvedArgs)];
1398
+ }));
1399
+ case 2:
1400
+ resolvedArgs = _context.sent;
1401
+ return _context.abrupt("return", syncFn.apply(void 0, _toConsumableArray(resolvedArgs)));
1402
+ case 4:
1403
+ case "end":
1404
+ return _context.stop();
856
1405
  }
857
- });
858
- });
1406
+ }, _callee);
1407
+ }));
859
1408
  };
860
1409
  }
861
1410
  function _defaultArgsContainPromises(args) {
@@ -874,44 +1423,15 @@ function _defaultArgsContainPromises(args) {
874
1423
  * in the inputs and executes sync or async versions
875
1424
  * accordingly
876
1425
  */
877
- function maybeAsyncFn(_a) {
878
- var syncFn = _a.syncFn,
879
- _b = _a.asyncFn,
880
- asyncFn = _b === void 0 ? _makeDefaultAsyncExpFn(syncFn) : _b,
881
- //
882
- // By default, argsContainPromises checks
883
- // if the any of the arguments provided are
884
- // themselves a promise or if they have a nested promise
885
- //
886
- // Allow the argsContainPromises to be configurable.
887
- // This allows for more specialized checks that
888
- // would perform better, some examples:
889
- // - If the first argument includes a promise
890
- // - If some deeply nested argument is set
891
- // to a value that will incur in the need
892
- // for async resolution, even if the input arg
893
- // itself is not a promise
894
- //
895
- _c = _a.argsContainPromises,
896
- //
897
- // By default, argsContainPromises checks
898
- // if the any of the arguments provided are
899
- // themselves a promise or if they have a nested promise
900
- //
901
- // Allow the argsContainPromises to be configurable.
902
- // This allows for more specialized checks that
903
- // would perform better, some examples:
904
- // - If the first argument includes a promise
905
- // - If some deeply nested argument is set
906
- // to a value that will incur in the need
907
- // for async resolution, even if the input arg
908
- // itself is not a promise
909
- //
910
- argsContainPromises = _c === void 0 ? _defaultArgsContainPromises : _c;
1426
+ function maybeAsyncFn(_ref) {
1427
+ var syncFn = _ref.syncFn,
1428
+ _ref$asyncFn = _ref.asyncFn,
1429
+ asyncFn = _ref$asyncFn === void 0 ? _makeDefaultAsyncExpFn(syncFn) : _ref$asyncFn,
1430
+ _ref$argsContainPromi = _ref.argsContainPromises,
1431
+ argsContainPromises = _ref$argsContainPromi === void 0 ? _defaultArgsContainPromises : _ref$argsContainPromi;
911
1432
  return function () {
912
- var args = [];
913
- for (var _i = 0; _i < arguments.length; _i++) {
914
- args[_i] = arguments[_i];
1433
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1434
+ args[_key2] = arguments[_key2];
915
1435
  }
916
1436
  return argsContainPromises(args) ? asyncFn.apply(void 0, args) : syncFn.apply(void 0, args);
917
1437
  };
@@ -935,9 +1455,9 @@ function untilConditionIsSatisfiedReducer(condition, reduce) {
935
1455
  //
936
1456
  var syncResult = reduce(acc, value, index, allValues);
937
1457
  if (isPromise(syncResult)) {
938
- var remainingValues_1 = allValues.slice(index + 1);
1458
+ var remainingValues = allValues.slice(index + 1);
939
1459
  return syncResult.then(function (asyncResult) {
940
- return condition(asyncResult) ? asyncResult : remainingValues_1.reduce(reducer, asyncResult);
1460
+ return condition(asyncResult) ? asyncResult : remainingValues.reduce(reducer, asyncResult);
941
1461
  });
942
1462
  } else {
943
1463
  return syncResult;
@@ -951,10 +1471,23 @@ function maybeReturnPromise(result, parseResult) {
951
1471
  }
952
1472
 
953
1473
  function syntheticJson(str) {
1474
+ var maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10000;
1475
+ // Step 0: Reject overly long input early to prevent
1476
+ // any possible vulnerability with ReDoS
1477
+ if (str.length > maxLength) {
1478
+ throw new Error('Input too large');
1479
+ }
954
1480
  // Step 1: Replace single quotes with double quotes
955
1481
  var normalized = str.replace(/'/g, '"');
956
- // Step 2: Add quotes around unquoted keys (letters, digits, underscores)
957
- normalized = normalized.replace(/([a-zA-Z0-9_]+)\s*:/g, '"$1":');
1482
+ // Step 2: Add quotes around unquoted keys with limited whitespace,
1483
+ // only if followed by
1484
+ // - double-quoted string (")
1485
+ // - positive or negative number (-?\d)
1486
+ // - start of object ({)
1487
+ // - start of array ([)
1488
+ // - null
1489
+ // - true or false
1490
+ normalized = normalized.replace(/([a-zA-Z0-9_]+)\s{0,5}:\s{0,5}(?=("|-?\d|\{|\[|null|true|false))/g, '"$1":');
958
1491
  // Step 3: Parse as JSON
959
1492
  try {
960
1493
  return JSON.parse(normalized);
@@ -980,15 +1513,16 @@ function _jsonLikeParseArgs(argsStr) {
980
1513
  function escapeRegExp(str) {
981
1514
  return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
982
1515
  }
983
- function strExpr(_a) {
984
- var expressions = _a.expressions,
985
- _b = _a.pipe,
986
- pipe = _b === void 0 ? '|' : _b,
987
- _c = _a.parseArgs,
988
- parseArgs = _c === void 0 ? _jsonLikeParseArgs : _c;
989
- var _d = Array.isArray(expressions) ? [expressions, null] : [Object.keys(expressions), expressions],
990
- expressionIds = _d[0],
991
- expressionFns = _d[1];
1516
+ function strExpr(_ref) {
1517
+ var expressions = _ref.expressions,
1518
+ _ref$pipe = _ref.pipe,
1519
+ pipe = _ref$pipe === void 0 ? '|' : _ref$pipe,
1520
+ _ref$parseArgs = _ref.parseArgs,
1521
+ parseArgs = _ref$parseArgs === void 0 ? _jsonLikeParseArgs : _ref$parseArgs;
1522
+ var _ref2 = Array.isArray(expressions) ? [expressions, null] : [Object.keys(expressions), expressions],
1523
+ _ref3 = _slicedToArray(_ref2, 2),
1524
+ expressionIds = _ref3[0],
1525
+ expressionFns = _ref3[1];
992
1526
  if (expressionIds.length === 0) {
993
1527
  throw new Error('No expressions provided');
994
1528
  }
@@ -1099,11 +1633,10 @@ function switchValue(input, cases) {
1099
1633
  }
1100
1634
  }
1101
1635
  function switchExec(input, cases) {
1102
- var args = [];
1103
- for (var _i = 2; _i < arguments.length; _i++) {
1104
- args[_i - 2] = arguments[_i];
1105
- }
1106
1636
  var fn = switchValue(input, cases);
1637
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1638
+ args[_key - 2] = arguments[_key];
1639
+ }
1107
1640
  return fn.apply(void 0, args);
1108
1641
  }
1109
1642
 
@@ -1184,26 +1717,31 @@ var typeOf = makeTypeOf(DEFAULT_TYPES);
1184
1717
  function defaultParseResponse(response) {
1185
1718
  return response.json();
1186
1719
  }
1187
- function paginatedHttpFetch(_a) {
1188
- var pageUrl = _a.pageUrl,
1189
- _b = _a.parseResponse,
1190
- parseResponse = _b === void 0 ? defaultParseResponse : _b;
1720
+ function paginatedHttpFetch(_ref) {
1721
+ var pageUrl = _ref.pageUrl,
1722
+ _ref$parseResponse = _ref.parseResponse,
1723
+ parseResponse = _ref$parseResponse === void 0 ? defaultParseResponse : _ref$parseResponse;
1191
1724
  return function (params) {
1192
- return __awaiter(this, void 0, void 0, function () {
1725
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1193
1726
  var response, data;
1194
- return __generator(this, function (_a) {
1195
- switch (_a.label) {
1727
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1728
+ while (1) switch (_context.prev = _context.next) {
1196
1729
  case 0:
1197
- return [4 /*yield*/, fetch(pageUrl(params))];
1198
- case 1:
1199
- response = _a.sent();
1200
- return [4 /*yield*/, parseResponse(response)];
1730
+ _context.next = 2;
1731
+ return fetch(pageUrl(params));
1201
1732
  case 2:
1202
- data = _a.sent();
1203
- return [2 /*return*/, data];
1733
+ response = _context.sent;
1734
+ _context.next = 5;
1735
+ return parseResponse(response);
1736
+ case 5:
1737
+ data = _context.sent;
1738
+ return _context.abrupt("return", data);
1739
+ case 7:
1740
+ case "end":
1741
+ return _context.stop();
1204
1742
  }
1205
- });
1206
- });
1743
+ }, _callee);
1744
+ }));
1207
1745
  };
1208
1746
  }
1209
1747
  function inMemoryDataStore() {
@@ -1213,68 +1751,69 @@ function inMemoryDataStore() {
1213
1751
  return data.length;
1214
1752
  },
1215
1753
  storePage: function storePage(pageData) {
1216
- data = __spreadArray(__spreadArray([], data, true), pageData, true);
1754
+ data = [].concat(_toConsumableArray(data), _toConsumableArray(pageData));
1217
1755
  },
1218
1756
  getResult: function getResult() {
1219
1757
  return data;
1220
1758
  }
1221
1759
  };
1222
1760
  }
1223
- function fetchAllPages(_a) {
1224
- var fetchPage = _a.fetchPage,
1225
- _b = _a.pageSize,
1226
- pageSize = _b === void 0 ? 50 : _b,
1227
- _c = _a.dataStore,
1228
- dataStore = _c === void 0 ? inMemoryDataStore : _c;
1229
- return __awaiter(this, void 0, void 0, function () {
1761
+ function fetchAllPages(_ref2) {
1762
+ var fetchPage = _ref2.fetchPage,
1763
+ _ref2$pageSize = _ref2.pageSize,
1764
+ pageSize = _ref2$pageSize === void 0 ? 50 : _ref2$pageSize,
1765
+ _ref2$dataStore = _ref2.dataStore,
1766
+ dataStore = _ref2$dataStore === void 0 ? inMemoryDataStore : _ref2$dataStore;
1767
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
1230
1768
  var store, currentPageData, currentOffset, result;
1231
- return __generator(this, function (_d) {
1232
- switch (_d.label) {
1769
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1770
+ while (1) switch (_context2.prev = _context2.next) {
1233
1771
  case 0:
1234
1772
  store = dataStore();
1235
1773
  currentPageData = null;
1236
- _d.label = 1;
1237
- case 1:
1238
- return [4 /*yield*/, store.getSize()];
1239
1774
  case 2:
1240
- currentOffset = _d.sent();
1241
- return [4 /*yield*/, fetchPage({
1775
+ _context2.next = 4;
1776
+ return store.getSize();
1777
+ case 4:
1778
+ currentOffset = _context2.sent;
1779
+ _context2.next = 7;
1780
+ return fetchPage({
1242
1781
  offset: currentOffset,
1243
1782
  pageSize: pageSize
1244
- })];
1245
- case 3:
1246
- currentPageData = _d.sent();
1247
- return [4 /*yield*/, store.storePage(currentPageData, {
1783
+ });
1784
+ case 7:
1785
+ currentPageData = _context2.sent;
1786
+ _context2.next = 10;
1787
+ return store.storePage(currentPageData, {
1248
1788
  offset: currentOffset,
1249
1789
  pageSize: pageSize
1250
- })];
1251
- case 4:
1252
- _d.sent();
1253
- _d.label = 5;
1254
- case 5:
1255
- if (currentPageData.length === pageSize) return [3 /*break*/, 1];
1256
- _d.label = 6;
1257
- case 6:
1258
- return [4 /*yield*/, store.getResult()];
1259
- case 7:
1260
- result = _d.sent();
1261
- return [2 /*return*/, result];
1790
+ });
1791
+ case 10:
1792
+ if (currentPageData.length === pageSize) {
1793
+ _context2.next = 2;
1794
+ break;
1795
+ }
1796
+ case 11:
1797
+ _context2.next = 13;
1798
+ return store.getResult();
1799
+ case 13:
1800
+ result = _context2.sent;
1801
+ return _context2.abrupt("return", result);
1802
+ case 15:
1803
+ case "end":
1804
+ return _context2.stop();
1262
1805
  }
1263
- });
1264
- });
1806
+ }, _callee2);
1807
+ }));
1265
1808
  }
1266
1809
 
1267
1810
  function deprecateFn(fn, message) {
1268
1811
  // Creating a new function that wraps the original function
1269
1812
  var wrappedFunction = function wrappedFunction() {
1270
- var args = [];
1271
- for (var _i = 0; _i < arguments.length; _i++) {
1272
- args[_i] = arguments[_i];
1273
- }
1274
1813
  if (process.env.NODE_ENV !== 'production') {
1275
1814
  console.warn(["[deprecated][fn] ".concat(fn.name, " is deprecated"), message].filter(Boolean).join(': '));
1276
1815
  }
1277
- return fn.apply(void 0, args);
1816
+ return fn.apply(void 0, arguments);
1278
1817
  };
1279
1818
  // Copying the original function's properties to the new function
1280
1819
  Object.assign(wrappedFunction, fn);
@@ -1309,10 +1848,8 @@ function deprecateInput(inputValue, message, convert) {
1309
1848
  }
1310
1849
  }
1311
1850
 
1312
- function slugify(str, delimiter) {
1313
- if (delimiter === void 0) {
1314
- delimiter = '-';
1315
- }
1851
+ function slugify(str) {
1852
+ var delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '-';
1316
1853
  // Escape the delimiter for safe use in regex
1317
1854
  var safeDelimiter = delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
1318
1855
  var CONSECUTIVE_DELIMITER_RE = new RegExp("".concat(safeDelimiter, "+"), 'g');
@@ -1327,77 +1864,95 @@ function slugify(str, delimiter) {
1327
1864
  }
1328
1865
  var normalizeString = deprecateFn(slugify, 'normalizeString is depreacted, use @orioro/util -> slugify instead');
1329
1866
 
1330
- //
1331
- // Hook module
1332
- //
1333
- function hookFn(fn, _a) {
1334
- var input = _a.input,
1335
- validate = _a.validate,
1336
- before = _a.before,
1337
- output = _a.output,
1338
- after = _a.after;
1867
+ function hookFn(fn, _ref) {
1868
+ var input = _ref.input,
1869
+ validate = _ref.validate,
1870
+ before = _ref.before,
1871
+ output = _ref.output,
1872
+ after = _ref.after;
1339
1873
  return function () {
1340
- var args = [];
1341
- for (var _i = 0; _i < arguments.length; _i++) {
1342
- args[_i] = arguments[_i];
1874
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1875
+ args[_key] = arguments[_key];
1343
1876
  }
1344
- return __awaiter(this, void 0, void 0, function () {
1345
- var _input, _a, validationResult, error, rawResult, result, _b;
1346
- return __generator(this, function (_c) {
1347
- switch (_c.label) {
1877
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1878
+ var _input, validationResult, error, rawResult, result;
1879
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1880
+ while (1) switch (_context.prev = _context.next) {
1348
1881
  case 0:
1349
- if (!(typeof input === 'function')) return [3 /*break*/, 2];
1350
- return [4 /*yield*/, input.apply(void 0, args)];
1351
- case 1:
1352
- _a = _c.sent();
1353
- return [3 /*break*/, 3];
1354
- case 2:
1355
- _a = args;
1356
- _c.label = 3;
1357
- case 3:
1358
- _input = _a;
1359
- if (!Array.isArray(_input)) {
1360
- throw new TypeError('Input hook must resolve an array of args');
1882
+ if (!(typeof input === 'function')) {
1883
+ _context.next = 6;
1884
+ break;
1361
1885
  }
1362
- if (!(typeof validate === 'function')) return [3 /*break*/, 5];
1363
- return [4 /*yield*/, validate.apply(void 0, _input)];
1364
- case 4:
1365
- validationResult = _c.sent();
1366
- if (validationResult !== true) {
1367
- error = typeof validationResult === 'string' ? new Error(validationResult) : validationResult instanceof Error ? validationResult : new Error('Invalid input');
1368
- throw error;
1369
- }
1370
- _c.label = 5;
1371
- case 5:
1372
- if (!(typeof before === 'function')) return [3 /*break*/, 7];
1373
- return [4 /*yield*/, before.apply(void 0, _input)];
1886
+ _context.next = 3;
1887
+ return input.apply(void 0, args);
1888
+ case 3:
1889
+ _context.t0 = _context.sent;
1890
+ _context.next = 7;
1891
+ break;
1374
1892
  case 6:
1375
- _c.sent();
1376
- _c.label = 7;
1893
+ _context.t0 = args;
1377
1894
  case 7:
1378
- return [4 /*yield*/, fn.apply(void 0, _input)];
1379
- case 8:
1380
- rawResult = _c.sent();
1381
- if (!(typeof output === 'function')) return [3 /*break*/, 10];
1382
- return [4 /*yield*/, output(rawResult)];
1383
- case 9:
1384
- _b = _c.sent();
1385
- return [3 /*break*/, 11];
1895
+ _input = _context.t0;
1896
+ if (Array.isArray(_input)) {
1897
+ _context.next = 10;
1898
+ break;
1899
+ }
1900
+ throw new TypeError('Input hook must resolve an array of args');
1386
1901
  case 10:
1387
- _b = rawResult;
1388
- _c.label = 11;
1389
- case 11:
1390
- result = _b;
1391
- if (!(typeof after === 'function')) return [3 /*break*/, 13];
1392
- return [4 /*yield*/, after.apply(void 0, __spreadArray([result], _input, false))];
1393
- case 12:
1394
- _c.sent();
1395
- _c.label = 13;
1902
+ if (!(typeof validate === 'function')) {
1903
+ _context.next = 17;
1904
+ break;
1905
+ }
1906
+ _context.next = 13;
1907
+ return validate.apply(void 0, _toConsumableArray(_input));
1396
1908
  case 13:
1397
- return [2 /*return*/, result];
1909
+ validationResult = _context.sent;
1910
+ if (!(validationResult !== true)) {
1911
+ _context.next = 17;
1912
+ break;
1913
+ }
1914
+ error = typeof validationResult === 'string' ? new Error(validationResult) : validationResult instanceof Error ? validationResult : new Error('Invalid input');
1915
+ throw error;
1916
+ case 17:
1917
+ if (!(typeof before === 'function')) {
1918
+ _context.next = 20;
1919
+ break;
1920
+ }
1921
+ _context.next = 20;
1922
+ return before.apply(void 0, _toConsumableArray(_input));
1923
+ case 20:
1924
+ _context.next = 22;
1925
+ return fn.apply(void 0, _toConsumableArray(_input));
1926
+ case 22:
1927
+ rawResult = _context.sent;
1928
+ if (!(typeof output === 'function')) {
1929
+ _context.next = 29;
1930
+ break;
1931
+ }
1932
+ _context.next = 26;
1933
+ return output(rawResult);
1934
+ case 26:
1935
+ _context.t1 = _context.sent;
1936
+ _context.next = 30;
1937
+ break;
1938
+ case 29:
1939
+ _context.t1 = rawResult;
1940
+ case 30:
1941
+ result = _context.t1;
1942
+ if (!(typeof after === 'function')) {
1943
+ _context.next = 34;
1944
+ break;
1945
+ }
1946
+ _context.next = 34;
1947
+ return after.apply(void 0, [result].concat(_toConsumableArray(_input)));
1948
+ case 34:
1949
+ return _context.abrupt("return", result);
1950
+ case 35:
1951
+ case "end":
1952
+ return _context.stop();
1398
1953
  }
1399
- });
1400
- });
1954
+ }, _callee);
1955
+ }));
1401
1956
  };
1402
1957
  }
1403
1958
 
@@ -1451,22 +2006,22 @@ function url(spec) {
1451
2006
  if (typeof spec === 'string') {
1452
2007
  return new URL(spec).href;
1453
2008
  } else {
1454
- var url_1 = new URL(_baseHref(spec));
1455
- if (spec.protocol) url_1.protocol = spec.protocol;
1456
- if (spec.username) url_1.username = spec.username;
1457
- if (spec.password) url_1.password = spec.password;
1458
- if (spec.host) url_1.host = spec.host;
1459
- if (spec.hostname) url_1.hostname = spec.hostname;
1460
- if (spec.port) url_1.port = spec.port;
1461
- if (spec.pathname) url_1.pathname = spec.pathname;
1462
- if (spec.search) url_1.search = spec.search;
2009
+ var _url = new URL(_baseHref(spec));
2010
+ if (spec.protocol) _url.protocol = spec.protocol;
2011
+ if (spec.username) _url.username = spec.username;
2012
+ if (spec.password) _url.password = spec.password;
2013
+ if (spec.host) _url.host = spec.host;
2014
+ if (spec.hostname) _url.hostname = spec.hostname;
2015
+ if (spec.port) _url.port = spec.port;
2016
+ if (spec.pathname) _url.pathname = spec.pathname;
2017
+ if (spec.search) _url.search = spec.search;
1463
2018
  // Handle searchParams
1464
2019
  if (spec.searchParams) {
1465
2020
  var searchString = Array.isArray(spec.searchParams) ? queryString.stringify(spec.searchParams[0], spec.searchParams[1]) : queryString.stringify(spec.searchParams);
1466
- url_1.search = searchString;
2021
+ _url.search = searchString;
1467
2022
  }
1468
- if (spec.hash) url_1.hash = spec.hash;
1469
- return url_1.href;
2023
+ if (spec.hash) _url.hash = spec.hash;
2024
+ return _url.href;
1470
2025
  }
1471
2026
  }
1472
2027
 
@@ -1475,6 +2030,7 @@ exports.PromiseLikeEventEmitter = PromiseLikeEventEmitter;
1475
2030
  exports.SKIPPED = SKIPPED;
1476
2031
  exports.TimeoutError = TimeoutError;
1477
2032
  exports.arrayChunk = arrayChunk;
2033
+ exports.arrayLikeIterable = arrayLikeIterable;
1478
2034
  exports.batchFn = batchFn;
1479
2035
  exports.dataJoin = dataJoin;
1480
2036
  exports.debugFn = debugFn;