@squadbase/vite-server 0.1.17-dev.3b633bb → 0.1.17-dev.71a85cd
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 +3310 -742
- package/dist/connectors/airtable-oauth.js +50 -8
- package/dist/connectors/airtable.js +46 -8
- package/dist/connectors/amplitude.js +10 -8
- package/dist/connectors/anthropic.js +4 -2
- package/dist/connectors/asana.js +39 -10
- package/dist/connectors/attio.js +32 -13
- package/dist/connectors/aws-billing.js +10 -8
- package/dist/connectors/azure-sql.js +33 -7
- package/dist/connectors/backlog-api-key.js +42 -15
- package/dist/connectors/clickup.js +52 -10
- package/dist/connectors/cosmosdb.js +14 -12
- package/dist/connectors/customerio.js +10 -8
- package/dist/connectors/dbt.js +688 -25
- package/dist/connectors/freshdesk.js +84 -8
- package/dist/connectors/freshsales.js +10 -8
- package/dist/connectors/freshservice.js +10 -8
- package/dist/connectors/gamma.js +17 -15
- package/dist/connectors/gemini.js +4 -2
- package/dist/connectors/github.js +14 -12
- package/dist/connectors/gmail-oauth.js +10 -10
- package/dist/connectors/gmail.js +6 -4
- package/dist/connectors/google-ads.js +10 -8
- package/dist/connectors/google-analytics-oauth.js +154 -25
- package/dist/connectors/google-analytics.js +536 -109
- package/dist/connectors/google-audit-log.js +6 -4
- package/dist/connectors/google-calendar-oauth.js +63 -15
- package/dist/connectors/google-calendar.js +63 -11
- package/dist/connectors/google-docs.js +10 -10
- package/dist/connectors/google-drive.js +32 -10
- package/dist/connectors/google-search-console-oauth.js +128 -17
- package/dist/connectors/google-sheets.js +8 -6
- package/dist/connectors/google-slides.js +10 -10
- package/dist/connectors/grafana.js +47 -10
- package/dist/connectors/hubspot-oauth.js +41 -9
- package/dist/connectors/hubspot.js +27 -9
- package/dist/connectors/influxdb.js +10 -8
- package/dist/connectors/intercom-oauth.js +72 -12
- package/dist/connectors/intercom.js +14 -12
- package/dist/connectors/jdbc.js +8 -6
- package/dist/connectors/jira-api-key.js +70 -11
- package/dist/connectors/kintone-api-token.js +68 -18
- package/dist/connectors/kintone.js +56 -11
- package/dist/connectors/linear.js +56 -12
- package/dist/connectors/linkedin-ads.js +43 -14
- package/dist/connectors/mailchimp-oauth.js +8 -6
- package/dist/connectors/mailchimp.js +8 -6
- package/dist/connectors/meta-ads-oauth.js +35 -14
- package/dist/connectors/meta-ads.js +37 -14
- package/dist/connectors/mixpanel.js +10 -8
- package/dist/connectors/monday.js +11 -9
- package/dist/connectors/mongodb.js +10 -8
- package/dist/connectors/notion-oauth.js +60 -11
- package/dist/connectors/notion.js +62 -11
- package/dist/connectors/openai.js +4 -2
- package/dist/connectors/oracle.js +25 -7
- package/dist/connectors/outlook-oauth.js +21 -21
- package/dist/connectors/powerbi-oauth.js +13 -13
- package/dist/connectors/salesforce.js +44 -9
- package/dist/connectors/semrush.js +8 -6
- package/dist/connectors/sentry.js +38 -10
- package/dist/connectors/shopify-oauth.js +43 -10
- package/dist/connectors/shopify.js +10 -8
- package/dist/connectors/sqlserver.js +33 -7
- package/dist/connectors/stripe-api-key.js +68 -15
- package/dist/connectors/stripe-oauth.js +70 -19
- package/dist/connectors/supabase.js +24 -5
- package/dist/connectors/tableau.js +17 -15
- package/dist/connectors/tiktok-ads.js +39 -16
- package/dist/connectors/wix-store.js +10 -8
- package/dist/connectors/zendesk-oauth.js +55 -12
- package/dist/connectors/zendesk.js +14 -12
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3339 -746
- package/dist/main.js +3328 -740
- package/dist/vite-plugin.js +3308 -740
- package/package.json +1 -1
package/dist/connectors/gmail.js
CHANGED
|
@@ -16,6 +16,7 @@ var init_parameter_definition = __esm({
|
|
|
16
16
|
type;
|
|
17
17
|
secret;
|
|
18
18
|
required;
|
|
19
|
+
isDeprecated;
|
|
19
20
|
constructor(config) {
|
|
20
21
|
this.slug = config.slug;
|
|
21
22
|
this.name = config.name;
|
|
@@ -24,6 +25,7 @@ var init_parameter_definition = __esm({
|
|
|
24
25
|
this.type = config.type;
|
|
25
26
|
this.secret = config.secret;
|
|
26
27
|
this.required = config.required;
|
|
28
|
+
this.isDeprecated = config.isDeprecated ?? false;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* Get the parameter value from a ConnectorConnectionObject.
|
|
@@ -224,7 +226,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
224
226
|
/**
|
|
225
227
|
* Create tools for connections that belong to this connector.
|
|
226
228
|
* Filters connections by connectorKey internally.
|
|
227
|
-
* Returns tools keyed as
|
|
229
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
228
230
|
*/
|
|
229
231
|
createTools(connections, config, opts) {
|
|
230
232
|
const myConnections = connections.filter(
|
|
@@ -234,7 +236,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
234
236
|
for (const t of Object.values(this.tools)) {
|
|
235
237
|
const tool = t.createTool(myConnections, config);
|
|
236
238
|
const originalToModelOutput = tool.toModelOutput;
|
|
237
|
-
result[
|
|
239
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
238
240
|
...tool,
|
|
239
241
|
toModelOutput: async (options) => {
|
|
240
242
|
if (!originalToModelOutput) {
|
|
@@ -719,7 +721,7 @@ var gmailConnector = new ConnectorPlugin({
|
|
|
719
721
|
systemPrompt: {
|
|
720
722
|
en: `### Tools
|
|
721
723
|
|
|
722
|
-
- \`
|
|
724
|
+
- \`connector_gmail-service-account_request_with_delegation\`: Call the Gmail API on behalf of the specified Workspace user via Domain-wide Delegation. Pass \`subject\` as the target user's email; the token will be issued as that user. Always pass \`scopes\`.
|
|
723
725
|
|
|
724
726
|
### OAuth Scopes (pass as \`scopes\` argument)
|
|
725
727
|
|
|
@@ -812,7 +814,7 @@ for (const msg of messages.messages ?? []) {
|
|
|
812
814
|
\`\`\``,
|
|
813
815
|
ja: `### \u30C4\u30FC\u30EB
|
|
814
816
|
|
|
815
|
-
- \`
|
|
817
|
+
- \`connector_gmail-service-account_request_with_delegation\`: \u6307\u5B9A\u3055\u308C\u305F Workspace \u30E6\u30FC\u30B6\u30FC\u306B\u4EE3\u308F\u3063\u3066 Domain-wide Delegation \u7D4C\u7531\u3067 Gmail API \u3092\u547C\u3073\u51FA\u3057\u307E\u3059\u3002\u4EE3\u7406\u5BFE\u8C61\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 \`subject\` \u3068\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u30C8\u30FC\u30AF\u30F3\u306F\u305D\u306E\u30E6\u30FC\u30B6\u30FC\u3068\u3057\u3066\u767A\u884C\u3055\u308C\u307E\u3059\u3002\`scopes\` \u3082\u6BCE\u56DE\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
816
818
|
|
|
817
819
|
### OAuth \u30B9\u30B3\u30FC\u30D7 (\`scopes\` \u5F15\u6570\u3067\u6E21\u3059)
|
|
818
820
|
|
|
@@ -16,6 +16,7 @@ var init_parameter_definition = __esm({
|
|
|
16
16
|
type;
|
|
17
17
|
secret;
|
|
18
18
|
required;
|
|
19
|
+
isDeprecated;
|
|
19
20
|
constructor(config) {
|
|
20
21
|
this.slug = config.slug;
|
|
21
22
|
this.name = config.name;
|
|
@@ -24,6 +25,7 @@ var init_parameter_definition = __esm({
|
|
|
24
25
|
this.type = config.type;
|
|
25
26
|
this.secret = config.secret;
|
|
26
27
|
this.required = config.required;
|
|
28
|
+
this.isDeprecated = config.isDeprecated ?? false;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* Get the parameter value from a ConnectorConnectionObject.
|
|
@@ -272,7 +274,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
272
274
|
/**
|
|
273
275
|
* Create tools for connections that belong to this connector.
|
|
274
276
|
* Filters connections by connectorKey internally.
|
|
275
|
-
* Returns tools keyed as
|
|
277
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
276
278
|
*/
|
|
277
279
|
createTools(connections, config, opts) {
|
|
278
280
|
const myConnections = connections.filter(
|
|
@@ -282,7 +284,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
282
284
|
for (const t of Object.values(this.tools)) {
|
|
283
285
|
const tool = t.createTool(myConnections, config);
|
|
284
286
|
const originalToModelOutput = tool.toModelOutput;
|
|
285
|
-
result[
|
|
287
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
286
288
|
...tool,
|
|
287
289
|
toModelOutput: async (options) => {
|
|
288
290
|
if (!originalToModelOutput) {
|
|
@@ -660,9 +662,9 @@ var googleAdsOnboarding = new ConnectorOnboarding({
|
|
|
660
662
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
661
663
|
},
|
|
662
664
|
dataOverviewInstructions: {
|
|
663
|
-
en: `1. Call
|
|
665
|
+
en: `1. Call connector_google-ads-oauth_request with POST customers/{customerId}/googleAds:searchStream to explore available campaign data using GAQL: SELECT campaign.id, campaign.name, campaign.status FROM campaign LIMIT 10
|
|
664
666
|
2. Explore ad group and keyword data as needed to understand the data structure`,
|
|
665
|
-
ja: `1.
|
|
667
|
+
ja: `1. connector_google-ads-oauth_request \u3067 POST customers/{customerId}/googleAds:searchStream \u3092\u547C\u3073\u51FA\u3057\u3001GAQL\u3067\u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u30C7\u30FC\u30BF\u3092\u63A2\u7D22: SELECT campaign.id, campaign.name, campaign.status FROM campaign LIMIT 10
|
|
666
668
|
2. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\u5E83\u544A\u30B0\u30EB\u30FC\u30D7\u3084\u30AD\u30FC\u30EF\u30FC\u30C9\u30C7\u30FC\u30BF\u3092\u63A2\u7D22\u3057\u3001\u30C7\u30FC\u30BF\u69CB\u9020\u3092\u628A\u63E1`
|
|
667
669
|
}
|
|
668
670
|
});
|
|
@@ -934,8 +936,8 @@ var googleAdsConnector = new ConnectorPlugin({
|
|
|
934
936
|
systemPrompt: {
|
|
935
937
|
en: `### Tools (setup-time only)
|
|
936
938
|
|
|
937
|
-
- \`
|
|
938
|
-
- \`
|
|
939
|
+
- \`connector_google-ads-oauth_request\`: Send authenticated requests to the Google Ads API during setup / data overview. Use it for GAQL queries via searchStream. The {customerId} placeholder in paths is automatically replaced (hyphens removed). Authentication and developer token are configured automatically.
|
|
940
|
+
- \`connector_google-ads-oauth_listCustomers\`: List accessible Google Ads customer accounts. Use this during setup to discover available accounts.
|
|
939
941
|
|
|
940
942
|
> **Important**: These tools are only available at setup time. Inside server-logic handlers, use the SDK (\`connection(id).search\`, etc.) \u2014 the SDK's fetch is already wired through the OAuth proxy. **Do NOT** hand-roll HTTP calls to \`_sqcore/connections/*/request\` from a handler.
|
|
941
943
|
|
|
@@ -996,8 +998,8 @@ const customerIds = await ads.listAccessibleCustomers();
|
|
|
996
998
|
\`\`\``,
|
|
997
999
|
ja: `### \u30C4\u30FC\u30EB\uFF08\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306E\u307F\uFF09
|
|
998
1000
|
|
|
999
|
-
- \`
|
|
1000
|
-
- \`
|
|
1001
|
+
- \`connector_google-ads-oauth_request\`: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3084\u30C7\u30FC\u30BF\u6982\u8981\u628A\u63E1\u6642\u306B Google Ads API \u3078\u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u3092\u9001\u4FE1\u3057\u307E\u3059\u3002searchStream \u3092\u4F7F\u3063\u305F GAQL \u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u30D1\u30B9\u5185\u306E {customerId} \u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u81EA\u52D5\u7684\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\uFF08\u30CF\u30A4\u30D5\u30F3\u306F\u9664\u53BB\uFF09\u3002\u8A8D\u8A3C\u3068\u30C7\u30D9\u30ED\u30C3\u30D1\u30FC\u30C8\u30FC\u30AF\u30F3\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
1002
|
+
- \`connector_google-ads-oauth_listCustomers\`: \u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A Google Ads \u9867\u5BA2\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
|
|
1001
1003
|
|
|
1002
1004
|
> **\u91CD\u8981**: \u3053\u308C\u3089\u306E\u30C4\u30FC\u30EB\u306F\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u6642\u306E\u307F\u5229\u7528\u53EF\u80FD\u3067\u3059\u3002\u30B5\u30FC\u30D0\u30FC\u30ED\u30B8\u30C3\u30AF\u306E\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u5FC5\u305A SDK\uFF08\`connection(id).search\` \u306A\u3069\uFF09\u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002SDK \u306E fetch \u306F OAuth \u30D7\u30ED\u30AD\u30B7\u7D4C\u7531\u3067\u65E2\u306B\u914D\u7DDA\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u304B\u3089 \`_sqcore/connections/*/request\` \u3092\u624B\u66F8\u304D\u3067\u547C\u3073\u51FA\u3055\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
1003
1005
|
|
|
@@ -16,6 +16,7 @@ var init_parameter_definition = __esm({
|
|
|
16
16
|
type;
|
|
17
17
|
secret;
|
|
18
18
|
required;
|
|
19
|
+
isDeprecated;
|
|
19
20
|
constructor(config) {
|
|
20
21
|
this.slug = config.slug;
|
|
21
22
|
this.name = config.name;
|
|
@@ -24,6 +25,7 @@ var init_parameter_definition = __esm({
|
|
|
24
25
|
this.type = config.type;
|
|
25
26
|
this.secret = config.secret;
|
|
26
27
|
this.required = config.required;
|
|
28
|
+
this.isDeprecated = config.isDeprecated ?? false;
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* Get the parameter value from a ConnectorConnectionObject.
|
|
@@ -253,7 +255,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
253
255
|
/**
|
|
254
256
|
* Create tools for connections that belong to this connector.
|
|
255
257
|
* Filters connections by connectorKey internally.
|
|
256
|
-
* Returns tools keyed as
|
|
258
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
257
259
|
*/
|
|
258
260
|
createTools(connections, config, opts) {
|
|
259
261
|
const myConnections = connections.filter(
|
|
@@ -263,7 +265,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
263
265
|
for (const t of Object.values(this.tools)) {
|
|
264
266
|
const tool = t.createTool(myConnections, config);
|
|
265
267
|
const originalToModelOutput = tool.toModelOutput;
|
|
266
|
-
result[
|
|
268
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
267
269
|
...tool,
|
|
268
270
|
toModelOutput: async (options) => {
|
|
269
271
|
if (!originalToModelOutput) {
|
|
@@ -663,15 +665,16 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
663
665
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
664
666
|
},
|
|
665
667
|
dataOverviewInstructions: {
|
|
666
|
-
en: `1. Call
|
|
667
|
-
2. Call
|
|
668
|
-
ja: `1.
|
|
669
|
-
2.
|
|
668
|
+
en: `1. Call connector_google-analytics-oauth_request with GET properties/{propertyId}/metadata to list available dimensions and metrics
|
|
669
|
+
2. Call connector_google-analytics-oauth_request with POST properties/{propertyId}:runReport using a small date range and basic metrics to verify data availability`,
|
|
670
|
+
ja: `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
|
|
671
|
+
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`
|
|
670
672
|
}
|
|
671
673
|
});
|
|
672
674
|
|
|
673
675
|
// ../connectors/src/connectors/google-analytics-oauth/setup-flow.ts
|
|
674
676
|
var ADMIN_BASE_URL3 = "https://analyticsadmin.googleapis.com/v1beta";
|
|
677
|
+
var DATA_BASE_URL = "https://analyticsdata.googleapis.com/v1beta";
|
|
675
678
|
var ALL_PROPERTIES = "__ALL_PROPERTIES__";
|
|
676
679
|
var GOOGLE_ANALYTICS_OAUTH_SETUP_MAX_PROPERTIES = 20;
|
|
677
680
|
async function listAccountSummaries(proxyFetch) {
|
|
@@ -702,6 +705,44 @@ async function getProperty(proxyFetch, propertyId) {
|
|
|
702
705
|
if (!res.ok) return null;
|
|
703
706
|
return await res.json();
|
|
704
707
|
}
|
|
708
|
+
async function getMetadata(proxyFetch, propertyId) {
|
|
709
|
+
try {
|
|
710
|
+
const res = await proxyFetch(
|
|
711
|
+
`${DATA_BASE_URL}/properties/${propertyId}/metadata`,
|
|
712
|
+
{ method: "GET" }
|
|
713
|
+
);
|
|
714
|
+
if (!res.ok) return { dimensions: [], metrics: [] };
|
|
715
|
+
const data = await res.json();
|
|
716
|
+
return {
|
|
717
|
+
dimensions: data.dimensions ?? [],
|
|
718
|
+
metrics: data.metrics ?? []
|
|
719
|
+
};
|
|
720
|
+
} catch {
|
|
721
|
+
return { dimensions: [], metrics: [] };
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
async function runSampleReport(proxyFetch, propertyId, dimensions, metrics, limit) {
|
|
725
|
+
try {
|
|
726
|
+
const res = await proxyFetch(
|
|
727
|
+
`${DATA_BASE_URL}/properties/${propertyId}:runReport`,
|
|
728
|
+
{
|
|
729
|
+
method: "POST",
|
|
730
|
+
headers: { "Content-Type": "application/json" },
|
|
731
|
+
body: JSON.stringify({
|
|
732
|
+
dateRanges: [{ startDate: "28daysAgo", endDate: "today" }],
|
|
733
|
+
dimensions: dimensions.map((name) => ({ name })),
|
|
734
|
+
metrics: metrics.map((name) => ({ name })),
|
|
735
|
+
limit
|
|
736
|
+
})
|
|
737
|
+
}
|
|
738
|
+
);
|
|
739
|
+
if (!res.ok) return [];
|
|
740
|
+
const data = await res.json();
|
|
741
|
+
return data.rows ?? [];
|
|
742
|
+
} catch {
|
|
743
|
+
return [];
|
|
744
|
+
}
|
|
745
|
+
}
|
|
705
746
|
var googleAnalyticsOauthSetupFlow = {
|
|
706
747
|
initialState: () => ({}),
|
|
707
748
|
steps: [
|
|
@@ -785,23 +826,111 @@ var googleAnalyticsOauthSetupFlow = {
|
|
|
785
826
|
sections.push("_No properties selected._", "");
|
|
786
827
|
return sections.join("\n");
|
|
787
828
|
}
|
|
788
|
-
sections.push(
|
|
789
|
-
"| Property ID | Display Name | Time Zone | Currency | Industry |"
|
|
790
|
-
);
|
|
791
|
-
sections.push(
|
|
792
|
-
"|-------------|--------------|-----------|----------|----------|"
|
|
793
|
-
);
|
|
794
829
|
for (const propertyId of targetPropertyIds) {
|
|
795
830
|
const prop = await getProperty(rt.config.proxyFetch, propertyId);
|
|
796
|
-
const displayName =
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
831
|
+
const displayName = prop?.displayName ?? propertyId;
|
|
832
|
+
sections.push(`### Property: ${displayName} (${propertyId})`, "");
|
|
833
|
+
if (prop?.timeZone || prop?.currencyCode || prop?.industryCategory) {
|
|
834
|
+
const details = [];
|
|
835
|
+
if (prop.timeZone) details.push(`Time Zone: ${prop.timeZone}`);
|
|
836
|
+
if (prop.currencyCode) details.push(`Currency: ${prop.currencyCode}`);
|
|
837
|
+
if (prop.industryCategory)
|
|
838
|
+
details.push(`Industry: ${prop.industryCategory}`);
|
|
839
|
+
sections.push(details.join(" | "), "");
|
|
840
|
+
}
|
|
841
|
+
const metadata = await getMetadata(rt.config.proxyFetch, propertyId);
|
|
842
|
+
if (metadata.dimensions.length > 0) {
|
|
843
|
+
const categories = /* @__PURE__ */ new Map();
|
|
844
|
+
for (const d of metadata.dimensions) {
|
|
845
|
+
const cat = d.category || "Other";
|
|
846
|
+
if (!categories.has(cat)) categories.set(cat, []);
|
|
847
|
+
categories.get(cat).push(d.uiName ?? d.apiName ?? "");
|
|
848
|
+
}
|
|
849
|
+
sections.push("#### Available Dimensions", "");
|
|
850
|
+
for (const [cat, dims] of categories) {
|
|
851
|
+
sections.push(
|
|
852
|
+
`- **${cat}**: ${dims.slice(0, 10).join(", ")}${dims.length > 10 ? ` \u2026+${dims.length - 10}` : ""}`
|
|
853
|
+
);
|
|
854
|
+
}
|
|
855
|
+
sections.push("");
|
|
856
|
+
}
|
|
857
|
+
if (metadata.metrics.length > 0) {
|
|
858
|
+
const categories = /* @__PURE__ */ new Map();
|
|
859
|
+
for (const m of metadata.metrics) {
|
|
860
|
+
const cat = m.category || "Other";
|
|
861
|
+
if (!categories.has(cat)) categories.set(cat, []);
|
|
862
|
+
categories.get(cat).push(m.uiName ?? m.apiName ?? "");
|
|
863
|
+
}
|
|
864
|
+
sections.push("#### Available Metrics", "");
|
|
865
|
+
for (const [cat, mets] of categories) {
|
|
866
|
+
sections.push(
|
|
867
|
+
`- **${cat}**: ${mets.slice(0, 10).join(", ")}${mets.length > 10 ? ` \u2026+${mets.length - 10}` : ""}`
|
|
868
|
+
);
|
|
869
|
+
}
|
|
870
|
+
sections.push("");
|
|
871
|
+
}
|
|
872
|
+
const trafficRows = await runSampleReport(
|
|
873
|
+
rt.config.proxyFetch,
|
|
874
|
+
propertyId,
|
|
875
|
+
["date"],
|
|
876
|
+
["sessions", "activeUsers", "screenPageViews"],
|
|
877
|
+
7
|
|
802
878
|
);
|
|
879
|
+
if (trafficRows.length > 0) {
|
|
880
|
+
sections.push("#### Traffic Summary (last 28 days, by date)", "");
|
|
881
|
+
sections.push("| Date | Sessions | Active Users | Page Views |");
|
|
882
|
+
sections.push("|------|----------|-------------|------------|");
|
|
883
|
+
for (const row of trafficRows) {
|
|
884
|
+
const d = row.dimensionValues?.[0]?.value ?? "";
|
|
885
|
+
const s = row.metricValues?.[0]?.value ?? "0";
|
|
886
|
+
const u = row.metricValues?.[1]?.value ?? "0";
|
|
887
|
+
const p = row.metricValues?.[2]?.value ?? "0";
|
|
888
|
+
sections.push(`| ${d} | ${s} | ${u} | ${p} |`);
|
|
889
|
+
}
|
|
890
|
+
sections.push("");
|
|
891
|
+
}
|
|
892
|
+
const channelRows = await runSampleReport(
|
|
893
|
+
rt.config.proxyFetch,
|
|
894
|
+
propertyId,
|
|
895
|
+
["sessionDefaultChannelGroup"],
|
|
896
|
+
["sessions", "activeUsers"],
|
|
897
|
+
10
|
|
898
|
+
);
|
|
899
|
+
if (channelRows.length > 0) {
|
|
900
|
+
sections.push("#### Top Channels (last 28 days)", "");
|
|
901
|
+
sections.push("| Channel | Sessions | Active Users |");
|
|
902
|
+
sections.push("|---------|----------|-------------|");
|
|
903
|
+
for (const row of channelRows) {
|
|
904
|
+
const ch = row.dimensionValues?.[0]?.value ?? "";
|
|
905
|
+
const s = row.metricValues?.[0]?.value ?? "0";
|
|
906
|
+
const u = row.metricValues?.[1]?.value ?? "0";
|
|
907
|
+
sections.push(`| ${ch} | ${s} | ${u} |`);
|
|
908
|
+
}
|
|
909
|
+
sections.push("");
|
|
910
|
+
}
|
|
911
|
+
const pageRows = await runSampleReport(
|
|
912
|
+
rt.config.proxyFetch,
|
|
913
|
+
propertyId,
|
|
914
|
+
["pagePath"],
|
|
915
|
+
["screenPageViews", "activeUsers"],
|
|
916
|
+
10
|
|
917
|
+
);
|
|
918
|
+
if (pageRows.length > 0) {
|
|
919
|
+
sections.push("#### Top Pages (last 28 days)", "");
|
|
920
|
+
sections.push("| Page Path | Page Views | Active Users |");
|
|
921
|
+
sections.push("|-----------|------------|-------------|");
|
|
922
|
+
for (const row of pageRows) {
|
|
923
|
+
const pg = (row.dimensionValues?.[0]?.value ?? "").replace(
|
|
924
|
+
/\|/g,
|
|
925
|
+
"\\|"
|
|
926
|
+
);
|
|
927
|
+
const v = row.metricValues?.[0]?.value ?? "0";
|
|
928
|
+
const u = row.metricValues?.[1]?.value ?? "0";
|
|
929
|
+
sections.push(`| ${pg} | ${v} | ${u} |`);
|
|
930
|
+
}
|
|
931
|
+
sections.push("");
|
|
932
|
+
}
|
|
803
933
|
}
|
|
804
|
-
sections.push("");
|
|
805
934
|
return sections.join("\n");
|
|
806
935
|
}
|
|
807
936
|
};
|
|
@@ -954,9 +1083,9 @@ var googleAnalyticsOauthConnector = new ConnectorPlugin({
|
|
|
954
1083
|
systemPrompt: {
|
|
955
1084
|
en: `### Tools
|
|
956
1085
|
|
|
957
|
-
- \`
|
|
958
|
-
- \`
|
|
959
|
-
- \`
|
|
1086
|
+
- \`connector_google-analytics-oauth_request\`: Send authenticated requests to the GA4 Data API. Use it for running reports, getting metadata, and realtime reports. The {propertyId} placeholder in paths is automatically replaced. Authentication is configured automatically via OAuth.
|
|
1087
|
+
- \`connector_google-analytics-oauth_listAccounts\`: List accessible Google Analytics accounts. Use during setup to discover available accounts.
|
|
1088
|
+
- \`connector_google-analytics-oauth_listProperties\`: List GA4 properties for a given account. Use during setup to select the target property.
|
|
960
1089
|
|
|
961
1090
|
### GA4 Data API Reference
|
|
962
1091
|
|
|
@@ -1026,9 +1155,9 @@ const realtime = await ga.runRealtimeReport({
|
|
|
1026
1155
|
\`\`\``,
|
|
1027
1156
|
ja: `### \u30C4\u30FC\u30EB
|
|
1028
1157
|
|
|
1029
|
-
- \`
|
|
1030
|
-
- \`
|
|
1031
|
-
- \`
|
|
1158
|
+
- \`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\u30D1\u30B9\u5185\u306E{propertyId}\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u81EA\u52D5\u7684\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002OAuth\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
|
|
1159
|
+
- \`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
|
|
1160
|
+
- \`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
|
|
1032
1161
|
|
|
1033
1162
|
### GA4 Data API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
1034
1163
|
|