@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,224 @@
|
|
|
1
|
+
import { join, dirname, resolve, isAbsolute } from 'path';
|
|
2
|
+
import { readdir, readFile } from 'fs/promises';
|
|
3
|
+
const CONFIG_DIR_FILES = [
|
|
4
|
+
'nextBackendFile',
|
|
5
|
+
'nextHTTPFile',
|
|
6
|
+
'fetchFile',
|
|
7
|
+
'websocketFile',
|
|
8
|
+
'rpcWiringsFile',
|
|
9
|
+
'queueWiringsFile',
|
|
10
|
+
'mcpJsonFile',
|
|
11
|
+
];
|
|
12
|
+
export const getPikkuCLIConfig = async (logger, configFile = undefined, requiredFields, exitProcess = false) => {
|
|
13
|
+
const config = await _getPikkuCLIConfig(logger, configFile, requiredFields, exitProcess);
|
|
14
|
+
return config;
|
|
15
|
+
};
|
|
16
|
+
const _getPikkuCLIConfig = async (logger, configFile = undefined, requiredFields, exitProcess = false) => {
|
|
17
|
+
if (!configFile) {
|
|
18
|
+
let execDirectory = process.cwd();
|
|
19
|
+
const files = await readdir(execDirectory);
|
|
20
|
+
const file = files.find((file) => /pikku\.config\.(ts|js|json)$/.test(file));
|
|
21
|
+
if (!file) {
|
|
22
|
+
throw new Error('Config file pikku.config.json not found');
|
|
23
|
+
}
|
|
24
|
+
configFile = join(execDirectory, file);
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
let result;
|
|
28
|
+
const file = await readFile(configFile, 'utf-8');
|
|
29
|
+
const configDir = dirname(configFile);
|
|
30
|
+
const config = JSON.parse(file);
|
|
31
|
+
if (config.extends) {
|
|
32
|
+
const extendedConfig = await getPikkuCLIConfig(logger, resolve(configDir, config.extends), [], exitProcess);
|
|
33
|
+
result = {
|
|
34
|
+
...extendedConfig,
|
|
35
|
+
...config,
|
|
36
|
+
configDir,
|
|
37
|
+
packageMappings: {
|
|
38
|
+
...extendedConfig.packageMappings,
|
|
39
|
+
...config.packageMappings,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
result = {
|
|
45
|
+
...config,
|
|
46
|
+
configDir,
|
|
47
|
+
packageMappings: config.packageMappings || {},
|
|
48
|
+
rootDir: config.rootDir
|
|
49
|
+
? resolve(configDir, config.rootDir)
|
|
50
|
+
: configDir,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// Create transport/event directories
|
|
54
|
+
const functionDir = join(result.outDir, 'function');
|
|
55
|
+
const httpDir = join(result.outDir, 'http');
|
|
56
|
+
const channelDir = join(result.outDir, 'channel');
|
|
57
|
+
const rpcDir = join(result.outDir, 'rpc');
|
|
58
|
+
const schedulerDir = join(result.outDir, 'scheduler');
|
|
59
|
+
const queueDir = join(result.outDir, 'queue');
|
|
60
|
+
const mcpDir = join(result.outDir, 'mcp');
|
|
61
|
+
const cliDir = join(result.outDir, 'cli');
|
|
62
|
+
const middlewareDir = join(result.outDir, 'middleware');
|
|
63
|
+
// Create directories if they don't exist (will be done lazily when files are written)
|
|
64
|
+
if (!result.schemaDirectory) {
|
|
65
|
+
result.schemaDirectory = join(result.outDir, 'schemas');
|
|
66
|
+
}
|
|
67
|
+
// Functions
|
|
68
|
+
if (!result.functionsFile) {
|
|
69
|
+
result.functionsFile = join(functionDir, 'pikku-functions.gen.ts');
|
|
70
|
+
}
|
|
71
|
+
if (!result.functionsMetaFile) {
|
|
72
|
+
result.functionsMetaFile = join(functionDir, 'pikku-functions-meta.gen.ts');
|
|
73
|
+
}
|
|
74
|
+
if (!result.functionsMetaMinFile) {
|
|
75
|
+
result.functionsMetaMinFile = join(functionDir, 'pikku-functions-meta.min.gen.ts');
|
|
76
|
+
}
|
|
77
|
+
if (!result.functionTypesFile) {
|
|
78
|
+
result.functionTypesFile = join(functionDir, 'pikku-function-types.gen.ts');
|
|
79
|
+
}
|
|
80
|
+
if (!result.typesDeclarationFile) {
|
|
81
|
+
result.typesDeclarationFile = join(result.outDir, 'pikku-types.gen.ts');
|
|
82
|
+
}
|
|
83
|
+
// HTTP
|
|
84
|
+
if (!result.httpWiringsFile) {
|
|
85
|
+
result.httpWiringsFile = join(httpDir, 'pikku-http-wirings.gen.ts');
|
|
86
|
+
}
|
|
87
|
+
if (!result.httpWiringMetaFile) {
|
|
88
|
+
result.httpWiringMetaFile = join(httpDir, 'pikku-http-wirings-meta.gen.ts');
|
|
89
|
+
}
|
|
90
|
+
if (!result.httpMapDeclarationFile) {
|
|
91
|
+
result.httpMapDeclarationFile = join(httpDir, 'pikku-http-wirings-map.gen.d.ts');
|
|
92
|
+
}
|
|
93
|
+
if (!result.httpTypesFile) {
|
|
94
|
+
result.httpTypesFile = join(httpDir, 'pikku-http-types.gen.ts');
|
|
95
|
+
}
|
|
96
|
+
// Channels/WebSocket
|
|
97
|
+
if (!result.channelsWiringFile) {
|
|
98
|
+
result.channelsWiringFile = join(channelDir, 'pikku-channels.gen.ts');
|
|
99
|
+
}
|
|
100
|
+
if (!result.channelsWiringMetaFile) {
|
|
101
|
+
result.channelsWiringMetaFile = join(channelDir, 'pikku-channels-meta.gen.ts');
|
|
102
|
+
}
|
|
103
|
+
if (!result.channelsMapDeclarationFile) {
|
|
104
|
+
result.channelsMapDeclarationFile = join(channelDir, 'pikku-channels-map.gen.d.ts');
|
|
105
|
+
}
|
|
106
|
+
if (!result.channelsTypesFile) {
|
|
107
|
+
result.channelsTypesFile = join(channelDir, 'pikku-channel-types.gen.ts');
|
|
108
|
+
}
|
|
109
|
+
// RPC (internal and external)
|
|
110
|
+
if (!result.rpcInternalWiringMetaFile) {
|
|
111
|
+
result.rpcInternalWiringMetaFile = join(rpcDir, 'pikku-rpc-wirings-meta.internal.gen.ts');
|
|
112
|
+
}
|
|
113
|
+
if (!result.rpcInternalMapDeclarationFile) {
|
|
114
|
+
result.rpcInternalMapDeclarationFile = join(rpcDir, 'pikku-rpc-wirings-map.internal.gen.d.ts');
|
|
115
|
+
}
|
|
116
|
+
if (!result.rpcMapDeclarationFile) {
|
|
117
|
+
result.rpcMapDeclarationFile = join(rpcDir, 'pikku-rpc-wirings-map.gen.d.ts');
|
|
118
|
+
}
|
|
119
|
+
// Scheduler
|
|
120
|
+
if (!result.schedulersWiringFile) {
|
|
121
|
+
result.schedulersWiringFile = join(schedulerDir, 'pikku-schedulers-wirings.gen.ts');
|
|
122
|
+
}
|
|
123
|
+
if (!result.schedulersWiringMetaFile) {
|
|
124
|
+
result.schedulersWiringMetaFile = join(schedulerDir, 'pikku-schedulers-wirings-meta.gen.ts');
|
|
125
|
+
}
|
|
126
|
+
if (!result.schedulersTypesFile) {
|
|
127
|
+
result.schedulersTypesFile = join(schedulerDir, 'pikku-scheduler-types.gen.ts');
|
|
128
|
+
}
|
|
129
|
+
// Queue
|
|
130
|
+
if (!result.queueWorkersWiringFile) {
|
|
131
|
+
result.queueWorkersWiringFile = join(queueDir, 'pikku-queue-workers-wirings.gen.ts');
|
|
132
|
+
}
|
|
133
|
+
if (!result.queueWorkersWiringMetaFile) {
|
|
134
|
+
result.queueWorkersWiringMetaFile = join(queueDir, 'pikku-queue-workers-wirings-meta.gen.ts');
|
|
135
|
+
}
|
|
136
|
+
if (!result.queueMapDeclarationFile) {
|
|
137
|
+
result.queueMapDeclarationFile = join(queueDir, 'pikku-queue-workers-wirings-map.gen.d.ts');
|
|
138
|
+
}
|
|
139
|
+
if (!result.queueTypesFile) {
|
|
140
|
+
result.queueTypesFile = join(queueDir, 'pikku-queue-types.gen.ts');
|
|
141
|
+
}
|
|
142
|
+
// Services
|
|
143
|
+
if (!result.servicesFile) {
|
|
144
|
+
result.servicesFile = join(result.outDir, 'pikku-services.gen.ts');
|
|
145
|
+
}
|
|
146
|
+
// Middleware
|
|
147
|
+
if (!result.middlewareFile) {
|
|
148
|
+
result.middlewareFile = join(middlewareDir, 'pikku-middleware.gen.ts');
|
|
149
|
+
}
|
|
150
|
+
if (!result.middlewareGroupsMetaFile) {
|
|
151
|
+
result.middlewareGroupsMetaFile = join(middlewareDir, 'pikku-middleware-groups-meta.gen.ts');
|
|
152
|
+
}
|
|
153
|
+
// Permissions
|
|
154
|
+
const permissionsDir = join(result.outDir, 'permissions');
|
|
155
|
+
if (!result.permissionsFile) {
|
|
156
|
+
result.permissionsFile = join(permissionsDir, 'pikku-permissions.gen.ts');
|
|
157
|
+
}
|
|
158
|
+
// Bootstrap files
|
|
159
|
+
if (!result.bootstrapFile) {
|
|
160
|
+
result.bootstrapFile = join(result.outDir, 'pikku-bootstrap.gen.ts');
|
|
161
|
+
}
|
|
162
|
+
// MCP
|
|
163
|
+
if (!result.mcpWiringsMetaFile) {
|
|
164
|
+
result.mcpWiringsMetaFile = join(mcpDir, 'pikku-mcp-wirings-meta.gen.ts');
|
|
165
|
+
}
|
|
166
|
+
if (!result.mcpWiringsFile) {
|
|
167
|
+
result.mcpWiringsFile = join(mcpDir, 'pikku-mcp-wirings.gen.ts');
|
|
168
|
+
}
|
|
169
|
+
if (!result.mcpJsonFile) {
|
|
170
|
+
result.mcpJsonFile = join(mcpDir, 'pikku-mcp.gen.json');
|
|
171
|
+
}
|
|
172
|
+
if (!result.mcpTypesFile) {
|
|
173
|
+
result.mcpTypesFile = join(mcpDir, 'pikku-mcp-types.gen.ts');
|
|
174
|
+
}
|
|
175
|
+
// CLI
|
|
176
|
+
if (!result.cliWiringsFile) {
|
|
177
|
+
result.cliWiringsFile = join(cliDir, 'pikku-cli-wirings.gen.ts');
|
|
178
|
+
}
|
|
179
|
+
if (!result.cliWiringMetaFile) {
|
|
180
|
+
result.cliWiringMetaFile = join(cliDir, 'pikku-cli-wirings-meta.gen.ts');
|
|
181
|
+
}
|
|
182
|
+
if (!result.cliBootstrapFile) {
|
|
183
|
+
result.cliBootstrapFile = join(cliDir, 'pikku-cli-bootstrap.gen.ts');
|
|
184
|
+
}
|
|
185
|
+
if (!result.cliTypesFile) {
|
|
186
|
+
result.cliTypesFile = join(cliDir, 'pikku-cli-types.gen.ts');
|
|
187
|
+
}
|
|
188
|
+
if (requiredFields.length > 0) {
|
|
189
|
+
validateCLIConfig(result, requiredFields);
|
|
190
|
+
}
|
|
191
|
+
for (const objectKey of Object.keys(result)) {
|
|
192
|
+
if (objectKey.endsWith('File') || objectKey.endsWith('Directory')) {
|
|
193
|
+
const relativeTo = CONFIG_DIR_FILES.includes(objectKey)
|
|
194
|
+
? result.configDir
|
|
195
|
+
: result.rootDir;
|
|
196
|
+
// Only normalize string values to avoid corrupting nested objects
|
|
197
|
+
if (result[objectKey] && typeof result[objectKey] === 'string') {
|
|
198
|
+
if (!isAbsolute(result[objectKey])) {
|
|
199
|
+
result[objectKey] = join(relativeTo, result[objectKey]);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (!isAbsolute(result.tsconfig)) {
|
|
205
|
+
result.tsconfig = join(result.rootDir, result.tsconfig);
|
|
206
|
+
}
|
|
207
|
+
return result;
|
|
208
|
+
}
|
|
209
|
+
catch (e) {
|
|
210
|
+
logger.error(e);
|
|
211
|
+
throw new Error(`Config file not found: ${configFile}`);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
export const validateCLIConfig = (cliConfig, required) => {
|
|
215
|
+
let errors = [];
|
|
216
|
+
for (const key of required) {
|
|
217
|
+
if (!cliConfig[key]) {
|
|
218
|
+
errors.push(key);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (errors.length > 0) {
|
|
222
|
+
throw new Error(`${errors.join(', ')} ${errors.length === 1 ? 'is' : 'are'} required in pikku.config.json`);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InspectorState, InspectorOptions } from '@pikku/inspector';
|
|
2
|
+
interface Meta {
|
|
3
|
+
file: string;
|
|
4
|
+
variable: string;
|
|
5
|
+
type: string;
|
|
6
|
+
typePath: string;
|
|
7
|
+
errors: Map<string, string[]>;
|
|
8
|
+
}
|
|
9
|
+
export type FilesAndMethods = {
|
|
10
|
+
userSessionType: Meta;
|
|
11
|
+
sessionServicesType: Meta;
|
|
12
|
+
singletonServicesType: Meta;
|
|
13
|
+
pikkuConfigFactory: Meta;
|
|
14
|
+
singletonServicesFactory: Meta;
|
|
15
|
+
sessionServicesFactory: Meta;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use state.filesAndMethods from InspectorState instead
|
|
19
|
+
*/
|
|
20
|
+
export declare const getPikkuFilesAndMethods: (state: InspectorState, options?: InspectorOptions["types"]) => Promise<FilesAndMethods>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const getMetaTypes = (type, map, desiredType) => {
|
|
2
|
+
const errors = new Map();
|
|
3
|
+
if (desiredType) {
|
|
4
|
+
for (const [file, meta] of map.entries()) {
|
|
5
|
+
for (const { type: entryType, variable, typePath } of meta) {
|
|
6
|
+
if (entryType === desiredType) {
|
|
7
|
+
if (entryType === null || typePath === null) {
|
|
8
|
+
throw new Error(`Unknown state due to metaType calculation: entryType or typePath is null for ${desiredType} in ${file}`);
|
|
9
|
+
}
|
|
10
|
+
return { file, variable, type: entryType, typePath, errors };
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
errors.set(`No ${desiredType} found that extends ${type}`, map);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const totalValues = Array.from(map.values()).flat();
|
|
18
|
+
if (totalValues.length === 0) {
|
|
19
|
+
const helpMessage = type === 'CoreConfig'
|
|
20
|
+
? `No ${type} found. Make sure you have exported a createConfig function in your codebase:\n\n` +
|
|
21
|
+
`export const createConfig: CreateConfig<Config> = async () => {\n` +
|
|
22
|
+
` return {}\n` +
|
|
23
|
+
`}\n\n` +
|
|
24
|
+
`Possible issues:\n` +
|
|
25
|
+
`- srcDirectories in pikku.config.json doesn't include the file with the createConfig method`
|
|
26
|
+
: `No ${type} found`;
|
|
27
|
+
errors.set(helpMessage, map);
|
|
28
|
+
}
|
|
29
|
+
else if (totalValues.length > 1) {
|
|
30
|
+
errors.set(`More than one ${type} found`, map);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
const entry = Array.from(map.entries())[0];
|
|
34
|
+
if (entry) {
|
|
35
|
+
const [file, [{ type: entryType, variable, typePath }]] = entry;
|
|
36
|
+
if (entryType === null || typePath === null) {
|
|
37
|
+
throw new Error(`Unknown state due to metaType calculation: entryType or typePath is null for ${type} in ${file}`);
|
|
38
|
+
}
|
|
39
|
+
return { file, type: entryType, variable, typePath, errors };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Use state.filesAndMethods from InspectorState instead
|
|
46
|
+
*/
|
|
47
|
+
export const getPikkuFilesAndMethods = async (state, options = {}) => {
|
|
48
|
+
const { singletonServicesTypeImportMap, sessionServicesTypeImportMap, userSessionTypeImportMap, sessionServicesFactories, singletonServicesFactories, configFactories, } = state;
|
|
49
|
+
const { configFileType, userSessionType, singletonServicesFactoryType, sessionServicesFactoryType, } = options;
|
|
50
|
+
let errors = new Map();
|
|
51
|
+
const result = {
|
|
52
|
+
userSessionType: getMetaTypes('CoreUserSession', userSessionTypeImportMap, userSessionType),
|
|
53
|
+
singletonServicesType: getMetaTypes('CoreSingletonServices', singletonServicesTypeImportMap),
|
|
54
|
+
sessionServicesType: getMetaTypes('CoreServices', sessionServicesTypeImportMap),
|
|
55
|
+
pikkuConfigFactory: getMetaTypes('CoreConfig', configFactories, configFileType),
|
|
56
|
+
singletonServicesFactory: getMetaTypes('CreateSingletonServices', singletonServicesFactories, singletonServicesFactoryType),
|
|
57
|
+
sessionServicesFactory: getMetaTypes('CreateSessionServices', sessionServicesFactories, sessionServicesFactoryType),
|
|
58
|
+
};
|
|
59
|
+
if (errors.size > 0) {
|
|
60
|
+
const result = ['Found errors:'];
|
|
61
|
+
errors.forEach((filesAndMethods, message) => {
|
|
62
|
+
result.push(`- ${message}`);
|
|
63
|
+
filesAndMethods.forEach((methods, file) => {
|
|
64
|
+
result.push(`\t* methods: ${methods.map(({ variable, type }) => `${variable}: ${type}`).join(', ')}`);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
throw new Error(result.join('\n'));
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CLILogger } from './utils.js';
|
|
2
1
|
import { FunctionsMeta, JSONValue } from '@pikku/core';
|
|
3
2
|
import { HTTPWiringsMeta } from '@pikku/core/http';
|
|
4
3
|
import { TypesMap } from '@pikku/inspector';
|
|
4
|
+
import { CLILogger } from '../services/cli-logger.service.js';
|
|
5
5
|
export declare function generateSchemas(logger: CLILogger, tsconfig: string, typesMap: TypesMap, functionMeta: FunctionsMeta, httpWiringsMeta: HTTPWiringsMeta, additionalTypes?: string[]): Promise<Record<string, JSONValue>>;
|
|
6
6
|
export declare function saveSchemas(logger: CLILogger, schemaParentDir: string, schemas: Record<string, JSONValue>, typesMap: TypesMap, functionsMeta: FunctionsMeta, supportsImportAttributes: boolean, additionalTypes?: string[]): Promise<void>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createGenerator, RootlessError } from 'ts-json-schema-generator';
|
|
2
|
-
import { writeFileInDir } from './
|
|
2
|
+
import { writeFileInDir } from './file-writer.js';
|
|
3
3
|
import { mkdir, writeFile } from 'fs/promises';
|
|
4
|
+
import { ErrorCode } from '@pikku/inspector';
|
|
4
5
|
export async function generateSchemas(logger, tsconfig, typesMap, functionMeta, httpWiringsMeta, additionalTypes) {
|
|
5
6
|
const schemasSet = new Set(typesMap.customTypes.keys());
|
|
6
7
|
for (const { inputs, outputs } of Object.values(functionMeta)) {
|
|
@@ -51,10 +52,10 @@ export async function generateSchemas(logger, tsconfig, typesMap, functionMeta,
|
|
|
51
52
|
catch (e) {
|
|
52
53
|
// Ignore rootless errors
|
|
53
54
|
if (e instanceof RootlessError) {
|
|
54
|
-
logger.error(`Error generating schema since it has no root: ${schema}`);
|
|
55
|
+
logger.error(`[${ErrorCode.SCHEMA_NO_ROOT}] Error generating schema since it has no root: ${schema}`);
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
|
-
logger.error(`Error generating schema: ${schema}`);
|
|
58
|
+
logger.error(`[${ErrorCode.SCHEMA_GENERATION_ERROR}] Error generating schema: ${schema}. Message: ${e.message}`);
|
|
58
59
|
}
|
|
59
60
|
});
|
|
60
61
|
return schemas;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getFileImportRelativePath } from './
|
|
1
|
+
import { getFileImportRelativePath } from './file-import-path.js';
|
|
2
2
|
export const serializeImportMap = (relativeToPath, packageMappings, typesMap, requiredTypes) => {
|
|
3
3
|
const paths = new Map();
|
|
4
4
|
Array.from(requiredTypes).forEach((requiredType) => {
|
|
@@ -69,9 +69,6 @@ export const serializeImportMap = (relativeToPath, packageMappings, typesMap, re
|
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
const variables = paths.get(path) || [];
|
|
72
|
-
if (uniqueName === '__object') {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
72
|
const importName = originalName === uniqueName
|
|
76
73
|
? originalName
|
|
77
74
|
: `${originalName} as ${uniqueName}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../bin/pikku
|
|
1
|
+
{"root":["../bin/pikku.ts","../src/cli.wiring.ts","../src/services.ts","../src/functions/commands/all.ts","../src/functions/commands/watch.ts","../src/functions/runtimes/nextjs/pikku-command-nextjs.ts","../src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.ts","../src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.ts","../src/functions/wirings/channels/pikku-channels.ts","../src/functions/wirings/channels/pikku-command-channel-types.ts","../src/functions/wirings/channels/pikku-command-channels-map.ts","../src/functions/wirings/channels/pikku-command-channels.ts","../src/functions/wirings/channels/pikku-command-websocket-typed.ts","../src/functions/wirings/channels/serialize-channel-types.ts","../src/functions/wirings/channels/serialize-typed-channel-map.ts","../src/functions/wirings/channels/serialize-websocket-wrapper.ts","../src/functions/wirings/cli/pikku-command-cli-entry.ts","../src/functions/wirings/cli/pikku-command-cli-types.ts","../src/functions/wirings/cli/pikku-command-cli.ts","../src/functions/wirings/cli/serialize-channel-cli-client.ts","../src/functions/wirings/cli/serialize-channel-cli.ts","../src/functions/wirings/cli/serialize-cli-types.ts","../src/functions/wirings/cli/serialize-local-cli-bootstrap.ts","../src/functions/wirings/fetch/index.ts","../src/functions/wirings/functions/pikku-command-function-types-split.ts","../src/functions/wirings/functions/pikku-command-function-types.ts","../src/functions/wirings/functions/pikku-command-functions.ts","../src/functions/wirings/functions/pikku-command-services.ts","../src/functions/wirings/functions/pikku-function-types.ts","../src/functions/wirings/functions/schemas.ts","../src/functions/wirings/functions/serialize-function-imports.ts","../src/functions/wirings/functions/serialize-function-types.ts","../src/functions/wirings/functions/serialize-pikku-types-hub.ts","../src/functions/wirings/http/openapi-spec-generator.ts","../src/functions/wirings/http/pikku-command-http-map.ts","../src/functions/wirings/http/pikku-command-http-routes.ts","../src/functions/wirings/http/pikku-command-http-types.ts","../src/functions/wirings/http/pikku-command-openapi.ts","../src/functions/wirings/http/pikku-http-routes.ts","../src/functions/wirings/http/serialize-fetch-wrapper.ts","../src/functions/wirings/http/serialize-http-types.ts","../src/functions/wirings/http/serialize-typed-http-map.ts","../src/functions/wirings/mcp/pikku-command-mcp-json.ts","../src/functions/wirings/mcp/pikku-command-mcp-types.ts","../src/functions/wirings/mcp/pikku-command-mcp.ts","../src/functions/wirings/mcp/serialize-mcp-json.ts","../src/functions/wirings/mcp/serialize-mcp-types.ts","../src/functions/wirings/middleware/pikku-command-middleware.ts","../src/functions/wirings/middleware/serialize-middleware-groups-meta.ts","../src/functions/wirings/middleware/serialize-middleware-imports.ts","../src/functions/wirings/permissions/pikku-command-permissions.ts","../src/functions/wirings/permissions/serialize-permissions-imports.ts","../src/functions/wirings/queue/pikku-command-queue-map.ts","../src/functions/wirings/queue/pikku-command-queue-service.ts","../src/functions/wirings/queue/pikku-command-queue-types.ts","../src/functions/wirings/queue/pikku-command-queue.ts","../src/functions/wirings/queue/pikku-queue-map.ts","../src/functions/wirings/queue/pikku-queue.ts","../src/functions/wirings/queue/serialize-queue-map.ts","../src/functions/wirings/queue/serialize-queue-meta.ts","../src/functions/wirings/queue/serialize-queue-types.ts","../src/functions/wirings/queue/serialize-queue-wrapper.ts","../src/functions/wirings/rpc/pikku-command-rpc-client.ts","../src/functions/wirings/rpc/pikku-command-rpc-map.ts","../src/functions/wirings/rpc/pikku-command-rpc.ts","../src/functions/wirings/rpc/serialize-rpc-wrapper.ts","../src/functions/wirings/rpc/serialize-typed-rpc-map.ts","../src/functions/wirings/scheduler/pikku-command-scheduler-types.ts","../src/functions/wirings/scheduler/pikku-command-scheduler.ts","../src/functions/wirings/scheduler/serialize-scheduler-meta.ts","../src/functions/wirings/scheduler/serialize-scheduler-types.ts","../src/middleware/log-command-info-and-time.ts","../src/services/cli-logger-forwarder.service.ts","../src/services/cli-logger.service.ts","../src/utils/check-required-types.ts","../src/utils/custom-types-generator.ts","../src/utils/file-import-path.ts","../src/utils/file-imports-serializer.ts","../src/utils/file-writer.ts","../src/utils/generate-bootstrap-file.ts","../src/utils/get-cli-version.ts","../src/utils/pikku-cli-config.ts","../src/utils/pikku-files-and-methods.ts","../src/utils/schema-generator.ts","../src/utils/serialize-import-map.ts","../.pikku/pikku-bootstrap.gen.ts","../.pikku/pikku-services.gen.ts","../.pikku/pikku-types.gen.ts","../.pikku/pikku-websocket.gen.ts","../.pikku/channel/pikku-channel-types.gen.ts","../.pikku/channel/pikku-channels-map.gen.d.ts","../.pikku/channel/pikku-channels-meta.gen.ts","../.pikku/channel/pikku-channels.gen.ts","../.pikku/cli/pikku-cli-channel.gen.ts","../.pikku/cli/pikku-cli-client.gen.ts","../.pikku/cli/pikku-cli-types.gen.ts","../.pikku/cli/pikku-cli-wirings-meta.gen.ts","../.pikku/cli/pikku-cli-wirings.gen.ts","../.pikku/cli/pikku-cli.gen.ts","../.pikku/function/pikku-function-types.gen.ts","../.pikku/function/pikku-functions-meta.gen.ts","../.pikku/function/pikku-functions-meta.min.gen.ts","../.pikku/function/pikku-functions.gen.ts","../.pikku/http/pikku-http-types.gen.ts","../.pikku/http/pikku-http-wirings-map.gen.d.ts","../.pikku/http/pikku-http-wirings-meta.gen.ts","../.pikku/http/pikku-http-wirings.gen.ts","../.pikku/mcp/pikku-mcp-types.gen.ts","../.pikku/mcp/pikku-mcp-wirings-meta.gen.ts","../.pikku/mcp/pikku-mcp-wirings.gen.ts","../.pikku/queue/pikku-queue-types.gen.ts","../.pikku/queue/pikku-queue-workers-wirings-map.gen.d.ts","../.pikku/queue/pikku-queue-workers-wirings-meta.gen.ts","../.pikku/queue/pikku-queue-workers-wirings.gen.ts","../.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts","../.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts","../.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts","../.pikku/scheduler/pikku-scheduler-types.gen.ts","../.pikku/scheduler/pikku-schedulers-wirings-meta.gen.ts","../.pikku/scheduler/pikku-schedulers-wirings.gen.ts","../.pikku/schemas/register.gen.ts","../types/application-types.d.ts","../types/config.d.ts"],"version":"5.9.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikku/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"author": "yasser.fadl@gmail.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"module": "dist/bin/pikku.js",
|
|
12
12
|
"scripts": {
|
|
13
13
|
"tsc": "tsc",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"build": "
|
|
14
|
+
"schema": "ts-json-schema-generator -o cli.schema.json --path 'src/utils/pikku-cli-config.ts' --type 'PikkuCLIConfig'",
|
|
15
|
+
"build": "yarn build:esm",
|
|
16
|
+
"build:esm": "./build.sh",
|
|
17
17
|
"ncu": "npx npm-check-updates -x '/.*glob.*/'",
|
|
18
18
|
"release": "yarn build && npm test",
|
|
19
19
|
"test": "bash run-tests.sh",
|
|
@@ -21,22 +21,24 @@
|
|
|
21
21
|
"test:coverage": "bash run-tests.sh --coverage"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@openapi-contrib/json-schema-to-openapi-schema": "^4.0
|
|
25
|
-
"@pikku/core": "^0.
|
|
26
|
-
"@pikku/inspector": "^0.
|
|
24
|
+
"@openapi-contrib/json-schema-to-openapi-schema": "^4.2.0",
|
|
25
|
+
"@pikku/core": "^0.10.0",
|
|
26
|
+
"@pikku/inspector": "^0.10.0",
|
|
27
27
|
"@types/cookie": "^1.0.0",
|
|
28
|
-
"@types/
|
|
29
|
-
"
|
|
28
|
+
"@types/json-schema": "^7.0.15",
|
|
29
|
+
"@types/uuid": "^11.0.0",
|
|
30
|
+
"chalk": "^5.6.2",
|
|
30
31
|
"chokidar": "^4.0.3",
|
|
31
32
|
"commander": "^14",
|
|
32
|
-
"
|
|
33
|
+
"openapi-types": "^12.1.3",
|
|
34
|
+
"path-to-regexp": "^8.3.0",
|
|
33
35
|
"tinyglobby": "^0.2.12",
|
|
34
36
|
"ts-json-schema-generator": "^2.4.0",
|
|
35
37
|
"typescript": "^5.9",
|
|
36
38
|
"yaml": "^2.8.1"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
|
-
"@types/node": "^24.
|
|
41
|
+
"@types/node": "^24.9.1"
|
|
40
42
|
},
|
|
41
43
|
"engines": {
|
|
42
44
|
"node": ">=18"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/pikkujs/pikku/refs/heads/main/packages/cli/cli.schema.json",
|
|
3
|
+
"tsconfig": "./tsconfig.json",
|
|
4
|
+
"srcDirectories": ["src", "bin", "types"],
|
|
5
|
+
"outDir": ".pikku",
|
|
6
|
+
"packageMappings": {
|
|
7
|
+
"../inspector/src": "@pikku/inspector"
|
|
8
|
+
},
|
|
9
|
+
"supportsImportAttributes": true,
|
|
10
|
+
"schemasFromTypes": ["PikkuCLIConfig"],
|
|
11
|
+
"websocketFile": ".pikku/pikku-websocket.gen.ts",
|
|
12
|
+
"cli": {
|
|
13
|
+
"entrypoints": {
|
|
14
|
+
"pikku": [
|
|
15
|
+
".pikku/cli/pikku-cli.gen.ts",
|
|
16
|
+
{
|
|
17
|
+
"type": "channel",
|
|
18
|
+
"wirePath": ".pikku/cli/pikku-cli-channel.gen.ts",
|
|
19
|
+
"path": ".pikku/cli/pikku-cli-client.gen.ts",
|
|
20
|
+
"name": "pikku-cli",
|
|
21
|
+
"route": "/cli/pikku"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { pikkuSchemas } from './functions/wirings/functions/schemas.js'
|
|
2
|
+
import { pikkuFetch } from './functions/wirings/fetch/index.js'
|
|
3
|
+
import { pikkuWebSocketTyped } from './functions/wirings/channels/pikku-command-websocket-typed.js'
|
|
4
|
+
import { pikkuRPCClient } from './functions/wirings/rpc/pikku-command-rpc-client.js'
|
|
5
|
+
import { pikkuQueueService } from './functions/wirings/queue/pikku-command-queue-service.js'
|
|
6
|
+
import { pikkuOpenAPI } from './functions/wirings/http/pikku-command-openapi.js'
|
|
7
|
+
import { pikkuNext } from './functions/runtimes/nextjs/pikku-command-nextjs.js'
|
|
8
|
+
import { pikkuCLICommand, wireCLI } from '../.pikku/cli/pikku-cli-types.gen.js'
|
|
9
|
+
import { all } from './functions/commands/all.js'
|
|
10
|
+
import { clientCLIRenderer } from './services.js'
|
|
11
|
+
|
|
12
|
+
wireCLI({
|
|
13
|
+
program: 'pikku',
|
|
14
|
+
description:
|
|
15
|
+
'Pikku CLI - Code generation tool for type-safe backend development',
|
|
16
|
+
render: clientCLIRenderer,
|
|
17
|
+
options: {
|
|
18
|
+
config: {
|
|
19
|
+
description: 'Path to pikku.config.json file',
|
|
20
|
+
short: 'c',
|
|
21
|
+
},
|
|
22
|
+
logLevel: {
|
|
23
|
+
description: 'Set log level',
|
|
24
|
+
default: 'info' as const,
|
|
25
|
+
short: 'l',
|
|
26
|
+
},
|
|
27
|
+
userSessionType: {
|
|
28
|
+
description:
|
|
29
|
+
'Specify which UserSession type to use (when multiple exist)',
|
|
30
|
+
},
|
|
31
|
+
singletonServicesFactoryType: {
|
|
32
|
+
description: 'Specify which singleton services factory to use',
|
|
33
|
+
},
|
|
34
|
+
sessionServicesFactoryType: {
|
|
35
|
+
description: 'Specify which session services factory to use',
|
|
36
|
+
},
|
|
37
|
+
stateOutput: {
|
|
38
|
+
description: 'Save inspector state to JSON file for reuse',
|
|
39
|
+
},
|
|
40
|
+
stateInput: {
|
|
41
|
+
description: 'Load inspector state from JSON file (skips inspection)',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
commands: {
|
|
45
|
+
all: pikkuCLICommand({
|
|
46
|
+
func: all,
|
|
47
|
+
description: 'Generate all Pikku files (types, schemas, wirings, etc.)',
|
|
48
|
+
isDefault: true,
|
|
49
|
+
options: {
|
|
50
|
+
tags: {
|
|
51
|
+
description: 'Filter functions by tags (comma-separated)',
|
|
52
|
+
short: 't',
|
|
53
|
+
},
|
|
54
|
+
types: {
|
|
55
|
+
description: 'Filter functions by types (comma-separated)',
|
|
56
|
+
},
|
|
57
|
+
directories: {
|
|
58
|
+
description: 'Filter functions by directories (comma-separated)',
|
|
59
|
+
short: 'd',
|
|
60
|
+
},
|
|
61
|
+
httpMethods: {
|
|
62
|
+
description: 'Filter HTTP routes by methods (comma-separated)',
|
|
63
|
+
},
|
|
64
|
+
httpRoutes: {
|
|
65
|
+
description: 'Filter HTTP routes by route patterns (comma-separated)',
|
|
66
|
+
},
|
|
67
|
+
names: {
|
|
68
|
+
description: 'Filter functions by name patterns (supports wildcards)',
|
|
69
|
+
short: 'n',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
}),
|
|
73
|
+
schemas: pikkuCLICommand({
|
|
74
|
+
func: pikkuSchemas,
|
|
75
|
+
description: 'Generate JSON schemas for function input/output types',
|
|
76
|
+
}),
|
|
77
|
+
fetch: pikkuCLICommand({
|
|
78
|
+
func: pikkuFetch,
|
|
79
|
+
description: 'Generate type-safe HTTP fetch client',
|
|
80
|
+
}),
|
|
81
|
+
websocket: pikkuCLICommand({
|
|
82
|
+
func: pikkuWebSocketTyped,
|
|
83
|
+
description: 'Generate type-safe WebSocket client',
|
|
84
|
+
}),
|
|
85
|
+
rpc: pikkuCLICommand({
|
|
86
|
+
func: pikkuRPCClient,
|
|
87
|
+
description: 'Generate RPC client wrappers',
|
|
88
|
+
}),
|
|
89
|
+
'queue-service': pikkuCLICommand({
|
|
90
|
+
func: pikkuQueueService,
|
|
91
|
+
description: 'Generate queue service wrapper',
|
|
92
|
+
}),
|
|
93
|
+
openapi: pikkuCLICommand({
|
|
94
|
+
func: pikkuOpenAPI,
|
|
95
|
+
description: 'Generate OpenAPI specification from HTTP routes',
|
|
96
|
+
}),
|
|
97
|
+
nextjs: pikkuCLICommand({
|
|
98
|
+
func: pikkuNext,
|
|
99
|
+
description: 'Generate Next.js backend and HTTP wrappers',
|
|
100
|
+
}),
|
|
101
|
+
},
|
|
102
|
+
})
|