@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
|
@@ -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/openai/index.ts
|
|
128
138
|
var tools = {};
|
|
129
139
|
var openaiConnector = new ConnectorPlugin({
|
|
130
140
|
slug: "openai",
|
|
131
|
-
authType:
|
|
141
|
+
authType: AUTH_TYPES.API_KEY,
|
|
132
142
|
name: "OpenAI",
|
|
133
143
|
description: "Connect to OpenAI for AI model inference, embeddings, and image generation.",
|
|
134
144
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/53XJtCgUlW10x6i1X8xpxM/0bfd634069f1d74241296543cb20427a/openai.svg",
|
|
@@ -207,6 +217,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
207
217
|
return process.env[envVarName] || void 0;
|
|
208
218
|
}
|
|
209
219
|
|
|
220
|
+
// src/connector-client/proxy-fetch.ts
|
|
221
|
+
import { getContext } from "hono/context-storage";
|
|
222
|
+
import { getCookie } from "hono/cookie";
|
|
223
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
224
|
+
function createSandboxProxyFetch(connectionId) {
|
|
225
|
+
return async (input, init) => {
|
|
226
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
227
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
228
|
+
if (!token || !sandboxId) {
|
|
229
|
+
throw new Error(
|
|
230
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
234
|
+
const originalMethod = init?.method ?? "GET";
|
|
235
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
236
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
237
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
238
|
+
return fetch(proxyUrl, {
|
|
239
|
+
method: "POST",
|
|
240
|
+
headers: {
|
|
241
|
+
"Content-Type": "application/json",
|
|
242
|
+
Authorization: `Bearer ${token}`
|
|
243
|
+
},
|
|
244
|
+
body: JSON.stringify({
|
|
245
|
+
url: originalUrl,
|
|
246
|
+
method: originalMethod,
|
|
247
|
+
body: originalBody
|
|
248
|
+
})
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
253
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
254
|
+
if (!projectId) {
|
|
255
|
+
throw new Error(
|
|
256
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
260
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
261
|
+
return async (input, init) => {
|
|
262
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
263
|
+
const originalMethod = init?.method ?? "GET";
|
|
264
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
265
|
+
const c = getContext();
|
|
266
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
267
|
+
if (!appSession) {
|
|
268
|
+
throw new Error(
|
|
269
|
+
"No authentication method available for connection proxy."
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
return fetch(proxyUrl, {
|
|
273
|
+
method: "POST",
|
|
274
|
+
headers: {
|
|
275
|
+
"Content-Type": "application/json",
|
|
276
|
+
Authorization: `Bearer ${appSession}`
|
|
277
|
+
},
|
|
278
|
+
body: JSON.stringify({
|
|
279
|
+
url: originalUrl,
|
|
280
|
+
method: originalMethod,
|
|
281
|
+
body: originalBody
|
|
282
|
+
})
|
|
283
|
+
});
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function createProxyFetch(connectionId) {
|
|
287
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
288
|
+
return createSandboxProxyFetch(connectionId);
|
|
289
|
+
}
|
|
290
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
291
|
+
}
|
|
292
|
+
|
|
210
293
|
// src/connectors/create-connector-sdk.ts
|
|
211
294
|
function loadConnectionsSync() {
|
|
212
295
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -240,7 +323,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
240
323
|
if (val !== void 0) params[param.slug] = val;
|
|
241
324
|
}
|
|
242
325
|
}
|
|
243
|
-
return createClient2(params);
|
|
326
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
244
327
|
};
|
|
245
328
|
}
|
|
246
329
|
|
|
@@ -112,7 +112,8 @@ var AUTH_TYPES = {
|
|
|
112
112
|
API_KEY: "api-key",
|
|
113
113
|
JWT: "jwt",
|
|
114
114
|
SERVICE_ACCOUNT: "service-account",
|
|
115
|
-
PAT: "pat"
|
|
115
|
+
PAT: "pat",
|
|
116
|
+
USER_PASSWORD: "user-password"
|
|
116
117
|
};
|
|
117
118
|
|
|
118
119
|
// ../connectors/src/connectors/shopify-oauth/tools/request.ts
|
|
@@ -278,7 +279,7 @@ var tools = { request: requestTool };
|
|
|
278
279
|
var shopifyOauthConnector = new ConnectorPlugin({
|
|
279
280
|
slug: "shopify",
|
|
280
281
|
authType: AUTH_TYPES.OAUTH,
|
|
281
|
-
name: "Shopify
|
|
282
|
+
name: "Shopify",
|
|
282
283
|
description: "Connect to Shopify for e-commerce data including products, orders, and customers using OAuth.",
|
|
283
284
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/57KEjZCBskKgSxgKyU4Sm0/117d681a410f48dc36f97cdd9c0593c5/shopify-icon.svg",
|
|
284
285
|
parameters,
|
|
@@ -434,6 +435,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
434
435
|
return process.env[envVarName] || void 0;
|
|
435
436
|
}
|
|
436
437
|
|
|
438
|
+
// src/connector-client/proxy-fetch.ts
|
|
439
|
+
import { getContext } from "hono/context-storage";
|
|
440
|
+
import { getCookie } from "hono/cookie";
|
|
441
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
442
|
+
function createSandboxProxyFetch(connectionId) {
|
|
443
|
+
return async (input, init) => {
|
|
444
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
445
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
446
|
+
if (!token || !sandboxId) {
|
|
447
|
+
throw new Error(
|
|
448
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
452
|
+
const originalMethod = init?.method ?? "GET";
|
|
453
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
454
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
455
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
456
|
+
return fetch(proxyUrl, {
|
|
457
|
+
method: "POST",
|
|
458
|
+
headers: {
|
|
459
|
+
"Content-Type": "application/json",
|
|
460
|
+
Authorization: `Bearer ${token}`
|
|
461
|
+
},
|
|
462
|
+
body: JSON.stringify({
|
|
463
|
+
url: originalUrl,
|
|
464
|
+
method: originalMethod,
|
|
465
|
+
body: originalBody
|
|
466
|
+
})
|
|
467
|
+
});
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
471
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
472
|
+
if (!projectId) {
|
|
473
|
+
throw new Error(
|
|
474
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
478
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
479
|
+
return async (input, init) => {
|
|
480
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
481
|
+
const originalMethod = init?.method ?? "GET";
|
|
482
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
483
|
+
const c = getContext();
|
|
484
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
485
|
+
if (!appSession) {
|
|
486
|
+
throw new Error(
|
|
487
|
+
"No authentication method available for connection proxy."
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
return fetch(proxyUrl, {
|
|
491
|
+
method: "POST",
|
|
492
|
+
headers: {
|
|
493
|
+
"Content-Type": "application/json",
|
|
494
|
+
Authorization: `Bearer ${appSession}`
|
|
495
|
+
},
|
|
496
|
+
body: JSON.stringify({
|
|
497
|
+
url: originalUrl,
|
|
498
|
+
method: originalMethod,
|
|
499
|
+
body: originalBody
|
|
500
|
+
})
|
|
501
|
+
});
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
function createProxyFetch(connectionId) {
|
|
505
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
506
|
+
return createSandboxProxyFetch(connectionId);
|
|
507
|
+
}
|
|
508
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
509
|
+
}
|
|
510
|
+
|
|
437
511
|
// src/connectors/create-connector-sdk.ts
|
|
438
512
|
function loadConnectionsSync() {
|
|
439
513
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -467,7 +541,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
467
541
|
if (val !== void 0) params[param.slug] = val;
|
|
468
542
|
}
|
|
469
543
|
}
|
|
470
|
-
return createClient2(params);
|
|
544
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
471
545
|
};
|
|
472
546
|
}
|
|
473
547
|
|
|
@@ -380,6 +380,16 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
382
|
|
|
383
|
+
// ../connectors/src/auth-types.ts
|
|
384
|
+
var AUTH_TYPES = {
|
|
385
|
+
OAUTH: "oauth",
|
|
386
|
+
API_KEY: "api-key",
|
|
387
|
+
JWT: "jwt",
|
|
388
|
+
SERVICE_ACCOUNT: "service-account",
|
|
389
|
+
PAT: "pat",
|
|
390
|
+
USER_PASSWORD: "user-password"
|
|
391
|
+
};
|
|
392
|
+
|
|
383
393
|
// ../connectors/src/connectors/shopify/setup.ts
|
|
384
394
|
var shopifyOnboarding = new ConnectorOnboarding({
|
|
385
395
|
dataOverviewInstructions: {
|
|
@@ -500,7 +510,7 @@ Use this tool for all Shopify API interactions: listing products, orders, custom
|
|
|
500
510
|
var tools = { request: requestTool };
|
|
501
511
|
var shopifyConnector = new ConnectorPlugin({
|
|
502
512
|
slug: "shopify",
|
|
503
|
-
authType:
|
|
513
|
+
authType: AUTH_TYPES.API_KEY,
|
|
504
514
|
name: "Shopify",
|
|
505
515
|
description: "Connect to Shopify for e-commerce data including products, orders, and customers.",
|
|
506
516
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/57KEjZCBskKgSxgKyU4Sm0/117d681a410f48dc36f97cdd9c0593c5/shopify-icon.svg",
|
|
@@ -678,6 +688,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
678
688
|
return process.env[envVarName] || void 0;
|
|
679
689
|
}
|
|
680
690
|
|
|
691
|
+
// src/connector-client/proxy-fetch.ts
|
|
692
|
+
import { getContext } from "hono/context-storage";
|
|
693
|
+
import { getCookie } from "hono/cookie";
|
|
694
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
695
|
+
function createSandboxProxyFetch(connectionId) {
|
|
696
|
+
return async (input, init) => {
|
|
697
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
698
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
699
|
+
if (!token || !sandboxId) {
|
|
700
|
+
throw new Error(
|
|
701
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
702
|
+
);
|
|
703
|
+
}
|
|
704
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
705
|
+
const originalMethod = init?.method ?? "GET";
|
|
706
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
707
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
708
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
709
|
+
return fetch(proxyUrl, {
|
|
710
|
+
method: "POST",
|
|
711
|
+
headers: {
|
|
712
|
+
"Content-Type": "application/json",
|
|
713
|
+
Authorization: `Bearer ${token}`
|
|
714
|
+
},
|
|
715
|
+
body: JSON.stringify({
|
|
716
|
+
url: originalUrl,
|
|
717
|
+
method: originalMethod,
|
|
718
|
+
body: originalBody
|
|
719
|
+
})
|
|
720
|
+
});
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
724
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
725
|
+
if (!projectId) {
|
|
726
|
+
throw new Error(
|
|
727
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
728
|
+
);
|
|
729
|
+
}
|
|
730
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
731
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
732
|
+
return async (input, init) => {
|
|
733
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
734
|
+
const originalMethod = init?.method ?? "GET";
|
|
735
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
736
|
+
const c = getContext();
|
|
737
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
738
|
+
if (!appSession) {
|
|
739
|
+
throw new Error(
|
|
740
|
+
"No authentication method available for connection proxy."
|
|
741
|
+
);
|
|
742
|
+
}
|
|
743
|
+
return fetch(proxyUrl, {
|
|
744
|
+
method: "POST",
|
|
745
|
+
headers: {
|
|
746
|
+
"Content-Type": "application/json",
|
|
747
|
+
Authorization: `Bearer ${appSession}`
|
|
748
|
+
},
|
|
749
|
+
body: JSON.stringify({
|
|
750
|
+
url: originalUrl,
|
|
751
|
+
method: originalMethod,
|
|
752
|
+
body: originalBody
|
|
753
|
+
})
|
|
754
|
+
});
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
function createProxyFetch(connectionId) {
|
|
758
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
759
|
+
return createSandboxProxyFetch(connectionId);
|
|
760
|
+
}
|
|
761
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
762
|
+
}
|
|
763
|
+
|
|
681
764
|
// src/connectors/create-connector-sdk.ts
|
|
682
765
|
function loadConnectionsSync() {
|
|
683
766
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -711,7 +794,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
711
794
|
if (val !== void 0) params[param.slug] = val;
|
|
712
795
|
}
|
|
713
796
|
}
|
|
714
|
-
return createClient2(params);
|
|
797
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
715
798
|
};
|
|
716
799
|
}
|
|
717
800
|
|