@crvouga/mockingbird-service-meta 0.0.0-stage → 0.1.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 +5 -0
- package/DISCOVERY.md +55 -0
- package/README.md +78 -2
- package/SUPPORT.md +13 -0
- package/dist/chunk-NRLAFEM5.js +3580 -0
- package/dist/chunk-NRLAFEM5.js.map +7 -0
- package/dist/chunk-T2NH67NR.js +827 -0
- package/dist/chunk-T2NH67NR.js.map +7 -0
- package/dist/cli.js +19 -0
- package/dist/cli.js.map +7 -0
- package/dist/index.d.ts +972 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +7 -0
- package/dist/server.d.ts +1412 -0
- package/dist/server.js +12 -0
- package/dist/server.js.map +7 -0
- package/openapi.yaml +214 -0
- package/package.json +124 -4
package/CHANGELOG.md
ADDED
package/DISCOVERY.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @crvouga/mockingbird-service-meta discovery
|
|
2
|
+
|
|
3
|
+
This is the installed-package index for coding agents and tooling. All relative links resolve
|
|
4
|
+
inside `node_modules/@crvouga/mockingbird-service-meta/`; no repository checkout is needed to discover the mock's
|
|
5
|
+
supported surface or documented behavior.
|
|
6
|
+
|
|
7
|
+
## Capability and behavior sources
|
|
8
|
+
|
|
9
|
+
| Question | Authoritative file | What it contains |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| Behaviour and integration | [`README.md`](README.md) | Routes, state transitions, auth, webhooks, controls, presets and deliberate omissions. |
|
|
12
|
+
| Exact capabilities | [`SUPPORT.md`](SUPPORT.md) | Supported, unsupported and parity-covered operations or commands, including reasons for gaps. |
|
|
13
|
+
| Wire contract | [`openapi.yaml`](openapi.yaml) | Machine-readable paths, methods, schemas, responses and parity annotations. |
|
|
14
|
+
| Public API | [`dist/index.d.ts`](dist/index.d.ts) | The installed package's exact TypeScript exports and signatures. |
|
|
15
|
+
| Package metadata | [`package.json`](package.json) | Runtime/entry-point claims, vendor links, parity scope/tier and `mockingbird.discovery`. |
|
|
16
|
+
|
|
17
|
+
Read these together: the contract/capability matrix says *what* is available, while the README
|
|
18
|
+
defines stateful behavior, lifecycle rules, test controls, and intentional oracle differences.
|
|
19
|
+
If prose and an executable surface disagree, report a parity mismatch instead of adding a
|
|
20
|
+
consumer-side workaround.
|
|
21
|
+
|
|
22
|
+
## Parity and oracle
|
|
23
|
+
|
|
24
|
+
- Declared parity surface: **Conversions events and marketing insights**.
|
|
25
|
+
- Parity tier: **cold** (the repository controls when live checks run).
|
|
26
|
+
- Oracle: **Live vendor API or sandbox**.
|
|
27
|
+
- Repository command: `bun run parity:service -- meta`.
|
|
28
|
+
- Evidence model: Run from a Mockingbird checkout; credentials come only from .env.local or GitHub Actions secrets. Missing credentials exit 2.
|
|
29
|
+
|
|
30
|
+
The npm package contains evidence summaries and the exact contract, not credentials or the
|
|
31
|
+
repository-only parity harness. Self-parity/property and acceptance tests run in the Mockingbird
|
|
32
|
+
repository; live parity is an additional oracle check, not a substitute for the packaged matrix.
|
|
33
|
+
|
|
34
|
+
## Runtime introspection
|
|
35
|
+
|
|
36
|
+
- `GET /__admin/health`
|
|
37
|
+
- `GET /__admin`
|
|
38
|
+
- `GET /__admin/state`
|
|
39
|
+
- `GET /__admin/requests`
|
|
40
|
+
- `GET /__admin/metrics`
|
|
41
|
+
- `GET /__admin/faults/presets`
|
|
42
|
+
- `GET /__admin/ui`
|
|
43
|
+
|
|
44
|
+
For HTTP services, use `x-mockingbird-namespace` (or the documented credential/path carrier) so
|
|
45
|
+
parallel tests do not share state. Admin state, journal, metrics and fault-preset endpoints are
|
|
46
|
+
designed for assertions and diagnosis by consuming test suites.
|
|
47
|
+
|
|
48
|
+
## Report a mismatch or missing capability
|
|
49
|
+
|
|
50
|
+
Follow the [agent reporting contract](https://github.com/crvouga/mockingbird/blob/main/docs/REPORTING_ISSUES.md). Include package version,
|
|
51
|
+
operation/command, a minimal redacted request, actual mock result, expected oracle result or vendor
|
|
52
|
+
documentation, and whether the mismatch appears in the matrix. Never include keys, tokens,
|
|
53
|
+
customer data, prompts, PHI, card data, or unredacted recordings.
|
|
54
|
+
|
|
55
|
+
Service key: `meta`.
|
package/README.md
CHANGED
|
@@ -1,3 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @crvouga/mockingbird-service-meta
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Familiar calls. Faithful echoes. Part of [Mockingbird](https://github.com/crvouga/mockingbird).
|
|
4
|
+
|
|
5
|
+
Stateful Meta Graph v26 mock for server-side Conversions API events and marketing reporting. It
|
|
6
|
+
preserves privacy-safe hashed user fields, event deduplication, ambiguous writes, Graph errors,
|
|
7
|
+
campaign objects, dated insights, breakdowns, and cursor pagination without contacting Meta.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -D @crvouga/mockingbird-service-meta
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
ESM only. Node >= 22 or Bun >= 1.2. Serve with `npx mockingbird-meta serve`, `createServer` from
|
|
16
|
+
`./server`, or mount `createRuntime()` in any Fetch-compatible process.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
Make the Graph origin injectable and point it at the mock. Any non-empty synthetic Bearer token or
|
|
21
|
+
`access_token` query value authenticates unless `/__admin/settings` restricts tokens.
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { createRuntime } from "@crvouga/mockingbird-service-meta"
|
|
25
|
+
|
|
26
|
+
const meta = createRuntime()
|
|
27
|
+
const response = await meta.fetch(new Request("http://meta.test/v26.0/pixel_test/events", {
|
|
28
|
+
method: "POST",
|
|
29
|
+
headers: { authorization: "Bearer meta_test", "content-type": "application/json" },
|
|
30
|
+
body: JSON.stringify({ data: [{
|
|
31
|
+
event_name: "Purchase",
|
|
32
|
+
event_time: Math.floor(Date.now() / 1000),
|
|
33
|
+
event_id: "order_42",
|
|
34
|
+
action_source: "website",
|
|
35
|
+
user_data: { em: ["a".repeat(64)] },
|
|
36
|
+
custom_data: { currency: "USD", value: 42 },
|
|
37
|
+
}] }),
|
|
38
|
+
}))
|
|
39
|
+
// → {events_received: 1, messages: [], fbtrace_id: "trace_…"}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Routes
|
|
43
|
+
|
|
44
|
+
| Route | Behaviour |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| `POST /v26.0/:pixelId/events` | Accepts CAPI `data[]` and `test_event_code`; keeps event name/time/id, action source, source URL, hashed user data and custom data. Repeated `event_id` values are acknowledged without a second stored event. Events older than seven days, future events, malformed hashes and invalid bodies receive Graph error envelopes. |
|
|
47
|
+
| `GET /v26.0/:accountId/insights` | Filters seeded or admin-inserted insight rows by inclusive JSON `time_range`, paginates with `limit`/`after`, and includes `country` when requested as a breakdown. |
|
|
48
|
+
| `GET /v26.0/:objectId` | Reads seeded/admin-inserted campaign, ad-set, or ad records. |
|
|
49
|
+
|
|
50
|
+
Seed fixtures are `act_mockingbird`, `cmp_mockingbird`, `set_mockingbird`, and `ad_mockingbird`,
|
|
51
|
+
with three dated insight rows from 2026-01-01 through 2026-01-03.
|
|
52
|
+
|
|
53
|
+
### Admin and faults
|
|
54
|
+
|
|
55
|
+
`GET /__admin/events` returns the namespace's privacy-safe stored requests. `GET/PUT
|
|
56
|
+
/__admin/settings` controls `accessTokens` and `maxEventAgeSeconds`. Standard `/__admin/state`
|
|
57
|
+
routes seed or edit `events`, `objects`, and `insights` directly.
|
|
58
|
+
|
|
59
|
+
Presets: `expired_token`, `rate_limited`, `server_error`, `partial_event_acceptance`,
|
|
60
|
+
`accepted_then_drop`, and `slow`. The ambiguous-write preset persists the event before dropping the
|
|
61
|
+
connection; retrying the same `event_id` remains deduplicated.
|
|
62
|
+
|
|
63
|
+
Namespaces use `x-mockingbird-namespace`, `/__admin/ns/<name>/…`, or credential mapping through
|
|
64
|
+
`PUT /__admin/credentials`.
|
|
65
|
+
|
|
66
|
+
## API
|
|
67
|
+
|
|
68
|
+
The main entry exports `MetaAPI`, `MetaState`, `createRuntime`, `META_NAMESPACE`, `META_PRESETS`,
|
|
69
|
+
`DEFAULT_SETTINGS`, `accessTokenCredential`, the generated `document`, `operationIds`,
|
|
70
|
+
`supportedOperationIds`, and their public option/state/event/insight types.
|
|
71
|
+
`@crvouga/mockingbird-service-meta/server` exports
|
|
72
|
+
`createServer`, `serveTarget`, `DEFAULT_PORT`, and server option/result types.
|
|
73
|
+
|
|
74
|
+
## Deliberately not modelled
|
|
75
|
+
|
|
76
|
+
- Real ad delivery, attribution calculation, hashing of plaintext PII, app-secret proof, or OAuth.
|
|
77
|
+
- Campaign/ad-set/ad mutation, creatives, audiences, pixels configuration, dashboards, or billing.
|
|
78
|
+
- The complete Insights fields/breakdowns matrix and asynchronous report jobs.
|
|
79
|
+
- Meta-side probabilistic matching: the mock records only the supplied synthetic hashed fields.
|
package/SUPPORT.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Meta Marketing and Conversions APIs (Mockingbird subset) — operation support
|
|
2
|
+
|
|
3
|
+
Generated from `openapi.yaml`; do not edit by hand.
|
|
4
|
+
|
|
5
|
+
- operations in spec: **3**
|
|
6
|
+
- supported by the mock: **3**
|
|
7
|
+
- parity enabled: **2**
|
|
8
|
+
|
|
9
|
+
| operationId | route | mock | parity | notes |
|
|
10
|
+
| --- | --- | --- | --- | --- |
|
|
11
|
+
| `PostPixelEvents` | `POST /v26.0/{pixel_id}/events` | ✅ supported | ❌ disabled | Sends conversion events to a real pixel |
|
|
12
|
+
| `GetInsights` | `GET /v26.0/{account_id}/insights` | ✅ supported | ✅ | |
|
|
13
|
+
| `GetMarketingObject` | `GET /v26.0/{object_id}` | ✅ supported | ✅ | |
|