@squadbase/vite-server 0.1.3-dev.1 → 0.1.3-dev.10
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 +71031 -6800
- package/dist/connectors/airtable-oauth.js +77 -3
- package/dist/connectors/airtable.js +85 -2
- package/dist/connectors/amplitude.js +85 -2
- package/dist/connectors/anthropic.js +85 -2
- package/dist/connectors/asana.js +86 -3
- package/dist/connectors/attio.js +85 -2
- package/dist/connectors/customerio.js +86 -3
- package/dist/connectors/dbt.js +85 -2
- package/dist/connectors/gemini.js +86 -3
- package/dist/connectors/gmail-oauth.js +78 -4
- package/dist/connectors/gmail.d.ts +5 -0
- package/dist/connectors/gmail.js +875 -0
- package/dist/connectors/google-ads-oauth.js +78 -4
- package/dist/connectors/google-ads.js +85 -2
- package/dist/connectors/google-analytics-oauth.js +90 -8
- package/dist/connectors/google-analytics.js +85 -2
- package/dist/connectors/google-calendar-oauth.d.ts +5 -0
- package/dist/connectors/google-calendar-oauth.js +817 -0
- package/dist/connectors/google-calendar.d.ts +5 -0
- package/dist/connectors/google-calendar.js +991 -0
- package/dist/connectors/google-sheets-oauth.js +144 -33
- package/dist/connectors/google-sheets.js +119 -10
- package/dist/connectors/{microsoft-teams.d.ts → grafana.d.ts} +1 -1
- package/dist/connectors/grafana.js +638 -0
- package/dist/connectors/hubspot-oauth.js +77 -3
- package/dist/connectors/hubspot.js +79 -5
- package/dist/connectors/intercom-oauth.js +78 -4
- package/dist/connectors/intercom.js +86 -3
- package/dist/connectors/jira-api-key.js +84 -9
- package/dist/connectors/kintone-api-token.js +77 -3
- package/dist/connectors/kintone.js +86 -3
- package/dist/connectors/linkedin-ads-oauth.js +78 -4
- package/dist/connectors/linkedin-ads.js +86 -3
- package/dist/connectors/mailchimp-oauth.js +77 -3
- package/dist/connectors/mailchimp.js +86 -3
- package/dist/connectors/{microsoft-teams-oauth.d.ts → notion-oauth.d.ts} +1 -1
- package/dist/connectors/notion-oauth.js +567 -0
- package/dist/connectors/{slack.d.ts → notion.d.ts} +1 -1
- package/dist/connectors/notion.js +663 -0
- package/dist/connectors/openai.js +85 -2
- package/dist/connectors/shopify-oauth.js +77 -3
- package/dist/connectors/shopify.js +85 -2
- package/dist/connectors/stripe-api-key.d.ts +5 -0
- package/dist/connectors/stripe-api-key.js +600 -0
- package/dist/connectors/stripe-oauth.js +77 -3
- package/dist/connectors/wix-store.js +85 -2
- package/dist/connectors/zendesk-oauth.js +78 -4
- package/dist/connectors/zendesk.js +86 -3
- package/dist/index.js +75373 -8431
- package/dist/main.js +75359 -8417
- package/dist/vite-plugin.js +75210 -8305
- package/package.json +46 -2
- package/dist/connectors/microsoft-teams-oauth.js +0 -479
- package/dist/connectors/microsoft-teams.js +0 -381
- package/dist/connectors/slack.js +0 -362
|
@@ -173,7 +173,8 @@ var AUTH_TYPES = {
|
|
|
173
173
|
API_KEY: "api-key",
|
|
174
174
|
JWT: "jwt",
|
|
175
175
|
SERVICE_ACCOUNT: "service-account",
|
|
176
|
-
PAT: "pat"
|
|
176
|
+
PAT: "pat",
|
|
177
|
+
USER_PASSWORD: "user-password"
|
|
177
178
|
};
|
|
178
179
|
|
|
179
180
|
// ../connectors/src/connectors/airtable-oauth/tools/request.ts
|
|
@@ -350,7 +351,7 @@ var tools = { request: requestTool };
|
|
|
350
351
|
var airtableOauthConnector = new ConnectorPlugin({
|
|
351
352
|
slug: "airtable",
|
|
352
353
|
authType: AUTH_TYPES.OAUTH,
|
|
353
|
-
name: "Airtable
|
|
354
|
+
name: "Airtable",
|
|
354
355
|
description: "Connect to Airtable for spreadsheet-database hybrid data management using OAuth.",
|
|
355
356
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/19JUphfOZjyjTK6Zg4NGCf/8c56227b088cada52d3a2d9385a3be97/airtable.svg",
|
|
356
357
|
parameters,
|
|
@@ -513,6 +514,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
513
514
|
return process.env[envVarName] || void 0;
|
|
514
515
|
}
|
|
515
516
|
|
|
517
|
+
// src/connector-client/proxy-fetch.ts
|
|
518
|
+
import { getContext } from "hono/context-storage";
|
|
519
|
+
import { getCookie } from "hono/cookie";
|
|
520
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
521
|
+
function createSandboxProxyFetch(connectionId) {
|
|
522
|
+
return async (input, init) => {
|
|
523
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
524
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
525
|
+
if (!token || !sandboxId) {
|
|
526
|
+
throw new Error(
|
|
527
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
531
|
+
const originalMethod = init?.method ?? "GET";
|
|
532
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
533
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
534
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
535
|
+
return fetch(proxyUrl, {
|
|
536
|
+
method: "POST",
|
|
537
|
+
headers: {
|
|
538
|
+
"Content-Type": "application/json",
|
|
539
|
+
Authorization: `Bearer ${token}`
|
|
540
|
+
},
|
|
541
|
+
body: JSON.stringify({
|
|
542
|
+
url: originalUrl,
|
|
543
|
+
method: originalMethod,
|
|
544
|
+
body: originalBody
|
|
545
|
+
})
|
|
546
|
+
});
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
550
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
551
|
+
if (!projectId) {
|
|
552
|
+
throw new Error(
|
|
553
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
557
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
558
|
+
return async (input, init) => {
|
|
559
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
560
|
+
const originalMethod = init?.method ?? "GET";
|
|
561
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
562
|
+
const c = getContext();
|
|
563
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
564
|
+
if (!appSession) {
|
|
565
|
+
throw new Error(
|
|
566
|
+
"No authentication method available for connection proxy."
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
return fetch(proxyUrl, {
|
|
570
|
+
method: "POST",
|
|
571
|
+
headers: {
|
|
572
|
+
"Content-Type": "application/json",
|
|
573
|
+
Authorization: `Bearer ${appSession}`
|
|
574
|
+
},
|
|
575
|
+
body: JSON.stringify({
|
|
576
|
+
url: originalUrl,
|
|
577
|
+
method: originalMethod,
|
|
578
|
+
body: originalBody
|
|
579
|
+
})
|
|
580
|
+
});
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
function createProxyFetch(connectionId) {
|
|
584
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
585
|
+
return createSandboxProxyFetch(connectionId);
|
|
586
|
+
}
|
|
587
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
588
|
+
}
|
|
589
|
+
|
|
516
590
|
// src/connectors/create-connector-sdk.ts
|
|
517
591
|
function loadConnectionsSync() {
|
|
518
592
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -546,7 +620,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
546
620
|
if (val !== void 0) params[param.slug] = val;
|
|
547
621
|
}
|
|
548
622
|
}
|
|
549
|
-
return createClient2(params);
|
|
623
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
550
624
|
};
|
|
551
625
|
}
|
|
552
626
|
|
|
@@ -297,6 +297,16 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
297
297
|
}
|
|
298
298
|
};
|
|
299
299
|
|
|
300
|
+
// ../connectors/src/auth-types.ts
|
|
301
|
+
var AUTH_TYPES = {
|
|
302
|
+
OAUTH: "oauth",
|
|
303
|
+
API_KEY: "api-key",
|
|
304
|
+
JWT: "jwt",
|
|
305
|
+
SERVICE_ACCOUNT: "service-account",
|
|
306
|
+
PAT: "pat",
|
|
307
|
+
USER_PASSWORD: "user-password"
|
|
308
|
+
};
|
|
309
|
+
|
|
300
310
|
// ../connectors/src/connectors/airtable/setup.ts
|
|
301
311
|
var airtableOnboarding = new ConnectorOnboarding({
|
|
302
312
|
dataOverviewInstructions: {
|
|
@@ -382,7 +392,7 @@ Authentication is handled automatically using the API Key.
|
|
|
382
392
|
var tools = { request: requestTool };
|
|
383
393
|
var airtableConnector = new ConnectorPlugin({
|
|
384
394
|
slug: "airtable",
|
|
385
|
-
authType:
|
|
395
|
+
authType: AUTH_TYPES.API_KEY,
|
|
386
396
|
name: "Airtable",
|
|
387
397
|
description: "Connect to Airtable for spreadsheet-database hybrid data management.",
|
|
388
398
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/19JUphfOZjyjTK6Zg4NGCf/8c56227b088cada52d3a2d9385a3be97/airtable.svg",
|
|
@@ -534,6 +544,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
534
544
|
return process.env[envVarName] || void 0;
|
|
535
545
|
}
|
|
536
546
|
|
|
547
|
+
// src/connector-client/proxy-fetch.ts
|
|
548
|
+
import { getContext } from "hono/context-storage";
|
|
549
|
+
import { getCookie } from "hono/cookie";
|
|
550
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
551
|
+
function createSandboxProxyFetch(connectionId) {
|
|
552
|
+
return async (input, init) => {
|
|
553
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
554
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
555
|
+
if (!token || !sandboxId) {
|
|
556
|
+
throw new Error(
|
|
557
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
561
|
+
const originalMethod = init?.method ?? "GET";
|
|
562
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
563
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
564
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
565
|
+
return fetch(proxyUrl, {
|
|
566
|
+
method: "POST",
|
|
567
|
+
headers: {
|
|
568
|
+
"Content-Type": "application/json",
|
|
569
|
+
Authorization: `Bearer ${token}`
|
|
570
|
+
},
|
|
571
|
+
body: JSON.stringify({
|
|
572
|
+
url: originalUrl,
|
|
573
|
+
method: originalMethod,
|
|
574
|
+
body: originalBody
|
|
575
|
+
})
|
|
576
|
+
});
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
580
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
581
|
+
if (!projectId) {
|
|
582
|
+
throw new Error(
|
|
583
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
587
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
588
|
+
return async (input, init) => {
|
|
589
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
590
|
+
const originalMethod = init?.method ?? "GET";
|
|
591
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
592
|
+
const c = getContext();
|
|
593
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
594
|
+
if (!appSession) {
|
|
595
|
+
throw new Error(
|
|
596
|
+
"No authentication method available for connection proxy."
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
return fetch(proxyUrl, {
|
|
600
|
+
method: "POST",
|
|
601
|
+
headers: {
|
|
602
|
+
"Content-Type": "application/json",
|
|
603
|
+
Authorization: `Bearer ${appSession}`
|
|
604
|
+
},
|
|
605
|
+
body: JSON.stringify({
|
|
606
|
+
url: originalUrl,
|
|
607
|
+
method: originalMethod,
|
|
608
|
+
body: originalBody
|
|
609
|
+
})
|
|
610
|
+
});
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
function createProxyFetch(connectionId) {
|
|
614
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
615
|
+
return createSandboxProxyFetch(connectionId);
|
|
616
|
+
}
|
|
617
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
618
|
+
}
|
|
619
|
+
|
|
537
620
|
// src/connectors/create-connector-sdk.ts
|
|
538
621
|
function loadConnectionsSync() {
|
|
539
622
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -567,7 +650,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
567
650
|
if (val !== void 0) params[param.slug] = val;
|
|
568
651
|
}
|
|
569
652
|
}
|
|
570
|
-
return createClient2(params);
|
|
653
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
571
654
|
};
|
|
572
655
|
}
|
|
573
656
|
|
|
@@ -257,6 +257,16 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
257
257
|
}
|
|
258
258
|
};
|
|
259
259
|
|
|
260
|
+
// ../connectors/src/auth-types.ts
|
|
261
|
+
var AUTH_TYPES = {
|
|
262
|
+
OAUTH: "oauth",
|
|
263
|
+
API_KEY: "api-key",
|
|
264
|
+
JWT: "jwt",
|
|
265
|
+
SERVICE_ACCOUNT: "service-account",
|
|
266
|
+
PAT: "pat",
|
|
267
|
+
USER_PASSWORD: "user-password"
|
|
268
|
+
};
|
|
269
|
+
|
|
260
270
|
// ../connectors/src/connectors/amplitude/setup.ts
|
|
261
271
|
var amplitudeOnboarding = new ConnectorOnboarding({
|
|
262
272
|
dataOverviewInstructions: {
|
|
@@ -363,7 +373,7 @@ IMPORTANT: Dashboard REST API endpoints (events/segmentation, funnels, retention
|
|
|
363
373
|
var tools = { request: requestTool };
|
|
364
374
|
var amplitudeConnector = new ConnectorPlugin({
|
|
365
375
|
slug: "amplitude",
|
|
366
|
-
authType:
|
|
376
|
+
authType: AUTH_TYPES.API_KEY,
|
|
367
377
|
name: "Amplitude",
|
|
368
378
|
description: "Connect to Amplitude for product analytics and user behavior data.",
|
|
369
379
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2UBJSdRlFJaLq52WUCTBEB/308b59b374cf6c662ac70989860bffd7/amplitude-icon.svg",
|
|
@@ -525,6 +535,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
525
535
|
return process.env[envVarName] || void 0;
|
|
526
536
|
}
|
|
527
537
|
|
|
538
|
+
// src/connector-client/proxy-fetch.ts
|
|
539
|
+
import { getContext } from "hono/context-storage";
|
|
540
|
+
import { getCookie } from "hono/cookie";
|
|
541
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
542
|
+
function createSandboxProxyFetch(connectionId) {
|
|
543
|
+
return async (input, init) => {
|
|
544
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
545
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
546
|
+
if (!token || !sandboxId) {
|
|
547
|
+
throw new Error(
|
|
548
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
552
|
+
const originalMethod = init?.method ?? "GET";
|
|
553
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
554
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
555
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
556
|
+
return fetch(proxyUrl, {
|
|
557
|
+
method: "POST",
|
|
558
|
+
headers: {
|
|
559
|
+
"Content-Type": "application/json",
|
|
560
|
+
Authorization: `Bearer ${token}`
|
|
561
|
+
},
|
|
562
|
+
body: JSON.stringify({
|
|
563
|
+
url: originalUrl,
|
|
564
|
+
method: originalMethod,
|
|
565
|
+
body: originalBody
|
|
566
|
+
})
|
|
567
|
+
});
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
571
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
572
|
+
if (!projectId) {
|
|
573
|
+
throw new Error(
|
|
574
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
578
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
579
|
+
return async (input, init) => {
|
|
580
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
581
|
+
const originalMethod = init?.method ?? "GET";
|
|
582
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
583
|
+
const c = getContext();
|
|
584
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
585
|
+
if (!appSession) {
|
|
586
|
+
throw new Error(
|
|
587
|
+
"No authentication method available for connection proxy."
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
return fetch(proxyUrl, {
|
|
591
|
+
method: "POST",
|
|
592
|
+
headers: {
|
|
593
|
+
"Content-Type": "application/json",
|
|
594
|
+
Authorization: `Bearer ${appSession}`
|
|
595
|
+
},
|
|
596
|
+
body: JSON.stringify({
|
|
597
|
+
url: originalUrl,
|
|
598
|
+
method: originalMethod,
|
|
599
|
+
body: originalBody
|
|
600
|
+
})
|
|
601
|
+
});
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
function createProxyFetch(connectionId) {
|
|
605
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
606
|
+
return createSandboxProxyFetch(connectionId);
|
|
607
|
+
}
|
|
608
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
609
|
+
}
|
|
610
|
+
|
|
528
611
|
// src/connectors/create-connector-sdk.ts
|
|
529
612
|
function loadConnectionsSync() {
|
|
530
613
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -558,7 +641,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
558
641
|
if (val !== void 0) params[param.slug] = val;
|
|
559
642
|
}
|
|
560
643
|
}
|
|
561
|
-
return createClient2(params);
|
|
644
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
562
645
|
};
|
|
563
646
|
}
|
|
564
647
|
|
|
@@ -124,11 +124,21 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
+
// ../connectors/src/auth-types.ts
|
|
128
|
+
var AUTH_TYPES = {
|
|
129
|
+
OAUTH: "oauth",
|
|
130
|
+
API_KEY: "api-key",
|
|
131
|
+
JWT: "jwt",
|
|
132
|
+
SERVICE_ACCOUNT: "service-account",
|
|
133
|
+
PAT: "pat",
|
|
134
|
+
USER_PASSWORD: "user-password"
|
|
135
|
+
};
|
|
136
|
+
|
|
127
137
|
// ../connectors/src/connectors/anthropic/index.ts
|
|
128
138
|
var tools = {};
|
|
129
139
|
var anthropicConnector = new ConnectorPlugin({
|
|
130
140
|
slug: "anthropic",
|
|
131
|
-
authType:
|
|
141
|
+
authType: AUTH_TYPES.API_KEY,
|
|
132
142
|
name: "Anthropic",
|
|
133
143
|
description: "Connect to Anthropic for AI model inference and text generation with Claude.",
|
|
134
144
|
iconUrl: "https://www.anthropic.com/images/icons/safari-pinned-tab.svg",
|
|
@@ -209,6 +219,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
209
219
|
return process.env[envVarName] || void 0;
|
|
210
220
|
}
|
|
211
221
|
|
|
222
|
+
// src/connector-client/proxy-fetch.ts
|
|
223
|
+
import { getContext } from "hono/context-storage";
|
|
224
|
+
import { getCookie } from "hono/cookie";
|
|
225
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
226
|
+
function createSandboxProxyFetch(connectionId) {
|
|
227
|
+
return async (input, init) => {
|
|
228
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
229
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
230
|
+
if (!token || !sandboxId) {
|
|
231
|
+
throw new Error(
|
|
232
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
236
|
+
const originalMethod = init?.method ?? "GET";
|
|
237
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
238
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
239
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
240
|
+
return fetch(proxyUrl, {
|
|
241
|
+
method: "POST",
|
|
242
|
+
headers: {
|
|
243
|
+
"Content-Type": "application/json",
|
|
244
|
+
Authorization: `Bearer ${token}`
|
|
245
|
+
},
|
|
246
|
+
body: JSON.stringify({
|
|
247
|
+
url: originalUrl,
|
|
248
|
+
method: originalMethod,
|
|
249
|
+
body: originalBody
|
|
250
|
+
})
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
255
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
256
|
+
if (!projectId) {
|
|
257
|
+
throw new Error(
|
|
258
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
262
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
263
|
+
return async (input, init) => {
|
|
264
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
265
|
+
const originalMethod = init?.method ?? "GET";
|
|
266
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
267
|
+
const c = getContext();
|
|
268
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
269
|
+
if (!appSession) {
|
|
270
|
+
throw new Error(
|
|
271
|
+
"No authentication method available for connection proxy."
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
return fetch(proxyUrl, {
|
|
275
|
+
method: "POST",
|
|
276
|
+
headers: {
|
|
277
|
+
"Content-Type": "application/json",
|
|
278
|
+
Authorization: `Bearer ${appSession}`
|
|
279
|
+
},
|
|
280
|
+
body: JSON.stringify({
|
|
281
|
+
url: originalUrl,
|
|
282
|
+
method: originalMethod,
|
|
283
|
+
body: originalBody
|
|
284
|
+
})
|
|
285
|
+
});
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
function createProxyFetch(connectionId) {
|
|
289
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
290
|
+
return createSandboxProxyFetch(connectionId);
|
|
291
|
+
}
|
|
292
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
293
|
+
}
|
|
294
|
+
|
|
212
295
|
// src/connectors/create-connector-sdk.ts
|
|
213
296
|
function loadConnectionsSync() {
|
|
214
297
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -242,7 +325,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
242
325
|
if (val !== void 0) params[param.slug] = val;
|
|
243
326
|
}
|
|
244
327
|
}
|
|
245
|
-
return createClient2(params);
|
|
328
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
246
329
|
};
|
|
247
330
|
}
|
|
248
331
|
|
package/dist/connectors/asana.js
CHANGED
|
@@ -294,6 +294,16 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
296
|
|
|
297
|
+
// ../connectors/src/auth-types.ts
|
|
298
|
+
var AUTH_TYPES = {
|
|
299
|
+
OAUTH: "oauth",
|
|
300
|
+
API_KEY: "api-key",
|
|
301
|
+
JWT: "jwt",
|
|
302
|
+
SERVICE_ACCOUNT: "service-account",
|
|
303
|
+
PAT: "pat",
|
|
304
|
+
USER_PASSWORD: "user-password"
|
|
305
|
+
};
|
|
306
|
+
|
|
297
307
|
// ../connectors/src/connectors/asana/setup.ts
|
|
298
308
|
var asanaOnboarding = new ConnectorOnboarding({
|
|
299
309
|
dataOverviewInstructions: {
|
|
@@ -409,10 +419,10 @@ Pagination: Use limit (1-100) and offset query parameters. The response includes
|
|
|
409
419
|
var tools = { request: requestTool };
|
|
410
420
|
var asanaConnector = new ConnectorPlugin({
|
|
411
421
|
slug: "asana",
|
|
412
|
-
authType:
|
|
422
|
+
authType: AUTH_TYPES.API_KEY,
|
|
413
423
|
name: "Asana",
|
|
414
424
|
description: "Connect to Asana for project management, task tracking, and team collaboration data.",
|
|
415
|
-
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/
|
|
425
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/3eIdaoqzIIZs2Md0OoDJMf/2fa66e0841adb985da4d3120466f3ec4/asana-icon.png",
|
|
416
426
|
parameters,
|
|
417
427
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
418
428
|
onboarding: asanaOnboarding,
|
|
@@ -617,6 +627,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
617
627
|
return process.env[envVarName] || void 0;
|
|
618
628
|
}
|
|
619
629
|
|
|
630
|
+
// src/connector-client/proxy-fetch.ts
|
|
631
|
+
import { getContext } from "hono/context-storage";
|
|
632
|
+
import { getCookie } from "hono/cookie";
|
|
633
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
634
|
+
function createSandboxProxyFetch(connectionId) {
|
|
635
|
+
return async (input, init) => {
|
|
636
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
637
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
638
|
+
if (!token || !sandboxId) {
|
|
639
|
+
throw new Error(
|
|
640
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
641
|
+
);
|
|
642
|
+
}
|
|
643
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
644
|
+
const originalMethod = init?.method ?? "GET";
|
|
645
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
646
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
647
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
648
|
+
return fetch(proxyUrl, {
|
|
649
|
+
method: "POST",
|
|
650
|
+
headers: {
|
|
651
|
+
"Content-Type": "application/json",
|
|
652
|
+
Authorization: `Bearer ${token}`
|
|
653
|
+
},
|
|
654
|
+
body: JSON.stringify({
|
|
655
|
+
url: originalUrl,
|
|
656
|
+
method: originalMethod,
|
|
657
|
+
body: originalBody
|
|
658
|
+
})
|
|
659
|
+
});
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
663
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
664
|
+
if (!projectId) {
|
|
665
|
+
throw new Error(
|
|
666
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
667
|
+
);
|
|
668
|
+
}
|
|
669
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
670
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
671
|
+
return async (input, init) => {
|
|
672
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
673
|
+
const originalMethod = init?.method ?? "GET";
|
|
674
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
675
|
+
const c = getContext();
|
|
676
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
677
|
+
if (!appSession) {
|
|
678
|
+
throw new Error(
|
|
679
|
+
"No authentication method available for connection proxy."
|
|
680
|
+
);
|
|
681
|
+
}
|
|
682
|
+
return fetch(proxyUrl, {
|
|
683
|
+
method: "POST",
|
|
684
|
+
headers: {
|
|
685
|
+
"Content-Type": "application/json",
|
|
686
|
+
Authorization: `Bearer ${appSession}`
|
|
687
|
+
},
|
|
688
|
+
body: JSON.stringify({
|
|
689
|
+
url: originalUrl,
|
|
690
|
+
method: originalMethod,
|
|
691
|
+
body: originalBody
|
|
692
|
+
})
|
|
693
|
+
});
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
function createProxyFetch(connectionId) {
|
|
697
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
698
|
+
return createSandboxProxyFetch(connectionId);
|
|
699
|
+
}
|
|
700
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
701
|
+
}
|
|
702
|
+
|
|
620
703
|
// src/connectors/create-connector-sdk.ts
|
|
621
704
|
function loadConnectionsSync() {
|
|
622
705
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -650,7 +733,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
650
733
|
if (val !== void 0) params[param.slug] = val;
|
|
651
734
|
}
|
|
652
735
|
}
|
|
653
|
-
return createClient2(params);
|
|
736
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
654
737
|
};
|
|
655
738
|
}
|
|
656
739
|
|
package/dist/connectors/attio.js
CHANGED
|
@@ -247,6 +247,16 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
249
|
|
|
250
|
+
// ../connectors/src/auth-types.ts
|
|
251
|
+
var AUTH_TYPES = {
|
|
252
|
+
OAUTH: "oauth",
|
|
253
|
+
API_KEY: "api-key",
|
|
254
|
+
JWT: "jwt",
|
|
255
|
+
SERVICE_ACCOUNT: "service-account",
|
|
256
|
+
PAT: "pat",
|
|
257
|
+
USER_PASSWORD: "user-password"
|
|
258
|
+
};
|
|
259
|
+
|
|
250
260
|
// ../connectors/src/connectors/attio/setup.ts
|
|
251
261
|
var attioOnboarding = new ConnectorOnboarding({
|
|
252
262
|
dataOverviewInstructions: {
|
|
@@ -343,7 +353,7 @@ Note that querying records uses POST (not GET) with a request body for filters.`
|
|
|
343
353
|
var tools = { request: requestTool };
|
|
344
354
|
var attioConnector = new ConnectorPlugin({
|
|
345
355
|
slug: "attio",
|
|
346
|
-
authType:
|
|
356
|
+
authType: AUTH_TYPES.API_KEY,
|
|
347
357
|
name: "Attio",
|
|
348
358
|
description: "Connect to Attio for CRM data and relationship intelligence.",
|
|
349
359
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2qqx99vvXJojUM3tSrSWPX/1e7c35e13da6b365b8b475c1effe568f/attio.svg",
|
|
@@ -491,6 +501,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
491
501
|
return process.env[envVarName] || void 0;
|
|
492
502
|
}
|
|
493
503
|
|
|
504
|
+
// src/connector-client/proxy-fetch.ts
|
|
505
|
+
import { getContext } from "hono/context-storage";
|
|
506
|
+
import { getCookie } from "hono/cookie";
|
|
507
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
508
|
+
function createSandboxProxyFetch(connectionId) {
|
|
509
|
+
return async (input, init) => {
|
|
510
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
511
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
512
|
+
if (!token || !sandboxId) {
|
|
513
|
+
throw new Error(
|
|
514
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
518
|
+
const originalMethod = init?.method ?? "GET";
|
|
519
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
520
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
521
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
522
|
+
return fetch(proxyUrl, {
|
|
523
|
+
method: "POST",
|
|
524
|
+
headers: {
|
|
525
|
+
"Content-Type": "application/json",
|
|
526
|
+
Authorization: `Bearer ${token}`
|
|
527
|
+
},
|
|
528
|
+
body: JSON.stringify({
|
|
529
|
+
url: originalUrl,
|
|
530
|
+
method: originalMethod,
|
|
531
|
+
body: originalBody
|
|
532
|
+
})
|
|
533
|
+
});
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
537
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
538
|
+
if (!projectId) {
|
|
539
|
+
throw new Error(
|
|
540
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
544
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
545
|
+
return async (input, init) => {
|
|
546
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
547
|
+
const originalMethod = init?.method ?? "GET";
|
|
548
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
549
|
+
const c = getContext();
|
|
550
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
551
|
+
if (!appSession) {
|
|
552
|
+
throw new Error(
|
|
553
|
+
"No authentication method available for connection proxy."
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
return fetch(proxyUrl, {
|
|
557
|
+
method: "POST",
|
|
558
|
+
headers: {
|
|
559
|
+
"Content-Type": "application/json",
|
|
560
|
+
Authorization: `Bearer ${appSession}`
|
|
561
|
+
},
|
|
562
|
+
body: JSON.stringify({
|
|
563
|
+
url: originalUrl,
|
|
564
|
+
method: originalMethod,
|
|
565
|
+
body: originalBody
|
|
566
|
+
})
|
|
567
|
+
});
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
function createProxyFetch(connectionId) {
|
|
571
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
572
|
+
return createSandboxProxyFetch(connectionId);
|
|
573
|
+
}
|
|
574
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
575
|
+
}
|
|
576
|
+
|
|
494
577
|
// src/connectors/create-connector-sdk.ts
|
|
495
578
|
function loadConnectionsSync() {
|
|
496
579
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -524,7 +607,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
524
607
|
if (val !== void 0) params[param.slug] = val;
|
|
525
608
|
}
|
|
526
609
|
}
|
|
527
|
-
return createClient2(params);
|
|
610
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
528
611
|
};
|
|
529
612
|
}
|
|
530
613
|
|