@credal/actions 0.1.18 → 0.1.20

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.
Files changed (35) hide show
  1. package/README.md +4 -1
  2. package/dist/actions/autogen/templates.js +81 -0
  3. package/dist/actions/autogen/types.d.ts +104 -0
  4. package/dist/actions/autogen/types.js +38 -0
  5. package/dist/actions/parse.js +1 -0
  6. package/dist/actions/providers/confluence/updatePage.js +9 -13
  7. package/dist/actions/providers/credal/callCopilot.js +2 -0
  8. package/dist/actions/providers/finnhub/getBasicFinancials.js +2 -5
  9. package/dist/actions/providers/finnhub/symbolLookup.js +2 -5
  10. package/dist/actions/providers/google-oauth/createNewGoogleDoc.js +32 -44
  11. package/dist/actions/providers/googlemaps/nearbysearch.js +31 -31
  12. package/dist/actions/providers/googlemaps/nearbysearchRestaurants.js +2 -5
  13. package/dist/actions/providers/googlemaps/validateAddress.js +2 -5
  14. package/dist/actions/providers/jira/createJiraTicket.js +35 -47
  15. package/dist/actions/providers/nws/getForecastForLocation.js +3 -6
  16. package/dist/actions/providers/openstreetmap/getLatitudeLongitudeFromLocation.js +2 -5
  17. package/dist/actions/providers/x/createXSharePostUrl.js +4 -1
  18. package/dist/actions/providers/x/scrapeTweetDataWithNitter.d.ts +3 -0
  19. package/dist/actions/providers/x/scrapeTweetDataWithNitter.js +45 -0
  20. package/dist/actions/providers/zendesk/createZendeskTicket.js +2 -5
  21. package/dist/actions/util/axiosClient.d.ts +7 -0
  22. package/dist/actions/util/axiosClient.js +46 -0
  23. package/package.json +1 -1
  24. package/dist/actions/autogen/definitions.d.ts +0 -5
  25. package/dist/actions/autogen/definitions.js +0 -132
  26. package/dist/actions/definitions.js +0 -35
  27. package/dist/actions/invokeMapper.d.ts +0 -9
  28. package/dist/actions/invokeMapper.js +0 -33
  29. package/dist/actions/providers/jira/createTicket.d.ts +0 -3
  30. package/dist/actions/providers/jira/createTicket.js +0 -34
  31. package/dist/actions/providers/slack/list_conversations.d.ts +0 -3
  32. package/dist/actions/providers/slack/list_conversations.js +0 -60
  33. package/dist/actions/schema.js +0 -6
  34. package/dist/actions/types.js +0 -2
  35. package/dist/main.js +0 -11
package/README.md CHANGED
@@ -1,4 +1,7 @@
1
- # actions
1
+ ![Credal Logo](assets/credal-logo.svg)
2
+
3
+ ## Credal.ai's Open Source Actions Framework
4
+ Easily add custom actions for your Credal Copilots. Read more about Credal's Agent platform [here](https://www.credal.ai/products/ai-agent-platform).
2
5
 
3
6
  ## Adding or updating actions
4
7
 
@@ -149,6 +149,11 @@ exports.jiraCreateJiraTicketDefinition = {
149
149
  type: "string",
150
150
  description: "The assignee for the new ticket creation",
151
151
  },
152
+ customFields: {
153
+ type: "object",
154
+ description: "Custom fields to be set on the create ticket request",
155
+ additionalProperties: true,
156
+ },
152
157
  },
153
158
  },
154
159
  output: {
@@ -427,6 +432,82 @@ exports.credalCallCopilotDefinition = {
427
432
  type: "string",
428
433
  description: "The response from the Credal Copilot",
429
434
  },
435
+ referencedSources: {
436
+ type: "array",
437
+ description: "The sources referenced in the response",
438
+ items: {
439
+ type: "object",
440
+ description: "The source referenced in the response",
441
+ required: ["id", "externalResourceId", "name"],
442
+ properties: {
443
+ id: {
444
+ type: "string",
445
+ description: "The id of the source",
446
+ },
447
+ externalResourceId: {
448
+ type: "object",
449
+ required: ["externalResourceId", "resourceType"],
450
+ description: "The external resource id of the source",
451
+ properties: {
452
+ externalResourceId: {
453
+ type: "string",
454
+ description: "The external resource id of the source",
455
+ },
456
+ resourceType: {
457
+ type: "string",
458
+ description: "The type of the resource",
459
+ },
460
+ },
461
+ },
462
+ name: {
463
+ type: "string",
464
+ description: "The name of the source",
465
+ },
466
+ url: {
467
+ type: "string",
468
+ description: "The url of the source",
469
+ },
470
+ },
471
+ },
472
+ },
473
+ sourcesInDataContext: {
474
+ type: "array",
475
+ description: "The sources in the data context of the response",
476
+ items: {
477
+ type: "object",
478
+ description: "The source in the data context of the response",
479
+ required: ["id", "externalResourceId", "name"],
480
+ properties: {
481
+ id: {
482
+ type: "string",
483
+ description: "The id of the source",
484
+ },
485
+ externalResourceId: {
486
+ type: "object",
487
+ description: "The external resource id of the source",
488
+ required: ["externalResourceId", "resourceType"],
489
+ properties: {
490
+ externalResourceId: {
491
+ type: "string",
492
+ description: "The external resource id of the source",
493
+ },
494
+ resourceType: {
495
+ type: "string",
496
+ description: "The type of the resource",
497
+ },
498
+ },
499
+ },
500
+ name: {
501
+ type: "string",
502
+ description: "The name of the source",
503
+ },
504
+ url: {
505
+ type: "string",
506
+ description: "The url of the source",
507
+ },
508
+ },
509
+ },
510
+ },
430
511
  },
431
512
  },
432
513
  name: "callCopilot",
