onecore 0.0.17 → 0.0.18

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onecore",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "onecore",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "git@github.com/common-ts/onecore"
20
+ "url": "git@github.com/core-ts/onecore"
21
21
  },
22
22
  "keywords": [
23
23
  "one",
package/src/index.ts CHANGED
@@ -27,12 +27,18 @@ export {DataLoader} from './loader';
27
27
 
28
28
  export * from './model';
29
29
 
30
+ import {GenericSearchRepository} from './repository/GenericSearchRepository';
31
+ export {GenericSearchRepository as Repository};
32
+
30
33
  export * from './repository/ViewRepository';
31
34
  export * from './repository/GenericRepository';
32
35
  export * from './repository/SearchRepository';
33
36
  export * from './repository/ViewSearchRepository';
34
37
  export * from './repository/GenericSearchRepository';
35
38
 
39
+ import {GenericSearchService} from './service/GenericSearchService';
40
+ export {GenericSearchService as Service};
41
+
36
42
  export * from './service/ViewService';
37
43
  export * from './service/GenericService';
38
44
  export * from './service/SearchService';
package/src/mq.ts CHANGED
@@ -8,37 +8,54 @@ export interface Message<T, ID, R> {
8
8
  timestamp?: Date;
9
9
  raw?: R;
10
10
  }
11
- export interface Publisher<T, ID> {
12
- publish(data: T, attributes?: StringMap, id?: ID): Promise<boolean|void>;
11
+ export interface Producer<T, R, ID> {
12
+ produce(data: T, attributes?: StringMap, id?: ID): Promise<R>;
13
13
  }
14
- export interface Sender<T, ID> {
15
- send(data: T, attributes?: StringMap, id?: ID): Promise<boolean|void>;
14
+ export interface Publisher<T, R, ID> {
15
+ publish(data: T, attributes?: StringMap, id?: ID): Promise<R>;
16
16
  }
17
- export interface Writer<T, ID> {
18
- write(data: T, attributes?: StringMap, id?: ID): Promise<boolean|void>;
17
+ export interface Sender<T, R, ID> {
18
+ send(data: T, attributes?: StringMap, id?: ID): Promise<R>;
19
+ }
20
+ export interface Writer<T, R, ID> {
21
+ write(data: T, attributes?: StringMap, id?: ID): Promise<R>;
19
22
  }
20
23
 
21
- export interface SimpleSubscriber<T> {
22
- subscribe(data: T, attributes?: StringMap, err?: any): Promise<boolean|void>;
24
+ export interface SimpleProducer<T, R, ID> {
25
+ produce(to: string, data: T, attributes?: StringMap, id?: ID): Promise<R>;
23
26
  }
24
- export interface Subscriber<T, ID, R> {
25
- subscribe(data: Message<T, ID, R>, attributes?: StringMap, err?: any): Promise<boolean|void>;
27
+ export interface SimplePublisher<T, R, ID> {
28
+ publish(to: string, data: T, attributes?: StringMap, id?: ID): Promise<R>;
29
+ }
30
+ export interface SimpleSender<T, R, ID> {
31
+ send(to: string, data: T, attributes?: StringMap, id?: ID): Promise<R>;
26
32
  }
33
+ export interface SimpleWriter<T, R, ID> {
34
+ write(to: string, data: T, attributes?: StringMap, id?: ID): Promise<R>;
35
+ }
36
+
27
37
  export interface SimpleConsumer<T> {
28
- consume(data: T, attributes?: StringMap, err?: any): Promise<boolean|void>;
38
+ consume(handle: (data: T, attributes?: StringMap) => Promise<number>): void;
29
39
  }
30
- export interface Consumer<T, ID, R> {
31
- consume(data: Message<T, ID, R>, attributes?: StringMap, err?: any): Promise<boolean|void>;
40
+ export interface SimpleSubscriber<T, R> {
41
+ subscribe(handle: (data: T, attributes?: StringMap) => Promise<number>): void;
42
+ }
43
+ export interface SimpleReceiver<T> {
44
+ receive(handle: (data: T, attributes?: StringMap) => Promise<number>): void;
32
45
  }
33
46
  export interface SimpleReader<T> {
34
- read(data: T, attributes?: StringMap, err?: any): Promise<boolean|void>;
47
+ read(handle: (data: T, attributes?: StringMap) => Promise<number>): void;
35
48
  }
49
+
36
50
  export interface Consumer<T, ID, R> {
37
- read(data: Message<T, ID, R>, attributes?: StringMap, err?: any): Promise<boolean|void>;
51
+ consume(data: Message<T, ID, R>): void;
38
52
  }
39
- export interface SimpleReceiver<T> {
40
- receive(data: T, attributes?: StringMap, err?: any): Promise<boolean|void>;
53
+ export interface Subscriber<T, ID, R> {
54
+ subscribe(handle: (data: Message<T, ID, R>) => Promise<number>): void;
41
55
  }
42
56
  export interface Receiver<T, ID, R> {
43
- receive(data: Message<T, ID, R>, attributes?: StringMap, err?: any): Promise<boolean|void>;
57
+ receive(handle: (data: Message<T, ID, R>) => Promise<number>): void;
58
+ }
59
+ export interface Reader<T, ID, R> {
60
+ read(handle: (data: Message<T, ID, R>) => Promise<number>): void;
44
61
  }
@@ -1,9 +1,9 @@
1
1
  import {Attributes} from '../metadata';
2
2
 
3
3
  export interface ViewRepository<T, ID> {
4
- metadata(): Attributes;
5
- keys(): string[];
4
+ metadata?(): Attributes;
5
+ keys?(): string[];
6
6
  all?(ctx?: any): Promise<T[]>;
7
- load(id: ID, ctx?: any): Promise<T>;
7
+ load(id: ID, ctx?: any): Promise<T|null>;
8
8
  exist?(id: ID, ctx?: any): Promise<boolean>;
9
9
  }
@@ -4,6 +4,6 @@ export interface ViewService<T, ID> {
4
4
  metadata?(): Attributes;
5
5
  keys?(): string[];
6
6
  all?(ctx?: any): Promise<T[]>;
7
- load(id: ID, ctx?: any): Promise<T>;
7
+ load(id: ID, ctx?: any): Promise<T|null>;
8
8
  exist?(id: ID, ctx?: any): Promise<boolean>;
9
9
  }
package/tsconfig.json CHANGED
@@ -6,6 +6,7 @@
6
6
  "outDir": "./lib",
7
7
  "module": "commonjs",
8
8
  "moduleResolution": "node",
9
+ "strict": true,
9
10
  "pretty": true,
10
11
  "sourceMap": false,
11
12
  "declaration": false,