@squadbase/vite-server 0.1.17-dev.e4768d1 → 0.1.18
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 +333 -49
- package/dist/connectors/google-analytics-oauth.js +1 -1
- package/dist/connectors/google-calendar-oauth.js +1 -1
- package/dist/connectors/hackernews.js +1 -1
- package/dist/connectors/slack.d.ts +5 -0
- package/dist/connectors/slack.js +656 -0
- package/dist/connectors/x.js +1 -1
- package/dist/index.js +333 -49
- package/dist/main.js +333 -49
- package/dist/vite-plugin.js +333 -49
- package/package.json +5 -1
package/dist/cli/index.js
CHANGED
|
@@ -3893,9 +3893,9 @@ var tidbConnector = new ConnectorPlugin({
|
|
|
3893
3893
|
authType: AUTH_TYPES.USER_PASSWORD,
|
|
3894
3894
|
name: "TiDB",
|
|
3895
3895
|
description: "Connect to TiDB (MySQL-compatible distributed SQL database, incl. TiDB Cloud Serverless/Dedicated) for relational data storage and querying.",
|
|
3896
|
-
iconUrl: "https://
|
|
3896
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/38VhfLEd1t6rkEca5Nls8o/6d6f9ca6dc83b89e8f807661317515bc/69240164.png",
|
|
3897
3897
|
parameters: parameters6,
|
|
3898
|
-
releaseFlag: { dev1: true, dev2:
|
|
3898
|
+
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
3899
3899
|
categories: ["database"],
|
|
3900
3900
|
onboarding: tidbOnboarding,
|
|
3901
3901
|
systemPrompt: {
|
|
@@ -11014,7 +11014,7 @@ var googleAnalyticsOauthConnector = new ConnectorPlugin({
|
|
|
11014
11014
|
description: "Connect to Google Analytics for web analytics and reporting using OAuth.",
|
|
11015
11015
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/7fs0ipzxuD9mACDzBATtxX/3c53ed90d15c96483e4f78cb29dab5e9/google-analytics.svg",
|
|
11016
11016
|
parameters: parameters16,
|
|
11017
|
-
releaseFlag: { dev1: true, dev2:
|
|
11017
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
11018
11018
|
categories: ["marketing"],
|
|
11019
11019
|
onboarding: googleAnalyticsOauthOnboarding,
|
|
11020
11020
|
proxyPolicy: {
|
|
@@ -12605,7 +12605,7 @@ var googleCalendarOauthConnector = new ConnectorPlugin({
|
|
|
12605
12605
|
description: "Connect to Google Calendar for calendar and event data access using OAuth.",
|
|
12606
12606
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2YsqoBEpdELmfDeFcyGHyE/4494c633b5ae15e562cb739cd85442c1/google-calendar.png",
|
|
12607
12607
|
parameters: parameters18,
|
|
12608
|
-
releaseFlag: { dev1: true, dev2:
|
|
12608
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
12609
12609
|
categories: ["productivity"],
|
|
12610
12610
|
onboarding: googleCalendarOauthOnboarding,
|
|
12611
12611
|
proxyPolicy: {
|
|
@@ -46258,7 +46258,7 @@ var xConnector = new ConnectorPlugin({
|
|
|
46258
46258
|
description: "Connect to X API v2 for posts, users, search, timelines, trends, and related social media data using a user-provided Bearer Token.",
|
|
46259
46259
|
iconUrl: "https://cdn.simpleicons.org/x/000000",
|
|
46260
46260
|
parameters: parameters85,
|
|
46261
|
-
releaseFlag: { dev1: true, dev2: true, prod:
|
|
46261
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
46262
46262
|
categories: ["social_media"],
|
|
46263
46263
|
onboarding: xOnboarding,
|
|
46264
46264
|
systemPrompt: {
|
|
@@ -46673,7 +46673,7 @@ var hackerNewsConnector = new ConnectorPlugin({
|
|
|
46673
46673
|
description: "Connect to public Hacker News data using the official Firebase API, with optional Algolia-powered search when needed.",
|
|
46674
46674
|
iconUrl: "https://news.ycombinator.com/y18.svg",
|
|
46675
46675
|
parameters: parameters86,
|
|
46676
|
-
releaseFlag: { dev1: true, dev2: true, prod:
|
|
46676
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
46677
46677
|
categories: ["scraping"],
|
|
46678
46678
|
onboarding: hackerNewsOnboarding,
|
|
46679
46679
|
systemPrompt: {
|
|
@@ -46818,6 +46818,289 @@ export default async function handler(c: Context) {
|
|
|
46818
46818
|
}
|
|
46819
46819
|
});
|
|
46820
46820
|
|
|
46821
|
+
// ../connectors/src/connectors/slack/tools/request.ts
|
|
46822
|
+
import { z as z105 } from "zod";
|
|
46823
|
+
var BASE_URL70 = "https://slack.com/api";
|
|
46824
|
+
var REQUEST_TIMEOUT_MS80 = 6e4;
|
|
46825
|
+
var cachedToken35 = null;
|
|
46826
|
+
async function getProxyToken35(config) {
|
|
46827
|
+
if (cachedToken35 && cachedToken35.expiresAt > Date.now() + 6e4) {
|
|
46828
|
+
return cachedToken35.token;
|
|
46829
|
+
}
|
|
46830
|
+
const url = `${config.appApiBaseUrl}/v0/database/${config.projectId}/environment/${config.environmentId}/oauth-request-proxy-token`;
|
|
46831
|
+
const res = await fetch(url, {
|
|
46832
|
+
method: "POST",
|
|
46833
|
+
headers: {
|
|
46834
|
+
"Content-Type": "application/json",
|
|
46835
|
+
"x-api-key": config.appApiKey,
|
|
46836
|
+
"project-id": config.projectId
|
|
46837
|
+
},
|
|
46838
|
+
body: JSON.stringify({
|
|
46839
|
+
sandboxId: config.sandboxId,
|
|
46840
|
+
issuedBy: "coding-agent"
|
|
46841
|
+
})
|
|
46842
|
+
});
|
|
46843
|
+
if (!res.ok) {
|
|
46844
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
46845
|
+
throw new Error(
|
|
46846
|
+
`Failed to get proxy token: HTTP ${res.status} ${errorText}`
|
|
46847
|
+
);
|
|
46848
|
+
}
|
|
46849
|
+
const data = await res.json();
|
|
46850
|
+
cachedToken35 = {
|
|
46851
|
+
token: data.token,
|
|
46852
|
+
expiresAt: new Date(data.expiresAt).getTime()
|
|
46853
|
+
};
|
|
46854
|
+
return data.token;
|
|
46855
|
+
}
|
|
46856
|
+
var inputSchema105 = z105.object({
|
|
46857
|
+
toolUseIntent: z105.string().optional().describe(
|
|
46858
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
46859
|
+
),
|
|
46860
|
+
connectionId: z105.string().describe("ID of the Slack connection to use"),
|
|
46861
|
+
method: z105.enum(["GET", "POST"]).describe("HTTP method"),
|
|
46862
|
+
path: z105.string().describe(
|
|
46863
|
+
"API method path appended to https://slack.com/api, including query parameters (e.g., '/conversations.list?types=public_channel,private_channel&limit=200', '/conversations.history?channel=C0123456789&limit=50')"
|
|
46864
|
+
),
|
|
46865
|
+
body: z105.record(z105.string(), z105.unknown()).optional().describe("Request body (JSON) for POST requests")
|
|
46866
|
+
});
|
|
46867
|
+
var outputSchema105 = z105.discriminatedUnion("success", [
|
|
46868
|
+
z105.object({
|
|
46869
|
+
success: z105.literal(true),
|
|
46870
|
+
status: z105.number(),
|
|
46871
|
+
data: z105.record(z105.string(), z105.unknown())
|
|
46872
|
+
}),
|
|
46873
|
+
z105.object({
|
|
46874
|
+
success: z105.literal(false),
|
|
46875
|
+
error: z105.string()
|
|
46876
|
+
})
|
|
46877
|
+
]);
|
|
46878
|
+
var requestTool60 = new ConnectorTool({
|
|
46879
|
+
name: "request",
|
|
46880
|
+
description: `Send authenticated requests to the Slack Web API.
|
|
46881
|
+
Authentication is handled automatically via OAuth proxy using the authorizing user's token, so results reflect what that user can see in Slack (public channels plus private channels/DMs they are a member of).
|
|
46882
|
+
Use this tool for all Slack API interactions: listing channels, reading channel message history, reading thread replies, and resolving user names.
|
|
46883
|
+
Pagination is cursor-based: pass 'cursor' from 'response_metadata.next_cursor' of the previous response. Message timestamps ('ts', 'oldest', 'latest') are Unix epoch seconds as strings.`,
|
|
46884
|
+
inputSchema: inputSchema105,
|
|
46885
|
+
outputSchema: outputSchema105,
|
|
46886
|
+
async execute({ connectionId, method, path: path5, body }, connections, config) {
|
|
46887
|
+
const connection = connections.find((c) => c.id === connectionId);
|
|
46888
|
+
if (!connection) {
|
|
46889
|
+
return {
|
|
46890
|
+
success: false,
|
|
46891
|
+
error: `Connection ${connectionId} not found`
|
|
46892
|
+
};
|
|
46893
|
+
}
|
|
46894
|
+
console.log(
|
|
46895
|
+
`[connector-request] slack/${connection.name}: ${method} ${path5}`
|
|
46896
|
+
);
|
|
46897
|
+
try {
|
|
46898
|
+
const url = `${BASE_URL70}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
46899
|
+
const token = await getProxyToken35(config.oauthProxy);
|
|
46900
|
+
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
46901
|
+
const controller = new AbortController();
|
|
46902
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS80);
|
|
46903
|
+
try {
|
|
46904
|
+
const response = await fetch(proxyUrl, {
|
|
46905
|
+
method: "POST",
|
|
46906
|
+
headers: {
|
|
46907
|
+
"Content-Type": "application/json",
|
|
46908
|
+
Authorization: `Bearer ${token}`
|
|
46909
|
+
},
|
|
46910
|
+
body: JSON.stringify({
|
|
46911
|
+
url,
|
|
46912
|
+
method,
|
|
46913
|
+
headers: method === "POST" ? { "Content-Type": "application/json; charset=utf-8" } : {},
|
|
46914
|
+
body: body ? JSON.stringify(body) : void 0
|
|
46915
|
+
}),
|
|
46916
|
+
signal: controller.signal
|
|
46917
|
+
});
|
|
46918
|
+
const data = await response.json();
|
|
46919
|
+
if (!response.ok || data.ok === false) {
|
|
46920
|
+
const errorMessage = typeof data?.error === "string" ? data.error : `HTTP ${response.status} ${response.statusText}`;
|
|
46921
|
+
return { success: false, error: errorMessage };
|
|
46922
|
+
}
|
|
46923
|
+
return { success: true, status: response.status, data };
|
|
46924
|
+
} finally {
|
|
46925
|
+
clearTimeout(timeout);
|
|
46926
|
+
}
|
|
46927
|
+
} catch (err) {
|
|
46928
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
46929
|
+
return { success: false, error: msg };
|
|
46930
|
+
}
|
|
46931
|
+
}
|
|
46932
|
+
});
|
|
46933
|
+
|
|
46934
|
+
// ../connectors/src/connectors/slack/setup.ts
|
|
46935
|
+
var requestToolName16 = `slack-oauth_${requestTool60.name}`;
|
|
46936
|
+
var slackOnboarding = new ConnectorOnboarding({
|
|
46937
|
+
connectionSetupInstructions: {
|
|
46938
|
+
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Slack\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
46939
|
+
|
|
46940
|
+
1. \`${requestToolName16}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u8A8D\u53EF\u3057\u305F\u30E6\u30FC\u30B6\u30FC\u3068\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u3092\u78BA\u8A8D\u3059\u308B:
|
|
46941
|
+
- \`method\`: \`"POST"\`
|
|
46942
|
+
- \`path\`: \`"/auth.test"\`
|
|
46943
|
+
2. \u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\u3001\u30E6\u30FC\u30B6\u30FC\u306BOAuth\u63A5\u7D9A\u306E\u8A2D\u5B9A\u3092\u78BA\u8A8D\u3059\u308B\u3088\u3046\u4F1D\u3048\u308B
|
|
46944
|
+
|
|
46945
|
+
#### \u5236\u7D04
|
|
46946
|
+
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30E1\u30C3\u30BB\u30FC\u30B8\u672C\u6587\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u624B\u9806\u3067\u6307\u5B9A\u3055\u308C\u305F\u8A8D\u8A3C\u78BA\u8A8D\u30EA\u30AF\u30A8\u30B9\u30C8\u306E\u307F
|
|
46947
|
+
- \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057\u3002\u4E0D\u8981\u306A\u8AAC\u660E\u306F\u7701\u7565\u3057\u3001\u52B9\u7387\u7684\u306B\u9032\u3081\u308B`,
|
|
46948
|
+
en: `Follow these steps to set up the Slack connection.
|
|
46949
|
+
|
|
46950
|
+
1. Call \`${requestToolName16}\` to verify the authorizing user and workspace:
|
|
46951
|
+
- \`method\`: \`"POST"\`
|
|
46952
|
+
- \`path\`: \`"/auth.test"\`
|
|
46953
|
+
2. If an error is returned, ask the user to check the OAuth connection settings
|
|
46954
|
+
|
|
46955
|
+
#### Constraints
|
|
46956
|
+
- **Do NOT read message contents during setup**. Only the auth verification request specified in the steps above is allowed
|
|
46957
|
+
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
46958
|
+
},
|
|
46959
|
+
dataOverviewInstructions: {
|
|
46960
|
+
en: `1. Call connector_slack-oauth_request with GET /conversations.list?types=public_channel,private_channel&exclude_archived=true&limit=100 to discover channels visible to the authorizing user
|
|
46961
|
+
2. For 2-3 channels relevant to the analysis, call connector_slack-oauth_request with GET /conversations.history?channel={channel_id}&limit=10 to sample recent messages
|
|
46962
|
+
3. Call connector_slack-oauth_request with GET /users.list?limit=100 to map user IDs to display names
|
|
46963
|
+
4. For threads worth exploring, call connector_slack-oauth_request with GET /conversations.replies?channel={channel_id}&ts={thread_ts} as needed`,
|
|
46964
|
+
ja: `1. connector_slack-oauth_request \u3067 GET /conversations.list?types=public_channel,private_channel&exclude_archived=true&limit=100 \u3092\u547C\u3073\u51FA\u3057\u3001\u8A8D\u53EF\u30E6\u30FC\u30B6\u30FC\u304C\u898B\u3048\u308B\u30C1\u30E3\u30F3\u30CD\u30EB\u3092\u691C\u51FA
|
|
46965
|
+
2. \u5206\u6790\u5BFE\u8C61\u306B\u306A\u308A\u305D\u3046\u306A2\u301C3\u30C1\u30E3\u30F3\u30CD\u30EB\u306B\u3064\u3044\u3066\u3001connector_slack-oauth_request \u3067 GET /conversations.history?channel={channel_id}&limit=10 \u3092\u547C\u3073\u51FA\u3057\u3001\u76F4\u8FD1\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0
|
|
46966
|
+
3. connector_slack-oauth_request \u3067 GET /users.list?limit=100 \u3092\u547C\u3073\u51FA\u3057\u3001\u30E6\u30FC\u30B6\u30FCID\u3068\u8868\u793A\u540D\u306E\u5BFE\u5FDC\u3092\u53D6\u5F97
|
|
46967
|
+
4. \u5FC5\u8981\u306B\u5FDC\u3058\u3066 GET /conversations.replies?channel={channel_id}&ts={thread_ts} \u3067\u30B9\u30EC\u30C3\u30C9\u3092\u63A2\u7D22`
|
|
46968
|
+
}
|
|
46969
|
+
});
|
|
46970
|
+
|
|
46971
|
+
// ../connectors/src/connectors/slack/parameters.ts
|
|
46972
|
+
var parameters87 = {};
|
|
46973
|
+
|
|
46974
|
+
// ../connectors/src/connectors/slack/index.ts
|
|
46975
|
+
var tools87 = { request: requestTool60 };
|
|
46976
|
+
var slackConnector = new ConnectorPlugin({
|
|
46977
|
+
slug: "slack",
|
|
46978
|
+
authType: AUTH_TYPES.OAUTH,
|
|
46979
|
+
skipConnectionCheckOnCreate: true,
|
|
46980
|
+
name: "Slack",
|
|
46981
|
+
description: "Connect to Slack to analyze channel messages and threads using OAuth. Reads run with the authorizing user's permissions.",
|
|
46982
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/75UXS4Ll04liDJiPYKb7gN/eccc8a5e9700174685f7aa3cb23f2830/2111615.png",
|
|
46983
|
+
parameters: parameters87,
|
|
46984
|
+
releaseFlag: { dev1: true, dev2: true, prod: false },
|
|
46985
|
+
categories: ["productivity"],
|
|
46986
|
+
onboarding: slackOnboarding,
|
|
46987
|
+
proxyPolicy: {
|
|
46988
|
+
allowlist: [
|
|
46989
|
+
{
|
|
46990
|
+
host: "slack.com",
|
|
46991
|
+
methods: ["GET", "POST"]
|
|
46992
|
+
}
|
|
46993
|
+
]
|
|
46994
|
+
},
|
|
46995
|
+
systemPrompt: {
|
|
46996
|
+
en: `### Tools
|
|
46997
|
+
|
|
46998
|
+
- \`connector_slack-oauth_request\`: The only way to call the Slack Web API. Use it to list channels, read channel message history, read thread replies, and resolve user names. Authentication is configured automatically via OAuth with the authorizing user's token \u2014 results reflect what that user can see in Slack (public channels plus private channels they are a member of). Pagination is cursor-based: pass \`cursor\` from \`response_metadata.next_cursor\`.
|
|
46999
|
+
|
|
47000
|
+
### Slack Web API Reference
|
|
47001
|
+
|
|
47002
|
+
#### Available Endpoints
|
|
47003
|
+
- GET \`/conversations.list?types=public_channel,private_channel&exclude_archived=true&limit=200\` \u2014 List channels visible to the user. Returns \`channels[]\` with \`id\`, \`name\`, \`is_private\`
|
|
47004
|
+
- GET \`/conversations.history?channel={id}&limit=50\` \u2014 Channel messages, newest first. Optional: \`oldest\` / \`latest\` (Unix epoch seconds as strings), \`cursor\`. Returns \`messages[]\` with \`user\`, \`ts\`, \`text\`, \`thread_ts\`, \`reply_count\`
|
|
47005
|
+
- GET \`/conversations.replies?channel={id}&ts={thread_ts}&limit=50\` \u2014 Messages in a thread (the parent message's \`ts\` is the \`thread_ts\`)
|
|
47006
|
+
- GET \`/users.list?limit=200\` \u2014 Workspace members. Returns \`members[]\` with \`id\`, \`name\`, \`real_name\`, \`profile.display_name\`
|
|
47007
|
+
- GET \`/users.info?user={id}\` \u2014 Single user detail
|
|
47008
|
+
- POST \`/auth.test\` \u2014 Verify the connection; returns the authorizing user and workspace
|
|
47009
|
+
|
|
47010
|
+
### Tips
|
|
47011
|
+
- Message \`ts\` values are Unix epoch seconds as strings (e.g. "1712345678.000200") and double as message IDs; convert for date filtering via \`oldest\`/\`latest\`
|
|
47012
|
+
- Messages reference users by ID (e.g. "U0123456789") \u2014 resolve display names via /users.list before presenting results
|
|
47013
|
+
- A message with \`thread_ts\` equal to its \`ts\` is a thread parent; fetch the thread with /conversations.replies
|
|
47014
|
+
- Respect rate limits: prefer \`limit\` + date bounds over paging through entire channel histories
|
|
47015
|
+
|
|
47016
|
+
### Business Logic
|
|
47017
|
+
|
|
47018
|
+
The business logic type for this connector is "typescript". Write handler code using the connector SDK shown below. Do NOT access credentials directly from environment variables.
|
|
47019
|
+
|
|
47020
|
+
#### Example
|
|
47021
|
+
|
|
47022
|
+
\`\`\`ts
|
|
47023
|
+
import { connection } from "@squadbase/vite-server/connectors/slack";
|
|
47024
|
+
|
|
47025
|
+
const slack = connection("<connectionId>");
|
|
47026
|
+
|
|
47027
|
+
// Authenticated fetch (returns standard Response)
|
|
47028
|
+
const res = await slack.request(
|
|
47029
|
+
"/conversations.history?channel=C0123456789&limit=50",
|
|
47030
|
+
);
|
|
47031
|
+
const data = await res.json();
|
|
47032
|
+
if (!data.ok) throw new Error(data.error);
|
|
47033
|
+
\`\`\``,
|
|
47034
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
47035
|
+
|
|
47036
|
+
- \`connector_slack-oauth_request\`: Slack Web API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30C1\u30E3\u30F3\u30CD\u30EB\u4E00\u89A7\u306E\u53D6\u5F97\u3001\u30C1\u30E3\u30F3\u30CD\u30EB\u30E1\u30C3\u30BB\u30FC\u30B8\u5C65\u6B74\u306E\u8AAD\u307F\u53D6\u308A\u3001\u30B9\u30EC\u30C3\u30C9\u8FD4\u4FE1\u306E\u8AAD\u307F\u53D6\u308A\u3001\u30E6\u30FC\u30B6\u30FC\u540D\u306E\u89E3\u6C7A\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\u306F\u8A8D\u53EF\u3057\u305F\u30E6\u30FC\u30B6\u30FC\u306E\u30C8\u30FC\u30AF\u30F3\u306B\u3088\u308BOAuth\u7D4C\u7531\u3067\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u3001\u7D50\u679C\u306F\u305D\u306E\u30E6\u30FC\u30B6\u30FC\u304CSlack\u3067\u898B\u3048\u308B\u7BC4\u56F2\uFF08public\u30C1\u30E3\u30F3\u30CD\u30EB\u3068\u3001\u53C2\u52A0\u3057\u3066\u3044\u308Bprivate\u30C1\u30E3\u30F3\u30CD\u30EB\uFF09\u3092\u53CD\u6620\u3057\u307E\u3059\u3002\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u306F \`response_metadata.next_cursor\` \u306E\u5024\u3092 \`cursor\` \u306B\u6E21\u3059\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u3067\u3059\u3002
|
|
47037
|
+
|
|
47038
|
+
### Slack Web API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
47039
|
+
|
|
47040
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
47041
|
+
- GET \`/conversations.list?types=public_channel,private_channel&exclude_archived=true&limit=200\` \u2014 \u30E6\u30FC\u30B6\u30FC\u304C\u898B\u3048\u308B\u30C1\u30E3\u30F3\u30CD\u30EB\u4E00\u89A7\u3002\`channels[]\`\uFF08\`id\`, \`name\`, \`is_private\`\uFF09\u3092\u8FD4\u3059
|
|
47042
|
+
- GET \`/conversations.history?channel={id}&limit=50\` \u2014 \u30C1\u30E3\u30F3\u30CD\u30EB\u30E1\u30C3\u30BB\u30FC\u30B8\uFF08\u65B0\u3057\u3044\u9806\uFF09\u3002\u30AA\u30D7\u30B7\u30E7\u30F3: \`oldest\` / \`latest\`\uFF08Unix epoch\u79D2\u306E\u6587\u5B57\u5217\uFF09, \`cursor\`\u3002\`messages[]\`\uFF08\`user\`, \`ts\`, \`text\`, \`thread_ts\`, \`reply_count\`\uFF09\u3092\u8FD4\u3059
|
|
47043
|
+
- GET \`/conversations.replies?channel={id}&ts={thread_ts}&limit=50\` \u2014 \u30B9\u30EC\u30C3\u30C9\u5185\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\uFF08\u89AA\u30E1\u30C3\u30BB\u30FC\u30B8\u306E \`ts\` \u304C \`thread_ts\`\uFF09
|
|
47044
|
+
- GET \`/users.list?limit=200\` \u2014 \u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u30E1\u30F3\u30D0\u30FC\u3002\`members[]\`\uFF08\`id\`, \`name\`, \`real_name\`, \`profile.display_name\`\uFF09\u3092\u8FD4\u3059
|
|
47045
|
+
- GET \`/users.info?user={id}\` \u2014 \u5358\u4E00\u30E6\u30FC\u30B6\u30FC\u306E\u8A73\u7D30
|
|
47046
|
+
- POST \`/auth.test\` \u2014 \u63A5\u7D9A\u78BA\u8A8D\u3002\u8A8D\u53EF\u30E6\u30FC\u30B6\u30FC\u3068\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u3092\u8FD4\u3059
|
|
47047
|
+
|
|
47048
|
+
### \u30D2\u30F3\u30C8
|
|
47049
|
+
- \u30E1\u30C3\u30BB\u30FC\u30B8\u306E \`ts\` \u306FUnix epoch\u79D2\u306E\u6587\u5B57\u5217\uFF08\u4F8B: "1712345678.000200"\uFF09\u3067\u30E1\u30C3\u30BB\u30FC\u30B8ID\u3092\u517C\u306D\u307E\u3059\u3002\u65E5\u4ED8\u30D5\u30A3\u30EB\u30BF\u306F \`oldest\`/\`latest\` \u306B\u5909\u63DB\u3057\u3066\u6E21\u3057\u307E\u3059
|
|
47050
|
+
- \u30E1\u30C3\u30BB\u30FC\u30B8\u5185\u306E\u30E6\u30FC\u30B6\u30FC\u306FID\uFF08\u4F8B: "U0123456789"\uFF09\u3067\u53C2\u7167\u3055\u308C\u308B\u305F\u3081\u3001\u7D50\u679C\u3092\u63D0\u793A\u3059\u308B\u524D\u306B /users.list \u3067\u8868\u793A\u540D\u3092\u89E3\u6C7A\u3057\u3066\u304F\u3060\u3055\u3044
|
|
47051
|
+
- \`thread_ts\` \u304C\u81EA\u8EAB\u306E \`ts\` \u3068\u7B49\u3057\u3044\u30E1\u30C3\u30BB\u30FC\u30B8\u306F\u30B9\u30EC\u30C3\u30C9\u306E\u89AA\u3067\u3059\u3002/conversations.replies \u3067\u30B9\u30EC\u30C3\u30C9\u3092\u53D6\u5F97\u3067\u304D\u307E\u3059
|
|
47052
|
+
- \u30EC\u30FC\u30C8\u30EA\u30DF\u30C3\u30C8\u306B\u914D\u616E\u3057\u3001\u30C1\u30E3\u30F3\u30CD\u30EB\u5C65\u6B74\u5168\u4F53\u306E\u30DA\u30FC\u30B8\u30F3\u30B0\u3088\u308A \`limit\` + \u671F\u9593\u6307\u5B9A\u3092\u512A\u5148\u3057\u3066\u304F\u3060\u3055\u3044
|
|
47053
|
+
|
|
47054
|
+
### Business Logic
|
|
47055
|
+
|
|
47056
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
47057
|
+
|
|
47058
|
+
#### Example
|
|
47059
|
+
|
|
47060
|
+
\`\`\`ts
|
|
47061
|
+
import { connection } from "@squadbase/vite-server/connectors/slack";
|
|
47062
|
+
|
|
47063
|
+
const slack = connection("<connectionId>");
|
|
47064
|
+
|
|
47065
|
+
// Authenticated fetch (returns standard Response)
|
|
47066
|
+
const res = await slack.request(
|
|
47067
|
+
"/conversations.history?channel=C0123456789&limit=50",
|
|
47068
|
+
);
|
|
47069
|
+
const data = await res.json();
|
|
47070
|
+
if (!data.ok) throw new Error(data.error);
|
|
47071
|
+
\`\`\``
|
|
47072
|
+
},
|
|
47073
|
+
tools: tools87,
|
|
47074
|
+
async checkConnection(_params, config) {
|
|
47075
|
+
const { proxyFetch } = config;
|
|
47076
|
+
try {
|
|
47077
|
+
const res = await proxyFetch("https://slack.com/api/auth.test", {
|
|
47078
|
+
method: "POST"
|
|
47079
|
+
});
|
|
47080
|
+
if (!res.ok) {
|
|
47081
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
47082
|
+
return {
|
|
47083
|
+
success: false,
|
|
47084
|
+
error: `Slack API failed: HTTP ${res.status} ${errorText}`
|
|
47085
|
+
};
|
|
47086
|
+
}
|
|
47087
|
+
const data = await res.json();
|
|
47088
|
+
if (data.ok !== true) {
|
|
47089
|
+
return {
|
|
47090
|
+
success: false,
|
|
47091
|
+
error: `Slack auth.test failed: ${data.error ?? "unknown error"}`
|
|
47092
|
+
};
|
|
47093
|
+
}
|
|
47094
|
+
return { success: true };
|
|
47095
|
+
} catch (error) {
|
|
47096
|
+
return {
|
|
47097
|
+
success: false,
|
|
47098
|
+
error: error instanceof Error ? error.message : String(error)
|
|
47099
|
+
};
|
|
47100
|
+
}
|
|
47101
|
+
}
|
|
47102
|
+
});
|
|
47103
|
+
|
|
46821
47104
|
// ../connectors/src/connectors/registry.ts
|
|
46822
47105
|
var plugins = {
|
|
46823
47106
|
snowflake: snowflakeConnector,
|
|
@@ -46905,7 +47188,8 @@ var plugins = {
|
|
|
46905
47188
|
tableau: tableauConnector,
|
|
46906
47189
|
outlookOauth: outlookOauthConnector,
|
|
46907
47190
|
x: xConnector,
|
|
46908
|
-
hackerNews: hackerNewsConnector
|
|
47191
|
+
hackerNews: hackerNewsConnector,
|
|
47192
|
+
slack: slackConnector
|
|
46909
47193
|
};
|
|
46910
47194
|
var connectors = {
|
|
46911
47195
|
...plugins,
|
|
@@ -47152,62 +47436,62 @@ import { watch as fsWatch2 } from "fs";
|
|
|
47152
47436
|
import path2 from "path";
|
|
47153
47437
|
|
|
47154
47438
|
// src/types/server-logic.ts
|
|
47155
|
-
import { z as
|
|
47156
|
-
var parameterMetaSchema =
|
|
47157
|
-
name:
|
|
47158
|
-
type:
|
|
47159
|
-
description:
|
|
47160
|
-
required:
|
|
47161
|
-
default:
|
|
47162
|
-
});
|
|
47163
|
-
var serverLogicCacheConfigSchema =
|
|
47164
|
-
ttl:
|
|
47165
|
-
staleWhileRevalidate:
|
|
47166
|
-
});
|
|
47167
|
-
var serverLogicSchemaObjectSchema =
|
|
47168
|
-
() =>
|
|
47169
|
-
type:
|
|
47170
|
-
format:
|
|
47171
|
-
description:
|
|
47172
|
-
nullable:
|
|
47173
|
-
enum:
|
|
47439
|
+
import { z as z106 } from "zod";
|
|
47440
|
+
var parameterMetaSchema = z106.object({
|
|
47441
|
+
name: z106.string(),
|
|
47442
|
+
type: z106.enum(["string", "number", "boolean"]),
|
|
47443
|
+
description: z106.string(),
|
|
47444
|
+
required: z106.boolean().optional(),
|
|
47445
|
+
default: z106.union([z106.string(), z106.number(), z106.boolean()]).optional()
|
|
47446
|
+
});
|
|
47447
|
+
var serverLogicCacheConfigSchema = z106.object({
|
|
47448
|
+
ttl: z106.number(),
|
|
47449
|
+
staleWhileRevalidate: z106.boolean().optional()
|
|
47450
|
+
});
|
|
47451
|
+
var serverLogicSchemaObjectSchema = z106.lazy(
|
|
47452
|
+
() => z106.object({
|
|
47453
|
+
type: z106.enum(["string", "number", "integer", "boolean", "object", "array", "null"]).optional(),
|
|
47454
|
+
format: z106.string().optional(),
|
|
47455
|
+
description: z106.string().optional(),
|
|
47456
|
+
nullable: z106.boolean().optional(),
|
|
47457
|
+
enum: z106.array(z106.union([z106.string(), z106.number(), z106.boolean(), z106.null()])).optional(),
|
|
47174
47458
|
items: serverLogicSchemaObjectSchema.optional(),
|
|
47175
|
-
properties:
|
|
47176
|
-
required:
|
|
47177
|
-
additionalProperties:
|
|
47178
|
-
minimum:
|
|
47179
|
-
maximum:
|
|
47180
|
-
minLength:
|
|
47181
|
-
maxLength:
|
|
47182
|
-
pattern:
|
|
47459
|
+
properties: z106.record(z106.string(), serverLogicSchemaObjectSchema).optional(),
|
|
47460
|
+
required: z106.array(z106.string()).optional(),
|
|
47461
|
+
additionalProperties: z106.union([z106.boolean(), serverLogicSchemaObjectSchema]).optional(),
|
|
47462
|
+
minimum: z106.number().optional(),
|
|
47463
|
+
maximum: z106.number().optional(),
|
|
47464
|
+
minLength: z106.number().optional(),
|
|
47465
|
+
maxLength: z106.number().optional(),
|
|
47466
|
+
pattern: z106.string().optional()
|
|
47183
47467
|
})
|
|
47184
47468
|
);
|
|
47185
|
-
var serverLogicMediaTypeSchema =
|
|
47469
|
+
var serverLogicMediaTypeSchema = z106.object({
|
|
47186
47470
|
schema: serverLogicSchemaObjectSchema.optional(),
|
|
47187
|
-
example:
|
|
47471
|
+
example: z106.unknown().optional()
|
|
47188
47472
|
});
|
|
47189
|
-
var serverLogicResponseSchema =
|
|
47190
|
-
description:
|
|
47191
|
-
content:
|
|
47473
|
+
var serverLogicResponseSchema = z106.object({
|
|
47474
|
+
description: z106.string().optional(),
|
|
47475
|
+
content: z106.record(z106.string(), serverLogicMediaTypeSchema).optional()
|
|
47192
47476
|
});
|
|
47193
47477
|
var jsonBaseFields = {
|
|
47194
|
-
description:
|
|
47195
|
-
parameters:
|
|
47478
|
+
description: z106.string(),
|
|
47479
|
+
parameters: z106.array(parameterMetaSchema).optional(),
|
|
47196
47480
|
response: serverLogicResponseSchema.optional(),
|
|
47197
47481
|
cache: serverLogicCacheConfigSchema.optional()
|
|
47198
47482
|
};
|
|
47199
|
-
var jsonSqlServerLogicSchema =
|
|
47483
|
+
var jsonSqlServerLogicSchema = z106.object({
|
|
47200
47484
|
...jsonBaseFields,
|
|
47201
|
-
type:
|
|
47202
|
-
query:
|
|
47203
|
-
connectionId:
|
|
47485
|
+
type: z106.literal("sql").optional(),
|
|
47486
|
+
query: z106.string(),
|
|
47487
|
+
connectionId: z106.string()
|
|
47204
47488
|
});
|
|
47205
|
-
var jsonTypeScriptServerLogicSchema =
|
|
47489
|
+
var jsonTypeScriptServerLogicSchema = z106.object({
|
|
47206
47490
|
...jsonBaseFields,
|
|
47207
|
-
type:
|
|
47208
|
-
handlerPath:
|
|
47491
|
+
type: z106.literal("typescript"),
|
|
47492
|
+
handlerPath: z106.string()
|
|
47209
47493
|
});
|
|
47210
|
-
var anyJsonServerLogicSchema =
|
|
47494
|
+
var anyJsonServerLogicSchema = z106.union([
|
|
47211
47495
|
jsonTypeScriptServerLogicSchema,
|
|
47212
47496
|
jsonSqlServerLogicSchema
|
|
47213
47497
|
]);
|
|
@@ -1089,7 +1089,7 @@ var googleAnalyticsOauthConnector = new ConnectorPlugin({
|
|
|
1089
1089
|
description: "Connect to Google Analytics for web analytics and reporting using OAuth.",
|
|
1090
1090
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/7fs0ipzxuD9mACDzBATtxX/3c53ed90d15c96483e4f78cb29dab5e9/google-analytics.svg",
|
|
1091
1091
|
parameters,
|
|
1092
|
-
releaseFlag: { dev1: true, dev2:
|
|
1092
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
1093
1093
|
categories: ["marketing"],
|
|
1094
1094
|
onboarding: googleAnalyticsOauthOnboarding,
|
|
1095
1095
|
proxyPolicy: {
|
|
@@ -839,7 +839,7 @@ var googleCalendarOauthConnector = new ConnectorPlugin({
|
|
|
839
839
|
description: "Connect to Google Calendar for calendar and event data access using OAuth.",
|
|
840
840
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2YsqoBEpdELmfDeFcyGHyE/4494c633b5ae15e562cb739cd85442c1/google-calendar.png",
|
|
841
841
|
parameters,
|
|
842
|
-
releaseFlag: { dev1: true, dev2:
|
|
842
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
843
843
|
categories: ["productivity"],
|
|
844
844
|
onboarding: googleCalendarOauthOnboarding,
|
|
845
845
|
proxyPolicy: {
|
|
@@ -595,7 +595,7 @@ var hackerNewsConnector = new ConnectorPlugin({
|
|
|
595
595
|
description: "Connect to public Hacker News data using the official Firebase API, with optional Algolia-powered search when needed.",
|
|
596
596
|
iconUrl: "https://news.ycombinator.com/y18.svg",
|
|
597
597
|
parameters,
|
|
598
|
-
releaseFlag: { dev1: true, dev2: true, prod:
|
|
598
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
599
599
|
categories: ["scraping"],
|
|
600
600
|
onboarding: hackerNewsOnboarding,
|
|
601
601
|
systemPrompt: {
|