@squadbase/vite-server 0.1.19-dev.40d2ebd → 0.1.19-dev.907a033
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/dist/cli/index.js +32 -47
- package/dist/connectors/google-analytics-oauth.js +40 -120
- package/dist/index.js +32 -47
- package/dist/main.js +32 -47
- package/dist/vite-plugin.js +32 -47
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -10570,11 +10570,11 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10570
10570
|
- \u30A2\u30AB\u30A6\u30F3\u30C8\u304C **1\u4EF6\u306E\u307F**: \`askUserQuestion\` \u306F\u30B9\u30AD\u30C3\u30D7\u3057\u3001\u305D\u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u9078\u629E\u6E08\u307F\u3068\u3057\u3066\u6B21\u3078\u9032\u3080
|
|
10571
10571
|
- \u30A2\u30AB\u30A6\u30F3\u30C8\u304C **0\u4EF6**: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
10572
10572
|
3. \`${listPropertiesToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u9078\u629E\u3055\u308C\u305F\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
10573
|
-
4.
|
|
10574
|
-
- \`
|
|
10575
|
-
-
|
|
10576
|
-
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **0\u4EF6
|
|
10577
|
-
5. \
|
|
10573
|
+
4. \u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u9078\u629E:
|
|
10574
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **2\u4EF6\u4EE5\u4E0A**: \u300C\u4F7F\u7528\u3059\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u300D\u3068\u30E6\u30FC\u30B6\u30FC\u306B\u4F1D\u3048\u305F\u4E0A\u3067\u3001\`askUserQuestion\` \u3092\u547C\u3073\u51FA\u3059\uFF08\`options\`: \u5404 option \u306E \`label\` \u306F \`\u8868\u793A\u540D (id: \u30D7\u30ED\u30D1\u30C6\u30A3ID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09
|
|
10575
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **1\u4EF6\u306E\u307F**: \`askUserQuestion\` \u306F\u30B9\u30AD\u30C3\u30D7\u3057\u3001\u305D\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u6E08\u307F\u3068\u3057\u3066\u6B21\u3078\u9032\u3080
|
|
10576
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **0\u4EF6**: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
10577
|
+
5. \u9078\u629E\u3055\u308C\u305F\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF08\u6570\u5024\uFF09\u306F\u4EE5\u964D\u306E\u30EA\u30AF\u30A8\u30B9\u30C8\u3067\u30D1\u30B9\u306B\u76F4\u63A5\u6307\u5B9A\u3059\u308B\uFF08\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306B\u306F\u4FDD\u5B58\u3055\u308C\u306A\u3044\uFF09\u3002\u6B21\u306E\u30B9\u30C6\u30C3\u30D7\u306B\u9032\u3080
|
|
10578
10578
|
|
|
10579
10579
|
#### \u5236\u7D04
|
|
10580
10580
|
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30EC\u30DD\u30FC\u30C8\u30C7\u30FC\u30BF\u3092\u53D6\u5F97\u3057\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u624B\u9806\u3067\u6307\u5B9A\u3055\u308C\u305F\u30E1\u30BF\u30C7\u30FC\u30BF\u53D6\u5F97\u306E\u307F
|
|
@@ -10588,11 +10588,11 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10588
10588
|
- **Only 1 account**: Skip \`askUserQuestion\` and proceed using that account as the selection
|
|
10589
10589
|
- **0 accounts**: Abort setup and inform the user that no accessible accounts are available
|
|
10590
10590
|
3. Call \`${listPropertiesToolName}\` to get the list of properties for the selected account
|
|
10591
|
-
4.
|
|
10592
|
-
- \`
|
|
10593
|
-
-
|
|
10594
|
-
-
|
|
10595
|
-
5.
|
|
10591
|
+
4. Select a property:
|
|
10592
|
+
- **2 or more properties**: Tell the user "Please select a property.", then call \`askUserQuestion\` (\`options\`: each option's \`label\` should be \`Display Name (id: propertyId)\`, \`value\` should be the property ID)
|
|
10593
|
+
- **Only 1 property**: Skip \`askUserQuestion\` and proceed using that property as the selection
|
|
10594
|
+
- **0 properties**: Abort setup and inform the user that no accessible properties are available
|
|
10595
|
+
5. Write the selected numeric property id directly into the request path (it is not stored on the connection). Proceed to the next step
|
|
10596
10596
|
|
|
10597
10597
|
#### Constraints
|
|
10598
10598
|
- **Do NOT fetch report data during setup**. Only the metadata requests specified in the steps above are allowed
|
|
@@ -10600,26 +10600,17 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10600
10600
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
10601
10601
|
},
|
|
10602
10602
|
dataOverviewInstructions: {
|
|
10603
|
-
en: `
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10603
|
+
en: `Use the selected numeric property id in the path (write it directly, e.g. properties/123456789).
|
|
10604
|
+
1. Call connector_google-analytics-oauth_request with GET properties/<propertyId>/metadata to list available dimensions and metrics
|
|
10605
|
+
2. Call connector_google-analytics-oauth_request with POST properties/<propertyId>:runReport using a small date range and basic metrics to verify data availability`,
|
|
10606
|
+
ja: `\u9078\u629E\u3057\u305F\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\u3092\u30D1\u30B9\u306B\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: properties/123456789\uFF09\u3002
|
|
10607
|
+
1. connector_google-analytics-oauth_request \u3067 GET properties/<propertyId>/metadata \u3092\u547C\u3073\u51FA\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u30E1\u30C8\u30EA\u30AF\u30B9\u306E\u4E00\u89A7\u3092\u53D6\u5F97
|
|
10608
|
+
2. connector_google-analytics-oauth_request \u3067 POST properties/<propertyId>:runReport \u3092\u77ED\u3044\u671F\u9593\u3068\u57FA\u672C\u30E1\u30C8\u30EA\u30AF\u30B9\u3067\u547C\u3073\u51FA\u3057\u3001\u30C7\u30FC\u30BF\u306E\u53EF\u7528\u6027\u3092\u78BA\u8A8D`
|
|
10607
10609
|
}
|
|
10608
10610
|
});
|
|
10609
10611
|
|
|
10610
10612
|
// ../connectors/src/connectors/google-analytics-oauth/parameters.ts
|
|
10611
|
-
|
|
10612
|
-
var parameters16 = {
|
|
10613
|
-
propertyId: new ParameterDefinition({
|
|
10614
|
-
slug: "property-id",
|
|
10615
|
-
name: "Default Property ID",
|
|
10616
|
-
description: "Optional default Google Analytics 4 property ID (e.g., 123456789) used when a request does not specify one. Can be found in GA4 Admin > Property Settings. Leave empty to always pass the property ID per request.",
|
|
10617
|
-
envVarBaseKey: "GA_OAUTH_PROPERTY_ID",
|
|
10618
|
-
type: "text",
|
|
10619
|
-
secret: false,
|
|
10620
|
-
required: false
|
|
10621
|
-
})
|
|
10622
|
-
};
|
|
10613
|
+
var parameters16 = {};
|
|
10623
10614
|
|
|
10624
10615
|
// ../connectors/src/connectors/google-analytics-oauth/setup-flow.ts
|
|
10625
10616
|
var ADMIN_BASE_URL4 = "https://analyticsadmin.googleapis.com/v1beta";
|
|
@@ -10926,7 +10917,7 @@ var inputSchema25 = z25.object({
|
|
|
10926
10917
|
connectionId: z25.string().describe("ID of the Google Analytics OAuth connection to use"),
|
|
10927
10918
|
method: z25.enum(["GET", "POST"]).describe("HTTP method"),
|
|
10928
10919
|
path: z25.string().describe(
|
|
10929
|
-
"API path appended to https://analyticsdata.googleapis.com/v1beta/ (e.g., 'properties/123456789:runReport'). Write the numeric property id directly
|
|
10920
|
+
"API path appended to https://analyticsdata.googleapis.com/v1beta/ (e.g., 'properties/123456789:runReport'). Write the numeric property id directly into the path."
|
|
10930
10921
|
),
|
|
10931
10922
|
body: z25.record(z25.string(), z25.unknown()).optional().describe("POST request body (JSON)")
|
|
10932
10923
|
});
|
|
@@ -10945,7 +10936,7 @@ var requestTool4 = new ConnectorTool({
|
|
|
10945
10936
|
name: "request",
|
|
10946
10937
|
description: `Send authenticated requests to the Google Analytics Data API v1beta.
|
|
10947
10938
|
Authentication is handled automatically via OAuth proxy.
|
|
10948
|
-
Write the numeric property id directly into the path (e.g. properties/123456789:runReport)
|
|
10939
|
+
Write the numeric property id directly into the path (e.g. properties/123456789:runReport).`,
|
|
10949
10940
|
inputSchema: inputSchema25,
|
|
10950
10941
|
outputSchema: outputSchema25,
|
|
10951
10942
|
async execute({ connectionId, method, path: path5, body }, connections, config) {
|
|
@@ -10960,9 +10951,7 @@ Write the numeric property id directly into the path (e.g. properties/123456789:
|
|
|
10960
10951
|
`[connector-request] google-analytics-oauth/${connection.name}: ${method} ${path5}`
|
|
10961
10952
|
);
|
|
10962
10953
|
try {
|
|
10963
|
-
const
|
|
10964
|
-
const resolvedPath = propertyId ? path5.replace(/\{propertyId\}/g, propertyId) : path5;
|
|
10965
|
-
const url = `${BASE_URL4}${resolvedPath}`;
|
|
10954
|
+
const url = `${BASE_URL4}${path5}`;
|
|
10966
10955
|
const token = await getProxyToken8(config.oauthProxy);
|
|
10967
10956
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
10968
10957
|
const controller = new AbortController();
|
|
@@ -11032,7 +11021,7 @@ var googleAnalyticsOauthConnector = new ConnectorPlugin({
|
|
|
11032
11021
|
systemPrompt: {
|
|
11033
11022
|
en: `### Tools
|
|
11034
11023
|
|
|
11035
|
-
- \`connector_google-analytics-oauth_request\`: Send authenticated requests to the GA4 Data API. Use it for running reports, getting metadata, and realtime reports. Write the target property into the path as \`properties/{numericPropertyId}
|
|
11024
|
+
- \`connector_google-analytics-oauth_request\`: Send authenticated requests to the GA4 Data API. Use it for running reports, getting metadata, and realtime reports. Write the target property into the path as \`properties/{numericPropertyId}\`. Authentication is configured automatically via OAuth.
|
|
11036
11025
|
- \`connector_google-analytics-oauth_listAccounts\`: List accessible Google Analytics accounts. Use during setup to discover available accounts.
|
|
11037
11026
|
- \`connector_google-analytics-oauth_listProperties\`: List GA4 properties for a given account. Use during setup to select the target property.
|
|
11038
11027
|
|
|
@@ -11068,12 +11057,12 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
11068
11057
|
The business logic type for this connector is "typescript". Write handler code using the connector SDK shown below. Do NOT access credentials directly from environment variables and do NOT read \`INTERNAL_SQUADBASE_*\` env vars \u2014 the SDK takes care of OAuth.
|
|
11069
11058
|
|
|
11070
11059
|
SDK surface (client created via \`connection(connectionId)\`):
|
|
11071
|
-
- \`client.request
|
|
11072
|
-
- \`client.runReport(request)\` \u2014 run a GA4 report. Set \`propertyId\` (bare numeric id) on the request object to target a property; required when no default is configured.
|
|
11060
|
+
- \`client.runReport(request)\` \u2014 run a GA4 report and get back \`{ rows, rowCount }\` (JSON, already parsed). **This is the primary method \u2014 prefer it over \`request\`.** Pass \`propertyId\` (bare numeric id) on the request object to target a property.
|
|
11073
11061
|
- \`client.runRealtimeReport(request)\` \u2014 run a realtime report. \`propertyId\` works the same as \`runReport\`.
|
|
11074
|
-
- \`client.getMetadata(propertyId
|
|
11062
|
+
- \`client.getMetadata(propertyId)\` \u2014 fetch available dimensions and metrics for a property.
|
|
11063
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch that returns a raw \`Response\` (\`path\` is appended to \`https://analyticsdata.googleapis.com/v1beta/\`; write the numeric property id directly into the path). Only use this for endpoints the convenience methods above do not cover, and remember to \`await res.json()\` yourself.
|
|
11075
11064
|
|
|
11076
|
-
|
|
11065
|
+
**\`propertyId\` is required on every call** \u2014 pass the numeric id from the data overview. A GA connection can span multiple properties, so there is no stored default.
|
|
11077
11066
|
|
|
11078
11067
|
If a handler test fails with \`Connection proxy is not configured\`, retry \u2014 the sandbox is still initializing. Do NOT abandon the SDK and construct OAuth proxy URLs manually.
|
|
11079
11068
|
|
|
@@ -11109,7 +11098,7 @@ const data = await res.json();
|
|
|
11109
11098
|
\`\`\``,
|
|
11110
11099
|
ja: `### \u30C4\u30FC\u30EB
|
|
11111
11100
|
|
|
11112
|
-
- \`connector_google-analytics-oauth_request\`: GA4 Data API\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u3001\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u306F\u30D1\u30B9\u306B \`properties/{\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID}\` \u306E\u5F62\u3067\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\
|
|
11101
|
+
- \`connector_google-analytics-oauth_request\`: GA4 Data API\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u3001\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u306F\u30D1\u30B9\u306B \`properties/{\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID}\` \u306E\u5F62\u3067\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
11113
11102
|
- \`connector_google-analytics-oauth_listAccounts\`: \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Analytics\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u5229\u7528\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u78BA\u8A8D\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
11114
11103
|
- \`connector_google-analytics-oauth_listProperties\`: \u6307\u5B9A\u30A2\u30AB\u30A6\u30F3\u30C8\u306EGA4\u30D7\u30ED\u30D1\u30C6\u30A3\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u30BF\u30FC\u30B2\u30C3\u30C8\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
11115
11104
|
|
|
@@ -11145,12 +11134,12 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
11145
11134
|
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BF SDK \u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\`INTERNAL_SQUADBASE_*\` \u306E\u74B0\u5883\u5909\u6570\u3092\u4F7F\u3063\u3066\u624B\u52D5\u3067 OAuth \u30D7\u30ED\u30AD\u30B7\u3092\u53E9\u304F\u3053\u3068\u3082\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044 \u2014 SDK \u304C OAuth \u3092\u51E6\u7406\u3057\u307E\u3059\u3002
|
|
11146
11135
|
|
|
11147
11136
|
SDK\uFF08\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\uFF09:
|
|
11148
|
-
- \`client.request
|
|
11149
|
-
- \`client.runReport(request)\` \u2014 GA4 \u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3002\u30EA\u30AF\u30A8\u30B9\u30C8\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B \`propertyId\`\uFF08\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09\u3092\u6307\u5B9A\u3057\u3066\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u6C7A\u3081\u307E\u3059\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u672A\u8A2D\u5B9A\u306E\u5834\u5408\u306F\u5FC5\u9808\u3067\u3059\u3002
|
|
11137
|
+
- \`client.runReport(request)\` \u2014 GA4 \u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3057\u3001\`{ rows, rowCount }\`\uFF08\u30D1\u30FC\u30B9\u6E08\u307F JSON\uFF09\u3092\u8FD4\u3057\u307E\u3059\u3002**\u3053\u308C\u304C\u4E3B\u8981\u30E1\u30BD\u30C3\u30C9\u3067\u3059 \u2014 \`request\` \u3088\u308A\u512A\u5148\u3057\u3066\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002** \u30EA\u30AF\u30A8\u30B9\u30C8\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B \`propertyId\`\uFF08\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09\u3092\u6307\u5B9A\u3057\u3066\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u6C7A\u3081\u307E\u3059\u3002
|
|
11150
11138
|
- \`client.runRealtimeReport(request)\` \u2014 \u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3002\`propertyId\` \u306E\u6271\u3044\u306F \`runReport\` \u3068\u540C\u3058\u3067\u3059\u3002
|
|
11151
|
-
- \`client.getMetadata(propertyId
|
|
11139
|
+
- \`client.getMetadata(propertyId)\` \u2014 \u6307\u5B9A\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u30E1\u30C8\u30EA\u30AF\u30B9\u3092\u53D6\u5F97\u3002
|
|
11140
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304D fetch\u3002\u751F\u306E \`Response\` \u3092\u8FD4\u3057\u307E\u3059\uFF08\`path\` \u306F \`https://analyticsdata.googleapis.com/v1beta/\` \u306B\u8FFD\u52A0\u3055\u308C\u307E\u3059\u3002\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\u3092\u30D1\u30B9\u306B\u76F4\u63A5\u66F8\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002\u4E0A\u8A18\u306E\u4FBF\u5229\u30E1\u30BD\u30C3\u30C9\u3067\u8CC4\u3048\u306A\u3044\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306E\u5834\u5408\u306E\u307F\u4F7F\u7528\u3057\u3001\`await res.json()\` \u306F\u81EA\u5206\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
11152
11141
|
|
|
11153
|
-
**\`propertyId\` \u306F\
|
|
11142
|
+
**\`propertyId\` \u306F\u3059\u3079\u3066\u306E\u547C\u3073\u51FA\u3057\u3067\u5FC5\u9808\u3067\u3059**\uFF08\u30C7\u30FC\u30BF\u6982\u8981\u306B\u8F09\u3063\u3066\u3044\u308B\u6570\u5024ID\uFF09\u3002GA \u306E\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306F\u8907\u6570\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u307E\u305F\u304C\u308B\u3053\u3068\u304C\u3042\u308B\u305F\u3081\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u4FDD\u5B58\u3055\u308C\u307E\u305B\u3093\u3002
|
|
11154
11143
|
|
|
11155
11144
|
\u30CF\u30F3\u30C9\u30E9\u306E\u30C6\u30B9\u30C8\u304C \`Connection proxy is not configured\` \u3067\u5931\u6557\u3059\u308B\u5834\u5408\u306F\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u901A\u5E38\u306F\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306E\u521D\u671F\u5316\u4E2D\u306B\u8D77\u304D\u307E\u3059\u3002SDK \u3092\u8AE6\u3081\u3066 OAuth \u30D7\u30ED\u30AD\u30B7\u306E URL \u3092\u81EA\u5206\u3067\u7D44\u307F\u7ACB\u3066\u308B\u3053\u3068\u306F **\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044**\u3002
|
|
11156
11145
|
|
|
@@ -11187,13 +11176,9 @@ const data = await res.json();
|
|
|
11187
11176
|
},
|
|
11188
11177
|
tools: tools16,
|
|
11189
11178
|
setup: (params, ctx, config) => runSetupFlow(googleAnalyticsOauthSetupFlow, params, ctx, config),
|
|
11190
|
-
async checkConnection(
|
|
11179
|
+
async checkConnection(_params, config) {
|
|
11191
11180
|
const { proxyFetch } = config;
|
|
11192
|
-
const
|
|
11193
|
-
if (!propertyId) {
|
|
11194
|
-
return { success: true };
|
|
11195
|
-
}
|
|
11196
|
-
const url = `https://analyticsdata.googleapis.com/v1beta/properties/${propertyId}/metadata`;
|
|
11181
|
+
const url = "https://analyticsadmin.googleapis.com/v1beta/accountSummaries";
|
|
11197
11182
|
try {
|
|
11198
11183
|
const res = await proxyFetch(url, { method: "GET" });
|
|
11199
11184
|
if (!res.ok) {
|
|
@@ -1,96 +1,17 @@
|
|
|
1
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var __esm = (fn, res, err) => function __init() {
|
|
3
|
-
if (err) throw err[0];
|
|
4
|
-
try {
|
|
5
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
6
|
-
} catch (e) {
|
|
7
|
-
throw err = [e], e;
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// ../connectors/src/parameter-definition.ts
|
|
12
|
-
var ParameterDefinition;
|
|
13
|
-
var init_parameter_definition = __esm({
|
|
14
|
-
"../connectors/src/parameter-definition.ts"() {
|
|
15
|
-
"use strict";
|
|
16
|
-
ParameterDefinition = class {
|
|
17
|
-
slug;
|
|
18
|
-
name;
|
|
19
|
-
description;
|
|
20
|
-
envVarBaseKey;
|
|
21
|
-
type;
|
|
22
|
-
secret;
|
|
23
|
-
required;
|
|
24
|
-
isDeprecated;
|
|
25
|
-
constructor(config) {
|
|
26
|
-
this.slug = config.slug;
|
|
27
|
-
this.name = config.name;
|
|
28
|
-
this.description = config.description;
|
|
29
|
-
this.envVarBaseKey = config.envVarBaseKey;
|
|
30
|
-
this.type = config.type;
|
|
31
|
-
this.secret = config.secret;
|
|
32
|
-
this.required = config.required;
|
|
33
|
-
this.isDeprecated = config.isDeprecated ?? false;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Get the parameter value from a ConnectorConnectionObject.
|
|
37
|
-
*/
|
|
38
|
-
getValue(connection2) {
|
|
39
|
-
const param = connection2.parameters.find(
|
|
40
|
-
(p) => p.parameterSlug === this.slug
|
|
41
|
-
);
|
|
42
|
-
if (!param || param.value == null) {
|
|
43
|
-
throw new Error(
|
|
44
|
-
`Parameter "${this.slug}" not found or has no value in connection "${connection2.id}"`
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
return param.value;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Try to get the parameter value. Returns undefined if not found (for optional params).
|
|
51
|
-
*/
|
|
52
|
-
tryGetValue(connection2) {
|
|
53
|
-
const param = connection2.parameters.find(
|
|
54
|
-
(p) => p.parameterSlug === this.slug
|
|
55
|
-
);
|
|
56
|
-
if (!param || param.value == null) return void 0;
|
|
57
|
-
return param.value;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// ../connectors/src/connectors/google-analytics-oauth/parameters.ts
|
|
64
|
-
init_parameter_definition();
|
|
65
|
-
var parameters = {
|
|
66
|
-
propertyId: new ParameterDefinition({
|
|
67
|
-
slug: "property-id",
|
|
68
|
-
name: "Default Property ID",
|
|
69
|
-
description: "Optional default Google Analytics 4 property ID (e.g., 123456789) used when a request does not specify one. Can be found in GA4 Admin > Property Settings. Leave empty to always pass the property ID per request.",
|
|
70
|
-
envVarBaseKey: "GA_OAUTH_PROPERTY_ID",
|
|
71
|
-
type: "text",
|
|
72
|
-
secret: false,
|
|
73
|
-
required: false
|
|
74
|
-
})
|
|
75
|
-
};
|
|
76
|
-
|
|
77
1
|
// ../connectors/src/connectors/google-analytics-oauth/sdk/index.ts
|
|
78
2
|
var BASE_URL = "https://analyticsdata.googleapis.com/v1beta/";
|
|
79
|
-
function createClient(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const pid = override ?? defaultPropertyId;
|
|
83
|
-
if (!pid) {
|
|
3
|
+
function createClient(_params, fetchFn) {
|
|
4
|
+
function resolvePropertyId(propertyId) {
|
|
5
|
+
if (!propertyId) {
|
|
84
6
|
throw new Error(
|
|
85
|
-
"google-analytics-oauth: propertyId is required.
|
|
7
|
+
"google-analytics-oauth: propertyId is required. Pass the numeric GA4 property id explicitly."
|
|
86
8
|
);
|
|
87
9
|
}
|
|
88
|
-
return
|
|
10
|
+
return propertyId;
|
|
89
11
|
}
|
|
90
12
|
return {
|
|
91
13
|
async request(path2, init) {
|
|
92
|
-
const
|
|
93
|
-
const url = `${BASE_URL.replace(/\/+$/, "")}/${resolvedPath.replace(/^\/+/, "")}`;
|
|
14
|
+
const url = `${BASE_URL.replace(/\/+$/, "")}/${path2.replace(/^\/+/, "")}`;
|
|
94
15
|
return fetchFn(url, init);
|
|
95
16
|
},
|
|
96
17
|
async runReport({ propertyId, ...request }) {
|
|
@@ -659,11 +580,11 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
659
580
|
- \u30A2\u30AB\u30A6\u30F3\u30C8\u304C **1\u4EF6\u306E\u307F**: \`askUserQuestion\` \u306F\u30B9\u30AD\u30C3\u30D7\u3057\u3001\u305D\u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u9078\u629E\u6E08\u307F\u3068\u3057\u3066\u6B21\u3078\u9032\u3080
|
|
660
581
|
- \u30A2\u30AB\u30A6\u30F3\u30C8\u304C **0\u4EF6**: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
661
582
|
3. \`${listPropertiesToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u9078\u629E\u3055\u308C\u305F\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
662
|
-
4.
|
|
663
|
-
- \`
|
|
664
|
-
-
|
|
665
|
-
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **0\u4EF6
|
|
666
|
-
5. \
|
|
583
|
+
4. \u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u9078\u629E:
|
|
584
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **2\u4EF6\u4EE5\u4E0A**: \u300C\u4F7F\u7528\u3059\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u300D\u3068\u30E6\u30FC\u30B6\u30FC\u306B\u4F1D\u3048\u305F\u4E0A\u3067\u3001\`askUserQuestion\` \u3092\u547C\u3073\u51FA\u3059\uFF08\`options\`: \u5404 option \u306E \`label\` \u306F \`\u8868\u793A\u540D (id: \u30D7\u30ED\u30D1\u30C6\u30A3ID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09
|
|
585
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **1\u4EF6\u306E\u307F**: \`askUserQuestion\` \u306F\u30B9\u30AD\u30C3\u30D7\u3057\u3001\u305D\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u6E08\u307F\u3068\u3057\u3066\u6B21\u3078\u9032\u3080
|
|
586
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **0\u4EF6**: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
587
|
+
5. \u9078\u629E\u3055\u308C\u305F\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF08\u6570\u5024\uFF09\u306F\u4EE5\u964D\u306E\u30EA\u30AF\u30A8\u30B9\u30C8\u3067\u30D1\u30B9\u306B\u76F4\u63A5\u6307\u5B9A\u3059\u308B\uFF08\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306B\u306F\u4FDD\u5B58\u3055\u308C\u306A\u3044\uFF09\u3002\u6B21\u306E\u30B9\u30C6\u30C3\u30D7\u306B\u9032\u3080
|
|
667
588
|
|
|
668
589
|
#### \u5236\u7D04
|
|
669
590
|
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30EC\u30DD\u30FC\u30C8\u30C7\u30FC\u30BF\u3092\u53D6\u5F97\u3057\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u624B\u9806\u3067\u6307\u5B9A\u3055\u308C\u305F\u30E1\u30BF\u30C7\u30FC\u30BF\u53D6\u5F97\u306E\u307F
|
|
@@ -677,11 +598,11 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
677
598
|
- **Only 1 account**: Skip \`askUserQuestion\` and proceed using that account as the selection
|
|
678
599
|
- **0 accounts**: Abort setup and inform the user that no accessible accounts are available
|
|
679
600
|
3. Call \`${listPropertiesToolName}\` to get the list of properties for the selected account
|
|
680
|
-
4.
|
|
681
|
-
- \`
|
|
682
|
-
-
|
|
683
|
-
-
|
|
684
|
-
5.
|
|
601
|
+
4. Select a property:
|
|
602
|
+
- **2 or more properties**: Tell the user "Please select a property.", then call \`askUserQuestion\` (\`options\`: each option's \`label\` should be \`Display Name (id: propertyId)\`, \`value\` should be the property ID)
|
|
603
|
+
- **Only 1 property**: Skip \`askUserQuestion\` and proceed using that property as the selection
|
|
604
|
+
- **0 properties**: Abort setup and inform the user that no accessible properties are available
|
|
605
|
+
5. Write the selected numeric property id directly into the request path (it is not stored on the connection). Proceed to the next step
|
|
685
606
|
|
|
686
607
|
#### Constraints
|
|
687
608
|
- **Do NOT fetch report data during setup**. Only the metadata requests specified in the steps above are allowed
|
|
@@ -689,13 +610,18 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
689
610
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
690
611
|
},
|
|
691
612
|
dataOverviewInstructions: {
|
|
692
|
-
en: `
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
613
|
+
en: `Use the selected numeric property id in the path (write it directly, e.g. properties/123456789).
|
|
614
|
+
1. Call connector_google-analytics-oauth_request with GET properties/<propertyId>/metadata to list available dimensions and metrics
|
|
615
|
+
2. Call connector_google-analytics-oauth_request with POST properties/<propertyId>:runReport using a small date range and basic metrics to verify data availability`,
|
|
616
|
+
ja: `\u9078\u629E\u3057\u305F\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\u3092\u30D1\u30B9\u306B\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: properties/123456789\uFF09\u3002
|
|
617
|
+
1. connector_google-analytics-oauth_request \u3067 GET properties/<propertyId>/metadata \u3092\u547C\u3073\u51FA\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u30E1\u30C8\u30EA\u30AF\u30B9\u306E\u4E00\u89A7\u3092\u53D6\u5F97
|
|
618
|
+
2. connector_google-analytics-oauth_request \u3067 POST properties/<propertyId>:runReport \u3092\u77ED\u3044\u671F\u9593\u3068\u57FA\u672C\u30E1\u30C8\u30EA\u30AF\u30B9\u3067\u547C\u3073\u51FA\u3057\u3001\u30C7\u30FC\u30BF\u306E\u53EF\u7528\u6027\u3092\u78BA\u8A8D`
|
|
696
619
|
}
|
|
697
620
|
});
|
|
698
621
|
|
|
622
|
+
// ../connectors/src/connectors/google-analytics-oauth/parameters.ts
|
|
623
|
+
var parameters = {};
|
|
624
|
+
|
|
699
625
|
// ../connectors/src/connectors/google-analytics-oauth/setup-flow.ts
|
|
700
626
|
var ADMIN_BASE_URL3 = "https://analyticsadmin.googleapis.com/v1beta";
|
|
701
627
|
var DATA_BASE_URL = "https://analyticsdata.googleapis.com/v1beta";
|
|
@@ -1001,7 +927,7 @@ var inputSchema3 = z3.object({
|
|
|
1001
927
|
connectionId: z3.string().describe("ID of the Google Analytics OAuth connection to use"),
|
|
1002
928
|
method: z3.enum(["GET", "POST"]).describe("HTTP method"),
|
|
1003
929
|
path: z3.string().describe(
|
|
1004
|
-
"API path appended to https://analyticsdata.googleapis.com/v1beta/ (e.g., 'properties/123456789:runReport'). Write the numeric property id directly
|
|
930
|
+
"API path appended to https://analyticsdata.googleapis.com/v1beta/ (e.g., 'properties/123456789:runReport'). Write the numeric property id directly into the path."
|
|
1005
931
|
),
|
|
1006
932
|
body: z3.record(z3.string(), z3.unknown()).optional().describe("POST request body (JSON)")
|
|
1007
933
|
});
|
|
@@ -1020,7 +946,7 @@ var requestTool = new ConnectorTool({
|
|
|
1020
946
|
name: "request",
|
|
1021
947
|
description: `Send authenticated requests to the Google Analytics Data API v1beta.
|
|
1022
948
|
Authentication is handled automatically via OAuth proxy.
|
|
1023
|
-
Write the numeric property id directly into the path (e.g. properties/123456789:runReport)
|
|
949
|
+
Write the numeric property id directly into the path (e.g. properties/123456789:runReport).`,
|
|
1024
950
|
inputSchema: inputSchema3,
|
|
1025
951
|
outputSchema: outputSchema3,
|
|
1026
952
|
async execute({ connectionId, method, path: path2, body }, connections, config) {
|
|
@@ -1035,9 +961,7 @@ Write the numeric property id directly into the path (e.g. properties/123456789:
|
|
|
1035
961
|
`[connector-request] google-analytics-oauth/${connection2.name}: ${method} ${path2}`
|
|
1036
962
|
);
|
|
1037
963
|
try {
|
|
1038
|
-
const
|
|
1039
|
-
const resolvedPath = propertyId ? path2.replace(/\{propertyId\}/g, propertyId) : path2;
|
|
1040
|
-
const url = `${BASE_URL2}${resolvedPath}`;
|
|
964
|
+
const url = `${BASE_URL2}${path2}`;
|
|
1041
965
|
const token = await getProxyToken3(config.oauthProxy);
|
|
1042
966
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
1043
967
|
const controller = new AbortController();
|
|
@@ -1107,7 +1031,7 @@ var googleAnalyticsOauthConnector = new ConnectorPlugin({
|
|
|
1107
1031
|
systemPrompt: {
|
|
1108
1032
|
en: `### Tools
|
|
1109
1033
|
|
|
1110
|
-
- \`connector_google-analytics-oauth_request\`: Send authenticated requests to the GA4 Data API. Use it for running reports, getting metadata, and realtime reports. Write the target property into the path as \`properties/{numericPropertyId}
|
|
1034
|
+
- \`connector_google-analytics-oauth_request\`: Send authenticated requests to the GA4 Data API. Use it for running reports, getting metadata, and realtime reports. Write the target property into the path as \`properties/{numericPropertyId}\`. Authentication is configured automatically via OAuth.
|
|
1111
1035
|
- \`connector_google-analytics-oauth_listAccounts\`: List accessible Google Analytics accounts. Use during setup to discover available accounts.
|
|
1112
1036
|
- \`connector_google-analytics-oauth_listProperties\`: List GA4 properties for a given account. Use during setup to select the target property.
|
|
1113
1037
|
|
|
@@ -1143,12 +1067,12 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
1143
1067
|
The business logic type for this connector is "typescript". Write handler code using the connector SDK shown below. Do NOT access credentials directly from environment variables and do NOT read \`INTERNAL_SQUADBASE_*\` env vars \u2014 the SDK takes care of OAuth.
|
|
1144
1068
|
|
|
1145
1069
|
SDK surface (client created via \`connection(connectionId)\`):
|
|
1146
|
-
- \`client.request
|
|
1147
|
-
- \`client.runReport(request)\` \u2014 run a GA4 report. Set \`propertyId\` (bare numeric id) on the request object to target a property; required when no default is configured.
|
|
1070
|
+
- \`client.runReport(request)\` \u2014 run a GA4 report and get back \`{ rows, rowCount }\` (JSON, already parsed). **This is the primary method \u2014 prefer it over \`request\`.** Pass \`propertyId\` (bare numeric id) on the request object to target a property.
|
|
1148
1071
|
- \`client.runRealtimeReport(request)\` \u2014 run a realtime report. \`propertyId\` works the same as \`runReport\`.
|
|
1149
|
-
- \`client.getMetadata(propertyId
|
|
1072
|
+
- \`client.getMetadata(propertyId)\` \u2014 fetch available dimensions and metrics for a property.
|
|
1073
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch that returns a raw \`Response\` (\`path\` is appended to \`https://analyticsdata.googleapis.com/v1beta/\`; write the numeric property id directly into the path). Only use this for endpoints the convenience methods above do not cover, and remember to \`await res.json()\` yourself.
|
|
1150
1074
|
|
|
1151
|
-
|
|
1075
|
+
**\`propertyId\` is required on every call** \u2014 pass the numeric id from the data overview. A GA connection can span multiple properties, so there is no stored default.
|
|
1152
1076
|
|
|
1153
1077
|
If a handler test fails with \`Connection proxy is not configured\`, retry \u2014 the sandbox is still initializing. Do NOT abandon the SDK and construct OAuth proxy URLs manually.
|
|
1154
1078
|
|
|
@@ -1184,7 +1108,7 @@ const data = await res.json();
|
|
|
1184
1108
|
\`\`\``,
|
|
1185
1109
|
ja: `### \u30C4\u30FC\u30EB
|
|
1186
1110
|
|
|
1187
|
-
- \`connector_google-analytics-oauth_request\`: GA4 Data API\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u3001\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u306F\u30D1\u30B9\u306B \`properties/{\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID}\` \u306E\u5F62\u3067\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\
|
|
1111
|
+
- \`connector_google-analytics-oauth_request\`: GA4 Data API\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u3001\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u306F\u30D1\u30B9\u306B \`properties/{\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID}\` \u306E\u5F62\u3067\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
1188
1112
|
- \`connector_google-analytics-oauth_listAccounts\`: \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Analytics\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u5229\u7528\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u78BA\u8A8D\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
1189
1113
|
- \`connector_google-analytics-oauth_listProperties\`: \u6307\u5B9A\u30A2\u30AB\u30A6\u30F3\u30C8\u306EGA4\u30D7\u30ED\u30D1\u30C6\u30A3\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u30BF\u30FC\u30B2\u30C3\u30C8\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
1190
1114
|
|
|
@@ -1220,12 +1144,12 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
1220
1144
|
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BF SDK \u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\`INTERNAL_SQUADBASE_*\` \u306E\u74B0\u5883\u5909\u6570\u3092\u4F7F\u3063\u3066\u624B\u52D5\u3067 OAuth \u30D7\u30ED\u30AD\u30B7\u3092\u53E9\u304F\u3053\u3068\u3082\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044 \u2014 SDK \u304C OAuth \u3092\u51E6\u7406\u3057\u307E\u3059\u3002
|
|
1221
1145
|
|
|
1222
1146
|
SDK\uFF08\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\uFF09:
|
|
1223
|
-
- \`client.request
|
|
1224
|
-
- \`client.runReport(request)\` \u2014 GA4 \u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3002\u30EA\u30AF\u30A8\u30B9\u30C8\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B \`propertyId\`\uFF08\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09\u3092\u6307\u5B9A\u3057\u3066\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u6C7A\u3081\u307E\u3059\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u672A\u8A2D\u5B9A\u306E\u5834\u5408\u306F\u5FC5\u9808\u3067\u3059\u3002
|
|
1147
|
+
- \`client.runReport(request)\` \u2014 GA4 \u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3057\u3001\`{ rows, rowCount }\`\uFF08\u30D1\u30FC\u30B9\u6E08\u307F JSON\uFF09\u3092\u8FD4\u3057\u307E\u3059\u3002**\u3053\u308C\u304C\u4E3B\u8981\u30E1\u30BD\u30C3\u30C9\u3067\u3059 \u2014 \`request\` \u3088\u308A\u512A\u5148\u3057\u3066\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002** \u30EA\u30AF\u30A8\u30B9\u30C8\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B \`propertyId\`\uFF08\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09\u3092\u6307\u5B9A\u3057\u3066\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u6C7A\u3081\u307E\u3059\u3002
|
|
1225
1148
|
- \`client.runRealtimeReport(request)\` \u2014 \u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3002\`propertyId\` \u306E\u6271\u3044\u306F \`runReport\` \u3068\u540C\u3058\u3067\u3059\u3002
|
|
1226
|
-
- \`client.getMetadata(propertyId
|
|
1149
|
+
- \`client.getMetadata(propertyId)\` \u2014 \u6307\u5B9A\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u30E1\u30C8\u30EA\u30AF\u30B9\u3092\u53D6\u5F97\u3002
|
|
1150
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304D fetch\u3002\u751F\u306E \`Response\` \u3092\u8FD4\u3057\u307E\u3059\uFF08\`path\` \u306F \`https://analyticsdata.googleapis.com/v1beta/\` \u306B\u8FFD\u52A0\u3055\u308C\u307E\u3059\u3002\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\u3092\u30D1\u30B9\u306B\u76F4\u63A5\u66F8\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002\u4E0A\u8A18\u306E\u4FBF\u5229\u30E1\u30BD\u30C3\u30C9\u3067\u8CC4\u3048\u306A\u3044\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306E\u5834\u5408\u306E\u307F\u4F7F\u7528\u3057\u3001\`await res.json()\` \u306F\u81EA\u5206\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
1227
1151
|
|
|
1228
|
-
**\`propertyId\` \u306F\
|
|
1152
|
+
**\`propertyId\` \u306F\u3059\u3079\u3066\u306E\u547C\u3073\u51FA\u3057\u3067\u5FC5\u9808\u3067\u3059**\uFF08\u30C7\u30FC\u30BF\u6982\u8981\u306B\u8F09\u3063\u3066\u3044\u308B\u6570\u5024ID\uFF09\u3002GA \u306E\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306F\u8907\u6570\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u307E\u305F\u304C\u308B\u3053\u3068\u304C\u3042\u308B\u305F\u3081\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u4FDD\u5B58\u3055\u308C\u307E\u305B\u3093\u3002
|
|
1229
1153
|
|
|
1230
1154
|
\u30CF\u30F3\u30C9\u30E9\u306E\u30C6\u30B9\u30C8\u304C \`Connection proxy is not configured\` \u3067\u5931\u6557\u3059\u308B\u5834\u5408\u306F\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u901A\u5E38\u306F\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306E\u521D\u671F\u5316\u4E2D\u306B\u8D77\u304D\u307E\u3059\u3002SDK \u3092\u8AE6\u3081\u3066 OAuth \u30D7\u30ED\u30AD\u30B7\u306E URL \u3092\u81EA\u5206\u3067\u7D44\u307F\u7ACB\u3066\u308B\u3053\u3068\u306F **\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044**\u3002
|
|
1231
1155
|
|
|
@@ -1262,13 +1186,9 @@ const data = await res.json();
|
|
|
1262
1186
|
},
|
|
1263
1187
|
tools,
|
|
1264
1188
|
setup: (params, ctx, config) => runSetupFlow(googleAnalyticsOauthSetupFlow, params, ctx, config),
|
|
1265
|
-
async checkConnection(
|
|
1189
|
+
async checkConnection(_params, config) {
|
|
1266
1190
|
const { proxyFetch } = config;
|
|
1267
|
-
const
|
|
1268
|
-
if (!propertyId) {
|
|
1269
|
-
return { success: true };
|
|
1270
|
-
}
|
|
1271
|
-
const url = `https://analyticsdata.googleapis.com/v1beta/properties/${propertyId}/metadata`;
|
|
1191
|
+
const url = "https://analyticsadmin.googleapis.com/v1beta/accountSummaries";
|
|
1272
1192
|
try {
|
|
1273
1193
|
const res = await proxyFetch(url, { method: "GET" });
|
|
1274
1194
|
if (!res.ok) {
|
package/dist/index.js
CHANGED
|
@@ -10505,11 +10505,11 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10505
10505
|
- \u30A2\u30AB\u30A6\u30F3\u30C8\u304C **1\u4EF6\u306E\u307F**: \`askUserQuestion\` \u306F\u30B9\u30AD\u30C3\u30D7\u3057\u3001\u305D\u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u9078\u629E\u6E08\u307F\u3068\u3057\u3066\u6B21\u3078\u9032\u3080
|
|
10506
10506
|
- \u30A2\u30AB\u30A6\u30F3\u30C8\u304C **0\u4EF6**: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
10507
10507
|
3. \`${listPropertiesToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u9078\u629E\u3055\u308C\u305F\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
10508
|
-
4.
|
|
10509
|
-
- \`
|
|
10510
|
-
-
|
|
10511
|
-
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **0\u4EF6
|
|
10512
|
-
5. \
|
|
10508
|
+
4. \u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u9078\u629E:
|
|
10509
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **2\u4EF6\u4EE5\u4E0A**: \u300C\u4F7F\u7528\u3059\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u300D\u3068\u30E6\u30FC\u30B6\u30FC\u306B\u4F1D\u3048\u305F\u4E0A\u3067\u3001\`askUserQuestion\` \u3092\u547C\u3073\u51FA\u3059\uFF08\`options\`: \u5404 option \u306E \`label\` \u306F \`\u8868\u793A\u540D (id: \u30D7\u30ED\u30D1\u30C6\u30A3ID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09
|
|
10510
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **1\u4EF6\u306E\u307F**: \`askUserQuestion\` \u306F\u30B9\u30AD\u30C3\u30D7\u3057\u3001\u305D\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u6E08\u307F\u3068\u3057\u3066\u6B21\u3078\u9032\u3080
|
|
10511
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **0\u4EF6**: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
10512
|
+
5. \u9078\u629E\u3055\u308C\u305F\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF08\u6570\u5024\uFF09\u306F\u4EE5\u964D\u306E\u30EA\u30AF\u30A8\u30B9\u30C8\u3067\u30D1\u30B9\u306B\u76F4\u63A5\u6307\u5B9A\u3059\u308B\uFF08\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306B\u306F\u4FDD\u5B58\u3055\u308C\u306A\u3044\uFF09\u3002\u6B21\u306E\u30B9\u30C6\u30C3\u30D7\u306B\u9032\u3080
|
|
10513
10513
|
|
|
10514
10514
|
#### \u5236\u7D04
|
|
10515
10515
|
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30EC\u30DD\u30FC\u30C8\u30C7\u30FC\u30BF\u3092\u53D6\u5F97\u3057\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u624B\u9806\u3067\u6307\u5B9A\u3055\u308C\u305F\u30E1\u30BF\u30C7\u30FC\u30BF\u53D6\u5F97\u306E\u307F
|
|
@@ -10523,11 +10523,11 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10523
10523
|
- **Only 1 account**: Skip \`askUserQuestion\` and proceed using that account as the selection
|
|
10524
10524
|
- **0 accounts**: Abort setup and inform the user that no accessible accounts are available
|
|
10525
10525
|
3. Call \`${listPropertiesToolName}\` to get the list of properties for the selected account
|
|
10526
|
-
4.
|
|
10527
|
-
- \`
|
|
10528
|
-
-
|
|
10529
|
-
-
|
|
10530
|
-
5.
|
|
10526
|
+
4. Select a property:
|
|
10527
|
+
- **2 or more properties**: Tell the user "Please select a property.", then call \`askUserQuestion\` (\`options\`: each option's \`label\` should be \`Display Name (id: propertyId)\`, \`value\` should be the property ID)
|
|
10528
|
+
- **Only 1 property**: Skip \`askUserQuestion\` and proceed using that property as the selection
|
|
10529
|
+
- **0 properties**: Abort setup and inform the user that no accessible properties are available
|
|
10530
|
+
5. Write the selected numeric property id directly into the request path (it is not stored on the connection). Proceed to the next step
|
|
10531
10531
|
|
|
10532
10532
|
#### Constraints
|
|
10533
10533
|
- **Do NOT fetch report data during setup**. Only the metadata requests specified in the steps above are allowed
|
|
@@ -10535,26 +10535,17 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10535
10535
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
10536
10536
|
},
|
|
10537
10537
|
dataOverviewInstructions: {
|
|
10538
|
-
en: `
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10538
|
+
en: `Use the selected numeric property id in the path (write it directly, e.g. properties/123456789).
|
|
10539
|
+
1. Call connector_google-analytics-oauth_request with GET properties/<propertyId>/metadata to list available dimensions and metrics
|
|
10540
|
+
2. Call connector_google-analytics-oauth_request with POST properties/<propertyId>:runReport using a small date range and basic metrics to verify data availability`,
|
|
10541
|
+
ja: `\u9078\u629E\u3057\u305F\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\u3092\u30D1\u30B9\u306B\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: properties/123456789\uFF09\u3002
|
|
10542
|
+
1. connector_google-analytics-oauth_request \u3067 GET properties/<propertyId>/metadata \u3092\u547C\u3073\u51FA\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u30E1\u30C8\u30EA\u30AF\u30B9\u306E\u4E00\u89A7\u3092\u53D6\u5F97
|
|
10543
|
+
2. connector_google-analytics-oauth_request \u3067 POST properties/<propertyId>:runReport \u3092\u77ED\u3044\u671F\u9593\u3068\u57FA\u672C\u30E1\u30C8\u30EA\u30AF\u30B9\u3067\u547C\u3073\u51FA\u3057\u3001\u30C7\u30FC\u30BF\u306E\u53EF\u7528\u6027\u3092\u78BA\u8A8D`
|
|
10542
10544
|
}
|
|
10543
10545
|
});
|
|
10544
10546
|
|
|
10545
10547
|
// ../connectors/src/connectors/google-analytics-oauth/parameters.ts
|
|
10546
|
-
|
|
10547
|
-
var parameters16 = {
|
|
10548
|
-
propertyId: new ParameterDefinition({
|
|
10549
|
-
slug: "property-id",
|
|
10550
|
-
name: "Default Property ID",
|
|
10551
|
-
description: "Optional default Google Analytics 4 property ID (e.g., 123456789) used when a request does not specify one. Can be found in GA4 Admin > Property Settings. Leave empty to always pass the property ID per request.",
|
|
10552
|
-
envVarBaseKey: "GA_OAUTH_PROPERTY_ID",
|
|
10553
|
-
type: "text",
|
|
10554
|
-
secret: false,
|
|
10555
|
-
required: false
|
|
10556
|
-
})
|
|
10557
|
-
};
|
|
10548
|
+
var parameters16 = {};
|
|
10558
10549
|
|
|
10559
10550
|
// ../connectors/src/connectors/google-analytics-oauth/setup-flow.ts
|
|
10560
10551
|
var ADMIN_BASE_URL4 = "https://analyticsadmin.googleapis.com/v1beta";
|
|
@@ -10861,7 +10852,7 @@ var inputSchema25 = z25.object({
|
|
|
10861
10852
|
connectionId: z25.string().describe("ID of the Google Analytics OAuth connection to use"),
|
|
10862
10853
|
method: z25.enum(["GET", "POST"]).describe("HTTP method"),
|
|
10863
10854
|
path: z25.string().describe(
|
|
10864
|
-
"API path appended to https://analyticsdata.googleapis.com/v1beta/ (e.g., 'properties/123456789:runReport'). Write the numeric property id directly
|
|
10855
|
+
"API path appended to https://analyticsdata.googleapis.com/v1beta/ (e.g., 'properties/123456789:runReport'). Write the numeric property id directly into the path."
|
|
10865
10856
|
),
|
|
10866
10857
|
body: z25.record(z25.string(), z25.unknown()).optional().describe("POST request body (JSON)")
|
|
10867
10858
|
});
|
|
@@ -10880,7 +10871,7 @@ var requestTool4 = new ConnectorTool({
|
|
|
10880
10871
|
name: "request",
|
|
10881
10872
|
description: `Send authenticated requests to the Google Analytics Data API v1beta.
|
|
10882
10873
|
Authentication is handled automatically via OAuth proxy.
|
|
10883
|
-
Write the numeric property id directly into the path (e.g. properties/123456789:runReport)
|
|
10874
|
+
Write the numeric property id directly into the path (e.g. properties/123456789:runReport).`,
|
|
10884
10875
|
inputSchema: inputSchema25,
|
|
10885
10876
|
outputSchema: outputSchema25,
|
|
10886
10877
|
async execute({ connectionId, method, path: path5, body }, connections, config) {
|
|
@@ -10895,9 +10886,7 @@ Write the numeric property id directly into the path (e.g. properties/123456789:
|
|
|
10895
10886
|
`[connector-request] google-analytics-oauth/${connection2.name}: ${method} ${path5}`
|
|
10896
10887
|
);
|
|
10897
10888
|
try {
|
|
10898
|
-
const
|
|
10899
|
-
const resolvedPath = propertyId ? path5.replace(/\{propertyId\}/g, propertyId) : path5;
|
|
10900
|
-
const url = `${BASE_URL4}${resolvedPath}`;
|
|
10889
|
+
const url = `${BASE_URL4}${path5}`;
|
|
10901
10890
|
const token = await getProxyToken8(config.oauthProxy);
|
|
10902
10891
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
10903
10892
|
const controller = new AbortController();
|
|
@@ -10967,7 +10956,7 @@ var googleAnalyticsOauthConnector = new ConnectorPlugin({
|
|
|
10967
10956
|
systemPrompt: {
|
|
10968
10957
|
en: `### Tools
|
|
10969
10958
|
|
|
10970
|
-
- \`connector_google-analytics-oauth_request\`: Send authenticated requests to the GA4 Data API. Use it for running reports, getting metadata, and realtime reports. Write the target property into the path as \`properties/{numericPropertyId}
|
|
10959
|
+
- \`connector_google-analytics-oauth_request\`: Send authenticated requests to the GA4 Data API. Use it for running reports, getting metadata, and realtime reports. Write the target property into the path as \`properties/{numericPropertyId}\`. Authentication is configured automatically via OAuth.
|
|
10971
10960
|
- \`connector_google-analytics-oauth_listAccounts\`: List accessible Google Analytics accounts. Use during setup to discover available accounts.
|
|
10972
10961
|
- \`connector_google-analytics-oauth_listProperties\`: List GA4 properties for a given account. Use during setup to select the target property.
|
|
10973
10962
|
|
|
@@ -11003,12 +10992,12 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
11003
10992
|
The business logic type for this connector is "typescript". Write handler code using the connector SDK shown below. Do NOT access credentials directly from environment variables and do NOT read \`INTERNAL_SQUADBASE_*\` env vars \u2014 the SDK takes care of OAuth.
|
|
11004
10993
|
|
|
11005
10994
|
SDK surface (client created via \`connection(connectionId)\`):
|
|
11006
|
-
- \`client.request
|
|
11007
|
-
- \`client.runReport(request)\` \u2014 run a GA4 report. Set \`propertyId\` (bare numeric id) on the request object to target a property; required when no default is configured.
|
|
10995
|
+
- \`client.runReport(request)\` \u2014 run a GA4 report and get back \`{ rows, rowCount }\` (JSON, already parsed). **This is the primary method \u2014 prefer it over \`request\`.** Pass \`propertyId\` (bare numeric id) on the request object to target a property.
|
|
11008
10996
|
- \`client.runRealtimeReport(request)\` \u2014 run a realtime report. \`propertyId\` works the same as \`runReport\`.
|
|
11009
|
-
- \`client.getMetadata(propertyId
|
|
10997
|
+
- \`client.getMetadata(propertyId)\` \u2014 fetch available dimensions and metrics for a property.
|
|
10998
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch that returns a raw \`Response\` (\`path\` is appended to \`https://analyticsdata.googleapis.com/v1beta/\`; write the numeric property id directly into the path). Only use this for endpoints the convenience methods above do not cover, and remember to \`await res.json()\` yourself.
|
|
11010
10999
|
|
|
11011
|
-
|
|
11000
|
+
**\`propertyId\` is required on every call** \u2014 pass the numeric id from the data overview. A GA connection can span multiple properties, so there is no stored default.
|
|
11012
11001
|
|
|
11013
11002
|
If a handler test fails with \`Connection proxy is not configured\`, retry \u2014 the sandbox is still initializing. Do NOT abandon the SDK and construct OAuth proxy URLs manually.
|
|
11014
11003
|
|
|
@@ -11044,7 +11033,7 @@ const data = await res.json();
|
|
|
11044
11033
|
\`\`\``,
|
|
11045
11034
|
ja: `### \u30C4\u30FC\u30EB
|
|
11046
11035
|
|
|
11047
|
-
- \`connector_google-analytics-oauth_request\`: GA4 Data API\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u3001\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u306F\u30D1\u30B9\u306B \`properties/{\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID}\` \u306E\u5F62\u3067\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\
|
|
11036
|
+
- \`connector_google-analytics-oauth_request\`: GA4 Data API\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u3001\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u306F\u30D1\u30B9\u306B \`properties/{\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID}\` \u306E\u5F62\u3067\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
11048
11037
|
- \`connector_google-analytics-oauth_listAccounts\`: \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Analytics\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u5229\u7528\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u78BA\u8A8D\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
11049
11038
|
- \`connector_google-analytics-oauth_listProperties\`: \u6307\u5B9A\u30A2\u30AB\u30A6\u30F3\u30C8\u306EGA4\u30D7\u30ED\u30D1\u30C6\u30A3\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u30BF\u30FC\u30B2\u30C3\u30C8\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
11050
11039
|
|
|
@@ -11080,12 +11069,12 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
11080
11069
|
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BF SDK \u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\`INTERNAL_SQUADBASE_*\` \u306E\u74B0\u5883\u5909\u6570\u3092\u4F7F\u3063\u3066\u624B\u52D5\u3067 OAuth \u30D7\u30ED\u30AD\u30B7\u3092\u53E9\u304F\u3053\u3068\u3082\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044 \u2014 SDK \u304C OAuth \u3092\u51E6\u7406\u3057\u307E\u3059\u3002
|
|
11081
11070
|
|
|
11082
11071
|
SDK\uFF08\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\uFF09:
|
|
11083
|
-
- \`client.request
|
|
11084
|
-
- \`client.runReport(request)\` \u2014 GA4 \u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3002\u30EA\u30AF\u30A8\u30B9\u30C8\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B \`propertyId\`\uFF08\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09\u3092\u6307\u5B9A\u3057\u3066\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u6C7A\u3081\u307E\u3059\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u672A\u8A2D\u5B9A\u306E\u5834\u5408\u306F\u5FC5\u9808\u3067\u3059\u3002
|
|
11072
|
+
- \`client.runReport(request)\` \u2014 GA4 \u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3057\u3001\`{ rows, rowCount }\`\uFF08\u30D1\u30FC\u30B9\u6E08\u307F JSON\uFF09\u3092\u8FD4\u3057\u307E\u3059\u3002**\u3053\u308C\u304C\u4E3B\u8981\u30E1\u30BD\u30C3\u30C9\u3067\u3059 \u2014 \`request\` \u3088\u308A\u512A\u5148\u3057\u3066\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002** \u30EA\u30AF\u30A8\u30B9\u30C8\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B \`propertyId\`\uFF08\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09\u3092\u6307\u5B9A\u3057\u3066\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u6C7A\u3081\u307E\u3059\u3002
|
|
11085
11073
|
- \`client.runRealtimeReport(request)\` \u2014 \u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3002\`propertyId\` \u306E\u6271\u3044\u306F \`runReport\` \u3068\u540C\u3058\u3067\u3059\u3002
|
|
11086
|
-
- \`client.getMetadata(propertyId
|
|
11074
|
+
- \`client.getMetadata(propertyId)\` \u2014 \u6307\u5B9A\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u30E1\u30C8\u30EA\u30AF\u30B9\u3092\u53D6\u5F97\u3002
|
|
11075
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304D fetch\u3002\u751F\u306E \`Response\` \u3092\u8FD4\u3057\u307E\u3059\uFF08\`path\` \u306F \`https://analyticsdata.googleapis.com/v1beta/\` \u306B\u8FFD\u52A0\u3055\u308C\u307E\u3059\u3002\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\u3092\u30D1\u30B9\u306B\u76F4\u63A5\u66F8\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002\u4E0A\u8A18\u306E\u4FBF\u5229\u30E1\u30BD\u30C3\u30C9\u3067\u8CC4\u3048\u306A\u3044\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306E\u5834\u5408\u306E\u307F\u4F7F\u7528\u3057\u3001\`await res.json()\` \u306F\u81EA\u5206\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
11087
11076
|
|
|
11088
|
-
**\`propertyId\` \u306F\
|
|
11077
|
+
**\`propertyId\` \u306F\u3059\u3079\u3066\u306E\u547C\u3073\u51FA\u3057\u3067\u5FC5\u9808\u3067\u3059**\uFF08\u30C7\u30FC\u30BF\u6982\u8981\u306B\u8F09\u3063\u3066\u3044\u308B\u6570\u5024ID\uFF09\u3002GA \u306E\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306F\u8907\u6570\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u307E\u305F\u304C\u308B\u3053\u3068\u304C\u3042\u308B\u305F\u3081\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u4FDD\u5B58\u3055\u308C\u307E\u305B\u3093\u3002
|
|
11089
11078
|
|
|
11090
11079
|
\u30CF\u30F3\u30C9\u30E9\u306E\u30C6\u30B9\u30C8\u304C \`Connection proxy is not configured\` \u3067\u5931\u6557\u3059\u308B\u5834\u5408\u306F\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u901A\u5E38\u306F\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306E\u521D\u671F\u5316\u4E2D\u306B\u8D77\u304D\u307E\u3059\u3002SDK \u3092\u8AE6\u3081\u3066 OAuth \u30D7\u30ED\u30AD\u30B7\u306E URL \u3092\u81EA\u5206\u3067\u7D44\u307F\u7ACB\u3066\u308B\u3053\u3068\u306F **\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044**\u3002
|
|
11091
11080
|
|
|
@@ -11122,13 +11111,9 @@ const data = await res.json();
|
|
|
11122
11111
|
},
|
|
11123
11112
|
tools: tools16,
|
|
11124
11113
|
setup: (params, ctx, config) => runSetupFlow(googleAnalyticsOauthSetupFlow, params, ctx, config),
|
|
11125
|
-
async checkConnection(
|
|
11114
|
+
async checkConnection(_params, config) {
|
|
11126
11115
|
const { proxyFetch } = config;
|
|
11127
|
-
const
|
|
11128
|
-
if (!propertyId) {
|
|
11129
|
-
return { success: true };
|
|
11130
|
-
}
|
|
11131
|
-
const url = `https://analyticsdata.googleapis.com/v1beta/properties/${propertyId}/metadata`;
|
|
11116
|
+
const url = "https://analyticsadmin.googleapis.com/v1beta/accountSummaries";
|
|
11132
11117
|
try {
|
|
11133
11118
|
const res = await proxyFetch(url, { method: "GET" });
|
|
11134
11119
|
if (!res.ok) {
|
package/dist/main.js
CHANGED
|
@@ -10505,11 +10505,11 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10505
10505
|
- \u30A2\u30AB\u30A6\u30F3\u30C8\u304C **1\u4EF6\u306E\u307F**: \`askUserQuestion\` \u306F\u30B9\u30AD\u30C3\u30D7\u3057\u3001\u305D\u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u9078\u629E\u6E08\u307F\u3068\u3057\u3066\u6B21\u3078\u9032\u3080
|
|
10506
10506
|
- \u30A2\u30AB\u30A6\u30F3\u30C8\u304C **0\u4EF6**: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
10507
10507
|
3. \`${listPropertiesToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u9078\u629E\u3055\u308C\u305F\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
10508
|
-
4.
|
|
10509
|
-
- \`
|
|
10510
|
-
-
|
|
10511
|
-
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **0\u4EF6
|
|
10512
|
-
5. \
|
|
10508
|
+
4. \u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u9078\u629E:
|
|
10509
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **2\u4EF6\u4EE5\u4E0A**: \u300C\u4F7F\u7528\u3059\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u300D\u3068\u30E6\u30FC\u30B6\u30FC\u306B\u4F1D\u3048\u305F\u4E0A\u3067\u3001\`askUserQuestion\` \u3092\u547C\u3073\u51FA\u3059\uFF08\`options\`: \u5404 option \u306E \`label\` \u306F \`\u8868\u793A\u540D (id: \u30D7\u30ED\u30D1\u30C6\u30A3ID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09
|
|
10510
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **1\u4EF6\u306E\u307F**: \`askUserQuestion\` \u306F\u30B9\u30AD\u30C3\u30D7\u3057\u3001\u305D\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u6E08\u307F\u3068\u3057\u3066\u6B21\u3078\u9032\u3080
|
|
10511
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **0\u4EF6**: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
10512
|
+
5. \u9078\u629E\u3055\u308C\u305F\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF08\u6570\u5024\uFF09\u306F\u4EE5\u964D\u306E\u30EA\u30AF\u30A8\u30B9\u30C8\u3067\u30D1\u30B9\u306B\u76F4\u63A5\u6307\u5B9A\u3059\u308B\uFF08\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306B\u306F\u4FDD\u5B58\u3055\u308C\u306A\u3044\uFF09\u3002\u6B21\u306E\u30B9\u30C6\u30C3\u30D7\u306B\u9032\u3080
|
|
10513
10513
|
|
|
10514
10514
|
#### \u5236\u7D04
|
|
10515
10515
|
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30EC\u30DD\u30FC\u30C8\u30C7\u30FC\u30BF\u3092\u53D6\u5F97\u3057\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u624B\u9806\u3067\u6307\u5B9A\u3055\u308C\u305F\u30E1\u30BF\u30C7\u30FC\u30BF\u53D6\u5F97\u306E\u307F
|
|
@@ -10523,11 +10523,11 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10523
10523
|
- **Only 1 account**: Skip \`askUserQuestion\` and proceed using that account as the selection
|
|
10524
10524
|
- **0 accounts**: Abort setup and inform the user that no accessible accounts are available
|
|
10525
10525
|
3. Call \`${listPropertiesToolName}\` to get the list of properties for the selected account
|
|
10526
|
-
4.
|
|
10527
|
-
- \`
|
|
10528
|
-
-
|
|
10529
|
-
-
|
|
10530
|
-
5.
|
|
10526
|
+
4. Select a property:
|
|
10527
|
+
- **2 or more properties**: Tell the user "Please select a property.", then call \`askUserQuestion\` (\`options\`: each option's \`label\` should be \`Display Name (id: propertyId)\`, \`value\` should be the property ID)
|
|
10528
|
+
- **Only 1 property**: Skip \`askUserQuestion\` and proceed using that property as the selection
|
|
10529
|
+
- **0 properties**: Abort setup and inform the user that no accessible properties are available
|
|
10530
|
+
5. Write the selected numeric property id directly into the request path (it is not stored on the connection). Proceed to the next step
|
|
10531
10531
|
|
|
10532
10532
|
#### Constraints
|
|
10533
10533
|
- **Do NOT fetch report data during setup**. Only the metadata requests specified in the steps above are allowed
|
|
@@ -10535,26 +10535,17 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10535
10535
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
10536
10536
|
},
|
|
10537
10537
|
dataOverviewInstructions: {
|
|
10538
|
-
en: `
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10538
|
+
en: `Use the selected numeric property id in the path (write it directly, e.g. properties/123456789).
|
|
10539
|
+
1. Call connector_google-analytics-oauth_request with GET properties/<propertyId>/metadata to list available dimensions and metrics
|
|
10540
|
+
2. Call connector_google-analytics-oauth_request with POST properties/<propertyId>:runReport using a small date range and basic metrics to verify data availability`,
|
|
10541
|
+
ja: `\u9078\u629E\u3057\u305F\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\u3092\u30D1\u30B9\u306B\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: properties/123456789\uFF09\u3002
|
|
10542
|
+
1. connector_google-analytics-oauth_request \u3067 GET properties/<propertyId>/metadata \u3092\u547C\u3073\u51FA\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u30E1\u30C8\u30EA\u30AF\u30B9\u306E\u4E00\u89A7\u3092\u53D6\u5F97
|
|
10543
|
+
2. connector_google-analytics-oauth_request \u3067 POST properties/<propertyId>:runReport \u3092\u77ED\u3044\u671F\u9593\u3068\u57FA\u672C\u30E1\u30C8\u30EA\u30AF\u30B9\u3067\u547C\u3073\u51FA\u3057\u3001\u30C7\u30FC\u30BF\u306E\u53EF\u7528\u6027\u3092\u78BA\u8A8D`
|
|
10542
10544
|
}
|
|
10543
10545
|
});
|
|
10544
10546
|
|
|
10545
10547
|
// ../connectors/src/connectors/google-analytics-oauth/parameters.ts
|
|
10546
|
-
|
|
10547
|
-
var parameters16 = {
|
|
10548
|
-
propertyId: new ParameterDefinition({
|
|
10549
|
-
slug: "property-id",
|
|
10550
|
-
name: "Default Property ID",
|
|
10551
|
-
description: "Optional default Google Analytics 4 property ID (e.g., 123456789) used when a request does not specify one. Can be found in GA4 Admin > Property Settings. Leave empty to always pass the property ID per request.",
|
|
10552
|
-
envVarBaseKey: "GA_OAUTH_PROPERTY_ID",
|
|
10553
|
-
type: "text",
|
|
10554
|
-
secret: false,
|
|
10555
|
-
required: false
|
|
10556
|
-
})
|
|
10557
|
-
};
|
|
10548
|
+
var parameters16 = {};
|
|
10558
10549
|
|
|
10559
10550
|
// ../connectors/src/connectors/google-analytics-oauth/setup-flow.ts
|
|
10560
10551
|
var ADMIN_BASE_URL4 = "https://analyticsadmin.googleapis.com/v1beta";
|
|
@@ -10861,7 +10852,7 @@ var inputSchema25 = z25.object({
|
|
|
10861
10852
|
connectionId: z25.string().describe("ID of the Google Analytics OAuth connection to use"),
|
|
10862
10853
|
method: z25.enum(["GET", "POST"]).describe("HTTP method"),
|
|
10863
10854
|
path: z25.string().describe(
|
|
10864
|
-
"API path appended to https://analyticsdata.googleapis.com/v1beta/ (e.g., 'properties/123456789:runReport'). Write the numeric property id directly
|
|
10855
|
+
"API path appended to https://analyticsdata.googleapis.com/v1beta/ (e.g., 'properties/123456789:runReport'). Write the numeric property id directly into the path."
|
|
10865
10856
|
),
|
|
10866
10857
|
body: z25.record(z25.string(), z25.unknown()).optional().describe("POST request body (JSON)")
|
|
10867
10858
|
});
|
|
@@ -10880,7 +10871,7 @@ var requestTool4 = new ConnectorTool({
|
|
|
10880
10871
|
name: "request",
|
|
10881
10872
|
description: `Send authenticated requests to the Google Analytics Data API v1beta.
|
|
10882
10873
|
Authentication is handled automatically via OAuth proxy.
|
|
10883
|
-
Write the numeric property id directly into the path (e.g. properties/123456789:runReport)
|
|
10874
|
+
Write the numeric property id directly into the path (e.g. properties/123456789:runReport).`,
|
|
10884
10875
|
inputSchema: inputSchema25,
|
|
10885
10876
|
outputSchema: outputSchema25,
|
|
10886
10877
|
async execute({ connectionId, method, path: path6, body }, connections, config) {
|
|
@@ -10895,9 +10886,7 @@ Write the numeric property id directly into the path (e.g. properties/123456789:
|
|
|
10895
10886
|
`[connector-request] google-analytics-oauth/${connection2.name}: ${method} ${path6}`
|
|
10896
10887
|
);
|
|
10897
10888
|
try {
|
|
10898
|
-
const
|
|
10899
|
-
const resolvedPath = propertyId ? path6.replace(/\{propertyId\}/g, propertyId) : path6;
|
|
10900
|
-
const url = `${BASE_URL4}${resolvedPath}`;
|
|
10889
|
+
const url = `${BASE_URL4}${path6}`;
|
|
10901
10890
|
const token = await getProxyToken8(config.oauthProxy);
|
|
10902
10891
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
10903
10892
|
const controller = new AbortController();
|
|
@@ -10967,7 +10956,7 @@ var googleAnalyticsOauthConnector = new ConnectorPlugin({
|
|
|
10967
10956
|
systemPrompt: {
|
|
10968
10957
|
en: `### Tools
|
|
10969
10958
|
|
|
10970
|
-
- \`connector_google-analytics-oauth_request\`: Send authenticated requests to the GA4 Data API. Use it for running reports, getting metadata, and realtime reports. Write the target property into the path as \`properties/{numericPropertyId}
|
|
10959
|
+
- \`connector_google-analytics-oauth_request\`: Send authenticated requests to the GA4 Data API. Use it for running reports, getting metadata, and realtime reports. Write the target property into the path as \`properties/{numericPropertyId}\`. Authentication is configured automatically via OAuth.
|
|
10971
10960
|
- \`connector_google-analytics-oauth_listAccounts\`: List accessible Google Analytics accounts. Use during setup to discover available accounts.
|
|
10972
10961
|
- \`connector_google-analytics-oauth_listProperties\`: List GA4 properties for a given account. Use during setup to select the target property.
|
|
10973
10962
|
|
|
@@ -11003,12 +10992,12 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
11003
10992
|
The business logic type for this connector is "typescript". Write handler code using the connector SDK shown below. Do NOT access credentials directly from environment variables and do NOT read \`INTERNAL_SQUADBASE_*\` env vars \u2014 the SDK takes care of OAuth.
|
|
11004
10993
|
|
|
11005
10994
|
SDK surface (client created via \`connection(connectionId)\`):
|
|
11006
|
-
- \`client.request
|
|
11007
|
-
- \`client.runReport(request)\` \u2014 run a GA4 report. Set \`propertyId\` (bare numeric id) on the request object to target a property; required when no default is configured.
|
|
10995
|
+
- \`client.runReport(request)\` \u2014 run a GA4 report and get back \`{ rows, rowCount }\` (JSON, already parsed). **This is the primary method \u2014 prefer it over \`request\`.** Pass \`propertyId\` (bare numeric id) on the request object to target a property.
|
|
11008
10996
|
- \`client.runRealtimeReport(request)\` \u2014 run a realtime report. \`propertyId\` works the same as \`runReport\`.
|
|
11009
|
-
- \`client.getMetadata(propertyId
|
|
10997
|
+
- \`client.getMetadata(propertyId)\` \u2014 fetch available dimensions and metrics for a property.
|
|
10998
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch that returns a raw \`Response\` (\`path\` is appended to \`https://analyticsdata.googleapis.com/v1beta/\`; write the numeric property id directly into the path). Only use this for endpoints the convenience methods above do not cover, and remember to \`await res.json()\` yourself.
|
|
11010
10999
|
|
|
11011
|
-
|
|
11000
|
+
**\`propertyId\` is required on every call** \u2014 pass the numeric id from the data overview. A GA connection can span multiple properties, so there is no stored default.
|
|
11012
11001
|
|
|
11013
11002
|
If a handler test fails with \`Connection proxy is not configured\`, retry \u2014 the sandbox is still initializing. Do NOT abandon the SDK and construct OAuth proxy URLs manually.
|
|
11014
11003
|
|
|
@@ -11044,7 +11033,7 @@ const data = await res.json();
|
|
|
11044
11033
|
\`\`\``,
|
|
11045
11034
|
ja: `### \u30C4\u30FC\u30EB
|
|
11046
11035
|
|
|
11047
|
-
- \`connector_google-analytics-oauth_request\`: GA4 Data API\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u3001\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u306F\u30D1\u30B9\u306B \`properties/{\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID}\` \u306E\u5F62\u3067\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\
|
|
11036
|
+
- \`connector_google-analytics-oauth_request\`: GA4 Data API\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u3001\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u306F\u30D1\u30B9\u306B \`properties/{\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID}\` \u306E\u5F62\u3067\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
11048
11037
|
- \`connector_google-analytics-oauth_listAccounts\`: \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Analytics\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u5229\u7528\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u78BA\u8A8D\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
11049
11038
|
- \`connector_google-analytics-oauth_listProperties\`: \u6307\u5B9A\u30A2\u30AB\u30A6\u30F3\u30C8\u306EGA4\u30D7\u30ED\u30D1\u30C6\u30A3\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u30BF\u30FC\u30B2\u30C3\u30C8\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
11050
11039
|
|
|
@@ -11080,12 +11069,12 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
11080
11069
|
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BF SDK \u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\`INTERNAL_SQUADBASE_*\` \u306E\u74B0\u5883\u5909\u6570\u3092\u4F7F\u3063\u3066\u624B\u52D5\u3067 OAuth \u30D7\u30ED\u30AD\u30B7\u3092\u53E9\u304F\u3053\u3068\u3082\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044 \u2014 SDK \u304C OAuth \u3092\u51E6\u7406\u3057\u307E\u3059\u3002
|
|
11081
11070
|
|
|
11082
11071
|
SDK\uFF08\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\uFF09:
|
|
11083
|
-
- \`client.request
|
|
11084
|
-
- \`client.runReport(request)\` \u2014 GA4 \u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3002\u30EA\u30AF\u30A8\u30B9\u30C8\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B \`propertyId\`\uFF08\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09\u3092\u6307\u5B9A\u3057\u3066\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u6C7A\u3081\u307E\u3059\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u672A\u8A2D\u5B9A\u306E\u5834\u5408\u306F\u5FC5\u9808\u3067\u3059\u3002
|
|
11072
|
+
- \`client.runReport(request)\` \u2014 GA4 \u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3057\u3001\`{ rows, rowCount }\`\uFF08\u30D1\u30FC\u30B9\u6E08\u307F JSON\uFF09\u3092\u8FD4\u3057\u307E\u3059\u3002**\u3053\u308C\u304C\u4E3B\u8981\u30E1\u30BD\u30C3\u30C9\u3067\u3059 \u2014 \`request\` \u3088\u308A\u512A\u5148\u3057\u3066\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002** \u30EA\u30AF\u30A8\u30B9\u30C8\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B \`propertyId\`\uFF08\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09\u3092\u6307\u5B9A\u3057\u3066\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u6C7A\u3081\u307E\u3059\u3002
|
|
11085
11073
|
- \`client.runRealtimeReport(request)\` \u2014 \u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3002\`propertyId\` \u306E\u6271\u3044\u306F \`runReport\` \u3068\u540C\u3058\u3067\u3059\u3002
|
|
11086
|
-
- \`client.getMetadata(propertyId
|
|
11074
|
+
- \`client.getMetadata(propertyId)\` \u2014 \u6307\u5B9A\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u30E1\u30C8\u30EA\u30AF\u30B9\u3092\u53D6\u5F97\u3002
|
|
11075
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304D fetch\u3002\u751F\u306E \`Response\` \u3092\u8FD4\u3057\u307E\u3059\uFF08\`path\` \u306F \`https://analyticsdata.googleapis.com/v1beta/\` \u306B\u8FFD\u52A0\u3055\u308C\u307E\u3059\u3002\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\u3092\u30D1\u30B9\u306B\u76F4\u63A5\u66F8\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002\u4E0A\u8A18\u306E\u4FBF\u5229\u30E1\u30BD\u30C3\u30C9\u3067\u8CC4\u3048\u306A\u3044\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306E\u5834\u5408\u306E\u307F\u4F7F\u7528\u3057\u3001\`await res.json()\` \u306F\u81EA\u5206\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
11087
11076
|
|
|
11088
|
-
**\`propertyId\` \u306F\
|
|
11077
|
+
**\`propertyId\` \u306F\u3059\u3079\u3066\u306E\u547C\u3073\u51FA\u3057\u3067\u5FC5\u9808\u3067\u3059**\uFF08\u30C7\u30FC\u30BF\u6982\u8981\u306B\u8F09\u3063\u3066\u3044\u308B\u6570\u5024ID\uFF09\u3002GA \u306E\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306F\u8907\u6570\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u307E\u305F\u304C\u308B\u3053\u3068\u304C\u3042\u308B\u305F\u3081\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u4FDD\u5B58\u3055\u308C\u307E\u305B\u3093\u3002
|
|
11089
11078
|
|
|
11090
11079
|
\u30CF\u30F3\u30C9\u30E9\u306E\u30C6\u30B9\u30C8\u304C \`Connection proxy is not configured\` \u3067\u5931\u6557\u3059\u308B\u5834\u5408\u306F\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u901A\u5E38\u306F\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306E\u521D\u671F\u5316\u4E2D\u306B\u8D77\u304D\u307E\u3059\u3002SDK \u3092\u8AE6\u3081\u3066 OAuth \u30D7\u30ED\u30AD\u30B7\u306E URL \u3092\u81EA\u5206\u3067\u7D44\u307F\u7ACB\u3066\u308B\u3053\u3068\u306F **\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044**\u3002
|
|
11091
11080
|
|
|
@@ -11122,13 +11111,9 @@ const data = await res.json();
|
|
|
11122
11111
|
},
|
|
11123
11112
|
tools: tools16,
|
|
11124
11113
|
setup: (params, ctx, config) => runSetupFlow(googleAnalyticsOauthSetupFlow, params, ctx, config),
|
|
11125
|
-
async checkConnection(
|
|
11114
|
+
async checkConnection(_params, config) {
|
|
11126
11115
|
const { proxyFetch } = config;
|
|
11127
|
-
const
|
|
11128
|
-
if (!propertyId) {
|
|
11129
|
-
return { success: true };
|
|
11130
|
-
}
|
|
11131
|
-
const url = `https://analyticsdata.googleapis.com/v1beta/properties/${propertyId}/metadata`;
|
|
11116
|
+
const url = "https://analyticsadmin.googleapis.com/v1beta/accountSummaries";
|
|
11132
11117
|
try {
|
|
11133
11118
|
const res = await proxyFetch(url, { method: "GET" });
|
|
11134
11119
|
if (!res.ok) {
|
package/dist/vite-plugin.js
CHANGED
|
@@ -10507,11 +10507,11 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10507
10507
|
- \u30A2\u30AB\u30A6\u30F3\u30C8\u304C **1\u4EF6\u306E\u307F**: \`askUserQuestion\` \u306F\u30B9\u30AD\u30C3\u30D7\u3057\u3001\u305D\u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u9078\u629E\u6E08\u307F\u3068\u3057\u3066\u6B21\u3078\u9032\u3080
|
|
10508
10508
|
- \u30A2\u30AB\u30A6\u30F3\u30C8\u304C **0\u4EF6**: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
10509
10509
|
3. \`${listPropertiesToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u9078\u629E\u3055\u308C\u305F\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
|
|
10510
|
-
4.
|
|
10511
|
-
- \`
|
|
10512
|
-
-
|
|
10513
|
-
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **0\u4EF6
|
|
10514
|
-
5. \
|
|
10510
|
+
4. \u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u9078\u629E:
|
|
10511
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **2\u4EF6\u4EE5\u4E0A**: \u300C\u4F7F\u7528\u3059\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u300D\u3068\u30E6\u30FC\u30B6\u30FC\u306B\u4F1D\u3048\u305F\u4E0A\u3067\u3001\`askUserQuestion\` \u3092\u547C\u3073\u51FA\u3059\uFF08\`options\`: \u5404 option \u306E \`label\` \u306F \`\u8868\u793A\u540D (id: \u30D7\u30ED\u30D1\u30C6\u30A3ID)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09
|
|
10512
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **1\u4EF6\u306E\u307F**: \`askUserQuestion\` \u306F\u30B9\u30AD\u30C3\u30D7\u3057\u3001\u305D\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u6E08\u307F\u3068\u3057\u3066\u6B21\u3078\u9032\u3080
|
|
10513
|
+
- \u30D7\u30ED\u30D1\u30C6\u30A3\u304C **0\u4EF6**: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u4E2D\u65AD\u3057\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u306A\u3044\u65E8\u3092\u4F1D\u3048\u308B
|
|
10514
|
+
5. \u9078\u629E\u3055\u308C\u305F\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF08\u6570\u5024\uFF09\u306F\u4EE5\u964D\u306E\u30EA\u30AF\u30A8\u30B9\u30C8\u3067\u30D1\u30B9\u306B\u76F4\u63A5\u6307\u5B9A\u3059\u308B\uFF08\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306B\u306F\u4FDD\u5B58\u3055\u308C\u306A\u3044\uFF09\u3002\u6B21\u306E\u30B9\u30C6\u30C3\u30D7\u306B\u9032\u3080
|
|
10515
10515
|
|
|
10516
10516
|
#### \u5236\u7D04
|
|
10517
10517
|
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30EC\u30DD\u30FC\u30C8\u30C7\u30FC\u30BF\u3092\u53D6\u5F97\u3057\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u624B\u9806\u3067\u6307\u5B9A\u3055\u308C\u305F\u30E1\u30BF\u30C7\u30FC\u30BF\u53D6\u5F97\u306E\u307F
|
|
@@ -10525,11 +10525,11 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10525
10525
|
- **Only 1 account**: Skip \`askUserQuestion\` and proceed using that account as the selection
|
|
10526
10526
|
- **0 accounts**: Abort setup and inform the user that no accessible accounts are available
|
|
10527
10527
|
3. Call \`${listPropertiesToolName}\` to get the list of properties for the selected account
|
|
10528
|
-
4.
|
|
10529
|
-
- \`
|
|
10530
|
-
-
|
|
10531
|
-
-
|
|
10532
|
-
5.
|
|
10528
|
+
4. Select a property:
|
|
10529
|
+
- **2 or more properties**: Tell the user "Please select a property.", then call \`askUserQuestion\` (\`options\`: each option's \`label\` should be \`Display Name (id: propertyId)\`, \`value\` should be the property ID)
|
|
10530
|
+
- **Only 1 property**: Skip \`askUserQuestion\` and proceed using that property as the selection
|
|
10531
|
+
- **0 properties**: Abort setup and inform the user that no accessible properties are available
|
|
10532
|
+
5. Write the selected numeric property id directly into the request path (it is not stored on the connection). Proceed to the next step
|
|
10533
10533
|
|
|
10534
10534
|
#### Constraints
|
|
10535
10535
|
- **Do NOT fetch report data during setup**. Only the metadata requests specified in the steps above are allowed
|
|
@@ -10537,26 +10537,17 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
10537
10537
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
10538
10538
|
},
|
|
10539
10539
|
dataOverviewInstructions: {
|
|
10540
|
-
en: `
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10540
|
+
en: `Use the selected numeric property id in the path (write it directly, e.g. properties/123456789).
|
|
10541
|
+
1. Call connector_google-analytics-oauth_request with GET properties/<propertyId>/metadata to list available dimensions and metrics
|
|
10542
|
+
2. Call connector_google-analytics-oauth_request with POST properties/<propertyId>:runReport using a small date range and basic metrics to verify data availability`,
|
|
10543
|
+
ja: `\u9078\u629E\u3057\u305F\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\u3092\u30D1\u30B9\u306B\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: properties/123456789\uFF09\u3002
|
|
10544
|
+
1. connector_google-analytics-oauth_request \u3067 GET properties/<propertyId>/metadata \u3092\u547C\u3073\u51FA\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u30E1\u30C8\u30EA\u30AF\u30B9\u306E\u4E00\u89A7\u3092\u53D6\u5F97
|
|
10545
|
+
2. connector_google-analytics-oauth_request \u3067 POST properties/<propertyId>:runReport \u3092\u77ED\u3044\u671F\u9593\u3068\u57FA\u672C\u30E1\u30C8\u30EA\u30AF\u30B9\u3067\u547C\u3073\u51FA\u3057\u3001\u30C7\u30FC\u30BF\u306E\u53EF\u7528\u6027\u3092\u78BA\u8A8D`
|
|
10544
10546
|
}
|
|
10545
10547
|
});
|
|
10546
10548
|
|
|
10547
10549
|
// ../connectors/src/connectors/google-analytics-oauth/parameters.ts
|
|
10548
|
-
|
|
10549
|
-
var parameters16 = {
|
|
10550
|
-
propertyId: new ParameterDefinition({
|
|
10551
|
-
slug: "property-id",
|
|
10552
|
-
name: "Default Property ID",
|
|
10553
|
-
description: "Optional default Google Analytics 4 property ID (e.g., 123456789) used when a request does not specify one. Can be found in GA4 Admin > Property Settings. Leave empty to always pass the property ID per request.",
|
|
10554
|
-
envVarBaseKey: "GA_OAUTH_PROPERTY_ID",
|
|
10555
|
-
type: "text",
|
|
10556
|
-
secret: false,
|
|
10557
|
-
required: false
|
|
10558
|
-
})
|
|
10559
|
-
};
|
|
10550
|
+
var parameters16 = {};
|
|
10560
10551
|
|
|
10561
10552
|
// ../connectors/src/connectors/google-analytics-oauth/setup-flow.ts
|
|
10562
10553
|
var ADMIN_BASE_URL4 = "https://analyticsadmin.googleapis.com/v1beta";
|
|
@@ -10863,7 +10854,7 @@ var inputSchema25 = z25.object({
|
|
|
10863
10854
|
connectionId: z25.string().describe("ID of the Google Analytics OAuth connection to use"),
|
|
10864
10855
|
method: z25.enum(["GET", "POST"]).describe("HTTP method"),
|
|
10865
10856
|
path: z25.string().describe(
|
|
10866
|
-
"API path appended to https://analyticsdata.googleapis.com/v1beta/ (e.g., 'properties/123456789:runReport'). Write the numeric property id directly
|
|
10857
|
+
"API path appended to https://analyticsdata.googleapis.com/v1beta/ (e.g., 'properties/123456789:runReport'). Write the numeric property id directly into the path."
|
|
10867
10858
|
),
|
|
10868
10859
|
body: z25.record(z25.string(), z25.unknown()).optional().describe("POST request body (JSON)")
|
|
10869
10860
|
});
|
|
@@ -10882,7 +10873,7 @@ var requestTool4 = new ConnectorTool({
|
|
|
10882
10873
|
name: "request",
|
|
10883
10874
|
description: `Send authenticated requests to the Google Analytics Data API v1beta.
|
|
10884
10875
|
Authentication is handled automatically via OAuth proxy.
|
|
10885
|
-
Write the numeric property id directly into the path (e.g. properties/123456789:runReport)
|
|
10876
|
+
Write the numeric property id directly into the path (e.g. properties/123456789:runReport).`,
|
|
10886
10877
|
inputSchema: inputSchema25,
|
|
10887
10878
|
outputSchema: outputSchema25,
|
|
10888
10879
|
async execute({ connectionId, method, path: path4, body }, connections, config) {
|
|
@@ -10897,9 +10888,7 @@ Write the numeric property id directly into the path (e.g. properties/123456789:
|
|
|
10897
10888
|
`[connector-request] google-analytics-oauth/${connection.name}: ${method} ${path4}`
|
|
10898
10889
|
);
|
|
10899
10890
|
try {
|
|
10900
|
-
const
|
|
10901
|
-
const resolvedPath = propertyId ? path4.replace(/\{propertyId\}/g, propertyId) : path4;
|
|
10902
|
-
const url = `${BASE_URL4}${resolvedPath}`;
|
|
10891
|
+
const url = `${BASE_URL4}${path4}`;
|
|
10903
10892
|
const token = await getProxyToken8(config.oauthProxy);
|
|
10904
10893
|
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
10905
10894
|
const controller = new AbortController();
|
|
@@ -10969,7 +10958,7 @@ var googleAnalyticsOauthConnector = new ConnectorPlugin({
|
|
|
10969
10958
|
systemPrompt: {
|
|
10970
10959
|
en: `### Tools
|
|
10971
10960
|
|
|
10972
|
-
- \`connector_google-analytics-oauth_request\`: Send authenticated requests to the GA4 Data API. Use it for running reports, getting metadata, and realtime reports. Write the target property into the path as \`properties/{numericPropertyId}
|
|
10961
|
+
- \`connector_google-analytics-oauth_request\`: Send authenticated requests to the GA4 Data API. Use it for running reports, getting metadata, and realtime reports. Write the target property into the path as \`properties/{numericPropertyId}\`. Authentication is configured automatically via OAuth.
|
|
10973
10962
|
- \`connector_google-analytics-oauth_listAccounts\`: List accessible Google Analytics accounts. Use during setup to discover available accounts.
|
|
10974
10963
|
- \`connector_google-analytics-oauth_listProperties\`: List GA4 properties for a given account. Use during setup to select the target property.
|
|
10975
10964
|
|
|
@@ -11005,12 +10994,12 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
11005
10994
|
The business logic type for this connector is "typescript". Write handler code using the connector SDK shown below. Do NOT access credentials directly from environment variables and do NOT read \`INTERNAL_SQUADBASE_*\` env vars \u2014 the SDK takes care of OAuth.
|
|
11006
10995
|
|
|
11007
10996
|
SDK surface (client created via \`connection(connectionId)\`):
|
|
11008
|
-
- \`client.request
|
|
11009
|
-
- \`client.runReport(request)\` \u2014 run a GA4 report. Set \`propertyId\` (bare numeric id) on the request object to target a property; required when no default is configured.
|
|
10997
|
+
- \`client.runReport(request)\` \u2014 run a GA4 report and get back \`{ rows, rowCount }\` (JSON, already parsed). **This is the primary method \u2014 prefer it over \`request\`.** Pass \`propertyId\` (bare numeric id) on the request object to target a property.
|
|
11010
10998
|
- \`client.runRealtimeReport(request)\` \u2014 run a realtime report. \`propertyId\` works the same as \`runReport\`.
|
|
11011
|
-
- \`client.getMetadata(propertyId
|
|
10999
|
+
- \`client.getMetadata(propertyId)\` \u2014 fetch available dimensions and metrics for a property.
|
|
11000
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch that returns a raw \`Response\` (\`path\` is appended to \`https://analyticsdata.googleapis.com/v1beta/\`; write the numeric property id directly into the path). Only use this for endpoints the convenience methods above do not cover, and remember to \`await res.json()\` yourself.
|
|
11012
11001
|
|
|
11013
|
-
|
|
11002
|
+
**\`propertyId\` is required on every call** \u2014 pass the numeric id from the data overview. A GA connection can span multiple properties, so there is no stored default.
|
|
11014
11003
|
|
|
11015
11004
|
If a handler test fails with \`Connection proxy is not configured\`, retry \u2014 the sandbox is still initializing. Do NOT abandon the SDK and construct OAuth proxy URLs manually.
|
|
11016
11005
|
|
|
@@ -11046,7 +11035,7 @@ const data = await res.json();
|
|
|
11046
11035
|
\`\`\``,
|
|
11047
11036
|
ja: `### \u30C4\u30FC\u30EB
|
|
11048
11037
|
|
|
11049
|
-
- \`connector_google-analytics-oauth_request\`: GA4 Data API\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u3001\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u306F\u30D1\u30B9\u306B \`properties/{\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID}\` \u306E\u5F62\u3067\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\
|
|
11038
|
+
- \`connector_google-analytics-oauth_request\`: GA4 Data API\u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u3001\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u306F\u30D1\u30B9\u306B \`properties/{\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID}\` \u306E\u5F62\u3067\u76F4\u63A5\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
11050
11039
|
- \`connector_google-analytics-oauth_listAccounts\`: \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306AGoogle Analytics\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u5229\u7528\u53EF\u80FD\u306A\u30A2\u30AB\u30A6\u30F3\u30C8\u3092\u78BA\u8A8D\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
11051
11040
|
- \`connector_google-analytics-oauth_listProperties\`: \u6307\u5B9A\u30A2\u30AB\u30A6\u30F3\u30C8\u306EGA4\u30D7\u30ED\u30D1\u30C6\u30A3\u4E00\u89A7\u3092\u53D6\u5F97\u3057\u307E\u3059\u3002\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306B\u30BF\u30FC\u30B2\u30C3\u30C8\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u9078\u629E\u3059\u308B\u305F\u3081\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
11052
11041
|
|
|
@@ -11082,12 +11071,12 @@ averageSessionDuration, conversions, totalRevenue
|
|
|
11082
11071
|
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BF SDK \u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\`INTERNAL_SQUADBASE_*\` \u306E\u74B0\u5883\u5909\u6570\u3092\u4F7F\u3063\u3066\u624B\u52D5\u3067 OAuth \u30D7\u30ED\u30AD\u30B7\u3092\u53E9\u304F\u3053\u3068\u3082\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044 \u2014 SDK \u304C OAuth \u3092\u51E6\u7406\u3057\u307E\u3059\u3002
|
|
11083
11072
|
|
|
11084
11073
|
SDK\uFF08\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\uFF09:
|
|
11085
|
-
- \`client.request
|
|
11086
|
-
- \`client.runReport(request)\` \u2014 GA4 \u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3002\u30EA\u30AF\u30A8\u30B9\u30C8\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B \`propertyId\`\uFF08\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09\u3092\u6307\u5B9A\u3057\u3066\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u6C7A\u3081\u307E\u3059\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u672A\u8A2D\u5B9A\u306E\u5834\u5408\u306F\u5FC5\u9808\u3067\u3059\u3002
|
|
11074
|
+
- \`client.runReport(request)\` \u2014 GA4 \u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3057\u3001\`{ rows, rowCount }\`\uFF08\u30D1\u30FC\u30B9\u6E08\u307F JSON\uFF09\u3092\u8FD4\u3057\u307E\u3059\u3002**\u3053\u308C\u304C\u4E3B\u8981\u30E1\u30BD\u30C3\u30C9\u3067\u3059 \u2014 \`request\` \u3088\u308A\u512A\u5148\u3057\u3066\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002** \u30EA\u30AF\u30A8\u30B9\u30C8\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B \`propertyId\`\uFF08\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\uFF09\u3092\u6307\u5B9A\u3057\u3066\u5BFE\u8C61\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u6C7A\u3081\u307E\u3059\u3002
|
|
11087
11075
|
- \`client.runRealtimeReport(request)\` \u2014 \u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C\u3002\`propertyId\` \u306E\u6271\u3044\u306F \`runReport\` \u3068\u540C\u3058\u3067\u3059\u3002
|
|
11088
|
-
- \`client.getMetadata(propertyId
|
|
11076
|
+
- \`client.getMetadata(propertyId)\` \u2014 \u6307\u5B9A\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3\u3068\u30E1\u30C8\u30EA\u30AF\u30B9\u3092\u53D6\u5F97\u3002
|
|
11077
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304D fetch\u3002\u751F\u306E \`Response\` \u3092\u8FD4\u3057\u307E\u3059\uFF08\`path\` \u306F \`https://analyticsdata.googleapis.com/v1beta/\` \u306B\u8FFD\u52A0\u3055\u308C\u307E\u3059\u3002\u6570\u5024\u306E\u30D7\u30ED\u30D1\u30C6\u30A3ID\u3092\u30D1\u30B9\u306B\u76F4\u63A5\u66F8\u3044\u3066\u304F\u3060\u3055\u3044\uFF09\u3002\u4E0A\u8A18\u306E\u4FBF\u5229\u30E1\u30BD\u30C3\u30C9\u3067\u8CC4\u3048\u306A\u3044\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u306E\u5834\u5408\u306E\u307F\u4F7F\u7528\u3057\u3001\`await res.json()\` \u306F\u81EA\u5206\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
11089
11078
|
|
|
11090
|
-
**\`propertyId\` \u306F\
|
|
11079
|
+
**\`propertyId\` \u306F\u3059\u3079\u3066\u306E\u547C\u3073\u51FA\u3057\u3067\u5FC5\u9808\u3067\u3059**\uFF08\u30C7\u30FC\u30BF\u6982\u8981\u306B\u8F09\u3063\u3066\u3044\u308B\u6570\u5024ID\uFF09\u3002GA \u306E\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306F\u8907\u6570\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u307E\u305F\u304C\u308B\u3053\u3068\u304C\u3042\u308B\u305F\u3081\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u4FDD\u5B58\u3055\u308C\u307E\u305B\u3093\u3002
|
|
11091
11080
|
|
|
11092
11081
|
\u30CF\u30F3\u30C9\u30E9\u306E\u30C6\u30B9\u30C8\u304C \`Connection proxy is not configured\` \u3067\u5931\u6557\u3059\u308B\u5834\u5408\u306F\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u901A\u5E38\u306F\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306E\u521D\u671F\u5316\u4E2D\u306B\u8D77\u304D\u307E\u3059\u3002SDK \u3092\u8AE6\u3081\u3066 OAuth \u30D7\u30ED\u30AD\u30B7\u306E URL \u3092\u81EA\u5206\u3067\u7D44\u307F\u7ACB\u3066\u308B\u3053\u3068\u306F **\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044**\u3002
|
|
11093
11082
|
|
|
@@ -11124,13 +11113,9 @@ const data = await res.json();
|
|
|
11124
11113
|
},
|
|
11125
11114
|
tools: tools16,
|
|
11126
11115
|
setup: (params, ctx, config) => runSetupFlow(googleAnalyticsOauthSetupFlow, params, ctx, config),
|
|
11127
|
-
async checkConnection(
|
|
11116
|
+
async checkConnection(_params, config) {
|
|
11128
11117
|
const { proxyFetch } = config;
|
|
11129
|
-
const
|
|
11130
|
-
if (!propertyId) {
|
|
11131
|
-
return { success: true };
|
|
11132
|
-
}
|
|
11133
|
-
const url = `https://analyticsdata.googleapis.com/v1beta/properties/${propertyId}/metadata`;
|
|
11118
|
+
const url = "https://analyticsadmin.googleapis.com/v1beta/accountSummaries";
|
|
11134
11119
|
try {
|
|
11135
11120
|
const res = await proxyFetch(url, { method: "GET" });
|
|
11136
11121
|
if (!res.ok) {
|