@credal/actions 0.1.10 → 0.1.13

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.
@@ -20,6 +20,7 @@ const getForecastForLocation_1 = __importDefault(require("./providers/nws/getFor
20
20
  const nearbysearchRestaurants_1 = __importDefault(require("./providers/googlemaps/nearbysearchRestaurants"));
21
21
  const scrapeUrl_1 = __importDefault(require("./providers/firecrawl/scrapeUrl"));
22
22
  const sendEmail_1 = __importDefault(require("./providers/resend/sendEmail"));
23
+ const createSharePostLinkedinUrl_1 = __importDefault(require("./providers/linkedin/createSharePostLinkedinUrl"));
23
24
  exports.ActionMapper = {
24
25
  math: {
25
26
  add: {
@@ -87,6 +88,13 @@ exports.ActionMapper = {
87
88
  outputSchema: types_1.snowflakeGetRowByFieldValueOutputSchema,
88
89
  },
89
90
  },
91
+ linkedin: {
92
+ createShareLinkedinPostUrl: {
93
+ fn: createSharePostLinkedinUrl_1.default,
94
+ paramsSchema: types_1.linkedinCreateShareLinkedinPostUrlParamsSchema,
95
+ outputSchema: types_1.linkedinCreateShareLinkedinPostUrlOutputSchema,
96
+ },
97
+ },
90
98
  jira: {
91
99
  createJiraTicket: {
92
100
  fn: createJiraTicket_1.default,
@@ -8,6 +8,7 @@ export declare const googlemapsValidateAddressDefinition: ActionTemplate;
8
8
  export declare const googlemapsNearbysearchRestaurantsDefinition: ActionTemplate;
9
9
  export declare const credalCallCopilotDefinition: ActionTemplate;
10
10
  export declare const zendeskCreateZendeskTicketDefinition: ActionTemplate;
11
+ export declare const linkedinCreateShareLinkedinPostUrlDefinition: ActionTemplate;
11
12
  export declare const mongoInsertMongoDocDefinition: ActionTemplate;
12
13
  export declare const snowflakeGetRowByFieldValueDefinition: ActionTemplate;
13
14
  export declare const openstreetmapGetLatitudeLongitudeFromLocationDefinition: 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.zendeskCreateZendeskTicketDefinition = exports.credalCallCopilotDefinition = exports.googlemapsNearbysearchRestaurantsDefinition = exports.googlemapsValidateAddressDefinition = exports.jiraCreateJiraTicketDefinition = exports.confluenceUpdatePageDefinition = exports.mathAddDefinition = exports.slackListConversationsDefinition = exports.slackSendMessageDefinition = void 0;
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;
4
4
  exports.slackSendMessageDefinition = {
5
5
  description: "Sends a message to a Slack channel",
6
6
  scopes: ["chat:write"],
@@ -123,7 +123,7 @@ exports.jiraCreateJiraTicketDefinition = {
123
123
  scopes: [],
124
124
  parameters: {
125
125
  type: "object",
126
- required: ["projectKey", "summary", "description", "issueType", "username"],
126
+ required: ["projectKey", "summary", "description", "issueType"],
127
127
  properties: {
128
128
  projectKey: {
129
129
  type: "string",
@@ -149,10 +149,6 @@ exports.jiraCreateJiraTicketDefinition = {
149
149
  type: "string",
150
150
  description: "The assignee for the new ticket creation",
151
151
  },
152
- username: {
153
- type: "string",
154
- description: "The username of the person creating the ticket",
155
- },
156
152
  },
157
153
  },
158
154
  output: {
@@ -478,6 +474,36 @@ exports.zendeskCreateZendeskTicketDefinition = {
478
474
  name: "createZendeskTicket",
479
475
  provider: "zendesk",
480
476
  };
477
+ exports.linkedinCreateShareLinkedinPostUrlDefinition = {
478
+ description: "Create a share linkedin post link",
479
+ scopes: [],
480
+ parameters: {
481
+ type: "object",
482
+ required: [],
483
+ properties: {
484
+ text: {
485
+ type: "string",
486
+ description: "The text for the linkedin post",
487
+ },
488
+ url: {
489
+ type: "string",
490
+ description: "The url for the linkedin post",
491
+ },
492
+ },
493
+ },
494
+ output: {
495
+ type: "object",
496
+ required: ["linkedinUrl"],
497
+ properties: {
498
+ linkedinUrl: {
499
+ type: "string",
500
+ description: "The share post linkedin URL",
501
+ },
502
+ },
503
+ },
504
+ name: "createShareLinkedinPostUrl",
505
+ provider: "linkedin",
506
+ };
481
507
  exports.mongoInsertMongoDocDefinition = {
482
508
  description: "Insert a document into a MongoDB collection",
483
509
  scopes: [],
@@ -7,23 +7,29 @@ export declare const AuthParamsSchema: z.ZodObject<{
7
7
  authToken: z.ZodOptional<z.ZodString>;
8
8
  baseUrl: z.ZodOptional<z.ZodString>;
9
9
  apiKey: z.ZodOptional<z.ZodString>;
10
+ username: z.ZodOptional<z.ZodString>;
10
11
  userAgent: z.ZodOptional<z.ZodString>;
11
12
  emailFrom: z.ZodOptional<z.ZodString>;
12
13
  emailReplyTo: z.ZodOptional<z.ZodString>;
14
+ emailBcc: z.ZodOptional<z.ZodString>;
13
15
  }, "strip", z.ZodTypeAny, {
16
+ username?: string | undefined;
14
17
  authToken?: string | undefined;
15
18
  baseUrl?: string | undefined;
16
19
  apiKey?: string | undefined;
17
20
  userAgent?: string | undefined;
18
21
  emailFrom?: string | undefined;
19
22
  emailReplyTo?: string | undefined;
23
+ emailBcc?: string | undefined;
20
24
  }, {
25
+ username?: string | undefined;
21
26
  authToken?: string | undefined;
22
27
  baseUrl?: string | undefined;
23
28
  apiKey?: string | undefined;
24
29
  userAgent?: string | undefined;
25
30
  emailFrom?: string | undefined;
26
31
  emailReplyTo?: string | undefined;
32
+ emailBcc?: string | undefined;
27
33
  }>;
28
34
  export type AuthParamsType = z.infer<typeof AuthParamsSchema>;
29
35
  export declare const slackSendMessageParamsSchema: z.ZodObject<{
@@ -123,10 +129,8 @@ export declare const jiraCreateJiraTicketParamsSchema: z.ZodObject<{
123
129
  issueType: z.ZodString;
124
130
  reporter: z.ZodOptional<z.ZodString>;
125
131
  assignee: z.ZodOptional<z.ZodString>;
126
- username: z.ZodString;
127
132
  }, "strip", z.ZodTypeAny, {
128
133
  description: string;
129
- username: string;
130
134
  projectKey: string;
131
135
  summary: string;
132
136
  issueType: string;
@@ -134,7 +138,6 @@ export declare const jiraCreateJiraTicketParamsSchema: z.ZodObject<{
134
138
  assignee?: string | undefined;
135
139
  }, {
136
140
  description: string;
137
- username: string;
138
141
  projectKey: string;
139
142
  summary: string;
140
143
  issueType: string;
@@ -490,6 +493,26 @@ export declare const zendeskCreateZendeskTicketOutputSchema: z.ZodObject<{
490
493
  }>;
491
494
  export type zendeskCreateZendeskTicketOutputType = z.infer<typeof zendeskCreateZendeskTicketOutputSchema>;
492
495
  export type zendeskCreateZendeskTicketFunction = ActionFunction<zendeskCreateZendeskTicketParamsType, AuthParamsType, zendeskCreateZendeskTicketOutputType>;
496
+ export declare const linkedinCreateShareLinkedinPostUrlParamsSchema: z.ZodObject<{
497
+ text: z.ZodOptional<z.ZodString>;
498
+ url: z.ZodOptional<z.ZodString>;
499
+ }, "strip", z.ZodTypeAny, {
500
+ text?: string | undefined;
501
+ url?: string | undefined;
502
+ }, {
503
+ text?: string | undefined;
504
+ url?: string | undefined;
505
+ }>;
506
+ export type linkedinCreateShareLinkedinPostUrlParamsType = z.infer<typeof linkedinCreateShareLinkedinPostUrlParamsSchema>;
507
+ export declare const linkedinCreateShareLinkedinPostUrlOutputSchema: z.ZodObject<{
508
+ linkedinUrl: z.ZodString;
509
+ }, "strip", z.ZodTypeAny, {
510
+ linkedinUrl: string;
511
+ }, {
512
+ linkedinUrl: string;
513
+ }>;
514
+ export type linkedinCreateShareLinkedinPostUrlOutputType = z.infer<typeof linkedinCreateShareLinkedinPostUrlOutputSchema>;
515
+ export type linkedinCreateShareLinkedinPostUrlFunction = ActionFunction<linkedinCreateShareLinkedinPostUrlParamsType, AuthParamsType, linkedinCreateShareLinkedinPostUrlOutputType>;
493
516
  export declare const mongoInsertMongoDocParamsSchema: z.ZodObject<{
494
517
  databaseName: z.ZodString;
495
518
  collectionName: z.ZodString;
@@ -1,14 +1,16 @@
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.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.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(),
7
7
  baseUrl: zod_1.z.string().optional(),
8
8
  apiKey: zod_1.z.string().optional(),
9
+ username: zod_1.z.string().optional(),
9
10
  userAgent: zod_1.z.string().optional(),
10
11
  emailFrom: zod_1.z.string().optional(),
11
12
  emailReplyTo: zod_1.z.string().optional(),
13
+ emailBcc: zod_1.z.string().optional(),
12
14
  });
13
15
  exports.slackSendMessageParamsSchema = zod_1.z.object({
14
16
  channelName: zod_1.z.string().describe("The name of the Slack channel to send the message to (e.g. general, alerts)"),
@@ -47,7 +49,6 @@ exports.jiraCreateJiraTicketParamsSchema = zod_1.z.object({
47
49
  issueType: zod_1.z.string().describe("The issue type of the new ticket"),
48
50
  reporter: zod_1.z.string().describe("The reporter for the new ticket creation").optional(),
49
51
  assignee: zod_1.z.string().describe("The assignee for the new ticket creation").optional(),
50
- username: zod_1.z.string().describe("The username of the person creating the ticket"),
51
52
  });
52
53
  exports.jiraCreateJiraTicketOutputSchema = zod_1.z.object({
53
54
  ticketUrl: zod_1.z.string().describe("The url to the created Jira Ticket"),
@@ -150,6 +151,13 @@ exports.zendeskCreateZendeskTicketOutputSchema = zod_1.z.object({
150
151
  ticketId: zod_1.z.string().describe("The ID of the ticket created"),
151
152
  ticketUrl: zod_1.z.string().describe("The URL of the ticket created").optional(),
152
153
  });
154
+ exports.linkedinCreateShareLinkedinPostUrlParamsSchema = zod_1.z.object({
155
+ text: zod_1.z.string().describe("The text for the linkedin post").optional(),
156
+ url: zod_1.z.string().describe("The url for the linkedin post").optional(),
157
+ });
158
+ exports.linkedinCreateShareLinkedinPostUrlOutputSchema = zod_1.z.object({
159
+ linkedinUrl: zod_1.z.string().describe("The share post linkedin URL"),
160
+ });
153
161
  exports.mongoInsertMongoDocParamsSchema = zod_1.z.object({
154
162
  databaseName: zod_1.z.string().describe("Database to connect to"),
155
163
  collectionName: zod_1.z.string().describe("Collection to insert the document into"),
@@ -23,6 +23,10 @@ exports.ACTION_GROUPS = {
23
23
  description: "Action for calling a Credal Copilot",
24
24
  actions: [templates_1.credalCallCopilotDefinition],
25
25
  },
26
+ LINKEDIN_SHARE_POST: {
27
+ description: "Action for creating a share post url on linkedin",
28
+ actions: [templates_1.linkedinCreateShareLinkedinPostUrlDefinition],
29
+ },
26
30
  ZENDESK_CREATE_TICKET: {
27
31
  description: "Action for creating a Zendesk ticket",
28
32
  actions: [templates_1.zendeskCreateZendeskTicketDefinition],
@@ -43,9 +43,11 @@ z.object({
43
43
  authToken: z.string().optional(),
44
44
  baseUrl: z.string().optional(),
45
45
  apiKey: z.string().optional(),
46
+ username: z.string().optional(),
46
47
  userAgent: z.string().optional(),
47
48
  emailFrom: z.string().optional(),
48
49
  emailReplyTo: z.string().optional(),
50
+ emailBcc: z.string().optional(),
49
51
  })
50
52
  `;
51
53
  function validateObject(object) {
@@ -35,17 +35,27 @@ function getUserAccountId(email, baseUrl, authToken, username) {
35
35
  });
36
36
  }
37
37
  const createJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
38
- const { authToken, baseUrl } = authParams;
38
+ const { authToken, baseUrl, username } = authParams;
39
39
  const url = `${baseUrl}/rest/api/3/issue`;
40
40
  // If assignee is an email, look up the account ID
41
41
  let reporterId = null;
42
- if (params.reporter && typeof params.reporter === "string" && params.reporter.includes("@") && baseUrl && authToken) {
43
- reporterId = yield getUserAccountId(params.reporter, baseUrl, authToken, params.username);
42
+ if (params.reporter &&
43
+ typeof params.reporter === "string" &&
44
+ params.reporter.includes("@") &&
45
+ baseUrl &&
46
+ authToken &&
47
+ username) {
48
+ reporterId = yield getUserAccountId(params.reporter, baseUrl, authToken, username);
44
49
  }
45
50
  // If assignee is an email, look up the account ID
46
51
  let assigneeId = null;
47
- if (params.assignee && typeof params.assignee === "string" && params.assignee.includes("@") && baseUrl && authToken) {
48
- assigneeId = yield getUserAccountId(params.assignee, baseUrl, authToken, params.username);
52
+ if (params.assignee &&
53
+ typeof params.assignee === "string" &&
54
+ params.assignee.includes("@") &&
55
+ baseUrl &&
56
+ authToken &&
57
+ username) {
58
+ assigneeId = yield getUserAccountId(params.assignee, baseUrl, authToken, username);
49
59
  }
50
60
  const description = typeof params.description === "string"
51
61
  ? {
@@ -73,7 +83,7 @@ const createJiraTicket = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
73
83
  };
74
84
  const response = yield axios_1.default.post(url, payload, {
75
85
  headers: {
76
- Authorization: `Basic ${Buffer.from(`${params.username}:${authToken}`).toString("base64")}`,
86
+ Authorization: `Basic ${Buffer.from(`${username}:${authToken}`).toString("base64")}`,
77
87
  "Content-Type": "application/json",
78
88
  },
79
89
  });
@@ -0,0 +1,3 @@
1
+ import { linkedinCreateShareLinkedinPostUrlFunction } from "../../autogen/types";
2
+ declare const createShareLinkedinPostUrl: linkedinCreateShareLinkedinPostUrlFunction;
3
+ export default createShareLinkedinPostUrl;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const createShareLinkedinPostUrl = ({ params, }) => {
4
+ const baseUrl = "https://www.linkedin.com/feed/?shareActive=true";
5
+ let shareUrl = baseUrl;
6
+ // Only add text parameter if it exists
7
+ if (params.text) {
8
+ const encodedText = encodeURIComponent(params.text);
9
+ shareUrl += `&text=${encodedText}`;
10
+ }
11
+ // Only add url parameter if it exists
12
+ if (params.url) {
13
+ const encodedUrl = encodeURIComponent(params.url);
14
+ shareUrl += `&shareUrl=${encodedUrl}`;
15
+ }
16
+ return Promise.resolve({
17
+ linkedinUrl: shareUrl,
18
+ });
19
+ };
20
+ exports.default = createShareLinkedinPostUrl;
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.1.10",
3
+ "version": "0.1.13",
4
4
  "description": "AI Actions by Credal AI",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",