@@ -1205,6 +1205,7 @@ type ExtractCollection<S extends Schema | undefined> = S extends ({
12051205 push : any ;
12061206 unshift : any ;
12071207 assign : any ;
1208+ remove : any ;
12081209 schema : Schema ;
12091210} ) ? S : S extends Object$1 < infer T > ? ExtractObject < T > : S extends Exclude < Schema , {
12101211 [ K : string ] : any ;
@@ -1356,6 +1357,12 @@ interface RestInstance<F extends FetchFunction = FetchFunction, S extends Schema
13561357 assign : AddEndpoint < F , ExtractCollection < S > , Exclude < O , 'body' | 'method' > & {
13571358 body : Record < string , OptionsToAdderBodyArgument < O > > | FormData ;
13581359 } > ;
1360+ /** Remove item(s) (PATCH) from collection
1361+ * @see https://dataclient.io/rest/api/RestEndpoint#remove
1362+ */
1363+ remove : RemoveEndpoint < F , ExtractCollection < S > [ 'remove' ] , Exclude < O , 'body' | 'method' > & {
1364+ body : OptionsToAdderBodyArgument < O > | OptionsToAdderBodyArgument < O > [ ] | FormData ;
1365+ } > ;
13591366}
13601367type RestEndpointExtendOptions < O extends PartialRestGenerics , E extends {
13611368 body ?: any ;
@@ -1430,17 +1437,39 @@ type PaginationEndpoint<E extends FetchFunction & RestGenerics & {
14301437} , A extends any [ ] > = RestInstanceBase < ParamFetchNoBody < A [ 0 ] , ResolveType < E > > , E [ 'schema' ] , E [ 'sideEffect' ] , Pick < E , 'path' | 'searchParams' | 'body' > & {
14311438 searchParams : Omit < A [ 0 ] , keyof PathArgs < E [ 'path' ] > > ;
14321439} > ;
1433- type PaginationFieldEndpoint < E extends FetchFunction & RestGenerics & {
1434- sideEffect ?: boolean | undefined ;
1435- } , C extends string > = RestInstanceBase < ParamFetchNoBody < {
1440+ /** Merge pagination field C into body, making it required */
1441+ type PaginationIntoBody < Body , C extends string > = Body & {
1442+ [ K in C ] : string | number | boolean ;
1443+ } ;
1444+ /** Paginated searchParams type */
1445+ type PaginatedSearchParams < E extends {
1446+ searchParams ?: any ;
1447+ path ?: string ;
1448+ } , C extends string > = {
14361449 [ K in C ] : string | number | boolean ;
1437- } & E [ 'searchParams' ] & PathArgs < Exclude < E [ 'path' ] , undefined > > , ResolveType < E > > , E [ 'schema' ] , E [ 'sideEffect' ] , Pick < E , 'path' | 'searchParams' | 'body' > & {
1450+ } & E [ 'searchParams' ] & PathArgs < Exclude < E [ 'path' ] , undefined > > ;
1451+ /** searchParams version: pagination in searchParams, optional body support */
1452+ type PaginationFieldInSearchParams < E extends FetchFunction & RestGenerics & {
1453+ sideEffect ?: boolean | undefined ;
1454+ } , C extends string > = RestInstanceBase < ParamFetchNoBody < PaginatedSearchParams < E , C > , ResolveType < E > > | ParamFetchWithBody < PaginatedSearchParams < E , C > , NonNullable < E [ 'body' ] > , ResolveType < E > > , E [ 'schema' ] , E [ 'sideEffect' ] , Pick < E , 'path' | 'searchParams' | 'body' > & {
14381455 searchParams : {
14391456 [ K in C ] : string | number | boolean ;
14401457 } & E [ 'searchParams' ] ;
14411458} > & {
14421459 paginationField : C ;
14431460} ;
1461+ /** body version: pagination field is in body (body required) */
1462+ type PaginationFieldInBody < E extends FetchFunction & RestGenerics & {
1463+ sideEffect ?: boolean | undefined ;
1464+ } , C extends string > = RestInstanceBase < ParamFetchWithBody < E [ 'searchParams' ] & PathArgs < Exclude < E [ 'path' ] , undefined > > , PaginationIntoBody < E [ 'body' ] , C > , ResolveType < E > > , E [ 'schema' ] , E [ 'sideEffect' ] , Pick < E , 'path' | 'searchParams' > & {
1465+ body : PaginationIntoBody < E [ 'body' ] , C > ;
1466+ } > & {
1467+ paginationField : C ;
1468+ } ;
1469+ /** Retrieves the next page of results by pagination field */
1470+ type PaginationFieldEndpoint < E extends FetchFunction & RestGenerics & {
1471+ sideEffect ?: boolean | undefined ;
1472+ } , C extends string > = undefined extends E [ 'body' ] ? PaginationFieldInSearchParams < E , C > : C extends keyof E [ 'body' ] ? PaginationFieldInBody < E , C > : PaginationFieldInSearchParams < E , C > ;
14441473type AddEndpoint < F extends FetchFunction = FetchFunction , S extends Schema | undefined = any , O extends {
14451474 path : string ;
14461475 body : any ;
@@ -1451,6 +1480,16 @@ type AddEndpoint<F extends FetchFunction = FetchFunction, S extends Schema | und
14511480} > = RestInstanceBase < RestFetch < 'searchParams' extends keyof O ? O [ 'searchParams' ] extends undefined ? PathArgs < Exclude < O [ 'path' ] , undefined > > : O [ 'searchParams' ] & PathArgs < Exclude < O [ 'path' ] , undefined > > : PathArgs < Exclude < O [ 'path' ] , undefined > > , O [ 'body' ] , ResolveType < F > > , S , true , Omit < O , 'method' > & {
14521481 method : 'POST' ;
14531482} > ;
1483+ type RemoveEndpoint < F extends FetchFunction = FetchFunction , S extends Schema | undefined = any , O extends {
1484+ path : string ;
1485+ body : any ;
1486+ searchParams ?: any ;
1487+ } = {
1488+ path : string ;
1489+ body : any ;
1490+ } > = RestInstanceBase < RestFetch < 'searchParams' extends keyof O ? O [ 'searchParams' ] extends undefined ? PathArgs < Exclude < O [ 'path' ] , undefined > > : O [ 'searchParams' ] & PathArgs < Exclude < O [ 'path' ] , undefined > > : PathArgs < Exclude < O [ 'path' ] , undefined > > , O [ 'body' ] , ResolveType < F > > , S , true , Omit < O , 'method' > & {
1491+ method : 'PATCH' ;
1492+ } > ;
14541493type OptionsToAdderBodyArgument < O extends {
14551494 body ?: any ;
14561495} > = 'body' extends keyof O ? O [ 'body' ] : any ;
@@ -1798,4 +1837,4 @@ declare class NetworkError extends Error {
17981837 constructor ( response : Response ) ;
17991838}
18001839
1801- export { type AbstractInstanceType , type AddEndpoint , Array$1 as Array , type CheckLoop , Collection , type CustomResource , type DefaultArgs , type Defaults , type Denormalize , type DenormalizeNullable , type DenormalizeNullableObject , type DenormalizeObject , Endpoint , type EndpointExtendOptions , type EndpointExtraOptions , type EndpointInstance , type EndpointInstanceInterface , type EndpointInterface , type EndpointOptions , type EndpointParam , type EndpointToFunction , type EntitiesInterface , type EntitiesPath , Entity , type EntityFields , type EntityInterface , type EntityMap , EntityMixin , type EntityPath , type EntityTable , type ErrorTypes , type ExpiryStatusInterface , ExtendableEndpoint , type ExtendedResource , type FetchFunction , type FetchGet , type FetchMutate , type FromFallBack , type GetEndpoint , type GetEntity , type GetIndex , type HookResource , type HookableEndpointInterface , type IEntityClass , type IEntityInstance , type INormalizeDelegate , type IQueryDelegate , type RestEndpoint$1 as IRestEndpoint , type IndexPath , Invalidate , type KeyofEndpointInstance , type KeyofRestEndpoint , type KeysToArgs , type Mergeable , type MethodToSide , type MutateEndpoint , type NI , NetworkError , type Normalize , type NormalizeNullable , type NormalizeObject , type NormalizedEntity , type NormalizedIndex , type NormalizedNullableObject , type ObjectArgs , type OptionsToFunction , type PaginationEndpoint , type PaginationFieldEndpoint , type ParamFetchNoBody , type ParamFetchWithBody , type ParamToArgs , type PartialRestGenerics , type PathArgs , type PathArgsAndSearch , type PathKeys , type PolymorphicInterface , type Queryable , type ReadEndpoint , type RecordClass , type ResolveType , type Resource , type ResourceEndpointExtensions , type ResourceExtension , type ResourceGenerics , type ResourceInterface , type ResourceOptions , RestEndpoint , type RestEndpointConstructor , type RestEndpointConstructorOptions , type RestEndpointExtendOptions , type RestEndpointOptions , type RestExtendedEndpoint , type RestFetch , type RestGenerics , type RestInstance , type RestInstanceBase , type RestType , type RestTypeNoBody , type RestTypeWithBody , type Schema , type SchemaArgs , type SchemaClass , type SchemaSimple , type Serializable , type ShortenPath , type SnapshotInterface , type UnknownError , type Visit , resource as createResource , getUrlBase , getUrlTokens , hookifyResource , resource , schema_d as schema , validateRequired } ;
1840+ export { type AbstractInstanceType , type AddEndpoint , Array$1 as Array , type CheckLoop , Collection , type CustomResource , type DefaultArgs , type Defaults , type Denormalize , type DenormalizeNullable , type DenormalizeNullableObject , type DenormalizeObject , Endpoint , type EndpointExtendOptions , type EndpointExtraOptions , type EndpointInstance , type EndpointInstanceInterface , type EndpointInterface , type EndpointOptions , type EndpointParam , type EndpointToFunction , type EntitiesInterface , type EntitiesPath , Entity , type EntityFields , type EntityInterface , type EntityMap , EntityMixin , type EntityPath , type EntityTable , type ErrorTypes , type ExpiryStatusInterface , ExtendableEndpoint , type ExtendedResource , type FetchFunction , type FetchGet , type FetchMutate , type FromFallBack , type GetEndpoint , type GetEntity , type GetIndex , type HookResource , type HookableEndpointInterface , type IEntityClass , type IEntityInstance , type INormalizeDelegate , type IQueryDelegate , type RestEndpoint$1 as IRestEndpoint , type IndexPath , Invalidate , type KeyofEndpointInstance , type KeyofRestEndpoint , type KeysToArgs , type Mergeable , type MethodToSide , type MutateEndpoint , type NI , NetworkError , type Normalize , type NormalizeNullable , type NormalizeObject , type NormalizedEntity , type NormalizedIndex , type NormalizedNullableObject , type ObjectArgs , type OptionsToFunction , type PaginationEndpoint , type PaginationFieldEndpoint , type ParamFetchNoBody , type ParamFetchWithBody , type ParamToArgs , type PartialRestGenerics , type PathArgs , type PathArgsAndSearch , type PathKeys , type PolymorphicInterface , type Queryable , type ReadEndpoint , type RecordClass , type RemoveEndpoint , type ResolveType , type Resource , type ResourceEndpointExtensions , type ResourceExtension , type ResourceGenerics , type ResourceInterface , type ResourceOptions , RestEndpoint , type RestEndpointConstructor , type RestEndpointConstructorOptions , type RestEndpointExtendOptions , type RestEndpointOptions , type RestExtendedEndpoint , type RestFetch , type RestGenerics , type RestInstance , type RestInstanceBase , type RestType , type RestTypeNoBody , type RestTypeWithBody , type Schema , type SchemaArgs , type SchemaClass , type SchemaSimple , type Serializable , type ShortenPath , type SnapshotInterface , type UnknownError , type Visit , resource as createResource , getUrlBase , getUrlTokens , hookifyResource , resource , schema_d as schema , validateRequired } ;
0 commit comments