@trpc/server 10.0.0-alpha.45 → 10.0.0-alpha.48
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/adapters/aws-lambda/index.js +1 -1
- package/adapters/fastify/index.js +1 -1
- package/adapters/fetch/index.js +1 -1
- package/adapters/node-http/index.js +1 -1
- package/dist/TRPCError-6f61762c.mjs +54 -0
- package/dist/TRPCError-9c7830b4.js +58 -0
- package/dist/adapters/aws-lambda/index.d.ts.map +1 -1
- package/dist/adapters/aws-lambda/index.js +119 -156
- package/dist/adapters/aws-lambda/index.mjs +119 -156
- package/dist/adapters/aws-lambda/utils.d.ts.map +1 -1
- package/dist/adapters/express.d.ts.map +1 -1
- package/dist/adapters/express.js +14 -14
- package/dist/adapters/express.mjs +14 -14
- package/dist/adapters/fastify/fastifyRequestHandler.d.ts.map +1 -1
- package/dist/adapters/fastify/fastifyTRPCPlugin.d.ts.map +1 -1
- package/dist/adapters/fastify/index.d.ts.map +1 -1
- package/dist/adapters/fastify/index.js +68 -89
- package/dist/adapters/fastify/index.mjs +68 -89
- package/dist/adapters/fetch/fetchRequestHandler.d.ts.map +1 -1
- package/dist/adapters/fetch/index.d.ts.map +1 -1
- package/dist/adapters/fetch/index.js +45 -57
- package/dist/adapters/fetch/index.mjs +45 -57
- package/dist/adapters/fetch/types.d.ts.map +1 -1
- package/dist/adapters/lambda/index.d.ts.map +1 -1
- package/dist/adapters/next.d.ts.map +1 -1
- package/dist/adapters/next.js +42 -46
- package/dist/adapters/next.mjs +42 -46
- package/dist/adapters/node-http/index.d.ts.map +1 -1
- package/dist/adapters/node-http/index.js +5 -5
- package/dist/adapters/node-http/index.mjs +5 -5
- package/dist/adapters/node-http/internals/getPostBody.d.ts.map +1 -1
- package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts.map +1 -1
- package/dist/adapters/node-http/types.d.ts.map +1 -1
- package/dist/adapters/standalone.d.ts.map +1 -1
- package/dist/adapters/standalone.js +30 -32
- package/dist/adapters/standalone.mjs +30 -32
- package/dist/adapters/ws.d.ts.map +1 -1
- package/dist/adapters/ws.js +272 -352
- package/dist/adapters/ws.mjs +272 -352
- package/dist/codes-1c24d919.js +47 -0
- package/dist/codes-aaa7d554.mjs +44 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/initTRPC.d.ts.map +1 -1
- package/dist/core/internals/__generated__/mergeRoutersGeneric.d.ts.map +1 -1
- package/dist/core/internals/config.d.ts.map +1 -1
- package/dist/core/internals/getParseFn.d.ts.map +1 -1
- package/dist/core/internals/mergeRouters.d.ts.map +1 -1
- package/dist/core/internals/mergeWithoutOverrides.d.ts.map +1 -1
- package/dist/core/internals/omitPrototype.d.ts.map +1 -1
- package/dist/core/internals/prefixObjectKeys.d.ts.map +1 -1
- package/dist/core/internals/procedureBuilder.d.ts.map +1 -1
- package/dist/core/internals/utils.d.ts.map +1 -1
- package/dist/core/middleware.d.ts.map +1 -1
- package/dist/core/parser.d.ts.map +1 -1
- package/dist/core/procedure.d.ts.map +1 -1
- package/dist/core/router.d.ts.map +1 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/deprecated/internals/callProcedure.d.ts.map +1 -1
- package/dist/deprecated/internals/middlewares.d.ts.map +1 -1
- package/dist/deprecated/internals/procedure.d.ts.map +1 -1
- package/dist/deprecated/interop.d.ts.map +1 -1
- package/dist/deprecated/router.d.ts.map +1 -1
- package/dist/error/TRPCError.d.ts.map +1 -1
- package/dist/error/formatter.d.ts.map +1 -1
- package/dist/error/utils.d.ts.map +1 -1
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/internals/getHTTPStatusCode.d.ts.map +1 -1
- package/dist/http/internals/types.d.ts.map +1 -1
- package/dist/http/resolveHTTPResponse.d.ts.map +1 -1
- package/dist/http/types.d.ts.map +1 -1
- package/dist/index-47817162.mjs +26 -0
- package/dist/index-9d687d33.js +28 -0
- package/dist/index.js +59 -95
- package/dist/index.mjs +60 -96
- package/dist/internals/invert.d.ts.map +1 -1
- package/dist/internals/transformTRPCResponse.d.ts.map +1 -1
- package/dist/internals/types.d.ts.map +1 -1
- package/dist/nodeHTTPRequestHandler-7c2a3037.js +82 -0
- package/dist/nodeHTTPRequestHandler-b37609f7.mjs +80 -0
- package/dist/observable/index.d.ts.map +1 -1
- package/dist/observable/index.js +125 -172
- package/dist/observable/index.mjs +125 -172
- package/dist/observable/internals/identity.d.ts.map +1 -1
- package/dist/observable/internals/observableToPromise.d.ts.map +1 -1
- package/dist/observable/internals/pipe.d.ts.map +1 -1
- package/dist/observable/observable.d.ts.map +1 -1
- package/dist/observable/operators/index.d.ts.map +1 -1
- package/dist/observable/operators/map.d.ts.map +1 -1
- package/dist/observable/operators/share.d.ts.map +1 -1
- package/dist/observable/operators/tap.d.ts.map +1 -1
- package/dist/observable/types.d.ts.map +1 -1
- package/dist/observable-b651bf11.js +84 -0
- package/dist/observable-e129ac9d.mjs +81 -0
- package/dist/resolveHTTPResponse-83703ee8.mjs +251 -0
- package/dist/resolveHTTPResponse-b486996d.js +255 -0
- package/dist/router-8372703e.js +886 -0
- package/dist/router-f21b6d06.mjs +876 -0
- package/dist/rpc/codes.d.ts.map +1 -1
- package/dist/rpc/envelopes.d.ts.map +1 -1
- package/dist/rpc/index.d.ts.map +1 -1
- package/dist/rpc/index.js +3 -7
- package/dist/rpc/index.mjs +1 -1
- package/dist/rpc/internals/invert.d.ts.map +1 -1
- package/dist/shared/createProxy/index.d.ts.map +1 -1
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/shared/index.mjs +1 -1
- package/dist/subscription.js +24 -34
- package/dist/subscription.mjs +24 -34
- package/dist/transformTRPCResponse-11ac69cc.js +27 -0
- package/dist/transformTRPCResponse-c8138d5f.mjs +25 -0
- package/observable/index.js +1 -1
- package/package.json +12 -16
- package/rpc/index.js +1 -1
- package/shared/index.js +1 -1
- package/subscription/index.d.ts +1 -0
- package/subscription/index.js +1 -0
- package/dist/TRPCError-9050a68d.js +0 -69
- package/dist/TRPCError-97212592.mjs +0 -65
- package/dist/adapters/aws-lambda/index.ts.js +0 -1
- package/dist/adapters/express.ts.js +0 -1
- package/dist/adapters/fastify/index.ts.js +0 -1
- package/dist/adapters/fetch/index.ts.js +0 -1
- package/dist/adapters/next.ts.js +0 -1
- package/dist/adapters/node-http/index.ts.js +0 -1
- package/dist/adapters/standalone.ts.js +0 -1
- package/dist/adapters/ws.ts.js +0 -1
- package/dist/envelopes-2ae27c9f.js +0 -85
- package/dist/envelopes-b9f49d4d.mjs +0 -82
- package/dist/index-1a25ccbd.js +0 -33
- package/dist/index-a3bd54c7.mjs +0 -31
- package/dist/index.ts.js +0 -1
- package/dist/nodeHTTPRequestHandler-bee7aacc.js +0 -107
- package/dist/nodeHTTPRequestHandler-f1656eba.mjs +0 -105
- package/dist/observable/index.ts.js +0 -1
- package/dist/observable-341a0506.js +0 -109
- package/dist/observable-cfedfa30.mjs +0 -106
- package/dist/resolveHTTPResponse-455f1e51.mjs +0 -293
- package/dist/resolveHTTPResponse-5d90abc5.js +0 -297
- package/dist/router-4e50a6ac.js +0 -1104
- package/dist/router-a3db8f3a.mjs +0 -1094
- package/dist/rpc/index.ts.js +0 -1
- package/dist/shared/index.ts.js +0 -1
- package/dist/subscription.ts.js +0 -1
- package/dist/transformTRPCResponse-0c261655.js +0 -29
- package/dist/transformTRPCResponse-747b9a68.mjs +0 -27
|
@@ -1,195 +1,148 @@
|
|
|
1
|
-
export { i as isObservable, o as observable } from '../observable-
|
|
1
|
+
export { i as isObservable, o as observable } from '../observable-e129ac9d.mjs';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
function share( // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3
|
+
function share(// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
4
|
_opts) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
5
|
+
return (originalObserver)=>{
|
|
6
|
+
let refCount = 0;
|
|
7
|
+
let subscription = null;
|
|
8
|
+
const observers = [];
|
|
9
|
+
function startIfNeeded() {
|
|
10
|
+
if (subscription) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
subscription = originalObserver.subscribe({
|
|
14
|
+
next (value) {
|
|
15
|
+
for (const observer of observers){
|
|
16
|
+
observer.next?.(value);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
error (error) {
|
|
20
|
+
for (const observer of observers){
|
|
21
|
+
observer.error?.(error);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
complete () {
|
|
25
|
+
for (const observer of observers){
|
|
26
|
+
observer.complete?.();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function resetIfNeeded() {
|
|
32
|
+
// "resetOnRefCountZero"
|
|
33
|
+
if (refCount === 0 && subscription) {
|
|
34
|
+
const _sub = subscription;
|
|
35
|
+
subscription = null;
|
|
36
|
+
_sub.unsubscribe();
|
|
37
|
+
}
|
|
39
38
|
}
|
|
40
|
-
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function resetIfNeeded() {
|
|
45
|
-
// "resetOnRefCountZero"
|
|
46
|
-
if (refCount === 0 && subscription) {
|
|
47
|
-
const _sub = subscription;
|
|
48
|
-
subscription = null;
|
|
49
|
-
|
|
50
|
-
_sub.unsubscribe();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return {
|
|
55
|
-
subscribe(observer) {
|
|
56
|
-
refCount++;
|
|
57
|
-
observers.push(observer);
|
|
58
|
-
startIfNeeded();
|
|
59
39
|
return {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
40
|
+
subscribe (observer) {
|
|
41
|
+
refCount++;
|
|
42
|
+
observers.push(observer);
|
|
43
|
+
startIfNeeded();
|
|
44
|
+
return {
|
|
45
|
+
unsubscribe () {
|
|
46
|
+
refCount--;
|
|
47
|
+
resetIfNeeded();
|
|
48
|
+
const index = observers.findIndex((v)=>v === observer);
|
|
49
|
+
if (index > -1) {
|
|
50
|
+
observers.splice(index, 1);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
67
54
|
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
55
|
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
56
|
};
|
|
74
|
-
};
|
|
75
57
|
}
|
|
76
58
|
|
|
77
59
|
function map(project) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
var _observer$complete;
|
|
97
|
-
|
|
98
|
-
(_observer$complete = observer.complete) === null || _observer$complete === void 0 ? void 0 : _observer$complete.call(observer);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
});
|
|
102
|
-
return subscription;
|
|
103
|
-
}
|
|
104
|
-
|
|
60
|
+
return (originalObserver)=>{
|
|
61
|
+
return {
|
|
62
|
+
subscribe (observer) {
|
|
63
|
+
let index = 0;
|
|
64
|
+
const subscription = originalObserver.subscribe({
|
|
65
|
+
next (value) {
|
|
66
|
+
observer.next?.(project(value, index++));
|
|
67
|
+
},
|
|
68
|
+
error (error) {
|
|
69
|
+
observer.error?.(error);
|
|
70
|
+
},
|
|
71
|
+
complete () {
|
|
72
|
+
observer.complete?.();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return subscription;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
105
78
|
};
|
|
106
|
-
};
|
|
107
79
|
}
|
|
108
80
|
|
|
109
81
|
function tap(observer) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
var _observer$complete, _observer2$complete;
|
|
130
|
-
|
|
131
|
-
(_observer$complete = observer.complete) === null || _observer$complete === void 0 ? void 0 : _observer$complete.call(observer);
|
|
132
|
-
(_observer2$complete = observer2.complete) === null || _observer2$complete === void 0 ? void 0 : _observer2$complete.call(observer2);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
|
|
82
|
+
return (originalObserver)=>{
|
|
83
|
+
return {
|
|
84
|
+
subscribe (observer2) {
|
|
85
|
+
return originalObserver.subscribe({
|
|
86
|
+
next (v) {
|
|
87
|
+
observer.next?.(v);
|
|
88
|
+
observer2.next?.(v);
|
|
89
|
+
},
|
|
90
|
+
error (v) {
|
|
91
|
+
observer.error?.(v);
|
|
92
|
+
observer2.error?.(v);
|
|
93
|
+
},
|
|
94
|
+
complete () {
|
|
95
|
+
observer.complete?.();
|
|
96
|
+
observer2.complete?.();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
};
|
|
138
101
|
};
|
|
139
|
-
};
|
|
140
102
|
}
|
|
141
103
|
|
|
142
104
|
class ObservableAbortError extends Error {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
/** @internal */
|
|
151
|
-
|
|
152
|
-
function observableToPromise(observable) {
|
|
153
|
-
let abort;
|
|
154
|
-
const promise = new Promise((resolve, reject) => {
|
|
155
|
-
let isDone = false;
|
|
156
|
-
|
|
157
|
-
function onDone() {
|
|
158
|
-
if (isDone) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
isDone = true;
|
|
163
|
-
reject(new ObservableAbortError('This operation was cancelled.'));
|
|
164
|
-
obs$.unsubscribe();
|
|
105
|
+
constructor(message){
|
|
106
|
+
super(message);
|
|
107
|
+
this.name = 'ObservableAbortError';
|
|
108
|
+
Object.setPrototypeOf(this, ObservableAbortError.prototype);
|
|
165
109
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
onDone()
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
110
|
+
}
|
|
111
|
+
/** @internal */ function observableToPromise(observable) {
|
|
112
|
+
let abort;
|
|
113
|
+
const promise = new Promise((resolve, reject)=>{
|
|
114
|
+
let isDone = false;
|
|
115
|
+
function onDone() {
|
|
116
|
+
if (isDone) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
isDone = true;
|
|
120
|
+
reject(new ObservableAbortError('This operation was cancelled.'));
|
|
121
|
+
obs$.unsubscribe();
|
|
122
|
+
}
|
|
123
|
+
const obs$ = observable.subscribe({
|
|
124
|
+
next (data) {
|
|
125
|
+
isDone = true;
|
|
126
|
+
resolve(data);
|
|
127
|
+
onDone();
|
|
128
|
+
},
|
|
129
|
+
error (data) {
|
|
130
|
+
isDone = true;
|
|
131
|
+
reject(data);
|
|
132
|
+
onDone();
|
|
133
|
+
},
|
|
134
|
+
complete () {
|
|
135
|
+
isDone = true;
|
|
136
|
+
onDone();
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
abort = onDone;
|
|
185
140
|
});
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
abort: abort
|
|
192
|
-
};
|
|
141
|
+
return {
|
|
142
|
+
promise,
|
|
143
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
144
|
+
abort: abort
|
|
145
|
+
};
|
|
193
146
|
}
|
|
194
147
|
|
|
195
148
|
export { map, observableToPromise, share, tap };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../../../packages/server/src/observable/internals/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAEnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observableToPromise.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"observableToPromise.d.ts","sourceRoot":"","sources":["../../../../../packages/server/src/observable/internals/observableToPromise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAK5B;AAED,gBAAgB;AAChB,wBAAgB,mBAAmB,CAAC,MAAM,EACxC,UAAU,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC;;iBAEtB,IAAI;EAkCtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipe.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"pipe.d.ts","sourceRoot":"","sources":["../../../../../packages/server/src/observable/internals/pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,gBAAgB;AAChB,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAChC,GAAG,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAC9B,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAgBrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observable.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"observable.d.ts","sourceRoot":"","sources":["../../../../packages/server/src/observable/observable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAoB,aAAa,EAAE,MAAM,SAAS,CAAC;AAEhF,oBAAY,oBAAoB,CAAC,WAAW,IAAI,WAAW,SAAS,UAAU,CAC5E,MAAM,MAAM,EACZ,OAAO,CACR,GACG,MAAM,GACN,KAAK,CAAC;AAEV,wBAAgB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAE1E;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,EACjD,SAAS,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,aAAa,GAC/D,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CA6D5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/server/src/observable/operators/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../../../packages/server/src/observable/operators/map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,wBAAgB,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EACnD,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK,WAAW,GAC3D,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,CAoB7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../../../../../packages/server/src/observable/operators/share.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAA4B,MAAM,UAAU,CAAC;AAG9E,UAAU,WAAW;CAAG;AACxB,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAElC,KAAK,CAAC,EAAE,WAAW,GAClB,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,CA2D1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tap.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"tap.d.ts","sourceRoot":"","sources":["../../../../../packages/server/src/observable/operators/tap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE9D,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,EAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAC1C,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,CAqB1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRo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C;IACpB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,QAAQ,CAAC,MAAM,EAAE,MAAM;IACtC,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,oBAAY,aAAa,GAEvB,cAAc,GAAG,aAAa,GAAG,IAAI,CAAC;AAExC,oBAAY,aAAa,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;AAEnD,oBAAY,gBAAgB,CAC1B,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,IACT,aAAa,CACf,YAAY,CAAC,YAAY,EAAE,YAAY,CAAC,EACxC,YAAY,CAAC,WAAW,EAAE,WAAW,CAAC,CACvC,CAAC;AAEF,oBAAY,wBAAwB,CAAC,MAAM,EAAE,MAAM,IAAI,gBAAgB,CACrE,MAAM,EACN,MAAM,EACN,MAAM,EACN,MAAM,CACP,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function identity(x) {
|
|
4
|
+
return x;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/** @internal */ function pipeFromArray(fns) {
|
|
8
|
+
if (fns.length === 0) {
|
|
9
|
+
return identity;
|
|
10
|
+
}
|
|
11
|
+
if (fns.length === 1) {
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
13
|
+
return fns[0];
|
|
14
|
+
}
|
|
15
|
+
return function piped(input) {
|
|
16
|
+
return fns.reduce((prev, fn)=>fn(prev), input);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function isObservable(x) {
|
|
21
|
+
return typeof x === 'object' && x !== null && 'subscribe' in x;
|
|
22
|
+
}
|
|
23
|
+
function observable(subscribe) {
|
|
24
|
+
const self = {
|
|
25
|
+
subscribe (observer) {
|
|
26
|
+
let teardownRef = null;
|
|
27
|
+
let isDone = false;
|
|
28
|
+
let unsubscribed = false;
|
|
29
|
+
let teardownImmediately = false;
|
|
30
|
+
function unsubscribe() {
|
|
31
|
+
if (teardownRef === null) {
|
|
32
|
+
teardownImmediately = true;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (unsubscribed) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
unsubscribed = true;
|
|
39
|
+
if (typeof teardownRef === 'function') {
|
|
40
|
+
teardownRef();
|
|
41
|
+
} else if (teardownRef) {
|
|
42
|
+
teardownRef.unsubscribe();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
teardownRef = subscribe({
|
|
46
|
+
next (value) {
|
|
47
|
+
if (isDone) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
observer.next?.(value);
|
|
51
|
+
},
|
|
52
|
+
error (err) {
|
|
53
|
+
if (isDone) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
isDone = true;
|
|
57
|
+
observer.error?.(err);
|
|
58
|
+
unsubscribe();
|
|
59
|
+
},
|
|
60
|
+
complete () {
|
|
61
|
+
if (isDone) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
isDone = true;
|
|
65
|
+
observer.complete?.();
|
|
66
|
+
unsubscribe();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
if (teardownImmediately) {
|
|
70
|
+
unsubscribe();
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
unsubscribe
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
pipe (...operations) {
|
|
77
|
+
return pipeFromArray(operations)(self);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
return self;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
exports.isObservable = isObservable;
|
|
84
|
+
exports.observable = observable;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
function identity(x) {
|
|
2
|
+
return x;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/** @internal */ function pipeFromArray(fns) {
|
|
6
|
+
if (fns.length === 0) {
|
|
7
|
+
return identity;
|
|
8
|
+
}
|
|
9
|
+
if (fns.length === 1) {
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11
|
+
return fns[0];
|
|
12
|
+
}
|
|
13
|
+
return function piped(input) {
|
|
14
|
+
return fns.reduce((prev, fn)=>fn(prev), input);
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function isObservable(x) {
|
|
19
|
+
return typeof x === 'object' && x !== null && 'subscribe' in x;
|
|
20
|
+
}
|
|
21
|
+
function observable(subscribe) {
|
|
22
|
+
const self = {
|
|
23
|
+
subscribe (observer) {
|
|
24
|
+
let teardownRef = null;
|
|
25
|
+
let isDone = false;
|
|
26
|
+
let unsubscribed = false;
|
|
27
|
+
let teardownImmediately = false;
|
|
28
|
+
function unsubscribe() {
|
|
29
|
+
if (teardownRef === null) {
|
|
30
|
+
teardownImmediately = true;
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (unsubscribed) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
unsubscribed = true;
|
|
37
|
+
if (typeof teardownRef === 'function') {
|
|
38
|
+
teardownRef();
|
|
39
|
+
} else if (teardownRef) {
|
|
40
|
+
teardownRef.unsubscribe();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
teardownRef = subscribe({
|
|
44
|
+
next (value) {
|
|
45
|
+
if (isDone) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
observer.next?.(value);
|
|
49
|
+
},
|
|
50
|
+
error (err) {
|
|
51
|
+
if (isDone) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
isDone = true;
|
|
55
|
+
observer.error?.(err);
|
|
56
|
+
unsubscribe();
|
|
57
|
+
},
|
|
58
|
+
complete () {
|
|
59
|
+
if (isDone) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
isDone = true;
|
|
63
|
+
observer.complete?.();
|
|
64
|
+
unsubscribe();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
if (teardownImmediately) {
|
|
68
|
+
unsubscribe();
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
unsubscribe
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
pipe (...operations) {
|
|
75
|
+
return pipeFromArray(operations)(self);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return self;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { isObservable as i, observable as o };
|