@particle-academy/google-ads-js 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 ADDED
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@particle-academy/google-ads-ui`,
4
+ `@particle-academy/google-ads-js`, `particle-academy/google-ads-php` and
5
+ `fancy-google-ads`.
6
+
7
+ ## [0.1.0] - 2026-08-24
8
+
9
+ ### Added
10
+
11
+ - List Google Ads customers directly accessible to an OAuth identity.
12
+ - Send the required developer token alongside OAuth bearer authorization.
13
+ - Support an optional manager customer header for manager-account access.
14
+ - Model Google Ads' isolated test-account hierarchy.
15
+ - Provide a deterministic fixture matching the v25 discovery response.
16
+
17
+ [0.1.0]: https://github.com/Fancy-Friends/google-ads/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Particle Academy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,101 @@
1
+ # Google Ads
2
+
3
+ Google Ads for [fancy-flow][flow] — as **four imported, versioned packages**, one
4
+ per runtime. Not vendored source: a copy cannot be upgraded, and third-party APIs
5
+ change.
6
+
7
+ [flow]: https://github.com/Particle-Academy/fancy-flow
8
+
9
+ | Runtime | Package | Install |
10
+ |---|---|---|
11
+ | Authoring surface (every host) | `@particle-academy/google-ads-ui` | `npm install @particle-academy/google-ads-ui` |
12
+ | Node | `@particle-academy/google-ads-js` | `npm install @particle-academy/google-ads-js` |
13
+ | PHP 8.4+ | `particle-academy/google-ads-php` | `composer require particle-academy/google-ads-php` |
14
+ | Python 3.11+ | `fancy-google-ads` | `pip install fancy-google-ads` |
15
+
16
+ The `ui` package is the editor surface and is React on every host — a PHP or
17
+ Python project installs it *and* its own runtime package, and never the `js` one.
18
+
19
+ ## What it costs you
20
+
21
+ One dependency: `@particle-academy/fancy-connector-core` (or
22
+ `particle-academy/fancy-connector-core` on Composer), which the `js` and `php`
23
+ packages pull in themselves. The Python package has **zero** runtime
24
+ dependencies.
25
+
26
+ **No Google Ads SDK.** Plain HTTP, deliberately: a vendor SDK is third-party code
27
+ subject to the kit's full approval bar, and one per provider is hundreds of
28
+ dependencies nobody is tracking.
29
+
30
+ ## Setting it up
31
+
32
+ Everything below is generated from `provider/manifest.json`, so it cannot disagree with what the packages do.
33
+
34
+ ### Credentials
35
+
36
+ A Google Ads connection holds 6 values.
37
+
38
+ **Two kinds of value, and mixing them up matters.** A `provider` credential is ONE value for the whole installation — an OAuth app's client secret serves every connected account. An `account` credential is one per connected account. A host that stores the second where it stores the first lets one account's credentials reach another's.
39
+
40
+ | Field | Scope | Secret | Where it comes from |
41
+ |---|---|---|---|
42
+ | **OAuth client ID** | per installation | not secret | The Google Cloud OAuth client shared by the installation. |
43
+ | **OAuth client secret** | per installation | **secret** | The matching Google Cloud OAuth client secret. |
44
+ | **Developer token** | per installation | **secret** | The 22-character Google Ads API developer token from the manager account's API Center. Google says to treat it like a password; one token identifies the installed application. |
45
+ | **Access token** | per connected account | **secret** | The connected Google user's one-hour OAuth access token. |
46
+ | **Refresh token** | per connected account | **secret** | The reusable offline token used to replace expired access tokens. |
47
+ | **Manager customer ID** *(optional)* | per connected account | not secret | Optional. The manager account's 10-digit customer ID without hyphens. Required when the OAuth user reaches a client through that manager; omit it for direct access. |
48
+
49
+ Every request carries `developer-token` and `login-customer-id` *(when set)* alongside the primary authorization, filled from the credentials above.
50
+
51
+ ### Authorising
52
+
53
+ Google Ads uses OAuth2 (authorization_code). The package DECLARES the exchange; the HOST performs it — a consent screen needs a browser, a redirect URI and somewhere to persist the result, and all three belong to the host.
54
+
55
+ - **Authorize URL** — https://accounts.google.com/o/oauth2/v2/auth
56
+ - **Token URL** — https://oauth2.googleapis.com/token
57
+ - **Scopes** — `https://www.googleapis.com/auth/adwords`
58
+ - **Access token lifetime** — 3600 seconds (1 hours). A host that never refreshes works all afternoon and is broken by morning.
59
+
60
+ The refresh tokens do **not** rotate: the same one is reusable, so a refresh may safely be retried and may run concurrently. Stated rather than assumed, because the opposite — a provider that spends the token and revokes the grant on a replay — looks identical until it happens.
61
+
62
+ ### The estate
63
+
64
+ Google Ads has a test estate on the same host, reached with credentials from a SEPARATE test account you register. Selecting sandbox mode uses those credentials.
65
+
66
+ > Use a dedicated Google Ads test manager and test client account. Test and production hierarchies cannot interact; test ads never serve or incur cost, but some features such as billing, conversion uploads and serving reports cannot be exercised there.
67
+
68
+ ## What it can do
69
+
70
+ ### Actions
71
+
72
+ #### `customer_list_accessible` — Accessible Google Ads customers
73
+
74
+ List Google Ads customer resource names directly accessible to the authenticated user. Manager-linked client accounts are not included; query the account hierarchy after choosing a directly accessible manager.
75
+
76
+ `GET /v25/customers:listAccessibleCustomers` · reads only — safe to replay
77
+
78
+ Takes no input.
79
+
80
+ ## Run it before you have credentials
81
+
82
+ Every operation ships a **faker**, whether or not Google Ads has a sandbox. Set a
83
+ node's mode to `fake` and it returns the shape Google Ads actually publishes — the
84
+ same field names, deterministically — so you can wire the downstream nodes before
85
+ touching an account, a key, or a network.
86
+
87
+ ## This repository is generated
88
+
89
+ `provider/` is the source. Everything under `packages/` is emitted from it and
90
+ **must not be hand-edited** — CI regenerates and diffs on every push, and the
91
+ next protocol sync destroys anything it finds. See [`AGENTS.md`](AGENTS.md).
92
+
93
+ ## Two namespaces, which do not match on purpose
94
+
95
+ The repo is `github.com/Fancy-Friends/google-ads`; the packages publish under
96
+ `particle-academy`. Nothing derives one from the other — the names come from
97
+ weaver's `friends.json` and nowhere else.
98
+
99
+ ## Licence
100
+
101
+ MIT.
@@ -0,0 +1,75 @@
1
+ import { callConnector } from '@particle-academy/fancy-connector-core';
2
+
3
+ // src/faker.ts
4
+ function fakeCustomerListAccessible({ config, fake }) {
5
+ return {
6
+ "resourceNames": [
7
+ "customers/1234567890",
8
+ "customers/9876543210"
9
+ ]
10
+ };
11
+ }
12
+ var googleAdsFaker = (operation, request) => {
13
+ switch (operation) {
14
+ case "customer_list_accessible":
15
+ return fakeCustomerListAccessible(request);
16
+ default:
17
+ throw new Error(
18
+ `google_ads: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
19
+ );
20
+ }
21
+ };
22
+
23
+ // src/service.ts
24
+ var CONNECTOR_API_VERSION = 1;
25
+ var GOOGLE_ADS_BASE_URLS = {
26
+ "live": "https://googleads.googleapis.com",
27
+ "sandbox": "https://googleads.googleapis.com"
28
+ };
29
+ var GOOGLE_ADS_REQUIRES = [
30
+ "accessToken",
31
+ "refreshToken",
32
+ "clientId",
33
+ "clientSecret",
34
+ "developerToken",
35
+ "loginCustomerId"
36
+ ];
37
+ function googleAdsAuthorize(credentials, request, _mode) {
38
+ request.headers.Authorization = `Bearer ${credentials.accessToken ?? ""}`;
39
+ request.headers["developer-token"] = String(credentials.developerToken ?? "");
40
+ if (credentials.loginCustomerId) {
41
+ request.headers["login-customer-id"] = String(credentials.loginCustomerId);
42
+ }
43
+ }
44
+ var GOOGLE_ADS = {
45
+ service: "google_ads",
46
+ title: "Google Ads",
47
+ sandbox: "separate-account",
48
+ baseUrls: { ...GOOGLE_ADS_BASE_URLS },
49
+ requires: [...GOOGLE_ADS_REQUIRES],
50
+ authorize: googleAdsAuthorize,
51
+ faker: googleAdsFaker
52
+ };
53
+ var CUSTOMER_LIST_ACCESSIBLE_OPERATION = "customer_list_accessible";
54
+ async function googleAdsCustomerListAccessible(options) {
55
+ const config = options.config ?? {};
56
+ return callConnector(GOOGLE_ADS, {
57
+ operation: CUSTOMER_LIST_ACCESSIBLE_OPERATION,
58
+ config,
59
+ input: options.input,
60
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
61
+ ...options.mode === void 0 ? {} : { mode: options.mode },
62
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
63
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
64
+ ...options.transport === void 0 ? {} : { transport: options.transport },
65
+ request: {
66
+ method: "GET",
67
+ path: "/v25/customers:listAccessibleCustomers",
68
+ query: {}
69
+ }
70
+ });
71
+ }
72
+
73
+ export { CONNECTOR_API_VERSION, CUSTOMER_LIST_ACCESSIBLE_OPERATION, GOOGLE_ADS, GOOGLE_ADS_BASE_URLS, GOOGLE_ADS_REQUIRES, googleAdsAuthorize, googleAdsCustomerListAccessible, googleAdsFaker };
74
+ //# sourceMappingURL=chunk-TDMIZIW5.js.map
75
+ //# sourceMappingURL=chunk-TDMIZIW5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/customer-list-accessible.ts"],"names":[],"mappings":";;;AAyBA,SAAS,0BAAA,CAA2B,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC1E,EAAA,OAAO;AAAA,IACL,eAAA,EAAiB;AAAA,MACf,sBAAA;AAAA,MACA;AAAA;AACF,GACF;AACF;AA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AkE;AACtH,EAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,MAAA,IAAU,EAAC;AAElC,EAAA,OAAO,cAAc,UAAA,EAAY;AAAA,IAC/B,SAAA,EAAW,kCAAA;AAAA,IACX,MAAA;AAAA,IACA,OAAO,OAAA,CAAQ,KAAA;AAAA,IACf,GAAI,QAAQ,WAAA,KAAgB,MAAA,GAAY,EAAC,GAAI,EAAE,WAAA,EAAa,OAAA,CAAQ,WAAA,EAAY;AAAA,IAChF,GAAI,QAAQ,IAAA,KAAS,MAAA,GAAY,EAAC,GAAI,EAAE,IAAA,EAAM,OAAA,CAAQ,IAAA,EAAK;AAAA,IAC3D,GAAI,QAAQ,YAAA,KAAiB,MAAA,GAAY,EAAC,GAAI,EAAE,YAAA,EAAc,OAAA,CAAQ,YAAA,EAAa;AAAA,IACnF,GAAI,QAAQ,QAAA,KAAa,MAAA,GAAY,EAAC,GAAI,EAAE,QAAA,EAAU,OAAA,CAAQ,QAAA,EAAS;AAAA,IACvE,GAAI,QAAQ,SAAA,KAAc,MAAA,GAAY,EAAC,GAAI,EAAE,SAAA,EAAW,OAAA,CAAQ,SAAA,EAAU;AAAA,IAC1E,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ,KAAA;AAAA,MACR,IAAA,EAAM,wCAAA;AAAA,MACN,OAAO;AAAC;AACV,GACD,CAAA;AACH","file":"chunk-TDMIZIW5.js","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_ads\n */\n\n/**\n * The Google Ads faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Google Ads actually publishes, so an author can wire {{ $json.data.id\n * }} against a fake and have it keep working against the real thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakeCustomerListAccessible({ config, fake }: FakeRequest): unknown {\n return {\n \"resourceNames\": [\n \"customers/1234567890\",\n \"customers/9876543210\",\n ],\n };\n}\n\nexport const googleAdsFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"customer_list_accessible\":\n return fakeCustomerListAccessible(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `google_ads: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_ads\n */\n\n/**\n * Google Ads, as one service descriptor shared by every Google Ads operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Google Ads: its base URL, its auth\n * scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Use a dedicated Google Ads test manager and test client account. Test and\n * production hierarchies cannot interact; test ads never serve or incur cost,\n * but some features such as billing, conversion uploads and serving reports\n * cannot be exercised there.\n */\n\nimport type { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { googleAdsFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const GOOGLE_ADS_BASE_URLS = {\n \"live\": \"https://googleads.googleapis.com\",\n \"sandbox\": \"https://googleads.googleapis.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const GOOGLE_ADS_REQUIRES = [\n \"accessToken\",\n \"refreshToken\",\n \"clientId\",\n \"clientSecret\",\n \"developerToken\",\n \"loginCustomerId\"\n] as const;\n\n/**\n * Apply Google Ads's auth scheme to an outgoing request.\n *\n * Google Ads requires the OAuth bearer AND the developer-token header on\n * ordinary calls. developerToken identifies the installed API application;\n * loginCustomerId selects the manager account only when access to a client is\n * through that manager. An absent optional manager id omits the header rather\n * than sending it empty.\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function googleAdsAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n\n request.headers[\"developer-token\"] = String(credentials.developerToken ?? \"\");\n if (credentials.loginCustomerId) {\n request.headers[\"login-customer-id\"] = String(credentials.loginCustomerId);\n }\n}\n\n/** The Google Ads service, for the TypeScript runtime. */\nexport const GOOGLE_ADS: ServiceDescriptor = {\n service: \"google_ads\",\n title: \"Google Ads\",\n sandbox: \"separate-account\",\n baseUrls: { ...GOOGLE_ADS_BASE_URLS },\n requires: [...GOOGLE_ADS_REQUIRES],\n authorize: googleAdsAuthorize,\n faker: googleAdsFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/customer-list-accessible.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/customer-list-accessible.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_ads\n */\n\n/**\n * List Google Ads customer resource names directly accessible to the\n * authenticated user. Manager-linked client accounts are not included; query\n * the account hierarchy after choosing a directly accessible manager.\n *\n * GET /v25/customers:listAccessibleCustomers —\n * https://developers.google.com/google-ads/api/rest/reference/rest/v25/customers/listAccessibleCustomers\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Ads or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_ADS } from \"../service.js\";\n\nexport const CUSTOMER_LIST_ACCESSIBLE_OPERATION = \"customer_list_accessible\";\n\nexport type CustomerListAccessibleOptions = {\n /** The node's resolved config. Keys: . */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleAdsCustomerListAccessible(options: CustomerListAccessibleOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n return callConnector(GOOGLE_ADS, {\n operation: CUSTOMER_LIST_ACCESSIBLE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: \"/v25/customers:listAccessibleCustomers\",\n query: {},\n },\n });\n}\n"]}
package/dist/flow.cjs ADDED
@@ -0,0 +1,99 @@
1
+ 'use strict';
2
+
3
+ var fancyConnectorCore = require('@particle-academy/fancy-connector-core');
4
+ var googleAdsUi = require('@particle-academy/google-ads-ui');
5
+
6
+ // src/flow.ts
7
+
8
+ // src/faker.ts
9
+ function fakeCustomerListAccessible({ config, fake }) {
10
+ return {
11
+ "resourceNames": [
12
+ "customers/1234567890",
13
+ "customers/9876543210"
14
+ ]
15
+ };
16
+ }
17
+ var googleAdsFaker = (operation, request) => {
18
+ switch (operation) {
19
+ case "customer_list_accessible":
20
+ return fakeCustomerListAccessible(request);
21
+ default:
22
+ throw new Error(
23
+ `google_ads: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
24
+ );
25
+ }
26
+ };
27
+
28
+ // src/service.ts
29
+ var GOOGLE_ADS_BASE_URLS = {
30
+ "live": "https://googleads.googleapis.com",
31
+ "sandbox": "https://googleads.googleapis.com"
32
+ };
33
+ var GOOGLE_ADS_REQUIRES = [
34
+ "accessToken",
35
+ "refreshToken",
36
+ "clientId",
37
+ "clientSecret",
38
+ "developerToken",
39
+ "loginCustomerId"
40
+ ];
41
+ function googleAdsAuthorize(credentials, request, _mode) {
42
+ request.headers.Authorization = `Bearer ${credentials.accessToken ?? ""}`;
43
+ request.headers["developer-token"] = String(credentials.developerToken ?? "");
44
+ if (credentials.loginCustomerId) {
45
+ request.headers["login-customer-id"] = String(credentials.loginCustomerId);
46
+ }
47
+ }
48
+ var GOOGLE_ADS = {
49
+ service: "google_ads",
50
+ title: "Google Ads",
51
+ sandbox: "separate-account",
52
+ baseUrls: { ...GOOGLE_ADS_BASE_URLS },
53
+ requires: [...GOOGLE_ADS_REQUIRES],
54
+ authorize: googleAdsAuthorize,
55
+ faker: googleAdsFaker
56
+ };
57
+ var CUSTOMER_LIST_ACCESSIBLE_OPERATION = "customer_list_accessible";
58
+ async function googleAdsCustomerListAccessible(options) {
59
+ const config = options.config ?? {};
60
+ return fancyConnectorCore.callConnector(GOOGLE_ADS, {
61
+ operation: CUSTOMER_LIST_ACCESSIBLE_OPERATION,
62
+ config,
63
+ input: options.input,
64
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
65
+ ...options.mode === void 0 ? {} : { mode: options.mode },
66
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
67
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
68
+ ...options.transport === void 0 ? {} : { transport: options.transport },
69
+ request: {
70
+ method: "GET",
71
+ path: "/v25/customers:listAccessibleCustomers",
72
+ query: {}
73
+ }
74
+ });
75
+ }
76
+
77
+ // src/flow.ts
78
+ var googleAdsCustomerListExecutor = async (ctx) => {
79
+ const config = ctx.node.data?.config ?? {};
80
+ const result = await googleAdsCustomerListAccessible({
81
+ config,
82
+ input: ctx.inputs?.in
83
+ });
84
+ ctx.emit({
85
+ type: "log",
86
+ level: "info",
87
+ nodeId: ctx.node.id,
88
+ message: `google_ads customer_list_accessible ${result.data?.id} (${result.mode})`
89
+ });
90
+ return { __port: "out", value: result };
91
+ };
92
+ var GOOGLE_ADS_RUNNABLE_KINDS = [
93
+ { ...googleAdsUi.googleAdsCustomerListKind, executor: googleAdsCustomerListExecutor }
94
+ ];
95
+
96
+ exports.GOOGLE_ADS_RUNNABLE_KINDS = GOOGLE_ADS_RUNNABLE_KINDS;
97
+ exports.googleAdsCustomerListExecutor = googleAdsCustomerListExecutor;
98
+ //# sourceMappingURL=flow.cjs.map
99
+ //# sourceMappingURL=flow.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/customer-list-accessible.ts","../src/flow.ts"],"names":["callConnector","googleAdsCustomerListKind"],"mappings":";;;;;;;;AAyBA,SAAS,0BAAA,CAA2B,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC1E,EAAA,OAAO;AAAA,IACL,eAAA,EAAiB;AAAA,MACf,sBAAA;AAAA,MACA;AAAA;AACF,GACF;AACF;AAEO,IAAM,cAAA,GAAiC,CAAC,SAAA,EAAW,OAAA,KAAY;AACpE,EAAA,QAAQ,SAAA;AAAW,IACjB,KAAK,0BAAA;AACH,MAAA,OAAO,2BAA2B,OAAO,CAAA;AAAA,IAE3C;AAIE,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,gDAAgD,SAAS,CAAA,iJAAA;AAAA,OAG3D;AAAA;AAEN,CAAA;;;ACVO,IAAM,oBAAA,GAAuB;AAAA,EAClC,MAAA,EAAQ,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5C","file":"flow.cjs","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_ads\n */\n\n/**\n * The Google Ads faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Google Ads actually publishes, so an author can wire {{ $json.data.id\n * }} against a fake and have it keep working against the real thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakeCustomerListAccessible({ config, fake }: FakeRequest): unknown {\n return {\n \"resourceNames\": [\n \"customers/1234567890\",\n \"customers/9876543210\",\n ],\n };\n}\n\nexport const googleAdsFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"customer_list_accessible\":\n return fakeCustomerListAccessible(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `google_ads: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_ads\n */\n\n/**\n * Google Ads, as one service descriptor shared by every Google Ads operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Google Ads: its base URL, its auth\n * scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Use a dedicated Google Ads test manager and test client account. Test and\n * production hierarchies cannot interact; test ads never serve or incur cost,\n * but some features such as billing, conversion uploads and serving reports\n * cannot be exercised there.\n */\n\nimport type { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { googleAdsFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const GOOGLE_ADS_BASE_URLS = {\n \"live\": \"https://googleads.googleapis.com\",\n \"sandbox\": \"https://googleads.googleapis.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const GOOGLE_ADS_REQUIRES = [\n \"accessToken\",\n \"refreshToken\",\n \"clientId\",\n \"clientSecret\",\n \"developerToken\",\n \"loginCustomerId\"\n] as const;\n\n/**\n * Apply Google Ads's auth scheme to an outgoing request.\n *\n * Google Ads requires the OAuth bearer AND the developer-token header on\n * ordinary calls. developerToken identifies the installed API application;\n * loginCustomerId selects the manager account only when access to a client is\n * through that manager. An absent optional manager id omits the header rather\n * than sending it empty.\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function googleAdsAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n\n request.headers[\"developer-token\"] = String(credentials.developerToken ?? \"\");\n if (credentials.loginCustomerId) {\n request.headers[\"login-customer-id\"] = String(credentials.loginCustomerId);\n }\n}\n\n/** The Google Ads service, for the TypeScript runtime. */\nexport const GOOGLE_ADS: ServiceDescriptor = {\n service: \"google_ads\",\n title: \"Google Ads\",\n sandbox: \"separate-account\",\n baseUrls: { ...GOOGLE_ADS_BASE_URLS },\n requires: [...GOOGLE_ADS_REQUIRES],\n authorize: googleAdsAuthorize,\n faker: googleAdsFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/customer-list-accessible.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/customer-list-accessible.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_ads\n */\n\n/**\n * List Google Ads customer resource names directly accessible to the\n * authenticated user. Manager-linked client accounts are not included; query\n * the account hierarchy after choosing a directly accessible manager.\n *\n * GET /v25/customers:listAccessibleCustomers —\n * https://developers.google.com/google-ads/api/rest/reference/rest/v25/customers/listAccessibleCustomers\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Ads or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_ADS } from \"../service.js\";\n\nexport const CUSTOMER_LIST_ACCESSIBLE_OPERATION = \"customer_list_accessible\";\n\nexport type CustomerListAccessibleOptions = {\n /** The node's resolved config. Keys: . */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleAdsCustomerListAccessible(options: CustomerListAccessibleOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n return callConnector(GOOGLE_ADS, {\n operation: CUSTOMER_LIST_ACCESSIBLE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: \"/v25/customers:listAccessibleCustomers\",\n query: {},\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/ + triggers/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/ + triggers/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_ads\n */\n\n/**\n * Google Ads's node kinds with their TypeScript executors attached — for hosts\n * that EXECUTE on TS.\n *\n * The authoring surface in @particle-academy/google-ads-ui carries no\n * executor: the editor is React on every host, so a PHP or Python project\n * installs the ui package and never this one.\n */\n\nimport type { NodeExecutor, NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport {\n idempotencyKeyFor,\n NO_IDEMPOTENCY_KEY_WARNING,\n resolveConnection,\n triggerEvent,\n type RequestedMode,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_ADS } from \"./service.js\";\n\nimport {\n googleAdsCustomerListKind,\n} from \"@particle-academy/google-ads-ui\";\n\nimport { googleAdsCustomerListAccessible } from \"./actions/customer-list-accessible.js\";\n\nexport const googleAdsCustomerListExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await googleAdsCustomerListAccessible({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `google_ads customer_list_accessible ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\n/** The kinds a TypeScript host registers. */\nexport const GOOGLE_ADS_RUNNABLE_KINDS: NodeKindDefinition[] = [\n { ...googleAdsCustomerListKind, executor: googleAdsCustomerListExecutor },\n];\n"]}
@@ -0,0 +1,26 @@
1
+ import { NodeKindDefinition, NodeExecutor } from '@particle-academy/fancy-flow/engine';
2
+
3
+ /**
4
+ * GENERATED FILE — do not edit.
5
+ *
6
+ * Emitted from provider/actions/ + triggers/ by weaver's generator.
7
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
8
+ * being rejected, because it works until it silently does not. Fix
9
+ * provider/actions/ + triggers/ (or weaver's template/) and regenerate:
10
+ *
11
+ * npm run provider -- google_ads
12
+ */
13
+ /**
14
+ * Google Ads's node kinds with their TypeScript executors attached — for hosts
15
+ * that EXECUTE on TS.
16
+ *
17
+ * The authoring surface in @particle-academy/google-ads-ui carries no
18
+ * executor: the editor is React on every host, so a PHP or Python project
19
+ * installs the ui package and never this one.
20
+ */
21
+
22
+ declare const googleAdsCustomerListExecutor: NodeExecutor;
23
+ /** The kinds a TypeScript host registers. */
24
+ declare const GOOGLE_ADS_RUNNABLE_KINDS: NodeKindDefinition[];
25
+
26
+ export { GOOGLE_ADS_RUNNABLE_KINDS, googleAdsCustomerListExecutor };
package/dist/flow.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ import { NodeKindDefinition, NodeExecutor } from '@particle-academy/fancy-flow/engine';
2
+
3
+ /**
4
+ * GENERATED FILE — do not edit.
5
+ *
6
+ * Emitted from provider/actions/ + triggers/ by weaver's generator.
7
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
8
+ * being rejected, because it works until it silently does not. Fix
9
+ * provider/actions/ + triggers/ (or weaver's template/) and regenerate:
10
+ *
11
+ * npm run provider -- google_ads
12
+ */
13
+ /**
14
+ * Google Ads's node kinds with their TypeScript executors attached — for hosts
15
+ * that EXECUTE on TS.
16
+ *
17
+ * The authoring surface in @particle-academy/google-ads-ui carries no
18
+ * executor: the editor is React on every host, so a PHP or Python project
19
+ * installs the ui package and never this one.
20
+ */
21
+
22
+ declare const googleAdsCustomerListExecutor: NodeExecutor;
23
+ /** The kinds a TypeScript host registers. */
24
+ declare const GOOGLE_ADS_RUNNABLE_KINDS: NodeKindDefinition[];
25
+
26
+ export { GOOGLE_ADS_RUNNABLE_KINDS, googleAdsCustomerListExecutor };
package/dist/flow.js ADDED
@@ -0,0 +1,25 @@
1
+ import { googleAdsCustomerListAccessible } from './chunk-TDMIZIW5.js';
2
+ import '@particle-academy/fancy-connector-core';
3
+ import { googleAdsCustomerListKind } from '@particle-academy/google-ads-ui';
4
+
5
+ var googleAdsCustomerListExecutor = async (ctx) => {
6
+ const config = ctx.node.data?.config ?? {};
7
+ const result = await googleAdsCustomerListAccessible({
8
+ config,
9
+ input: ctx.inputs?.in
10
+ });
11
+ ctx.emit({
12
+ type: "log",
13
+ level: "info",
14
+ nodeId: ctx.node.id,
15
+ message: `google_ads customer_list_accessible ${result.data?.id} (${result.mode})`
16
+ });
17
+ return { __port: "out", value: result };
18
+ };
19
+ var GOOGLE_ADS_RUNNABLE_KINDS = [
20
+ { ...googleAdsCustomerListKind, executor: googleAdsCustomerListExecutor }
21
+ ];
22
+
23
+ export { GOOGLE_ADS_RUNNABLE_KINDS, googleAdsCustomerListExecutor };
24
+ //# sourceMappingURL=flow.js.map
25
+ //# sourceMappingURL=flow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/flow.ts"],"names":[],"mappings":";;;;AAoCO,IAAM,6BAAA,GAA8C,OAAO,GAAA,KAAQ;AACxE,EAAA,MAAM,MAAA,GAAW,GAAA,CAAI,IAAA,CAAK,IAAA,EAA+C,UAAU,EAAC;AAEpF,EAAA,MAAM,MAAA,GAAS,MAAM,+BAAA,CAAgC;AAAA,IACnD,MAAA;AAAA,IACA,KAAA,EAAO,IAAI,MAAA,EAAQ;AAAA,GACpB,CAAA;AAED,EAAA,GAAA,CAAI,IAAA,CAAK;AAAA,IACP,IAAA,EAAM,KAAA;AAAA,IACN,KAAA,EAAO,MAAA;AAAA,IACP,MAAA,EAAQ,IAAI,IAAA,CAAK,EAAA;AAAA,IACjB,SAAS,CAAA,oCAAA,EAAwC,MAAA,CAAO,MAA0B,EAAE,CAAA,EAAA,EAAK,OAAO,IAAI,CAAA,CAAA;AAAA,GACrG,CAAA;AAED,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,MAAA,EAAO;AACxC;AAGO,IAAM,yBAAA,GAAkD;AAAA,EAC7D,EAAE,GAAG,yBAAA,EAA2B,QAAA,EAAU,6BAAA;AAC5C","file":"flow.js","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/ + triggers/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/ + triggers/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_ads\n */\n\n/**\n * Google Ads's node kinds with their TypeScript executors attached — for hosts\n * that EXECUTE on TS.\n *\n * The authoring surface in @particle-academy/google-ads-ui carries no\n * executor: the editor is React on every host, so a PHP or Python project\n * installs the ui package and never this one.\n */\n\nimport type { NodeExecutor, NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport {\n idempotencyKeyFor,\n NO_IDEMPOTENCY_KEY_WARNING,\n resolveConnection,\n triggerEvent,\n type RequestedMode,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_ADS } from \"./service.js\";\n\nimport {\n googleAdsCustomerListKind,\n} from \"@particle-academy/google-ads-ui\";\n\nimport { googleAdsCustomerListAccessible } from \"./actions/customer-list-accessible.js\";\n\nexport const googleAdsCustomerListExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await googleAdsCustomerListAccessible({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `google_ads customer_list_accessible ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\n/** The kinds a TypeScript host registers. */\nexport const GOOGLE_ADS_RUNNABLE_KINDS: NodeKindDefinition[] = [\n { ...googleAdsCustomerListKind, executor: googleAdsCustomerListExecutor },\n];\n"]}
package/dist/index.cjs ADDED
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+
3
+ var fancyConnectorCore = require('@particle-academy/fancy-connector-core');
4
+
5
+ // src/faker.ts
6
+ function fakeCustomerListAccessible({ config, fake }) {
7
+ return {
8
+ "resourceNames": [
9
+ "customers/1234567890",
10
+ "customers/9876543210"
11
+ ]
12
+ };
13
+ }
14
+ var googleAdsFaker = (operation, request) => {
15
+ switch (operation) {
16
+ case "customer_list_accessible":
17
+ return fakeCustomerListAccessible(request);
18
+ default:
19
+ throw new Error(
20
+ `google_ads: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
21
+ );
22
+ }
23
+ };
24
+
25
+ // src/service.ts
26
+ var CONNECTOR_API_VERSION = 1;
27
+ var GOOGLE_ADS_BASE_URLS = {
28
+ "live": "https://googleads.googleapis.com",
29
+ "sandbox": "https://googleads.googleapis.com"
30
+ };
31
+ var GOOGLE_ADS_REQUIRES = [
32
+ "accessToken",
33
+ "refreshToken",
34
+ "clientId",
35
+ "clientSecret",
36
+ "developerToken",
37
+ "loginCustomerId"
38
+ ];
39
+ function googleAdsAuthorize(credentials, request, _mode) {
40
+ request.headers.Authorization = `Bearer ${credentials.accessToken ?? ""}`;
41
+ request.headers["developer-token"] = String(credentials.developerToken ?? "");
42
+ if (credentials.loginCustomerId) {
43
+ request.headers["login-customer-id"] = String(credentials.loginCustomerId);
44
+ }
45
+ }
46
+ var GOOGLE_ADS = {
47
+ service: "google_ads",
48
+ title: "Google Ads",
49
+ sandbox: "separate-account",
50
+ baseUrls: { ...GOOGLE_ADS_BASE_URLS },
51
+ requires: [...GOOGLE_ADS_REQUIRES],
52
+ authorize: googleAdsAuthorize,
53
+ faker: googleAdsFaker
54
+ };
55
+ var CUSTOMER_LIST_ACCESSIBLE_OPERATION = "customer_list_accessible";
56
+ async function googleAdsCustomerListAccessible(options) {
57
+ const config = options.config ?? {};
58
+ return fancyConnectorCore.callConnector(GOOGLE_ADS, {
59
+ operation: CUSTOMER_LIST_ACCESSIBLE_OPERATION,
60
+ config,
61
+ input: options.input,
62
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
63
+ ...options.mode === void 0 ? {} : { mode: options.mode },
64
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
65
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
66
+ ...options.transport === void 0 ? {} : { transport: options.transport },
67
+ request: {
68
+ method: "GET",
69
+ path: "/v25/customers:listAccessibleCustomers",
70
+ query: {}
71
+ }
72
+ });
73
+ }
74
+
75
+ exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
76
+ exports.CUSTOMER_LIST_ACCESSIBLE_OPERATION = CUSTOMER_LIST_ACCESSIBLE_OPERATION;
77
+ exports.GOOGLE_ADS = GOOGLE_ADS;
78
+ exports.GOOGLE_ADS_BASE_URLS = GOOGLE_ADS_BASE_URLS;
79
+ exports.GOOGLE_ADS_REQUIRES = GOOGLE_ADS_REQUIRES;
80
+ exports.googleAdsAuthorize = googleAdsAuthorize;
81
+ exports.googleAdsCustomerListAccessible = googleAdsCustomerListAccessible;
82
+ exports.googleAdsFaker = googleAdsFaker;
83
+ //# sourceMappingURL=index.cjs.map
84
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/customer-list-accessible.ts"],"names":["callConnector"],"mappings":";;;;;AAyBA,SAAS,0BAAA,CAA2B,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC1E,EAAA,OAAO;AAAA,IACL,eAAA,EAAiB;AAAA,MACf,sBAAA;AAAA,MACA;AAAA;AACF,GACF;AACF;AAEO,IAAM,cAAA,GAAiC,CAAC,SAAA,EAAW,OAAA,KAAY;AACpE,EAAA,QAAQ,SAAA;AAAW,IACjB,KAAK,0BAAA;AACH,MAAA,OAAO,2BAA2B,OAAO,CAAA;AAAA,IAE3C;AAIE,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,gDAAgD,SAAS,CAAA,iJAAA;AAAA,OAG3D;AAA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EAAC,GAAI,EAAE,WAAA,EAAa,OAAA,CAAQ,WAAA,EAAY;AAAA,IAChF,GAAI,QAAQ,IAAA,KAAS,MAAA,GAAY,EAAC,GAAI,EAAE,IAAA,EAAM,OAAA,CAAQ,IAAA,EAAK;AAAA,IAC3D,GAAI,QAAQ,YAAA,KAAiB,MAAA,GAAY,EAAC,GAAI,EAAE,YAAA,EAAc,OAAA,CAAQ,YAAA,EAAa;AAAA,IACnF,GAAI,QAAQ,QAAA,KAAa,MAAA,GAAY,EAAC,GAAI,EAAE,QAAA,EAAU,OAAA,CAAQ,QAAA,EAAS;AAAA,IACvE,GAAI,QAAQ,SAAA,KAAc,MAAA,GAAY,EAAC,GAAI,EAAE,SAAA,EAAW,OAAA,CAAQ,SAAA,EAAU;AAAA,IAC1E,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ,KAAA;AAAA,MACR,IAAA,EAAM,wCAAA;AAAA,MACN,OAAO;AAAC;AACV,GACD,CAAA;AACH","file":"index.cjs","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_ads\n */\n\n/**\n * The Google Ads faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Google Ads actually publishes, so an author can wire {{ $json.data.id\n * }} against a fake and have it keep working against the real thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakeCustomerListAccessible({ config, fake }: FakeRequest): unknown {\n return {\n \"resourceNames\": [\n \"customers/1234567890\",\n \"customers/9876543210\",\n ],\n };\n}\n\nexport const googleAdsFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"customer_list_accessible\":\n return fakeCustomerListAccessible(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `google_ads: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_ads\n */\n\n/**\n * Google Ads, as one service descriptor shared by every Google Ads operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Google Ads: its base URL, its auth\n * scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Use a dedicated Google Ads test manager and test client account. Test and\n * production hierarchies cannot interact; test ads never serve or incur cost,\n * but some features such as billing, conversion uploads and serving reports\n * cannot be exercised there.\n */\n\nimport type { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { googleAdsFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const GOOGLE_ADS_BASE_URLS = {\n \"live\": \"https://googleads.googleapis.com\",\n \"sandbox\": \"https://googleads.googleapis.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const GOOGLE_ADS_REQUIRES = [\n \"accessToken\",\n \"refreshToken\",\n \"clientId\",\n \"clientSecret\",\n \"developerToken\",\n \"loginCustomerId\"\n] as const;\n\n/**\n * Apply Google Ads's auth scheme to an outgoing request.\n *\n * Google Ads requires the OAuth bearer AND the developer-token header on\n * ordinary calls. developerToken identifies the installed API application;\n * loginCustomerId selects the manager account only when access to a client is\n * through that manager. An absent optional manager id omits the header rather\n * than sending it empty.\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function googleAdsAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n\n request.headers[\"developer-token\"] = String(credentials.developerToken ?? \"\");\n if (credentials.loginCustomerId) {\n request.headers[\"login-customer-id\"] = String(credentials.loginCustomerId);\n }\n}\n\n/** The Google Ads service, for the TypeScript runtime. */\nexport const GOOGLE_ADS: ServiceDescriptor = {\n service: \"google_ads\",\n title: \"Google Ads\",\n sandbox: \"separate-account\",\n baseUrls: { ...GOOGLE_ADS_BASE_URLS },\n requires: [...GOOGLE_ADS_REQUIRES],\n authorize: googleAdsAuthorize,\n faker: googleAdsFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/customer-list-accessible.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/customer-list-accessible.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_ads\n */\n\n/**\n * List Google Ads customer resource names directly accessible to the\n * authenticated user. Manager-linked client accounts are not included; query\n * the account hierarchy after choosing a directly accessible manager.\n *\n * GET /v25/customers:listAccessibleCustomers —\n * https://developers.google.com/google-ads/api/rest/reference/rest/v25/customers/listAccessibleCustomers\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Ads or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_ADS } from \"../service.js\";\n\nexport const CUSTOMER_LIST_ACCESSIBLE_OPERATION = \"customer_list_accessible\";\n\nexport type CustomerListAccessibleOptions = {\n /** The node's resolved config. Keys: . */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleAdsCustomerListAccessible(options: CustomerListAccessibleOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n return callConnector(GOOGLE_ADS, {\n operation: CUSTOMER_LIST_ACCESSIBLE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: \"/v25/customers:listAccessibleCustomers\",\n query: {},\n },\n });\n}\n"]}
@@ -0,0 +1,121 @@
1
+ import { ServiceDescriptor, PreparedRequest, ConnectorMode, ConnectorFaker, RequestedMode, Transport, ConnectorResult } from '@particle-academy/fancy-connector-core';
2
+
3
+ /**
4
+ * GENERATED FILE — do not edit.
5
+ *
6
+ * Emitted from provider/manifest.json by weaver's generator.
7
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
8
+ * being rejected, because it works until it silently does not. Fix
9
+ * provider/manifest.json (or weaver's template/) and regenerate:
10
+ *
11
+ * npm run provider -- google_ads
12
+ */
13
+ /**
14
+ * Google Ads, as one service descriptor shared by every Google Ads operation.
15
+ *
16
+ * @particle-academy/fancy-connector-core carries what is true of ALL
17
+ * connectors. This carries what is true of Google Ads: its base URL, its auth
18
+ * scheme, its idempotency header, and its faker.
19
+ *
20
+ * ## The sandbox trap, written down where it is used
21
+ *
22
+ * Use a dedicated Google Ads test manager and test client account. Test and
23
+ * production hierarchies cannot interact; test ads never serve or incur cost,
24
+ * but some features such as billing, conversion uploads and serving reports
25
+ * cannot be exercised there.
26
+ */
27
+
28
+ /**
29
+ * The connector API version this package was GENERATED against.
30
+ *
31
+ * A literal, never imported. An imported constant lets an upgrade rewrite the
32
+ * very claim it exists to detect, after which the copy agrees with itself
33
+ * forever.
34
+ */
35
+ declare const CONNECTOR_API_VERSION = 1;
36
+ declare const GOOGLE_ADS_BASE_URLS: {
37
+ readonly live: "https://googleads.googleapis.com";
38
+ readonly sandbox: "https://googleads.googleapis.com";
39
+ };
40
+ /** Credential keys a remote call cannot proceed without. */
41
+ declare const GOOGLE_ADS_REQUIRES: readonly ["accessToken", "refreshToken", "clientId", "clientSecret", "developerToken", "loginCustomerId"];
42
+ /**
43
+ * Apply Google Ads's auth scheme to an outgoing request.
44
+ *
45
+ * Google Ads requires the OAuth bearer AND the developer-token header on
46
+ * ordinary calls. developerToken identifies the installed API application;
47
+ * loginCustomerId selects the manager account only when access to a client is
48
+ * through that manager. An absent optional manager id omits the header rather
49
+ * than sending it empty.
50
+ *
51
+ * The mode is passed in because for some providers auth and estate are the
52
+ * same decision expressed in the URL; here it is unused, and saying so is
53
+ * cheaper than wondering later whether it was forgotten.
54
+ */
55
+ declare function googleAdsAuthorize(credentials: Record<string, string | undefined>, request: PreparedRequest, _mode: ConnectorMode): void;
56
+ /** The Google Ads service, for the TypeScript runtime. */
57
+ declare const GOOGLE_ADS: ServiceDescriptor;
58
+
59
+ /**
60
+ * GENERATED FILE — do not edit.
61
+ *
62
+ * Emitted from provider/fixtures/ by weaver's generator.
63
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
64
+ * being rejected, because it works until it silently does not. Fix
65
+ * provider/fixtures/ (or weaver's template/) and regenerate:
66
+ *
67
+ * npm run provider -- google_ads
68
+ */
69
+ /**
70
+ * The Google Ads faker.
71
+ *
72
+ * Shapes, not behaviour: the goal is that a downstream node sees the field
73
+ * NAMES Google Ads actually publishes, so an author can wire {{ $json.data.id
74
+ * }} against a fake and have it keep working against the real thing.
75
+ *
76
+ * Deterministic — same inputs, same output. A faker returning a fresh uuid
77
+ * every call cannot be asserted on, so its fixtures degrade to "it did not
78
+ * throw", which is the assertion that catches nothing.
79
+ */
80
+
81
+ declare const googleAdsFaker: ConnectorFaker;
82
+
83
+ /**
84
+ * GENERATED FILE — do not edit.
85
+ *
86
+ * Emitted from provider/actions/customer-list-accessible.json by weaver's generator.
87
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
88
+ * being rejected, because it works until it silently does not. Fix
89
+ * provider/actions/customer-list-accessible.json (or weaver's template/) and regenerate:
90
+ *
91
+ * npm run provider -- google_ads
92
+ */
93
+ /**
94
+ * List Google Ads customer resource names directly accessible to the
95
+ * authenticated user. Manager-linked client accounts are not included; query
96
+ * the account hierarchy after choosing a directly accessible manager.
97
+ *
98
+ * GET /v25/customers:listAccessibleCustomers —
99
+ * https://developers.google.com/google-ads/api/rest/reference/rest/v25/customers/listAccessibleCustomers
100
+ *
101
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
102
+ * no fake/real branch. This describes the request; callConnector resolves the
103
+ * connection, picks the estate, and either calls Google Ads or calls the
104
+ * faker.
105
+ */
106
+
107
+ declare const CUSTOMER_LIST_ACCESSIBLE_OPERATION = "customer_list_accessible";
108
+ type CustomerListAccessibleOptions = {
109
+ /** The node's resolved config. Keys: . */
110
+ config: Record<string, unknown>;
111
+ credentials?: Record<string, string | undefined>;
112
+ mode?: RequestedMode;
113
+ connectionId?: string | null;
114
+ input?: unknown;
115
+ attempts?: number;
116
+ /** Override the transport. The only way to exercise this without a network. */
117
+ transport?: Transport;
118
+ };
119
+ declare function googleAdsCustomerListAccessible(options: CustomerListAccessibleOptions): Promise<ConnectorResult>;
120
+
121
+ export { CONNECTOR_API_VERSION, CUSTOMER_LIST_ACCESSIBLE_OPERATION, type CustomerListAccessibleOptions, GOOGLE_ADS, GOOGLE_ADS_BASE_URLS, GOOGLE_ADS_REQUIRES, googleAdsAuthorize, googleAdsCustomerListAccessible, googleAdsFaker };
@@ -0,0 +1,121 @@
1
+ import { ServiceDescriptor, PreparedRequest, ConnectorMode, ConnectorFaker, RequestedMode, Transport, ConnectorResult } from '@particle-academy/fancy-connector-core';
2
+
3
+ /**
4
+ * GENERATED FILE — do not edit.
5
+ *
6
+ * Emitted from provider/manifest.json by weaver's generator.
7
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
8
+ * being rejected, because it works until it silently does not. Fix
9
+ * provider/manifest.json (or weaver's template/) and regenerate:
10
+ *
11
+ * npm run provider -- google_ads
12
+ */
13
+ /**
14
+ * Google Ads, as one service descriptor shared by every Google Ads operation.
15
+ *
16
+ * @particle-academy/fancy-connector-core carries what is true of ALL
17
+ * connectors. This carries what is true of Google Ads: its base URL, its auth
18
+ * scheme, its idempotency header, and its faker.
19
+ *
20
+ * ## The sandbox trap, written down where it is used
21
+ *
22
+ * Use a dedicated Google Ads test manager and test client account. Test and
23
+ * production hierarchies cannot interact; test ads never serve or incur cost,
24
+ * but some features such as billing, conversion uploads and serving reports
25
+ * cannot be exercised there.
26
+ */
27
+
28
+ /**
29
+ * The connector API version this package was GENERATED against.
30
+ *
31
+ * A literal, never imported. An imported constant lets an upgrade rewrite the
32
+ * very claim it exists to detect, after which the copy agrees with itself
33
+ * forever.
34
+ */
35
+ declare const CONNECTOR_API_VERSION = 1;
36
+ declare const GOOGLE_ADS_BASE_URLS: {
37
+ readonly live: "https://googleads.googleapis.com";
38
+ readonly sandbox: "https://googleads.googleapis.com";
39
+ };
40
+ /** Credential keys a remote call cannot proceed without. */
41
+ declare const GOOGLE_ADS_REQUIRES: readonly ["accessToken", "refreshToken", "clientId", "clientSecret", "developerToken", "loginCustomerId"];
42
+ /**
43
+ * Apply Google Ads's auth scheme to an outgoing request.
44
+ *
45
+ * Google Ads requires the OAuth bearer AND the developer-token header on
46
+ * ordinary calls. developerToken identifies the installed API application;
47
+ * loginCustomerId selects the manager account only when access to a client is
48
+ * through that manager. An absent optional manager id omits the header rather
49
+ * than sending it empty.
50
+ *
51
+ * The mode is passed in because for some providers auth and estate are the
52
+ * same decision expressed in the URL; here it is unused, and saying so is
53
+ * cheaper than wondering later whether it was forgotten.
54
+ */
55
+ declare function googleAdsAuthorize(credentials: Record<string, string | undefined>, request: PreparedRequest, _mode: ConnectorMode): void;
56
+ /** The Google Ads service, for the TypeScript runtime. */
57
+ declare const GOOGLE_ADS: ServiceDescriptor;
58
+
59
+ /**
60
+ * GENERATED FILE — do not edit.
61
+ *
62
+ * Emitted from provider/fixtures/ by weaver's generator.
63
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
64
+ * being rejected, because it works until it silently does not. Fix
65
+ * provider/fixtures/ (or weaver's template/) and regenerate:
66
+ *
67
+ * npm run provider -- google_ads
68
+ */
69
+ /**
70
+ * The Google Ads faker.
71
+ *
72
+ * Shapes, not behaviour: the goal is that a downstream node sees the field
73
+ * NAMES Google Ads actually publishes, so an author can wire {{ $json.data.id
74
+ * }} against a fake and have it keep working against the real thing.
75
+ *
76
+ * Deterministic — same inputs, same output. A faker returning a fresh uuid
77
+ * every call cannot be asserted on, so its fixtures degrade to "it did not
78
+ * throw", which is the assertion that catches nothing.
79
+ */
80
+
81
+ declare const googleAdsFaker: ConnectorFaker;
82
+
83
+ /**
84
+ * GENERATED FILE — do not edit.
85
+ *
86
+ * Emitted from provider/actions/customer-list-accessible.json by weaver's generator.
87
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
88
+ * being rejected, because it works until it silently does not. Fix
89
+ * provider/actions/customer-list-accessible.json (or weaver's template/) and regenerate:
90
+ *
91
+ * npm run provider -- google_ads
92
+ */
93
+ /**
94
+ * List Google Ads customer resource names directly accessible to the
95
+ * authenticated user. Manager-linked client accounts are not included; query
96
+ * the account hierarchy after choosing a directly accessible manager.
97
+ *
98
+ * GET /v25/customers:listAccessibleCustomers —
99
+ * https://developers.google.com/google-ads/api/rest/reference/rest/v25/customers/listAccessibleCustomers
100
+ *
101
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
102
+ * no fake/real branch. This describes the request; callConnector resolves the
103
+ * connection, picks the estate, and either calls Google Ads or calls the
104
+ * faker.
105
+ */
106
+
107
+ declare const CUSTOMER_LIST_ACCESSIBLE_OPERATION = "customer_list_accessible";
108
+ type CustomerListAccessibleOptions = {
109
+ /** The node's resolved config. Keys: . */
110
+ config: Record<string, unknown>;
111
+ credentials?: Record<string, string | undefined>;
112
+ mode?: RequestedMode;
113
+ connectionId?: string | null;
114
+ input?: unknown;
115
+ attempts?: number;
116
+ /** Override the transport. The only way to exercise this without a network. */
117
+ transport?: Transport;
118
+ };
119
+ declare function googleAdsCustomerListAccessible(options: CustomerListAccessibleOptions): Promise<ConnectorResult>;
120
+
121
+ export { CONNECTOR_API_VERSION, CUSTOMER_LIST_ACCESSIBLE_OPERATION, type CustomerListAccessibleOptions, GOOGLE_ADS, GOOGLE_ADS_BASE_URLS, GOOGLE_ADS_REQUIRES, googleAdsAuthorize, googleAdsCustomerListAccessible, googleAdsFaker };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { CONNECTOR_API_VERSION, CUSTOMER_LIST_ACCESSIBLE_OPERATION, GOOGLE_ADS, GOOGLE_ADS_BASE_URLS, GOOGLE_ADS_REQUIRES, googleAdsAuthorize, googleAdsCustomerListAccessible, googleAdsFaker } from './chunk-TDMIZIW5.js';
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
package/package.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "@particle-academy/google-ads-js",
3
+ "version": "0.1.0",
4
+ "description": "Google Ads for Node — the service descriptor, its faker, its webhook verification, and one function per operation. Plain HTTP on @particle-academy/fancy-connector-core; no vendor SDK.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/Fancy-Friends/google-ads.git"
8
+ },
9
+ "homepage": "https://github.com/Fancy-Friends/google-ads#readme",
10
+ "bugs": "https://github.com/Fancy-Friends/google-ads/issues",
11
+ "type": "module",
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "import": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ },
21
+ "require": {
22
+ "types": "./dist/index.d.cts",
23
+ "default": "./dist/index.cjs"
24
+ }
25
+ },
26
+ "./flow": {
27
+ "import": {
28
+ "types": "./dist/flow.d.ts",
29
+ "default": "./dist/flow.js"
30
+ },
31
+ "require": {
32
+ "types": "./dist/flow.d.cts",
33
+ "default": "./dist/flow.cjs"
34
+ }
35
+ },
36
+ "./package.json": "./package.json"
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "README.md",
41
+ "CHANGELOG.md",
42
+ "LICENSE"
43
+ ],
44
+ "scripts": {
45
+ "build": "tsup",
46
+ "lint": "tsc --noEmit",
47
+ "test": "node --import tsx --test tests/*.test.ts",
48
+ "prepublishOnly": "tsup"
49
+ },
50
+ "dependencies": {
51
+ "@particle-academy/fancy-connector-core": ">=0.3.1 <2.0"
52
+ },
53
+ "peerDependencies": {
54
+ "@particle-academy/fancy-flow": ">=0.47.1 <2.0",
55
+ "@particle-academy/google-ads-ui": ">=0.1.0 <0.2.0"
56
+ },
57
+ "peerDependenciesMeta": {
58
+ "@particle-academy/fancy-flow": {
59
+ "optional": true
60
+ },
61
+ "@particle-academy/google-ads-ui": {
62
+ "optional": true
63
+ }
64
+ },
65
+ "devDependencies": {
66
+ "@particle-academy/fancy-flow": ">=0.47.1 <2.0",
67
+ "@types/node": "^26.2.0",
68
+ "tsup": "^8.5.0",
69
+ "tsx": "^4.19.0",
70
+ "typescript": "^5.8.0"
71
+ },
72
+ "publishConfig": {
73
+ "access": "public"
74
+ },
75
+ "keywords": [
76
+ "google_ads",
77
+ "marketing",
78
+ "connector",
79
+ "api",
80
+ "fancy-ui",
81
+ "particle-academy"
82
+ ],
83
+ "license": "MIT",
84
+ "sideEffects": false,
85
+ "engines": {
86
+ "node": ">=22"
87
+ }
88
+ }