Skip to main content
Version: 2.x

Interface: CreditsServiceOptions

Defined in: javascript/src/credits/service-types.ts:37

Properties

analytics?

optional analytics?: UsageAnalyticsStore | null

Defined in: javascript/src/credits/service-types.ts:45

Optional read-only analytics backend. Defaults to the credit store, which keeps PostgreSQL as the zero-infrastructure behavior.


catalogCacheTtlMs?

optional catalogCacheTtlMs?: number

Defined in: javascript/src/credits/service-types.ts:67

Catalog cache TTL in milliseconds. A value of 0 disables automatic reloads. Concurrent reloads are deduplicated. Defaults to 300,000.


defaultTtlSeconds?

optional defaultTtlSeconds?: number

Defined in: javascript/src/credits/service-types.ts:60

Default lease TTL in seconds. Defaults to 600.


instrumentation?

optional instrumentation?: Instrumentation | null

Defined in: javascript/src/credits/service-types.ts:40

Explicit telemetry implementation; falls back to Bursar's no-op registry.


lazyExpiry?

optional lazyExpiry?: boolean

Defined in: javascript/src/credits/service-types.ts:62

Sweep a subject's expired credits before balance-sensitive operations.


logger?

optional logger?: Logger | null

Defined in: javascript/src/credits/service-types.ts:38


lowBalance?

optional lowBalance?: LowBalanceConfig | null

Defined in: javascript/src/credits/service-types.ts:58

Edge-triggered low-balance thresholds and optional non-blocking handler. Defaults to zero when omitted.


maxConcurrent?

optional maxConcurrent?: number | null

Defined in: javascript/src/credits/service-types.ts:53

Planless-subject admission limit fallback.


overdraftFloor?

optional overdraftFloor?: ExactAmount | null

Defined in: javascript/src/credits/service-types.ts:51

Planless-subject floor used with the overdraft fallback.


policy?

optional policy?: PolicyPreset

Defined in: javascript/src/credits/service-types.ts:49

Fallback credit policy for subjects without a plan assignment.


postDeduction?

optional postDeduction?: ((context) => void | Promise<void>) | null

Defined in: javascript/src/credits/service-types.ts:72

Awaited after a committed, non-replayed deduction. Hook failures are isolated from the committed credit charge.


usageStore?

optional usageStore?: UsageChargeStore | null

Defined in: javascript/src/credits/service-types.ts:47

Optional usage-history backend. Defaults to the credit store.