@danypops/papyrus 0.33.4 → 0.33.5
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/package.json +1 -1
- package/src/domain-services.ts +7 -4
- package/src/service.ts +1 -1
package/package.json
CHANGED
package/src/domain-services.ts
CHANGED
|
@@ -121,7 +121,10 @@ function templateSubtype(artifacts: ArtifactStore, templateId: string | undefine
|
|
|
121
121
|
return typeof subtype === "string" ? subtype : undefined;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
// No default action: linkDocument's own bug (both target and source checks silently defaulting to
|
|
125
|
+
// "status" here) was exactly what let a plain reference edge to a Task trip the tasks.* lifecycle
|
|
126
|
+
// guard, which is scoped to actual status changes only. Every call site now names its real action.
|
|
127
|
+
function requireMutableDocument(document: Artifact, authority: AuthorityRegistry, action: ArtifactAction): Artifact {
|
|
125
128
|
authority.requireArtifactAllowed(document.kind, document.subtype, action, "docs");
|
|
126
129
|
return document;
|
|
127
130
|
}
|
|
@@ -191,7 +194,7 @@ export function showDocument(artifacts: ArtifactStore, id: string): Artifact {
|
|
|
191
194
|
}
|
|
192
195
|
|
|
193
196
|
export function transitionDocument(artifacts: ArtifactStore, id: string, action: DocumentTransition, authority: AuthorityRegistry, context?: ArtifactEventContext): Artifact {
|
|
194
|
-
const document = requireLocallyOwnedContent(requireMutableDocument(requireDocument(artifacts, id), authority));
|
|
197
|
+
const document = requireLocallyOwnedContent(requireMutableDocument(requireDocument(artifacts, id), authority, "status"));
|
|
195
198
|
const transition = DOCUMENT_TRANSITIONS[action];
|
|
196
199
|
if (!transition.from.includes(document.status)) throw new Error(`cannot ${action} document from ${document.status}`);
|
|
197
200
|
return artifacts.setStatus(id, transition.to, context)!;
|
|
@@ -215,10 +218,10 @@ export function updateDocument(artifacts: ArtifactStore, id: string, input: Upda
|
|
|
215
218
|
}
|
|
216
219
|
|
|
217
220
|
export function linkDocument(artifacts: ArtifactStore, id: string, relation: DocumentRelation, targetId: string, authority: AuthorityRegistry, context?: ArtifactEventContext): Artifact {
|
|
218
|
-
requireLocallyOwnedContent(requireMutableDocument(requireDocument(artifacts, id), authority));
|
|
221
|
+
requireLocallyOwnedContent(requireMutableDocument(requireDocument(artifacts, id), authority, "link"));
|
|
219
222
|
const target = artifacts.get(targetId);
|
|
220
223
|
if (!target) throw new Error(`target artifact "${targetId}" not found`);
|
|
221
|
-
requireLocallyOwnedContent(requireMutableDocument(target, authority));
|
|
224
|
+
requireLocallyOwnedContent(requireMutableDocument(target, authority, "link"));
|
|
222
225
|
artifacts.link({ from: id, relation, to: targetId }, context);
|
|
223
226
|
return showDocument(artifacts, id);
|
|
224
227
|
}
|
package/src/service.ts
CHANGED
|
@@ -179,7 +179,7 @@ function lifecycleAuthorityClaim(owner: "docs" | "rules" | "skills" | "playbooks
|
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
function createAuthorityRegistry(): AuthorityRegistry {
|
|
182
|
+
export function createAuthorityRegistry(): AuthorityRegistry {
|
|
183
183
|
const authority = new AuthorityRegistry();
|
|
184
184
|
authority.claimAll([
|
|
185
185
|
notesAuthorityClaim,
|