@rest-hooks/endpoint
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -6,2 +6,11 @@ # Change Log | ||
### [1.2.5](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/endpoint@1.2.4...@rest-hooks/endpoint@1.2.5) (2022-04-16) | ||
### 🐛 Bug Fix | ||
* useFetcher() work with zero argument Endpoint ([#1514](https://github.com/coinbase/rest-hooks/issues/1514)) ([5bd749b](https://github.com/coinbase/rest-hooks/commit/5bd749b9c2209f8af6b5fde95fecf1a051b4d016)) | ||
### [1.2.4](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/endpoint@1.2.3...@rest-hooks/endpoint@1.2.4) (2021-09-08) | ||
@@ -8,0 +17,0 @@ |
/* eslint-disable @typescript-eslint/ban-types */ | ||
import type { Schema, schema } from '@rest-hooks/normalizr'; | ||
import type { EndpointInterface } from './interface'; | ||
import type { EndpointExtraOptions, FetchFunction } from './types'; | ||
import type { ResolveType } from './utility'; | ||
import type { EndpointInterface } from './interface'; | ||
@@ -36,23 +36,6 @@ export interface EndpointOptions< | ||
export type ExtendedEndpoint< | ||
O extends EndpointExtendOptions<F>, | ||
E extends EndpointInstance< | ||
FetchFunction, | ||
Schema | undefined, | ||
true | undefined | ||
>, | ||
F extends FetchFunction, | ||
> = Omit<O, keyof EndpointInstance<FetchFunction>> & | ||
Omit<E, keyof EndpointInstance<FetchFunction>> & | ||
EndpointInstance< | ||
'fetch' extends keyof O ? Exclude<O['fetch'], undefined> : E['fetch'], | ||
'schema' extends keyof O ? O['schema'] : E['_schema'], | ||
'sideEffect' extends keyof O ? O['sideEffect'] : E['sideEffect'] | ||
>; | ||
export function Make(...args: any[]): EndpointInstance<FetchFunction>; | ||
/** | ||
* Defines an async data source. | ||
* @see https://resthooks.io/docs/api/Endpoint | ||
* Creates a new function. | ||
*/ | ||
@@ -143,3 +126,15 @@ export interface EndpointInstance< | ||
options: O, | ||
): ExtendedEndpoint<typeof options, E, F>; | ||
): Omit<O, keyof EndpointInstance<FetchFunction>> & | ||
Omit<E, keyof EndpointInstance<FetchFunction>> & | ||
EndpointInstance< | ||
'fetch' extends keyof typeof options | ||
? Exclude<typeof options['fetch'], undefined> | ||
: E['fetch'], | ||
'schema' extends keyof typeof options | ||
? typeof options['schema'] | ||
: E['_schema'], | ||
'sideEffect' extends keyof typeof options | ||
? typeof options['sideEffect'] | ||
: E['sideEffect'] | ||
>; | ||
@@ -153,3 +148,7 @@ /** The following is for compatibility with FetchShape */ | ||
/** @deprecated */ | ||
getFetchKey(params: Parameters<F>[0]): string; | ||
getFetchKey( | ||
...args: Parameters<F>[0] extends undefined | ||
? [] | ||
: [params: Parameters<F>[0]] | ||
): string; | ||
/** @deprecated */ | ||
@@ -156,0 +155,0 @@ options?: EndpointExtraOptions<F>; |
@@ -1,10 +0,10 @@ | ||
export { EndpointInterface, ReadEndpoint, MutateEndpoint, IndexInterface, IndexParams, ArrayElement, } from "./interface"; | ||
export { EndpointOptions, EndpointInstance, } from "./endpoint"; | ||
export { Normalize, NormalizeNullable, Denormalize, DenormalizeNullable, } from "./normal"; | ||
export { schema, Entity, isEntity, DELETED } from '@rest-hooks/normalizr'; | ||
export type { EndpointInterface, ReadEndpoint, MutateEndpoint, IndexInterface, IndexParams, ArrayElement, } from './interface'; | ||
export type { EndpointOptions, EndpointInstance } from './endpoint'; | ||
export type { Normalize, NormalizeNullable, Denormalize, DenormalizeNullable, } from './normal'; | ||
export { schema, SimpleRecord, Entity, isEntity, DELETED, } from '@rest-hooks/normalizr'; | ||
export type { AbstractInstanceType, Schema } from '@rest-hooks/normalizr'; | ||
export { EndpointExtraOptions, FetchFunction, OptimisticUpdateParams, UpdateFunction, SchemaDetail, SchemaList, } from "./types"; | ||
export { ResolveType, EndpointParam, InferReturn, } from "./utility"; | ||
export { default as Endpoint } from "./endpoint"; | ||
export { default as Index } from "./indexEndpoint"; | ||
export type { EndpointExtraOptions, FetchFunction, OptimisticUpdateParams, UpdateFunction, SchemaDetail, SchemaList, } from './types'; | ||
export type { ResolveType, EndpointParam, InferReturn } from './utility'; | ||
export { default as Endpoint } from './endpoint'; | ||
export { default as Index } from './indexEndpoint'; | ||
//# sourceMappingURL=index.d.ts.map |
import { Schema } from '@rest-hooks/normalizr'; | ||
import type { IndexInterface, IndexParams } from "./interface"; | ||
/** | ||
* Performant lookups by secondary indexes | ||
* @see https://resthooks.io/docs/api/Index | ||
*/ | ||
import type { IndexInterface, IndexParams } from './interface'; | ||
export default class Index<S extends Schema, P = Readonly<IndexParams<S>>> implements IndexInterface<S, P> { | ||
@@ -8,0 +4,0 @@ schema: S; |
import { Schema, AbstractInstanceType } from '@rest-hooks/normalizr'; | ||
import type { EndpointExtraOptions, FetchFunction } from "./types"; | ||
import { InferReturn } from "./utility"; | ||
import type { EndpointExtraOptions, FetchFunction } from './types'; | ||
import { InferReturn } from './utility'; | ||
/** Defines a networking endpoint */ | ||
@@ -5,0 +5,0 @@ export interface EndpointInterface<F extends FetchFunction = FetchFunction, S extends Schema | undefined = Schema | undefined, M extends true | undefined = true | undefined> extends EndpointExtraOptions<F> { |
import { schema, Schema } from '@rest-hooks/normalizr'; | ||
import { Normalize } from "./normal"; | ||
import { EndpointInterface } from "./interface"; | ||
import { ResolveType } from "./utility"; | ||
import { Normalize } from './normal'; | ||
import { EndpointInterface } from './interface'; | ||
import { ResolveType } from './utility'; | ||
export interface EndpointExtraOptions<F extends FetchFunction = FetchFunction> { | ||
@@ -16,4 +16,2 @@ /** Default data expiry length, will fall back to NetworkManager default if not defined */ | ||
readonly optimisticUpdate?: (...args: Parameters<F>) => ResolveType<F>; | ||
/** Determines whether to throw or fallback to */ | ||
readonly errorPolicy?: (error: any) => 'soft' | undefined; | ||
/** User-land extra data to send */ | ||
@@ -20,0 +18,0 @@ readonly extra?: any; |
import { Schema } from '@rest-hooks/normalizr'; | ||
import { Denormalize } from "./normal"; | ||
import { FetchFunction } from "./types"; | ||
import { Denormalize } from './normal'; | ||
import { FetchFunction } from './types'; | ||
/** What the function's promise resolves to */ | ||
@@ -5,0 +5,0 @@ export declare type ResolveType<E extends (...args: any) => any> = ReturnType<E> extends Promise<infer R> ? R : never; |
{ | ||
"name": "@rest-hooks/endpoint", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "Declarative Network Interface Definitions", | ||
@@ -81,5 +81,5 @@ "sideEffects": false, | ||
"@babel/runtime": "^7.7.2", | ||
"@rest-hooks/normalizr": "^7.5.1" | ||
"@rest-hooks/normalizr": "^7.5.2" | ||
}, | ||
"gitHead": "0a735a3a198039145cfd5244319c0e228610100b" | ||
"gitHead": "2e6c2e438ffb6bbe6cb2ef15fc2d1db5e6568fd0" | ||
} |
@@ -146,3 +146,7 @@ /* eslint-disable @typescript-eslint/ban-types */ | ||
/** @deprecated */ | ||
getFetchKey(params: Parameters<F>[0]): string; | ||
getFetchKey( | ||
...args: Parameters<F>[0] extends undefined | ||
? [] | ||
: [params: Parameters<F>[0]] | ||
): string; | ||
/** @deprecated */ | ||
@@ -149,0 +153,0 @@ options?: EndpointExtraOptions<F>; |
@@ -1,10 +0,10 @@ | ||
export { EndpointInterface, ReadEndpoint, MutateEndpoint, IndexInterface, IndexParams, ArrayElement, } from "./interface"; | ||
export { EndpointOptions, EndpointInstance, } from "./endpoint"; | ||
export { Normalize, NormalizeNullable, Denormalize, DenormalizeNullable, } from "./normal"; | ||
export { schema, Entity, isEntity, DELETED } from '@rest-hooks/normalizr'; | ||
export { EndpointInterface, ReadEndpoint, MutateEndpoint, IndexInterface, IndexParams, ArrayElement, } from './interface'; | ||
export { EndpointOptions, EndpointInstance } from './endpoint'; | ||
export { Normalize, NormalizeNullable, Denormalize, DenormalizeNullable, } from './normal'; | ||
export { schema, SimpleRecord, Entity, isEntity, DELETED, } from '@rest-hooks/normalizr'; | ||
export { AbstractInstanceType, Schema } from '@rest-hooks/normalizr'; | ||
export { EndpointExtraOptions, FetchFunction, OptimisticUpdateParams, UpdateFunction, SchemaDetail, SchemaList, } from "./types"; | ||
export { ResolveType, EndpointParam, InferReturn, } from "./utility"; | ||
export { default as Endpoint } from "./endpoint"; | ||
export { default as Index } from "./indexEndpoint"; | ||
export { EndpointExtraOptions, FetchFunction, OptimisticUpdateParams, UpdateFunction, SchemaDetail, SchemaList, } from './types'; | ||
export { ResolveType, EndpointParam, InferReturn } from './utility'; | ||
export { default as Endpoint } from './endpoint'; | ||
export { default as Index } from './indexEndpoint'; | ||
//# sourceMappingURL=index.d.ts.map |
import { Schema } from '@rest-hooks/normalizr'; | ||
import { IndexInterface, IndexParams } from "./interface"; | ||
/** | ||
* Performant lookups by secondary indexes | ||
* @see https://resthooks.io/docs/api/Index | ||
*/ | ||
import { IndexInterface, IndexParams } from './interface'; | ||
export default class Index<S extends Schema, P = Readonly<IndexParams<S>>> implements IndexInterface<S, P> { | ||
@@ -8,0 +4,0 @@ schema: S; |
import { Schema, AbstractInstanceType } from '@rest-hooks/normalizr'; | ||
import { EndpointExtraOptions, FetchFunction } from "./types"; | ||
import { InferReturn } from "./utility"; | ||
import { EndpointExtraOptions, FetchFunction } from './types'; | ||
import { InferReturn } from './utility'; | ||
/** Defines a networking endpoint */ | ||
@@ -5,0 +5,0 @@ export interface EndpointInterface<F extends FetchFunction = FetchFunction, S extends Schema | undefined = Schema | undefined, M extends true | undefined = true | undefined> extends EndpointExtraOptions<F> { |
import { Schema } from '@rest-hooks/normalizr'; | ||
import { Denormalize } from "./normal"; | ||
import { FetchFunction } from "./types"; | ||
import { Denormalize } from './normal'; | ||
import { FetchFunction } from './types'; | ||
/** What the function's promise resolves to */ | ||
@@ -5,0 +5,0 @@ export declare type ResolveType<E extends (...args: any) => any> = ReturnType<E> extends Promise<infer R> ? R : never; |
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
2
131950
43
1969
Updated@rest-hooks/normalizr@^7.5.2