bijection/archive.ts
Declaring an interface
defineOperationInterface takes three fields:
name: the interface’s name. It starts with a letter or_, may contain letters, digits,_and., and is at most 128 characters long.args: the shared arguments, without the target.returns: the shared result.
Implementing an interface
A concrete operation opts in withimplements. Each implementation must:
- declare
target: { argument: "target" }, with a requiredtargetargument that is an ID of its own object type; - declare exactly the interface’s other arguments, and exactly its result.
defineOperation refuses an implementation whose shape does not match. An
operation can implement up to 16 interfaces.
When you deploy, at most one operation per interface and object type is admitted
in a component, private operations included. Two implementations for the same
pair are refused rather than one being picked.
Nothing is inferred. An interface does not make a view’s field editable, and
does not map one argument name to another. Each implementation spells out its
own change.
Discovering implementations
The exported interface is an ordinary query. Call it with an optionalon
filter, the name of an object type in your schema, and it returns the public
implementations in that component that the caller can currently read:
src/archive.ts
operationImplementationReference turns a discovered implementation into an
ordinary operation reference.
From there, previewing, invoking, recovering and following a request work as
for any operation.
An empty result means no implementation is available to this caller, not that
none exists. Discovery grants nothing either: previewing and invoking still need
the concrete operation’s grants.