onecore 0.5.2 → 0.5.4
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/lib/index.js +15 -26
- package/package.json +1 -1
- package/src/db.ts +44 -5
- package/src/index.ts +25 -48
- package/src/service.ts +45 -0
- package/src/repository/GenericRepository.ts +0 -20
- package/src/repository/GenericSearchRepository.ts +0 -7
- package/src/repository/SearchRepository.ts +0 -6
- package/src/repository/ViewRepository.ts +0 -7
- package/src/repository/ViewSearchRepository.ts +0 -7
- package/src/service/ApprService.ts +0 -17
- package/src/service/DiffApprService.ts +0 -16
- package/src/service/DiffService.ts +0 -22
- package/src/service/GenericSearchDiffApprService.ts +0 -7
- package/src/service/GenericSearchService.ts +0 -10
- package/src/service/GenericService.ts +0 -8
- package/src/service/SearchService.ts +0 -22
- package/src/service/ViewSearchService.ts +0 -7
- package/src/service/ViewService.ts +0 -7
package/lib/index.js
CHANGED
|
@@ -32,14 +32,14 @@ var Writer = (function () {
|
|
|
32
32
|
this.update = this.update.bind(this);
|
|
33
33
|
this.patch = this.patch.bind(this);
|
|
34
34
|
}
|
|
35
|
-
Writer.prototype.create = function (obj
|
|
36
|
-
return this.repository.create(obj
|
|
35
|
+
Writer.prototype.create = function (obj) {
|
|
36
|
+
return this.repository.create(obj);
|
|
37
37
|
};
|
|
38
|
-
Writer.prototype.update = function (obj
|
|
39
|
-
return this.repository.update(obj
|
|
38
|
+
Writer.prototype.update = function (obj) {
|
|
39
|
+
return this.repository.update(obj);
|
|
40
40
|
};
|
|
41
|
-
Writer.prototype.patch = function (obj
|
|
42
|
-
return (this.repository.patch ? this.repository.patch(obj
|
|
41
|
+
Writer.prototype.patch = function (obj) {
|
|
42
|
+
return (this.repository.patch ? this.repository.patch(obj) : Promise.resolve(-1));
|
|
43
43
|
};
|
|
44
44
|
return Writer;
|
|
45
45
|
}());
|
|
@@ -75,11 +75,11 @@ var UseCase = (function (_super) {
|
|
|
75
75
|
UseCase.prototype.keys = function () {
|
|
76
76
|
return (this.repository.keys ? this.repository.keys() : []);
|
|
77
77
|
};
|
|
78
|
-
UseCase.prototype.load = function (id
|
|
79
|
-
return this.repository.load(id
|
|
78
|
+
UseCase.prototype.load = function (id) {
|
|
79
|
+
return this.repository.load(id);
|
|
80
80
|
};
|
|
81
|
-
UseCase.prototype.delete = function (id
|
|
82
|
-
return this.repository.delete(id
|
|
81
|
+
UseCase.prototype.delete = function (id) {
|
|
82
|
+
return this.repository.delete(id);
|
|
83
83
|
};
|
|
84
84
|
return UseCase;
|
|
85
85
|
}(SearchWriter));
|
|
@@ -101,11 +101,11 @@ var GenericUseCase = (function (_super) {
|
|
|
101
101
|
GenericUseCase.prototype.keys = function () {
|
|
102
102
|
return (this.repository.keys ? this.repository.keys() : []);
|
|
103
103
|
};
|
|
104
|
-
GenericUseCase.prototype.load = function (id
|
|
105
|
-
return this.repository.load(id
|
|
104
|
+
GenericUseCase.prototype.load = function (id) {
|
|
105
|
+
return this.repository.load(id);
|
|
106
106
|
};
|
|
107
|
-
GenericUseCase.prototype.delete = function (id
|
|
108
|
-
return this.repository.delete(id
|
|
107
|
+
GenericUseCase.prototype.delete = function (id) {
|
|
108
|
+
return this.repository.delete(id);
|
|
109
109
|
};
|
|
110
110
|
return GenericUseCase;
|
|
111
111
|
}(Writer));
|
|
@@ -141,15 +141,4 @@ var SavedService = (function () {
|
|
|
141
141
|
return SavedService;
|
|
142
142
|
}());
|
|
143
143
|
exports.SavedService = SavedService;
|
|
144
|
-
|
|
145
|
-
__extends(SavedUseCase, _super);
|
|
146
|
-
function SavedUseCase() {
|
|
147
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
148
|
-
}
|
|
149
|
-
return SavedUseCase;
|
|
150
|
-
}(SavedService));
|
|
151
|
-
exports.SavedUseCase = SavedUseCase;
|
|
152
|
-
function isSuccessful(res) {
|
|
153
|
-
return (typeof res === "number" && res <= 0) || Array.isArray(res) ? false : true;
|
|
154
|
-
}
|
|
155
|
-
exports.isSuccessful = isSuccessful;
|
|
144
|
+
exports.SavedUseCase = SavedService;
|
package/package.json
CHANGED
package/src/db.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {Attribute} from './metadata';
|
|
1
|
+
import { Attribute, Attributes } from './metadata';
|
|
2
|
+
import { Filter, SearchResult } from './model';
|
|
2
3
|
export interface Statement {
|
|
3
4
|
query: string;
|
|
4
5
|
params?: any[];
|
|
@@ -13,10 +14,48 @@ export interface SimpleDB {
|
|
|
13
14
|
interface StringMap {
|
|
14
15
|
[key: string]: string;
|
|
15
16
|
}
|
|
16
|
-
export interface
|
|
17
|
+
export interface Executor {
|
|
17
18
|
driver: string;
|
|
18
19
|
param(i: number): string;
|
|
19
|
-
exec(sql: string, args?: any[], ctx?:
|
|
20
|
-
execBatch(statements: Statement[], firstSuccess?: boolean, ctx?:
|
|
21
|
-
query<T>(sql: string, args?: any[], m?: StringMap, bools?: Attribute[], ctx?:
|
|
20
|
+
exec(sql: string, args?: any[], ctx?: Transaction): Promise<number>;
|
|
21
|
+
execBatch(statements: Statement[], firstSuccess?: boolean, ctx?: Transaction): Promise<number>;
|
|
22
|
+
query<T>(sql: string, args?: any[], m?: StringMap, bools?: Attribute[], ctx?: Transaction): Promise<T[]>;
|
|
23
|
+
}
|
|
24
|
+
export interface Transaction extends Executor {
|
|
25
|
+
commit(): Promise<void>
|
|
26
|
+
rollback(): Promise<void>
|
|
27
|
+
end(): Promise<void>
|
|
28
|
+
}
|
|
29
|
+
export interface DB extends Executor {
|
|
30
|
+
beginTransaction(): Promise<Transaction>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ViewRepository<T, ID> {
|
|
34
|
+
metadata?(): Attributes|undefined;
|
|
35
|
+
keys?(): string[];
|
|
36
|
+
load(id: ID, ctx?: Transaction): Promise<T|null>;
|
|
37
|
+
}
|
|
38
|
+
export interface SearchRepository<T, F extends Filter> {
|
|
39
|
+
search(s: F, limit: number, offset?: number|string, fields?: string[], ctx?: Transaction): Promise<SearchResult<T>>;
|
|
40
|
+
}
|
|
41
|
+
export interface ViewSearchRepository<T, ID, F extends Filter>
|
|
42
|
+
extends ViewRepository<T, ID>, SearchRepository<T, F> {
|
|
43
|
+
}
|
|
44
|
+
export interface GenericRepository<T, ID> extends ViewRepository<T, ID> {
|
|
45
|
+
create(obj: T, ctx?: Transaction): Promise<number>;
|
|
46
|
+
update(obj: T, ctx?: Transaction): Promise<number>;
|
|
47
|
+
patch(obj: Partial<T>, ctx?: Transaction): Promise<number>;
|
|
48
|
+
delete(id: ID, ctx?: Transaction): Promise<number>;
|
|
49
|
+
}
|
|
50
|
+
export interface CRUDRepository<T, ID> extends ViewRepository<T, ID> {
|
|
51
|
+
create(obj: T, ctx?: Transaction): Promise<number>;
|
|
52
|
+
update(obj: T, ctx?: Transaction): Promise<number>;
|
|
53
|
+
patch(obj: Partial<T>, ctx?: Transaction): Promise<number>;
|
|
54
|
+
delete(id: ID, ctx?: Transaction): Promise<number>;
|
|
55
|
+
}
|
|
56
|
+
export interface Repository<T, ID, F extends Filter>
|
|
57
|
+
extends GenericRepository<T, ID>, SearchRepository<T, F> {
|
|
58
|
+
}
|
|
59
|
+
export interface GenericSearchRepository<T, ID, F extends Filter>
|
|
60
|
+
extends GenericRepository<T, ID>, SearchRepository<T, F> {
|
|
22
61
|
}
|
package/src/index.ts
CHANGED
|
@@ -7,23 +7,9 @@ export * from './validator';
|
|
|
7
7
|
export * from './loader';
|
|
8
8
|
export * from './model';
|
|
9
9
|
|
|
10
|
-
import {GenericRepository} from './
|
|
11
|
-
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './repository/GenericRepository';
|
|
14
|
-
export * from './repository/SearchRepository';
|
|
15
|
-
export * from './repository/ViewSearchRepository';
|
|
16
|
-
export * from './repository/GenericSearchRepository';
|
|
17
|
-
|
|
18
|
-
export * from './service/ViewService';
|
|
19
|
-
export * from './service/GenericService';
|
|
20
|
-
export * from './service/SearchService';
|
|
21
|
-
export * from './service/ViewSearchService';
|
|
22
|
-
export * from './service/GenericSearchService';
|
|
23
|
-
export * from './service/DiffService';
|
|
24
|
-
export * from './service/ApprService';
|
|
25
|
-
export * from './service/DiffApprService';
|
|
26
|
-
export * from './service/GenericSearchDiffApprService';
|
|
10
|
+
import { GenericRepository, SearchRepository, GenericSearchRepository, Transaction } from './db';
|
|
11
|
+
import { GenericSearchService, GenericService } from './service';
|
|
12
|
+
export * from './service';
|
|
27
13
|
|
|
28
14
|
export * from './mail/model/AttachmentData';
|
|
29
15
|
export * from './mail/model/TrackingSettings';
|
|
@@ -56,10 +42,6 @@ export type LogFunc = Log;
|
|
|
56
42
|
|
|
57
43
|
import { Attributes } from './metadata';
|
|
58
44
|
import { ErrorMessage, Filter, SearchResult } from './model';
|
|
59
|
-
import { GenericSearchService } from './service/GenericSearchService';
|
|
60
|
-
import { GenericService } from './service/GenericService';
|
|
61
|
-
import { SearchRepository } from './repository/SearchRepository';
|
|
62
|
-
import { GenericSearchRepository } from './repository/GenericSearchRepository';
|
|
63
45
|
|
|
64
46
|
export type Search<T, F> = (s: F, limit: number, page?: number | string, fields?: string[]) => Promise<SearchResult<T>>;
|
|
65
47
|
export type SearchFunc<T, F> = Search<T, F>;
|
|
@@ -136,9 +118,9 @@ export class SearchUseCase<T, F extends Filter> {
|
|
|
136
118
|
export const SearchManager = SearchUseCase
|
|
137
119
|
|
|
138
120
|
interface WriterRepo<T> {
|
|
139
|
-
create(obj: T, ctx?:
|
|
140
|
-
update(obj: T, ctx?:
|
|
141
|
-
patch(obj: Partial<T>, ctx?:
|
|
121
|
+
create(obj: T, ctx?: Transaction): Promise<number>;
|
|
122
|
+
update(obj: T, ctx?: Transaction): Promise<number>;
|
|
123
|
+
patch(obj: Partial<T>, ctx?: Transaction): Promise<number>;
|
|
142
124
|
}
|
|
143
125
|
// tslint:disable-next-line:max-classes-per-file
|
|
144
126
|
export class Writer<T> {
|
|
@@ -147,22 +129,22 @@ export class Writer<T> {
|
|
|
147
129
|
this.update = this.update.bind(this);
|
|
148
130
|
this.patch = this.patch.bind(this);
|
|
149
131
|
}
|
|
150
|
-
create(obj: T
|
|
151
|
-
return this.repository.create(obj
|
|
132
|
+
create(obj: T): Promise<number> {
|
|
133
|
+
return this.repository.create(obj);
|
|
152
134
|
}
|
|
153
|
-
update(obj: T
|
|
154
|
-
return this.repository.update(obj
|
|
135
|
+
update(obj: T): Promise<number> {
|
|
136
|
+
return this.repository.update(obj);
|
|
155
137
|
}
|
|
156
|
-
patch(obj: Partial<T
|
|
157
|
-
return (this.repository.patch ? this.repository.patch(obj
|
|
138
|
+
patch(obj: Partial<T>): Promise<number> {
|
|
139
|
+
return (this.repository.patch ? this.repository.patch(obj) : Promise.resolve(-1));
|
|
158
140
|
}
|
|
159
141
|
}
|
|
160
142
|
|
|
161
143
|
interface SearchWriterRepo<T, F extends Filter> {
|
|
162
144
|
search(s: F, limit: number, page?: number|string, fields?: string[]): Promise<SearchResult<T>>
|
|
163
|
-
create(obj: T, ctx?:
|
|
164
|
-
update(obj: T, ctx?:
|
|
165
|
-
patch(obj: Partial<T>, ctx?:
|
|
145
|
+
create(obj: T, ctx?: Transaction): Promise<number>;
|
|
146
|
+
update(obj: T, ctx?: Transaction): Promise<number>;
|
|
147
|
+
patch(obj: Partial<T>, ctx?: Transaction): Promise<number>;
|
|
166
148
|
}
|
|
167
149
|
// tslint:disable-next-line:max-classes-per-file
|
|
168
150
|
export class SearchWriter<T, F extends Filter> extends Writer<T> {
|
|
@@ -190,11 +172,11 @@ export class UseCase<T, ID, F extends Filter> extends SearchWriter<T, F> impleme
|
|
|
190
172
|
keys(): string[] {
|
|
191
173
|
return (this.repository.keys ? this.repository.keys() : []);
|
|
192
174
|
}
|
|
193
|
-
load(id: ID
|
|
194
|
-
return this.repository.load(id
|
|
175
|
+
load(id: ID): Promise<T | null> {
|
|
176
|
+
return this.repository.load(id);
|
|
195
177
|
}
|
|
196
|
-
delete(id: ID
|
|
197
|
-
return this.repository.delete(id
|
|
178
|
+
delete(id: ID): Promise<number> {
|
|
179
|
+
return this.repository.delete(id);
|
|
198
180
|
}
|
|
199
181
|
}
|
|
200
182
|
|
|
@@ -207,17 +189,17 @@ export class GenericUseCase<T, ID> extends Writer<T> implements GenericService<T
|
|
|
207
189
|
this.load = this.load.bind(this);
|
|
208
190
|
this.delete = this.delete.bind(this);
|
|
209
191
|
}
|
|
210
|
-
metadata(): Attributes|undefined {
|
|
192
|
+
metadata(): Attributes | undefined {
|
|
211
193
|
return (this.repository.metadata ? this.repository.metadata() : undefined);
|
|
212
194
|
}
|
|
213
195
|
keys(): string[] {
|
|
214
196
|
return (this.repository.keys ? this.repository.keys() : []);
|
|
215
197
|
}
|
|
216
|
-
load(id: ID
|
|
217
|
-
return this.repository.load(id
|
|
198
|
+
load(id: ID): Promise<T | null> {
|
|
199
|
+
return this.repository.load(id);
|
|
218
200
|
}
|
|
219
|
-
delete(id: ID
|
|
220
|
-
return this.repository.delete(id
|
|
201
|
+
delete(id: ID): Promise<number> {
|
|
202
|
+
return this.repository.delete(id);
|
|
221
203
|
}
|
|
222
204
|
}
|
|
223
205
|
export const CRUDUseCase = GenericUseCase
|
|
@@ -254,9 +236,4 @@ export class SavedService<UID, ID> {
|
|
|
254
236
|
return this.savedRepository.remove(userId, id)
|
|
255
237
|
}
|
|
256
238
|
}
|
|
257
|
-
|
|
258
|
-
export class SavedUseCase<ID, T> extends SavedService<ID, T> {
|
|
259
|
-
}
|
|
260
|
-
export function isSuccessful<T>(res: number | T | ErrorMessage[]): boolean {
|
|
261
|
-
return (typeof res === "number" && res <= 0) || Array.isArray(res) ? false : true
|
|
262
|
-
}
|
|
239
|
+
export const SavedUseCase = SavedService
|
package/src/service.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Filter, Result, SearchResult } from './model';
|
|
2
|
+
import { Attributes } from './metadata';
|
|
3
|
+
|
|
4
|
+
export interface ViewService<T, ID> {
|
|
5
|
+
metadata?(): Attributes|undefined;
|
|
6
|
+
keys?(): string[];
|
|
7
|
+
load(id: ID): Promise<T|null>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface SearchService<T, F extends Filter> {
|
|
11
|
+
keys?(): string[];
|
|
12
|
+
search(s: F, limit: number, page?: number|string, fields?: string[]): Promise<SearchResult<T>>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface Query<T, ID, F extends Filter> extends SearchService<T, F> {
|
|
16
|
+
metadata?(): Attributes|undefined;
|
|
17
|
+
load(id: ID): Promise<T|null>;
|
|
18
|
+
}
|
|
19
|
+
export interface QueryService<T, ID, F extends Filter> extends SearchService<T, F> {
|
|
20
|
+
metadata?(): Attributes|undefined;
|
|
21
|
+
load(id: ID): Promise<T|null>;
|
|
22
|
+
}
|
|
23
|
+
export interface QueryRepository<T, ID, F extends Filter> extends SearchService<T, F> {
|
|
24
|
+
metadata?(): Attributes|undefined;
|
|
25
|
+
load(id: ID): Promise<T|null>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface GenericService<T, ID, R> extends ViewService<T, ID> {
|
|
29
|
+
create(obj: T): Promise<R>;
|
|
30
|
+
update(obj: T): Promise<R>;
|
|
31
|
+
patch(obj: Partial<T>): Promise<R>;
|
|
32
|
+
delete(id: ID): Promise<number>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface ViewSearchService<T, ID, F extends Filter>
|
|
36
|
+
extends ViewService<T, ID>, SearchService<T, F> {
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface GenericSearchService<T, ID, R, F extends Filter>
|
|
40
|
+
extends GenericService<T, ID, R>, SearchService<T, F> {
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface Service<T, ID, F extends Filter>
|
|
44
|
+
extends GenericService<T, ID, Result<T>>, SearchService<T, F> {
|
|
45
|
+
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {ViewRepository} from './ViewRepository';
|
|
2
|
-
|
|
3
|
-
export interface GenericRepository<T, ID> extends ViewRepository<T, ID> {
|
|
4
|
-
create(obj: T, ctx?: any): Promise<number>;
|
|
5
|
-
update(obj: T, ctx?: any): Promise<number>;
|
|
6
|
-
patch(obj: Partial<T>, ctx?: any): Promise<number>;
|
|
7
|
-
delete(id: ID, ctx?: any): Promise<number>;
|
|
8
|
-
}
|
|
9
|
-
export interface Repository<T, ID> extends ViewRepository<T, ID> {
|
|
10
|
-
create(obj: T, ctx?: any): Promise<number>;
|
|
11
|
-
update(obj: T, ctx?: any): Promise<number>;
|
|
12
|
-
patch(obj: Partial<T>, ctx?: any): Promise<number>;
|
|
13
|
-
delete(id: ID, ctx?: any): Promise<number>;
|
|
14
|
-
}
|
|
15
|
-
export interface CRUDRepository<T, ID> extends ViewRepository<T, ID> {
|
|
16
|
-
create(obj: T, ctx?: any): Promise<number>;
|
|
17
|
-
update(obj: T, ctx?: any): Promise<number>;
|
|
18
|
-
patch(obj: Partial<T>, ctx?: any): Promise<number>;
|
|
19
|
-
delete(id: ID, ctx?: any): Promise<number>;
|
|
20
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import {Filter} from '../model';
|
|
2
|
-
import {GenericRepository} from './GenericRepository';
|
|
3
|
-
import {SearchRepository} from './SearchRepository';
|
|
4
|
-
|
|
5
|
-
export interface GenericSearchRepository<T, ID, F extends Filter>
|
|
6
|
-
extends GenericRepository<T, ID>, SearchRepository<T, F> {
|
|
7
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface ApprService<ID> {
|
|
2
|
-
approve(id: ID, ctx?: any): Promise<number|string>;
|
|
3
|
-
reject(id: ID, ctx?: any): Promise<number|string>;
|
|
4
|
-
}
|
|
5
|
-
export interface ApprListService<ID> {
|
|
6
|
-
approve(ids: ID[], ctx?: any): Promise<number|string>;
|
|
7
|
-
reject(ids: ID[], ctx?: any): Promise<number|string>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface ApprRepository<ID> {
|
|
11
|
-
approve(id: ID, ctx?: any): Promise<number|string>;
|
|
12
|
-
reject(id: ID, ctx?: any): Promise<number|string>;
|
|
13
|
-
}
|
|
14
|
-
export interface ApprListRepository<ID> {
|
|
15
|
-
approve(ids: ID[], ctx?: any): Promise<number|string>;
|
|
16
|
-
reject(ids: ID[], ctx?: any): Promise<number|string>;
|
|
17
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {ApprListRepository, ApprListService, ApprRepository, ApprService} from './ApprService';
|
|
2
|
-
import {DiffListRepository, DiffListService, DiffRepository, DiffService} from './DiffService';
|
|
3
|
-
|
|
4
|
-
export interface DiffApprService<T, ID> extends DiffService<T, ID>, ApprService<ID> {
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export interface DiffApprListService<T, ID> extends DiffListService<T, ID>, ApprListService<ID> {
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface DiffApprRepository<T, ID> extends DiffRepository<T, ID>, ApprRepository<ID> {
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
export interface DiffApprListRepository<T, ID> extends DiffListRepository<T, ID>, ApprListRepository<ID> {
|
|
15
|
-
|
|
16
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import {DiffModel} from '../model';
|
|
3
|
-
|
|
4
|
-
export interface DiffService<T, ID> {
|
|
5
|
-
keys?(): string[];
|
|
6
|
-
diff(id: ID, ctx?: any): Promise<DiffModel<T, ID>>;
|
|
7
|
-
}
|
|
8
|
-
export interface DiffListService<T, ID> {
|
|
9
|
-
keys?(): string[];
|
|
10
|
-
// tslint:disable-next-line:array-type
|
|
11
|
-
diff(ids: ID[], ctx?: any): Promise<Array<DiffModel<T, ID>>>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface DiffRepository<T, ID> {
|
|
15
|
-
keys?(): string[];
|
|
16
|
-
diff(id: ID, ctx?: any): Promise<DiffModel<T, ID>>;
|
|
17
|
-
}
|
|
18
|
-
export interface DiffListRepository<T, ID> {
|
|
19
|
-
keys?(): string[];
|
|
20
|
-
// tslint:disable-next-line:array-type
|
|
21
|
-
diff(ids: ID[], ctx?: any): Promise<Array<DiffModel<T, ID>>>;
|
|
22
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import {Filter} from '../model';
|
|
2
|
-
import {DiffApprService} from './DiffApprService';
|
|
3
|
-
import {GenericSearchService} from './GenericSearchService';
|
|
4
|
-
|
|
5
|
-
export interface GenericSearchDiffApprService<T, ID, R, F extends Filter> extends GenericSearchService<T, ID, R, F>, DiffApprService<T, ID> {
|
|
6
|
-
|
|
7
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {Filter, Result} from '../model';
|
|
2
|
-
import {GenericService} from './GenericService';
|
|
3
|
-
import {SearchService} from './SearchService';
|
|
4
|
-
|
|
5
|
-
export interface GenericSearchService<T, ID, R, F extends Filter>
|
|
6
|
-
extends GenericService<T, ID, R>, SearchService<T, F> {
|
|
7
|
-
}
|
|
8
|
-
export interface Service<T, ID, F extends Filter> extends GenericSearchService<T, ID, Result<T>, F> {
|
|
9
|
-
|
|
10
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import {ViewService} from './ViewService';
|
|
2
|
-
|
|
3
|
-
export interface GenericService<T, ID, R> extends ViewService<T, ID> {
|
|
4
|
-
create(obj: T, ctx?: any): Promise<R>;
|
|
5
|
-
update(obj: T, ctx?: any): Promise<R>;
|
|
6
|
-
patch(obj: Partial<T>, ctx?: any): Promise<R>;
|
|
7
|
-
delete(id: ID, ctx?: any): Promise<number>;
|
|
8
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {Attributes} from '../metadata';
|
|
2
|
-
import {Filter, SearchResult} from '../model';
|
|
3
|
-
|
|
4
|
-
export interface SearchService<T, F extends Filter> {
|
|
5
|
-
keys?(): string[];
|
|
6
|
-
search(s: F, limit: number, page?: number|string, fields?: string[], ctx?: any): Promise<SearchResult<T>>;
|
|
7
|
-
}
|
|
8
|
-
export interface Query<T, ID, F extends Filter> extends SearchService<T, F> {
|
|
9
|
-
metadata?(): Attributes|undefined;
|
|
10
|
-
metadata?(): Attributes|undefined;
|
|
11
|
-
load(id: ID, ctx?: any): Promise<T|null>;
|
|
12
|
-
}
|
|
13
|
-
export interface QueryService<T, ID, F extends Filter> extends SearchService<T, F> {
|
|
14
|
-
metadata?(): Attributes|undefined;
|
|
15
|
-
metadata?(): Attributes|undefined;
|
|
16
|
-
load(id: ID, ctx?: any): Promise<T|null>;
|
|
17
|
-
}
|
|
18
|
-
export interface QueryRepository<T, ID, F extends Filter> extends SearchService<T, F> {
|
|
19
|
-
metadata?(): Attributes|undefined;
|
|
20
|
-
metadata?(): Attributes|undefined;
|
|
21
|
-
load(id: ID, ctx?: any): Promise<T|null>;
|
|
22
|
-
}
|