Skip to main content

Class: CheckpointPolicy

Defined in: policy.ts:12

Validates checkpoint triggers at save time and provides a count-based fallback trigger for periodic checkpointing.

Throws

if constructed with an empty after array.

Constructors

Constructor

new CheckpointPolicy(config): CheckpointPolicy

Defined in: policy.ts:22

Creates a checkpoint trigger policy.

Parameters

config

CheckpointPolicyConfig

Declares allowed trigger names and optional count cadence.

Returns

CheckpointPolicy

Methods

shouldCheckpointOnCount()

shouldCheckpointOnCount(): boolean

Defined in: policy.ts:61

Increment an internal counter and return true every everyN calls, resetting the counter on each trigger.

This is a count-based fallback that fires independently of named events.

Returns

boolean


validate()

validate(trigger): void

Defined in: policy.ts:43

Assert that trigger was declared at init time.

Parameters

trigger

string

Returns

void

Throws

if trigger is not a registered trigger.