boostr
Version:
Build and deploy your Layr apps
33 lines • 1.05 kB
JavaScript
import { logMessage, logError, throwError } from '../utilities.js';
export class BaseResource {
constructor(config, { serviceName } = {}) {
this._serviceName = serviceName;
this._config = this.normalizeConfig(config);
}
getConfig() {
return this._config;
}
normalizeConfig(config) {
const { domainName } = config;
if (!domainName) {
this.throwError(`A 'domainName' property is required in the configuration`);
}
return { domainName };
}
getServiceName() {
return this._serviceName;
}
async initialize() { }
// === Utilities ===
logMessage(message) {
logMessage(message, { serviceName: this.getServiceName() });
}
logError(message) {
logError(message, { serviceName: this.getServiceName() });
}
throwError(message) {
throwError(message, { serviceName: this.getServiceName() });
}
}
BaseResource.managerIdentifiers = ['boostr-v1', 'simple-deployment-v1'];
//# sourceMappingURL=base.js.map