@particle-academy/google-analytics-ui 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,55 @@ The four packages share one version, because they are generated from one
8
8
  `provider/` definition and a version that meant something different in each
9
9
  would be a version nobody could reason about.
10
10
 
11
+ ## [0.3.2] — 2026-09-06
12
+
13
+ ### Changed
14
+
15
+ - **Published through npm Trusted Publishing, so these packages now carry PROVENANCE.**
16
+
17
+ Every earlier release went out under a scope-wide npm token. This one is
18
+ published by an OIDC exchange from the release workflow itself, and npm records
19
+ which workflow in which repository built it.
20
+ `npm view @particle-academy/google-analytics-ui@0.3.2` shows the attestation; releases before
21
+ this one have none.
22
+
23
+ What it buys a consumer: the tarball on the registry can be tied to a public
24
+ commit and a public workflow run, rather than to whoever held a token. What it
25
+ does not buy: nothing about the code changed, and the runtime behaviour of all
26
+ four packages is identical to 0.3.1.
27
+
28
+ - **`repository.directory` in the npm packages.**
29
+
30
+ `@particle-academy/google-analytics-ui` and `@particle-academy/google-analytics-js` live at
31
+ `packages/ui` and `packages/js` inside the provider repo. npm's `repository`
32
+ field now says so, which makes the "Repository" link on each package page point
33
+ at the package rather than at the repository root.
34
+
35
+ ## [0.3.1] — 2026-08-24
36
+
37
+ ### Fixed
38
+
39
+ - **`@particle-academy/google-analytics-js` now accepts a RANGE of `@particle-academy/google-analytics-ui`, not one exact version.**
40
+
41
+ It peer-depended on `@particle-academy/google-analytics-ui` at exactly the release it shipped with. That is the
42
+ strict form of the thing the kit's own rule forbids — a first-party sibling gets
43
+ a range — and the same block applied the rule correctly to its other two
44
+ dependencies. It was this one pair that slipped.
45
+
46
+ What it cost: ship `@particle-academy/google-analytics-ui` with a fixed help string and every consumer on the
47
+ previous `@particle-academy/google-analytics-js` had an **unmet peer**, which npm 7+ errors on. A documentation
48
+ patch could not be delivered without a matching runtime release, and a routine
49
+ `npm update` that moved the ui package alone broke the install.
50
+
51
+ The coupling is real and is not being loosened away. The ui package emits the
52
+ config schema and the js package implements against it, so a ui that adds a
53
+ field to a js that ignores it is silently wrong. But a PATCH is non-additive by
54
+ definition and a MINOR is where a field can appear — so `>=0.3.1 <0.4.0` is the
55
+ coupling that actually exists rather than the strictest one expressible.
56
+
57
+ Nothing else changed. `particle-academy/google-analytics-php` and `fancy-google-analytics` are unaffected; neither has an
58
+ equivalent edge.
59
+
11
60
  ## [0.3.0] — 2026-08-24
12
61
 
13
62
  ### Added
@@ -117,3 +166,4 @@ that works against the fake and concatenates against the real thing.
117
166
  [0.1.0]: https://github.com/Fancy-Friends/google-analytics/releases/tag/v0.1.0
118
167
  [0.2.0]: https://github.com/Fancy-Friends/google-analytics/releases/tag/v0.2.0
119
168
  [0.3.0]: https://github.com/Fancy-Friends/google-analytics/releases/tag/v0.3.0
