@credal/actions 0.1.55 → 0.1.57
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.
- package/dist/actions/autogen/templates.js +4 -0
- package/dist/actions/autogen/types.d.ts +3 -0
- package/dist/actions/autogen/types.js +1 -0
- package/dist/actions/providers/github/listPullRequests.js +4 -8
- package/dist/actions/providers/salesforce/createRecord.js +5 -1
- package/dist/actions/providers/snowflake/runSnowflakeQuery.js +4 -1
- package/package.json +1 -1
@@ -1462,6 +1462,10 @@ exports.snowflakeRunSnowflakeQueryDefinition = {
|
|
1462
1462
|
description: "The format of the output",
|
1463
1463
|
enum: ["json", "csv"],
|
1464
1464
|
},
|
1465
|
+
limit: {
|
1466
|
+
type: "number",
|
1467
|
+
description: "A limit on the number of rows to return",
|
1468
|
+
},
|
1465
1469
|
},
|
1466
1470
|
},
|
1467
1471
|
output: {
|
@@ -1263,17 +1263,20 @@ export declare const snowflakeRunSnowflakeQueryParamsSchema: z.ZodObject<{
|
|
1263
1263
|
query: z.ZodString;
|
1264
1264
|
accountName: z.ZodString;
|
1265
1265
|
outputFormat: z.ZodOptional<z.ZodEnum<["json", "csv"]>>;
|
1266
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
1266
1267
|
}, "strip", z.ZodTypeAny, {
|
1267
1268
|
query: string;
|
1268
1269
|
databaseName: string;
|
1269
1270
|
accountName: string;
|
1270
1271
|
warehouse: string;
|
1272
|
+
limit?: number | undefined;
|
1271
1273
|
outputFormat?: "json" | "csv" | undefined;
|
1272
1274
|
}, {
|
1273
1275
|
query: string;
|
1274
1276
|
databaseName: string;
|
1275
1277
|
accountName: string;
|
1276
1278
|
warehouse: string;
|
1279
|
+
limit?: number | undefined;
|
1277
1280
|
outputFormat?: "json" | "csv" | undefined;
|
1278
1281
|
}>;
|
1279
1282
|
export type snowflakeRunSnowflakeQueryParamsType = z.infer<typeof snowflakeRunSnowflakeQueryParamsSchema>;
|
@@ -438,6 +438,7 @@ exports.snowflakeRunSnowflakeQueryParamsSchema = zod_1.z.object({
|
|
438
438
|
query: zod_1.z.string().describe("The SQL query to execute"),
|
439
439
|
accountName: zod_1.z.string().describe("The name of the Snowflake account"),
|
440
440
|
outputFormat: zod_1.z.enum(["json", "csv"]).describe("The format of the output").optional(),
|
441
|
+
limit: zod_1.z.number().describe("A limit on the number of rows to return").optional(),
|
441
442
|
});
|
442
443
|
exports.snowflakeRunSnowflakeQueryOutputSchema = zod_1.z.object({
|
443
444
|
format: zod_1.z.enum(["json", "csv"]).describe("The format of the output"),
|
@@ -16,10 +16,8 @@ const axios_1 = __importDefault(require("axios"));
|
|
16
16
|
const types_1 = require("../../autogen/types");
|
17
17
|
const listPullRequests = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
18
18
|
const { authToken } = authParams;
|
19
|
-
const { repositoryName, repositoryOwner } = params;
|
19
|
+
const { repositoryName, repositoryOwner, state } = params;
|
20
20
|
const url = `https://api.github.com/repos/${repositoryOwner}/${repositoryName}/pulls`;
|
21
|
-
const oneYearAgo = new Date();
|
22
|
-
oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);
|
23
21
|
const allPulls = [];
|
24
22
|
let page = 1;
|
25
23
|
const perPage = 100;
|
@@ -31,7 +29,7 @@ const listPullRequests = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
31
29
|
"X-GitHub-Api-Version": "2022-11-28",
|
32
30
|
},
|
33
31
|
params: {
|
34
|
-
state: "all",
|
32
|
+
state: state !== null && state !== void 0 ? state : "all",
|
35
33
|
sort: "created",
|
36
34
|
direction: "desc",
|
37
35
|
per_page: perPage,
|
@@ -41,11 +39,9 @@ const listPullRequests = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pa
|
|
41
39
|
const pulls = response.data;
|
42
40
|
if (pulls.length === 0)
|
43
41
|
break;
|
44
|
-
|
45
|
-
const recentPulls = pulls.filter(pr => pr.createdAt && new Date(pr.createdAt) >= oneYearAgo);
|
46
|
-
allPulls.push(...recentPulls);
|
42
|
+
allPulls.push(...pulls);
|
47
43
|
// Stop if the rest are older than one year
|
48
|
-
if (
|
44
|
+
if (pulls.length < perPage)
|
49
45
|
break;
|
50
46
|
page++;
|
51
47
|
}
|
@@ -36,7 +36,11 @@ const createRecord = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params
|
|
36
36
|
console.error("Error creating Salesforce object:", error);
|
37
37
|
return {
|
38
38
|
success: false,
|
39
|
-
error: error instanceof
|
39
|
+
error: error instanceof axiosClient_1.ApiError
|
40
|
+
? error.data.length > 0
|
41
|
+
? error.data[0].message
|
42
|
+
: error.message
|
43
|
+
: "An unknown error occurred",
|
40
44
|
};
|
41
45
|
}
|
42
46
|
});
|
@@ -17,7 +17,7 @@ const getSnowflakeConnection_1 = require("./auth/getSnowflakeConnection");
|
|
17
17
|
const formatDataForCodeInterpreter_1 = require("../../util/formatDataForCodeInterpreter");
|
18
18
|
snowflake_sdk_1.default.configure({ logLevel: "ERROR" });
|
19
19
|
const runSnowflakeQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, authParams, }) {
|
20
|
-
const { databaseName, warehouse, query, accountName, outputFormat = "json" } = params;
|
20
|
+
const { databaseName, warehouse, query, accountName, outputFormat = "json", limit } = params;
|
21
21
|
if (!accountName || !databaseName || !warehouse || !query) {
|
22
22
|
throw new Error("Missing required parameters for Snowflake query");
|
23
23
|
}
|
@@ -36,6 +36,9 @@ const runSnowflakeQuery = (_a) => __awaiter(void 0, [_a], void 0, function* ({ p
|
|
36
36
|
});
|
37
37
|
});
|
38
38
|
// Format the results based on the output format
|
39
|
+
if (limit && queryResults.length - 1 > limit) {
|
40
|
+
queryResults.splice(limit + 1); // Include header
|
41
|
+
}
|
39
42
|
const { formattedData, resultsLength } = (0, formatDataForCodeInterpreter_1.formatDataForCodeInterpreter)(queryResults, outputFormat);
|
40
43
|
return { formattedData, resultsLength };
|
41
44
|
});
|