@pikku/inspector 0.11.0 → 0.11.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 +16 -1
- package/dist/add/add-channel.js +11 -10
- package/dist/add/add-file-with-factory.js +10 -10
- package/dist/add/add-functions.js +57 -43
- package/dist/add/add-http-route.js +5 -4
- package/dist/add/add-mcp-prompt.js +6 -5
- package/dist/add/add-mcp-resource.js +6 -5
- package/dist/add/add-mcp-tool.js +6 -5
- package/dist/add/add-middleware.js +1 -1
- package/dist/add/add-permission.js +1 -1
- package/dist/add/add-queue-worker.js +6 -5
- package/dist/add/add-schedule.js +5 -4
- package/dist/add/add-workflow.d.ts +1 -1
- package/dist/add/add-workflow.js +92 -66
- package/dist/error-codes.d.ts +1 -0
- package/dist/error-codes.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/inspector.js +10 -6
- package/dist/types.d.ts +21 -8
- package/dist/utils/extract-function-node.d.ts +10 -0
- package/dist/utils/extract-function-node.js +38 -0
- package/dist/utils/extract-node-value.d.ts +8 -0
- package/dist/utils/extract-node-value.js +24 -0
- package/dist/utils/extract-service-metadata.d.ts +19 -0
- package/dist/utils/extract-service-metadata.js +244 -0
- package/dist/utils/get-files-and-methods.d.ts +3 -3
- package/dist/utils/get-files-and-methods.js +3 -3
- package/dist/utils/get-property-value.d.ts +13 -6
- package/dist/utils/get-property-value.js +51 -43
- package/dist/utils/post-process.d.ts +9 -0
- package/dist/utils/post-process.js +30 -3
- package/dist/utils/serialize-inspector-state.d.ts +18 -5
- package/dist/utils/serialize-inspector-state.js +12 -10
- package/dist/utils/write-service-metadata.d.ts +13 -0
- package/dist/utils/write-service-metadata.js +37 -0
- package/dist/visit.js +2 -2
- package/dist/workflow/extract-simple-workflow.d.ts +15 -0
- package/dist/workflow/extract-simple-workflow.js +803 -0
- package/dist/workflow/patterns.d.ts +39 -0
- package/dist/workflow/patterns.js +138 -0
- package/dist/workflow/validation.d.ts +28 -0
- package/dist/workflow/validation.js +124 -0
- package/package.json +4 -4
- package/src/add/add-channel.ts +37 -17
- package/src/add/add-file-with-factory.ts +10 -10
- package/src/add/add-functions.ts +72 -56
- package/src/add/add-http-route.ts +10 -5
- package/src/add/add-mcp-prompt.ts +11 -7
- package/src/add/add-mcp-resource.ts +11 -7
- package/src/add/add-mcp-tool.ts +11 -7
- package/src/add/add-middleware.ts +1 -1
- package/src/add/add-permission.ts +1 -1
- package/src/add/add-queue-worker.ts +11 -12
- package/src/add/add-schedule.ts +10 -5
- package/src/add/add-workflow.ts +120 -110
- package/src/error-codes.ts +1 -0
- package/src/index.ts +2 -0
- package/src/inspector.ts +16 -6
- package/src/types.ts +18 -8
- package/src/utils/extract-function-node.ts +58 -0
- package/src/utils/extract-node-value.ts +31 -0
- package/src/utils/extract-service-metadata.ts +353 -0
- package/src/utils/filter-inspector-state.test.ts +3 -3
- package/src/utils/filter-utils.test.ts +45 -51
- package/src/utils/get-files-and-methods.ts +11 -11
- package/src/utils/get-property-value.ts +60 -53
- package/src/utils/permissions.test.ts +3 -3
- package/src/utils/post-process.ts +56 -3
- package/src/utils/serialize-inspector-state.ts +28 -18
- package/src/utils/test-data/inspector-state.json +9 -9
- package/src/utils/write-service-metadata.ts +51 -0
- package/src/visit.ts +3 -3
- package/src/workflow/extract-simple-workflow.ts +1035 -0
- package/src/workflow/patterns.ts +182 -0
- package/src/workflow/validation.ts +153 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
/**
|
|
4
|
+
* Write service metadata to a JSON file in .pikku/services directory
|
|
5
|
+
*/
|
|
6
|
+
export function writeServiceMetadata(serviceMeta, outDir) {
|
|
7
|
+
const servicesDir = path.join(outDir, 'services');
|
|
8
|
+
if (!fs.existsSync(servicesDir)) {
|
|
9
|
+
fs.mkdirSync(servicesDir, { recursive: true });
|
|
10
|
+
}
|
|
11
|
+
const fileName = `${serviceMeta.name}.gen.json`;
|
|
12
|
+
const filePath = path.join(servicesDir, fileName);
|
|
13
|
+
const jsonContent = JSON.stringify(serviceMeta, null, 2);
|
|
14
|
+
fs.writeFileSync(filePath, jsonContent, 'utf-8');
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Write all service metadata files
|
|
18
|
+
*/
|
|
19
|
+
export function writeAllServiceMetadata(servicesMetadata, outDir) {
|
|
20
|
+
for (const serviceMeta of servicesMetadata) {
|
|
21
|
+
writeServiceMetadata(serviceMeta, outDir);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Clean up services directory (remove old service JSON files)
|
|
26
|
+
*/
|
|
27
|
+
export function cleanServicesDirectory(outDir) {
|
|
28
|
+
const servicesDir = path.join(outDir, 'services');
|
|
29
|
+
if (fs.existsSync(servicesDir)) {
|
|
30
|
+
const files = fs.readdirSync(servicesDir);
|
|
31
|
+
for (const file of files) {
|
|
32
|
+
if (file.endsWith('.gen.json')) {
|
|
33
|
+
fs.unlinkSync(path.join(servicesDir, file));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
package/dist/visit.js
CHANGED
|
@@ -16,11 +16,11 @@ import { addPermission } from './add/add-permission.js';
|
|
|
16
16
|
import { addCLI, addCLIRenderers } from './add/add-cli.js';
|
|
17
17
|
export const visitSetup = (logger, checker, node, state, options) => {
|
|
18
18
|
addFileExtendsCoreType(node, checker, state.singletonServicesTypeImportMap, 'CoreSingletonServices', state);
|
|
19
|
-
addFileExtendsCoreType(node, checker, state.
|
|
19
|
+
addFileExtendsCoreType(node, checker, state.wireServicesTypeImportMap, 'CoreServices', state);
|
|
20
20
|
addFileExtendsCoreType(node, checker, state.userSessionTypeImportMap, 'CoreUserSession', state);
|
|
21
21
|
addFileExtendsCoreType(node, checker, state.configTypeImportMap, 'CoreConfig', state);
|
|
22
22
|
addFileWithFactory(node, checker, state.singletonServicesFactories, 'CreateSingletonServices');
|
|
23
|
-
addFileWithFactory(node, checker, state.
|
|
23
|
+
addFileWithFactory(node, checker, state.wireServicesFactories, 'CreateWireServices', state);
|
|
24
24
|
addFileWithFactory(node, checker, state.configFactories, 'CreateConfig');
|
|
25
25
|
addRPCInvocations(node, state, logger);
|
|
26
26
|
addMiddleware(logger, node, checker, state, options);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
import { WorkflowStepMeta } from '@pikku/core/workflow';
|
|
3
|
+
/**
|
|
4
|
+
* Result of simple workflow extraction
|
|
5
|
+
*/
|
|
6
|
+
export interface ExtractionResult {
|
|
7
|
+
status: 'ok' | 'error';
|
|
8
|
+
steps?: WorkflowStepMeta[];
|
|
9
|
+
reason?: string;
|
|
10
|
+
simple?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Extract simple workflow metadata from a function declaration
|
|
14
|
+
*/
|
|
15
|
+
export declare function extractSimpleWorkflow(funcNode: ts.Node, checker: ts.TypeChecker): ExtractionResult;
|