@trpc/client 10.0.0-alpha.35 → 10.0.0-alpha.38
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/README.md +58 -1
- package/dist/index.js +5 -4
- package/dist/index.mjs +7 -6
- package/dist/links/dedupeLink.d.ts.map +1 -1
- package/dist/links/internals/createChain.d.ts.map +1 -1
- package/dist/links/splitLink.js +1 -1
- package/dist/links/splitLink.mjs +1 -1
- package/dist/links/wsLink.d.ts.map +1 -1
- package/dist/links/wsLink.js +2 -1
- package/dist/links/wsLink.mjs +2 -1
- package/dist/{splitLink-62ff9db0.mjs → splitLink-0202cd7b.mjs} +5 -0
- package/dist/{splitLink-8202386e.js → splitLink-23c5ce5c.js} +5 -0
- package/dist/{wsLink-9468a563.mjs → wsLink-11ee4922.mjs} +5 -2
- package/dist/{wsLink-69f5adb8.js → wsLink-807f4ad9.js} +6 -2
- package/package.json +4 -4
- package/src/internals/dataLoader.ts +2 -2
- package/src/links/dedupeLink.ts +3 -2
- package/src/links/internals/createChain.ts +5 -0
- package/src/links/wsLink.ts +1 -2
package/README.md
CHANGED
|
@@ -1,3 +1,60 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://trpc.io/"><img src="../../www/static/img/logo-text.svg" alt="tRPC" height="130"/></a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>End-to-end typesafe APIs made easy</strong>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<!-- TODO: replace with new version GIF -->
|
|
11
|
+
<img src="https://storage.googleapis.com/trpc/trpcgif.gif" alt="Demo" />
|
|
12
|
+
</p>
|
|
13
|
+
|
|
1
14
|
# `@trpc/client`
|
|
2
15
|
|
|
3
|
-
|
|
16
|
+
> Communicate with a tRPC server on the client side.
|
|
17
|
+
|
|
18
|
+
## Documentation
|
|
19
|
+
|
|
20
|
+
Full documentation for `@trpc/client` can be found [here](https://trpc.io/docs/vanilla)
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# npm
|
|
26
|
+
npm install @trpc/client
|
|
27
|
+
|
|
28
|
+
# Yarn
|
|
29
|
+
yarn add @trpc/client
|
|
30
|
+
|
|
31
|
+
# pnpm
|
|
32
|
+
pnpm add @trpc/client
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Basic Example
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { createTRPCClient, createTRPCClientProxy } from '@trpc/client';
|
|
39
|
+
// Importing the router type from the server file
|
|
40
|
+
import type { AppRouter } from './server';
|
|
41
|
+
|
|
42
|
+
// Initializing the tRPC client
|
|
43
|
+
const client = createTRPCClient<AppRouter>({
|
|
44
|
+
url: 'http://localhost:2022',
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Creating a proxy, this allows for cmd+click to the backend function.
|
|
48
|
+
const proxy = createTRPCClientProxy(client);
|
|
49
|
+
|
|
50
|
+
async function main() {
|
|
51
|
+
// Querying the greeting
|
|
52
|
+
const helloResponse = await proxy.greeting.query({
|
|
53
|
+
name: 'world',
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
console.log('helloResponse', helloResponse); // Hello world
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
main();
|
|
60
|
+
```
|
package/dist/index.js
CHANGED
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
|
|
6
6
|
var _createClass = require('@babel/runtime/helpers/createClass');
|
|
7
7
|
var observable = require('@trpc/server/observable');
|
|
8
|
-
var links_wsLink = require('./wsLink-
|
|
8
|
+
var links_wsLink = require('./wsLink-807f4ad9.js');
|
|
9
9
|
var links_httpBatchLink = require('./links/httpBatchLink.js');
|
|
10
10
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
11
|
require('@babel/runtime/helpers/slicedToArray');
|
|
12
|
-
var links_splitLink = require('./splitLink-
|
|
12
|
+
var links_splitLink = require('./splitLink-23c5ce5c.js');
|
|
13
13
|
require('@babel/runtime/helpers/assertThisInitialized');
|
|
14
14
|
require('@babel/runtime/helpers/inherits');
|
|
15
15
|
require('@babel/runtime/helpers/possibleConstructorReturn');
|
|
@@ -70,11 +70,12 @@ function dedupeLink() {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
var key = JSON.stringify([op.path, op.input]);
|
|
73
|
+
var obs$ = pending[key];
|
|
73
74
|
|
|
74
|
-
if (
|
|
75
|
+
if (obs$) {
|
|
75
76
|
// console.log('hooking into pending', { op });
|
|
76
77
|
return observable.observable(function (observer) {
|
|
77
|
-
return
|
|
78
|
+
return obs$.subscribe(observer);
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
81
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
2
2
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
3
3
|
import { observable, share, observableToPromise } from '@trpc/server/observable';
|
|
4
|
-
import { T as TRPCClientError } from './wsLink-
|
|
5
|
-
export { T as TRPCClientError, c as createWSClient, w as wsLink } from './wsLink-
|
|
4
|
+
import { T as TRPCClientError } from './wsLink-11ee4922.mjs';
|
|
5
|
+
export { T as TRPCClientError, c as createWSClient, w as wsLink } from './wsLink-11ee4922.mjs';
|
|
6
6
|
import { httpBatchLink } from './links/httpBatchLink.mjs';
|
|
7
7
|
export { httpBatchLink } from './links/httpBatchLink.mjs';
|
|
8
8
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
9
9
|
import '@babel/runtime/helpers/slicedToArray';
|
|
10
|
-
import { c as createChain } from './splitLink-
|
|
11
|
-
export { s as splitLink } from './splitLink-
|
|
10
|
+
import { c as createChain } from './splitLink-0202cd7b.mjs';
|
|
11
|
+
export { s as splitLink } from './splitLink-0202cd7b.mjs';
|
|
12
12
|
import '@babel/runtime/helpers/assertThisInitialized';
|
|
13
13
|
import '@babel/runtime/helpers/inherits';
|
|
14
14
|
import '@babel/runtime/helpers/possibleConstructorReturn';
|
|
@@ -62,11 +62,12 @@ function dedupeLink() {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
var key = JSON.stringify([op.path, op.input]);
|
|
65
|
+
var obs$ = pending[key];
|
|
65
66
|
|
|
66
|
-
if (
|
|
67
|
+
if (obs$) {
|
|
67
68
|
// console.log('hooking into pending', { op });
|
|
68
69
|
return observable(function (observer) {
|
|
69
|
-
return
|
|
70
|
+
return obs$.subscribe(observer);
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dedupeLink.d.ts","sourceRoot":"","sources":["../../src/links/dedupeLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,wBAAgB,UAAU,CACxB,OAAO,SAAS,SAAS,GAAG,SAAS,KAClC,QAAQ,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"dedupeLink.d.ts","sourceRoot":"","sources":["../../src/links/dedupeLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,wBAAgB,UAAU,CACxB,OAAO,SAAS,SAAS,GAAG,SAAS,KAClC,QAAQ,CAAC,OAAO,CAAC,CA6CrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createChain.d.ts","sourceRoot":"","sources":["../../../src/links/internals/createChain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAE/E,gBAAgB;AAChB,wBAAgB,WAAW,CACzB,OAAO,SAAS,SAAS,EACzB,MAAM,GAAG,OAAO,EAChB,OAAO,GAAG,OAAO,EACjB,IAAI,EAAE;IACN,KAAK,EAAE,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACjD,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;CACvB,GAAG,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"createChain.d.ts","sourceRoot":"","sources":["../../../src/links/internals/createChain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAE/E,gBAAgB;AAChB,wBAAgB,WAAW,CACzB,OAAO,SAAS,SAAS,EACzB,MAAM,GAAG,OAAO,EAChB,OAAO,GAAG,OAAO,EACjB,IAAI,EAAE;IACN,KAAK,EAAE,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACjD,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;CACvB,GAAG,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,CAuB9C"}
|
package/dist/links/splitLink.js
CHANGED
package/dist/links/splitLink.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import '@trpc/server/observable';
|
|
2
|
-
export { s as splitLink } from '../splitLink-
|
|
2
|
+
export { s as splitLink } from '../splitLink-0202cd7b.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wsLink.d.ts","sourceRoot":"","sources":["../../src/links/wsLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAiB,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,aAAa,EAAc,MAAM,yBAAyB,CAAC;AASpE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,OAAO,SAAS,CAAC;IAC7B,YAAY,CAAC,EAAE,OAAO,UAAU,CAAC;CAClC;AACD,wBAAgB,cAAc,CAAC,IAAI,EAAE,sBAAsB;;
|
|
1
|
+
{"version":3,"file":"wsLink.d.ts","sourceRoot":"","sources":["../../src/links/wsLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAiB,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,aAAa,EAAc,MAAM,yBAAyB,CAAC;AASpE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,OAAO,SAAS,CAAC;IAC7B,YAAY,CAAC,EAAE,OAAO,UAAU,CAAC;CAClC;AACD,wBAAgB,cAAc,CAAC,IAAI,EAAE,sBAAsB;;kBA6LpC,SAAS,6DAA0B,aAAa;;EAgDtE;AACD,oBAAY,mBAAmB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAEpE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAiBD,wBAAgB,MAAM,CAAC,OAAO,SAAS,SAAS,EAC9C,IAAI,EAAE,oBAAoB,GACzB,QAAQ,CAAC,OAAO,CAAC,CAoDnB"}
|
package/dist/links/wsLink.js
CHANGED
|
@@ -9,8 +9,9 @@ require('@babel/runtime/helpers/inherits');
|
|
|
9
9
|
require('@babel/runtime/helpers/possibleConstructorReturn');
|
|
10
10
|
require('@babel/runtime/helpers/getPrototypeOf');
|
|
11
11
|
require('@babel/runtime/helpers/wrapNativeSuper');
|
|
12
|
+
require('@babel/runtime/helpers/slicedToArray');
|
|
12
13
|
require('@trpc/server/observable');
|
|
13
|
-
var links_wsLink = require('../wsLink-
|
|
14
|
+
var links_wsLink = require('../wsLink-807f4ad9.js');
|
|
14
15
|
require('@babel/runtime/helpers/defineProperty');
|
|
15
16
|
|
|
16
17
|
|
package/dist/links/wsLink.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import '@babel/runtime/helpers/inherits';
|
|
|
5
5
|
import '@babel/runtime/helpers/possibleConstructorReturn';
|
|
6
6
|
import '@babel/runtime/helpers/getPrototypeOf';
|
|
7
7
|
import '@babel/runtime/helpers/wrapNativeSuper';
|
|
8
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
8
9
|
import '@trpc/server/observable';
|
|
9
|
-
export { c as createWSClient, w as wsLink } from '../wsLink-
|
|
10
|
+
export { c as createWSClient, w as wsLink } from '../wsLink-11ee4922.mjs';
|
|
10
11
|
import '@babel/runtime/helpers/defineProperty';
|
|
@@ -7,6 +7,11 @@ function createChain(opts) {
|
|
|
7
7
|
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
8
8
|
var op = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : opts.op;
|
|
9
9
|
var next = opts.links[index];
|
|
10
|
+
|
|
11
|
+
if (!next) {
|
|
12
|
+
throw new Error('No more links to execute - did you forget to add an ending link?');
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
var subscription = next({
|
|
11
16
|
op: op,
|
|
12
17
|
next: function next(nextOp) {
|
|
@@ -9,6 +9,11 @@ function createChain(opts) {
|
|
|
9
9
|
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
10
10
|
var op = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : opts.op;
|
|
11
11
|
var next = opts.links[index];
|
|
12
|
+
|
|
13
|
+
if (!next) {
|
|
14
|
+
throw new Error('No more links to execute - did you forget to add an ending link?');
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
var subscription = next({
|
|
13
18
|
op: op,
|
|
14
19
|
next: function next(nextOp) {
|
|
@@ -5,6 +5,7 @@ import _inherits from '@babel/runtime/helpers/inherits';
|
|
|
5
5
|
import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn';
|
|
6
6
|
import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf';
|
|
7
7
|
import _wrapNativeSuper from '@babel/runtime/helpers/wrapNativeSuper';
|
|
8
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
8
9
|
import { observable } from '@trpc/server/observable';
|
|
9
10
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
10
11
|
|
|
@@ -262,10 +263,12 @@ function createWSClient(opts) {
|
|
|
262
263
|
tryReconnect();
|
|
263
264
|
}
|
|
264
265
|
|
|
265
|
-
for (var
|
|
266
|
+
for (var _i2 = 0, _Object$entries = Object.entries(pendingRequests); _i2 < _Object$entries.length; _i2++) {
|
|
266
267
|
var _req$callbacks$error, _req$callbacks2;
|
|
267
268
|
|
|
268
|
-
var
|
|
269
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2),
|
|
270
|
+
key = _Object$entries$_i[0],
|
|
271
|
+
req = _Object$entries$_i[1];
|
|
269
272
|
|
|
270
273
|
if (req.ws !== conn) {
|
|
271
274
|
continue;
|
|
@@ -7,6 +7,7 @@ var _inherits = require('@babel/runtime/helpers/inherits');
|
|
|
7
7
|
var _possibleConstructorReturn = require('@babel/runtime/helpers/possibleConstructorReturn');
|
|
8
8
|
var _getPrototypeOf = require('@babel/runtime/helpers/getPrototypeOf');
|
|
9
9
|
var _wrapNativeSuper = require('@babel/runtime/helpers/wrapNativeSuper');
|
|
10
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
10
11
|
var observable = require('@trpc/server/observable');
|
|
11
12
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
12
13
|
|
|
@@ -19,6 +20,7 @@ var _inherits__default = /*#__PURE__*/_interopDefaultLegacy(_inherits);
|
|
|
19
20
|
var _possibleConstructorReturn__default = /*#__PURE__*/_interopDefaultLegacy(_possibleConstructorReturn);
|
|
20
21
|
var _getPrototypeOf__default = /*#__PURE__*/_interopDefaultLegacy(_getPrototypeOf);
|
|
21
22
|
var _wrapNativeSuper__default = /*#__PURE__*/_interopDefaultLegacy(_wrapNativeSuper);
|
|
23
|
+
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
22
24
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
23
25
|
|
|
24
26
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -275,10 +277,12 @@ function createWSClient(opts) {
|
|
|
275
277
|
tryReconnect();
|
|
276
278
|
}
|
|
277
279
|
|
|
278
|
-
for (var
|
|
280
|
+
for (var _i2 = 0, _Object$entries = Object.entries(pendingRequests); _i2 < _Object$entries.length; _i2++) {
|
|
279
281
|
var _req$callbacks$error, _req$callbacks2;
|
|
280
282
|
|
|
281
|
-
var
|
|
283
|
+
var _Object$entries$_i = _slicedToArray__default["default"](_Object$entries[_i2], 2),
|
|
284
|
+
key = _Object$entries$_i[0],
|
|
285
|
+
req = _Object$entries$_i[1];
|
|
282
286
|
|
|
283
287
|
if (req.ws !== conn) {
|
|
284
288
|
continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/client",
|
|
3
|
-
"version": "10.0.0-alpha.
|
|
3
|
+
"version": "10.0.0-alpha.38",
|
|
4
4
|
"description": "tRPC Client lib",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
"@babel/runtime": "^7.9.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@trpc/server": "10.0.0-alpha.
|
|
70
|
+
"@trpc/server": "10.0.0-alpha.38"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@trpc/server": "10.0.0-alpha.
|
|
73
|
+
"@trpc/server": "10.0.0-alpha.38"
|
|
74
74
|
},
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "0c40cb7ebfd8762ef482ff72cc54c2cf3ef4a0a8"
|
|
79
79
|
}
|
|
@@ -112,8 +112,8 @@ export function dataLoader<TKey, TValue>(
|
|
|
112
112
|
promise
|
|
113
113
|
.then((result) => {
|
|
114
114
|
for (let i = 0; i < result.length; i++) {
|
|
115
|
-
const value = result[i]
|
|
116
|
-
const item = batch.items[i]
|
|
115
|
+
const value = result[i]!;
|
|
116
|
+
const item = batch.items[i]!;
|
|
117
117
|
item.resolve(value);
|
|
118
118
|
item.batch = null;
|
|
119
119
|
}
|
package/src/links/dedupeLink.ts
CHANGED
|
@@ -17,9 +17,10 @@ export function dedupeLink<
|
|
|
17
17
|
return next(op);
|
|
18
18
|
}
|
|
19
19
|
const key = JSON.stringify([op.path, op.input]);
|
|
20
|
-
|
|
20
|
+
const obs$ = pending[key];
|
|
21
|
+
if (obs$) {
|
|
21
22
|
// console.log('hooking into pending', { op });
|
|
22
|
-
return observable((observer) =>
|
|
23
|
+
return observable((observer) => obs$.subscribe(observer));
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
const shared$ = observable((observer) => {
|
|
@@ -14,6 +14,11 @@ export function createChain<
|
|
|
14
14
|
return observable((observer) => {
|
|
15
15
|
function execute(index = 0, op = opts.op) {
|
|
16
16
|
const next = opts.links[index];
|
|
17
|
+
if (!next) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
'No more links to execute - did you forget to add an ending link?',
|
|
20
|
+
);
|
|
21
|
+
}
|
|
17
22
|
const subscription = next({
|
|
18
23
|
op,
|
|
19
24
|
next(nextOp) {
|
package/src/links/wsLink.ts
CHANGED
|
@@ -184,8 +184,7 @@ export function createWSClient(opts: WebSocketClientOptions) {
|
|
|
184
184
|
tryReconnect();
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
for (const key
|
|
188
|
-
const req = pendingRequests[key];
|
|
187
|
+
for (const [key, req] of Object.entries(pendingRequests)) {
|
|
189
188
|
if (req.ws !== conn) {
|
|
190
189
|
continue;
|
|
191
190
|
}
|