bmlt-query-client 1.0.8 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +10 -0
- package/README.md +44 -0
- package/dist/app.d.ts +72 -6
- package/dist/app.js +245 -178
- package/dist/app.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -183,6 +183,50 @@ const todaysVirtualMeetings = await quickSearch
|
|
|
183
183
|
.execute();
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
+
### Finding Duplicate Meetings
|
|
187
|
+
|
|
188
|
+
When querying meetings from multiple service bodies or servers, use `findDuplicateMeetings` to identify the same meeting appearing in more than one list:
|
|
189
|
+
|
|
190
|
+
```javascript
|
|
191
|
+
import { findDuplicateMeetings } from 'bmlt-query-client';
|
|
192
|
+
|
|
193
|
+
const [listA, listB] = await Promise.all([
|
|
194
|
+
client.searchMeetings({ services: [1] }),
|
|
195
|
+
client.searchMeetings({ services: [2] }),
|
|
196
|
+
]);
|
|
197
|
+
|
|
198
|
+
const duplicates = findDuplicateMeetings([listA, listB]);
|
|
199
|
+
|
|
200
|
+
for (const group of duplicates) {
|
|
201
|
+
console.log(`Duplicate: ${group.key}`);
|
|
202
|
+
for (const { meeting, listIndex } of group.entries) {
|
|
203
|
+
console.log(` List ${listIndex}: id=${meeting.id_bigint}`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
By default, meetings are compared on `weekday_tinyint`, `start_time`, `meeting_name`, and `location_text` (case-insensitive). You can customize the fields:
|
|
209
|
+
|
|
210
|
+
```javascript
|
|
211
|
+
// Compare only on name and street address
|
|
212
|
+
const duplicates = findDuplicateMeetings([listA, listB], {
|
|
213
|
+
fields: ['meeting_name', 'location_street'],
|
|
214
|
+
normalize: true, // lowercase + trim (default)
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Counting Unique Groups
|
|
219
|
+
|
|
220
|
+
Use `countUniqueGroups` to get the total number of distinct groups in a meeting list. A group is identified by its service body plus meeting name (case-insensitive, trimmed), so multiple weekly occurrences of the same group count once:
|
|
221
|
+
|
|
222
|
+
```javascript
|
|
223
|
+
import { countUniqueGroups } from 'bmlt-query-client';
|
|
224
|
+
|
|
225
|
+
const meetings = await client.searchMeetings();
|
|
226
|
+
const total = countUniqueGroups(meetings);
|
|
227
|
+
console.log(`Total unique groups: ${total}`);
|
|
228
|
+
```
|
|
229
|
+
|
|
186
230
|
## Error Handling
|
|
187
231
|
|
|
188
232
|
The client provides comprehensive error handling with specific error types:
|
package/dist/app.d.ts
CHANGED
|
@@ -284,6 +284,15 @@ export declare interface Coordinates {
|
|
|
284
284
|
longitude: number;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
/**
|
|
288
|
+
* Count unique groups across a list of meetings.
|
|
289
|
+
*
|
|
290
|
+
* A "group" is identified by the combination of service body and meeting name
|
|
291
|
+
* (case-insensitive, trimmed), so multiple weekly meetings of the same group
|
|
292
|
+
* count once.
|
|
293
|
+
*/
|
|
294
|
+
export declare function countUniqueGroups(meetings: Meeting[]): number;
|
|
295
|
+
|
|
287
296
|
export declare interface CoverageArea {
|
|
288
297
|
/** North boundary */
|
|
289
298
|
north_latitude: number;
|
|
@@ -295,6 +304,21 @@ export declare interface CoverageArea {
|
|
|
295
304
|
west_longitude: number;
|
|
296
305
|
}
|
|
297
306
|
|
|
307
|
+
/** A single meeting paired with the index of the list it came from */
|
|
308
|
+
export declare interface DuplicateMeetingEntry {
|
|
309
|
+
meeting: Meeting;
|
|
310
|
+
/** Index of the source list in the array passed to findDuplicateMeetings */
|
|
311
|
+
listIndex: number;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** A group of meetings from different lists that match on the comparison key */
|
|
315
|
+
export declare interface DuplicateMeetingGroup {
|
|
316
|
+
/** Composite key used for matching */
|
|
317
|
+
key: string;
|
|
318
|
+
/** All matching entries, one per occurrence across the lists */
|
|
319
|
+
entries: DuplicateMeetingEntry[];
|
|
320
|
+
}
|
|
321
|
+
|
|
298
322
|
/**
|
|
299
323
|
* Factory class for creating specific error types
|
|
300
324
|
*/
|
|
@@ -372,6 +396,37 @@ export declare interface FieldValuesParams extends BaseSearchParams {
|
|
|
372
396
|
all_formats?: boolean;
|
|
373
397
|
}
|
|
374
398
|
|
|
399
|
+
/**
|
|
400
|
+
* Find meetings that appear in more than one of the provided lists.
|
|
401
|
+
*
|
|
402
|
+
* Comparison is done via a composite key built from the specified fields
|
|
403
|
+
* (default: weekday, start time, meeting name, location). Only groups that
|
|
404
|
+
* span at least two different lists are returned.
|
|
405
|
+
*
|
|
406
|
+
* @example
|
|
407
|
+
* const duplicates = findDuplicateMeetings([listA, listB]);
|
|
408
|
+
* for (const group of duplicates) {
|
|
409
|
+
* console.log(`Duplicate: ${group.key}`);
|
|
410
|
+
* for (const { meeting, listIndex } of group.entries) {
|
|
411
|
+
* console.log(` List ${listIndex}: id=${meeting.id_bigint}`);
|
|
412
|
+
* }
|
|
413
|
+
* }
|
|
414
|
+
*/
|
|
415
|
+
export declare function findDuplicateMeetings(meetingLists: Meeting[][], options?: FindDuplicatesOptions): DuplicateMeetingGroup[];
|
|
416
|
+
|
|
417
|
+
export declare interface FindDuplicatesOptions {
|
|
418
|
+
/**
|
|
419
|
+
* Meeting fields used to build the composite comparison key.
|
|
420
|
+
* Defaults to weekday, start time, meeting name, and location.
|
|
421
|
+
*/
|
|
422
|
+
fields?: Array<keyof Meeting>;
|
|
423
|
+
/**
|
|
424
|
+
* Normalize string values before comparing (lowercase + trim).
|
|
425
|
+
* Defaults to true.
|
|
426
|
+
*/
|
|
427
|
+
normalize?: boolean;
|
|
428
|
+
}
|
|
429
|
+
|
|
375
430
|
export declare interface Format {
|
|
376
431
|
/** Format ID */
|
|
377
432
|
id: string;
|
|
@@ -507,15 +562,17 @@ export declare interface GeographicSearchParams {
|
|
|
507
562
|
export declare function kilometersToMiles(km: number): number;
|
|
508
563
|
|
|
509
564
|
export declare enum Language {
|
|
510
|
-
|
|
565
|
+
DANISH = "da",
|
|
511
566
|
GERMAN = "de",
|
|
512
|
-
|
|
567
|
+
GREEK = "el",
|
|
568
|
+
ENGLISH = "en",
|
|
513
569
|
SPANISH = "es",
|
|
514
570
|
PERSIAN = "fa",
|
|
515
571
|
FRENCH = "fr",
|
|
516
572
|
ITALIAN = "it",
|
|
517
573
|
POLISH = "pl",
|
|
518
574
|
PORTUGUESE = "pt",
|
|
575
|
+
RUSSIAN = "ru",
|
|
519
576
|
SWEDISH = "sv"
|
|
520
577
|
}
|
|
521
578
|
|
|
@@ -640,6 +697,13 @@ export declare class MeetingQueryBuilder {
|
|
|
640
697
|
* Search for specific text
|
|
641
698
|
*/
|
|
642
699
|
searchText(text: string): this;
|
|
700
|
+
/**
|
|
701
|
+
* Search by address using server-side geocoding (StringSearchIsAnAddress=1).
|
|
702
|
+
* Note: typically broken on most BMLT servers because their Google API key uses
|
|
703
|
+
* HTTP referer restrictions rather than server IP allowlisting. Prefer
|
|
704
|
+
* BmltClient.searchMeetingsByAddress() which uses Nominatim client-side.
|
|
705
|
+
*/
|
|
706
|
+
searchAddress(address: string, radius?: number): this;
|
|
643
707
|
/**
|
|
644
708
|
* Meetings starting after specific time
|
|
645
709
|
*/
|
|
@@ -713,9 +777,9 @@ export declare class MeetingQueryBuilder {
|
|
|
713
777
|
*/
|
|
714
778
|
formatsOnly(): this;
|
|
715
779
|
/**
|
|
716
|
-
* Filter by server IDs (aggregator mode)
|
|
780
|
+
* Filter by root server IDs (aggregator mode)
|
|
717
781
|
*/
|
|
718
|
-
|
|
782
|
+
rootServerIds(serverIds: number | number[], exclude?: boolean): this;
|
|
719
783
|
/**
|
|
720
784
|
* Get the current query parameters
|
|
721
785
|
*/
|
|
@@ -881,6 +945,8 @@ export declare interface SearchResultsParams extends BaseSearchParams {
|
|
|
881
945
|
SearchString?: string;
|
|
882
946
|
/** Search radius for geographic searches */
|
|
883
947
|
SearchStringRadius?: number;
|
|
948
|
+
/** Treat SearchString as an address and have the server geocode it. Note: typically broken on most servers because the Google API key uses HTTP referer restrictions rather than server IP allowlisting. Prefer searchMeetingsByAddress() which uses Nominatim client-side. */
|
|
949
|
+
StringSearchIsAnAddress?: boolean;
|
|
884
950
|
/** Meetings starting after hour (0-23) */
|
|
885
951
|
StartsAfterH?: number;
|
|
886
952
|
/** Meetings starting after minute (0-59) */
|
|
@@ -927,8 +993,8 @@ export declare interface SearchResultsParams extends BaseSearchParams {
|
|
|
927
993
|
page_num?: number;
|
|
928
994
|
/** Published status: undefined=published only, 0=all, -1=unpublished only */
|
|
929
995
|
advanced_published?: 0 | -1;
|
|
930
|
-
/** Include specific server IDs (for aggregator mode) */
|
|
931
|
-
|
|
996
|
+
/** Include specific root server IDs (for aggregator mode) */
|
|
997
|
+
root_server_ids?: number | number[];
|
|
932
998
|
}
|
|
933
999
|
|
|
934
1000
|
export declare interface ServerInfo {
|