@syngrisi/syngrisi 2.2.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/.nvmrc +1 -0
- package/LICENSE.md +9 -0
- package/README.md +139 -0
- package/config.js +17 -0
- package/dist/config.js +16 -0
- package/dist/src/server/models/index.js +508 -0
- package/dist/src/server/models/plugins/index.js +4 -0
- package/dist/src/server/models/plugins/paginate.plugin.js +76 -0
- package/dist/src/server/models/plugins/paginateDistinct.plugin.js +76 -0
- package/dist/src/server/models/plugins/toJSON.plugin.js +39 -0
- package/dist/src/server/schemas/createCheck.shema.js +17 -0
- package/dist/src/server/schemas/getBaseline.shema.js +12 -0
- package/dist/src/server/utils/paramsGuard.js +18 -0
- package/dist/src/tasks/backup.js +68 -0
- package/dist/src/tasks/lib/common.js +14 -0
- package/dist/src/tasks/lib/utils.js +14 -0
- package/dist/src/tasks/migrations/2.0.migration.js +86 -0
- package/dist/src/tasks/migrations/2.0.migration_mql.js +57 -0
- package/dist/src/tasks/reindex.js +28 -0
- package/dist/src/tasks/restore.js +86 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/docker-compose.yml +70 -0
- package/mvc/views/react/admin/index.html +22 -0
- package/mvc/views/react/assets/LogicalGroup.95929360.js +15993 -0
- package/mvc/views/react/assets/PasswordInput.8a73fdd2.js +299 -0
- package/mvc/views/react/assets/admin.94703bdc.js +14448 -0
- package/mvc/views/react/assets/auth.748478ef.js +673 -0
- package/mvc/views/react/assets/bg_2_0_dark_L2.3a31edc0.png +0 -0
- package/mvc/views/react/assets/favicon.bf5828d5.svg +7 -0
- package/mvc/views/react/assets/index.a5606313.css +23 -0
- package/mvc/views/react/assets/roboto-v30-latin-100.0f303f31.woff2 +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-100.34e9582c.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-500.9ce7f3ac.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-500.b0195382.woff2 +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-700.e0fd57c0.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-700.f5aebdfe.woff2 +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-regular.f2abf7fb.woff +0 -0
- package/mvc/views/react/assets/roboto-v30-latin-regular.f6734f81.woff2 +0 -0
- package/mvc/views/react/assets/root.136e0ea3.js +25451 -0
- package/mvc/views/react/assets/use-form.57ebe175.js +24472 -0
- package/mvc/views/react/assets/use-form.ecb4391b.css +36 -0
- package/mvc/views/react/auth/index.html +22 -0
- package/mvc/views/react/index.html +19 -0
- package/mvc/views/react/index2/index.html +21 -0
- package/package.json +144 -0
- package/server.js +166 -0
- package/src/server/controllers/app.controller.js +21 -0
- package/src/server/controllers/auth.controller.js +156 -0
- package/src/server/controllers/baseline.controller.js +24 -0
- package/src/server/controllers/check.controller.js +56 -0
- package/src/server/controllers/client.controller.js +173 -0
- package/src/server/controllers/index.js +12 -0
- package/src/server/controllers/logs.controller.js +30 -0
- package/src/server/controllers/runs.controller.js +25 -0
- package/src/server/controllers/settings.controller.js +23 -0
- package/src/server/controllers/snapshots.controller.js +17 -0
- package/src/server/controllers/suite.controller.js +24 -0
- package/src/server/controllers/tasks.controller.js +47 -0
- package/src/server/controllers/test.controller.js +70 -0
- package/src/server/controllers/users.controller.js +79 -0
- package/src/server/data/custom_devices.json +8 -0
- package/src/server/data/devices.json +773 -0
- package/src/server/data/get_devices.sh +2 -0
- package/src/server/lib/AppSettings.js +56 -0
- package/src/server/lib/admin.json +9 -0
- package/src/server/lib/comparator.js +147 -0
- package/src/server/lib/compareImagesNode.js +60 -0
- package/src/server/lib/dbItems.js +215 -0
- package/src/server/lib/ensureLogin/ensureLoggedIn.js +223 -0
- package/src/server/lib/ensureLogin/ensureLoggedOut.js +44 -0
- package/src/server/lib/getElementsByPixPositionsFromDump.js +72 -0
- package/src/server/lib/guest.json +9 -0
- package/src/server/lib/initialAppSettings.json +18 -0
- package/src/server/lib/logger.js +95 -0
- package/src/server/lib/onStart.js +53 -0
- package/src/server/lib/parseDiff.js.bak +72 -0
- package/src/server/lib/testAdmin.json +9 -0
- package/src/server/lib/testUsers.json +41 -0
- package/src/server/middlewares/authorization.js +50 -0
- package/src/server/middlewares/disableCors.js +19 -0
- package/src/server/models/index.js +534 -0
- package/src/server/models/plugins/index.js +3 -0
- package/src/server/models/plugins/paginate.plugin.js +83 -0
- package/src/server/models/plugins/paginateDistinct.plugin.js +80 -0
- package/src/server/models/plugins/toJSON.plugin.js +44 -0
- package/src/server/routes/ui/admin.js +20 -0
- package/src/server/routes/ui/auth.js +15 -0
- package/src/server/routes/ui/index.js +19 -0
- package/src/server/routes/v1/app.route.js +9 -0
- package/src/server/routes/v1/auth.route.js +12 -0
- package/src/server/routes/v1/baselines.route.js +14 -0
- package/src/server/routes/v1/checks.route.js +25 -0
- package/src/server/routes/v1/client.route.js +39 -0
- package/src/server/routes/v1/index.js +82 -0
- package/src/server/routes/v1/logs.route.js +16 -0
- package/src/server/routes/v1/runs.route.js +15 -0
- package/src/server/routes/v1/settings.route.js +23 -0
- package/src/server/routes/v1/snapshots.route.js +11 -0
- package/src/server/routes/v1/suites.route.js +15 -0
- package/src/server/routes/v1/tasks.route.js +59 -0
- package/src/server/routes/v1/test.route.js +20 -0
- package/src/server/routes/v1/test_distinct.route.js +14 -0
- package/src/server/routes/v1/users.route.js +36 -0
- package/src/server/schemas/createCheck.shema.ts +17 -0
- package/src/server/schemas/getBaseline.shema.ts +12 -0
- package/src/server/services/app.service.js +23 -0
- package/src/server/services/check.service.js +178 -0
- package/src/server/services/client.service.js +648 -0
- package/src/server/services/generic.service.js +51 -0
- package/src/server/services/index.js +12 -0
- package/src/server/services/logs.service.js +38 -0
- package/src/server/services/run.service.js +40 -0
- package/src/server/services/suite.service.js +39 -0
- package/src/server/services/tasks.service.js +536 -0
- package/src/server/services/test.service.js +72 -0
- package/src/server/services/user.service.js +128 -0
- package/src/server/utils/ApiError.js +14 -0
- package/src/server/utils/catchAsync.js +8 -0
- package/src/server/utils/check.js +58 -0
- package/src/server/utils/dateToISO8601.js +2 -0
- package/src/server/utils/deserializeIfJSON.js +9 -0
- package/src/server/utils/formatISOToDateTime.js +6 -0
- package/src/server/utils/index.js +10 -0
- package/src/server/utils/isJSON.js +6 -0
- package/src/server/utils/paramsGuard.ts +15 -0
- package/src/server/utils/pick.js +15 -0
- package/src/server/utils/prettyCheckParams.js +13 -0
- package/src/server/utils/snapshots.js +73 -0
- package/src/server/utils/subDays.js +7 -0
- package/src/server/utils/tests.js +36 -0
- package/src/server/utils/utils.js +146 -0
- package/src/tasks/backup.js.bak +84 -0
- package/src/tasks/backup.ts +53 -0
- package/src/tasks/lib/common.js +24 -0
- package/src/tasks/lib/utils.js +15 -0
- package/src/tasks/migrations/2.0.migration.js +86 -0
- package/src/tasks/migrations/2.0.migration.ts +95 -0
- package/src/tasks/migrations/2.0.migration_mql.js +63 -0
- package/src/tasks/reindex.js +36 -0
- package/src/tasks/restore.js.bak +100 -0
- package/src/tasks/restore.ts +75 -0
- package/src/ui-app/.eslintrc.json +119 -0
- package/src/ui-app/README.md +15 -0
- package/src/ui-app/admin/AdminLayout.tsx +38 -0
- package/src/ui-app/admin/App.tsx +108 -0
- package/src/ui-app/admin/AppContext.ts +3 -0
- package/src/ui-app/admin/components/Header/AdminHeader.tsx +148 -0
- package/src/ui-app/admin/components/Logs/AdminLogs.tsx +142 -0
- package/src/ui-app/admin/components/Logs/RefreshActionIcon.tsx +60 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTable.tsx +81 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableFilter.tsx +170 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableHeads.tsx +50 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableRows.tsx +207 -0
- package/src/ui-app/admin/components/Logs/Table/AdminLogsTableSettings.tsx +95 -0
- package/src/ui-app/admin/components/Logs/Table/InfinityScrollSkeleton.tsx +77 -0
- package/src/ui-app/admin/components/Logs/Table/InfinityScrollSkeletonFIller.tsx +57 -0
- package/src/ui-app/admin/components/Logs/Table/PagesCountAffix.tsx +61 -0
- package/src/ui-app/admin/components/Logs/Table/adminLogsCreateStyle.tsx +36 -0
- package/src/ui-app/admin/components/Logs/Table/adminLogsTableColumns.ts +52 -0
- package/src/ui-app/admin/components/Logs/UnfoldActionIcon.tsx +39 -0
- package/src/ui-app/admin/components/Navbar/AdminNavbar.tsx +50 -0
- package/src/ui-app/admin/components/Navbar/NavbarLinksGroup.tsx +104 -0
- package/src/ui-app/admin/components/Settings/AdminSettings.tsx +51 -0
- package/src/ui-app/admin/components/Settings/Forms/Boolean.tsx +59 -0
- package/src/ui-app/admin/components/Settings/Forms/FormWrapper.tsx +45 -0
- package/src/ui-app/admin/components/Settings/Forms/index.tsx +5 -0
- package/src/ui-app/admin/components/Settings/Forms/interfaces.tsx +17 -0
- package/src/ui-app/admin/components/Tasks/Task.tsx +138 -0
- package/src/ui-app/admin/components/Tasks/TaskWrapper.tsx +11 -0
- package/src/ui-app/admin/components/Tasks/tasksList.ts +59 -0
- package/src/ui-app/admin/components/Users/AdminUsers.tsx +182 -0
- package/src/ui-app/admin/components/Users/UserAddForm.tsx +137 -0
- package/src/ui-app/admin/components/Users/UserForm.tsx +196 -0
- package/src/ui-app/admin/hooks/useParams.tsx +18 -0
- package/src/ui-app/admin/index.html +17 -0
- package/src/ui-app/admin/main.tsx +24 -0
- package/src/ui-app/asserts/css/auth/index.css +23 -0
- package/src/ui-app/asserts/css/styles.css +36 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.svg +313 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-100.woff2 +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.svg +305 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-500.woff2 +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.svg +309 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-700.woff2 +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.eot +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.svg +308 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.ttf +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.woff +0 -0
- package/src/ui-app/asserts/fonts/roboto/roboto-v30-latin-regular.woff2 +0 -0
- package/src/ui-app/asserts/images/background.jpg +0 -0
- package/src/ui-app/asserts/images/bg_2_0_dark_L2.png +0 -0
- package/src/ui-app/asserts/images/favicon.svg +7 -0
- package/src/ui-app/auth/App.tsx +82 -0
- package/src/ui-app/auth/commonStyles.tsx +26 -0
- package/src/ui-app/auth/components/AuthFooter.tsx +51 -0
- package/src/ui-app/auth/components/AuthLogo.tsx +58 -0
- package/src/ui-app/auth/components/ChangePasswordForm.tsx +216 -0
- package/src/ui-app/auth/components/ChangePasswordSuccessForm.tsx +38 -0
- package/src/ui-app/auth/components/LoginForm.tsx +148 -0
- package/src/ui-app/auth/components/LogoutForm.tsx +89 -0
- package/src/ui-app/auth/components/ToggleThemeButton.tsx +41 -0
- package/src/ui-app/auth/components/change-password/Bars.tsx +45 -0
- package/src/ui-app/auth/components/change-password/PasswordRequirement.tsx +14 -0
- package/src/ui-app/auth/components/change-password/requirements.tsx +6 -0
- package/src/ui-app/auth/index.html +17 -0
- package/src/ui-app/auth/main.tsx +12 -0
- package/src/ui-app/auth/routes.tsx +26 -0
- package/src/ui-app/config.ts +15 -0
- package/src/ui-app/index.html +12 -0
- package/src/ui-app/index2/App.tsx +162 -0
- package/src/ui-app/index2/AppContext.ts +3 -0
- package/src/ui-app/index2/IndexLayout.tsx +34 -0
- package/src/ui-app/index2/components/Header/HeaderIndex.tsx +248 -0
- package/src/ui-app/index2/components/Header/QuickFilter.tsx +312 -0
- package/src/ui-app/index2/components/Navbar/Items/AcceptStatusItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/BaseItemWrapper.tsx +94 -0
- package/src/ui-app/index2/components/Navbar/Items/BrowserItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/PlatformItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/RemoveItemModalAsk.tsx +71 -0
- package/src/ui-app/index2/components/Navbar/Items/RemoveItemPopover.tsx +58 -0
- package/src/ui-app/index2/components/Navbar/Items/RemoveSuiteModalAsk.tsx +61 -0
- package/src/ui-app/index2/components/Navbar/Items/RunItem.tsx +149 -0
- package/src/ui-app/index2/components/Navbar/Items/StatusItem.tsx +42 -0
- package/src/ui-app/index2/components/Navbar/Items/SuiteItem.tsx +109 -0
- package/src/ui-app/index2/components/Navbar/Items/index.tsx +6 -0
- package/src/ui-app/index2/components/Navbar/NavbarFilter.tsx +93 -0
- package/src/ui-app/index2/components/Navbar/NavbarGroupBySelect.tsx +83 -0
- package/src/ui-app/index2/components/Navbar/NavbarIndex.tsx +247 -0
- package/src/ui-app/index2/components/Navbar/NavbarItems.tsx +38 -0
- package/src/ui-app/index2/components/Navbar/NavbarSort.tsx +105 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/RunsDummySkeleton.tsx +27 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/SimpleDummySkeleton.tsx +23 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/SkeletonWrapper.tsx +45 -0
- package/src/ui-app/index2/components/Navbar/Skeletons/SuitesDummySkeleton.tsx +27 -0
- package/src/ui-app/index2/components/Tests/Table/AcceptTestModalAsk.tsx +68 -0
- package/src/ui-app/index2/components/Tests/Table/AcceptTestsButton.tsx +44 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/Branch.tsx +35 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/BrowserName.tsx +33 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/BrowserVersion.tsx +31 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/CellWrapper.tsx +49 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/Os.tsx +32 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/StartDate.tsx +34 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/Status.tsx +50 -0
- package/src/ui-app/index2/components/Tests/Table/Cells/ViewPort.tsx +46 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/AcceptButton.tsx +142 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/Check.tsx +281 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/Canvas.tsx +36 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/helpers.ts +72 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/mainView.ts +495 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/sideToSideView.ts +398 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Canvas/simpleView.ts +21 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/CheckDetails.tsx +237 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Header.tsx +221 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedCheckItem.tsx +167 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedCheckSort.tsx +81 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedChecks.tsx +197 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedChecksItems.tsx +31 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/RelatedChecks/RelatedChecksSkeleton.tsx +37 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/HighlightButton.tsx +56 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/RegionsToolbar.tsx +150 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/ScreenshotDetails.tsx +137 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/Toolbar.tsx +101 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/ViewSegmentedControl.tsx +159 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/ZoomToolbar.tsx +326 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/Toolbar/highlightDiff.ts +167 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckDetails/hooks/useRelatedChecks.tsx +43 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/CheckModal.tsx +119 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/Checks.tsx +91 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/ChecksSkeleton.tsx +21 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/PreviewCheckTooltipLabel.tsx +121 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/RemoveButton.tsx +63 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/ViewPortLabel.tsx +94 -0
- package/src/ui-app/index2/components/Tests/Table/Checks/checkSizes.ts +27 -0
- package/src/ui-app/index2/components/Tests/Table/Filter.tsx +179 -0
- package/src/ui-app/index2/components/Tests/Table/Heads.tsx +54 -0
- package/src/ui-app/index2/components/Tests/Table/InfinityScrollSkeleton.tsx +71 -0
- package/src/ui-app/index2/components/Tests/Table/PagesCountAffix.tsx +61 -0
- package/src/ui-app/index2/components/Tests/Table/RefreshActionIcon.tsx +65 -0
- package/src/ui-app/index2/components/Tests/Table/RemoveTestModalAsk.tsx +66 -0
- package/src/ui-app/index2/components/Tests/Table/RemoveTestsButton.tsx +43 -0
- package/src/ui-app/index2/components/Tests/Table/Row.tsx +128 -0
- package/src/ui-app/index2/components/Tests/Table/Rows.tsx +87 -0
- package/src/ui-app/index2/components/Tests/Table/Settings.tsx +121 -0
- package/src/ui-app/index2/components/Tests/Table/TestsTable.tsx +140 -0
- package/src/ui-app/index2/components/Tests/Table/UnfoldActionIcon.tsx +39 -0
- package/src/ui-app/index2/components/Tests/Table/tableColumns.ts +80 -0
- package/src/ui-app/index2/components/Tests/Table/testsCreateStyle.tsx +35 -0
- package/src/ui-app/index2/components/Tests/Tests.tsx +157 -0
- package/src/ui-app/index2/hooks/useIndexSubpageEffect.tsx +14 -0
- package/src/ui-app/index2/hooks/useNavbarActiveItems.tsx +66 -0
- package/src/ui-app/index2/hooks/useParams.tsx +25 -0
- package/src/ui-app/index2/index.html +17 -0
- package/src/ui-app/index2/main.tsx +33 -0
- package/src/ui-app/package-lock.json +6150 -0
- package/src/ui-app/package.json +58 -0
- package/src/ui-app/shared/components/ActionPopoverIcon.tsx +116 -0
- package/src/ui-app/shared/components/Check/AcceptedStatusIcon.tsx +51 -0
- package/src/ui-app/shared/components/Check/BrowserIcon.tsx +50 -0
- package/src/ui-app/shared/components/Check/OsIcon.tsx +73 -0
- package/src/ui-app/shared/components/Check/Status.tsx +37 -0
- package/src/ui-app/shared/components/Check/StatusIcon.tsx +66 -0
- package/src/ui-app/shared/components/Email.tsx +83 -0
- package/src/ui-app/shared/components/Header/ApiKeyModalAsk.tsx +31 -0
- package/src/ui-app/shared/components/Header/ApiKeyModalResult.tsx +89 -0
- package/src/ui-app/shared/components/Header/HeaderLogo.tsx +82 -0
- package/src/ui-app/shared/components/Header/UserInfoModal.tsx +92 -0
- package/src/ui-app/shared/components/Header/UserMenu.tsx +151 -0
- package/src/ui-app/shared/components/Password.tsx +95 -0
- package/src/ui-app/shared/components/RelativeDrawer.tsx +43 -0
- package/src/ui-app/shared/components/SafeSelect.tsx +95 -0
- package/src/ui-app/shared/components/Tests/StatusesRing.tsx +66 -0
- package/src/ui-app/shared/components/ToggleThemeButton.tsx +33 -0
- package/src/ui-app/shared/components/Users/LabelUser.tsx +60 -0
- package/src/ui-app/shared/components/errors/ErrorFallback.tsx +66 -0
- package/src/ui-app/shared/components/filter/AcceptedFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/BrowserNameFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/CommonDistinctFilter.tsx +104 -0
- package/src/ui-app/shared/components/filter/DateFilter.tsx +54 -0
- package/src/ui-app/shared/components/filter/FilterWrapper.tsx +80 -0
- package/src/ui-app/shared/components/filter/IdFilter.tsx +60 -0
- package/src/ui-app/shared/components/filter/LogLevelFilter.tsx +77 -0
- package/src/ui-app/shared/components/filter/LogicalGroup.tsx +179 -0
- package/src/ui-app/shared/components/filter/OsFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/StatusFilter.tsx +20 -0
- package/src/ui-app/shared/components/filter/StringFilter.tsx +55 -0
- package/src/ui-app/shared/components/filter/index.ts +19 -0
- package/src/ui-app/shared/components/heaserLinks.tsx +4 -0
- package/src/ui-app/shared/hooks/index.ts +3 -0
- package/src/ui-app/shared/hooks/useColorSheme.ts +22 -0
- package/src/ui-app/shared/hooks/useDistinctLogQuery.tsx +33 -0
- package/src/ui-app/shared/hooks/useDistinctQuery.tsx +37 -0
- package/src/ui-app/shared/hooks/useInfinityScroll.tsx +163 -0
- package/src/ui-app/shared/hooks/useInfinityScrollRelatedChecks.tsx +60 -0
- package/src/ui-app/shared/hooks/useNavProgressFetchEffect.tsx +17 -0
- package/src/ui-app/shared/hooks/useSubpageEffect.tsx +28 -0
- package/src/ui-app/shared/hooks/user.hooks.ts +49 -0
- package/src/ui-app/shared/interfaces/ILog.tsx +13 -0
- package/src/ui-app/shared/interfaces/IUser.tsx +13 -0
- package/src/ui-app/shared/interfaces/logQueries.tsx +31 -0
- package/src/ui-app/shared/navigation/interfaces.tsx +7 -0
- package/src/ui-app/shared/navigation/navigationData.tsx +191 -0
- package/src/ui-app/shared/services/checks.service.ts +39 -0
- package/src/ui-app/shared/services/generic.service.ts +115 -0
- package/src/ui-app/shared/services/index.ts +6 -0
- package/src/ui-app/shared/services/runs.service.ts +20 -0
- package/src/ui-app/shared/services/suites.service.ts +20 -0
- package/src/ui-app/shared/services/tests.service.ts +39 -0
- package/src/ui-app/shared/services/users.service.ts +29 -0
- package/src/ui-app/shared/utils/Logger.ts +12 -0
- package/src/ui-app/shared/utils/SearchParams.ts +17 -0
- package/src/ui-app/shared/utils/filters.tsx +14 -0
- package/src/ui-app/shared/utils/index.ts +5 -0
- package/src/ui-app/shared/utils/utils.tsx +70 -0
- package/src/ui-app/stub.html +12 -0
- package/src/ui-app/stub.tsx +58 -0
- package/src/ui-app/stubDemoColors.tsx +47 -0
- package/src/ui-app/stubDemoNav.tsx +41 -0
- package/src/ui-app/tsconfig.json +21 -0
- package/src/ui-app/tsconfig.node.json +12 -0
- package/static/A.png +0 -0
- package/static/B.png +0 -0
- package/static/affected.html +39 -0
- package/static/affected_2.html +40 -0
- package/static/data/custom_devices.json +14 -0
- package/static/grids/desktop-higher.html +72 -0
- package/static/grids/desktop-wider.html +72 -0
- package/static/grids/desktop.html +61 -0
- package/static/grids/fit-in-view.html +62 -0
- package/static/js/canvasjs.min.js.bak +957 -0
- package/static/js/chart.js.bak +92 -0
- package/static/js/jquery-3.3.1.slim.js.bak +8269 -0
- package/static/js/jquery-3.3.1.slim.min.js.bak +2 -0
- package/static/js/moment.min.js.bak +2 -0
- package/static/low_diff_0.png +0 -0
- package/static/low_diff_1.png +0 -0
- package/static/vShift.png +0 -0
- package/static/vShift_bottom.png +0 -0
- package/static/vShift_top.png +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-param-reassign, valid-jsdoc */
|
|
3
|
+
const paginate = (schema) => {
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} QueryResult
|
|
6
|
+
* @property {Document[]} results - Results found
|
|
7
|
+
* @property {number} page - Current page
|
|
8
|
+
* @property {number} limit - Maximum number of results per page
|
|
9
|
+
* @property {number} totalPages - Total number of pages
|
|
10
|
+
* @property {number} totalResults - Total number of documents
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Query for documents with pagination
|
|
14
|
+
* @param {Object} [filter] - Mongo filter
|
|
15
|
+
* @param {Object} [options] - Query options
|
|
16
|
+
* @param {string} [options.sortBy] - Sorting criteria using the format: sortField:(desc|asc).
|
|
17
|
+
* Multiple sorting criteria should be separated by commas (,)
|
|
18
|
+
* @param {string} [options.populate] - Populate data fields. Hierarchy of fields should be separated by (.).
|
|
19
|
+
* Multiple populating criteria should be separated by commas (,)
|
|
20
|
+
* @param {number} [options.limit] - Maximum number of results per page (default = 10)
|
|
21
|
+
* @param {number} [options.page] - Current page (default = 1)
|
|
22
|
+
* @returns {Promise<QueryResult>}
|
|
23
|
+
*/
|
|
24
|
+
// eslint-disable-next-line func-names
|
|
25
|
+
schema.statics.paginate = async function (filter, options) {
|
|
26
|
+
let sort = '';
|
|
27
|
+
if (options.sortBy) {
|
|
28
|
+
const sortingCriteria = [];
|
|
29
|
+
options.sortBy.split(',')
|
|
30
|
+
.forEach((sortOption) => {
|
|
31
|
+
const [key, order] = sortOption.split(':');
|
|
32
|
+
sortingCriteria.push((order === 'desc' ? '-' : '') + key);
|
|
33
|
+
});
|
|
34
|
+
sort = sortingCriteria.join(' ');
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
sort = { _id: -1 };
|
|
38
|
+
}
|
|
39
|
+
const limit = options.limit && parseInt(options.limit, 10) >= 0 ? parseInt(options.limit, 10) : 10;
|
|
40
|
+
const page = options.page && parseInt(options.page, 10) > 0 ? parseInt(options.page, 10) : 1;
|
|
41
|
+
const skip = (page - 1) * limit;
|
|
42
|
+
const countPromise = this.countDocuments(filter)
|
|
43
|
+
.exec();
|
|
44
|
+
let docsPromise = this.find(filter)
|
|
45
|
+
.sort(sort)
|
|
46
|
+
.skip(skip)
|
|
47
|
+
.limit(limit);
|
|
48
|
+
if (options.populate) {
|
|
49
|
+
options.populate.split(',')
|
|
50
|
+
.forEach((populateOption) => {
|
|
51
|
+
docsPromise = docsPromise.populate(populateOption
|
|
52
|
+
.split('.')
|
|
53
|
+
.reverse()
|
|
54
|
+
.reduce((a, b) => ({ path: b, populate: a })));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
docsPromise = docsPromise.exec();
|
|
58
|
+
return Promise.all([countPromise, docsPromise])
|
|
59
|
+
.then((values) => {
|
|
60
|
+
const [totalResults, results] = values;
|
|
61
|
+
const totalPages = Math.ceil(totalResults / limit);
|
|
62
|
+
const result = {
|
|
63
|
+
results,
|
|
64
|
+
page,
|
|
65
|
+
limit,
|
|
66
|
+
totalPages,
|
|
67
|
+
totalResults,
|
|
68
|
+
// microseconds
|
|
69
|
+
timestamp: Number(Date.now() + String(process.hrtime()[1])
|
|
70
|
+
.slice(3, 6)),
|
|
71
|
+
};
|
|
72
|
+
return Promise.resolve(result);
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
module.exports = paginate;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-param-reassign, valid-jsdoc */
|
|
3
|
+
const { EJSON } = require('bson');
|
|
4
|
+
const paginateDistinct = (schema) => {
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {Object} QueryResult
|
|
7
|
+
* @property {Document[]} results - Results found
|
|
8
|
+
* @property {number} page - Current page
|
|
9
|
+
* @property {number} limit - Maximum number of results per page
|
|
10
|
+
* @property {number} totalPages - Total number of pages
|
|
11
|
+
* @property {number} totalResults - Total number of documents
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Query for documents with pagination
|
|
15
|
+
* @param {Object} [filter] - Mongo filter
|
|
16
|
+
* @param {Object} [options] - Query options
|
|
17
|
+
* @param {string} [options.sortBy] - Sorting criteria using the format: sortField:(desc|asc).
|
|
18
|
+
* Multiple sorting criteria should be separated by commas (,)
|
|
19
|
+
* @param {string} [options.populate] - Populate data fields. Hierarchy of fields should be separated by (.).
|
|
20
|
+
* Multiple populating criteria should be separated by commas (,)
|
|
21
|
+
* @param {number} [options.limit] - Maximum number of results per page (default = 10)
|
|
22
|
+
* @param {number} [options.page] - Current page (default = 1)
|
|
23
|
+
* @returns {Promise<QueryResult>}
|
|
24
|
+
*/
|
|
25
|
+
// eslint-disable-next-line func-names
|
|
26
|
+
schema.statics.paginateDistinct = async function (filter, options) {
|
|
27
|
+
let sort = {};
|
|
28
|
+
if (options.sortBy) {
|
|
29
|
+
options.sortBy.split(',')
|
|
30
|
+
.forEach((sortOption) => {
|
|
31
|
+
const [key, order] = sortOption.split(':');
|
|
32
|
+
sort[key] = (order === 'desc') ? -1 : 1;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
sort = { _id: -1 };
|
|
37
|
+
}
|
|
38
|
+
let limit = options.limit && parseInt(options.limit, 10) >= 0 ? parseInt(options.limit, 10) : 10;
|
|
39
|
+
limit = limit === 0 ? 9007199254740991 : limit;
|
|
40
|
+
const page = options.page && parseInt(options.page, 10) > 0 ? parseInt(options.page, 10) : 1;
|
|
41
|
+
const skip = (page - 1) * limit;
|
|
42
|
+
const groupAggregateObj = { $group: { _id: `$${options.field}` } };
|
|
43
|
+
const documentsCount = (await this.aggregate([groupAggregateObj])
|
|
44
|
+
.exec()).length;
|
|
45
|
+
const aggregateArr = [
|
|
46
|
+
{ $match: EJSON.parse(filter.filter || '{}') },
|
|
47
|
+
groupAggregateObj,
|
|
48
|
+
{ $sort: sort },
|
|
49
|
+
{ $skip: skip },
|
|
50
|
+
{ $limit: limit },
|
|
51
|
+
];
|
|
52
|
+
const aggregatedDocs = (await this.aggregate(aggregateArr))
|
|
53
|
+
.filter((x) => x._id)
|
|
54
|
+
.map((x) => {
|
|
55
|
+
if (x[options.field]) {
|
|
56
|
+
return x[options.field][0];
|
|
57
|
+
}
|
|
58
|
+
return { name: x._id };
|
|
59
|
+
});
|
|
60
|
+
return Promise.all([documentsCount, aggregatedDocs])
|
|
61
|
+
.then((values) => {
|
|
62
|
+
const [totalResults, results] = values;
|
|
63
|
+
const totalPages = Math.ceil(totalResults / limit);
|
|
64
|
+
const result = {
|
|
65
|
+
results,
|
|
66
|
+
page,
|
|
67
|
+
limit,
|
|
68
|
+
totalPages,
|
|
69
|
+
totalResults,
|
|
70
|
+
timestamp: new Date() / 1,
|
|
71
|
+
};
|
|
72
|
+
return Promise.resolve(result);
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
module.exports = paginateDistinct;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-param-reassign */
|
|
3
|
+
/**
|
|
4
|
+
* A mongoose schema plugin which applies the following in the toJSON transform call:
|
|
5
|
+
* - removes __v, createdAt, updatedAt, and any path that has private: true
|
|
6
|
+
* - replaces _id with id
|
|
7
|
+
*/
|
|
8
|
+
const deleteAtPath = (obj, path, index) => {
|
|
9
|
+
if (index === path.length - 1) {
|
|
10
|
+
delete obj[path[index]];
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
deleteAtPath(obj[path[index]], path, index + 1);
|
|
14
|
+
};
|
|
15
|
+
const toJSON = (schema) => {
|
|
16
|
+
let transform;
|
|
17
|
+
if (schema.options.toJSON && schema.options.toJSON.transform) {
|
|
18
|
+
transform = schema.options.toJSON.transform;
|
|
19
|
+
}
|
|
20
|
+
schema.options.toJSON = Object.assign(schema.options.toJSON || {}, {
|
|
21
|
+
transform(doc, ret, options) {
|
|
22
|
+
Object.keys(schema.paths).forEach((path) => {
|
|
23
|
+
if (schema.paths[path].options && schema.paths[path].options.private) {
|
|
24
|
+
deleteAtPath(ret, path.split('.'), 0);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
ret.id = ret._id.toString();
|
|
28
|
+
// delete ret._id;
|
|
29
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
30
|
+
delete ret.__v;
|
|
31
|
+
delete ret.createdAt;
|
|
32
|
+
delete ret.updatedAt;
|
|
33
|
+
if (transform) {
|
|
34
|
+
return transform(doc, ret, options);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
module.exports = toJSON;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCheckParamsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.createCheckParamsSchema = zod_1.z.object({
|
|
6
|
+
branch: zod_1.z.string().min(1),
|
|
7
|
+
appName: zod_1.z.string().min(1),
|
|
8
|
+
suitename: zod_1.z.string().min(1),
|
|
9
|
+
testid: zod_1.z.string().regex(/^[a-f0-9]{24}$/),
|
|
10
|
+
name: zod_1.z.string().min(1),
|
|
11
|
+
viewport: zod_1.z.string().regex(/^\d+x\d+$/),
|
|
12
|
+
browserName: zod_1.z.string().min(1),
|
|
13
|
+
browserVersion: zod_1.z.string().min(1),
|
|
14
|
+
browserFullVersion: zod_1.z.string(),
|
|
15
|
+
os: zod_1.z.string().min(1),
|
|
16
|
+
hashcode: zod_1.z.string().length(128) // Assuming hashcode is always 128 chars length
|
|
17
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequiredIdentOptionsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.RequiredIdentOptionsSchema = zod_1.z.object({
|
|
6
|
+
name: zod_1.z.string().min(1),
|
|
7
|
+
viewport: zod_1.z.string().min(3),
|
|
8
|
+
browserName: zod_1.z.string().min(1),
|
|
9
|
+
os: zod_1.z.string().min(1),
|
|
10
|
+
app: zod_1.z.string().min(1),
|
|
11
|
+
branch: zod_1.z.string().min(1),
|
|
12
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paramsGuard = void 0;
|
|
4
|
+
const paramsGuard = (params, functionName, schema) => {
|
|
5
|
+
const result = schema.safeParse(params);
|
|
6
|
+
if (result.success) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
const errorDetails = result.error.format();
|
|
11
|
+
throw new Error(`
|
|
12
|
+
Invalid '${functionName}' parameters: ${JSON.stringify(errorDetails)}
|
|
13
|
+
\n error: ${result.error?.stack || result.error}
|
|
14
|
+
\n params: ${JSON.stringify(params, null, 2)}
|
|
15
|
+
`);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.paramsGuard = paramsGuard;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
27
|
+
const fs = __importStar(require("node:fs"));
|
|
28
|
+
const path = __importStar(require("node:path"));
|
|
29
|
+
const child_process_1 = require("child_process");
|
|
30
|
+
const config_1 = require("../../config");
|
|
31
|
+
const run = async () => {
|
|
32
|
+
const backupFolder = config_1.config.backupsFolder;
|
|
33
|
+
if (!fs.existsSync(backupFolder)) {
|
|
34
|
+
fs.mkdirSync(backupFolder, { recursive: true });
|
|
35
|
+
}
|
|
36
|
+
console.log('Please be sure that \'mongodump\', \'mongorestore\' and \'rsync\' tools are present in your system.');
|
|
37
|
+
const currDate = new Date().toLocaleString('en-US', { year: 'numeric', month: '2-digit', day: 'numeric' })
|
|
38
|
+
.replace(/[/]/gm, '_');
|
|
39
|
+
const backupSubFolder = `${currDate}_${Date.now()}`;
|
|
40
|
+
const answers = {
|
|
41
|
+
folder: await (0, prompts_1.input)({ message: 'Enter the Backup Folder name Filename', default: backupSubFolder }),
|
|
42
|
+
connectionString: await (0, prompts_1.input)({ message: 'Enter the Database Connection String URI', default: config_1.config.connectionString }),
|
|
43
|
+
imagesPath: await (0, prompts_1.input)({ message: 'Enter the Images Folder Path', default: config_1.config.defaultImagesPath }),
|
|
44
|
+
confirm: await (0, prompts_1.confirm)({ message: 'Continue?' }),
|
|
45
|
+
};
|
|
46
|
+
if (!answers.confirm) {
|
|
47
|
+
return "Skipped";
|
|
48
|
+
}
|
|
49
|
+
const fullBackupPath = path.join(backupFolder, answers.folder);
|
|
50
|
+
if (fs.existsSync(fullBackupPath)) {
|
|
51
|
+
console.log('The folder is already exists, please enter another folder ');
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
fs.mkdirSync(fullBackupPath, { recursive: true });
|
|
55
|
+
const destDatabasePath = path.join(fullBackupPath, 'database');
|
|
56
|
+
fs.mkdirSync(destDatabasePath, { recursive: true });
|
|
57
|
+
const destImagesPath = path.join(fullBackupPath, 'images');
|
|
58
|
+
fs.mkdirSync(fullBackupPath, { recursive: true });
|
|
59
|
+
console.log('Backup the Database');
|
|
60
|
+
const dbDumpResult = (0, child_process_1.execSync)(`mongodump --uri=${answers.connectionString} --gzip --out ${destDatabasePath}`).toString();
|
|
61
|
+
console.log(dbDumpResult);
|
|
62
|
+
console.log('Backup Images');
|
|
63
|
+
const imagesBackupResult = (0, child_process_1.execSync)(`rsync -vah --progress ${answers.imagesPath} ${destImagesPath}`)
|
|
64
|
+
.toString('utf8');
|
|
65
|
+
console.log(imagesBackupResult);
|
|
66
|
+
return '✅ Success';
|
|
67
|
+
};
|
|
68
|
+
run().then((result) => console.log(`operation complete: ${result}`));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const { Snapshot, Check, Test, Run, App, Suite, User, Baseline, } = require('../../server/models');
|
|
3
|
+
// const url = 'mongodb://localhost/VRSdb';
|
|
4
|
+
module.exports = {
|
|
5
|
+
// url,
|
|
6
|
+
User,
|
|
7
|
+
Snapshot,
|
|
8
|
+
Check,
|
|
9
|
+
Test,
|
|
10
|
+
Run,
|
|
11
|
+
App,
|
|
12
|
+
Suite,
|
|
13
|
+
Baseline,
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const mongoose = require('mongoose');
|
|
3
|
+
const { url } = require('./common');
|
|
4
|
+
const connect = async () => {
|
|
5
|
+
const connection = await mongoose.connect(url, {});
|
|
6
|
+
console.log(`Mongoose default connection open to: '${url}', models: '${Object.keys(connection.models)
|
|
7
|
+
.join(', ')}'`);
|
|
8
|
+
return connection;
|
|
9
|
+
};
|
|
10
|
+
module.exports.runMongoCode = async (cb) => {
|
|
11
|
+
await connect();
|
|
12
|
+
await cb();
|
|
13
|
+
await mongoose.connection.close();
|
|
14
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-await-in-loop,no-restricted-syntax */
|
|
3
|
+
require('../../server/models');
|
|
4
|
+
const utils = require('../lib/utils');
|
|
5
|
+
const { Check, Test, Run, Suite } = require('../lib/common');
|
|
6
|
+
async function task() {
|
|
7
|
+
await utils.runMongoCode(async () => {
|
|
8
|
+
try {
|
|
9
|
+
/**
|
|
10
|
+
* 0. fill test collection with 'checks' field array
|
|
11
|
+
* */
|
|
12
|
+
console.log('\nStage: 0');
|
|
13
|
+
const checks = await Check.find({});
|
|
14
|
+
// console.log(checks);
|
|
15
|
+
for (const check of checks) {
|
|
16
|
+
const testId = check.test;
|
|
17
|
+
const test = await Test.findOne({ _id: testId });
|
|
18
|
+
if (test && testId && !test.checks.map((x) => x.toString()).includes(check?._id.toString())) {
|
|
19
|
+
const newChecksArray = test.checks || [];
|
|
20
|
+
newChecksArray.push(check._id);
|
|
21
|
+
await test.update({ _id: test._id }, { $set: { checks: newChecksArray } });
|
|
22
|
+
await test.save();
|
|
23
|
+
process.stdout.write('.');
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
process.stdout.write('x');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 1. fill test suite fields
|
|
31
|
+
* */
|
|
32
|
+
console.log('\nStage: 1');
|
|
33
|
+
const tests = await Test.find({});
|
|
34
|
+
for (const test of tests) {
|
|
35
|
+
// console.log(test.checks[0]);
|
|
36
|
+
const firstCheckId = test.checks[0];
|
|
37
|
+
if (firstCheckId) {
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
const firstCheck = await Check.findOne({ _id: test.checks[0] });
|
|
40
|
+
if (firstCheck) {
|
|
41
|
+
const { suite } = firstCheck;
|
|
42
|
+
if (suite) {
|
|
43
|
+
test.suite = suite;
|
|
44
|
+
await Test.update({ _id: test._id }, { $set: { suite } });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
process.stdout.write('x');
|
|
50
|
+
}
|
|
51
|
+
process.stdout.write('.');
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 2. set app id for runs and suites
|
|
55
|
+
* */
|
|
56
|
+
console.log('\nStage: 2');
|
|
57
|
+
for (const x of tests) {
|
|
58
|
+
const appId = x.app;
|
|
59
|
+
await Run.update({ _id: x.run }, { $set: { app: appId } });
|
|
60
|
+
await Suite.update({ _id: x.suite }, { $set: { app: appId } });
|
|
61
|
+
process.stdout.write('.');
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* 3. populate 'runs' and 'suites' with 'createdDate' field
|
|
65
|
+
* */
|
|
66
|
+
console.log('\nStage: 3');
|
|
67
|
+
const suites = await Suite.find({});
|
|
68
|
+
for (const x of suites) {
|
|
69
|
+
await Suite.update({ _id: x._id }, { $set: { createdDate: x._id.getTimestamp() } });
|
|
70
|
+
process.stdout.write('+');
|
|
71
|
+
}
|
|
72
|
+
const runs = await Run.find({});
|
|
73
|
+
for (const x of runs) {
|
|
74
|
+
await Run.update({ _id: x._id }, { $set: { createdDate: x._id.getTimestamp() } });
|
|
75
|
+
process.stdout.write('>');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
console.error(err);
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
console.log('\nDone');
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
task();
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* 0. fill test collection with 'checks' field array
|
|
5
|
+
**/
|
|
6
|
+
const checks = db.vrschecks.find({}).toArray();
|
|
7
|
+
for (const check of checks) {
|
|
8
|
+
const testId = check.test;
|
|
9
|
+
if (testId) {
|
|
10
|
+
const test = db.vrstests.findOne({ _id: testId });
|
|
11
|
+
const newChecksArray = test.checks || [];
|
|
12
|
+
newChecksArray.push(check._id);
|
|
13
|
+
db.vrstests.update({ _id: test._id }, { $set: { "checks": newChecksArray } });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 1. fill test suite fields
|
|
18
|
+
**/
|
|
19
|
+
const tests = db.vrstests.find({}).toArray();
|
|
20
|
+
tests.forEach((test) => {
|
|
21
|
+
console.log(test.checks[0]);
|
|
22
|
+
const firstCheckId = test.checks[0];
|
|
23
|
+
if (firstCheckId) {
|
|
24
|
+
const firstCheck = db.vrschecks.findOne({ _id: test.checks[0] });
|
|
25
|
+
if (firstCheck) {
|
|
26
|
+
const suite = firstCheck.suite;
|
|
27
|
+
if (suite) {
|
|
28
|
+
test.suite = suite;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
console.log('Cannot find checks');
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* 2. set app id for runs and suites
|
|
38
|
+
**/
|
|
39
|
+
db.vrstests.find({}).forEach((x) => {
|
|
40
|
+
const appId = x.app;
|
|
41
|
+
console.log({ appId });
|
|
42
|
+
db.vrsruns.update({ _id: x.run }, { $set: { "app": appId } });
|
|
43
|
+
db.vrssuites.update({ _id: x.suite }, { $set: { "app": appId } });
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* 3. populate 'runs' and 'suites' with 'createdDate' field
|
|
47
|
+
**/
|
|
48
|
+
db.vrssuites.find({}).forEach((x) => {
|
|
49
|
+
// x.createdDate = x._id.getTimestamp();
|
|
50
|
+
db.vrssuites.update({ _id: x._id }, { $set: { "createdDate": x._id.getTimestamp() } });
|
|
51
|
+
console.log(x.updatedDate);
|
|
52
|
+
});
|
|
53
|
+
db.vrsruns.find({}).forEach((x) => {
|
|
54
|
+
// x.createdDate = x._id.getTimestamp();
|
|
55
|
+
db.vrsruns.update({ _id: x._id }, { $set: { "createdDate": x._id.getTimestamp() } });
|
|
56
|
+
console.log(x.updatedDate);
|
|
57
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
require('../server/models');
|
|
3
|
+
const utils = require('./lib/utils');
|
|
4
|
+
const { User, Snapshot, Check, Test, Run, Log, App, Suite, Baseline, } = require('./lib/common');
|
|
5
|
+
(async () => {
|
|
6
|
+
await utils.runMongoCode(() => {
|
|
7
|
+
return new Promise(async (resolve, reject) => {
|
|
8
|
+
const result = [];
|
|
9
|
+
[User, Snapshot, Check, Test, Run, Log, App, Suite, Baseline].forEach((model) => {
|
|
10
|
+
result.push(model.collection.dropIndexes()
|
|
11
|
+
.then(() => {
|
|
12
|
+
console.log(`Drop: '${model.collection.name}'`);
|
|
13
|
+
})
|
|
14
|
+
.catch((err) => {
|
|
15
|
+
console.log(`Cannot drop index '${model.collection.name}', error: '${err}' `);
|
|
16
|
+
}));
|
|
17
|
+
});
|
|
18
|
+
return resolve(await Promise.all(result)
|
|
19
|
+
.catch((err) => {
|
|
20
|
+
console.log('ERROR:');
|
|
21
|
+
console.error(err);
|
|
22
|
+
})
|
|
23
|
+
.then(() => {
|
|
24
|
+
console.log('End of reindex task');
|
|
25
|
+
}));
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
})();
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
/* eslint-disable no-console */
|
|
27
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
28
|
+
const fs = __importStar(require("node:fs"));
|
|
29
|
+
const path = __importStar(require("node:path"));
|
|
30
|
+
const child_process_1 = require("child_process");
|
|
31
|
+
const config_1 = require("../../config");
|
|
32
|
+
const run = async () => {
|
|
33
|
+
const backupFolder = config_1.config.backupsFolder;
|
|
34
|
+
if (!fs.existsSync(backupFolder)) {
|
|
35
|
+
fs.mkdirSync(backupFolder, { recursive: true });
|
|
36
|
+
}
|
|
37
|
+
console.log('Be sure that Application is down and \'mongodump\', \'mongorestore\' and \'rsync\' tools are present in your system.');
|
|
38
|
+
const backupsFolders = fs.readdirSync(backupFolder, { withFileTypes: true })
|
|
39
|
+
.filter((x) => x.isDirectory())
|
|
40
|
+
.map((x) => ({ name: x.name, value: x.name }));
|
|
41
|
+
const answers = {
|
|
42
|
+
backupSubFolder: await (0, prompts_1.select)({ message: 'Enter the Backup Folder name Filename', choices: backupsFolders }),
|
|
43
|
+
destConnectionString: await (0, prompts_1.input)({ message: 'Enter the Destination Database Connection String URI', default: config_1.config.connectionString }),
|
|
44
|
+
destImagesSubFolder: await (0, prompts_1.input)({ message: 'Enter the Images Folder Path', default: config_1.config.defaultImagesPath }),
|
|
45
|
+
confirm: await (0, prompts_1.confirm)({ message: '⚠️ Caution! All current Application Data will be removed, before the Restoring! Continue?', default: false }),
|
|
46
|
+
};
|
|
47
|
+
if (!answers.confirm) {
|
|
48
|
+
return 'Skipped';
|
|
49
|
+
}
|
|
50
|
+
const fullBackupPath = path.join(backupFolder, answers.backupSubFolder);
|
|
51
|
+
console.log({ fullBackupPath });
|
|
52
|
+
const fullSourceDatabasePath = path.join(fullBackupPath, 'database');
|
|
53
|
+
if (!fs.existsSync(fullSourceDatabasePath)) {
|
|
54
|
+
console.log('The Source Database Folder is not exists, please select tha another folder');
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const fullSourceImagesPath = path.join(fullBackupPath, 'images');
|
|
58
|
+
if (!fs.existsSync(fullSourceImagesPath)) {
|
|
59
|
+
console.log('The Source Images Folder is not exists, please select tha another folder');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!fs.existsSync(answers.destImagesSubFolder)) {
|
|
63
|
+
console.log('The Destination Images Folder is not exists, please select tha another folder');
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
console.log('Remove the Destination Database');
|
|
67
|
+
const removeDbResult = (0, child_process_1.execSync)(`mongosh '${answers.destConnectionString}' --eval "db.dropDatabase();"`)
|
|
68
|
+
.toString();
|
|
69
|
+
console.log(removeDbResult);
|
|
70
|
+
console.log('Restore the Database');
|
|
71
|
+
const restoreDbResult = (0, child_process_1.execSync)(`mongorestore --uri ${answers.destConnectionString} --gzip ${fullSourceDatabasePath}/*`)
|
|
72
|
+
.toString();
|
|
73
|
+
console.log(restoreDbResult);
|
|
74
|
+
console.log('Clean the Destination Images Folder');
|
|
75
|
+
// eslint-disable-next-line max-len
|
|
76
|
+
const removeImagesResult = (0, child_process_1.execSync)(`ls ${answers.destImagesSubFolder};rm -rfv ${answers.destImagesSubFolder} && mkdir ${answers.destImagesSubFolder}`)
|
|
77
|
+
.toString();
|
|
78
|
+
console.log(removeImagesResult);
|
|
79
|
+
console.log('Restore the Images');
|
|
80
|
+
console.log({ fullSourceImagesPath });
|
|
81
|
+
const restoreImagesResult = (0, child_process_1.execSync)(`rsync -vah --progress ${fullSourceImagesPath}/ ${answers.destImagesSubFolder}`)
|
|
82
|
+
.toString('utf8');
|
|
83
|
+
console.log(restoreImagesResult);
|
|
84
|
+
return '✅ Success';
|
|
85
|
+
};
|
|
86
|
+
run().then((result) => console.log(`operation complete: ${result}`));
|