@pikku/cli 0.11.3 → 0.12.1
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/cli.schema.json +1 -1
- package/console-app/android-chrome-192x192.png +0 -0
- package/console-app/android-chrome-512x512.png +0 -0
- package/console-app/apple-touch-icon.png +0 -0
- package/console-app/assets/index-0Ui5UudO.css +1 -0
- package/console-app/assets/index-DiYPTQU_.js +676 -0
- package/console-app/favicon-16x16.png +0 -0
- package/console-app/favicon-32x32.png +0 -0
- package/console-app/favicon.ico +0 -0
- package/console-app/index.html +34 -0
- package/console-app/pikku-console-logo.png +0 -0
- package/console-app/site.webmanifest +19 -0
- package/console-app/wiring-icons/cron.svg +6 -0
- package/console-app/wiring-icons/function.png +0 -0
- package/console-app/wiring-icons/http.svg +2 -0
- package/console-app/wiring-icons/mcp.svg +1 -0
- package/console-app/wiring-icons/queue.svg +18 -0
- package/console-app/wiring-icons/sse.svg +5 -0
- package/console-app/wiring-icons/websocket.svg +8 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +46 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.js +17 -0
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js +6 -0
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.json +3 -0
- package/dist/.pikku/agent/pikku-agent-wirings.gen.d.ts +4 -0
- package/dist/.pikku/agent/pikku-agent-wirings.gen.js +4 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +27 -14
- package/dist/.pikku/channel/pikku-channel-types.gen.js +21 -4
- package/dist/.pikku/channel/pikku-channels-meta.gen.js +2 -2
- 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 +72 -3
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +9 -1
- package/dist/.pikku/cli/pikku-cli-types.gen.js +12 -2
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +2 -2
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +261 -11
- package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -5
- package/dist/.pikku/cli/pikku-cli.gen.js +1 -5
- package/dist/.pikku/console/pikku-node-types.gen.d.ts +6 -0
- package/dist/.pikku/console/pikku-node-types.gen.js +1 -0
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +83 -29
- package/dist/.pikku/function/pikku-function-types.gen.js +51 -15
- package/dist/.pikku/function/pikku-functions-meta.gen.js +2 -2
- package/dist/.pikku/function/pikku-functions-meta.gen.json +896 -192
- package/dist/.pikku/function/pikku-functions.gen.d.ts +1 -0
- package/dist/.pikku/function/pikku-functions.gen.js +119 -0
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +55 -19
- package/dist/.pikku/http/pikku-http-types.gen.js +11 -2
- package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +2 -2
- 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 +26 -27
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +2 -12
- package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.js +2 -2
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.d.ts +1 -1
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.js +2 -2
- package/dist/.pikku/node/pikku-node-types.gen.d.ts +1 -0
- package/dist/.pikku/node/pikku-node-types.gen.js +1 -0
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +5 -4
- package/dist/.pikku/pikku-bootstrap.gen.js +13 -2
- package/dist/.pikku/pikku-services.gen.d.ts +6 -1
- package/dist/.pikku/pikku-services.gen.js +5 -0
- package/dist/.pikku/pikku-types.gen.d.ts +4 -2
- package/dist/.pikku/pikku-types.gen.js +7 -3
- 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 +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.js +2 -2
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +2 -2
- 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 +3 -3
- package/dist/.pikku/rpc/pikku-remote-rpc-workers.gen.js +3 -3
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts +1 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +6 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +70 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +2 -2
- package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.js +2 -2
- 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 +43 -19
- package/dist/.pikku/schemas/schemas/BootstrapInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/ConsoleCommandInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuAIAgentOutput.schema.json +1 -0
- 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/PikkuConsoleFunctionsOutput.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/PikkuNewAddonInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuNewFunctionInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuNewMiddlewareInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuNewPermissionInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuNewWiringInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuNodesMetaOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuPackageOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuPermissionsOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuPublicAgentOutput.schema.json +1 -0
- 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/PikkuTriggerOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuVersionsInitInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuWorkflowOutput.schema.json +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +5 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.js +4 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +11 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.js +10 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +113 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.js +33 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +5 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.js +4 -0
- package/dist/.pikku/variables/pikku-variables.gen.d.ts +11 -0
- package/dist/.pikku/variables/pikku-variables.gen.js +10 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +28 -180
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +18 -106
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +2 -2
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
- package/dist/bin/pikku.js +20 -47
- package/dist/src/cli.wiring.js +210 -2
- package/dist/src/functions/commands/all.d.ts +1 -1
- package/dist/src/functions/commands/all.js +83 -180
- package/dist/src/functions/commands/bootstrap.d.ts +1 -1
- package/dist/src/functions/commands/bootstrap.js +13 -22
- package/dist/src/functions/commands/console.d.ts +7 -0
- package/dist/src/functions/commands/console.js +106 -0
- package/dist/src/functions/commands/info.d.ts +9 -0
- package/dist/src/functions/commands/info.js +283 -0
- package/dist/src/functions/commands/new-addon.d.ts +34 -0
- package/dist/src/functions/commands/new-addon.js +636 -0
- package/dist/src/functions/commands/new-function.d.ts +10 -0
- package/dist/src/functions/commands/new-function.js +79 -0
- package/dist/src/functions/commands/new-middleware.d.ts +10 -0
- package/dist/src/functions/commands/new-middleware.js +48 -0
- package/dist/src/functions/commands/new-permission.d.ts +10 -0
- package/dist/src/functions/commands/new-permission.js +45 -0
- package/dist/src/functions/commands/new-wiring.d.ts +10 -0
- package/dist/src/functions/commands/new-wiring.js +102 -0
- package/dist/src/functions/commands/pikku-command-bootstrap.d.ts +4 -0
- package/dist/src/functions/commands/pikku-command-bootstrap.js +38 -0
- package/dist/src/functions/commands/pikku-command-summary.d.ts +1 -0
- package/dist/src/functions/commands/pikku-command-summary.js +55 -0
- package/dist/src/functions/commands/versions-check.d.ts +1 -0
- package/dist/src/functions/commands/versions-check.js +99 -0
- package/dist/src/functions/commands/versions-init.d.ts +7 -0
- package/dist/src/functions/commands/versions-init.js +15 -0
- package/dist/src/functions/commands/versions-update.d.ts +1 -0
- package/dist/src/functions/commands/versions-update.js +20 -0
- package/dist/src/functions/commands/watch.d.ts +1 -1
- package/dist/src/functions/commands/watch.js +4 -5
- package/dist/src/functions/runtimes/fetch/index.d.ts +1 -0
- package/dist/src/functions/{wirings → runtimes}/fetch/index.js +3 -3
- package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.d.ts +1 -1
- package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.js +6 -7
- 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 +4 -16
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.js +4 -8
- package/dist/src/functions/runtimes/websocket/pikku-command-websocket-typed.d.ts +1 -0
- package/dist/src/functions/{wirings/channels → runtimes/websocket}/pikku-command-websocket-typed.js +2 -2
- package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent-types.d.ts +1 -0
- package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent-types.js +20 -0
- package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent.d.ts +1 -0
- package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent.js +68 -0
- package/dist/src/functions/wirings/ai-agent/pikku-command-public-agent.d.ts +1 -0
- package/dist/src/functions/wirings/ai-agent/pikku-command-public-agent.js +23 -0
- package/dist/src/functions/wirings/ai-agent/serialize-agent-map.d.ts +4 -0
- package/dist/src/functions/wirings/ai-agent/serialize-agent-map.js +48 -0
- package/dist/src/functions/wirings/ai-agent/serialize-ai-agent-types.d.ts +1 -0
- package/dist/src/functions/wirings/ai-agent/serialize-ai-agent-types.js +76 -0
- package/dist/src/functions/wirings/ai-agent/serialize-public-agent.d.ts +1 -0
- package/dist/src/functions/wirings/ai-agent/serialize-public-agent.js +68 -0
- package/dist/src/functions/wirings/channels/pikku-channels.d.ts +1 -1
- package/dist/src/functions/wirings/channels/pikku-channels.js +2 -2
- package/dist/src/functions/wirings/channels/pikku-command-channel-types.d.ts +1 -1
- package/dist/src/functions/wirings/channels/pikku-command-channel-types.js +3 -3
- package/dist/src/functions/wirings/channels/pikku-command-channels-map.d.ts +1 -1
- package/dist/src/functions/wirings/channels/pikku-command-channels-map.js +2 -2
- package/dist/src/functions/wirings/channels/pikku-command-channels.d.ts +1 -1
- package/dist/src/functions/wirings/channels/pikku-command-channels.js +2 -2
- package/dist/src/functions/wirings/channels/serialize-channel-types.d.ts +1 -1
- package/dist/src/functions/wirings/channels/serialize-channel-types.js +47 -17
- package/dist/src/functions/wirings/channels/serialize-typed-channel-map.d.ts +5 -4
- package/dist/src/functions/wirings/channels/serialize-typed-channel-map.js +8 -8
- package/dist/src/functions/wirings/cli/pikku-command-cli-entry.d.ts +1 -1
- package/dist/src/functions/wirings/cli/pikku-command-cli-entry.js +3 -7
- package/dist/src/functions/wirings/cli/pikku-command-cli-types.d.ts +1 -1
- package/dist/src/functions/wirings/cli/pikku-command-cli-types.js +1 -1
- package/dist/src/functions/wirings/cli/pikku-command-cli.d.ts +1 -1
- package/dist/src/functions/wirings/cli/pikku-command-cli.js +2 -2
- package/dist/src/functions/wirings/cli/serialize-channel-cli-client.d.ts +2 -2
- package/dist/src/functions/wirings/cli/serialize-channel-cli.d.ts +1 -1
- package/dist/src/functions/wirings/cli/serialize-channel-cli.js +8 -8
- package/dist/src/functions/wirings/cli/serialize-cli-types.js +14 -1
- package/dist/src/functions/wirings/cli/serialize-local-cli-bootstrap.d.ts +3 -3
- package/dist/src/functions/wirings/cli/serialize-local-cli-bootstrap.js +10 -11
- package/dist/src/functions/wirings/console/pikku-command-console-functions.d.ts +1 -0
- package/dist/src/functions/wirings/console/pikku-command-console-functions.js +24 -0
- package/dist/src/functions/wirings/console/pikku-command-node-types.d.ts +1 -0
- package/dist/src/functions/wirings/console/pikku-command-node-types.js +21 -0
- package/dist/src/functions/wirings/console/pikku-command-nodes-meta.d.ts +1 -0
- package/dist/src/functions/wirings/console/pikku-command-nodes-meta.js +79 -0
- package/dist/src/functions/wirings/console/serialize-console-functions.d.ts +1 -0
- package/dist/src/functions/wirings/console/serialize-console-functions.js +90 -0
- package/dist/src/functions/wirings/console/serialize-node-types.d.ts +1 -0
- package/dist/src/functions/wirings/console/serialize-node-types.js +11 -0
- package/dist/src/functions/wirings/functions/pikku-command-addon-types.d.ts +1 -0
- package/dist/src/functions/wirings/functions/pikku-command-addon-types.js +33 -0
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +2 -2
- package/dist/src/functions/wirings/functions/pikku-command-function-types.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-function-types.js +6 -6
- package/dist/src/functions/wirings/functions/pikku-command-functions.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-functions.js +9 -15
- package/dist/src/functions/wirings/functions/pikku-command-services.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-services.js +1 -1
- package/dist/src/functions/wirings/functions/schemas.d.ts +1 -4
- package/dist/src/functions/wirings/functions/schemas.js +8 -10
- package/dist/src/functions/wirings/functions/serialize-addon-types.d.ts +1 -0
- package/dist/src/functions/wirings/functions/serialize-addon-types.js +78 -0
- package/dist/src/functions/wirings/functions/serialize-function-imports.d.ts +3 -4
- package/dist/src/functions/wirings/functions/serialize-function-imports.js +13 -20
- package/dist/src/functions/wirings/functions/serialize-function-types.d.ts +1 -1
- package/dist/src/functions/wirings/functions/serialize-function-types.js +126 -45
- 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 +5 -2
- package/dist/src/functions/wirings/http/pikku-command-http-map.d.ts +1 -1
- package/dist/src/functions/wirings/http/pikku-command-http-map.js +4 -4
- package/dist/src/functions/wirings/http/pikku-command-http-routes.d.ts +1 -1
- package/dist/src/functions/wirings/http/pikku-command-http-routes.js +2 -2
- package/dist/src/functions/wirings/http/pikku-command-http-types.d.ts +1 -1
- package/dist/src/functions/wirings/http/pikku-command-http-types.js +1 -1
- package/dist/src/functions/wirings/http/pikku-command-openapi.d.ts +1 -1
- package/dist/src/functions/wirings/http/pikku-command-openapi.js +11 -9
- package/dist/src/functions/wirings/http/pikku-http-routes.d.ts +1 -1
- package/dist/src/functions/wirings/http/pikku-http-routes.js +2 -2
- package/dist/src/functions/wirings/http/serialize-http-types.js +65 -20
- package/dist/src/functions/wirings/http/serialize-typed-http-map.d.ts +7 -4
- package/dist/src/functions/wirings/http/serialize-typed-http-map.js +33 -46
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-json.d.ts +1 -1
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-json.js +5 -6
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-types.d.ts +1 -1
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-types.js +1 -1
- package/dist/src/functions/wirings/mcp/pikku-command-mcp.d.ts +1 -1
- package/dist/src/functions/wirings/mcp/pikku-command-mcp.js +14 -5
- package/dist/src/functions/wirings/mcp/serialize-mcp-types.js +27 -36
- package/dist/src/functions/wirings/middleware/pikku-command-middleware.d.ts +1 -1
- package/dist/src/functions/wirings/middleware/pikku-command-middleware.js +11 -34
- package/dist/src/functions/wirings/middleware/serialize-middleware-imports.js +19 -24
- package/dist/src/functions/wirings/package/pikku-command-package-types.d.ts +2 -0
- package/dist/src/functions/wirings/package/pikku-command-package-types.js +30 -0
- package/dist/src/functions/wirings/package/pikku-command-package.d.ts +1 -1
- package/dist/src/functions/wirings/package/pikku-command-package.js +8 -8
- package/dist/src/functions/wirings/package/serialize-package-types.d.ts +2 -0
- package/dist/src/functions/wirings/package/serialize-package-types.js +10 -0
- package/dist/src/functions/wirings/package/serialize-package.js +2 -2
- package/dist/src/functions/wirings/permissions/pikku-command-permissions.d.ts +1 -1
- package/dist/src/functions/wirings/permissions/pikku-command-permissions.js +7 -7
- package/dist/src/functions/wirings/queue/pikku-command-queue-map.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue-map.js +3 -3
- package/dist/src/functions/wirings/queue/pikku-command-queue-service.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue-service.js +2 -2
- package/dist/src/functions/wirings/queue/pikku-command-queue-types.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue-types.js +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-command-queue.js +1 -1
- package/dist/src/functions/wirings/queue/pikku-queue-map.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-queue-map.js +3 -3
- package/dist/src/functions/wirings/queue/pikku-queue.d.ts +1 -1
- package/dist/src/functions/wirings/queue/pikku-queue.js +1 -1
- package/dist/src/functions/wirings/queue/serialize-queue-map.d.ts +6 -3
- package/dist/src/functions/wirings/queue/serialize-queue-map.js +12 -40
- package/dist/src/functions/wirings/queue/serialize-queue-meta.d.ts +1 -1
- package/dist/src/functions/wirings/queue/serialize-queue-meta.js +9 -10
- package/dist/src/functions/wirings/queue/serialize-queue-types.js +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-public-rpc.js +2 -2
- package/dist/src/functions/wirings/rpc/pikku-command-remote-rpc.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-remote-rpc.js +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.js +2 -2
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.d.ts +2 -2
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.js +14 -9
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +3 -2
- package/dist/src/functions/wirings/rpc/serialize-public-rpc.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/serialize-public-rpc.js +34 -20
- package/dist/src/functions/wirings/rpc/serialize-remote-rpc.js +2 -2
- package/dist/src/functions/wirings/rpc/serialize-rpc-wrapper.js +55 -8
- package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.d.ts +11 -3
- package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.js +106 -71
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler-types.d.ts +1 -1
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler-types.js +1 -1
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.d.ts +1 -1
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.js +1 -1
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-meta.d.ts +2 -2
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-meta.js +13 -12
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-types.js +1 -1
- package/dist/src/functions/wirings/secrets/pikku-command-secrets.d.ts +1 -0
- package/dist/src/functions/wirings/secrets/pikku-command-secrets.js +31 -0
- package/dist/src/functions/wirings/secrets/serialize-secrets-types.d.ts +9 -0
- package/dist/src/functions/wirings/secrets/serialize-secrets-types.js +64 -0
- package/dist/src/functions/wirings/triggers/pikku-command-trigger-types.d.ts +1 -0
- package/dist/src/functions/wirings/triggers/pikku-command-trigger-types.js +24 -0
- package/dist/src/functions/wirings/triggers/pikku-command-trigger.d.ts +1 -0
- package/dist/src/functions/wirings/triggers/pikku-command-trigger.js +40 -0
- package/dist/src/functions/wirings/triggers/serialize-trigger-meta.d.ts +5 -0
- package/dist/src/functions/wirings/triggers/serialize-trigger-meta.js +35 -0
- package/dist/src/functions/wirings/triggers/serialize-trigger-types.d.ts +4 -0
- package/dist/src/functions/wirings/triggers/serialize-trigger-types.js +163 -0
- package/dist/src/functions/wirings/variables/pikku-command-variables.d.ts +1 -0
- package/dist/src/functions/wirings/variables/pikku-command-variables.js +31 -0
- package/dist/src/functions/wirings/variables/serialize-variables-types.d.ts +9 -0
- package/dist/src/functions/wirings/variables/serialize-variables-types.js +53 -0
- package/dist/src/functions/wirings/workflow/pikku-command-workflow.d.ts +1 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +8 -37
- package/dist/src/functions/wirings/workflow/serialize-workflow-map.d.ts +5 -3
- package/dist/src/functions/wirings/workflow/serialize-workflow-map.js +63 -12
- package/dist/src/functions/wirings/workflow/serialize-workflow-meta.js +32 -33
- package/dist/src/functions/wirings/workflow/serialize-workflow-registration.d.ts +1 -1
- package/dist/src/functions/wirings/workflow/serialize-workflow-registration.js +4 -31
- package/dist/src/functions/wirings/workflow/serialize-workflow-types.d.ts +1 -6
- package/dist/src/functions/wirings/workflow/serialize-workflow-types.js +60 -256
- package/dist/src/functions/wirings/workflow/serialize-workflow-workers.js +5 -5
- package/dist/src/services/cli-logger-forwarder.service.d.ts +4 -3
- package/dist/src/services/cli-logger-forwarder.service.js +1 -1
- package/dist/src/services/cli-logger.service.d.ts +3 -2
- package/dist/src/services/cli-logger.service.js +1 -1
- package/dist/src/services.d.ts +5 -4
- package/dist/src/services.js +53 -7
- package/dist/src/utils/check-required-types.d.ts +1 -1
- package/dist/src/utils/command-summary.d.ts +2 -1
- package/dist/src/utils/command-summary.js +2 -1
- package/dist/src/utils/contract-versions.d.ts +6 -0
- package/dist/src/utils/contract-versions.js +25 -0
- package/dist/src/utils/file-import-path.js +20 -6
- package/dist/src/utils/file-writer.d.ts +6 -1
- package/dist/src/utils/file-writer.js +14 -1
- package/dist/src/utils/generate-bootstrap-file.d.ts +2 -2
- package/dist/src/utils/openapi/codegen.d.ts +19 -0
- package/dist/src/utils/openapi/codegen.js +288 -0
- package/dist/src/utils/openapi/naming.d.ts +30 -0
- package/dist/src/utils/openapi/naming.js +167 -0
- package/dist/src/utils/openapi/parse-openapi.d.ts +36 -0
- package/dist/src/utils/openapi/parse-openapi.js +196 -0
- package/dist/src/utils/openapi/zod-codegen.d.ts +53 -0
- package/dist/src/utils/openapi/zod-codegen.js +251 -0
- package/dist/src/utils/pikku-cli-config.d.ts +2 -2
- package/dist/src/utils/pikku-cli-config.js +80 -23
- package/dist/src/utils/pikku-files-and-methods.d.ts +1 -2
- package/dist/src/utils/pikku-files-and-methods.js +15 -60
- package/dist/src/utils/serialize-import-map.d.ts +3 -2
- package/dist/src/utils/serialize-import-map.js +4 -55
- package/dist/src/utils/serialize-meta-ts.d.ts +8 -0
- package/dist/src/utils/serialize-meta-ts.js +12 -0
- package/dist/src/utils/serialize-schemas.d.ts +3 -0
- package/dist/src/utils/serialize-schemas.js +38 -0
- package/dist/src/utils/strip-verbose-meta.d.ts +5 -5
- package/dist/src/utils/strip-verbose-meta.js +15 -15
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -10
- package/.pikku/channel/pikku-channel-types.gen.ts +0 -148
- package/.pikku/channel/pikku-channels-map.gen.d.ts +0 -47
- package/.pikku/channel/pikku-channels-meta.gen.json +0 -1
- package/.pikku/channel/pikku-channels-meta.gen.ts +0 -7
- package/.pikku/channel/pikku-channels.gen.ts +0 -4
- package/.pikku/cli/pikku-cli-channel.ts +0 -92
- package/.pikku/cli/pikku-cli-client.gen.ts +0 -54
- package/.pikku/cli/pikku-cli-types.gen.ts +0 -92
- package/.pikku/cli/pikku-cli-wirings-meta.gen.json +0 -147
- package/.pikku/cli/pikku-cli-wirings-meta.gen.ts +0 -7
- package/.pikku/cli/pikku-cli-wirings.gen.ts +0 -6
- package/.pikku/cli/pikku-cli.gen.ts +0 -41
- package/.pikku/forge/pikku-forge-types.gen.ts +0 -83
- package/.pikku/function/pikku-function-types.gen.ts +0 -572
- package/.pikku/function/pikku-functions-meta-verbose.gen.json +0 -1030
- package/.pikku/function/pikku-functions-meta.gen.json +0 -656
- package/.pikku/function/pikku-functions-meta.gen.ts +0 -6
- package/.pikku/http/pikku-http-types.gen.ts +0 -102
- package/.pikku/http/pikku-http-wirings-map.gen.d.ts +0 -46
- package/.pikku/http/pikku-http-wirings-meta.gen.json +0 -9
- package/.pikku/http/pikku-http-wirings-meta.gen.ts +0 -7
- package/.pikku/http/pikku-http-wirings.gen.ts +0 -4
- package/.pikku/mcp/pikku-mcp-types.gen.ts +0 -192
- package/.pikku/mcp/pikku-mcp-wirings-meta.gen.json +0 -5
- package/.pikku/mcp/pikku-mcp-wirings-meta.gen.ts +0 -9
- package/.pikku/mcp/pikku-mcp-wirings.gen.ts +0 -4
- package/.pikku/mcp/pikku-mcp.gen.json +0 -5
- package/.pikku/pikku-bootstrap.gen.ts +0 -17
- package/.pikku/pikku-services.gen.ts +0 -28
- package/.pikku/pikku-types.gen.ts +0 -30
- package/.pikku/pikku-websocket.gen.ts +0 -90
- package/.pikku/queue/pikku-queue-types.gen.ts +0 -27
- package/.pikku/queue/pikku-queue-workers-wirings-map.gen.d.ts +0 -60
- package/.pikku/queue/pikku-queue-workers-wirings-meta.gen.json +0 -1
- package/.pikku/queue/pikku-queue-workers-wirings-meta.gen.ts +0 -8
- package/.pikku/queue/pikku-queue-workers-wirings.gen.ts +0 -4
- package/.pikku/rpc/pikku-remote-rpc-workers.gen.ts +0 -30
- package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +0 -62
- package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +0 -105
- package/.pikku/scheduler/pikku-scheduler-types.gen.ts +0 -25
- package/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.json +0 -1
- package/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.ts +0 -8
- package/.pikku/scheduler/pikku-schedulers-wirings.gen.ts +0 -4
- package/.pikku/schemas/register.gen.ts +0 -71
- package/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuCLIOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuForgeNodesOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuFunctionsOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuHTTPOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuMCPOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuMiddlewareOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuPackageOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuPermissionsOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuPublicRPCOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuQueueOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuRPCOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuRemoteRPCOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuSchedulerOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/PikkuWorkflowOutput.schema.json +0 -1
- package/.pikku/services/config.gen.json +0 -104
- package/.pikku/services/getInspectorState.gen.json +0 -10
- package/.pikku/services/jwt.gen.json +0 -13
- package/.pikku/services/logger.gen.json +0 -25
- package/.pikku/services/queueService.gen.json +0 -14
- package/.pikku/services/schedulerService.gen.json +0 -17
- package/.pikku/services/schema.gen.json +0 -14
- package/.pikku/services/secrets.gen.json +0 -13
- package/.pikku/services/variables.gen.json +0 -13
- package/.pikku/services/workflowService.gen.json +0 -31
- package/.pikku/workflow/pikku-workflow-map.gen.d.ts +0 -28
- package/.pikku/workflow/pikku-workflow-types.gen.ts +0 -349
- package/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +0 -9
- package/.pikku/workflow/pikku-workflow-wirings.gen.ts +0 -3
- package/CHANGELOG.md +0 -957
- package/bin/pikku.ts +0 -88
- package/build.sh +0 -75
- package/dist/.pikku/forge/pikku-forge-types.gen.d.ts +0 -72
- package/dist/.pikku/forge/pikku-forge-types.gen.js +0 -55
- package/dist/.pikku/schemas/schemas/PikkuForgeNodesOutput.schema.json +0 -1
- package/dist/src/functions/wirings/channels/pikku-command-websocket-typed.d.ts +0 -1
- package/dist/src/functions/wirings/fetch/index.d.ts +0 -1
- package/dist/src/functions/wirings/forge/pikku-command-forge-nodes.d.ts +0 -1
- package/dist/src/functions/wirings/forge/pikku-command-forge-nodes.js +0 -90
- package/dist/src/functions/wirings/forge/pikku-command-forge-types.d.ts +0 -1
- package/dist/src/functions/wirings/forge/pikku-command-forge-types.js +0 -26
- package/dist/src/functions/wirings/forge/serialize-forge-types.d.ts +0 -4
- package/dist/src/functions/wirings/forge/serialize-forge-types.js +0 -90
- package/dist/src/functions/wirings/functions/pikku-function-types.d.ts +0 -1
- package/dist/src/functions/wirings/functions/pikku-function-types.js +0 -18
- package/dist/src/functions/wirings/http/openapi-spec-generator.d.ts +0 -81
- package/dist/src/functions/wirings/http/openapi-spec-generator.js +0 -152
- package/dist/src/functions/wirings/mcp/serialize-mcp-json.d.ts +0 -5
- package/dist/src/functions/wirings/mcp/serialize-mcp-json.js +0 -102
- package/dist/src/functions/wirings/middleware/serialize-middleware-groups-meta.d.ts +0 -11
- package/dist/src/functions/wirings/middleware/serialize-middleware-groups-meta.js +0 -36
- package/dist/src/functions/wirings/services/pikku-command-service-metadata.d.ts +0 -1
- package/dist/src/functions/wirings/services/pikku-command-service-metadata.js +0 -22
- package/dist/src/utils/custom-types-generator.d.ts +0 -2
- package/dist/src/utils/custom-types-generator.js +0 -41
- package/dist/src/utils/schema-generator.d.ts +0 -7
- package/dist/src/utils/schema-generator.js +0 -238
- package/pikku.config.json +0 -29
- package/run-tests.sh +0 -53
- package/src/cli.wiring.ts +0 -112
- package/src/functions/commands/all.ts +0 -313
- package/src/functions/commands/bootstrap.ts +0 -35
- package/src/functions/commands/watch.ts +0 -61
- package/src/functions/runtimes/nextjs/pikku-command-nextjs.ts +0 -131
- package/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.ts +0 -282
- package/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.ts +0 -215
- package/src/functions/wirings/channels/pikku-channels.ts +0 -59
- package/src/functions/wirings/channels/pikku-command-channel-types.ts +0 -25
- package/src/functions/wirings/channels/pikku-command-channels-map.ts +0 -26
- package/src/functions/wirings/channels/pikku-command-channels.ts +0 -83
- package/src/functions/wirings/channels/pikku-command-websocket-typed.ts +0 -37
- package/src/functions/wirings/channels/serialize-channel-types.ts +0 -151
- package/src/functions/wirings/channels/serialize-typed-channel-map.ts +0 -173
- package/src/functions/wirings/channels/serialize-websocket-wrapper.ts +0 -89
- package/src/functions/wirings/cli/pikku-command-cli-entry.ts +0 -216
- package/src/functions/wirings/cli/pikku-command-cli-types.ts +0 -48
- package/src/functions/wirings/cli/pikku-command-cli.ts +0 -81
- package/src/functions/wirings/cli/serialize-channel-cli-client.ts +0 -184
- package/src/functions/wirings/cli/serialize-channel-cli.ts +0 -134
- package/src/functions/wirings/cli/serialize-cli-types.ts +0 -101
- package/src/functions/wirings/cli/serialize-local-cli-bootstrap.ts +0 -80
- package/src/functions/wirings/fetch/index.ts +0 -36
- package/src/functions/wirings/forge/pikku-command-forge-nodes.ts +0 -135
- package/src/functions/wirings/forge/pikku-command-forge-types.ts +0 -38
- package/src/functions/wirings/forge/serialize-forge-types.ts +0 -94
- package/src/functions/wirings/functions/pikku-command-function-types-split.ts +0 -61
- package/src/functions/wirings/functions/pikku-command-function-types.ts +0 -50
- package/src/functions/wirings/functions/pikku-command-functions.ts +0 -104
- package/src/functions/wirings/functions/pikku-command-services.ts +0 -140
- package/src/functions/wirings/functions/pikku-function-types.ts +0 -45
- package/src/functions/wirings/functions/schemas.ts +0 -56
- package/src/functions/wirings/functions/serialize-function-imports.ts +0 -80
- package/src/functions/wirings/functions/serialize-function-types.ts +0 -587
- package/src/functions/wirings/functions/serialize-pikku-types-hub.ts +0 -39
- package/src/functions/wirings/http/openapi-spec-generator.ts +0 -265
- package/src/functions/wirings/http/pikku-command-http-map.ts +0 -27
- package/src/functions/wirings/http/pikku-command-http-routes.ts +0 -80
- package/src/functions/wirings/http/pikku-command-http-types.ts +0 -25
- package/src/functions/wirings/http/pikku-command-openapi.ts +0 -64
- package/src/functions/wirings/http/pikku-http-routes.ts +0 -61
- package/src/functions/wirings/http/serialize-fetch-wrapper.ts +0 -67
- package/src/functions/wirings/http/serialize-http-types.ts +0 -105
- package/src/functions/wirings/http/serialize-typed-http-map.ts +0 -178
- package/src/functions/wirings/mcp/pikku-command-mcp-json.ts +0 -33
- package/src/functions/wirings/mcp/pikku-command-mcp-types.ts +0 -25
- package/src/functions/wirings/mcp/pikku-command-mcp.ts +0 -162
- package/src/functions/wirings/mcp/serialize-mcp-json.ts +0 -161
- package/src/functions/wirings/mcp/serialize-mcp-types.ts +0 -195
- package/src/functions/wirings/middleware/pikku-command-middleware.ts +0 -89
- package/src/functions/wirings/middleware/serialize-middleware-groups-meta.ts +0 -40
- package/src/functions/wirings/middleware/serialize-middleware-imports.ts +0 -78
- package/src/functions/wirings/package/pikku-command-package.ts +0 -81
- package/src/functions/wirings/package/serialize-package.ts +0 -69
- package/src/functions/wirings/permissions/pikku-command-permissions.ts +0 -49
- package/src/functions/wirings/permissions/serialize-permissions-imports.test.ts +0 -274
- package/src/functions/wirings/permissions/serialize-permissions-imports.ts +0 -78
- package/src/functions/wirings/queue/pikku-command-queue-map.ts +0 -26
- package/src/functions/wirings/queue/pikku-command-queue-service.ts +0 -37
- package/src/functions/wirings/queue/pikku-command-queue-types.ts +0 -25
- package/src/functions/wirings/queue/pikku-command-queue.ts +0 -86
- package/src/functions/wirings/queue/pikku-queue-map.ts +0 -26
- package/src/functions/wirings/queue/pikku-queue.ts +0 -66
- package/src/functions/wirings/queue/serialize-queue-map.ts +0 -134
- package/src/functions/wirings/queue/serialize-queue-meta.ts +0 -24
- package/src/functions/wirings/queue/serialize-queue-types.ts +0 -30
- package/src/functions/wirings/queue/serialize-queue-wrapper.ts +0 -35
- package/src/functions/wirings/rpc/pikku-command-public-rpc.ts +0 -32
- package/src/functions/wirings/rpc/pikku-command-remote-rpc.ts +0 -35
- package/src/functions/wirings/rpc/pikku-command-rpc-client.ts +0 -35
- package/src/functions/wirings/rpc/pikku-command-rpc-map.ts +0 -51
- package/src/functions/wirings/rpc/pikku-command-rpc.ts +0 -49
- package/src/functions/wirings/rpc/serialize-public-rpc.ts +0 -37
- package/src/functions/wirings/rpc/serialize-remote-rpc.ts +0 -33
- package/src/functions/wirings/rpc/serialize-rpc-wrapper.ts +0 -68
- package/src/functions/wirings/rpc/serialize-typed-rpc-map.ts +0 -194
- package/src/functions/wirings/scheduler/pikku-command-scheduler-types.ts +0 -25
- package/src/functions/wirings/scheduler/pikku-command-scheduler.ts +0 -88
- package/src/functions/wirings/scheduler/serialize-scheduler-meta.ts +0 -37
- package/src/functions/wirings/scheduler/serialize-scheduler-types.ts +0 -28
- package/src/functions/wirings/services/pikku-command-service-metadata.ts +0 -25
- package/src/functions/wirings/workflow/pikku-command-workflow.ts +0 -218
- package/src/functions/wirings/workflow/serialize-workflow-map.ts +0 -121
- package/src/functions/wirings/workflow/serialize-workflow-meta.ts +0 -73
- package/src/functions/wirings/workflow/serialize-workflow-registration.ts +0 -83
- package/src/functions/wirings/workflow/serialize-workflow-types.ts +0 -357
- package/src/functions/wirings/workflow/serialize-workflow-workers.ts +0 -47
- package/src/middleware/log-command-info-and-time.ts +0 -35
- package/src/services/cli-logger-forwarder.service.ts +0 -99
- package/src/services/cli-logger.service.ts +0 -108
- package/src/services.ts +0 -322
- package/src/utils/check-required-types.ts +0 -65
- package/src/utils/command-summary.ts +0 -107
- package/src/utils/custom-types-generator.ts +0 -55
- package/src/utils/file-import-path.test.ts +0 -175
- package/src/utils/file-import-path.ts +0 -53
- package/src/utils/file-imports-serializer.ts +0 -25
- package/src/utils/file-writer.ts +0 -72
- package/src/utils/generate-bootstrap-file.ts +0 -43
- package/src/utils/get-cli-version.ts +0 -28
- package/src/utils/pikku-cli-config.ts +0 -495
- package/src/utils/pikku-files-and-methods.ts +0 -145
- package/src/utils/schema-generator.ts +0 -335
- package/src/utils/serialize-import-map.ts +0 -102
- package/src/utils/strip-verbose-meta.ts +0 -254
- package/tsconfig.json +0 -21
- package/types/application-types.d.ts +0 -27
- package/types/config.d.ts +0 -304
- /package/dist/src/functions/{wirings/channels → runtimes/websocket}/serialize-websocket-wrapper.d.ts +0 -0
- /package/dist/src/functions/{wirings/channels → runtimes/websocket}/serialize-websocket-wrapper.js +0 -0
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generates type definitions for WebSocket channel wirings
|
|
3
3
|
*/
|
|
4
|
-
export const serializeChannelTypes = (functionTypesImportPath) => {
|
|
4
|
+
export const serializeChannelTypes = (functionTypesImportPath, packageName) => {
|
|
5
|
+
const packageNameValue = packageName ? `'${packageName}'` : 'null';
|
|
5
6
|
return `/**
|
|
6
|
-
|
|
7
7
|
* Channel-specific type definitions for tree-shaking optimization
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { CoreChannel, wireChannel as wireChannelCore } from '@pikku/core/channel'
|
|
10
|
+
import { CoreChannel, CorePikkuChannelMiddleware, CorePikkuChannelMiddlewareFactory, wireChannel as wireChannelCore, defineChannelRoutes as defineChannelRoutesCore, addChannelMiddleware as addChannelMiddlewareCore } from '@pikku/core/channel'
|
|
11
11
|
import { AssertHTTPWiringParams } from '@pikku/core/http'
|
|
12
|
-
import type { PikkuFunctionConfig, PikkuFunctionSessionless, PikkuPermission, PikkuMiddleware } from '${functionTypesImportPath}'
|
|
13
|
-
import type {
|
|
12
|
+
import type { PikkuFunctionConfig, PikkuFunctionSessionless, PikkuPermission, PikkuMiddleware, Services } from '${functionTypesImportPath}'
|
|
13
|
+
import type { CorePermissionGroup } from '@pikku/core'
|
|
14
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec'
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
|
-
* Helper type to infer the output type from a
|
|
17
|
+
* Helper type to infer the output type from a Standard Schema
|
|
17
18
|
*/
|
|
18
|
-
type
|
|
19
|
+
type InferSchemaOutput<T> = T extends StandardSchemaV1<any, infer Output> ? Output : never
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Type definition for WebSocket channels with typed data exchange.
|
|
@@ -70,20 +71,20 @@ export const pikkuChannelDisconnectionFunc = (
|
|
|
70
71
|
* Configuration object for channel functions with Zod schema validation.
|
|
71
72
|
*/
|
|
72
73
|
type PikkuChannelFuncConfigWithSchema<
|
|
73
|
-
InputSchema extends
|
|
74
|
-
OutputSchema extends
|
|
74
|
+
InputSchema extends StandardSchemaV1,
|
|
75
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
75
76
|
> = {
|
|
76
77
|
name?: string
|
|
77
78
|
tags?: string[]
|
|
78
79
|
expose?: boolean
|
|
79
|
-
|
|
80
|
+
remote?: boolean
|
|
80
81
|
func: PikkuFunctionSessionless<
|
|
81
|
-
|
|
82
|
-
OutputSchema extends
|
|
82
|
+
InferSchemaOutput<InputSchema>,
|
|
83
|
+
OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown,
|
|
83
84
|
'channel' | 'session' | 'rpc'
|
|
84
85
|
>
|
|
85
86
|
auth?: boolean
|
|
86
|
-
permissions?: CorePermissionGroup<PikkuPermission<
|
|
87
|
+
permissions?: CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>>
|
|
87
88
|
middleware?: PikkuMiddleware[]
|
|
88
89
|
input: InputSchema
|
|
89
90
|
output?: OutputSchema
|
|
@@ -121,11 +122,11 @@ type PikkuChannelFuncConfigWithSchema<
|
|
|
121
122
|
* \`\`\`
|
|
122
123
|
*/
|
|
123
124
|
export function pikkuChannelFunc<
|
|
124
|
-
InputSchema extends
|
|
125
|
-
OutputSchema extends
|
|
125
|
+
InputSchema extends StandardSchemaV1,
|
|
126
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
126
127
|
>(
|
|
127
128
|
config: PikkuChannelFuncConfigWithSchema<InputSchema, OutputSchema>
|
|
128
|
-
): PikkuFunctionConfig<
|
|
129
|
+
): PikkuFunctionConfig<InferSchemaOutput<InputSchema>, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'channel' | 'session' | 'rpc'>
|
|
129
130
|
export function pikkuChannelFunc<In, Out = unknown>(
|
|
130
131
|
func:
|
|
131
132
|
| PikkuFunctionSessionless<In, Out, 'channel' | 'session' | 'rpc'>
|
|
@@ -145,7 +146,36 @@ export function pikkuChannelFunc(func: any) {
|
|
|
145
146
|
export const wireChannel = <ChannelData, Channel extends string>(
|
|
146
147
|
channel: ChannelWiring<ChannelData, Channel> & AssertHTTPWiringParams<ChannelData, Channel>
|
|
147
148
|
) => {
|
|
148
|
-
wireChannelCore(channel as any)
|
|
149
|
+
wireChannelCore(channel as any)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Type-safe helper for defining channel message routes that can be composed.
|
|
154
|
+
* Returns the routes record as-is for use with wireChannel's onMessageWiring.
|
|
155
|
+
*
|
|
156
|
+
* @template T - Record of channel route handlers
|
|
157
|
+
* @param routes - The channel routes record
|
|
158
|
+
* @returns The same routes record (identity function for type safety)
|
|
159
|
+
*/
|
|
160
|
+
export function defineChannelRoutes<T extends Record<string, any>>(routes: T): T {
|
|
161
|
+
return defineChannelRoutesCore(routes)
|
|
149
162
|
}
|
|
163
|
+
|
|
164
|
+
export type PikkuChannelMiddleware<RequiredServices extends Services = Services, Event = unknown> = CorePikkuChannelMiddleware<RequiredServices, Event>
|
|
165
|
+
|
|
166
|
+
export const pikkuChannelMiddleware = <RequiredServices extends Services = Services, Event = unknown>(
|
|
167
|
+
middleware: PikkuChannelMiddleware<RequiredServices, Event>
|
|
168
|
+
): PikkuChannelMiddleware<RequiredServices, Event> => {
|
|
169
|
+
return middleware
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export const pikkuChannelMiddlewareFactory = <In = any>(
|
|
173
|
+
factory: CorePikkuChannelMiddlewareFactory<In>
|
|
174
|
+
): CorePikkuChannelMiddlewareFactory<In> => {
|
|
175
|
+
return factory
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export const addChannelMiddleware = (tag: string, middleware: PikkuChannelMiddleware[]) =>
|
|
179
|
+
addChannelMiddlewareCore(tag, middleware, ${packageNameValue})
|
|
150
180
|
`;
|
|
151
181
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ChannelsMeta } from '@pikku/core/channel';
|
|
2
|
-
import { TypesMap } from '@pikku/inspector';
|
|
3
|
-
import { FunctionsMeta } from '@pikku/core';
|
|
4
|
-
|
|
1
|
+
import type { ChannelsMeta } from '@pikku/core/channel';
|
|
2
|
+
import type { TypesMap } from '@pikku/inspector';
|
|
3
|
+
import type { FunctionsMeta } from '@pikku/core';
|
|
4
|
+
import type { Logger } from '@pikku/core/services';
|
|
5
|
+
export declare const serializeTypedChannelsMap: (logger: Logger, relativeToPath: string, packageMappings: Record<string, string>, typesMap: TypesMap, functionsMeta: FunctionsMeta, channelsMeta: ChannelsMeta) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { serializeImportMap } from '../../../utils/serialize-import-map.js';
|
|
2
|
-
import { generateCustomTypes } from '
|
|
3
|
-
export const serializeTypedChannelsMap = (relativeToPath, packageMappings, typesMap, functionsMeta, channelsMeta) => {
|
|
2
|
+
import { generateCustomTypes } from '@pikku/inspector';
|
|
3
|
+
export const serializeTypedChannelsMap = (logger, relativeToPath, packageMappings, typesMap, functionsMeta, channelsMeta) => {
|
|
4
4
|
const { channels, requiredTypes } = generateChannels(functionsMeta, channelsMeta);
|
|
5
5
|
typesMap.customTypes.forEach(({ references }) => {
|
|
6
6
|
for (const reference of references) {
|
|
@@ -9,7 +9,7 @@ export const serializeTypedChannelsMap = (relativeToPath, packageMappings, types
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
const imports = serializeImportMap(relativeToPath, packageMappings, typesMap, requiredTypes);
|
|
12
|
+
const imports = serializeImportMap(logger, relativeToPath, packageMappings, typesMap, requiredTypes);
|
|
13
13
|
const serializedCustomTypes = generateCustomTypes(typesMap, requiredTypes);
|
|
14
14
|
return `/**
|
|
15
15
|
* This provides the structure needed for TypeScript to be aware of channels
|
|
@@ -49,9 +49,9 @@ function generateChannels(functionsMeta, channelsMeta) {
|
|
|
49
49
|
channelsObject[name] = { message: null, routes: {} };
|
|
50
50
|
}
|
|
51
51
|
if (message) {
|
|
52
|
-
const func = functionsMeta[message.
|
|
52
|
+
const func = functionsMeta[message.pikkuFuncId];
|
|
53
53
|
if (!func) {
|
|
54
|
-
throw new Error(`Function ${message.
|
|
54
|
+
throw new Error(`Function ${message.pikkuFuncId} not found in functionsMeta for channel ${name}`);
|
|
55
55
|
}
|
|
56
56
|
const inputTypes = func.inputs || null;
|
|
57
57
|
const outputTypes = func.outputs || null;
|
|
@@ -66,10 +66,10 @@ function generateChannels(functionsMeta, channelsMeta) {
|
|
|
66
66
|
if (!channelsObject[name].routes[key]) {
|
|
67
67
|
channelsObject[name].routes[key] = {};
|
|
68
68
|
}
|
|
69
|
-
for (const [method, {
|
|
70
|
-
const func = functionsMeta[
|
|
69
|
+
for (const [method, { pikkuFuncId }] of Object.entries(route)) {
|
|
70
|
+
const func = functionsMeta[pikkuFuncId];
|
|
71
71
|
if (!func) {
|
|
72
|
-
throw new Error(`Function ${
|
|
72
|
+
throw new Error(`Function ${pikkuFuncId} not found in functionsMeta for channel ${name}, route ${key}, method ${method}`);
|
|
73
73
|
}
|
|
74
74
|
const inputTypes = func.inputs || null;
|
|
75
75
|
const outputTypes = func.outputs || null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const pikkuCLIEntry:
|
|
1
|
+
export declare const pikkuCLIEntry: import("#pikku").PikkuFunctionConfig<void, void, "session" | "rpc", import("#pikku").PikkuFunctionSessionless<void, void, "session" | "rpc", import("#pikku").Services> | import("#pikku").PikkuFunction<void, void, "session" | "rpc", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pikkuSessionlessFunc } from '
|
|
1
|
+
import { pikkuSessionlessFunc } from '#pikku';
|
|
2
2
|
import { writeFileInDir } from '../../../utils/file-writer.js';
|
|
3
3
|
import { checkRequiredTypes } from '../../../utils/check-required-types.js';
|
|
4
4
|
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js';
|
|
@@ -15,7 +15,7 @@ export const pikkuCLIEntry = pikkuSessionlessFunc({
|
|
|
15
15
|
// Check if CLI entrypoints are configured
|
|
16
16
|
if (!config.cli?.entrypoints ||
|
|
17
17
|
Object.keys(config.cli.entrypoints).length === 0) {
|
|
18
|
-
logger.
|
|
18
|
+
logger.debug({
|
|
19
19
|
message: 'No CLI entrypoints configured in config.cli.entrypoints, skipping CLI bootstrap generation',
|
|
20
20
|
type: 'skip',
|
|
21
21
|
});
|
|
@@ -98,14 +98,10 @@ export const pikkuCLIEntry = pikkuSessionlessFunc({
|
|
|
98
98
|
// Get service factories for local mode
|
|
99
99
|
// Check for required types
|
|
100
100
|
checkRequiredTypes(visitState.filesAndMethodsErrors, {
|
|
101
|
-
config: true,
|
|
102
101
|
singletonServicesFactory: true,
|
|
103
|
-
wireServicesFactory: true,
|
|
104
102
|
});
|
|
105
103
|
const { pikkuConfigFactory, singletonServicesFactory, wireServicesFactory, } = visitState.filesAndMethods;
|
|
106
|
-
if (!
|
|
107
|
-
!singletonServicesFactory ||
|
|
108
|
-
!wireServicesFactory) {
|
|
104
|
+
if (!singletonServicesFactory) {
|
|
109
105
|
throw new Error('Required types not found');
|
|
110
106
|
}
|
|
111
107
|
const bootstrapCode = serializeLocalCLIBootstrap(programName, programMeta, bootstrapFile, config, pikkuConfigFactory, singletonServicesFactory, wireServicesFactory);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const pikkuCLITypes:
|
|
1
|
+
export declare const pikkuCLITypes: import("#pikku").PikkuFunctionConfig<void, void, "session" | "rpc", import("#pikku").PikkuFunctionSessionless<void, void, "session" | "rpc", import("#pikku").Services> | import("#pikku").PikkuFunction<void, void, "session" | "rpc", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pikkuSessionlessFunc } from '
|
|
1
|
+
import { pikkuSessionlessFunc } from '#pikku';
|
|
2
2
|
import { writeFileInDir } from '../../../utils/file-writer.js';
|
|
3
3
|
import { getFileImportRelativePath } from '../../../utils/file-import-path.js';
|
|
4
4
|
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const pikkuCLI:
|
|
1
|
+
export declare const pikkuCLI: import("#pikku").PikkuFunctionConfig<void, boolean | undefined, "session" | "rpc", import("#pikku").PikkuFunctionSessionless<void, boolean | undefined, "session" | "rpc", import("#pikku").Services> | import("#pikku").PikkuFunction<void, boolean | undefined, "session" | "rpc", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pikkuSessionlessFunc } from '
|
|
1
|
+
import { pikkuSessionlessFunc } from '#pikku';
|
|
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';
|
|
@@ -24,7 +24,7 @@ export const pikkuCLI = pikkuSessionlessFunc({
|
|
|
24
24
|
const importStatement = supportsImportAttributes
|
|
25
25
|
? `import metaData from '${jsonImportPath}' with { type: 'json' }`
|
|
26
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)`);
|
|
27
|
+
await writeFileInDir(logger, cliWiringMetaFile, `import { pikkuState } from '@pikku/core/internal'\nimport { CLIMeta } from '@pikku/core/cli'\n${importStatement}\npikkuState(null, 'cli', 'meta', metaData as CLIMeta)`);
|
|
28
28
|
return true;
|
|
29
29
|
},
|
|
30
30
|
middleware: [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CLIProgramMeta } from '@pikku/core/cli';
|
|
2
|
-
import { Config } from '../../../../types/application-types.js';
|
|
1
|
+
import type { CLIProgramMeta } from '@pikku/core/cli';
|
|
2
|
+
import type { Config } from '../../../../types/application-types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Collect all unique renderer names from CLI metadata (populated by inspector)
|
|
5
5
|
*/
|
|
@@ -12,9 +12,9 @@ export function serializeChannelCLI(programName, programMeta, channelFile, funct
|
|
|
12
12
|
for (const [name, cmd] of Object.entries(commands)) {
|
|
13
13
|
const fullPath = [...path, name];
|
|
14
14
|
const commandKey = fullPath.join('.');
|
|
15
|
-
if (cmd.
|
|
15
|
+
if (cmd.pikkuFuncId) {
|
|
16
16
|
commandMap[commandKey] = {
|
|
17
|
-
|
|
17
|
+
pikkuFuncId: cmd.pikkuFuncId,
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
// Recursively process subcommands
|
|
@@ -26,13 +26,13 @@ export function serializeChannelCLI(programName, programMeta, channelFile, funct
|
|
|
26
26
|
collectCommands(programMeta.commands);
|
|
27
27
|
// Generate imports from function file locations
|
|
28
28
|
const funcNames = [
|
|
29
|
-
...new Set(Object.values(commandMap).map((v) => v.
|
|
29
|
+
...new Set(Object.values(commandMap).map((v) => v.pikkuFuncId)),
|
|
30
30
|
];
|
|
31
31
|
const imports = funcNames
|
|
32
|
-
.map((
|
|
33
|
-
const fileInfo = functionFiles.get(
|
|
32
|
+
.map((pikkuFuncId) => {
|
|
33
|
+
const fileInfo = functionFiles.get(pikkuFuncId);
|
|
34
34
|
if (!fileInfo) {
|
|
35
|
-
throw new Error(`Function not found in files map: ${
|
|
35
|
+
throw new Error(`Function not found in files map: ${pikkuFuncId}`);
|
|
36
36
|
}
|
|
37
37
|
const importPath = getFileImportRelativePath(channelFile, fileInfo.path, packageMappings);
|
|
38
38
|
return `import { ${fileInfo.exportedName} } from '${importPath}'`;
|
|
@@ -79,8 +79,8 @@ wireChannel({
|
|
|
79
79
|
onMessageWiring: {
|
|
80
80
|
command: {
|
|
81
81
|
${Object.entries(commandMap)
|
|
82
|
-
.map(([commandKey, {
|
|
83
|
-
func: ${
|
|
82
|
+
.map(([commandKey, { pikkuFuncId }]) => ` '${commandKey}': {
|
|
83
|
+
func: ${pikkuFuncId},
|
|
84
84
|
middleware: [cliCloseOnComplete],
|
|
85
85
|
}`)
|
|
86
86
|
.join(',\n')}
|
|
@@ -7,7 +7,7 @@ export const serializeCLITypes = (functionTypesImportPath, userSessionTypeImport
|
|
|
7
7
|
* CLI-specific type definitions for tree-shaking optimization
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { CoreCLI, wireCLI as wireCLICore, CorePikkuCLIRender, CoreCLICommandConfig } from '@pikku/core/cli'
|
|
10
|
+
import { CoreCLI, wireCLI as wireCLICore, CorePikkuCLIRender, CoreCLICommandConfig, defineCLICommands as defineCLICommandsCore } from '@pikku/core/cli'
|
|
11
11
|
import type { PikkuFunctionConfig, PikkuMiddleware } from '${functionTypesImportPath}'
|
|
12
12
|
${userSessionTypeImport}
|
|
13
13
|
${singletonServicesTypeImport}
|
|
@@ -91,5 +91,18 @@ export const pikkuCLICommand = <
|
|
|
91
91
|
): CoreCLICommandConfig<FuncConfig, PikkuMiddleware, PikkuCLIRender<any>, string> => {
|
|
92
92
|
return config as any
|
|
93
93
|
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Type-safe helper for defining CLI commands that can be composed and spread into wireCLI.
|
|
97
|
+
*
|
|
98
|
+
* @template T - Record of CLI command configurations
|
|
99
|
+
* @param commands - The CLI commands record
|
|
100
|
+
* @returns The same commands record (identity function for type safety)
|
|
101
|
+
*/
|
|
102
|
+
export const defineCLICommands = <T extends Record<string, CoreCLICommandConfig<any, PikkuMiddleware, PikkuCLIRender<any>, any>>>(
|
|
103
|
+
commands: T
|
|
104
|
+
): T => {
|
|
105
|
+
return defineCLICommandsCore(commands as any) as T
|
|
106
|
+
}
|
|
94
107
|
`;
|
|
95
108
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Config } from '../../../../types/application-types.js';
|
|
1
|
+
import type { Config } from '../../../../types/application-types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Serializes the local (in-program) CLI bootstrap code
|
|
4
4
|
*/
|
|
5
5
|
export declare function serializeLocalCLIBootstrap(programName: string, _programMeta: any, bootstrapFile: string, config: Config, pikkuConfigFactory: {
|
|
6
6
|
file: string;
|
|
7
7
|
variable: string;
|
|
8
|
-
}, singletonServicesFactory: {
|
|
8
|
+
} | undefined, singletonServicesFactory: {
|
|
9
9
|
file: string;
|
|
10
10
|
variable: string;
|
|
11
|
-
}, wireServicesFactory
|
|
11
|
+
}, wireServicesFactory?: {
|
|
12
12
|
file: string;
|
|
13
13
|
variable: string;
|
|
14
14
|
}): string;
|
|
@@ -4,30 +4,29 @@ import { getFileImportRelativePath } from '../../../utils/file-import-path.js';
|
|
|
4
4
|
*/
|
|
5
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
|
-
|
|
8
|
-
|
|
7
|
+
const pikkuConfigPath = pikkuConfigFactory
|
|
8
|
+
? getFileImportRelativePath(bootstrapFile, pikkuConfigFactory.file, config.packageMappings)
|
|
9
|
+
: null;
|
|
9
10
|
const singletonServicesPath = getFileImportRelativePath(bootstrapFile, singletonServicesFactory.file, config.packageMappings);
|
|
10
|
-
const wireServicesPath =
|
|
11
|
+
const wireServicesPath = wireServicesFactory
|
|
12
|
+
? getFileImportRelativePath(bootstrapFile, wireServicesFactory.file, config.packageMappings)
|
|
13
|
+
: null;
|
|
11
14
|
const cliBootstrapPath = getFileImportRelativePath(bootstrapFile, config.bootstrapFile, config.packageMappings);
|
|
12
15
|
return `
|
|
13
16
|
import { executeCLI, CLIError } from '@pikku/core/cli'
|
|
14
|
-
import { ${pikkuConfigFactory.variable} as createConfig } from '${pikkuConfigPath}'
|
|
17
|
+
${pikkuConfigFactory ? `import { ${pikkuConfigFactory.variable} as createConfig } from '${pikkuConfigPath}'` : ''}
|
|
15
18
|
import { ${singletonServicesFactory.variable} as createSingletonServices } from '${singletonServicesPath}'
|
|
16
|
-
import { ${wireServicesFactory.variable} as createWireServices } from '${wireServicesPath}'
|
|
19
|
+
${wireServicesFactory ? `import { ${wireServicesFactory.variable} as createWireServices } from '${wireServicesPath}'` : ''}
|
|
17
20
|
import '${cliBootstrapPath}'
|
|
18
21
|
|
|
19
|
-
/**
|
|
20
|
-
* ${capitalizedName} CLI function
|
|
21
|
-
* Handles command line arguments and executes the appropriate function
|
|
22
|
-
*/
|
|
23
22
|
export async function ${capitalizedName}CLI(args: string[]): Promise<void> {
|
|
24
23
|
try {
|
|
25
24
|
await executeCLI({
|
|
26
25
|
programName: '${programName}',
|
|
27
26
|
args: args || process.argv.slice(2),
|
|
28
|
-
createConfig,
|
|
27
|
+
${pikkuConfigFactory ? ' createConfig,' : ''}
|
|
29
28
|
createSingletonServices,
|
|
30
|
-
createWireServices,
|
|
29
|
+
${wireServicesFactory ? ' createWireServices,' : ''}
|
|
31
30
|
})
|
|
32
31
|
} catch (error) {
|
|
33
32
|
if (error instanceof CLIError) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuConsoleFunctions: import("#pikku").PikkuFunctionConfig<void, boolean, "session" | "rpc", import("#pikku").PikkuFunctionSessionless<void, boolean, "session" | "rpc", import("#pikku").Services> | import("#pikku").PikkuFunction<void, boolean, "session" | "rpc", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { pikkuSessionlessFunc } from '#pikku';
|
|
2
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js';
|
|
3
|
+
import { writeFileInDir } from '../../../utils/file-writer.js';
|
|
4
|
+
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js';
|
|
5
|
+
import { serializeConsoleFunctions } from './serialize-console-functions.js';
|
|
6
|
+
import { join } from 'path';
|
|
7
|
+
export const pikkuConsoleFunctions = pikkuSessionlessFunc({
|
|
8
|
+
func: async ({ logger, config }) => {
|
|
9
|
+
if (config.console?.functionsPath) {
|
|
10
|
+
const consoleFunctionsPath = join(config.rootDir, config.console.functionsPath);
|
|
11
|
+
const pathToPikkuTypes = getFileImportRelativePath(consoleFunctionsPath, config.typesDeclarationFile, config.packageMappings);
|
|
12
|
+
const pathToAgentTypes = getFileImportRelativePath(consoleFunctionsPath, config.agentTypesFile, config.packageMappings);
|
|
13
|
+
await writeFileInDir(logger, consoleFunctionsPath, serializeConsoleFunctions(pathToPikkuTypes, pathToAgentTypes));
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
},
|
|
18
|
+
middleware: [
|
|
19
|
+
logCommandInfoAndTime({
|
|
20
|
+
commandStart: 'Generating Console functions',
|
|
21
|
+
commandEnd: 'Generated Console functions',
|
|
22
|
+
}),
|
|
23
|
+
],
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuNodeTypes: import("#pikku").PikkuFunctionConfig<void, void, "session" | "rpc", import("#pikku").PikkuFunctionSessionless<void, void, "session" | "rpc", import("#pikku").Services> | import("#pikku").PikkuFunction<void, void, "session" | "rpc", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { pikkuSessionlessFunc } from '#pikku';
|
|
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 { serializeNodeTypes } from './serialize-node-types.js';
|
|
6
|
+
export const pikkuNodeTypes = pikkuSessionlessFunc({
|
|
7
|
+
func: async ({ logger, config }) => {
|
|
8
|
+
const { nodeTypesFile, rpcInternalMapDeclarationFile, packageMappings, node, } = config;
|
|
9
|
+
let rpcMapImportPath = getFileImportRelativePath(nodeTypesFile, rpcInternalMapDeclarationFile, packageMappings);
|
|
10
|
+
rpcMapImportPath = rpcMapImportPath.replace('.d.js', '.js');
|
|
11
|
+
const categories = node?.categories;
|
|
12
|
+
const content = serializeNodeTypes(rpcMapImportPath, categories);
|
|
13
|
+
await writeFileInDir(logger, nodeTypesFile, content);
|
|
14
|
+
},
|
|
15
|
+
middleware: [
|
|
16
|
+
logCommandInfoAndTime({
|
|
17
|
+
commandStart: 'Creating Node types',
|
|
18
|
+
commandEnd: 'Created Node types',
|
|
19
|
+
}),
|
|
20
|
+
],
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuNodesMeta: import("#pikku").PikkuFunctionConfig<void, boolean | undefined, "session" | "rpc", import("#pikku").PikkuFunctionSessionless<void, boolean | undefined, "session" | "rpc", import("#pikku").Services> | import("#pikku").PikkuFunction<void, boolean | undefined, "session" | "rpc", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { pikkuSessionlessFunc } from '#pikku';
|
|
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
|
+
import { validateAndBuildSecretDefinitionsMeta } from '@pikku/core/secret';
|
|
9
|
+
const loadIcon = async (iconPath, rootDir, logger) => {
|
|
10
|
+
if (!iconPath)
|
|
11
|
+
return undefined;
|
|
12
|
+
const fullPath = isAbsolute(iconPath) ? iconPath : join(rootDir, iconPath);
|
|
13
|
+
try {
|
|
14
|
+
const content = await readFile(fullPath, 'utf-8');
|
|
15
|
+
const trimmed = content.trim();
|
|
16
|
+
if (!trimmed.startsWith('<svg') && !trimmed.startsWith('<?xml')) {
|
|
17
|
+
logger.warn(`Icon file is not a valid SVG: ${fullPath}`);
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
return trimmed.replace(/<\?xml[^?]*\?>\s*/g, '').trim();
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
logger.warn(`Could not load icon: ${fullPath}`);
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export const pikkuNodesMeta = pikkuSessionlessFunc({
|
|
28
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
29
|
+
const state = await getInspectorState();
|
|
30
|
+
const { nodes, secrets } = state;
|
|
31
|
+
const { nodesMetaJsonFile, node, rootDir } = config;
|
|
32
|
+
const secretsMeta = validateAndBuildSecretDefinitionsMeta(secrets.definitions, state.schemaLookup);
|
|
33
|
+
const hasNodes = Object.keys(nodes.meta).length > 0;
|
|
34
|
+
const hasSecrets = secrets.definitions.length > 0;
|
|
35
|
+
if (!hasNodes && !hasSecrets) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const allowedCategories = node?.categories;
|
|
39
|
+
if (allowedCategories && allowedCategories.length > 0) {
|
|
40
|
+
for (const [name, meta] of Object.entries(nodes.meta)) {
|
|
41
|
+
if (!allowedCategories.includes(meta.category)) {
|
|
42
|
+
logger.critical(ErrorCode.INVALID_VALUE, `Node '${name}' has invalid category '${meta.category}'. ` +
|
|
43
|
+
`Allowed categories: ${allowedCategories.join(', ')}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const outputMeta = {};
|
|
48
|
+
for (const [name, meta] of Object.entries(nodes.meta)) {
|
|
49
|
+
const { icon: _icon, ...nodeMetaWithoutIcon } = meta;
|
|
50
|
+
outputMeta[name] = nodeMetaWithoutIcon;
|
|
51
|
+
}
|
|
52
|
+
const packageIcon = await loadIcon(node?.icon, rootDir, logger);
|
|
53
|
+
const metaData = {
|
|
54
|
+
nodes: outputMeta,
|
|
55
|
+
secrets: secretsMeta,
|
|
56
|
+
package: {
|
|
57
|
+
displayName: node?.displayName,
|
|
58
|
+
description: node?.description,
|
|
59
|
+
icon: packageIcon,
|
|
60
|
+
categories: node?.categories,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
if (nodesMetaJsonFile) {
|
|
64
|
+
const minimalMeta = stripVerboseFields(metaData);
|
|
65
|
+
await writeFileInDir(logger, nodesMetaJsonFile, JSON.stringify(minimalMeta, null, 2), { ignoreModifyComment: true });
|
|
66
|
+
if (hasVerboseFields(metaData)) {
|
|
67
|
+
const verbosePath = nodesMetaJsonFile.replace(/\.gen\.json$/, '-verbose.gen.json');
|
|
68
|
+
await writeFileInDir(logger, verbosePath, JSON.stringify(metaData, null, 2), { ignoreModifyComment: true });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
},
|
|
73
|
+
middleware: [
|
|
74
|
+
logCommandInfoAndTime({
|
|
75
|
+
commandStart: 'Generating nodes metadata',
|
|
76
|
+
commandEnd: 'Generated nodes metadata',
|
|
77
|
+
}),
|
|
78
|
+
],
|
|
79
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const serializeConsoleFunctions: (pathToPikkuTypes: string, _pathToAgentTypes: string) => string;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export const serializeConsoleFunctions = (pathToPikkuTypes, _pathToAgentTypes) => {
|
|
2
|
+
return `import { pikkuSessionlessFunc, defineHTTPRoutes, wireHTTPRoutes, addon, wireAddon } from '${pathToPikkuTypes}'
|
|
3
|
+
|
|
4
|
+
export const pikkuConsoleSetSecret = pikkuSessionlessFunc<{
|
|
5
|
+
secretId: string
|
|
6
|
+
value: unknown
|
|
7
|
+
}, {
|
|
8
|
+
success: boolean
|
|
9
|
+
}>({
|
|
10
|
+
description: 'Set the value of a secret',
|
|
11
|
+
expose: true,
|
|
12
|
+
auth: false,
|
|
13
|
+
func: async ({ secrets }, { secretId, value }) => {
|
|
14
|
+
await secrets.setSecretJSON(secretId, value)
|
|
15
|
+
return { success: true }
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const pikkuConsoleGetVariable = pikkuSessionlessFunc<
|
|
20
|
+
{ variableId: string },
|
|
21
|
+
{ exists: boolean; value: unknown | null }
|
|
22
|
+
>({
|
|
23
|
+
description: 'Get the current value of a variable',
|
|
24
|
+
expose: true,
|
|
25
|
+
auth: false,
|
|
26
|
+
func: async ({ variables }, { variableId }) => {
|
|
27
|
+
const exists = await variables.has(variableId)
|
|
28
|
+
if (!exists) {
|
|
29
|
+
return { exists: false, value: null }
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const value = await variables.getJSON(variableId)
|
|
33
|
+
return { exists: true, value }
|
|
34
|
+
} catch {
|
|
35
|
+
const value = await variables.get(variableId)
|
|
36
|
+
return { exists: true, value }
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
export const pikkuConsoleSetVariable = pikkuSessionlessFunc<
|
|
42
|
+
{ variableId: string; value: unknown },
|
|
43
|
+
{ success: boolean }
|
|
44
|
+
>({
|
|
45
|
+
description: 'Set the value of a variable',
|
|
46
|
+
expose: true,
|
|
47
|
+
auth: false,
|
|
48
|
+
func: async ({ variables }, { variableId, value }) => {
|
|
49
|
+
if (typeof value === 'string') {
|
|
50
|
+
await variables.set(variableId, value)
|
|
51
|
+
} else {
|
|
52
|
+
await variables.setJSON(variableId, value)
|
|
53
|
+
}
|
|
54
|
+
return { success: true }
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
export const pikkuConsoleGetSecret = pikkuSessionlessFunc<
|
|
59
|
+
{ secretId: string },
|
|
60
|
+
{ exists: boolean; value: unknown | null }
|
|
61
|
+
>({
|
|
62
|
+
description: 'Get the current value of a secret',
|
|
63
|
+
expose: true,
|
|
64
|
+
auth: false,
|
|
65
|
+
func: async ({ secrets }, { secretId }) => {
|
|
66
|
+
const exists = await secrets.hasSecret(secretId)
|
|
67
|
+
if (!exists) {
|
|
68
|
+
return { exists: false, value: null }
|
|
69
|
+
}
|
|
70
|
+
const value = await secrets.getSecretJSON(secretId)
|
|
71
|
+
return { exists: true, value }
|
|
72
|
+
},
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
export const consoleRoutes = defineHTTPRoutes({
|
|
76
|
+
auth: false,
|
|
77
|
+
routes: {
|
|
78
|
+
workflowRunStream: {
|
|
79
|
+
route: '/workflow-run/:runId/stream',
|
|
80
|
+
method: 'get',
|
|
81
|
+
sse: true,
|
|
82
|
+
func: addon('console:streamWorkflowRun'),
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
wireAddon({ name: 'console', package: '@pikku/addon-console' })
|
|
88
|
+
wireHTTPRoutes({ baseRoute: '/api', routes: { console: consoleRoutes } })
|
|
89
|
+
`;
|
|
90
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const serializeNodeTypes: (rpcMapImportPath: string, categories: string[] | undefined) => string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const serializeNodeTypes = (rpcMapImportPath, categories) => {
|
|
2
|
+
const categoryType = categories?.length
|
|
3
|
+
? categories.map((c) => `'${c}'`).join(' | ')
|
|
4
|
+
: 'never';
|
|
5
|
+
return `import type { FlattenedRPCMap } from '${rpcMapImportPath}'
|
|
6
|
+
|
|
7
|
+
export type NodeCategory = ${categoryType}
|
|
8
|
+
|
|
9
|
+
export type NodeRPCName = keyof FlattenedRPCMap
|
|
10
|
+
`;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuAddonTypes: import("#pikku").PikkuFunctionConfig<void, void, "session" | "rpc", import("#pikku").PikkuFunctionSessionless<void, void, "session" | "rpc", import("#pikku").Services> | import("#pikku").PikkuFunction<void, void, "session" | "rpc", import("#pikku").Services>, undefined, undefined>;
|