win-portal-auth-sdk 1.4.1 → 1.5.1
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/dist/client/api/auth.api.d.ts +14 -3
- package/dist/client/api/auth.api.d.ts.map +1 -1
- package/dist/client/api/auth.api.js +12 -4
- package/dist/client/api/index.d.ts +1 -0
- package/dist/client/api/index.d.ts.map +1 -1
- package/dist/client/api/index.js +3 -1
- package/dist/client/api/todo.api.d.ts +31 -0
- package/dist/client/api/todo.api.d.ts.map +1 -0
- package/dist/client/api/todo.api.js +36 -0
- package/dist/client/auth-client.d.ts +18 -6
- package/dist/client/auth-client.d.ts.map +1 -1
- package/dist/client/auth-client.js +71 -44
- package/dist/middleware/express.middleware.d.ts +1 -1
- package/dist/middleware/express.middleware.d.ts.map +1 -1
- package/dist/middleware/express.middleware.js +19 -92
- package/dist/middleware/nestjs.guard.d.ts.map +1 -1
- package/dist/middleware/nestjs.guard.js +24 -114
- package/dist/middleware/shared/auth-service.d.ts +36 -0
- package/dist/middleware/shared/auth-service.d.ts.map +1 -0
- package/dist/middleware/shared/auth-service.js +98 -0
- package/dist/middleware/shared/index.d.ts +7 -0
- package/dist/middleware/shared/index.d.ts.map +1 -0
- package/dist/middleware/shared/index.js +22 -0
- package/dist/middleware/shared/token-extractor.d.ts +15 -0
- package/dist/middleware/shared/token-extractor.d.ts.map +1 -0
- package/dist/middleware/shared/token-extractor.js +47 -0
- package/dist/middleware/shared/user-cache.d.ts +51 -0
- package/dist/middleware/shared/user-cache.d.ts.map +1 -0
- package/dist/middleware/shared/user-cache.js +81 -0
- package/dist/types/event-log.types.d.ts +103 -1
- package/dist/types/event-log.types.d.ts.map +1 -1
- package/dist/types/event-log.types.js +5 -1
- package/dist/types/index.d.ts +31 -29
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +9 -3
- package/dist/types/system-config.types.d.ts +2 -5
- package/dist/types/system-config.types.d.ts.map +1 -1
- package/dist/types/todo.types.d.ts +162 -0
- package/dist/types/todo.types.d.ts.map +1 -0
- package/dist/types/todo.types.js +18 -0
- package/package.json +1 -1
- package/dist/types/event-log.interfaces.d.ts +0 -108
- package/dist/types/event-log.interfaces.d.ts.map +0 -1
- package/dist/types/event-log.interfaces.js +0 -7
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - TOTP (Two-Factor Authentication)
|
|
10
10
|
*/
|
|
11
11
|
import { AuthClient } from '../auth-client';
|
|
12
|
-
import { AuthSession, User
|
|
12
|
+
import { AuthSession, User } from '../../types';
|
|
13
13
|
export declare class AuthAPI {
|
|
14
14
|
private client;
|
|
15
15
|
constructor(client: AuthClient);
|
|
@@ -29,9 +29,20 @@ export declare class AuthAPI {
|
|
|
29
29
|
profile(): Promise<User>;
|
|
30
30
|
/**
|
|
31
31
|
* Refresh access token using session (for web portal)
|
|
32
|
-
* Uses current
|
|
32
|
+
* Uses current access token from Authorization header to refresh
|
|
33
|
+
* This endpoint doesn't require refresh_token - it uses the session from the current token
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* // Token is already set in client
|
|
38
|
+
* authClient.setToken(accessToken);
|
|
39
|
+
* const result = await authClient.auth.refreshSession();
|
|
40
|
+
* authClient.setToken(result.token);
|
|
41
|
+
* ```
|
|
33
42
|
*/
|
|
34
|
-
|
|
43
|
+
refreshSession(): Promise<{
|
|
44
|
+
token: string;
|
|
45
|
+
}>;
|
|
35
46
|
/**
|
|
36
47
|
* Refresh access token using refresh token (for mobile apps and long-lived sessions)
|
|
37
48
|
* This endpoint uses refresh token flow and supports token rotation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.api.d.ts","sourceRoot":"","sources":["../../../src/client/api/auth.api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAEL,WAAW,EACX,IAAI,
|
|
1
|
+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EAAE,OAAO,CAAC;QACpB,WAAW,EAAE,OAAO,CAAC;QACrB,sBAAsB,EAAE,MAAM,CAAC;QAC/B,YAAY,CAAC,EAAE,IAAI,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IAeF;;OAEG;IACG,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IAK/D;;;OAGG;IACG,eAAe,CACnB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,WAAW,CAAC;IASvB;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IAKnD;;;OAGG;IACG,yBAAyB,IAAI,OAAO,CAAC;QACzC,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CASH"}
|
|
@@ -39,11 +39,19 @@ class AuthAPI {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Refresh access token using session (for web portal)
|
|
42
|
-
* Uses current
|
|
42
|
+
* Uses current access token from Authorization header to refresh
|
|
43
|
+
* This endpoint doesn't require refresh_token - it uses the session from the current token
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* // Token is already set in client
|
|
48
|
+
* authClient.setToken(accessToken);
|
|
49
|
+
* const result = await authClient.auth.refreshSession();
|
|
50
|
+
* authClient.setToken(result.token);
|
|
51
|
+
* ```
|
|
43
52
|
*/
|
|
44
|
-
async
|
|
45
|
-
const
|
|
46
|
-
const response = await this.client.post('/auth/refresh', payload);
|
|
53
|
+
async refreshSession() {
|
|
54
|
+
const response = await this.client.post('/auth/refresh');
|
|
47
55
|
return response.data.data;
|
|
48
56
|
}
|
|
49
57
|
/**
|
|
@@ -15,4 +15,5 @@ export type { OAuthConfig, AuthorizationUrlOptions, TokenResponse, UserInfo, Dis
|
|
|
15
15
|
export { generatePKCE, generateState } from './oauth.api';
|
|
16
16
|
export { LineAPI } from './line.api';
|
|
17
17
|
export type { SendTextMessageRequest, SendStickerRequest, SendImageRequest, SendMessagesRequest, SendNotificationRequest, LineMessagePayload, LineMessageResponse, LineMessagingAvailabilityResponse, } from './line.api';
|
|
18
|
+
export { TodoAPI } from './todo.api';
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/api/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,YAAY,EAAE,WAAW,EAAE,uBAAuB,EAAE,aAAa,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACpH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,YAAY,EACV,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,iCAAiC,GAClC,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/api/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,YAAY,EAAE,WAAW,EAAE,uBAAuB,EAAE,aAAa,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACpH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,YAAY,EACV,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,iCAAiC,GAClC,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/client/api/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Central export point for all API namespaces
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.LineAPI = exports.generateState = exports.generatePKCE = exports.OAuthAPI = exports.LicenseAPI = exports.EventLogApi = exports.FilesAPI = exports.SystemConfigAPI = exports.HealthAPI = exports.AuthAPI = void 0;
|
|
8
|
+
exports.TodoAPI = exports.LineAPI = exports.generateState = exports.generatePKCE = exports.OAuthAPI = exports.LicenseAPI = exports.EventLogApi = exports.FilesAPI = exports.SystemConfigAPI = exports.HealthAPI = exports.AuthAPI = void 0;
|
|
9
9
|
var auth_api_1 = require("./auth.api");
|
|
10
10
|
Object.defineProperty(exports, "AuthAPI", { enumerable: true, get: function () { return auth_api_1.AuthAPI; } });
|
|
11
11
|
var health_api_1 = require("./health.api");
|
|
@@ -25,3 +25,5 @@ Object.defineProperty(exports, "generatePKCE", { enumerable: true, get: function
|
|
|
25
25
|
Object.defineProperty(exports, "generateState", { enumerable: true, get: function () { return oauth_api_2.generateState; } });
|
|
26
26
|
var line_api_1 = require("./line.api");
|
|
27
27
|
Object.defineProperty(exports, "LineAPI", { enumerable: true, get: function () { return line_api_1.LineAPI; } });
|
|
28
|
+
var todo_api_1 = require("./todo.api");
|
|
29
|
+
Object.defineProperty(exports, "TodoAPI", { enumerable: true, get: function () { return todo_api_1.TodoAPI; } });
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Todo API Client
|
|
3
|
+
*
|
|
4
|
+
* Handles todo operations:
|
|
5
|
+
* - Create todo
|
|
6
|
+
*/
|
|
7
|
+
import { AuthClient } from '../auth-client';
|
|
8
|
+
import { CreateTodoRequest, Todo } from '../../types';
|
|
9
|
+
export declare class TodoAPI {
|
|
10
|
+
private readonly client;
|
|
11
|
+
constructor(client: AuthClient);
|
|
12
|
+
/**
|
|
13
|
+
* Create a new todo
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const todo = await authClient.todo.create({
|
|
18
|
+
* title: "ซื้อของใช้ในบ้าน",
|
|
19
|
+
* priority: TodoPriority.NORMAL,
|
|
20
|
+
* user_id: "user123e4567-e89b-12d3-a456-426614174000",
|
|
21
|
+
* description: "ซื้อน้ำยาล้างจาน, กระดาษทิชชู่, แชมพู",
|
|
22
|
+
* due_date: new Date("2024-01-20T17:00:00Z"),
|
|
23
|
+
* category: "shopping",
|
|
24
|
+
* labels: ["บ้าน", "จำเป็น"],
|
|
25
|
+
* is_send_notification: true
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
create(todoData: CreateTodoRequest): Promise<Todo>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=todo.api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todo.api.d.ts","sourceRoot":"","sources":["../../../src/client/api/todo.api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAe,MAAM,aAAa,CAAC;AAEnE,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAE/C;;;;;;;;;;;;;;;;OAgBG;IACG,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAIzD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Todo API Client
|
|
4
|
+
*
|
|
5
|
+
* Handles todo operations:
|
|
6
|
+
* - Create todo
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.TodoAPI = void 0;
|
|
10
|
+
class TodoAPI {
|
|
11
|
+
constructor(client) {
|
|
12
|
+
this.client = client;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create a new todo
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const todo = await authClient.todo.create({
|
|
20
|
+
* title: "ซื้อของใช้ในบ้าน",
|
|
21
|
+
* priority: TodoPriority.NORMAL,
|
|
22
|
+
* user_id: "user123e4567-e89b-12d3-a456-426614174000",
|
|
23
|
+
* description: "ซื้อน้ำยาล้างจาน, กระดาษทิชชู่, แชมพู",
|
|
24
|
+
* due_date: new Date("2024-01-20T17:00:00Z"),
|
|
25
|
+
* category: "shopping",
|
|
26
|
+
* labels: ["บ้าน", "จำเป็น"],
|
|
27
|
+
* is_send_notification: true
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
async create(todoData) {
|
|
32
|
+
const response = await this.client.post('/todos', todoData);
|
|
33
|
+
return response.data.data;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.TodoAPI = TodoAPI;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
9
9
|
import { AuthSdkConfig } from '../types';
|
|
10
|
-
import { AuthAPI, HealthAPI, SystemConfigAPI, FilesAPI, EventLogApi, LicenseAPI, OAuthAPI, OAuthConfig, LineAPI } from './api';
|
|
10
|
+
import { AuthAPI, HealthAPI, SystemConfigAPI, FilesAPI, EventLogApi, LicenseAPI, OAuthAPI, OAuthConfig, LineAPI, TodoAPI } from './api';
|
|
11
11
|
export interface RefreshTokenCallbacks {
|
|
12
12
|
/**
|
|
13
13
|
* Get refresh token from storage
|
|
@@ -52,11 +52,15 @@ export interface AutomaticRefreshOptions {
|
|
|
52
52
|
/**
|
|
53
53
|
* Storage key for refresh token (SDK will manage localStorage automatically)
|
|
54
54
|
* If provided, SDK will handle localStorage operations automatically
|
|
55
|
+
*
|
|
56
|
+
* Note: If login doesn't return refresh_token, SDK will use session-based refresh instead
|
|
55
57
|
*/
|
|
56
58
|
refreshTokenKey?: string;
|
|
57
59
|
/**
|
|
58
60
|
* Custom callbacks (use if you need custom storage or want to override default behavior)
|
|
59
61
|
* If refreshTokenKey is provided, these will be ignored
|
|
62
|
+
*
|
|
63
|
+
* Note: If not provided and no refreshTokenKey, SDK will use session-based refresh (no refresh token needed)
|
|
60
64
|
*/
|
|
61
65
|
callbacks?: RefreshTokenCallbacks;
|
|
62
66
|
/**
|
|
@@ -131,6 +135,7 @@ export declare class AuthClient {
|
|
|
131
135
|
readonly eventLog: EventLogApi;
|
|
132
136
|
readonly license: LicenseAPI;
|
|
133
137
|
readonly line: LineAPI;
|
|
138
|
+
readonly todo: TodoAPI;
|
|
134
139
|
oauth?: OAuthAPI;
|
|
135
140
|
constructor(config: AuthSdkConfig);
|
|
136
141
|
/**
|
|
@@ -219,17 +224,23 @@ export declare class AuthClient {
|
|
|
219
224
|
* Enable automatic token refresh
|
|
220
225
|
* Call this after user is authenticated to enable automatic refresh
|
|
221
226
|
*
|
|
222
|
-
* @param options - Options for automatic refresh
|
|
227
|
+
* @param options - Options for automatic refresh (optional - SDK will use session-based refresh if not provided)
|
|
223
228
|
*
|
|
224
229
|
* @example
|
|
225
230
|
* ```typescript
|
|
226
|
-
* //
|
|
231
|
+
* // Option 1: Session-based refresh (default - no refresh token needed)
|
|
232
|
+
* // Works when login only returns access_token
|
|
233
|
+
* await authClient.enableAutomaticRefresh({
|
|
234
|
+
* onRefreshFailure: () => window.location.href = '/login'
|
|
235
|
+
* });
|
|
236
|
+
*
|
|
237
|
+
* // Option 2: With refresh token (if login returns refresh_token)
|
|
227
238
|
* await authClient.enableAutomaticRefresh({
|
|
228
239
|
* refreshTokenKey: 'refresh_token',
|
|
229
240
|
* onRefreshFailure: () => window.location.href = '/login'
|
|
230
241
|
* });
|
|
231
242
|
*
|
|
232
|
-
* //
|
|
243
|
+
* // Option 3: Custom callbacks
|
|
233
244
|
* await authClient.enableAutomaticRefresh({
|
|
234
245
|
* callbacks: {
|
|
235
246
|
* getRefreshToken: () => customStorage.get('refresh_token'),
|
|
@@ -240,7 +251,7 @@ export declare class AuthClient {
|
|
|
240
251
|
* });
|
|
241
252
|
* ```
|
|
242
253
|
*/
|
|
243
|
-
enableAutomaticRefresh(options
|
|
254
|
+
enableAutomaticRefresh(options?: AutomaticRefreshOptions): Promise<void>;
|
|
244
255
|
/**
|
|
245
256
|
* Disable automatic token refresh
|
|
246
257
|
*/
|
|
@@ -259,6 +270,7 @@ export declare class AuthClient {
|
|
|
259
270
|
private performRefresh;
|
|
260
271
|
/**
|
|
261
272
|
* Execute refresh token request
|
|
273
|
+
* Supports both session-based refresh (no refresh token needed) and refresh token flow
|
|
262
274
|
*/
|
|
263
275
|
private doRefresh;
|
|
264
276
|
/**
|
|
@@ -314,7 +326,7 @@ export declare class AuthClient {
|
|
|
314
326
|
*
|
|
315
327
|
* Note: ใช้ token expiration time เป็นตัวประมาณ session expiration
|
|
316
328
|
* เพราะเราไม่มี session creation time หรือ last activity time ใน SDK
|
|
317
|
-
* Token expiration จะถูก refresh อัตโนมัติเมื่อมีการใช้งาน
|
|
329
|
+
* Token expiration จะถูก refresh อัตโนมัติเมื่อมีการใช้งาน
|
|
318
330
|
*/
|
|
319
331
|
private checkSessionExpiration;
|
|
320
332
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-client.d.ts","sourceRoot":"","sources":["../../src/client/auth-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,aAAa,EAA8B,MAAM,OAAO,CAAC;AAC5G,OAAO,EAAE,aAAa,EAA8C,MAAM,UAAU,CAAC;AACrF,OAAO,EACL,OAAO,EACP,SAAS,EACT,eAAe,EACf,QAAQ,EACR,WAAW,EACX,UAAU,EACV,QAAQ,EACR,WAAW,EACX,OAAO,EACR,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"auth-client.d.ts","sourceRoot":"","sources":["../../src/client/auth-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,aAAa,EAA8B,MAAM,OAAO,CAAC;AAC5G,OAAO,EAAE,aAAa,EAA8C,MAAM,UAAU,CAAC;AACrF,OAAO,EACL,OAAO,EACP,SAAS,EACT,eAAe,EACf,QAAQ,EAC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AEG;YACW,kCAAkC;IAmBhD;;OAEG;IACH,OAAO,CAAC,gCAAgC;IAaxC;;OAEG;IACH,OAAO,CAAC,+BAA+B;IAOvC;;;;;;OAMG;IACH,OAAO,CAAC,sBAAsB;IAkE9B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAe9B;;OAEG;IACG,6BAA6B,IAAI,OAAO,CAAC,IAAI,CAAC;IAMpD;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACG,yBAAyB,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC;IAsDnF;;OAEG;IACH,0BAA0B,IAAI,IAAI;IAyBlC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAkB1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAuB9B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAc/B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAW/B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAmC5B;;OAEG;IACH,OAAO,CAAC,sBAAsB;CA0B/B"}
|
|
@@ -183,6 +183,7 @@ class AuthClient {
|
|
|
183
183
|
this.eventLog = new api_1.EventLogApi(this);
|
|
184
184
|
this.license = new api_1.LicenseAPI(this);
|
|
185
185
|
this.line = new api_1.LineAPI(this);
|
|
186
|
+
this.todo = new api_1.TodoAPI(this);
|
|
186
187
|
}
|
|
187
188
|
/**
|
|
188
189
|
* Initialize OAuth client for OAuth 2.0 flows
|
|
@@ -323,17 +324,23 @@ class AuthClient {
|
|
|
323
324
|
* Enable automatic token refresh
|
|
324
325
|
* Call this after user is authenticated to enable automatic refresh
|
|
325
326
|
*
|
|
326
|
-
* @param options - Options for automatic refresh
|
|
327
|
+
* @param options - Options for automatic refresh (optional - SDK will use session-based refresh if not provided)
|
|
327
328
|
*
|
|
328
329
|
* @example
|
|
329
330
|
* ```typescript
|
|
330
|
-
* //
|
|
331
|
+
* // Option 1: Session-based refresh (default - no refresh token needed)
|
|
332
|
+
* // Works when login only returns access_token
|
|
333
|
+
* await authClient.enableAutomaticRefresh({
|
|
334
|
+
* onRefreshFailure: () => window.location.href = '/login'
|
|
335
|
+
* });
|
|
336
|
+
*
|
|
337
|
+
* // Option 2: With refresh token (if login returns refresh_token)
|
|
331
338
|
* await authClient.enableAutomaticRefresh({
|
|
332
339
|
* refreshTokenKey: 'refresh_token',
|
|
333
340
|
* onRefreshFailure: () => window.location.href = '/login'
|
|
334
341
|
* });
|
|
335
342
|
*
|
|
336
|
-
* //
|
|
343
|
+
* // Option 3: Custom callbacks
|
|
337
344
|
* await authClient.enableAutomaticRefresh({
|
|
338
345
|
* callbacks: {
|
|
339
346
|
* getRefreshToken: () => customStorage.get('refresh_token'),
|
|
@@ -345,7 +352,16 @@ class AuthClient {
|
|
|
345
352
|
* ```
|
|
346
353
|
*/
|
|
347
354
|
async enableAutomaticRefresh(options) {
|
|
348
|
-
|
|
355
|
+
// If no options provided, use session-based refresh (no refresh token needed)
|
|
356
|
+
if (!options) {
|
|
357
|
+
this.refreshTokenCallbacks = {
|
|
358
|
+
getRefreshToken: () => null, // No refresh token available
|
|
359
|
+
setRefreshToken: () => { }, // No-op
|
|
360
|
+
clearRefreshToken: () => { }, // No-op
|
|
361
|
+
onRefreshFailure: undefined,
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
else if (options.refreshTokenKey) {
|
|
349
365
|
// Use localStorage with provided key
|
|
350
366
|
const key = options.refreshTokenKey;
|
|
351
367
|
this.refreshTokenCallbacks = {
|
|
@@ -375,7 +391,13 @@ class AuthClient {
|
|
|
375
391
|
};
|
|
376
392
|
}
|
|
377
393
|
else {
|
|
378
|
-
|
|
394
|
+
// No refresh token callbacks - use session-based refresh
|
|
395
|
+
this.refreshTokenCallbacks = {
|
|
396
|
+
getRefreshToken: () => null,
|
|
397
|
+
setRefreshToken: () => { },
|
|
398
|
+
clearRefreshToken: () => { },
|
|
399
|
+
onRefreshFailure: options.onRefreshFailure,
|
|
400
|
+
};
|
|
379
401
|
}
|
|
380
402
|
await this.loadJwtConfig();
|
|
381
403
|
}
|
|
@@ -437,48 +459,54 @@ class AuthClient {
|
|
|
437
459
|
}
|
|
438
460
|
/**
|
|
439
461
|
* Execute refresh token request
|
|
462
|
+
* Supports both session-based refresh (no refresh token needed) and refresh token flow
|
|
440
463
|
*/
|
|
441
464
|
async doRefresh() {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
465
|
+
// Strategy 1: Try session-based refresh first (works without refresh token)
|
|
466
|
+
// This is the default for web portal login that only returns access_token
|
|
467
|
+
if (this.token) {
|
|
468
|
+
try {
|
|
469
|
+
logger_1.logger.debug('Attempting session-based refresh...');
|
|
470
|
+
const result = await this.auth.refreshSession();
|
|
471
|
+
const newAccessToken = result.token;
|
|
472
|
+
// Update token in client
|
|
473
|
+
this.token = newAccessToken;
|
|
474
|
+
logger_1.logger.debug('Token refreshed successfully (session-based)');
|
|
475
|
+
return newAccessToken;
|
|
476
|
+
}
|
|
477
|
+
catch (error) {
|
|
478
|
+
// If session-based refresh fails (e.g., session expired), try refresh token flow
|
|
479
|
+
logger_1.logger.debug('Session-based refresh failed, trying refresh token flow...', {
|
|
480
|
+
status: error.response?.status,
|
|
481
|
+
message: error.message,
|
|
482
|
+
});
|
|
458
483
|
}
|
|
459
|
-
logger_1.logger.debug('Token refreshed successfully');
|
|
460
|
-
return newAccessToken;
|
|
461
484
|
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
485
|
+
// Strategy 2: Use refresh token flow (for mobile apps or when refresh token is available)
|
|
486
|
+
if (this.refreshTokenCallbacks) {
|
|
487
|
+
const refreshToken = await this.refreshTokenCallbacks.getRefreshToken();
|
|
488
|
+
if (refreshToken) {
|
|
465
489
|
try {
|
|
466
|
-
|
|
467
|
-
const
|
|
490
|
+
// Try refreshWithToken first (for mobile apps with refresh token)
|
|
491
|
+
const session = await this.auth.refreshWithToken(refreshToken);
|
|
492
|
+
const newAccessToken = session.access_token;
|
|
493
|
+
// Update token in client
|
|
468
494
|
this.token = newAccessToken;
|
|
469
|
-
if
|
|
470
|
-
|
|
495
|
+
// Save new refresh token if rotated
|
|
496
|
+
if (session.refresh_token) {
|
|
497
|
+
await this.refreshTokenCallbacks.setRefreshToken(session.refresh_token);
|
|
471
498
|
}
|
|
472
|
-
logger_1.logger.debug('Token refreshed successfully (
|
|
499
|
+
logger_1.logger.debug('Token refreshed successfully (refresh token flow)');
|
|
473
500
|
return newAccessToken;
|
|
474
501
|
}
|
|
475
|
-
catch (
|
|
476
|
-
logger_1.logger.error('
|
|
477
|
-
throw
|
|
502
|
+
catch (error) {
|
|
503
|
+
logger_1.logger.error('Refresh token flow failed:', error);
|
|
504
|
+
throw error;
|
|
478
505
|
}
|
|
479
506
|
}
|
|
480
|
-
throw error;
|
|
481
507
|
}
|
|
508
|
+
// If both strategies fail
|
|
509
|
+
throw new Error('No refresh method available: token expired and no refresh token configured');
|
|
482
510
|
}
|
|
483
511
|
/**
|
|
484
512
|
* Reload JWT config (for when config changes)
|
|
@@ -548,10 +576,10 @@ class AuthClient {
|
|
|
548
576
|
this.sessionManagementConfig = config;
|
|
549
577
|
logger_1.logger.debug('Session management config loaded:', {
|
|
550
578
|
inactivityEnabled: config.inactivity.enabled,
|
|
551
|
-
|
|
579
|
+
inactivityTimeoutMinutes: config.inactivity.timeout_minutes,
|
|
552
580
|
inactivityWarningMinutes: config.inactivity.warning_minutes,
|
|
553
581
|
lifetimeEnabled: config.lifetime.enabled,
|
|
554
|
-
|
|
582
|
+
lifetimeMaxDays: config.lifetime.enabled ? config.lifetime.max_lifetime_days : 'N/A',
|
|
555
583
|
});
|
|
556
584
|
}
|
|
557
585
|
catch (error) {
|
|
@@ -588,7 +616,7 @@ class AuthClient {
|
|
|
588
616
|
*
|
|
589
617
|
* Note: ใช้ token expiration time เป็นตัวประมาณ session expiration
|
|
590
618
|
* เพราะเราไม่มี session creation time หรือ last activity time ใน SDK
|
|
591
|
-
* Token expiration จะถูก refresh อัตโนมัติเมื่อมีการใช้งาน
|
|
619
|
+
* Token expiration จะถูก refresh อัตโนมัติเมื่อมีการใช้งาน
|
|
592
620
|
*/
|
|
593
621
|
checkSessionExpiration() {
|
|
594
622
|
if (!this.token || !this.sessionExpirationCallbacks || !this.sessionManagementConfig) {
|
|
@@ -606,7 +634,7 @@ class AuthClient {
|
|
|
606
634
|
return;
|
|
607
635
|
}
|
|
608
636
|
// ใช้ token expiration time เป็นตัวประมาณ session expiration
|
|
609
|
-
// เพราะ token จะถูก refresh อัตโนมัติเมื่อมีการใช้งาน
|
|
637
|
+
// เพราะ token จะถูก refresh อัตโนมัติเมื่อมีการใช้งาน
|
|
610
638
|
// ดังนั้น token expiration time จะสะท้อน session expiration time ได้ดีพอสมควร
|
|
611
639
|
// ตรวจสอบว่า session expiration monitoring เปิดใช้งานหรือไม่
|
|
612
640
|
const inactivityEnabled = this.sessionManagementConfig.inactivity.enabled;
|
|
@@ -622,10 +650,10 @@ class AuthClient {
|
|
|
622
650
|
}
|
|
623
651
|
// คำนวณ session expiration times จาก config
|
|
624
652
|
const inactivityTimeoutMinutes = inactivityEnabled
|
|
625
|
-
?
|
|
653
|
+
? this.sessionManagementConfig.inactivity.timeout_minutes
|
|
626
654
|
: null;
|
|
627
|
-
const lifetimeMaxMinutes = lifetimeEnabled
|
|
628
|
-
?
|
|
655
|
+
const lifetimeMaxMinutes = lifetimeEnabled && this.sessionManagementConfig.lifetime.max_lifetime_days
|
|
656
|
+
? this.sessionManagementConfig.lifetime.max_lifetime_days * 24 * 60 // Convert days to minutes
|
|
629
657
|
: null;
|
|
630
658
|
// ใช้ token expiration time เป็นตัวประมาณ session expiration
|
|
631
659
|
// เพราะ token จะถูก refresh อัตโนมัติเมื่อมีการใช้งาน
|
|
@@ -709,8 +737,7 @@ class AuthClient {
|
|
|
709
737
|
}
|
|
710
738
|
else if (this.sessionManagementConfig?.inactivity.enabled) {
|
|
711
739
|
// Use session management config
|
|
712
|
-
this.inactivityTimeoutSeconds =
|
|
713
|
-
(0, token_utils_1.convertDurationToMinutes)(this.sessionManagementConfig.inactivity.timeout_duration, this.sessionManagementConfig.inactivity.timeout_unit) * 60; // Convert to seconds
|
|
740
|
+
this.inactivityTimeoutSeconds = this.sessionManagementConfig.inactivity.timeout_minutes * 60; // Convert minutes to seconds
|
|
714
741
|
}
|
|
715
742
|
else {
|
|
716
743
|
// Default: 30 minutes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express.middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/express.middleware.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"express.middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/express.middleware.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAMxD,OAAO,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,gBAAgB,SAGlC,GAAG,OAAO,GAAG,QAAQ,GAAG,kBA4B5C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,WAAW,CAK7C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG;IACrC,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CASA;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,QAM5C"}
|