@etsoo/appscript 1.5.79 → 1.5.81
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/api/AuthApi.d.ts +2 -1
- package/lib/cjs/api/AuthApi.js +13 -2
- package/lib/cjs/api/rq/SwitchOrgRQ.d.ts +1 -1
- package/lib/mjs/api/AuthApi.d.ts +2 -1
- package/lib/mjs/api/AuthApi.js +13 -2
- package/lib/mjs/api/rq/SwitchOrgRQ.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/AuthApi.ts +20 -2
- package/src/api/rq/SwitchOrgRQ.ts +1 -1
package/lib/cjs/api/AuthApi.d.ts
CHANGED
|
@@ -93,7 +93,8 @@ export declare class AuthApi extends BaseApi {
|
|
|
93
93
|
/**
|
|
94
94
|
* Switch organization
|
|
95
95
|
* @param rq Request data
|
|
96
|
+
* @param tokenKey Refresh token key
|
|
96
97
|
* @param payload Payload
|
|
97
98
|
*/
|
|
98
|
-
switchOrg(rq: SwitchOrgRQ, payload?:
|
|
99
|
+
switchOrg<T extends IUser>(rq: SwitchOrgRQ, payload?: IApiPayload<IActionResult<T>>, tokenKey?: string): Promise<[IActionResult<T> | undefined, string | null]>;
|
|
99
100
|
}
|
package/lib/cjs/api/AuthApi.js
CHANGED
|
@@ -163,10 +163,21 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
163
163
|
/**
|
|
164
164
|
* Switch organization
|
|
165
165
|
* @param rq Request data
|
|
166
|
+
* @param tokenKey Refresh token key
|
|
166
167
|
* @param payload Payload
|
|
167
168
|
*/
|
|
168
|
-
switchOrg(rq, payload) {
|
|
169
|
-
|
|
169
|
+
async switchOrg(rq, payload, tokenKey) {
|
|
170
|
+
// Default values
|
|
171
|
+
payload ?? (payload = {});
|
|
172
|
+
tokenKey ?? (tokenKey = AuthApi.HeaderTokenField);
|
|
173
|
+
// Call the API
|
|
174
|
+
const result = await this.api.post("Auth/SwitchOrg", rq, payload);
|
|
175
|
+
// Get the refresh token
|
|
176
|
+
const refreshToken = result?.ok
|
|
177
|
+
? this.app.getResponseToken(payload.response, tokenKey)
|
|
178
|
+
: null;
|
|
179
|
+
// Return the result
|
|
180
|
+
return [result, refreshToken];
|
|
170
181
|
}
|
|
171
182
|
}
|
|
172
183
|
exports.AuthApi = AuthApi;
|
package/lib/mjs/api/AuthApi.d.ts
CHANGED
|
@@ -93,7 +93,8 @@ export declare class AuthApi extends BaseApi {
|
|
|
93
93
|
/**
|
|
94
94
|
* Switch organization
|
|
95
95
|
* @param rq Request data
|
|
96
|
+
* @param tokenKey Refresh token key
|
|
96
97
|
* @param payload Payload
|
|
97
98
|
*/
|
|
98
|
-
switchOrg(rq: SwitchOrgRQ, payload?:
|
|
99
|
+
switchOrg<T extends IUser>(rq: SwitchOrgRQ, payload?: IApiPayload<IActionResult<T>>, tokenKey?: string): Promise<[IActionResult<T> | undefined, string | null]>;
|
|
99
100
|
}
|
package/lib/mjs/api/AuthApi.js
CHANGED
|
@@ -160,10 +160,21 @@ export class AuthApi extends BaseApi {
|
|
|
160
160
|
/**
|
|
161
161
|
* Switch organization
|
|
162
162
|
* @param rq Request data
|
|
163
|
+
* @param tokenKey Refresh token key
|
|
163
164
|
* @param payload Payload
|
|
164
165
|
*/
|
|
165
|
-
switchOrg(rq, payload) {
|
|
166
|
-
|
|
166
|
+
async switchOrg(rq, payload, tokenKey) {
|
|
167
|
+
// Default values
|
|
168
|
+
payload ?? (payload = {});
|
|
169
|
+
tokenKey ?? (tokenKey = AuthApi.HeaderTokenField);
|
|
170
|
+
// Call the API
|
|
171
|
+
const result = await this.api.post("Auth/SwitchOrg", rq, payload);
|
|
172
|
+
// Get the refresh token
|
|
173
|
+
const refreshToken = result?.ok
|
|
174
|
+
? this.app.getResponseToken(payload.response, tokenKey)
|
|
175
|
+
: null;
|
|
176
|
+
// Return the result
|
|
177
|
+
return [result, refreshToken];
|
|
167
178
|
}
|
|
168
179
|
}
|
|
169
180
|
/**
|
package/package.json
CHANGED
package/src/api/AuthApi.ts
CHANGED
|
@@ -218,9 +218,27 @@ export class AuthApi extends BaseApi {
|
|
|
218
218
|
/**
|
|
219
219
|
* Switch organization
|
|
220
220
|
* @param rq Request data
|
|
221
|
+
* @param tokenKey Refresh token key
|
|
221
222
|
* @param payload Payload
|
|
222
223
|
*/
|
|
223
|
-
switchOrg
|
|
224
|
-
|
|
224
|
+
async switchOrg<T extends IUser>(
|
|
225
|
+
rq: SwitchOrgRQ,
|
|
226
|
+
payload?: IApiPayload<IActionResult<T>>,
|
|
227
|
+
tokenKey?: string
|
|
228
|
+
): Promise<[IActionResult<T> | undefined, string | null]> {
|
|
229
|
+
// Default values
|
|
230
|
+
payload ??= {};
|
|
231
|
+
tokenKey ??= AuthApi.HeaderTokenField;
|
|
232
|
+
|
|
233
|
+
// Call the API
|
|
234
|
+
const result = await this.api.post("Auth/SwitchOrg", rq, payload);
|
|
235
|
+
|
|
236
|
+
// Get the refresh token
|
|
237
|
+
const refreshToken = result?.ok
|
|
238
|
+
? this.app.getResponseToken(payload.response, tokenKey)
|
|
239
|
+
: null;
|
|
240
|
+
|
|
241
|
+
// Return the result
|
|
242
|
+
return [result, refreshToken];
|
|
225
243
|
}
|
|
226
244
|
}
|