@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,134 +0,0 @@
|
|
|
1
|
-
import type { QueueWorkersMeta } from '@pikku/core/queue'
|
|
2
|
-
import { serializeImportMap } from '../../../utils/serialize-import-map.js'
|
|
3
|
-
import { TypesMap } from '@pikku/inspector'
|
|
4
|
-
import { FunctionsMeta } from '@pikku/core'
|
|
5
|
-
import { generateCustomTypes } from '../../../utils/custom-types-generator.js'
|
|
6
|
-
|
|
7
|
-
export const serializeQueueMap = (
|
|
8
|
-
relativeToPath: string,
|
|
9
|
-
packageMappings: Record<string, string>,
|
|
10
|
-
typesMap: TypesMap,
|
|
11
|
-
functionsMeta: FunctionsMeta,
|
|
12
|
-
queueWorkersMeta: QueueWorkersMeta
|
|
13
|
-
) => {
|
|
14
|
-
const requiredTypes = new Set<string>()
|
|
15
|
-
const serializedCustomTypes = generateCustomTypes(typesMap, requiredTypes)
|
|
16
|
-
const serializedQueues = generateQueues(
|
|
17
|
-
queueWorkersMeta,
|
|
18
|
-
functionsMeta,
|
|
19
|
-
typesMap,
|
|
20
|
-
requiredTypes
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
const serializedImportMap = serializeImportMap(
|
|
24
|
-
relativeToPath,
|
|
25
|
-
packageMappings,
|
|
26
|
-
typesMap,
|
|
27
|
-
requiredTypes
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
return `/**
|
|
31
|
-
* This provides the structure needed for typescript to be aware of Queue workers and their input/output types
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
${serializedImportMap}
|
|
35
|
-
${serializedCustomTypes}
|
|
36
|
-
|
|
37
|
-
import type { QueueJob } from '@pikku/core/queue'
|
|
38
|
-
|
|
39
|
-
interface QueueHandler<I, O> {
|
|
40
|
-
input: I;
|
|
41
|
-
output: O;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
${serializedQueues}
|
|
45
|
-
|
|
46
|
-
type QueueAdd = <Name extends keyof QueueMap>(
|
|
47
|
-
name: Name,
|
|
48
|
-
data: QueueMap[Name]['input'],
|
|
49
|
-
options?: {
|
|
50
|
-
priority?: number
|
|
51
|
-
delay?: number
|
|
52
|
-
attempts?: number
|
|
53
|
-
removeOnComplete?: number
|
|
54
|
-
removeOnFail?: number
|
|
55
|
-
jobId?: string
|
|
56
|
-
}
|
|
57
|
-
) => Promise<string>
|
|
58
|
-
|
|
59
|
-
type QueueGetJob = <Name extends keyof QueueMap>(
|
|
60
|
-
name: Name,
|
|
61
|
-
jobId: string
|
|
62
|
-
) => Promise<QueueJob<QueueMap[Name]['input'], QueueMap[Name]['output']> | null>
|
|
63
|
-
|
|
64
|
-
export type TypedPikkuQueue = {
|
|
65
|
-
add: QueueAdd;
|
|
66
|
-
getJob: QueueGetJob;
|
|
67
|
-
}
|
|
68
|
-
`
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function generateQueues(
|
|
72
|
-
queueWorkersMeta: QueueWorkersMeta,
|
|
73
|
-
functionsMeta: FunctionsMeta,
|
|
74
|
-
typesMap: TypesMap,
|
|
75
|
-
requiredTypes: Set<string>
|
|
76
|
-
) {
|
|
77
|
-
// Initialize an object to collect queues
|
|
78
|
-
const queuesObj: Record<string, { inputType: string; outputType: string }> =
|
|
79
|
-
{}
|
|
80
|
-
|
|
81
|
-
// Iterate through Queue metadata
|
|
82
|
-
for (const [queueName, { pikkuFuncName }] of Object.entries(
|
|
83
|
-
queueWorkersMeta
|
|
84
|
-
)) {
|
|
85
|
-
const functionMeta = functionsMeta[pikkuFuncName]
|
|
86
|
-
if (!functionMeta) {
|
|
87
|
-
throw new Error(
|
|
88
|
-
`Function ${queueName} not found in functionsMeta. Please check your configuration.`
|
|
89
|
-
)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const input = functionMeta.inputs ? functionMeta.inputs[0] : undefined
|
|
93
|
-
const output = functionMeta.outputs ? functionMeta.outputs[0] : undefined
|
|
94
|
-
|
|
95
|
-
// Store the input and output types for QueueHandler
|
|
96
|
-
// For zod-derived schemas, the type might not be in typesMap, so use the schema name directly
|
|
97
|
-
let inputType = 'null'
|
|
98
|
-
if (input) {
|
|
99
|
-
try {
|
|
100
|
-
inputType = typesMap.getTypeMeta(input).uniqueName
|
|
101
|
-
} catch {
|
|
102
|
-
inputType = input
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
let outputType = 'null'
|
|
106
|
-
if (output) {
|
|
107
|
-
try {
|
|
108
|
-
outputType = typesMap.getTypeMeta(output).uniqueName
|
|
109
|
-
} catch {
|
|
110
|
-
outputType = output
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
requiredTypes.add(inputType)
|
|
115
|
-
requiredTypes.add(outputType)
|
|
116
|
-
|
|
117
|
-
// Add Queue entry
|
|
118
|
-
queuesObj[queueName] = {
|
|
119
|
-
inputType,
|
|
120
|
-
outputType,
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Build the Queues object as a string
|
|
125
|
-
let queuesStr = 'export type QueueMap = {\n'
|
|
126
|
-
|
|
127
|
-
for (const [queueName, handler] of Object.entries(queuesObj)) {
|
|
128
|
-
queuesStr += ` readonly '${queueName}': QueueHandler<${handler.inputType}, ${handler.outputType}>,\n`
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
queuesStr += '};\n'
|
|
132
|
-
|
|
133
|
-
return queuesStr
|
|
134
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { QueueWorkersMeta } from '@pikku/core/queue'
|
|
2
|
-
|
|
3
|
-
export const serializeQueueMeta = (queueWorkersMeta: QueueWorkersMeta) => {
|
|
4
|
-
return queueWorkersMeta
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const serializeQueueMetaTS = (
|
|
8
|
-
jsonImportPath: string,
|
|
9
|
-
supportsImportAttributes: boolean
|
|
10
|
-
) => {
|
|
11
|
-
const importStatement = supportsImportAttributes
|
|
12
|
-
? `import metaData from '${jsonImportPath}' with { type: 'json' }`
|
|
13
|
-
: `import metaData from '${jsonImportPath}'`
|
|
14
|
-
|
|
15
|
-
const serializedOutput: string[] = []
|
|
16
|
-
serializedOutput.push("import { pikkuState } from '@pikku/core'")
|
|
17
|
-
serializedOutput.push("import { QueueWorkersMeta } from '@pikku/core/queue'")
|
|
18
|
-
serializedOutput.push(importStatement)
|
|
19
|
-
serializedOutput.push('')
|
|
20
|
-
serializedOutput.push(
|
|
21
|
-
"pikkuState(null, 'queue', 'meta', metaData as QueueWorkersMeta)"
|
|
22
|
-
)
|
|
23
|
-
return serializedOutput.join('\n')
|
|
24
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates type definitions for queue wirings
|
|
3
|
-
*/
|
|
4
|
-
export const serializeQueueTypes = (functionTypesImportPath: string) => {
|
|
5
|
-
return `/**
|
|
6
|
-
* Queue-specific type definitions for tree-shaking optimization
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { CoreQueueWorker, wireQueueWorker as wireQueueWorkerCore } from '@pikku/core/queue'
|
|
10
|
-
import type { PikkuFunctionConfig } from '${functionTypesImportPath}'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Type definition for queue workers that process background jobs.
|
|
14
|
-
*
|
|
15
|
-
* @template In - Input type for the queue job
|
|
16
|
-
* @template Out - Output type for the queue job
|
|
17
|
-
*/
|
|
18
|
-
type QueueWiring<In, Out> = CoreQueueWorker<PikkuFunctionConfig<In, Out, 'session' | 'rpc'>>
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Registers a queue worker with the Pikku framework.
|
|
22
|
-
* Workers process background jobs from queues.
|
|
23
|
-
*
|
|
24
|
-
* @param queueWorker - Queue worker definition with job handler
|
|
25
|
-
*/
|
|
26
|
-
export const wireQueueWorker = (queueWorker: QueueWiring<any, any>) => {
|
|
27
|
-
wireQueueWorkerCore(queueWorker as any) // TODO
|
|
28
|
-
}
|
|
29
|
-
`
|
|
30
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export const serializeQueueWrapper = (queueMapPath: string) => {
|
|
2
|
-
return `
|
|
3
|
-
import type { QueueService, QueueJob } from '@pikku/core/queue'
|
|
4
|
-
import type { QueueMap, TypedPikkuQueue } from '${queueMapPath}'
|
|
5
|
-
|
|
6
|
-
export class PikkuQueue implements TypedPikkuQueue {
|
|
7
|
-
constructor(private queueService: QueueService) {}
|
|
8
|
-
|
|
9
|
-
public async add<Name extends keyof QueueMap>(
|
|
10
|
-
queueName: Name,
|
|
11
|
-
data: QueueMap[Name]['input'],
|
|
12
|
-
options?: {
|
|
13
|
-
priority?: number
|
|
14
|
-
delay?: number
|
|
15
|
-
attempts?: number
|
|
16
|
-
removeOnComplete?: number
|
|
17
|
-
removeOnFail?: number
|
|
18
|
-
jobId?: string
|
|
19
|
-
}
|
|
20
|
-
): Promise<string> {
|
|
21
|
-
return this.queueService.add(queueName as string, data, options);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public async getJob<Name extends keyof QueueMap>(
|
|
25
|
-
queueName: Name,
|
|
26
|
-
jobId: string
|
|
27
|
-
): Promise<QueueJob<QueueMap[Name]['input'], QueueMap[Name]['output']> | null> {
|
|
28
|
-
return this.queueService.getJob<QueueMap[Name]['input'], QueueMap[Name]['output']>(
|
|
29
|
-
queueName as string,
|
|
30
|
-
jobId
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
`
|
|
35
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
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 { serializePublicRPC } from './serialize-public-rpc.js'
|
|
6
|
-
import { join } from 'path'
|
|
7
|
-
|
|
8
|
-
export const pikkuPublicRPC: any = pikkuSessionlessFunc<void, boolean>({
|
|
9
|
-
func: async ({ logger, config }) => {
|
|
10
|
-
if (config.rpc?.publicRpcPath) {
|
|
11
|
-
const publicRpcPath = join(config.rootDir, config.rpc.publicRpcPath)
|
|
12
|
-
const pathToPikkuTypes = getFileImportRelativePath(
|
|
13
|
-
publicRpcPath,
|
|
14
|
-
config.typesDeclarationFile,
|
|
15
|
-
config.packageMappings
|
|
16
|
-
)
|
|
17
|
-
await writeFileInDir(
|
|
18
|
-
logger,
|
|
19
|
-
publicRpcPath,
|
|
20
|
-
serializePublicRPC(pathToPikkuTypes)
|
|
21
|
-
)
|
|
22
|
-
return true
|
|
23
|
-
}
|
|
24
|
-
return false
|
|
25
|
-
},
|
|
26
|
-
middleware: [
|
|
27
|
-
logCommandInfoAndTime({
|
|
28
|
-
commandStart: 'Generating Public RPC Endpoint',
|
|
29
|
-
commandEnd: 'Generated Public RPC Endpoint',
|
|
30
|
-
}),
|
|
31
|
-
],
|
|
32
|
-
})
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
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 { serializeRemoteRPC } from './serialize-remote-rpc.js'
|
|
6
|
-
import { join } from 'path'
|
|
7
|
-
|
|
8
|
-
export const pikkuRemoteRPC: any = pikkuSessionlessFunc<void, boolean>({
|
|
9
|
-
func: async ({ logger, config }) => {
|
|
10
|
-
if (config.rpc?.remoteRpcWorkersPath) {
|
|
11
|
-
const remoteRpcPath = join(
|
|
12
|
-
config.rootDir,
|
|
13
|
-
config.rpc.remoteRpcWorkersPath
|
|
14
|
-
)
|
|
15
|
-
const pathToPikkuTypes = getFileImportRelativePath(
|
|
16
|
-
remoteRpcPath,
|
|
17
|
-
config.typesDeclarationFile,
|
|
18
|
-
config.packageMappings
|
|
19
|
-
)
|
|
20
|
-
await writeFileInDir(
|
|
21
|
-
logger,
|
|
22
|
-
remoteRpcPath,
|
|
23
|
-
serializeRemoteRPC(pathToPikkuTypes)
|
|
24
|
-
)
|
|
25
|
-
return true
|
|
26
|
-
}
|
|
27
|
-
return false
|
|
28
|
-
},
|
|
29
|
-
middleware: [
|
|
30
|
-
logCommandInfoAndTime({
|
|
31
|
-
commandStart: 'Generating Remote RPC Workers',
|
|
32
|
-
commandEnd: 'Generated Remote RPC Workers',
|
|
33
|
-
}),
|
|
34
|
-
],
|
|
35
|
-
})
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
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 { serializeRPCWrapper } from './serialize-rpc-wrapper.js'
|
|
6
|
-
|
|
7
|
-
export const pikkuRPCClient: any = pikkuSessionlessFunc<void, void>({
|
|
8
|
-
func: async ({ logger, config }) => {
|
|
9
|
-
const { rpcWiringsFile, rpcMapDeclarationFile, packageMappings } = config
|
|
10
|
-
|
|
11
|
-
// If rpcWiringsFile is not set, clean up any existing file and return
|
|
12
|
-
if (!rpcWiringsFile) {
|
|
13
|
-
logger.info({
|
|
14
|
-
message:
|
|
15
|
-
"Skipping generating RPC wrappers since rpcWiringsFile isn't set in the pikku config.",
|
|
16
|
-
type: 'skip',
|
|
17
|
-
})
|
|
18
|
-
return
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const rpcMapDeclarationPath = getFileImportRelativePath(
|
|
22
|
-
rpcWiringsFile,
|
|
23
|
-
rpcMapDeclarationFile,
|
|
24
|
-
packageMappings
|
|
25
|
-
)
|
|
26
|
-
const content = [serializeRPCWrapper(rpcMapDeclarationPath)]
|
|
27
|
-
await writeFileInDir(logger, rpcWiringsFile, content.join('\n'))
|
|
28
|
-
},
|
|
29
|
-
middleware: [
|
|
30
|
-
logCommandInfoAndTime({
|
|
31
|
-
commandStart: 'Generating RPC wrappers',
|
|
32
|
-
commandEnd: 'Generated RPC wrappers',
|
|
33
|
-
}),
|
|
34
|
-
],
|
|
35
|
-
})
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
2
|
-
import { writeFileInDir } from '../../../utils/file-writer.js'
|
|
3
|
-
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js'
|
|
4
|
-
import { serializeTypedRPCMap } from './serialize-typed-rpc-map.js'
|
|
5
|
-
|
|
6
|
-
export const pikkuRPCInternalMap: any = pikkuSessionlessFunc<void, void>({
|
|
7
|
-
func: async ({ logger, config, getInspectorState }) => {
|
|
8
|
-
const { functions, rpc } = await getInspectorState()
|
|
9
|
-
const { rpcInternalMapDeclarationFile, packageMappings, externalPackages } =
|
|
10
|
-
config
|
|
11
|
-
|
|
12
|
-
const content = serializeTypedRPCMap(
|
|
13
|
-
rpcInternalMapDeclarationFile,
|
|
14
|
-
packageMappings,
|
|
15
|
-
functions.typesMap,
|
|
16
|
-
functions.meta,
|
|
17
|
-
rpc.internalMeta,
|
|
18
|
-
externalPackages
|
|
19
|
-
)
|
|
20
|
-
await writeFileInDir(logger, rpcInternalMapDeclarationFile, content)
|
|
21
|
-
},
|
|
22
|
-
middleware: [
|
|
23
|
-
logCommandInfoAndTime({
|
|
24
|
-
commandStart: 'Creating RPC internal map',
|
|
25
|
-
commandEnd: 'Created RPC internal map',
|
|
26
|
-
}),
|
|
27
|
-
],
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
export const pikkuRPCExposedMap: any = pikkuSessionlessFunc<void, void>({
|
|
31
|
-
func: async ({ logger, config, getInspectorState }) => {
|
|
32
|
-
const { functions, rpc } = await getInspectorState()
|
|
33
|
-
const { rpcMapDeclarationFile, packageMappings, externalPackages } = config
|
|
34
|
-
|
|
35
|
-
const content = serializeTypedRPCMap(
|
|
36
|
-
rpcMapDeclarationFile,
|
|
37
|
-
packageMappings,
|
|
38
|
-
functions.typesMap,
|
|
39
|
-
functions.meta,
|
|
40
|
-
rpc.exposedMeta,
|
|
41
|
-
externalPackages
|
|
42
|
-
)
|
|
43
|
-
await writeFileInDir(logger, rpcMapDeclarationFile, content)
|
|
44
|
-
},
|
|
45
|
-
middleware: [
|
|
46
|
-
logCommandInfoAndTime({
|
|
47
|
-
commandStart: 'Creating RPC external map',
|
|
48
|
-
commandEnd: 'Created RPC external map',
|
|
49
|
-
}),
|
|
50
|
-
],
|
|
51
|
-
})
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
2
|
-
import { writeFileInDir } from '../../../utils/file-writer.js'
|
|
3
|
-
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js'
|
|
4
|
-
import { getFileImportRelativePath } from '../../../utils/file-import-path.js'
|
|
5
|
-
|
|
6
|
-
export const pikkuRPC: any = pikkuSessionlessFunc<void, boolean>({
|
|
7
|
-
func: async ({ logger, config, getInspectorState }) => {
|
|
8
|
-
const { rpc } = await getInspectorState()
|
|
9
|
-
const {
|
|
10
|
-
rpcInternalWiringMetaFile,
|
|
11
|
-
rpcInternalWiringMetaJsonFile,
|
|
12
|
-
packageMappings,
|
|
13
|
-
schema,
|
|
14
|
-
} = config
|
|
15
|
-
|
|
16
|
-
if (rpc.internalFiles.size > 0) {
|
|
17
|
-
await writeFileInDir(
|
|
18
|
-
logger,
|
|
19
|
-
rpcInternalWiringMetaJsonFile,
|
|
20
|
-
JSON.stringify(rpc.internalMeta, null, 2)
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
const jsonImportPath = getFileImportRelativePath(
|
|
24
|
-
rpcInternalWiringMetaFile,
|
|
25
|
-
rpcInternalWiringMetaJsonFile,
|
|
26
|
-
packageMappings
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
const supportsImportAttributes = schema?.supportsImportAttributes ?? false
|
|
30
|
-
const importStatement = supportsImportAttributes
|
|
31
|
-
? `import metaData from '${jsonImportPath}' with { type: 'json' }`
|
|
32
|
-
: `import metaData from '${jsonImportPath}'`
|
|
33
|
-
|
|
34
|
-
await writeFileInDir(
|
|
35
|
-
logger,
|
|
36
|
-
rpcInternalWiringMetaFile,
|
|
37
|
-
`import { pikkuState } from '@pikku/core'\n${importStatement}\npikkuState(null, 'rpc', 'meta', metaData as Record<string, string>)`
|
|
38
|
-
)
|
|
39
|
-
return true
|
|
40
|
-
}
|
|
41
|
-
return false
|
|
42
|
-
},
|
|
43
|
-
middleware: [
|
|
44
|
-
logCommandInfoAndTime({
|
|
45
|
-
commandStart: 'Finding RPCs tasks',
|
|
46
|
-
commandEnd: 'Found RPCs',
|
|
47
|
-
}),
|
|
48
|
-
],
|
|
49
|
-
})
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generate public RPC HTTP endpoint
|
|
3
|
-
*/
|
|
4
|
-
export const serializePublicRPC = (pathToPikkuTypes: string) => {
|
|
5
|
-
return `/**
|
|
6
|
-
* Auto-generated public RPC HTTP endpoint
|
|
7
|
-
* Do not edit manually - regenerate with 'npx pikku'
|
|
8
|
-
*/
|
|
9
|
-
import { pikkuSessionlessFunc, wireHTTP } from '${pathToPikkuTypes}'
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Public RPC endpoint that invokes any exposed RPC by name
|
|
13
|
-
* This is used for public HTTP access to exposed server functions
|
|
14
|
-
*/
|
|
15
|
-
export const rpcCaller = pikkuSessionlessFunc<
|
|
16
|
-
{ rpcName: string, data?: any },
|
|
17
|
-
any
|
|
18
|
-
>({
|
|
19
|
-
func: async (services, { rpcName, data }, { rpc }) => {
|
|
20
|
-
return await (rpc.invokeExposed as any)(rpcName, data)
|
|
21
|
-
},
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
wireHTTP({
|
|
25
|
-
route: "/rpc/:rpcName",
|
|
26
|
-
method: "options",
|
|
27
|
-
auth: false,
|
|
28
|
-
func: pikkuSessionlessFunc<{ rpcName: string }>(async () => void 0),
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
wireHTTP({
|
|
32
|
-
route: '/rpc/:rpcName',
|
|
33
|
-
method: 'post',
|
|
34
|
-
func: rpcCaller,
|
|
35
|
-
})
|
|
36
|
-
`
|
|
37
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generate remote internal RPC queue worker and HTTP endpoint
|
|
3
|
-
*/
|
|
4
|
-
export const serializeRemoteRPC = (pathToPikkuTypes: string) => {
|
|
5
|
-
return `/**
|
|
6
|
-
* Auto-generated remote internal RPC queue worker and HTTP endpoint
|
|
7
|
-
* Do not edit manually - regenerate with 'npx pikku'
|
|
8
|
-
*/
|
|
9
|
-
import { pikkuSessionlessFunc, wireQueueWorker } from '${pathToPikkuTypes}'
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Generic remote RPC worker that invokes any internal RPC by name
|
|
13
|
-
* This is used for executing internal RPCs via a queue or HTTP (e.g., scheduled tasks, background jobs, internal services)
|
|
14
|
-
*
|
|
15
|
-
* TODO: Security risk - this allows any RPC to be invoked by name. Should validate
|
|
16
|
-
* that rpcName is in an allowlist of permitted internal RPCs to prevent unauthorized access.
|
|
17
|
-
*/
|
|
18
|
-
export const pikkuRemoteInternalRPC = pikkuSessionlessFunc<
|
|
19
|
-
{ rpcName: string, data?: any },
|
|
20
|
-
any
|
|
21
|
-
>({
|
|
22
|
-
func: async (_services, { rpcName, data }, { rpc }) => {
|
|
23
|
-
return await (rpc.invoke as any)(rpcName, data)
|
|
24
|
-
},
|
|
25
|
-
internal: true,
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
wireQueueWorker({
|
|
29
|
-
queueName: 'pikku-remote-internal-rpc',
|
|
30
|
-
func: pikkuRemoteInternalRPC,
|
|
31
|
-
})
|
|
32
|
-
`
|
|
33
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
export const serializeRPCWrapper = (rpcMapPath: string) => {
|
|
2
|
-
return `
|
|
3
|
-
import { PikkuFetch } from "./pikku-fetch.gen.js"
|
|
4
|
-
import type { RPCInvoke } from '${rpcMapPath}'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* PikkuRPC provides a type-safe client for making Remote Procedure Calls (RPC)
|
|
8
|
-
* to your Pikku server. It wraps the underlying HTTP client and provides a
|
|
9
|
-
* simple interface for invoking server-side functions.
|
|
10
|
-
*/
|
|
11
|
-
export class PikkuRPC {
|
|
12
|
-
/** The underlying HTTP client used for making RPC calls */
|
|
13
|
-
pikkuFetch = new PikkuFetch()
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Sets a custom PikkuFetch instance to use for RPC calls.
|
|
17
|
-
* This allows you to configure custom settings or use a shared client instance.
|
|
18
|
-
*
|
|
19
|
-
* @param pikkuFetch - The PikkuFetch instance to use
|
|
20
|
-
*/
|
|
21
|
-
setPikkuFetch(pikkuFetch: PikkuFetch): void {
|
|
22
|
-
this.pikkuFetch = pikkuFetch
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Sets the base server URL for all RPC calls.
|
|
27
|
-
*
|
|
28
|
-
* @param serverUrl - The base URL of your Pikku server (e.g., 'https://api.example.com')
|
|
29
|
-
*/
|
|
30
|
-
setServerUrl(serverUrl: string): void {
|
|
31
|
-
this.pikkuFetch.setServerUrl(serverUrl)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Sets the JWT token for authorization on all RPC calls.
|
|
36
|
-
*
|
|
37
|
-
* @param jwt - The JWT token to use for authorization, or null to remove authorization
|
|
38
|
-
*/
|
|
39
|
-
setAuthorizationJWT(jwt: string | null): void {
|
|
40
|
-
this.pikkuFetch.setAuthorizationJWT(jwt)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Sets the API key for authorization on all RPC calls.
|
|
45
|
-
*
|
|
46
|
-
* @param apiKey - The API key to use for authorization, or null to remove the API key
|
|
47
|
-
*/
|
|
48
|
-
setAPIKey(apiKey: string | null): void {
|
|
49
|
-
this.pikkuFetch.setAPIKey(apiKey)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Invokes a remote procedure call on the server.
|
|
54
|
-
* This is a generic method that routes to the appropriate server function
|
|
55
|
-
* based on the function name and passes the provided data.
|
|
56
|
-
*
|
|
57
|
-
* @param rpcName - The name of the server function to invoke
|
|
58
|
-
* @param data - The data to pass to the server function
|
|
59
|
-
* @returns A promise that resolves with the function's return value
|
|
60
|
-
*/
|
|
61
|
-
invoke: RPCInvoke = async (rpcName, data) => {
|
|
62
|
-
return await this.pikkuFetch.post(\`/rpc/\${rpcName}\` as any, { rpcName: String(rpcName), data }) as any
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export const pikkuRPC = new PikkuRPC();
|
|
67
|
-
`
|
|
68
|
-
}
|