@pikku/cli 0.11.2 → 0.11.3
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 +63 -6
- package/.pikku/channel/pikku-channels-map.gen.d.ts +4 -4
- package/.pikku/channel/pikku-channels-meta.gen.ts +4 -2
- package/.pikku/channel/pikku-channels.gen.ts +1 -1
- package/.pikku/cli/pikku-cli-channel.ts +1 -1
- package/.pikku/cli/pikku-cli-client.gen.ts +1 -1
- package/.pikku/cli/pikku-cli-types.gen.ts +1 -1
- package/.pikku/cli/pikku-cli-wirings-meta.gen.json +2 -1
- package/.pikku/cli/pikku-cli-wirings-meta.gen.ts +2 -2
- package/.pikku/cli/pikku-cli-wirings.gen.ts +1 -1
- package/.pikku/cli/pikku-cli.gen.ts +1 -1
- package/.pikku/forge/pikku-forge-types.gen.ts +83 -0
- package/.pikku/function/pikku-function-types.gen.ts +181 -35
- package/.pikku/function/pikku-functions-meta-verbose.gen.json +1030 -0
- package/.pikku/function/pikku-functions-meta.gen.json +88 -420
- package/.pikku/function/pikku-functions-meta.gen.ts +2 -2
- package/.pikku/http/pikku-http-types.gen.ts +19 -3
- package/.pikku/http/pikku-http-wirings-map.gen.d.ts +4 -4
- package/.pikku/http/pikku-http-wirings-meta.gen.json +9 -0
- package/.pikku/http/pikku-http-wirings-meta.gen.ts +4 -10
- package/.pikku/http/pikku-http-wirings.gen.ts +1 -1
- package/.pikku/mcp/pikku-mcp-types.gen.ts +69 -17
- package/.pikku/mcp/pikku-mcp-wirings-meta.gen.ts +4 -4
- package/.pikku/mcp/pikku-mcp-wirings.gen.ts +1 -1
- package/.pikku/pikku-bootstrap.gen.ts +7 -9
- package/.pikku/pikku-services.gen.ts +3 -2
- package/.pikku/pikku-types.gen.ts +4 -1
- package/.pikku/pikku-websocket.gen.ts +1 -1
- package/.pikku/queue/pikku-queue-types.gen.ts +1 -1
- package/.pikku/queue/pikku-queue-workers-wirings-map.gen.d.ts +4 -4
- package/.pikku/queue/pikku-queue-workers-wirings-meta.gen.ts +2 -2
- package/.pikku/queue/pikku-queue-workers-wirings.gen.ts +1 -1
- package/.pikku/rpc/pikku-remote-rpc-workers.gen.ts +4 -1
- package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +12 -7
- package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +15 -9
- package/.pikku/scheduler/pikku-scheduler-types.gen.ts +1 -1
- package/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.ts +2 -2
- package/.pikku/scheduler/pikku-schedulers-wirings.gen.ts +1 -1
- package/.pikku/schemas/register.gen.ts +9 -1
- package/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuCLIOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuForgeNodesOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuFunctionsOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuHTTPOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuMCPOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuMiddlewareOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuPackageOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuPermissionsOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuPublicRPCOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuQueueOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuRPCOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuRemoteRPCOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuSchedulerOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuWorkflowOutput.schema.json +1 -1
- package/.pikku/services/config.gen.json +11 -6
- package/.pikku/services/getInspectorState.gen.json +2 -2
- package/.pikku/services/jwt.gen.json +2 -2
- package/.pikku/services/logger.gen.json +2 -2
- package/.pikku/services/queueService.gen.json +2 -2
- package/.pikku/services/schedulerService.gen.json +2 -2
- package/.pikku/services/schema.gen.json +2 -2
- package/.pikku/services/secrets.gen.json +13 -0
- package/.pikku/services/variables.gen.json +2 -2
- package/.pikku/services/workflowService.gen.json +6 -6
- package/.pikku/workflow/pikku-workflow-map.gen.d.ts +2 -36
- package/.pikku/workflow/pikku-workflow-types.gen.ts +297 -45
- package/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +5 -4
- package/.pikku/workflow/pikku-workflow-wirings.gen.ts +1 -6
- package/CHANGELOG.md +23 -1
- package/cli.schema.json +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +47 -5
- package/dist/.pikku/channel/pikku-channel-types.gen.js +3 -13
- package/dist/.pikku/channel/pikku-channels-meta.gen.js +3 -2
- package/dist/.pikku/channel/pikku-channels.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channels.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-channel.js +1 -1
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +2 -2
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +2 -1
- package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
- package/dist/.pikku/forge/pikku-forge-types.gen.d.ts +72 -0
- package/dist/.pikku/forge/pikku-forge-types.gen.js +55 -0
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +123 -31
- package/dist/.pikku/function/pikku-function-types.gen.js +37 -51
- package/dist/.pikku/function/pikku-functions-meta.gen.js +2 -2
- package/dist/.pikku/function/pikku-functions-meta.gen.json +88 -420
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +18 -3
- package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
- package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +3 -10
- package/dist/.pikku/http/pikku-http-wirings-meta.gen.json +9 -0
- package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
- package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +54 -14
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +7 -31
- package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.js +4 -4
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.d.ts +1 -1
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.js +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +7 -9
- package/dist/.pikku/pikku-bootstrap.gen.js +7 -9
- package/dist/.pikku/pikku-services.gen.d.ts +3 -2
- package/dist/.pikku/pikku-services.gen.js +1 -0
- package/dist/.pikku/pikku-types.gen.d.ts +2 -1
- package/dist/.pikku/pikku-types.gen.js +3 -1
- package/dist/.pikku/pikku-websocket.gen.d.ts +1 -1
- package/dist/.pikku/pikku-websocket.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +2 -2
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-remote-rpc-workers.gen.d.ts +4 -1
- package/dist/.pikku/rpc/pikku-remote-rpc-workers.gen.js +4 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
- package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.js +2 -2
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.d.ts +1 -1
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.js +1 -1
- package/dist/.pikku/schemas/register.gen.js +5 -1
- package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuCLIOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuForgeNodesOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuFunctionsOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuHTTPOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuMCPOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuMiddlewareOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuPackageOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuPermissionsOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuPublicRPCOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuQueueOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuRPCOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuRemoteRPCOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuSchedulerOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuWorkflowOutput.schema.json +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +207 -37
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +104 -28
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +3 -3
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +2 -6
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +2 -6
- package/dist/src/functions/commands/all.js +117 -79
- package/dist/src/functions/commands/bootstrap.js +2 -9
- package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.js +0 -1
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.js +49 -35
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.js +49 -35
- package/dist/src/functions/wirings/channels/pikku-channels.js +1 -1
- package/dist/src/functions/wirings/channels/pikku-command-channels.js +18 -2
- package/dist/src/functions/wirings/channels/serialize-channel-types.js +62 -5
- package/dist/src/functions/wirings/channels/serialize-typed-channel-map.js +1 -2
- package/dist/src/functions/wirings/cli/pikku-command-cli.js +10 -2
- package/dist/src/functions/wirings/forge/pikku-command-forge-nodes.d.ts +1 -0
- package/dist/src/functions/wirings/forge/pikku-command-forge-nodes.js +90 -0
- package/dist/src/functions/wirings/forge/pikku-command-forge-types.d.ts +1 -0
- package/dist/src/functions/wirings/forge/pikku-command-forge-types.js +26 -0
- package/dist/src/functions/wirings/forge/serialize-forge-types.d.ts +4 -0
- package/dist/src/functions/wirings/forge/serialize-forge-types.js +90 -0
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-function-types.js +7 -2
- package/dist/src/functions/wirings/functions/pikku-command-functions.js +33 -18
- package/dist/src/functions/wirings/functions/pikku-command-services.js +1 -1
- package/dist/src/functions/wirings/functions/pikku-function-types.js +2 -2
- package/dist/src/functions/wirings/functions/schemas.d.ts +1 -1
- package/dist/src/functions/wirings/functions/schemas.js +5 -4
- package/dist/src/functions/wirings/functions/serialize-function-imports.d.ts +3 -1
- package/dist/src/functions/wirings/functions/serialize-function-imports.js +7 -3
- package/dist/src/functions/wirings/functions/serialize-function-types.d.ts +1 -1
- package/dist/src/functions/wirings/functions/serialize-function-types.js +181 -34
- package/dist/src/functions/wirings/functions/serialize-pikku-types-hub.d.ts +1 -1
- package/dist/src/functions/wirings/functions/serialize-pikku-types-hub.js +19 -21
- package/dist/src/functions/wirings/http/openapi-spec-generator.js +1 -1
- package/dist/src/functions/wirings/http/pikku-command-http-routes.js +18 -2
- package/dist/src/functions/wirings/http/pikku-command-openapi.js +2 -2
- package/dist/src/functions/wirings/http/pikku-http-routes.js +1 -1
- package/dist/src/functions/wirings/http/serialize-http-types.js +18 -2
- package/dist/src/functions/wirings/http/serialize-typed-http-map.js +33 -8
- package/dist/src/functions/wirings/mcp/pikku-command-mcp.js +15 -6
- package/dist/src/functions/wirings/mcp/serialize-mcp-json.js +3 -2
- package/dist/src/functions/wirings/mcp/serialize-mcp-types.js +68 -16
- package/dist/src/functions/wirings/middleware/pikku-command-middleware.js +5 -2
- package/dist/src/functions/wirings/package/pikku-command-package.d.ts +1 -0
- package/dist/src/functions/wirings/package/pikku-command-package.js +58 -0
- package/dist/src/functions/wirings/package/serialize-package.d.ts +5 -0
- package/dist/src/functions/wirings/package/serialize-package.js +32 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue.js +10 -2
- package/dist/src/functions/wirings/queue/pikku-queue.js +1 -9
- package/dist/src/functions/wirings/queue/serialize-queue-map.js +20 -3
- package/dist/src/functions/wirings/queue/serialize-queue-meta.js +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.js +4 -4
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +1 -1
- package/dist/src/functions/wirings/rpc/serialize-remote-rpc.js +3 -0
- package/dist/src/functions/wirings/rpc/serialize-rpc-wrapper.js +1 -1
- package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.js +54 -8
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.js +10 -1
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-meta.js +1 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +56 -18
- package/dist/src/functions/wirings/workflow/serialize-workflow-map.d.ts +3 -0
- package/dist/src/functions/wirings/workflow/serialize-workflow-map.js +30 -32
- package/dist/src/functions/wirings/workflow/serialize-workflow-meta.d.ts +1 -3
- package/dist/src/functions/wirings/workflow/serialize-workflow-meta.js +43 -18
- package/dist/src/functions/wirings/workflow/serialize-workflow-registration.d.ts +7 -0
- package/dist/src/functions/wirings/workflow/serialize-workflow-registration.js +53 -0
- package/dist/src/functions/wirings/workflow/serialize-workflow-types.d.ts +3 -1
- package/dist/src/functions/wirings/workflow/serialize-workflow-types.js +299 -45
- package/dist/src/functions/wirings/workflow/serialize-workflow-workers.d.ts +1 -1
- package/dist/src/functions/wirings/workflow/serialize-workflow-workers.js +14 -27
- package/dist/src/services.js +4 -1
- package/dist/src/utils/command-summary.d.ts +2 -0
- package/dist/src/utils/command-summary.js +2 -0
- package/dist/src/utils/custom-types-generator.js +13 -15
- package/dist/src/utils/generate-bootstrap-file.js +1 -1
- package/dist/src/utils/pikku-cli-config.js +37 -9
- package/dist/src/utils/schema-generator.d.ts +4 -3
- package/dist/src/utils/schema-generator.js +135 -15
- package/dist/src/utils/strip-verbose-meta.d.ts +43 -0
- package/dist/src/utils/strip-verbose-meta.js +210 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -4
- package/src/functions/commands/all.ts +144 -97
- package/src/functions/commands/bootstrap.ts +2 -10
- package/src/functions/runtimes/nextjs/pikku-command-nextjs.ts +0 -1
- package/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.ts +49 -35
- package/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.ts +49 -35
- package/src/functions/wirings/channels/pikku-channels.ts +1 -1
- package/src/functions/wirings/channels/pikku-command-channels.ts +46 -3
- package/src/functions/wirings/channels/serialize-channel-types.ts +62 -5
- package/src/functions/wirings/channels/serialize-typed-channel-map.ts +3 -2
- package/src/functions/wirings/cli/pikku-command-cli.ts +21 -2
- package/src/functions/wirings/forge/pikku-command-forge-nodes.ts +135 -0
- package/src/functions/wirings/forge/pikku-command-forge-types.ts +38 -0
- package/src/functions/wirings/forge/serialize-forge-types.ts +94 -0
- package/src/functions/wirings/functions/pikku-command-function-types-split.ts +3 -2
- package/src/functions/wirings/functions/pikku-command-function-types.ts +17 -10
- package/src/functions/wirings/functions/pikku-command-functions.ts +47 -37
- package/src/functions/wirings/functions/pikku-command-services.ts +1 -1
- package/src/functions/wirings/functions/pikku-function-types.ts +3 -1
- package/src/functions/wirings/functions/schemas.ts +14 -4
- package/src/functions/wirings/functions/serialize-function-imports.ts +12 -3
- package/src/functions/wirings/functions/serialize-function-types.ts +182 -34
- package/src/functions/wirings/functions/serialize-pikku-types-hub.ts +27 -26
- package/src/functions/wirings/http/openapi-spec-generator.ts +1 -1
- package/src/functions/wirings/http/pikku-command-http-routes.ts +46 -2
- package/src/functions/wirings/http/pikku-command-openapi.ts +3 -2
- package/src/functions/wirings/http/pikku-http-routes.ts +1 -1
- package/src/functions/wirings/http/serialize-http-types.ts +18 -2
- package/src/functions/wirings/http/serialize-typed-http-map.ts +32 -8
- package/src/functions/wirings/mcp/pikku-command-mcp.ts +32 -10
- package/src/functions/wirings/mcp/serialize-mcp-json.ts +8 -6
- package/src/functions/wirings/mcp/serialize-mcp-types.ts +68 -16
- package/src/functions/wirings/middleware/pikku-command-middleware.ts +6 -2
- package/src/functions/wirings/package/pikku-command-package.ts +81 -0
- package/src/functions/wirings/package/serialize-package.ts +69 -0
- package/src/functions/wirings/queue/pikku-command-queue.ts +22 -2
- package/src/functions/wirings/queue/pikku-queue.ts +1 -10
- package/src/functions/wirings/queue/serialize-queue-map.ts +18 -3
- package/src/functions/wirings/queue/serialize-queue-meta.ts +1 -1
- package/src/functions/wirings/rpc/pikku-command-rpc-map.ts +7 -4
- package/src/functions/wirings/rpc/pikku-command-rpc.ts +1 -1
- package/src/functions/wirings/rpc/serialize-remote-rpc.ts +3 -0
- package/src/functions/wirings/rpc/serialize-rpc-wrapper.ts +1 -1
- package/src/functions/wirings/rpc/serialize-typed-rpc-map.ts +74 -8
- package/src/functions/wirings/scheduler/pikku-command-scheduler.ts +22 -1
- package/src/functions/wirings/scheduler/serialize-scheduler-meta.ts +1 -1
- package/src/functions/wirings/workflow/pikku-command-workflow.ts +104 -37
- package/src/functions/wirings/workflow/serialize-workflow-map.ts +38 -40
- package/src/functions/wirings/workflow/serialize-workflow-meta.ts +66 -26
- package/src/functions/wirings/workflow/serialize-workflow-registration.ts +83 -0
- package/src/functions/wirings/workflow/serialize-workflow-types.ts +299 -45
- package/src/functions/wirings/workflow/serialize-workflow-workers.ts +14 -27
- package/src/services.ts +8 -1
- package/src/utils/command-summary.ts +4 -0
- package/src/utils/custom-types-generator.ts +15 -15
- package/src/utils/generate-bootstrap-file.ts +1 -1
- package/src/utils/pikku-cli-config.ts +51 -18
- package/src/utils/schema-generator.ts +185 -22
- package/src/utils/strip-verbose-meta.ts +254 -0
- package/types/config.d.ts +37 -3
- package/.pikku/function/pikku-functions-meta.min.gen.json +0 -212
- package/.pikku/function/pikku-functions-meta.min.gen.ts +0 -6
- package/dist/.pikku/function/pikku-functions-meta.min.gen.d.ts +0 -1
- package/dist/.pikku/function/pikku-functions-meta.min.gen.js +0 -6
- package/dist/.pikku/function/pikku-functions-meta.min.gen.json +0 -212
- package/dist/src/functions/wirings/workflow/pikku-command-workflow-map.d.ts +0 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow-map.js +0 -12
- package/dist/src/functions/wirings/workflow/pikku-command-workflow-types.d.ts +0 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow-types.js +0 -13
- package/dist/src/functions/wirings/workflow/serialize-workflow-wirings.d.ts +0 -8
- package/dist/src/functions/wirings/workflow/serialize-workflow-wirings.js +0 -30
- package/src/functions/wirings/workflow/pikku-command-workflow-map.ts +0 -24
- package/src/functions/wirings/workflow/pikku-command-workflow-types.ts +0 -29
- package/src/functions/wirings/workflow/serialize-workflow-wirings.ts +0 -47
- /package/.pikku/{workflow/pikku-workflow-wirings-meta.gen.json → channel/pikku-channels-meta.gen.json} +0 -0
- /package/dist/.pikku/{workflow/pikku-workflow-wirings-meta.gen.json → channel/pikku-channels-meta.gen.json} +0 -0
|
@@ -4,14 +4,12 @@ import { getFileImportRelativePath } from '../../utils/file-import-path.js'
|
|
|
4
4
|
import { writeFileInDir } from '../../utils/file-writer.js'
|
|
5
5
|
import { CommandSummary } from '../../utils/command-summary.js'
|
|
6
6
|
|
|
7
|
-
// Import all command functions directly
|
|
8
7
|
import { pikkuFunctionTypes } from '../wirings/functions/pikku-command-function-types.js'
|
|
9
8
|
import { pikkuFunctionTypesSplit } from '../wirings/functions/pikku-command-function-types-split.js'
|
|
10
9
|
import { pikkuHTTPTypes } from '../wirings/http/pikku-command-http-types.js'
|
|
11
10
|
import { pikkuChannelTypes } from '../wirings/channels/pikku-command-channel-types.js'
|
|
12
11
|
import { pikkuSchedulerTypes } from '../wirings/scheduler/pikku-command-scheduler-types.js'
|
|
13
12
|
import { pikkuQueueTypes } from '../wirings/queue/pikku-command-queue-types.js'
|
|
14
|
-
import { pikkuWorkflowTypes } from '../wirings/workflow/pikku-command-workflow-types.js'
|
|
15
13
|
import { pikkuMCPTypes } from '../wirings/mcp/pikku-command-mcp-types.js'
|
|
16
14
|
import { pikkuCLITypes } from '../wirings/cli/pikku-command-cli-types.js'
|
|
17
15
|
import { pikkuFunctions } from '../wirings/functions/pikku-command-functions.js'
|
|
@@ -33,7 +31,6 @@ import { pikkuFetch } from '../wirings/fetch/index.js'
|
|
|
33
31
|
import { pikkuScheduler } from '../wirings/scheduler/pikku-command-scheduler.js'
|
|
34
32
|
import { pikkuWorkflow } from '../wirings/workflow/pikku-command-workflow.js'
|
|
35
33
|
import { pikkuRemoteRPC } from '../wirings/rpc/pikku-command-remote-rpc.js'
|
|
36
|
-
import { pikkuWorkflowMap } from '../wirings/workflow/pikku-command-workflow-map.js'
|
|
37
34
|
import { pikkuQueue } from '../wirings/queue/pikku-command-queue.js'
|
|
38
35
|
import { pikkuQueueMap } from '../wirings/queue/pikku-command-queue-map.js'
|
|
39
36
|
import { pikkuQueueService } from '../wirings/queue/pikku-command-queue-service.js'
|
|
@@ -46,6 +43,9 @@ import { pikkuCLI } from '../wirings/cli/pikku-command-cli.js'
|
|
|
46
43
|
import { pikkuCLIEntry } from '../wirings/cli/pikku-command-cli-entry.js'
|
|
47
44
|
import { pikkuNext } from '../runtimes/nextjs/pikku-command-nextjs.js'
|
|
48
45
|
import { pikkuOpenAPI } from '../wirings/http/pikku-command-openapi.js'
|
|
46
|
+
import { pikkuPackage } from '../wirings/package/pikku-command-package.js'
|
|
47
|
+
import { pikkuForgeNodes } from '../wirings/forge/pikku-command-forge-nodes.js'
|
|
48
|
+
import { pikkuForgeTypes } from '../wirings/forge/pikku-command-forge-types.js'
|
|
49
49
|
import { PikkuWire } from '@pikku/core'
|
|
50
50
|
|
|
51
51
|
export const all: any = pikkuVoidFunc({
|
|
@@ -62,21 +62,21 @@ export const all: any = pikkuVoidFunc({
|
|
|
62
62
|
|
|
63
63
|
await pikkuFunctionTypes.func(services, null, wire)
|
|
64
64
|
|
|
65
|
-
// This is needed since the wireHTTP function will add the routes to the visitState
|
|
66
65
|
if (!typesDeclarationFileExists) {
|
|
67
66
|
logger.debug(`• Type file first created, inspecting again...`)
|
|
68
67
|
await getInspectorState(true)
|
|
69
68
|
}
|
|
70
69
|
|
|
71
|
-
// Generate wiring-specific type files for tree-shaking
|
|
72
70
|
await pikkuFunctionTypesSplit.func(services, null, wire)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
|
|
72
|
+
if (!config.externalPackage) {
|
|
73
|
+
await pikkuHTTPTypes.func(services, null, wire)
|
|
74
|
+
await pikkuChannelTypes.func(services, null, wire)
|
|
75
|
+
await pikkuSchedulerTypes.func(services, null, wire)
|
|
76
|
+
await pikkuQueueTypes.func(services, null, wire)
|
|
77
|
+
await pikkuMCPTypes.func(services, null, wire)
|
|
78
|
+
await pikkuCLITypes.func(services, null, wire)
|
|
79
|
+
}
|
|
80
80
|
|
|
81
81
|
const hasFunctionRegistrations = await pikkuFunctions.func(
|
|
82
82
|
services,
|
|
@@ -84,117 +84,115 @@ export const all: any = pikkuVoidFunc({
|
|
|
84
84
|
null
|
|
85
85
|
)
|
|
86
86
|
|
|
87
|
-
// Generate and register middleware
|
|
88
87
|
const middleware = await pikkuMiddleware.func(services, null, wire)
|
|
89
|
-
// Middleware must be imported before functions meta to ensure registration happens first
|
|
90
88
|
if (middleware) {
|
|
91
89
|
allImports.push(config.middlewareFile)
|
|
92
90
|
}
|
|
93
91
|
|
|
94
|
-
// Generate and register permissions
|
|
95
92
|
const permissions = await pikkuPermissions.func(services, null, wire)
|
|
96
|
-
// Permissions must be imported before functions meta to ensure registration happens first
|
|
97
93
|
if (permissions) {
|
|
98
94
|
allImports.push(config.permissionsFile)
|
|
99
95
|
}
|
|
100
96
|
|
|
101
|
-
// Always import functions meta (needed for all function metadata)
|
|
102
97
|
allImports.push(config.functionsMetaFile)
|
|
103
98
|
|
|
104
|
-
// Only import functionsFile if it was generated (has internal/external RPCs)
|
|
105
99
|
if (hasFunctionRegistrations) {
|
|
106
100
|
allImports.push(config.functionsFile)
|
|
107
101
|
}
|
|
108
102
|
|
|
109
|
-
// Generate services map
|
|
110
103
|
await pikkuServices.func(services, null, wire)
|
|
111
|
-
|
|
112
|
-
// Generate service metadata JSON files for AI consumption
|
|
113
104
|
await pikkuServiceMetadata.func(services, null, wire)
|
|
114
105
|
|
|
106
|
+
const hasPackageFactories = await pikkuPackage.func(services, null, wire)
|
|
107
|
+
if (hasPackageFactories) {
|
|
108
|
+
allImports.push(config.packageFile)
|
|
109
|
+
}
|
|
110
|
+
|
|
115
111
|
const hasInternalRPCs = await pikkuRPC.func(services, null, wire)
|
|
112
|
+
|
|
113
|
+
const schemas = await pikkuSchemas.func(services, null, wire)
|
|
114
|
+
if (schemas) {
|
|
115
|
+
allImports.push(`${config.schemaDirectory}/register.gen.ts`)
|
|
116
|
+
}
|
|
117
|
+
|
|
116
118
|
await pikkuRPCInternalMap.func(services, null, wire)
|
|
117
119
|
await pikkuRPCExposedMap.func(services, null, wire)
|
|
118
120
|
await pikkuPublicRPC.func(services, null, wire)
|
|
119
121
|
await pikkuRPCClient.func(services, null, wire)
|
|
120
122
|
|
|
123
|
+
await pikkuForgeTypes.func(services, null, wire)
|
|
124
|
+
|
|
121
125
|
if (hasInternalRPCs) {
|
|
122
126
|
allImports.push(config.rpcInternalWiringMetaFile)
|
|
123
127
|
}
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
await
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (scheduler) {
|
|
141
|
-
allImports.push(
|
|
142
|
-
config.schedulersWiringMetaFile,
|
|
143
|
-
config.schedulersWiringFile
|
|
144
|
-
)
|
|
129
|
+
if (!config.externalPackage) {
|
|
130
|
+
const http = await pikkuHTTP.func(services, null, wire)
|
|
131
|
+
if (http) {
|
|
132
|
+
await pikkuHTTPMap.func(services, null, wire)
|
|
133
|
+
await pikkuFetch.func(services, null, wire)
|
|
134
|
+
allImports.push(config.httpWiringMetaFile, config.httpWiringsFile)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const scheduler = await pikkuScheduler.func(services, null, wire)
|
|
138
|
+
if (scheduler) {
|
|
139
|
+
allImports.push(
|
|
140
|
+
config.schedulersWiringMetaFile,
|
|
141
|
+
config.schedulersWiringFile
|
|
142
|
+
)
|
|
143
|
+
}
|
|
145
144
|
}
|
|
146
145
|
|
|
147
|
-
// Generate Workflows
|
|
148
146
|
const workflows = await pikkuWorkflow.func(services, null, wire)
|
|
149
147
|
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
let remoteRPC = false
|
|
149
|
+
if (!config.externalPackage) {
|
|
150
|
+
remoteRPC = await pikkuRemoteRPC.func(services, null, wire)
|
|
151
|
+
}
|
|
152
152
|
|
|
153
|
-
// Reinspect to pick up generated workflow workers and remote RPC workers BEFORE generating maps
|
|
154
153
|
if (workflows || remoteRPC) {
|
|
155
154
|
await getInspectorState(true)
|
|
156
155
|
}
|
|
157
156
|
|
|
158
157
|
if (workflows) {
|
|
159
|
-
|
|
160
|
-
allImports.push(
|
|
161
|
-
config.workflowsWiringMetaFile,
|
|
162
|
-
config.workflowsWiringFile
|
|
163
|
-
)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// Generate Queues
|
|
167
|
-
const queues = await pikkuQueue.func(services, null, wire)
|
|
168
|
-
if (queues) {
|
|
169
|
-
await pikkuQueueMap.func(services, null, wire)
|
|
170
|
-
await pikkuQueueService.func(services, null, wire)
|
|
171
|
-
allImports.push(
|
|
172
|
-
config.queueWorkersWiringMetaFile,
|
|
173
|
-
config.queueWorkersWiringFile
|
|
174
|
-
)
|
|
158
|
+
allImports.push(config.workflowsWiringFile)
|
|
175
159
|
}
|
|
176
160
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
await
|
|
189
|
-
|
|
161
|
+
if (!config.externalPackage) {
|
|
162
|
+
const queues = await pikkuQueue.func(services, null, wire)
|
|
163
|
+
if (queues) {
|
|
164
|
+
await pikkuQueueMap.func(services, null, wire)
|
|
165
|
+
await pikkuQueueService.func(services, null, wire)
|
|
166
|
+
allImports.push(
|
|
167
|
+
config.queueWorkersWiringMetaFile,
|
|
168
|
+
config.queueWorkersWiringFile
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const channels = await pikkuChannels.func(services, null, wire)
|
|
173
|
+
if (channels) {
|
|
174
|
+
await pikkuChannelsMap.func(services, null, wire)
|
|
175
|
+
await pikkuWebSocketTyped.func(services, null, wire)
|
|
176
|
+
allImports.push(
|
|
177
|
+
config.channelsWiringMetaFile,
|
|
178
|
+
config.channelsWiringFile
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const mcp = await pikkuMCP.func(services, null, wire)
|
|
183
|
+
if (mcp) {
|
|
184
|
+
await pikkuMCPJSON.func(services, null, wire)
|
|
185
|
+
allImports.push(config.mcpWiringsMetaFile, config.mcpWiringsFile)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const cli = await pikkuCLI.func(services, null, wire)
|
|
189
|
+
if (cli) {
|
|
190
|
+
await pikkuCLIEntry.func(services, null, wire)
|
|
191
|
+
allImports.push(config.cliWiringMetaFile, config.cliWiringsFile)
|
|
192
|
+
}
|
|
190
193
|
}
|
|
191
194
|
|
|
192
|
-
|
|
193
|
-
const cli = await pikkuCLI.func(services, null, wire)
|
|
194
|
-
if (cli) {
|
|
195
|
-
await pikkuCLIEntry.func(services, null, wire)
|
|
196
|
-
allImports.push(config.cliWiringMetaFile, config.cliWiringsFile)
|
|
197
|
-
}
|
|
195
|
+
await pikkuForgeNodes.func(services, null, wire)
|
|
198
196
|
|
|
199
197
|
if (config.nextBackendFile || config.nextHTTPFile) {
|
|
200
198
|
await pikkuNext.func(services, null, wire)
|
|
@@ -208,23 +206,66 @@ export const all: any = pikkuVoidFunc({
|
|
|
208
206
|
await pikkuOpenAPI.func(services, null, wire)
|
|
209
207
|
}
|
|
210
208
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
209
|
+
const stateBeforeBootstrap = await getInspectorState()
|
|
210
|
+
const externalPackageBootstraps: string[] = []
|
|
211
|
+
const usedExternalPackages: Record<string, string> = {}
|
|
212
|
+
if (
|
|
213
|
+
config.externalPackages &&
|
|
214
|
+
stateBeforeBootstrap.rpc?.usedExternalPackages?.size > 0
|
|
215
|
+
) {
|
|
216
|
+
for (const namespace of stateBeforeBootstrap.rpc.usedExternalPackages) {
|
|
217
|
+
const packageName = config.externalPackages[namespace]
|
|
218
|
+
if (packageName) {
|
|
219
|
+
const packageBootstrap = `${packageName}/.pikku/pikku-bootstrap.gen.js`
|
|
220
|
+
externalPackageBootstraps.push(packageBootstrap)
|
|
221
|
+
usedExternalPackages[namespace] = packageName
|
|
222
|
+
logger.debug(
|
|
223
|
+
`• External package detected: ${namespace} (${packageName})`
|
|
224
|
+
)
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const localImports = allImports.map(
|
|
230
|
+
(to) =>
|
|
231
|
+
`import '${getFileImportRelativePath(config.bootstrapFile, to, config.packageMappings)}'`
|
|
232
|
+
)
|
|
233
|
+
const externalImports = externalPackageBootstraps.map(
|
|
234
|
+
(packagePath) => `import '${packagePath}'`
|
|
222
235
|
)
|
|
223
236
|
|
|
224
|
-
|
|
237
|
+
let externalPackagesRegistration = ''
|
|
238
|
+
if (Object.keys(usedExternalPackages).length > 0) {
|
|
239
|
+
externalPackagesRegistration = `
|
|
240
|
+
// Register external package mappings
|
|
241
|
+
import { pikkuState } from '@pikku/core'
|
|
242
|
+
const externalPackages = pikkuState(null, 'rpc', 'externalPackages')
|
|
243
|
+
${Object.entries(usedExternalPackages)
|
|
244
|
+
.map(([ns, pkg]) => `externalPackages.set('${ns}', '${pkg}')`)
|
|
245
|
+
.join('\n')}
|
|
246
|
+
`
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const allBootstrapImports =
|
|
250
|
+
[...localImports, ...externalImports]
|
|
251
|
+
.sort((a, b) => {
|
|
252
|
+
const aMeta = a.includes('meta')
|
|
253
|
+
const bMeta = b.includes('meta')
|
|
254
|
+
if (aMeta && !bMeta) return -1
|
|
255
|
+
if (!aMeta && bMeta) return 1
|
|
256
|
+
return 0
|
|
257
|
+
})
|
|
258
|
+
.join('\n') + externalPackagesRegistration
|
|
259
|
+
|
|
260
|
+
await writeFileInDir(logger, config.bootstrapFile, allBootstrapImports)
|
|
261
|
+
|
|
225
262
|
const state = await getInspectorState()
|
|
226
|
-
if (state.http?.meta)
|
|
227
|
-
|
|
263
|
+
if (state.http?.meta) {
|
|
264
|
+
const httpRouteCount = (
|
|
265
|
+
Object.values(state.http.meta) as Record<string, unknown>[]
|
|
266
|
+
).reduce((sum, routes) => sum + Object.keys(routes).length, 0)
|
|
267
|
+
if (httpRouteCount > 0) summary.set('httpRoutes', httpRouteCount)
|
|
268
|
+
}
|
|
228
269
|
if (state.channels?.meta)
|
|
229
270
|
summary.set('channels', Object.keys(state.channels.meta).length)
|
|
230
271
|
if (state.scheduledTasks?.meta)
|
|
@@ -242,7 +283,6 @@ export const all: any = pikkuVoidFunc({
|
|
|
242
283
|
if (mcpTotal > 0) summary.set('mcpEndpoints', mcpTotal)
|
|
243
284
|
}
|
|
244
285
|
if (state.cli?.meta) {
|
|
245
|
-
// Count total CLI commands across all programs
|
|
246
286
|
const totalCommands: number = Object.values(state.cli.meta).reduce(
|
|
247
287
|
(sum: number, program: any) => sum + (program.commands?.length || 0),
|
|
248
288
|
0
|
|
@@ -252,13 +292,20 @@ export const all: any = pikkuVoidFunc({
|
|
|
252
292
|
if (state.workflows?.meta) {
|
|
253
293
|
summary.set('workflows', Object.keys(state.workflows.meta).length)
|
|
254
294
|
}
|
|
295
|
+
if (state.forgeNodes?.meta) {
|
|
296
|
+
const forgeNodesCount = Object.keys(state.forgeNodes.meta).length
|
|
297
|
+
if (forgeNodesCount > 0) summary.set('forgeNodes', forgeNodesCount)
|
|
298
|
+
}
|
|
299
|
+
if (state.workflows?.graphMeta) {
|
|
300
|
+
const workflowGraphsCount = Object.keys(state.workflows.graphMeta).length
|
|
301
|
+
if (workflowGraphsCount > 0)
|
|
302
|
+
summary.set('workflowGraphs', workflowGraphsCount)
|
|
303
|
+
}
|
|
255
304
|
|
|
256
|
-
// Display summary (unless in silent mode)
|
|
257
305
|
if (!logger.isSilent()) {
|
|
258
306
|
console.log(summary.format())
|
|
259
307
|
}
|
|
260
308
|
|
|
261
|
-
// Check for critical errors and exit if any were logged
|
|
262
309
|
if (logger.hasCriticalErrors()) {
|
|
263
310
|
process.exit(1)
|
|
264
311
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { pikkuVoidFunc } from '../../../.pikku/pikku-types.gen.js'
|
|
2
|
-
|
|
3
|
-
// Import command functions directly
|
|
4
2
|
import { pikkuFunctionTypes } from '../wirings/functions/pikku-command-function-types.js'
|
|
5
3
|
import { pikkuFunctionTypesSplit } from '../wirings/functions/pikku-command-function-types-split.js'
|
|
6
4
|
import { pikkuHTTPTypes } from '../wirings/http/pikku-command-http-types.js'
|
|
7
5
|
import { pikkuChannelTypes } from '../wirings/channels/pikku-command-channel-types.js'
|
|
8
6
|
import { pikkuSchedulerTypes } from '../wirings/scheduler/pikku-command-scheduler-types.js'
|
|
9
7
|
import { pikkuQueueTypes } from '../wirings/queue/pikku-command-queue-types.js'
|
|
10
|
-
import {
|
|
8
|
+
import { pikkuWorkflow } from '../wirings/workflow/pikku-command-workflow.js'
|
|
11
9
|
import { pikkuMCPTypes } from '../wirings/mcp/pikku-command-mcp-types.js'
|
|
12
10
|
import { pikkuCLITypes } from '../wirings/cli/pikku-command-cli-types.js'
|
|
13
11
|
import { PikkuWire } from '@pikku/core'
|
|
@@ -17,25 +15,19 @@ export const bootstrap: any = pikkuVoidFunc({
|
|
|
17
15
|
const wire: PikkuWire = {}
|
|
18
16
|
const services = { logger, config, getInspectorState }
|
|
19
17
|
|
|
20
|
-
// Initialize inspector state in bootstrap mode with core types only
|
|
21
|
-
// This allows bootstrap to run immediately without inspecting the codebase
|
|
22
|
-
// All subsequent RPC commands will use this cached state
|
|
23
18
|
await getInspectorState(false, false, true)
|
|
24
19
|
|
|
25
20
|
await pikkuFunctionTypes.func(services, null, wire)
|
|
26
21
|
|
|
27
|
-
// Generate wiring-specific type files for tree-shaking
|
|
28
|
-
// These use the bootstrap mode state with core types
|
|
29
22
|
await pikkuFunctionTypesSplit.func(services, null, wire)
|
|
30
23
|
await pikkuHTTPTypes.func(services, null, wire)
|
|
31
24
|
await pikkuChannelTypes.func(services, null, wire)
|
|
32
25
|
await pikkuSchedulerTypes.func(services, null, wire)
|
|
33
26
|
await pikkuQueueTypes.func(services, null, wire)
|
|
34
|
-
await
|
|
27
|
+
await pikkuWorkflow.func(services, null, wire)
|
|
35
28
|
await pikkuMCPTypes.func(services, null, wire)
|
|
36
29
|
await pikkuCLITypes.func(services, null, wire)
|
|
37
30
|
|
|
38
|
-
// Check for critical errors and exit if any were logged
|
|
39
31
|
if (logger.hasCriticalErrors()) {
|
|
40
32
|
process.exit(1)
|
|
41
33
|
}
|
|
@@ -15,7 +15,7 @@ export const serializeNextJsBackendWrapper = (
|
|
|
15
15
|
import { PikkuNextJS } from '@pikku/next'
|
|
16
16
|
import { NextRequest } from 'next/server.js'
|
|
17
17
|
import type { HTTPWiringsMap, HTTPWiringHandlerOf, HTTPWiringsWithMethod } from '${routesMapPath}'
|
|
18
|
-
import type {
|
|
18
|
+
import type { FlattenedRPCMap } from '${rpcMapPath}'
|
|
19
19
|
|
|
20
20
|
type RouteContext = { params: Promise<Record<string, string | string[]>> }
|
|
21
21
|
|
|
@@ -95,14 +95,16 @@ export const pikku = (_options?: any) => {
|
|
|
95
95
|
*
|
|
96
96
|
* @template Route - The route key with the POST method.
|
|
97
97
|
* @param route - The route identifier.
|
|
98
|
-
* @param data - The input data for the POST request
|
|
98
|
+
* @param data - The input data for the POST request (required if input type is defined).
|
|
99
99
|
* @returns A promise that resolves to the output of the POST handler.
|
|
100
100
|
*/
|
|
101
101
|
const dynamicPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
|
|
102
102
|
route: Route,
|
|
103
|
-
|
|
103
|
+
...args: HTTPWiringHandlerOf<Route, 'POST'>['input'] extends null | undefined
|
|
104
|
+
? [data?: HTTPWiringHandlerOf<Route, 'POST'>['input']]
|
|
105
|
+
: [data: NonNullable<HTTPWiringHandlerOf<Route, 'POST'>['input']>]
|
|
104
106
|
): Promise<HTTPWiringHandlerOf<Route, 'POST'>['output']> => {
|
|
105
|
-
return dynamicActionRequest(route, 'POST',
|
|
107
|
+
return dynamicActionRequest(route, 'POST', args[0] ?? null)
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
/**
|
|
@@ -110,14 +112,16 @@ export const pikku = (_options?: any) => {
|
|
|
110
112
|
*
|
|
111
113
|
* @template Route - The route key with the GET method.
|
|
112
114
|
* @param route - The route identifier.
|
|
113
|
-
* @param data - The input data for the GET request
|
|
115
|
+
* @param data - The input data for the GET request (required if input type is defined).
|
|
114
116
|
* @returns A promise that resolves to the output of the GET handler.
|
|
115
117
|
*/
|
|
116
118
|
const dynamicGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
|
|
117
119
|
route: Route,
|
|
118
|
-
|
|
120
|
+
...args: HTTPWiringHandlerOf<Route, 'GET'>['input'] extends null | undefined
|
|
121
|
+
? [data?: HTTPWiringHandlerOf<Route, 'GET'>['input']]
|
|
122
|
+
: [data: NonNullable<HTTPWiringHandlerOf<Route, 'GET'>['input']>]
|
|
119
123
|
): Promise<HTTPWiringHandlerOf<Route, 'GET'>['output']> => {
|
|
120
|
-
return dynamicActionRequest(route, 'GET',
|
|
124
|
+
return dynamicActionRequest(route, 'GET', args[0] ?? null)
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
/**
|
|
@@ -125,14 +129,16 @@ export const pikku = (_options?: any) => {
|
|
|
125
129
|
*
|
|
126
130
|
* @template Route - The route key with the PATCH method.
|
|
127
131
|
* @param route - The route identifier.
|
|
128
|
-
* @param data - The input data for the PATCH request
|
|
132
|
+
* @param data - The input data for the PATCH request (required if input type is defined).
|
|
129
133
|
* @returns A promise that resolves to the output of the PATCH handler.
|
|
130
134
|
*/
|
|
131
135
|
const dynamicPatch = <Route extends HTTPWiringsWithMethod<'PATCH'>>(
|
|
132
136
|
route: Route,
|
|
133
|
-
|
|
137
|
+
...args: HTTPWiringHandlerOf<Route, 'PATCH'>['input'] extends null | undefined
|
|
138
|
+
? [data?: HTTPWiringHandlerOf<Route, 'PATCH'>['input']]
|
|
139
|
+
: [data: NonNullable<HTTPWiringHandlerOf<Route, 'PATCH'>['input']>]
|
|
134
140
|
): Promise<HTTPWiringHandlerOf<Route, 'PATCH'>['output']> => {
|
|
135
|
-
return dynamicActionRequest(route, 'PATCH',
|
|
141
|
+
return dynamicActionRequest(route, 'PATCH', args[0] ?? null)
|
|
136
142
|
}
|
|
137
143
|
|
|
138
144
|
/**
|
|
@@ -140,14 +146,16 @@ export const pikku = (_options?: any) => {
|
|
|
140
146
|
*
|
|
141
147
|
* @template Route - The route key with the DELETE method.
|
|
142
148
|
* @param route - The route identifier.
|
|
143
|
-
* @param data - The input data for the DELETE request
|
|
149
|
+
* @param data - The input data for the DELETE request (required if input type is defined).
|
|
144
150
|
* @returns A promise that resolves to the output of the DELETE handler.
|
|
145
151
|
*/
|
|
146
152
|
const dynamicDel = <Route extends HTTPWiringsWithMethod<'DELETE'>>(
|
|
147
153
|
route: Route,
|
|
148
|
-
|
|
154
|
+
...args: HTTPWiringHandlerOf<Route, 'DELETE'>['input'] extends null | undefined
|
|
155
|
+
? [data?: HTTPWiringHandlerOf<Route, 'DELETE'>['input']]
|
|
156
|
+
: [data: NonNullable<HTTPWiringHandlerOf<Route, 'DELETE'>['input']>]
|
|
149
157
|
): Promise<HTTPWiringHandlerOf<Route, 'DELETE'>['output']> => {
|
|
150
|
-
return dynamicActionRequest(route, 'DELETE',
|
|
158
|
+
return dynamicActionRequest(route, 'DELETE', args[0] ?? null)
|
|
151
159
|
}
|
|
152
160
|
|
|
153
161
|
// Static Requests
|
|
@@ -157,14 +165,16 @@ export const pikku = (_options?: any) => {
|
|
|
157
165
|
*
|
|
158
166
|
* @template Route - The route key with the POST method.
|
|
159
167
|
* @param route - The route identifier.
|
|
160
|
-
* @param data - The input data for the POST request
|
|
168
|
+
* @param data - The input data for the POST request (required if input type is defined).
|
|
161
169
|
* @returns A promise that resolves to the output of the POST handler.
|
|
162
170
|
*/
|
|
163
171
|
const staticPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
|
|
164
172
|
route: Route,
|
|
165
|
-
|
|
173
|
+
...args: HTTPWiringHandlerOf<Route, 'POST'>['input'] extends null | undefined
|
|
174
|
+
? [data?: HTTPWiringHandlerOf<Route, 'POST'>['input']]
|
|
175
|
+
: [data: NonNullable<HTTPWiringHandlerOf<Route, 'POST'>['input']>]
|
|
166
176
|
): Promise<HTTPWiringHandlerOf<Route, 'POST'>['output']> => {
|
|
167
|
-
return staticActionRequest(route, 'POST',
|
|
177
|
+
return staticActionRequest(route, 'POST', args[0] ?? null)
|
|
168
178
|
}
|
|
169
179
|
|
|
170
180
|
/**
|
|
@@ -172,49 +182,53 @@ export const pikku = (_options?: any) => {
|
|
|
172
182
|
*
|
|
173
183
|
* @template Route - The route key with the GET method.
|
|
174
184
|
* @param route - The route identifier.
|
|
175
|
-
* @param data - The input data for the GET request
|
|
185
|
+
* @param data - The input data for the GET request (required if input type is defined).
|
|
176
186
|
* @returns A promise that resolves to the output of the GET handler.
|
|
177
187
|
*/
|
|
178
188
|
const staticGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
|
|
179
189
|
route: Route,
|
|
180
|
-
|
|
190
|
+
...args: HTTPWiringHandlerOf<Route, 'GET'>['input'] extends null | undefined
|
|
191
|
+
? [data?: HTTPWiringHandlerOf<Route, 'GET'>['input']]
|
|
192
|
+
: [data: NonNullable<HTTPWiringHandlerOf<Route, 'GET'>['input']>]
|
|
181
193
|
): Promise<HTTPWiringHandlerOf<Route, 'GET'>['output']> => {
|
|
182
|
-
return staticActionRequest(route, 'GET',
|
|
194
|
+
return staticActionRequest(route, 'GET', args[0] ?? null)
|
|
183
195
|
}
|
|
184
196
|
|
|
185
197
|
// RPC Requests
|
|
186
198
|
|
|
187
|
-
/**
|
|
188
|
-
* Type definition for RPC invocation with dynamic context.
|
|
189
|
-
*/
|
|
190
|
-
type RPCInvoke = <Name extends keyof RPCMap>(
|
|
191
|
-
name: Name,
|
|
192
|
-
data: RPCMap[Name]['input']
|
|
193
|
-
) => Promise<RPCMap[Name]['output']>
|
|
194
|
-
|
|
195
199
|
/**
|
|
196
200
|
* Makes a dynamic RPC request.
|
|
197
201
|
*
|
|
198
|
-
* @template Name - The RPC function name from the
|
|
202
|
+
* @template Name - The RPC function name from the FlattenedRPCMap.
|
|
199
203
|
* @param name - The RPC function identifier.
|
|
200
|
-
* @param data - The input data for the RPC request.
|
|
204
|
+
* @param data - The input data for the RPC request (required if input type is defined).
|
|
201
205
|
* @returns A promise that resolves to the output of the RPC handler.
|
|
202
206
|
*/
|
|
203
|
-
const rpc
|
|
204
|
-
|
|
207
|
+
const rpc = async <Name extends keyof FlattenedRPCMap>(
|
|
208
|
+
rpcName: Name,
|
|
209
|
+
...args: FlattenedRPCMap[Name]['input'] extends null | undefined
|
|
210
|
+
? [data?: FlattenedRPCMap[Name]['input']]
|
|
211
|
+
: [data: NonNullable<FlattenedRPCMap[Name]['input']>]
|
|
212
|
+
): Promise<FlattenedRPCMap[Name]['output']> => {
|
|
213
|
+
return dynamicActionRequest('/rpc/:rpcName' as '/rpc/:rpcName', 'POST', { rpcName, data: args[0] ?? null }) as unknown as FlattenedRPCMap[Name]['output']
|
|
205
214
|
}
|
|
206
215
|
|
|
207
216
|
/**
|
|
208
217
|
* Makes a static RPC request.
|
|
209
218
|
* Note: In HTTP wrapper context, both rpc and staticRPC behave the same way.
|
|
210
219
|
*
|
|
211
|
-
* @template Name - The RPC function name from the
|
|
220
|
+
* @template Name - The RPC function name from the FlattenedRPCMap.
|
|
212
221
|
* @param name - The RPC function identifier.
|
|
213
|
-
* @param data - The input data for the RPC request.
|
|
222
|
+
* @param data - The input data for the RPC request (required if input type is defined).
|
|
214
223
|
* @returns A promise that resolves to the output of the RPC handler.
|
|
215
224
|
*/
|
|
216
|
-
const staticRPC
|
|
217
|
-
|
|
225
|
+
const staticRPC = async <Name extends keyof FlattenedRPCMap>(
|
|
226
|
+
rpcName: Name,
|
|
227
|
+
...args: FlattenedRPCMap[Name]['input'] extends null | undefined
|
|
228
|
+
? [data?: FlattenedRPCMap[Name]['input']]
|
|
229
|
+
: [data: NonNullable<FlattenedRPCMap[Name]['input']>]
|
|
230
|
+
): Promise<FlattenedRPCMap[Name]['output']> => {
|
|
231
|
+
return staticActionRequest('/rpc/:rpcName' as '/rpc/:rpcName', 'POST', { rpcName, data: args[0] ?? null }) as unknown as FlattenedRPCMap[Name]['output']
|
|
218
232
|
}
|
|
219
233
|
|
|
220
234
|
return {
|