@trpc/server 11.0.0-alpha-tmp-04-26-resolveResponse-and-multi.415 → 11.0.0-alpha-tmp-04-26-resolveResponse-and-multi.417

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.
@@ -5,5 +5,5 @@ export type { BaseHandlerOptions, HTTPBaseHandlerOptions, HTTPErrorHandler,
5
5
  */
6
6
  HTTPErrorHandler as OnErrorFunction, ResolveHTTPRequestOptionsContextFn, ResponseMeta, ResponseMetaFn, TRPCRequestInfo, } from '../../unstable-core-do-not-import';
7
7
  export { getBatchStreamFormatter } from '../../unstable-core-do-not-import';
8
- export { parseOctetInput, toURL } from '../../unstable-core-do-not-import';
8
+ export { octetInputParser, toURL } from '../../unstable-core-do-not-import';
9
9
  //# sourceMappingURL=http.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/@trpc/server/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB;AAChB;;GAEG;AACH,gBAAgB,IAAI,eAAe,EACnC,kCAAkC,EAClC,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC"}
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/@trpc/server/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB;AAChB;;GAEG;AACH,gBAAgB,IAAI,eAAe,EACnC,kCAAkC,EAClC,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
- "bundleSize": 87003,
3
- "bundleOrigSize": 134601,
4
- "bundleReduction": 35.36,
2
+ "bundleSize": 86656,
3
+ "bundleOrigSize": 134259,
4
+ "bundleReduction": 35.46,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/unstable-core-do-not-import/http/resolveResponse.ts",
@@ -14,7 +14,7 @@
14
14
  "dependents": [
15
15
  "/src/unstable-core-do-not-import.ts"
16
16
  ],
17
- "percent": 14.18,
17
+ "percent": 14.24,
18
18
  "reduction": 0.42
19
19
  },
20
20
  {
@@ -29,7 +29,7 @@
29
29
  "dependents": [
30
30
  "/src/adapters/fastify/fastifyTRPCPlugin.ts"
31
31
  ],
32
- "percent": 11.69,
32
+ "percent": 11.74,
33
33
  "reduction": 0
34
34
  },
35
35
  {
@@ -44,7 +44,7 @@
44
44
  "/src/unstable-core-do-not-import.ts",
45
45
  "/src/unstable-core-do-not-import/initTRPC.ts"
46
46
  ],
47
- "percent": 7.27,
47
+ "percent": 7.3,
48
48
  "reduction": 59.52
49
49
  },
50
50
  {
@@ -63,7 +63,7 @@
63
63
  "/src/unstable-core-do-not-import/http/resolveResponse.ts",
64
64
  "/src/unstable-core-do-not-import/initTRPC.ts"
65
65
  ],
66
- "percent": 6.88,
66
+ "percent": 6.91,
67
67
  "reduction": 41.05
68
68
  },
69
69
  {
@@ -84,7 +84,7 @@
84
84
  "dependents": [
85
85
  "/src/adapters/aws-lambda/index.ts"
86
86
  ],
87
- "percent": 5.17,
87
+ "percent": 5.2,
88
88
  "reduction": 25.84
89
89
  },
90
90
  {
@@ -101,7 +101,7 @@
101
101
  "/src/observable/index.ts",
102
102
  "/src/observable/operators.ts"
103
103
  ],
104
- "percent": 3.6,
104
+ "percent": 3.61,
105
105
  "reduction": 0.67
106
106
  },
107
107
  {
@@ -115,7 +115,7 @@
115
115
  "dependents": [
116
116
  "/src/adapters/next-app-dir.ts"
117
117
  ],
118
- "percent": 3.51,
118
+ "percent": 3.52,
119
119
  "reduction": 20.12
120
120
  },
121
121
  {
@@ -131,7 +131,7 @@
131
131
  "dependents": [
132
132
  "/src/observable/index.ts"
133
133
  ],
134
- "percent": 3.17,
134
+ "percent": 3.18,
135
135
  "reduction": 0
136
136
  },
