@crvouga/mockingbird-service-paddle 2.3.0 → 2.5.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-paddle
2
2
 
3
- ## 2.3.0 (2026-10-09)
3
+ ## 2.5.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
+ ## 2.4.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
+ ## 2.3.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
  ## 2.2.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
@@ -39,13 +39,13 @@ npx mockingbird-paddle serve --port 8795 --fixtures \
39
39
  PADDLE_API_BASE_URL=http://127.0.0.1:8795 node app.js
40
40
  ```
41
41
 
42
- ```js
42
+ ```ts
43
43
  import { createServer } from "@crvouga/mockingbird-service-paddle/server"
44
- import { Paddle } from "@paddle/paddle-node-sdk"
44
+ import { type Environment, Paddle } from "@paddle/paddle-node-sdk"
45
45
 
46
46
  const emulator = await createServer({ paymentLink: "https://pay.example.com/checkout" })
47
- // In TypeScript: `{ environment: emulator.url as Environment }`.
48
- const paddle = new Paddle("pdl_sdbx_apikey_test", { environment: emulator.url })
47
+ // The app's own Paddle client. Only its environment changes.
48
+ const paddle = new Paddle("pdl_sdbx_apikey_test", { environment: emulator.url as Environment })
49
49
 
50
50
  const product = await paddle.products.create({ name: "Pro plan", taxCategory: "saas" })
51
51
  const price = await paddle.prices.create({
@@ -71,22 +71,27 @@ const [subscription] = await paddle.subscriptions.list({ customerId: [customer.i
71
71
  await emulator.close()
72
72
  ```
73
73
 
74
- Without the SDK, the same over HTTP:
74
+ With `fixtures: true` the catalog is already seeded, and one admin call completes a checkout:
75
75
 
76
76
  ```ts
77
77
  import { createServer } from "@crvouga/mockingbird-service-paddle/server"
78
+ import { type Environment, Paddle } from "@paddle/paddle-node-sdk"
78
79
 
79
80
  const emulator = await createServer({ fixtures: true })
80
- const headers = { authorization: "Bearer pdl_sdbx_apikey_test", "content-type": "application/json" }
81
- const { data: products } = await (await fetch(`${emulator.url}/products?include=prices`, { headers })).json()
82
- const checkout = await (
83
- await fetch(`${emulator.url}/__admin/checkout`, {
84
- method: "POST",
85
- headers,
86
- body: JSON.stringify({ email: "new@example.com", items: [{ price_id: products[0].prices[0].id }] }),
87
- })
88
- ).json()
89
- // checkout.transaction.status === "completed", checkout.subscription.status === "active"
81
+ const paddle = new Paddle("pdl_sdbx_apikey_test", { environment: emulator.url as Environment })
82
+ const [product] = await paddle.products.list({ include: ["prices"] }).next()
83
+
84
+ // Test setup: one admin call stands in for a customer completing the hosted checkout.
85
+ const completed = await fetch(`${emulator.url}/__admin/checkout`, {
86
+ method: "POST",
87
+ headers: { "content-type": "application/json" },
88
+ body: JSON.stringify({ email: "new@example.com", items: [{ price_id: product?.prices?.[0]?.id }] }),
89
+ })
90
+ const checkout = (await completed.json()) as { transaction: { id: string }; subscription: { id: string } }
91
+
92
+ const transaction = await paddle.transactions.get(checkout.transaction.id)
93
+ const subscription = await paddle.subscriptions.get(checkout.subscription.id)
94
+ // transaction.status === "completed", subscription.status === "trialing" (the fixture price has a trial)
90
95
  await emulator.close()
91
96
  ```
92
97