@pikku/cli 0.9.15 → 0.10.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/.pikku/channel/pikku-channel-types.gen.ts +91 -0
- package/.pikku/channel/pikku-channels-map.gen.d.ts +44 -0
- package/.pikku/channel/pikku-channels-meta.gen.ts +5 -0
- package/.pikku/channel/pikku-channels.gen.ts +4 -0
- package/.pikku/cli/pikku-cli-channel.gen.ts +34 -0
- package/.pikku/cli/pikku-cli-client.gen.ts +43 -0
- package/.pikku/cli/pikku-cli-types.gen.ts +70 -0
- package/.pikku/cli/pikku-cli-wirings-meta.gen.ts +145 -0
- package/.pikku/cli/pikku-cli-wirings.gen.ts +6 -0
- package/.pikku/cli/pikku-cli.gen.ts +41 -0
- package/.pikku/function/pikku-function-types.gen.ts +440 -0
- package/.pikku/function/pikku-functions-meta.gen.ts +845 -0
- package/.pikku/function/pikku-functions-meta.min.gen.ts +181 -0
- package/.pikku/function/pikku-functions.gen.ts +76 -0
- package/.pikku/http/pikku-http-types.gen.ts +86 -0
- package/.pikku/http/pikku-http-wirings-map.gen.d.ts +43 -0
- package/.pikku/http/pikku-http-wirings-meta.gen.ts +13 -0
- package/.pikku/http/pikku-http-wirings.gen.ts +4 -0
- package/.pikku/mcp/pikku-mcp-types.gen.ts +140 -0
- package/.pikku/mcp/pikku-mcp-wirings-meta.gen.ts +7 -0
- package/.pikku/mcp/pikku-mcp-wirings.gen.ts +4 -0
- package/.pikku/mcp/pikku-mcp.gen.json +5 -0
- package/.pikku/pikku-bootstrap.gen.ts +19 -0
- package/.pikku/pikku-services.gen.ts +20 -0
- package/.pikku/pikku-types.gen.ts +27 -0
- package/.pikku/pikku-websocket.gen.ts +76 -0
- package/.pikku/queue/pikku-queue-types.gen.ts +27 -0
- package/.pikku/queue/pikku-queue-workers-wirings-map.gen.d.ts +57 -0
- package/.pikku/queue/pikku-queue-workers-wirings-meta.gen.ts +5 -0
- package/.pikku/queue/pikku-queue-workers-wirings.gen.ts +4 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +47 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +82 -0
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +41 -0
- package/.pikku/scheduler/pikku-scheduler-types.gen.ts +25 -0
- package/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.ts +5 -0
- package/.pikku/scheduler/pikku-schedulers-wirings.gen.ts +4 -0
- package/.pikku/schemas/register.gen.ts +51 -0
- package/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuCLIOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuFunctionsOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuHTTPOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuMCPOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuMiddlewareOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuPermissionsOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuQueueOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuRPCOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuSchedulerOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -0
- package/CHANGELOG.md +15 -0
- package/bin/pikku.ts +97 -14
- package/build.sh +53 -0
- package/cli.schema.json +1 -382
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +56 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.js +52 -0
- package/dist/.pikku/channel/pikku-channels-meta.gen.js +5 -0
- package/dist/.pikku/channel/pikku-channels.gen.d.ts +4 -0
- package/dist/.pikku/channel/pikku-channels.gen.js +5 -0
- package/dist/.pikku/cli/pikku-cli-channel.gen.d.ts +1 -0
- package/dist/.pikku/cli/pikku-cli-channel.gen.js +33 -0
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +10 -0
- package/dist/.pikku/cli/pikku-cli-client.gen.js +34 -0
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +52 -0
- package/dist/.pikku/cli/pikku-cli-types.gen.js +31 -0
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +145 -0
- package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +5 -0
- package/dist/.pikku/cli/pikku-cli-wirings.gen.js +6 -0
- package/dist/.pikku/cli/pikku-cli.gen.d.ts +10 -0
- package/dist/.pikku/cli/pikku-cli.gen.js +38 -0
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +380 -0
- package/dist/.pikku/function/pikku-function-types.gen.js +271 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.d.ts +1 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.js +845 -0
- package/dist/.pikku/function/pikku-functions-meta.min.gen.d.ts +1 -0
- package/dist/.pikku/function/pikku-functions-meta.min.gen.js +181 -0
- package/dist/.pikku/function/pikku-functions.gen.d.ts +1 -0
- package/dist/.pikku/function/pikku-functions.gen.js +75 -0
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +68 -0
- package/dist/.pikku/http/pikku-http-types.gen.js +62 -0
- package/dist/.pikku/http/pikku-http-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +13 -0
- package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +4 -0
- package/dist/.pikku/http/pikku-http-wirings.gen.js +5 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +91 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +71 -0
- package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.js +7 -0
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.d.ts +4 -0
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.js +5 -0
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +19 -0
- package/dist/.pikku/pikku-bootstrap.gen.js +19 -0
- package/dist/.pikku/pikku-services.gen.d.ts +13 -0
- package/dist/.pikku/pikku-services.gen.js +5 -0
- package/dist/.pikku/pikku-types.gen.d.ts +13 -0
- package/dist/.pikku/pikku-types.gen.js +20 -0
- package/dist/.pikku/pikku-websocket.gen.d.ts +31 -0
- package/dist/.pikku/pikku-websocket.gen.js +49 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +23 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.js +16 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +5 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +4 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +5 -0
- 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 +41 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +21 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +16 -0
- package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.js +5 -0
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.d.ts +4 -0
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.js +5 -0
- package/dist/.pikku/schemas/register.gen.d.ts +1 -0
- package/dist/.pikku/schemas/register.gen.js +28 -0
- package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuCLIOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuFunctionsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuHTTPOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMCPOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMiddlewareOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuPermissionsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuQueueOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuRPCOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuSchedulerOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -0
- package/dist/bin/pikku.js +63 -14
- package/dist/src/cli.wiring.d.ts +1 -0
- package/dist/src/cli.wiring.js +99 -0
- package/dist/src/functions/commands/all.d.ts +1 -0
- package/dist/src/functions/commands/all.js +114 -0
- package/dist/src/functions/commands/watch.d.ts +1 -0
- package/dist/src/functions/commands/watch.js +47 -0
- package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.d.ts +1 -0
- package/dist/src/{runtimes → functions/runtimes}/nextjs/pikku-command-nextjs.js +33 -12
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.d.ts +1 -0
- package/dist/src/{runtimes → functions/runtimes}/nextjs/serialize-nextjs-backend-wrapper.js +2 -2
- package/dist/src/functions/wirings/channels/pikku-channels.d.ts +1 -0
- package/dist/src/functions/wirings/channels/pikku-channels.js +19 -0
- package/dist/src/functions/wirings/channels/pikku-command-channel-types.d.ts +1 -0
- package/dist/src/functions/wirings/channels/pikku-command-channel-types.js +19 -0
- package/dist/src/functions/wirings/channels/pikku-command-channels-map.d.ts +1 -0
- package/dist/src/functions/wirings/channels/pikku-command-channels-map.js +18 -0
- package/dist/src/functions/wirings/channels/pikku-command-channels.d.ts +1 -0
- package/dist/src/functions/wirings/channels/pikku-command-channels.js +20 -0
- package/dist/src/functions/wirings/channels/pikku-command-websocket-typed.d.ts +1 -0
- package/dist/src/functions/wirings/channels/pikku-command-websocket-typed.js +27 -0
- package/dist/src/functions/wirings/channels/serialize-channel-types.d.ts +4 -0
- package/dist/src/functions/wirings/channels/serialize-channel-types.js +94 -0
- package/dist/src/{wirings → functions/wirings}/channels/serialize-typed-channel-map.js +6 -3
- package/dist/src/functions/wirings/cli/pikku-command-cli-entry.d.ts +1 -0
- package/dist/src/functions/wirings/cli/pikku-command-cli-entry.js +123 -0
- package/dist/src/functions/wirings/cli/pikku-command-cli-types.d.ts +1 -0
- package/dist/src/functions/wirings/cli/pikku-command-cli-types.js +31 -0
- package/dist/src/functions/wirings/cli/pikku-command-cli.d.ts +1 -0
- package/dist/src/functions/wirings/cli/pikku-command-cli.js +22 -0
- package/dist/src/functions/wirings/cli/serialize-channel-cli-client.d.ts +11 -0
- package/dist/src/functions/wirings/cli/serialize-channel-cli-client.js +131 -0
- package/dist/src/functions/wirings/cli/serialize-channel-cli.d.ts +9 -0
- package/dist/src/functions/wirings/cli/serialize-channel-cli.js +67 -0
- package/dist/src/functions/wirings/cli/serialize-cli-types.d.ts +4 -0
- package/dist/src/functions/wirings/cli/serialize-cli-types.js +73 -0
- package/dist/src/functions/wirings/cli/serialize-local-cli-bootstrap.d.ts +14 -0
- package/dist/src/functions/wirings/cli/serialize-local-cli-bootstrap.js +51 -0
- package/dist/src/functions/wirings/fetch/index.d.ts +1 -0
- package/dist/src/functions/wirings/fetch/index.js +27 -0
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.d.ts +1 -0
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +33 -0
- package/dist/src/functions/wirings/functions/pikku-command-function-types.d.ts +1 -0
- package/dist/src/functions/wirings/functions/pikku-command-function-types.js +18 -0
- package/dist/src/functions/wirings/functions/pikku-command-functions.d.ts +1 -0
- package/dist/src/functions/wirings/functions/pikku-command-functions.js +26 -0
- package/dist/src/functions/wirings/functions/pikku-command-services.d.ts +2 -0
- package/dist/src/{wirings → functions/wirings}/functions/pikku-command-services.js +36 -29
- package/dist/src/functions/wirings/functions/pikku-function-types.d.ts +1 -0
- package/dist/src/functions/wirings/functions/pikku-function-types.js +18 -0
- package/dist/src/functions/wirings/functions/schemas.d.ts +4 -0
- package/dist/src/functions/wirings/functions/schemas.js +20 -0
- package/dist/src/{wirings → functions/wirings}/functions/serialize-function-imports.js +4 -21
- package/dist/src/functions/wirings/functions/serialize-function-types.d.ts +4 -0
- package/dist/src/functions/wirings/functions/serialize-function-types.js +443 -0
- package/dist/src/functions/wirings/functions/serialize-pikku-types-hub.d.ts +4 -0
- package/dist/src/functions/wirings/functions/serialize-pikku-types-hub.js +30 -0
- package/dist/src/{wirings → functions/wirings}/http/openapi-spec-generator.d.ts +4 -2
- package/dist/src/{wirings → functions/wirings}/http/openapi-spec-generator.js +2 -2
- package/dist/src/functions/wirings/http/pikku-command-http-map.d.ts +1 -0
- package/dist/src/functions/wirings/http/pikku-command-http-map.js +18 -0
- package/dist/src/functions/wirings/http/pikku-command-http-routes.d.ts +1 -0
- package/dist/src/functions/wirings/http/pikku-command-http-routes.js +20 -0
- package/dist/src/functions/wirings/http/pikku-command-http-types.d.ts +1 -0
- package/dist/src/functions/wirings/http/pikku-command-http-types.js +19 -0
- package/dist/src/functions/wirings/http/pikku-command-openapi.d.ts +1 -0
- package/dist/src/functions/wirings/http/pikku-command-openapi.js +37 -0
- package/dist/src/functions/wirings/http/pikku-http-routes.d.ts +1 -0
- package/dist/src/functions/wirings/http/pikku-http-routes.js +20 -0
- package/dist/src/functions/wirings/http/serialize-http-types.d.ts +4 -0
- package/dist/src/functions/wirings/http/serialize-http-types.js +89 -0
- package/dist/src/{wirings → functions/wirings}/http/serialize-typed-http-map.js +2 -2
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-json.d.ts +1 -0
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-json.js +23 -0
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-types.d.ts +1 -0
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-types.js +19 -0
- package/dist/src/functions/wirings/mcp/pikku-command-mcp.d.ts +1 -0
- package/dist/src/{wirings → functions/wirings}/mcp/pikku-command-mcp.js +17 -5
- package/dist/src/{wirings → functions/wirings}/mcp/serialize-mcp-json.d.ts +2 -2
- package/dist/src/functions/wirings/mcp/serialize-mcp-types.d.ts +4 -0
- package/dist/src/functions/wirings/mcp/serialize-mcp-types.js +143 -0
- package/dist/src/functions/wirings/middleware/pikku-command-middleware.d.ts +1 -0
- package/dist/src/functions/wirings/middleware/pikku-command-middleware.js +36 -0
- package/dist/src/functions/wirings/middleware/serialize-middleware-groups-meta.d.ts +8 -0
- package/dist/src/functions/wirings/middleware/serialize-middleware-groups-meta.js +44 -0
- package/dist/src/functions/wirings/middleware/serialize-middleware-imports.d.ts +2 -0
- package/dist/src/functions/wirings/middleware/serialize-middleware-imports.js +43 -0
- package/dist/src/functions/wirings/permissions/pikku-command-permissions.d.ts +1 -0
- package/dist/src/functions/wirings/permissions/pikku-command-permissions.js +28 -0
- package/dist/src/functions/wirings/permissions/serialize-permissions-imports.d.ts +2 -0
- package/dist/src/functions/wirings/permissions/serialize-permissions-imports.js +43 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue-map.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue-map.js +18 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue-service.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue-service.js +27 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue-types.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue-types.js +19 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue.js +21 -0
- package/dist/src/functions/wirings/queue/pikku-queue-map.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-queue-map.js +18 -0
- package/dist/src/functions/wirings/queue/pikku-queue.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-queue.js +21 -0
- package/dist/src/{wirings → functions/wirings}/queue/serialize-queue-map.js +2 -2
- package/dist/src/{wirings → functions/wirings}/queue/serialize-queue-meta.d.ts +1 -1
- package/dist/src/functions/wirings/queue/serialize-queue-types.d.ts +4 -0
- package/dist/src/functions/wirings/queue/serialize-queue-types.js +30 -0
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.d.ts +1 -0
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.js +27 -0
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.d.ts +2 -0
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.js +32 -0
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.d.ts +1 -0
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +20 -0
- package/dist/src/{wirings → functions/wirings}/rpc/serialize-typed-rpc-map.js +2 -2
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler-types.d.ts +1 -0
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler-types.js +19 -0
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.d.ts +1 -0
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.js +21 -0
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-types.d.ts +4 -0
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-types.js +28 -0
- package/dist/src/middleware/log-command-info-and-time.d.ts +13 -0
- package/dist/src/middleware/log-command-info-and-time.js +15 -0
- package/dist/src/services/cli-logger-forwarder.service.d.ts +30 -0
- package/dist/src/services/cli-logger-forwarder.service.js +64 -0
- package/dist/src/services/cli-logger.service.d.ts +23 -0
- package/dist/src/services/cli-logger.service.js +77 -0
- package/dist/src/services.d.ts +20 -0
- package/dist/src/services.js +162 -0
- package/dist/src/utils/check-required-types.d.ts +10 -0
- package/dist/src/utils/check-required-types.js +31 -0
- package/dist/src/utils/custom-types-generator.d.ts +2 -0
- package/dist/src/utils/custom-types-generator.js +43 -0
- package/dist/src/utils/file-import-path.d.ts +1 -0
- package/dist/src/utils/file-import-path.js +43 -0
- package/dist/src/utils/file-imports-serializer.d.ts +1 -0
- package/dist/src/utils/file-imports-serializer.js +13 -0
- package/dist/src/utils/file-writer.d.ts +9 -0
- package/dist/src/utils/file-writer.js +50 -0
- package/dist/src/utils/generate-bootstrap-file.d.ts +3 -0
- package/dist/src/utils/generate-bootstrap-file.js +21 -0
- package/dist/src/utils/get-cli-version.d.ts +5 -0
- package/dist/src/utils/get-cli-version.js +27 -0
- package/dist/src/utils/pikku-cli-config.d.ts +4 -0
- package/dist/src/utils/pikku-cli-config.js +224 -0
- package/dist/src/utils/pikku-files-and-methods.d.ts +21 -0
- package/dist/src/utils/pikku-files-and-methods.js +70 -0
- package/dist/src/{schema-generator.d.ts → utils/schema-generator.d.ts} +1 -1
- package/dist/src/{schema-generator.js → utils/schema-generator.js} +4 -3
- package/dist/src/{serialize-import-map.js → utils/serialize-import-map.js} +1 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -11
- package/pikku.config.json +26 -0
- package/src/cli.wiring.ts +102 -0
- package/src/functions/commands/all.ts +153 -0
- package/src/functions/commands/watch.ts +58 -0
- package/src/functions/runtimes/nextjs/pikku-command-nextjs.ts +111 -0
- package/src/{runtimes → functions/runtimes}/nextjs/serialize-nextjs-backend-wrapper.ts +2 -2
- package/src/functions/wirings/channels/pikku-channels.ts +35 -0
- package/src/functions/wirings/channels/pikku-command-channel-types.ts +25 -0
- package/src/functions/wirings/channels/pikku-command-channels-map.ts +26 -0
- package/src/functions/wirings/channels/pikku-command-channels.ts +40 -0
- package/src/functions/wirings/channels/pikku-command-websocket-typed.ts +37 -0
- package/src/functions/wirings/channels/serialize-channel-types.ts +94 -0
- package/src/{wirings → functions/wirings}/channels/serialize-typed-channel-map.ts +6 -3
- package/src/functions/wirings/cli/pikku-command-cli-entry.ts +216 -0
- package/src/functions/wirings/cli/pikku-command-cli-types.ts +48 -0
- package/src/functions/wirings/cli/pikku-command-cli.ts +39 -0
- package/src/functions/wirings/cli/serialize-channel-cli-client.ts +171 -0
- package/src/functions/wirings/cli/serialize-channel-cli.ts +102 -0
- package/src/functions/wirings/cli/serialize-cli-types.ts +79 -0
- package/src/functions/wirings/cli/serialize-local-cli-bootstrap.ts +80 -0
- package/src/functions/wirings/fetch/index.ts +36 -0
- package/src/functions/wirings/functions/pikku-command-function-types-split.ts +60 -0
- package/src/functions/wirings/functions/pikku-command-function-types.ts +43 -0
- package/src/functions/wirings/functions/pikku-command-functions.ts +59 -0
- package/src/functions/wirings/functions/pikku-command-services.ts +111 -0
- package/src/functions/wirings/functions/pikku-function-types.ts +43 -0
- package/src/functions/wirings/functions/schemas.ts +45 -0
- package/src/{wirings → functions/wirings}/functions/serialize-function-imports.ts +4 -30
- package/src/functions/wirings/functions/serialize-function-types.ts +453 -0
- package/src/functions/wirings/functions/serialize-pikku-types-hub.ts +38 -0
- package/src/{wirings → functions/wirings}/http/openapi-spec-generator.ts +5 -2
- package/src/functions/wirings/http/pikku-command-http-map.ts +27 -0
- package/src/functions/wirings/http/pikku-command-http-routes.ts +36 -0
- package/src/functions/wirings/http/pikku-command-http-types.ts +25 -0
- package/src/functions/wirings/http/pikku-command-openapi.ts +62 -0
- package/src/functions/wirings/http/pikku-http-routes.ts +35 -0
- package/src/functions/wirings/http/serialize-http-types.ts +89 -0
- package/src/{wirings → functions/wirings}/http/serialize-typed-http-map.ts +2 -2
- package/src/functions/wirings/mcp/pikku-command-mcp-json.ts +33 -0
- package/src/functions/wirings/mcp/pikku-command-mcp-types.ts +25 -0
- package/src/{wirings → functions/wirings}/mcp/pikku-command-mcp.ts +50 -46
- package/src/{wirings → functions/wirings}/mcp/serialize-mcp-json.ts +2 -2
- package/src/functions/wirings/mcp/serialize-mcp-types.ts +143 -0
- package/src/functions/wirings/middleware/pikku-command-middleware.ts +63 -0
- package/src/functions/wirings/middleware/serialize-middleware-groups-meta.ts +55 -0
- package/src/functions/wirings/middleware/serialize-middleware-imports.ts +78 -0
- package/src/functions/wirings/permissions/pikku-command-permissions.ts +49 -0
- package/src/functions/wirings/permissions/serialize-permissions-imports.test.ts +274 -0
- package/src/functions/wirings/permissions/serialize-permissions-imports.ts +78 -0
- package/src/functions/wirings/queue/pikku-command-queue-map.ts +26 -0
- package/src/functions/wirings/queue/pikku-command-queue-service.ts +37 -0
- package/src/functions/wirings/queue/pikku-command-queue-types.ts +25 -0
- package/src/functions/wirings/queue/pikku-command-queue.ts +41 -0
- package/src/functions/wirings/queue/pikku-queue-map.ts +26 -0
- package/src/functions/wirings/queue/pikku-queue.ts +41 -0
- package/src/{wirings → functions/wirings}/queue/serialize-queue-map.ts +2 -2
- package/src/{wirings → functions/wirings}/queue/serialize-queue-meta.ts +1 -1
- package/src/functions/wirings/queue/serialize-queue-types.ts +30 -0
- package/src/functions/wirings/rpc/pikku-command-rpc-client.ts +35 -0
- package/src/functions/wirings/rpc/pikku-command-rpc-map.ts +48 -0
- package/src/functions/wirings/rpc/pikku-command-rpc.ts +26 -0
- package/src/{wirings → functions/wirings}/rpc/serialize-typed-rpc-map.ts +2 -2
- package/src/functions/wirings/scheduler/pikku-command-scheduler-types.ts +25 -0
- package/src/functions/wirings/scheduler/pikku-command-scheduler.ts +41 -0
- package/src/functions/wirings/scheduler/serialize-scheduler-types.ts +28 -0
- package/src/middleware/log-command-info-and-time.ts +35 -0
- package/src/services/cli-logger-forwarder.service.ts +90 -0
- package/src/services/cli-logger.service.ts +93 -0
- package/src/services.ts +240 -0
- package/src/utils/check-required-types.ts +53 -0
- package/src/utils/custom-types-generator.ts +55 -0
- package/src/{utils.test.ts → utils/file-import-path.test.ts} +1 -1
- package/src/utils/file-import-path.ts +53 -0
- package/src/utils/file-imports-serializer.ts +25 -0
- package/src/utils/file-writer.ts +72 -0
- package/src/utils/generate-bootstrap-file.ts +43 -0
- package/src/utils/get-cli-version.ts +28 -0
- package/src/utils/pikku-cli-config.ts +327 -0
- package/src/utils/pikku-files-and-methods.ts +148 -0
- package/src/{schema-generator.ts → utils/schema-generator.ts} +10 -4
- package/src/{serialize-import-map.ts → utils/serialize-import-map.ts} +1 -5
- package/tsconfig.json +2 -2
- package/types/application-types.d.ts +23 -0
- package/types/config.d.ts +204 -0
- package/bin/pikku-all.ts +0 -349
- package/bin/pikku-fetch.ts +0 -27
- package/bin/pikku-nextjs.ts +0 -44
- package/bin/pikku-openapi.ts +0 -31
- package/bin/pikku-queue-service.ts +0 -28
- package/bin/pikku-rpc.ts +0 -28
- package/bin/pikku-schemas.ts +0 -31
- package/bin/pikku-websocket.ts +0 -28
- package/dist/bin/pikku-all.d.ts +0 -4
- package/dist/bin/pikku-all.js +0 -194
- package/dist/bin/pikku-fetch.d.ts +0 -4
- package/dist/bin/pikku-fetch.js +0 -19
- package/dist/bin/pikku-nextjs.d.ts +0 -4
- package/dist/bin/pikku-nextjs.js +0 -24
- package/dist/bin/pikku-openapi.d.ts +0 -2
- package/dist/bin/pikku-openapi.js +0 -19
- package/dist/bin/pikku-queue-service.d.ts +0 -4
- package/dist/bin/pikku-queue-service.js +0 -19
- package/dist/bin/pikku-rpc.d.ts +0 -4
- package/dist/bin/pikku-rpc.js +0 -19
- package/dist/bin/pikku-schemas.d.ts +0 -2
- package/dist/bin/pikku-schemas.js +0 -21
- package/dist/bin/pikku-websocket.d.ts +0 -4
- package/dist/bin/pikku-websocket.js +0 -19
- package/dist/src/inspector-glob.d.ts +0 -2
- package/dist/src/inspector-glob.js +0 -12
- package/dist/src/pikku-cli-config.d.ts +0 -56
- package/dist/src/pikku-cli-config.js +0 -203
- package/dist/src/pikku-command-schemas.d.ts +0 -2
- package/dist/src/pikku-command-schemas.js +0 -8
- package/dist/src/runtimes/nextjs/pikku-command-nextjs.d.ts +0 -2
- package/dist/src/runtimes/nextjs/serialize-nextjs-backend-wrapper.d.ts +0 -1
- package/dist/src/schemas.d.ts +0 -2
- package/dist/src/schemas.js +0 -8
- package/dist/src/serialize-pikku-types.d.ts +0 -4
- package/dist/src/serialize-pikku-types.js +0 -605
- package/dist/src/types.d.ts +0 -5
- package/dist/src/utils.d.ts +0 -60
- package/dist/src/utils.js +0 -248
- package/dist/src/wirings/channels/pikku-channels.d.ts +0 -2
- package/dist/src/wirings/channels/pikku-channels.js +0 -9
- package/dist/src/wirings/channels/pikku-command-channels-map.d.ts +0 -2
- package/dist/src/wirings/channels/pikku-command-channels-map.js +0 -8
- package/dist/src/wirings/channels/pikku-command-channels.d.ts +0 -2
- package/dist/src/wirings/channels/pikku-command-channels.js +0 -9
- package/dist/src/wirings/channels/pikku-command-websocket-typed.d.ts +0 -2
- package/dist/src/wirings/channels/pikku-command-websocket-typed.js +0 -15
- package/dist/src/wirings/fetch/index.d.ts +0 -2
- package/dist/src/wirings/fetch/index.js +0 -12
- package/dist/src/wirings/functions/pikku-command-function-types.d.ts +0 -2
- package/dist/src/wirings/functions/pikku-command-function-types.js +0 -13
- package/dist/src/wirings/functions/pikku-command-functions.d.ts +0 -2
- package/dist/src/wirings/functions/pikku-command-functions.js +0 -14
- package/dist/src/wirings/functions/pikku-command-services.d.ts +0 -3
- package/dist/src/wirings/functions/pikku-function-types.d.ts +0 -2
- package/dist/src/wirings/functions/pikku-function-types.js +0 -13
- package/dist/src/wirings/http/pikku-command-http-map.d.ts +0 -2
- package/dist/src/wirings/http/pikku-command-http-map.js +0 -8
- package/dist/src/wirings/http/pikku-command-http-routes.d.ts +0 -2
- package/dist/src/wirings/http/pikku-command-http-routes.js +0 -9
- package/dist/src/wirings/http/pikku-command-openapi.d.ts +0 -2
- package/dist/src/wirings/http/pikku-command-openapi.js +0 -20
- package/dist/src/wirings/http/pikku-http-routes.d.ts +0 -2
- package/dist/src/wirings/http/pikku-http-routes.js +0 -9
- package/dist/src/wirings/mcp/pikku-command-mcp-json.d.ts +0 -2
- package/dist/src/wirings/mcp/pikku-command-mcp-json.js +0 -13
- package/dist/src/wirings/mcp/pikku-command-mcp.d.ts +0 -2
- package/dist/src/wirings/queue/pikku-command-queue-map.d.ts +0 -2
- package/dist/src/wirings/queue/pikku-command-queue-map.js +0 -8
- package/dist/src/wirings/queue/pikku-command-queue-service.d.ts +0 -2
- package/dist/src/wirings/queue/pikku-command-queue-service.js +0 -15
- package/dist/src/wirings/queue/pikku-command-queue.d.ts +0 -2
- package/dist/src/wirings/queue/pikku-command-queue.js +0 -10
- package/dist/src/wirings/queue/pikku-queue-map.d.ts +0 -2
- package/dist/src/wirings/queue/pikku-queue-map.js +0 -8
- package/dist/src/wirings/queue/pikku-queue.d.ts +0 -2
- package/dist/src/wirings/queue/pikku-queue.js +0 -10
- package/dist/src/wirings/rpc/pikku-command-rpc-client.d.ts +0 -2
- package/dist/src/wirings/rpc/pikku-command-rpc-client.js +0 -15
- package/dist/src/wirings/rpc/pikku-command-rpc-map.d.ts +0 -3
- package/dist/src/wirings/rpc/pikku-command-rpc-map.js +0 -14
- package/dist/src/wirings/rpc/pikku-command-rpc.d.ts +0 -2
- package/dist/src/wirings/rpc/pikku-command-rpc.js +0 -8
- package/dist/src/wirings/scheduler/pikku-command-scheduler.d.ts +0 -2
- package/dist/src/wirings/scheduler/pikku-command-scheduler.js +0 -10
- package/src/inspector-glob.ts +0 -30
- package/src/pikku-cli-config.ts +0 -387
- package/src/pikku-command-schemas.ts +0 -35
- package/src/runtimes/nextjs/pikku-command-nextjs.ts +0 -110
- package/src/schemas.ts +0 -35
- package/src/serialize-pikku-types.ts +0 -613
- package/src/types.ts +0 -16
- package/src/utils.ts +0 -420
- package/src/wirings/channels/pikku-channels.ts +0 -41
- package/src/wirings/channels/pikku-command-channels-map.ts +0 -26
- package/src/wirings/channels/pikku-command-channels.ts +0 -39
- package/src/wirings/channels/pikku-command-websocket-typed.ts +0 -36
- package/src/wirings/fetch/index.ts +0 -33
- package/src/wirings/functions/pikku-command-function-types.ts +0 -53
- package/src/wirings/functions/pikku-command-functions.ts +0 -48
- package/src/wirings/functions/pikku-command-services.ts +0 -125
- package/src/wirings/functions/pikku-function-types.ts +0 -52
- package/src/wirings/http/pikku-command-http-map.ts +0 -27
- package/src/wirings/http/pikku-command-http-routes.ts +0 -40
- package/src/wirings/http/pikku-command-openapi.ts +0 -55
- package/src/wirings/http/pikku-http-routes.ts +0 -40
- package/src/wirings/mcp/pikku-command-mcp-json.ts +0 -33
- package/src/wirings/queue/pikku-command-queue-map.ts +0 -26
- package/src/wirings/queue/pikku-command-queue-service.ts +0 -36
- package/src/wirings/queue/pikku-command-queue.ts +0 -45
- package/src/wirings/queue/pikku-queue-map.ts +0 -26
- package/src/wirings/queue/pikku-queue.ts +0 -43
- package/src/wirings/rpc/pikku-command-rpc-client.ts +0 -35
- package/src/wirings/rpc/pikku-command-rpc-map.ts +0 -49
- package/src/wirings/rpc/pikku-command-rpc.ts +0 -24
- package/src/wirings/scheduler/pikku-command-scheduler.ts +0 -43
- /package/dist/{src/types.js → .pikku/channel/pikku-channels-meta.gen.d.ts} +0 -0
- /package/dist/src/{runtimes → functions/runtimes}/nextjs/serialize-nextjs-http-wrapper.d.ts +0 -0
- /package/dist/src/{runtimes → functions/runtimes}/nextjs/serialize-nextjs-http-wrapper.js +0 -0
- /package/dist/src/{wirings → functions/wirings}/channels/serialize-typed-channel-map.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/channels/serialize-websocket-wrapper.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/channels/serialize-websocket-wrapper.js +0 -0
- /package/dist/src/{wirings → functions/wirings}/functions/serialize-function-imports.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/http/serialize-fetch-wrapper.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/http/serialize-fetch-wrapper.js +0 -0
- /package/dist/src/{wirings → functions/wirings}/http/serialize-typed-http-map.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/mcp/serialize-mcp-json.js +0 -0
- /package/dist/src/{wirings → functions/wirings}/queue/serialize-queue-map.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/queue/serialize-queue-meta.js +0 -0
- /package/dist/src/{wirings → functions/wirings}/queue/serialize-queue-wrapper.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/queue/serialize-queue-wrapper.js +0 -0
- /package/dist/src/{wirings → functions/wirings}/rpc/serialize-rpc-wrapper.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/rpc/serialize-rpc-wrapper.js +0 -0
- /package/dist/src/{wirings → functions/wirings}/rpc/serialize-typed-rpc-map.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/scheduler/serialize-scheduler-meta.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/scheduler/serialize-scheduler-meta.js +0 -0
- /package/dist/src/{serialize-import-map.d.ts → utils/serialize-import-map.d.ts} +0 -0
- /package/src/{runtimes → functions/runtimes}/nextjs/serialize-nextjs-http-wrapper.ts +0 -0
- /package/src/{wirings → functions/wirings}/channels/serialize-websocket-wrapper.ts +0 -0
- /package/src/{wirings → functions/wirings}/http/serialize-fetch-wrapper.ts +0 -0
- /package/src/{wirings → functions/wirings}/queue/serialize-queue-wrapper.ts +0 -0
- /package/src/{wirings → functions/wirings}/rpc/serialize-rpc-wrapper.ts +0 -0
- /package/src/{wirings → functions/wirings}/scheduler/serialize-scheduler-meta.ts +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.10.0
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
|
|
6
|
+
* CLI-specific type definitions for tree-shaking optimization
|
|
7
|
+
*/
|
|
8
|
+
import { CoreCLI, CorePikkuCLIRender, CoreCLICommandConfig } from '@pikku/core/cli';
|
|
9
|
+
import type { PikkuFunctionConfig, PikkuMiddleware } from '../function/pikku-function-types.gen.js';
|
|
10
|
+
import type { UserSession } from '../../types/application-types.d.js';
|
|
11
|
+
import type { SingletonServices } from '../../types/application-types.d.js';
|
|
12
|
+
type Session = UserSession;
|
|
13
|
+
/**
|
|
14
|
+
* Type-safe CLI renderer definition that can access your application's services.
|
|
15
|
+
* Use this to define custom renderers for CLI command output.
|
|
16
|
+
*
|
|
17
|
+
* @template Data - The output data type from the CLI command
|
|
18
|
+
* @template RequiredServices - The services required for this renderer
|
|
19
|
+
*/
|
|
20
|
+
type PikkuCLIRender<Data, RequiredServices extends SingletonServices = SingletonServices> = CorePikkuCLIRender<Data, RequiredServices, Session>;
|
|
21
|
+
/**
|
|
22
|
+
* CLI command configuration with project-specific types.
|
|
23
|
+
* Uses CoreCLICommandConfig from @pikku/core with local middleware and render types.
|
|
24
|
+
*/
|
|
25
|
+
type CLICommandConfig<Func extends PikkuFunctionConfig<In, Out>, In = any, Out = any, Params extends string = string> = CoreCLICommandConfig<Func, PikkuMiddleware, PikkuCLIRender<any>, Params>;
|
|
26
|
+
/**
|
|
27
|
+
* Type definition for CLI applications with commands and global options.
|
|
28
|
+
*
|
|
29
|
+
* @template Commands - Type describing the command structure
|
|
30
|
+
* @template GlobalOptions - Type for global CLI options
|
|
31
|
+
*/
|
|
32
|
+
type CLIWiring<Commands extends Record<string, CoreCLICommandConfig<any, PikkuMiddleware, PikkuCLIRender<any>, any>>, GlobalOptions> = CoreCLI<Commands, GlobalOptions, PikkuMiddleware, PikkuCLIRender<any>>;
|
|
33
|
+
/**
|
|
34
|
+
* Registers a CLI application with the Pikku framework.
|
|
35
|
+
* Creates command-line interfaces with type-safe commands and options.
|
|
36
|
+
*
|
|
37
|
+
* @template Commands - Type describing the command structure
|
|
38
|
+
* @template GlobalOptions - Type for global CLI options
|
|
39
|
+
* @param cli - CLI definition with program name, commands, and global options
|
|
40
|
+
*/
|
|
41
|
+
export declare const wireCLI: <Commands extends Record<string, CoreCLICommandConfig<any, PikkuMiddleware, PikkuCLIRender<any>, any>>, GlobalOptions>(cli: CLIWiring<Commands, GlobalOptions>) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Creates a CLI command definition with automatic option inference from the function's input type.
|
|
44
|
+
* This allows TypeScript to automatically derive CLI options from the function signature.
|
|
45
|
+
*
|
|
46
|
+
* @template FuncConfig - The Pikku function config type
|
|
47
|
+
* @template Params - The parameters string literal type
|
|
48
|
+
* @param config - CLI command configuration
|
|
49
|
+
* @returns CLI command configuration with inferred types
|
|
50
|
+
*/
|
|
51
|
+
export declare const pikkuCLICommand: <FuncConfig extends PikkuFunctionConfig<any, any>, Params extends string>(config: CLICommandConfig<FuncConfig, any, any, Params>) => CoreCLICommandConfig<FuncConfig, PikkuMiddleware, PikkuCLIRender<any>, string>;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.10.0
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
|
|
6
|
+
* CLI-specific type definitions for tree-shaking optimization
|
|
7
|
+
*/
|
|
8
|
+
import { wireCLI as wireCLICore } from '@pikku/core/cli';
|
|
9
|
+
/**
|
|
10
|
+
* Registers a CLI application with the Pikku framework.
|
|
11
|
+
* Creates command-line interfaces with type-safe commands and options.
|
|
12
|
+
*
|
|
13
|
+
* @template Commands - Type describing the command structure
|
|
14
|
+
* @template GlobalOptions - Type for global CLI options
|
|
15
|
+
* @param cli - CLI definition with program name, commands, and global options
|
|
16
|
+
*/
|
|
17
|
+
export const wireCLI = (cli) => {
|
|
18
|
+
wireCLICore(cli);
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Creates a CLI command definition with automatic option inference from the function's input type.
|
|
22
|
+
* This allows TypeScript to automatically derive CLI options from the function signature.
|
|
23
|
+
*
|
|
24
|
+
* @template FuncConfig - The Pikku function config type
|
|
25
|
+
* @template Params - The parameters string literal type
|
|
26
|
+
* @param config - CLI command configuration
|
|
27
|
+
* @returns CLI command configuration with inferred types
|
|
28
|
+
*/
|
|
29
|
+
export const pikkuCLICommand = (config) => {
|
|
30
|
+
return config;
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.10.0
|
|
3
|
+
*/
|
|
4
|
+
import { pikkuState } from '@pikku/core';
|
|
5
|
+
pikkuState('cli', 'meta', {
|
|
6
|
+
"programs": {
|
|
7
|
+
"pikku": {
|
|
8
|
+
"program": "pikku",
|
|
9
|
+
"commands": {
|
|
10
|
+
"all": {
|
|
11
|
+
"pikkuFuncName": "all",
|
|
12
|
+
"positionals": [],
|
|
13
|
+
"options": {
|
|
14
|
+
"tags": {
|
|
15
|
+
"description": "Filter functions by tags (comma-separated)",
|
|
16
|
+
"short": "t"
|
|
17
|
+
},
|
|
18
|
+
"types": {
|
|
19
|
+
"description": "Filter functions by types (comma-separated)"
|
|
20
|
+
},
|
|
21
|
+
"directories": {
|
|
22
|
+
"description": "Filter functions by directories (comma-separated)",
|
|
23
|
+
"short": "d"
|
|
24
|
+
},
|
|
25
|
+
"httpMethods": {
|
|
26
|
+
"description": "Filter HTTP routes by methods (comma-separated)"
|
|
27
|
+
},
|
|
28
|
+
"httpRoutes": {
|
|
29
|
+
"description": "Filter HTTP routes by route patterns (comma-separated)"
|
|
30
|
+
},
|
|
31
|
+
"names": {
|
|
32
|
+
"description": "Filter functions by name patterns (supports wildcards)",
|
|
33
|
+
"short": "n"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"description": "Generate all Pikku files (types, schemas, wirings, etc.)",
|
|
37
|
+
"isDefault": true
|
|
38
|
+
},
|
|
39
|
+
"schemas": {
|
|
40
|
+
"pikkuFuncName": "pikkuSchemas",
|
|
41
|
+
"positionals": [],
|
|
42
|
+
"options": {},
|
|
43
|
+
"description": "Generate JSON schemas for function input/output types"
|
|
44
|
+
},
|
|
45
|
+
"fetch": {
|
|
46
|
+
"pikkuFuncName": "pikkuFetch",
|
|
47
|
+
"positionals": [],
|
|
48
|
+
"options": {},
|
|
49
|
+
"description": "Generate type-safe HTTP fetch client"
|
|
50
|
+
},
|
|
51
|
+
"websocket": {
|
|
52
|
+
"pikkuFuncName": "pikkuWebSocketTyped",
|
|
53
|
+
"positionals": [],
|
|
54
|
+
"options": {},
|
|
55
|
+
"description": "Generate type-safe WebSocket client"
|
|
56
|
+
},
|
|
57
|
+
"rpc": {
|
|
58
|
+
"pikkuFuncName": "pikkuRPCClient",
|
|
59
|
+
"positionals": [],
|
|
60
|
+
"options": {},
|
|
61
|
+
"description": "Generate RPC client wrappers"
|
|
62
|
+
},
|
|
63
|
+
"queue-service": {
|
|
64
|
+
"pikkuFuncName": "pikkuQueueService",
|
|
65
|
+
"positionals": [],
|
|
66
|
+
"options": {},
|
|
67
|
+
"description": "Generate queue service wrapper"
|
|
68
|
+
},
|
|
69
|
+
"openapi": {
|
|
70
|
+
"pikkuFuncName": "pikkuOpenAPI",
|
|
71
|
+
"positionals": [],
|
|
72
|
+
"options": {},
|
|
73
|
+
"description": "Generate OpenAPI specification from HTTP routes"
|
|
74
|
+
},
|
|
75
|
+
"nextjs": {
|
|
76
|
+
"pikkuFuncName": "pikkuNext",
|
|
77
|
+
"positionals": [],
|
|
78
|
+
"options": {},
|
|
79
|
+
"description": "Generate Next.js backend and HTTP wrappers"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"options": {
|
|
83
|
+
"config": {
|
|
84
|
+
"description": "Path to pikku.config.json file",
|
|
85
|
+
"short": "c"
|
|
86
|
+
},
|
|
87
|
+
"logLevel": {
|
|
88
|
+
"description": "Set log level",
|
|
89
|
+
"short": "l",
|
|
90
|
+
"choices": [
|
|
91
|
+
"trace",
|
|
92
|
+
"debug",
|
|
93
|
+
"info",
|
|
94
|
+
"warn",
|
|
95
|
+
"error",
|
|
96
|
+
"critical"
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"userSessionType": {
|
|
100
|
+
"description": "Specify which UserSession type to use (when multiple exist)"
|
|
101
|
+
},
|
|
102
|
+
"singletonServicesFactoryType": {
|
|
103
|
+
"description": "Specify which singleton services factory to use"
|
|
104
|
+
},
|
|
105
|
+
"sessionServicesFactoryType": {
|
|
106
|
+
"description": "Specify which session services factory to use"
|
|
107
|
+
},
|
|
108
|
+
"stateOutput": {
|
|
109
|
+
"description": "Save inspector state to JSON file for reuse"
|
|
110
|
+
},
|
|
111
|
+
"stateInput": {
|
|
112
|
+
"description": "Load inspector state from JSON file (skips inspection)"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"defaultRenderName": "clientCLIRenderer"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"renderers": {
|
|
119
|
+
"defaultCLIRenderer": {
|
|
120
|
+
"name": "defaultCLIRenderer",
|
|
121
|
+
"exportedName": "defaultCLIRenderer",
|
|
122
|
+
"services": {
|
|
123
|
+
"optimized": true,
|
|
124
|
+
"services": [
|
|
125
|
+
"logger",
|
|
126
|
+
"getInspectorState",
|
|
127
|
+
"schema",
|
|
128
|
+
"jwt",
|
|
129
|
+
"config",
|
|
130
|
+
"variables"
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
"filePath": "/home/runner/work/pikku/pikku/packages/cli/src/services.ts"
|
|
134
|
+
},
|
|
135
|
+
"clientCLIRenderer": {
|
|
136
|
+
"name": "clientCLIRenderer",
|
|
137
|
+
"exportedName": "clientCLIRenderer",
|
|
138
|
+
"services": {
|
|
139
|
+
"optimized": true,
|
|
140
|
+
"services": []
|
|
141
|
+
},
|
|
142
|
+
"filePath": "/home/runner/work/pikku/pikku/packages/cli/src/services.ts"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.10.0
|
|
3
|
+
*/
|
|
4
|
+
import '../pikku-bootstrap.gen.js';
|
|
5
|
+
/**
|
|
6
|
+
* Pikku CLI function
|
|
7
|
+
* Handles command line arguments and executes the appropriate function
|
|
8
|
+
*/
|
|
9
|
+
export declare function PikkuCLI(args: string[]): Promise<void>;
|
|
10
|
+
export default PikkuCLI;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.10.0
|
|
3
|
+
*/
|
|
4
|
+
import { executeCLI, CLIError } from '@pikku/core/cli';
|
|
5
|
+
import { createConfig as createConfig } from '../../src/services.js';
|
|
6
|
+
import { createSingletonServices as createSingletonServices } from '../../src/services.js';
|
|
7
|
+
import { createSessionServices as createSessionServices } from '../../src/services.js';
|
|
8
|
+
import '../pikku-bootstrap.gen.js';
|
|
9
|
+
/**
|
|
10
|
+
* Pikku CLI function
|
|
11
|
+
* Handles command line arguments and executes the appropriate function
|
|
12
|
+
*/
|
|
13
|
+
export async function PikkuCLI(args) {
|
|
14
|
+
try {
|
|
15
|
+
await executeCLI({
|
|
16
|
+
programName: 'pikku',
|
|
17
|
+
args: args || process.argv.slice(2),
|
|
18
|
+
createConfig,
|
|
19
|
+
createSingletonServices,
|
|
20
|
+
createSessionServices,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
if (error instanceof CLIError) {
|
|
25
|
+
process.exit(error.exitCode);
|
|
26
|
+
}
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// Export as default for easy importing
|
|
31
|
+
export default PikkuCLI;
|
|
32
|
+
// For direct execution (if this file is run directly)
|
|
33
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
34
|
+
PikkuCLI(process.argv.slice(2)).catch(error => {
|
|
35
|
+
console.error('Fatal error:', error.message);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.10.0
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Core function, middleware, and permission types for all wirings
|
|
6
|
+
*/
|
|
7
|
+
import { CorePikkuFunctionConfig, CorePikkuPermission, CorePikkuMiddleware, CorePermissionGroup } from '@pikku/core';
|
|
8
|
+
import { CorePikkuFunction, CorePikkuFunctionSessionless } from '@pikku/core/function';
|
|
9
|
+
import { PikkuChannel } from '@pikku/core/channel';
|
|
10
|
+
import { PikkuMCP } from '@pikku/core/mcp';
|
|
11
|
+
import type { UserSession } from '../../types/application-types.d.js';
|
|
12
|
+
import type { SingletonServices } from '../../types/application-types.d.js';
|
|
13
|
+
import type { Services } from '../../types/application-types.d.js';
|
|
14
|
+
import type { Config } from '../../types/application-types.d.js';
|
|
15
|
+
import type { TypedPikkuRPC } from '../rpc/pikku-rpc-wirings-map.internal.gen.d.js';
|
|
16
|
+
import type { RequiredSingletonServices, RequiredSessionServices } from '../pikku-services.gen.js';
|
|
17
|
+
type Session = UserSession;
|
|
18
|
+
/**
|
|
19
|
+
* Type-safe API permission definition that integrates with your application's session type.
|
|
20
|
+
* Use this to define authorization logic for your API endpoints.
|
|
21
|
+
*
|
|
22
|
+
* @template In - The input type that the permission check will receive
|
|
23
|
+
* @template RequiredServices - The services required for this permission check
|
|
24
|
+
*/
|
|
25
|
+
export type PikkuPermission<In = unknown, RequiredServices extends Services = Services> = CorePikkuPermission<In, RequiredServices, Session>;
|
|
26
|
+
/**
|
|
27
|
+
* Type-safe middleware definition that can access your application's services and session.
|
|
28
|
+
* Use this to define reusable middleware that can be applied to multiple wirings.
|
|
29
|
+
*
|
|
30
|
+
* @template RequiredServices - The services required for this middleware
|
|
31
|
+
*/
|
|
32
|
+
export type PikkuMiddleware<RequiredServices extends SingletonServices = SingletonServices> = CorePikkuMiddleware<RequiredServices, Session>;
|
|
33
|
+
/**
|
|
34
|
+
* Configuration object for creating a permission with metadata
|
|
35
|
+
*/
|
|
36
|
+
export type PikkuPermissionConfig<In = unknown, RequiredServices extends Services = Services> = {
|
|
37
|
+
/** The permission function */
|
|
38
|
+
func: PikkuPermission<In, RequiredServices>;
|
|
39
|
+
/** Optional human-readable name for the permission */
|
|
40
|
+
name?: string;
|
|
41
|
+
/** Optional description of what the permission checks */
|
|
42
|
+
description?: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Factory function for creating permissions with tree-shaking support.
|
|
46
|
+
* Supports both direct function and configuration object syntax.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* // Direct function syntax
|
|
51
|
+
* const permission = pikkuPermission(({ logger }, data, session) => {
|
|
52
|
+
* return session?.role === 'admin'
|
|
53
|
+
* })
|
|
54
|
+
*
|
|
55
|
+
* // Configuration object syntax with metadata
|
|
56
|
+
* const adminPermission = pikkuPermission({
|
|
57
|
+
* name: 'Admin Permission',
|
|
58
|
+
* description: 'Checks if user has admin role',
|
|
59
|
+
* func: async ({ logger }, data, session) => {
|
|
60
|
+
* return session?.role === 'admin'
|
|
61
|
+
* }
|
|
62
|
+
* })
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare const pikkuPermission: <In>(permission: PikkuPermission<In> | PikkuPermissionConfig<In>) => PikkuPermission<In>;
|
|
66
|
+
/**
|
|
67
|
+
* Configuration object for creating middleware with metadata
|
|
68
|
+
*/
|
|
69
|
+
export type PikkuMiddlewareConfig<RequiredServices extends SingletonServices = SingletonServices> = {
|
|
70
|
+
/** The middleware function */
|
|
71
|
+
func: PikkuMiddleware<RequiredServices>;
|
|
72
|
+
/** Optional human-readable name for the middleware */
|
|
73
|
+
name?: string;
|
|
74
|
+
/** Optional description of what the middleware does */
|
|
75
|
+
description?: string;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Factory function for creating middleware with tree-shaking support.
|
|
79
|
+
* Supports both direct function and configuration object syntax.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* // Direct function syntax
|
|
84
|
+
* const middleware = pikkuMiddleware(({ logger }, interactions, next) => {
|
|
85
|
+
* logger.info('Middleware executed')
|
|
86
|
+
* await next()
|
|
87
|
+
* })
|
|
88
|
+
*
|
|
89
|
+
* // Configuration object syntax with metadata
|
|
90
|
+
* const logMiddleware = pikkuMiddleware({
|
|
91
|
+
* name: 'Request Logger',
|
|
92
|
+
* description: 'Logs all incoming requests',
|
|
93
|
+
* func: async ({ logger }, interactions, next) => {
|
|
94
|
+
* logger.info('Request started')
|
|
95
|
+
* await next()
|
|
96
|
+
* }
|
|
97
|
+
* })
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export declare const pikkuMiddleware: <RequiredServices extends SingletonServices = SingletonServices>(middleware: PikkuMiddleware<RequiredServices> | PikkuMiddlewareConfig<RequiredServices>) => PikkuMiddleware<RequiredServices>;
|
|
101
|
+
/**
|
|
102
|
+
* Factory function for creating middleware factories
|
|
103
|
+
* Use this when your middleware needs configuration/input parameters
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* export const logMiddleware = pikkuMiddlewareFactory<LogOptions>(({
|
|
108
|
+
* message,
|
|
109
|
+
* level = 'info'
|
|
110
|
+
* }) => {
|
|
111
|
+
* return pikkuMiddleware(async ({ logger }, _interaction, next) => {
|
|
112
|
+
* logger[level](message)
|
|
113
|
+
* await next()
|
|
114
|
+
* })
|
|
115
|
+
* })
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
export declare const pikkuMiddlewareFactory: <In = any>(factory: (input: In) => PikkuMiddleware) => ((input: In) => PikkuMiddleware);
|
|
119
|
+
/**
|
|
120
|
+
* Factory function for creating permission factories
|
|
121
|
+
* Use this when your permission needs configuration/input parameters
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* export const requireRole = pikkuPermissionFactory<{ role: string }>(({
|
|
126
|
+
* role
|
|
127
|
+
* }) => {
|
|
128
|
+
* return pikkuPermission(async ({ logger }, data, session) => {
|
|
129
|
+
* if (!session || session.role !== role) {
|
|
130
|
+
* logger.warn(`Permission denied: required role '${role}'`)
|
|
131
|
+
* return false
|
|
132
|
+
* }
|
|
133
|
+
* return true
|
|
134
|
+
* })
|
|
135
|
+
* })
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export declare const pikkuPermissionFactory: <In = any>(factory: (input: In) => PikkuPermission<any>) => ((input: In) => PikkuPermission<any>);
|
|
139
|
+
/**
|
|
140
|
+
* A sessionless API function that doesn't require user authentication.
|
|
141
|
+
* Use this for public endpoints, health checks, or operations that don't need user context.
|
|
142
|
+
*
|
|
143
|
+
* @template In - The input type
|
|
144
|
+
* @template Out - The output type that the function returns
|
|
145
|
+
* @template ChannelData - Channel data type (null = optional channel)
|
|
146
|
+
* @template MCPData - MCP data type (null = optional MCP)
|
|
147
|
+
* @template RequiredServices - Services required by this function
|
|
148
|
+
*/
|
|
149
|
+
export type PikkuFunctionSessionless<In = unknown, Out = never, ChannelData = null, // null means optional channel
|
|
150
|
+
MCPData = null, // null means optional MCP
|
|
151
|
+
RequiredServices extends Services = Omit<Services, 'rpc' | 'channel' | 'mcp'> & {
|
|
152
|
+
rpc: TypedPikkuRPC;
|
|
153
|
+
} & ([
|
|
154
|
+
ChannelData
|
|
155
|
+
] extends [null] ? {
|
|
156
|
+
channel?: PikkuChannel<unknown, Out>;
|
|
157
|
+
} : {
|
|
158
|
+
channel: PikkuChannel<ChannelData, Out>;
|
|
159
|
+
}) & ([MCPData] extends [null] ? {
|
|
160
|
+
mcp?: PikkuMCP;
|
|
161
|
+
} : {
|
|
162
|
+
mcp: PikkuMCP;
|
|
163
|
+
})> = CorePikkuFunctionSessionless<In, Out, ChannelData, RequiredServices, Session>;
|
|
164
|
+
/**
|
|
165
|
+
* A session-aware API function that requires user authentication.
|
|
166
|
+
* Use this for protected endpoints that need access to user session data.
|
|
167
|
+
*
|
|
168
|
+
* @template In - The input type
|
|
169
|
+
* @template Out - The output type that the function returns
|
|
170
|
+
* @template ChannelData - Channel data type (null = optional channel)
|
|
171
|
+
* @template MCPData - MCP data type (null = optional MCP)
|
|
172
|
+
* @template RequiredServices - Services required by this function
|
|
173
|
+
*/
|
|
174
|
+
export type PikkuFunction<In = unknown, Out = never, ChannelData = null, // null means optional channel
|
|
175
|
+
MCPData = null, // null means optional MCP
|
|
176
|
+
RequiredServices extends Services = Omit<Services, 'rpc' | 'channel' | 'mcp'> & {
|
|
177
|
+
rpc: TypedPikkuRPC;
|
|
178
|
+
} & ([
|
|
179
|
+
ChannelData
|
|
180
|
+
] extends [null] ? {
|
|
181
|
+
channel?: PikkuChannel<unknown, Out>;
|
|
182
|
+
} : {
|
|
183
|
+
channel: PikkuChannel<ChannelData, Out>;
|
|
184
|
+
}) & ([MCPData] extends [null] ? {
|
|
185
|
+
mcp?: PikkuMCP;
|
|
186
|
+
} : {
|
|
187
|
+
mcp: PikkuMCP;
|
|
188
|
+
})> = CorePikkuFunction<In, Out, ChannelData, RequiredServices, Session>;
|
|
189
|
+
/**
|
|
190
|
+
* Configuration object for Pikku functions with optional middleware, permissions, tags, and documentation.
|
|
191
|
+
* This type wraps CorePikkuFunctionConfig with the user's custom types.
|
|
192
|
+
*
|
|
193
|
+
* @template In - The input type
|
|
194
|
+
* @template Out - The output type
|
|
195
|
+
* @template ChannelData - Channel data type
|
|
196
|
+
* @template MCPData - MCP data type
|
|
197
|
+
* @template PikkuFunc - The function type (can be narrowed to PikkuFunction or PikkuFunctionSessionless)
|
|
198
|
+
*/
|
|
199
|
+
export type PikkuFunctionConfig<In = unknown, Out = unknown, ChannelData = unknown, MCPData = unknown, PikkuFunc extends PikkuFunction<In, Out, ChannelData, MCPData> | PikkuFunctionSessionless<In, Out, ChannelData, MCPData> = PikkuFunction<In, Out, ChannelData, MCPData> | PikkuFunctionSessionless<In, Out, ChannelData, MCPData>> = CorePikkuFunctionConfig<PikkuFunc, PikkuPermission<In>, PikkuMiddleware>;
|
|
200
|
+
/**
|
|
201
|
+
* Creates a Pikku function that can be either session-aware or sessionless.
|
|
202
|
+
* This is the main function wrapper for creating API endpoints.
|
|
203
|
+
*
|
|
204
|
+
* @template In - Input type for the function
|
|
205
|
+
* @template Out - Output type for the function
|
|
206
|
+
* @param func - Function definition, either direct function or configuration object
|
|
207
|
+
* @returns The normalized configuration object
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* \`\`\`typescript
|
|
211
|
+
* const createUser = pikkuFunc<{name: string, email: string}, {id: number, message: string}>({
|
|
212
|
+
* func: async ({db, logger}, input) => {
|
|
213
|
+
* logger.info('Creating user', input.name)
|
|
214
|
+
* const user = await db.users.create(input)
|
|
215
|
+
* return {id: user.id, message: \`User \${input.name} created successfully\`}
|
|
216
|
+
* },
|
|
217
|
+
* auth: true
|
|
218
|
+
* })
|
|
219
|
+
* \`\`\`
|
|
220
|
+
*/
|
|
221
|
+
export declare const pikkuFunc: <In, Out = unknown>(func: PikkuFunction<In, Out> | CorePikkuFunctionConfig<PikkuFunction<In, Out>, PikkuPermission<In>, PikkuMiddleware>) => CorePikkuFunctionConfig<PikkuFunction<In, Out, null, null, Omit<Services, "rpc" | "channel" | "mcp"> & {
|
|
222
|
+
rpc: TypedPikkuRPC;
|
|
223
|
+
} & {
|
|
224
|
+
channel?: PikkuChannel<unknown, Out> | undefined;
|
|
225
|
+
} & {
|
|
226
|
+
mcp?: PikkuMCP;
|
|
227
|
+
}>, PikkuPermission<In, Services>, PikkuMiddleware<SingletonServices>>;
|
|
228
|
+
/**
|
|
229
|
+
* Creates a sessionless Pikku function that doesn't require user authentication.
|
|
230
|
+
* Use this for public endpoints, webhooks, or background tasks.
|
|
231
|
+
*
|
|
232
|
+
* @template In - Input type for the function
|
|
233
|
+
* @template Out - Output type for the function
|
|
234
|
+
* @param func - Function definition, either direct function or configuration object
|
|
235
|
+
* @returns The normalized configuration object
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* \`\`\`typescript
|
|
239
|
+
* const healthCheck = pikkuSessionlessFunc<void, {status: string, timestamp: string}>({
|
|
240
|
+
* func: async ({logger}) => {
|
|
241
|
+
* logger.info('Health check requested')
|
|
242
|
+
* return {status: 'healthy', timestamp: new Date().toISOString()}
|
|
243
|
+
* },
|
|
244
|
+
* name: 'healthCheck'
|
|
245
|
+
* })
|
|
246
|
+
* \`\`\`
|
|
247
|
+
*/
|
|
248
|
+
export declare const pikkuSessionlessFunc: <In, Out = unknown>(func: PikkuFunctionSessionless<In, Out> | CorePikkuFunctionConfig<PikkuFunctionSessionless<In, Out>, PikkuPermission<In>, PikkuMiddleware>) => CorePikkuFunctionConfig<PikkuFunctionSessionless<In, Out, null, null, Omit<Services, "rpc" | "channel" | "mcp"> & {
|
|
249
|
+
rpc: TypedPikkuRPC;
|
|
250
|
+
} & {
|
|
251
|
+
channel?: PikkuChannel<unknown, Out> | undefined;
|
|
252
|
+
} & {
|
|
253
|
+
mcp?: PikkuMCP;
|
|
254
|
+
}>, PikkuPermission<In, Services>, PikkuMiddleware<SingletonServices>>;
|
|
255
|
+
/**
|
|
256
|
+
* Creates a function that takes no input and returns no output.
|
|
257
|
+
* Useful for health checks, triggers, or cleanup operations.
|
|
258
|
+
*
|
|
259
|
+
* @param func - Function definition, either direct function or configuration object
|
|
260
|
+
* @returns The normalized configuration object
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* \`\`\`typescript
|
|
264
|
+
* const cleanupTempFiles = pikkuVoidFunc(async ({fileSystem, logger}) => {
|
|
265
|
+
* logger.info('Starting cleanup of temporary files')
|
|
266
|
+
* await fileSystem.deleteDirectory('/tmp/uploads')
|
|
267
|
+
* logger.info('Cleanup completed')
|
|
268
|
+
* })
|
|
269
|
+
* \`\`\`
|
|
270
|
+
*/
|
|
271
|
+
export declare const pikkuVoidFunc: (func: PikkuFunctionSessionless<void, void> | CorePikkuFunctionConfig<PikkuFunctionSessionless<void, void>, PikkuPermission<void>>) => CorePikkuFunctionConfig<PikkuFunctionSessionless<void, void, null, null, Omit<Services, "rpc" | "channel" | "mcp"> & {
|
|
272
|
+
rpc: TypedPikkuRPC;
|
|
273
|
+
} & {
|
|
274
|
+
channel?: PikkuChannel<unknown, void> | undefined;
|
|
275
|
+
} & {
|
|
276
|
+
mcp?: PikkuMCP;
|
|
277
|
+
}>, PikkuPermission<void, Services>>;
|
|
278
|
+
/**
|
|
279
|
+
* Creates a Pikku config factory.
|
|
280
|
+
* Use this to define your application's configuration factory.
|
|
281
|
+
*
|
|
282
|
+
* @param func - Config factory function that returns your application's config
|
|
283
|
+
* @returns The config factory function
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```typescript
|
|
287
|
+
* export const createConfig = pikkuConfig(async () => {
|
|
288
|
+
* return {
|
|
289
|
+
* apiUrl: process.env.API_URL || 'http://localhost:3000',
|
|
290
|
+
* dbUrl: process.env.DATABASE_URL
|
|
291
|
+
* }
|
|
292
|
+
* })
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
export declare const pikkuConfig: (func: (variables?: any, ...args: any[]) => Promise<Config>) => (variables?: any, ...args: any[]) => Promise<Config>;
|
|
296
|
+
/**
|
|
297
|
+
* Creates a Pikku singleton services factory.
|
|
298
|
+
* Use this to define services that are created once and shared across all requests.
|
|
299
|
+
*
|
|
300
|
+
* @param func - Singleton services factory function
|
|
301
|
+
* @returns The singleton services factory function
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
* ```typescript
|
|
305
|
+
* export const createSingletonServices = pikkuServices(async (config, existingServices) => {
|
|
306
|
+
* return {
|
|
307
|
+
* config,
|
|
308
|
+
* logger: new CustomLogger(),
|
|
309
|
+
* db: await createDatabaseConnection(config.dbUrl)
|
|
310
|
+
* }
|
|
311
|
+
* })
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
export declare const pikkuServices: (func: (config: Config, existingServices?: Partial<SingletonServices>) => Promise<RequiredSingletonServices>) => (config: Config, existingServices?: Partial<SingletonServices>) => Promise<RequiredSingletonServices>;
|
|
315
|
+
/**
|
|
316
|
+
* Creates a Pikku session services factory.
|
|
317
|
+
* Use this to define services that are created per-request/session.
|
|
318
|
+
*
|
|
319
|
+
* @param func - Session services factory function
|
|
320
|
+
* @returns The session services factory function
|
|
321
|
+
*
|
|
322
|
+
* @example
|
|
323
|
+
* ```typescript
|
|
324
|
+
* export const createSessionServices = pikkuSessionServices(async (services, interaction, session) => {
|
|
325
|
+
* return {
|
|
326
|
+
* userCache: new UserCache(session?.userId)
|
|
327
|
+
* }
|
|
328
|
+
* })
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
export declare const pikkuSessionServices: (func: (services: SingletonServices, interaction: any, session: Session | undefined) => Promise<RequiredSessionServices>) => (services: SingletonServices, interaction: any, session: Session | undefined) => Promise<RequiredSessionServices>;
|
|
332
|
+
/**
|
|
333
|
+
* Adds global middleware for a specific tag.
|
|
334
|
+
*
|
|
335
|
+
* This function allows you to register middleware that will be applied to
|
|
336
|
+
* any wiring (HTTP, Channel, Queue, Scheduler, MCP) that includes the matching tag.
|
|
337
|
+
*
|
|
338
|
+
* @param tag - The tag that the middleware should apply to.
|
|
339
|
+
* @param middleware - The middleware array to apply for the specified tag.
|
|
340
|
+
*
|
|
341
|
+
* @throws Error if middleware for the tag already exists.
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```typescript
|
|
345
|
+
* // Add admin middleware for admin endpoints
|
|
346
|
+
* addMiddleware('admin', [adminMiddleware])
|
|
347
|
+
*
|
|
348
|
+
* // Add authentication middleware for auth endpoints
|
|
349
|
+
* addMiddleware('auth', [authMiddleware])
|
|
350
|
+
*
|
|
351
|
+
* // Add logging middleware for all API endpoints
|
|
352
|
+
* addMiddleware('api', [loggingMiddleware])
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
export declare const addMiddleware: (tag: string, middleware: PikkuMiddleware[]) => void;
|
|
356
|
+
/**
|
|
357
|
+
* Adds global permissions for a specific tag.
|
|
358
|
+
*
|
|
359
|
+
* This function allows you to register permissions that will be applied to
|
|
360
|
+
* any wiring (HTTP, Channel, Queue, Scheduler, MCP) that includes the matching tag.
|
|
361
|
+
*
|
|
362
|
+
* @param tag - The tag that the permissions should apply to.
|
|
363
|
+
* @param permissions - The permissions array or object to apply for the specified tag.
|
|
364
|
+
*
|
|
365
|
+
* @throws Error if permissions for the tag already exist.
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* ```typescript
|
|
369
|
+
* // Add admin permissions for admin endpoints
|
|
370
|
+
* addPermission('admin', [adminPermission])
|
|
371
|
+
*
|
|
372
|
+
* // Add authentication permissions for auth endpoints
|
|
373
|
+
* addPermission('auth', [authPermission])
|
|
374
|
+
*
|
|
375
|
+
* // Add read permissions for all API endpoints (as object)
|
|
376
|
+
* addPermission('api', { read: readPermission })
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
export declare const addPermission: <In = unknown>(tag: string, permissions: CorePermissionGroup<PikkuPermission<In>> | PikkuPermission<In>[]) => void;
|
|
380
|
+
export {};
|