@pikku/inspector 0.9.5 → 0.10.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/CHANGELOG.md +14 -0
- package/dist/add/add-channel.d.ts +17 -0
- package/dist/{add-channel.js → add/add-channel.js} +60 -34
- package/dist/add/add-cli.d.ts +9 -0
- package/dist/add/add-cli.js +566 -0
- package/dist/{add-file-extends-core-type.d.ts → add/add-file-extends-core-type.d.ts} +2 -2
- package/dist/{add-file-extends-core-type.js → add/add-file-extends-core-type.js} +17 -4
- package/dist/{add-file-with-config.d.ts → add/add-file-with-config.d.ts} +1 -1
- package/dist/{add-file-with-config.js → add/add-file-with-config.js} +1 -1
- package/dist/{add-file-with-factory.d.ts → add/add-file-with-factory.d.ts} +2 -2
- package/dist/{add-file-with-factory.js → add/add-file-with-factory.js} +38 -5
- package/dist/add/add-functions.d.ts +6 -0
- package/dist/{add-functions.js → add/add-functions.js} +77 -10
- package/dist/{add-http-route.d.ts → add/add-http-route.d.ts} +2 -3
- package/dist/{add-http-route.js → add/add-http-route.js} +26 -13
- package/dist/add/add-mcp-prompt.d.ts +2 -0
- package/dist/add/add-mcp-prompt.js +74 -0
- package/dist/add/add-mcp-resource.d.ts +2 -0
- package/dist/add/add-mcp-resource.js +84 -0
- package/dist/add/add-mcp-tool.d.ts +2 -0
- package/dist/add/add-mcp-tool.js +80 -0
- package/dist/add/add-middleware.d.ts +5 -0
- package/dist/add/add-middleware.js +290 -0
- package/dist/add/add-permission.d.ts +5 -0
- package/dist/add/add-permission.js +292 -0
- package/dist/add/add-queue-worker.d.ts +2 -0
- package/dist/add/add-queue-worker.js +52 -0
- package/dist/{add-rpc-invocations.d.ts → add/add-rpc-invocations.d.ts} +1 -1
- package/dist/add/add-schedule.d.ts +2 -0
- package/dist/{add-schedule.js → add/add-schedule.js} +16 -11
- package/dist/error-codes.d.ts +35 -0
- package/dist/error-codes.js +40 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4 -0
- package/dist/inspector.d.ts +2 -3
- package/dist/inspector.js +38 -8
- package/dist/types.d.ts +108 -1
- package/dist/utils/ensure-function-metadata.d.ts +6 -0
- package/dist/utils/ensure-function-metadata.js +18 -0
- package/dist/utils/extract-function-name.d.ts +31 -0
- package/dist/{utils.js → utils/extract-function-name.js} +35 -149
- package/dist/utils/extract-services.d.ts +6 -0
- package/dist/utils/extract-services.js +29 -0
- package/dist/utils/filter-inspector-state.d.ts +6 -0
- package/dist/utils/filter-inspector-state.js +382 -0
- package/dist/utils/filter-utils.d.ts +19 -0
- package/dist/utils/filter-utils.js +109 -0
- package/dist/utils/find-root-dir.d.ts +23 -0
- package/dist/utils/find-root-dir.js +55 -0
- package/dist/utils/get-files-and-methods.d.ts +22 -0
- package/dist/utils/get-files-and-methods.js +61 -0
- package/dist/utils/get-property-value.d.ts +12 -0
- package/dist/{get-property-value.js → utils/get-property-value.js} +20 -0
- package/dist/utils/middleware.d.ts +39 -0
- package/dist/utils/middleware.js +157 -0
- package/dist/utils/permissions.d.ts +43 -0
- package/dist/utils/permissions.js +178 -0
- package/dist/utils/post-process.d.ts +16 -0
- package/dist/utils/post-process.js +132 -0
- package/dist/utils/serialize-inspector-state.d.ts +179 -0
- package/dist/utils/serialize-inspector-state.js +170 -0
- package/dist/utils/type-utils.d.ts +3 -0
- package/dist/utils/type-utils.js +50 -0
- package/dist/visit.d.ts +3 -3
- package/dist/visit.js +35 -31
- package/package.json +5 -6
- package/src/{add-channel.ts → add/add-channel.ts} +108 -56
- package/src/add/add-cli.ts +822 -0
- package/src/{add-file-extends-core-type.ts → add/add-file-extends-core-type.ts} +23 -5
- package/src/{add-file-with-config.ts → add/add-file-with-config.ts} +2 -2
- package/src/{add-file-with-factory.ts → add/add-file-with-factory.ts} +49 -6
- package/src/{add-functions.ts → add/add-functions.ts} +89 -19
- package/src/{add-http-route.ts → add/add-http-route.ts} +66 -32
- package/src/add/add-mcp-prompt.ts +128 -0
- package/src/add/add-mcp-prompt.ts.tmp +0 -0
- package/src/add/add-mcp-resource.ts +145 -0
- package/src/add/add-mcp-resource.ts.tmp +0 -0
- package/src/add/add-mcp-tool.ts +137 -0
- package/src/add/add-middleware.ts +385 -0
- package/src/add/add-permission.ts +391 -0
- package/src/add/add-queue-worker.ts +92 -0
- package/src/{add-rpc-invocations.ts → add/add-rpc-invocations.ts} +1 -1
- package/src/{add-schedule.ts → add/add-schedule.ts} +30 -28
- package/src/error-codes.ts +43 -0
- package/src/index.ts +12 -0
- package/src/inspector.ts +41 -17
- package/src/types.ts +128 -1
- package/src/utils/ensure-function-metadata.ts +24 -0
- package/src/{utils.ts → utils/extract-function-name.ts} +44 -206
- package/src/utils/extract-services.ts +35 -0
- package/src/utils/filter-inspector-state.test.ts +1433 -0
- package/src/utils/filter-inspector-state.ts +526 -0
- package/src/{utils.test.ts → utils/filter-utils.test.ts} +351 -2
- package/src/utils/filter-utils.ts +152 -0
- package/src/utils/find-root-dir.ts +68 -0
- package/src/utils/get-files-and-methods.ts +151 -0
- package/src/{get-property-value.ts → utils/get-property-value.ts} +27 -0
- package/src/utils/middleware.ts +241 -0
- package/src/utils/permissions.test.ts +327 -0
- package/src/utils/permissions.ts +262 -0
- package/src/utils/post-process.ts +178 -0
- package/src/utils/serialize-inspector-state.ts +375 -0
- package/src/utils/test-data/inspector-state.json +1680 -0
- package/src/utils/type-utils.ts +74 -0
- package/src/visit.ts +50 -34
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/add-channel.d.ts +0 -13
- package/dist/add-functions.d.ts +0 -7
- package/dist/add-mcp-prompt.d.ts +0 -3
- package/dist/add-mcp-prompt.js +0 -61
- package/dist/add-mcp-resource.d.ts +0 -3
- package/dist/add-mcp-resource.js +0 -68
- package/dist/add-mcp-tool.d.ts +0 -3
- package/dist/add-mcp-tool.js +0 -64
- package/dist/add-middleware.d.ts +0 -7
- package/dist/add-middleware.js +0 -35
- package/dist/add-permission.d.ts +0 -7
- package/dist/add-permission.js +0 -35
- package/dist/add-queue-worker.d.ts +0 -3
- package/dist/add-queue-worker.js +0 -48
- package/dist/add-schedule.d.ts +0 -3
- package/dist/get-property-value.d.ts +0 -3
- package/dist/utils.d.ts +0 -39
- package/src/add-mcp-prompt.ts +0 -104
- package/src/add-mcp-resource.ts +0 -116
- package/src/add-mcp-tool.ts +0 -107
- package/src/add-middleware.ts +0 -51
- package/src/add-permission.ts +0 -53
- package/src/add-queue-worker.ts +0 -92
- /package/dist/{add-rpc-invocations.js → add/add-rpc-invocations.js} +0 -0
- /package/dist/{does-type-extend-core-type.d.ts → utils/does-type-extend-core-type.d.ts} +0 -0
- /package/dist/{does-type-extend-core-type.js → utils/does-type-extend-core-type.js} +0 -0
- /package/src/{does-type-extend-core-type.ts → utils/does-type-extend-core-type.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @pikku/inspector
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
This release includes significant improvements across the framework including tree-shaking support, middleware/permission factories, enhanced CLI functionality, improved TypeScript type safety, and comprehensive test strategies.
|
|
6
|
+
|
|
7
|
+
For complete details, see https://pikku.dev/changelogs/0_10_0.md
|
|
8
|
+
|
|
9
|
+
## 0.9.6-next.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- feat: running @pikku/cli using pikku
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @pikku/core@0.9.12-next.0
|
|
16
|
+
|
|
3
17
|
## 0.9.5
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
import { ErrorCode } from '../error-codes.js';
|
|
3
|
+
import type { ChannelMeta } from '@pikku/core/channel';
|
|
4
|
+
import type { InspectorState, AddWiring } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Build out the nested message-routes by looking up each handler
|
|
7
|
+
* in state.functions.meta instead of re-inferring it here.
|
|
8
|
+
*/
|
|
9
|
+
export declare function addMessagesRoutes(logger: {
|
|
10
|
+
error: (msg: string) => void;
|
|
11
|
+
critical: (code: ErrorCode, msg: string) => void;
|
|
12
|
+
}, obj: ts.ObjectLiteralExpression, state: InspectorState, checker: ts.TypeChecker): ChannelMeta['messageWirings'];
|
|
13
|
+
/**
|
|
14
|
+
* Inspect addChannel calls, look up all handlers in state.functions.meta,
|
|
15
|
+
* and emit one entry into state.channels.meta.
|
|
16
|
+
*/
|
|
17
|
+
export declare const addChannel: AddWiring;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
|
-
import {
|
|
2
|
+
import { ErrorCode } from '../error-codes.js';
|
|
3
|
+
import { getPropertyValue, getPropertyTags, } from '../utils/get-property-value.js';
|
|
3
4
|
import { pathToRegexp } from 'path-to-regexp';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
5
|
+
import { extractFunctionName } from '../utils/extract-function-name.js';
|
|
6
|
+
import { getPropertyAssignmentInitializer } from '../utils/type-utils.js';
|
|
7
|
+
import { resolveMiddleware } from '../utils/middleware.js';
|
|
8
|
+
import { extractWireNames } from '../utils/post-process.js';
|
|
6
9
|
/**
|
|
7
|
-
* Safely get the
|
|
10
|
+
* Safely get the "initializer" expression of a property-like AST node:
|
|
8
11
|
* - for `foo: expr`, returns `expr`
|
|
9
12
|
* - for `{ foo }` shorthand, returns the identifier `foo`
|
|
10
13
|
* - otherwise, returns undefined
|
|
@@ -22,7 +25,7 @@ function getInitializerOf(elem) {
|
|
|
22
25
|
* Resolve a handler expression (Identifier, CallExpression, or { func })
|
|
23
26
|
* into its underlying function name.
|
|
24
27
|
*/
|
|
25
|
-
function getHandlerNameFromExpression(expr, checker) {
|
|
28
|
+
function getHandlerNameFromExpression(expr, checker, rootDir) {
|
|
26
29
|
// Handle direct identifier case (which includes shorthand properties)
|
|
27
30
|
if (ts.isIdentifier(expr)) {
|
|
28
31
|
const sym = checker.getSymbolAtLocation(expr);
|
|
@@ -41,31 +44,31 @@ function getHandlerNameFromExpression(expr, checker) {
|
|
|
41
44
|
ts.isArrowFunction(decl.initializer) ||
|
|
42
45
|
ts.isFunctionExpression(decl.initializer)) {
|
|
43
46
|
// Extract function name from the declaration's initializer
|
|
44
|
-
const { pikkuFuncName } = extractFunctionName(decl.initializer, checker);
|
|
47
|
+
const { pikkuFuncName } = extractFunctionName(decl.initializer, checker, rootDir);
|
|
45
48
|
return pikkuFuncName;
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
51
|
// For function declarations, use directly
|
|
49
52
|
else if (ts.isFunctionDeclaration(decl)) {
|
|
50
|
-
const { pikkuFuncName } = extractFunctionName(decl, checker);
|
|
53
|
+
const { pikkuFuncName } = extractFunctionName(decl, checker, rootDir);
|
|
51
54
|
return pikkuFuncName;
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
// Fallback: try to extract directly from the identifier
|
|
56
|
-
const { pikkuFuncName } = extractFunctionName(expr, checker);
|
|
59
|
+
const { pikkuFuncName } = extractFunctionName(expr, checker, rootDir);
|
|
57
60
|
return pikkuFuncName;
|
|
58
61
|
}
|
|
59
62
|
// Handle call expressions
|
|
60
63
|
if (ts.isCallExpression(expr)) {
|
|
61
|
-
const { pikkuFuncName } = extractFunctionName(expr, checker);
|
|
64
|
+
const { pikkuFuncName } = extractFunctionName(expr, checker, rootDir);
|
|
62
65
|
return pikkuFuncName;
|
|
63
66
|
}
|
|
64
67
|
// Handle object literals with 'func' property
|
|
65
68
|
if (ts.isObjectLiteralExpression(expr)) {
|
|
66
69
|
const fnProp = getPropertyAssignmentInitializer(expr, 'func', true, checker);
|
|
67
70
|
if (fnProp) {
|
|
68
|
-
return getHandlerNameFromExpression(fnProp, checker);
|
|
71
|
+
return getHandlerNameFromExpression(fnProp, checker, rootDir);
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
74
|
return null;
|
|
@@ -74,7 +77,7 @@ function getHandlerNameFromExpression(expr, checker) {
|
|
|
74
77
|
* Build out the nested message-routes by looking up each handler
|
|
75
78
|
* in state.functions.meta instead of re-inferring it here.
|
|
76
79
|
*/
|
|
77
|
-
export function addMessagesRoutes(obj, state, checker) {
|
|
80
|
+
export function addMessagesRoutes(logger, obj, state, checker) {
|
|
78
81
|
const result = {};
|
|
79
82
|
const onMsgRouteProp = getPropertyAssignmentInitializer(obj, 'onMessageWiring', true, checker);
|
|
80
83
|
if (!onMsgRouteProp)
|
|
@@ -125,7 +128,7 @@ export function addMessagesRoutes(obj, state, checker) {
|
|
|
125
128
|
if (ts.isArrowFunction(importDecl.initializer) ||
|
|
126
129
|
ts.isFunctionExpression(importDecl.initializer) ||
|
|
127
130
|
ts.isCallExpression(importDecl.initializer)) {
|
|
128
|
-
const { pikkuFuncName } = extractFunctionName(importDecl.initializer, checker);
|
|
131
|
+
const { pikkuFuncName } = extractFunctionName(importDecl.initializer, checker, state.rootDir);
|
|
129
132
|
const handlerName = pikkuFuncName;
|
|
130
133
|
// Look up in the registry
|
|
131
134
|
const fnMeta = state.functions.meta[handlerName];
|
|
@@ -139,7 +142,7 @@ export function addMessagesRoutes(obj, state, checker) {
|
|
|
139
142
|
}
|
|
140
143
|
else if (ts.isFunctionDeclaration(importDecl)) {
|
|
141
144
|
// Extract from the function declaration
|
|
142
|
-
const { pikkuFuncName } = extractFunctionName(importDecl, checker);
|
|
145
|
+
const { pikkuFuncName } = extractFunctionName(importDecl, checker, state.rootDir);
|
|
143
146
|
const handlerName = pikkuFuncName;
|
|
144
147
|
// Look up in the registry
|
|
145
148
|
const fnMeta = state.functions.meta[handlerName];
|
|
@@ -165,7 +168,7 @@ export function addMessagesRoutes(obj, state, checker) {
|
|
|
165
168
|
const exportDecl = exportDecls[0];
|
|
166
169
|
if (ts.isVariableDeclaration(exportDecl) &&
|
|
167
170
|
exportDecl.initializer) {
|
|
168
|
-
const { pikkuFuncName } = extractFunctionName(exportDecl.initializer, checker);
|
|
171
|
+
const { pikkuFuncName } = extractFunctionName(exportDecl.initializer, checker, state.rootDir);
|
|
169
172
|
const handlerName = pikkuFuncName;
|
|
170
173
|
const fnMeta = state.functions.meta[handlerName];
|
|
171
174
|
if (fnMeta) {
|
|
@@ -176,7 +179,7 @@ export function addMessagesRoutes(obj, state, checker) {
|
|
|
176
179
|
}
|
|
177
180
|
}
|
|
178
181
|
else if (ts.isFunctionDeclaration(exportDecl)) {
|
|
179
|
-
const { pikkuFuncName } = extractFunctionName(exportDecl, checker);
|
|
182
|
+
const { pikkuFuncName } = extractFunctionName(exportDecl, checker, state.rootDir);
|
|
180
183
|
const handlerName = pikkuFuncName;
|
|
181
184
|
const fnMeta = state.functions.meta[handlerName];
|
|
182
185
|
if (fnMeta) {
|
|
@@ -202,7 +205,7 @@ export function addMessagesRoutes(obj, state, checker) {
|
|
|
202
205
|
if (possibleMatch) {
|
|
203
206
|
const fnMeta = state.functions.meta[possibleMatch];
|
|
204
207
|
if (!fnMeta) {
|
|
205
|
-
|
|
208
|
+
logger.critical(ErrorCode.FUNCTION_METADATA_NOT_FOUND, `No function metadata found for handler '${possibleMatch}'`);
|
|
206
209
|
continue;
|
|
207
210
|
}
|
|
208
211
|
result[channelKey][routeKey] = {
|
|
@@ -231,7 +234,7 @@ export function addMessagesRoutes(obj, state, checker) {
|
|
|
231
234
|
// If we found the actual function, extract its name
|
|
232
235
|
if (actualFunction) {
|
|
233
236
|
// Extract the function name directly from the actual function
|
|
234
|
-
const { pikkuFuncName } = extractFunctionName(actualFunction, checker);
|
|
237
|
+
const { pikkuFuncName } = extractFunctionName(actualFunction, checker, state.rootDir);
|
|
235
238
|
const handlerName = pikkuFuncName;
|
|
236
239
|
// Now use this handlerName to look up in the registry
|
|
237
240
|
const fnMeta = state.functions.meta[handlerName];
|
|
@@ -246,14 +249,14 @@ export function addMessagesRoutes(obj, state, checker) {
|
|
|
246
249
|
}
|
|
247
250
|
}
|
|
248
251
|
// Normal processing for non-shorthand properties
|
|
249
|
-
const handlerName = getHandlerNameFromExpression(init, checker);
|
|
252
|
+
const handlerName = getHandlerNameFromExpression(init, checker, state.rootDir);
|
|
250
253
|
if (!handlerName) {
|
|
251
|
-
|
|
254
|
+
logger.error(`Could not resolve handler for message route '${routeKey}'`);
|
|
252
255
|
continue;
|
|
253
256
|
}
|
|
254
257
|
const fnMeta = state.functions.meta[handlerName];
|
|
255
258
|
if (!fnMeta) {
|
|
256
|
-
|
|
259
|
+
logger.critical(ErrorCode.FUNCTION_METADATA_NOT_FOUND, `No function metadata found for handler '${handlerName}'`);
|
|
257
260
|
continue;
|
|
258
261
|
}
|
|
259
262
|
result[channelKey][routeKey] = {
|
|
@@ -267,7 +270,7 @@ export function addMessagesRoutes(obj, state, checker) {
|
|
|
267
270
|
* Inspect addChannel calls, look up all handlers in state.functions.meta,
|
|
268
271
|
* and emit one entry into state.channels.meta.
|
|
269
272
|
*/
|
|
270
|
-
export
|
|
273
|
+
export const addChannel = (logger, node, checker, state, options) => {
|
|
271
274
|
if (!ts.isCallExpression(node))
|
|
272
275
|
return;
|
|
273
276
|
const { expression, arguments: args } = node;
|
|
@@ -280,7 +283,7 @@ export function addChannel(node, checker, state, filters, logger) {
|
|
|
280
283
|
const name = getPropertyValue(obj, 'name');
|
|
281
284
|
const route = getPropertyValue(obj, 'route') ?? '';
|
|
282
285
|
if (!name) {
|
|
283
|
-
|
|
286
|
+
logger.critical(ErrorCode.MISSING_CHANNEL_NAME, 'Channel name is required');
|
|
284
287
|
return;
|
|
285
288
|
}
|
|
286
289
|
// path parameters
|
|
@@ -290,18 +293,16 @@ export function addChannel(node, checker, state, filters, logger) {
|
|
|
290
293
|
.map((k) => k.name)
|
|
291
294
|
: [];
|
|
292
295
|
const docs = getPropertyValue(obj, 'docs');
|
|
293
|
-
const tags =
|
|
296
|
+
const tags = getPropertyTags(obj, 'Channel', route, logger);
|
|
294
297
|
const query = getPropertyValue(obj, 'query');
|
|
295
|
-
const filePath = node.getSourceFile().fileName;
|
|
296
|
-
if (!matchesFilters(filters, { tags }, { type: PikkuWiringTypes.channel, name, filePath }, logger))
|
|
297
|
-
return;
|
|
298
298
|
const connect = getPropertyAssignmentInitializer(obj, 'onConnect', false, checker);
|
|
299
299
|
const disconnect = getPropertyAssignmentInitializer(obj, 'onDisconnect', false, checker);
|
|
300
300
|
// default onMessage handler
|
|
301
301
|
let message = null;
|
|
302
302
|
const onMsgProp = getPropertyAssignmentInitializer(obj, 'onMessage', false, checker);
|
|
303
303
|
if (onMsgProp) {
|
|
304
|
-
const handlerName = onMsgProp &&
|
|
304
|
+
const handlerName = onMsgProp &&
|
|
305
|
+
getHandlerNameFromExpression(onMsgProp, checker, state.rootDir);
|
|
305
306
|
const fnMeta = handlerName && state.functions.meta[handlerName];
|
|
306
307
|
if (!fnMeta) {
|
|
307
308
|
console.error(`No function metadata for onMessage handler '${handlerName}'`);
|
|
@@ -309,13 +310,35 @@ export function addChannel(node, checker, state, filters, logger) {
|
|
|
309
310
|
}
|
|
310
311
|
else {
|
|
311
312
|
message = {
|
|
312
|
-
pikkuFuncName: extractFunctionName(onMsgProp, checker)
|
|
313
|
-
.pikkuFuncName,
|
|
313
|
+
pikkuFuncName: extractFunctionName(onMsgProp, checker, state.rootDir).pikkuFuncName,
|
|
314
314
|
};
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
// nested message-routes
|
|
318
|
-
const messageWirings = addMessagesRoutes(obj, state, checker);
|
|
318
|
+
const messageWirings = addMessagesRoutes(logger, obj, state, checker);
|
|
319
|
+
// --- resolve middleware ---
|
|
320
|
+
const middleware = resolveMiddleware(state, obj, tags, checker);
|
|
321
|
+
// --- track used functions/middleware for service aggregation ---
|
|
322
|
+
// Track connect/disconnect/message handlers
|
|
323
|
+
if (connect) {
|
|
324
|
+
const connectFuncName = extractFunctionName(connect, checker, state.rootDir).pikkuFuncName;
|
|
325
|
+
state.serviceAggregation.usedFunctions.add(connectFuncName);
|
|
326
|
+
}
|
|
327
|
+
if (disconnect) {
|
|
328
|
+
const disconnectFuncName = extractFunctionName(disconnect, checker, state.rootDir).pikkuFuncName;
|
|
329
|
+
state.serviceAggregation.usedFunctions.add(disconnectFuncName);
|
|
330
|
+
}
|
|
331
|
+
if (message) {
|
|
332
|
+
state.serviceAggregation.usedFunctions.add(message.pikkuFuncName);
|
|
333
|
+
}
|
|
334
|
+
// Track message wiring handlers
|
|
335
|
+
for (const channelHandlers of Object.values(messageWirings)) {
|
|
336
|
+
for (const handler of Object.values(channelHandlers)) {
|
|
337
|
+
state.serviceAggregation.usedFunctions.add(handler.pikkuFuncName);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
// Track middleware
|
|
341
|
+
extractWireNames(middleware).forEach((name) => state.serviceAggregation.usedMiddleware.add(name));
|
|
319
342
|
// record into state
|
|
320
343
|
state.channels.files.add(node.getSourceFile().fileName);
|
|
321
344
|
state.channels.meta[name] = {
|
|
@@ -332,17 +355,20 @@ export function addChannel(node, checker, state, filters, logger) {
|
|
|
332
355
|
// params
|
|
333
356
|
// ),
|
|
334
357
|
connect: connect
|
|
335
|
-
? {
|
|
358
|
+
? {
|
|
359
|
+
pikkuFuncName: extractFunctionName(connect, checker, state.rootDir)
|
|
360
|
+
.pikkuFuncName,
|
|
361
|
+
}
|
|
336
362
|
: null,
|
|
337
363
|
disconnect: disconnect
|
|
338
364
|
? {
|
|
339
|
-
pikkuFuncName: extractFunctionName(disconnect, checker)
|
|
340
|
-
.pikkuFuncName,
|
|
365
|
+
pikkuFuncName: extractFunctionName(disconnect, checker, state.rootDir).pikkuFuncName,
|
|
341
366
|
}
|
|
342
367
|
: null,
|
|
343
368
|
message,
|
|
344
369
|
messageWirings,
|
|
345
370
|
docs: docs ?? undefined,
|
|
346
371
|
tags: tags ?? undefined,
|
|
372
|
+
middleware,
|
|
347
373
|
};
|
|
348
|
-
}
|
|
374
|
+
};
|