@etsoo/appscript 1.3.66 → 1.3.67
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/__tests__/app/CoreApp.ts +7 -0
- package/lib/cjs/app/CoreApp.d.ts +6 -0
- package/lib/cjs/app/CoreApp.js +16 -0
- package/lib/cjs/app/IApp.d.ts +6 -0
- package/lib/mjs/app/CoreApp.d.ts +6 -0
- package/lib/mjs/app/CoreApp.js +16 -0
- package/lib/mjs/app/IApp.d.ts +6 -0
- package/package.json +8 -8
- package/src/app/CoreApp.ts +18 -0
- package/src/app/IApp.ts +10 -0
package/__tests__/app/CoreApp.ts
CHANGED
|
@@ -192,6 +192,13 @@ test('Tests for initCallUpdateLocal', () => {
|
|
|
192
192
|
expect(passphrase).not.toBeNull();
|
|
193
193
|
});
|
|
194
194
|
|
|
195
|
+
test('Tests for formatFullName', () => {
|
|
196
|
+
expect(app.formatFullName('亿速', null)).toBe('亿速');
|
|
197
|
+
expect(app.formatFullName(null, null)).toBe('');
|
|
198
|
+
expect(app.formatFullName('亿速', '思维')).toBe('亿速思维');
|
|
199
|
+
expect(app.formatFullName('Xiao', 'Garry')).toBe('Garry Xiao');
|
|
200
|
+
});
|
|
201
|
+
|
|
195
202
|
test('Tests for getRoles', () => {
|
|
196
203
|
var roles = app.getRoles(UserRole.User | UserRole.Manager | UserRole.Admin);
|
|
197
204
|
expect(roles.length).toBe(3);
|
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -322,6 +322,12 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
322
322
|
* @param silent Silent without any popups
|
|
323
323
|
*/
|
|
324
324
|
doRefreshTokenResult(result: RefreshTokenResult, initCallCallback?: (result: boolean) => void, silent?: boolean): void;
|
|
325
|
+
/**
|
|
326
|
+
* Format as full name
|
|
327
|
+
* @param familyName Family name
|
|
328
|
+
* @param givenName Given name
|
|
329
|
+
*/
|
|
330
|
+
formatFullName(familyName: string | undefined | null, givenName: string | undefined | null): string;
|
|
325
331
|
/**
|
|
326
332
|
* Format refresh token result
|
|
327
333
|
* @param result Refresh token result
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -785,6 +785,22 @@ class CoreApp {
|
|
|
785
785
|
this.refreshTokenFailed();
|
|
786
786
|
});
|
|
787
787
|
}
|
|
788
|
+
/**
|
|
789
|
+
* Format as full name
|
|
790
|
+
* @param familyName Family name
|
|
791
|
+
* @param givenName Given name
|
|
792
|
+
*/
|
|
793
|
+
formatFullName(familyName, givenName) {
|
|
794
|
+
if (!familyName)
|
|
795
|
+
return givenName !== null && givenName !== void 0 ? givenName : '';
|
|
796
|
+
if (!givenName)
|
|
797
|
+
return familyName !== null && familyName !== void 0 ? familyName : '';
|
|
798
|
+
const wf = givenName + ' ' + familyName;
|
|
799
|
+
if (wf.containChinese() || wf.containJapanese() || wf.containKorean()) {
|
|
800
|
+
return familyName + givenName;
|
|
801
|
+
}
|
|
802
|
+
return wf;
|
|
803
|
+
}
|
|
788
804
|
/**
|
|
789
805
|
* Format refresh token result
|
|
790
806
|
* @param result Refresh token result
|
package/lib/cjs/app/IApp.d.ts
CHANGED
|
@@ -252,6 +252,12 @@ export interface IApp {
|
|
|
252
252
|
* @param silent Silent without any popups
|
|
253
253
|
*/
|
|
254
254
|
doRefreshTokenResult(result: RefreshTokenResult, initCallCallback?: (result: boolean) => void, silent?: boolean): void;
|
|
255
|
+
/**
|
|
256
|
+
* Format as full name
|
|
257
|
+
* @param familyName Family name
|
|
258
|
+
* @param givenName Given name
|
|
259
|
+
*/
|
|
260
|
+
formatFullName(familyName: string | undefined | null, givenName: string | undefined | null): string;
|
|
255
261
|
/**
|
|
256
262
|
* Format refresh token result
|
|
257
263
|
* @param result Refresh token result
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -322,6 +322,12 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
322
322
|
* @param silent Silent without any popups
|
|
323
323
|
*/
|
|
324
324
|
doRefreshTokenResult(result: RefreshTokenResult, initCallCallback?: (result: boolean) => void, silent?: boolean): void;
|
|
325
|
+
/**
|
|
326
|
+
* Format as full name
|
|
327
|
+
* @param familyName Family name
|
|
328
|
+
* @param givenName Given name
|
|
329
|
+
*/
|
|
330
|
+
formatFullName(familyName: string | undefined | null, givenName: string | undefined | null): string;
|
|
325
331
|
/**
|
|
326
332
|
* Format refresh token result
|
|
327
333
|
* @param result Refresh token result
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -782,6 +782,22 @@ export class CoreApp {
|
|
|
782
782
|
this.refreshTokenFailed();
|
|
783
783
|
});
|
|
784
784
|
}
|
|
785
|
+
/**
|
|
786
|
+
* Format as full name
|
|
787
|
+
* @param familyName Family name
|
|
788
|
+
* @param givenName Given name
|
|
789
|
+
*/
|
|
790
|
+
formatFullName(familyName, givenName) {
|
|
791
|
+
if (!familyName)
|
|
792
|
+
return givenName !== null && givenName !== void 0 ? givenName : '';
|
|
793
|
+
if (!givenName)
|
|
794
|
+
return familyName !== null && familyName !== void 0 ? familyName : '';
|
|
795
|
+
const wf = givenName + ' ' + familyName;
|
|
796
|
+
if (wf.containChinese() || wf.containJapanese() || wf.containKorean()) {
|
|
797
|
+
return familyName + givenName;
|
|
798
|
+
}
|
|
799
|
+
return wf;
|
|
800
|
+
}
|
|
785
801
|
/**
|
|
786
802
|
* Format refresh token result
|
|
787
803
|
* @param result Refresh token result
|
package/lib/mjs/app/IApp.d.ts
CHANGED
|
@@ -252,6 +252,12 @@ export interface IApp {
|
|
|
252
252
|
* @param silent Silent without any popups
|
|
253
253
|
*/
|
|
254
254
|
doRefreshTokenResult(result: RefreshTokenResult, initCallCallback?: (result: boolean) => void, silent?: boolean): void;
|
|
255
|
+
/**
|
|
256
|
+
* Format as full name
|
|
257
|
+
* @param familyName Family name
|
|
258
|
+
* @param givenName Given name
|
|
259
|
+
*/
|
|
260
|
+
formatFullName(familyName: string | undefined | null, givenName: string | undefined | null): string;
|
|
255
261
|
/**
|
|
256
262
|
* Format refresh token result
|
|
257
263
|
* @param result Refresh token result
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/appscript",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.67",
|
|
4
4
|
"description": "Applications shared TypeScript framework",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -52,18 +52,18 @@
|
|
|
52
52
|
},
|
|
53
53
|
"homepage": "https://github.com/ETSOO/AppScript#readme",
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@etsoo/notificationbase": "^1.1.
|
|
56
|
-
"@etsoo/restclient": "^1.0.
|
|
57
|
-
"@etsoo/shared": "^1.1.
|
|
55
|
+
"@etsoo/notificationbase": "^1.1.24",
|
|
56
|
+
"@etsoo/restclient": "^1.0.85",
|
|
57
|
+
"@etsoo/shared": "^1.1.89",
|
|
58
58
|
"@types/crypto-js": "^4.1.1",
|
|
59
59
|
"crypto-js": "^4.1.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@babel/cli": "^7.
|
|
63
|
-
"@babel/core": "^7.
|
|
64
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
62
|
+
"@babel/cli": "^7.21.0",
|
|
63
|
+
"@babel/core": "^7.21.0",
|
|
64
|
+
"@babel/plugin-transform-runtime": "^7.21.0",
|
|
65
65
|
"@babel/preset-env": "^7.20.2",
|
|
66
|
-
"@babel/runtime-corejs3": "^7.
|
|
66
|
+
"@babel/runtime-corejs3": "^7.21.0",
|
|
67
67
|
"@types/jest": "^29.4.0",
|
|
68
68
|
"jest": "^29.4.3",
|
|
69
69
|
"jest-environment-jsdom": "^29.4.3",
|
package/src/app/CoreApp.ts
CHANGED
|
@@ -1104,6 +1104,24 @@ export abstract class CoreApp<
|
|
|
1104
1104
|
});
|
|
1105
1105
|
}
|
|
1106
1106
|
|
|
1107
|
+
/**
|
|
1108
|
+
* Format as full name
|
|
1109
|
+
* @param familyName Family name
|
|
1110
|
+
* @param givenName Given name
|
|
1111
|
+
*/
|
|
1112
|
+
formatFullName(
|
|
1113
|
+
familyName: string | undefined | null,
|
|
1114
|
+
givenName: string | undefined | null
|
|
1115
|
+
) {
|
|
1116
|
+
if (!familyName) return givenName ?? '';
|
|
1117
|
+
if (!givenName) return familyName ?? '';
|
|
1118
|
+
const wf = givenName + ' ' + familyName;
|
|
1119
|
+
if (wf.containChinese() || wf.containJapanese() || wf.containKorean()) {
|
|
1120
|
+
return familyName + givenName;
|
|
1121
|
+
}
|
|
1122
|
+
return wf;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1107
1125
|
/**
|
|
1108
1126
|
* Format refresh token result
|
|
1109
1127
|
* @param result Refresh token result
|
package/src/app/IApp.ts
CHANGED
|
@@ -345,6 +345,16 @@ export interface IApp {
|
|
|
345
345
|
silent?: boolean
|
|
346
346
|
): void;
|
|
347
347
|
|
|
348
|
+
/**
|
|
349
|
+
* Format as full name
|
|
350
|
+
* @param familyName Family name
|
|
351
|
+
* @param givenName Given name
|
|
352
|
+
*/
|
|
353
|
+
formatFullName(
|
|
354
|
+
familyName: string | undefined | null,
|
|
355
|
+
givenName: string | undefined | null
|
|
356
|
+
): string;
|
|
357
|
+
|
|
348
358
|
/**
|
|
349
359
|
* Format refresh token result
|
|
350
360
|
* @param result Refresh token result
|