@mitreka/coreflow-types 0.0.5 → 0.0.8
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/auth.ts +34 -4
- package/error.ts +30 -0
- package/index.ts +1 -0
- package/package.json +1 -1
package/auth.ts
CHANGED
|
@@ -63,6 +63,11 @@ export type AuthorizationRequest = {
|
|
|
63
63
|
redirect_uri: string;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
export type ClientDetail = {
|
|
67
|
+
name: string;
|
|
68
|
+
description?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
66
71
|
export type IDToken = {
|
|
67
72
|
iss: string;
|
|
68
73
|
aud: string; // Client ID
|
|
@@ -91,14 +96,17 @@ export interface OAuthClientEntity {
|
|
|
91
96
|
expired_at: Date;
|
|
92
97
|
}
|
|
93
98
|
|
|
94
|
-
export interface OAuthGrant {
|
|
99
|
+
export interface OAuthGrant extends OAuthGrantEntity {
|
|
95
100
|
id: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface OAuthGrantEntity {
|
|
96
104
|
client_id: string;
|
|
97
105
|
user_id: string;
|
|
106
|
+
code: string;
|
|
98
107
|
scopes: string;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
granted_at: Date;
|
|
108
|
+
expired_at?: Date;
|
|
109
|
+
granted_at?: Date;
|
|
102
110
|
}
|
|
103
111
|
|
|
104
112
|
export interface OAuthScope extends BaseEntity, OAuthScopeEntity {
|
|
@@ -110,6 +118,27 @@ export interface OAuthScopeEntity {
|
|
|
110
118
|
description?: string;
|
|
111
119
|
}
|
|
112
120
|
|
|
121
|
+
export interface OAuthSession extends OAuthSessionEntity {
|
|
122
|
+
id: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface OAuthSessionEntity {
|
|
126
|
+
user_id: string;
|
|
127
|
+
ip_address: string;
|
|
128
|
+
user_agent: string;
|
|
129
|
+
expires_at?: Date;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export type RedirectUriOptions = {
|
|
133
|
+
client_id: string;
|
|
134
|
+
code_challenge: string;
|
|
135
|
+
code_challenge_method: string;
|
|
136
|
+
redirect_uri: string;
|
|
137
|
+
response_type: AuthResponseType;
|
|
138
|
+
scope: string;
|
|
139
|
+
state?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
113
142
|
export type RefreshToken = {
|
|
114
143
|
jti: string;
|
|
115
144
|
iat: number;
|
|
@@ -136,6 +165,7 @@ export type TokenPair = {
|
|
|
136
165
|
export type UserCredentials = {
|
|
137
166
|
username: string;
|
|
138
167
|
password: string;
|
|
168
|
+
client_id?: string;
|
|
139
169
|
}
|
|
140
170
|
|
|
141
171
|
export type UserSession = {
|
package/error.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class HttpError extends Error {
|
|
2
|
+
public readonly status: number;
|
|
3
|
+
|
|
4
|
+
constructor(status: number, message: string) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = 'HttpError';
|
|
7
|
+
this.status = status;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class BadRequestError extends HttpError {
|
|
12
|
+
constructor(message: string = 'Bad Request') {
|
|
13
|
+
super(400, message);
|
|
14
|
+
this.name = 'BadRequestError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class UnauthorizedError extends HttpError {
|
|
19
|
+
constructor(message = 'Unauthorized') {
|
|
20
|
+
super(401, message);
|
|
21
|
+
this.name = 'UnauthorizedError';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class NotFoundError extends HttpError {
|
|
26
|
+
constructor(message: string = 'Not Found') {
|
|
27
|
+
super(404, message);
|
|
28
|
+
this.name = 'NotFoundError';
|
|
29
|
+
}
|
|
30
|
+
}
|
package/index.ts
CHANGED