@orioro/util 0.12.0 → 0.13.1

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