{"_id":"@anthnyalxndr/gtm-client","_rev":"2-73024a2ad5cf9a6636d656288f046bd7","name":"@anthnyalxndr/gtm-client","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@anthnyalxndr/gtm-client","version":"1.0.0","keywords":["google-tag-manager","gtm","tagmanager","oauth"],"license":"Apache-2.0","_id":"@anthnyalxndr/gtm-client@1.0.0","maintainers":[{"name":"anthnyalxndr","email":"avail-fetes.43@icloud.com"}],"homepage":"https://github.com/anthnyalxndr/gtm_v2#readme","bugs":{"url":"https://github.com/anthnyalxndr/gtm_v2/issues"},"dist":{"shasum":"e19ff82f9ec131b8595c2382fc36a0b881c424d5","tarball":"https://registry.npmjs.org/@anthnyalxndr/gtm-client/-/gtm-client-1.0.0.tgz","fileCount":31,"integrity":"sha512-VLrB777y88jKIvfk12ZVhvMN6yTlk+ZAtEg53SYRG+bWdqjLdC2riiT3KNk729DqMfQ/GXsb51jPf6DkqI+rtw==","signatures":[{"sig":"MEUCIQCySGwg0a0kzD0G5lzFxT1xrtKnjYeW27L9HrKGL5Ub6wIgOcczQvVXv4koToq2WsIGw+LrWpsWhu75/LE6Uk9wu5k=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":76350},"main":"dist/index.js","type":"module","_from":"file:anthnyalxndr-gtm-client-1.0.0.tgz","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./testing":{"types":"./dist/testing.d.ts","import":"./dist/testing.js","default":"./dist/testing.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.test.json"},"_npmUser":{"name":"anthnyalxndr","email":"avail-fetes.43@icloud.com"},"_resolved":"/private/var/folders/r6/j2vfy3g508394ff38b2n9n_00000gn/T/40fbd5e1374b234992d8bba1bf2f883e/anthnyalxndr-gtm-client-1.0.0.tgz","_integrity":"sha512-VLrB777y88jKIvfk12ZVhvMN6yTlk+ZAtEg53SYRG+bWdqjLdC2riiT3KNk729DqMfQ/GXsb51jPf6DkqI+rtw==","repository":{"url":"git+https://github.com/anthnyalxndr/gtm_v2.git","type":"git","directory":"packages/gtm-client"},"_npmVersion":"11.4.2","description":"Authenticated, throttled Google Tag Manager API v2 client: OAuth with a shared credential directory, retry with backoff, and typed helpers for accounts and containers.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"open":"^11.0.2","google-auth-library":"^10.5.0","@googleapis/tagmanager":"^16.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/gtm-client_1.0.0_1789066551975_0.5167537805153974","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"_id":"@anthnyalxndr/gtm-client@1.1.0","bugs":{"url":"https://github.com/anthnyalxndr/gtm_v2/issues"},"dist":{"shasum":"15e6b8fb3db51b00f40b06b93cdb676a32c14d0b","tarball":"https://registry.npmjs.org/@anthnyalxndr/gtm-client/-/gtm-client-1.1.0.tgz","fileCount":31,"integrity":"sha512-dikBSiP3uVFKtyYsnDTHigVE/oUSWhV/X1vxBcfVMtSd95Q/uKeliVbQRf5zXWrfN1AJSuni6PfHIgWuCmdsmg==","signatures":[{"sig":"MEYCIQC/LFVX8cvOM4kRX7UkXSVJN7LztGGZTAoIvTiVPlcJRQIhALALVYWo3jj0KMdsNq4LdmodZXlnKPbV9AsX8ymeeujr","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICGXa3afnNZR6FfPBE8UcS5uyKMPJ26KS8zxLIKJjFsuAiEA2uABNFqwj3atrGp0ZLlHnn91zhMWK93b2hffWLURKuM="}],"unpackedSize":86156},"main":"dist/index.js","name":"@anthnyalxndr/gtm-client","type":"module","_from":"file:anthnyalxndr-gtm-client-1.1.0.tgz","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./testing":{"types":"./dist/testing.d.ts","import":"./dist/testing.js","default":"./dist/testing.js"}},"license":"Apache-2.0","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.test.json"},"version":"1.1.0","_npmUser":{"name":"anthnyalxndr","email":"avail-fetes.43@icloud.com"},"homepage":"https://github.com/anthnyalxndr/gtm_v2#readme","keywords":["google-tag-manager","gtm","tagmanager","oauth"],"_resolved":"/private/var/folders/r6/j2vfy3g508394ff38b2n9n_00000gn/T/25fb49120c885590ba905ee0c7f79689/anthnyalxndr-gtm-client-1.1.0.tgz","_integrity":"sha512-dikBSiP3uVFKtyYsnDTHigVE/oUSWhV/X1vxBcfVMtSd95Q/uKeliVbQRf5zXWrfN1AJSuni6PfHIgWuCmdsmg==","repository":{"url":"git+https://github.com/anthnyalxndr/gtm_v2.git","type":"git","directory":"packages/gtm-client"},"_npmVersion":"11.4.2","description":"Authenticated, throttled Google Tag Manager API v2 client: OAuth with a shared credential directory, retry with backoff, and typed helpers for accounts and containers.","directories":{},"maintainers":[{"name":"anthnyalxndr","email":"avail-fetes.43@icloud.com"}],"_nodeVersion":"22.16.0","dependencies":{"open":"^11.0.2","google-auth-library":"^10.5.0","@googleapis/tagmanager":"^16.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/gtm-client_1.1.0_1789141292837_0.6061649216246525"}}},"time":{"created":"2026-09-10T18:55:51.756Z","modified":"2026-09-11T15:41:33.063Z","1.0.0":"2026-09-10T18:55:52.126Z","1.1.0":"2026-09-11T15:41:32.918Z"},"bugs":{"url":"https://github.com/anthnyalxndr/gtm_v2/issues"},"license":"Apache-2.0","homepage":"https://github.com/anthnyalxndr/gtm_v2#readme","keywords":["google-tag-manager","gtm","tagmanager","oauth"],"repository":{"url":"git+https://github.com/anthnyalxndr/gtm_v2.git","type":"git","directory":"packages/gtm-client"},"description":"Authenticated, throttled Google Tag Manager API v2 client: OAuth with a shared credential directory, retry with backoff, and typed helpers for accounts and containers.","maintainers":[{"name":"anthnyalxndr","email":"avail-fetes.43@icloud.com"}],"readme":"# @anthnyalxndr/gtm-client\n\nAn authenticated, throttled client for the Google Tag Manager API v2, built on Google's per-API `@googleapis/tagmanager` package. Use it from any project that needs to call Tag Manager from TypeScript or Node.\n\n```bash\npnpm add @anthnyalxndr/gtm-client\n```\n\n## What it does\n\n- **OAuth once, everywhere.** Client secrets and the token live in `~/.config/gtm-apply/` (override with `GTM_APPLY_CONFIG_DIR`, or pass paths to the constructor). First run opens a browser and stores the token; every later run on the machine reuses it. A revoked token produces an error that names the file to delete.\n- **Throttle and retry.** `client.call(fn)` serializes requests with a minimum gap and retries 429 and 5xx with backoff. Every helper goes through it.\n- **The raw service.** `client.service` is the generated `tagmanager_v2.Tagmanager` instance for anything not wrapped.\n- **Typed helpers.** `listAccounts`, `resolveContainer` (find a container by its `GTM-XXXXXXX` public id across every account you can see), `createContainer`.\n- **A fake for tests.** `@anthnyalxndr/gtm-client/testing` exports `createFakeService`, an in-memory implementation of the API surface with workspace, version, and fingerprint semantics, so code built on the client can be tested without credentials.\n\n## Usage\n\n```ts\nimport { GtmClient, listAccounts, resolveContainer } from \"@anthnyalxndr/gtm-client\";\n\nconst client = new GtmClient();\nawait client.init();\n\nfor (const account of await listAccounts(client)) {\n  console.log(account.accountId, account.name);\n}\n\nconst ref = await resolveContainer(client, \"GTM-XXXXXXX\");\nconst tags = await client.call(() =>\n  client.service.accounts.containers.workspaces.tags.list({\n    parent: `${ref.path}/workspaces/1`,\n  })\n);\n```\n\n## Testing with the fake\n\n```ts\nimport { GtmClient } from \"@anthnyalxndr/gtm-client\";\nimport { createFakeService } from \"@anthnyalxndr/gtm-client/testing\";\n\nconst { service, state } = createFakeService();\nconst client = new GtmClient({ service, minIntervalMs: 0 });\n// state.calls records every method invoked; state.versions holds snapshots.\n```\n\n## Credentials file\n\nCreate an OAuth client of type \"Desktop app\" in Google Cloud, download the JSON, and save it as `~/.config/gtm-apply/client_secrets.json`. The token is written next to it on first run.\n\n## License\n\nApache-2.0\n","readmeFilename":"README.md"}