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

@therms/rpc-client

Package Overview
Dependencies
Maintainers
4
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@therms/rpc-client - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

dist/RPCClientIdentity.d.ts

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [2.2.1](http://bitbucket.org/thermsio/rpc-client-ts/compare/v2.2.0...v2.2.1) (2021-12-06)
### Bug Fixes
* add debug logs to WebSocketTransport ([9954900](http://bitbucket.org/thermsio/rpc-client-ts/commits/9954900bd40fd63cf9bcd1108de504af640515be))
# [2.2.0](http://bitbucket.org/thermsio/rpc-client-ts/compare/v2.1.2...v2.2.0) (2021-10-02)

@@ -2,0 +9,0 @@

15

dist/cjs.js

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

this.options = options;
debug('new WebSocketTransport()');
this.host = options.host;

@@ -535,4 +536,7 @@ this.connect();

connect = () => {
if (this.websocket)
debug('connect', this.host);
if (this.websocket) {
debug('connect() returning early, websocket already exists');
return;
}
this.websocketId = Math.random();

@@ -542,3 +546,3 @@ this.websocket = new WebSocket(this.host);

ws.onopen = () => {
console.log('WebSocket connected');
console.log('WebSocket connected:');
this.setConnectedToRemote(true);

@@ -556,2 +560,5 @@ if (this.identity) {

}
else {
debug('WebSocket closed, it was not connected to the remote');
}
this.setConnectedToRemote(false);

@@ -574,2 +581,5 @@ this.isWaitingForIdentityConfirmation = false;

}
else {
debug('WebSocket errored, it was not connected to the remote');
}
ws.close();

@@ -579,2 +589,3 @@ };

disconnect = () => {
debug('disconnect');
this.setConnectedToRemote(false);

@@ -581,0 +592,0 @@ this.isWaitingForIdentityConfirmation = false;

3

dist/index.d.ts

@@ -5,3 +5,4 @@ export { RPCClient, RPCClientOptions } from './RPCClient';

export { CallResponseDTO as RPCResponse } from './CallResponseDTO';
export { Identity as RPCIdentity } from './Identity';
export { RPCClientIdentity } from './RPCClientIdentity';
export { RPCClientIdentity as RPCIdentity } from './RPCClientIdentity';
//# sourceMappingURL=index.d.ts.map

@@ -7,3 +7,3 @@ import { Cache } from '../cache/Cache';

import { CallRequestInterceptor } from '../CallRequestInterceptor';
import { Identity } from '../Identity';
import { RPCClientIdentity } from '../RPCClientIdentity';
interface ClientManagerOptions {

@@ -23,3 +23,3 @@ cache?: Cache;

manageClientRequest(request: CallRequestDTO): Promise<CallResponseDTO>;
setIdentity(identity?: Identity): void;
setIdentity(identity?: RPCClientIdentity): void;
}

@@ -39,3 +39,3 @@ export declare class ClientManager implements ClientManager {

manageClientRequest: (request: CallRequestDTO<any>) => Promise<CallResponseDTO<any>>;
setIdentity: (identity?: Identity | undefined) => void;
setIdentity: (identity?: RPCClientIdentity | undefined) => void;
private interceptRequestMutator;

@@ -42,0 +42,0 @@ private interceptResponseMutator;

@@ -6,3 +6,3 @@ import { CallRequestDTO } from './CallRequestDTO';

import { Transport } from './transports/Transport';
import { Identity } from './Identity';
import { RPCClientIdentity } from './RPCClientIdentity';
export interface RPCClient {

@@ -12,3 +12,3 @@ call<Args = any, Data = any>(request: CallRequestDTO<Args> | string, args?: Args): Promise<CallResponseDTO<Data>>;

getCallCache<Args = any, Data = any>(request: CallRequestDTO<Args> | string, args?: Args): CallResponseDTO<Data> | undefined;
getIdentity(): Identity | undefined;
getIdentity(): RPCClientIdentity | undefined;
getInFlightCallCount(): number;

@@ -19,3 +19,3 @@ getWebSocketConnected(): boolean;

registerRequestInterceptor(requestInterceptor: CallRequestInterceptor): void;
setIdentity(identity?: Identity): void;
setIdentity(identity?: RPCClientIdentity): void;
}

@@ -49,3 +49,3 @@ export interface RPCClientOptions {

getCallCache: <Args = any, Data = any>(request: string | CallRequestDTO<Args>, args?: Args | undefined) => CallResponseDTO<Data> | undefined;
getIdentity: () => Identity | undefined;
getIdentity: () => RPCClientIdentity | undefined;
getInFlightCallCount: () => number;

@@ -56,4 +56,4 @@ getWebSocketConnected: () => boolean;

registerRequestInterceptor: (requestInterceptor: CallRequestInterceptor) => void;
setIdentity: (identity?: Identity | undefined) => void;
setIdentity: (identity?: RPCClientIdentity | undefined) => void;
}
//# sourceMappingURL=RPCClient.d.ts.map
import { Transport } from './Transport';
import { CallRequestDTO } from '../CallRequestDTO';
import { CallResponseDTO } from '../CallResponseDTO';
import { Identity } from '../Identity';
import { RPCClientIdentity } from '../RPCClientIdentity';
interface HTTPTransportOptions {

@@ -17,5 +17,5 @@ host: string;

sendRequest: (call: CallRequestDTO) => Promise<CallResponseDTO>;
setIdentity: (identity?: Identity | undefined) => void;
setIdentity: (identity?: RPCClientIdentity | undefined) => void;
}
export {};
//# sourceMappingURL=HTTPTransport.d.ts.map
import { CallRequestDTO } from '../CallRequestDTO';
import { CallResponseDTO } from '../CallResponseDTO';
import { Identity } from '../Identity';
import { RPCClientIdentity } from '../RPCClientIdentity';
export interface Transport {

@@ -8,4 +8,4 @@ isConnected(): boolean;

sendRequest(call: CallRequestDTO): Promise<CallResponseDTO>;
setIdentity(identity?: Identity): void;
setIdentity(identity?: RPCClientIdentity): void;
}
//# sourceMappingURL=Transport.d.ts.map
import { Transport } from './Transport';
import { CallRequestDTO } from '../CallRequestDTO';
import { CallResponseDTO } from '../CallResponseDTO';
import { Identity } from '../Identity';
import { RPCClientIdentity } from '../RPCClientIdentity';
interface WebSocketTransportOptions {
host: string;
identity?: Identity;
identity?: RPCClientIdentity;
onConnectionStatusChange?: (connected: boolean) => void;

@@ -24,3 +24,3 @@ }

sendRequest: (call: CallRequestDTO) => Promise<CallResponseDTO>;
setIdentity: (identity?: Identity | undefined) => void;
setIdentity: (identity?: RPCClientIdentity | undefined) => void;
private connect;

@@ -27,0 +27,0 @@ private disconnect;

@@ -21,2 +21,3 @@ import { CallResponseDTO } from '../CallResponseDTO.js';

this.options = options;
debug('new WebSocketTransport()');
this.host = options.host;

@@ -63,4 +64,7 @@ this.connect();

connect = () => {
if (this.websocket)
debug('connect', this.host);
if (this.websocket) {
debug('connect() returning early, websocket already exists');
return;
}
this.websocketId = Math.random();

@@ -70,3 +74,3 @@ this.websocket = new WebSocket(this.host);

ws.onopen = () => {
console.log('WebSocket connected');
console.log('WebSocket connected:');
this.setConnectedToRemote(true);

@@ -84,2 +88,5 @@ if (this.identity) {

}
else {
debug('WebSocket closed, it was not connected to the remote');
}
this.setConnectedToRemote(false);

@@ -102,2 +109,5 @@ this.isWaitingForIdentityConfirmation = false;

}
else {
debug('WebSocket errored, it was not connected to the remote');
}
ws.close();

@@ -107,2 +117,3 @@ };

disconnect = () => {
debug('disconnect');
this.setConnectedToRemote(false);

@@ -109,0 +120,0 @@ this.isWaitingForIdentityConfirmation = false;

{
"name": "@therms/rpc-client",
"version": "2.2.0",
"version": "2.2.1",
"description": "RPC framework, browser client lib",

@@ -5,0 +5,0 @@ "private": false,

@@ -76,3 +76,3 @@ # @therms/rpc-client

### Auth & Identity
### Auth & RPCClientIdentity

@@ -97,11 +97,11 @@ The RPC server implementation accepts a property with all RPC calls `identity` that contains information about the client's authentication info.

Once the RPC client instance identity is set, it will be maintained in-memory until explicitly changed with `setIdentity(identity: Identity)`.
Once the RPC client instance identity is set, it will be maintained in-memory until explicitly changed with `setIdentity(identity: RPCClientIdentity)`.
The `identity` can be overridden for a single request be passing an `identity` object to the method `call(request: RequestDTO)` when making a _call_. This **does not** override the maintained `identity` state that is set with `setIdentity`.
#### Http Identity State
#### Http RPCClientIdentity State
When the client lib sends a RPC request over HTTP, the RPC will always include the `identity` property when the back-end requires authentication/authorization for the specific procedure.
#### WebSocket Identity State
#### WebSocket RPCClientIdentity State

@@ -108,0 +108,0 @@ When the client lib makes a connection with the remote, the RPC client lib will immediately send the `identity` information to the remote and can expect the remote to maintain it's `identity` information as long as the WebSocket connection remains alive. The `identity` information will be sent everytime a new WebSocket connection is opened with the remote.

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

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc