@credal/actions 0.2.29 → 0.2.31

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.
@@ -25,7 +25,7 @@ const searchRepository = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
25
25
  const { organization, repository, query } = params;
26
26
  // Search CODE with text match metadata
27
27
  const codeResultsResponse = yield octokit.rest.search.code({
28
- q: `${query} repo:${organization}/${repository}`,
28
+ q: `${query} in:file,path repo:${organization}/${repository}`,
29
29
  text_match: true,
30
30
  headers: {
31
31
  accept: "application/vnd.github.v3.text-match+json",
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { ApiError, axiosClient } from "../../util/axiosClient.js";
11
+ const MAX_RECORDS_LIMIT = 2000;
11
12
  const getSalesforceRecordsByQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
12
13
  const { authToken, baseUrl } = authParams;
13
14
  const { query, limit } = params;
@@ -17,8 +18,14 @@ const getSalesforceRecordsByQuery = (_a) => __awaiter(void 0, [_a], void 0, func
17
18
  error: "authToken and baseUrl are required for Salesforce API",
18
19
  };
19
20
  }
21
+ // Included a prepended space and an opening bracket to make sure these terms don't get confused
22
+ // with parts of other words.
23
+ const aggregateFunction = [" COUNT(", " SUM(", " AVG(", " MIN(", " MAX("];
24
+ const containsAggregateFunction = aggregateFunction.some(func => query.toUpperCase().includes(func));
20
25
  // The API limits the maximum number of records returned to 2000, the limit lets the user set a smaller custom limit
21
- const url = `${baseUrl}/services/data/v56.0/queryAll?q=${encodeURIComponent(query + " LIMIT " + (limit != undefined && limit <= 2000 ? limit : 2000))}`;
26
+ const url = `${baseUrl}/services/data/v56.0/queryAll?q=${encodeURIComponent(containsAggregateFunction
27
+ ? query
28
+ : query + " LIMIT " + (limit != undefined && limit <= MAX_RECORDS_LIMIT ? limit : MAX_RECORDS_LIMIT))}`;
22
29
  try {
23
30
  const response = yield axiosClient.get(url, {
24
31
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.2.29",
3
+ "version": "0.2.31",
4
4
  "type": "module",
5
5
  "description": "AI Actions by Credal AI",
6
6
  "sideEffects": false,