nestlens 0.5.2 → 0.6.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/dist/api/dashboard.controller.d.ts +7 -0
- package/dist/api/dashboard.controller.d.ts.map +1 -1
- package/dist/api/dashboard.controller.js +21 -1
- package/dist/api/dashboard.controller.js.map +1 -1
- package/dist/api/route-path.d.ts +14 -0
- package/dist/api/route-path.d.ts.map +1 -0
- package/dist/api/route-path.js +29 -0
- package/dist/api/route-path.js.map +1 -0
- package/dist/dashboard/public/assets/{BatchesPage-BGhLy-T5.js → BatchesPage-49gOGnzu.js} +1 -1
- package/dist/dashboard/public/assets/{CachePage-CDnNbIzo.js → CachePage-ov2Ag-N9.js} +1 -1
- package/dist/dashboard/public/assets/{ClickableBadge-BzF92jvt.js → ClickableBadge-DYNLPtLq.js} +1 -1
- package/dist/dashboard/public/assets/{CommandsPage-D8pYskAe.js → CommandsPage-mpPr6q9X.js} +1 -1
- package/dist/dashboard/public/assets/{DashboardPage-gFHu-Nwd.js → DashboardPage-DOdstR4a.js} +1 -1
- package/dist/dashboard/public/assets/{DumpsPage-Ccg_V5vS.js → DumpsPage-CQ_vpUE8.js} +1 -1
- package/dist/dashboard/public/assets/{EntryDetailPage-Dc_JZ1Tc.js → EntryDetailPage-CxL10HuU.js} +1 -1
- package/dist/dashboard/public/assets/{EntrySearchInput-DF0OUnR0.js → EntrySearchInput-DaH1CLjl.js} +1 -1
- package/dist/dashboard/public/assets/{EventsPage-D5vletvf.js → EventsPage-Di57VeHM.js} +1 -1
- package/dist/dashboard/public/assets/{ExceptionsPage-MyvF0i9X.js → ExceptionsPage-C9DcC4-2.js} +1 -1
- package/dist/dashboard/public/assets/{GatesPage-BN47FfAa.js → GatesPage-DBgWv2nS.js} +1 -1
- package/dist/dashboard/public/assets/{GraphQLPage-Ba6on48X.js → GraphQLPage-D8DcycD9.js} +1 -1
- package/dist/dashboard/public/assets/{HttpClientPage-BWPDXyqZ.js → HttpClientPage-PTrP2EjP.js} +1 -1
- package/dist/dashboard/public/assets/{JobsPage-BX4pZDnE.js → JobsPage-CraSw8O9.js} +1 -1
- package/dist/dashboard/public/assets/{LogsPage-98DCrWxA.js → LogsPage-7ZGkLuX9.js} +1 -1
- package/dist/dashboard/public/assets/{MailPage-CxE1cC46.js → MailPage-dQoSJAY3.js} +1 -1
- package/dist/dashboard/public/assets/{ModelsPage-YuBXpII-.js → ModelsPage-CKkb6PGt.js} +1 -1
- package/dist/dashboard/public/assets/{NotificationsPage-CEQRKmJB.js → NotificationsPage-CuTXZ1qY.js} +1 -1
- package/dist/dashboard/public/assets/{PageHeader-VKMQB2QM.js → PageHeader-q5aVtQHw.js} +1 -1
- package/dist/dashboard/public/assets/{QueriesPage-DiTK99vp.js → QueriesPage-CM4NansM.js} +1 -1
- package/dist/dashboard/public/assets/{RedisPage-D0eCbYXO.js → RedisPage-C9y6TuoK.js} +1 -1
- package/dist/dashboard/public/assets/{RequestsPage-B6Lvm-DQ.js → RequestsPage-Cxnqol-x.js} +1 -1
- package/dist/dashboard/public/assets/{SchedulePage-Cdnrs2AM.js → SchedulePage-Cp3ecH0l.js} +1 -1
- package/dist/dashboard/public/assets/{ViewsPage-CoL-Fxon.js → ViewsPage-BG8omC5C.js} +1 -1
- package/dist/dashboard/public/assets/{calendar-GxtPIdFE.js → calendar-CjIUfRxv.js} +1 -1
- package/dist/dashboard/public/assets/{circle-check-big-CUTcqDzy.js → circle-check-big-DDApLrDE.js} +1 -1
- package/dist/dashboard/public/assets/{eye-jph38F8w.js → eye-csDSrPe6.js} +1 -1
- package/dist/dashboard/public/assets/index-TmiQivGf.js +361 -0
- package/dist/dashboard/public/assets/{search-BKkZEk7u.js → search-DS3CEfeI.js} +1 -1
- package/dist/dashboard/public/assets/{types-Cz3zUxcx.js → types-DcORDHhK.js} +1 -1
- package/dist/dashboard/public/assets/{zap-Dy5QHE03.js → zap-DEs_rIzA.js} +1 -1
- package/dist/dashboard/public/index.html +4 -4
- package/dist/nestlens.module.d.ts +12 -0
- package/dist/nestlens.module.d.ts.map +1 -1
- package/dist/nestlens.module.js +26 -0
- package/dist/nestlens.module.js.map +1 -1
- package/package.json +3 -3
- package/dist/__tests__/api/api.controller.spec.d.ts +0 -2
- package/dist/__tests__/api/api.controller.spec.d.ts.map +0 -1
- package/dist/__tests__/api/api.controller.spec.js +0 -871
- package/dist/__tests__/api/api.controller.spec.js.map +0 -1
- package/dist/__tests__/api/api.guard.spec.d.ts +0 -2
- package/dist/__tests__/api/api.guard.spec.d.ts.map +0 -1
- package/dist/__tests__/api/api.guard.spec.js +0 -545
- package/dist/__tests__/api/api.guard.spec.js.map +0 -1
- package/dist/__tests__/api/dashboard.controller.spec.d.ts +0 -2
- package/dist/__tests__/api/dashboard.controller.spec.d.ts.map +0 -1
- package/dist/__tests__/api/dashboard.controller.spec.js +0 -159
- package/dist/__tests__/api/dashboard.controller.spec.js.map +0 -1
- package/dist/__tests__/api/nestlens-validation.pipe.spec.d.ts +0 -2
- package/dist/__tests__/api/nestlens-validation.pipe.spec.d.ts.map +0 -1
- package/dist/__tests__/api/nestlens-validation.pipe.spec.js +0 -73
- package/dist/__tests__/api/nestlens-validation.pipe.spec.js.map +0 -1
- package/dist/__tests__/api/tag.controller.spec.d.ts +0 -2
- package/dist/__tests__/api/tag.controller.spec.d.ts.map +0 -1
- package/dist/__tests__/api/tag.controller.spec.js +0 -280
- package/dist/__tests__/api/tag.controller.spec.js.map +0 -1
- package/dist/__tests__/collector.service.spec.d.ts +0 -2
- package/dist/__tests__/collector.service.spec.d.ts.map +0 -1
- package/dist/__tests__/collector.service.spec.js +0 -240
- package/dist/__tests__/collector.service.spec.js.map +0 -1
- package/dist/__tests__/core/collector.service.spec.d.ts +0 -2
- package/dist/__tests__/core/collector.service.spec.d.ts.map +0 -1
- package/dist/__tests__/core/collector.service.spec.js +0 -517
- package/dist/__tests__/core/collector.service.spec.js.map +0 -1
- package/dist/__tests__/core/family-hash.service.spec.d.ts +0 -2
- package/dist/__tests__/core/family-hash.service.spec.d.ts.map +0 -1
- package/dist/__tests__/core/family-hash.service.spec.js +0 -1117
- package/dist/__tests__/core/family-hash.service.spec.js.map +0 -1
- package/dist/__tests__/core/pruning.service.spec.d.ts +0 -2
- package/dist/__tests__/core/pruning.service.spec.d.ts.map +0 -1
- package/dist/__tests__/core/pruning.service.spec.js +0 -224
- package/dist/__tests__/core/pruning.service.spec.js.map +0 -1
- package/dist/__tests__/core/storage/memory.storage.spec.d.ts +0 -2
- package/dist/__tests__/core/storage/memory.storage.spec.d.ts.map +0 -1
- package/dist/__tests__/core/storage/memory.storage.spec.js +0 -450
- package/dist/__tests__/core/storage/memory.storage.spec.js.map +0 -1
- package/dist/__tests__/core/storage/redis.storage.spec.d.ts +0 -10
- package/dist/__tests__/core/storage/redis.storage.spec.d.ts.map +0 -1
- package/dist/__tests__/core/storage/redis.storage.spec.js +0 -657
- package/dist/__tests__/core/storage/redis.storage.spec.js.map +0 -1
- package/dist/__tests__/core/storage/sqlite.storage.spec.d.ts +0 -2
- package/dist/__tests__/core/storage/sqlite.storage.spec.d.ts.map +0 -1
- package/dist/__tests__/core/storage/sqlite.storage.spec.js +0 -1294
- package/dist/__tests__/core/storage/sqlite.storage.spec.js.map +0 -1
- package/dist/__tests__/core/storage/storage.factory.spec.d.ts +0 -2
- package/dist/__tests__/core/storage/storage.factory.spec.d.ts.map +0 -1
- package/dist/__tests__/core/storage/storage.factory.spec.js +0 -151
- package/dist/__tests__/core/storage/storage.factory.spec.js.map +0 -1
- package/dist/__tests__/core/tag.service.spec.d.ts +0 -2
- package/dist/__tests__/core/tag.service.spec.d.ts.map +0 -1
- package/dist/__tests__/core/tag.service.spec.js +0 -1126
- package/dist/__tests__/core/tag.service.spec.js.map +0 -1
- package/dist/__tests__/docs-consistency.spec.d.ts +0 -2
- package/dist/__tests__/docs-consistency.spec.d.ts.map +0 -1
- package/dist/__tests__/docs-consistency.spec.js +0 -74
- package/dist/__tests__/docs-consistency.spec.js.map +0 -1
- package/dist/__tests__/family-hash.service.spec.d.ts +0 -2
- package/dist/__tests__/family-hash.service.spec.d.ts.map +0 -1
- package/dist/__tests__/family-hash.service.spec.js +0 -325
- package/dist/__tests__/family-hash.service.spec.js.map +0 -1
- package/dist/__tests__/filters/api-filters.spec.d.ts +0 -2
- package/dist/__tests__/filters/api-filters.spec.d.ts.map +0 -1
- package/dist/__tests__/filters/api-filters.spec.js +0 -188
- package/dist/__tests__/filters/api-filters.spec.js.map +0 -1
- package/dist/__tests__/filters/badge-filter-e2e.spec.d.ts +0 -2
- package/dist/__tests__/filters/badge-filter-e2e.spec.d.ts.map +0 -1
- package/dist/__tests__/filters/badge-filter-e2e.spec.js +0 -418
- package/dist/__tests__/filters/badge-filter-e2e.spec.js.map +0 -1
- package/dist/__tests__/filters/entry-factories.d.ts +0 -20
- package/dist/__tests__/filters/entry-factories.d.ts.map +0 -1
- package/dist/__tests__/filters/entry-factories.js +0 -288
- package/dist/__tests__/filters/entry-factories.js.map +0 -1
- package/dist/__tests__/filters/filter-contract.spec.d.ts +0 -2
- package/dist/__tests__/filters/filter-contract.spec.d.ts.map +0 -1
- package/dist/__tests__/filters/filter-contract.spec.js +0 -319
- package/dist/__tests__/filters/filter-contract.spec.js.map +0 -1
- package/dist/__tests__/filters/filter-test-data.d.ts +0 -26
- package/dist/__tests__/filters/filter-test-data.d.ts.map +0 -1
- package/dist/__tests__/filters/filter-test-data.js +0 -374
- package/dist/__tests__/filters/filter-test-data.js.map +0 -1
- package/dist/__tests__/filters/storage-filters.spec.d.ts +0 -2
- package/dist/__tests__/filters/storage-filters.spec.d.ts.map +0 -1
- package/dist/__tests__/filters/storage-filters.spec.js +0 -699
- package/dist/__tests__/filters/storage-filters.spec.js.map +0 -1
- package/dist/__tests__/filters/test-utils.d.ts +0 -23
- package/dist/__tests__/filters/test-utils.d.ts.map +0 -1
- package/dist/__tests__/filters/test-utils.js +0 -54
- package/dist/__tests__/filters/test-utils.js.map +0 -1
- package/dist/__tests__/integration/adapter-compat.integration.spec.d.ts +0 -2
- package/dist/__tests__/integration/adapter-compat.integration.spec.d.ts.map +0 -1
- package/dist/__tests__/integration/adapter-compat.integration.spec.js +0 -139
- package/dist/__tests__/integration/adapter-compat.integration.spec.js.map +0 -1
- package/dist/__tests__/integration/entries-filter-graphql-tags.integration.spec.d.ts +0 -16
- package/dist/__tests__/integration/entries-filter-graphql-tags.integration.spec.d.ts.map +0 -1
- package/dist/__tests__/integration/entries-filter-graphql-tags.integration.spec.js +0 -131
- package/dist/__tests__/integration/entries-filter-graphql-tags.integration.spec.js.map +0 -1
- package/dist/__tests__/integration/schedule-watcher.integration.spec.d.ts +0 -2
- package/dist/__tests__/integration/schedule-watcher.integration.spec.d.ts.map +0 -1
- package/dist/__tests__/integration/schedule-watcher.integration.spec.js +0 -87
- package/dist/__tests__/integration/schedule-watcher.integration.spec.js.map +0 -1
- package/dist/__tests__/integration/watcher-coexistence.integration.spec.d.ts +0 -2
- package/dist/__tests__/integration/watcher-coexistence.integration.spec.d.ts.map +0 -1
- package/dist/__tests__/integration/watcher-coexistence.integration.spec.js +0 -88
- package/dist/__tests__/integration/watcher-coexistence.integration.spec.js.map +0 -1
- package/dist/__tests__/nestlens.module.spec.d.ts +0 -2
- package/dist/__tests__/nestlens.module.spec.d.ts.map +0 -1
- package/dist/__tests__/nestlens.module.spec.js +0 -620
- package/dist/__tests__/nestlens.module.spec.js.map +0 -1
- package/dist/__tests__/package-contract.spec.d.ts +0 -2
- package/dist/__tests__/package-contract.spec.d.ts.map +0 -1
- package/dist/__tests__/package-contract.spec.js +0 -88
- package/dist/__tests__/package-contract.spec.js.map +0 -1
- package/dist/__tests__/pruning.service.spec.d.ts +0 -2
- package/dist/__tests__/pruning.service.spec.d.ts.map +0 -1
- package/dist/__tests__/pruning.service.spec.js +0 -142
- package/dist/__tests__/pruning.service.spec.js.map +0 -1
- package/dist/__tests__/setup.d.ts +0 -7
- package/dist/__tests__/setup.d.ts.map +0 -1
- package/dist/__tests__/setup.js +0 -24
- package/dist/__tests__/setup.js.map +0 -1
- package/dist/__tests__/tag.service.spec.d.ts +0 -2
- package/dist/__tests__/tag.service.spec.d.ts.map +0 -1
- package/dist/__tests__/tag.service.spec.js +0 -477
- package/dist/__tests__/tag.service.spec.js.map +0 -1
- package/dist/__tests__/watchers/batch.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/batch.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/batch.watcher.spec.js +0 -515
- package/dist/__tests__/watchers/batch.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/cache.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/cache.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/cache.watcher.spec.js +0 -397
- package/dist/__tests__/watchers/cache.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/command.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/command.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/command.watcher.spec.js +0 -604
- package/dist/__tests__/watchers/command.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/dump.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/dump.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/dump.watcher.spec.js +0 -723
- package/dist/__tests__/watchers/dump.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/event.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/event.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/event.watcher.spec.js +0 -316
- package/dist/__tests__/watchers/event.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/exception.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/exception.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/exception.watcher.spec.js +0 -507
- package/dist/__tests__/watchers/exception.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/gate.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/gate.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/gate.watcher.spec.js +0 -683
- package/dist/__tests__/watchers/gate.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/graphql/header-masking.spec.d.ts +0 -2
- package/dist/__tests__/watchers/graphql/header-masking.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/graphql/header-masking.spec.js +0 -95
- package/dist/__tests__/watchers/graphql/header-masking.spec.js.map +0 -1
- package/dist/__tests__/watchers/http-client.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/http-client.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/http-client.watcher.spec.js +0 -886
- package/dist/__tests__/watchers/http-client.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/job.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/job.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/job.watcher.spec.js +0 -843
- package/dist/__tests__/watchers/job.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/log.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/log.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/log.watcher.spec.js +0 -428
- package/dist/__tests__/watchers/log.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/mail.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/mail.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/mail.watcher.spec.js +0 -426
- package/dist/__tests__/watchers/mail.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/model.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/model.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/model.watcher.spec.js +0 -712
- package/dist/__tests__/watchers/model.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/notification.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/notification.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/notification.watcher.spec.js +0 -595
- package/dist/__tests__/watchers/notification.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/query/typeorm-integration.spec.d.ts +0 -2
- package/dist/__tests__/watchers/query/typeorm-integration.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/query/typeorm-integration.spec.js +0 -100
- package/dist/__tests__/watchers/query/typeorm-integration.spec.js.map +0 -1
- package/dist/__tests__/watchers/query/types.spec.d.ts +0 -2
- package/dist/__tests__/watchers/query/types.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/query/types.spec.js +0 -77
- package/dist/__tests__/watchers/query/types.spec.js.map +0 -1
- package/dist/__tests__/watchers/query.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/query.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/query.watcher.spec.js +0 -252
- package/dist/__tests__/watchers/query.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/redis.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/redis.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/redis.watcher.spec.js +0 -636
- package/dist/__tests__/watchers/redis.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/request.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/request.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/request.watcher.spec.js +0 -1064
- package/dist/__tests__/watchers/request.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/schedule.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/schedule.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/schedule.watcher.spec.js +0 -345
- package/dist/__tests__/watchers/schedule.watcher.spec.js.map +0 -1
- package/dist/__tests__/watchers/view.watcher.spec.d.ts +0 -2
- package/dist/__tests__/watchers/view.watcher.spec.d.ts.map +0 -1
- package/dist/__tests__/watchers/view.watcher.spec.js +0 -566
- package/dist/__tests__/watchers/view.watcher.spec.js.map +0 -1
- package/dist/dashboard/public/assets/index-BfQJSu7W.js +0 -361
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("reflect-metadata");
|
|
4
|
-
const testing_1 = require("@nestjs/testing");
|
|
5
|
-
const class_transformer_1 = require("class-transformer");
|
|
6
|
-
const api_controller_1 = require("../../api/api.controller");
|
|
7
|
-
const storage_interface_1 = require("../../core/storage/storage.interface");
|
|
8
|
-
const nestlens_config_1 = require("../../nestlens.config");
|
|
9
|
-
const pruning_service_1 = require("../../core/pruning.service");
|
|
10
|
-
const collector_service_1 = require("../../core/collector.service");
|
|
11
|
-
const dto_1 = require("../../api/dto");
|
|
12
|
-
const test_utils_1 = require("./test-utils");
|
|
13
|
-
const entry_factories_1 = require("./entry-factories");
|
|
14
|
-
/**
|
|
15
|
-
* Helper to create CursorQueryDto from query params
|
|
16
|
-
*/
|
|
17
|
-
function createQuery(params = {}) {
|
|
18
|
-
return (0, class_transformer_1.plainToInstance)(dto_1.CursorQueryDto, params);
|
|
19
|
-
}
|
|
20
|
-
describe('API Filter Parsing', () => {
|
|
21
|
-
let controller;
|
|
22
|
-
let storage;
|
|
23
|
-
beforeEach(async () => {
|
|
24
|
-
storage = (0, test_utils_1.createTestStorage)();
|
|
25
|
-
const module = await testing_1.Test.createTestingModule({
|
|
26
|
-
controllers: [api_controller_1.NestLensApiController],
|
|
27
|
-
providers: [
|
|
28
|
-
{ provide: storage_interface_1.STORAGE, useValue: storage },
|
|
29
|
-
{ provide: nestlens_config_1.NESTLENS_CONFIG, useValue: { enabled: true, pruning: { interval: 60 } } },
|
|
30
|
-
{
|
|
31
|
-
provide: pruning_service_1.PruningService,
|
|
32
|
-
useValue: { stop: jest.fn(), getStatus: jest.fn().mockReturnValue({ lastRun: null }) },
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
provide: collector_service_1.CollectorService,
|
|
36
|
-
useValue: { getRecordingStatus: jest.fn().mockReturnValue({ isPaused: false }) },
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
}).compile();
|
|
40
|
-
controller = module.get(api_controller_1.NestLensApiController);
|
|
41
|
-
});
|
|
42
|
-
afterEach(async () => {
|
|
43
|
-
await storage.close();
|
|
44
|
-
});
|
|
45
|
-
describe('Filter Parameter Parsing', () => {
|
|
46
|
-
it('parses comma-separated levels correctly', async () => {
|
|
47
|
-
await (0, test_utils_1.seedStorage)(storage, [
|
|
48
|
-
(0, entry_factories_1.createLogEntry)({ level: 'error' }),
|
|
49
|
-
(0, entry_factories_1.createLogEntry)({ level: 'warn' }),
|
|
50
|
-
(0, entry_factories_1.createLogEntry)({ level: 'debug' }),
|
|
51
|
-
]);
|
|
52
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'log', levels: 'error,warn' }));
|
|
53
|
-
expect(result.data).toHaveLength(2);
|
|
54
|
-
expect(result.data.every((e) => ['error', 'warn'].includes(e.payload.level))).toBe(true);
|
|
55
|
-
});
|
|
56
|
-
it('parses comma-separated statuses correctly', async () => {
|
|
57
|
-
await (0, test_utils_1.seedStorage)(storage, [
|
|
58
|
-
(0, entry_factories_1.createRequestEntry)({ statusCode: 200 }),
|
|
59
|
-
(0, entry_factories_1.createRequestEntry)({ statusCode: 404 }),
|
|
60
|
-
(0, entry_factories_1.createRequestEntry)({ statusCode: 500 }),
|
|
61
|
-
]);
|
|
62
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'request', statuses: '200,404' }));
|
|
63
|
-
expect(result.data).toHaveLength(2);
|
|
64
|
-
});
|
|
65
|
-
it('parses redis filters correctly', async () => {
|
|
66
|
-
await (0, test_utils_1.seedStorage)(storage, [
|
|
67
|
-
(0, entry_factories_1.createRedisEntry)({ status: 'success', command: 'GET' }),
|
|
68
|
-
(0, entry_factories_1.createRedisEntry)({ status: 'error', command: 'SET' }),
|
|
69
|
-
(0, entry_factories_1.createRedisEntry)({ status: 'success', command: 'HGET' }),
|
|
70
|
-
]);
|
|
71
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'redis', redisStatuses: 'success', redisCommands: 'GET' }));
|
|
72
|
-
expect(result.data).toHaveLength(1);
|
|
73
|
-
expect(result.data[0].payload.command).toBe('GET');
|
|
74
|
-
});
|
|
75
|
-
it('parses model filters correctly', async () => {
|
|
76
|
-
await (0, test_utils_1.seedStorage)(storage, [
|
|
77
|
-
(0, entry_factories_1.createModelEntry)({ action: 'create', entity: 'User', source: 'typeorm' }),
|
|
78
|
-
(0, entry_factories_1.createModelEntry)({ action: 'find', entity: 'Post', source: 'prisma' }),
|
|
79
|
-
(0, entry_factories_1.createModelEntry)({ action: 'update', entity: 'User', source: 'typeorm' }),
|
|
80
|
-
]);
|
|
81
|
-
const result = await controller.getEntriesWithCursor(createQuery({
|
|
82
|
-
type: 'model',
|
|
83
|
-
modelActions: 'create,update',
|
|
84
|
-
entities: 'User',
|
|
85
|
-
modelSources: 'typeorm',
|
|
86
|
-
}));
|
|
87
|
-
expect(result.data).toHaveLength(2);
|
|
88
|
-
expect(result.data.every((e) => e.payload.entity === 'User')).toBe(true);
|
|
89
|
-
});
|
|
90
|
-
it('parses gate filters correctly', async () => {
|
|
91
|
-
await (0, test_utils_1.seedStorage)(storage, [
|
|
92
|
-
(0, entry_factories_1.createGateEntry)({ gate: 'admin', allowed: true }),
|
|
93
|
-
(0, entry_factories_1.createGateEntry)({ gate: 'admin-panel', allowed: false }),
|
|
94
|
-
(0, entry_factories_1.createGateEntry)({ gate: 'premium', allowed: true }),
|
|
95
|
-
]);
|
|
96
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'gate', gateNames: 'admin', gateResults: 'allowed' }));
|
|
97
|
-
expect(result.data).toHaveLength(1);
|
|
98
|
-
expect(result.data[0].payload.gate).toBe('admin');
|
|
99
|
-
});
|
|
100
|
-
it('parses command filters correctly', async () => {
|
|
101
|
-
await (0, test_utils_1.seedStorage)(storage, [
|
|
102
|
-
(0, entry_factories_1.createCommandEntry)({ name: 'cache:clear', status: 'completed' }),
|
|
103
|
-
(0, entry_factories_1.createCommandEntry)({ name: 'cache:warmup', status: 'failed' }),
|
|
104
|
-
(0, entry_factories_1.createCommandEntry)({ name: 'db:migrate', status: 'completed' }),
|
|
105
|
-
]);
|
|
106
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'command', commandStatuses: 'completed', commandNames: 'cache' }));
|
|
107
|
-
expect(result.data).toHaveLength(1);
|
|
108
|
-
expect(result.data[0].payload.name).toBe('cache:clear');
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
describe('All Filter Parameters Defined', () => {
|
|
112
|
-
// Test that the CursorQueryDto includes all expected filter properties
|
|
113
|
-
const expectedFilters = [
|
|
114
|
-
'levels',
|
|
115
|
-
'contexts',
|
|
116
|
-
'queryTypes',
|
|
117
|
-
'sources',
|
|
118
|
-
'slow',
|
|
119
|
-
'names',
|
|
120
|
-
'methods',
|
|
121
|
-
'paths',
|
|
122
|
-
'resolved',
|
|
123
|
-
'statuses',
|
|
124
|
-
'hostnames',
|
|
125
|
-
'controllers',
|
|
126
|
-
'ips',
|
|
127
|
-
'eventNames',
|
|
128
|
-
'scheduleStatuses',
|
|
129
|
-
'scheduleNames',
|
|
130
|
-
'jobStatuses',
|
|
131
|
-
'jobNames',
|
|
132
|
-
'queues',
|
|
133
|
-
'cacheOperations',
|
|
134
|
-
'mailStatuses',
|
|
135
|
-
'redisStatuses',
|
|
136
|
-
'redisCommands',
|
|
137
|
-
'modelActions',
|
|
138
|
-
'entities',
|
|
139
|
-
'modelSources',
|
|
140
|
-
'notificationTypes',
|
|
141
|
-
'notificationStatuses',
|
|
142
|
-
'viewFormats',
|
|
143
|
-
'viewStatuses',
|
|
144
|
-
'commandStatuses',
|
|
145
|
-
'commandNames',
|
|
146
|
-
'gateNames',
|
|
147
|
-
'gateResults',
|
|
148
|
-
'batchStatuses',
|
|
149
|
-
'batchOperations',
|
|
150
|
-
'dumpStatuses',
|
|
151
|
-
'dumpOperations',
|
|
152
|
-
'dumpFormats',
|
|
153
|
-
'tags',
|
|
154
|
-
'search',
|
|
155
|
-
];
|
|
156
|
-
it('has all expected filter parameters in CursorQueryDto', () => {
|
|
157
|
-
// Verify CursorQueryDto has all expected filter properties
|
|
158
|
-
const dto = new dto_1.CursorQueryDto();
|
|
159
|
-
// All filter properties should be definable on the DTO
|
|
160
|
-
for (const filter of expectedFilters) {
|
|
161
|
-
expect(filter in dto ||
|
|
162
|
-
Object.getOwnPropertyDescriptor(dto_1.CursorQueryDto.prototype, filter) !== undefined ||
|
|
163
|
-
Reflect.getMetadataKeys(dto, filter).length >= 0).toBeTruthy();
|
|
164
|
-
}
|
|
165
|
-
expect(expectedFilters).toHaveLength(41);
|
|
166
|
-
});
|
|
167
|
-
it('toFilters() correctly extracts filter properties', () => {
|
|
168
|
-
const dto = createQuery({
|
|
169
|
-
type: 'log',
|
|
170
|
-
limit: '50',
|
|
171
|
-
levels: 'error,warn',
|
|
172
|
-
contexts: 'app,db',
|
|
173
|
-
search: 'test',
|
|
174
|
-
});
|
|
175
|
-
const filters = dto.toFilters();
|
|
176
|
-
// Should include filter properties
|
|
177
|
-
expect(filters).toHaveProperty('levels');
|
|
178
|
-
expect(filters).toHaveProperty('contexts');
|
|
179
|
-
expect(filters).toHaveProperty('search');
|
|
180
|
-
// Should NOT include pagination properties
|
|
181
|
-
expect(filters).not.toHaveProperty('type');
|
|
182
|
-
expect(filters).not.toHaveProperty('limit');
|
|
183
|
-
expect(filters).not.toHaveProperty('beforeSequence');
|
|
184
|
-
expect(filters).not.toHaveProperty('afterSequence');
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
//# sourceMappingURL=api-filters.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-filters.spec.js","sourceRoot":"","sources":["../../../src/__tests__/filters/api-filters.spec.ts"],"names":[],"mappings":";;AAAA,4BAA0B;AAC1B,6CAAsD;AACtD,yDAAoD;AACpD,6DAAiE;AACjE,4EAA+D;AAE/D,2D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AC,CAAC;YAC3C,MAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;YAEzC,2CAA2C;YAC3C,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAC3C,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YAC5C,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;YACrD,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"badge-filter-e2e.spec.d.ts","sourceRoot":"","sources":["../../../src/__tests__/filters/badge-filter-e2e.spec.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC"}
|
|
@@ -1,418 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("reflect-metadata");
|
|
4
|
-
const testing_1 = require("@nestjs/testing");
|
|
5
|
-
const class_transformer_1 = require("class-transformer");
|
|
6
|
-
const api_controller_1 = require("../../api/api.controller");
|
|
7
|
-
const storage_interface_1 = require("../../core/storage/storage.interface");
|
|
8
|
-
const memory_storage_1 = require("../../core/storage/memory.storage");
|
|
9
|
-
const nestlens_config_1 = require("../../nestlens.config");
|
|
10
|
-
const pruning_service_1 = require("../../core/pruning.service");
|
|
11
|
-
const collector_service_1 = require("../../core/collector.service");
|
|
12
|
-
const dto_1 = require("../../api/dto");
|
|
13
|
-
const test_utils_1 = require("./test-utils");
|
|
14
|
-
const entry_factories_1 = require("./entry-factories");
|
|
15
|
-
/**
|
|
16
|
-
* End-to-End Badge Filter Tests
|
|
17
|
-
*
|
|
18
|
-
* These tests verify the complete flow from badge click to filtered results:
|
|
19
|
-
* 1. Entry is saved with tags (via storage.addTags)
|
|
20
|
-
* 2. Frontend sends filter request (any case)
|
|
21
|
-
* 3. Backend correctly filters and returns matching entries
|
|
22
|
-
*
|
|
23
|
-
* CRITICAL: All tag filtering must be CASE-INSENSITIVE
|
|
24
|
-
* - Tags are stored as UPPERCASE
|
|
25
|
-
* - Filters can be sent in any case (lowercase, UPPERCASE, MixedCase)
|
|
26
|
-
* - Backend should normalize and match correctly
|
|
27
|
-
*
|
|
28
|
-
* This is the "most important test" as stated by the user:
|
|
29
|
-
* "ben bi badge e tıkladığımda. doğru sorgu gidiyo mu? doğru filtreleme yapılıyo mu?
|
|
30
|
-
* listelenenler doğru mu? her badge kendi işini uçtan uca doğru şekilde yapıyo mu?"
|
|
31
|
-
*/
|
|
32
|
-
function createQuery(params = {}) {
|
|
33
|
-
return (0, class_transformer_1.plainToInstance)(dto_1.CursorQueryDto, params);
|
|
34
|
-
}
|
|
35
|
-
describe('Badge Filter End-to-End Tests', () => {
|
|
36
|
-
let controller;
|
|
37
|
-
let storage;
|
|
38
|
-
beforeEach(async () => {
|
|
39
|
-
storage = (0, test_utils_1.createTestStorage)();
|
|
40
|
-
const module = await testing_1.Test.createTestingModule({
|
|
41
|
-
controllers: [api_controller_1.NestLensApiController],
|
|
42
|
-
providers: [
|
|
43
|
-
{ provide: storage_interface_1.STORAGE, useValue: storage },
|
|
44
|
-
{ provide: nestlens_config_1.NESTLENS_CONFIG, useValue: { enabled: true, pruning: { interval: 60 } } },
|
|
45
|
-
{
|
|
46
|
-
provide: pruning_service_1.PruningService,
|
|
47
|
-
useValue: { stop: jest.fn(), getStatus: jest.fn().mockReturnValue({ lastRun: null }) },
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
provide: collector_service_1.CollectorService,
|
|
51
|
-
useValue: { getRecordingStatus: jest.fn().mockReturnValue({ isPaused: false }) },
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
}).compile();
|
|
55
|
-
controller = module.get(api_controller_1.NestLensApiController);
|
|
56
|
-
});
|
|
57
|
-
afterEach(async () => {
|
|
58
|
-
await storage.close();
|
|
59
|
-
});
|
|
60
|
-
// ==========================================================================
|
|
61
|
-
// CACHE BADGE FILTERS (The original failing case)
|
|
62
|
-
// ==========================================================================
|
|
63
|
-
describe('Cache HIT/MISS Badge Filtering', () => {
|
|
64
|
-
beforeEach(async () => {
|
|
65
|
-
// Seed cache entries
|
|
66
|
-
const entries = await (0, test_utils_1.seedStorage)(storage, [
|
|
67
|
-
(0, entry_factories_1.createCacheEntry)({ operation: 'get', key: 'user:1', hit: true, duration: 5 }),
|
|
68
|
-
(0, entry_factories_1.createCacheEntry)({ operation: 'get', key: 'user:2', hit: false, duration: 10 }),
|
|
69
|
-
(0, entry_factories_1.createCacheEntry)({ operation: 'get', key: 'user:3', hit: true, duration: 3 }),
|
|
70
|
-
(0, entry_factories_1.createCacheEntry)({ operation: 'set', key: 'user:4', duration: 15 }),
|
|
71
|
-
]);
|
|
72
|
-
// Add HIT/MISS tags like TagService.addCacheTags would
|
|
73
|
-
await storage.addTags(entries[0].id, ['GET', 'HIT']);
|
|
74
|
-
await storage.addTags(entries[1].id, ['GET', 'MISS']);
|
|
75
|
-
await storage.addTags(entries[2].id, ['GET', 'HIT']);
|
|
76
|
-
await storage.addTags(entries[3].id, ['SET']);
|
|
77
|
-
});
|
|
78
|
-
it('filters by HIT tag with lowercase "hit"', async () => {
|
|
79
|
-
// This is what the frontend sends when clicking the HIT badge
|
|
80
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'cache', tags: 'hit' }));
|
|
81
|
-
expect(result.data).toHaveLength(2);
|
|
82
|
-
expect(result.data.every((e) => e.payload.hit === true)).toBe(true);
|
|
83
|
-
});
|
|
84
|
-
it('filters by HIT tag with UPPERCASE "HIT"', async () => {
|
|
85
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'cache', tags: 'HIT' }));
|
|
86
|
-
expect(result.data).toHaveLength(2);
|
|
87
|
-
expect(result.data.every((e) => e.payload.hit === true)).toBe(true);
|
|
88
|
-
});
|
|
89
|
-
it('filters by MISS tag with lowercase "miss"', async () => {
|
|
90
|
-
// This is what the frontend sends when clicking the MISS badge
|
|
91
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'cache', tags: 'miss' }));
|
|
92
|
-
expect(result.data).toHaveLength(1);
|
|
93
|
-
expect(result.data[0].payload.hit).toBe(false);
|
|
94
|
-
});
|
|
95
|
-
it('filters by MISS tag with UPPERCASE "MISS"', async () => {
|
|
96
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'cache', tags: 'MISS' }));
|
|
97
|
-
expect(result.data).toHaveLength(1);
|
|
98
|
-
expect(result.data[0].payload.hit).toBe(false);
|
|
99
|
-
});
|
|
100
|
-
it('filters by GET operation tag with lowercase', async () => {
|
|
101
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'cache', tags: 'get' }));
|
|
102
|
-
expect(result.data).toHaveLength(3);
|
|
103
|
-
expect(result.data.every((e) => e.payload.operation === 'get')).toBe(true);
|
|
104
|
-
});
|
|
105
|
-
it('filters by SET operation tag with mixed case', async () => {
|
|
106
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'cache', tags: 'Set' }));
|
|
107
|
-
expect(result.data).toHaveLength(1);
|
|
108
|
-
expect(result.data[0].payload.operation).toBe('set');
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
// ==========================================================================
|
|
112
|
-
// REQUEST BADGE FILTERS
|
|
113
|
-
// ==========================================================================
|
|
114
|
-
describe('Request Badge Filtering', () => {
|
|
115
|
-
beforeEach(async () => {
|
|
116
|
-
const entries = await (0, test_utils_1.seedStorage)(storage, [
|
|
117
|
-
(0, entry_factories_1.createRequestEntry)({ method: 'GET', statusCode: 200, duration: 100 }),
|
|
118
|
-
(0, entry_factories_1.createRequestEntry)({ method: 'POST', statusCode: 201, duration: 150 }),
|
|
119
|
-
(0, entry_factories_1.createRequestEntry)({ method: 'GET', statusCode: 404, duration: 50 }),
|
|
120
|
-
(0, entry_factories_1.createRequestEntry)({ method: 'DELETE', statusCode: 500, duration: 200 }),
|
|
121
|
-
(0, entry_factories_1.createRequestEntry)({ method: 'GET', statusCode: 200, duration: 1500 }), // slow
|
|
122
|
-
]);
|
|
123
|
-
// Add tags like TagService.addRequestTags would
|
|
124
|
-
await storage.addTags(entries[0].id, ['GET', 'SUCCESS']);
|
|
125
|
-
await storage.addTags(entries[1].id, ['POST', 'SUCCESS']);
|
|
126
|
-
await storage.addTags(entries[2].id, ['GET', 'CLIENT-ERROR', '4XX']);
|
|
127
|
-
await storage.addTags(entries[3].id, ['DELETE', 'ERROR', '5XX']);
|
|
128
|
-
await storage.addTags(entries[4].id, ['GET', 'SUCCESS', 'SLOW']);
|
|
129
|
-
});
|
|
130
|
-
it('filters by SUCCESS tag with lowercase', async () => {
|
|
131
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'request', tags: 'success' }));
|
|
132
|
-
expect(result.data).toHaveLength(3);
|
|
133
|
-
expect(result.data.every((e) => e.payload.statusCode >= 200 && e.payload.statusCode < 300)).toBe(true);
|
|
134
|
-
});
|
|
135
|
-
it('filters by ERROR tag with lowercase', async () => {
|
|
136
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'request', tags: 'error' }));
|
|
137
|
-
expect(result.data).toHaveLength(1);
|
|
138
|
-
expect(result.data[0].payload.statusCode).toBe(500);
|
|
139
|
-
});
|
|
140
|
-
it('filters by 5XX tag with lowercase', async () => {
|
|
141
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'request', tags: '5xx' }));
|
|
142
|
-
expect(result.data).toHaveLength(1);
|
|
143
|
-
expect(result.data[0].payload.statusCode).toBeGreaterThanOrEqual(500);
|
|
144
|
-
});
|
|
145
|
-
it('filters by SLOW tag with mixed case', async () => {
|
|
146
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'request', tags: 'Slow' }));
|
|
147
|
-
expect(result.data).toHaveLength(1);
|
|
148
|
-
expect(result.data[0].payload.duration).toBeGreaterThan(1000);
|
|
149
|
-
});
|
|
150
|
-
it('filters by HTTP method tag with lowercase', async () => {
|
|
151
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'request', tags: 'get' }));
|
|
152
|
-
expect(result.data).toHaveLength(3);
|
|
153
|
-
expect(result.data.every((e) => e.payload.method === 'GET')).toBe(true);
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
// ==========================================================================
|
|
157
|
-
// LOG LEVEL BADGE FILTERS
|
|
158
|
-
// ==========================================================================
|
|
159
|
-
describe('Log Level Badge Filtering', () => {
|
|
160
|
-
beforeEach(async () => {
|
|
161
|
-
const entries = await (0, test_utils_1.seedStorage)(storage, [
|
|
162
|
-
(0, entry_factories_1.createLogEntry)({ level: 'error', message: 'Error 1', context: 'AuthService' }),
|
|
163
|
-
(0, entry_factories_1.createLogEntry)({ level: 'warn', message: 'Warning 1', context: 'AuthService' }),
|
|
164
|
-
(0, entry_factories_1.createLogEntry)({ level: 'log', message: 'Info 1', context: 'UserService' }),
|
|
165
|
-
(0, entry_factories_1.createLogEntry)({ level: 'debug', message: 'Debug 1', context: 'UserService' }),
|
|
166
|
-
]);
|
|
167
|
-
// Add tags like TagService.addLogTags would
|
|
168
|
-
await storage.addTags(entries[0].id, ['ERROR', 'AUTHSERVICE']);
|
|
169
|
-
await storage.addTags(entries[1].id, ['WARN', 'WARNING', 'AUTHSERVICE']);
|
|
170
|
-
await storage.addTags(entries[2].id, ['LOG', 'USERSERVICE']);
|
|
171
|
-
await storage.addTags(entries[3].id, ['DEBUG', 'USERSERVICE']);
|
|
172
|
-
});
|
|
173
|
-
it('filters by ERROR tag with lowercase', async () => {
|
|
174
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'log', tags: 'error' }));
|
|
175
|
-
expect(result.data).toHaveLength(1);
|
|
176
|
-
expect(result.data[0].payload.level).toBe('error');
|
|
177
|
-
});
|
|
178
|
-
it('filters by WARNING tag with lowercase', async () => {
|
|
179
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'log', tags: 'warning' }));
|
|
180
|
-
expect(result.data).toHaveLength(1);
|
|
181
|
-
expect(result.data[0].payload.level).toBe('warn');
|
|
182
|
-
});
|
|
183
|
-
it('filters by context tag with lowercase', async () => {
|
|
184
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'log', tags: 'authservice' }));
|
|
185
|
-
expect(result.data).toHaveLength(2);
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
// ==========================================================================
|
|
189
|
-
// JOB STATUS BADGE FILTERS
|
|
190
|
-
// ==========================================================================
|
|
191
|
-
describe('Job Status Badge Filtering', () => {
|
|
192
|
-
beforeEach(async () => {
|
|
193
|
-
const entries = await (0, test_utils_1.seedStorage)(storage, [
|
|
194
|
-
(0, entry_factories_1.createJobEntry)({ name: 'send-email', status: 'completed', queue: 'default' }),
|
|
195
|
-
(0, entry_factories_1.createJobEntry)({ name: 'process-payment', status: 'failed', queue: 'payments' }),
|
|
196
|
-
(0, entry_factories_1.createJobEntry)({ name: 'notify-user', status: 'active', queue: 'notifications' }),
|
|
197
|
-
]);
|
|
198
|
-
// Add tags like TagService.addJobTags would
|
|
199
|
-
await storage.addTags(entries[0].id, ['COMPLETED', 'DEFAULT']);
|
|
200
|
-
await storage.addTags(entries[1].id, ['FAILED', 'ERROR', 'PAYMENTS']);
|
|
201
|
-
await storage.addTags(entries[2].id, ['ACTIVE', 'NOTIFICATIONS']);
|
|
202
|
-
});
|
|
203
|
-
it('filters by COMPLETED tag with lowercase', async () => {
|
|
204
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'job', tags: 'completed' }));
|
|
205
|
-
expect(result.data).toHaveLength(1);
|
|
206
|
-
expect(result.data[0].payload.status).toBe('completed');
|
|
207
|
-
});
|
|
208
|
-
it('filters by FAILED tag with lowercase', async () => {
|
|
209
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'job', tags: 'failed' }));
|
|
210
|
-
expect(result.data).toHaveLength(1);
|
|
211
|
-
expect(result.data[0].payload.status).toBe('failed');
|
|
212
|
-
});
|
|
213
|
-
it('filters by queue tag with lowercase', async () => {
|
|
214
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'job', tags: 'payments' }));
|
|
215
|
-
expect(result.data).toHaveLength(1);
|
|
216
|
-
expect(result.data[0].payload.queue).toBe('payments');
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
// ==========================================================================
|
|
220
|
-
// GATE BADGE FILTERS
|
|
221
|
-
// ==========================================================================
|
|
222
|
-
describe('Gate Result Badge Filtering', () => {
|
|
223
|
-
beforeEach(async () => {
|
|
224
|
-
const entries = await (0, test_utils_1.seedStorage)(storage, [
|
|
225
|
-
(0, entry_factories_1.createGateEntry)({ gate: 'admin', allowed: true }),
|
|
226
|
-
(0, entry_factories_1.createGateEntry)({ gate: 'admin-panel', allowed: false }),
|
|
227
|
-
(0, entry_factories_1.createGateEntry)({ gate: 'premium', allowed: true }),
|
|
228
|
-
]);
|
|
229
|
-
// Add tags like TagService.addGateTags would
|
|
230
|
-
await storage.addTags(entries[0].id, ['ALLOWED', 'ADMIN']);
|
|
231
|
-
await storage.addTags(entries[1].id, ['DENIED', 'ADMIN-PANEL']);
|
|
232
|
-
await storage.addTags(entries[2].id, ['ALLOWED', 'PREMIUM']);
|
|
233
|
-
});
|
|
234
|
-
it('filters by ALLOWED tag with lowercase', async () => {
|
|
235
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'gate', tags: 'allowed' }));
|
|
236
|
-
expect(result.data).toHaveLength(2);
|
|
237
|
-
expect(result.data.every((e) => e.payload.allowed === true)).toBe(true);
|
|
238
|
-
});
|
|
239
|
-
it('filters by DENIED tag with lowercase', async () => {
|
|
240
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'gate', tags: 'denied' }));
|
|
241
|
-
expect(result.data).toHaveLength(1);
|
|
242
|
-
expect(result.data[0].payload.allowed).toBe(false);
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
// ==========================================================================
|
|
246
|
-
// HTTP CLIENT BADGE FILTERS
|
|
247
|
-
// ==========================================================================
|
|
248
|
-
describe('HTTP Client Badge Filtering', () => {
|
|
249
|
-
beforeEach(async () => {
|
|
250
|
-
const entries = await (0, test_utils_1.seedStorage)(storage, [
|
|
251
|
-
(0, entry_factories_1.createHttpClientEntry)({ method: 'GET', statusCode: 200, hostname: 'api.example.com' }),
|
|
252
|
-
(0, entry_factories_1.createHttpClientEntry)({ method: 'POST', statusCode: 500, hostname: 'api.stripe.com' }),
|
|
253
|
-
(0, entry_factories_1.createHttpClientEntry)({ method: 'GET', statusCode: 404, hostname: 'api.example.com' }),
|
|
254
|
-
]);
|
|
255
|
-
// Add tags like TagService.addHttpClientTags would
|
|
256
|
-
await storage.addTags(entries[0].id, ['GET', 'SUCCESS', 'API.EXAMPLE.COM']);
|
|
257
|
-
await storage.addTags(entries[1].id, ['POST', 'ERROR', '5XX', 'API.STRIPE.COM']);
|
|
258
|
-
await storage.addTags(entries[2].id, ['GET', 'CLIENT-ERROR', '4XX', 'API.EXAMPLE.COM']);
|
|
259
|
-
});
|
|
260
|
-
it('filters by SUCCESS tag with lowercase', async () => {
|
|
261
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'http-client', tags: 'success' }));
|
|
262
|
-
expect(result.data).toHaveLength(1);
|
|
263
|
-
expect(result.data[0].payload.statusCode).toBe(200);
|
|
264
|
-
});
|
|
265
|
-
it('filters by hostname tag with lowercase', async () => {
|
|
266
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'http-client', tags: 'api.example.com' }));
|
|
267
|
-
expect(result.data).toHaveLength(2);
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
// ==========================================================================
|
|
271
|
-
// QUERY BADGE FILTERS
|
|
272
|
-
// ==========================================================================
|
|
273
|
-
describe('Query Badge Filtering', () => {
|
|
274
|
-
beforeEach(async () => {
|
|
275
|
-
const entries = await (0, test_utils_1.seedStorage)(storage, [
|
|
276
|
-
(0, entry_factories_1.createQueryEntry)({ query: 'SELECT * FROM users', slow: false, source: 'typeorm' }),
|
|
277
|
-
(0, entry_factories_1.createQueryEntry)({
|
|
278
|
-
query: 'INSERT INTO orders VALUES (...)',
|
|
279
|
-
slow: false,
|
|
280
|
-
source: 'prisma',
|
|
281
|
-
}),
|
|
282
|
-
(0, entry_factories_1.createQueryEntry)({ query: 'SELECT * FROM products', slow: true, source: 'typeorm' }),
|
|
283
|
-
]);
|
|
284
|
-
// Add tags like TagService.addQueryTags would
|
|
285
|
-
await storage.addTags(entries[0].id, ['SELECT', 'TYPEORM']);
|
|
286
|
-
await storage.addTags(entries[1].id, ['INSERT', 'PRISMA']);
|
|
287
|
-
await storage.addTags(entries[2].id, ['SELECT', 'TYPEORM', 'SLOW']);
|
|
288
|
-
});
|
|
289
|
-
it('filters by SELECT tag with lowercase', async () => {
|
|
290
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'query', tags: 'select' }));
|
|
291
|
-
expect(result.data).toHaveLength(2);
|
|
292
|
-
expect(result.data.every((e) => e.payload.query.toLowerCase().startsWith('select'))).toBe(true);
|
|
293
|
-
});
|
|
294
|
-
it('filters by SLOW tag with lowercase', async () => {
|
|
295
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'query', tags: 'slow' }));
|
|
296
|
-
expect(result.data).toHaveLength(1);
|
|
297
|
-
expect(result.data[0].payload.slow).toBe(true);
|
|
298
|
-
});
|
|
299
|
-
it('filters by ORM source tag with lowercase', async () => {
|
|
300
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'query', tags: 'typeorm' }));
|
|
301
|
-
expect(result.data).toHaveLength(2);
|
|
302
|
-
expect(result.data.every((e) => e.payload.source === 'typeorm')).toBe(true);
|
|
303
|
-
});
|
|
304
|
-
});
|
|
305
|
-
// ==========================================================================
|
|
306
|
-
// MULTIPLE TAGS FILTER (OR LOGIC)
|
|
307
|
-
// ==========================================================================
|
|
308
|
-
describe('Multiple Tags Filter (OR logic)', () => {
|
|
309
|
-
beforeEach(async () => {
|
|
310
|
-
const entries = await (0, test_utils_1.seedStorage)(storage, [
|
|
311
|
-
(0, entry_factories_1.createCacheEntry)({ operation: 'get', hit: true }),
|
|
312
|
-
(0, entry_factories_1.createCacheEntry)({ operation: 'get', hit: false }),
|
|
313
|
-
(0, entry_factories_1.createCacheEntry)({ operation: 'set' }),
|
|
314
|
-
]);
|
|
315
|
-
await storage.addTags(entries[0].id, ['GET', 'HIT']);
|
|
316
|
-
await storage.addTags(entries[1].id, ['GET', 'MISS']);
|
|
317
|
-
await storage.addTags(entries[2].id, ['SET']);
|
|
318
|
-
});
|
|
319
|
-
it('filters by multiple tags with lowercase (OR logic)', async () => {
|
|
320
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'cache', tags: 'hit,miss' }));
|
|
321
|
-
expect(result.data).toHaveLength(2);
|
|
322
|
-
});
|
|
323
|
-
it('filters by mixed case tags (OR logic)', async () => {
|
|
324
|
-
const result = await controller.getEntriesWithCursor(createQuery({ type: 'cache', tags: 'Hit,MISS,set' }));
|
|
325
|
-
expect(result.data).toHaveLength(3);
|
|
326
|
-
});
|
|
327
|
-
});
|
|
328
|
-
// ==========================================================================
|
|
329
|
-
// MEMORY STORAGE TAG CASE-INSENSITIVITY
|
|
330
|
-
// ==========================================================================
|
|
331
|
-
describe('Memory Storage Tag Case-Insensitivity', () => {
|
|
332
|
-
let memoryStorage;
|
|
333
|
-
beforeEach(async () => {
|
|
334
|
-
memoryStorage = new memory_storage_1.MemoryStorage({ maxEntries: 100 });
|
|
335
|
-
await memoryStorage.initialize();
|
|
336
|
-
});
|
|
337
|
-
afterEach(async () => {
|
|
338
|
-
await memoryStorage.close();
|
|
339
|
-
});
|
|
340
|
-
it('normalizes tags to uppercase on save', async () => {
|
|
341
|
-
const entry = await memoryStorage.save((0, entry_factories_1.createCacheEntry)({ operation: 'get', hit: true }));
|
|
342
|
-
await memoryStorage.addTags(entry.id, ['hit', 'get']); // lowercase input
|
|
343
|
-
const tags = await memoryStorage.getEntryTags(entry.id);
|
|
344
|
-
expect(tags).toContain('HIT'); // stored as uppercase
|
|
345
|
-
expect(tags).toContain('GET');
|
|
346
|
-
});
|
|
347
|
-
it('matches tags case-insensitively in findByTags', async () => {
|
|
348
|
-
const entry = await memoryStorage.save((0, entry_factories_1.createCacheEntry)({ operation: 'get', hit: true }));
|
|
349
|
-
await memoryStorage.addTags(entry.id, ['HIT']); // uppercase
|
|
350
|
-
const found = await memoryStorage.findByTags(['hit'], 'OR'); // lowercase search
|
|
351
|
-
expect(found).toHaveLength(1);
|
|
352
|
-
expect(found[0].id).toBe(entry.id);
|
|
353
|
-
});
|
|
354
|
-
it('matches tags case-insensitively in findWithCursor', async () => {
|
|
355
|
-
const entry = await memoryStorage.save((0, entry_factories_1.createCacheEntry)({ operation: 'get', hit: true }));
|
|
356
|
-
await memoryStorage.addTags(entry.id, ['HIT']); // uppercase
|
|
357
|
-
const result = await memoryStorage.findWithCursor('cache', {
|
|
358
|
-
filters: { tags: ['hit'] }, // lowercase search
|
|
359
|
-
});
|
|
360
|
-
expect(result.data).toHaveLength(1);
|
|
361
|
-
expect(result.data[0].id).toBe(entry.id);
|
|
362
|
-
});
|
|
363
|
-
it('removes tags case-insensitively', async () => {
|
|
364
|
-
const entry = await memoryStorage.save((0, entry_factories_1.createCacheEntry)({ operation: 'get', hit: true }));
|
|
365
|
-
await memoryStorage.addTags(entry.id, ['HIT', 'GET']); // uppercase
|
|
366
|
-
await memoryStorage.removeTags(entry.id, ['hit']); // lowercase remove
|
|
367
|
-
const tags = await memoryStorage.getEntryTags(entry.id);
|
|
368
|
-
expect(tags).not.toContain('HIT');
|
|
369
|
-
expect(tags).toContain('GET');
|
|
370
|
-
});
|
|
371
|
-
});
|
|
372
|
-
// ==========================================================================
|
|
373
|
-
// SQLITE STORAGE TAG CASE-INSENSITIVITY
|
|
374
|
-
// ==========================================================================
|
|
375
|
-
describe('SQLite Storage Tag Case-Insensitivity', () => {
|
|
376
|
-
it('normalizes tags to uppercase on save', async () => {
|
|
377
|
-
const entry = await storage.save((0, entry_factories_1.createCacheEntry)({ operation: 'get', hit: true }));
|
|
378
|
-
await storage.addTags(entry.id, ['hit', 'get']); // lowercase input
|
|
379
|
-
const tags = await storage.getEntryTags(entry.id);
|
|
380
|
-
expect(tags).toContain('HIT'); // stored as uppercase
|
|
381
|
-
expect(tags).toContain('GET');
|
|
382
|
-
});
|
|
383
|
-
it('matches tags case-insensitively in findByTags', async () => {
|
|
384
|
-
const entry = await storage.save((0, entry_factories_1.createCacheEntry)({ operation: 'get', hit: true }));
|
|
385
|
-
await storage.addTags(entry.id, ['HIT']); // uppercase
|
|
386
|
-
const found = await storage.findByTags(['hit'], 'OR'); // lowercase search
|
|
387
|
-
expect(found).toHaveLength(1);
|
|
388
|
-
expect(found[0].id).toBe(entry.id);
|
|
389
|
-
});
|
|
390
|
-
it('matches tags case-insensitively in findWithCursor', async () => {
|
|
391
|
-
const entry = await storage.save((0, entry_factories_1.createCacheEntry)({ operation: 'get', hit: true }));
|
|
392
|
-
await storage.addTags(entry.id, ['HIT']); // uppercase
|
|
393
|
-
const result = await storage.findWithCursor('cache', {
|
|
394
|
-
filters: { tags: ['hit'] }, // lowercase search
|
|
395
|
-
});
|
|
396
|
-
expect(result.data).toHaveLength(1);
|
|
397
|
-
expect(result.data[0].id).toBe(entry.id);
|
|
398
|
-
});
|
|
399
|
-
it('removes tags case-insensitively', async () => {
|
|
400
|
-
const entry = await storage.save((0, entry_factories_1.createCacheEntry)({ operation: 'get', hit: true }));
|
|
401
|
-
await storage.addTags(entry.id, ['HIT', 'GET']); // uppercase
|
|
402
|
-
await storage.removeTags(entry.id, ['hit']); // lowercase remove
|
|
403
|
-
const tags = await storage.getEntryTags(entry.id);
|
|
404
|
-
expect(tags).not.toContain('HIT');
|
|
405
|
-
expect(tags).toContain('GET');
|
|
406
|
-
});
|
|
407
|
-
it('handles mixed case tags in AND logic', async () => {
|
|
408
|
-
const entry1 = await storage.save((0, entry_factories_1.createCacheEntry)({ operation: 'get', hit: true }));
|
|
409
|
-
const entry2 = await storage.save((0, entry_factories_1.createCacheEntry)({ operation: 'get', hit: false }));
|
|
410
|
-
await storage.addTags(entry1.id, ['GET', 'HIT']);
|
|
411
|
-
await storage.addTags(entry2.id, ['GET', 'MISS']);
|
|
412
|
-
const found = await storage.findByTags(['get', 'hit'], 'AND'); // lowercase search
|
|
413
|
-
expect(found).toHaveLength(1);
|
|
414
|
-
expect(found[0].id).toBe(entry1.id);
|
|
415
|
-
});
|
|
416
|
-
});
|
|
417
|
-
});
|
|
418
|
-
//# sourceMappingURL=badge-filter-e2e.spec.js.map
|