@orion-js/paginated-mongodb 4.0.0-next.0 → 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/dist/index.cjs +5959 -18316
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +56 -0
- package/dist/index.d.ts +48 -50
- package/dist/index.js +5943 -18287
- package/dist/index.js.map +1 -0
- package/package.json +18 -18
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as _orion_js_resolvers from '@orion-js/resolvers';
|
|
2
|
+
|
|
3
|
+
interface PaginatedCursor {
|
|
4
|
+
count?: () => Promise<number> | number;
|
|
5
|
+
toArray: () => Promise<any[]>;
|
|
6
|
+
limit?: (newLimit: number) => void;
|
|
7
|
+
skip?: (newSkip: number) => void;
|
|
8
|
+
sort?: (newSort: {
|
|
9
|
+
[key: string]: 1 | -1;
|
|
10
|
+
}) => void;
|
|
11
|
+
}
|
|
12
|
+
type PaginatedResolverGetCursorResultWithCount = {
|
|
13
|
+
count: () => Promise<number> | number;
|
|
14
|
+
cursor: PaginatedCursor;
|
|
15
|
+
};
|
|
16
|
+
type PaginatedResolverGetCursorResult = PaginatedCursor | PaginatedResolverGetCursorResultWithCount;
|
|
17
|
+
interface PaginatedResolverOpts {
|
|
18
|
+
returns: any;
|
|
19
|
+
getCursor: (params?: any, viewer?: any) => Promise<PaginatedResolverGetCursorResult>;
|
|
20
|
+
allowedSorts?: string[];
|
|
21
|
+
defaultSortBy?: string;
|
|
22
|
+
defaultSortType?: 'asc' | 'desc';
|
|
23
|
+
params?: any;
|
|
24
|
+
modelName?: string;
|
|
25
|
+
permissionsOptions?: any;
|
|
26
|
+
}
|
|
27
|
+
declare function paginatedResolver({ returns, params, allowedSorts, defaultSortBy, defaultSortType, getCursor, getCursorAndCount, modelName, ...otherOptions }: PaginatedResolverOpts & {
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}): _orion_js_resolvers.Resolver<(params: any, viewer: any, info?: any) => Promise<{
|
|
30
|
+
cursor: PaginatedCursor;
|
|
31
|
+
params: any;
|
|
32
|
+
viewer: any;
|
|
33
|
+
options: {
|
|
34
|
+
skip: number;
|
|
35
|
+
limit: any;
|
|
36
|
+
};
|
|
37
|
+
count: number;
|
|
38
|
+
}>, undefined>;
|
|
39
|
+
|
|
40
|
+
declare function export_default({ collection, params, resolve, ...otherOptions }: {
|
|
41
|
+
[x: string]: any;
|
|
42
|
+
collection: any;
|
|
43
|
+
params: any;
|
|
44
|
+
resolve: any;
|
|
45
|
+
}): _orion_js_resolvers.Resolver<(params: any, viewer: any, info?: any) => Promise<{
|
|
46
|
+
params: any;
|
|
47
|
+
cursor: any;
|
|
48
|
+
viewer: any;
|
|
49
|
+
}>, undefined>;
|
|
50
|
+
|
|
51
|
+
interface PagiantedQueryDescriptor extends Omit<PropertyDecorator, 'value'> {
|
|
52
|
+
value?: PaginatedResolverOpts['getCursor'];
|
|
53
|
+
}
|
|
54
|
+
declare function PaginatedQuery(options: Omit<PaginatedResolverOpts, 'getCursor'>): (target: any, propertyKey: string, descriptor: PagiantedQueryDescriptor) => void;
|
|
55
|
+
|
|
56
|
+
export { type PagiantedQueryDescriptor, PaginatedQuery, paginatedResolver, export_default as tokenPaginatedResolver };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,58 +1,56 @@
|
|
|
1
|
-
|
|
1
|
+
import * as _orion_js_resolvers from '@orion-js/resolvers';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
interface PaginatedCursor {
|
|
4
|
+
count?: () => Promise<number> | number;
|
|
5
|
+
toArray: () => Promise<any[]>;
|
|
6
|
+
limit?: (newLimit: number) => void;
|
|
7
|
+
skip?: (newSkip: number) => void;
|
|
8
|
+
sort?: (newSort: {
|
|
9
|
+
[key: string]: 1 | -1;
|
|
10
|
+
}) => void;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
type PaginatedResolverGetCursorResultWithCount = {
|
|
13
|
+
count: () => Promise<number> | number;
|
|
14
|
+
cursor: PaginatedCursor;
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
type PaginatedResolverGetCursorResult = PaginatedCursor | PaginatedResolverGetCursorResultWithCount;
|
|
17
|
+
interface PaginatedResolverOpts {
|
|
18
|
+
returns: any;
|
|
19
|
+
getCursor: (params?: any, viewer?: any) => Promise<PaginatedResolverGetCursorResult>;
|
|
20
|
+
allowedSorts?: string[];
|
|
21
|
+
defaultSortBy?: string;
|
|
22
|
+
defaultSortType?: 'asc' | 'desc';
|
|
23
|
+
params?: any;
|
|
24
|
+
modelName?: string;
|
|
25
|
+
permissionsOptions?: any;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}):
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
declare function paginatedResolver({ returns, params, allowedSorts, defaultSortBy, defaultSortType, getCursor, getCursorAndCount, modelName, ...otherOptions }: PaginatedResolverOpts & {
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}): _orion_js_resolvers.Resolver<(params: any, viewer: any, info?: any) => Promise<{
|
|
30
|
+
cursor: PaginatedCursor;
|
|
31
|
+
params: any;
|
|
32
|
+
viewer: any;
|
|
33
|
+
options: {
|
|
34
|
+
skip: number;
|
|
35
|
+
limit: any;
|
|
36
|
+
};
|
|
37
|
+
count: number;
|
|
38
38
|
}>, undefined>;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
|
|
40
|
+
declare function export_default({ collection, params, resolve, ...otherOptions }: {
|
|
41
|
+
[x: string]: any;
|
|
42
|
+
collection: any;
|
|
43
|
+
params: any;
|
|
44
|
+
resolve: any;
|
|
45
|
+
}): _orion_js_resolvers.Resolver<(params: any, viewer: any, info?: any) => Promise<{
|
|
46
|
+
params: any;
|
|
47
|
+
cursor: any;
|
|
48
|
+
viewer: any;
|
|
48
49
|
}>, undefined>;
|
|
49
|
-
export interface PagiantedQueryDescriptor extends Omit<PropertyDecorator, "value"> {
|
|
50
|
-
value?: PaginatedResolverOpts["getCursor"];
|
|
51
|
-
}
|
|
52
|
-
export declare function PaginatedQuery(options: Omit<PaginatedResolverOpts, "getCursor">): (target: any, propertyKey: string, descriptor: PagiantedQueryDescriptor) => void;
|
|
53
50
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
51
|
+
interface PagiantedQueryDescriptor extends Omit<PropertyDecorator, 'value'> {
|
|
52
|
+
value?: PaginatedResolverOpts['getCursor'];
|
|
53
|
+
}
|
|
54
|
+
declare function PaginatedQuery(options: Omit<PaginatedResolverOpts, 'getCursor'>): (target: any, propertyKey: string, descriptor: PagiantedQueryDescriptor) => void;
|
|
57
55
|
|
|
58
|
-
export {};
|
|
56
|
+
export { type PagiantedQueryDescriptor, PaginatedQuery, paginatedResolver, export_default as tokenPaginatedResolver };
|