import type { ObjectWithKeysFromStringArray, StoreBaseConfig } from '@purista/core'; import { ConfigStoreBaseClass } from '@purista/core'; import type { KV, NatsConnection } from 'nats'; import type { NatsConfigStoreConfig } from './types/NatsConfigStoreConfig.js'; /** * Config store backed by a NATS JetStream key-value bucket. * * JetStream must be enabled on the NATS server. Values are encoded with the NATS * `JSONCodec`, so stored values must be JSON-compatible. This store keeps only * the NATS connection and KV bucket handle in memory; values are read from the * bucket for each operation. * * The default bucket is `purista-config-store`. Use tenant-aware keys such as * `tenant.acme.prod.payments.public-api-url`, and configure NATS credentials via * connection options or your runtime environment. * * @example * ```typescript * const store = new NatsConfigStore({ * servers: 'nats://localhost:4222', * keyValueStoreName: 'purista-config-store', * }) * * await store.setConfig('tenant.acme.prod.app.features', { checkout: true }) * const config = await store.getConfig('tenant.acme.prod.app.features') * await store.destroy() * ``` */ export declare class NatsConfigStore extends ConfigStoreBaseClass { /** * Active NATS connection, created lazily by `getStore`. */ connection: NatsConnection | undefined; /** * JSON codec used to encode and decode values in the key-value bucket. */ sc: import("nats").Codec; /** * Cached JetStream key-value bucket handle. */ kv: KV | undefined; /** * Creates a NATS JetStream-backed config store. * * @param config Store options plus NATS connection and KV bucket options. */ constructor(config?: StoreBaseConfig>); /** * Returns a healthy JetStream key-value bucket handle. * * Reconnects when the previous connection was closed or is draining. */ getStore(): Promise; protected getConfigImpl(...stateNames: ConfigNames): Promise>; protected removeConfigImpl(stateName: string): Promise; protected setConfigImpl(stateName: string, stateValue: unknown): Promise; /** * Drains and closes the NATS connection and clears cached handles. * * Call this during application shutdown. */ destroy(): Promise; } //# sourceMappingURL=NatsConfigStore.impl.d.ts.map