@trpc/client 11.0.0-alpha-tmp-03-03-pipe-pipe.310 → 11.0.0-alpha-tmp-issues-5557-types-node-wut.318
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/bundle-analysis.json +7 -7
- package/dist/internals/types.d.ts +4 -2
- package/dist/internals/types.d.ts.map +1 -1
- package/dist/links/httpLink.d.ts +2 -2
- package/dist/links/httpLink.d.ts.map +1 -1
- package/dist/links/internals/createHTTPBatchLink.d.ts.map +1 -1
- package/dist/links/internals/parseJSONStream.d.ts +2 -3
- package/dist/links/internals/parseJSONStream.d.ts.map +1 -1
- package/package.json +5 -7
- package/src/internals/types.ts +9 -1
- package/src/links/internals/parseJSONStream.ts +7 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bundleSize": 46703,
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 29.
|
|
3
|
+
"bundleOrigSize": 65934,
|
|
4
|
+
"bundleReduction": 29.17,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/links/wsLink.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
{
|
|
46
46
|
"id": "/src/links/internals/parseJSONStream.ts",
|
|
47
47
|
"size": 4007,
|
|
48
|
-
"origSize":
|
|
48
|
+
"origSize": 5037,
|
|
49
49
|
"renderedExports": [
|
|
50
50
|
"parseJSONStream",
|
|
51
51
|
"streamingJsonHttpRequester"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"/src/links/httpBatchStreamLink.ts"
|
|
56
56
|
],
|
|
57
57
|
"percent": 8.58,
|
|
58
|
-
"reduction":
|
|
58
|
+
"reduction": 20.45
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
"id": "/src/links/internals/httpUtils.ts",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
],
|
|
72
72
|
"removedExports": [],
|
|
73
73
|
"dependents": [
|
|
74
|
-
"/src/links/httpLink.ts",
|
|
75
74
|
"/src/links/httpBatchLink.ts",
|
|
75
|
+
"/src/links/httpLink.ts",
|
|
76
76
|
"/src/links/httpFormDataLink.ts",
|
|
77
77
|
"/src/links/internals/createHTTPBatchLink.ts",
|
|
78
78
|
"/src/links/internals/parseJSONStream.ts"
|
|
@@ -138,8 +138,8 @@
|
|
|
138
138
|
"/src/links/httpLink.ts",
|
|
139
139
|
"/src/links/wsLink.ts",
|
|
140
140
|
"/src/internals/TRPCUntypedClient.ts",
|
|
141
|
-
"/src/links/internals/
|
|
142
|
-
"/src/links/internals/
|
|
141
|
+
"/src/links/internals/createHTTPBatchLink.ts",
|
|
142
|
+
"/src/links/internals/httpUtils.ts"
|
|
143
143
|
],
|
|
144
144
|
"percent": 4,
|
|
145
145
|
"reduction": 45.71
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
export type AbortControllerEsque = new () => AbortControllerInstanceEsque;
|
|
3
2
|
/**
|
|
4
3
|
* Allows you to abort one or more requests.
|
|
@@ -62,12 +61,15 @@ export interface RequestInitEsque {
|
|
|
62
61
|
export type WebReadableStreamEsque = {
|
|
63
62
|
getReader: () => ReadableStreamDefaultReader<Uint8Array>;
|
|
64
63
|
};
|
|
64
|
+
export type NodeJSReadableStreamEsque = {
|
|
65
|
+
on(eventName: string | symbol, listener: (...args: any[]) => void): NodeJSReadableStreamEsque;
|
|
66
|
+
};
|
|
65
67
|
/**
|
|
66
68
|
* A subset of the standard Response properties needed by tRPC internally.
|
|
67
69
|
* @see Response from lib.dom.d.ts
|
|
68
70
|
*/
|
|
69
71
|
export interface ResponseEsque {
|
|
70
|
-
readonly body?:
|
|
72
|
+
readonly body?: NodeJSReadableStreamEsque | WebReadableStreamEsque | null;
|
|
71
73
|
/**
|
|
72
74
|
* @remarks
|
|
73
75
|
* The built-in Response::json() method returns Promise<any>, but
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/internals/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/internals/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG,UAAU,4BAA4B,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B;;;OAGG;IACH,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,CACvB,KAAK,EAAE,WAAW,GAAG,GAAG,GAAG,MAAM,EACjC,IAAI,CAAC,EAAE,WAAW,GAAG,gBAAgB,KAClC,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5B;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,GAAG,EAAE,GAAG,GAAG,MAAM,EACjB,IAAI,CAAC,EAAE,yBAAyB,KAC7B,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5B,MAAM,WAAW,yBAAyB;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,cAAc,GAAG,MAAM,GAAG,IAAI,CAAC;IAEjD;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEtD;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,2BAA2B,CAAC,UAAU,CAAC,CAAC;CAC1D,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IAEtC,EAAE,CACA,SAAS,EAAE,MAAM,GAAG,MAAM,EAC1B,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GACjC,yBAAyB,CAAC;CAC9B,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,yBAAyB,GAAG,sBAAsB,GAAG,IAAI,CAAC;IAC1E;;;;;OAKG;IACH,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC"}
|
package/dist/links/httpLink.d.ts
CHANGED
|
@@ -12,9 +12,9 @@ export type HTTPLinkOptions<TRoot extends AnyRootTypes> = HTTPLinkBaseOptions<TR
|
|
|
12
12
|
};
|
|
13
13
|
export declare function httpLinkFactory(factoryOpts: {
|
|
14
14
|
requester: Requester;
|
|
15
|
-
}): <TRouter extends AnyRouter>(opts: HTTPLinkOptions<TRouter[
|
|
15
|
+
}): <TRouter extends AnyRouter>(opts: HTTPLinkOptions<TRouter['_def']['_config']['$types']>) => TRPCLink<TRouter>;
|
|
16
16
|
/**
|
|
17
17
|
* @link https://trpc.io/docs/v11/client/links/httpLink
|
|
18
18
|
*/
|
|
19
|
-
export declare const httpLink: <TRouter extends AnyRouter>(opts: HTTPLinkOptions<TRouter[
|
|
19
|
+
export declare const httpLink: <TRouter extends AnyRouter>(opts: HTTPLinkOptions<TRouter['_def']['_config']['$types']>) => TRPCLink<TRouter>;
|
|
20
20
|
//# sourceMappingURL=httpLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpLink.d.ts","sourceRoot":"","sources":["../../src/links/httpLink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACV,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EACV,mBAAmB,EAEnB,SAAS,EACV,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEhE,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,YAAY,IACpD,mBAAmB,CAAC,KAAK,CAAC,GAAG;IAC3B;;;OAGG;IACH,OAAO,CAAC,EACJ,WAAW,GACX,CAAC,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,SAAS,CAAA;KAAE,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;CACvE,CAAC;AAEJ,wBAAgB,eAAe,CAAC,WAAW,EAAE;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"httpLink.d.ts","sourceRoot":"","sources":["../../src/links/httpLink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACV,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EACV,mBAAmB,EAEnB,SAAS,EACV,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEhE,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,YAAY,IACpD,mBAAmB,CAAC,KAAK,CAAC,GAAG;IAC3B;;;OAGG;IACH,OAAO,CAAC,EACJ,WAAW,GACX,CAAC,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,SAAS,CAAA;KAAE,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;CACvE,CAAC;AAEJ,wBAAgB,eAAe,CAAC,WAAW,EAAE;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,qCAE3D,gBAAgB,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,KAC1D,SAAS,OAAO,CAAC,CAwDrB;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ,oCA9DX,gBAAgB,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,KAC1D,SAAS,OAAO,CA6DoD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHTTPBatchLink.d.ts","sourceRoot":"","sources":["../../../src/links/internals/createHTTPBatchLink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,aAAa,EACd,MAAM,0CAA0C,CAAC;AAIlD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACT,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAGvE;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,QAAQ,SAAS,oBAAoB,CAAC,YAAY,CAAC,IAAI,CAC7E,aAAa,EAAE,uBAAuB,GAAG;IACvC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,QAAQ,CAAC;CAChB,KACE,CACH,QAAQ,EAAE,SAAS,EAAE,EACrB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,KAAK,IAAI,KAClE;IACH,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC/B,MAAM,EAAE,QAAQ,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,WAAW,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"createHTTPBatchLink.d.ts","sourceRoot":"","sources":["../../../src/links/internals/createHTTPBatchLink.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,aAAa,EACd,MAAM,0CAA0C,CAAC;AAIlD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACT,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAGvE;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,QAAQ,SAAS,oBAAoB,CAAC,YAAY,CAAC,IAAI,CAC7E,aAAa,EAAE,uBAAuB,GAAG;IACvC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,QAAQ,CAAC;CAChB,KACE,CACH,QAAQ,EAAE,SAAS,EAAE,EACrB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC,KAAK,IAAI,KAClE;IACH,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC/B,MAAM,EAAE,QAAQ,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,WAAW,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC,qCAGlD,qBAAqB,iBAAiB,OAAO,CAAC,CAAC,KACpD,SAAS,OAAO,CAAC,CAuFrB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type { WebReadableStreamEsque } from '../../internals/types';
|
|
1
|
+
import type { NodeJSReadableStreamEsque, WebReadableStreamEsque } from '../../internals/types';
|
|
3
2
|
import type { HTTPHeaders } from '../types';
|
|
4
3
|
import type { HTTPBaseRequestOptions, HTTPResult } from './httpUtils';
|
|
5
4
|
import type { TextDecoderEsque } from './streamingUtils';
|
|
@@ -18,7 +17,7 @@ export declare function parseJSONStream<TReturn>(opts: {
|
|
|
18
17
|
/**
|
|
19
18
|
* As given by `(await fetch(url)).body`
|
|
20
19
|
*/
|
|
21
|
-
readableStream:
|
|
20
|
+
readableStream: NodeJSReadableStreamEsque | WebReadableStreamEsque;
|
|
22
21
|
/**
|
|
23
22
|
* Called for each line of the stream
|
|
24
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseJSONStream.d.ts","sourceRoot":"","sources":["../../../src/links/internals/parseJSONStream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parseJSONStream.d.ts","sourceRoot":"","sources":["../../../src/links/internals/parseJSONStream.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,IAAI,EAAE;IACnD;;OAEG;IACH,cAAc,EAAE,yBAAyB,GAAG,sBAAsB,CAAC;IACnE;;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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/client",
|
|
3
|
-
"version": "11.0.0-alpha-tmp-
|
|
3
|
+
"version": "11.0.0-alpha-tmp-issues-5557-types-node-wut.318+203bbaf87",
|
|
4
4
|
"description": "The tRPC client library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -76,11 +76,10 @@
|
|
|
76
76
|
"!**/*.test.*"
|
|
77
77
|
],
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@trpc/server": "11.0.0-alpha-tmp-
|
|
79
|
+
"@trpc/server": "11.0.0-alpha-tmp-issues-5557-types-node-wut.318+203bbaf87"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@
|
|
83
|
-
"@trpc/server": "11.0.0-alpha-tmp-03-03-pipe-pipe.310+5895b1d60",
|
|
82
|
+
"@trpc/server": "11.0.0-alpha-tmp-issues-5557-types-node-wut.318+203bbaf87",
|
|
84
83
|
"@types/isomorphic-fetch": "^0.0.39",
|
|
85
84
|
"@types/node": "^20.10.0",
|
|
86
85
|
"eslint": "^8.56.0",
|
|
@@ -88,8 +87,7 @@
|
|
|
88
87
|
"node-fetch": "^3.3.0",
|
|
89
88
|
"rollup": "^4.9.5",
|
|
90
89
|
"tsx": "^4.0.0",
|
|
91
|
-
"undici": "^6.0.1"
|
|
92
|
-
"vitest": "^1.2.2"
|
|
90
|
+
"undici": "^6.0.1"
|
|
93
91
|
},
|
|
94
92
|
"publishConfig": {
|
|
95
93
|
"access": "public"
|
|
@@ -97,5 +95,5 @@
|
|
|
97
95
|
"funding": [
|
|
98
96
|
"https://trpc.io/sponsor"
|
|
99
97
|
],
|
|
100
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "203bbaf87dd70fd3b8decd29cc8833018078a3e5"
|
|
101
99
|
}
|
package/src/internals/types.ts
CHANGED
|
@@ -78,12 +78,20 @@ export type WebReadableStreamEsque = {
|
|
|
78
78
|
getReader: () => ReadableStreamDefaultReader<Uint8Array>;
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
+
export type NodeJSReadableStreamEsque = {
|
|
82
|
+
// on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
83
|
+
on(
|
|
84
|
+
eventName: string | symbol,
|
|
85
|
+
listener: (...args: any[]) => void,
|
|
86
|
+
): NodeJSReadableStreamEsque;
|
|
87
|
+
};
|
|
88
|
+
|
|
81
89
|
/**
|
|
82
90
|
* A subset of the standard Response properties needed by tRPC internally.
|
|
83
91
|
* @see Response from lib.dom.d.ts
|
|
84
92
|
*/
|
|
85
93
|
export interface ResponseEsque {
|
|
86
|
-
readonly body?:
|
|
94
|
+
readonly body?: NodeJSReadableStreamEsque | WebReadableStreamEsque | null;
|
|
87
95
|
/**
|
|
88
96
|
* @remarks
|
|
89
97
|
* The built-in Response::json() method returns Promise<any>, but
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// Stream parsing adapted from https://www.loginradius.com/blog/engineering/guest-post/http-streaming-with-nodejs-and-fetch-api/
|
|
2
2
|
import type { TRPCResponse } from '@trpc/server/unstable-core-do-not-import';
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
NodeJSReadableStreamEsque,
|
|
5
|
+
WebReadableStreamEsque,
|
|
6
|
+
} from '../../internals/types';
|
|
4
7
|
import type { HTTPHeaders } from '../types';
|
|
5
8
|
import type { HTTPBaseRequestOptions, HTTPResult } from './httpUtils';
|
|
6
9
|
import { fetchHTTPResponse, getBody, getUrl } from './httpUtils';
|
|
@@ -21,7 +24,7 @@ export async function parseJSONStream<TReturn>(opts: {
|
|
|
21
24
|
/**
|
|
22
25
|
* As given by `(await fetch(url)).body`
|
|
23
26
|
*/
|
|
24
|
-
readableStream:
|
|
27
|
+
readableStream: NodeJSReadableStreamEsque | WebReadableStreamEsque;
|
|
25
28
|
/**
|
|
26
29
|
* Called for each line of the stream
|
|
27
30
|
*/
|
|
@@ -64,7 +67,7 @@ export async function parseJSONStream<TReturn>(opts: {
|
|
|
64
67
|
* @param onLine will be called for every line ('\n' delimited) in the stream
|
|
65
68
|
*/
|
|
66
69
|
async function readLines(
|
|
67
|
-
readableStream:
|
|
70
|
+
readableStream: NodeJSReadableStreamEsque | WebReadableStreamEsque,
|
|
68
71
|
onLine: (line: string) => void,
|
|
69
72
|
textDecoder: TextDecoderEsque,
|
|
70
73
|
) {
|
|
@@ -101,7 +104,7 @@ async function readLines(
|
|
|
101
104
|
* Handle NodeJS stream
|
|
102
105
|
*/
|
|
103
106
|
function readNodeChunks(
|
|
104
|
-
stream:
|
|
107
|
+
stream: NodeJSReadableStreamEsque,
|
|
105
108
|
onChunk: (chunk: Uint8Array) => void,
|
|
106
109
|
) {
|
|
107
110
|
return new Promise<void>((resolve) => {
|