GeoLeaf Core API - v3.19.0
    Preparing search index...

    Public API of the outbox store.

    interface OutboxDBInstance {
        append(entry: OutboxEntry): Promise<number>;
        list(): Promise<StoredOutboxEntry[]>;
        listByState(state: string): Promise<StoredOutboxEntry[]>;
        getById(id: string): Promise<StoredOutboxEntry | null>;
        listByEntity(
            layerId: string,
            localId: string,
        ): Promise<StoredOutboxEntry[]>;
        updateState(
            id: string,
            state: string,
            patch?: {
                attempts?: number;
                quarantine?: QuarantineReason | null;
                quarantineStatus?: number | null;
                inFlightAt?: number | null;
                nextAttemptAt?: number | null;
                baseVersion?: VersionMarker | null;
            },
        ): Promise<void>;
        remove(id: string): Promise<void>;
        count(): Promise<number>;
        countDue(now: number): Promise<number>;
    }
    Index
    • Entries touching one entity — coalescence (3.10) and join to features.

      Parameters

      • layerId: string
      • localId: string

      Returns Promise<StoredOutboxEntry[]>

    • 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.

      Parameters

      • id: string
      • state: string
      • Optionalpatch: {
            attempts?: number;
            quarantine?: QuarantineReason | null;
            quarantineStatus?: number | null;
            inFlightAt?: number | null;
            nextAttemptAt?: number | null;
            baseVersion?: VersionMarker | null;
        }
        • Optionalattempts?: number
        • Optionalquarantine?: QuarantineReason | null
        • OptionalquarantineStatus?: number | null

          HTTP status of the refusal. null erases it on requeue.

        • OptionalinFlightAt?: number | null

          When 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 | null

          Earliest replay date. 0 or null makes the entry replayable now.

        • OptionalbaseVersion?: VersionMarker | null

          The marker the entry's filter is built from. Moved when the write it was stacked behind returned a new one (push-engine.ts#rebaseFollowers).

      Returns Promise<void>

    • 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.

      Parameters

      • now: number

        The clock the deferral is judged against, passed in so the caller holds ONE reading for its whole decision.

      Returns Promise<number>