@credal/actions 0.1.9 → 0.1.10

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.
@@ -17,7 +17,7 @@ const createZendeskTicket_1 = __importDefault(require("./providers/zendesk/creat
17
17
  const createJiraTicket_1 = __importDefault(require("./providers/jira/createJiraTicket"));
18
18
  const getLatitudeLongitudeFromLocation_1 = __importDefault(require("./providers/openstreetmap/getLatitudeLongitudeFromLocation"));
19
19
  const getForecastForLocation_1 = __importDefault(require("./providers/nws/getForecastForLocation"));
20
- const nearbysearch_1 = __importDefault(require("./providers/googlemaps/nearbysearch"));
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
23
  exports.ActionMapper = {
@@ -54,9 +54,9 @@ exports.ActionMapper = {
54
54
  outputSchema: types_1.googlemapsValidateAddressOutputSchema,
55
55
  },
56
56
  nearbysearch: {
57
- fn: nearbysearch_1.default,
58
- paramsSchema: types_1.googlemapsNearbysearchParamsSchema,
59
- outputSchema: types_1.googlemapsNearbysearchOutputSchema,
57
+ fn: nearbysearchRestaurants_1.default,
58
+ paramsSchema: types_1.googlemapsNearbysearchRestaurantsParamsSchema,
59
+ outputSchema: types_1.googlemapsNearbysearchRestaurantsOutputSchema,
60
60
  },
61
61
  },
62
62
  credal: {
@@ -5,7 +5,7 @@ export declare const mathAddDefinition: ActionTemplate;
5
5
  export declare const confluenceUpdatePageDefinition: ActionTemplate;
6
6
  export declare const jiraCreateJiraTicketDefinition: ActionTemplate;
7
7
  export declare const googlemapsValidateAddressDefinition: ActionTemplate;
8
- export declare const googlemapsNearbysearchDefinition: ActionTemplate;
8
+ export declare const googlemapsNearbysearchRestaurantsDefinition: ActionTemplate;
9
9
  export declare const credalCallCopilotDefinition: ActionTemplate;
10
10
  export declare const zendeskCreateZendeskTicketDefinition: ActionTemplate;
11
11
  export declare const mongoInsertMongoDocDefinition: 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.googlemapsNearbysearchDefinition = 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.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"],
@@ -335,7 +335,7 @@ exports.googlemapsValidateAddressDefinition = {
335
335
  name: "validateAddress",
336
336
  provider: "googlemaps",
337
337
  };
338
- exports.googlemapsNearbysearchDefinition = {
338
+ exports.googlemapsNearbysearchRestaurantsDefinition = {
339
339
  description: "Search for nearby places using Google Maps",
340
340
  scopes: [],
341
341
  parameters: {
@@ -390,12 +390,16 @@ exports.googlemapsNearbysearchDefinition = {
390
390
  type: "string",
391
391
  description: "The editorial summary of the place",
392
392
  },
393
+ websiteUri: {
394
+ type: "string",
395
+ description: "The website URI of the place",
396
+ },
393
397
  },
394
398
  },
395
399
  },
396
400
  },
397
401
  },
398
- name: "nearbysearch",
402
+ name: "nearbysearchRestaurants",
399
403
  provider: "googlemaps",
400
404
  };
