@data-client/rest 0.3.1 → 0.4.1
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.
- package/README.md +1 -1
- package/legacy/OptionsToFunction.js +1 -1
- package/legacy/createResource.js +1 -1
- package/legacy/extractCollection.js +1 -1
- package/legacy/extractObject.js +2 -0
- package/legacy/index.js +1 -1
- package/lib/OptionsToFunction.d.ts +8 -3
- package/lib/OptionsToFunction.d.ts.map +1 -1
- package/lib/OptionsToFunction.js +1 -1
- package/lib/RestEndpoint.d.ts +120 -43
- package/lib/createResource.d.ts +2 -0
- package/lib/createResource.d.ts.map +1 -1
- package/lib/createResource.js +1 -1
- package/lib/extractCollection.d.ts +7 -4
- package/lib/extractCollection.d.ts.map +1 -1
- package/lib/extractCollection.js +1 -1
- package/lib/extractObject.d.ts +6 -0
- package/lib/extractObject.d.ts.map +1 -0
- package/lib/extractObject.js +2 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/package.json +17 -5
- package/src/OptionsToFunction.ts +23 -9
- package/src/RestEndpoint.d.ts +120 -43
- package/src/__tests__/RestEndpoint.ts +10 -1
- package/src/__tests__/types.test.ts +6 -2
- package/src/createResource.ts +6 -0
- package/src/extractCollection.ts +16 -14
- package/src/extractObject.ts +7 -0
- package/src/index.ts +1 -0
- package/ts4.0/OptionsToFunction.d.ts +7 -4
- package/ts4.0/RestEndpoint.d.ts +80 -25
- package/ts4.0/createResource.d.ts +2 -0
- package/ts4.0/deleteme.d.ts +0 -0
- package/ts4.0/extractCollection.d.ts +7 -4
- package/ts4.0/extractObject.d.ts +1 -0
- package/ts4.0/index.d.ts +1 -1
- package/ts4.1/NetworkError.d.ts +11 -0
- package/ts4.1/OptionsToFunction.d.ts +12 -0
- package/ts4.1/RestEndpoint.d.ts +281 -0
- package/ts4.1/RestEndpointTypeHelp.d.ts +10 -0
- package/ts4.1/RestHelpers.d.ts +7 -0
- package/ts4.1/createResource.d.ts +113 -0
- package/ts4.1/deleteme.d.ts +0 -0
- package/ts4.1/extractCollection.d.ts +14 -0
- package/ts4.1/extractObject.d.ts +6 -0
- package/ts4.1/getArrayPath.d.ts +3 -0
- package/ts4.1/hookifyResource.d.ts +14 -0
- package/ts4.1/index.d.ts +14 -0
- package/ts4.1/mapCollection.d.ts +16 -0
- package/ts4.1/next/index.d.ts +6 -0
- package/ts4.1/paginatedCollections.d.ts +3 -0
- package/ts4.1/paginationUpdate.d.ts +10 -0
- package/ts4.1/paramsToString.d.ts +2 -0
- package/ts4.1/paramsToString.native.d.ts +2 -0
- package/ts4.1/pathTypes.d.ts +21 -0
- package/ts4.1/resourceTypes.d.ts +41 -0
- package/ts4.1/test-fixtures.d.ts +141 -0
- package/ts4.1/utiltypes.d.ts +21 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
export declare const payload: {
|
|
2
|
+
id: number;
|
|
3
|
+
title: string;
|
|
4
|
+
content: string;
|
|
5
|
+
tags: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare const createPayload: {
|
|
8
|
+
id: number;
|
|
9
|
+
title: string;
|
|
10
|
+
content: string;
|
|
11
|
+
tags: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare const articlesPages: {
|
|
14
|
+
prevPage: string;
|
|
15
|
+
nextPage: string;
|
|
16
|
+
results: ({
|
|
17
|
+
id: number;
|
|
18
|
+
title: string;
|
|
19
|
+
content: string;
|
|
20
|
+
tags: string[];
|
|
21
|
+
} | {
|
|
22
|
+
id: number;
|
|
23
|
+
title: string;
|
|
24
|
+
content: string;
|
|
25
|
+
tags?: undefined;
|
|
26
|
+
})[];
|
|
27
|
+
};
|
|
28
|
+
export declare const users: {
|
|
29
|
+
id: number;
|
|
30
|
+
username: string;
|
|
31
|
+
email: string;
|
|
32
|
+
isAdmin: boolean;
|
|
33
|
+
}[];
|
|
34
|
+
export declare const nested: ({
|
|
35
|
+
id: number;
|
|
36
|
+
title: string;
|
|
37
|
+
content: string;
|
|
38
|
+
tags: string[];
|
|
39
|
+
author: {
|
|
40
|
+
id: number;
|
|
41
|
+
username: string;
|
|
42
|
+
email?: undefined;
|
|
43
|
+
};
|
|
44
|
+
} | {
|
|
45
|
+
id: number;
|
|
46
|
+
title: string;
|
|
47
|
+
content: string;
|
|
48
|
+
author: {
|
|
49
|
+
id: number;
|
|
50
|
+
username: string;
|
|
51
|
+
email: string;
|
|
52
|
+
};
|
|
53
|
+
tags?: undefined;
|
|
54
|
+
})[];
|
|
55
|
+
export declare const moreNested: ({
|
|
56
|
+
id: number;
|
|
57
|
+
title: string;
|
|
58
|
+
content: string;
|
|
59
|
+
tags: string[];
|
|
60
|
+
author: {
|
|
61
|
+
id: number;
|
|
62
|
+
username: string;
|
|
63
|
+
email?: undefined;
|
|
64
|
+
};
|
|
65
|
+
} | {
|
|
66
|
+
id: number;
|
|
67
|
+
title: string;
|
|
68
|
+
content: string;
|
|
69
|
+
author: {
|
|
70
|
+
id: number;
|
|
71
|
+
username: string;
|
|
72
|
+
email: string;
|
|
73
|
+
};
|
|
74
|
+
tags?: undefined;
|
|
75
|
+
})[];
|
|
76
|
+
export declare const valuesFixture: {
|
|
77
|
+
first: {
|
|
78
|
+
id: number;
|
|
79
|
+
title: string;
|
|
80
|
+
content: string;
|
|
81
|
+
tags: never[];
|
|
82
|
+
};
|
|
83
|
+
second: {
|
|
84
|
+
id: number;
|
|
85
|
+
name: string;
|
|
86
|
+
content: string;
|
|
87
|
+
tags: never[];
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
export declare const paginatedFirstPage: {
|
|
91
|
+
nextPage: string;
|
|
92
|
+
data: {
|
|
93
|
+
results: ({
|
|
94
|
+
id: number;
|
|
95
|
+
title: string;
|
|
96
|
+
content: string;
|
|
97
|
+
tags: string[];
|
|
98
|
+
author: {
|
|
99
|
+
id: number;
|
|
100
|
+
username: string;
|
|
101
|
+
email?: undefined;
|
|
102
|
+
};
|
|
103
|
+
} | {
|
|
104
|
+
id: number;
|
|
105
|
+
title: string;
|
|
106
|
+
content: string;
|
|
107
|
+
author: {
|
|
108
|
+
id: number;
|
|
109
|
+
username: string;
|
|
110
|
+
email: string;
|
|
111
|
+
};
|
|
112
|
+
tags?: undefined;
|
|
113
|
+
})[];
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export declare const paginatedSecondPage: {
|
|
117
|
+
data: {
|
|
118
|
+
results: ({
|
|
119
|
+
id: number;
|
|
120
|
+
title: string;
|
|
121
|
+
content: string;
|
|
122
|
+
tags: string[];
|
|
123
|
+
author: {
|
|
124
|
+
id: number;
|
|
125
|
+
username: string;
|
|
126
|
+
email?: undefined;
|
|
127
|
+
};
|
|
128
|
+
} | {
|
|
129
|
+
id: number;
|
|
130
|
+
title: string;
|
|
131
|
+
content: string;
|
|
132
|
+
author: {
|
|
133
|
+
id: number;
|
|
134
|
+
username: string;
|
|
135
|
+
email: string;
|
|
136
|
+
};
|
|
137
|
+
tags?: undefined;
|
|
138
|
+
})[];
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL=test-fixtures.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Extracts only the keys that will be required
|
|
2
|
+
*
|
|
3
|
+
* Removes optional, as well as unbounded (aka 'string')
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
```
|
|
7
|
+
RequiredKeys<{
|
|
8
|
+
opt?: string;
|
|
9
|
+
bob: string;
|
|
10
|
+
alice: number;
|
|
11
|
+
[k: string]: string | number | undefined;
|
|
12
|
+
}> // = 'bob' | 'alice'
|
|
13
|
+
```
|
|
14
|
+
*/
|
|
15
|
+
export type RequiredKeys<T> = Values<OnlyRequired<T>>;
|
|
16
|
+
type OnlyRequired<T> = {
|
|
17
|
+
[K in keyof T as string extends K ? never : K]-?: {} extends Pick<T, K> ? never : K;
|
|
18
|
+
};
|
|
19
|
+
type Values<T> = T[Exclude<keyof T, number>];
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=utiltypes.d.ts.map
|