@etsoo/appscript 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.
@@ -147,6 +147,10 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
147
147
  */
148
148
  get isTryingLogin(): boolean;
149
149
  protected set isTryingLogin(value: boolean);
150
+ /**
151
+ * Get core API name
152
+ */
153
+ protected get coreName(): string;
150
154
  /**
151
155
  * Last called with token refresh
152
156
  */
@@ -645,9 +649,8 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
645
649
  /**
646
650
  * Exchange intergration tokens for all APIs
647
651
  * @param coreData Core system's token data to exchange
648
- * @param coreName Core system's name, default is 'core'
649
652
  */
650
- exchangeTokenAll(coreData: ApiRefreshTokenDto, coreName?: string): void;
653
+ exchangeTokenAll(coreData: ApiRefreshTokenDto): void;
651
654
  /**
652
655
  * API refresh token data
653
656
  * @param api Current API
@@ -134,6 +134,12 @@ class CoreApp {
134
134
  set isTryingLogin(value) {
135
135
  this._isTryingLogin = value;
136
136
  }
137
+ /**
138
+ * Get core API name
139
+ */
140
+ get coreName() {
141
+ return "core";
142
+ }
137
143
  /**
138
144
  * Protected constructor
139
145
  * @param settings Settings
@@ -1563,10 +1569,8 @@ class CoreApp {
1563
1569
  /**
1564
1570
  * Exchange intergration tokens for all APIs
1565
1571
  * @param coreData Core system's token data to exchange
1566
- * @param coreName Core system's name, default is 'core'
1567
1572
  */
