@pikku/inspector 0.12.14 → 0.12.17

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 (46) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/add/add-ai-agent.js +1 -1
  3. package/dist/add/add-channel.js +25 -7
  4. package/dist/add/add-functions.js +31 -13
  5. package/dist/add/add-gateway.js +1 -1
  6. package/dist/add/add-http-route.js +23 -1
  7. package/dist/add/add-mcp-prompt.js +1 -1
  8. package/dist/add/add-mcp-resource.js +1 -1
  9. package/dist/add/add-queue-worker.js +1 -1
  10. package/dist/add/add-schedule.js +1 -1
  11. package/dist/add/add-trigger.js +1 -1
  12. package/dist/add/add-workflow.js +1 -1
  13. package/dist/utils/check-pii-output.d.ts +9 -4
  14. package/dist/utils/check-pii-output.js +17 -7
  15. package/dist/utils/custom-types-generator.js +55 -4
  16. package/dist/utils/ensure-function-metadata.js +1 -1
  17. package/dist/utils/extract-node-value.d.ts +1 -1
  18. package/dist/utils/extract-node-value.js +10 -1
  19. package/dist/utils/get-property-value.d.ts +1 -1
  20. package/dist/utils/get-property-value.js +35 -9
  21. package/dist/utils/schema-generator.js +4 -2
  22. package/dist/utils/workflow/dsl/extract-dsl-workflow.js +43 -9
  23. package/package.json +2 -2
  24. package/src/add/add-ai-agent.ts +1 -1
  25. package/src/add/add-channel.ts +37 -7
  26. package/src/add/add-functions.ts +47 -13
  27. package/src/add/add-gateway.ts +1 -1
  28. package/src/add/add-http-route.ts +26 -1
  29. package/src/add/add-mcp-prompt.ts +1 -1
  30. package/src/add/add-mcp-resource.ts +1 -1
  31. package/src/add/add-queue-worker.ts +1 -1
  32. package/src/add/add-schedule.ts +1 -1
  33. package/src/add/add-trigger.ts +1 -1
  34. package/src/add/add-workflow.test.ts +152 -0
  35. package/src/add/add-workflow.ts +2 -1
  36. package/src/add/pii-check.test.ts +70 -28
  37. package/src/utils/check-pii-output.ts +27 -11
  38. package/src/utils/custom-types-generator.test.ts +99 -0
  39. package/src/utils/custom-types-generator.ts +64 -4
  40. package/src/utils/ensure-function-metadata.ts +3 -1
  41. package/src/utils/extract-node-value.test.ts +12 -10
  42. package/src/utils/extract-node-value.ts +15 -1
  43. package/src/utils/get-property-value.ts +33 -13
  44. package/src/utils/schema-generator.ts +4 -2
  45. package/src/utils/workflow/dsl/extract-dsl-workflow.ts +50 -11
  46. package/tsconfig.tsbuildinfo +1 -1
@@ -6,7 +6,6 @@ import type {
6
6
  BranchStepMeta,
7
7
  ParallelGroupStepMeta,
8
8
  FanoutStepMeta,
9
- ReturnStepMeta,
10
9
  CancelStepMeta,
11
10
  SetStepMeta,
12
11
  SwitchStepMeta,
@@ -436,21 +435,34 @@ function extractExpressionStatement(
436
435
  outputVar = expr.left.text
437
436
 
438
437
  // Check if this is an assignment to a context variable (set step)
438
+ // But if the RHS is a workflow.do() call, fall through to RPC extraction —
439
+ // reassigning a pre-declared variable with a workflow step is valid and common.
439
440
  if (context.contextVars.has(outputVar)) {
440
- const literalValue = extractLiteralValue(expr.right)
441
- if (literalValue !== undefined) {
441
+ const rhs = expr.right
442
+ const rhsCall =
443
+ ts.isAwaitExpression(rhs) && ts.isCallExpression(rhs.expression)
444
+ ? rhs.expression
445
+ : null
446
+ const isWorkflowCall = rhsCall
447
+ ? isWorkflowDoCall(rhsCall, context.checker)
448
+ : false
449
+
450
+ if (!isWorkflowCall) {
451
+ const literalValue = extractLiteralValue(expr.right)
452
+ if (literalValue !== undefined) {
453
+ return {
454
+ type: 'set',
455
+ variable: outputVar,
456
+ value: literalValue,
457
+ } as SetStepMeta
458
+ }
459
+ // Non-literal assignment to context var - use expression as string
442
460
  return {
443
461
  type: 'set',
444
462
  variable: outputVar,
445
- value: literalValue,
463
+ value: getSourceText(expr.right),
446
464
  } as SetStepMeta
447
465
  }
448
- // Non-literal assignment to context var - use expression as string
449
- return {
450
- type: 'set',
451
- variable: outputVar,
452
- value: getSourceText(expr.right),
453
- } as SetStepMeta
454
466
  }
455
467
  }
456
468
  // Use right side as the expression to extract from
@@ -1327,11 +1339,38 @@ function extractOutputBinding(
1327
1339
  function extractReturn(
1328
1340
  statement: ts.ReturnStatement,
1329
1341
  context: ExtractionContext
1330
- ): ReturnStepMeta | null {
1342
+ ): WorkflowStepMeta | null {
1331
1343
  if (!statement.expression) {
1332
1344
  return null
1333
1345
  }
1334
1346
 
1347
+ if (
1348
+ ts.isAwaitExpression(statement.expression) &&
1349
+ ts.isCallExpression(statement.expression.expression)
1350
+ ) {
1351
+ const call = statement.expression.expression
1352
+ if (isWorkflowDoCall(call, context.checker)) {
1353
+ return isInlineDoCall(call)
1354
+ ? extractInlineStep(call, context)
1355
+ : extractRpcStep(call, context)
1356
+ }
1357
+ if (isWorkflowSleepCall(call, context.checker)) {
1358
+ return extractSleepStep(call, context)
1359
+ }
1360
+ }
1361
+
1362
+ if (ts.isCallExpression(statement.expression)) {
1363
+ const call = statement.expression
1364
+ if (isWorkflowDoCall(call, context.checker)) {
1365
+ return isInlineDoCall(call)
1366
+ ? extractInlineStep(call, context)
1367
+ : extractRpcStep(call, context)
1368
+ }
1369
+ if (isWorkflowSleepCall(call, context.checker)) {
1370
+ return extractSleepStep(call, context)
1371
+ }
1372
+ }
1373
+
1335
1374
  if (!ts.isObjectLiteralExpression(statement.expression)) {
1336
1375
  return null
1337
1376
  }