@crvouga/mockingbird-service-google-maps 3.2.0 → 3.4.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/CHANGELOG.md CHANGED
@@ -1,14 +1,28 @@
1
1
  # Changelog — @crvouga/mockingbird-service-google-maps
2
2
 
3
- ## 3.2.0 (2026-10-09)
3
+ ## 3.4.0 (2026-10-15)
4
4
 
5
5
  ### Features
6
6
 
7
- - match Emulate provider coverage ([16b65ce](https://github.com/crvouga/mockingbird/commit/16b65ce791fa216f28ec1521df636f57771d9c5e))
7
+ - finish durable run lifecycle ([725ea1a](https://github.com/crvouga/mockingbird/commit/725ea1a966dac65434e98f06a9c33aca0d6f32d7))
8
+ - add management and portable archives ([0d2a6dd](https://github.com/crvouga/mockingbird/commit/0d2a6dd0f9fecb3a1ea7c1638f6639787395c2f4))
9
+
10
+ ### Fixes and improvements
8
11
 
9
- ### Dependencies
12
+ - correlate cross-namespace operations ([3457a4b](https://github.com/crvouga/mockingbird/commit/3457a4b7dbfd9ad9c8a10671a5744b7c8425d000))
13
+ - harden HTTP stream handling ([674307a](https://github.com/crvouga/mockingbird/commit/674307a869f57907567d462c4f506c3b0a237e13))
14
+
15
+ ## 3.3.0 (2026-10-12)
16
+
17
+ ### Features
10
18
 
11
- - `@crvouga/mockingbird-service-sqlite`
19
+ - unify the emulator control plane ([2068547](https://github.com/crvouga/mockingbird/commit/2068547bedde4e2e2331c1657c1a78120e84428b))
20
+
21
+ ## 3.2.0 (2026-10-08)
22
+
23
+ ### Features
24
+
25
+ - match Emulate provider coverage ([16b65ce](https://github.com/crvouga/mockingbird/commit/16b65ce791fa216f28ec1521df636f57771d9c5e))
12
26
 
13
27
  ## 3.1.0 (2026-10-08)
14
28
 
package/DISCOVERY.md CHANGED
@@ -35,6 +35,7 @@ repository; live parity is an additional oracle check, not a substitute for the
35
35
 
36
36
  - `GET /__admin/health`
37
37
  - `GET /__admin`
38
+ - `GET /__admin/controls`
38
39
  - `GET /__admin/state`
39
40
  - `GET /__admin/requests`
40
41
  - `GET /__admin/metrics`
@@ -45,6 +46,28 @@ For HTTP services, use `x-mockingbird-namespace` (or the documented credential/p
45
46
  parallel tests do not share state. Admin state, journal, metrics and fault-preset endpoints are
46
47
  designed for assertions and diagnosis by consuming test suites.
47
48
 
49
+ ## Admin controls
50
+
51
+ Every HTTP emulator takes the same controls, and each means the same thing at boot
52
+ (`createRuntime({ adminControls })`, `serve --admin-controls`), over `/__admin`, and in a request header:
53
+
54
+ | Control | Admin API | Request header | Interface |
55
+ | --- | --- | --- | --- |
56
+ | Isolate state by key | `GET /__admin/namespaces` | `x-mockingbird-namespace: <key>` | [Namespaces](https://mockingbird.chrisvouga.dev/docs/admin-controls/namespaces) |
57
+ | Reset to boot | `POST /__admin/reset` | `x-mockingbird-reset: true` | [Reset](https://mockingbird.chrisvouga.dev/docs/admin-controls/reset) |
58
+ | Snapshot and restore | `POST /__admin/snapshots`, `POST /__admin/snapshots/<id>/restore` | `x-mockingbird-snapshot: <name>`, `x-mockingbird-restore: <name>` | [Snapshot and restore](https://mockingbird.chrisvouga.dev/docs/admin-controls/snapshot-and-restore) |
59
+ | Move the clock | `POST /__admin/clock` | `x-mockingbird-time: <instant>`, `x-mockingbird-advance: <duration>` | [Clock](https://mockingbird.chrisvouga.dev/docs/admin-controls/clock) |
60
+ | Read or branch from old state | `GET /__admin/timeline` | `x-mockingbird-at: <checkpoint>`, `x-mockingbird-branch: <name>` | [Checkpoints and branches](https://mockingbird.chrisvouga.dev/docs/admin-controls/checkpoints-and-branches) |
61
+ | Inject a fault | `POST /__admin/faults` | `x-mockingbird-fault: <fault>` | [Faults](https://mockingbird.chrisvouga.dev/docs/admin-controls/faults) |
62
+ | Latency and timeouts | `PUT /__admin/latency` | `x-mockingbird-delay: <duration>`, `x-mockingbird-timeout: <duration>` | [Latency and timeouts](https://mockingbird.chrisvouga.dev/docs/admin-controls/latency-and-timeouts) |
63
+ | Replay from a seed | `PUT /__admin/controls` | `x-mockingbird-seed: <seed>` | [Seed and determinism](https://mockingbird.chrisvouga.dev/docs/admin-controls/seed-and-determinism) |
64
+ | See what happened | `GET /__admin/requests`, `GET /__admin/state` | | [Journal, metrics and state](https://mockingbird.chrisvouga.dev/docs/admin-controls/journal-and-state) |
65
+
66
+ `GET /__admin` lists every route and header with a one-line summary, and `GET /__admin/controls`
67
+ is the namespace's current control document. The same seed and the same requests give the same
68
+ bytes. Setting controls as an emulator starts is [Boot](https://mockingbird.chrisvouga.dev/docs/admin-controls/boot); every route and header is in
69
+ the [Reference](https://mockingbird.chrisvouga.dev/docs/admin-controls/reference). The full guide: <https://mockingbird.chrisvouga.dev/docs/admin-controls>.
70
+
48
71
  ## Report a mismatch or missing capability
49
72
 
50
73
  Follow the [agent reporting contract](https://github.com/crvouga/mockingbird/blob/main/docs/REPORTING_ISSUES.md). Include package version,
package/README.md CHANGED
@@ -41,22 +41,29 @@ npx mockingbird-google-maps serve --port 8814 --api-key "$PLACES_KEY"
41
41
  ```
42
42
 
43
43
  ```ts
44
+ import { Client, PlaceAutocompleteType } from "@googlemaps/google-maps-services-js"
44
45
  import { createRuntime } from "@crvouga/mockingbird-service-google-maps"
45
46
 
46
- const maps = createRuntime()
47
- const get = async (path: string) =>
48
- (await maps.fetch(new Request(`http://maps.test${path}`))).json()
49
-
50
- const { predictions } = await get(
51
- "/maps/api/place/autocomplete/json?input=1625%20N%20Central&types=address&components=country:us&key=k",
52
- )
53
- const details = await get(
54
- `/maps/api/place/details/json?place_id=${predictions[0].place_id}&fields=address_component&key=k`,
55
- )
56
- // details.result.address_components → 1625 / N Central Ave / Phoenix / AZ / 85004
57
-
58
- // Make the next two autocomplete calls fail, as QA's manual-entry fallback expects.
59
- maps.applyPreset("autocomplete_over_query_limit", "default", { count: 2 })
47
+ // The Maps client your application already uses. Only its HTTP layer changes: axios's
48
+ // fetch adapter reaches the emulator in this process instead of maps.googleapis.com.
49
+ const emulator = createRuntime()
50
+ const maps = new Client({
51
+ config: {
52
+ adapter: "fetch",
53
+ env: { fetch: (url: string | URL | Request, init?: RequestInit) => emulator.fetch(new Request(url, init)) },
54
+ },
55
+ })
56
+
57
+ const { data } = await maps.placeAutocomplete({
58
+ params: { input: "1625 N Central", types: PlaceAutocompleteType.address, components: ["country:us"], key: "k" },
59
+ })
60
+ const details = await maps.placeDetails({
61
+ params: { place_id: data.predictions[0]?.place_id ?? "", fields: ["address_component"], key: "k" },
62
+ })
63
+ // details.data.result.address_components → 1625 / N Central Ave / Phoenix / AZ / 85004
64
+
65
+ // Test control: make the next two autocomplete calls fail, as QA's manual-entry fallback expects.
66
+ emulator.applyPreset("autocomplete_over_query_limit", "default", { count: 2 })
60
67
  ```
61
68
 
62
69
  ### Address Validation
@@ -66,30 +73,37 @@ not collide, so one emulator serves both. Point the server-side client's Address
66
73
  at the emulator (or at `<emulator>/__admin/ns/<namespace>`), with the key as `?key=` (or `X-Goog-Api-Key`).
67
74
 
68
75
  ```ts
69
- import { createRuntime } from "@crvouga/mockingbird-service-google-maps"
70
-
71
- const maps = createRuntime()
72
- const response = await maps.fetch(
73
- new Request("http://maps.test/v1:validateAddress?key=k", {
74
- method: "POST",
75
- headers: { "content-type": "application/json" },
76
- body: JSON.stringify({
77
- address: {
78
- regionCode: "US",
79
- addressLines: ["1625 N Central Ave"],
80
- locality: "Phoenix",
81
- administrativeArea: "AZ",
82
- postalCode: "85004",
83
- },
84
- enableUspsCass: true,
85
- }),
86
- }),
87
- )
88
- const { result } = await response.json()
89
- // result.verdict → PREMISE / addressComplete / ACCEPT; result.uspsData.dpvConfirmation → "Y"
90
-
91
- // Force the USPS "not deliverable" answer on the next call.
92
- maps.applyPreset("address_validation_dpv_n", "default", { count: 1 })
76
+ import { AddressValidationClient } from "@googlemaps/addressvalidation"
77
+ import { createServer } from "@crvouga/mockingbird-service-google-maps/server"
78
+
79
+ const server = await createServer()
80
+ const { hostname, port } = new URL(server.url)
81
+
82
+ // The application's client, in REST mode. Only the endpoint changes.
83
+ const client = new AddressValidationClient({
84
+ fallback: true,
85
+ protocol: "http",
86
+ apiEndpoint: hostname,
87
+ port: Number(port),
88
+ apiKey: "k",
89
+ })
90
+ const [{ result }] = await client.validateAddress({
91
+ address: {
92
+ regionCode: "US",
93
+ addressLines: ["1625 N Central Ave"],
94
+ locality: "Phoenix",
95
+ administrativeArea: "AZ",
96
+ postalCode: "85004",
97
+ },
98
+ enableUspsCass: true,
99
+ })
100
+ // result.verdict → PREMISE / addressComplete; result.uspsData.dpvConfirmation → "Y"
101
+
102
+ // Test control: force the USPS "not deliverable" answer on the next call.
103
+ server.runtime.applyPreset("address_validation_dpv_n", "default", { count: 1 })
104
+
105
+ await client.close()
106
+ await server.close()
93
107
  ```
94
108
 
95
109
  On web, load `<emulator>/maps/api/js?key=…&libraries=places` exactly as the app loads Google's