@trpc/server 11.0.0-next-beta.242 → 11.0.0-next-beta.248

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.
Files changed (29) hide show
  1. package/dist/@trpc/server/index.d.ts +1 -5
  2. package/dist/@trpc/server/index.d.ts.map +1 -1
  3. package/dist/adapters/node-http/content-type/form-data/index.js +2 -2
  4. package/dist/adapters/node-http/content-type/form-data/index.mjs +1 -1
  5. package/dist/bundle-analysis.json +65 -123
  6. package/dist/unstable-core-do-not-import/index.d.ts +1 -1
  7. package/dist/unstable-core-do-not-import/index.d.ts.map +1 -1
  8. package/dist/unstable-core-do-not-import/initTRPC.d.ts +15 -7
  9. package/dist/unstable-core-do-not-import/initTRPC.d.ts.map +1 -1
  10. package/dist/unstable-core-do-not-import/router.d.ts +25 -18
  11. package/dist/unstable-core-do-not-import/router.d.ts.map +1 -1
  12. package/dist/unstable-core-do-not-import/router.js +36 -19
  13. package/dist/unstable-core-do-not-import/router.mjs +37 -20
  14. package/dist/unstable-core-do-not-import/rpc/codes.d.ts +1 -2
  15. package/dist/unstable-core-do-not-import/rpc/codes.d.ts.map +1 -1
  16. package/dist/unstable-core-do-not-import/types.d.ts +1 -0
  17. package/dist/unstable-core-do-not-import/types.d.ts.map +1 -1
  18. package/package.json +2 -2
  19. package/src/@trpc/server/index.ts +1 -5
  20. package/src/unstable-core-do-not-import/index.ts +0 -2
  21. package/src/unstable-core-do-not-import/router.ts +84 -54
  22. package/src/unstable-core-do-not-import/rpc/codes.ts +1 -1
  23. package/src/unstable-core-do-not-import/types.ts +1 -0
  24. package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/index.js +0 -203
  25. package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/index.mjs +0 -201
  26. package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/search.js +0 -167
  27. package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/search.mjs +0 -163
  28. package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/utils.js +0 -35
  29. package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/utils.mjs +0 -30
