@pikku/cli 0.11.3 → 0.12.0
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-C19L3UJu.js +637 -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 +29 -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 +19 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.js +4 -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 +1 -1
- 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 +18 -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 +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +43 -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 +71 -20
- package/dist/.pikku/function/pikku-function-types.gen.js +27 -3
- package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.json +645 -195
- 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 +1 -1
- 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 +1 -1
- 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 +5 -1
- package/dist/.pikku/pikku-services.gen.js +4 -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 +1 -1
- 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 +61 -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 +1 -1
- 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 +33 -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/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 +1 -1
- 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 +29 -2
- package/dist/src/functions/commands/all.d.ts +1 -1
- package/dist/src/functions/commands/all.js +79 -176
- 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/pikku-command-bootstrap.d.ts +4 -0
- package/dist/src/functions/commands/pikku-command-bootstrap.js +67 -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 +17 -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 +8 -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 +19 -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 +31 -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 +90 -0
- package/dist/src/functions/wirings/channels/pikku-channels.d.ts +1 -1
- package/dist/src/functions/wirings/channels/pikku-channels.js +1 -1
- 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 +1 -1
- 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 +2 -1
- 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 +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 +2 -2
- 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 +23 -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 +229 -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-external-types.d.ts +1 -0
- package/dist/src/functions/wirings/functions/pikku-command-external-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 +5 -5
- package/dist/src/functions/wirings/functions/pikku-command-functions.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-functions.js +1 -1
- 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-external-types.d.ts +1 -0
- package/dist/src/functions/wirings/functions/serialize-external-types.js +77 -0
- package/dist/src/functions/wirings/functions/serialize-function-imports.d.ts +1 -2
- package/dist/src/functions/wirings/functions/serialize-function-imports.js +10 -17
- package/dist/src/functions/wirings/functions/serialize-function-types.d.ts +1 -1
- package/dist/src/functions/wirings/functions/serialize-function-types.js +99 -32
- 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 +1 -1
- 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 +5 -2
- 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 +13 -4
- 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 +3 -3
- 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/permissions/pikku-command-permissions.d.ts +1 -1
- package/dist/src/functions/wirings/permissions/pikku-command-permissions.js +10 -5
- 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 +5 -2
- package/dist/src/functions/wirings/queue/serialize-queue-map.js +12 -40
- 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 +12 -7
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +5 -2
- package/dist/src/functions/wirings/rpc/serialize-public-rpc.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/serialize-public-rpc.js +11 -6
- package/dist/src/functions/wirings/rpc/serialize-remote-rpc.js +2 -2
- package/dist/src/functions/wirings/rpc/serialize-rpc-wrapper.js +19 -8
- package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.d.ts +6 -3
- package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.js +85 -60
- 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 +1 -1
- 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 +6 -35
- package/dist/src/functions/wirings/workflow/serialize-workflow-map.d.ts +4 -2
- 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 +1 -1
- package/dist/src/services/cli-logger-forwarder.service.js +1 -1
- package/dist/src/services/cli-logger.service.d.ts +1 -1
- package/dist/src/services/cli-logger.service.js +1 -1
- package/dist/src/services.d.ts +1 -1
- package/dist/src/services.js +53 -6
- 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/pikku-cli-config.js +77 -14
- package/dist/src/utils/pikku-files-and-methods.d.ts +0 -1
- package/dist/src/utils/pikku-files-and-methods.js +15 -60
- package/dist/src/utils/serialize-import-map.d.ts +2 -1
- package/dist/src/utils/serialize-import-map.js +3 -54
- 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,13 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generates core function, middleware, and permission type definitions
|
|
3
3
|
*/
|
|
4
|
-
export const serializeFunctionTypes = (userSessionTypeImport, userSessionTypeName, singletonServicesTypeImport, singletonServicesTypeName, wireServicesTypeImport, wireServicesTypeName, rpcMapTypeImport, requiredServicesTypeImport, configTypeImport, packageName) => {
|
|
4
|
+
export const serializeFunctionTypes = (userSessionTypeImport, userSessionTypeName, singletonServicesTypeImport, singletonServicesTypeName, wireServicesTypeImport, wireServicesTypeName, rpcMapTypeImport, requiredServicesTypeImport, configTypeImport, packageName, workflowTypesImport, nodeCategories) => {
|
|
5
5
|
const packageNameValue = packageName ? `'${packageName}'` : 'null';
|
|
6
|
+
const nodeCategoryType = nodeCategories?.length
|
|
7
|
+
? nodeCategories.map((c) => `'${c}'`).join(' | ')
|
|
8
|
+
: 'string';
|
|
9
|
+
const workflowImport = workflowTypesImport ||
|
|
10
|
+
`import type { TypedWorkflow } from '../workflow/pikku-workflow-types.gen.js'`;
|
|
6
11
|
return `/**
|
|
7
12
|
* Core function, middleware, and permission types for all wirings
|
|
8
13
|
*/
|
|
9
14
|
|
|
10
|
-
import { CorePikkuFunctionConfig, CorePikkuPermission, CorePikkuMiddleware, CorePermissionGroup, addMiddleware as addMiddlewareCore, addPermission as addPermissionCore, PikkuWire, PickRequired,
|
|
15
|
+
import { CorePikkuFunctionConfig, CorePikkuAuth, CorePikkuAuthConfig, CorePikkuPermission, CorePikkuMiddleware, CorePermissionGroup, addMiddleware as addMiddlewareCore, addPermission as addPermissionCore, PikkuWire, PickRequired, CreateWireServices } from '@pikku/core'
|
|
16
|
+
import { pikkuAuth as pikkuAuthCore } from '@pikku/core'
|
|
17
|
+
import type { NodeType } from '@pikku/core/node'
|
|
18
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec'
|
|
11
19
|
import { CorePikkuFunction, CorePikkuFunctionSessionless } from '@pikku/core/function'
|
|
12
20
|
|
|
13
21
|
${userSessionTypeImport}
|
|
@@ -16,11 +24,22 @@ ${wireServicesTypeImport}
|
|
|
16
24
|
${configTypeImport}
|
|
17
25
|
${rpcMapTypeImport}
|
|
18
26
|
${requiredServicesTypeImport}
|
|
27
|
+
${workflowImport}
|
|
19
28
|
|
|
20
|
-
${singletonServicesTypeName !== 'SingletonServices' ? `type SingletonServices = ${singletonServicesTypeName}` :
|
|
21
|
-
${wireServicesTypeName !== 'Services' ? `type Services = ${wireServicesTypeName}` :
|
|
22
|
-
${userSessionTypeName !== 'Session' ? `type Session = ${userSessionTypeName}` :
|
|
23
|
-
${configTypeImport.includes('Config type not found') ? 'type Config = any' : ''}
|
|
29
|
+
${singletonServicesTypeName !== 'SingletonServices' ? `export type SingletonServices = ${singletonServicesTypeName}` : `export type { ${singletonServicesTypeName} as SingletonServices }`}
|
|
30
|
+
${wireServicesTypeName !== 'Services' ? `export type Services = ${wireServicesTypeName}` : `export type { ${wireServicesTypeName} as Services }`}
|
|
31
|
+
${userSessionTypeName !== 'Session' ? `export type Session = ${userSessionTypeName}` : `export type { ${userSessionTypeName} as Session }`}
|
|
32
|
+
${configTypeImport.includes('Config type not found') ? 'export type Config = any' : ''}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Inline node configuration for function definitions.
|
|
36
|
+
*/
|
|
37
|
+
export type NodeConfig = {
|
|
38
|
+
displayName: string
|
|
39
|
+
category: ${nodeCategoryType}
|
|
40
|
+
type: NodeType
|
|
41
|
+
errorOutput?: boolean
|
|
42
|
+
}
|
|
24
43
|
|
|
25
44
|
/**
|
|
26
45
|
* Type-safe API permission definition that integrates with your application's session type.
|
|
@@ -80,6 +99,46 @@ export const pikkuPermission = <In>(
|
|
|
80
99
|
return typeof permission === 'function' ? permission : permission.func
|
|
81
100
|
}
|
|
82
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Type-safe auth-only permission that only needs services and session.
|
|
104
|
+
* Use this for upfront authorization gates (MCP tools, AI agents, workflows)
|
|
105
|
+
* where request data isn't available yet.
|
|
106
|
+
*
|
|
107
|
+
* @template RequiredServices - The services required for this auth check
|
|
108
|
+
*/
|
|
109
|
+
export type PikkuAuth<RequiredServices extends SingletonServices = SingletonServices> = CorePikkuAuth<RequiredServices, Session>
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Configuration object for creating an auth permission with metadata
|
|
113
|
+
*/
|
|
114
|
+
export type PikkuAuthConfig<RequiredServices extends SingletonServices = SingletonServices> = CorePikkuAuthConfig<RequiredServices, Session>
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Factory function for creating auth-only permissions with tree-shaking support.
|
|
118
|
+
* Auth permissions only receive services and session (no request data),
|
|
119
|
+
* making them evaluable before request data is available.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* \\\`\\\`\\\`typescript
|
|
123
|
+
* const isAuthenticated = pikkuAuth(async ({ logger }, session) => {
|
|
124
|
+
* return !!session
|
|
125
|
+
* })
|
|
126
|
+
*
|
|
127
|
+
* const isAdmin = pikkuAuth({
|
|
128
|
+
* name: 'Admin Auth',
|
|
129
|
+
* description: 'Checks if user is an admin',
|
|
130
|
+
* func: async ({ logger }, session) => {
|
|
131
|
+
* return session?.role === 'admin'
|
|
132
|
+
* }
|
|
133
|
+
* })
|
|
134
|
+
* \\\`\\\`\\\`
|
|
135
|
+
*/
|
|
136
|
+
export const pikkuAuth = <RequiredServices extends SingletonServices = SingletonServices>(
|
|
137
|
+
auth: PikkuAuth<RequiredServices> | PikkuAuthConfig<RequiredServices>
|
|
138
|
+
): PikkuPermission<any, any> => {
|
|
139
|
+
return pikkuAuthCore(auth as any) as any
|
|
140
|
+
}
|
|
141
|
+
|
|
83
142
|
/**
|
|
84
143
|
* Configuration object for creating middleware with metadata
|
|
85
144
|
*/
|
|
@@ -153,8 +212,8 @@ export const pikkuMiddlewareFactory = <In = any>(
|
|
|
153
212
|
* export const requireRole = pikkuPermissionFactory<{ role: string }>(({
|
|
154
213
|
* role
|
|
155
214
|
* }) => {
|
|
156
|
-
* return pikkuPermission(async ({ logger }, data, {
|
|
157
|
-
* if (!
|
|
215
|
+
* return pikkuPermission(async ({ logger }, data, { session }) => {
|
|
216
|
+
* if (!session || session.role !== role) {
|
|
158
217
|
* logger.warn(\`Permission denied: required role '\${role}'\`)
|
|
159
218
|
* return false
|
|
160
219
|
* }
|
|
@@ -186,7 +245,8 @@ export type PikkuFunctionSessionless<
|
|
|
186
245
|
In,
|
|
187
246
|
Out,
|
|
188
247
|
RequiredServices,
|
|
189
|
-
|
|
248
|
+
Session,
|
|
249
|
+
PickRequired<PikkuWire<In, Out, false, Session, TypedPikkuRPC, null, any, TypedWorkflow>, RequiredWires>
|
|
190
250
|
>
|
|
191
251
|
|
|
192
252
|
/**
|
|
@@ -206,13 +266,14 @@ export type PikkuFunction<
|
|
|
206
266
|
In,
|
|
207
267
|
Out,
|
|
208
268
|
RequiredServices,
|
|
209
|
-
|
|
269
|
+
Session,
|
|
270
|
+
PickRequired<PikkuWire<In, Out, true, Session, TypedPikkuRPC, null, any, TypedWorkflow>, RequiredWires>
|
|
210
271
|
>
|
|
211
272
|
|
|
212
273
|
/**
|
|
213
|
-
* Helper type to infer the output type from a
|
|
274
|
+
* Helper type to infer the output type from a Standard Schema
|
|
214
275
|
*/
|
|
215
|
-
export type
|
|
276
|
+
export type InferSchemaOutput<T> = T extends StandardSchemaV1<any, infer Output> ? Output : never
|
|
216
277
|
|
|
217
278
|
/**
|
|
218
279
|
* Configuration object for Pikku functions with optional middleware, permissions, tags, and documentation.
|
|
@@ -227,8 +288,8 @@ export type PikkuFunctionConfig<
|
|
|
227
288
|
Out = unknown,
|
|
228
289
|
RequiredWires extends keyof PikkuWire = never,
|
|
229
290
|
PikkuFunc extends PikkuFunction<In, Out, RequiredWires> | PikkuFunctionSessionless<In, Out, RequiredWires> = PikkuFunction<In, Out, RequiredWires> | PikkuFunctionSessionless<In, Out, RequiredWires>,
|
|
230
|
-
InputSchema extends
|
|
231
|
-
OutputSchema extends
|
|
291
|
+
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
292
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
232
293
|
> = CorePikkuFunctionConfig<PikkuFunc, PikkuPermission<In>, PikkuMiddleware, InputSchema, OutputSchema>
|
|
233
294
|
|
|
234
295
|
/**
|
|
@@ -237,28 +298,30 @@ export type PikkuFunctionConfig<
|
|
|
237
298
|
* Types are automatically inferred from the schemas.
|
|
238
299
|
*/
|
|
239
300
|
export type PikkuFunctionConfigWithSchema<
|
|
240
|
-
InputSchema extends
|
|
241
|
-
OutputSchema extends
|
|
301
|
+
InputSchema extends StandardSchemaV1,
|
|
302
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
242
303
|
RequiredWires extends keyof PikkuWire = never
|
|
243
304
|
> = {
|
|
244
305
|
name?: string
|
|
245
306
|
tags?: string[]
|
|
246
307
|
expose?: boolean
|
|
308
|
+
mcp?: boolean
|
|
247
309
|
internal?: boolean
|
|
248
310
|
func: PikkuFunction<
|
|
249
|
-
|
|
250
|
-
OutputSchema extends
|
|
311
|
+
InferSchemaOutput<InputSchema>,
|
|
312
|
+
OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown,
|
|
251
313
|
RequiredWires
|
|
252
314
|
> | PikkuFunctionSessionless<
|
|
253
|
-
|
|
254
|
-
OutputSchema extends
|
|
315
|
+
InferSchemaOutput<InputSchema>,
|
|
316
|
+
OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown,
|
|
255
317
|
RequiredWires
|
|
256
318
|
>
|
|
257
319
|
auth?: boolean
|
|
258
|
-
permissions?: CorePermissionGroup<PikkuPermission<
|
|
320
|
+
permissions?: CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>>
|
|
259
321
|
middleware?: PikkuMiddleware[]
|
|
260
322
|
input: InputSchema
|
|
261
323
|
output?: OutputSchema
|
|
324
|
+
node?: NodeConfig
|
|
262
325
|
}
|
|
263
326
|
|
|
264
327
|
/**
|
|
@@ -300,11 +363,11 @@ export type PikkuFunctionConfigWithSchema<
|
|
|
300
363
|
* \`\`\`
|
|
301
364
|
*/
|
|
302
365
|
export function pikkuFunc<
|
|
303
|
-
InputSchema extends
|
|
304
|
-
OutputSchema extends
|
|
366
|
+
InputSchema extends StandardSchemaV1,
|
|
367
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
305
368
|
>(
|
|
306
369
|
config: PikkuFunctionConfigWithSchema<InputSchema, OutputSchema, 'session' | 'rpc'>
|
|
307
|
-
): PikkuFunctionConfig<
|
|
370
|
+
): PikkuFunctionConfig<InferSchemaOutput<InputSchema>, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'session' | 'rpc'>
|
|
308
371
|
export function pikkuFunc<In, Out = unknown>(
|
|
309
372
|
func:
|
|
310
373
|
| PikkuFunction<In, Out, 'session' | 'rpc'>
|
|
@@ -318,25 +381,28 @@ export function pikkuFunc(func: any) {
|
|
|
318
381
|
* Configuration object for sessionless Pikku functions with Zod schema validation.
|
|
319
382
|
*/
|
|
320
383
|
export type PikkuFunctionSessionlessConfigWithSchema<
|
|
321
|
-
InputSchema extends
|
|
322
|
-
OutputSchema extends
|
|
384
|
+
InputSchema extends StandardSchemaV1,
|
|
385
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
323
386
|
RequiredWires extends keyof PikkuWire = never
|
|
324
387
|
> = {
|
|
325
388
|
name?: string
|
|
326
389
|
description?: string
|
|
327
390
|
tags?: string[]
|
|
328
391
|
expose?: boolean
|
|
392
|
+
mcp?: boolean
|
|
329
393
|
internal?: boolean
|
|
394
|
+
remote?: boolean
|
|
330
395
|
func: PikkuFunctionSessionless<
|
|
331
|
-
|
|
332
|
-
OutputSchema extends
|
|
396
|
+
InferSchemaOutput<InputSchema>,
|
|
397
|
+
OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown,
|
|
333
398
|
RequiredWires
|
|
334
399
|
>
|
|
335
400
|
auth?: boolean
|
|
336
|
-
permissions?: CorePermissionGroup<PikkuPermission<
|
|
401
|
+
permissions?: CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>>
|
|
337
402
|
middleware?: PikkuMiddleware[]
|
|
338
403
|
input: InputSchema
|
|
339
404
|
output?: OutputSchema
|
|
405
|
+
node?: NodeConfig
|
|
340
406
|
}
|
|
341
407
|
|
|
342
408
|
/**
|
|
@@ -375,11 +441,11 @@ export type PikkuFunctionSessionlessConfigWithSchema<
|
|
|
375
441
|
* \`\`\`
|
|
376
442
|
*/
|
|
377
443
|
export function pikkuSessionlessFunc<
|
|
378
|
-
InputSchema extends
|
|
379
|
-
OutputSchema extends
|
|
444
|
+
InputSchema extends StandardSchemaV1,
|
|
445
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
380
446
|
>(
|
|
381
447
|
config: PikkuFunctionSessionlessConfigWithSchema<InputSchema, OutputSchema, 'session' | 'rpc'>
|
|
382
|
-
): PikkuFunctionConfig<
|
|
448
|
+
): PikkuFunctionConfig<InferSchemaOutput<InputSchema>, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'session' | 'rpc'>
|
|
383
449
|
export function pikkuSessionlessFunc<In, Out = unknown>(
|
|
384
450
|
func:
|
|
385
451
|
| PikkuFunctionSessionless<In, Out, 'session' | 'rpc'>
|
|
@@ -473,6 +539,7 @@ export const pikkuConfig = (
|
|
|
473
539
|
func: (variables?: any, ...args: any[]) => Promise<Config>
|
|
474
540
|
) => func
|
|
475
541
|
|
|
542
|
+
|
|
476
543
|
/**
|
|
477
544
|
* Creates a Pikku singleton services factory.
|
|
478
545
|
* Use this to define services that are created once and shared across all requests.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generates the main pikku-types.gen.ts file as a re-export hub
|
|
3
3
|
*/
|
|
4
|
-
export declare const serializePikkuTypesHub: (functionTypesImportPath: string, httpTypesImportPath: string | null, channelTypesImportPath: string | null, schedulerTypesImportPath: string | null, queueTypesImportPath: string | null, mcpTypesImportPath: string | null, cliTypesImportPath: string | null,
|
|
4
|
+
export declare const serializePikkuTypesHub: (functionTypesImportPath: string, httpTypesImportPath: string | null, channelTypesImportPath: string | null, triggerTypesImportPath: string | null, schedulerTypesImportPath: string | null, queueTypesImportPath: string | null, mcpTypesImportPath: string | null, cliTypesImportPath: string | null, nodeTypesImportPath: string | null, secretTypesImportPath: string | null, externalTypesImportPath: string | null) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generates the main pikku-types.gen.ts file as a re-export hub
|
|
3
3
|
*/
|
|
4
|
-
export const serializePikkuTypesHub = (functionTypesImportPath, httpTypesImportPath, channelTypesImportPath, schedulerTypesImportPath, queueTypesImportPath, mcpTypesImportPath, cliTypesImportPath,
|
|
4
|
+
export const serializePikkuTypesHub = (functionTypesImportPath, httpTypesImportPath, channelTypesImportPath, triggerTypesImportPath, schedulerTypesImportPath, queueTypesImportPath, mcpTypesImportPath, cliTypesImportPath, nodeTypesImportPath, secretTypesImportPath, externalTypesImportPath) => {
|
|
5
5
|
const exports = [
|
|
6
6
|
{
|
|
7
7
|
comment: 'Core function, middleware, and permission types',
|
|
@@ -9,11 +9,14 @@ export const serializePikkuTypesHub = (functionTypesImportPath, httpTypesImportP
|
|
|
9
9
|
},
|
|
10
10
|
{ comment: 'HTTP wiring types', path: httpTypesImportPath },
|
|
11
11
|
{ comment: 'Channel wiring types', path: channelTypesImportPath },
|
|
12
|
+
{ comment: 'Trigger wiring types', path: triggerTypesImportPath },
|
|
12
13
|
{ comment: 'Scheduler wiring types', path: schedulerTypesImportPath },
|
|
13
14
|
{ comment: 'Queue wiring types', path: queueTypesImportPath },
|
|
14
15
|
{ comment: 'MCP wiring types', path: mcpTypesImportPath },
|
|
15
16
|
{ comment: 'CLI wiring types', path: cliTypesImportPath },
|
|
16
|
-
{ comment: '
|
|
17
|
+
{ comment: 'Node wiring types', path: nodeTypesImportPath },
|
|
18
|
+
{ comment: 'Secret definition types', path: secretTypesImportPath },
|
|
19
|
+
{ comment: 'External package types', path: externalTypesImportPath },
|
|
17
20
|
];
|
|
18
21
|
const exportStatements = exports
|
|
19
22
|
.filter((e) => e.path)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const pikkuHTTPMap:
|
|
1
|
+
export declare const pikkuHTTPMap: 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,12 +1,12 @@
|
|
|
1
|
-
import { pikkuSessionlessFunc } from '
|
|
1
|
+
import { pikkuSessionlessFunc } from '#pikku';
|
|
2
2
|
import { writeFileInDir } from '../../../utils/file-writer.js';
|
|
3
3
|
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js';
|
|
4
4
|
import { serializeTypedHTTPWiringsMap } from './serialize-typed-http-map.js';
|
|
5
5
|
export const pikkuHTTPMap = pikkuSessionlessFunc({
|
|
6
6
|
func: async ({ logger, config, getInspectorState }) => {
|
|
7
|
-
const { http, functions } = await getInspectorState();
|
|
8
|
-
const { httpMapDeclarationFile, packageMappings } = config;
|
|
9
|
-
const content = serializeTypedHTTPWiringsMap(httpMapDeclarationFile, packageMappings, functions.typesMap,
|
|
7
|
+
const { http, functions, resolvedIOTypes } = await getInspectorState();
|
|
8
|
+
const { httpMapDeclarationFile, rpcInternalMapDeclarationFile, packageMappings, } = config;
|
|
9
|
+
const content = serializeTypedHTTPWiringsMap(logger, httpMapDeclarationFile, packageMappings, functions.typesMap, http.meta, http.metaInputTypes, resolvedIOTypes, rpcInternalMapDeclarationFile);
|
|
10
10
|
await writeFileInDir(logger, httpMapDeclarationFile, content);
|
|
11
11
|
},
|
|
12
12
|
middleware: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const pikkuHTTP:
|
|
1
|
+
export declare const pikkuHTTP: 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';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const pikkuHTTPTypes:
|
|
1
|
+
export declare const pikkuHTTPTypes: 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 pikkuOpenAPI:
|
|
1
|
+
export declare const pikkuOpenAPI: 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,23 +1,25 @@
|
|
|
1
|
-
import { pikkuSessionlessFunc } from '
|
|
1
|
+
import { pikkuSessionlessFunc } from '#pikku';
|
|
2
2
|
import { writeFileInDir } from '../../../utils/file-writer.js';
|
|
3
3
|
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js';
|
|
4
|
-
import { generateSchemas } from '../../../utils/schema-generator.js';
|
|
5
|
-
import { generateOpenAPISpec } from './openapi-spec-generator.js';
|
|
6
4
|
import { stringify } from 'yaml';
|
|
7
5
|
export const pikkuOpenAPI = pikkuSessionlessFunc({
|
|
8
6
|
func: async ({ logger, config, getInspectorState }) => {
|
|
9
|
-
const {
|
|
10
|
-
// If openAPI outputFile is not defined, clean up any existing file and return
|
|
7
|
+
const { openAPI } = config;
|
|
11
8
|
if (!openAPI?.outputFile) {
|
|
12
|
-
logger.
|
|
9
|
+
logger.debug({
|
|
13
10
|
message: 'Skipping creating OpenAPI spec since openAPI outfile is not defined.',
|
|
14
11
|
type: 'skip',
|
|
15
12
|
});
|
|
16
13
|
return;
|
|
17
14
|
}
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
const { openAPISpec } = await getInspectorState();
|
|
16
|
+
if (!openAPISpec) {
|
|
17
|
+
logger.debug({
|
|
18
|
+
message: 'Skipping creating OpenAPI spec since no spec was generated.',
|
|
19
|
+
type: 'skip',
|
|
20
|
+
});
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
21
23
|
if (openAPI.outputFile.endsWith('.json')) {
|
|
22
24
|
await writeFileInDir(logger, openAPI.outputFile, JSON.stringify(openAPISpec, null, 2), { ignoreModifyComment: true });
|
|
23
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const pikkuHTTP:
|
|
1
|
+
export declare const pikkuHTTP: 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>;
|
|
@@ -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';
|
|
@@ -15,7 +15,7 @@ export const pikkuHTTP = pikkuSessionlessFunc({
|
|
|
15
15
|
const importStatement = supportsImportAttributes
|
|
16
16
|
? `import metaData from '${jsonImportPath}' with { type: 'json' }`
|
|
17
17
|
: `import metaData from '${jsonImportPath}'`;
|
|
18
|
-
await writeFileInDir(logger, httpWiringMetaFile, `import { pikkuState
|
|
18
|
+
await writeFileInDir(logger, httpWiringMetaFile, `import { pikkuState } from '@pikku/core'\nimport type { HTTPWiringsMeta } from '@pikku/core/http'\n${importStatement}\npikkuState(null, 'http', 'meta', metaData as HTTPWiringsMeta)`);
|
|
19
19
|
return true;
|
|
20
20
|
},
|
|
21
21
|
middleware: [
|
|
@@ -6,9 +6,9 @@ export const serializeHTTPTypes = (functionTypesImportPath) => {
|
|
|
6
6
|
* HTTP-specific type definitions for tree-shaking optimization
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { AssertHTTPWiringParams, wireHTTP as wireHTTPCore, addHTTPMiddleware as addHTTPMiddlewareCore, addHTTPPermission as addHTTPPermissionCore } from '@pikku/core/http'
|
|
10
|
-
import type { PikkuFunction, PikkuFunctionSessionless, PikkuPermission, PikkuMiddleware } from '${functionTypesImportPath}'
|
|
11
|
-
import type { CoreHTTPFunctionWiring, HTTPMethod } from '@pikku/core/http'
|
|
9
|
+
import { AssertHTTPWiringParams, wireHTTP as wireHTTPCore, addHTTPMiddleware as addHTTPMiddlewareCore, addHTTPPermission as addHTTPPermissionCore, wireHTTPRoutes as wireHTTPRoutesCore, defineHTTPRoutes as defineHTTPRoutesCore } from '@pikku/core/http'
|
|
10
|
+
import type { PikkuFunction, PikkuFunctionSessionless, PikkuPermission, PikkuMiddleware, PikkuFunctionConfig } from '${functionTypesImportPath}'
|
|
11
|
+
import type { CoreHTTPFunctionWiring, HTTPMethod, HTTPRouteBaseConfig } from '@pikku/core/http'
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Type definition for HTTP API wirings with type-safe path parameters.
|
|
@@ -20,22 +20,6 @@ import type { CoreHTTPFunctionWiring, HTTPMethod } from '@pikku/core/http'
|
|
|
20
20
|
*/
|
|
21
21
|
type HTTPWiring<In, Out, Route extends string> = CoreHTTPFunctionWiring<In, Out, Route, PikkuFunction<In, Out, 'rpc' | 'session'>, PikkuFunctionSessionless<In, Out, 'rpc' | 'session'>, PikkuPermission<In>, PikkuMiddleware>
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* HTTP wiring for workflow triggers (no function needed)
|
|
25
|
-
*/
|
|
26
|
-
type HTTPWorkflowWiring<Route extends string> = {
|
|
27
|
-
route: Route
|
|
28
|
-
method: HTTPMethod
|
|
29
|
-
workflow: true
|
|
30
|
-
func?: undefined
|
|
31
|
-
permissions?: undefined
|
|
32
|
-
auth?: undefined
|
|
33
|
-
tags?: undefined
|
|
34
|
-
middleware?: undefined
|
|
35
|
-
returnsJSON?: undefined
|
|
36
|
-
sse?: boolean
|
|
37
|
-
}
|
|
38
|
-
|
|
39
23
|
/**
|
|
40
24
|
* Registers an HTTP wiring with the Pikku framework.
|
|
41
25
|
*
|
|
@@ -45,7 +29,7 @@ type HTTPWorkflowWiring<Route extends string> = {
|
|
|
45
29
|
* @param httpWiring - HTTP wiring definition with handler, method, and optional middleware
|
|
46
30
|
*/
|
|
47
31
|
export const wireHTTP = <In, Out, Route extends string>(
|
|
48
|
-
httpWiring:
|
|
32
|
+
httpWiring: HTTPWiring<In, Out, Route> & AssertHTTPWiringParams<In, Route>
|
|
49
33
|
) => {
|
|
50
34
|
wireHTTPCore(httpWiring as any)
|
|
51
35
|
}
|
|
@@ -101,5 +85,66 @@ export const addHTTPPermission = <In = unknown>(
|
|
|
101
85
|
) => {
|
|
102
86
|
addHTTPPermissionCore(pattern, permissions as any)
|
|
103
87
|
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Route configuration for wireHTTPRoutes with proper typing
|
|
91
|
+
*/
|
|
92
|
+
type HTTPRouteConfig = HTTPRouteBaseConfig & {
|
|
93
|
+
method: HTTPMethod
|
|
94
|
+
route: string
|
|
95
|
+
func: PikkuFunctionConfig<any, any, any, any, any, any>
|
|
96
|
+
auth?: boolean
|
|
97
|
+
permissions?: Record<string, PikkuPermission | PikkuPermission[]>
|
|
98
|
+
middleware?: PikkuMiddleware[]
|
|
99
|
+
sse?: boolean
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Typed route map for wireHTTPRoutes
|
|
104
|
+
*/
|
|
105
|
+
type TypedHTTPRouteMap = {
|
|
106
|
+
[key: string]: HTTPRouteConfig | TypedHTTPRouteMap | TypedHTTPRouteContract
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Typed route contract for defineHTTPRoutes
|
|
111
|
+
*/
|
|
112
|
+
type TypedHTTPRouteContract<T extends TypedHTTPRouteMap = TypedHTTPRouteMap> = TypedHTTPRoutesGroupConfig & {
|
|
113
|
+
routes: T
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Group config with typed middleware/permissions
|
|
118
|
+
*/
|
|
119
|
+
type TypedHTTPRoutesGroupConfig = {
|
|
120
|
+
basePath?: string
|
|
121
|
+
tags?: string[]
|
|
122
|
+
auth?: boolean
|
|
123
|
+
middleware?: PikkuMiddleware[]
|
|
124
|
+
permissions?: Record<string, PikkuPermission | PikkuPermission[]>
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Full config for wireHTTPRoutes
|
|
129
|
+
*/
|
|
130
|
+
type TypedWireHTTPRoutesConfig = TypedHTTPRoutesGroupConfig & {
|
|
131
|
+
routes: TypedHTTPRouteMap | HTTPRouteConfig[]
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Type-safe helper for defining route contracts that can be composed.
|
|
136
|
+
*/
|
|
137
|
+
export function defineHTTPRoutes<T extends TypedHTTPRouteMap>(routes: T): TypedHTTPRouteContract<T>
|
|
138
|
+
export function defineHTTPRoutes<T extends TypedHTTPRouteMap>(config: TypedHTTPRoutesGroupConfig & { routes: T }): TypedHTTPRouteContract<T>
|
|
139
|
+
export function defineHTTPRoutes<T extends TypedHTTPRouteMap>(configOrRoutes: T | (TypedHTTPRoutesGroupConfig & { routes: T })): TypedHTTPRouteContract<T> {
|
|
140
|
+
return defineHTTPRoutesCore(configOrRoutes as any) as unknown as TypedHTTPRouteContract<T>
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Wires multiple HTTP routes from a nested map or array configuration.
|
|
145
|
+
*/
|
|
146
|
+
export const wireHTTPRoutes = (config: TypedWireHTTPRoutesConfig): void => {
|
|
147
|
+
wireHTTPRoutesCore(config as any)
|
|
148
|
+
}
|
|
104
149
|
`;
|
|
105
150
|
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { HTTPWiringsMeta } from '@pikku/core/http';
|
|
2
2
|
import { MetaInputTypes, TypesMap } from '@pikku/inspector';
|
|
3
|
-
import {
|
|
4
|
-
export declare const serializeTypedHTTPWiringsMap: (relativeToPath: string, packageMappings: Record<string, string>, typesMap: TypesMap,
|
|
3
|
+
import { Logger } from '@pikku/core/services';
|
|
4
|
+
export declare const serializeTypedHTTPWiringsMap: (logger: Logger, relativeToPath: string, packageMappings: Record<string, string>, typesMap: TypesMap, wiringsMeta: HTTPWiringsMeta, metaTypes: MetaInputTypes, resolvedIOTypes: Record<string, {
|
|
5
|
+
inputType: string;
|
|
6
|
+
outputType: string;
|
|
7
|
+
}>, rpcInternalMapDeclarationFile: string) => string;
|
|
@@ -1,17 +1,34 @@
|
|
|
1
1
|
import { serializeImportMap } from '../../../utils/serialize-import-map.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js';
|
|
3
|
+
import { generateCustomTypes } from '@pikku/inspector';
|
|
4
|
+
export const serializeTypedHTTPWiringsMap = (logger, relativeToPath, packageMappings, typesMap, wiringsMeta, metaTypes, resolvedIOTypes, rpcInternalMapDeclarationFile) => {
|
|
4
5
|
const requiredTypes = new Set();
|
|
5
6
|
const serializedCustomTypes = generateCustomTypes(typesMap, requiredTypes);
|
|
6
|
-
const serializedMetaTypes = generateMetaTypes(metaTypes, typesMap);
|
|
7
|
-
const serializedHTTPWirings = generateHTTPWirings(wiringsMeta,
|
|
8
|
-
const
|
|
7
|
+
const serializedMetaTypes = generateMetaTypes(metaTypes, typesMap, requiredTypes);
|
|
8
|
+
const serializedHTTPWirings = generateHTTPWirings(wiringsMeta, resolvedIOTypes, requiredTypes);
|
|
9
|
+
const needsFlattenedRPCMap = Array.from(requiredTypes).some((t) => t.includes('FlattenedRPCMap'));
|
|
10
|
+
if (needsFlattenedRPCMap) {
|
|
11
|
+
for (const t of Array.from(requiredTypes)) {
|
|
12
|
+
if (t.includes('FlattenedRPCMap')) {
|
|
13
|
+
requiredTypes.delete(t);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const serializedImportMap = serializeImportMap(logger, relativeToPath, packageMappings, typesMap, requiredTypes);
|
|
18
|
+
const rpcMapImport = needsFlattenedRPCMap
|
|
19
|
+
? `import type { FlattenedRPCMap } from '${getFileImportRelativePath(relativeToPath, rpcInternalMapDeclarationFile, packageMappings)}'`
|
|
20
|
+
: '';
|
|
21
|
+
const serializedCustomTypesDeclarationsOnly = serializedCustomTypes
|
|
22
|
+
.split('\n')
|
|
23
|
+
.filter((line) => !line.startsWith('import '))
|
|
24
|
+
.join('\n');
|
|
9
25
|
return `/**
|
|
10
26
|
* This provides the structure needed for typescript to be aware of routes and their return types
|
|
11
27
|
*/
|
|
12
28
|
|
|
13
29
|
${serializedImportMap}
|
|
14
|
-
${
|
|
30
|
+
${rpcMapImport}
|
|
31
|
+
${serializedCustomTypesDeclarationsOnly}
|
|
15
32
|
${serializedMetaTypes}
|
|
16
33
|
|
|
17
34
|
interface HTTPWiringHandler<I, O> {
|
|
@@ -31,52 +48,21 @@ export type HTTPWiringsWithMethod<Method extends string> = {
|
|
|
31
48
|
}[keyof HTTPWiringsMap];
|
|
32
49
|
`;
|
|
33
50
|
};
|
|
34
|
-
function generateHTTPWirings(routesMeta,
|
|
35
|
-
// Initialize an object to collect routes
|
|
51
|
+
function generateHTTPWirings(routesMeta, resolvedIOTypes, requiredTypes) {
|
|
36
52
|
const routesObj = {};
|
|
37
53
|
for (const methods of Object.values(routesMeta)) {
|
|
38
54
|
for (const meta of Object.values(methods)) {
|
|
39
|
-
const { route, method,
|
|
40
|
-
// Skip workflow-triggered routes (they don't have a function)
|
|
41
|
-
if (meta.workflow) {
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
const functionMeta = functionsMeta[pikkuFuncName];
|
|
45
|
-
if (!functionMeta) {
|
|
46
|
-
throw new Error(`Function ${pikkuFuncName} not found in functionsMeta. Please check your configuration.`);
|
|
47
|
-
}
|
|
48
|
-
const input = functionMeta.inputs ? functionMeta.inputs[0] : undefined;
|
|
49
|
-
const output = functionMeta.outputs ? functionMeta.outputs[0] : undefined;
|
|
55
|
+
const { route, method, pikkuFuncId } = meta;
|
|
50
56
|
if (!routesObj[route]) {
|
|
51
57
|
routesObj[route] = {};
|
|
52
58
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
try {
|
|
57
|
-
inputType = typesMap.getTypeMeta(input).uniqueName;
|
|
58
|
-
}
|
|
59
|
-
catch {
|
|
60
|
-
inputType = input;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
let outputType = 'null';
|
|
64
|
-
if (output) {
|
|
65
|
-
try {
|
|
66
|
-
outputType = typesMap.getTypeMeta(output).uniqueName;
|
|
67
|
-
}
|
|
68
|
-
catch {
|
|
69
|
-
// Zod-derived schema - use the schema name directly
|
|
70
|
-
outputType = output;
|
|
71
|
-
}
|
|
59
|
+
const resolved = resolvedIOTypes[pikkuFuncId];
|
|
60
|
+
if (!resolved) {
|
|
61
|
+
throw new Error(`Function ${pikkuFuncId} not found in resolvedIOTypes. Please check your configuration.`);
|
|
72
62
|
}
|
|
73
|
-
requiredTypes.add(inputType);
|
|
74
|
-
requiredTypes.add(outputType);
|
|
75
|
-
|
|
76
|
-
routesObj[route][method] = {
|
|
77
|
-
inputType,
|
|
78
|
-
outputType,
|
|
79
|
-
};
|
|
63
|
+
requiredTypes.add(resolved.inputType);
|
|
64
|
+
requiredTypes.add(resolved.outputType);
|
|
65
|
+
routesObj[route][method] = resolved;
|
|
80
66
|
}
|
|
81
67
|
}
|
|
82
68
|
// Build the routes object as a string
|
|
@@ -91,7 +77,7 @@ function generateHTTPWirings(routesMeta, functionsMeta, typesMap, requiredTypes)
|
|
|
91
77
|
routesStr += '};';
|
|
92
78
|
return routesStr;
|
|
93
79
|
}
|
|
94
|
-
const generateMetaTypes = (metaTypes, typesMap) => {
|
|
80
|
+
const generateMetaTypes = (metaTypes, typesMap, requiredTypes) => {
|
|
95
81
|
const nameToTypeMap = Array.from(metaTypes.entries()).reduce((result, [_name, { query, body, params }]) => {
|
|
96
82
|
let uniqueName;
|
|
97
83
|
try {
|
|
@@ -101,6 +87,7 @@ const generateMetaTypes = (metaTypes, typesMap) => {
|
|
|
101
87
|
// Zod-derived schema - use the name directly
|
|
102
88
|
uniqueName = _name;
|
|
103
89
|
}
|
|
90
|
+
requiredTypes.add(uniqueName);
|
|
104
91
|
const queryType = query && query.length > 0
|
|
105
92
|
? `Pick<${uniqueName}, '${query?.join("' | '")}'>`
|
|
106
93
|
: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const pikkuMCPJSON:
|
|
1
|
+
export declare const pikkuMCPJSON: 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>;
|