@stackone/transport 1.8.1 → 1.8.3

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.mts CHANGED
@@ -1,7 +1,9 @@
1
- import { z } from "zod";
2
- import { AxiosInstance } from "axios";
3
- import https from "https";
1
+ import * as redis from "redis";
2
+ import { AxiosInstance, AxiosInterceptorOptions, AxiosResponse, CreateAxiosDefaults, InternalAxiosRequestConfig } from "axios";
3
+ import { AgentOptions } from "node:http";
4
4
  import { ILogger } from "@stackone/logger";
5
+ import { z } from "zod/v4";
6
+ import https from "https";
5
7
 
6
8
  //#region src/authorization/types.d.ts
7
9
  type BasicAuthorizationParams = {
@@ -21,23 +23,203 @@ declare const createAuthorizationHeaders: (authenticationParams: BasicAuthorizat
21
23
  authorization: string;
22
24
  };
23
25
  //#endregion
26
+ //#region src/cacheClient/types.d.ts
27
+ interface ICacheClient<ClientType = unknown> {
28
+ getData<T>(key: string): Promise<T | null>;
29
+ listData<T>({
30
+ partialKey,
31
+ limit,
32
+ cursor
33
+ }: {
34
+ partialKey: string;
35
+ limit?: number;
36
+ cursor?: string;
37
+ }): Promise<{
38
+ items: T[] | null;
39
+ cursor?: string;
40
+ }>;
41
+ setData<T>({
42
+ key,
43
+ value,
44
+ cacheTTL,
45
+ groupKey
46
+ }: {
47
+ key: string;
48
+ value: T;
49
+ cacheTTL: number;
50
+ groupKey?: string;
51
+ }): Promise<boolean>;
52
+ executeScript?<T>({
53
+ sha1,
54
+ keys,
55
+ args
56
+ }: {
57
+ sha1: string;
58
+ keys: string[];
59
+ args: string[];
60
+ }): Promise<T | null>;
61
+ loadScript?(script: string): Promise<string | null>;
62
+ increment?(key: string, cacheTTL: number): Promise<number | null>;
63
+ decrement?(key: string, cacheTTL: number): Promise<number | null>;
64
+ subscribe?<T extends boolean = false>(pattern: string, listener: PubSubListener<T>): Promise<boolean>;
65
+ unsubscribe?(pattern: string): Promise<boolean>;
66
+ publish?(channel: string, message: string): Promise<number | null>;
67
+ getClient?(): ClientType | null;
68
+ deleteData?(key: string): Promise<boolean>;
69
+ }
70
+ type PubSubListener<ReturnsBuffer extends boolean = false> = <T extends (ReturnsBuffer extends true ? Buffer : string)>(message: T, channel: T) => unknown;
71
+ //#endregion
72
+ //#region src/redisClient/index.d.ts
73
+ type RedisClientType = redis.RedisClientType;
74
+ interface RedisClientConfig {
75
+ getRedisClient?: typeof redis.createClient;
76
+ host?: string;
77
+ port?: number;
78
+ tls?: boolean;
79
+ reconnect?: boolean;
80
+ database?: number;
81
+ }
82
+ declare const buildRedisClientInstance: (config: RedisClientConfig, logger?: ILogger) => Promise<ICacheClient<RedisClientType> | undefined>;
83
+ declare class RedisClient implements ICacheClient<RedisClientType> {
84
+ #private;
85
+ static build({
86
+ getRedisClient,
87
+ host,
88
+ port,
89
+ tls,
90
+ reconnect,
91
+ database
92
+ }: RedisClientConfig, logger?: ILogger): Promise<ICacheClient<RedisClientType> | null>;
93
+ getData<T>(key: string): Promise<T | null>;
94
+ setData<T>({
95
+ key,
96
+ value,
97
+ cacheTTL,
98
+ groupKey
99
+ }: {
100
+ key: string;
101
+ value: T;
102
+ cacheTTL: number;
103
+ groupKey?: string;
104
+ }): Promise<boolean>;
105
+ executeScript<T>({
106
+ sha1,
107
+ keys,
108
+ args
109
+ }: {
110
+ sha1: string;
111
+ keys: string[];
112
+ args: string[];
113
+ }): Promise<T | null>;
114
+ loadScript(script: string): Promise<string | null>;
115
+ increment(key: string, cacheTTL: number): Promise<number | null>;
116
+ decrement(key: string, cacheTTL: number): Promise<number | null>;
117
+ subscribe<T extends boolean>(pattern: string, listener: PubSubListener<T>): Promise<boolean>;
118
+ unsubscribe(pattern: string): Promise<boolean>;
119
+ publish(channel: string, message: string): Promise<number | null>;
120
+ getClient(): RedisClientType | null;
121
+ listData<T>({
122
+ partialKey,
123
+ limit,
124
+ cursor
125
+ }: {
126
+ partialKey: string;
127
+ limit: number;
128
+ cursor?: string;
129
+ }): Promise<{
130
+ items: T[] | null;
131
+ cursor?: string;
132
+ }>;
133
+ deleteData(key: string): Promise<boolean>;
134
+ }
135
+ //#endregion
136
+ //#region src/scriptManager/types.d.ts
137
+ type Scripts<T extends string> = Record<T, string>;
138
+ type ScriptManagerOptions<T extends string> = {
139
+ redisClientConfig: RedisClientConfig;
140
+ logger?: ILogger;
141
+ scriptMap?: Map<T, string>;
142
+ };
143
+ //#endregion
144
+ //#region src/scriptManager/index.d.ts
145
+ declare class ScriptManager<T extends string> {
146
+ protected cacheClient: ICacheClient<RedisClientType> | null;
147
+ protected scriptMap: Map<string, string>;
148
+ protected logger?: ILogger;
149
+ protected scripts: Scripts<T>;
150
+ protected redisClientConfig: RedisClientConfig;
151
+ constructor(preLoadScripts: Scripts<T>);
152
+ protected initialize({
153
+ redisClientConfig,
154
+ logger,
155
+ scriptMap
156
+ }: ScriptManagerOptions<T>, ...args: unknown[]): Promise<void>;
157
+ protected additionalInitialization(..._args: unknown[]): Promise<void>;
158
+ protected loadScripts<U extends string>(scripts: Scripts<U>, scriptMap?: Map<U, string>): Promise<void>;
159
+ protected executeScript<X extends string, U>(method: X, keys: string[], args: string[]): Promise<U | null>;
160
+ protected isReady(): Promise<boolean>;
161
+ }
162
+ //#endregion
163
+ //#region src/concurrencyManager/types.d.ts
164
+ type ConcurrencySubPoolConfig = {
165
+ subPoolKey: string;
166
+ urlPattern: RegExp | string;
167
+ maxConcurrency: number;
168
+ };
169
+ type ConcurrencyConfig = {
170
+ mainMaxConcurrency: number;
171
+ subPools?: ConcurrencySubPoolConfig[];
172
+ };
173
+ type RequestMetadata = {
174
+ requestId: string;
175
+ targetConcurrencyKey: string;
176
+ leaseSubscription: boolean;
177
+ setRemovalSubscription: boolean;
178
+ queueKey: string;
179
+ joinCondition?: 'optimistic' | 'attempts' | 'failed';
180
+ failureReason?: string;
181
+ };
182
+ //#endregion
183
+ //#region src/concurrencyManager/utils/index.d.ts
184
+ declare enum ConcurrencyMethods {
185
+ tryConcurrency = "tryConcurrency",
186
+ removeFromSet = "removeFromSet",
187
+ publishNextItem = "publishNextItem",
188
+ }
189
+ //#endregion
190
+ //#region src/concurrencyManager/index.d.ts
191
+ declare class ConcurrencyManager extends ScriptManager<ConcurrencyMethods> {
192
+ private static instance;
193
+ private static asyncInstanceInit;
194
+ private static hasValidRedisConfig;
195
+ private static lastInitFailure;
196
+ private static RETRY_WINDOW_MS;
197
+ private static logger?;
198
+ private static initConfig;
199
+ private subscriptionManager;
200
+ private queueManager;
201
+ private generateUUID;
202
+ static getInstance(config?: RedisClientConfig, logger?: ILogger, scriptMap?: Map<ConcurrencyMethods, string>, generateUUID?: () => string): Promise<ConcurrencyManager>;
203
+ protected additionalInitialization(generateUUID?: () => string): Promise<void>;
204
+ private addTestSubscription;
205
+ private checkRedisEventsEmit;
206
+ isRedisConfigured(): Promise<boolean>;
207
+ private subscribeToLeaseExpiry;
208
+ private subscribeToSetRemoval;
209
+ registerRequest(requestKey: string, config: ConcurrencyConfig, requestId: string, requestUrl: string | undefined): Promise<RequestMetadata>;
210
+ releaseRequest(requestId: string, targetConcurrencyKey: string): Promise<boolean>;
211
+ private readyCheck;
212
+ static isReady(): Promise<boolean>;
213
+ static close(): void;
214
+ }
215
+ //#endregion
24
216
  //#region src/customErrors/schemas.d.ts
25
217
  declare const CUSTOM_ERROR_CONFIG_SCHEMA: z.ZodObject<{
26
218
  receivedStatus: z.ZodNumber;
27
219
  targetStatus: z.ZodNumber;
28
220
  message: z.ZodOptional<z.ZodString>;
29
221
  condition: z.ZodOptional<z.ZodString>;
30
- }, "strip", z.ZodTypeAny, {
31
- receivedStatus: number;
32
- targetStatus: number;
33
- message?: string | undefined;
34
- condition?: string | undefined;
35
- }, {
36
- receivedStatus: number;
37
- targetStatus: number;
38
- message?: string | undefined;
39
- condition?: string | undefined;
40
- }>;
222
+ }, z.core.$strip>;
41
223
  //#endregion
