@pikku/cli 0.11.1 → 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.
- package/.pikku/channel/pikku-channel-types.gen.ts +73 -17
- package/.pikku/channel/pikku-channels-map.gen.d.ts +11 -11
- package/.pikku/channel/pikku-channels-meta.gen.json +1 -0
- package/.pikku/channel/pikku-channels-meta.gen.ts +4 -2
- package/.pikku/channel/pikku-channels.gen.ts +1 -1
- package/.pikku/cli/pikku-cli-channel.ts +2 -2
- package/.pikku/cli/pikku-cli-client.gen.ts +1 -3
- package/.pikku/cli/pikku-cli-types.gen.ts +3 -3
- package/.pikku/cli/pikku-cli-wirings-meta.gen.json +147 -0
- package/.pikku/cli/pikku-cli-wirings-meta.gen.ts +4 -157
- package/.pikku/cli/pikku-cli-wirings.gen.ts +3 -3
- package/.pikku/cli/pikku-cli.gen.ts +3 -3
- package/.pikku/forge/pikku-forge-types.gen.ts +83 -0
- package/.pikku/function/pikku-function-types.gen.ts +223 -91
- package/.pikku/function/pikku-functions-meta-verbose.gen.json +1030 -0
- package/.pikku/function/pikku-functions-meta.gen.json +656 -0
- package/.pikku/function/pikku-functions-meta.gen.ts +4 -970
- package/.pikku/http/pikku-http-types.gen.ts +20 -4
- package/.pikku/http/pikku-http-wirings-map.gen.d.ts +11 -11
- package/.pikku/http/pikku-http-wirings-meta.gen.json +9 -0
- package/.pikku/http/pikku-http-wirings-meta.gen.ts +4 -10
- package/.pikku/http/pikku-http-wirings.gen.ts +1 -1
- package/.pikku/mcp/pikku-mcp-types.gen.ts +72 -20
- package/.pikku/mcp/pikku-mcp-wirings-meta.gen.json +5 -0
- package/.pikku/mcp/pikku-mcp-wirings-meta.gen.ts +6 -4
- package/.pikku/mcp/pikku-mcp-wirings.gen.ts +1 -1
- package/.pikku/pikku-bootstrap.gen.ts +7 -12
- package/.pikku/pikku-services.gen.ts +6 -7
- package/.pikku/pikku-types.gen.ts +4 -1
- package/.pikku/pikku-websocket.gen.ts +1 -1
- package/.pikku/queue/pikku-queue-types.gen.ts +2 -2
- package/.pikku/queue/pikku-queue-workers-wirings-map.gen.d.ts +11 -11
- package/.pikku/queue/pikku-queue-workers-wirings-meta.gen.json +1 -0
- package/.pikku/queue/pikku-queue-workers-wirings-meta.gen.ts +5 -7
- package/.pikku/queue/pikku-queue-workers-wirings.gen.ts +1 -1
- package/.pikku/rpc/pikku-remote-rpc-workers.gen.ts +5 -2
- package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +19 -14
- package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +46 -39
- package/.pikku/scheduler/pikku-scheduler-types.gen.ts +2 -2
- package/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.json +1 -0
- package/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.ts +5 -2
- package/.pikku/scheduler/pikku-schedulers-wirings.gen.ts +1 -1
- package/.pikku/schemas/register.gen.ts +31 -23
- package/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuCLIOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuForgeNodesOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuFunctionsOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuHTTPOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuMCPOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuMiddlewareOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuPackageOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuPermissionsOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuPublicRPCOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuQueueOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuRPCOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuRemoteRPCOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuSchedulerOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuWorkflowOutput.schema.json +1 -1
- package/.pikku/services/config.gen.json +104 -0
- package/.pikku/services/getInspectorState.gen.json +10 -0
- package/.pikku/services/jwt.gen.json +13 -0
- package/.pikku/services/logger.gen.json +25 -0
- package/.pikku/services/queueService.gen.json +14 -0
- package/.pikku/services/schedulerService.gen.json +17 -0
- package/.pikku/services/schema.gen.json +14 -0
- package/.pikku/services/secrets.gen.json +13 -0
- package/.pikku/services/variables.gen.json +13 -0
- package/.pikku/services/workflowService.gen.json +31 -0
- package/.pikku/workflow/pikku-workflow-map.gen.d.ts +2 -36
- package/.pikku/workflow/pikku-workflow-types.gen.ts +305 -48
- package/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +6 -2
- package/.pikku/workflow/pikku-workflow-wirings.gen.ts +1 -2
- package/CHANGELOG.md +44 -1
- package/bin/pikku.ts +6 -32
- package/build.sh +53 -31
- package/cli.schema.json +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +51 -10
- package/dist/.pikku/channel/pikku-channel-types.gen.js +3 -13
- package/dist/.pikku/channel/pikku-channels-meta.gen.js +3 -2
- package/dist/.pikku/channel/pikku-channels-meta.gen.json +1 -0
- package/dist/.pikku/channel/pikku-channels.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channels.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-channel.js +2 -2
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -3
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +3 -3
- package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +3 -157
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +147 -0
- package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +2 -2
- package/dist/.pikku/cli/pikku-cli-wirings.gen.js +2 -2
- package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.js +3 -3
- package/dist/.pikku/forge/pikku-forge-types.gen.d.ts +72 -0
- package/dist/.pikku/forge/pikku-forge-types.gen.js +55 -0
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +141 -99
- package/dist/.pikku/function/pikku-function-types.gen.js +52 -62
- package/dist/.pikku/function/pikku-functions-meta.gen.js +3 -969
- package/dist/.pikku/function/pikku-functions-meta.gen.json +656 -0
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +19 -4
- package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
- package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +3 -10
- package/dist/.pikku/http/pikku-http-wirings-meta.gen.json +9 -0
- package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
- package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +57 -17
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +7 -31
- package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.js +5 -4
- package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.json +5 -0
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.d.ts +1 -1
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.js +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +7 -12
- package/dist/.pikku/pikku-bootstrap.gen.js +7 -12
- package/dist/.pikku/pikku-services.gen.d.ts +5 -7
- package/dist/.pikku/pikku-services.gen.js +3 -5
- package/dist/.pikku/pikku-types.gen.d.ts +2 -1
- package/dist/.pikku/pikku-types.gen.js +3 -1
- package/dist/.pikku/pikku-websocket.gen.d.ts +1 -1
- package/dist/.pikku/pikku-websocket.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +2 -2
- package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +3 -7
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.json +1 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-remote-rpc-workers.gen.d.ts +9 -9
- package/dist/.pikku/rpc/pikku-remote-rpc-workers.gen.js +5 -2
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +2 -2
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
- package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.js +3 -2
- package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.json +1 -0
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.d.ts +1 -1
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.js +1 -1
- package/dist/.pikku/schemas/register.gen.js +19 -15
- package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuCLIOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuForgeNodesOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuFunctionsOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuHTTPOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuMCPOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuMiddlewareOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuPackageOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuPermissionsOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuPublicRPCOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuQueueOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuRPCOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuRemoteRPCOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuSchedulerOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuWorkflowOutput.schema.json +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +213 -39
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +106 -16
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +3 -2
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -2
- package/dist/bin/pikku.js +5 -26
- package/dist/src/cli.wiring.js +4 -4
- package/dist/src/functions/commands/all.js +172 -94
- package/dist/src/functions/commands/bootstrap.js +21 -16
- package/dist/src/functions/commands/watch.js +6 -3
- package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.js +12 -8
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.d.ts +1 -1
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.js +74 -22
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.d.ts +1 -1
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.js +72 -20
- package/dist/src/functions/wirings/channels/pikku-channels.js +9 -2
- package/dist/src/functions/wirings/channels/pikku-command-channels.js +18 -2
- package/dist/src/functions/wirings/channels/serialize-channel-types.js +72 -16
- package/dist/src/functions/wirings/channels/serialize-typed-channel-map.js +1 -2
- package/dist/src/functions/wirings/cli/pikku-command-cli-entry.js +4 -4
- package/dist/src/functions/wirings/cli/pikku-command-cli-types.js +1 -1
- package/dist/src/functions/wirings/cli/pikku-command-cli.js +17 -3
- package/dist/src/functions/wirings/cli/serialize-channel-cli.js +1 -1
- package/dist/src/functions/wirings/cli/serialize-cli-types.js +2 -2
- package/dist/src/functions/wirings/cli/serialize-local-cli-bootstrap.d.ts +1 -1
- package/dist/src/functions/wirings/cli/serialize-local-cli-bootstrap.js +4 -4
- package/dist/src/functions/wirings/forge/pikku-command-forge-nodes.d.ts +1 -0
- package/dist/src/functions/wirings/forge/pikku-command-forge-nodes.js +90 -0
- package/dist/src/functions/wirings/forge/pikku-command-forge-types.d.ts +1 -0
- package/dist/src/functions/wirings/forge/pikku-command-forge-types.js +26 -0
- package/dist/src/functions/wirings/forge/serialize-forge-types.d.ts +4 -0
- package/dist/src/functions/wirings/forge/serialize-forge-types.js +90 -0
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +4 -4
- package/dist/src/functions/wirings/functions/pikku-command-function-types.js +7 -2
- package/dist/src/functions/wirings/functions/pikku-command-functions.js +35 -10
- package/dist/src/functions/wirings/functions/pikku-command-services.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-services.js +24 -24
- package/dist/src/functions/wirings/functions/pikku-function-types.js +2 -2
- package/dist/src/functions/wirings/functions/schemas.d.ts +1 -1
- package/dist/src/functions/wirings/functions/schemas.js +5 -4
- package/dist/src/functions/wirings/functions/serialize-function-imports.d.ts +3 -1
- package/dist/src/functions/wirings/functions/serialize-function-imports.js +7 -3
- package/dist/src/functions/wirings/functions/serialize-function-types.d.ts +1 -1
- package/dist/src/functions/wirings/functions/serialize-function-types.js +224 -91
- package/dist/src/functions/wirings/functions/serialize-pikku-types-hub.d.ts +1 -1
- package/dist/src/functions/wirings/functions/serialize-pikku-types-hub.js +19 -21
- package/dist/src/functions/wirings/http/openapi-spec-generator.js +5 -5
- package/dist/src/functions/wirings/http/pikku-command-http-routes.js +18 -2
- package/dist/src/functions/wirings/http/pikku-command-openapi.js +2 -2
- package/dist/src/functions/wirings/http/pikku-http-routes.js +9 -2
- package/dist/src/functions/wirings/http/serialize-http-types.js +19 -3
- package/dist/src/functions/wirings/http/serialize-typed-http-map.js +33 -8
- package/dist/src/functions/wirings/mcp/pikku-command-mcp.js +29 -6
- package/dist/src/functions/wirings/mcp/serialize-mcp-json.js +3 -2
- package/dist/src/functions/wirings/mcp/serialize-mcp-types.js +71 -19
- package/dist/src/functions/wirings/middleware/pikku-command-middleware.js +29 -2
- package/dist/src/functions/wirings/middleware/serialize-middleware-groups-meta.d.ts +5 -2
- package/dist/src/functions/wirings/middleware/serialize-middleware-groups-meta.js +5 -13
- package/dist/src/functions/wirings/package/pikku-command-package.d.ts +1 -0
- package/dist/src/functions/wirings/package/pikku-command-package.js +58 -0
- package/dist/src/functions/wirings/package/serialize-package.d.ts +5 -0
- package/dist/src/functions/wirings/package/serialize-package.js +32 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue.js +17 -3
- package/dist/src/functions/wirings/queue/pikku-queue.js +9 -11
- package/dist/src/functions/wirings/queue/serialize-queue-map.js +20 -3
- package/dist/src/functions/wirings/queue/serialize-queue-meta.d.ts +2 -1
- package/dist/src/functions/wirings/queue/serialize-queue-meta.js +10 -1
- package/dist/src/functions/wirings/queue/serialize-queue-types.js +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.js +4 -4
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +9 -2
- package/dist/src/functions/wirings/rpc/serialize-public-rpc.js +11 -4
- package/dist/src/functions/wirings/rpc/serialize-remote-rpc.js +4 -1
- package/dist/src/functions/wirings/rpc/serialize-rpc-wrapper.js +3 -3
- package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.js +54 -8
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.js +15 -3
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-meta.d.ts +2 -1
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-meta.js +11 -1
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-types.js +1 -1
- package/dist/src/functions/wirings/services/pikku-command-service-metadata.d.ts +1 -0
- package/dist/src/functions/wirings/services/pikku-command-service-metadata.js +22 -0
- package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +58 -16
- package/dist/src/functions/wirings/workflow/serialize-workflow-map.d.ts +3 -0
- package/dist/src/functions/wirings/workflow/serialize-workflow-map.js +30 -32
- package/dist/src/functions/wirings/workflow/serialize-workflow-meta.d.ts +1 -2
- package/dist/src/functions/wirings/workflow/serialize-workflow-meta.js +43 -8
- package/dist/src/functions/wirings/workflow/serialize-workflow-registration.d.ts +7 -0
- package/dist/src/functions/wirings/workflow/serialize-workflow-registration.js +53 -0
- package/dist/src/functions/wirings/workflow/serialize-workflow-types.d.ts +4 -2
- package/dist/src/functions/wirings/workflow/serialize-workflow-types.js +308 -49
- package/dist/src/functions/wirings/workflow/serialize-workflow-workers.d.ts +1 -1
- package/dist/src/functions/wirings/workflow/serialize-workflow-workers.js +16 -29
- package/dist/src/middleware/log-command-info-and-time.d.ts +2 -2
- package/dist/src/middleware/log-command-info-and-time.js +1 -4
- package/dist/src/services/cli-logger-forwarder.service.js +1 -1
- package/dist/src/services.d.ts +2 -7
- package/dist/src/services.js +18 -13
- package/dist/src/utils/check-required-types.d.ts +2 -2
- package/dist/src/utils/check-required-types.js +2 -3
- package/dist/src/utils/command-summary.d.ts +2 -0
- package/dist/src/utils/command-summary.js +2 -0
- package/dist/src/utils/custom-types-generator.js +13 -15
- package/dist/src/utils/generate-bootstrap-file.js +1 -1
- package/dist/src/utils/pikku-cli-config.js +65 -4
- package/dist/src/utils/pikku-files-and-methods.d.ts +2 -2
- package/dist/src/utils/pikku-files-and-methods.js +4 -4
- package/dist/src/utils/schema-generator.d.ts +4 -3
- package/dist/src/utils/schema-generator.js +135 -15
- package/dist/src/utils/strip-verbose-meta.d.ts +43 -0
- package/dist/src/utils/strip-verbose-meta.js +210 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -9
- package/src/cli.wiring.ts +4 -4
- package/src/functions/commands/all.ts +203 -107
- package/src/functions/commands/bootstrap.ts +23 -16
- package/src/functions/commands/watch.ts +6 -3
- package/src/functions/runtimes/nextjs/pikku-command-nextjs.ts +26 -6
- package/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.ts +75 -22
- package/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.ts +72 -19
- package/src/functions/wirings/channels/pikku-channels.ts +27 -3
- package/src/functions/wirings/channels/pikku-command-channels.ts +46 -3
- package/src/functions/wirings/channels/serialize-channel-types.ts +72 -16
- package/src/functions/wirings/channels/serialize-typed-channel-map.ts +3 -2
- package/src/functions/wirings/cli/pikku-command-cli-entry.ts +4 -4
- package/src/functions/wirings/cli/pikku-command-cli-types.ts +1 -1
- package/src/functions/wirings/cli/pikku-command-cli.ts +45 -3
- package/src/functions/wirings/cli/serialize-channel-cli.ts +1 -1
- package/src/functions/wirings/cli/serialize-cli-types.ts +2 -2
- package/src/functions/wirings/cli/serialize-local-cli-bootstrap.ts +5 -5
- package/src/functions/wirings/forge/pikku-command-forge-nodes.ts +135 -0
- package/src/functions/wirings/forge/pikku-command-forge-types.ts +38 -0
- package/src/functions/wirings/forge/serialize-forge-types.ts +94 -0
- package/src/functions/wirings/functions/pikku-command-function-types-split.ts +9 -8
- package/src/functions/wirings/functions/pikku-command-function-types.ts +17 -10
- package/src/functions/wirings/functions/pikku-command-functions.ts +59 -14
- package/src/functions/wirings/functions/pikku-command-services.ts +26 -26
- package/src/functions/wirings/functions/pikku-function-types.ts +3 -1
- package/src/functions/wirings/functions/schemas.ts +14 -4
- package/src/functions/wirings/functions/serialize-function-imports.ts +12 -3
- package/src/functions/wirings/functions/serialize-function-types.ts +227 -93
- package/src/functions/wirings/functions/serialize-pikku-types-hub.ts +27 -26
- package/src/functions/wirings/http/openapi-spec-generator.ts +15 -6
- package/src/functions/wirings/http/pikku-command-http-routes.ts +46 -2
- package/src/functions/wirings/http/pikku-command-openapi.ts +3 -2
- package/src/functions/wirings/http/pikku-http-routes.ts +28 -2
- package/src/functions/wirings/http/serialize-http-types.ts +19 -3
- package/src/functions/wirings/http/serialize-typed-http-map.ts +32 -8
- package/src/functions/wirings/mcp/pikku-command-mcp.ts +58 -10
- package/src/functions/wirings/mcp/serialize-mcp-json.ts +8 -6
- package/src/functions/wirings/mcp/serialize-mcp-types.ts +71 -19
- package/src/functions/wirings/middleware/pikku-command-middleware.ts +39 -2
- package/src/functions/wirings/middleware/serialize-middleware-groups-meta.ts +4 -19
- package/src/functions/wirings/package/pikku-command-package.ts +81 -0
- package/src/functions/wirings/package/serialize-package.ts +69 -0
- package/src/functions/wirings/permissions/pikku-command-permissions.ts +2 -2
- package/src/functions/wirings/queue/pikku-command-queue.ts +47 -2
- package/src/functions/wirings/queue/pikku-queue.ts +26 -10
- package/src/functions/wirings/queue/serialize-queue-map.ts +18 -3
- package/src/functions/wirings/queue/serialize-queue-meta.ts +15 -1
- package/src/functions/wirings/queue/serialize-queue-types.ts +1 -1
- package/src/functions/wirings/rpc/pikku-command-rpc-map.ts +7 -4
- package/src/functions/wirings/rpc/pikku-command-rpc.ts +25 -2
- package/src/functions/wirings/rpc/serialize-public-rpc.ts +11 -4
- package/src/functions/wirings/rpc/serialize-remote-rpc.ts +4 -1
- package/src/functions/wirings/rpc/serialize-rpc-wrapper.ts +3 -3
- package/src/functions/wirings/rpc/serialize-typed-rpc-map.ts +74 -8
- package/src/functions/wirings/scheduler/pikku-command-scheduler.ts +51 -4
- package/src/functions/wirings/scheduler/serialize-scheduler-meta.ts +20 -1
- package/src/functions/wirings/scheduler/serialize-scheduler-types.ts +1 -1
- package/src/functions/wirings/services/pikku-command-service-metadata.ts +25 -0
- package/src/functions/wirings/workflow/pikku-command-workflow.ts +114 -19
- package/src/functions/wirings/workflow/serialize-workflow-map.ts +38 -40
- package/src/functions/wirings/workflow/serialize-workflow-meta.ts +68 -11
- package/src/functions/wirings/workflow/serialize-workflow-registration.ts +83 -0
- package/src/functions/wirings/workflow/serialize-workflow-types.ts +311 -49
- package/src/functions/wirings/workflow/serialize-workflow-workers.ts +16 -29
- package/src/middleware/log-command-info-and-time.ts +3 -6
- package/src/services/cli-logger-forwarder.service.ts +1 -1
- package/src/services.ts +23 -16
- package/src/utils/check-required-types.ts +4 -7
- package/src/utils/command-summary.ts +4 -0
- package/src/utils/custom-types-generator.ts +15 -15
- package/src/utils/generate-bootstrap-file.ts +1 -1
- package/src/utils/pikku-cli-config.ts +105 -5
- package/src/utils/pikku-files-and-methods.ts +10 -13
- package/src/utils/schema-generator.ts +185 -22
- package/src/utils/strip-verbose-meta.ts +254 -0
- package/types/application-types.d.ts +1 -1
- package/types/config.d.ts +47 -2
- package/.pikku/function/pikku-functions-meta.min.gen.ts +0 -211
- package/.pikku/function/pikku-functions.gen.ts +0 -84
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +0 -47
- package/dist/.pikku/function/pikku-functions-meta.min.gen.d.ts +0 -1
- package/dist/.pikku/function/pikku-functions-meta.min.gen.js +0 -211
- package/dist/.pikku/function/pikku-functions.gen.d.ts +0 -1
- package/dist/.pikku/function/pikku-functions.gen.js +0 -83
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts +0 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +0 -47
- package/dist/.pikku/schemas/schemas/PikkuRemoteInternalRPCInput.schema.json +0 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow-map.d.ts +0 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow-map.js +0 -12
- package/dist/src/functions/wirings/workflow/pikku-command-workflow-types.d.ts +0 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow-types.js +0 -11
- package/src/functions/wirings/workflow/pikku-command-workflow-map.ts +0 -24
- package/src/functions/wirings/workflow/pikku-command-workflow-types.ts +0 -22
|
@@ -2,7 +2,15 @@ import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
|
2
2
|
import { serializeFileImports } from '../../../utils/file-imports-serializer.js'
|
|
3
3
|
import { writeFileInDir } from '../../../utils/file-writer.js'
|
|
4
4
|
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
serializeSchedulerMeta,
|
|
7
|
+
serializeSchedulerMetaTS,
|
|
8
|
+
} from './serialize-scheduler-meta.js'
|
|
9
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js'
|
|
10
|
+
import {
|
|
11
|
+
stripVerboseFields,
|
|
12
|
+
hasVerboseFields,
|
|
13
|
+
} from '../../../utils/strip-verbose-meta.js'
|
|
6
14
|
|
|
7
15
|
export const pikkuScheduler: any = pikkuSessionlessFunc<
|
|
8
16
|
void,
|
|
@@ -10,15 +18,54 @@ export const pikkuScheduler: any = pikkuSessionlessFunc<
|
|
|
10
18
|
>({
|
|
11
19
|
func: async ({ logger, config, getInspectorState }) => {
|
|
12
20
|
const visitState = await getInspectorState()
|
|
13
|
-
const {
|
|
14
|
-
|
|
21
|
+
const {
|
|
22
|
+
schedulersWiringFile,
|
|
23
|
+
schedulersWiringMetaFile,
|
|
24
|
+
schedulersWiringMetaJsonFile,
|
|
25
|
+
packageMappings,
|
|
26
|
+
schema,
|
|
27
|
+
} = config
|
|
15
28
|
const { scheduledTasks } = visitState
|
|
16
29
|
|
|
30
|
+
const fullMeta = serializeSchedulerMeta(scheduledTasks.meta)
|
|
31
|
+
|
|
32
|
+
// Write minimal JSON (runtime-only fields)
|
|
33
|
+
const minimalMeta = stripVerboseFields(fullMeta)
|
|
17
34
|
await writeFileInDir(
|
|
18
35
|
logger,
|
|
36
|
+
schedulersWiringMetaJsonFile,
|
|
37
|
+
JSON.stringify(minimalMeta, null, 2)
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
// Write verbose JSON only if it has additional fields
|
|
41
|
+
if (hasVerboseFields(fullMeta)) {
|
|
42
|
+
const verbosePath = schedulersWiringMetaJsonFile.replace(
|
|
43
|
+
/\.gen\.json$/,
|
|
44
|
+
'-verbose.gen.json'
|
|
45
|
+
)
|
|
46
|
+
await writeFileInDir(
|
|
47
|
+
logger,
|
|
48
|
+
verbosePath,
|
|
49
|
+
JSON.stringify(fullMeta, null, 2)
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const jsonImportPath = getFileImportRelativePath(
|
|
19
54
|
schedulersWiringMetaFile,
|
|
20
|
-
|
|
55
|
+
schedulersWiringMetaJsonFile,
|
|
56
|
+
packageMappings
|
|
21
57
|
)
|
|
58
|
+
|
|
59
|
+
await writeFileInDir(
|
|
60
|
+
logger,
|
|
61
|
+
schedulersWiringMetaFile,
|
|
62
|
+
serializeSchedulerMetaTS(
|
|
63
|
+
scheduledTasks.meta,
|
|
64
|
+
jsonImportPath,
|
|
65
|
+
schema?.supportsImportAttributes ?? false
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
|
|
22
69
|
await writeFileInDir(
|
|
23
70
|
logger,
|
|
24
71
|
schedulersWiringFile,
|
|
@@ -3,11 +3,30 @@ import { ScheduledTasksMeta } from '@pikku/core/scheduler'
|
|
|
3
3
|
export const serializeSchedulerMeta = (
|
|
4
4
|
scheduledTasksMeta: ScheduledTasksMeta
|
|
5
5
|
) => {
|
|
6
|
+
return scheduledTasksMeta
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const serializeSchedulerMetaTS = (
|
|
10
|
+
scheduledTasksMeta: ScheduledTasksMeta,
|
|
11
|
+
jsonImportPath: string,
|
|
12
|
+
supportsImportAttributes
|
|
13
|
+
) => {
|
|
14
|
+
const importStatement = supportsImportAttributes
|
|
15
|
+
? `import metaData from '${jsonImportPath}' with { type: 'json' }`
|
|
16
|
+
: `import metaData from '${jsonImportPath}'`
|
|
17
|
+
|
|
6
18
|
const serializedOutput: string[] = []
|
|
7
19
|
serializedOutput.push("import { pikkuState } from '@pikku/core'")
|
|
8
20
|
serializedOutput.push(
|
|
9
|
-
|
|
21
|
+
"import { ScheduledTasksMeta } from '@pikku/core/scheduler'"
|
|
10
22
|
)
|
|
23
|
+
serializedOutput.push(importStatement)
|
|
24
|
+
serializedOutput.push('')
|
|
25
|
+
serializedOutput.push(
|
|
26
|
+
"pikkuState(null, 'scheduler', 'meta', metaData as ScheduledTasksMeta)"
|
|
27
|
+
)
|
|
28
|
+
serializedOutput.push('')
|
|
29
|
+
|
|
11
30
|
const scheduledTasksMetaValues = Object.values(scheduledTasksMeta)
|
|
12
31
|
if (scheduledTasksMetaValues.length > 0) {
|
|
13
32
|
serializedOutput.push(
|
|
@@ -13,7 +13,7 @@ import type { PikkuFunctionConfig, PikkuMiddleware } from '${functionTypesImport
|
|
|
13
13
|
* Type definition for scheduled tasks that run at specified intervals.
|
|
14
14
|
* These are sessionless functions that execute based on cron expressions.
|
|
15
15
|
*/
|
|
16
|
-
type SchedulerWiring = CoreScheduledTask<PikkuFunctionConfig<void, void>, PikkuMiddleware>
|
|
16
|
+
type SchedulerWiring = CoreScheduledTask<PikkuFunctionConfig<void, void, 'session' | 'rpc'>, PikkuMiddleware>
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Registers a scheduled task with the Pikku framework.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
2
|
+
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js'
|
|
3
|
+
import { writeAllServiceMetadata } from '@pikku/inspector'
|
|
4
|
+
|
|
5
|
+
export const pikkuServiceMetadata: any = pikkuSessionlessFunc<void, void>({
|
|
6
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
7
|
+
const state = await getInspectorState()
|
|
8
|
+
|
|
9
|
+
// Only write service metadata if there are services to document
|
|
10
|
+
if (state.serviceMetadata && state.serviceMetadata.length > 0) {
|
|
11
|
+
writeAllServiceMetadata(state.serviceMetadata, config.outDir)
|
|
12
|
+
logger.debug(
|
|
13
|
+
`• Wrote ${state.serviceMetadata.length} service metadata files`
|
|
14
|
+
)
|
|
15
|
+
} else {
|
|
16
|
+
logger.debug('• No service metadata to write')
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
middleware: [
|
|
20
|
+
logCommandInfoAndTime({
|
|
21
|
+
commandStart: 'Generating service metadata',
|
|
22
|
+
commandEnd: 'Generated service metadata',
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
})
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
2
|
-
import { ErrorCode } from '@pikku/inspector'
|
|
3
|
-
import {
|
|
2
|
+
import { convertDslToGraph, ErrorCode } from '@pikku/inspector'
|
|
3
|
+
import type { WorkflowsMeta } from '@pikku/core/workflow'
|
|
4
4
|
import { writeFileInDir } from '../../../utils/file-writer.js'
|
|
5
5
|
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js'
|
|
6
|
-
import { serializeWorkflowMeta } from './serialize-workflow-meta.js'
|
|
7
6
|
import { serializeWorkflowTypes } from './serialize-workflow-types.js'
|
|
7
|
+
import { serializeWorkflowRegistration } from './serialize-workflow-registration.js'
|
|
8
8
|
import { serializeWorkflowMap } from './serialize-workflow-map.js'
|
|
9
|
+
import { serializeWorkflowMeta } from './serialize-workflow-meta.js'
|
|
9
10
|
import { serializeWorkflowWorkers } from './serialize-workflow-workers.js'
|
|
10
11
|
import { getFileImportRelativePath } from '../../../utils/file-import-path.js'
|
|
12
|
+
import {
|
|
13
|
+
stripVerboseFields,
|
|
14
|
+
hasVerboseFields,
|
|
15
|
+
} from '../../../utils/strip-verbose-meta.js'
|
|
11
16
|
import { join } from 'path'
|
|
12
17
|
|
|
13
18
|
export const pikkuWorkflow: any = pikkuSessionlessFunc<
|
|
@@ -19,17 +24,27 @@ export const pikkuWorkflow: any = pikkuSessionlessFunc<
|
|
|
19
24
|
const {
|
|
20
25
|
workflowsWiringFile,
|
|
21
26
|
workflowsWiringMetaFile,
|
|
27
|
+
workflowMetaDir,
|
|
22
28
|
workflowMapDeclarationFile,
|
|
23
29
|
workflowTypesFile,
|
|
24
30
|
functionTypesFile,
|
|
25
31
|
typesDeclarationFile,
|
|
26
32
|
packageMappings,
|
|
33
|
+
schema,
|
|
27
34
|
} = config
|
|
28
35
|
const { workflows, functions: functionState } = visitState
|
|
29
36
|
const { typesMap } = functionState
|
|
30
37
|
|
|
31
|
-
//
|
|
32
|
-
const
|
|
38
|
+
// Get all workflow names (both DSL and graph-based)
|
|
39
|
+
const dslWorkflowNames = Object.keys(workflows.meta)
|
|
40
|
+
const graphWorkflowNames = Object.keys(workflows.graphMeta)
|
|
41
|
+
const allWorkflowNames = [
|
|
42
|
+
...new Set([...dslWorkflowNames, ...graphWorkflowNames]),
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
const hasWorkflows = allWorkflowNames.length > 0
|
|
46
|
+
|
|
47
|
+
// Validate that workflowService is configured if workflows are defined
|
|
33
48
|
if (hasWorkflows) {
|
|
34
49
|
const hasWorkflowState =
|
|
35
50
|
visitState.serviceAggregation.allSingletonServices.includes(
|
|
@@ -46,38 +61,117 @@ export const pikkuWorkflow: any = pikkuSessionlessFunc<
|
|
|
46
61
|
}
|
|
47
62
|
}
|
|
48
63
|
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
64
|
+
// Generate individual JSON files for each workflow (convert DSL to graph format)
|
|
65
|
+
if (hasWorkflows && workflowMetaDir) {
|
|
66
|
+
// Write individual JSON files for DSL workflows
|
|
67
|
+
const dslMeta = workflows.meta as WorkflowsMeta
|
|
68
|
+
for (const [name, meta] of Object.entries(dslMeta)) {
|
|
69
|
+
const graphMeta = convertDslToGraph(name, meta)
|
|
70
|
+
|
|
71
|
+
// Write minimal version (runtime-only fields)
|
|
72
|
+
const minimalMeta = stripVerboseFields(graphMeta)
|
|
73
|
+
const minimalPath = join(workflowMetaDir, `${name}.gen.json`)
|
|
74
|
+
await writeFileInDir(
|
|
75
|
+
logger,
|
|
76
|
+
minimalPath,
|
|
77
|
+
JSON.stringify(minimalMeta, null, 2),
|
|
78
|
+
{ ignoreModifyComment: true }
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
// Write verbose version only if it has additional fields
|
|
82
|
+
if (hasVerboseFields(graphMeta)) {
|
|
83
|
+
const verbosePath = join(workflowMetaDir, `${name}-verbose.gen.json`)
|
|
84
|
+
await writeFileInDir(
|
|
85
|
+
logger,
|
|
86
|
+
verbosePath,
|
|
87
|
+
JSON.stringify(graphMeta, null, 2),
|
|
88
|
+
{ ignoreModifyComment: true }
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Write individual JSON files for graph workflows
|
|
94
|
+
for (const [name, graphMeta] of Object.entries(workflows.graphMeta)) {
|
|
95
|
+
// Write minimal version (runtime-only fields)
|
|
96
|
+
const minimalMeta = stripVerboseFields(graphMeta)
|
|
97
|
+
const minimalPath = join(workflowMetaDir, `${name}.gen.json`)
|
|
98
|
+
await writeFileInDir(
|
|
99
|
+
logger,
|
|
100
|
+
minimalPath,
|
|
101
|
+
JSON.stringify(minimalMeta, null, 2),
|
|
102
|
+
{ ignoreModifyComment: true }
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
// Write verbose version only if it has additional fields
|
|
106
|
+
if (hasVerboseFields(graphMeta)) {
|
|
107
|
+
const verbosePath = join(workflowMetaDir, `${name}-verbose.gen.json`)
|
|
108
|
+
await writeFileInDir(
|
|
109
|
+
logger,
|
|
110
|
+
verbosePath,
|
|
111
|
+
JSON.stringify(graphMeta, null, 2),
|
|
112
|
+
{ ignoreModifyComment: true }
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Generate workflow meta aggregation file
|
|
119
|
+
if (workflowsWiringMetaFile && workflowMetaDir) {
|
|
120
|
+
await writeFileInDir(
|
|
121
|
+
logger,
|
|
122
|
+
workflowsWiringMetaFile,
|
|
123
|
+
serializeWorkflowMeta(
|
|
124
|
+
workflowsWiringMetaFile,
|
|
125
|
+
workflowMetaDir,
|
|
126
|
+
allWorkflowNames,
|
|
127
|
+
packageMappings,
|
|
128
|
+
schema?.supportsImportAttributes ?? false,
|
|
129
|
+
config.externalPackageName
|
|
130
|
+
)
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Generate workflow registration (meta + DSL workflow registrations)
|
|
135
|
+
const metaImportPath = getFileImportRelativePath(
|
|
136
|
+
workflowsWiringFile,
|
|
52
137
|
workflowsWiringMetaFile,
|
|
53
|
-
|
|
138
|
+
packageMappings
|
|
54
139
|
)
|
|
55
140
|
|
|
56
|
-
// Write workflow wirings (imports)
|
|
57
141
|
await writeFileInDir(
|
|
58
142
|
logger,
|
|
59
143
|
workflowsWiringFile,
|
|
60
|
-
|
|
61
|
-
'wireWorkflow',
|
|
144
|
+
serializeWorkflowRegistration(
|
|
62
145
|
workflowsWiringFile,
|
|
146
|
+
metaImportPath,
|
|
147
|
+
allWorkflowNames,
|
|
63
148
|
workflows.files,
|
|
64
|
-
|
|
149
|
+
workflows.graphFiles,
|
|
150
|
+
packageMappings,
|
|
151
|
+
config.externalPackageName
|
|
65
152
|
)
|
|
66
153
|
)
|
|
67
154
|
|
|
68
|
-
//
|
|
155
|
+
// Generate workflow types (DSL + graph helpers in one file)
|
|
69
156
|
const functionTypesImportPath = getFileImportRelativePath(
|
|
70
157
|
workflowTypesFile,
|
|
71
158
|
functionTypesFile,
|
|
72
159
|
packageMappings
|
|
73
160
|
)
|
|
161
|
+
const rpcMapImportPath = getFileImportRelativePath(
|
|
162
|
+
workflowTypesFile,
|
|
163
|
+
config.rpcInternalMapDeclarationFile,
|
|
164
|
+
packageMappings
|
|
165
|
+
)
|
|
166
|
+
|
|
74
167
|
await writeFileInDir(
|
|
75
168
|
logger,
|
|
76
169
|
workflowTypesFile,
|
|
77
|
-
serializeWorkflowTypes(functionTypesImportPath)
|
|
170
|
+
serializeWorkflowTypes(functionTypesImportPath, rpcMapImportPath)
|
|
78
171
|
)
|
|
79
172
|
|
|
80
|
-
//
|
|
173
|
+
// Generate workflow map (I/O types for type-safe client)
|
|
174
|
+
// Always generate even if empty - RPC map imports WorkflowMap
|
|
81
175
|
await writeFileInDir(
|
|
82
176
|
logger,
|
|
83
177
|
workflowMapDeclarationFile,
|
|
@@ -90,6 +184,7 @@ export const pikkuWorkflow: any = pikkuSessionlessFunc<
|
|
|
90
184
|
)
|
|
91
185
|
)
|
|
92
186
|
|
|
187
|
+
// Generate workflow workers if configured
|
|
93
188
|
if (config.workflows) {
|
|
94
189
|
if (config.workflows.singleQueue) {
|
|
95
190
|
const workflowPath = join(config.rootDir, config.workflows.path)
|
|
@@ -112,12 +207,12 @@ export const pikkuWorkflow: any = pikkuSessionlessFunc<
|
|
|
112
207
|
}
|
|
113
208
|
}
|
|
114
209
|
|
|
115
|
-
return
|
|
210
|
+
return hasWorkflows
|
|
116
211
|
},
|
|
117
212
|
middleware: [
|
|
118
213
|
logCommandInfoAndTime({
|
|
119
|
-
commandStart: '
|
|
120
|
-
commandEnd: '
|
|
214
|
+
commandStart: 'Generating Workflows',
|
|
215
|
+
commandEnd: 'Generated Workflows',
|
|
121
216
|
}),
|
|
122
217
|
],
|
|
123
218
|
})
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate workflow map type definitions for type-safe client API
|
|
3
|
+
*/
|
|
1
4
|
import type { WorkflowsMeta } from '@pikku/core/workflow'
|
|
2
5
|
import { serializeImportMap } from '../../../utils/serialize-import-map.js'
|
|
3
6
|
import { TypesMap } from '@pikku/inspector'
|
|
@@ -12,7 +15,8 @@ export const serializeWorkflowMap = (
|
|
|
12
15
|
workflowsMeta: WorkflowsMeta
|
|
13
16
|
) => {
|
|
14
17
|
const requiredTypes = new Set<string>()
|
|
15
|
-
|
|
18
|
+
|
|
19
|
+
// First generate workflows to collect required types
|
|
16
20
|
const serializedWorkflows = generateWorkflows(
|
|
17
21
|
workflowsMeta,
|
|
18
22
|
functionsMeta,
|
|
@@ -20,15 +24,23 @@ export const serializeWorkflowMap = (
|
|
|
20
24
|
requiredTypes
|
|
21
25
|
)
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
typesMap,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
// Only generate custom types if we have workflows with types
|
|
28
|
+
const hasWorkflows = Object.keys(workflowsMeta).length > 0
|
|
29
|
+
const serializedCustomTypes = hasWorkflows
|
|
30
|
+
? generateCustomTypes(typesMap, requiredTypes)
|
|
31
|
+
: ''
|
|
32
|
+
|
|
33
|
+
const serializedImportMap = hasWorkflows
|
|
34
|
+
? serializeImportMap(
|
|
35
|
+
relativeToPath,
|
|
36
|
+
packageMappings,
|
|
37
|
+
typesMap,
|
|
38
|
+
requiredTypes
|
|
39
|
+
)
|
|
40
|
+
: ''
|
|
29
41
|
|
|
30
42
|
return `/**
|
|
31
|
-
*
|
|
43
|
+
* Workflow type map with input/output types for each workflow
|
|
32
44
|
*/
|
|
33
45
|
|
|
34
46
|
${serializedImportMap}
|
|
@@ -41,33 +53,16 @@ interface WorkflowHandler<I, O> {
|
|
|
41
53
|
|
|
42
54
|
${serializedWorkflows}
|
|
43
55
|
|
|
44
|
-
/**
|
|
45
|
-
* Type-safe workflow client API
|
|
46
|
-
*/
|
|
47
56
|
export type WorkflowClient<Name extends keyof WorkflowMap> = {
|
|
48
|
-
/**
|
|
49
|
-
* Start a new workflow run
|
|
50
|
-
*/
|
|
51
57
|
start: (input: WorkflowMap[Name]['input']) => Promise<{ runId: string }>;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Get a workflow run by ID
|
|
55
|
-
*/
|
|
56
58
|
getRun: <output extends keyof WorkflowMap[Name]>(runId: string) => Promise<WorkflowMap[Name][output]>;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Cancel a running workflow
|
|
60
|
-
*/
|
|
61
59
|
cancelRun: (runId: string) => Promise<boolean>;
|
|
62
60
|
}
|
|
63
61
|
|
|
64
|
-
/**
|
|
65
|
-
* Map of all registered workflows with type-safe client APIs
|
|
66
|
-
*/
|
|
67
62
|
export type TypedWorkflowClients = {
|
|
68
63
|
[Name in keyof WorkflowMap]: WorkflowClient<Name>;
|
|
69
64
|
}
|
|
70
|
-
|
|
65
|
+
`
|
|
71
66
|
}
|
|
72
67
|
|
|
73
68
|
function generateWorkflows(
|
|
@@ -76,13 +71,11 @@ function generateWorkflows(
|
|
|
76
71
|
typesMap: TypesMap,
|
|
77
72
|
requiredTypes: Set<string>
|
|
78
73
|
) {
|
|
79
|
-
// Initialize an object to collect workflows
|
|
80
74
|
const workflowsObj: Record<
|
|
81
75
|
string,
|
|
82
76
|
{ inputType: string; outputType: string }
|
|
83
77
|
> = {}
|
|
84
78
|
|
|
85
|
-
// Iterate through workflow metadata
|
|
86
79
|
for (const [workflowName, { pikkuFuncName }] of Object.entries(
|
|
87
80
|
workflowsMeta
|
|
88
81
|
)) {
|
|
@@ -96,27 +89,32 @@ function generateWorkflows(
|
|
|
96
89
|
const input = functionMeta.inputs ? functionMeta.inputs[0] : undefined
|
|
97
90
|
const output = functionMeta.outputs ? functionMeta.outputs[0] : undefined
|
|
98
91
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
92
|
+
let inputType = 'void'
|
|
93
|
+
if (input) {
|
|
94
|
+
try {
|
|
95
|
+
inputType = typesMap.getTypeMeta(input).uniqueName
|
|
96
|
+
} catch {
|
|
97
|
+
inputType = input
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
let outputType = 'void'
|
|
101
|
+
if (output) {
|
|
102
|
+
try {
|
|
103
|
+
outputType = typesMap.getTypeMeta(output).uniqueName
|
|
104
|
+
} catch {
|
|
105
|
+
outputType = output
|
|
106
|
+
}
|
|
107
|
+
}
|
|
102
108
|
|
|
103
109
|
requiredTypes.add(inputType)
|
|
104
110
|
requiredTypes.add(outputType)
|
|
105
|
-
|
|
106
|
-
// Add workflow entry
|
|
107
|
-
workflowsObj[workflowName] = {
|
|
108
|
-
inputType,
|
|
109
|
-
outputType,
|
|
110
|
-
}
|
|
111
|
+
workflowsObj[workflowName] = { inputType, outputType }
|
|
111
112
|
}
|
|
112
113
|
|
|
113
|
-
// Build the Workflows object as a string
|
|
114
114
|
let workflowsStr = 'export type WorkflowMap = {\n'
|
|
115
|
-
|
|
116
115
|
for (const [workflowName, handler] of Object.entries(workflowsObj)) {
|
|
117
116
|
workflowsStr += ` readonly '${workflowName}': WorkflowHandler<${handler.inputType}, ${handler.outputType}>,\n`
|
|
118
117
|
}
|
|
119
|
-
|
|
120
118
|
workflowsStr += '};\n'
|
|
121
119
|
|
|
122
120
|
return workflowsStr
|
|
@@ -1,16 +1,73 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Generate workflow meta aggregation file that imports individual workflow JSON files
|
|
3
|
+
* and registers them with pikkuState
|
|
4
|
+
*/
|
|
5
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js'
|
|
2
6
|
|
|
3
|
-
export const serializeWorkflowMeta = (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
export const serializeWorkflowMeta = (
|
|
8
|
+
outputPath: string,
|
|
9
|
+
metaDir: string,
|
|
10
|
+
workflowNames: string[],
|
|
11
|
+
packageMappings: Record<string, string>,
|
|
12
|
+
supportsImportAttributes: boolean,
|
|
13
|
+
packageName?: string
|
|
14
|
+
) => {
|
|
15
|
+
const lines: string[] = []
|
|
16
|
+
|
|
17
|
+
if (workflowNames.length === 0) {
|
|
18
|
+
// Empty meta file - still need to register empty meta
|
|
19
|
+
lines.push("import { pikkuState } from '@pikku/core'")
|
|
20
|
+
lines.push(
|
|
21
|
+
"import type { SerializedWorkflowGraphs } from '@pikku/inspector/workflow-graph'"
|
|
22
|
+
)
|
|
23
|
+
lines.push('')
|
|
24
|
+
lines.push('const workflowsMeta: SerializedWorkflowGraphs = {}')
|
|
25
|
+
lines.push('')
|
|
26
|
+
const packageNameValue = packageName ? `'${packageName}'` : 'null'
|
|
27
|
+
lines.push(
|
|
28
|
+
`pikkuState(${packageNameValue}, 'workflows', 'meta', workflowsMeta)`
|
|
29
|
+
)
|
|
30
|
+
return lines.join('\n')
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Imports
|
|
34
|
+
lines.push("import { pikkuState } from '@pikku/core'")
|
|
35
|
+
lines.push(
|
|
36
|
+
"import type { SerializedWorkflowGraphs } from '@pikku/inspector/workflow-graph'"
|
|
8
37
|
)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
38
|
+
lines.push('')
|
|
39
|
+
|
|
40
|
+
// Import each workflow meta JSON
|
|
41
|
+
const sortedNames = [...workflowNames].sort()
|
|
42
|
+
for (const name of sortedNames) {
|
|
43
|
+
const jsonPath = `${metaDir}/${name}.gen.json`
|
|
44
|
+
const importPath = getFileImportRelativePath(
|
|
45
|
+
outputPath,
|
|
46
|
+
jsonPath,
|
|
47
|
+
packageMappings
|
|
13
48
|
)
|
|
49
|
+
const importStatement = supportsImportAttributes
|
|
50
|
+
? `import ${name}Meta from '${importPath}' with { type: 'json' }`
|
|
51
|
+
: `import ${name}Meta from '${importPath}'`
|
|
52
|
+
lines.push(importStatement)
|
|
14
53
|
}
|
|
15
|
-
|
|
54
|
+
|
|
55
|
+
lines.push('')
|
|
56
|
+
|
|
57
|
+
// Create aggregated meta object (cast JSON imports to proper types)
|
|
58
|
+
lines.push('const workflowsMeta = {')
|
|
59
|
+
for (const name of sortedNames) {
|
|
60
|
+
lines.push(` '${name}': ${name}Meta,`)
|
|
61
|
+
}
|
|
62
|
+
lines.push('} as SerializedWorkflowGraphs')
|
|
63
|
+
|
|
64
|
+
lines.push('')
|
|
65
|
+
|
|
66
|
+
// Register meta with pikkuState
|
|
67
|
+
const packageNameValue = packageName ? `'${packageName}'` : 'null'
|
|
68
|
+
lines.push(
|
|
69
|
+
`pikkuState(${packageNameValue}, 'workflows', 'meta', workflowsMeta)`
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
return lines.join('\n')
|
|
16
73
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate workflow runtime registration
|
|
3
|
+
* Imports meta (which registers with pikkuState) and registers DSL workflows (addWorkflow) and graph workflows (addWorkflowGraph)
|
|
4
|
+
*/
|
|
5
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js'
|
|
6
|
+
|
|
7
|
+
export const serializeWorkflowRegistration = (
|
|
8
|
+
outputPath: string,
|
|
9
|
+
metaImportPath: string,
|
|
10
|
+
workflowNames: string[],
|
|
11
|
+
workflowFiles: Map<string, { path: string; exportedName: string }>,
|
|
12
|
+
graphFiles: Map<string, { path: string; exportedName: string }>,
|
|
13
|
+
packageMappings: Record<string, string>,
|
|
14
|
+
_packageName?: string
|
|
15
|
+
) => {
|
|
16
|
+
const lines: string[] = []
|
|
17
|
+
const hasWorkflows = workflowNames.length > 0
|
|
18
|
+
const hasDslWorkflows = workflowFiles.size > 0
|
|
19
|
+
const hasGraphWorkflows = graphFiles.size > 0
|
|
20
|
+
|
|
21
|
+
// Imports
|
|
22
|
+
const imports: string[] = []
|
|
23
|
+
if (hasDslWorkflows) {
|
|
24
|
+
imports.push('addWorkflow')
|
|
25
|
+
}
|
|
26
|
+
if (hasGraphWorkflows) {
|
|
27
|
+
imports.push('addWorkflowGraph')
|
|
28
|
+
}
|
|
29
|
+
if (imports.length > 0) {
|
|
30
|
+
lines.push(`import { ${imports.join(', ')} } from '@pikku/core/workflow'`)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Import meta file (which registers meta with pikkuState)
|
|
34
|
+
if (hasWorkflows) {
|
|
35
|
+
lines.push(`import '${metaImportPath}'`)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Import DSL workflow functions
|
|
39
|
+
const sortedWorkflows = Array.from(workflowFiles.entries()).sort((a, b) =>
|
|
40
|
+
a[0].localeCompare(b[0])
|
|
41
|
+
)
|
|
42
|
+
for (const [, { path, exportedName }] of sortedWorkflows) {
|
|
43
|
+
const importPath = getFileImportRelativePath(
|
|
44
|
+
outputPath,
|
|
45
|
+
path,
|
|
46
|
+
packageMappings
|
|
47
|
+
)
|
|
48
|
+
lines.push(`import { ${exportedName} } from '${importPath}'`)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Import graph workflow definitions
|
|
52
|
+
const sortedGraphWorkflows = Array.from(graphFiles.entries()).sort((a, b) =>
|
|
53
|
+
a[0].localeCompare(b[0])
|
|
54
|
+
)
|
|
55
|
+
for (const [, { path, exportedName }] of sortedGraphWorkflows) {
|
|
56
|
+
const importPath = getFileImportRelativePath(
|
|
57
|
+
outputPath,
|
|
58
|
+
path,
|
|
59
|
+
packageMappings
|
|
60
|
+
)
|
|
61
|
+
lines.push(`import { ${exportedName} } from '${importPath}'`)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
lines.push('')
|
|
65
|
+
|
|
66
|
+
// Register DSL workflows
|
|
67
|
+
for (const [pikkuFuncName, { exportedName }] of sortedWorkflows) {
|
|
68
|
+
lines.push(`addWorkflow('${pikkuFuncName}', ${exportedName})`)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Register graph workflows
|
|
72
|
+
for (const [workflowName, { exportedName }] of sortedGraphWorkflows) {
|
|
73
|
+
lines.push(`addWorkflowGraph('${workflowName}', ${exportedName})`)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Export workflow names type
|
|
77
|
+
if (hasWorkflows) {
|
|
78
|
+
lines.push('')
|
|
79
|
+
lines.push(`export type WorkflowNames = '${workflowNames.join("' | '")}'`)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return lines.join('\n')
|
|
83
|
+
}
|