@mastra/slack 0.1.0 → 1.0.0
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/index.js +8 -0
- package/dist/slack/src/apis/create-new-channel.d.ts +9 -0
- package/dist/slack/src/apis/invite-to-channel.d.ts +9 -0
- package/dist/slack/src/apis/send-message-to-channel.d.ts +9 -0
- package/dist/slack/src/client.d.ts +26 -0
- package/dist/slack/src/constants.d.ts +1 -0
- package/dist/slack/src/index.d.ts +30 -0
- package/dist/slack/src/schemas.d.ts +38 -0
- package/dist/slack/src/types.d.ts +3 -0
- package/dist/slack.cjs.development.js +1046 -0
- package/dist/slack.cjs.development.js.map +1 -0
- package/dist/slack.cjs.production.min.js +2 -0
- package/dist/slack.cjs.production.min.js.map +1 -0
- package/dist/slack.esm.js +1042 -0
- package/dist/slack.esm.js.map +1 -0
- package/package.json +2 -2
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DataLayer, IntegrationApi } from '@mastra/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { CREATE_NEW_CHANNEL_SCHEMA, CREATE_NEW_CHANNEL_OUTPUT_SCHEMA } from '../schemas';
|
|
4
|
+
import { MakeClient } from '../types';
|
|
5
|
+
export declare const CREATE_NEW_CHANNEL: ({ name, makeClient, }: {
|
|
6
|
+
name: string;
|
|
7
|
+
dataAccess: DataLayer;
|
|
8
|
+
makeClient: MakeClient;
|
|
9
|
+
}) => IntegrationApi<z.infer<typeof CREATE_NEW_CHANNEL_SCHEMA>, z.infer<typeof CREATE_NEW_CHANNEL_OUTPUT_SCHEMA>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DataLayer, IntegrationApi } from '@mastra/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { INVITE_TO_CHANNEL_SCHEMA } from '../schemas';
|
|
4
|
+
import { MakeClient } from '../types';
|
|
5
|
+
export declare const INVITE_TO_CHANNEL: ({ name, makeClient, }: {
|
|
6
|
+
name: string;
|
|
7
|
+
dataAccess: DataLayer;
|
|
8
|
+
makeClient: MakeClient;
|
|
9
|
+
}) => IntegrationApi<z.infer<typeof INVITE_TO_CHANNEL_SCHEMA>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DataLayer, IntegrationApi } from '@mastra/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { SEND_MESSAGE_TO_CHANNEL_SCHEMA } from '../schemas';
|
|
4
|
+
import { MakeClient } from '../types';
|
|
5
|
+
export declare const SEND_MESSAGE_TO_CHANNEL: ({ name, dataAccess, makeClient, }: {
|
|
6
|
+
name: string;
|
|
7
|
+
dataAccess: DataLayer;
|
|
8
|
+
makeClient: MakeClient;
|
|
9
|
+
}) => IntegrationApi<z.infer<typeof SEND_MESSAGE_TO_CHANNEL_SCHEMA>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare class SlackClient {
|
|
2
|
+
private token;
|
|
3
|
+
private client;
|
|
4
|
+
constructor({ token }: {
|
|
5
|
+
token: string;
|
|
6
|
+
});
|
|
7
|
+
getAllChannels(): Promise<import("@slack/web-api/dist/types/response/ConversationsListResponse").Channel[] | undefined>;
|
|
8
|
+
channelByName(channelName: string): Promise<import("@slack/web-api/dist/types/response/ConversationsListResponse").Channel | undefined>;
|
|
9
|
+
getActiveUsers(): Promise<import("@slack/web-api/dist/types/response/UsersListResponse").Member[] | undefined>;
|
|
10
|
+
userIdsByNames(names: string[]): Promise<(string | undefined)[] | undefined>;
|
|
11
|
+
sendMessage({ channelId, message }: {
|
|
12
|
+
channelId: string;
|
|
13
|
+
message: string;
|
|
14
|
+
}): Promise<import("@slack/web-api").ChatPostMessageResponse>;
|
|
15
|
+
invite({ channelId, users }: {
|
|
16
|
+
channelId: string;
|
|
17
|
+
users: string[];
|
|
18
|
+
}): Promise<import("@slack/web-api").ConversationsInviteResponse>;
|
|
19
|
+
createChannel({ name, isPrivate }: {
|
|
20
|
+
name: string;
|
|
21
|
+
isPrivate: boolean;
|
|
22
|
+
}): Promise<import("@slack/web-api").ConversationsCreateResponse>;
|
|
23
|
+
joinChannel({ channelId }: {
|
|
24
|
+
channelId: string;
|
|
25
|
+
}): Promise<import("@slack/web-api").ConversationsJoinResponse>;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SLACK_INTEGRATION_NAME = "SLACK";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Connection, IntegrationApi, IntegrationAuth, Integration } from '@mastra/core';
|
|
2
|
+
import { SlackClient } from './client';
|
|
3
|
+
type SlackConfig = {
|
|
4
|
+
CLIENT_ID: string;
|
|
5
|
+
CLIENT_SECRET: string;
|
|
6
|
+
SCOPES: string[];
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
};
|
|
9
|
+
export declare class SlackIntegration extends Integration<SlackClient> {
|
|
10
|
+
config: SlackConfig;
|
|
11
|
+
availableScopes: {
|
|
12
|
+
key: string;
|
|
13
|
+
description: string;
|
|
14
|
+
}[];
|
|
15
|
+
constructor({ config }: {
|
|
16
|
+
config: SlackConfig;
|
|
17
|
+
});
|
|
18
|
+
makeClient: ({ connectionId }: {
|
|
19
|
+
connectionId: string;
|
|
20
|
+
}) => Promise<SlackClient>;
|
|
21
|
+
registerApis(): Record<string, IntegrationApi<any>>;
|
|
22
|
+
onConnectionCreated({ connection }: {
|
|
23
|
+
connection: Connection;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
onDisconnect({ connectionId }: {
|
|
26
|
+
connectionId: string;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
getAuthenticator(): IntegrationAuth;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SEND_MESSAGE_TO_CHANNEL_SCHEMA: z.ZodObject<{
|
|
3
|
+
channelId: z.ZodString;
|
|
4
|
+
message: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
channelId: string;
|
|
7
|
+
message: string;
|
|
8
|
+
}, {
|
|
9
|
+
channelId: string;
|
|
10
|
+
message: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const CREATE_NEW_CHANNEL_SCHEMA: z.ZodObject<{
|
|
13
|
+
channelName: z.ZodString;
|
|
14
|
+
isPrivate: z.ZodEnum<["true", "false"]>;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
channelName: string;
|
|
17
|
+
isPrivate: "true" | "false";
|
|
18
|
+
}, {
|
|
19
|
+
channelName: string;
|
|
20
|
+
isPrivate: "true" | "false";
|
|
21
|
+
}>;
|
|
22
|
+
export declare const CREATE_NEW_CHANNEL_OUTPUT_SCHEMA: z.ZodObject<{
|
|
23
|
+
channelId: z.ZodNullable<z.ZodString>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
channelId: string | null;
|
|
26
|
+
}, {
|
|
27
|
+
channelId: string | null;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const INVITE_TO_CHANNEL_SCHEMA: z.ZodObject<{
|
|
30
|
+
channelId: z.ZodString;
|
|
31
|
+
users: z.ZodArray<z.ZodString, "many">;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
channelId: string;
|
|
34
|
+
users: string[];
|
|
35
|
+
}, {
|
|
36
|
+
channelId: string;
|
|
37
|
+
users: string[];
|
|
38
|
+
}>;
|