@pikku/inspector 0.12.13 → 0.12.16

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 (54) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/add/add-ai-agent.js +1 -1
  3. package/dist/add/add-auth.d.ts +2 -0
  4. package/dist/add/add-auth.js +34 -0
  5. package/dist/add/add-channel.js +25 -7
  6. package/dist/add/add-functions.js +28 -13
  7. package/dist/add/add-gateway.js +1 -1
  8. package/dist/add/add-http-route.js +23 -1
  9. package/dist/add/add-mcp-prompt.js +1 -1
  10. package/dist/add/add-mcp-resource.js +1 -1
  11. package/dist/add/add-queue-worker.js +1 -1
  12. package/dist/add/add-schedule.js +1 -1
  13. package/dist/add/add-trigger.js +1 -1
  14. package/dist/add/add-workflow.js +1 -1
  15. package/dist/inspector.js +4 -0
  16. package/dist/types.d.ts +4 -0
  17. package/dist/utils/check-pii-output.d.ts +13 -8
  18. package/dist/utils/check-pii-output.js +22 -12
  19. package/dist/utils/ensure-function-metadata.js +1 -1
  20. package/dist/utils/extract-node-value.d.ts +1 -1
  21. package/dist/utils/extract-node-value.js +10 -1
  22. package/dist/utils/get-property-value.d.ts +1 -1
  23. package/dist/utils/get-property-value.js +35 -9
  24. package/dist/utils/serialize-inspector-state.d.ts +4 -0
  25. package/dist/utils/serialize-inspector-state.js +8 -0
  26. package/dist/utils/workflow/dsl/extract-dsl-workflow.js +20 -9
  27. package/dist/visit.js +2 -0
  28. package/package.json +2 -2
  29. package/src/add/add-ai-agent.ts +1 -1
  30. package/src/add/add-auth.test.ts +175 -0
  31. package/src/add/add-auth.ts +49 -0
  32. package/src/add/add-channel.ts +37 -7
  33. package/src/add/add-functions.ts +44 -13
  34. package/src/add/add-gateway.ts +1 -1
  35. package/src/add/add-http-route.ts +26 -1
  36. package/src/add/add-mcp-prompt.ts +1 -1
  37. package/src/add/add-mcp-resource.ts +1 -1
  38. package/src/add/add-queue-worker.ts +1 -1
  39. package/src/add/add-schedule.ts +1 -1
  40. package/src/add/add-trigger.ts +1 -1
  41. package/src/add/add-workflow.test.ts +152 -0
  42. package/src/add/add-workflow.ts +2 -1
  43. package/src/add/pii-check.test.ts +79 -32
  44. package/src/inspector.ts +4 -0
  45. package/src/types.ts +4 -0
  46. package/src/utils/check-pii-output.ts +41 -19
  47. package/src/utils/ensure-function-metadata.ts +3 -1
  48. package/src/utils/extract-node-value.test.ts +12 -10
  49. package/src/utils/extract-node-value.ts +15 -1
  50. package/src/utils/get-property-value.ts +33 -13
  51. package/src/utils/serialize-inspector-state.ts +12 -0
  52. package/src/utils/workflow/dsl/extract-dsl-workflow.ts +22 -9
  53. package/src/visit.ts +2 -0
  54. package/tsconfig.tsbuildinfo +1 -1
@@ -436,21 +436,34 @@ function extractExpressionStatement(
436
436
  outputVar = expr.left.text
437
437
 
438
438
  // Check if this is an assignment to a context variable (set step)
439
+ // But if the RHS is a workflow.do() call, fall through to RPC extraction —
440
+ // reassigning a pre-declared variable with a workflow step is valid and common.
439
441
  if (context.contextVars.has(outputVar)) {
440
- const literalValue = extractLiteralValue(expr.right)
441
- if (literalValue !== undefined) {
442
+ const rhs = expr.right
443
+ const rhsCall =
444
+ ts.isAwaitExpression(rhs) && ts.isCallExpression(rhs.expression)
445
+ ? rhs.expression
446
+ : null
447
+ const isWorkflowCall = rhsCall
448
+ ? isWorkflowDoCall(rhsCall, context.checker)
449
+ : false
450
+
451
+ if (!isWorkflowCall) {
452
+ const literalValue = extractLiteralValue(expr.right)
453
+ if (literalValue !== undefined) {
454
+ return {
455
+ type: 'set',
456
+ variable: outputVar,
457
+ value: literalValue,
458
+ } as SetStepMeta
459
+ }
460
+ // Non-literal assignment to context var - use expression as string
442
461
  return {
443
462
  type: 'set',
444
463
  variable: outputVar,
445
- value: literalValue,
464
+ value: getSourceText(expr.right),
446
465
  } as SetStepMeta
447
466
  }
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
467
  }
455
468
  }
456
469
  // Use right side as the expression to extract from
package/src/visit.ts CHANGED
@@ -22,6 +22,7 @@ import { addWireAddon } from './add/add-wire-addon.js'
22
22
  import { addMiddleware } from './add/add-middleware.js'
23
23
  import { addPermission } from './add/add-permission.js'
24
24
  import { addCLI, addCLIRenderers } from './add/add-cli.js'
25
+ import { addAuth } from './add/add-auth.js'
25
26
  import { addSecret } from './add/add-secret.js'
26
27
  import { addCredential } from './add/add-credential.js'
27
28
  import { addVariable } from './add/add-variable.js'
@@ -106,6 +107,7 @@ export const visitRoutes = (
106
107
  options: InspectorOptions
107
108
  ) => {
108
109
  addFunctions(logger, node, checker, state, options)
110
+ addAuth(logger, node, checker, state, options)
109
111
  addSecret(logger, node, checker, state, options)
110
112
  addCredential(logger, node, checker, state, options)
111
113
  addVariable(logger, node, checker, state, options)