bmlt-query-client 1.0.7 → 1.0.8

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.
@@ -87,7 +87,7 @@ import { BmltClient, Weekday, VenueType } from 'bmlt-query-client';
87
87
 
88
88
  // Initialize client with NYC demo server
89
89
  const client = new BmltClient({
90
- rootServerURL: 'https://latest.aws.bmlt.app/main_server',
90
+ serverURL: 'https://latest.aws.bmlt.app/main_server',
91
91
  });
92
92
 
93
93
  // Search by address with automatic geocoding
package/README.md CHANGED
@@ -38,7 +38,7 @@ The easiest way to use the BMLT Query Client in the browser is via ES modules:
38
38
 
39
39
  // Initialize the client
40
40
  const client = new BmltClient({
41
- rootServerURL: 'https://latest.aws.bmlt.app/main_server', // NYC demo server
41
+ serverURL: 'https://latest.aws.bmlt.app/main_server', // NYC demo server
42
42
  });
43
43
 
44
44
  // Search for virtual meetings
@@ -72,7 +72,7 @@ npm install bmlt-query-client
72
72
  import { BmltClient, VenueType, MeetingQueryBuilder } from 'bmlt-query-client';
73
73
 
74
74
  const client = new BmltClient({
75
- rootServerURL: 'https://your-bmlt-server.org/main_server',
75
+ serverURL: 'https://your-bmlt-server.org/main_server',
76
76
  });
77
77
 
78
78
  // Search for meetings
@@ -253,9 +253,9 @@ console.log(client.getUserAgent()); // 'my-updated-app/2.0.0'
253
253
  client.setTimeout(60000); // 60 seconds
254
254
  console.log(client.getTimeout()); // 60000
255
255
 
256
- // Update root server URL
257
- client.setRootServerURL('https://new-server.org/main_server');
258
- console.log(client.getRootServerURL());
256
+ // Update server URL
257
+ client.setServerURL('https://new-server.org/main_server');
258
+ console.log(client.getServerURL());
259
259
 
260
260
  // Update default data format
261
261
  client.setDefaultFormat(BmltDataFormat.JSONP);
@@ -266,7 +266,7 @@ console.log(client.getDefaultFormat());
266
266
 
267
267
  ```javascript
268
268
  const client = new BmltClient({
269
- rootServerURL: 'https://your-server.org/main_server', // Required
269
+ serverURL: 'https://your-server.org/main_server', // Required
270
270
  defaultFormat: BmltDataFormat.JSON, // Optional
271
271
  timeout: 30000, // 30 seconds
272
272
  userAgent: 'my-app/1.0.0', // Custom user agent
@@ -283,7 +283,7 @@ const client = new BmltClient({
283
283
 
284
284
  ```javascript
