unleash-server
Version:
Unleash is an enterprise ready feature flag service. It provides different strategies for handling feature flags.
24 lines • 781 B
JavaScript
import pkg from 'joi';
const { ValidationError } = pkg;
import { CLIENT } from './permissions.js';
export class ApiUser {
constructor({ permissions = [CLIENT], projects, project, environment, type, secret, tokenName, }) {
this.isAPI = true;
if (!tokenName) {
throw new ValidationError('tokenName is required', [], undefined);
}
this.username = tokenName;
this.permissions = permissions;
this.environment = environment;
this.type = type;
this.secret = secret;
if (projects && projects.length > 0) {
this.projects = projects;
}
else {
this.projects = project ? [project] : [];
}
}
}
export default ApiUser;
//# sourceMappingURL=api-user.js.map