@baasix/sdk 0.1.4 → 0.1.6
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 +18 -0
- package/dist/index.cjs +15 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/modules/auth.cjs +12 -2
- package/dist/modules/auth.cjs.map +1 -1
- package/dist/modules/auth.d.cts +8 -0
- package/dist/modules/auth.d.ts +8 -0
- package/dist/modules/auth.js +12 -2
- package/dist/modules/auth.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -118,7 +118,9 @@ var HttpClient = class {
|
|
|
118
118
|
"Content-Type": "application/json",
|
|
119
119
|
...this.config.headers
|
|
120
120
|
},
|
|
121
|
-
body:
|
|
121
|
+
body: JSON.stringify(
|
|
122
|
+
this.config.authMode === "jwt" ? { refreshToken, authMode: "jwt" } : { authMode: "cookie" }
|
|
123
|
+
),
|
|
122
124
|
credentials: this.config.credentials
|
|
123
125
|
}
|
|
124
126
|
);
|
|
@@ -557,6 +559,14 @@ var AuthModule = class {
|
|
|
557
559
|
* password: 'password123',
|
|
558
560
|
* tenantId: 'tenant-uuid'
|
|
559
561
|
* });
|
|
562
|
+
*
|
|
563
|
+
* // Login with authMode and authType
|
|
564
|
+
* const result = await baasix.auth.login({
|
|
565
|
+
* email: 'user@example.com',
|
|
566
|
+
* password: 'password123',
|
|
567
|
+
* authMode: 'cookie', // or 'jwt' (default)
|
|
568
|
+
* authType: 'mobile' // for session management
|
|
569
|
+
* });
|
|
560
570
|
* ```
|
|
561
571
|
*/
|
|
562
572
|
async login(credentials) {
|
|
@@ -565,7 +575,9 @@ var AuthModule = class {
|
|
|
565
575
|
{
|
|
566
576
|
email: credentials.email,
|
|
567
577
|
password: credentials.password,
|
|
568
|
-
tenant_Id: credentials.tenantId
|
|
578
|
+
tenant_Id: credentials.tenantId,
|
|
579
|
+
authMode: credentials.authMode,
|
|
580
|
+
authType: credentials.authType
|
|
569
581
|
},
|
|
570
582
|
{ skipAuth: true }
|
|
571
583
|
);
|
|
@@ -709,7 +721,7 @@ var AuthModule = class {
|
|
|
709
721
|
const refreshToken = await this.storage.get(STORAGE_KEYS.REFRESH_TOKEN);
|
|
710
722
|
const response = await this.client.post(
|
|
711
723
|
"/auth/refresh",
|
|
712
|
-
this.authMode === "jwt" ? { refreshToken } :
|
|
724
|
+
this.authMode === "jwt" ? { refreshToken, authMode: "jwt" } : { authMode: "cookie" }
|
|
713
725
|
);
|
|
714
726
|
await this.storeTokens(response);
|
|
715
727
|
const tokens = {
|