42
224
  //#region src/customErrors/types.d.ts
43
225
  type CustomErrorConfig = z.infer<typeof CUSTOM_ERROR_CONFIG_SCHEMA>;
@@ -121,6 +303,38 @@ interface IHttpClient {
121
303
  payload?: P;
122
304
  }): Promise<HttpResponse<T>>;
123
305
  }
306
+ interface OperationSetting {
307
+ url?: string;
308
+ query?: Record<string, string>;
309
+ config?: Partial<APIConfig>;
310
+ custom_settings?: Record<string, unknown>;
311
+ }
312
+ type OperationSettings = Record<string, OperationSetting>;
313
+ type AccountSettings = Record<string, string | number | boolean | object>;
314
+ type HttpClientBehaviour = 'CONCURRENCY' | 'RETRY';
315
+ type APIConfig = Record<string, unknown>;
316
+ type RequestContext = {
317
+ accountSecureId?: string;
318
+ projectSecureId?: string;
319
+ organizationId?: number;
320
+ environment?: string;
321
+ authConfigKey?: string;
322
+ provider?: string;
323
+ service?: string;
324
+ resource?: string;
325
+ subResource?: string;
326
+ childResource?: string;
327
+ operation?: string;
328
+ action?: string;
329
+ mode?: string;
330
+ testerUniqueToken?: string;
331
+ externalKey?: string;
332
+ dataKey?: string;
333
+ isDataSync?: boolean;
334
+ operationSettings?: OperationSettings;
335
+ accountSettings?: AccountSettings;
336
+ behaviours?: HttpClientBehaviour[];
337
+ };
124
338
  //#endregion
