@mitreka/coreflow-types 0.0.8 → 0.0.10

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.
Files changed (3) hide show
  1. package/auth.ts +35 -16
  2. package/package.json +1 -1
  3. package/resource.ts +16 -6
package/auth.ts CHANGED
@@ -40,29 +40,39 @@ export type AccessUser = {
40
40
  }
41
41
 
42
42
  export type AuthAccessType = 'offline' | 'online';
43
-
44
43
  export type AuthGrantType = 'authorization_code' | 'refresh_token';
45
-
46
44
  export type AuthResponseType = 'code' | 'token';
47
45
 
48
- /**
49
- * Authorization request
50
- */
51
- export type AuthorizationRequest = {
46
+ export type AuthorizationParam = {
52
47
  client_id: string;
53
48
  client_secret: string;
54
49
  code: string;
50
+ code_verifier: string;
55
51
  code_challenge: string;
56
52
  code_challenge_method: string;
57
- code_verifier: string;
58
53
  grant_type: AuthGrantType;
59
- response_type: AuthResponseType;
54
+ redirect_uri: string;
60
55
  refresh_token: string;
56
+ response_type: AuthResponseType;
61
57
  scope: string;
62
58
  state: string;
63
- redirect_uri: string;
64
59
  }
65
60
 
61
+ /**
62
+ * Authorization exchange
63
+ */
64
+ export type AuthorizationExchange = Omit<AuthorizationParam, 'code_challenge' | 'code_challenge_method' | 'refresh_token' | 'response_type' | 'scope' | 'state'>;
65
+
66
+ /**
67
+ * Authorization refresh
68
+ */
69
+ export type AuthorizationRefresh = Pick<AuthorizationParam, 'client_id' | 'client_secret' | 'grant_type' | 'refresh_token'>;
70
+
71
+ /**
72
+ * Authorization request
73
+ */
74
+ export type AuthorizationRequest = Omit<AuthorizationParam, 'client_secret' | 'code' | 'code_verifier' | 'grant_type' | 'refresh_token'>;
75
+
66
76
  export type ClientDetail = {
67
77
  name: string;
68
78
  description?: string;
@@ -73,7 +83,7 @@ export type IDToken = {
73
83
  aud: string; // Client ID
74
84
  sub: string; // User ID
75
85
  name: string;
76
- email: string;
86
+ email?: string;
77
87
  iat: number;
78
88
  exp: number;
79
89
  }
@@ -105,10 +115,20 @@ export interface OAuthGrantEntity {
105
115
  user_id: string;
106
116
  code: string;
107
117
  scopes: string;
118
+ auth_code: string;
119
+ redirect_uri: string;
108
120
  expired_at?: Date;
109
121
  granted_at?: Date;
110
122
  }
111
123
 
124
+ export type OAuthLogin = {
125
+ username: string;
126
+ password: string;
127
+ client_id: string;
128
+ redirect_uri: string;
129
+ scope: string;
130
+ }
131
+
112
132
  export interface OAuthScope extends BaseEntity, OAuthScopeEntity {
113
133
  id: string;
114
134
  }
@@ -152,6 +172,11 @@ export type RefreshTokenOptions = {
152
172
  scope?: string;
153
173
  }
154
174
 
175
+ export type SessionList = {
176
+ active: string;
177
+ list: string[];
178
+ }
179
+
155
180
  export type TokenExpires = {
156
181
  accessExpiresIn: string;
157
182
  refreshExpiresIn: string;
@@ -162,12 +187,6 @@ export type TokenPair = {
162
187
  refresh_token: string;
163
188
  }
164
189
 
165
- export type UserCredentials = {
166
- username: string;
167
- password: string;
168
- client_id?: string;
169
- }
170
-
171
190
  export type UserSession = {
172
191
  company: AccessCompany;
173
192
  roles: AccessRole[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mitreka/coreflow-types",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "CoreFlow Types Definition",
5
5
  "author": {
6
6
  "name": "Riyan Widiyanto",
package/resource.ts CHANGED
@@ -1,12 +1,22 @@
1
+ export type PageMetaData = {
2
+ page: number;
3
+ limit: number;
4
+ total: number;
5
+ total_pages: number;
6
+ }
7
+
1
8
  export type ResourceCollection<T> = {
2
9
  message: string;
3
10
  data: T[];
4
- meta: {
5
- page: number;
6
- limit: number;
7
- total: number;
8
- total_pages: number;
9
- };
11
+ meta: PageMetaData;
12
+ }
13
+
14
+ export type ResourceListRequest = {
15
+ id: string;
16
+ order: string;
17
+ page: number;
18
+ limit: number;
19
+ q: string;
10
20
  }
11
21
 
12
22
  export type ResourceEntity<T> = {