@stackone/transport 2.26.0 → 2.27.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/README.md +7 -7
- package/dist/chunk-BhWHdk3m.mjs +1 -0
- package/dist/index.cjs +11 -27
- package/dist/index.d.cts +19 -79
- package/dist/index.d.mts +19 -79
- package/dist/index.mjs +12 -28
- package/package.json +56 -52
- package/dist/chunk-hhuvQGXm.mjs +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,74 +1,13 @@
|
|
|
1
|
+
import { ILogger } from "@stackone/logger";
|
|
1
2
|
import http, { AgentOptions } from "node:http";
|
|
2
3
|
import https from "node:https";
|
|
3
4
|
import { AxiosError, AxiosInstance, AxiosInterceptorManager, AxiosInterceptorOptions, AxiosResponse, CreateAxiosDefaults, InternalAxiosRequestConfig } from "axios";
|
|
4
5
|
import * as redis from "redis";
|
|
6
|
+
import * as tls$1 from "tls";
|
|
5
7
|
import { Readable } from "node:stream";
|
|
6
|
-
import { z } from "
|
|
8
|
+
import { z } from "@stackone/utils";
|
|
7
9
|
|
|
8
|
-
//#region
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region ../logger/src/types.d.ts
|
|
11
|
-
interface ILogger {
|
|
12
|
-
debug({
|
|
13
|
-
category,
|
|
14
|
-
message,
|
|
15
|
-
traceId,
|
|
16
|
-
context
|
|
17
|
-
}: {
|
|
18
|
-
category?: string;
|
|
19
|
-
message: string;
|
|
20
|
-
traceId?: string;
|
|
21
|
-
context?: Record<string, unknown>;
|
|
22
|
-
}): void;
|
|
23
|
-
info({
|
|
24
|
-
category,
|
|
25
|
-
message,
|
|
26
|
-
traceId,
|
|
27
|
-
context
|
|
28
|
-
}: {
|
|
29
|
-
category?: string;
|
|
30
|
-
message: string;
|
|
31
|
-
traceId?: string;
|
|
32
|
-
context?: Record<string, unknown>;
|
|
33
|
-
}): void;
|
|
34
|
-
warning({
|
|
35
|
-
category,
|
|
36
|
-
message,
|
|
37
|
-
traceId,
|
|
38
|
-
error,
|
|
39
|
-
code,
|
|
40
|
-
context
|
|
41
|
-
}: {
|
|
42
|
-
category?: string;
|
|
43
|
-
message: string;
|
|
44
|
-
traceId?: string;
|
|
45
|
-
error?: LogError;
|
|
46
|
-
code?: string;
|
|
47
|
-
context?: Record<string, unknown>;
|
|
48
|
-
}): void;
|
|
49
|
-
error({
|
|
50
|
-
category,
|
|
51
|
-
message,
|
|
52
|
-
traceId,
|
|
53
|
-
error,
|
|
54
|
-
code,
|
|
55
|
-
context
|
|
56
|
-
}: {
|
|
57
|
-
category?: string;
|
|
58
|
-
message: string;
|
|
59
|
-
traceId?: string;
|
|
60
|
-
error?: LogError;
|
|
61
|
-
code: string;
|
|
62
|
-
context?: Record<string, unknown>;
|
|
63
|
-
}): void;
|
|
64
|
-
}
|
|
65
|
-
type LogError = Error & {
|
|
66
|
-
response?: {
|
|
67
|
-
data?: unknown;
|
|
68
|
-
};
|
|
69
|
-
context?: Record<string, unknown>;
|
|
70
|
-
url?: string;
|
|
71
|
-
};
|
|
10
|
+
//#region \0rolldown/runtime.js
|
|
72
11
|
//#endregion
|
|
73
12
|
//#region src/asyncSingleton/index.d.ts
|
|
74
13
|
declare abstract class AsyncSingleton<T, O> {
|
|
@@ -149,7 +88,7 @@ interface RedisClientConfig {
|
|
|
149
88
|
getRedisClient?: typeof redis.createClient;
|
|
150
89
|
host?: string;
|
|
151
90
|
port?: number;
|
|
152
|
-
tls?: boolean;
|
|
91
|
+
tls?: boolean | tls$1.ConnectionOptions;
|
|
153
92
|
keepAlive?: number;
|
|
154
93
|
reconnect?: boolean;
|
|
155
94
|
database?: number;
|
|
@@ -285,7 +224,7 @@ type RequestMetadata = {
|
|
|
285
224
|
declare enum ConcurrencyMethods {
|
|
286
225
|
tryConcurrency = "tryConcurrency",
|
|
287
226
|
removeFromSet = "removeFromSet",
|
|
288
|
-
publishNextItem = "publishNextItem"
|
|
227
|
+
publishNextItem = "publishNextItem"
|
|
289
228
|
}
|
|
290
229
|
//#endregion
|
|
291
230
|
//#region src/concurrencyManager/index.d.ts
|
|
@@ -330,7 +269,7 @@ type RateLimitConfig = {
|
|
|
330
269
|
//#endregion
|
|
331
270
|
//#region src/rateLimitManager/constants.d.ts
|
|
332
271
|
declare enum RateLimitMethods {
|
|
333
|
-
incr = "incr"
|
|
272
|
+
incr = "incr"
|
|
334
273
|
}
|
|
335
274
|
//#endregion
|
|
336
275
|
//#region src/rateLimitManager/index.d.ts
|
|
@@ -412,7 +351,7 @@ type HttpQueryParams = {
|
|
|
412
351
|
};
|
|
413
352
|
declare const HttpMethods: readonly ["get", "post", "put", "delete", "patch"];
|
|
414
353
|
type HttpMethod = (typeof HttpMethods)[number];
|
|
415
|
-
type HttpResponse<T = any, P
|
|
354
|
+
type HttpResponse<T = any, P = any> = {
|
|
416
355
|
data: T;
|
|
417
356
|
status: number;
|
|
418
357
|
headers: HttpHeaders;
|
|
@@ -420,7 +359,7 @@ type HttpResponse<T = any, P$1 = any> = {
|
|
|
420
359
|
responseType?: string;
|
|
421
360
|
responseTime?: Date;
|
|
422
361
|
message?: string;
|
|
423
|
-
body?: P
|
|
362
|
+
body?: P;
|
|
424
363
|
};
|
|
425
364
|
type StreamHttpResponse = {
|
|
426
365
|
status: number;
|
|
@@ -434,7 +373,7 @@ type HttpParameters = {
|
|
|
434
373
|
headers: HttpHeaders;
|
|
435
374
|
};
|
|
436
375
|
interface IHttpClient {
|
|
437
|
-
request<P
|
|
376
|
+
request<P, T>({
|
|
438
377
|
headers,
|
|
439
378
|
url,
|
|
440
379
|
method,
|
|
@@ -457,7 +396,7 @@ interface IHttpClient {
|
|
|
457
396
|
responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text';
|
|
458
397
|
cacheTTL?: number;
|
|
459
398
|
context?: RequestContext;
|
|
460
|
-
payload?: P
|
|
399
|
+
payload?: P;
|
|
461
400
|
httpsAgent?: https.Agent;
|
|
462
401
|
httpAgent?: http.Agent;
|
|
463
402
|
requestConfig?: RequestConfig;
|
|
@@ -480,7 +419,7 @@ interface IHttpClient {
|
|
|
480
419
|
context?: RequestContext;
|
|
481
420
|
requestConfig?: RequestConfig;
|
|
482
421
|
}): Promise<HttpResponse<T>>;
|
|
483
|
-
post<P
|
|
422
|
+
post<P, T>({
|
|
484
423
|
headers,
|
|
485
424
|
url,
|
|
486
425
|
maxRedirects,
|
|
@@ -494,7 +433,7 @@ interface IHttpClient {
|
|
|
494
433
|
maxRedirects?: number;
|
|
495
434
|
cacheTTL?: number;
|
|
496
435
|
context?: RequestContext;
|
|
497
|
-
payload?: P
|
|
436
|
+
payload?: P;
|
|
498
437
|
requestConfig?: RequestConfig;
|
|
499
438
|
}): Promise<HttpResponse<T>>;
|
|
500
439
|
requestStream({
|
|
@@ -745,7 +684,7 @@ declare class HttpClient<TError extends Error = Error> implements IHttpClient {
|
|
|
745
684
|
redisClientConfig?: RedisClientConfig;
|
|
746
685
|
errorMappingFn?: ErrorMappingFn<TError>;
|
|
747
686
|
});
|
|
748
|
-
request<P
|
|
687
|
+
request<P, T>({
|
|
749
688
|
headers,
|
|
750
689
|
url,
|
|
751
690
|
method,
|
|
@@ -770,7 +709,7 @@ declare class HttpClient<TError extends Error = Error> implements IHttpClient {
|
|
|
770
709
|
cacheTTL?: number;
|
|
771
710
|
context?: RequestContext;
|
|
772
711
|
traceId?: string;
|
|
773
|
-
payload?: P
|
|
712
|
+
payload?: P;
|
|
774
713
|
httpsAgent?: https.Agent;
|
|
775
714
|
httpAgent?: http.Agent;
|
|
776
715
|
requestConfig?: RequestConfig;
|
|
@@ -795,7 +734,7 @@ declare class HttpClient<TError extends Error = Error> implements IHttpClient {
|
|
|
795
734
|
traceId?: string;
|
|
796
735
|
requestConfig?: RequestConfig;
|
|
797
736
|
}): Promise<HttpResponse<T>>;
|
|
798
|
-
post<P
|
|
737
|
+
post<P, T>({
|
|
799
738
|
headers,
|
|
800
739
|
url,
|
|
801
740
|
maxRedirects,
|
|
@@ -811,7 +750,7 @@ declare class HttpClient<TError extends Error = Error> implements IHttpClient {
|
|
|
811
750
|
cacheTTL?: number;
|
|
812
751
|
context?: RequestContext;
|
|
813
752
|
traceId?: string;
|
|
814
|
-
payload?: P
|
|
753
|
+
payload?: P;
|
|
815
754
|
requestConfig?: RequestConfig;
|
|
816
755
|
}): Promise<HttpResponse<T>>;
|
|
817
756
|
requestStream({
|
|
@@ -921,7 +860,7 @@ declare enum QueueMethods {
|
|
|
921
860
|
rPush = "rPush",
|
|
922
861
|
lPush = "lPush",
|
|
923
862
|
lPop = "lPop",
|
|
924
|
-
llen = "llen"
|
|
863
|
+
llen = "llen"
|
|
925
864
|
}
|
|
926
865
|
//#endregion
|
|
927
866
|
//#region src/queueManager/types.d.ts
|
|
@@ -1021,6 +960,7 @@ declare class MemoryStore<T> implements ICacheClient {
|
|
|
1021
960
|
private typeGuardBypass;
|
|
1022
961
|
delete(key: string, groupKeys?: string[]): Promise<boolean>;
|
|
1023
962
|
pruneExpiredKeys(): Promise<PruneCount | undefined>;
|
|
963
|
+
private removeKeysFromGroups;
|
|
1024
964
|
private startEvictionTask;
|
|
1025
965
|
private stopEvictionTask;
|
|
1026
966
|
private updateLastAccessedAt;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,74 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as __name } from "./chunk-BhWHdk3m.mjs";
|
|
2
|
+
import { z } from "@stackone/utils";
|
|
2
3
|
import * as redis from "redis";
|
|
3
4
|
import { AxiosError, AxiosInstance, AxiosInterceptorManager, AxiosInterceptorOptions, AxiosResponse, CreateAxiosDefaults, InternalAxiosRequestConfig } from "axios";
|
|
4
5
|
import https from "node:https";
|
|
6
|
+
import { ILogger } from "@stackone/logger";
|
|
5
7
|
import http, { AgentOptions } from "node:http";
|
|
8
|
+
import * as tls$1 from "tls";
|
|
6
9
|
import { Readable } from "node:stream";
|
|
7
|
-
import { z } from "zod/v4";
|
|
8
10
|
|
|
9
|
-
//#region ../logger/src/types.d.ts
|
|
10
|
-
interface ILogger {
|
|
11
|
-
debug({
|
|
12
|
-
category,
|
|
13
|
-
message,
|
|
14
|
-
traceId,
|
|
15
|
-
context
|
|
16
|
-
}: {
|
|
17
|
-
category?: string;
|
|
18
|
-
message: string;
|
|
19
|
-
traceId?: string;
|
|
20
|
-
context?: Record<string, unknown>;
|
|
21
|
-
}): void;
|
|
22
|
-
info({
|
|
23
|
-
category,
|
|
24
|
-
message,
|
|
25
|
-
traceId,
|
|
26
|
-
context
|
|
27
|
-
}: {
|
|
28
|
-
category?: string;
|
|
29
|
-
message: string;
|
|
30
|
-
traceId?: string;
|
|
31
|
-
context?: Record<string, unknown>;
|
|
32
|
-
}): void;
|
|
33
|
-
warning({
|
|
34
|
-
category,
|
|
35
|
-
message,
|
|
36
|
-
traceId,
|
|
37
|
-
error,
|
|
38
|
-
code,
|
|
39
|
-
context
|
|
40
|
-
}: {
|
|
41
|
-
category?: string;
|
|
42
|
-
message: string;
|
|
43
|
-
traceId?: string;
|
|
44
|
-
error?: LogError;
|
|
45
|
-
code?: string;
|
|
46
|
-
context?: Record<string, unknown>;
|
|
47
|
-
}): void;
|
|
48
|
-
error({
|
|
49
|
-
category,
|
|
50
|
-
message,
|
|
51
|
-
traceId,
|
|
52
|
-
error,
|
|
53
|
-
code,
|
|
54
|
-
context
|
|
55
|
-
}: {
|
|
56
|
-
category?: string;
|
|
57
|
-
message: string;
|
|
58
|
-
traceId?: string;
|
|
59
|
-
error?: LogError;
|
|
60
|
-
code: string;
|
|
61
|
-
context?: Record<string, unknown>;
|
|
62
|
-
}): void;
|
|
63
|
-
}
|
|
64
|
-
type LogError = Error & {
|
|
65
|
-
response?: {
|
|
66
|
-
data?: unknown;
|
|
67
|
-
};
|
|
68
|
-
context?: Record<string, unknown>;
|
|
69
|
-
url?: string;
|
|
70
|
-
};
|
|
71
|
-
//#endregion
|
|
72
11
|
//#region src/asyncSingleton/index.d.ts
|
|
73
12
|
declare abstract class AsyncSingleton<T, O> {
|
|
74
13
|
private instance;
|
|
@@ -148,7 +87,7 @@ interface RedisClientConfig {
|
|
|
148
87
|
getRedisClient?: typeof redis.createClient;
|
|
149
88
|
host?: string;
|
|
150
89
|
port?: number;
|
|
151
|
-
tls?: boolean;
|
|
90
|
+
tls?: boolean | tls$1.ConnectionOptions;
|
|
152
91
|
keepAlive?: number;
|
|
153
92
|
reconnect?: boolean;
|
|
154
93
|
database?: number;
|
|
@@ -284,7 +223,7 @@ type RequestMetadata = {
|
|
|
284
223
|
declare enum ConcurrencyMethods {
|
|
285
224
|
tryConcurrency = "tryConcurrency",
|
|
286
225
|
removeFromSet = "removeFromSet",
|
|
287
|
-
publishNextItem = "publishNextItem"
|
|
226
|
+
publishNextItem = "publishNextItem"
|
|
288
227
|
}
|
|
289
228
|
//#endregion
|
|
290
229
|
//#region src/concurrencyManager/index.d.ts
|
|
@@ -329,7 +268,7 @@ type RateLimitConfig = {
|
|
|
329
268
|
//#endregion
|
|
330
269
|
//#region src/rateLimitManager/constants.d.ts
|
|
331
270
|
declare enum RateLimitMethods {
|
|
332
|
-
incr = "incr"
|
|
271
|
+
incr = "incr"
|
|
333
272
|
}
|
|
334
273
|
//#endregion
|
|
335
274
|
//#region src/rateLimitManager/index.d.ts
|
|
@@ -411,7 +350,7 @@ type HttpQueryParams = {
|
|
|
411
350
|
};
|
|
412
351
|
declare const HttpMethods: readonly ["get", "post", "put", "delete", "patch"];
|
|
413
352
|
type HttpMethod = (typeof HttpMethods)[number];
|
|
414
|
-
type HttpResponse<T = any, P
|
|
353
|
+
type HttpResponse<T = any, P = any> = {
|
|
415
354
|
data: T;
|
|
416
355
|
status: number;
|
|
417
356
|
headers: HttpHeaders;
|
|
@@ -419,7 +358,7 @@ type HttpResponse<T = any, P$1 = any> = {
|
|
|
419
358
|
responseType?: string;
|
|
420
359
|
responseTime?: Date;
|
|
421
360
|
message?: string;
|
|
422
|
-
body?: P
|
|
361
|
+
body?: P;
|
|
423
362
|
};
|
|
424
363
|
type StreamHttpResponse = {
|
|
425
364
|
status: number;
|
|
@@ -433,7 +372,7 @@ type HttpParameters = {
|
|
|
433
372
|
headers: HttpHeaders;
|
|
434
373
|
};
|
|
435
374
|
interface IHttpClient {
|
|
436
|
-
request<P
|
|
375
|
+
request<P, T>({
|
|
437
376
|
headers,
|
|
438
377
|
url,
|
|
439
378
|
method,
|
|
@@ -456,7 +395,7 @@ interface IHttpClient {
|
|
|
456
395
|
responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text';
|
|
457
396
|
cacheTTL?: number;
|
|
458
397
|
context?: RequestContext;
|
|
459
|
-
payload?: P
|
|
398
|
+
payload?: P;
|
|
460
399
|
httpsAgent?: https.Agent;
|
|
461
400
|
httpAgent?: http.Agent;
|
|
462
401
|
requestConfig?: RequestConfig;
|
|
@@ -479,7 +418,7 @@ interface IHttpClient {
|
|
|
479
418
|
context?: RequestContext;
|
|
480
419
|
requestConfig?: RequestConfig;
|
|
481
420
|
}): Promise<HttpResponse<T>>;
|
|
482
|
-
post<P
|
|
421
|
+
post<P, T>({
|
|
483
422
|
headers,
|
|
484
423
|
url,
|
|
485
424
|
maxRedirects,
|
|
@@ -493,7 +432,7 @@ interface IHttpClient {
|
|
|
493
432
|
maxRedirects?: number;
|
|
494
433
|
cacheTTL?: number;
|
|
495
434
|
context?: RequestContext;
|
|
496
|
-
payload?: P
|
|
435
|
+
payload?: P;
|
|
497
436
|
requestConfig?: RequestConfig;
|
|
498
437
|
}): Promise<HttpResponse<T>>;
|
|
499
438
|
requestStream({
|
|
@@ -744,7 +683,7 @@ declare class HttpClient<TError extends Error = Error> implements IHttpClient {
|
|
|
744
683
|
redisClientConfig?: RedisClientConfig;
|
|
745
684
|
errorMappingFn?: ErrorMappingFn<TError>;
|
|
746
685
|
});
|
|
747
|
-
request<P
|
|
686
|
+
request<P, T>({
|
|
748
687
|
headers,
|
|
749
688
|
url,
|
|
750
689
|
method,
|
|
@@ -769,7 +708,7 @@ declare class HttpClient<TError extends Error = Error> implements IHttpClient {
|
|
|
769
708
|
cacheTTL?: number;
|
|
770
709
|
context?: RequestContext;
|
|
771
710
|
traceId?: string;
|
|
772
|
-
payload?: P
|
|
711
|
+
payload?: P;
|
|
773
712
|
httpsAgent?: https.Agent;
|
|
774
713
|
httpAgent?: http.Agent;
|
|
775
714
|
requestConfig?: RequestConfig;
|
|
@@ -794,7 +733,7 @@ declare class HttpClient<TError extends Error = Error> implements IHttpClient {
|
|
|
794
733
|
traceId?: string;
|
|
795
734
|
requestConfig?: RequestConfig;
|
|
796
735
|
}): Promise<HttpResponse<T>>;
|
|
797
|
-
post<P
|
|
736
|
+
post<P, T>({
|
|
798
737
|
headers,
|
|
799
738
|
url,
|
|
800
739
|
maxRedirects,
|
|
@@ -810,7 +749,7 @@ declare class HttpClient<TError extends Error = Error> implements IHttpClient {
|
|
|
810
749
|
cacheTTL?: number;
|
|
811
750
|
context?: RequestContext;
|
|
812
751
|
traceId?: string;
|
|
813
|
-
payload?: P
|
|
752
|
+
payload?: P;
|
|
814
753
|
requestConfig?: RequestConfig;
|
|
815
754
|
}): Promise<HttpResponse<T>>;
|
|
816
755
|
requestStream({
|
|
@@ -920,7 +859,7 @@ declare enum QueueMethods {
|
|
|
920
859
|
rPush = "rPush",
|
|
921
860
|
lPush = "lPush",
|
|
922
861
|
lPop = "lPop",
|
|
923
|
-
llen = "llen"
|
|
862
|
+
llen = "llen"
|
|
924
863
|
}
|
|
925
864
|
//#endregion
|
|
926
865
|
//#region src/queueManager/types.d.ts
|
|
@@ -1020,6 +959,7 @@ declare class MemoryStore<T> implements ICacheClient {
|
|
|
1020
959
|
private typeGuardBypass;
|
|
1021
960
|
delete(key: string, groupKeys?: string[]): Promise<boolean>;
|
|
1022
961
|
pruneExpiredKeys(): Promise<PruneCount | undefined>;
|
|
962
|
+
private removeKeysFromGroups;
|
|
1023
963
|
private startEvictionTask;
|
|
1024
964
|
private stopEvictionTask;
|
|
1025
965
|
private updateLastAccessedAt;
|