Restore the workspace canvas and atomic Studio creation workflow
This commit is contained in:
+28
-19
@@ -103,6 +103,7 @@ interface Method {
|
||||
input: ValueType;
|
||||
output: ValueType;
|
||||
keyed: boolean;
|
||||
explicitInput?: boolean;
|
||||
}
|
||||
function methods(
|
||||
schema: BindingSchema,
|
||||
@@ -185,7 +186,7 @@ function methods(
|
||||
if (
|
||||
(execution.kind === "remote" ? !remote : !execution.targets.includes(target)) ||
|
||||
op.mode !== "call" ||
|
||||
op.scope === "class"
|
||||
(op.scope === "class" && (remote || req.receiver === "input"))
|
||||
)
|
||||
throw new PortableBindingError(
|
||||
`${path}.${member.displayName}.${op.displayName}`,
|
||||
@@ -194,24 +195,27 @@ function methods(
|
||||
if (execution.kind === "transaction" && !remote) writable();
|
||||
if (req.receiver === "input" && remote)
|
||||
throw new PortableBindingError(path, "Reference-selected dependencies require portable execution");
|
||||
return method(
|
||||
`${member.displayName}.${op.displayName}`,
|
||||
{ kind: "interface", operationId: op.id },
|
||||
req.receiver === "input"
|
||||
? {
|
||||
kind: "record",
|
||||
fields: {
|
||||
receiver: {
|
||||
kind: "object-ref",
|
||||
expectation: { kind: "interface", interfaceRevisionId: req.interfaceRevisionId },
|
||||
return {
|
||||
...method(
|
||||
`${member.displayName}.${op.displayName}`,
|
||||
{ kind: "interface", operationId: op.id },
|
||||
req.receiver === "input"
|
||||
? {
|
||||
kind: "record",
|
||||
fields: {
|
||||
receiver: {
|
||||
kind: "object-ref",
|
||||
expectation: { kind: "interface", interfaceRevisionId: req.interfaceRevisionId },
|
||||
},
|
||||
input: op.inputType,
|
||||
},
|
||||
input: op.inputType,
|
||||
},
|
||||
}
|
||||
: op.inputType,
|
||||
op.outputType,
|
||||
execution.kind === "transaction",
|
||||
);
|
||||
}
|
||||
: op.inputType,
|
||||
op.outputType,
|
||||
execution.kind === "transaction",
|
||||
),
|
||||
...(op.scope === "class" ? { explicitInput: true } : {}),
|
||||
};
|
||||
});
|
||||
}
|
||||
default:
|
||||
@@ -276,7 +280,7 @@ function generateBindings(
|
||||
throw new PortableBindingError(port.id, "Duplicate method name");
|
||||
all.push(...selected);
|
||||
facets.push(
|
||||
`readonly ${q(port.displayName)}: { ${selected.map((m) => `readonly ${q(m.name)}: (${[...(isUnit(m.input) ? [] : [`input: ${tsType(m.input)}`]), ...(m.keyed ? [remote ? "options: ServerMutationOptions" : "options: MutationKey"] : [])].join(", ")}) => Promise<${tsType(m.output)}>`).join("; ")} }`,
|
||||
`readonly ${q(port.displayName)}: { ${selected.map((m) => `readonly ${q(m.name)}: (${[...(isUnit(m.input) && !m.explicitInput ? [] : [`input: ${tsType(m.input)}`]), ...(m.keyed ? [remote ? "options: ServerMutationOptions" : "options: MutationKey"] : [])].join(", ")}) => Promise<${tsType(m.output)}>`).join("; ")} }`,
|
||||
);
|
||||
}
|
||||
const receiver =
|
||||
@@ -312,6 +316,10 @@ function generateBindings(
|
||||
});
|
||||
}
|
||||
const groups = new Map<string, typeof entries>();
|
||||
for (const template of pkg.genericExports ?? []) {
|
||||
if (template.execution?.kind !== "remote" && template.execution?.targets.includes(options.target))
|
||||
groups.set(template.displayName, []);
|
||||
}
|
||||
for (const entry of entries) {
|
||||
if (!entry.application) continue;
|
||||
const template = pkg.genericExports?.find((item) => item.id === entry.application!.exportId);
|
||||
@@ -319,6 +327,7 @@ function generateBindings(
|
||||
groups.set(template.displayName, [...(groups.get(template.displayName) ?? []), entry]);
|
||||
}
|
||||
const generic = [...groups].map(([name, applications]) => {
|
||||
if (!applications.length) return `${q(name)}: (_handler: unknown) => ({})`;
|
||||
contexts.push(
|
||||
`readonly ${q(name)}: ${applications.map((entry) => `Contexts[${q(entry.displayName)}]`).join(" | ")}`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user