@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,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryIncludeParser = void 0;
|
|
4
|
+
const config_1 = require("@lib/config");
|
|
5
|
+
const dataServer_types_1 = require("@lib/dataServer.types");
|
|
6
|
+
const query_1 = require("@lib/query");
|
|
7
|
+
const query_types_1 = require("@lib/query/query.types");
|
|
8
|
+
const object_1 = require("@lib/utils/object");
|
|
9
|
+
const aliasWithoutTypeIncludeParser_1 = require("./types/aliasWithoutTypeIncludeParser");
|
|
10
|
+
/**
|
|
11
|
+
* Parses query includes.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* Instead of executing a query and adding its result to a JSON file,
|
|
15
|
+
* create a Proxy so queries are only executed when they are consumed,
|
|
16
|
+
* in a Just-In-Time way.
|
|
17
|
+
*/
|
|
18
|
+
const queryIncludeParser = ({ host, includePath, }) => {
|
|
19
|
+
const queryDefinition = (0, object_1.getObjValue)(host, includePath);
|
|
20
|
+
if (!queryDefinition) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
// Execute the query when the "data" property is accessed.
|
|
24
|
+
const proxyHandler = {
|
|
25
|
+
get: (target, prop) => {
|
|
26
|
+
if (prop === 'data') {
|
|
27
|
+
const queryResponse = query_1.queryRunner.run(queryDefinition);
|
|
28
|
+
if ((0, query_types_1.isQueryErrorResponse)(queryResponse)) {
|
|
29
|
+
return config_1.config.runMode === dataServer_types_1.RunMode.DEV
|
|
30
|
+
? `${queryResponse.error} (message visible only in run mode DEV)`
|
|
31
|
+
: null;
|
|
32
|
+
}
|
|
33
|
+
return queryResponse.data;
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
const target = new Proxy({ data: null }, proxyHandler);
|
|
39
|
+
const mountPath = includePath.split('.');
|
|
40
|
+
const includeKey = mountPath.pop();
|
|
41
|
+
if (includeKey) {
|
|
42
|
+
(0, aliasWithoutTypeIncludeParser_1.aliasWithoutTypeIncludeParser)({ host, target, mountPath, includeKey }, 'query');
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
exports.queryIncludeParser = queryIncludeParser;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aliasIncludeParser.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/store/include/parsers/types/aliasIncludeParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAGrF,eAAO,MAAM,kBAAkB,6CAK5B,2BAA2B,KAAG,IAIhC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.aliasIncludeParser = void 0;
|
|
4
|
+
const object_1 = require("@lib/utils/object");
|
|
5
|
+
const aliasIncludeParser = ({ host, target, mountPath, includeKey, }) => {
|
|
6
|
+
const mountPoint = (0, object_1.getObjValue)(host, mountPath);
|
|
7
|
+
mountPoint[includeKey.replace('Include', '')] = target;
|
|
8
|
+
delete mountPoint[includeKey];
|
|
9
|
+
};
|
|
10
|
+
exports.aliasIncludeParser = aliasIncludeParser;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GenericIncludeParserOptions } from '@lib/store/include/includeParser.types';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param options - Object with options as defined in @see {@link IncludeParserOptions}
|
|
5
|
+
* @param type - Type of include (custom, query, etc)
|
|
6
|
+
*/
|
|
7
|
+
export declare const aliasWithoutTypeIncludeParser: ({ host, target, mountPath, includeKey }: GenericIncludeParserOptions, type: string) => void;
|
|
8
|
+
//# sourceMappingURL=aliasWithoutTypeIncludeParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aliasWithoutTypeIncludeParser.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/store/include/parsers/types/aliasWithoutTypeIncludeParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAErF;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,4CACC,2BAA2B,QAC9D,MAAM,KACX,IAWF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.aliasWithoutTypeIncludeParser = void 0;
|
|
4
|
+
const object_1 = require("@lib/utils/object");
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param options - Object with options as defined in @see {@link IncludeParserOptions}
|
|
8
|
+
* @param type - Type of include (custom, query, etc)
|
|
9
|
+
*/
|
|
10
|
+
const aliasWithoutTypeIncludeParser = ({ host, target, mountPath, includeKey }, type) => {
|
|
11
|
+
const mountPoint = (0, object_1.getObjValue)(host, mountPath);
|
|
12
|
+
const mountPointKey = includeKey.replace('Include', '') === type
|
|
13
|
+
? type
|
|
14
|
+
: includeKey.replace(`${type.charAt(0).toUpperCase() + type.slice(1)}Include`, '');
|
|
15
|
+
mountPoint[mountPointKey] = target;
|
|
16
|
+
delete mountPoint[includeKey];
|
|
17
|
+
};
|
|
18
|
+
exports.aliasWithoutTypeIncludeParser = aliasWithoutTypeIncludeParser;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/store/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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("./store"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/lib/store/store.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,EAIN,MAAM,eAAe,CAAC;AAcvB,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC;AAkEF;;GAEG;AACH,eAAO,MAAM,UAAU,QAAO,IAO7B,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
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.resetStore = exports.store = void 0;
|
|
7
|
+
const microtime_1 = __importDefault(require("microtime"));
|
|
8
|
+
const string_1 = require("@lib/utils/string");
|
|
9
|
+
const logger_1 = require("@lib/utils/logger");
|
|
10
|
+
const cache_1 = require("@lib/utils/cache");
|
|
11
|
+
// Instantiate the subset cache so it can be accessed faster.
|
|
12
|
+
const subsetCache = cache_1.cache.bin('store-subset');
|
|
13
|
+
const initIndex = () => {
|
|
14
|
+
return {
|
|
15
|
+
url: new Map(),
|
|
16
|
+
uuid: new Map(),
|
|
17
|
+
custom: new Map(),
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
const initData = () => new Map();
|
|
21
|
+
exports.store = {
|
|
22
|
+
syncDate: null,
|
|
23
|
+
data: initData(),
|
|
24
|
+
deleted: new Set(),
|
|
25
|
+
index: initIndex(),
|
|
26
|
+
};
|
|
27
|
+
exports.store.data.subset = (options) => {
|
|
28
|
+
const startDate = microtime_1.default.now();
|
|
29
|
+
// Merge provided options with default ones.
|
|
30
|
+
const defaultOptions = {
|
|
31
|
+
variant: '_main',
|
|
32
|
+
ext: 'json',
|
|
33
|
+
recursive: 'true',
|
|
34
|
+
};
|
|
35
|
+
const opts = { ...defaultOptions, ...options };
|
|
36
|
+
let subset = { filenames: [], items: [] };
|
|
37
|
+
const dirWithTrimmedSlashes = opts.dir?.replace(/^\//, '').replace(/\/$/, '');
|
|
38
|
+
const dirPart = dirWithTrimmedSlashes ? `${dirWithTrimmedSlashes}/` : '';
|
|
39
|
+
let variantPart;
|
|
40
|
+
if (opts.variant) {
|
|
41
|
+
const recursiveGroup = opts.recursive ? '.' : '[^/]';
|
|
42
|
+
variantPart =
|
|
43
|
+
opts.variant === '_main'
|
|
44
|
+
? `((?!--)${recursiveGroup})+`
|
|
45
|
+
: `${recursiveGroup}+${string_1.VARIANT_SEPARATOR}${opts.variant}`;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
variantPart = '';
|
|
49
|
+
}
|
|
50
|
+
let extensionPart;
|
|
51
|
+
if (opts.recursive) {
|
|
52
|
+
extensionPart = opts.ext ? `.${opts.ext}` : '.+';
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
extensionPart = opts.ext ? `.${opts.ext}` : '[^/]+';
|
|
56
|
+
}
|
|
57
|
+
const pattern = `^${dirPart}${variantPart}${extensionPart}$`;
|
|
58
|
+
logger_1.logger.debug(`Store subset pattern: ${pattern}`);
|
|
59
|
+
const cachedSubset = subsetCache.get(pattern);
|
|
60
|
+
if (cachedSubset) {
|
|
61
|
+
subset = cachedSubset;
|
|
62
|
+
logger_1.logger.debug(`Store subset obtained from cache in ${(microtime_1.default.now() - startDate) / 1000}ms. ${subset.items.length} items.`);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
const regex = new RegExp(pattern);
|
|
66
|
+
const mapKeys = Array.from(exports.store.data.keys());
|
|
67
|
+
mapKeys.forEach(k => {
|
|
68
|
+
if (k.match(regex)) {
|
|
69
|
+
subset.filenames.push(k);
|
|
70
|
+
subset.items.push(exports.store.data.get(k));
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
subsetCache.set(pattern, subset);
|
|
74
|
+
logger_1.logger.debug(`Store subset created in ${(microtime_1.default.now() - startDate) / 1000} ms. ${subset.items.length} items.`);
|
|
75
|
+
}
|
|
76
|
+
return subset;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Resets store and deletes all loaded data.
|
|
80
|
+
*/
|
|
81
|
+
const resetStore = () => {
|
|
82
|
+
exports.store.syncDate = null;
|
|
83
|
+
const previousSubset = exports.store.data.subset;
|
|
84
|
+
exports.store.data = initData();
|
|
85
|
+
exports.store.data.subset = previousSubset;
|
|
86
|
+
exports.store.deleted.clear();
|
|
87
|
+
exports.store.index = initIndex();
|
|
88
|
+
};
|
|
89
|
+
exports.resetStore = resetStore;
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
export interface StoreData<K, V> extends Map<K, V> {
|
|
2
|
+
/**
|
|
3
|
+
* Create a subset with all files in store that match the given arguments.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* All subsets are automatically cached, so passing the same arguments
|
|
7
|
+
* will return the same subset from the cache.
|
|
8
|
+
*
|
|
9
|
+
* This is the preferred way of getting a subset of the store files,
|
|
10
|
+
* since is a simple function that most of the times only requires
|
|
11
|
+
* the first argument.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```
|
|
15
|
+
* // Get a subset of all nodes with "json" extension.
|
|
16
|
+
* dataServer.store.data.subset({ dir: 'en/entity/node/', variant: null });
|
|
17
|
+
*
|
|
18
|
+
* // Get a subset of all articles in all languages with "json" extension.
|
|
19
|
+
* dataServer.store.data.subset({ dir: '.+/entity/node/article/' });
|
|
20
|
+
*
|
|
21
|
+
* // Get a subset of all articles regardless of their extension.
|
|
22
|
+
* dataServer.store.data.subset({ dir: 'en/entity/node/article/', ext: null });
|
|
23
|
+
*
|
|
24
|
+
* // Get a subset of all card variants for articles with "json" extension.
|
|
25
|
+
* dataServer.store.data.subset({ dir: 'en/entity/node/article/', variant: null });
|
|
26
|
+
*
|
|
27
|
+
* // Get a subset of english articles, with "yml" extension, non-recursively.
|
|
28
|
+
* dataServer.store.data.subset({ dir: 'en/entity/node/article/', ext: 'yml', recursive: false });
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param options - Object with options for creating a store subset.
|
|
32
|
+
*
|
|
33
|
+
* @returns An object with "filenames" and "items".
|
|
34
|
+
*/
|
|
35
|
+
subset(options: StoreSubsetOptions): StoreSubset;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The store that holds all data.
|
|
39
|
+
*/
|
|
40
|
+
export declare type Store = {
|
|
41
|
+
/**
|
|
42
|
+
* Date to tell when was the store last synced.
|
|
43
|
+
*
|
|
44
|
+
* Every time the store is updated, syncDate is set with the last modification
|
|
45
|
+
* date of the data directory, not the date when the store has finished updating.
|
|
46
|
+
*
|
|
47
|
+
* Given this scenario:
|
|
48
|
+
* - Data directory modified at 12:30:00
|
|
49
|
+
* - Syncing the store takes 3 seconds and finishes at 12:30:03
|
|
50
|
+
*
|
|
51
|
+
* ... syncDate will be 12:30:00, not 12:30:03.
|
|
52
|
+
*
|
|
53
|
+
* Doing it the other way round can cause data inconsistencies, because syncing files
|
|
54
|
+
* to the store takes time, it is done sequentially, and in the meanwhile, other
|
|
55
|
+
* modifications can happen:
|
|
56
|
+
* - Store last syncDate is 12:29:00
|
|
57
|
+
* - Data directory is modified at 12:30:00
|
|
58
|
+
* - We ask for modified files after 12:29:00 and got 3 files (1.json, 2.json and 3.json)
|
|
59
|
+
* - File "1.json" is processed and added to the store at 12:30:01
|
|
60
|
+
* - While "2.json" is being processed and added to the store, data directory is modified
|
|
61
|
+
* again at 12:30:02 and "1.json" is changed.
|
|
62
|
+
* - File "3.json" is processed and added to the store at 12:30:03
|
|
63
|
+
*
|
|
64
|
+
* At this moment, there are two options:
|
|
65
|
+
*
|
|
66
|
+
* 1) Setting syncDate to the current date:
|
|
67
|
+
* - Store syncDate is set to 12:30:03
|
|
68
|
+
* - Data directory is modified again at 12:30:10 and only "3.json" is changed
|
|
69
|
+
* - We ask for modified files after 12:30:03 and get only "3.json"
|
|
70
|
+
* - Modification done at 12:30:02 to "1.json" is lost and cannot be recovered unless "1.json" is
|
|
71
|
+
* modified again, or Data Server is restarted
|
|
72
|
+
*
|
|
73
|
+
* 2) Setting syncDate to the last modification date of the data directory:
|
|
74
|
+
* - Store syncDate is set to 12:30:00
|
|
75
|
+
* - Data directory is modified again at 12:30:10 and only "3.json" is changed
|
|
76
|
+
* - We ask for modified files after 12:30:00 and get "1.json" and "3.json"
|
|
77
|
+
* - Modification done at 12:30:02 to "1.json" is properly processed
|
|
78
|
+
*/
|
|
79
|
+
syncDate: Date | null;
|
|
80
|
+
/**
|
|
81
|
+
* Map that holds all data for all files.
|
|
82
|
+
*
|
|
83
|
+
* @remarks
|
|
84
|
+
* This map contains files, keyed by their relative filepath. No directory or
|
|
85
|
+
* any other structure is stored here.
|
|
86
|
+
*
|
|
87
|
+
* When executing a query, a common pattern is to create a subset of this
|
|
88
|
+
* map (e.g.- to get all articles of an specific language) and the execute the
|
|
89
|
+
* query against that subset. To do so, see {@link Store#subset}
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```
|
|
93
|
+
* // Find an specific article.
|
|
94
|
+
* const article = store.data.get('en/entity/node/article/123.json');
|
|
95
|
+
* const article = store.index.url.get('public/pretty/url');
|
|
96
|
+
* const article = store.index.uuid.get('nl').get('ce736c8b-a6ea-43c4-9a6b-ad1fc498017c');
|
|
97
|
+
* const article = store.index.custom.get('taxonomies').get('12234');
|
|
98
|
+
*
|
|
99
|
+
* // Create a subset of all english articles.
|
|
100
|
+
* const results = store.data.subset({ dir: 'en/entity/node/article/', recursive: true });
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
data: StoreData<string, any>;
|
|
104
|
+
/**
|
|
105
|
+
* A list of deleted files from store, to be able to track them.
|
|
106
|
+
*/
|
|
107
|
+
deleted: Set<string>;
|
|
108
|
+
/**
|
|
109
|
+
* An object to hold accessory index data.
|
|
110
|
+
*/
|
|
111
|
+
index: {
|
|
112
|
+
/**
|
|
113
|
+
* An index that holds all data for all files, keyed by their URL.
|
|
114
|
+
*/
|
|
115
|
+
url: Map<string, any>;
|
|
116
|
+
/**
|
|
117
|
+
* An index that holds all data for all files, keyed by their lang and uuid.
|
|
118
|
+
*/
|
|
119
|
+
uuid: Map<string, any>;
|
|
120
|
+
/**
|
|
121
|
+
* An index to hold custom data defined in hooks or queries.
|
|
122
|
+
*/
|
|
123
|
+
custom: Map<string, any>;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Options for subset() function.
|
|
128
|
+
*/
|
|
129
|
+
export declare type StoreSubsetOptions = {
|
|
130
|
+
/**
|
|
131
|
+
* Optional base directory to filter files.
|
|
132
|
+
*
|
|
133
|
+
* @remarks
|
|
134
|
+
* It requires a trailing slash, but not a leading slash, e.g.- "en/entity/node/article/"
|
|
135
|
+
*/
|
|
136
|
+
dir?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Optional name of a variant file.
|
|
139
|
+
*
|
|
140
|
+
* @remarks
|
|
141
|
+
* Use '_main' to obtain the default variant.
|
|
142
|
+
* Use any other string, e.g.- 'card', to obtain the card variant.
|
|
143
|
+
* Use null to avoid searching for any variant.
|
|
144
|
+
* Defaults to '_main'.
|
|
145
|
+
*/
|
|
146
|
+
variant?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Optional file extension, without dots. Defaults to 'json'.
|
|
149
|
+
*/
|
|
150
|
+
ext?: string;
|
|
151
|
+
/**
|
|
152
|
+
* Optional flag to search for files recursively. True by default.
|
|
153
|
+
*/
|
|
154
|
+
recursive?: boolean;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Object holding a subset of items from the store.
|
|
158
|
+
*/
|
|
159
|
+
export declare type StoreSubset = {
|
|
160
|
+
/**
|
|
161
|
+
* Array of filenames in this subset.
|
|
162
|
+
*/
|
|
163
|
+
filenames: Array<string>;
|
|
164
|
+
/**
|
|
165
|
+
* Array of items in this subset.
|
|
166
|
+
*/
|
|
167
|
+
items: Array<any>;
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* The manager that handles the store data.
|
|
171
|
+
*/
|
|
172
|
+
export declare type StoreManager = {
|
|
173
|
+
/**
|
|
174
|
+
* Adds a file to the store, into a Map structure keyed by its relative filepath.
|
|
175
|
+
*
|
|
176
|
+
* @remarks
|
|
177
|
+
* It invokes "process file" and "store add" hooks.
|
|
178
|
+
*
|
|
179
|
+
* @param relativeFilepath - Relative file path, inside dataDir, to the file to be added.
|
|
180
|
+
*
|
|
181
|
+
* @returns The store manager, to allow chaining.
|
|
182
|
+
*/
|
|
183
|
+
add(relativeFilepath: string): StoreManager;
|
|
184
|
+
/**
|
|
185
|
+
* Removes a file from the store.
|
|
186
|
+
*
|
|
187
|
+
* @remarks
|
|
188
|
+
* It removes the file from the map structure.
|
|
189
|
+
* It invokes the "store remove" hook.
|
|
190
|
+
*
|
|
191
|
+
* @param file - Relative path to the file to be removed.
|
|
192
|
+
*
|
|
193
|
+
* @returns The store manager, to allow chaining.
|
|
194
|
+
*/
|
|
195
|
+
remove(file: string): StoreManager;
|
|
196
|
+
/**
|
|
197
|
+
* Updates a file from the store.
|
|
198
|
+
*
|
|
199
|
+
* @remarks
|
|
200
|
+
* It removes the file from the map structure, and adds it again.
|
|
201
|
+
*
|
|
202
|
+
* @param file - Relative path, inside dataDir, to the file to be updated.
|
|
203
|
+
*
|
|
204
|
+
* @returns The store manager, to allow chaining.
|
|
205
|
+
*/
|
|
206
|
+
update(file: string): StoreManager;
|
|
207
|
+
/**
|
|
208
|
+
* Parses all static and dynamic includes (entity, config, locale, custom and query)
|
|
209
|
+
* from data stored in "store.data".
|
|
210
|
+
*
|
|
211
|
+
* @returns The store manager, to allow chaining.
|
|
212
|
+
*/
|
|
213
|
+
parseIncludes(): StoreManager;
|
|
214
|
+
/**
|
|
215
|
+
* Parses all static and dynamic includes (entity, config, locale, custom and query)
|
|
216
|
+
* from one file.
|
|
217
|
+
*
|
|
218
|
+
* @param relativeFilepath - Relative file path, inside dataDir, to the file to be parsed.
|
|
219
|
+
* @param fileContent - The contents of a file.
|
|
220
|
+
*
|
|
221
|
+
* @returns The store manager, to allow chaining.
|
|
222
|
+
*/
|
|
223
|
+
parseSingleFileIncludes(relativeFilepath: string, fileContent: any): StoreManager;
|
|
224
|
+
/**
|
|
225
|
+
* Resets store and deletes all loaded data.
|
|
226
|
+
*
|
|
227
|
+
* @returns The store manager, to allow chaining.
|
|
228
|
+
*/
|
|
229
|
+
reset(): StoreManager;
|
|
230
|
+
};
|
|
231
|
+
//# sourceMappingURL=store.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.types.d.ts","sourceRoot":"","sources":["../../../src/lib/store/store.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,MAAM,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,CAAC;CAClD;AAED;;GAEG;AACH,oBAAY,KAAK,GAAG;IAClB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAC;IAEtB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE7B;;OAEG;IACH,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAErB;;OAEG;IACH,KAAK,EAAE;QACL;;WAEG;QACH,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAEtB;;WAEG;QACH,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAEvB;;WAEG;QACH,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC1B,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,oBAAY,kBAAkB,GAAG;IAC/B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,oBAAY,WAAW,GAAG;IACxB;;OAEG;IACH,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAEzB;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,oBAAY,YAAY,GAAG;IACzB;;;;;;;;;OASG;IACH,GAAG,CAAC,gBAAgB,EAAE,MAAM,GAAG,YAAY,CAAC;IAE5C;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAAC;IAEnC;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAAC;IAEnC;;;;;OAKG;IACH,aAAa,IAAI,YAAY,CAAC;IAE9B;;;;;;;;OAQG;IACH,uBAAuB,CACrB,gBAAgB,EAAE,MAAM,EACxB,WAAW,EAAE,GAAG,GACf,YAAY,CAAC;IAEhB;;;;OAIG;IACH,KAAK,IAAI,YAAY,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storeManager.d.ts","sourceRoot":"","sources":["../../../src/lib/store/storeManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AA2F7C,eAAO,MAAM,YAAY,EAAE,YA4F1B,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.storeManager = void 0;
|
|
4
|
+
const config_1 = require("@lib/config");
|
|
5
|
+
const fs_1 = require("@lib/utils/fs");
|
|
6
|
+
const hook_1 = require("./hook");
|
|
7
|
+
const _1 = require(".");
|
|
8
|
+
const include_1 = require("./include");
|
|
9
|
+
const dependencyFileHelper_1 = require("./dependency/dependencyFileHelper");
|
|
10
|
+
const dependencyTagger_1 = require("./dependency/dependencyTagger");
|
|
11
|
+
/**
|
|
12
|
+
* Sets a file into the store, regardless of being already added or not.
|
|
13
|
+
*
|
|
14
|
+
* @param relativeFilepath - Relative file path, inside dataDir, to the file to be added.
|
|
15
|
+
* @param options - Configuration options.
|
|
16
|
+
*
|
|
17
|
+
* @returns Object with two properties, "raw" and "json".
|
|
18
|
+
*/
|
|
19
|
+
const setFileIntoStore = (relativeFilepath) => {
|
|
20
|
+
const absoluteFilePath = `${config_1.config.dataDir}/${relativeFilepath}`;
|
|
21
|
+
let fileContent = (0, fs_1.getFileContent)(absoluteFilePath);
|
|
22
|
+
// Invoke "process file" hook.
|
|
23
|
+
fileContent = hook_1.hookManager.invokeOnProcessFile({
|
|
24
|
+
relativeFilepath,
|
|
25
|
+
fileContent,
|
|
26
|
+
});
|
|
27
|
+
const dataToStore = fileContent.json || fileContent.raw;
|
|
28
|
+
if (fileContent.json) {
|
|
29
|
+
// Check if the object already exists to make sure we don't break the reference
|
|
30
|
+
const previousData = _1.store.data.get(relativeFilepath);
|
|
31
|
+
if (dataToStore && typeof dataToStore === 'object') {
|
|
32
|
+
if (previousData) {
|
|
33
|
+
// Delete include dependencies.
|
|
34
|
+
dependencyFileHelper_1.dependencyIncludeHelper.deleteIncludeDependencies(relativeFilepath, dataToStore);
|
|
35
|
+
// Remove previous data from URL index.
|
|
36
|
+
const url = previousData.data?.content?.url?.path;
|
|
37
|
+
if (url) {
|
|
38
|
+
_1.store.index.url.delete(url);
|
|
39
|
+
}
|
|
40
|
+
// Remove previous data from UUID index.
|
|
41
|
+
const uuid = previousData.data?.content?.uuid;
|
|
42
|
+
const langcode = previousData.data?.content?.langcode?.value;
|
|
43
|
+
if (uuid && langcode) {
|
|
44
|
+
_1.store.index.uuid.get(langcode)?.delete(uuid);
|
|
45
|
+
}
|
|
46
|
+
// Delete all referenced object properties
|
|
47
|
+
Object.keys(previousData).forEach(key => {
|
|
48
|
+
delete previousData[key];
|
|
49
|
+
});
|
|
50
|
+
// hydrate new object properties into referenced object
|
|
51
|
+
Object.keys(dataToStore).forEach(key => {
|
|
52
|
+
previousData[key] = dataToStore[key];
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
// Add data to UUID index.
|
|
56
|
+
const uuid = dataToStore.data?.content?.uuid;
|
|
57
|
+
const langcode = dataToStore.data?.content?.langcode?.value;
|
|
58
|
+
if (uuid && langcode) {
|
|
59
|
+
const langcodeMap = _1.store.index.uuid.get(langcode) ||
|
|
60
|
+
_1.store.index.uuid.set(langcode, new Map()).get(langcode);
|
|
61
|
+
langcodeMap.set(uuid, dataToStore);
|
|
62
|
+
}
|
|
63
|
+
// Add data to URL index.
|
|
64
|
+
const url = dataToStore.data?.content?.url?.path;
|
|
65
|
+
if (url) {
|
|
66
|
+
_1.store.index.url.set(url, dataToStore);
|
|
67
|
+
}
|
|
68
|
+
// Add include dependencies.
|
|
69
|
+
dependencyFileHelper_1.dependencyIncludeHelper.setIncludeDependencies(relativeFilepath, dataToStore);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
_1.store.data.set(relativeFilepath, dataToStore);
|
|
73
|
+
// Remove this path from store.deleted
|
|
74
|
+
_1.store.deleted.delete(relativeFilepath);
|
|
75
|
+
return fileContent;
|
|
76
|
+
};
|
|
77
|
+
exports.storeManager = {
|
|
78
|
+
add: (relativeFilepath) => {
|
|
79
|
+
const fileContent = setFileIntoStore(relativeFilepath);
|
|
80
|
+
// Invoke "store add" hook.
|
|
81
|
+
hook_1.hookManager.invokeOnStoreItemAdd({ relativeFilepath, fileContent });
|
|
82
|
+
return exports.storeManager;
|
|
83
|
+
},
|
|
84
|
+
update: (relativeFilepath) => {
|
|
85
|
+
const storedData = _1.store.data.get(relativeFilepath);
|
|
86
|
+
if (storedData) {
|
|
87
|
+
hook_1.hookManager.invokeOnStoreItemBeforeUpdate({
|
|
88
|
+
relativeFilepath,
|
|
89
|
+
fileContent: storedData,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const fileContent = setFileIntoStore(relativeFilepath);
|
|
93
|
+
// Invalidate this item.
|
|
94
|
+
dependencyTagger_1.dependencyTagger.invalidateTags([relativeFilepath]);
|
|
95
|
+
// Invoke "store update" hook.
|
|
96
|
+
hook_1.hookManager.invokeOnStoreItemAfterUpdate({
|
|
97
|
+
relativeFilepath,
|
|
98
|
+
fileContent,
|
|
99
|
+
});
|
|
100
|
+
return exports.storeManager;
|
|
101
|
+
},
|
|
102
|
+
remove: (relativeFilepath) => {
|
|
103
|
+
// Get stored data before removing it from store.
|
|
104
|
+
const storedData = _1.store.data.get(relativeFilepath);
|
|
105
|
+
// Remove data from URL index.
|
|
106
|
+
const url = storedData.data?.content?.url?.path;
|
|
107
|
+
if (url) {
|
|
108
|
+
_1.store.index.url.delete(url);
|
|
109
|
+
}
|
|
110
|
+
// Remove data from UUID index.
|
|
111
|
+
const uuid = storedData.data?.content?.uuid;
|
|
112
|
+
const langcode = storedData.data?.content?.langcode?.value;
|
|
113
|
+
if (uuid && langcode) {
|
|
114
|
+
_1.store.index.uuid.get(langcode)?.delete(uuid);
|
|
115
|
+
}
|
|
116
|
+
// Delete file contents from store.
|
|
117
|
+
_1.store.data.delete(relativeFilepath);
|
|
118
|
+
// Save its path in store.deleted for future reference.
|
|
119
|
+
_1.store.deleted.add(relativeFilepath);
|
|
120
|
+
// Invalidate this item.
|
|
121
|
+
dependencyTagger_1.dependencyTagger.invalidateTags([relativeFilepath]);
|
|
122
|
+
// Invoke "store remove" hook.
|
|
123
|
+
hook_1.hookManager.invokeOnStoreItemDelete({
|
|
124
|
+
relativeFilepath,
|
|
125
|
+
fileContent: storedData,
|
|
126
|
+
});
|
|
127
|
+
return exports.storeManager;
|
|
128
|
+
},
|
|
129
|
+
parseIncludes: () => {
|
|
130
|
+
// Parses static includes.
|
|
131
|
+
_1.store.data.forEach((fileContent, relativeFilepath) => {
|
|
132
|
+
include_1.includeParser.static(relativeFilepath, fileContent);
|
|
133
|
+
});
|
|
134
|
+
// Parses dynamic includes.
|
|
135
|
+
_1.store.data.forEach(fileContent => {
|
|
136
|
+
include_1.includeParser.dynamic(fileContent);
|
|
137
|
+
});
|
|
138
|
+
return exports.storeManager;
|
|
139
|
+
},
|
|
140
|
+
parseSingleFileIncludes: (relativeFilepath, fileContent) => {
|
|
141
|
+
include_1.includeParser.static(relativeFilepath, fileContent);
|
|
142
|
+
include_1.includeParser.dynamic(fileContent);
|
|
143
|
+
return exports.storeManager;
|
|
144
|
+
},
|
|
145
|
+
reset: () => {
|
|
146
|
+
(0, _1.resetStore)();
|
|
147
|
+
return exports.storeManager;
|
|
148
|
+
},
|
|
149
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/store/workDir/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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("./workDirHelper"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getChangedLinesSince.d.ts","sourceRoot":"","sources":["../../../../../src/lib/store/workDir/storage/getChangedLinesSince.ts"],"names":[],"mappings":"AAIA;;;;;;KAMK;AACL,eAAO,MAAM,oBAAoB,cAAe,IAAI,KAAG,MAAM,EAmC5D,CAAC"}
|