169
+ [0.3.1]: https://github.com/Fancy-Friends/google-analytics/releases/tag/v0.3.1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/service.ts","../src/kinds/report-run.ts","../src/index.ts"],"names":["defineConnectorKind","summarize"],"mappings":";;;;;AAkCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,wBAAA,GAA2B;AAAA,EACtC,OAAA,EAAS,kBAAA;AAAA,EACT,YAAA,EAAc,kBAAA;AAAA,EACd,MAAA,EAAQ,WAAA;AAAA,EACR,OAAA,EAAS;AACX;AAGO,IAAM,4BAAA,GAA+B;AAAA,EAC1C;AAAA,IACE,KAAA,EAAO,UAAA;AAAA,IACP,OAAA,EAAS,iBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,KAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,cAAA;AAAA,IACP,OAAA,EAAS,qBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAA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A,MACP,OAAA,EAAS,YAAA;AAAA,MACT,SAAA,EAAW,MAAA;AAAA,MACX,aAAA,EAAe;AAAA;AACjB,GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,UAAA,EAAY,CAAC,EAAE,MAAA,OACbC,oBAAA,CAAU,4BAAA,EAA8B,QAAmC,cAAc;AAC7F,CAAC;;;AClFM,IAAM,sBAAA,GAA+C;AAAA,EAC1D;AACF","file":"index.cjs","sourcesContent":["/**\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_analytics\n */\n\n/**\n * Google Analytics's identity on the authoring surface, shared by every Google\n * Analytics node.\n *\n * This file must import nothing from the js package: a PHP or Python project\n * installs the ui package and never that one, and the import would be a\n * dangling module the moment it did.\n *\n * ## The sandbox trap\n *\n * Google Analytics has no sandbox. A report reads a real property's real data\n * and spends real quota. The faker returns a plausibly-shaped report so a flow\n * can be built without a Google account.\n */\n\nimport type { ConnectorMeta } from \"@particle-academy/fancy-flow/connectors\";\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.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\n/** The parts of a connector's identity that belong to the SERVICE, not the node. */\nexport const GOOGLE_ANALYTICS_SERVICE = {\n service: \"google_analytics\",\n serviceTitle: \"Google Analytics\",\n domain: \"analytics\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/** The credentials a Google Analytics connection holds. */\nexport const GOOGLE_ANALYTICS_CREDENTIALS = [\n {\n \"key\": \"clientId\",\n \"label\": \"OAuth client ID\",\n \"scope\": \"provider\",\n \"secret\": false,\n \"help\": \"From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account.\"\n },\n {\n \"key\": \"clientSecret\",\n \"label\": \"OAuth client secret\",\n \"scope\": \"provider\",\n \"secret\": true,\n \"help\": \"The client secret for the same OAuth app. One value for the whole installation.\"\n },\n {\n \"key\": \"accessToken\",\n \"label\": \"Access token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.\"\n },\n {\n \"key\": \"refreshToken\",\n \"label\": \"Refresh token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account. Google issues one only when the consent request asks for offline access.\"\n }\n] as const;\n\n/**\n * The OAuth2 exchange Google Analytics requires — DECLARED here, performed by\n * the host.\n *\n * A consent screen needs a browser, a redirect URI and somewhere to persist\n * the result, and all three belong to the host; a package that ran the dance\n * itself would have to own a web server. So this says precisely enough for a\n * host to do it.\n *\n * The access token lasts 3600 seconds. A host that never refreshes will work\n * all afternoon and be broken by morning, which is why the lifetime is stated\n * rather than left to be discovered.\n *\n * Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may\n * safely be retried and may run concurrently. That is stated rather than\n * assumed because the opposite — a provider that spends the token and revokes\n * the grant on a replay — looks identical until it happens.\n */\nexport const GOOGLE_ANALYTICS_OAUTH = {\n \"flow\": \"authorization_code\",\n \"authorizeUrl\": \"https://accounts.google.com/o/oauth2/v2/auth\",\n \"tokenUrl\": \"https://oauth2.googleapis.com/token\",\n \"scopes\": [\n \"https://www.googleapis.com/auth/analytics.readonly\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"refreshTokenRotates\": false,\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a Google Analytics node's connector metadata from the operation it performs. */\nexport function googleAnalyticsMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_ANALYTICS_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/report-run.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/report-run.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_analytics\n */\n\n/**\n * Google Analytics report — Run a report against a Google Analytics 4\n * property.\n *\n * https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleAnalyticsMeta } from \"../service.js\";\n\nexport const GOOGLE_ANALYTICS_REPORT_KIND = \"@particle-academy/google_analytics_report\";\nexport const GOOGLE_ANALYTICS_REPORT_OPERATION = \"report_run\";\n\nexport const GOOGLE_ANALYTICS_REPORT_META = googleAnalyticsMeta(\"action\", \"run a report\", \"https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_ANALYTICS_REPORT_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.rows\",\n \"type\": \"array\",\n \"description\": \"One entry per combination of dimension values. Each carries dimensionValues and metricValues, in the order requested.\"\n },\n {\n \"path\": \"data.rowCount\",\n \"type\": \"number\",\n \"description\": \"Total rows matching the query, which can exceed the rows returned.\"\n },\n {\n \"path\": \"data.metricHeaders\",\n \"type\": \"array\",\n \"description\": \"The metrics in the order their values appear in each row -- the only thing that says which number is which.\"\n }\n];\n\nexport const googleAnalyticsReportKind: NodeKindDefinition = defineConnectorKind(GOOGLE_ANALYTICS_REPORT_META, {\n name: GOOGLE_ANALYTICS_REPORT_KIND,\n aliases: [\"google_analytics_report\"],\n label: \"Google Analytics report\",\n description: \"Run a report against a Google Analytics 4 property.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"none\",\n outputShape: GOOGLE_ANALYTICS_REPORT_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"property\",\n \"label\": \"Property\",\n \"required\": true,\n \"default\": \"properties/\",\n \"description\": \"The GA4 property, written as `properties/1234567890`. The numeric id alone is not accepted.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"startDate\",\n \"label\": \"Start date\",\n \"required\": true,\n \"default\": \"28daysAgo\",\n \"description\": \"YYYY-MM-DD, or a relative form Google accepts such as `28daysAgo`, `yesterday` or `today`.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"endDate\",\n \"label\": \"End date\",\n \"required\": true,\n \"default\": \"today\",\n \"description\": \"YYYY-MM-DD, or a relative form such as `today`.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"metrics\",\n \"label\": \"Metrics\",\n \"required\": true,\n \"default\": \"activeUsers,sessions\",\n \"description\": \"Metric names, comma separated. For example activeUsers, sessions, screenPageViews.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"dimensions\",\n \"label\": \"Dimensions\",\n \"default\": \"date\",\n \"description\": \"Dimension names, comma separated. For example date, country, pagePath. Leave empty for a single total row.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_ANALYTICS_REPORT_META, config as Record<string, unknown>, \"run a report\"),\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_analytics\n */\n\n/**\n * Google Analytics's node kinds for fancy-flow.\n *\n * Install this on every host. The TypeScript executors live in the js\n * package's `./flow` subpath; PHP and Python hosts run their own and need only\n * this.\n */\n\nexport * from \"./service.js\";\nexport * from \"./kinds/report-run.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleAnalyticsReportKind } from \"./kinds/report-run.js\";\n\n/** Every Google Analytics kind, for a host that registers the lot. */\nexport const GOOGLE_ANALYTICS_KINDS: NodeKindDefinition[] = [\n googleAnalyticsReportKind,\n];\n"]}
1
+ {"version":3,"sources":["../src/service.ts","../src/kinds/report-run.ts","../src/index.ts"],"names":["defineConnectorKind","summarize"],"mappings":";;;;;AAkCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,wBAAA,GAA2B;AAAA,EACtC,OAAA,EAAS,kBAAA;AAAA,EACT,YAAA,EAAc,kBAAA;AAAA,EACd,MAAA,EAAQ,WAAA;AAAA,EACR,OAAA,EAAS;AACX;AA+BO,IAAM,4BAAA,GAA+B;AAAA,EAC1C;AAAA,IACE,KAAA,EAAO,UAAA;AAAA,IACP,OAAA,EAAS,iBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,KAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,cAAA;AAAA,IACP,OAAA,EAAS,qBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,aAAA;AAAA,IACP,OAAA,EAAS,cAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,cAAA;AAAA,IACP,OAAA,EAAS,eAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA;AAEZ;AAoBO,IAAM,sBAAA,GAAyB;AAAA,EACpC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* 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_analytics\n */\n\n/**\n * Google Analytics's identity on the authoring surface, shared by every Google\n * Analytics node.\n *\n * This file must import nothing from the js package: a PHP or Python project\n * installs the ui package and never that one, and the import would be a\n * dangling module the moment it did.\n *\n * ## The sandbox trap\n *\n * Google Analytics has no sandbox. A report reads a real property's real data\n * and spends real quota. The faker returns a plausibly-shaped report so a flow\n * can be built without a Google account.\n */\n\nimport type { ConnectorDomain, ConnectorMeta } from \"@particle-academy/fancy-flow/connectors\";\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.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\n/** The parts of a connector's identity that belong to the SERVICE, not the node. */\nexport const GOOGLE_ANALYTICS_SERVICE = {\n service: \"google_analytics\",\n serviceTitle: \"Google Analytics\",\n domain: \"analytics\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/**\n * Every connector domain weaver knows, pinned against fancy-flow's union.\n *\n * A closed set copied into three codebases stays correct only while something\n * MAKES it: this line fails to compile the moment weaver carries a value\n * fancy-flow does not, including the values no provider uses yet.\n */\nconst WEAVER_DOMAINS: readonly ConnectorDomain[] = [\n \"payments\",\n \"commerce\",\n \"messaging\",\n \"email\",\n \"crm\",\n \"support\",\n \"storage\",\n \"calendar\",\n \"productivity\",\n \"database\",\n \"devtools\",\n \"analytics\",\n \"marketing\",\n \"ai\",\n \"forms\",\n \"hr\",\n \"geo\"\n];\nvoid WEAVER_DOMAINS;\n\n/** The credentials a Google Analytics connection holds. */\nexport const GOOGLE_ANALYTICS_CREDENTIALS = [\n {\n \"key\": \"clientId\",\n \"label\": \"OAuth client ID\",\n \"scope\": \"provider\",\n \"secret\": false,\n \"help\": \"From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account.\"\n },\n {\n \"key\": \"clientSecret\",\n \"label\": \"OAuth client secret\",\n \"scope\": \"provider\",\n \"secret\": true,\n \"help\": \"The client secret for the same OAuth app. One value for the whole installation.\"\n },\n {\n \"key\": \"accessToken\",\n \"label\": \"Access token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.\"\n },\n {\n \"key\": \"refreshToken\",\n \"label\": \"Refresh token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account. Google issues one only when the consent request asks for offline access.\"\n }\n] as const;\n\n/**\n * The OAuth2 exchange Google Analytics requires — DECLARED here, performed by\n * the host.\n *\n * A consent screen needs a browser, a redirect URI and somewhere to persist\n * the result, and all three belong to the host; a package that ran the dance\n * itself would have to own a web server. So this says precisely enough for a\n * host to do it.\n *\n * The access token lasts 3600 seconds. A host that never refreshes will work\n * all afternoon and be broken by morning, which is why the lifetime is stated\n * rather than left to be discovered.\n *\n * Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may\n * safely be retried and may run concurrently. That is stated rather than\n * assumed because the opposite — a provider that spends the token and revokes\n * the grant on a replay — looks identical until it happens.\n */\nexport const GOOGLE_ANALYTICS_OAUTH = {\n \"flow\": \"authorization_code\",\n \"authorizeUrl\": \"https://accounts.google.com/o/oauth2/v2/auth\",\n \"tokenUrl\": \"https://oauth2.googleapis.com/token\",\n \"scopes\": [\n \"https://www.googleapis.com/auth/analytics.readonly\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"refreshTokenRotates\": false,\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a Google Analytics node's connector metadata from the operation it performs. */\nexport function googleAnalyticsMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_ANALYTICS_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/report-run.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/report-run.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_analytics\n */\n\n/**\n * Google Analytics report — Run a report against a Google Analytics 4\n * property.\n *\n * https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleAnalyticsMeta } from \"../service.js\";\n\nexport const GOOGLE_ANALYTICS_REPORT_KIND = \"@particle-academy/google_analytics_report\";\nexport const GOOGLE_ANALYTICS_REPORT_OPERATION = \"report_run\";\n\nexport const GOOGLE_ANALYTICS_REPORT_META = googleAnalyticsMeta(\"action\", \"run a report\", \"https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_ANALYTICS_REPORT_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.rows\",\n \"type\": \"array\",\n \"description\": \"One entry per combination of dimension values. Each carries dimensionValues and metricValues, in the order requested.\"\n },\n {\n \"path\": \"data.rowCount\",\n \"type\": \"number\",\n \"description\": \"Total rows matching the query, which can exceed the rows returned.\"\n },\n {\n \"path\": \"data.metricHeaders\",\n \"type\": \"array\",\n \"description\": \"The metrics in the order their values appear in each row -- the only thing that says which number is which.\"\n }\n];\n\nexport const googleAnalyticsReportKind: NodeKindDefinition = defineConnectorKind(GOOGLE_ANALYTICS_REPORT_META, {\n name: GOOGLE_ANALYTICS_REPORT_KIND,\n aliases: [\"google_analytics_report\"],\n label: \"Google Analytics report\",\n description: \"Run a report against a Google Analytics 4 property.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"none\",\n outputShape: GOOGLE_ANALYTICS_REPORT_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"property\",\n \"label\": \"Property\",\n \"required\": true,\n \"default\": \"properties/\",\n \"description\": \"The GA4 property, written as `properties/1234567890`. The numeric id alone is not accepted.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"startDate\",\n \"label\": \"Start date\",\n \"required\": true,\n \"default\": \"28daysAgo\",\n \"description\": \"YYYY-MM-DD, or a relative form Google accepts such as `28daysAgo`, `yesterday` or `today`.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"endDate\",\n \"label\": \"End date\",\n \"required\": true,\n \"default\": \"today\",\n \"description\": \"YYYY-MM-DD, or a relative form such as `today`.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"metrics\",\n \"label\": \"Metrics\",\n \"required\": true,\n \"default\": \"activeUsers,sessions\",\n \"description\": \"Metric names, comma separated. For example activeUsers, sessions, screenPageViews.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"dimensions\",\n \"label\": \"Dimensions\",\n \"default\": \"date\",\n \"description\": \"Dimension names, comma separated. For example date, country, pagePath. Leave empty for a single total row.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_ANALYTICS_REPORT_META, config as Record<string, unknown>, \"run a report\"),\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_analytics\n */\n\n/**\n * Google Analytics's node kinds for fancy-flow.\n *\n * Install this on every host. The TypeScript executors live in the js\n * package's `./flow` subpath; PHP and Python hosts run their own and need only\n * this.\n */\n\nexport * from \"./service.js\";\nexport * from \"./kinds/report-run.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleAnalyticsReportKind } from \"./kinds/report-run.js\";\n\n/** Every Google Analytics kind, for a host that registers the lot. */\nexport const GOOGLE_ANALYTICS_KINDS: NodeKindDefinition[] = [\n googleAnalyticsReportKind,\n];\n"]}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/service.ts","../src/kinds/report-run.ts","../src/index.ts"],"names":[],"mappings":";;;AAkCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,wBAAA,GAA2B;AAAA,EACtC,OAAA,EAAS,kBAAA;AAAA,EACT,YAAA,EAAc,kBAAA;AAAA,EACd,MAAA,EAAQ,WAAA;AAAA,EACR,OAAA,EAAS;AACX;AAGO,IAAM,4BAAA,GAA+B;AAAA,EAC1C;AAAA,IACE,KAAA,EAAO,UAAA;AAAA,IACP,OAAA,EAAS,iBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,KAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,cAAA;AAAA,IACP,OAAA,EAAS,qBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,aAAA;AAAA,IACP,OAAA,EAAS,cAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,cAAA;AAAA,IACP,OAAA,EAAS,eAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA;AAEZ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Content":["/**\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_analytics\n */\n\n/**\n * Google Analytics's identity on the authoring surface, shared by every Google\n * Analytics node.\n *\n * This file must import nothing from the js package: a PHP or Python project\n * installs the ui package and never that one, and the import would be a\n * dangling module the moment it did.\n *\n * ## The sandbox trap\n *\n * Google Analytics has no sandbox. A report reads a real property's real data\n * and spends real quota. The faker returns a plausibly-shaped report so a flow\n * can be built without a Google account.\n */\n\nimport type { ConnectorMeta } from \"@particle-academy/fancy-flow/connectors\";\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.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\n/** The parts of a connector's identity that belong to the SERVICE, not the node. */\nexport const GOOGLE_ANALYTICS_SERVICE = {\n service: \"google_analytics\",\n serviceTitle: \"Google Analytics\",\n domain: \"analytics\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/** The credentials a Google Analytics connection holds. */\nexport const GOOGLE_ANALYTICS_CREDENTIALS = [\n {\n \"key\": \"clientId\",\n \"label\": \"OAuth client ID\",\n \"scope\": \"provider\",\n \"secret\": false,\n \"help\": \"From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account.\"\n },\n {\n \"key\": \"clientSecret\",\n \"label\": \"OAuth client secret\",\n \"scope\": \"provider\",\n \"secret\": true,\n \"help\": \"The client secret for the same OAuth app. One value for the whole installation.\"\n },\n {\n \"key\": \"accessToken\",\n \"label\": \"Access token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.\"\n },\n {\n \"key\": \"refreshToken\",\n \"label\": \"Refresh token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account. Google issues one only when the consent request asks for offline access.\"\n }\n] as const;\n\n/**\n * The OAuth2 exchange Google Analytics requires — DECLARED here, performed by\n * the host.\n *\n * A consent screen needs a browser, a redirect URI and somewhere to persist\n * the result, and all three belong to the host; a package that ran the dance\n * itself would have to own a web server. So this says precisely enough for a\n * host to do it.\n *\n * The access token lasts 3600 seconds. A host that never refreshes will work\n * all afternoon and be broken by morning, which is why the lifetime is stated\n * rather than left to be discovered.\n *\n * Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may\n * safely be retried and may run concurrently. That is stated rather than\n * assumed because the opposite — a provider that spends the token and revokes\n * the grant on a replay — looks identical until it happens.\n */\nexport const GOOGLE_ANALYTICS_OAUTH = {\n \"flow\": \"authorization_code\",\n \"authorizeUrl\": \"https://accounts.google.com/o/oauth2/v2/auth\",\n \"tokenUrl\": \"https://oauth2.googleapis.com/token\",\n \"scopes\": [\n \"https://www.googleapis.com/auth/analytics.readonly\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"refreshTokenRotates\": false,\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a Google Analytics node's connector metadata from the operation it performs. */\nexport function googleAnalyticsMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_ANALYTICS_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/report-run.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/report-run.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_analytics\n */\n\n/**\n * Google Analytics report — Run a report against a Google Analytics 4\n * property.\n *\n * https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleAnalyticsMeta } from \"../service.js\";\n\nexport const GOOGLE_ANALYTICS_REPORT_KIND = \"@particle-academy/google_analytics_report\";\nexport const GOOGLE_ANALYTICS_REPORT_OPERATION = \"report_run\";\n\nexport const GOOGLE_ANALYTICS_REPORT_META = googleAnalyticsMeta(\"action\", \"run a report\", \"https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_ANALYTICS_REPORT_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.rows\",\n \"type\": \"array\",\n \"description\": \"One entry per combination of dimension values. Each carries dimensionValues and metricValues, in the order requested.\"\n },\n {\n \"path\": \"data.rowCount\",\n \"type\": \"number\",\n \"description\": \"Total rows matching the query, which can exceed the rows returned.\"\n },\n {\n \"path\": \"data.metricHeaders\",\n \"type\": \"array\",\n \"description\": \"The metrics in the order their values appear in each row -- the only thing that says which number is which.\"\n }\n];\n\nexport const googleAnalyticsReportKind: NodeKindDefinition = defineConnectorKind(GOOGLE_ANALYTICS_REPORT_META, {\n name: GOOGLE_ANALYTICS_REPORT_KIND,\n aliases: [\"google_analytics_report\"],\n label: \"Google Analytics report\",\n description: \"Run a report against a Google Analytics 4 property.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"none\",\n outputShape: GOOGLE_ANALYTICS_REPORT_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"property\",\n \"label\": \"Property\",\n \"required\": true,\n \"default\": \"properties/\",\n \"description\": \"The GA4 property, written as `properties/1234567890`. The numeric id alone is not accepted.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"startDate\",\n \"label\": \"Start date\",\n \"required\": true,\n \"default\": \"28daysAgo\",\n \"description\": \"YYYY-MM-DD, or a relative form Google accepts such as `28daysAgo`, `yesterday` or `today`.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"endDate\",\n \"label\": \"End date\",\n \"required\": true,\n \"default\": \"today\",\n \"description\": \"YYYY-MM-DD, or a relative form such as `today`.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"metrics\",\n \"label\": \"Metrics\",\n \"required\": true,\n \"default\": \"activeUsers,sessions\",\n \"description\": \"Metric names, comma separated. For example activeUsers, sessions, screenPageViews.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"dimensions\",\n \"label\": \"Dimensions\",\n \"default\": \"date\",\n \"description\": \"Dimension names, comma separated. For example date, country, pagePath. Leave empty for a single total row.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_ANALYTICS_REPORT_META, config as Record<string, unknown>, \"run a report\"),\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_analytics\n */\n\n/**\n * Google Analytics's node kinds for fancy-flow.\n *\n * Install this on every host. The TypeScript executors live in the js\n * package's `./flow` subpath; PHP and Python hosts run their own and need only\n * this.\n */\n\nexport * from \"./service.js\";\nexport * from \"./kinds/report-run.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleAnalyticsReportKind } from \"./kinds/report-run.js\";\n\n/** Every Google Analytics kind, for a host that registers the lot. */\nexport const GOOGLE_ANALYTICS_KINDS: NodeKindDefinition[] = [\n googleAnalyticsReportKind,\n];\n"]}
1
+ {"version":3,"sources":["../src/service.ts","../src/kinds/report-run.ts","../src/index.ts"],"names":[],"mapp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,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,SAAA,EAAW,WAAA;AAAA,MACX,aAAA,EAAe;AAAA,KACjB;AAAA,IACA;AAAA,MACE,MAAA,EAAQ,MAAA;AAAA,MACR,KAAA,EAAO,SAAA;AAAA,MACP,OAAA,EAAS,UAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,SAAA,EAAW,OAAA;AAAA,MACX,aAAA,EAAe;AAAA,KACjB;AAAA,IACA;AAAA,MACE,MAAA,EAAQ,MAAA;AAAA,MACR,KAAA,EAAO,SAAA;AAAA,MACP,OAAA,EAAS,SAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,SAAA,EAAW,sBAAA;AAAA,MACX,aAAA,EAAe;AAAA,KACjB;AAAA,IACA;AAAA,MACE,MAAA,EAAQ,MAAA;AAAA,MACR,KAAA,EAAO,YAAA;AAAA,MACP,OAAA,EAAS,YAAA;AAAA,MACT,SAAA,EAAW,MAAA;AAAA,MACX,aAAA,EAAe;AAAA;AACjB,GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,UAAA,EAAY,CAAC,EAAE,MAAA,OACb,SAAA,CAAU,4BAAA,EAA8B,QAAmC,cAAc;AAC7F,CAAC;;;AClFM,IAAM,sBAAA,GAA+C;AAAA,EAC1D;AACF","file":"index.js","sourcesContent":["/**\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_analytics\n */\n\n/**\n * Google Analytics's identity on the authoring surface, shared by every Google\n * Analytics node.\n *\n * This file must import nothing from the js package: a PHP or Python project\n * installs the ui package and never that one, and the import would be a\n * dangling module the moment it did.\n *\n * ## The sandbox trap\n *\n * Google Analytics has no sandbox. A report reads a real property's real data\n * and spends real quota. The faker returns a plausibly-shaped report so a flow\n * can be built without a Google account.\n */\n\nimport type { ConnectorDomain, ConnectorMeta } from \"@particle-academy/fancy-flow/connectors\";\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.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\n/** The parts of a connector's identity that belong to the SERVICE, not the node. */\nexport const GOOGLE_ANALYTICS_SERVICE = {\n service: \"google_analytics\",\n serviceTitle: \"Google Analytics\",\n domain: \"analytics\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/**\n * Every connector domain weaver knows, pinned against fancy-flow's union.\n *\n * A closed set copied into three codebases stays correct only while something\n * MAKES it: this line fails to compile the moment weaver carries a value\n * fancy-flow does not, including the values no provider uses yet.\n */\nconst WEAVER_DOMAINS: readonly ConnectorDomain[] = [\n \"payments\",\n \"commerce\",\n \"messaging\",\n \"email\",\n \"crm\",\n \"support\",\n \"storage\",\n \"calendar\",\n \"productivity\",\n \"database\",\n \"devtools\",\n \"analytics\",\n \"marketing\",\n \"ai\",\n \"forms\",\n \"hr\",\n \"geo\"\n];\nvoid WEAVER_DOMAINS;\n\n/** The credentials a Google Analytics connection holds. */\nexport const GOOGLE_ANALYTICS_CREDENTIALS = [\n {\n \"key\": \"clientId\",\n \"label\": \"OAuth client ID\",\n \"scope\": \"provider\",\n \"secret\": false,\n \"help\": \"From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account.\"\n },\n {\n \"key\": \"clientSecret\",\n \"label\": \"OAuth client secret\",\n \"scope\": \"provider\",\n \"secret\": true,\n \"help\": \"The client secret for the same OAuth app. One value for the whole installation.\"\n },\n {\n \"key\": \"accessToken\",\n \"label\": \"Access token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.\"\n },\n {\n \"key\": \"refreshToken\",\n \"label\": \"Refresh token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account. Google issues one only when the consent request asks for offline access.\"\n }\n] as const;\n\n/**\n * The OAuth2 exchange Google Analytics requires — DECLARED here, performed by\n * the host.\n *\n * A consent screen needs a browser, a redirect URI and somewhere to persist\n * the result, and all three belong to the host; a package that ran the dance\n * itself would have to own a web server. So this says precisely enough for a\n * host to do it.\n *\n * The access token lasts 3600 seconds. A host that never refreshes will work\n * all afternoon and be broken by morning, which is why the lifetime is stated\n * rather than left to be discovered.\n *\n * Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may\n * safely be retried and may run concurrently. That is stated rather than\n * assumed because the opposite — a provider that spends the token and revokes\n * the grant on a replay — looks identical until it happens.\n */\nexport const GOOGLE_ANALYTICS_OAUTH = {\n \"flow\": \"authorization_code\",\n \"authorizeUrl\": \"https://accounts.google.com/o/oauth2/v2/auth\",\n \"tokenUrl\": \"https://oauth2.googleapis.com/token\",\n \"scopes\": [\n \"https://www.googleapis.com/auth/analytics.readonly\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"refreshTokenRotates\": false,\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a Google Analytics node's connector metadata from the operation it performs. */\nexport function googleAnalyticsMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_ANALYTICS_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/report-run.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/report-run.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_analytics\n */\n\n/**\n * Google Analytics report — Run a report against a Google Analytics 4\n * property.\n *\n * https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleAnalyticsMeta } from \"../service.js\";\n\nexport const GOOGLE_ANALYTICS_REPORT_KIND = \"@particle-academy/google_analytics_report\";\nexport const GOOGLE_ANALYTICS_REPORT_OPERATION = \"report_run\";\n\nexport const GOOGLE_ANALYTICS_REPORT_META = googleAnalyticsMeta(\"action\", \"run a report\", \"https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_ANALYTICS_REPORT_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.rows\",\n \"type\": \"array\",\n \"description\": \"One entry per combination of dimension values. Each carries dimensionValues and metricValues, in the order requested.\"\n },\n {\n \"path\": \"data.rowCount\",\n \"type\": \"number\",\n \"description\": \"Total rows matching the query, which can exceed the rows returned.\"\n },\n {\n \"path\": \"data.metricHeaders\",\n \"type\": \"array\",\n \"description\": \"The metrics in the order their values appear in each row -- the only thing that says which number is which.\"\n }\n];\n\nexport const googleAnalyticsReportKind: NodeKindDefinition = defineConnectorKind(GOOGLE_ANALYTICS_REPORT_META, {\n name: GOOGLE_ANALYTICS_REPORT_KIND,\n aliases: [\"google_analytics_report\"],\n label: \"Google Analytics report\",\n description: \"Run a report against a Google Analytics 4 property.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"none\",\n outputShape: GOOGLE_ANALYTICS_REPORT_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"property\",\n \"label\": \"Property\",\n \"required\": true,\n \"default\": \"properties/\",\n \"description\": \"The GA4 property, written as `properties/1234567890`. The numeric id alone is not accepted.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"startDate\",\n \"label\": \"Start date\",\n \"required\": true,\n \"default\": \"28daysAgo\",\n \"description\": \"YYYY-MM-DD, or a relative form Google accepts such as `28daysAgo`, `yesterday` or `today`.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"endDate\",\n \"label\": \"End date\",\n \"required\": true,\n \"default\": \"today\",\n \"description\": \"YYYY-MM-DD, or a relative form such as `today`.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"metrics\",\n \"label\": \"Metrics\",\n \"required\": true,\n \"default\": \"activeUsers,sessions\",\n \"description\": \"Metric names, comma separated. For example activeUsers, sessions, screenPageViews.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"dimensions\",\n \"label\": \"Dimensions\",\n \"default\": \"date\",\n \"description\": \"Dimension names, comma separated. For example date, country, pagePath. Leave empty for a single total row.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_ANALYTICS_REPORT_META, config as Record<string, unknown>, \"run a report\"),\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_analytics\n */\n\n/**\n * Google Analytics's node kinds for fancy-flow.\n *\n * Install this on every host. The TypeScript executors live in the js\n * package's `./flow` subpath; PHP and Python hosts run their own and need only\n * this.\n */\n\nexport * from \"./service.js\";\nexport * from \"./kinds/report-run.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleAnalyticsReportKind } from \"./kinds/report-run.js\";\n\n/** Every Google Analytics kind, for a host that registers the lot. */\nexport const GOOGLE_ANALYTICS_KINDS: NodeKindDefinition[] = [\n googleAnalyticsReportKind,\n];\n"]}
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@particle-academy/google-analytics-ui",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Google Analytics's authoring surface for fancy-flow — the node kinds, their config schemas and their declared output shapes. React on every host; carries no executor.",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/Fancy-Friends/google-analytics.git"
7
+ "url": "git+https://github.com/Fancy-Friends/google-analytics.git",
8
+ "directory": "packages/ui"
8
9
  },
9
10
  "homepage": "https://github.com/Fancy-Friends/google-analytics#readme",
10
11
  "bugs": "https://github.com/Fancy-Friends/google-analytics/issues",