@trpc/client 10.32.0 → 10.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/TRPCClientError.d.ts +1 -1
- package/dist/TRPCClientError.d.ts.map +1 -1
- package/dist/createTRPCClient.d.ts +1 -1
- package/dist/createTRPCClient.d.ts.map +1 -1
- package/dist/createTRPCClientProxy.d.ts +1 -1
- package/dist/createTRPCClientProxy.d.ts.map +1 -1
- package/dist/getFetch.d.ts.map +1 -1
- package/dist/{httpBatchLink-38dcf5f2.js → httpBatchLink-76c6f2d4.js} +9 -6
- package/dist/{httpBatchLink-e66c0674.mjs → httpBatchLink-c184c799.mjs} +9 -6
- package/dist/{httpBatchLink-f35df745.js → httpBatchLink-c64f6cdb.js} +9 -6
- package/dist/{httpUtils-145e783b.js → httpUtils-a0ac1597.js} +15 -18
- package/dist/{httpUtils-b2fcc20c.mjs → httpUtils-a9242d4e.mjs} +15 -18
- package/dist/{httpUtils-21cbb35d.js → httpUtils-fa0d6f71.js} +15 -18
- package/dist/index.js +5 -3
- package/dist/index.mjs +7 -5
- package/dist/internals/TRPCUntypedClient.d.ts +2 -2
- package/dist/internals/TRPCUntypedClient.d.ts.map +1 -1
- package/dist/internals/dataLoader.d.ts.map +1 -1
- package/dist/internals/types.d.ts +4 -6
- package/dist/internals/types.d.ts.map +1 -1
- package/dist/links/httpBatchLink.js +2 -2
- package/dist/links/httpBatchLink.mjs +2 -2
- package/dist/links/httpBatchStreamLink.d.ts.map +1 -1
- package/dist/links/httpLink.d.ts.map +1 -1
- package/dist/links/httpLink.js +4 -2
- package/dist/links/httpLink.mjs +4 -2
- package/dist/links/internals/createHTTPBatchLink.d.ts.map +1 -1
- package/dist/links/internals/httpUtils.d.ts +5 -5
- package/dist/links/internals/httpUtils.d.ts.map +1 -1
- package/dist/links/internals/parseJSONStream.d.ts +1 -1
- package/dist/links/internals/parseJSONStream.d.ts.map +1 -1
- package/dist/links/loggerLink.d.ts +14 -9
- package/dist/links/loggerLink.d.ts.map +1 -1
- package/dist/links/loggerLink.js +109 -46
- package/dist/links/loggerLink.mjs +109 -46
- package/dist/links/types.d.ts +3 -3
- package/dist/links/types.d.ts.map +1 -1
- package/dist/links/wsLink.js +1 -1
- package/dist/links/wsLink.mjs +1 -1
- package/dist/shared/transformResult.d.ts +2 -2
- package/dist/shared/transformResult.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/TRPCClientError.ts +1 -1
- package/src/createTRPCClient.ts +2 -2
- package/src/createTRPCClientProxy.ts +7 -7
- package/src/getFetch.ts +2 -7
- package/src/internals/TRPCUntypedClient.ts +10 -8
- package/src/internals/dataLoader.ts +1 -2
- package/src/internals/types.ts +4 -6
- package/src/links/httpBatchStreamLink.ts +3 -1
- package/src/links/httpLink.ts +3 -1
- package/src/links/internals/createHTTPBatchLink.ts +7 -3
- package/src/links/internals/httpUtils.ts +19 -18
- package/src/links/internals/parseJSONStream.ts +2 -2
- package/src/links/loggerLink.ts +124 -51
- package/src/links/types.ts +4 -4
- package/src/links/wsLink.ts +2 -2
- package/src/shared/transformResult.ts +4 -4
|
@@ -19,7 +19,7 @@ export interface HTTPLinkBaseOptions {
|
|
|
19
19
|
}
|
|
20
20
|
export interface ResolvedHTTPLinkOptions {
|
|
21
21
|
url: string;
|
|
22
|
-
fetch
|
|
22
|
+
fetch?: FetchEsque;
|
|
23
23
|
AbortController: AbortControllerEsque | null;
|
|
24
24
|
}
|
|
25
25
|
export declare function resolveHTTPLinkOptions(opts: HTTPLinkBaseOptions): ResolvedHTTPLinkOptions;
|
|
@@ -32,11 +32,11 @@ export interface HTTPResult {
|
|
|
32
32
|
type GetInputOptions = {
|
|
33
33
|
runtime: TRPCClientRuntime;
|
|
34
34
|
} & ({
|
|
35
|
-
inputs: unknown[];
|
|
36
|
-
} | {
|
|
37
35
|
input: unknown;
|
|
36
|
+
} | {
|
|
37
|
+
inputs: unknown[];
|
|
38
38
|
});
|
|
39
|
-
export type HTTPBaseRequestOptions =
|
|
39
|
+
export type HTTPBaseRequestOptions = GetInputOptions & ResolvedHTTPLinkOptions & {
|
|
40
40
|
type: ProcedureType;
|
|
41
41
|
path: string;
|
|
42
42
|
};
|
|
@@ -54,7 +54,7 @@ export type Requester = (opts: HTTPBaseRequestOptions & {
|
|
|
54
54
|
headers: () => HTTPHeaders | Promise<HTTPHeaders>;
|
|
55
55
|
}) => PromiseAndCancel<HTTPResult>;
|
|
56
56
|
export declare const jsonHttpRequester: Requester;
|
|
57
|
-
export type HTTPRequestOptions =
|
|
57
|
+
export type HTTPRequestOptions = ContentOptions & HTTPBaseRequestOptions & {
|
|
58
58
|
headers: () => HTTPHeaders | Promise<HTTPHeaders>;
|
|
59
59
|
TextDecoder?: TextDecoderEsque;
|
|
60
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpUtils.d.ts","sourceRoot":"","sources":["../../../src/links/internals/httpUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,UAAU,EACV,gBAAgB,EAChB,aAAa,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;OAEG;IACH,eAAe,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CAC/C;AAED,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"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,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,sBAAsB,KAAK,MAAM,CAAC;AAC9D,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,sBAAsB,KACzB,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAE9B,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,MAgBpB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,OAMrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,CACtB,IAAI,EAAE,sBAAsB,GAAG;IAC7B,OAAO,EAAE,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CACnD,KACE,gBAAgB,CAAC,UAAU,CAAC,CAAC;AAElC,eAAO,MAAM,iBAAiB,EAAE,SAO/B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAC7C,sBAAsB,GAAG;IACvB,OAAO,EAAE,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAClD,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC,CAAC;AAEJ,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,kBAAkB,EACxB,EAAE,CAAC,EAAE,4BAA4B,GAAG,IAAI,0BA0BzC;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,kBAAkB,GACvB,gBAAgB,CAAC,UAAU,CAAC,CAsB9B"}
|
|
@@ -18,7 +18,7 @@ export declare function parseJSONStream<TReturn>(opts: {
|
|
|
18
18
|
/**
|
|
19
19
|
* As given by `(await fetch(url)).body`
|
|
20
20
|
*/
|
|
21
|
-
readableStream:
|
|
21
|
+
readableStream: NodeJS.ReadableStream | WebReadableStreamEsque;
|
|
22
22
|
/**
|
|
23
23
|
* Called for each line of the stream
|
|
24
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseJSONStream.d.ts","sourceRoot":"","sources":["../../../src/links/internals/parseJSONStream.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAIL,sBAAsB,EACtB,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,IAAI,EAAE;IACnD;;OAEG;IACH,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"parseJSONStream.d.ts","sourceRoot":"","sources":["../../../src/links/internals/parseJSONStream.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAIL,sBAAsB,EACtB,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,IAAI,EAAE;IACnD;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC,cAAc,GAAG,sBAAsB,CAAC;IAC/D;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,WAAW,EAAE,gBAAgB,CAAC;CAC/B,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBhB;AAwED,eAAO,MAAM,0BAA0B,SAC/B,sBAAsB,GAAG;IAC7B,OAAO,EAAE,MAAM,WAAW,GAAG,QAAQ,WAAW,CAAC,CAAC;IAClD,WAAW,EAAE,gBAAgB,CAAC;CAC/B,oBACiB,MAAM,OAAO,UAAU,KAAK,IAAI;;;CA8BnD,CAAC"}
|
|
@@ -6,25 +6,25 @@ type ConsoleEsque = {
|
|
|
6
6
|
log: (...args: any[]) => void;
|
|
7
7
|
error: (...args: any[]) => void;
|
|
8
8
|
};
|
|
9
|
-
type EnableFnOptions<TRouter extends AnyRouter> =
|
|
10
|
-
direction: 'up';
|
|
11
|
-
}) | {
|
|
9
|
+
type EnableFnOptions<TRouter extends AnyRouter> = {
|
|
12
10
|
direction: 'down';
|
|
13
11
|
result: OperationResultEnvelope<unknown> | TRPCClientError<TRouter>;
|
|
14
|
-
}
|
|
12
|
+
} | (Operation & {
|
|
13
|
+
direction: 'up';
|
|
14
|
+
});
|
|
15
15
|
type EnabledFn<TRouter extends AnyRouter> = (opts: EnableFnOptions<TRouter>) => boolean;
|
|
16
16
|
type LoggerLinkFnOptions<TRouter extends AnyRouter> = Operation & ({
|
|
17
|
-
/**
|
|
18
|
-
* Request was just initialized
|
|
19
|
-
*/
|
|
20
|
-
direction: 'up';
|
|
21
|
-
} | {
|
|
22
17
|
/**
|
|
23
18
|
* Request result
|
|
24
19
|
*/
|
|
25
20
|
direction: 'down';
|
|
26
21
|
result: OperationResultEnvelope<unknown> | TRPCClientError<TRouter>;
|
|
27
22
|
elapsedMs: number;
|
|
23
|
+
} | {
|
|
24
|
+
/**
|
|
25
|
+
* Request was just initialized
|
|
26
|
+
*/
|
|
27
|
+
direction: 'up';
|
|
28
28
|
});
|
|
29
29
|
type LoggerLinkFn<TRouter extends AnyRouter> = (opts: LoggerLinkFnOptions<TRouter>) => void;
|
|
30
30
|
export interface LoggerLinkOptions<TRouter extends AnyRouter> {
|
|
@@ -34,6 +34,11 @@ export interface LoggerLinkOptions<TRouter extends AnyRouter> {
|
|
|
34
34
|
* Used in the built-in defaultLogger
|
|
35
35
|
*/
|
|
36
36
|
console?: ConsoleEsque;
|
|
37
|
+
/**
|
|
38
|
+
* Color mode
|
|
39
|
+
* @default typeof window === 'undefined' ? 'ansi' : 'css'
|
|
40
|
+
*/
|
|
41
|
+
colorMode?: 'ansi' | 'css';
|
|
37
42
|
}
|
|
38
43
|
export declare function loggerLink<TRouter extends AnyRouter = AnyRouter>(opts?: LoggerLinkOptions<TRouter>): TRPCLink<TRouter>;
|
|
39
44
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loggerLink.d.ts","sourceRoot":"","sources":["../../src/links/loggerLink.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEvE,KAAK,YAAY,GAAG;IAClB,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAC9B,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;CACjC,CAAC;AAEF,KAAK,eAAe,CAAC,OAAO,SAAS,SAAS,IAC1C
|
|
1
|
+
{"version":3,"file":"loggerLink.d.ts","sourceRoot":"","sources":["../../src/links/loggerLink.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEvE,KAAK,YAAY,GAAG;IAClB,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;IAC9B,KAAK,EAAE,CAAC,GAAG,IAAI,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ggerLink.js
CHANGED
|
@@ -5,20 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var observable = require('@trpc/server/observable');
|
|
6
6
|
|
|
7
7
|
/// <reference lib="dom.iterable" />
|
|
8
|
-
const palette = {
|
|
9
|
-
query: [
|
|
10
|
-
'72e3ff',
|
|
11
|
-
'3fb0d8'
|
|
12
|
-
],
|
|
13
|
-
mutation: [
|
|
14
|
-
'c5a3fc',
|
|
15
|
-
'904dfc'
|
|
16
|
-
],
|
|
17
|
-
subscription: [
|
|
18
|
-
'ff49e1',
|
|
19
|
-
'd83fbe'
|
|
20
|
-
]
|
|
21
|
-
};
|
|
22
8
|
function isFormData(value) {
|
|
23
9
|
if (typeof FormData === 'undefined') {
|
|
24
10
|
// FormData is not supported
|
|
@@ -26,43 +12,116 @@ function isFormData(value) {
|
|
|
26
12
|
}
|
|
27
13
|
return value instanceof FormData;
|
|
28
14
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
'
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
15
|
+
const palettes = {
|
|
16
|
+
css: {
|
|
17
|
+
query: [
|
|
18
|
+
'72e3ff',
|
|
19
|
+
'3fb0d8'
|
|
20
|
+
],
|
|
21
|
+
mutation: [
|
|
22
|
+
'c5a3fc',
|
|
23
|
+
'904dfc'
|
|
24
|
+
],
|
|
25
|
+
subscription: [
|
|
26
|
+
'ff49e1',
|
|
27
|
+
'd83fbe'
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
ansi: {
|
|
31
|
+
regular: {
|
|
32
|
+
// Cyan background, black and white text respectively
|
|
33
|
+
query: [
|
|
34
|
+
'\x1b[30;46m',
|
|
35
|
+
'\x1b[97;46m'
|
|
36
|
+
],
|
|
37
|
+
// Magenta background, black and white text respectively
|
|
38
|
+
mutation: [
|
|
39
|
+
'\x1b[30;45m',
|
|
40
|
+
'\x1b[97;45m'
|
|
41
|
+
],
|
|
42
|
+
// Green background, black and white text respectively
|
|
43
|
+
subscription: [
|
|
44
|
+
'\x1b[30;42m',
|
|
45
|
+
'\x1b[97;42m'
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
bold: {
|
|
49
|
+
query: [
|
|
50
|
+
'\x1b[1;30;46m',
|
|
51
|
+
'\x1b[1;97;46m'
|
|
52
|
+
],
|
|
53
|
+
mutation: [
|
|
54
|
+
'\x1b[1;30;45m',
|
|
55
|
+
'\x1b[1;97;45m'
|
|
56
|
+
],
|
|
57
|
+
subscription: [
|
|
58
|
+
'\x1b[1;30;42m',
|
|
59
|
+
'\x1b[1;97;42m'
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
function constructPartsAndArgs(opts) {
|
|
65
|
+
const { direction , type , path , id , input } = opts;
|
|
66
|
+
const parts = [];
|
|
67
|
+
const args = [];
|
|
68
|
+
if (opts.colorMode === 'ansi') {
|
|
69
|
+
const [lightRegular, darkRegular] = palettes.ansi.regular[type];
|
|
70
|
+
const [lightBold, darkBold] = palettes.ansi.bold[type];
|
|
71
|
+
const reset = '\x1b[0m';
|
|
72
|
+
parts.push(direction === 'up' ? lightRegular : darkRegular, direction === 'up' ? '>>' : '<<', type, direction === 'up' ? lightBold : darkBold, `#${id}`, path, reset);
|
|
73
|
+
if (direction === 'up') {
|
|
54
74
|
args.push({
|
|
55
|
-
input
|
|
56
|
-
context: context
|
|
75
|
+
input: opts.input
|
|
57
76
|
});
|
|
58
77
|
} else {
|
|
59
78
|
args.push({
|
|
60
|
-
input,
|
|
61
|
-
result
|
|
62
|
-
|
|
63
|
-
|
|
79
|
+
input: opts.input,
|
|
80
|
+
// strip context from result cause it's too noisy in terminal wihtout collapse mode
|
|
81
|
+
result: 'result' in opts.result ? opts.result.result : opts.result,
|
|
82
|
+
elapsedMs: opts.elapsedMs
|
|
64
83
|
});
|
|
65
84
|
}
|
|
85
|
+
return {
|
|
86
|
+
parts,
|
|
87
|
+
args
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const [light, dark] = palettes.css[type];
|
|
91
|
+
const css = `
|
|
92
|
+
background-color: #${direction === 'up' ? light : dark};
|
|
93
|
+
color: ${direction === 'up' ? 'black' : 'white'};
|
|
94
|
+
padding: 2px;
|
|
95
|
+
`;
|
|
96
|
+
parts.push('%c', direction === 'up' ? '>>' : '<<', type, `#${id}`, `%c${path}%c`, '%O');
|
|
97
|
+
args.push(css, `${css}; font-weight: bold;`, `${css}; font-weight: normal;`);
|
|
98
|
+
if (direction === 'up') {
|
|
99
|
+
args.push({
|
|
100
|
+
input,
|
|
101
|
+
context: opts.context
|
|
102
|
+
});
|
|
103
|
+
} else {
|
|
104
|
+
args.push({
|
|
105
|
+
input,
|
|
106
|
+
result: opts.result,
|
|
107
|
+
elapsedMs: opts.elapsedMs,
|
|
108
|
+
context: opts.context
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
parts,
|
|
113
|
+
args
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
// maybe this should be moved to it's own package
|
|
117
|
+
const defaultLogger = ({ c =console , colorMode ='css' })=>(props)=>{
|
|
118
|
+
const rawInput = props.input;
|
|
119
|
+
const input = isFormData(rawInput) ? Object.fromEntries(rawInput) : rawInput;
|
|
120
|
+
const { parts , args } = constructPartsAndArgs({
|
|
121
|
+
...props,
|
|
122
|
+
colorMode,
|
|
123
|
+
input
|
|
124
|
+
});
|
|
66
125
|
const fn = props.direction === 'down' && props.result && (props.result instanceof Error || 'error' in props.result.result) ? 'error' : 'log';
|
|
67
126
|
c[fn].apply(null, [
|
|
68
127
|
parts.join(' ')
|
|
@@ -70,7 +129,11 @@ const defaultLogger = (c = console)=>(props)=>{
|
|
|
70
129
|
};
|
|
71
130
|
function loggerLink(opts = {}) {
|
|
72
131
|
const { enabled =()=>true } = opts;
|
|
73
|
-
const
|
|
132
|
+
const colorMode = opts.colorMode ?? (typeof window === 'undefined' ? 'ansi' : 'css');
|
|
133
|
+
const { logger =defaultLogger({
|
|
134
|
+
c: opts.console,
|
|
135
|
+
colorMode
|
|
136
|
+
}) } = opts;
|
|
74
137
|
return ()=>{
|
|
75
138
|
return ({ op , next })=>{
|
|
76
139
|
return observable.observable((observer)=>{
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
import { observable, tap } from '@trpc/server/observable';
|
|
2
2
|
|
|
3
3
|
/// <reference lib="dom.iterable" />
|
|
4
|
-
const palette = {
|
|
5
|
-
query: [
|
|
6
|
-
'72e3ff',
|
|
7
|
-
'3fb0d8'
|
|
8
|
-
],
|
|
9
|
-
mutation: [
|
|
10
|
-
'c5a3fc',
|
|
11
|
-
'904dfc'
|
|
12
|
-
],
|
|
13
|
-
subscription: [
|
|
14
|
-
'ff49e1',
|
|
15
|
-
'd83fbe'
|
|
16
|
-
]
|
|
17
|
-
};
|
|
18
4
|
function isFormData(value) {
|
|
19
5
|
if (typeof FormData === 'undefined') {
|
|
20
6
|
// FormData is not supported
|
|
@@ -22,43 +8,116 @@ function isFormData(value) {
|
|
|
22
8
|
}
|
|
23
9
|
return value instanceof FormData;
|
|
24
10
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
'
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
11
|
+
const palettes = {
|
|
12
|
+
css: {
|
|
13
|
+
query: [
|
|
14
|
+
'72e3ff',
|
|
15
|
+
'3fb0d8'
|
|
16
|
+
],
|
|
17
|
+
mutation: [
|
|
18
|
+
'c5a3fc',
|
|
19
|
+
'904dfc'
|
|
20
|
+
],
|
|
21
|
+
subscription: [
|
|
22
|
+
'ff49e1',
|
|
23
|
+
'd83fbe'
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
ansi: {
|
|
27
|
+
regular: {
|
|
28
|
+
// Cyan background, black and white text respectively
|
|
29
|
+
query: [
|
|
30
|
+
'\x1b[30;46m',
|
|
31
|
+
'\x1b[97;46m'
|
|
32
|
+
],
|
|
33
|
+
// Magenta background, black and white text respectively
|
|
34
|
+
mutation: [
|
|
35
|
+
'\x1b[30;45m',
|
|
36
|
+
'\x1b[97;45m'
|
|
37
|
+
],
|
|
38
|
+
// Green background, black and white text respectively
|
|
39
|
+
subscription: [
|
|
40
|
+
'\x1b[30;42m',
|
|
41
|
+
'\x1b[97;42m'
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
bold: {
|
|
45
|
+
query: [
|
|
46
|
+
'\x1b[1;30;46m',
|
|
47
|
+
'\x1b[1;97;46m'
|
|
48
|
+
],
|
|
49
|
+
mutation: [
|
|
50
|
+
'\x1b[1;30;45m',
|
|
51
|
+
'\x1b[1;97;45m'
|
|
52
|
+
],
|
|
53
|
+
subscription: [
|
|
54
|
+
'\x1b[1;30;42m',
|
|
55
|
+
'\x1b[1;97;42m'
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
function constructPartsAndArgs(opts) {
|
|
61
|
+
const { direction , type , path , id , input } = opts;
|
|
62
|
+
const parts = [];
|
|
63
|
+
const args = [];
|
|
64
|
+
if (opts.colorMode === 'ansi') {
|
|
65
|
+
const [lightRegular, darkRegular] = palettes.ansi.regular[type];
|
|
66
|
+
const [lightBold, darkBold] = palettes.ansi.bold[type];
|
|
67
|
+
const reset = '\x1b[0m';
|
|
68
|
+
parts.push(direction === 'up' ? lightRegular : darkRegular, direction === 'up' ? '>>' : '<<', type, direction === 'up' ? lightBold : darkBold, `#${id}`, path, reset);
|
|
69
|
+
if (direction === 'up') {
|
|
50
70
|
args.push({
|
|
51
|
-
input
|
|
52
|
-
context: context
|
|
71
|
+
input: opts.input
|
|
53
72
|
});
|
|
54
73
|
} else {
|
|
55
74
|
args.push({
|
|
56
|
-
input,
|
|
57
|
-
result
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
input: opts.input,
|
|
76
|
+
// strip context from result cause it's too noisy in terminal wihtout collapse mode
|
|
77
|
+
result: 'result' in opts.result ? opts.result.result : opts.result,
|
|
78
|
+
elapsedMs: opts.elapsedMs
|
|
60
79
|
});
|
|
61
80
|
}
|
|
81
|
+
return {
|
|
82
|
+
parts,
|
|
83
|
+
args
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const [light, dark] = palettes.css[type];
|
|
87
|
+
const css = `
|
|
88
|
+
background-color: #${direction === 'up' ? light : dark};
|
|
89
|
+
color: ${direction === 'up' ? 'black' : 'white'};
|
|
90
|
+
padding: 2px;
|
|
91
|
+
`;
|
|
92
|
+
parts.push('%c', direction === 'up' ? '>>' : '<<', type, `#${id}`, `%c${path}%c`, '%O');
|
|
93
|
+
args.push(css, `${css}; font-weight: bold;`, `${css}; font-weight: normal;`);
|
|
94
|
+
if (direction === 'up') {
|
|
95
|
+
args.push({
|
|
96
|
+
input,
|
|
97
|
+
context: opts.context
|
|
98
|
+
});
|
|
99
|
+
} else {
|
|
100
|
+
args.push({
|
|
101
|
+
input,
|
|
102
|
+
result: opts.result,
|
|
103
|
+
elapsedMs: opts.elapsedMs,
|
|
104
|
+
context: opts.context
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
parts,
|
|
109
|
+
args
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
// maybe this should be moved to it's own package
|
|
113
|
+
const defaultLogger = ({ c =console , colorMode ='css' })=>(props)=>{
|
|
114
|
+
const rawInput = props.input;
|
|
115
|
+
const input = isFormData(rawInput) ? Object.fromEntries(rawInput) : rawInput;
|
|
116
|
+
const { parts , args } = constructPartsAndArgs({
|
|
117
|
+
...props,
|
|
118
|
+
colorMode,
|
|
119
|
+
input
|
|
120
|
+
});
|
|
62
121
|
const fn = props.direction === 'down' && props.result && (props.result instanceof Error || 'error' in props.result.result) ? 'error' : 'log';
|
|
63
122
|
c[fn].apply(null, [
|
|
64
123
|
parts.join(' ')
|
|
@@ -66,7 +125,11 @@ const defaultLogger = (c = console)=>(props)=>{
|
|
|
66
125
|
};
|
|
67
126
|
function loggerLink(opts = {}) {
|
|
68
127
|
const { enabled =()=>true } = opts;
|
|
69
|
-
const
|
|
128
|
+
const colorMode = opts.colorMode ?? (typeof window === 'undefined' ? 'ansi' : 'css');
|
|
129
|
+
const { logger =defaultLogger({
|
|
130
|
+
c: opts.console,
|
|
131
|
+
colorMode
|
|
132
|
+
}) } = opts;
|
|
70
133
|
return ()=>{
|
|
71
134
|
return ({ op , next })=>{
|
|
72
135
|
return observable((observer)=>{
|
package/dist/links/types.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface OperationContext extends Record<string, unknown> {
|
|
|
24
24
|
*/
|
|
25
25
|
export type Operation<TInput = unknown> = {
|
|
26
26
|
id: number;
|
|
27
|
-
type: '
|
|
27
|
+
type: 'mutation' | 'query' | 'subscription';
|
|
28
28
|
input: TInput;
|
|
29
29
|
path: string;
|
|
30
30
|
context: OperationContext;
|
|
@@ -32,7 +32,7 @@ export type Operation<TInput = unknown> = {
|
|
|
32
32
|
/**
|
|
33
33
|
* @internal
|
|
34
34
|
*/
|
|
35
|
-
export type HTTPHeaders = Record<string, string | string
|
|
35
|
+
export type HTTPHeaders = Record<string, string[] | string | undefined>;
|
|
36
36
|
/**
|
|
37
37
|
* The default `fetch` implementation has an overloaded signature. By convention this library
|
|
38
38
|
* only uses the overload taking a string and options object.
|
|
@@ -46,7 +46,7 @@ export interface TRPCClientRuntime {
|
|
|
46
46
|
* @internal
|
|
47
47
|
*/
|
|
48
48
|
export interface OperationResultEnvelope<TOutput> {
|
|
49
|
-
result:
|
|
49
|
+
result: TRPCResultMessage<TOutput>['result'] | TRPCSuccessResponse<TOutput>['result'];
|
|
50
50
|
context?: OperationContext;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/links/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,uBAAuB,EACvB,eAAe,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,MAAM,IAAI;IACrC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,MAAM,EAAE,QAAQ,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAAG;AAEpE;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,MAAM,GAAG,OAAO,IAAI;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/links/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,uBAAuB,EACvB,eAAe,EAChB,MA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OAAO,CAAC,CAAC,QAAQ,CAAC,GACpC,mBAAmB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,yBAAyB,CACnC,OAAO,SAAS,SAAS,EACzB,OAAO,IACL,UAAU,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;AAE3E;;GAEG;AACH,MAAM,MAAM,uBAAuB,CACjC,OAAO,SAAS,SAAS,EACzB,OAAO,IACL,QAAQ,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,aAAa,CACvB,OAAO,SAAS,SAAS,EACzB,MAAM,GAAG,OAAO,EAChB,OAAO,GAAG,OAAO,IACf,CAAC,IAAI,EAAE;IACT,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACtB,IAAI,EAAE,CAAC,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,KAAK,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;CAC9E,KAAK,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,QAAQ,CAAC,OAAO,SAAS,SAAS,IAAI,CAChD,IAAI,EAAE,iBAAiB,KACpB,aAAa,CAAC,OAAO,CAAC,CAAC"}
|
package/dist/links/wsLink.js
CHANGED
package/dist/links/wsLink.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import type { AnyRouter, inferRouterError } from '@trpc/server';
|
|
|
2
2
|
import type { TRPCResponse, TRPCResponseMessage } from '@trpc/server/rpc';
|
|
3
3
|
import type { TRPCClientRuntime } from '../links';
|
|
4
4
|
/** @internal */
|
|
5
|
-
declare function transformResultInner<TRouter extends AnyRouter, TOutput>(response:
|
|
5
|
+
declare function transformResultInner<TRouter extends AnyRouter, TOutput>(response: TRPCResponse<TOutput, inferRouterError<TRouter>> | TRPCResponseMessage<TOutput, inferRouterError<TRouter>>, runtime: TRPCClientRuntime): {
|
|
6
6
|
readonly ok: false;
|
|
7
7
|
readonly error: {
|
|
8
8
|
readonly error: inferRouterError<TRouter>;
|
|
@@ -29,6 +29,6 @@ declare function transformResultInner<TRouter extends AnyRouter, TOutput>(respon
|
|
|
29
29
|
* Transforms and validates that the result is a valid TRPCResponse
|
|
30
30
|
* @internal
|
|
31
31
|
*/
|
|
32
|
-
export declare function transformResult<TRouter extends AnyRouter, TOutput>(response:
|
|
32
|
+
export declare function transformResult<TRouter extends AnyRouter, TOutput>(response: TRPCResponse<TOutput, inferRouterError<TRouter>> | TRPCResponseMessage<TOutput, inferRouterError<TRouter>>, runtime: TRPCClientRuntime): ReturnType<typeof transformResultInner>;
|
|
33
33
|
export {};
|
|
34
34
|
//# sourceMappingURL=transformResult.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformResult.d.ts","sourceRoot":"","sources":["../../src/shared/transformResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EAEpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAOlD,gBAAgB;AAChB,iBAAS,oBAAoB,CAAC,OAAO,SAAS,SAAS,EAAE,OAAO,EAC9D,QAAQ,EACJ,
|
|
1
|
+
{"version":3,"file":"transformResult.d.ts","sourceRoot":"","sources":["../../src/shared/transformResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EAEpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAOlD,gBAAgB;AAChB,iBAAS,oBAAoB,CAAC,OAAO,SAAS,SAAS,EAAE,OAAO,EAC9D,QAAQ,EACJ,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAChD,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAC3D,OAAO,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;EAuB3B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAS,SAAS,EAAE,OAAO,EAChE,QAAQ,EACJ,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAChD,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAC3D,OAAO,EAAE,iBAAiB,GACzB,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAqBzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/client",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.33.1",
|
|
4
4
|
"description": "The tRPC client library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -76,11 +76,11 @@
|
|
|
76
76
|
"!**/*.test.*"
|
|
77
77
|
],
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@trpc/server": "10.
|
|
79
|
+
"@trpc/server": "10.33.1"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@testing-library/dom": "^9.0.0",
|
|
83
|
-
"@trpc/server": "10.
|
|
83
|
+
"@trpc/server": "10.33.1",
|
|
84
84
|
"@types/isomorphic-fetch": "^0.0.36",
|
|
85
85
|
"@types/node": "^18.16.16",
|
|
86
86
|
"eslint": "^8.40.0",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"funding": [
|
|
99
99
|
"https://trpc.io/sponsor"
|
|
100
100
|
],
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "403be02df05c29a9c3a77256805674baf6b6b125"
|
|
102
102
|
}
|
package/src/TRPCClientError.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '@trpc/server';
|
|
8
8
|
import { TRPCErrorResponse, TRPCErrorShape } from '@trpc/server/rpc';
|
|
9
9
|
|
|
10
|
-
type ErrorInferrable =
|
|
10
|
+
type ErrorInferrable = AnyProcedure | AnyRouter | TRPCErrorShape<number>;
|
|
11
11
|
|
|
12
12
|
type inferErrorShape<TInferrable extends ErrorInferrable> =
|
|
13
13
|
TInferrable extends AnyRouter
|
package/src/createTRPCClient.ts
CHANGED
|
@@ -49,8 +49,8 @@ export interface TRPCClient<TRouter extends AnyRouter> {
|
|
|
49
49
|
>(
|
|
50
50
|
path: TPath,
|
|
51
51
|
input: TInput,
|
|
52
|
-
opts:
|
|
53
|
-
|
|
52
|
+
opts: Partial<TRPCSubscriptionObserver<TOutput, TRPCClientError<TRouter>>> &
|
|
53
|
+
TRPCRequestOptions,
|
|
54
54
|
): Unsubscribable;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
@@ -40,13 +40,13 @@ export type Resolver<TProcedure extends AnyProcedure> = (
|
|
|
40
40
|
type SubscriptionResolver<TProcedure extends AnyProcedure> = (
|
|
41
41
|
...args: [
|
|
42
42
|
input: ProcedureArgs<TProcedure['_def']>[0],
|
|
43
|
-
opts:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
opts: Partial<
|
|
44
|
+
TRPCSubscriptionObserver<
|
|
45
|
+
inferTransformedSubscriptionOutput<TProcedure>,
|
|
46
|
+
TRPCClientError<TProcedure>
|
|
47
|
+
>
|
|
48
|
+
> &
|
|
49
|
+
ProcedureArgs<TProcedure['_def']>[1],
|
|
50
50
|
]
|
|
51
51
|
) => Unsubscribable;
|
|
52
52
|
|