@droz-js/sdk 0.2.5 → 0.2.6

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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@droz-js/sdk",
3
3
  "description": "Droz SDK",
4
- "version": "0.2.5",
4
+ "version": "0.2.6",
5
5
  "private": false,
6
- "main": "./src/index.js",
7
6
  "exports": {
7
+ ".": "./src/index.js",
8
8
  "./*": "./src/*.js",
9
9
  "./server": "./src/index.ts",
10
10
  "./server/*": "./src/*.ts"
@@ -25,11 +25,9 @@ function emptyAsyncIterator() {
25
25
  };
26
26
  }
27
27
  function buildArgs(req) {
28
- const operationNames = Array.isArray(req) ? req.map(r => r.operationName) : [req.operationName];
29
- const params = new URLSearchParams();
30
- const uniques = new Set(operationNames);
31
- uniques.forEach(name => params.append('_', name));
32
- return params.toString();
28
+ const names = [].concat(req).map(each => each.operationName);
29
+ const uniques = [...new Set(names)].join(',');
30
+ return `_=${uniques}`;
33
31
  }
34
32
  class HttpRequester {
35
33
  serviceName;
package/src/client/ws.js CHANGED
@@ -31,6 +31,8 @@ class WsRequester {
31
31
  return this.requester.bind(this);
32
32
  }
33
33
  requester(query, variables) {
34
+ if (!this.client)
35
+ throw new Error('ws client not connected, you must call await client.connect(); first');
34
36
  const isSubscription = query.trim().startsWith('subscription ');
35
37
  const operation = { query, variables };
36
38
  const iterable = this.client.iterate(operation);