@credal/actions 0.2.14 → 0.2.15

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.
@@ -1,9 +1,9 @@
1
1
  import type { z } from "zod";
2
- import { type ActionFunction } from "./autogen/types.js";
2
+ import { type ActionFunction, type ProviderName } from "./autogen/types.js";
3
3
  interface ActionFunctionComponents {
4
4
  fn: ActionFunction<any, any, any>;
5
5
  paramsSchema: z.ZodSchema;
6
6
  outputSchema: z.ZodSchema;
7
7
  }
8
- export declare const ActionMapper: Record<string, Record<string, ActionFunctionComponents>>;
8
+ export declare const ActionMapper: Record<ProviderName, Record<string, ActionFunctionComponents>>;
9
9
  export {};
@@ -84,9 +84,6 @@ import getTasksDetails from "./providers/asana/getTasksDetails.js";
84
84
  import searchByTitle from "./providers/notion/searchByTitle.js";
85
85
  import searchGmailMessages from "./providers/googlemail/searchGmailMessages.js";
86
86
  import listGmailThreads from "./providers/googlemail/listGmailThreads.js";
87
- // import listCalendarEvents from "./providers/google-oauth/listCalendarEvents";
88
- // import updateCalendarEvent from "./providers/google-oauth/updateCalendarEvent";
89
- // import deleteCalendarEvent from "./providers/google-oauth/deleteCalendarEvent";
90
87
  import listGroups from "./providers/google-oauth/listGroups.js";
91
88
  import getGroup from "./providers/google-oauth/getGroup.js";
92
89
  import listGroupMembers from "./providers/google-oauth/listGroupMembers.js";
@@ -394,16 +391,6 @@ export const ActionMapper = {
394
391
  paramsSchema: googleOauthSearchDriveByKeywordsParamsSchema,
395
392
  outputSchema: googleOauthSearchDriveByKeywordsOutputSchema,
396
393
  },
397
- searchGmailMessages: {
398
- fn: searchGmailMessages,
399
- paramsSchema: googlemailSearchGmailMessagesParamsSchema,
400
- outputSchema: googlemailSearchGmailMessagesOutputSchema,
401
- },
402
- listGmailThreads: {
403
- fn: listGmailThreads,
404
- paramsSchema: googlemailListGmailThreadsParamsSchema,
405
- outputSchema: googlemailListGmailThreadsOutputSchema,
406
- },
407
394
  listCalendars: {
408
395
  fn: listCalendars,
409
396
  paramsSchema: googleOauthListCalendarsParamsSchema,
@@ -455,6 +442,18 @@ export const ActionMapper = {
455
442
  outputSchema: googleOauthDeleteGroupMemberOutputSchema,
456
443
  },
457
444
  },
445
+ googlemail: {
446
+ searchGmailMessages: {
447
+ fn: searchGmailMessages,
448
+ paramsSchema: googlemailSearchGmailMessagesParamsSchema,
449
+ outputSchema: googlemailSearchGmailMessagesOutputSchema,
450
+ },
451
+ listGmailThreads: {
452
+ fn: listGmailThreads,
453
+ paramsSchema: googlemailListGmailThreadsParamsSchema,
454
+ outputSchema: googlemailListGmailThreadsOutputSchema,
455
+ },
456
+ },
458
457
  x: {
459
458
  createShareXPostUrl: {
460
459
  fn: createXSharePostUrl,
@@ -8,10 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { ActionMapper } from "./actionMapper.js";
11
+ import { ProviderName } from "./autogen/types.js";
11
12
  export function invokeAction(input) {
12
13
  return __awaiter(this, void 0, void 0, function* () {
13
14
  const { provider, name, parameters, authParams } = input;
14
- if (!ActionMapper[provider]) {
15
+ if (!isProviderName(provider)) {
15
16
  throw new Error(`Provider '${provider}' not found`);
16
17
  }
17
18
  const providerFunction = ActionMapper[provider][name].fn;
@@ -22,3 +23,6 @@ export function invokeAction(input) {
22
23
  return providerFunction({ params: parameters, authParams });
23
24
  });
24
25
  }
26
+ function isProviderName(value) {
27
+ return Object.values(ProviderName).includes(value);
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "type": "module",
5
5
  "description": "AI Actions by Credal AI",
6
6
  "sideEffects": false,