@datarails-ai/dr-cli 1.6.137 → 1.6.138

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/cli.js CHANGED
@@ -8,7 +8,7 @@ import { fileURLToPath as fileURLToPath3 } from "url";
8
8
  // package.json
9
9
  var package_default = {
10
10
  name: "@datarails-ai/dr-cli",
11
- version: "1.6.137",
11
+ version: "1.6.138",
12
12
  description: "Datarails CLI",
13
13
  type: "module",
14
14
  engines: {
@@ -69,7 +69,7 @@ var package_default = {
69
69
  };
70
70
 
71
71
  // src/buildInfo.ts
72
- var BUILD_TIME = "2026-10-15T19:39:28.907Z";
72
+ var BUILD_TIME = "2026-10-15T20:14:54.448Z";
73
73
  function formatBuildTime(iso) {
74
74
  if (iso === "") return "";
75
75
  const d = new Date(iso);
@@ -33166,7 +33166,7 @@ async function runPreviewData(cfg) {
33166
33166
  const result = await previewData(cfg.client, body, { signal: cfg.signal });
33167
33167
  writeJSONIndented(cfg.out, result);
33168
33168
  }
33169
- async function findOrdinalCollisions(client, mapperId, docIds, signal) {
33169
+ async function findBindingLosses(client, mapperId, docIds, signal) {
33170
33170
  const details = await getDetails2(client, mapperId, { signal });
33171
33171
  const tableId = details.template.id;
33172
33172
  const mappers = await list20(client, tableId, { signal });
@@ -33179,9 +33179,10 @@ async function findOrdinalCollisions(client, mapperId, docIds, signal) {
33179
33179
  const others = mappers.filter(
33180
33180
  (m) => m.id !== mapperId && (m.ordinal ?? null) === ordinal && (m.mapped_documents_ids ?? []).some((d) => wanted.has(d))
33181
33181
  );
33182
- return { tableId, ordinal, others };
33182
+ const dropped = (self.mapped_documents_ids ?? []).filter((d) => !wanted.has(d));
33183
+ return { tableId, ordinal, others, dropped };
33183
33184
  }
33184
- async function warnOrdinalCollisions(cfg, body) {
33185
+ async function warnBindingLosses(cfg, body) {
33185
33186
  const err = cfg.err ?? process.stderr;
33186
33187
  const raw = body["selected_document_ids"];
33187
33188
  const docIds = (Array.isArray(raw) ? raw : []).map((d) => {
@@ -33193,24 +33194,34 @@ async function warnOrdinalCollisions(cfg, body) {
33193
33194
  }
33194
33195
  return n;
33195
33196
  });
33196
- if (docIds.length === 0) {
33197
+ if (!Array.isArray(raw)) {
33197
33198
  return;
33198
33199
  }
33199
33200
  let found;
33200
33201
  try {
33201
- found = await findOrdinalCollisions(cfg.client, cfg.mapperId, docIds, cfg.signal);
33202
+ found = await findBindingLosses(cfg.client, cfg.mapperId, docIds, cfg.signal);
33202
33203
  } catch (e) {
33203
33204
  if (cfg.signal.aborted) {
33204
33205
  throw e;
33205
33206
  }
33207
+ err.write(`note: could not check what this bind unbinds: ${e.message}
33208
+ `);
33209
+ return;
33210
+ }
33211
+ if (found === null) {
33206
33212
  err.write(
33207
- `note: could not check for other mappers on the same ordinal: ${e.message}
33213
+ `note: mapper ${cfg.mapperId} is not in its table's mapper list, so dr could not check what this bind unbinds. The document list replaces its current documents.
33208
33214
  `
33209
33215
  );
33210
33216
  return;
33211
33217
  }
33212
- if (found === null) {
33213
- return;
33218
+ if (found.dropped.length > 0) {
33219
+ const all = [.../* @__PURE__ */ new Set([...found.dropped, ...docIds])];
33220
+ const keep = cfg.payloadFile.trim() === "" ? all.map((d) => `--doc ${d}`).join(" ") : `"selected_document_ids": [${all.join(", ")}]`;
33221
+ err.write(
33222
+ `warning: the document list replaces mapper ${cfg.mapperId}'s current documents, so this bind unbinds mapper ${cfg.mapperId} from document(s) [${found.dropped.join(", ")}]. To keep them, list every document you want bound: ${keep}
33223
+ `
33224
+ );
33214
33225
  }
33215
33226
  const ordinal = found.ordinal === null ? "null" : String(found.ordinal);
33216
33227
  for (const other of found.others) {
@@ -33245,7 +33256,7 @@ async function runUpdateBinding(cfg) {
33245
33256
  body["rescan"] = r;
33246
33257
  }
33247
33258
  }
33248
- await warnOrdinalCollisions(cfg, body);
33259
+ await warnBindingLosses(cfg, body);
33249
33260
  const result = await updateBinding(cfg.client, cfg.mapperId, body, {
33250
33261
  signal: cfg.signal
33251
33262
  });
@@ -34303,7 +34314,7 @@ function registerDatamappersCommand(root) {
34303
34314
  addServerFlag(previewCmd);
34304
34315
  addAccountFlag(previewCmd);
34305
34316
  const bindCmd = dm.command("bind").description(
34306
- 'Update which document IDs a mapper is bound to. Posts to `POST /api/templates/mappers/<id>/binding` with `{selected_document_ids, rescan?}`. The legacy webclient\'s "Mapping table with documents" modal calls this when the operator checks/unchecks docs in the binding picker. Warns first when another mapper of the table on the same ordinal is bound to one of those docs: mappers that share an ordinal are versions of one mapper, so the bind unbinds the other.'
34317
+ "Update which document IDs a mapper is bound to. The --doc list replaces the mapper's current documents; repeat every filebox you want to keep (dr warns first and names any it drops). Posts to `POST /api/templates/mappers/<id>/binding` with `{selected_document_ids, rescan?}`. The legacy webclient's \"Mapping table with documents\" modal calls this when the operator checks/unchecks docs in the binding picker. Warns first when another mapper of the table on the same ordinal is bound to one of those docs: mappers that share an ordinal are versions of one mapper, so the bind unbinds the other."
34307
34318
  ).argument("<mapper_id>", "mapper id (positive integer)").option("--doc <id>", "Document id to bind (positive integer; repeatable)", collectInts, []).option(
34308
34319
  "--rescan <mode>",
34309
34320
  "Trigger a re-extraction: `latest` or `all` (default: omit; no rescan)",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 1,
3
- "cliVersion": "1.6.137",
3
+ "cliVersion": "1.6.138",
4
4
  "_contract": "Resolve a command path through `aliases` (canonical prefix + alias segment -> canonical path) before any lookup. A path listed in `pendingCommands`, or whose first segment is a key of `pending`, is UNDECIDED, not unrestricted: fail closed or skip it, and never read a path's absence from `commands` as 'no requirement'. An entry carrying `denied` is UNAVAILABLE to any AGENT-SCOPED credential — one whose `scopes` claim carries at least one `resource:action` entry; a claim that is absent, empty, capability-only or wholly unparseable is UNRESTRICTED, and this mark does not apply to it — whatever else that entry says: it is not a ceiling and it is not always-available, its `denied.reason` says why and `denied.until` names the ticket that lifts it, and the absence of `requires` on it must NEVER be read as 'no requirement'. Only an entry in `commands` with an empty `requires` means always-available.",
5
5
  "commands": {
6
6
  "login": {
@@ -124,7 +124,9 @@ value-inference behavior. `NAME` is the target **table field** name (the
124
124
  - `datamappers preview --payload-file <p>` — renders mapper output for sample
125
125
  input ("what would this extract?") before saving.
126
126
  - `datamappers bind <mapper_id> --doc <id> [--rescan latest|all]` — change which
127
- docs a mapper is bound to. A doc bound to another mapper of the table on the
127
+ docs a mapper is bound to. The --doc list replaces the mapper's current
128
+ documents; repeat every filebox you want to keep. dr warns first and names any
129
+ bound filebox the list drops. A doc bound to another mapper of the table on the
128
130
  same ordinal moves to this one (see *Ordinal* above), and dr warns first.
129
131
 
130
132
  ### `update --field NAME:TYPE` — set column types (materialising calc columns)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarails-ai/dr-cli",
3
- "version": "1.6.137",
3
+ "version": "1.6.138",
4
4
  "description": "Datarails CLI",
5
5
  "type": "module",
6
6
  "engines": {