@pikku/cli 0.11.2 → 0.11.3

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 (301) hide show
  1. package/.pikku/channel/pikku-channel-types.gen.ts +63 -6
  2. package/.pikku/channel/pikku-channels-map.gen.d.ts +4 -4
  3. package/.pikku/channel/pikku-channels-meta.gen.ts +4 -2
  4. package/.pikku/channel/pikku-channels.gen.ts +1 -1
  5. package/.pikku/cli/pikku-cli-channel.ts +1 -1
  6. package/.pikku/cli/pikku-cli-client.gen.ts +1 -1
  7. package/.pikku/cli/pikku-cli-types.gen.ts +1 -1
  8. package/.pikku/cli/pikku-cli-wirings-meta.gen.json +2 -1
  9. package/.pikku/cli/pikku-cli-wirings-meta.gen.ts +2 -2
  10. package/.pikku/cli/pikku-cli-wirings.gen.ts +1 -1
  11. package/.pikku/cli/pikku-cli.gen.ts +1 -1
  12. package/.pikku/forge/pikku-forge-types.gen.ts +83 -0
  13. package/.pikku/function/pikku-function-types.gen.ts +181 -35
  14. package/.pikku/function/pikku-functions-meta-verbose.gen.json +1030 -0
  15. package/.pikku/function/pikku-functions-meta.gen.json +88 -420
  16. package/.pikku/function/pikku-functions-meta.gen.ts +2 -2
  17. package/.pikku/http/pikku-http-types.gen.ts +19 -3
  18. package/.pikku/http/pikku-http-wirings-map.gen.d.ts +4 -4
  19. package/.pikku/http/pikku-http-wirings-meta.gen.json +9 -0
  20. package/.pikku/http/pikku-http-wirings-meta.gen.ts +4 -10
  21. package/.pikku/http/pikku-http-wirings.gen.ts +1 -1
  22. package/.pikku/mcp/pikku-mcp-types.gen.ts +69 -17
  23. package/.pikku/mcp/pikku-mcp-wirings-meta.gen.ts +4 -4
  24. package/.pikku/mcp/pikku-mcp-wirings.gen.ts +1 -1
  25. package/.pikku/pikku-bootstrap.gen.ts +7 -9
  26. package/.pikku/pikku-services.gen.ts +3 -2
  27. package/.pikku/pikku-types.gen.ts +4 -1
  28. package/.pikku/pikku-websocket.gen.ts +1 -1
  29. package/.pikku/queue/pikku-queue-types.gen.ts +1 -1
  30. package/.pikku/queue/pikku-queue-workers-wirings-map.gen.d.ts +4 -4
  31. package/.pikku/queue/pikku-queue-workers-wirings-meta.gen.ts +2 -2
  32. package/.pikku/queue/pikku-queue-workers-wirings.gen.ts +1 -1
  33. package/.pikku/rpc/pikku-remote-rpc-workers.gen.ts +4 -1
  34. package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +12 -7
  35. package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +15 -9
  36. package/.pikku/scheduler/pikku-scheduler-types.gen.ts +1 -1
  37. package/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.ts +2 -2
  38. package/.pikku/scheduler/pikku-schedulers-wirings.gen.ts +1 -1
  39. package/.pikku/schemas/register.gen.ts +9 -1
  40. package/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
  41. package/.pikku/schemas/schemas/PikkuCLIOutput.schema.json +1 -1
  42. package/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -1
  43. package/.pikku/schemas/schemas/PikkuForgeNodesOutput.schema.json +1 -0
  44. package/.pikku/schemas/schemas/PikkuFunctionsOutput.schema.json +1 -1
  45. package/.pikku/schemas/schemas/PikkuHTTPOutput.schema.json +1 -1
  46. package/.pikku/schemas/schemas/PikkuMCPOutput.schema.json +1 -1
  47. package/.pikku/schemas/schemas/PikkuMiddlewareOutput.schema.json +1 -1
  48. package/.pikku/schemas/schemas/PikkuPackageOutput.schema.json +1 -0
  49. package/.pikku/schemas/schemas/PikkuPermissionsOutput.schema.json +1 -1
  50. package/.pikku/schemas/schemas/PikkuPublicRPCOutput.schema.json +1 -1
  51. package/.pikku/schemas/schemas/PikkuQueueOutput.schema.json +1 -1
  52. package/.pikku/schemas/schemas/PikkuRPCOutput.schema.json +1 -1
  53. package/.pikku/schemas/schemas/PikkuRemoteRPCOutput.schema.json +1 -1
  54. package/.pikku/schemas/schemas/PikkuSchedulerOutput.schema.json +1 -1
  55. package/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -1
  56. package/.pikku/schemas/schemas/PikkuWorkflowOutput.schema.json +1 -1
  57. package/.pikku/services/config.gen.json +11 -6
  58. package/.pikku/services/getInspectorState.gen.json +2 -2
  59. package/.pikku/services/jwt.gen.json +2 -2
  60. package/.pikku/services/logger.gen.json +2 -2
  61. package/.pikku/services/queueService.gen.json +2 -2
  62. package/.pikku/services/schedulerService.gen.json +2 -2
  63. package/.pikku/services/schema.gen.json +2 -2
  64. package/.pikku/services/secrets.gen.json +13 -0
  65. package/.pikku/services/variables.gen.json +2 -2
  66. package/.pikku/services/workflowService.gen.json +6 -6
  67. package/.pikku/workflow/pikku-workflow-map.gen.d.ts +2 -36
  68. package/.pikku/workflow/pikku-workflow-types.gen.ts +297 -45
  69. package/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +5 -4
  70. package/.pikku/workflow/pikku-workflow-wirings.gen.ts +1 -6
  71. package/CHANGELOG.md +23 -1
  72. package/cli.schema.json +1 -1
  73. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +47 -5
  74. package/dist/.pikku/channel/pikku-channel-types.gen.js +3 -13
  75. package/dist/.pikku/channel/pikku-channels-meta.gen.js +3 -2
  76. package/dist/.pikku/channel/pikku-channels.gen.d.ts +1 -1
  77. package/dist/.pikku/channel/pikku-channels.gen.js +1 -1
  78. package/dist/.pikku/cli/pikku-cli-channel.js +1 -1
  79. package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
  80. package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -1
  81. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
  82. package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
  83. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +2 -2
  84. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +2 -1
  85. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
  86. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
  87. package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
  88. package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
  89. package/dist/.pikku/forge/pikku-forge-types.gen.d.ts +72 -0
  90. package/dist/.pikku/forge/pikku-forge-types.gen.js +55 -0
  91. package/dist/.pikku/function/pikku-function-types.gen.d.ts +123 -31
  92. package/dist/.pikku/function/pikku-function-types.gen.js +37 -51
  93. package/dist/.pikku/function/pikku-functions-meta.gen.js +2 -2
  94. package/dist/.pikku/function/pikku-functions-meta.gen.json +88 -420
  95. package/dist/.pikku/http/pikku-http-types.gen.d.ts +18 -3
  96. package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
  97. package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +3 -10
  98. package/dist/.pikku/http/pikku-http-wirings-meta.gen.json +9 -0
  99. package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
  100. package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -1
  101. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +54 -14
  102. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +7 -31
  103. package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.js +4 -4
  104. package/dist/.pikku/mcp/pikku-mcp-wirings.gen.d.ts +1 -1
  105. package/dist/.pikku/mcp/pikku-mcp-wirings.gen.js +1 -1
  106. package/dist/.pikku/pikku-bootstrap.gen.d.ts +7 -9
  107. package/dist/.pikku/pikku-bootstrap.gen.js +7 -9
  108. package/dist/.pikku/pikku-services.gen.d.ts +3 -2
  109. package/dist/.pikku/pikku-services.gen.js +1 -0
  110. package/dist/.pikku/pikku-types.gen.d.ts +2 -1
  111. package/dist/.pikku/pikku-types.gen.js +3 -1
  112. package/dist/.pikku/pikku-websocket.gen.d.ts +1 -1
  113. package/dist/.pikku/pikku-websocket.gen.js +1 -1
  114. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  115. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  116. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +2 -2
  117. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
  118. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
  119. package/dist/.pikku/rpc/pikku-remote-rpc-workers.gen.d.ts +4 -1
  120. package/dist/.pikku/rpc/pikku-remote-rpc-workers.gen.js +4 -1
  121. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  122. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  123. package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.js +2 -2
  124. package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.d.ts +1 -1
  125. package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.js +1 -1
  126. package/dist/.pikku/schemas/register.gen.js +5 -1
  127. package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
  128. package/dist/.pikku/schemas/schemas/PikkuCLIOutput.schema.json +1 -1
  129. package/dist/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -1
  130. package/dist/.pikku/schemas/schemas/PikkuForgeNodesOutput.schema.json +1 -0
  131. package/dist/.pikku/schemas/schemas/PikkuFunctionsOutput.schema.json +1 -1
  132. package/dist/.pikku/schemas/schemas/PikkuHTTPOutput.schema.json +1 -1
  133. package/dist/.pikku/schemas/schemas/PikkuMCPOutput.schema.json +1 -1
  134. package/dist/.pikku/schemas/schemas/PikkuMiddlewareOutput.schema.json +1 -1
  135. package/dist/.pikku/schemas/schemas/PikkuPackageOutput.schema.json +1 -0
  136. package/dist/.pikku/schemas/schemas/PikkuPermissionsOutput.schema.json +1 -1
  137. package/dist/.pikku/schemas/schemas/PikkuPublicRPCOutput.schema.json +1 -1
  138. package/dist/.pikku/schemas/schemas/PikkuQueueOutput.schema.json +1 -1
  139. package/dist/.pikku/schemas/schemas/PikkuRPCOutput.schema.json +1 -1
  140. package/dist/.pikku/schemas/schemas/PikkuRemoteRPCOutput.schema.json +1 -1
  141. package/dist/.pikku/schemas/schemas/PikkuSchedulerOutput.schema.json +1 -1
  142. package/dist/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -1
  143. package/dist/.pikku/schemas/schemas/PikkuWorkflowOutput.schema.json +1 -1
  144. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +207 -37
  145. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +104 -28
  146. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +3 -3
  147. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +2 -6
  148. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +2 -6
  149. package/dist/src/functions/commands/all.js +117 -79
  150. package/dist/src/functions/commands/bootstrap.js +2 -9
  151. package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.js +0 -1
  152. package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.js +49 -35
  153. package/dist/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.js +49 -35
  154. package/dist/src/functions/wirings/channels/pikku-channels.js +1 -1
  155. package/dist/src/functions/wirings/channels/pikku-command-channels.js +18 -2
  156. package/dist/src/functions/wirings/channels/serialize-channel-types.js +62 -5
  157. package/dist/src/functions/wirings/channels/serialize-typed-channel-map.js +1 -2
  158. package/dist/src/functions/wirings/cli/pikku-command-cli.js +10 -2
  159. package/dist/src/functions/wirings/forge/pikku-command-forge-nodes.d.ts +1 -0
  160. package/dist/src/functions/wirings/forge/pikku-command-forge-nodes.js +90 -0
  161. package/dist/src/functions/wirings/forge/pikku-command-forge-types.d.ts +1 -0
  162. package/dist/src/functions/wirings/forge/pikku-command-forge-types.js +26 -0
  163. package/dist/src/functions/wirings/forge/serialize-forge-types.d.ts +4 -0
  164. package/dist/src/functions/wirings/forge/serialize-forge-types.js +90 -0
  165. package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +1 -1
  166. package/dist/src/functions/wirings/functions/pikku-command-function-types.js +7 -2
  167. package/dist/src/functions/wirings/functions/pikku-command-functions.js +33 -18
  168. package/dist/src/functions/wirings/functions/pikku-command-services.js +1 -1
  169. package/dist/src/functions/wirings/functions/pikku-function-types.js +2 -2
  170. package/dist/src/functions/wirings/functions/schemas.d.ts +1 -1
  171. package/dist/src/functions/wirings/functions/schemas.js +5 -4
  172. package/dist/src/functions/wirings/functions/serialize-function-imports.d.ts +3 -1
  173. package/dist/src/functions/wirings/functions/serialize-function-imports.js +7 -3
  174. package/dist/src/functions/wirings/functions/serialize-function-types.d.ts +1 -1
  175. package/dist/src/functions/wirings/functions/serialize-function-types.js +181 -34
  176. package/dist/src/functions/wirings/functions/serialize-pikku-types-hub.d.ts +1 -1
  177. package/dist/src/functions/wirings/functions/serialize-pikku-types-hub.js +19 -21
  178. package/dist/src/functions/wirings/http/openapi-spec-generator.js +1 -1
  179. package/dist/src/functions/wirings/http/pikku-command-http-routes.js +18 -2
  180. package/dist/src/functions/wirings/http/pikku-command-openapi.js +2 -2
  181. package/dist/src/functions/wirings/http/pikku-http-routes.js +1 -1
  182. package/dist/src/functions/wirings/http/serialize-http-types.js +18 -2
  183. package/dist/src/functions/wirings/http/serialize-typed-http-map.js +33 -8
  184. package/dist/src/functions/wirings/mcp/pikku-command-mcp.js +15 -6
  185. package/dist/src/functions/wirings/mcp/serialize-mcp-json.js +3 -2
  186. package/dist/src/functions/wirings/mcp/serialize-mcp-types.js +68 -16
  187. package/dist/src/functions/wirings/middleware/pikku-command-middleware.js +5 -2
  188. package/dist/src/functions/wirings/package/pikku-command-package.d.ts +1 -0
  189. package/dist/src/functions/wirings/package/pikku-command-package.js +58 -0
  190. package/dist/src/functions/wirings/package/serialize-package.d.ts +5 -0
  191. package/dist/src/functions/wirings/package/serialize-package.js +32 -0
  192. package/dist/src/functions/wirings/queue/pikku-command-queue.js +10 -2
  193. package/dist/src/functions/wirings/queue/pikku-queue.js +1 -9
  194. package/dist/src/functions/wirings/queue/serialize-queue-map.js +20 -3
  195. package/dist/src/functions/wirings/queue/serialize-queue-meta.js +1 -1
  196. package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.js +4 -4
  197. package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +1 -1
  198. package/dist/src/functions/wirings/rpc/serialize-remote-rpc.js +3 -0
  199. package/dist/src/functions/wirings/rpc/serialize-rpc-wrapper.js +1 -1
  200. package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.d.ts +1 -1
  201. package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.js +54 -8
  202. package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.js +10 -1
  203. package/dist/src/functions/wirings/scheduler/serialize-scheduler-meta.js +1 -1
  204. package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +56 -18
  205. package/dist/src/functions/wirings/workflow/serialize-workflow-map.d.ts +3 -0
  206. package/dist/src/functions/wirings/workflow/serialize-workflow-map.js +30 -32
  207. package/dist/src/functions/wirings/workflow/serialize-workflow-meta.d.ts +1 -3
  208. package/dist/src/functions/wirings/workflow/serialize-workflow-meta.js +43 -18
  209. package/dist/src/functions/wirings/workflow/serialize-workflow-registration.d.ts +7 -0
  210. package/dist/src/functions/wirings/workflow/serialize-workflow-registration.js +53 -0
  211. package/dist/src/functions/wirings/workflow/serialize-workflow-types.d.ts +3 -1
  212. package/dist/src/functions/wirings/workflow/serialize-workflow-types.js +299 -45
  213. package/dist/src/functions/wirings/workflow/serialize-workflow-workers.d.ts +1 -1
  214. package/dist/src/functions/wirings/workflow/serialize-workflow-workers.js +14 -27
  215. package/dist/src/services.js +4 -1
  216. package/dist/src/utils/command-summary.d.ts +2 -0
  217. package/dist/src/utils/command-summary.js +2 -0
  218. package/dist/src/utils/custom-types-generator.js +13 -15
  219. package/dist/src/utils/generate-bootstrap-file.js +1 -1
  220. package/dist/src/utils/pikku-cli-config.js +37 -9
  221. package/dist/src/utils/schema-generator.d.ts +4 -3
  222. package/dist/src/utils/schema-generator.js +135 -15
  223. package/dist/src/utils/strip-verbose-meta.d.ts +43 -0
  224. package/dist/src/utils/strip-verbose-meta.js +210 -0
  225. package/dist/tsconfig.tsbuildinfo +1 -1
  226. package/package.json +7 -4
  227. package/src/functions/commands/all.ts +144 -97
  228. package/src/functions/commands/bootstrap.ts +2 -10
  229. package/src/functions/runtimes/nextjs/pikku-command-nextjs.ts +0 -1
  230. package/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.ts +49 -35
  231. package/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.ts +49 -35
  232. package/src/functions/wirings/channels/pikku-channels.ts +1 -1
  233. package/src/functions/wirings/channels/pikku-command-channels.ts +46 -3
  234. package/src/functions/wirings/channels/serialize-channel-types.ts +62 -5
  235. package/src/functions/wirings/channels/serialize-typed-channel-map.ts +3 -2
  236. package/src/functions/wirings/cli/pikku-command-cli.ts +21 -2
  237. package/src/functions/wirings/forge/pikku-command-forge-nodes.ts +135 -0
  238. package/src/functions/wirings/forge/pikku-command-forge-types.ts +38 -0
  239. package/src/functions/wirings/forge/serialize-forge-types.ts +94 -0
  240. package/src/functions/wirings/functions/pikku-command-function-types-split.ts +3 -2
  241. package/src/functions/wirings/functions/pikku-command-function-types.ts +17 -10
  242. package/src/functions/wirings/functions/pikku-command-functions.ts +47 -37
  243. package/src/functions/wirings/functions/pikku-command-services.ts +1 -1
  244. package/src/functions/wirings/functions/pikku-function-types.ts +3 -1
  245. package/src/functions/wirings/functions/schemas.ts +14 -4
  246. package/src/functions/wirings/functions/serialize-function-imports.ts +12 -3
  247. package/src/functions/wirings/functions/serialize-function-types.ts +182 -34
  248. package/src/functions/wirings/functions/serialize-pikku-types-hub.ts +27 -26
  249. package/src/functions/wirings/http/openapi-spec-generator.ts +1 -1
  250. package/src/functions/wirings/http/pikku-command-http-routes.ts +46 -2
  251. package/src/functions/wirings/http/pikku-command-openapi.ts +3 -2
  252. package/src/functions/wirings/http/pikku-http-routes.ts +1 -1
  253. package/src/functions/wirings/http/serialize-http-types.ts +18 -2
  254. package/src/functions/wirings/http/serialize-typed-http-map.ts +32 -8
  255. package/src/functions/wirings/mcp/pikku-command-mcp.ts +32 -10
  256. package/src/functions/wirings/mcp/serialize-mcp-json.ts +8 -6
  257. package/src/functions/wirings/mcp/serialize-mcp-types.ts +68 -16
  258. package/src/functions/wirings/middleware/pikku-command-middleware.ts +6 -2
  259. package/src/functions/wirings/package/pikku-command-package.ts +81 -0
  260. package/src/functions/wirings/package/serialize-package.ts +69 -0
  261. package/src/functions/wirings/queue/pikku-command-queue.ts +22 -2
  262. package/src/functions/wirings/queue/pikku-queue.ts +1 -10
  263. package/src/functions/wirings/queue/serialize-queue-map.ts +18 -3
  264. package/src/functions/wirings/queue/serialize-queue-meta.ts +1 -1
  265. package/src/functions/wirings/rpc/pikku-command-rpc-map.ts +7 -4
  266. package/src/functions/wirings/rpc/pikku-command-rpc.ts +1 -1
  267. package/src/functions/wirings/rpc/serialize-remote-rpc.ts +3 -0
  268. package/src/functions/wirings/rpc/serialize-rpc-wrapper.ts +1 -1
  269. package/src/functions/wirings/rpc/serialize-typed-rpc-map.ts +74 -8
  270. package/src/functions/wirings/scheduler/pikku-command-scheduler.ts +22 -1
  271. package/src/functions/wirings/scheduler/serialize-scheduler-meta.ts +1 -1
  272. package/src/functions/wirings/workflow/pikku-command-workflow.ts +104 -37
  273. package/src/functions/wirings/workflow/serialize-workflow-map.ts +38 -40
  274. package/src/functions/wirings/workflow/serialize-workflow-meta.ts +66 -26
  275. package/src/functions/wirings/workflow/serialize-workflow-registration.ts +83 -0
  276. package/src/functions/wirings/workflow/serialize-workflow-types.ts +299 -45
  277. package/src/functions/wirings/workflow/serialize-workflow-workers.ts +14 -27
  278. package/src/services.ts +8 -1
  279. package/src/utils/command-summary.ts +4 -0
  280. package/src/utils/custom-types-generator.ts +15 -15
  281. package/src/utils/generate-bootstrap-file.ts +1 -1
  282. package/src/utils/pikku-cli-config.ts +51 -18
  283. package/src/utils/schema-generator.ts +185 -22
  284. package/src/utils/strip-verbose-meta.ts +254 -0
  285. package/types/config.d.ts +37 -3
  286. package/.pikku/function/pikku-functions-meta.min.gen.json +0 -212
  287. package/.pikku/function/pikku-functions-meta.min.gen.ts +0 -6
  288. package/dist/.pikku/function/pikku-functions-meta.min.gen.d.ts +0 -1
  289. package/dist/.pikku/function/pikku-functions-meta.min.gen.js +0 -6
  290. package/dist/.pikku/function/pikku-functions-meta.min.gen.json +0 -212
  291. package/dist/src/functions/wirings/workflow/pikku-command-workflow-map.d.ts +0 -1
  292. package/dist/src/functions/wirings/workflow/pikku-command-workflow-map.js +0 -12
  293. package/dist/src/functions/wirings/workflow/pikku-command-workflow-types.d.ts +0 -1
  294. package/dist/src/functions/wirings/workflow/pikku-command-workflow-types.js +0 -13
  295. package/dist/src/functions/wirings/workflow/serialize-workflow-wirings.d.ts +0 -8
  296. package/dist/src/functions/wirings/workflow/serialize-workflow-wirings.js +0 -30
  297. package/src/functions/wirings/workflow/pikku-command-workflow-map.ts +0 -24
  298. package/src/functions/wirings/workflow/pikku-command-workflow-types.ts +0 -29
  299. package/src/functions/wirings/workflow/serialize-workflow-wirings.ts +0 -47
  300. /package/.pikku/{workflow/pikku-workflow-wirings-meta.gen.json → channel/pikku-channels-meta.gen.json} +0 -0
  301. /package/dist/.pikku/{workflow/pikku-workflow-wirings-meta.gen.json → channel/pikku-channels-meta.gen.json} +0 -0
@@ -1,23 +1,29 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.11.2
2
+ * This file was generated by @pikku/cli@0.11.3
3
3
  */
4
4
  /**
5
- * Workflow-specific type definitions for tree-shaking optimization
5
+ * Workflow type definitions and helpers
6
+ * Used for authoring both DSL and graph-based workflows
6
7
  */
7
8
 
8
- import { PikkuWorkflowWire, WorkflowStepOptions } from '@pikku/core/workflow'
9
+ import { PikkuWorkflowWire, WorkflowStepOptions, WorkflowCancelledException } from '@pikku/core/workflow'
10
+
11
+ // Re-export WorkflowCancelledException for use in workflow functions
12
+ export { WorkflowCancelledException }
9
13
  import type { PikkuFunctionSessionless, PikkuFunctionConfig } from '../function/pikku-function-types.gen.js'
10
- import type { RPCMap } from '../rpc/pikku-rpc-wirings-map.internal.gen.d.js'
14
+ import type { RPCMap, FlattenedRPCMap } from '../rpc/pikku-rpc-wirings-map.internal.gen.d.js'
15
+ import type { GraphNodeConfig, HTTPMethod } from '@pikku/core'
16
+ import { createGraph, wireWorkflow as coreWireWorkflow } from '@pikku/core'
17
+
18
+ // ============================================================================
19
+ // DSL Workflow Types (pikkuWorkflowFunc, pikkuWorkflowComplexFunc)
20
+ // ============================================================================
11
21
 
