onecore 0.1.5 → 0.1.7
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
CHANGED
package/src/index.ts
CHANGED
|
@@ -64,7 +64,7 @@ import { GenericService } from './service/GenericService';
|
|
|
64
64
|
import { ViewSearchService } from './service/ViewSearchService';
|
|
65
65
|
import { ViewService } from './service/ViewService';
|
|
66
66
|
|
|
67
|
-
export type Search<T, F> = (s: F, limit
|
|
67
|
+
export type Search<T, F> = (s: F, limit: number, page?: number | string, fields?: string[]) => Promise<SearchResult<T>>;
|
|
68
68
|
export type SearchFunc<T, F> = Search<T, F>;
|
|
69
69
|
|
|
70
70
|
export interface KeypairResult {
|
|
@@ -155,8 +155,8 @@ export class ViewSearchManager<T, ID, F extends Filter> extends ViewManager<T, I
|
|
|
155
155
|
super(repo);
|
|
156
156
|
this.search = this.search.bind(this);
|
|
157
157
|
}
|
|
158
|
-
search(s: F, limit
|
|
159
|
-
return this.find(s, limit,
|
|
158
|
+
search(s: F, limit: number, page?: number|string, fields?: string[]): Promise<SearchResult<T>> {
|
|
159
|
+
return this.find(s, limit, page, fields);
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
// tslint:disable-next-line:max-classes-per-file
|
|
@@ -168,8 +168,8 @@ export class SearchManager<T, ID, F extends Filter> extends ViewManager<T, ID> i
|
|
|
168
168
|
super(repository);
|
|
169
169
|
this.search = this.search.bind(this);
|
|
170
170
|
}
|
|
171
|
-
search(s: F, limit
|
|
172
|
-
return this.repository.search(s, limit,
|
|
171
|
+
search(s: F, limit: number, page?: number|string, fields?: string[]): Promise<SearchResult<T>> {
|
|
172
|
+
return this.repository.search(s, limit, page, fields);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
// tslint:disable-next-line:max-classes-per-file
|
|
@@ -215,8 +215,8 @@ export class Manager<T, ID, F extends Filter> extends GenericManager<T, ID> impl
|
|
|
215
215
|
super(repo);
|
|
216
216
|
this.search = this.search.bind(this);
|
|
217
217
|
}
|
|
218
|
-
search(s: F, limit
|
|
219
|
-
return this.find(s, limit,
|
|
218
|
+
search(s: F, limit: number, page?: number|string, fields?: string[]): Promise<SearchResult<T>> {
|
|
219
|
+
return this.find(s, limit, page, fields);
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
// tslint:disable-next-line:max-classes-per-file
|
package/src/metadata.ts
CHANGED
|
@@ -35,10 +35,10 @@ export interface Attribute {
|
|
|
35
35
|
nopatch?: boolean;
|
|
36
36
|
version?: boolean;
|
|
37
37
|
length?: number;
|
|
38
|
-
min?: number;
|
|
39
|
-
max?: number;
|
|
40
|
-
gt?: number;
|
|
41
|
-
lt?: number;
|
|
38
|
+
min?: number | Date | string;
|
|
39
|
+
max?: number | Date | string;
|
|
40
|
+
gt?: number | Date | string;
|
|
41
|
+
lt?: number | Date | string;
|
|
42
42
|
precision?: number;
|
|
43
43
|
scale?: number;
|
|
44
44
|
exp?: RegExp | string;
|
|
@@ -2,5 +2,5 @@ import {Filter} from '../model';
|
|
|
2
2
|
import {SearchResult} from '../model';
|
|
3
3
|
|
|
4
4
|
export interface SearchRepository<T, F extends Filter> {
|
|
5
|
-
search(s: F, limit
|
|
5
|
+
search(s: F, limit: number, offset?: number|string, fields?: string[], ctx?: any): Promise<SearchResult<T>>;
|
|
6
6
|
}
|
|
@@ -3,7 +3,7 @@ import {Filter, SearchResult} from '../model';
|
|
|
3
3
|
|
|
4
4
|
export interface SearchService<T, F extends Filter> {
|
|
5
5
|
keys?(): string[];
|
|
6
|
-
search(s: F, limit
|
|
6
|
+
search(s: F, limit: number, page?: number|string, fields?: string[], ctx?: any): Promise<SearchResult<T>>;
|
|
7
7
|
}
|
|
8
8
|
export interface Query<T, ID, F extends Filter> extends SearchService<T, F> {
|
|
9
9
|
metadata?(): Attributes|undefined;
|