@data-client/rest 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/index.js +10 -14
  2. package/dist/index.umd.min.js +1 -1
  3. package/legacy/OptionsToFunction.js +1 -1
  4. package/legacy/RestEndpoint.js +5 -5
  5. package/legacy/createResource.js +8 -10
  6. package/legacy/index.js +2 -1
  7. package/legacy/next/index.js +4 -4
  8. package/legacy/resourceTypes.js +2 -0
  9. package/lib/OptionsToFunction.d.ts.map +1 -1
  10. package/lib/OptionsToFunction.js +1 -1
  11. package/lib/RestEndpoint.d.ts +29 -35
  12. package/lib/RestEndpoint.js +5 -5
  13. package/lib/createResource.d.ts +51 -31
  14. package/lib/createResource.d.ts.map +1 -1
  15. package/lib/createResource.js +7 -11
  16. package/lib/index.d.ts +3 -1
  17. package/lib/index.d.ts.map +1 -1
  18. package/lib/index.js +2 -1
  19. package/lib/next/index.d.ts +5 -5
  20. package/lib/next/index.d.ts.map +1 -1
  21. package/lib/next/index.js +4 -4
  22. package/lib/resourceTypes.d.ts.map +1 -0
  23. package/lib/resourceTypes.js +2 -0
  24. package/package.json +3 -3
  25. package/src/OptionsToFunction.ts +0 -1
  26. package/src/RestEndpoint.d.ts +29 -35
  27. package/src/RestEndpoint.js +4 -4
  28. package/src/__tests__/RestEndpoint.ts +38 -9
  29. package/src/__tests__/createResource.test.ts +3 -4
  30. package/src/__tests__/hookifyResource.ts +7 -3
  31. package/src/__tests__/types.test.ts +332 -212
  32. package/src/createResource.ts +81 -60
  33. package/src/index.ts +2 -2
  34. package/src/next/index.ts +5 -5
  35. package/ts4.0/RestEndpoint.d.ts +18 -32
  36. package/ts4.0/createResource.d.ts +59 -31
  37. package/ts4.0/index.d.ts +3 -1
  38. package/ts4.0/next/index.d.ts +5 -5
  39. package/legacy/next/OptionsToFunction.js +0 -2
  40. package/legacy/next/RestEndpoint.js +0 -225
  41. package/legacy/next/createResource.js +0 -86
  42. package/legacy/next/resourceTypes.js +0 -2
  43. package/lib/next/OptionsToFunction.d.ts +0 -7
  44. package/lib/next/OptionsToFunction.d.ts.map +0 -1
  45. package/lib/next/OptionsToFunction.js +0 -2
  46. package/lib/next/RestEndpoint.d.ts +0 -542
  47. package/lib/next/RestEndpoint.js +0 -229
  48. package/lib/next/createResource.d.ts +0 -86
  49. package/lib/next/createResource.d.ts.map +0 -1
  50. package/lib/next/createResource.js +0 -100
  51. package/lib/next/resourceTypes.d.ts.map +0 -1
  52. package/lib/next/resourceTypes.js +0 -2
  53. package/src/next/OptionsToFunction.ts +0 -41
  54. package/src/next/RestEndpoint.d.ts +0 -542
  55. package/src/next/RestEndpoint.js +0 -262
  56. package/src/next/__tests__/RestEndpoint.ts +0 -1333
  57. package/src/next/__tests__/__snapshots__/RestEndpoint.ts.snap +0 -18
  58. package/src/next/__tests__/types.test.ts +0 -429
  59. package/src/next/createResource.ts +0 -194
  60. package/ts4.0/next/OptionsToFunction.d.ts +0 -16
  61. package/ts4.0/next/RestEndpoint.d.ts +0 -226
  62. package/ts4.0/next/createResource.d.ts +0 -94
  63. /package/lib/{next/resourceTypes.d.ts → resourceTypes.d.ts} +0 -0
  64. /package/src/{next/resourceTypes.ts → resourceTypes.ts} +0 -0
  65. /package/ts4.0/{next/resourceTypes.d.ts → resourceTypes.d.ts} +0 -0
