@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 CHANGED
@@ -140,8 +140,26 @@ const result = await baasix.auth.login({
140
140
  password: 'password123',
141
141
  tenantId: 'tenant-uuid',
142
142
  });
143
+
144
+ // With authMode and authType for session management
145
+ const result = await baasix.auth.login({
146
+ email: 'user@example.com',
147
+ password: 'password123',
148
+ authMode: 'cookie', // 'jwt' (default) or 'cookie'
149
+ authType: 'mobile', // 'web', 'mobile', 'default', etc.
150
+ });
143
151
  ```
144
152
 
153
+ **Login Options:**
154
+
155
+ | Option | Type | Description |
156
+ |--------|------|-------------|
157
+ | `email` | string | User's email address (required) |
158
+ | `password` | string | User's password (required) |
159
+ | `tenantId` | string | Tenant ID for multi-tenant mode |
160
+ | `authMode` | `'jwt'` \| `'cookie'` | Authentication mode. Use `'jwt'` for token-based auth (default), `'cookie'` for cookie-based auth |
161
+ | `authType` | string | Session type identifier (e.g., `'web'`, `'mobile'`, `'default'`). Used for session limits and management |
162
+
145
163
  ### Get Current User
146
164
 
147
165
  ```typescript
package/dist/index.cjs CHANGED
@@ -120,7 +120,9 @@ var HttpClient = class {
120
120
  "Content-Type": "application/json",
121
121
  ...this.config.headers
122
122
  },
123
- body: this.config.authMode === "jwt" ? JSON.stringify({ refreshToken }) : void 0,
123
+ body: JSON.stringify(
124
+ this.config.authMode === "jwt" ? { refreshToken, authMode: "jwt" } : { authMode: "cookie" }
125
+ ),
124
126
  credentials: this.config.credentials
125
127
  }
126
128
  );
@@ -559,6 +561,14 @@ var AuthModule = class {
559
561
  * password: 'password123',
560
562
  * tenantId: 'tenant-uuid'
561
563
  * });
564
+ *
565
+ * // Login with authMode and authType
566
+ * const result = await baasix.auth.login({
567
+ * email: 'user@example.com',
568
+ * password: 'password123',
569
+ * authMode: 'cookie', // or 'jwt' (default)
570
+ * authType: 'mobile' // for session management
571
+ * });
562
572
  * ```
563
573
  */
564
574
  async login(credentials) {
@@ -567,7 +577,9 @@ var AuthModule = class {
567
577
  {
568
578
  email: credentials.email,
569
579
  password: credentials.password,
570
- tenant_Id: credentials.tenantId
580
+ tenant_Id: credentials.tenantId,
581
+ authMode: credentials.authMode,
582
+ authType: credentials.authType
571
583
  },
572
584
  { skipAuth: true }
573
585
  );
@@ -711,7 +723,7 @@ var AuthModule = class {
711
723
  const refreshToken = await this.storage.get(STORAGE_KEYS.REFRESH_TOKEN);
712
724
  const response = await this.client.post(
713
725
  "/auth/refresh",
714
- this.authMode === "jwt" ? { refreshToken } : void 0
726
+ this.authMode === "jwt" ? { refreshToken, authMode: "jwt" } : { authMode: "cookie" }
715
727
  );
716
728
  await this.storeTokens(response);
717
729
  const tokens = {