New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@remote-ui/rpc

Package Overview
Dependencies
Maintainers
3
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remote-ui/rpc - npm Package Compare versions

Comparing version

to
1.3.3

2

build/cjs/endpoint.js

@@ -161,2 +161,3 @@ 'use strict';

}]);
throw error;
} finally {

@@ -211,2 +212,3 @@ stackFrame.release();

}]);
throw error;
}

@@ -213,0 +215,0 @@

@@ -8,2 +8,6 @@ # Changelog

## [1.3.3] - 2022-08-15
- Errors in exposed methods are now rethrown where they occur ([pull request](https://github.com/Shopify/remote-ui/pull/173)).
## [1.3.1] - 2022-03-10

@@ -10,0 +14,0 @@

4

package.json
{
"name": "@remote-ui/rpc",
"description": "An RPC library with strong support for simulating the transfer of functions via postMessage",
"version": "1.3.2",
"version": "1.3.3",
"publishConfig": {

@@ -26,3 +26,3 @@ "access": "public"

},
"gitHead": "972d276de41f404b4c3f5964eea016b120d3f4d7"
"gitHead": "74cd41c4fe67ef9b9bb7f8c597c722b7eb848b50"
}

@@ -194,2 +194,3 @@ import {createBasicEncoder} from './encoding';

send(RESULT, [id, {name, message, stack}]);
throw error;
} finally {

@@ -235,2 +236,3 @@ stackFrame.release();

send(FUNCTION_RESULT, [callId, {name, message, stack}]);
throw error;
}

@@ -237,0 +239,0 @@

@@ -0,1 +1,2 @@

import {MessageEndpoint} from '../types';
import {createEndpoint, TERMINATE} from '../endpoint';

@@ -52,3 +53,3 @@ import {fromMessagePort} from '../adaptors';

);
const endpoint2 = createEndpoint(fromMessagePort(port2));
const endpoint2 = createEndpoint(createCatchingMessageEndpoint(port2));

@@ -64,2 +65,35 @@ await expect(endpoint1.call.hello()).rejects.toMatchObject({

it('re-throws errors thrown in exposed methods', async () => {
expect.assertions(2);
const {port1, port2} = new MessageChannel();
port1.start();
port2.start();
const endpoint1 = createEndpoint<{hello(): string}>(
fromMessagePort(port1),
);
const messageEndpoint2 = fromMessagePort(port2);
const endpoint2 = createEndpoint({
...messageEndpoint2,
addEventListener(event, listener) {
messageEndpoint2.addEventListener(event, async (...args) => {
await expect(listener(...args)).rejects.toMatchObject({
message: expect.stringContaining('this is broken'),
});
});
},
});
endpoint2.expose({
hello: () => {
throw new Error('this is broken');
},
});
await expect(endpoint1.call.hello()).rejects.toMatchObject({
message: expect.stringContaining('this is broken'),
});
});
it('deletes an exposed value by passing undefined', async () => {

@@ -73,3 +107,3 @@ const {port1, port2} = new MessageChannel();

);
const endpoint2 = createEndpoint(fromMessagePort(port2));
const endpoint2 = createEndpoint(createCatchingMessageEndpoint(port2));

@@ -168,1 +202,19 @@ endpoint2.expose({hello: () => 'world'});

});
function createCatchingMessageEndpoint(
messagePort: MessagePort,
): MessageEndpoint {
const messageEndpoint = fromMessagePort(messagePort);
return {
...messageEndpoint,
addEventListener: (event, listener) => {
messageEndpoint.addEventListener(event, async (...args) => {
try {
await listener(...args);
// eslint-disable-next-line no-empty
} catch {}
});
},
};
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet