@pikku/cli 0.9.14 → 0.9.16-next.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 +92 -0
- package/.pikku/cli/pikku-cli-types.gen.ts +71 -0
- package/.pikku/cli/pikku-cli-wirings-meta.gen.ts +5 -0
- package/.pikku/cli/pikku-cli-wirings.gen.ts +4 -0
- package/.pikku/function/pikku-function-types.gen.ts +292 -0
- package/.pikku/function/pikku-functions-meta.gen.ts +817 -0
- package/.pikku/function/pikku-functions-meta.min.gen.ts +176 -0
- package/.pikku/function/pikku-functions.gen.ts +74 -0
- package/.pikku/http/pikku-http-types.gen.ts +61 -0
- package/.pikku/mcp/pikku-mcp-types.gen.ts +138 -0
- package/.pikku/pikku-bootstrap.gen.ts +9 -0
- package/.pikku/pikku-services.gen.ts +24 -0
- package/.pikku/pikku-types.gen.ts +28 -0
- package/.pikku/queue/pikku-queue-types.gen.ts +28 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +46 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +80 -0
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +40 -0
- package/.pikku/scheduler/pikku-scheduler-types.gen.ts +26 -0
- package/.pikku/schemas/register.gen.ts +47 -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/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 +45 -14
- package/build.sh +53 -0
- package/cli.schema.json +1 -382
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +65 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.js +54 -0
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +55 -0
- package/dist/.pikku/cli/pikku-cli-types.gen.js +30 -0
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +5 -0
- package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +4 -0
- package/dist/.pikku/cli/pikku-cli-wirings.gen.js +5 -0
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +259 -0
- package/dist/.pikku/function/pikku-function-types.gen.js +175 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.d.ts +1 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.js +817 -0
- package/dist/.pikku/function/pikku-functions-meta.min.gen.d.ts +1 -0
- package/dist/.pikku/function/pikku-functions-meta.min.gen.js +176 -0
- package/dist/.pikku/function/pikku-functions.gen.d.ts +1 -0
- package/dist/.pikku/function/pikku-functions.gen.js +73 -0
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +49 -0
- package/dist/.pikku/http/pikku-http-types.gen.js +41 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +88 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +71 -0
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +9 -0
- package/dist/.pikku/pikku-bootstrap.gen.js +9 -0
- package/dist/.pikku/pikku-services.gen.d.ts +16 -0
- package/dist/.pikku/pikku-services.gen.js +11 -0
- package/dist/.pikku/pikku-types.gen.d.ts +14 -0
- package/dist/.pikku/pikku-types.gen.js +21 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +24 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.js +17 -0
- package/dist/.pikku/rpc/pikku-bootstrap-rpc.gen.d.ts +6 -0
- package/dist/.pikku/rpc/pikku-bootstrap-rpc.gen.js +6 -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 +40 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +22 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +17 -0
- package/dist/.pikku/schemas/register.gen.d.ts +1 -0
- package/dist/.pikku/schemas/register.gen.js +26 -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/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.d.ts +1 -1
- package/dist/bin/pikku.js +32 -14
- package/dist/src/cli.wiring.d.ts +1 -0
- package/dist/src/cli.wiring.js +75 -0
- package/dist/src/functions/commands/all.d.ts +1 -0
- package/dist/src/functions/commands/all.js +104 -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 +28 -9
- package/dist/src/functions/wirings/channels/pikku-channels.d.ts +1 -0
- package/dist/src/functions/wirings/channels/pikku-channels.js +24 -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 +21 -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 +23 -0
- package/dist/src/functions/wirings/channels/pikku-command-channels.d.ts +1 -0
- package/dist/src/functions/wirings/channels/pikku-command-channels.js +25 -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 +24 -0
- package/dist/src/functions/wirings/channels/serialize-channel-types.d.ts +4 -0
- package/dist/src/functions/wirings/channels/serialize-channel-types.js +95 -0
- package/dist/src/{wirings → functions/wirings}/channels/serialize-typed-channel-map.js +2 -2
- 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 +100 -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 +33 -0
- package/dist/src/functions/wirings/cli/pikku-command-cli.d.ts +1 -0
- package/dist/src/functions/wirings/cli/pikku-command-cli.js +24 -0
- package/dist/src/functions/wirings/cli/serialize-channel-cli-client.d.ts +7 -0
- package/dist/src/functions/wirings/cli/serialize-channel-cli-client.js +54 -0
- package/dist/src/functions/wirings/cli/serialize-channel-cli.d.ts +9 -0
- package/dist/src/functions/wirings/cli/serialize-channel-cli.js +84 -0
- package/dist/src/functions/wirings/cli/serialize-cli-types.d.ts +4 -0
- package/dist/src/functions/wirings/cli/serialize-cli-types.js +74 -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 +46 -0
- package/dist/src/functions/wirings/fetch/index.d.ts +1 -0
- package/dist/src/functions/wirings/fetch/index.js +24 -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 +32 -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 +20 -0
- package/dist/src/functions/wirings/functions/pikku-command-functions.d.ts +1 -0
- package/dist/src/functions/wirings/functions/pikku-command-functions.js +28 -0
- package/dist/src/{wirings → functions/wirings}/functions/pikku-command-services.d.ts +1 -2
- package/dist/src/{wirings → functions/wirings}/functions/pikku-command-services.js +27 -10
- package/dist/src/functions/wirings/functions/pikku-function-types.d.ts +1 -0
- package/dist/src/functions/wirings/functions/pikku-function-types.js +20 -0
- package/dist/src/functions/wirings/functions/schemas.d.ts +4 -0
- package/dist/src/functions/wirings/functions/schemas.js +22 -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 +295 -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 +31 -0
- package/dist/src/{wirings → functions/wirings}/http/openapi-spec-generator.d.ts +2 -1
- 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 +23 -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 +25 -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 +21 -0
- package/dist/src/functions/wirings/http/pikku-command-openapi.d.ts +1 -0
- package/dist/src/functions/wirings/http/pikku-command-openapi.js +34 -0
- package/dist/src/functions/wirings/http/pikku-http-routes.d.ts +1 -0
- package/dist/src/functions/wirings/http/pikku-http-routes.js +25 -0
- package/dist/src/functions/wirings/http/serialize-http-types.d.ts +4 -0
- package/dist/src/functions/wirings/http/serialize-http-types.js +64 -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 +28 -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 +21 -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 +22 -5
- package/dist/src/{wirings → functions/wirings}/mcp/serialize-mcp-json.d.ts +1 -1
- package/dist/src/functions/wirings/mcp/serialize-mcp-types.d.ts +4 -0
- package/dist/src/functions/wirings/mcp/serialize-mcp-types.js +141 -0
- package/dist/src/functions/wirings/middleware/pikku-command-middleware.d.ts +1 -0
- package/dist/src/functions/wirings/middleware/pikku-command-middleware.js +38 -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 +50 -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/queue/pikku-command-queue-map.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue-map.js +23 -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 +24 -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 +21 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue.js +26 -0
- package/dist/src/functions/wirings/queue/pikku-queue-map.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-queue-map.js +23 -0
- package/dist/src/functions/wirings/queue/pikku-queue.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-queue.js +25 -0
- package/dist/src/{wirings → functions/wirings}/queue/serialize-queue-map.js +2 -2
- package/dist/src/functions/wirings/queue/serialize-queue-types.d.ts +4 -0
- package/dist/src/functions/wirings/queue/serialize-queue-types.js +31 -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 +25 -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 +36 -0
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.d.ts +1 -0
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +22 -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 +21 -0
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.d.ts +1 -0
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.js +26 -0
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-types.d.ts +4 -0
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-types.js +29 -0
- package/dist/src/middleware/log-command-info-and-time.d.ts +19 -0
- package/dist/src/middleware/log-command-info-and-time.js +27 -0
- package/dist/src/serialize-pikku-types.js +2 -2
- package/dist/src/services/cli-logger-forwarder.service.d.ts +26 -0
- package/dist/src/services/cli-logger-forwarder.service.js +55 -0
- package/dist/src/services/cli-logger.service.d.ts +19 -0
- package/dist/src/services/cli-logger.service.js +66 -0
- package/dist/src/services.d.ts +15 -0
- package/dist/src/services.js +64 -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 +37 -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 +6 -0
- package/dist/src/utils/file-writer.js +40 -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/pikku-cli-config.d.ts +5 -0
- package/dist/src/utils/pikku-cli-config.js +243 -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} +1 -1
- package/dist/src/{serialize-import-map.js → utils/serialize-import-map.js} +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/pikku.config.json +24 -0
- package/src/cli.wiring.ts +75 -0
- package/src/functions/commands/all.ts +141 -0
- package/src/functions/commands/watch.ts +58 -0
- package/src/functions/runtimes/nextjs/pikku-command-nextjs.ts +111 -0
- package/src/functions/wirings/channels/pikku-channels.ts +40 -0
- package/src/functions/wirings/channels/pikku-command-channel-types.ts +27 -0
- package/src/functions/wirings/channels/pikku-command-channels-map.ts +31 -0
- package/src/functions/wirings/channels/pikku-command-channels.ts +45 -0
- package/src/functions/wirings/channels/pikku-command-websocket-typed.ts +33 -0
- package/src/functions/wirings/channels/serialize-channel-types.ts +95 -0
- package/src/{wirings → functions/wirings}/channels/serialize-typed-channel-map.ts +2 -2
- package/src/functions/wirings/cli/pikku-command-cli-entry.ts +173 -0
- package/src/functions/wirings/cli/pikku-command-cli-types.ts +50 -0
- package/src/functions/wirings/cli/pikku-command-cli.ts +41 -0
- package/src/functions/wirings/cli/serialize-channel-cli-client.ts +72 -0
- package/src/functions/wirings/cli/serialize-channel-cli.ts +123 -0
- package/src/functions/wirings/cli/serialize-cli-types.ts +80 -0
- package/src/functions/wirings/cli/serialize-local-cli-bootstrap.ts +75 -0
- package/src/functions/wirings/fetch/index.ts +32 -0
- package/src/functions/wirings/functions/pikku-command-function-types-split.ts +51 -0
- package/src/functions/wirings/functions/pikku-command-function-types.ts +45 -0
- package/src/functions/wirings/functions/pikku-command-functions.ts +61 -0
- package/src/{wirings → functions/wirings}/functions/pikku-command-services.ts +41 -44
- package/src/functions/wirings/functions/pikku-function-types.ts +45 -0
- package/src/functions/wirings/functions/schemas.ts +47 -0
- package/src/{wirings → functions/wirings}/functions/serialize-function-imports.ts +4 -30
- package/src/functions/wirings/functions/serialize-function-types.ts +303 -0
- package/src/functions/wirings/functions/serialize-pikku-types-hub.ts +39 -0
- package/src/{wirings → functions/wirings}/http/openapi-spec-generator.ts +3 -1
- package/src/functions/wirings/http/pikku-command-http-map.ts +32 -0
- package/src/functions/wirings/http/pikku-command-http-routes.ts +41 -0
- package/src/functions/wirings/http/pikku-command-http-types.ts +27 -0
- package/src/functions/wirings/http/pikku-command-openapi.ts +57 -0
- package/src/functions/wirings/http/pikku-http-routes.ts +40 -0
- package/src/functions/wirings/http/serialize-http-types.ts +64 -0
- package/src/{wirings → functions/wirings}/http/serialize-typed-http-map.ts +2 -2
- package/src/functions/wirings/mcp/pikku-command-mcp-json.ts +38 -0
- package/src/functions/wirings/mcp/pikku-command-mcp-types.ts +27 -0
- package/src/{wirings → functions/wirings}/mcp/pikku-command-mcp.ts +55 -46
- package/src/{wirings → functions/wirings}/mcp/serialize-mcp-json.ts +1 -1
- package/src/functions/wirings/mcp/serialize-mcp-types.ts +141 -0
- package/src/functions/wirings/middleware/pikku-command-middleware.ts +65 -0
- package/src/functions/wirings/middleware/serialize-middleware-groups-meta.ts +61 -0
- package/src/functions/wirings/middleware/serialize-middleware-imports.ts +78 -0
- package/src/functions/wirings/queue/pikku-command-queue-map.ts +31 -0
- package/src/functions/wirings/queue/pikku-command-queue-service.ts +33 -0
- package/src/functions/wirings/queue/pikku-command-queue-types.ts +27 -0
- package/src/functions/wirings/queue/pikku-command-queue.ts +46 -0
- package/src/functions/wirings/queue/pikku-queue-map.ts +31 -0
- package/src/functions/wirings/queue/pikku-queue.ts +44 -0
- package/src/{wirings → functions/wirings}/queue/serialize-queue-map.ts +2 -2
- package/src/functions/wirings/queue/serialize-queue-types.ts +31 -0
- package/src/functions/wirings/rpc/pikku-command-rpc-client.ts +32 -0
- package/src/functions/wirings/rpc/pikku-command-rpc-map.ts +52 -0
- package/src/functions/wirings/rpc/pikku-command-rpc.ts +28 -0
- package/src/{wirings → functions/wirings}/rpc/serialize-typed-rpc-map.ts +2 -2
- package/src/functions/wirings/scheduler/pikku-command-scheduler-types.ts +27 -0
- package/src/functions/wirings/scheduler/pikku-command-scheduler.ts +46 -0
- package/src/functions/wirings/scheduler/serialize-scheduler-types.ts +29 -0
- package/src/middleware/log-command-info-and-time.ts +61 -0
- package/src/serialize-pikku-types.ts +2 -2
- package/src/services/cli-logger-forwarder.service.ts +77 -0
- package/src/services/cli-logger.service.ts +78 -0
- package/src/services.ts +111 -0
- package/src/utils/check-required-types.ts +53 -0
- package/src/utils/custom-types-generator.ts +49 -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 +56 -0
- package/src/utils/generate-bootstrap-file.ts +43 -0
- package/src/utils/pikku-cli-config.ts +356 -0
- package/src/utils/pikku-files-and-methods.ts +148 -0
- package/src/{schema-generator.ts → utils/schema-generator.ts} +3 -1
- package/src/{serialize-import-map.ts → utils/serialize-import-map.ts} +1 -1
- package/tsconfig.json +2 -2
- package/types/application-types.d.ts +20 -0
- package/types/config.d.ts +192 -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/schemas.d.ts +0 -2
- package/dist/src/schemas.js +0 -8
- 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-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/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-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/cli/pikku-cli-wirings-meta.gen.d.ts} +0 -0
- /package/dist/src/{runtimes → functions/runtimes}/nextjs/serialize-nextjs-backend-wrapper.d.ts +0 -0
- /package/dist/src/{runtimes → functions/runtimes}/nextjs/serialize-nextjs-backend-wrapper.js +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.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-backend-wrapper.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-meta.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,44 @@
|
|
|
1
|
+
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
2
|
+
import { serializeFileImports } from '../../../utils/file-imports-serializer.js'
|
|
3
|
+
import { writeFileInDir } from '../../../utils/file-writer.js'
|
|
4
|
+
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js'
|
|
5
|
+
import { serializeQueueMeta } from './serialize-queue-meta.js'
|
|
6
|
+
|
|
7
|
+
export const pikkuQueue: any = pikkuSessionlessFunc<void, void>({
|
|
8
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
9
|
+
const visitState = await getInspectorState()
|
|
10
|
+
const {
|
|
11
|
+
queueWorkersWiringFile,
|
|
12
|
+
queueWorkersWiringMetaFile,
|
|
13
|
+
packageMappings,
|
|
14
|
+
} = config
|
|
15
|
+
const { queueWorkers } = visitState
|
|
16
|
+
|
|
17
|
+
await writeFileInDir(
|
|
18
|
+
logger,
|
|
19
|
+
queueWorkersWiringMetaFile,
|
|
20
|
+
serializeQueueMeta(queueWorkers.meta)
|
|
21
|
+
)
|
|
22
|
+
await writeFileInDir(
|
|
23
|
+
logger,
|
|
24
|
+
queueWorkersWiringFile,
|
|
25
|
+
serializeFileImports(
|
|
26
|
+
'addQueueWorkers',
|
|
27
|
+
queueWorkersWiringFile,
|
|
28
|
+
queueWorkers.files,
|
|
29
|
+
packageMappings
|
|
30
|
+
)
|
|
31
|
+
)
|
|
32
|
+
},
|
|
33
|
+
middleware: [
|
|
34
|
+
logCommandInfoAndTime({
|
|
35
|
+
commandStart: 'Finding queues',
|
|
36
|
+
commandEnd: 'Found queue',
|
|
37
|
+
skipCondition: async ({ getInspectorState }) => {
|
|
38
|
+
const { queueWorkers } = await getInspectorState()
|
|
39
|
+
return queueWorkers.files.size === 0
|
|
40
|
+
},
|
|
41
|
+
skipMessage: 'none found',
|
|
42
|
+
}),
|
|
43
|
+
],
|
|
44
|
+
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { queueWorkersMeta } from '@pikku/core/queue'
|
|
2
|
-
import { serializeImportMap } from '
|
|
2
|
+
import { serializeImportMap } from '../../../utils/serialize-import-map.js'
|
|
3
3
|
import { TypesMap } from '@pikku/inspector'
|
|
4
4
|
import { FunctionsMeta } from '@pikku/core'
|
|
5
|
-
import { generateCustomTypes } from '
|
|
5
|
+
import { generateCustomTypes } from '../../../utils/custom-types-generator.js'
|
|
6
6
|
|
|
7
7
|
export const serializeQueueMap = (
|
|
8
8
|
relativeToPath: string,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates type definitions for queue wirings
|
|
3
|
+
*/
|
|
4
|
+
export const serializeQueueTypes = (functionTypesImportPath: string) => {
|
|
5
|
+
return `/**
|
|
6
|
+
* This file was generated by the @pikku/cli
|
|
7
|
+
* Queue-specific type definitions for tree-shaking optimization
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { CoreQueueWorker, wireQueueWorker as wireQueueWorkerCore } from '@pikku/core/queue'
|
|
11
|
+
import type { PikkuFunctionConfig } from '${functionTypesImportPath}'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Type definition for queue workers that process background jobs.
|
|
15
|
+
*
|
|
16
|
+
* @template In - Input type for the queue job
|
|
17
|
+
* @template Out - Output type for the queue job
|
|
18
|
+
*/
|
|
19
|
+
type QueueWiring<In, Out> = CoreQueueWorker<PikkuFunctionConfig<In, Out>>
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Registers a queue worker with the Pikku framework.
|
|
23
|
+
* Workers process background jobs from queues.
|
|
24
|
+
*
|
|
25
|
+
* @param queueWorker - Queue worker definition with job handler
|
|
26
|
+
*/
|
|
27
|
+
export const wireQueueWorker = (queueWorker: QueueWiring<any, any>) => {
|
|
28
|
+
wireQueueWorkerCore(queueWorker as any) // TODO
|
|
29
|
+
}
|
|
30
|
+
`
|
|
31
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
2
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js'
|
|
3
|
+
import { writeFileInDir } from '../../../utils/file-writer.js'
|
|
4
|
+
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js'
|
|
5
|
+
import { serializeRPCWrapper } from './serialize-rpc-wrapper.js'
|
|
6
|
+
|
|
7
|
+
export const pikkuRPCClient: any = pikkuSessionlessFunc<void, void>({
|
|
8
|
+
func: async ({ logger, config }) => {
|
|
9
|
+
const { rpcWiringsFile, rpcMapDeclarationFile, packageMappings } = config
|
|
10
|
+
|
|
11
|
+
if (!rpcWiringsFile) {
|
|
12
|
+
return
|
|
13
|
+
// TODO: throw new Error("rpcWiringsFile isn't set in the pikku config")
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const rpcMapDeclarationPath = getFileImportRelativePath(
|
|
17
|
+
rpcWiringsFile,
|
|
18
|
+
rpcMapDeclarationFile,
|
|
19
|
+
packageMappings
|
|
20
|
+
)
|
|
21
|
+
const content = [serializeRPCWrapper(rpcMapDeclarationPath)]
|
|
22
|
+
await writeFileInDir(logger, rpcWiringsFile, content.join('\n'))
|
|
23
|
+
},
|
|
24
|
+
middleware: [
|
|
25
|
+
logCommandInfoAndTime({
|
|
26
|
+
commandStart: 'Generating RPC wrappers',
|
|
27
|
+
commandEnd: 'Generated RPC wrappers',
|
|
28
|
+
skipCondition: ({ config }) => config.rpcWiringsFile === undefined,
|
|
29
|
+
skipMessage: "rpcWiringsFile isn't set in the pikku config",
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
})
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
2
|
+
import { writeFileInDir } from '../../../utils/file-writer.js'
|
|
3
|
+
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js'
|
|
4
|
+
import { serializeTypedRPCMap } from './serialize-typed-rpc-map.js'
|
|
5
|
+
|
|
6
|
+
export const pikkuRPCInternalMap: any = pikkuSessionlessFunc<void, void>({
|
|
7
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
8
|
+
const { functions, rpc } = await getInspectorState()
|
|
9
|
+
const { rpcInternalMapDeclarationFile, packageMappings } = config
|
|
10
|
+
|
|
11
|
+
const content = serializeTypedRPCMap(
|
|
12
|
+
rpcInternalMapDeclarationFile,
|
|
13
|
+
packageMappings,
|
|
14
|
+
functions.typesMap,
|
|
15
|
+
functions.meta,
|
|
16
|
+
rpc.internalMeta
|
|
17
|
+
)
|
|
18
|
+
await writeFileInDir(logger, rpcInternalMapDeclarationFile, content)
|
|
19
|
+
},
|
|
20
|
+
middleware: [
|
|
21
|
+
logCommandInfoAndTime({
|
|
22
|
+
commandStart: 'Creating RPC internal map',
|
|
23
|
+
commandEnd: 'Created RPC internal map',
|
|
24
|
+
skipCondition: false,
|
|
25
|
+
skipMessage: '',
|
|
26
|
+
}),
|
|
27
|
+
],
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
export const pikkuRPCExposedMap: any = pikkuSessionlessFunc<void, void>({
|
|
31
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
32
|
+
const { functions, rpc } = await getInspectorState()
|
|
33
|
+
const { rpcMapDeclarationFile, packageMappings } = config
|
|
34
|
+
|
|
35
|
+
const content = serializeTypedRPCMap(
|
|
36
|
+
rpcMapDeclarationFile,
|
|
37
|
+
packageMappings,
|
|
38
|
+
functions.typesMap,
|
|
39
|
+
functions.meta,
|
|
40
|
+
rpc.exposedMeta
|
|
41
|
+
)
|
|
42
|
+
await writeFileInDir(logger, rpcMapDeclarationFile, content)
|
|
43
|
+
},
|
|
44
|
+
middleware: [
|
|
45
|
+
logCommandInfoAndTime({
|
|
46
|
+
commandStart: 'Creating RPC external map',
|
|
47
|
+
commandEnd: 'Created RPC external map',
|
|
48
|
+
skipCondition: false,
|
|
49
|
+
skipMessage: '',
|
|
50
|
+
}),
|
|
51
|
+
],
|
|
52
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
2
|
+
import { writeFileInDir } from '../../../utils/file-writer.js'
|
|
3
|
+
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js'
|
|
4
|
+
|
|
5
|
+
export const pikkuRPC: any = pikkuSessionlessFunc<void, boolean>({
|
|
6
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
7
|
+
const { rpc } = await getInspectorState()
|
|
8
|
+
const { rpcInternalWiringMetaFile } = config
|
|
9
|
+
|
|
10
|
+
if (rpc.internalFiles.size > 0) {
|
|
11
|
+
await writeFileInDir(
|
|
12
|
+
logger,
|
|
13
|
+
rpcInternalWiringMetaFile,
|
|
14
|
+
`import { pikkuState } from '@pikku/core'\npikkuState('rpc', 'meta', ${JSON.stringify(rpc.internalMeta, null, 2)})`
|
|
15
|
+
)
|
|
16
|
+
return true
|
|
17
|
+
}
|
|
18
|
+
return false
|
|
19
|
+
},
|
|
20
|
+
middleware: [
|
|
21
|
+
logCommandInfoAndTime({
|
|
22
|
+
commandStart: 'Finding RPCs tasks',
|
|
23
|
+
commandEnd: 'Found RPCs',
|
|
24
|
+
skipCondition: false,
|
|
25
|
+
skipMessage: '',
|
|
26
|
+
}),
|
|
27
|
+
],
|
|
28
|
+
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { serializeImportMap } from '
|
|
1
|
+
import { serializeImportMap } from '../../../utils/serialize-import-map.js'
|
|
2
2
|
import { TypesMap } from '@pikku/inspector'
|
|
3
3
|
import { FunctionsMeta } from '@pikku/core'
|
|
4
|
-
import { generateCustomTypes } from '
|
|
4
|
+
import { generateCustomTypes } from '../../../utils/custom-types-generator.js'
|
|
5
5
|
|
|
6
6
|
export const serializeTypedRPCMap = (
|
|
7
7
|
relativeToPath: string,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
2
|
+
import { writeFileInDir } from '../../../utils/file-writer.js'
|
|
3
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js'
|
|
4
|
+
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js'
|
|
5
|
+
import { serializeSchedulerTypes } from './serialize-scheduler-types.js'
|
|
6
|
+
|
|
7
|
+
export const pikkuSchedulerTypes: any = pikkuSessionlessFunc<void, void>({
|
|
8
|
+
func: async ({ logger, config }) => {
|
|
9
|
+
const { schedulersTypesFile, functionTypesFile, packageMappings } = config
|
|
10
|
+
|
|
11
|
+
const functionTypesImportPath = getFileImportRelativePath(
|
|
12
|
+
schedulersTypesFile,
|
|
13
|
+
functionTypesFile,
|
|
14
|
+
packageMappings
|
|
15
|
+
)
|
|
16
|
+
const content = serializeSchedulerTypes(functionTypesImportPath)
|
|
17
|
+
await writeFileInDir(logger, schedulersTypesFile, content)
|
|
18
|
+
},
|
|
19
|
+
middleware: [
|
|
20
|
+
logCommandInfoAndTime({
|
|
21
|
+
commandStart: 'Creating cheduler types',
|
|
22
|
+
commandEnd: 'Created scheduler types',
|
|
23
|
+
skipCondition: false,
|
|
24
|
+
skipMessage: '',
|
|
25
|
+
}),
|
|
26
|
+
],
|
|
27
|
+
})
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
2
|
+
import { serializeFileImports } from '../../../utils/file-imports-serializer.js'
|
|
3
|
+
import { writeFileInDir } from '../../../utils/file-writer.js'
|
|
4
|
+
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js'
|
|
5
|
+
import { serializeSchedulerMeta } from './serialize-scheduler-meta.js'
|
|
6
|
+
|
|
7
|
+
export const pikkuScheduler: any = pikkuSessionlessFunc<
|
|
8
|
+
void,
|
|
9
|
+
boolean | undefined
|
|
10
|
+
>({
|
|
11
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
12
|
+
const visitState = await getInspectorState()
|
|
13
|
+
const { schedulersWiringFile, schedulersWiringMetaFile, packageMappings } =
|
|
14
|
+
config
|
|
15
|
+
const { scheduledTasks } = visitState
|
|
16
|
+
|
|
17
|
+
await writeFileInDir(
|
|
18
|
+
logger,
|
|
19
|
+
schedulersWiringMetaFile,
|
|
20
|
+
serializeSchedulerMeta(scheduledTasks.meta)
|
|
21
|
+
)
|
|
22
|
+
await writeFileInDir(
|
|
23
|
+
logger,
|
|
24
|
+
schedulersWiringFile,
|
|
25
|
+
serializeFileImports(
|
|
26
|
+
'addScheduledTasks',
|
|
27
|
+
schedulersWiringFile,
|
|
28
|
+
scheduledTasks.files,
|
|
29
|
+
packageMappings
|
|
30
|
+
)
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
return true
|
|
34
|
+
},
|
|
35
|
+
middleware: [
|
|
36
|
+
logCommandInfoAndTime({
|
|
37
|
+
commandStart: 'Finding Scheduled tasks',
|
|
38
|
+
commandEnd: 'Found Scheduled tasks',
|
|
39
|
+
skipCondition: async ({ getInspectorState }) => {
|
|
40
|
+
const visitState = await getInspectorState()
|
|
41
|
+
return visitState.scheduledTasks.files.size === 0
|
|
42
|
+
},
|
|
43
|
+
skipMessage: 'none found',
|
|
44
|
+
}),
|
|
45
|
+
],
|
|
46
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates type definitions for scheduler wirings
|
|
3
|
+
*/
|
|
4
|
+
export const serializeSchedulerTypes = (functionTypesImportPath: string) => {
|
|
5
|
+
return `/**
|
|
6
|
+
* This file was generated by the @pikku/cli
|
|
7
|
+
* Scheduler-specific type definitions for tree-shaking optimization
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { CoreScheduledTask, wireScheduler as wireSchedulerCore } from '@pikku/core/scheduler'
|
|
11
|
+
import type { PikkuFunctionConfig, PikkuMiddleware } from '${functionTypesImportPath}'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Type definition for scheduled tasks that run at specified intervals.
|
|
15
|
+
* These are sessionless functions that execute based on cron expressions.
|
|
16
|
+
*/
|
|
17
|
+
type SchedulerWiring = CoreScheduledTask<PikkuFunctionConfig<void, void>, PikkuMiddleware>
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Registers a scheduled task with the Pikku framework.
|
|
21
|
+
* Tasks run based on cron expressions and are sessionless.
|
|
22
|
+
*
|
|
23
|
+
* @param task - Scheduled task definition with cron expression and handler
|
|
24
|
+
*/
|
|
25
|
+
export const wireScheduler = (task: SchedulerWiring) => {
|
|
26
|
+
wireSchedulerCore(task as any) // TODO
|
|
27
|
+
}
|
|
28
|
+
`
|
|
29
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SingletonServices,
|
|
3
|
+
Services,
|
|
4
|
+
} from '../../types/application-types.js'
|
|
5
|
+
import type { PikkuInteraction } from '@pikku/core'
|
|
6
|
+
|
|
7
|
+
// Middleware type for CLI
|
|
8
|
+
type PikkuMiddleware = (
|
|
9
|
+
services: Services,
|
|
10
|
+
interaction: PikkuInteraction,
|
|
11
|
+
next: () => Promise<void>
|
|
12
|
+
) => Promise<void>
|
|
13
|
+
|
|
14
|
+
export interface LogCommandInfoOptions {
|
|
15
|
+
commandStart: string
|
|
16
|
+
commandEnd: string
|
|
17
|
+
skipCondition?:
|
|
18
|
+
| boolean
|
|
19
|
+
| ((services: SingletonServices) => boolean | Promise<boolean>)
|
|
20
|
+
skipMessage?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Middleware to log command execution timing and status
|
|
25
|
+
* Replaces the logCommandInfoAndTime wrapper function
|
|
26
|
+
*
|
|
27
|
+
* The skipCondition can be:
|
|
28
|
+
* - A boolean valuewe
|
|
29
|
+
* - A function that receives services and returns a boolean (can access getInspectorState)
|
|
30
|
+
*/
|
|
31
|
+
export const logCommandInfoAndTime = ({
|
|
32
|
+
commandStart,
|
|
33
|
+
commandEnd,
|
|
34
|
+
skipCondition = false,
|
|
35
|
+
skipMessage = 'none found',
|
|
36
|
+
}: LogCommandInfoOptions): PikkuMiddleware => {
|
|
37
|
+
return async ({ logger, ...services }, _interaction, next) => {
|
|
38
|
+
// Evaluate skip condition (can be boolean or function)
|
|
39
|
+
const shouldSkip =
|
|
40
|
+
typeof skipCondition === 'function'
|
|
41
|
+
? await skipCondition({ logger, ...services } as any)
|
|
42
|
+
: skipCondition
|
|
43
|
+
|
|
44
|
+
if (shouldSkip === true) {
|
|
45
|
+
logger.info(
|
|
46
|
+
`• Skipping ${commandStart.charAt(0).toLocaleLowerCase()}${commandStart.slice(1)} since ${skipMessage}.`
|
|
47
|
+
)
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Log start
|
|
52
|
+
const start = Date.now()
|
|
53
|
+
logger.info(`• ${commandStart}...`)
|
|
54
|
+
|
|
55
|
+
// Execute the function
|
|
56
|
+
await next()
|
|
57
|
+
|
|
58
|
+
// Log completion
|
|
59
|
+
logger.info(`✓ ${commandEnd} in ${Date.now() - start}ms.`)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -163,7 +163,7 @@ type SchedulerWiring = CoreScheduledTask<PikkuFunctionSessionless<void, void>, P
|
|
|
163
163
|
* @template In - Input type for the queue job
|
|
164
164
|
* @template Out - Output type for the queue job
|
|
165
165
|
*/
|
|
166
|
-
type QueueWiring<In, Out> = CoreQueueWorker<
|
|
166
|
+
type QueueWiring<In, Out> = CoreQueueWorker<any>
|
|
167
167
|
|
|
168
168
|
/**
|
|
169
169
|
* Type definition for MCP resources that provide data to AI models.
|
|
@@ -449,7 +449,7 @@ export { addPermission }
|
|
|
449
449
|
export const wireHTTP = <In, Out, Route extends string>(
|
|
450
450
|
httpWiring: HTTPWiring<In, Out, Route> & AssertHTTPWiringParams<In, Route>
|
|
451
451
|
) => {
|
|
452
|
-
wireHTTPCore(httpWiring)
|
|
452
|
+
wireHTTPCore(httpWiring as any) // TODO
|
|
453
453
|
}
|
|
454
454
|
|
|
455
455
|
/**
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Logger, LogLevel, PikkuChannel } from '@pikku/core'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Log message structure sent through the channel
|
|
5
|
+
*/
|
|
6
|
+
export interface ForwardedLogMessage {
|
|
7
|
+
message: string
|
|
8
|
+
level: 'trace' | 'debug' | 'info' | 'warn' | 'error'
|
|
9
|
+
type?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A logger implementation that forwards log messages to a CLI channel
|
|
14
|
+
* instead of logging to console directly.
|
|
15
|
+
*/
|
|
16
|
+
export class CLILoggerForwarder implements Logger {
|
|
17
|
+
private level: LogLevel = LogLevel.info
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
private logger: Logger,
|
|
21
|
+
private channel: PikkuChannel<unknown, ForwardedLogMessage>
|
|
22
|
+
) {}
|
|
23
|
+
|
|
24
|
+
setLevel(level: LogLevel): void {
|
|
25
|
+
this.level = level
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private log(
|
|
29
|
+
level: ForwardedLogMessage['level'],
|
|
30
|
+
logLevel: LogLevel,
|
|
31
|
+
messageOrObj: string | Record<string, any> | Error,
|
|
32
|
+
type?: string
|
|
33
|
+
) {
|
|
34
|
+
if (this.level > logLevel) return
|
|
35
|
+
|
|
36
|
+
let message: string
|
|
37
|
+
|
|
38
|
+
if (messageOrObj instanceof Error) {
|
|
39
|
+
this.logger.error(messageOrObj)
|
|
40
|
+
message = messageOrObj.message
|
|
41
|
+
} else if (typeof messageOrObj === 'object') {
|
|
42
|
+
if (
|
|
43
|
+
'message' in messageOrObj &&
|
|
44
|
+
typeof messageOrObj.message === 'string'
|
|
45
|
+
) {
|
|
46
|
+
message = messageOrObj.message
|
|
47
|
+
type = type || (messageOrObj.type as string)
|
|
48
|
+
} else {
|
|
49
|
+
message = JSON.stringify(messageOrObj)
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
message = messageOrObj
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
this.channel.send({ message, level, type })
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
info(messageOrObj: string | Record<string, any>, ..._meta: any[]) {
|
|
59
|
+
this.log('info', LogLevel.info, messageOrObj)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
error(messageOrObj: string | Record<string, any> | Error, ..._meta: any[]) {
|
|
63
|
+
this.log('error', LogLevel.error, messageOrObj)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
warn(messageOrObj: string | Record<string, any>, ..._meta: any[]) {
|
|
67
|
+
this.log('warn', LogLevel.warn, messageOrObj)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
debug(message: string, ..._meta: any[]) {
|
|
71
|
+
this.log('debug', LogLevel.debug, message)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
trace(message: string, ..._meta: any[]) {
|
|
75
|
+
this.log('trace', LogLevel.trace, message)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import chalk from 'chalk'
|
|
2
|
+
import { Logger, LogLevel } from '@pikku/core'
|
|
3
|
+
|
|
4
|
+
const logo = `
|
|
5
|
+
______ _ _ _
|
|
6
|
+
(_____ (_) | | |
|
|
7
|
+
_____) )| | _| | _ _ _
|
|
8
|
+
| ____/ | |_/ ) |_/ ) | | |
|
|
9
|
+
| | | | _ (| _ (| _ (| |_| |
|
|
10
|
+
|_| |_|_| _)_| _)____/
|
|
11
|
+
`
|
|
12
|
+
|
|
13
|
+
export class CLILogger implements Logger {
|
|
14
|
+
private silent: boolean
|
|
15
|
+
private level: LogLevel = LogLevel.info
|
|
16
|
+
|
|
17
|
+
constructor({
|
|
18
|
+
logLogo,
|
|
19
|
+
silent = false,
|
|
20
|
+
}: {
|
|
21
|
+
logLogo: boolean
|
|
22
|
+
silent?: boolean
|
|
23
|
+
}) {
|
|
24
|
+
this.silent = silent
|
|
25
|
+
if (logLogo && !silent) {
|
|
26
|
+
this.logPikkuLogo()
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
setLevel(level: LogLevel): void {
|
|
31
|
+
this.level = level
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
info(message: string | { message: string; type?: string }) {
|
|
35
|
+
if (this.level > LogLevel.info || this.silent) return
|
|
36
|
+
|
|
37
|
+
let c = chalk.blue
|
|
38
|
+
if (typeof message === 'object') {
|
|
39
|
+
if (message.type === 'success') {
|
|
40
|
+
c = chalk.green
|
|
41
|
+
} else if (message.type === 'timing') {
|
|
42
|
+
c = chalk.gray
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
console.log(c(typeof message === 'string' ? message : message.message))
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
error(message: string) {
|
|
49
|
+
if (this.level > LogLevel.error) return
|
|
50
|
+
console.error(chalk.red(message))
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
warn(message: string) {
|
|
54
|
+
if (this.level > LogLevel.warn) return
|
|
55
|
+
console.error(chalk.yellow(message))
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
debug(message: string) {
|
|
59
|
+
if (this.level > LogLevel.debug || this.silent) return
|
|
60
|
+
console.log(chalk.gray(message))
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private logPikkuLogo() {
|
|
64
|
+
this.primary(logo)
|
|
65
|
+
// // When running from dist/, __filename is dist/src/services/cli-logger.service.js
|
|
66
|
+
// // So we need to go up 3 levels: dist/src/services -> dist/src -> dist -> package.json
|
|
67
|
+
// const packageJson = JSON.parse(
|
|
68
|
+
// readFileSync(`${dirname(__filename)}/../../../package.json`, 'utf-8')
|
|
69
|
+
// )
|
|
70
|
+
// this.primary(`⚙️ Welcome to the Pikku CLI (v${packageJson.version})\n`)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private primary(message: string) {
|
|
74
|
+
if (!this.silent) {
|
|
75
|
+
console.log(chalk.green(message))
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
package/src/services.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Config,
|
|
3
|
+
Services,
|
|
4
|
+
SingletonServices,
|
|
5
|
+
UserSession,
|
|
6
|
+
} from '../types/application-types.js'
|
|
7
|
+
import {
|
|
8
|
+
CreateConfig,
|
|
9
|
+
CreateSessionServices,
|
|
10
|
+
CreateSingletonServices,
|
|
11
|
+
pikkuCLIRender,
|
|
12
|
+
} from '@pikku/core'
|
|
13
|
+
import { LocalVariablesService } from '@pikku/core/services'
|
|
14
|
+
import { CLILogger } from './services/cli-logger.service.js'
|
|
15
|
+
import { getPikkuCLIConfig } from './utils/pikku-cli-config.js'
|
|
16
|
+
import { inspect, InspectorState } from '@pikku/inspector'
|
|
17
|
+
import { glob } from 'tinyglobby'
|
|
18
|
+
import path from 'path'
|
|
19
|
+
import { PikkuCLIConfig } from '../types/config.js'
|
|
20
|
+
import {
|
|
21
|
+
CLILoggerForwarder,
|
|
22
|
+
ForwardedLogMessage,
|
|
23
|
+
} from './services/cli-logger-forwarder.service.js'
|
|
24
|
+
|
|
25
|
+
const logger = new CLILogger({ logLogo: true, silent: false })
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Default CLI renderer that logs output using the logger
|
|
29
|
+
*/
|
|
30
|
+
export const defaultCLIRenderer = pikkuCLIRender<
|
|
31
|
+
ForwardedLogMessage,
|
|
32
|
+
SingletonServices
|
|
33
|
+
>((_services, data) => {
|
|
34
|
+
if (data) {
|
|
35
|
+
logger[data.level]({ message: data.message, type: data.type })
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
export const createConfig: CreateConfig<Config, [PikkuCLIConfig]> = async (
|
|
40
|
+
_variablesService,
|
|
41
|
+
data
|
|
42
|
+
) => {
|
|
43
|
+
const cliConfig = await getPikkuCLIConfig(
|
|
44
|
+
logger,
|
|
45
|
+
data.configFile,
|
|
46
|
+
[],
|
|
47
|
+
data,
|
|
48
|
+
true
|
|
49
|
+
)
|
|
50
|
+
return {
|
|
51
|
+
...cliConfig,
|
|
52
|
+
...data,
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Singleton services factory for the Pikku CLI
|
|
58
|
+
* This function creates the singleton services used by the CLI and is created once on start.
|
|
59
|
+
*/
|
|
60
|
+
export const createSingletonServices: CreateSingletonServices<
|
|
61
|
+
Config,
|
|
62
|
+
SingletonServices
|
|
63
|
+
> = async (config) => {
|
|
64
|
+
const { rootDir, srcDirectories, filters } = config
|
|
65
|
+
const variables = new LocalVariablesService()
|
|
66
|
+
|
|
67
|
+
let inspectorState: InspectorState | undefined = undefined
|
|
68
|
+
const getInspectorState = async (refresh: boolean = false) => {
|
|
69
|
+
if (refresh || !inspectorState) {
|
|
70
|
+
const wiringFiles = (
|
|
71
|
+
await Promise.all(
|
|
72
|
+
srcDirectories.map((dir) =>
|
|
73
|
+
glob(`${path.join(rootDir, dir)}/**/*.ts`)
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
).flat()
|
|
77
|
+
inspectorState = await inspect(logger, wiringFiles, {
|
|
78
|
+
filters,
|
|
79
|
+
types: {
|
|
80
|
+
configFileType: config.configFile,
|
|
81
|
+
userSessionType: config.tags?.[0], // TODO: Properly handle type selection
|
|
82
|
+
singletonServicesFactoryType: undefined,
|
|
83
|
+
sessionServicesFactoryType: undefined,
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
return inspectorState
|
|
87
|
+
}
|
|
88
|
+
return inspectorState!
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
config,
|
|
93
|
+
logger,
|
|
94
|
+
variables,
|
|
95
|
+
getInspectorState,
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export const createSessionServices: CreateSessionServices<
|
|
100
|
+
SingletonServices,
|
|
101
|
+
Services,
|
|
102
|
+
UserSession
|
|
103
|
+
> = async ({ logger }, { cli, channel }) => {
|
|
104
|
+
const vChannel = cli ? cli.channel : channel
|
|
105
|
+
if (!vChannel) {
|
|
106
|
+
throw new Error('No channel provided for CLI services')
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
logger: new CLILoggerForwarder(logger, vChannel),
|
|
110
|
+
}
|
|
111
|
+
}
|