@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
|
@@ -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
|
|