bmlt-query-client 1.0.8 → 1.0.9
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 +68 -4
- package/dist/app.js +244 -177
- 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;
|
|
@@ -640,6 +695,13 @@ export declare class MeetingQueryBuilder {
|
|
|
640
695
|
* Search for specific text
|
|
641
696
|
*/
|
|
642
697
|
searchText(text: string): this;
|
|
698
|
+
/**
|
|
699
|
+
* Search by address using server-side geocoding (StringSearchIsAnAddress=1).
|
|
700
|
+
* Note: typically broken on most BMLT servers because their Google API key uses
|
|
701
|
+
* HTTP referer restrictions rather than server IP allowlisting. Prefer
|
|
702
|
+
* BmltClient.searchMeetingsByAddress() which uses Nominatim client-side.
|
|
703
|
+
*/
|
|
704
|
+
searchAddress(address: string, radius?: number): this;
|
|
643
705
|
/**
|
|
644
706
|
* Meetings starting after specific time
|
|
645
707
|
*/
|
|
@@ -713,9 +775,9 @@ export declare class MeetingQueryBuilder {
|
|
|
713
775
|
*/
|
|
714
776
|
formatsOnly(): this;
|
|
715
777
|
/**
|
|
716
|
-
* Filter by server IDs (aggregator mode)
|
|
778
|
+
* Filter by root server IDs (aggregator mode)
|
|
717
779
|
*/
|
|
718
|
-
|
|
780
|
+
rootServerIds(serverIds: number | number[], exclude?: boolean): this;
|
|
719
781
|
/**
|
|
720
782
|
* Get the current query parameters
|
|
721
783
|
*/
|
|
@@ -881,6 +943,8 @@ export declare interface SearchResultsParams extends BaseSearchParams {
|
|
|
881
943
|
SearchString?: string;
|
|
882
944
|
/** Search radius for geographic searches */
|
|
883
945
|
SearchStringRadius?: number;
|
|
946
|
+
/** 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. */
|
|
947
|
+
StringSearchIsAnAddress?: boolean;
|
|
884
948
|
/** Meetings starting after hour (0-23) */
|
|
885
949
|
StartsAfterH?: number;
|
|
886
950
|
/** Meetings starting after minute (0-59) */
|
|
@@ -927,8 +991,8 @@ export declare interface SearchResultsParams extends BaseSearchParams {
|
|
|
927
991
|
page_num?: number;
|
|
928
992
|
/** Published status: undefined=published only, 0=all, -1=unpublished only */
|
|
929
993
|
advanced_published?: 0 | -1;
|
|
930
|
-
/** Include specific server IDs (for aggregator mode) */
|
|
931
|
-
|
|
994
|
+
/** Include specific root server IDs (for aggregator mode) */
|
|
995
|
+
root_server_ids?: number | number[];
|
|
932
996
|
}
|
|
933
997
|
|
|
934
998
|
export declare interface ServerInfo {
|