@squadbase/vite-server 0.1.12-dev.a9ac647 → 0.1.17-dev.3b633bb
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 +14375 -1652
- package/dist/connectors/airtable-oauth.js +282 -46
- package/dist/connectors/airtable.js +319 -51
- package/dist/connectors/amplitude.js +322 -47
- package/dist/connectors/anthropic.js +135 -47
- package/dist/connectors/asana.js +327 -49
- package/dist/connectors/attio.js +302 -49
- package/dist/connectors/aws-billing.js +287 -46
- package/dist/connectors/azure-sql.js +421 -102
- package/dist/connectors/backlog-api-key.js +317 -47
- package/dist/connectors/clickup.js +338 -49
- package/dist/connectors/cosmosdb.js +305 -50
- package/dist/connectors/customerio.js +319 -47
- package/dist/connectors/dbt.js +340 -47
- package/dist/connectors/freshdesk.js +342 -53
- package/dist/connectors/freshsales.js +333 -52
- package/dist/connectors/freshservice.js +361 -53
- package/dist/connectors/gamma.js +327 -52
- package/dist/connectors/gemini.js +134 -47
- package/dist/connectors/github.js +386 -49
- package/dist/connectors/gmail-oauth.js +204 -7
- package/dist/connectors/gmail.js +350 -47
- package/dist/connectors/google-ads.js +288 -46
- package/dist/connectors/google-analytics-oauth.js +310 -46
- package/dist/connectors/google-analytics.js +547 -87
- package/dist/connectors/google-audit-log.js +438 -47
- package/dist/connectors/google-calendar-oauth.js +259 -46
- package/dist/connectors/google-calendar.js +359 -47
- package/dist/connectors/google-docs.js +220 -6
- package/dist/connectors/google-drive.js +262 -5
- package/dist/connectors/google-search-console-oauth.js +256 -46
- package/dist/connectors/google-sheets.js +272 -47
- package/dist/connectors/google-slides.js +205 -6
- package/dist/connectors/grafana.js +332 -49
- package/dist/connectors/hubspot-oauth.js +208 -5
- package/dist/connectors/hubspot.js +306 -49
- package/dist/connectors/influxdb.js +416 -51
- package/dist/connectors/intercom-oauth.js +210 -5
- package/dist/connectors/intercom.js +302 -49
- package/dist/connectors/jdbc.js +762 -110
- package/dist/connectors/jira-api-key.js +326 -47
- package/dist/connectors/kintone-api-token.js +281 -47
- package/dist/connectors/kintone.js +328 -47
- package/dist/connectors/linear.js +330 -49
- package/dist/connectors/linkedin-ads.js +268 -50
- package/dist/connectors/mailchimp-oauth.js +268 -46
- package/dist/connectors/mailchimp.js +320 -49
- package/dist/connectors/meta-ads-oauth.js +273 -48
- package/dist/connectors/meta-ads.js +285 -50
- package/dist/connectors/mixpanel.js +338 -47
- package/dist/connectors/monday.js +360 -49
- package/dist/connectors/mongodb.js +319 -57
- package/dist/connectors/notion-oauth.js +231 -5
- package/dist/connectors/notion.js +323 -51
- package/dist/connectors/openai.js +134 -47
- package/dist/connectors/oracle.js +454 -103
- package/dist/connectors/outlook-oauth.js +204 -5
- package/dist/connectors/powerbi-oauth.js +498 -5
- package/dist/connectors/salesforce.js +384 -49
- package/dist/connectors/semrush.js +609 -49
- package/dist/connectors/sentry.js +289 -50
- package/dist/connectors/shopify-oauth.js +187 -5
- package/dist/connectors/shopify.js +357 -47
- package/dist/connectors/sqlserver.js +415 -102
- package/dist/connectors/stripe-api-key.js +269 -46
- package/dist/connectors/stripe-oauth.js +202 -5
- package/dist/connectors/supabase.js +303 -48
- package/dist/connectors/tableau.js +536 -163
- package/dist/connectors/tiktok-ads.js +279 -48
- package/dist/connectors/wix-store.js +320 -49
- package/dist/connectors/zendesk-oauth.js +239 -5
- package/dist/connectors/zendesk.js +358 -47
- package/dist/index.d.ts +149 -1
- package/dist/index.js +15057 -2117
- package/dist/main.js +15005 -2073
- package/dist/vite-plugin.js +14752 -2019
- 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,76 @@ 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
|
+
const pendingParameterUpdates = [];
|
|
294
|
+
for (const step of flow.steps) {
|
|
295
|
+
const ans = ctx.answers[answerIdx];
|
|
296
|
+
if (ans && ans.questionSlug === step.slug) {
|
|
297
|
+
state = step.applyAnswer(state, ans.answer);
|
|
298
|
+
if (step.toParameterUpdates) {
|
|
299
|
+
pendingParameterUpdates.push(...step.toParameterUpdates(state));
|
|
300
|
+
}
|
|
301
|
+
answerIdx += 1;
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
|
|
305
|
+
if (step.type === "text") {
|
|
306
|
+
if (step.fetchOptions) {
|
|
307
|
+
const options2 = await step.fetchOptions(state, runtime);
|
|
308
|
+
if (options2.length === 0) {
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return {
|
|
313
|
+
type: "nextQuestion",
|
|
314
|
+
questionSlug: step.slug,
|
|
315
|
+
question: step.question[ctx.language],
|
|
316
|
+
questionType: "text",
|
|
317
|
+
allowFreeText: resolvedAllowFreeText,
|
|
318
|
+
...pendingParameterUpdates.length > 0 && {
|
|
319
|
+
parameterUpdates: pendingParameterUpdates
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
|
|
324
|
+
if (options.length === 0) {
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
return {
|
|
328
|
+
type: "nextQuestion",
|
|
329
|
+
questionSlug: step.slug,
|
|
330
|
+
question: step.question[ctx.language],
|
|
331
|
+
questionType: step.type,
|
|
332
|
+
options,
|
|
333
|
+
allowFreeText: resolvedAllowFreeText,
|
|
334
|
+
...pendingParameterUpdates.length > 0 && {
|
|
335
|
+
parameterUpdates: pendingParameterUpdates
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
const dataInvestigationResult = await flow.finalize(state, runtime);
|
|
340
|
+
return {
|
|
341
|
+
type: "fulfilled",
|
|
342
|
+
dataInvestigationResult,
|
|
343
|
+
...pendingParameterUpdates.length > 0 && {
|
|
344
|
+
parameterUpdates: pendingParameterUpdates
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
async function resolveSetupSelection(params) {
|
|
349
|
+
const { selected, allSentinel, fetchAll, limit } = params;
|
|
350
|
+
const resolved = selected.includes(allSentinel) ? await fetchAll() : selected.filter((v) => v !== allSentinel);
|
|
351
|
+
return resolved.slice(0, limit);
|
|
352
|
+
}
|
|
353
|
+
|
|
248
354
|
// ../connectors/src/auth-types.ts
|
|
249
355
|
var AUTH_TYPES = {
|
|
250
356
|
OAUTH: "oauth",
|
|
@@ -470,6 +576,221 @@ var googleAuditLogOnboarding = new ConnectorOnboarding({
|
|
|
470
576
|
}
|
|
471
577
|
});
|
|
472
578
|
|
|
579
|
+
// ../connectors/src/connectors/google-audit-log/setup-flow.ts
|
|
580
|
+
var ALL_APPLICATIONS = "__ALL_APPLICATIONS__";
|
|
581
|
+
var GOOGLE_AUDIT_LOG_SETUP_MAX_APPS = 24;
|
|
582
|
+
var APPLICATIONS = [
|
|
583
|
+
{
|
|
584
|
+
value: "access_transparency",
|
|
585
|
+
label: {
|
|
586
|
+
en: "Access Transparency \u2014 Google staff access events",
|
|
587
|
+
ja: "Access Transparency \u2014 Google \u30B9\u30BF\u30C3\u30D5\u306E\u30A2\u30AF\u30BB\u30B9\u8A18\u9332"
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
value: "admin",
|
|
592
|
+
label: {
|
|
593
|
+
en: "Admin \u2014 Workspace admin console actions",
|
|
594
|
+
ja: "Admin \u2014 \u7BA1\u7406\u30B3\u30F3\u30BD\u30FC\u30EB\u306E\u64CD\u4F5C"
|
|
595
|
+
}
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
value: "calendar",
|
|
599
|
+
label: {
|
|
600
|
+
en: "Calendar \u2014 calendar events and sharing changes",
|
|
601
|
+
ja: "Calendar \u2014 \u30AB\u30EC\u30F3\u30C0\u30FC\u30A4\u30D9\u30F3\u30C8\u3068\u5171\u6709\u8A2D\u5B9A\u306E\u5909\u66F4"
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
value: "chat",
|
|
606
|
+
label: {
|
|
607
|
+
en: "Chat \u2014 Google Chat messages and spaces",
|
|
608
|
+
ja: "Chat \u2014 Google Chat \u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3068\u30B9\u30DA\u30FC\u30B9"
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
value: "chrome",
|
|
613
|
+
label: {
|
|
614
|
+
en: "Chrome \u2014 Chrome browser/device management events",
|
|
615
|
+
ja: "Chrome \u2014 Chrome \u30D6\u30E9\u30A6\u30B6\u30FB\u30C7\u30D0\u30A4\u30B9\u7BA1\u7406\u30A4\u30D9\u30F3\u30C8"
|
|
616
|
+
}
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
value: "context_aware_access",
|
|
620
|
+
label: {
|
|
621
|
+
en: "Context-aware Access \u2014 access policy evaluations",
|
|
622
|
+
ja: "Context-aware Access \u2014 \u30A2\u30AF\u30BB\u30B9\u30DD\u30EA\u30B7\u30FC\u8A55\u4FA1"
|
|
623
|
+
}
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
value: "data_studio",
|
|
627
|
+
label: {
|
|
628
|
+
en: "Looker Studio \u2014 report/data source activity",
|
|
629
|
+
ja: "Looker Studio \u2014 \u30EC\u30DD\u30FC\u30C8 / \u30C7\u30FC\u30BF\u30BD\u30FC\u30B9\u306E\u64CD\u4F5C"
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
value: "drive",
|
|
634
|
+
label: {
|
|
635
|
+
en: "Drive \u2014 file create / share / download / delete",
|
|
636
|
+
ja: "Drive \u2014 \u30D5\u30A1\u30A4\u30EB\u306E\u4F5C\u6210\u30FB\u5171\u6709\u30FB\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u30FB\u524A\u9664"
|
|
637
|
+
}
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
value: "gcp",
|
|
641
|
+
label: {
|
|
642
|
+
en: "GCP \u2014 Workspace-linked GCP project events",
|
|
643
|
+
ja: "GCP \u2014 Workspace \u306B\u7D10\u3065\u304F GCP \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30A4\u30D9\u30F3\u30C8"
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
value: "gplus",
|
|
648
|
+
label: {
|
|
649
|
+
en: "Currents/Google+ \u2014 community events (legacy)",
|
|
650
|
+
ja: "Currents/Google+ \u2014 \u30B3\u30DF\u30E5\u30CB\u30C6\u30A3\u30A4\u30D9\u30F3\u30C8 (\u30EC\u30AC\u30B7\u30FC)"
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
value: "groups",
|
|
655
|
+
label: {
|
|
656
|
+
en: "Groups \u2014 group membership and settings",
|
|
657
|
+
ja: "Groups \u2014 \u30B0\u30EB\u30FC\u30D7\u30E1\u30F3\u30D0\u30FC\u30B7\u30C3\u30D7\u3068\u8A2D\u5B9A"
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
value: "groups_enterprise",
|
|
662
|
+
label: {
|
|
663
|
+
en: "Groups Enterprise \u2014 enterprise group activity",
|
|
664
|
+
ja: "Groups Enterprise \u2014 \u30A8\u30F3\u30BF\u30FC\u30D7\u30E9\u30A4\u30BA\u30B0\u30EB\u30FC\u30D7\u306E\u30A2\u30AF\u30C6\u30A3\u30D3\u30C6\u30A3"
|
|
665
|
+
}
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
value: "jamboard",
|
|
669
|
+
label: {
|
|
670
|
+
en: "Jamboard \u2014 Jamboard device events",
|
|
671
|
+
ja: "Jamboard \u2014 Jamboard \u30C7\u30D0\u30A4\u30B9\u30A4\u30D9\u30F3\u30C8"
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
value: "keep",
|
|
676
|
+
label: {
|
|
677
|
+
en: "Keep \u2014 Keep notes activity",
|
|
678
|
+
ja: "Keep \u2014 Keep \u306E\u30E1\u30E2\u64CD\u4F5C"
|
|
679
|
+
}
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
value: "login",
|
|
683
|
+
label: {
|
|
684
|
+
en: "Login \u2014 user sign-in successes and failures",
|
|
685
|
+
ja: "Login \u2014 \u30E6\u30FC\u30B6\u30FC\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u6210\u5426"
|
|
686
|
+
}
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
value: "meet",
|
|
690
|
+
label: {
|
|
691
|
+
en: "Meet \u2014 meeting and recording events",
|
|
692
|
+
ja: "Meet \u2014 \u4F1A\u8B70\u30FB\u9332\u753B\u30A4\u30D9\u30F3\u30C8"
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
value: "mobile",
|
|
697
|
+
label: {
|
|
698
|
+
en: "Mobile \u2014 managed mobile device events",
|
|
699
|
+
ja: "Mobile \u2014 \u7BA1\u7406\u5BFE\u8C61\u30E2\u30D0\u30A4\u30EB\u30C7\u30D0\u30A4\u30B9\u306E\u30A4\u30D9\u30F3\u30C8"
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
value: "rules",
|
|
704
|
+
label: {
|
|
705
|
+
en: "Rules \u2014 automated rule triggers",
|
|
706
|
+
ja: "Rules \u2014 \u81EA\u52D5\u30EB\u30FC\u30EB\u306E\u767A\u706B"
|
|
707
|
+
}
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
value: "saml",
|
|
711
|
+
label: {
|
|
712
|
+
en: "SAML \u2014 SAML SSO sign-in events",
|
|
713
|
+
ja: "SAML \u2014 SAML SSO \u30B5\u30A4\u30F3\u30A4\u30F3\u30A4\u30D9\u30F3\u30C8"
|
|
714
|
+
}
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
value: "token",
|
|
718
|
+
label: {
|
|
719
|
+
en: "Token \u2014 OAuth token grants and revocations",
|
|
720
|
+
ja: "Token \u2014 OAuth \u30C8\u30FC\u30AF\u30F3\u306E\u4ED8\u4E0E\u30FB\u53D6\u308A\u6D88\u3057"
|
|
721
|
+
}
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
value: "user_accounts",
|
|
725
|
+
label: {
|
|
726
|
+
en: "User Accounts \u2014 end-user account self-service",
|
|
727
|
+
ja: "User Accounts \u2014 \u30A8\u30F3\u30C9\u30E6\u30FC\u30B6\u30FC\u306E\u30A2\u30AB\u30A6\u30F3\u30C8\u64CD\u4F5C"
|
|
728
|
+
}
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
value: "vault",
|
|
732
|
+
label: {
|
|
733
|
+
en: "Vault \u2014 eDiscovery / retention activity",
|
|
734
|
+
ja: "Vault \u2014 eDiscovery\u30FB\u30C7\u30FC\u30BF\u4FDD\u6301\u306E\u64CD\u4F5C"
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
];
|
|
738
|
+
var googleAuditLogSetupFlow = {
|
|
739
|
+
initialState: () => ({}),
|
|
740
|
+
steps: [
|
|
741
|
+
{
|
|
742
|
+
slug: "applications",
|
|
743
|
+
type: "multiSelect",
|
|
744
|
+
question: {
|
|
745
|
+
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",
|
|
746
|
+
en: "Select target Workspace applications to audit (multi-select allowed)"
|
|
747
|
+
},
|
|
748
|
+
async fetchOptions(_state, rt) {
|
|
749
|
+
return [
|
|
750
|
+
{
|
|
751
|
+
value: ALL_APPLICATIONS,
|
|
752
|
+
label: rt.language === "ja" ? "\u3059\u3079\u3066\u306E\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3" : "All applications"
|
|
753
|
+
},
|
|
754
|
+
...APPLICATIONS.map((a) => ({
|
|
755
|
+
value: a.value,
|
|
756
|
+
label: a.label[rt.language]
|
|
757
|
+
}))
|
|
758
|
+
];
|
|
759
|
+
},
|
|
760
|
+
applyAnswer: (state, answer) => ({ ...state, applications: answer })
|
|
761
|
+
}
|
|
762
|
+
],
|
|
763
|
+
async finalize(state, rt) {
|
|
764
|
+
if (!state.applications) {
|
|
765
|
+
throw new Error(
|
|
766
|
+
"Google Audit Log setup: incomplete state on finalize"
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
const targetApplications = await resolveSetupSelection({
|
|
770
|
+
selected: state.applications,
|
|
771
|
+
allSentinel: ALL_APPLICATIONS,
|
|
772
|
+
fetchAll: async () => APPLICATIONS.map((a) => a.value),
|
|
773
|
+
limit: GOOGLE_AUDIT_LOG_SETUP_MAX_APPS
|
|
774
|
+
});
|
|
775
|
+
const labelByValue = new Map(
|
|
776
|
+
APPLICATIONS.map((a) => [a.value, a.label[rt.language]])
|
|
777
|
+
);
|
|
778
|
+
const sections = ["## Google Workspace Audit Log", ""];
|
|
779
|
+
if (targetApplications.length === 0) {
|
|
780
|
+
sections.push("_No applications selected._", "");
|
|
781
|
+
return sections.join("\n");
|
|
782
|
+
}
|
|
783
|
+
sections.push("| Application | Description |");
|
|
784
|
+
sections.push("|-------------|-------------|");
|
|
785
|
+
for (const app of targetApplications) {
|
|
786
|
+
const desc = (labelByValue.get(app) ?? app).replace(/\|/g, "\\|");
|
|
787
|
+
sections.push(`| ${app} | ${desc} |`);
|
|
788
|
+
}
|
|
789
|
+
sections.push("");
|
|
790
|
+
return sections.join("\n");
|
|
791
|
+
}
|
|
792
|
+
};
|
|
793
|
+
|
|
473
794
|
// ../connectors/src/connectors/google-audit-log/index.ts
|
|
474
795
|
var tools = { request_with_delegation: requestWithDelegationTool };
|
|
475
796
|
var googleAuditLogConnector = new ConnectorPlugin({
|
|
@@ -661,7 +982,57 @@ export default async function handler(c: Context) {
|
|
|
661
982
|
}
|
|
662
983
|
\`\`\``
|
|
663
984
|
},
|
|
664
|
-
tools
|
|
985
|
+
tools,
|
|
986
|
+
setup: (params, ctx, config) => runSetupFlow(googleAuditLogSetupFlow, params, ctx, config),
|
|
987
|
+
async checkConnection(params, _config) {
|
|
988
|
+
const keyJsonBase64 = params[parameters.serviceAccountKeyJsonBase64.slug];
|
|
989
|
+
if (!keyJsonBase64) {
|
|
990
|
+
return {
|
|
991
|
+
success: false,
|
|
992
|
+
error: "google-audit-log: missing service account key"
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
let sa;
|
|
996
|
+
try {
|
|
997
|
+
const decoded = Buffer.from(keyJsonBase64, "base64").toString("utf-8");
|
|
998
|
+
sa = JSON.parse(decoded);
|
|
999
|
+
} catch (err) {
|
|
1000
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1001
|
+
return {
|
|
1002
|
+
success: false,
|
|
1003
|
+
error: `google-audit-log: failed to parse service account JSON: ${msg}`
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
if (!sa.client_email || !sa.private_key) {
|
|
1007
|
+
return {
|
|
1008
|
+
success: false,
|
|
1009
|
+
error: "google-audit-log: service account JSON must contain client_email and private_key"
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
try {
|
|
1013
|
+
const { GoogleAuth } = await import("google-auth-library");
|
|
1014
|
+
const auth = new GoogleAuth({
|
|
1015
|
+
credentials: {
|
|
1016
|
+
client_email: sa.client_email,
|
|
1017
|
+
private_key: sa.private_key
|
|
1018
|
+
},
|
|
1019
|
+
scopes: [
|
|
1020
|
+
"https://www.googleapis.com/auth/admin.reports.audit.readonly"
|
|
1021
|
+
]
|
|
1022
|
+
});
|
|
1023
|
+
const token = await auth.getAccessToken();
|
|
1024
|
+
if (!token) {
|
|
1025
|
+
return {
|
|
1026
|
+
success: false,
|
|
1027
|
+
error: "google-audit-log: failed to obtain access token"
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
return { success: true };
|
|
1031
|
+
} catch (err) {
|
|
1032
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1033
|
+
return { success: false, error: msg };
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
665
1036
|
});
|
|
666
1037
|
|
|
667
1038
|
// src/connectors/create-connector-sdk.ts
|
|
@@ -690,6 +1061,7 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
690
1061
|
import { getContext } from "hono/context-storage";
|
|
691
1062
|
import { getCookie } from "hono/cookie";
|
|
692
1063
|
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
1064
|
+
var TABLEAU_SESSION_SENTINEL_URL = "squadbase://tableau-session/";
|
|
693
1065
|
function normalizeHeaders(input) {
|
|
694
1066
|
const out = {};
|
|
695
1067
|
if (!input) return out;
|
|
@@ -698,6 +1070,11 @@ function normalizeHeaders(input) {
|
|
|
698
1070
|
});
|
|
699
1071
|
return out;
|
|
700
1072
|
}
|
|
1073
|
+
function extractInputUrl(input) {
|
|
1074
|
+
if (typeof input === "string") return input;
|
|
1075
|
+
if (input instanceof URL) return input.href;
|
|
1076
|
+
return input.url;
|
|
1077
|
+
}
|
|
701
1078
|
function createSandboxProxyFetch(connectionId) {
|
|
702
1079
|
return async (input, init) => {
|
|
703
1080
|
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
@@ -707,10 +1084,17 @@ function createSandboxProxyFetch(connectionId) {
|
|
|
707
1084
|
"Connection proxy is not configured. Please check your deployment settings."
|
|
708
1085
|
);
|
|
709
1086
|
}
|
|
710
|
-
const originalUrl =
|
|
1087
|
+
const originalUrl = extractInputUrl(input);
|
|
1088
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
1089
|
+
if (originalUrl === TABLEAU_SESSION_SENTINEL_URL) {
|
|
1090
|
+
const sessionUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/tableau-session`;
|
|
1091
|
+
return fetch(sessionUrl, {
|
|
1092
|
+
method: "POST",
|
|
1093
|
+
headers: { Authorization: `Bearer ${token}` }
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
711
1096
|
const originalMethod = init?.method ?? "GET";
|
|
712
1097
|
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
713
|
-
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
714
1098
|
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
715
1099
|
return fetch(proxyUrl, {
|
|
716
1100
|
method: "POST",
|
|
@@ -736,10 +1120,9 @@ function createDeployedAppProxyFetch(connectionId) {
|
|
|
736
1120
|
}
|
|
737
1121
|
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
738
1122
|
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
1123
|
+
const sessionUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/tableau-session`;
|
|
739
1124
|
return async (input, init) => {
|
|
740
|
-
const originalUrl =
|
|
741
|
-
const originalMethod = init?.method ?? "GET";
|
|
742
|
-
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
1125
|
+
const originalUrl = extractInputUrl(input);
|
|
743
1126
|
const c = getContext();
|
|
744
1127
|
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
745
1128
|
if (!appSession) {
|
|
@@ -747,6 +1130,14 @@ function createDeployedAppProxyFetch(connectionId) {
|
|
|
747
1130
|
"No authentication method available for connection proxy."
|
|
748
1131
|
);
|
|
749
1132
|
}
|
|
1133
|
+
if (originalUrl === TABLEAU_SESSION_SENTINEL_URL) {
|
|
1134
|
+
return fetch(sessionUrl, {
|
|
1135
|
+
method: "POST",
|
|
1136
|
+
headers: { Authorization: `Bearer ${appSession}` }
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
const originalMethod = init?.method ?? "GET";
|
|
1140
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
750
1141
|
return fetch(proxyUrl, {
|
|
751
1142
|
method: "POST",
|
|
752
1143
|
headers: {
|