125
339
  //#region src/errors/httpResponseError.d.ts
126
340
  declare class HttpResponseError extends Error {
@@ -129,6 +343,70 @@ declare class HttpResponseError extends Error {
129
343
  toString(): string;
130
344
  }
131
345
  //#endregion
346
+ //#region src/lockManager/index.d.ts
347
+ declare class LockManager {
348
+ private locks;
349
+ constructor();
350
+ withLock<T>(key: string, operation: () => Promise<T>): Promise<T>;
351
+ lock(key: string): Promise<void>;
352
+ unlock(key: string): void;
353
+ queueLength(key: string): number | undefined;
354
+ close(): void;
355
+ }
356
+ //#endregion
357
+ //#region src/memoryStore/types.d.ts
358
+ interface MemoryStoreConfig<T> {
359
+ instantiator?: string;
360
+ logger?: ILogger;
361
+ dataStore?: Map<string, T>;
362
+ lockManager?: LockManager;
363
+ expiryMap?: Map<string, number>;
364
+ evictionFrequency?: number;
365
+ staleDataThreshold?: number;
366
+ truncateThreshold?: number;
367
+ truncationPercentage?: number;
368
+ typeGuard?: (data: unknown) => data is T;
369
+ dispose?: (key: string, value: T) => Promise<void> | void;
370
+ }
371
+ type PruneCount = {
372
+ dataStoreSize: number;
373
+ prunedDataStoreSize: number;
374
+ };
375
+ //#endregion
376
+ //#region src/eventClient/types.d.ts
377
+ type PromiseExecutorMethods<T> = {
378
+ resolve?: (value: T) => void;
379
+ reject?: (reason: unknown) => void;
380
+ };
381
+ type EventClientConfig<T> = {
382
+ instantiator?: string;
383
+ defaultTimeoutMS?: number;
384
+ timeoutResolveValue?: T;
385
+ };
386
+ //#endregion
387
+ //#region src/eventClient/index.d.ts
388
+ declare class EventClient<T> {
389
+ private executorMethodStore;
390
+ private promiseStore;
391
+ private logger;
392
+ private eventClientConfig?;
393
+ private executorMethodStoreConfig?;
394
+ private pendingPromiseStoreConfig?;
395
+ constructor(eventClientConfig?: EventClientConfig<T>, executorMethodStoreConfig?: MemoryStoreConfig<PromiseExecutorMethods<T> | undefined>, pendingPromiseStoreConfig?: MemoryStoreConfig<Promise<T> | undefined>);
396
+ setPendingEvent(eventKey: string, timeoutInMS: number): Promise<void>;
397
+ waitForEvent(eventKey: string, timeoutInMS: number): Promise<T | null>;
398
+ getPendingEvent(eventKey: string): Promise<T | null>;
399
+ deleteEvent(eventKey: string): Promise<boolean>;
400
+ resolveEvent(eventKey: string, value: T): Promise<void>;
401
+ private defaultExecutorMethodDispose;
402
+ private defaultExecutorMethodTypeGuard;
403
+ private defaultPendingPromiseDispose;
404
+ private defaultPendingPromiseTypeGuard;
405
+ }
406
+ //#endregion
407
+ //#region src/getTransportInstance/index.d.ts
408
+ declare const getTransportInstance: (logger: ILogger, context?: RequestContext) => Promise<AxiosInstance>;
409
+ //#endregion
132
410
  //#region src/httpClient/httpClient.d.ts
133
411
  declare class HttpClient implements IHttpClient {
134
412
  #private;
@@ -204,6 +482,80 @@ declare class HttpClientManager {
204
482
  static resetInstance(): void;
205
483
  }
206
484
  //#endregion
485
+ //#region src/rateLimitManager/types.d.ts
486
+ type RateLimitSubPoolConfig = {
487
+ subPoolKey: string;
488
+ urlPattern: RegExp | string;
489
+ rateLimit: number;
490
+ };
491
+ type RetryUnit = 'seconds' | 'milliseconds' | 'date';
492
+ type MappedRateLimitErrorConfig = {
493
+ errorStatus: number;
494
+ errorMessage: string | RegExp;
495
+ errorMessagePath?: string;
496
+ retryAfterPath?: string;
497
+ retryAfterUnit?: RetryUnit;
498
+ retryAfterValue?: number;
499
+ };
500
+ type RateLimitConfig = {
501
+ mainRatelimit: number;
502
+ subPools?: RateLimitSubPoolConfig[];
503
+ mappedRateLimitErrors?: MappedRateLimitErrorConfig[];
504
+ };
505
+ //#endregion
506
+ //#region src/interceptors/types.d.ts
507
+ type RequestInterceptor = (value: InternalAxiosRequestConfig<unknown>) => InternalAxiosRequestConfig<unknown> | Promise<InternalAxiosRequestConfig<unknown>>;
508
+ type ResponseInterceptor = (value: AxiosResponse<unknown, unknown>) => AxiosResponse<unknown, unknown> | Promise<AxiosResponse<unknown, unknown>>;
509
+ type ErrorInterceptor = (error: unknown) => unknown;
510
+ type Interceptor = RequestInterceptor | ResponseInterceptor | ErrorInterceptor | null;
511
+ interface InterceptorDependencies {
512
+ axiosInstance?: AxiosInstance;
513
+ logger?: ILogger;
514
+ context?: RequestContext;
515
+ requestConfig?: RequestConfig;
516
+ [key: string]: unknown;
517
+ }
518
+ type RequestConfig = {
519
+ rateLimits?: RateLimitConfig;
520
+ concurrency?: ConcurrencyConfig;
521
+ };
522
+ //#endregion
523
+ //#region src/httpTransportFactory/types.d.ts
524
+ type InterceptorDependencyInjector<T extends Interceptor> = (dependencies: InterceptorDependencies) => T;
525
+ type RequestInterceptorConfig = {
526
+ onFulfilled: InterceptorDependencyInjector<RequestInterceptor> | RequestInterceptor | null;
527
+ onRejected: InterceptorDependencyInjector<ErrorInterceptor> | ErrorInterceptor | null;
528
+ options: AxiosInterceptorOptions | undefined;
529
+ };
530
+ type ResponseInterceptorConfig = {
531
+ onFulfilled: InterceptorDependencyInjector<ResponseInterceptor> | ResponseInterceptor | null;
532
+ onRejected: InterceptorDependencyInjector<ErrorInterceptor> | ErrorInterceptor | null;
533
+ };
534
+ type InterceptorConfigs = {
535
+ requestConfigs?: RequestInterceptorConfig[];
536
+ responseConfigs?: ResponseInterceptorConfig[];
537
+ };
538
+ type HttpTransportInstanceConfig = {
539
+ interceptors?: InterceptorConfigs;
540
+ instanceConfig?: CreateAxiosDefaults;
541
+ httpAgentConfig?: AgentOptions;
542
+ logger: ILogger;
543
+ context?: RequestContext;
544
+ };
545
+ //#endregion
546
+ //#region src/httpTransportFactory/index.d.ts
547
+ declare class HttpTransportFactory {
548
+ static createInstance({
549
+ interceptors,
550
+ instanceConfig,
551
+ httpAgentConfig,
552
+ logger,
553
+ context
554
+ }: HttpTransportInstanceConfig): AxiosInstance;
555
+ private static applyInterceptors;
556
+ private static resolveInterceptorInstance;
557
+ }
558
+ //#endregion
207
559
  //#region src/instanceManager/index.d.ts
208
560
  declare class InstanceManager {
209
561
  private static instance;
@@ -219,82 +571,6 @@ declare class InstanceManager {
219
571
  close(): void;
220
572
  }
221
573
  //#endregion
222
- //#region src/lockManager/index.d.ts
223
- declare class LockManager {
224
- private locks;
225
- constructor();
226
- withLock<T>(key: string, operation: () => Promise<T>): Promise<T>;
227
- lock(key: string): Promise<void>;
228
- unlock(key: string): void;
229
- queueLength(key: string): number | undefined;
230
- close(): void;
231
- }
232
- //#endregion
233
- //#region src/cacheClient/types.d.ts
234
- interface ICacheClient<ClientType = unknown> {
235
- getData<T>(key: string): Promise<T | null>;
236
- listData<T>({
237
- partialKey,
238
- limit,
239
- cursor
240
- }: {
241
- partialKey: string;
242
- limit?: number;
243
- cursor?: string;
244
- }): Promise<{
245
- items: T[] | null;
246
- cursor?: string;
247
- }>;
248
- setData<T>({
249
- key,
250
- value,
251
- cacheTTL,
252
- groupKey
253
- }: {
254
- key: string;
255
- value: T;
256
- cacheTTL: number;
257
- groupKey?: string;
258
- }): Promise<boolean>;
259
- executeScript?<T>({
260
- sha1,
261
- keys,
262
- args
263
- }: {
264
- sha1: string;
265
- keys: string[];
266
- args: string[];
267
- }): Promise<T | null>;
268
- loadScript?(script: string): Promise<string | null>;
269
- increment?(key: string, cacheTTL: number): Promise<number | null>;
270
- decrement?(key: string, cacheTTL: number): Promise<number | null>;
271
- subscribe?<T extends boolean = false>(pattern: string, listener: PubSubListener<T>): Promise<boolean>;
272
- unsubscribe?(pattern: string): Promise<boolean>;
273
- publish?(channel: string, message: string): Promise<number | null>;
274
- getClient?(): ClientType | null;
275
- deleteData?(key: string): Promise<boolean>;
276
- }
277
- type PubSubListener<ReturnsBuffer extends boolean = false> = <T extends (ReturnsBuffer extends true ? Buffer : string)>(message: T, channel: T) => unknown;
278
- //#endregion
279
- //#region src/memoryStore/types.d.ts
280
- interface MemoryStoreConfig<T> {
281
- instantiator?: string;
282
- logger?: ILogger;
283
- dataStore?: Map<string, T>;
284
- lockManager?: LockManager;
285
- expiryMap?: Map<string, number>;
286
- evictionFrequency?: number;
287
- staleDataThreshold?: number;
288
- truncateThreshold?: number;
289
- truncationPercentage?: number;
290
- typeGuard?: (data: unknown) => data is T;
291
- dispose?: (key: string, value: T) => Promise<void> | void;
292
- }
293
- type PruneCount = {
294
- dataStoreSize: number;
295
- prunedDataStoreSize: number;
296
- };
297
- //#endregion
298
574
  //#region src/memoryStore/index.d.ts
299
575
  declare class MemoryStore<T> implements ICacheClient {
300
576
  private config;
@@ -357,6 +633,55 @@ type RequestParameter = {
357
633
  //#region src/parsers/requestParameters.d.ts
358
634
  declare const parseRequestParameters: (parameters: RequestParameter[]) => HttpParameters;
359
635
  //#endregion
636
+ //#region src/queueManager/utils/enums.d.ts
637
+ declare enum QueueMethods {
638
+ rPush = "rPush",
639
+ lPush = "lPush",
640
+ lPop = "lPop",
641
+ llen = "llen",
642
+ }
643
+ //#endregion
644
+ //#region src/queueManager/types.d.ts
645
+ type OnTurnFunction<T> = (queueName: string, value: string) => T | Promise<T>;
646
+ //#endregion
647
+ //#region src/queueManager/index.d.ts
648
+ declare class QueueManager extends ScriptManager<QueueMethods> {
649
+ private static instance;
650
+ private static asyncInstanceInit;
651
+ private static logger?;
652
+ private static config?;
653
+ protected logger?: ILogger;
654
+ private subscriptionManager;
655
+ private eventClient;
656
+ static getInstance(config?: RedisClientConfig, logger?: ILogger, scriptMap?: Map<QueueMethods, string>): Promise<QueueManager>;
657
+ protected additionalInitialization(): Promise<void>;
658
+ joinAndWaitTurn<T>(queueName: string, value: string, hasPriority: boolean, onTurn: OnTurnFunction<T>, coldStartEnabled?: boolean): Promise<T | null>;
659
+ pop<T>(queueName: string): Promise<T | null>;
660
+ length(queueName: string): Promise<number | null>;
661
+ private readyCheck;
662
+ isReady(): Promise<boolean>;
663
+ close(): void;
664
+ }
665
+ //#endregion
666
+ //#region src/rateLimitManager/constants.d.ts
667
+ declare enum RateLimitMethods {
668
+ incr = "incr",
669
+ }
670
+ //#endregion
671
+ //#region src/rateLimitManager/index.d.ts
672
+ declare class RateLimitManager extends ScriptManager<RateLimitMethods> {
673
+ private static instance;
674
+ private static asyncInstanceInit;
675
+ private static logger?;
676
+ private static initConfig;
677
+ static getInstance(config?: RedisClientConfig, logger?: ILogger, scriptMap?: Map<RateLimitMethods, string>): Promise<RateLimitManager>;
678
+ getDynamicMaxWaitTime(ratelimitConfig: RateLimitConfig, concurrencyConfig: ConcurrencyConfig, requestUrl?: string, cutoffTime?: number, fudgeFactor?: number, ballparkResponseTime?: number): Promise<number>;
679
+ getWaitTime(requestKey: any, config: RateLimitConfig, requestUrl?: string): Promise<number | null>;
680
+ private readyCheck;
681
+ static isReady(): Promise<boolean>;
682
+ static close(): void;
683
+ }
684
+ //#endregion
360
685
  //#region src/requestClient/types.d.ts
361
686
  interface IRequestClient {
362
687
  performRequest: ({
@@ -383,6 +708,35 @@ declare class RequestClientFactory {
383
708
  static build(type?: RequestClientType): IRequestClient;
384
709
  }
385
710
  //#endregion
711
+ //#region src/redisClient/types.d.ts
712
+ type GetRedisClient = typeof buildRedisClientInstance;
713
+ //#endregion
714
+ //#region src/subscriptionManager/types.d.ts
715
+ type SubscriptionManagerOptions = {
716
+ config?: RedisClientConfig;
717
+ getCacheClient?: GetRedisClient;
718
+ logger?: ILogger;
719
+ instantiator?: string;
720
+ subscriptionTTL?: number;
721
+ staleSubscriptionsThreshold?: number;
722
+ truncateThreshold?: number;
723
+ truncationPercentage?: number;
724
+ };
725
+ //#endregion
726
+ //#region src/subscriptionManager/index.d.ts
727
+ declare class SubscriptionManager {
728
+ private options;
729
+ private subscriptionMap;
730
+ private subscriptionClient;
731
+ private logger?;
732
+ constructor(options: SubscriptionManagerOptions);
733
+ initialize(options?: SubscriptionManagerOptions): Promise<void>;
734
+ subscribe<T extends boolean = false>(key: string, listener: PubSubListener<T>): Promise<boolean>;
735
+ unsubscribe(key: string): Promise<boolean>;
736
+ isReady(): boolean;
737
+ close(): void;
738
+ }
739
+ //#endregion
386
740
  //#region src/validators/statusCodes.d.ts
387
741
  declare const isSuccessStatusCode: (status: number | undefined) => boolean;
388
742
  declare const isFailedStatusCode: (status: number | undefined) => boolean;
@@ -396,4 +750,4 @@ type LockEntry = {
396
750
  unlock: Unlock;
397
751
  };
398
752
  //#endregion
399
- export { CUSTOM_ERROR_CONFIG_SCHEMA, CustomErrorConfig, HttpClient, HttpClientManager, HttpErrorMessages, HttpHeaders, HttpMethod, HttpMethods, HttpParameters, HttpQueryParams, HttpResponse, HttpResponseError, ICacheClient, IHttpClient, InstanceManager, Lock, LockEntry, LockManager, MemoryStore, MemoryStoreConfig, PruneCount, PubSubListener, RequestClientFactory, RequestParameter, RequestParameterLocations, Unlock, createAuthorizationHeaders, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, parseRequestParameters };
753
+ export { CUSTOM_ERROR_CONFIG_SCHEMA, ConcurrencyManager, CustomErrorConfig, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, HttpHeaders, HttpMethod, HttpMethods, HttpParameters, HttpQueryParams, HttpResponse, HttpResponseError, HttpTransportFactory, ICacheClient, IHttpClient, InstanceManager, Lock, LockEntry, LockManager, MemoryStore, MemoryStoreConfig, PruneCount, PubSubListener, QueueManager, RateLimitManager, RedisClient, RequestClientFactory, RequestParameter, RequestParameterLocations, ScriptManager, SubscriptionManager, Unlock, createAuthorizationHeaders, getTransportInstance, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, parseRequestParameters };