401
405
  exports.credalCallCopilotDefinition = {
@@ -373,7 +373,7 @@ export declare const googlemapsValidateAddressOutputSchema: z.ZodObject<{
373
373
  }>;
374
374
  export type googlemapsValidateAddressOutputType = z.infer<typeof googlemapsValidateAddressOutputSchema>;
375
375
  export type googlemapsValidateAddressFunction = ActionFunction<googlemapsValidateAddressParamsType, AuthParamsType, googlemapsValidateAddressOutputType>;
376
- export declare const googlemapsNearbysearchParamsSchema: z.ZodObject<{
376
+ export declare const googlemapsNearbysearchRestaurantsParamsSchema: z.ZodObject<{
377
377
  latitude: z.ZodNumber;
378
378
  longitude: z.ZodNumber;
379
379
  }, "strip", z.ZodTypeAny, {
@@ -383,8 +383,8 @@ export declare const googlemapsNearbysearchParamsSchema: z.ZodObject<{
383
383
  latitude: number;
384
384
  longitude: number;
385
385
  }>;
386
- export type googlemapsNearbysearchParamsType = z.infer<typeof googlemapsNearbysearchParamsSchema>;
387
- export declare const googlemapsNearbysearchOutputSchema: z.ZodObject<{
386
+ export type googlemapsNearbysearchRestaurantsParamsType = z.infer<typeof googlemapsNearbysearchRestaurantsParamsSchema>;
387
+ export declare const googlemapsNearbysearchRestaurantsOutputSchema: z.ZodObject<{
388
388
  results: z.ZodArray<z.ZodObject<{
389
389
  name: z.ZodOptional<z.ZodString>;
390
390
  address: z.ZodOptional<z.ZodString>;
@@ -393,6 +393,7 @@ export declare const googlemapsNearbysearchOutputSchema: z.ZodObject<{
393
393
  openingHours: z.ZodOptional<z.ZodString>;
394
394
  primaryType: z.ZodOptional<z.ZodString>;
395
395
  editorialSummary: z.ZodOptional<z.ZodString>;
396
+ websiteUri: z.ZodOptional<z.ZodString>;
396
397
  }, "strip", z.ZodTypeAny, {
397
398
  name?: string | undefined;
398
399
  address?: string | undefined;
@@ -401,6 +402,7 @@ export declare const googlemapsNearbysearchOutputSchema: z.ZodObject<{
401
402
  openingHours?: string | undefined;
402
403
  primaryType?: string | undefined;
403
404
  editorialSummary?: string | undefined;
405
+ websiteUri?: string | undefined;
404
406
  }, {
405
407
  name?: string | undefined;
406
408
  address?: string | undefined;
@@ -409,6 +411,7 @@ export declare const googlemapsNearbysearchOutputSchema: z.ZodObject<{
409
411
  openingHours?: string | undefined;
410
412
  primaryType?: string | undefined;
411
413
  editorialSummary?: string | undefined;
414
+ websiteUri?: string | undefined;
412
415
  }>, "many">;
413
416
  }, "strip", z.ZodTypeAny, {
414
417
  results: {
@@ -419,6 +422,7 @@ export declare const googlemapsNearbysearchOutputSchema: z.ZodObject<{
419
422
  openingHours?: string | undefined;
420
423
  primaryType?: string | undefined;
421
424
  editorialSummary?: string | undefined;
425
+ websiteUri?: string | undefined;
422
426
  }[];
423
427
  }, {
424
428
  results: {
@@ -429,10 +433,11 @@ export declare const googlemapsNearbysearchOutputSchema: z.ZodObject<{
429
433
  openingHours?: string | undefined;
430
434
  primaryType?: string | undefined;
431
435
  editorialSummary?: string | undefined;
436
+ websiteUri?: string | undefined;
432
437
  }[];
433
438
  }>;
434
- export type googlemapsNearbysearchOutputType = z.infer<typeof googlemapsNearbysearchOutputSchema>;
435
- export type googlemapsNearbysearchFunction = ActionFunction<googlemapsNearbysearchParamsType, AuthParamsType, googlemapsNearbysearchOutputType>;
439
+ export type googlemapsNearbysearchRestaurantsOutputType = z.infer<typeof googlemapsNearbysearchRestaurantsOutputSchema>;
440
+ export type googlemapsNearbysearchRestaurantsFunction = ActionFunction<googlemapsNearbysearchRestaurantsParamsType, AuthParamsType, googlemapsNearbysearchRestaurantsOutputType>;
436
441
  export declare const credalCallCopilotParamsSchema: z.ZodObject<{
437
442
  agentId: z.ZodString;
438
443
  query: z.ZodString;
@@ -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.zendeskCreateZendeskTicketOutputSchema = exports.zendeskCreateZendeskTicketParamsSchema = exports.credalCallCopilotOutputSchema = exports.credalCallCopilotParamsSchema = exports.googlemapsNearbysearchOutputSchema = exports.googlemapsNearbysearchParamsSchema = 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.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(),
@@ -114,11 +114,11 @@ exports.googlemapsValidateAddressOutputSchema = zod_1.z.object({
114
114
  .describe("USPS-specific validation details.")
115
115
  .optional(),
116
116
  });
117
- exports.googlemapsNearbysearchParamsSchema = zod_1.z.object({
117
+ exports.googlemapsNearbysearchRestaurantsParamsSchema = zod_1.z.object({
118
118
  latitude: zod_1.z.number().describe("The latitude of the location to search nearby"),
119
119
  longitude: zod_1.z.number().describe("The longitude of the location to search nearby"),
120
120
  });
121
- exports.googlemapsNearbysearchOutputSchema = zod_1.z.object({
121
+ exports.googlemapsNearbysearchRestaurantsOutputSchema = zod_1.z.object({
122
122
  results: zod_1.z
123
123
  .array(zod_1.z.object({
124
124
  name: zod_1.z.string().describe("The name of the place").optional(),
@@ -128,6 +128,7 @@ exports.googlemapsNearbysearchOutputSchema = zod_1.z.object({
128
128
  openingHours: zod_1.z.string().describe("The opening hours of the place").optional(),
129
129
  primaryType: zod_1.z.string().describe("The primary type of the place").optional(),
130
130
  editorialSummary: zod_1.z.string().describe("The editorial summary of the place").optional(),
131
+ websiteUri: zod_1.z.string().describe("The website URI of the place").optional(),
131
132
  }))
132
133
  .describe("The results of the nearby search"),
133
134
  });
@@ -17,7 +17,7 @@ exports.ACTION_GROUPS = {
17
17
  },
18
18
  GOOGLE_MAPS: {
19
19
  description: "Action for interacting with Google Maps",
20
- actions: [templates_1.googlemapsValidateAddressDefinition, templates_1.googlemapsNearbysearchDefinition],
20
+ actions: [templates_1.googlemapsValidateAddressDefinition, templates_1.googlemapsNearbysearchRestaurantsDefinition],
21
21
  },
22
22
  CREDAL_CALL_COPILOT: {
23
23
  description: "Action for calling a Credal Copilot",
@@ -15,38 +15,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const axios_1 = __importDefault(require("axios"));
16
16
  const types_1 = require("../../autogen/types");
17
17
  const INCLUDED_TYPES = [
18
- "monument",
19
- "museum",
20
- "art_gallery",
21
- "sculpture",
22
- "cultural_landmark",
23
- "historical_place",
24
- "performing_arts_theater",
25
- "university",
26
- "aquarium",
27
- "botanical_garden",
28
- "comedy_club",
29
- "park",
30
- "movie_theater",
31
- "national_park",
32
- "garden",
33
- "night_club",
34
- "tourist_attraction",
35
- "water_park",
36
- "zoo",
37
- "bar",
18
+ // "monument",
19
+ // "museum",
20
+ // "art_gallery",
21
+ // "sculpture",
22
+ // "cultural_landmark",
23
+ // "historical_place",
24
+ // "performing_arts_theater",
25
+ // "university",
26
+ // "aquarium",
27
+ // "botanical_garden",
28
+ // "comedy_club",
29
+ // "park",
30
+ // "movie_theater",
31
+ // "national_park",
32
+ // "garden",
33
+ // "night_club",
34
+ // "tourist_attraction",
35
+ // "water_park",
36
+ // "zoo",
37
+ // "bar",
38
38
  "restaurant",
39
- "food_court",
40
- "bakery",
41
- "cafe",
42
- "coffee_shop",
43
- "pub",
44
- "wine_bar",
45
- "spa",
46
- "beach",
47
- "market",
48
- "shopping_mall",
49
- "stadium",
39
+ // "food_court",
40
+ // "bakery",
41
+ // "cafe",
42
+ // "coffee_shop",
43
+ // "pub",
44
+ // "wine_bar",
45
+ // "spa",
46
+ // "beach",
47
+ // "market",
48
+ // "shopping_mall",
49
+ // "stadium",
50
50
  ];
51
51
  const nearbysearch = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
52
52
  const url = `https://places.googleapis.com/v1/places:searchNearby`;
@@ -0,0 +1,3 @@
1
+ import { googlemapsNearbysearchRestaurantsFunction } from "../../autogen/types";
2
+ declare const nearbysearchRestaurants: googlemapsNearbysearchRestaurantsFunction;
3
+ export default nearbysearchRestaurants;
@@ -0,0 +1,65 @@
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
+ const types_1 = require("../../autogen/types");
17
+ const INCLUDED_TYPES = ["restaurant"];
18
+ const nearbysearchRestaurants = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
19
+ const url = `https://places.googleapis.com/v1/places:searchNearby`;
20
+ const fieldMask = [
21
+ "places.displayName",
22
+ "places.formattedAddress",
23
+ "places.priceLevel",
24
+ "places.rating",
25
+ "places.primaryTypeDisplayName",
26
+ "places.editorialSummary",
27
+ "places.regularOpeningHours",
28
+ "places.websiteUri",
29
+ ].join(",");
30
+ const response = yield axios_1.default.post(url, {
31
+ maxResultCount: 20,
32
+ includedTypes: INCLUDED_TYPES,
33
+ locationRestriction: {
34
+ circle: {
35
+ center: {
36
+ latitude: params.latitude,
37
+ longitude: params.longitude,
38
+ },
39
+ radius: 5000,
40
+ },
41
+ },
42
+ }, {
43
+ headers: {
44
+ "X-Goog-Api-Key": authParams.apiKey,
45
+ "X-Goog-FieldMask": fieldMask,
46
+ "Content-Type": "application/json",
47
+ },
48
+ });
49
+ return types_1.googlemapsNearbysearchRestaurantsOutputSchema.parse({
50
+ results: response.data.places.map((place) => {
51
+ var _a, _b;
52
+ return ({
53
+ name: place.displayName.text,
54
+ address: place.formattedAddress,
55
+ priceLevel: place.priceLevel,
56
+ rating: place.rating,
57
+ primaryType: place.primaryTypeDisplayName.text,
58
+ editorialSummary: ((_a = place.editorialSummary) === null || _a === void 0 ? void 0 : _a.text) || "",
59
+ openingHours: ((_b = place.regularOpeningHours) === null || _b === void 0 ? void 0 : _b.weekdayDescriptions.join("\n")) || "",
60
+ websiteUri: place.websiteUri,
61
+ });
62
+ }),
63
+ });
64
+ });
65
+ exports.default = nearbysearchRestaurants;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "AI Actions by Credal AI",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",