bmlt-query-client 1.4.1 → 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/.claude/settings.local.json +12 -5
- package/CHANGELOG.md +15 -1
- package/CLAUDE.md +39 -0
- package/README.md +21 -0
- package/dist/app.d.ts +50 -3
- package/dist/app.js +282 -268
- 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,174 +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) => ({
|
|
560
|
+
...e,
|
|
561
|
+
timeoutRemaining: e.timeout ? Math.max(0, e.startTime + e.timeout - Date.now()) : void 0
|
|
562
|
+
}));
|
|
559
563
|
}
|
|
560
564
|
};
|
|
561
|
-
function
|
|
562
|
-
for (;
|
|
563
|
-
let n =
|
|
564
|
-
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)) {
|
|
565
569
|
var t;
|
|
566
|
-
|
|
570
|
+
b(F, this, (t = y(F, this), t++, t));
|
|
567
571
|
} else break;
|
|
568
572
|
}
|
|
569
|
-
(
|
|
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));
|
|
570
574
|
}
|
|
571
|
-
function
|
|
572
|
-
if (
|
|
575
|
+
function we(e) {
|
|
576
|
+
if (y(N, this)) y(P, this).push(e);
|
|
573
577
|
else {
|
|
574
578
|
var t;
|
|
575
|
-
|
|
579
|
+
b(T, this, (t = y(T, this), t++, t));
|
|
576
580
|
}
|
|
577
581
|
}
|
|
578
|
-
function
|
|
579
|
-
if (
|
|
580
|
-
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) {
|
|
581
585
|
var e;
|
|
582
|
-
|
|
586
|
+
b(T, this, (e = y(T, this), e--, e));
|
|
583
587
|
}
|
|
584
588
|
}
|
|
589
|
+
function Ee() {
|
|
590
|
+
return y(P, this).length - y(F, this);
|
|
591
|
+
}
|
|
585
592
|
function De() {
|
|
586
|
-
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);
|
|
587
594
|
}
|
|
588
595
|
function Oe() {
|
|
589
|
-
return
|
|
596
|
+
return y(L, this) < y(R, this);
|
|
590
597
|
}
|
|
591
598
|
function ke() {
|
|
592
|
-
return b(L, this) < b(R, this);
|
|
593
|
-
}
|
|
594
|
-
function Ae() {
|
|
595
599
|
var e;
|
|
596
|
-
|
|
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");
|
|
597
601
|
}
|
|
598
|
-
function
|
|
599
|
-
|
|
602
|
+
function Ae() {
|
|
603
|
+
b(M, this, void 0), v(H, this, Le).call(this), v(H, this, Ie).call(this);
|
|
600
604
|
}
|
|
601
|
-
function
|
|
602
|
-
if (
|
|
603
|
-
if (
|
|
604
|
-
let t =
|
|
605
|
-
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;
|
|
606
610
|
}
|
|
607
611
|
return !1;
|
|
608
612
|
}
|
|
609
|
-
if (
|
|
610
|
-
let t =
|
|
611
|
-
if (t < 0)
|
|
612
|
-
|
|
613
|
-
let t = e - b(A, this);
|
|
614
|
-
if (t < b(k, this)) return y(H, this, Ne).call(this, b(k, this) - t), !0;
|
|
615
|
-
}
|
|
616
|
-
x(T, this, b(ye, this) ? b(L, this) : 0);
|
|
617
|
-
} 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;
|
|
618
617
|
}
|
|
619
618
|
return !1;
|
|
620
619
|
}
|
|
621
|
-
function
|
|
622
|
-
|
|
623
|
-
|
|
620
|
+
function Me(e) {
|
|
621
|
+
y(M, this) === void 0 && b(M, this, setTimeout(() => {
|
|
622
|
+
v(H, this, Ae).call(this);
|
|
624
623
|
}, e));
|
|
625
624
|
}
|
|
625
|
+
function Ne() {
|
|
626
|
+
y(j, this) && (clearInterval(y(j, this)), b(j, this, void 0));
|
|
627
|
+
}
|
|
626
628
|
function Pe() {
|
|
627
|
-
|
|
629
|
+
y(M, this) && (clearTimeout(y(M, this)), b(M, this, void 0));
|
|
628
630
|
}
|
|
629
631
|
function Fe() {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
if (b(I, this).size === 0) {
|
|
634
|
-
if (y(H, this, Pe).call(this), this.emit("empty"), b(L, this) === 0) {
|
|
635
|
-
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) {
|
|
636
635
|
let e = Date.now();
|
|
637
|
-
|
|
636
|
+
v(H, this, Ce).call(this, e);
|
|
638
637
|
}
|
|
639
638
|
this.emit("idle");
|
|
640
639
|
}
|
|
641
640
|
return !1;
|
|
642
641
|
}
|
|
643
642
|
let e = !1;
|
|
644
|
-
if (!
|
|
645
|
-
let t = Date.now(), n = !
|
|
646
|
-
if (
|
|
647
|
-
let r =
|
|
648
|
-
|
|
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;
|
|
649
648
|
}
|
|
650
649
|
}
|
|
651
650
|
return e;
|
|
652
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
|
+
}
|
|
653
657
|
function Le() {
|
|
654
|
-
|
|
655
|
-
y(H, this, Re).call(this);
|
|
656
|
-
}, 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);
|
|
657
659
|
}
|
|
658
660
|
function Re() {
|
|
659
|
-
|
|
660
|
-
}
|
|
661
|
-
function ze() {
|
|
662
|
-
for (; y(H, this, Ie).call(this););
|
|
661
|
+
for (; v(H, this, Fe).call(this););
|
|
663
662
|
}
|
|
664
663
|
async function U(e, t) {
|
|
665
|
-
|
|
664
|
+
let n = Array.isArray(e) ? e : [e];
|
|
665
|
+
return new Promise((e) => {
|
|
666
666
|
let r = () => {
|
|
667
|
-
|
|
667
|
+
if (!t || t()) {
|
|
668
|
+
for (let e of n) this.off(e, r);
|
|
669
|
+
e();
|
|
670
|
+
}
|
|
668
671
|
};
|
|
669
|
-
this.on(e, r);
|
|
672
|
+
for (let e of n) this.on(e, r);
|
|
670
673
|
});
|
|
671
674
|
}
|
|
672
|
-
function
|
|
673
|
-
|
|
674
|
-
|
|
675
|
+
function ze() {
|
|
676
|
+
y(w, this) || (this.on("add", () => {
|
|
677
|
+
y(I, this).size > 0 && v(H, this, W).call(this);
|
|
675
678
|
}), this.on("next", () => {
|
|
676
|
-
|
|
679
|
+
v(H, this, W).call(this);
|
|
677
680
|
}));
|
|
678
681
|
}
|
|
679
682
|
function W() {
|
|
680
|
-
|
|
681
|
-
|
|
683
|
+
y(w, this) || y(O, this) || (b(O, this, !0), queueMicrotask(() => {
|
|
684
|
+
b(O, this, !1), v(H, this, Ve).call(this);
|
|
682
685
|
}));
|
|
683
686
|
}
|
|
684
|
-
function
|
|
685
|
-
|
|
687
|
+
function Be() {
|
|
688
|
+
y(w, this) || (v(H, this, Te).call(this), v(H, this, W).call(this));
|
|
686
689
|
}
|
|
687
|
-
function
|
|
688
|
-
let e =
|
|
689
|
-
if (
|
|
690
|
-
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"));
|
|
691
694
|
return;
|
|
692
695
|
}
|
|
693
696
|
let t;
|
|
694
|
-
if (
|
|
697
|
+
if (y(N, this)) {
|
|
695
698
|
let e = Date.now();
|
|
696
|
-
|
|
697
|
-
} else t =
|
|
698
|
-
let n = t >=
|
|
699
|
-
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"));
|
|
700
703
|
}
|
|
701
704
|
//#endregion
|
|
702
705
|
//#region src/utils/errors.ts
|
|
703
|
-
var
|
|
706
|
+
var He = /* @__PURE__ */ function(e) {
|
|
704
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;
|
|
705
708
|
}({}), G = class e extends Error {
|
|
706
709
|
constructor(t, n, r = {}) {
|
|
707
|
-
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);
|
|
708
711
|
}
|
|
709
712
|
isType(e) {
|
|
710
713
|
return this.type === e;
|
|
@@ -786,7 +789,7 @@ var Ue = /* @__PURE__ */ function(e) {
|
|
|
786
789
|
static createConfigurationError(e, t) {
|
|
787
790
|
return new G("ConfigurationError", e, { context: t });
|
|
788
791
|
}
|
|
789
|
-
},
|
|
792
|
+
}, Ue = class e {
|
|
790
793
|
static handleFetchError(e, t) {
|
|
791
794
|
if (e instanceof Error && e.name === "AbortError") return K.createTimeoutError("Request timeout", e);
|
|
792
795
|
if (e instanceof TypeError) return K.createNetworkError("Network connection failed", e);
|
|
@@ -842,22 +845,22 @@ var Ue = /* @__PURE__ */ function(e) {
|
|
|
842
845
|
}
|
|
843
846
|
}) : K.createApiError(r, void 0, void 0, e);
|
|
844
847
|
}
|
|
845
|
-
},
|
|
848
|
+
}, We = class {
|
|
846
849
|
static async withRetry(e, t) {
|
|
847
850
|
let { maxRetries: n, baseDelay: r, maxDelay: i, factor: a, onRetry: o } = t, s;
|
|
848
851
|
for (let t = 0; t <= n; t++) try {
|
|
849
852
|
return await e();
|
|
850
853
|
} catch (e) {
|
|
851
|
-
let c = e instanceof G ? e :
|
|
854
|
+
let c = e instanceof G ? e : Ue.wrapError(e, "Operation failed");
|
|
852
855
|
if (s = c, t === n || !c.isRetryable()) throw c;
|
|
853
856
|
let l = Math.min(r * a ** +t, i);
|
|
854
857
|
o && o(c, t + 1), await new Promise((e) => setTimeout(e, l));
|
|
855
858
|
}
|
|
856
859
|
throw s;
|
|
857
860
|
}
|
|
858
|
-
},
|
|
861
|
+
}, Ge = class {
|
|
859
862
|
constructor(e = {}) {
|
|
860
|
-
|
|
863
|
+
g(this, "baseURL", void 0), g(this, "queue", void 0), g(this, "defaultOptions", void 0);
|
|
861
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;
|
|
862
865
|
this.defaultOptions = {
|
|
863
866
|
retryCount: t,
|
|
@@ -866,7 +869,7 @@ var Ue = /* @__PURE__ */ function(e) {
|
|
|
866
869
|
countryCode: i,
|
|
867
870
|
viewbox: a,
|
|
868
871
|
bounded: o
|
|
869
|
-
}, this.baseURL = "https://nominatim.openstreetmap.org", this.queue = new
|
|
872
|
+
}, this.baseURL = "https://nominatim.openstreetmap.org", this.queue = new Se({
|
|
870
873
|
intervalCap: s,
|
|
871
874
|
interval: c,
|
|
872
875
|
concurrency: l,
|
|
@@ -912,7 +915,7 @@ var Ue = /* @__PURE__ */ function(e) {
|
|
|
912
915
|
...this.defaultOptions,
|
|
913
916
|
...t
|
|
914
917
|
};
|
|
915
|
-
return this.queue.add(async () =>
|
|
918
|
+
return this.queue.add(async () => oe(async () => {
|
|
916
919
|
try {
|
|
917
920
|
let t = {
|
|
918
921
|
q: e,
|
|
@@ -927,7 +930,7 @@ var Ue = /* @__PURE__ */ function(e) {
|
|
|
927
930
|
r.searchParams.append(e, String(t));
|
|
928
931
|
});
|
|
929
932
|
let i = await this.fetchWithTimeout(r.toString(), n.timeout, n.userAgent);
|
|
930
|
-
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}`);
|
|
931
934
|
let a = i[0], o = {
|
|
932
935
|
latitude: parseFloat(a.lat),
|
|
933
936
|
longitude: parseFloat(a.lon)
|
|
@@ -978,7 +981,7 @@ var Ue = /* @__PURE__ */ function(e) {
|
|
|
978
981
|
...this.defaultOptions,
|
|
979
982
|
...t
|
|
980
983
|
};
|
|
981
|
-
return this.queue.add(async () =>
|
|
984
|
+
return this.queue.add(async () => oe(async () => {
|
|
982
985
|
try {
|
|
983
986
|
let t = new URL(`${this.baseURL}/reverse`);
|
|
984
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");
|
|
@@ -1044,14 +1047,14 @@ var Ue = /* @__PURE__ */ function(e) {
|
|
|
1044
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;
|
|
1045
1048
|
}({}), X = /* @__PURE__ */ function(e) {
|
|
1046
1049
|
return e[e.IN_PERSON = 1] = "IN_PERSON", e[e.VIRTUAL = 2] = "VIRTUAL", e[e.HYBRID = 3] = "HYBRID", e;
|
|
1047
|
-
}({}),
|
|
1050
|
+
}({}), Ke = /* @__PURE__ */ function(e) {
|
|
1048
1051
|
return e.WEEKDAY = "weekday", e.TIME = "time", e.TOWN = "town", e.STATE = "state", e.WEEKDAY_STATE = "weekday_state", e;
|
|
1049
|
-
}({}),
|
|
1052
|
+
}({}), qe = /* @__PURE__ */ function(e) {
|
|
1050
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;
|
|
1051
1054
|
}({});
|
|
1052
1055
|
//#endregion
|
|
1053
1056
|
//#region src/utils/url-builder.ts
|
|
1054
|
-
function
|
|
1057
|
+
function Je(e) {
|
|
1055
1058
|
let { serverURL: t, format: n, endpoint: r, parameters: i = {} } = e, a = `${t.endsWith("/") ? t : `${t}/`}client_interface/${n}/`, o = new URLSearchParams();
|
|
1056
1059
|
return o.set("switcher", r), Object.entries(i).forEach(([e, t]) => {
|
|
1057
1060
|
t != null && (Array.isArray(t) ? t.forEach((t, n) => {
|
|
@@ -1059,25 +1062,27 @@ function Ye(e) {
|
|
|
1059
1062
|
}) : typeof t == "boolean" ? o.set(e, t ? "1" : "0") : o.set(e, t.toString()));
|
|
1060
1063
|
}), `${a}?${o.toString()}`;
|
|
1061
1064
|
}
|
|
1062
|
-
function
|
|
1065
|
+
function Ye(e) {
|
|
1063
1066
|
let t = {};
|
|
1064
1067
|
return Object.entries(e).forEach(([e, n]) => {
|
|
1065
|
-
if (n != null)
|
|
1066
|
-
if (
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
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
|
+
}
|
|
1078
1083
|
}), t;
|
|
1079
1084
|
}
|
|
1080
|
-
function
|
|
1085
|
+
function Xe(e, t) {
|
|
1081
1086
|
let n = {
|
|
1082
1087
|
[J.GET_SEARCH_RESULTS]: [
|
|
1083
1088
|
q.JSON,
|
|
@@ -1095,7 +1100,7 @@ function Ze(e, t) {
|
|
|
1095
1100
|
}[e];
|
|
1096
1101
|
if (!n.includes(t)) throw Error(`Invalid format '${t}' for endpoint '${e}'. Valid formats: ${n.join(", ")}`);
|
|
1097
1102
|
}
|
|
1098
|
-
function
|
|
1103
|
+
function Ze(e) {
|
|
1099
1104
|
try {
|
|
1100
1105
|
let t = new URL(e);
|
|
1101
1106
|
if (!["http:", "https:"].includes(t.protocol)) throw Error("Server URL must use http or https protocol");
|
|
@@ -1105,10 +1110,10 @@ function Qe(e) {
|
|
|
1105
1110
|
throw n.cause = t, n;
|
|
1106
1111
|
}
|
|
1107
1112
|
}
|
|
1108
|
-
function
|
|
1113
|
+
function Qe(e) {
|
|
1109
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)) : [];
|
|
1110
1115
|
}
|
|
1111
|
-
function
|
|
1116
|
+
function $e(e, t) {
|
|
1112
1117
|
let n = {};
|
|
1113
1118
|
if (typeof e == "number") {
|
|
1114
1119
|
if (e < 0 || e > 23) throw Error("Hours must be between 0 and 23");
|
|
@@ -1120,7 +1125,7 @@ function et(e, t) {
|
|
|
1120
1125
|
}
|
|
1121
1126
|
return n;
|
|
1122
1127
|
}
|
|
1123
|
-
function
|
|
1128
|
+
function et(e, t) {
|
|
1124
1129
|
if (typeof e != "number" || isNaN(e)) throw Error("Latitude must be a valid number");
|
|
1125
1130
|
if (typeof t != "number" || isNaN(t)) throw Error("Longitude must be a valid number");
|
|
1126
1131
|
if (e < -90 || e > 90) throw Error("Latitude must be between -90 and 90 degrees");
|
|
@@ -1130,18 +1135,18 @@ function Z(e) {
|
|
|
1130
1135
|
if (typeof e != "number" || isNaN(e)) throw Error("Radius must be a valid number");
|
|
1131
1136
|
if (e <= 0) throw Error("Radius must be greater than 0");
|
|
1132
1137
|
}
|
|
1133
|
-
function
|
|
1138
|
+
function tt(e) {
|
|
1134
1139
|
return e * 1.60934;
|
|
1135
1140
|
}
|
|
1136
|
-
function
|
|
1141
|
+
function nt(e) {
|
|
1137
1142
|
return e / 1.60934;
|
|
1138
1143
|
}
|
|
1139
1144
|
//#endregion
|
|
1140
1145
|
//#region src/utils/transforms.ts
|
|
1141
|
-
var Q = (e) => typeof e == "number" ? e : parseFloat(e),
|
|
1142
|
-
if (
|
|
1146
|
+
var Q = (e) => typeof e == "number" ? e : parseFloat(e), rt = (e) => {
|
|
1147
|
+
if (e != null && e !== "") return Q(e);
|
|
1143
1148
|
};
|
|
1144
|
-
function
|
|
1149
|
+
function it(e) {
|
|
1145
1150
|
let t = e;
|
|
1146
1151
|
return {
|
|
1147
1152
|
...t,
|
|
@@ -1150,11 +1155,11 @@ function at(e) {
|
|
|
1150
1155
|
published: Q(t.published),
|
|
1151
1156
|
latitude: Q(t.latitude),
|
|
1152
1157
|
longitude: Q(t.longitude),
|
|
1153
|
-
distance_in_km:
|
|
1154
|
-
distance_in_miles:
|
|
1158
|
+
distance_in_km: rt(t.distance_in_km),
|
|
1159
|
+
distance_in_miles: rt(t.distance_in_miles)
|
|
1155
1160
|
};
|
|
1156
1161
|
}
|
|
1157
|
-
function
|
|
1162
|
+
function at(e) {
|
|
1158
1163
|
let t = e;
|
|
1159
1164
|
return {
|
|
1160
1165
|
...t,
|
|
@@ -1166,7 +1171,7 @@ function ot(e) {
|
|
|
1166
1171
|
changesPerMeeting: Q(t.changesPerMeeting)
|
|
1167
1172
|
};
|
|
1168
1173
|
}
|
|
1169
|
-
function
|
|
1174
|
+
function ot(e) {
|
|
1170
1175
|
let t = e;
|
|
1171
1176
|
return {
|
|
1172
1177
|
nw_corner_longitude: Q(t.nw_corner_longitude),
|
|
@@ -1177,11 +1182,11 @@ function st(e) {
|
|
|
1177
1182
|
}
|
|
1178
1183
|
//#endregion
|
|
1179
1184
|
//#region src/client/bmlt-client.ts
|
|
1180
|
-
var
|
|
1185
|
+
var st = class {
|
|
1181
1186
|
constructor(e) {
|
|
1182
|
-
|
|
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);
|
|
1183
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;
|
|
1184
|
-
this.serverURL =
|
|
1189
|
+
this.serverURL = Ze(t), this.defaultFormat = n, this.timeout = r, this.userAgent = i, o && (this.geocodingService = new Ge(a));
|
|
1185
1190
|
}
|
|
1186
1191
|
async fetchAndParse(e, t, n = {}) {
|
|
1187
1192
|
let r;
|
|
@@ -1196,7 +1201,7 @@ var ct = class {
|
|
|
1196
1201
|
} finally {
|
|
1197
1202
|
clearTimeout(a);
|
|
1198
1203
|
}
|
|
1199
|
-
if (!r.ok) throw
|
|
1204
|
+
if (!r.ok) throw Ue.handleFetchError(/* @__PURE__ */ Error(`HTTP ${r.status}: ${r.statusText}`), r);
|
|
1200
1205
|
let o = await r.text();
|
|
1201
1206
|
if (t === q.CSV) return o;
|
|
1202
1207
|
if (t === q.JSONP) {
|
|
@@ -1206,12 +1211,12 @@ var ct = class {
|
|
|
1206
1211
|
}
|
|
1207
1212
|
return t === q.JSON || t === q.TSML ? JSON.parse(o) : o;
|
|
1208
1213
|
} catch (e) {
|
|
1209
|
-
throw
|
|
1214
|
+
throw Ue.handleFetchError(e, r);
|
|
1210
1215
|
}
|
|
1211
1216
|
}
|
|
1212
1217
|
async makeRequest(e, t = {}, n = this.defaultFormat) {
|
|
1213
|
-
|
|
1214
|
-
let r =
|
|
1218
|
+
Xe(e, n);
|
|
1219
|
+
let r = Je({
|
|
1215
1220
|
serverURL: this.serverURL,
|
|
1216
1221
|
format: n,
|
|
1217
1222
|
endpoint: e,
|
|
@@ -1225,7 +1230,7 @@ var ct = class {
|
|
|
1225
1230
|
}
|
|
1226
1231
|
async searchMeetings(e = {}) {
|
|
1227
1232
|
let { format: t = this.defaultFormat, ...n } = e;
|
|
1228
|
-
return (await this.makeRequest(J.GET_SEARCH_RESULTS, n, t)).map(
|
|
1233
|
+
return (await this.makeRequest(J.GET_SEARCH_RESULTS, n, t)).map(it);
|
|
1229
1234
|
}
|
|
1230
1235
|
async searchMeetingsWithFormats(e = {}) {
|
|
1231
1236
|
let { format: t = this.defaultFormat, ...n } = e, r = await this.makeRequest(J.GET_SEARCH_RESULTS, {
|
|
@@ -1233,7 +1238,7 @@ var ct = class {
|
|
|
1233
1238
|
get_used_formats: !0
|
|
1234
1239
|
}, t);
|
|
1235
1240
|
return {
|
|
1236
|
-
meetings: r.meetings.map(
|
|
1241
|
+
meetings: r.meetings.map(it),
|
|
1237
1242
|
formats: r.formats
|
|
1238
1243
|
};
|
|
1239
1244
|
}
|
|
@@ -1248,7 +1253,7 @@ var ct = class {
|
|
|
1248
1253
|
return n === void 0 ? r !== void 0 && (Z(r), s.geo_width_km = r) : (Z(n), s.geo_width = n), this.searchMeetings(s);
|
|
1249
1254
|
}
|
|
1250
1255
|
async searchMeetingsByCoordinates(e, t, n, r = {}) {
|
|
1251
|
-
|
|
1256
|
+
et(e.latitude, e.longitude);
|
|
1252
1257
|
let i = {
|
|
1253
1258
|
...r,
|
|
1254
1259
|
lat_val: e.latitude,
|
|
@@ -1280,10 +1285,10 @@ var ct = class {
|
|
|
1280
1285
|
return this.makeRequest(J.GET_NAWS_DUMP, e, q.CSV);
|
|
1281
1286
|
}
|
|
1282
1287
|
async getServerInfo() {
|
|
1283
|
-
return
|
|
1288
|
+
return at((await this.makeRequest(J.GET_SERVER_INFO))[0]);
|
|
1284
1289
|
}
|
|
1285
1290
|
async getCoverageArea() {
|
|
1286
|
-
return
|
|
1291
|
+
return ot((await this.makeRequest(J.GET_COVERAGE_AREA))[0]);
|
|
1287
1292
|
}
|
|
1288
1293
|
async geocodeAddress(e, t) {
|
|
1289
1294
|
if (!this.geocodingService) throw Error("Geocoding is not enabled. Initialize client with enableGeocoding: true");
|
|
@@ -1297,7 +1302,7 @@ var ct = class {
|
|
|
1297
1302
|
return this.serverURL;
|
|
1298
1303
|
}
|
|
1299
1304
|
setServerURL(e) {
|
|
1300
|
-
this.serverURL =
|
|
1305
|
+
this.serverURL = Ze(e);
|
|
1301
1306
|
}
|
|
1302
1307
|
getDefaultFormat() {
|
|
1303
1308
|
return this.defaultFormat;
|
|
@@ -1330,7 +1335,7 @@ var ct = class {
|
|
|
1330
1335
|
}
|
|
1331
1336
|
}, $ = class e {
|
|
1332
1337
|
constructor(e) {
|
|
1333
|
-
|
|
1338
|
+
g(this, "params", {}), g(this, "client", void 0), this.client = e;
|
|
1334
1339
|
}
|
|
1335
1340
|
meetingIds(e, t = !1) {
|
|
1336
1341
|
return Array.isArray(e) ? this.params.meeting_ids = t ? e.map((e) => -e) : e : this.params.meeting_ids = t ? -e : e, this;
|
|
@@ -1408,6 +1413,12 @@ var ct = class {
|
|
|
1408
1413
|
sortByDistance() {
|
|
1409
1414
|
return this.params.sort_results_by_distance = !0, this;
|
|
1410
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
|
+
}
|
|
1411
1422
|
paginate(e, t = 1) {
|
|
1412
1423
|
return this.params.page_size = e, this.params.page_num = t, this;
|
|
1413
1424
|
}
|
|
@@ -1458,9 +1469,9 @@ var ct = class {
|
|
|
1458
1469
|
searchParams: this.params
|
|
1459
1470
|
});
|
|
1460
1471
|
}
|
|
1461
|
-
},
|
|
1472
|
+
}, ct = class {
|
|
1462
1473
|
constructor(e) {
|
|
1463
|
-
|
|
1474
|
+
g(this, "client", void 0), this.client = e;
|
|
1464
1475
|
}
|
|
1465
1476
|
today() {
|
|
1466
1477
|
let e = (/* @__PURE__ */ new Date()).getDay(), t = e === 0 ? Y.SUNDAY : e;
|
|
@@ -1484,26 +1495,30 @@ var ct = class {
|
|
|
1484
1495
|
inPerson() {
|
|
1485
1496
|
return new $(this.client).inPersonOnly();
|
|
1486
1497
|
}
|
|
1498
|
+
virtualSoonest(e) {
|
|
1499
|
+
let t = new $(this.client).virtualOrHybrid().sortByNextStart();
|
|
1500
|
+
return e ? t.targetTimeZone(e) : t;
|
|
1501
|
+
}
|
|
1487
1502
|
byText(e) {
|
|
1488
1503
|
return new $(this.client).searchText(e);
|
|
1489
1504
|
}
|
|
1490
|
-
},
|
|
1505
|
+
}, lt = [
|
|
1491
1506
|
"weekday_tinyint",
|
|
1492
1507
|
"start_time",
|
|
1493
1508
|
"meeting_name",
|
|
1494
1509
|
"location_text"
|
|
1495
1510
|
];
|
|
1496
|
-
function
|
|
1511
|
+
function ut(e, t) {
|
|
1497
1512
|
let n = e == null ? "" : String(e);
|
|
1498
1513
|
return t ? n.toLowerCase().trim() : n;
|
|
1499
1514
|
}
|
|
1500
|
-
function
|
|
1501
|
-
return t.map((t) =>
|
|
1515
|
+
function dt(e, t, n) {
|
|
1516
|
+
return t.map((t) => ut(e[t], n)).join(" | ");
|
|
1502
1517
|
}
|
|
1503
|
-
function
|
|
1504
|
-
let { fields: n =
|
|
1518
|
+
function ft(e, t = {}) {
|
|
1519
|
+
let { fields: n = lt, normalize: r = !0 } = t, i = /* @__PURE__ */ new Map();
|
|
1505
1520
|
for (let t = 0; t < e.length; t++) for (let a of e[t]) {
|
|
1506
|
-
let e =
|
|
1521
|
+
let e = dt(a, n, r);
|
|
1507
1522
|
i.has(e) || i.set(e, []), i.get(e).push({
|
|
1508
1523
|
meeting: a,
|
|
1509
1524
|
listIndex: t
|
|
@@ -1516,18 +1531,17 @@ function pt(e, t = {}) {
|
|
|
1516
1531
|
});
|
|
1517
1532
|
return a;
|
|
1518
1533
|
}
|
|
1519
|
-
function
|
|
1520
|
-
let t = /* @__PURE__ */ new
|
|
1521
|
-
for (let
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
return n;
|
|
1534
|
+
function pt(e) {
|
|
1535
|
+
let t = /* @__PURE__ */ new Set();
|
|
1536
|
+
for (let n of e) {
|
|
1537
|
+
let e = n.service_body_bigint, r = n.meeting_name;
|
|
1538
|
+
if (!e || !r) continue;
|
|
1539
|
+
let i = r.trim().toLowerCase(), a = n.venue_type === 2 ? `${n.virtual_meeting_link ?? ""}|${n.virtual_meeting_additional_info ?? ""}` : `${n.latitude.toFixed(6)}|${n.longitude.toFixed(6)}`;
|
|
1540
|
+
t.add(`${e}|${i}|${a}`);
|
|
1541
|
+
}
|
|
1542
|
+
return t.size;
|
|
1529
1543
|
}
|
|
1530
1544
|
//#endregion
|
|
1531
|
-
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 };
|
|
1532
1546
|
|
|
1533
1547
|
//# sourceMappingURL=app.js.map
|