12
22
  /**
13
23
  * Typed workflow wire with RPC awareness
14
24
  * Provides type-safe workflow.do() for RPC steps
15
25
  */
16
26
  export interface TypedWorkflow extends PikkuWorkflowWire {
17
- /**
18
- * Execute a workflow step with RPC invocation (typed based on available RPCs)
19
- * @template K - RPC name from the RPC map
20
- */
21
27
  do<K extends keyof RPCMap>(
22
28
  stepName: string,
23
29
  rpcName: K,
@@ -25,10 +31,6 @@ export interface TypedWorkflow extends PikkuWorkflowWire {
25
31
  options?: WorkflowStepOptions
26
32
  ): Promise<RPCMap[K]['output']>
27
33
 
28
- /**
29
- * Execute a workflow step with inline function
30
- * @template T - Return type of the inline function
31
- */
32
34
  do<T>(
33
35
  stepName: string,
34
36
  fn: () => T | Promise<T>,
@@ -38,28 +40,14 @@ export interface TypedWorkflow extends PikkuWorkflowWire {
38
40
 
39
41
  /**
40
42
  * Workflow function type with typed workflow service
41
- * Includes the workflow wire object with typed RPC methods
42
43
  */
43
44
  export type PikkuFunctionWorkflow<
44
45
  In = unknown,
45
46
  Out = never
46
- > = PikkuFunctionSessionless<
47
- In,
48
- Out,
49
- 'workflow'
50
- >
47
+ > = PikkuFunctionSessionless<In, Out, 'workflow'>
51
48
 
52
49
  /**
53
- * Creates a workflow function with typed input and output.
54
- * Workflow functions have access to the workflow wire object for step execution.
55
- *
56
- * This is the permissive mode - workflows that don't conform to simple DSL will fall back
57
- * to basic extraction with a warning.
58
- *
59
- * @template In - Input type for the workflow
60
- * @template Out - Output type for the workflow
61
- * @param func - Function definition, either direct function or configuration object
62
- * @returns The normalized configuration object
50
+ * Creates a DSL-compatible workflow function (serializable, shows in Forge UI)
63
51
  */
64
52
  export const pikkuWorkflowFunc = <In, Out = unknown>(
65
53
  func:
@@ -70,24 +58,9 @@ export const pikkuWorkflowFunc = <In, Out = unknown>(
70
58
  }
71
59
 
72
60
  /**
73
- * Creates a simple workflow function with typed input and output.
74
- * Simple workflows must conform to the restricted DSL for static analysis.
75
- *
76
- * This is the strict mode - workflows that don't conform to simple DSL will cause
77
- * a critical error during inspection.
78
- *
79
- * Constraints:
80
- * - Must use only workflow.do() with RPC form (no inline functions)
81
- * - Only if/else, for..of, and Promise.all(array.map()) control flow allowed
82
- * - Step names must be unique (except across mutually exclusive branches)
83
- * - All workflow calls must be awaited
84
- *
85
- * @template In - Input type for the workflow
86
- * @template Out - Output type for the workflow
87
- * @param func - Function definition, either direct function or configuration object
88
- * @returns The normalized configuration object
61
+ * Creates a complex workflow function (arbitrary code, hidden from Forge UI)
89
62
  */
90
- export const pikkuSimpleWorkflowFunc = <In, Out = unknown>(
63
+ export const pikkuWorkflowComplexFunc = <In, Out = unknown>(
91
64
  func:
92
65
  | PikkuFunctionWorkflow<In, Out>
93
66
  | PikkuFunctionConfig<In, Out, 'workflow', PikkuFunctionWorkflow<In, Out>>
@@ -95,3 +68,282 @@ export const pikkuSimpleWorkflowFunc = <In, Out = unknown>(
95
68
  return typeof func === 'function' ? { func } : func
96
69
  }
97
70
 
71
+ // ============================================================================
72
+ // Graph Workflow Types (pikkuWorkflowGraph)
73
+ // ============================================================================
74
+
75
+ /**
76
+ * Type-safe graph builder with full RPC autocomplete
77
+ */
78
+ const graphBuilder = createGraph<FlattenedRPCMap>()
79
+
80
+ /** HTTP wire configuration for graph workflows */
81
+ interface GraphHttpWire<NodeIds extends string> {
82
+ route: string
83
+ method: HTTPMethod
84
+ startNode: NodeIds
85
+ }
86
+
87
+ /** Channel wire configuration for graph workflows */
88
+ interface GraphChannelWire<NodeIds extends string> {
89
+ name: string
90
+ onConnect?: NodeIds
91
+ onDisconnect?: NodeIds
92
+ onMessage?: NodeIds
93
+ }
94
+
95
+ /** Queue wire configuration for graph workflows */
96
+ interface GraphQueueWire<NodeIds extends string> {
97
+ name: string
98
+ startNode: NodeIds
99
+ }
100
+
101
+ /** CLI wire configuration for graph workflows */
102
+ interface GraphCliWire<NodeIds extends string> {
103
+ command: string
104
+ startNode: NodeIds
105
+ }
106
+
107
+ /** MCP wire configurations for graph workflows */
108
+ interface GraphMcpWires<NodeIds extends string> {
109
+ tool?: Array<{ name: string; startNode: NodeIds }>
110
+ prompt?: Array<{ name: string; startNode: NodeIds }>
111
+ resource?: Array<{ uri: string; startNode: NodeIds }>
112
+ }
113
+
114
+ /** Schedule wire configuration for graph workflows */
115
+ interface GraphScheduleWire<NodeIds extends string> {
116
+ cron?: string
117
+ interval?: string
118
+ startNode: NodeIds
119
+ }
120
+
121
+ /** Trigger wire configuration for graph workflows */
122
+ interface GraphTriggerWire<NodeIds extends string> {
123
+ name: string // RPC name of the trigger function
124
+ startNode: NodeIds
125
+ }
126
+
127
+ /** All wire configurations for graph workflows */
128
+ interface GraphWiresConfig<NodeIds extends string> {
129
+ http?: Array<GraphHttpWire<NodeIds>>
130
+ channel?: Array<GraphChannelWire<NodeIds>>
131
+ queue?: Array<GraphQueueWire<NodeIds>>
132
+ cli?: Array<GraphCliWire<NodeIds>>
133
+ mcp?: GraphMcpWires<NodeIds>
134
+ schedule?: Array<GraphScheduleWire<NodeIds>>
135
+ trigger?: Array<GraphTriggerWire<NodeIds>>
136
+ }
137
+
138
+ /** Configuration for graph-based workflow */
139
+ export interface PikkuWorkflowGraphConfig<
140
+ FuncMap extends Record<string, keyof FlattenedRPCMap & string>,
141
+ T
142
+ > {
143
+ /** Workflow name (optional - defaults to exported variable name) */
144
+ name?: string
145
+ /** Optional description */
146
+ description?: string
147
+ /** Optional tags for organization */
148
+ tags?: string[]
149
+ /** Node to RPC function mapping */
150
+ nodes: FuncMap
151
+ /** Wire configurations - how this workflow can be triggered */
152
+ wires?: GraphWiresConfig<Extract<keyof FuncMap, string>>
153
+ /** Node configurations (next, input, onError) */
154
+ config?: T
155
+ }
156
+
157
+ /** Result of pikkuWorkflowGraph - includes metadata for wiring */
158
+ export interface PikkuWorkflowGraphResult<T, NodeIds extends string = string> {
159
+ __type: 'pikkuWorkflowGraph'
160
+ name?: string
161
+ description?: string
162
+ tags?: string[]
163
+ wires?: GraphWiresConfig<NodeIds>
164
+ graph: T
165
+ }
166
+
167
+ /**
168
+ * Creates a graph-based workflow definition with metadata
169
+ * Name defaults to the exported variable name if not provided.
170
+ *
171
+ * @example
172
+ * // Name inferred from exported variable name
173
+ * export const myWorkflow = pikkuWorkflowGraph({
174
+ * description: 'Handles user onboarding',
175
+ * tags: ['onboarding'],
176
+ * nodes: {
177
+ * entry: 'createUser',
178
+ * sendEmail: 'sendWelcomeEmail',
179
+ * },
180
+ * config: {
181
+ * entry: { next: 'sendEmail' },
182
+ * sendEmail: { input: (ref) => ({ to: ref('entry', 'email') }) },
183
+ * },
184
+ * })
185
+ */
186
+ export function pikkuWorkflowGraph<
187
+ const FuncMap extends Record<string, keyof FlattenedRPCMap & string>
188
+ >(
189
+ config: PikkuWorkflowGraphConfig<FuncMap, GraphNodeConfigMap<FuncMap>>
190
+ ): PikkuWorkflowGraphResult<Record<Extract<keyof FuncMap, string>, GraphNodeConfig<Extract<keyof FuncMap, string>>>, Extract<keyof FuncMap, string>> {
191
+ return {
192
+ __type: 'pikkuWorkflowGraph',
193
+ name: config.name,
194
+ description: config.description,
195
+ tags: config.tags,
196
+ wires: config.wires,
197
+ graph: graphBuilder(config.nodes, config.config as any),
198
+ }
199
+ }
200
+
201
+ /** Typed ref value */
202
+ type TypedRef<T> = { $ref: string; path?: string } & { __phantomType?: T }
203
+
204
+ /** Template string type - assignable to string fields */
205
+ type TemplateString = {
206
+ $template: {
207
+ parts: string[]
208
+ expressions: Array<{ $ref: string; path?: string }>
209
+ }
210
+ } & { __brand: 'TemplateString' }
211
+
212
+ /**
213
+ * Creates a template string with variable interpolation
214
+ * Uses indexed placeholders $0, $1, etc. with refs array
215
+ *
216
+ * @example
217
+ * template('Hello $0, your order $1 is ready', [ref('trigger', 'name'), ref('step_0', 'orderId')])
218
+ */
219
+ export function template(templateStr: string, refs: TypedRef<unknown>[]): TemplateString {
220
+ const parts: string[] = []
221
+ const expressions: Array<{ $ref: string; path?: string }> = []
222
+
223
+ // Parse template string: "Hello $0" -> parts: ["Hello ", ""], use refs[0] for expression
224
+ const regex = /$(d+)/g
225
+ let lastIndex = 0
226
+ let match
227
+
228
+ while ((match = regex.exec(templateStr)) !== null) {
229
+ // Add the part before this match
230
+ parts.push(templateStr.slice(lastIndex, match.index))
231
+
232
+ // Get the ref by index
233
+ const refIndex = parseInt(match[1]!, 10)
234
+ const refValue = refs[refIndex]
235
+ if (refValue) {
236
+ const expr: { $ref: string; path?: string } = { $ref: refValue.$ref }
237
+ if (refValue.path) {
238
+ expr.path = refValue.path
239
+ }
240
+ expressions.push(expr)
241
+ } else {
242
+ expressions.push({ $ref: 'unknown' })
243
+ }
244
+
245
+ lastIndex = regex.lastIndex
246
+ }
247
+
248
+ // Add the remaining part
249
+ parts.push(templateStr.slice(lastIndex))
250
+
251
+ return {
252
+ $template: { parts, expressions }
253
+ } as TemplateString
254
+ }
255
+
256
+ /** Map input type fields to allow TypedRef or TemplateString for any field */
257
+ type InputWithRefs<T> = {
258
+ [K in keyof T]?: T[K] | TypedRef<T[K]> | TypedRef<unknown> | TemplateString
259
+ }
260
+
261
+ /** Get the input type for a node based on its RPC mapping */
262
+ type NodeInputType<FuncMap extends Record<string, string>, K extends keyof FuncMap> =
263
+ FuncMap[K] extends keyof FlattenedRPCMap
264
+ ? InputWithRefs<FlattenedRPCMap[FuncMap[K]]['input']>
265
+ : Record<string, unknown>
266
+
267
+ /** Get the output type keys for a node based on its RPC mapping */
268
+ type NodeOutputKeys<FuncMap extends Record<string, string>, N extends string> =
269
+ N extends keyof FuncMap
270
+ ? FuncMap[N] extends keyof FlattenedRPCMap
271
+ ? keyof FlattenedRPCMap[FuncMap[N]]['output'] & string
272
+ : string
273
+ : string
274
+
275
+ /** Ref function type with path validation */
276
+ type RefFunction<FuncMap extends Record<string, string>> = {
277
+ <N extends Extract<keyof FuncMap, string>>(
278
+ nodeId: N,
279
+ path: NodeOutputKeys<FuncMap, N>
280
+ ): TypedRef<unknown>
281
+ (nodeId: 'trigger' | '$item', path?: string): TypedRef<unknown>
282
+ }
283
+
284
+ /** Template function type */
285
+ type TemplateFunction = (templateStr: string, refs: TypedRef<unknown>[]) => TemplateString
286
+
287
+ /** Type helper for node configuration */
288
+ type GraphNodeConfigMap<FuncMap extends Record<string, string>> = {
289
+ [K in Extract<keyof FuncMap, string>]?: {
290
+ next?: NextConfig<Extract<keyof FuncMap, string>>
291
+ input?:
292
+ | NodeInputType<FuncMap, K>
293
+ | (() => NodeInputType<FuncMap, K>)
294
+ | ((ref: RefFunction<FuncMap>, template: TemplateFunction) => NodeInputType<FuncMap, K>)
295
+ onError?: Extract<keyof FuncMap, string> | Extract<keyof FuncMap, string>[]
296
+ }
297
+ }
298
+
299
+ type NextConfig<NodeIds extends string> = NodeIds | NodeIds[] | { if: string; then: NodeIds; else?: NodeIds }
300
+
301
+ // ============================================================================
302
+ // Unified wireWorkflow
303
+ // ============================================================================
304
+
305
+ /** Workflow definition with DSL function */
306
+ interface WorkflowDefinitionFunc {
307
+ /** Whether this workflow wiring is enabled (default: true) */
308
+ enabled?: boolean
309
+ /** Wire configurations for the workflow */
310
+ wires: {
311
+ http?: { route: string; method: HTTPMethod }
312
+ channel?: string
313
+ queue?: string
314
+ }
315
+ /** DSL workflow function */
316
+ func: PikkuFunctionConfig<any, any, 'workflow', PikkuFunctionWorkflow<any, any>>
317
+ }
318
+
319
+ /** Workflow definition with graph */
320
+ interface WorkflowDefinitionGraph<T, NodeIds extends string = string> {
321
+ /** Whether this workflow wiring is enabled (default: true) */
322
+ enabled?: boolean
323
+ /** Graph workflow definition - wires are defined in the graph itself */
324
+ graph: PikkuWorkflowGraphResult<T, NodeIds>
325
+ }
326
+
327
+ /**
328
+ * Wire a workflow with wires
329
+ * Accepts either a DSL function (func) or a graph definition (graph)
330
+ *
331
+ * @example
332
+ * // DSL workflow
333
+ * wireWorkflow({
334
+ * wires: { http: { route: '/start', method: 'post' } },
335
+ * func: myWorkflowFunc,
336
+ * })
337
+ *
338
+ * @example
339
+ * // Graph workflow - wires are defined in the graph itself
340
+ * wireWorkflow({
341
+ * enabled: true, // default: true
342
+ * graph: myGraphWorkflow,
343
+ * })
344
+ */
345
+ export function wireWorkflow<T extends Record<string, GraphNodeConfig<Extract<keyof T, string>>>, NodeIds extends string = string>(
346
+ definition: WorkflowDefinitionFunc | WorkflowDefinitionGraph<T, NodeIds>
347
+ ): void {
348
+ coreWireWorkflow(definition as any)
349
+ }
@@ -1,8 +1,9 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.11.2
2
+ * This file was generated by @pikku/cli@0.11.3
3
3
  */
4
4
  import { pikkuState } from '@pikku/core'
5
- import { WorkflowsMeta } from '@pikku/core/workflow'
6
- import metaData from './pikku-workflow-wirings-meta.gen.json' with { type: 'json' }
5
+ import type { SerializedWorkflowGraphs } from '@pikku/inspector/workflow-graph'
7
6
 
8
- pikkuState('workflows', 'meta', metaData as WorkflowsMeta)
7
+ const workflowsMeta: SerializedWorkflowGraphs = {}
8
+
9
+ pikkuState(null, 'workflows', 'meta', workflowsMeta)
@@ -1,8 +1,3 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.11.2
2
+ * This file was generated by @pikku/cli@0.11.3
3
3
  */
4
- /**
5
- * Auto-generated workflow registrations
6
- * Do not edit manually - regenerate with 'npx pikku'
7
- */
8
-
package/CHANGELOG.md CHANGED
@@ -1,4 +1,26 @@
1
- ## 0.11.0
1
+ ## 0.11.3
2
+
3
+ ## 0.11.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 14a3dcd: fix: nextjs rpc route wasn't working
8
+ - db9c7bf: Add workflow graph code generation and fix HTTP routes count
9
+ - Updated dependencies [db9c7bf]
10
+ - Updated dependencies [db9c7bf]
11
+ - @pikku/core@0.11.2
12
+ - @pikku/inspector@0.11.2
13
+
14
+ ### Features
15
+
16
+ - f35e89da: Add workflow graph code generation
17
+ - Workflow graph serialization and type generation
18
+ - DSL to graph conversion for workflow metadata
19
+
20
+ ### Fixes
21
+
22
+ - ddd87eaf: Make CreateWireServices type compatible with custom Config types
23
+ - c42aad80: Correct HTTP routes count in CLI summary (was showing method count instead of route count)
2
24
 
3
25
  ## 0.11.2
4
26
 
package/cli.schema.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"http://json-schema.org/draft-07/schema#","type":"object","additionalProperties":false,"properties":{"outDir":{"type":"string"},"schemaDirectory":{"type":"string"},"typesDeclarationFile":{"type":"string"},"functionsFile":{"type":"string"},"functionsMetaFile":{"type":"string"},"functionsMetaJsonFile":{"type":"string"},"functionsMetaMinFile":{"type":"string"},"functionsMetaMinJsonFile":{"type":"string"},"functionTypesFile":{"type":"string"},"httpWiringsFile":{"type":"string"},"httpWiringMetaFile":{"type":"string"},"httpWiringMetaJsonFile":{"type":"string"},"httpMapDeclarationFile":{"type":"string"},"httpTypesFile":{"type":"string"},"channelsWiringFile":{"type":"string"},"channelsWiringMetaFile":{"type":"string"},"channelsWiringMetaJsonFile":{"type":"string"},"channelsMapDeclarationFile":{"type":"string"},"channelsTypesFile":{"type":"string"},"rpcInternalWiringMetaFile":{"type":"string"},"rpcInternalWiringMetaJsonFile":{"type":"string"},"rpcInternalMapDeclarationFile":{"type":"string"},"rpcMapDeclarationFile":{"type":"string"},"schedulersWiringFile":{"type":"string"},"schedulersWiringMetaFile":{"type":"string"},"schedulersWiringMetaJsonFile":{"type":"string"},"schedulersTypesFile":{"type":"string"},"queueWorkersWiringFile":{"type":"string"},"queueWorkersWiringMetaFile":{"type":"string"},"queueWorkersWiringMetaJsonFile":{"type":"string"},"queueMapDeclarationFile":{"type":"string"},"queueTypesFile":{"type":"string"},"workflowsWiringFile":{"type":"string"},"workflowsWiringMetaFile":{"type":"string"},"workflowsWiringMetaJsonFile":{"type":"string"},"workflowsWorkersFile":{"type":"string"},"workflowMapDeclarationFile":{"type":"string"},"workflowTypesFile":{"type":"string"},"mcpWiringsFile":{"type":"string"},"mcpWiringsMetaFile":{"type":"string"},"mcpWiringsMetaJsonFile":{"type":"string"},"mcpTypesFile":{"type":"string"},"cliWiringsFile":{"type":"string"},"cliWiringMetaFile":{"type":"string"},"cliWiringMetaJsonFile":{"type":"string"},"cliBootstrapFile":{"type":"string"},"cliTypesFile":{"type":"string"},"servicesFile":{"type":"string"},"middlewareFile":{"type":"string"},"middlewareGroupsMetaFile":{"type":"string"},"middlewareGroupsMetaJsonFile":{"type":"string"},"permissionsFile":{"type":"string"},"bootstrapFile":{"type":"string"},"$schema":{"type":"string"},"extends":{"type":"string"},"rootDir":{"type":"string"},"srcDirectories":{"type":"array","items":{"type":"string"}},"ignoreFiles":{"type":"array","items":{"type":"string"}},"packageMappings":{"type":"object","additionalProperties":{"type":"string"}},"configFile":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"types":{"type":"array","items":{"type":"string"}},"userSessionType":{"type":"string"},"singletonServicesFactoryType":{"type":"string"},"wireServicesFactoryType":{"type":"string"},"configDir":{"type":"string"},"tsconfig":{"type":"string"},"nextBackendFile":{"type":"string"},"nextHTTPFile":{"type":"string"},"fetchFile":{"type":"string"},"websocketFile":{"type":"string"},"rpcWiringsFile":{"type":"string"},"queueWiringsFile":{"type":"string"},"mcpJsonFile":{"type":"string"},"openAPI":{"type":"object","properties":{"outputFile":{"type":"string"},"additionalInfo":{"$ref":"#/definitions/OpenAPISpecInfo"}},"required":["outputFile","additionalInfo"],"additionalProperties":false},"schema":{"type":"object","properties":{"additionalProperties":{"type":"boolean"},"supportsImportAttributes":{"type":"boolean"}},"additionalProperties":false},"cli":{"type":"object","properties":{"entrypoints":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"object","properties":{"type":{"type":"string","const":"local"},"path":{"type":"string"}},"required":["type","path"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"channel"},"name":{"type":"string"},"route":{"type":"string"},"wirePath":{"type":"string"},"path":{"type":"string"}},"required":["type","wirePath"],"additionalProperties":false},{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"object","properties":{"type":{"type":"string","const":"local"},"path":{"type":"string"}},"required":["type","path"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"channel"},"name":{"type":"string"},"route":{"type":"string"},"wirePath":{"type":"string"},"path":{"type":"string"}},"required":["type","wirePath"],"additionalProperties":false}]}}]}}},"additionalProperties":false},"workflows":{"anyOf":[{"type":"object","properties":{"singleQueue":{"type":"boolean","const":true},"path":{"type":"string"},"orchestratorQueue":{"type":"string"},"workerQueue":{"type":"string"}},"required":["singleQueue","path"],"additionalProperties":false},{"type":"object","properties":{"singleQueue":{"type":"boolean","const":false},"dir":{"type":"string"},"orchestratorQueuePrefix":{"type":"string"},"workerQueuePrefix":{"type":"string"}},"required":["singleQueue","dir"],"additionalProperties":false}]},"rpc":{"type":"object","properties":{"remoteRpcWorkersPath":{"type":"string"},"publicRpcPath":{"type":"string"}},"additionalProperties":false},"forceRequiredServices":{"type":"array","items":{"type":"string"}},"schemasFromTypes":{"type":"array","items":{"type":"string"}},"stateOutput":{"type":"string"},"stateInput":{"type":"string"},"filters":{"$ref":"#/definitions/InspectorFilters"}},"required":["bootstrapFile","channelsMapDeclarationFile","channelsTypesFile","channelsWiringFile","channelsWiringMetaFile","channelsWiringMetaJsonFile","cliBootstrapFile","cliTypesFile","cliWiringMetaFile","cliWiringMetaJsonFile","cliWiringsFile","configDir","filters","functionTypesFile","functionsFile","functionsMetaFile","functionsMetaJsonFile","functionsMetaMinFile","functionsMetaMinJsonFile","httpMapDeclarationFile","httpTypesFile","httpWiringMetaFile","httpWiringMetaJsonFile","httpWiringsFile","mcpTypesFile","mcpWiringsFile","mcpWiringsMetaFile","mcpWiringsMetaJsonFile","middlewareFile","middlewareGroupsMetaFile","middlewareGroupsMetaJsonFile","outDir","packageMappings","permissionsFile","queueMapDeclarationFile","queueTypesFile","queueWorkersWiringFile","queueWorkersWiringMetaFile","queueWorkersWiringMetaJsonFile","rootDir","rpcInternalMapDeclarationFile","rpcInternalWiringMetaFile","rpcInternalWiringMetaJsonFile","rpcMapDeclarationFile","schedulersTypesFile","schedulersWiringFile","schedulersWiringMetaFile","schedulersWiringMetaJsonFile","schemaDirectory","servicesFile","srcDirectories","tsconfig","typesDeclarationFile","workflowMapDeclarationFile","workflowTypesFile","workflowsWiringFile","workflowsWiringMetaFile","workflowsWiringMetaJsonFile","workflowsWorkersFile"],"definitions":{"OpenAPISpecInfo":{"type":"object","properties":{"info":{"type":"object","properties":{"title":{"type":"string"},"version":{"type":"string"},"description":{"type":"string"},"termsOfService":{"type":"string"},"contact":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"},"email":{"type":"string"}},"additionalProperties":false},"license":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"}},"required":["name"],"additionalProperties":false}},"required":["title","version","description"],"additionalProperties":false},"servers":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"description":{"type":"string"}},"required":["url"],"additionalProperties":false}},"tags":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"}},"required":["name"],"additionalProperties":false}},"externalDocs":{"type":"object","properties":{"description":{"type":"string"},"url":{"type":"string"}},"required":["url"],"additionalProperties":false},"securitySchemes":{"type":"object"},"security":{"type":"array","items":{"type":"object","additionalProperties":{"type":"array","items":{}}}}},"required":["info","servers"],"additionalProperties":false},"InspectorFilters":{"type":"object","properties":{"names":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"types":{"type":"array","items":{"type":"string"}},"directories":{"type":"array","items":{"type":"string"}},"httpRoutes":{"type":"array","items":{"type":"string"}},"httpMethods":{"type":"array","items":{"type":"string"}}},"additionalProperties":false}}}
1
+ {"$schema":"http://json-schema.org/draft-07/schema#","type":"object","additionalProperties":false,"properties":{"outDir":{"type":"string"},"schemaDirectory":{"type":"string"},"typesDeclarationFile":{"type":"string"},"functionsFile":{"type":"string"},"functionsMetaFile":{"type":"string"},"functionsMetaJsonFile":{"type":"string"},"functionTypesFile":{"type":"string"},"httpWiringsFile":{"type":"string"},"httpWiringMetaFile":{"type":"string"},"httpWiringMetaJsonFile":{"type":"string"},"httpMapDeclarationFile":{"type":"string"},"httpTypesFile":{"type":"string"},"channelsWiringFile":{"type":"string"},"channelsWiringMetaFile":{"type":"string"},"channelsWiringMetaJsonFile":{"type":"string"},"channelsMapDeclarationFile":{"type":"string"},"channelsTypesFile":{"type":"string"},"rpcInternalWiringMetaFile":{"type":"string"},"rpcInternalWiringMetaJsonFile":{"type":"string"},"rpcInternalMapDeclarationFile":{"type":"string"},"rpcMapDeclarationFile":{"type":"string"},"schedulersWiringFile":{"type":"string"},"schedulersWiringMetaFile":{"type":"string"},"schedulersWiringMetaJsonFile":{"type":"string"},"schedulersTypesFile":{"type":"string"},"queueWorkersWiringFile":{"type":"string"},"queueWorkersWiringMetaFile":{"type":"string"},"queueWorkersWiringMetaJsonFile":{"type":"string"},"queueMapDeclarationFile":{"type":"string"},"queueTypesFile":{"type":"string"},"workflowsWiringFile":{"type":"string"},"workflowsWiringMetaFile":{"type":"string"},"workflowsWorkersFile":{"type":"string"},"workflowMapDeclarationFile":{"type":"string"},"workflowTypesFile":{"type":"string"},"workflowMetaDir":{"type":"string"},"mcpWiringsFile":{"type":"string"},"mcpWiringsMetaFile":{"type":"string"},"mcpWiringsMetaJsonFile":{"type":"string"},"mcpTypesFile":{"type":"string"},"cliWiringsFile":{"type":"string"},"cliWiringMetaFile":{"type":"string"},"cliWiringMetaJsonFile":{"type":"string"},"cliBootstrapFile":{"type":"string"},"cliTypesFile":{"type":"string"},"servicesFile":{"type":"string"},"middlewareFile":{"type":"string"},"middlewareGroupsMetaFile":{"type":"string"},"middlewareGroupsMetaJsonFile":{"type":"string"},"permissionsFile":{"type":"string"},"bootstrapFile":{"type":"string"},"packageFile":{"type":"string"},"forgeTypesFile":{"type":"string"},"$schema":{"type":"string"},"extends":{"type":"string"},"rootDir":{"type":"string"},"srcDirectories":{"type":"array","items":{"type":"string"}},"ignoreFiles":{"type":"array","items":{"type":"string"}},"packageMappings":{"type":"object","additionalProperties":{"type":"string"}},"externalPackages":{"type":"object","additionalProperties":{"type":"string"}},"externalPackage":{"type":"boolean"},"externalPackageName":{"type":"string"},"configFile":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"types":{"type":"array","items":{"type":"string"}},"userSessionType":{"type":"string"},"singletonServicesFactoryType":{"type":"string"},"wireServicesFactoryType":{"type":"string"},"configDir":{"type":"string"},"tsconfig":{"type":"string"},"nextBackendFile":{"type":"string"},"nextHTTPFile":{"type":"string"},"fetchFile":{"type":"string"},"websocketFile":{"type":"string"},"rpcWiringsFile":{"type":"string"},"queueWiringsFile":{"type":"string"},"mcpJsonFile":{"type":"string"},"openAPI":{"type":"object","properties":{"outputFile":{"type":"string"},"additionalInfo":{"$ref":"#/definitions/OpenAPISpecInfo"}},"required":["outputFile","additionalInfo"],"additionalProperties":false},"schema":{"type":"object","properties":{"additionalProperties":{"type":"boolean"},"supportsImportAttributes":{"type":"boolean"}},"additionalProperties":false},"cli":{"type":"object","properties":{"entrypoints":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"object","properties":{"type":{"type":"string","const":"local"},"path":{"type":"string"}},"required":["type","path"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"channel"},"name":{"type":"string"},"route":{"type":"string"},"wirePath":{"type":"string"},"path":{"type":"string"}},"required":["type","wirePath"],"additionalProperties":false},{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"object","properties":{"type":{"type":"string","const":"local"},"path":{"type":"string"}},"required":["type","path"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"channel"},"name":{"type":"string"},"route":{"type":"string"},"wirePath":{"type":"string"},"path":{"type":"string"}},"required":["type","wirePath"],"additionalProperties":false}]}}]}}},"additionalProperties":false},"workflows":{"anyOf":[{"type":"object","properties":{"singleQueue":{"type":"boolean","const":true},"path":{"type":"string"},"orchestratorQueue":{"type":"string"},"workerQueue":{"type":"string"}},"required":["singleQueue","path"],"additionalProperties":false},{"type":"object","properties":{"singleQueue":{"type":"boolean","const":false},"dir":{"type":"string"},"orchestratorQueuePrefix":{"type":"string"},"workerQueuePrefix":{"type":"string"}},"required":["singleQueue","dir"],"additionalProperties":false}]},"rpc":{"type":"object","properties":{"remoteRpcWorkersPath":{"type":"string"},"publicRpcPath":{"type":"string"}},"additionalProperties":false},"forceRequiredServices":{"type":"array","items":{"type":"string"}},"schemasFromTypes":{"type":"array","items":{"type":"string"}},"stateOutput":{"type":"string"},"stateInput":{"type":"string"},"forge":{"type":"object","properties":{"verboseMeta":{"type":"boolean"},"node":{"type":"object","properties":{"categories":{"type":"array","items":{"type":"string"}},"icon":{"type":"string"},"displayName":{"type":"string"},"description":{"type":"string"}},"additionalProperties":false}},"additionalProperties":false},"forgeNodesMetaJsonFile":{"type":"string"},"filters":{"$ref":"#/definitions/InspectorFilters"}},"required":["bootstrapFile","channelsMapDeclarationFile","channelsTypesFile","channelsWiringFile","channelsWiringMetaFile","channelsWiringMetaJsonFile","cliBootstrapFile","cliTypesFile","cliWiringMetaFile","cliWiringMetaJsonFile","cliWiringsFile","configDir","filters","forgeTypesFile","functionTypesFile","functionsFile","functionsMetaFile","functionsMetaJsonFile","httpMapDeclarationFile","httpTypesFile","httpWiringMetaFile","httpWiringMetaJsonFile","httpWiringsFile","mcpTypesFile","mcpWiringsFile","mcpWiringsMetaFile","mcpWiringsMetaJsonFile","middlewareFile","middlewareGroupsMetaFile","middlewareGroupsMetaJsonFile","outDir","packageFile","packageMappings","permissionsFile","queueMapDeclarationFile","queueTypesFile","queueWorkersWiringFile","queueWorkersWiringMetaFile","queueWorkersWiringMetaJsonFile","rootDir","rpcInternalMapDeclarationFile","rpcInternalWiringMetaFile","rpcInternalWiringMetaJsonFile","rpcMapDeclarationFile","schedulersTypesFile","schedulersWiringFile","schedulersWiringMetaFile","schedulersWiringMetaJsonFile","schemaDirectory","servicesFile","srcDirectories","tsconfig","typesDeclarationFile","workflowMapDeclarationFile","workflowMetaDir","workflowTypesFile","workflowsWiringFile","workflowsWiringMetaFile","workflowsWorkersFile"],"definitions":{"OpenAPISpecInfo":{"type":"object","properties":{"info":{"type":"object","properties":{"title":{"type":"string"},"version":{"type":"string"},"description":{"type":"string"},"termsOfService":{"type":"string"},"contact":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"},"email":{"type":"string"}},"additionalProperties":false},"license":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"}},"required":["name"],"additionalProperties":false}},"required":["title","version","description"],"additionalProperties":false},"servers":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"description":{"type":"string"}},"required":["url"],"additionalProperties":false}},"tags":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"}},"required":["name"],"additionalProperties":false}},"externalDocs":{"type":"object","properties":{"description":{"type":"string"},"url":{"type":"string"}},"required":["url"],"additionalProperties":false},"securitySchemes":{"type":"object"},"security":{"type":"array","items":{"type":"object","additionalProperties":{"type":"array","items":{}}}}},"required":["info","servers"],"additionalProperties":false},"InspectorFilters":{"type":"object","properties":{"names":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"types":{"type":"array","items":{"type":"string"}},"directories":{"type":"array","items":{"type":"string"}},"httpRoutes":{"type":"array","items":{"type":"string"}},"httpMethods":{"type":"array","items":{"type":"string"}}},"additionalProperties":false}}}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.11.2
2
+ * This file was generated by @pikku/cli@0.11.3
3
3
  */
4
4
  /**
5
5
 
@@ -8,6 +8,11 @@
8
8
  import { CoreChannel } from '@pikku/core/channel';
9
9
  import { AssertHTTPWiringParams } from '@pikku/core/http';
10
10
  import type { PikkuFunctionConfig, PikkuFunctionSessionless, PikkuPermission, PikkuMiddleware } from '../function/pikku-function-types.gen.js';
11
+ import type { ZodLike, CorePermissionGroup } from '@pikku/core';
12
+ /**
13
+ * Helper type to infer the output type from a Zod schema
14
+ */
15
+ type InferZodOutput<T> = T extends ZodLike<infer U> ? U : never;
11
16
  /**
12
17
  * Type definition for WebSocket channels with typed data exchange.
13
18
  * Supports connection, disconnection, and message handling.
@@ -34,17 +39,54 @@ export declare const pikkuChannelConnectionFunc: <Out = unknown>(func: PikkuFunc
34
39
  * @returns The normalized configuration object
35
40
  */
36
41
  export declare const pikkuChannelDisconnectionFunc: (func: PikkuFunctionSessionless<void, void, "channel"> | PikkuFunctionConfig<void, void, "channel" | "session" | "rpc">) => PikkuFunctionConfig<void, void, "rpc" | "channel" | "session">;