285
285
  const client = new BmltClient({
286
- rootServerURL: 'https://your-server.org/main_server',
286
+ serverURL: 'https://your-server.org/main_server',
287
287
  geocodingOptions: {
288
288
  countryCode: 'us', // ISO country code bias
289
289
  viewbox: [-74.2, 40.4, -73.7, 40.9], // Geographic bounding box [w,s,e,n]
package/dist/app.d.ts CHANGED
@@ -11,7 +11,7 @@ export declare class BmltClient {
11
11
  private timeout;
12
12
  private userAgent;
13
13
  private readonly geocodingService?;
14
- private rootServerURL;
14
+ private serverURL;
15
15
  private defaultFormat;
16
16
  constructor(options: BmltClientOptions);
17
17
  /**
@@ -81,13 +81,13 @@ export declare class BmltClient {
81
81
  */
82
82
  reverseGeocode(coordinates: Coordinates, options?: Partial<GeocodeOptions>): Promise<GeocodeResult>;
83
83
  /**
84
- * Get the root server URL
84
+ * Get the server URL
85
85
  */
86
- getRootServerURL(): string;
86
+ getServerURL(): string;
87
87
  /**
88
- * Update the root server URL
88
+ * Update the server URL
89
89
  */
90
- setRootServerURL(url: string): void;
90
+ setServerURL(url: string): void;
91
91
  /**
92
92
  * Get the default data format
93
93
  */
@@ -126,8 +126,8 @@ export declare class BmltClient {
126
126
  }
127
127
 
128
128
  export declare interface BmltClientOptions {
129
- /** Root server URL */
130
- rootServerURL: string;
129
+ /** Server URL */
130
+ serverURL: string;
131
131
  /** Default data format */
132
132
  defaultFormat?: BmltDataFormat;
133
133
  /** HTTP request timeout in milliseconds */
@@ -713,9 +713,9 @@ export declare class MeetingQueryBuilder {
713
713
  */
714
714
  formatsOnly(): this;
715
715
  /**
716
- * Filter by root server IDs (aggregator mode)
716
+ * Filter by server IDs (aggregator mode)
717
717
  */
718
- rootServerIds(serverIds: number | number[], exclude?: boolean): this;
718
+ serverIds(serverIds: number | number[], exclude?: boolean): this;
719
719
  /**
720
720
  * Get the current query parameters
721
721
  */
@@ -927,8 +927,8 @@ export declare interface SearchResultsParams extends BaseSearchParams {
927
927
  page_num?: number;
928
928
  /** Published status: undefined=published only, 0=all, -1=unpublished only */
929
929
  advanced_published?: 0 | -1;
930
- /** Include specific root server IDs (for aggregator mode) */
931
- root_server_ids?: number | number[];
930
+ /** Include specific server IDs (for aggregator mode) */
931
+ server_ids?: number | number[];
932
932
  }
933
933
 
934
934
  export declare interface ServerInfo {
@@ -989,7 +989,7 @@ export declare enum SortKey {
989
989
  }
990
990
 
991
991
  export declare interface URLBuilderOptions {
992
- rootServerURL: string;
992
+ serverURL: string;
993
993
  format: BmltDataFormat;
994
994
  endpoint: BmltEndpoint;
995
995
  parameters?: Record<string, unknown>;
@@ -1011,9 +1011,9 @@ export declare function validateEndpointFormat(endpoint: BmltEndpoint, format: B
1011
1011
  export declare function validateRadius(radius: number): void;
1012
1012
 
1013
1013
  /**
1014
- * Clean and validate a root server URL
1014
+ * Clean and validate a server URL
1015
1015
  */
1016
- export declare function validateRootServerURL(url: string): string;
1016
+ export declare function validateServerURL(url: string): string;
1017
1017
 
1018
1018
  export declare enum VenueType {
1019
1019
  IN_PERSON = 1,
package/dist/app.js CHANGED
@@ -1011,7 +1011,7 @@ var W = /* @__PURE__ */ function(e) {
1011
1011
  //#endregion
1012
1012
  //#region src/utils/url-builder.ts
1013
1013
  function Ue(e) {
1014
- let { rootServerURL: t, format: n, endpoint: r, parameters: i = {} } = e, a = `${t.endsWith("/") ? t : `${t}/`}client_interface/${n}/`, o = new URLSearchParams();
1014
+ let { serverURL: t, format: n, endpoint: r, parameters: i = {} } = e, a = `${t.endsWith("/") ? t : `${t}/`}client_interface/${n}/`, o = new URLSearchParams();
1015
1015
  return o.set("switcher", r), Object.entries(i).forEach(([e, t]) => {
1016
1016
  t != null && (Array.isArray(t) ? t.forEach((t, n) => {
1017
1017
  (typeof t == "number" || typeof t == "string") && o.append(`${e}[]`, t.toString());
@@ -1057,10 +1057,10 @@ function Ge(e, t) {
1057
1057
  function Ke(e) {
1058
1058
  try {
1059
1059
  let t = new URL(e);
1060
- if (!["http:", "https:"].includes(t.protocol)) throw Error("Root server URL must use http or https protocol");
1060
+ if (!["http:", "https:"].includes(t.protocol)) throw Error("Server URL must use http or https protocol");
1061
1061
  return t.href.replace(/\/$/, "");
1062
1062
  } catch (t) {
1063
- let n = /* @__PURE__ */ Error(`Invalid root server URL: ${e}`);
1063
+ let n = /* @__PURE__ */ Error(`Invalid server URL: ${e}`);
1064
1064
  throw n.cause = t, n;
1065
1065
  }
1066
1066
  }
@@ -1099,16 +1099,16 @@ function Ze(e) {
1099
1099
  //#region src/client/bmlt-client.ts
1100
1100
  var Qe = class {
1101
1101
  constructor(e) {
1102
- v(this, "timeout", void 0), v(this, "userAgent", void 0), v(this, "geocodingService", void 0), v(this, "rootServerURL", void 0), v(this, "defaultFormat", void 0);
1103
- let { rootServerURL: t, defaultFormat: n = J.JSON, timeout: r = 3e4, userAgent: i = "bmlt-query-client/1.0.0", geocodingOptions: a = {}, enableGeocoding: o = !0 } = e;
1104
- this.rootServerURL = Ke(t), this.defaultFormat = n, this.timeout = r, this.userAgent = i, o && (this.geocodingService = new Be(a));
1102
+ v(this, "timeout", void 0), v(this, "userAgent", void 0), v(this, "geocodingService", void 0), v(this, "serverURL", void 0), v(this, "defaultFormat", void 0);
1103
+ let { serverURL: t, defaultFormat: n = J.JSON, timeout: r = 3e4, userAgent: i = "bmlt-query-client/1.0.0", geocodingOptions: a = {}, enableGeocoding: o = !0 } = e;
1104
+ this.serverURL = Ke(t), this.defaultFormat = n, this.timeout = r, this.userAgent = i, o && (this.geocodingService = new Be(a));
1105
1105
  }
1106
1106
  async makeRequest(e, t = {}, n = this.defaultFormat) {
1107
1107
  let r;
1108
1108
  try {
1109
1109
  Ge(e, n);
1110
1110
  let i = Ue({
1111
- rootServerURL: this.rootServerURL,
1111
+ serverURL: this.serverURL,
1112
1112
  format: n,
1113
1113
  endpoint: e,
1114
1114
  parameters: t
@@ -1202,11 +1202,11 @@ var Qe = class {
1202
1202
  if (!this.geocodingService) throw Error("Geocoding is not enabled. Initialize client with enableGeocoding: true");
1203
1203
  return this.geocodingService.reverseGeocode(e, t);
1204
1204
  }
1205
- getRootServerURL() {
1206
- return this.rootServerURL;
1205
+ getServerURL() {
1206
+ return this.serverURL;
1207
1207
  }
1208
- setRootServerURL(e) {
1209
- this.rootServerURL = Ke(e);
1208
+ setServerURL(e) {
1209
+ this.serverURL = Ke(e);
1210
1210
  }
1211
1211
  getDefaultFormat() {
1212
1212
  return this.defaultFormat;
@@ -1335,8 +1335,8 @@ var Qe = class {
1335
1335
  formatsOnly() {
1336
1336
  return this.params.get_used_formats = !0, this.params.get_formats_only = !0, this;
1337
1337
  }
1338
- rootServerIds(e, t = !1) {
1339
- return Array.isArray(e) ? this.params.root_server_ids = t ? e.map((e) => -e) : e : this.params.root_server_ids = t ? -e : e, this;
1338
+ serverIds(e, t = !1) {
1339
+ return Array.isArray(e) ? this.params.server_ids = t ? e.map((e) => -e) : e : this.params.server_ids = t ? -e : e, this;
1340
1340
  }
1341
1341
  getParams() {
1342
1342
  return { ...this.params };
@@ -1395,6 +1395,6 @@ var Qe = class {
1395
1395
  }
1396
1396
  };
1397
1397
  //#endregion
1398
- export { Qe as BmltClient, J as BmltDataFormat, Y as BmltEndpoint, W as BmltErrorType, G as BmltQueryError, K as ErrorFactory, q as ErrorHandler, Be as GeocodingService, He as Language, $ as MeetingQueryBuilder, $e as QuickSearch, ze as RetryHandler, Ve as SortKey, Z as VenueType, X as Weekday, Ue as buildBmltURL, qe as extractIds, Je as formatTimeValue, Ze as kilometersToMiles, Xe as milesToKilometers, We as normalizeParameters, Ye as validateCoordinates, Ge as validateEndpointFormat, Q as validateRadius, Ke as validateRootServerURL };
1398
+ export { Qe as BmltClient, J as BmltDataFormat, Y as BmltEndpoint, W as BmltErrorType, G as BmltQueryError, K as ErrorFactory, q as ErrorHandler, Be as GeocodingService, He as Language, $ as MeetingQueryBuilder, $e as QuickSearch, ze as RetryHandler, Ve as SortKey, Z as VenueType, X as Weekday, Ue as buildBmltURL, qe as extractIds, Je as formatTimeValue, Ze as kilometersToMiles, Xe as milesToKilometers, We as normalizeParameters, Ye as validateCoordinates, Ge as validateEndpointFormat, Q as validateRadius, Ke as validateServerURL };
1399
1399
 
1400
1400
  //# sourceMappingURL=app.js.map
package/dist/app.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","names":["EventEmitter"],"sources":["../node_modules/is-network-error/index.js","../node_modules/p-retry/index.js","../node_modules/eventemitter3/index.js","../node_modules/eventemitter3/index.mjs","../node_modules/p-timeout/index.js","../node_modules/p-queue/dist/lower-bound.js","../node_modules/p-queue/dist/priority-queue.js","../node_modules/p-queue/dist/index.js","../src/utils/errors.ts","../src/services/geocoding.ts","../src/types/base.ts","../src/utils/url-builder.ts","../src/client/bmlt-client.ts","../src/client/query-builder.ts"],"sourcesContent":["const objectToString = Object.prototype.toString;\n\nconst isError = value => objectToString.call(value) === '[object Error]';\n\nconst errorMessages = new Set([\n\t'network error', // Chrome\n\t'NetworkError when attempting to fetch resource.', // Firefox\n\t'The Internet connection appears to be offline.', // Safari 16\n\t'Network request failed', // `cross-fetch`\n\t'fetch failed', // Undici (Node.js)\n\t'terminated', // Undici (Node.js)\n\t' A network error occurred.', // Bun (WebKit)\n\t'Network connection lost', // Cloudflare Workers (fetch)\n]);\n\nexport default function isNetworkError(error) {\n\tconst isValid = error\n\t\t&& isError(error)\n\t\t&& error.name === 'TypeError'\n\t\t&& typeof error.message === 'string';\n\n\tif (!isValid) {\n\t\treturn false;\n\t}\n\n\tconst {message, stack} = error;\n\n\t// Safari 17+ has generic message but no stack for network errors\n\tif (message === 'Load failed') {\n\t\treturn stack === undefined\n\t\t\t// Sentry adds its own stack trace to the fetch error, so also check for that\n\t\t\t|| '__sentry_captured__' in error;\n\t}\n\n\t// Deno network errors start with specific text\n\tif (message.startsWith('error sending request for url')) {\n\t\treturn true;\n\t}\n\n\t// Chrome: exact \"Failed to fetch\" or with hostname: \"Failed to fetch (example.com)\"\n\tif (message === 'Failed to fetch' || (message.startsWith('Failed to fetch (') && message.endsWith(')'))) {\n\t\treturn true;\n\t}\n\n\t// Standard network error messages\n\treturn errorMessages.has(message);\n}\n","import isNetworkError from 'is-network-error';\n\nfunction validateRetries(retries) {\n\tif (typeof retries === 'number') {\n\t\tif (retries < 0) {\n\t\t\tthrow new TypeError('Expected `retries` to be a non-negative number.');\n\t\t}\n\n\t\tif (Number.isNaN(retries)) {\n\t\t\tthrow new TypeError('Expected `retries` to be a valid number or Infinity, got NaN.');\n\t\t}\n\t} else if (retries !== undefined) {\n\t\tthrow new TypeError('Expected `retries` to be a number or Infinity.');\n\t}\n}\n\nfunction validateNumberOption(name, value, {min = 0, allowInfinity = false} = {}) {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof value !== 'number' || Number.isNaN(value)) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be a number${allowInfinity ? ' or Infinity' : ''}.`);\n\t}\n\n\tif (!allowInfinity && !Number.isFinite(value)) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be a finite number.`);\n\t}\n\n\tif (value < min) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be \\u2265 ${min}.`);\n\t}\n}\n\nfunction validateFunctionOption(name, value) {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof value !== 'function') {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be a function.`);\n\t}\n}\n\nexport class AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\n\t\tif (message instanceof Error) {\n\t\t\tthis.originalError = message;\n\t\t\t({message} = message);\n\t\t} else {\n\t\t\tthis.originalError = new Error(message);\n\t\t\tthis.originalError.stack = this.stack;\n\t\t}\n\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\nfunction calculateDelay(retriesConsumed, options) {\n\tconst attempt = Math.max(1, retriesConsumed + 1);\n\tconst random = options.randomize ? (Math.random() + 1) : 1;\n\n\tlet timeout = Math.round(random * options.minTimeout * (options.factor ** (attempt - 1)));\n\ttimeout = Math.min(timeout, options.maxTimeout);\n\n\treturn timeout;\n}\n\nfunction calculateRemainingTime(start, max) {\n\tif (!Number.isFinite(max)) {\n\t\treturn max;\n\t}\n\n\treturn max - (performance.now() - start);\n}\n\nasync function delayForRetry(delay, options) {\n\tif (delay <= 0) {\n\t\treturn;\n\t}\n\n\tawait new Promise((resolve, reject) => {\n\t\tconst onAbort = () => {\n\t\t\tclearTimeout(timeoutToken);\n\t\t\toptions.signal?.removeEventListener('abort', onAbort);\n\t\t\treject(options.signal.reason);\n\t\t};\n\n\t\tconst timeoutToken = setTimeout(() => {\n\t\t\toptions.signal?.removeEventListener('abort', onAbort);\n\t\t\tresolve();\n\t\t}, delay);\n\n\t\tif (options.unref) {\n\t\t\ttimeoutToken.unref?.();\n\t\t}\n\n\t\toptions.signal?.addEventListener('abort', onAbort, {once: true});\n\t});\n}\n\nasync function onAttemptFailure({error, attemptNumber, retriesConsumed, startTime, options}) {\n\tconst normalizedError = error instanceof Error\n\t\t? error\n\t\t: new TypeError(`Non-error was thrown: \"${error}\". You should only throw errors.`);\n\n\tif (normalizedError instanceof AbortError) {\n\t\tthrow normalizedError.originalError;\n\t}\n\n\tconst retriesLeft = Number.isFinite(options.retries)\n\t\t? Math.max(0, options.retries - retriesConsumed)\n\t\t: options.retries;\n\n\tconst maxRetryTime = options.maxRetryTime ?? Number.POSITIVE_INFINITY;\n\tconst delayTime = calculateDelay(retriesConsumed, options);\n\tconst remainingTimeBeforeCallbacks = calculateRemainingTime(startTime, maxRetryTime);\n\n\tif (remainingTimeBeforeCallbacks <= 0) {\n\t\tconst context = Object.freeze({\n\t\t\terror: normalizedError,\n\t\t\tattemptNumber,\n\t\t\tretriesLeft,\n\t\t\tretriesConsumed,\n\t\t\tretryDelay: 0,\n\t\t});\n\n\t\tawait options.onFailedAttempt(context);\n\n\t\tthrow normalizedError;\n\t}\n\n\tconst consumeRetryContext = Object.freeze({\n\t\terror: normalizedError,\n\t\tattemptNumber,\n\t\tretriesLeft,\n\t\tretriesConsumed,\n\t\tretryDelay: retriesLeft > 0 ? delayTime : 0,\n\t});\n\n\tconst consumeRetry = await options.shouldConsumeRetry(consumeRetryContext);\n\tconst effectiveDelay = consumeRetry && retriesLeft > 0 ? delayTime : 0;\n\tconst context = Object.freeze({\n\t\terror: normalizedError,\n\t\tattemptNumber,\n\t\tretriesLeft,\n\t\tretriesConsumed,\n\t\tretryDelay: effectiveDelay,\n\t});\n\n\tawait options.onFailedAttempt(context);\n\n\tif (calculateRemainingTime(startTime, maxRetryTime) <= 0) {\n\t\tthrow normalizedError;\n\t}\n\n\tconst remainingTime = calculateRemainingTime(startTime, maxRetryTime);\n\n\tif (remainingTime <= 0 || retriesLeft <= 0) {\n\t\tthrow normalizedError;\n\t}\n\n\tif (normalizedError instanceof TypeError && !isNetworkError(normalizedError)) {\n\t\tthrow normalizedError;\n\t}\n\n\tif (!await options.shouldRetry(context)) {\n\t\tthrow normalizedError;\n\t}\n\n\tconst remainingTimeAfterShouldRetry = calculateRemainingTime(startTime, maxRetryTime);\n\n\tif (remainingTimeAfterShouldRetry <= 0) {\n\t\tthrow normalizedError;\n\t}\n\n\tif (!consumeRetry) {\n\t\toptions.signal?.throwIfAborted();\n\t\treturn false;\n\t}\n\n\tconst finalDelay = Math.min(effectiveDelay, remainingTimeAfterShouldRetry);\n\n\toptions.signal?.throwIfAborted();\n\n\tawait delayForRetry(finalDelay, options);\n\n\toptions.signal?.throwIfAborted();\n\n\treturn true;\n}\n\nexport default async function pRetry(input, options = {}) {\n\toptions = {...options};\n\n\tvalidateRetries(options.retries);\n\n\tif (Object.hasOwn(options, 'forever')) {\n\t\tthrow new Error('The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.');\n\t}\n\n\toptions.retries ??= 10;\n\toptions.factor ??= 2;\n\toptions.minTimeout ??= 1000;\n\toptions.maxTimeout ??= Number.POSITIVE_INFINITY;\n\toptions.maxRetryTime ??= Number.POSITIVE_INFINITY;\n\toptions.randomize ??= false;\n\toptions.onFailedAttempt ??= () => {};\n\toptions.shouldRetry ??= () => true;\n\toptions.shouldConsumeRetry ??= () => true;\n\n\t// Validate numeric options and normalize edge cases\n\tvalidateFunctionOption('onFailedAttempt', options.onFailedAttempt);\n\tvalidateFunctionOption('shouldRetry', options.shouldRetry);\n\tvalidateFunctionOption('shouldConsumeRetry', options.shouldConsumeRetry);\n\tvalidateNumberOption('factor', options.factor, {min: 0, allowInfinity: false});\n\tvalidateNumberOption('minTimeout', options.minTimeout, {min: 0, allowInfinity: false});\n\tvalidateNumberOption('maxTimeout', options.maxTimeout, {min: 0, allowInfinity: true});\n\tvalidateNumberOption('maxRetryTime', options.maxRetryTime, {min: 0, allowInfinity: true});\n\n\t// Treat non-positive factor as 1 to avoid zero backoff or negative behavior\n\tif (!(options.factor > 0)) {\n\t\toptions.factor = 1;\n\t}\n\n\toptions.signal?.throwIfAborted();\n\n\tlet attemptNumber = 0;\n\tlet retriesConsumed = 0;\n\tconst startTime = performance.now();\n\n\twhile (Number.isFinite(options.retries) ? retriesConsumed <= options.retries : true) {\n\t\tattemptNumber++;\n\n\t\ttry {\n\t\t\toptions.signal?.throwIfAborted();\n\n\t\t\tconst result = await input(attemptNumber);\n\n\t\t\toptions.signal?.throwIfAborted();\n\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (await onAttemptFailure({\n\t\t\t\terror,\n\t\t\t\tattemptNumber,\n\t\t\t\tretriesConsumed,\n\t\t\t\tstartTime,\n\t\t\t\toptions,\n\t\t\t})) {\n\t\t\t\tretriesConsumed++;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Should not reach here, but in case it does, throw an error\n\tthrow new Error('Retry attempts exhausted without throwing an error.');\n}\n\nexport function makeRetriable(function_, options) {\n\treturn function (...arguments_) {\n\t\treturn pRetry(() => function_.apply(this, arguments_), options);\n\t};\n}\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","import EventEmitter from './index.js'\n\nexport { EventEmitter }\nexport default EventEmitter\n","export class TimeoutError extends Error {\n\tname = 'TimeoutError';\n\n\tconstructor(message, options) {\n\t\tsuper(message, options);\n\t\tError.captureStackTrace?.(this, TimeoutError);\n\t}\n}\n\nconst getAbortedReason = signal => signal.reason ?? new DOMException('This operation was aborted.', 'AbortError');\n\nexport default function pTimeout(promise, options) {\n\tconst {\n\t\tmilliseconds,\n\t\tfallback,\n\t\tmessage,\n\t\tcustomTimers = {setTimeout, clearTimeout},\n\t\tsignal,\n\t} = options;\n\n\tlet timer;\n\tlet abortHandler;\n\n\tconst wrappedPromise = new Promise((resolve, reject) => {\n\t\tif (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {\n\t\t\tthrow new TypeError(`Expected \\`milliseconds\\` to be a positive number, got \\`${milliseconds}\\``);\n\t\t}\n\n\t\tif (signal?.aborted) {\n\t\t\treject(getAbortedReason(signal));\n\t\t\treturn;\n\t\t}\n\n\t\tif (signal) {\n\t\t\tabortHandler = () => {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t};\n\n\t\t\tsignal.addEventListener('abort', abortHandler, {once: true});\n\t\t}\n\n\t\t// Use .then() instead of async IIFE to preserve stack traces\n\t\t// eslint-disable-next-line promise/prefer-await-to-then, promise/prefer-catch\n\t\tpromise.then(resolve, reject);\n\n\t\tif (milliseconds === Number.POSITIVE_INFINITY) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We create the error outside of `setTimeout` to preserve the stack trace.\n\t\tconst timeoutError = new TimeoutError();\n\n\t\t// `.call(undefined, ...)` is needed for custom timers to avoid context issues\n\t\ttimer = customTimers.setTimeout.call(undefined, () => {\n\t\t\tif (fallback) {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(fallback());\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (typeof promise.cancel === 'function') {\n\t\t\t\tpromise.cancel();\n\t\t\t}\n\n\t\t\tif (message === false) {\n\t\t\t\tresolve();\n\t\t\t} else if (message instanceof Error) {\n\t\t\t\treject(message);\n\t\t\t} else {\n\t\t\t\ttimeoutError.message = message ?? `Promise timed out after ${milliseconds} milliseconds`;\n\t\t\t\treject(timeoutError);\n\t\t\t}\n\t\t}, milliseconds);\n\t});\n\n\t// eslint-disable-next-line promise/prefer-await-to-then\n\tconst cancelablePromise = wrappedPromise.finally(() => {\n\t\tcancelablePromise.clear();\n\t\tif (abortHandler && signal) {\n\t\t\tsignal.removeEventListener('abort', abortHandler);\n\t\t}\n\t});\n\n\tcancelablePromise.clear = () => {\n\t\t// `.call(undefined, ...)` is needed for custom timers to avoid context issues\n\t\tcustomTimers.clearTimeout.call(undefined, timer);\n\t\ttimer = undefined;\n\t};\n\n\treturn cancelablePromise;\n}\n","// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound\n// Used to compute insertion index to keep queue sorted after insertion\nexport default function lowerBound(array, value, comparator) {\n let first = 0;\n let count = array.length;\n while (count > 0) {\n const step = Math.trunc(count / 2);\n let it = first + step;\n if (comparator(array[it], value) <= 0) {\n first = ++it;\n count -= step + 1;\n }\n else {\n count = step;\n }\n }\n return first;\n}\n","import lowerBound from './lower-bound.js';\nexport default class PriorityQueue {\n #queue = [];\n enqueue(run, options) {\n const { priority = 0, id, } = options ?? {};\n const element = {\n priority,\n id,\n run,\n };\n if (this.size === 0 || this.#queue[this.size - 1].priority >= priority) {\n this.#queue.push(element);\n return;\n }\n const index = lowerBound(this.#queue, element, (a, b) => b.priority - a.priority);\n this.#queue.splice(index, 0, element);\n }\n setPriority(id, priority) {\n const index = this.#queue.findIndex((element) => element.id === id);\n if (index === -1) {\n throw new ReferenceError(`No promise function with the id \"${id}\" exists in the queue.`);\n }\n const [item] = this.#queue.splice(index, 1);\n this.enqueue(item.run, { priority, id });\n }\n dequeue() {\n const item = this.#queue.shift();\n return item?.run;\n }\n filter(options) {\n return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);\n }\n get size() {\n return this.#queue.length;\n }\n}\n","import { EventEmitter } from 'eventemitter3';\nimport pTimeout from 'p-timeout';\nimport PriorityQueue from './priority-queue.js';\n/**\nPromise queue with concurrency control.\n*/\nexport default class PQueue extends EventEmitter {\n #carryoverIntervalCount;\n #isIntervalIgnored;\n #intervalCount = 0;\n #intervalCap;\n #rateLimitedInInterval = false;\n #rateLimitFlushScheduled = false;\n #interval;\n #intervalEnd = 0;\n #lastExecutionTime = 0;\n #intervalId;\n #timeoutId;\n #strict;\n // Circular buffer implementation for better performance\n #strictTicks = [];\n #strictTicksStartIndex = 0;\n #queue;\n #queueClass;\n #pending = 0;\n // The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194\n #concurrency;\n #isPaused;\n // Use to assign a unique identifier to a promise function, if not explicitly specified\n #idAssigner = 1n;\n // Track currently running tasks for debugging\n #runningTasks = new Map();\n /**\n Get or set the default timeout for all tasks. Can be changed at runtime.\n\n Operations will throw a `TimeoutError` if they don't complete within the specified time.\n\n The timeout begins when the operation is dequeued and starts execution, not while it's waiting in the queue.\n\n @example\n ```\n const queue = new PQueue({timeout: 5000});\n\n // Change timeout for all future tasks\n queue.timeout = 10000;\n ```\n */\n timeout;\n constructor(options) {\n super();\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n options = {\n carryoverIntervalCount: false,\n intervalCap: Number.POSITIVE_INFINITY,\n interval: 0,\n concurrency: Number.POSITIVE_INFINITY,\n autoStart: true,\n queueClass: PriorityQueue,\n strict: false,\n ...options,\n };\n if (!(typeof options.intervalCap === 'number' && options.intervalCap >= 1)) {\n throw new TypeError(`Expected \\`intervalCap\\` to be a number from 1 and up, got \\`${options.intervalCap?.toString() ?? ''}\\` (${typeof options.intervalCap})`);\n }\n if (options.interval === undefined || !(Number.isFinite(options.interval) && options.interval >= 0)) {\n throw new TypeError(`Expected \\`interval\\` to be a finite number >= 0, got \\`${options.interval?.toString() ?? ''}\\` (${typeof options.interval})`);\n }\n if (options.strict && options.interval === 0) {\n throw new TypeError('The `strict` option requires a non-zero `interval`');\n }\n if (options.strict && options.intervalCap === Number.POSITIVE_INFINITY) {\n throw new TypeError('The `strict` option requires a finite `intervalCap`');\n }\n // TODO: Remove this fallback in the next major version\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this.#carryoverIntervalCount = options.carryoverIntervalCount ?? options.carryoverConcurrencyCount ?? false;\n this.#isIntervalIgnored = options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0;\n this.#intervalCap = options.intervalCap;\n this.#interval = options.interval;\n this.#strict = options.strict;\n this.#queue = new options.queueClass();\n this.#queueClass = options.queueClass;\n this.concurrency = options.concurrency;\n if (options.timeout !== undefined && !(Number.isFinite(options.timeout) && options.timeout > 0)) {\n throw new TypeError(`Expected \\`timeout\\` to be a positive finite number, got \\`${options.timeout}\\` (${typeof options.timeout})`);\n }\n this.timeout = options.timeout;\n this.#isPaused = options.autoStart === false;\n this.#setupRateLimitTracking();\n }\n #cleanupStrictTicks(now) {\n // Remove ticks outside the current interval window using circular buffer approach\n while (this.#strictTicksStartIndex < this.#strictTicks.length) {\n const oldestTick = this.#strictTicks[this.#strictTicksStartIndex];\n if (oldestTick !== undefined && now - oldestTick >= this.#interval) {\n this.#strictTicksStartIndex++;\n }\n else {\n break;\n }\n }\n // Compact the array when it becomes inefficient or fully consumed\n // Compact when: (start index is large AND more than half wasted) OR all ticks expired\n const shouldCompact = (this.#strictTicksStartIndex > 100 && this.#strictTicksStartIndex > this.#strictTicks.length / 2)\n || this.#strictTicksStartIndex === this.#strictTicks.length;\n if (shouldCompact) {\n this.#strictTicks = this.#strictTicks.slice(this.#strictTicksStartIndex);\n this.#strictTicksStartIndex = 0;\n }\n }\n // Helper methods for interval consumption\n #consumeIntervalSlot(now) {\n if (this.#strict) {\n this.#strictTicks.push(now);\n }\n else {\n this.#intervalCount++;\n }\n }\n #rollbackIntervalSlot() {\n if (this.#strict) {\n // Pop from the end of the actual data (not from start index)\n if (this.#strictTicks.length > this.#strictTicksStartIndex) {\n this.#strictTicks.pop();\n }\n }\n else if (this.#intervalCount > 0) {\n this.#intervalCount--;\n }\n }\n #getActiveTicksCount() {\n return this.#strictTicks.length - this.#strictTicksStartIndex;\n }\n get #doesIntervalAllowAnother() {\n if (this.#isIntervalIgnored) {\n return true;\n }\n if (this.#strict) {\n // Cleanup already done by #isIntervalPausedAt before this is called\n return this.#getActiveTicksCount() < this.#intervalCap;\n }\n return this.#intervalCount < this.#intervalCap;\n }\n get #doesConcurrentAllowAnother() {\n return this.#pending < this.#concurrency;\n }\n #next() {\n this.#pending--;\n if (this.#pending === 0) {\n this.emit('pendingZero');\n }\n this.#tryToStartAnother();\n this.emit('next');\n }\n #onResumeInterval() {\n // Clear timeout ID before processing to prevent race condition\n // Must clear before #onInterval to allow new timeouts to be scheduled\n this.#timeoutId = undefined;\n this.#onInterval();\n this.#initializeIntervalIfNeeded();\n }\n #isIntervalPausedAt(now) {\n // Strict mode: check if we need to wait for oldest tick to age out\n if (this.#strict) {\n this.#cleanupStrictTicks(now);\n // If at capacity, need to wait for oldest tick to age out\n const activeTicksCount = this.#getActiveTicksCount();\n if (activeTicksCount >= this.#intervalCap) {\n const oldestTick = this.#strictTicks[this.#strictTicksStartIndex];\n // After cleanup, remaining ticks are within interval, so delay is always > 0\n const delay = this.#interval - (now - oldestTick);\n this.#createIntervalTimeout(delay);\n return true;\n }\n return false;\n }\n // Fixed window mode (original logic)\n if (this.#intervalId === undefined) {\n const delay = this.#intervalEnd - now;\n if (delay < 0) {\n // If the interval has expired while idle, check if we should enforce the interval\n // from the last task execution. This ensures proper spacing between tasks even\n // when the queue becomes empty and then new tasks are added.\n if (this.#lastExecutionTime > 0) {\n const timeSinceLastExecution = now - this.#lastExecutionTime;\n if (timeSinceLastExecution < this.#interval) {\n // Not enough time has passed since the last task execution\n this.#createIntervalTimeout(this.#interval - timeSinceLastExecution);\n return true;\n }\n }\n // Enough time has passed or no previous execution, allow execution\n this.#intervalCount = (this.#carryoverIntervalCount) ? this.#pending : 0;\n }\n else {\n // Act as the interval is pending\n this.#createIntervalTimeout(delay);\n return true;\n }\n }\n return false;\n }\n #createIntervalTimeout(delay) {\n if (this.#timeoutId !== undefined) {\n return;\n }\n this.#timeoutId = setTimeout(() => {\n this.#onResumeInterval();\n }, delay);\n }\n #clearIntervalTimer() {\n if (this.#intervalId) {\n clearInterval(this.#intervalId);\n this.#intervalId = undefined;\n }\n }\n #clearTimeoutTimer() {\n if (this.#timeoutId) {\n clearTimeout(this.#timeoutId);\n this.#timeoutId = undefined;\n }\n }\n #tryToStartAnother() {\n if (this.#queue.size === 0) {\n // We can clear the interval (\"pause\")\n // Because we can redo it later (\"resume\")\n this.#clearIntervalTimer();\n this.emit('empty');\n if (this.#pending === 0) {\n // Clear timeout as well when completely idle\n this.#clearTimeoutTimer();\n // Compact strict ticks when idle to free memory\n if (this.#strict && this.#strictTicksStartIndex > 0) {\n const now = Date.now();\n this.#cleanupStrictTicks(now);\n }\n this.emit('idle');\n }\n return false;\n }\n let taskStarted = false;\n if (!this.#isPaused) {\n const now = Date.now();\n const canInitializeInterval = !this.#isIntervalPausedAt(now);\n if (this.#doesIntervalAllowAnother && this.#doesConcurrentAllowAnother) {\n const job = this.#queue.dequeue();\n if (!this.#isIntervalIgnored) {\n this.#consumeIntervalSlot(now);\n this.#scheduleRateLimitUpdate();\n }\n this.emit('active');\n job();\n if (canInitializeInterval) {\n this.#initializeIntervalIfNeeded();\n }\n taskStarted = true;\n }\n }\n return taskStarted;\n }\n #initializeIntervalIfNeeded() {\n if (this.#isIntervalIgnored || this.#intervalId !== undefined) {\n return;\n }\n // Strict mode uses timeouts instead of interval timers\n if (this.#strict) {\n return;\n }\n this.#intervalId = setInterval(() => {\n this.#onInterval();\n }, this.#interval);\n this.#intervalEnd = Date.now() + this.#interval;\n }\n #onInterval() {\n // Non-strict mode uses interval timers and intervalCount\n if (!this.#strict) {\n if (this.#intervalCount === 0 && this.#pending === 0 && this.#intervalId) {\n this.#clearIntervalTimer();\n }\n this.#intervalCount = this.#carryoverIntervalCount ? this.#pending : 0;\n }\n this.#processQueue();\n this.#scheduleRateLimitUpdate();\n }\n /**\n Executes all queued functions until it reaches the limit.\n */\n #processQueue() {\n // eslint-disable-next-line no-empty\n while (this.#tryToStartAnother()) { }\n }\n get concurrency() {\n return this.#concurrency;\n }\n set concurrency(newConcurrency) {\n if (!(typeof newConcurrency === 'number' && newConcurrency >= 1)) {\n throw new TypeError(`Expected \\`concurrency\\` to be a number from 1 and up, got \\`${newConcurrency}\\` (${typeof newConcurrency})`);\n }\n this.#concurrency = newConcurrency;\n this.#processQueue();\n }\n /**\n Updates the priority of a promise function by its id, affecting its execution order. Requires a defined concurrency limit to take effect.\n\n For example, this can be used to prioritize a promise function to run earlier.\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 1});\n\n queue.add(async () => '🦄', {priority: 1});\n queue.add(async () => '🦀', {priority: 0, id: '🦀'});\n queue.add(async () => '🦄', {priority: 1});\n queue.add(async () => '🦄', {priority: 1});\n\n queue.setPriority('🦀', 2);\n ```\n\n In this case, the promise function with `id: '🦀'` runs second.\n\n You can also deprioritize a promise function to delay its execution:\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 1});\n\n queue.add(async () => '🦄', {priority: 1});\n queue.add(async () => '🦀', {priority: 1, id: '🦀'});\n queue.add(async () => '🦄');\n queue.add(async () => '🦄', {priority: 0});\n\n queue.setPriority('🦀', -1);\n ```\n Here, the promise function with `id: '🦀'` executes last.\n */\n setPriority(id, priority) {\n if (typeof priority !== 'number' || !Number.isFinite(priority)) {\n throw new TypeError(`Expected \\`priority\\` to be a finite number, got \\`${priority}\\` (${typeof priority})`);\n }\n this.#queue.setPriority(id, priority);\n }\n async add(function_, options = {}) {\n // Create a copy to avoid mutating the original options object\n options = {\n timeout: this.timeout,\n ...options,\n // Assign unique ID if not provided\n id: options.id ?? (this.#idAssigner++).toString(),\n };\n return new Promise((resolve, reject) => {\n // Create a unique symbol for tracking this task\n const taskSymbol = Symbol(`task-${options.id}`);\n this.#queue.enqueue(async () => {\n this.#pending++;\n // Track this running task\n this.#runningTasks.set(taskSymbol, {\n id: options.id,\n priority: options.priority ?? 0, // Match priority-queue default\n startTime: Date.now(),\n timeout: options.timeout,\n });\n let eventListener;\n try {\n // Check abort signal - if aborted, need to decrement the counter\n // that was incremented in tryToStartAnother\n try {\n options.signal?.throwIfAborted();\n }\n catch (error) {\n this.#rollbackIntervalConsumption();\n // Clean up tracking before throwing\n this.#runningTasks.delete(taskSymbol);\n throw error;\n }\n this.#lastExecutionTime = Date.now();\n let operation = function_({ signal: options.signal });\n if (options.timeout) {\n operation = pTimeout(Promise.resolve(operation), {\n milliseconds: options.timeout,\n message: `Task timed out after ${options.timeout}ms (queue has ${this.#pending} running, ${this.#queue.size} waiting)`,\n });\n }\n if (options.signal) {\n const { signal } = options;\n operation = Promise.race([operation, new Promise((_resolve, reject) => {\n eventListener = () => {\n reject(signal.reason);\n };\n signal.addEventListener('abort', eventListener, { once: true });\n })]);\n }\n const result = await operation;\n resolve(result);\n this.emit('completed', result);\n }\n catch (error) {\n reject(error);\n this.emit('error', error);\n }\n finally {\n // Clean up abort event listener\n if (eventListener) {\n options.signal?.removeEventListener('abort', eventListener);\n }\n // Remove from running tasks\n this.#runningTasks.delete(taskSymbol);\n // Use queueMicrotask to prevent deep recursion while maintaining timing\n queueMicrotask(() => {\n this.#next();\n });\n }\n }, options);\n this.emit('add');\n this.#tryToStartAnother();\n });\n }\n async addAll(functions, options) {\n return Promise.all(functions.map(async (function_) => this.add(function_, options)));\n }\n /**\n Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)\n */\n start() {\n if (!this.#isPaused) {\n return this;\n }\n this.#isPaused = false;\n this.#processQueue();\n return this;\n }\n /**\n Put queue execution on hold.\n */\n pause() {\n this.#isPaused = true;\n }\n /**\n Clear the queue.\n */\n clear() {\n this.#queue = new this.#queueClass();\n // Clear interval timer since queue is now empty (consistent with #tryToStartAnother)\n this.#clearIntervalTimer();\n // Note: We preserve strict mode rate-limiting state (ticks and timeout)\n // because clear() only clears queued tasks, not rate limit history.\n // This ensures that rate limits are still enforced after clearing the queue.\n // Note: We don't clear #runningTasks as those tasks are still running\n // They will be removed when they complete in the finally block\n // Force synchronous update since clear() should have immediate effect\n this.#updateRateLimitState();\n // Emit events so waiters (onEmpty, onIdle, onSizeLessThan) can resolve\n this.emit('empty');\n if (this.#pending === 0) {\n this.#clearTimeoutTimer();\n this.emit('idle');\n }\n this.emit('next');\n }\n /**\n Can be called multiple times. Useful if you for example add additional items at a later time.\n\n @returns A promise that settles when the queue becomes empty.\n */\n async onEmpty() {\n // Instantly resolve if the queue is empty\n if (this.#queue.size === 0) {\n return;\n }\n await this.#onEvent('empty');\n }\n /**\n @returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.\n\n If you want to avoid having the queue grow beyond a certain size you can `await queue.onSizeLessThan()` before adding a new item.\n\n Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.\n */\n async onSizeLessThan(limit) {\n // Instantly resolve if the queue is empty.\n if (this.#queue.size < limit) {\n return;\n }\n await this.#onEvent('next', () => this.#queue.size < limit);\n }\n /**\n The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.\n\n @returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.\n */\n async onIdle() {\n // Instantly resolve if none pending and if nothing else is queued\n if (this.#pending === 0 && this.#queue.size === 0) {\n return;\n }\n await this.#onEvent('idle');\n }\n /**\n The difference with `.onIdle` is that `.onPendingZero` only waits for currently running tasks to finish, ignoring queued tasks.\n\n @returns A promise that settles when all currently running tasks have completed; `queue.pending === 0`.\n */\n async onPendingZero() {\n if (this.#pending === 0) {\n return;\n }\n await this.#onEvent('pendingZero');\n }\n /**\n @returns A promise that settles when the queue becomes rate-limited due to intervalCap.\n */\n async onRateLimit() {\n if (this.isRateLimited) {\n return;\n }\n await this.#onEvent('rateLimit');\n }\n /**\n @returns A promise that settles when the queue is no longer rate-limited.\n */\n async onRateLimitCleared() {\n if (!this.isRateLimited) {\n return;\n }\n await this.#onEvent('rateLimitCleared');\n }\n /**\n @returns A promise that rejects when any task in the queue errors.\n\n Use with `Promise.race([queue.onError(), queue.onIdle()])` to fail fast on the first error while still resolving normally when the queue goes idle.\n\n Important: The promise returned by `add()` still rejects. You must handle each `add()` promise (for example, `.catch(() => {})`) to avoid unhandled rejections.\n\n @example\n ```\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 2});\n\n queue.add(() => fetchData(1)).catch(() => {});\n queue.add(() => fetchData(2)).catch(() => {});\n queue.add(() => fetchData(3)).catch(() => {});\n\n // Stop processing on first error\n try {\n await Promise.race([\n queue.onError(),\n queue.onIdle()\n ]);\n } catch (error) {\n queue.pause(); // Stop processing remaining tasks\n console.error('Queue failed:', error);\n }\n ```\n */\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n onError() {\n return new Promise((_resolve, reject) => {\n const handleError = (error) => {\n this.off('error', handleError);\n reject(error);\n };\n this.on('error', handleError);\n });\n }\n async #onEvent(event, filter) {\n return new Promise(resolve => {\n const listener = () => {\n if (filter && !filter()) {\n return;\n }\n this.off(event, listener);\n resolve();\n };\n this.on(event, listener);\n });\n }\n /**\n Size of the queue, the number of queued items waiting to run.\n */\n get size() {\n return this.#queue.size;\n }\n /**\n Size of the queue, filtered by the given options.\n\n For example, this can be used to find the number of items remaining in the queue with a specific priority level.\n */\n sizeBy(options) {\n // eslint-disable-next-line unicorn/no-array-callback-reference\n return this.#queue.filter(options).length;\n }\n /**\n Number of running items (no longer in the queue).\n */\n get pending() {\n return this.#pending;\n }\n /**\n Whether the queue is currently paused.\n */\n get isPaused() {\n return this.#isPaused;\n }\n #setupRateLimitTracking() {\n // Only schedule updates when rate limiting is enabled\n if (this.#isIntervalIgnored) {\n return;\n }\n // Wire up to lifecycle events that affect rate limit state\n // Only 'add' and 'next' can actually change rate limit state\n this.on('add', () => {\n if (this.#queue.size > 0) {\n this.#scheduleRateLimitUpdate();\n }\n });\n this.on('next', () => {\n this.#scheduleRateLimitUpdate();\n });\n }\n #scheduleRateLimitUpdate() {\n // Skip if rate limiting is not enabled or already scheduled\n if (this.#isIntervalIgnored || this.#rateLimitFlushScheduled) {\n return;\n }\n this.#rateLimitFlushScheduled = true;\n queueMicrotask(() => {\n this.#rateLimitFlushScheduled = false;\n this.#updateRateLimitState();\n });\n }\n #rollbackIntervalConsumption() {\n if (this.#isIntervalIgnored) {\n return;\n }\n this.#rollbackIntervalSlot();\n this.#scheduleRateLimitUpdate();\n }\n #updateRateLimitState() {\n const previous = this.#rateLimitedInInterval;\n // Early exit if rate limiting is disabled or queue is empty\n if (this.#isIntervalIgnored || this.#queue.size === 0) {\n if (previous) {\n this.#rateLimitedInInterval = false;\n this.emit('rateLimitCleared');\n }\n return;\n }\n // Get the current count based on mode\n let count;\n if (this.#strict) {\n const now = Date.now();\n this.#cleanupStrictTicks(now);\n count = this.#getActiveTicksCount();\n }\n else {\n count = this.#intervalCount;\n }\n const shouldBeRateLimited = count >= this.#intervalCap;\n if (shouldBeRateLimited !== previous) {\n this.#rateLimitedInInterval = shouldBeRateLimited;\n this.emit(shouldBeRateLimited ? 'rateLimit' : 'rateLimitCleared');\n }\n }\n /**\n Whether the queue is currently rate-limited due to intervalCap.\n */\n get isRateLimited() {\n return this.#rateLimitedInInterval;\n }\n /**\n Whether the queue is saturated. Returns `true` when:\n - All concurrency slots are occupied and tasks are waiting, OR\n - The queue is rate-limited and tasks are waiting\n\n Useful for detecting backpressure and potential hanging tasks.\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 2});\n\n // Backpressure handling\n if (queue.isSaturated) {\n console.log('Queue is saturated, waiting for capacity...');\n await queue.onSizeLessThan(queue.concurrency);\n }\n\n // Monitoring for stuck tasks\n setInterval(() => {\n if (queue.isSaturated) {\n console.warn(`Queue saturated: ${queue.pending} running, ${queue.size} waiting`);\n }\n }, 60000);\n ```\n */\n get isSaturated() {\n return (this.#pending === this.#concurrency && this.#queue.size > 0)\n || (this.isRateLimited && this.#queue.size > 0);\n }\n /**\n The tasks currently being executed. Each task includes its `id`, `priority`, `startTime`, and `timeout` (if set).\n\n Returns an array of task info objects.\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 2});\n\n // Add tasks with IDs for better debugging\n queue.add(() => fetchUser(123), {id: 'user-123'});\n queue.add(() => fetchPosts(456), {id: 'posts-456', priority: 1});\n\n // Check what's running\n console.log(queue.runningTasks);\n // => [{\n // id: 'user-123',\n // priority: 0,\n // startTime: 1759253001716,\n // timeout: undefined\n // }, {\n // id: 'posts-456',\n // priority: 1,\n // startTime: 1759253001916,\n // timeout: undefined\n // }]\n ```\n */\n get runningTasks() {\n // Return fresh array with fresh objects to prevent mutations\n return [...this.#runningTasks.values()].map(task => ({ ...task }));\n }\n}\n/**\nError thrown when a task times out.\n\n@example\n```\nimport PQueue, {TimeoutError} from 'p-queue';\n\nconst queue = new PQueue({timeout: 1000});\n\ntry {\n await queue.add(() => someTask());\n} catch (error) {\n if (error instanceof TimeoutError) {\n console.log('Task timed out');\n }\n}\n```\n*/\nexport { TimeoutError } from 'p-timeout';\n","/**\n * Comprehensive error handling for BMLT Query Client\n */\n\nexport enum BmltErrorType {\n API_ERROR = 'ApiError',\n NETWORK_ERROR = 'NetworkError',\n VALIDATION_ERROR = 'ValidationError',\n GEOCODING_ERROR = 'GeocodingError',\n RATE_LIMIT_ERROR = 'RateLimitError',\n TIMEOUT_ERROR = 'TimeoutError',\n AUTHENTICATION_ERROR = 'AuthenticationError',\n SERVER_ERROR = 'ServerError',\n CLIENT_ERROR = 'ClientError',\n CONFIGURATION_ERROR = 'ConfigurationError',\n}\n\nexport class BmltQueryError extends Error {\n public readonly type: BmltErrorType;\n public readonly statusCode?: number;\n public readonly response?: unknown;\n public readonly originalError?: Error;\n public readonly context?: Record<string, unknown>;\n\n constructor(\n type: BmltErrorType,\n message: string,\n options: {\n statusCode?: number;\n response?: unknown;\n originalError?: Error;\n context?: Record<string, unknown>;\n } = {}\n ) {\n super(message);\n this.name = 'BmltQueryError';\n this.type = type;\n this.statusCode = options.statusCode;\n this.response = options.response;\n this.originalError = options.originalError;\n this.context = options.context;\n\n // Ensure proper prototype chain for instanceof checks\n Object.setPrototypeOf(this, BmltQueryError.prototype);\n }\n\n /**\n * Check if error is of a specific type\n */\n isType(type: BmltErrorType): boolean {\n return this.type === type;\n }\n\n /**\n * Check if error is retryable\n */\n isRetryable(): boolean {\n const retryableTypes = [\n BmltErrorType.NETWORK_ERROR,\n BmltErrorType.TIMEOUT_ERROR,\n BmltErrorType.RATE_LIMIT_ERROR,\n BmltErrorType.SERVER_ERROR,\n ];\n return retryableTypes.includes(this.type);\n }\n\n /**\n * Check if error is a client-side error (4xx)\n */\n isClientError(): boolean {\n return this.statusCode !== undefined && this.statusCode >= 400 && this.statusCode < 500;\n }\n\n /**\n * Check if error is a server-side error (5xx)\n */\n isServerError(): boolean {\n return this.statusCode !== undefined && this.statusCode >= 500;\n }\n\n /**\n * Get a user-friendly error message\n */\n getUserMessage(): string {\n switch (this.type) {\n case BmltErrorType.NETWORK_ERROR:\n return 'Unable to connect to the BMLT server. Please check your internet connection and try again.';\n\n case BmltErrorType.TIMEOUT_ERROR:\n return 'The request timed out. Please try again later.';\n\n case BmltErrorType.RATE_LIMIT_ERROR:\n return 'Too many requests. Please wait a moment and try again.';\n\n case BmltErrorType.GEOCODING_ERROR:\n return 'Unable to find the specified address. Please check the address and try again.';\n\n case BmltErrorType.VALIDATION_ERROR:\n return 'Invalid input provided. Please check your parameters and try again.';\n\n case BmltErrorType.AUTHENTICATION_ERROR:\n return 'Authentication failed. Please check your credentials.';\n\n case BmltErrorType.SERVER_ERROR:\n return 'The BMLT server encountered an error. Please try again later.';\n\n case BmltErrorType.API_ERROR:\n if (this.statusCode === 404) {\n return 'The requested resource was not found.';\n }\n return 'An error occurred while communicating with the BMLT server.';\n\n case BmltErrorType.CONFIGURATION_ERROR:\n return 'Invalid configuration. Please check your settings.';\n\n default:\n return this.message || 'An unexpected error occurred.';\n }\n }\n\n /**\n * Convert error to JSON for logging\n */\n toJSON() {\n return {\n name: this.name,\n type: this.type,\n message: this.message,\n statusCode: this.statusCode,\n response: this.response,\n context: this.context,\n stack: this.stack,\n originalError: this.originalError\n ? {\n name: this.originalError.name,\n message: this.originalError.message,\n stack: this.originalError.stack,\n }\n : undefined,\n };\n }\n}\n\n/**\n * Factory class for creating specific error types\n */\nexport class ErrorFactory {\n static createApiError(\n message: string,\n statusCode?: number,\n response?: unknown,\n originalError?: Error\n ): BmltQueryError {\n let type: BmltErrorType;\n\n if (statusCode) {\n if (statusCode >= 500) {\n type = BmltErrorType.SERVER_ERROR;\n } else if (statusCode === 401 || statusCode === 403) {\n type = BmltErrorType.AUTHENTICATION_ERROR;\n } else if (statusCode === 429) {\n type = BmltErrorType.RATE_LIMIT_ERROR;\n } else if (statusCode >= 400) {\n type = BmltErrorType.CLIENT_ERROR;\n } else {\n type = BmltErrorType.API_ERROR;\n }\n } else {\n type = BmltErrorType.API_ERROR;\n }\n\n return new BmltQueryError(type, message, {\n statusCode,\n response,\n originalError,\n });\n }\n\n static createNetworkError(message: string, originalError?: Error): BmltQueryError {\n return new BmltQueryError(BmltErrorType.NETWORK_ERROR, message, {\n originalError,\n });\n }\n\n static createTimeoutError(message: string, originalError?: Error): BmltQueryError {\n return new BmltQueryError(BmltErrorType.TIMEOUT_ERROR, message, {\n originalError,\n });\n }\n\n static createValidationError(message: string, context?: Record<string, unknown>): BmltQueryError {\n return new BmltQueryError(BmltErrorType.VALIDATION_ERROR, message, {\n context,\n });\n }\n\n static createGeocodingError(\n message: string,\n originalError?: Error,\n context?: Record<string, unknown>\n ): BmltQueryError {\n return new BmltQueryError(BmltErrorType.GEOCODING_ERROR, message, {\n originalError,\n context,\n });\n }\n\n static createRateLimitError(\n message: string,\n statusCode?: number,\n response?: unknown\n ): BmltQueryError {\n return new BmltQueryError(BmltErrorType.RATE_LIMIT_ERROR, message, {\n statusCode,\n response,\n });\n }\n\n static createConfigurationError(\n message: string,\n context?: Record<string, unknown>\n ): BmltQueryError {\n return new BmltQueryError(BmltErrorType.CONFIGURATION_ERROR, message, {\n context,\n });\n }\n}\n\n/**\n * Error handler utility class\n */\nexport class ErrorHandler {\n /**\n * Handle and transform fetch errors\n */\n static handleFetchError(error: unknown, response?: Response): BmltQueryError {\n // Handle AbortError (timeout)\n if (error instanceof Error && error.name === 'AbortError') {\n return ErrorFactory.createTimeoutError('Request timeout', error);\n }\n\n // Handle TypeError (network errors)\n if (error instanceof TypeError) {\n return ErrorFactory.createNetworkError('Network connection failed', error);\n }\n\n if (response && !response.ok) {\n // Server responded with error status\n const message = `HTTP ${response.status}: ${response.statusText}`;\n return ErrorFactory.createApiError(message, response.status, undefined, error as Error);\n }\n\n // Handle other errors\n if (error instanceof Error) {\n return ErrorFactory.createApiError(error.message, undefined, undefined, error);\n }\n\n // Fallback for unknown errors\n return ErrorFactory.createApiError(\n 'Unknown error occurred',\n undefined,\n undefined,\n new Error(String(error))\n );\n }\n\n /**\n * @deprecated Use handleFetchError instead\n */\n static handleAxiosError(error: any): BmltQueryError {\n return ErrorHandler.handleFetchError(error);\n }\n\n /**\n * Handle validation errors with detailed context\n */\n static handleValidationError(\n field: string,\n value: unknown,\n expectedType: string,\n constraints?: string[]\n ): BmltQueryError {\n let message = `Invalid ${field}: expected ${expectedType}`;\n\n if (constraints && constraints.length > 0) {\n message += ` (${constraints.join(', ')})`;\n }\n\n return ErrorFactory.createValidationError(message, {\n field,\n value,\n expectedType,\n constraints,\n });\n }\n\n /**\n * Handle endpoint validation errors\n */\n static handleEndpointError(endpoint: string, format: string): BmltQueryError {\n const message = `Invalid endpoint/format combination: ${endpoint} with ${format}`;\n return ErrorFactory.createValidationError(message, {\n endpoint,\n format,\n });\n }\n\n /**\n * Handle URL validation errors\n */\n static handleUrlError(url: string, reason: string): BmltQueryError {\n const message = `Invalid URL: ${reason}`;\n return ErrorFactory.createValidationError(message, {\n url,\n reason,\n });\n }\n\n /**\n * Handle coordinate validation errors\n */\n static handleCoordinateError(\n latitude?: number,\n longitude?: number,\n reason?: string\n ): BmltQueryError {\n const message = reason || 'Invalid coordinates provided';\n return ErrorFactory.createValidationError(message, {\n latitude,\n longitude,\n reason,\n });\n }\n\n /**\n * Wrap and enhance existing errors\n */\n static wrapError(\n originalError: Error,\n context: string,\n additionalContext?: Record<string, unknown>\n ): BmltQueryError {\n const message = `${context}: ${originalError.message}`;\n\n // Try to preserve the original error type if it's already a BmltQueryError\n if (originalError instanceof BmltQueryError) {\n return new BmltQueryError(originalError.type, message, {\n statusCode: originalError.statusCode,\n response: originalError.response,\n originalError: originalError.originalError || originalError,\n context: {\n ...originalError.context,\n ...additionalContext,\n },\n });\n }\n\n // Default to API error for unknown errors\n return ErrorFactory.createApiError(message, undefined, undefined, originalError);\n }\n}\n\n/**\n * Retry utility for handling retryable errors\n */\nexport interface RetryOptions {\n maxRetries: number;\n baseDelay: number;\n maxDelay: number;\n factor: number;\n onRetry?: (error: BmltQueryError, attempt: number) => void;\n}\n\nexport class RetryHandler {\n static async withRetry<T>(operation: () => Promise<T>, options: RetryOptions): Promise<T> {\n const { maxRetries, baseDelay, maxDelay, factor, onRetry } = options;\n\n let lastError: BmltQueryError;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n return await operation();\n } catch (error) {\n const bmltError =\n error instanceof BmltQueryError\n ? error\n : ErrorHandler.wrapError(error as Error, 'Operation failed');\n\n lastError = bmltError;\n\n // Don't retry if it's the last attempt or error is not retryable\n if (attempt === maxRetries || !bmltError.isRetryable()) {\n throw bmltError;\n }\n\n // Calculate delay for next attempt\n const delay = Math.min(baseDelay * Math.pow(factor, attempt), maxDelay);\n\n // Call retry callback if provided\n if (onRetry) {\n onRetry(bmltError, attempt + 1);\n }\n\n // Wait before retrying\n await new Promise(resolve => setTimeout(resolve, delay));\n }\n }\n\n throw lastError!;\n }\n}\n","/**\n * Nominatim geocoding service with retry logic and rate limiting\n */\n\nimport pRetry from 'p-retry';\nimport PQueue from 'p-queue';\nimport { GeocodeResult, GeocodeOptions, RateLimitOptions, BmltError, Coordinates } from '../types';\nimport { BmltQueryError, BmltErrorType, ErrorHandler } from '../utils/errors';\n\nexport interface NominatimResponse {\n place_id: number;\n licence: string;\n osm_type: string;\n osm_id: number;\n lat: string;\n lon: string;\n display_name: string;\n address?: {\n house_number?: string;\n road?: string;\n neighbourhood?: string;\n suburb?: string;\n city?: string;\n town?: string;\n village?: string;\n county?: string;\n state?: string;\n postcode?: string;\n country?: string;\n country_code?: string;\n };\n importance?: number;\n boundingbox: string[];\n}\n\nexport class GeocodingService {\n private baseURL: string;\n private queue: PQueue;\n private readonly defaultOptions: Required<Omit<GeocodeOptions, 'viewbox'>> & {\n viewbox?: [number, number, number, number];\n };\n\n constructor(options: GeocodeOptions & RateLimitOptions = {}) {\n const {\n retryCount = 3,\n timeout = 10000,\n userAgent = 'bmlt-query-client/1.0.0',\n countryCode = 'us',\n viewbox,\n bounded = false,\n intervalCap = 1,\n interval = 1000, // 1 second between requests\n concurrency = 1,\n carryoverConcurrencyCount = false,\n ...rateLimitOptions\n } = options;\n\n this.defaultOptions = {\n retryCount,\n timeout,\n userAgent,\n countryCode,\n viewbox,\n bounded,\n };\n\n this.baseURL = 'https://nominatim.openstreetmap.org';\n\n this.queue = new PQueue({\n intervalCap,\n interval,\n concurrency,\n carryoverConcurrencyCount,\n ...rateLimitOptions,\n });\n }\n\n /**\n * Make a fetch request with timeout and error handling\n */\n private async fetchWithTimeout<T>(url: string, timeout: number, userAgent: string): Promise<T> {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n try {\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n 'User-Agent': userAgent,\n },\n signal: controller.signal,\n });\n\n if (!response.ok) {\n if (response.status === 429) {\n const error: BmltError = new Error('Rate limit exceeded for geocoding service');\n error.name = 'RateLimitError';\n error.statusCode = 429;\n throw error;\n }\n\n if (response.status >= 400) {\n const error: BmltError = new Error(\n `Geocoding service error: ${response.status} ${response.statusText}`\n );\n error.name = 'GeocodingError';\n error.statusCode = response.status;\n throw error;\n }\n }\n\n const data = await response.json();\n return data as T;\n } catch (error) {\n if (error instanceof Error && error.name === 'AbortError') {\n const timeoutError: BmltError = new Error('Request timeout during geocoding');\n timeoutError.name = 'TimeoutError';\n throw timeoutError;\n }\n\n if (error instanceof TypeError) {\n const networkError: BmltError = new Error('Network error occurred during geocoding');\n networkError.name = 'NetworkError';\n throw networkError;\n }\n\n throw error;\n } finally {\n clearTimeout(timeoutId);\n }\n }\n\n /**\n * Geocode an address using Nominatim\n */\n async geocode(address: string, options: Partial<GeocodeOptions> = {}): Promise<GeocodeResult> {\n const geocodeOptions = { ...this.defaultOptions, ...options };\n\n return this.queue.add(async (): Promise<GeocodeResult> => {\n return pRetry(\n async () => {\n try {\n // Build search parameters with region bias\n const searchParams: Record<string, string | number> = {\n q: address,\n format: 'json',\n addressdetails: 1,\n limit: 1,\n dedupe: 1,\n };\n\n // Add country code bias if specified\n if (geocodeOptions.countryCode) {\n searchParams.countrycodes = geocodeOptions.countryCode;\n }\n\n // Add viewbox if specified\n if (geocodeOptions.viewbox) {\n searchParams.viewbox = geocodeOptions.viewbox.join(',');\n if (geocodeOptions.bounded) {\n searchParams.bounded = 1;\n }\n }\n\n // Build URL with parameters\n const searchUrl = new URL(`${this.baseURL}/search`);\n Object.entries(searchParams).forEach(([key, value]) => {\n searchUrl.searchParams.append(key, String(value));\n });\n\n const response = await this.fetchWithTimeout<NominatimResponse[]>(\n searchUrl.toString(),\n geocodeOptions.timeout,\n geocodeOptions.userAgent\n );\n\n if (!response || response.length === 0) {\n throw new BmltQueryError(\n BmltErrorType.GEOCODING_ERROR,\n `No results found for address: ${address}`\n );\n }\n\n // Always take the first result (most relevant based on search parameters)\n const result = response[0];\n const coordinates: Coordinates = {\n latitude: parseFloat(result.lat),\n longitude: parseFloat(result.lon),\n };\n\n // Validate coordinates\n if (isNaN(coordinates.latitude) || isNaN(coordinates.longitude)) {\n const error: BmltError = new Error(\n 'Invalid coordinates received from geocoding service'\n );\n error.name = 'GeocodingError';\n throw error;\n }\n\n if (\n coordinates.latitude < -90 ||\n coordinates.latitude > 90 ||\n coordinates.longitude < -180 ||\n coordinates.longitude > 180\n ) {\n const error: BmltError = new Error('Coordinates out of valid range');\n error.name = 'GeocodingError';\n throw error;\n }\n\n return {\n coordinates,\n display_name: result.display_name,\n confidence: result.importance,\n address: result.address\n ? {\n house_number: result.address.house_number,\n road: result.address.road,\n neighbourhood: result.address.neighbourhood,\n suburb: result.address.suburb,\n city: result.address.city || result.address.town || result.address.village,\n county: result.address.county,\n state: result.address.state,\n postcode: result.address.postcode,\n country: result.address.country,\n }\n : undefined,\n };\n } catch (error) {\n // Re-throw errors from fetchWithTimeout or validation\n throw error;\n }\n },\n {\n retries: geocodeOptions.retryCount,\n factor: 2,\n minTimeout: 1000,\n maxTimeout: 10000,\n onFailedAttempt: error => {\n console.warn(\n `Geocoding attempt ${error.attemptNumber} failed. ${error.retriesLeft} retries left. Error: ${error.error.message}`\n );\n },\n }\n );\n }) as Promise<GeocodeResult>;\n }\n\n /**\n * Batch geocode multiple addresses\n */\n async batchGeocode(\n addresses: string[],\n options: Partial<GeocodeOptions> = {}\n ): Promise<GeocodeResult[]> {\n const promises = addresses.map(address =>\n this.geocode(address, options).catch(error => {\n console.warn(`Failed to geocode address \"${address}\":`, error.message);\n return null;\n })\n );\n\n const results = await Promise.all(promises);\n return results.filter((result): result is GeocodeResult => result !== null);\n }\n\n /**\n * Reverse geocode coordinates to an address\n */\n async reverseGeocode(\n coordinates: Coordinates,\n options: Partial<GeocodeOptions> = {}\n ): Promise<GeocodeResult> {\n const geocodeOptions = { ...this.defaultOptions, ...options };\n\n return this.queue.add(async (): Promise<GeocodeResult> => {\n return pRetry(\n async () => {\n try {\n // Build URL with parameters\n const reverseUrl = new URL(`${this.baseURL}/reverse`);\n reverseUrl.searchParams.append('lat', String(coordinates.latitude));\n reverseUrl.searchParams.append('lon', String(coordinates.longitude));\n reverseUrl.searchParams.append('format', 'json');\n reverseUrl.searchParams.append('addressdetails', '1');\n\n const response = await this.fetchWithTimeout<NominatimResponse>(\n reverseUrl.toString(),\n geocodeOptions.timeout,\n geocodeOptions.userAgent\n );\n\n if (!response) {\n const error: BmltError = new Error(\n `No results found for coordinates: ${coordinates.latitude}, ${coordinates.longitude}`\n );\n error.name = 'GeocodingError';\n throw error;\n }\n\n const result = response;\n\n return {\n coordinates: {\n latitude: parseFloat(result.lat),\n longitude: parseFloat(result.lon),\n },\n display_name: result.display_name,\n confidence: result.importance,\n address: result.address\n ? {\n house_number: result.address.house_number,\n road: result.address.road,\n neighbourhood: result.address.neighbourhood,\n suburb: result.address.suburb,\n city: result.address.city || result.address.town || result.address.village,\n county: result.address.county,\n state: result.address.state,\n postcode: result.address.postcode,\n country: result.address.country,\n }\n : undefined,\n };\n } catch (error) {\n // Re-throw errors from fetchWithTimeout\n throw error;\n }\n },\n {\n retries: geocodeOptions.retryCount,\n factor: 2,\n minTimeout: 1000,\n maxTimeout: 10000,\n }\n );\n }) as Promise<GeocodeResult>;\n }\n\n /**\n * Get the current queue size\n */\n getQueueSize(): number {\n return this.queue.size;\n }\n\n /**\n * Get the number of pending operations\n */\n getPendingCount(): number {\n return this.queue.pending;\n }\n\n /**\n * Clear the queue\n */\n clearQueue(): void {\n this.queue.clear();\n }\n\n /**\n * Set concurrency limit\n */\n setConcurrency(concurrency: number): void {\n this.queue.concurrency = concurrency;\n }\n\n /**\n * Get the current user agent string\n */\n getUserAgent(): string {\n return this.defaultOptions.userAgent;\n }\n\n /**\n * Set the user agent string for geocoding requests\n */\n setUserAgent(userAgent: string): void {\n if (!userAgent || userAgent.trim().length === 0) {\n throw new Error('User agent must be a non-empty string');\n }\n this.defaultOptions.userAgent = userAgent.trim();\n }\n}\n","/**\n * Base types and enums for BMLT API\n */\n\nexport enum BmltDataFormat {\n JSON = 'json',\n JSONP = 'jsonp',\n TSML = 'tsml',\n CSV = 'csv',\n}\n\nexport enum BmltEndpoint {\n GET_SEARCH_RESULTS = 'GetSearchResults',\n GET_FORMATS = 'GetFormats',\n GET_SERVICE_BODIES = 'GetServiceBodies',\n GET_CHANGES = 'GetChanges',\n GET_FIELD_KEYS = 'GetFieldKeys',\n GET_FIELD_VALUES = 'GetFieldValues',\n GET_NAWS_DUMP = 'GetNAWSDump',\n GET_SERVER_INFO = 'GetServerInfo',\n GET_COVERAGE_AREA = 'GetCoverageArea',\n}\n\nexport enum Weekday {\n SUNDAY = 1,\n MONDAY = 2,\n TUESDAY = 3,\n WEDNESDAY = 4,\n THURSDAY = 5,\n FRIDAY = 6,\n SATURDAY = 7,\n}\n\nexport enum VenueType {\n IN_PERSON = 1,\n VIRTUAL = 2,\n HYBRID = 3,\n}\n\nexport enum SortKey {\n WEEKDAY = 'weekday',\n TIME = 'time',\n TOWN = 'town',\n STATE = 'state',\n WEEKDAY_STATE = 'weekday_state',\n}\n\nexport enum Language {\n ENGLISH = 'en',\n GERMAN = 'de',\n DANISH = 'dk',\n SPANISH = 'es',\n PERSIAN = 'fa',\n FRENCH = 'fr',\n ITALIAN = 'it',\n POLISH = 'pl',\n PORTUGUESE = 'pt',\n SWEDISH = 'sv',\n}\n\nexport interface Coordinates {\n latitude: number;\n longitude: number;\n}\n\nexport interface BmltError extends Error {\n statusCode?: number;\n response?: unknown;\n}\n\nexport interface GeocodeOptions {\n retryCount?: number;\n timeout?: number;\n userAgent?: string;\n /** Country code for region bias (e.g., 'us', 'ca', 'gb') */\n countryCode?: string;\n /** Viewbox for region bias [minLon, minLat, maxLon, maxLat] */\n viewbox?: [number, number, number, number];\n /** Bounded search - restrict results to viewbox */\n bounded?: boolean;\n}\n\nexport interface RateLimitOptions {\n intervalCap?: number;\n interval?: number;\n carryoverConcurrencyCount?: boolean;\n concurrency?: number;\n}\n","/**\n * Utility functions for building BMLT API URLs and handling parameters\n */\n\nimport { BmltDataFormat, BmltEndpoint } from '../types';\n\nexport interface URLBuilderOptions {\n rootServerURL: string;\n format: BmltDataFormat;\n endpoint: BmltEndpoint;\n parameters?: Record<string, unknown>;\n}\n\n/**\n * Build a BMLT API URL with parameters\n */\nexport function buildBmltURL(options: URLBuilderOptions): string {\n const { rootServerURL, format, endpoint, parameters = {} } = options;\n\n // Ensure root server URL ends with slash\n const baseURL = rootServerURL.endsWith('/') ? rootServerURL : `${rootServerURL}/`;\n\n // Build the base endpoint URL\n const endpointURL = `${baseURL}client_interface/${format}/`;\n\n // Convert parameters to query string\n const queryParams = new URLSearchParams();\n queryParams.set('switcher', endpoint);\n\n // Add other parameters\n Object.entries(parameters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n // Handle array parameters\n value.forEach((item, index) => {\n if (typeof item === 'number' || typeof item === 'string') {\n queryParams.append(`${key}[]`, item.toString());\n }\n });\n } else if (typeof value === 'boolean') {\n queryParams.set(key, value ? '1' : '0');\n } else {\n queryParams.set(key, value.toString());\n }\n }\n });\n\n return `${endpointURL}?${queryParams.toString()}`;\n}\n\n/**\n * Normalize parameter values for BMLT API\n */\nexport function normalizeParameters(params: Record<string, unknown>): Record<string, unknown> {\n const normalized: Record<string, unknown> = {};\n\n Object.entries(params).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n // Handle array parameters with positive/negative values\n if (Array.isArray(value)) {\n normalized[key] = value.map(item => {\n if (typeof item === 'number') {\n return item;\n } else if (typeof item === 'string') {\n const num = parseFloat(item);\n return isNaN(num) ? item : num;\n }\n return item;\n });\n }\n // Handle boolean parameters\n else if (typeof value === 'boolean') {\n normalized[key] = value;\n }\n // Handle numeric strings\n else if (typeof value === 'string') {\n const num = parseFloat(value);\n if (!isNaN(num) && isFinite(num)) {\n normalized[key] = num;\n } else {\n normalized[key] = value;\n }\n }\n // Keep other values as-is\n else {\n normalized[key] = value;\n }\n }\n });\n\n return normalized;\n}\n\n/**\n * Validate endpoint/format combinations\n */\nexport function validateEndpointFormat(endpoint: BmltEndpoint, format: BmltDataFormat): void {\n const validCombinations: Record<BmltEndpoint, BmltDataFormat[]> = {\n [BmltEndpoint.GET_SEARCH_RESULTS]: [\n BmltDataFormat.JSON,\n BmltDataFormat.JSONP,\n BmltDataFormat.TSML,\n ],\n [BmltEndpoint.GET_FORMATS]: [BmltDataFormat.JSON, BmltDataFormat.JSONP],\n [BmltEndpoint.GET_SERVICE_BODIES]: [BmltDataFormat.JSON, BmltDataFormat.JSONP],\n [BmltEndpoint.GET_CHANGES]: [BmltDataFormat.JSON, BmltDataFormat.JSONP],\n [BmltEndpoint.GET_FIELD_KEYS]: [BmltDataFormat.JSON, BmltDataFormat.JSONP],\n [BmltEndpoint.GET_FIELD_VALUES]: [BmltDataFormat.JSON, BmltDataFormat.JSONP],\n [BmltEndpoint.GET_NAWS_DUMP]: [BmltDataFormat.CSV],\n [BmltEndpoint.GET_SERVER_INFO]: [BmltDataFormat.JSON, BmltDataFormat.JSONP],\n [BmltEndpoint.GET_COVERAGE_AREA]: [BmltDataFormat.JSON, BmltDataFormat.JSONP],\n };\n\n const validFormats = validCombinations[endpoint];\n if (!validFormats.includes(format)) {\n throw new Error(\n `Invalid format '${format}' for endpoint '${endpoint}'. Valid formats: ${validFormats.join(', ')}`\n );\n }\n}\n\n/**\n * Clean and validate a root server URL\n */\nexport function validateRootServerURL(url: string): string {\n try {\n const urlObj = new URL(url);\n if (!['http:', 'https:'].includes(urlObj.protocol)) {\n throw new Error('Root server URL must use http or https protocol');\n }\n\n // Return the URL without trailing slash for consistency\n return urlObj.href.replace(/\\/$/, '');\n } catch (error) {\n const validationError = new Error(`Invalid root server URL: ${url}`);\n validationError.cause = error;\n throw validationError;\n }\n}\n\n/**\n * Extract numeric IDs from various parameter formats\n */\nexport function extractIds(value: unknown): number[] {\n if (typeof value === 'number') {\n return [value];\n }\n\n if (typeof value === 'string') {\n // Handle comma-separated values\n return value\n .split(',')\n .map(id => parseInt(id.trim(), 10))\n .filter(id => !isNaN(id));\n }\n\n if (Array.isArray(value)) {\n return value\n .map(item => (typeof item === 'number' ? item : parseInt(String(item), 10)))\n .filter(id => !isNaN(id));\n }\n\n return [];\n}\n\n/**\n * Format time values for BMLT API\n */\nexport function formatTimeValue(\n hours?: number,\n minutes?: number\n): { hours?: number; minutes?: number } {\n const result: { hours?: number; minutes?: number } = {};\n\n if (typeof hours === 'number') {\n if (hours < 0 || hours > 23) {\n throw new Error('Hours must be between 0 and 23');\n }\n result.hours = hours;\n }\n\n if (typeof minutes === 'number') {\n if (minutes < 0 || minutes > 59) {\n throw new Error('Minutes must be between 0 and 59');\n }\n result.minutes = minutes;\n }\n\n return result;\n}\n\n/**\n * Validate coordinate values\n */\nexport function validateCoordinates(latitude: number, longitude: number): void {\n if (typeof latitude !== 'number' || isNaN(latitude)) {\n throw new Error('Latitude must be a valid number');\n }\n\n if (typeof longitude !== 'number' || isNaN(longitude)) {\n throw new Error('Longitude must be a valid number');\n }\n\n if (latitude < -90 || latitude > 90) {\n throw new Error('Latitude must be between -90 and 90 degrees');\n }\n\n if (longitude < -180 || longitude > 180) {\n throw new Error('Longitude must be between -180 and 180 degrees');\n }\n}\n\n/**\n * Validate radius values\n */\nexport function validateRadius(radius: number): void {\n if (typeof radius !== 'number' || isNaN(radius)) {\n throw new Error('Radius must be a valid number');\n }\n\n if (radius <= 0) {\n throw new Error('Radius must be greater than 0');\n }\n}\n\n/**\n * Convert miles to kilometers\n */\nexport function milesToKilometers(miles: number): number {\n return miles * 1.60934;\n}\n\n/**\n * Convert kilometers to miles\n */\nexport function kilometersToMiles(km: number): number {\n return km / 1.60934;\n}\n","/**\n * Main BMLT client class for querying BMLT servers\n */\n\nimport { GeocodingService } from '../services/geocoding';\nimport {\n BmltDataFormat,\n BmltEndpoint,\n BmltError,\n Meeting,\n Format,\n MeetingsWithFormats,\n ServiceBody,\n Change,\n ServerInfo,\n CoverageArea,\n FieldKey,\n FieldValue,\n SearchResultsParams,\n GeographicSearchParams,\n FormatsParams,\n ServiceBodiesParams,\n ChangesParams,\n FieldValuesParams,\n NAWSDumpParams,\n GeocodeOptions,\n RateLimitOptions,\n Coordinates,\n} from '../types';\nimport {\n buildBmltURL,\n validateEndpointFormat,\n validateRootServerURL,\n validateCoordinates,\n validateRadius,\n} from '../utils/url-builder';\nimport { ErrorHandler } from '../utils/errors';\n\nexport interface BmltClientOptions {\n /** Root server URL */\n rootServerURL: string;\n\n /** Default data format */\n defaultFormat?: BmltDataFormat;\n\n /** HTTP request timeout in milliseconds */\n timeout?: number;\n\n /** User agent string */\n userAgent?: string;\n\n /** Geocoding options */\n geocodingOptions?: GeocodeOptions & RateLimitOptions;\n\n /** Enable automatic geocoding for address searches */\n enableGeocoding?: boolean;\n}\n\nexport class BmltClient {\n private timeout: number;\n private userAgent: string;\n private readonly geocodingService?: GeocodingService;\n private rootServerURL: string;\n private defaultFormat: BmltDataFormat;\n\n constructor(options: BmltClientOptions) {\n const {\n rootServerURL,\n defaultFormat = BmltDataFormat.JSON,\n timeout = 30000,\n userAgent = 'bmlt-query-client/1.0.0',\n geocodingOptions = {},\n enableGeocoding = true,\n } = options;\n\n // Validate and normalize root server URL\n this.rootServerURL = validateRootServerURL(rootServerURL);\n this.defaultFormat = defaultFormat;\n this.timeout = timeout;\n this.userAgent = userAgent;\n\n // Initialize geocoding service if enabled\n if (enableGeocoding) {\n this.geocodingService = new GeocodingService(geocodingOptions);\n }\n }\n\n /**\n * Make a request to the BMLT API\n */\n private async makeRequest<T>(\n endpoint: BmltEndpoint,\n parameters: Record<string, unknown> = {},\n format: BmltDataFormat = this.defaultFormat\n ): Promise<T> {\n let response: Response | undefined;\n\n try {\n // Validate endpoint/format combination\n validateEndpointFormat(endpoint, format);\n\n // Build the request URL\n const url = buildBmltURL({\n rootServerURL: this.rootServerURL,\n format,\n endpoint,\n parameters,\n });\n\n // Create abort controller for timeout\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.timeout);\n\n try {\n // Make the request\n response = await fetch(url, {\n method: 'GET',\n headers: {\n 'User-Agent': this.userAgent,\n },\n signal: controller.signal,\n });\n } finally {\n clearTimeout(timeoutId);\n }\n\n // Check if response is ok\n if (!response.ok) {\n throw ErrorHandler.handleFetchError(\n new Error(`HTTP ${response.status}: ${response.statusText}`),\n response\n );\n }\n\n // Get response text\n const responseText = await response.text();\n\n // Handle CSV responses\n if (format === BmltDataFormat.CSV) {\n return responseText as T;\n }\n\n // Handle JSONP responses\n if (format === BmltDataFormat.JSONP) {\n // Extract JSON from JSONP callback\n const callbackName = (parameters.callback as string) || 'callback';\n const jsonMatch = responseText.match(new RegExp(`${callbackName}\\\\((.+)\\\\);?$`));\n\n if (!jsonMatch) {\n throw new Error('Invalid JSONP response format');\n }\n\n return JSON.parse(jsonMatch[1]) as T;\n }\n\n // Handle JSON and TSML responses\n if (format === BmltDataFormat.JSON || format === BmltDataFormat.TSML) {\n return JSON.parse(responseText) as T;\n }\n\n // Fallback - return as text\n return responseText as T;\n } catch (error) {\n throw ErrorHandler.handleFetchError(error, response);\n }\n }\n\n /**\n * Search for meetings\n */\n async searchMeetings(params: SearchResultsParams = {}): Promise<Meeting[]> {\n const { format = this.defaultFormat, ...searchParams } = params;\n return this.makeRequest<Meeting[]>(BmltEndpoint.GET_SEARCH_RESULTS, searchParams, format);\n }\n\n /**\n * Search for meetings and return both meetings and the formats they reference in a\n * single request. Uses get_used_formats=true so the server wraps the response as\n * { meetings: Meeting[], formats: Format[] } instead of a bare Meeting[].\n *\n * This replaces the common pattern of Promise.all([getFormats(), searchMeetings()])\n * with a single round-trip, which matters for large servers where getFormats() can\n * return hundreds of unused format records.\n */\n async searchMeetingsWithFormats(\n params: Omit<SearchResultsParams, 'get_used_formats' | 'get_formats_only'> = {}\n ): Promise<MeetingsWithFormats> {\n const { format = this.defaultFormat, ...searchParams } = params;\n return this.makeRequest<MeetingsWithFormats>(\n BmltEndpoint.GET_SEARCH_RESULTS,\n { ...searchParams, get_used_formats: true },\n format\n );\n }\n\n /**\n * Search for meetings by geographic location using geocoding\n */\n async searchMeetingsByAddress(params: GeographicSearchParams): Promise<Meeting[]> {\n if (!this.geocodingService) {\n throw new Error('Geocoding is not enabled. Initialize client with enableGeocoding: true');\n }\n\n const { address, radiusMiles, radiusKm, sortByDistance = true, searchParams = {} } = params;\n\n // Geocode the address\n const geocodeResult = await this.geocodingService.geocode(address);\n\n // Build search parameters with coordinates\n const geoSearchParams: SearchResultsParams = {\n ...searchParams,\n lat_val: geocodeResult.coordinates.latitude,\n long_val: geocodeResult.coordinates.longitude,\n sort_results_by_distance: sortByDistance,\n };\n\n // Add radius parameter\n if (radiusMiles !== undefined) {\n validateRadius(radiusMiles);\n geoSearchParams.geo_width = radiusMiles;\n } else if (radiusKm !== undefined) {\n validateRadius(radiusKm);\n geoSearchParams.geo_width_km = radiusKm;\n }\n\n return this.searchMeetings(geoSearchParams);\n }\n\n /**\n * Search for meetings by coordinates\n */\n async searchMeetingsByCoordinates(\n coordinates: Coordinates,\n radiusMiles?: number,\n radiusKm?: number,\n searchParams: Omit<\n SearchResultsParams,\n 'lat_val' | 'long_val' | 'geo_width' | 'geo_width_km'\n > = {}\n ): Promise<Meeting[]> {\n validateCoordinates(coordinates.latitude, coordinates.longitude);\n\n const geoSearchParams: SearchResultsParams = {\n ...searchParams,\n lat_val: coordinates.latitude,\n long_val: coordinates.longitude,\n sort_results_by_distance: true,\n };\n\n if (radiusMiles !== undefined) {\n validateRadius(radiusMiles);\n geoSearchParams.geo_width = radiusMiles;\n } else if (radiusKm !== undefined) {\n validateRadius(radiusKm);\n geoSearchParams.geo_width_km = radiusKm;\n }\n\n return this.searchMeetings(geoSearchParams);\n }\n\n /**\n * Get available meeting formats\n */\n async getFormats(params: FormatsParams = {}): Promise<Format[]> {\n const { format = this.defaultFormat, ...formatParams } = params;\n return this.makeRequest<Format[]>(BmltEndpoint.GET_FORMATS, formatParams, format);\n }\n\n /**\n * Get service bodies\n */\n async getServiceBodies(params: ServiceBodiesParams = {}): Promise<ServiceBody[]> {\n const { format = this.defaultFormat, ...serviceParams } = params;\n return this.makeRequest<ServiceBody[]>(BmltEndpoint.GET_SERVICE_BODIES, serviceParams, format);\n }\n\n /**\n * Get meeting changes within a date range\n */\n async getChanges(params: ChangesParams = {}): Promise<Change[]> {\n const { format = this.defaultFormat, ...changeParams } = params;\n return this.makeRequest<Change[]>(BmltEndpoint.GET_CHANGES, changeParams, format);\n }\n\n /**\n * Get available field keys\n */\n async getFieldKeys(): Promise<FieldKey[]> {\n return this.makeRequest<FieldKey[]>(BmltEndpoint.GET_FIELD_KEYS);\n }\n\n /**\n * Get field values for a specific field key\n */\n async getFieldValues(params: FieldValuesParams): Promise<FieldValue[]> {\n const { format = this.defaultFormat, ...fieldParams } = params;\n return this.makeRequest<FieldValue[]>(BmltEndpoint.GET_FIELD_VALUES, fieldParams, format);\n }\n\n /**\n * Get NAWS dump for a service body (CSV format only)\n */\n async getNAWSDump(params: NAWSDumpParams): Promise<string> {\n return this.makeRequest<string>(BmltEndpoint.GET_NAWS_DUMP, params, BmltDataFormat.CSV);\n }\n\n /**\n * Get server information\n */\n async getServerInfo(): Promise<ServerInfo> {\n return this.makeRequest<ServerInfo>(BmltEndpoint.GET_SERVER_INFO);\n }\n\n /**\n * Get server coverage area\n */\n async getCoverageArea(): Promise<CoverageArea> {\n return this.makeRequest<CoverageArea>(BmltEndpoint.GET_COVERAGE_AREA);\n }\n\n /**\n * Geocode an address using the built-in geocoding service\n */\n async geocodeAddress(address: string, options?: Partial<GeocodeOptions>) {\n if (!this.geocodingService) {\n throw new Error('Geocoding is not enabled. Initialize client with enableGeocoding: true');\n }\n\n return this.geocodingService.geocode(address, options);\n }\n\n /**\n * Reverse geocode coordinates to an address\n */\n async reverseGeocode(coordinates: Coordinates, options?: Partial<GeocodeOptions>) {\n if (!this.geocodingService) {\n throw new Error('Geocoding is not enabled. Initialize client with enableGeocoding: true');\n }\n\n return this.geocodingService.reverseGeocode(coordinates, options);\n }\n\n /**\n * Get the root server URL\n */\n getRootServerURL(): string {\n return this.rootServerURL;\n }\n\n /**\n * Update the root server URL\n */\n setRootServerURL(url: string): void {\n this.rootServerURL = validateRootServerURL(url);\n }\n\n /**\n * Get the default data format\n */\n getDefaultFormat(): BmltDataFormat {\n return this.defaultFormat;\n }\n\n /**\n * Set the default data format\n */\n setDefaultFormat(format: BmltDataFormat): void {\n this.defaultFormat = format;\n }\n\n /**\n * Get geocoding service statistics\n */\n getGeocodingStats() {\n if (!this.geocodingService) {\n return null;\n }\n\n return {\n queueSize: this.geocodingService.getQueueSize(),\n pendingCount: this.geocodingService.getPendingCount(),\n };\n }\n\n /**\n * Clear the geocoding queue\n */\n clearGeocodingQueue(): void {\n if (this.geocodingService) {\n this.geocodingService.clearQueue();\n }\n }\n\n /**\n * Get the current user agent string\n */\n getUserAgent(): string {\n return this.userAgent;\n }\n\n /**\n * Set the user agent string for HTTP requests\n */\n setUserAgent(userAgent: string): void {\n if (!userAgent || userAgent.trim().length === 0) {\n throw new Error('User agent must be a non-empty string');\n }\n this.userAgent = userAgent.trim();\n\n // Also update the geocoding service user agent if it exists\n if (this.geocodingService) {\n this.geocodingService.setUserAgent(this.userAgent);\n }\n }\n\n /**\n * Get the current timeout setting\n */\n getTimeout(): number {\n return this.timeout;\n }\n\n /**\n * Set the timeout for HTTP requests\n */\n setTimeout(timeout: number): void {\n if (!Number.isInteger(timeout) || timeout <= 0) {\n throw new Error('Timeout must be a positive integer');\n }\n this.timeout = timeout;\n }\n}\n","/**\n * Fluent query builder for BMLT meeting searches\n */\n\nimport {\n SearchResultsParams,\n Meeting,\n MeetingsWithFormats,\n Weekday,\n VenueType,\n SortKey,\n Language,\n BmltDataFormat,\n Coordinates,\n} from '../types';\nimport { BmltClient } from './bmlt-client';\n\nexport class MeetingQueryBuilder {\n private params: SearchResultsParams = {};\n private client: BmltClient;\n\n constructor(client: BmltClient) {\n this.client = client;\n }\n\n /**\n * Include or exclude specific meeting IDs\n */\n meetingIds(ids: number | number[], exclude = false): this {\n if (Array.isArray(ids)) {\n this.params.meeting_ids = exclude ? ids.map(id => -id) : ids;\n } else {\n this.params.meeting_ids = exclude ? -ids : ids;\n }\n return this;\n }\n\n /**\n * Include meetings on specific weekdays\n */\n onWeekdays(...days: Weekday[]): this {\n this.params.weekdays = days.length === 1 ? days[0] : days;\n return this;\n }\n\n /**\n * Exclude meetings on specific weekdays\n */\n notOnWeekdays(...days: Weekday[]): this {\n const excludeDays = days.map(day => -day);\n this.params.weekdays = excludeDays.length === 1 ? excludeDays[0] : excludeDays;\n return this;\n }\n\n /**\n * Filter by venue types\n */\n venueTypes(...types: VenueType[]): this {\n this.params.venue_types = types.length === 1 ? types[0] : types;\n return this;\n }\n\n /**\n * Include only in-person meetings\n */\n inPersonOnly(): this {\n return this.venueTypes(VenueType.IN_PERSON);\n }\n\n /**\n * Include only virtual meetings\n */\n virtualOnly(): this {\n return this.venueTypes(VenueType.VIRTUAL);\n }\n\n /**\n * Include only hybrid meetings\n */\n hybridOnly(): this {\n return this.venueTypes(VenueType.HYBRID);\n }\n\n /**\n * Include virtual and hybrid meetings\n */\n virtualOrHybrid(): this {\n return this.venueTypes(VenueType.VIRTUAL, VenueType.HYBRID);\n }\n\n /**\n * Filter by meeting formats\n */\n formats(formatIds: number | number[], exclude = false): this {\n if (Array.isArray(formatIds)) {\n this.params.formats = exclude ? formatIds.map(id => -id) : formatIds;\n } else {\n this.params.formats = exclude ? -formatIds : formatIds;\n }\n return this;\n }\n\n /**\n * Use OR logic for format matching instead of AND\n */\n anyFormat(): this {\n this.params.formats_comparison_operator = 'OR';\n return this;\n }\n\n /**\n * Filter by service bodies\n */\n serviceBodies(serviceBodyIds: number | number[], exclude = false): this {\n if (Array.isArray(serviceBodyIds)) {\n this.params.services = exclude ? serviceBodyIds.map(id => -id) : serviceBodyIds;\n } else {\n this.params.services = exclude ? -serviceBodyIds : serviceBodyIds;\n }\n return this;\n }\n\n /**\n * Include child service bodies\n */\n includeChildServiceBodies(): this {\n this.params.recursive = true;\n return this;\n }\n\n /**\n * Search for specific text\n */\n searchText(text: string): this {\n this.params.SearchString = text;\n return this;\n }\n\n /**\n * Meetings starting after specific time\n */\n startingAfter(hours: number, minutes = 0): this {\n this.params.StartsAfterH = hours;\n this.params.StartsAfterM = minutes;\n return this;\n }\n\n /**\n * Meetings starting before specific time\n */\n startingBefore(hours: number, minutes = 0): this {\n this.params.StartsBeforeH = hours;\n this.params.StartsBeforeM = minutes;\n return this;\n }\n\n /**\n * Meetings ending before specific time\n */\n endingBefore(hours: number, minutes = 0): this {\n this.params.EndsBeforeH = hours;\n this.params.EndsBeforeM = minutes;\n return this;\n }\n\n /**\n * Minimum meeting duration\n */\n minimumDuration(hours = 0, minutes = 0): this {\n if (hours > 0) this.params.MinDurationH = hours;\n if (minutes > 0) this.params.MinDurationM = minutes;\n return this;\n }\n\n /**\n * Maximum meeting duration\n */\n maximumDuration(hours = 0, minutes = 0): this {\n if (hours > 0) this.params.MaxDurationH = hours;\n if (minutes > 0) this.params.MaxDurationM = minutes;\n return this;\n }\n\n /**\n * Search within geographic area by coordinates\n */\n nearCoordinates(coordinates: Coordinates, radiusMiles?: number, radiusKm?: number): this {\n this.params.lat_val = coordinates.latitude;\n this.params.long_val = coordinates.longitude;\n\n if (radiusMiles !== undefined) {\n this.params.geo_width = radiusMiles;\n } else if (radiusKm !== undefined) {\n this.params.geo_width_km = radiusKm;\n }\n\n return this;\n }\n\n /**\n * Search for specific field value\n */\n fieldValue(fieldKey: string, value: string): this {\n this.params.meeting_key = fieldKey;\n this.params.meeting_key_value = value;\n return this;\n }\n\n /**\n * Return only specific fields\n */\n selectFields(...fields: string[]): this {\n this.params.data_field_key = fields.join(',');\n return this;\n }\n\n /**\n * Sort results by specific fields\n */\n sortBy(...fields: string[]): this {\n this.params.sort_keys = fields.join(',');\n return this;\n }\n\n /**\n * Sort by predefined aliases\n */\n sortByAlias(alias: SortKey): this {\n this.params.sort_key = alias;\n return this;\n }\n\n /**\n * Sort by distance (requires geographic search)\n */\n sortByDistance(): this {\n this.params.sort_results_by_distance = true;\n return this;\n }\n\n /**\n * Set pagination\n */\n paginate(pageSize: number, pageNumber = 1): this {\n this.params.page_size = pageSize;\n this.params.page_num = pageNumber;\n return this;\n }\n\n /**\n * Include unpublished meetings\n */\n includeUnpublished(): this {\n this.params.advanced_published = 0;\n return this;\n }\n\n /**\n * Include only unpublished meetings\n */\n unpublishedOnly(): this {\n this.params.advanced_published = -1;\n return this;\n }\n\n /**\n * Set language for format names\n */\n language(lang: Language): this {\n this.params.lang_enum = lang;\n return this;\n }\n\n /**\n * Set response format\n */\n format(format: BmltDataFormat): this {\n this.params.format = format;\n return this;\n }\n\n /**\n * Include formats used in search results\n */\n includeFormats(): this {\n this.params.get_used_formats = true;\n return this;\n }\n\n /**\n * Return only formats (requires includeFormats)\n */\n formatsOnly(): this {\n this.params.get_used_formats = true;\n this.params.get_formats_only = true;\n return this;\n }\n\n /**\n * Filter by root server IDs (aggregator mode)\n */\n rootServerIds(serverIds: number | number[], exclude = false): this {\n if (Array.isArray(serverIds)) {\n this.params.root_server_ids = exclude ? serverIds.map(id => -id) : serverIds;\n } else {\n this.params.root_server_ids = exclude ? -serverIds : serverIds;\n }\n return this;\n }\n\n /**\n * Get the current query parameters\n */\n getParams(): SearchResultsParams {\n return { ...this.params };\n }\n\n /**\n * Reset the query builder\n */\n reset(): this {\n this.params = {};\n return this;\n }\n\n /**\n * Clone the current query builder\n */\n clone(): MeetingQueryBuilder {\n const cloned = new MeetingQueryBuilder(this.client);\n cloned.params = { ...this.params };\n return cloned;\n }\n\n /**\n * Execute the search and return results\n */\n async execute(): Promise<Meeting[]> {\n return this.client.searchMeetings(this.params);\n }\n\n /**\n * Execute the search and return both meetings and the formats they reference\n * in a single request. Equivalent to execute() but avoids a separate getFormats() call.\n */\n async executeWithFormats(): Promise<MeetingsWithFormats> {\n const { get_used_formats, get_formats_only, ...params } = this.params;\n return this.client.searchMeetingsWithFormats(params);\n }\n\n /**\n * Execute the search by geocoding an address first\n */\n async executeNearAddress(\n address: string,\n radiusMiles?: number,\n radiusKm?: number,\n sortByDistance = true\n ): Promise<Meeting[]> {\n return this.client.searchMeetingsByAddress({\n address,\n radiusMiles,\n radiusKm,\n sortByDistance,\n searchParams: this.params,\n });\n }\n}\n\n/**\n * Convenience methods for common search patterns\n */\nexport class QuickSearch {\n private client: BmltClient;\n\n constructor(client: BmltClient) {\n this.client = client;\n }\n\n /**\n * Search for today's meetings\n */\n today(): MeetingQueryBuilder {\n const today = new Date().getDay();\n const weekday = today === 0 ? Weekday.SUNDAY : (today as Weekday);\n return new MeetingQueryBuilder(this.client).onWeekdays(weekday);\n }\n\n /**\n * Search for weekend meetings\n */\n weekend(): MeetingQueryBuilder {\n return new MeetingQueryBuilder(this.client).onWeekdays(Weekday.SATURDAY, Weekday.SUNDAY);\n }\n\n /**\n * Search for weekday meetings\n */\n weekdays(): MeetingQueryBuilder {\n return new MeetingQueryBuilder(this.client).onWeekdays(\n Weekday.MONDAY,\n Weekday.TUESDAY,\n Weekday.WEDNESDAY,\n Weekday.THURSDAY,\n Weekday.FRIDAY\n );\n }\n\n /**\n * Search for evening meetings (after 5 PM)\n */\n evening(): MeetingQueryBuilder {\n return new MeetingQueryBuilder(this.client).startingAfter(17);\n }\n\n /**\n * Search for morning meetings (before 12 PM)\n */\n morning(): MeetingQueryBuilder {\n return new MeetingQueryBuilder(this.client).startingBefore(12);\n }\n\n /**\n * Search for virtual meetings only\n */\n virtual(): MeetingQueryBuilder {\n return new MeetingQueryBuilder(this.client).virtualOnly();\n }\n\n /**\n * Search for in-person meetings only\n */\n inPerson(): MeetingQueryBuilder {\n return new MeetingQueryBuilder(this.client).inPersonOnly();\n }\n\n /**\n * Search by meeting name or location\n */\n byText(searchText: string): MeetingQueryBuilder {\n return new MeetingQueryBuilder(this.client).searchText(searchText);\n }\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7],"mappings":";;;;;;;;;;aAAM,IAAiB,OAAO,UAAU,UAElC,KAAU,MAAS,EAAe,KAAK,EAAM,KAAK,kBAElD,IAAgB,IAAI,IAAI;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC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AO,GAAyC;AAC9C,SAAO,IAAI,EAAoB,KAAK,OAAO,CAAC,WAAW,EAAW"}
1
+ {"version":3,"file":"app.js","names":["EventEmitter"],"sources":["../node_modules/is-network-error/index.js","../node_modules/p-retry/index.js","../node_modules/eventemitter3/index.js","../node_modules/eventemitter3/index.mjs","../node_modules/p-timeout/index.js","../node_modules/p-queue/dist/lower-bound.js","../node_modules/p-queue/dist/priority-queue.js","../node_modules/p-queue/dist/index.js","../src/utils/errors.ts","../src/services/geocoding.ts","../src/types/base.ts","../src/utils/url-builder.ts","../src/client/bmlt-client.ts","../src/client/query-builder.ts"],"sourcesContent":["const objectToString = Object.prototype.toString;\n\nconst isError = value => objectToString.call(value) === '[object Error]';\n\nconst errorMessages = new Set([\n\t'network error', // Chrome\n\t'NetworkError when attempting to fetch resource.', // Firefox\n\t'The Internet connection appears to be offline.', // Safari 16\n\t'Network request failed', // `cross-fetch`\n\t'fetch failed', // Undici (Node.js)\n\t'terminated', // Undici (Node.js)\n\t' A network error occurred.', // Bun (WebKit)\n\t'Network connection lost', // Cloudflare Workers (fetch)\n]);\n\nexport default function isNetworkError(error) {\n\tconst isValid = error\n\t\t&& isError(error)\n\t\t&& error.name === 'TypeError'\n\t\t&& typeof error.message === 'string';\n\n\tif (!isValid) {\n\t\treturn false;\n\t}\n\n\tconst {message, stack} = error;\n\n\t// Safari 17+ has generic message but no stack for network errors\n\tif (message === 'Load failed') {\n\t\treturn stack === undefined\n\t\t\t// Sentry adds its own stack trace to the fetch error, so also check for that\n\t\t\t|| '__sentry_captured__' in error;\n\t}\n\n\t// Deno network errors start with specific text\n\tif (message.startsWith('error sending request for url')) {\n\t\treturn true;\n\t}\n\n\t// Chrome: exact \"Failed to fetch\" or with hostname: \"Failed to fetch (example.com)\"\n\tif (message === 'Failed to fetch' || (message.startsWith('Failed to fetch (') && message.endsWith(')'))) {\n\t\treturn true;\n\t}\n\n\t// Standard network error messages\n\treturn errorMessages.has(message);\n}\n","import isNetworkError from 'is-network-error';\n\nfunction validateRetries(retries) {\n\tif (typeof retries === 'number') {\n\t\tif (retries < 0) {\n\t\t\tthrow new TypeError('Expected `retries` to be a non-negative number.');\n\t\t}\n\n\t\tif (Number.isNaN(retries)) {\n\t\t\tthrow new TypeError('Expected `retries` to be a valid number or Infinity, got NaN.');\n\t\t}\n\t} else if (retries !== undefined) {\n\t\tthrow new TypeError('Expected `retries` to be a number or Infinity.');\n\t}\n}\n\nfunction validateNumberOption(name, value, {min = 0, allowInfinity = false} = {}) {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof value !== 'number' || Number.isNaN(value)) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be a number${allowInfinity ? ' or Infinity' : ''}.`);\n\t}\n\n\tif (!allowInfinity && !Number.isFinite(value)) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be a finite number.`);\n\t}\n\n\tif (value < min) {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be \\u2265 ${min}.`);\n\t}\n}\n\nfunction validateFunctionOption(name, value) {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof value !== 'function') {\n\t\tthrow new TypeError(`Expected \\`${name}\\` to be a function.`);\n\t}\n}\n\nexport class AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\n\t\tif (message instanceof Error) {\n\t\t\tthis.originalError = message;\n\t\t\t({message} = message);\n\t\t} else {\n\t\t\tthis.originalError = new Error(message);\n\t\t\tthis.originalError.stack = this.stack;\n\t\t}\n\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\nfunction calculateDelay(retriesConsumed, options) {\n\tconst attempt = Math.max(1, retriesConsumed + 1);\n\tconst random = options.randomize ? (Math.random() + 1) : 1;\n\n\tlet timeout = Math.round(random * options.minTimeout * (options.factor ** (attempt - 1)));\n\ttimeout = Math.min(timeout, options.maxTimeout);\n\n\treturn timeout;\n}\n\nfunction calculateRemainingTime(start, max) {\n\tif (!Number.isFinite(max)) {\n\t\treturn max;\n\t}\n\n\treturn max - (performance.now() - start);\n}\n\nasync function delayForRetry(delay, options) {\n\tif (delay <= 0) {\n\t\treturn;\n\t}\n\n\tawait new Promise((resolve, reject) => {\n\t\tconst onAbort = () => {\n\t\t\tclearTimeout(timeoutToken);\n\t\t\toptions.signal?.removeEventListener('abort', onAbort);\n\t\t\treject(options.signal.reason);\n\t\t};\n\n\t\tconst timeoutToken = setTimeout(() => {\n\t\t\toptions.signal?.removeEventListener('abort', onAbort);\n\t\t\tresolve();\n\t\t}, delay);\n\n\t\tif (options.unref) {\n\t\t\ttimeoutToken.unref?.();\n\t\t}\n\n\t\toptions.signal?.addEventListener('abort', onAbort, {once: true});\n\t});\n}\n\nasync function onAttemptFailure({error, attemptNumber, retriesConsumed, startTime, options}) {\n\tconst normalizedError = error instanceof Error\n\t\t? error\n\t\t: new TypeError(`Non-error was thrown: \"${error}\". You should only throw errors.`);\n\n\tif (normalizedError instanceof AbortError) {\n\t\tthrow normalizedError.originalError;\n\t}\n\n\tconst retriesLeft = Number.isFinite(options.retries)\n\t\t? Math.max(0, options.retries - retriesConsumed)\n\t\t: options.retries;\n\n\tconst maxRetryTime = options.maxRetryTime ?? Number.POSITIVE_INFINITY;\n\tconst delayTime = calculateDelay(retriesConsumed, options);\n\tconst remainingTimeBeforeCallbacks = calculateRemainingTime(startTime, maxRetryTime);\n\n\tif (remainingTimeBeforeCallbacks <= 0) {\n\t\tconst context = Object.freeze({\n\t\t\terror: normalizedError,\n\t\t\tattemptNumber,\n\t\t\tretriesLeft,\n\t\t\tretriesConsumed,\n\t\t\tretryDelay: 0,\n\t\t});\n\n\t\tawait options.onFailedAttempt(context);\n\n\t\tthrow normalizedError;\n\t}\n\n\tconst consumeRetryContext = Object.freeze({\n\t\terror: normalizedError,\n\t\tattemptNumber,\n\t\tretriesLeft,\n\t\tretriesConsumed,\n\t\tretryDelay: retriesLeft > 0 ? delayTime : 0,\n\t});\n\n\tconst consumeRetry = await options.shouldConsumeRetry(consumeRetryContext);\n\tconst effectiveDelay = consumeRetry && retriesLeft > 0 ? delayTime : 0;\n\tconst context = Object.freeze({\n\t\terror: normalizedError,\n\t\tattemptNumber,\n\t\tretriesLeft,\n\t\tretriesConsumed,\n\t\tretryDelay: effectiveDelay,\n\t});\n\n\tawait options.onFailedAttempt(context);\n\n\tif (calculateRemainingTime(startTime, maxRetryTime) <= 0) {\n\t\tthrow normalizedError;\n\t}\n\n\tconst remainingTime = calculateRemainingTime(startTime, maxRetryTime);\n\n\tif (remainingTime <= 0 || retriesLeft <= 0) {\n\t\tthrow normalizedError;\n\t}\n\n\tif (normalizedError instanceof TypeError && !isNetworkError(normalizedError)) {\n\t\tthrow normalizedError;\n\t}\n\n\tif (!await options.shouldRetry(context)) {\n\t\tthrow normalizedError;\n\t}\n\n\tconst remainingTimeAfterShouldRetry = calculateRemainingTime(startTime, maxRetryTime);\n\n\tif (remainingTimeAfterShouldRetry <= 0) {\n\t\tthrow normalizedError;\n\t}\n\n\tif (!consumeRetry) {\n\t\toptions.signal?.throwIfAborted();\n\t\treturn false;\n\t}\n\n\tconst finalDelay = Math.min(effectiveDelay, remainingTimeAfterShouldRetry);\n\n\toptions.signal?.throwIfAborted();\n\n\tawait delayForRetry(finalDelay, options);\n\n\toptions.signal?.throwIfAborted();\n\n\treturn true;\n}\n\nexport default async function pRetry(input, options = {}) {\n\toptions = {...options};\n\n\tvalidateRetries(options.retries);\n\n\tif (Object.hasOwn(options, 'forever')) {\n\t\tthrow new Error('The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.');\n\t}\n\n\toptions.retries ??= 10;\n\toptions.factor ??= 2;\n\toptions.minTimeout ??= 1000;\n\toptions.maxTimeout ??= Number.POSITIVE_INFINITY;\n\toptions.maxRetryTime ??= Number.POSITIVE_INFINITY;\n\toptions.randomize ??= false;\n\toptions.onFailedAttempt ??= () => {};\n\toptions.shouldRetry ??= () => true;\n\toptions.shouldConsumeRetry ??= () => true;\n\n\t// Validate numeric options and normalize edge cases\n\tvalidateFunctionOption('onFailedAttempt', options.onFailedAttempt);\n\tvalidateFunctionOption('shouldRetry', options.shouldRetry);\n\tvalidateFunctionOption('shouldConsumeRetry', options.shouldConsumeRetry);\n\tvalidateNumberOption('factor', options.factor, {min: 0, allowInfinity: false});\n\tvalidateNumberOption('minTimeout', options.minTimeout, {min: 0, allowInfinity: false});\n\tvalidateNumberOption('maxTimeout', options.maxTimeout, {min: 0, allowInfinity: true});\n\tvalidateNumberOption('maxRetryTime', options.maxRetryTime, {min: 0, allowInfinity: true});\n\n\t// Treat non-positive factor as 1 to avoid zero backoff or negative behavior\n\tif (!(options.factor > 0)) {\n\t\toptions.factor = 1;\n\t}\n\n\toptions.signal?.throwIfAborted();\n\n\tlet attemptNumber = 0;\n\tlet retriesConsumed = 0;\n\tconst startTime = performance.now();\n\n\twhile (Number.isFinite(options.retries) ? retriesConsumed <= options.retries : true) {\n\t\tattemptNumber++;\n\n\t\ttry {\n\t\t\toptions.signal?.throwIfAborted();\n\n\t\t\tconst result = await input(attemptNumber);\n\n\t\t\toptions.signal?.throwIfAborted();\n\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (await onAttemptFailure({\n\t\t\t\terror,\n\t\t\t\tattemptNumber,\n\t\t\t\tretriesConsumed,\n\t\t\t\tstartTime,\n\t\t\t\toptions,\n\t\t\t})) {\n\t\t\t\tretriesConsumed++;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Should not reach here, but in case it does, throw an error\n\tthrow new Error('Retry attempts exhausted without throwing an error.');\n}\n\nexport function makeRetriable(function_, options) {\n\treturn function (...arguments_) {\n\t\treturn pRetry(() => function_.apply(this, arguments_), options);\n\t};\n}\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","import EventEmitter from './index.js'\n\nexport { EventEmitter }\nexport default EventEmitter\n","export class TimeoutError extends Error {\n\tname = 'TimeoutError';\n\n\tconstructor(message, options) {\n\t\tsuper(message, options);\n\t\tError.captureStackTrace?.(this, TimeoutError);\n\t}\n}\n\nconst getAbortedReason = signal => signal.reason ?? new DOMException('This operation was aborted.', 'AbortError');\n\nexport default function pTimeout(promise, options) {\n\tconst {\n\t\tmilliseconds,\n\t\tfallback,\n\t\tmessage,\n\t\tcustomTimers = {setTimeout, clearTimeout},\n\t\tsignal,\n\t} = options;\n\n\tlet timer;\n\tlet abortHandler;\n\n\tconst wrappedPromise = new Promise((resolve, reject) => {\n\t\tif (typeof milliseconds !== 'number' || Math.sign(milliseconds) !== 1) {\n\t\t\tthrow new TypeError(`Expected \\`milliseconds\\` to be a positive number, got \\`${milliseconds}\\``);\n\t\t}\n\n\t\tif (signal?.aborted) {\n\t\t\treject(getAbortedReason(signal));\n\t\t\treturn;\n\t\t}\n\n\t\tif (signal) {\n\t\t\tabortHandler = () => {\n\t\t\t\treject(getAbortedReason(signal));\n\t\t\t};\n\n\t\t\tsignal.addEventListener('abort', abortHandler, {once: true});\n\t\t}\n\n\t\t// Use .then() instead of async IIFE to preserve stack traces\n\t\t// eslint-disable-next-line promise/prefer-await-to-then, promise/prefer-catch\n\t\tpromise.then(resolve, reject);\n\n\t\tif (milliseconds === Number.POSITIVE_INFINITY) {\n\t\t\treturn;\n\t\t}\n\n\t\t// We create the error outside of `setTimeout` to preserve the stack trace.\n\t\tconst timeoutError = new TimeoutError();\n\n\t\t// `.call(undefined, ...)` is needed for custom timers to avoid context issues\n\t\ttimer = customTimers.setTimeout.call(undefined, () => {\n\t\t\tif (fallback) {\n\t\t\t\ttry {\n\t\t\t\t\tresolve(fallback());\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (typeof promise.cancel === 'function') {\n\t\t\t\tpromise.cancel();\n\t\t\t}\n\n\t\t\tif (message === false) {\n\t\t\t\tresolve();\n\t\t\t} else if (message instanceof Error) {\n\t\t\t\treject(message);\n\t\t\t} else {\n\t\t\t\ttimeoutError.message = message ?? `Promise timed out after ${milliseconds} milliseconds`;\n\t\t\t\treject(timeoutError);\n\t\t\t}\n\t\t}, milliseconds);\n\t});\n\n\t// eslint-disable-next-line promise/prefer-await-to-then\n\tconst cancelablePromise = wrappedPromise.finally(() => {\n\t\tcancelablePromise.clear();\n\t\tif (abortHandler && signal) {\n\t\t\tsignal.removeEventListener('abort', abortHandler);\n\t\t}\n\t});\n\n\tcancelablePromise.clear = () => {\n\t\t// `.call(undefined, ...)` is needed for custom timers to avoid context issues\n\t\tcustomTimers.clearTimeout.call(undefined, timer);\n\t\ttimer = undefined;\n\t};\n\n\treturn cancelablePromise;\n}\n","// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound\n// Used to compute insertion index to keep queue sorted after insertion\nexport default function lowerBound(array, value, comparator) {\n let first = 0;\n let count = array.length;\n while (count > 0) {\n const step = Math.trunc(count / 2);\n let it = first + step;\n if (comparator(array[it], value) <= 0) {\n first = ++it;\n count -= step + 1;\n }\n else {\n count = step;\n }\n }\n return first;\n}\n","import lowerBound from './lower-bound.js';\nexport default class PriorityQueue {\n #queue = [];\n enqueue(run, options) {\n const { priority = 0, id, } = options ?? {};\n const element = {\n priority,\n id,\n run,\n };\n if (this.size === 0 || this.#queue[this.size - 1].priority >= priority) {\n this.#queue.push(element);\n return;\n }\n const index = lowerBound(this.#queue, element, (a, b) => b.priority - a.priority);\n this.#queue.splice(index, 0, element);\n }\n setPriority(id, priority) {\n const index = this.#queue.findIndex((element) => element.id === id);\n if (index === -1) {\n throw new ReferenceError(`No promise function with the id \"${id}\" exists in the queue.`);\n }\n const [item] = this.#queue.splice(index, 1);\n this.enqueue(item.run, { priority, id });\n }\n dequeue() {\n const item = this.#queue.shift();\n return item?.run;\n }\n filter(options) {\n return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);\n }\n get size() {\n return this.#queue.length;\n }\n}\n","import { EventEmitter } from 'eventemitter3';\nimport pTimeout from 'p-timeout';\nimport PriorityQueue from './priority-queue.js';\n/**\nPromise queue with concurrency control.\n*/\nexport default class PQueue extends EventEmitter {\n #carryoverIntervalCount;\n #isIntervalIgnored;\n #intervalCount = 0;\n #intervalCap;\n #rateLimitedInInterval = false;\n #rateLimitFlushScheduled = false;\n #interval;\n #intervalEnd = 0;\n #lastExecutionTime = 0;\n #intervalId;\n #timeoutId;\n #strict;\n // Circular buffer implementation for better performance\n #strictTicks = [];\n #strictTicksStartIndex = 0;\n #queue;\n #queueClass;\n #pending = 0;\n // The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194\n #concurrency;\n #isPaused;\n // Use to assign a unique identifier to a promise function, if not explicitly specified\n #idAssigner = 1n;\n // Track currently running tasks for debugging\n #runningTasks = new Map();\n /**\n Get or set the default timeout for all tasks. Can be changed at runtime.\n\n Operations will throw a `TimeoutError` if they don't complete within the specified time.\n\n The timeout begins when the operation is dequeued and starts execution, not while it's waiting in the queue.\n\n @example\n ```\n const queue = new PQueue({timeout: 5000});\n\n // Change timeout for all future tasks\n queue.timeout = 10000;\n ```\n */\n timeout;\n constructor(options) {\n super();\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n options = {\n carryoverIntervalCount: false,\n intervalCap: Number.POSITIVE_INFINITY,\n interval: 0,\n concurrency: Number.POSITIVE_INFINITY,\n autoStart: true,\n queueClass: PriorityQueue,\n strict: false,\n ...options,\n };\n if (!(typeof options.intervalCap === 'number' && options.intervalCap >= 1)) {\n throw new TypeError(`Expected \\`intervalCap\\` to be a number from 1 and up, got \\`${options.intervalCap?.toString() ?? ''}\\` (${typeof options.intervalCap})`);\n }\n if (options.interval === undefined || !(Number.isFinite(options.interval) && options.interval >= 0)) {\n throw new TypeError(`Expected \\`interval\\` to be a finite number >= 0, got \\`${options.interval?.toString() ?? ''}\\` (${typeof options.interval})`);\n }\n if (options.strict && options.interval === 0) {\n throw new TypeError('The `strict` option requires a non-zero `interval`');\n }\n if (options.strict && options.intervalCap === Number.POSITIVE_INFINITY) {\n throw new TypeError('The `strict` option requires a finite `intervalCap`');\n }\n // TODO: Remove this fallback in the next major version\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n this.#carryoverIntervalCount = options.carryoverIntervalCount ?? options.carryoverConcurrencyCount ?? false;\n this.#isIntervalIgnored = options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0;\n this.#intervalCap = options.intervalCap;\n this.#interval = options.interval;\n this.#strict = options.strict;\n this.#queue = new options.queueClass();\n this.#queueClass = options.queueClass;\n this.concurrency = options.concurrency;\n if (options.timeout !== undefined && !(Number.isFinite(options.timeout) && options.timeout > 0)) {\n throw new TypeError(`Expected \\`timeout\\` to be a positive finite number, got \\`${options.timeout}\\` (${typeof options.timeout})`);\n }\n this.timeout = options.timeout;\n this.#isPaused = options.autoStart === false;\n this.#setupRateLimitTracking();\n }\n #cleanupStrictTicks(now) {\n // Remove ticks outside the current interval window using circular buffer approach\n while (this.#strictTicksStartIndex < this.#strictTicks.length) {\n const oldestTick = this.#strictTicks[this.#strictTicksStartIndex];\n if (oldestTick !== undefined && now - oldestTick >= this.#interval) {\n this.#strictTicksStartIndex++;\n }\n else {\n break;\n }\n }\n // Compact the array when it becomes inefficient or fully consumed\n // Compact when: (start index is large AND more than half wasted) OR all ticks expired\n const shouldCompact = (this.#strictTicksStartIndex > 100 && this.#strictTicksStartIndex > this.#strictTicks.length / 2)\n || this.#strictTicksStartIndex === this.#strictTicks.length;\n if (shouldCompact) {\n this.#strictTicks = this.#strictTicks.slice(this.#strictTicksStartIndex);\n this.#strictTicksStartIndex = 0;\n }\n }\n // Helper methods for interval consumption\n #consumeIntervalSlot(now) {\n if (this.#strict) {\n this.#strictTicks.push(now);\n }\n else {\n this.#intervalCount++;\n }\n }\n #rollbackIntervalSlot() {\n if (this.#strict) {\n // Pop from the end of the actual data (not from start index)\n if (this.#strictTicks.length > this.#strictTicksStartIndex) {\n this.#strictTicks.pop();\n }\n }\n else if (this.#intervalCount > 0) {\n this.#intervalCount--;\n }\n }\n #getActiveTicksCount() {\n return this.#strictTicks.length - this.#strictTicksStartIndex;\n }\n get #doesIntervalAllowAnother() {\n if (this.#isIntervalIgnored) {\n return true;\n }\n if (this.#strict) {\n // Cleanup already done by #isIntervalPausedAt before this is called\n return this.#getActiveTicksCount() < this.#intervalCap;\n }\n return this.#intervalCount < this.#intervalCap;\n }\n get #doesConcurrentAllowAnother() {\n return this.#pending < this.#concurrency;\n }\n #next() {\n this.#pending--;\n if (this.#pending === 0) {\n this.emit('pendingZero');\n }\n this.#tryToStartAnother();\n this.emit('next');\n }\n #onResumeInterval() {\n // Clear timeout ID before processing to prevent race condition\n // Must clear before #onInterval to allow new timeouts to be scheduled\n this.#timeoutId = undefined;\n this.#onInterval();\n this.#initializeIntervalIfNeeded();\n }\n #isIntervalPausedAt(now) {\n // Strict mode: check if we need to wait for oldest tick to age out\n if (this.#strict) {\n this.#cleanupStrictTicks(now);\n // If at capacity, need to wait for oldest tick to age out\n const activeTicksCount = this.#getActiveTicksCount();\n if (activeTicksCount >= this.#intervalCap) {\n const oldestTick = this.#strictTicks[this.#strictTicksStartIndex];\n // After cleanup, remaining ticks are within interval, so delay is always > 0\n const delay = this.#interval - (now - oldestTick);\n this.#createIntervalTimeout(delay);\n return true;\n }\n return false;\n }\n // Fixed window mode (original logic)\n if (this.#intervalId === undefined) {\n const delay = this.#intervalEnd - now;\n if (delay < 0) {\n // If the interval has expired while idle, check if we should enforce the interval\n // from the last task execution. This ensures proper spacing between tasks even\n // when the queue becomes empty and then new tasks are added.\n if (this.#lastExecutionTime > 0) {\n const timeSinceLastExecution = now - this.#lastExecutionTime;\n if (timeSinceLastExecution < this.#interval) {\n // Not enough time has passed since the last task execution\n this.#createIntervalTimeout(this.#interval - timeSinceLastExecution);\n return true;\n }\n }\n // Enough time has passed or no previous execution, allow execution\n this.#intervalCount = (this.#carryoverIntervalCount) ? this.#pending : 0;\n }\n else {\n // Act as the interval is pending\n this.#createIntervalTimeout(delay);\n return true;\n }\n }\n return false;\n }\n #createIntervalTimeout(delay) {\n if (this.#timeoutId !== undefined) {\n return;\n }\n this.#timeoutId = setTimeout(() => {\n this.#onResumeInterval();\n }, delay);\n }\n #clearIntervalTimer() {\n if (this.#intervalId) {\n clearInterval(this.#intervalId);\n this.#intervalId = undefined;\n }\n }\n #clearTimeoutTimer() {\n if (this.#timeoutId) {\n clearTimeout(this.#timeoutId);\n this.#timeoutId = undefined;\n }\n }\n #tryToStartAnother() {\n if (this.#queue.size === 0) {\n // We can clear the interval (\"pause\")\n // Because we can redo it later (\"resume\")\n this.#clearIntervalTimer();\n this.emit('empty');\n if (this.#pending === 0) {\n // Clear timeout as well when completely idle\n this.#clearTimeoutTimer();\n // Compact strict ticks when idle to free memory\n if (this.#strict && this.#strictTicksStartIndex > 0) {\n const now = Date.now();\n this.#cleanupStrictTicks(now);\n }\n this.emit('idle');\n }\n return false;\n }\n let taskStarted = false;\n if (!this.#isPaused) {\n const now = Date.now();\n const canInitializeInterval = !this.#isIntervalPausedAt(now);\n if (this.#doesIntervalAllowAnother && this.#doesConcurrentAllowAnother) {\n const job = this.#queue.dequeue();\n if (!this.#isIntervalIgnored) {\n this.#consumeIntervalSlot(now);\n this.#scheduleRateLimitUpdate();\n }\n this.emit('active');\n job();\n if (canInitializeInterval) {\n this.#initializeIntervalIfNeeded();\n }\n taskStarted = true;\n }\n }\n return taskStarted;\n }\n #initializeIntervalIfNeeded() {\n if (this.#isIntervalIgnored || this.#intervalId !== undefined) {\n return;\n }\n // Strict mode uses timeouts instead of interval timers\n if (this.#strict) {\n return;\n }\n this.#intervalId = setInterval(() => {\n this.#onInterval();\n }, this.#interval);\n this.#intervalEnd = Date.now() + this.#interval;\n }\n #onInterval() {\n // Non-strict mode uses interval timers and intervalCount\n if (!this.#strict) {\n if (this.#intervalCount === 0 && this.#pending === 0 && this.#intervalId) {\n this.#clearIntervalTimer();\n }\n this.#intervalCount = this.#carryoverIntervalCount ? this.#pending : 0;\n }\n this.#processQueue();\n this.#scheduleRateLimitUpdate();\n }\n /**\n Executes all queued functions until it reaches the limit.\n */\n #processQueue() {\n // eslint-disable-next-line no-empty\n while (this.#tryToStartAnother()) { }\n }\n get concurrency() {\n return this.#concurrency;\n }\n set concurrency(newConcurrency) {\n if (!(typeof newConcurrency === 'number' && newConcurrency >= 1)) {\n throw new TypeError(`Expected \\`concurrency\\` to be a number from 1 and up, got \\`${newConcurrency}\\` (${typeof newConcurrency})`);\n }\n this.#concurrency = newConcurrency;\n this.#processQueue();\n }\n /**\n Updates the priority of a promise function by its id, affecting its execution order. Requires a defined concurrency limit to take effect.\n\n For example, this can be used to prioritize a promise function to run earlier.\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 1});\n\n queue.add(async () => '🦄', {priority: 1});\n queue.add(async () => '🦀', {priority: 0, id: '🦀'});\n queue.add(async () => '🦄', {priority: 1});\n queue.add(async () => '🦄', {priority: 1});\n\n queue.setPriority('🦀', 2);\n ```\n\n In this case, the promise function with `id: '🦀'` runs second.\n\n You can also deprioritize a promise function to delay its execution:\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 1});\n\n queue.add(async () => '🦄', {priority: 1});\n queue.add(async () => '🦀', {priority: 1, id: '🦀'});\n queue.add(async () => '🦄');\n queue.add(async () => '🦄', {priority: 0});\n\n queue.setPriority('🦀', -1);\n ```\n Here, the promise function with `id: '🦀'` executes last.\n */\n setPriority(id, priority) {\n if (typeof priority !== 'number' || !Number.isFinite(priority)) {\n throw new TypeError(`Expected \\`priority\\` to be a finite number, got \\`${priority}\\` (${typeof priority})`);\n }\n this.#queue.setPriority(id, priority);\n }\n async add(function_, options = {}) {\n // Create a copy to avoid mutating the original options object\n options = {\n timeout: this.timeout,\n ...options,\n // Assign unique ID if not provided\n id: options.id ?? (this.#idAssigner++).toString(),\n };\n return new Promise((resolve, reject) => {\n // Create a unique symbol for tracking this task\n const taskSymbol = Symbol(`task-${options.id}`);\n this.#queue.enqueue(async () => {\n this.#pending++;\n // Track this running task\n this.#runningTasks.set(taskSymbol, {\n id: options.id,\n priority: options.priority ?? 0, // Match priority-queue default\n startTime: Date.now(),\n timeout: options.timeout,\n });\n let eventListener;\n try {\n // Check abort signal - if aborted, need to decrement the counter\n // that was incremented in tryToStartAnother\n try {\n options.signal?.throwIfAborted();\n }\n catch (error) {\n this.#rollbackIntervalConsumption();\n // Clean up tracking before throwing\n this.#runningTasks.delete(taskSymbol);\n throw error;\n }\n this.#lastExecutionTime = Date.now();\n let operation = function_({ signal: options.signal });\n if (options.timeout) {\n operation = pTimeout(Promise.resolve(operation), {\n milliseconds: options.timeout,\n message: `Task timed out after ${options.timeout}ms (queue has ${this.#pending} running, ${this.#queue.size} waiting)`,\n });\n }\n if (options.signal) {\n const { signal } = options;\n operation = Promise.race([operation, new Promise((_resolve, reject) => {\n eventListener = () => {\n reject(signal.reason);\n };\n signal.addEventListener('abort', eventListener, { once: true });\n })]);\n }\n const result = await operation;\n resolve(result);\n this.emit('completed', result);\n }\n catch (error) {\n reject(error);\n this.emit('error', error);\n }\n finally {\n // Clean up abort event listener\n if (eventListener) {\n options.signal?.removeEventListener('abort', eventListener);\n }\n // Remove from running tasks\n this.#runningTasks.delete(taskSymbol);\n // Use queueMicrotask to prevent deep recursion while maintaining timing\n queueMicrotask(() => {\n this.#next();\n });\n }\n }, options);\n this.emit('add');\n this.#tryToStartAnother();\n });\n }\n async addAll(functions, options) {\n return Promise.all(functions.map(async (function_) => this.add(function_, options)));\n }\n /**\n Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)\n */\n start() {\n if (!this.#isPaused) {\n return this;\n }\n this.#isPaused = false;\n this.#processQueue();\n return this;\n }\n /**\n Put queue execution on hold.\n */\n pause() {\n this.#isPaused = true;\n }\n /**\n Clear the queue.\n */\n clear() {\n this.#queue = new this.#queueClass();\n // Clear interval timer since queue is now empty (consistent with #tryToStartAnother)\n this.#clearIntervalTimer();\n // Note: We preserve strict mode rate-limiting state (ticks and timeout)\n // because clear() only clears queued tasks, not rate limit history.\n // This ensures that rate limits are still enforced after clearing the queue.\n // Note: We don't clear #runningTasks as those tasks are still running\n // They will be removed when they complete in the finally block\n // Force synchronous update since clear() should have immediate effect\n this.#updateRateLimitState();\n // Emit events so waiters (onEmpty, onIdle, onSizeLessThan) can resolve\n this.emit('empty');\n if (this.#pending === 0) {\n this.#clearTimeoutTimer();\n this.emit('idle');\n }\n this.emit('next');\n }\n /**\n Can be called multiple times. Useful if you for example add additional items at a later time.\n\n @returns A promise that settles when the queue becomes empty.\n */\n async onEmpty() {\n // Instantly resolve if the queue is empty\n if (this.#queue.size === 0) {\n return;\n }\n await this.#onEvent('empty');\n }\n /**\n @returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.\n\n If you want to avoid having the queue grow beyond a certain size you can `await queue.onSizeLessThan()` before adding a new item.\n\n Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.\n */\n async onSizeLessThan(limit) {\n // Instantly resolve if the queue is empty.\n if (this.#queue.size < limit) {\n return;\n }\n await this.#onEvent('next', () => this.#queue.size < limit);\n }\n /**\n The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.\n\n @returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.\n */\n async onIdle() {\n // Instantly resolve if none pending and if nothing else is queued\n if (this.#pending === 0 && this.#queue.size === 0) {\n return;\n }\n await this.#onEvent('idle');\n }\n /**\n The difference with `.onIdle` is that `.onPendingZero` only waits for currently running tasks to finish, ignoring queued tasks.\n\n @returns A promise that settles when all currently running tasks have completed; `queue.pending === 0`.\n */\n async onPendingZero() {\n if (this.#pending === 0) {\n return;\n }\n await this.#onEvent('pendingZero');\n }\n /**\n @returns A promise that settles when the queue becomes rate-limited due to intervalCap.\n */\n async onRateLimit() {\n if (this.isRateLimited) {\n return;\n }\n await this.#onEvent('rateLimit');\n }\n /**\n @returns A promise that settles when the queue is no longer rate-limited.\n */\n async onRateLimitCleared() {\n if (!this.isRateLimited) {\n return;\n }\n await this.#onEvent('rateLimitCleared');\n }\n /**\n @returns A promise that rejects when any task in the queue errors.\n\n Use with `Promise.race([queue.onError(), queue.onIdle()])` to fail fast on the first error while still resolving normally when the queue goes idle.\n\n Important: The promise returned by `add()` still rejects. You must handle each `add()` promise (for example, `.catch(() => {})`) to avoid unhandled rejections.\n\n @example\n ```\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 2});\n\n queue.add(() => fetchData(1)).catch(() => {});\n queue.add(() => fetchData(2)).catch(() => {});\n queue.add(() => fetchData(3)).catch(() => {});\n\n // Stop processing on first error\n try {\n await Promise.race([\n queue.onError(),\n queue.onIdle()\n ]);\n } catch (error) {\n queue.pause(); // Stop processing remaining tasks\n console.error('Queue failed:', error);\n }\n ```\n */\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n onError() {\n return new Promise((_resolve, reject) => {\n const handleError = (error) => {\n this.off('error', handleError);\n reject(error);\n };\n this.on('error', handleError);\n });\n }\n async #onEvent(event, filter) {\n return new Promise(resolve => {\n const listener = () => {\n if (filter && !filter()) {\n return;\n }\n this.off(event, listener);\n resolve();\n };\n this.on(event, listener);\n });\n }\n /**\n Size of the queue, the number of queued items waiting to run.\n */\n get size() {\n return this.#queue.size;\n }\n /**\n Size of the queue, filtered by the given options.\n\n For example, this can be used to find the number of items remaining in the queue with a specific priority level.\n */\n sizeBy(options) {\n // eslint-disable-next-line unicorn/no-array-callback-reference\n return this.#queue.filter(options).length;\n }\n /**\n Number of running items (no longer in the queue).\n */\n get pending() {\n return this.#pending;\n }\n /**\n Whether the queue is currently paused.\n */\n get isPaused() {\n return this.#isPaused;\n }\n #setupRateLimitTracking() {\n // Only schedule updates when rate limiting is enabled\n if (this.#isIntervalIgnored) {\n return;\n }\n // Wire up to lifecycle events that affect rate limit state\n // Only 'add' and 'next' can actually change rate limit state\n this.on('add', () => {\n if (this.#queue.size > 0) {\n this.#scheduleRateLimitUpdate();\n }\n });\n this.on('next', () => {\n this.#scheduleRateLimitUpdate();\n });\n }\n #scheduleRateLimitUpdate() {\n // Skip if rate limiting is not enabled or already scheduled\n if (this.#isIntervalIgnored || this.#rateLimitFlushScheduled) {\n return;\n }\n this.#rateLimitFlushScheduled = true;\n queueMicrotask(() => {\n this.#rateLimitFlushScheduled = false;\n this.#updateRateLimitState();\n });\n }\n #rollbackIntervalConsumption() {\n if (this.#isIntervalIgnored) {\n return;\n }\n this.#rollbackIntervalSlot();\n this.#scheduleRateLimitUpdate();\n }\n #updateRateLimitState() {\n const previous = this.#rateLimitedInInterval;\n // Early exit if rate limiting is disabled or queue is empty\n if (this.#isIntervalIgnored || this.#queue.size === 0) {\n if (previous) {\n this.#rateLimitedInInterval = false;\n this.emit('rateLimitCleared');\n }\n return;\n }\n // Get the current count based on mode\n let count;\n if (this.#strict) {\n const now = Date.now();\n this.#cleanupStrictTicks(now);\n count = this.#getActiveTicksCount();\n }\n else {\n count = this.#intervalCount;\n }\n const shouldBeRateLimited = count >= this.#intervalCap;\n if (shouldBeRateLimited !== previous) {\n this.#rateLimitedInInterval = shouldBeRateLimited;\n this.emit(shouldBeRateLimited ? 'rateLimit' : 'rateLimitCleared');\n }\n }\n /**\n Whether the queue is currently rate-limited due to intervalCap.\n */\n get isRateLimited() {\n return this.#rateLimitedInInterval;\n }\n /**\n Whether the queue is saturated. Returns `true` when:\n - All concurrency slots are occupied and tasks are waiting, OR\n - The queue is rate-limited and tasks are waiting\n\n Useful for detecting backpressure and potential hanging tasks.\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 2});\n\n // Backpressure handling\n if (queue.isSaturated) {\n console.log('Queue is saturated, waiting for capacity...');\n await queue.onSizeLessThan(queue.concurrency);\n }\n\n // Monitoring for stuck tasks\n setInterval(() => {\n if (queue.isSaturated) {\n console.warn(`Queue saturated: ${queue.pending} running, ${queue.size} waiting`);\n }\n }, 60000);\n ```\n */\n get isSaturated() {\n return (this.#pending === this.#concurrency && this.#queue.size > 0)\n || (this.isRateLimited && this.#queue.size > 0);\n }\n /**\n The tasks currently being executed. Each task includes its `id`, `priority`, `startTime`, and `timeout` (if set).\n\n Returns an array of task info objects.\n\n ```js\n import PQueue from 'p-queue';\n\n const queue = new PQueue({concurrency: 2});\n\n // Add tasks with IDs for better debugging\n queue.add(() => fetchUser(123), {id: 'user-123'});\n queue.add(() => fetchPosts(456), {id: 'posts-456', priority: 1});\n\n // Check what's running\n console.log(queue.runningTasks);\n // => [{\n // id: 'user-123',\n // priority: 0,\n // startTime: 1759253001716,\n // timeout: undefined\n // }, {\n // id: 'posts-456',\n // priority: 1,\n // startTime: 1759253001916,\n // timeout: undefined\n // }]\n ```\n */\n get runningTasks() {\n // Return fresh array with fresh objects to prevent mutations\n return [...this.#runningTasks.values()].map(task => ({ ...task }));\n }\n}\n/**\nError thrown when a task times out.\n\n@example\n```\nimport PQueue, {TimeoutError} from 'p-queue';\n\nconst queue = new PQueue({timeout: 1000});\n\ntry {\n await queue.add(() => someTask());\n} catch (error) {\n if (error instanceof TimeoutError) {\n console.log('Task timed out');\n }\n}\n```\n*/\nexport { TimeoutError } from 'p-timeout';\n","/**\n * Comprehensive error handling for BMLT Query Client\n */\n\nexport enum BmltErrorType {\n API_ERROR = 'ApiError',\n NETWORK_ERROR = 'NetworkError',\n VALIDATION_ERROR = 'ValidationError',\n GEOCODING_ERROR = 'GeocodingError',\n RATE_LIMIT_ERROR = 'RateLimitError',\n TIMEOUT_ERROR = 'TimeoutError',\n AUTHENTICATION_ERROR = 'AuthenticationError',\n SERVER_ERROR = 'ServerError',\n CLIENT_ERROR = 'ClientError',\n CONFIGURATION_ERROR = 'ConfigurationError',\n}\n\nexport class BmltQueryError extends Error {\n public readonly type: BmltErrorType;\n public readonly statusCode?: number;\n public readonly response?: unknown;\n public readonly originalError?: Error;\n public readonly context?: Record<string, unknown>;\n\n constructor(\n type: BmltErrorType,\n message: string,\n options: {\n statusCode?: number;\n response?: unknown;\n originalError?: Error;\n context?: Record<string, unknown>;\n } = {}\n ) {\n super(message);\n this.name = 'BmltQueryError';\n this.type = type;\n this.statusCode = options.statusCode;\n this.response = options.response;\n this.originalError = options.originalError;\n this.context = options.context;\n\n // Ensure proper prototype chain for instanceof checks\n Object.setPrototypeOf(this, BmltQueryError.prototype);\n }\n\n /**\n * Check if error is of a specific type\n */\n isType(type: BmltErrorType): boolean {\n return this.type === type;\n }\n\n /**\n * Check if error is retryable\n */\n isRetryable(): boolean {\n const retryableTypes = [\n BmltErrorType.NETWORK_ERROR,\n BmltErrorType.TIMEOUT_ERROR,\n BmltErrorType.RATE_LIMIT_ERROR,\n BmltErrorType.SERVER_ERROR,\n ];\n return retryableTypes.includes(this.type);\n }\n\n /**\n * Check if error is a client-side error (4xx)\n */\n isClientError(): boolean {\n return this.statusCode !== undefined && this.statusCode >= 400 && this.statusCode < 500;\n }\n\n /**\n * Check if error is a server-side error (5xx)\n */\n isServerError(): boolean {\n return this.statusCode !== undefined && this.statusCode >= 500;\n }\n\n /**\n * Get a user-friendly error message\n */\n getUserMessage(): string {\n switch (this.type) {\n case BmltErrorType.NETWORK_ERROR:\n return 'Unable to connect to the BMLT server. Please check your internet connection and try again.';\n\n case BmltErrorType.TIMEOUT_ERROR:\n return 'The request timed out. Please try again later.';\n\n case BmltErrorType.RATE_LIMIT_ERROR:\n return 'Too many requests. Please wait a moment and try again.';\n\n case BmltErrorType.GEOCODING_ERROR:\n return 'Unable to find the specified address. Please check the address and try again.';\n\n case BmltErrorType.VALIDATION_ERROR:\n return 'Invalid input provided. Please check your parameters and try again.';\n\n case BmltErrorType.AUTHENTICATION_ERROR:\n return 'Authentication failed. Please check your credentials.';\n\n case BmltErrorType.SERVER_ERROR:\n return 'The BMLT server encountered an error. Please try again later.';\n\n case BmltErrorType.API_ERROR:\n if (this.statusCode === 404) {\n return 'The requested resource was not found.';\n }\n return 'An error occurred while communicating with the BMLT server.';\n\n case BmltErrorType.CONFIGURATION_ERROR:\n return 'Invalid configuration. Please check your settings.';\n\n default:\n return this.message || 'An unexpected error occurred.';\n }\n }\n\n /**\n * Convert error to JSON for logging\n */\n toJSON() {\n return {\n name: this.name,\n type: this.type,\n message: this.message,\n statusCode: this.statusCode,\n response: this.response,\n context: this.context,\n stack: this.stack,\n originalError: this.originalError\n ? {\n name: this.originalError.name,\n message: this.originalError.message,\n stack: this.originalError.stack,\n }\n : undefined,\n };\n }\n}\n\n/**\n * Factory class for creating specific error types\n */\nexport class ErrorFactory {\n static createApiError(\n message: string,\n statusCode?: number,\n response?: unknown,\n originalError?: Error\n ): BmltQueryError {\n let type: BmltErrorType;\n\n if (statusCode) {\n if (statusCode >= 500) {\n type = BmltErrorType.SERVER_ERROR;\n } else if (statusCode === 401 || statusCode === 403) {\n type = BmltErrorType.AUTHENTICATION_ERROR;\n } else if (statusCode === 429) {\n type = BmltErrorType.RATE_LIMIT_ERROR;\n } else if (statusCode >= 400) {\n type = BmltErrorType.CLIENT_ERROR;\n } else {\n type = BmltErrorType.API_ERROR;\n }\n } else {\n type = BmltErrorType.API_ERROR;\n }\n\n return new BmltQueryError(type, message, {\n statusCode,\n response,\n originalError,\n });\n }\n\n static createNetworkError(message: string, originalError?: Error): BmltQueryError {\n return new BmltQueryError(BmltErrorType.NETWORK_ERROR, message, {\n originalError,\n });\n }\n\n static createTimeoutError(message: string, originalError?: Error): BmltQueryError {\n return new BmltQueryError(BmltErrorType.TIMEOUT_ERROR, message, {\n originalError,\n });\n }\n\n static createValidationError(message: string, context?: Record<string, unknown>): BmltQueryError {\n return new BmltQueryError(BmltErrorType.VALIDATION_ERROR, message, {\n context,\n });\n }\n\n static createGeocodingError(\n message: string,\n originalError?: Error,\n context?: Record<string, unknown>\n ): BmltQueryError {\n return new BmltQueryError(BmltErrorType.GEOCODING_ERROR, message, {\n originalError,\n context,\n });\n }\n\n static createRateLimitError(\n message: string,\n statusCode?: number,\n response?: unknown\n ): BmltQueryError {\n return new BmltQueryError(BmltErrorType.RATE_LIMIT_ERROR, message, {\n statusCode,\n response,\n });\n }\n\n static createConfigurationError(\n message: string,\n context?: Record<string, unknown>\n ): BmltQueryError {\n return new BmltQueryError(BmltErrorType.CONFIGURATION_ERROR, message, {\n context,\n });\n }\n}\n\n/**\n * Error handler utility class\n */\nexport class ErrorHandler {\n /**\n * Handle and transform fetch errors\n */\n static handleFetchError(error: unknown, response?: Response): BmltQueryError {\n // Handle AbortError (timeout)\n if (error instanceof Error && error.name === 'AbortError') {\n return ErrorFactory.createTimeoutError('Request timeout', error);\n }\n\n // Handle TypeError (network errors)\n if (error instanceof TypeError) {\n return ErrorFactory.createNetworkError('Network connection failed', error);\n }\n\n if (response && !response.ok) {\n // Server responded with error status\n const message = `HTTP ${response.status}: ${response.statusText}`;\n return ErrorFactory.createApiError(message, response.status, undefined, error as Error);\n }\n\n // Handle other errors\n if (error instanceof Error) {\n return ErrorFactory.createApiError(error.message, undefined, undefined, error);\n }\n\n // Fallback for unknown errors\n return ErrorFactory.createApiError(\n 'Unknown error occurred',\n undefined,\n undefined,\n new Error(String(error))\n );\n }\n\n /**\n * @deprecated Use handleFetchError instead\n */\n static handleAxiosError(error: any): BmltQueryError {\n return ErrorHandler.handleFetchError(error);\n }\n\n /**\n * Handle validation errors with detailed context\n */\n static handleValidationError(\n field: string,\n value: unknown,\n expectedType: string,\n constraints?: string[]\n ): BmltQueryError {\n let message = `Invalid ${field}: expected ${expectedType}`;\n\n if (constraints && constraints.length > 0) {\n message += ` (${constraints.join(', ')})`;\n }\n\n return ErrorFactory.createValidationError(message, {\n field,\n value,\n expectedType,\n constraints,\n });\n }\n\n /**\n * Handle endpoint validation errors\n */\n static handleEndpointError(endpoint: string, format: string): BmltQueryError {\n const message = `Invalid endpoint/format combination: ${endpoint} with ${format}`;\n return ErrorFactory.createValidationError(message, {\n endpoint,\n format,\n });\n }\n\n /**\n * Handle URL validation errors\n */\n static handleUrlError(url: string, reason: string): BmltQueryError {\n const message = `Invalid URL: ${reason}`;\n return ErrorFactory.createValidationError(message, {\n url,\n reason,\n });\n }\n\n /**\n * Handle coordinate validation errors\n */\n static handleCoordinateError(\n latitude?: number,\n longitude?: number,\n reason?: string\n ): BmltQueryError {\n const message = reason || 'Invalid coordinates provided';\n return ErrorFactory.createValidationError(message, {\n latitude,\n longitude,\n reason,\n });\n }\n\n /**\n * Wrap and enhance existing errors\n */\n static wrapError(\n originalError: Error,\n context: string,\n additionalContext?: Record<string, unknown>\n ): BmltQueryError {\n const message = `${context}: ${originalError.message}`;\n\n // Try to preserve the original error type if it's already a BmltQueryError\n if (originalError instanceof BmltQueryError) {\n return new BmltQueryError(originalError.type, message, {\n statusCode: originalError.statusCode,\n response: originalError.response,\n originalError: originalError.originalError || originalError,\n context: {\n ...originalError.context,\n ...additionalContext,\n },\n });\n }\n\n // Default to API error for unknown errors\n return ErrorFactory.createApiError(message, undefined, undefined, originalError);\n }\n}\n\n/**\n * Retry utility for handling retryable errors\n */\nexport interface RetryOptions {\n maxRetries: number;\n baseDelay: number;\n maxDelay: number;\n factor: number;\n onRetry?: (error: BmltQueryError, attempt: number) => void;\n}\n\nexport class RetryHandler {\n static async withRetry<T>(operation: () => Promise<T>, options: RetryOptions): Promise<T> {\n const { maxRetries, baseDelay, maxDelay, factor, onRetry } = options;\n\n let lastError: BmltQueryError;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n return await operation();\n } catch (error) {\n const bmltError =\n error instanceof BmltQueryError\n ? error\n : ErrorHandler.wrapError(error as Error, 'Operation failed');\n\n lastError = bmltError;\n\n // Don't retry if it's the last attempt or error is not retryable\n if (attempt === maxRetries || !bmltError.isRetryable()) {\n throw bmltError;\n }\n\n // Calculate delay for next attempt\n const delay = Math.min(baseDelay * Math.pow(factor, attempt), maxDelay);\n\n // Call retry callback if provided\n if (onRetry) {\n onRetry(bmltError, attempt + 1);\n }\n\n // Wait before retrying\n await new Promise(resolve => setTimeout(resolve, delay));\n }\n }\n\n throw lastError!;\n }\n}\n","/**\n * Nominatim geocoding service with retry logic and rate limiting\n */\n\nimport pRetry from 'p-retry';\nimport PQueue from 'p-queue';\nimport { GeocodeResult, GeocodeOptions, RateLimitOptions, BmltError, Coordinates } from '../types';\nimport { BmltQueryError, BmltErrorType, ErrorHandler } from '../utils/errors';\n\nexport interface NominatimResponse {\n place_id: number;\n licence: string;\n osm_type: string;\n osm_id: number;\n lat: string;\n lon: string;\n display_name: string;\n address?: {\n house_number?: string;\n road?: string;\n neighbourhood?: string;\n suburb?: string;\n city?: string;\n town?: string;\n village?: string;\n county?: string;\n state?: string;\n postcode?: string;\n country?: string;\n country_code?: string;\n };\n importance?: number;\n boundingbox: string[];\n}\n\nexport class GeocodingService {\n private baseURL: string;\n private queue: PQueue;\n private readonly defaultOptions: Required<Omit<GeocodeOptions, 'viewbox'>> & {\n viewbox?: [number, number, number, number];\n };\n\n constructor(options: GeocodeOptions & RateLimitOptions = {}) {\n const {\n retryCount = 3,\n timeout = 10000,\n userAgent = 'bmlt-query-client/1.0.0',\n countryCode = 'us',\n viewbox,\n bounded = false,\n intervalCap = 1,\n interval = 1000, // 1 second between requests\n concurrency = 1,\n carryoverConcurrencyCount = false,\n ...rateLimitOptions\n } = options;\n\n this.defaultOptions = {\n retryCount,\n timeout,\n userAgent,\n countryCode,\n viewbox,\n bounded,\n };\n\n this.baseURL = 'https://nominatim.openstreetmap.org';\n\n this.queue = new PQueue({\n intervalCap,\n interval,\n concurrency,\n carryoverConcurrencyCount,\n ...rateLimitOptions,\n });\n }\n\n /**\n * Make a fetch request with timeout and error handling\n */\n private async fetchWithTimeout<T>(url: string, timeout: number, userAgent: string): Promise<T> {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n try {\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n 'User-Agent': userAgent,\n },\n signal: controller.signal,\n });\n\n if (!response.ok) {\n if (response.status === 429) {\n const error: BmltError = new Error('Rate limit exceeded for geocoding service');\n error.name = 'RateLimitError';\n error.statusCode = 429;\n throw error;\n }\n\n if (response.status >= 400) {\n const error: BmltError = new Error(\n `Geocoding service error: ${response.status} ${response.statusText}`\n );\n error.name = 'GeocodingError';\n error.statusCode = response.status;\n throw error;\n }\n }\n\n const data = await response.json();\n return data as T;\n } catch (error) {\n if (error instanceof Error && error.name === 'AbortError') {\n const timeoutError: BmltError = new Error('Request timeout during geocoding');\n timeoutError.name = 'TimeoutError';\n throw timeoutError;\n }\n\n if (error instanceof TypeError) {\n const networkError: BmltError = new Error('Network error occurred during geocoding');\n networkError.name = 'NetworkError';\n throw networkError;\n }\n\n throw error;\n } finally {\n clearTimeout(timeoutId);\n }\n }\n\n /**\n * Geocode an address using Nominatim\n */\n async geocode(address: string, options: Partial<GeocodeOptions> = {}): Promise<GeocodeResult> {\n const geocodeOptions = { ...this.defaultOptions, ...options };\n\n return this.queue.add(async (): Promise<GeocodeResult> => {\n return pRetry(\n async () => {\n try {\n // Build search parameters with region bias\n const searchParams: Record<string, string | number> = {\n q: address,\n format: 'json',\n addressdetails: 1,\n limit: 1,\n dedupe: 1,\n };\n\n // Add country code bias if specified\n if (geocodeOptions.countryCode) {\n searchParams.countrycodes = geocodeOptions.countryCode;\n }\n\n // Add viewbox if specified\n if (geocodeOptions.viewbox) {\n searchParams.viewbox = geocodeOptions.viewbox.join(',');\n if (geocodeOptions.bounded) {\n searchParams.bounded = 1;\n }\n }\n\n // Build URL with parameters\n const searchUrl = new URL(`${this.baseURL}/search`);\n Object.entries(searchParams).forEach(([key, value]) => {\n searchUrl.searchParams.append(key, String(value));\n });\n\n const response = await this.fetchWithTimeout<NominatimResponse[]>(\n searchUrl.toString(),\n geocodeOptions.timeout,\n geocodeOptions.userAgent\n );\n\n if (!response || response.length === 0) {\n throw new BmltQueryError(\n BmltErrorType.GEOCODING_ERROR,\n `No results found for address: ${address}`\n );\n }\n\n // Always take the first result (most relevant based on search parameters)\n const result = response[0];\n const coordinates: Coordinates = {\n latitude: parseFloat(result.lat),\n longitude: parseFloat(result.lon),\n };\n\n // Validate coordinates\n if (isNaN(coordinates.latitude) || isNaN(coordinates.longitude)) {\n const error: BmltError = new Error(\n 'Invalid coordinates received from geocoding service'\n );\n error.name = 'GeocodingError';\n throw error;\n }\n\n if (\n coordinates.latitude < -90 ||\n coordinates.latitude > 90 ||\n coordinates.longitude < -180 ||\n coordinates.longitude > 180\n ) {\n const error: BmltError = new Error('Coordinates out of valid range');\n error.name = 'GeocodingError';\n throw error;\n }\n\n return {\n coordinates,\n display_name: result.display_name,\n confidence: result.importance,\n address: result.address\n ? {\n house_number: result.address.house_number,\n road: result.address.road,\n neighbourhood: result.address.neighbourhood,\n suburb: result.address.suburb,\n city: result.address.city || result.address.town || result.address.village,\n county: result.address.county,\n state: result.address.state,\n postcode: result.address.postcode,\n country: result.address.country,\n }\n : undefined,\n };\n } catch (error) {\n // Re-throw errors from fetchWithTimeout or validation\n throw error;\n }\n },\n {\n retries: geocodeOptions.retryCount,\n factor: 2,\n minTimeout: 1000,\n maxTimeout: 10000,\n onFailedAttempt: error => {\n console.warn(\n `Geocoding attempt ${error.attemptNumber} failed. ${error.retriesLeft} retries left. Error: ${error.error.message}`\n );\n },\n }\n );\n }) as Promise<GeocodeResult>;\n }\n\n /**\n * Batch geocode multiple addresses\n */\n async batchGeocode(\n addresses: string[],\n options: Partial<GeocodeOptions> = {}\n ): Promise<GeocodeResult[]> {\n const promises = addresses.map(address =>\n this.geocode(address, options).catch(error => {\n console.warn(`Failed to geocode address \"${address}\":`, error.message);\n return null;\n })\n );\n\n const results = await Promise.all(promises);\n return results.filter((result): result is GeocodeResult => result !== null);\n }\n\n /**\n * Reverse geocode coordinates to an address\n */\n async reverseGeocode(\n coordinates: Coordinates,\n options: Partial<GeocodeOptions> = {}\n ): Promise<GeocodeResult> {\n const geocodeOptions = { ...this.defaultOptions, ...options };\n\n return this.queue.add(async (): Promise<GeocodeResult> => {\n return pRetry(\n async () => {\n try {\n // Build URL with parameters\n const reverseUrl = new URL(`${this.baseURL}/reverse`);\n reverseUrl.searchParams.append('lat', String(coordinates.latitude));\n reverseUrl.searchParams.append('lon', String(coordinates.longitude));\n reverseUrl.searchParams.append('format', 'json');\n reverseUrl.searchParams.append('addressdetails', '1');\n\n const response = await this.fetchWithTimeout<NominatimResponse>(\n reverseUrl.toString(),\n geocodeOptions.timeout,\n geocodeOptions.userAgent\n );\n\n if (!response) {\n const error: BmltError = new Error(\n `No results found for coordinates: ${coordinates.latitude}, ${coordinates.longitude}`\n );\n error.name = 'GeocodingError';\n throw error;\n }\n\n const result = response;\n\n return {\n coordinates: {\n latitude: parseFloat(result.lat),\n longitude: parseFloat(result.lon),\n },\n display_name: result.display_name,\n confidence: result.importance,\n address: result.address\n ? {\n house_number: result.address.house_number,\n road: result.address.road,\n neighbourhood: result.address.neighbourhood,\n suburb: result.address.suburb,\n city: result.address.city || result.address.town || result.address.village,\n county: result.address.county,\n state: result.address.state,\n postcode: result.address.postcode,\n country: result.address.country,\n }\n : undefined,\n };\n } catch (error) {\n // Re-throw errors from fetchWithTimeout\n throw error;\n }\n },\n {\n retries: geocodeOptions.retryCount,\n factor: 2,\n minTimeout: 1000,\n maxTimeout: 10000,\n }\n );\n }) as Promise<GeocodeResult>;\n }\n\n /**\n * Get the current queue size\n */\n getQueueSize(): number {\n return this.queue.size;\n }\n\n /**\n * Get the number of pending operations\n */\n getPendingCount(): number {\n return this.queue.pending;\n }\n\n /**\n * Clear the queue\n */\n clearQueue(): void {\n this.queue.clear();\n }\n\n /**\n * Set concurrency limit\n */\n setConcurrency(concurrency: number): void {\n this.queue.concurrency = concurrency;\n }\n\n /**\n * Get the current user agent string\n */\n getUserAgent(): string {\n return this.defaultOptions.userAgent;\n }\n\n /**\n * Set the user agent string for geocoding requests\n */\n setUserAgent(userAgent: string): void {\n if (!userAgent || userAgent.trim().length === 0) {\n throw new Error('User agent must be a non-empty string');\n }\n this.defaultOptions.userAgent = userAgent.trim();\n }\n}\n","/**\n * Base types and enums for BMLT API\n */\n\nexport enum BmltDataFormat {\n JSON = 'json',\n JSONP = 'jsonp',\n TSML = 'tsml',\n CSV = 'csv',\n}\n\nexport enum BmltEndpoint {\n GET_SEARCH_RESULTS = 'GetSearchResults',\n GET_FORMATS = 'GetFormats',\n GET_SERVICE_BODIES = 'GetServiceBodies',\n GET_CHANGES = 'GetChanges',\n GET_FIELD_KEYS = 'GetFieldKeys',\n GET_FIELD_VALUES = 'GetFieldValues',\n GET_NAWS_DUMP = 'GetNAWSDump',\n GET_SERVER_INFO = 'GetServerInfo',\n GET_COVERAGE_AREA = 'GetCoverageArea',\n}\n\nexport enum Weekday {\n SUNDAY = 1,\n MONDAY = 2,\n TUESDAY = 3,\n WEDNESDAY = 4,\n THURSDAY = 5,\n FRIDAY = 6,\n SATURDAY = 7,\n}\n\nexport enum VenueType {\n IN_PERSON = 1,\n VIRTUAL = 2,\n HYBRID = 3,\n}\n\nexport enum SortKey {\n WEEKDAY = 'weekday',\n TIME = 'time',\n TOWN = 'town',\n STATE = 'state',\n WEEKDAY_STATE = 'weekday_state',\n}\n\nexport enum Language {\n ENGLISH = 'en',\n GERMAN = 'de',\n DANISH = 'dk',\n SPANISH = 'es',\n PERSIAN = 'fa',\n FRENCH = 'fr',\n ITALIAN = 'it',\n POLISH = 'pl',\n PORTUGUESE = 'pt',\n SWEDISH = 'sv',\n}\n\nexport interface Coordinates {\n latitude: number;\n longitude: number;\n}\n\nexport interface BmltError extends Error {\n statusCode?: number;\n response?: unknown;\n}\n\nexport interface GeocodeOptions {\n retryCount?: number;\n timeout?: number;\n userAgent?: string;\n /** Country code for region bias (e.g., 'us', 'ca', 'gb') */\n countryCode?: string;\n /** Viewbox for region bias [minLon, minLat, maxLon, maxLat] */\n viewbox?: [number, number, number, number];\n /** Bounded search - restrict results to viewbox */\n bounded?: boolean;\n}\n\nexport interface RateLimitOptions {\n intervalCap?: number;\n interval?: number;\n carryoverConcurrencyCount?: boolean;\n concurrency?: number;\n}\n","/**\n * Utility functions for building BMLT API URLs and handling parameters\n */\n\nimport { BmltDataFormat, BmltEndpoint } from '../types';\n\nexport interface URLBuilderOptions {\n serverURL: string;\n format: BmltDataFormat;\n endpoint: BmltEndpoint;\n parameters?: Record<string, unknown>;\n}\n\n/**\n * Build a BMLT API URL with parameters\n */\nexport function buildBmltURL(options: URLBuilderOptions): string {\n const { serverURL, format, endpoint, parameters = {} } = options;\n\n // Ensure server URL ends with slash\n const baseURL = serverURL.endsWith('/') ? serverURL : `${serverURL}/`;\n\n // Build the base endpoint URL\n const endpointURL = `${baseURL}client_interface/${format}/`;\n\n // Convert parameters to query string\n const queryParams = new URLSearchParams();\n queryParams.set('switcher', endpoint);\n\n // Add other parameters\n Object.entries(parameters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n // Handle array parameters\n value.forEach((item, index) => {\n if (typeof item === 'number' || typeof item === 'string') {\n queryParams.append(`${key}[]`, item.toString());\n }\n });\n } else if (typeof value === 'boolean') {\n queryParams.set(key, value ? '1' : '0');\n } else {\n queryParams.set(key, value.toString());\n }\n }\n });\n\n return `${endpointURL}?${queryParams.toString()}`;\n}\n\n/**\n * Normalize parameter values for BMLT API\n */\nexport function normalizeParameters(params: Record<string, unknown>): Record<string, unknown> {\n const normalized: Record<string, unknown> = {};\n\n Object.entries(params).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n // Handle array parameters with positive/negative values\n if (Array.isArray(value)) {\n normalized[key] = value.map(item => {\n if (typeof item === 'number') {\n return item;\n } else if (typeof item === 'string') {\n const num = parseFloat(item);\n return isNaN(num) ? item : num;\n }\n return item;\n });\n }\n // Handle boolean parameters\n else if (typeof value === 'boolean') {\n normalized[key] = value;\n }\n // Handle numeric strings\n else if (typeof value === 'string') {\n const num = parseFloat(value);\n if (!isNaN(num) && isFinite(num)) {\n normalized[key] = num;\n } else {\n normalized[key] = value;\n }\n }\n // Keep other values as-is\n else {\n normalized[key] = value;\n }\n }\n });\n\n return normalized;\n}\n\n/**\n * Validate endpoint/format combinations\n */\nexport function validateEndpointFormat(endpoint: BmltEndpoint, format: BmltDataFormat): void {\n const validCombinations: Record<BmltEndpoint, BmltDataFormat[]> = {\n [BmltEndpoint.GET_SEARCH_RESULTS]: [\n BmltDataFormat.JSON,\n BmltDataFormat.JSONP,\n BmltDataFormat.TSML,\n ],\n [BmltEndpoint.GET_FORMATS]: [BmltDataFormat.JSON, BmltDataFormat.JSONP],\n [BmltEndpoint.GET_SERVICE_BODIES]: [BmltDataFormat.JSON, BmltDataFormat.JSONP],\n [BmltEndpoint.GET_CHANGES]: [BmltDataFormat.JSON, BmltDataFormat.JSONP],\n [BmltEndpoint.GET_FIELD_KEYS]: [BmltDataFormat.JSON, BmltDataFormat.JSONP],\n [BmltEndpoint.GET_FIELD_VALUES]: [BmltDataFormat.JSON, BmltDataFormat.JSONP],\n [BmltEndpoint.GET_NAWS_DUMP]: [BmltDataFormat.CSV],\n [BmltEndpoint.GET_SERVER_INFO]: [BmltDataFormat.JSON, BmltDataFormat.JSONP],\n [BmltEndpoint.GET_COVERAGE_AREA]: [BmltDataFormat.JSON, BmltDataFormat.JSONP],\n };\n\n const validFormats = validCombinations[endpoint];\n if (!validFormats.includes(format)) {\n throw new Error(\n `Invalid format '${format}' for endpoint '${endpoint}'. Valid formats: ${validFormats.join(', ')}`\n );\n }\n}\n\n/**\n * Clean and validate a server URL\n */\nexport function validateServerURL(url: string): string {\n try {\n const urlObj = new URL(url);\n if (!['http:', 'https:'].includes(urlObj.protocol)) {\n throw new Error('Server URL must use http or https protocol');\n }\n\n // Return the URL without trailing slash for consistency\n return urlObj.href.replace(/\\/$/, '');\n } catch (error) {\n const validationError = new Error(`Invalid server URL: ${url}`);\n validationError.cause = error;\n throw validationError;\n }\n}\n\n/**\n * Extract numeric IDs from various parameter formats\n */\nexport function extractIds(value: unknown): number[] {\n if (typeof value === 'number') {\n return [value];\n }\n\n if (typeof value === 'string') {\n // Handle comma-separated values\n return value\n .split(',')\n .map(id => parseInt(id.trim(), 10))\n .filter(id => !isNaN(id));\n }\n\n if (Array.isArray(value)) {\n return value\n .map(item => (typeof item === 'number' ? item : parseInt(String(item), 10)))\n .filter(id => !isNaN(id));\n }\n\n return [];\n}\n\n/**\n * Format time values for BMLT API\n */\nexport function formatTimeValue(\n hours?: number,\n minutes?: number\n): { hours?: number; minutes?: number } {\n const result: { hours?: number; minutes?: number } = {};\n\n if (typeof hours === 'number') {\n if (hours < 0 || hours > 23) {\n throw new Error('Hours must be between 0 and 23');\n }\n result.hours = hours;\n }\n\n if (typeof minutes === 'number') {\n if (minutes < 0 || minutes > 59) {\n throw new Error('Minutes must be between 0 and 59');\n }\n result.minutes = minutes;\n }\n\n return result;\n}\n\n/**\n * Validate coordinate values\n */\nexport function validateCoordinates(latitude: number, longitude: number): void {\n if (typeof latitude !== 'number' || isNaN(latitude)) {\n throw new Error('Latitude must be a valid number');\n }\n\n if (typeof longitude !== 'number' || isNaN(longitude)) {\n throw new Error('Longitude must be a valid number');\n }\n\n if (latitude < -90 || latitude > 90) {\n throw new Error('Latitude must be between -90 and 90 degrees');\n }\n\n if (longitude < -180 || longitude > 180) {\n throw new Error('Longitude must be between -180 and 180 degrees');\n }\n}\n\n/**\n * Validate radius values\n */\nexport function validateRadius(radius: number): void {\n if (typeof radius !== 'number' || isNaN(radius)) {\n throw new Error('Radius must be a valid number');\n }\n\n if (radius <= 0) {\n throw new Error('Radius must be greater than 0');\n }\n}\n\n/**\n * Convert miles to kilometers\n */\nexport function milesToKilometers(miles: number): number {\n return miles * 1.60934;\n}\n\n/**\n * Convert kilometers to miles\n */\nexport function kilometersToMiles(km: number): number {\n return km / 1.60934;\n}\n","/**\n * Main BMLT client class for querying BMLT servers\n */\n\nimport { GeocodingService } from '../services/geocoding';\nimport {\n BmltDataFormat,\n BmltEndpoint,\n BmltError,\n Meeting,\n Format,\n MeetingsWithFormats,\n ServiceBody,\n Change,\n ServerInfo,\n CoverageArea,\n FieldKey,\n FieldValue,\n SearchResultsParams,\n GeographicSearchParams,\n FormatsParams,\n ServiceBodiesParams,\n ChangesParams,\n FieldValuesParams,\n NAWSDumpParams,\n GeocodeOptions,\n RateLimitOptions,\n Coordinates,\n} from '../types';\nimport {\n buildBmltURL,\n validateEndpointFormat,\n validateServerURL,\n validateCoordinates,\n validateRadius,\n} from '../utils/url-builder';\nimport { ErrorHandler } from '../utils/errors';\n\nexport interface BmltClientOptions {\n /** Server URL */\n serverURL: string;\n\n /** Default data format */\n defaultFormat?: BmltDataFormat;\n\n /** HTTP request timeout in milliseconds */\n timeout?: number;\n\n /** User agent string */\n userAgent?: string;\n\n /** Geocoding options */\n geocodingOptions?: GeocodeOptions & RateLimitOptions;\n\n /** Enable automatic geocoding for address searches */\n enableGeocoding?: boolean;\n}\n\nexport class BmltClient {\n private timeout: number;\n private userAgent: string;\n private readonly geocodingService?: GeocodingService;\n private serverURL: string;\n private defaultFormat: BmltDataFormat;\n\n constructor(options: BmltClientOptions) {\n const {\n serverURL,\n defaultFormat = BmltDataFormat.JSON,\n timeout = 30000,\n userAgent = 'bmlt-query-client/1.0.0',\n geocodingOptions = {},\n enableGeocoding = true,\n } = options;\n\n // Validate and normalize server URL\n this.serverURL = validateServerURL(serverURL);\n this.defaultFormat = defaultFormat;\n this.timeout = timeout;\n this.userAgent = userAgent;\n\n // Initialize geocoding service if enabled\n if (enableGeocoding) {\n this.geocodingService = new GeocodingService(geocodingOptions);\n }\n }\n\n /**\n * Make a request to the BMLT API\n */\n private async makeRequest<T>(\n endpoint: BmltEndpoint,\n parameters: Record<string, unknown> = {},\n format: BmltDataFormat = this.defaultFormat\n ): Promise<T> {\n let response: Response | undefined;\n\n try {\n // Validate endpoint/format combination\n validateEndpointFormat(endpoint, format);\n\n // Build the request URL\n const url = buildBmltURL({\n serverURL: this.serverURL,\n format,\n endpoint,\n parameters,\n });\n\n // Create abort controller for timeout\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.timeout);\n\n try {\n // Make the request\n response = await fetch(url, {\n method: 'GET',\n headers: {\n 'User-Agent': this.userAgent,\n },\n signal: controller.signal,\n });\n } finally {\n clearTimeout(timeoutId);\n }\n\n // Check if response is ok\n if (!response.ok) {\n throw ErrorHandler.handleFetchError(\n new Error(`HTTP ${response.status}: ${response.statusText}`),\n response\n );\n }\n\n // Get response text\n const responseText = await response.text();\n\n // Handle CSV responses\n if (format === BmltDataFormat.CSV) {\n return responseText as T;\n }\n\n // Handle JSONP responses\n if (format === BmltDataFormat.JSONP) {\n // Extract JSON from JSONP callback\n const callbackName = (parameters.callback as string) || 'callback';\n const jsonMatch = responseText.match(new RegExp(`${callbackName}\\\\((.+)\\\\);?$`));\n\n if (!jsonMatch) {\n throw new Error('Invalid JSONP response format');\n }\n\n return JSON.parse(jsonMatch[1]) as T;\n }\n\n // Handle JSON and TSML responses\n if (format === BmltDataFormat.JSON || format === BmltDataFormat.TSML) {\n return JSON.parse(responseText) as T;\n }\n\n // Fallback - return as text\n return responseText as T;\n } catch (error) {\n throw ErrorHandler.handleFetchError(error, response);\n }\n }\n\n /**\n * Search for meetings\n */\n async searchMeetings(params: SearchResultsParams = {}): Promise<Meeting[]> {\n const { format = this.defaultFormat, ...searchParams } = params;\n return this.makeRequest<Meeting[]>(BmltEndpoint.GET_SEARCH_RESULTS, searchParams, format);\n }\n\n /**\n * Search for meetings and return both meetings and the formats they reference in a\n * single request. Uses get_used_formats=true so the server wraps the response as\n * { meetings: Meeting[], formats: Format[] } instead of a bare Meeting[].\n *\n * This replaces the common pattern of Promise.all([getFormats(), searchMeetings()])\n * with a single round-trip, which matters for large servers where getFormats() can\n * return hundreds of unused format records.\n */\n async searchMeetingsWithFormats(\n params: Omit<SearchResultsParams, 'get_used_formats' | 'get_formats_only'> = {}\n ): Promise<MeetingsWithFormats> {\n const { format = this.defaultFormat, ...searchParams } = params;\n return this.makeRequest<MeetingsWithFormats>(\n BmltEndpoint.GET_SEARCH_RESULTS,\n { ...searchParams, get_used_formats: true },\n format\n );\n }\n\n /**\n * Search for meetings by geographic location using geocoding\n */\n async searchMeetingsByAddress(params: GeographicSearchParams): Promise<Meeting[]> {\n if (!this.geocodingService) {\n throw new Error('Geocoding is not enabled. Initialize client with enableGeocoding: true');\n }\n\n const { address, radiusMiles, radiusKm, sortByDistance = true, searchParams = {} } = params;\n\n // Geocode the address\n const geocodeResult = await this.geocodingService.geocode(address);\n\n // Build search parameters with coordinates\n const geoSearchParams: SearchResultsParams = {\n ...searchParams,\n lat_val: geocodeResult.coordinates.latitude,\n long_val: geocodeResult.coordinates.longitude,\n sort_results_by_distance: sortByDistance,\n };\n\n // Add radius parameter\n if (radiusMiles !== undefined) {\n validateRadius(radiusMiles);\n geoSearchParams.geo_width = radiusMiles;\n } else if (radiusKm !== undefined) {\n validateRadius(radiusKm);\n geoSearchParams.geo_width_km = radiusKm;\n }\n\n return this.searchMeetings(geoSearchParams);\n }\n\n /**\n * Search for meetings by coordinates\n */\n async searchMeetingsByCoordinates(\n coordinates: Coordinates,\n radiusMiles?: number,\n radiusKm?: number,\n searchParams: Omit<\n SearchResultsParams,\n 'lat_val' | 'long_val' | 'geo_width' | 'geo_width_km'\n > = {}\n ): Promise<Meeting[]> {\n validateCoordinates(coordinates.latitude, coordinates.longitude);\n\n const geoSearchParams: SearchResultsParams = {\n ...searchParams,\n lat_val: coordinates.latitude,\n long_val: coordinates.longitude,\n sort_results_by_distance: true,\n };\n\n if (radiusMiles !== undefined) {\n validateRadius(radiusMiles);\n geoSearchParams.geo_width = radiusMiles;\n } else if (radiusKm !== undefined) {\n validateRadius(radiusKm);\n geoSearchParams.geo_width_km = radiusKm;\n }\n\n return this.searchMeetings(geoSearchParams);\n }\n\n /**\n * Get available meeting formats\n */\n async getFormats(params: FormatsParams = {}): Promise<Format[]> {\n const { format = this.defaultFormat, ...formatParams } = params;\n return this.makeRequest<Format[]>(BmltEndpoint.GET_FORMATS, formatParams, format);\n }\n\n /**\n * Get service bodies\n */\n async getServiceBodies(params: ServiceBodiesParams = {}): Promise<ServiceBody[]> {\n const { format = this.defaultFormat, ...serviceParams } = params;\n return this.makeRequest<ServiceBody[]>(BmltEndpoint.GET_SERVICE_BODIES, serviceParams, format);\n }\n\n /**\n * Get meeting changes within a date range\n */\n async getChanges(params: ChangesParams = {}): Promise<Change[]> {\n const { format = this.defaultFormat, ...changeParams } = params;\n return this.makeRequest<Change[]>(BmltEndpoint.GET_CHANGES, changeParams, format);\n }\n\n /**\n * Get available field keys\n */\n async getFieldKeys(): Promise<FieldKey[]> {\n return this.makeRequest<FieldKey[]>(BmltEndpoint.GET_FIELD_KEYS);\n }\n\n /**\n * Get field values for a specific field key\n */\n async getFieldValues(params: FieldValuesParams): Promise<FieldValue[]> {\n const { format = this.defaultFormat, ...fieldParams } = params;\n return this.makeRequest<FieldValue[]>(BmltEndpoint.GET_FIELD_VALUES, fieldParams, format);\n }\n\n /**\n * Get NAWS dump for a service body (CSV format only)\n */\n async getNAWSDump(params: NAWSDumpParams): Promise<string> {\n return this.makeRequest<string>(BmltEndpoint.GET_NAWS_DUMP, params, BmltDataFormat.CSV);\n }\n\n /**\n * Get server information\n */\n async getServerInfo(): Promise<ServerInfo> {\n return this.makeRequest<ServerInfo>(BmltEndpoint.GET_SERVER_INFO);\n }\n\n /**\n * Get server coverage area\n */\n async getCoverageArea(): Promise<CoverageArea> {\n return this.makeRequest<CoverageArea>(BmltEndpoint.GET_COVERAGE_AREA);\n }\n\n /**\n * Geocode an address using the built-in geocoding service\n */\n async geocodeAddress(address: string, options?: Partial<GeocodeOptions>) {\n if (!this.geocodingService) {\n throw new Error('Geocoding is not enabled. Initialize client with enableGeocoding: true');\n }\n\n return this.geocodingService.geocode(address, options);\n }\n\n /**\n * Reverse geocode coordinates to an address\n */\n async reverseGeocode(coordinates: Coordinates, options?: Partial<GeocodeOptions>) {\n if (!this.geocodingService) {\n throw new Error('Geocoding is not enabled. Initialize client with enableGeocoding: true');\n }\n\n return this.geocodingService.reverseGeocode(coordinates, options);\n }\n\n /**\n * Get the server URL\n */\n getServerURL(): string {\n return this.serverURL;\n }\n\n /**\n * Update the server URL\n */\n setServerURL(url: string): void {\n this.serverURL = validateServerURL(url);\n }\n\n /**\n * Get the default data format\n */\n getDefaultFormat(): BmltDataFormat {\n return this.defaultFormat;\n }\n\n /**\n * Set the default data format\n */\n setDefaultFormat(format: BmltDataFormat): void {\n this.defaultFormat = format;\n }\n\n /**\n * Get geocoding service statistics\n */\n getGeocodingStats() {\n if (!this.geocodingService) {\n return null;\n }\n\n return {\n queueSize: this.geocodingService.getQueueSize(),\n pendingCount: this.geocodingService.getPendingCount(),\n };\n }\n\n /**\n * Clear the geocoding queue\n */\n clearGeocodingQueue(): void {\n if (this.geocodingService) {\n this.geocodingService.clearQueue();\n }\n }\n\n /**\n * Get the current user agent string\n */\n getUserAgent(): string {\n return this.userAgent;\n }\n\n /**\n * Set the user agent string for HTTP requests\n */\n setUserAgent(userAgent: string): void {\n if (!userAgent || userAgent.trim().length === 0) {\n throw new Error('User agent must be a non-empty string');\n }\n this.userAgent = userAgent.trim();\n\n // Also update the geocoding service user agent if it exists\n if (this.geocodingService) {\n this.geocodingService.setUserAgent(this.userAgent);\n }\n }\n\n /**\n * Get the current timeout setting\n */\n getTimeout(): number {\n return this.timeout;\n }\n\n /**\n * Set the timeout for HTTP requests\n */\n setTimeout(timeout: number): void {\n if (!Number.isInteger(timeout) || timeout <= 0) {\n throw new Error('Timeout must be a positive integer');\n }\n this.timeout = timeout;\n }\n}\n","/**\n * Fluent query builder for BMLT meeting searches\n */\n\nimport {\n SearchResultsParams,\n Meeting,\n MeetingsWithFormats,\n Weekday,\n VenueType,\n SortKey,\n Language,\n BmltDataFormat,\n Coordinates,\n} from '../types';\nimport { BmltClient } from './bmlt-client';\n\nexport class MeetingQueryBuilder {\n private params: SearchResultsParams = {};\n private client: BmltClient;\n\n constructor(client: BmltClient) {\n this.client = client;\n }\n\n /**\n * Include or exclude specific meeting IDs\n */\n meetingIds(ids: number | number[], exclude = false): this {\n if (Array.isArray(ids)) {\n this.params.meeting_ids = exclude ? ids.map(id => -id) : ids;\n } else {\n this.params.meeting_ids = exclude ? -ids : ids;\n }\n return this;\n }\n\n /**\n * Include meetings on specific weekdays\n */\n onWeekdays(...days: Weekday[]): this {\n this.params.weekdays = days.length === 1 ? days[0] : days;\n return this;\n }\n\n /**\n * Exclude meetings on specific weekdays\n */\n notOnWeekdays(...days: Weekday[]): this {\n const excludeDays = days.map(day => -day);\n this.params.weekdays = excludeDays.length === 1 ? excludeDays[0] : excludeDays;\n return this;\n }\n\n /**\n * Filter by venue types\n */\n venueTypes(...types: VenueType[]): this {\n this.params.venue_types = types.length === 1 ? types[0] : types;\n return this;\n }\n\n /**\n * Include only in-person meetings\n */\n inPersonOnly(): this {\n return this.venueTypes(VenueType.IN_PERSON);\n }\n\n /**\n * Include only virtual meetings\n */\n virtualOnly(): this {\n return this.venueTypes(VenueType.VIRTUAL);\n }\n\n /**\n * Include only hybrid meetings\n */\n hybridOnly(): this {\n return this.venueTypes(VenueType.HYBRID);\n }\n\n /**\n * Include virtual and hybrid meetings\n */\n virtualOrHybrid(): this {\n return this.venueTypes(VenueType.VIRTUAL, VenueType.HYBRID);\n }\n\n /**\n * Filter by meeting formats\n */\n formats(formatIds: number | number[], exclude = false): this {\n if (Array.isArray(formatIds)) {\n this.params.formats = exclude ? formatIds.map(id => -id) : formatIds;\n } else {\n this.params.formats = exclude ? -formatIds : formatIds;\n }\n return this;\n }\n\n /**\n * Use OR logic for format matching instead of AND\n */\n anyFormat(): this {\n this.params.formats_comparison_operator = 'OR';\n return this;\n }\n\n /**\n * Filter by service bodies\n */\n serviceBodies(serviceBodyIds: number | number[], exclude = false): this {\n if (Array.isArray(serviceBodyIds)) {\n this.params.services = exclude ? serviceBodyIds.map(id => -id) : serviceBodyIds;\n } else {\n this.params.services = exclude ? -serviceBodyIds : serviceBodyIds;\n }\n return this;\n }\n\n /**\n * Include child service bodies\n */\n includeChildServiceBodies(): this {\n this.params.recursive = true;\n return this;\n }\n\n /**\n * Search for specific text\n */\n searchText(text: string): this {\n this.params.SearchString = text;\n return this;\n }\n\n /**\n * Meetings starting after specific time\n */\n startingAfter(hours: number, minutes = 0): this {\n this.params.StartsAfterH = hours;\n this.params.StartsAfterM = minutes;\n return this;\n }\n\n /**\n * Meetings starting before specific time\n */\n startingBefore(hours: number, minutes = 0): this {\n this.params.StartsBeforeH = hours;\n this.params.StartsBeforeM = minutes;\n return this;\n }\n\n /**\n * Meetings ending before specific time\n */\n endingBefore(hours: number, minutes = 0): this {\n this.params.EndsBeforeH = hours;\n this.params.EndsBeforeM = minutes;\n return this;\n }\n\n /**\n * Minimum meeting duration\n */\n minimumDuration(hours = 0, minutes = 0): this {\n if (hours > 0) this.params.MinDurationH = hours;\n if (minutes > 0) this.params.MinDurationM = minutes;\n return this;\n }\n\n /**\n * Maximum meeting duration\n */\n maximumDuration(hours = 0, minutes = 0): this {\n if (hours > 0) this.params.MaxDurationH = hours;\n if (minutes > 0) this.params.MaxDurationM = minutes;\n return this;\n }\n\n /**\n * Search within geographic area by coordinates\n */\n nearCoordinates(coordinates: Coordinates, radiusMiles?: number, radiusKm?: number): this {\n this.params.lat_val = coordinates.latitude;\n this.params.long_val = coordinates.longitude;\n\n if (radiusMiles !== undefined) {\n this.params.geo_width = radiusMiles;\n } else if (radiusKm !== undefined) {\n this.params.geo_width_km = radiusKm;\n }\n\n return this;\n }\n\n /**\n * Search for specific field value\n */\n fieldValue(fieldKey: string, value: string): this {\n this.params.meeting_key = fieldKey;\n this.params.meeting_key_value = value;\n return this;\n }\n\n /**\n * Return only specific fields\n */\n selectFields(...fields: string[]): this {\n this.params.data_field_key = fields.join(',');\n return this;\n }\n\n /**\n * Sort results by specific fields\n */\n sortBy(...fields: string[]): this {\n this.params.sort_keys = fields.join(',');\n return this;\n }\n\n /**\n * Sort by predefined aliases\n */\n sortByAlias(alias: SortKey): this {\n this.params.sort_key = alias;\n return this;\n }\n\n /**\n * Sort by distance (requires geographic search)\n */\n sortByDistance(): this {\n this.params.sort_results_by_distance = true;\n return this;\n }\n\n /**\n * Set pagination\n */\n paginate(pageSize: number, pageNumber = 1): this {\n this.params.page_size = pageSize;\n this.params.page_num = pageNumber;\n return this;\n }\n\n /**\n * Include unpublished meetings\n */\n includeUnpublished(): this {\n this.params.advanced_published = 0;\n return this;\n }\n\n /**\n * Include only unpublished meetings\n */\n unpublishedOnly(): this {\n this.params.advanced_published = -1;\n return this;\n }\n\n /**\n * Set language for format names\n */\n language(lang: Language): this {\n this.params.lang_enum = lang;\n return this;\n }\n\n /**\n * Set response format\n */\n format(format: BmltDataFormat): this {\n this.params.format = format;\n return this;\n }\n\n /**\n * Include formats used in search results\n */\n includeFormats(): this {\n this.params.get_used_formats = true;\n return this;\n }\n\n /**\n * Return only formats (requires includeFormats)\n */\n formatsOnly(): this {\n this.params.get_used_formats = true;\n this.params.get_formats_only = true;\n return this;\n }\n\n /**\n * Filter by server IDs (aggregator mode)\n */\n serverIds(serverIds: number | number[], exclude = false): this {\n if (Array.isArray(serverIds)) {\n this.params.server_ids = exclude ? serverIds.map(id => -id) : serverIds;\n } else {\n this.params.server_ids = exclude ? -serverIds : serverIds;\n }\n return this;\n }\n\n /**\n * Get the current query parameters\n */\n getParams(): SearchResultsParams {\n return { ...this.params };\n }\n\n /**\n * Reset the query builder\n */\n reset(): this {\n this.params = {};\n return this;\n }\n\n /**\n * Clone the current query builder\n */\n clone(): MeetingQueryBuilder {\n const cloned = new MeetingQueryBuilder(this.client);\n cloned.params = { ...this.params };\n return cloned;\n }\n\n /**\n * Execute the search and return results\n */\n async execute(): Promise<Meeting[]> {\n return this.client.searchMeetings(this.params);\n }\n\n /**\n * Execute the search and return both meetings and the formats they reference\n * in a single request. Equivalent to execute() but avoids a separate getFormats() call.\n */\n async executeWithFormats(): Promise<MeetingsWithFormats> {\n const { get_used_formats, get_formats_only, ...params } = this.params;\n return this.client.searchMeetingsWithFormats(params);\n }\n\n /**\n * Execute the search by geocoding an address first\n */\n async executeNearAddress(\n address: string,\n radiusMiles?: number,\n radiusKm?: number,\n sortByDistance = true\n ): Promise<Meeting[]> {\n return this.client.searchMeetingsByAddress({\n address,\n radiusMiles,\n radiusKm,\n sortByDistance,\n searchParams: this.params,\n });\n }\n}\n\n/**\n * Convenience methods for common search patterns\n */\nexport class QuickSearch {\n private client: BmltClient;\n\n constructor(client: BmltClient) {\n this.client = client;\n }\n\n /**\n * Search for today's meetings\n */\n today(): MeetingQueryBuilder {\n const today = new Date().getDay();\n const weekday = today === 0 ? Weekday.SUNDAY : (today as Weekday);\n return new MeetingQueryBuilder(this.client).onWeekdays(weekday);\n }\n\n /**\n * Search for weekend meetings\n */\n weekend(): MeetingQueryBuilder {\n return new MeetingQueryBuilder(this.client).onWeekdays(Weekday.SATURDAY, Weekday.SUNDAY);\n }\n\n /**\n * Search for weekday meetings\n */\n weekdays(): MeetingQueryBuilder {\n return new MeetingQueryBuilder(this.client).onWeekdays(\n Weekday.MONDAY,\n Weekday.TUESDAY,\n Weekday.WEDNESDAY,\n Weekday.THURSDAY,\n Weekday.FRIDAY\n );\n }\n\n /**\n * Search for evening meetings (after 5 PM)\n */\n evening(): MeetingQueryBuilder {\n return new MeetingQueryBuilder(this.client).startingAfter(17);\n }\n\n /**\n * Search for morning meetings (before 12 PM)\n */\n morning(): MeetingQueryBuilder {\n return new MeetingQueryBuilder(this.client).startingBefore(12);\n }\n\n /**\n * Search for virtual meetings only\n */\n virtual(): MeetingQueryBuilder {\n return new MeetingQueryBuilder(this.client).virtualOnly();\n }\n\n /**\n * Search for in-person meetings only\n */\n inPerson(): MeetingQueryBuilder {\n return new MeetingQueryBuilder(this.client).inPersonOnly();\n }\n\n /**\n * Search by meeting name or location\n */\n byText(searchText: string): MeetingQueryBuilder {\n return new MeetingQueryBuilder(this.client).searchText(searchText);\n }\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7],"mappings":";;;;;;;;;;aAAM,IAAiB,OAAO,UAAU,UAElC,KAAU,MAAS,EAAe,KAAK,EAAM,KAAK,kBAElD,IAAgB,IAAI,IAAI;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC;AAEF,SAAwB,EAAe,GAAO;AAM7C,KAAI,EALY,KACZ,EAAQ,EAAM,IACd,EAAM,SAAS,eACf,OAAO,EAAM,WAAY,UAG5B,QAAO;CAGR,IAAM,EAAC,YAAS,aAAS;AAoBzB,QAjBI,MAAY,gBACR,MAAU,KAAA,KAEb,yBAAyB,IAI1B,EAAQ,WAAW,gCAAgC,IAKnD,MAAY,qBAAsB,EAAQ,WAAW,oBAAoB,IAAI,EAAQ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KAAK;AAC/D,SAAO,KAAK,OAAO,0BAA0B,EAAO;;CAMtD,MAAM,mBACJ,GACA,GACA,GACA,IAAiB,IACG;AACpB,SAAO,KAAK,OAAO,wBAAwB;GACzC;GACA;GACA;GACA;GACA,cAAc,KAAK;GACpB,CAAC;;GAOO,KAAb,MAAyB;CAGvB,YAAY,GAAoB;AAC9B,UAHF,UAAA,KAAA,EAAQ,EAGN,KAAK,SAAS;;CAMhB,QAA6B;EAC3B,IAAM,qBAAQ,IAAI,MAAM,EAAC,QAAQ,EAC3B,IAAU,MAAU,IAAI,EAAQ,SAAU;AAChD,SAAO,IAAI,EAAoB,KAAK,OAAO,CAAC,WAAW,EAAQ;;CAMjE,UAA+B;AAC7B,SAAO,IAAI,EAAoB,KAAK,OAAO,CAAC,WAAW,EAAQ,UAAU,EAAQ,OAAO;;CAM1F,WAAgC;AAC9B,SAAO,IAAI,EAAoB,KAAK,OAAO,CAAC,WAC1C,EAAQ,QACR,EAAQ,SACR,EAAQ,WACR,EAAQ,UACR,EAAQ,OACT;;CAMH,UAA+B;AAC7B,SAAO,IAAI,EAAoB,KAAK,OAAO,CAAC,cAAc,GAAG;;CAM/D,UAA+B;AAC7B,SAAO,IAAI,EAAoB,KAAK,OAAO,CAAC,eAAe,GAAG;;CAMhE,UAA+B;AAC7B,SAAO,IAAI,EAAoB,KAAK,OAAO,CAAC,aAAa;;CAM3D,WAAgC;AAC9B,SAAO,IAAI,EAAoB,KAAK,OAAO,CAAC,cAAc;;CAM5D,OAAO,GAAyC;AAC9C,SAAO,IAAI,EAAoB,KAAK,OAAO,CAAC,WAAW,EAAW"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bmlt-query-client",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "A TypeScript client for querying BMLT (Basic Meeting List Tool) servers with built-in geocoding support",
5
5
  "type": "module",
6
6
  "main": "dist/app.js",