@pikku/inspector 0.12.28 → 0.12.29
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 +26 -0
- package/dist/add/add-file-with-factory.js +1 -0
- package/dist/inspector.js +2 -0
- package/dist/types.d.ts +8 -0
- package/dist/utils/get-files-and-methods.d.ts +2 -1
- package/dist/utils/get-files-and-methods.js +2 -1
- package/dist/utils/load-addon-functions-meta.js +14 -0
- package/dist/utils/serialize-inspector-state.d.ts +9 -0
- package/dist/utils/serialize-inspector-state.js +4 -0
- package/dist/utils/workflow/derive-workflow-plan.js +19 -0
- package/dist/utils/workflow/dsl/extract-dsl-workflow.js +26 -1
- package/dist/utils/workflow/dsl/patterns.d.ts +4 -0
- package/dist/utils/workflow/dsl/patterns.js +12 -0
- package/dist/visit.js +1 -0
- package/package.json +2 -2
- package/src/add/add-file-with-factory.ts +1 -0
- package/src/add/pii-check.test.ts +5 -2
- package/src/inspector.ts +2 -0
- package/src/types.ts +8 -0
- package/src/utils/filter-inspector-state.test.ts +110 -1
- package/src/utils/get-files-and-methods.ts +6 -0
- package/src/utils/load-addon-functions-meta.ts +23 -0
- package/src/utils/serialize-inspector-state.ts +17 -0
- package/src/utils/workflow/derive-workflow-plan.test.ts +18 -0
- package/src/utils/workflow/derive-workflow-plan.ts +20 -0
- package/src/utils/workflow/dsl/extract-dsl-workflow.ts +31 -0
- package/src/utils/workflow/dsl/patterns.ts +19 -0
- package/src/visit.ts +6 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
ParallelGroupStepMeta,
|
|
8
8
|
FanoutStepMeta,
|
|
9
9
|
CancelStepMeta,
|
|
10
|
+
SuspendStepMeta,
|
|
10
11
|
SetStepMeta,
|
|
11
12
|
SwitchStepMeta,
|
|
12
13
|
SwitchCaseMeta,
|
|
@@ -21,6 +22,7 @@ import type {
|
|
|
21
22
|
import {
|
|
22
23
|
isWorkflowDoCall,
|
|
23
24
|
isWorkflowSleepCall,
|
|
25
|
+
isWorkflowSuspendCall,
|
|
24
26
|
isThrowCancelException,
|
|
25
27
|
extractCancelReason,
|
|
26
28
|
isParallelFanout,
|
|
@@ -512,6 +514,10 @@ function extractExpressionStatement(
|
|
|
512
514
|
return extractSleepStep(call, context)
|
|
513
515
|
}
|
|
514
516
|
|
|
517
|
+
if (isWorkflowSuspendCall(call, context.checker)) {
|
|
518
|
+
return extractSuspendStep(call, context)
|
|
519
|
+
}
|
|
520
|
+
|
|
515
521
|
// Check for parallel group or fanout
|
|
516
522
|
if (isParallelFanout(call)) {
|
|
517
523
|
return extractParallelFanout(call, context)
|
|
@@ -698,6 +704,31 @@ function extractSleepStep(
|
|
|
698
704
|
}
|
|
699
705
|
}
|
|
700
706
|
|
|
707
|
+
/**
|
|
708
|
+
* Extract suspend step from workflow.suspend() call
|
|
709
|
+
*/
|
|
710
|
+
function extractSuspendStep(
|
|
711
|
+
call: ts.CallExpression,
|
|
712
|
+
context: ExtractionContext
|
|
713
|
+
): SuspendStepMeta | null {
|
|
714
|
+
const args = call.arguments
|
|
715
|
+
if (args.length < 1) return null
|
|
716
|
+
|
|
717
|
+
try {
|
|
718
|
+
const reason = extractStringLiteral(args[0], context.checker)
|
|
719
|
+
return {
|
|
720
|
+
type: 'suspend',
|
|
721
|
+
reason,
|
|
722
|
+
}
|
|
723
|
+
} catch (error) {
|
|
724
|
+
context.errors.push({
|
|
725
|
+
message: `Failed to extract suspend step: ${error instanceof Error ? error.message : String(error)}`,
|
|
726
|
+
node: call,
|
|
727
|
+
})
|
|
728
|
+
return null
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
701
732
|
/**
|
|
702
733
|
* Extract cancel step from throw WorkflowCancelledException statement
|
|
703
734
|
*/
|
|
@@ -42,6 +42,25 @@ export function isWorkflowSleepCall(
|
|
|
42
42
|
)
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Check if a call expression is workflow.suspend()
|
|
47
|
+
*/
|
|
48
|
+
export function isWorkflowSuspendCall(
|
|
49
|
+
node: ts.CallExpression,
|
|
50
|
+
_checker: ts.TypeChecker
|
|
51
|
+
): boolean {
|
|
52
|
+
if (!ts.isPropertyAccessExpression(node.expression)) {
|
|
53
|
+
return false
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const propAccess = node.expression
|
|
57
|
+
return (
|
|
58
|
+
propAccess.name.text === 'suspend' &&
|
|
59
|
+
ts.isIdentifier(propAccess.expression) &&
|
|
60
|
+
propAccess.expression.text === 'workflow'
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
45
64
|
/**
|
|
46
65
|
* Check if a throw statement throws WorkflowCancelledException
|
|
47
66
|
* Matches: throw new WorkflowCancelledException(...) or throw WorkflowCancelledException(...)
|
package/src/visit.ts
CHANGED
|
@@ -87,6 +87,12 @@ export const visitSetup = (
|
|
|
87
87
|
)
|
|
88
88
|
|
|
89
89
|
addFileWithFactory(node, checker, state.configFactories, 'CreateConfig')
|
|
90
|
+
addFileWithFactory(
|
|
91
|
+
node,
|
|
92
|
+
checker,
|
|
93
|
+
state.serverLifecycleFactories,
|
|
94
|
+
'ServerLifecycle'
|
|
95
|
+
)
|
|
90
96
|
|
|
91
97
|
addRPCInvocations(node, state, logger)
|
|
92
98
|
addWireAddon(node, state, logger)
|