UNPKG

unleash-server

Version:

Unleash is an enterprise ready feature flag service. It provides different strategies for handling feature flags.

27 lines 926 B
import Joi from 'joi'; const { ValidationError } = Joi; import { generateImageUrl } from '../util/generateImageUrl.js'; export class User { constructor({ id, name, email, username, imageUrl, seenAt, loginAttempts, createdAt, isService, scimId, }) { this.isAPI = false; this.accountType = 'User'; if (!id) { throw new ValidationError('Id is required', [], undefined); } this.id = id; this.name = name; this.username = username; this.email = email; this.imageUrl = imageUrl || this.generateImageUrl(); this.seenAt = seenAt; this.loginAttempts = loginAttempts; this.createdAt = createdAt; this.accountType = isService ? 'Service Account' : 'User'; this.scimId = scimId; } generateImageUrl() { return generateImageUrl(this); } } export default User; //# sourceMappingURL=user.js.map