@credal/actions 0.1.12 → 0.1.14
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/actionMapper.js +8 -0
- package/dist/actions/autogen/templates.d.ts +1 -0
- package/dist/actions/autogen/templates.js +35 -1
- package/dist/actions/autogen/types.d.ts +26 -0
- package/dist/actions/autogen/types.js +10 -1
- package/dist/actions/groups.js +4 -0
- package/dist/actions/parse.js +1 -0
- package/dist/actions/providers/google-oauth/createNewGoogleDoc.d.ts +6 -0
- package/dist/actions/providers/google-oauth/createNewGoogleDoc.js +70 -0
- package/dist/actions/providers/resend/sendEmail.js +1 -0
- package/package.json +1 -1
@@ -21,6 +21,7 @@ const nearbysearchRestaurants_1 = __importDefault(require("./providers/googlemap
|
|
21
21
|
const scrapeUrl_1 = __importDefault(require("./providers/firecrawl/scrapeUrl"));
|
22
22
|
const sendEmail_1 = __importDefault(require("./providers/resend/sendEmail"));
|
23
23
|
const createSharePostLinkedinUrl_1 = __importDefault(require("./providers/linkedin/createSharePostLinkedinUrl"));
|
24
|
+
const createNewGoogleDoc_1 = __importDefault(require("./providers/google-oauth/createNewGoogleDoc"));
|
24
25
|
exports.ActionMapper = {
|
25
26
|
math: {
|
26
27
|
add: {
|
@@ -130,4 +131,11 @@ exports.ActionMapper = {
|
|
130
131
|
outputSchema: types_1.resendSendEmailOutputSchema,
|
131
132
|
},
|
132
133
|
},
|
134
|
+
googleOauth: {
|
135
|
+
createNewGoogleDoc: {
|
136
|
+
fn: createNewGoogleDoc_1.default,
|
137
|
+
paramsSchema: types_1.googleOauthCreateNewGoogleDocParamsSchema,
|
138
|
+
outputSchema: types_1.googleOauthCreateNewGoogleDocOutputSchema,
|
139
|
+
},
|
140
|
+
},
|
133
141
|
};
|
@@ -15,3 +15,4 @@ export declare const openstreetmapGetLatitudeLongitudeFromLocationDefinition: Ac
|
|
15
15
|
export declare const nwsGetForecastForLocationDefinition: ActionTemplate;
|
16
16
|
export declare const firecrawlScrapeUrlDefinition: ActionTemplate;
|
17
17
|
export declare const resendSendEmailDefinition: ActionTemplate;
|
18
|
+
export declare const googleOauthCreateNewGoogleDocDefinition: ActionTemplate;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.resendSendEmailDefinition = exports.firecrawlScrapeUrlDefinition = exports.nwsGetForecastForLocationDefinition = exports.openstreetmapGetLatitudeLongitudeFromLocationDefinition = exports.snowflakeGetRowByFieldValueDefinition = exports.mongoInsertMongoDocDefinition = exports.linkedinCreateShareLinkedinPostUrlDefinition = exports.zendeskCreateZendeskTicketDefinition = exports.credalCallCopilotDefinition = exports.googlemapsNearbysearchRestaurantsDefinition = exports.googlemapsValidateAddressDefinition = exports.jiraCreateJiraTicketDefinition = exports.confluenceUpdatePageDefinition = exports.mathAddDefinition = exports.slackListConversationsDefinition = exports.slackSendMessageDefinition = void 0;
|
3
|
+
exports.googleOauthCreateNewGoogleDocDefinition = exports.resendSendEmailDefinition = exports.firecrawlScrapeUrlDefinition = exports.nwsGetForecastForLocationDefinition = exports.openstreetmapGetLatitudeLongitudeFromLocationDefinition = exports.snowflakeGetRowByFieldValueDefinition = exports.mongoInsertMongoDocDefinition = exports.linkedinCreateShareLinkedinPostUrlDefinition = exports.zendeskCreateZendeskTicketDefinition = exports.credalCallCopilotDefinition = exports.googlemapsNearbysearchRestaurantsDefinition = exports.googlemapsValidateAddressDefinition = exports.jiraCreateJiraTicketDefinition = exports.confluenceUpdatePageDefinition = exports.mathAddDefinition = exports.slackListConversationsDefinition = exports.slackSendMessageDefinition = void 0;
|
4
4
|
exports.slackSendMessageDefinition = {
|
5
5
|
description: "Sends a message to a Slack channel",
|
6
6
|
scopes: ["chat:write"],
|
@@ -754,3 +754,37 @@ exports.resendSendEmailDefinition = {
|
|
754
754
|
name: "sendEmail",
|
755
755
|
provider: "resend",
|
756
756
|
};
|
757
|
+
exports.googleOauthCreateNewGoogleDocDefinition = {
|
758
|
+
description: "Create a new Google Docs document using OAuth authentication",
|
759
|
+
scopes: [],
|
760
|
+
parameters: {
|
761
|
+
type: "object",
|
762
|
+
required: ["title"],
|
763
|
+
properties: {
|
764
|
+
title: {
|
765
|
+
type: "string",
|
766
|
+
description: "The title of the new Google Doc",
|
767
|
+
},
|
768
|
+
content: {
|
769
|
+
type: "string",
|
770
|
+
description: "The content to add to the new Google Doc",
|
771
|
+
},
|
772
|
+
},
|
773
|
+
},
|
774
|
+
output: {
|
775
|
+
type: "object",
|
776
|
+
required: ["documentId"],
|
777
|
+
properties: {
|
778
|
+
documentId: {
|
779
|
+
type: "string",
|
780
|
+
description: "The ID of the created Google Doc",
|
781
|
+
},
|
782
|
+
documentUrl: {
|
783
|
+
type: "string",
|
784
|
+
description: "The URL to access the created Google Doc",
|
785
|
+
},
|
786
|
+
},
|
787
|
+
},
|
788
|
+
name: "createNewGoogleDoc",
|
789
|
+
provider: "googleOauth",
|
790
|
+
};
|
@@ -11,6 +11,7 @@ export declare const AuthParamsSchema: z.ZodObject<{
|
|
11
11
|
userAgent: z.ZodOptional<z.ZodString>;
|
12
12
|
emailFrom: z.ZodOptional<z.ZodString>;
|
13
13
|
emailReplyTo: z.ZodOptional<z.ZodString>;
|
14
|
+
emailBcc: z.ZodOptional<z.ZodString>;
|
14
15
|
}, "strip", z.ZodTypeAny, {
|
15
16
|
username?: string | undefined;
|
16
17
|
authToken?: string | undefined;
|
@@ -19,6 +20,7 @@ export declare const AuthParamsSchema: z.ZodObject<{
|
|
19
20
|
userAgent?: string | undefined;
|
20
21
|
emailFrom?: string | undefined;
|
21
22
|
emailReplyTo?: string | undefined;
|
23
|
+
emailBcc?: string | undefined;
|
22
24
|
}, {
|
23
25
|
username?: string | undefined;
|
24
26
|
authToken?: string | undefined;
|
@@ -27,6 +29,7 @@ export declare const AuthParamsSchema: z.ZodObject<{
|
|
27
29
|
userAgent?: string | undefined;
|
28
30
|
emailFrom?: string | undefined;
|
29
31
|
emailReplyTo?: string | undefined;
|
32
|
+
emailBcc?: string | undefined;
|
30
33
|
}>;
|
31
34
|
export type AuthParamsType = z.infer<typeof AuthParamsSchema>;
|
32
35
|
export declare const slackSendMessageParamsSchema: z.ZodObject<{
|
@@ -710,3 +713,26 @@ export declare const resendSendEmailOutputSchema: z.ZodObject<{
|
|
710
713
|
}>;
|
711
714
|
export type resendSendEmailOutputType = z.infer<typeof resendSendEmailOutputSchema>;
|
712
715
|
export type resendSendEmailFunction = ActionFunction<resendSendEmailParamsType, AuthParamsType, resendSendEmailOutputType>;
|
716
|
+
export declare const googleOauthCreateNewGoogleDocParamsSchema: z.ZodObject<{
|
717
|
+
title: z.ZodString;
|
718
|
+
content: z.ZodOptional<z.ZodString>;
|
719
|
+
}, "strip", z.ZodTypeAny, {
|
720
|
+
title: string;
|
721
|
+
content?: string | undefined;
|
722
|
+
}, {
|
723
|
+
title: string;
|
724
|
+
content?: string | undefined;
|
725
|
+
}>;
|
726
|
+
export type googleOauthCreateNewGoogleDocParamsType = z.infer<typeof googleOauthCreateNewGoogleDocParamsSchema>;
|
727
|
+
export declare const googleOauthCreateNewGoogleDocOutputSchema: z.ZodObject<{
|
728
|
+
documentId: z.ZodString;
|
729
|
+
documentUrl: z.ZodOptional<z.ZodString>;
|
730
|
+
}, "strip", z.ZodTypeAny, {
|
731
|
+
documentId: string;
|
732
|
+
documentUrl?: string | undefined;
|
733
|
+
}, {
|
734
|
+
documentId: string;
|
735
|
+
documentUrl?: string | undefined;
|
736
|
+
}>;
|
737
|
+
export type googleOauthCreateNewGoogleDocOutputType = z.infer<typeof googleOauthCreateNewGoogleDocOutputSchema>;
|
738
|
+
export type googleOauthCreateNewGoogleDocFunction = ActionFunction<googleOauthCreateNewGoogleDocParamsType, AuthParamsType, googleOauthCreateNewGoogleDocOutputType>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.resendSendEmailOutputSchema = exports.resendSendEmailParamsSchema = exports.firecrawlScrapeUrlOutputSchema = exports.firecrawlScrapeUrlParamsSchema = exports.nwsGetForecastForLocationOutputSchema = exports.nwsGetForecastForLocationParamsSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationOutputSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationParamsSchema = exports.snowflakeGetRowByFieldValueOutputSchema = exports.snowflakeGetRowByFieldValueParamsSchema = exports.mongoInsertMongoDocOutputSchema = exports.mongoInsertMongoDocParamsSchema = exports.linkedinCreateShareLinkedinPostUrlOutputSchema = exports.linkedinCreateShareLinkedinPostUrlParamsSchema = exports.zendeskCreateZendeskTicketOutputSchema = exports.zendeskCreateZendeskTicketParamsSchema = exports.credalCallCopilotOutputSchema = exports.credalCallCopilotParamsSchema = exports.googlemapsNearbysearchRestaurantsOutputSchema = exports.googlemapsNearbysearchRestaurantsParamsSchema = exports.googlemapsValidateAddressOutputSchema = exports.googlemapsValidateAddressParamsSchema = exports.jiraCreateJiraTicketOutputSchema = exports.jiraCreateJiraTicketParamsSchema = exports.confluenceUpdatePageOutputSchema = exports.confluenceUpdatePageParamsSchema = exports.mathAddOutputSchema = exports.mathAddParamsSchema = exports.slackListConversationsOutputSchema = exports.slackListConversationsParamsSchema = exports.slackSendMessageOutputSchema = exports.slackSendMessageParamsSchema = exports.AuthParamsSchema = void 0;
|
3
|
+
exports.googleOauthCreateNewGoogleDocOutputSchema = exports.googleOauthCreateNewGoogleDocParamsSchema = exports.resendSendEmailOutputSchema = exports.resendSendEmailParamsSchema = exports.firecrawlScrapeUrlOutputSchema = exports.firecrawlScrapeUrlParamsSchema = exports.nwsGetForecastForLocationOutputSchema = exports.nwsGetForecastForLocationParamsSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationOutputSchema = exports.openstreetmapGetLatitudeLongitudeFromLocationParamsSchema = exports.snowflakeGetRowByFieldValueOutputSchema = exports.snowflakeGetRowByFieldValueParamsSchema = exports.mongoInsertMongoDocOutputSchema = exports.mongoInsertMongoDocParamsSchema = exports.linkedinCreateShareLinkedinPostUrlOutputSchema = exports.linkedinCreateShareLinkedinPostUrlParamsSchema = exports.zendeskCreateZendeskTicketOutputSchema = exports.zendeskCreateZendeskTicketParamsSchema = exports.credalCallCopilotOutputSchema = exports.credalCallCopilotParamsSchema = exports.googlemapsNearbysearchRestaurantsOutputSchema = exports.googlemapsNearbysearchRestaurantsParamsSchema = exports.googlemapsValidateAddressOutputSchema = exports.googlemapsValidateAddressParamsSchema = exports.jiraCreateJiraTicketOutputSchema = exports.jiraCreateJiraTicketParamsSchema = exports.confluenceUpdatePageOutputSchema = exports.confluenceUpdatePageParamsSchema = exports.mathAddOutputSchema = exports.mathAddParamsSchema = exports.slackListConversationsOutputSchema = exports.slackListConversationsParamsSchema = exports.slackSendMessageOutputSchema = exports.slackSendMessageParamsSchema = exports.AuthParamsSchema = void 0;
|
4
4
|
const zod_1 = require("zod");
|
5
5
|
exports.AuthParamsSchema = zod_1.z.object({
|
6
6
|
authToken: zod_1.z.string().optional(),
|
@@ -10,6 +10,7 @@ exports.AuthParamsSchema = zod_1.z.object({
|
|
10
10
|
userAgent: zod_1.z.string().optional(),
|
11
11
|
emailFrom: zod_1.z.string().optional(),
|
12
12
|
emailReplyTo: zod_1.z.string().optional(),
|
13
|
+
emailBcc: zod_1.z.string().optional(),
|
13
14
|
});
|
14
15
|
exports.slackSendMessageParamsSchema = zod_1.z.object({
|
15
16
|
channelName: zod_1.z.string().describe("The name of the Slack channel to send the message to (e.g. general, alerts)"),
|
@@ -220,3 +221,11 @@ exports.resendSendEmailOutputSchema = zod_1.z.object({
|
|
220
221
|
success: zod_1.z.boolean().describe("Whether the email was sent successfully"),
|
221
222
|
error: zod_1.z.string().describe("The error that occurred if the email was not sent successfully").optional(),
|
222
223
|
});
|
224
|
+
exports.googleOauthCreateNewGoogleDocParamsSchema = zod_1.z.object({
|
225
|
+
title: zod_1.z.string().describe("The title of the new Google Doc"),
|
226
|
+
content: zod_1.z.string().describe("The content to add to the new Google Doc").optional(),
|
227
|
+
});
|
228
|
+
exports.googleOauthCreateNewGoogleDocOutputSchema = zod_1.z.object({
|
229
|
+
documentId: zod_1.z.string().describe("The ID of the created Google Doc"),
|
230
|
+
documentUrl: zod_1.z.string().describe("The URL to access the created Google Doc").optional(),
|
231
|
+
});
|
package/dist/actions/groups.js
CHANGED
@@ -19,6 +19,10 @@ exports.ACTION_GROUPS = {
|
|
19
19
|
description: "Action for interacting with Google Maps",
|
20
20
|
actions: [templates_1.googlemapsValidateAddressDefinition, templates_1.googlemapsNearbysearchRestaurantsDefinition],
|
21
21
|
},
|
22
|
+
GOOGLE_DRIVE: {
|
23
|
+
description: "Action for interacting with Google Drive",
|
24
|
+
actions: [templates_1.googleOauthCreateNewGoogleDocDefinition],
|
25
|
+
},
|
22
26
|
CREDAL_CALL_COPILOT: {
|
23
27
|
description: "Action for calling a Credal Copilot",
|
24
28
|
actions: [templates_1.credalCallCopilotDefinition],
|
package/dist/actions/parse.js
CHANGED
@@ -0,0 +1,70 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const axios_1 = __importDefault(require("axios"));
|
16
|
+
/**
|
17
|
+
* Creates a new Google Doc document using OAuth authentication
|
18
|
+
*/
|
19
|
+
const createNewGoogleDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
20
|
+
var _b, _c, _d;
|
21
|
+
if (!authParams.authToken) {
|
22
|
+
throw new Error("authToken is required for Google Docs API");
|
23
|
+
}
|
24
|
+
try {
|
25
|
+
const { title, content } = params;
|
26
|
+
const baseApiUrl = "https://docs.googleapis.com/v1/documents";
|
27
|
+
// Create the document with the provided title
|
28
|
+
const response = yield axios_1.default.post(baseApiUrl, { title }, {
|
29
|
+
headers: {
|
30
|
+
Authorization: `Bearer ${authParams.authToken}`,
|
31
|
+
"Content-Type": "application/json",
|
32
|
+
},
|
33
|
+
});
|
34
|
+
// If description is provided, update the document body with the description
|
35
|
+
if (content) {
|
36
|
+
const documentId = response.data.documentId;
|
37
|
+
// Add the description to the document content
|
38
|
+
yield axios_1.default.post(`${baseApiUrl}/${documentId}:batchUpdate`, {
|
39
|
+
requests: [
|
40
|
+
{
|
41
|
+
insertText: {
|
42
|
+
location: {
|
43
|
+
index: 1, // Insert at the beginning of the document
|
44
|
+
},
|
45
|
+
text: content,
|
46
|
+
},
|
47
|
+
},
|
48
|
+
],
|
49
|
+
}, {
|
50
|
+
headers: {
|
51
|
+
Authorization: `Bearer ${authParams.authToken}`,
|
52
|
+
"Content-Type": "application/json",
|
53
|
+
},
|
54
|
+
});
|
55
|
+
}
|
56
|
+
return {
|
57
|
+
documentId: response.data.documentId,
|
58
|
+
documentUrl: response.data.documentId
|
59
|
+
? `https://docs.google.com/document/d/${response.data.documentId}/edit`
|
60
|
+
: undefined,
|
61
|
+
};
|
62
|
+
}
|
63
|
+
catch (error) {
|
64
|
+
if (axios_1.default.isAxiosError(error)) {
|
65
|
+
throw new Error(`Google Docs API error: ${((_d = (_c = (_b = error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.error) === null || _d === void 0 ? void 0 : _d.message) || error.message}`);
|
66
|
+
}
|
67
|
+
throw error;
|
68
|
+
}
|
69
|
+
});
|
70
|
+
exports.default = createNewGoogleDoc;
|
@@ -17,6 +17,7 @@ const sendEmail = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, a
|
|
17
17
|
const result = yield resend.emails.send({
|
18
18
|
from: authParams.emailFrom,
|
19
19
|
replyTo: authParams.emailReplyTo,
|
20
|
+
bcc: authParams.emailBcc,
|
20
21
|
to: params.to,
|
21
22
|
subject: params.subject,
|
22
23
|
text: params.content,
|