42
+ /**
43
+ * Configuration object for channel functions with Zod schema validation.
44
+ */
45
+ type PikkuChannelFuncConfigWithSchema<InputSchema extends ZodLike, OutputSchema extends ZodLike | undefined = undefined> = {
46
+ name?: string;
47
+ tags?: string[];
48
+ expose?: boolean;
49
+ internal?: boolean;
50
+ func: PikkuFunctionSessionless<InferZodOutput<InputSchema>, OutputSchema extends ZodLike ? InferZodOutput<OutputSchema> : unknown, 'channel' | 'session' | 'rpc'>;
51
+ auth?: boolean;
52
+ permissions?: CorePermissionGroup<PikkuPermission<InferZodOutput<InputSchema>>>;
53
+ middleware?: PikkuMiddleware[];
54
+ input: InputSchema;
55
+ output?: OutputSchema;
56
+ };
37
57
  /**
38
58
  * Creates a function that handles WebSocket channel messages.
39
59
  * Called when a message is received on a channel.
40
- * This is the same as pikkuSessionlessFunc but with ChannelData = unknown by default.
41
60
  *
42
- * @template In - Input type for channel messages
43
- * @template Out - Output type for channel responses
61
+ * Supports two patterns:
62
+ * 1. Generic types: `pikkuChannelFunc<Input, Output>({ func: ... })`
63
+ * 2. Zod schemas: `pikkuChannelFunc({ input: z.object(...), func: ... })`
64
+ *
65
+ * @template In - Input type for channel messages (inferred from schema if provided)
66
+ * @template Out - Output type for channel responses (inferred from schema if provided)
44
67
  * @param func - Function definition, either direct function or configuration object
45
68
  * @returns The normalized configuration object
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * // Pattern 1: Using generic types
73
+ * const handleMessage = pikkuChannelFunc<{text: string}, {received: boolean}>({
74
+ * func: async (_services, { text }) => ({ received: true })
75
+ * })
76
+ *
77
+ * // Pattern 2: Using Zod schemas
78
+ * const messageInput = z.object({ text: z.string() })
79
+ * const messageOutput = z.object({ received: z.boolean() })
80
+ *
81
+ * const handleMessage = pikkuChannelFunc({
82
+ * input: messageInput,
83
+ * output: messageOutput,
84
+ * func: async (_services, { text }) => ({ received: true })
85
+ * })
86
+ * ```
46
87
  */
