@horizon-republic/nestjs-jetstream 2.11.1 → 2.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -553,9 +553,13 @@ declare class JetstreamClient extends ClientProxy {
553
553
  * uses a separate `_sch` namespace that is NOT matched by any consumer filter.
554
554
  * NATS holds the message and publishes it to the target subject after the delay.
555
555
  *
556
+ * A unique per-message suffix is appended because the server stores schedules
557
+ * as rollup messages — one active schedule per subject (ADR-51). Without it,
558
+ * concurrent schedules of the same pattern would silently replace each other.
559
+ *
556
560
  * Examples:
557
- * - `{svc}__microservice.ev.order.reminder` → `{svc}__microservice._sch.order.reminder`
558
- * - `broadcast.config.updated` → `broadcast._sch.config.updated`
561
+ * - `{svc}__microservice.ev.order.reminder` → `{svc}__microservice._sch.order.reminder.<nuid>`
562
+ * - `broadcast.config.updated` → `broadcast._sch.config.updated.<nuid>`
559
563
  */
560
564
  private buildScheduleSubject;
561
565
  }
@@ -935,6 +939,8 @@ interface OtelOptions {
935
939
  errorClassifier?(err: unknown): ErrorClassification;
936
940
  }
937
941
 
942
+ type ProvisioningEntity = 'stream' | 'consumer';
943
+
938
944
  /**
939
945
  * Stream config overrides exposed to users.
940
946
  *
@@ -1073,6 +1079,14 @@ interface MetadataRegistryOptions {
1073
1079
  */
1074
1080
  ttl?: number;
1075
1081
  }
1082
+ /** Provisioning behavior. Stream reservations are always logged at boot (INFO). */
1083
+ interface ProvisioningOptions {
1084
+ /**
1085
+ * Opt-in storage budget check via `getAccountInfo()` before provisioning.
1086
+ * Warn-only; never blocks boot. Off by default.
1087
+ */
1088
+ preflightStorageCheck?: boolean;
1089
+ }
1076
1090
  /**
1077
1091
  * Root module configuration for `JetstreamModule.forRoot()`.
1078
1092
  *
@@ -1240,6 +1254,8 @@ interface JetstreamModuleOptions {
1240
1254
  * @see OtelOptions
1241
1255
  */
1242
1256
  otel?: OtelOptions | boolean;
1257
+ /** Provisioning behavior. */
1258
+ provisioning?: ProvisioningOptions;
1243
1259
  }
1244
1260
  /** Options for `JetstreamModule.forFeature()`. */
