Appends an entry. seq is minted here; any seq on the argument is ignored.
Every entry, in INSERTION order.
Entries in one state, in insertion order within that state.
Looks an entry up by its contract id (unique index).
Entries touching one entity — coalescence (3.10) and join to features.
Changes an entry's state, and — when patch is given — its attempt counter and
quarantine motive, in the SAME transaction.
⚠️ patch exists because a quarantine state without a motive says nothing:
the contract declares quarantine?: QuarantineReason on the entry, and until
now no path could write it. Writing the state first then the motive would have
opened a window where the entry is set aside with nobody knowing why.
Optionalpatch: {Optionalattempts?: numberOptionalquarantine?: QuarantineReason | nullOptionalquarantineStatus?: number | nullHTTP status of the refusal. null erases it on requeue.
OptionalinFlightAt?: number | nullWhen the entry went on the wire. Written WITH the inFlight state, never
after: a state saying "in flight" without the date that dates it is exactly
the entry no reclaim can tell from one another tab is sending.
OptionalnextAttemptAt?: number | nullEarliest replay date. 0 or null makes the entry replayable now.
OptionalbaseVersion?: VersionMarker | nullThe marker the entry's filter is built from. Moved when the write it was
stacked behind returned a new one (push-engine.ts#rebaseFollowers).
How many entries are replayable RIGHT NOW — pending or failed, and past their
retry delay.
🛑 count() cannot answer this question, and using it would be worse than not
asking. It counts everything the store holds, quarantined included — an entry
that is by definition NOT replayable. A periodic trigger reading count() would
therefore wake the device forever after the first quarantine, on a queue nothing
can move. And it ignores nextAttemptAt, so it also wakes for entries the drain
would walk straight past.
The clock the deferral is judged against, passed in so the caller holds ONE reading for its whole decision.
Public API of the outbox store.