1568
- exchangeTokenAll(coreData, coreName) {
1569
- coreName ?? (coreName = "core");
1573
+ exchangeTokenAll(coreData) {
1570
1574
  for (const name in this.apis) {
1571
1575
  // Ignore the system API as it has its own logic with refreshToken
1572
1576
  if (name === systemApi)
@@ -1574,7 +1578,7 @@ class CoreApp {
1574
1578
  const data = this.apis[name];
1575
1579
  const api = data[0];
1576
1580
  // The core API
1577
- if (name === coreName) {
1581
+ if (name === this.coreName) {
1578
1582
  api.authorize(coreData.tokenType, coreData.accessToken);
1579
1583
  this.updateApi(data, coreData.refreshToken, coreData.expiresIn);
1580
1584
  }
@@ -36,7 +36,7 @@ export interface IExternalSettings extends ExternalEndpoint {
36
36
  /**
37
37
  * Endpoints to other services
38
38
  */
39
- readonly endpoints?: Record<"core" | "admin" | "finance" | "crm" | "oa" | "agile" | string, ExternalEndpoint>;
39
+ readonly endpoints?: Record<"platform" | "core" | "admin" | "finance" | "crm" | "oa" | "agile" | string, ExternalEndpoint>;
40
40
  }
41
41
  /**
42
42
  * External settings namespace
@@ -342,9 +342,8 @@ export interface IApp {
342
342
  /**
343
343
  * Exchange intergration tokens for all APIs
344
344
  * @param coreData Core system's token data to exchange
345
- * @param coreName Core system's name, default is 'core'
346
345
  */
347
- exchangeTokenAll(coreData: ApiRefreshTokenDto, coreName?: string): void;
346
+ exchangeTokenAll(coreData: ApiRefreshTokenDto): void;
348
347
  /**
349
348
  * Format date to string
350
349
  * @param input Input date
@@ -147,6 +147,10 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
147
147
  */
148
148
  get isTryingLogin(): boolean;
149
149
  protected set isTryingLogin(value: boolean);
150
+ /**
151
+ * Get core API name
152
+ */
153
+ protected get coreName(): string;
150
154
  /**
151
155
  * Last called with token refresh
152
156
  */
@@ -645,9 +649,8 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
645
649
  /**
646
650
  * Exchange intergration tokens for all APIs
647
651
  * @param coreData Core system's token data to exchange
648
- * @param coreName Core system's name, default is 'core'
649
652
  */
650
- exchangeTokenAll(coreData: ApiRefreshTokenDto, coreName?: string): void;
653
+ exchangeTokenAll(coreData: ApiRefreshTokenDto): void;
651
654
  /**
652
655
  * API refresh token data
653
656
  * @param api Current API
@@ -131,6 +131,12 @@ export class CoreApp {
131
131
  set isTryingLogin(value) {
132
132
  this._isTryingLogin = value;
133
133
  }
134
+ /**
135
+ * Get core API name
136
+ */
137
+ get coreName() {
138
+ return "core";
139
+ }
134
140
  /**
135
141
  * Protected constructor
136
142
  * @param settings Settings
@@ -1560,10 +1566,8 @@ export class CoreApp {
1560
1566
  /**
1561
1567
  * Exchange intergration tokens for all APIs
1562
1568
  * @param coreData Core system's token data to exchange
1563
- * @param coreName Core system's name, default is 'core'
1564
1569
  */
1565
- exchangeTokenAll(coreData, coreName) {
1566
- coreName ?? (coreName = "core");
1570
+ exchangeTokenAll(coreData) {
1567
1571
  for (const name in this.apis) {
1568
1572
  // Ignore the system API as it has its own logic with refreshToken
1569
1573
  if (name === systemApi)
@@ -1571,7 +1575,7 @@ export class CoreApp {
1571
1575
  const data = this.apis[name];
1572
1576
  const api = data[0];
1573
1577
  // The core API
1574
- if (name === coreName) {
1578
+ if (name === this.coreName) {
1575
1579
  api.authorize(coreData.tokenType, coreData.accessToken);
1576
1580
  this.updateApi(data, coreData.refreshToken, coreData.expiresIn);
1577
1581
  }
@@ -36,7 +36,7 @@ export interface IExternalSettings extends ExternalEndpoint {
36
36
  /**
37
37
  * Endpoints to other services
38
38
  */
39
- readonly endpoints?: Record<"core" | "admin" | "finance" | "crm" | "oa" | "agile" | string, ExternalEndpoint>;
39
+ readonly endpoints?: Record<"platform" | "core" | "admin" | "finance" | "crm" | "oa" | "agile" | string, ExternalEndpoint>;
40
40
  }
41
41
  /**
42
42
  * External settings namespace
@@ -342,9 +342,8 @@ export interface IApp {
342
342
  /**
343
343
  * Exchange intergration tokens for all APIs
344
344
  * @param coreData Core system's token data to exchange
345
- * @param coreName Core system's name, default is 'core'
346
345
  */
347
- exchangeTokenAll(coreData: ApiRefreshTokenDto, coreName?: string): void;
346
+ exchangeTokenAll(coreData: ApiRefreshTokenDto): void;
348
347
  /**
349
348
  * Format date to string
350
349
  * @param input Input date
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -42,10 +42,10 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@babel/cli": "^7.26.4",
45
- "@babel/core": "^7.26.8",
46
- "@babel/plugin-transform-runtime": "^7.26.8",
47
- "@babel/preset-env": "^7.26.8",
48
- "@babel/runtime-corejs3": "^7.26.7",
45
+ "@babel/core": "^7.26.9",
46
+ "@babel/plugin-transform-runtime": "^7.26.9",
47
+ "@babel/preset-env": "^7.26.9",
48
+ "@babel/runtime-corejs3": "^7.26.9",
49
49
  "@types/crypto-js": "^4.2.2",
50
50
  "@vitejs/plugin-react": "^4.3.4",
51
51
  "jsdom": "^26.0.0",
@@ -293,6 +293,13 @@ export abstract class CoreApp<
293
293
  this._isTryingLogin = value;
294
294
  }
295
295
 
296
+ /**
297
+ * Get core API name
298
+ */
299
+ protected get coreName() {
300
+ return "core";
301
+ }
302
+
296
303
  /**
297
304
  * Last called with token refresh
298
305
  */
@@ -2112,11 +2119,8 @@ export abstract class CoreApp<
2112
2119
  /**
2113
2120
  * Exchange intergration tokens for all APIs
2114
2121
  * @param coreData Core system's token data to exchange
2115
- * @param coreName Core system's name, default is 'core'
2116
2122
  */
2117
- exchangeTokenAll(coreData: ApiRefreshTokenDto, coreName?: string) {
2118
- coreName ??= "core";
2119
-
2123
+ exchangeTokenAll(coreData: ApiRefreshTokenDto) {
2120
2124
  for (const name in this.apis) {
2121
2125
  // Ignore the system API as it has its own logic with refreshToken
2122
2126
  if (name === systemApi) continue;
@@ -2125,7 +2129,7 @@ export abstract class CoreApp<
2125
2129
  const api = data[0];
2126
2130
 
2127
2131
  // The core API
2128
- if (name === coreName) {
2132
+ if (name === this.coreName) {
2129
2133
  api.authorize(coreData.tokenType, coreData.accessToken);
2130
2134
  this.updateApi(data, coreData.refreshToken, coreData.expiresIn);
2131
2135
  } else {
@@ -43,7 +43,7 @@ export interface IExternalSettings extends ExternalEndpoint {
43
43
  * Endpoints to other services
44
44
  */
45
45
  readonly endpoints?: Record<
46
- "core" | "admin" | "finance" | "crm" | "oa" | "agile" | string,
46
+ "platform" | "core" | "admin" | "finance" | "crm" | "oa" | "agile" | string,
47
47
  ExternalEndpoint
48
48
  >;
49
49
  }
package/src/app/IApp.ts CHANGED
@@ -454,9 +454,8 @@ export interface IApp {
454
454
  /**
455
455
  * Exchange intergration tokens for all APIs
456
456
  * @param coreData Core system's token data to exchange
457
- * @param coreName Core system's name, default is 'core'
458
457
  */
459
- exchangeTokenAll(coreData: ApiRefreshTokenDto, coreName?: string): void;
458
+ exchangeTokenAll(coreData: ApiRefreshTokenDto): void;
460
459
 
461
460
  /**
462
461
  * Format date to string