onecore 0.0.27 → 0.0.28
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/index.ts +6 -27
- package/src/mail/config.ts +24 -2
- package/src/model.ts +16 -0
- package/src/mq.ts +22 -0
- package/src/repository/GenericRepository.ts +7 -0
- package/src/video.ts +9 -9
- package/src/mail/service/MailService.ts +0 -5
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,35 +1,13 @@
|
|
|
1
|
-
export {Locale} from './formatter';
|
|
2
|
-
|
|
3
1
|
export * from './db';
|
|
4
2
|
|
|
5
|
-
export
|
|
6
|
-
export {LocaleMapper} from './formatter';
|
|
7
|
-
export {Formatter} from './formatter';
|
|
8
|
-
export {LocaleFormatter} from './formatter';
|
|
9
|
-
export {StringFormatter} from './formatter';
|
|
10
|
-
export {LocaleStringFormatter} from './formatter';
|
|
11
|
-
|
|
3
|
+
export * from './formatter';
|
|
12
4
|
export * from './metadata';
|
|
13
|
-
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
export {Validator} from './validator';
|
|
18
|
-
export {SyncValidator} from './validator';
|
|
19
|
-
|
|
20
|
-
export {ValueGenerator} from './loader';
|
|
21
|
-
export {IdGenerator} from './loader';
|
|
22
|
-
|
|
23
|
-
export {Generator} from './loader';
|
|
24
|
-
export {Loader} from './loader';
|
|
25
|
-
export {UniqueValueBuilder} from './loader';
|
|
26
|
-
|
|
27
|
-
export {DataLoader} from './loader';
|
|
28
|
-
|
|
5
|
+
export * from './cache';
|
|
6
|
+
export * from './validator';
|
|
7
|
+
export * from './loader';
|
|
29
8
|
export * from './model';
|
|
30
9
|
|
|
31
10
|
import {GenericRepository} from './repository/GenericRepository';
|
|
32
|
-
export {GenericRepository as Repository};
|
|
33
11
|
|
|
34
12
|
export * from './repository/ViewRepository';
|
|
35
13
|
export * from './repository/GenericRepository';
|
|
@@ -55,7 +33,6 @@ export * from './mail/model/MailContent';
|
|
|
55
33
|
export * from './mail/model/PersonalizationData';
|
|
56
34
|
export * from './mail/model/MailSettings';
|
|
57
35
|
export * from './mail/model/ASMOptions';
|
|
58
|
-
export * from './mail/service/MailService';
|
|
59
36
|
export * from './mail/config';
|
|
60
37
|
|
|
61
38
|
export * from './location';
|
|
@@ -102,6 +79,7 @@ export class ViewManager<T, ID> implements ViewService<T, ID> {
|
|
|
102
79
|
return (this.r.exist ? this.r.exist(id, ctx) : Promise.resolve(false));
|
|
103
80
|
}
|
|
104
81
|
}
|
|
82
|
+
// tslint:disable-next-line:max-classes-per-file
|
|
105
83
|
export class GenericManager<T, ID> extends ViewManager<T, ID> implements GenericService<T, ID, number> {
|
|
106
84
|
constructor(protected repository: GenericRepository<T, ID>) {
|
|
107
85
|
super(repository);
|
|
@@ -127,6 +105,7 @@ export class GenericManager<T, ID> extends ViewManager<T, ID> implements Generic
|
|
|
127
105
|
return (this.repository.delete ? this.repository.delete(id, ctx) : Promise.resolve(-1));
|
|
128
106
|
}
|
|
129
107
|
}
|
|
108
|
+
// tslint:disable-next-line:max-classes-per-file
|
|
130
109
|
export class Manager<T, ID, F extends Filter> extends GenericManager<T, ID> implements GenericSearchService<T, ID, number, F> {
|
|
131
110
|
constructor(public find: Search<T, F>, repo: GenericRepository<T, ID>) {
|
|
132
111
|
super(repo);
|
package/src/mail/config.ts
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
|
+
import {EmailData} from './model/EmailData';
|
|
1
2
|
import {MailData} from './model/MailData';
|
|
2
3
|
|
|
3
|
-
export interface
|
|
4
|
-
|
|
4
|
+
export interface MailConfig {
|
|
5
|
+
provider?: string;
|
|
6
|
+
from: EmailData;
|
|
5
7
|
key: string;
|
|
8
|
+
smtp?: SmtpConfig;
|
|
9
|
+
}
|
|
10
|
+
export interface Address {
|
|
11
|
+
name: string;
|
|
12
|
+
address: string;
|
|
13
|
+
}
|
|
14
|
+
export interface SmtpConfig {
|
|
15
|
+
host: string;
|
|
16
|
+
port: number;
|
|
17
|
+
secure?: boolean;
|
|
18
|
+
auth: Auth;
|
|
19
|
+
}
|
|
20
|
+
export interface Auth {
|
|
21
|
+
user: string;
|
|
22
|
+
pass: string;
|
|
23
|
+
}
|
|
24
|
+
export type Send = (mailData: MailData) => Promise<boolean>;
|
|
25
|
+
export type SendMail = Send;
|
|
26
|
+
export interface MailService {
|
|
27
|
+
send(mailData: MailData): Promise<boolean>;
|
|
6
28
|
}
|
package/src/model.ts
CHANGED
|
@@ -36,6 +36,10 @@ export interface Domain {
|
|
|
36
36
|
name?: string;
|
|
37
37
|
status?: string;
|
|
38
38
|
}
|
|
39
|
+
export interface Item {
|
|
40
|
+
value: string;
|
|
41
|
+
text?: string;
|
|
42
|
+
}
|
|
39
43
|
export interface ValueText {
|
|
40
44
|
value: string;
|
|
41
45
|
text?: string;
|
|
@@ -125,12 +129,24 @@ export interface DiffModel<T, ID> {
|
|
|
125
129
|
value: T;
|
|
126
130
|
}
|
|
127
131
|
|
|
132
|
+
export interface Achievement {
|
|
133
|
+
subject: string;
|
|
134
|
+
description: string;
|
|
135
|
+
}
|
|
136
|
+
export interface Skill {
|
|
137
|
+
skill: string;
|
|
138
|
+
hirable: boolean;
|
|
139
|
+
}
|
|
128
140
|
export interface UserFilter extends Filter {
|
|
129
141
|
userId?: string;
|
|
130
142
|
username?: string;
|
|
131
143
|
email?: string;
|
|
132
144
|
displayName?: string;
|
|
145
|
+
dateOfBirth?: DateRange;
|
|
133
146
|
status?: string[]|string;
|
|
147
|
+
interests: string[];
|
|
148
|
+
skills: Skill[];
|
|
149
|
+
achievements: Achievement[];
|
|
134
150
|
}
|
|
135
151
|
export interface RoleFilter extends Filter {
|
|
136
152
|
roleId?: string;
|
package/src/mq.ts
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
interface StringMap {
|
|
2
2
|
[key: string]: string;
|
|
3
3
|
}
|
|
4
|
+
export interface NumberMap {
|
|
5
|
+
[key: number]: number;
|
|
6
|
+
}
|
|
7
|
+
export type Handle<T> = (data: T, header?: StringMap) => Promise<number>;
|
|
8
|
+
export type Consume<T> = (handle: (data: T, header?: StringMap) => Promise<number>) => void;
|
|
9
|
+
export type Read<T> = Consume<T>;
|
|
10
|
+
export type Subscribe<T> = Consume<T>;
|
|
11
|
+
export type Receive<T> = Consume<T>;
|
|
12
|
+
export type Get<T> = Consume<T>;
|
|
13
|
+
export type Fetch<T> = Consume<T>;
|
|
14
|
+
export type Produce<T, R> = (data: T) => Promise<R>;
|
|
15
|
+
export type Write<T, R> = Produce<T, R>;
|
|
16
|
+
export type Publish<T, R> = Produce<T, R>;
|
|
17
|
+
export type Send<T, R> = Produce<T, R>;
|
|
18
|
+
export type Put<T, R> = Produce<T, R>;
|
|
19
|
+
export type Set<T, R> = Produce<T, R>;
|
|
20
|
+
|
|
21
|
+
export interface RetryConfig {
|
|
22
|
+
name: string;
|
|
23
|
+
limit: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
4
26
|
export interface Message<T, ID, R> {
|
|
5
27
|
id?: ID;
|
|
6
28
|
data?: T;
|
|
@@ -7,3 +7,10 @@ export interface GenericRepository<T, ID> extends ViewRepository<T, ID> {
|
|
|
7
7
|
save?(obj: T, ctx?: any): Promise<number>;
|
|
8
8
|
delete?(id: ID, ctx?: any): Promise<number>;
|
|
9
9
|
}
|
|
10
|
+
export interface Repository<T, ID> extends ViewRepository<T, ID> {
|
|
11
|
+
insert(obj: T, ctx?: any): Promise<number>;
|
|
12
|
+
update(obj: T, ctx?: any): Promise<number>;
|
|
13
|
+
patch?(obj: T, ctx?: any): Promise<number>;
|
|
14
|
+
save?(obj: T, ctx?: any): Promise<number>;
|
|
15
|
+
delete?(id: ID, ctx?: any): Promise<number>;
|
|
16
|
+
}
|
package/src/video.ts
CHANGED
|
@@ -64,7 +64,7 @@ export interface ListResult<T> {
|
|
|
64
64
|
nextPageToken?: string;
|
|
65
65
|
}
|
|
66
66
|
export type ChannelSortType = 'title' | 'count' | 'date';
|
|
67
|
-
export interface
|
|
67
|
+
export interface ChannelFilter {
|
|
68
68
|
q?: string;
|
|
69
69
|
sort?: SortType; // date, rating, relevance, title, count (for channels)
|
|
70
70
|
forMine?: boolean;
|
|
@@ -78,7 +78,7 @@ export interface ChannelSM {
|
|
|
78
78
|
topicId?: string;
|
|
79
79
|
}
|
|
80
80
|
export type PlaylistSortType = 'title' | 'count' | 'date';
|
|
81
|
-
export interface
|
|
81
|
+
export interface PlaylistFilter {
|
|
82
82
|
q?: string;
|
|
83
83
|
sort?: SortType; // date, rating, relevance, title, count (for channels), viewCount (for live broadcast)
|
|
84
84
|
forMine?: boolean;
|
|
@@ -102,7 +102,7 @@ export type LicenseType = 'creativeCommon' | 'youtube' | 'any' | '';
|
|
|
102
102
|
export type SyndicatedType = 'true' | 'any' | '';
|
|
103
103
|
export type VideoType = 'movie' | 'episode' | 'any' | '';
|
|
104
104
|
export type SortType = 'rating' | 'date' | 'count' | 'relevance' | 'title' | 'viewCount' | '';
|
|
105
|
-
export interface
|
|
105
|
+
export interface ItemFilter {
|
|
106
106
|
q?: string;
|
|
107
107
|
type?: ItemType; // video, channel, playlist
|
|
108
108
|
duration?: Duration; // any, long (more than 20 minutes), medium (from 4 minutes to 20 minutes), short (less than 4 minutes)
|
|
@@ -127,7 +127,7 @@ export interface ItemSM {
|
|
|
127
127
|
syndicated?: SyndicatedType; // any, true
|
|
128
128
|
videoType?: SyndicatedType; // any, episode, movie
|
|
129
129
|
}
|
|
130
|
-
export interface
|
|
130
|
+
export interface VideoItem extends Title, Thumbnail, ChannelInfo {
|
|
131
131
|
kind?: string; // video, channel, playlist
|
|
132
132
|
id?: string;
|
|
133
133
|
liveBroadcastContent?: string; // upcoming, live, none
|
|
@@ -384,11 +384,11 @@ export interface VideoService {
|
|
|
384
384
|
getPopularVideos(regionCode?: string, videoCategoryId?: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<Video>>;
|
|
385
385
|
getVideos(ids: string[], fields?: string[]): Promise<Video[]>;
|
|
386
386
|
getVideo(id: string, fields?: string[]): Promise<Video>;
|
|
387
|
-
search(sm:
|
|
388
|
-
getRelatedVideos?(videoId: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<
|
|
389
|
-
searchVideos?(sm:
|
|
390
|
-
searchPlaylists?(sm:
|
|
391
|
-
searchChannels?(sm:
|
|
387
|
+
search(sm: ItemFilter, max?: number, nextPageToken?: string | number, fields?: string[]): Promise<ListResult<VideoItem>>;
|
|
388
|
+
getRelatedVideos?(videoId: string, max?: number, nextPageToken?: string, fields?: string[]): Promise<ListResult<VideoItem>>;
|
|
389
|
+
searchVideos?(sm: ItemFilter, max?: number, nextPageToken?: string | number, fields?: string[]): Promise<ListResult<VideoItem>>;
|
|
390
|
+
searchPlaylists?(sm: PlaylistFilter, max?: number, nextPageToken?: string | number, fields?: string[]): Promise<ListResult<Playlist>>;
|
|
391
|
+
searchChannels?(sm: ChannelFilter, max?: number, nextPageToken?: string | number, fields?: string[]): Promise<ListResult<Channel>>;
|
|
392
392
|
/**
|
|
393
393
|
* @param videoId
|
|
394
394
|
* @param order relevance, time (default)
|