@lad-tech/nsc-toolkit 1.28.0 → 1.28.2

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.
Files changed (48) hide show
  1. package/.vscode/launch.json +77 -0
  2. package/.vscode/tasks.json +25 -0
  3. package/package.json +1 -1
  4. package/CHANGELOG.md +0 -6
  5. package/dist/Client.js +0 -292
  6. package/dist/Container.js +0 -124
  7. package/dist/Meter.js +0 -58
  8. package/dist/Method.js +0 -7
  9. package/dist/Root.js +0 -120
  10. package/dist/Service.js +0 -677
  11. package/dist/StreamBatchMsgFetcher.js +0 -17
  12. package/dist/StreamManager.js +0 -173
  13. package/dist/StreamOptions/BufferToJsonTransform.js +0 -34
  14. package/dist/StreamOptions/JsonToBufferTransform.js +0 -11
  15. package/dist/StreamOptions/index.js +0 -19
  16. package/dist/StreamSingleMsgFetcher.js +0 -28
  17. package/dist/Union/Broker.js +0 -95
  18. package/dist/Union/ConsumerApi.js +0 -28
  19. package/dist/Union/JetStreamClient.js +0 -40
  20. package/dist/Union/JetStreamManager.js +0 -26
  21. package/dist/Union/StreamApi.js +0 -46
  22. package/dist/Union/Subscription.js +0 -47
  23. package/dist/Union/index.js +0 -18
  24. package/dist/index.js +0 -24
  25. package/dist/injector.js +0 -65
  26. package/dist/interfaces.js +0 -16
  27. package/dist/types/Client.d.ts +0 -32
  28. package/dist/types/Container.d.ts +0 -54
  29. package/dist/types/Meter.d.ts +0 -11
  30. package/dist/types/Method.d.ts +0 -6
  31. package/dist/types/Root.d.ts +0 -29
  32. package/dist/types/Service.d.ts +0 -140
  33. package/dist/types/StreamBatchMsgFetcher.d.ts +0 -13
  34. package/dist/types/StreamManager.d.ts +0 -26
  35. package/dist/types/StreamOptions/BufferToJsonTransform.d.ts +0 -14
  36. package/dist/types/StreamOptions/JsonToBufferTransform.d.ts +0 -6
  37. package/dist/types/StreamOptions/index.d.ts +0 -2
  38. package/dist/types/StreamSingleMsgFetcher.d.ts +0 -16
  39. package/dist/types/Union/Broker.d.ts +0 -32
  40. package/dist/types/Union/ConsumerApi.d.ts +0 -16
  41. package/dist/types/Union/JetStreamClient.d.ts +0 -18
  42. package/dist/types/Union/JetStreamManager.d.ts +0 -12
  43. package/dist/types/Union/StreamApi.d.ts +0 -16
  44. package/dist/types/Union/Subscription.d.ts +0 -19
  45. package/dist/types/Union/index.d.ts +0 -1
  46. package/dist/types/index.d.ts +0 -7
  47. package/dist/types/injector.d.ts +0 -14
  48. package/dist/types/interfaces.d.ts +0 -181
