@erdoai/cli 0.214.0 → 0.216.0
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/index.js +32 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2123,6 +2123,16 @@ var ErdoClient = class {
|
|
|
2123
2123
|
const qs = schemaName ? `?schema_name=${encodeURIComponent(schemaName)}` : "";
|
|
2124
2124
|
return this.request("GET", `/v1/integrations/${encodeURIComponent(integration)}/tables${qs}`);
|
|
2125
2125
|
}
|
|
2126
|
+
searchIntegrationActions(query, app, limit) {
|
|
2127
|
+
const params = new URLSearchParams();
|
|
2128
|
+
if (query) params.set("query", query);
|
|
2129
|
+
if (app) params.set("app", app);
|
|
2130
|
+
if (limit !== void 0) params.set("limit", String(limit));
|
|
2131
|
+
return this.request("GET", `/v1/integration-actions?${params}`);
|
|
2132
|
+
}
|
|
2133
|
+
runIntegrationAction(app, key, input) {
|
|
2134
|
+
return this.request("POST", "/v1/integration-actions/run", { app, key, input });
|
|
2135
|
+
}
|
|
2126
2136
|
// `provided_by_organization_slug` marks a connection your manager
|
|
2127
2137
|
// organization lends to you rather than one this org connected. It is usable
|
|
2128
2138
|
// exactly like your own for as long as the management link lives, and is not
|
|
@@ -10492,6 +10502,28 @@ function printLead(lead) {
|
|
|
10492
10502
|
}
|
|
10493
10503
|
}
|
|
10494
10504
|
var integrationsCmd = program.command("integrations").description("Connect and inspect integrations");
|
|
10505
|
+
var integrationActionsCmd = integrationsCmd.command("actions").description("Search and run registered integration actions");
|
|
10506
|
+
integrationActionsCmd.command("search [query]").description("Find actions and their input schemas in your organization's integrations").option("--app <slug>", "limit search to an integration").option("--limit <number>", "maximum results (1\u2013100)").action(async (query, opts) => {
|
|
10507
|
+
try {
|
|
10508
|
+
const limit = opts.limit === void 0 ? void 0 : Number(opts.limit);
|
|
10509
|
+
if (limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > 100)) throw new Error("--limit must be an integer from 1 to 100");
|
|
10510
|
+
console.log(JSON.stringify(await new ErdoClient().searchIntegrationActions(query, opts.app, limit), null, 2));
|
|
10511
|
+
} catch (e) {
|
|
10512
|
+
fail(e);
|
|
10513
|
+
}
|
|
10514
|
+
});
|
|
10515
|
+
integrationActionsCmd.command("run <app> <key>").description("Run an action through the same approval and spend gates as an agent").option("--input <json>", "action input as a JSON object").option("--input-file <path>", "read the action input JSON object from a file").action(async (app, key, opts) => {
|
|
10516
|
+
try {
|
|
10517
|
+
if (opts.input === void 0 === (opts.inputFile === void 0)) throw new Error("provide exactly one of --input or --input-file");
|
|
10518
|
+
const input = JSON.parse(opts.input ?? readFileSync5(opts.inputFile, "utf8"));
|
|
10519
|
+
if (input === null || typeof input !== "object" || Array.isArray(input)) throw new Error("action input must be a JSON object");
|
|
10520
|
+
const result = await new ErdoClient().runIntegrationAction(app, key, input);
|
|
10521
|
+
console.log(JSON.stringify(result, null, 2));
|
|
10522
|
+
if (result.status !== "succeeded") process.exitCode = 1;
|
|
10523
|
+
} catch (e) {
|
|
10524
|
+
fail(e);
|
|
10525
|
+
}
|
|
10526
|
+
});
|
|
10495
10527
|
integrationsCmd.command("list").description("List connected integrations \u2014 app, status, auth type, name, then the connection's id (what --from-connection takes) and connector_account_id when available").action(async () => {
|
|
10496
10528
|
try {
|
|
10497
10529
|
const { integrations } = await new ErdoClient().listIntegrations();
|