@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,15 +2,29 @@ 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 { getFileImportRelativePath } from '../../../utils/file-import-path.js';
|
|
6
|
+
import { stripVerboseFields, hasVerboseFields, } from '../../../utils/strip-verbose-meta.js';
|
|
5
7
|
export const pikkuCLI = pikkuSessionlessFunc({
|
|
6
8
|
func: async ({ logger, config, getInspectorState }) => {
|
|
7
9
|
const visitState = await getInspectorState();
|
|
8
|
-
const { cliWiringsFile, cliWiringMetaFile, packageMappings } = config;
|
|
10
|
+
const { cliWiringsFile, cliWiringMetaFile, cliWiringMetaJsonFile, packageMappings, schema, } = config;
|
|
9
11
|
const { cli } = visitState;
|
|
10
12
|
// Generate CLI wirings file
|
|
11
13
|
await writeFileInDir(logger, cliWiringsFile, serializeFileImports('wireCLI', cliWiringsFile, cli.files, packageMappings));
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
+
// Write minimal JSON (runtime-only fields)
|
|
15
|
+
const minimalMeta = stripVerboseFields(cli.meta);
|
|
16
|
+
await writeFileInDir(logger, cliWiringMetaJsonFile, JSON.stringify(minimalMeta, null, 2));
|
|
17
|
+
// Write verbose JSON only if it has additional fields
|
|
18
|
+
if (hasVerboseFields(cli.meta)) {
|
|
19
|
+
const verbosePath = cliWiringMetaJsonFile.replace(/\.gen\.json$/, '-verbose.gen.json');
|
|
20
|
+
await writeFileInDir(logger, verbosePath, JSON.stringify(cli.meta, null, 2));
|
|
21
|
+
}
|
|
22
|
+
const jsonImportPath = getFileImportRelativePath(cliWiringMetaFile, cliWiringMetaJsonFile, packageMappings);
|
|
23
|
+
const supportsImportAttributes = schema?.supportsImportAttributes ?? false;
|
|
24
|
+
const importStatement = supportsImportAttributes
|
|
25
|
+
? `import metaData from '${jsonImportPath}' with { type: 'json' }`
|
|
26
|
+
: `import metaData from '${jsonImportPath}'`;
|
|
27
|
+
await writeFileInDir(logger, cliWiringMetaFile, `import { pikkuState } from '@pikku/core'\nimport { CLIMeta } from '@pikku/core/cli'\n${importStatement}\npikkuState(null, 'cli', 'meta', metaData as CLIMeta)`);
|
|
14
28
|
return true;
|
|
15
29
|
},
|
|
16
30
|
middleware: [
|
|
@@ -50,7 +50,7 @@ import { pikkuMiddleware } from '${functionTypesPath}'
|
|
|
50
50
|
${imports}
|
|
51
51
|
|
|
52
52
|
// Middleware to close the channel after CLI command completes
|
|
53
|
-
const cliCloseOnComplete = pikkuMiddleware(async (
|
|
53
|
+
const cliCloseOnComplete = pikkuMiddleware(async (_services, { channel }, next) => {
|
|
54
54
|
const closeChannel = () => {
|
|
55
55
|
setTimeout(async () => {
|
|
56
56
|
try {
|
|
@@ -50,7 +50,7 @@ export const pikkuCLIRender = <Data, RequiredServices extends SingletonServices
|
|
|
50
50
|
* CLI command configuration with project-specific types.
|
|
51
51
|
* Uses CoreCLICommandConfig from @pikku/core with local middleware and render types.
|
|
52
52
|
*/
|
|
53
|
-
type CLICommandConfig<Func extends PikkuFunctionConfig<In, Out>, In = any, Out = any, Params extends string = string> = CoreCLICommandConfig<Func, PikkuMiddleware, PikkuCLIRender<any>, Params>
|
|
53
|
+
type CLICommandConfig<Func extends PikkuFunctionConfig<In, Out, 'cli' | 'rpc' | 'session'>, In = any, Out = any, Params extends string = string> = CoreCLICommandConfig<Func, PikkuMiddleware, PikkuCLIRender<any>, Params>
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* Type definition for CLI applications with commands and global options.
|
|
@@ -84,7 +84,7 @@ export const wireCLI = <Commands extends Record<string, CoreCLICommandConfig<any
|
|
|
84
84
|
* @returns CLI command configuration with inferred types
|
|
85
85
|
*/
|
|
86
86
|
export const pikkuCLICommand = <
|
|
87
|
-
FuncConfig extends PikkuFunctionConfig<any, any>,
|
|
87
|
+
FuncConfig extends PikkuFunctionConfig<any, any, 'cli' | 'rpc' | 'session'>,
|
|
88
88
|
Params extends string
|
|
89
89
|
>(
|
|
90
90
|
config: CLICommandConfig<FuncConfig, any, any, Params>
|
|
@@ -8,7 +8,7 @@ export declare function serializeLocalCLIBootstrap(programName: string, _program
|
|
|
8
8
|
}, singletonServicesFactory: {
|
|
9
9
|
file: string;
|
|
10
10
|
variable: string;
|
|
11
|
-
},
|
|
11
|
+
}, wireServicesFactory: {
|
|
12
12
|
file: string;
|
|
13
13
|
variable: string;
|
|
14
14
|
}): string;
|
|
@@ -2,18 +2,18 @@ import { getFileImportRelativePath } from '../../../utils/file-import-path.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Serializes the local (in-program) CLI bootstrap code
|
|
4
4
|
*/
|
|
5
|
-
export function serializeLocalCLIBootstrap(programName, _programMeta, bootstrapFile, config, pikkuConfigFactory, singletonServicesFactory,
|
|
5
|
+
export function serializeLocalCLIBootstrap(programName, _programMeta, bootstrapFile, config, pikkuConfigFactory, singletonServicesFactory, wireServicesFactory) {
|
|
6
6
|
const capitalizedName = programName.charAt(0).toUpperCase() + programName.slice(1).replace(/-/g, '');
|
|
7
7
|
// Get relative import paths
|
|
8
8
|
const pikkuConfigPath = getFileImportRelativePath(bootstrapFile, pikkuConfigFactory.file, config.packageMappings);
|
|
9
9
|
const singletonServicesPath = getFileImportRelativePath(bootstrapFile, singletonServicesFactory.file, config.packageMappings);
|
|
10
|
-
const
|
|
10
|
+
const wireServicesPath = getFileImportRelativePath(bootstrapFile, wireServicesFactory.file, config.packageMappings);
|
|
11
11
|
const cliBootstrapPath = getFileImportRelativePath(bootstrapFile, config.bootstrapFile, config.packageMappings);
|
|
12
12
|
return `
|
|
13
13
|
import { executeCLI, CLIError } from '@pikku/core/cli'
|
|
14
14
|
import { ${pikkuConfigFactory.variable} as createConfig } from '${pikkuConfigPath}'
|
|
15
15
|
import { ${singletonServicesFactory.variable} as createSingletonServices } from '${singletonServicesPath}'
|
|
16
|
-
import { ${
|
|
16
|
+
import { ${wireServicesFactory.variable} as createWireServices } from '${wireServicesPath}'
|
|
17
17
|
import '${cliBootstrapPath}'
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -27,7 +27,7 @@ export async function ${capitalizedName}CLI(args: string[]): Promise<void> {
|
|
|
27
27
|
args: args || process.argv.slice(2),
|
|
28
28
|
createConfig,
|
|
29
29
|
createSingletonServices,
|
|
30
|
-
|
|
30
|
+
createWireServices,
|
|
31
31
|
})
|
|
32
32
|
} catch (error) {
|
|
33
33
|
if (error instanceof CLIError) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuForgeNodes: any;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js';
|
|
2
|
+
import { ErrorCode } from '@pikku/inspector';
|
|
3
|
+
import { writeFileInDir } from '../../../utils/file-writer.js';
|
|
4
|
+
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js';
|
|
5
|
+
import { readFile } from 'fs/promises';
|
|
6
|
+
import { join, isAbsolute } from 'path';
|
|
7
|
+
import { stripVerboseFields, hasVerboseFields, } from '../../../utils/strip-verbose-meta.js';
|
|
8
|
+
/**
|
|
9
|
+
* Load and sanitize an SVG icon file.
|
|
10
|
+
* Returns the SVG content as a string, or undefined if not found.
|
|
11
|
+
*/
|
|
12
|
+
const loadIcon = async (iconPath, rootDir, logger) => {
|
|
13
|
+
if (!iconPath)
|
|
14
|
+
return undefined;
|
|
15
|
+
// Resolve the full path to the icon
|
|
16
|
+
const fullPath = isAbsolute(iconPath) ? iconPath : join(rootDir, iconPath);
|
|
17
|
+
try {
|
|
18
|
+
const content = await readFile(fullPath, 'utf-8');
|
|
19
|
+
// Basic SVG validation - must start with <svg
|
|
20
|
+
const trimmed = content.trim();
|
|
21
|
+
if (!trimmed.startsWith('<svg') && !trimmed.startsWith('<?xml')) {
|
|
22
|
+
logger.warn(`Icon file is not a valid SVG: ${fullPath}`);
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
// Return the sanitized SVG (remove XML declaration if present)
|
|
26
|
+
return trimmed.replace(/<\?xml[^?]*\?>\s*/g, '').trim();
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
logger.warn(`Could not load icon: ${fullPath}`);
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export const pikkuForgeNodes = pikkuSessionlessFunc({
|
|
34
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
35
|
+
const { forgeNodes, forgeCredentials } = await getInspectorState();
|
|
36
|
+
const { forgeNodesMetaJsonFile, forge, rootDir } = config;
|
|
37
|
+
const hasNodes = Object.keys(forgeNodes.meta).length > 0;
|
|
38
|
+
const hasCredentials = Object.keys(forgeCredentials.meta).length > 0;
|
|
39
|
+
// Only generate if there are forge nodes or credentials
|
|
40
|
+
if (!hasNodes && !hasCredentials) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
// Validate categories if configured
|
|
44
|
+
const allowedCategories = forge?.node?.categories;
|
|
45
|
+
if (allowedCategories && allowedCategories.length > 0) {
|
|
46
|
+
for (const [name, meta] of Object.entries(forgeNodes.meta)) {
|
|
47
|
+
if (!allowedCategories.includes(meta.category)) {
|
|
48
|
+
logger.critical(ErrorCode.INVALID_VALUE, `Forge node '${name}' has invalid category '${meta.category}'. ` +
|
|
49
|
+
`Allowed categories: ${allowedCategories.join(', ')}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Build the output metadata - remove per-node icon field
|
|
54
|
+
const outputMeta = {};
|
|
55
|
+
for (const [name, meta] of Object.entries(forgeNodes.meta)) {
|
|
56
|
+
// Remove icon from node meta - only package-level icon is used
|
|
57
|
+
const { icon: _icon, ...nodeMetaWithoutIcon } = meta;
|
|
58
|
+
outputMeta[name] = nodeMetaWithoutIcon;
|
|
59
|
+
}
|
|
60
|
+
// Load package-level icon
|
|
61
|
+
const packageIcon = await loadIcon(forge?.node?.icon, rootDir, logger);
|
|
62
|
+
const metaData = {
|
|
63
|
+
nodes: outputMeta,
|
|
64
|
+
credentials: forgeCredentials.meta,
|
|
65
|
+
package: {
|
|
66
|
+
displayName: forge?.node?.displayName,
|
|
67
|
+
description: forge?.node?.description,
|
|
68
|
+
icon: packageIcon,
|
|
69
|
+
categories: forge?.node?.categories,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
if (forgeNodesMetaJsonFile) {
|
|
73
|
+
// Write minimal JSON (runtime-only fields)
|
|
74
|
+
const minimalMeta = stripVerboseFields(metaData);
|
|
75
|
+
await writeFileInDir(logger, forgeNodesMetaJsonFile, JSON.stringify(minimalMeta, null, 2), { ignoreModifyComment: true });
|
|
76
|
+
// Write verbose JSON only if it has additional fields
|
|
77
|
+
if (hasVerboseFields(metaData)) {
|
|
78
|
+
const verbosePath = forgeNodesMetaJsonFile.replace(/\.gen\.json$/, '-verbose.gen.json');
|
|
79
|
+
await writeFileInDir(logger, verbosePath, JSON.stringify(metaData, null, 2), { ignoreModifyComment: true });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
},
|
|
84
|
+
middleware: [
|
|
85
|
+
logCommandInfoAndTime({
|
|
86
|
+
commandStart: 'Generating Forge nodes metadata',
|
|
87
|
+
commandEnd: 'Generated Forge nodes metadata',
|
|
88
|
+
}),
|
|
89
|
+
],
|
|
90
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuForgeTypes: any;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js';
|
|
2
|
+
import { writeFileInDir } from '../../../utils/file-writer.js';
|
|
3
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js';
|
|
4
|
+
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js';
|
|
5
|
+
import { serializeForgeTypes } from './serialize-forge-types.js';
|
|
6
|
+
export const pikkuForgeTypes = pikkuSessionlessFunc({
|
|
7
|
+
func: async ({ logger, config }) => {
|
|
8
|
+
const { forgeTypesFile, rpcInternalMapDeclarationFile, packageMappings, forge, } = config;
|
|
9
|
+
// Get the import path for the RPC map declaration file
|
|
10
|
+
// The declaration file ends in .d.ts, but we need to import from .js
|
|
11
|
+
// getFileImportRelativePath converts .ts -> .js, so .d.ts -> .d.js
|
|
12
|
+
// We need to remove the extra .d extension
|
|
13
|
+
let rpcMapImportPath = getFileImportRelativePath(forgeTypesFile, rpcInternalMapDeclarationFile, packageMappings);
|
|
14
|
+
// Fix: .d.ts files should be imported as .js (TypeScript resolves types from .d.ts)
|
|
15
|
+
rpcMapImportPath = rpcMapImportPath.replace('.d.js', '.js');
|
|
16
|
+
const categories = forge?.node?.categories;
|
|
17
|
+
const content = serializeForgeTypes(rpcMapImportPath, categories);
|
|
18
|
+
await writeFileInDir(logger, forgeTypesFile, content);
|
|
19
|
+
},
|
|
20
|
+
middleware: [
|
|
21
|
+
logCommandInfoAndTime({
|
|
22
|
+
commandStart: 'Creating Forge types',
|
|
23
|
+
commandEnd: 'Created Forge types',
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates type definitions for Forge wirings with typed category and RPC validation
|
|
3
|
+
*/
|
|
4
|
+
export const serializeForgeTypes = (rpcMapImportPath, categories) => {
|
|
5
|
+
// Generate category union type - 'never' if no categories configured
|
|
6
|
+
const categoryType = categories?.length
|
|
7
|
+
? categories.map((c) => `'${c}'`).join(' | ')
|
|
8
|
+
: 'never';
|
|
9
|
+
return `/**
|
|
10
|
+
* Forge-specific type definitions for typed wireForgeNode and wireForgeCredential
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { wireForgeNode as wireForgeNodeCore, wireForgeCredential as wireForgeCredentialCore } from '@pikku/core/forge-node'
|
|
14
|
+
import type { CoreForgeNode, CoreForgeCredential } from '@pikku/core/forge-node'
|
|
15
|
+
import type { FlattenedRPCMap } from '${rpcMapImportPath}'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Valid category values for forge nodes.
|
|
19
|
+
* ${categories?.length ? `Configured categories: ${categories.join(', ')}` : 'No categories configured - wireForgeNode cannot be used until forge.node.categories is defined in pikku.config.json.'}
|
|
20
|
+
*/
|
|
21
|
+
export type ForgeCategory = ${categoryType}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Valid RPC names that can be used with forge nodes.
|
|
25
|
+
* These are derived from the FlattenedRPCMap which includes both local and external package RPCs.
|
|
26
|
+
*/
|
|
27
|
+
export type ForgeRPCName = keyof FlattenedRPCMap
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Typed forge node configuration.
|
|
31
|
+
* Validates that category and rpc are valid values.
|
|
32
|
+
*/
|
|
33
|
+
export type TypedForgeNode = Omit<CoreForgeNode, 'category' | 'rpc'> & {
|
|
34
|
+
/** Grouping category (validated against forge.node.categories in config) */
|
|
35
|
+
category: ForgeCategory
|
|
36
|
+
/** RPC name to call when node executes (must be a valid RPC name) */
|
|
37
|
+
rpc: ForgeRPCName
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Registers a Forge node with validated category and RPC.
|
|
42
|
+
*
|
|
43
|
+
* @param config - Forge node configuration with typed category and rpc
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* \`\`\`typescript
|
|
47
|
+
* wireForgeNode({
|
|
48
|
+
* name: 'send-email',
|
|
49
|
+
* displayName: 'Send Email',
|
|
50
|
+
* category: 'Communication', // Must be in forge.node.categories
|
|
51
|
+
* type: 'action',
|
|
52
|
+
* rpc: 'sendEmail', // Must be a valid RPC name
|
|
53
|
+
* description: 'Sends an email to a recipient'
|
|
54
|
+
* })
|
|
55
|
+
* \`\`\`
|
|
56
|
+
*/
|
|
57
|
+
export const wireForgeNode = (config: TypedForgeNode): void => {
|
|
58
|
+
wireForgeNodeCore(config as CoreForgeNode)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Registers a Forge credential definition.
|
|
63
|
+
* Credentials define secrets/API keys required by the package.
|
|
64
|
+
*
|
|
65
|
+
* @template T - Zod schema type for the credential structure
|
|
66
|
+
* @param config - Forge credential configuration
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* \`\`\`typescript
|
|
70
|
+
* import { z } from 'zod'
|
|
71
|
+
*
|
|
72
|
+
* const apiCredentials = z.object({
|
|
73
|
+
* apiKey: z.string().describe('API key for authentication'),
|
|
74
|
+
* apiSecret: z.string().describe('API secret')
|
|
75
|
+
* })
|
|
76
|
+
*
|
|
77
|
+
* wireForgeCredential({
|
|
78
|
+
* name: 'example-api',
|
|
79
|
+
* displayName: 'Example API Credentials',
|
|
80
|
+
* description: 'Credentials for the example external API',
|
|
81
|
+
* secretId: 'EXAMPLE_API_CREDENTIALS',
|
|
82
|
+
* schema: apiCredentials
|
|
83
|
+
* })
|
|
84
|
+
* \`\`\`
|
|
85
|
+
*/
|
|
86
|
+
export const wireForgeCredential = <T>(config: CoreForgeCredential<T>): void => {
|
|
87
|
+
wireForgeCredentialCore(config)
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
};
|
|
@@ -11,17 +11,17 @@ export const pikkuFunctionTypesSplit = pikkuSessionlessFunc({
|
|
|
11
11
|
// Check for required types
|
|
12
12
|
checkRequiredTypes(visitState.filesAndMethodsErrors, {
|
|
13
13
|
userSessionType: true,
|
|
14
|
-
|
|
14
|
+
wireServiceType: true,
|
|
15
15
|
singletonServicesType: true,
|
|
16
16
|
});
|
|
17
|
-
const { userSessionType,
|
|
18
|
-
if (!userSessionType || !
|
|
17
|
+
const { userSessionType, wireServicesType, singletonServicesType, pikkuConfigType, } = visitState.filesAndMethods;
|
|
18
|
+
if (!userSessionType || !wireServicesType || !singletonServicesType) {
|
|
19
19
|
throw new Error('Required types not found');
|
|
20
20
|
}
|
|
21
21
|
const configTypeImport = pikkuConfigType
|
|
22
22
|
? `import type { ${pikkuConfigType.type} } from '${getFileImportRelativePath(functionTypesFile, pikkuConfigType.typePath, packageMappings)}'`
|
|
23
23
|
: '// Config type not found, will use fallback';
|
|
24
|
-
const content = serializeFunctionTypes(`import type { ${userSessionType.type} } from '${getFileImportRelativePath(functionTypesFile, userSessionType.typePath, packageMappings)}'`, userSessionType.type, `import type { ${singletonServicesType.type} } from '${getFileImportRelativePath(functionTypesFile, singletonServicesType.typePath, packageMappings)}'`, singletonServicesType.type, `import type { ${
|
|
24
|
+
const content = serializeFunctionTypes(`import type { ${userSessionType.type} } from '${getFileImportRelativePath(functionTypesFile, userSessionType.typePath, packageMappings)}'`, userSessionType.type, `import type { ${singletonServicesType.type} } from '${getFileImportRelativePath(functionTypesFile, singletonServicesType.typePath, packageMappings)}'`, singletonServicesType.type, `import type { ${wireServicesType.type} } from '${getFileImportRelativePath(functionTypesFile, wireServicesType.typePath, packageMappings)}'`, wireServicesType.type, `import type { TypedPikkuRPC, FlattenedRPCMap } from '${getFileImportRelativePath(functionTypesFile, rpcInternalMapDeclarationFile, packageMappings)}'`, `import type { RequiredSingletonServices, RequiredWireServices } from '${getFileImportRelativePath(functionTypesFile, servicesFile, packageMappings)}'`, configTypeImport, config.externalPackageName);
|
|
25
25
|
await writeFileInDir(logger, functionTypesFile, content);
|
|
26
26
|
},
|
|
27
27
|
middleware: [
|
|
@@ -5,8 +5,13 @@ import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-
|
|
|
5
5
|
import { serializePikkuTypesHub } from './serialize-pikku-types-hub.js';
|
|
6
6
|
export const pikkuFunctionTypes = pikkuSessionlessFunc({
|
|
7
7
|
func: async ({ logger, config }) => {
|
|
8
|
-
const { typesDeclarationFile: typesFile, packageMappings, functionTypesFile, httpTypesFile, channelsTypesFile, schedulersTypesFile, queueTypesFile, mcpTypesFile, cliTypesFile, } = config;
|
|
9
|
-
const
|
|
8
|
+
const { typesDeclarationFile: typesFile, packageMappings, functionTypesFile, httpTypesFile, channelsTypesFile, schedulersTypesFile, queueTypesFile, mcpTypesFile, cliTypesFile, forgeTypesFile, } = config;
|
|
9
|
+
const getImportPath = (file) => config.externalPackage
|
|
10
|
+
? null
|
|
11
|
+
: getFileImportRelativePath(typesFile, file, packageMappings);
|
|
12
|
+
// Forge types are included for external packages (they need wireForgeNode/wireForgeCredential)
|
|
13
|
+
const getForgeImportPath = (file) => getFileImportRelativePath(typesFile, file, packageMappings);
|
|
14
|
+
const content = serializePikkuTypesHub(getFileImportRelativePath(typesFile, functionTypesFile, packageMappings), getImportPath(httpTypesFile), getImportPath(channelsTypesFile), getImportPath(schedulersTypesFile), getImportPath(queueTypesFile), getImportPath(mcpTypesFile), getImportPath(cliTypesFile), getForgeImportPath(forgeTypesFile));
|
|
10
15
|
await writeFileInDir(logger, typesFile, content);
|
|
11
16
|
},
|
|
12
17
|
middleware: [
|
|
@@ -1,21 +1,46 @@
|
|
|
1
1
|
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js';
|
|
2
2
|
import { writeFileInDir } from '../../../utils/file-writer.js';
|
|
3
3
|
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js';
|
|
4
|
-
import {
|
|
4
|
+
import { serializeFunctionImports } from './serialize-function-imports.js';
|
|
5
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js';
|
|
6
|
+
import { stripVerboseFields, hasVerboseFields, } from '../../../utils/strip-verbose-meta.js';
|
|
5
7
|
export const pikkuFunctions = pikkuSessionlessFunc({
|
|
6
8
|
func: async ({ logger, config, getInspectorState }) => {
|
|
7
9
|
const { functions, rpc } = await getInspectorState();
|
|
8
|
-
const { functionsMetaFile,
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const { functionsMetaFile, functionsMetaJsonFile, functionsFile, packageMappings, schema, } = config;
|
|
11
|
+
// Write minimal JSON (runtime-only fields)
|
|
12
|
+
const minimalMeta = stripVerboseFields(functions.meta);
|
|
13
|
+
await writeFileInDir(logger, functionsMetaJsonFile, JSON.stringify(minimalMeta, null, 2));
|
|
14
|
+
// Write verbose JSON only if it has additional fields
|
|
15
|
+
if (hasVerboseFields(functions.meta)) {
|
|
16
|
+
const verbosePath = functionsMetaJsonFile.replace(/\.gen\.json$/, '-verbose.gen.json');
|
|
17
|
+
await writeFileInDir(logger, verbosePath, JSON.stringify(functions.meta, null, 2));
|
|
18
|
+
}
|
|
19
|
+
const jsonImportPath = getFileImportRelativePath(functionsMetaFile, functionsMetaJsonFile, packageMappings);
|
|
20
|
+
const supportsImportAttributes = schema?.supportsImportAttributes ?? false;
|
|
21
|
+
const importStatement = supportsImportAttributes
|
|
22
|
+
? `import metaData from '${jsonImportPath}' with { type: 'json' }`
|
|
23
|
+
: `import metaData from '${jsonImportPath}'`;
|
|
24
|
+
const packageName = config.externalPackageName
|
|
25
|
+
? `'${config.externalPackageName}'`
|
|
26
|
+
: 'null';
|
|
27
|
+
await writeFileInDir(logger, functionsMetaFile, `import { pikkuState, FunctionsMeta } from '@pikku/core'\n${importStatement}\npikkuState(${packageName}, 'function', 'meta', metaData as FunctionsMeta)`);
|
|
28
|
+
// For external packages, register ALL functions (they'll be invoked by consumers)
|
|
29
|
+
// For main packages, only register functions that are invoked via internal RPCs
|
|
30
|
+
const isExternalPackage = !!config.externalPackageName;
|
|
14
31
|
const hasRPCs = rpc.exposedFiles.size > 0 || rpc.internalFiles.size > 0;
|
|
15
|
-
|
|
16
|
-
|
|
32
|
+
const hasFunctions = functions.files.size > 0;
|
|
33
|
+
const shouldGenerateFunctionsFile = isExternalPackage
|
|
34
|
+
? hasFunctions
|
|
35
|
+
: hasRPCs;
|
|
36
|
+
if (shouldGenerateFunctionsFile) {
|
|
37
|
+
// For external packages, use all function files; for main packages, use internal RPC files
|
|
38
|
+
const filesToRegister = isExternalPackage
|
|
39
|
+
? functions.files
|
|
40
|
+
: rpc.internalFiles;
|
|
41
|
+
await writeFileInDir(logger, functionsFile, serializeFunctionImports(functionsFile, filesToRegister, functions.meta, packageMappings, config.externalPackageName));
|
|
17
42
|
}
|
|
18
|
-
return
|
|
43
|
+
return shouldGenerateFunctionsFile;
|
|
19
44
|
},
|
|
20
45
|
middleware: [
|
|
21
46
|
logCommandInfoAndTime({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const serializeServicesMap: (allSingletonServices: string[],
|
|
1
|
+
export declare const serializeServicesMap: (allSingletonServices: string[], allWireServices: string[], requiredServices: Set<string>, forceRequiredServices: string[] | undefined, servicesImport: string, wireServicesImport: string) => string;
|
|
2
2
|
export declare const pikkuServices: any;
|
|
@@ -3,7 +3,7 @@ import { getFileImportRelativePath } from '../../../utils/file-import-path.js';
|
|
|
3
3
|
import { checkRequiredTypes } from '../../../utils/check-required-types.js';
|
|
4
4
|
import { writeFileInDir } from '../../../utils/file-writer.js';
|
|
5
5
|
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js';
|
|
6
|
-
export const serializeServicesMap = (allSingletonServices,
|
|
6
|
+
export const serializeServicesMap = (allSingletonServices, allWireServices, requiredServices, forceRequiredServices = [], servicesImport, wireServicesImport) => {
|
|
7
7
|
// Use pre-aggregated services from inspector state
|
|
8
8
|
// This includes services from:
|
|
9
9
|
// - Wired functions (HTTP, channels, queues, schedulers, MCP, CLI, RPC)
|
|
@@ -11,7 +11,7 @@ export const serializeServicesMap = (allSingletonServices, allSessionServices, r
|
|
|
11
11
|
// - Permissions used by wired functions
|
|
12
12
|
// - Session factories
|
|
13
13
|
const usedServices = new Set(requiredServices);
|
|
14
|
-
// Internal services that are created internally by the framework (
|
|
14
|
+
// Internal services that are created internally by the framework (PikkuWire)
|
|
15
15
|
// These should not appear in the services maps
|
|
16
16
|
const internalServices = new Set([
|
|
17
17
|
'rpc',
|
|
@@ -30,31 +30,31 @@ export const serializeServicesMap = (allSingletonServices, allSessionServices, r
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
// Services that are always required internally by the framework
|
|
33
|
-
const defaultServices = ['config', 'logger', 'variables', 'schema'];
|
|
33
|
+
const defaultServices = ['config', 'logger', 'variables', 'schema', 'secrets'];
|
|
34
34
|
defaultServices.forEach((service) => usedServices.add(service));
|
|
35
35
|
// Create singleton services map: all singleton services with true/false based on usage
|
|
36
36
|
const singletonServicesMap = {};
|
|
37
37
|
allSingletonServices.forEach((service) => {
|
|
38
38
|
singletonServicesMap[service] = usedServices.has(service);
|
|
39
39
|
});
|
|
40
|
-
// Create
|
|
41
|
-
// Exclude internal framework services (
|
|
42
|
-
const
|
|
43
|
-
|
|
40
|
+
// Create wire services map: all wire services with true/false based on usage
|
|
41
|
+
// Exclude internal framework services (PikkuWire)
|
|
42
|
+
const wireServicesMap = {};
|
|
43
|
+
allWireServices.forEach((service) => {
|
|
44
44
|
if (!internalServices.has(service)) {
|
|
45
|
-
|
|
45
|
+
wireServicesMap[service] = usedServices.has(service);
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
// Get all required service names (those marked as true)
|
|
49
49
|
const requiredSingletonServiceNames = Object.keys(singletonServicesMap)
|
|
50
50
|
.filter((key) => singletonServicesMap[key])
|
|
51
51
|
.sort();
|
|
52
|
-
const
|
|
53
|
-
.filter((key) =>
|
|
52
|
+
const requiredWireServiceNames = Object.keys(wireServicesMap)
|
|
53
|
+
.filter((key) => wireServicesMap[key])
|
|
54
54
|
.sort();
|
|
55
55
|
const code = [
|
|
56
56
|
servicesImport,
|
|
57
|
-
|
|
57
|
+
wireServicesImport,
|
|
58
58
|
'',
|
|
59
59
|
'// Singleton services map: true if required, false if available but unused',
|
|
60
60
|
'export const requiredSingletonServices = {',
|
|
@@ -63,11 +63,11 @@ export const serializeServicesMap = (allSingletonServices, allSessionServices, r
|
|
|
63
63
|
.map((service) => ` '${service}': ${singletonServicesMap[service]},`),
|
|
64
64
|
'} as const',
|
|
65
65
|
'',
|
|
66
|
-
'//
|
|
67
|
-
'export const
|
|
68
|
-
...Object.keys(
|
|
66
|
+
'// Wire services map: true if required, false if available but unused',
|
|
67
|
+
'export const requiredWireServices = {',
|
|
68
|
+
...Object.keys(wireServicesMap)
|
|
69
69
|
.sort()
|
|
70
|
-
.map((service) => ` '${service}': ${
|
|
70
|
+
.map((service) => ` '${service}': ${wireServicesMap[service]},`),
|
|
71
71
|
'} as const',
|
|
72
72
|
'',
|
|
73
73
|
'// Type exports',
|
|
@@ -75,9 +75,9 @@ export const serializeServicesMap = (allSingletonServices, allSessionServices, r
|
|
|
75
75
|
? `export type RequiredSingletonServices = Pick<SingletonServices, ${requiredSingletonServiceNames.map((key) => `'${key}'`).join(' | ')}> & Partial<Omit<SingletonServices, ${requiredSingletonServiceNames.map((key) => `'${key}'`).join(' | ')}>>`
|
|
76
76
|
: 'export type RequiredSingletonServices = Partial<SingletonServices>',
|
|
77
77
|
'',
|
|
78
|
-
|
|
79
|
-
? `export type
|
|
80
|
-
: 'export type
|
|
78
|
+
requiredWireServiceNames.length > 0
|
|
79
|
+
? `export type RequiredWireServices = Pick<Services, ${requiredWireServiceNames.map((key) => `'${key}'`).join(' | ')}> & Partial<Omit<Services, ${requiredWireServiceNames.map((key) => `'${key}'`).join(' | ')}>>`
|
|
80
|
+
: 'export type RequiredWireServices = Partial<Services>',
|
|
81
81
|
'',
|
|
82
82
|
].join('\n');
|
|
83
83
|
return code;
|
|
@@ -87,16 +87,16 @@ export const pikkuServices = pikkuSessionlessFunc({
|
|
|
87
87
|
const visitState = await getInspectorState();
|
|
88
88
|
// Check for required types
|
|
89
89
|
checkRequiredTypes(visitState.filesAndMethodsErrors, {
|
|
90
|
-
|
|
90
|
+
wireServiceType: true,
|
|
91
91
|
singletonServicesType: true,
|
|
92
92
|
});
|
|
93
|
-
const {
|
|
94
|
-
if (!
|
|
95
|
-
throw new Error('Required types not found:
|
|
93
|
+
const { wireServicesType, singletonServicesType } = visitState.filesAndMethods;
|
|
94
|
+
if (!wireServicesType || !singletonServicesType) {
|
|
95
|
+
throw new Error('Required types not found: wireServicesType or singletonServicesType');
|
|
96
96
|
}
|
|
97
97
|
const servicesImport = `import type { ${singletonServicesType.type} } from '${getFileImportRelativePath(config.typesDeclarationFile, singletonServicesType.typePath, config.packageMappings)}'`;
|
|
98
|
-
const
|
|
99
|
-
const servicesCode = serializeServicesMap(visitState.serviceAggregation.allSingletonServices, visitState.serviceAggregation.
|
|
98
|
+
const wireServicesImport = `import type { ${wireServicesType.type} } from '${getFileImportRelativePath(config.typesDeclarationFile, wireServicesType.typePath, config.packageMappings)}'`;
|
|
99
|
+
const servicesCode = serializeServicesMap(visitState.serviceAggregation.allSingletonServices, visitState.serviceAggregation.allWireServices, visitState.serviceAggregation.requiredServices, config.forceRequiredServices, servicesImport, wireServicesImport);
|
|
100
100
|
await writeFileInDir(logger, config.servicesFile, servicesCode);
|
|
101
101
|
},
|
|
102
102
|
middleware: [
|
|
@@ -5,8 +5,8 @@ import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-
|
|
|
5
5
|
import { serializePikkuTypesHub } from './serialize-pikku-types-hub.js';
|
|
6
6
|
export const pikkuFunctionTypes = pikkuSessionlessFunc({
|
|
7
7
|
func: async ({ logger, config }) => {
|
|
8
|
-
const { typesDeclarationFile: typesFile, packageMappings, functionTypesFile, httpTypesFile, channelsTypesFile, schedulersTypesFile, queueTypesFile, mcpTypesFile, cliTypesFile, } = config;
|
|
9
|
-
const content = serializePikkuTypesHub(getFileImportRelativePath(typesFile, functionTypesFile, packageMappings), getFileImportRelativePath(typesFile, httpTypesFile, packageMappings), getFileImportRelativePath(typesFile, channelsTypesFile, packageMappings), getFileImportRelativePath(typesFile, schedulersTypesFile, packageMappings), getFileImportRelativePath(typesFile, queueTypesFile, packageMappings), getFileImportRelativePath(typesFile, mcpTypesFile, packageMappings), getFileImportRelativePath(typesFile, cliTypesFile, packageMappings));
|
|
8
|
+
const { typesDeclarationFile: typesFile, packageMappings, functionTypesFile, httpTypesFile, channelsTypesFile, schedulersTypesFile, queueTypesFile, mcpTypesFile, cliTypesFile, forgeTypesFile, } = config;
|
|
9
|
+
const content = serializePikkuTypesHub(getFileImportRelativePath(typesFile, functionTypesFile, packageMappings), getFileImportRelativePath(typesFile, httpTypesFile, packageMappings), getFileImportRelativePath(typesFile, channelsTypesFile, packageMappings), getFileImportRelativePath(typesFile, schedulersTypesFile, packageMappings), getFileImportRelativePath(typesFile, queueTypesFile, packageMappings), getFileImportRelativePath(typesFile, mcpTypesFile, packageMappings), getFileImportRelativePath(typesFile, cliTypesFile, packageMappings), getFileImportRelativePath(typesFile, forgeTypesFile, packageMappings));
|
|
10
10
|
await writeFileInDir(logger, typesFile, content);
|
|
11
11
|
},
|
|
12
12
|
middleware: [
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js';
|
|
2
|
-
import { saveSchemas, generateSchemas, } from '../../../utils/schema-generator.js';
|
|
2
|
+
import { saveSchemas, generateSchemas, generateZodSchemas, } from '../../../utils/schema-generator.js';
|
|
3
3
|
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js';
|
|
4
4
|
/**
|
|
5
|
-
* Generate JSON schemas from TypeScript types
|
|
5
|
+
* Generate JSON schemas from TypeScript types and Zod schemas
|
|
6
6
|
*/
|
|
7
7
|
export const pikkuSchemas = pikkuSessionlessFunc({
|
|
8
8
|
func: async ({ logger, config, getInspectorState }) => {
|
|
9
9
|
const visitState = await getInspectorState();
|
|
10
|
-
const schemas = await generateSchemas(logger, config.tsconfig, visitState.functions.typesMap, visitState.functions.meta, visitState.http.meta, config.schemasFromTypes, config.schema?.additionalProperties);
|
|
11
|
-
await
|
|
10
|
+
const schemas = await generateSchemas(logger, config.tsconfig, visitState.functions.typesMap, visitState.functions.meta, visitState.http.meta, config.schemasFromTypes, config.schema?.additionalProperties, visitState.zodLookup);
|
|
11
|
+
const zodSchemas = await generateZodSchemas(logger, visitState.zodLookup, visitState.functions.typesMap);
|
|
12
|
+
await saveSchemas(logger, config.schemaDirectory, { ...schemas, ...zodSchemas }, visitState.functions.typesMap, visitState.functions.meta, config.schema?.supportsImportAttributes || true, config.schemasFromTypes, visitState.zodLookup, config.externalPackageName || null);
|
|
12
13
|
return true;
|
|
13
14
|
},
|
|
14
15
|
middleware: [
|
|
@@ -2,5 +2,7 @@ import { FunctionsMeta, FunctionsRuntimeMeta } from '@pikku/core';
|
|
|
2
2
|
export declare const serializeFunctionImports: (outputPath: string, functionsMap: Map<string, {
|
|
3
3
|
path: string;
|
|
4
4
|
exportedName: string;
|
|
5
|
-
}>, functionsMeta: FunctionsMeta, packageMappings?: Record<string, string
|
|
5
|
+
}>, functionsMeta: FunctionsMeta, packageMappings?: Record<string, string>,
|
|
6
|
+
/** Package name for external packages (e.g., '@pikku/templates-function-external') */
|
|
7
|
+
externalPackageName?: string) => string;
|
|
6
8
|
export declare const generateRuntimeMeta: (functions: FunctionsMeta) => FunctionsRuntimeMeta;
|