137
137
  {
@@ -151,7 +151,7 @@
151
151
  "/src/unstable-core-do-not-import/router.ts",
152
152
  "/src/unstable-core-do-not-import/initTRPC.ts"
153
153
  ],
154
- "percent": 3.15,
154
+ "percent": 3.17,
155
155
  "reduction": 45.94
156
156
  },
157
157
  {
@@ -165,7 +165,7 @@
165
165
  "dependents": [
166
166
  "/src/unstable-core-do-not-import.ts"
167
167
  ],
168
- "percent": 3.05,
168
+ "percent": 3.06,
169
169
  "reduction": 41.46
170
170
  },
171
171
  {
@@ -185,7 +185,7 @@
185
185
  "/src/unstable-core-do-not-import/initTRPC.ts",
186
186
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
187
187
  ],
188
- "percent": 3.02,
188
+ "percent": 3.03,
189
189
  "reduction": 55.5
190
190
  },
191
191
  {
@@ -197,7 +197,7 @@
197
197
  ],
198
198
  "removedExports": [],
199
199
  "dependents": [],
200
- "percent": 2.79,
200
+ "percent": 2.8,
201
201
  "reduction": 32.66
202
202
  },
203
203
  {
@@ -211,7 +211,7 @@
211
211
  "dependents": [
212
212
  "/src/adapters/fetch/index.ts"
213
213
  ],
214
- "percent": 2.59,
214
+ "percent": 2.6,
215
215
  "reduction": 2.17
216
216
  },
217
217
  {
@@ -242,7 +242,7 @@
242
242
  "/src/unstable-core-do-not-import.ts",
243
243
  "/src/unstable-core-do-not-import/router.ts"
244
244
  ],
245
- "percent": 2.3,
245
+ "percent": 2.31,
246
246
  "reduction": 0
247
247
  },
248
248
  {
@@ -256,7 +256,7 @@
256
256
  "dependents": [
257
257
  "/src/adapters/node-http/index.ts"
258
258
  ],
259
- "percent": 2.25,
259
+ "percent": 2.26,
260
260
  "reduction": 18.16
261
261
  },
262
262
  {
@@ -286,14 +286,13 @@
286
286
  "removedExports": [],
287
287
  "dependents": [
288
288
  "/src/unstable-core-do-not-import.ts",
289
- "/src/unstable-core-do-not-import/http/contentTypeParsers.ts",
290
289
  "/src/unstable-core-do-not-import/http/resolveResponse.ts",
291
290
  "/src/unstable-core-do-not-import/router.ts",
292
291
  "/src/unstable-core-do-not-import/middleware.ts",
293
292
  "/src/unstable-core-do-not-import/http/contentType.ts",
294
293
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
295
294
  ],
296
- "percent": 1.99,
295
+ "percent": 2,
297
296
  "reduction": 19.47
298
297
  },
299
298
  {
@@ -317,7 +316,7 @@
317
316
  ],
318
317
  "removedExports": [],
319
318
  "dependents": [],
320
- "percent": 1.77,
319
+ "percent": 1.78,
321
320
  "reduction": 26.94
322
321
  },
323
322
  {
@@ -330,7 +329,7 @@
330
329
  ],
331
330
  "removedExports": [],
332
331
  "dependents": [],
333
- "percent": 1.75,
332
+ "percent": 1.76,
334
333
  "reduction": 27.6
335
334
  },
336
335
  {
@@ -344,7 +343,7 @@
344
343
  "dependents": [
345
344
  "/src/adapters/fastify/index.ts"
346
345
  ],
347
- "percent": 1.7,
346
+ "percent": 1.71,
348
347
  "reduction": 34.44
349
348
  },
350
349
  {
@@ -380,11 +379,11 @@
380
379
  "dependents": [
381
380
  "/src/unstable-core-do-not-import.ts",
382
381
  "/src/unstable-core-do-not-import/http/resolveResponse.ts",
383
- "/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
384
382
  "/src/unstable-core-do-not-import/error/TRPCError.ts",
385
383
  "/src/unstable-core-do-not-import/router.ts",
386
384
  "/src/unstable-core-do-not-import/transformer.ts",
387
385
  "/src/unstable-core-do-not-import/middleware.ts",
386
+ "/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
388
387
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
389
388
  ],
390
389
  "percent": 1.36,
@@ -419,7 +418,7 @@
419
418
  "/src/adapters/next-app-dir/nextAppDirCaller.ts",
420
419
  "/src/adapters/next-app-dir/rethrowNextErrors.ts"
421
420
  ],
422
- "percent": 1.13,
421
+ "percent": 1.14,
423
422
  "reduction": 13.65
424
423
  },
425
424
  {
@@ -481,20 +480,6 @@
481
480
  "percent": 0.72,
482
481
  "reduction": 43.49
483
482
  },
484
- {
485
- "id": "/src/unstable-core-do-not-import/http/contentTypeParsers.ts",
486
- "size": 624,
487
- "origSize": 1219,
488
- "renderedExports": [
489
- "parseOctetInput"
490
- ],
491
- "removedExports": [],
492
- "dependents": [
493
- "/src/unstable-core-do-not-import.ts"
494
- ],
495
- "percent": 0.72,
496
- "reduction": 48.81
497
- },
498
483
  {
499
484
  "id": "/src/adapters/standalone.ts",
500
485
  "size": 520,
@@ -534,7 +519,7 @@
534
519
  "/src/unstable-core-do-not-import.ts",
535
520
  "/src/unstable-core-do-not-import/initTRPC.ts"
536
521
  ],
537
- "percent": 0.39,
522
+ "percent": 0.4,
538
523
  "reduction": 87.93
539
524
  },
540
525
  {
@@ -549,6 +534,20 @@
549
534
  "percent": 0.32,
550
535
  "reduction": 72.92
551
536
  },
537
+ {
538
+ "id": "/src/unstable-core-do-not-import/http/contentTypeParsers.ts",
539
+ "size": 277,
540
+ "origSize": 878,
541
+ "renderedExports": [
542
+ "octetInputParser"
543
+ ],
544
+ "removedExports": [],
545
+ "dependents": [
546
+ "/src/unstable-core-do-not-import.ts"
547
+ ],
548
+ "percent": 0.32,
549
+ "reduction": 68.45
550
+ },
552
551
  {
553
552
  "id": "/src/unstable-core-do-not-import/types.ts",
554
553
  "size": 221,
@@ -560,7 +559,7 @@
560
559
  "dependents": [
561
560
  "/src/unstable-core-do-not-import.ts"
562
561
  ],
563
- "percent": 0.25,
562
+ "percent": 0.26,
564
563
  "reduction": 94.55
565
564
  },
566
565
  {
@@ -633,9 +632,9 @@
633
632
  "reduction": 100
634
633
  },
635
634
  {
636
- "id": "/src/rpc.ts",
635
+ "id": "/src/index.ts",
637
636
  "size": 0,
638
- "origSize": 36,
637
+ "origSize": 32,
639
638
  "renderedExports": [],
640
639
  "removedExports": [],
641
640
  "dependents": [],
@@ -643,9 +642,9 @@
643
642
  "reduction": 100
644
643
  },
645
644
  {
646
- "id": "/src/index.ts",
645
+ "id": "/src/rpc.ts",
647
646
  "size": 0,
648
- "origSize": 32,
647
+ "origSize": 36,
649
648
  "renderedExports": [],
650
649
  "removedExports": [],
651
650
  "dependents": [],
@@ -653,9 +652,9 @@
653
652
  "reduction": 100
654
653
  },
655
654
  {
656
- "id": "/src/shared.ts",
655
+ "id": "/src/unstable-core-do-not-import.ts",
657
656
  "size": 0,
658
- "origSize": 653,
657
+ "origSize": 1908,
659
658
  "renderedExports": [],
660
659
  "removedExports": [],
661
660
  "dependents": [],
@@ -663,9 +662,9 @@
663
662
  "reduction": 100
664
663
  },
