@ngn-net/nestjs-telescope 0.2.1 → 0.2.3

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.
@@ -11,5 +11,8 @@ export declare enum EntryType {
11
11
  SCHEDULED_TASK = "scheduled_task",
12
12
  REDIS = "redis",
13
13
  GATE = "gate",
14
+ COMMAND = "command",
15
+ MODEL = "model",
16
+ NOTIFICATION = "notification",
14
17
  DUMP = "dump"
15
18
  }
@@ -16,5 +16,8 @@ var EntryType;
16
16
  EntryType["SCHEDULED_TASK"] = "scheduled_task";
17
17
  EntryType["REDIS"] = "redis";
18
18
  EntryType["GATE"] = "gate";
19
+ EntryType["COMMAND"] = "command";
20
+ EntryType["MODEL"] = "model";
21
+ EntryType["NOTIFICATION"] = "notification";
19
22
  EntryType["DUMP"] = "dump";
20
23
  })(EntryType || (exports.EntryType = EntryType = {}));
package/dist/index.d.ts CHANGED
@@ -8,13 +8,7 @@ export * from './interfaces/entry.interface';
8
8
  export * from './guards/telescope-jwt.guard';
9
9
  export * from './constants';
10
10
  export * from './dashboard.provider';
11
- export * from './watchers/http-request.watcher';
12
- export * from './watchers/query.watcher';
13
- export * from './watchers/cache.watcher';
14
- export * from './watchers/queue.watcher';
15
- export * from './watchers/event.watcher';
16
- export * from './watchers/mail.watcher';
17
- export * from './watchers/log.watcher';
18
- export * from './watchers/exception.watcher';
19
- export * from './watchers/schedule.watcher';
20
- export * from './watchers/redis.watcher';
11
+ export * from './watchers/command.watcher';
12
+ export * from './watchers/model.watcher';
13
+ export * from './watchers/notification.watcher';
14
+ export * from './watchers/gate.watcher';
package/dist/index.js CHANGED
@@ -26,13 +26,7 @@ __exportStar(require("./guards/telescope-jwt.guard"), exports);
26
26
  __exportStar(require("./constants"), exports);
27
27
  __exportStar(require("./dashboard.provider"), exports);
28
28
  // Export all watchers for custom usage/extension
29
- __exportStar(require("./watchers/http-request.watcher"), exports);
30
- __exportStar(require("./watchers/query.watcher"), exports);
31
- __exportStar(require("./watchers/cache.watcher"), exports);
32
- __exportStar(require("./watchers/queue.watcher"), exports);
33
- __exportStar(require("./watchers/event.watcher"), exports);
34
- __exportStar(require("./watchers/mail.watcher"), exports);
35
- __exportStar(require("./watchers/log.watcher"), exports);
36
- __exportStar(require("./watchers/exception.watcher"), exports);
37
- __exportStar(require("./watchers/schedule.watcher"), exports);
38
- __exportStar(require("./watchers/redis.watcher"), exports);
29
+ __exportStar(require("./watchers/command.watcher"), exports);
30
+ __exportStar(require("./watchers/model.watcher"), exports);
31
+ __exportStar(require("./watchers/notification.watcher"), exports);
32
+ __exportStar(require("./watchers/gate.watcher"), exports);
@@ -33,8 +33,13 @@ const mail_watcher_1 = require("./watchers/mail.watcher");
33
33
  const log_watcher_1 = require("./watchers/log.watcher");
34
34
  const exception_watcher_1 = require("./watchers/exception.watcher");
35
35
  const schedule_watcher_1 = require("./watchers/schedule.watcher");
36
+ const http_service_watcher_1 = require("./watchers/http-service.watcher");
36
37
  const redis_watcher_1 = require("./watchers/redis.watcher");
37
38
  const telescope_jwt_guard_1 = require("./guards/telescope-jwt.guard");
