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

@rest-hooks/endpoint

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rest-hooks/endpoint - npm Package Compare versions

Comparing version 0.4.3 to 0.5.0

src/__tests__/indexEndpoint.ts

9

CHANGELOG.md

@@ -6,2 +6,11 @@ # Change Log

## 0.5.0 (2020-07-27)
* feat: Add @rest-hooks/rest package (#375) ([5e5c125](https://github.com/coinbase/rest-hooks/commit/5e5c125)), closes [#375](https://github.com/coinbase/rest-hooks/issues/375)
* feat: Support helper methods ([c3fb075](https://github.com/coinbase/rest-hooks/commit/c3fb075))
## <small>0.4.3 (2020-07-22)</small>

@@ -8,0 +17,0 @@

3

lib/endpoint.d.ts

@@ -93,3 +93,4 @@ /* eslint-disable @typescript-eslint/ban-types */

E extends EndpointInstance<any, S, any>,
O extends EndpointExtendOptions<K, any, any>,
O extends EndpointExtendOptions<K, any, any> &
Partial<ThisParameterType<E['fetch']>>,
K extends (

@@ -96,0 +97,0 @@ this: ThisParameterType<

{
"name": "@rest-hooks/endpoint",
"version": "0.4.3",
"version": "0.5.0",
"description": "Declarative Network Interface Definitions",

@@ -57,3 +57,3 @@ "sideEffects": false,

},
"gitHead": "796bad7931b65611c4c4c1532e851e67ea6ad97b"
"gitHead": "85d6b4b1c05ddecfe055008f64184db9b0a6dda2"
}

@@ -254,2 +254,29 @@ import nock from 'nock';

describe('helper members', () => {
it('url helper', async () => {
const url = ({ id }: { id: string }) => `/users/${id}`;
const fetchUsers = function (
this: { url: (params: { id: string }) => string },
{ id }: { id: string },
) {
return fetch(this.url({ id })).then(res => res.json()) as Promise<
typeof payload
>;
};
// @ts-expect-error
new Endpoint(fetchUsers, { url: '' });
// @ts-expect-error
new Endpoint(fetchUsers, { url }).extend({ url: 'hi' });
const UserDetail = new Endpoint(fetchUsers, { url }).extend({ url });
// check return type and call params
const response = await UserDetail({ id: payload.id });
expect(response).toEqual(payload);
expect(response.username).toBe(payload.username);
// @ts-expect-error
expect(response.notexist).toBeUndefined();
});
});
/*describe('class', () => {

@@ -256,0 +283,0 @@ describe('auth patterns', () => {

@@ -93,3 +93,4 @@ /* eslint-disable @typescript-eslint/ban-types */

E extends EndpointInstance<any, S, any>,
O extends EndpointExtendOptions<K, any, any>,
O extends EndpointExtendOptions<K, any, any> &
Partial<ThisParameterType<E['fetch']>>,
K extends (

@@ -96,0 +97,0 @@ this: ThisParameterType<

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