@gleif-it/vlei-verifier-workflows
Version:
Workflows for vLEI users and vLEI credentials for the vLEI-verifier service
36 lines (35 loc) • 1.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WorkflowState = void 0;
const handle_json_config_js_1 = require("./utils/handle-json-config.js");
const constants_js_1 = require("./constants.js");
class WorkflowState {
constructor(configJson) {
this.schemas = constants_js_1.SCHEMAS;
this.rules = constants_js_1.RULES;
this.clients = new Map();
this.aids = new Map();
this.oobis = new Map();
this.credentialsInfo = new Map();
this.registries = new Map();
this.credentials = new Map();
this.aidsInfo = new Map();
this.kargsAID = constants_js_1.witnessIds.length > 0 ? { toad: constants_js_1.witnessIds.length, wits: constants_js_1.witnessIds } : {};
this.configJson = configJson;
this.credentialsInfo = (0, handle_json_config_js_1.buildCredentials)(configJson);
}
static getInstance(configJson = null) {
if (!WorkflowState.instance) {
if (!configJson)
throw 'WorkflowState.getInstance: no configJson was provided';
WorkflowState.instance = new WorkflowState(configJson);
}
return WorkflowState.instance;
}
static resetInstance() {
if (WorkflowState.instance) {
WorkflowState.instance = new WorkflowState(WorkflowState.instance.configJson);
}
}
}
exports.WorkflowState = WorkflowState;