@trpc/client 11.3.1 → 11.3.2-canary.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.
- package/dist/TRPCClientError-CGgRtttT.cjs +67 -0
- package/dist/TRPCClientError-COkhCKf3.mjs +56 -0
- package/dist/TRPCClientError-COkhCKf3.mjs.map +1 -0
- package/dist/chunk-DWy1uDak.cjs +39 -0
- package/dist/httpBatchLink-CIC9PZ_Z.cjs +267 -0
- package/dist/httpBatchLink-DIfnmmcu.mjs +238 -0
- package/dist/httpBatchLink-DIfnmmcu.mjs.map +1 -0
- package/dist/httpBatchLink.d-BN2Iw_cK.d.mts +33 -0
- package/dist/httpBatchLink.d-BN2Iw_cK.d.mts.map +1 -0
- package/dist/httpBatchLink.d-CLAuJKNV.d.cts +33 -0
- package/dist/httpBatchLink.d-CLAuJKNV.d.cts.map +1 -0
- package/dist/httpLink-9bpwQ15c.mjs +90 -0
- package/dist/httpLink-9bpwQ15c.mjs.map +1 -0
- package/dist/httpLink-BbVj_TgM.cjs +113 -0
- package/dist/httpLink.d-CTSOARfE.d.mts +23 -0
- package/dist/httpLink.d-CTSOARfE.d.mts.map +1 -0
- package/dist/httpLink.d-yMKfOlTU.d.cts +23 -0
- package/dist/httpLink.d-yMKfOlTU.d.cts.map +1 -0
- package/dist/httpUtils-3pbQzhUL.mjs +123 -0
- package/dist/httpUtils-3pbQzhUL.mjs.map +1 -0
- package/dist/httpUtils-Buf6jCgh.cjs +163 -0
- package/dist/httpUtils.d-C8wPxU79.d.mts +25 -0
- package/dist/httpUtils.d-C8wPxU79.d.mts.map +1 -0
- package/dist/httpUtils.d-DNRVGNHs.d.cts +25 -0
- package/dist/httpUtils.d-DNRVGNHs.d.cts.map +1 -0
- package/dist/index.cjs +731 -0
- package/dist/index.d.cts +197 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +197 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +733 -16
- package/dist/index.mjs.map +1 -0
- package/dist/links/httpBatchLink.cjs +6 -0
- package/dist/links/httpBatchLink.d.cts +6 -0
- package/dist/links/httpBatchLink.d.mts +6 -0
- package/dist/links/httpBatchLink.mjs +5 -107
- package/dist/links/httpLink.cjs +6 -0
- package/dist/links/httpLink.d.cts +6 -0
- package/dist/links/httpLink.d.mts +6 -0
- package/dist/links/httpLink.mjs +5 -92
- package/dist/links/loggerLink.cjs +3 -0
- package/dist/links/loggerLink.d.cts +4 -0
- package/dist/links/loggerLink.d.mts +4 -0
- package/dist/links/loggerLink.mjs +2 -175
- package/dist/links/splitLink.cjs +3 -0
- package/dist/links/splitLink.d.cts +4 -0
- package/dist/links/splitLink.d.mts +4 -0
- package/dist/links/splitLink.mjs +2 -24
- package/dist/links/wsLink/wsLink.cjs +6 -0
- package/dist/links/wsLink/wsLink.d.cts +5 -0
- package/dist/links/wsLink/wsLink.d.mts +5 -0
- package/dist/links/wsLink/wsLink.mjs +4 -31
- package/dist/loggerLink-CsDfg5Bb.cjs +130 -0
- package/dist/loggerLink-PGBSQFcR.mjs +125 -0
- package/dist/loggerLink-PGBSQFcR.mjs.map +1 -0
- package/dist/loggerLink.d-CZjK1CXm.d.mts +54 -0
- package/dist/loggerLink.d-CZjK1CXm.d.mts.map +1 -0
- package/dist/loggerLink.d-DU855urG.d.cts +54 -0
- package/dist/loggerLink.d-DU855urG.d.cts.map +1 -0
- package/dist/splitLink-BMgxggng.cjs +58 -0
- package/dist/splitLink-BVblHq4n.mjs +47 -0
- package/dist/splitLink-BVblHq4n.mjs.map +1 -0
- package/dist/splitLink.d-BAqgq0NG.d.mts +20 -0
- package/dist/splitLink.d-BAqgq0NG.d.mts.map +1 -0
- package/dist/splitLink.d-GdevSkGW.d.cts +20 -0
- package/dist/splitLink.d-GdevSkGW.d.cts.map +1 -0
- package/dist/subscriptions.d-Ciljg_dH.d.cts +19 -0
- package/dist/subscriptions.d-Ciljg_dH.d.cts.map +1 -0
- package/dist/subscriptions.d-U92STdZl.d.mts +19 -0
- package/dist/subscriptions.d-U92STdZl.d.mts.map +1 -0
- package/dist/types.d-DXbqQLCC.d.mts +182 -0
- package/dist/types.d-DXbqQLCC.d.mts.map +1 -0
- package/dist/types.d-DqGYG6S_.d.cts +182 -0
- package/dist/types.d-DqGYG6S_.d.cts.map +1 -0
- package/dist/unstable-internals-CYBH4jbF.cjs +34 -0
- package/dist/unstable-internals-DU4WecoG.mjs +29 -0
- package/dist/unstable-internals-DU4WecoG.mjs.map +1 -0
- package/dist/unstable-internals.cjs +3 -0
- package/dist/unstable-internals.d-DyLd-B0J.d.mts +46 -0
- package/dist/unstable-internals.d-DyLd-B0J.d.mts.map +1 -0
- package/dist/unstable-internals.d-kWsZTlQq.d.cts +46 -0
- package/dist/unstable-internals.d-kWsZTlQq.d.cts.map +1 -0
- package/dist/unstable-internals.d.cts +3 -0
- package/dist/unstable-internals.d.mts +3 -0
- package/dist/unstable-internals.mjs +3 -1
- package/dist/wsLink-DbSHOzlB.mjs +698 -0
- package/dist/wsLink-DbSHOzlB.mjs.map +1 -0
- package/dist/wsLink-DhJ50EC5.cjs +715 -0
- package/dist/wsLink.d-BqO7ltN_.d.mts +194 -0
- package/dist/wsLink.d-BqO7ltN_.d.mts.map +1 -0
- package/dist/wsLink.d-DtZjg09g.d.cts +194 -0
- package/dist/wsLink.d-DtZjg09g.d.cts.map +1 -0
- package/links/httpBatchLink/package.json +1 -0
- package/links/httpLink/package.json +1 -0
- package/links/loggerLink/package.json +1 -0
- package/links/splitLink/package.json +1 -0
- package/links/wsLink/wsLink/package.json +1 -0
- package/package.json +67 -33
- package/unstable-internals/package.json +1 -0
- package/dist/TRPCClientError.d.ts +0 -30
- package/dist/TRPCClientError.d.ts.map +0 -1
- package/dist/TRPCClientError.js +0 -79
- package/dist/TRPCClientError.mjs +0 -76
- package/dist/createTRPCClient.d.ts +0 -69
- package/dist/createTRPCClient.d.ts.map +0 -1
- package/dist/createTRPCClient.js +0 -48
- package/dist/createTRPCClient.mjs +0 -43
- package/dist/createTRPCUntypedClient.d.ts +0 -7
- package/dist/createTRPCUntypedClient.d.ts.map +0 -1
- package/dist/createTRPCUntypedClient.js +0 -10
- package/dist/createTRPCUntypedClient.mjs +0 -7
- package/dist/getFetch.d.ts +0 -3
- package/dist/getFetch.d.ts.map +0 -1
- package/dist/getFetch.js +0 -17
- package/dist/getFetch.mjs +0 -15
- package/dist/index.d.ts +0 -16
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -46
- package/dist/internals/TRPCUntypedClient.d.ts +0 -39
- package/dist/internals/TRPCUntypedClient.d.ts.map +0 -1
- package/dist/internals/TRPCUntypedClient.js +0 -115
- package/dist/internals/TRPCUntypedClient.mjs +0 -113
- package/dist/internals/dataLoader.d.ts +0 -13
- package/dist/internals/dataLoader.d.ts.map +0 -1
- package/dist/internals/dataLoader.js +0 -117
- package/dist/internals/dataLoader.mjs +0 -115
- package/dist/internals/inputWithTrackedEventId.d.ts +0 -2
- package/dist/internals/inputWithTrackedEventId.d.ts.map +0 -1
- package/dist/internals/inputWithTrackedEventId.js +0 -16
- package/dist/internals/inputWithTrackedEventId.mjs +0 -14
- package/dist/internals/signals.d.ts +0 -16
- package/dist/internals/signals.d.ts.map +0 -1
- package/dist/internals/signals.js +0 -61
- package/dist/internals/signals.mjs +0 -57
- package/dist/internals/transformer.d.ts +0 -42
- package/dist/internals/transformer.d.ts.map +0 -1
- package/dist/internals/transformer.js +0 -30
- package/dist/internals/transformer.mjs +0 -28
- package/dist/internals/types.d.ts +0 -82
- package/dist/internals/types.d.ts.map +0 -1
- package/dist/links/HTTPBatchLinkOptions.d.ts +0 -20
- package/dist/links/HTTPBatchLinkOptions.d.ts.map +0 -1
- package/dist/links/httpBatchLink.d.ts +0 -8
- package/dist/links/httpBatchLink.d.ts.map +0 -1
- package/dist/links/httpBatchLink.js +0 -110
- package/dist/links/httpBatchStreamLink.d.ts +0 -12
- package/dist/links/httpBatchStreamLink.d.ts.map +0 -1
- package/dist/links/httpBatchStreamLink.js +0 -150
- package/dist/links/httpBatchStreamLink.mjs +0 -147
- package/dist/links/httpLink.d.ts +0 -17
- package/dist/links/httpLink.d.ts.map +0 -1
- package/dist/links/httpLink.js +0 -95
- package/dist/links/httpSubscriptionLink.d.ts +0 -26
- package/dist/links/httpSubscriptionLink.d.ts.map +0 -1
- package/dist/links/httpSubscriptionLink.js +0 -177
- package/dist/links/httpSubscriptionLink.mjs +0 -174
- package/dist/links/internals/contentTypes.d.ts +0 -4
- package/dist/links/internals/contentTypes.d.ts.map +0 -1
- package/dist/links/internals/contentTypes.js +0 -16
- package/dist/links/internals/contentTypes.mjs +0 -12
- package/dist/links/internals/createChain.d.ts +0 -8
- package/dist/links/internals/createChain.d.ts.map +0 -1
- package/dist/links/internals/createChain.js +0 -26
- package/dist/links/internals/createChain.mjs +0 -24
- package/dist/links/internals/dedupeLink.d.ts +0 -7
- package/dist/links/internals/dedupeLink.d.ts.map +0 -1
- package/dist/links/internals/httpUtils.d.ts +0 -68
- package/dist/links/internals/httpUtils.d.ts.map +0 -1
- package/dist/links/internals/httpUtils.js +0 -141
- package/dist/links/internals/httpUtils.mjs +0 -133
- package/dist/links/internals/subscriptions.d.ts +0 -17
- package/dist/links/internals/subscriptions.d.ts.map +0 -1
- package/dist/links/internals/urlWithConnectionParams.d.ts +0 -23
- package/dist/links/internals/urlWithConnectionParams.d.ts.map +0 -1
- package/dist/links/internals/urlWithConnectionParams.js +0 -10
- package/dist/links/internals/urlWithConnectionParams.mjs +0 -8
- package/dist/links/localLink.d.ts +0 -15
- package/dist/links/localLink.d.ts.map +0 -1
- package/dist/links/localLink.js +0 -333
- package/dist/links/localLink.mjs +0 -331
- package/dist/links/loggerLink.d.ts +0 -52
- package/dist/links/loggerLink.d.ts.map +0 -1
- package/dist/links/loggerLink.js +0 -178
- package/dist/links/retryLink.d.ts +0 -33
- package/dist/links/retryLink.d.ts.map +0 -1
- package/dist/links/retryLink.js +0 -72
- package/dist/links/retryLink.mjs +0 -70
- package/dist/links/splitLink.d.ts +0 -14
- package/dist/links/splitLink.d.ts.map +0 -1
- package/dist/links/splitLink.js +0 -27
- package/dist/links/types.d.ts +0 -63
- package/dist/links/types.d.ts.map +0 -1
- package/dist/links/wsLink/createWsClient.d.ts +0 -6
- package/dist/links/wsLink/createWsClient.d.ts.map +0 -1
- package/dist/links/wsLink/createWsClient.js +0 -9
- package/dist/links/wsLink/createWsClient.mjs +0 -7
- package/dist/links/wsLink/wsClient/options.d.ts +0 -79
- package/dist/links/wsLink/wsClient/options.d.ts.map +0 -1
- package/dist/links/wsLink/wsClient/options.js +0 -22
- package/dist/links/wsLink/wsClient/options.mjs +0 -18
- package/dist/links/wsLink/wsClient/requestManager.d.ts +0 -106
- package/dist/links/wsLink/wsClient/requestManager.d.ts.map +0 -1
- package/dist/links/wsLink/wsClient/requestManager.js +0 -143
- package/dist/links/wsLink/wsClient/requestManager.mjs +0 -141
- package/dist/links/wsLink/wsClient/utils.d.ts +0 -38
- package/dist/links/wsLink/wsClient/utils.d.ts.map +0 -1
- package/dist/links/wsLink/wsClient/utils.js +0 -94
- package/dist/links/wsLink/wsClient/utils.mjs +0 -88
- package/dist/links/wsLink/wsClient/wsClient.d.ts +0 -84
- package/dist/links/wsLink/wsClient/wsClient.d.ts.map +0 -1
- package/dist/links/wsLink/wsClient/wsClient.js +0 -325
- package/dist/links/wsLink/wsClient/wsClient.mjs +0 -323
- package/dist/links/wsLink/wsClient/wsConnection.d.ts +0 -79
- package/dist/links/wsLink/wsClient/wsConnection.d.ts.map +0 -1
- package/dist/links/wsLink/wsClient/wsConnection.js +0 -188
- package/dist/links/wsLink/wsClient/wsConnection.mjs +0 -185
- package/dist/links/wsLink/wsLink.d.ts +0 -11
- package/dist/links/wsLink/wsLink.d.ts.map +0 -1
- package/dist/links/wsLink/wsLink.js +0 -35
- package/dist/links.d.ts +0 -12
- package/dist/links.d.ts.map +0 -1
- package/dist/unstable-internals.d.ts +0 -3
- package/dist/unstable-internals.d.ts.map +0 -1
- package/dist/unstable-internals.js +0 -7
- package/links/httpBatchLink/index.d.ts +0 -1
- package/links/httpBatchLink/index.js +0 -1
- package/links/httpLink/index.d.ts +0 -1
- package/links/httpLink/index.js +0 -1
- package/links/loggerLink/index.d.ts +0 -1
- package/links/loggerLink/index.js +0 -1
- package/links/splitLink/index.d.ts +0 -1
- package/links/splitLink/index.js +0 -1
- package/links/wsLink/index.d.ts +0 -1
- package/links/wsLink/index.js +0 -1
- package/links/wsLink/wsLink/index.d.ts +0 -1
- package/links/wsLink/wsLink/index.js +0 -1
- package/unstable-internals/index.d.ts +0 -1
- package/unstable-internals/index.js +0 -1
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { AnyRouter, InferrableClientTypes } from '@trpc/server/unstable-core-do-not-import';
|
|
2
|
-
import type { TRPCClientError } from '../TRPCClientError';
|
|
3
|
-
import type { Operation, OperationResultEnvelope, TRPCLink } from './types';
|
|
4
|
-
type ConsoleEsque = {
|
|
5
|
-
log: (...args: any[]) => void;
|
|
6
|
-
error: (...args: any[]) => void;
|
|
7
|
-
};
|
|
8
|
-
type EnableFnOptions<TRouter extends InferrableClientTypes> = {
|
|
9
|
-
direction: 'down';
|
|
10
|
-
result: OperationResultEnvelope<unknown, TRPCClientError<TRouter>> | TRPCClientError<TRouter>;
|
|
11
|
-
} | (Operation & {
|
|
12
|
-
direction: 'up';
|
|
13
|
-
});
|
|
14
|
-
type EnabledFn<TRouter extends AnyRouter> = (opts: EnableFnOptions<TRouter>) => boolean;
|
|
15
|
-
type LoggerLinkFnOptions<TRouter extends AnyRouter> = Operation & ({
|
|
16
|
-
/**
|
|
17
|
-
* Request result
|
|
18
|
-
*/
|
|
19
|
-
direction: 'down';
|
|
20
|
-
result: OperationResultEnvelope<unknown, TRPCClientError<TRouter>> | TRPCClientError<TRouter>;
|
|
21
|
-
elapsedMs: number;
|
|
22
|
-
} | {
|
|
23
|
-
/**
|
|
24
|
-
* Request was just initialized
|
|
25
|
-
*/
|
|
26
|
-
direction: 'up';
|
|
27
|
-
});
|
|
28
|
-
type LoggerLinkFn<TRouter extends AnyRouter> = (opts: LoggerLinkFnOptions<TRouter>) => void;
|
|
29
|
-
type ColorMode = 'ansi' | 'css' | 'none';
|
|
30
|
-
export interface LoggerLinkOptions<TRouter extends AnyRouter> {
|
|
31
|
-
logger?: LoggerLinkFn<TRouter>;
|
|
32
|
-
enabled?: EnabledFn<TRouter>;
|
|
33
|
-
/**
|
|
34
|
-
* Used in the built-in defaultLogger
|
|
35
|
-
*/
|
|
36
|
-
console?: ConsoleEsque;
|
|
37
|
-
/**
|
|
38
|
-
* Color mode
|
|
39
|
-
* @default typeof window === 'undefined' ? 'ansi' : 'css'
|
|
40
|
-
*/
|
|
41
|
-
colorMode?: ColorMode;
|
|
42
|
-
/**
|
|
43
|
-
* Include context in the log - defaults to false unless `colorMode` is 'css'
|
|
44
|
-
*/
|
|
45
|
-
withContext?: boolean;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* @see https://trpc.io/docs/v11/client/links/loggerLink
|
|
49
|
-
*/
|
|
50
|
-
export declare function loggerLink<TRouter extends AnyRouter = AnyRouter>(opts?: LoggerLinkOptions<TRouter>): TRPCLink<TRouter>;
|
|
51
|
-
export {};
|
|
52
|
-
//# sourceMappingURL=loggerLink.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loggerLink.d.ts","sourceRoot":"","sources":["../../src/links/loggerLink.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACtB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5E,KAAK,YAAY,GAAG;IAClB,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAC9B,K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AW,CAAC,EAAE,OAAO,CAAC;CACvB;AAqID;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,SAAS,SAAS,GAAG,SAAS,EAC9D,IAAI,GAAE,iBAAiB,CAAC,OAAO,CAAM,GACpC,QAAQ,CAAC,OAAO,CAAC,CAoDnB"}
|
package/dist/links/loggerLink.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var observable = require('@trpc/server/observable');
|
|
4
|
-
|
|
5
|
-
/// <reference lib="dom.iterable" />
|
|
6
|
-
// `dom.iterable` types are explicitly required for extracting `FormData` values,
|
|
7
|
-
// as all implementations of `Symbol.iterable` are separated from the main `dom` types.
|
|
8
|
-
// Using triple-slash directive makes sure that it will be available,
|
|
9
|
-
// even if end-user `tsconfig.json` omits it in the `lib` array.
|
|
10
|
-
function isFormData(value) {
|
|
11
|
-
if (typeof FormData === 'undefined') {
|
|
12
|
-
// FormData is not supported
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
15
|
-
return value instanceof FormData;
|
|
16
|
-
}
|
|
17
|
-
const palettes = {
|
|
18
|
-
css: {
|
|
19
|
-
query: [
|
|
20
|
-
'72e3ff',
|
|
21
|
-
'3fb0d8'
|
|
22
|
-
],
|
|
23
|
-
mutation: [
|
|
24
|
-
'c5a3fc',
|
|
25
|
-
'904dfc'
|
|
26
|
-
],
|
|
27
|
-
subscription: [
|
|
28
|
-
'ff49e1',
|
|
29
|
-
'd83fbe'
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
ansi: {
|
|
33
|
-
regular: {
|
|
34
|
-
// Cyan background, black and white text respectively
|
|
35
|
-
query: [
|
|
36
|
-
'\x1b[30;46m',
|
|
37
|
-
'\x1b[97;46m'
|
|
38
|
-
],
|
|
39
|
-
// Magenta background, black and white text respectively
|
|
40
|
-
mutation: [
|
|
41
|
-
'\x1b[30;45m',
|
|
42
|
-
'\x1b[97;45m'
|
|
43
|
-
],
|
|
44
|
-
// Green background, black and white text respectively
|
|
45
|
-
subscription: [
|
|
46
|
-
'\x1b[30;42m',
|
|
47
|
-
'\x1b[97;42m'
|
|
48
|
-
]
|
|
49
|
-
},
|
|
50
|
-
bold: {
|
|
51
|
-
query: [
|
|
52
|
-
'\x1b[1;30;46m',
|
|
53
|
-
'\x1b[1;97;46m'
|
|
54
|
-
],
|
|
55
|
-
mutation: [
|
|
56
|
-
'\x1b[1;30;45m',
|
|
57
|
-
'\x1b[1;97;45m'
|
|
58
|
-
],
|
|
59
|
-
subscription: [
|
|
60
|
-
'\x1b[1;30;42m',
|
|
61
|
-
'\x1b[1;97;42m'
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
function constructPartsAndArgs(opts) {
|
|
67
|
-
const { direction, type, withContext, path, id, input } = opts;
|
|
68
|
-
const parts = [];
|
|
69
|
-
const args = [];
|
|
70
|
-
if (opts.colorMode === 'none') {
|
|
71
|
-
parts.push(direction === 'up' ? '>>' : '<<', type, `#${id}`, path);
|
|
72
|
-
} else if (opts.colorMode === 'ansi') {
|
|
73
|
-
const [lightRegular, darkRegular] = palettes.ansi.regular[type];
|
|
74
|
-
const [lightBold, darkBold] = palettes.ansi.bold[type];
|
|
75
|
-
const reset = '\x1b[0m';
|
|
76
|
-
parts.push(direction === 'up' ? lightRegular : darkRegular, direction === 'up' ? '>>' : '<<', type, direction === 'up' ? lightBold : darkBold, `#${id}`, path, reset);
|
|
77
|
-
} else {
|
|
78
|
-
// css color mode
|
|
79
|
-
const [light, dark] = palettes.css[type];
|
|
80
|
-
const css = `
|
|
81
|
-
background-color: #${direction === 'up' ? light : dark};
|
|
82
|
-
color: ${direction === 'up' ? 'black' : 'white'};
|
|
83
|
-
padding: 2px;
|
|
84
|
-
`;
|
|
85
|
-
parts.push('%c', direction === 'up' ? '>>' : '<<', type, `#${id}`, `%c${path}%c`, '%O');
|
|
86
|
-
args.push(css, `${css}; font-weight: bold;`, `${css}; font-weight: normal;`);
|
|
87
|
-
}
|
|
88
|
-
if (direction === 'up') {
|
|
89
|
-
args.push(withContext ? {
|
|
90
|
-
input,
|
|
91
|
-
context: opts.context
|
|
92
|
-
} : {
|
|
93
|
-
input
|
|
94
|
-
});
|
|
95
|
-
} else {
|
|
96
|
-
args.push({
|
|
97
|
-
input,
|
|
98
|
-
result: opts.result,
|
|
99
|
-
elapsedMs: opts.elapsedMs,
|
|
100
|
-
...withContext && {
|
|
101
|
-
context: opts.context
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
return {
|
|
106
|
-
parts,
|
|
107
|
-
args
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
// maybe this should be moved to it's own package
|
|
111
|
-
const defaultLogger = ({ c = console, colorMode = 'css', withContext })=>(props)=>{
|
|
112
|
-
const rawInput = props.input;
|
|
113
|
-
const input = isFormData(rawInput) ? Object.fromEntries(rawInput) : rawInput;
|
|
114
|
-
const { parts, args } = constructPartsAndArgs({
|
|
115
|
-
...props,
|
|
116
|
-
colorMode,
|
|
117
|
-
input,
|
|
118
|
-
withContext
|
|
119
|
-
});
|
|
120
|
-
const fn = props.direction === 'down' && props.result && (props.result instanceof Error || 'error' in props.result.result && props.result.result.error) ? 'error' : 'log';
|
|
121
|
-
c[fn].apply(null, [
|
|
122
|
-
parts.join(' ')
|
|
123
|
-
].concat(args));
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* @see https://trpc.io/docs/v11/client/links/loggerLink
|
|
127
|
-
*/ function loggerLink(opts = {}) {
|
|
128
|
-
const { enabled = ()=>true } = opts;
|
|
129
|
-
const colorMode = opts.colorMode ?? (typeof window === 'undefined' ? 'ansi' : 'css');
|
|
130
|
-
const withContext = opts.withContext ?? colorMode === 'css';
|
|
131
|
-
const { logger = defaultLogger({
|
|
132
|
-
c: opts.console,
|
|
133
|
-
colorMode,
|
|
134
|
-
withContext
|
|
135
|
-
}) } = opts;
|
|
136
|
-
return ()=>{
|
|
137
|
-
return ({ op, next })=>{
|
|
138
|
-
return observable.observable((observer)=>{
|
|
139
|
-
// ->
|
|
140
|
-
if (enabled({
|
|
141
|
-
...op,
|
|
142
|
-
direction: 'up'
|
|
143
|
-
})) {
|
|
144
|
-
logger({
|
|
145
|
-
...op,
|
|
146
|
-
direction: 'up'
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
const requestStartTime = Date.now();
|
|
150
|
-
function logResult(result) {
|
|
151
|
-
const elapsedMs = Date.now() - requestStartTime;
|
|
152
|
-
if (enabled({
|
|
153
|
-
...op,
|
|
154
|
-
direction: 'down',
|
|
155
|
-
result
|
|
156
|
-
})) {
|
|
157
|
-
logger({
|
|
158
|
-
...op,
|
|
159
|
-
direction: 'down',
|
|
160
|
-
elapsedMs,
|
|
161
|
-
result
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return next(op).pipe(observable.tap({
|
|
166
|
-
next (result) {
|
|
167
|
-
logResult(result);
|
|
168
|
-
},
|
|
169
|
-
error (result) {
|
|
170
|
-
logResult(result);
|
|
171
|
-
}
|
|
172
|
-
})).subscribe(observer);
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
exports.loggerLink = loggerLink;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { InferrableClientTypes } from '@trpc/server/unstable-core-do-not-import';
|
|
2
|
-
import type { TRPCClientError } from '../TRPCClientError';
|
|
3
|
-
import type { Operation, TRPCLink } from './types';
|
|
4
|
-
interface RetryLinkOptions<TInferrable extends InferrableClientTypes> {
|
|
5
|
-
/**
|
|
6
|
-
* The retry function
|
|
7
|
-
*/
|
|
8
|
-
retry: (opts: RetryFnOptions<TInferrable>) => boolean;
|
|
9
|
-
/**
|
|
10
|
-
* The delay between retries in ms (defaults to 0)
|
|
11
|
-
*/
|
|
12
|
-
retryDelayMs?: (attempt: number) => number;
|
|
13
|
-
}
|
|
14
|
-
interface RetryFnOptions<TInferrable extends InferrableClientTypes> {
|
|
15
|
-
/**
|
|
16
|
-
* The operation that failed
|
|
17
|
-
*/
|
|
18
|
-
op: Operation;
|
|
19
|
-
/**
|
|
20
|
-
* The error that occurred
|
|
21
|
-
*/
|
|
22
|
-
error: TRPCClientError<TInferrable>;
|
|
23
|
-
/**
|
|
24
|
-
* The number of attempts that have been made (including the first call)
|
|
25
|
-
*/
|
|
26
|
-
attempts: number;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* @see https://trpc.io/docs/v11/client/links/retryLink
|
|
30
|
-
*/
|
|
31
|
-
export declare function retryLink<TInferrable extends InferrableClientTypes>(opts: RetryLinkOptions<TInferrable>): TRPCLink<TInferrable>;
|
|
32
|
-
export {};
|
|
33
|
-
//# sourceMappingURL=retryLink.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retryLink.d.ts","sourceRoot":"","sources":["../../src/links/retryLink.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEtF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnD,UAAU,gBAAgB,CAAC,WAAW,SAAS,qBAAqB;IAClE;;OAEG;IACH,KAAK,EAAE,CAAC,IAAI,EAAE,cAAc,CAAC,WAAW,CAAC,KAAK,OAAO,CAAC;IACtD;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C;AAED,UAAU,cAAc,CAAC,WAAW,SAAS,qBAAqB;IAChE;;OAEG;IACH,EAAE,EAAE,SAAS,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IACpC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,WAAW,SAAS,qBAAqB,EACjE,IAAI,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAClC,QAAQ,CAAC,WAAW,CAAC,CA4EvB"}
|
package/dist/links/retryLink.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var observable = require('@trpc/server/observable');
|
|
4
|
-
var inputWithTrackedEventId = require('../internals/inputWithTrackedEventId.js');
|
|
5
|
-
|
|
6
|
-
/* istanbul ignore file -- @preserve */ // We're not actually exporting this link
|
|
7
|
-
/**
|
|
8
|
-
* @see https://trpc.io/docs/v11/client/links/retryLink
|
|
9
|
-
*/ function retryLink(opts) {
|
|
10
|
-
// initialized config
|
|
11
|
-
return ()=>{
|
|
12
|
-
// initialized in app
|
|
13
|
-
return (callOpts)=>{
|
|
14
|
-
// initialized for request
|
|
15
|
-
return observable.observable((observer)=>{
|
|
16
|
-
let next$;
|
|
17
|
-
let callNextTimeout = undefined;
|
|
18
|
-
let lastEventId = undefined;
|
|
19
|
-
attempt(1);
|
|
20
|
-
function opWithLastEventId() {
|
|
21
|
-
const op = callOpts.op;
|
|
22
|
-
if (!lastEventId) {
|
|
23
|
-
return op;
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
26
|
-
...op,
|
|
27
|
-
input: inputWithTrackedEventId.inputWithTrackedEventId(op.input, lastEventId)
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function attempt(attempts) {
|
|
31
|
-
const op = opWithLastEventId();
|
|
32
|
-
next$ = callOpts.next(op).subscribe({
|
|
33
|
-
error (error) {
|
|
34
|
-
const shouldRetry = opts.retry({
|
|
35
|
-
op,
|
|
36
|
-
attempts,
|
|
37
|
-
error
|
|
38
|
-
});
|
|
39
|
-
if (!shouldRetry) {
|
|
40
|
-
observer.error(error);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const delayMs = opts.retryDelayMs?.(attempts) ?? 0;
|
|
44
|
-
if (delayMs <= 0) {
|
|
45
|
-
attempt(attempts + 1);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
callNextTimeout = setTimeout(()=>attempt(attempts + 1), delayMs);
|
|
49
|
-
},
|
|
50
|
-
next (envelope) {
|
|
51
|
-
//
|
|
52
|
-
if ((!envelope.result.type || envelope.result.type === 'data') && envelope.result.id) {
|
|
53
|
-
//
|
|
54
|
-
lastEventId = envelope.result.id;
|
|
55
|
-
}
|
|
56
|
-
observer.next(envelope);
|
|
57
|
-
},
|
|
58
|
-
complete () {
|
|
59
|
-
observer.complete();
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
return ()=>{
|
|
64
|
-
next$.unsubscribe();
|
|
65
|
-
clearTimeout(callNextTimeout);
|
|
66
|
-
};
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
exports.retryLink = retryLink;
|
package/dist/links/retryLink.mjs
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { observable } from '@trpc/server/observable';
|
|
2
|
-
import { inputWithTrackedEventId } from '../internals/inputWithTrackedEventId.mjs';
|
|
3
|
-
|
|
4
|
-
/* istanbul ignore file -- @preserve */ // We're not actually exporting this link
|
|
5
|
-
/**
|
|
6
|
-
* @see https://trpc.io/docs/v11/client/links/retryLink
|
|
7
|
-
*/ function retryLink(opts) {
|
|
8
|
-
// initialized config
|
|
9
|
-
return ()=>{
|
|
10
|
-
// initialized in app
|
|
11
|
-
return (callOpts)=>{
|
|
12
|
-
// initialized for request
|
|
13
|
-
return observable((observer)=>{
|
|
14
|
-
let next$;
|
|
15
|
-
let callNextTimeout = undefined;
|
|
16
|
-
let lastEventId = undefined;
|
|
17
|
-
attempt(1);
|
|
18
|
-
function opWithLastEventId() {
|
|
19
|
-
const op = callOpts.op;
|
|
20
|
-
if (!lastEventId) {
|
|
21
|
-
return op;
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
...op,
|
|
25
|
-
input: inputWithTrackedEventId(op.input, lastEventId)
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function attempt(attempts) {
|
|
29
|
-
const op = opWithLastEventId();
|
|
30
|
-
next$ = callOpts.next(op).subscribe({
|
|
31
|
-
error (error) {
|
|
32
|
-
const shouldRetry = opts.retry({
|
|
33
|
-
op,
|
|
34
|
-
attempts,
|
|
35
|
-
error
|
|
36
|
-
});
|
|
37
|
-
if (!shouldRetry) {
|
|
38
|
-
observer.error(error);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const delayMs = opts.retryDelayMs?.(attempts) ?? 0;
|
|
42
|
-
if (delayMs <= 0) {
|
|
43
|
-
attempt(attempts + 1);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
callNextTimeout = setTimeout(()=>attempt(attempts + 1), delayMs);
|
|
47
|
-
},
|
|
48
|
-
next (envelope) {
|
|
49
|
-
//
|
|
50
|
-
if ((!envelope.result.type || envelope.result.type === 'data') && envelope.result.id) {
|
|
51
|
-
//
|
|
52
|
-
lastEventId = envelope.result.id;
|
|
53
|
-
}
|
|
54
|
-
observer.next(envelope);
|
|
55
|
-
},
|
|
56
|
-
complete () {
|
|
57
|
-
observer.complete();
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
return ()=>{
|
|
62
|
-
next$.unsubscribe();
|
|
63
|
-
clearTimeout(callNextTimeout);
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { retryLink };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { AnyRouter } from '@trpc/server/unstable-core-do-not-import';
|
|
2
|
-
import type { Operation, TRPCLink } from './types';
|
|
3
|
-
export declare function splitLink<TRouter extends AnyRouter = AnyRouter>(opts: {
|
|
4
|
-
condition: (op: Operation) => boolean;
|
|
5
|
-
/**
|
|
6
|
-
* The link to execute next if the test function returns `true`.
|
|
7
|
-
*/
|
|
8
|
-
true: TRPCLink<TRouter> | TRPCLink<TRouter>[];
|
|
9
|
-
/**
|
|
10
|
-
* The link to execute next if the test function returns `false`.
|
|
11
|
-
*/
|
|
12
|
-
false: TRPCLink<TRouter> | TRPCLink<TRouter>[];
|
|
13
|
-
}): TRPCLink<TRouter>;
|
|
14
|
-
//# sourceMappingURL=splitLink.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"splitLink.d.ts","sourceRoot":"","sources":["../../src/links/splitLink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAKnD,wBAAgB,SAAS,CAAC,OAAO,SAAS,SAAS,GAAG,SAAS,EAAE,IAAI,EAAE;IACrE,SAAS,EAAE,CAAC,EAAE,EAAE,SAAS,KAAK,OAAO,CAAC;IACtC;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9C;;OAEG;IACH,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;CAChD,GAAG,QAAQ,CAAC,OAAO,CAAC,CAWpB"}
|
package/dist/links/splitLink.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var observable = require('@trpc/server/observable');
|
|
4
|
-
var createChain = require('./internals/createChain.js');
|
|
5
|
-
|
|
6
|
-
function asArray(value) {
|
|
7
|
-
return Array.isArray(value) ? value : [
|
|
8
|
-
value
|
|
9
|
-
];
|
|
10
|
-
}
|
|
11
|
-
function splitLink(opts) {
|
|
12
|
-
return (runtime)=>{
|
|
13
|
-
const yes = asArray(opts.true).map((link)=>link(runtime));
|
|
14
|
-
const no = asArray(opts.false).map((link)=>link(runtime));
|
|
15
|
-
return (props)=>{
|
|
16
|
-
return observable.observable((observer)=>{
|
|
17
|
-
const links = opts.condition(props.op) ? yes : no;
|
|
18
|
-
return createChain.createChain({
|
|
19
|
-
op: props.op,
|
|
20
|
-
links
|
|
21
|
-
}).subscribe(observer);
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
exports.splitLink = splitLink;
|
package/dist/links/types.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { Observable, Observer } from '@trpc/server/observable';
|
|
2
|
-
import type { InferrableClientTypes, Maybe, TRPCResultMessage, TRPCSuccessResponse } from '@trpc/server/unstable-core-do-not-import';
|
|
3
|
-
import type { ResponseEsque } from '../internals/types';
|
|
4
|
-
import type { TRPCClientError } from '../TRPCClientError';
|
|
5
|
-
import type { TRPCConnectionState } from './internals/subscriptions';
|
|
6
|
-
export { isNonJsonSerializable, isFormData, isOctetType, } from './internals/contentTypes';
|
|
7
|
-
/**
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export interface OperationContext extends Record<string, unknown> {
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
export type Operation<TInput = unknown> = {
|
|
16
|
-
id: number;
|
|
17
|
-
type: 'mutation' | 'query' | 'subscription';
|
|
18
|
-
input: TInput;
|
|
19
|
-
path: string;
|
|
20
|
-
context: OperationContext;
|
|
21
|
-
signal: Maybe<AbortSignal>;
|
|
22
|
-
};
|
|
23
|
-
interface HeadersInitEsque {
|
|
24
|
-
[Symbol.iterator](): IterableIterator<[string, string]>;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
29
|
-
export type HTTPHeaders = HeadersInitEsque | Record<string, string[] | string | undefined>;
|
|
30
|
-
/**
|
|
31
|
-
* The default `fetch` implementation has an overloaded signature. By convention this library
|
|
32
|
-
* only uses the overload taking a string and options object.
|
|
33
|
-
*/
|
|
34
|
-
export type TRPCFetch = (url: string, options?: RequestInit) => Promise<ResponseEsque>;
|
|
35
|
-
export interface TRPCClientRuntime {
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @internal
|
|
39
|
-
*/
|
|
40
|
-
export interface OperationResultEnvelope<TOutput, TError> {
|
|
41
|
-
result: TRPCResultMessage<TOutput>['result'] | TRPCSuccessResponse<TOutput>['result'] | TRPCConnectionState<TError>;
|
|
42
|
-
context?: OperationContext;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
export type OperationResultObservable<TInferrable extends InferrableClientTypes, TOutput> = Observable<OperationResultEnvelope<TOutput, TRPCClientError<TInferrable>>, TRPCClientError<TInferrable>>;
|
|
48
|
-
/**
|
|
49
|
-
* @internal
|
|
50
|
-
*/
|
|
51
|
-
export type OperationResultObserver<TInferrable extends InferrableClientTypes, TOutput> = Observer<OperationResultEnvelope<TOutput, TRPCClientError<TInferrable>>, TRPCClientError<TInferrable>>;
|
|
52
|
-
/**
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
export type OperationLink<TInferrable extends InferrableClientTypes, TInput = unknown, TOutput = unknown> = (opts: {
|
|
56
|
-
op: Operation<TInput>;
|
|
57
|
-
next: (op: Operation<TInput>) => OperationResultObservable<TInferrable, TOutput>;
|
|
58
|
-
}) => OperationResultObservable<TInferrable, TOutput>;
|
|
59
|
-
/**
|
|
60
|
-
* @public
|
|
61
|
-
*/
|
|
62
|
-
export type TRPCLink<TInferrable extends InferrableClientTypes> = (opts: TRPCClientRuntime) => OperationLink<TInferrable>;
|
|
63
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.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wsClient/options';
|
|
2
|
-
import { WsClient } from './wsClient/wsClient';
|
|
3
|
-
export declare function createWSClient(opts: WebSocketClientOptions): WsClient;
|
|
4
|
-
export type TRPCWebSocketClient = ReturnType<typeof createWSClient>;
|
|
5
|
-
export { WebSocketClientOptions };
|
|
6
|
-
//# sourceMappingURL=createWsClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createWsClient.d.ts","sourceRoot":"","sources":["../../../src/links/wsLink/createWsClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,wBAAgB,cAAc,CAAC,IAAI,EAAE,sBAAsB,YAE1D;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAEpE,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import type { UrlOptionsWithConnectionParams } from '../../internals/urlWithConnectionParams';
|
|
2
|
-
export interface WebSocketClientOptions extends UrlOptionsWithConnectionParams {
|
|
3
|
-
/**
|
|
4
|
-
* Ponyfill which WebSocket implementation to use
|
|
5
|
-
*/
|
|
6
|
-
WebSocket?: typeof WebSocket;
|
|
7
|
-
/**
|
|
8
|
-
* The number of milliseconds before a reconnect is attempted.
|
|
9
|
-
* @default {@link exponentialBackoff}
|
|
10
|
-
*/
|
|
11
|
-
retryDelayMs?: (attemptIndex: number) => number;
|
|
12
|
-
/**
|
|
13
|
-
* Triggered when a WebSocket connection is established
|
|
14
|
-
*/
|
|
15
|
-
onOpen?: () => void;
|
|
16
|
-
/**
|
|
17
|
-
* Triggered when a WebSocket connection encounters an error
|
|
18
|
-
*/
|
|
19
|
-
onError?: (evt?: Event) => void;
|
|
20
|
-
/**
|
|
21
|
-
* Triggered when a WebSocket connection is closed
|
|
22
|
-
*/
|
|
23
|
-
onClose?: (cause?: {
|
|
24
|
-
code?: number;
|
|
25
|
-
}) => void;
|
|
26
|
-
/**
|
|
27
|
-
* Lazy mode will close the WebSocket automatically after a period of inactivity (no messages sent or received and no pending requests)
|
|
28
|
-
*/
|
|
29
|
-
lazy?: {
|
|
30
|
-
/**
|
|
31
|
-
* Enable lazy mode
|
|
32
|
-
* @default false
|
|
33
|
-
*/
|
|
34
|
-
enabled: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Close the WebSocket after this many milliseconds
|
|
37
|
-
* @default 0
|
|
38
|
-
*/
|
|
39
|
-
closeMs: number;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Send ping messages to the server and kill the connection if no pong message is returned
|
|
43
|
-
*/
|
|
44
|
-
keepAlive?: {
|
|
45
|
-
/**
|
|
46
|
-
* @default false
|
|
47
|
-
*/
|
|
48
|
-
enabled: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Send a ping message every this many milliseconds
|
|
51
|
-
* @default 5_000
|
|
52
|
-
*/
|
|
53
|
-
intervalMs?: number;
|
|
54
|
-
/**
|
|
55
|
-
* Close the WebSocket after this many milliseconds if the server does not respond
|
|
56
|
-
* @default 1_000
|
|
57
|
-
*/
|
|
58
|
-
pongTimeoutMs?: number;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Default options for lazy WebSocket connections.
|
|
63
|
-
* Determines whether the connection should be established lazily and defines the delay before closure.
|
|
64
|
-
*/
|
|
65
|
-
export type LazyOptions = Required<NonNullable<WebSocketClientOptions['lazy']>>;
|
|
66
|
-
export declare const lazyDefaults: LazyOptions;
|
|
67
|
-
/**
|
|
68
|
-
* Default options for the WebSocket keep-alive mechanism.
|
|
69
|
-
* Configures whether keep-alive is enabled and specifies the timeout and interval for ping-pong messages.
|
|
70
|
-
*/
|
|
71
|
-
export type KeepAliveOptions = Required<NonNullable<WebSocketClientOptions['keepAlive']>>;
|
|
72
|
-
export declare const keepAliveDefaults: KeepAliveOptions;
|
|
73
|
-
/**
|
|
74
|
-
* Calculates a delay for exponential backoff based on the retry attempt index.
|
|
75
|
-
* The delay starts at 0 for the first attempt and doubles for each subsequent attempt,
|
|
76
|
-
* capped at 30 seconds.
|
|
77
|
-
*/
|
|
78
|
-
export declare const exponentialBackoff: (attemptIndex: number) => number;
|
|
79
|
-
//# sourceMappingURL=options.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../src/links/wsLink/wsClient/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AAE9F,MAAM,WAAW,sBAAuB,SAAQ,8BAA8B;IAC5E;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,SAAS,CAAC;IAC7B;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC9C;;OAEG;IACH,IAAI,CAAC,EAAE;QACL;;;WAGG;QACH,OAAO,EAAE,OAAO,CAAC;QACjB;;;WAGG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF;;OAEG;IACH,SAAS,CAAC,EAAE;QACV;;WAEG;QACH,OAAO,EAAE,OAAO,CAAC;QACjB;;;WAGG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB;;;WAGG;QACH,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,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