47
- export declare const pikkuChannelFunc: <In, Out = unknown>(func: PikkuFunctionSessionless<In, Out, "channel" | "session" | "rpc"> | PikkuFunctionConfig<In, Out, "channel" | "session" | "rpc">) => PikkuFunctionConfig<In, Out, "rpc" | "channel" | "session">;
88
+ export declare function pikkuChannelFunc<InputSchema extends ZodLike, OutputSchema extends ZodLike | undefined = undefined>(config: PikkuChannelFuncConfigWithSchema<InputSchema, OutputSchema>): PikkuFunctionConfig<InferZodOutput<InputSchema>, OutputSchema extends ZodLike ? InferZodOutput<OutputSchema> : unknown, 'channel' | 'session' | 'rpc'>;
89
+ export declare function pikkuChannelFunc<In, Out = unknown>(func: PikkuFunctionSessionless<In, Out, 'channel' | 'session' | 'rpc'> | PikkuFunctionConfig<In, Out, 'channel' | 'session' | 'rpc'>): PikkuFunctionConfig<In, Out, 'channel' | 'session' | 'rpc'>;
48
90
  /**
49
91
  * Registers a WebSocket channel with the Pikku framework.
50
92
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.11.2
2
+ * This file was generated by @pikku/cli@0.11.3
3
3
  */
