UNPKG

@vulcan-sql/extension-store-canner

Version:

Canner persistence store for Vulcan SQL

28 lines 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getIndicatorFilesOfWorkspaces = exports.indicatorPathPattern = exports.vulcanFolderPathPattern = void 0; const tslib_1 = require("tslib"); const lodash_1 = require("lodash"); // The pattern for listing vulcansql folder path exports.vulcanFolderPathPattern = new RegExp('([a-zA-Z0-9-]+)/vulcansql'); // The pattern for finding indicator.json file from vulcansql folder exports.indicatorPathPattern = new RegExp(`${exports.vulcanFolderPathPattern.source.replace('\\', '')}/indicator.json`); /** * Get the indicator files path of each workspaces * @param filesInfo files info from storage service * @returns the indicator files path of each workspaces */ const getIndicatorFilesOfWorkspaces = (filesInfo) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { const filePaths = (0, lodash_1.chain)(filesInfo) .filter((fileInfo) => exports.indicatorPathPattern.test(fileInfo.name)) .map((fileInfo) => { return { name: fileInfo.name, workspaceId: exports.vulcanFolderPathPattern.exec(fileInfo.name)[1], }; }) .value(); return filePaths; }); exports.getIndicatorFilesOfWorkspaces = getIndicatorFilesOfWorkspaces; //# sourceMappingURL=utils.js.map