@pikku/inspector 0.11.0 → 0.11.2

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 (109) hide show
  1. package/CHANGELOG.md +32 -2
  2. package/dist/add/add-channel.js +11 -10
  3. package/dist/add/add-file-with-factory.js +10 -10
  4. package/dist/add/add-forge-credential.d.ts +8 -0
  5. package/dist/add/add-forge-credential.js +77 -0
  6. package/dist/add/add-forge-node.d.ts +7 -0
  7. package/dist/add/add-forge-node.js +77 -0
  8. package/dist/add/add-functions.js +158 -51
  9. package/dist/add/add-http-route.js +28 -4
  10. package/dist/add/add-mcp-prompt.js +6 -5
  11. package/dist/add/add-mcp-resource.js +6 -5
  12. package/dist/add/add-mcp-tool.js +6 -5
  13. package/dist/add/add-middleware.js +1 -1
  14. package/dist/add/add-permission.js +1 -1
  15. package/dist/add/add-queue-worker.js +6 -5
  16. package/dist/add/add-rpc-invocations.d.ts +3 -0
  17. package/dist/add/add-rpc-invocations.js +51 -25
  18. package/dist/add/add-schedule.js +5 -4
  19. package/dist/add/add-workflow-graph.d.ts +6 -0
  20. package/dist/add/add-workflow-graph.js +659 -0
  21. package/dist/add/add-workflow.d.ts +1 -1
  22. package/dist/add/add-workflow.js +191 -69
  23. package/dist/error-codes.d.ts +3 -0
  24. package/dist/error-codes.js +3 -0
  25. package/dist/index.d.ts +5 -0
  26. package/dist/index.js +3 -0
  27. package/dist/inspector.js +29 -9
  28. package/dist/types.d.ts +47 -8
  29. package/dist/utils/extract-function-name.js +7 -7
  30. package/dist/utils/extract-function-node.d.ts +10 -0
  31. package/dist/utils/extract-function-node.js +38 -0
  32. package/dist/utils/extract-node-value.d.ts +8 -0
  33. package/dist/utils/extract-node-value.js +24 -0
  34. package/dist/utils/extract-service-metadata.d.ts +19 -0
  35. package/dist/utils/extract-service-metadata.js +244 -0
  36. package/dist/utils/get-files-and-methods.d.ts +3 -3
  37. package/dist/utils/get-files-and-methods.js +3 -3
  38. package/dist/utils/get-property-value.d.ts +14 -6
  39. package/dist/utils/get-property-value.js +55 -43
  40. package/dist/utils/post-process.d.ts +9 -0
  41. package/dist/utils/post-process.js +30 -3
  42. package/dist/utils/serialize-inspector-state.d.ts +42 -6
  43. package/dist/utils/serialize-inspector-state.js +36 -10
  44. package/dist/utils/workflow/dsl/deserialize-dsl-workflow.d.ts +24 -0
  45. package/dist/utils/workflow/dsl/deserialize-dsl-workflow.js +898 -0
  46. package/dist/utils/workflow/dsl/extract-dsl-workflow.d.ts +17 -0
  47. package/dist/utils/workflow/dsl/extract-dsl-workflow.js +1284 -0
  48. package/dist/utils/workflow/dsl/index.d.ts +7 -0
  49. package/dist/utils/workflow/dsl/index.js +7 -0
  50. package/dist/utils/workflow/dsl/patterns.d.ts +60 -0
  51. package/dist/utils/workflow/dsl/patterns.js +218 -0
  52. package/dist/utils/workflow/dsl/validation.d.ts +30 -0
  53. package/dist/utils/workflow/dsl/validation.js +142 -0
  54. package/dist/utils/workflow/graph/convert-dsl-to-graph.d.ts +13 -0
  55. package/dist/utils/workflow/graph/convert-dsl-to-graph.js +316 -0
  56. package/dist/utils/workflow/graph/index.d.ts +6 -0
  57. package/dist/utils/workflow/graph/index.js +6 -0
  58. package/dist/utils/workflow/graph/serialize-workflow-graph.d.ts +43 -0
  59. package/dist/utils/workflow/graph/serialize-workflow-graph.js +152 -0
  60. package/dist/utils/workflow/graph/workflow-graph.types.d.ts +229 -0
  61. package/dist/utils/workflow/graph/workflow-graph.types.js +38 -0
  62. package/dist/utils/write-service-metadata.d.ts +13 -0
  63. package/dist/utils/write-service-metadata.js +37 -0
  64. package/dist/visit.js +8 -2
  65. package/package.json +16 -4
  66. package/src/add/add-channel.ts +37 -17
  67. package/src/add/add-file-with-factory.ts +10 -10
  68. package/src/add/add-forge-credential.ts +119 -0
  69. package/src/add/add-forge-node.ts +132 -0
  70. package/src/add/add-functions.ts +199 -69
  71. package/src/add/add-http-route.ts +34 -5
  72. package/src/add/add-mcp-prompt.ts +11 -7
  73. package/src/add/add-mcp-resource.ts +11 -7
  74. package/src/add/add-mcp-tool.ts +11 -7
  75. package/src/add/add-middleware.ts +1 -1
  76. package/src/add/add-permission.ts +1 -1
  77. package/src/add/add-queue-worker.ts +11 -12
  78. package/src/add/add-rpc-invocations.ts +61 -31
  79. package/src/add/add-schedule.ts +10 -5
  80. package/src/add/add-workflow-graph.ts +864 -0
  81. package/src/add/add-workflow.ts +212 -116
  82. package/src/error-codes.ts +3 -0
  83. package/src/index.ts +12 -0
  84. package/src/inspector.ts +36 -10
  85. package/src/types.ts +43 -9
  86. package/src/utils/extract-function-name.ts +7 -7
  87. package/src/utils/extract-function-node.ts +58 -0
  88. package/src/utils/extract-node-value.ts +31 -0
  89. package/src/utils/extract-service-metadata.ts +353 -0
  90. package/src/utils/filter-inspector-state.test.ts +3 -3
  91. package/src/utils/filter-utils.test.ts +45 -51
  92. package/src/utils/get-files-and-methods.ts +11 -11
  93. package/src/utils/get-property-value.ts +67 -53
  94. package/src/utils/permissions.test.ts +3 -3
  95. package/src/utils/post-process.ts +56 -3
  96. package/src/utils/serialize-inspector-state.ts +67 -19
  97. package/src/utils/test-data/inspector-state.json +9 -9
  98. package/src/utils/workflow/dsl/deserialize-dsl-workflow.ts +1180 -0
  99. package/src/utils/workflow/dsl/extract-dsl-workflow.ts +1608 -0
  100. package/src/utils/workflow/dsl/index.ts +11 -0
  101. package/src/utils/workflow/dsl/patterns.ts +279 -0
  102. package/src/utils/workflow/dsl/validation.ts +180 -0
  103. package/src/utils/workflow/graph/convert-dsl-to-graph.ts +415 -0
  104. package/src/utils/workflow/graph/index.ts +6 -0
  105. package/src/utils/workflow/graph/serialize-workflow-graph.ts +223 -0
  106. package/src/utils/workflow/graph/workflow-graph.types.ts +280 -0
  107. package/src/utils/write-service-metadata.ts +51 -0
  108. package/src/visit.ts +9 -3
  109. package/tsconfig.tsbuildinfo +1 -1
