@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,23 @@
|
|
|
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 { serializeTypedHTTPWiringsMap } from './serialize-typed-http-map.js';
|
|
5
|
+
export const pikkuHTTPMap = pikkuSessionlessFunc({
|
|
6
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
7
|
+
const { http, functions } = await getInspectorState();
|
|
8
|
+
const { httpMapDeclarationFile, packageMappings } = config;
|
|
9
|
+
const content = serializeTypedHTTPWiringsMap(httpMapDeclarationFile, packageMappings, functions.typesMap, functions.meta, http.meta, http.metaInputTypes);
|
|
10
|
+
await writeFileInDir(logger, httpMapDeclarationFile, content);
|
|
11
|
+
},
|
|
12
|
+
middleware: [
|
|
13
|
+
logCommandInfoAndTime({
|
|
14
|
+
commandStart: 'Creating HTTP map',
|
|
15
|
+
commandEnd: 'Created HTTP map',
|
|
16
|
+
skipCondition: async ({ getInspectorState }) => {
|
|
17
|
+
const { http } = await getInspectorState();
|
|
18
|
+
return http.files.size === 0;
|
|
19
|
+
},
|
|
20
|
+
skipMessage: 'none found',
|
|
21
|
+
}),
|
|
22
|
+
],
|
|
23
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuHTTP: any;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
export const pikkuHTTP = pikkuSessionlessFunc({
|
|
6
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
7
|
+
const visitState = await getInspectorState();
|
|
8
|
+
const { httpWiringsFile, httpWiringMetaFile, packageMappings } = config;
|
|
9
|
+
const { http } = visitState;
|
|
10
|
+
await writeFileInDir(logger, httpWiringsFile, serializeFileImports('wireHTTP', httpWiringsFile, http.files, packageMappings));
|
|
11
|
+
await writeFileInDir(logger, httpWiringMetaFile, `import { pikkuState } from '@pikku/core'\npikkuState('http', 'meta', ${JSON.stringify(http.meta, null, 2)})`);
|
|
12
|
+
return true;
|
|
13
|
+
},
|
|
14
|
+
middleware: [
|
|
15
|
+
logCommandInfoAndTime({
|
|
16
|
+
commandStart: 'Finding HTTP routes',
|
|
17
|
+
commandEnd: 'Found HTTP routes',
|
|
18
|
+
skipCondition: async ({ getInspectorState }) => {
|
|
19
|
+
const visitState = await getInspectorState();
|
|
20
|
+
return visitState.http.files.size === 0;
|
|
21
|
+
},
|
|
22
|
+
skipMessage: 'none found',
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuHTTPTypes: any;
|
|
@@ -0,0 +1,21 @@
|
|
|
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 { serializeHTTPTypes } from './serialize-http-types.js';
|
|
6
|
+
export const pikkuHTTPTypes = pikkuSessionlessFunc({
|
|
7
|
+
func: async ({ logger, config }) => {
|
|
8
|
+
const { httpTypesFile, functionTypesFile, packageMappings } = config;
|
|
9
|
+
const functionTypesImportPath = getFileImportRelativePath(httpTypesFile, functionTypesFile, packageMappings);
|
|
10
|
+
const content = serializeHTTPTypes(functionTypesImportPath);
|
|
11
|
+
await writeFileInDir(logger, httpTypesFile, content);
|
|
12
|
+
},
|
|
13
|
+
middleware: [
|
|
14
|
+
logCommandInfoAndTime({
|
|
15
|
+
commandStart: 'Creating HTTP types',
|
|
16
|
+
commandEnd: 'Created HTTP types',
|
|
17
|
+
skipCondition: false,
|
|
18
|
+
skipMessage: '',
|
|
19
|
+
}),
|
|
20
|
+
],
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuOpenAPI: any;
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { generateSchemas } from '../../../utils/schema-generator.js';
|
|
5
|
+
import { generateOpenAPISpec } from './openapi-spec-generator.js';
|
|
6
|
+
import { stringify } from 'yaml';
|
|
7
|
+
export const pikkuOpenAPI = pikkuSessionlessFunc({
|
|
8
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
9
|
+
const { http, functions } = await getInspectorState();
|
|
10
|
+
const { tsconfig, openAPI, schemasFromTypes } = config;
|
|
11
|
+
if (!openAPI?.outputFile) {
|
|
12
|
+
throw new Error('openAPI is required');
|
|
13
|
+
}
|
|
14
|
+
const schemas = await generateSchemas(logger, tsconfig, functions.typesMap, functions.meta, http.meta, schemasFromTypes);
|
|
15
|
+
const openAPISpec = await generateOpenAPISpec(logger, functions.meta, http.meta, schemas, openAPI.additionalInfo);
|
|
16
|
+
if (openAPI.outputFile.endsWith('.json')) {
|
|
17
|
+
await writeFileInDir(logger, openAPI.outputFile, JSON.stringify(openAPISpec, null, 2), { ignoreModifyComment: true });
|
|
18
|
+
}
|
|
19
|
+
else if (openAPI.outputFile.endsWith('.yaml') ||
|
|
20
|
+
openAPI.outputFile.endsWith('.yml')) {
|
|
21
|
+
await writeFileInDir(logger, openAPI.outputFile, stringify(openAPISpec), {
|
|
22
|
+
ignoreModifyComment: true,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
middleware: [
|
|
27
|
+
logCommandInfoAndTime({
|
|
28
|
+
commandStart: 'Creating OpenAPI spec',
|
|
29
|
+
commandEnd: 'Created OpenAPI spec',
|
|
30
|
+
skipCondition: ({ config }) => config.openAPI?.outputFile === undefined,
|
|
31
|
+
skipMessage: 'openAPI outfile is not defined',
|
|
32
|
+
}),
|
|
33
|
+
],
|
|
34
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuHTTP: any;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
export const pikkuHTTP = pikkuSessionlessFunc({
|
|
6
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
7
|
+
const visitState = await getInspectorState();
|
|
8
|
+
const { httpWiringsFile, httpWiringMetaFile, packageMappings } = config;
|
|
9
|
+
const { http } = visitState;
|
|
10
|
+
await writeFileInDir(logger, httpWiringsFile, serializeFileImports('wireHTTP', httpWiringsFile, http.files, packageMappings));
|
|
11
|
+
await writeFileInDir(logger, httpWiringMetaFile, `import { pikkuState } from '@pikku/core'\npikkuState('http', 'meta', ${JSON.stringify(http.meta, null, 2)})`);
|
|
12
|
+
return true;
|
|
13
|
+
},
|
|
14
|
+
middleware: [
|
|
15
|
+
logCommandInfoAndTime({
|
|
16
|
+
commandStart: 'Finding HTTP routes',
|
|
17
|
+
commandEnd: 'Found HTTP routes',
|
|
18
|
+
skipCondition: async ({ getInspectorState }) => {
|
|
19
|
+
const visitState = await getInspectorState();
|
|
20
|
+
return visitState.http.files.size === 0;
|
|
21
|
+
},
|
|
22
|
+
skipMessage: 'none found',
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates type definitions for HTTP wirings
|
|
3
|
+
*/
|
|
4
|
+
export const serializeHTTPTypes = (functionTypesImportPath) => {
|
|
5
|
+
return `/**
|
|
6
|
+
* This file was generated by the @pikku/cli
|
|
7
|
+
* HTTP-specific type definitions for tree-shaking optimization
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { AssertHTTPWiringParams, wireHTTP as wireHTTPCore, addHTTPMiddleware as addHTTPMiddlewareCore } from '@pikku/core/http'
|
|
11
|
+
import type { PikkuFunction, PikkuFunctionSessionless, PikkuPermission, PikkuMiddleware } from '${functionTypesImportPath}'
|
|
12
|
+
import type { CoreHTTPFunctionWiring } from '@pikku/core/http'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Type definition for HTTP API wirings with type-safe path parameters.
|
|
16
|
+
* Supports both authenticated and unauthenticated functions.
|
|
17
|
+
*
|
|
18
|
+
* @template In - Input type for the HTTP wiring
|
|
19
|
+
* @template Out - Output type for the HTTP wiring
|
|
20
|
+
* @template Route - String literal type for the HTTP path (e.g., "/users/:id")
|
|
21
|
+
*/
|
|
22
|
+
type HTTPWiring<In, Out, Route extends string> = CoreHTTPFunctionWiring<In, Out, Route, PikkuFunction<In, Out>, PikkuFunctionSessionless<In, Out>, PikkuPermission<In>, PikkuMiddleware>
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Registers an HTTP wiring with the Pikku framework.
|
|
26
|
+
*
|
|
27
|
+
* @template In - Input type for the HTTP wiring
|
|
28
|
+
* @template Out - Output type for the HTTP wiring
|
|
29
|
+
* @template Route - String literal type for the HTTP path (e.g., "/users/:id")
|
|
30
|
+
* @param httpWiring - HTTP wiring definition with handler, method, and optional middleware
|
|
31
|
+
*/
|
|
32
|
+
export const wireHTTP = <In, Out, Route extends string>(
|
|
33
|
+
httpWiring: HTTPWiring<In, Out, Route> & AssertHTTPWiringParams<In, Route>
|
|
34
|
+
) => {
|
|
35
|
+
wireHTTPCore(httpWiring as any)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Registers HTTP middleware either globally or for a specific route pattern.
|
|
40
|
+
*
|
|
41
|
+
* When a string route pattern is provided along with middleware, the middleware
|
|
42
|
+
* is applied only to that route. Otherwise, if an array is provided, it is treated
|
|
43
|
+
* as global middleware (applied to all routes).
|
|
44
|
+
*
|
|
45
|
+
* @param routeOrMiddleware - Either a global middleware array or a route pattern string
|
|
46
|
+
* @param middleware - The middleware array to apply when a route pattern is specified
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* \`\`\`typescript
|
|
50
|
+
* // Add global HTTP middleware
|
|
51
|
+
* addHTTPMiddleware([authMiddleware, loggingMiddleware])
|
|
52
|
+
*
|
|
53
|
+
* // Add route-specific middleware
|
|
54
|
+
* addHTTPMiddleware('/api/admin/*', [adminAuthMiddleware])
|
|
55
|
+
* \`\`\`
|
|
56
|
+
*/
|
|
57
|
+
export const addHTTPMiddleware = (
|
|
58
|
+
routeOrMiddleware: PikkuMiddleware[] | string,
|
|
59
|
+
middleware?: PikkuMiddleware[]
|
|
60
|
+
) => {
|
|
61
|
+
addHTTPMiddlewareCore(routeOrMiddleware as any, middleware as any)
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { serializeImportMap } from '
|
|
2
|
-
import { generateCustomTypes } from '
|
|
1
|
+
import { serializeImportMap } from '../../../utils/serialize-import-map.js';
|
|
2
|
+
import { generateCustomTypes } from '../../../utils/custom-types-generator.js';
|
|
3
3
|
export const serializeTypedHTTPWiringsMap = (relativeToPath, packageMappings, typesMap, functionsMeta, wiringsMeta, metaTypes) => {
|
|
4
4
|
const requiredTypes = new Set();
|
|
5
5
|
const serializedCustomTypes = generateCustomTypes(typesMap, requiredTypes);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuMCPJSON: any;
|
|
@@ -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
|
+
import { serializeMCPJson } from './serialize-mcp-json.js';
|
|
5
|
+
export const pikkuMCPJSON = pikkuSessionlessFunc({
|
|
6
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
7
|
+
const { mcpEndpoints, functions } = await getInspectorState();
|
|
8
|
+
const { mcpJsonFile, schemaDirectory } = config;
|
|
9
|
+
// Generate MCP JSON file
|
|
10
|
+
if (mcpJsonFile) {
|
|
11
|
+
const mcpJson = await serializeMCPJson(logger, schemaDirectory, functions.meta, functions.typesMap, mcpEndpoints.resourcesMeta, mcpEndpoints.toolsMeta, mcpEndpoints.promptsMeta);
|
|
12
|
+
await writeFileInDir(logger, mcpJsonFile, mcpJson, {
|
|
13
|
+
ignoreModifyComment: true,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
middleware: [
|
|
18
|
+
logCommandInfoAndTime({
|
|
19
|
+
commandStart: 'Generating MCP JSON',
|
|
20
|
+
commandEnd: 'Generated MCP JSON',
|
|
21
|
+
skipCondition: async ({ getInspectorState, config }) => {
|
|
22
|
+
const { mcpEndpoints } = await getInspectorState();
|
|
23
|
+
return mcpEndpoints.files.size === 0 || !config.mcpJsonFile;
|
|
24
|
+
},
|
|
25
|
+
skipMessage: 'none found or mcpJsonFile not set',
|
|
26
|
+
}),
|
|
27
|
+
],
|
|
28
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuMCPTypes: any;
|
|
@@ -0,0 +1,21 @@
|
|
|
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 { serializeMCPTypes } from './serialize-mcp-types.js';
|
|
6
|
+
export const pikkuMCPTypes = pikkuSessionlessFunc({
|
|
7
|
+
func: async ({ logger, config }) => {
|
|
8
|
+
const { mcpTypesFile, functionTypesFile, packageMappings } = config;
|
|
9
|
+
const functionTypesImportPath = getFileImportRelativePath(mcpTypesFile, functionTypesFile, packageMappings);
|
|
10
|
+
const content = serializeMCPTypes(functionTypesImportPath);
|
|
11
|
+
await writeFileInDir(logger, mcpTypesFile, content);
|
|
12
|
+
},
|
|
13
|
+
middleware: [
|
|
14
|
+
logCommandInfoAndTime({
|
|
15
|
+
commandStart: 'Creating MCP types',
|
|
16
|
+
commandEnd: 'Created MCP types',
|
|
17
|
+
skipCondition: false,
|
|
18
|
+
skipMessage: '',
|
|
19
|
+
}),
|
|
20
|
+
],
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuMCP: any;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
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';
|
|
2
5
|
import { readFile } from 'fs/promises';
|
|
3
6
|
import { join } from 'path';
|
|
4
7
|
// Helper function to generate arguments from schema
|
|
@@ -34,8 +37,10 @@ const generateArgumentsFromSchema = async (inputSchema, schemaDirectory, typesMa
|
|
|
34
37
|
return [];
|
|
35
38
|
}
|
|
36
39
|
};
|
|
37
|
-
export const pikkuMCP =
|
|
38
|
-
|
|
40
|
+
export const pikkuMCP = pikkuSessionlessFunc({
|
|
41
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
42
|
+
const { mcpEndpoints, functions } = await getInspectorState();
|
|
43
|
+
const { mcpWiringsFile, mcpWiringsMetaFile, packageMappings, schemaDirectory, } = config;
|
|
39
44
|
await writeFileInDir(logger, mcpWiringsFile, serializeFileImports('wireMCPResource or wireMCPTool', mcpWiringsFile, mcpEndpoints.files, packageMappings));
|
|
40
45
|
// Populate arguments for prompts meta before serializing
|
|
41
46
|
const promptsMetaWithArguments = { ...mcpEndpoints.promptsMeta };
|
|
@@ -50,5 +55,17 @@ export const pikkuMCP = async (logger, { mcpWiringsFile, mcpWiringsMetaFile, pac
|
|
|
50
55
|
pikkuState('mcp', 'resourcesMeta', ${JSON.stringify(mcpEndpoints.resourcesMeta, null, 2)})
|
|
51
56
|
pikkuState('mcp', 'toolsMeta', ${JSON.stringify(mcpEndpoints.toolsMeta, null, 2)})
|
|
52
57
|
pikkuState('mcp', 'promptsMeta', ${JSON.stringify(promptsMetaWithArguments, null, 2)})`);
|
|
53
|
-
|
|
54
|
-
}
|
|
58
|
+
return true;
|
|
59
|
+
},
|
|
60
|
+
middleware: [
|
|
61
|
+
logCommandInfoAndTime({
|
|
62
|
+
commandStart: 'Finding MCP endpoints',
|
|
63
|
+
commandEnd: 'Found MCP endpoints',
|
|
64
|
+
skipCondition: async ({ getInspectorState }) => {
|
|
65
|
+
const { mcpEndpoints } = await getInspectorState();
|
|
66
|
+
return mcpEndpoints.files.size === 0;
|
|
67
|
+
},
|
|
68
|
+
skipMessage: 'none found',
|
|
69
|
+
}),
|
|
70
|
+
],
|
|
71
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MCPResourceMeta, MCPToolMeta, MCPPromptMeta } from '@pikku/core';
|
|
2
2
|
import { FunctionsMeta } from '@pikku/core';
|
|
3
3
|
import { TypesMap } from '@pikku/inspector';
|
|
4
|
-
import { CLILogger } from '
|
|
4
|
+
import { CLILogger } from '../../../services/cli-logger.service.js';
|
|
5
5
|
export declare const serializeMCPJson: (logger: CLILogger, schemaDirectory: string, functionsMeta: FunctionsMeta, typesMap: TypesMap, mcpResourceMeta: MCPResourceMeta, mcpToolMeta: MCPToolMeta, mcpPromptMeta: MCPPromptMeta) => Promise<string>;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates type definitions for MCP wirings
|
|
3
|
+
*/
|
|
4
|
+
export const serializeMCPTypes = (functionTypesImportPath) => {
|
|
5
|
+
return `/**
|
|
6
|
+
* This file was generated by the @pikku/cli
|
|
7
|
+
* MCP-specific type definitions for tree-shaking optimization
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
CoreMCPResource,
|
|
12
|
+
CoreMCPTool,
|
|
13
|
+
CoreMCPPrompt,
|
|
14
|
+
wireMCPResource as wireMCPResourceCore,
|
|
15
|
+
wireMCPTool as wireMCPToolCore,
|
|
16
|
+
wireMCPPrompt as wireMCPPromptCore,
|
|
17
|
+
MCPResourceResponse,
|
|
18
|
+
MCPToolResponse,
|
|
19
|
+
MCPPromptResponse
|
|
20
|
+
} from '@pikku/core'
|
|
21
|
+
|
|
22
|
+
import type { PikkuFunctionConfig, PikkuFunctionSessionless } from '${functionTypesImportPath}'
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Type definition for MCP resources that provide data to AI models.
|
|
26
|
+
*
|
|
27
|
+
* @template In - Input type for the resource request
|
|
28
|
+
*/
|
|
29
|
+
type MCPResourceWiring<In> = CoreMCPResource<PikkuFunctionConfig<In, MCPResourceResponse>>
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Type definition for MCP tools that AI models can invoke.
|
|
33
|
+
*
|
|
34
|
+
* @template In - Input type for the tool invocation
|
|
35
|
+
*/
|
|
36
|
+
type MCPToolWiring<In> = CoreMCPTool<PikkuFunctionConfig<In, MCPToolResponse>>
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Type definition for MCP prompts that provide templates to AI models.
|
|
40
|
+
*
|
|
41
|
+
* @template In - Input type for the prompt parameters
|
|
42
|
+
*/
|
|
43
|
+
type MCPPromptWiring<In> = CoreMCPPrompt<PikkuFunctionConfig<In, MCPPromptResponse>>
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Registers an MCP resource with the Pikku framework.
|
|
47
|
+
* Resources provide data that AI models can access.
|
|
48
|
+
*
|
|
49
|
+
* @template In - Input type for the resource request
|
|
50
|
+
* @param mcpResource - MCP resource definition with data provider function
|
|
51
|
+
*/
|
|
52
|
+
export const wireMCPResource = <In>(
|
|
53
|
+
mcpResource: MCPResourceWiring<In>
|
|
54
|
+
) => {
|
|
55
|
+
wireMCPResourceCore(mcpResource as any)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Registers an MCP tool with the Pikku framework.
|
|
60
|
+
* Tools are functions that AI models can invoke.
|
|
61
|
+
*
|
|
62
|
+
* @template In - Input type for the tool invocation
|
|
63
|
+
* @param mcpTool - MCP tool definition with action function
|
|
64
|
+
*/
|
|
65
|
+
export const wireMCPTool = <In>(
|
|
66
|
+
mcpTool: MCPToolWiring<In>
|
|
67
|
+
) => {
|
|
68
|
+
wireMCPToolCore(mcpTool as any)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Registers an MCP prompt with the Pikku framework.
|
|
73
|
+
* Prompts provide templates that AI models can use.
|
|
74
|
+
*
|
|
75
|
+
* @template In - Input type for the prompt parameters
|
|
76
|
+
* @param mcpPrompt - MCP prompt definition with template function
|
|
77
|
+
*/
|
|
78
|
+
export const wireMCPPrompt = <In>(
|
|
79
|
+
mcpPrompt: MCPPromptWiring<In>
|
|
80
|
+
) => {
|
|
81
|
+
wireMCPPromptCore(mcpPrompt as any)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Creates a function for handling MCP prompt requests.
|
|
86
|
+
* These functions generate prompt templates for AI models.
|
|
87
|
+
*
|
|
88
|
+
* @template In - Input type for the prompt parameters
|
|
89
|
+
* @param func - Function definition, either direct function or configuration object
|
|
90
|
+
* @returns The unwrapped function for internal use
|
|
91
|
+
*/
|
|
92
|
+
export const pikkuMCPPromptFunc = <In>(
|
|
93
|
+
func:
|
|
94
|
+
| PikkuFunctionSessionless<In, MCPPromptResponse>
|
|
95
|
+
| {
|
|
96
|
+
func: PikkuFunctionSessionless<In, MCPPromptResponse>
|
|
97
|
+
name?: string
|
|
98
|
+
}
|
|
99
|
+
) => {
|
|
100
|
+
return typeof func === 'function' ? func : func.func
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Creates a function for handling MCP tool invocations.
|
|
105
|
+
* These functions perform actions that AI models can request.
|
|
106
|
+
*
|
|
107
|
+
* @template In - Input type for the tool invocation
|
|
108
|
+
* @param func - Function definition, either direct function or configuration object
|
|
109
|
+
* @returns The unwrapped function for internal use
|
|
110
|
+
*/
|
|
111
|
+
export const pikkuMCPToolFunc = <In>(
|
|
112
|
+
func:
|
|
113
|
+
| PikkuFunctionSessionless<In, MCPToolResponse, null, true>
|
|
114
|
+
| {
|
|
115
|
+
func: PikkuFunctionSessionless<In, MCPToolResponse, null, true>
|
|
116
|
+
name?: string
|
|
117
|
+
}
|
|
118
|
+
) => {
|
|
119
|
+
return typeof func === 'function' ? func : func.func
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Creates a function for handling MCP resource requests.
|
|
124
|
+
* These functions provide data that AI models can access.
|
|
125
|
+
*
|
|
126
|
+
* @template In - Input type for the resource request
|
|
127
|
+
* @param func - Function definition, either direct function or configuration object
|
|
128
|
+
* @returns The unwrapped function for internal use
|
|
129
|
+
*/
|
|
130
|
+
export const pikkuMCPResourceFunc = <In>(
|
|
131
|
+
func:
|
|
132
|
+
| PikkuFunctionSessionless<In, MCPResourceResponse, null, true>
|
|
133
|
+
| {
|
|
134
|
+
func: PikkuFunctionSessionless<In, MCPResourceResponse, null, true>
|
|
135
|
+
name?: string
|
|
136
|
+
}
|
|
137
|
+
) => {
|
|
138
|
+
return typeof func === 'function' ? func : func.func
|
|
139
|
+
}
|
|
140
|
+
`;
|
|
141
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuMiddleware: any;
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { serializeMiddlewareImports } from './serialize-middleware-imports.js';
|
|
5
|
+
import { serializeMiddlewareGroupsMeta } from './serialize-middleware-groups-meta.js';
|
|
6
|
+
export const pikkuMiddleware = pikkuSessionlessFunc({
|
|
7
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
8
|
+
const state = await getInspectorState();
|
|
9
|
+
const { middleware } = state;
|
|
10
|
+
const { middlewareFile, packageMappings } = config;
|
|
11
|
+
let filesGenerated = false;
|
|
12
|
+
// Check if there are any middleware group factories
|
|
13
|
+
const hasHTTPFactories = Array.from(state.http.routeMiddleware.values()).some((meta) => meta.exportName && meta.isFactory);
|
|
14
|
+
const hasTagFactories = Array.from(state.middleware.tagMiddleware.values()).some((meta) => meta.exportName && meta.isFactory);
|
|
15
|
+
const hasFactories = hasHTTPFactories || hasTagFactories;
|
|
16
|
+
// Generate middleware imports file if there are factories
|
|
17
|
+
if (hasFactories) {
|
|
18
|
+
await writeFileInDir(logger, middlewareFile, serializeMiddlewareImports(middlewareFile, middleware, state.http, packageMappings));
|
|
19
|
+
filesGenerated = true;
|
|
20
|
+
}
|
|
21
|
+
// Generate middleware groups metadata file
|
|
22
|
+
const hasHTTPGroups = state.http.routeMiddleware.size > 0;
|
|
23
|
+
const hasTagGroups = state.middleware.tagMiddleware.size > 0;
|
|
24
|
+
if (hasHTTPGroups || hasTagGroups) {
|
|
25
|
+
await writeFileInDir(logger, config.middlewareGroupsMetaFile, serializeMiddlewareGroupsMeta(state));
|
|
26
|
+
filesGenerated = true;
|
|
27
|
+
}
|
|
28
|
+
return filesGenerated;
|
|
29
|
+
},
|
|
30
|
+
middleware: [
|
|
31
|
+
logCommandInfoAndTime({
|
|
32
|
+
commandStart: 'Serializing Pikku middleware',
|
|
33
|
+
commandEnd: 'Serialized Pikku middleware',
|
|
34
|
+
skipCondition: false,
|
|
35
|
+
skipMessage: '',
|
|
36
|
+
}),
|
|
37
|
+
],
|
|
38
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { InspectorState } from '@pikku/inspector';
|
|
2
|
+
/**
|
|
3
|
+
* Generates the middleware groups metadata file that stores metadata about
|
|
4
|
+
* tag-based and HTTP middleware groups for visualization and inspection.
|
|
5
|
+
*
|
|
6
|
+
* This includes services, middleware count, factory status, etc.
|
|
7
|
+
*/
|
|
8
|
+
export declare const serializeMiddlewareGroupsMeta: (state: InspectorState) => string;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates the middleware groups metadata file that stores metadata about
|
|
3
|
+
* tag-based and HTTP middleware groups for visualization and inspection.
|
|
4
|
+
*
|
|
5
|
+
* This includes services, middleware count, factory status, etc.
|
|
6
|
+
*/
|
|
7
|
+
export const serializeMiddlewareGroupsMeta = (state) => {
|
|
8
|
+
const lines = [
|
|
9
|
+
`/**`,
|
|
10
|
+
` * This file was generated by the @pikku/cli`,
|
|
11
|
+
` */`,
|
|
12
|
+
`import { pikkuState } from '@pikku/core'`,
|
|
13
|
+
``,
|
|
14
|
+
];
|
|
15
|
+
// Serialize HTTP middleware groups metadata
|
|
16
|
+
const httpGroups = {};
|
|
17
|
+
for (const [pattern, meta] of state.http.routeMiddleware.entries()) {
|
|
18
|
+
httpGroups[pattern] = {
|
|
19
|
+
exportName: meta.exportName,
|
|
20
|
+
sourceFile: meta.sourceFile,
|
|
21
|
+
position: meta.position,
|
|
22
|
+
services: meta.services,
|
|
23
|
+
middlewareCount: meta.middlewareCount,
|
|
24
|
+
isFactory: meta.isFactory,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (Object.keys(httpGroups).length > 0) {
|
|
28
|
+
lines.push(`// HTTP middleware groups metadata`);
|
|
29
|
+
lines.push(`pikkuState('middleware', 'httpGroupMeta', ${JSON.stringify(httpGroups, null, 2)})`);
|
|
30
|
+
lines.push(``);
|
|
31
|
+
}
|
|
32
|
+
// Serialize tag middleware groups metadata
|
|
33
|
+
const tagGroups = {};
|
|
34
|
+
for (const [tag, meta] of state.middleware.tagMiddleware.entries()) {
|
|
35
|
+
tagGroups[tag] = {
|
|
36
|
+
exportName: meta.exportName,
|
|
37
|
+
sourceFile: meta.sourceFile,
|
|
38
|
+
position: meta.position,
|
|
39
|
+
services: meta.services,
|
|
40
|
+
middlewareCount: meta.middlewareCount,
|
|
41
|
+
isFactory: meta.isFactory,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (Object.keys(tagGroups).length > 0) {
|
|
45
|
+
lines.push(`// Tag middleware groups metadata`);
|
|
46
|
+
lines.push(`pikkuState('middleware', 'tagGroupMeta', ${JSON.stringify(tagGroups, null, 2)})`);
|
|
47
|
+
lines.push(``);
|
|
48
|
+
}
|
|
49
|
+
return lines.join('\n');
|
|
50
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { InspectorMiddlewareState, InspectorHTTPState, InspectorState } from '@pikku/inspector';
|
|
2
|
+
export declare const serializeMiddlewareImports: (outputPath: string, middlewareState: InspectorMiddlewareState, httpState: InspectorHTTPState, packageMappings?: Record<string, string>, fullState?: InspectorState) => string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js';
|
|
2
|
+
export const serializeMiddlewareImports = (outputPath, middlewareState, httpState, packageMappings = {}, fullState) => {
|
|
3
|
+
const serializedImports = [];
|
|
4
|
+
const serializedFactoryCalls = [];
|
|
5
|
+
// Collect factory imports and calls for HTTP middleware groups
|
|
6
|
+
const httpFactories = new Map();
|
|
7
|
+
for (const [, groupMeta] of httpState.routeMiddleware.entries()) {
|
|
8
|
+
if (groupMeta.exportName && groupMeta.isFactory) {
|
|
9
|
+
const filePath = getFileImportRelativePath(outputPath, groupMeta.sourceFile, packageMappings);
|
|
10
|
+
httpFactories.set(groupMeta.exportName, {
|
|
11
|
+
exportName: groupMeta.exportName,
|
|
12
|
+
filePath,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
// Collect factory imports and calls for tag middleware groups
|
|
17
|
+
const tagFactories = new Map();
|
|
18
|
+
for (const [, groupMeta] of middlewareState.tagMiddleware.entries()) {
|
|
19
|
+
if (groupMeta.exportName && groupMeta.isFactory) {
|
|
20
|
+
const filePath = getFileImportRelativePath(outputPath, groupMeta.sourceFile, packageMappings);
|
|
21
|
+
tagFactories.set(groupMeta.exportName, {
|
|
22
|
+
exportName: groupMeta.exportName,
|
|
23
|
+
filePath,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// Combine all factories and deduplicate by exportName (same factory might be used in multiple groups)
|
|
28
|
+
const allFactories = new Map([...httpFactories, ...tagFactories]);
|
|
29
|
+
// Add factory imports and calls
|
|
30
|
+
if (allFactories.size > 0) {
|
|
31
|
+
serializedImports.push('/* Call middleware group factories to register at module evaluation */');
|
|
32
|
+
// Import factories
|
|
33
|
+
for (const [exportName, { filePath }] of allFactories) {
|
|
34
|
+
serializedImports.push(`import { ${exportName} } from '${filePath}'`);
|
|
35
|
+
}
|
|
36
|
+
// Call factories
|
|
37
|
+
for (const [exportName] of allFactories) {
|
|
38
|
+
serializedFactoryCalls.push(`${exportName}()`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Return combined output
|
|
42
|
+
return [...serializedImports, ...serializedFactoryCalls].join('\n');
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuQueueMap: any;
|