@adcp/sdk API Reference - v14.3.0
    Preparing search index...

    Interface EstablishedProposalStore

    Production persistence contract for established 3.0/3.1 proposal compatibility state.

    reserveMutation is an atomic compare-and-swap across every supplied binding. Implementations must use their database/server clock in that same transaction. Two workers must never both receive reserved for a first attempt, and authoritatively settled terminal records must never become executable again. A terminal commit-uncertain record remains fenced, but an exact seller-task reconciliation may complete it or release it after an authoritative terminal error. The mutation fence is proposal-wide within principal, seller, and version scope: alternate accountScope representations for the same proposalId must conflict once any representation is reserved or terminal.

    Every input and output must be detached from the backing store. Do not persist raw seller responses, authentication material, presigned URLs, or live coordinator objects. The SDK supplies only its reduced allow-listed proposal snapshot.

    interface EstablishedProposalStore {
        putSnapshot(
            snapshot: ProposalSnapshotEntry,
            expectedSnapshotFingerprint?: string,
        ): Promise<EstablishedProposalPutResult>;
        discardSnapshot(
            binding: EstablishedProposalBinding,
            expectedSnapshotFingerprint: string,
        ): Promise<"missing" | "fenced" | "discarded">;
        get(
            binding: EstablishedProposalBinding,
        ): Promise<EstablishedProposalRecord | undefined>;
        find(
            scope: EstablishedProposalScope,
            proposalIds: readonly string[],
        ): Promise<EstablishedProposalRecord[]>;
        findSubmittedTask(
            scope: EstablishedProposalTaskScope,
            sellerTaskId: string,
        ): Promise<EstablishedProposalSubmittedOperation | undefined>;
        reserveMutation(
            request: EstablishedProposalReserveRequest,
        ): Promise<EstablishedProposalReserveResult>;
        completeMutation(
            request: EstablishedProposalReserveRequest,
            disposition: "accepted",
            terminalResultFingerprint: string,
        ): Promise<EstablishedProposalTransitionResult>;
        completeRefinement(
            request: EstablishedProposalReserveRequest,
            replacements: readonly ProposalSnapshotEntry[],
            retainedBindings?: readonly EstablishedProposalMutationBinding[],
        ): Promise<EstablishedProposalTransitionResult>;
        completeDecline(
            request: EstablishedProposalReserveRequest,
            retainedBindings?: readonly EstablishedProposalMutationBinding[],
        ): Promise<EstablishedProposalTransitionResult>;
        pruneCompletionTombstones?(limit?: number): Promise<number>;
        releaseMutation(
            request: EstablishedProposalReserveRequest,
        ): Promise<EstablishedProposalTransitionResult>;
        recordSubmittedTask(
            request: EstablishedProposalReserveRequest,
            sellerTaskId: string,
        ): Promise<EstablishedProposalTransitionResult>;
        markAmbiguous(
            request: EstablishedProposalReserveRequest,
            ambiguity: "paused" | "commit-uncertain",
        ): Promise<EstablishedProposalTransitionResult>;
    }

    Implemented by

    Index
    • Delete completion tombstones whose store-authored retainUntil is at or before the store's current time. Implementations must never prune earlier than ESTABLISHED_PROPOSAL_COMPLETION_TOMBSTONE_RETENTION_MS after completion. After pruning, findSubmittedTask may return undefined and reserveMutation may return any result justified by the remaining source records (including a fresh reservation when every source was restored). limit is the maximum number of tombstones deleted in one call; ordering is unspecified. Return the number of deletions committed. Durable stores must select eligible rows and delete them atomically using one transaction and one backing-store clock snapshot.

      Optional for backward compatibility; durable implementations should implement this or provide an equivalent database-owned sweeper.

      Parameters

      • Optionallimit: number

      Returns Promise<number>