bmlt-query-client 1.4.2 → 1.5.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/CHANGELOG.md +7 -0
- package/README.md +21 -0
- package/dist/app.d.ts +41 -0
- package/dist/app.js +271 -259
- package/dist/app.js.map +1 -1
- package/package.json +15 -15
package/dist/app.js
CHANGED
|
@@ -5,10 +5,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
5
5
|
enumerable: !(s = n(i, d)) || s.enumerable
|
|
6
6
|
});
|
|
7
7
|
return e;
|
|
8
|
-
}, c = (n, r,
|
|
8
|
+
}, c = (n, r, o) => (o = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule || !a.call(n, "default") ? t(o, "default", {
|
|
9
9
|
value: n,
|
|
10
10
|
enumerable: !0
|
|
11
|
-
}) :
|
|
11
|
+
}) : o, n)), l = Object.prototype.toString, u = (e) => l.call(e) === "[object Error]", d = /* @__PURE__ */ new Set([
|
|
12
12
|
"network error",
|
|
13
13
|
"NetworkError when attempting to fetch resource.",
|
|
14
14
|
"The Internet connection appears to be offline.",
|
|
@@ -29,6 +29,7 @@ function p(e) {
|
|
|
29
29
|
if (typeof e == "number") {
|
|
30
30
|
if (e < 0) throw TypeError("Expected `retries` to be a non-negative number.");
|
|
31
31
|
if (Number.isNaN(e)) throw TypeError("Expected `retries` to be a valid number or Infinity, got NaN.");
|
|
32
|
+
if (Number.isFinite(e) && !Number.isInteger(e)) throw TypeError("Expected `retries` to be a non-negative integer or Infinity.");
|
|
32
33
|
} else if (e !== void 0) throw TypeError("Expected `retries` to be a number or Infinity.");
|
|
33
34
|
}
|
|
34
35
|
function m(e, t, { min: n = 0, allowInfinity: r = !1 } = {}) {
|
|
@@ -50,10 +51,10 @@ function ne(e, t) {
|
|
|
50
51
|
let n = Math.max(1, e + 1), r = t.randomize ? Math.random() + 1 : 1, i = Math.round(r * t.minTimeout * t.factor ** (n - 1));
|
|
51
52
|
return i = Math.min(i, t.maxTimeout), i;
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function re(e, t) {
|
|
54
55
|
return Number.isFinite(t) ? t - (performance.now() - e) : t;
|
|
55
56
|
}
|
|
56
|
-
async function
|
|
57
|
+
async function ie(e, t) {
|
|
57
58
|
e <= 0 || await new Promise((n, r) => {
|
|
58
59
|
let i = () => {
|
|
59
60
|
clearTimeout(a), t.signal?.removeEventListener("abort", i), r(t.signal.reason);
|
|
@@ -63,11 +64,11 @@ async function re(e, t) {
|
|
|
63
64
|
t.unref && a.unref?.(), t.signal?.addEventListener("abort", i, { once: !0 });
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
|
-
async function
|
|
67
|
+
async function ae({ error: e, attemptNumber: t, retriesConsumed: n, startTime: r, options: i }) {
|
|
67
68
|
let a = e instanceof Error ? e : /* @__PURE__ */ TypeError(`Non-error was thrown: "${e}". You should only throw errors.`);
|
|
68
69
|
if (a instanceof te) throw a.originalError;
|
|
69
70
|
let o = Number.isFinite(i.retries) ? Math.max(0, i.retries - n) : i.retries, s = i.maxRetryTime ?? Infinity, c = ne(n, i);
|
|
70
|
-
if (
|
|
71
|
+
if (re(r, s) <= 0) {
|
|
71
72
|
let e = Object.freeze({
|
|
72
73
|
error: a,
|
|
73
74
|
attemptNumber: t,
|
|
@@ -90,14 +91,14 @@ async function ie({ error: e, attemptNumber: t, retriesConsumed: n, startTime: r
|
|
|
90
91
|
retriesConsumed: n,
|
|
91
92
|
retryDelay: d
|
|
92
93
|
});
|
|
93
|
-
if (await i.onFailedAttempt(p),
|
|
94
|
-
let m =
|
|
94
|
+
if (await i.onFailedAttempt(p), re(r, s) <= 0 || re(r, s) <= 0 || o <= 0 || a instanceof TypeError && !f(a) || !await i.shouldRetry(p)) throw a;
|
|
95
|
+
let m = re(r, s);
|
|
95
96
|
if (m <= 0) throw a;
|
|
96
97
|
if (!u) return i.signal?.throwIfAborted(), !1;
|
|
97
98
|
let ee = Math.min(d, m);
|
|
98
|
-
return i.signal?.throwIfAborted(), await
|
|
99
|
+
return i.signal?.throwIfAborted(), await ie(ee, i), i.signal?.throwIfAborted(), !0;
|
|
99
100
|
}
|
|
100
|
-
async function
|
|
101
|
+
async function oe(e, t = {}) {
|
|
101
102
|
var n, r, i, a, o, s, c, l, u;
|
|
102
103
|
if (t = { ...t }, p(t.retries), Object.hasOwn(t, "forever")) throw Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");
|
|
103
104
|
(n = t).retries ?? (n.retries = 10), (r = t).factor ?? (r.factor = 2), (i = t).minTimeout ?? (i.minTimeout = 1e3), (a = t).maxTimeout ?? (a.maxTimeout = Infinity), (o = t).maxRetryTime ?? (o.maxRetryTime = Infinity), (s = t).randomize ?? (s.randomize = !1), (c = t).onFailedAttempt ?? (c.onFailedAttempt = () => {}), (l = t).shouldRetry ?? (l.shouldRetry = () => !0), (u = t).shouldConsumeRetry ?? (u.shouldConsumeRetry = () => !0), ee("onFailedAttempt", t.onFailedAttempt), ee("shouldRetry", t.shouldRetry), ee("shouldConsumeRetry", t.shouldConsumeRetry), m("factor", t.factor, {
|
|
@@ -121,7 +122,7 @@ async function ae(e, t = {}) {
|
|
|
121
122
|
let n = await e(d);
|
|
122
123
|
return t.signal?.throwIfAborted(), n;
|
|
123
124
|
} catch (e) {
|
|
124
|
-
await
|
|
125
|
+
await ae({
|
|
125
126
|
error: e,
|
|
126
127
|
attemptNumber: d,
|
|
127
128
|
retriesConsumed: f,
|
|
@@ -134,7 +135,7 @@ async function ae(e, t = {}) {
|
|
|
134
135
|
}
|
|
135
136
|
//#endregion
|
|
136
137
|
//#region node_modules/eventemitter3/index.mjs
|
|
137
|
-
var
|
|
138
|
+
var se = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
138
139
|
var n = Object.prototype.hasOwnProperty, r = "~";
|
|
139
140
|
function i() {}
|
|
140
141
|
Object.create && (i.prototype = Object.create(null), new i().__proto__ || (r = !1));
|
|
@@ -223,37 +224,37 @@ var oe = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
|
223
224
|
}, c.prototype.off = c.prototype.removeListener, c.prototype.addListener = c.prototype.on, c.prefixed = r, c.EventEmitter = c, t !== void 0 && (t.exports = c);
|
|
224
225
|
})))(), 1);
|
|
225
226
|
//#endregion
|
|
226
|
-
//#region \0@oxc-project+runtime@0.
|
|
227
|
-
function
|
|
227
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
|
|
228
|
+
function h(e) {
|
|
228
229
|
"@babel/helpers - typeof";
|
|
229
|
-
return
|
|
230
|
+
return h = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
230
231
|
return typeof e;
|
|
231
232
|
} : function(e) {
|
|
232
233
|
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
233
|
-
},
|
|
234
|
+
}, h(e);
|
|
234
235
|
}
|
|
235
236
|
//#endregion
|
|
236
|
-
//#region \0@oxc-project+runtime@0.
|
|
237
|
-
function
|
|
238
|
-
if (
|
|
237
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
|
|
238
|
+
function ce(e, t) {
|
|
239
|
+
if (h(e) != "object" || !e) return e;
|
|
239
240
|
var n = e[Symbol.toPrimitive];
|
|
240
241
|
if (n !== void 0) {
|
|
241
242
|
var r = n.call(e, t || "default");
|
|
242
|
-
if (
|
|
243
|
+
if (h(r) != "object") return r;
|
|
243
244
|
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
244
245
|
}
|
|
245
246
|
return (t === "string" ? String : Number)(e);
|
|
246
247
|
}
|
|
247
248
|
//#endregion
|
|
248
|
-
//#region \0@oxc-project+runtime@0.
|
|
249
|
-
function
|
|
250
|
-
var t =
|
|
251
|
-
return
|
|
249
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
|
|
250
|
+
function le(e) {
|
|
251
|
+
var t = ce(e, "string");
|
|
252
|
+
return h(t) == "symbol" ? t : t + "";
|
|
252
253
|
}
|
|
253
254
|
//#endregion
|
|
254
|
-
//#region \0@oxc-project+runtime@0.
|
|
255
|
-
function
|
|
256
|
-
return (t =
|
|
255
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
|
|
256
|
+
function g(e, t, n) {
|
|
257
|
+
return (t = le(t)) in e ? Object.defineProperty(e, t, {
|
|
257
258
|
value: n,
|
|
258
259
|
enumerable: !0,
|
|
259
260
|
configurable: !0,
|
|
@@ -262,25 +263,25 @@ function _(e, t, n) {
|
|
|
262
263
|
}
|
|
263
264
|
//#endregion
|
|
264
265
|
//#region node_modules/p-timeout/index.js
|
|
265
|
-
var
|
|
266
|
+
var ue = class e extends Error {
|
|
266
267
|
constructor(t, n) {
|
|
267
|
-
super(t, n),
|
|
268
|
+
super(t, n), g(this, "name", "TimeoutError"), Error.captureStackTrace?.(this, e);
|
|
268
269
|
}
|
|
269
|
-
},
|
|
270
|
-
function
|
|
270
|
+
}, de = (e) => e.reason ?? new DOMException("This operation was aborted.", "AbortError");
|
|
271
|
+
function fe(e, t) {
|
|
271
272
|
let { milliseconds: n, fallback: r, message: i, customTimers: a = {
|
|
272
273
|
setTimeout,
|
|
273
274
|
clearTimeout
|
|
274
275
|
}, signal: o } = t, s, c, l = new Promise((t, l) => {
|
|
275
276
|
if (typeof n != "number" || Math.sign(n) !== 1) throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);
|
|
276
277
|
if (o?.aborted) {
|
|
277
|
-
l(
|
|
278
|
+
l(de(o)), e.then(t, l);
|
|
278
279
|
return;
|
|
279
280
|
}
|
|
280
281
|
if (o && (c = () => {
|
|
281
|
-
l(
|
|
282
|
+
l(de(o));
|
|
282
283
|
}, o.addEventListener("abort", c, { once: !0 })), e.then(t, l), n === Infinity) return;
|
|
283
|
-
let u = new
|
|
284
|
+
let u = new ue();
|
|
284
285
|
s = a.setTimeout.call(void 0, () => {
|
|
285
286
|
if (r) {
|
|
286
287
|
try {
|
|
@@ -301,7 +302,7 @@ function de(e, t) {
|
|
|
301
302
|
}
|
|
302
303
|
//#endregion
|
|
303
304
|
//#region node_modules/p-queue/dist/lower-bound.js
|
|
304
|
-
function
|
|
305
|
+
function pe(e, t, n) {
|
|
305
306
|
let r = 0, i = e.length;
|
|
306
307
|
for (; i > 0;) {
|
|
307
308
|
let a = Math.trunc(i / 2), o = r + a;
|
|
@@ -310,41 +311,41 @@ function fe(e, t, n) {
|
|
|
310
311
|
return r;
|
|
311
312
|
}
|
|
312
313
|
//#endregion
|
|
313
|
-
//#region \0@oxc-project+runtime@0.
|
|
314
|
-
function
|
|
314
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/checkPrivateRedeclaration.js
|
|
315
|
+
function me(e, t) {
|
|
315
316
|
if (t.has(e)) throw TypeError("Cannot initialize the same private elements twice on an object");
|
|
316
317
|
}
|
|
317
318
|
//#endregion
|
|
318
|
-
//#region \0@oxc-project+runtime@0.
|
|
319
|
-
function
|
|
320
|
-
|
|
319
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/classPrivateMethodInitSpec.js
|
|
320
|
+
function he(e, t) {
|
|
321
|
+
me(e, t), t.add(e);
|
|
321
322
|
}
|
|
322
323
|
//#endregion
|
|
323
|
-
//#region \0@oxc-project+runtime@0.
|
|
324
|
-
function
|
|
325
|
-
|
|
324
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/classPrivateFieldInitSpec.js
|
|
325
|
+
function _(e, t, n) {
|
|
326
|
+
me(e, t), t.set(e, n);
|
|
326
327
|
}
|
|
327
328
|
//#endregion
|
|
328
|
-
//#region \0@oxc-project+runtime@0.
|
|
329
|
-
function
|
|
329
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/assertClassBrand.js
|
|
330
|
+
function v(e, t, n) {
|
|
330
331
|
if (typeof e == "function" ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
331
332
|
throw TypeError("Private element is not present on this object");
|
|
332
333
|
}
|
|
333
334
|
//#endregion
|
|
334
|
-
//#region \0@oxc-project+runtime@0.
|
|
335
|
-
function
|
|
336
|
-
return e.get(
|
|
335
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/classPrivateFieldGet2.js
|
|
336
|
+
function y(e, t) {
|
|
337
|
+
return e.get(v(e, t));
|
|
337
338
|
}
|
|
338
339
|
//#endregion
|
|
339
|
-
//#region \0@oxc-project+runtime@0.
|
|
340
|
-
function
|
|
341
|
-
return e.set(
|
|
340
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/classPrivateFieldSet2.js
|
|
341
|
+
function b(e, t, n) {
|
|
342
|
+
return e.set(v(e, t), n), n;
|
|
342
343
|
}
|
|
343
344
|
//#endregion
|
|
344
345
|
//#region node_modules/p-queue/dist/priority-queue.js
|
|
345
|
-
var
|
|
346
|
+
var ge = 100, x = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), _e = /* @__PURE__ */ new WeakSet(), ve = class {
|
|
346
347
|
constructor() {
|
|
347
|
-
|
|
348
|
+
he(this, _e), _(this, x, []), _(this, S, 0);
|
|
348
349
|
}
|
|
349
350
|
enqueue(e, t) {
|
|
350
351
|
let { priority: n = 0, id: r } = t ?? {}, { size: i } = this, a = {
|
|
@@ -353,92 +354,93 @@ var he = 100, S = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap
|
|
|
353
354
|
run: e
|
|
354
355
|
};
|
|
355
356
|
if (i === 0) {
|
|
356
|
-
|
|
357
|
+
y(x, this).length = 0, b(S, this, 0), y(x, this).push(a);
|
|
357
358
|
return;
|
|
358
359
|
}
|
|
359
|
-
if (
|
|
360
|
-
|
|
360
|
+
if (y(x, this).at(-1).priority >= n) {
|
|
361
|
+
y(x, this).push(a);
|
|
361
362
|
return;
|
|
362
363
|
}
|
|
363
|
-
|
|
364
|
-
let o =
|
|
365
|
-
|
|
364
|
+
v(_e, this, ye).call(this);
|
|
365
|
+
let o = pe(y(x, this), a, (e, t) => t.priority - e.priority);
|
|
366
|
+
y(x, this).splice(o, 0, a);
|
|
366
367
|
}
|
|
367
368
|
setPriority(e, t) {
|
|
368
|
-
let n =
|
|
369
|
+
let n = y(x, this).findIndex((t, n) => n >= y(S, this) && t.id === e);
|
|
369
370
|
if (n === -1) throw ReferenceError(`No promise function with the id "${e}" exists in the queue.`);
|
|
370
|
-
let [r] =
|
|
371
|
+
let [r] = y(x, this).splice(n, 1);
|
|
371
372
|
this.enqueue(r.run, {
|
|
372
373
|
priority: t,
|
|
373
374
|
id: e
|
|
374
375
|
});
|
|
375
376
|
}
|
|
376
377
|
remove(e) {
|
|
377
|
-
let t =
|
|
378
|
-
t !== -1 &&
|
|
378
|
+
let t = y(x, this).findIndex((t, n) => n < y(S, this) ? !1 : typeof e == "string" ? t.id === e : t.run === e);
|
|
379
|
+
t !== -1 && y(x, this).splice(t, 1);
|
|
379
380
|
}
|
|
380
381
|
dequeue() {
|
|
381
382
|
var e;
|
|
382
|
-
if (
|
|
383
|
-
let t =
|
|
384
|
-
return
|
|
383
|
+
if (y(S, this) === y(x, this).length) return;
|
|
384
|
+
let t = y(x, this)[y(S, this)];
|
|
385
|
+
return b(S, this, (e = y(S, this), e++, e)), y(S, this) === y(x, this).length ? (y(x, this).length = 0, b(S, this, 0)) : y(S, this) > ge && y(S, this) > y(x, this).length / 2 && v(_e, this, ye).call(this), t?.run;
|
|
385
386
|
}
|
|
386
387
|
filter(e) {
|
|
387
388
|
let t = [];
|
|
388
|
-
for (let n =
|
|
389
|
-
let r =
|
|
389
|
+
for (let n = y(S, this); n < y(x, this).length; n++) {
|
|
390
|
+
let r = y(x, this)[n];
|
|
390
391
|
r.priority === e.priority && t.push(r.run);
|
|
391
392
|
}
|
|
392
393
|
return t;
|
|
393
394
|
}
|
|
394
395
|
get size() {
|
|
395
|
-
return
|
|
396
|
+
return y(x, this).length - y(S, this);
|
|
396
397
|
}
|
|
397
398
|
};
|
|
398
|
-
function
|
|
399
|
-
|
|
399
|
+
function ye() {
|
|
400
|
+
y(S, this) !== 0 && (y(x, this).splice(0, y(S, this)), b(S, this, 0));
|
|
400
401
|
}
|
|
401
402
|
//#endregion
|
|
402
403
|
//#region node_modules/p-queue/dist/index.js
|
|
403
|
-
var
|
|
404
|
+
var C = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), be = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakSet(), Se = class extends se.default {
|
|
404
405
|
constructor(e) {
|
|
405
|
-
if (super(),
|
|
406
|
+
if (super(), he(this, H), _(this, C, void 0), _(this, w, void 0), _(this, T, 0), _(this, E, void 0), _(this, D, !1), _(this, O, !1), _(this, k, void 0), _(this, A, 0), _(this, j, void 0), _(this, M, void 0), _(this, N, void 0), _(this, P, []), _(this, F, 0), _(this, I, void 0), _(this, be, void 0), _(this, L, 0), _(this, R, void 0), _(this, z, void 0), _(this, xe, 1n), _(this, B, /* @__PURE__ */ new Map()), _(this, V, /* @__PURE__ */ new Set()), g(this, "timeout", void 0), e = {
|
|
406
407
|
carryoverIntervalCount: !1,
|
|
407
408
|
intervalCap: Infinity,
|
|
408
409
|
interval: 0,
|
|
409
410
|
concurrency: Infinity,
|
|
410
411
|
autoStart: !0,
|
|
411
|
-
queueClass:
|
|
412
|
+
queueClass: ve,
|
|
412
413
|
strict: !1,
|
|
413
414
|
...e
|
|
414
415
|
}, !(typeof e.intervalCap == "number" && e.intervalCap >= 1)) throw TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString() ?? ""}\` (${typeof e.intervalCap})`);
|
|
415
416
|
if (e.interval === void 0 || !(Number.isFinite(e.interval) && e.interval >= 0)) throw TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString() ?? ""}\` (${typeof e.interval})`);
|
|
416
417
|
if (e.strict && e.interval === 0) throw TypeError("The `strict` option requires a non-zero `interval`");
|
|
417
418
|
if (e.strict && e.intervalCap === Infinity) throw TypeError("The `strict` option requires a finite `intervalCap`");
|
|
418
|
-
if (
|
|
419
|
-
this.timeout = e.timeout,
|
|
419
|
+
if (b(C, this, e.carryoverIntervalCount ?? e.carryoverConcurrencyCount ?? !1), b(w, this, e.intervalCap === Infinity || e.interval === 0), b(E, this, e.intervalCap), b(k, this, e.interval), b(N, this, e.strict), b(I, this, new e.queueClass()), b(be, this, e.queueClass), this.concurrency = e.concurrency, e.timeout !== void 0 && !(Number.isFinite(e.timeout) && e.timeout > 0)) throw TypeError(`Expected \`timeout\` to be a positive finite number, got \`${e.timeout}\` (${typeof e.timeout})`);
|
|
420
|
+
this.timeout = e.timeout, b(z, this, e.autoStart === !1), v(H, this, ze).call(this);
|
|
420
421
|
}
|
|
421
422
|
get concurrency() {
|
|
422
|
-
return
|
|
423
|
+
return y(R, this);
|
|
423
424
|
}
|
|
424
425
|
set concurrency(e) {
|
|
425
426
|
if (!(typeof e == "number" && e >= 1)) throw TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);
|
|
426
|
-
|
|
427
|
+
b(R, this, e), v(H, this, Re).call(this);
|
|
427
428
|
}
|
|
428
429
|
setPriority(e, t) {
|
|
429
430
|
if (typeof t != "number" || !Number.isFinite(t)) throw TypeError(`Expected \`priority\` to be a finite number, got \`${t}\` (${typeof t})`);
|
|
430
|
-
|
|
431
|
+
y(I, this).setPriority(e, t);
|
|
431
432
|
}
|
|
432
433
|
async add(e, t = {}) {
|
|
433
434
|
var n, r;
|
|
434
|
-
|
|
435
|
+
if (t = {
|
|
435
436
|
timeout: this.timeout,
|
|
436
437
|
...t,
|
|
437
|
-
id: t.id ?? (
|
|
438
|
-
},
|
|
438
|
+
id: t.id ?? (b(xe, this, (n = y(xe, this), r = n++, n)), r).toString()
|
|
439
|
+
}, t.timeout !== void 0 && !(Number.isFinite(t.timeout) && t.timeout > 0)) throw TypeError(`Expected \`timeout\` to be a positive finite number, got \`${t.timeout}\` (${typeof t.timeout})`);
|
|
440
|
+
return new Promise((n, r) => {
|
|
439
441
|
let i = Symbol(`task-${t.id}`), a = () => void 0, o = async () => {
|
|
440
442
|
var o;
|
|
441
|
-
a(),
|
|
443
|
+
a(), b(L, this, (o = y(L, this), o++, o)), y(B, this).set(i, {
|
|
442
444
|
id: t.id,
|
|
443
445
|
priority: t.priority ?? 0,
|
|
444
446
|
startTime: Date.now(),
|
|
@@ -449,13 +451,12 @@ var ye = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), T = /
|
|
|
449
451
|
try {
|
|
450
452
|
t.signal?.throwIfAborted();
|
|
451
453
|
} catch (e) {
|
|
452
|
-
throw
|
|
454
|
+
throw v(H, this, Be).call(this), y(B, this).delete(i), e;
|
|
453
455
|
}
|
|
454
|
-
x(A, this, Date.now());
|
|
455
456
|
let r = e({ signal: t.signal });
|
|
456
|
-
if (t.timeout && (r =
|
|
457
|
+
if (t.timeout !== void 0 && (r = fe(Promise.resolve(r), {
|
|
457
458
|
milliseconds: t.timeout,
|
|
458
|
-
message: `Task timed out after ${t.timeout}ms (queue has ${
|
|
459
|
+
message: `Task timed out after ${t.timeout}ms (queue has ${y(L, this)} running, ${y(I, this).size} waiting)`
|
|
459
460
|
})), t.signal) {
|
|
460
461
|
let { signal: e } = t;
|
|
461
462
|
r = Promise.race([r, new Promise((t, n) => {
|
|
@@ -469,64 +470,64 @@ var ye = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), T = /
|
|
|
469
470
|
} catch (e) {
|
|
470
471
|
r(e), this.emit("error", e);
|
|
471
472
|
} finally {
|
|
472
|
-
s && t.signal?.removeEventListener("abort", s),
|
|
473
|
-
|
|
473
|
+
s && t.signal?.removeEventListener("abort", s), y(B, this).delete(i), queueMicrotask(() => {
|
|
474
|
+
v(H, this, ke).call(this);
|
|
474
475
|
});
|
|
475
476
|
}
|
|
476
477
|
};
|
|
477
|
-
|
|
478
|
+
y(I, this).enqueue(o, t);
|
|
478
479
|
let s = () => {
|
|
479
|
-
if (
|
|
480
|
-
|
|
480
|
+
if (y(I, this) instanceof ve) {
|
|
481
|
+
y(I, this).remove(o);
|
|
481
482
|
return;
|
|
482
483
|
}
|
|
483
|
-
|
|
484
|
+
y(I, this).remove?.(t.id);
|
|
484
485
|
};
|
|
485
486
|
if (t.signal) {
|
|
486
487
|
let { signal: e } = t, n = () => {
|
|
487
|
-
a(), s(), r(e.reason),
|
|
488
|
+
a(), s(), r(e.reason), v(H, this, Fe).call(this), this.emit("next");
|
|
488
489
|
};
|
|
489
490
|
if (a = () => {
|
|
490
|
-
e.removeEventListener("abort", n),
|
|
491
|
+
e.removeEventListener("abort", n), y(V, this).delete(a);
|
|
491
492
|
}, e.aborted) {
|
|
492
493
|
n();
|
|
493
494
|
return;
|
|
494
495
|
}
|
|
495
|
-
e.addEventListener("abort", n, { once: !0 }),
|
|
496
|
+
e.addEventListener("abort", n, { once: !0 }), y(V, this).add(a);
|
|
496
497
|
}
|
|
497
|
-
this.emit("add"),
|
|
498
|
+
this.emit("add"), v(H, this, Fe).call(this);
|
|
498
499
|
});
|
|
499
500
|
}
|
|
500
501
|
async addAll(e, t) {
|
|
501
502
|
return Promise.all(e.map(async (e) => this.add(e, t)));
|
|
502
503
|
}
|
|
503
504
|
start() {
|
|
504
|
-
return
|
|
505
|
+
return y(z, this) ? (b(z, this, !1), v(H, this, Re).call(this), this) : this;
|
|
505
506
|
}
|
|
506
507
|
pause() {
|
|
507
|
-
|
|
508
|
+
b(z, this, !0);
|
|
508
509
|
}
|
|
509
510
|
clear() {
|
|
510
|
-
for (let e of
|
|
511
|
-
|
|
511
|
+
for (let e of y(V, this)) e();
|
|
512
|
+
b(I, this, new (y(be, this))()), v(H, this, Ne).call(this), v(H, this, Ve).call(this), this.emit("empty"), y(L, this) === 0 && (v(H, this, Pe).call(this), this.emit("idle")), this.emit("next");
|
|
512
513
|
}
|
|
513
514
|
async onEmpty() {
|
|
514
|
-
|
|
515
|
+
y(I, this).size !== 0 && await v(H, this, U).call(this, "empty");
|
|
515
516
|
}
|
|
516
517
|
async onSizeLessThan(e) {
|
|
517
|
-
|
|
518
|
+
y(I, this).size < e || await v(H, this, U).call(this, ["next", "active"], () => y(I, this).size < e);
|
|
518
519
|
}
|
|
519
520
|
async onIdle() {
|
|
520
|
-
|
|
521
|
+
(y(L, this) !== 0 || y(I, this).size !== 0) && await v(H, this, U).call(this, "idle");
|
|
521
522
|
}
|
|
522
523
|
async onPendingZero() {
|
|
523
|
-
|
|
524
|
+
y(L, this) !== 0 && await v(H, this, U).call(this, "pendingZero");
|
|
524
525
|
}
|
|
525
526
|
async onRateLimit() {
|
|
526
|
-
this.isRateLimited || await
|
|
527
|
+
this.isRateLimited || await v(H, this, U).call(this, "rateLimit");
|
|
527
528
|
}
|
|
528
529
|
async onRateLimitCleared() {
|
|
529
|
-
this.isRateLimited && await
|
|
530
|
+
this.isRateLimited && await v(H, this, U).call(this, "rateLimitCleared");
|
|
530
531
|
}
|
|
531
532
|
onError() {
|
|
532
533
|
return new Promise((e, t) => {
|
|
@@ -537,177 +538,176 @@ var ye = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), T = /
|
|
|
537
538
|
});
|
|
538
539
|
}
|
|
539
540
|
get size() {
|
|
540
|
-
return
|
|
541
|
+
return y(I, this).size;
|
|
541
542
|
}
|
|
542
543
|
sizeBy(e) {
|
|
543
|
-
return
|
|
544
|
+
return y(I, this).filter(e).length;
|
|
544
545
|
}
|
|
545
546
|
get pending() {
|
|
546
|
-
return
|
|
547
|
+
return y(L, this);
|
|
547
548
|
}
|
|
548
549
|
get isPaused() {
|
|
549
|
-
return
|
|
550
|
+
return y(z, this);
|
|
550
551
|
}
|
|
551
552
|
get isRateLimited() {
|
|
552
|
-
return
|
|
553
|
+
return y(D, this);
|
|
553
554
|
}
|
|
554
555
|
get isSaturated() {
|
|
555
|
-
return
|
|
556
|
+
return y(L, this) === y(R, this) && y(I, this).size > 0 || this.isRateLimited && y(I, this).size > 0;
|
|
556
557
|
}
|
|
557
558
|
get runningTasks() {
|
|
558
|
-
return [...
|
|
559
|
+
return [...y(B, this).values()].map((e) => ({
|
|
559
560
|
...e,
|
|
560
561
|
timeoutRemaining: e.timeout ? Math.max(0, e.startTime + e.timeout - Date.now()) : void 0
|
|
561
562
|
}));
|
|
562
563
|
}
|
|
563
564
|
};
|
|
564
|
-
function
|
|
565
|
-
for (;
|
|
566
|
-
let n =
|
|
567
|
-
if (n !== void 0 && e - n >=
|
|
565
|
+
function Ce(e) {
|
|
566
|
+
for (; y(F, this) < y(P, this).length;) {
|
|
567
|
+
let n = y(P, this)[y(F, this)];
|
|
568
|
+
if (n !== void 0 && e - n >= y(k, this)) {
|
|
568
569
|
var t;
|
|
569
|
-
|
|
570
|
+
b(F, this, (t = y(F, this), t++, t));
|
|
570
571
|
} else break;
|
|
571
572
|
}
|
|
572
|
-
(
|
|
573
|
+
(y(F, this) > 100 && y(F, this) > y(P, this).length / 2 || y(F, this) === y(P, this).length) && (b(P, this, y(P, this).slice(y(F, this))), b(F, this, 0));
|
|
573
574
|
}
|
|
574
|
-
function
|
|
575
|
-
if (
|
|
575
|
+
function we(e) {
|
|
576
|
+
if (y(N, this)) y(P, this).push(e);
|
|
576
577
|
else {
|
|
577
578
|
var t;
|
|
578
|
-
|
|
579
|
+
b(T, this, (t = y(T, this), t++, t));
|
|
579
580
|
}
|
|
580
581
|
}
|
|
581
|
-
function
|
|
582
|
-
if (
|
|
583
|
-
else if (
|
|
582
|
+
function Te() {
|
|
583
|
+
if (y(N, this)) y(P, this).length > y(F, this) && y(P, this).pop();
|
|
584
|
+
else if (y(T, this) > 0) {
|
|
584
585
|
var e;
|
|
585
|
-
|
|
586
|
+
b(T, this, (e = y(T, this), e--, e));
|
|
586
587
|
}
|
|
587
588
|
}
|
|
589
|
+
function Ee() {
|
|
590
|
+
return y(P, this).length - y(F, this);
|
|
591
|
+
}
|
|
588
592
|
function De() {
|
|
589
|
-
return
|
|
593
|
+
return y(w, this) ? !0 : y(N, this) ? v(H, this, Ee).call(this) < y(E, this) : y(T, this) < y(E, this);
|
|
590
594
|
}
|
|
591
595
|
function Oe() {
|
|
592
|
-
return
|
|
596
|
+
return y(L, this) < y(R, this);
|
|
593
597
|
}
|
|
594
598
|
function ke() {
|
|
595
|
-
return b(L, this) < b(R, this);
|
|
596
|
-
}
|
|
597
|
-
function Ae() {
|
|
598
599
|
var e;
|
|
599
|
-
|
|
600
|
+
b(L, this, (e = y(L, this), e--, e)), y(L, this) === 0 && this.emit("pendingZero"), v(H, this, Fe).call(this), this.emit("next");
|
|
600
601
|
}
|
|
601
|
-
function
|
|
602
|
-
|
|
602
|
+
function Ae() {
|
|
603
|
+
b(M, this, void 0), v(H, this, Le).call(this), v(H, this, Ie).call(this);
|
|
603
604
|
}
|
|
604
|
-
function
|
|
605
|
-
if (
|
|
606
|
-
if (
|
|
607
|
-
let t =
|
|
608
|
-
return
|
|
605
|
+
function je(e) {
|
|
606
|
+
if (y(N, this)) {
|
|
607
|
+
if (v(H, this, Ce).call(this, e), v(H, this, Ee).call(this) >= y(E, this)) {
|
|
608
|
+
let t = y(P, this)[y(F, this)], n = y(k, this) - (e - t);
|
|
609
|
+
return v(H, this, Me).call(this, n), !0;
|
|
609
610
|
}
|
|
610
611
|
return !1;
|
|
611
612
|
}
|
|
612
|
-
if (
|
|
613
|
-
let t =
|
|
614
|
-
if (t < 0)
|
|
615
|
-
|
|
616
|
-
let t = e - b(A, this);
|
|
617
|
-
if (t < b(k, this)) return y(H, this, Ne).call(this, b(k, this) - t), !0;
|
|
618
|
-
}
|
|
619
|
-
x(T, this, b(ye, this) ? b(L, this) : 0);
|
|
620
|
-
} else return y(H, this, Ne).call(this, t), !0;
|
|
613
|
+
if (y(j, this) === void 0) {
|
|
614
|
+
let t = y(A, this) - e;
|
|
615
|
+
if (t < 0) b(T, this, y(C, this) ? y(L, this) : 0);
|
|
616
|
+
else return v(H, this, Me).call(this, t), !0;
|
|
621
617
|
}
|
|
622
618
|
return !1;
|
|
623
619
|
}
|
|
624
|
-
function
|
|
625
|
-
|
|
626
|
-
|
|
620
|
+
function Me(e) {
|
|
621
|
+
y(M, this) === void 0 && b(M, this, setTimeout(() => {
|
|
622
|
+
v(H, this, Ae).call(this);
|
|
627
623
|
}, e));
|
|
628
624
|
}
|
|
625
|
+
function Ne() {
|
|
626
|
+
y(j, this) && (clearInterval(y(j, this)), b(j, this, void 0));
|
|
627
|
+
}
|
|
629
628
|
function Pe() {
|
|
630
|
-
|
|
629
|
+
y(M, this) && (clearTimeout(y(M, this)), b(M, this, void 0));
|
|
631
630
|
}
|
|
632
631
|
function Fe() {
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
if (b(I, this).size === 0) {
|
|
637
|
-
if (y(H, this, Pe).call(this), this.emit("empty"), b(L, this) === 0) {
|
|
638
|
-
if (y(H, this, Fe).call(this), b(N, this) && b(F, this) > 0) {
|
|
632
|
+
if (y(I, this).size === 0) {
|
|
633
|
+
if (v(H, this, Ne).call(this), this.emit("empty"), y(L, this) === 0) {
|
|
634
|
+
if (v(H, this, Pe).call(this), y(N, this) && y(F, this) > 0) {
|
|
639
635
|
let e = Date.now();
|
|
640
|
-
|
|
636
|
+
v(H, this, Ce).call(this, e);
|
|
641
637
|
}
|
|
642
638
|
this.emit("idle");
|
|
643
639
|
}
|
|
644
640
|
return !1;
|
|
645
641
|
}
|
|
646
642
|
let e = !1;
|
|
647
|
-
if (!
|
|
648
|
-
let t = Date.now(), n = !
|
|
649
|
-
if (
|
|
650
|
-
let r =
|
|
651
|
-
|
|
643
|
+
if (!y(z, this)) {
|
|
644
|
+
let t = Date.now(), n = !v(H, this, je).call(this, t);
|
|
645
|
+
if (De.call(v(H, this)) && Oe.call(v(H, this))) {
|
|
646
|
+
let r = y(I, this).dequeue();
|
|
647
|
+
y(w, this) || (v(H, this, we).call(this, t), v(H, this, W).call(this)), n && v(H, this, Ie).call(this), this.emit("active"), r(), e = !0;
|
|
652
648
|
}
|
|
653
649
|
}
|
|
654
650
|
return e;
|
|
655
651
|
}
|
|
652
|
+
function Ie() {
|
|
653
|
+
y(w, this) || y(j, this) !== void 0 || y(N, this) || (b(j, this, setInterval(() => {
|
|
654
|
+
v(H, this, Le).call(this);
|
|
655
|
+
}, y(k, this))), b(A, this, Date.now() + y(k, this)));
|
|
656
|
+
}
|
|
656
657
|
function Le() {
|
|
657
|
-
|
|
658
|
-
y(H, this, Re).call(this);
|
|
659
|
-
}, b(k, this))), x(be, this, Date.now() + b(k, this)));
|
|
658
|
+
y(N, this) || (y(j, this) !== void 0 && (y(T, this) === 0 && y(L, this) === 0 ? v(H, this, Ne).call(this) : b(A, this, Date.now() + y(k, this))), b(T, this, y(C, this) ? y(L, this) : 0)), v(H, this, Re).call(this), v(H, this, W).call(this);
|
|
660
659
|
}
|
|
661
660
|
function Re() {
|
|
662
|
-
|
|
663
|
-
}
|
|
664
|
-
function ze() {
|
|
665
|
-
for (; y(H, this, Ie).call(this););
|
|
661
|
+
for (; v(H, this, Fe).call(this););
|
|
666
662
|
}
|
|
667
663
|
async function U(e, t) {
|
|
668
|
-
|
|
664
|
+
let n = Array.isArray(e) ? e : [e];
|
|
665
|
+
return new Promise((e) => {
|
|
669
666
|
let r = () => {
|
|
670
|
-
|
|
667
|
+
if (!t || t()) {
|
|
668
|
+
for (let e of n) this.off(e, r);
|
|
669
|
+
e();
|
|
670
|
+
}
|
|
671
671
|
};
|
|
672
|
-
this.on(e, r);
|
|
672
|
+
for (let e of n) this.on(e, r);
|
|
673
673
|
});
|
|
674
674
|
}
|
|
675
|
-
function
|
|
676
|
-
|
|
677
|
-
|
|
675
|
+
function ze() {
|
|
676
|
+
y(w, this) || (this.on("add", () => {
|
|
677
|
+
y(I, this).size > 0 && v(H, this, W).call(this);
|
|
678
678
|
}), this.on("next", () => {
|
|
679
|
-
|
|
679
|
+
v(H, this, W).call(this);
|
|
680
680
|
}));
|
|
681
681
|
}
|
|
682
682
|
function W() {
|
|
683
|
-
|
|
684
|
-
|
|
683
|
+
y(w, this) || y(O, this) || (b(O, this, !0), queueMicrotask(() => {
|
|
684
|
+
b(O, this, !1), v(H, this, Ve).call(this);
|
|
685
685
|
}));
|
|
686
686
|
}
|
|
687
|
-
function
|
|
688
|
-
|
|
687
|
+
function Be() {
|
|
688
|
+
y(w, this) || (v(H, this, Te).call(this), v(H, this, W).call(this));
|
|
689
689
|
}
|
|
690
|
-
function
|
|
691
|
-
let e =
|
|
692
|
-
if (
|
|
693
|
-
e && (
|
|
690
|
+
function Ve() {
|
|
691
|
+
let e = y(D, this);
|
|
692
|
+
if (y(w, this) || y(I, this).size === 0) {
|
|
693
|
+
e && (b(D, this, !1), this.emit("rateLimitCleared"));
|
|
694
694
|
return;
|
|
695
695
|
}
|
|
696
696
|
let t;
|
|
697
|
-
if (
|
|
697
|
+
if (y(N, this)) {
|
|
698
698
|
let e = Date.now();
|
|
699
|
-
|
|
700
|
-
} else t =
|
|
701
|
-
let n = t >=
|
|
702
|
-
n !== e && (
|
|
699
|
+
v(H, this, Ce).call(this, e), t = v(H, this, Ee).call(this);
|
|
700
|
+
} else t = y(T, this);
|
|
701
|
+
let n = t >= y(E, this);
|
|
702
|
+
n !== e && (b(D, this, n), this.emit(n ? "rateLimit" : "rateLimitCleared"));
|
|
703
703
|
}
|
|
704
704
|
//#endregion
|
|
705
705
|
//#region src/utils/errors.ts
|
|
706
|
-
var
|
|
706
|
+
var He = /* @__PURE__ */ function(e) {
|
|
707
707
|
return e.API_ERROR = "ApiError", e.NETWORK_ERROR = "NetworkError", e.VALIDATION_ERROR = "ValidationError", e.GEOCODING_ERROR = "GeocodingError", e.RATE_LIMIT_ERROR = "RateLimitError", e.TIMEOUT_ERROR = "TimeoutError", e.AUTHENTICATION_ERROR = "AuthenticationError", e.SERVER_ERROR = "ServerError", e.CLIENT_ERROR = "ClientError", e.CONFIGURATION_ERROR = "ConfigurationError", e;
|
|
708
708
|
}({}), G = class e extends Error {
|
|
709
709
|
constructor(t, n, r = {}) {
|
|
710
|
-
super(n),
|
|
710
|
+
super(n), g(this, "type", void 0), g(this, "statusCode", void 0), g(this, "response", void 0), g(this, "originalError", void 0), g(this, "context", void 0), this.name = "BmltQueryError", this.type = t, this.statusCode = r.statusCode, this.response = r.response, this.originalError = r.originalError, this.context = r.context, Object.setPrototypeOf(this, e.prototype);
|
|
711
711
|
}
|
|
712
712
|
isType(e) {
|
|
713
713
|
return this.type === e;
|
|
@@ -789,7 +789,7 @@ var Ue = /* @__PURE__ */ function(e) {
|
|
|
789
789
|
static createConfigurationError(e, t) {
|
|
790
790
|
return new G("ConfigurationError", e, { context: t });
|
|
791
791
|
}
|
|
792
|
-
},
|
|
792
|
+
}, Ue = class e {
|
|
793
793
|
static handleFetchError(e, t) {
|
|
794
794
|
if (e instanceof Error && e.name === "AbortError") return K.createTimeoutError("Request timeout", e);
|
|
795
795
|
if (e instanceof TypeError) return K.createNetworkError("Network connection failed", e);
|
|
@@ -845,22 +845,22 @@ var Ue = /* @__PURE__ */ function(e) {
|
|
|
845
845
|
}
|
|
846
846
|
}) : K.createApiError(r, void 0, void 0, e);
|
|
847
847
|
}
|
|
848
|
-
},
|
|
848
|
+
}, We = class {
|
|
849
849
|
static async withRetry(e, t) {
|
|
850
850
|
let { maxRetries: n, baseDelay: r, maxDelay: i, factor: a, onRetry: o } = t, s;
|
|
851
851
|
for (let t = 0; t <= n; t++) try {
|
|
852
852
|
return await e();
|
|
853
853
|
} catch (e) {
|
|
854
|
-
let c = e instanceof G ? e :
|
|
854
|
+
let c = e instanceof G ? e : Ue.wrapError(e, "Operation failed");
|
|
855
855
|
if (s = c, t === n || !c.isRetryable()) throw c;
|
|
856
856
|
let l = Math.min(r * a ** +t, i);
|
|
857
857
|
o && o(c, t + 1), await new Promise((e) => setTimeout(e, l));
|
|
858
858
|
}
|
|
859
859
|
throw s;
|
|
860
860
|
}
|
|
861
|
-
},
|
|
861
|
+
}, Ge = class {
|
|
862
862
|
constructor(e = {}) {
|
|
863
|
-
|
|
863
|
+
g(this, "baseURL", void 0), g(this, "queue", void 0), g(this, "defaultOptions", void 0);
|
|
864
864
|
let { retryCount: t = 3, timeout: n = 1e4, userAgent: r = "bmlt-query-client/1.0.0", countryCode: i = "us", viewbox: a, bounded: o = !1, intervalCap: s = 1, interval: c = 1e3, concurrency: l = 1, carryoverConcurrencyCount: u = !1, ...d } = e;
|
|
865
865
|
this.defaultOptions = {
|
|
866
866
|
retryCount: t,
|
|
@@ -869,7 +869,7 @@ var Ue = /* @__PURE__ */ function(e) {
|
|
|
869
869
|
countryCode: i,
|
|
870
870
|
viewbox: a,
|
|
871
871
|
bounded: o
|
|
872
|
-
}, this.baseURL = "https://nominatim.openstreetmap.org", this.queue = new
|
|
872
|
+
}, this.baseURL = "https://nominatim.openstreetmap.org", this.queue = new Se({
|
|
873
873
|
intervalCap: s,
|
|
874
874
|
interval: c,
|
|
875
875
|
concurrency: l,
|
|
@@ -915,7 +915,7 @@ var Ue = /* @__PURE__ */ function(e) {
|
|
|
915
915
|
...this.defaultOptions,
|
|
916
916
|
...t
|
|
917
917
|
};
|
|
918
|
-
return this.queue.add(async () =>
|
|
918
|
+
return this.queue.add(async () => oe(async () => {
|
|
919
919
|
try {
|
|
920
920
|
let t = {
|
|
921
921
|
q: e,
|
|
@@ -930,7 +930,7 @@ var Ue = /* @__PURE__ */ function(e) {
|
|
|
930
930
|
r.searchParams.append(e, String(t));
|
|
931
931
|
});
|
|
932
932
|
let i = await this.fetchWithTimeout(r.toString(), n.timeout, n.userAgent);
|
|
933
|
-
if (!i || i.length === 0) throw new G(
|
|
933
|
+
if (!i || i.length === 0) throw new G(He.GEOCODING_ERROR, `No results found for address: ${e}`);
|
|
934
934
|
let a = i[0], o = {
|
|
935
935
|
latitude: parseFloat(a.lat),
|
|
936
936
|
longitude: parseFloat(a.lon)
|
|
@@ -981,7 +981,7 @@ var Ue = /* @__PURE__ */ function(e) {
|
|
|
981
981
|
...this.defaultOptions,
|
|
982
982
|
...t
|
|
983
983
|
};
|
|
984
|
-
return this.queue.add(async () =>
|
|
984
|
+
return this.queue.add(async () => oe(async () => {
|
|
985
985
|
try {
|
|
986
986
|
let t = new URL(`${this.baseURL}/reverse`);
|
|
987
987
|
t.searchParams.append("lat", String(e.latitude)), t.searchParams.append("lon", String(e.longitude)), t.searchParams.append("format", "json"), t.searchParams.append("addressdetails", "1");
|
|
@@ -1047,14 +1047,14 @@ var Ue = /* @__PURE__ */ function(e) {
|
|
|
1047
1047
|
return e[e.SUNDAY = 1] = "SUNDAY", e[e.MONDAY = 2] = "MONDAY", e[e.TUESDAY = 3] = "TUESDAY", e[e.WEDNESDAY = 4] = "WEDNESDAY", e[e.THURSDAY = 5] = "THURSDAY", e[e.FRIDAY = 6] = "FRIDAY", e[e.SATURDAY = 7] = "SATURDAY", e;
|
|
1048
1048
|
}({}), X = /* @__PURE__ */ function(e) {
|
|
1049
1049
|
return e[e.IN_PERSON = 1] = "IN_PERSON", e[e.VIRTUAL = 2] = "VIRTUAL", e[e.HYBRID = 3] = "HYBRID", e;
|
|
1050
|
-
}({}),
|
|
1050
|
+
}({}), Ke = /* @__PURE__ */ function(e) {
|
|
1051
1051
|
return e.WEEKDAY = "weekday", e.TIME = "time", e.TOWN = "town", e.STATE = "state", e.WEEKDAY_STATE = "weekday_state", e;
|
|
1052
|
-
}({}),
|
|
1052
|
+
}({}), qe = /* @__PURE__ */ function(e) {
|
|
1053
1053
|
return e.DANISH = "da", e.GERMAN = "de", e.GREEK = "el", e.ENGLISH = "en", e.SPANISH = "es", e.PERSIAN = "fa", e.FRENCH = "fr", e.ITALIAN = "it", e.POLISH = "pl", e.PORTUGUESE = "pt", e.RUSSIAN = "ru", e.SWEDISH = "sv", e;
|
|
1054
1054
|
}({});
|
|
1055
1055
|
//#endregion
|
|
1056
1056
|
//#region src/utils/url-builder.ts
|
|
1057
|
-
function
|
|
1057
|
+
function Je(e) {
|
|
1058
1058
|
let { serverURL: t, format: n, endpoint: r, parameters: i = {} } = e, a = `${t.endsWith("/") ? t : `${t}/`}client_interface/${n}/`, o = new URLSearchParams();
|
|
1059
1059
|
return o.set("switcher", r), Object.entries(i).forEach(([e, t]) => {
|
|
1060
1060
|
t != null && (Array.isArray(t) ? t.forEach((t, n) => {
|
|
@@ -1062,25 +1062,27 @@ function Ye(e) {
|
|
|
1062
1062
|
}) : typeof t == "boolean" ? o.set(e, t ? "1" : "0") : o.set(e, t.toString()));
|
|
1063
1063
|
}), `${a}?${o.toString()}`;
|
|
1064
1064
|
}
|
|
1065
|
-
function
|
|
1065
|
+
function Ye(e) {
|
|
1066
1066
|
let t = {};
|
|
1067
1067
|
return Object.entries(e).forEach(([e, n]) => {
|
|
1068
|
-
if (n != null)
|
|
1069
|
-
if (
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1068
|
+
if (n != null) {
|
|
1069
|
+
if (Array.isArray(n)) t[e] = n.map((e) => {
|
|
1070
|
+
if (typeof e == "number") return e;
|
|
1071
|
+
if (typeof e == "string") {
|
|
1072
|
+
let t = parseFloat(e);
|
|
1073
|
+
return isNaN(t) ? e : t;
|
|
1074
|
+
}
|
|
1075
|
+
return e;
|
|
1076
|
+
});
|
|
1077
|
+
else if (typeof n == "boolean") t[e] = n;
|
|
1078
|
+
else if (typeof n == "string") {
|
|
1079
|
+
let r = parseFloat(n);
|
|
1080
|
+
!isNaN(r) && isFinite(r) ? t[e] = r : t[e] = n;
|
|
1081
|
+
} else t[e] = n;
|
|
1082
|
+
}
|
|
1081
1083
|
}), t;
|
|
1082
1084
|
}
|
|
1083
|
-
function
|
|
1085
|
+
function Xe(e, t) {
|
|
1084
1086
|
let n = {
|
|
1085
1087
|
[J.GET_SEARCH_RESULTS]: [
|
|
1086
1088
|
q.JSON,
|
|
@@ -1098,7 +1100,7 @@ function Ze(e, t) {
|
|
|
1098
1100
|
}[e];
|
|
1099
1101
|
if (!n.includes(t)) throw Error(`Invalid format '${t}' for endpoint '${e}'. Valid formats: ${n.join(", ")}`);
|
|
1100
1102
|
}
|
|
1101
|
-
function
|
|
1103
|
+
function Ze(e) {
|
|
1102
1104
|
try {
|
|
1103
1105
|
let t = new URL(e);
|
|
1104
1106
|
if (!["http:", "https:"].includes(t.protocol)) throw Error("Server URL must use http or https protocol");
|
|
@@ -1108,10 +1110,10 @@ function Qe(e) {
|
|
|
1108
1110
|
throw n.cause = t, n;
|
|
1109
1111
|
}
|
|
1110
1112
|
}
|
|
1111
|
-
function
|
|
1113
|
+
function Qe(e) {
|
|
1112
1114
|
return typeof e == "number" ? [e] : typeof e == "string" ? e.split(",").map((e) => parseInt(e.trim(), 10)).filter((e) => !isNaN(e)) : Array.isArray(e) ? e.map((e) => typeof e == "number" ? e : parseInt(String(e), 10)).filter((e) => !isNaN(e)) : [];
|
|
1113
1115
|
}
|
|
1114
|
-
function
|
|
1116
|
+
function $e(e, t) {
|
|
1115
1117
|
let n = {};
|
|
1116
1118
|
if (typeof e == "number") {
|
|
1117
1119
|
if (e < 0 || e > 23) throw Error("Hours must be between 0 and 23");
|
|
@@ -1123,7 +1125,7 @@ function et(e, t) {
|
|
|
1123
1125
|
}
|
|
1124
1126
|
return n;
|
|
1125
1127
|
}
|
|
1126
|
-
function
|
|
1128
|
+
function et(e, t) {
|
|
1127
1129
|
if (typeof e != "number" || isNaN(e)) throw Error("Latitude must be a valid number");
|
|
1128
1130
|
if (typeof t != "number" || isNaN(t)) throw Error("Longitude must be a valid number");
|
|
1129
1131
|
if (e < -90 || e > 90) throw Error("Latitude must be between -90 and 90 degrees");
|
|
@@ -1133,18 +1135,18 @@ function Z(e) {
|
|
|
1133
1135
|
if (typeof e != "number" || isNaN(e)) throw Error("Radius must be a valid number");
|
|
1134
1136
|
if (e <= 0) throw Error("Radius must be greater than 0");
|
|
1135
1137
|
}
|
|
1136
|
-
function
|
|
1138
|
+
function tt(e) {
|
|
1137
1139
|
return e * 1.60934;
|
|
1138
1140
|
}
|
|
1139
|
-
function
|
|
1141
|
+
function nt(e) {
|
|
1140
1142
|
return e / 1.60934;
|
|
1141
1143
|
}
|
|
1142
1144
|
//#endregion
|
|
1143
1145
|
//#region src/utils/transforms.ts
|
|
1144
|
-
var Q = (e) => typeof e == "number" ? e : parseFloat(e),
|
|
1145
|
-
if (
|
|
1146
|
+
var Q = (e) => typeof e == "number" ? e : parseFloat(e), rt = (e) => {
|
|
1147
|
+
if (e != null && e !== "") return Q(e);
|
|
1146
1148
|
};
|
|
1147
|
-
function
|
|
1149
|
+
function it(e) {
|
|
1148
1150
|
let t = e;
|
|
1149
1151
|
return {
|
|
1150
1152
|
...t,
|
|
@@ -1153,11 +1155,11 @@ function at(e) {
|
|
|
1153
1155
|
published: Q(t.published),
|
|
1154
1156
|
latitude: Q(t.latitude),
|
|
1155
1157
|
longitude: Q(t.longitude),
|
|
1156
|
-
distance_in_km:
|
|
1157
|
-
distance_in_miles:
|
|
1158
|
+
distance_in_km: rt(t.distance_in_km),
|
|
1159
|
+
distance_in_miles: rt(t.distance_in_miles)
|
|
1158
1160
|
};
|
|
1159
1161
|
}
|
|
1160
|
-
function
|
|
1162
|
+
function at(e) {
|
|
1161
1163
|
let t = e;
|
|
1162
1164
|
return {
|
|
1163
1165
|
...t,
|
|
@@ -1169,7 +1171,7 @@ function ot(e) {
|
|
|
1169
1171
|
changesPerMeeting: Q(t.changesPerMeeting)
|
|
1170
1172
|
};
|
|
1171
1173
|
}
|
|
1172
|
-
function
|
|
1174
|
+
function ot(e) {
|
|
1173
1175
|
let t = e;
|
|
1174
1176
|
return {
|
|
1175
1177
|
nw_corner_longitude: Q(t.nw_corner_longitude),
|
|
@@ -1180,11 +1182,11 @@ function st(e) {
|
|
|
1180
1182
|
}
|
|
1181
1183
|
//#endregion
|
|
1182
1184
|
//#region src/client/bmlt-client.ts
|
|
1183
|
-
var
|
|
1185
|
+
var st = class {
|
|
1184
1186
|
constructor(e) {
|
|
1185
|
-
|
|
1187
|
+
g(this, "timeout", void 0), g(this, "userAgent", void 0), g(this, "geocodingService", void 0), g(this, "serverURL", void 0), g(this, "defaultFormat", void 0);
|
|
1186
1188
|
let { serverURL: t, defaultFormat: n = q.JSON, timeout: r = 3e4, userAgent: i = "bmlt-query-client/1.0.0", geocodingOptions: a = {}, enableGeocoding: o = !0 } = e;
|
|
1187
|
-
this.serverURL =
|
|
1189
|
+
this.serverURL = Ze(t), this.defaultFormat = n, this.timeout = r, this.userAgent = i, o && (this.geocodingService = new Ge(a));
|
|
1188
1190
|
}
|
|
1189
1191
|
async fetchAndParse(e, t, n = {}) {
|
|
1190
1192
|
let r;
|
|
@@ -1199,7 +1201,7 @@ var ct = class {
|
|
|
1199
1201
|
} finally {
|
|
1200
1202
|
clearTimeout(a);
|
|
1201
1203
|
}
|
|
1202
|
-
if (!r.ok) throw
|
|
1204
|
+
if (!r.ok) throw Ue.handleFetchError(/* @__PURE__ */ Error(`HTTP ${r.status}: ${r.statusText}`), r);
|
|
1203
1205
|
let o = await r.text();
|
|
1204
1206
|
if (t === q.CSV) return o;
|
|
1205
1207
|
if (t === q.JSONP) {
|
|
@@ -1209,12 +1211,12 @@ var ct = class {
|
|
|
1209
1211
|
}
|
|
1210
1212
|
return t === q.JSON || t === q.TSML ? JSON.parse(o) : o;
|
|
1211
1213
|
} catch (e) {
|
|
1212
|
-
throw
|
|
1214
|
+
throw Ue.handleFetchError(e, r);
|
|
1213
1215
|
}
|
|
1214
1216
|
}
|
|
1215
1217
|
async makeRequest(e, t = {}, n = this.defaultFormat) {
|
|
1216
|
-
|
|
1217
|
-
let r =
|
|
1218
|
+
Xe(e, n);
|
|
1219
|
+
let r = Je({
|
|
1218
1220
|
serverURL: this.serverURL,
|
|
1219
1221
|
format: n,
|
|
1220
1222
|
endpoint: e,
|
|
@@ -1228,7 +1230,7 @@ var ct = class {
|
|
|
1228
1230
|
}
|
|
1229
1231
|
async searchMeetings(e = {}) {
|
|
1230
1232
|
let { format: t = this.defaultFormat, ...n } = e;
|
|
1231
|
-
return (await this.makeRequest(J.GET_SEARCH_RESULTS, n, t)).map(
|
|
1233
|
+
return (await this.makeRequest(J.GET_SEARCH_RESULTS, n, t)).map(it);
|
|
1232
1234
|
}
|
|
1233
1235
|
async searchMeetingsWithFormats(e = {}) {
|
|
1234
1236
|
let { format: t = this.defaultFormat, ...n } = e, r = await this.makeRequest(J.GET_SEARCH_RESULTS, {
|
|
@@ -1236,7 +1238,7 @@ var ct = class {
|
|
|
1236
1238
|
get_used_formats: !0
|
|
1237
1239
|
}, t);
|
|
1238
1240
|
return {
|
|
1239
|
-
meetings: r.meetings.map(
|
|
1241
|
+
meetings: r.meetings.map(it),
|
|
1240
1242
|
formats: r.formats
|
|
1241
1243
|
};
|
|
1242
1244
|
}
|
|
@@ -1251,7 +1253,7 @@ var ct = class {
|
|
|
1251
1253
|
return n === void 0 ? r !== void 0 && (Z(r), s.geo_width_km = r) : (Z(n), s.geo_width = n), this.searchMeetings(s);
|
|
1252
1254
|
}
|
|
1253
1255
|
async searchMeetingsByCoordinates(e, t, n, r = {}) {
|
|
1254
|
-
|
|
1256
|
+
et(e.latitude, e.longitude);
|
|
1255
1257
|
let i = {
|
|
1256
1258
|
...r,
|
|
1257
1259
|
lat_val: e.latitude,
|
|
@@ -1283,10 +1285,10 @@ var ct = class {
|
|
|
1283
1285
|
return this.makeRequest(J.GET_NAWS_DUMP, e, q.CSV);
|
|
1284
1286
|
}
|
|
1285
1287
|
async getServerInfo() {
|
|
1286
|
-
return
|
|
1288
|
+
return at((await this.makeRequest(J.GET_SERVER_INFO))[0]);
|
|
1287
1289
|
}
|
|
1288
1290
|
async getCoverageArea() {
|
|
1289
|
-
return
|
|
1291
|
+
return ot((await this.makeRequest(J.GET_COVERAGE_AREA))[0]);
|
|
1290
1292
|
}
|
|
1291
1293
|
async geocodeAddress(e, t) {
|
|
1292
1294
|
if (!this.geocodingService) throw Error("Geocoding is not enabled. Initialize client with enableGeocoding: true");
|
|
@@ -1300,7 +1302,7 @@ var ct = class {
|
|
|
1300
1302
|
return this.serverURL;
|
|
1301
1303
|
}
|
|
1302
1304
|
setServerURL(e) {
|
|
1303
|
-
this.serverURL =
|
|
1305
|
+
this.serverURL = Ze(e);
|
|
1304
1306
|
}
|
|
1305
1307
|
getDefaultFormat() {
|
|
1306
1308
|
return this.defaultFormat;
|
|
@@ -1333,7 +1335,7 @@ var ct = class {
|
|
|
1333
1335
|
}
|
|
1334
1336
|
}, $ = class e {
|
|
1335
1337
|
constructor(e) {
|
|
1336
|
-
|
|
1338
|
+
g(this, "params", {}), g(this, "client", void 0), this.client = e;
|
|
1337
1339
|
}
|
|
1338
1340
|
meetingIds(e, t = !1) {
|
|
1339
1341
|
return Array.isArray(e) ? this.params.meeting_ids = t ? e.map((e) => -e) : e : this.params.meeting_ids = t ? -e : e, this;
|
|
@@ -1411,6 +1413,12 @@ var ct = class {
|
|
|
1411
1413
|
sortByDistance() {
|
|
1412
1414
|
return this.params.sort_results_by_distance = !0, this;
|
|
1413
1415
|
}
|
|
1416
|
+
sortByNextStart(e) {
|
|
1417
|
+
return this.params.sort_results_by_next_start = !0, e !== void 0 && (this.params.next_start_grace_minutes = e), this;
|
|
1418
|
+
}
|
|
1419
|
+
targetTimeZone(e) {
|
|
1420
|
+
return this.params.target_time_zone = e, this;
|
|
1421
|
+
}
|
|
1414
1422
|
paginate(e, t = 1) {
|
|
1415
1423
|
return this.params.page_size = e, this.params.page_num = t, this;
|
|
1416
1424
|
}
|
|
@@ -1461,9 +1469,9 @@ var ct = class {
|
|
|
1461
1469
|
searchParams: this.params
|
|
1462
1470
|
});
|
|
1463
1471
|
}
|
|
1464
|
-
},
|
|
1472
|
+
}, ct = class {
|
|
1465
1473
|
constructor(e) {
|
|
1466
|
-
|
|
1474
|
+
g(this, "client", void 0), this.client = e;
|
|
1467
1475
|
}
|
|
1468
1476
|
today() {
|
|
1469
1477
|
let e = (/* @__PURE__ */ new Date()).getDay(), t = e === 0 ? Y.SUNDAY : e;
|
|
@@ -1487,26 +1495,30 @@ var ct = class {
|
|
|
1487
1495
|
inPerson() {
|
|
1488
1496
|
return new $(this.client).inPersonOnly();
|
|
1489
1497
|
}
|
|
1498
|
+
virtualSoonest(e) {
|
|
1499
|
+
let t = new $(this.client).virtualOrHybrid().sortByNextStart();
|
|
1500
|
+
return e ? t.targetTimeZone(e) : t;
|
|
1501
|
+
}
|
|
1490
1502
|
byText(e) {
|
|
1491
1503
|
return new $(this.client).searchText(e);
|
|
1492
1504
|
}
|
|
1493
|
-
},
|
|
1505
|
+
}, lt = [
|
|
1494
1506
|
"weekday_tinyint",
|
|
1495
1507
|
"start_time",
|
|
1496
1508
|
"meeting_name",
|
|
1497
1509
|
"location_text"
|
|
1498
1510
|
];
|
|
1499
|
-
function
|
|
1511
|
+
function ut(e, t) {
|
|
1500
1512
|
let n = e == null ? "" : String(e);
|
|
1501
1513
|
return t ? n.toLowerCase().trim() : n;
|
|
1502
1514
|
}
|
|
1503
|
-
function
|
|
1504
|
-
return t.map((t) =>
|
|
1515
|
+
function dt(e, t, n) {
|
|
1516
|
+
return t.map((t) => ut(e[t], n)).join(" | ");
|
|
1505
1517
|
}
|
|
1506
|
-
function
|
|
1507
|
-
let { fields: n =
|
|
1518
|
+
function ft(e, t = {}) {
|
|
1519
|
+
let { fields: n = lt, normalize: r = !0 } = t, i = /* @__PURE__ */ new Map();
|
|
1508
1520
|
for (let t = 0; t < e.length; t++) for (let a of e[t]) {
|
|
1509
|
-
let e =
|
|
1521
|
+
let e = dt(a, n, r);
|
|
1510
1522
|
i.has(e) || i.set(e, []), i.get(e).push({
|
|
1511
1523
|
meeting: a,
|
|
1512
1524
|
listIndex: t
|
|
@@ -1519,7 +1531,7 @@ function pt(e, t = {}) {
|
|
|
1519
1531
|
});
|
|
1520
1532
|
return a;
|
|
1521
1533
|
}
|
|
1522
|
-
function
|
|
1534
|
+
function pt(e) {
|
|
1523
1535
|
let t = /* @__PURE__ */ new Set();
|
|
1524
1536
|
for (let n of e) {
|
|
1525
1537
|
let e = n.service_body_bigint, r = n.meeting_name;
|
|
@@ -1530,6 +1542,6 @@ function mt(e) {
|
|
|
1530
1542
|
return t.size;
|
|
1531
1543
|
}
|
|
1532
1544
|
//#endregion
|
|
1533
|
-
export {
|
|
1545
|
+
export { st as BmltClient, q as BmltDataFormat, J as BmltEndpoint, He as BmltErrorType, G as BmltQueryError, K as ErrorFactory, Ue as ErrorHandler, Ge as GeocodingService, qe as Language, $ as MeetingQueryBuilder, ct as QuickSearch, We as RetryHandler, Ke as SortKey, X as VenueType, Y as Weekday, Je as buildBmltURL, pt as countUniqueGroups, Qe as extractIds, ft as findDuplicateMeetings, $e as formatTimeValue, nt as kilometersToMiles, tt as milesToKilometers, Ye as normalizeParameters, et as validateCoordinates, Xe as validateEndpointFormat, Z as validateRadius, Ze as validateServerURL };
|
|
1534
1546
|
|
|
1535
1547
|
//# sourceMappingURL=app.js.map
|