@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/index.js
CHANGED
|
@@ -3828,9 +3828,9 @@ var tidbConnector = new ConnectorPlugin({
|
|
|
3828
3828
|
authType: AUTH_TYPES.USER_PASSWORD,
|
|
3829
3829
|
name: "TiDB",
|
|
3830
3830
|
description: "Connect to TiDB (MySQL-compatible distributed SQL database, incl. TiDB Cloud Serverless/Dedicated) for relational data storage and querying.",
|
|
3831
|
-
iconUrl: "https://
|
|
3831
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/38VhfLEd1t6rkEca5Nls8o/6d6f9ca6dc83b89e8f807661317515bc/69240164.png",
|
|
3832
3832
|
parameters: parameters6,
|
|
3833
|
-
releaseFlag: { dev1: true, dev2:
|
|
3833
|
+
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
3834
3834
|
categories: ["database"],
|
|
3835
3835
|
onboarding: tidbOnboarding,
|
|
3836
3836
|
systemPrompt: {
|
|
@@ -10949,7 +10949,7 @@ var googleAnalyticsOauthConnector = new ConnectorPlugin({
|
|
|
10949
10949
|
description: "Connect to Google Analytics for web analytics and reporting using OAuth.",
|
|
10950
10950
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/7fs0ipzxuD9mACDzBATtxX/3c53ed90d15c96483e4f78cb29dab5e9/google-analytics.svg",
|
|
10951
10951
|
parameters: parameters16,
|
|
10952
|
-
releaseFlag: { dev1: true, dev2:
|
|
10952
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
10953
10953
|
categories: ["marketing"],
|
|
10954
10954
|
onboarding: googleAnalyticsOauthOnboarding,
|
|
10955
10955
|
proxyPolicy: {
|
|
@@ -12540,7 +12540,7 @@ var googleCalendarOauthConnector = new ConnectorPlugin({
|
|
|
12540
12540
|
description: "Connect to Google Calendar for calendar and event data access using OAuth.",
|
|
12541
12541
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2YsqoBEpdELmfDeFcyGHyE/4494c633b5ae15e562cb739cd85442c1/google-calendar.png",
|
|
12542
12542
|
parameters: parameters18,
|
|
12543
|
-
releaseFlag: { dev1: true, dev2:
|
|
12543
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
12544
12544
|
categories: ["productivity"],
|
|
12545
12545
|
onboarding: googleCalendarOauthOnboarding,
|
|
12546
12546
|
proxyPolicy: {
|
|
@@ -46193,7 +46193,7 @@ var xConnector = new ConnectorPlugin({
|
|
|
46193
46193
|
description: "Connect to X API v2 for posts, users, search, timelines, trends, and related social media data using a user-provided Bearer Token.",
|
|
46194
46194
|
iconUrl: "https://cdn.simpleicons.org/x/000000",
|
|
46195
46195
|
parameters: parameters85,
|
|
46196
|
-
releaseFlag: { dev1: true, dev2: true, prod:
|
|
46196
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
46197
46197
|
categories: ["social_media"],
|
|
46198
46198
|
onboarding: xOnboarding,
|
|
46199
46199
|
systemPrompt: {
|
|
@@ -46608,7 +46608,7 @@ var hackerNewsConnector = new ConnectorPlugin({
|
|
|
46608
46608
|
description: "Connect to public Hacker News data using the official Firebase API, with optional Algolia-powered search when needed.",
|
|
46609
46609
|
iconUrl: "https://news.ycombinator.com/y18.svg",
|
|
46610
46610
|
parameters: parameters86,
|
|
46611
|
-
releaseFlag: { dev1: true, dev2: true, prod:
|
|
46611
|
+
releaseFlag: { dev1: true, dev2: true, prod: true },
|
|
46612
46612
|
categories: ["scraping"],
|
|
46613
46613
|
onboarding: hackerNewsOnboarding,
|
|
46614
46614
|
systemPrompt: {
|
|
@@ -46753,6 +46753,289 @@ export default async function handler(c: Context) {
|
|
|
46753
46753
|
}
|
|
46754
46754
|
});
|
|
46755
46755
|
|
|
46756
|
+
// ../connectors/src/connectors/slack/tools/request.ts
|
|
46757
|
+
import { z as z105 } from "zod";
|
|
46758
|
+
var BASE_URL70 = "https://slack.com/api";
|
|
46759
|
+
var REQUEST_TIMEOUT_MS80 = 6e4;
|
|
46760
|
+
var cachedToken35 = null;
|
|
46761
|
+
async function getProxyToken35(config) {
|
|
46762
|
+
if (cachedToken35 && cachedToken35.expiresAt > Date.now() + 6e4) {
|
|
46763
|
+
return cachedToken35.token;
|
|
46764
|
+
}
|
|
46765
|
+
const url = `${config.appApiBaseUrl}/v0/database/${config.projectId}/environment/${config.environmentId}/oauth-request-proxy-token`;
|
|
46766
|
+
const res = await fetch(url, {
|
|
46767
|
+
method: "POST",
|
|
46768
|
+
headers: {
|
|
46769
|
+
"Content-Type": "application/json",
|
|
46770
|
+
"x-api-key": config.appApiKey,
|
|
46771
|
+
"project-id": config.projectId
|
|
46772
|
+
},
|
|
46773
|
+
body: JSON.stringify({
|
|
46774
|
+
sandboxId: config.sandboxId,
|
|
46775
|
+
issuedBy: "coding-agent"
|
|
46776
|
+
})
|
|
46777
|
+
});
|
|
46778
|
+
if (!res.ok) {
|
|
46779
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
46780
|
+
throw new Error(
|
|
46781
|
+
`Failed to get proxy token: HTTP ${res.status} ${errorText}`
|
|
46782
|
+
);
|
|
46783
|
+
}
|
|
46784
|
+
const data = await res.json();
|
|
46785
|
+
cachedToken35 = {
|
|
46786
|
+
token: data.token,
|
|
46787
|
+
expiresAt: new Date(data.expiresAt).getTime()
|
|
46788
|
+
};
|
|
46789
|
+
return data.token;
|
|
46790
|
+
}
|
|
46791
|
+
var inputSchema105 = z105.object({
|
|
46792
|
+
toolUseIntent: z105.string().optional().describe(
|
|
46793
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
46794
|
+
),
|
|
46795
|
+
connectionId: z105.string().describe("ID of the Slack connection to use"),
|
|
46796
|
+
method: z105.enum(["GET", "POST"]).describe("HTTP method"),
|
|
46797
|
+
path: z105.string().describe(
|
|
46798
|
+
"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')"
|
|
46799
|
+
),
|
|
46800
|
+
body: z105.record(z105.string(), z105.unknown()).optional().describe("Request body (JSON) for POST requests")
|
|
46801
|
+
});
|
|
46802
|
+
var outputSchema105 = z105.discriminatedUnion("success", [
|
|
46803
|
+
z105.object({
|
|
46804
|
+
success: z105.literal(true),
|
|
46805
|
+
status: z105.number(),
|
|
46806
|
+
data: z105.record(z105.string(), z105.unknown())
|
|
46807
|
+
}),
|
|
46808
|
+
z105.object({
|
|
46809
|
+
success: z105.literal(false),
|
|
46810
|
+
error: z105.string()
|
|
46811
|
+
})
|
|
46812
|
+
]);
|
|
46813
|
+
var requestTool60 = new ConnectorTool({
|
|
46814
|
+
name: "request",
|
|
46815
|
+
description: `Send authenticated requests to the Slack Web API.
|
|
46816
|
+
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).
|
|
46817
|
+
Use this tool for all Slack API interactions: listing channels, reading channel message history, reading thread replies, and resolving user names.
|
|
46818
|
+
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.`,
|
|
46819
|
+
inputSchema: inputSchema105,
|
|
46820
|
+
outputSchema: outputSchema105,
|
|
46821
|
+
async execute({ connectionId, method, path: path5, body }, connections, config) {
|
|
46822
|
+
const connection2 = connections.find((c) => c.id === connectionId);
|
|
46823
|
+
if (!connection2) {
|
|
46824
|
+
return {
|
|
46825
|
+
success: false,
|
|
46826
|
+
error: `Connection ${connectionId} not found`
|
|
46827
|
+
};
|
|
46828
|
+
}
|
|
46829
|
+
console.log(
|
|
46830
|
+
`[connector-request] slack/${connection2.name}: ${method} ${path5}`
|
|
46831
|
+
);
|
|
46832
|
+
try {
|
|
46833
|
+
const url = `${BASE_URL70}${path5.startsWith("/") ? "" : "/"}${path5}`;
|
|
46834
|
+
const token = await getProxyToken35(config.oauthProxy);
|
|
46835
|
+
const proxyUrl = `https://${config.oauthProxy.sandboxId}.${config.oauthProxy.previewBaseDomain}/_sqcore/connections/${connectionId}/request`;
|
|
46836
|
+
const controller = new AbortController();
|
|
46837
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS80);
|
|
46838
|
+
try {
|
|
46839
|
+
const response = await fetch(proxyUrl, {
|
|
46840
|
+
method: "POST",
|
|
46841
|
+
headers: {
|
|
46842
|
+
"Content-Type": "application/json",
|
|
46843
|
+
Authorization: `Bearer ${token}`
|
|
46844
|
+
},
|
|
46845
|
+
body: JSON.stringify({
|
|
46846
|
+
url,
|
|
46847
|
+
method,
|
|
46848
|
+
headers: method === "POST" ? { "Content-Type": "application/json; charset=utf-8" } : {},
|
|
46849
|
+
body: body ? JSON.stringify(body) : void 0
|
|
46850
|
+
}),
|
|
46851
|
+
signal: controller.signal
|
|
46852
|
+
});
|
|
46853
|
+
const data = await response.json();
|
|
46854
|
+
if (!response.ok || data.ok === false) {
|
|
46855
|
+
const errorMessage = typeof data?.error === "string" ? data.error : `HTTP ${response.status} ${response.statusText}`;
|
|
46856
|
+
return { success: false, error: errorMessage };
|
|
46857
|
+
}
|
|
46858
|
+
return { success: true, status: response.status, data };
|
|
46859
|
+
} finally {
|
|
46860
|
+
clearTimeout(timeout);
|
|
46861
|
+
}
|
|
46862
|
+
} catch (err) {
|
|
46863
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
46864
|
+
return { success: false, error: msg };
|
|
46865
|
+
}
|
|
46866
|
+
}
|
|
46867
|
+
});
|
|
46868
|
+
|
|
46869
|
+
// ../connectors/src/connectors/slack/setup.ts
|
|
46870
|
+
var requestToolName16 = `slack-oauth_${requestTool60.name}`;
|
|
46871
|
+
var slackOnboarding = new ConnectorOnboarding({
|
|
46872
|
+
connectionSetupInstructions: {
|
|
46873
|
+
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
|
|
46874
|
+
|
|
46875
|
+
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:
|
|
46876
|
+
- \`method\`: \`"POST"\`
|
|
46877
|
+
- \`path\`: \`"/auth.test"\`
|
|
46878
|
+
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
|
|
46879
|
+
|
|
46880
|
+
#### \u5236\u7D04
|
|
46881
|
+
- **\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
|
|
46882
|
+
- \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`,
|
|
46883
|
+
en: `Follow these steps to set up the Slack connection.
|
|
46884
|
+
|
|
46885
|
+
1. Call \`${requestToolName16}\` to verify the authorizing user and workspace:
|
|
46886
|
+
- \`method\`: \`"POST"\`
|
|
46887
|
+
- \`path\`: \`"/auth.test"\`
|
|
46888
|
+
2. If an error is returned, ask the user to check the OAuth connection settings
|
|
46889
|
+
|
|
46890
|
+
#### Constraints
|
|
46891
|
+
- **Do NOT read message contents during setup**. Only the auth verification request specified in the steps above is allowed
|
|
46892
|
+
- Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
|
|
46893
|
+
},
|
|
46894
|
+
dataOverviewInstructions: {
|
|
46895
|
+
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
|
|
46896
|
+
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
|
|
46897
|
+
3. Call connector_slack-oauth_request with GET /users.list?limit=100 to map user IDs to display names
|
|
46898
|
+
4. For threads worth exploring, call connector_slack-oauth_request with GET /conversations.replies?channel={channel_id}&ts={thread_ts} as needed`,
|
|
46899
|
+
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
|
|
46900
|
+
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
|
|
46901
|
+
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
|
|
46902
|
+
4. \u5FC5\u8981\u306B\u5FDC\u3058\u3066 GET /conversations.replies?channel={channel_id}&ts={thread_ts} \u3067\u30B9\u30EC\u30C3\u30C9\u3092\u63A2\u7D22`
|
|
46903
|
+
}
|
|
46904
|
+
});
|
|
46905
|
+
|
|
46906
|
+
// ../connectors/src/connectors/slack/parameters.ts
|
|
46907
|
+
var parameters87 = {};
|
|
46908
|
+
|
|
46909
|
+
// ../connectors/src/connectors/slack/index.ts
|
|
46910
|
+
var tools87 = { request: requestTool60 };
|
|
46911
|
+
var slackConnector = new ConnectorPlugin({
|
|
46912
|
+
slug: "slack",
|
|
46913
|
+
authType: AUTH_TYPES.OAUTH,
|
|
46914
|
+
skipConnectionCheckOnCreate: true,
|
|
46915
|
+
name: "Slack",
|
|
46916
|
+
description: "Connect to Slack to analyze channel messages and threads using OAuth. Reads run with the authorizing user's permissions.",
|
|
46917
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/75UXS4Ll04liDJiPYKb7gN/eccc8a5e9700174685f7aa3cb23f2830/2111615.png",
|
|
46918
|
+
parameters: parameters87,
|
|
46919
|
+
releaseFlag: { dev1: true, dev2: true, prod: false },
|
|
46920
|
+
categories: ["productivity"],
|
|
46921
|
+
onboarding: slackOnboarding,
|
|
46922
|
+
proxyPolicy: {
|
|
46923
|
+
allowlist: [
|
|
46924
|
+
{
|
|
46925
|
+
host: "slack.com",
|
|
46926
|
+
methods: ["GET", "POST"]
|
|
46927
|
+
}
|
|
46928
|
+
]
|
|
46929
|
+
},
|
|
46930
|
+
systemPrompt: {
|
|
46931
|
+
en: `### Tools
|
|
46932
|
+
|
|
46933
|
+
- \`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\`.
|
|
46934
|
+
|
|
46935
|
+
### Slack Web API Reference
|
|
46936
|
+
|
|
46937
|
+
#### Available Endpoints
|
|
46938
|
+
- 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\`
|
|
46939
|
+
- 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\`
|
|
46940
|
+
- GET \`/conversations.replies?channel={id}&ts={thread_ts}&limit=50\` \u2014 Messages in a thread (the parent message's \`ts\` is the \`thread_ts\`)
|
|
46941
|
+
- GET \`/users.list?limit=200\` \u2014 Workspace members. Returns \`members[]\` with \`id\`, \`name\`, \`real_name\`, \`profile.display_name\`
|
|
46942
|
+
- GET \`/users.info?user={id}\` \u2014 Single user detail
|
|
46943
|
+
- POST \`/auth.test\` \u2014 Verify the connection; returns the authorizing user and workspace
|
|
46944
|
+
|
|
46945
|
+
### Tips
|
|
46946
|
+
- 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\`
|
|
46947
|
+
- Messages reference users by ID (e.g. "U0123456789") \u2014 resolve display names via /users.list before presenting results
|
|
46948
|
+
- A message with \`thread_ts\` equal to its \`ts\` is a thread parent; fetch the thread with /conversations.replies
|
|
46949
|
+
- Respect rate limits: prefer \`limit\` + date bounds over paging through entire channel histories
|
|
46950
|
+
|
|
46951
|
+
### Business Logic
|
|
46952
|
+
|
|
46953
|
+
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.
|
|
46954
|
+
|
|
46955
|
+
#### Example
|
|
46956
|
+
|
|
46957
|
+
\`\`\`ts
|
|
46958
|
+
import { connection } from "@squadbase/vite-server/connectors/slack";
|
|
46959
|
+
|
|
46960
|
+
const slack = connection("<connectionId>");
|
|
46961
|
+
|
|
46962
|
+
// Authenticated fetch (returns standard Response)
|
|
46963
|
+
const res = await slack.request(
|
|
46964
|
+
"/conversations.history?channel=C0123456789&limit=50",
|
|
46965
|
+
);
|
|
46966
|
+
const data = await res.json();
|
|
46967
|
+
if (!data.ok) throw new Error(data.error);
|
|
46968
|
+
\`\`\``,
|
|
46969
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
46970
|
+
|
|
46971
|
+
- \`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
|
|
46972
|
+
|
|
46973
|
+
### Slack Web API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
46974
|
+
|
|
46975
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
46976
|
+
- 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
|
|
46977
|
+
- 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
|
|
46978
|
+
- 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
|
|
46979
|
+
- 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
|
|
46980
|
+
- GET \`/users.info?user={id}\` \u2014 \u5358\u4E00\u30E6\u30FC\u30B6\u30FC\u306E\u8A73\u7D30
|
|
46981
|
+
- 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
|
|
46982
|
+
|
|
46983
|
+
### \u30D2\u30F3\u30C8
|
|
46984
|
+
- \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
|
|
46985
|
+
- \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
|
|
46986
|
+
- \`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
|
|
46987
|
+
- \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
|
|
46988
|
+
|
|
46989
|
+
### Business Logic
|
|
46990
|
+
|
|
46991
|
+
\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
|
|
46992
|
+
|
|
46993
|
+
#### Example
|
|
46994
|
+
|
|
46995
|
+
\`\`\`ts
|
|
46996
|
+
import { connection } from "@squadbase/vite-server/connectors/slack";
|
|
46997
|
+
|
|
46998
|
+
const slack = connection("<connectionId>");
|
|
46999
|
+
|
|
47000
|
+
// Authenticated fetch (returns standard Response)
|
|
47001
|
+
const res = await slack.request(
|
|
47002
|
+
"/conversations.history?channel=C0123456789&limit=50",
|
|
47003
|
+
);
|
|
47004
|
+
const data = await res.json();
|
|
47005
|
+
if (!data.ok) throw new Error(data.error);
|
|
47006
|
+
\`\`\``
|
|
47007
|
+
},
|
|
47008
|
+
tools: tools87,
|
|
47009
|
+
async checkConnection(_params, config) {
|
|
47010
|
+
const { proxyFetch } = config;
|
|
47011
|
+
try {
|
|
47012
|
+
const res = await proxyFetch("https://slack.com/api/auth.test", {
|
|
47013
|
+
method: "POST"
|
|
47014
|
+
});
|
|
47015
|
+
if (!res.ok) {
|
|
47016
|
+
const errorText = await res.text().catch(() => res.statusText);
|
|
47017
|
+
return {
|
|
47018
|
+
success: false,
|
|
47019
|
+
error: `Slack API failed: HTTP ${res.status} ${errorText}`
|
|
47020
|
+
};
|
|
47021
|
+
}
|
|
47022
|
+
const data = await res.json();
|
|
47023
|
+
if (data.ok !== true) {
|
|
47024
|
+
return {
|
|
47025
|
+
success: false,
|
|
47026
|
+
error: `Slack auth.test failed: ${data.error ?? "unknown error"}`
|
|
47027
|
+
};
|
|
47028
|
+
}
|
|
47029
|
+
return { success: true };
|
|
47030
|
+
} catch (error) {
|
|
47031
|
+
return {
|
|
47032
|
+
success: false,
|
|
47033
|
+
error: error instanceof Error ? error.message : String(error)
|
|
47034
|
+
};
|
|
47035
|
+
}
|
|
47036
|
+
}
|
|
47037
|
+
});
|
|
47038
|
+
|
|
46756
47039
|
// ../connectors/src/connectors/registry.ts
|
|
46757
47040
|
var plugins = {
|
|
46758
47041
|
snowflake: snowflakeConnector,
|
|
@@ -46840,7 +47123,8 @@ var plugins = {
|
|
|
46840
47123
|
tableau: tableauConnector,
|
|
46841
47124
|
outlookOauth: outlookOauthConnector,
|
|
46842
47125
|
x: xConnector,
|
|
46843
|
-
hackerNews: hackerNewsConnector
|
|
47126
|
+
hackerNews: hackerNewsConnector,
|
|
47127
|
+
slack: slackConnector
|
|
46844
47128
|
};
|
|
46845
47129
|
var connectors = {
|
|
46846
47130
|
...plugins,
|
|
@@ -47338,62 +47622,62 @@ function createDbtClient(entry, slug) {
|
|
|
47338
47622
|
var { getQuery, loadConnections, reloadEnvFile, watchConnectionsFile } = createConnectorRegistry();
|
|
47339
47623
|
|
|
47340
47624
|
// src/types/server-logic.ts
|
|
47341
|
-
import { z as
|
|
47342
|
-
var parameterMetaSchema =
|
|
47343
|
-
name:
|
|
47344
|
-
type:
|
|
47345
|
-
description:
|
|
47346
|
-
required:
|
|
47347
|
-
default:
|
|
47348
|
-
});
|
|
47349
|
-
var serverLogicCacheConfigSchema =
|
|
47350
|
-
ttl:
|
|
47351
|
-
staleWhileRevalidate:
|
|
47352
|
-
});
|
|
47353
|
-
var serverLogicSchemaObjectSchema =
|
|
47354
|
-
() =>
|
|
47355
|
-
type:
|
|
47356
|
-
format:
|
|
47357
|
-
description:
|
|
47358
|
-
nullable:
|
|
47359
|
-
enum:
|
|
47625
|
+
import { z as z106 } from "zod";
|
|
47626
|
+
var parameterMetaSchema = z106.object({
|
|
47627
|
+
name: z106.string(),
|
|
47628
|
+
type: z106.enum(["string", "number", "boolean"]),
|
|
47629
|
+
description: z106.string(),
|
|
47630
|
+
required: z106.boolean().optional(),
|
|
47631
|
+
default: z106.union([z106.string(), z106.number(), z106.boolean()]).optional()
|
|
47632
|
+
});
|
|
47633
|
+
var serverLogicCacheConfigSchema = z106.object({
|
|
47634
|
+
ttl: z106.number(),
|
|
47635
|
+
staleWhileRevalidate: z106.boolean().optional()
|
|
47636
|
+
});
|
|
47637
|
+
var serverLogicSchemaObjectSchema = z106.lazy(
|
|
47638
|
+
() => z106.object({
|
|
47639
|
+
type: z106.enum(["string", "number", "integer", "boolean", "object", "array", "null"]).optional(),
|
|
47640
|
+
format: z106.string().optional(),
|
|
47641
|
+
description: z106.string().optional(),
|
|
47642
|
+
nullable: z106.boolean().optional(),
|
|
47643
|
+
enum: z106.array(z106.union([z106.string(), z106.number(), z106.boolean(), z106.null()])).optional(),
|
|
47360
47644
|
items: serverLogicSchemaObjectSchema.optional(),
|
|
47361
|
-
properties:
|
|
47362
|
-
required:
|
|
47363
|
-
additionalProperties:
|
|
47364
|
-
minimum:
|
|
47365
|
-
maximum:
|
|
47366
|
-
minLength:
|
|
47367
|
-
maxLength:
|
|
47368
|
-
pattern:
|
|
47645
|
+
properties: z106.record(z106.string(), serverLogicSchemaObjectSchema).optional(),
|
|
47646
|
+
required: z106.array(z106.string()).optional(),
|
|
47647
|
+
additionalProperties: z106.union([z106.boolean(), serverLogicSchemaObjectSchema]).optional(),
|
|
47648
|
+
minimum: z106.number().optional(),
|
|
47649
|
+
maximum: z106.number().optional(),
|
|
47650
|
+
minLength: z106.number().optional(),
|
|
47651
|
+
maxLength: z106.number().optional(),
|
|
47652
|
+
pattern: z106.string().optional()
|
|
47369
47653
|
})
|
|
47370
47654
|
);
|
|
47371
|
-
var serverLogicMediaTypeSchema =
|
|
47655
|
+
var serverLogicMediaTypeSchema = z106.object({
|
|
47372
47656
|
schema: serverLogicSchemaObjectSchema.optional(),
|
|
47373
|
-
example:
|
|
47657
|
+
example: z106.unknown().optional()
|
|
47374
47658
|
});
|
|
47375
|
-
var serverLogicResponseSchema =
|
|
47376
|
-
description:
|
|
47377
|
-
content:
|
|
47659
|
+
var serverLogicResponseSchema = z106.object({
|
|
47660
|
+
description: z106.string().optional(),
|
|
47661
|
+
content: z106.record(z106.string(), serverLogicMediaTypeSchema).optional()
|
|
47378
47662
|
});
|
|
47379
47663
|
var jsonBaseFields = {
|
|
47380
|
-
description:
|
|
47381
|
-
parameters:
|
|
47664
|
+
description: z106.string(),
|
|
47665
|
+
parameters: z106.array(parameterMetaSchema).optional(),
|
|
47382
47666
|
response: serverLogicResponseSchema.optional(),
|
|
47383
47667
|
cache: serverLogicCacheConfigSchema.optional()
|
|
47384
47668
|
};
|
|
47385
|
-
var jsonSqlServerLogicSchema =
|
|
47669
|
+
var jsonSqlServerLogicSchema = z106.object({
|
|
47386
47670
|
...jsonBaseFields,
|
|
47387
|
-
type:
|
|
47388
|
-
query:
|
|
47389
|
-
connectionId:
|
|
47671
|
+
type: z106.literal("sql").optional(),
|
|
47672
|
+
query: z106.string(),
|
|
47673
|
+
connectionId: z106.string()
|
|
47390
47674
|
});
|
|
47391
|
-
var jsonTypeScriptServerLogicSchema =
|
|
47675
|
+
var jsonTypeScriptServerLogicSchema = z106.object({
|
|
47392
47676
|
...jsonBaseFields,
|
|
47393
|
-
type:
|
|
47394
|
-
handlerPath:
|
|
47677
|
+
type: z106.literal("typescript"),
|
|
47678
|
+
handlerPath: z106.string()
|
|
47395
47679
|
});
|
|
47396
|
-
var anyJsonServerLogicSchema =
|
|
47680
|
+
var anyJsonServerLogicSchema = z106.union([
|
|
47397
47681
|
jsonTypeScriptServerLogicSchema,
|
|
47398
47682
|
jsonSqlServerLogicSchema
|
|
47399
47683
|
]);
|