@erdoai/cli 0.134.0 → 0.136.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 +57 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1189,6 +1189,15 @@ var ErdoClient = class {
|
|
|
1189
1189
|
const qs = q.toString();
|
|
1190
1190
|
return this.request("GET", `/v1/datasets${qs ? `?${qs}` : ""}`);
|
|
1191
1191
|
}
|
|
1192
|
+
listDatasetUserPermissions(slug) {
|
|
1193
|
+
return this.request("GET", `/v1/datasets/${encodeURIComponent(slug)}/permissions/users`);
|
|
1194
|
+
}
|
|
1195
|
+
setDatasetUserPermission(slug, userID, level) {
|
|
1196
|
+
return this.request("PUT", `/v1/datasets/${encodeURIComponent(slug)}/permissions/users/${encodeURIComponent(userID)}`, { level });
|
|
1197
|
+
}
|
|
1198
|
+
removeDatasetUserPermission(slug, userID) {
|
|
1199
|
+
return this.request("DELETE", `/v1/datasets/${encodeURIComponent(slug)}/permissions/users/${encodeURIComponent(userID)}`);
|
|
1200
|
+
}
|
|
1192
1201
|
// The org's dataset vocabulary: every purpose in use, its current dataset,
|
|
1193
1202
|
// and the declared producer contract on that same dataset.
|
|
1194
1203
|
// scope="managed" reads the same across every client organization a manager
|
|
@@ -1668,6 +1677,9 @@ var ErdoClient = class {
|
|
|
1668
1677
|
`/v1/event-pipelines/${encodeURIComponent(slug)}/executions${qs ? `?${qs}` : ""}`
|
|
1669
1678
|
);
|
|
1670
1679
|
}
|
|
1680
|
+
markEventPipelineExecutionsHandled(slug, body) {
|
|
1681
|
+
return this.request("POST", `/v1/event-pipelines/${encodeURIComponent(slug)}/executions/handled`, body);
|
|
1682
|
+
}
|
|
1671
1683
|
// --- knowledge ---
|
|
1672
1684
|
getKnowledge(id) {
|
|
1673
1685
|
return this.request("GET", `/v1/knowledge/${encodeURIComponent(id)}`);
|
|
@@ -6869,6 +6881,40 @@ voiceAgentsCmd.command("whatsapp-replies <slug>").description("Turn a voice agen
|
|
|
6869
6881
|
}
|
|
6870
6882
|
});
|
|
6871
6883
|
var datasetsCmd = program.command("datasets").description("Datasets");
|
|
6884
|
+
var datasetPermissionsCmd = datasetsCmd.command("permissions").description("Manage dataset user permissions");
|
|
6885
|
+
datasetPermissionsCmd.command("list <slug>").option("--json", "output raw JSON").action(async (slug, opts) => {
|
|
6886
|
+
try {
|
|
6887
|
+
const result = await new ErdoClient().listDatasetUserPermissions(slug);
|
|
6888
|
+
if (opts.json) print(result);
|
|
6889
|
+
else for (const p of result.permissions) console.log(`${p.user_id} ${p.level}`);
|
|
6890
|
+
} catch (e) {
|
|
6891
|
+
fail(e);
|
|
6892
|
+
}
|
|
6893
|
+
});
|
|
6894
|
+
datasetPermissionsCmd.command("set-user <slug> <user-id>").requiredOption("--level <view|edit|admin>", "permission level").option("--json", "output raw JSON").action(async (slug, userID, opts) => {
|
|
6895
|
+
try {
|
|
6896
|
+
if (!["view", "edit", "admin"].includes(opts.level)) throw new Error("--level must be view, edit, or admin");
|
|
6897
|
+
const result = await new ErdoClient().setDatasetUserPermission(slug, userID, opts.level);
|
|
6898
|
+
if (opts.json) print(result);
|
|
6899
|
+
else console.log(`${result.user_id} ${result.level}`);
|
|
6900
|
+
if (result.user_id.toLowerCase() !== userID.toLowerCase() || result.level !== opts.level) {
|
|
6901
|
+
console.error("Readback does not match the requested dataset user grant");
|
|
6902
|
+
process.exitCode = 1;
|
|
6903
|
+
}
|
|
6904
|
+
} catch (e) {
|
|
6905
|
+
fail(e);
|
|
6906
|
+
}
|
|
6907
|
+
});
|
|
6908
|
+
datasetPermissionsCmd.command("remove-user <slug> <user-id>").option("--json", "output raw JSON").action(async (slug, userID, opts) => {
|
|
6909
|
+
try {
|
|
6910
|
+
const result = await new ErdoClient().removeDatasetUserPermission(slug, userID);
|
|
6911
|
+
if (opts.json) print(result);
|
|
6912
|
+
else console.log(result.direct_grant_absent ? "no direct user grant remains" : "direct grant absence was not verified");
|
|
6913
|
+
if (result.inherited_access_may_remain) console.error("inherited access may remain");
|
|
6914
|
+
} catch (e) {
|
|
6915
|
+
fail(e);
|
|
6916
|
+
}
|
|
6917
|
+
});
|
|
6872
6918
|
datasetsCmd.command("list").description("List datasets").option(
|
|
6873
6919
|
"--class <class>",
|
|
6874
6920
|
"filter by structural class: 'table' or 'scratch', or 'all' to include scratch analysis by-products (default hides scratch)"
|
|
@@ -8666,6 +8712,17 @@ pipelinesCmd.command("executions <slug>").description("Show an event pipeline's
|
|
|
8666
8712
|
fail(e);
|
|
8667
8713
|
}
|
|
8668
8714
|
});
|
|
8715
|
+
pipelinesCmd.command("mark-handled <slug>").description("Record that failed executions have been dealt with").requiredOption("--note <text>", "explanation, up to 500 characters").option("--through <iso>", "inclusive RFC3339 receipt-time cutoff (default: now)").option("--execution <id>", "execution UUID; repeat to select specific executions instead of a cutoff", (id, ids) => [...ids, id], []).action(async (slug, opts) => {
|
|
8716
|
+
try {
|
|
8717
|
+
print(await new ErdoClient().markEventPipelineExecutionsHandled(slug, {
|
|
8718
|
+
note: opts.note,
|
|
8719
|
+
through: opts.through,
|
|
8720
|
+
execution_ids: opts.execution.length ? opts.execution : void 0
|
|
8721
|
+
}));
|
|
8722
|
+
} catch (e) {
|
|
8723
|
+
fail(e);
|
|
8724
|
+
}
|
|
8725
|
+
});
|
|
8669
8726
|
var knowledgeCmd = program.command("knowledge").description("Knowledge objects");
|
|
8670
8727
|
knowledgeCmd.command("create").description("Create a Knowledge object").requiredOption("--title <title>", "title").requiredOption("--body <body>", "body text, or @file").option("--description <description>", "short description").option("--type <type>", "snippet or skill", "snippet").option("--category <category>", "category").option("--tags <tags>", "comma-separated tags").option("--agent <name>", "name of the agent making the write").action(async (opts) => {
|
|
8671
8728
|
try {
|