@opexa/portal-sdk 0.59.76 → 0.59.77
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/{chunk-BDZPLMTL.js → chunk-3WS4U4B7.js} +22 -10
- package/dist/chunk-3WS4U4B7.js.map +1 -0
- package/dist/index.cjs +40 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +20 -8
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-BDZPLMTL.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -4500,7 +4500,7 @@ var AuthService = class {
|
|
|
4500
4500
|
}
|
|
4501
4501
|
async createSession(input, version = 1) {
|
|
4502
4502
|
const headers = new Headers(this.headers);
|
|
4503
|
-
if (version === 3) {
|
|
4503
|
+
if (version === 3 || version === 4) {
|
|
4504
4504
|
const fingerprint = await getFingerPrint();
|
|
4505
4505
|
if (fingerprint) {
|
|
4506
4506
|
headers.append("Fingerprint", fingerprint);
|
|
@@ -4629,9 +4629,15 @@ var AuthService = class {
|
|
|
4629
4629
|
if (version !== 4) {
|
|
4630
4630
|
headers.append("Authorization", `Bearer ${refreshToken}`);
|
|
4631
4631
|
}
|
|
4632
|
+
if (version === 3 || version === 4) {
|
|
4633
|
+
const fingerprint = await getFingerPrint();
|
|
4634
|
+
if (fingerprint) {
|
|
4635
|
+
headers.append("Fingerprint", fingerprint);
|
|
4636
|
+
}
|
|
4637
|
+
}
|
|
4632
4638
|
try {
|
|
4633
4639
|
const res = await fetch(
|
|
4634
|
-
`${this.url}${version
|
|
4640
|
+
`${this.url}${version !== 1 ? `/v${version}/session/refresh` : "/session:refresh"}`,
|
|
4635
4641
|
{
|
|
4636
4642
|
method: "POST",
|
|
4637
4643
|
headers,
|
|
@@ -4674,14 +4680,20 @@ var AuthService = class {
|
|
|
4674
4680
|
};
|
|
4675
4681
|
}
|
|
4676
4682
|
}
|
|
4677
|
-
async destroySession(accessToken) {
|
|
4683
|
+
async destroySession(accessToken, version = 1) {
|
|
4678
4684
|
const headers = new Headers(this.headers);
|
|
4679
|
-
|
|
4685
|
+
if (version !== 4) {
|
|
4686
|
+
headers.append("Authorization", `Bearer ${accessToken}`);
|
|
4687
|
+
}
|
|
4680
4688
|
try {
|
|
4681
|
-
const res = await fetch(
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4689
|
+
const res = await fetch(
|
|
4690
|
+
`${this.url}${version !== 1 ? `/v${version}/session` : "/session"}`,
|
|
4691
|
+
{
|
|
4692
|
+
method: "DELETE",
|
|
4693
|
+
headers,
|
|
4694
|
+
...version === 4 && { credentials: "include" }
|
|
4695
|
+
}
|
|
4696
|
+
);
|
|
4685
4697
|
return res.ok ? { ok: true } : { ok: false, error: statusCodeToOperationError(res.status) };
|
|
4686
4698
|
} catch {
|
|
4687
4699
|
return { ok: false, error: statusCodeToOperationError(500) };
|
|
@@ -7459,9 +7471,18 @@ var SessionManagerCookie = class {
|
|
|
7459
7471
|
this.logger.warn("'client cookies' is not available on the server.");
|
|
7460
7472
|
return;
|
|
7461
7473
|
}
|
|
7474
|
+
let version = 1;
|
|
7475
|
+
const val = cookies__default.default.get(this.storageKey);
|
|
7476
|
+
if (val) {
|
|
7477
|
+
try {
|
|
7478
|
+
const stored = JSON.parse(val);
|
|
7479
|
+
version = stored.version ?? 1;
|
|
7480
|
+
} catch {
|
|
7481
|
+
}
|
|
7482
|
+
}
|
|
7462
7483
|
const res = await this.get();
|
|
7463
7484
|
if (res.data?.accessToken) {
|
|
7464
|
-
await this.authService.destroySession(res.data.accessToken);
|
|
7485
|
+
await this.authService.destroySession(res.data.accessToken, version);
|
|
7465
7486
|
}
|
|
7466
7487
|
this.v4AccessToken = null;
|
|
7467
7488
|
this.v4AccessTokenExpiresAt = null;
|
|
@@ -7871,9 +7892,18 @@ var SessionManager = class {
|
|
|
7871
7892
|
this.logger.warn("'localStorage' is not available on the server.");
|
|
7872
7893
|
return;
|
|
7873
7894
|
}
|
|
7895
|
+
let version = 1;
|
|
7896
|
+
const val = localStorage.getItem(this.storageKey);
|
|
7897
|
+
if (val) {
|
|
7898
|
+
try {
|
|
7899
|
+
const stored = JSON.parse(val);
|
|
7900
|
+
version = stored.version ?? 1;
|
|
7901
|
+
} catch {
|
|
7902
|
+
}
|
|
7903
|
+
}
|
|
7874
7904
|
const res = await this.get();
|
|
7875
7905
|
if (res.data?.accessToken) {
|
|
7876
|
-
await this.authService.destroySession(res.data.accessToken);
|
|
7906
|
+
await this.authService.destroySession(res.data.accessToken, version);
|
|
7877
7907
|
}
|
|
7878
7908
|
this.v4AccessToken = null;
|
|
7879
7909
|
this.v4AccessTokenExpiresAt = null;
|