A project client sees its project. A team client sees team events and every
project’s events.
List events
type, since, and until. To read one event with its body, ask
for the payload:
payloadAvailability tells you when a body is
not available, for example after it expired. See Event history.
Poll for new events
listIndexed returns events in the order Polymorfa stored them, not the order
they happened. Use it for polling: an event that is stored late, such as a
message received after a reconnect, still appears after your saved offset.
Start from a baseline, then poll from the saved offset:
hasMore is true, continue from nextOffset. When the page is
exhausted, save highWatermark and pass it on your next poll. Offsets are
decimal strings. Keep them as strings.
Stream events in real time
Event streams are a beta. A team owner or admin enrolls the team in the Console.
Without enrollment, the stream throws
PolymorfaAuthorizationError with code
feature_unavailable. See Event streams.stream() reconnects after a dropped connection and resumes from the last
event it delivered. Each item has:
event: the event record, with the same fields asevents.retrieve.webhook: the webhook body, ornullwhen the body was not kept.cursor: the position after this event.
since. Pass onGap to
learn when events expired before you resumed. Aborting the signal or leaving the
loop closes the stream. A team client must pass projectId.
Run streams on your server only. Client tokens cannot open them.
Replay an event
Send a stored event to one webhook endpoint again:replayableUntil time.
Wait for an operation
Methods that start background work return an operation ID. Wait for it to finish:wait returns when the operation succeeds, fails, or is cancelled, or when
maxWaitMs ends (5 minutes by default). It returns the latest state either
way, so always check status.
Find and cancel operations
get(id) reads one operation. Pass { wait: 30 } to hold the request open for
up to 30 seconds until the operation changes. listTransitions(id) lists its
state changes. Cancelling works only while capabilities.cancellable is
true. See Operations.