win-portal-auth-sdk 1.6.1 → 1.6.2

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.
@@ -1,5 +1,5 @@
1
+ import { SessionManagementConfig, SystemConfig, SystemConfigByCategory } from '../../types';
1
2
  import { AuthClient } from '../auth-client';
2
- import { SystemConfig, SystemConfigByCategory, SecurityJwtConfig, SessionManagementConfig } from '../../types';
3
3
  /**
4
4
  * System Config API
5
5
  * Methods for retrieving system configurations
@@ -12,22 +12,13 @@ export declare class SystemConfigAPI {
12
12
  * GET /system-configs/categories/:category
13
13
  * ดึง configs ตาม category - ส่ง object ที่รวมทุก key เป็น { key1: value1, key2: value2 }
14
14
  */
15
- getByCategory(category: string): Promise<SystemConfigByCategory>;
15
+ private getByCategory;
16
16
  /**
17
17
  * GET /system-configs/categories/:category/:key
18
18
  * ดึง config ตาม category และ key - ส่ง full metadata row
19
19
  */
20
- getByCategoryAndKey(category: string, key: string): Promise<SystemConfig>;
21
- /**
22
- * GET /system-configs/categories/security
23
- * ดึง security configs ทั้งหมด (convenience method)
24
- */
25
- security(): Promise<SystemConfigByCategory>;
26
- /**
27
- * GET /system-configs/categories/security/jwt
28
- * ดึง JWT configuration (convenience method)
29
- */
30
- getSecurityJwtConfig(): Promise<SecurityJwtConfig>;
20
+ private getByCategoryAndKey;
21
+ get(category: string, key?: string): Promise<SystemConfig | SystemConfigByCategory>;
31
22
  /**
32
23
  * GET /system-configs/categories/security/session-management
33
24
  * ดึง Session Management configuration (convenience method)
@@ -1 +1 @@
1
- {"version":3,"file":"system-config.api.d.ts","sourceRoot":"","sources":["../../../src/client/api/system-config.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,iBAAiB,EACjB,uBAAuB,EAExB,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;;OAGG;IACG,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAOtE;;;OAGG;IACG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAK/E;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAIjD;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAKxD;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC,uBAAuB,CAAC;CAS/D"}
1
+ {"version":3,"file":"system-config.api.d.ts","sourceRoot":"","sources":["../../../src/client/api/system-config.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EACvB,YAAY,EACZ,sBAAsB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;;OAGG;YACW,aAAa;IAO3B;;;OAGG;YACW,mBAAmB;IAK3B,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,sBAAsB,CAAC;IAOzF;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC,uBAAuB,CAAC;CAI/D"}
@@ -26,33 +26,19 @@ class SystemConfigAPI {
26
26
  const response = await this.client.get(`/system-configs/categories/${category}/${key}`);
27
27
  return response.data.data;
28
28
  }
29
- /**
30
- * GET /system-configs/categories/security
31
- * ดึง security configs ทั้งหมด (convenience method)
32
- */
33
- async security() {
34
- return this.getByCategory('security');
35
- }
36
- /**
37
- * GET /system-configs/categories/security/jwt
38
- * ดึง JWT configuration (convenience method)
39
- */
40
- async getSecurityJwtConfig() {
41
- const config = await this.getByCategoryAndKey('security', 'jwt');
42
- return config.value;
29
+ async get(category, key) {
30
+ if (key) {
31
+ return await this.getByCategoryAndKey(category, key);
32
+ }
33
+ return await this.getByCategory(category);
43
34
  }
44
35
  /**
45
36
  * GET /system-configs/categories/security/session-management
46
37
  * ดึง Session Management configuration (convenience method)
47
38
  */
48
39
  async getSessionManagement() {
49
- const securityConfigs = await this.security();
50
- // Key ใน database เป็น session_management (snake_case)
51
- const sessionManagement = securityConfigs['session_management'] || securityConfigs['session-management'];
52
- if (!sessionManagement) {
53
- throw new Error('Session management configuration not found');
54
- }
55
- return sessionManagement;
40
+ const securityConfigs = await this.get('security', 'session_management');
41
+ return securityConfigs.value;
56
42
  }
57
43
  }
58
44
  exports.SystemConfigAPI = SystemConfigAPI;
@@ -432,7 +432,7 @@ class AuthClient {
432
432
  */
433
433
  async performJwtConfigLoad() {
434
434
  try {
435
- const config = await this.systemConfig.getSecurityJwtConfig();
435
+ const config = (await this.systemConfig.get('security', 'jwt')).value;
436
436
  this.refreshThresholdMinutes = config.refresh_threshold_minutes;
437
437
  this.automaticRefreshEnabled = config.automatic_refresh ?? true;
438
438
  logger_1.logger.debug(`JWT config loaded: refresh_threshold_minutes=${this.refreshThresholdMinutes} minutes, automatic_refresh=${this.automaticRefreshEnabled}`);
@@ -69,8 +69,10 @@ export interface WebhookLogDetail {
69
69
  status: 'pending' | 'success' | 'failed' | 'retrying';
70
70
  /** HTTP status code ที่ได้รับกลับมา */
71
71
  http_status?: number;
72
- /** Headers ที่ส่งไปกับ request */
72
+ /** HTTP request headers จาก external ที่เรียกเข้ามา */
73
73
  request_headers?: Record<string, string>;
74
+ /** Headers ที่จะใช้ส่งไปกับ axios (จาก DTO หรือ webhook config) */
75
+ headers?: Record<string, string>;
74
76
  /** Headers ที่ได้รับกลับมาจาก response */
75
77
  response_headers?: Record<string, string>;
76
78
  /** Response body ที่ได้รับกลับมา */
@@ -1 +1 @@
1
- {"version":3,"file":"webhook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;IAEtD,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,uDAAuD;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEzC,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC,0CAA0C;IAC1C,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE1C,oCAAoC;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;IAEpB,iCAAiC;IACjC,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAE9B,2CAA2C;IAC3C,YAAY,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAE7B,gDAAgD;IAChD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,kBAAkB;IAClB,UAAU,EAAE,IAAI,GAAG,MAAM,CAAC;IAE1B,yBAAyB;IACzB,UAAU,EAAE,IAAI,GAAG,MAAM,CAAC;CAC3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "win-portal-auth-sdk",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "Shared authentication SDK for Win Portal applications with JWT and OAuth support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",