bmlt-query-client 1.0.4 → 1.0.6

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/AGENTS.md ADDED
@@ -0,0 +1,124 @@
1
+ # AGENTS.md
2
+
3
+ This file provides guidance for AI agents working in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ `bmlt-query-client` is a TypeScript/ES module client library for querying [BMLT (Basic Meeting List Tool)](https://bmlt.app) servers. It wraps the BMLT Semantic API with a zero-external-dependency bundle, a fluent query builder, and built-in geocoding via OpenStreetMap Nominatim.
8
+
9
+ Published to NPM as `bmlt-query-client`. Minimum Node.js version: 22.
10
+
11
+ ## Repository Layout
12
+
13
+ ```
14
+ src/
15
+ client/
16
+ bmlt-client.ts # Main BmltClient class — primary public API
17
+ query-builder.ts # MeetingQueryBuilder (fluent) and QuickSearch helpers
18
+ services/
19
+ geocoding.ts # Nominatim geocoding with rate limiting and retry
20
+ types/
21
+ base.ts # Enums: BmltDataFormat, BmltEndpoint, Weekday, VenueType, etc.
22
+ requests.ts # Request parameter interfaces for each BMLT endpoint
23
+ responses.ts # Response types: Meeting, Format, ServiceBody, etc.
24
+ index.ts # Re-exports all types
25
+ utils/
26
+ errors.ts # BmltQueryError, BmltErrorType enum, ErrorHandler
27
+ url-builder.ts # URL construction and parameter validation
28
+ index.ts # Public package exports
29
+
30
+ test/
31
+ basic.test.ts # Integration tests against the NYC BMLT demo server
32
+ setup.ts # Vitest setup
33
+
34
+ examples/
35
+ basic-usage.ts # Runnable usage examples
36
+
37
+ docs/
38
+ index.html # Browser demo using the ES module directly
39
+ ```
40
+
41
+ ## Common Commands
42
+
43
+ ```bash
44
+ npm install # Install dependencies
45
+ npm run build # Compile TypeScript → dist/ (Vite + vite-plugin-dts)
46
+ npm run type-check # Type-check without emitting
47
+ npm run lint # ESLint on src/
48
+ npm run format # Prettier auto-format
49
+ npm run format:check # Check formatting without modifying files
50
+ npm test # Run Vitest integration tests (requires network)
51
+ npm run clean # Delete dist/
52
+ ```
53
+
54
+ ## Build Output
55
+
56
+ Vite produces a single ES module bundle:
57
+
58
+ - `dist/app.js` — bundle with p-queue and p-retry inlined (~55 KB, ~15 KB gzipped)
59
+ - `dist/app.d.ts` — TypeScript declarations (generated by vite-plugin-dts)
60
+ - `dist/app.js.map` — source map
61
+
62
+ The package is ESM-only (`"type": "module"` in package.json). Do not add CommonJS output.
63
+
64
+ ## Testing
65
+
66
+ Tests in `test/basic.test.ts` are **integration tests** that call the live NYC BMLT demo server (`https://latest.aws.bmlt.app/main_server`). There are no unit tests with mocks.
67
+
68
+ - Run `npm test` to execute all tests.
69
+ - Tests verify real API response shapes and client behaviour including error scenarios.
70
+ - Do not add mock-based tests; keep tests hitting the real demo server.
71
+ - If a test requires network access and CI is offline, mark it with `test.skip`.
72
+
73
+ ## Code Style
74
+
75
+ Enforced by Prettier and ESLint — run `npm run format` and `npm run lint` before committing.
76
+
77
+ Key rules:
78
+
79
+ - 2-space indentation, single quotes, semicolons required, trailing commas (ES5), 100-char line width.
80
+ - `const` over `let`; `var` is banned.
81
+ - TypeScript strict mode is on; avoid `any`.
82
+ - Arrow functions: no parentheses for single parameters (`x => x`, not `(x) => x`).
83
+
84
+ ## Architecture Constraints
85
+
86
+ - **Zero runtime dependencies in the bundle.** `p-queue` and `p-retry` are bundled via Vite. Do not add new production dependencies without bundling them. Verify with `npm run build` and inspect `dist/app.js`.
87
+ - **No CommonJS.** All source files use ES module syntax (`import`/`export`). `tsconfig.json` targets `ESNext` modules.
88
+ - **Native fetch only.** HTTP requests use the global `fetch` API (Node 22 built-in). Do not introduce axios, node-fetch, or similar.
89
+ - **Enums over magic strings.** Use `Weekday`, `VenueType`, `BmltEndpoint`, etc. when representing BMLT-specific values.
90
+ - **Custom error types.** Throw `BmltQueryError` (from `src/utils/errors.ts`), never plain `Error`, for library errors. Use `BmltErrorType` to classify the error.
91
+
92
+ ## Adding or Changing API Surface
93
+
94
+ 1. Add or update the relevant type in `src/types/requests.ts` or `src/types/responses.ts`.
95
+ 2. Implement or update the method in `src/client/bmlt-client.ts`.
96
+ 3. If the feature is chainable, expose it via `MeetingQueryBuilder` in `src/client/query-builder.ts`.
97
+ 4. Export any new public types from `src/types/index.ts` and any new public classes/functions from `src/index.ts`.
98
+ 5. Add a usage example in `examples/basic-usage.ts`.
99
+ 6. Add or extend a test in `test/basic.test.ts`.
100
+
101
+ ## Geocoding
102
+
103
+ The geocoding service (`src/services/geocoding.ts`) calls OpenStreetMap Nominatim. Key constraints:
104
+
105
+ - Rate limit: 1 request per second by default (configurable via `GeocodeOptions`).
106
+ - Uses `p-queue` for queuing and `p-retry` for exponential backoff.
107
+ - Respects Nominatim's usage policy — do not remove the rate limiter.
108
+ - Default country bias: `'us'`. Callers can override via `GeocodeOptions`.
109
+
110
+ ## CI/CD
111
+
112
+ GitHub Actions (`.github/workflows/ci-cd.yml`):
113
+
114
+ - **test job**: runs on push and PRs; matrix over Node 22 and 24; runs lint → build → test.
115
+ - **publish job**: triggered on version tags (`v*`); publishes to NPM using `NPM_TOKEN` secret and creates a GitHub Release.
116
+ - **security job**: runs `npm audit --audit-level moderate` on every push/PR.
117
+
118
+ Publishing is tag-driven. To release, create and push a semver tag (e.g., `v1.1.0`).
119
+
120
+ ## Key Invariants
121
+
122
+ - `dist/` is generated and must not be committed.
123
+ - `package.json` version is updated automatically by the publish CI job from the git tag.
124
+ - The BMLT demo server URL (`https://latest.aws.bmlt.app/main_server`) is used only in tests and examples — it must not be hardcoded in library source.
package/dist/app.d.ts CHANGED
@@ -10,7 +10,7 @@ export declare interface BaseSearchParams {
10
10
  export declare class BmltClient {
11
11
  private timeout;
12
12
  private userAgent;
13
- private geocodingService?;
13
+ private readonly geocodingService?;
14
14
  private rootServerURL;
15
15
  private defaultFormat;
16
16
  constructor(options: BmltClientOptions);
@@ -364,7 +364,7 @@ export declare interface FieldValuesParams extends BaseSearchParams {
364
364
 
365
365
  export declare interface Format {
366
366
  /** Format ID */
367
- shared_id_bigint: string;
367
+ id: string;
368
368
  /** Format key string */
369
369
  key_string: string;
370
370
  /** Format name */
@@ -373,6 +373,10 @@ export declare interface Format {
373
373
  description_string: string;
374
374
  /** Language */
375
375
  lang: string;
376
+ /** World format ID */
377
+ world_id?: string;
378
+ /** Format type enum */
379
+ format_type_enum?: string;
376
380
  /** Root server URI (for aggregator mode) */
377
381
  root_server_uri?: string;
378
382
  }