1245
1261
  interface JetstreamFeatureOptions {
@@ -1313,8 +1329,11 @@ interface DeadLetterConfig {
1313
1329
  * Used to detect when a message from a given stream has exhausted all delivery attempts.
1314
1330
  */
1315
1331
  maxDeliverByStream: Map<string, number>;
1316
- /** Async callback invoked when a message exhausts all deliveries. */
1317
- onDeadLetter(info: DeadLetterInfo): Promise<void>;
1332
+ /**
1333
+ * Async callback invoked when a message exhausts all deliveries.
1334
+ * Optional: in dlq-only mode dead letters go to the DLQ stream without a callback.
1335
+ */
1336
+ onDeadLetter?(info: DeadLetterInfo): Promise<void>;
1318
1337
  }
1319
1338
  /** Options for configuring RPC processing behavior. */
1320
1339
  interface RpcRouterOptions {
@@ -1455,6 +1474,11 @@ declare class StreamProvider {
1455
1474
  private handleExistingStream;
1456
1475
  private buildMutableOnlyConfig;
1457
1476
  private logChanges;
1477
+ private buildReservation;
1478
+ private errorContext;
1479
+ private runStreamOp;
1480
+ /** The broadcast stream is global — every service in the cluster shares it. */
1481
+ private isSharedStream;
1458
1482
  /** Build the full stream config by merging defaults with user overrides. */
1459
1483
  private buildConfig;
1460
1484
  /**
@@ -1508,12 +1532,21 @@ declare class EventRouter {
1508
1532
  private getConcurrency;
1509
1533
  private getAckExtensionConfig;
1510
1534
  /**
1511
- * Last-resort path for a dead letter: invoke `onDeadLetter`, then `term` on
1512
- * success or `nak` on hook failure so NATS retries on the next delivery
1513
- * cycle. Used when DLQ stream isn't configured, or when publishing to it
1514
- * failed and we still have to surface the message somewhere observable.
1535
+ * Last resort: invoke onDeadLetter, then term on success. On failure the
1536
+ * message is nak'd never redelivered past max_deliver, but preserved.
1515
1537
  */
1516
1538
  private fallbackToOnDeadLetterCallback;
1539
+ /**
1540
+ * Copy headers for the DLQ republish, dropping NATS control headers — a
1541
+ * copied Nats-TTL would expire the DLQ entry, Nats-Msg-Id trips dedup.
1542
+ */
1543
+ private buildDlqHeaders;
1544
+ /**
1545
+ * Past max_deliver the server never redelivers, so these in-process attempts
1546
+ * are the only second chance a dead letter gets. No artificial delay — an
1547
+ * unreachable broker already spaces attempts via its own request timeout.
1548
+ */
1549
+ private publishToDlqWithRetry;
1517
1550
  /**
1518
1551
  * Publish a dead letter to the configured Dead-Letter Queue (DLQ) stream.
1519
1552
  *
@@ -1624,6 +1657,7 @@ declare class ConsumerProvider {
1624
1657
  * Create a consumer, handling the race where another pod creates it first.
1625
1658
  */
1626
1659
  private createConsumer;
1660
+ private runConsumerOp;
1627
1661
  /** Build consumer config by merging defaults with user overrides. */
1628
1662
  private buildConfig;
1629
1663
  /** Get default config for a consumer kind. */
@@ -1765,7 +1799,7 @@ declare class MetadataProvider {
1765
1799
  * NATS JetStream API error codes used by the transport.
1766
1800
  *
1767
1801
  * Ref: https://github.com/nats-io/nats-server (server error definitions)
1768
- * Verified on NATS 2.12.6 via integration tests (2026-04-02).
1802
+ * Codes verified across NATS 2.12.6–2.14.1 via integration tests (original codes: 2026-04-02).
1769
1803
  */
1770
1804
  declare enum NatsErrorCode {
1771
1805
  /** Consumer does not exist on the specified stream. */
@@ -1773,7 +1807,14 @@ declare enum NatsErrorCode {
1773
1807
  /** Consumer name already in use with different configuration (race condition on create). */
1774
1808
  ConsumerAlreadyExists = 10148,
1775
1809
  /** Stream does not exist. */
1776
- StreamNotFound = 10059
1810
+ StreamNotFound = 10059,
1811
+ /** Storage resources exceeded — reservation exceeds server `max_file_store`. */
1812
+ StorageResourcesExceeded = 10047,
1813
+ /**
1814
+ * No suitable peers for placement (fewer healthy peers than `num_replicas`,
1815
+ * or no peer has storage headroom). Confirmed at runtime by the cluster integration test.
1816
+ */
1817
+ NoSuitablePeers = 10005
1777
1818
  }
1778
1819
 
1779
1820
  /**
@@ -1808,7 +1849,7 @@ declare class JetstreamStrategy extends Server implements CustomTransportStrateg
1808
1849
  *
1809
1850
  * Called by NestJS when `connectMicroservice()` is used, or internally by the module.
1810
1851
  */
1811
- listen(callback: () => void): Promise<void>;
1852
+ listen(callback: (...args: unknown[]) => void): Promise<void>;
1812
1853
  /** Stop all consumers, routers, subscriptions, and metadata heartbeat. Called during shutdown. */
1813
1854
  close(): void;
1814
1855
  /**
@@ -1838,9 +1879,13 @@ declare class JetstreamStrategy extends Server implements CustomTransportStrateg
1838
1879
  unwrap<T>(): T;
1839
1880
  /** Access the pattern registry (for module-level introspection). */
1840
1881
  getPatternRegistry(): PatternRegistry;
1882
+ private doListen;
1841
1883
  /** Determine which streams and durable consumers are needed. */
1842
1884
  private resolveRequiredKinds;
1843
- /** Populate the shared ack_wait map from actual NATS consumer configs. */
1885
+ /** Subscribe the event and RPC routers to the message subjects. */
1886
+ private startRouters;
1887
+ /** Begin durable and ordered consumption; routers must already be subscribed. */
1888
+ private startConsumption;
1844
1889
  private populateAckWaitMap;
1845
1890
  /** Build max_deliver map from actual NATS consumer configs (not options). */
1846
1891
  private buildMaxDeliverMap;
@@ -2347,4 +2392,30 @@ declare const isJetStreamRpcMode: (rpc: RpcConfig | undefined) => boolean;
2347
2392
  /** Check if the RPC config specifies Core mode (default). */
2348
2393
  declare const isCoreRpcMode: (rpc: RpcConfig | undefined) => boolean;
2349
2394
 
2350
- export { type CaptureBodyOptions, type Codec, ConsumeKind, type ConsumeSourceMsg, DEFAULT_BROADCAST_CONSUMER_CONFIG, DEFAULT_BROADCAST_STREAM_CONFIG, DEFAULT_COMMAND_CONSUMER_CONFIG, DEFAULT_COMMAND_STREAM_CONFIG, DEFAULT_DLQ_STREAM_CONFIG, DEFAULT_EVENT_CONSUMER_CONFIG, DEFAULT_EVENT_STREAM_CONFIG, DEFAULT_JETSTREAM_RPC_TIMEOUT, DEFAULT_METADATA_BUCKET, DEFAULT_METADATA_HISTORY, DEFAULT_METADATA_REPLICAS, DEFAULT_METADATA_TTL, DEFAULT_ORDERED_STREAM_CONFIG, DEFAULT_RPC_TIMEOUT, DEFAULT_SHUTDOWN_TIMEOUT, DEFAULT_TRACES, type DeadLetterInfo, type ErrorClassification, type HandlerMetadata, JETSTREAM_CODEC, JETSTREAM_CONNECTION, JETSTREAM_OPTIONS, JetstreamClient, type JetstreamConsumeContext, JetstreamDlqHeader, type JetstreamFeatureOptions, JetstreamHeader, JetstreamHealthIndicator, type JetstreamHealthStatus, JetstreamModule, type JetstreamModuleAsyncOptions, type JetstreamModuleOptions, type JetstreamPublishContext, JetstreamRecord, JetstreamRecordBuilder, type JetstreamResponseContext, JetstreamStrategy, JetstreamTrace, JsonCodec, MIN_METADATA_TTL, MessageKind, type MetadataRegistryOptions, MsgpackCodec, NatsErrorCode, type OrderedEventOverrides, type OtelOptions, PatternPrefix, PublishKind, RESERVED_HEADERS, type RpcConfig, RpcContext, type ScheduleRecordOptions, type ServerEndpoint, type StreamConfigOverrides, type StreamConsumerOverrides, StreamKind, TRACER_NAME, TransportEvent, type TransportHooks, buildBroadcastSubject, buildSubject, consumerName, dlqStreamName, getClientToken, internalName, isCoreRpcMode, isJetStreamRpcMode, metadataKey, streamName, toNanos };
2395
+ interface ProvisioningErrorFields {
2396
+ readonly entity: ProvisioningEntity;
2397
+ readonly target: string;
2398
+ readonly kind: string;
2399
+ readonly errCode: number;
2400
+ readonly errDescription: string;
2401
+ readonly remediation: string;
2402
+ readonly maxBytes?: number;
2403
+ readonly numReplicas?: number;
2404
+ readonly reservation?: number;
2405
+ readonly cause: unknown;
2406
+ }
2407
+ /** Non-recoverable stream/consumer provisioning failure; preserves the NATS error as `cause`. */
2408
+ declare class JetstreamProvisioningError extends Error {
2409
+ readonly entity: ProvisioningEntity;
2410
+ readonly target: string;
2411
+ readonly kind: string;
2412
+ readonly errCode: number;
2413
+ readonly errDescription: string;
2414
+ readonly remediation: string;
2415
+ readonly maxBytes?: number;
2416
+ readonly numReplicas?: number;
2417
+ readonly reservation?: number;
2418
+ constructor(fields: ProvisioningErrorFields);
2419
+ }
2420
+
2421
+ export { type CaptureBodyOptions, type Codec, ConsumeKind, type ConsumeSourceMsg, DEFAULT_BROADCAST_CONSUMER_CONFIG, DEFAULT_BROADCAST_STREAM_CONFIG, DEFAULT_COMMAND_CONSUMER_CONFIG, DEFAULT_COMMAND_STREAM_CONFIG, DEFAULT_DLQ_STREAM_CONFIG, DEFAULT_EVENT_CONSUMER_CONFIG, DEFAULT_EVENT_STREAM_CONFIG, DEFAULT_JETSTREAM_RPC_TIMEOUT, DEFAULT_METADATA_BUCKET, DEFAULT_METADATA_HISTORY, DEFAULT_METADATA_REPLICAS, DEFAULT_METADATA_TTL, DEFAULT_ORDERED_STREAM_CONFIG, DEFAULT_RPC_TIMEOUT, DEFAULT_SHUTDOWN_TIMEOUT, DEFAULT_TRACES, type DeadLetterInfo, type ErrorClassification, type HandlerMetadata, JETSTREAM_CODEC, JETSTREAM_CONNECTION, JETSTREAM_OPTIONS, JetstreamClient, type JetstreamConsumeContext, JetstreamDlqHeader, type JetstreamFeatureOptions, JetstreamHeader, JetstreamHealthIndicator, type JetstreamHealthStatus, JetstreamModule, type JetstreamModuleAsyncOptions, type JetstreamModuleOptions, JetstreamProvisioningError, type JetstreamPublishContext, JetstreamRecord, JetstreamRecordBuilder, type JetstreamResponseContext, JetstreamStrategy, JetstreamTrace, JsonCodec, MIN_METADATA_TTL, MessageKind, type MetadataRegistryOptions, MsgpackCodec, NatsErrorCode, type OrderedEventOverrides, type OtelOptions, PatternPrefix, type ProvisioningOptions, PublishKind, RESERVED_HEADERS, type RpcConfig, RpcContext, type ScheduleRecordOptions, type ServerEndpoint, type StreamConfigOverrides, type StreamConsumerOverrides, StreamKind, TRACER_NAME, TransportEvent, type TransportHooks, buildBroadcastSubject, buildSubject, consumerName, dlqStreamName, getClientToken, internalName, isCoreRpcMode, isJetStreamRpcMode, metadataKey, streamName, toNanos };
package/dist/index.d.ts CHANGED
@@ -553,9 +553,13 @@ declare class JetstreamClient extends ClientProxy {
553
553
  * uses a separate `_sch` namespace that is NOT matched by any consumer filter.
554
554
  * NATS holds the message and publishes it to the target subject after the delay.
555
555
  *
556
+ * A unique per-message suffix is appended because the server stores schedules
557
+ * as rollup messages — one active schedule per subject (ADR-51). Without it,
558
+ * concurrent schedules of the same pattern would silently replace each other.
559
+ *
556
560
  * Examples:
557
- * - `{svc}__microservice.ev.order.reminder` → `{svc}__microservice._sch.order.reminder`
558
- * - `broadcast.config.updated` → `broadcast._sch.config.updated`
561
+ * - `{svc}__microservice.ev.order.reminder` → `{svc}__microservice._sch.order.reminder.<nuid>`
562
+ * - `broadcast.config.updated` → `broadcast._sch.config.updated.<nuid>`
559
563
  */
560
564
  private buildScheduleSubject;
561
565
  }
@@ -935,6 +939,8 @@ interface OtelOptions {
935
939
  errorClassifier?(err: unknown): ErrorClassification;
936
940
  }
937
941
 
942
+ type ProvisioningEntity = 'stream' | 'consumer';
943
+
938
944
  /**
939
945
  * Stream config overrides exposed to users.
940
946
  *
@@ -1073,6 +1079,14 @@ interface MetadataRegistryOptions {
1073
1079
  */
1074
1080
  ttl?: number;
1075
1081
  }
1082
+ /** Provisioning behavior. Stream reservations are always logged at boot (INFO). */
1083
+ interface ProvisioningOptions {
1084
+ /**
1085
+ * Opt-in storage budget check via `getAccountInfo()` before provisioning.
1086
+ * Warn-only; never blocks boot. Off by default.
1087
+ */
1088
+ preflightStorageCheck?: boolean;
1089
+ }
1076
1090
  /**
1077
1091
  * Root module configuration for `JetstreamModule.forRoot()`.
1078
1092
  *
@@ -1240,6 +1254,8 @@ interface JetstreamModuleOptions {
1240
1254
  * @see OtelOptions
1241
1255
  */
1242
1256
  otel?: OtelOptions | boolean;
1257
+ /** Provisioning behavior. */
1258
+ provisioning?: ProvisioningOptions;
1243
1259
  }
1244
1260
  /** Options for `JetstreamModule.forFeature()`. */
1245
1261
  interface JetstreamFeatureOptions {
@@ -1313,8 +1329,11 @@ interface DeadLetterConfig {
1313
1329
  * Used to detect when a message from a given stream has exhausted all delivery attempts.
1314
1330
  */
1315
1331
  maxDeliverByStream: Map<string, number>;
1316
- /** Async callback invoked when a message exhausts all deliveries. */
1317
- onDeadLetter(info: DeadLetterInfo): Promise<void>;
1332
+ /**
1333
+ * Async callback invoked when a message exhausts all deliveries.
1334
+ * Optional: in dlq-only mode dead letters go to the DLQ stream without a callback.
1335
+ */
1336
+ onDeadLetter?(info: DeadLetterInfo): Promise<void>;
1318
1337
  }
1319
1338
  /** Options for configuring RPC processing behavior. */
1320
1339
  interface RpcRouterOptions {
@@ -1455,6 +1474,11 @@ declare class StreamProvider {
1455
1474
  private handleExistingStream;
1456
1475
  private buildMutableOnlyConfig;
1457
1476
  private logChanges;
1477
+ private buildReservation;
1478
+ private errorContext;
1479
+ private runStreamOp;
1480
+ /** The broadcast stream is global — every service in the cluster shares it. */
1481
+ private isSharedStream;
1458
1482
  /** Build the full stream config by merging defaults with user overrides. */
1459
1483
  private buildConfig;
1460
1484
  /**
@@ -1508,12 +1532,21 @@ declare class EventRouter {
1508
1532
  private getConcurrency;
1509
1533
  private getAckExtensionConfig;
1510
1534
  /**
1511
- * Last-resort path for a dead letter: invoke `onDeadLetter`, then `term` on
1512
- * success or `nak` on hook failure so NATS retries on the next delivery
1513
- * cycle. Used when DLQ stream isn't configured, or when publishing to it
1514
- * failed and we still have to surface the message somewhere observable.
1535
+ * Last resort: invoke onDeadLetter, then term on success. On failure the
1536
+ * message is nak'd never redelivered past max_deliver, but preserved.
1515
1537
  */
1516
1538
  private fallbackToOnDeadLetterCallback;
1539
+ /**
1540
+ * Copy headers for the DLQ republish, dropping NATS control headers — a
1541
+ * copied Nats-TTL would expire the DLQ entry, Nats-Msg-Id trips dedup.
1542
+ */
1543
+ private buildDlqHeaders;
1544
+ /**
1545
+ * Past max_deliver the server never redelivers, so these in-process attempts
1546
+ * are the only second chance a dead letter gets. No artificial delay — an
1547
+ * unreachable broker already spaces attempts via its own request timeout.
1548
+ */
1549
+ private publishToDlqWithRetry;
1517
1550
  /**
1518
1551
  * Publish a dead letter to the configured Dead-Letter Queue (DLQ) stream.
1519
1552
  *
@@ -1624,6 +1657,7 @@ declare class ConsumerProvider {
1624
1657
  * Create a consumer, handling the race where another pod creates it first.
1625
1658
  */
1626
1659
  private createConsumer;
1660
+ private runConsumerOp;
1627
1661
  /** Build consumer config by merging defaults with user overrides. */
1628
1662
  private buildConfig;
1629
1663
  /** Get default config for a consumer kind. */
@@ -1765,7 +1799,7 @@ declare class MetadataProvider {
1765
1799
  * NATS JetStream API error codes used by the transport.
1766
1800
  *
1767
1801
  * Ref: https://github.com/nats-io/nats-server (server error definitions)
1768
- * Verified on NATS 2.12.6 via integration tests (2026-04-02).
1802
+ * Codes verified across NATS 2.12.6–2.14.1 via integration tests (original codes: 2026-04-02).
1769
1803
  */
1770
1804
  declare enum NatsErrorCode {
1771
1805
  /** Consumer does not exist on the specified stream. */
@@ -1773,7 +1807,14 @@ declare enum NatsErrorCode {
1773
1807
  /** Consumer name already in use with different configuration (race condition on create). */
1774
1808
  ConsumerAlreadyExists = 10148,
1775
1809
  /** Stream does not exist. */
1776
- StreamNotFound = 10059
1810
+ StreamNotFound = 10059,
1811
+ /** Storage resources exceeded — reservation exceeds server `max_file_store`. */
1812
+ StorageResourcesExceeded = 10047,
1813
+ /**
1814
+ * No suitable peers for placement (fewer healthy peers than `num_replicas`,
1815
+ * or no peer has storage headroom). Confirmed at runtime by the cluster integration test.
1816
+ */
1817
+ NoSuitablePeers = 10005
1777
1818
  }
1778
1819
 
1779
1820
  /**
@@ -1808,7 +1849,7 @@ declare class JetstreamStrategy extends Server implements CustomTransportStrateg
1808
1849
  *
1809
1850
  * Called by NestJS when `connectMicroservice()` is used, or internally by the module.
1810
1851
  */
1811
- listen(callback: () => void): Promise<void>;
1852
+ listen(callback: (...args: unknown[]) => void): Promise<void>;
1812
1853
  /** Stop all consumers, routers, subscriptions, and metadata heartbeat. Called during shutdown. */
1813
1854
  close(): void;
1814
1855
  /**
@@ -1838,9 +1879,13 @@ declare class JetstreamStrategy extends Server implements CustomTransportStrateg
1838
1879
  unwrap<T>(): T;
1839
1880
  /** Access the pattern registry (for module-level introspection). */
1840
1881
  getPatternRegistry(): PatternRegistry;
1882
+ private doListen;
1841
1883
  /** Determine which streams and durable consumers are needed. */
1842
1884
  private resolveRequiredKinds;
1843
- /** Populate the shared ack_wait map from actual NATS consumer configs. */
1885
+ /** Subscribe the event and RPC routers to the message subjects. */
1886
+ private startRouters;
1887
+ /** Begin durable and ordered consumption; routers must already be subscribed. */
1888
+ private startConsumption;
1844
1889
  private populateAckWaitMap;
1845
1890
  /** Build max_deliver map from actual NATS consumer configs (not options). */
1846
1891
  private buildMaxDeliverMap;
@@ -2347,4 +2392,30 @@ declare const isJetStreamRpcMode: (rpc: RpcConfig | undefined) => boolean;
2347
2392
  /** Check if the RPC config specifies Core mode (default). */
2348
2393
  declare const isCoreRpcMode: (rpc: RpcConfig | undefined) => boolean;
2349
2394
 
2350
- export { type CaptureBodyOptions, type Codec, ConsumeKind, type ConsumeSourceMsg, DEFAULT_BROADCAST_CONSUMER_CONFIG, DEFAULT_BROADCAST_STREAM_CONFIG, DEFAULT_COMMAND_CONSUMER_CONFIG, DEFAULT_COMMAND_STREAM_CONFIG, DEFAULT_DLQ_STREAM_CONFIG, DEFAULT_EVENT_CONSUMER_CONFIG, DEFAULT_EVENT_STREAM_CONFIG, DEFAULT_JETSTREAM_RPC_TIMEOUT, DEFAULT_METADATA_BUCKET, DEFAULT_METADATA_HISTORY, DEFAULT_METADATA_REPLICAS, DEFAULT_METADATA_TTL, DEFAULT_ORDERED_STREAM_CONFIG, DEFAULT_RPC_TIMEOUT, DEFAULT_SHUTDOWN_TIMEOUT, DEFAULT_TRACES, type DeadLetterInfo, type ErrorClassification, type HandlerMetadata, JETSTREAM_CODEC, JETSTREAM_CONNECTION, JETSTREAM_OPTIONS, JetstreamClient, type JetstreamConsumeContext, JetstreamDlqHeader, type JetstreamFeatureOptions, JetstreamHeader, JetstreamHealthIndicator, type JetstreamHealthStatus, JetstreamModule, type JetstreamModuleAsyncOptions, type JetstreamModuleOptions, type JetstreamPublishContext, JetstreamRecord, JetstreamRecordBuilder, type JetstreamResponseContext, JetstreamStrategy, JetstreamTrace, JsonCodec, MIN_METADATA_TTL, MessageKind, type MetadataRegistryOptions, MsgpackCodec, NatsErrorCode, type OrderedEventOverrides, type OtelOptions, PatternPrefix, PublishKind, RESERVED_HEADERS, type RpcConfig, RpcContext, type ScheduleRecordOptions, type ServerEndpoint, type StreamConfigOverrides, type StreamConsumerOverrides, StreamKind, TRACER_NAME, TransportEvent, type TransportHooks, buildBroadcastSubject, buildSubject, consumerName, dlqStreamName, getClientToken, internalName, isCoreRpcMode, isJetStreamRpcMode, metadataKey, streamName, toNanos };
2395
+ interface ProvisioningErrorFields {
2396
+ readonly entity: ProvisioningEntity;
2397
+ readonly target: string;
2398
+ readonly kind: string;
2399
+ readonly errCode: number;
2400
+ readonly errDescription: string;
2401
+ readonly remediation: string;
2402
+ readonly maxBytes?: number;
2403
+ readonly numReplicas?: number;
2404
+ readonly reservation?: number;
2405
+ readonly cause: unknown;
2406
+ }
2407
+ /** Non-recoverable stream/consumer provisioning failure; preserves the NATS error as `cause`. */
2408
+ declare class JetstreamProvisioningError extends Error {
2409
+ readonly entity: ProvisioningEntity;
2410
+ readonly target: string;
2411
+ readonly kind: string;
2412
+ readonly errCode: number;
2413
+ readonly errDescription: string;
2414
+ readonly remediation: string;
2415
+ readonly maxBytes?: number;
2416
+ readonly numReplicas?: number;
2417
+ readonly reservation?: number;
2418
+ constructor(fields: ProvisioningErrorFields);
2419
+ }
2420
+
2421
+ export { type CaptureBodyOptions, type Codec, ConsumeKind, type ConsumeSourceMsg, DEFAULT_BROADCAST_CONSUMER_CONFIG, DEFAULT_BROADCAST_STREAM_CONFIG, DEFAULT_COMMAND_CONSUMER_CONFIG, DEFAULT_COMMAND_STREAM_CONFIG, DEFAULT_DLQ_STREAM_CONFIG, DEFAULT_EVENT_CONSUMER_CONFIG, DEFAULT_EVENT_STREAM_CONFIG, DEFAULT_JETSTREAM_RPC_TIMEOUT, DEFAULT_METADATA_BUCKET, DEFAULT_METADATA_HISTORY, DEFAULT_METADATA_REPLICAS, DEFAULT_METADATA_TTL, DEFAULT_ORDERED_STREAM_CONFIG, DEFAULT_RPC_TIMEOUT, DEFAULT_SHUTDOWN_TIMEOUT, DEFAULT_TRACES, type DeadLetterInfo, type ErrorClassification, type HandlerMetadata, JETSTREAM_CODEC, JETSTREAM_CONNECTION, JETSTREAM_OPTIONS, JetstreamClient, type JetstreamConsumeContext, JetstreamDlqHeader, type JetstreamFeatureOptions, JetstreamHeader, JetstreamHealthIndicator, type JetstreamHealthStatus, JetstreamModule, type JetstreamModuleAsyncOptions, type JetstreamModuleOptions, JetstreamProvisioningError, type JetstreamPublishContext, JetstreamRecord, JetstreamRecordBuilder, type JetstreamResponseContext, JetstreamStrategy, JetstreamTrace, JsonCodec, MIN_METADATA_TTL, MessageKind, type MetadataRegistryOptions, MsgpackCodec, NatsErrorCode, type OrderedEventOverrides, type OtelOptions, PatternPrefix, type ProvisioningOptions, PublishKind, RESERVED_HEADERS, type RpcConfig, RpcContext, type ScheduleRecordOptions, type ServerEndpoint, type StreamConfigOverrides, type StreamConsumerOverrides, StreamKind, TRACER_NAME, TransportEvent, type TransportHooks, buildBroadcastSubject, buildSubject, consumerName, dlqStreamName, getClientToken, internalName, isCoreRpcMode, isJetStreamRpcMode, metadataKey, streamName, toNanos };