@rixl/sdk 0.29.1 → 0.29.3
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/dist/index.d.ts +5 -6
- package/dist/index.js +17 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14856,12 +14856,11 @@ export declare const publicRespondToInvitation: (token: string, state: Membershi
|
|
|
14856
14856
|
/**
|
|
14857
14857
|
* Switches the caller's active organization.
|
|
14858
14858
|
*
|
|
14859
|
-
* Identified by org id, not by `Membership.id
|
|
14860
|
-
*
|
|
14861
|
-
*
|
|
14862
|
-
*
|
|
14863
|
-
*
|
|
14864
|
-
* backend takes user_id from the bearer token.
|
|
14859
|
+
* Identified by org id, not by `Membership.id`, which is a `user_id:org_id`
|
|
14860
|
+
* concatenation that no endpoint accepts. The target org goes in the top-level
|
|
14861
|
+
* `org_id`: the backend reads `user.org_id` as the caller's current org, so a
|
|
14862
|
+
* target sent there is ignored and the call fails with "org_id is required".
|
|
14863
|
+
* The backend fills `user.user_id` from the bearer token.
|
|
14865
14864
|
*/
|
|
14866
14865
|
export declare const updateActiveMembership: (orgId: string) => Promise<void>;
|
|
14867
14866
|
export declare const updateMemberRole: (orgId: string, userId: string, role: AssignableRole) => Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -3499,6 +3499,16 @@ const isTokenExpired = (expireAt) => {
|
|
|
3499
3499
|
return Date.now() >= expireAt;
|
|
3500
3500
|
};
|
|
3501
3501
|
|
|
3502
|
+
//#endregion
|
|
3503
|
+
//#region src/auth/utils/requires-action.ts
|
|
3504
|
+
/**
|
|
3505
|
+
* Whether a token response is limited scope: it names an action the user must
|
|
3506
|
+
* take before getting full tokens (e.g. `add_email`). The gateway emits every
|
|
3507
|
+
* field, so a full-scope response carries `requires_action: ""` too; only a
|
|
3508
|
+
* non-empty value counts.
|
|
3509
|
+
*/
|
|
3510
|
+
const isLimitedScopeTokenResponse = (result) => "requires_action" in result && Boolean(result.requires_action);
|
|
3511
|
+
|
|
3502
3512
|
//#endregion
|
|
3503
3513
|
//#region src/auth/authStore.ts
|
|
3504
3514
|
const isLogged = shared("isLogged", () => atom(initVals["isLogged"] === "true"));
|
|
@@ -3525,7 +3535,7 @@ const login = async (provider) => {
|
|
|
3525
3535
|
};
|
|
3526
3536
|
const refreshAccessToken = async (refresh) => {
|
|
3527
3537
|
const result = await refreshTokens("Bearer", refresh);
|
|
3528
|
-
if (!(
|
|
3538
|
+
if (!isLimitedScopeTokenResponse(result)) setTokens(result.access_token, result.refresh_token, result.expires_in);
|
|
3529
3539
|
};
|
|
3530
3540
|
const ensureValidAccessToken = async (refresh) => {
|
|
3531
3541
|
if (accessToken.get() && !isTokenExpired(expireAt.get())) return;
|
|
@@ -3832,9 +3842,6 @@ const initConfig = async (config) => {
|
|
|
3832
3842
|
updateTelegramAuthUrl();
|
|
3833
3843
|
}
|
|
3834
3844
|
};
|
|
3835
|
-
const isLimitedScopeTokenResponse = (result) => {
|
|
3836
|
-
return "requires_action" in result;
|
|
3837
|
-
};
|
|
3838
3845
|
const applyTokenExchangeResult = (result) => {
|
|
3839
3846
|
if (isLimitedScopeTokenResponse(result)) {
|
|
3840
3847
|
setLimitedAccessState(result.access_token, result.requires_action);
|
|
@@ -4225,17 +4232,16 @@ const ROLE_TO_PROTO = {
|
|
|
4225
4232
|
/**
|
|
4226
4233
|
* Switches the caller's active organization.
|
|
4227
4234
|
*
|
|
4228
|
-
* Identified by org id, not by `Membership.id
|
|
4229
|
-
*
|
|
4230
|
-
*
|
|
4231
|
-
*
|
|
4232
|
-
*
|
|
4233
|
-
* backend takes user_id from the bearer token.
|
|
4235
|
+
* Identified by org id, not by `Membership.id`, which is a `user_id:org_id`
|
|
4236
|
+
* concatenation that no endpoint accepts. The target org goes in the top-level
|
|
4237
|
+
* `org_id`: the backend reads `user.org_id` as the caller's current org, so a
|
|
4238
|
+
* target sent there is ignored and the call fails with "org_id is required".
|
|
4239
|
+
* The backend fills `user.user_id` from the bearer token.
|
|
4234
4240
|
*/
|
|
4235
4241
|
const updateActiveMembership = async (orgId) => {
|
|
4236
4242
|
return apiCall(async () => {
|
|
4237
4243
|
await authV1MembershipServiceUpdateActiveMembership({
|
|
4238
|
-
body: {
|
|
4244
|
+
body: { org_id: orgId },
|
|
4239
4245
|
throwOnError: true
|
|
4240
4246
|
});
|
|
4241
4247
|
accessToken.set(void 0);
|