@opexa/portal-sdk 0.59.75 → 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/README.md +1634 -1634
- package/dist/{chunk-UT6VBXJ4.js → chunk-3WS4U4B7.js} +40 -24
- package/dist/chunk-3WS4U4B7.js.map +1 -0
- package/dist/{chunk-5WRVWQBT.js → chunk-7APXFZ5G.js} +3 -3
- package/dist/chunk-7APXFZ5G.js.map +1 -0
- package/dist/{chunk-ROBGEUSE.js → chunk-WVFSGB7Y.js} +2 -2
- package/dist/chunk-WVFSGB7Y.js.map +1 -0
- package/dist/index.cjs +263 -153
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +229 -135
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +37 -21
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +5 -5
- package/dist/services/index.d.ts +5 -5
- package/dist/services/index.js +2 -2
- package/dist/{types-Dz4J_rhs.d.cts → types-kTe_j8tm.d.cts} +3 -3
- package/dist/{types-Cmawo0zW.d.ts → types-lZQpMvHU.d.ts} +3 -3
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-5WRVWQBT.js.map +0 -1
- package/dist/chunk-ROBGEUSE.js.map +0 -1
- package/dist/chunk-UT6VBXJ4.js.map +0 -1
package/dist/services/index.cjs
CHANGED
|
@@ -4479,7 +4479,7 @@ var AuthService = class {
|
|
|
4479
4479
|
}
|
|
4480
4480
|
async createSession(input, version = 1) {
|
|
4481
4481
|
const headers = new Headers(this.headers);
|
|
4482
|
-
if (version === 3) {
|
|
4482
|
+
if (version === 3 || version === 4) {
|
|
4483
4483
|
const fingerprint = await getFingerPrint();
|
|
4484
4484
|
if (fingerprint) {
|
|
4485
4485
|
headers.append("Fingerprint", fingerprint);
|
|
@@ -4517,14 +4517,12 @@ var AuthService = class {
|
|
|
4517
4517
|
headers.set("test-pass", input.testPass);
|
|
4518
4518
|
}
|
|
4519
4519
|
try {
|
|
4520
|
-
const res = await fetch(
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
}
|
|
4527
|
-
);
|
|
4520
|
+
const res = await fetch(`${this.url}${version !== 1 ? `/v${version}/sessions` : "/sessions"}`, {
|
|
4521
|
+
method: "POST",
|
|
4522
|
+
headers,
|
|
4523
|
+
body: JSON.stringify(input),
|
|
4524
|
+
...version === 4 && { credentials: "include" }
|
|
4525
|
+
});
|
|
4528
4526
|
const data = await res.json();
|
|
4529
4527
|
if (res.ok) {
|
|
4530
4528
|
return {
|
|
@@ -4605,14 +4603,26 @@ var AuthService = class {
|
|
|
4605
4603
|
}
|
|
4606
4604
|
throw new Error("Invalid input 'type'");
|
|
4607
4605
|
}
|
|
4608
|
-
async refreshSession(refreshToken) {
|
|
4606
|
+
async refreshSession(refreshToken, version = 1) {
|
|
4609
4607
|
const headers = new Headers(this.headers);
|
|
4610
|
-
|
|
4608
|
+
if (version !== 4) {
|
|
4609
|
+
headers.append("Authorization", `Bearer ${refreshToken}`);
|
|
4610
|
+
}
|
|
4611
|
+
if (version === 3 || version === 4) {
|
|
4612
|
+
const fingerprint = await getFingerPrint();
|
|
4613
|
+
if (fingerprint) {
|
|
4614
|
+
headers.append("Fingerprint", fingerprint);
|
|
4615
|
+
}
|
|
4616
|
+
}
|
|
4611
4617
|
try {
|
|
4612
|
-
const res = await fetch(
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4618
|
+
const res = await fetch(
|
|
4619
|
+
`${this.url}${version !== 1 ? `/v${version}/session/refresh` : "/session:refresh"}`,
|
|
4620
|
+
{
|
|
4621
|
+
method: "POST",
|
|
4622
|
+
headers,
|
|
4623
|
+
...version === 4 && { credentials: "include" }
|
|
4624
|
+
}
|
|
4625
|
+
);
|
|
4616
4626
|
const data = await res.json();
|
|
4617
4627
|
if (res.ok) {
|
|
4618
4628
|
return {
|
|
@@ -4649,14 +4659,20 @@ var AuthService = class {
|
|
|
4649
4659
|
};
|
|
4650
4660
|
}
|
|
4651
4661
|
}
|
|
4652
|
-
async destroySession(accessToken) {
|
|
4662
|
+
async destroySession(accessToken, version = 1) {
|
|
4653
4663
|
const headers = new Headers(this.headers);
|
|
4654
|
-
|
|
4664
|
+
if (version !== 4) {
|
|
4665
|
+
headers.append("Authorization", `Bearer ${accessToken}`);
|
|
4666
|
+
}
|
|
4655
4667
|
try {
|
|
4656
|
-
const res = await fetch(
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4668
|
+
const res = await fetch(
|
|
4669
|
+
`${this.url}${version !== 1 ? `/v${version}/session` : "/session"}`,
|
|
4670
|
+
{
|
|
4671
|
+
method: "DELETE",
|
|
4672
|
+
headers,
|
|
4673
|
+
...version === 4 && { credentials: "include" }
|
|
4674
|
+
}
|
|
4675
|
+
);
|
|
4660
4676
|
return res.ok ? { ok: true } : { ok: false, error: statusCodeToOperationError(res.status) };
|
|
4661
4677
|
} catch {
|
|
4662
4678
|
return { ok: false, error: statusCodeToOperationError(500) };
|