4
4
  /**
5
5
 
@@ -27,19 +27,9 @@ export const pikkuChannelConnectionFunc = (func) => {
27
27
  export const pikkuChannelDisconnectionFunc = (func) => {
28
28
  return typeof func === 'function' ? { func } : func;
29
29
  };
30
- /**
31
- * Creates a function that handles WebSocket channel messages.
32
- * Called when a message is received on a channel.
33
- * This is the same as pikkuSessionlessFunc but with ChannelData = unknown by default.
34
- *
35
- * @template In - Input type for channel messages
36
- * @template Out - Output type for channel responses
37
- * @param func - Function definition, either direct function or configuration object
38
- * @returns The normalized configuration object
39
- */
40
- export const pikkuChannelFunc = (func) => {
30
+ export function pikkuChannelFunc(func) {
41
31
  return typeof func === 'function' ? { func } : func;
42
- };
32
+ }
43
33
  /**
44
34
  * Registers a WebSocket channel with the Pikku framework.
45
35
  *
@@ -1,5 +1,6 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.11.2
2
+ * This file was generated by @pikku/cli@0.11.3
3
3
  */
4
4
  import { pikkuState } from '@pikku/core';
5
- pikkuState('channel', 'meta', {});
5
+ import metaData from './pikku-channels-meta.gen.json' with { type: 'json' };
6
+ pikkuState(null, 'channel', 'meta', metaData);
@@ -1,4 +1,4 @@
1
1
  export {};
2
2
  /**
3
- * This file was generated by @pikku/cli@0.11.2
3
+ * This file was generated by @pikku/cli@0.11.3
4
4
  */
@@ -1,5 +1,5 @@
1
1
  export {};
2
2
  /**
3
- * This file was generated by @pikku/cli@0.11.2
3
+ * This file was generated by @pikku/cli@0.11.3
4
4
  */
5
5
  /* The files with an addChannel function call */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.11.2
2
+ * This file was generated by @pikku/cli@0.11.3
3
3
  */
4
4
  /**
5
5
  * WebSocket channel backend for 'pikku' CLI commands
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.11.2
2
+ * This file was generated by @pikku/cli@0.11.3
3
3
  */
4
4
  import '../pikku-bootstrap.gen.js';
5
5
  /**