@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,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.statusDiff = exports.statusIndexCustom = exports.statusIndexUuid = exports.statusIndexUrl = exports.statusBasic = exports.statusIndex = void 0;
|
|
4
|
+
const dataDir_1 = require("@lib/store/dataDir");
|
|
5
|
+
const query_1 = require("@lib/query");
|
|
6
|
+
const config_1 = require("@lib/config");
|
|
7
|
+
const cache_1 = require("@lib/utils/cache");
|
|
8
|
+
const store_1 = require("@lib/store");
|
|
9
|
+
const object_1 = require("@lib/utils/object");
|
|
10
|
+
const diffManager_1 = require("@lib/store/diff/diffManager");
|
|
11
|
+
const dependencyManager_1 = require("@lib/store/dependency/dependencyManager");
|
|
12
|
+
const dependencyTagger_1 = require("@lib/store/dependency/dependencyTagger");
|
|
13
|
+
const statusIndex = (req, res) => {
|
|
14
|
+
res.render('statusIndex', {
|
|
15
|
+
links: {
|
|
16
|
+
'/status/basic': 'Basic status info',
|
|
17
|
+
'/status/index/url': 'List of indexed URLs',
|
|
18
|
+
'/status/index/uuid': 'List of indexed UUIDs by language',
|
|
19
|
+
'/status/index/include': 'List of indexed includes',
|
|
20
|
+
'/status/index/custom': 'List of custom indexes',
|
|
21
|
+
'/status/diff': 'Executes a diff operation',
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
exports.statusIndex = statusIndex;
|
|
26
|
+
const statusBasic = (req, res) => {
|
|
27
|
+
dataDir_1.dataDirManager.update();
|
|
28
|
+
const response = {
|
|
29
|
+
config: config_1.config,
|
|
30
|
+
dataDirLastUpdate: dataDir_1.dataDirManager.getModificationDate(),
|
|
31
|
+
query: {
|
|
32
|
+
numberOfExecutions: query_1.queryRunner.getCount(),
|
|
33
|
+
numberOfCachedQueries: cache_1.cache.bin('query').size,
|
|
34
|
+
},
|
|
35
|
+
dependencyTree: (0, object_1.jsonify)(dependencyTagger_1.dependencyTree),
|
|
36
|
+
reversedDependencyTree: (0, object_1.jsonify)((0, dependencyTagger_1.getReversedDependencyTree)()),
|
|
37
|
+
invalidatedFilepaths: dependencyManager_1.dependencyManager.getInvalidatedFilepaths(),
|
|
38
|
+
};
|
|
39
|
+
res.status(200);
|
|
40
|
+
res.set({ 'Content-Type': 'application/json' });
|
|
41
|
+
res.send(response);
|
|
42
|
+
};
|
|
43
|
+
exports.statusBasic = statusBasic;
|
|
44
|
+
const statusIndexUrl = (req, res) => {
|
|
45
|
+
const response = Array.from(store_1.store.index.url.keys());
|
|
46
|
+
res.status(200);
|
|
47
|
+
res.set({ 'Content-Type': 'application/json' });
|
|
48
|
+
res.send(response);
|
|
49
|
+
};
|
|
50
|
+
exports.statusIndexUrl = statusIndexUrl;
|
|
51
|
+
const statusIndexUuid = (req, res) => {
|
|
52
|
+
const response = {};
|
|
53
|
+
store_1.store.index.uuid.forEach((uuids, langcode) => {
|
|
54
|
+
response[langcode] = Array.from(uuids.keys());
|
|
55
|
+
});
|
|
56
|
+
res.status(200);
|
|
57
|
+
res.set({ 'Content-Type': 'application/json' });
|
|
58
|
+
res.send(response);
|
|
59
|
+
};
|
|
60
|
+
exports.statusIndexUuid = statusIndexUuid;
|
|
61
|
+
const statusIndexCustom = (req, res) => {
|
|
62
|
+
const response = Array.from(store_1.store.index.custom.keys());
|
|
63
|
+
res.status(200);
|
|
64
|
+
res.set({ 'Content-Type': 'application/json' });
|
|
65
|
+
res.send(response);
|
|
66
|
+
};
|
|
67
|
+
exports.statusIndexCustom = statusIndexCustom;
|
|
68
|
+
const statusDiff = (req, res) => {
|
|
69
|
+
const response = (0, object_1.jsonify)(diffManager_1.diffManager.getDiff());
|
|
70
|
+
res.status(200);
|
|
71
|
+
res.set({ 'Content-Type': 'application/json' });
|
|
72
|
+
res.send(response);
|
|
73
|
+
};
|
|
74
|
+
exports.statusDiff = statusDiff;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../../src/http/routes/task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAQ5C,QAAA,MAAM,SAAS,QAAS,OAAO,OAAO,QAAQ,KAAG,IAKhD,CAAC;AAEF,QAAA,MAAM,OAAO,QAAS,OAAO,OAAO,QAAQ,KAAG,IAW9C,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runTask = exports.taskIndex = void 0;
|
|
4
|
+
const dataDir_1 = require("@lib/store/dataDir");
|
|
5
|
+
const task_1 = require("@lib/task");
|
|
6
|
+
const taskIndex = (req, res) => {
|
|
7
|
+
const taskIds = Array.from(task_1.taskManager.getModuleGroupInfo().keys());
|
|
8
|
+
res.render('taskIndex', {
|
|
9
|
+
taskIds: taskIds.length > 0 ? taskIds.map(task => `/task/${task}`) : null,
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
exports.taskIndex = taskIndex;
|
|
13
|
+
const runTask = (req, res) => {
|
|
14
|
+
dataDir_1.dataDirManager.update();
|
|
15
|
+
const args = req.query;
|
|
16
|
+
const taskId = req.params[0];
|
|
17
|
+
const response = task_1.taskRunner.run(taskId, args);
|
|
18
|
+
res.status(200);
|
|
19
|
+
res.set('application/json');
|
|
20
|
+
res.send(response);
|
|
21
|
+
};
|
|
22
|
+
exports.runTask = runTask;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
extends includes/layout.pug
|
|
2
|
+
|
|
3
|
+
block vars
|
|
4
|
+
- var title = "Clear cache bin | Static Suite Data Server"
|
|
5
|
+
|
|
6
|
+
block breadcrumbs
|
|
7
|
+
li
|
|
8
|
+
a(href="/cache")="cache"
|
|
9
|
+
|
|
10
|
+
block content
|
|
11
|
+
h1(class="title is-1")=`Clear cache bin "${cacheBinId}"`
|
|
12
|
+
table(class="table is-fullwidth is-hoverable")
|
|
13
|
+
tbody
|
|
14
|
+
if done
|
|
15
|
+
p(href=cacheBinId)=`Cache bin "${cacheBinId}" cleared`
|
|
16
|
+
else
|
|
17
|
+
p=`Cache bin "${cacheBinId}" not found`
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
extends includes/layout.pug
|
|
2
|
+
|
|
3
|
+
block vars
|
|
4
|
+
- var title = "Available cache bins | Static Suite Data Server"
|
|
5
|
+
|
|
6
|
+
block content
|
|
7
|
+
h1(class="title is-1")="Available cache bins"
|
|
8
|
+
table(class="table is-fullwidth is-hoverable")
|
|
9
|
+
tbody
|
|
10
|
+
if cacheBins
|
|
11
|
+
each cacheBin in cacheBins
|
|
12
|
+
tr
|
|
13
|
+
td= cacheBin
|
|
14
|
+
td
|
|
15
|
+
a(href=`/cache/${cacheBin}/clear`)="Clear"
|
|
16
|
+
else
|
|
17
|
+
tr
|
|
18
|
+
td="No cache bins available"
|
|
19
|
+
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
extends includes/layout.pug
|
|
2
|
+
|
|
3
|
+
block vars
|
|
4
|
+
- var title = "Data | Static Suite Data Server"
|
|
5
|
+
|
|
6
|
+
block assets
|
|
7
|
+
link(rel='stylesheet', href='https://cdn.jsdelivr.net/npm/simple-datatables@latest/dist/style.css')
|
|
8
|
+
link(rel='stylesheet', href='https://cdn.jsdelivr.net/npm/bulma-tooltip@3.0.2/dist/css/bulma-tooltip.min.css')
|
|
9
|
+
script(src="https://cdn.jsdelivr.net/npm/simple-datatables@latest")
|
|
10
|
+
script(src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js")
|
|
11
|
+
|
|
12
|
+
script.
|
|
13
|
+
const dataTable = new simpleDatatables.DataTable("#data-table", {
|
|
14
|
+
paging: false
|
|
15
|
+
});
|
|
16
|
+
new ClipboardJS('#copy-to-clipboard');
|
|
17
|
+
|
|
18
|
+
block breadcrumbs
|
|
19
|
+
li
|
|
20
|
+
a(href="/data")="data"
|
|
21
|
+
each breadcrumb in breadcrumbs
|
|
22
|
+
li
|
|
23
|
+
a(href=`/data/${breadcrumb.url}`)=breadcrumb.title
|
|
24
|
+
|
|
25
|
+
block content
|
|
26
|
+
h1(class="title is-1" id="data-path")=`${path}`
|
|
27
|
+
span(class="icon is-medium ml-5")
|
|
28
|
+
button(id="copy-to-clipboard" class="button is-light" data-clipboard-text=`data${path}` style="padding-left:5px; padding-right:0" title="Copy to clipboard")
|
|
29
|
+
span(class="has-tooltip-arrow" data-tooltip="Copy to clipboard")
|
|
30
|
+
svg(xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 1024 896")
|
|
31
|
+
path(d="M128 768h256v64H128v-64z m320-384H128v64h320v-64z m128 192V448L384 640l192 192V704h320V576H576z m-288-64H128v64h160v-64zM128 704h160v-64H128v64z m576 64h64v128c-1 18-7 33-19 45s-27 18-45 19H64c-35 0-64-29-64-64V192c0-35 29-64 64-64h192C256 57 313 0 384 0s128 57 128 128h192c35 0 64 29 64 64v320h-64V320H64v576h640V768zM128 256h512c0-35-29-64-64-64h-64c-35 0-64-29-64-64s-29-64-64-64-64 29-64 64-29 64-64 64h-64c-35 0-64 29-64 64z")
|
|
32
|
+
h2(class="subtitle")=`${count} items`
|
|
33
|
+
|
|
34
|
+
table(id="data-table" class="table is-fullwidth is-striped is-hoverable")
|
|
35
|
+
thead
|
|
36
|
+
tr
|
|
37
|
+
th="Item"
|
|
38
|
+
th="Type"
|
|
39
|
+
if hasContentInfo
|
|
40
|
+
th="Id"
|
|
41
|
+
th="Entity Type"
|
|
42
|
+
th="Bundle"
|
|
43
|
+
th="Published"
|
|
44
|
+
th="Title"
|
|
45
|
+
th="Filename"
|
|
46
|
+
tbody
|
|
47
|
+
for item in items
|
|
48
|
+
tr
|
|
49
|
+
td
|
|
50
|
+
a(href=`/data/${base}${item.name}`)= item.name
|
|
51
|
+
td=item.type
|
|
52
|
+
if item.info
|
|
53
|
+
td=item.info.id
|
|
54
|
+
td=item.info.type
|
|
55
|
+
td=item.info.bundle
|
|
56
|
+
td=item.info.isPublished
|
|
57
|
+
td=item.info.title
|
|
58
|
+
td=item.info.filename
|
|
59
|
+
else if hasContentInfo
|
|
60
|
+
td
|
|
61
|
+
td
|
|
62
|
+
td
|
|
63
|
+
td
|
|
64
|
+
td
|
|
65
|
+
td
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
extends includes/layout.pug
|
|
2
|
+
|
|
3
|
+
block vars
|
|
4
|
+
- var title = "Dump | Static Suite Data Server"
|
|
5
|
+
|
|
6
|
+
block content
|
|
7
|
+
h1(class="title is-1")="Dump"
|
|
8
|
+
table(class="table is-fullwidth is-hoverable")
|
|
9
|
+
tbody
|
|
10
|
+
each description, link in links
|
|
11
|
+
tr
|
|
12
|
+
td
|
|
13
|
+
a(href=link)= link
|
|
14
|
+
td=description
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
extends includes/layout.pug
|
|
2
|
+
|
|
3
|
+
block vars
|
|
4
|
+
- var title = "Static Suite Data Server"
|
|
5
|
+
|
|
6
|
+
block content
|
|
7
|
+
h1(class="title is-1")="Static Suite Data Server"
|
|
8
|
+
h2(class="subtitle")="Table of Contents"
|
|
9
|
+
table(class="table is-fullwidth is-hoverable")
|
|
10
|
+
tbody
|
|
11
|
+
each description, link in links
|
|
12
|
+
tr
|
|
13
|
+
td
|
|
14
|
+
a(href=link)= link
|
|
15
|
+
td=description
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
html
|
|
3
|
+
block vars
|
|
4
|
+
head
|
|
5
|
+
title #{title}
|
|
6
|
+
meta(name='viewport', content='width=device-width, initial-scale=1.0')
|
|
7
|
+
link(rel='stylesheet', href='https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css')
|
|
8
|
+
body
|
|
9
|
+
section(class="section")
|
|
10
|
+
div(class="container")
|
|
11
|
+
nav(class="breadcrumb" aria-label="breadcrumbs")
|
|
12
|
+
ul
|
|
13
|
+
li
|
|
14
|
+
span(class="icon-text")
|
|
15
|
+
span(class="icon")
|
|
16
|
+
svg(xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24")
|
|
17
|
+
path(d="M21 13v10h-6v-6h-6v6h-6v-10h-3l12-12 12 12h-3zm-1-5.907v-5.093h-3v2.093l3 3z")
|
|
18
|
+
span
|
|
19
|
+
a(href="/")="Home"
|
|
20
|
+
block breadcrumbs
|
|
21
|
+
block content
|
|
22
|
+
block assets
|
|
23
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
extends includes/layout.pug
|
|
2
|
+
|
|
3
|
+
block vars
|
|
4
|
+
- var title = "Available queries | Static Suite Data Server"
|
|
5
|
+
|
|
6
|
+
block content
|
|
7
|
+
h1(class="title is-1")="Available queries"
|
|
8
|
+
table(class="table is-fullwidth is-hoverable")
|
|
9
|
+
tbody
|
|
10
|
+
if queryIds
|
|
11
|
+
each queryId in queryIds
|
|
12
|
+
tr
|
|
13
|
+
td
|
|
14
|
+
a(href=queryId)= queryId
|
|
15
|
+
else
|
|
16
|
+
tr
|
|
17
|
+
td="No queries available"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
extends includes/layout.pug
|
|
2
|
+
|
|
3
|
+
block vars
|
|
4
|
+
- var title = "Status | Static Suite Data Server"
|
|
5
|
+
|
|
6
|
+
block content
|
|
7
|
+
h1(class="title is-1")="Status"
|
|
8
|
+
table(class="table is-fullwidth is-hoverable")
|
|
9
|
+
tbody
|
|
10
|
+
each description, link in links
|
|
11
|
+
tr
|
|
12
|
+
td
|
|
13
|
+
a(href=link)= link
|
|
14
|
+
td=description
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
extends includes/layout.pug
|
|
2
|
+
|
|
3
|
+
block vars
|
|
4
|
+
- var title = "Available tasks | Static Suite Data Server"
|
|
5
|
+
|
|
6
|
+
block content
|
|
7
|
+
h1(class="title is-1")="Available tasks"
|
|
8
|
+
table(class="table is-fullwidth is-hoverable")
|
|
9
|
+
tbody
|
|
10
|
+
if taskIds
|
|
11
|
+
each taskId in taskIds
|
|
12
|
+
tr
|
|
13
|
+
td
|
|
14
|
+
a(href=taskId)= taskId
|
|
15
|
+
else
|
|
16
|
+
tr
|
|
17
|
+
td="No tasks available"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ConfigOptions, NonSanitizedConfigOptions } from './config.types';
|
|
2
|
+
declare const config: ConfigOptions;
|
|
3
|
+
/**
|
|
4
|
+
* Configures the data server.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* It validates provided configuration and returns a sanitized and immutable
|
|
8
|
+
* configuration object. It throws several errors if validation is not passing.
|
|
9
|
+
*
|
|
10
|
+
* @param options - Configuration options, @see {@link ConfigOptions}
|
|
11
|
+
*
|
|
12
|
+
* @returns - The sanitized and immutable configuration object.
|
|
13
|
+
*
|
|
14
|
+
* @throws {@link MissingRequiredOption}
|
|
15
|
+
* Exception thrown if the dataDir or runMode are not provided.
|
|
16
|
+
*
|
|
17
|
+
* @throws {@link MissingDirectory}
|
|
18
|
+
* Exception thrown if any of the provided paths (dataDir, workDir,
|
|
19
|
+
* queryDir, hookDir or taskDir) is not found.
|
|
20
|
+
*
|
|
21
|
+
* @throws {@link InvalidRunMode}
|
|
22
|
+
* Exception thrown if runMode is not valid.
|
|
23
|
+
*/
|
|
24
|
+
declare const setConfig: (options: NonSanitizedConfigOptions) => ConfigOptions;
|
|
25
|
+
export { config, setConfig };
|
|
26
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/lib/config/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAQ1E,QAAA,MAAM,MAAM,EAAE,aAAmC,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,SAAS,YAAa,yBAAyB,KAAG,aAyGvD,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
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.setConfig = exports.config = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const dataServer_types_1 = require("@lib/dataServer.types");
|
|
10
|
+
const object_1 = require("@lib/utils/object");
|
|
11
|
+
const error_1 = require("./error");
|
|
12
|
+
const config = Object.create(null); // no inherited properties
|
|
13
|
+
exports.config = config;
|
|
14
|
+
/**
|
|
15
|
+
* Configures the data server.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* It validates provided configuration and returns a sanitized and immutable
|
|
19
|
+
* configuration object. It throws several errors if validation is not passing.
|
|
20
|
+
*
|
|
21
|
+
* @param options - Configuration options, @see {@link ConfigOptions}
|
|
22
|
+
*
|
|
23
|
+
* @returns - The sanitized and immutable configuration object.
|
|
24
|
+
*
|
|
25
|
+
* @throws {@link MissingRequiredOption}
|
|
26
|
+
* Exception thrown if the dataDir or runMode are not provided.
|
|
27
|
+
*
|
|
28
|
+
* @throws {@link MissingDirectory}
|
|
29
|
+
* Exception thrown if any of the provided paths (dataDir, workDir,
|
|
30
|
+
* queryDir, hookDir or taskDir) is not found.
|
|
31
|
+
*
|
|
32
|
+
* @throws {@link InvalidRunMode}
|
|
33
|
+
* Exception thrown if runMode is not valid.
|
|
34
|
+
*/
|
|
35
|
+
const setConfig = (options) => {
|
|
36
|
+
const localOptions = options;
|
|
37
|
+
// Check that required options are provided.
|
|
38
|
+
// Since this method is publicly accessible at runtime, it is not
|
|
39
|
+
// possible to rely on TypeScript type safety.
|
|
40
|
+
if (!localOptions.dataDir) {
|
|
41
|
+
throw new error_1.MissingRequiredOption('dataDir');
|
|
42
|
+
}
|
|
43
|
+
localOptions.dataDir = path_1.default.resolve(localOptions.dataDir);
|
|
44
|
+
if (!fs_1.default.existsSync(localOptions.dataDir) ||
|
|
45
|
+
!fs_1.default.lstatSync(localOptions.dataDir).isDirectory()) {
|
|
46
|
+
throw new error_1.MissingDirectory('dataDir', localOptions.dataDir);
|
|
47
|
+
}
|
|
48
|
+
// fs.realpathSync() throws an error if path does not exist.
|
|
49
|
+
localOptions.dataDir = fs_1.default.realpathSync(localOptions.dataDir);
|
|
50
|
+
if (localOptions.workDir) {
|
|
51
|
+
localOptions.workDir = path_1.default.resolve(localOptions.workDir);
|
|
52
|
+
if (!fs_1.default.existsSync(localOptions.workDir) ||
|
|
53
|
+
!fs_1.default.lstatSync(localOptions.workDir).isDirectory()) {
|
|
54
|
+
throw new error_1.MissingDirectory('workDir', localOptions.workDir);
|
|
55
|
+
}
|
|
56
|
+
// fs.realpathSync() throws an error if path does not exist.
|
|
57
|
+
localOptions.workDir = fs_1.default.realpathSync(localOptions.workDir);
|
|
58
|
+
}
|
|
59
|
+
if (localOptions.queryDir) {
|
|
60
|
+
localOptions.queryDir = path_1.default.resolve(localOptions.queryDir);
|
|
61
|
+
if (!fs_1.default.existsSync(localOptions.queryDir) ||
|
|
62
|
+
!fs_1.default.lstatSync(localOptions.queryDir).isDirectory()) {
|
|
63
|
+
throw new error_1.MissingDirectory('queryDir', localOptions.queryDir);
|
|
64
|
+
}
|
|
65
|
+
// fs.realpathSync() throws an error if path does not exist.
|
|
66
|
+
localOptions.queryDir = fs_1.default.realpathSync(localOptions.queryDir);
|
|
67
|
+
}
|
|
68
|
+
if (localOptions.hookDir) {
|
|
69
|
+
localOptions.hookDir = path_1.default.resolve(localOptions.hookDir);
|
|
70
|
+
if (!fs_1.default.existsSync(localOptions.hookDir) ||
|
|
71
|
+
!fs_1.default.lstatSync(localOptions.hookDir).isDirectory()) {
|
|
72
|
+
throw new error_1.MissingDirectory('hookDir', localOptions.hookDir);
|
|
73
|
+
}
|
|
74
|
+
// fs.realpathSync() throws an error if path does not exist.
|
|
75
|
+
localOptions.hookDir = fs_1.default.realpathSync(localOptions.hookDir);
|
|
76
|
+
}
|
|
77
|
+
if (localOptions.taskDir) {
|
|
78
|
+
localOptions.taskDir = path_1.default.resolve(localOptions.taskDir);
|
|
79
|
+
if (!fs_1.default.existsSync(localOptions.taskDir) ||
|
|
80
|
+
!fs_1.default.lstatSync(localOptions.taskDir).isDirectory()) {
|
|
81
|
+
throw new error_1.MissingDirectory('taskDir', localOptions.taskDir);
|
|
82
|
+
}
|
|
83
|
+
// fs.realpathSync() throws an error if path does not exist.
|
|
84
|
+
localOptions.taskDir = fs_1.default.realpathSync(localOptions.taskDir);
|
|
85
|
+
}
|
|
86
|
+
if (localOptions.dumpDir) {
|
|
87
|
+
localOptions.dumpDir = path_1.default.resolve(localOptions.dumpDir);
|
|
88
|
+
if (!fs_1.default.existsSync(localOptions.dumpDir) ||
|
|
89
|
+
!fs_1.default.lstatSync(localOptions.dumpDir).isDirectory()) {
|
|
90
|
+
throw new error_1.MissingDirectory('dumpDir', localOptions.dumpDir);
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
fs_1.default.accessSync(localOptions.dumpDir, fs_1.default.constants.W_OK);
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
throw new error_1.NonWritableDirectory('dumpDir', localOptions.dumpDir);
|
|
97
|
+
}
|
|
98
|
+
// fs.realpathSync() throws an error if path does not exist.
|
|
99
|
+
localOptions.dumpDir = fs_1.default.realpathSync(localOptions.dumpDir);
|
|
100
|
+
}
|
|
101
|
+
if (!localOptions.runMode) {
|
|
102
|
+
localOptions.runMode = dataServer_types_1.RunMode.PROD;
|
|
103
|
+
}
|
|
104
|
+
if (!Object.values(dataServer_types_1.RunMode).includes(localOptions.runMode)) {
|
|
105
|
+
throw new error_1.InvalidRunMode(localOptions.runMode);
|
|
106
|
+
}
|
|
107
|
+
Object.keys(localOptions).forEach(key => {
|
|
108
|
+
if ((0, object_1.hasKey)(localOptions, key)) {
|
|
109
|
+
Object.defineProperty(config, key, {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
configurable: false,
|
|
112
|
+
writable: false,
|
|
113
|
+
// Remove leading slash from all directories.
|
|
114
|
+
value: key === 'runMode'
|
|
115
|
+
? localOptions[key]
|
|
116
|
+
: localOptions[key]?.replace(/\/$/, ''),
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
return Object.freeze(config);
|
|
121
|
+
};
|
|
122
|
+
exports.setConfig = setConfig;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { RunMode } from '@lib/dataServer.types';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration options.
|
|
4
|
+
*/
|
|
5
|
+
export declare type ConfigOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* Path to the directory where data is stored.
|
|
8
|
+
*/
|
|
9
|
+
dataDir: string;
|
|
10
|
+
/**
|
|
11
|
+
* Path to the directory where work data is stored. Optional.
|
|
12
|
+
*/
|
|
13
|
+
workDir?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Path to the directory where queries are stored. Optional.
|
|
16
|
+
*/
|
|
17
|
+
queryDir?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Path to the directory where hooks are stored. Optional.
|
|
20
|
+
*/
|
|
21
|
+
hookDir?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Path to the directory where tasks are stored. Optional.
|
|
24
|
+
*/
|
|
25
|
+
taskDir?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Path to the directory where dumps are stored. Optional.
|
|
28
|
+
*/
|
|
29
|
+
dumpDir?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Run mode (dev or prod).
|
|
32
|
+
*/
|
|
33
|
+
runMode: RunMode;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Non-sanitized configuration options.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* Options received by Data Server before validating them. They are the same as
|
|
40
|
+
* {@link ConfigOptions} but with an optional runMode.
|
|
41
|
+
*
|
|
42
|
+
* @see {@link ConfigOptions}
|
|
43
|
+
*/
|
|
44
|
+
export declare type NonSanitizedConfigOptions = {
|
|
45
|
+
/**
|
|
46
|
+
* Path to the directory where data is stored.
|
|
47
|
+
*/
|
|
48
|
+
dataDir: string;
|
|
49
|
+
/**
|
|
50
|
+
* Path to the directory where work data is stored. Optional.
|
|
51
|
+
*/
|
|
52
|
+
workDir?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Path to the directory where queries are stored. Optional.
|
|
55
|
+
*/
|
|
56
|
+
queryDir?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Path to the directory where hooks are stored. Optional.
|
|
59
|
+
*/
|
|
60
|
+
hookDir?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Path to the directory where tasks are stored. Optional.
|
|
63
|
+
*/
|
|
64
|
+
taskDir?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Path to the directory where dumps are stored. Optional.
|
|
67
|
+
*/
|
|
68
|
+
dumpDir?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Run mode (dev or prod).
|
|
71
|
+
*/
|
|
72
|
+
runMode?: RunMode;
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=config.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.types.d.ts","sourceRoot":"","sources":["../../../src/lib/config/config.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD;;GAEG;AACH,oBAAY,aAAa,GAAG;IAC1B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;;;;;GAQG;AACH,oBAAY,yBAAyB,GAAG;IACtC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DomainError } from '@lib/error/DomainError';
|
|
2
|
+
/**
|
|
3
|
+
* Defines a custom error for invalid run modes.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare class InvalidRunMode extends DomainError {
|
|
8
|
+
/**
|
|
9
|
+
* Constructs a new error for invalid run modes.
|
|
10
|
+
*
|
|
11
|
+
* @param runMode - the value of the invalid runMode.
|
|
12
|
+
*/
|
|
13
|
+
constructor(runMode: string);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=InvalidRunMode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidRunMode.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/error/InvalidRunMode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC7C;;;;OAIG;gBACS,OAAO,EAAE,MAAM;CAG5B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidRunMode = void 0;
|
|
4
|
+
const DomainError_1 = require("@lib/error/DomainError");
|
|
5
|
+
/**
|
|
6
|
+
* Defines a custom error for invalid run modes.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
class InvalidRunMode extends DomainError_1.DomainError {
|
|
11
|
+
/**
|
|
12
|
+
* Constructs a new error for invalid run modes.
|
|
13
|
+
*
|
|
14
|
+
* @param runMode - the value of the invalid runMode.
|
|
15
|
+
*/
|
|
16
|
+
constructor(runMode) {
|
|
17
|
+
super(`Invalid value provided for "runMode": "${runMode}"`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.InvalidRunMode = InvalidRunMode;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DomainError } from '@lib/error/DomainError';
|
|
2
|
+
/**
|
|
3
|
+
* Defines a custom error for missing directories.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare class MissingDirectory extends DomainError {
|
|
8
|
+
/**
|
|
9
|
+
* The configuration id of the missing directory (dataDir, queryDir, etc).
|
|
10
|
+
*/
|
|
11
|
+
directoryId: string;
|
|
12
|
+
/**
|
|
13
|
+
* Path of the missing directory.
|
|
14
|
+
*/
|
|
15
|
+
path: string;
|
|
16
|
+
/**
|
|
17
|
+
* Constructs a new error for missing directories.
|
|
18
|
+
*
|
|
19
|
+
* @param directoryId - the configuration id of the missing directory (dataDir, queryDir, etc).
|
|
20
|
+
* @param path - the path of the missing directory.
|
|
21
|
+
*/
|
|
22
|
+
constructor(directoryId: string, path: string);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=MissingDirectory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MissingDirectory.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/error/MissingDirectory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;gBACS,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAK9C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MissingDirectory = void 0;
|
|
4
|
+
const DomainError_1 = require("@lib/error/DomainError");
|
|
5
|
+
/**
|
|
6
|
+
* Defines a custom error for missing directories.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
class MissingDirectory extends DomainError_1.DomainError {
|
|
11
|
+
/**
|
|
12
|
+
* Constructs a new error for missing directories.
|
|
13
|
+
*
|
|
14
|
+
* @param directoryId - the configuration id of the missing directory (dataDir, queryDir, etc).
|
|
15
|
+
* @param path - the path of the missing directory.
|
|
16
|
+
*/
|
|
17
|
+
constructor(directoryId, path) {
|
|
18
|
+
super(`Cannot find "${directoryId}" directory: "${path}"`);
|
|
19
|
+
this.directoryId = directoryId;
|
|
20
|
+
this.path = path;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.MissingDirectory = MissingDirectory;
|