@lemoncloud/growing-socials-api 0.24.1224 → 0.25.104
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.
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `types.ts`
|
|
3
|
+
* - common types used in `/cores`
|
|
4
|
+
*
|
|
5
|
+
* @author Steve <steve@lemoncloud.io>
|
|
6
|
+
* @date 2022-06-21 optimized w/ `abstract-services`
|
|
7
|
+
* @date 2022-06-28 added `Codable` interface for general types.
|
|
8
|
+
* @date 2023-01-18 optimized with `lemon-core@3.2.4`
|
|
9
|
+
* @date 2023-02-15 optimized with `lemon-core@3.2.5`
|
|
10
|
+
* @date 2024-11-14 optimized `IdentityToken`.
|
|
11
|
+
*
|
|
12
|
+
* @copyright (C) 2022 LemonCloud Co Ltd. - All Rights Reserved.
|
|
13
|
+
* @origin `@lemoncloud/codes-backend-api/cores`
|
|
14
|
+
*/
|
|
15
|
+
import { NextIdentity, CoreModel, View, Body } from 'lemon-model';
|
|
16
|
+
export { CoreModel, View, Body };
|
|
17
|
+
/** type: `IdentityTokenSite` */
|
|
18
|
+
export interface IdentityTokenSite {
|
|
19
|
+
/** site-code (ex: kwonsun) */
|
|
20
|
+
code?: string;
|
|
21
|
+
/** name of site (ex: 권선) */
|
|
22
|
+
name?: string;
|
|
23
|
+
}
|
|
24
|
+
/** type: `IdentityTokenUser` */
|
|
25
|
+
export interface IdentityTokenUser {
|
|
26
|
+
/** name of user (ex: 홍길동) */
|
|
27
|
+
name?: string;
|
|
28
|
+
/** nick of user (ex: 홍사마) */
|
|
29
|
+
nick?: string;
|
|
30
|
+
/** (optional) login-id of user */
|
|
31
|
+
login?: string;
|
|
32
|
+
}
|
|
33
|
+
/** type: `IdentityTokenGroup` */
|
|
34
|
+
export interface IdentityTokenGroup {
|
|
35
|
+
/** site-code (ex: kwonsun) */
|
|
36
|
+
code?: string;
|
|
37
|
+
/** name of site (ex: 권선) */
|
|
38
|
+
name?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* type: `IdentityToken`
|
|
42
|
+
* - 계정토큰(= JWT(IdentityToken))으로, `/refresh`시 AWS Key와 함께 발급됨 (기본, 1일동안 유효함)
|
|
43
|
+
* - `backend-api`에서 조직/그룹/사용자에 맞게 재설정됨!
|
|
44
|
+
* - 세션토큰 검사는 `proxy.getCurrenSession()` 이용하기
|
|
45
|
+
*/
|
|
46
|
+
export interface IdentityToken<T = any, U extends IdentityTokenUser = IdentityTokenUser, S extends IdentityTokenSite = IdentityTokenSite, G extends IdentityTokenGroup = IdentityTokenGroup> extends NextIdentity<T> {
|
|
47
|
+
/**
|
|
48
|
+
* site-id (= id in `SiteModel(사이트)`)
|
|
49
|
+
* - `#` 일경우, 특정 site에 엮이지 않음 (무시됨)
|
|
50
|
+
* - `0000` 일경우, 기본 site 정보로 환경설정에 따름
|
|
51
|
+
* - 메인 `backend-api` (see `.iss`)에서 관리되는 `site-model`의 id
|
|
52
|
+
*
|
|
53
|
+
* @see SiteModel
|
|
54
|
+
*/
|
|
55
|
+
sid: string;
|
|
56
|
+
/**
|
|
57
|
+
* group-id (= id in `GroupModel(그룹)`)
|
|
58
|
+
* - `group`은 `user`를 물리적 구분으로 나눠서 생각해볼때 이용가능함.
|
|
59
|
+
*
|
|
60
|
+
* @see GroupModel
|
|
61
|
+
*/
|
|
62
|
+
gid: string;
|
|
63
|
+
/**
|
|
64
|
+
* user-id (= id in `UserModel(유저)`)
|
|
65
|
+
* - 메인 `backend-api` (see `.iss`)에서 관리되는 `user-model`의 id.
|
|
66
|
+
*
|
|
67
|
+
* @see UserModel
|
|
68
|
+
*/
|
|
69
|
+
uid: string;
|
|
70
|
+
/**
|
|
71
|
+
* auth-id (= id in `AuthModel(인정정보)`)
|
|
72
|
+
* - 메인 `backend-api` (see `.iss`)에서 관리되는 `auth-model`의 id.
|
|
73
|
+
* - 인증 정보를 통해서, 로그인의 추가 상세 정보를 알 수 있음.
|
|
74
|
+
*
|
|
75
|
+
* @see AuthModel
|
|
76
|
+
*/
|
|
77
|
+
aid: string;
|
|
78
|
+
/**
|
|
79
|
+
* list of roles (like `user`, `admin`, `super`)
|
|
80
|
+
*/
|
|
81
|
+
roles: string[];
|
|
82
|
+
/**
|
|
83
|
+
* (optional) internal `identity-id` (= delegated identity)
|
|
84
|
+
* - `.identityId` 는 aws cognito 인증을 통해서, 현재 인증된 `identity-id`를 알 수 있음
|
|
85
|
+
* - 다만, `delegated`된 경우에는 위임된 id 가 들어감.
|
|
86
|
+
*
|
|
87
|
+
* @deprecated 삭제될 예정! @241114
|
|
88
|
+
*/
|
|
89
|
+
iid?: string;
|
|
90
|
+
/**
|
|
91
|
+
* service-name of issuer
|
|
92
|
+
* ex) `lemon-backend-api`
|
|
93
|
+
*/
|
|
94
|
+
iss?: string;
|
|
95
|
+
/** Site Info */
|
|
96
|
+
Site: S;
|
|
97
|
+
/** User Info */
|
|
98
|
+
User: U;
|
|
99
|
+
/** (optional) Group Info */
|
|
100
|
+
Group?: G;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* type `ListResult`
|
|
104
|
+
*/
|
|
105
|
+
export interface ListResult<T, R = any> {
|
|
106
|
+
/**
|
|
107
|
+
* total searched count
|
|
108
|
+
*/
|
|
109
|
+
total?: number;
|
|
110
|
+
/**
|
|
111
|
+
* max items count in the page
|
|
112
|
+
*/
|
|
113
|
+
limit?: number;
|
|
114
|
+
/**
|
|
115
|
+
* current page number.
|
|
116
|
+
*/
|
|
117
|
+
page?: number;
|
|
118
|
+
/**
|
|
119
|
+
* (optional) time took in sec
|
|
120
|
+
*/
|
|
121
|
+
took?: number;
|
|
122
|
+
/**
|
|
123
|
+
* items searched
|
|
124
|
+
*/
|
|
125
|
+
list: T[];
|
|
126
|
+
/**
|
|
127
|
+
* (optional) aggr list
|
|
128
|
+
*/
|
|
129
|
+
aggr?: R[];
|
|
130
|
+
}
|
|
131
|
+
export interface AggrKeyCount {
|
|
132
|
+
/** name of key(or bucket name) */
|
|
133
|
+
key: string;
|
|
134
|
+
/** number of count */
|
|
135
|
+
val: number;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* type `PaginatedListResult`
|
|
139
|
+
*/
|
|
140
|
+
export interface PaginatedListResult<T, R = string> extends ListResult<T, R> {
|
|
141
|
+
/**
|
|
142
|
+
* current page
|
|
143
|
+
*/
|
|
144
|
+
page: number;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* type `ListParam`
|
|
148
|
+
*/
|
|
149
|
+
export interface ListParam {
|
|
150
|
+
/**
|
|
151
|
+
* max items count to be fetched
|
|
152
|
+
*/
|
|
153
|
+
limit?: number;
|
|
154
|
+
/**
|
|
155
|
+
* (optional) sorting order
|
|
156
|
+
* - 'asc': older first
|
|
157
|
+
* - 'desc': newer first
|
|
158
|
+
* - string: extended sorting features
|
|
159
|
+
*/
|
|
160
|
+
sort?: 'asc' | 'desc' | string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* type `PaginateParam`
|
|
164
|
+
*/
|
|
165
|
+
export interface PaginateParam extends ListParam {
|
|
166
|
+
/**
|
|
167
|
+
* page # to fetch (0-indexed)
|
|
168
|
+
*/
|
|
169
|
+
page?: number;
|
|
170
|
+
/**
|
|
171
|
+
* (optional) offset # from start.
|
|
172
|
+
*/
|
|
173
|
+
offset?: number;
|
|
174
|
+
/**
|
|
175
|
+
* (optional) flag to filter by uid
|
|
176
|
+
*/
|
|
177
|
+
uid?: string;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* type `BulkUpdateBody`
|
|
181
|
+
*/
|
|
182
|
+
export interface BulkUpdateBody<T> extends BulkBody<T> {
|
|
183
|
+
/**
|
|
184
|
+
* list bulk update model with id
|
|
185
|
+
*/
|
|
186
|
+
list: T[];
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* body data for bulk
|
|
190
|
+
*/
|
|
191
|
+
export interface BulkBody<T> {
|
|
192
|
+
list: T[];
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* list of the selected model-id
|
|
196
|
+
*/
|
|
197
|
+
export interface BodyList<T extends {
|
|
198
|
+
id: string;
|
|
199
|
+
} = {
|
|
200
|
+
id: string;
|
|
201
|
+
}> {
|
|
202
|
+
list: T[];
|
|
203
|
+
}
|