Skip to content

idempotent

idempotent(options): PipelineBehaviorTuple<IdempotencyBehavior, IdempotencyBehaviorOptions>

Defined in: packages/pipeline-idempotency/src/helpers/idempotency.intent.ts:38

Returns an idempotency behavior entry for pipeline.wrap() or createPipeline({ globalBehaviors }).

IdempotencyIntentOptions

A key factory and idempotency options, or inheritModuleKey: true when the behavior’s constructor defaults supply the key factory. The inheritance marker is not forwarded to the behavior and does not validate module configuration.

PipelineBehaviorTuple<IdempotencyBehavior, IdempotencyBehaviorOptions>

The behavior class and options tuple. Keys must distinguish operations and any tenant/principal scope that changes the authorized response; a shared key can replay another caller’s response.

export const createUser = pipeline.wrap(
{ name: 'createUser', kind: 'command' },
idempotent({ keyFactory: createUserKey, ttl: 86_400_000 }),
)(users.create);
// The key factory comes from the IdempotencyBehavior constructor defaults.
const entry = idempotent({ inheritModuleKey: true });