@@ -12,6 +12,7 @@ export declare const AuthParamsSchema: z.ZodObject<{
12
12
  emailFrom: z.ZodOptional<z.ZodString>;
13
13
  emailReplyTo: z.ZodOptional<z.ZodString>;
14
14
  emailBcc: z.ZodOptional<z.ZodString>;
15
+ cloudId: z.ZodOptional<z.ZodString>;
15
16
  }, "strip", z.ZodTypeAny, {
16
17
  username?: string | undefined;
17
18
  authToken?: string | undefined;
@@ -21,6 +22,7 @@ export declare const AuthParamsSchema: z.ZodObject<{
21
22
  emailFrom?: string | undefined;
22
23
  emailReplyTo?: string | undefined;
23
24
  emailBcc?: string | undefined;
25
+ cloudId?: string | undefined;
24
26
  }, {
25
27
  username?: string | undefined;
26
28
  authToken?: string | undefined;
@@ -30,6 +32,7 @@ export declare const AuthParamsSchema: z.ZodObject<{
30
32
  emailFrom?: string | undefined;
31
33
  emailReplyTo?: string | undefined;
32
34
  emailBcc?: string | undefined;
35
+ cloudId?: string | undefined;
33
36
  }>;
34
37
  export type AuthParamsType = z.infer<typeof AuthParamsSchema>;
35
38
  export declare const slackSendMessageParamsSchema: z.ZodObject<{
@@ -129,6 +132,7 @@ export declare const jiraCreateJiraTicketParamsSchema: z.ZodObject<{
129
132
  issueType: z.ZodString;
130
133
  reporter: z.ZodOptional<z.ZodString>;
131
134
  assignee: z.ZodOptional<z.ZodString>;
135
+ customFields: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodAny, z.objectOutputType<{}, z.ZodAny, "strip">, z.objectInputType<{}, z.ZodAny, "strip">>>;
132
136
  }, "strip", z.ZodTypeAny, {
133
137
  description: string;
134
138
  projectKey: string;
@@ -136,6 +140,7 @@ export declare const jiraCreateJiraTicketParamsSchema: z.ZodObject<{
136
140
  issueType: string;
137
141
  reporter?: string | undefined;
138
142
  assignee?: string | undefined;
143
+ customFields?: z.objectOutputType<{}, z.ZodAny, "strip"> | undefined;
139
144
  }, {
140
145
  description: string;
141
146
  projectKey: string;
@@ -143,6 +148,7 @@ export declare const jiraCreateJiraTicketParamsSchema: z.ZodObject<{
143
148
  issueType: string;
144
149
  reporter?: string | undefined;
145
150
  assignee?: string | undefined;
151
+ customFields?: z.objectInputType<{}, z.ZodAny, "strip"> | undefined;
146
152
  }>;
147
153
  export type jiraCreateJiraTicketParamsType = z.infer<typeof jiraCreateJiraTicketParamsSchema>;
148
154
  export declare const jiraCreateJiraTicketOutputSchema: z.ZodObject<{
@@ -457,10 +463,108 @@ export declare const credalCallCopilotParamsSchema: z.ZodObject<{
457
463
  export type credalCallCopilotParamsType = z.infer<typeof credalCallCopilotParamsSchema>;
458
464
  export declare const credalCallCopilotOutputSchema: z.ZodObject<{
459
465
  response: z.ZodString;
466
+ referencedSources: z.ZodOptional<z.ZodArray<z.ZodObject<{
467
+ id: z.ZodString;
468
+ externalResourceId: z.ZodObject<{
469
+ externalResourceId: z.ZodString;
470
+ resourceType: z.ZodString;
471
+ }, "strip", z.ZodTypeAny, {
472
+ externalResourceId: string;
473
+ resourceType: string;
474
+ }, {
475
+ externalResourceId: string;
476
+ resourceType: string;
477
+ }>;
478
+ name: z.ZodString;
479
+ url: z.ZodOptional<z.ZodString>;
480
+ }, "strip", z.ZodTypeAny, {
481
+ name: string;
482
+ id: string;
483
+ externalResourceId: {
484
+ externalResourceId: string;
485
+ resourceType: string;
486
+ };
487
+ url?: string | undefined;
488
+ }, {
489
+ name: string;
490
+ id: string;
491
+ externalResourceId: {
492
+ externalResourceId: string;
493
+ resourceType: string;
494
+ };
495
+ url?: string | undefined;
496
+ }>, "many">>;
497
+ sourcesInDataContext: z.ZodOptional<z.ZodArray<z.ZodObject<{
498
+ id: z.ZodString;
499
+ externalResourceId: z.ZodObject<{
500
+ externalResourceId: z.ZodString;
501
+ resourceType: z.ZodString;
502
+ }, "strip", z.ZodTypeAny, {
503
+ externalResourceId: string;
504
+ resourceType: string;
505
+ }, {
506
+ externalResourceId: string;
507
+ resourceType: string;
508
+ }>;
509
+ name: z.ZodString;
510
+ url: z.ZodOptional<z.ZodString>;
511
+ }, "strip", z.ZodTypeAny, {
512
+ name: string;
513
+ id: string;
514
+ externalResourceId: {
515
+ externalResourceId: string;
516
+ resourceType: string;
517
+ };
518
+ url?: string | undefined;
519
+ }, {
520
+ name: string;
521
+ id: string;
522
+ externalResourceId: {
523
+ externalResourceId: string;
524
+ resourceType: string;
525
+ };
526
+ url?: string | undefined;
527
+ }>, "many">>;
460
528
  }, "strip", z.ZodTypeAny, {
461
529
  response: string;
530
+ referencedSources?: {
531
+ name: string;
532
+ id: string;
533
+ externalResourceId: {
534
+ externalResourceId: string;
535
+ resourceType: string;
536
+ };
537
+ url?: string | undefined;
538
+ }[] | undefined;
539
+ sourcesInDataContext?: {
540
+ name: string;
541
+ id: string;
542
+ externalResourceId: {
543
+ externalResourceId: string;
544
+ resourceType: string;
545
+ };
546
+ url?: string | undefined;
547
+ }[] | undefined;
462
548
  }, {
463
549
  response: string;
550
+ referencedSources?: {
551
+ name: string;
552
+ id: string;
553
+ externalResourceId: {
554
+ externalResourceId: string;
555
+ resourceType: string;
556
+ };
557
+ url?: string | undefined;
558
+ }[] | undefined;
559
+ sourcesInDataContext?: {
560
+ name: string;
561
+ id: string;
562
+ externalResourceId: {
563
+ externalResourceId: string;
564
+ resourceType: string;
565
+ };
566
+ url?: string | undefined;
567
+ }[] | undefined;
464
568
  }>;
465
569
  export type credalCallCopilotOutputType = z.infer<typeof credalCallCopilotOutputSchema>;
466
570
  export type credalCallCopilotFunction = ActionFunction<credalCallCopilotParamsType, AuthParamsType, credalCallCopilotOutputType>;
@@ -11,6 +11,7 @@ exports.AuthParamsSchema = zod_1.z.object({
11
11
  emailFrom: zod_1.z.string().optional(),
12
12
  emailReplyTo: zod_1.z.string().optional(),
13
13
  emailBcc: zod_1.z.string().optional(),
14
+ cloudId: zod_1.z.string().optional(),
14
15
  });
15
16
  exports.slackSendMessageParamsSchema = zod_1.z.object({
16
17
  channelName: zod_1.z.string().describe("The name of the Slack channel to send the message to (e.g. general, alerts)"),
@@ -49,6 +50,11 @@ exports.jiraCreateJiraTicketParamsSchema = zod_1.z.object({
49
50
  issueType: zod_1.z.string().describe("The issue type of the new ticket"),
50
51
  reporter: zod_1.z.string().describe("The reporter for the new ticket creation").optional(),
51
52
  assignee: zod_1.z.string().describe("The assignee for the new ticket creation").optional(),
53
+ customFields: zod_1.z
54
+ .object({})
55
+ .catchall(zod_1.z.any())
56
+ .describe("Custom fields to be set on the create ticket request")
57
+ .optional(),
52
58
  });
53
59
  exports.jiraCreateJiraTicketOutputSchema = zod_1.z.object({
54
60
  ticketUrl: zod_1.z.string().describe("The url to the created Jira Ticket"),
@@ -140,6 +146,38 @@ exports.credalCallCopilotParamsSchema = zod_1.z.object({
140
146
  });
141
147
  exports.credalCallCopilotOutputSchema = zod_1.z.object({
142
148
  response: zod_1.z.string().describe("The response from the Credal Copilot"),
149
+ referencedSources: zod_1.z
150
+ .array(zod_1.z
151
+ .object({
152
+ id: zod_1.z.string().describe("The id of the source"),
153
+ externalResourceId: zod_1.z
154
+ .object({
155
+ externalResourceId: zod_1.z.string().describe("The external resource id of the source"),
156
+ resourceType: zod_1.z.string().describe("The type of the resource"),
157
+ })
158
+ .describe("The external resource id of the source"),
159
+ name: zod_1.z.string().describe("The name of the source"),
160
+ url: zod_1.z.string().describe("The url of the source").optional(),
161
+ })
162
+ .describe("The source referenced in the response"))
163
+ .describe("The sources referenced in the response")
164
+ .optional(),
165
+ sourcesInDataContext: zod_1.z
166
+ .array(zod_1.z
167
+ .object({
168
+ id: zod_1.z.string().describe("The id of the source"),
169
+ externalResourceId: zod_1.z
170
+ .object({
171
+ externalResourceId: zod_1.z.string().describe("The external resource id of the source"),
172
+ resourceType: zod_1.z.string().describe("The type of the resource"),
173
+ })
174
+ .describe("The external resource id of the source"),
175
+ name: zod_1.z.string().describe("The name of the source"),
176
+ url: zod_1.z.string().describe("The url of the source").optional(),
177
+ })
178
+ .describe("The source in the data context of the response"))
179
+ .describe("The sources in the data context of the response")
180
+ .optional(),
143
181
  });
144
182
  exports.zendeskCreateZendeskTicketParamsSchema = zod_1.z.object({
145
183
  subject: zod_1.z.string().describe("The subject of the ticket"),
@@ -48,6 +48,7 @@ z.object({
48
48
  emailFrom: z.string().optional(),
49
49
  emailReplyTo: z.string().optional(),
50
50
  emailBcc: z.string().optional(),
51
+ cloudId: z.string().optional(),
51
52
  })
52
53
  `;
53
54
  function validateObject(object) {
@@ -8,30 +8,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const axios_1 = __importDefault(require("axios"));
16
- function getConfluenceApi(baseUrl, username, apiToken) {
17
- const api = axios_1.default.create({
12
+ const axiosClient_1 = require("../../util/axiosClient");
13
+ function getConfluenceRequestConfig(baseUrl, username, apiToken) {
14
+ return {
18
15
  baseURL: baseUrl,
19
16
  headers: {
20
17
  Accept: "application/json",
21
- // Tokens are associated with a specific user.
22
18
  Authorization: `Basic ${Buffer.from(`${username}:${apiToken}`).toString("base64")}`,
23
19
  },
24
- });
25
- return api;
20
+ };
26
21
  }
27
22
  const confluenceUpdatePage = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
28
23
  const { pageId, username, content, title } = params;
29
24
  const { baseUrl, authToken } = authParams;
30
- const api = getConfluenceApi(baseUrl, username, authToken);
25
+ const config = getConfluenceRequestConfig(baseUrl, username, authToken);
31
26
  // Get current version number
32
- const response = yield api.get(`/api/v2/pages/${pageId}`);
27
+ const response = yield axiosClient_1.axiosClient.get(`/api/v2/pages/${pageId}`, config);
33
28
  const currVersion = response.data.version.number;
34
- yield api.put(`/api/v2/pages/${pageId}`, {
29
+ const payload = {
35
30
  id: pageId,
36
31
  status: "current",
37
32
  title,
@@ -42,6 +37,7 @@ const confluenceUpdatePage = (_a) => __awaiter(void 0, [_a], void 0, function* (
42
37
  version: {
43
38
  number: currVersion + 1,
44
39
  },
45
- });
40
+ };
41
+ yield axiosClient_1.axiosClient.put(`/api/v2/pages/${pageId}`, payload, config);
46
42
  });
47
43
  exports.default = confluenceUpdatePage;
@@ -28,6 +28,8 @@ const callCopilot = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
28
28
  response: response.sendChatResult.type === "ai_response_result"
29
29
  ? response.sendChatResult.response.message
30
30
  : "Error getting response",
31
+ referencedSources: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.referencedSources : [],
32
+ sourcesInDataContext: response.sendChatResult.type === "ai_response_result" ? response.sendChatResult.sourcesInDataContext : [],
31
33
  };
32
34
  });
33
35
  exports.default = callCopilot;
@@ -8,12 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  const types_1 = require("../../autogen/types");
16
- const axios_1 = __importDefault(require("axios"));
13
+ const axiosClient_1 = require("../../util/axiosClient");
17
14
  function transformData(data) {
18
15
  return Object.entries(data).map(([key, value]) => ({
19
16
  metric: key,
@@ -29,7 +26,7 @@ function transformData(data) {
29
26
  const getBasicFinancials = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
30
27
  try {
31
28
  const apiKey = authParams.apiKey;
32
- const result = yield axios_1.default.get(`https://finnhub.io/api/v1/stock/metric?symbol=${params.symbol}`, {
29
+ const result = yield axiosClient_1.axiosClient.get(`https://finnhub.io/api/v1/stock/metric?symbol=${params.symbol}`, {
33
30
  headers: {
34
31
  "X-Finnhub-Token": apiKey,
35
32
  },
@@ -8,16 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  const types_1 = require("../../autogen/types");
16
- const axios_1 = __importDefault(require("axios"));
13
+ const axiosClient_1 = require("../../util/axiosClient");
17
14
  const symbolLookup = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
18
15
  try {
19
16
  const apiKey = authParams.apiKey;
20
- const result = yield axios_1.default.get(`https://finnhub.io/api/v1/search?q=${params.query}`, {
17
+ const result = yield axiosClient_1.axiosClient.get(`https://finnhub.io/api/v1/search?q=${params.query}`, {
21
18
  headers: {
22
19
  "X-Finnhub-Token": apiKey,
23
20
  },
@@ -8,63 +8,51 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const axios_1 = __importDefault(require("axios"));
12
+ const axiosClient_1 = require("../../util/axiosClient");
16
13
  /**
17
14
  * Creates a new Google Doc document using OAuth authentication
18
15
  */
19
16
  const createNewGoogleDoc = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
20
- var _b, _c, _d;
21
17
  if (!authParams.authToken) {
22
18
  throw new Error("authToken is required for Google Docs API");
23
19
  }
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 }, {
20
+ const { title, content } = params;
21
+ const baseApiUrl = "https://docs.googleapis.com/v1/documents";
22
+ // Create the document with the provided title
23
+ const response = yield axiosClient_1.axiosClient.post(baseApiUrl, { title }, {
24
+ headers: {
25
+ Authorization: `Bearer ${authParams.authToken}`,
26
+ "Content-Type": "application/json",
27
+ },
28
+ });
29
+ // If content is provided, update the document body with the content
30
+ if (content) {
31
+ const documentId = response.data.documentId;
32
+ // Add the description to the document content
33
+ yield axiosClient_1.axiosClient.post(`${baseApiUrl}/${documentId}:batchUpdate`, {
34
+ requests: [
35
+ {
36
+ insertText: {
37
+ location: {
38
+ index: 1, // Insert at the beginning of the document
39
+ },
40
+ text: content,
41
+ },
42
+ },
43
+ ],
44
+ }, {
29
45
  headers: {
30
46
  Authorization: `Bearer ${authParams.authToken}`,
31
47
  "Content-Type": "application/json",
32
48
  },
33
49
  });
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
50
  }
51
+ return {
52
+ documentId: response.data.documentId,
53
+ documentUrl: response.data.documentId
54
+ ? `https://docs.google.com/document/d/${response.data.documentId}/edit`
55
+ : undefined,
56
+ };
69
57
  });
70
58
  exports.default = createNewGoogleDoc;
@@ -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`;
@@ -8,12 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const axios_1 = __importDefault(require("axios"));
16
12
  const types_1 = require("../../autogen/types");
13
+ const axiosClient_1 = require("../../util/axiosClient");
17
14
  const INCLUDED_TYPES = ["restaurant"];
18
15
  const nearbysearchRestaurants = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
19
16
  const url = `https://places.googleapis.com/v1/places:searchNearby`;
@@ -27,7 +24,7 @@ const nearbysearchRestaurants = (_a) => __awaiter(void 0, [_a], void 0, function
27
24
  "places.regularOpeningHours",
28
25
  "places.websiteUri",
29
26
  ].join(",");
30
- const response = yield axios_1.default.post(url, {
27
+ const response = yield axiosClient_1.axiosClient.post(url, {
31
28
  maxResultCount: 20,
32
29
  includedTypes: INCLUDED_TYPES,
33
30
  locationRestriction: {
@@ -8,11 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const axios_1 = __importDefault(require("axios"));
12
+ const axiosClient_1 = require("../../util/axiosClient");
16
13
  const validateAddress = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
17
14
  const url = `https://addressvalidation.googleapis.com/v1:validateAddress?key=${authParams.apiKey}`;
18
15
  const requestBody = {
@@ -20,7 +17,7 @@ const validateAddress = (_a) => __awaiter(void 0, [_a], void 0, function* ({ par
20
17
  addressLines: [...params.addressLines, params.locality, params.regionCode, params.postalCode],
21
18
  },
22
19
  };
23
- const response = yield axios_1.default.post(url, requestBody, {
20
+ const response = yield axiosClient_1.axiosClient.post(url, requestBody, {
24
21
  headers: {
25
22
  "Content-Type": "application/json",
26
23
  },