@crvouga/mockingbird-service-stripe 3.2.0 → 3.3.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 +8 -2
- package/DISCOVERY.md +23 -0
- package/README.md +20 -17
- package/dist/{chunk-3ANL4Q47.js → chunk-ESFURE4Z.js} +2449 -653
- package/dist/{chunk-3ANL4Q47.js.map → chunk-ESFURE4Z.js.map} +4 -4
- package/dist/{chunk-QYOTTK3Z.js → chunk-N7LLU7DT.js} +135 -24
- package/dist/chunk-N7LLU7DT.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +339 -40
- package/dist/index.js +1 -1
- package/dist/server.d.ts +678 -80
- package/dist/server.js +2 -2
- package/package.json +3 -2
- package/dist/chunk-QYOTTK3Z.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-stripe
|
|
2
2
|
|
|
3
|
-
## 3.
|
|
3
|
+
## 3.3.0 (2026-10-12)
|
|
4
4
|
|
|
5
5
|
### Features
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- unify the emulator control plane ([2068547](https://github.com/crvouga/mockingbird/commit/2068547bedde4e2e2331c1657c1a78120e84428b))
|
|
8
8
|
|
|
9
9
|
### Dependencies
|
|
10
10
|
|
|
11
11
|
- `@crvouga/mockingbird-service-sqlite`
|
|
12
12
|
|
|
13
|
+
## 3.2.0 (2026-10-08)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
- match Emulate provider coverage ([16b65ce](https://github.com/crvouga/mockingbird/commit/16b65ce791fa216f28ec1521df636f57771d9c5e))
|
|
18
|
+
|
|
13
19
|
## 3.1.0 (2026-10-08)
|
|
14
20
|
|
|
15
21
|
### Features
|
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
|
@@ -33,11 +33,12 @@ npx mockingbird-stripe serve --accounts accounts.json --admin-key local-admin
|
|
|
33
33
|
npx mockingbird-stripe serve --config mockingbird.json # every service in one process
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
```
|
|
36
|
+
```ts
|
|
37
37
|
import Stripe from "stripe"
|
|
38
|
-
import {
|
|
38
|
+
import { createRuntime } from "@crvouga/mockingbird-service-stripe"
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
// Test setup: the emulator, with one account per API key the app uses.
|
|
41
|
+
const emulator = createRuntime({
|
|
41
42
|
accounts: [
|
|
42
43
|
// Legacy STRIPE_API_KEY, STRIPE_MSO_API_KEY and the EMR key all act as MSO and share state.
|
|
43
44
|
{ id: "acct_mso", keys: ["sk_test_legacy", "sk_test_mso", "sk_test_emr", "pk_test_mso"], corpus: true },
|
|
@@ -45,33 +46,35 @@ const server = await createServer({
|
|
|
45
46
|
{ id: "acct_pp", keys: ["sk_test_pp"], apiVersion: "2025-02-24.acacia" },
|
|
46
47
|
],
|
|
47
48
|
})
|
|
48
|
-
|
|
49
|
+
|
|
50
|
+
// The Stripe SDK your application already uses. Only its HTTP client changes:
|
|
51
|
+
// requests reach the emulator in this process instead of api.stripe.com.
|
|
49
52
|
const stripe = new Stripe("sk_test_mso", {
|
|
50
53
|
apiVersion: "2024-06-20",
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
httpClient: Stripe.createFetchHttpClient((url: string, init: RequestInit) =>
|
|
55
|
+
emulator.fetch(new Request(url, init)),
|
|
56
|
+
),
|
|
54
57
|
})
|
|
55
58
|
const customer = await stripe.customers.create({ email: "qa@example.com" })
|
|
56
59
|
await stripe.paymentMethods.attach("pm_card_visa", { customer: customer.id }) // a new pm_ id
|
|
57
|
-
await server.close()
|
|
58
60
|
```
|
|
59
61
|
|
|
60
|
-
Or
|
|
62
|
+
Or against a listening server, when the application runs in its own process:
|
|
61
63
|
|
|
62
64
|
```ts
|
|
65
|
+
import Stripe from "stripe"
|
|
63
66
|
import { createServer } from "@crvouga/mockingbird-service-stripe/server"
|
|
64
67
|
|
|
65
68
|
const server = await createServer()
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
body: new URLSearchParams({ email: "qa@example.com" }),
|
|
69
|
+
const url = new URL(server.url)
|
|
70
|
+
const stripe = new Stripe("sk_test_mso", {
|
|
71
|
+
apiVersion: "2024-06-20",
|
|
72
|
+
host: url.hostname,
|
|
73
|
+
port: Number(url.port),
|
|
74
|
+
protocol: "http",
|
|
73
75
|
})
|
|
74
|
-
const customer =
|
|
76
|
+
const customer = await stripe.customers.create({ email: "qa@example.com" })
|
|
77
|
+
// customer.id === "cus_…", customer.email === "qa@example.com"
|
|
75
78
|
await server.close()
|
|
76
79
|
```
|
|
77
80
|
|