@squadbase/vite-server 0.1.17-dev.a9ddcfa → 0.1.17-dev.d4fff69
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 +4299 -821
- package/dist/connectors/airtable-oauth.js +48 -8
- package/dist/connectors/airtable.js +44 -8
- package/dist/connectors/amplitude.js +8 -8
- package/dist/connectors/anthropic.js +2 -2
- package/dist/connectors/asana.js +37 -10
- package/dist/connectors/attio.js +30 -13
- package/dist/connectors/aws-billing.js +8 -8
- package/dist/connectors/azure-sql.js +47 -10
- package/dist/connectors/backlog-api-key.js +40 -15
- package/dist/connectors/clickup.js +50 -10
- package/dist/connectors/cosmosdb.js +12 -12
- package/dist/connectors/customerio.js +8 -8
- package/dist/connectors/dbt.js +686 -25
- package/dist/connectors/freshdesk.js +82 -8
- package/dist/connectors/freshsales.js +8 -8
- package/dist/connectors/freshservice.js +8 -8
- package/dist/connectors/gamma.js +15 -15
- package/dist/connectors/gemini.js +2 -2
- package/dist/connectors/github.js +12 -12
- package/dist/connectors/gmail-oauth.js +10 -10
- package/dist/connectors/gmail.js +4 -4
- package/dist/connectors/google-ads.js +8 -8
- package/dist/connectors/google-analytics-oauth.js +152 -25
- package/dist/connectors/google-analytics.js +490 -96
- package/dist/connectors/google-audit-log.js +4 -4
- package/dist/connectors/google-calendar-oauth.js +61 -15
- package/dist/connectors/google-calendar.js +61 -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 +126 -17
- package/dist/connectors/google-sheets.js +6 -6
- package/dist/connectors/google-slides.js +10 -10
- package/dist/connectors/grafana.js +45 -10
- package/dist/connectors/hackernews.d.ts +5 -0
- package/dist/connectors/hackernews.js +890 -0
- package/dist/connectors/hubspot-oauth.js +41 -9
- package/dist/connectors/hubspot.js +25 -9
- package/dist/connectors/influxdb.js +8 -8
- package/dist/connectors/intercom-oauth.js +72 -12
- package/dist/connectors/intercom.js +12 -12
- package/dist/connectors/jdbc.js +37 -10
- package/dist/connectors/jira-api-key.js +68 -11
- package/dist/connectors/kintone-api-token.js +66 -18
- package/dist/connectors/kintone.js +54 -11
- package/dist/connectors/linear.js +54 -12
- package/dist/connectors/linkedin-ads.js +41 -14
- package/dist/connectors/mailchimp-oauth.js +6 -6
- package/dist/connectors/mailchimp.js +6 -6
- package/dist/connectors/meta-ads-oauth.js +33 -14
- package/dist/connectors/meta-ads.js +35 -14
- package/dist/connectors/mixpanel.js +8 -8
- package/dist/connectors/monday.js +9 -9
- package/dist/connectors/mongodb.js +8 -8
- package/dist/connectors/notion-oauth.js +60 -11
- package/dist/connectors/notion.js +60 -11
- package/dist/connectors/openai.js +2 -2
- package/dist/connectors/oracle.js +39 -11
- package/dist/connectors/outlook-oauth.js +21 -21
- package/dist/connectors/powerbi-oauth.js +13 -13
- package/dist/connectors/salesforce.js +42 -9
- package/dist/connectors/semrush.js +6 -6
- package/dist/connectors/sentry.js +36 -10
- package/dist/connectors/shopify-oauth.js +43 -10
- package/dist/connectors/shopify.js +8 -8
- package/dist/connectors/sqlserver.js +47 -10
- package/dist/connectors/stripe-api-key.js +66 -15
- package/dist/connectors/stripe-oauth.js +70 -19
- package/dist/connectors/supabase.js +31 -6
- package/dist/connectors/tableau.js +15 -15
- package/dist/connectors/tiktok-ads.js +37 -16
- package/dist/connectors/wix-store.js +8 -8
- package/dist/connectors/x.d.ts +5 -0
- package/dist/connectors/x.js +927 -0
- package/dist/connectors/zendesk-oauth.js +55 -12
- package/dist/connectors/zendesk.js +12 -12
- package/dist/index.js +4317 -819
- package/dist/main.js +4317 -819
- package/dist/vite-plugin.js +4297 -819
- package/package.json +9 -1
|
@@ -255,7 +255,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
255
255
|
/**
|
|
256
256
|
* Create tools for connections that belong to this connector.
|
|
257
257
|
* Filters connections by connectorKey internally.
|
|
258
|
-
* Returns tools keyed as
|
|
258
|
+
* Returns tools keyed as `connector_${connectorKey}_${toolName}`.
|
|
259
259
|
*/
|
|
260
260
|
createTools(connections, config, opts) {
|
|
261
261
|
const myConnections = connections.filter(
|
|
@@ -265,7 +265,7 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
265
265
|
for (const t of Object.values(this.tools)) {
|
|
266
266
|
const tool = t.createTool(myConnections, config);
|
|
267
267
|
const originalToModelOutput = tool.toModelOutput;
|
|
268
|
-
result[
|
|
268
|
+
result[`connector_${this.connectorKey}_${t.name}`] = {
|
|
269
269
|
...tool,
|
|
270
270
|
toModelOutput: async (options) => {
|
|
271
271
|
if (!originalToModelOutput) {
|
|
@@ -665,15 +665,16 @@ var googleAnalyticsOauthOnboarding = new ConnectorOnboarding({
|
|
|
665
665
|
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
666
666
|
},
|
|
667
667
|
dataOverviewInstructions: {
|
|
668
|
-
en: `1. Call
|
|
669
|
-
2. Call
|
|
670
|
-
ja: `1.
|
|
671
|
-
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`
|
|
672
672
|
}
|
|
673
673
|
});
|
|
674
674
|
|
|
675
675
|
// ../connectors/src/connectors/google-analytics-oauth/setup-flow.ts
|
|
676
676
|
var ADMIN_BASE_URL3 = "https://analyticsadmin.googleapis.com/v1beta";
|
|
677
|
+
var DATA_BASE_URL = "https://analyticsdata.googleapis.com/v1beta";
|
|
677
678
|
var ALL_PROPERTIES = "__ALL_PROPERTIES__";
|
|
678
679
|
var GOOGLE_ANALYTICS_OAUTH_SETUP_MAX_PROPERTIES = 20;
|
|
679
680
|
async function listAccountSummaries(proxyFetch) {
|
|
@@ -704,6 +705,44 @@ async function getProperty(proxyFetch, propertyId) {
|
|
|
704
705
|
if (!res.ok) return null;
|
|
705
706
|
return await res.json();
|
|
706
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
|
+
}
|
|
707
746
|
var googleAnalyticsOauthSetupFlow = {
|
|
708
747
|
initialState: () => ({}),
|
|
709
748
|
steps: [
|
|
@@ -787,23 +826,111 @@ var googleAnalyticsOauthSetupFlow = {
|
|
|
787
826
|
sections.push("_No properties selected._", "");
|
|
788
827
|
return sections.join("\n");
|
|
789
828
|
}
|
|
790
|
-
sections.push(
|
|
791
|
-
"| Property ID | Display Name | Time Zone | Currency | Industry |"
|
|
792
|
-
);
|
|
793
|
-
sections.push(
|
|
794
|
-
"|-------------|--------------|-----------|----------|----------|"
|
|
795
|
-
);
|
|
796
829
|
for (const propertyId of targetPropertyIds) {
|
|
797
830
|
const prop = await getProperty(rt.config.proxyFetch, propertyId);
|
|
798
|
-
const displayName =
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
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
|
|
804
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
|
+
}
|
|
805
933
|
}
|
|
806
|
-
sections.push("");
|
|
807
934
|
return sections.join("\n");
|
|
808
935
|
}
|
|
809
936
|
};
|
|
@@ -956,9 +1083,9 @@ var googleAnalyticsOauthConnector = new ConnectorPlugin({
|
|
|
956
1083
|
systemPrompt: {
|
|
957
1084
|
en: `### Tools
|
|
958
1085
|
|
|
959
|
-
- \`
|
|
960
|
-
- \`
|
|
961
|
-
- \`
|
|
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.
|
|
962
1089
|
|
|
963
1090
|
### GA4 Data API Reference
|
|
964
1091
|
|
|
@@ -1028,9 +1155,9 @@ const realtime = await ga.runRealtimeReport({
|
|
|
1028
1155
|
\`\`\``,
|
|
1029
1156
|
ja: `### \u30C4\u30FC\u30EB
|
|
1030
1157
|
|
|
1031
|
-
- \`
|
|
1032
|
-
- \`
|
|
1033
|
-
- \`
|
|
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
|
|
1034
1161
|
|
|
1035
1162
|
### GA4 Data API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
1036
1163
|
|