@@ -1,226 +0,0 @@
1
- /* eslint-disable @typescript-eslint/ban-types */
2
- import type { EndpointExtraOptions, EndpointInstanceInterface, Schema, FetchFunction, ResolveType, } from '@data-client/endpoint';
3
- import { OptionsToFunction } from './OptionsToFunction.js';
4
- import type { ExtractCollection } from '../extractCollection.js';
5
- import { PathArgs } from '../pathTypes.js';
6
- import { EndpointUpdateFunction } from '../RestEndpointTypeHelp.js';
7
- export interface RestInstanceBase<F extends FetchFunction = FetchFunction, S extends Schema | undefined = any, M extends true | undefined = true | undefined, O extends {
8
- path: string;
9
- body?: any;
10
- searchParams?: any;
11
- } = {
12
- path: string;
13
- }> extends EndpointInstanceInterface<F, S, M> {
14
- readonly body?: 'body' extends keyof O ? O['body'] : any;
15
- readonly searchParams?: 'searchParams' extends keyof O ? O['searchParams'] : unknown;
16
- /** Pattern to construct url based on Url Parameters
17
- * @see https://resthooks.io/rest/api/RestEndpoint#path
18
- */
19
- readonly path: O['path'];
20
- /** Prepended to all urls
21
- * @see https://resthooks.io/rest/api/RestEndpoint#urlPrefix
22
- */
23
- readonly urlPrefix: string;
24
- readonly requestInit: RequestInit;
25
- readonly method: string;
26
- readonly signal: AbortSignal | undefined;
27
- /* fetch lifecycles */
28
- /* before-fetch */
29
- url(...args: Parameters<F>): string;
30
- /** @see https://resthooks.io/rest/api/RestEndpoint#getRequestInit */
31
- getRequestInit(this: any, body?: RequestInit['body'] | Record<string, unknown>): Promise<RequestInit> | RequestInit;
32
- /** @see https://resthooks.io/rest/api/RestEndpoint#getHeaders */
33
- getHeaders(headers: HeadersInit): Promise<HeadersInit> | HeadersInit;
34
- /* after-fetch */
35
- /** @see https://resthooks.io/rest/api/RestEndpoint#fetchResponse */
36
- fetchResponse(input: RequestInfo, init: RequestInit): Promise<Response>;
37
- /** @see https://resthooks.io/rest/api/RestEndpoint#parseResponse */
38
- parseResponse(response: Response): Promise<any>;
39
- /** @see https://resthooks.io/rest/api/RestEndpoint#process */
40
- process(value: any, ...args: Parameters<F>): ResolveType<F>;
41
- /* utilities */
42
- /** @see https://resthooks.io/rest/api/RestEndpoint#testKey */
43
- testKey(key: string): boolean;
44
- /* extenders */
45
- // TODO: figure out better way than wrapping whole options in Readonly<> + making O extend from {}
46
- // this is just a hack to handle when no members of PartialRestGenerics are present
47
- // Note: Using overloading (like paginated did) struggles because typescript does not have a clear way of distinguishing one
48
- // should be used from the other (due to same problem with every member being partial)
49
- extend<E extends RestInstanceBase, O extends PartialRestGenerics | {}>(this: E, options: Readonly<RestEndpointExtendOptions<O, E, F> & O>): RestExtendedEndpoint<O, E>;
50
- paginated<E extends RestInstanceBase<FetchFunction, any, undefined>, A extends any[]>(this: E, removeCursor: (...args: A) => readonly [
51
- ...Parameters<E>
52
- ]): PaginationEndpoint<E, A>;
53
- paginated<E extends RestInstanceBase<FetchFunction, any, undefined>, C extends string>(this: E, cursorField: C): PaginationFieldEndpoint<E, C>;
54
- }
55
- export interface RestInstance<F extends FetchFunction = FetchFunction, S extends Schema | undefined = any, M extends true | undefined = true | undefined, O extends {
56
- path: string;
57
- body?: any;
58
- searchParams?: any;
59
- } = {
60
- path: string;
61
- }> extends RestInstanceBase<F, S, M, O> {
62
- push: AddEndpoint<F, S, O>;
63
- unshift: AddEndpoint<F, S, O>;
64
- assign: AddEndpoint<F, S, O>;
65
- }
66
- export type RestEndpointExtendOptions<O extends PartialRestGenerics, E extends RestInstanceBase, F extends FetchFunction> = RestEndpointOptions<OptionsToFunction<O, E, F>, 'schema' extends keyof O ? Extract<O['schema'], Schema | undefined> : E['schema']> & Partial<Omit<E, KeyofRestEndpoint | keyof PartialRestGenerics>>;
67
- type OptionsToRestEndpoint<O extends PartialRestGenerics, E extends RestInstanceBase & {
68
- body?: any;
69
- }, F extends FetchFunction> = 'path' extends keyof O ? RestType<'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>>, 'body' extends keyof O ? O['body'] : E['body'], 'schema' extends keyof O ? O['schema'] : E['schema'], 'method' extends keyof O ? MethodToSide<O['method']> : E['sideEffect'], O['process'] extends {} ? ReturnType<O['process']> : ResolveType<F>, {
70
- path: Exclude<O['path'], undefined>;
71
- body: 'body' extends keyof O ? O['body'] : E['body'];
72
- searchParams: 'searchParams' extends keyof O ? O['searchParams'] : E['searchParams'];
73
- }> : 'body' extends keyof O ? RestType<'searchParams' extends keyof O ? O['searchParams'] extends undefined ? PathArgs<Exclude<O['path'], undefined>> : O['searchParams'] & PathArgs<Exclude<E['path'], undefined>> : PathArgs<Exclude<E['path'], undefined>>, O['body'], 'schema' extends keyof O ? O['schema'] : E['schema'], 'method' extends keyof O ? MethodToSide<O['method']> : E['sideEffect'], O['process'] extends {} ? ReturnType<O['process']> : ResolveType<F>, {
74
- path: E['path'];
75
- body: O['body'];
76
- searchParams: 'searchParams' extends keyof O ? O['searchParams'] : E['searchParams'];
77
- }> : 'searchParams' extends keyof O ? RestType<O['searchParams'] extends undefined ? PathArgs<Exclude<O['path'], undefined>> : O['searchParams'] & PathArgs<Exclude<E['path'], undefined>>, E['body'], 'schema' extends keyof O ? O['schema'] : E['schema'], 'method' extends keyof O ? MethodToSide<O['method']> : E['sideEffect'], O['process'] extends {} ? ReturnType<O['process']> : ResolveType<F>, {
78
- path: E['path'];
79
- body: E['body'];
80
- searchParams: O['searchParams'];
81
- }> : RestInstance<F, 'schema' extends keyof O ? O['schema'] : E['schema'], 'method' extends keyof O ? MethodToSide<O['method']> : E['sideEffect'], {
82
- path: 'path' extends keyof O ? Exclude<O['path'], undefined> : E['path'];
83
- body: 'body' extends keyof O ? O['body'] : E['body'];
84
- searchParams: 'searchParams' extends keyof O ? O['searchParams'] : E['searchParams'];
85
- }>;
86
- export type RestExtendedEndpoint<O extends PartialRestGenerics, E extends RestInstanceBase> = OptionsToRestEndpoint<O, E, RestInstance<(...args: Parameters<E>) => O['process'] extends {} ? Promise<ReturnType<O['process']>> : ReturnType<E>, 'schema' extends keyof O ? O['schema'] : E['schema'], 'method' extends keyof O ? MethodToSide<O['method']> : E['sideEffect']>> & Omit<O, KeyofRestEndpoint> & Omit<E, KeyofRestEndpoint | keyof O>;
87
- export interface PartialRestGenerics {
88
- readonly path?: string;
89
- readonly schema?: Schema | undefined;
90
- readonly method?: string;
91
- /** Only used for types */
92
- readonly body?: any;
93
- /** Only used for types */
94
- readonly searchParams?: any;
95
- /** @see https://resthooks.io/rest/api/RestEndpoint#process */
96
- process?(value: any, ...args: any): any;
97
- }
98
- export interface RestGenerics extends PartialRestGenerics {
99
- readonly path: string;
100
- }
101
- export type PaginationEndpoint<E extends RestInstanceBase, A extends any[]> = RestInstance<ParamFetchNoBody<A[0], ResolveType<E>>, E['schema'], E['sideEffect'], Pick<E, 'path' | 'searchParams' | 'body'> & {
102
- searchParams: Omit<A[0], keyof PathArgs<E['path']>>;
103
- }>;
104
- export type PaginationFieldEndpoint<E extends RestInstanceBase, C extends string> = RestInstance<ParamFetchNoBody<{
105
- [K in C]: string | number | boolean;
106
- } & E['searchParams'] & PathArgs<Exclude<E['path'], undefined>>, ResolveType<E>>, E['schema'], E['sideEffect'], Pick<E, 'path' | 'searchParams' | 'body'> & {
107
- searchParams: {
108
- [K in C]: string | number | boolean;
109
- } & E['searchParams'];
110
- }>;
111
- export type AddEndpoint<F extends FetchFunction = FetchFunction, S extends Schema | undefined = any, O extends {
112
- path: string;
113
- body?: any;
114
- searchParams?: any;
115
- } = {
116
- path: string;
117
- }> = 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>>, any, ReturnType<F>>, ExtractCollection<S>, true, Omit<O, 'body'>> & {
118
- method: 'POST';
119
- };
120
- export type BodyDefault<O extends RestGenerics> = 'body' extends keyof O ? O['body'] : O['method'] extends 'POST' | 'PUT' | 'PATCH' ? Record<string, unknown> | FormData : undefined;
121
- type OptionsBodyDefault<O extends RestGenerics> = 'body' extends keyof O ? O : O['method'] extends 'POST' | 'PUT' | 'PATCH' ? O & {
122
- body: any;
123
- } : O & {
124
- body: undefined;
125
- };
126
- export interface RestEndpointOptions<F extends FetchFunction = FetchFunction, S extends Schema | undefined = undefined> extends EndpointExtraOptions<F> {
127
- urlPrefix?: string;
128
- requestInit?: RequestInit;
129
- getHeaders?(headers: HeadersInit): Promise<HeadersInit> | HeadersInit;
130
- getRequestInit?(body: any): Promise<RequestInit> | RequestInit;
131
- fetchResponse?(input: RequestInfo, init: RequestInit): Promise<any>;
132
- parseResponse?(response: Response): Promise<any>;
133
- sideEffect?: true | undefined;
134
- name?: string;
135
- signal?: AbortSignal;
136
- fetch?: F;
137
- key?(...args: Parameters<F>): string;
138
- url?(...args: Parameters<F>): string;
139
- update?: EndpointUpdateFunction<F, S>;
140
- }
141
- export type RestEndpointConstructorOptions<O extends RestGenerics = any> = RestEndpointOptions<RestFetch<'searchParams' extends keyof O ? O['searchParams'] extends undefined ? PathArgs<O['path']> : O['searchParams'] & PathArgs<O['path']> : PathArgs<O['path']>, BodyDefault<O>, O['process'] extends {} ? ReturnType<O['process']> : any /*Denormalize<O['schema']>*/>, O['schema']>;
142
- export interface RestEndpointConstructor {
143
- new <O extends RestGenerics = any>({ method, sideEffect, name, ...options }: RestEndpointConstructorOptions<O> & Readonly<O>): RestInstance<RestFetch<'searchParams' extends keyof O ? O['searchParams'] extends undefined ? PathArgs<O['path']> : O['searchParams'] & PathArgs<O['path']> : PathArgs<O['path']>, BodyDefault<O>, O['process'] extends {} ? ReturnType<O['process']> : any /*Denormalize<O['schema']>*/>, 'schema' extends keyof O ? O['schema'] : undefined, MethodToSide<O['method']>, OptionsBodyDefault<O>>;
144
- readonly prototype: RestInstanceBase;
145
- }
146
- /** Simplifies endpoint definitions that follow REST patterns
147
- *
148
- * @see https://resthooks.io/rest/api/RestEndpoint
149
- */
150
- export declare let RestEndpoint: RestEndpointConstructor;
151
- export default RestEndpoint;
152
- export type MethodToSide<M> = M extends string ? M extends 'GET' ? undefined : true : undefined;
153
- /** RestEndpoint types simplified */
154
- export type RestType<UrlParams = any, Body = any, S extends Schema | undefined = Schema | undefined, M extends true | undefined = true | undefined, R = any, O extends {
155
- path: string;
156
- body?: any;
157
- searchParams?: any;
158
- } = {
159
- path: string;
160
- }> = IfTypeScriptLooseNull<RestInstance<keyof UrlParams extends never ? (this: EndpointInstanceInterface, body?: Body) => Promise<R> : {} extends UrlParams ? ((this: EndpointInstanceInterface, body?: Body) => Promise<R>) | ((this: EndpointInstanceInterface, params: UrlParams, body?: Body) => Promise<R>) : (this: EndpointInstanceInterface, params: UrlParams, body?: Body) => Promise<R>, S, M, O>, Body extends {} ? RestTypeWithBody<UrlParams, S, M, Body, R, O> : RestTypeNoBody<UrlParams, S, M, R, O>>;
161
- export type RestTypeWithBody<UrlParams = any, S extends Schema | undefined = Schema | undefined, M extends true | undefined = true | undefined, Body = any, R = any /*Denormalize<S>*/, O extends {
162
- path: string;
163
- body?: any;
164
- searchParams?: any;
165
- } = {
166
- path: string;
167
- body: any;
168
- }> = RestInstance<ParamFetchWithBody<UrlParams, Body, R>, S, M, O>;
169
- export type RestTypeNoBody<UrlParams = any, S extends Schema | undefined = Schema | undefined, M extends true | undefined = true | undefined, R = any /*Denormalize<S>*/, O extends {
170
- path: string;
171
- body?: undefined;
172
- searchParams?: any;
173
- } = {
174
- path: string;
175
- body: undefined;
176
- }> = RestInstance<ParamFetchNoBody<UrlParams, R>, S, M, O>;
177
- /** Simple parameters, and body fetch functions */
178
- export type RestFetch<UrlParams,
179
- // eslint-disable-next-line @typescript-eslint/ban-types
180
- Body = {}, Resolve = any> = IfTypeScriptLooseNull<ParamFetchNoBody<UrlParams, Resolve> | ParamFetchWithBody<UrlParams, Body, Resolve>, Body extends {} ? ParamFetchWithBody<UrlParams, Body, Resolve> : ParamFetchNoBody<UrlParams, Resolve>>;
181
- export type ParamFetchWithBody<P, B = {}, R = any> =
182
- // we must always allow undefined in a union and give it a type without params
183
- P extends undefined ? (this: EndpointInstanceInterface, body: B) => Promise<R> : {} extends P ? keyof P extends never ? (this: EndpointInstanceInterface, body: B) => Promise<R> : ((this: EndpointInstanceInterface, params: P, body: B) => Promise<R>) | ((this: EndpointInstanceInterface, body: B) => Promise<R>) : (this: EndpointInstanceInterface, params: P, body: B) => Promise<R>;
184
- export type ParamFetchNoBody<P, R = any> =
185
- // we must always allow undefined in a union and give it a type without params
186
- P extends undefined ? (this: EndpointInstanceInterface) => Promise<R> : {} extends P ? keyof P extends never ? (this: EndpointInstanceInterface) => Promise<R> : ((this: EndpointInstanceInterface, params: P) => Promise<R>) | ((this: EndpointInstanceInterface) => Promise<R>) : (this: EndpointInstanceInterface, params: P) => Promise<R>;
187
- type IfTypeScriptLooseNull<Y, N> = 1 | undefined extends 1 ? Y : N;
188
- export type KeyofRestEndpoint = keyof RestInstance;
189
- export type FromFallBack<K extends keyof E, O, E> = K extends keyof O ? O[K] : E[K];
190
- export type FetchMutate<A extends readonly any[] = [
191
- any,
192
- {}
193
- ]
194
- // eslint-disable-next-line @typescript-eslint/ban-types
195
- | [
196
- {}
197
- ], R = any> = (this: RestInstance, ...args: A) => Promise<R>;
198
- export type FetchGet<A extends readonly any[] = [
199
- any
200
- ], R = any> = (this: RestInstance, ...args: A) => Promise<R>;
201
- export type Defaults<O, D> = {
202
- [K in keyof O | keyof D]: K extends keyof O ? Exclude<O[K], undefined> : D[Extract<K, keyof D>];
203
- };
204
- export type GetEndpoint<O extends {
205
- readonly path: string;
206
- readonly schema: Schema;
207
- /** Only used for types */
208
- readonly searchParams?: any;
209
- } = {
210
- path: string;
211
- schema: Schema;
212
- }> = RestTypeNoBody<'searchParams' extends keyof O ? O['searchParams'] extends undefined ? PathArgs<O['path']> : O['searchParams'] & PathArgs<O['path']> : PathArgs<O['path']>, O['schema'], undefined, any, O & {
213
- body: undefined;
214
- }>;
215
- export type MutateEndpoint<O extends {
216
- readonly path: string;
217
- readonly schema: Schema;
218
- /** Only used for types */
219
- readonly searchParams?: any;
220
- /** Only used for types */
221
- readonly body?: any;
222
- } = {
223
- path: string;
224
- body: any;
225
- schema: Schema;
226
- }> = RestTypeWithBody<'searchParams' extends keyof O ? O['searchParams'] extends undefined ? PathArgs<O['path']> : O['searchParams'] & PathArgs<O['path']> : PathArgs<O['path']>, O['schema'], true, O['body'], any, O>;
@@ -1,94 +0,0 @@
1
- import { schema } from '@data-client/endpoint';
2
- import type { Denormalize } from '@data-client/endpoint';
3
- import { ResourceGenerics, ResourceOptions } from './resourceTypes.js';
4
- import { GetEndpoint, MutateEndpoint, RestTypeNoBody } from './RestEndpoint.js';
5
- import { PathArgs, ShortenPath } from '../pathTypes.js';
6
- /** Creates collection of Endpoints for common operations on a given data/schema.
7
- *
8
- * @see https://resthooks.io/rest/api/createResource
9
- */
10
- export default function createResource<O extends ResourceGenerics>({ path, schema, Endpoint, optimistic, ...extraOptions }: Readonly<O> & ResourceOptions): Resource<O>;
11
- export interface Resource<O extends ResourceGenerics = {
12
- path: string;
13
- schema: any;
14
- }> {
15
- /** Get a singular item
16
- *
17
- * @see https://resthooks.io/rest/api/createResource#get
18
- */
19
- get: GetEndpoint<{
20
- path: O['path'];
21
- schema: O['schema'];
22
- }>;
23
- /** Get a list of item
24
- *
25
- * @see https://resthooks.io/rest/api/createResource#getlist
26
- */
27
- getList: 'searchParams' extends keyof O ? GetEndpoint<{
28
- path: ShortenPath<O['path']>;
29
- schema: schema.Collection<[
30
- O['schema']
31
- ]>;
32
- searchParams: O['searchParams'];
33
- }> : GetEndpoint<{
34
- path: ShortenPath<O['path']>;
35
- schema: schema.Collection<[
36
- O['schema']
37
- ]>;
38
- searchParams: Record<string, number | string | boolean> | undefined;
39
- }>;
40
- /** Create a new item (POST)
41
- *
42
- * @see https://resthooks.io/rest/api/createResource#create
43
- */
44
- create: 'searchParams' extends keyof O ? MutateEndpoint<{
45
- path: ShortenPath<O['path']>;
46
- schema: schema.Collection<[
47
- O['schema']
48
- ]>['push'];
49
- body: 'body' extends keyof O ? O['body'] : Partial<Denormalize<O['schema']>>;
50
- searchParams: O['searchParams'];
51
- }> : MutateEndpoint<{
52
- path: ShortenPath<O['path']>;
53
- schema: schema.Collection<[
54
- O['schema']
55
- ]>['push'];
56
- body: 'body' extends keyof O ? O['body'] : Partial<Denormalize<O['schema']>>;
57
- }>;
58
- /** Update an item (PUT)
59
- *
60
- * @see https://resthooks.io/rest/api/createResource#update
61
- */
62
- update: 'body' extends keyof O ? MutateEndpoint<{
63
- path: O['path'];
64
- body: O['body'];
65
- schema: O['schema'];
66
- }> : MutateEndpoint<{
67
- path: O['path'];
68
- body: Partial<Denormalize<O['schema']>>;
69
- schema: O['schema'];
70
- }>;
71
- /** Update an item (PATCH)
72
- *
73
- * @see https://resthooks.io/rest/api/createResource#partialupdate
74
- */
75
- partialUpdate: 'body' extends keyof O ? MutateEndpoint<{
76
- path: O['path'];
77
- body: Partial<O['body']>;
78
- schema: O['schema'];
79
- }> : MutateEndpoint<{
80
- path: O['path'];
81
- body: Partial<Denormalize<O['schema']>>;
82
- schema: O['schema'];
83
- }>;
84
- /** Delete an item (DELETE)
85
- *
86
- * @see https://resthooks.io/rest/api/createResource#delete
87
- */
88
- delete: RestTypeNoBody<PathArgs<O['path']>, O['schema'] extends schema.EntityInterface & {
89
- process: any;
90
- } ? schema.Invalidate<O['schema']> : O['schema'], undefined, Partial<PathArgs<O['path']>>, {
91
- path: O['path'];
92
- }>;
93
- }
94
- //# sourceMappingURL=createResource.d.ts.map
File without changes