moderator-toolbox-nxg-for-reddit / modules/shared/proposals/mutate
modules/shared/proposals/mutate¶
Functions¶
mutateProposals()¶
mutateProposals<
T>(subreddit,mutator,reason):Promise<T>
Defined in: extension/data/modules/shared/proposals/mutate.ts:56
Serialized, conflict-safe mutation of a subreddit’s proposals page.
Type Parameters¶
T¶
T
Parameters¶
subreddit¶
string
The subreddit to mutate.
mutator¶
The mutation to apply (see ProposalsMutator).
reason¶
string
The wiki revision note.
Returns¶
Promise<T>
The mutator’s result. Rejects only on transport failure, a refusal to
overwrite a newer-schema page, or after exhausting conflict retries.
Type Aliases¶
MutatorOutcome¶
MutatorOutcome<
T> = {result:T;write:true; } | {result:T;write:false; }
Defined in: extension/data/modules/shared/proposals/mutate.ts:37
The outcome of applying a mutator to the current proposals data.
write: true- the mutator changeddata; persist it and returnresult.write: false- no change is warranted (e.g. the target is already resolved); skip the write entirely and returnresult(typically a typed conflict/no-op).
result is the caller-defined value mutateProposals resolves with, so callers
can surface “already resolved by u/X” without throwing. (A back-compat alias over
the generic import(‘../../../util/wiki/mutateWikiPage’).MutatorOutcome; proposals never use its abort variant.)
Type Parameters¶
T¶
T
ProposalsMutator¶
ProposalsMutator<
T> = (data) =>MutatorOutcome<T>
Defined in: extension/data/modules/shared/proposals/mutate.ts:46
A mutation applied to proposals data. Receives the current (mutable) data and returns whether to persist plus a typed result. MUST be idempotent in intent: it is re-invoked with fresh data on every conflict retry.
Type Parameters¶
T¶
T