kuzzle-sdk
Version:
Official Javascript SDK for Kuzzle
53 lines • 1.25 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.User = void 0;
class User {
/**
*
* @param {Kuzzle} kuzzle
* @param {Object} data
*/
constructor(kuzzle, _id = null, content = {}) {
Reflect.defineProperty(this, "_kuzzle", {
value: kuzzle,
});
Reflect.defineProperty(this, "content", {
enumerable: true,
get() {
return this._source;
},
});
this._id = _id;
this._source = content;
}
get kuzzle() {
return this._kuzzle;
}
/**
* Array of profile IDs
*/
get profileIds() {
return this._source.profileIds || [];
}
/**
* Gets user profile definitions from the API
*/
getProfiles() {
if (!this.profileIds || this.profileIds.length === 0) {
return Promise.resolve([]);
}
return this.kuzzle.security.mGetProfiles(this.profileIds);
}
/**
* Serialize the instance
*/
serialize() {
return {
_id: this._id,
_source: this._source,
};
}
}
exports.User = User;
module.exports = { User };
//# sourceMappingURL=User.js.map
;