nestlens 0.1.0
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/LICENSE +21 -0
- package/README.md +145 -0
- package/dist/__tests__/api/api.controller.spec.d.ts +2 -0
- package/dist/__tests__/api/api.controller.spec.d.ts.map +1 -0
- package/dist/__tests__/api/api.controller.spec.js +982 -0
- package/dist/__tests__/api/api.controller.spec.js.map +1 -0
- package/dist/__tests__/api/api.guard.spec.d.ts +2 -0
- package/dist/__tests__/api/api.guard.spec.d.ts.map +1 -0
- package/dist/__tests__/api/api.guard.spec.js +572 -0
- package/dist/__tests__/api/api.guard.spec.js.map +1 -0
- package/dist/__tests__/api/dashboard.controller.spec.d.ts +2 -0
- package/dist/__tests__/api/dashboard.controller.spec.d.ts.map +1 -0
- package/dist/__tests__/api/dashboard.controller.spec.js +474 -0
- package/dist/__tests__/api/dashboard.controller.spec.js.map +1 -0
- package/dist/__tests__/api/tag.controller.spec.d.ts +2 -0
- package/dist/__tests__/api/tag.controller.spec.d.ts.map +1 -0
- package/dist/__tests__/api/tag.controller.spec.js +280 -0
- package/dist/__tests__/api/tag.controller.spec.js.map +1 -0
- package/dist/__tests__/collector.service.spec.d.ts +2 -0
- package/dist/__tests__/collector.service.spec.d.ts.map +1 -0
- package/dist/__tests__/collector.service.spec.js +240 -0
- package/dist/__tests__/collector.service.spec.js.map +1 -0
- package/dist/__tests__/core/collector.service.spec.d.ts +2 -0
- package/dist/__tests__/core/collector.service.spec.d.ts.map +1 -0
- package/dist/__tests__/core/collector.service.spec.js +526 -0
- package/dist/__tests__/core/collector.service.spec.js.map +1 -0
- package/dist/__tests__/core/family-hash.service.spec.d.ts +2 -0
- package/dist/__tests__/core/family-hash.service.spec.d.ts.map +1 -0
- package/dist/__tests__/core/family-hash.service.spec.js +1117 -0
- package/dist/__tests__/core/family-hash.service.spec.js.map +1 -0
- package/dist/__tests__/core/pruning.service.spec.d.ts +2 -0
- package/dist/__tests__/core/pruning.service.spec.d.ts.map +1 -0
- package/dist/__tests__/core/pruning.service.spec.js +224 -0
- package/dist/__tests__/core/pruning.service.spec.js.map +1 -0
- package/dist/__tests__/core/storage/sqlite.storage.spec.d.ts +2 -0
- package/dist/__tests__/core/storage/sqlite.storage.spec.d.ts.map +1 -0
- package/dist/__tests__/core/storage/sqlite.storage.spec.js +853 -0
- package/dist/__tests__/core/storage/sqlite.storage.spec.js.map +1 -0
- package/dist/__tests__/core/tag.service.spec.d.ts +2 -0
- package/dist/__tests__/core/tag.service.spec.d.ts.map +1 -0
- package/dist/__tests__/core/tag.service.spec.js +994 -0
- package/dist/__tests__/core/tag.service.spec.js.map +1 -0
- package/dist/__tests__/family-hash.service.spec.d.ts +2 -0
- package/dist/__tests__/family-hash.service.spec.d.ts.map +1 -0
- package/dist/__tests__/family-hash.service.spec.js +325 -0
- package/dist/__tests__/family-hash.service.spec.js.map +1 -0
- package/dist/__tests__/filters/api-filters.spec.d.ts +2 -0
- package/dist/__tests__/filters/api-filters.spec.d.ts.map +1 -0
- package/dist/__tests__/filters/api-filters.spec.js +172 -0
- package/dist/__tests__/filters/api-filters.spec.js.map +1 -0
- package/dist/__tests__/filters/entry-factories.d.ts +20 -0
- package/dist/__tests__/filters/entry-factories.d.ts.map +1 -0
- package/dist/__tests__/filters/entry-factories.js +288 -0
- package/dist/__tests__/filters/entry-factories.js.map +1 -0
- package/dist/__tests__/filters/filter-contract.spec.d.ts +2 -0
- package/dist/__tests__/filters/filter-contract.spec.d.ts.map +1 -0
- package/dist/__tests__/filters/filter-contract.spec.js +230 -0
- package/dist/__tests__/filters/filter-contract.spec.js.map +1 -0
- package/dist/__tests__/filters/filter-test-data.d.ts +26 -0
- package/dist/__tests__/filters/filter-test-data.d.ts.map +1 -0
- package/dist/__tests__/filters/filter-test-data.js +374 -0
- package/dist/__tests__/filters/filter-test-data.js.map +1 -0
- package/dist/__tests__/filters/storage-filters.spec.d.ts +2 -0
- package/dist/__tests__/filters/storage-filters.spec.d.ts.map +1 -0
- package/dist/__tests__/filters/storage-filters.spec.js +699 -0
- package/dist/__tests__/filters/storage-filters.spec.js.map +1 -0
- package/dist/__tests__/filters/test-utils.d.ts +23 -0
- package/dist/__tests__/filters/test-utils.d.ts.map +1 -0
- package/dist/__tests__/filters/test-utils.js +54 -0
- package/dist/__tests__/filters/test-utils.js.map +1 -0
- package/dist/__tests__/nestlens.module.spec.d.ts +2 -0
- package/dist/__tests__/nestlens.module.spec.d.ts.map +1 -0
- package/dist/__tests__/nestlens.module.spec.js +620 -0
- package/dist/__tests__/nestlens.module.spec.js.map +1 -0
- package/dist/__tests__/pruning.service.spec.d.ts +2 -0
- package/dist/__tests__/pruning.service.spec.d.ts.map +1 -0
- package/dist/__tests__/pruning.service.spec.js +142 -0
- package/dist/__tests__/pruning.service.spec.js.map +1 -0
- package/dist/__tests__/setup.d.ts +7 -0
- package/dist/__tests__/setup.d.ts.map +1 -0
- package/dist/__tests__/setup.js +24 -0
- package/dist/__tests__/setup.js.map +1 -0
- package/dist/__tests__/tag.service.spec.d.ts +2 -0
- package/dist/__tests__/tag.service.spec.d.ts.map +1 -0
- package/dist/__tests__/tag.service.spec.js +482 -0
- package/dist/__tests__/tag.service.spec.js.map +1 -0
- package/dist/__tests__/watchers/batch.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/batch.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/batch.watcher.spec.js +515 -0
- package/dist/__tests__/watchers/batch.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/cache.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/cache.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/cache.watcher.spec.js +395 -0
- package/dist/__tests__/watchers/cache.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/command.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/command.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/command.watcher.spec.js +598 -0
- package/dist/__tests__/watchers/command.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/dump.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/dump.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/dump.watcher.spec.js +724 -0
- package/dist/__tests__/watchers/dump.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/event.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/event.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/event.watcher.spec.js +316 -0
- package/dist/__tests__/watchers/event.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/exception.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/exception.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/exception.watcher.spec.js +495 -0
- package/dist/__tests__/watchers/exception.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/gate.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/gate.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/gate.watcher.spec.js +683 -0
- package/dist/__tests__/watchers/gate.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/http-client.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/http-client.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/http-client.watcher.spec.js +888 -0
- package/dist/__tests__/watchers/http-client.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/job.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/job.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/job.watcher.spec.js +513 -0
- package/dist/__tests__/watchers/job.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/log.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/log.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/log.watcher.spec.js +428 -0
- package/dist/__tests__/watchers/log.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/mail.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/mail.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/mail.watcher.spec.js +425 -0
- package/dist/__tests__/watchers/mail.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/model.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/model.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/model.watcher.spec.js +675 -0
- package/dist/__tests__/watchers/model.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/notification.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/notification.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/notification.watcher.spec.js +595 -0
- package/dist/__tests__/watchers/notification.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/query/types.spec.d.ts +2 -0
- package/dist/__tests__/watchers/query/types.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/query/types.spec.js +292 -0
- package/dist/__tests__/watchers/query/types.spec.js.map +1 -0
- package/dist/__tests__/watchers/query.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/query.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/query.watcher.spec.js +597 -0
- package/dist/__tests__/watchers/query.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/redis.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/redis.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/redis.watcher.spec.js +634 -0
- package/dist/__tests__/watchers/redis.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/request.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/request.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/request.watcher.spec.js +1017 -0
- package/dist/__tests__/watchers/request.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/schedule.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/schedule.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/schedule.watcher.spec.js +338 -0
- package/dist/__tests__/watchers/schedule.watcher.spec.js.map +1 -0
- package/dist/__tests__/watchers/view.watcher.spec.d.ts +2 -0
- package/dist/__tests__/watchers/view.watcher.spec.d.ts.map +1 -0
- package/dist/__tests__/watchers/view.watcher.spec.js +564 -0
- package/dist/__tests__/watchers/view.watcher.spec.js.map +1 -0
- package/dist/api/api.controller.d.ts +193 -0
- package/dist/api/api.controller.d.ts.map +1 -0
- package/dist/api/api.controller.js +562 -0
- package/dist/api/api.controller.js.map +1 -0
- package/dist/api/api.guard.d.ts +77 -0
- package/dist/api/api.guard.d.ts.map +1 -0
- package/dist/api/api.guard.js +294 -0
- package/dist/api/api.guard.js.map +1 -0
- package/dist/api/dashboard.controller.d.ts +49 -0
- package/dist/api/dashboard.controller.d.ts.map +1 -0
- package/dist/api/dashboard.controller.js +472 -0
- package/dist/api/dashboard.controller.js.map +1 -0
- package/dist/api/index.d.ts +5 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +21 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/tag.controller.d.ts +65 -0
- package/dist/api/tag.controller.d.ts.map +1 -0
- package/dist/api/tag.controller.js +149 -0
- package/dist/api/tag.controller.js.map +1 -0
- package/dist/core/collector.service.d.ts +80 -0
- package/dist/core/collector.service.d.ts.map +1 -0
- package/dist/core/collector.service.js +255 -0
- package/dist/core/collector.service.js.map +1 -0
- package/dist/core/family-hash.service.d.ts +64 -0
- package/dist/core/family-hash.service.d.ts.map +1 -0
- package/dist/core/family-hash.service.js +281 -0
- package/dist/core/family-hash.service.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +20 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/pruning.service.d.ts +16 -0
- package/dist/core/pruning.service.d.ts.map +1 -0
- package/dist/core/pruning.service.js +71 -0
- package/dist/core/pruning.service.js.map +1 -0
- package/dist/core/storage/index.d.ts +3 -0
- package/dist/core/storage/index.d.ts.map +1 -0
- package/dist/core/storage/index.js +19 -0
- package/dist/core/storage/index.js.map +1 -0
- package/dist/core/storage/sqlite.storage.d.ts +60 -0
- package/dist/core/storage/sqlite.storage.d.ts.map +1 -0
- package/dist/core/storage/sqlite.storage.js +929 -0
- package/dist/core/storage/sqlite.storage.js.map +1 -0
- package/dist/core/storage/storage.interface.d.ts +122 -0
- package/dist/core/storage/storage.interface.d.ts.map +1 -0
- package/dist/core/storage/storage.interface.js +5 -0
- package/dist/core/storage/storage.interface.js.map +1 -0
- package/dist/core/tag.service.d.ts +71 -0
- package/dist/core/tag.service.d.ts.map +1 -0
- package/dist/core/tag.service.js +568 -0
- package/dist/core/tag.service.js.map +1 -0
- package/dist/dashboard/public/assets/BatchesPage-DFT4fKlJ.js +1 -0
- package/dist/dashboard/public/assets/CachePage-CRy1Tjb8.js +1 -0
- package/dist/dashboard/public/assets/ClickableBadge-CV5J3THx.js +1 -0
- package/dist/dashboard/public/assets/CommandsPage-DdRnTm-W.js +1 -0
- package/dist/dashboard/public/assets/DashboardPage-CjaRZXYy.js +26 -0
- package/dist/dashboard/public/assets/DataTable-B6o9H8lh.js +88 -0
- package/dist/dashboard/public/assets/DumpsPage-DO8y1RTg.js +1 -0
- package/dist/dashboard/public/assets/EntryDetailPage-By-YcAGL.js +125 -0
- package/dist/dashboard/public/assets/EventsPage-u-r4AiT4.js +1 -0
- package/dist/dashboard/public/assets/ExceptionsPage-DXUcARr1.js +6 -0
- package/dist/dashboard/public/assets/GatesPage-DpeP7CDZ.js +1 -0
- package/dist/dashboard/public/assets/HttpClientPage-BJ4-5E6t.js +1 -0
- package/dist/dashboard/public/assets/JobsPage-Dv3KaX2x.js +1 -0
- package/dist/dashboard/public/assets/LogsPage-D0Q3yDb1.js +1 -0
- package/dist/dashboard/public/assets/MailPage-Bf8C6WF6.js +1 -0
- package/dist/dashboard/public/assets/ModelsPage-BMHncI5y.js +1 -0
- package/dist/dashboard/public/assets/NotificationsPage-D5-I-Oxb.js +1 -0
- package/dist/dashboard/public/assets/QueriesPage-oNp0i6Gt.js +1 -0
- package/dist/dashboard/public/assets/RedisPage-_GeS2OD8.js +1 -0
- package/dist/dashboard/public/assets/RequestsPage-BCwqu9US.js +1 -0
- package/dist/dashboard/public/assets/SchedulePage-CR0P-oX6.js +1 -0
- package/dist/dashboard/public/assets/ViewsPage-Dsy5ECRA.js +1 -0
- package/dist/dashboard/public/assets/calendar-DfK3x-6B.js +6 -0
- package/dist/dashboard/public/assets/circle-check-big-DcsYW8y8.js +6 -0
- package/dist/dashboard/public/assets/format-BFldcnCk.js +1 -0
- package/dist/dashboard/public/assets/index-DmeA1maE.css +1 -0
- package/dist/dashboard/public/assets/index-rkbGYdU7.js +351 -0
- package/dist/dashboard/public/assets/types-Cldoe2db.js +1 -0
- package/dist/dashboard/public/assets/vendor-B2nVRih0.js +43 -0
- package/dist/dashboard/public/assets/zap-DqtRi0JM.js +6 -0
- package/dist/dashboard/public/index.html +15 -0
- package/dist/dashboard/public/nestlens-icon.svg +9 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +69 -0
- package/dist/index.js.map +1 -0
- package/dist/nestlens.config.d.ts +216 -0
- package/dist/nestlens.config.d.ts.map +1 -0
- package/dist/nestlens.config.js +57 -0
- package/dist/nestlens.config.js.map +1 -0
- package/dist/nestlens.module.d.ts +10 -0
- package/dist/nestlens.module.d.ts.map +1 -0
- package/dist/nestlens.module.js +211 -0
- package/dist/nestlens.module.js.map +1 -0
- package/dist/types/entry.types.d.ts +368 -0
- package/dist/types/entry.types.d.ts.map +1 -0
- package/dist/types/entry.types.js +3 -0
- package/dist/types/entry.types.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +20 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/request.types.d.ts +9 -0
- package/dist/types/request.types.d.ts.map +1 -0
- package/dist/types/request.types.js +3 -0
- package/dist/types/request.types.js.map +1 -0
- package/dist/types/tag.types.d.ts +32 -0
- package/dist/types/tag.types.d.ts.map +1 -0
- package/dist/types/tag.types.js +3 -0
- package/dist/types/tag.types.js.map +1 -0
- package/dist/watchers/batch.watcher.d.ts +48 -0
- package/dist/watchers/batch.watcher.d.ts.map +1 -0
- package/dist/watchers/batch.watcher.js +185 -0
- package/dist/watchers/batch.watcher.js.map +1 -0
- package/dist/watchers/cache.watcher.d.ts +19 -0
- package/dist/watchers/cache.watcher.d.ts.map +1 -0
- package/dist/watchers/cache.watcher.js +158 -0
- package/dist/watchers/cache.watcher.js.map +1 -0
- package/dist/watchers/command.watcher.d.ts +32 -0
- package/dist/watchers/command.watcher.d.ts.map +1 -0
- package/dist/watchers/command.watcher.js +174 -0
- package/dist/watchers/command.watcher.js.map +1 -0
- package/dist/watchers/dump.watcher.d.ts +52 -0
- package/dist/watchers/dump.watcher.d.ts.map +1 -0
- package/dist/watchers/dump.watcher.js +234 -0
- package/dist/watchers/dump.watcher.js.map +1 -0
- package/dist/watchers/event.watcher.d.ts +20 -0
- package/dist/watchers/event.watcher.d.ts.map +1 -0
- package/dist/watchers/event.watcher.js +123 -0
- package/dist/watchers/event.watcher.js.map +1 -0
- package/dist/watchers/exception.watcher.d.ts +15 -0
- package/dist/watchers/exception.watcher.d.ts.map +1 -0
- package/dist/watchers/exception.watcher.js +117 -0
- package/dist/watchers/exception.watcher.js.map +1 -0
- package/dist/watchers/gate.watcher.d.ts +40 -0
- package/dist/watchers/gate.watcher.d.ts.map +1 -0
- package/dist/watchers/gate.watcher.js +200 -0
- package/dist/watchers/gate.watcher.js.map +1 -0
- package/dist/watchers/http-client.watcher.d.ts +34 -0
- package/dist/watchers/http-client.watcher.d.ts.map +1 -0
- package/dist/watchers/http-client.watcher.js +259 -0
- package/dist/watchers/http-client.watcher.js.map +1 -0
- package/dist/watchers/index.d.ts +19 -0
- package/dist/watchers/index.d.ts.map +1 -0
- package/dist/watchers/index.js +35 -0
- package/dist/watchers/index.js.map +1 -0
- package/dist/watchers/job.watcher.d.ts +27 -0
- package/dist/watchers/job.watcher.d.ts.map +1 -0
- package/dist/watchers/job.watcher.js +190 -0
- package/dist/watchers/job.watcher.js.map +1 -0
- package/dist/watchers/log.watcher.d.ts +26 -0
- package/dist/watchers/log.watcher.d.ts.map +1 -0
- package/dist/watchers/log.watcher.js +122 -0
- package/dist/watchers/log.watcher.js.map +1 -0
- package/dist/watchers/mail.watcher.d.ts +26 -0
- package/dist/watchers/mail.watcher.d.ts.map +1 -0
- package/dist/watchers/mail.watcher.js +154 -0
- package/dist/watchers/mail.watcher.js.map +1 -0
- package/dist/watchers/model.watcher.d.ts +54 -0
- package/dist/watchers/model.watcher.d.ts.map +1 -0
- package/dist/watchers/model.watcher.js +343 -0
- package/dist/watchers/model.watcher.js.map +1 -0
- package/dist/watchers/notification.watcher.d.ts +48 -0
- package/dist/watchers/notification.watcher.d.ts.map +1 -0
- package/dist/watchers/notification.watcher.js +215 -0
- package/dist/watchers/notification.watcher.js.map +1 -0
- package/dist/watchers/query/index.d.ts +3 -0
- package/dist/watchers/query/index.d.ts.map +1 -0
- package/dist/watchers/query/index.js +19 -0
- package/dist/watchers/query/index.js.map +1 -0
- package/dist/watchers/query/query.watcher.d.ts +27 -0
- package/dist/watchers/query/query.watcher.d.ts.map +1 -0
- package/dist/watchers/query/query.watcher.js +167 -0
- package/dist/watchers/query/query.watcher.js.map +1 -0
- package/dist/watchers/query/types.d.ts +60 -0
- package/dist/watchers/query/types.d.ts.map +1 -0
- package/dist/watchers/query/types.js +55 -0
- package/dist/watchers/query/types.js.map +1 -0
- package/dist/watchers/redis.watcher.d.ts +43 -0
- package/dist/watchers/redis.watcher.d.ts.map +1 -0
- package/dist/watchers/redis.watcher.js +225 -0
- package/dist/watchers/redis.watcher.js.map +1 -0
- package/dist/watchers/request.watcher.d.ts +21 -0
- package/dist/watchers/request.watcher.d.ts.map +1 -0
- package/dist/watchers/request.watcher.js +287 -0
- package/dist/watchers/request.watcher.js.map +1 -0
- package/dist/watchers/schedule.watcher.d.ts +25 -0
- package/dist/watchers/schedule.watcher.d.ts.map +1 -0
- package/dist/watchers/schedule.watcher.js +168 -0
- package/dist/watchers/schedule.watcher.js.map +1 -0
- package/dist/watchers/view.watcher.d.ts +51 -0
- package/dist/watchers/view.watcher.d.ts.map +1 -0
- package/dist/watchers/view.watcher.js +219 -0
- package/dist/watchers/view.watcher.js.map +1 -0
- package/package.json +86 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const testing_1 = require("@nestjs/testing");
|
|
4
|
+
const pruning_service_1 = require("../core/pruning.service");
|
|
5
|
+
const storage_interface_1 = require("../core/storage/storage.interface");
|
|
6
|
+
const nestlens_config_1 = require("../nestlens.config");
|
|
7
|
+
describe('PruningService', () => {
|
|
8
|
+
let service;
|
|
9
|
+
let mockStorage;
|
|
10
|
+
let mockConfig;
|
|
11
|
+
beforeEach(async () => {
|
|
12
|
+
mockStorage = {
|
|
13
|
+
initialize: jest.fn(),
|
|
14
|
+
save: jest.fn(),
|
|
15
|
+
saveBatch: jest.fn(),
|
|
16
|
+
find: jest.fn(),
|
|
17
|
+
findWithCursor: jest.fn(),
|
|
18
|
+
findById: jest.fn(),
|
|
19
|
+
count: jest.fn(),
|
|
20
|
+
getLatestSequence: jest.fn(),
|
|
21
|
+
hasEntriesAfter: jest.fn(),
|
|
22
|
+
getStats: jest.fn(),
|
|
23
|
+
getStorageStats: jest.fn(),
|
|
24
|
+
prune: jest.fn(),
|
|
25
|
+
pruneByType: jest.fn(),
|
|
26
|
+
clear: jest.fn(),
|
|
27
|
+
close: jest.fn(),
|
|
28
|
+
addTags: jest.fn(),
|
|
29
|
+
removeTags: jest.fn(),
|
|
30
|
+
getEntryTags: jest.fn(),
|
|
31
|
+
getAllTags: jest.fn(),
|
|
32
|
+
findByTags: jest.fn(),
|
|
33
|
+
addMonitoredTag: jest.fn(),
|
|
34
|
+
removeMonitoredTag: jest.fn(),
|
|
35
|
+
getMonitoredTags: jest.fn(),
|
|
36
|
+
resolveEntry: jest.fn(),
|
|
37
|
+
unresolveEntry: jest.fn(),
|
|
38
|
+
updateFamilyHash: jest.fn(),
|
|
39
|
+
findByFamilyHash: jest.fn(),
|
|
40
|
+
getGroupedByFamilyHash: jest.fn(),
|
|
41
|
+
};
|
|
42
|
+
mockConfig = {
|
|
43
|
+
enabled: true,
|
|
44
|
+
pruning: {
|
|
45
|
+
enabled: false, // Disable auto-start in tests
|
|
46
|
+
maxAge: 24,
|
|
47
|
+
interval: 60,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
const module = await testing_1.Test.createTestingModule({
|
|
51
|
+
providers: [
|
|
52
|
+
pruning_service_1.PruningService,
|
|
53
|
+
{ provide: storage_interface_1.STORAGE, useValue: mockStorage },
|
|
54
|
+
{ provide: nestlens_config_1.NESTLENS_CONFIG, useValue: mockConfig },
|
|
55
|
+
],
|
|
56
|
+
}).compile();
|
|
57
|
+
service = module.get(pruning_service_1.PruningService);
|
|
58
|
+
});
|
|
59
|
+
afterEach(async () => {
|
|
60
|
+
await service.stop();
|
|
61
|
+
});
|
|
62
|
+
describe('onModuleInit', () => {
|
|
63
|
+
it('should not start pruning when disabled', () => {
|
|
64
|
+
mockConfig.pruning.enabled = false;
|
|
65
|
+
service.onModuleInit();
|
|
66
|
+
// Should not call prune immediately
|
|
67
|
+
expect(mockStorage.prune).not.toHaveBeenCalled();
|
|
68
|
+
});
|
|
69
|
+
it('should start pruning when enabled', async () => {
|
|
70
|
+
mockConfig.pruning.enabled = true;
|
|
71
|
+
mockStorage.prune.mockResolvedValue(5);
|
|
72
|
+
service.onModuleInit();
|
|
73
|
+
// Wait for immediate prune call
|
|
74
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
75
|
+
expect(mockStorage.prune).toHaveBeenCalled();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
describe('prune', () => {
|
|
79
|
+
it('should calculate correct cutoff date based on maxAge', async () => {
|
|
80
|
+
mockConfig.pruning.enabled = true;
|
|
81
|
+
mockConfig.pruning.maxAge = 48; // 48 hours
|
|
82
|
+
mockStorage.prune.mockResolvedValue(0);
|
|
83
|
+
service.onModuleInit();
|
|
84
|
+
// Wait for the prune to be called
|
|
85
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
86
|
+
expect(mockStorage.prune).toHaveBeenCalled();
|
|
87
|
+
const callArg = mockStorage.prune.mock.calls[0][0];
|
|
88
|
+
// The date should be approximately 48 hours ago
|
|
89
|
+
const expectedDate = new Date(Date.now() - 48 * 60 * 60 * 1000);
|
|
90
|
+
const actualDate = new Date(callArg);
|
|
91
|
+
// Allow 1 second tolerance
|
|
92
|
+
expect(Math.abs(actualDate.getTime() - expectedDate.getTime())).toBeLessThan(1000);
|
|
93
|
+
});
|
|
94
|
+
it('should use default maxAge of 24 hours when not specified', async () => {
|
|
95
|
+
delete mockConfig.pruning.maxAge;
|
|
96
|
+
mockConfig.pruning.enabled = true;
|
|
97
|
+
mockStorage.prune.mockResolvedValue(0);
|
|
98
|
+
service.onModuleInit();
|
|
99
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
100
|
+
expect(mockStorage.prune).toHaveBeenCalled();
|
|
101
|
+
const callArg = mockStorage.prune.mock.calls[0][0];
|
|
102
|
+
const expectedDate = new Date(Date.now() - 24 * 60 * 60 * 1000);
|
|
103
|
+
const actualDate = new Date(callArg);
|
|
104
|
+
expect(Math.abs(actualDate.getTime() - expectedDate.getTime())).toBeLessThan(1000);
|
|
105
|
+
});
|
|
106
|
+
it('should handle prune errors gracefully', async () => {
|
|
107
|
+
mockConfig.pruning.enabled = true;
|
|
108
|
+
mockStorage.prune.mockRejectedValue(new Error('Database error'));
|
|
109
|
+
// Should not throw
|
|
110
|
+
service.onModuleInit();
|
|
111
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
112
|
+
expect(mockStorage.prune).toHaveBeenCalled();
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
describe('stop', () => {
|
|
116
|
+
it('should stop the pruning interval', async () => {
|
|
117
|
+
mockConfig.pruning.enabled = true;
|
|
118
|
+
mockStorage.prune.mockResolvedValue(0);
|
|
119
|
+
service.onModuleInit();
|
|
120
|
+
await service.stop();
|
|
121
|
+
// Clear the mock
|
|
122
|
+
mockStorage.prune.mockClear();
|
|
123
|
+
// Wait to ensure no more calls happen
|
|
124
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
125
|
+
expect(mockStorage.prune).not.toHaveBeenCalled();
|
|
126
|
+
});
|
|
127
|
+
it('should handle multiple stop calls gracefully', async () => {
|
|
128
|
+
await service.stop();
|
|
129
|
+
await service.stop();
|
|
130
|
+
await service.stop();
|
|
131
|
+
// Should not throw
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
describe('onModuleDestroy', () => {
|
|
135
|
+
it('should call stop on module destroy', async () => {
|
|
136
|
+
const stopSpy = jest.spyOn(service, 'stop');
|
|
137
|
+
await service.onModuleDestroy();
|
|
138
|
+
expect(stopSpy).toHaveBeenCalled();
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
//# sourceMappingURL=pruning.service.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pruning.service.spec.js","sourceRoot":"","sources":["../../src/__tests__/pruning.service.spec.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AACtD,6DAAyD;AACzD,yEAA8E;AAC9E,wDAAqE;AAErE,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,OAAuB,CAAC;IAC5B,IAAI,WAA0C,CAAC;IAC/C,IAAI,UAA0B,CAAC;IAE/B,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,WAAW,GAAG;YACZ,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;YACrB,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;YACf,SAAS,EAAE,IAAI,CAAC,EAAE,E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
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Jest Test Setup
|
|
4
|
+
*
|
|
5
|
+
* This file runs before all tests to set up the testing environment.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
require("reflect-metadata");
|
|
9
|
+
// Increase timeout for async operations
|
|
10
|
+
jest.setTimeout(10000);
|
|
11
|
+
// Mock console.error to keep test output clean (optional)
|
|
12
|
+
// Uncomment if you want to suppress expected error logs during tests
|
|
13
|
+
// const originalError = console.error;
|
|
14
|
+
// beforeAll(() => {
|
|
15
|
+
// console.error = jest.fn();
|
|
16
|
+
// });
|
|
17
|
+
// afterAll(() => {
|
|
18
|
+
// console.error = originalError;
|
|
19
|
+
// });
|
|
20
|
+
// Clean up after each test
|
|
21
|
+
afterEach(() => {
|
|
22
|
+
jest.clearAllMocks();
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAEH,4BAA0B;AAE1B,wCAAwC;AACxC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AAEvB,0DAA0D;AAC1D,qEAAqE;AACrE,uCAAuC;AACvC,oBAAoB;AACpB,+BAA+B;AAC/B,MAAM;AACN,mBAAmB;AACnB,mCAAmC;AACnC,MAAM;AAEN,2BAA2B;AAC3B,SAAS,CAAC,GAAG,EAAE;IACb,IAAI,CAAC,aAAa,EAAE,CAAC;AACvB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.service.spec.d.ts","sourceRoot":"","sources":["../../src/__tests__/tag.service.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const testing_1 = require("@nestjs/testing");
|
|
4
|
+
const tag_service_1 = require("../core/tag.service");
|
|
5
|
+
const storage_interface_1 = require("../core/storage/storage.interface");
|
|
6
|
+
describe('TagService', () => {
|
|
7
|
+
let service;
|
|
8
|
+
let mockStorage;
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
mockStorage = {
|
|
11
|
+
initialize: jest.fn(),
|
|
12
|
+
save: jest.fn(),
|
|
13
|
+
saveBatch: jest.fn(),
|
|
14
|
+
find: jest.fn(),
|
|
15
|
+
findWithCursor: jest.fn(),
|
|
16
|
+
findById: jest.fn(),
|
|
17
|
+
count: jest.fn(),
|
|
18
|
+
getLatestSequence: jest.fn(),
|
|
19
|
+
hasEntriesAfter: jest.fn(),
|
|
20
|
+
getStats: jest.fn(),
|
|
21
|
+
getStorageStats: jest.fn(),
|
|
22
|
+
prune: jest.fn(),
|
|
23
|
+
pruneByType: jest.fn(),
|
|
24
|
+
clear: jest.fn(),
|
|
25
|
+
close: jest.fn(),
|
|
26
|
+
addTags: jest.fn(),
|
|
27
|
+
removeTags: jest.fn(),
|
|
28
|
+
getEntryTags: jest.fn(),
|
|
29
|
+
getAllTags: jest.fn(),
|
|
30
|
+
findByTags: jest.fn(),
|
|
31
|
+
addMonitoredTag: jest.fn(),
|
|
32
|
+
removeMonitoredTag: jest.fn(),
|
|
33
|
+
getMonitoredTags: jest.fn(),
|
|
34
|
+
resolveEntry: jest.fn(),
|
|
35
|
+
unresolveEntry: jest.fn(),
|
|
36
|
+
updateFamilyHash: jest.fn(),
|
|
37
|
+
findByFamilyHash: jest.fn(),
|
|
38
|
+
getGroupedByFamilyHash: jest.fn(),
|
|
39
|
+
};
|
|
40
|
+
const module = await testing_1.Test.createTestingModule({
|
|
41
|
+
providers: [
|
|
42
|
+
tag_service_1.TagService,
|
|
43
|
+
{ provide: storage_interface_1.STORAGE, useValue: mockStorage },
|
|
44
|
+
],
|
|
45
|
+
}).compile();
|
|
46
|
+
service = module.get(tag_service_1.TagService);
|
|
47
|
+
});
|
|
48
|
+
describe('autoTag', () => {
|
|
49
|
+
describe('request entries', () => {
|
|
50
|
+
it('should add SUCCESS tag for 2xx status codes', async () => {
|
|
51
|
+
const entry = {
|
|
52
|
+
id: 1,
|
|
53
|
+
type: 'request',
|
|
54
|
+
payload: {
|
|
55
|
+
method: 'GET',
|
|
56
|
+
url: '/api/users',
|
|
57
|
+
path: '/api/users',
|
|
58
|
+
query: {},
|
|
59
|
+
params: {},
|
|
60
|
+
headers: {},
|
|
61
|
+
statusCode: 200,
|
|
62
|
+
duration: 100,
|
|
63
|
+
memory: 0,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
const tags = await service.autoTag(entry);
|
|
67
|
+
expect(tags).toContain('SUCCESS');
|
|
68
|
+
expect(tags).toContain('GET');
|
|
69
|
+
expect(mockStorage.addTags).toHaveBeenCalledWith(1, expect.arrayContaining(['SUCCESS', 'GET']));
|
|
70
|
+
});
|
|
71
|
+
it('should add 5XX and ERROR tags for 5xx status codes', async () => {
|
|
72
|
+
const entry = {
|
|
73
|
+
id: 1,
|
|
74
|
+
type: 'request',
|
|
75
|
+
payload: {
|
|
76
|
+
method: 'POST',
|
|
77
|
+
url: '/api/users',
|
|
78
|
+
path: '/api/users',
|
|
79
|
+
query: {},
|
|
80
|
+
params: {},
|
|
81
|
+
headers: {},
|
|
82
|
+
statusCode: 500,
|
|
83
|
+
duration: 100,
|
|
84
|
+
memory: 0,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
const tags = await service.autoTag(entry);
|
|
88
|
+
expect(tags).toContain('ERROR');
|
|
89
|
+
expect(tags).toContain('5XX');
|
|
90
|
+
});
|
|
91
|
+
it('should add 4XX and CLIENT-ERROR tags for 4xx status codes', async () => {
|
|
92
|
+
const entry = {
|
|
93
|
+
id: 1,
|
|
94
|
+
type: 'request',
|
|
95
|
+
payload: {
|
|
96
|
+
method: 'GET',
|
|
97
|
+
url: '/api/users',
|
|
98
|
+
path: '/api/users',
|
|
99
|
+
query: {},
|
|
100
|
+
params: {},
|
|
101
|
+
headers: {},
|
|
102
|
+
statusCode: 404,
|
|
103
|
+
duration: 100,
|
|
104
|
+
memory: 0,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
const tags = await service.autoTag(entry);
|
|
108
|
+
expect(tags).toContain('CLIENT-ERROR');
|
|
109
|
+
expect(tags).toContain('4XX');
|
|
110
|
+
});
|
|
111
|
+
it('should add SLOW tag for requests > 1000ms', async () => {
|
|
112
|
+
const entry = {
|
|
113
|
+
id: 1,
|
|
114
|
+
type: 'request',
|
|
115
|
+
payload: {
|
|
116
|
+
method: 'GET',
|
|
117
|
+
url: '/api/users',
|
|
118
|
+
path: '/api/users',
|
|
119
|
+
query: {},
|
|
120
|
+
params: {},
|
|
121
|
+
headers: {},
|
|
122
|
+
statusCode: 200,
|
|
123
|
+
duration: 1500,
|
|
124
|
+
memory: 0,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
const tags = await service.autoTag(entry);
|
|
128
|
+
expect(tags).toContain('SLOW');
|
|
129
|
+
});
|
|
130
|
+
it('should add USER tag when user is present', async () => {
|
|
131
|
+
const entry = {
|
|
132
|
+
id: 1,
|
|
133
|
+
type: 'request',
|
|
134
|
+
payload: {
|
|
135
|
+
method: 'GET',
|
|
136
|
+
url: '/api/users',
|
|
137
|
+
path: '/api/users',
|
|
138
|
+
query: {},
|
|
139
|
+
params: {},
|
|
140
|
+
headers: {},
|
|
141
|
+
statusCode: 200,
|
|
142
|
+
duration: 100,
|
|
143
|
+
memory: 0,
|
|
144
|
+
user: { id: 123, name: 'Test User' },
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
const tags = await service.autoTag(entry);
|
|
148
|
+
expect(tags).toContain('USER:123');
|
|
149
|
+
});
|
|
150
|
+
it('should not add method tag for GraphQL requests', async () => {
|
|
151
|
+
const entry = {
|
|
152
|
+
id: 1,
|
|
153
|
+
type: 'request',
|
|
154
|
+
payload: {
|
|
155
|
+
method: 'POST',
|
|
156
|
+
url: '/graphql',
|
|
157
|
+
path: '/graphql',
|
|
158
|
+
query: {},
|
|
159
|
+
params: {},
|
|
160
|
+
headers: {},
|
|
161
|
+
statusCode: 200,
|
|
162
|
+
duration: 100,
|
|
163
|
+
memory: 0,
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
const tags = await service.autoTag(entry);
|
|
167
|
+
expect(tags).not.toContain('POST');
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
describe('query entries', () => {
|
|
171
|
+
it('should add SLOW tag for slow queries', async () => {
|
|
172
|
+
const entry = {
|
|
173
|
+
id: 1,
|
|
174
|
+
type: 'query',
|
|
175
|
+
payload: {
|
|
176
|
+
query: 'SELECT * FROM users',
|
|
177
|
+
duration: 150,
|
|
178
|
+
slow: true,
|
|
179
|
+
source: 'typeorm',
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
const tags = await service.autoTag(entry);
|
|
183
|
+
expect(tags).toContain('SLOW');
|
|
184
|
+
});
|
|
185
|
+
it('should add source tag', async () => {
|
|
186
|
+
const entry = {
|
|
187
|
+
id: 1,
|
|
188
|
+
type: 'query',
|
|
189
|
+
payload: {
|
|
190
|
+
query: 'SELECT * FROM users',
|
|
191
|
+
duration: 50,
|
|
192
|
+
slow: false,
|
|
193
|
+
source: 'prisma',
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
const tags = await service.autoTag(entry);
|
|
197
|
+
expect(tags).toContain('PRISMA');
|
|
198
|
+
});
|
|
199
|
+
it('should detect SELECT queries', async () => {
|
|
200
|
+
const entry = {
|
|
201
|
+
id: 1,
|
|
202
|
+
type: 'query',
|
|
203
|
+
payload: {
|
|
204
|
+
query: 'SELECT * FROM users WHERE id = 1',
|
|
205
|
+
duration: 50,
|
|
206
|
+
slow: false,
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
const tags = await service.autoTag(entry);
|
|
210
|
+
expect(tags).toContain('SELECT');
|
|
211
|
+
});
|
|
212
|
+
it('should detect INSERT queries', async () => {
|
|
213
|
+
const entry = {
|
|
214
|
+
id: 1,
|
|
215
|
+
type: 'query',
|
|
216
|
+
payload: {
|
|
217
|
+
query: 'INSERT INTO users (name) VALUES ("test")',
|
|
218
|
+
duration: 50,
|
|
219
|
+
slow: false,
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
const tags = await service.autoTag(entry);
|
|
223
|
+
expect(tags).toContain('INSERT');
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
describe('exception entries', () => {
|
|
227
|
+
it('should add ERROR tag for all exceptions', async () => {
|
|
228
|
+
const entry = {
|
|
229
|
+
id: 1,
|
|
230
|
+
type: 'exception',
|
|
231
|
+
payload: {
|
|
232
|
+
name: 'TypeError',
|
|
233
|
+
message: 'Cannot read property of undefined',
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
const tags = await service.autoTag(entry);
|
|
237
|
+
expect(tags).toContain('ERROR');
|
|
238
|
+
expect(tags).toContain('TYPEERROR');
|
|
239
|
+
});
|
|
240
|
+
it('should not add exception name tag for generic Error', async () => {
|
|
241
|
+
const entry = {
|
|
242
|
+
id: 1,
|
|
243
|
+
type: 'exception',
|
|
244
|
+
payload: {
|
|
245
|
+
name: 'Error',
|
|
246
|
+
message: 'Something went wrong',
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
const tags = await service.autoTag(entry);
|
|
250
|
+
// Should have ERROR tag (from exception) but not duplicate it as exception name
|
|
251
|
+
expect(tags).toContain('ERROR');
|
|
252
|
+
expect(tags.filter(t => t === 'ERROR')).toHaveLength(1);
|
|
253
|
+
});
|
|
254
|
+
it('should add HTTP-ERROR tag for HTTP exceptions', async () => {
|
|
255
|
+
const entry = {
|
|
256
|
+
id: 1,
|
|
257
|
+
type: 'exception',
|
|
258
|
+
payload: {
|
|
259
|
+
name: 'BadRequestException',
|
|
260
|
+
message: 'Invalid input',
|
|
261
|
+
},
|
|
262
|
+
};
|
|
263
|
+
const tags = await service.autoTag(entry);
|
|
264
|
+
expect(tags).toContain('HTTP-ERROR');
|
|
265
|
+
});
|
|
266
|
+
it('should add VALIDATION-ERROR tag for validation errors', async () => {
|
|
267
|
+
const entry = {
|
|
268
|
+
id: 1,
|
|
269
|
+
type: 'exception',
|
|
270
|
+
payload: {
|
|
271
|
+
name: 'ValidationError',
|
|
272
|
+
message: 'Email is required',
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
const tags = await service.autoTag(entry);
|
|
276
|
+
expect(tags).toContain('VALIDATION-ERROR');
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
describe('log entries', () => {
|
|
280
|
+
it('should add level tag', async () => {
|
|
281
|
+
const entry = {
|
|
282
|
+
id: 1,
|
|
283
|
+
type: 'log',
|
|
284
|
+
payload: {
|
|
285
|
+
level: 'error',
|
|
286
|
+
message: 'Something failed',
|
|
287
|
+
context: 'TestService',
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
const tags = await service.autoTag(entry);
|
|
291
|
+
expect(tags).toContain('ERROR');
|
|
292
|
+
expect(tags).toContain('TESTSERVICE');
|
|
293
|
+
});
|
|
294
|
+
it('should add WARNING tag for warn level', async () => {
|
|
295
|
+
const entry = {
|
|
296
|
+
id: 1,
|
|
297
|
+
type: 'log',
|
|
298
|
+
payload: {
|
|
299
|
+
level: 'warn',
|
|
300
|
+
message: 'Deprecated function used',
|
|
301
|
+
},
|
|
302
|
+
};
|
|
303
|
+
const tags = await service.autoTag(entry);
|
|
304
|
+
expect(tags).toContain('WARN');
|
|
305
|
+
expect(tags).toContain('WARNING');
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
describe('job entries', () => {
|
|
309
|
+
it('should add status and queue tags', async () => {
|
|
310
|
+
const entry = {
|
|
311
|
+
id: 1,
|
|
312
|
+
type: 'job',
|
|
313
|
+
payload: {
|
|
314
|
+
name: 'email-job',
|
|
315
|
+
queue: 'emails',
|
|
316
|
+
data: {},
|
|
317
|
+
status: 'completed',
|
|
318
|
+
attempts: 1,
|
|
319
|
+
},
|
|
320
|
+
};
|
|
321
|
+
const tags = await service.autoTag(entry);
|
|
322
|
+
expect(tags).toContain('COMPLETED');
|
|
323
|
+
expect(tags).toContain('EMAILS');
|
|
324
|
+
});
|
|
325
|
+
it('should add ERROR tag for failed jobs', async () => {
|
|
326
|
+
const entry = {
|
|
327
|
+
id: 1,
|
|
328
|
+
type: 'job',
|
|
329
|
+
payload: {
|
|
330
|
+
name: 'email-job',
|
|
331
|
+
queue: 'emails',
|
|
332
|
+
data: {},
|
|
333
|
+
status: 'failed',
|
|
334
|
+
attempts: 3,
|
|
335
|
+
error: 'SMTP error',
|
|
336
|
+
},
|
|
337
|
+
};
|
|
338
|
+
const tags = await service.autoTag(entry);
|
|
339
|
+
expect(tags).toContain('FAILED');
|
|
340
|
+
expect(tags).toContain('ERROR');
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
describe('cache entries', () => {
|
|
344
|
+
it('should add operation tag', async () => {
|
|
345
|
+
const entry = {
|
|
346
|
+
id: 1,
|
|
347
|
+
type: 'cache',
|
|
348
|
+
payload: {
|
|
349
|
+
operation: 'get',
|
|
350
|
+
key: 'user:123',
|
|
351
|
+
hit: true,
|
|
352
|
+
duration: 5,
|
|
353
|
+
},
|
|
354
|
+
};
|
|
355
|
+
const tags = await service.autoTag(entry);
|
|
356
|
+
expect(tags).toContain('GET');
|
|
357
|
+
expect(tags).toContain('HIT');
|
|
358
|
+
});
|
|
359
|
+
it('should add MISS tag for cache misses', async () => {
|
|
360
|
+
const entry = {
|
|
361
|
+
id: 1,
|
|
362
|
+
type: 'cache',
|
|
363
|
+
payload: {
|
|
364
|
+
operation: 'get',
|
|
365
|
+
key: 'user:123',
|
|
366
|
+
hit: false,
|
|
367
|
+
duration: 2,
|
|
368
|
+
},
|
|
369
|
+
};
|
|
370
|
+
const tags = await service.autoTag(entry);
|
|
371
|
+
expect(tags).toContain('MISS');
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
describe('mail entries', () => {
|
|
375
|
+
it('should add status and HTML tags', async () => {
|
|
376
|
+
const entry = {
|
|
377
|
+
id: 1,
|
|
378
|
+
type: 'mail',
|
|
379
|
+
payload: {
|
|
380
|
+
to: 'test@example.com',
|
|
381
|
+
subject: 'Welcome',
|
|
382
|
+
html: '<h1>Hello</h1>',
|
|
383
|
+
status: 'sent',
|
|
384
|
+
duration: 100,
|
|
385
|
+
},
|
|
386
|
+
};
|
|
387
|
+
const tags = await service.autoTag(entry);
|
|
388
|
+
expect(tags).toContain('SENT');
|
|
389
|
+
expect(tags).toContain('HTML');
|
|
390
|
+
});
|
|
391
|
+
it('should add BULK tag for multiple recipients', async () => {
|
|
392
|
+
const entry = {
|
|
393
|
+
id: 1,
|
|
394
|
+
type: 'mail',
|
|
395
|
+
payload: {
|
|
396
|
+
to: ['user1@example.com', 'user2@example.com'],
|
|
397
|
+
subject: 'Newsletter',
|
|
398
|
+
status: 'sent',
|
|
399
|
+
duration: 200,
|
|
400
|
+
},
|
|
401
|
+
};
|
|
402
|
+
const tags = await service.autoTag(entry);
|
|
403
|
+
expect(tags).toContain('BULK');
|
|
404
|
+
});
|
|
405
|
+
it('should add ERROR tag for failed mails', async () => {
|
|
406
|
+
const entry = {
|
|
407
|
+
id: 1,
|
|
408
|
+
type: 'mail',
|
|
409
|
+
payload: {
|
|
410
|
+
to: 'test@example.com',
|
|
411
|
+
subject: 'Test',
|
|
412
|
+
status: 'failed',
|
|
413
|
+
error: 'SMTP connection failed',
|
|
414
|
+
duration: 5000,
|
|
415
|
+
},
|
|
416
|
+
};
|
|
417
|
+
const tags = await service.autoTag(entry);
|
|
418
|
+
expect(tags).toContain('FAILED');
|
|
419
|
+
expect(tags).toContain('ERROR');
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
it('should not call addTags if entry has no ID', async () => {
|
|
423
|
+
const entry = {
|
|
424
|
+
type: 'log',
|
|
425
|
+
payload: {
|
|
426
|
+
level: 'log',
|
|
427
|
+
message: 'Test message',
|
|
428
|
+
},
|
|
429
|
+
};
|
|
430
|
+
await service.autoTag(entry);
|
|
431
|
+
expect(mockStorage.addTags).not.toHaveBeenCalled();
|
|
432
|
+
});
|
|
433
|
+
});
|
|
434
|
+
describe('tag management', () => {
|
|
435
|
+
it('should add tags to an entry', async () => {
|
|
436
|
+
await service.addTags(1, ['custom', 'important']);
|
|
437
|
+
expect(mockStorage.addTags).toHaveBeenCalledWith(1, ['custom', 'important']);
|
|
438
|
+
});
|
|
439
|
+
it('should remove tags from an entry', async () => {
|
|
440
|
+
await service.removeTags(1, ['custom']);
|
|
441
|
+
expect(mockStorage.removeTags).toHaveBeenCalledWith(1, ['custom']);
|
|
442
|
+
});
|
|
443
|
+
it('should get tags for an entry', async () => {
|
|
444
|
+
mockStorage.getEntryTags.mockResolvedValue(['tag1', 'tag2']);
|
|
445
|
+
const tags = await service.getEntryTags(1);
|
|
446
|
+
expect(tags).toEqual(['tag1', 'tag2']);
|
|
447
|
+
});
|
|
448
|
+
it('should get all tags with counts', async () => {
|
|
449
|
+
mockStorage.getAllTags.mockResolvedValue([
|
|
450
|
+
{ tag: 'ERROR', count: 10 },
|
|
451
|
+
{ tag: 'SUCCESS', count: 100 },
|
|
452
|
+
]);
|
|
453
|
+
const tags = await service.getAllTags();
|
|
454
|
+
expect(tags).toHaveLength(2);
|
|
455
|
+
expect(tags[0].count).toBe(10);
|
|
456
|
+
});
|
|
457
|
+
});
|
|
458
|
+
describe('monitored tags', () => {
|
|
459
|
+
it('should add a monitored tag', async () => {
|
|
460
|
+
const monitoredTag = { id: 1, tag: 'CRITICAL', createdAt: new Date().toISOString() };
|
|
461
|
+
mockStorage.addMonitoredTag.mockResolvedValue(monitoredTag);
|
|
462
|
+
const result = await service.addMonitoredTag('CRITICAL');
|
|
463
|
+
expect(result).toEqual(monitoredTag);
|
|
464
|
+
});
|
|
465
|
+
it('should remove a monitored tag', async () => {
|
|
466
|
+
await service.removeMonitoredTag('CRITICAL');
|
|
467
|
+
expect(mockStorage.removeMonitoredTag).toHaveBeenCalledWith('CRITICAL');
|
|
468
|
+
});
|
|
469
|
+
it('should get monitored tags with counts', async () => {
|
|
470
|
+
mockStorage.getMonitoredTags.mockResolvedValue([
|
|
471
|
+
{ id: 1, tag: 'ERROR', createdAt: new Date().toISOString() },
|
|
472
|
+
]);
|
|
473
|
+
mockStorage.getAllTags.mockResolvedValue([
|
|
474
|
+
{ tag: 'ERROR', count: 50 },
|
|
475
|
+
]);
|
|
476
|
+
const result = await service.getMonitoredTagsWithCounts();
|
|
477
|
+
expect(result).toHaveLength(1);
|
|
478
|
+
expect(result[0].count).toBe(50);
|
|
479
|
+
});
|
|
480
|
+
});
|
|
481
|
+
});
|
|
482
|
+
//# sourceMappingURL=tag.service.spec.js.map
|