@erdoai/cli 0.136.0 → 0.138.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 -5
- 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;
|
|
@@ -1859,6 +1866,7 @@ var ErdoClient = class {
|
|
|
1859
1866
|
if (opts.since) params.set("since", opts.since);
|
|
1860
1867
|
if (opts.limit) params.set("limit", String(opts.limit));
|
|
1861
1868
|
if (opts.offset) params.set("offset", String(opts.offset));
|
|
1869
|
+
if (opts.lapsed_offset) params.set("lapsed_offset", String(opts.lapsed_offset));
|
|
1862
1870
|
const qs = params.toString();
|
|
1863
1871
|
return this.request("GET", `/v1/decisions${qs ? `?${qs}` : ""}`);
|
|
1864
1872
|
}
|
|
@@ -2599,6 +2607,36 @@ program.command("update").description("Update the CLI to the latest published ve
|
|
|
2599
2607
|
program.command(REFRESH_COMMAND, { hidden: true }).description("Internal: refresh the remembered latest published version").action(async () => {
|
|
2600
2608
|
await refreshVersionCache();
|
|
2601
2609
|
});
|
|
2610
|
+
var paidMedia = program.command("paid-media").description("Paid media setup and operations");
|
|
2611
|
+
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) => {
|
|
2612
|
+
try {
|
|
2613
|
+
if (opts.category && opts.category !== "QUALIFIED_LEAD" && opts.category !== "SUBMIT_LEAD_FORM") {
|
|
2614
|
+
fail(new Error("--category must be QUALIFIED_LEAD or SUBMIT_LEAD_FORM"));
|
|
2615
|
+
}
|
|
2616
|
+
const body = {
|
|
2617
|
+
name: opts.name,
|
|
2618
|
+
type: "UPLOAD_CLICKS"
|
|
2619
|
+
};
|
|
2620
|
+
if (opts.category) body.category = opts.category;
|
|
2621
|
+
if (opts.customerId) body.customer_id = opts.customerId;
|
|
2622
|
+
const result = await new ErdoClient().ensurePaidMediaConversionAction(body);
|
|
2623
|
+
if (opts.json) {
|
|
2624
|
+
print(result);
|
|
2625
|
+
return;
|
|
2626
|
+
}
|
|
2627
|
+
console.log(`customer id: ${result.customer_id}`);
|
|
2628
|
+
console.log(`name: ${result.name}`);
|
|
2629
|
+
if (result.status === "ready") {
|
|
2630
|
+
console.log(`status: ready`);
|
|
2631
|
+
if (result.conversion_action_id) console.log(`conversion action id: ${result.conversion_action_id}`);
|
|
2632
|
+
} else {
|
|
2633
|
+
console.log(`status: pending approval`);
|
|
2634
|
+
console.log(`approval request id: ${result.approval_request_id}`);
|
|
2635
|
+
}
|
|
2636
|
+
} catch (e) {
|
|
2637
|
+
fail(e);
|
|
2638
|
+
}
|
|
2639
|
+
});
|
|
2602
2640
|
var org = program.command("org").description("Manage the active organization");
|
|
2603
2641
|
org.command("list").description("List your organizations (* = active)").action(async () => {
|
|
2604
2642
|
try {
|
|
@@ -4518,7 +4556,10 @@ var decisionsCmd = program.command("decisions").description(
|
|
|
4518
4556
|
"The decision record \u2014 what your organization committed to, whether the change actually happened, and what the evidence said afterwards"
|
|
4519
4557
|
);
|
|
4520
4558
|
function decisionLine(d) {
|
|
4521
|
-
const parts = [d.slug, d.status];
|
|
4559
|
+
const parts = [d.slug, d.lapsed ? "lapsed" : d.status];
|
|
4560
|
+
if (d.review_by) parts.push(`review_by=${d.review_by}`);
|
|
4561
|
+
if (d.age_seconds !== void 0) parts.push(`age_seconds=${d.age_seconds}`);
|
|
4562
|
+
if (d.exit_condition) parts.push(`exit_condition=${d.exit_condition}`);
|
|
4522
4563
|
if (d.execution_status) parts.push(d.execution_status);
|
|
4523
4564
|
parts.push(d.what);
|
|
4524
4565
|
if (d.outcome_label) {
|
|
@@ -4577,7 +4618,11 @@ decisionsCmd.command("list").description("List decisions, newest first").option(
|
|
|
4577
4618
|
).option("--applicability <kind>", "standing | one_shot").option("--outcome <outcome>", "only decisions with a settled effect that came back met | not_met | inconclusive").option(
|
|
4578
4619
|
"--approval <id>",
|
|
4579
4620
|
"only the decisions produced by answering this approval (approvals are referenced by id, not slug)"
|
|
4580
|
-
).option("--since <timestamp>", "inclusive RFC3339 lower bound on the latest known decision movement").option("-l, --limit <n>", "max rows (default 50, max 200)", (v) => parseInt(v, 10)).option("--offset <n>", "pagination offset", (v) => parseInt(v, 10)).option(
|
|
4621
|
+
).option("--since <timestamp>", "inclusive RFC3339 lower bound on the latest known decision movement").option("-l, --limit <n>", "max rows (default 50, max 200)", (v) => parseInt(v, 10)).option("--offset <n>", "pagination offset", (v) => parseInt(v, 10)).option(
|
|
4622
|
+
"--lapsed-offset <n>",
|
|
4623
|
+
"pagination offset into lapsed commitments (with --applicability standing; paged separately from --offset)",
|
|
4624
|
+
(v) => parseInt(v, 10)
|
|
4625
|
+
).option("--json", "output raw JSON").action(
|
|
4581
4626
|
async (opts) => {
|
|
4582
4627
|
try {
|
|
4583
4628
|
const res = await new ErdoClient().listDecisions({
|
|
@@ -4593,17 +4638,22 @@ decisionsCmd.command("list").description("List decisions, newest first").option(
|
|
|
4593
4638
|
approval_id: opts.approval,
|
|
4594
4639
|
since: opts.since,
|
|
4595
4640
|
limit: opts.limit,
|
|
4596
|
-
offset: opts.offset
|
|
4641
|
+
offset: opts.offset,
|
|
4642
|
+
lapsed_offset: opts.lapsedOffset
|
|
4597
4643
|
});
|
|
4598
4644
|
if (opts.json) {
|
|
4599
4645
|
print(res);
|
|
4600
4646
|
return;
|
|
4601
4647
|
}
|
|
4602
|
-
if (!res.decisions.length) {
|
|
4648
|
+
if (!res.decisions.length && !res.lapsed_decisions?.length) {
|
|
4603
4649
|
console.log("No decisions match. Widen the filters, or check that the work engine is on for this org.");
|
|
4604
4650
|
return;
|
|
4605
4651
|
}
|
|
4606
4652
|
for (const d of res.decisions) console.log(decisionLine(d));
|
|
4653
|
+
if (res.lapsed_decisions?.length) {
|
|
4654
|
+
console.log("Lapsed commitments (no longer current):");
|
|
4655
|
+
for (const d of res.lapsed_decisions) console.log(decisionLine(d));
|
|
4656
|
+
}
|
|
4607
4657
|
} catch (e) {
|
|
4608
4658
|
fail(e);
|
|
4609
4659
|
}
|
|
@@ -4612,13 +4662,15 @@ decisionsCmd.command("list").description("List decisions, newest first").option(
|
|
|
4612
4662
|
function renderDecision(detail) {
|
|
4613
4663
|
const d = detail.decision;
|
|
4614
4664
|
console.log(d.what);
|
|
4665
|
+
const applicability = d.lapsed ? `lapsed on ${d.review_by ?? "its review deadline"} \u2014 no longer current` : d.applicability === "standing" ? "standing (until superseded)" : "one-off authorization";
|
|
4615
4666
|
const facts = [
|
|
4616
4667
|
["status", d.status],
|
|
4617
4668
|
["class", d.decision_class],
|
|
4618
4669
|
["source", d.source],
|
|
4619
|
-
["applies",
|
|
4670
|
+
["applies", applicability],
|
|
4620
4671
|
["decided by", d.decided_by_name ? `${d.decided_by_name} (${d.decider_kind})` : d.decider_kind]
|
|
4621
4672
|
];
|
|
4673
|
+
if (d.review_by) facts.push(["review by", d.review_by]);
|
|
4622
4674
|
if (d.subject_label) facts.push(["subject", d.subject_label]);
|
|
4623
4675
|
if (d.execution_status) facts.push(["execution", d.execution_status]);
|
|
4624
4676
|
if (d.outcome_status) facts.push(["outcome", d.outcome_label || d.outcome_status]);
|