@squadbase/vite-server 0.1.17-dev.7408ec4 → 0.1.17-dev.9d1f952
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 -51
- package/dist/connectors/airtable-oauth.js +6 -0
- package/dist/connectors/airtable.js +6 -0
- package/dist/connectors/amplitude.js +6 -0
- package/dist/connectors/asana.js +6 -0
- package/dist/connectors/attio.js +6 -0
- package/dist/connectors/aws-billing.js +6 -0
- package/dist/connectors/azure-sql.js +6 -0
- package/dist/connectors/backlog-api-key.js +6 -0
- package/dist/connectors/clickup.js +6 -0
- package/dist/connectors/cosmosdb.js +6 -0
- package/dist/connectors/customerio.js +6 -0
- package/dist/connectors/dbt.js +6 -0
- package/dist/connectors/freshdesk.js +6 -0
- package/dist/connectors/freshsales.js +6 -0
- package/dist/connectors/freshservice.js +6 -0
- package/dist/connectors/gamma.js +6 -0
- package/dist/connectors/github.js +6 -0
- package/dist/connectors/gmail-oauth.js +6 -0
- package/dist/connectors/gmail.js +6 -0
- package/dist/connectors/google-ads.js +6 -0
- package/dist/connectors/google-analytics-oauth.js +6 -0
- package/dist/connectors/google-analytics.js +53 -64
- package/dist/connectors/google-audit-log.js +6 -0
- package/dist/connectors/google-calendar-oauth.js +6 -0
- package/dist/connectors/google-calendar.js +6 -0
- package/dist/connectors/google-docs.js +6 -0
- package/dist/connectors/google-drive.js +6 -0
- package/dist/connectors/google-search-console-oauth.js +6 -0
- package/dist/connectors/google-sheets.js +6 -0
- package/dist/connectors/google-slides.js +6 -0
- package/dist/connectors/grafana.js +6 -0
- package/dist/connectors/hubspot-oauth.js +6 -0
- package/dist/connectors/hubspot.js +6 -0
- package/dist/connectors/influxdb.js +6 -0
- package/dist/connectors/intercom-oauth.js +6 -0
- package/dist/connectors/intercom.js +6 -0
- package/dist/connectors/jdbc.js +6 -0
- package/dist/connectors/jira-api-key.js +6 -0
- package/dist/connectors/kintone-api-token.js +6 -0
- package/dist/connectors/kintone.js +6 -0
- package/dist/connectors/linear.js +6 -0
- package/dist/connectors/linkedin-ads.js +6 -0
- package/dist/connectors/mailchimp-oauth.js +6 -0
- package/dist/connectors/mailchimp.js +6 -0
- package/dist/connectors/meta-ads-oauth.js +6 -0
- package/dist/connectors/meta-ads.js +6 -0
- package/dist/connectors/mixpanel.js +6 -0
- package/dist/connectors/monday.js +6 -0
- package/dist/connectors/mongodb.js +6 -0
- package/dist/connectors/notion-oauth.js +6 -0
- package/dist/connectors/notion.js +6 -0
- package/dist/connectors/oracle.js +6 -0
- package/dist/connectors/outlook-oauth.js +6 -0
- package/dist/connectors/powerbi-oauth.js +6 -0
- package/dist/connectors/salesforce.js +6 -0
- package/dist/connectors/semrush.js +6 -0
- package/dist/connectors/sentry.js +6 -0
- package/dist/connectors/shopify-oauth.js +6 -0
- package/dist/connectors/shopify.js +6 -0
- package/dist/connectors/sqlserver.js +6 -0
- package/dist/connectors/stripe-api-key.js +6 -0
- package/dist/connectors/stripe-oauth.js +6 -0
- package/dist/connectors/supabase.js +6 -0
- package/dist/connectors/tableau.js +6 -0
- package/dist/connectors/tiktok-ads.js +6 -0
- package/dist/connectors/wix-store.js +6 -0
- package/dist/connectors/zendesk-oauth.js +6 -0
- package/dist/connectors/zendesk.js +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +43 -57
- package/dist/main.js +32 -51
- package/dist/vite-plugin.js +32 -51
- package/package.json +1 -1
|
@@ -346,6 +346,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
346
346
|
}
|
|
347
347
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
348
348
|
if (step.type === "text") {
|
|
349
|
+
if (step.fetchOptions) {
|
|
350
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
351
|
+
if (options2.length === 0) {
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
349
355
|
return {
|
|
350
356
|
type: "nextQuestion",
|
|
351
357
|
questionSlug: step.slug,
|
|
@@ -197,6 +197,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
197
197
|
}
|
|
198
198
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
199
199
|
if (step.type === "text") {
|
|
200
|
+
if (step.fetchOptions) {
|
|
201
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
202
|
+
if (options2.length === 0) {
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
200
206
|
return {
|
|
201
207
|
type: "nextQuestion",
|
|
202
208
|
questionSlug: step.slug,
|
|
@@ -361,6 +361,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
361
361
|
}
|
|
362
362
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
363
363
|
if (step.type === "text") {
|
|
364
|
+
if (step.fetchOptions) {
|
|
365
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
366
|
+
if (options2.length === 0) {
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
364
370
|
return {
|
|
365
371
|
type: "nextQuestion",
|
|
366
372
|
questionSlug: step.slug,
|
|
@@ -624,6 +624,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
624
624
|
}
|
|
625
625
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
626
626
|
if (step.type === "text") {
|
|
627
|
+
if (step.fetchOptions) {
|
|
628
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
629
|
+
if (options2.length === 0) {
|
|
630
|
+
continue;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
627
633
|
return {
|
|
628
634
|
type: "nextQuestion",
|
|
629
635
|
questionSlug: step.slug,
|
|
@@ -311,6 +311,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
311
311
|
}
|
|
312
312
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
313
313
|
if (step.type === "text") {
|
|
314
|
+
if (step.fetchOptions) {
|
|
315
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
316
|
+
if (options2.length === 0) {
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
314
320
|
return {
|
|
315
321
|
type: "nextQuestion",
|
|
316
322
|
questionSlug: step.slug,
|
|
@@ -269,6 +269,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
269
269
|
}
|
|
270
270
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
271
271
|
if (step.type === "text") {
|
|
272
|
+
if (step.fetchOptions) {
|
|
273
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
274
|
+
if (options2.length === 0) {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
272
278
|
return {
|
|
273
279
|
type: "nextQuestion",
|
|
274
280
|
questionSlug: step.slug,
|
|
@@ -410,6 +410,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
410
410
|
}
|
|
411
411
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
412
412
|
if (step.type === "text") {
|
|
413
|
+
if (step.fetchOptions) {
|
|
414
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
415
|
+
if (options2.length === 0) {
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
413
419
|
return {
|
|
414
420
|
type: "nextQuestion",
|
|
415
421
|
questionSlug: step.slug,
|
|
@@ -374,6 +374,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
374
374
|
}
|
|
375
375
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
376
376
|
if (step.type === "text") {
|
|
377
|
+
if (step.fetchOptions) {
|
|
378
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
379
|
+
if (options2.length === 0) {
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
377
383
|
return {
|
|
378
384
|
type: "nextQuestion",
|
|
379
385
|
questionSlug: step.slug,
|
|
@@ -365,6 +365,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
365
365
|
}
|
|
366
366
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
367
367
|
if (step.type === "text") {
|
|
368
|
+
if (step.fetchOptions) {
|
|
369
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
370
|
+
if (options2.length === 0) {
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
368
374
|
return {
|
|
369
375
|
type: "nextQuestion",
|
|
370
376
|
questionSlug: step.slug,
|
|
@@ -191,6 +191,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
191
191
|
}
|
|
192
192
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
193
193
|
if (step.type === "text") {
|
|
194
|
+
if (step.fetchOptions) {
|
|
195
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
196
|
+
if (options2.length === 0) {
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
194
200
|
return {
|
|
195
201
|
type: "nextQuestion",
|
|
196
202
|
questionSlug: step.slug,
|
|
@@ -478,6 +478,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
478
478
|
}
|
|
479
479
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
480
480
|
if (step.type === "text") {
|
|
481
|
+
if (step.fetchOptions) {
|
|
482
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
483
|
+
if (options2.length === 0) {
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
481
487
|
return {
|
|
482
488
|
type: "nextQuestion",
|
|
483
489
|
questionSlug: step.slug,
|
|
@@ -589,6 +589,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
589
589
|
}
|
|
590
590
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
591
591
|
if (step.type === "text") {
|
|
592
|
+
if (step.fetchOptions) {
|
|
593
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
594
|
+
if (options2.length === 0) {
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
592
598
|
return {
|
|
593
599
|
type: "nextQuestion",
|
|
594
600
|
questionSlug: step.slug,
|
|
@@ -271,6 +271,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
271
271
|
}
|
|
272
272
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
273
273
|
if (step.type === "text") {
|
|
274
|
+
if (step.fetchOptions) {
|
|
275
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
276
|
+
if (options2.length === 0) {
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
274
280
|
return {
|
|
275
281
|
type: "nextQuestion",
|
|
276
282
|
questionSlug: step.slug,
|
|
@@ -193,6 +193,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
193
193
|
}
|
|
194
194
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
195
195
|
if (step.type === "text") {
|
|
196
|
+
if (step.fetchOptions) {
|
|
197
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
198
|
+
if (options2.length === 0) {
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
196
202
|
return {
|
|
197
203
|
type: "nextQuestion",
|
|
198
204
|
questionSlug: step.slug,
|
|
@@ -285,6 +285,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
285
285
|
}
|
|
286
286
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
287
287
|
if (step.type === "text") {
|
|
288
|
+
if (step.fetchOptions) {
|
|
289
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
290
|
+
if (options2.length === 0) {
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
288
294
|
return {
|
|
289
295
|
type: "nextQuestion",
|
|
290
296
|
questionSlug: step.slug,
|
|
@@ -382,6 +382,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
382
382
|
}
|
|
383
383
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
384
384
|
if (step.type === "text") {
|
|
385
|
+
if (step.fetchOptions) {
|
|
386
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
387
|
+
if (options2.length === 0) {
|
|
388
|
+
continue;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
385
391
|
return {
|
|
386
392
|
type: "nextQuestion",
|
|
387
393
|
questionSlug: step.slug,
|
|
@@ -248,6 +248,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
248
248
|
}
|
|
249
249
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
250
250
|
if (step.type === "text") {
|
|
251
|
+
if (step.fetchOptions) {
|
|
252
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
253
|
+
if (options2.length === 0) {
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
251
257
|
return {
|
|
252
258
|
type: "nextQuestion",
|
|
253
259
|
questionSlug: step.slug,
|
|
@@ -396,6 +396,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
396
396
|
}
|
|
397
397
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
398
398
|
if (step.type === "text") {
|
|
399
|
+
if (step.fetchOptions) {
|
|
400
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
401
|
+
if (options2.length === 0) {
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
399
405
|
return {
|
|
400
406
|
type: "nextQuestion",
|
|
401
407
|
questionSlug: step.slug,
|
|
@@ -191,6 +191,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
191
191
|
}
|
|
192
192
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
193
193
|
if (step.type === "text") {
|
|
194
|
+
if (step.fetchOptions) {
|
|
195
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
196
|
+
if (options2.length === 0) {
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
194
200
|
return {
|
|
195
201
|
type: "nextQuestion",
|
|
196
202
|
questionSlug: step.slug,
|
|
@@ -378,6 +378,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
378
378
|
}
|
|
379
379
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
380
380
|
if (step.type === "text") {
|
|
381
|
+
if (step.fetchOptions) {
|
|
382
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
383
|
+
if (options2.length === 0) {
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
381
387
|
return {
|
|
382
388
|
type: "nextQuestion",
|
|
383
389
|
questionSlug: step.slug,
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -804,6 +804,12 @@ async function runSetupFlow(flow, params, ctx, config) {
|
|
|
804
804
|
}
|
|
805
805
|
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
806
806
|
if (step.type === "text") {
|
|
807
|
+
if (step.fetchOptions) {
|
|
808
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
809
|
+
if (options2.length === 0) {
|
|
810
|
+
continue;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
807
813
|
return {
|
|
808
814
|
type: "nextQuestion",
|
|
809
815
|
questionSlug: step.slug,
|
|
@@ -7601,15 +7607,6 @@ var parameters13 = {
|
|
|
7601
7607
|
type: "base64EncodedJson",
|
|
7602
7608
|
secret: true,
|
|
7603
7609
|
required: true
|
|
7604
|
-
}),
|
|
7605
|
-
propertyId: new ParameterDefinition({
|
|
7606
|
-
slug: "property-id",
|
|
7607
|
-
name: "Google Analytics Property ID",
|
|
7608
|
-
description: "The Google Analytics 4 property ID (e.g., 123456789). Automatically set during the setup flow.",
|
|
7609
|
-
envVarBaseKey: "GA_PROPERTY_ID",
|
|
7610
|
-
type: "text",
|
|
7611
|
-
secret: false,
|
|
7612
|
-
required: false
|
|
7613
7610
|
})
|
|
7614
7611
|
};
|
|
7615
7612
|
|
|
@@ -7847,40 +7844,23 @@ var googleAnalyticsSetupFlow = {
|
|
|
7847
7844
|
return [];
|
|
7848
7845
|
}
|
|
7849
7846
|
},
|
|
7850
|
-
applyAnswer: (state, answer) => ({ ...state, properties: answer })
|
|
7851
|
-
toParameterUpdates: (state) => {
|
|
7852
|
-
const first = state.properties?.find((v) => v !== ALL_PROPERTIES);
|
|
7853
|
-
return first ? [{ slug: parameters13.propertyId.slug, value: first }] : [];
|
|
7854
|
-
}
|
|
7847
|
+
applyAnswer: (state, answer) => ({ ...state, properties: answer })
|
|
7855
7848
|
},
|
|
7856
7849
|
{
|
|
7857
7850
|
slug: "manualPropertyId",
|
|
7858
|
-
type: "
|
|
7859
|
-
allowFreeText: true,
|
|
7851
|
+
type: "text",
|
|
7860
7852
|
question: {
|
|
7861
7853
|
ja: "GA4 \u30D7\u30ED\u30D1\u30C6\u30A3 ID \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u4F8B: 123456789\uFF09\u3002GA4 \u7BA1\u7406\u753B\u9762 > \u30D7\u30ED\u30D1\u30C6\u30A3\u8A2D\u5B9A\u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002",
|
|
7862
7854
|
en: "Enter your GA4 Property ID (e.g., 123456789). Found in GA4 Admin > Property Settings."
|
|
7863
7855
|
},
|
|
7864
|
-
async fetchOptions(state
|
|
7856
|
+
async fetchOptions(state) {
|
|
7865
7857
|
if (state.properties?.length) return [];
|
|
7866
|
-
|
|
7867
|
-
return existing ? [{ value: existing, label: existing }] : [
|
|
7868
|
-
{
|
|
7869
|
-
value: "example",
|
|
7870
|
-
label: rt.language === "ja" ? "\u4F8B: 123456789" : "Example: 123456789"
|
|
7871
|
-
}
|
|
7872
|
-
];
|
|
7858
|
+
return [{ value: "_show", label: "" }];
|
|
7873
7859
|
},
|
|
7874
7860
|
applyAnswer: (state, answer) => ({
|
|
7875
7861
|
...state,
|
|
7876
7862
|
manualPropertyId: answer[0]
|
|
7877
|
-
})
|
|
7878
|
-
toParameterUpdates: (state) => state.manualPropertyId ? [
|
|
7879
|
-
{
|
|
7880
|
-
slug: parameters13.propertyId.slug,
|
|
7881
|
-
value: state.manualPropertyId
|
|
7882
|
-
}
|
|
7883
|
-
] : []
|
|
7863
|
+
})
|
|
7884
7864
|
}
|
|
7885
7865
|
],
|
|
7886
7866
|
async finalize(state, rt) {
|
|
@@ -7936,7 +7916,7 @@ var googleAnalyticsSetupFlow = {
|
|
|
7936
7916
|
}
|
|
7937
7917
|
return sections.join("\n");
|
|
7938
7918
|
}
|
|
7939
|
-
const propertyId = state.manualPropertyId
|
|
7919
|
+
const propertyId = state.manualPropertyId;
|
|
7940
7920
|
if (propertyId) {
|
|
7941
7921
|
sections.push(`### Property: ${propertyId}`, "");
|
|
7942
7922
|
const { dimensions, metrics } = await getMetadata(
|
|
@@ -7947,7 +7927,7 @@ var googleAnalyticsSetupFlow = {
|
|
|
7947
7927
|
return sections.join("\n");
|
|
7948
7928
|
}
|
|
7949
7929
|
sections.push(
|
|
7950
|
-
"_Could not list GA4 accounts. Please enable the Google Analytics Admin API in your GCP project
|
|
7930
|
+
"_Could not list GA4 accounts. Please enable the Google Analytics Admin API in your GCP project. Property ID can be specified per request at runtime._",
|
|
7951
7931
|
""
|
|
7952
7932
|
);
|
|
7953
7933
|
return sections.join("\n");
|
|
@@ -7961,8 +7941,9 @@ var REQUEST_TIMEOUT_MS10 = 6e4;
|
|
|
7961
7941
|
var inputSchema20 = z20.object({
|
|
7962
7942
|
toolUseIntent: z20.string().optional().describe("Brief description of what you intend to accomplish with this tool call"),
|
|
7963
7943
|
connectionId: z20.string().describe("ID of the Google Analytics connection to use"),
|
|
7944
|
+
propertyId: z20.string().describe("GA4 property ID (e.g., '123456789')"),
|
|
7964
7945
|
method: z20.enum(["GET", "POST"]).describe("HTTP method"),
|
|
7965
|
-
path: z20.string().describe("API path (e.g., 'properties/{propertyId}:runReport'). {propertyId} is
|
|
7946
|
+
path: z20.string().describe("API path (e.g., 'properties/{propertyId}:runReport'). {propertyId} is replaced with the propertyId parameter."),
|
|
7966
7947
|
body: z20.record(z20.string(), z20.unknown()).optional().describe("POST request body (JSON)")
|
|
7967
7948
|
});
|
|
7968
7949
|
var outputSchema20 = z20.discriminatedUnion("success", [
|
|
@@ -7980,10 +7961,10 @@ var requestTool3 = new ConnectorTool({
|
|
|
7980
7961
|
name: "request",
|
|
7981
7962
|
description: `Send authenticated requests to the Google Analytics Data API.
|
|
7982
7963
|
Authentication is handled automatically using a service account.
|
|
7983
|
-
{propertyId} in the path is automatically replaced with the
|
|
7964
|
+
{propertyId} in the path is automatically replaced with the propertyId parameter.`,
|
|
7984
7965
|
inputSchema: inputSchema20,
|
|
7985
7966
|
outputSchema: outputSchema20,
|
|
7986
|
-
async execute({ connectionId, method, path: path5, body }, connections) {
|
|
7967
|
+
async execute({ connectionId, propertyId, method, path: path5, body }, connections) {
|
|
7987
7968
|
const connection2 = connections.find((c) => c.id === connectionId);
|
|
7988
7969
|
if (!connection2) {
|
|
7989
7970
|
return { success: false, error: `Connection ${connectionId} not found` };
|
|
@@ -7992,7 +7973,6 @@ Authentication is handled automatically using a service account.
|
|
|
7992
7973
|
try {
|
|
7993
7974
|
const { GoogleAuth } = await import("google-auth-library");
|
|
7994
7975
|
const keyJsonBase64 = parameters13.serviceAccountKeyJsonBase64.getValue(connection2);
|
|
7995
|
-
const propertyId = parameters13.propertyId.getValue(connection2);
|
|
7996
7976
|
const credentials = JSON.parse(
|
|
7997
7977
|
Buffer.from(keyJsonBase64, "base64").toString("utf-8")
|
|
7998
7978
|
);
|
|
@@ -8052,7 +8032,7 @@ var googleAnalyticsConnector = new ConnectorPlugin({
|
|
|
8052
8032
|
systemPrompt: {
|
|
8053
8033
|
en: `### Tools
|
|
8054
8034
|
|
|
8055
|
-
- \`google-analytics-service-account_request\`: The only way to call the GA4 Data API. Use it to fetch metadata, run reports, or run realtime reports. See the GA4 Data API Reference below for available endpoints and request bodies.
|
|
8035
|
+
- \`google-analytics-service-account_request\`: The only way to call the GA4 Data API. Use it to fetch metadata, run reports, or run realtime reports. Requires a \`propertyId\` parameter. See the GA4 Data API Reference below for available endpoints and request bodies.
|
|
8056
8036
|
|
|
8057
8037
|
### Business Logic
|
|
8058
8038
|
|
|
@@ -8061,9 +8041,11 @@ The business logic type for this connector is "typescript". Use the connector SD
|
|
|
8061
8041
|
SDK methods (client created via \`connection(connectionId)\`):
|
|
8062
8042
|
- \`client.runReport(request)\` \u2014 run a GA4 report
|
|
8063
8043
|
- \`client.runRealtimeReport(request)\` \u2014 run a realtime report
|
|
8064
|
-
- \`client.getMetadata()\` \u2014 fetch available dimensions/metrics
|
|
8044
|
+
- \`client.getMetadata(request)\` \u2014 fetch available dimensions/metrics
|
|
8065
8045
|
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch
|
|
8066
8046
|
|
|
8047
|
+
**IMPORTANT**: You MUST always include \`propertyId\` in every SDK method call. The property ID is obtained during the setup flow. Without it, the request will fail.
|
|
8048
|
+
|
|
8067
8049
|
\`\`\`ts
|
|
8068
8050
|
import type { Context } from "hono";
|
|
8069
8051
|
import { connection } from "@squadbase/vite-server/connectors/google-analytics";
|
|
@@ -8071,12 +8053,14 @@ import { connection } from "@squadbase/vite-server/connectors/google-analytics";
|
|
|
8071
8053
|
const ga = connection("<connectionId>");
|
|
8072
8054
|
|
|
8073
8055
|
export default async function handler(c: Context) {
|
|
8074
|
-
const { startDate = "7daysAgo", endDate = "today" } = await c.req.json<{
|
|
8056
|
+
const { propertyId, startDate = "7daysAgo", endDate = "today" } = await c.req.json<{
|
|
8057
|
+
propertyId: string;
|
|
8075
8058
|
startDate?: string;
|
|
8076
8059
|
endDate?: string;
|
|
8077
8060
|
}>();
|
|
8078
8061
|
|
|
8079
8062
|
const { rows } = await ga.runReport({
|
|
8063
|
+
propertyId,
|
|
8080
8064
|
dateRanges: [{ startDate, endDate }],
|
|
8081
8065
|
dimensions: [{ name: "date" }],
|
|
8082
8066
|
metrics: [{ name: "activeUsers" }, { name: "sessions" }],
|
|
@@ -8120,7 +8104,7 @@ activeUsers, sessions, screenPageViews, bounceRate, averageSessionDuration, conv
|
|
|
8120
8104
|
- Relative: \`"today"\`, \`"yesterday"\`, \`"7daysAgo"\`, \`"30daysAgo"\``,
|
|
8121
8105
|
ja: `### \u30C4\u30FC\u30EB
|
|
8122
8106
|
|
|
8123
|
-
- \`google-analytics-service-account_request\`: GA4 Data API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u3001\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u3068\u30EA\u30AF\u30A8\u30B9\u30C8\u30DC\u30C7\u30A3\u306F\u4E0B\u90E8\u306E\u300CGA4 Data API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9\u300D\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
8107
|
+
- \`google-analytics-service-account_request\`: GA4 Data API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30E1\u30BF\u30C7\u30FC\u30BF\u306E\u53D6\u5F97\u3001\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u3001\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u306E\u5B9F\u884C\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\`propertyId\` \u30D1\u30E9\u30E1\u30FC\u30BF\u30FC\u304C\u5FC5\u8981\u3067\u3059\u3002\u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8\u3068\u30EA\u30AF\u30A8\u30B9\u30C8\u30DC\u30C7\u30A3\u306F\u4E0B\u90E8\u306E\u300CGA4 Data API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9\u300D\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
8124
8108
|
|
|
8125
8109
|
### Business Logic
|
|
8126
8110
|
|
|
@@ -8129,9 +8113,11 @@ activeUsers, sessions, screenPageViews, bounceRate, averageSessionDuration, conv
|
|
|
8129
8113
|
SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
8130
8114
|
- \`client.runReport(request)\` \u2014 GA4\u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C
|
|
8131
8115
|
- \`client.runRealtimeReport(request)\` \u2014 \u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u30EC\u30DD\u30FC\u30C8\u3092\u5B9F\u884C
|
|
8132
|
-
- \`client.getMetadata()\` \u2014 \u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3/\u30E1\u30C8\u30EA\u30AF\u30B9\u3092\u53D6\u5F97
|
|
8116
|
+
- \`client.getMetadata(request)\` \u2014 \u5229\u7528\u53EF\u80FD\u306A\u30C7\u30A3\u30E1\u30F3\u30B7\u30E7\u30F3/\u30E1\u30C8\u30EA\u30AF\u30B9\u3092\u53D6\u5F97
|
|
8133
8117
|
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304Dfetch
|
|
8134
8118
|
|
|
8119
|
+
**\u91CD\u8981**: \u3059\u3079\u3066\u306ESDK\u30E1\u30BD\u30C3\u30C9\u547C\u3073\u51FA\u3057\u306B\u306F\u5FC5\u305A \`propertyId\` \u3092\u542B\u3081\u3066\u304F\u3060\u3055\u3044\u3002\u30D7\u30ED\u30D1\u30C6\u30A3ID\u306F\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u30D5\u30ED\u30FC\u3067\u53D6\u5F97\u3055\u308C\u307E\u3059\u3002\u6307\u5B9A\u3057\u306A\u3044\u3068\u30EA\u30AF\u30A8\u30B9\u30C8\u304C\u5931\u6557\u3057\u307E\u3059\u3002
|
|
8120
|
+
|
|
8135
8121
|
\`\`\`ts
|
|
8136
8122
|
import type { Context } from "hono";
|
|
8137
8123
|
import { connection } from "@squadbase/vite-server/connectors/google-analytics";
|
|
@@ -8139,12 +8125,14 @@ import { connection } from "@squadbase/vite-server/connectors/google-analytics";
|
|
|
8139
8125
|
const ga = connection("<connectionId>");
|
|
8140
8126
|
|
|
8141
8127
|
export default async function handler(c: Context) {
|
|
8142
|
-
const { startDate = "7daysAgo", endDate = "today" } = await c.req.json<{
|
|
8128
|
+
const { propertyId, startDate = "7daysAgo", endDate = "today" } = await c.req.json<{
|
|
8129
|
+
propertyId: string;
|
|
8143
8130
|
startDate?: string;
|
|
8144
8131
|
endDate?: string;
|
|
8145
8132
|
}>();
|
|
8146
8133
|
|
|
8147
8134
|
const { rows } = await ga.runReport({
|
|
8135
|
+
propertyId,
|
|
8148
8136
|
dateRanges: [{ startDate, endDate }],
|
|
8149
8137
|
dimensions: [{ name: "date" }],
|
|
8150
8138
|
metrics: [{ name: "activeUsers" }, { name: "sessions" }],
|
|
@@ -8197,15 +8185,8 @@ activeUsers, sessions, screenPageViews, bounceRate, averageSessionDuration, conv
|
|
|
8197
8185
|
error: "google-analytics: missing service account key"
|
|
8198
8186
|
};
|
|
8199
8187
|
}
|
|
8200
|
-
const propertyId = params[parameters13.propertyId.slug];
|
|
8201
|
-
if (!propertyId) {
|
|
8202
|
-
return { success: true };
|
|
8203
|
-
}
|
|
8204
8188
|
try {
|
|
8205
|
-
const res = await dataFetch(
|
|
8206
|
-
params,
|
|
8207
|
-
`/properties/${propertyId}/metadata`
|
|
8208
|
-
);
|
|
8189
|
+
const res = await dataFetch(params, `/metadata`);
|
|
8209
8190
|
if (!res.ok) {
|
|
8210
8191
|
const body = await res.text().catch(() => res.statusText);
|
|
8211
8192
|
return {
|
|
@@ -41872,7 +41853,7 @@ function createAirtableClient(entry, slug) {
|
|
|
41872
41853
|
// src/connector-client/google-analytics.ts
|
|
41873
41854
|
function createGoogleAnalyticsClient(entry, slug) {
|
|
41874
41855
|
const serviceAccountJsonBase64 = resolveEnvVar(entry, "service-account-key-json-base64", slug);
|
|
41875
|
-
const
|
|
41856
|
+
const defaultPropertyId = resolveEnvVarOptional(entry, "property-id");
|
|
41876
41857
|
const serviceAccountJson = Buffer.from(serviceAccountJsonBase64, "base64").toString("utf-8");
|
|
41877
41858
|
let credentials;
|
|
41878
41859
|
try {
|
|
@@ -41884,6 +41865,11 @@ function createGoogleAnalyticsClient(entry, slug) {
|
|
|
41884
41865
|
}
|
|
41885
41866
|
return {
|
|
41886
41867
|
async runReport(request) {
|
|
41868
|
+
const { propertyId: pid, ...reportRequest } = request;
|
|
41869
|
+
const propertyId = pid || defaultPropertyId;
|
|
41870
|
+
if (!propertyId) {
|
|
41871
|
+
throw new Error("Google Analytics: propertyId is required in runReport request");
|
|
41872
|
+
}
|
|
41887
41873
|
const { BetaAnalyticsDataClient } = await import("@google-analytics/data");
|
|
41888
41874
|
const client = new BetaAnalyticsDataClient({
|
|
41889
41875
|
credentials: {
|
|
@@ -41893,11 +41879,11 @@ function createGoogleAnalyticsClient(entry, slug) {
|
|
|
41893
41879
|
});
|
|
41894
41880
|
const response = await client.runReport({
|
|
41895
41881
|
property: `properties/${propertyId}`,
|
|
41896
|
-
dateRanges:
|
|
41897
|
-
dimensions:
|
|
41898
|
-
metrics:
|
|
41899
|
-
limit:
|
|
41900
|
-
offset:
|
|
41882
|
+
dateRanges: reportRequest.dateRanges,
|
|
41883
|
+
dimensions: reportRequest.dimensions,
|
|
41884
|
+
metrics: reportRequest.metrics,
|
|
41885
|
+
limit: reportRequest.limit != null ? String(reportRequest.limit) : void 0,
|
|
41886
|
+
offset: reportRequest.offset != null ? String(reportRequest.offset) : void 0
|
|
41901
41887
|
});
|
|
41902
41888
|
const reportResponse = Array.isArray(response) ? response[0] : response;
|
|
41903
41889
|
const rawRows = reportResponse.rows;
|