@@ -13,7 +13,7 @@ export interface SerializableInspectorState {
13
13
  typePath: string | null;
14
14
  }[]
15
15
  ]>;
16
- sessionServicesTypeImportMap: Array<[
16
+ wireServicesTypeImportMap: Array<[
17
17
  string,
18
18
  {
19
19
  variable: string;
@@ -45,7 +45,7 @@ export interface SerializableInspectorState {
45
45
  typePath: string | null;
46
46
  }[]
47
47
  ]>;
48
- sessionServicesFactories: Array<[
48
+ wireServicesFactories: Array<[
49
49
  string,
50
50
  {
51
51
  variable: string;
@@ -53,7 +53,7 @@ export interface SerializableInspectorState {
53
53
  typePath: string | null;
54
54
  }[]
55
55
  ]>;
56
- sessionServicesMeta: Array<[string, string[]]>;
56
+ wireServicesMeta: Array<[string, string[]]>;
57
57
  configFactories: Array<[
58
58
  string,
59
59
  {
@@ -74,6 +74,10 @@ export interface SerializableInspectorState {
74
74
  }[]
75
75
  ]>
76
76
  ]>;
77
+ zodLookup: Array<[string, {
78
+ variableName: string;
79
+ sourceFile: string;
80
+ }]>;
77
81
  functions: {
78
82
  typesMap: {
79
83
  map: Array<[string, {
@@ -125,7 +129,15 @@ export interface SerializableInspectorState {
125
129
  };
126
130
  workflows: {
127
131
  meta: InspectorState['workflows']['meta'];
128
- files: string[];
132
+ files: Array<[string, {
133
+ path: string;
134
+ exportedName: string;
135
+ }]>;
136
+ graphMeta: InspectorState['workflows']['graphMeta'];
137
+ graphFiles: Array<[string, {
138
+ path: string;
139
+ exportedName: string;
140
+ }]>;
129
141
  };
130
142
  rpc: {
131
143
  internalMeta: InspectorState['rpc']['internalMeta'];
@@ -139,6 +151,7 @@ export interface SerializableInspectorState {
139
151
  exportedName: string;
140
152
  }]>;
141
153
  invokedFunctions: string[];
154
+ usedExternalPackages: string[];
142
155
  };
143
156
  mcpEndpoints: {
144
157
  resourcesMeta: InspectorState['mcpEndpoints']['resourcesMeta'];
@@ -150,6 +163,14 @@ export interface SerializableInspectorState {
150
163
  meta: InspectorState['cli']['meta'];
151
164
  files: string[];
152
165
  };
166
+ forgeNodes: {
167
+ meta: InspectorState['forgeNodes']['meta'];
168
+ files: string[];
169
+ };
170
+ forgeCredentials: {
171
+ meta: InspectorState['forgeCredentials']['meta'];
172
+ files: string[];
173
+ };
153
174
  middleware: {
154
175
  meta: InspectorState['middleware']['meta'];
155
176
  tagMiddleware: Array<[
@@ -170,8 +191,18 @@ export interface SerializableInspectorState {
170
191
  usedMiddleware: string[];
171
192
  usedPermissions: string[];
172
193
  allSingletonServices: string[];
173
- allSessionServices: string[];
194
+ allWireServices: string[];
174
195
  };
196
+ serviceMetadata: Array<{
197
+ name: string;
198
+ summary: string;
199
+ description: string;
200
+ package: string;
201
+ path: string;
202
+ version: string;
203
+ interface: string;
204
+ expandedProperties: Record<string, string>;
205
+ }>;
175
206
  }
176
207
  /**
177
208
  * Serializes InspectorState to a JSON-compatible format
@@ -182,4 +213,9 @@ export declare function serializeInspectorState(state: InspectorState): Serializ
182
213
  * Deserializes JSON data back to InspectorState
183
214
  * Creates a partial state suitable for filtering/generation (without typesLookup)
184
215
  */
185
- export declare function deserializeInspectorState(data: SerializableInspectorState): Omit<InspectorState, 'typesLookup'>;
216
+ export declare function deserializeInspectorState(data: SerializableInspectorState): Omit<InspectorState, 'typesLookup' | 'zodLookup'> & {
217
+ zodLookup: Map<string, {
218
+ variableName: string;
219
+ sourceFile: string;
220
+ }>;
221
+ };
@@ -17,15 +17,16 @@ export function serializeInspectorState(state) {
17
17
  return {
18
18
  rootDir: state.rootDir,
19
19
  singletonServicesTypeImportMap: Array.from(state.singletonServicesTypeImportMap.entries()),
20
- sessionServicesTypeImportMap: Array.from(state.sessionServicesTypeImportMap.entries()),
20
+ wireServicesTypeImportMap: Array.from(state.wireServicesTypeImportMap.entries()),
21
21
  userSessionTypeImportMap: Array.from(state.userSessionTypeImportMap.entries()),
22
22
  configTypeImportMap: Array.from(state.configTypeImportMap.entries()),
23
23
  singletonServicesFactories: Array.from(state.singletonServicesFactories.entries()),
24
- sessionServicesFactories: Array.from(state.sessionServicesFactories.entries()),
25
- sessionServicesMeta: Array.from(state.sessionServicesMeta.entries()),
24
+ wireServicesFactories: Array.from(state.wireServicesFactories.entries()),
25
+ wireServicesMeta: Array.from(state.wireServicesMeta.entries()),
26
26
  configFactories: Array.from(state.configFactories.entries()),
27
27
  filesAndMethods: state.filesAndMethods,
28
28
  filesAndMethodsErrors: Array.from(state.filesAndMethodsErrors.entries()).map(([key, mapValue]) => [key, Array.from(mapValue.entries())]),
29
+ zodLookup: Array.from(state.zodLookup.entries()),
29
30
  functions: {
30
31
  typesMap: serializeTypesMap(state.functions.typesMap),
31
32
  meta: state.functions.meta,
@@ -52,7 +53,9 @@ export function serializeInspectorState(state) {
52
53
  },
53
54
  workflows: {
54
55
  meta: state.workflows.meta,
55
- files: Array.from(state.workflows.files),
56
+ files: Array.from(state.workflows.files.entries()),
57
+ graphMeta: state.workflows.graphMeta,
58
+ graphFiles: Array.from(state.workflows.graphFiles.entries()),
56
59
  },
57
60
  rpc: {
58
61
  internalMeta: state.rpc.internalMeta,
@@ -60,6 +63,7 @@ export function serializeInspectorState(state) {
60
63
  exposedMeta: state.rpc.exposedMeta,
61
64
  exposedFiles: Array.from(state.rpc.exposedFiles.entries()),
62
65
  invokedFunctions: Array.from(state.rpc.invokedFunctions),
66
+ usedExternalPackages: Array.from(state.rpc.usedExternalPackages),
63
67
  },
64
68
  mcpEndpoints: {
65
69
  resourcesMeta: state.mcpEndpoints.resourcesMeta,
@@ -71,6 +75,14 @@ export function serializeInspectorState(state) {
71
75
  meta: state.cli.meta,
72
76
  files: Array.from(state.cli.files),
73
77
  },
78
+ forgeNodes: {
79
+ meta: state.forgeNodes.meta,
80
+ files: Array.from(state.forgeNodes.files),
81
+ },
82
+ forgeCredentials: {
83
+ meta: state.forgeCredentials.meta,
84
+ files: Array.from(state.forgeCredentials.files),
85
+ },
74
86
  middleware: {
75
87
  meta: state.middleware.meta,
76
88
  tagMiddleware: Array.from(state.middleware.tagMiddleware.entries()),
@@ -85,8 +97,9 @@ export function serializeInspectorState(state) {
85
97
  usedMiddleware: Array.from(state.serviceAggregation.usedMiddleware),
86
98
  usedPermissions: Array.from(state.serviceAggregation.usedPermissions),
87
99
  allSingletonServices: state.serviceAggregation.allSingletonServices,
88
- allSessionServices: state.serviceAggregation.allSessionServices,
100
+ allWireServices: state.serviceAggregation.allWireServices,
89
101
  },
102
+ serviceMetadata: state.serviceMetadata,
90
103
  };
91
104
  }
92
105
  /**
@@ -105,18 +118,19 @@ export function deserializeInspectorState(data) {
105
118
  return {
106
119
  rootDir: data.rootDir,
107
120
  singletonServicesTypeImportMap: new Map(data.singletonServicesTypeImportMap),
108
- sessionServicesTypeImportMap: new Map(data.sessionServicesTypeImportMap),
121
+ wireServicesTypeImportMap: new Map(data.wireServicesTypeImportMap),
109
122
  userSessionTypeImportMap: new Map(data.userSessionTypeImportMap),
110
123
  configTypeImportMap: new Map(data.configTypeImportMap),
111
124
  singletonServicesFactories: new Map(data.singletonServicesFactories),
112
- sessionServicesFactories: new Map(data.sessionServicesFactories),
113
- sessionServicesMeta: new Map(data.sessionServicesMeta),
125
+ wireServicesFactories: new Map(data.wireServicesFactories),
126
+ wireServicesMeta: new Map(data.wireServicesMeta),
114
127
  configFactories: new Map(data.configFactories),
115
128
  filesAndMethods: data.filesAndMethods,
116
129
  filesAndMethodsErrors: new Map(data.filesAndMethodsErrors.map(([key, entries]) => [
117
130
  key,
118
131
  new Map(entries),
119
132
  ])),
133
+ zodLookup: new Map(data.zodLookup || []),
120
134
  functions: {
121
135
  typesMap: deserializeTypesMap(data.functions.typesMap),
122
136
  meta: data.functions.meta,
@@ -143,7 +157,9 @@ export function deserializeInspectorState(data) {
143
157
  },
144
158
  workflows: {
145
159
  meta: data.workflows.meta,
146
- files: new Set(data.workflows.files),
160
+ files: new Map(data.workflows.files),
161
+ graphMeta: data.workflows.graphMeta || {},
162
+ graphFiles: new Map(data.workflows.graphFiles || []),
147
163
  },
148
164
  rpc: {
149
165
  internalMeta: data.rpc.internalMeta,
@@ -151,6 +167,7 @@ export function deserializeInspectorState(data) {
151
167
  exposedMeta: data.rpc.exposedMeta,
152
168
  exposedFiles: new Map(data.rpc.exposedFiles),
153
169
  invokedFunctions: new Set(data.rpc.invokedFunctions),
170
+ usedExternalPackages: new Set(data.rpc.usedExternalPackages || []),
154
171
  },
155
172
  mcpEndpoints: {
156
173
  resourcesMeta: data.mcpEndpoints.resourcesMeta,
@@ -162,6 +179,14 @@ export function deserializeInspectorState(data) {
162
179
  meta: data.cli.meta,
163
180
  files: new Set(data.cli.files),
164
181
  },
182
+ forgeNodes: {
183
+ meta: data.forgeNodes?.meta || {},
184
+ files: new Set(data.forgeNodes?.files || []),
185
+ },
186
+ forgeCredentials: {
187
+ meta: data.forgeCredentials?.meta || {},
188
+ files: new Set(data.forgeCredentials?.files || []),
189
+ },
165
190
  middleware: {
166
191
  meta: data.middleware.meta,
167
192
  tagMiddleware: new Map(data.middleware.tagMiddleware),
@@ -176,7 +201,8 @@ export function deserializeInspectorState(data) {
176
201
  usedMiddleware: new Set(data.serviceAggregation.usedMiddleware),
177
202
  usedPermissions: new Set(data.serviceAggregation.usedPermissions),
178
203
  allSingletonServices: data.serviceAggregation.allSingletonServices,
179
- allSessionServices: data.serviceAggregation.allSessionServices,
204
+ allWireServices: data.serviceAggregation.allWireServices,
180
205
  },
206
+ serviceMetadata: data.serviceMetadata || [],
181
207
  };
182
208
  }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Deserialize workflow JSON back to DSL code
3
+ * Converts the serialized workflow graph format back to TypeScript DSL code
4
+ */
5
+ import type { SerializedWorkflowGraph } from '../graph/workflow-graph.types.js';
6
+ interface DeserializeOptions {
7
+ /** Import path for pikkuWorkflowFunc */
8
+ pikkuImportPath?: string;
9
+ /** Whether to include type annotations */
10
+ includeTypes?: boolean;
11
+ }
12
+ /**
13
+ * Deserialize a workflow graph to DSL code
14
+ */
15
+ export declare function deserializeDslWorkflow(workflow: SerializedWorkflowGraph, options?: DeserializeOptions): string;
16
+ /**
17
+ * Deserialize a graph workflow to pikkuWorkflowGraph code
18
+ */
19
+ export declare function deserializeGraphWorkflow(workflow: SerializedWorkflowGraph, options?: DeserializeOptions): string;
20
+ /**
21
+ * Deserialize all workflows from JSON to DSL code
22
+ */
23
+ export declare function deserializeAllDslWorkflows(workflows: Record<string, SerializedWorkflowGraph>, options?: DeserializeOptions): Record<string, string>;
24
+ export {};