@5minds/processcube_engine
Version:
The ProcessCube Engine. Stores and executes BPMNs.
82 lines • 4.06 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApplicationInfoService = void 0;
const fs_1 = __importDefault(require("fs"));
const inversify_1 = require("inversify");
const path_1 = __importDefault(require("path"));
const Contracts_1 = require("../../Contracts");
const Configurator_1 = __importDefault(require("../../Tools/Configurator"));
const IamService_1 = require("../../Tools/Iam/IamService");
let ApplicationInfoService = class ApplicationInfoService {
applicationInfo;
iamService;
container;
extensionInfoServiceProxy;
constructor(iamService, container) {
this.iamService = iamService;
this.container = container;
this.extensionInfoServiceProxy = null;
}
init() {
this.extensionInfoServiceProxy = this.container.get(Contracts_1.IocRegistrationKeys.internal.ExtensionInfoServiceProxy);
}
async getApplicationInfo() {
if (!this.applicationInfo) {
this.readApplicationPackageJson();
}
if (this.extensionInfoServiceProxy) {
this.applicationInfo.loadedExtensions = await this.extensionInfoServiceProxy.getLoadedExtensions();
}
return this.applicationInfo;
}
async getAuthorityAddress() {
return this.iamService.getAuthorityAddress();
}
readApplicationPackageJson() {
const appRootDir = Configurator_1.default.get('appRootDir');
const pathToPackageJson = path_1.default.resolve(appRootDir, 'package.json');
const packageJson = this.getPackageJsonContent(pathToPackageJson);
const applicationConfig = Configurator_1.default.application();
const engineName = applicationConfig?.name || process.env.name || '5Minds Engine';
const iamConfig = Configurator_1.default.iam();
const extraInfo = Configurator_1.default.get('extraInfo');
this.applicationInfo = {
id: applicationConfig.id,
name: engineName,
packageName: packageJson.name,
version: packageJson.version,
authorityUrl: iamConfig.baseUrl,
allowAnonymousRootAccess: iamConfig.allowAnonymousRootAccess,
loadedExtensions: [],
extraInfo: extraInfo,
};
}
getPackageJsonContent(pathToPackageJson) {
const packageJsonAsString = fs_1.default.readFileSync(pathToPackageJson, 'utf-8');
const packageJson = JSON.parse(packageJsonAsString);
return packageJson;
}
};
exports.ApplicationInfoService = ApplicationInfoService;
exports.ApplicationInfoService = ApplicationInfoService = __decorate([
(0, inversify_1.injectable)(),
__param(0, (0, inversify_1.inject)(Contracts_1.IocRegistrationKeys.internal.IamService)),
__param(1, (0, inversify_1.inject)(Contracts_1.IocRegistrationKeys.internal.Container)),
__metadata("design:paramtypes", [IamService_1.IamService, inversify_1.Container])
], ApplicationInfoService);
//# sourceMappingURL=ApplicationInfoService.js.map