@credal/actions 0.1.53 → 0.1.54
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/actions/autogen/templates.js +14 -0
- package/dist/actions/autogen/types.d.ts +10 -1
- package/dist/actions/autogen/types.js +4 -1
- package/dist/actions/groups.js +6 -1
- package/dist/actions/providers/slack/sendMessage.d.ts +1 -1
- package/dist/actions/providers/slack/sendMessage.js +23 -12
- package/package.json +1 -1
@@ -213,6 +213,20 @@ exports.slackSendMessageDefinition = {
|
|
213
213
|
},
|
214
214
|
},
|
215
215
|
},
|
216
|
+
output: {
|
217
|
+
type: "object",
|
218
|
+
required: ["success"],
|
219
|
+
properties: {
|
220
|
+
success: {
|
221
|
+
type: "boolean",
|
222
|
+
description: "Whether the email was sent successfully",
|
223
|
+
},
|
224
|
+
error: {
|
225
|
+
type: "string",
|
226
|
+
description: "The error that occurred if the email was not sent successfully",
|
227
|
+
},
|
228
|
+
},
|
229
|
+
},
|
216
230
|
name: "sendMessage",
|
217
231
|
provider: "slack",
|
218
232
|
};
|
@@ -207,7 +207,16 @@ export declare const slackSendMessageParamsSchema: z.ZodObject<{
|
|
207
207
|
channelName: string;
|
208
208
|
}>;
|
209
209
|
export type slackSendMessageParamsType = z.infer<typeof slackSendMessageParamsSchema>;
|
210
|
-
export declare const slackSendMessageOutputSchema: z.
|
210
|
+
export declare const slackSendMessageOutputSchema: z.ZodObject<{
|
211
|
+
success: z.ZodBoolean;
|
212
|
+
error: z.ZodOptional<z.ZodString>;
|
213
|
+
}, "strip", z.ZodTypeAny, {
|
214
|
+
success: boolean;
|
215
|
+
error?: string | undefined;
|
216
|
+
}, {
|
217
|
+
success: boolean;
|
218
|
+
error?: string | undefined;
|
219
|
+
}>;
|
211
220
|
export type slackSendMessageOutputType = z.infer<typeof slackSendMessageOutputSchema>;
|
212
221
|
export type slackSendMessageFunction = ActionFunction<slackSendMessageParamsType, AuthParamsType, slackSendMessageOutputType>;
|
213
222
|
export declare const slackListConversationsParamsSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
@@ -78,7 +78,10 @@ exports.slackSendMessageParamsSchema = zod_1.z.object({
|
|
78
78
|
channelName: zod_1.z.string().describe("The name of the Slack channel to send the message to (e.g. general, alerts)"),
|
79
79
|
message: zod_1.z.string().describe("The message content to send to Slack. Can include markdown formatting."),
|
80
80
|
});
|
81
|
-
exports.slackSendMessageOutputSchema = zod_1.z.
|
81
|
+
exports.slackSendMessageOutputSchema = zod_1.z.object({
|
82
|
+
success: zod_1.z.boolean().describe("Whether the email was sent successfully"),
|
83
|
+
error: zod_1.z.string().describe("The error that occurred if the email was not sent successfully").optional(),
|
84
|
+
});
|
82
85
|
exports.slackListConversationsParamsSchema = zod_1.z.object({});
|
83
86
|
exports.slackListConversationsOutputSchema = zod_1.z.object({
|
84
87
|
channels: zod_1.z
|
package/dist/actions/groups.js
CHANGED
@@ -131,6 +131,11 @@ exports.ACTION_GROUPS = {
|
|
131
131
|
},
|
132
132
|
GITHUB: {
|
133
133
|
description: "Actions for interacting with GitHub",
|
134
|
-
actions: [
|
134
|
+
actions: [
|
135
|
+
templates_1.githubCreateOrUpdateFileDefinition,
|
136
|
+
templates_1.githubCreateBranchDefinition,
|
137
|
+
templates_1.githubCreatePullRequestDefinition,
|
138
|
+
templates_1.githubListPullRequestsDefinition,
|
139
|
+
],
|
135
140
|
},
|
136
141
|
};
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
const web_api_1 = require("@slack/web-api");
|
13
|
+
const types_1 = require("../../autogen/types");
|
13
14
|
const helpers_1 = require("./helpers");
|
14
15
|
const sendMessage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
15
16
|
const client = new web_api_1.WebClient(authParams.authToken);
|
@@ -19,18 +20,28 @@ const sendMessage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
19
20
|
if (!channel || !channel.id) {
|
20
21
|
throw Error(`Channel with name ${channelName} not found`);
|
21
22
|
}
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
try {
|
24
|
+
yield client.chat.postMessage({
|
25
|
+
channel: channel.id,
|
26
|
+
blocks: [
|
27
|
+
{
|
28
|
+
type: "section",
|
29
|
+
text: {
|
30
|
+
type: "mrkdwn",
|
31
|
+
text: message,
|
32
|
+
},
|
30
33
|
},
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
],
|
35
|
+
});
|
36
|
+
return types_1.slackSendMessageOutputSchema.parse({
|
37
|
+
success: true,
|
38
|
+
});
|
39
|
+
}
|
40
|
+
catch (error) {
|
41
|
+
return types_1.slackSendMessageOutputSchema.parse({
|
42
|
+
success: false,
|
43
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
44
|
+
});
|
45
|
+
}
|
35
46
|
});
|
36
47
|
exports.default = sendMessage;
|