Expose authoritative lifecycle deletion through capability bindings
This commit is contained in:
@@ -70,6 +70,7 @@ export type CapabilityValidationIssueCode =
|
||||
| "invalid-attachment"
|
||||
| "invalid-state-binding"
|
||||
| "invalid-edge-binding"
|
||||
| "invalid-lifecycle-binding"
|
||||
| "invalid-package-binding"
|
||||
| "invalid-forwarding-binding"
|
||||
| "invalid-dependency-binding"
|
||||
@@ -1696,6 +1697,24 @@ const validateConformances = (
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (binding.kind === "lifecycle") {
|
||||
if (
|
||||
binding.primitive !== "delete" ||
|
||||
operationEntry.member.kind !== "operation" ||
|
||||
operation.mode !== "call" ||
|
||||
operation.inputType.kind !== "builtin" ||
|
||||
operation.inputType.name !== "unit" ||
|
||||
operation.outputType.kind !== "builtin" ||
|
||||
operation.outputType.name !== "unit"
|
||||
)
|
||||
issue(
|
||||
issues,
|
||||
"invalid-lifecycle-binding",
|
||||
bindingPath,
|
||||
"Deletion implements an object call from unit to unit",
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if (binding.kind === "state") {
|
||||
const attachment = findAttachment(indexes, "state", binding.slotId);
|
||||
if (!attachment || attachment.attachment.kind !== "state") {
|
||||
@@ -2324,6 +2343,7 @@ export const resolveOperationPlan = (
|
||||
attachment: owned as OwnedAttachment & { attachment: EdgeDefinition },
|
||||
};
|
||||
}
|
||||
if (binding.kind === "lifecycle") return undefined; // Old runtime has no lifecycle provider.
|
||||
const packageRevision = plan.packages.get(binding.packageRevisionId);
|
||||
const packageExport = packageRevision?.exports.find(
|
||||
(entry): entry is PackageOperationExport | PackageFunctionExport =>
|
||||
@@ -2469,7 +2489,7 @@ export const computeCapabilityClosure = (
|
||||
attachments.add(binding.edgeTypeId);
|
||||
} else if (binding.kind === "interface") {
|
||||
queued.push({ atomId: root.atomId, interfaceRevisionId: binding.interfaceRevisionId });
|
||||
} else {
|
||||
} else if (binding.kind === "package") {
|
||||
packages.add(binding.packageRevisionId);
|
||||
includeDependencies(root.atomId, binding.dependencies);
|
||||
const packageRevision = plan.packages.get(binding.packageRevisionId);
|
||||
|
||||
Reference in New Issue
Block a user