@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
|
@@ -3,14 +3,12 @@ import { pikkuVoidFunc } from '../../../.pikku/pikku-types.gen.js';
|
|
|
3
3
|
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
|
-
// Import all command functions directly
|
|
7
6
|
import { pikkuFunctionTypes } from '../wirings/functions/pikku-command-function-types.js';
|
|
8
7
|
import { pikkuFunctionTypesSplit } from '../wirings/functions/pikku-command-function-types-split.js';
|
|
9
8
|
import { pikkuHTTPTypes } from '../wirings/http/pikku-command-http-types.js';
|
|
10
9
|
import { pikkuChannelTypes } from '../wirings/channels/pikku-command-channel-types.js';
|
|
11
10
|
import { pikkuSchedulerTypes } from '../wirings/scheduler/pikku-command-scheduler-types.js';
|
|
12
11
|
import { pikkuQueueTypes } from '../wirings/queue/pikku-command-queue-types.js';
|
|
13
|
-
import { pikkuWorkflowTypes } from '../wirings/workflow/pikku-command-workflow-types.js';
|
|
14
12
|
import { pikkuMCPTypes } from '../wirings/mcp/pikku-command-mcp-types.js';
|
|
15
13
|
import { pikkuCLITypes } from '../wirings/cli/pikku-command-cli-types.js';
|
|
16
14
|
import { pikkuFunctions } from '../wirings/functions/pikku-command-functions.js';
|
|
@@ -29,7 +27,6 @@ import { pikkuFetch } from '../wirings/fetch/index.js';
|
|
|
29
27
|
import { pikkuScheduler } from '../wirings/scheduler/pikku-command-scheduler.js';
|
|
30
28
|
import { pikkuWorkflow } from '../wirings/workflow/pikku-command-workflow.js';
|
|
31
29
|
import { pikkuRemoteRPC } from '../wirings/rpc/pikku-command-remote-rpc.js';
|
|
32
|
-
import { pikkuWorkflowMap } from '../wirings/workflow/pikku-command-workflow-map.js';
|
|
33
30
|
import { pikkuQueue } from '../wirings/queue/pikku-command-queue.js';
|
|
34
31
|
import { pikkuQueueMap } from '../wirings/queue/pikku-command-queue-map.js';
|
|
35
32
|
import { pikkuQueueService } from '../wirings/queue/pikku-command-queue-service.js';
|
|
@@ -42,6 +39,9 @@ import { pikkuCLI } from '../wirings/cli/pikku-command-cli.js';
|
|
|
42
39
|
import { pikkuCLIEntry } from '../wirings/cli/pikku-command-cli-entry.js';
|
|
43
40
|
import { pikkuNext } from '../runtimes/nextjs/pikku-command-nextjs.js';
|
|
44
41
|
import { pikkuOpenAPI } from '../wirings/http/pikku-command-openapi.js';
|
|
42
|
+
import { pikkuPackage } from '../wirings/package/pikku-command-package.js';
|
|
43
|
+
import { pikkuForgeNodes } from '../wirings/forge/pikku-command-forge-nodes.js';
|
|
44
|
+
import { pikkuForgeTypes } from '../wirings/forge/pikku-command-forge-types.js';
|
|
45
45
|
export const all = pikkuVoidFunc({
|
|
46
46
|
func: async ({ logger, config, getInspectorState }) => {
|
|
47
47
|
const wire = {};
|
|
@@ -53,105 +53,99 @@ export const all = pikkuVoidFunc({
|
|
|
53
53
|
typesDeclarationFileExists = false;
|
|
54
54
|
}
|
|
55
55
|
await pikkuFunctionTypes.func(services, null, wire);
|
|
56
|
-
// This is needed since the wireHTTP function will add the routes to the visitState
|
|
57
56
|
if (!typesDeclarationFileExists) {
|
|
58
57
|
logger.debug(`• Type file first created, inspecting again...`);
|
|
59
58
|
await getInspectorState(true);
|
|
60
59
|
}
|
|
61
|
-
// Generate wiring-specific type files for tree-shaking
|
|
62
60
|
await pikkuFunctionTypesSplit.func(services, null, wire);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
if (!config.externalPackage) {
|
|
62
|
+
await pikkuHTTPTypes.func(services, null, wire);
|
|
63
|
+
await pikkuChannelTypes.func(services, null, wire);
|
|
64
|
+
await pikkuSchedulerTypes.func(services, null, wire);
|
|
65
|
+
await pikkuQueueTypes.func(services, null, wire);
|
|
66
|
+
await pikkuMCPTypes.func(services, null, wire);
|
|
67
|
+
await pikkuCLITypes.func(services, null, wire);
|
|
68
|
+
}
|
|
70
69
|
const hasFunctionRegistrations = await pikkuFunctions.func(services, wire, null);
|
|
71
|
-
// Generate and register middleware
|
|
72
70
|
const middleware = await pikkuMiddleware.func(services, null, wire);
|
|
73
|
-
// Middleware must be imported before functions meta to ensure registration happens first
|
|
74
71
|
if (middleware) {
|
|
75
72
|
allImports.push(config.middlewareFile);
|
|
76
73
|
}
|
|
77
|
-
// Generate and register permissions
|
|
78
74
|
const permissions = await pikkuPermissions.func(services, null, wire);
|
|
79
|
-
// Permissions must be imported before functions meta to ensure registration happens first
|
|
80
75
|
if (permissions) {
|
|
81
76
|
allImports.push(config.permissionsFile);
|
|
82
77
|
}
|
|
83
|
-
// Always import functions meta (needed for all function metadata)
|
|
84
78
|
allImports.push(config.functionsMetaFile);
|
|
85
|
-
// Only import functionsFile if it was generated (has internal/external RPCs)
|
|
86
79
|
if (hasFunctionRegistrations) {
|
|
87
80
|
allImports.push(config.functionsFile);
|
|
88
81
|
}
|
|
89
|
-
// Generate services map
|
|
90
82
|
await pikkuServices.func(services, null, wire);
|
|
91
|
-
// Generate service metadata JSON files for AI consumption
|
|
92
83
|
await pikkuServiceMetadata.func(services, null, wire);
|
|
84
|
+
const hasPackageFactories = await pikkuPackage.func(services, null, wire);
|
|
85
|
+
if (hasPackageFactories) {
|
|
86
|
+
allImports.push(config.packageFile);
|
|
87
|
+
}
|
|
93
88
|
const hasInternalRPCs = await pikkuRPC.func(services, null, wire);
|
|
89
|
+
const schemas = await pikkuSchemas.func(services, null, wire);
|
|
90
|
+
if (schemas) {
|
|
91
|
+
allImports.push(`${config.schemaDirectory}/register.gen.ts`);
|
|
92
|
+
}
|
|
94
93
|
await pikkuRPCInternalMap.func(services, null, wire);
|
|
95
94
|
await pikkuRPCExposedMap.func(services, null, wire);
|
|
96
95
|
await pikkuPublicRPC.func(services, null, wire);
|
|
97
96
|
await pikkuRPCClient.func(services, null, wire);
|
|
97
|
+
await pikkuForgeTypes.func(services, null, wire);
|
|
98
98
|
if (hasInternalRPCs) {
|
|
99
99
|
allImports.push(config.rpcInternalWiringMetaFile);
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
await
|
|
109
|
-
|
|
110
|
-
|
|
101
|
+
if (!config.externalPackage) {
|
|
102
|
+
const http = await pikkuHTTP.func(services, null, wire);
|
|
103
|
+
if (http) {
|
|
104
|
+
await pikkuHTTPMap.func(services, null, wire);
|
|
105
|
+
await pikkuFetch.func(services, null, wire);
|
|
106
|
+
allImports.push(config.httpWiringMetaFile, config.httpWiringsFile);
|
|
107
|
+
}
|
|
108
|
+
const scheduler = await pikkuScheduler.func(services, null, wire);
|
|
109
|
+
if (scheduler) {
|
|
110
|
+
allImports.push(config.schedulersWiringMetaFile, config.schedulersWiringFile);
|
|
111
|
+
}
|
|
111
112
|
}
|
|
112
|
-
// Generate Scheduler
|
|
113
|
-
const scheduler = await pikkuScheduler.func(services, null, wire);
|
|
114
|
-
if (scheduler) {
|
|
115
|
-
allImports.push(config.schedulersWiringMetaFile, config.schedulersWiringFile);
|
|
116
|
-
}
|
|
117
|
-
// Generate Workflows
|
|
118
113
|
const workflows = await pikkuWorkflow.func(services, null, wire);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
114
|
+
let remoteRPC = false;
|
|
115
|
+
if (!config.externalPackage) {
|
|
116
|
+
remoteRPC = await pikkuRemoteRPC.func(services, null, wire);
|
|
117
|
+
}
|
|
122
118
|
if (workflows || remoteRPC) {
|
|
123
119
|
await getInspectorState(true);
|
|
124
120
|
}
|
|
125
121
|
if (workflows) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
await
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
allImports.push(config.cliWiringMetaFile, config.cliWiringsFile);
|
|
154
|
-
}
|
|
122
|
+
allImports.push(config.workflowsWiringFile);
|
|
123
|
+
}
|
|
124
|
+
if (!config.externalPackage) {
|
|
125
|
+
const queues = await pikkuQueue.func(services, null, wire);
|
|
126
|
+
if (queues) {
|
|
127
|
+
await pikkuQueueMap.func(services, null, wire);
|
|
128
|
+
await pikkuQueueService.func(services, null, wire);
|
|
129
|
+
allImports.push(config.queueWorkersWiringMetaFile, config.queueWorkersWiringFile);
|
|
130
|
+
}
|
|
131
|
+
const channels = await pikkuChannels.func(services, null, wire);
|
|
132
|
+
if (channels) {
|
|
133
|
+
await pikkuChannelsMap.func(services, null, wire);
|
|
134
|
+
await pikkuWebSocketTyped.func(services, null, wire);
|
|
135
|
+
allImports.push(config.channelsWiringMetaFile, config.channelsWiringFile);
|
|
136
|
+
}
|
|
137
|
+
const mcp = await pikkuMCP.func(services, null, wire);
|
|
138
|
+
if (mcp) {
|
|
139
|
+
await pikkuMCPJSON.func(services, null, wire);
|
|
140
|
+
allImports.push(config.mcpWiringsMetaFile, config.mcpWiringsFile);
|
|
141
|
+
}
|
|
142
|
+
const cli = await pikkuCLI.func(services, null, wire);
|
|
143
|
+
if (cli) {
|
|
144
|
+
await pikkuCLIEntry.func(services, null, wire);
|
|
145
|
+
allImports.push(config.cliWiringMetaFile, config.cliWiringsFile);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
await pikkuForgeNodes.func(services, null, wire);
|
|
155
149
|
if (config.nextBackendFile || config.nextHTTPFile) {
|
|
156
150
|
await pikkuNext.func(services, null, wire);
|
|
157
151
|
}
|
|
@@ -160,15 +154,52 @@ export const all = pikkuVoidFunc({
|
|
|
160
154
|
await getInspectorState(true);
|
|
161
155
|
await pikkuOpenAPI.func(services, null, wire);
|
|
162
156
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
.
|
|
168
|
-
|
|
157
|
+
const stateBeforeBootstrap = await getInspectorState();
|
|
158
|
+
const externalPackageBootstraps = [];
|
|
159
|
+
const usedExternalPackages = {};
|
|
160
|
+
if (config.externalPackages &&
|
|
161
|
+
stateBeforeBootstrap.rpc?.usedExternalPackages?.size > 0) {
|
|
162
|
+
for (const namespace of stateBeforeBootstrap.rpc.usedExternalPackages) {
|
|
163
|
+
const packageName = config.externalPackages[namespace];
|
|
164
|
+
if (packageName) {
|
|
165
|
+
const packageBootstrap = `${packageName}/.pikku/pikku-bootstrap.gen.js`;
|
|
166
|
+
externalPackageBootstraps.push(packageBootstrap);
|
|
167
|
+
usedExternalPackages[namespace] = packageName;
|
|
168
|
+
logger.debug(`• External package detected: ${namespace} (${packageName})`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const localImports = allImports.map((to) => `import '${getFileImportRelativePath(config.bootstrapFile, to, config.packageMappings)}'`);
|
|
173
|
+
const externalImports = externalPackageBootstraps.map((packagePath) => `import '${packagePath}'`);
|
|
174
|
+
let externalPackagesRegistration = '';
|
|
175
|
+
if (Object.keys(usedExternalPackages).length > 0) {
|
|
176
|
+
externalPackagesRegistration = `
|
|
177
|
+
// Register external package mappings
|
|
178
|
+
import { pikkuState } from '@pikku/core'
|
|
179
|
+
const externalPackages = pikkuState(null, 'rpc', 'externalPackages')
|
|
180
|
+
${Object.entries(usedExternalPackages)
|
|
181
|
+
.map(([ns, pkg]) => `externalPackages.set('${ns}', '${pkg}')`)
|
|
182
|
+
.join('\n')}
|
|
183
|
+
`;
|
|
184
|
+
}
|
|
185
|
+
const allBootstrapImports = [...localImports, ...externalImports]
|
|
186
|
+
.sort((a, b) => {
|
|
187
|
+
const aMeta = a.includes('meta');
|
|
188
|
+
const bMeta = b.includes('meta');
|
|
189
|
+
if (aMeta && !bMeta)
|
|
190
|
+
return -1;
|
|
191
|
+
if (!aMeta && bMeta)
|
|
192
|
+
return 1;
|
|
193
|
+
return 0;
|
|
194
|
+
})
|
|
195
|
+
.join('\n') + externalPackagesRegistration;
|
|
196
|
+
await writeFileInDir(logger, config.bootstrapFile, allBootstrapImports);
|
|
169
197
|
const state = await getInspectorState();
|
|
170
|
-
if (state.http?.meta)
|
|
171
|
-
|
|
198
|
+
if (state.http?.meta) {
|
|
199
|
+
const httpRouteCount = Object.values(state.http.meta).reduce((sum, routes) => sum + Object.keys(routes).length, 0);
|
|
200
|
+
if (httpRouteCount > 0)
|
|
201
|
+
summary.set('httpRoutes', httpRouteCount);
|
|
202
|
+
}
|
|
172
203
|
if (state.channels?.meta)
|
|
173
204
|
summary.set('channels', Object.keys(state.channels.meta).length);
|
|
174
205
|
if (state.scheduledTasks?.meta)
|
|
@@ -183,7 +214,6 @@ export const all = pikkuVoidFunc({
|
|
|
183
214
|
summary.set('mcpEndpoints', mcpTotal);
|
|
184
215
|
}
|
|
185
216
|
if (state.cli?.meta) {
|
|
186
|
-
// Count total CLI commands across all programs
|
|
187
217
|
const totalCommands = Object.values(state.cli.meta).reduce((sum, program) => sum + (program.commands?.length || 0), 0);
|
|
188
218
|
if (totalCommands > 0)
|
|
189
219
|
summary.set('cliCommands', totalCommands);
|
|
@@ -191,11 +221,19 @@ export const all = pikkuVoidFunc({
|
|
|
191
221
|
if (state.workflows?.meta) {
|
|
192
222
|
summary.set('workflows', Object.keys(state.workflows.meta).length);
|
|
193
223
|
}
|
|
194
|
-
|
|
224
|
+
if (state.forgeNodes?.meta) {
|
|
225
|
+
const forgeNodesCount = Object.keys(state.forgeNodes.meta).length;
|
|
226
|
+
if (forgeNodesCount > 0)
|
|
227
|
+
summary.set('forgeNodes', forgeNodesCount);
|
|
228
|
+
}
|
|
229
|
+
if (state.workflows?.graphMeta) {
|
|
230
|
+
const workflowGraphsCount = Object.keys(state.workflows.graphMeta).length;
|
|
231
|
+
if (workflowGraphsCount > 0)
|
|
232
|
+
summary.set('workflowGraphs', workflowGraphsCount);
|
|
233
|
+
}
|
|
195
234
|
if (!logger.isSilent()) {
|
|
196
235
|
console.log(summary.format());
|
|
197
236
|
}
|
|
198
|
-
// Check for critical errors and exit if any were logged
|
|
199
237
|
if (logger.hasCriticalErrors()) {
|
|
200
238
|
process.exit(1);
|
|
201
239
|
}
|
|
@@ -1,34 +1,27 @@
|
|
|
1
1
|
import { pikkuVoidFunc } from '../../../.pikku/pikku-types.gen.js';
|
|
2
|
-
// Import command functions directly
|
|
3
2
|
import { pikkuFunctionTypes } from '../wirings/functions/pikku-command-function-types.js';
|
|
4
3
|
import { pikkuFunctionTypesSplit } from '../wirings/functions/pikku-command-function-types-split.js';
|
|
5
4
|
import { pikkuHTTPTypes } from '../wirings/http/pikku-command-http-types.js';
|
|
6
5
|
import { pikkuChannelTypes } from '../wirings/channels/pikku-command-channel-types.js';
|
|
7
6
|
import { pikkuSchedulerTypes } from '../wirings/scheduler/pikku-command-scheduler-types.js';
|
|
8
7
|
import { pikkuQueueTypes } from '../wirings/queue/pikku-command-queue-types.js';
|
|
9
|
-
import {
|
|
8
|
+
import { pikkuWorkflow } from '../wirings/workflow/pikku-command-workflow.js';
|
|
10
9
|
import { pikkuMCPTypes } from '../wirings/mcp/pikku-command-mcp-types.js';
|
|
11
10
|
import { pikkuCLITypes } from '../wirings/cli/pikku-command-cli-types.js';
|
|
12
11
|
export const bootstrap = pikkuVoidFunc({
|
|
13
12
|
func: async ({ logger, config, getInspectorState }) => {
|
|
14
13
|
const wire = {};
|
|
15
14
|
const services = { logger, config, getInspectorState };
|
|
16
|
-
// Initialize inspector state in bootstrap mode with core types only
|
|
17
|
-
// This allows bootstrap to run immediately without inspecting the codebase
|
|
18
|
-
// All subsequent RPC commands will use this cached state
|
|
19
15
|
await getInspectorState(false, false, true);
|
|
20
16
|
await pikkuFunctionTypes.func(services, null, wire);
|
|
21
|
-
// Generate wiring-specific type files for tree-shaking
|
|
22
|
-
// These use the bootstrap mode state with core types
|
|
23
17
|
await pikkuFunctionTypesSplit.func(services, null, wire);
|
|
24
18
|
await pikkuHTTPTypes.func(services, null, wire);
|
|
25
19
|
await pikkuChannelTypes.func(services, null, wire);
|
|
26
20
|
await pikkuSchedulerTypes.func(services, null, wire);
|
|
27
21
|
await pikkuQueueTypes.func(services, null, wire);
|
|
28
|
-
await
|
|
22
|
+
await pikkuWorkflow.func(services, null, wire);
|
|
29
23
|
await pikkuMCPTypes.func(services, null, wire);
|
|
30
24
|
await pikkuCLITypes.func(services, null, wire);
|
|
31
|
-
// Check for critical errors and exit if any were logged
|
|
32
25
|
if (logger.hasCriticalErrors()) {
|
|
33
26
|
process.exit(1);
|
|
34
27
|
}
|
|
@@ -24,7 +24,6 @@ export const pikkuNext = pikkuSessionlessFunc({
|
|
|
24
24
|
throw new Error('rpcMapDeclarationFile is required in pikku config in order for nextJS wrapper to work');
|
|
25
25
|
}
|
|
26
26
|
if (nextBackendFile) {
|
|
27
|
-
// Check for required types
|
|
28
27
|
checkRequiredTypes(visitState.filesAndMethodsErrors, {
|
|
29
28
|
config: true,
|
|
30
29
|
singletonServicesFactory: true,
|
|
@@ -8,7 +8,7 @@ export const serializeNextJsBackendWrapper = (bootstrapPath, routesMapPath, rpcM
|
|
|
8
8
|
import { PikkuNextJS } from '@pikku/next'
|
|
9
9
|
import { NextRequest } from 'next/server.js'
|
|
10
10
|
import type { HTTPWiringsMap, HTTPWiringHandlerOf, HTTPWiringsWithMethod } from '${routesMapPath}'
|
|
11
|
-
import type {
|
|
11
|
+
import type { FlattenedRPCMap } from '${rpcMapPath}'
|
|
12
12
|
|
|
13
13
|
type RouteContext = { params: Promise<Record<string, string | string[]>> }
|
|
14
14
|
|
|
@@ -88,14 +88,16 @@ export const pikku = (_options?: any) => {
|
|
|
88
88
|
*
|
|
89
89
|
* @template Route - The route key with the POST method.
|
|
90
90
|
* @param route - The route identifier.
|
|
91
|
-
* @param data - The input data for the POST request
|
|
91
|
+
* @param data - The input data for the POST request (required if input type is defined).
|
|
92
92
|
* @returns A promise that resolves to the output of the POST handler.
|
|
93
93
|
*/
|
|
94
94
|
const dynamicPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
|
|
95
95
|
route: Route,
|
|
96
|
-
|
|
96
|
+
...args: HTTPWiringHandlerOf<Route, 'POST'>['input'] extends null | undefined
|
|
97
|
+
? [data?: HTTPWiringHandlerOf<Route, 'POST'>['input']]
|
|
98
|
+
: [data: NonNullable<HTTPWiringHandlerOf<Route, 'POST'>['input']>]
|
|
97
99
|
): Promise<HTTPWiringHandlerOf<Route, 'POST'>['output']> => {
|
|
98
|
-
return dynamicActionRequest(route, 'POST',
|
|
100
|
+
return dynamicActionRequest(route, 'POST', args[0] ?? null)
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
/**
|
|
@@ -103,14 +105,16 @@ export const pikku = (_options?: any) => {
|
|
|
103
105
|
*
|
|
104
106
|
* @template Route - The route key with the GET method.
|
|
105
107
|
* @param route - The route identifier.
|
|
106
|
-
* @param data - The input data for the GET request
|
|
108
|
+
* @param data - The input data for the GET request (required if input type is defined).
|
|
107
109
|
* @returns A promise that resolves to the output of the GET handler.
|
|
108
110
|
*/
|
|
109
111
|
const dynamicGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
|
|
110
112
|
route: Route,
|
|
111
|
-
|
|
113
|
+
...args: HTTPWiringHandlerOf<Route, 'GET'>['input'] extends null | undefined
|
|
114
|
+
? [data?: HTTPWiringHandlerOf<Route, 'GET'>['input']]
|
|
115
|
+
: [data: NonNullable<HTTPWiringHandlerOf<Route, 'GET'>['input']>]
|
|
112
116
|
): Promise<HTTPWiringHandlerOf<Route, 'GET'>['output']> => {
|
|
113
|
-
return dynamicActionRequest(route, 'GET',
|
|
117
|
+
return dynamicActionRequest(route, 'GET', args[0] ?? null)
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
/**
|
|
@@ -118,14 +122,16 @@ export const pikku = (_options?: any) => {
|
|
|
118
122
|
*
|
|
119
123
|
* @template Route - The route key with the PATCH method.
|
|
120
124
|
* @param route - The route identifier.
|
|
121
|
-
* @param data - The input data for the PATCH request
|
|
125
|
+
* @param data - The input data for the PATCH request (required if input type is defined).
|
|
122
126
|
* @returns A promise that resolves to the output of the PATCH handler.
|
|
123
127
|
*/
|
|
124
128
|
const dynamicPatch = <Route extends HTTPWiringsWithMethod<'PATCH'>>(
|
|
125
129
|
route: Route,
|
|
126
|
-
|
|
130
|
+
...args: HTTPWiringHandlerOf<Route, 'PATCH'>['input'] extends null | undefined
|
|
131
|
+
? [data?: HTTPWiringHandlerOf<Route, 'PATCH'>['input']]
|
|
132
|
+
: [data: NonNullable<HTTPWiringHandlerOf<Route, 'PATCH'>['input']>]
|
|
127
133
|
): Promise<HTTPWiringHandlerOf<Route, 'PATCH'>['output']> => {
|
|
128
|
-
return dynamicActionRequest(route, 'PATCH',
|
|
134
|
+
return dynamicActionRequest(route, 'PATCH', args[0] ?? null)
|
|
129
135
|
}
|
|
130
136
|
|
|
131
137
|
/**
|
|
@@ -133,14 +139,16 @@ export const pikku = (_options?: any) => {
|
|
|
133
139
|
*
|
|
134
140
|
* @template Route - The route key with the DELETE method.
|
|
135
141
|
* @param route - The route identifier.
|
|
136
|
-
* @param data - The input data for the DELETE request
|
|
142
|
+
* @param data - The input data for the DELETE request (required if input type is defined).
|
|
137
143
|
* @returns A promise that resolves to the output of the DELETE handler.
|
|
138
144
|
*/
|
|
139
145
|
const dynamicDel = <Route extends HTTPWiringsWithMethod<'DELETE'>>(
|
|
140
146
|
route: Route,
|
|
141
|
-
|
|
147
|
+
...args: HTTPWiringHandlerOf<Route, 'DELETE'>['input'] extends null | undefined
|
|
148
|
+
? [data?: HTTPWiringHandlerOf<Route, 'DELETE'>['input']]
|
|
149
|
+
: [data: NonNullable<HTTPWiringHandlerOf<Route, 'DELETE'>['input']>]
|
|
142
150
|
): Promise<HTTPWiringHandlerOf<Route, 'DELETE'>['output']> => {
|
|
143
|
-
return dynamicActionRequest(route, 'DELETE',
|
|
151
|
+
return dynamicActionRequest(route, 'DELETE', args[0] ?? null)
|
|
144
152
|
}
|
|
145
153
|
|
|
146
154
|
// Static Requests
|
|
@@ -150,14 +158,16 @@ export const pikku = (_options?: any) => {
|
|
|
150
158
|
*
|
|
151
159
|
* @template Route - The route key with the POST method.
|
|
152
160
|
* @param route - The route identifier.
|
|
153
|
-
* @param data - The input data for the POST request
|
|
161
|
+
* @param data - The input data for the POST request (required if input type is defined).
|
|
154
162
|
* @returns A promise that resolves to the output of the POST handler.
|
|
155
163
|
*/
|
|
156
164
|
const staticPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
|
|
157
165
|
route: Route,
|
|
158
|
-
|
|
166
|
+
...args: HTTPWiringHandlerOf<Route, 'POST'>['input'] extends null | undefined
|
|
167
|
+
? [data?: HTTPWiringHandlerOf<Route, 'POST'>['input']]
|
|
168
|
+
: [data: NonNullable<HTTPWiringHandlerOf<Route, 'POST'>['input']>]
|
|
159
169
|
): Promise<HTTPWiringHandlerOf<Route, 'POST'>['output']> => {
|
|
160
|
-
return staticActionRequest(route, 'POST',
|
|
170
|
+
return staticActionRequest(route, 'POST', args[0] ?? null)
|
|
161
171
|
}
|
|
162
172
|
|
|
163
173
|
/**
|
|
@@ -165,49 +175,53 @@ export const pikku = (_options?: any) => {
|
|
|
165
175
|
*
|
|
166
176
|
* @template Route - The route key with the GET method.
|
|
167
177
|
* @param route - The route identifier.
|
|
168
|
-
* @param data - The input data for the GET request
|
|
178
|
+
* @param data - The input data for the GET request (required if input type is defined).
|
|
169
179
|
* @returns A promise that resolves to the output of the GET handler.
|
|
170
180
|
*/
|
|
171
181
|
const staticGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
|
|
172
182
|
route: Route,
|
|
173
|
-
|
|
183
|
+
...args: HTTPWiringHandlerOf<Route, 'GET'>['input'] extends null | undefined
|
|
184
|
+
? [data?: HTTPWiringHandlerOf<Route, 'GET'>['input']]
|
|
185
|
+
: [data: NonNullable<HTTPWiringHandlerOf<Route, 'GET'>['input']>]
|
|
174
186
|
): Promise<HTTPWiringHandlerOf<Route, 'GET'>['output']> => {
|
|
175
|
-
return staticActionRequest(route, 'GET',
|
|
187
|
+
return staticActionRequest(route, 'GET', args[0] ?? null)
|
|
176
188
|
}
|
|
177
189
|
|
|
178
190
|
// RPC Requests
|
|
179
191
|
|
|
180
|
-
/**
|
|
181
|
-
* Type definition for RPC invocation with dynamic context.
|
|
182
|
-
*/
|
|
183
|
-
type RPCInvoke = <Name extends keyof RPCMap>(
|
|
184
|
-
name: Name,
|
|
185
|
-
data: RPCMap[Name]['input']
|
|
186
|
-
) => Promise<RPCMap[Name]['output']>
|
|
187
|
-
|
|
188
192
|
/**
|
|
189
193
|
* Makes a dynamic RPC request.
|
|
190
194
|
*
|
|
191
|
-
* @template Name - The RPC function name from the
|
|
195
|
+
* @template Name - The RPC function name from the FlattenedRPCMap.
|
|
192
196
|
* @param name - The RPC function identifier.
|
|
193
|
-
* @param data - The input data for the RPC request.
|
|
197
|
+
* @param data - The input data for the RPC request (required if input type is defined).
|
|
194
198
|
* @returns A promise that resolves to the output of the RPC handler.
|
|
195
199
|
*/
|
|
196
|
-
const rpc
|
|
197
|
-
|
|
200
|
+
const rpc = async <Name extends keyof FlattenedRPCMap>(
|
|
201
|
+
rpcName: Name,
|
|
202
|
+
...args: FlattenedRPCMap[Name]['input'] extends null | undefined
|
|
203
|
+
? [data?: FlattenedRPCMap[Name]['input']]
|
|
204
|
+
: [data: NonNullable<FlattenedRPCMap[Name]['input']>]
|
|
205
|
+
): Promise<FlattenedRPCMap[Name]['output']> => {
|
|
206
|
+
return dynamicActionRequest('/rpc/:rpcName' as '/rpc/:rpcName', 'POST', { rpcName, data: args[0] ?? null }) as unknown as FlattenedRPCMap[Name]['output']
|
|
198
207
|
}
|
|
199
208
|
|
|
200
209
|
/**
|
|
201
210
|
* Makes a static RPC request.
|
|
202
211
|
* Note: In HTTP wrapper context, both rpc and staticRPC behave the same way.
|
|
203
212
|
*
|
|
204
|
-
* @template Name - The RPC function name from the
|
|
213
|
+
* @template Name - The RPC function name from the FlattenedRPCMap.
|
|
205
214
|
* @param name - The RPC function identifier.
|
|
206
|
-
* @param data - The input data for the RPC request.
|
|
215
|
+
* @param data - The input data for the RPC request (required if input type is defined).
|
|
207
216
|
* @returns A promise that resolves to the output of the RPC handler.
|
|
208
217
|
*/
|
|
209
|
-
const staticRPC
|
|
210
|
-
|
|
218
|
+
const staticRPC = async <Name extends keyof FlattenedRPCMap>(
|
|
219
|
+
rpcName: Name,
|
|
220
|
+
...args: FlattenedRPCMap[Name]['input'] extends null | undefined
|
|
221
|
+
? [data?: FlattenedRPCMap[Name]['input']]
|
|
222
|
+
: [data: NonNullable<FlattenedRPCMap[Name]['input']>]
|
|
223
|
+
): Promise<FlattenedRPCMap[Name]['output']> => {
|
|
224
|
+
return staticActionRequest('/rpc/:rpcName' as '/rpc/:rpcName', 'POST', { rpcName, data: args[0] ?? null }) as unknown as FlattenedRPCMap[Name]['output']
|
|
211
225
|
}
|
|
212
226
|
|
|
213
227
|
return {
|