@squadbase/vite-server 0.1.3-dev.0 → 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 +82859 -9645
- 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/{slack.d.ts → asana.d.ts} +1 -1
- package/dist/connectors/asana.js +744 -0
- package/dist/connectors/attio.js +85 -2
- package/dist/connectors/{microsoft-teams-oauth.d.ts → customerio.d.ts} +1 -1
- package/dist/connectors/customerio.js +716 -0
- package/dist/connectors/dbt.js +85 -2
- package/dist/connectors/gemini.js +86 -3
- package/dist/connectors/{microsoft-teams.d.ts → gmail-oauth.d.ts} +1 -1
- package/dist/connectors/gmail-oauth.js +713 -0
- 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.d.ts +5 -0
- package/dist/connectors/google-ads.js +867 -0
- 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.d.ts +5 -0
- package/dist/connectors/google-sheets.js +707 -0
- package/dist/connectors/grafana.d.ts +5 -0
- package/dist/connectors/grafana.js +638 -0
- package/dist/connectors/hubspot-oauth.js +77 -3
- package/dist/connectors/hubspot.js +89 -6
- package/dist/connectors/intercom-oauth.d.ts +5 -0
- package/dist/connectors/intercom-oauth.js +584 -0
- package/dist/connectors/intercom.d.ts +5 -0
- package/dist/connectors/intercom.js +710 -0
- package/dist/connectors/jira-api-key.d.ts +5 -0
- package/dist/connectors/jira-api-key.js +598 -0
- package/dist/connectors/kintone-api-token.js +77 -3
- package/dist/connectors/kintone.js +86 -3
- package/dist/connectors/linkedin-ads-oauth.d.ts +5 -0
- package/dist/connectors/linkedin-ads-oauth.js +848 -0
- package/dist/connectors/linkedin-ads.d.ts +5 -0
- package/dist/connectors/linkedin-ads.js +865 -0
- package/dist/connectors/mailchimp-oauth.d.ts +5 -0
- package/dist/connectors/mailchimp-oauth.js +613 -0
- package/dist/connectors/mailchimp.d.ts +5 -0
- package/dist/connectors/mailchimp.js +729 -0
- package/dist/connectors/notion-oauth.d.ts +5 -0
- package/dist/connectors/notion-oauth.js +567 -0
- package/dist/connectors/notion.d.ts +5 -0
- 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.d.ts +5 -0
- package/dist/connectors/zendesk-oauth.js +579 -0
- package/dist/connectors/zendesk.d.ts +5 -0
- package/dist/connectors/zendesk.js +714 -0
- package/dist/index.js +83024 -7099
- package/dist/main.js +82988 -7063
- package/dist/vite-plugin.js +82862 -6974
- package/package.json +86 -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
package/dist/connectors/dbt.js
CHANGED
|
@@ -417,6 +417,16 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
417
417
|
}
|
|
418
418
|
};
|
|
419
419
|
|
|
420
|
+
// ../connectors/src/auth-types.ts
|
|
421
|
+
var AUTH_TYPES = {
|
|
422
|
+
OAUTH: "oauth",
|
|
423
|
+
API_KEY: "api-key",
|
|
424
|
+
JWT: "jwt",
|
|
425
|
+
SERVICE_ACCOUNT: "service-account",
|
|
426
|
+
PAT: "pat",
|
|
427
|
+
USER_PASSWORD: "user-password"
|
|
428
|
+
};
|
|
429
|
+
|
|
420
430
|
// ../connectors/src/connectors/dbt/setup.ts
|
|
421
431
|
var dbtOnboarding = new ConnectorOnboarding({
|
|
422
432
|
dataOverviewInstructions: {
|
|
@@ -518,7 +528,7 @@ Authentication is handled automatically using the API token.
|
|
|
518
528
|
var tools = { request: requestTool };
|
|
519
529
|
var dbtConnector = new ConnectorPlugin({
|
|
520
530
|
slug: "dbt",
|
|
521
|
-
authType:
|
|
531
|
+
authType: AUTH_TYPES.API_KEY,
|
|
522
532
|
name: "dbt",
|
|
523
533
|
description: "Connect to dbt Cloud for data transformation and analytics engineering.",
|
|
524
534
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/4iT6ncXtdtHdkXexU0WgfZ/0367a38d245f2568eab5eb511f9ee692/dbt.png",
|
|
@@ -770,6 +780,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
770
780
|
return process.env[envVarName] || void 0;
|
|
771
781
|
}
|
|
772
782
|
|
|
783
|
+
// src/connector-client/proxy-fetch.ts
|
|
784
|
+
import { getContext } from "hono/context-storage";
|
|
785
|
+
import { getCookie } from "hono/cookie";
|
|
786
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
787
|
+
function createSandboxProxyFetch(connectionId) {
|
|
788
|
+
return async (input, init) => {
|
|
789
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
790
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
791
|
+
if (!token || !sandboxId) {
|
|
792
|
+
throw new Error(
|
|
793
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
797
|
+
const originalMethod = init?.method ?? "GET";
|
|
798
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
799
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
800
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
801
|
+
return fetch(proxyUrl, {
|
|
802
|
+
method: "POST",
|
|
803
|
+
headers: {
|
|
804
|
+
"Content-Type": "application/json",
|
|
805
|
+
Authorization: `Bearer ${token}`
|
|
806
|
+
},
|
|
807
|
+
body: JSON.stringify({
|
|
808
|
+
url: originalUrl,
|
|
809
|
+
method: originalMethod,
|
|
810
|
+
body: originalBody
|
|
811
|
+
})
|
|
812
|
+
});
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
816
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
817
|
+
if (!projectId) {
|
|
818
|
+
throw new Error(
|
|
819
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
820
|
+
);
|
|
821
|
+
}
|
|
822
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
823
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
824
|
+
return async (input, init) => {
|
|
825
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
826
|
+
const originalMethod = init?.method ?? "GET";
|
|
827
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
828
|
+
const c = getContext();
|
|
829
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
830
|
+
if (!appSession) {
|
|
831
|
+
throw new Error(
|
|
832
|
+
"No authentication method available for connection proxy."
|
|
833
|
+
);
|
|
834
|
+
}
|
|
835
|
+
return fetch(proxyUrl, {
|
|
836
|
+
method: "POST",
|
|
837
|
+
headers: {
|
|
838
|
+
"Content-Type": "application/json",
|
|
839
|
+
Authorization: `Bearer ${appSession}`
|
|
840
|
+
},
|
|
841
|
+
body: JSON.stringify({
|
|
842
|
+
url: originalUrl,
|
|
843
|
+
method: originalMethod,
|
|
844
|
+
body: originalBody
|
|
845
|
+
})
|
|
846
|
+
});
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
function createProxyFetch(connectionId) {
|
|
850
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
851
|
+
return createSandboxProxyFetch(connectionId);
|
|
852
|
+
}
|
|
853
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
854
|
+
}
|
|
855
|
+
|
|
773
856
|
// src/connectors/create-connector-sdk.ts
|
|
774
857
|
function loadConnectionsSync() {
|
|
775
858
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -803,7 +886,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
803
886
|
if (val !== void 0) params[param.slug] = val;
|
|
804
887
|
}
|
|
805
888
|
}
|
|
806
|
-
return createClient2(params);
|
|
889
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
807
890
|
};
|
|
808
891
|
}
|
|
809
892
|
|
|
@@ -124,14 +124,24 @@ 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/gemini/index.ts
|
|
128
138
|
var tools = {};
|
|
129
139
|
var geminiConnector = new ConnectorPlugin({
|
|
130
140
|
slug: "gemini",
|
|
131
|
-
authType:
|
|
141
|
+
authType: AUTH_TYPES.API_KEY,
|
|
132
142
|
name: "Gemini",
|
|
133
143
|
description: "Connect to Google Gemini for AI model inference, embeddings, and multimodal generation.",
|
|
134
|
-
iconUrl: "https://
|
|
144
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/6K2qZQZEQq90YENfrXy5my/c83c0c3815af0a97d29ee70f37215f01/gemini.png",
|
|
135
145
|
parameters,
|
|
136
146
|
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
137
147
|
systemPrompt: {
|
|
@@ -201,6 +211,79 @@ function resolveEnvVarOptional(entry, key) {
|
|
|
201
211
|
return process.env[envVarName] || void 0;
|
|
202
212
|
}
|
|
203
213
|
|
|
214
|
+
// src/connector-client/proxy-fetch.ts
|
|
215
|
+
import { getContext } from "hono/context-storage";
|
|
216
|
+
import { getCookie } from "hono/cookie";
|
|
217
|
+
var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
|
|
218
|
+
function createSandboxProxyFetch(connectionId) {
|
|
219
|
+
return async (input, init) => {
|
|
220
|
+
const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
|
|
221
|
+
const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
|
|
222
|
+
if (!token || !sandboxId) {
|
|
223
|
+
throw new Error(
|
|
224
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
228
|
+
const originalMethod = init?.method ?? "GET";
|
|
229
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
230
|
+
const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
|
|
231
|
+
const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
232
|
+
return fetch(proxyUrl, {
|
|
233
|
+
method: "POST",
|
|
234
|
+
headers: {
|
|
235
|
+
"Content-Type": "application/json",
|
|
236
|
+
Authorization: `Bearer ${token}`
|
|
237
|
+
},
|
|
238
|
+
body: JSON.stringify({
|
|
239
|
+
url: originalUrl,
|
|
240
|
+
method: originalMethod,
|
|
241
|
+
body: originalBody
|
|
242
|
+
})
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function createDeployedAppProxyFetch(connectionId) {
|
|
247
|
+
const projectId = process.env["SQUADBASE_PROJECT_ID"];
|
|
248
|
+
if (!projectId) {
|
|
249
|
+
throw new Error(
|
|
250
|
+
"Connection proxy is not configured. Please check your deployment settings."
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
|
|
254
|
+
const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
255
|
+
return async (input, init) => {
|
|
256
|
+
const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
257
|
+
const originalMethod = init?.method ?? "GET";
|
|
258
|
+
const originalBody = init?.body ? JSON.parse(init.body) : void 0;
|
|
259
|
+
const c = getContext();
|
|
260
|
+
const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
|
|
261
|
+
if (!appSession) {
|
|
262
|
+
throw new Error(
|
|
263
|
+
"No authentication method available for connection proxy."
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
return fetch(proxyUrl, {
|
|
267
|
+
method: "POST",
|
|
268
|
+
headers: {
|
|
269
|
+
"Content-Type": "application/json",
|
|
270
|
+
Authorization: `Bearer ${appSession}`
|
|
271
|
+
},
|
|
272
|
+
body: JSON.stringify({
|
|
273
|
+
url: originalUrl,
|
|
274
|
+
method: originalMethod,
|
|
275
|
+
body: originalBody
|
|
276
|
+
})
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
function createProxyFetch(connectionId) {
|
|
281
|
+
if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
|
|
282
|
+
return createSandboxProxyFetch(connectionId);
|
|
283
|
+
}
|
|
284
|
+
return createDeployedAppProxyFetch(connectionId);
|
|
285
|
+
}
|
|
286
|
+
|
|
204
287
|
// src/connectors/create-connector-sdk.ts
|
|
205
288
|
function loadConnectionsSync() {
|
|
206
289
|
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
@@ -234,7 +317,7 @@ function createConnectorSdk(plugin, createClient2) {
|
|
|
234
317
|
if (val !== void 0) params[param.slug] = val;
|
|
235
318
|
}
|
|
236
319
|
}
|
|
237
|
-
return createClient2(params);
|
|
320
|
+
return createClient2(params, createProxyFetch(connectionId));
|
|
238
321
|
};
|
|
239
322
|
}
|
|
240
323
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _squadbase_connectors_sdk from '@squadbase/connectors/sdk';
|
|
2
2
|
|
|
3
|
-
declare const connection: (connectionId: string) => _squadbase_connectors_sdk.
|
|
3
|
+
declare const connection: (connectionId: string) => _squadbase_connectors_sdk.GmailConnectorSdk;
|
|
4
4
|
|
|
5
5
|
export { connection };
|