@etsoo/appscript 1.3.65 → 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 +11 -0
- package/lib/cjs/app/CoreApp.js +27 -0
- package/lib/cjs/app/IApp.d.ts +11 -0
- package/lib/mjs/app/CoreApp.d.ts +11 -0
- package/lib/mjs/app/CoreApp.js +27 -0
- package/lib/mjs/app/IApp.d.ts +11 -0
- package/package.json +10 -10
- package/src/app/CoreApp.ts +30 -0
- package/src/app/IApp.ts +16 -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
|
|
@@ -347,6 +353,11 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
347
353
|
getLabels<T extends string>(...keys: T[]): {
|
|
348
354
|
[K in T]: string;
|
|
349
355
|
};
|
|
356
|
+
/**
|
|
357
|
+
* Get bool items
|
|
358
|
+
* @returns Bool items
|
|
359
|
+
*/
|
|
360
|
+
getBools(): ListType1[];
|
|
350
361
|
/**
|
|
351
362
|
* Get cached token
|
|
352
363
|
* @returns Cached token
|
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
|
|
@@ -853,6 +869,17 @@ class CoreApp {
|
|
|
853
869
|
const init = {};
|
|
854
870
|
return keys.reduce((a, v) => { var _a; return ({ ...a, [v]: (_a = this.get(v)) !== null && _a !== void 0 ? _a : '' }); }, init);
|
|
855
871
|
}
|
|
872
|
+
/**
|
|
873
|
+
* Get bool items
|
|
874
|
+
* @returns Bool items
|
|
875
|
+
*/
|
|
876
|
+
getBools() {
|
|
877
|
+
const { no = 'No', yes = 'Yes' } = this.getLabels('no', 'yes');
|
|
878
|
+
return [
|
|
879
|
+
{ id: 'false', label: no },
|
|
880
|
+
{ id: 'true', label: yes }
|
|
881
|
+
];
|
|
882
|
+
}
|
|
856
883
|
/**
|
|
857
884
|
* Get cached token
|
|
858
885
|
* @returns Cached token
|
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
|
|
@@ -283,6 +289,11 @@ export interface IApp {
|
|
|
283
289
|
getLabels<T extends string>(...keys: T[]): {
|
|
284
290
|
[K in T]: string;
|
|
285
291
|
};
|
|
292
|
+
/**
|
|
293
|
+
* Get bool items
|
|
294
|
+
* @returns Bool items
|
|
295
|
+
*/
|
|
296
|
+
getBools(): ListType1[];
|
|
286
297
|
/**
|
|
287
298
|
* Get cached token
|
|
288
299
|
* @returns Cached token
|
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
|
|
@@ -347,6 +353,11 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
347
353
|
getLabels<T extends string>(...keys: T[]): {
|
|
348
354
|
[K in T]: string;
|
|
349
355
|
};
|
|
356
|
+
/**
|
|
357
|
+
* Get bool items
|
|
358
|
+
* @returns Bool items
|
|
359
|
+
*/
|
|
360
|
+
getBools(): ListType1[];
|
|
350
361
|
/**
|
|
351
362
|
* Get cached token
|
|
352
363
|
* @returns Cached token
|
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
|
|
@@ -850,6 +866,17 @@ export class CoreApp {
|
|
|
850
866
|
const init = {};
|
|
851
867
|
return keys.reduce((a, v) => { var _a; return ({ ...a, [v]: (_a = this.get(v)) !== null && _a !== void 0 ? _a : '' }); }, init);
|
|
852
868
|
}
|
|
869
|
+
/**
|
|
870
|
+
* Get bool items
|
|
871
|
+
* @returns Bool items
|
|
872
|
+
*/
|
|
873
|
+
getBools() {
|
|
874
|
+
const { no = 'No', yes = 'Yes' } = this.getLabels('no', 'yes');
|
|
875
|
+
return [
|
|
876
|
+
{ id: 'false', label: no },
|
|
877
|
+
{ id: 'true', label: yes }
|
|
878
|
+
];
|
|
879
|
+
}
|
|
853
880
|
/**
|
|
854
881
|
* Get cached token
|
|
855
882
|
* @returns Cached token
|
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
|
|
@@ -283,6 +289,11 @@ export interface IApp {
|
|
|
283
289
|
getLabels<T extends string>(...keys: T[]): {
|
|
284
290
|
[K in T]: string;
|
|
285
291
|
};
|
|
292
|
+
/**
|
|
293
|
+
* Get bool items
|
|
294
|
+
* @returns Bool items
|
|
295
|
+
*/
|
|
296
|
+
getBools(): ListType1[];
|
|
286
297
|
/**
|
|
287
298
|
* Get cached token
|
|
288
299
|
* @returns Cached token
|
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,21 +52,21 @@
|
|
|
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
|
-
"jest": "^29.4.
|
|
69
|
-
"jest-environment-jsdom": "^29.4.
|
|
68
|
+
"jest": "^29.4.3",
|
|
69
|
+
"jest-environment-jsdom": "^29.4.3",
|
|
70
70
|
"ts-jest": "^29.0.5",
|
|
71
71
|
"typescript": "^4.9.5"
|
|
72
72
|
}
|
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
|
|
@@ -1178,6 +1196,18 @@ export abstract class CoreApp<
|
|
|
1178
1196
|
);
|
|
1179
1197
|
}
|
|
1180
1198
|
|
|
1199
|
+
/**
|
|
1200
|
+
* Get bool items
|
|
1201
|
+
* @returns Bool items
|
|
1202
|
+
*/
|
|
1203
|
+
getBools(): ListType1[] {
|
|
1204
|
+
const { no = 'No', yes = 'Yes' } = this.getLabels('no', 'yes');
|
|
1205
|
+
return [
|
|
1206
|
+
{ id: 'false', label: no },
|
|
1207
|
+
{ id: 'true', label: yes }
|
|
1208
|
+
];
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1181
1211
|
/**
|
|
1182
1212
|
* Get cached token
|
|
1183
1213
|
* @returns Cached token
|
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
|
|
@@ -379,6 +389,12 @@ export interface IApp {
|
|
|
379
389
|
*/
|
|
380
390
|
getLabels<T extends string>(...keys: T[]): { [K in T]: string };
|
|
381
391
|
|
|
392
|
+
/**
|
|
393
|
+
* Get bool items
|
|
394
|
+
* @returns Bool items
|
|
395
|
+
*/
|
|
396
|
+
getBools(): ListType1[];
|
|
397
|
+
|
|
382
398
|
/**
|
|
383
399
|
* Get cached token
|
|
384
400
|
* @returns Cached token
|