@novasamatech/host-api 0.9.4 → 0.10.1
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/dist/hostApi.js +102 -3
- package/dist/index.d.ts +7 -1
- package/dist/index.js +6 -1
- package/dist/protocol/callError.d.ts +63 -0
- package/dist/protocol/callError.js +57 -0
- package/dist/protocol/impl.d.ts +370 -54
- package/dist/protocol/impl.js +86 -10
- package/dist/protocol/messageCodec.d.ts +903 -109
- package/dist/protocol/v1/accounts.d.ts +10 -10
- package/dist/protocol/v1/accounts.js +12 -11
- package/dist/protocol/v1/chainInteraction.d.ts +44 -12
- package/dist/protocol/v1/chainInteraction.js +25 -15
- package/dist/protocol/v1/chat.d.ts +3 -3
- package/dist/protocol/v1/chat.js +5 -4
- package/dist/protocol/v1/coinPayment.d.ts +345 -0
- package/dist/protocol/v1/coinPayment.js +105 -0
- package/dist/protocol/v1/createTransaction.d.ts +9 -9
- package/dist/protocol/v1/createTransaction.js +4 -3
- package/dist/protocol/v1/deriveEntropy.d.ts +1 -1
- package/dist/protocol/v1/deriveEntropy.js +2 -2
- package/dist/protocol/v1/devicePermission.d.ts +1 -1
- package/dist/protocol/v1/devicePermission.js +3 -2
- package/dist/protocol/v1/feature.d.ts +1 -1
- package/dist/protocol/v1/feature.js +3 -2
- package/dist/protocol/v1/handshake.d.ts +1 -1
- package/dist/protocol/v1/handshake.js +3 -2
- package/dist/protocol/v1/localStorage.d.ts +10 -3
- package/dist/protocol/v1/localStorage.js +10 -4
- package/dist/protocol/v1/locale.d.ts +8 -0
- package/dist/protocol/v1/locale.js +7 -0
- package/dist/protocol/v1/navigation.d.ts +1 -1
- package/dist/protocol/v1/navigation.js +3 -2
- package/dist/protocol/v1/notification.d.ts +2 -2
- package/dist/protocol/v1/notification.js +4 -3
- package/dist/protocol/v1/payments.d.ts +8 -8
- package/dist/protocol/v1/payments.js +4 -3
- package/dist/protocol/v1/preimage.d.ts +1 -1
- package/dist/protocol/v1/preimage.js +3 -2
- package/dist/protocol/v1/remotePermission.d.ts +1 -1
- package/dist/protocol/v1/remotePermission.js +3 -2
- package/dist/protocol/v1/resourceAllocation.d.ts +1 -1
- package/dist/protocol/v1/resourceAllocation.js +3 -2
- package/dist/protocol/v1/sign.d.ts +4 -4
- package/dist/protocol/v1/sign.js +6 -5
- package/dist/protocol/v1/statementStore.d.ts +3 -3
- package/dist/protocol/v1/statementStore.js +5 -4
- package/dist/protocol/v1/system.d.ts +23 -0
- package/dist/protocol/v1/system.js +21 -0
- package/dist/protocol/v1/worker.d.ts +37 -0
- package/dist/protocol/v1/worker.js +20 -0
- package/dist/transport.js +16 -2
- package/dist/transport.spec.js +18 -0
- package/package.json +3 -3
package/dist/transport.spec.js
CHANGED
|
@@ -57,6 +57,24 @@ describe('transport', () => {
|
|
|
57
57
|
expect(s1Handler).toHaveBeenCalledTimes(1);
|
|
58
58
|
expect(s2Handler).toHaveBeenCalledTimes(2);
|
|
59
59
|
});
|
|
60
|
+
it('isolates a throwing subscriber so siblings on the same subscription still receive', () => {
|
|
61
|
+
const providers = createProviders();
|
|
62
|
+
const events = createNanoEvents();
|
|
63
|
+
const host = createTransport(providers.host);
|
|
64
|
+
const sdk = createTransport(providers.sdk);
|
|
65
|
+
host.handleSubscription('host_account_connection_status_subscribe', (_, send) => events.on('push', () => send({ tag: 'v1', value: 'connected' })));
|
|
66
|
+
const throwing = vi.fn(() => {
|
|
67
|
+
throw new Error('subscriber boom');
|
|
68
|
+
});
|
|
69
|
+
const healthy = vi.fn();
|
|
70
|
+
sdk.subscribe('host_account_connection_status_subscribe', { tag: 'v1', value: undefined }, throwing);
|
|
71
|
+
sdk.subscribe('host_account_connection_status_subscribe', { tag: 'v1', value: undefined }, healthy);
|
|
72
|
+
// A throw in the first subscriber must neither escape the dispatch nor
|
|
73
|
+
// starve the second subscriber on the same subscription.
|
|
74
|
+
expect(() => events.emit('push')).not.toThrow();
|
|
75
|
+
expect(throwing).toHaveBeenCalledTimes(1);
|
|
76
|
+
expect(healthy).toHaveBeenCalledTimes(1);
|
|
77
|
+
});
|
|
60
78
|
});
|
|
61
79
|
describe('debug hook', () => {
|
|
62
80
|
it('emits outgoing events when postMessage is called and still delivers the message', () => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novasamatech/host-api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.1",
|
|
5
5
|
"description": "Host API: transport implementation for host - product integration.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@novasamatech/scale": "0.
|
|
25
|
+
"@novasamatech/scale": "0.10.1",
|
|
26
26
|
"nanoevents": "10.0.0",
|
|
27
|
-
"nanoid": "6.0.
|
|
27
|
+
"nanoid": "6.0.1",
|
|
28
28
|
"neverthrow": "^8.2.0",
|
|
29
29
|
"scale-ts": "1.6.1"
|
|
30
30
|
},
|