@bibike/erp-sdk 1.1.0 → 1.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.js CHANGED
@@ -346,6 +346,8 @@ var BibikeClient = class {
346
346
  */
347
347
  async login(credentials) {
348
348
  const response = await this.request("auth", "login", "POST", {
349
+ // Send both for backwards compatibility with older API versions
350
+ username: credentials.login,
349
351
  login: credentials.login,
350
352
  password: credentials.password,
351
353
  two_factor_code: credentials.two_factor_code
@@ -359,12 +361,14 @@ var BibikeClient = class {
359
361
  methods: rawResponse.methods
360
362
  };
361
363
  }
362
- if (response.data?.token) {
363
- this.token = response.data.token;
364
+ const token = rawResponse.data?.token || rawResponse.token;
365
+ const user = rawResponse.data?.user || rawResponse.user;
366
+ if (token) {
367
+ this.token = token;
364
368
  }
365
369
  return {
366
370
  success: true,
367
- data: response.data
371
+ data: { token, user }
368
372
  };
369
373
  }
370
374
  /**
@@ -372,12 +376,15 @@ var BibikeClient = class {
372
376
  */
373
377
  async verify2FA(input) {
374
378
  const response = await this.request("auth", "verify_2fa", "POST", input);
375
- if (response.data?.token) {
376
- this.token = response.data.token;
379
+ const rawResponse = response;
380
+ const token = rawResponse.data?.token || rawResponse.token;
381
+ const user = rawResponse.data?.user || rawResponse.user;
382
+ if (token) {
383
+ this.token = token;
377
384
  }
378
385
  return {
379
386
  success: true,
380
- data: response.data
387
+ data: { token, user }
381
388
  };
382
389
  }
383
390
  /**
package/dist/index.mjs CHANGED
@@ -319,6 +319,8 @@ var BibikeClient = class {
319
319
  */
320
320
  async login(credentials) {
321
321
  const response = await this.request("auth", "login", "POST", {
322
+ // Send both for backwards compatibility with older API versions
323
+ username: credentials.login,
322
324
  login: credentials.login,
323
325
  password: credentials.password,
324
326
  two_factor_code: credentials.two_factor_code
@@ -332,12 +334,14 @@ var BibikeClient = class {
332
334
  methods: rawResponse.methods
333
335
  };
334
336
  }
335
- if (response.data?.token) {
336
- this.token = response.data.token;
337
+ const token = rawResponse.data?.token || rawResponse.token;
338
+ const user = rawResponse.data?.user || rawResponse.user;
339
+ if (token) {
340
+ this.token = token;
337
341
  }
338
342
  return {
339
343
  success: true,
340
- data: response.data
344
+ data: { token, user }
341
345
  };
342
346
  }
343
347
  /**
@@ -345,12 +349,15 @@ var BibikeClient = class {
345
349
  */
346
350
  async verify2FA(input) {
347
351
  const response = await this.request("auth", "verify_2fa", "POST", input);
348
- if (response.data?.token) {
349
- this.token = response.data.token;
352
+ const rawResponse = response;
353
+ const token = rawResponse.data?.token || rawResponse.token;
354
+ const user = rawResponse.data?.user || rawResponse.user;
355
+ if (token) {
356
+ this.token = token;
350
357
  }
351
358
  return {
352
359
  success: true,
353
- data: response.data
360
+ data: { token, user }
354
361
  };
355
362
  }
356
363
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bibike/erp-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "TypeScript SDK for Bibike ERP API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",