@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 +12 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1261,6 +1261,16 @@ function localStorageCursorStorage(prefix = "spacelr:cursor:") {
|
|
|
1261
1261
|
}
|
|
1262
1262
|
|
|
1263
1263
|
// libs/sdk/src/modules/auth.module.ts
|
|
1264
|
+
function mapProfile(u) {
|
|
1265
|
+
const name = u.name ?? ([u.firstName, u.lastName].filter(Boolean).join(" ") || void 0) ?? u.displayName;
|
|
1266
|
+
return {
|
|
1267
|
+
id: u.id ?? u._id ?? u.userId ?? u.sub ?? "",
|
|
1268
|
+
email: u.email ?? "",
|
|
1269
|
+
username: u.username,
|
|
1270
|
+
name,
|
|
1271
|
+
roles: u.roles ?? []
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1264
1274
|
var AuthModule = class {
|
|
1265
1275
|
constructor(http, tokenManager, config) {
|
|
1266
1276
|
this.stateListeners = /* @__PURE__ */ new Set();
|
|
@@ -1384,11 +1394,12 @@ var AuthModule = class {
|
|
|
1384
1394
|
});
|
|
1385
1395
|
}
|
|
1386
1396
|
async getProfile() {
|
|
1387
|
-
|
|
1397
|
+
const data = await this.http.request({
|
|
1388
1398
|
method: "GET",
|
|
1389
1399
|
path: "/auth/me",
|
|
1390
1400
|
authenticated: true
|
|
1391
1401
|
});
|
|
1402
|
+
return mapProfile(data.user ?? data);
|
|
1392
1403
|
}
|
|
1393
1404
|
async logout() {
|
|
1394
1405
|
try {
|