Support checked keyed relationships across portable operations and queries
This commit is contained in:
@@ -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`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user