@trpc/server 11.0.0-alpha-tmp-export-from-main-nuke-core.219 → 11.0.0-alpha-tmp-export-from-main.211

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 (209) hide show
  1. package/dist/@trpc-core-unstable-do-not-import-this-please.d.ts +9 -0
  2. package/dist/@trpc-core-unstable-do-not-import-this-please.d.ts.map +1 -0
  3. package/dist/@trpc-server/http.d.ts +1 -1
  4. package/dist/@trpc-server/http.d.ts.map +1 -1
  5. package/dist/@trpc-server.d.ts +3 -3
  6. package/dist/@trpc-server.d.ts.map +1 -1
  7. package/dist/adapters/aws-lambda/index.d.ts +1 -1
  8. package/dist/adapters/aws-lambda/index.js +7 -13
  9. package/dist/adapters/aws-lambda/index.mjs +3 -9
  10. package/dist/adapters/aws-lambda/utils.d.ts +1 -1
  11. package/dist/adapters/express.d.ts +1 -1
  12. package/dist/adapters/express.d.ts.map +1 -1
  13. package/dist/adapters/express.js +2 -9
  14. package/dist/adapters/express.mjs +2 -9
  15. package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts +1 -1
  16. package/dist/adapters/fastify/index.js +4 -13
  17. package/dist/adapters/fastify/index.mjs +2 -11
  18. package/dist/adapters/fetch/fetchRequestHandler.d.ts +1 -1
  19. package/dist/adapters/fetch/index.js +4 -11
  20. package/dist/adapters/fetch/index.mjs +2 -9
  21. package/dist/adapters/fetch/types.d.ts +1 -1
  22. package/dist/adapters/next.d.ts +1 -1
  23. package/dist/adapters/next.js +5 -12
  24. package/dist/adapters/next.mjs +3 -10
  25. package/dist/adapters/node-http/content-type/json/index.js +3 -6
  26. package/dist/adapters/node-http/content-type/json/index.mjs +1 -4
  27. package/dist/adapters/node-http/index.js +2 -9
  28. package/dist/adapters/node-http/index.mjs +2 -9
  29. package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts +1 -1
  30. package/dist/adapters/node-http/types.d.ts +2 -2
  31. package/dist/adapters/node-http/types.d.ts.map +1 -1
  32. package/dist/adapters/standalone.d.ts +1 -1
  33. package/dist/adapters/standalone.js +2 -9
  34. package/dist/adapters/standalone.mjs +2 -9
  35. package/dist/adapters/ws.d.ts +1 -2
  36. package/dist/adapters/ws.d.ts.map +1 -1
  37. package/dist/adapters/ws.js +26 -32
  38. package/dist/adapters/ws.mjs +1 -7
  39. package/dist/http.d.ts +6 -6
  40. package/dist/http.d.ts.map +1 -1
  41. package/dist/http.js +21 -13
  42. package/dist/http.mjs +1 -8
  43. package/dist/index.js +41 -16
  44. package/dist/index.mjs +1 -6
  45. package/dist/{nodeHTTPRequestHandler-d8558115.mjs → nodeHTTPRequestHandler-2d5c8791.mjs} +2 -4
  46. package/dist/{nodeHTTPRequestHandler-0bc1dc41.js → nodeHTTPRequestHandler-55f05150.js} +4 -6
  47. package/dist/{nodeHTTPRequestHandler-c7d41cde.js → nodeHTTPRequestHandler-7691fc79.js} +1 -3
  48. package/dist/observable.d.ts +3 -0
  49. package/dist/observable.d.ts.map +1 -0
  50. package/dist/observable.js +32 -0
  51. package/dist/observable.mjs +1 -0
  52. package/dist/rpc.d.ts +2 -2
  53. package/dist/rpc.d.ts.map +1 -1
  54. package/dist/rpc.js +13 -6
  55. package/dist/rpc.mjs +1 -3
  56. package/dist/shared.js +9 -5
  57. package/dist/shared.mjs +1 -3
  58. package/package.json +125 -53
  59. package/src/@trpc-core-unstable-do-not-import-this-please.ts +9 -0
  60. package/src/@trpc-server/http.ts +1 -2
  61. package/src/@trpc-server.ts +3 -3
  62. package/src/adapters/aws-lambda/index.ts +1 -1
  63. package/src/adapters/aws-lambda/utils.ts +1 -1
  64. package/src/adapters/express.ts +2 -1
  65. package/src/adapters/fastify/fastifyRequestHandler.ts +1 -1
  66. package/src/adapters/fastify/fastifyTRPCPlugin.ts +1 -1
  67. package/src/adapters/fetch/fetchRequestHandler.ts +1 -1
  68. package/src/adapters/fetch/types.ts +1 -1
  69. package/src/adapters/next.ts +1 -1
  70. package/src/adapters/node-http/nodeHTTPRequestHandler.ts +1 -1
  71. package/src/adapters/node-http/types.ts +3 -2
  72. package/src/adapters/standalone.ts +1 -1
  73. package/src/adapters/ws.ts +10 -9
  74. package/src/http.ts +6 -6
  75. package/src/observable.ts +16 -0
  76. package/src/rpc.ts +2 -2
  77. package/dist/TRPCError-57838b33.js +0 -67
  78. package/dist/TRPCError-af754aba.mjs +0 -63
  79. package/dist/TRPCError-ebbde27d.js +0 -61
  80. package/dist/batchStreamFormatter-1971db27.js +0 -32
  81. package/dist/batchStreamFormatter-378277dc.mjs +0 -30
  82. package/dist/batchStreamFormatter-4375dc8b.js +0 -31
  83. package/dist/bundle-analysis.json +0 -770
  84. package/dist/contentType-9756da28.js +0 -59
  85. package/dist/contentType-b31eab56.js +0 -54
  86. package/dist/contentType-f93c6ba8.mjs +0 -52
  87. package/dist/createProxy-7293f632.mjs +0 -121
  88. package/dist/createProxy-c5cd21e8.js +0 -127
  89. package/dist/createProxy-f6960c7b.js +0 -116
  90. package/dist/initTRPC-6c16fa27.mjs +0 -377
  91. package/dist/initTRPC-8b5714ea.js +0 -385
  92. package/dist/initTRPC-b65b35e2.js +0 -372
  93. package/dist/observable/index.d.ts +0 -5
  94. package/dist/observable/index.d.ts.map +0 -1
  95. package/dist/observable/index.js +0 -111
  96. package/dist/observable/index.mjs +0 -102
  97. package/dist/observable/observable.d.ts +0 -13
  98. package/dist/observable/observable.d.ts.map +0 -1
  99. package/dist/observable/operators.d.ts +0 -8
  100. package/dist/observable/operators.d.ts.map +0 -1
  101. package/dist/observable/types.d.ts +0 -26
  102. package/dist/observable/types.d.ts.map +0 -1
  103. package/dist/observable-7233bd21.mjs +0 -121
  104. package/dist/observable-7865c812.js +0 -125
  105. package/dist/observable-cbbc588a.js +0 -125
  106. package/dist/parseTRPCMessage-3ae1b295.js +0 -67
  107. package/dist/parseTRPCMessage-abbd6862.mjs +0 -62
  108. package/dist/parseTRPCMessage-c6022e94.js +0 -65
  109. package/dist/resolveHTTPResponse-3133d603.js +0 -265
  110. package/dist/resolveHTTPResponse-80c99f62.mjs +0 -291
  111. package/dist/resolveHTTPResponse-9e260431.js +0 -293
  112. package/dist/rootConfig-a1ad09d0.js +0 -48
  113. package/dist/rootConfig-db88d377.js +0 -44
  114. package/dist/rootConfig-f741a4e7.mjs +0 -40
  115. package/dist/router-68063d64.mjs +0 -252
  116. package/dist/router-7a7bb4fd.js +0 -262
  117. package/dist/router-c5bd7780.js +0 -259
  118. package/dist/unstable-core-do-not-import/TRPCInferrable.d.ts +0 -6
  119. package/dist/unstable-core-do-not-import/TRPCInferrable.d.ts.map +0 -1
  120. package/dist/unstable-core-do-not-import/createProxy.d.ts +0 -19
  121. package/dist/unstable-core-do-not-import/createProxy.d.ts.map +0 -1
  122. package/dist/unstable-core-do-not-import/error/TRPCError.d.ts +0 -13
  123. package/dist/unstable-core-do-not-import/error/TRPCError.d.ts.map +0 -1
  124. package/dist/unstable-core-do-not-import/error/formatter.d.ts +0 -33
  125. package/dist/unstable-core-do-not-import/error/formatter.d.ts.map +0 -1
  126. package/dist/unstable-core-do-not-import/error/getErrorShape.d.ts +0 -15
  127. package/dist/unstable-core-do-not-import/error/getErrorShape.d.ts.map +0 -1
  128. package/dist/unstable-core-do-not-import/http/batchStreamFormatter.d.ts +0 -24
  129. package/dist/unstable-core-do-not-import/http/batchStreamFormatter.d.ts.map +0 -1
  130. package/dist/unstable-core-do-not-import/http/contentType.d.ts +0 -29
  131. package/dist/unstable-core-do-not-import/http/contentType.d.ts.map +0 -1
  132. package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts +0 -5
  133. package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts.map +0 -1
  134. package/dist/unstable-core-do-not-import/http/index.d.ts +0 -7
  135. package/dist/unstable-core-do-not-import/http/index.d.ts.map +0 -1
  136. package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.d.ts +0 -51
  137. package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.d.ts.map +0 -1
  138. package/dist/unstable-core-do-not-import/http/types.d.ts +0 -96
  139. package/dist/unstable-core-do-not-import/http/types.d.ts.map +0 -1
  140. package/dist/unstable-core-do-not-import/index.d.ts +0 -34
  141. package/dist/unstable-core-do-not-import/index.d.ts.map +0 -1
  142. package/dist/unstable-core-do-not-import/index.js +0 -44
  143. package/dist/unstable-core-do-not-import/index.mjs +0 -10
  144. package/dist/unstable-core-do-not-import/initTRPC.d.ts +0 -96
  145. package/dist/unstable-core-do-not-import/initTRPC.d.ts.map +0 -1
  146. package/dist/unstable-core-do-not-import/middleware.d.ts +0 -105
  147. package/dist/unstable-core-do-not-import/middleware.d.ts.map +0 -1
  148. package/dist/unstable-core-do-not-import/parser.d.ts +0 -30
  149. package/dist/unstable-core-do-not-import/parser.d.ts.map +0 -1
  150. package/dist/unstable-core-do-not-import/procedure.d.ts +0 -72
  151. package/dist/unstable-core-do-not-import/procedure.d.ts.map +0 -1
  152. package/dist/unstable-core-do-not-import/procedureBuilder.d.ts +0 -101
  153. package/dist/unstable-core-do-not-import/procedureBuilder.d.ts.map +0 -1
  154. package/dist/unstable-core-do-not-import/rootConfig.d.ts +0 -75
  155. package/dist/unstable-core-do-not-import/rootConfig.d.ts.map +0 -1
  156. package/dist/unstable-core-do-not-import/router.d.ts +0 -85
  157. package/dist/unstable-core-do-not-import/router.d.ts.map +0 -1
  158. package/dist/unstable-core-do-not-import/rpc/codes.d.ts +0 -51
  159. package/dist/unstable-core-do-not-import/rpc/codes.d.ts.map +0 -1
  160. package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts +0 -97
  161. package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts.map +0 -1
  162. package/dist/unstable-core-do-not-import/rpc/index.d.ts +0 -5
  163. package/dist/unstable-core-do-not-import/rpc/index.d.ts.map +0 -1
  164. package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.d.ts +0 -5
  165. package/dist/unstable-core-do-not-import/rpc/parseTRPCMessage.d.ts.map +0 -1
  166. package/dist/unstable-core-do-not-import/serialize.d.ts +0 -62
  167. package/dist/unstable-core-do-not-import/serialize.d.ts.map +0 -1
  168. package/dist/unstable-core-do-not-import/transformer.d.ts +0 -107
  169. package/dist/unstable-core-do-not-import/transformer.d.ts.map +0 -1
  170. package/dist/unstable-core-do-not-import/types.d.ts +0 -98
  171. package/dist/unstable-core-do-not-import/types.d.ts.map +0 -1
  172. package/dist/unstable-core-do-not-import/utils.d.ts +0 -31
  173. package/dist/unstable-core-do-not-import/utils.d.ts.map +0 -1
  174. package/dist/utils-42a3ba6d.js +0 -50
  175. package/dist/utils-cf6178ec.mjs +0 -44
  176. package/dist/utils-e1d51fac.js +0 -49
  177. package/src/observable/index.ts +0 -10
  178. package/src/observable/observable.ts +0 -155
  179. package/src/observable/operators.ts +0 -119
  180. package/src/observable/types.ts +0 -76
  181. package/src/unstable-core-do-not-import/TRPCInferrable.ts +0 -9
  182. package/src/unstable-core-do-not-import/createProxy.ts +0 -59
  183. package/src/unstable-core-do-not-import/error/TRPCError.ts +0 -82
  184. package/src/unstable-core-do-not-import/error/formatter.ts +0 -51
  185. package/src/unstable-core-do-not-import/error/getErrorShape.ts +0 -36
  186. package/src/unstable-core-do-not-import/http/batchStreamFormatter.ts +0 -29
  187. package/src/unstable-core-do-not-import/http/contentType.ts +0 -99
  188. package/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts +0 -57
  189. package/src/unstable-core-do-not-import/http/index.ts +0 -23
  190. package/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts +0 -458
  191. package/src/unstable-core-do-not-import/http/types.ts +0 -111
  192. package/src/unstable-core-do-not-import/index.ts +0 -107
  193. package/src/unstable-core-do-not-import/initTRPC.ts +0 -206
  194. package/src/unstable-core-do-not-import/middleware.ts +0 -233
  195. package/src/unstable-core-do-not-import/parser.ts +0 -94
  196. package/src/unstable-core-do-not-import/procedure.ts +0 -108
  197. package/src/unstable-core-do-not-import/procedureBuilder.ts +0 -458
  198. package/src/unstable-core-do-not-import/rootConfig.ts +0 -90
  199. package/src/unstable-core-do-not-import/router.ts +0 -370
  200. package/src/unstable-core-do-not-import/rpc/codes.ts +0 -44
  201. package/src/unstable-core-do-not-import/rpc/envelopes.ts +0 -136
  202. package/src/unstable-core-do-not-import/rpc/index.ts +0 -21
  203. package/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts +0 -85
  204. package/src/unstable-core-do-not-import/serialize.ts +0 -122
  205. package/src/unstable-core-do-not-import/transformer.ts +0 -202
  206. package/src/unstable-core-do-not-import/types.ts +0 -151
  207. package/src/unstable-core-do-not-import/utils.ts +0 -66
  208. package/unstable-core-do-not-import/index.d.ts +0 -1
  209. package/unstable-core-do-not-import/index.js +0 -1
