@open-xamu-co/ui-common-types 4.0.0-next.1 → 4.0.0-next.2
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/package.json +1 -1
- package/src/fetch.ts +24 -2
package/package.json
CHANGED
package/src/fetch.ts
CHANGED
|
@@ -3,28 +3,44 @@ export type tOrder = "desc" | "asc";
|
|
|
3
3
|
/**
|
|
4
4
|
* Order using column or property
|
|
5
5
|
*
|
|
6
|
-
* @example [
|
|
7
|
-
* @example [
|
|
6
|
+
* @example ["id", "asc" ], order ascendente de id
|
|
7
|
+
* @example ["id", "desc" ] or ["id"], order descendente de id
|
|
8
8
|
*/
|
|
9
9
|
export type tOrderBy = [string, tOrder?];
|
|
10
10
|
|
|
11
11
|
export interface iPageEdge<T, C extends string | number = string> {
|
|
12
12
|
cursor: C;
|
|
13
|
+
/** Node data */
|
|
13
14
|
node: T;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export interface iPageInfo<C extends string | number = string> {
|
|
17
18
|
nextCursor?: C;
|
|
18
19
|
previousCursor?: C;
|
|
20
|
+
/**
|
|
21
|
+
* Current page number
|
|
22
|
+
* According to the "at" and "first" parameters
|
|
23
|
+
*/
|
|
19
24
|
pageNumber?: number;
|
|
25
|
+
/** There is a next page */
|
|
20
26
|
hasNextPage: boolean;
|
|
27
|
+
/** There is a previous page */
|
|
21
28
|
hasPreviousPage: boolean;
|
|
29
|
+
/** Current page path */
|
|
22
30
|
path?: string;
|
|
23
31
|
}
|
|
24
32
|
|
|
25
33
|
export interface iPage<T, C extends string | number = string> {
|
|
34
|
+
/**
|
|
35
|
+
* List of nodes with cursor data for the current page
|
|
36
|
+
* Amount of nodes is limited by the "first" parameter
|
|
37
|
+
*/
|
|
26
38
|
edges: iPageEdge<T, C>[];
|
|
27
39
|
pageInfo: iPageInfo<C>;
|
|
40
|
+
/**
|
|
41
|
+
* Count of nodes matching the path
|
|
42
|
+
* Independent of pagination
|
|
43
|
+
*/
|
|
28
44
|
totalCount: number;
|
|
29
45
|
}
|
|
30
46
|
|
|
@@ -39,6 +55,12 @@ export interface iPagination {
|
|
|
39
55
|
* Cantidad de elementos por pagina (limite)
|
|
40
56
|
*/
|
|
41
57
|
first?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Order using column or property
|
|
60
|
+
*
|
|
61
|
+
* @example [["id", "asc" ]], order ascendente de id
|
|
62
|
+
* @example [["id", "desc" ]] or [["id"]], order descendente de id
|
|
63
|
+
*/
|
|
42
64
|
orderBy?: tOrderBy[];
|
|
43
65
|
}
|
|
44
66
|
|