@crvouga/mockingbird-service-google-ads 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 +110 -0
- package/SUPPORT.md +18 -0
- package/dist/chunk-JBX6JYJ4.js +4840 -0
- package/dist/chunk-JBX6JYJ4.js.map +7 -0
- package/dist/chunk-KCDPF76K.js +818 -0
- package/dist/chunk-KCDPF76K.js.map +7 -0
- package/dist/cli.js +19 -0
- package/dist/cli.js.map +7 -0
- package/dist/index.d.ts +1125 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +7 -0
- package/dist/server.d.ts +1553 -0
- package/dist/server.js +12 -0
- package/dist/server.js.map +7 -0
- package/openapi.yaml +1838 -0
- package/package.json +130 -0
package/CHANGELOG.md
ADDED
package/DISCOVERY.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @crvouga/mockingbird-service-google-ads 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-google-ads/`; 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: **GAQL metrics, campaign budgets, conversions and GA4 events/reports**.
|
|
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 -- google-ads`.
|
|
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: `google-ads`.
|
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# @crvouga/mockingbird-service-google-ads
|
|
2
|
+
|
|
3
|
+
> Familiar calls. Faithful echoes. Part of [Mockingbird](https://github.com/crvouga/mockingbird).
|
|
4
|
+
|
|
5
|
+
A **wip** portable mock for Google Ads API v25 and Google Analytics 4. It provides deterministic
|
|
6
|
+
GAQL reporting, campaign-budget mutations, click-conversion uploads, Measurement Protocol event
|
|
7
|
+
collection, and Analytics Data reports using namespaced SQLite state and an injected clock.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
bun add @crvouga/mockingbird-service-google-ads
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import {
|
|
19
|
+
createRuntime,
|
|
20
|
+
DEFAULT_CUSTOMER,
|
|
21
|
+
DEFAULT_TOKEN,
|
|
22
|
+
} from "@crvouga/mockingbird-service-google-ads"
|
|
23
|
+
|
|
24
|
+
const mock = createRuntime()
|
|
25
|
+
const response = await mock.fetch(
|
|
26
|
+
new Request(`http://mock.local/v25/customers/${DEFAULT_CUSTOMER}/googleAds:search`, {
|
|
27
|
+
method: "POST",
|
|
28
|
+
headers: {
|
|
29
|
+
authorization: `Bearer ${DEFAULT_TOKEN}`,
|
|
30
|
+
"content-type": "application/json",
|
|
31
|
+
},
|
|
32
|
+
body: JSON.stringify({
|
|
33
|
+
query: "SELECT campaign.id, campaign.name, metrics.clicks FROM campaign",
|
|
34
|
+
}),
|
|
35
|
+
}),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
console.log(await response.json())
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The Ads and Analytics Data routes use OAuth Bearer credentials. Measurement Protocol routes use
|
|
42
|
+
the `measurement_id` and `api_secret` query parameters. The exported defaults are synthetic and
|
|
43
|
+
safe for tests. Configure `tokens`, customers, campaigns, budgets, conversion actions, metrics,
|
|
44
|
+
and Analytics properties through `createRuntime` options when a suite needs different fixtures.
|
|
45
|
+
|
|
46
|
+
For parallel tests, send `x-mockingbird-namespace`, use the shared `/__admin/ns/{namespace}` path,
|
|
47
|
+
or register credentials with the shared admin API. State, pagination snapshots, IDs, clocks,
|
|
48
|
+
faults, and resets are isolated by namespace.
|
|
49
|
+
|
|
50
|
+
## Supported operations
|
|
51
|
+
|
|
52
|
+
| Operation | Route | Behavior |
|
|
53
|
+
| --- | --- | --- |
|
|
54
|
+
| SearchGoogleAds | `POST /v25/customers/{customerId}/googleAds:search` | GAQL selection, filtering, ordering, aggregation, summary rows, stable 10,000-row pages and validate-only requests |
|
|
55
|
+
| SearchStreamGoogleAds | `POST /v25/customers/{customerId}/googleAds:searchStream` | Deterministic JSON batches and optional summary rows |
|
|
56
|
+
| MutateCampaignBudgets | `POST /v25/customers/{customerId}/campaignBudgets:mutate` | Create, update, remove, update masks, validate-only and atomic or partial failure |
|
|
57
|
+
| UploadClickConversions | `POST /v25/customers/{customerId}:uploadClickConversions` | Click identifiers, conversion actions, duplicate detection, job IDs and partial failure |
|
|
58
|
+
| CollectAnalyticsEvents | `POST /mp/collect` | Production-style empty 204 response with accepted events stored for reporting |
|
|
59
|
+
| ValidateAnalyticsEvents | `POST /debug/mp/collect` | Validation messages without ingestion |
|
|
60
|
+
| RunAnalyticsReport | `POST /v1beta/properties/{propertyId}:runReport` | Dimensions, metrics, filters, ordering, pagination and reporting lag |
|
|
61
|
+
| BatchRunAnalyticsReports | `POST /v1beta/properties/{propertyId}:batchRunReports` | Up to five report requests |
|
|
62
|
+
|
|
63
|
+
The exact request and response schemas are in [`openapi.yaml`](openapi.yaml), and the generated
|
|
64
|
+
support matrix is in [`SUPPORT.md`](SUPPORT.md).
|
|
65
|
+
|
|
66
|
+
## Controls and failures
|
|
67
|
+
|
|
68
|
+
Service-specific controls are protected by the shared `x-mockingbird-admin-key` guard and live
|
|
69
|
+
beside the shared health, state, clock, journal, fault, reset, and Timeline endpoints.
|
|
70
|
+
|
|
71
|
+
| Control | Purpose |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| `GET /__admin/events` | Inspect stored Analytics events |
|
|
74
|
+
| `GET /__admin/conversions` | Inspect uploaded conversions |
|
|
75
|
+
| `GET /__admin/budgets` | Inspect campaign budgets |
|
|
76
|
+
| `GET /__admin/budget-mutations` | Inspect the mutation audit trail |
|
|
77
|
+
| `GET /__admin/request-metadata` | Inspect redacted request metadata |
|
|
78
|
+
| `POST /__admin/daily-metrics` | Seed synthetic daily Ads metrics |
|
|
79
|
+
| `POST /__admin/page-tokens/expire` | Expire all current GAQL page tokens |
|
|
80
|
+
| `GET /__admin/settings` | Read reporting lag, page-token TTL and future-timestamp policy |
|
|
81
|
+
| `PUT /__admin/settings` | Update those deterministic test settings |
|
|
82
|
+
|
|
83
|
+
Fault presets include `quota_exhausted`, `server_error`, `network_reset`, `slow_response`,
|
|
84
|
+
`ambiguous_budget_write`, `partial_budget_failure`, and `partial_conversion_failure`. The
|
|
85
|
+
ambiguous-write preset commits the mutation before returning 503 so retry logic can be tested
|
|
86
|
+
against an uncertain outcome. Sensitive event and conversion payloads are sealed in state;
|
|
87
|
+
journals and inspection metadata contain only the fields needed for assertions.
|
|
88
|
+
|
|
89
|
+
## API
|
|
90
|
+
|
|
91
|
+
The portable root exports `GoogleAdsAPI`, `createRuntime`, `document`, `supportedOperationIds`,
|
|
92
|
+
`GOOGLE_ADS_NAMESPACE`, `GOOGLE_ADS_PRESETS`, `DEFAULT_ADMIN_KEY`, `DEFAULT_TOKEN`,
|
|
93
|
+
`DEFAULT_CUSTOMER`, `DEFAULT_CUSTOMERS`, `DEFAULT_BUDGETS`, `DEFAULT_CAMPAIGNS`, `DEFAULT_ACTIONS`,
|
|
94
|
+
`DEFAULT_PROPERTY`, `DEFAULT_MEASUREMENT`, `DEFAULT_API_SECRET`, `createVaultKey`, `fingerprint`,
|
|
95
|
+
and the public fixture/runtime option types. The Node `./server` entry exports `createServer`,
|
|
96
|
+
`DEFAULT_PORT`, and server types. `mockingbird-google-ads serve` starts a listener.
|
|
97
|
+
|
|
98
|
+
## Verification and scope
|
|
99
|
+
|
|
100
|
+
Acceptance tests cover GAQL precision and paging, budget preflight and partial writes, conversion
|
|
101
|
+
deduplication, GA4 event validation and reporting, OAuth scope/expiry behavior, encrypted state,
|
|
102
|
+
namespaces, resets, fault recovery, and the unmodified `google-auth-library` 11.1.0 HTTP signing
|
|
103
|
+
path. Property tests exercise every parity-enabled operation and prove that a divergent transport
|
|
104
|
+
is detected deterministically.
|
|
105
|
+
|
|
106
|
+
The mock intentionally implements a bounded subset. It does not model the complete Google Ads
|
|
107
|
+
resource graph, every GAQL function, every Analytics dimension or metric, real Google identity,
|
|
108
|
+
production quota allocation, billing, dashboards, attribution processing, or undocumented
|
|
109
|
+
backend behavior. Normal operation is local and does not contact Google; only the explicit parity
|
|
110
|
+
command uses credentials supplied through `.env.local` or GitHub Actions secrets.
|
package/SUPPORT.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Google Ads v25 and GA4 local API subset — operation support
|
|
2
|
+
|
|
3
|
+
Generated from `openapi.yaml`; do not edit by hand.
|
|
4
|
+
|
|
5
|
+
- operations in spec: **8**
|
|
6
|
+
- supported by the mock: **8**
|
|
7
|
+
- parity enabled: **8**
|
|
8
|
+
|
|
9
|
+
| operationId | route | mock | parity | notes |
|
|
10
|
+
| --- | --- | --- | --- | --- |
|
|
11
|
+
| `SearchGoogleAds` | `POST /v25/customers/{customerId}/googleAds:search` | ✅ supported | ✅ | |
|
|
12
|
+
| `SearchStreamGoogleAds` | `POST /v25/customers/{customerId}/googleAds:searchStream` | ✅ supported | ✅ | |
|
|
13
|
+
| `MutateCampaignBudgets` | `POST /v25/customers/{customerId}/campaignBudgets:mutate` | ✅ supported | ⚠️ unsafe (opt-in) | |
|
|
14
|
+
| `UploadClickConversions` | `POST /v25/customers/{customerId}:uploadClickConversions` | ✅ supported | ⚠️ unsafe (opt-in) | |
|
|
15
|
+
| `CollectAnalyticsEvents` | `POST /mp/collect` | ✅ supported | ⚠️ unsafe (opt-in) | |
|
|
16
|
+
| `ValidateAnalyticsEvents` | `POST /debug/mp/collect` | ✅ supported | ✅ | |
|
|
17
|
+
| `RunAnalyticsReport` | `POST /v1beta/properties/{propertyId}:runReport` | ✅ supported | ✅ | |
|
|
18
|
+
| `BatchRunAnalyticsReports` | `POST /v1beta/properties/{propertyId}:batchRunReports` | ✅ supported | ✅ | |
|