@etsoo/appscript 1.1.52 → 1.1.53
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/lib/cjs/app/CoreApp.d.ts +10 -0
- package/lib/cjs/app/CoreApp.js +13 -0
- package/lib/mjs/app/CoreApp.d.ts +10 -0
- package/lib/mjs/app/CoreApp.js +13 -0
- package/package.json +1 -1
- package/src/app/CoreApp.ts +20 -0
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -178,6 +178,11 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
178
178
|
* @param apiUrl Signout API URL
|
|
179
179
|
*/
|
|
180
180
|
signout(apiUrl?: string): Promise<void>;
|
|
181
|
+
/**
|
|
182
|
+
* Switch organization
|
|
183
|
+
* @param apiOrOrg API URL or organization id
|
|
184
|
+
*/
|
|
185
|
+
switchOrg(apiOrOrg: string | number): Promise<boolean | undefined>;
|
|
181
186
|
/**
|
|
182
187
|
* Go to the login page
|
|
183
188
|
*/
|
|
@@ -426,6 +431,11 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
426
431
|
* @param apiUrl Signout API URL
|
|
427
432
|
*/
|
|
428
433
|
signout(apiUrl?: string): Promise<void>;
|
|
434
|
+
/**
|
|
435
|
+
* Switch organization
|
|
436
|
+
* @param apiOrOrg API URL or organization id
|
|
437
|
+
*/
|
|
438
|
+
switchOrg(apiOrOrg: string | number): Promise<boolean | undefined>;
|
|
429
439
|
/**
|
|
430
440
|
* Go to the login page
|
|
431
441
|
*/
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -424,6 +424,19 @@ class CoreApp {
|
|
|
424
424
|
// Go to login page
|
|
425
425
|
this.toLoginPage();
|
|
426
426
|
}
|
|
427
|
+
/**
|
|
428
|
+
* Switch organization
|
|
429
|
+
* @param apiOrOrg API URL or organization id
|
|
430
|
+
*/
|
|
431
|
+
async switchOrg(apiOrOrg) {
|
|
432
|
+
const api = typeof apiOrOrg === 'number'
|
|
433
|
+
? `Organization/Switch/${apiOrOrg}`
|
|
434
|
+
: apiOrOrg;
|
|
435
|
+
const result = await this.api.put(api);
|
|
436
|
+
if (result)
|
|
437
|
+
return await this.refreshToken();
|
|
438
|
+
return result;
|
|
439
|
+
}
|
|
427
440
|
/**
|
|
428
441
|
* Go to the login page
|
|
429
442
|
*/
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -178,6 +178,11 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
178
178
|
* @param apiUrl Signout API URL
|
|
179
179
|
*/
|
|
180
180
|
signout(apiUrl?: string): Promise<void>;
|
|
181
|
+
/**
|
|
182
|
+
* Switch organization
|
|
183
|
+
* @param apiOrOrg API URL or organization id
|
|
184
|
+
*/
|
|
185
|
+
switchOrg(apiOrOrg: string | number): Promise<boolean | undefined>;
|
|
181
186
|
/**
|
|
182
187
|
* Go to the login page
|
|
183
188
|
*/
|
|
@@ -426,6 +431,11 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
426
431
|
* @param apiUrl Signout API URL
|
|
427
432
|
*/
|
|
428
433
|
signout(apiUrl?: string): Promise<void>;
|
|
434
|
+
/**
|
|
435
|
+
* Switch organization
|
|
436
|
+
* @param apiOrOrg API URL or organization id
|
|
437
|
+
*/
|
|
438
|
+
switchOrg(apiOrOrg: string | number): Promise<boolean | undefined>;
|
|
429
439
|
/**
|
|
430
440
|
* Go to the login page
|
|
431
441
|
*/
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -421,6 +421,19 @@ export class CoreApp {
|
|
|
421
421
|
// Go to login page
|
|
422
422
|
this.toLoginPage();
|
|
423
423
|
}
|
|
424
|
+
/**
|
|
425
|
+
* Switch organization
|
|
426
|
+
* @param apiOrOrg API URL or organization id
|
|
427
|
+
*/
|
|
428
|
+
async switchOrg(apiOrOrg) {
|
|
429
|
+
const api = typeof apiOrOrg === 'number'
|
|
430
|
+
? `Organization/Switch/${apiOrOrg}`
|
|
431
|
+
: apiOrOrg;
|
|
432
|
+
const result = await this.api.put(api);
|
|
433
|
+
if (result)
|
|
434
|
+
return await this.refreshToken();
|
|
435
|
+
return result;
|
|
436
|
+
}
|
|
424
437
|
/**
|
|
425
438
|
* Go to the login page
|
|
426
439
|
*/
|
package/package.json
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -240,6 +240,12 @@ export interface ICoreApp<
|
|
|
240
240
|
*/
|
|
241
241
|
signout(apiUrl?: string): Promise<void>;
|
|
242
242
|
|
|
243
|
+
/**
|
|
244
|
+
* Switch organization
|
|
245
|
+
* @param apiOrOrg API URL or organization id
|
|
246
|
+
*/
|
|
247
|
+
switchOrg(apiOrOrg: string | number): Promise<boolean | undefined>;
|
|
248
|
+
|
|
243
249
|
/**
|
|
244
250
|
* Go to the login page
|
|
245
251
|
*/
|
|
@@ -847,6 +853,20 @@ export abstract class CoreApp<
|
|
|
847
853
|
this.toLoginPage();
|
|
848
854
|
}
|
|
849
855
|
|
|
856
|
+
/**
|
|
857
|
+
* Switch organization
|
|
858
|
+
* @param apiOrOrg API URL or organization id
|
|
859
|
+
*/
|
|
860
|
+
async switchOrg(apiOrOrg: string | number) {
|
|
861
|
+
const api =
|
|
862
|
+
typeof apiOrOrg === 'number'
|
|
863
|
+
? `Organization/Switch/${apiOrOrg}`
|
|
864
|
+
: apiOrOrg;
|
|
865
|
+
const result = await this.api.put<boolean>(api);
|
|
866
|
+
if (result) return await this.refreshToken();
|
|
867
|
+
return result;
|
|
868
|
+
}
|
|
869
|
+
|
|
850
870
|
/**
|
|
851
871
|
* Go to the login page
|
|
852
872
|
*/
|