@erdoai/cli 0.184.0 → 0.185.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 +64 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -354,6 +354,9 @@ var ErdoClient = class {
|
|
|
354
354
|
if (customerId) query.set("customer_id", customerId);
|
|
355
355
|
return this.request("GET", `/v1/paid-media/audiences?${query}`);
|
|
356
356
|
}
|
|
357
|
+
auditPaidMediaNegativeCoverage(input) {
|
|
358
|
+
return this.request("POST", "/v1/paid-media/negative-coverage", input);
|
|
359
|
+
}
|
|
357
360
|
listPaidMediaCampaigns(customerId) {
|
|
358
361
|
const query = customerId ? `?customer_id=${encodeURIComponent(customerId)}` : "";
|
|
359
362
|
return this.request("GET", `/v1/paid-media/campaigns${query}`);
|
|
@@ -428,6 +431,12 @@ var ErdoClient = class {
|
|
|
428
431
|
creditBalance() {
|
|
429
432
|
return this.request("GET", "/v1/credits/balance");
|
|
430
433
|
}
|
|
434
|
+
getManagerCreditFunding() {
|
|
435
|
+
return this.request("GET", "/v1/credits/manager-funding");
|
|
436
|
+
}
|
|
437
|
+
setManagerCreditFunding(enabled) {
|
|
438
|
+
return this.request("PATCH", "/v1/credits/manager-funding", { enabled });
|
|
439
|
+
}
|
|
431
440
|
listMCPToolsets() {
|
|
432
441
|
return this.request("GET", "/v1/mcp/toolsets");
|
|
433
442
|
}
|
|
@@ -2914,6 +2923,20 @@ credits.command("balance").description("Read the current organization's credit b
|
|
|
2914
2923
|
fail(error);
|
|
2915
2924
|
}
|
|
2916
2925
|
});
|
|
2926
|
+
credits.command("manager-funding").description("Read or change manager execution-credit funding for the current organization").option("--enabled <true|false>", "Set whether this organization funds managed organizations").action(async (options) => {
|
|
2927
|
+
try {
|
|
2928
|
+
if (options.enabled === void 0) {
|
|
2929
|
+
print(await new ErdoClient().getManagerCreditFunding());
|
|
2930
|
+
return;
|
|
2931
|
+
}
|
|
2932
|
+
if (options.enabled !== "true" && options.enabled !== "false") {
|
|
2933
|
+
throw new Error("--enabled must be exactly true or false");
|
|
2934
|
+
}
|
|
2935
|
+
print(await new ErdoClient().setManagerCreditFunding(options.enabled === "true"));
|
|
2936
|
+
} catch (error) {
|
|
2937
|
+
fail(error);
|
|
2938
|
+
}
|
|
2939
|
+
});
|
|
2917
2940
|
var admin = program.command("admin").description("Erdo staff administration");
|
|
2918
2941
|
admin.command("credits").description("Staff-only manual credit grants").command("grant <orgSlugOrId>").description("Grant non-expiring credits without payment; requires an authenticated staff user").requiredOption("--amount <integer>", "Positive integer credits to grant").requiredOption("--reason <text>", "Audit reason").action(async (organization, options) => {
|
|
2919
2942
|
try {
|
|
@@ -3063,6 +3086,29 @@ paidMedia.command("audiences").description("Read live audience lists, eligibilit
|
|
|
3063
3086
|
fail(e);
|
|
3064
3087
|
}
|
|
3065
3088
|
});
|
|
3089
|
+
paidMedia.command("negative-coverage").description("Read live Google Ads negative keyword coverage. Does not add or remove keywords").option("--provider <provider>", "ad platform", "google_ads").option("--customer-id <id>", "Google Ads customer id (defaults to the selected account)").option("--campaign-id <id>", "one Search campaign; omit to read Search campaigns in the account").option("--json", "print the raw JSON result, including unreadable scopes").action(async (opts) => {
|
|
3090
|
+
try {
|
|
3091
|
+
const result = await new ErdoClient().auditPaidMediaNegativeCoverage({
|
|
3092
|
+
provider: opts.provider,
|
|
3093
|
+
customer_id: opts.customerId,
|
|
3094
|
+
campaign_id: opts.campaignId
|
|
3095
|
+
});
|
|
3096
|
+
if (opts.json) {
|
|
3097
|
+
print(result);
|
|
3098
|
+
return;
|
|
3099
|
+
}
|
|
3100
|
+
console.log(`customer ${result.customer_id}${result.truncated ? " (truncated)" : ""}`);
|
|
3101
|
+
for (const campaign of result.campaigns ?? []) {
|
|
3102
|
+
const id = String(campaign.campaign_id ?? "");
|
|
3103
|
+
const coverage = String(campaign.coverage ?? "");
|
|
3104
|
+
const missing = Array.isArray(campaign.missing) ? campaign.missing.length : 0;
|
|
3105
|
+
console.log(`${id} ${coverage} missing=${missing}`);
|
|
3106
|
+
}
|
|
3107
|
+
if (result.read_note) console.log(result.read_note);
|
|
3108
|
+
} catch (e) {
|
|
3109
|
+
fail(e);
|
|
3110
|
+
}
|
|
3111
|
+
});
|
|
3066
3112
|
var paidMediaCampaigns = paidMedia.command("campaigns").description("Google Ads campaigns and their conversion goals");
|
|
3067
3113
|
paidMedia.command("audience-mode <campaignId>").description("Set audience Observation or Targeting, preserving other targeting dimensions (approval-gated)").requiredOption("--customer-id <id>", "Google Ads customer ID").requiredOption("--mode <mode>", "observation or targeting").option("--adgroup-id <id>", "update this ad group instead of its parent campaign").option("--reason <text>", "reason shown on the approval card").action(async (campaignId, opts) => {
|
|
3068
3114
|
try {
|
|
@@ -8017,6 +8063,21 @@ providerLeadSourcesCmd.command("set").description(
|
|
|
8017
8063
|
fail(e);
|
|
8018
8064
|
}
|
|
8019
8065
|
});
|
|
8066
|
+
var leadSourcePreviewSample = 5;
|
|
8067
|
+
function newestLeadSample(batches) {
|
|
8068
|
+
const ts = (lead) => typeof lead.ts === "string" ? lead.ts : "";
|
|
8069
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8070
|
+
const kept = batches.map(
|
|
8071
|
+
(sample) => sample.filter((lead) => {
|
|
8072
|
+
const id = typeof lead.provider_lead_id === "string" ? lead.provider_lead_id : "";
|
|
8073
|
+
if (id === "") return true;
|
|
8074
|
+
if (seen.has(id)) return false;
|
|
8075
|
+
seen.add(id);
|
|
8076
|
+
return true;
|
|
8077
|
+
})
|
|
8078
|
+
);
|
|
8079
|
+
return kept.reverse().flat().sort((a, b) => ts(a) < ts(b) ? 1 : ts(a) > ts(b) ? -1 : 0).slice(0, leadSourcePreviewSample);
|
|
8080
|
+
}
|
|
8020
8081
|
providerLeadSourcesCmd.command("import <name> <file>").description(
|
|
8021
8082
|
"Import a CSV file into an import lead source. Every row is written as history: never alerted on, billed or followed up until started. Without --commit this is a dry run that previews the file and writes nothing."
|
|
8022
8083
|
).option("--commit", "write the rows (without it, only a preview)").option("--default-submitted-at <date>", "when these people got in touch, for rows the file does not date (YYYY-MM-DD or RFC 3339)").option("--start-follow-up", "after writing, start follow-up on each lead the import created (with --commit)").action(async (name, file, opts) => {
|
|
@@ -8032,6 +8093,7 @@ providerLeadSourcesCmd.command("import <name> <file>").description(
|
|
|
8032
8093
|
const skipped = {};
|
|
8033
8094
|
const created = /* @__PURE__ */ new Set();
|
|
8034
8095
|
let preview;
|
|
8096
|
+
const samples = [];
|
|
8035
8097
|
for (let start = 0; start < rows.length || start === 0; start += batch) {
|
|
8036
8098
|
const result = await client.importLeadSourceRows({
|
|
8037
8099
|
name,
|
|
@@ -8042,6 +8104,7 @@ providerLeadSourcesCmd.command("import <name> <file>").description(
|
|
|
8042
8104
|
});
|
|
8043
8105
|
if (result.preview) {
|
|
8044
8106
|
preview ??= result.preview;
|
|
8107
|
+
samples.push(result.preview.sample);
|
|
8045
8108
|
totals.history += result.preview.history;
|
|
8046
8109
|
totals.already_written += result.preview.already_written;
|
|
8047
8110
|
totals.test += result.preview.test;
|
|
@@ -8058,7 +8121,7 @@ providerLeadSourcesCmd.command("import <name> <file>").description(
|
|
|
8058
8121
|
if (rows.length === 0) break;
|
|
8059
8122
|
}
|
|
8060
8123
|
if (!opts.commit) {
|
|
8061
|
-
print({ dry_run: true, rows: totals.rows, history: totals.history, already_written: totals.already_written, test: totals.test, skipped, not_read: preview?.not_read ?? [], missing_fields: preview?.missing_fields ?? [], sample:
|
|
8124
|
+
print({ dry_run: true, rows: totals.rows, history: totals.history, already_written: totals.already_written, test: totals.test, skipped, not_read: preview?.not_read ?? [], missing_fields: preview?.missing_fields ?? [], sample: newestLeadSample(samples) });
|
|
8062
8125
|
process.stderr.write(`Dry run: nothing written. ${totals.history} rows would be written as history. Run again with --commit to write them.
|
|
8063
8126
|
`);
|
|
8064
8127
|
return;
|