@static-suite/static-suite-data-server 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +4 -0
- package/.eslintrc.json +49 -0
- package/.nvmrc +1 -0
- package/.prettierrc +10 -0
- package/.vscode/launch.json +44 -0
- package/LICENSE.txt +339 -0
- package/README.md +300 -0
- package/__mocks__/clear-module.js +7 -0
- package/api-extractor.json +339 -0
- package/dist/bin/serve.d.ts +3 -0
- package/dist/bin/serve.d.ts.map +1 -0
- package/dist/bin/serve.js +105 -0
- package/dist/http/README.md +300 -0
- package/dist/http/httpServer.d.ts +4 -0
- package/dist/http/httpServer.d.ts.map +1 -0
- package/dist/http/httpServer.js +24 -0
- package/dist/http/public/assets/bulma/bulma-tooltip.min.css +2 -0
- package/dist/http/public/assets/bulma/bulma.min.css +1 -0
- package/dist/http/public/assets/clipboard/clipboard.min.js +7 -0
- package/dist/http/public/assets/simple-datatables/index.js +12 -0
- package/dist/http/public/assets/simple-datatables/style.css +173 -0
- package/dist/http/routes/cache.d.ts +4 -0
- package/dist/http/routes/cache.d.ts.map +1 -0
- package/dist/http/routes/cache.js +19 -0
- package/dist/http/routes/data.d.ts +4 -0
- package/dist/http/routes/data.d.ts.map +1 -0
- package/dist/http/routes/data.js +104 -0
- package/dist/http/routes/docs.d.ts +3 -0
- package/dist/http/routes/docs.d.ts.map +1 -0
- package/dist/http/routes/docs.js +14 -0
- package/dist/http/routes/dump.d.ts +8 -0
- package/dist/http/routes/dump.d.ts.map +1 -0
- package/dist/http/routes/dump.js +57 -0
- package/dist/http/routes/home.d.ts +3 -0
- package/dist/http/routes/home.d.ts.map +1 -0
- package/dist/http/routes/home.js +17 -0
- package/dist/http/routes/index.d.ts +3 -0
- package/dist/http/routes/index.d.ts.map +1 -0
- package/dist/http/routes/index.js +33 -0
- package/dist/http/routes/query.d.ts +5 -0
- package/dist/http/routes/query.d.ts.map +1 -0
- package/dist/http/routes/query.js +21 -0
- package/dist/http/routes/status.d.ts +9 -0
- package/dist/http/routes/status.d.ts.map +1 -0
- package/dist/http/routes/status.js +74 -0
- package/dist/http/routes/task.d.ts +5 -0
- package/dist/http/routes/task.d.ts.map +1 -0
- package/dist/http/routes/task.js +22 -0
- package/dist/http/views/cacheClear.pug +17 -0
- package/dist/http/views/cacheIndex.pug +19 -0
- package/dist/http/views/data.pug +68 -0
- package/dist/http/views/docs.pug +7 -0
- package/dist/http/views/dumpIndex.pug +14 -0
- package/dist/http/views/home.pug +15 -0
- package/dist/http/views/includes/layout.pug +23 -0
- package/dist/http/views/queryIndex.pug +17 -0
- package/dist/http/views/statusIndex.pug +14 -0
- package/dist/http/views/taskIndex.pug +17 -0
- package/dist/lib/config/config.d.ts +26 -0
- package/dist/lib/config/config.d.ts.map +1 -0
- package/dist/lib/config/config.js +122 -0
- package/dist/lib/config/config.types.d.ts +74 -0
- package/dist/lib/config/config.types.d.ts.map +1 -0
- package/dist/lib/config/config.types.js +2 -0
- package/dist/lib/config/error/InvalidRunMode.d.ts +15 -0
- package/dist/lib/config/error/InvalidRunMode.d.ts.map +1 -0
- package/dist/lib/config/error/InvalidRunMode.js +20 -0
- package/dist/lib/config/error/MissingDirectory.d.ts +24 -0
- package/dist/lib/config/error/MissingDirectory.d.ts.map +1 -0
- package/dist/lib/config/error/MissingDirectory.js +23 -0
- package/dist/lib/config/error/MissingRequiredOption.d.ts +19 -0
- package/dist/lib/config/error/MissingRequiredOption.d.ts.map +1 -0
- package/dist/lib/config/error/MissingRequiredOption.js +21 -0
- package/dist/lib/config/error/NonWritableDirectory.d.ts +24 -0
- package/dist/lib/config/error/NonWritableDirectory.d.ts.map +1 -0
- package/dist/lib/config/error/NonWritableDirectory.js +23 -0
- package/dist/lib/config/error/index.d.ts +5 -0
- package/dist/lib/config/error/index.d.ts.map +1 -0
- package/dist/lib/config/error/index.js +16 -0
- package/dist/lib/config/index.d.ts +2 -0
- package/dist/lib/config/index.d.ts.map +1 -0
- package/dist/lib/config/index.js +13 -0
- package/dist/lib/dataServer.d.ts +21 -0
- package/dist/lib/dataServer.d.ts.map +1 -0
- package/dist/lib/dataServer.js +56 -0
- package/dist/lib/dataServer.types.d.ts +84 -0
- package/dist/lib/dataServer.types.d.ts.map +1 -0
- package/dist/lib/dataServer.types.js +13 -0
- package/dist/lib/error/DomainError.d.ts +9 -0
- package/dist/lib/error/DomainError.d.ts.map +1 -0
- package/dist/lib/error/DomainError.js +20 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +15 -0
- package/dist/lib/query/index.d.ts +3 -0
- package/dist/lib/query/index.d.ts.map +1 -0
- package/dist/lib/query/index.js +14 -0
- package/dist/lib/query/query.types.d.ts +206 -0
- package/dist/lib/query/query.types.d.ts.map +1 -0
- package/dist/lib/query/query.types.js +21 -0
- package/dist/lib/query/queryManager.d.ts +10 -0
- package/dist/lib/query/queryManager.d.ts.map +1 -0
- package/dist/lib/query/queryManager.js +12 -0
- package/dist/lib/query/queryRunner copy.d.ts +3 -0
- package/dist/lib/query/queryRunner copy.d.ts.map +1 -0
- package/dist/lib/query/queryRunner copy.js +87 -0
- package/dist/lib/query/queryRunner.d.ts +3 -0
- package/dist/lib/query/queryRunner.d.ts.map +1 -0
- package/dist/lib/query/queryRunner.js +96 -0
- package/dist/lib/query/queryTagManager.d.ts +3 -0
- package/dist/lib/query/queryTagManager.d.ts.map +1 -0
- package/dist/lib/query/queryTagManager.js +47 -0
- package/dist/lib/store/dataDir/dataDir.types.d.ts +36 -0
- package/dist/lib/store/dataDir/dataDir.types.d.ts.map +1 -0
- package/dist/lib/store/dataDir/dataDir.types.js +2 -0
- package/dist/lib/store/dataDir/dataDirManager.d.ts +3 -0
- package/dist/lib/store/dataDir/dataDirManager.d.ts.map +1 -0
- package/dist/lib/store/dataDir/dataDirManager.js +97 -0
- package/dist/lib/store/dataDir/index.d.ts +2 -0
- package/dist/lib/store/dataDir/index.d.ts.map +1 -0
- package/dist/lib/store/dataDir/index.js +13 -0
- package/dist/lib/store/dependency/dependency.types.d.ts +70 -0
- package/dist/lib/store/dependency/dependency.types.d.ts.map +1 -0
- package/dist/lib/store/dependency/dependency.types.js +2 -0
- package/dist/lib/store/dependency/dependencyFileHelper.d.ts +6 -0
- package/dist/lib/store/dependency/dependencyFileHelper.d.ts.map +1 -0
- package/dist/lib/store/dependency/dependencyFileHelper.js +46 -0
- package/dist/lib/store/dependency/dependencyManager copy.d.ts +6 -0
- package/dist/lib/store/dependency/dependencyManager copy.d.ts.map +1 -0
- package/dist/lib/store/dependency/dependencyManager copy.js +91 -0
- package/dist/lib/store/dependency/dependencyManager.d.ts +6 -0
- package/dist/lib/store/dependency/dependencyManager.d.ts.map +1 -0
- package/dist/lib/store/dependency/dependencyManager.js +78 -0
- package/dist/lib/store/dependency/dependencyManager.types.d.ts +48 -0
- package/dist/lib/store/dependency/dependencyManager.types.d.ts.map +1 -0
- package/dist/lib/store/dependency/dependencyManager.types.js +2 -0
- package/dist/lib/store/dependency/dependencyTagManager.d.ts +6 -0
- package/dist/lib/store/dependency/dependencyTagManager.d.ts.map +1 -0
- package/dist/lib/store/dependency/dependencyTagManager.js +33 -0
- package/dist/lib/store/dependency/dependencyTagger.d.ts +11 -0
- package/dist/lib/store/dependency/dependencyTagger.d.ts.map +1 -0
- package/dist/lib/store/dependency/dependencyTagger.js +99 -0
- package/dist/lib/store/diff/diffManager.d.ts +3 -0
- package/dist/lib/store/diff/diffManager.d.ts.map +1 -0
- package/dist/lib/store/diff/diffManager.js +114 -0
- package/dist/lib/store/diff/diffManager.types.d.ts +50 -0
- package/dist/lib/store/diff/diffManager.types.d.ts.map +1 -0
- package/dist/lib/store/diff/diffManager.types.js +2 -0
- package/dist/lib/store/diff/index.d.ts +2 -0
- package/dist/lib/store/diff/index.d.ts.map +1 -0
- package/dist/lib/store/diff/index.js +13 -0
- package/dist/lib/store/diff/tracker.d.ts +3 -0
- package/dist/lib/store/diff/tracker.d.ts.map +1 -0
- package/dist/lib/store/diff/tracker.js +82 -0
- package/dist/lib/store/diff/tracker.types.d.ts +31 -0
- package/dist/lib/store/diff/tracker.types.d.ts.map +1 -0
- package/dist/lib/store/diff/tracker.types.js +2 -0
- package/dist/lib/store/dump/dumpManager.d.ts +3 -0
- package/dist/lib/store/dump/dumpManager.d.ts.map +1 -0
- package/dist/lib/store/dump/dumpManager.js +199 -0
- package/dist/lib/store/dump/dumpManager.types.d.ts +62 -0
- package/dist/lib/store/dump/dumpManager.types.d.ts.map +1 -0
- package/dist/lib/store/dump/dumpManager.types.js +2 -0
- package/dist/lib/store/dump/index.d.ts +2 -0
- package/dist/lib/store/dump/index.d.ts.map +1 -0
- package/dist/lib/store/dump/index.js +13 -0
- package/dist/lib/store/hook/hook.types.d.ts +205 -0
- package/dist/lib/store/hook/hook.types.d.ts.map +1 -0
- package/dist/lib/store/hook/hook.types.js +2 -0
- package/dist/lib/store/hook/hookManager.d.ts +6 -0
- package/dist/lib/store/hook/hookManager.d.ts.map +1 -0
- package/dist/lib/store/hook/hookManager.js +168 -0
- package/dist/lib/store/hook/index.d.ts +2 -0
- package/dist/lib/store/hook/index.d.ts.map +1 -0
- package/dist/lib/store/hook/index.js +13 -0
- package/dist/lib/store/include/includeIndex.d.ts +6 -0
- package/dist/lib/store/include/includeIndex.d.ts.map +1 -0
- package/dist/lib/store/include/includeIndex.js +65 -0
- package/dist/lib/store/include/includeIndex.types.d.ts +29 -0
- package/dist/lib/store/include/includeIndex.types.d.ts.map +1 -0
- package/dist/lib/store/include/includeIndex.types.js +2 -0
- package/dist/lib/store/include/includeParser.d.ts +3 -0
- package/dist/lib/store/include/includeParser.d.ts.map +1 -0
- package/dist/lib/store/include/includeParser.js +46 -0
- package/dist/lib/store/include/includeParser.types.d.ts +88 -0
- package/dist/lib/store/include/includeParser.types.d.ts.map +1 -0
- package/dist/lib/store/include/includeParser.types.js +2 -0
- package/dist/lib/store/include/index.d.ts +2 -0
- package/dist/lib/store/include/index.d.ts.map +1 -0
- package/dist/lib/store/include/index.js +13 -0
- package/dist/lib/store/include/parsers/configIncludeParser.d.ts +3 -0
- package/dist/lib/store/include/parsers/configIncludeParser.d.ts.map +1 -0
- package/dist/lib/store/include/parsers/configIncludeParser.js +8 -0
- package/dist/lib/store/include/parsers/customIncludeParser.d.ts +3 -0
- package/dist/lib/store/include/parsers/customIncludeParser.d.ts.map +1 -0
- package/dist/lib/store/include/parsers/customIncludeParser.js +8 -0
- package/dist/lib/store/include/parsers/entityIncludeParser.d.ts +3 -0
- package/dist/lib/store/include/parsers/entityIncludeParser.d.ts.map +1 -0
- package/dist/lib/store/include/parsers/entityIncludeParser.js +13 -0
- package/dist/lib/store/include/parsers/index.d.ts +6 -0
- package/dist/lib/store/include/parsers/index.d.ts.map +1 -0
- package/dist/lib/store/include/parsers/index.js +17 -0
- package/dist/lib/store/include/parsers/localeIncludeParser.d.ts +3 -0
- package/dist/lib/store/include/parsers/localeIncludeParser.d.ts.map +1 -0
- package/dist/lib/store/include/parsers/localeIncludeParser.js +8 -0
- package/dist/lib/store/include/parsers/queryIncludeParser.d.ts +11 -0
- package/dist/lib/store/include/parsers/queryIncludeParser.d.ts.map +1 -0
- package/dist/lib/store/include/parsers/queryIncludeParser.js +45 -0
- package/dist/lib/store/include/parsers/types/aliasIncludeParser.d.ts +3 -0
- package/dist/lib/store/include/parsers/types/aliasIncludeParser.d.ts.map +1 -0
- package/dist/lib/store/include/parsers/types/aliasIncludeParser.js +10 -0
- package/dist/lib/store/include/parsers/types/aliasWithoutTypeIncludeParser.d.ts +8 -0
- package/dist/lib/store/include/parsers/types/aliasWithoutTypeIncludeParser.d.ts.map +1 -0
- package/dist/lib/store/include/parsers/types/aliasWithoutTypeIncludeParser.js +18 -0
- package/dist/lib/store/index.d.ts +2 -0
- package/dist/lib/store/index.d.ts.map +1 -0
- package/dist/lib/store/index.js +13 -0
- package/dist/lib/store/store.d.ts +7 -0
- package/dist/lib/store/store.d.ts.map +1 -0
- package/dist/lib/store/store.js +89 -0
- package/dist/lib/store/store.types.d.ts +231 -0
- package/dist/lib/store/store.types.d.ts.map +1 -0
- package/dist/lib/store/store.types.js +2 -0
- package/dist/lib/store/storeManager.d.ts +3 -0
- package/dist/lib/store/storeManager.d.ts.map +1 -0
- package/dist/lib/store/storeManager.js +149 -0
- package/dist/lib/store/workDir/index.d.ts +2 -0
- package/dist/lib/store/workDir/index.d.ts.map +1 -0
- package/dist/lib/store/workDir/index.js +13 -0
- package/dist/lib/store/workDir/storage/getChangedLinesSince.d.ts +9 -0
- package/dist/lib/store/workDir/storage/getChangedLinesSince.d.ts.map +1 -0
- package/dist/lib/store/workDir/storage/getChangedLinesSince.js +47 -0
- package/dist/lib/store/workDir/storage/getDataFromLogLine.d.ts +10 -0
- package/dist/lib/store/workDir/storage/getDataFromLogLine.d.ts.map +1 -0
- package/dist/lib/store/workDir/storage/getDataFromLogLine.js +33 -0
- package/dist/lib/store/workDir/storage/getLogFile.d.ts +8 -0
- package/dist/lib/store/workDir/storage/getLogFile.d.ts.map +1 -0
- package/dist/lib/store/workDir/storage/getLogFile.js +11 -0
- package/dist/lib/store/workDir/storage/index.d.ts +4 -0
- package/dist/lib/store/workDir/storage/index.d.ts.map +1 -0
- package/dist/lib/store/workDir/storage/index.js +20 -0
- package/dist/lib/store/workDir/workDir.types.d.ts +44 -0
- package/dist/lib/store/workDir/workDir.types.d.ts.map +1 -0
- package/dist/lib/store/workDir/workDir.types.js +2 -0
- package/dist/lib/store/workDir/workDirHelper.d.ts +20 -0
- package/dist/lib/store/workDir/workDirHelper.d.ts.map +1 -0
- package/dist/lib/store/workDir/workDirHelper.js +52 -0
- package/dist/lib/task/index.d.ts +3 -0
- package/dist/lib/task/index.d.ts.map +1 -0
- package/dist/lib/task/index.js +14 -0
- package/dist/lib/task/task.types.d.ts +140 -0
- package/dist/lib/task/task.types.d.ts.map +1 -0
- package/dist/lib/task/task.types.js +11 -0
- package/dist/lib/task/taskManager.d.ts +10 -0
- package/dist/lib/task/taskManager.d.ts.map +1 -0
- package/dist/lib/task/taskManager.js +12 -0
- package/dist/lib/task/taskRunner.d.ts +3 -0
- package/dist/lib/task/taskRunner.d.ts.map +1 -0
- package/dist/lib/task/taskRunner.js +71 -0
- package/dist/lib/tsdoc-metadata.json +11 -0
- package/dist/lib/utils/array/arrayUtils.d.ts +2 -0
- package/dist/lib/utils/array/arrayUtils.d.ts.map +1 -0
- package/dist/lib/utils/array/arrayUtils.js +11 -0
- package/dist/lib/utils/cache/cacheBinManager.d.ts +37 -0
- package/dist/lib/utils/cache/cacheBinManager.d.ts.map +1 -0
- package/dist/lib/utils/cache/cacheBinManager.js +53 -0
- package/dist/lib/utils/cache/index.d.ts +2 -0
- package/dist/lib/utils/cache/index.d.ts.map +1 -0
- package/dist/lib/utils/cache/index.js +13 -0
- package/dist/lib/utils/fs/fs.types.d.ts +20 -0
- package/dist/lib/utils/fs/fs.types.d.ts.map +1 -0
- package/dist/lib/utils/fs/fs.types.js +2 -0
- package/dist/lib/utils/fs/fsUtils.d.ts +62 -0
- package/dist/lib/utils/fs/fsUtils.d.ts.map +1 -0
- package/dist/lib/utils/fs/fsUtils.js +137 -0
- package/dist/lib/utils/fs/index.d.ts +2 -0
- package/dist/lib/utils/fs/index.d.ts.map +1 -0
- package/dist/lib/utils/fs/index.js +13 -0
- package/dist/lib/utils/logger/index.d.ts +2 -0
- package/dist/lib/utils/logger/index.d.ts.map +1 -0
- package/dist/lib/utils/logger/index.js +13 -0
- package/dist/lib/utils/logger/logger.d.ts +32 -0
- package/dist/lib/utils/logger/logger.d.ts.map +1 -0
- package/dist/lib/utils/logger/logger.js +82 -0
- package/dist/lib/utils/logger/logger.types.d.ts +37 -0
- package/dist/lib/utils/logger/logger.types.d.ts.map +1 -0
- package/dist/lib/utils/logger/logger.types.js +15 -0
- package/dist/lib/utils/module/dirBasedModuleGroupManager.d.ts +30 -0
- package/dist/lib/utils/module/dirBasedModuleGroupManager.d.ts.map +1 -0
- package/dist/lib/utils/module/dirBasedModuleGroupManager.js +78 -0
- package/dist/lib/utils/module/index.d.ts +3 -0
- package/dist/lib/utils/module/index.d.ts.map +1 -0
- package/dist/lib/utils/module/index.js +14 -0
- package/dist/lib/utils/module/module.types.d.ts +53 -0
- package/dist/lib/utils/module/module.types.d.ts.map +1 -0
- package/dist/lib/utils/module/module.types.js +2 -0
- package/dist/lib/utils/module/moduleManager.d.ts +64 -0
- package/dist/lib/utils/module/moduleManager.d.ts.map +1 -0
- package/dist/lib/utils/module/moduleManager.js +139 -0
- package/dist/lib/utils/object/index.d.ts +2 -0
- package/dist/lib/utils/object/index.d.ts.map +1 -0
- package/dist/lib/utils/object/index.js +13 -0
- package/dist/lib/utils/object/object.types.d.ts +72 -0
- package/dist/lib/utils/object/object.types.d.ts.map +1 -0
- package/dist/lib/utils/object/object.types.js +2 -0
- package/dist/lib/utils/object/objectUtils.d.ts +45 -0
- package/dist/lib/utils/object/objectUtils.d.ts.map +1 -0
- package/dist/lib/utils/object/objectUtils.js +64 -0
- package/dist/lib/utils/string/index.d.ts +2 -0
- package/dist/lib/utils/string/index.d.ts.map +1 -0
- package/dist/lib/utils/string/index.js +13 -0
- package/dist/lib/utils/string/string.types.d.ts +2 -0
- package/dist/lib/utils/string/string.types.d.ts.map +1 -0
- package/dist/lib/utils/string/string.types.js +2 -0
- package/dist/lib/utils/string/stringUtils.d.ts +37 -0
- package/dist/lib/utils/string/stringUtils.d.ts.map +1 -0
- package/dist/lib/utils/string/stringUtils.js +62 -0
- package/dist/lib/watcher/index.d.ts +2 -0
- package/dist/lib/watcher/index.d.ts.map +1 -0
- package/dist/lib/watcher/index.js +13 -0
- package/dist/lib/watcher/watcher.d.ts +17 -0
- package/dist/lib/watcher/watcher.d.ts.map +1 -0
- package/dist/lib/watcher/watcher.js +65 -0
- package/dist/static-suite-data-server.d.ts +392 -0
- package/package.json +102 -0
- package/scripts/copy-http-files-to-src.js +45 -0
- package/src/__tests__/fixtures/data/en/en.json +3 -0
- package/src/__tests__/fixtures/data/en/entity/entity.json +3 -0
- package/src/__tests__/fixtures/data/en/entity/node/article/article1--card.json +3 -0
- package/src/__tests__/fixtures/data/en/entity/node/article/article1--small.json +3 -0
- package/src/__tests__/fixtures/data/en/entity/node/article/article1.json +40 -0
- package/src/__tests__/fixtures/data/en/entity/node/article/article2--card.json +3 -0
- package/src/__tests__/fixtures/data/en/entity/node/article/article2--small.json +3 -0
- package/src/__tests__/fixtures/data/en/entity/node/article/article2.json +40 -0
- package/src/__tests__/fixtures/data/en/entity/node/article/article3--card.json +3 -0
- package/src/__tests__/fixtures/data/en/entity/node/article/article3--small.json +3 -0
- package/src/__tests__/fixtures/data/en/entity/node/article/article3.json +7 -0
- package/src/__tests__/fixtures/data/en/entity/node/node.json +3 -0
- package/src/__tests__/fixtures/data/en/entity/node/page/page1--card.json +3 -0
- package/src/__tests__/fixtures/data/en/entity/node/page/page1--small.json +3 -0
- package/src/__tests__/fixtures/data/en/entity/node/page/page1.json +3 -0
- package/src/__tests__/fixtures/data/en/entity/node/page/page2--card.json +3 -0
- package/src/__tests__/fixtures/data/en/entity/node/page/page2--small.json +3 -0
- package/src/__tests__/fixtures/data/en/entity/node/page/page2.json +3 -0
- package/src/__tests__/fixtures/data/global--block.json +3 -0
- package/src/__tests__/fixtures/data/global.json +3 -0
- package/src/__tests__/fixtures/hook/main.hook.js +15 -0
- package/src/__tests__/fixtures/hook/taxonomy/main.hook.js +15 -0
- package/src/__tests__/fixtures/hook/taxonomy/taxo.hook.js +15 -0
- package/src/__tests__/fixtures/query/error.query.js +6 -0
- package/src/__tests__/fixtures/query/noHandler.query.js +14 -0
- package/src/__tests__/fixtures/query/query1.query.js +15 -0
- package/src/__tests__/fixtures/query/query2.query.js +14 -0
- package/src/__tests__/fixtures/query/wrongNamequery.js +14 -0
- package/src/__tests__/fixtures/task/error.task.js +6 -0
- package/src/__tests__/fixtures/task/noHandler.task.js +13 -0
- package/src/__tests__/fixtures/task/task1.task.js +14 -0
- package/src/__tests__/fixtures/task/task2.task.js +13 -0
- package/src/__tests__/fixtures/task/wrongNametask.js +13 -0
- package/src/bin/serve.ts +107 -0
- package/src/http/httpServer.ts +21 -0
- package/src/http/routes/cache.ts +17 -0
- package/src/http/routes/data.ts +114 -0
- package/src/http/routes/docs.ts +9 -0
- package/src/http/routes/dump.ts +61 -0
- package/src/http/routes/home.ts +16 -0
- package/src/http/routes/index.ts +47 -0
- package/src/http/routes/query.ts +27 -0
- package/src/http/routes/status.ts +89 -0
- package/src/http/routes/task.ts +29 -0
- package/src/http/views/cacheClear.pug +17 -0
- package/src/http/views/cacheIndex.pug +19 -0
- package/src/http/views/data.pug +68 -0
- package/src/http/views/docs.pug +7 -0
- package/src/http/views/dumpIndex.pug +14 -0
- package/src/http/views/home.pug +15 -0
- package/src/http/views/includes/layout.pug +23 -0
- package/src/http/views/queryIndex.pug +17 -0
- package/src/http/views/statusIndex.pug +14 -0
- package/src/http/views/taskIndex.pug +17 -0
- package/src/lib/config/__tests__/config.test.ts +132 -0
- package/src/lib/config/config.ts +143 -0
- package/src/lib/config/config.types.ts +87 -0
- package/src/lib/config/error/InvalidRunMode.ts +17 -0
- package/src/lib/config/error/MissingDirectory.ts +30 -0
- package/src/lib/config/error/MissingRequiredOption.ts +23 -0
- package/src/lib/config/error/NonWritableDirectory.ts +30 -0
- package/src/lib/config/error/index.ts +4 -0
- package/src/lib/config/index.ts +1 -0
- package/src/lib/dataServer.ts +81 -0
- package/src/lib/dataServer.types.ts +98 -0
- package/src/lib/error/DomainError.ts +18 -0
- package/src/lib/index.ts +4 -0
- package/src/lib/query/__tests__/queryRunner.test.ts +61 -0
- package/src/lib/query/index.ts +2 -0
- package/src/lib/query/query.types.ts +231 -0
- package/src/lib/query/queryManager.ts +11 -0
- package/src/lib/query/queryRunner.ts +110 -0
- package/src/lib/query/queryTagManager.ts +53 -0
- package/src/lib/store/dataDir/__tests__/dataDirManager.test.ts +15 -0
- package/src/lib/store/dataDir/dataDir.types.ts +38 -0
- package/src/lib/store/dataDir/dataDirManager.ts +121 -0
- package/src/lib/store/dataDir/index.ts +1 -0
- package/src/lib/store/dependency/dependency.types.ts +78 -0
- package/src/lib/store/dependency/dependencyFileHelper.ts +50 -0
- package/src/lib/store/dependency/dependencyManager.ts +82 -0
- package/src/lib/store/dependency/dependencyTagger.ts +105 -0
- package/src/lib/store/diff/diffManager.ts +122 -0
- package/src/lib/store/diff/diffManager.types.ts +51 -0
- package/src/lib/store/diff/index.ts +1 -0
- package/src/lib/store/dump/dumpManager.ts +235 -0
- package/src/lib/store/dump/dumpManager.types.ts +61 -0
- package/src/lib/store/dump/index.ts +1 -0
- package/src/lib/store/hook/hook.types.ts +232 -0
- package/src/lib/store/hook/hookManager.ts +180 -0
- package/src/lib/store/hook/index.ts +1 -0
- package/src/lib/store/include/__tests__/includeParser.test.ts +80 -0
- package/src/lib/store/include/includeParser.ts +54 -0
- package/src/lib/store/include/includeParser.types.ts +99 -0
- package/src/lib/store/include/index.ts +1 -0
- package/src/lib/store/include/parsers/__tests__/entityIncludeParser.test.ts +43 -0
- package/src/lib/store/include/parsers/configIncludeParser.ts +8 -0
- package/src/lib/store/include/parsers/customIncludeParser.ts +8 -0
- package/src/lib/store/include/parsers/entityIncludeParser.ts +15 -0
- package/src/lib/store/include/parsers/index.ts +5 -0
- package/src/lib/store/include/parsers/localeIncludeParser.ts +8 -0
- package/src/lib/store/include/parsers/queryIncludeParser.ts +51 -0
- package/src/lib/store/include/parsers/types/__tests__/aliasIncludeParser.test.ts +37 -0
- package/src/lib/store/include/parsers/types/__tests__/aliasWithoutTypeIncludeParser.test.ts +43 -0
- package/src/lib/store/include/parsers/types/aliasIncludeParser.ts +13 -0
- package/src/lib/store/include/parsers/types/aliasWithoutTypeIncludeParser.ts +22 -0
- package/src/lib/store/index.ts +1 -0
- package/src/lib/store/store.ts +105 -0
- package/src/lib/store/store.types.ts +251 -0
- package/src/lib/store/storeManager.ts +187 -0
- package/src/lib/store/workDir/__tests__/workDirHelper.test.ts +25 -0
- package/src/lib/store/workDir/index.ts +1 -0
- package/src/lib/store/workDir/storage/__tests__/getChangedLinesSince.test.ts +23 -0
- package/src/lib/store/workDir/storage/__tests__/getDataFromLogLine.test.ts +21 -0
- package/src/lib/store/workDir/storage/getChangedLinesSince.ts +47 -0
- package/src/lib/store/workDir/storage/getDataFromLogLine.ts +31 -0
- package/src/lib/store/workDir/storage/getLogFile.ts +11 -0
- package/src/lib/store/workDir/storage/index.ts +8 -0
- package/src/lib/store/workDir/workDir.types.ts +48 -0
- package/src/lib/store/workDir/workDirHelper.ts +59 -0
- package/src/lib/task/__tests__/taskRunner.test.ts +47 -0
- package/src/lib/task/index.ts +2 -0
- package/src/lib/task/task.types.ts +151 -0
- package/src/lib/task/taskManager.ts +11 -0
- package/src/lib/task/taskRunner.ts +79 -0
- package/src/lib/utils/array/__tests__/arrayUtils.test.ts +16 -0
- package/src/lib/utils/array/arrayUtils.ts +7 -0
- package/src/lib/utils/cache/__tests__/cache.test.ts +24 -0
- package/src/lib/utils/cache/cacheBinManager.ts +88 -0
- package/src/lib/utils/cache/index.ts +1 -0
- package/src/lib/utils/fs/__tests__/fixtures/file.json +3 -0
- package/src/lib/utils/fs/__tests__/fixtures/file.txt +3 -0
- package/src/lib/utils/fs/__tests__/fsUtils.test.ts +93 -0
- package/src/lib/utils/fs/fs.types.ts +21 -0
- package/src/lib/utils/fs/fsUtils.ts +141 -0
- package/src/lib/utils/fs/index.ts +1 -0
- package/src/lib/utils/logger/__tests__/logger.test.ts +12 -0
- package/src/lib/utils/logger/index.ts +1 -0
- package/src/lib/utils/logger/logger.ts +87 -0
- package/src/lib/utils/logger/logger.types.ts +41 -0
- package/src/lib/utils/module/__mocks__/dummyModule.query.js +4 -0
- package/src/lib/utils/module/__mocks__/dummyModule2.query.js +4 -0
- package/src/lib/utils/module/__tests__/dirBasedModuleGroupManager.test.ts +34 -0
- package/src/lib/utils/module/__tests__/moduleHandler.test.ts +100 -0
- package/src/lib/utils/module/dirBasedModuleGroupManager.ts +78 -0
- package/src/lib/utils/module/index.ts +2 -0
- package/src/lib/utils/module/module.types.ts +57 -0
- package/src/lib/utils/module/moduleManager.ts +144 -0
- package/src/lib/utils/object/__tests__/objectUtils.test.ts +62 -0
- package/src/lib/utils/object/index.ts +1 -0
- package/src/lib/utils/object/object.types.ts +74 -0
- package/src/lib/utils/object/objectUtils.ts +71 -0
- package/src/lib/utils/string/__tests__/stringUtils.test.ts +30 -0
- package/src/lib/utils/string/index.ts +1 -0
- package/src/lib/utils/string/string.types.ts +1 -0
- package/src/lib/utils/string/stringUtils.ts +61 -0
- package/src/lib/watcher/index.ts +1 -0
- package/src/lib/watcher/watcher.ts +66 -0
- package/tsconfig.json +83 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getChangedLinesSince = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const logger_1 = require("@lib/utils/logger");
|
|
9
|
+
const getLogFile_1 = require("./getLogFile");
|
|
10
|
+
/**
|
|
11
|
+
* Get changed files since a date.
|
|
12
|
+
*
|
|
13
|
+
* @param sinceDate - Date to search
|
|
14
|
+
|
|
15
|
+
* @returns Array of changed lines
|
|
16
|
+
*/
|
|
17
|
+
const getChangedLinesSince = (sinceDate) => {
|
|
18
|
+
let allLines = [];
|
|
19
|
+
const logFile = (0, getLogFile_1.getLogFile)();
|
|
20
|
+
if (logFile) {
|
|
21
|
+
try {
|
|
22
|
+
allLines = fs_1.default.readFileSync(logFile).toString().split('\n');
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
logger_1.logger.error(`Error reading metadata log file located at ${`logFile`}: ${e}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// todo - Do not use dates and use timestamps in all cases
|
|
29
|
+
// to avoid having to fix offsets.
|
|
30
|
+
const date = new Date();
|
|
31
|
+
const dateOffset = -(date.getTimezoneOffset() * 60 * 1000);
|
|
32
|
+
const changedLines = allLines.filter(line => {
|
|
33
|
+
const uniqueId = line.substring(0, 32);
|
|
34
|
+
if (!uniqueId) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const dateString = uniqueId.replace(/(\d{4})-(\d{2})-(\d{2})_(\d{2})-(\d{2})-(\d{2})\.(\d{3}).*/, '$1-$2-$3T$4:$5:$6.$7');
|
|
38
|
+
const uniqueIdDate = Date.parse(dateString) + dateOffset;
|
|
39
|
+
return uniqueIdDate && uniqueIdDate > sinceDate.getTime();
|
|
40
|
+
});
|
|
41
|
+
logger_1.logger.debug(`Found ${changedLines.length} changed lines`);
|
|
42
|
+
changedLines.forEach(line => {
|
|
43
|
+
logger_1.logger.debug(`Found changed line: ${line}`);
|
|
44
|
+
});
|
|
45
|
+
return changedLines;
|
|
46
|
+
};
|
|
47
|
+
exports.getChangedLinesSince = getChangedLinesSince;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LogLineData } from '../workDir.types';
|
|
2
|
+
/**
|
|
3
|
+
* Extract information from Static Suite's log line.
|
|
4
|
+
*
|
|
5
|
+
* @param line - Log line.
|
|
6
|
+
*
|
|
7
|
+
* @returns An object with parsed data, or null if line format is not valid.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getDataFromLogLine: (line: string) => LogLineData | null;
|
|
10
|
+
//# sourceMappingURL=getDataFromLogLine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDataFromLogLine.d.ts","sourceRoot":"","sources":["../../../../../src/lib/store/workDir/storage/getDataFromLogLine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,SAAU,MAAM,KAAG,WAAW,GAAG,IAqB/D,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDataFromLogLine = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Extract information from Static Suite's log line.
|
|
6
|
+
*
|
|
7
|
+
* @param line - Log line.
|
|
8
|
+
*
|
|
9
|
+
* @returns An object with parsed data, or null if line format is not valid.
|
|
10
|
+
*/
|
|
11
|
+
const getDataFromLogLine = (line) => {
|
|
12
|
+
const matches = line.match(/^(\S+) (\S+) \[ID: ([^\]]+)] (.+)/);
|
|
13
|
+
if (matches) {
|
|
14
|
+
const uniqueId = matches[1];
|
|
15
|
+
const operation = matches[2];
|
|
16
|
+
const fileId = matches[3];
|
|
17
|
+
const [fileLabel, uri] = matches[4].split(' | ');
|
|
18
|
+
const [, uriTarget] = uri.split('://');
|
|
19
|
+
if (operation === 'write' || operation === 'delete') {
|
|
20
|
+
return {
|
|
21
|
+
uniqueId,
|
|
22
|
+
operation,
|
|
23
|
+
file: {
|
|
24
|
+
id: fileId,
|
|
25
|
+
label: fileLabel,
|
|
26
|
+
relativePath: uriTarget,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
};
|
|
33
|
+
exports.getDataFromLogLine = getDataFromLogLine;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLogFile.d.ts","sourceRoot":"","sources":["../../../../../src/lib/store/workDir/storage/getLogFile.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,QAAA,MAAM,UAAU,QAAO,MAAM,GAAG,IAC+B,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLogFile = void 0;
|
|
4
|
+
const config_1 = require("@lib/config");
|
|
5
|
+
/**
|
|
6
|
+
* Gets the absolute path to Static Suite's log file.
|
|
7
|
+
*
|
|
8
|
+
* @returns The absolute path to Static Suite's log file.
|
|
9
|
+
*/
|
|
10
|
+
const getLogFile = () => config_1.config.workDir ? `${config_1.config.workDir}/lock-executed.log` : null;
|
|
11
|
+
exports.getLogFile = getLogFile;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/store/workDir/storage/index.ts"],"names":[],"mappings":"AAKA,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
/*
|
|
14
|
+
These functions are separated from workDirHelper, since they are specific
|
|
15
|
+
to the current storage backend (log files saved on disk) and they can change
|
|
16
|
+
in the future.
|
|
17
|
+
*/
|
|
18
|
+
__exportStar(require("./getChangedLinesSince"), exports);
|
|
19
|
+
__exportStar(require("./getDataFromLogLine"), exports);
|
|
20
|
+
__exportStar(require("./getLogFile"), exports);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A group of changed files in Static Suite's data dir.
|
|
3
|
+
*/
|
|
4
|
+
export declare type ChangedFiles = {
|
|
5
|
+
/**
|
|
6
|
+
* A list of updated files (both newly added and changed files).
|
|
7
|
+
*/
|
|
8
|
+
updated: string[];
|
|
9
|
+
/**
|
|
10
|
+
* A list of deleted files.
|
|
11
|
+
*/
|
|
12
|
+
deleted: string[];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Information from a Static Suite's log line.
|
|
16
|
+
*/
|
|
17
|
+
export declare type LogLineData = {
|
|
18
|
+
/**
|
|
19
|
+
* The unique ID of the write/delete operation from Static Suite.
|
|
20
|
+
*/
|
|
21
|
+
uniqueId: string;
|
|
22
|
+
/**
|
|
23
|
+
* The type of operation executed in the log line.
|
|
24
|
+
*/
|
|
25
|
+
operation: 'write' | 'delete';
|
|
26
|
+
/**
|
|
27
|
+
* Information about the affected file
|
|
28
|
+
*/
|
|
29
|
+
file: {
|
|
30
|
+
/**
|
|
31
|
+
* File ID, a string identifying the file in a meaningful way, usually a numeric ID
|
|
32
|
+
*/
|
|
33
|
+
id: string;
|
|
34
|
+
/**
|
|
35
|
+
* A long text identifying the file in a meaningful way, usually the content title.
|
|
36
|
+
*/
|
|
37
|
+
label: string;
|
|
38
|
+
/**
|
|
39
|
+
* Relative file path inside data dir.
|
|
40
|
+
*/
|
|
41
|
+
relativePath: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=workDir.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workDir.types.d.ts","sourceRoot":"","sources":["../../../../src/lib/store/workDir/workDir.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,YAAY,GAAG;IACzB;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,oBAAY,WAAW,GAAG;IACxB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,EAAE,OAAO,GAAG,QAAQ,CAAC;IAE9B;;OAEG;IACH,IAAI,EAAE;QACJ;;WAEG;QACH,EAAE,EAAE,MAAM,CAAC;QAEX;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ChangedFiles } from './workDir.types';
|
|
2
|
+
export declare const workDirHelper: {
|
|
3
|
+
/**
|
|
4
|
+
* Gets date of last modification of work directory.
|
|
5
|
+
*
|
|
6
|
+
* @returns The date of last modification of work directory, or null if directory not found.
|
|
7
|
+
*/
|
|
8
|
+
getModificationDate: () => Date | null;
|
|
9
|
+
/**
|
|
10
|
+
* Get changed files since a date.
|
|
11
|
+
*
|
|
12
|
+
* @param sinceDate - Date to search
|
|
13
|
+
*
|
|
14
|
+
* @returns Object with two properties:
|
|
15
|
+
* - updated: array of changed files.
|
|
16
|
+
* - deleted: array of deleted files.
|
|
17
|
+
*/
|
|
18
|
+
getChangedFilesSince: (sinceDate: Date) => ChangedFiles;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=workDirHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workDirHelper.d.ts","sourceRoot":"","sources":["../../../../src/lib/store/workDir/workDirHelper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAe,MAAM,iBAAiB,CAAC;AAO5D,eAAO,MAAM,aAAa;IACxB;;;;OAIG;+BACsB,IAAI,GAAG,IAAI;IAKpC;;;;;;;;OAQG;sCAC+B,IAAI,KAAG,YAAY;CA6BtD,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.workDirHelper = void 0;
|
|
4
|
+
const fs_1 = require("@lib/utils/fs");
|
|
5
|
+
const logger_1 = require("@lib/utils/logger");
|
|
6
|
+
const storage_1 = require("./storage");
|
|
7
|
+
exports.workDirHelper = {
|
|
8
|
+
/**
|
|
9
|
+
* Gets date of last modification of work directory.
|
|
10
|
+
*
|
|
11
|
+
* @returns The date of last modification of work directory, or null if directory not found.
|
|
12
|
+
*/
|
|
13
|
+
getModificationDate: () => {
|
|
14
|
+
const logFile = (0, storage_1.getLogFile)();
|
|
15
|
+
return logFile ? (0, fs_1.getModificationDate)(logFile) : null;
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* Get changed files since a date.
|
|
19
|
+
*
|
|
20
|
+
* @param sinceDate - Date to search
|
|
21
|
+
*
|
|
22
|
+
* @returns Object with two properties:
|
|
23
|
+
* - updated: array of changed files.
|
|
24
|
+
* - deleted: array of deleted files.
|
|
25
|
+
*/
|
|
26
|
+
getChangedFilesSince: (sinceDate) => {
|
|
27
|
+
const changedLines = (0, storage_1.getChangedLinesSince)(sinceDate);
|
|
28
|
+
const lineData = {};
|
|
29
|
+
changedLines.forEach(line => {
|
|
30
|
+
const dataFromLogLine = (0, storage_1.getDataFromLogLine)(line);
|
|
31
|
+
if (dataFromLogLine) {
|
|
32
|
+
// Save lines keyed by its relativePath so only the last
|
|
33
|
+
// operation on the same file is processed.
|
|
34
|
+
lineData[dataFromLogLine.file.relativePath] = dataFromLogLine;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const lineDataArray = Object.values(lineData);
|
|
38
|
+
const updated = lineDataArray
|
|
39
|
+
.filter(data => data.operation === 'write')
|
|
40
|
+
.map(data => data.file.relativePath);
|
|
41
|
+
updated.forEach(file => {
|
|
42
|
+
logger_1.logger.debug(`Found updated file "${file}"`);
|
|
43
|
+
});
|
|
44
|
+
const deleted = lineDataArray
|
|
45
|
+
.filter(data => data.operation === 'delete')
|
|
46
|
+
.map(data => data.file.relativePath);
|
|
47
|
+
deleted.forEach(file => {
|
|
48
|
+
logger_1.logger.debug(`Found deleted file "${file}"`);
|
|
49
|
+
});
|
|
50
|
+
return { updated, deleted };
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/task/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./taskManager"), exports);
|
|
14
|
+
__exportStar(require("./taskRunner"), exports);
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Store } from '@lib/store/store.types';
|
|
2
|
+
/**
|
|
3
|
+
* A service to handle the execution of tasks.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare type TaskRunner = {
|
|
8
|
+
/**
|
|
9
|
+
* Runs a task and returns its results with metadata.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* It checks several validations before a task is run, and then task is executed.
|
|
13
|
+
*
|
|
14
|
+
* It logs an error and throws an exception if any problem occurs during the
|
|
15
|
+
* task execution.
|
|
16
|
+
*
|
|
17
|
+
* @param taskId - Task ID (filename without extension and suffix) of the task
|
|
18
|
+
* to be executed. @see {@link ModuleInfo#id | Definition of a module ID}
|
|
19
|
+
* @param args - Optional object with task arguments.
|
|
20
|
+
*
|
|
21
|
+
* @returns The result of the task as a JSON object with data and metadata keys,
|
|
22
|
+
* or an error response if some validation is not met.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* Here's a result example:
|
|
26
|
+
* ```
|
|
27
|
+
* {
|
|
28
|
+
* data: ['title 1', 'title 2'],
|
|
29
|
+
* metadata: {
|
|
30
|
+
* contentType: 'application/json',
|
|
31
|
+
* execTime: 2,
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
|
|
36
|
+
* @throws
|
|
37
|
+
* Exception thrown if any problem occurs during the task execution.
|
|
38
|
+
*/
|
|
39
|
+
run(taskId: string, args: TaskArgs): TaskSuccessfulResponse | TaskErrorResponse;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* An object with task arguments.
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
export declare type TaskArgs = Record<string, any>;
|
|
47
|
+
/**
|
|
48
|
+
* The result that a task returns after being executed.
|
|
49
|
+
*/
|
|
50
|
+
export declare type TaskModuleResult = {
|
|
51
|
+
/**
|
|
52
|
+
* A result, which can be of any kind (and array, an object, a string, etc)
|
|
53
|
+
*/
|
|
54
|
+
result: any;
|
|
55
|
+
/**
|
|
56
|
+
* Optional content type for the data available in "result"
|
|
57
|
+
*
|
|
58
|
+
* @remarks
|
|
59
|
+
* Data coming from the task can be anything (XML, a string, etc).
|
|
60
|
+
* This content type is added to the metadata section of the TaskResponse.
|
|
61
|
+
* @see {@link TaskSuccessfulResponse#metadata}.
|
|
62
|
+
*
|
|
63
|
+
* @defaultValue 'application/json'
|
|
64
|
+
*/
|
|
65
|
+
contentType?: string;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* A successful response returned after executing a task.
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* It takes the results from a TaskModule#taskHandler, and wraps them into an
|
|
72
|
+
* structure with metadata. @see {@link TaskModule#default}
|
|
73
|
+
*
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
export declare type TaskSuccessfulResponse = {
|
|
77
|
+
/**
|
|
78
|
+
* Data returned by the task. @see {@link TaskModule#default}
|
|
79
|
+
*/
|
|
80
|
+
data: any;
|
|
81
|
+
/**
|
|
82
|
+
* Task metadata
|
|
83
|
+
*/
|
|
84
|
+
metadata: {
|
|
85
|
+
/**
|
|
86
|
+
* Content type for the data available in "data"
|
|
87
|
+
*
|
|
88
|
+
* @remarks
|
|
89
|
+
* Even thought this structure is a JSON object, data coming from the
|
|
90
|
+
* task can be anything (XML, a string, etc). It must be specified so any
|
|
91
|
+
* consumer of this data knows what is being returned.
|
|
92
|
+
*/
|
|
93
|
+
contentType: string;
|
|
94
|
+
/**
|
|
95
|
+
* Execution time taken by the task, in milliseconds.
|
|
96
|
+
*/
|
|
97
|
+
execTimeMs: number;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* A module that defines a task.
|
|
102
|
+
*/
|
|
103
|
+
export declare type TaskModule = {
|
|
104
|
+
/**
|
|
105
|
+
* The handler that executes a task.
|
|
106
|
+
*
|
|
107
|
+
* @remarks
|
|
108
|
+
* It receives the store data and a set of arguments, executes the task
|
|
109
|
+
* and returns its results.
|
|
110
|
+
*
|
|
111
|
+
* @param options - An object with options for the task: store and args
|
|
112
|
+
*/
|
|
113
|
+
default(options: {
|
|
114
|
+
store: Store;
|
|
115
|
+
args: TaskArgs;
|
|
116
|
+
}): TaskModuleResult;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* An error response returned after executing a task.
|
|
120
|
+
*
|
|
121
|
+
* @remarks
|
|
122
|
+
* It takes an string from TaskModule#taskHandler, and wraps them into an
|
|
123
|
+
* structure with metadata. @see {@link TaskModule#default}
|
|
124
|
+
*
|
|
125
|
+
* @public
|
|
126
|
+
*/
|
|
127
|
+
export declare type TaskErrorResponse = {
|
|
128
|
+
/**
|
|
129
|
+
* Error message from the task, usually coming from a failed validation.
|
|
130
|
+
*/
|
|
131
|
+
error: string;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Tells whether a task response is erroneous or not.
|
|
135
|
+
*
|
|
136
|
+
* @param taskResponse - A response (successful or erroneous) from the task handler.
|
|
137
|
+
* @returns True if taskResponse is erroneous.
|
|
138
|
+
*/
|
|
139
|
+
export declare const isTaskErrorResponse: (taskResponse: TaskSuccessfulResponse | TaskErrorResponse) => taskResponse is TaskErrorResponse;
|
|
140
|
+
//# sourceMappingURL=task.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.types.d.ts","sourceRoot":"","sources":["../../../src/lib/task/task.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C;;;;GAIG;AACH,oBAAY,UAAU,GAAG;IACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,GAAG,CACD,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,QAAQ,GACb,sBAAsB,GAAG,iBAAiB,CAAC;CAC/C,CAAC;AAEF;;;;GAIG;AACH,oBAAY,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE3C;;GAEG;AACH,oBAAY,gBAAgB,GAAG;IAC7B;;OAEG;IACH,MAAM,EAAE,GAAG,CAAC;IAEZ;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;;;GAQG;AACH,oBAAY,sBAAsB,GAAG;IACnC;;OAEG;IACH,IAAI,EAAE,GAAG,CAAC;IAEV;;OAEG;IACH,QAAQ,EAAE;QACR;;;;;;;WAOG;QACH,WAAW,EAAE,MAAM,CAAC;QAEpB;;WAEG;QACH,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,oBAAY,UAAU,GAAG;IACvB;;;;;;;;OAQG;IACH,OAAO,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,GAAG,gBAAgB,CAAC;CACtE,CAAC;AACF;;;;;;;;GAQG;AACH,oBAAY,iBAAiB,GAAG;IAC9B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,iBAChB,sBAAsB,GAAG,iBAAiB,sCAED,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTaskErrorResponse = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Tells whether a task response is erroneous or not.
|
|
6
|
+
*
|
|
7
|
+
* @param taskResponse - A response (successful or erroneous) from the task handler.
|
|
8
|
+
* @returns True if taskResponse is erroneous.
|
|
9
|
+
*/
|
|
10
|
+
const isTaskErrorResponse = (taskResponse) => taskResponse.error !== undefined;
|
|
11
|
+
exports.isTaskErrorResponse = isTaskErrorResponse;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TaskModule } from './task.types';
|
|
2
|
+
/**
|
|
3
|
+
* A manager for tasks stored in a user-land directory defined by configuration.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* It extends dirBasedModuleGroupManager, which manages groups of modules based
|
|
7
|
+
* on a directory: @see {@link dirBasedModuleGroupManager}
|
|
8
|
+
*/
|
|
9
|
+
export declare const taskManager: import("../utils/module/module.types").ModuleGroupManager<TaskModule>;
|
|
10
|
+
//# sourceMappingURL=taskManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taskManager.d.ts","sourceRoot":"","sources":["../../../src/lib/task/taskManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,uEAAiD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.taskManager = void 0;
|
|
4
|
+
const module_1 = require("@lib/utils/module");
|
|
5
|
+
/**
|
|
6
|
+
* A manager for tasks stored in a user-land directory defined by configuration.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* It extends dirBasedModuleGroupManager, which manages groups of modules based
|
|
10
|
+
* on a directory: @see {@link dirBasedModuleGroupManager}
|
|
11
|
+
*/
|
|
12
|
+
exports.taskManager = (0, module_1.dirBasedModuleGroupManager)('task');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taskRunner.d.ts","sourceRoot":"","sources":["../../../src/lib/task/taskRunner.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,UAAU,EAIX,MAAM,cAAc,CAAC;AAkBtB,eAAO,MAAM,UAAU,EAAE,UAkDxB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.taskRunner = void 0;
|
|
7
|
+
const microtime_1 = __importDefault(require("microtime"));
|
|
8
|
+
const config_1 = require("@lib/config");
|
|
9
|
+
const store_1 = require("@lib/store");
|
|
10
|
+
const logger_1 = require("@lib/utils/logger");
|
|
11
|
+
const taskManager_1 = require("./taskManager");
|
|
12
|
+
let count = 0;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a TaskErrorResponse object ready to be returned to clients.
|
|
15
|
+
*
|
|
16
|
+
* @param message - Error message
|
|
17
|
+
*
|
|
18
|
+
* @returns A JSON object with an error key
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
const createErrorResponse = (message) => {
|
|
23
|
+
logger_1.logger.error(message);
|
|
24
|
+
return { error: message };
|
|
25
|
+
};
|
|
26
|
+
exports.taskRunner = {
|
|
27
|
+
run: (taskId, args) => {
|
|
28
|
+
if (!config_1.config.taskDir) {
|
|
29
|
+
return createErrorResponse('No task directory ("taskDir") configured');
|
|
30
|
+
}
|
|
31
|
+
if (!taskId) {
|
|
32
|
+
return createErrorResponse('No task ID received');
|
|
33
|
+
}
|
|
34
|
+
const taskModuleInfo = taskManager_1.taskManager.getModuleGroupInfo().get(taskId);
|
|
35
|
+
if (!taskModuleInfo) {
|
|
36
|
+
return createErrorResponse(`Task module for ID ${taskId} not found`);
|
|
37
|
+
}
|
|
38
|
+
count += 1;
|
|
39
|
+
const startDate = microtime_1.default.now();
|
|
40
|
+
const argsString = JSON.stringify(args);
|
|
41
|
+
logger_1.logger.debug(`#${count} Task started: "${taskId}", args "${argsString}"`);
|
|
42
|
+
const taskResult = {
|
|
43
|
+
result: undefined,
|
|
44
|
+
contentType: undefined,
|
|
45
|
+
};
|
|
46
|
+
try {
|
|
47
|
+
const taskModule = taskModuleInfo.getModule();
|
|
48
|
+
const taskResponse = taskModule.default({
|
|
49
|
+
store: store_1.store,
|
|
50
|
+
args,
|
|
51
|
+
});
|
|
52
|
+
taskResult.result = taskResponse?.result;
|
|
53
|
+
taskResult.contentType = taskResponse?.contentType || 'application/json';
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
// Log error and rethrow.
|
|
57
|
+
logger_1.logger.error(`#${count} Task error: "${taskId}", args "${argsString}": ${e}`);
|
|
58
|
+
throw e;
|
|
59
|
+
}
|
|
60
|
+
const execTimeMs = (microtime_1.default.now() - startDate) / 1000;
|
|
61
|
+
const response = {
|
|
62
|
+
data: taskResult.result,
|
|
63
|
+
metadata: {
|
|
64
|
+
contentType: taskResult.contentType || 'application/json',
|
|
65
|
+
execTimeMs,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
logger_1.logger.debug(`#${count} Task "${taskId}" took ${execTimeMs} ms.`);
|
|
69
|
+
return response;
|
|
70
|
+
},
|
|
71
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.18.19"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrayUtils.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/array/arrayUtils.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,QAAS,GAAG,EAAE,SAAS,GAAG,KAAG,IAK3D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arrayRemoveByValue = void 0;
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
5
|
+
const arrayRemoveByValue = (arr, value) => {
|
|
6
|
+
const index = arr.indexOf(value);
|
|
7
|
+
if (index !== -1) {
|
|
8
|
+
arr.splice(index, 1);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
exports.arrayRemoveByValue = arrayRemoveByValue;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare type CacheBin<Type> = Map<string, Type>;
|
|
2
|
+
export declare type Cache = {
|
|
3
|
+
/**
|
|
4
|
+
* Gets a cache bin by its id.
|
|
5
|
+
*
|
|
6
|
+
* @param binId - The id of the bin.
|
|
7
|
+
* @returns The cache bin.
|
|
8
|
+
*/
|
|
9
|
+
bin<Type>(binId: string): CacheBin<Type>;
|
|
10
|
+
/**
|
|
11
|
+
* Returns a boolean indicating whether a cache bin
|
|
12
|
+
* with the specified key exists or not.
|
|
13
|
+
*
|
|
14
|
+
* @param binId - The id of the bin.
|
|
15
|
+
* @returns True if the cache bin exists, false otherwise.
|
|
16
|
+
*/
|
|
17
|
+
has(binId: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Gets an array of keys of all available cache bins.
|
|
20
|
+
*
|
|
21
|
+
* @returns An array of cache bin keys.
|
|
22
|
+
*/
|
|
23
|
+
keys(): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Clears all available cache bins.
|
|
26
|
+
*/
|
|
27
|
+
clear(): void;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Cache system based on specialized bins.
|
|
31
|
+
*
|
|
32
|
+
* All cache items belong to a specific bin ("file", "query", etc),
|
|
33
|
+
* which is a kind of "folder" or "directory" where data belonging
|
|
34
|
+
* to the same context/domain is stored altogether.
|
|
35
|
+
*/
|
|
36
|
+
export declare const cache: Cache;
|
|
37
|
+
//# sourceMappingURL=cacheBinManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheBinManager.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/cache/cacheBinManager.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAE/C,oBAAY,KAAK,GAAG;IAClB;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;;;OAMG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAE5B;;;;OAIG;IACH,IAAI,IAAI,MAAM,EAAE,CAAC;IAEjB;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAoBF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,KA6BnB,CAAC"}
|