@erdoai/cli 0.88.0 → 0.89.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.
Files changed (2) hide show
  1. package/dist/index.js +60 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1153,6 +1153,23 @@ var ErdoClient = class {
1153
1153
  `/v1/datasets/${encodeURIComponent(slug)}/refresh/run`
1154
1154
  );
1155
1155
  }
1156
+ // --- lead identity ---
1157
+ // Preview or perform a dataset's permanent-lead-identity migration: give every
1158
+ // pipeline writer the producer contract, backfill the IDs, and publish the
1159
+ // identity config in one transaction.
1160
+ //
1161
+ // apply:false mutates nothing and is the way to read readiness — `ready`, the
1162
+ // `blockers` holding it up, and how many rows would be assigned an identity.
1163
+ // apply:true needs an operation_key: replaying the same key settles an apply
1164
+ // whose response was lost, while a different key against a migrated dataset is
1165
+ // refused rather than migrating twice.
1166
+ maintainLeadIdentity(slug, body) {
1167
+ return this.request(
1168
+ "POST",
1169
+ `/v1/datasets/${encodeURIComponent(slug)}/lead-identity/maintain`,
1170
+ body
1171
+ );
1172
+ }
1156
1173
  // --- bounded outreach ---
1157
1174
  putOutreachBatch(batch, body) {
1158
1175
  return this.request(
@@ -5653,6 +5670,49 @@ datasetsCmd.command("set-purpose <slug> [purpose]").description(
5653
5670
  fail(e);
5654
5671
  }
5655
5672
  });
5673
+ var leadIdentityCmd = datasetsCmd.command("lead-identity").description(
5674
+ "Permanent lead identity \u2014 one lead is one row, however many ways they got in touch. Migrating a dataset gives every row a canonical_lead_id, points every pipeline writer at it, and makes the resolver the only thing that decides whether a submission is a new lead or an existing one."
5675
+ );
5676
+ leadIdentityCmd.command("maintain <slug>").description(
5677
+ "Preview or perform the migration for one dataset. Without --apply it mutates nothing and reports readiness: whether the dataset is ready, what blocks it, and how many rows would be assigned an identity. Run the preview first and read the blockers \u2014 apply refuses outright while any consumer is incompatible, unverifiable, queued or running, because the backfill rewrites the file every one of them reads."
5678
+ ).option(
5679
+ "--apply",
5680
+ "perform the migration rather than preview it; requires --operation-key"
5681
+ ).option(
5682
+ "--operation-key <key>",
5683
+ "the migration receipt. Replaying the same key settles an apply whose response was lost; a different key against an already-migrated dataset is refused rather than migrating it twice."
5684
+ ).option("--email-column <column>", "the dataset's email column (detected when omitted)").option("--phone-column <column>", "the dataset's phone column (detected when omitted)").option(
5685
+ "--conversion-id-column <column>",
5686
+ "optional conversion id column; must differ from both contact columns"
5687
+ ).option(
5688
+ "--default-calling-code <code>",
5689
+ "calling code a phone written in national form belongs to, so one number written two ways is one lead (default 1)"
5690
+ ).action(
5691
+ async (slug, opts) => {
5692
+ try {
5693
+ if (opts.apply && !opts.operationKey) {
5694
+ fail(
5695
+ new Error(
5696
+ "--apply requires --operation-key so an uncertain retry can settle rather than migrating twice"
5697
+ )
5698
+ );
5699
+ return;
5700
+ }
5701
+ print(
5702
+ await new ErdoClient().maintainLeadIdentity(slug, {
5703
+ apply: Boolean(opts.apply),
5704
+ operation_key: opts.operationKey,
5705
+ email_column: opts.emailColumn,
5706
+ phone_column: opts.phoneColumn,
5707
+ conversion_id_column: opts.conversionIdColumn,
5708
+ default_calling_code: opts.defaultCallingCode
5709
+ })
5710
+ );
5711
+ } catch (e) {
5712
+ fail(e);
5713
+ }
5714
+ }
5715
+ );
5656
5716
  datasetsCmd.command("query <slug> <question>").description(
5657
5717
  "Ask a natural-language question of a dataset \u2014 Erdo writes and runs the SQL, and answers with that SQL alongside the values. It runs an agent, so it is slower and two identical questions can produce two different queries: for a deterministic or scripted read, write the SQL yourself with `datasets fetch --sql`."
5658
5718
  ).action(async (slug, question) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.88.0",
3
+ "version": "0.89.0",
4
4
  "description": "Erdo CLI — drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {