@creator-notes/cnotes 0.121.6 → 0.121.7
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/commands/notes.js
CHANGED
|
@@ -490,11 +490,19 @@ Examples:
|
|
|
490
490
|
noteIds,
|
|
491
491
|
isArchived,
|
|
492
492
|
});
|
|
493
|
+
// Success needs one result per note sent (PM-157). An agent once got
|
|
494
|
+
// `{"archived": true}` for 21 notes that all stayed active; a missing
|
|
495
|
+
// results array read as "nothing failed" and exited 0.
|
|
496
|
+
if (!Array.isArray(data.results) || data.results.length !== noteIds.length) {
|
|
497
|
+
const err = new CliError(`The server did not confirm the ${isArchived ? "archive" : "unarchive"}: it answered for ${Array.isArray(data.results) ? data.results.length : "none"} of ${noteIds.length} notes.`, EXIT_CODES.GENERIC, "Read the notes back (cnotes notes get <id>) before assuming anything changed; `cnotes notes update <id> --archive` archives one note and returns its state.", { response: data });
|
|
498
|
+
err.name = "BulkArchiveUnconfirmed";
|
|
499
|
+
throw err;
|
|
500
|
+
}
|
|
493
501
|
// Per-item results ({noteId, displayId?, status, error?}). Partial
|
|
494
502
|
// failure keeps exit 0 (callers inspect results[].error — documented
|
|
495
503
|
// contract), but when EVERY note failed nothing was archived and
|
|
496
504
|
// exiting 0 would report success to an agent keying on the exit code.
|
|
497
|
-
const results =
|
|
505
|
+
const results = data.results;
|
|
498
506
|
const successStatus = isArchived ? "archived" : "unarchived";
|
|
499
507
|
const failedResults = results.filter((r) => r.status !== successStatus);
|
|
500
508
|
const allFailed = results.length > 0 && failedResults.length === results.length;
|