@anchrd/intel-api 0.32.0 → 0.33.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/nodes/nodes.js +12 -11
  2. package/package.json +1 -1
@@ -120,16 +120,17 @@ async function boardFor(deps, actor, parent) {
120
120
  return null;
121
121
  return (await deps.boardOfTask?.(actor, parent.id)) ?? null;
122
122
  }
123
- function refuseArchivedParent(childKind, parent) {
124
- // ⚠️ Tasks only, and the narrowness is deliberate. The same hole exists for a folder archive an
125
- // empty one, file a document in it, purge but it is OLDER than this ticket and fixing it here
126
- // would change the behaviour of the whole tree out of a board ticket, with no test outside
127
- // `boards.int.ts` covering it. It is #679, which also asks what such data already exists.
123
+ function refuseArchivedParent(parent) {
124
+ // ⚠️ EVERY kind, not just tasks (#679). It was narrowed to tasks in #677 because widening it out
125
+ // of a board ticket would have changed the whole tree with no test outside `boards.int.ts`; the
126
+ // hole it left is older than that ticket and is what this one closes.
128
127
  //
129
- // ⚠️ A reference without its number is not a reference: the review of #677 searched for this
130
- // ticket and could not find it, because this comment did not name it.
131
- if (childKind !== "task")
132
- return;
128
+ // ⚠️ **This asks the DIRECT parent only, and the hole one level up stays open** (#733). Archiving a
129
+ // folder that still holds something live is allowed for every kind but `task`, so `Aussen`
130
+ // archived over a live `Innen` still takes anything filed under `Innen` when it is purged:
131
+ // `inspectPurgeTree` walks the whole subtree and `purge` checks `archived_at` on the root alone.
132
+ // Closing that needs a decision (refuse the archive, cascade it, refuse the purge, or name the
133
+ // live nodes in the preview) and #733 carries it with the count of what already exists.
133
134
  if (parent === null || parent.archivedAt === null)
134
135
  return;
135
136
  throw new IntelError(409, "parent_archived", `This ${parent.kind} is archived, so nothing new can be filed under it. Restore it first.`);
@@ -597,7 +598,7 @@ export function createNodes(deps) {
597
598
  // reason — a task lives on a board — and saying "restore the folder first" would send the
598
599
  // reader to do something that changes nothing: restored, the folder still cannot hold a task.
599
600
  refuseWrongParent(input.kind, destinationParent, { destination: destinationBoard });
600
- refuseArchivedParent(input.kind, destinationParent);
601
+ refuseArchivedParent(destinationParent);
601
602
  const timestamp = deps.now().toISOString();
602
603
  const created = await deps.repository.insertNode({
603
604
  node: {
@@ -983,7 +984,7 @@ export function createNodes(deps) {
983
984
  destination: destinationBoard,
984
985
  current: currentBoard,
985
986
  });
986
- refuseArchivedParent(current.kind, parent);
987
+ refuseArchivedParent(parent);
987
988
  }
988
989
  const updatedAt = deps.now().toISOString();
989
990
  const updated = await deps.repository.updateNode({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anchrd/intel-api",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {