@datarails-ai/dr-cli 1.6.122 → 1.6.123
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 +234 -141
- package/dist/scopes-map.json +1 -1
- package/dist/skills/dr-cli/reference/filebox-documents.md +15 -2
- package/package.json +1 -1
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.
|
|
11
|
+
version: "1.6.123",
|
|
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-
|
|
72
|
+
var BUILD_TIME = "2026-10-12T11:20:38.309Z";
|
|
73
73
|
function formatBuildTime(iso) {
|
|
74
74
|
if (iso === "") return "";
|
|
75
75
|
const d = new Date(iso);
|
|
@@ -891,7 +891,7 @@ async function exchangeApiKey(host, apiKey, options) {
|
|
|
891
891
|
}
|
|
892
892
|
function describeApiKeyExchangeFailure(err, identity2) {
|
|
893
893
|
if (err.httpStatus === 401) {
|
|
894
|
-
return `the server refused the API key for ${identity2} \u2014 it may be revoked or expired, API keys may not be enabled for your organization (ask an admin), or the server may be temporarily unable to evaluate that.`;
|
|
894
|
+
return `the server refused the API key for ${identity2} \u2014 it may be revoked or expired, API keys may not be enabled for your organization (ask an admin), or the server may be temporarily unable to evaluate that. If the key was revoked or expired, start a new session with a new key; retrying with this one will not help.`;
|
|
895
895
|
}
|
|
896
896
|
if (err.httpStatus === 404) {
|
|
897
897
|
return `${identity2}: this server does not support API keys (the exchange endpoint answered 404).`;
|
|
@@ -37600,22 +37600,68 @@ async function runFileboxSetVersionWorkflow(cfg) {
|
|
|
37600
37600
|
`document ${cfg.docId} has no WORKFLOW tag in its config (available: ${availMsg})`
|
|
37601
37601
|
);
|
|
37602
37602
|
}
|
|
37603
|
-
const
|
|
37604
|
-
|
|
37605
|
-
|
|
37606
|
-
const
|
|
37607
|
-
|
|
37608
|
-
cfg.
|
|
37609
|
-
|
|
37610
|
-
|
|
37611
|
-
|
|
37612
|
-
|
|
37613
|
-
|
|
37614
|
-
|
|
37603
|
+
const err = cfg.err ?? process.stderr;
|
|
37604
|
+
const { target } = await loadTargetVersion(cfg.client, cfg.docId, cfg.versionId, cfg.signal);
|
|
37605
|
+
const current = tagValueOf(target.tags, tag.id);
|
|
37606
|
+
const previous = typeof current === "string" ? current : null;
|
|
37607
|
+
const writer = new FullTagSetWriter({
|
|
37608
|
+
client: cfg.client,
|
|
37609
|
+
docId: cfg.docId,
|
|
37610
|
+
versionId: cfg.versionId,
|
|
37611
|
+
snapshot: target.tags,
|
|
37612
|
+
tag: { id: tag.id, value: cfg.status, name: tag.name, label: cfg.status },
|
|
37613
|
+
action: "set version workflow",
|
|
37614
|
+
signal: cfg.signal,
|
|
37615
|
+
sleep: cfg.sleep,
|
|
37616
|
+
settleMs: cfg.tagSettleDelayMs
|
|
37617
|
+
});
|
|
37618
|
+
await writer.write();
|
|
37619
|
+
const kept = await keepDateTagValue({
|
|
37620
|
+
writer,
|
|
37621
|
+
seen: await writer.readBack(),
|
|
37622
|
+
dateBefore: target.date_tag_value,
|
|
37623
|
+
versionId: cfg.versionId,
|
|
37624
|
+
docId: cfg.docId,
|
|
37625
|
+
what: "WORKFLOW tag",
|
|
37626
|
+
signal: cfg.signal,
|
|
37627
|
+
err
|
|
37628
|
+
});
|
|
37629
|
+
const { seen, dateAfter, datePreserved } = kept;
|
|
37630
|
+
const now = seen === null ? void 0 : tagValueOf(seen.tags, tag.id);
|
|
37631
|
+
const verified = seen !== null && now === cfg.status;
|
|
37632
|
+
if (seen === null) {
|
|
37633
|
+
err.write(
|
|
37634
|
+
`warning: could not read version ${cfg.versionId} back to verify its WORKFLOW tag \u2014 confirm with \`dr filebox versions ${cfg.docId}\`
|
|
37635
|
+
`
|
|
37636
|
+
);
|
|
37637
|
+
} else if (!verified) {
|
|
37638
|
+
err.write(
|
|
37639
|
+
`warning: version ${cfg.versionId} reads WORKFLOW ${JSON.stringify(now ?? null)} after the write, not "${cfg.status}" \u2014 confirm with \`dr filebox versions ${cfg.docId}\`
|
|
37640
|
+
`
|
|
37641
|
+
);
|
|
37642
|
+
}
|
|
37643
|
+
if (cfg.asJson) {
|
|
37644
|
+
writeJSONIndented(cfg.out, {
|
|
37645
|
+
version_id: cfg.versionId,
|
|
37646
|
+
doc_id: cfg.docId,
|
|
37647
|
+
tag_id: tag.id,
|
|
37648
|
+
previous,
|
|
37649
|
+
status: cfg.status,
|
|
37650
|
+
verified,
|
|
37651
|
+
reapplied: kept.reapplied,
|
|
37652
|
+
date_tag_value: dateAfter,
|
|
37653
|
+
date_tag_value_preserved: datePreserved
|
|
37654
|
+
});
|
|
37615
37655
|
return;
|
|
37616
37656
|
}
|
|
37617
|
-
const
|
|
37618
|
-
|
|
37657
|
+
const verdict = !verified ? "unverified" : kept.reapplied ? "verified after one re-apply" : "verified";
|
|
37658
|
+
cfg.out.write(
|
|
37659
|
+
`Set WORKFLOW tag on version ${cfg.versionId}: ${JSON.stringify(previous ?? "(unset)")} -> "${cfg.status}" (${verdict}).
|
|
37660
|
+
`
|
|
37661
|
+
);
|
|
37662
|
+
if (datePreserved === false) {
|
|
37663
|
+
cfg.out.write(dateNotPreservedLine(dateAfter, target.date_tag_value));
|
|
37664
|
+
}
|
|
37619
37665
|
}
|
|
37620
37666
|
var FILE_STATUS_VALUES = ["Draft", "Final"];
|
|
37621
37667
|
function parseFileStatus(raw) {
|
|
@@ -37716,6 +37762,110 @@ function fullTagSetWith(stored, write) {
|
|
|
37716
37762
|
}
|
|
37717
37763
|
return [...kept, write].sort((a, b) => a.id - b.id);
|
|
37718
37764
|
}
|
|
37765
|
+
var FullTagSetWriter = class {
|
|
37766
|
+
constructor(cfg) {
|
|
37767
|
+
this.cfg = cfg;
|
|
37768
|
+
this.base = cfg.snapshot ?? [];
|
|
37769
|
+
}
|
|
37770
|
+
cfg;
|
|
37771
|
+
base;
|
|
37772
|
+
/** PUT the full set; a non-2xx answer throws `TagWriteRefusedError`. */
|
|
37773
|
+
async write() {
|
|
37774
|
+
const { cfg } = this;
|
|
37775
|
+
const res = await setVersionTagsAndLabel(
|
|
37776
|
+
cfg.client,
|
|
37777
|
+
cfg.versionId,
|
|
37778
|
+
{ tags_to_update: JSON.stringify(fullTagSetWith(this.base, cfg.tag)) },
|
|
37779
|
+
{ signal: cfg.signal }
|
|
37780
|
+
);
|
|
37781
|
+
if (res.status < 200 || res.status >= 300) {
|
|
37782
|
+
const body = (await res.text()).trim();
|
|
37783
|
+
throw new TagWriteRefusedError(
|
|
37784
|
+
`${cfg.action} refused (HTTP ${res.status}): ${body}`,
|
|
37785
|
+
`(HTTP ${res.status}): ${body}`
|
|
37786
|
+
);
|
|
37787
|
+
}
|
|
37788
|
+
}
|
|
37789
|
+
/** Wait the settle delay, then read the version back (`null` = unreadable). */
|
|
37790
|
+
async readBack() {
|
|
37791
|
+
const { cfg } = this;
|
|
37792
|
+
const sleep3 = cfg.sleep ?? defaultCycleTagSleep;
|
|
37793
|
+
await sleep3(cfg.settleMs ?? CYCLE_TAG_SETTLE_DELAY_MS, cfg.signal);
|
|
37794
|
+
return readVersionForConfirm(cfg.client, cfg.versionId, cfg.docId, cfg.signal);
|
|
37795
|
+
}
|
|
37796
|
+
/** Build the next write from this read-back instead of the earlier snapshot. */
|
|
37797
|
+
refreshBase(v) {
|
|
37798
|
+
if (v !== null && v.tags.length > 0) {
|
|
37799
|
+
this.base = v.tags;
|
|
37800
|
+
}
|
|
37801
|
+
}
|
|
37802
|
+
};
|
|
37803
|
+
async function keepDateTagValue(cfg) {
|
|
37804
|
+
const { dateBefore, err } = cfg;
|
|
37805
|
+
let seen = cfg.seen;
|
|
37806
|
+
const dateMoved = (v) => v !== null && typeof dateBefore === "number" && v.row.date_tag_value !== void 0 && v.row.date_tag_value !== dateBefore;
|
|
37807
|
+
let reapplied = false;
|
|
37808
|
+
let dateUnknown = false;
|
|
37809
|
+
if (dateMoved(seen)) {
|
|
37810
|
+
err.write(
|
|
37811
|
+
`warning: date_tag_value on version ${cfg.versionId} changed (${JSON.stringify(dateBefore)} -> ${JSON.stringify(seen.row.date_tag_value ?? null)}) when its ${cfg.what} was set; re-applying the full tag set once
|
|
37812
|
+
`
|
|
37813
|
+
);
|
|
37814
|
+
reapplied = true;
|
|
37815
|
+
cfg.writer.refreshBase(seen);
|
|
37816
|
+
let refused = false;
|
|
37817
|
+
try {
|
|
37818
|
+
await cfg.writer.write();
|
|
37819
|
+
} catch (e) {
|
|
37820
|
+
if (cfg.signal.aborted) {
|
|
37821
|
+
throw e;
|
|
37822
|
+
}
|
|
37823
|
+
if (e instanceof TagWriteRefusedError) {
|
|
37824
|
+
refused = true;
|
|
37825
|
+
err.write(`warning: re-applying the full tag set was refused ${e.reason}
|
|
37826
|
+
`);
|
|
37827
|
+
} else {
|
|
37828
|
+
err.write(
|
|
37829
|
+
`warning: re-applying the full tag set failed (${e instanceof Error ? e.message : String(e)}); its outcome is unknown, reading the version again
|
|
37830
|
+
`
|
|
37831
|
+
);
|
|
37832
|
+
}
|
|
37833
|
+
}
|
|
37834
|
+
const after = refused ? seen : await cfg.writer.readBack();
|
|
37835
|
+
if (after === null) {
|
|
37836
|
+
dateUnknown = true;
|
|
37837
|
+
err.write(
|
|
37838
|
+
`warning: could not read version ${cfg.versionId} back to confirm its date_tag_value after re-applying the full tag set \u2014 check it with \`dr filebox versions ${cfg.docId} --json\`
|
|
37839
|
+
`
|
|
37840
|
+
);
|
|
37841
|
+
} else {
|
|
37842
|
+
seen = after;
|
|
37843
|
+
}
|
|
37844
|
+
}
|
|
37845
|
+
const dateAfter = dateUnknown || seen === null || seen.row.date_tag_value === void 0 ? null : seen.row.date_tag_value;
|
|
37846
|
+
const datePreserved = dateUnknown || seen === null || dateBefore === void 0 || seen.row.date_tag_value === void 0 ? null : !dateMoved(seen);
|
|
37847
|
+
if (datePreserved === false) {
|
|
37848
|
+
err.write(
|
|
37849
|
+
`warning: date_tag_value on version ${cfg.versionId} is still ${JSON.stringify(dateAfter)} (was ${JSON.stringify(dateBefore)}) after one re-apply; its tags still carry the date. Restore it with \`dr filebox set-version-date-tag ${cfg.versionId} --doc ${cfg.docId} --<dimension> <date>\` (it sends the date tag alone; on a planning filebox use \`dr filebox set-version-cycle ${cfg.versionId} --doc ${cfg.docId} --date <date> --scenario <name>\` instead, which keeps the cycle), then check \`dr filebox versions ${cfg.docId} --json\`
|
|
37850
|
+
`
|
|
37851
|
+
);
|
|
37852
|
+
}
|
|
37853
|
+
return { seen, reapplied, dateAfter, datePreserved };
|
|
37854
|
+
}
|
|
37855
|
+
function dateNotPreservedLine(dateAfter, dateBefore) {
|
|
37856
|
+
return `date_tag_value NOT preserved: it reads ${JSON.stringify(dateAfter)}, was ${JSON.stringify(dateBefore)} (see the warning above).
|
|
37857
|
+
`;
|
|
37858
|
+
}
|
|
37859
|
+
async function loadTargetVersion(client, docId, versionId, signal) {
|
|
37860
|
+
const rows = await listVersions(client, docId, { includeAutoSaves: true }, { signal });
|
|
37861
|
+
const target = rows.find((r) => r.id === versionId);
|
|
37862
|
+
if (target === void 0) {
|
|
37863
|
+
throw new Error(
|
|
37864
|
+
`version ${versionId} is not a version of filebox ${docId} \u2014 list them with \`dr filebox versions ${docId} --all\``
|
|
37865
|
+
);
|
|
37866
|
+
}
|
|
37867
|
+
return { rows, target };
|
|
37868
|
+
}
|
|
37719
37869
|
async function runFileboxSetVersionFileStatus(cfg) {
|
|
37720
37870
|
if (cfg.docId <= 0) {
|
|
37721
37871
|
throw new Error("document id must be positive");
|
|
@@ -37724,8 +37874,6 @@ async function runFileboxSetVersionFileStatus(cfg) {
|
|
|
37724
37874
|
throw new Error("version id must be positive");
|
|
37725
37875
|
}
|
|
37726
37876
|
const err = cfg.err ?? process.stderr;
|
|
37727
|
-
const sleep3 = cfg.sleep ?? defaultCycleTagSleep;
|
|
37728
|
-
const settleMs = cfg.tagSettleDelayMs ?? CYCLE_TAG_SETTLE_DELAY_MS;
|
|
37729
37877
|
const details = await getDetails(cfg.client, cfg.docId, { signal: cfg.signal });
|
|
37730
37878
|
const tag = (details.tags_config ?? []).find(isFileStatusTag);
|
|
37731
37879
|
if (tag === void 0) {
|
|
@@ -37739,18 +37887,12 @@ async function runFileboxSetVersionFileStatus(cfg) {
|
|
|
37739
37887
|
`File Status on document ${cfg.docId} does not allow "${cfg.status}" (allowed: ${tag.values.map((v) => JSON.stringify(v)).join(" | ")})`
|
|
37740
37888
|
);
|
|
37741
37889
|
}
|
|
37742
|
-
const rows = await
|
|
37890
|
+
const { rows, target } = await loadTargetVersion(
|
|
37743
37891
|
cfg.client,
|
|
37744
37892
|
cfg.docId,
|
|
37745
|
-
|
|
37746
|
-
|
|
37893
|
+
cfg.versionId,
|
|
37894
|
+
cfg.signal
|
|
37747
37895
|
);
|
|
37748
|
-
const target = rows.find((r) => r.id === cfg.versionId);
|
|
37749
|
-
if (target === void 0) {
|
|
37750
|
-
throw new Error(
|
|
37751
|
-
`version ${cfg.versionId} is not a version of filebox ${cfg.docId} \u2014 list them with \`dr filebox versions ${cfg.docId} --all\``
|
|
37752
|
-
);
|
|
37753
|
-
}
|
|
37754
37896
|
const current = tagValueOf(target.tags, tag.id);
|
|
37755
37897
|
const previous = typeof current === "string" ? current : null;
|
|
37756
37898
|
const options = tag.options ?? {};
|
|
@@ -37803,45 +37945,25 @@ async function runFileboxSetVersionFileStatus(cfg) {
|
|
|
37803
37945
|
);
|
|
37804
37946
|
}
|
|
37805
37947
|
}
|
|
37806
|
-
const
|
|
37807
|
-
|
|
37808
|
-
|
|
37809
|
-
|
|
37810
|
-
|
|
37811
|
-
|
|
37812
|
-
|
|
37813
|
-
|
|
37814
|
-
|
|
37815
|
-
|
|
37816
|
-
|
|
37817
|
-
|
|
37818
|
-
const write = async () => {
|
|
37819
|
-
const res = await setVersionTagsAndLabel(
|
|
37820
|
-
cfg.client,
|
|
37821
|
-
cfg.versionId,
|
|
37822
|
-
{ tags_to_update: JSON.stringify(fullTagSetWith(base, statusWrite)) },
|
|
37823
|
-
{ signal: cfg.signal }
|
|
37824
|
-
);
|
|
37825
|
-
if (res.status < 200 || res.status >= 300) {
|
|
37826
|
-
const body = await res.text();
|
|
37827
|
-
throw new TagWriteRefusedError(
|
|
37828
|
-
`set version file status refused (HTTP ${res.status}): ${body.trim()}`,
|
|
37829
|
-
`(HTTP ${res.status}): ${body.trim()}`
|
|
37830
|
-
);
|
|
37831
|
-
}
|
|
37832
|
-
};
|
|
37833
|
-
const readBack = async () => {
|
|
37834
|
-
await sleep3(settleMs, cfg.signal);
|
|
37835
|
-
return readVersionForConfirm(cfg.client, cfg.versionId, cfg.docId, cfg.signal);
|
|
37836
|
-
};
|
|
37837
|
-
await write();
|
|
37948
|
+
const writer = new FullTagSetWriter({
|
|
37949
|
+
client: cfg.client,
|
|
37950
|
+
docId: cfg.docId,
|
|
37951
|
+
versionId: cfg.versionId,
|
|
37952
|
+
snapshot: target.tags,
|
|
37953
|
+
tag: { id: tag.id, value: cfg.status, name: tag.name, label: cfg.status },
|
|
37954
|
+
action: "set version file status",
|
|
37955
|
+
signal: cfg.signal,
|
|
37956
|
+
sleep: cfg.sleep,
|
|
37957
|
+
settleMs: cfg.tagSettleDelayMs
|
|
37958
|
+
});
|
|
37959
|
+
await writer.write();
|
|
37838
37960
|
let reapplied = false;
|
|
37839
|
-
let seen = await readBack();
|
|
37961
|
+
let seen = await writer.readBack();
|
|
37840
37962
|
if (seen !== null && tagValueOf(seen.tags, tag.id) !== cfg.status) {
|
|
37841
37963
|
reapplied = true;
|
|
37842
|
-
refreshBase(seen);
|
|
37843
|
-
await write();
|
|
37844
|
-
seen = await readBack();
|
|
37964
|
+
writer.refreshBase(seen);
|
|
37965
|
+
await writer.write();
|
|
37966
|
+
seen = await writer.readBack();
|
|
37845
37967
|
const now = seen === null ? void 0 : tagValueOf(seen.tags, tag.id);
|
|
37846
37968
|
if (seen !== null && now !== cfg.status) {
|
|
37847
37969
|
throw new Error(
|
|
@@ -37849,53 +37971,19 @@ async function runFileboxSetVersionFileStatus(cfg) {
|
|
|
37849
37971
|
);
|
|
37850
37972
|
}
|
|
37851
37973
|
}
|
|
37852
|
-
const
|
|
37853
|
-
|
|
37854
|
-
|
|
37855
|
-
|
|
37856
|
-
|
|
37857
|
-
|
|
37858
|
-
|
|
37859
|
-
|
|
37860
|
-
|
|
37861
|
-
|
|
37862
|
-
|
|
37863
|
-
|
|
37864
|
-
|
|
37865
|
-
} catch (e) {
|
|
37866
|
-
if (cfg.signal.aborted) {
|
|
37867
|
-
throw e;
|
|
37868
|
-
}
|
|
37869
|
-
if (e instanceof TagWriteRefusedError) {
|
|
37870
|
-
refused = true;
|
|
37871
|
-
err.write(`warning: re-applying the full tag set was refused ${e.reason}
|
|
37872
|
-
`);
|
|
37873
|
-
} else {
|
|
37874
|
-
err.write(
|
|
37875
|
-
`warning: re-applying the full tag set failed (${e instanceof Error ? e.message : String(e)}); its outcome is unknown, reading the version again
|
|
37876
|
-
`
|
|
37877
|
-
);
|
|
37878
|
-
}
|
|
37879
|
-
}
|
|
37880
|
-
const after = refused ? seen : await readBack();
|
|
37881
|
-
if (after === null) {
|
|
37882
|
-
dateUnknown = true;
|
|
37883
|
-
err.write(
|
|
37884
|
-
`warning: could not read version ${cfg.versionId} back to confirm its date_tag_value after re-applying the full tag set \u2014 check it with \`dr filebox versions ${cfg.docId} --json\`
|
|
37885
|
-
`
|
|
37886
|
-
);
|
|
37887
|
-
} else {
|
|
37888
|
-
seen = after;
|
|
37889
|
-
}
|
|
37890
|
-
}
|
|
37891
|
-
const dateAfter = dateUnknown || seen === null || seen.row.date_tag_value === void 0 ? null : seen.row.date_tag_value;
|
|
37892
|
-
const datePreserved = dateUnknown || seen === null || dateBefore === void 0 || seen.row.date_tag_value === void 0 ? null : !dateMoved(seen);
|
|
37893
|
-
if (datePreserved === false) {
|
|
37894
|
-
err.write(
|
|
37895
|
-
`warning: date_tag_value on version ${cfg.versionId} is still ${JSON.stringify(dateAfter)} (was ${JSON.stringify(dateBefore)}) after one re-apply; its tags still carry the date. Restore it with \`dr filebox set-version-date-tag ${cfg.versionId} --doc ${cfg.docId} --<dimension> <date>\` (it sends the date tag alone; on a planning filebox use \`dr filebox set-version-cycle ${cfg.versionId} --doc ${cfg.docId} --date <date> --scenario <name>\` instead, which keeps the cycle), then check \`dr filebox versions ${cfg.docId} --json\`
|
|
37896
|
-
`
|
|
37897
|
-
);
|
|
37898
|
-
}
|
|
37974
|
+
const kept = await keepDateTagValue({
|
|
37975
|
+
writer,
|
|
37976
|
+
seen,
|
|
37977
|
+
dateBefore: target.date_tag_value,
|
|
37978
|
+
versionId: cfg.versionId,
|
|
37979
|
+
docId: cfg.docId,
|
|
37980
|
+
what: "File Status",
|
|
37981
|
+
signal: cfg.signal,
|
|
37982
|
+
err
|
|
37983
|
+
});
|
|
37984
|
+
seen = kept.seen;
|
|
37985
|
+
reapplied ||= kept.reapplied;
|
|
37986
|
+
const { dateAfter, datePreserved } = kept;
|
|
37899
37987
|
if (seen === null) {
|
|
37900
37988
|
err.write(
|
|
37901
37989
|
`warning: could not read version ${cfg.versionId} back to verify its File Status \u2014 confirm with \`dr filebox versions ${cfg.docId}\`
|
|
@@ -37934,10 +38022,7 @@ async function runFileboxSetVersionFileStatus(cfg) {
|
|
|
37934
38022
|
`
|
|
37935
38023
|
);
|
|
37936
38024
|
if (datePreserved === false) {
|
|
37937
|
-
cfg.out.write(
|
|
37938
|
-
`date_tag_value NOT preserved: it reads ${JSON.stringify(dateAfter)}, was ${JSON.stringify(dateBefore)} (see the warning above).
|
|
37939
|
-
`
|
|
37940
|
-
);
|
|
38025
|
+
cfg.out.write(dateNotPreservedLine(dateAfter, target.date_tag_value));
|
|
37941
38026
|
}
|
|
37942
38027
|
if (demotedIds.length > 0) {
|
|
37943
38028
|
cfg.out.write(
|
|
@@ -39635,33 +39720,41 @@ function registerFileboxCommand(root) {
|
|
|
39635
39720
|
).requiredOption(
|
|
39636
39721
|
"--status <s>",
|
|
39637
39722
|
"New WORKFLOW value: Not Started | In Progress | Pending | Approved | Rejected. Setting Approved requires the `approve_workflow` permission server-side."
|
|
39638
|
-
).
|
|
39639
|
-
|
|
39640
|
-
|
|
39641
|
-
|
|
39642
|
-
|
|
39643
|
-
|
|
39644
|
-
|
|
39645
|
-
|
|
39646
|
-
|
|
39647
|
-
|
|
39648
|
-
);
|
|
39649
|
-
|
|
39650
|
-
|
|
39651
|
-
|
|
39652
|
-
|
|
39653
|
-
|
|
39654
|
-
|
|
39655
|
-
|
|
39656
|
-
|
|
39657
|
-
|
|
39658
|
-
|
|
39659
|
-
|
|
39660
|
-
|
|
39661
|
-
|
|
39662
|
-
|
|
39723
|
+
).option(
|
|
39724
|
+
"--json",
|
|
39725
|
+
"Output a JSON record describing the write instead of the human confirmation",
|
|
39726
|
+
false
|
|
39727
|
+
).action(
|
|
39728
|
+
async (idStr, opts) => {
|
|
39729
|
+
const versionId = parseFileboxIdArg(idStr);
|
|
39730
|
+
if (opts.doc === void 0 || opts.doc === "") {
|
|
39731
|
+
throw new Error("--doc is required");
|
|
39732
|
+
}
|
|
39733
|
+
const docId = parseFileboxIdArg(opts.doc);
|
|
39734
|
+
const raw = opts.status ?? "";
|
|
39735
|
+
if (!WORKFLOW_STATUSES.includes(raw)) {
|
|
39736
|
+
throw new Error(
|
|
39737
|
+
`invalid --status "${raw}" (expected one of: ${WORKFLOW_STATUSES.map((s) => `"${s}"`).join(" | ")})`
|
|
39738
|
+
);
|
|
39739
|
+
}
|
|
39740
|
+
const status2 = raw;
|
|
39741
|
+
const setup = await setupCall(opts.server, opts.account, { timeoutMs: 5 * 6e4 });
|
|
39742
|
+
try {
|
|
39743
|
+
await runFileboxSetVersionWorkflow({
|
|
39744
|
+
client: setup.client,
|
|
39745
|
+
docId,
|
|
39746
|
+
versionId,
|
|
39747
|
+
status: status2,
|
|
39748
|
+
asJson: opts.json === true,
|
|
39749
|
+
signal: setup.signal,
|
|
39750
|
+
out: process.stdout,
|
|
39751
|
+
err: process.stderr
|
|
39752
|
+
});
|
|
39753
|
+
} finally {
|
|
39754
|
+
setup.cleanup();
|
|
39755
|
+
}
|
|
39663
39756
|
}
|
|
39664
|
-
|
|
39757
|
+
);
|
|
39665
39758
|
addServerFlag(setVersionWorkflowCmd);
|
|
39666
39759
|
addAccountFlag(setVersionWorkflowCmd);
|
|
39667
39760
|
const setVersionFileStatusCmd = fb.command("set-version-file-status").description(
|
package/dist/scopes-map.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
|
-
"cliVersion": "1.6.
|
|
3
|
+
"cliVersion": "1.6.123",
|
|
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": {
|
|
@@ -170,8 +170,16 @@ set-version-include` (below).
|
|
|
170
170
|
control characters, and not `auto-calculated` (reserved by the server for
|
|
171
171
|
versions it generates); pass the label as one quoted argument. Needs change
|
|
172
172
|
rights on the filebox or to be the version's uploader (HTTP 405 otherwise).
|
|
173
|
-
- `filebox set-version-workflow <vid> --doc <id> --status <Not Started|In Progress|Pending|Approved|Rejected
|
|
174
|
-
— set the workflow LIST-tag value (setting `Approved` requires
|
|
173
|
+
- `filebox set-version-workflow <vid> --doc <id> --status <Not Started|In Progress|Pending|Approved|Rejected>
|
|
174
|
+
[--json]` — set the workflow LIST-tag value (setting `Approved` requires
|
|
175
|
+
`approve_workflow`). Like `set-version-file-status` below, it sends the
|
|
176
|
+
version's **full tag set** with WORKFLOW replaced, and reads the version back:
|
|
177
|
+
the WORKFLOW value is checked, and `date_tag_value` is re-applied once and
|
|
178
|
+
reported exactly as that command does (`date_tag_value`,
|
|
179
|
+
`date_tag_value_preserved`, `verified`, `reapplied` and `previous` in
|
|
180
|
+
`--json`). A WORKFLOW-only body (CLI releases before DR-55186) left the
|
|
181
|
+
version's `date_tag_value` null while `tags` still held the month; repair such
|
|
182
|
+
a version the way the `set-version-file-status` entry describes.
|
|
175
183
|
- `filebox set-version-file-status <vid> --doc <id> --status <Draft|Final> [--json]`
|
|
176
184
|
— set the File Status LIST-tag value (other tags untouched). This is how a
|
|
177
185
|
version uploaded with `upload-version` (always Draft) is made Final without the
|
|
@@ -226,6 +234,11 @@ set-version-include` (below).
|
|
|
226
234
|
tag's `sub_type`/name; a forecast filebox's `Forecast (New)` tag has none, so
|
|
227
235
|
only the tag's presence is checked there. The scenario tag is compared
|
|
228
236
|
exactly.
|
|
237
|
+
It sends those two tags only, and the server rebuilds the version's
|
|
238
|
+
dimension value from them. That is right when the filebox's dimension tags
|
|
239
|
+
are exactly the date and the scenario, as on the planning fileboxes this
|
|
240
|
+
command is for; a third dimension tag would drop out of the dimension.
|
|
241
|
+
`upload-version --date --scenario` writes the same two-tag body.
|
|
229
242
|
On an upload the confirmed row is also cross-checked against the upload
|
|
230
243
|
response (version number, name, filebox) — if the response only carried a
|
|
231
244
|
`latest_version_id` the cascade had already moved, the tag went to the wrong
|