@pikku/cli 0.9.15 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pikku/channel/pikku-channel-types.gen.ts +91 -0
- package/.pikku/channel/pikku-channels-map.gen.d.ts +44 -0
- package/.pikku/channel/pikku-channels-meta.gen.ts +5 -0
- package/.pikku/channel/pikku-channels.gen.ts +4 -0
- package/.pikku/cli/pikku-cli-channel.gen.ts +34 -0
- package/.pikku/cli/pikku-cli-client.gen.ts +43 -0
- package/.pikku/cli/pikku-cli-types.gen.ts +70 -0
- package/.pikku/cli/pikku-cli-wirings-meta.gen.ts +145 -0
- package/.pikku/cli/pikku-cli-wirings.gen.ts +6 -0
- package/.pikku/cli/pikku-cli.gen.ts +41 -0
- package/.pikku/function/pikku-function-types.gen.ts +440 -0
- package/.pikku/function/pikku-functions-meta.gen.ts +845 -0
- package/.pikku/function/pikku-functions-meta.min.gen.ts +181 -0
- package/.pikku/function/pikku-functions.gen.ts +76 -0
- package/.pikku/http/pikku-http-types.gen.ts +86 -0
- package/.pikku/http/pikku-http-wirings-map.gen.d.ts +43 -0
- package/.pikku/http/pikku-http-wirings-meta.gen.ts +13 -0
- package/.pikku/http/pikku-http-wirings.gen.ts +4 -0
- package/.pikku/mcp/pikku-mcp-types.gen.ts +140 -0
- package/.pikku/mcp/pikku-mcp-wirings-meta.gen.ts +7 -0
- package/.pikku/mcp/pikku-mcp-wirings.gen.ts +4 -0
- package/.pikku/mcp/pikku-mcp.gen.json +5 -0
- package/.pikku/pikku-bootstrap.gen.ts +19 -0
- package/.pikku/pikku-services.gen.ts +20 -0
- package/.pikku/pikku-types.gen.ts +27 -0
- package/.pikku/pikku-websocket.gen.ts +76 -0
- package/.pikku/queue/pikku-queue-types.gen.ts +27 -0
- package/.pikku/queue/pikku-queue-workers-wirings-map.gen.d.ts +57 -0
- package/.pikku/queue/pikku-queue-workers-wirings-meta.gen.ts +5 -0
- package/.pikku/queue/pikku-queue-workers-wirings.gen.ts +4 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +47 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +82 -0
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +41 -0
- package/.pikku/scheduler/pikku-scheduler-types.gen.ts +25 -0
- package/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.ts +5 -0
- package/.pikku/scheduler/pikku-schedulers-wirings.gen.ts +4 -0
- package/.pikku/schemas/register.gen.ts +51 -0
- package/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuCLIOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuFunctionsOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuHTTPOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuMCPOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuMiddlewareOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuPermissionsOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuQueueOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuRPCOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuSchedulerOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -0
- package/CHANGELOG.md +15 -0
- package/bin/pikku.ts +97 -14
- package/build.sh +53 -0
- package/cli.schema.json +1 -382
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +56 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.js +52 -0
- package/dist/.pikku/channel/pikku-channels-meta.gen.js +5 -0
- package/dist/.pikku/channel/pikku-channels.gen.d.ts +4 -0
- package/dist/.pikku/channel/pikku-channels.gen.js +5 -0
- package/dist/.pikku/cli/pikku-cli-channel.gen.d.ts +1 -0
- package/dist/.pikku/cli/pikku-cli-channel.gen.js +33 -0
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +10 -0
- package/dist/.pikku/cli/pikku-cli-client.gen.js +34 -0
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +52 -0
- package/dist/.pikku/cli/pikku-cli-types.gen.js +31 -0
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +145 -0
- package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +5 -0
- package/dist/.pikku/cli/pikku-cli-wirings.gen.js +6 -0
- package/dist/.pikku/cli/pikku-cli.gen.d.ts +10 -0
- package/dist/.pikku/cli/pikku-cli.gen.js +38 -0
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +380 -0
- package/dist/.pikku/function/pikku-function-types.gen.js +271 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.d.ts +1 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.js +845 -0
- package/dist/.pikku/function/pikku-functions-meta.min.gen.d.ts +1 -0
- package/dist/.pikku/function/pikku-functions-meta.min.gen.js +181 -0
- package/dist/.pikku/function/pikku-functions.gen.d.ts +1 -0
- package/dist/.pikku/function/pikku-functions.gen.js +75 -0
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +68 -0
- package/dist/.pikku/http/pikku-http-types.gen.js +62 -0
- package/dist/.pikku/http/pikku-http-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +13 -0
- package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +4 -0
- package/dist/.pikku/http/pikku-http-wirings.gen.js +5 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +91 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +71 -0
- package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.js +7 -0
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.d.ts +4 -0
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.js +5 -0
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +19 -0
- package/dist/.pikku/pikku-bootstrap.gen.js +19 -0
- package/dist/.pikku/pikku-services.gen.d.ts +13 -0
- package/dist/.pikku/pikku-services.gen.js +5 -0
- package/dist/.pikku/pikku-types.gen.d.ts +13 -0
- package/dist/.pikku/pikku-types.gen.js +20 -0
- package/dist/.pikku/pikku-websocket.gen.d.ts +31 -0
- package/dist/.pikku/pikku-websocket.gen.js +49 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +23 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.js +16 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +5 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +4 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +5 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts +1 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +41 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +21 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +16 -0
- package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.js +5 -0
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.d.ts +4 -0
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.js +5 -0
- package/dist/.pikku/schemas/register.gen.d.ts +1 -0
- package/dist/.pikku/schemas/register.gen.js +28 -0
- package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuCLIOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuFunctionsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuHTTPOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMCPOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuMiddlewareOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuPermissionsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuQueueOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuRPCOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuSchedulerOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -0
- package/dist/bin/pikku.js +63 -14
- package/dist/src/cli.wiring.d.ts +1 -0
- package/dist/src/cli.wiring.js +99 -0
- package/dist/src/functions/commands/all.d.ts +1 -0
- package/dist/src/functions/commands/all.js +114 -0
- package/dist/src/functions/commands/watch.d.ts +1 -0
- package/dist/src/functions/commands/watch.js +47 -0
- package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.d.ts +1 -0
- package/dist/src/{runtimes → functions/runtimes}/nextjs/pikku-command-nextjs.js +33 -12
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.d.ts +1 -0
- package/dist/src/{runtimes → functions/runtimes}/nextjs/serialize-nextjs-backend-wrapper.js +2 -2
- package/dist/src/functions/wirings/channels/pikku-channels.d.ts +1 -0
- package/dist/src/functions/wirings/channels/pikku-channels.js +19 -0
- package/dist/src/functions/wirings/channels/pikku-command-channel-types.d.ts +1 -0
- package/dist/src/functions/wirings/channels/pikku-command-channel-types.js +19 -0
- package/dist/src/functions/wirings/channels/pikku-command-channels-map.d.ts +1 -0
- package/dist/src/functions/wirings/channels/pikku-command-channels-map.js +18 -0
- package/dist/src/functions/wirings/channels/pikku-command-channels.d.ts +1 -0
- package/dist/src/functions/wirings/channels/pikku-command-channels.js +20 -0
- package/dist/src/functions/wirings/channels/pikku-command-websocket-typed.d.ts +1 -0
- package/dist/src/functions/wirings/channels/pikku-command-websocket-typed.js +27 -0
- package/dist/src/functions/wirings/channels/serialize-channel-types.d.ts +4 -0
- package/dist/src/functions/wirings/channels/serialize-channel-types.js +94 -0
- package/dist/src/{wirings → functions/wirings}/channels/serialize-typed-channel-map.js +6 -3
- package/dist/src/functions/wirings/cli/pikku-command-cli-entry.d.ts +1 -0
- package/dist/src/functions/wirings/cli/pikku-command-cli-entry.js +123 -0
- package/dist/src/functions/wirings/cli/pikku-command-cli-types.d.ts +1 -0
- package/dist/src/functions/wirings/cli/pikku-command-cli-types.js +31 -0
- package/dist/src/functions/wirings/cli/pikku-command-cli.d.ts +1 -0
- package/dist/src/functions/wirings/cli/pikku-command-cli.js +22 -0
- package/dist/src/functions/wirings/cli/serialize-channel-cli-client.d.ts +11 -0
- package/dist/src/functions/wirings/cli/serialize-channel-cli-client.js +131 -0
- package/dist/src/functions/wirings/cli/serialize-channel-cli.d.ts +9 -0
- package/dist/src/functions/wirings/cli/serialize-channel-cli.js +67 -0
- package/dist/src/functions/wirings/cli/serialize-cli-types.d.ts +4 -0
- package/dist/src/functions/wirings/cli/serialize-cli-types.js +73 -0
- package/dist/src/functions/wirings/cli/serialize-local-cli-bootstrap.d.ts +14 -0
- package/dist/src/functions/wirings/cli/serialize-local-cli-bootstrap.js +51 -0
- package/dist/src/functions/wirings/fetch/index.d.ts +1 -0
- package/dist/src/functions/wirings/fetch/index.js +27 -0
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.d.ts +1 -0
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +33 -0
- package/dist/src/functions/wirings/functions/pikku-command-function-types.d.ts +1 -0
- package/dist/src/functions/wirings/functions/pikku-command-function-types.js +18 -0
- package/dist/src/functions/wirings/functions/pikku-command-functions.d.ts +1 -0
- package/dist/src/functions/wirings/functions/pikku-command-functions.js +26 -0
- package/dist/src/functions/wirings/functions/pikku-command-services.d.ts +2 -0
- package/dist/src/{wirings → functions/wirings}/functions/pikku-command-services.js +36 -29
- package/dist/src/functions/wirings/functions/pikku-function-types.d.ts +1 -0
- package/dist/src/functions/wirings/functions/pikku-function-types.js +18 -0
- package/dist/src/functions/wirings/functions/schemas.d.ts +4 -0
- package/dist/src/functions/wirings/functions/schemas.js +20 -0
- package/dist/src/{wirings → functions/wirings}/functions/serialize-function-imports.js +4 -21
- package/dist/src/functions/wirings/functions/serialize-function-types.d.ts +4 -0
- package/dist/src/functions/wirings/functions/serialize-function-types.js +443 -0
- package/dist/src/functions/wirings/functions/serialize-pikku-types-hub.d.ts +4 -0
- package/dist/src/functions/wirings/functions/serialize-pikku-types-hub.js +30 -0
- package/dist/src/{wirings → functions/wirings}/http/openapi-spec-generator.d.ts +4 -2
- package/dist/src/{wirings → functions/wirings}/http/openapi-spec-generator.js +2 -2
- package/dist/src/functions/wirings/http/pikku-command-http-map.d.ts +1 -0
- package/dist/src/functions/wirings/http/pikku-command-http-map.js +18 -0
- package/dist/src/functions/wirings/http/pikku-command-http-routes.d.ts +1 -0
- package/dist/src/functions/wirings/http/pikku-command-http-routes.js +20 -0
- package/dist/src/functions/wirings/http/pikku-command-http-types.d.ts +1 -0
- package/dist/src/functions/wirings/http/pikku-command-http-types.js +19 -0
- package/dist/src/functions/wirings/http/pikku-command-openapi.d.ts +1 -0
- package/dist/src/functions/wirings/http/pikku-command-openapi.js +37 -0
- package/dist/src/functions/wirings/http/pikku-http-routes.d.ts +1 -0
- package/dist/src/functions/wirings/http/pikku-http-routes.js +20 -0
- package/dist/src/functions/wirings/http/serialize-http-types.d.ts +4 -0
- package/dist/src/functions/wirings/http/serialize-http-types.js +89 -0
- package/dist/src/{wirings → functions/wirings}/http/serialize-typed-http-map.js +2 -2
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-json.d.ts +1 -0
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-json.js +23 -0
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-types.d.ts +1 -0
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-types.js +19 -0
- package/dist/src/functions/wirings/mcp/pikku-command-mcp.d.ts +1 -0
- package/dist/src/{wirings → functions/wirings}/mcp/pikku-command-mcp.js +17 -5
- package/dist/src/{wirings → functions/wirings}/mcp/serialize-mcp-json.d.ts +2 -2
- package/dist/src/functions/wirings/mcp/serialize-mcp-types.d.ts +4 -0
- package/dist/src/functions/wirings/mcp/serialize-mcp-types.js +143 -0
- package/dist/src/functions/wirings/middleware/pikku-command-middleware.d.ts +1 -0
- package/dist/src/functions/wirings/middleware/pikku-command-middleware.js +36 -0
- package/dist/src/functions/wirings/middleware/serialize-middleware-groups-meta.d.ts +8 -0
- package/dist/src/functions/wirings/middleware/serialize-middleware-groups-meta.js +44 -0
- package/dist/src/functions/wirings/middleware/serialize-middleware-imports.d.ts +2 -0
- package/dist/src/functions/wirings/middleware/serialize-middleware-imports.js +43 -0
- package/dist/src/functions/wirings/permissions/pikku-command-permissions.d.ts +1 -0
- package/dist/src/functions/wirings/permissions/pikku-command-permissions.js +28 -0
- package/dist/src/functions/wirings/permissions/serialize-permissions-imports.d.ts +2 -0
- package/dist/src/functions/wirings/permissions/serialize-permissions-imports.js +43 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue-map.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue-map.js +18 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue-service.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue-service.js +27 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue-types.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue-types.js +19 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue.js +21 -0
- package/dist/src/functions/wirings/queue/pikku-queue-map.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-queue-map.js +18 -0
- package/dist/src/functions/wirings/queue/pikku-queue.d.ts +1 -0
- package/dist/src/functions/wirings/queue/pikku-queue.js +21 -0
- package/dist/src/{wirings → functions/wirings}/queue/serialize-queue-map.js +2 -2
- package/dist/src/{wirings → functions/wirings}/queue/serialize-queue-meta.d.ts +1 -1
- package/dist/src/functions/wirings/queue/serialize-queue-types.d.ts +4 -0
- package/dist/src/functions/wirings/queue/serialize-queue-types.js +30 -0
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.d.ts +1 -0
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.js +27 -0
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.d.ts +2 -0
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.js +32 -0
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.d.ts +1 -0
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +20 -0
- package/dist/src/{wirings → functions/wirings}/rpc/serialize-typed-rpc-map.js +2 -2
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler-types.d.ts +1 -0
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler-types.js +19 -0
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.d.ts +1 -0
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.js +21 -0
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-types.d.ts +4 -0
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-types.js +28 -0
- package/dist/src/middleware/log-command-info-and-time.d.ts +13 -0
- package/dist/src/middleware/log-command-info-and-time.js +15 -0
- package/dist/src/services/cli-logger-forwarder.service.d.ts +30 -0
- package/dist/src/services/cli-logger-forwarder.service.js +64 -0
- package/dist/src/services/cli-logger.service.d.ts +23 -0
- package/dist/src/services/cli-logger.service.js +77 -0
- package/dist/src/services.d.ts +20 -0
- package/dist/src/services.js +162 -0
- package/dist/src/utils/check-required-types.d.ts +10 -0
- package/dist/src/utils/check-required-types.js +31 -0
- package/dist/src/utils/custom-types-generator.d.ts +2 -0
- package/dist/src/utils/custom-types-generator.js +43 -0
- package/dist/src/utils/file-import-path.d.ts +1 -0
- package/dist/src/utils/file-import-path.js +43 -0
- package/dist/src/utils/file-imports-serializer.d.ts +1 -0
- package/dist/src/utils/file-imports-serializer.js +13 -0
- package/dist/src/utils/file-writer.d.ts +9 -0
- package/dist/src/utils/file-writer.js +50 -0
- package/dist/src/utils/generate-bootstrap-file.d.ts +3 -0
- package/dist/src/utils/generate-bootstrap-file.js +21 -0
- package/dist/src/utils/get-cli-version.d.ts +5 -0
- package/dist/src/utils/get-cli-version.js +27 -0
- package/dist/src/utils/pikku-cli-config.d.ts +4 -0
- package/dist/src/utils/pikku-cli-config.js +224 -0
- package/dist/src/utils/pikku-files-and-methods.d.ts +21 -0
- package/dist/src/utils/pikku-files-and-methods.js +70 -0
- package/dist/src/{schema-generator.d.ts → utils/schema-generator.d.ts} +1 -1
- package/dist/src/{schema-generator.js → utils/schema-generator.js} +4 -3
- package/dist/src/{serialize-import-map.js → utils/serialize-import-map.js} +1 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -11
- package/pikku.config.json +26 -0
- package/src/cli.wiring.ts +102 -0
- package/src/functions/commands/all.ts +153 -0
- package/src/functions/commands/watch.ts +58 -0
- package/src/functions/runtimes/nextjs/pikku-command-nextjs.ts +111 -0
- package/src/{runtimes → functions/runtimes}/nextjs/serialize-nextjs-backend-wrapper.ts +2 -2
- package/src/functions/wirings/channels/pikku-channels.ts +35 -0
- package/src/functions/wirings/channels/pikku-command-channel-types.ts +25 -0
- package/src/functions/wirings/channels/pikku-command-channels-map.ts +26 -0
- package/src/functions/wirings/channels/pikku-command-channels.ts +40 -0
- package/src/functions/wirings/channels/pikku-command-websocket-typed.ts +37 -0
- package/src/functions/wirings/channels/serialize-channel-types.ts +94 -0
- package/src/{wirings → functions/wirings}/channels/serialize-typed-channel-map.ts +6 -3
- package/src/functions/wirings/cli/pikku-command-cli-entry.ts +216 -0
- package/src/functions/wirings/cli/pikku-command-cli-types.ts +48 -0
- package/src/functions/wirings/cli/pikku-command-cli.ts +39 -0
- package/src/functions/wirings/cli/serialize-channel-cli-client.ts +171 -0
- package/src/functions/wirings/cli/serialize-channel-cli.ts +102 -0
- package/src/functions/wirings/cli/serialize-cli-types.ts +79 -0
- package/src/functions/wirings/cli/serialize-local-cli-bootstrap.ts +80 -0
- package/src/functions/wirings/fetch/index.ts +36 -0
- package/src/functions/wirings/functions/pikku-command-function-types-split.ts +60 -0
- package/src/functions/wirings/functions/pikku-command-function-types.ts +43 -0
- package/src/functions/wirings/functions/pikku-command-functions.ts +59 -0
- package/src/functions/wirings/functions/pikku-command-services.ts +111 -0
- package/src/functions/wirings/functions/pikku-function-types.ts +43 -0
- package/src/functions/wirings/functions/schemas.ts +45 -0
- package/src/{wirings → functions/wirings}/functions/serialize-function-imports.ts +4 -30
- package/src/functions/wirings/functions/serialize-function-types.ts +453 -0
- package/src/functions/wirings/functions/serialize-pikku-types-hub.ts +38 -0
- package/src/{wirings → functions/wirings}/http/openapi-spec-generator.ts +5 -2
- package/src/functions/wirings/http/pikku-command-http-map.ts +27 -0
- package/src/functions/wirings/http/pikku-command-http-routes.ts +36 -0
- package/src/functions/wirings/http/pikku-command-http-types.ts +25 -0
- package/src/functions/wirings/http/pikku-command-openapi.ts +62 -0
- package/src/functions/wirings/http/pikku-http-routes.ts +35 -0
- package/src/functions/wirings/http/serialize-http-types.ts +89 -0
- package/src/{wirings → functions/wirings}/http/serialize-typed-http-map.ts +2 -2
- package/src/functions/wirings/mcp/pikku-command-mcp-json.ts +33 -0
- package/src/functions/wirings/mcp/pikku-command-mcp-types.ts +25 -0
- package/src/{wirings → functions/wirings}/mcp/pikku-command-mcp.ts +50 -46
- package/src/{wirings → functions/wirings}/mcp/serialize-mcp-json.ts +2 -2
- package/src/functions/wirings/mcp/serialize-mcp-types.ts +143 -0
- package/src/functions/wirings/middleware/pikku-command-middleware.ts +63 -0
- package/src/functions/wirings/middleware/serialize-middleware-groups-meta.ts +55 -0
- package/src/functions/wirings/middleware/serialize-middleware-imports.ts +78 -0
- package/src/functions/wirings/permissions/pikku-command-permissions.ts +49 -0
- package/src/functions/wirings/permissions/serialize-permissions-imports.test.ts +274 -0
- package/src/functions/wirings/permissions/serialize-permissions-imports.ts +78 -0
- package/src/functions/wirings/queue/pikku-command-queue-map.ts +26 -0
- package/src/functions/wirings/queue/pikku-command-queue-service.ts +37 -0
- package/src/functions/wirings/queue/pikku-command-queue-types.ts +25 -0
- package/src/functions/wirings/queue/pikku-command-queue.ts +41 -0
- package/src/functions/wirings/queue/pikku-queue-map.ts +26 -0
- package/src/functions/wirings/queue/pikku-queue.ts +41 -0
- package/src/{wirings → functions/wirings}/queue/serialize-queue-map.ts +2 -2
- package/src/{wirings → functions/wirings}/queue/serialize-queue-meta.ts +1 -1
- package/src/functions/wirings/queue/serialize-queue-types.ts +30 -0
- package/src/functions/wirings/rpc/pikku-command-rpc-client.ts +35 -0
- package/src/functions/wirings/rpc/pikku-command-rpc-map.ts +48 -0
- package/src/functions/wirings/rpc/pikku-command-rpc.ts +26 -0
- package/src/{wirings → functions/wirings}/rpc/serialize-typed-rpc-map.ts +2 -2
- package/src/functions/wirings/scheduler/pikku-command-scheduler-types.ts +25 -0
- package/src/functions/wirings/scheduler/pikku-command-scheduler.ts +41 -0
- package/src/functions/wirings/scheduler/serialize-scheduler-types.ts +28 -0
- package/src/middleware/log-command-info-and-time.ts +35 -0
- package/src/services/cli-logger-forwarder.service.ts +90 -0
- package/src/services/cli-logger.service.ts +93 -0
- package/src/services.ts +240 -0
- package/src/utils/check-required-types.ts +53 -0
- package/src/utils/custom-types-generator.ts +55 -0
- package/src/{utils.test.ts → utils/file-import-path.test.ts} +1 -1
- package/src/utils/file-import-path.ts +53 -0
- package/src/utils/file-imports-serializer.ts +25 -0
- package/src/utils/file-writer.ts +72 -0
- package/src/utils/generate-bootstrap-file.ts +43 -0
- package/src/utils/get-cli-version.ts +28 -0
- package/src/utils/pikku-cli-config.ts +327 -0
- package/src/utils/pikku-files-and-methods.ts +148 -0
- package/src/{schema-generator.ts → utils/schema-generator.ts} +10 -4
- package/src/{serialize-import-map.ts → utils/serialize-import-map.ts} +1 -5
- package/tsconfig.json +2 -2
- package/types/application-types.d.ts +23 -0
- package/types/config.d.ts +204 -0
- package/bin/pikku-all.ts +0 -349
- package/bin/pikku-fetch.ts +0 -27
- package/bin/pikku-nextjs.ts +0 -44
- package/bin/pikku-openapi.ts +0 -31
- package/bin/pikku-queue-service.ts +0 -28
- package/bin/pikku-rpc.ts +0 -28
- package/bin/pikku-schemas.ts +0 -31
- package/bin/pikku-websocket.ts +0 -28
- package/dist/bin/pikku-all.d.ts +0 -4
- package/dist/bin/pikku-all.js +0 -194
- package/dist/bin/pikku-fetch.d.ts +0 -4
- package/dist/bin/pikku-fetch.js +0 -19
- package/dist/bin/pikku-nextjs.d.ts +0 -4
- package/dist/bin/pikku-nextjs.js +0 -24
- package/dist/bin/pikku-openapi.d.ts +0 -2
- package/dist/bin/pikku-openapi.js +0 -19
- package/dist/bin/pikku-queue-service.d.ts +0 -4
- package/dist/bin/pikku-queue-service.js +0 -19
- package/dist/bin/pikku-rpc.d.ts +0 -4
- package/dist/bin/pikku-rpc.js +0 -19
- package/dist/bin/pikku-schemas.d.ts +0 -2
- package/dist/bin/pikku-schemas.js +0 -21
- package/dist/bin/pikku-websocket.d.ts +0 -4
- package/dist/bin/pikku-websocket.js +0 -19
- package/dist/src/inspector-glob.d.ts +0 -2
- package/dist/src/inspector-glob.js +0 -12
- package/dist/src/pikku-cli-config.d.ts +0 -56
- package/dist/src/pikku-cli-config.js +0 -203
- package/dist/src/pikku-command-schemas.d.ts +0 -2
- package/dist/src/pikku-command-schemas.js +0 -8
- package/dist/src/runtimes/nextjs/pikku-command-nextjs.d.ts +0 -2
- package/dist/src/runtimes/nextjs/serialize-nextjs-backend-wrapper.d.ts +0 -1
- package/dist/src/schemas.d.ts +0 -2
- package/dist/src/schemas.js +0 -8
- package/dist/src/serialize-pikku-types.d.ts +0 -4
- package/dist/src/serialize-pikku-types.js +0 -605
- package/dist/src/types.d.ts +0 -5
- package/dist/src/utils.d.ts +0 -60
- package/dist/src/utils.js +0 -248
- package/dist/src/wirings/channels/pikku-channels.d.ts +0 -2
- package/dist/src/wirings/channels/pikku-channels.js +0 -9
- package/dist/src/wirings/channels/pikku-command-channels-map.d.ts +0 -2
- package/dist/src/wirings/channels/pikku-command-channels-map.js +0 -8
- package/dist/src/wirings/channels/pikku-command-channels.d.ts +0 -2
- package/dist/src/wirings/channels/pikku-command-channels.js +0 -9
- package/dist/src/wirings/channels/pikku-command-websocket-typed.d.ts +0 -2
- package/dist/src/wirings/channels/pikku-command-websocket-typed.js +0 -15
- package/dist/src/wirings/fetch/index.d.ts +0 -2
- package/dist/src/wirings/fetch/index.js +0 -12
- package/dist/src/wirings/functions/pikku-command-function-types.d.ts +0 -2
- package/dist/src/wirings/functions/pikku-command-function-types.js +0 -13
- package/dist/src/wirings/functions/pikku-command-functions.d.ts +0 -2
- package/dist/src/wirings/functions/pikku-command-functions.js +0 -14
- package/dist/src/wirings/functions/pikku-command-services.d.ts +0 -3
- package/dist/src/wirings/functions/pikku-function-types.d.ts +0 -2
- package/dist/src/wirings/functions/pikku-function-types.js +0 -13
- package/dist/src/wirings/http/pikku-command-http-map.d.ts +0 -2
- package/dist/src/wirings/http/pikku-command-http-map.js +0 -8
- package/dist/src/wirings/http/pikku-command-http-routes.d.ts +0 -2
- package/dist/src/wirings/http/pikku-command-http-routes.js +0 -9
- package/dist/src/wirings/http/pikku-command-openapi.d.ts +0 -2
- package/dist/src/wirings/http/pikku-command-openapi.js +0 -20
- package/dist/src/wirings/http/pikku-http-routes.d.ts +0 -2
- package/dist/src/wirings/http/pikku-http-routes.js +0 -9
- package/dist/src/wirings/mcp/pikku-command-mcp-json.d.ts +0 -2
- package/dist/src/wirings/mcp/pikku-command-mcp-json.js +0 -13
- package/dist/src/wirings/mcp/pikku-command-mcp.d.ts +0 -2
- package/dist/src/wirings/queue/pikku-command-queue-map.d.ts +0 -2
- package/dist/src/wirings/queue/pikku-command-queue-map.js +0 -8
- package/dist/src/wirings/queue/pikku-command-queue-service.d.ts +0 -2
- package/dist/src/wirings/queue/pikku-command-queue-service.js +0 -15
- package/dist/src/wirings/queue/pikku-command-queue.d.ts +0 -2
- package/dist/src/wirings/queue/pikku-command-queue.js +0 -10
- package/dist/src/wirings/queue/pikku-queue-map.d.ts +0 -2
- package/dist/src/wirings/queue/pikku-queue-map.js +0 -8
- package/dist/src/wirings/queue/pikku-queue.d.ts +0 -2
- package/dist/src/wirings/queue/pikku-queue.js +0 -10
- package/dist/src/wirings/rpc/pikku-command-rpc-client.d.ts +0 -2
- package/dist/src/wirings/rpc/pikku-command-rpc-client.js +0 -15
- package/dist/src/wirings/rpc/pikku-command-rpc-map.d.ts +0 -3
- package/dist/src/wirings/rpc/pikku-command-rpc-map.js +0 -14
- package/dist/src/wirings/rpc/pikku-command-rpc.d.ts +0 -2
- package/dist/src/wirings/rpc/pikku-command-rpc.js +0 -8
- package/dist/src/wirings/scheduler/pikku-command-scheduler.d.ts +0 -2
- package/dist/src/wirings/scheduler/pikku-command-scheduler.js +0 -10
- package/src/inspector-glob.ts +0 -30
- package/src/pikku-cli-config.ts +0 -387
- package/src/pikku-command-schemas.ts +0 -35
- package/src/runtimes/nextjs/pikku-command-nextjs.ts +0 -110
- package/src/schemas.ts +0 -35
- package/src/serialize-pikku-types.ts +0 -613
- package/src/types.ts +0 -16
- package/src/utils.ts +0 -420
- package/src/wirings/channels/pikku-channels.ts +0 -41
- package/src/wirings/channels/pikku-command-channels-map.ts +0 -26
- package/src/wirings/channels/pikku-command-channels.ts +0 -39
- package/src/wirings/channels/pikku-command-websocket-typed.ts +0 -36
- package/src/wirings/fetch/index.ts +0 -33
- package/src/wirings/functions/pikku-command-function-types.ts +0 -53
- package/src/wirings/functions/pikku-command-functions.ts +0 -48
- package/src/wirings/functions/pikku-command-services.ts +0 -125
- package/src/wirings/functions/pikku-function-types.ts +0 -52
- package/src/wirings/http/pikku-command-http-map.ts +0 -27
- package/src/wirings/http/pikku-command-http-routes.ts +0 -40
- package/src/wirings/http/pikku-command-openapi.ts +0 -55
- package/src/wirings/http/pikku-http-routes.ts +0 -40
- package/src/wirings/mcp/pikku-command-mcp-json.ts +0 -33
- package/src/wirings/queue/pikku-command-queue-map.ts +0 -26
- package/src/wirings/queue/pikku-command-queue-service.ts +0 -36
- package/src/wirings/queue/pikku-command-queue.ts +0 -45
- package/src/wirings/queue/pikku-queue-map.ts +0 -26
- package/src/wirings/queue/pikku-queue.ts +0 -43
- package/src/wirings/rpc/pikku-command-rpc-client.ts +0 -35
- package/src/wirings/rpc/pikku-command-rpc-map.ts +0 -49
- package/src/wirings/rpc/pikku-command-rpc.ts +0 -24
- package/src/wirings/scheduler/pikku-command-scheduler.ts +0 -43
- /package/dist/{src/types.js → .pikku/channel/pikku-channels-meta.gen.d.ts} +0 -0
- /package/dist/src/{runtimes → functions/runtimes}/nextjs/serialize-nextjs-http-wrapper.d.ts +0 -0
- /package/dist/src/{runtimes → functions/runtimes}/nextjs/serialize-nextjs-http-wrapper.js +0 -0
- /package/dist/src/{wirings → functions/wirings}/channels/serialize-typed-channel-map.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/channels/serialize-websocket-wrapper.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/channels/serialize-websocket-wrapper.js +0 -0
- /package/dist/src/{wirings → functions/wirings}/functions/serialize-function-imports.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/http/serialize-fetch-wrapper.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/http/serialize-fetch-wrapper.js +0 -0
- /package/dist/src/{wirings → functions/wirings}/http/serialize-typed-http-map.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/mcp/serialize-mcp-json.js +0 -0
- /package/dist/src/{wirings → functions/wirings}/queue/serialize-queue-map.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/queue/serialize-queue-meta.js +0 -0
- /package/dist/src/{wirings → functions/wirings}/queue/serialize-queue-wrapper.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/queue/serialize-queue-wrapper.js +0 -0
- /package/dist/src/{wirings → functions/wirings}/rpc/serialize-rpc-wrapper.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/rpc/serialize-rpc-wrapper.js +0 -0
- /package/dist/src/{wirings → functions/wirings}/rpc/serialize-typed-rpc-map.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/scheduler/serialize-scheduler-meta.d.ts +0 -0
- /package/dist/src/{wirings → functions/wirings}/scheduler/serialize-scheduler-meta.js +0 -0
- /package/dist/src/{serialize-import-map.d.ts → utils/serialize-import-map.d.ts} +0 -0
- /package/src/{runtimes → functions/runtimes}/nextjs/serialize-nextjs-http-wrapper.ts +0 -0
- /package/src/{wirings → functions/wirings}/channels/serialize-websocket-wrapper.ts +0 -0
- /package/src/{wirings → functions/wirings}/http/serialize-fetch-wrapper.ts +0 -0
- /package/src/{wirings → functions/wirings}/queue/serialize-queue-wrapper.ts +0 -0
- /package/src/{wirings → functions/wirings}/rpc/serialize-rpc-wrapper.ts +0 -0
- /package/src/{wirings → functions/wirings}/scheduler/serialize-scheduler-meta.ts +0 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { existsSync } from 'fs'
|
|
2
|
+
import { pikkuVoidFunc } from '../../../.pikku/pikku-types.gen.js'
|
|
3
|
+
import { getFileImportRelativePath } from '../../utils/file-import-path.js'
|
|
4
|
+
import { writeFileInDir } from '../../utils/file-writer.js'
|
|
5
|
+
|
|
6
|
+
export const all: any = pikkuVoidFunc({
|
|
7
|
+
func: async ({ logger, config, rpc, getInspectorState }) => {
|
|
8
|
+
const allImports: string[] = []
|
|
9
|
+
let typesDeclarationFileExists = true
|
|
10
|
+
|
|
11
|
+
if (!existsSync(config.typesDeclarationFile)) {
|
|
12
|
+
typesDeclarationFileExists = false
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
await rpc.invoke('pikkuFunctionTypes', null)
|
|
16
|
+
|
|
17
|
+
// This is needed since the wireHTTP function will add the routes to the visitState
|
|
18
|
+
if (!typesDeclarationFileExists) {
|
|
19
|
+
logger.info(`• Type file first created, inspecting again...\x1b[0m`)
|
|
20
|
+
await getInspectorState(true)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Generate wiring-specific type files for tree-shaking
|
|
24
|
+
await rpc.invoke('pikkuFunctionTypesSplit', null)
|
|
25
|
+
await rpc.invoke('pikkuHTTPTypes', null)
|
|
26
|
+
await rpc.invoke('pikkuChannelTypes', null)
|
|
27
|
+
await rpc.invoke('pikkuSchedulerTypes', null)
|
|
28
|
+
await rpc.invoke('pikkuQueueTypes', null)
|
|
29
|
+
await rpc.invoke('pikkuMCPTypes', null)
|
|
30
|
+
await rpc.invoke('pikkuCLITypes', null)
|
|
31
|
+
|
|
32
|
+
const hasFunctionRegistrations = await rpc.invoke('pikkuFunctions', null)
|
|
33
|
+
|
|
34
|
+
// Generate and register middleware
|
|
35
|
+
const middleware = await rpc.invoke('pikkuMiddleware', null)
|
|
36
|
+
// Middleware must be imported before functions meta to ensure registration happens first
|
|
37
|
+
if (middleware) {
|
|
38
|
+
allImports.push(config.middlewareFile)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Generate and register permissions
|
|
42
|
+
const permissions = await rpc.invoke('pikkuPermissions', null)
|
|
43
|
+
// Permissions must be imported before functions meta to ensure registration happens first
|
|
44
|
+
if (permissions) {
|
|
45
|
+
allImports.push(config.permissionsFile)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Always import functions meta (needed for all function metadata)
|
|
49
|
+
allImports.push(config.functionsMetaFile)
|
|
50
|
+
|
|
51
|
+
// Only import functionsFile if it was generated (has internal/external RPCs)
|
|
52
|
+
if (hasFunctionRegistrations) {
|
|
53
|
+
allImports.push(config.functionsFile)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Generate services map
|
|
57
|
+
await rpc.invoke('pikkuServices', null)
|
|
58
|
+
|
|
59
|
+
const hasInternalRPCs = await rpc.invoke('pikkuRPC', null)
|
|
60
|
+
await rpc.invoke('pikkuRPCInternalMap', null)
|
|
61
|
+
await rpc.invoke('pikkuRPCExposedMap', null)
|
|
62
|
+
await rpc.invoke('pikkuRPCClient', null)
|
|
63
|
+
|
|
64
|
+
if (hasInternalRPCs) {
|
|
65
|
+
allImports.push(config.rpcInternalWiringMetaFile)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const schemas = await rpc.invoke('pikkuSchemas', null)
|
|
69
|
+
if (schemas) {
|
|
70
|
+
allImports.push(`${config.schemaDirectory}/register.gen.ts`)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Generate HTTP
|
|
74
|
+
const http = await rpc.invoke('pikkuHTTP', null)
|
|
75
|
+
if (http) {
|
|
76
|
+
await rpc.invoke('pikkuHTTPMap', null)
|
|
77
|
+
await rpc.invoke('pikkuFetch', null)
|
|
78
|
+
allImports.push(config.httpWiringMetaFile, config.httpWiringsFile)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Generate Scheduler
|
|
82
|
+
const scheduler = await rpc.invoke('pikkuScheduler', null)
|
|
83
|
+
if (scheduler) {
|
|
84
|
+
allImports.push(
|
|
85
|
+
config.schedulersWiringMetaFile,
|
|
86
|
+
config.schedulersWiringFile
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Generate Queues
|
|
91
|
+
const queues = await rpc.invoke('pikkuQueue', null)
|
|
92
|
+
if (queues) {
|
|
93
|
+
await rpc.invoke('pikkuQueueMap', null)
|
|
94
|
+
await rpc.invoke('pikkuQueueService', null)
|
|
95
|
+
allImports.push(
|
|
96
|
+
config.queueWorkersWiringMetaFile,
|
|
97
|
+
config.queueWorkersWiringFile
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Generate Channels
|
|
102
|
+
const channels = await rpc.invoke('pikkuChannels', null)
|
|
103
|
+
if (channels) {
|
|
104
|
+
await rpc.invoke('pikkuChannelsMap', null)
|
|
105
|
+
await rpc.invoke('pikkuWebSocketTyped', null)
|
|
106
|
+
allImports.push(config.channelsWiringMetaFile, config.channelsWiringFile)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Generate MCP
|
|
110
|
+
const mcp = await rpc.invoke('pikkuMCP', null)
|
|
111
|
+
if (mcp) {
|
|
112
|
+
await rpc.invoke('pikkuMCPJSON', null)
|
|
113
|
+
allImports.push(config.mcpWiringsMetaFile, config.mcpWiringsFile)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Generate CLI
|
|
117
|
+
const cli = await rpc.invoke('pikkuCLI', null)
|
|
118
|
+
if (cli) {
|
|
119
|
+
await rpc.invoke('pikkuCLIEntry', null)
|
|
120
|
+
allImports.push(config.cliWiringMetaFile, config.cliWiringsFile)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (config.nextBackendFile || config.nextHTTPFile) {
|
|
124
|
+
await rpc.invoke('pikkuNext', null)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (config.openAPI) {
|
|
128
|
+
logger.info(
|
|
129
|
+
`• OpenAPI requires a reinspection to pickup new generated types..`
|
|
130
|
+
)
|
|
131
|
+
await getInspectorState(true)
|
|
132
|
+
await rpc.invoke('pikkuOpenAPI', null)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Generate main bootstrap file (pass all imports directly since this is the main file)
|
|
136
|
+
await writeFileInDir(
|
|
137
|
+
logger,
|
|
138
|
+
config.bootstrapFile,
|
|
139
|
+
allImports
|
|
140
|
+
.map(
|
|
141
|
+
(to) =>
|
|
142
|
+
`import '${getFileImportRelativePath(config.bootstrapFile, to, config.packageMappings)}'`
|
|
143
|
+
)
|
|
144
|
+
.sort((to) => (to.includes('meta') ? -1 : 1)) // Ensure meta files are at the top
|
|
145
|
+
.join('\n')
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
// Check for critical errors and exit if any were logged
|
|
149
|
+
if (logger.hasCriticalErrors()) {
|
|
150
|
+
process.exit(1)
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
})
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { pikkuVoidFunc } from '../../../.pikku/pikku-types.gen.js'
|
|
2
|
+
import chokidar from 'chokidar'
|
|
3
|
+
|
|
4
|
+
export const watch: any = pikkuVoidFunc({
|
|
5
|
+
func: async ({ logger, config, rpc }) => {
|
|
6
|
+
const configWatcher = chokidar.watch(config.srcDirectories, {
|
|
7
|
+
ignoreInitial: true,
|
|
8
|
+
ignored: /.*\.gen\.tsx?/,
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
let watcher = new chokidar.FSWatcher({})
|
|
12
|
+
|
|
13
|
+
const generatorWatcher = () => {
|
|
14
|
+
watcher.close()
|
|
15
|
+
|
|
16
|
+
logger.info(
|
|
17
|
+
`• Watching directories: \n - ${config.srcDirectories.join('\n - ')}`
|
|
18
|
+
)
|
|
19
|
+
watcher = chokidar.watch(config.srcDirectories, {
|
|
20
|
+
ignoreInitial: true,
|
|
21
|
+
ignored: /.*\.gen\.ts/,
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
watcher.on('ready', async () => {
|
|
25
|
+
const handle = async () => {
|
|
26
|
+
try {
|
|
27
|
+
const start = Date.now()
|
|
28
|
+
await rpc.invoke('all', null)
|
|
29
|
+
logger.info({
|
|
30
|
+
message: `✓ Generated in ${Date.now() - start}ms`,
|
|
31
|
+
type: 'timing',
|
|
32
|
+
})
|
|
33
|
+
} catch (err) {
|
|
34
|
+
logger.error(err)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
await handle()
|
|
39
|
+
|
|
40
|
+
let timeout: ReturnType<typeof setTimeout> | undefined
|
|
41
|
+
|
|
42
|
+
const deduped = (_file: string) => {
|
|
43
|
+
if (timeout) {
|
|
44
|
+
clearTimeout(timeout)
|
|
45
|
+
}
|
|
46
|
+
timeout = setTimeout(handle, 10)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
watcher.on('change', deduped)
|
|
50
|
+
watcher.on('add', deduped)
|
|
51
|
+
watcher.on('unlink', deduped)
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
configWatcher.on('ready', generatorWatcher)
|
|
56
|
+
configWatcher.on('change', generatorWatcher)
|
|
57
|
+
},
|
|
58
|
+
})
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
2
|
+
import { checkRequiredTypes } from '../../../utils/check-required-types.js'
|
|
3
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js'
|
|
4
|
+
import { writeFileInDir } from '../../../utils/file-writer.js'
|
|
5
|
+
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js'
|
|
6
|
+
import { serializeNextJsBackendWrapper as serializeNextBackendWrapper } from './serialize-nextjs-backend-wrapper.js'
|
|
7
|
+
import { serializeNextJsHTTPWrapper as serializeNextHTTPWrapper } from './serialize-nextjs-http-wrapper.js'
|
|
8
|
+
|
|
9
|
+
export const pikkuNext: any = pikkuSessionlessFunc<void, void>({
|
|
10
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
11
|
+
const {
|
|
12
|
+
nextBackendFile,
|
|
13
|
+
nextHTTPFile,
|
|
14
|
+
httpMapDeclarationFile,
|
|
15
|
+
packageMappings,
|
|
16
|
+
fetchFile,
|
|
17
|
+
} = config
|
|
18
|
+
|
|
19
|
+
// If both files are undefined, clean up any existing files and return
|
|
20
|
+
if (!nextBackendFile && !nextHTTPFile) {
|
|
21
|
+
logger.info({
|
|
22
|
+
message:
|
|
23
|
+
'Skipping generating nextjs wrapper since nextjs outfile is not defined.',
|
|
24
|
+
type: 'skip',
|
|
25
|
+
})
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const visitState = await getInspectorState()
|
|
30
|
+
|
|
31
|
+
if (nextHTTPFile && !fetchFile) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
'fetchFile is required in pikku config in order for nextJS http wrapper to work'
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (nextBackendFile) {
|
|
38
|
+
// Check for required types
|
|
39
|
+
checkRequiredTypes(visitState.filesAndMethodsErrors, {
|
|
40
|
+
config: true,
|
|
41
|
+
singletonServicesFactory: true,
|
|
42
|
+
sessionServicesFactory: true,
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const {
|
|
46
|
+
pikkuConfigFactory,
|
|
47
|
+
singletonServicesFactory,
|
|
48
|
+
sessionServicesFactory,
|
|
49
|
+
} = visitState.filesAndMethods
|
|
50
|
+
|
|
51
|
+
if (
|
|
52
|
+
!pikkuConfigFactory ||
|
|
53
|
+
!singletonServicesFactory ||
|
|
54
|
+
!sessionServicesFactory
|
|
55
|
+
) {
|
|
56
|
+
throw new Error('Required types not found')
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const pikkuConfigImport = `import { ${pikkuConfigFactory.variable} as createConfig } from '${getFileImportRelativePath(nextBackendFile, pikkuConfigFactory.file, packageMappings)}'`
|
|
60
|
+
const singletonServicesImport = `import { ${singletonServicesFactory.variable} as createSingletonServices } from '${getFileImportRelativePath(nextBackendFile, singletonServicesFactory.file, packageMappings)}'`
|
|
61
|
+
const sessionServicesImport = `import { ${sessionServicesFactory.variable} as createSessionServices } from '${getFileImportRelativePath(nextBackendFile, sessionServicesFactory.file, packageMappings)}'`
|
|
62
|
+
|
|
63
|
+
const bootstrapPath = getFileImportRelativePath(
|
|
64
|
+
nextBackendFile,
|
|
65
|
+
config.bootstrapFile,
|
|
66
|
+
packageMappings
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
const routesMapDeclarationPath = getFileImportRelativePath(
|
|
70
|
+
nextBackendFile,
|
|
71
|
+
httpMapDeclarationFile,
|
|
72
|
+
packageMappings
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
const content = serializeNextBackendWrapper(
|
|
76
|
+
bootstrapPath,
|
|
77
|
+
routesMapDeclarationPath,
|
|
78
|
+
pikkuConfigImport,
|
|
79
|
+
singletonServicesImport,
|
|
80
|
+
sessionServicesImport
|
|
81
|
+
)
|
|
82
|
+
await writeFileInDir(logger, nextBackendFile, content)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (nextHTTPFile && fetchFile) {
|
|
86
|
+
const routesMapDeclarationPath = getFileImportRelativePath(
|
|
87
|
+
nextHTTPFile,
|
|
88
|
+
httpMapDeclarationFile,
|
|
89
|
+
packageMappings
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
const fetchPath = getFileImportRelativePath(
|
|
93
|
+
nextHTTPFile,
|
|
94
|
+
fetchFile,
|
|
95
|
+
packageMappings
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
const content = serializeNextHTTPWrapper(
|
|
99
|
+
routesMapDeclarationPath,
|
|
100
|
+
fetchPath
|
|
101
|
+
)
|
|
102
|
+
await writeFileInDir(logger, nextHTTPFile, content)
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
middleware: [
|
|
106
|
+
logCommandInfoAndTime({
|
|
107
|
+
commandStart: 'Generating nextjs wrapper',
|
|
108
|
+
commandEnd: 'Generated nextjs wrapper',
|
|
109
|
+
}),
|
|
110
|
+
],
|
|
111
|
+
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const serializeNextJsBackendWrapper = (
|
|
2
|
-
|
|
2
|
+
bootstrapPath: string,
|
|
3
3
|
routesMapPath: string,
|
|
4
4
|
configImport: string,
|
|
5
5
|
singleServicesFactoryImport: string,
|
|
@@ -18,7 +18,7 @@ ${configImport}
|
|
|
18
18
|
${singleServicesFactoryImport}
|
|
19
19
|
${sessionServicesImport}
|
|
20
20
|
|
|
21
|
-
import '${
|
|
21
|
+
import '${bootstrapPath}'
|
|
22
22
|
|
|
23
23
|
let _pikku: PikkuNextJS | undefined
|
|
24
24
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { pikkuVoidFunc } 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
|
+
|
|
6
|
+
export const pikkuChannels: any = pikkuVoidFunc({
|
|
7
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
8
|
+
const visitState = await getInspectorState()
|
|
9
|
+
const { channelsWiringFile, channelsWiringMetaFile, packageMappings } =
|
|
10
|
+
config
|
|
11
|
+
const { channels } = visitState
|
|
12
|
+
|
|
13
|
+
await writeFileInDir(
|
|
14
|
+
logger,
|
|
15
|
+
channelsWiringFile,
|
|
16
|
+
serializeFileImports(
|
|
17
|
+
'addChannel',
|
|
18
|
+
channelsWiringFile,
|
|
19
|
+
channels.files,
|
|
20
|
+
packageMappings
|
|
21
|
+
)
|
|
22
|
+
)
|
|
23
|
+
await writeFileInDir(
|
|
24
|
+
logger,
|
|
25
|
+
channelsWiringMetaFile,
|
|
26
|
+
`import { pikkuState } from '@pikku/core'\npikkuState('channel', 'meta', ${JSON.stringify(channels.meta, null, 2)})`
|
|
27
|
+
)
|
|
28
|
+
},
|
|
29
|
+
middleware: [
|
|
30
|
+
logCommandInfoAndTime({
|
|
31
|
+
commandStart: 'Finding Channels',
|
|
32
|
+
commandEnd: 'Found channels',
|
|
33
|
+
}),
|
|
34
|
+
],
|
|
35
|
+
})
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { serializeChannelTypes } from './serialize-channel-types.js'
|
|
6
|
+
|
|
7
|
+
export const pikkuChannelTypes: any = pikkuSessionlessFunc<void, void>({
|
|
8
|
+
func: async ({ logger, config }) => {
|
|
9
|
+
const { channelsTypesFile, functionTypesFile, packageMappings } = config
|
|
10
|
+
|
|
11
|
+
const functionTypesImportPath = getFileImportRelativePath(
|
|
12
|
+
channelsTypesFile,
|
|
13
|
+
functionTypesFile,
|
|
14
|
+
packageMappings
|
|
15
|
+
)
|
|
16
|
+
const content = serializeChannelTypes(functionTypesImportPath)
|
|
17
|
+
await writeFileInDir(logger, channelsTypesFile, content)
|
|
18
|
+
},
|
|
19
|
+
middleware: [
|
|
20
|
+
logCommandInfoAndTime({
|
|
21
|
+
commandStart: 'Creating channel types',
|
|
22
|
+
commandEnd: 'Created channel types',
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
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 { serializeTypedChannelsMap } from './serialize-typed-channel-map.js'
|
|
5
|
+
|
|
6
|
+
export const pikkuChannelsMap: any = pikkuSessionlessFunc<void, void>({
|
|
7
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
8
|
+
const state = await getInspectorState()
|
|
9
|
+
const { channelsMapDeclarationFile, packageMappings } = config
|
|
10
|
+
|
|
11
|
+
const content = serializeTypedChannelsMap(
|
|
12
|
+
channelsMapDeclarationFile,
|
|
13
|
+
packageMappings,
|
|
14
|
+
state.functions.typesMap,
|
|
15
|
+
state.functions.meta,
|
|
16
|
+
state.channels.meta
|
|
17
|
+
)
|
|
18
|
+
await writeFileInDir(logger, channelsMapDeclarationFile, content)
|
|
19
|
+
},
|
|
20
|
+
middleware: [
|
|
21
|
+
logCommandInfoAndTime({
|
|
22
|
+
commandStart: 'Creating channels map',
|
|
23
|
+
commandEnd: 'Created channels map',
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
|
|
6
|
+
export const pikkuChannels: any = pikkuSessionlessFunc<
|
|
7
|
+
void,
|
|
8
|
+
boolean | undefined
|
|
9
|
+
>({
|
|
10
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
11
|
+
const visitState = await getInspectorState()
|
|
12
|
+
const { channelsWiringFile, channelsWiringMetaFile, packageMappings } =
|
|
13
|
+
config
|
|
14
|
+
const { channels } = visitState
|
|
15
|
+
|
|
16
|
+
await writeFileInDir(
|
|
17
|
+
logger,
|
|
18
|
+
channelsWiringFile,
|
|
19
|
+
serializeFileImports(
|
|
20
|
+
'addChannel',
|
|
21
|
+
channelsWiringFile,
|
|
22
|
+
channels.files,
|
|
23
|
+
packageMappings
|
|
24
|
+
)
|
|
25
|
+
)
|
|
26
|
+
await writeFileInDir(
|
|
27
|
+
logger,
|
|
28
|
+
channelsWiringMetaFile,
|
|
29
|
+
`import { pikkuState } from '@pikku/core'\npikkuState('channel', 'meta', ${JSON.stringify(channels.meta, null, 2)})`
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
return true
|
|
33
|
+
},
|
|
34
|
+
middleware: [
|
|
35
|
+
logCommandInfoAndTime({
|
|
36
|
+
commandStart: 'Finding Channels',
|
|
37
|
+
commandEnd: 'Found channels',
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
})
|
|
@@ -0,0 +1,37 @@
|
|
|
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 { serializeWebsocketWrapper } from './serialize-websocket-wrapper.js'
|
|
6
|
+
|
|
7
|
+
export const pikkuWebSocketTyped: any = pikkuSessionlessFunc<void, void>({
|
|
8
|
+
func: async ({ logger, config }) => {
|
|
9
|
+
const { websocketFile, channelsMapDeclarationFile, packageMappings } =
|
|
10
|
+
config
|
|
11
|
+
|
|
12
|
+
// If websocketFile is not set, clean up any existing file and return
|
|
13
|
+
if (!websocketFile) {
|
|
14
|
+
logger.info({
|
|
15
|
+
message:
|
|
16
|
+
"Skipping generating websocket wrapper since websocketFile isn't set in the pikku config.",
|
|
17
|
+
type: 'skip',
|
|
18
|
+
})
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const channelsMapDeclarationPath = getFileImportRelativePath(
|
|
23
|
+
websocketFile,
|
|
24
|
+
channelsMapDeclarationFile,
|
|
25
|
+
packageMappings
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
const content = [serializeWebsocketWrapper(channelsMapDeclarationPath)]
|
|
29
|
+
await writeFileInDir(logger, websocketFile, content.join('\n'))
|
|
30
|
+
},
|
|
31
|
+
middleware: [
|
|
32
|
+
logCommandInfoAndTime({
|
|
33
|
+
commandStart: 'Generating websocket wrapper',
|
|
34
|
+
commandEnd: 'Generated websocket wrapper',
|
|
35
|
+
}),
|
|
36
|
+
],
|
|
37
|
+
})
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates type definitions for WebSocket channel wirings
|
|
3
|
+
*/
|
|
4
|
+
export const serializeChannelTypes = (functionTypesImportPath: string) => {
|
|
5
|
+
return `/**
|
|
6
|
+
|
|
7
|
+
* Channel-specific type definitions for tree-shaking optimization
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { CoreChannel, wireChannel as wireChannelCore } from '@pikku/core/channel'
|
|
11
|
+
import { CorePikkuFunctionConfig } from '@pikku/core'
|
|
12
|
+
import { AssertHTTPWiringParams } from '@pikku/core/http'
|
|
13
|
+
import type { PikkuFunctionSessionless, PikkuPermission, PikkuMiddleware } from '${functionTypesImportPath}'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Type definition for WebSocket channels with typed data exchange.
|
|
17
|
+
* Supports connection, disconnection, and message handling.
|
|
18
|
+
*
|
|
19
|
+
* @template ChannelData - Type of data exchanged through the channel
|
|
20
|
+
* @template Channel - String literal type for the channel name
|
|
21
|
+
*/
|
|
22
|
+
type ChannelWiring<ChannelData, Channel extends string> = CoreChannel<
|
|
23
|
+
ChannelData,
|
|
24
|
+
Channel,
|
|
25
|
+
CorePikkuFunctionConfig<PikkuFunctionSessionless<void, any, ChannelData>, PikkuPermission<void>, PikkuMiddleware>,
|
|
26
|
+
CorePikkuFunctionConfig<PikkuFunctionSessionless<void, void, ChannelData>, PikkuPermission<void>, PikkuMiddleware>,
|
|
27
|
+
CorePikkuFunctionConfig<PikkuFunctionSessionless<any, any, ChannelData>, PikkuPermission<any>, PikkuMiddleware>,
|
|
28
|
+
PikkuPermission,
|
|
29
|
+
PikkuMiddleware
|
|
30
|
+
>
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Creates a function that handles WebSocket channel connections.
|
|
34
|
+
* Called when a client connects to a channel.
|
|
35
|
+
*
|
|
36
|
+
* @template Out - Output type for connection response
|
|
37
|
+
* @param func - Function definition, either direct function or configuration object
|
|
38
|
+
* @returns The normalized configuration object
|
|
39
|
+
*/
|
|
40
|
+
export const pikkuChannelConnectionFunc = <Out = unknown>(
|
|
41
|
+
func:
|
|
42
|
+
| PikkuFunctionSessionless<void, Out, unknown>
|
|
43
|
+
| CorePikkuFunctionConfig<PikkuFunctionSessionless<void, Out, unknown>, PikkuPermission<void>, PikkuMiddleware>
|
|
44
|
+
) => {
|
|
45
|
+
return typeof func === 'function' ? { func } : func
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Creates a function that handles WebSocket channel disconnections.
|
|
50
|
+
* Called when a client disconnects from a channel.
|
|
51
|
+
*
|
|
52
|
+
* @param func - Function definition, either direct function or configuration object
|
|
53
|
+
* @returns The normalized configuration object
|
|
54
|
+
*/
|
|
55
|
+
export const pikkuChannelDisconnectionFunc = (
|
|
56
|
+
func:
|
|
57
|
+
| PikkuFunctionSessionless<void, void, unknown>
|
|
58
|
+
| CorePikkuFunctionConfig<PikkuFunctionSessionless<void, void, unknown>, PikkuPermission<void>, PikkuMiddleware>
|
|
59
|
+
) => {
|
|
60
|
+
return typeof func === 'function' ? { func } : func
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Creates a function that handles WebSocket channel messages.
|
|
65
|
+
* Called when a message is received on a channel.
|
|
66
|
+
* This is the same as pikkuSessionlessFunc but with ChannelData = unknown by default.
|
|
67
|
+
*
|
|
68
|
+
* @template In - Input type for channel messages
|
|
69
|
+
* @template Out - Output type for channel responses
|
|
70
|
+
* @param func - Function definition, either direct function or configuration object
|
|
71
|
+
* @returns The normalized configuration object
|
|
72
|
+
*/
|
|
73
|
+
export const pikkuChannelFunc = <In, Out = unknown>(
|
|
74
|
+
func:
|
|
75
|
+
| PikkuFunctionSessionless<In, Out, unknown>
|
|
76
|
+
| CorePikkuFunctionConfig<PikkuFunctionSessionless<In, Out, unknown>, PikkuPermission<In>, PikkuMiddleware>
|
|
77
|
+
) => {
|
|
78
|
+
return typeof func === 'function' ? { func } : func
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Registers a WebSocket channel with the Pikku framework.
|
|
83
|
+
*
|
|
84
|
+
* @template ChannelData - Type of data associated with the channel
|
|
85
|
+
* @template Channel - String literal type for the channel name
|
|
86
|
+
* @param channel - Channel definition with connection, disconnection, and message handlers
|
|
87
|
+
*/
|
|
88
|
+
export const wireChannel = <ChannelData, Channel extends string>(
|
|
89
|
+
channel: ChannelWiring<ChannelData, Channel> & AssertHTTPWiringParams<ChannelData, Channel>
|
|
90
|
+
) => {
|
|
91
|
+
wireChannelCore(channel as any) // TODO
|
|
92
|
+
}
|
|
93
|
+
`
|
|
94
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChannelsMeta } from '@pikku/core/channel'
|
|
2
|
-
import { serializeImportMap } from '
|
|
2
|
+
import { serializeImportMap } from '../../../utils/serialize-import-map.js'
|
|
3
3
|
import { TypesMap } from '@pikku/inspector'
|
|
4
|
-
import { generateCustomTypes } from '
|
|
4
|
+
import { generateCustomTypes } from '../../../utils/custom-types-generator.js'
|
|
5
5
|
import { FunctionsMeta } from '@pikku/core'
|
|
6
6
|
|
|
7
7
|
export const serializeTypedChannelsMap = (
|
|
@@ -17,7 +17,10 @@ export const serializeTypedChannelsMap = (
|
|
|
17
17
|
)
|
|
18
18
|
typesMap.customTypes.forEach(({ references }) => {
|
|
19
19
|
for (const reference of references) {
|
|
20
|
-
|
|
20
|
+
// Skip __object types (placeholder types for invalid/broken functions)
|
|
21
|
+
if (reference !== '__object' && !reference.startsWith('__object_')) {
|
|
22
|
+
requiredTypes.add(reference)
|
|
23
|
+
}
|
|
21
24
|
}
|
|
22
25
|
})
|
|
23
26
|
const imports = serializeImportMap(
|