@storm-software/k8s-tools
Version:
Tools for managing Kubernetes (k8s) infrastructure within a Nx workspace.
22 lines (18 loc) • 730 B
JavaScript
;Object.defineProperty(exports, "__esModule", {value: true});// src/utils/ensure-init.ts
var ensureInitialized = (target, propertyKey, descriptor) => {
const originalMethod = descriptor.value;
descriptor.value = async function(...arguments_) {
const self = this;
if (self.initialized === void 0 || typeof self.initialize !== "function") {
throw new TypeError(
`The ensureInitialized decorator can only be applied in classes with an 'initialized' property and 'initialize' method.`
);
}
if (!self.initialized) {
await self.initialize();
}
return originalMethod.apply(this, arguments_);
};
return descriptor;
};
exports.ensureInitialized = ensureInitialized;