Support checked keyed relationships across portable operations and queries

This commit is contained in:
Timothy J. Aveni
2026-09-25 12:02:05 -07:00
parent e0e8563224
commit 1bc3c69de3
23 changed files with 1203 additions and 949 deletions
+6 -2
View File
@@ -163,12 +163,16 @@ function methods(
});
case "edge": {
const ref: ValueType = { kind: "object-ref", expectation: req.target };
const item: ValueType = { kind: "record", fields: { entry: string, target: ref } };
const mapKey: ValueType | undefined = req.keyType
? { kind: "scalar", name: req.keyType === "boolean" ? "bool" : req.keyType }
: undefined;
const item: ValueType = { kind: "record", fields: { entry: string, target: ref, ...(mapKey ? { mapKey } : {}) } };
const connectInput: ValueType = mapKey ? { kind: "record", fields: { mapKey, target: ref } } : ref;
return req.primitives.map((primitive) => {
if (primitive === "resolve")
return method("resolve", { kind: "edge", primitive }, unit, { kind: "list", value: item });
writable();
if (primitive === "connect") return method("connect", { kind: "edge", primitive }, ref, string, true);
if (primitive === "connect") return method("connect", { kind: "edge", primitive }, connectInput, string, true);
if (primitive === "disconnect") return method("disconnect", { kind: "edge", primitive }, string, bool);
throw new PortableBindingError(path, `Edge ${primitive} is not supported by this portable adapter yet`);
});