Implement typed module contracts and conformance bindings
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { isStorableType } from "./generics.js";
|
||||
import { validateInitialization } from "./initialization.js";
|
||||
import { validatePresentations } from "./presentations.js";
|
||||
import { validateModules } from "./modules.js";
|
||||
import { validateWorkspaceControllers } from "./controllers.js";
|
||||
import { validateExecutionContracts } from "./execution.js";
|
||||
import { resolveForwardedBinding, type ConcreteBinding } from "./forwarding.js";
|
||||
@@ -48,6 +49,7 @@ import { isDeepStrictEqual } from "node:util";
|
||||
export type CapabilityValidationIssueCode =
|
||||
| "invalid-controller"
|
||||
| "invalid-presentation"
|
||||
| "invalid-module-contract"
|
||||
| "invalid-initialization"
|
||||
| "invalid-execution-contract"
|
||||
| "invalid-query-contract"
|
||||
@@ -543,7 +545,7 @@ const collectIdentityIndexes = (
|
||||
memberPath,
|
||||
"Keyed relationships require many cardinality and string, boolean or int64 keys",
|
||||
);
|
||||
if (member.kind !== "operation" && member.queryRead) {
|
||||
if (member.kind !== "operation" && member.kind !== "module" && member.queryRead) {
|
||||
const contract = member.queryRead.execution;
|
||||
const getter = member.kind === "value" ? "get" : "resolve";
|
||||
if (contract !== "native" && contract !== "rpc-permitted" && contract !== "portable")
|
||||
@@ -841,6 +843,8 @@ const validateInterfaces = (
|
||||
validateValueType(issues, member.valueType, `${memberPath}.valueType`, indexes);
|
||||
} else if (member.kind === "relationship") {
|
||||
validateConstraint(issues, member.target, `${memberPath}.target`, indexes);
|
||||
} else if (member.kind === "module") {
|
||||
if (member.subject) validateConstraint(issues, member.subject, `${memberPath}.subject`, indexes);
|
||||
} else {
|
||||
validateValueType(issues, member.inputType, `${memberPath}.inputType`, indexes);
|
||||
validateValueType(issues, member.outputType, `${memberPath}.outputType`, indexes);
|
||||
@@ -1671,6 +1675,7 @@ const validateConformances = (
|
||||
);
|
||||
if (
|
||||
member.kind !== "operation" &&
|
||||
member.kind !== "module" &&
|
||||
member.queryRead &&
|
||||
operation.displayName === (member.kind === "value" ? "get" : "resolve")
|
||||
) {
|
||||
@@ -2224,6 +2229,7 @@ export const validateWorkspaceRevision = (workspace: WorkspaceRevision): Capabil
|
||||
...validateExecutionContracts(workspace),
|
||||
...validateInitialization(workspace),
|
||||
...validatePresentations(workspace),
|
||||
...validateModules(workspace),
|
||||
...validateWorkspaceControllers(workspace),
|
||||
);
|
||||
return issues;
|
||||
@@ -2504,6 +2510,14 @@ export const computeCapabilityClosure = (
|
||||
for (const interfaceRevisionId of plan.interfaces.get(root.interfaceRevisionId)?.requiredInterfaces ?? []) {
|
||||
queued.push({ atomId: root.atomId, interfaceRevisionId });
|
||||
}
|
||||
for (const module of conformance.source.moduleBindings ?? []) {
|
||||
packages.add(module.packageRevisionId);
|
||||
const member = plan.interfaces
|
||||
.get(root.interfaceRevisionId)
|
||||
?.members.find((member) => member.id === module.memberId);
|
||||
if (member?.kind === "module" && member.subject?.kind === "interface")
|
||||
queued.push({ atomId: root.atomId, interfaceRevisionId: member.subject.interfaceRevisionId });
|
||||
}
|
||||
for (const binding of conformance.operationBindings.values()) {
|
||||
if (binding.kind === "state") {
|
||||
attachments.add(binding.slotId);
|
||||
|
||||
Reference in New Issue
Block a user