UNPKG

@voximplant/voxengine-ci

Version:

Manage Voximplant Platform `applications`, `rules` and `scenarios` from your own environment

66 lines (65 loc) 3.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AbstractPersistentRepository = void 0; const node_path_1 = require("node:path"); const log_message_generator_1 = require("../../utils/log-message-generator"); class AbstractPersistentRepository { constructor(context) { this.context = context; this.lmg = log_message_generator_1.LogMessageGeneratorFactory.getInstance(); this.init = async () => { await this.context.client.createDirectory(this.relativeStoragePath); await this.context.client.createMetadataDirectory(this.relativeStoragePath); console.info(this.lmg.generate('INFO__INIT_SUCCESS', this.constructor.name)); }; this.link = async () => { await this.context.client.createDirectory(this.relativeStoragePath); }; this.linkMetadata = async () => { await this.context.client.createMetadataDirectory(this.relativeStoragePath); }; this.unlink = async () => { await this.context.client.removeDirectory(this.relativeStoragePath); }; this.unlinkMetadata = async () => { await this.context.client.removeMetadataDirectory(this.relativeStoragePath); }; this.checkStorageExists = (path = '.') => { const joinedPath = (0, node_path_1.join)(this.relativeStoragePath, path); return this.context.client.checkExists(joinedPath); }; this.createStorage = async (path) => { const joinedPath = (0, node_path_1.join)(this.relativeStoragePath, path); await this.context.client.createDirectory(joinedPath); }; this.createMetadataStorage = async (path) => { const joinedPath = (0, node_path_1.join)(this.relativeStoragePath, path); await this.context.client.createMetadataDirectory(joinedPath); }; this.readStorage = async (path = '.') => { const joinedPath = (0, node_path_1.join)(this.relativeStoragePath, path); return await this.context.client.readDirectory(joinedPath); }; this.readMetadataStorage = async (path = '.') => { const joinedPath = (0, node_path_1.join)(this.relativeStoragePath, path); return await this.context.client.readMetadataDirectory(joinedPath); }; this.removeStorage = async (path) => { const joinedPath = (0, node_path_1.join)(this.relativeStoragePath, path); await this.context.client.removeDirectory(joinedPath); }; this.removeMetadataStorage = async (path) => { const joinedPath = (0, node_path_1.join)(this.relativeStoragePath, path); await this.context.client.removeMetadataDirectory(joinedPath); }; this.remove = async (path) => { const joinedPath = (0, node_path_1.join)(this.relativeStoragePath, path); await this.context.client.removeFile(joinedPath); }; this.removeMetadata = async (path) => { const joinedPath = (0, node_path_1.join)(this.relativeStoragePath, path); await this.context.client.removeMetadataFile(joinedPath); }; } } exports.AbstractPersistentRepository = AbstractPersistentRepository;