@spacelr/sdk 0.9.0 → 0.9.1

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
@@ -1304,6 +1304,16 @@ function localStorageCursorStorage(prefix = "spacelr:cursor:") {
1304
1304
  }
1305
1305
 
1306
1306
  // libs/sdk/src/modules/auth.module.ts
1307
+ function mapProfile(u) {
1308
+ const name = u.name ?? ([u.firstName, u.lastName].filter(Boolean).join(" ") || void 0) ?? u.displayName;
1309
+ return {
1310
+ id: u.id ?? u._id ?? u.userId ?? u.sub ?? "",
1311
+ email: u.email ?? "",
1312
+ username: u.username,
1313
+ name,
1314
+ roles: u.roles ?? []
1315
+ };
1316
+ }
1307
1317
  var AuthModule = class {
1308
1318
  constructor(http, tokenManager, config) {
1309
1319
  this.stateListeners = /* @__PURE__ */ new Set();
@@ -1427,11 +1437,12 @@ var AuthModule = class {
1427
1437
  });
1428
1438
  }
1429
1439
  async getProfile() {
1430
- return this.http.request({
1440
+ const data = await this.http.request({
1431
1441
  method: "GET",
1432
1442
  path: "/auth/me",
1433
1443
  authenticated: true
1434
1444
  });
1445
+ return mapProfile(data.user ?? data);
1435
1446
  }
1436
1447
  async logout() {
1437
1448
  try {