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
2
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 1.2.1 to 1.2.2

dist/utils/request.d.ts

9

CHANGELOG.md

@@ -0,1 +1,10 @@

## [1.2.2](http://bitbucket.org/thermsio/rpc-client-ts/compare/v1.2.1...v1.2.2) (2021-05-17)
### Bug Fixes
* debug logging ([af0ce23](http://bitbucket.org/thermsio/rpc-client-ts/commits/af0ce2395f6e9c27f4c1653cb58fbe1129e1f0aa))
* postinstall script ([429b495](http://bitbucket.org/thermsio/rpc-client-ts/commits/429b49563acdd7e958cf7de2fcb1d36c2216f89a))
* **InMemoryCache:** json string/parse before get/set ([b7cb925](http://bitbucket.org/thermsio/rpc-client-ts/commits/b7cb925633873db34c874a910911ba23f738c057))
## [1.2.1](http://bitbucket.org/thermsio/rpc-client-ts/compare/v1.2.0...v1.2.1) (2021-05-16)

@@ -2,0 +11,0 @@

2

dist/CallRequestDTO.d.ts

@@ -0,1 +1,3 @@

export declare const DEFAULT_REQUEST_SCOPE = "global";
export declare const DEFAULT_REQUEST_VERSION = "1";
export interface CallRequestDTO {

@@ -2,0 +4,0 @@ args?: any;

10

dist/RPCClient.d.ts

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

export interface RPCClient {
call(request: CallRequestDTO): Promise<CallResponseDTO>;
call(request: CallRequestDTO | string, args?: any): Promise<CallResponseDTO>;
clearCache(request?: CallRequestDTO): void;
getCallCache(request: CallRequestDTO): CallResponseDTO | undefined;
getCallCache(request: CallRequestDTO | string, args?: any): CallResponseDTO | undefined;
getInFlightCallCount(): number;
getWebSocketConnected(): boolean;
makeProcedure(request: CallRequestDTO): (args?: any) => Promise<CallResponseDTO>;
makeProcedure(request: CallRequestDTO | string): (args?: any) => Promise<CallResponseDTO>;
setIdentity(identity?: Identity): void;

@@ -42,7 +42,7 @@ }

clearCache: (request?: CallRequestDTO | undefined) => void;
getCallCache: (request: CallRequestDTO) => CallResponseDTO | undefined;
getCallCache: (request: string | CallRequestDTO, args?: any) => CallResponseDTO | undefined;
getIdentity: () => Identity | undefined;
getInFlightCallCount: () => number;
getWebSocketConnected: () => boolean;
makeProcedure: (request: CallRequestDTO) => (args?: any) => Promise<CallResponseDTO>;
makeProcedure: (request: string | CallRequestDTO) => (args?: any) => Promise<CallResponseDTO>;
setIdentity: (identity?: Identity | undefined) => void;

@@ -49,0 +49,0 @@ }

{
"name": "@therms/rpc-client",
"version": "1.2.1",
"version": "1.2.2",
"description": "RPC framework, browser client lib",
"private": false,
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build:prod": "rollup -c",
"postinstall": "npm update @therms/rpc-server",
"postinstall": "npx update-by-scope @therms",
"test": "jest"

@@ -12,0 +12,0 @@ },

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

},
});
})

@@ -48,3 +48,3 @@ /* Make a remote procedure call */

version: '1',
});
})
```

@@ -54,2 +54,13 @@

#### Shorthand Request
This client lib provides the option to use a request string for shorthand calls:
```js
const { data } = await rpc.call('procedure::scope::version')
// 2nd arg is optionally "args" passed with request
const { data } = await rpc.call('get-users::users::1', { active: true })
```
#### Catch Failed Calls

@@ -70,3 +81,3 @@

The RPC server implementation accepts a property with all RPC calls `identity` that contains information about the client's authentication info.
The RPC server implementation accepts a property with all RPC calls `identity` that contains information about the client's authentication info.

@@ -83,3 +94,3 @@ The `identity` property schema:

The client library implementation is responsible for sending the `identity` property with RPC's to the back-end. The `identity` information can be set with the client like this:
The client library implementation is responsible for sending the `identity` property with RPC's to the back-end. The `identity` information can be set with the client like this:

@@ -111,3 +122,3 @@ ```typescript

},
});
})
```

@@ -123,7 +134,7 @@

requestInterceptor: (request) => {
request.args.count = request.args.count + 1;
request.args.count = request.args.count + 1
return request;
return request
},
});
})

@@ -133,5 +144,5 @@ const { data } = await rpc.call({

procedure: 'intercept-request',
});
})
console.log(data.count); // => 2
console.log(data.count) // => 2
```

@@ -147,7 +158,7 @@

responseInterceptor: (response) => {
response.data.count = 100;
response.data.count = 100
return response;
return response
},
});
})

@@ -157,5 +168,5 @@ const { data } = await rpc.call({

procedure: 'intercept-request',
});
})
console.log(data.count); // => 100
console.log(data.count) // => 100
```

@@ -172,6 +183,6 @@

isConnected() {
return true;
return true
}
name: 'CustomHTTPTransport';
name: 'CustomHTTPTransport'

@@ -181,9 +192,9 @@ async sendRequest(call) {

data: call,
}).then((res) => res.json());
}).then((res) => res.json())
return response;
return response
}
setIdentity(identity) {
this.identity = identity;
this.identity = identity
}

@@ -202,3 +213,3 @@ }

},
});
})
```

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 too big to display

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