@erdoai/cli 0.135.0 → 0.137.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 +80 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -247,6 +247,13 @@ var ErdoClient = class {
|
|
|
247
247
|
this.orgPinned = Boolean(orgOverride || process.env.ERDO_ORG);
|
|
248
248
|
this.orgName = acct?.organizationName;
|
|
249
249
|
}
|
|
250
|
+
ensurePaidMediaConversionAction(input) {
|
|
251
|
+
return this.request(
|
|
252
|
+
"POST",
|
|
253
|
+
"/v1/paid-media/conversion-actions",
|
|
254
|
+
input
|
|
255
|
+
);
|
|
256
|
+
}
|
|
250
257
|
announceOrgOnce(method) {
|
|
251
258
|
if (announcedOrg) return;
|
|
252
259
|
if (method.toUpperCase() === "GET") return;
|
|
@@ -1189,6 +1196,15 @@ var ErdoClient = class {
|
|
|
1189
1196
|
const qs = q.toString();
|
|
1190
1197
|
return this.request("GET", `/v1/datasets${qs ? `?${qs}` : ""}`);
|
|
1191
1198
|
}
|
|
1199
|
+
listDatasetUserPermissions(slug) {
|
|
1200
|
+
return this.request("GET", `/v1/datasets/${encodeURIComponent(slug)}/permissions/users`);
|
|
1201
|
+
}
|
|
1202
|
+
setDatasetUserPermission(slug, userID, level) {
|
|
1203
|
+
return this.request("PUT", `/v1/datasets/${encodeURIComponent(slug)}/permissions/users/${encodeURIComponent(userID)}`, { level });
|
|
1204
|
+
}
|
|
1205
|
+
removeDatasetUserPermission(slug, userID) {
|
|
1206
|
+
return this.request("DELETE", `/v1/datasets/${encodeURIComponent(slug)}/permissions/users/${encodeURIComponent(userID)}`);
|
|
1207
|
+
}
|
|
1192
1208
|
// The org's dataset vocabulary: every purpose in use, its current dataset,
|
|
1193
1209
|
// and the declared producer contract on that same dataset.
|
|
1194
1210
|
// scope="managed" reads the same across every client organization a manager
|
|
@@ -2590,6 +2606,36 @@ program.command("update").description("Update the CLI to the latest published ve
|
|
|
2590
2606
|
program.command(REFRESH_COMMAND, { hidden: true }).description("Internal: refresh the remembered latest published version").action(async () => {
|
|
2591
2607
|
await refreshVersionCache();
|
|
2592
2608
|
});
|
|
2609
|
+
var paidMedia = program.command("paid-media").description("Paid media setup and operations");
|
|
2610
|
+
paidMedia.command("conversion-actions").command("ensure").description("Find or approval-gate creation of an offline lead conversion action").requiredOption("--name <name>", "exact Google Ads conversion action name").option("--category <category>", "QUALIFIED_LEAD or SUBMIT_LEAD_FORM", "QUALIFIED_LEAD").option("--customer-id <id>", "Google Ads customer id (defaults to the selected account)").option("--json", "print the raw JSON result").action(async (opts) => {
|
|
2611
|
+
try {
|
|
2612
|
+
if (opts.category && opts.category !== "QUALIFIED_LEAD" && opts.category !== "SUBMIT_LEAD_FORM") {
|
|
2613
|
+
fail(new Error("--category must be QUALIFIED_LEAD or SUBMIT_LEAD_FORM"));
|
|
2614
|
+
}
|
|
2615
|
+
const body = {
|
|
2616
|
+
name: opts.name,
|
|
2617
|
+
type: "UPLOAD_CLICKS"
|
|
2618
|
+
};
|
|
2619
|
+
if (opts.category) body.category = opts.category;
|
|
2620
|
+
if (opts.customerId) body.customer_id = opts.customerId;
|
|
2621
|
+
const result = await new ErdoClient().ensurePaidMediaConversionAction(body);
|
|
2622
|
+
if (opts.json) {
|
|
2623
|
+
print(result);
|
|
2624
|
+
return;
|
|
2625
|
+
}
|
|
2626
|
+
console.log(`customer id: ${result.customer_id}`);
|
|
2627
|
+
console.log(`name: ${result.name}`);
|
|
2628
|
+
if (result.status === "ready") {
|
|
2629
|
+
console.log(`status: ready`);
|
|
2630
|
+
if (result.conversion_action_id) console.log(`conversion action id: ${result.conversion_action_id}`);
|
|
2631
|
+
} else {
|
|
2632
|
+
console.log(`status: pending approval`);
|
|
2633
|
+
console.log(`approval request id: ${result.approval_request_id}`);
|
|
2634
|
+
}
|
|
2635
|
+
} catch (e) {
|
|
2636
|
+
fail(e);
|
|
2637
|
+
}
|
|
2638
|
+
});
|
|
2593
2639
|
var org = program.command("org").description("Manage the active organization");
|
|
2594
2640
|
org.command("list").description("List your organizations (* = active)").action(async () => {
|
|
2595
2641
|
try {
|
|
@@ -6872,6 +6918,40 @@ voiceAgentsCmd.command("whatsapp-replies <slug>").description("Turn a voice agen
|
|
|
6872
6918
|
}
|
|
6873
6919
|
});
|
|
6874
6920
|
var datasetsCmd = program.command("datasets").description("Datasets");
|
|
6921
|
+
var datasetPermissionsCmd = datasetsCmd.command("permissions").description("Manage dataset user permissions");
|
|
6922
|
+
datasetPermissionsCmd.command("list <slug>").option("--json", "output raw JSON").action(async (slug, opts) => {
|
|
6923
|
+
try {
|
|
6924
|
+
const result = await new ErdoClient().listDatasetUserPermissions(slug);
|
|
6925
|
+
if (opts.json) print(result);
|
|
6926
|
+
else for (const p of result.permissions) console.log(`${p.user_id} ${p.level}`);
|
|
6927
|
+
} catch (e) {
|
|
6928
|
+
fail(e);
|
|
6929
|
+
}
|
|
6930
|
+
});
|
|
6931
|
+
datasetPermissionsCmd.command("set-user <slug> <user-id>").requiredOption("--level <view|edit|admin>", "permission level").option("--json", "output raw JSON").action(async (slug, userID, opts) => {
|
|
6932
|
+
try {
|
|
6933
|
+
if (!["view", "edit", "admin"].includes(opts.level)) throw new Error("--level must be view, edit, or admin");
|
|
6934
|
+
const result = await new ErdoClient().setDatasetUserPermission(slug, userID, opts.level);
|
|
6935
|
+
if (opts.json) print(result);
|
|
6936
|
+
else console.log(`${result.user_id} ${result.level}`);
|
|
6937
|
+
if (result.user_id.toLowerCase() !== userID.toLowerCase() || result.level !== opts.level) {
|
|
6938
|
+
console.error("Readback does not match the requested dataset user grant");
|
|
6939
|
+
process.exitCode = 1;
|
|
6940
|
+
}
|
|
6941
|
+
} catch (e) {
|
|
6942
|
+
fail(e);
|
|
6943
|
+
}
|
|
6944
|
+
});
|
|
6945
|
+
datasetPermissionsCmd.command("remove-user <slug> <user-id>").option("--json", "output raw JSON").action(async (slug, userID, opts) => {
|
|
6946
|
+
try {
|
|
6947
|
+
const result = await new ErdoClient().removeDatasetUserPermission(slug, userID);
|
|
6948
|
+
if (opts.json) print(result);
|
|
6949
|
+
else console.log(result.direct_grant_absent ? "no direct user grant remains" : "direct grant absence was not verified");
|
|
6950
|
+
if (result.inherited_access_may_remain) console.error("inherited access may remain");
|
|
6951
|
+
} catch (e) {
|
|
6952
|
+
fail(e);
|
|
6953
|
+
}
|
|
6954
|
+
});
|
|
6875
6955
|
datasetsCmd.command("list").description("List datasets").option(
|
|
6876
6956
|
"--class <class>",
|
|
6877
6957
|
"filter by structural class: 'table' or 'scratch', or 'all' to include scratch analysis by-products (default hides scratch)"
|