@eide/foir-cli 0.19.0 → 0.20.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/cli.js +32 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6625,7 +6625,9 @@ function registerRecordsCommands(program2, globalOpts) {
|
|
|
6625
6625
|
}
|
|
6626
6626
|
)
|
|
6627
6627
|
);
|
|
6628
|
-
records.command("update <modelKey> <id>").description(
|
|
6628
|
+
records.command("update <modelKey> <id>").description(
|
|
6629
|
+
"Update a record's data column directly. Bypasses versioning \u2014 no version row is created and currentVersionId is unchanged. For the admin-equivalent atomic save (data + new version + currentVersionId bump), use `records save`."
|
|
6630
|
+
).option("-d, --data <json>", "Record data as JSON").option("-f, --file <path>", "Read data from file").action(
|
|
6629
6631
|
withErrorHandler(
|
|
6630
6632
|
globalOpts,
|
|
6631
6633
|
async (_modelKey, id, cmdOpts) => {
|
|
@@ -6641,6 +6643,34 @@ function registerRecordsCommands(program2, globalOpts) {
|
|
|
6641
6643
|
}
|
|
6642
6644
|
)
|
|
6643
6645
|
);
|
|
6646
|
+
records.command("save <modelKey> <id>").description(
|
|
6647
|
+
"Save record content (admin Save Draft equivalent). Atomically replaces data, creates an immutable version row, and advances currentVersionId \u2014 preview and storefront see the new content without a separate publish step."
|
|
6648
|
+
).option("-d, --data <json>", "Record data as JSON").option("-f, --file <path>", "Read data from file").option("-m, --message <msg>", "Change description").option("--variant <key>", "Save into a specific variant").action(
|
|
6649
|
+
withErrorHandler(
|
|
6650
|
+
globalOpts,
|
|
6651
|
+
async (_modelKey, id, cmdOpts) => {
|
|
6652
|
+
const opts = globalOpts();
|
|
6653
|
+
const client = await createPlatformClient(opts);
|
|
6654
|
+
const inputData = await parseInputData(cmdOpts);
|
|
6655
|
+
const result = await client.records.saveContent({
|
|
6656
|
+
recordId: id,
|
|
6657
|
+
data: inputData,
|
|
6658
|
+
variantKey: cmdOpts.variant,
|
|
6659
|
+
changeDescription: cmdOpts.message
|
|
6660
|
+
});
|
|
6661
|
+
formatOutput(
|
|
6662
|
+
{
|
|
6663
|
+
record: result.record ? toJson3(RecordSchema, result.record) : null,
|
|
6664
|
+
version: result.version ? toJson3(RecordSchema, result.version) : null
|
|
6665
|
+
},
|
|
6666
|
+
opts
|
|
6667
|
+
);
|
|
6668
|
+
if (!(opts.json || opts.jsonl || opts.quiet)) {
|
|
6669
|
+
success(`Saved record ${id} \u2192 version ${result.version?.id}`);
|
|
6670
|
+
}
|
|
6671
|
+
}
|
|
6672
|
+
)
|
|
6673
|
+
);
|
|
6644
6674
|
records.command("delete <modelKey> <id>").description("Delete a record").option("--confirm", "Skip confirmation prompt").action(
|
|
6645
6675
|
withErrorHandler(
|
|
6646
6676
|
globalOpts,
|
|
@@ -6748,7 +6778,7 @@ function registerRecordsCommands(program2, globalOpts) {
|
|
|
6748
6778
|
})
|
|
6749
6779
|
);
|
|
6750
6780
|
records.command("create-version <parentId>").description(
|
|
6751
|
-
"
|
|
6781
|
+
"Low-level: create a version row without touching the parent record's data column or currentVersionId. The new version is orphaned from preview/storefront resolution until published. For the admin-equivalent atomic save (data + version + currentVersionId), use `records save`."
|
|
6752
6782
|
).option("-d, --data <json>", "Version content as JSON").option("-f, --file <path>", "Read content from file").option("-m, --message <msg>", "Change description").option("--source-version <id>", "Source version ID to base off").action(
|
|
6753
6783
|
withErrorHandler(
|
|
6754
6784
|
globalOpts,
|