@squadbase/vite-server 0.1.12-dev.a9ac647 → 0.1.17-dev.24af54e
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 +12374 -883
- package/dist/connectors/airtable-oauth.js +257 -46
- package/dist/connectors/airtable.js +294 -51
- package/dist/connectors/amplitude.js +297 -47
- package/dist/connectors/anthropic.js +135 -47
- package/dist/connectors/asana.js +302 -49
- package/dist/connectors/attio.js +277 -49
- package/dist/connectors/aws-billing.js +262 -46
- package/dist/connectors/azure-sql.js +396 -102
- package/dist/connectors/backlog-api-key.js +292 -47
- package/dist/connectors/clickup.js +313 -49
- package/dist/connectors/cosmosdb.js +280 -50
- package/dist/connectors/customerio.js +294 -47
- package/dist/connectors/dbt.js +315 -47
- package/dist/connectors/freshdesk.js +317 -53
- package/dist/connectors/freshsales.js +308 -52
- package/dist/connectors/freshservice.js +336 -53
- package/dist/connectors/gamma.js +302 -52
- package/dist/connectors/gemini.js +134 -47
- package/dist/connectors/github.js +361 -49
- package/dist/connectors/gmail-oauth.js +179 -7
- package/dist/connectors/gmail.js +325 -47
- package/dist/connectors/google-ads.js +263 -46
- package/dist/connectors/google-analytics-oauth.js +285 -46
- package/dist/connectors/google-analytics.js +387 -49
- package/dist/connectors/google-audit-log.js +413 -47
- package/dist/connectors/google-calendar-oauth.js +234 -46
- package/dist/connectors/google-calendar.js +334 -47
- package/dist/connectors/google-docs.js +195 -6
- package/dist/connectors/google-drive.js +237 -5
- package/dist/connectors/google-search-console-oauth.js +231 -46
- package/dist/connectors/google-sheets.js +247 -47
- package/dist/connectors/google-slides.js +180 -6
- package/dist/connectors/grafana.js +307 -49
- package/dist/connectors/hubspot-oauth.js +183 -5
- package/dist/connectors/hubspot.js +281 -49
- package/dist/connectors/influxdb.js +391 -51
- package/dist/connectors/intercom-oauth.js +185 -5
- package/dist/connectors/intercom.js +277 -49
- package/dist/connectors/jdbc.js +737 -110
- package/dist/connectors/jira-api-key.js +301 -47
- package/dist/connectors/kintone-api-token.js +256 -47
- package/dist/connectors/kintone.js +303 -47
- package/dist/connectors/linear.js +305 -49
- package/dist/connectors/linkedin-ads.js +243 -50
- package/dist/connectors/mailchimp-oauth.js +243 -46
- package/dist/connectors/mailchimp.js +295 -49
- package/dist/connectors/meta-ads-oauth.js +248 -48
- package/dist/connectors/meta-ads.js +260 -50
- package/dist/connectors/mixpanel.js +313 -47
- package/dist/connectors/monday.js +335 -49
- package/dist/connectors/mongodb.js +294 -57
- package/dist/connectors/notion-oauth.js +206 -5
- package/dist/connectors/notion.js +298 -51
- package/dist/connectors/openai.js +134 -47
- package/dist/connectors/oracle.js +414 -103
- package/dist/connectors/outlook-oauth.js +179 -5
- package/dist/connectors/powerbi-oauth.js +226 -5
- package/dist/connectors/salesforce.js +359 -49
- package/dist/connectors/semrush.js +289 -49
- package/dist/connectors/sentry.js +264 -50
- package/dist/connectors/shopify-oauth.js +162 -5
- package/dist/connectors/shopify.js +332 -47
- package/dist/connectors/sqlserver.js +390 -102
- package/dist/connectors/stripe-api-key.js +244 -46
- package/dist/connectors/stripe-oauth.js +177 -5
- package/dist/connectors/supabase.js +278 -48
- package/dist/connectors/tableau.js +389 -184
- package/dist/connectors/tiktok-ads.js +254 -48
- package/dist/connectors/wix-store.js +295 -49
- package/dist/connectors/zendesk-oauth.js +214 -5
- package/dist/connectors/zendesk.js +333 -47
- package/dist/index.d.ts +149 -1
- package/dist/index.js +13677 -1969
- package/dist/main.js +13627 -1927
- package/dist/vite-plugin.js +12391 -890
- package/package.json +1 -1
|
@@ -1,48 +1,60 @@
|
|
|
1
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
+
var __esm = (fn, res) => function __init() {
|
|
3
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
4
|
+
};
|
|
5
|
+
|
|
1
6
|
// ../connectors/src/parameter-definition.ts
|
|
2
|
-
var ParameterDefinition
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
7
|
+
var ParameterDefinition;
|
|
8
|
+
var init_parameter_definition = __esm({
|
|
9
|
+
"../connectors/src/parameter-definition.ts"() {
|
|
10
|
+
"use strict";
|
|
11
|
+
ParameterDefinition = class {
|
|
12
|
+
slug;
|
|
13
|
+
name;
|
|
14
|
+
description;
|
|
15
|
+
envVarBaseKey;
|
|
16
|
+
type;
|
|
17
|
+
secret;
|
|
18
|
+
required;
|
|
19
|
+
constructor(config) {
|
|
20
|
+
this.slug = config.slug;
|
|
21
|
+
this.name = config.name;
|
|
22
|
+
this.description = config.description;
|
|
23
|
+
this.envVarBaseKey = config.envVarBaseKey;
|
|
24
|
+
this.type = config.type;
|
|
25
|
+
this.secret = config.secret;
|
|
26
|
+
this.required = config.required;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the parameter value from a ConnectorConnectionObject.
|
|
30
|
+
*/
|
|
31
|
+
getValue(connection2) {
|
|
32
|
+
const param = connection2.parameters.find(
|
|
33
|
+
(p) => p.parameterSlug === this.slug
|
|
34
|
+
);
|
|
35
|
+
if (!param || param.value == null) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
`Parameter "${this.slug}" not found or has no value in connection "${connection2.id}"`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
return param.value;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Try to get the parameter value. Returns undefined if not found (for optional params).
|
|
44
|
+
*/
|
|
45
|
+
tryGetValue(connection2) {
|
|
46
|
+
const param = connection2.parameters.find(
|
|
47
|
+
(p) => p.parameterSlug === this.slug
|
|
48
|
+
);
|
|
49
|
+
if (!param || param.value == null) return void 0;
|
|
50
|
+
return param.value;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
42
53
|
}
|
|
43
|
-
};
|
|
54
|
+
});
|
|
44
55
|
|
|
45
56
|
// ../connectors/src/connectors/google-audit-log/parameters.ts
|
|
57
|
+
init_parameter_definition();
|
|
46
58
|
var parameters = {
|
|
47
59
|
serviceAccountKeyJsonBase64: new ParameterDefinition({
|
|
48
60
|
slug: "service-account-key-json-base64",
|
|
@@ -165,6 +177,28 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
165
177
|
tools;
|
|
166
178
|
query;
|
|
167
179
|
checkConnection;
|
|
180
|
+
/**
|
|
181
|
+
* SQPD-1212: Logic-based, rule-driven connection setup. Connectors that
|
|
182
|
+
* implement this expose a step-by-step exploration flow (database/schema/
|
|
183
|
+
* table/etc. discovery) that the dashboard backend drives via the
|
|
184
|
+
* `/connections/:connectionId/setup` endpoint. Implement by delegating to
|
|
185
|
+
* `runSetupFlow` from `setup-flow.ts`.
|
|
186
|
+
*/
|
|
187
|
+
setup;
|
|
188
|
+
/**
|
|
189
|
+
* Opt-out of the default "verify before save" behavior on connection
|
|
190
|
+
* creation. The backend invokes `checkConnection` synchronously while
|
|
191
|
+
* creating the connection and aborts (no row inserted) if it fails — this
|
|
192
|
+
* flag disables that for connectors where the check cannot succeed pre-save:
|
|
193
|
+
*
|
|
194
|
+
* - `squadbase-db` populates `connection-url` only after Neon provisioning
|
|
195
|
+
* - OAuth connectors require an OAuth-aware proxyFetch keyed by the
|
|
196
|
+
* connectionId, which doesn't exist until the row is saved
|
|
197
|
+
*
|
|
198
|
+
* Exceptions are the explicit position; new credential-input connectors get
|
|
199
|
+
* the default verify-on-create behavior without opt-in.
|
|
200
|
+
*/
|
|
201
|
+
skipConnectionCheckOnCreate;
|
|
168
202
|
constructor(config) {
|
|
169
203
|
this.slug = config.slug;
|
|
170
204
|
this.authType = config.authType;
|
|
@@ -181,6 +215,8 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
181
215
|
this.tools = config.tools;
|
|
182
216
|
this.query = config.query;
|
|
183
217
|
this.checkConnection = config.checkConnection;
|
|
218
|
+
this.setup = config.setup;
|
|
219
|
+
this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
|
|
184
220
|
}
|
|
185
221
|
get connectorKey() {
|
|
186
222
|
return _ConnectorPlugin.deriveKey(this.slug, this.authType);
|
|
@@ -245,6 +281,51 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
245
281
|
}
|
|
246
282
|
};
|
|
247
283
|
|
|
284
|
+
// ../connectors/src/setup-flow.ts
|
|
285
|
+
async function runSetupFlow(flow, params, ctx, config) {
|
|
286
|
+
const runtime = {
|
|
287
|
+
params,
|
|
288
|
+
language: ctx.language,
|
|
289
|
+
config
|
|
290
|
+
};
|
|
291
|
+
let state = flow.initialState();
|
|
292
|
+
let answerIdx = 0;
|
|
293
|
+
for (const step of flow.steps) {
|
|
294
|
+
const ans = ctx.answers[answerIdx];
|
|
295
|
+
if (ans && ans.questionSlug === step.slug) {
|
|
296
|
+
state = step.applyAnswer(state, ans.answer);
|
|
297
|
+
answerIdx += 1;
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
if (step.type === "text") {
|
|
301
|
+
return {
|
|
302
|
+
type: "nextQuestion",
|
|
303
|
+
questionSlug: step.slug,
|
|
304
|
+
question: step.question[ctx.language],
|
|
305
|
+
questionType: "text"
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
|
|
309
|
+
if (options.length === 0) {
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
return {
|
|
313
|
+
type: "nextQuestion",
|
|
314
|
+
questionSlug: step.slug,
|
|
315
|
+
question: step.question[ctx.language],
|
|
316
|
+
questionType: step.type,
|
|
317
|
+
options
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
const dataInvestigationResult = await flow.finalize(state, runtime);
|
|
321
|
+
return { type: "fulfilled", dataInvestigationResult };
|
|
322
|
+
}
|
|
323
|
+
async function resolveSetupSelection(params) {
|
|
324
|
+
const { selected, allSentinel, fetchAll, limit } = params;
|
|
325
|
+
const resolved = selected.includes(allSentinel) ? await fetchAll() : selected.filter((v) => v !== allSentinel);
|
|
326
|
+
return resolved.slice(0, limit);
|
|
327
|
+
}
|
|
328
|
+
|
|
248
329
|
// ../connectors/src/auth-types.ts
|
|
249
330
|
var AUTH_TYPES = {
|
|
250
331
|
OAUTH: "oauth",
|
|
@@ -470,6 +551,221 @@ var googleAuditLogOnboarding = new ConnectorOnboarding({
|
|
|
470
551
|
}
|
|
471
552
|
});
|
|
472
553
|
|
|
554
|
+
// ../connectors/src/connectors/google-audit-log/setup-flow.ts
|
|
555
|
+
var ALL_APPLICATIONS = "__ALL_APPLICATIONS__";
|
|
556
|
+
var GOOGLE_AUDIT_LOG_SETUP_MAX_APPS = 24;
|
|
557
|
+
var APPLICATIONS = [
|
|
558
|
+
{
|
|
559
|
+
value: "access_transparency",
|
|
560
|
+
label: {
|
|
561
|
+
en: "Access Transparency \u2014 Google staff access events",
|
|
562
|
+
ja: "Access Transparency \u2014 Google \u30B9\u30BF\u30C3\u30D5\u306E\u30A2\u30AF\u30BB\u30B9\u8A18\u9332"
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
value: "admin",
|
|
567
|
+
label: {
|
|
568
|
+
en: "Admin \u2014 Workspace admin console actions",
|
|
569
|
+
ja: "Admin \u2014 \u7BA1\u7406\u30B3\u30F3\u30BD\u30FC\u30EB\u306E\u64CD\u4F5C"
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
value: "calendar",
|
|
574
|
+
label: {
|
|
575
|
+
en: "Calendar \u2014 calendar events and sharing changes",
|
|
576
|
+
ja: "Calendar \u2014 \u30AB\u30EC\u30F3\u30C0\u30FC\u30A4\u30D9\u30F3\u30C8\u3068\u5171\u6709\u8A2D\u5B9A\u306E\u5909\u66F4"
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
value: "chat",
|
|
581
|
+
label: {
|
|
582
|
+
en: "Chat \u2014 Google Chat messages and spaces",
|
|
583
|
+
ja: "Chat \u2014 Google Chat \u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3068\u30B9\u30DA\u30FC\u30B9"
|
|
584
|
+
}
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
value: "chrome",
|
|
588
|
+
label: {
|
|
589
|
+
en: "Chrome \u2014 Chrome browser/device management events",
|
|
590
|
+
ja: "Chrome \u2014 Chrome \u30D6\u30E9\u30A6\u30B6\u30FB\u30C7\u30D0\u30A4\u30B9\u7BA1\u7406\u30A4\u30D9\u30F3\u30C8"
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
value: "context_aware_access",
|
|
595
|
+
label: {
|
|
596
|
+
en: "Context-aware Access \u2014 access policy evaluations",
|
|
597
|
+
ja: "Context-aware Access \u2014 \u30A2\u30AF\u30BB\u30B9\u30DD\u30EA\u30B7\u30FC\u8A55\u4FA1"
|
|
598
|
+
}
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
value: "data_studio",
|
|
602
|
+
label: {
|
|
603
|
+
en: "Looker Studio \u2014 report/data source activity",
|
|
604
|
+
ja: "Looker Studio \u2014 \u30EC\u30DD\u30FC\u30C8 / \u30C7\u30FC\u30BF\u30BD\u30FC\u30B9\u306E\u64CD\u4F5C"
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
value: "drive",
|
|
609
|
+
label: {
|
|
610
|
+
en: "Drive \u2014 file create / share / download / delete",
|
|
611
|
+
ja: "Drive \u2014 \u30D5\u30A1\u30A4\u30EB\u306E\u4F5C\u6210\u30FB\u5171\u6709\u30FB\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u30FB\u524A\u9664"
|
|
612
|
+
}
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
value: "gcp",
|
|
616
|
+
label: {
|
|
617
|
+
en: "GCP \u2014 Workspace-linked GCP project events",
|
|
618
|
+
ja: "GCP \u2014 Workspace \u306B\u7D10\u3065\u304F GCP \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30A4\u30D9\u30F3\u30C8"
|
|
619
|
+
}
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
value: "gplus",
|
|
623
|
+
label: {
|
|
624
|
+
en: "Currents/Google+ \u2014 community events (legacy)",
|
|
625
|
+
ja: "Currents/Google+ \u2014 \u30B3\u30DF\u30E5\u30CB\u30C6\u30A3\u30A4\u30D9\u30F3\u30C8 (\u30EC\u30AC\u30B7\u30FC)"
|
|
626
|
+
}
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
value: "groups",
|
|
630
|
+
label: {
|
|
631
|
+
en: "Groups \u2014 group membership and settings",
|
|
632
|
+
ja: "Groups \u2014 \u30B0\u30EB\u30FC\u30D7\u30E1\u30F3\u30D0\u30FC\u30B7\u30C3\u30D7\u3068\u8A2D\u5B9A"
|
|
633
|
+
}
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
value: "groups_enterprise",
|
|
637
|
+
label: {
|
|
638
|
+
en: "Groups Enterprise \u2014 enterprise group activity",
|
|
639
|
+
ja: "Groups Enterprise \u2014 \u30A8\u30F3\u30BF\u30FC\u30D7\u30E9\u30A4\u30BA\u30B0\u30EB\u30FC\u30D7\u306E\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3"
|
|
640
|
+
}
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
value: "jamboard",
|
|
644
|
+
label: {
|
|
645
|
+
en: "Jamboard \u2014 Jamboard device events",
|
|
646
|
+
ja: "Jamboard \u2014 Jamboard \u30C7\u30D0\u30A4\u30B9\u30A4\u30D9\u30F3\u30C8"
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
value: "keep",
|
|
651
|
+
label: {
|
|
652
|
+
en: "Keep \u2014 Keep notes activity",
|
|
653
|
+
ja: "Keep \u2014 Keep \u306E\u30E1\u30E2\u64CD\u4F5C"
|
|
654
|
+
}
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
value: "login",
|
|
658
|
+
label: {
|
|
659
|
+
en: "Login \u2014 user sign-in successes and failures",
|
|
660
|
+
ja: "Login \u2014 \u30E6\u30FC\u30B6\u30FC\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u6210\u5426"
|
|
661
|
+
}
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
value: "meet",
|
|
665
|
+
label: {
|
|
666
|
+
en: "Meet \u2014 meeting and recording events",
|
|
667
|
+
ja: "Meet \u2014 \u4F1A\u8B70\u30FB\u9332\u753B\u30A4\u30D9\u30F3\u30C8"
|
|
668
|
+
}
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
value: "mobile",
|
|
672
|
+
label: {
|
|
673
|
+
en: "Mobile \u2014 managed mobile device events",
|
|
674
|
+
ja: "Mobile \u2014 \u7BA1\u7406\u5BFE\u8C61\u30E2\u30D0\u30A4\u30EB\u30C7\u30D0\u30A4\u30B9\u306E\u30A4\u30D9\u30F3\u30C8"
|
|
675
|
+
}
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
value: "rules",
|
|
679
|
+
label: {
|
|
680
|
+
en: "Rules \u2014 automated rule triggers",
|
|
681
|
+
ja: "Rules \u2014 \u81EA\u52D5\u30EB\u30FC\u30EB\u306E\u767A\u706B"
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
value: "saml",
|
|
686
|
+
label: {
|
|
687
|
+
en: "SAML \u2014 SAML SSO sign-in events",
|
|
688
|
+
ja: "SAML \u2014 SAML SSO \u30B5\u30A4\u30F3\u30A4\u30F3\u30A4\u30D9\u30F3\u30C8"
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
value: "token",
|
|
693
|
+
label: {
|
|
694
|
+
en: "Token \u2014 OAuth token grants and revocations",
|
|
695
|
+
ja: "Token \u2014 OAuth \u30C8\u30FC\u30AF\u30F3\u306E\u4ED8\u4E0E\u30FB\u53D6\u308A\u6D88\u3057"
|
|
696
|
+
}
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
value: "user_accounts",
|
|
700
|
+
label: {
|
|
701
|
+
en: "User Accounts \u2014 end-user account self-service",
|
|
702
|
+
ja: "User Accounts \u2014 \u30A8\u30F3\u30C9\u30E6\u30FC\u30B6\u30FC\u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u64CD\u4F5C"
|
|
703
|
+
}
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
value: "vault",
|
|
707
|
+
label: {
|
|
708
|
+
en: "Vault \u2014 eDiscovery / retention activity",
|
|
709
|
+
ja: "Vault \u2014 eDiscovery\u30FB\u30C7\u30FC\u30BF\u4FDD\u6301\u306E\u64CD\u4F5C"
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
];
|
|
713
|
+
var googleAuditLogSetupFlow = {
|
|
714
|
+
initialState: () => ({}),
|
|
715
|
+
steps: [
|
|
716
|
+
{
|
|
717
|
+
slug: "applications",
|
|
718
|
+
type: "multiSelect",
|
|
719
|
+
question: {
|
|
720
|
+
ja: "\u5BFE\u8C61\u306E Workspace \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\uFF08\u76E3\u67FB\u5BFE\u8C61\uFF09\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\uFF08\u8907\u6570\u9078\u629E\u53EF\uFF09",
|
|
721
|
+
en: "Select target Workspace applications to audit (multi-select allowed)"
|
|
722
|
+
},
|
|
723
|
+
async fetchOptions(_state, rt) {
|
|
724
|
+
return [
|
|
725
|
+
{
|
|
726
|
+
value: ALL_APPLICATIONS,
|
|
727
|
+
label: rt.language === "ja" ? "\u3059\u3079\u3066\u306E\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3" : "All applications"
|
|
728
|
+
},
|
|
729
|
+
...APPLICATIONS.map((a) => ({
|
|
730
|
+
value: a.value,
|
|
731
|
+
label: a.label[rt.language]
|
|
732
|
+
}))
|
|
733
|
+
];
|
|
734
|
+
},
|
|
735
|
+
applyAnswer: (state, answer) => ({ ...state, applications: answer })
|
|
736
|
+
}
|
|
737
|
+
],
|
|
738
|
+
async finalize(state, rt) {
|
|
739
|
+
if (!state.applications) {
|
|
740
|
+
throw new Error(
|
|
741
|
+
"Google Audit Log setup: incomplete state on finalize"
|
|
742
|
+
);
|
|
743
|
+
}
|
|
744
|
+
const targetApplications = await resolveSetupSelection({
|
|
745
|
+
selected: state.applications,
|
|
746
|
+
allSentinel: ALL_APPLICATIONS,
|
|
747
|
+
fetchAll: async () => APPLICATIONS.map((a) => a.value),
|
|
748
|
+
limit: GOOGLE_AUDIT_LOG_SETUP_MAX_APPS
|
|
749
|
+
});
|
|
750
|
+
const labelByValue = new Map(
|
|
751
|
+
APPLICATIONS.map((a) => [a.value, a.label[rt.language]])
|
|
752
|
+
);
|
|
753
|
+
const sections = ["## Google Workspace Audit Log", ""];
|
|
754
|
+
if (targetApplications.length === 0) {
|
|
755
|
+
sections.push("_No applications selected._", "");
|
|
756
|
+
return sections.join("\n");
|
|
757
|
+
}
|
|
758
|
+
sections.push("| Application | Description |");
|
|
759
|
+
sections.push("|-------------|-------------|");
|
|
760
|
+
for (const app of targetApplications) {
|
|
761
|
+
const desc = (labelByValue.get(app) ?? app).replace(/\|/g, "\\|");
|
|
762
|
+
sections.push(`| ${app} | ${desc} |`);
|
|
763
|
+
}
|
|
764
|
+
sections.push("");
|
|
765
|
+
return sections.join("\n");
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
|
|
473
769
|
// ../connectors/src/connectors/google-audit-log/index.ts
|
|
474
770
|
var tools = { request_with_delegation: requestWithDelegationTool };
|
|
475
771
|
var googleAuditLogConnector = new ConnectorPlugin({
|
|
@@ -661,7 +957,57 @@ export default async function handler(c: Context) {
|
|
|
661
957
|
}
|
|
662
958
|
\`\`\``
|
|
663
959
|
},
|
|
664
|
-
tools
|
|
960
|
+
tools,
|
|
961
|
+
setup: (params, ctx, config) => runSetupFlow(googleAuditLogSetupFlow, params, ctx, config),
|
|
962
|
+
async checkConnection(params, _config) {
|
|
963
|
+
const keyJsonBase64 = params[parameters.serviceAccountKeyJsonBase64.slug];
|
|
964
|
+
if (!keyJsonBase64) {
|
|
965
|
+
return {
|
|
966
|
+
success: false,
|
|
967
|
+
error: "google-audit-log: missing service account key"
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
let sa;
|
|
971
|
+
try {
|
|
972
|
+
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
973
|
+
sa = JSON.parse(decoded);
|
|
974
|
+
} catch (err) {
|
|
975
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
976
|
+
return {
|
|
977
|
+
success: false,
|
|
978
|
+
error: `google-audit-log: failed to parse service account JSON: ${msg}`
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
if (!sa.client_email || !sa.private_key) {
|
|
982
|
+
return {
|
|
983
|
+
success: false,
|
|
984
|
+
error: "google-audit-log: service account JSON must contain client_email and private_key"
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
try {
|
|
988
|
+
const { GoogleAuth } = await import("google-auth-library");
|
|
989
|
+
const auth = new GoogleAuth({
|
|
990
|
+
credentials: {
|
|
991
|
+
client_email: sa.client_email,
|
|
992
|
+
private_key: sa.private_key
|
|
993
|
+
},
|
|
994
|
+
scopes: [
|
|
995
|
+
"https://www.googleapis.com/auth/admin.reports.audit.readonly"
|
|
996
|
+
]
|
|
997
|
+
});
|
|
998
|
+
const token = await auth.getAccessToken();
|
|
999
|
+
if (!token) {
|
|
1000
|
+
return {
|
|
1001
|
+
success: false,
|
|
1002
|
+
error: "google-audit-log: failed to obtain access token"
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
return { success: true };
|
|
1006
|
+
} catch (err) {
|
|
1007
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1008
|
+
return { success: false, error: msg };
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
665
1011
|
});
|
|
666
1012
|
|
|
667
1013
|
// src/connectors/create-connector-sdk.ts
|
|
@@ -690,6 +1036,7 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
690
1036
|
import { getContext } from "hono/context-storage";
|
|
691
1037
|
import { getCookie } from "hono/cookie";
|
|
692
1038
|
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
1039
|
+
var TABLEAU_SESSION_SENTINEL_URL = "squadbase://tableau-session/";
|
|
693
1040
|
function normalizeHeaders(input) {
|
|
694
1041
|
const out = {};
|
|
695
1042
|
if (!input) return out;
|
|
@@ -698,6 +1045,11 @@ function normalizeHeaders(input) {
|
|
|
698
1045
|
});
|
|
699
1046
|
return out;
|
|
700
1047
|
}
|
|
1048
|
+
function extractInputUrl(input) {
|
|
1049
|
+
if (typeof input === "string") return input;
|
|
1050
|
+
if (input instanceof URL) return input.href;
|
|
1051
|
+
return input.url;
|
|
1052
|
+
}
|
|
701
1053
|
function createSandboxProxyFetch(connectionId) {
|
|
702
1054
|
return async (input, init) => {
|
|
703
1055
|
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
@@ -707,10 +1059,17 @@ function createSandboxProxyFetch(connectionId) {
|
|
|
707
1059
|
"Connection proxy is not configured. Please check your deployment settings."
|
|
708
1060
|
);
|
|
709
1061
|
}
|
|
710
|
-
const originalUrl =
|
|
1062
|
+
const originalUrl = extractInputUrl(input);
|
|
1063
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
1064
|
+
if (originalUrl === TABLEAU_SESSION_SENTINEL_URL) {
|
|
1065
|
+
const sessionUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/tableau-session`;
|
|
1066
|
+
return fetch(sessionUrl, {
|
|
1067
|
+
method: "POST",
|
|
1068
|
+
headers: { Authorization: `Bearer ${token}` }
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
711
1071
|
const originalMethod = init?.method ?? "GET";
|
|
712
1072
|
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
713
|
-
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
714
1073
|
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
715
1074
|
return fetch(proxyUrl, {
|
|
716
1075
|
method: "POST",
|
|
@@ -736,10 +1095,9 @@ function createDeployedAppProxyFetch(connectionId) {
|
|
|
736
1095
|
}
|
|
737
1096
|
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
738
1097
|
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
1098
|
+
const sessionUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/tableau-session`;
|
|
739
1099
|
return async (input, init) => {
|
|
740
|
-
const originalUrl =
|
|
741
|
-
const originalMethod = init?.method ?? "GET";
|
|
742
|
-
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
1100
|
+
const originalUrl = extractInputUrl(input);
|
|
743
1101
|
const c = getContext();
|
|
744
1102
|
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
745
1103
|
if (!appSession) {
|
|
@@ -747,6 +1105,14 @@ function createDeployedAppProxyFetch(connectionId) {
|
|
|
747
1105
|
"No authentication method available for connection proxy."
|
|
748
1106
|
);
|
|
749
1107
|
}
|
|
1108
|
+
if (originalUrl === TABLEAU_SESSION_SENTINEL_URL) {
|
|
1109
|
+
return fetch(sessionUrl, {
|
|
1110
|
+
method: "POST",
|
|
1111
|
+
headers: { Authorization: `Bearer ${appSession}` }
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
const originalMethod = init?.method ?? "GET";
|
|
1115
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
750
1116
|
return fetch(proxyUrl, {
|
|
751
1117
|
method: "POST",
|
|
752
1118
|
headers: {
|