@@ -1,121 +0,0 @@
1
- import { b as identity } from './utils-cf6178ec.mjs';
2
-
3
- /** @public */ function isObservable(x) {
4
- return typeof x === 'object' && x !== null && 'subscribe' in x;
5
- }
6
- /** @public */ function observable(subscribe) {
7
- const self = {
8
- subscribe (observer) {
9
- let teardownRef = null;
10
- let isDone = false;
11
- let unsubscribed = false;
12
- let teardownImmediately = false;
13
- function unsubscribe() {
14
- if (teardownRef === null) {
15
- teardownImmediately = true;
16
- return;
17
- }
18
- if (unsubscribed) {
19
- return;
20
- }
21
- unsubscribed = true;
22
- if (typeof teardownRef === 'function') {
23
- teardownRef();
24
- } else if (teardownRef) {
25
- teardownRef.unsubscribe();
26
- }
27
- }
28
- teardownRef = subscribe({
29
- next (value) {
30
- if (isDone) {
31
- return;
32
- }
33
- observer.next?.(value);
34
- },
35
- error (err) {
36
- if (isDone) {
37
- return;
38
- }
39
- isDone = true;
40
- observer.error?.(err);
41
- unsubscribe();
42
- },
43
- complete () {
44
- if (isDone) {
45
- return;
46
- }
47
- isDone = true;
48
- observer.complete?.();
49
- unsubscribe();
50
- }
51
- });
52
- if (teardownImmediately) {
53
- unsubscribe();
54
- }
55
- return {
56
- unsubscribe
57
- };
58
- },
59
- pipe (...operations) {
60
- return pipeFromArray(operations)(self);
61
- }
62
- };
63
- return self;
64
- }
65
- function pipeFromArray(fns) {
66
- if (fns.length === 0) {
67
- return identity;
68
- }
69
- if (fns.length === 1) {
70
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
71
- return fns[0];
72
- }
73
- return function piped(input) {
74
- return fns.reduce((prev, fn)=>fn(prev), input);
75
- };
76
- }
77
- class ObservableAbortError extends Error {
78
- constructor(message){
79
- super(message);
80
- this.name = 'ObservableAbortError';
81
- Object.setPrototypeOf(this, ObservableAbortError.prototype);
82
- }
83
- }
84
- /** @internal */ function observableToPromise(observable) {
85
- let abort;
86
- const promise = new Promise((resolve, reject)=>{
87
- let isDone = false;
88
- function onDone() {
89
- if (isDone) {
90
- return;
91
- }
92
- isDone = true;
93
- reject(new ObservableAbortError('This operation was aborted.'));
94
- obs$.unsubscribe();
95
- }
96
- const obs$ = observable.subscribe({
97
- next (data) {
98
- isDone = true;
99
- resolve(data);
100
- onDone();
101
- },
102
- error (data) {
103
- isDone = true;
104
- reject(data);
105
- onDone();
106
- },
107
- complete () {
108
- isDone = true;
109
- onDone();
110
- }
111
- });
112
- abort = onDone;
113
- });
114
- return {
115
- promise,
116
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
117
- abort: abort
118
- };
119
- }
120
-
121
- export { observableToPromise as a, isObservable as i, observable as o };
@@ -1,125 +0,0 @@
1
- import { b as identity } from './utils-e1d51fac.js';
2
-
3
- /** @public */
4
- function isObservable(x) {
5
- return typeof x === 'object' && x !== null && 'subscribe' in x;
6
- }
7
- /** @public */
8
- function observable(subscribe) {
9
- const self = {
10
- subscribe(observer) {
11
- let teardownRef = null;
12
- let isDone = false;
13
- let unsubscribed = false;
14
- let teardownImmediately = false;
15
- function unsubscribe() {
16
- if (teardownRef === null) {
17
- teardownImmediately = true;
18
- return;
19
- }
20
- if (unsubscribed) {
21
- return;
22
- }
23
- unsubscribed = true;
24
- if (typeof teardownRef === 'function') {
25
- teardownRef();
26
- }
27
- else if (teardownRef) {
28
- teardownRef.unsubscribe();
29
- }
30
- }
31
- teardownRef = subscribe({
32
- next(value) {
33
- if (isDone) {
34
- return;
35
- }
36
- observer.next?.(value);
37
- },
38
- error(err) {
39
- if (isDone) {
40
- return;
41
- }
42
- isDone = true;
43
- observer.error?.(err);
44
- unsubscribe();
45
- },
46
- complete() {
47
- if (isDone) {
48
- return;
49
- }
50
- isDone = true;
51
- observer.complete?.();
52
- unsubscribe();
53
- },
54
- });
55
- if (teardownImmediately) {
56
- unsubscribe();
57
- }
58
- return {
59
- unsubscribe,
60
- };
61
- },
62
- pipe(...operations) {
63
- return pipeFromArray(operations)(self);
64
- },
65
- };
66
- return self;
67
- }
68
- function pipeFromArray(fns) {
69
- if (fns.length === 0) {
70
- return identity;
71
- }
72
- if (fns.length === 1) {
73
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
74
- return fns[0];
75
- }
76
- return function piped(input) {
77
- return fns.reduce((prev, fn) => fn(prev), input);
78
- };
79
- }
80
- class ObservableAbortError extends Error {
81
- constructor(message) {
82
- super(message);
83
- this.name = 'ObservableAbortError';
84
- Object.setPrototypeOf(this, ObservableAbortError.prototype);
85
- }
86
- }
87
- /** @internal */
88
- function observableToPromise(observable) {
89
- let abort;
90
- const promise = new Promise((resolve, reject) => {
91
- let isDone = false;
92
- function onDone() {
93
- if (isDone) {
94
- return;
95
- }
96
- isDone = true;
97
- reject(new ObservableAbortError('This operation was aborted.'));
98
- obs$.unsubscribe();
99
- }
100
- const obs$ = observable.subscribe({
101
- next(data) {
102
- isDone = true;
103
- resolve(data);
104
- onDone();
105
- },
106
- error(data) {
107
- isDone = true;
108
- reject(data);
109
- onDone();
110
- },
111
- complete() {
112
- isDone = true;
113
- onDone();
114
- },
115
- });
116
- abort = onDone;
117
- });
118
- return {
119
- promise,
120
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
121
- abort: abort,
122
- };
123
- }
124
-
125
- export { observableToPromise as a, isObservable as i, observable as o };
@@ -1,125 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('./utils-42a3ba6d.js');
4
-
5
- /** @public */ function isObservable(x) {
6
- return typeof x === 'object' && x !== null && 'subscribe' in x;
7
- }
8
- /** @public */ function observable(subscribe) {
9
- const self = {
10
- subscribe (observer) {
11
- let teardownRef = null;
12
- let isDone = false;
13
- let unsubscribed = false;
14
- let teardownImmediately = false;
15
- function unsubscribe() {
16
- if (teardownRef === null) {
17
- teardownImmediately = true;
18
- return;
19
- }
20
- if (unsubscribed) {
21
- return;
22
- }
23
- unsubscribed = true;
24
- if (typeof teardownRef === 'function') {
25
- teardownRef();
26
- } else if (teardownRef) {
27
- teardownRef.unsubscribe();
28
- }
29
- }
30
- teardownRef = subscribe({
31
- next (value) {
32
- if (isDone) {
33
- return;
34
- }
35
- observer.next?.(value);
36
- },
37
- error (err) {
38
- if (isDone) {
39
- return;
40
- }
41
- isDone = true;
42
- observer.error?.(err);
43
- unsubscribe();
44
- },
45
- complete () {
46
- if (isDone) {
47
- return;
48
- }
49
- isDone = true;
50
- observer.complete?.();
51
- unsubscribe();
52
- }
53
- });
54
- if (teardownImmediately) {
55
- unsubscribe();
56
- }
57
- return {
58
- unsubscribe
59
- };
60
- },
61
- pipe (...operations) {
62
- return pipeFromArray(operations)(self);
63
- }
64
- };
65
- return self;
66
- }
67
- function pipeFromArray(fns) {
68
- if (fns.length === 0) {
69
- return utils.identity;
70
- }
71
- if (fns.length === 1) {
72
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
73
- return fns[0];
74
- }
75
- return function piped(input) {
76
- return fns.reduce((prev, fn)=>fn(prev), input);
77
- };
78
- }
79
- class ObservableAbortError extends Error {
80
- constructor(message){
81
- super(message);
82
- this.name = 'ObservableAbortError';
83
- Object.setPrototypeOf(this, ObservableAbortError.prototype);
84
- }
85
- }
86
- /** @internal */ function observableToPromise(observable) {
87
- let abort;
88
- const promise = new Promise((resolve, reject)=>{
89
- let isDone = false;
90
- function onDone() {
91
- if (isDone) {
92
- return;
93
- }
94
- isDone = true;
95
- reject(new ObservableAbortError('This operation was aborted.'));
96
- obs$.unsubscribe();
97
- }
98
- const obs$ = observable.subscribe({
99
- next (data) {
100
- isDone = true;
101
- resolve(data);
102
- onDone();
103
- },
104
- error (data) {
105
- isDone = true;
106
- reject(data);
107
- onDone();
108
- },
109
- complete () {
110
- isDone = true;
111
- onDone();
112
- }
113
- });
114
- abort = onDone;
115
- });
116
- return {
117
- promise,
118
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
119
- abort: abort
120
- };
121
- }
122
-
123
- exports.isObservable = isObservable;
124
- exports.observable = observable;
125
- exports.observableToPromise = observableToPromise;
@@ -1,67 +0,0 @@
1
- import { a as isObject } from './utils-e1d51fac.js';
2
-
3
- const procedureTypes = ['query', 'mutation', 'subscription'];
4
-
5
- /* istanbul ignore next -- @preserve */
6
- function assertIsObject(obj) {
7
- if (!isObject(obj)) {
8
- throw new Error('Not an object');
9
- }
10
- }
11
- /* istanbul ignore next -- @preserve */
12
- function assertIsProcedureType(obj) {
13
- if (!procedureTypes.includes(obj)) {
14
- throw new Error('Invalid procedure type');
15
- }
16
- }
17
- /* istanbul ignore next -- @preserve */
18
- function assertIsRequestId(obj) {
19
- if (obj !== null &&
20
- typeof obj === 'number' &&
21
- isNaN(obj) &&
22
- typeof obj !== 'string') {
23
- throw new Error('Invalid request id');
24
- }
25
- }
26
- /* istanbul ignore next -- @preserve */
27
- function assertIsString(obj) {
28
- if (typeof obj !== 'string') {
29
- throw new Error('Invalid string');
30
- }
31
- }
32
- /* istanbul ignore next -- @preserve */
33
- function assertIsJSONRPC2OrUndefined(obj) {
34
- if (typeof obj !== 'undefined' && obj !== '2.0') {
35
- throw new Error('Must be JSONRPC 2.0');
36
- }
37
- }
38
- /** @public */
39
- function parseTRPCMessage(obj, transformer) {
40
- assertIsObject(obj);
41
- const { id, jsonrpc, method, params } = obj;
42
- assertIsRequestId(id);
43
- assertIsJSONRPC2OrUndefined(jsonrpc);
44
- if (method === 'subscription.stop') {
45
- return {
46
- id,
47
- jsonrpc,
48
- method,
49
- };
50
- }
51
- assertIsProcedureType(method);
52
- assertIsObject(params);
53
- const { input: rawInput, path } = params;
54
- assertIsString(path);
55
- const input = transformer.input.deserialize(rawInput);
56
- return {
57
- id,
58
- jsonrpc,
59
- method,
60
- params: {
61
- input,
62
- path,
63
- },
64
- };
65
- }
66
-
67
- export { procedureTypes as a, parseTRPCMessage as p };
@@ -1,62 +0,0 @@
1
- import { a as isObject } from './utils-cf6178ec.mjs';
2
-
3
- const procedureTypes = [
4
- 'query',
5
- 'mutation',
6
- 'subscription'
7
- ];
8
-
9
- /* istanbul ignore next -- @preserve */ function assertIsObject(obj) {
10
- if (!isObject(obj)) {
11
- throw new Error('Not an object');
12
- }
13
- }
14
- /* istanbul ignore next -- @preserve */ function assertIsProcedureType(obj) {
15
- if (!procedureTypes.includes(obj)) {
16
- throw new Error('Invalid procedure type');
17
- }
18
- }
19
- /* istanbul ignore next -- @preserve */ function assertIsRequestId(obj) {
20
- if (obj !== null && typeof obj === 'number' && isNaN(obj) && typeof obj !== 'string') {
21
- throw new Error('Invalid request id');
22
- }
23
- }
24
- /* istanbul ignore next -- @preserve */ function assertIsString(obj) {
25
- if (typeof obj !== 'string') {
26
- throw new Error('Invalid string');
27
- }
28
- }
29
- /* istanbul ignore next -- @preserve */ function assertIsJSONRPC2OrUndefined(obj) {
30
- if (typeof obj !== 'undefined' && obj !== '2.0') {
31
- throw new Error('Must be JSONRPC 2.0');
32
- }
33
- }
34
- /** @public */ function parseTRPCMessage(obj, transformer) {
35
- assertIsObject(obj);
36
- const { id , jsonrpc , method , params } = obj;
37
- assertIsRequestId(id);
38
- assertIsJSONRPC2OrUndefined(jsonrpc);
39
- if (method === 'subscription.stop') {
40
- return {
41
- id,
42
- jsonrpc,
43
- method
44
- };
45
- }
46
- assertIsProcedureType(method);
47
- assertIsObject(params);
48
- const { input: rawInput , path } = params;
49
- assertIsString(path);
50
- const input = transformer.input.deserialize(rawInput);
51
- return {
52
- id,
53
- jsonrpc,
54
- method,
55
- params: {
56
- input,
57
- path
58
- }
59
- };
60
- }
61
-
62
- export { procedureTypes as a, parseTRPCMessage as p };
@@ -1,65 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('./utils-42a3ba6d.js');
4
-
5
- const procedureTypes = [
6
- 'query',
7
- 'mutation',
8
- 'subscription'
9
- ];
10
-
11
- /* istanbul ignore next -- @preserve */ function assertIsObject(obj) {
12
- if (!utils.isObject(obj)) {
13
- throw new Error('Not an object');
14
- }
15
- }
16
- /* istanbul ignore next -- @preserve */ function assertIsProcedureType(obj) {
17
- if (!procedureTypes.includes(obj)) {
18
- throw new Error('Invalid procedure type');
19
- }
20
- }
21
- /* istanbul ignore next -- @preserve */ function assertIsRequestId(obj) {
22
- if (obj !== null && typeof obj === 'number' && isNaN(obj) && typeof obj !== 'string') {
23
- throw new Error('Invalid request id');
24
- }
25
- }
26
- /* istanbul ignore next -- @preserve */ function assertIsString(obj) {
27
- if (typeof obj !== 'string') {
28
- throw new Error('Invalid string');
29
- }
30
- }
31
- /* istanbul ignore next -- @preserve */ function assertIsJSONRPC2OrUndefined(obj) {
32
- if (typeof obj !== 'undefined' && obj !== '2.0') {
33
- throw new Error('Must be JSONRPC 2.0');
34
- }
35
- }
36
- /** @public */ function parseTRPCMessage(obj, transformer) {
37
- assertIsObject(obj);
38
- const { id , jsonrpc , method , params } = obj;
39
- assertIsRequestId(id);
40
- assertIsJSONRPC2OrUndefined(jsonrpc);
41
- if (method === 'subscription.stop') {
42
- return {
43
- id,
44
- jsonrpc,
45
- method
46
- };
47
- }
48
- assertIsProcedureType(method);
49
- assertIsObject(params);
50
- const { input: rawInput , path } = params;
51
- assertIsString(path);
52
- const input = transformer.input.deserialize(rawInput);
53
- return {
54
- id,
55
- jsonrpc,
56
- method,
57
- params: {
58
- input,
59
- path
60
- }
61
- };
62
- }
63
-
64
- exports.parseTRPCMessage = parseTRPCMessage;
65
- exports.procedureTypes = procedureTypes;