@@ -1,16 +0,0 @@
1
- "use strict";
2
- // COMMON
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.TagKey = exports.DependencyType = void 0;
5
- exports.DependencyType = {
6
- SERVICE: 'service',
7
- ADAPTER: 'adapter',
8
- CONSTANT: 'constant', // Just an object
9
- };
10
- exports.TagKey = {
11
- LOCATION: 'location',
12
- TYPE: 'type',
13
- NAME: 'name',
14
- TARGET: 'target',
15
- };
16
- //# sourceMappingURL=interfaces.js.map
@@ -1,32 +0,0 @@
1
- /// <reference types="node" />
2
- import { Readable } from 'node:stream';
3
- import { ClientParam, Emitter, GetBatchListenerOptions, GetListenerOptions, Listener, ListenerBatch, MethodSettings } from './interfaces';
4
- import { Root } from './Root';
5
- type RequestData = Record<string, unknown> | Readable;
6
- export declare class Client<E extends Emitter = Emitter> extends Root {
7
- private serviceName;
8
- private baggage?;
9
- private cache?;
10
- private events?;
11
- private Ref?;
12
- private subscriptions;
13
- private REQUEST_HTTP_SETTINGS_TIMEOUT;
14
- constructor({ broker, events, loggerOutputFormatter, serviceName, baggage, cache, Ref }: ClientParam<E>);
15
- private startWatch;
16
- private startBatchWatch;
17
- /**
18
- * Make listener for service events. Auto subscribe and unsubscribe to subject
19
- */
20
- getListener<A extends keyof E>(serviceNameFrom: string, options?: GetListenerOptions): Listener<E>;
21
- getListener<A extends keyof E>(serviceNameFrom: string, options?: GetBatchListenerOptions): ListenerBatch<E>;
22
- private createCacheKey;
23
- private validate;
24
- protected request<R = any, P extends RequestData = RequestData>(subject: string, data: P, { options, request, response }: MethodSettings): Promise<R>;
25
- private getHTTPSettingsFromRemoteService;
26
- private isStream;
27
- private makeBrokerRequest;
28
- private makeHttpRequest;
29
- private isJsMessage;
30
- private getBaggageFromNATSHeader;
31
- }
32
- export {};
@@ -1,54 +0,0 @@
1
- import { ClientService, DependencyType, InitializableService, Tag } from '.';
2
- type Constant = Record<string, any>;
3
- type Service<R extends Constant = Constant> = ClientService<R>;
4
- export type Adapter<R extends Constant = Constant> = new (...args: any[]) => R;
5
- export type Singlton = {
6
- singlton: true;
7
- tag?: Tag;
8
- };
9
- export type NeedInit = {
10
- init: true;
11
- tag?: Tag;
12
- };
13
- export type AdapterOptions = Singlton | NeedInit;
14
- type Dependency = Service | Adapter | Constant;
15
- type ContainerValue = {
16
- type: DependencyType;
17
- value: Dependency;
18
- options?: AdapterOptions;
19
- };
20
- declare class Container {
21
- private readonly container;
22
- private readonly singltons;
23
- private buildDependency;
24
- private inject;
25
- private isServiceDependency;
26
- private isAdapterDependency;
27
- private isConstantDependency;
28
- bind<R extends Record<string, any>>(key: symbol, type: typeof DependencyType.SERVICE, value: ClientService<R>): void;
29
- bind<R extends Record<string, any>>(key: symbol, type: typeof DependencyType.ADAPTER, value: Adapter<R>, options?: Singlton): void;
30
- bind<R extends Record<string, any>>(key: symbol, type: typeof DependencyType.ADAPTER, value: Adapter<R & InitializableService>, options?: NeedInit): void;
31
- bind<R extends Record<string, any>>(key: symbol, type: typeof DependencyType.CONSTANT, value: R): void;
32
- symbol(key: symbol): {
33
- to: {
34
- Adapter: <R extends Record<string, any>>(value: Adapter<R> | Adapter<R & import("./interfaces").GracefulShutdownAdditionalService & {
35
- init: () => Promise<any>;
36
- }>, options?: AdapterOptions) => void;
37
- Singlton: <R_1 extends Record<string, any>>(value: Adapter<R_1>) => void;
38
- Constant: <R_2 extends Record<string, any>>(value: R_2) => void;
39
- Initializable: <R_3 extends Record<string, any>>(value: Adapter<R_3 & import("./interfaces").GracefulShutdownAdditionalService & {
40
- init: () => Promise<any>;
41
- }>) => void;
42
- Service: <R_4 extends Record<string, any>>(value: ClientService<R_4>) => void;
43
- };
44
- };
45
- unbind(key: symbol): Promise<void>;
46
- get(key: symbol): {
47
- dependency: ContainerValue;
48
- constructor: unknown[];
49
- };
50
- getInstance<R = Constant>(key: symbol): R;
51
- initDependencies(): Promise<InitializableService[]>;
52
- }
53
- export declare const container: Container;
54
- export {};
@@ -1,11 +0,0 @@
1
- import { Baggage, EventMeter, Tag } from './interfaces';
2
- import { Root } from './Root';
3
- export declare class Meter extends Root implements EventMeter {
4
- private name;
5
- private baggage?;
6
- private span?;
7
- constructor(name: string, baggage?: Baggage | undefined);
8
- start(): void;
9
- end(error?: Error): void;
10
- measure<T extends (...args: any[]) => any>(func: T, arg: Parameters<T>, context: unknown, tag?: Tag): ReturnType<T>;
11
- }
@@ -1,6 +0,0 @@
1
- import { Logs } from '@lad-tech/toolbelt';
2
- import { Emitter } from './interfaces';
3
- export declare class BaseMethod<E extends Emitter = Record<string, () => void>> {
4
- protected logger: Logs.Logger;
5
- protected emitter: E;
6
- }
@@ -1,29 +0,0 @@
1
- import { Logs } from '@lad-tech/toolbelt';
2
- import * as opentelemetry from '@opentelemetry/api';
3
- import type { NatsConnection } from 'nats';
4
- import { type Baggage, type ExternalBaggage, type Tag } from './interfaces';
5
- import { Broker } from './Union';
6
- export declare class Root {
7
- protected readonly SERVICE_SUBJECT_FOR_GET_HTTP_SETTINGS = "get_http_settings";
8
- protected readonly CACHE_SERVICE_KEY = "CACHE";
9
- protected readonly SUBJECT_DELIMITER = ".";
10
- protected logger: Logs.Logger;
11
- broker: Broker;
12
- constructor(broker?: NatsConnection, outputFormatter?: Logs.OutputFormatter);
13
- protected castToNumber(value?: string): number;
14
- protected getSettingFromEnv(name: string, required?: boolean): string | undefined;
15
- /**
16
- * Make opentelemetry context from baggagge
17
- */
18
- protected getContext(baggage?: Baggage): opentelemetry.Context | undefined;
19
- protected getExpired(expired?: number, ownTimeout?: number): number;
20
- protected buildErrorMessage(error: string | Error | Record<any, any>, code?: number): {
21
- payload: null;
22
- error: {
23
- message: string;
24
- code: number | undefined;
25
- };
26
- };
27
- protected convertBaggaggeToExternalHeader(baggage?: Partial<Baggage>): ExternalBaggage;
28
- protected applyTag(span: opentelemetry.Span, tag?: Tag): void;
29
- }
@@ -1,140 +0,0 @@
1
- import { Root } from './Root';
2
- import { Emitter, ServiceOptions, Baggage, ExternalBaggage, ClientService } from '.';
3
- export declare class Service<E extends Emitter = Emitter> extends Root {
4
- private options;
5
- emitter: E;
6
- private serviceName;
7
- private httpServer?;
8
- private httpProbServer?;
9
- protected httpPort?: number;
10
- protected ipAddress?: string;
11
- private subscriptions;
12
- private httpMethods;
13
- private rootSpans;
14
- /**
15
- * Unique identifier NATS header for a message that will be used by the server apply
16
- * de-duplication within the configured Duplicate Window
17
- */
18
- private readonly UNIQ_ID_HEADER;
19
- /**
20
- * Nats-Rollup header indicating all prior messages should be purged
21
- */
22
- private readonly ROLLUP_HEADER;
23
- /**
24
- * Roll-up only same subject message in the stream
25
- */
26
- private readonly ROLLUP_STRATEGY;
27
- private readonly BASE_EVENT_SUFFIX;
28
- constructor(options: ServiceOptions<E>);
29
- /**
30
- * Create global Tracer
31
- */
32
- private createTracer;
33
- private finishSpan;
34
- /**
35
- * Wrapper for async methods. Create span
36
- */
37
- private perform;
38
- /**
39
- * Build trap for object with async methods
40
- */
41
- private getTrap;
42
- /**
43
- * Creating an object to inject into Method (business logic)
44
- */
45
- private createObjectWithDependencies;
46
- /**
47
- * Create Method (business logic) context
48
- */
49
- private createMethodContext;
50
- /**
51
- * Create Baggage from span. Expired one-on-one business logic call
52
- */
53
- private getNextBaggage;
54
- /**
55
- * Guard for determine whether baggage contains trace information
56
- */
57
- private isBaggageContainTrace;
58
- /**
59
- * If there is no baggage. For example, in HTTP Gateway
60
- */
61
- getRootBaggage(subject: string, headers?: ExternalBaggage, ownTimeout?: number): {
62
- expired: number;
63
- traceId: string;
64
- spanId: string;
65
- traceFlags: number;
66
- requestId: string | undefined;
67
- };
68
- /**
69
- * End root baggage
70
- */
71
- endRootSpan(traceId: string, error?: Error): void;
72
- buildService<C extends ClientService>(Client: C, baggage?: Baggage): InstanceType<C>;
73
- /**
74
- * Create service Method for send HTTP settings
75
- */
76
- private runServiceMethodForHttp;
77
- private makeHttpSingleResponse;
78
- /**
79
- * Create transform stream for convert object to string in stream pipeline
80
- */
81
- private getStringifyTransform;
82
- private makeHttpStreamResponse;
83
- /**
84
- * Up HTTP server and start listen http routes
85
- */
86
- private buildHTTPHandlers;
87
- /**
88
- * Run business logic for request
89
- */
90
- private handled;
91
- /**
92
- * Wrap emitter for luggage baggagge
93
- */
94
- private getWrappedEmitter;
95
- /**
96
- * Make error object if error instance of Error object for logger
97
- */
98
- private createErrorMessageForLogger;
99
- /**
100
- * Start service. Subscribe for subject and up http server
101
- */
102
- start(): Promise<void>;
103
- /**
104
- * Correct finish all connections
105
- */
106
- private cleanupAndExit;
107
- stop(): Promise<void>;
108
- /**
109
- * Handler for OS Signal
110
- */
111
- private handleSignal;
112
- /**
113
- * Handler for Force OS Signal
114
- */
115
- private handleFatalError;
116
- /**
117
- * Register listeners for Graceful Shutdown
118
- */
119
- private registerGracefulShutdown;
120
- /**
121
- * Up Probe Route for container orchestration service
122
- */
123
- private upProbeRoutes;
124
- /**
125
- * Type guard for NATS debug event
126
- */
127
- private isNATSDebugEvent;
128
- /**
129
- * Logs events from the broker
130
- */
131
- private watchBrokerEvents;
132
- /**
133
- * Build message for broker
134
- */
135
- private buildMessage;
136
- private upHTTPServer;
137
- private getMyIpV4;
138
- private getHttpSettings;
139
- private getBaggageFromExternalHeader;
140
- }
@@ -1,13 +0,0 @@
1
- import { Consumer, ConsumerMessages } from 'nats';
2
- interface BatcherOptions {
3
- batchSize?: number;
4
- batchTimeout?: number;
5
- noWait?: boolean;
6
- }
7
- export declare class StreamBatchMsgFetcher {
8
- private consumer;
9
- private options;
10
- constructor(consumer: Consumer, options: BatcherOptions);
11
- fetch(size?: number, expires?: number): Promise<ConsumerMessages>;
12
- }
13
- export {};
@@ -1,26 +0,0 @@
1
- import { StreamManagerParam, GetListenerOptions, GetBatchListenerOptions } from '.';
2
- import { Subscription } from 'nats';
3
- import { Root } from './Root';
4
- import { StreamBatchMsgFetcher } from './StreamBatchMsgFetcher';
5
- import { StreamSingleMsgFetcher } from './StreamSingleMsgFetcher';
6
- export declare class StreamManager extends Root {
7
- private param;
8
- private readonly STAR_WILDCARD;
9
- private readonly GREATER_WILDCARD;
10
- private readonly TWO_WEEKS_IN_SECOND;
11
- private readonly ONE_DAY_IN_SECOND;
12
- private readonly CONSUMER_NOT_FOUND;
13
- private readonly defaultStreamOption;
14
- private jsm?;
15
- constructor(param: StreamManagerParam);
16
- static isPullConsumerOptions(setting?: GetListenerOptions | GetBatchListenerOptions): setting is GetBatchListenerOptions;
17
- static isStreamFetcher(consumer?: StreamSingleMsgFetcher | StreamBatchMsgFetcher | Subscription): consumer is StreamBatchMsgFetcher;
18
- createStreams(): Promise<void>;
19
- createConsumer(serviceNameFrom: string, eventName: string, setting?: GetListenerOptions): Promise<StreamSingleMsgFetcher>;
20
- createConsumer(serviceNameFrom: string, eventName: string, setting?: GetBatchListenerOptions): Promise<StreamBatchMsgFetcher>;
21
- private getStreamName;
22
- private isNotFoundStreamError;
23
- private buildPrefixForStreamName;
24
- private capitalizeFirstLetter;
25
- private convertSecondsToNanoseconds;
26
- }
@@ -1,14 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- import { Logs } from '@lad-tech/toolbelt';
5
- import { Transform, TransformCallback, TransformOptions } from 'stream';
6
- export declare class BufferToJsonTransform<T = any> extends Transform {
7
- private head;
8
- private static errors;
9
- private logger?;
10
- constructor(options: TransformOptions & {
11
- logger?: Logs.Logger;
12
- });
13
- _transform(tail: Buffer, _: BufferEncoding, cb: TransformCallback): Promise<void>;
14
- }
@@ -1,6 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { Transform, TransformCallback } from 'stream';
4
- export declare class JsonToBufferTransform<T> extends Transform {
5
- _transform(chunk: T, encoding: BufferEncoding, cb: TransformCallback): void;
6
- }
@@ -1,2 +0,0 @@
1
- export * from './JsonToBufferTransform';
2
- export * from './BufferToJsonTransform';
@@ -1,16 +0,0 @@
1
- import { Consumer } from 'nats';
2
- export declare class StreamSingleMsgFetcher {
3
- private consumer;
4
- private done;
5
- constructor(consumer: Consumer);
6
- [Symbol.asyncIterator](): {
7
- next: () => Promise<{
8
- value: import("nats").JsMsg;
9
- done: boolean;
10
- } | {
11
- done: boolean;
12
- value?: undefined;
13
- }>;
14
- };
15
- unsubscribe(): void;
16
- }
@@ -1,32 +0,0 @@
1
- import { JetStreamClient, JetStreamManager, JetStreamOptions, Msg, NatsConnection, Payload, PublishOptions, RequestManyOptions, RequestOptions, ServerInfo, ServicesAPI, Stats, Status, Subscription, SubscriptionOptions } from 'nats';
2
- interface Union {
3
- isUnion?: boolean;
4
- }
5
- export type Broker = NatsConnection & Union;
6
- export declare class UnionBroker implements Broker {
7
- publishMessage(msg: Msg): void;
8
- respondMessage(msg: Msg): boolean;
9
- requestMany(subject: string, payload?: Payload | undefined, opts?: Partial<RequestManyOptions> | undefined): Promise<AsyncIterable<Msg>>;
10
- services: ServicesAPI;
11
- reconnect(): Promise<void>;
12
- info?: ServerInfo;
13
- isUnion: boolean;
14
- private DEFAULT_TIMEOUT;
15
- private emitter;
16
- closed(): Promise<void | Error>;
17
- close(): Promise<void>;
18
- publish(subject: string, data?: Uint8Array, options?: PublishOptions): void;
19
- subscribe(subject: string, opts?: SubscriptionOptions): Subscription;
20
- request(subject: string, data?: Uint8Array, opts?: RequestOptions): Promise<Msg>;
21
- flush(): Promise<void>;
22
- drain(): Promise<void>;
23
- isClosed(): boolean;
24
- isDraining(): boolean;
25
- getServer(): string;
26
- status(): AsyncIterable<Status>;
27
- stats(): Stats;
28
- jetstreamManager(opts?: JetStreamOptions): Promise<JetStreamManager>;
29
- jetstream(opts?: JetStreamOptions): JetStreamClient;
30
- rtt(): Promise<number>;
31
- }
32
- export {};
@@ -1,16 +0,0 @@
1
- import { ConsumerAPI, ConsumerConfig, ConsumerInfo, ConsumerUpdateConfig, Lister } from 'nats';
2
- export declare class ConsumerApiBlank implements ConsumerAPI {
3
- info(stream: string, consumer: string): Promise<ConsumerInfo>;
4
- add(stream: string, cfg: Partial<ConsumerConfig>): Promise<ConsumerInfo>;
5
- update(stream: string, durable: string, cfg: Partial<ConsumerUpdateConfig>): Promise<ConsumerInfo>;
6
- delete(stream: string, consumer: string): Promise<boolean>;
7
- list(stream: string): Lister<ConsumerInfo>;
8
- pause(stream: string, name: string, until?: Date | undefined): Promise<{
9
- paused: boolean;
10
- pause_until?: string | undefined;
11
- }>;
12
- resume(stream: string, name: string): Promise<{
13
- paused: boolean;
14
- pause_until?: string | undefined;
15
- }>;
16
- }
@@ -1,18 +0,0 @@
1
- /// <reference types="node" />
2
- import { ConsumerOpts, ConsumerOptsBuilder, Consumers, JetStreamClient, JetStreamManager, JetStreamOptions, JetStreamPublishOptions, JetStreamPullSubscription, JetStreamSubscription, JsMsg, PubAck, PullOptions, QueuedIterator, Streams, Views } from 'nats';
3
- import { EventEmitter } from 'stream';
4
- export declare class JetStreamClientBlank implements JetStreamClient {
5
- private emitter;
6
- views: Views;
7
- constructor(emitter: EventEmitter);
8
- apiPrefix: string;
9
- consumers: Consumers;
10
- streams: Streams;
11
- jetstreamManager(checkAPI?: boolean | undefined): Promise<JetStreamManager>;
12
- getOptions(): JetStreamOptions;
13
- publish(subj: string, data?: Uint8Array, options?: Partial<JetStreamPublishOptions>): Promise<PubAck>;
14
- pull(stream: string, durable: string, expires?: number): Promise<JsMsg>;
15
- fetch(stream: string, durable: string, opts?: Partial<PullOptions>): QueuedIterator<JsMsg>;
16
- pullSubscribe(subject: string, opts: ConsumerOptsBuilder | Partial<ConsumerOpts>): Promise<JetStreamPullSubscription>;
17
- subscribe(subject: string, opts: ConsumerOptsBuilder | Partial<ConsumerOpts>): Promise<JetStreamSubscription>;
18
- }
@@ -1,12 +0,0 @@
1
- import { Advisory, JetStreamAccountStats, JetStreamClient, JetStreamManager, JetStreamOptions } from 'nats';
2
- import { StreamApiBlank } from './StreamApi';
3
- import { ConsumerApiBlank } from './ConsumerApi';
4
- export declare class JetStreamManagerBlank implements JetStreamManager {
5
- getOptions(): JetStreamOptions;
6
- jetstream(): JetStreamClient;
7
- consumers: ConsumerApiBlank;
8
- streams: StreamApiBlank;
9
- getAccountInfo(): Promise<JetStreamAccountStats>;
10
- advisories(): AsyncIterable<Advisory>;
11
- }
12
- export declare const jetStreamManagerBlank: JetStreamManagerBlank;
@@ -1,16 +0,0 @@
1
- import { StreamAPI, StreamInfoRequestOptions, StreamInfo, StreamConfig, StreamUpdateConfig, PurgeOpts, PurgeResponse, Lister, MsgRequest, StoredMsg, KvStatus, ObjectStoreStatus, Stream } from 'nats';
2
- export declare class StreamApiBlank implements StreamAPI {
3
- listKvs(): Lister<KvStatus>;
4
- listObjectStores(): Lister<ObjectStoreStatus>;
5
- names(subject?: string | undefined): Lister<string>;
6
- get(name: string): Promise<Stream>;
7
- info(stream: string, opts?: Partial<StreamInfoRequestOptions>): Promise<StreamInfo>;
8
- add(cfg: Partial<StreamConfig>): Promise<StreamInfo>;
9
- update(name: string, cfg: Partial<StreamUpdateConfig>): Promise<StreamInfo>;
10
- purge(stream: string, opts?: PurgeOpts): Promise<PurgeResponse>;
11
- delete(stream: string): Promise<boolean>;
12
- list(): Lister<StreamInfo>;
13
- deleteMessage(stream: string, seq: number, erase?: boolean): Promise<boolean>;
14
- getMessage(stream: string, query: MsgRequest): Promise<StoredMsg>;
15
- find(subject: string): Promise<string>;
16
- }
@@ -1,19 +0,0 @@
1
- /// <reference types="node" />
2
- import { Closed, ConsumerInfoable, Destroyable, Msg, NatsError, Subscription } from 'nats';
3
- import { PassThrough } from 'node:stream';
4
- export declare class UnionSubscription extends PassThrough implements Subscription, Destroyable, Closed, ConsumerInfoable {
5
- closed: any;
6
- unsubscribe(max?: number): void;
7
- drain(): Promise<void>;
8
- isDraining(): boolean;
9
- isClosed(): boolean;
10
- callback(err: NatsError | null, msg: Msg): void;
11
- getSubject(): string;
12
- getReceived(): number;
13
- getProcessed(): number;
14
- getPending(): number;
15
- getID(): number;
16
- getMax(): number | undefined;
17
- destroy(error?: Error | undefined): any;
18
- consumerInfo(): Promise<any>;
19
- }
@@ -1 +0,0 @@
1
- export * from './Broker';
@@ -1,7 +0,0 @@
1
- export * from './Service';
2
- export * from './Client';
3
- export * from './Method';
4
- export * from './injector';
5
- export * from './Container';
6
- export * from './interfaces';
7
- export * from './StreamOptions';
@@ -1,14 +0,0 @@
1
- import 'reflect-metadata';
2
- import { Method, ClientService } from './interfaces';
3
- export type Instance = Record<string, (props: any) => Promise<unknown>>;
4
- export type Dependency = ClientService<unknown>;
5
- export type DependenceStorage = Map<string, Dependency>;
6
- export type InstanceStorage = Map<string, Instance>;
7
- export declare const dependencyStorageMetaKey: unique symbol;
8
- export declare const ServiceContainer: Map<string, DependenceStorage>;
9
- export declare const InstanceContainer: Map<string, InstanceStorage>;
10
- export declare const ConstructorDependencyKey = "constructor";
11
- export declare function related<T extends Method>(target: T): void;
12
- export declare function service(dependence: Dependency): (target: any, dependenceName: string) => void;
13
- export declare function instance(instance: Instance): (target: any, instanceName: string) => void;
14
- export declare function inject(key: symbol): (target: any, property: string | symbol | undefined, index?: number) => void;