@enkaku/client 0.15.0 → 0.16.0

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 (2) hide show
  1. package/lib/client.js +12 -4
  2. package/package.json +11 -11
package/lib/client.js CHANGED
@@ -10,19 +10,25 @@ import { safeWrite } from './safe-write.js';
10
10
  const defaultTracer = createTracer('client');
11
11
  function createController(params, onDone) {
12
12
  const deferred = defer();
13
+ let done = false;
14
+ const finish = ()=>{
15
+ if (done) return;
16
+ done = true;
17
+ onDone?.();
18
+ };
13
19
  return Object.assign(new AbortController(), params, {
14
20
  result: deferred.promise,
15
21
  ok: (value)=>{
16
22
  deferred.resolve(value);
17
- onDone?.();
23
+ finish();
18
24
  },
19
25
  error: (error)=>{
20
26
  deferred.reject(error);
21
- onDone?.();
27
+ finish();
22
28
  },
23
29
  aborted: (signal)=>{
24
30
  deferred.reject(signal.reason);
25
- onDone?.();
31
+ finish();
26
32
  }
27
33
  });
28
34
  }
@@ -55,7 +61,9 @@ function getCreateMessage(identity, aud) {
55
61
  if (!isSigningIdentity(id)) {
56
62
  throw new Error('Identity does not support signing');
57
63
  }
58
- return id.signToken(payload, header);
64
+ return id.signToken(payload, {
65
+ header
66
+ });
59
67
  });
60
68
  };
61
69
  return aud ? (payload, header)=>createToken({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enkaku/client",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://enkaku.dev",
6
6
  "description": "Enkaku RPC client",
@@ -26,18 +26,18 @@
26
26
  ],
27
27
  "sideEffects": false,
28
28
  "dependencies": {
29
- "@enkaku/async": "^0.15.0",
30
- "@enkaku/event": "^0.15.0",
31
- "@enkaku/execution": "^0.15.0",
32
- "@enkaku/log": "^0.15.0",
33
- "@enkaku/otel": "^0.15.0",
34
- "@enkaku/stream": "^0.15.0",
35
- "@enkaku/token": "^0.15.0",
36
- "@enkaku/runtime": "^0.15.0"
29
+ "@enkaku/async": "^0.16.0",
30
+ "@enkaku/event": "^0.16.0",
31
+ "@enkaku/token": "^0.16.0",
32
+ "@enkaku/otel": "^0.16.0",
33
+ "@enkaku/runtime": "^0.16.0",
34
+ "@enkaku/execution": "^0.16.0",
35
+ "@enkaku/stream": "^0.16.0",
36
+ "@enkaku/log": "^0.16.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@enkaku/protocol": "^0.15.0",
40
- "@enkaku/transport": "^0.15.0"
39
+ "@enkaku/protocol": "^0.16.0",
40
+ "@enkaku/transport": "^0.16.0"
41
41
  },
42
42
  "scripts": {
43
43
  "build:clean": "del lib",