@hazeljs/inspector 0.2.0-rc.5

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.
Files changed (75) hide show
  1. package/LICENSE +192 -0
  2. package/README.md +97 -0
  3. package/dist/config/inspector.config.d.ts +8 -0
  4. package/dist/config/inspector.config.d.ts.map +1 -0
  5. package/dist/config/inspector.config.js +38 -0
  6. package/dist/contracts/types.d.ts +253 -0
  7. package/dist/contracts/types.d.ts.map +1 -0
  8. package/dist/contracts/types.js +5 -0
  9. package/dist/index.d.ts +11 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +14 -0
  12. package/dist/inspector.module.d.ts +25 -0
  13. package/dist/inspector.module.d.ts.map +1 -0
  14. package/dist/inspector.module.js +489 -0
  15. package/dist/plugins/agent.inspector.d.ts +8 -0
  16. package/dist/plugins/agent.inspector.d.ts.map +1 -0
  17. package/dist/plugins/agent.inspector.js +51 -0
  18. package/dist/plugins/ai.inspector.d.ts +8 -0
  19. package/dist/plugins/ai.inspector.d.ts.map +1 -0
  20. package/dist/plugins/ai.inspector.js +87 -0
  21. package/dist/plugins/core.inspector.d.ts +8 -0
  22. package/dist/plugins/core.inspector.d.ts.map +1 -0
  23. package/dist/plugins/core.inspector.js +203 -0
  24. package/dist/plugins/cron.inspector.d.ts +8 -0
  25. package/dist/plugins/cron.inspector.d.ts.map +1 -0
  26. package/dist/plugins/cron.inspector.js +74 -0
  27. package/dist/plugins/data.inspector.d.ts +8 -0
  28. package/dist/plugins/data.inspector.d.ts.map +1 -0
  29. package/dist/plugins/data.inspector.js +50 -0
  30. package/dist/plugins/event-emitter.inspector.d.ts +8 -0
  31. package/dist/plugins/event-emitter.inspector.d.ts.map +1 -0
  32. package/dist/plugins/event-emitter.inspector.js +53 -0
  33. package/dist/plugins/flow.inspector.d.ts +8 -0
  34. package/dist/plugins/flow.inspector.d.ts.map +1 -0
  35. package/dist/plugins/flow.inspector.js +112 -0
  36. package/dist/plugins/graphql.inspector.d.ts +8 -0
  37. package/dist/plugins/graphql.inspector.d.ts.map +1 -0
  38. package/dist/plugins/graphql.inspector.js +75 -0
  39. package/dist/plugins/grpc.inspector.d.ts +8 -0
  40. package/dist/plugins/grpc.inspector.d.ts.map +1 -0
  41. package/dist/plugins/grpc.inspector.js +53 -0
  42. package/dist/plugins/kafka.inspector.d.ts +8 -0
  43. package/dist/plugins/kafka.inspector.d.ts.map +1 -0
  44. package/dist/plugins/kafka.inspector.js +59 -0
  45. package/dist/plugins/ml.inspector.d.ts +8 -0
  46. package/dist/plugins/ml.inspector.d.ts.map +1 -0
  47. package/dist/plugins/ml.inspector.js +78 -0
  48. package/dist/plugins/prompts.inspector.d.ts +7 -0
  49. package/dist/plugins/prompts.inspector.d.ts.map +1 -0
  50. package/dist/plugins/prompts.inspector.js +41 -0
  51. package/dist/plugins/queue.inspector.d.ts +8 -0
  52. package/dist/plugins/queue.inspector.d.ts.map +1 -0
  53. package/dist/plugins/queue.inspector.js +55 -0
  54. package/dist/plugins/rag.inspector.d.ts +8 -0
  55. package/dist/plugins/rag.inspector.d.ts.map +1 -0
  56. package/dist/plugins/rag.inspector.js +72 -0
  57. package/dist/plugins/serverless.inspector.d.ts +8 -0
  58. package/dist/plugins/serverless.inspector.d.ts.map +1 -0
  59. package/dist/plugins/serverless.inspector.js +53 -0
  60. package/dist/plugins/websocket.inspector.d.ts +8 -0
  61. package/dist/plugins/websocket.inspector.d.ts.map +1 -0
  62. package/dist/plugins/websocket.inspector.js +73 -0
  63. package/dist/registry/registry.d.ts +12 -0
  64. package/dist/registry/registry.d.ts.map +1 -0
  65. package/dist/registry/registry.js +43 -0
  66. package/dist/runtime/inspector-runtime.d.ts +66 -0
  67. package/dist/runtime/inspector-runtime.d.ts.map +1 -0
  68. package/dist/runtime/inspector-runtime.js +97 -0
  69. package/dist/service/inspector.service.d.ts +37 -0
  70. package/dist/service/inspector.service.d.ts.map +1 -0
  71. package/dist/service/inspector.service.js +146 -0
  72. package/package.json +124 -0
  73. package/ui-dist/assets/index-BN8Zr7QX.css +1 -0
  74. package/ui-dist/assets/index-DLS5TpZI.js +80 -0
  75. package/ui-dist/index.html +316 -0
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ /**
3
+ * AI inspector plugin - inspects @AIFunction decorated methods
4
+ * Optional: requires @hazeljs/ai to be installed
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.aiInspector = void 0;
8
+ require("reflect-metadata");
9
+ const core_1 = require("@hazeljs/core");
10
+ const AI_FUNCTION_METADATA_KEY = 'hazel:ai:function';
11
+ function createId(...parts) {
12
+ return parts.filter(Boolean).join(':');
13
+ }
14
+ function tryGetAIModule() {
15
+ try {
16
+ require.resolve('@hazeljs/ai');
17
+ return true;
18
+ }
19
+ catch {
20
+ return false;
21
+ }
22
+ }
23
+ exports.aiInspector = {
24
+ name: 'ai',
25
+ version: '1.0.0',
26
+ supports: () => tryGetAIModule(),
27
+ inspect: async (context) => {
28
+ if (!tryGetAIModule())
29
+ return [];
30
+ const entries = [];
31
+ const controllers = (0, core_1.collectControllersFromModule)(context.moduleType);
32
+ for (const ctrl of controllers) {
33
+ const proto = ctrl.prototype;
34
+ if (!proto)
35
+ continue;
36
+ const methodNames = Object.getOwnPropertyNames(proto).filter((n) => n !== 'constructor' && typeof proto[n] === 'function');
37
+ for (const methodName of methodNames) {
38
+ const meta = Reflect.getMetadata(AI_FUNCTION_METADATA_KEY, proto, methodName);
39
+ if (!meta)
40
+ continue;
41
+ const className = ctrl.name ?? 'Unknown';
42
+ entries.push({
43
+ id: createId('aifunction', className, methodName),
44
+ kind: 'aifunction',
45
+ packageName: '@hazeljs/ai',
46
+ sourceType: 'method',
47
+ className,
48
+ methodName,
49
+ provider: meta.provider,
50
+ model: meta.model,
51
+ streaming: meta.streaming,
52
+ });
53
+ }
54
+ }
55
+ // Also scan providers for AI functions
56
+ const tokens = context.container.getTokens?.() ?? [];
57
+ for (const token of tokens) {
58
+ if (typeof token !== 'function')
59
+ continue;
60
+ const proto = token.prototype;
61
+ if (!proto)
62
+ continue;
63
+ const methodNames = Object.getOwnPropertyNames(proto).filter((n) => n !== 'constructor' && typeof proto[n] === 'function');
64
+ for (const methodName of methodNames) {
65
+ const meta = Reflect.getMetadata(AI_FUNCTION_METADATA_KEY, proto, methodName);
66
+ if (!meta)
67
+ continue;
68
+ const className = token.name ?? 'Unknown';
69
+ const id = createId('aifunction', className, methodName);
70
+ if (entries.some((e) => e.id === id))
71
+ continue;
72
+ entries.push({
73
+ id,
74
+ kind: 'aifunction',
75
+ packageName: '@hazeljs/ai',
76
+ sourceType: 'method',
77
+ className,
78
+ methodName,
79
+ provider: meta.provider,
80
+ model: meta.model,
81
+ streaming: meta.streaming,
82
+ });
83
+ }
84
+ }
85
+ return entries;
86
+ },
87
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Core inspector plugin - routes, modules, providers, decorators
3
+ * Uses @hazeljs/core utilities: collectControllersFromModule, collectModulesFromModule, getModuleMetadata
4
+ */
5
+ import 'reflect-metadata';
6
+ import type { HazelInspectorPlugin } from '../contracts/types';
7
+ export declare const coreInspector: HazelInspectorPlugin;
8
+ //# sourceMappingURL=core.inspector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.inspector.d.ts","sourceRoot":"","sources":["../../src/plugins/core.inspector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,kBAAkB,CAAC;AA4B1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,eAAO,MAAM,aAAa,EAAE,oBA8M3B,CAAC"}
@@ -0,0 +1,203 @@
1
+ "use strict";
2
+ /**
3
+ * Core inspector plugin - routes, modules, providers, decorators
4
+ * Uses @hazeljs/core utilities: collectControllersFromModule, collectModulesFromModule, getModuleMetadata
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.coreInspector = void 0;
8
+ require("reflect-metadata");
9
+ const core_1 = require("@hazeljs/core");
10
+ const CONTROLLER_METADATA_KEY = 'hazel:controller';
11
+ const ROUTE_METADATA_KEY = 'hazel:routes';
12
+ function normalizePath(path) {
13
+ let p = path || '/';
14
+ if (!p.startsWith('/'))
15
+ p = '/' + p;
16
+ if (p !== '/' && p.endsWith('/'))
17
+ p = p.slice(0, -1);
18
+ return p;
19
+ }
20
+ function createId(prefix, ...parts) {
21
+ return [prefix, ...parts].filter(Boolean).join(':');
22
+ }
23
+ exports.coreInspector = {
24
+ name: 'core',
25
+ version: '1.0.0',
26
+ supports: () => true,
27
+ inspect: async (context) => {
28
+ const entries = [];
29
+ const { moduleType, container } = context;
30
+ // Routes from controllers
31
+ const controllersRaw = (0, core_1.collectControllersFromModule)(moduleType);
32
+ const controllers = Array.isArray(controllersRaw) ? controllersRaw : [];
33
+ for (const controller of controllers) {
34
+ const controllerMeta = Reflect.getMetadata(CONTROLLER_METADATA_KEY, controller) || {};
35
+ const controllerPath = controllerMeta.path || '';
36
+ const controllerName = controller.name || 'Unknown';
37
+ const routeMetaRaw = Reflect.getMetadata(ROUTE_METADATA_KEY, controller);
38
+ const routeMetaList = Array.isArray(routeMetaRaw) ? routeMetaRaw : [];
39
+ for (const routeMeta of routeMetaList) {
40
+ const { method, path, propertyKey } = routeMeta;
41
+ const routePath = path || '';
42
+ const fullPath = normalizePath(controllerPath + routePath);
43
+ const guardsRaw = Reflect.getMetadata('hazel:guards', controller.prototype, propertyKey) ||
44
+ Reflect.getMetadata('hazel:guards', controller) ||
45
+ [];
46
+ const interceptorsRaw = Reflect.getMetadata('hazel:interceptors', controller, propertyKey) ||
47
+ Reflect.getMetadata('hazel:class-interceptors', controller) ||
48
+ [];
49
+ const pipesRaw = Reflect.getMetadata('hazel:pipe', controller.prototype, propertyKey) || [];
50
+ const guards = Array.isArray(guardsRaw) ? guardsRaw : [];
51
+ const interceptors = Array.isArray(interceptorsRaw) ? interceptorsRaw : [];
52
+ const pipes = Array.isArray(pipesRaw) ? pipesRaw : [];
53
+ const routeEntry = {
54
+ id: createId('route', (method || 'GET').toUpperCase(), fullPath, String(propertyKey)),
55
+ kind: 'route',
56
+ packageName: '@hazeljs/core',
57
+ sourceType: 'method',
58
+ className: controllerName,
59
+ methodName: String(propertyKey),
60
+ httpMethod: (method || 'GET').toUpperCase(),
61
+ fullPath,
62
+ controllerPath: normalizePath(controllerPath),
63
+ routePath,
64
+ guards: guards.map((g) => g?.name ?? String(g)),
65
+ interceptors: interceptors.map((i) => i?.name ?? String(i)),
66
+ pipes: pipes.map((p) => p?.type?.name ?? String(p)),
67
+ };
68
+ entries.push(routeEntry);
69
+ }
70
+ }
71
+ // Modules
72
+ const modulesRaw = (0, core_1.collectModulesFromModule)(moduleType);
73
+ const modules = Array.isArray(modulesRaw) ? modulesRaw : [];
74
+ for (const { moduleType: modRef, name, isDynamic } of modules) {
75
+ const metadata = (0, core_1.getModuleMetadata)(modRef);
76
+ const moduleEntry = {
77
+ id: createId('module', name),
78
+ kind: 'module',
79
+ packageName: '@hazeljs/core',
80
+ moduleName: name,
81
+ dynamicModule: isDynamic,
82
+ imports: (metadata?.imports?.map((m) => m && typeof m === 'object' && 'module' in m
83
+ ? (m.module?.name ?? 'DynamicModule')
84
+ : (m?.name ?? 'DynamicModule')) ?? []),
85
+ providers: (metadata?.providers?.map((p) => p && typeof p === 'object' && 'provide' in p
86
+ ? String(p.provide)
87
+ : (p?.name ?? 'Unknown')) ?? []),
88
+ controllers: metadata?.controllers?.map((c) => c?.name ?? 'Unknown') ??
89
+ [],
90
+ exports: metadata?.exports?.map((e) => e?.name ?? String(e)) ?? [],
91
+ };
92
+ entries.push(moduleEntry);
93
+ }
94
+ // Providers from modules + container
95
+ const seenProviders = new Set();
96
+ for (const { moduleType: modRef, name: moduleName } of modules) {
97
+ const metadata = (0, core_1.getModuleMetadata)(modRef);
98
+ const providerList = metadata?.providers ?? modRef.providers;
99
+ if (providerList) {
100
+ for (const provider of providerList) {
101
+ if (provider &&
102
+ typeof provider === 'object' &&
103
+ ('provide' in provider || 'token' in provider)) {
104
+ const p = provider;
105
+ const token = p.token ?? p.provide;
106
+ const displayName = typeof token === 'function'
107
+ ? (token.name ?? 'Unknown')
108
+ : typeof token === 'symbol'
109
+ ? token.toString()
110
+ : String(token);
111
+ const providerName = p.useClass?.name ?? displayName;
112
+ if (!seenProviders.has(providerName)) {
113
+ seenProviders.add(providerName);
114
+ const scope = (typeof token === 'function'
115
+ ? Reflect.getMetadata('hazel:scope', token)
116
+ : undefined) ?? 'singleton';
117
+ entries.push({
118
+ id: createId('provider', providerName),
119
+ kind: 'provider',
120
+ packageName: '@hazeljs/core',
121
+ providerName,
122
+ token: providerName,
123
+ scope: scope,
124
+ moduleName,
125
+ });
126
+ }
127
+ }
128
+ else {
129
+ const cls = provider;
130
+ const name = cls?.name ?? 'Unknown';
131
+ if (!seenProviders.has(name)) {
132
+ seenProviders.add(name);
133
+ const scope = Reflect.getMetadata('hazel:scope', provider) ?? 'singleton';
134
+ entries.push({
135
+ id: createId('provider', name),
136
+ kind: 'provider',
137
+ packageName: '@hazeljs/core',
138
+ providerName: name,
139
+ token: name,
140
+ scope: scope,
141
+ moduleName,
142
+ });
143
+ }
144
+ }
145
+ }
146
+ }
147
+ }
148
+ // Container tokens - use class/function name, never String(token) which dumps full source
149
+ try {
150
+ const tokensRaw = container.getTokens?.() ?? [];
151
+ const tokens = Array.isArray(tokensRaw) ? tokensRaw : [];
152
+ for (const token of tokens) {
153
+ const displayName = typeof token === 'function'
154
+ ? token.name
155
+ : typeof token === 'symbol'
156
+ ? token.toString()
157
+ : typeof token === 'string'
158
+ ? token
159
+ : null;
160
+ if (!displayName || seenProviders.has(displayName) || displayName.includes('Object'))
161
+ continue;
162
+ seenProviders.add(displayName);
163
+ const scope = (typeof token === 'function' ? Reflect.getMetadata('hazel:scope', token) : undefined) ??
164
+ 'singleton';
165
+ entries.push({
166
+ id: createId('provider', displayName),
167
+ kind: 'provider',
168
+ packageName: '@hazeljs/core',
169
+ providerName: displayName,
170
+ token: displayName,
171
+ scope: scope,
172
+ moduleName: undefined,
173
+ });
174
+ }
175
+ }
176
+ catch {
177
+ // ignore
178
+ }
179
+ // Decorators on controllers (route decorators)
180
+ for (const controller of controllers) {
181
+ const controllerName = controller.name || 'Unknown';
182
+ const routeMetaRaw2 = Reflect.getMetadata(ROUTE_METADATA_KEY, controller);
183
+ const routeMetaList2 = Array.isArray(routeMetaRaw2) ? routeMetaRaw2 : [];
184
+ for (const routeMeta of routeMetaList2) {
185
+ const { method, propertyKey } = routeMeta;
186
+ entries.push({
187
+ id: createId('decorator', controllerName, String(propertyKey), method),
188
+ kind: 'decorator',
189
+ packageName: '@hazeljs/core',
190
+ sourceType: 'method',
191
+ className: controllerName,
192
+ methodName: String(propertyKey),
193
+ decoratorName: method?.toLowerCase() ?? 'get',
194
+ targetType: 'method',
195
+ targetClass: controllerName,
196
+ targetMethod: String(propertyKey),
197
+ rawMetadataKey: ROUTE_METADATA_KEY,
198
+ });
199
+ }
200
+ }
201
+ return entries;
202
+ },
203
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Cron inspector plugin - inspects @Cron decorated methods
3
+ * Optional: requires @hazeljs/cron to be installed
4
+ */
5
+ import 'reflect-metadata';
6
+ import type { HazelInspectorPlugin } from '../contracts/types';
7
+ export declare const cronInspector: HazelInspectorPlugin;
8
+ //# sourceMappingURL=cron.inspector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cron.inspector.d.ts","sourceRoot":"","sources":["../../src/plugins/cron.inspector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAsC,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAgCnG,eAAO,MAAM,aAAa,EAAE,oBAyC3B,CAAC"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ /**
3
+ * Cron inspector plugin - inspects @Cron decorated methods
4
+ * Optional: requires @hazeljs/cron to be installed
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.cronInspector = void 0;
8
+ require("reflect-metadata");
9
+ function createId(...parts) {
10
+ return parts.filter(Boolean).join(':');
11
+ }
12
+ function getNextRuns(cronExpression, count = 5) {
13
+ try {
14
+ const parser = require('cron-parser');
15
+ const interval = parser.parseExpression(cronExpression);
16
+ const runs = [];
17
+ for (let i = 0; i < count; i++) {
18
+ runs.push(interval.next().toDate().toISOString());
19
+ }
20
+ return runs;
21
+ }
22
+ catch {
23
+ return [];
24
+ }
25
+ }
26
+ function tryGetCronModule() {
27
+ try {
28
+ return require('@hazeljs/cron');
29
+ }
30
+ catch {
31
+ return null;
32
+ }
33
+ }
34
+ exports.cronInspector = {
35
+ name: 'cron',
36
+ version: '1.0.0',
37
+ supports: (_context) => {
38
+ return tryGetCronModule() !== null;
39
+ },
40
+ inspect: async (_context) => {
41
+ const cronMod = tryGetCronModule();
42
+ if (!cronMod)
43
+ return [];
44
+ const entries = [];
45
+ const tokensRaw = _context.container.getTokens?.() ?? [];
46
+ const tokens = Array.isArray(tokensRaw) ? tokensRaw : [];
47
+ for (const token of tokens) {
48
+ if (typeof token !== 'function')
49
+ continue;
50
+ const jobsRaw = cronMod.getCronMetadata(token.prototype ?? token);
51
+ const jobs = Array.isArray(jobsRaw) ? jobsRaw : [];
52
+ if (!jobs.length)
53
+ continue;
54
+ const className = token.name ?? 'Unknown';
55
+ for (const job of jobs) {
56
+ const opts = job.options || {};
57
+ const nextRuns = opts.cronTime ? getNextRuns(opts.cronTime) : [];
58
+ entries.push({
59
+ id: createId('cron', opts.name ?? `${className}.${job.methodName}`),
60
+ kind: 'cron',
61
+ packageName: '@hazeljs/cron',
62
+ sourceType: 'method',
63
+ className,
64
+ methodName: job.methodName,
65
+ jobName: opts.name ?? `${className}.${job.methodName}`,
66
+ cronExpression: opts.cronTime,
67
+ enabled: opts.enabled !== false,
68
+ nextRuns: nextRuns.length ? nextRuns : undefined,
69
+ });
70
+ }
71
+ }
72
+ return entries;
73
+ },
74
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Data pipeline inspector plugin - inspects @Pipeline
3
+ * Optional: requires @hazeljs/data to be installed
4
+ */
5
+ import 'reflect-metadata';
6
+ import type { HazelInspectorPlugin } from '../contracts/types';
7
+ export declare const dataInspector: HazelInspectorPlugin;
8
+ //# sourceMappingURL=data.inspector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.inspector.d.ts","sourceRoot":"","sources":["../../src/plugins/data.inspector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAmB5B,eAAO,MAAM,aAAa,EAAE,oBA+B3B,CAAC"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ /**
3
+ * Data pipeline inspector plugin - inspects @Pipeline
4
+ * Optional: requires @hazeljs/data to be installed
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.dataInspector = void 0;
8
+ require("reflect-metadata");
9
+ const _PIPELINE_METADATA_KEY = 'hazel:data:pipeline';
10
+ function createId(...parts) {
11
+ return parts.filter(Boolean).join(':');
12
+ }
13
+ function tryGetDataModule() {
14
+ try {
15
+ return require('@hazeljs/data');
16
+ }
17
+ catch {
18
+ return null;
19
+ }
20
+ }
21
+ exports.dataInspector = {
22
+ name: 'data',
23
+ version: '1.0.0',
24
+ supports: () => tryGetDataModule() !== null,
25
+ inspect: async (context) => {
26
+ const dataMod = tryGetDataModule();
27
+ if (!dataMod)
28
+ return [];
29
+ const entries = [];
30
+ const tokens = context.container.getTokens?.() ?? [];
31
+ for (const token of tokens) {
32
+ if (typeof token !== 'function')
33
+ continue;
34
+ if (!dataMod.hasPipelineMetadata(token))
35
+ continue;
36
+ const meta = dataMod.getPipelineMetadata(token);
37
+ const className = token.name ?? 'Unknown';
38
+ const pipelineName = meta?.name ?? className;
39
+ entries.push({
40
+ id: createId('data', pipelineName),
41
+ kind: 'data',
42
+ packageName: '@hazeljs/data',
43
+ sourceType: 'class',
44
+ className,
45
+ pipelineName,
46
+ });
47
+ }
48
+ return entries;
49
+ },
50
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Event emitter inspector plugin - inspects @OnEvent listeners
3
+ * Optional: requires @hazeljs/event-emitter to be installed
4
+ */
5
+ import 'reflect-metadata';
6
+ import type { HazelInspectorPlugin } from '../contracts/types';
7
+ export declare const eventEmitterInspector: HazelInspectorPlugin;
8
+ //# sourceMappingURL=event-emitter.inspector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-emitter.inspector.d.ts","sourceRoot":"","sources":["../../src/plugins/event-emitter.inspector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAuC,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAkBpG,eAAO,MAAM,qBAAqB,EAAE,oBAkCnC,CAAC"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /**
3
+ * Event emitter inspector plugin - inspects @OnEvent listeners
4
+ * Optional: requires @hazeljs/event-emitter to be installed
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.eventEmitterInspector = void 0;
8
+ require("reflect-metadata");
9
+ function createId(...parts) {
10
+ return parts.filter(Boolean).join(':');
11
+ }
12
+ function tryGetEventEmitterModule() {
13
+ try {
14
+ return require('@hazeljs/event-emitter');
15
+ }
16
+ catch {
17
+ return null;
18
+ }
19
+ }
20
+ exports.eventEmitterInspector = {
21
+ name: 'event-emitter',
22
+ version: '1.0.0',
23
+ supports: () => tryGetEventEmitterModule() !== null,
24
+ inspect: async (context) => {
25
+ const eeMod = tryGetEventEmitterModule();
26
+ if (!eeMod)
27
+ return [];
28
+ const entries = [];
29
+ const tokens = context.container.getTokens?.() ?? [];
30
+ for (const token of tokens) {
31
+ if (typeof token !== 'function')
32
+ continue;
33
+ const target = token.prototype ?? token;
34
+ const listeners = eeMod.getOnEventMetadata(target);
35
+ if (!listeners?.length)
36
+ continue;
37
+ const className = token.name ?? 'Unknown';
38
+ for (const l of listeners) {
39
+ const eventStr = Array.isArray(l.event) ? l.event.join(', ') : String(l.event);
40
+ entries.push({
41
+ id: createId('event', className, l.methodName, eventStr),
42
+ kind: 'event',
43
+ packageName: '@hazeljs/event-emitter',
44
+ sourceType: 'method',
45
+ className,
46
+ methodName: l.methodName,
47
+ eventName: eventStr,
48
+ });
49
+ }
50
+ }
51
+ return entries;
52
+ },
53
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Flow inspector plugin - inspects @Flow definitions with @Node
3
+ * Optional: requires @hazeljs/flow to be installed
4
+ */
5
+ import 'reflect-metadata';
6
+ import type { HazelInspectorPlugin } from '../contracts/types';
7
+ export declare const flowInspector: HazelInspectorPlugin;
8
+ //# sourceMappingURL=flow.inspector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow.inspector.d.ts","sourceRoot":"","sources":["../../src/plugins/flow.inspector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAsC,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAoBnG,eAAO,MAAM,aAAa,EAAE,oBAiG3B,CAAC"}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ /**
3
+ * Flow inspector plugin - inspects @Flow definitions with @Node
4
+ * Optional: requires @hazeljs/flow to be installed
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.flowInspector = void 0;
8
+ require("reflect-metadata");
9
+ function createId(...parts) {
10
+ return parts.filter(Boolean).join(':');
11
+ }
12
+ const FLOW_METADATA_KEY = 'flow:definition';
13
+ const NODE_METADATA_KEY = 'flow:nodes';
14
+ const EDGE_METADATA_KEY = 'flow:edges';
15
+ const ENTRY_METADATA_KEY = 'flow:entry';
16
+ function tryGetFlowModule() {
17
+ try {
18
+ require.resolve('@hazeljs/flow');
19
+ return true;
20
+ }
21
+ catch {
22
+ return false;
23
+ }
24
+ }
25
+ exports.flowInspector = {
26
+ name: 'flow',
27
+ version: '1.0.0',
28
+ supports: () => tryGetFlowModule(),
29
+ inspect: async (context) => {
30
+ if (!tryGetFlowModule())
31
+ return [];
32
+ const entries = [];
33
+ const tokensRaw = context.container.getTokens?.() ?? [];
34
+ const tokens = Array.isArray(tokensRaw) ? tokensRaw : [];
35
+ for (const token of tokens) {
36
+ if (typeof token !== 'function')
37
+ continue;
38
+ const flowMeta = Reflect.getMetadata(FLOW_METADATA_KEY, token);
39
+ if (!flowMeta)
40
+ continue;
41
+ const className = token.name ?? 'Unknown';
42
+ const flowId = flowMeta.flowId ?? className;
43
+ const version = flowMeta.version;
44
+ const proto = token.prototype;
45
+ let entryNodeId = null;
46
+ const allEdges = [];
47
+ const nodeIds = [];
48
+ if (proto) {
49
+ const methodNames = Object.getOwnPropertyNames(proto).filter((n) => n !== 'constructor' && typeof proto[n] === 'function');
50
+ for (const methodName of methodNames) {
51
+ const nodeMeta = Reflect.getMetadata(NODE_METADATA_KEY, proto, methodName);
52
+ if (nodeMeta) {
53
+ const nodeId = nodeMeta.id ?? methodName;
54
+ nodeIds.push(nodeId);
55
+ if (Reflect.getMetadata(ENTRY_METADATA_KEY, proto, methodName)) {
56
+ entryNodeId = nodeId;
57
+ }
58
+ const nodeEdgesRaw = Reflect.getMetadata(EDGE_METADATA_KEY, proto, methodName);
59
+ const nodeEdges = Array.isArray(nodeEdgesRaw) ? nodeEdgesRaw : [];
60
+ for (const e of nodeEdges) {
61
+ allEdges.push(`${e.from}→${e.to}`);
62
+ }
63
+ }
64
+ }
65
+ }
66
+ // Flow definition entry (one per @Flow class)
67
+ entries.push({
68
+ id: createId('flow', flowId, version ?? ''),
69
+ kind: 'flow',
70
+ packageName: '@hazeljs/flow',
71
+ sourceType: 'class',
72
+ className,
73
+ flowId,
74
+ version,
75
+ nodeName: entryNodeId ?? undefined,
76
+ entryNode: entryNodeId ?? undefined,
77
+ nodes: nodeIds.join(', '),
78
+ edges: allEdges.join('; ') || undefined,
79
+ });
80
+ // Node entries (one per @Node method)
81
+ if (proto) {
82
+ const methodNames = Object.getOwnPropertyNames(proto).filter((n) => n !== 'constructor' && typeof proto[n] === 'function');
83
+ for (const methodName of methodNames) {
84
+ const nodeMeta = Reflect.getMetadata(NODE_METADATA_KEY, proto, methodName);
85
+ if (nodeMeta) {
86
+ const nodeId = nodeMeta.id ?? methodName;
87
+ const nodeEdgesRaw = Reflect.getMetadata(EDGE_METADATA_KEY, proto, methodName);
88
+ const nodeEdges = Array.isArray(nodeEdgesRaw) ? nodeEdgesRaw : [];
89
+ const edgesStr = nodeEdges
90
+ .map((e) => `${e.from}→${e.to}`)
91
+ .join(', ');
92
+ const isEntry = Reflect.getMetadata(ENTRY_METADATA_KEY, proto, methodName);
93
+ entries.push({
94
+ id: createId('flow', flowId, 'node', nodeId),
95
+ kind: 'flow',
96
+ packageName: '@hazeljs/flow',
97
+ sourceType: 'method',
98
+ className,
99
+ methodName,
100
+ flowId,
101
+ version,
102
+ nodeName: nodeId,
103
+ entryNode: isEntry ? nodeId : undefined,
104
+ edges: edgesStr || undefined,
105
+ });
106
+ }
107
+ }
108
+ }
109
+ }
110
+ return entries;
111
+ },
112
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * GraphQL inspector plugin - inspects @Resolver with @Query/@Mutation
3
+ * Optional: requires @hazeljs/graphql to be installed
4
+ */
5
+ import 'reflect-metadata';
6
+ import type { HazelInspectorPlugin } from '../contracts/types';
7
+ export declare const graphqlInspector: HazelInspectorPlugin;
8
+ //# sourceMappingURL=graphql.inspector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql.inspector.d.ts","sourceRoot":"","sources":["../../src/plugins/graphql.inspector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAmB5B,eAAO,MAAM,gBAAgB,EAAE,oBAyD9B,CAAC"}