@@ -1,167 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('./utils.js');
4
-
5
- function coerce(a) {
6
- if (a instanceof Uint8Array) {
7
- return index => a[index];
8
- }
9
- return a;
10
- }
11
- function jsmemcmp(buf1, pos1, buf2, pos2, len) {
12
- const fn1 = coerce(buf1);
13
- const fn2 = coerce(buf2);
14
- for (let i = 0; i < len; ++i) {
15
- if (fn1(pos1 + i) !== fn2(pos2 + i)) {
16
- return false;
17
- }
18
- }
19
- return true;
20
- }
21
- function createOccurenceTable(s) {
22
- const table = new Array(256).fill(s.length);
23
- if (s.length > 1) {
24
- for (let i = 0; i < s.length - 1; i++) {
25
- table[s[i]] = s.length - 1 - i;
26
- }
27
- }
28
- return table;
29
- }
30
- const MATCH = Symbol('Match');
31
- class StreamSearch {
32
- constructor(needle) {
33
- this._lookbehind = new Uint8Array();
34
- if (typeof needle === 'string') {
35
- this._needle = needle = utils.stringToArray(needle);
36
- } else {
37
- this._needle = needle;
38
- }
39
- this._lastChar = needle[needle.length - 1];
40
- this._occ = createOccurenceTable(needle);
41
- }
42
- feed(chunk) {
43
- let pos = 0;
44
- let tokens;
45
- const allTokens = [];
46
- while (pos !== chunk.length) {
47
- [pos, ...tokens] = this._feed(chunk, pos);
48
- allTokens.push(...tokens);
49
- }
50
- return allTokens;
51
- }
52
- end() {
53
- const tail = this._lookbehind;
54
- this._lookbehind = new Uint8Array();
55
- return tail;
56
- }
57
- _feed(data, bufPos) {
58
- const tokens = [];
59
- let pos = -this._lookbehind.length;
60
- if (pos < 0) {
61
- while (pos < 0 && pos <= data.length - this._needle.length) {
62
- const ch = this._charAt(data, pos + this._needle.length - 1);
63
- if (ch === this._lastChar && this._memcmp(data, pos, this._needle.length - 1)) {
64
- if (pos > -this._lookbehind.length) {
65
- tokens.push(this._lookbehind.slice(0, this._lookbehind.length + pos));
66
- }
67
- tokens.push(MATCH);
68
- this._lookbehind = new Uint8Array();
69
- return [
70
- pos + this._needle.length,
71
- ...tokens
72
- ];
73
- } else {
74
- pos += this._occ[ch];
75
- }
76
- }
77
- if (pos < 0) {
78
- while (pos < 0 && !this._memcmp(data, pos, data.length - pos)) {
79
- pos++;
80
- }
81
- }
82
- if (pos >= 0) {
83
- tokens.push(this._lookbehind);
84
- this._lookbehind = new Uint8Array();
85
- } else {
86
- const bytesToCutOff = this._lookbehind.length + pos;
87
- if (bytesToCutOff > 0) {
88
- tokens.push(this._lookbehind.slice(0, bytesToCutOff));
89
- this._lookbehind = this._lookbehind.slice(bytesToCutOff);
90
- }
91
- this._lookbehind = Uint8Array.from(new Array(this._lookbehind.length + data.length), (_, i) => this._charAt(data, i - this._lookbehind.length));
92
- return [
93
- data.length,
94
- ...tokens
95
- ];
96
- }
97
- }
98
- pos += bufPos;
99
- while (pos <= data.length - this._needle.length) {
100
- const ch = data[pos + this._needle.length - 1];
101
- if (ch === this._lastChar && data[pos] === this._needle[0] && jsmemcmp(this._needle, 0, data, pos, this._needle.length - 1)) {
102
- if (pos > bufPos) {
103
- tokens.push(data.slice(bufPos, pos));
104
- }
105
- tokens.push(MATCH);
106
- return [
107
- pos + this._needle.length,
108
- ...tokens
109
- ];
110
- } else {
111
- pos += this._occ[ch];
112
- }
113
- }
114
- if (pos < data.length) {
115
- while (pos < data.length && (data[pos] !== this._needle[0] || !jsmemcmp(data, pos, this._needle, 0, data.length - pos))) {
116
- ++pos;
117
- }
118
- if (pos < data.length) {
119
- this._lookbehind = data.slice(pos);
120
- }
121
- }
122
- if (pos > 0) {
123
- tokens.push(data.slice(bufPos, pos < data.length ? pos : data.length));
124
- }
125
- return [
126
- data.length,
127
- ...tokens
128
- ];
129
- }
130
- _charAt(data, pos) {
131
- if (pos < 0) {
132
- return this._lookbehind[this._lookbehind.length + pos];
133
- }
134
- return data[pos];
135
- }
136
- _memcmp(data, pos, len) {
137
- return jsmemcmp(this._charAt.bind(this, data), pos, this._needle, 0, len);
138
- }
139
- }
140
- class ReadableStreamSearch {
141
- constructor(needle, _readableStream) {
142
- this._readableStream = _readableStream;
143
- this._search = new StreamSearch(needle);
144
- }
145
- async *[Symbol.asyncIterator]() {
146
- const reader = this._readableStream.getReader();
147
- try {
148
- while (true) {
149
- const result = await reader.read();
150
- if (result.done) {
151
- break;
152
- }
153
- yield* this._search.feed(result.value);
154
- }
155
- const tail = this._search.end();
156
- if (tail.length) {
157
- yield tail;
158
- }
159
- } finally {
160
- reader.releaseLock();
161
- }
162
- }
163
- }
164
-
165
- exports.MATCH = MATCH;
166
- exports.ReadableStreamSearch = ReadableStreamSearch;
167
- exports.StreamSearch = StreamSearch;
@@ -1,163 +0,0 @@
1
- import { stringToArray } from './utils.mjs';
2
-
3
- function coerce(a) {
4
- if (a instanceof Uint8Array) {
5
- return index => a[index];
6
- }
7
- return a;
8
- }
9
- function jsmemcmp(buf1, pos1, buf2, pos2, len) {
10
- const fn1 = coerce(buf1);
11
- const fn2 = coerce(buf2);
12
- for (let i = 0; i < len; ++i) {
13
- if (fn1(pos1 + i) !== fn2(pos2 + i)) {
14
- return false;
15
- }
16
- }
17
- return true;
18
- }
19
- function createOccurenceTable(s) {
20
- const table = new Array(256).fill(s.length);
21
- if (s.length > 1) {
22
- for (let i = 0; i < s.length - 1; i++) {
23
- table[s[i]] = s.length - 1 - i;
24
- }
25
- }
26
- return table;
27
- }
28
- const MATCH = Symbol('Match');
29
- class StreamSearch {
30
- constructor(needle) {
31
- this._lookbehind = new Uint8Array();
32
- if (typeof needle === 'string') {
33
- this._needle = needle = stringToArray(needle);
34
- } else {
35
- this._needle = needle;
36
- }
37
- this._lastChar = needle[needle.length - 1];
38
- this._occ = createOccurenceTable(needle);
39
- }
40
- feed(chunk) {
41
- let pos = 0;
42
- let tokens;
43
- const allTokens = [];
44
- while (pos !== chunk.length) {
45
- [pos, ...tokens] = this._feed(chunk, pos);
46
- allTokens.push(...tokens);
47
- }
48
- return allTokens;
49
- }
50
- end() {
51
- const tail = this._lookbehind;
52
- this._lookbehind = new Uint8Array();
53
- return tail;
54
- }
55
- _feed(data, bufPos) {
56
- const tokens = [];
57
- let pos = -this._lookbehind.length;
58
- if (pos < 0) {
59
- while (pos < 0 && pos <= data.length - this._needle.length) {
60
- const ch = this._charAt(data, pos + this._needle.length - 1);
61
- if (ch === this._lastChar && this._memcmp(data, pos, this._needle.length - 1)) {
62
- if (pos > -this._lookbehind.length) {
63
- tokens.push(this._lookbehind.slice(0, this._lookbehind.length + pos));
64
- }
65
- tokens.push(MATCH);
66
- this._lookbehind = new Uint8Array();
67
- return [
68
- pos + this._needle.length,
69
- ...tokens
70
- ];
71
- } else {
72
- pos += this._occ[ch];
73
- }
74
- }
75
- if (pos < 0) {
76
- while (pos < 0 && !this._memcmp(data, pos, data.length - pos)) {
77
- pos++;
78
- }
79
- }
80
- if (pos >= 0) {
81
- tokens.push(this._lookbehind);
82
- this._lookbehind = new Uint8Array();
83
- } else {
84
- const bytesToCutOff = this._lookbehind.length + pos;
85
- if (bytesToCutOff > 0) {
86
- tokens.push(this._lookbehind.slice(0, bytesToCutOff));
87
- this._lookbehind = this._lookbehind.slice(bytesToCutOff);
88
- }
89
- this._lookbehind = Uint8Array.from(new Array(this._lookbehind.length + data.length), (_, i) => this._charAt(data, i - this._lookbehind.length));
90
- return [
91
- data.length,
92
- ...tokens
93
- ];
94
- }
95
- }
96
- pos += bufPos;
97
- while (pos <= data.length - this._needle.length) {
98
- const ch = data[pos + this._needle.length - 1];
99
- if (ch === this._lastChar && data[pos] === this._needle[0] && jsmemcmp(this._needle, 0, data, pos, this._needle.length - 1)) {
100
- if (pos > bufPos) {
101
- tokens.push(data.slice(bufPos, pos));
102
- }
103
- tokens.push(MATCH);
104
- return [
105
- pos + this._needle.length,
106
- ...tokens
107
- ];
108
- } else {
109
- pos += this._occ[ch];
110
- }
111
- }
112
- if (pos < data.length) {
113
- while (pos < data.length && (data[pos] !== this._needle[0] || !jsmemcmp(data, pos, this._needle, 0, data.length - pos))) {
114
- ++pos;
115
- }
116
- if (pos < data.length) {
117
- this._lookbehind = data.slice(pos);
118
- }
119
- }
120
- if (pos > 0) {
121
- tokens.push(data.slice(bufPos, pos < data.length ? pos : data.length));
122
- }
123
- return [
124
- data.length,
125
- ...tokens
126
- ];
127
- }
128
- _charAt(data, pos) {
129
- if (pos < 0) {
130
- return this._lookbehind[this._lookbehind.length + pos];
131
- }
132
- return data[pos];
133
- }
134
- _memcmp(data, pos, len) {
135
- return jsmemcmp(this._charAt.bind(this, data), pos, this._needle, 0, len);
136
- }
137
- }
138
- class ReadableStreamSearch {
139
- constructor(needle, _readableStream) {
140
- this._readableStream = _readableStream;
141
- this._search = new StreamSearch(needle);
142
- }
143
- async *[Symbol.asyncIterator]() {
144
- const reader = this._readableStream.getReader();
145
- try {
146
- while (true) {
147
- const result = await reader.read();
148
- if (result.done) {
149
- break;
150
- }
151
- yield* this._search.feed(result.value);
152
- }
153
- const tail = this._search.end();
154
- if (tail.length) {
155
- yield tail;
156
- }
157
- } finally {
158
- reader.releaseLock();
159
- }
160
- }
161
- }
162
-
163
- export { MATCH, ReadableStreamSearch, StreamSearch };
@@ -1,35 +0,0 @@
1
- 'use strict';
2
-
3
- function stringToArray(s) {
4
- const utf8 = unescape(encodeURIComponent(s));
5
- return Uint8Array.from(utf8, (_, i) => utf8.charCodeAt(i));
6
- }
7
- function arrayToString(a) {
8
- const utf8 = String.fromCharCode.apply(null, a);
9
- return decodeURIComponent(escape(utf8));
10
- }
11
- function mergeArrays(...arrays) {
12
- const out = new Uint8Array(arrays.reduce((total, arr) => total + arr.length, 0));
13
- let offset = 0;
14
- for (const arr of arrays) {
15
- out.set(arr, offset);
16
- offset += arr.length;
17
- }
18
- return out;
19
- }
20
- function arraysEqual(a, b) {
21
- if (a.length !== b.length) {
22
- return false;
23
- }
24
- for (let i = 0; i < a.length; i++) {
25
- if (a[i] !== b[i]) {
26
- return false;
27
- }
28
- }
29
- return true;
30
- }
31
-
32
- exports.arrayToString = arrayToString;
33
- exports.arraysEqual = arraysEqual;
34
- exports.mergeArrays = mergeArrays;
35
- exports.stringToArray = stringToArray;
@@ -1,30 +0,0 @@
1
- function stringToArray(s) {
2
- const utf8 = unescape(encodeURIComponent(s));
3
- return Uint8Array.from(utf8, (_, i) => utf8.charCodeAt(i));
4
- }
5
- function arrayToString(a) {
6
- const utf8 = String.fromCharCode.apply(null, a);
7
- return decodeURIComponent(escape(utf8));
8
- }
9
- function mergeArrays(...arrays) {
10
- const out = new Uint8Array(arrays.reduce((total, arr) => total + arr.length, 0));
11
- let offset = 0;
12
- for (const arr of arrays) {
13
- out.set(arr, offset);
14
- offset += arr.length;
15
- }
16
- return out;
17
- }
18
- function arraysEqual(a, b) {
19
- if (a.length !== b.length) {
20
- return false;
21
- }
22
- for (let i = 0; i < a.length; i++) {
23
- if (a[i] !== b[i]) {
24
- return false;
25
- }
26
- }
27
- return true;
28
- }
29
-
30
- export { arrayToString, arraysEqual, mergeArrays, stringToArray };