@pikku/inspector 0.8.1 → 0.9.1
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-channel.d.ts +1 -1
- package/dist/add-channel.js +6 -6
- package/dist/add-file-extends-core-type.js +0 -1
- package/dist/add-http-route.d.ts +1 -1
- package/dist/add-http-route.js +4 -4
- package/dist/add-mcp-prompt.js +4 -4
- package/dist/add-mcp-resource.js +4 -4
- package/dist/add-mcp-tool.js +4 -4
- package/dist/add-queue-worker.js +3 -3
- package/dist/add-schedule.js +3 -3
- package/dist/types.d.ts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/src/add-channel.ts +8 -8
- package/src/add-file-extends-core-type.ts +0 -2
- package/src/add-http-route.ts +4 -4
- package/src/add-mcp-prompt.ts +4 -4
- package/src/add-mcp-resource.ts +4 -4
- package/src/add-mcp-tool.ts +4 -4
- package/src/add-queue-worker.ts +3 -3
- package/src/add-schedule.ts +3 -3
- package/src/types.ts +2 -2
- package/src/utils.test.ts +33 -33
- package/src/utils.ts +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/lcov.info +0 -4655
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @pikku/inspector
|
|
2
2
|
|
|
3
|
+
## 0.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fdb1593: core: bumping everything with a patch to sync up the major release inconsistencies in dependencies
|
|
8
|
+
- Updated dependencies [fdb1593]
|
|
9
|
+
- @pikku/core@0.9.1
|
|
10
|
+
|
|
11
|
+
## 0.9.0
|
|
12
|
+
|
|
13
|
+
### Breaking Changes
|
|
14
|
+
|
|
15
|
+
- Normalized all transports to use "wirings" instead of events/routes/transports for consistency across the framework
|
|
16
|
+
|
|
3
17
|
## 0.8.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/add-channel.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { InspectorFilters, InspectorState, InspectorLogger } from './types.
|
|
|
5
5
|
* Build out the nested message-routes by looking up each handler
|
|
6
6
|
* in state.functions.meta instead of re-inferring it here.
|
|
7
7
|
*/
|
|
8
|
-
export declare function addMessagesRoutes(obj: ts.ObjectLiteralExpression, state: InspectorState, checker: ts.TypeChecker): ChannelMeta['
|
|
8
|
+
export declare function addMessagesRoutes(obj: ts.ObjectLiteralExpression, state: InspectorState, checker: ts.TypeChecker): ChannelMeta['messageWirings'];
|
|
9
9
|
/**
|
|
10
10
|
* Inspect addChannel calls, look up all handlers in state.functions.meta,
|
|
11
11
|
* and emit one entry into state.channels.meta.
|
package/dist/add-channel.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
2
|
import { getPropertyValue } from './get-property-value.js';
|
|
3
3
|
import { pathToRegexp } from 'path-to-regexp';
|
|
4
|
-
import {
|
|
4
|
+
import { PikkuWiringTypes } from '@pikku/core';
|
|
5
5
|
import { extractFunctionName, getPropertyAssignmentInitializer, matchesFilters, } from './utils.js';
|
|
6
6
|
/**
|
|
7
7
|
* Safely get the “initializer” expression of a property-like AST node:
|
|
@@ -76,7 +76,7 @@ function getHandlerNameFromExpression(expr, checker) {
|
|
|
76
76
|
*/
|
|
77
77
|
export function addMessagesRoutes(obj, state, checker) {
|
|
78
78
|
const result = {};
|
|
79
|
-
const onMsgRouteProp = getPropertyAssignmentInitializer(obj, '
|
|
79
|
+
const onMsgRouteProp = getPropertyAssignmentInitializer(obj, 'onMessageWiring', true, checker);
|
|
80
80
|
if (!onMsgRouteProp)
|
|
81
81
|
return result;
|
|
82
82
|
if (!onMsgRouteProp || !ts.isObjectLiteralExpression(onMsgRouteProp))
|
|
@@ -271,7 +271,7 @@ export function addChannel(node, checker, state, filters, logger) {
|
|
|
271
271
|
if (!ts.isCallExpression(node))
|
|
272
272
|
return;
|
|
273
273
|
const { expression, arguments: args } = node;
|
|
274
|
-
if (!ts.isIdentifier(expression) || expression.text !== '
|
|
274
|
+
if (!ts.isIdentifier(expression) || expression.text !== 'wireChannel')
|
|
275
275
|
return;
|
|
276
276
|
const first = args[0];
|
|
277
277
|
if (!first || !ts.isObjectLiteralExpression(first))
|
|
@@ -293,7 +293,7 @@ export function addChannel(node, checker, state, filters, logger) {
|
|
|
293
293
|
const tags = getPropertyValue(obj, 'tags');
|
|
294
294
|
const query = getPropertyValue(obj, 'query');
|
|
295
295
|
const filePath = node.getSourceFile().fileName;
|
|
296
|
-
if (!matchesFilters(filters, { tags }, { type:
|
|
296
|
+
if (!matchesFilters(filters, { tags }, { type: PikkuWiringTypes.channel, name, filePath }, logger))
|
|
297
297
|
return;
|
|
298
298
|
const connect = getPropertyAssignmentInitializer(obj, 'onConnect', false, checker);
|
|
299
299
|
const disconnect = getPropertyAssignmentInitializer(obj, 'onDisconnect', false, checker);
|
|
@@ -315,7 +315,7 @@ export function addChannel(node, checker, state, filters, logger) {
|
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
// nested message-routes
|
|
318
|
-
const
|
|
318
|
+
const messageWirings = addMessagesRoutes(obj, state, checker);
|
|
319
319
|
// record into state
|
|
320
320
|
state.channels.files.add(node.getSourceFile().fileName);
|
|
321
321
|
state.channels.meta[name] = {
|
|
@@ -341,7 +341,7 @@ export function addChannel(node, checker, state, filters, logger) {
|
|
|
341
341
|
}
|
|
342
342
|
: null,
|
|
343
343
|
message,
|
|
344
|
-
|
|
344
|
+
messageWirings,
|
|
345
345
|
docs: docs ?? undefined,
|
|
346
346
|
tags: tags ?? undefined,
|
|
347
347
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
|
-
// const VRAMEWORK_TYPES = ['CoreConfig', 'CoreService', 'CoreServices', 'CoreSingletonService', 'CoreSessionService']
|
|
3
2
|
export const addFileExtendsCoreType = (node, checker, methods, expectedTypeName) => {
|
|
4
3
|
if (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node)) {
|
|
5
4
|
const fileName = node.getSourceFile().fileName;
|
package/dist/add-http-route.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare const getInputTypes: (metaTypes: Map<string, {
|
|
|
10
10
|
body?: string[];
|
|
11
11
|
}>, methodType: string, inputType: string | null, queryValues: string[], paramsValues: string[]) => undefined;
|
|
12
12
|
/**
|
|
13
|
-
* Simplified
|
|
13
|
+
* Simplified wireHTTP: re-uses function metadata from state.functions.meta
|
|
14
14
|
* instead of re-inferring types here.
|
|
15
15
|
*/
|
|
16
16
|
export declare const addHTTPRoute: (node: ts.Node, checker: ts.TypeChecker, state: InspectorState, filters: InspectorFilters, logger: InspectorLogger) => void;
|
package/dist/add-http-route.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
2
|
import { getPropertyValue } from './get-property-value.js';
|
|
3
3
|
import { pathToRegexp } from 'path-to-regexp';
|
|
4
|
-
import {
|
|
4
|
+
import { PikkuWiringTypes } from '@pikku/core';
|
|
5
5
|
import { extractFunctionName, getPropertyAssignmentInitializer, matchesFilters, } from './utils.js';
|
|
6
6
|
/**
|
|
7
7
|
* Populate metaInputTypes for a given route based on method, input type,
|
|
@@ -20,7 +20,7 @@ export const getInputTypes = (metaTypes, methodType, inputType, queryValues, par
|
|
|
20
20
|
return;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
|
-
* Simplified
|
|
23
|
+
* Simplified wireHTTP: re-uses function metadata from state.functions.meta
|
|
24
24
|
* instead of re-inferring types here.
|
|
25
25
|
*/
|
|
26
26
|
export const addHTTPRoute = (node, checker, state, filters, logger) => {
|
|
@@ -28,7 +28,7 @@ export const addHTTPRoute = (node, checker, state, filters, logger) => {
|
|
|
28
28
|
if (!ts.isCallExpression(node))
|
|
29
29
|
return;
|
|
30
30
|
const { expression, arguments: args } = node;
|
|
31
|
-
if (!ts.isIdentifier(expression) || expression.text !== '
|
|
31
|
+
if (!ts.isIdentifier(expression) || expression.text !== 'wireHTTP')
|
|
32
32
|
return;
|
|
33
33
|
// must pass an object literal
|
|
34
34
|
const firstArg = args[0];
|
|
@@ -46,7 +46,7 @@ export const addHTTPRoute = (node, checker, state, filters, logger) => {
|
|
|
46
46
|
const tags = getPropertyValue(obj, 'tags') || undefined;
|
|
47
47
|
const query = getPropertyValue(obj, 'query') || [];
|
|
48
48
|
const filePath = node.getSourceFile().fileName;
|
|
49
|
-
if (!matchesFilters(filters, { tags }, { type:
|
|
49
|
+
if (!matchesFilters(filters, { tags }, { type: PikkuWiringTypes.http, name: route, filePath }, logger)) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
// --- find the referenced function ---
|
package/dist/add-mcp-prompt.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
2
|
import { getPropertyValue } from './get-property-value.js';
|
|
3
|
-
import {
|
|
3
|
+
import { PikkuWiringTypes } from '@pikku/core';
|
|
4
4
|
import { extractFunctionName, getPropertyAssignmentInitializer, matchesFilters, } from './utils.js';
|
|
5
5
|
export const addMCPPrompt = (node, checker, state, filters, logger) => {
|
|
6
6
|
if (!ts.isCallExpression(node)) {
|
|
@@ -9,8 +9,8 @@ export const addMCPPrompt = (node, checker, state, filters, logger) => {
|
|
|
9
9
|
const args = node.arguments;
|
|
10
10
|
const firstArg = args[0];
|
|
11
11
|
const expression = node.expression;
|
|
12
|
-
// Check if the call is to
|
|
13
|
-
if (!ts.isIdentifier(expression) || expression.text !== '
|
|
12
|
+
// Check if the call is to wireMCPPrompt
|
|
13
|
+
if (!ts.isIdentifier(expression) || expression.text !== 'wireMCPPrompt') {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
if (!firstArg) {
|
|
@@ -36,7 +36,7 @@ export const addMCPPrompt = (node, checker, state, filters, logger) => {
|
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
const filePath = node.getSourceFile().fileName;
|
|
39
|
-
if (!matchesFilters(filters, { tags }, { type:
|
|
39
|
+
if (!matchesFilters(filters, { tags }, { type: PikkuWiringTypes.mcp, name: nameValue, filePath }, logger)) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
// lookup existing function metadata
|
package/dist/add-mcp-resource.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
2
|
import { getPropertyValue } from './get-property-value.js';
|
|
3
|
-
import {
|
|
3
|
+
import { PikkuWiringTypes } from '@pikku/core';
|
|
4
4
|
import { extractFunctionName, getPropertyAssignmentInitializer, matchesFilters, } from './utils.js';
|
|
5
5
|
export const addMCPResource = (node, checker, state, filters, logger) => {
|
|
6
6
|
if (!ts.isCallExpression(node)) {
|
|
@@ -9,8 +9,8 @@ export const addMCPResource = (node, checker, state, filters, logger) => {
|
|
|
9
9
|
const args = node.arguments;
|
|
10
10
|
const firstArg = args[0];
|
|
11
11
|
const expression = node.expression;
|
|
12
|
-
// Check if the call is to
|
|
13
|
-
if (!ts.isIdentifier(expression) || expression.text !== '
|
|
12
|
+
// Check if the call is to wireMCPResource
|
|
13
|
+
if (!ts.isIdentifier(expression) || expression.text !== 'wireMCPResource') {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
if (!firstArg) {
|
|
@@ -42,7 +42,7 @@ export const addMCPResource = (node, checker, state, filters, logger) => {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
const filePath = node.getSourceFile().fileName;
|
|
45
|
-
if (!matchesFilters(filters, { tags }, { type:
|
|
45
|
+
if (!matchesFilters(filters, { tags }, { type: PikkuWiringTypes.mcp, name: uriValue, filePath }, logger)) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
// lookup existing function metadata
|
package/dist/add-mcp-tool.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
2
|
import { getPropertyValue } from './get-property-value.js';
|
|
3
|
-
import {
|
|
3
|
+
import { PikkuWiringTypes } from '@pikku/core';
|
|
4
4
|
import { extractFunctionName, getPropertyAssignmentInitializer, matchesFilters, } from './utils.js';
|
|
5
5
|
export const addMCPTool = (node, checker, state, filters, logger) => {
|
|
6
6
|
if (!ts.isCallExpression(node)) {
|
|
@@ -9,8 +9,8 @@ export const addMCPTool = (node, checker, state, filters, logger) => {
|
|
|
9
9
|
const args = node.arguments;
|
|
10
10
|
const firstArg = args[0];
|
|
11
11
|
const expression = node.expression;
|
|
12
|
-
// Check if the call is to
|
|
13
|
-
if (!ts.isIdentifier(expression) || expression.text !== '
|
|
12
|
+
// Check if the call is to wireMCPTool
|
|
13
|
+
if (!ts.isIdentifier(expression) || expression.text !== 'wireMCPTool') {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
if (!firstArg) {
|
|
@@ -38,7 +38,7 @@ export const addMCPTool = (node, checker, state, filters, logger) => {
|
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
const filePath = node.getSourceFile().fileName;
|
|
41
|
-
if (!matchesFilters(filters, { tags }, { type:
|
|
41
|
+
if (!matchesFilters(filters, { tags }, { type: PikkuWiringTypes.mcp, name: nameValue, filePath }, logger)) {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
// lookup existing function metadata
|
package/dist/add-queue-worker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
2
|
import { getPropertyValue } from './get-property-value.js';
|
|
3
|
-
import {
|
|
3
|
+
import { PikkuWiringTypes } from '@pikku/core';
|
|
4
4
|
import { extractFunctionName, getPropertyAssignmentInitializer, matchesFilters, } from './utils.js';
|
|
5
5
|
export const addQueueWorker = (node, checker, state, filters, logger) => {
|
|
6
6
|
if (!ts.isCallExpression(node)) {
|
|
@@ -10,7 +10,7 @@ export const addQueueWorker = (node, checker, state, filters, logger) => {
|
|
|
10
10
|
const firstArg = args[0];
|
|
11
11
|
const expression = node.expression;
|
|
12
12
|
// Check if the call is to addQueueWorker
|
|
13
|
-
if (!ts.isIdentifier(expression) || expression.text !== '
|
|
13
|
+
if (!ts.isIdentifier(expression) || expression.text !== 'wireQueueWorker') {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
if (!firstArg) {
|
|
@@ -33,7 +33,7 @@ export const addQueueWorker = (node, checker, state, filters, logger) => {
|
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
const filePath = node.getSourceFile().fileName;
|
|
36
|
-
if (!matchesFilters(filters, { tags }, { type:
|
|
36
|
+
if (!matchesFilters(filters, { tags }, { type: PikkuWiringTypes.queue, name: queueName, filePath }, logger)) {
|
|
37
37
|
console.info(`• Skipping queue processor '${pikkuFuncName}' for queue '${queueName}' due to filter mismatch.`);
|
|
38
38
|
return;
|
|
39
39
|
}
|
package/dist/add-schedule.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
2
|
import { getPropertyValue } from './get-property-value.js';
|
|
3
|
-
import {
|
|
3
|
+
import { PikkuWiringTypes } from '@pikku/core';
|
|
4
4
|
import { extractFunctionName, getPropertyAssignmentInitializer, matchesFilters, } from './utils.js';
|
|
5
5
|
export const addSchedule = (node, checker, state, filters, logger) => {
|
|
6
6
|
if (!ts.isCallExpression(node)) {
|
|
@@ -10,7 +10,7 @@ export const addSchedule = (node, checker, state, filters, logger) => {
|
|
|
10
10
|
const firstArg = args[0];
|
|
11
11
|
const expression = node.expression;
|
|
12
12
|
// Check if the call is to addScheduledTask
|
|
13
|
-
if (!ts.isIdentifier(expression) || expression.text !== '
|
|
13
|
+
if (!ts.isIdentifier(expression) || expression.text !== 'wireScheduler') {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
if (!firstArg) {
|
|
@@ -32,7 +32,7 @@ export const addSchedule = (node, checker, state, filters, logger) => {
|
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
const filePath = node.getSourceFile().fileName;
|
|
35
|
-
if (!matchesFilters(filters, { tags }, { type:
|
|
35
|
+
if (!matchesFilters(filters, { tags }, { type: PikkuWiringTypes.scheduler, name: nameValue, filePath }, logger)) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
state.scheduledTasks.files.add(node.getSourceFile().fileName);
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChannelsMeta } from '@pikku/core/channel';
|
|
2
|
-
import {
|
|
2
|
+
import { HTTPWiringsMeta } from '@pikku/core/http';
|
|
3
3
|
import { ScheduledTasksMeta } from '@pikku/core/scheduler';
|
|
4
4
|
import { queueWorkersMeta } from '@pikku/core/queue';
|
|
5
5
|
import { MCPResourceMeta, MCPToolMeta, MCPPromptMeta } from '@pikku/core';
|
|
@@ -18,7 +18,7 @@ export type MetaInputTypes = Map<string, {
|
|
|
18
18
|
}>;
|
|
19
19
|
export interface InspectorHTTPState {
|
|
20
20
|
metaInputTypes: MetaInputTypes;
|
|
21
|
-
meta:
|
|
21
|
+
meta: HTTPWiringsMeta;
|
|
22
22
|
files: Set<string>;
|
|
23
23
|
}
|
|
24
24
|
export interface InspectorFunctionState {
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ts from 'typescript';
|
|
2
2
|
import { InspectorFilters, InspectorLogger } from './types.js';
|
|
3
|
-
import {
|
|
3
|
+
import { PikkuWiringTypes } from '@pikku/core';
|
|
4
4
|
type ExtractedFunctionName = {
|
|
5
5
|
pikkuFuncName: string;
|
|
6
6
|
name: string;
|
|
@@ -28,7 +28,7 @@ export declare function getPropertyAssignmentInitializer(obj: ts.ObjectLiteralEx
|
|
|
28
28
|
export declare const matchesFilters: (filters: InspectorFilters, params: {
|
|
29
29
|
tags?: string[];
|
|
30
30
|
}, meta: {
|
|
31
|
-
type:
|
|
31
|
+
type: PikkuWiringTypes;
|
|
32
32
|
name: string;
|
|
33
33
|
filePath?: string;
|
|
34
34
|
}, logger: InspectorLogger) => boolean;
|
package/dist/utils.js
CHANGED
|
@@ -204,7 +204,7 @@ export function extractFunctionName(callExpr, checker) {
|
|
|
204
204
|
propertyName: null,
|
|
205
205
|
explicitName: null,
|
|
206
206
|
};
|
|
207
|
-
// Special case for
|
|
207
|
+
// Special case for wireHTTP: if this is an identifier within an object literal,
|
|
208
208
|
// it might be coming from the HTTP route handling flow
|
|
209
209
|
if (ts.isIdentifier(callExpr) &&
|
|
210
210
|
callExpr.parent &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikku/inspector",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"author": "yasser.fadl@gmail.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"test:coverage": "bash run-tests.sh --coverage"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@pikku/core": "^0.
|
|
20
|
+
"@pikku/core": "^0.9.1",
|
|
21
21
|
"path-to-regexp": "^8.2.0",
|
|
22
22
|
"typescript": "^5.6"
|
|
23
23
|
},
|
package/src/add-channel.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as ts from 'typescript'
|
|
2
2
|
import { getPropertyValue } from './get-property-value.js'
|
|
3
3
|
import { pathToRegexp } from 'path-to-regexp'
|
|
4
|
-
import { APIDocs,
|
|
4
|
+
import { APIDocs, PikkuWiringTypes } from '@pikku/core'
|
|
5
5
|
import {
|
|
6
6
|
extractFunctionName,
|
|
7
7
|
getPropertyAssignmentInitializer,
|
|
@@ -107,11 +107,11 @@ export function addMessagesRoutes(
|
|
|
107
107
|
obj: ts.ObjectLiteralExpression,
|
|
108
108
|
state: InspectorState,
|
|
109
109
|
checker: ts.TypeChecker
|
|
110
|
-
): ChannelMeta['
|
|
111
|
-
const result: ChannelMeta['
|
|
110
|
+
): ChannelMeta['messageWirings'] {
|
|
111
|
+
const result: ChannelMeta['messageWirings'] = {}
|
|
112
112
|
const onMsgRouteProp = getPropertyAssignmentInitializer(
|
|
113
113
|
obj,
|
|
114
|
-
'
|
|
114
|
+
'onMessageWiring',
|
|
115
115
|
true,
|
|
116
116
|
checker
|
|
117
117
|
)
|
|
@@ -372,7 +372,7 @@ export function addChannel(
|
|
|
372
372
|
) {
|
|
373
373
|
if (!ts.isCallExpression(node)) return
|
|
374
374
|
const { expression, arguments: args } = node
|
|
375
|
-
if (!ts.isIdentifier(expression) || expression.text !== '
|
|
375
|
+
if (!ts.isIdentifier(expression) || expression.text !== 'wireChannel') return
|
|
376
376
|
const first = args[0]
|
|
377
377
|
if (!first || !ts.isObjectLiteralExpression(first)) return
|
|
378
378
|
|
|
@@ -402,7 +402,7 @@ export function addChannel(
|
|
|
402
402
|
!matchesFilters(
|
|
403
403
|
filters,
|
|
404
404
|
{ tags },
|
|
405
|
-
{ type:
|
|
405
|
+
{ type: PikkuWiringTypes.channel, name, filePath },
|
|
406
406
|
logger
|
|
407
407
|
)
|
|
408
408
|
)
|
|
@@ -448,7 +448,7 @@ export function addChannel(
|
|
|
448
448
|
}
|
|
449
449
|
|
|
450
450
|
// nested message-routes
|
|
451
|
-
const
|
|
451
|
+
const messageWirings = addMessagesRoutes(obj, state, checker)
|
|
452
452
|
|
|
453
453
|
// record into state
|
|
454
454
|
state.channels.files.add(node.getSourceFile().fileName)
|
|
@@ -475,7 +475,7 @@ export function addChannel(
|
|
|
475
475
|
}
|
|
476
476
|
: null,
|
|
477
477
|
message,
|
|
478
|
-
|
|
478
|
+
messageWirings,
|
|
479
479
|
docs: docs ?? undefined,
|
|
480
480
|
tags: tags ?? undefined,
|
|
481
481
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as ts from 'typescript'
|
|
2
2
|
import { PathToNameAndType } from './types.js'
|
|
3
3
|
|
|
4
|
-
// const VRAMEWORK_TYPES = ['CoreConfig', 'CoreService', 'CoreServices', 'CoreSingletonService', 'CoreSessionService']
|
|
5
|
-
|
|
6
4
|
export const addFileExtendsCoreType = (
|
|
7
5
|
node: ts.Node,
|
|
8
6
|
checker: ts.TypeChecker,
|
package/src/add-http-route.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as ts from 'typescript'
|
|
|
2
2
|
import { getPropertyValue } from './get-property-value.js'
|
|
3
3
|
import { pathToRegexp } from 'path-to-regexp'
|
|
4
4
|
import { HTTPMethod } from '@pikku/core/http'
|
|
5
|
-
import { APIDocs,
|
|
5
|
+
import { APIDocs, PikkuWiringTypes } from '@pikku/core'
|
|
6
6
|
import {
|
|
7
7
|
extractFunctionName,
|
|
8
8
|
getPropertyAssignmentInitializer,
|
|
@@ -36,7 +36,7 @@ export const getInputTypes = (
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* Simplified
|
|
39
|
+
* Simplified wireHTTP: re-uses function metadata from state.functions.meta
|
|
40
40
|
* instead of re-inferring types here.
|
|
41
41
|
*/
|
|
42
42
|
export const addHTTPRoute = (
|
|
@@ -50,7 +50,7 @@ export const addHTTPRoute = (
|
|
|
50
50
|
if (!ts.isCallExpression(node)) return
|
|
51
51
|
|
|
52
52
|
const { expression, arguments: args } = node
|
|
53
|
-
if (!ts.isIdentifier(expression) || expression.text !== '
|
|
53
|
+
if (!ts.isIdentifier(expression) || expression.text !== 'wireHTTP') return
|
|
54
54
|
|
|
55
55
|
// must pass an object literal
|
|
56
56
|
const firstArg = args[0]
|
|
@@ -76,7 +76,7 @@ export const addHTTPRoute = (
|
|
|
76
76
|
!matchesFilters(
|
|
77
77
|
filters,
|
|
78
78
|
{ tags },
|
|
79
|
-
{ type:
|
|
79
|
+
{ type: PikkuWiringTypes.http, name: route, filePath },
|
|
80
80
|
logger
|
|
81
81
|
)
|
|
82
82
|
) {
|
package/src/add-mcp-prompt.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ts from 'typescript'
|
|
2
2
|
import { getPropertyValue } from './get-property-value.js'
|
|
3
|
-
import {
|
|
3
|
+
import { PikkuWiringTypes } from '@pikku/core'
|
|
4
4
|
import { InspectorFilters, InspectorState, InspectorLogger } from './types.js'
|
|
5
5
|
import {
|
|
6
6
|
extractFunctionName,
|
|
@@ -23,8 +23,8 @@ export const addMCPPrompt = (
|
|
|
23
23
|
const firstArg = args[0]
|
|
24
24
|
const expression = node.expression
|
|
25
25
|
|
|
26
|
-
// Check if the call is to
|
|
27
|
-
if (!ts.isIdentifier(expression) || expression.text !== '
|
|
26
|
+
// Check if the call is to wireMCPPrompt
|
|
27
|
+
if (!ts.isIdentifier(expression) || expression.text !== 'wireMCPPrompt') {
|
|
28
28
|
return
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -73,7 +73,7 @@ export const addMCPPrompt = (
|
|
|
73
73
|
!matchesFilters(
|
|
74
74
|
filters,
|
|
75
75
|
{ tags },
|
|
76
|
-
{ type:
|
|
76
|
+
{ type: PikkuWiringTypes.mcp, name: nameValue, filePath },
|
|
77
77
|
logger
|
|
78
78
|
)
|
|
79
79
|
) {
|
package/src/add-mcp-resource.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ts from 'typescript'
|
|
2
2
|
import { getPropertyValue } from './get-property-value.js'
|
|
3
|
-
import {
|
|
3
|
+
import { PikkuWiringTypes } from '@pikku/core'
|
|
4
4
|
import { InspectorFilters, InspectorState, InspectorLogger } from './types.js'
|
|
5
5
|
import {
|
|
6
6
|
extractFunctionName,
|
|
@@ -23,8 +23,8 @@ export const addMCPResource = (
|
|
|
23
23
|
const firstArg = args[0]
|
|
24
24
|
const expression = node.expression
|
|
25
25
|
|
|
26
|
-
// Check if the call is to
|
|
27
|
-
if (!ts.isIdentifier(expression) || expression.text !== '
|
|
26
|
+
// Check if the call is to wireMCPResource
|
|
27
|
+
if (!ts.isIdentifier(expression) || expression.text !== 'wireMCPResource') {
|
|
28
28
|
return
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -84,7 +84,7 @@ export const addMCPResource = (
|
|
|
84
84
|
!matchesFilters(
|
|
85
85
|
filters,
|
|
86
86
|
{ tags },
|
|
87
|
-
{ type:
|
|
87
|
+
{ type: PikkuWiringTypes.mcp, name: uriValue, filePath },
|
|
88
88
|
logger
|
|
89
89
|
)
|
|
90
90
|
) {
|
package/src/add-mcp-tool.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ts from 'typescript'
|
|
2
2
|
import { getPropertyValue } from './get-property-value.js'
|
|
3
|
-
import {
|
|
3
|
+
import { PikkuWiringTypes } from '@pikku/core'
|
|
4
4
|
import { InspectorFilters, InspectorState, InspectorLogger } from './types.js'
|
|
5
5
|
import {
|
|
6
6
|
extractFunctionName,
|
|
@@ -23,8 +23,8 @@ export const addMCPTool = (
|
|
|
23
23
|
const firstArg = args[0]
|
|
24
24
|
const expression = node.expression
|
|
25
25
|
|
|
26
|
-
// Check if the call is to
|
|
27
|
-
if (!ts.isIdentifier(expression) || expression.text !== '
|
|
26
|
+
// Check if the call is to wireMCPTool
|
|
27
|
+
if (!ts.isIdentifier(expression) || expression.text !== 'wireMCPTool') {
|
|
28
28
|
return
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -75,7 +75,7 @@ export const addMCPTool = (
|
|
|
75
75
|
!matchesFilters(
|
|
76
76
|
filters,
|
|
77
77
|
{ tags },
|
|
78
|
-
{ type:
|
|
78
|
+
{ type: PikkuWiringTypes.mcp, name: nameValue, filePath },
|
|
79
79
|
logger
|
|
80
80
|
)
|
|
81
81
|
) {
|
package/src/add-queue-worker.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ts from 'typescript'
|
|
2
2
|
import { getPropertyValue } from './get-property-value.js'
|
|
3
|
-
import { APIDocs,
|
|
3
|
+
import { APIDocs, PikkuWiringTypes } from '@pikku/core'
|
|
4
4
|
import { InspectorFilters, InspectorState, InspectorLogger } from './types.js'
|
|
5
5
|
import {
|
|
6
6
|
extractFunctionName,
|
|
@@ -24,7 +24,7 @@ export const addQueueWorker = (
|
|
|
24
24
|
const expression = node.expression
|
|
25
25
|
|
|
26
26
|
// Check if the call is to addQueueWorker
|
|
27
|
-
if (!ts.isIdentifier(expression) || expression.text !== '
|
|
27
|
+
if (!ts.isIdentifier(expression) || expression.text !== 'wireQueueWorker') {
|
|
28
28
|
return
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -71,7 +71,7 @@ export const addQueueWorker = (
|
|
|
71
71
|
!matchesFilters(
|
|
72
72
|
filters,
|
|
73
73
|
{ tags },
|
|
74
|
-
{ type:
|
|
74
|
+
{ type: PikkuWiringTypes.queue, name: queueName, filePath },
|
|
75
75
|
logger
|
|
76
76
|
)
|
|
77
77
|
) {
|
package/src/add-schedule.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ts from 'typescript'
|
|
2
2
|
import { getPropertyValue } from './get-property-value.js'
|
|
3
|
-
import { APIDocs,
|
|
3
|
+
import { APIDocs, PikkuWiringTypes } from '@pikku/core'
|
|
4
4
|
import { InspectorFilters, InspectorState, InspectorLogger } from './types.js'
|
|
5
5
|
import {
|
|
6
6
|
extractFunctionName,
|
|
@@ -24,7 +24,7 @@ export const addSchedule = (
|
|
|
24
24
|
const expression = node.expression
|
|
25
25
|
|
|
26
26
|
// Check if the call is to addScheduledTask
|
|
27
|
-
if (!ts.isIdentifier(expression) || expression.text !== '
|
|
27
|
+
if (!ts.isIdentifier(expression) || expression.text !== 'wireScheduler') {
|
|
28
28
|
return
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -68,7 +68,7 @@ export const addSchedule = (
|
|
|
68
68
|
!matchesFilters(
|
|
69
69
|
filters,
|
|
70
70
|
{ tags },
|
|
71
|
-
{ type:
|
|
71
|
+
{ type: PikkuWiringTypes.scheduler, name: nameValue, filePath },
|
|
72
72
|
logger
|
|
73
73
|
)
|
|
74
74
|
) {
|
package/src/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChannelsMeta } from '@pikku/core/channel'
|
|
2
|
-
import {
|
|
2
|
+
import { HTTPWiringsMeta } from '@pikku/core/http'
|
|
3
3
|
import { ScheduledTasksMeta } from '@pikku/core/scheduler'
|
|
4
4
|
import { queueWorkersMeta } from '@pikku/core/queue'
|
|
5
5
|
import { MCPResourceMeta, MCPToolMeta, MCPPromptMeta } from '@pikku/core'
|
|
@@ -23,7 +23,7 @@ export type MetaInputTypes = Map<
|
|
|
23
23
|
|
|
24
24
|
export interface InspectorHTTPState {
|
|
25
25
|
metaInputTypes: MetaInputTypes
|
|
26
|
-
meta:
|
|
26
|
+
meta: HTTPWiringsMeta
|
|
27
27
|
files: Set<string>
|
|
28
28
|
}
|
|
29
29
|
|