@vitia.ai/secure-api-client-vue 0.1.1 → 0.1.2
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.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +8 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -2962,7 +2962,7 @@ ${c}`, l = await Hs(i, new TextEncoder().encode(h)), g = ne(l), w = new Headers(
|
|
|
2962
2962
|
var t, r, s;
|
|
2963
2963
|
(!this.session || !this.session.sessionId || !this.session.sessionExpiresAt || !this.session.encKey || !this.session.macKey) && await this.handshake();
|
|
2964
2964
|
const e = new Date(Date.now() + 5 * 60 * 1e3);
|
|
2965
|
-
(t = this.session) != null && t.sessionExpiresAt && new Date((r = this.session) == null ? void 0 : r.sessionExpiresAt) < e && await this.extendHandshake(), (s = this.session) != null && s.
|
|
2965
|
+
(t = this.session) != null && t.sessionExpiresAt && new Date((r = this.session) == null ? void 0 : r.sessionExpiresAt) < e && await this.extendHandshake(), (s = this.session) != null && s.accessToken && this.isTokenExpired() && await this.refresh();
|
|
2966
2966
|
}
|
|
2967
2967
|
async extendHandshake() {
|
|
2968
2968
|
await this.post("/handshake/extend", {}).then(async (e) => {
|
|
@@ -2999,9 +2999,14 @@ ${c}`, l = await Hs(i, new TextEncoder().encode(h)), g = ne(l), w = new Headers(
|
|
|
2999
2999
|
return r === 0;
|
|
3000
3000
|
}
|
|
3001
3001
|
async login(e) {
|
|
3002
|
-
await this.
|
|
3002
|
+
(!this.session || !this.session.sessionId || !this.session.sessionExpiresAt || !this.session.encKey || !this.session.macKey) && await this.handshake(), this.updateSession({
|
|
3003
|
+
accessToken: void 0,
|
|
3004
|
+
tokenType: void 0,
|
|
3005
|
+
expiresAt: void 0,
|
|
3006
|
+
refreshToken: void 0
|
|
3007
|
+
});
|
|
3003
3008
|
const t = {};
|
|
3004
|
-
"username" in e && "password" in e && (t.username = e.username, t.password = e.password, t.scope = e.scope), "email" in e && "socialLoginId" in e && (t.email = e.email, t.social_login_id = e.socialLoginId, t.scope = e.scope), "jwt" in e && this.updateSession({
|
|
3009
|
+
"username" in e && "password" in e && (t.username = e.username, t.password = e.password, t.scope = e.scope, t.oauth_session = e.oauthSession), "email" in e && "socialLoginId" in e && (t.email = e.email, t.social_login_id = e.socialLoginId, t.scope = e.scope, t.oauth_session = e.oauthSession), "jwt" in e && this.updateSession({
|
|
3005
3010
|
accessToken: e.jwt,
|
|
3006
3011
|
tokenType: "Bearer"
|
|
3007
3012
|
}), "refreshToken" in e && (t.refresh_token = e.refreshToken);
|