665
664
  {
666
- "id": "/src/unstable-core-do-not-import.ts",
665
+ "id": "/src/shared.ts",
667
666
  "size": 0,
668
- "origSize": 1909,
667
+ "origSize": 653,
669
668
  "renderedExports": [],
670
669
  "removedExports": [],
671
670
  "dependents": [],
@@ -722,8 +721,8 @@
722
721
  "removedExports": [],
723
722
  "dependents": [
724
723
  "/src/adapters/express.ts",
725
- "/src/adapters/next.ts",
726
724
  "/src/adapters/standalone.ts",
725
+ "/src/adapters/next.ts",
727
726
  "/src/adapters/fastify/fastifyRequestHandler.ts"
728
727
  ],
729
728
  "percent": 0,
package/dist/http.js CHANGED
@@ -12,6 +12,6 @@ require('./unstable-core-do-not-import/rootConfig.js');
12
12
  exports.getHTTPStatusCode = getHTTPStatusCode.getHTTPStatusCode;
13
13
  exports.getHTTPStatusCodeFromError = getHTTPStatusCode.getHTTPStatusCodeFromError;
14
14
  exports.getBatchStreamFormatter = batchStreamFormatter.getBatchStreamFormatter;
15
- exports.parseOctetInput = contentTypeParsers.parseOctetInput;
15
+ exports.octetInputParser = contentTypeParsers.octetInputParser;
16
16
  exports.resolveResponse = resolveResponse.resolveResponse;
17
17
  exports.toURL = toURL.toURL;
package/dist/http.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  export { getHTTPStatusCode, getHTTPStatusCodeFromError } from './unstable-core-do-not-import/http/getHTTPStatusCode.mjs';
2
2
  export { getBatchStreamFormatter } from './unstable-core-do-not-import/http/batchStreamFormatter.mjs';
3
- export { parseOctetInput } from './unstable-core-do-not-import/http/contentTypeParsers.mjs';
3
+ export { octetInputParser } from './unstable-core-do-not-import/http/contentTypeParsers.mjs';
4
4
  export { resolveResponse } from './unstable-core-do-not-import/http/resolveResponse.mjs';
5
5
  export { toURL } from './unstable-core-do-not-import/http/toURL.mjs';
6
6
  import './unstable-core-do-not-import/rootConfig.mjs';
@@ -1,5 +1,5 @@
1
1
  import type { ParserZodEsque } from '../parser';
2
- export type UtilityParser<TInput, TOutput> = ParserZodEsque<TInput, TOutput> & {
2
+ type UtilityParser<TInput, TOutput> = ParserZodEsque<TInput, TOutput> & {
3
3
  parse: (input: unknown) => TOutput;
4
4
  };
5
5
  /**
@@ -8,9 +8,7 @@ export type UtilityParser<TInput, TOutput> = ParserZodEsque<TInput, TOutput> & {
8
8
  interface FileLike extends Blob {
9
9
  readonly name: string;
10
10
  }
11
- /**
12
- * When expecting a supported octet type to be passed from the frontend, this parser may be used to validate the type for your procedure. Note: the output is always a `Readable` stream.
13
- */
14
- export declare function parseOctetInput<TInput extends Blob | Uint8Array | FileLike>(): UtilityParser<TInput, ReadableStream>;
11
+ type OctetInput = Blob | Uint8Array | FileLike;
12
+ export declare const octetInputParser: UtilityParser<OctetInput, ReadableStream>;
15
13
  export {};
16
14
  //# sourceMappingURL=contentTypeParsers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contentTypeParsers.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/contentTypeParsers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,MAAM,aAAa,CAAC,MAAM,EAAE,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAC7E,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CACpC,CAAC;AAIF;;GAEG;AACH,UAAU,QAAS,SAAQ,IAAI;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,MAAM,SAAS,IAAI,GAAG,UAAU,GAAG,QAAQ,KACxC,aAAa,CAAC,MAAM,EAAE,cAAc,CAAC,CAezC"}
1
+ {"version":3,"file":"contentTypeParsers.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/contentTypeParsers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,KAAK,aAAa,CAAC,MAAM,EAAE,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IACtE,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CACpC,CAAC;AAIF;;GAEG;AACH,UAAU,QAAS,SAAQ,IAAI;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,KAAK,UAAU,GAAG,IAAI,GAAG,UAAU,GAAG,QAAQ,CAAC;AAC/C,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC,UAAU,EAAE,cAAc,CAYtE,CAAC"}
@@ -1,23 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var TRPCError = require('../error/TRPCError.js');
4
-
5
- /**
6
- * When expecting a supported octet type to be passed from the frontend, this parser may be used to validate the type for your procedure. Note: the output is always a `Readable` stream.
7
- */ function parseOctetInput() {
8
- return {
9
- _input: null,
10
- _output: null,
11
- parse (input) {
12
- if (input instanceof ReadableStream) {
13
- return input;
14
- }
15
- throw new TRPCError.TRPCError({
16
- code: 'INTERNAL_SERVER_ERROR',
17
- cause: `Parsed input was expected to be a ReadableStream but was: ${typeof input}`
18
- });
3
+ const octetInputParser = {
4
+ _input: null,
5
+ _output: null,
6
+ parse (input) {
7
+ if (input instanceof ReadableStream) {
8
+ return input;
19
9
  }
20
- };
21
- }
10
+ throw new Error(`Parsed input was expected to be a ReadableStream but was: ${typeof input}`);
11
+ }
12
+ };
22
13
 
23
- exports.parseOctetInput = parseOctetInput;
14
+ exports.octetInputParser = octetInputParser;
@@ -1,21 +1,12 @@
1
- import { TRPCError } from '../error/TRPCError.mjs';
2
-
3
- /**
4
- * When expecting a supported octet type to be passed from the frontend, this parser may be used to validate the type for your procedure. Note: the output is always a `Readable` stream.
5
- */ function parseOctetInput() {
6
- return {
7
- _input: null,
8
- _output: null,
9
- parse (input) {
10
- if (input instanceof ReadableStream) {
11
- return input;
12
- }
13
- throw new TRPCError({
14
- code: 'INTERNAL_SERVER_ERROR',
15
- cause: `Parsed input was expected to be a ReadableStream but was: ${typeof input}`
16
- });
1
+ const octetInputParser = {
2
+ _input: null,
3
+ _output: null,
4
+ parse (input) {
5
+ if (input instanceof ReadableStream) {
6
+ return input;
17
7
  }
18
- };
19
- }
8
+ throw new Error(`Parsed input was expected to be a ReadableStream but was: ${typeof input}`);
9
+ }
10
+ };
20
11
 
21
- export { parseOctetInput };
12
+ export { octetInputParser };
@@ -34,7 +34,7 @@ exports.defaultFormatter = formatter.defaultFormatter;
34
34
  exports.getErrorShape = getErrorShape.getErrorShape;
35
35
  exports.getBatchStreamFormatter = batchStreamFormatter.getBatchStreamFormatter;
36
36
  exports.getContentTypeHandlerOrThrow = contentType.getContentTypeHandlerOrThrow;
37
- exports.parseOctetInput = contentTypeParsers.parseOctetInput;
37
+ exports.octetInputParser = contentTypeParsers.octetInputParser;
38
38
  exports.getHTTPStatusCode = getHTTPStatusCode.getHTTPStatusCode;
39
39
  exports.getHTTPStatusCodeFromError = getHTTPStatusCode.getHTTPStatusCodeFromError;
40
40
  exports.resolveResponse = resolveResponse.resolveResponse;
@@ -4,7 +4,7 @@ export { defaultFormatter } from './unstable-core-do-not-import/error/formatter.
4
4
  export { getErrorShape } from './unstable-core-do-not-import/error/getErrorShape.mjs';
5
5
  export { getBatchStreamFormatter } from './unstable-core-do-not-import/http/batchStreamFormatter.mjs';
6
6
  export { getContentTypeHandlerOrThrow } from './unstable-core-do-not-import/http/contentType.mjs';
7
- export { parseOctetInput } from './unstable-core-do-not-import/http/contentTypeParsers.mjs';
7
+ export { octetInputParser } from './unstable-core-do-not-import/http/contentTypeParsers.mjs';
8
8
  export { getHTTPStatusCode, getHTTPStatusCodeFromError } from './unstable-core-do-not-import/http/getHTTPStatusCode.mjs';
9
9
  export { resolveResponse } from './unstable-core-do-not-import/http/resolveResponse.mjs';
10
10
  export { toURL } from './unstable-core-do-not-import/http/toURL.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/server",
3
- "version": "11.0.0-alpha-tmp-04-26-resolveResponse-and-multi.415+b11c38729",
3
+ "version": "11.0.0-alpha-tmp-04-26-resolveResponse-and-multi.417+be4bf9001",
4
4
  "description": "The tRPC server library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -149,5 +149,5 @@
149
149
  "funding": [
150
150
  "https://trpc.io/sponsor"
151
151
  ],
152
- "gitHead": "b11c38729a9d3a100ce9730e1bb806fa307d0295"
152
+ "gitHead": "be4bf900105f01a954b87236dc8f07708e8c28ac"
153
153
  }
@@ -18,4 +18,4 @@ export type {
18
18
  } from '../../unstable-core-do-not-import';
19
19
 
20
20
  export { getBatchStreamFormatter } from '../../unstable-core-do-not-import';
21
- export { parseOctetInput, toURL } from '../../unstable-core-do-not-import';
21
+ export { octetInputParser, toURL } from '../../unstable-core-do-not-import';
@@ -1,7 +1,6 @@
1
- import { TRPCError } from '../error/TRPCError';
2
1
  import type { ParserZodEsque } from '../parser';
3
2
 
4
- export type UtilityParser<TInput, TOutput> = ParserZodEsque<TInput, TOutput> & {
3
+ type UtilityParser<TInput, TOutput> = ParserZodEsque<TInput, TOutput> & {
5
4
  parse: (input: unknown) => TOutput;
6
5
  };
7
6
 
@@ -14,24 +13,17 @@ interface FileLike extends Blob {
14
13
  readonly name: string;
15
14
  }
16
15
 
17
- /**
18
- * When expecting a supported octet type to be passed from the frontend, this parser may be used to validate the type for your procedure. Note: the output is always a `Readable` stream.
19
- */
20
- export function parseOctetInput<
21
- TInput extends Blob | Uint8Array | FileLike,
22
- >(): UtilityParser<TInput, ReadableStream> {
23
- return {
24
- _input: null as any as TInput,
25
- _output: null as any as ReadableStream,
26
- parse(input: unknown) {
27
- if (input instanceof ReadableStream) {
28
- return input;
29
- }
16
+ type OctetInput = Blob | Uint8Array | FileLike;
17
+ export const octetInputParser: UtilityParser<OctetInput, ReadableStream> = {
18
+ _input: null as any as OctetInput,
19
+ _output: null as any as ReadableStream,
20
+ parse(input) {
21
+ if (input instanceof ReadableStream) {
22
+ return input;
23
+ }
30
24
 
31
- throw new TRPCError({
32
- code: 'INTERNAL_SERVER_ERROR',
33
- cause: `Parsed input was expected to be a ReadableStream but was: ${typeof input}`,
34
- });
35
- },
36
- };
37
- }
25
+ throw new Error(
26
+ `Parsed input was expected to be a ReadableStream but was: ${typeof input}`,
27
+ );
28
+ },
29
+ };
@@ -33,4 +33,3 @@ export * from './unstable-core-do-not-import/rpc';
33
33
  export * from './unstable-core-do-not-import/transformer';
34
34
  export * from './unstable-core-do-not-import/types';
35
35
  export * from './unstable-core-do-not-import/utils';
36
-