@squadbase/vite-server 0.1.3-dev.1 → 0.1.3-dev.11
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 +71446 -6941
- 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/{microsoft-teams.d.ts → backlog-api-key.d.ts} +1 -1
- package/dist/connectors/backlog-api-key.js +592 -0
- 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-oauth.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/notion-oauth.d.ts +5 -0
- 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 +75463 -8247
- package/dist/main.js +75191 -7975
- package/dist/vite-plugin.js +75300 -8121
- package/package.json +50 -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
|
@@ -191,7 +191,8 @@ var AUTH_TYPES = {
|
|
|
191
191
|
API_KEY: "api-key",
|
|
192
192
|
JWT: "jwt",
|
|
193
193
|
SERVICE_ACCOUNT: "service-account",
|
|
194
|
-
PAT: "pat"
|
|
194
|
+
PAT: "pat",
|
|
195
|
+
USER_PASSWORD: "user-password"
|
|
195
196
|
};
|
|
196
197
|
|
|
197
198
|
// ../connectors/src/connectors/kintone-api-token/setup.ts
|
|
@@ -281,7 +282,7 @@ var tools = { request: requestTool };
|
|
|
281
282
|
var kintoneApiTokenConnector = new ConnectorPlugin({
|
|
282
283
|
slug: "kintone",
|
|
283
284
|
authType: AUTH_TYPES.API_KEY,
|
|
284
|
-
name: "kintone
|
|
285
|
+
name: "kintone",
|
|
285
286
|
description: "Connect to kintone for business application data retrieval and analytics using API token authentication.",
|
|
286
287
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/76nPGMJFZkMFE3UQNo2JFy/e71dc5f5d5cec1306ce0e17aafbfd9f0/kintone.png",
|
|
287
288
|
parameters,
|
|
@@ -408,6 +409,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
408
409
|
return process.env[envVarName] || void 0;
|
|
409
410
|
}
|
|
410
411
|
|
|
412
|
+
// src/connector-client/proxy-fetch.ts
|
|
413
|
+
import { getContext } from "hono/context-storage";
|
|
414
|
+
import { getCookie } from "hono/cookie";
|
|
415
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
416
|
+
function createSandboxProxyFetch(connectionId) {
|
|
417
|
+
return async (input, init) => {
|
|
418
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
419
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
420
|
+
if (!token || !sandboxId) {
|
|
421
|
+
throw new Error(
|
|
422
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
426
|
+
const originalMethod = init?.method ?? "GET";
|
|
427
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
428
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
429
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
430
|
+
return fetch(proxyUrl, {
|
|
431
|
+
method: "POST",
|
|
432
|
+
headers: {
|
|
433
|
+
"Content-Type": "application/json",
|
|
434
|
+
Authorization: `Bearer ${token}`
|
|
435
|
+
},
|
|
436
|
+
body: JSON.stringify({
|
|
437
|
+
url: originalUrl,
|
|
438
|
+
method: originalMethod,
|
|
439
|
+
body: originalBody
|
|
440
|
+
})
|
|
441
|
+
});
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
445
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
446
|
+
if (!projectId) {
|
|
447
|
+
throw new Error(
|
|
448
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
452
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
453
|
+
return async (input, init) => {
|
|
454
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
455
|
+
const originalMethod = init?.method ?? "GET";
|
|
456
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
457
|
+
const c = getContext();
|
|
458
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
459
|
+
if (!appSession) {
|
|
460
|
+
throw new Error(
|
|
461
|
+
"No authentication method available for connection proxy."
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
return fetch(proxyUrl, {
|
|
465
|
+
method: "POST",
|
|
466
|
+
headers: {
|
|
467
|
+
"Content-Type": "application/json",
|
|
468
|
+
Authorization: `Bearer ${appSession}`
|
|
469
|
+
},
|
|
470
|
+
body: JSON.stringify({
|
|
471
|
+
url: originalUrl,
|
|
472
|
+
method: originalMethod,
|
|
473
|
+
body: originalBody
|
|
474
|
+
})
|
|
475
|
+
});
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
function createProxyFetch(connectionId) {
|
|
479
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
480
|
+
return createSandboxProxyFetch(connectionId);
|
|
481
|
+
}
|
|
482
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
483
|
+
}
|
|
484
|
+
|
|
411
485
|
// src/connectors/create-connector-sdk.ts
|
|
412
486
|
function loadConnectionsSync() {
|
|
413
487
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -441,7 +515,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
441
515
|
if (val !== void 0) params[param.slug] = val;
|
|
442
516
|
}
|
|
443
517
|
}
|
|
444
|
-
return createClient2(params);
|
|
518
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
445
519
|
};
|
|
446
520
|
}
|
|
447
521
|
|
|
@@ -242,6 +242,16 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
244
|
|
|
245
|
+
// ../connectors/src/auth-types.ts
|
|
246
|
+
var AUTH_TYPES = {
|
|
247
|
+
OAUTH: "oauth",
|
|
248
|
+
API_KEY: "api-key",
|
|
249
|
+
JWT: "jwt",
|
|
250
|
+
SERVICE_ACCOUNT: "service-account",
|
|
251
|
+
PAT: "pat",
|
|
252
|
+
USER_PASSWORD: "user-password"
|
|
253
|
+
};
|
|
254
|
+
|
|
245
255
|
// ../connectors/src/connectors/kintone/setup.ts
|
|
246
256
|
var kintoneOnboarding = new ConnectorOnboarding({
|
|
247
257
|
dataOverviewInstructions: {
|
|
@@ -330,8 +340,8 @@ Authentication is handled automatically using username and password.`,
|
|
|
330
340
|
var tools = { request: requestTool };
|
|
331
341
|
var kintoneConnector = new ConnectorPlugin({
|
|
332
342
|
slug: "kintone",
|
|
333
|
-
authType:
|
|
334
|
-
name: "kintone
|
|
343
|
+
authType: AUTH_TYPES.USER_PASSWORD,
|
|
344
|
+
name: "kintone",
|
|
335
345
|
description: "Connect to kintone for business application data retrieval and analytics.",
|
|
336
346
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/76nPGMJFZkMFE3UQNo2JFy/e71dc5f5d5cec1306ce0e17aafbfd9f0/kintone.png",
|
|
337
347
|
parameters,
|
|
@@ -498,6 +508,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
498
508
|
return process.env[envVarName] || void 0;
|
|
499
509
|
}
|
|
500
510
|
|
|
511
|
+
// src/connector-client/proxy-fetch.ts
|
|
512
|
+
import { getContext } from "hono/context-storage";
|
|
513
|
+
import { getCookie } from "hono/cookie";
|
|
514
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
515
|
+
function createSandboxProxyFetch(connectionId) {
|
|
516
|
+
return async (input, init) => {
|
|
517
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
518
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
519
|
+
if (!token || !sandboxId) {
|
|
520
|
+
throw new Error(
|
|
521
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
522
|
+
);
|
|
523
|
+
}
|
|
524
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
525
|
+
const originalMethod = init?.method ?? "GET";
|
|
526
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
527
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
528
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
529
|
+
return fetch(proxyUrl, {
|
|
530
|
+
method: "POST",
|
|
531
|
+
headers: {
|
|
532
|
+
"Content-Type": "application/json",
|
|
533
|
+
Authorization: `Bearer ${token}`
|
|
534
|
+
},
|
|
535
|
+
body: JSON.stringify({
|
|
536
|
+
url: originalUrl,
|
|
537
|
+
method: originalMethod,
|
|
538
|
+
body: originalBody
|
|
539
|
+
})
|
|
540
|
+
});
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
544
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
545
|
+
if (!projectId) {
|
|
546
|
+
throw new Error(
|
|
547
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
548
|
+
);
|
|
549
|
+
}
|
|
550
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
551
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
552
|
+
return async (input, init) => {
|
|
553
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
554
|
+
const originalMethod = init?.method ?? "GET";
|
|
555
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
556
|
+
const c = getContext();
|
|
557
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
558
|
+
if (!appSession) {
|
|
559
|
+
throw new Error(
|
|
560
|
+
"No authentication method available for connection proxy."
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
return fetch(proxyUrl, {
|
|
564
|
+
method: "POST",
|
|
565
|
+
headers: {
|
|
566
|
+
"Content-Type": "application/json",
|
|
567
|
+
Authorization: `Bearer ${appSession}`
|
|
568
|
+
},
|
|
569
|
+
body: JSON.stringify({
|
|
570
|
+
url: originalUrl,
|
|
571
|
+
method: originalMethod,
|
|
572
|
+
body: originalBody
|
|
573
|
+
})
|
|
574
|
+
});
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
function createProxyFetch(connectionId) {
|
|
578
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
579
|
+
return createSandboxProxyFetch(connectionId);
|
|
580
|
+
}
|
|
581
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
582
|
+
}
|
|
583
|
+
|
|
501
584
|
// src/connectors/create-connector-sdk.ts
|
|
502
585
|
function loadConnectionsSync() {
|
|
503
586
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -531,7 +614,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
531
614
|
if (val !== void 0) params[param.slug] = val;
|
|
532
615
|
}
|
|
533
616
|
}
|
|
534
|
-
return createClient2(params);
|
|
617
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
535
618
|
};
|
|
536
619
|
}
|
|
537
620
|
|
|
@@ -158,7 +158,8 @@ var AUTH_TYPES = {
|
|
|
158
158
|
API_KEY: "api-key",
|
|
159
159
|
JWT: "jwt",
|
|
160
160
|
SERVICE_ACCOUNT: "service-account",
|
|
161
|
-
PAT: "pat"
|
|
161
|
+
PAT: "pat",
|
|
162
|
+
USER_PASSWORD: "user-password"
|
|
162
163
|
};
|
|
163
164
|
|
|
164
165
|
// ../connectors/src/connectors/linkedin-ads-oauth/tools/list-ad-accounts.ts
|
|
@@ -477,9 +478,9 @@ var tools = {
|
|
|
477
478
|
var linkedinAdsOauthConnector = new ConnectorPlugin({
|
|
478
479
|
slug: "linkedin-ads",
|
|
479
480
|
authType: AUTH_TYPES.OAUTH,
|
|
480
|
-
name: "LinkedIn Ads
|
|
481
|
+
name: "LinkedIn Ads",
|
|
481
482
|
description: "Connect to LinkedIn Ads (Marketing API) for advertising campaign data and reporting using OAuth.",
|
|
482
|
-
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/
|
|
483
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/3x7xd9pVJkRFY7ADIg4ycq/b94720e34cb081e9ae45dfde799a59cd/LinkedIn_icon.svg.png",
|
|
483
484
|
parameters,
|
|
484
485
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
485
486
|
onboarding: linkedinAdsOauthOnboarding,
|
|
@@ -730,6 +731,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
730
731
|
return process.env[envVarName] || void 0;
|
|
731
732
|
}
|
|
732
733
|
|
|
734
|
+
// src/connector-client/proxy-fetch.ts
|
|
735
|
+
import { getContext } from "hono/context-storage";
|
|
736
|
+
import { getCookie } from "hono/cookie";
|
|
737
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
738
|
+
function createSandboxProxyFetch(connectionId) {
|
|
739
|
+
return async (input, init) => {
|
|
740
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
741
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
742
|
+
if (!token || !sandboxId) {
|
|
743
|
+
throw new Error(
|
|
744
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
745
|
+
);
|
|
746
|
+
}
|
|
747
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
748
|
+
const originalMethod = init?.method ?? "GET";
|
|
749
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
750
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
751
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
752
|
+
return fetch(proxyUrl, {
|
|
753
|
+
method: "POST",
|
|
754
|
+
headers: {
|
|
755
|
+
"Content-Type": "application/json",
|
|
756
|
+
Authorization: `Bearer ${token}`
|
|
757
|
+
},
|
|
758
|
+
body: JSON.stringify({
|
|
759
|
+
url: originalUrl,
|
|
760
|
+
method: originalMethod,
|
|
761
|
+
body: originalBody
|
|
762
|
+
})
|
|
763
|
+
});
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
767
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
768
|
+
if (!projectId) {
|
|
769
|
+
throw new Error(
|
|
770
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
771
|
+
);
|
|
772
|
+
}
|
|
773
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
774
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
775
|
+
return async (input, init) => {
|
|
776
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
777
|
+
const originalMethod = init?.method ?? "GET";
|
|
778
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
779
|
+
const c = getContext();
|
|
780
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
781
|
+
if (!appSession) {
|
|
782
|
+
throw new Error(
|
|
783
|
+
"No authentication method available for connection proxy."
|
|
784
|
+
);
|
|
785
|
+
}
|
|
786
|
+
return fetch(proxyUrl, {
|
|
787
|
+
method: "POST",
|
|
788
|
+
headers: {
|
|
789
|
+
"Content-Type": "application/json",
|
|
790
|
+
Authorization: `Bearer ${appSession}`
|
|
791
|
+
},
|
|
792
|
+
body: JSON.stringify({
|
|
793
|
+
url: originalUrl,
|
|
794
|
+
method: originalMethod,
|
|
795
|
+
body: originalBody
|
|
796
|
+
})
|
|
797
|
+
});
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
function createProxyFetch(connectionId) {
|
|
801
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
802
|
+
return createSandboxProxyFetch(connectionId);
|
|
803
|
+
}
|
|
804
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
805
|
+
}
|
|
806
|
+
|
|
733
807
|
// src/connectors/create-connector-sdk.ts
|
|
734
808
|
function loadConnectionsSync() {
|
|
735
809
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -763,7 +837,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
763
837
|
if (val !== void 0) params[param.slug] = val;
|
|
764
838
|
}
|
|
765
839
|
}
|
|
766
|
-
return createClient2(params);
|
|
840
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
767
841
|
};
|
|
768
842
|
}
|
|
769
843
|
|
|
@@ -236,6 +236,16 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
236
236
|
}
|
|
237
237
|
};
|
|
238
238
|
|
|
239
|
+
// ../connectors/src/auth-types.ts
|
|
240
|
+
var AUTH_TYPES = {
|
|
241
|
+
OAUTH: "oauth",
|
|
242
|
+
API_KEY: "api-key",
|
|
243
|
+
JWT: "jwt",
|
|
244
|
+
SERVICE_ACCOUNT: "service-account",
|
|
245
|
+
PAT: "pat",
|
|
246
|
+
USER_PASSWORD: "user-password"
|
|
247
|
+
};
|
|
248
|
+
|
|
239
249
|
// ../connectors/src/connectors/linkedin-ads/tools/list-ad-accounts.ts
|
|
240
250
|
import { z } from "zod";
|
|
241
251
|
var REQUEST_TIMEOUT_MS = 6e4;
|
|
@@ -461,10 +471,10 @@ var tools = {
|
|
|
461
471
|
};
|
|
462
472
|
var linkedinAdsConnector = new ConnectorPlugin({
|
|
463
473
|
slug: "linkedin-ads",
|
|
464
|
-
authType:
|
|
474
|
+
authType: AUTH_TYPES.API_KEY,
|
|
465
475
|
name: "LinkedIn Ads",
|
|
466
476
|
description: "Connect to LinkedIn Ads (Marketing API) for advertising campaign data and reporting using an access token.",
|
|
467
|
-
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/
|
|
477
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/3x7xd9pVJkRFY7ADIg4ycq/b94720e34cb081e9ae45dfde799a59cd/LinkedIn_icon.svg.png",
|
|
468
478
|
parameters,
|
|
469
479
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
470
480
|
onboarding: linkedinAdsOnboarding,
|
|
@@ -738,6 +748,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
738
748
|
return process.env[envVarName] || void 0;
|
|
739
749
|
}
|
|
740
750
|
|
|
751
|
+
// src/connector-client/proxy-fetch.ts
|
|
752
|
+
import { getContext } from "hono/context-storage";
|
|
753
|
+
import { getCookie } from "hono/cookie";
|
|
754
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
755
|
+
function createSandboxProxyFetch(connectionId) {
|
|
756
|
+
return async (input, init) => {
|
|
757
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
758
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
759
|
+
if (!token || !sandboxId) {
|
|
760
|
+
throw new Error(
|
|
761
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
762
|
+
);
|
|
763
|
+
}
|
|
764
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
765
|
+
const originalMethod = init?.method ?? "GET";
|
|
766
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
767
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
768
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
769
|
+
return fetch(proxyUrl, {
|
|
770
|
+
method: "POST",
|
|
771
|
+
headers: {
|
|
772
|
+
"Content-Type": "application/json",
|
|
773
|
+
Authorization: `Bearer ${token}`
|
|
774
|
+
},
|
|
775
|
+
body: JSON.stringify({
|
|
776
|
+
url: originalUrl,
|
|
777
|
+
method: originalMethod,
|
|
778
|
+
body: originalBody
|
|
779
|
+
})
|
|
780
|
+
});
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
784
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
785
|
+
if (!projectId) {
|
|
786
|
+
throw new Error(
|
|
787
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
791
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
792
|
+
return async (input, init) => {
|
|
793
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
794
|
+
const originalMethod = init?.method ?? "GET";
|
|
795
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
796
|
+
const c = getContext();
|
|
797
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
798
|
+
if (!appSession) {
|
|
799
|
+
throw new Error(
|
|
800
|
+
"No authentication method available for connection proxy."
|
|
801
|
+
);
|
|
802
|
+
}
|
|
803
|
+
return fetch(proxyUrl, {
|
|
804
|
+
method: "POST",
|
|
805
|
+
headers: {
|
|
806
|
+
"Content-Type": "application/json",
|
|
807
|
+
Authorization: `Bearer ${appSession}`
|
|
808
|
+
},
|
|
809
|
+
body: JSON.stringify({
|
|
810
|
+
url: originalUrl,
|
|
811
|
+
method: originalMethod,
|
|
812
|
+
body: originalBody
|
|
813
|
+
})
|
|
814
|
+
});
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
function createProxyFetch(connectionId) {
|
|
818
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
819
|
+
return createSandboxProxyFetch(connectionId);
|
|
820
|
+
}
|
|
821
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
822
|
+
}
|
|
823
|
+
|
|
741
824
|
// src/connectors/create-connector-sdk.ts
|
|
742
825
|
function loadConnectionsSync() {
|
|
743
826
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -771,7 +854,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
771
854
|
if (val !== void 0) params[param.slug] = val;
|
|
772
855
|
}
|
|
773
856
|
}
|
|
774
|
-
return createClient2(params);
|
|
857
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
775
858
|
};
|
|
776
859
|
}
|
|
777
860
|
|
|
@@ -164,7 +164,8 @@ var AUTH_TYPES = {
|
|
|
164
164
|
API_KEY: "api-key",
|
|
165
165
|
JWT: "jwt",
|
|
166
166
|
SERVICE_ACCOUNT: "service-account",
|
|
167
|
-
PAT: "pat"
|
|
167
|
+
PAT: "pat",
|
|
168
|
+
USER_PASSWORD: "user-password"
|
|
168
169
|
};
|
|
169
170
|
|
|
170
171
|
// ../connectors/src/connectors/mailchimp-oauth/setup.ts
|
|
@@ -317,7 +318,7 @@ var mailchimpOauthConnector = new ConnectorPlugin({
|
|
|
317
318
|
authType: AUTH_TYPES.OAUTH,
|
|
318
319
|
name: "Mailchimp (OAuth)",
|
|
319
320
|
description: "Connect to Mailchimp for email marketing, audiences, campaigns, and analytics using OAuth.",
|
|
320
|
-
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/
|
|
321
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/19Rac6B8eGiLpQb4lKMbG3/10f567f85572aeb16f2ee6aaa6602987/mailchimp.png",
|
|
321
322
|
parameters,
|
|
322
323
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
323
324
|
onboarding: mailchimpOauthOnboarding,
|
|
@@ -495,6 +496,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
495
496
|
return process.env[envVarName] || void 0;
|
|
496
497
|
}
|
|
497
498
|
|
|
499
|
+
// src/connector-client/proxy-fetch.ts
|
|
500
|
+
import { getContext } from "hono/context-storage";
|
|
501
|
+
import { getCookie } from "hono/cookie";
|
|
502
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
503
|
+
function createSandboxProxyFetch(connectionId) {
|
|
504
|
+
return async (input, init) => {
|
|
505
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
506
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
507
|
+
if (!token || !sandboxId) {
|
|
508
|
+
throw new Error(
|
|
509
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
513
|
+
const originalMethod = init?.method ?? "GET";
|
|
514
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
515
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
516
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
517
|
+
return fetch(proxyUrl, {
|
|
518
|
+
method: "POST",
|
|
519
|
+
headers: {
|
|
520
|
+
"Content-Type": "application/json",
|
|
521
|
+
Authorization: `Bearer ${token}`
|
|
522
|
+
},
|
|
523
|
+
body: JSON.stringify({
|
|
524
|
+
url: originalUrl,
|
|
525
|
+
method: originalMethod,
|
|
526
|
+
body: originalBody
|
|
527
|
+
})
|
|
528
|
+
});
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
532
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
533
|
+
if (!projectId) {
|
|
534
|
+
throw new Error(
|
|
535
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
539
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
540
|
+
return async (input, init) => {
|
|
541
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
542
|
+
const originalMethod = init?.method ?? "GET";
|
|
543
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
544
|
+
const c = getContext();
|
|
545
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
546
|
+
if (!appSession) {
|
|
547
|
+
throw new Error(
|
|
548
|
+
"No authentication method available for connection proxy."
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
return fetch(proxyUrl, {
|
|
552
|
+
method: "POST",
|
|
553
|
+
headers: {
|
|
554
|
+
"Content-Type": "application/json",
|
|
555
|
+
Authorization: `Bearer ${appSession}`
|
|
556
|
+
},
|
|
557
|
+
body: JSON.stringify({
|
|
558
|
+
url: originalUrl,
|
|
559
|
+
method: originalMethod,
|
|
560
|
+
body: originalBody
|
|
561
|
+
})
|
|
562
|
+
});
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
function createProxyFetch(connectionId) {
|
|
566
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
567
|
+
return createSandboxProxyFetch(connectionId);
|
|
568
|
+
}
|
|
569
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
570
|
+
}
|
|
571
|
+
|
|
498
572
|
// src/connectors/create-connector-sdk.ts
|
|
499
573
|
function loadConnectionsSync() {
|
|
500
574
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -528,7 +602,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
528
602
|
if (val !== void 0) params[param.slug] = val;
|
|
529
603
|
}
|
|
530
604
|
}
|
|
531
|
-
return createClient2(params);
|
|
605
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
532
606
|
};
|
|
533
607
|
}
|
|
534
608
|
|
|
@@ -262,6 +262,16 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
262
262
|
}
|
|
263
263
|
};
|
|
264
264
|
|
|
265
|
+
// ../connectors/src/auth-types.ts
|
|
266
|
+
var AUTH_TYPES = {
|
|
267
|
+
OAUTH: "oauth",
|
|
268
|
+
API_KEY: "api-key",
|
|
269
|
+
JWT: "jwt",
|
|
270
|
+
SERVICE_ACCOUNT: "service-account",
|
|
271
|
+
PAT: "pat",
|
|
272
|
+
USER_PASSWORD: "user-password"
|
|
273
|
+
};
|
|
274
|
+
|
|
265
275
|
// ../connectors/src/connectors/mailchimp/setup.ts
|
|
266
276
|
var mailchimpOnboarding = new ConnectorOnboarding({
|
|
267
277
|
dataOverviewInstructions: {
|
|
@@ -374,10 +384,10 @@ The datacenter is automatically extracted from the API key suffix.`,
|
|
|
374
384
|
var tools = { request: requestTool };
|
|
375
385
|
var mailchimpConnector = new ConnectorPlugin({
|
|
376
386
|
slug: "mailchimp",
|
|
377
|
-
authType:
|
|
387
|
+
authType: AUTH_TYPES.API_KEY,
|
|
378
388
|
name: "Mailchimp",
|
|
379
389
|
description: "Connect to Mailchimp for email marketing, audiences, campaigns, and analytics.",
|
|
380
|
-
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/
|
|
390
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/19Rac6B8eGiLpQb4lKMbG3/10f567f85572aeb16f2ee6aaa6602987/mailchimp.png",
|
|
381
391
|
parameters,
|
|
382
392
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
383
393
|
onboarding: mailchimpOnboarding,
|
|
@@ -602,6 +612,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
602
612
|
return process.env[envVarName] || void 0;
|
|
603
613
|
}
|
|
604
614
|
|
|
615
|
+
// src/connector-client/proxy-fetch.ts
|
|
616
|
+
import { getContext } from "hono/context-storage";
|
|
617
|
+
import { getCookie } from "hono/cookie";
|
|
618
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
619
|
+
function createSandboxProxyFetch(connectionId) {
|
|
620
|
+
return async (input, init) => {
|
|
621
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
622
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
623
|
+
if (!token || !sandboxId) {
|
|
624
|
+
throw new Error(
|
|
625
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
629
|
+
const originalMethod = init?.method ?? "GET";
|
|
630
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
631
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
632
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
633
|
+
return fetch(proxyUrl, {
|
|
634
|
+
method: "POST",
|
|
635
|
+
headers: {
|
|
636
|
+
"Content-Type": "application/json",
|
|
637
|
+
Authorization: `Bearer ${token}`
|
|
638
|
+
},
|
|
639
|
+
body: JSON.stringify({
|
|
640
|
+
url: originalUrl,
|
|
641
|
+
method: originalMethod,
|
|
642
|
+
body: originalBody
|
|
643
|
+
})
|
|
644
|
+
});
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
648
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
649
|
+
if (!projectId) {
|
|
650
|
+
throw new Error(
|
|
651
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
652
|
+
);
|
|
653
|
+
}
|
|
654
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
655
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
656
|
+
return async (input, init) => {
|
|
657
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
658
|
+
const originalMethod = init?.method ?? "GET";
|
|
659
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
660
|
+
const c = getContext();
|
|
661
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
662
|
+
if (!appSession) {
|
|
663
|
+
throw new Error(
|
|
664
|
+
"No authentication method available for connection proxy."
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
return fetch(proxyUrl, {
|
|
668
|
+
method: "POST",
|
|
669
|
+
headers: {
|
|
670
|
+
"Content-Type": "application/json",
|
|
671
|
+
Authorization: `Bearer ${appSession}`
|
|
672
|
+
},
|
|
673
|
+
body: JSON.stringify({
|
|
674
|
+
url: originalUrl,
|
|
675
|
+
method: originalMethod,
|
|
676
|
+
body: originalBody
|
|
677
|
+
})
|
|
678
|
+
});
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
function createProxyFetch(connectionId) {
|
|
682
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
683
|
+
return createSandboxProxyFetch(connectionId);
|
|
684
|
+
}
|
|
685
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
686
|
+
}
|
|
687
|
+
|
|
605
688
|
// src/connectors/create-connector-sdk.ts
|
|
606
689
|
function loadConnectionsSync() {
|
|
607
690
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -635,7 +718,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
635
718
|
if (val !== void 0) params[param.slug] = val;
|
|
636
719
|
}
|
|
637
720
|
}
|
|
638
|
-
return createClient2(params);
|
|
721
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
639
722
|
};
|
|
640
723
|
}
|
|
641
724
|
|