39
+ const command_watcher_1 = require("./watchers/command.watcher");
40
+ const model_watcher_1 = require("./watchers/model.watcher");
41
+ const notification_watcher_1 = require("./watchers/notification.watcher");
42
+ const gate_watcher_1 = require("./watchers/gate.watcher");
38
43
  const constants_1 = require("./constants");
39
44
  const entry_type_enum_1 = require("./enums/entry-type.enum");
40
45
  let TelescopeModule = TelescopeModule_1 = class TelescopeModule {
@@ -215,6 +220,10 @@ let TelescopeModule = TelescopeModule_1 = class TelescopeModule {
215
220
  { type: entry_type_enum_1.EntryType.LOG, watcher: log_watcher_1.LogWatcher },
216
221
  { type: entry_type_enum_1.EntryType.EXCEPTION, watcher: exception_watcher_1.ExceptionWatcher, isInterceptor: true },
217
222
  { type: entry_type_enum_1.EntryType.REDIS, watcher: redis_watcher_1.RedisWatcher },
223
+ // New watchers for parity with Laravel Telescope
224
+ { type: entry_type_enum_1.EntryType.COMMAND, watcher: command_watcher_1.CommandWatcher },
225
+ { type: entry_type_enum_1.EntryType.MODEL, watcher: model_watcher_1.ModelWatcher },
226
+ { type: entry_type_enum_1.EntryType.NOTIFICATION, watcher: notification_watcher_1.NotificationWatcher },
218
227
  ];
219
228
  for (const item of coreWatchers) {
220
229
  if (!options.enabledEntryTypes || options.enabledEntryTypes.includes(item.type)) {
@@ -226,6 +235,22 @@ let TelescopeModule = TelescopeModule_1 = class TelescopeModule {
226
235
  }
227
236
  }
228
237
  }
238
+ // Additional optional watchers (non-interceptors)
239
+ if (!options.enabledEntryTypes || options.enabledEntryTypes.includes(entry_type_enum_1.EntryType.HTTP_CLIENT)) {
240
+ providers.push(http_service_watcher_1.HttpServiceWatcher);
241
+ }
242
+ if (!options.enabledEntryTypes || options.enabledEntryTypes.includes(entry_type_enum_1.EntryType.COMMAND)) {
243
+ providers.push(command_watcher_1.CommandWatcher);
244
+ }
245
+ if (!options.enabledEntryTypes || options.enabledEntryTypes.includes(entry_type_enum_1.EntryType.MODEL)) {
246
+ providers.push(model_watcher_1.ModelWatcher);
247
+ }
248
+ if (!options.enabledEntryTypes || options.enabledEntryTypes.includes(entry_type_enum_1.EntryType.NOTIFICATION)) {
249
+ providers.push(notification_watcher_1.NotificationWatcher);
250
+ }
251
+ if (!options.enabledEntryTypes || options.enabledEntryTypes.includes(entry_type_enum_1.EntryType.GATE)) {
252
+ providers.push(gate_watcher_1.GateWatcher);
253
+ }
229
254
  // 2. CacheWatcher
230
255
  try {
231
256
  require('@nestjs/cache-manager');
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ngn-net/nestjs-telescope",
3
- "version": "0.2.1",
4
- "builtAt": "2026-06-08T11:03:02.519Z"
3
+ "version": "0.2.3",
4
+ "builtAt": "2026-06-08T11:52:38.806Z"
5
5
  }
@@ -0,0 +1,13 @@
1
+ import { OnModuleInit } from '@nestjs/common';
2
+ import { TelescopeService } from '../telescope.service';
3
+ /**
4
+ * Placeholder watcher for command execution monitoring.
5
+ * In a real implementation you would integrate with a command runner
6
+ * such as `nest-commander` or capture process events.
7
+ */
8
+ export declare class CommandWatcher implements OnModuleInit {
9
+ private readonly telescope;
10
+ private readonly logger;
11
+ constructor(telescope: TelescopeService);
12
+ onModuleInit(): void;
13
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var CommandWatcher_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.CommandWatcher = void 0;
14
+ // src/watchers/command.watcher.ts
15
+ const common_1 = require("@nestjs/common");
16
+ const telescope_service_1 = require("../telescope.service");
17
+ const entry_type_enum_1 = require("../enums/entry-type.enum");
18
+ /**
19
+ * Placeholder watcher for command execution monitoring.
20
+ * In a real implementation you would integrate with a command runner
21
+ * such as `nest-commander` or capture process events.
22
+ */
23
+ let CommandWatcher = CommandWatcher_1 = class CommandWatcher {
24
+ telescope;
25
+ logger = new common_1.Logger(CommandWatcher_1.name);
26
+ constructor(telescope) {
27
+ this.telescope = telescope;
28
+ }
29
+ onModuleInit() {
30
+ // Example: record a dummy command entry when the module initializes.
31
+ this.telescope
32
+ .record({
33
+ type: entry_type_enum_1.EntryType.COMMAND,
34
+ content: {
35
+ command: 'module:init',
36
+ args: process.argv.slice(2),
37
+ timestamp: new Date().toISOString(),
38
+ },
39
+ })
40
+ .catch(() => { });
41
+ this.logger.debug('CommandWatcher initialized – dummy entry recorded');
42
+ }
43
+ };
44
+ exports.CommandWatcher = CommandWatcher;
45
+ exports.CommandWatcher = CommandWatcher = CommandWatcher_1 = __decorate([
46
+ (0, common_1.Injectable)(),
47
+ __metadata("design:paramtypes", [telescope_service_1.TelescopeService])
48
+ ], CommandWatcher);
@@ -0,0 +1,13 @@
1
+ import { OnModuleInit } from '@nestjs/common';
2
+ import { TelescopeService } from '../telescope.service';
3
+ /**
4
+ * Placeholder watcher for authorization gate checks.
5
+ * In a full implementation you would hook into NestJS guards (CanActivate)
6
+ * and record the decision, user, policy, etc.
7
+ */
8
+ export declare class GateWatcher implements OnModuleInit {
9
+ private readonly telescope;
10
+ private readonly logger;
11
+ constructor(telescope: TelescopeService);
12
+ onModuleInit(): void;
13
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var GateWatcher_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.GateWatcher = void 0;
14
+ // src/watchers/gate.watcher.ts
15
+ const common_1 = require("@nestjs/common");
16
+ const telescope_service_1 = require("../telescope.service");
17
+ const entry_type_enum_1 = require("../enums/entry-type.enum");
18
+ /**
19
+ * Placeholder watcher for authorization gate checks.
20
+ * In a full implementation you would hook into NestJS guards (CanActivate)
21
+ * and record the decision, user, policy, etc.
22
+ */
23
+ let GateWatcher = GateWatcher_1 = class GateWatcher {
24
+ telescope;
25
+ logger = new common_1.Logger(GateWatcher_1.name);
26
+ constructor(telescope) {
27
+ this.telescope = telescope;
28
+ }
29
+ onModuleInit() {
30
+ // Record a dummy gate entry on init for demonstration.
31
+ this.telescope
32
+ .record({
33
+ type: entry_type_enum_1.EntryType.GATE,
34
+ content: {
35
+ gate: 'module:init',
36
+ allowed: true,
37
+ timestamp: new Date().toISOString(),
38
+ },
39
+ })
40
+ .catch(() => { });
41
+ this.logger.debug('GateWatcher initialized – dummy entry recorded');
42
+ }
43
+ };
44
+ exports.GateWatcher = GateWatcher;
45
+ exports.GateWatcher = GateWatcher = GateWatcher_1 = __decorate([
46
+ (0, common_1.Injectable)(),
47
+ __metadata("design:paramtypes", [telescope_service_1.TelescopeService])
48
+ ], GateWatcher);
@@ -0,0 +1,14 @@
1
+ import { OnModuleInit } from '@nestjs/common';
2
+ import { TelescopeService } from '../telescope.service';
3
+ import { TelescopeOptions } from '../interfaces/telescope-options.interface';
4
+ /**
5
+ * Watches outbound HTTP requests made via NestJS's HttpService (axios based).
6
+ * It patches the HttpService prototype methods to record request/response data.
7
+ * The watcher is optional – it only activates if @nestjs/axios is installed.
8
+ */
9
+ export declare class HttpServiceWatcher implements OnModuleInit {
10
+ private readonly telescope;
11
+ private readonly options?;
12
+ constructor(telescope: TelescopeService, options?: TelescopeOptions | undefined);
13
+ onModuleInit(): void;
14
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.HttpServiceWatcher = void 0;
16
+ // src/watchers/http-service.watcher.ts
17
+ const common_1 = require("@nestjs/common");
18
+ const telescope_service_1 = require("../telescope.service");
19
+ const entry_type_enum_1 = require("../enums/entry-type.enum");
20
+ const constants_1 = require("../constants");
21
+ /**
22
+ * Watches outbound HTTP requests made via NestJS's HttpService (axios based).
23
+ * It patches the HttpService prototype methods to record request/response data.
24
+ * The watcher is optional – it only activates if @nestjs/axios is installed.
25
+ */
26
+ let HttpServiceWatcher = class HttpServiceWatcher {
27
+ telescope;
28
+ options;
29
+ constructor(telescope, options) {
30
+ this.telescope = telescope;
31
+ this.options = options;
32
+ }
33
+ onModuleInit() {
34
+ try {
35
+ const { HttpService } = require('@nestjs/axios');
36
+ const methods = ['get', 'post', 'put', 'delete', 'patch', 'head', 'options'];
37
+ for (const method of methods) {
38
+ if (typeof HttpService.prototype[method] !== 'function')
39
+ continue;
40
+ const original = HttpService.prototype[method];
41
+ const self = this;
42
+ HttpService.prototype[method] = async function (...args) {
43
+ const url = args[0];
44
+ const config = args[1] ?? {};
45
+ const start = Date.now();
46
+ try {
47
+ const response = await original.apply(this, args);
48
+ const duration = Date.now() - start;
49
+ // Record successful request
50
+ self.telescope
51
+ .record({
52
+ type: entry_type_enum_1.EntryType.HTTP_CLIENT,
53
+ content: {
54
+ method: method.toUpperCase(),
55
+ url,
56
+ requestConfig: config,
57
+ responseStatus: response?.status,
58
+ responseData: response?.data,
59
+ duration,
60
+ },
61
+ })
62
+ .catch(() => { });
63
+ return response;
64
+ }
65
+ catch (err) {
66
+ const duration = Date.now() - start;
67
+ self.telescope
68
+ .record({
69
+ type: entry_type_enum_1.EntryType.HTTP_CLIENT,
70
+ content: {
71
+ method: method.toUpperCase(),
72
+ url,
73
+ requestConfig: config,
74
+ error: err?.message,
75
+ duration,
76
+ },
77
+ })
78
+ .catch(() => { });
79
+ throw err;
80
+ }
81
+ };
82
+ }
83
+ }
84
+ catch (e) {
85
+ // @nestjs/axios not installed – watcher remains inactive.
86
+ }
87
+ }
88
+ };
89
+ exports.HttpServiceWatcher = HttpServiceWatcher;
90
+ exports.HttpServiceWatcher = HttpServiceWatcher = __decorate([
91
+ (0, common_1.Injectable)(),
92
+ __param(1, (0, common_1.Inject)(constants_1.TELESCOPE_OPTIONS)),
93
+ __param(1, (0, common_1.Optional)()),
94
+ __metadata("design:paramtypes", [telescope_service_1.TelescopeService, Object])
95
+ ], HttpServiceWatcher);
@@ -0,0 +1,14 @@
1
+ import { EntitySubscriberInterface, InsertEvent, UpdateEvent, RemoveEvent } from 'typeorm';
2
+ import { TelescopeService } from '../telescope.service';
3
+ /**
4
+ * Subscribes to TypeORM entity lifecycle events and records them.
5
+ * This watcher is automatically registered when TypeORM is present.
6
+ */
7
+ export declare class ModelSubscriber implements EntitySubscriberInterface {
8
+ private readonly telescope;
9
+ constructor(telescope: TelescopeService);
10
+ listenTo(): ObjectConstructor;
11
+ afterInsert(event: InsertEvent<any>): void;
12
+ afterUpdate(event: UpdateEvent<any>): void;
13
+ afterRemove(event: RemoveEvent<any>): void;
14
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ModelSubscriber = void 0;
13
+ // src/watchers/model.subscriber.ts
14
+ const typeorm_1 = require("typeorm");
15
+ const common_1 = require("@nestjs/common");
16
+ const telescope_service_1 = require("../telescope.service");
17
+ const entry_type_enum_1 = require("../enums/entry-type.enum");
18
+ /**
19
+ * Subscribes to TypeORM entity lifecycle events and records them.
20
+ * This watcher is automatically registered when TypeORM is present.
21
+ */
22
+ let ModelSubscriber = class ModelSubscriber {
23
+ telescope;
24
+ constructor(telescope) {
25
+ this.telescope = telescope;
26
+ }
27
+ listenTo() {
28
+ // Listen to all entities
29
+ return Object;
30
+ }
31
+ afterInsert(event) {
32
+ this.telescope.record({
33
+ type: entry_type_enum_1.EntryType.MODEL,
34
+ content: {
35
+ action: 'insert',
36
+ entity: event.metadata.name,
37
+ primaryKey: event.entity?.id ?? null,
38
+ data: event.entity,
39
+ },
40
+ }).catch(() => { });
41
+ }
42
+ afterUpdate(event) {
43
+ this.telescope.record({
44
+ type: entry_type_enum_1.EntryType.MODEL,
45
+ content: {
46
+ action: 'update',
47
+ entity: event.metadata.name,
48
+ primaryKey: event.entity?.id ?? null,
49
+ updatedColumns: event.updatedColumns.map(col => col.propertyName),
50
+ data: event.entity,
51
+ },
52
+ }).catch(() => { });
53
+ }
54
+ afterRemove(event) {
55
+ this.telescope.record({
56
+ type: entry_type_enum_1.EntryType.MODEL,
57
+ content: {
58
+ action: 'remove',
59
+ entity: event.metadata.name,
60
+ primaryKey: event.entityId,
61
+ },
62
+ }).catch(() => { });
63
+ }
64
+ };
65
+ exports.ModelSubscriber = ModelSubscriber;
66
+ exports.ModelSubscriber = ModelSubscriber = __decorate([
67
+ (0, typeorm_1.EventSubscriber)(),
68
+ (0, common_1.Injectable)(),
69
+ __metadata("design:paramtypes", [telescope_service_1.TelescopeService])
70
+ ], ModelSubscriber);
@@ -0,0 +1,12 @@
1
+ import { OnModuleInit } from '@nestjs/common';
2
+ import { TelescopeService } from '../telescope.service';
3
+ /**
4
+ * Placeholder watcher for ORM model events (e.g., TypeORM, Mongoose, Sequelize).
5
+ * Real implementation would subscribe to lifecycle hooks and record create/update/delete.
6
+ */
7
+ export declare class ModelWatcher implements OnModuleInit {
8
+ private readonly telescope;
9
+ private readonly logger;
10
+ constructor(telescope: TelescopeService);
11
+ onModuleInit(): void;
12
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var ModelWatcher_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.ModelWatcher = void 0;
14
+ // src/watchers/model.watcher.ts
15
+ const common_1 = require("@nestjs/common");
16
+ const telescope_service_1 = require("../telescope.service");
17
+ const entry_type_enum_1 = require("../enums/entry-type.enum");
18
+ /**
19
+ * Placeholder watcher for ORM model events (e.g., TypeORM, Mongoose, Sequelize).
20
+ * Real implementation would subscribe to lifecycle hooks and record create/update/delete.
21
+ */
22
+ let ModelWatcher = ModelWatcher_1 = class ModelWatcher {
23
+ telescope;
24
+ logger = new common_1.Logger(ModelWatcher_1.name);
25
+ constructor(telescope) {
26
+ this.telescope = telescope;
27
+ }
28
+ onModuleInit() {
29
+ // Dummy entry to prove watcher registration.
30
+ this.telescope
31
+ .record({
32
+ type: entry_type_enum_1.EntryType.MODEL,
33
+ content: {
34
+ model: 'module:init',
35
+ action: 'init',
36
+ timestamp: new Date().toISOString(),
37
+ },
38
+ })
39
+ .catch(() => { });
40
+ this.logger.debug('ModelWatcher initialized – dummy entry recorded');
41
+ }
42
+ };
43
+ exports.ModelWatcher = ModelWatcher;
44
+ exports.ModelWatcher = ModelWatcher = ModelWatcher_1 = __decorate([
45
+ (0, common_1.Injectable)(),
46
+ __metadata("design:paramtypes", [telescope_service_1.TelescopeService])
47
+ ], ModelWatcher);
@@ -0,0 +1,13 @@
1
+ import { OnModuleInit } from '@nestjs/common';
2
+ import { TelescopeService } from '../telescope.service';
3
+ /**
4
+ * Placeholder watcher for notification events.
5
+ * In a full implementation you would hook into NestJS's EventEmitter2 or any
6
+ * custom notification system and log the payload.
7
+ */
8
+ export declare class NotificationWatcher implements OnModuleInit {
9
+ private readonly telescope;
10
+ private readonly logger;
11
+ constructor(telescope: TelescopeService);
12
+ onModuleInit(): void;
13
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var NotificationWatcher_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.NotificationWatcher = void 0;
14
+ // src/watchers/notification.watcher.ts
15
+ const common_1 = require("@nestjs/common");
16
+ const telescope_service_1 = require("../telescope.service");
17
+ const entry_type_enum_1 = require("../enums/entry-type.enum");
18
+ /**
19
+ * Placeholder watcher for notification events.
20
+ * In a full implementation you would hook into NestJS's EventEmitter2 or any
21
+ * custom notification system and log the payload.
22
+ */
23
+ let NotificationWatcher = NotificationWatcher_1 = class NotificationWatcher {
24
+ telescope;
25
+ logger = new common_1.Logger(NotificationWatcher_1.name);
26
+ constructor(telescope) {
27
+ this.telescope = telescope;
28
+ }
29
+ onModuleInit() {
30
+ // Record a dummy notification on module init.
31
+ this.telescope
32
+ .record({
33
+ type: entry_type_enum_1.EntryType.NOTIFICATION,
34
+ content: {
35
+ notification: 'module:init',
36
+ payload: {},
37
+ timestamp: new Date().toISOString(),
38
+ },
39
+ })
40
+ .catch(() => { });
41
+ this.logger.debug('NotificationWatcher initialized – dummy entry recorded');
42
+ }
43
+ };
44
+ exports.NotificationWatcher = NotificationWatcher;
45
+ exports.NotificationWatcher = NotificationWatcher = NotificationWatcher_1 = __decorate([
46
+ (0, common_1.Injectable)(),
47
+ __metadata("design:paramtypes", [telescope_service_1.TelescopeService])
48
+ ], NotificationWatcher);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngn-net/nestjs-telescope",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },