@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
|
@@ -7,6 +7,10 @@ import {
|
|
|
7
7
|
serializeSchedulerMetaTS,
|
|
8
8
|
} from './serialize-scheduler-meta.js'
|
|
9
9
|
import { getFileImportRelativePath } from '../../../utils/file-import-path.js'
|
|
10
|
+
import {
|
|
11
|
+
stripVerboseFields,
|
|
12
|
+
hasVerboseFields,
|
|
13
|
+
} from '../../../utils/strip-verbose-meta.js'
|
|
10
14
|
|
|
11
15
|
export const pikkuScheduler: any = pikkuSessionlessFunc<
|
|
12
16
|
void,
|
|
@@ -23,12 +27,29 @@ export const pikkuScheduler: any = pikkuSessionlessFunc<
|
|
|
23
27
|
} = config
|
|
24
28
|
const { scheduledTasks } = visitState
|
|
25
29
|
|
|
30
|
+
const fullMeta = serializeSchedulerMeta(scheduledTasks.meta)
|
|
31
|
+
|
|
32
|
+
// Write minimal JSON (runtime-only fields)
|
|
33
|
+
const minimalMeta = stripVerboseFields(fullMeta)
|
|
26
34
|
await writeFileInDir(
|
|
27
35
|
logger,
|
|
28
36
|
schedulersWiringMetaJsonFile,
|
|
29
|
-
JSON.stringify(
|
|
37
|
+
JSON.stringify(minimalMeta, null, 2)
|
|
30
38
|
)
|
|
31
39
|
|
|
40
|
+
// Write verbose JSON only if it has additional fields
|
|
41
|
+
if (hasVerboseFields(fullMeta)) {
|
|
42
|
+
const verbosePath = schedulersWiringMetaJsonFile.replace(
|
|
43
|
+
/\.gen\.json$/,
|
|
44
|
+
'-verbose.gen.json'
|
|
45
|
+
)
|
|
46
|
+
await writeFileInDir(
|
|
47
|
+
logger,
|
|
48
|
+
verbosePath,
|
|
49
|
+
JSON.stringify(fullMeta, null, 2)
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
32
53
|
const jsonImportPath = getFileImportRelativePath(
|
|
33
54
|
schedulersWiringMetaFile,
|
|
34
55
|
schedulersWiringMetaJsonFile,
|
|
@@ -23,7 +23,7 @@ export const serializeSchedulerMetaTS = (
|
|
|
23
23
|
serializedOutput.push(importStatement)
|
|
24
24
|
serializedOutput.push('')
|
|
25
25
|
serializedOutput.push(
|
|
26
|
-
"pikkuState('scheduler', 'meta', metaData as ScheduledTasksMeta)"
|
|
26
|
+
"pikkuState(null, 'scheduler', 'meta', metaData as ScheduledTasksMeta)"
|
|
27
27
|
)
|
|
28
28
|
serializedOutput.push('')
|
|
29
29
|
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { pikkuSessionlessFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
2
|
-
import { ErrorCode } from '@pikku/inspector'
|
|
2
|
+
import { convertDslToGraph, ErrorCode } from '@pikku/inspector'
|
|
3
|
+
import type { WorkflowsMeta } from '@pikku/core/workflow'
|
|
3
4
|
import { writeFileInDir } from '../../../utils/file-writer.js'
|
|
4
5
|
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js'
|
|
5
|
-
import {
|
|
6
|
-
serializeWorkflowMeta,
|
|
7
|
-
serializeWorkflowMetaTS,
|
|
8
|
-
} from './serialize-workflow-meta.js'
|
|
9
6
|
import { serializeWorkflowTypes } from './serialize-workflow-types.js'
|
|
7
|
+
import { serializeWorkflowRegistration } from './serialize-workflow-registration.js'
|
|
10
8
|
import { serializeWorkflowMap } from './serialize-workflow-map.js'
|
|
9
|
+
import { serializeWorkflowMeta } from './serialize-workflow-meta.js'
|
|
11
10
|
import { serializeWorkflowWorkers } from './serialize-workflow-workers.js'
|
|
12
|
-
import { serializeWorkflowWirings } from './serialize-workflow-wirings.js'
|
|
13
11
|
import { getFileImportRelativePath } from '../../../utils/file-import-path.js'
|
|
12
|
+
import {
|
|
13
|
+
stripVerboseFields,
|
|
14
|
+
hasVerboseFields,
|
|
15
|
+
} from '../../../utils/strip-verbose-meta.js'
|
|
14
16
|
import { join } from 'path'
|
|
15
17
|
|
|
16
18
|
export const pikkuWorkflow: any = pikkuSessionlessFunc<
|
|
@@ -22,7 +24,7 @@ export const pikkuWorkflow: any = pikkuSessionlessFunc<
|
|
|
22
24
|
const {
|
|
23
25
|
workflowsWiringFile,
|
|
24
26
|
workflowsWiringMetaFile,
|
|
25
|
-
|
|
27
|
+
workflowMetaDir,
|
|
26
28
|
workflowMapDeclarationFile,
|
|
27
29
|
workflowTypesFile,
|
|
28
30
|
functionTypesFile,
|
|
@@ -33,8 +35,16 @@ export const pikkuWorkflow: any = pikkuSessionlessFunc<
|
|
|
33
35
|
const { workflows, functions: functionState } = visitState
|
|
34
36
|
const { typesMap } = functionState
|
|
35
37
|
|
|
36
|
-
//
|
|
37
|
-
const
|
|
38
|
+
// Get all workflow names (both DSL and graph-based)
|
|
39
|
+
const dslWorkflowNames = Object.keys(workflows.meta)
|
|
40
|
+
const graphWorkflowNames = Object.keys(workflows.graphMeta)
|
|
41
|
+
const allWorkflowNames = [
|
|
42
|
+
...new Set([...dslWorkflowNames, ...graphWorkflowNames]),
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
const hasWorkflows = allWorkflowNames.length > 0
|
|
46
|
+
|
|
47
|
+
// Validate that workflowService is configured if workflows are defined
|
|
38
48
|
if (hasWorkflows) {
|
|
39
49
|
const hasWorkflowState =
|
|
40
50
|
visitState.serviceAggregation.allSingletonServices.includes(
|
|
@@ -51,48 +61,103 @@ export const pikkuWorkflow: any = pikkuSessionlessFunc<
|
|
|
51
61
|
}
|
|
52
62
|
}
|
|
53
63
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
// Generate individual JSON files for each workflow (convert DSL to graph format)
|
|
65
|
+
if (hasWorkflows && workflowMetaDir) {
|
|
66
|
+
// Write individual JSON files for DSL workflows
|
|
67
|
+
const dslMeta = workflows.meta as WorkflowsMeta
|
|
68
|
+
for (const [name, meta] of Object.entries(dslMeta)) {
|
|
69
|
+
const graphMeta = convertDslToGraph(name, meta)
|
|
59
70
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
71
|
+
// Write minimal version (runtime-only fields)
|
|
72
|
+
const minimalMeta = stripVerboseFields(graphMeta)
|
|
73
|
+
const minimalPath = join(workflowMetaDir, `${name}.gen.json`)
|
|
74
|
+
await writeFileInDir(
|
|
75
|
+
logger,
|
|
76
|
+
minimalPath,
|
|
77
|
+
JSON.stringify(minimalMeta, null, 2),
|
|
78
|
+
{ ignoreModifyComment: true }
|
|
79
|
+
)
|
|
65
80
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
81
|
+
// Write verbose version only if it has additional fields
|
|
82
|
+
if (hasVerboseFields(graphMeta)) {
|
|
83
|
+
const verbosePath = join(workflowMetaDir, `${name}-verbose.gen.json`)
|
|
84
|
+
await writeFileInDir(
|
|
85
|
+
logger,
|
|
86
|
+
verbosePath,
|
|
87
|
+
JSON.stringify(graphMeta, null, 2),
|
|
88
|
+
{ ignoreModifyComment: true }
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Write individual JSON files for graph workflows
|
|
94
|
+
for (const [name, graphMeta] of Object.entries(workflows.graphMeta)) {
|
|
95
|
+
// Write minimal version (runtime-only fields)
|
|
96
|
+
const minimalMeta = stripVerboseFields(graphMeta)
|
|
97
|
+
const minimalPath = join(workflowMetaDir, `${name}.gen.json`)
|
|
98
|
+
await writeFileInDir(
|
|
99
|
+
logger,
|
|
100
|
+
minimalPath,
|
|
101
|
+
JSON.stringify(minimalMeta, null, 2),
|
|
102
|
+
{ ignoreModifyComment: true }
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
// Write verbose version only if it has additional fields
|
|
106
|
+
if (hasVerboseFields(graphMeta)) {
|
|
107
|
+
const verbosePath = join(workflowMetaDir, `${name}-verbose.gen.json`)
|
|
108
|
+
await writeFileInDir(
|
|
109
|
+
logger,
|
|
110
|
+
verbosePath,
|
|
111
|
+
JSON.stringify(graphMeta, null, 2),
|
|
112
|
+
{ ignoreModifyComment: true }
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Generate workflow meta aggregation file
|
|
119
|
+
if (workflowsWiringMetaFile && workflowMetaDir) {
|
|
120
|
+
await writeFileInDir(
|
|
121
|
+
logger,
|
|
122
|
+
workflowsWiringMetaFile,
|
|
123
|
+
serializeWorkflowMeta(
|
|
124
|
+
workflowsWiringMetaFile,
|
|
125
|
+
workflowMetaDir,
|
|
126
|
+
allWorkflowNames,
|
|
127
|
+
packageMappings,
|
|
128
|
+
schema?.supportsImportAttributes ?? false,
|
|
129
|
+
config.externalPackageName
|
|
130
|
+
)
|
|
74
131
|
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Generate workflow registration (meta + DSL workflow registrations)
|
|
135
|
+
const metaImportPath = getFileImportRelativePath(
|
|
136
|
+
workflowsWiringFile,
|
|
137
|
+
workflowsWiringMetaFile,
|
|
138
|
+
packageMappings
|
|
75
139
|
)
|
|
76
140
|
|
|
77
|
-
// Write workflow wirings (imports and addWorkflow calls)
|
|
78
141
|
await writeFileInDir(
|
|
79
142
|
logger,
|
|
80
143
|
workflowsWiringFile,
|
|
81
|
-
|
|
144
|
+
serializeWorkflowRegistration(
|
|
82
145
|
workflowsWiringFile,
|
|
146
|
+
metaImportPath,
|
|
147
|
+
allWorkflowNames,
|
|
83
148
|
workflows.files,
|
|
84
|
-
|
|
149
|
+
workflows.graphFiles,
|
|
150
|
+
packageMappings,
|
|
151
|
+
config.externalPackageName
|
|
85
152
|
)
|
|
86
153
|
)
|
|
87
154
|
|
|
88
|
-
//
|
|
155
|
+
// Generate workflow types (DSL + graph helpers in one file)
|
|
89
156
|
const functionTypesImportPath = getFileImportRelativePath(
|
|
90
157
|
workflowTypesFile,
|
|
91
158
|
functionTypesFile,
|
|
92
159
|
packageMappings
|
|
93
160
|
)
|
|
94
|
-
|
|
95
|
-
// Get RPC map import path
|
|
96
161
|
const rpcMapImportPath = getFileImportRelativePath(
|
|
97
162
|
workflowTypesFile,
|
|
98
163
|
config.rpcInternalMapDeclarationFile,
|
|
@@ -105,7 +170,8 @@ export const pikkuWorkflow: any = pikkuSessionlessFunc<
|
|
|
105
170
|
serializeWorkflowTypes(functionTypesImportPath, rpcMapImportPath)
|
|
106
171
|
)
|
|
107
172
|
|
|
108
|
-
//
|
|
173
|
+
// Generate workflow map (I/O types for type-safe client)
|
|
174
|
+
// Always generate even if empty - RPC map imports WorkflowMap
|
|
109
175
|
await writeFileInDir(
|
|
110
176
|
logger,
|
|
111
177
|
workflowMapDeclarationFile,
|
|
@@ -118,6 +184,7 @@ export const pikkuWorkflow: any = pikkuSessionlessFunc<
|
|
|
118
184
|
)
|
|
119
185
|
)
|
|
120
186
|
|
|
187
|
+
// Generate workflow workers if configured
|
|
121
188
|
if (config.workflows) {
|
|
122
189
|
if (config.workflows.singleQueue) {
|
|
123
190
|
const workflowPath = join(config.rootDir, config.workflows.path)
|
|
@@ -140,12 +207,12 @@ export const pikkuWorkflow: any = pikkuSessionlessFunc<
|
|
|
140
207
|
}
|
|
141
208
|
}
|
|
142
209
|
|
|
143
|
-
return
|
|
210
|
+
return hasWorkflows
|
|
144
211
|
},
|
|
145
212
|
middleware: [
|
|
146
213
|
logCommandInfoAndTime({
|
|
147
|
-
commandStart: '
|
|
148
|
-
commandEnd: '
|
|
214
|
+
commandStart: 'Generating Workflows',
|
|
215
|
+
commandEnd: 'Generated Workflows',
|
|
149
216
|
}),
|
|
150
217
|
],
|
|
151
218
|
})
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate workflow map type definitions for type-safe client API
|
|
3
|
+
*/
|
|
1
4
|
import type { WorkflowsMeta } from '@pikku/core/workflow'
|
|
2
5
|
import { serializeImportMap } from '../../../utils/serialize-import-map.js'
|
|
3
6
|
import { TypesMap } from '@pikku/inspector'
|
|
@@ -12,7 +15,8 @@ export const serializeWorkflowMap = (
|
|
|
12
15
|
workflowsMeta: WorkflowsMeta
|
|
13
16
|
) => {
|
|
14
17
|
const requiredTypes = new Set<string>()
|
|
15
|
-
|
|
18
|
+
|
|
19
|
+
// First generate workflows to collect required types
|
|
16
20
|
const serializedWorkflows = generateWorkflows(
|
|
17
21
|
workflowsMeta,
|
|
18
22
|
functionsMeta,
|
|
@@ -20,15 +24,23 @@ export const serializeWorkflowMap = (
|
|
|
20
24
|
requiredTypes
|
|
21
25
|
)
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
typesMap,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
// Only generate custom types if we have workflows with types
|
|
28
|
+
const hasWorkflows = Object.keys(workflowsMeta).length > 0
|
|
29
|
+
const serializedCustomTypes = hasWorkflows
|
|
30
|
+
? generateCustomTypes(typesMap, requiredTypes)
|
|
31
|
+
: ''
|
|
32
|
+
|
|
33
|
+
const serializedImportMap = hasWorkflows
|
|
34
|
+
? serializeImportMap(
|
|
35
|
+
relativeToPath,
|
|
36
|
+
packageMappings,
|
|
37
|
+
typesMap,
|
|
38
|
+
requiredTypes
|
|
39
|
+
)
|
|
40
|
+
: ''
|
|
29
41
|
|
|
30
42
|
return `/**
|
|
31
|
-
*
|
|
43
|
+
* Workflow type map with input/output types for each workflow
|
|
32
44
|
*/
|
|
33
45
|
|
|
34
46
|
${serializedImportMap}
|
|
@@ -41,33 +53,16 @@ interface WorkflowHandler<I, O> {
|
|
|
41
53
|
|
|
42
54
|
${serializedWorkflows}
|
|
43
55
|
|
|
44
|
-
/**
|
|
45
|
-
* Type-safe workflow client API
|
|
46
|
-
*/
|
|
47
56
|
export type WorkflowClient<Name extends keyof WorkflowMap> = {
|
|
48
|
-
/**
|
|
49
|
-
* Start a new workflow run
|
|
50
|
-
*/
|
|
51
57
|
start: (input: WorkflowMap[Name]['input']) => Promise<{ runId: string }>;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Get a workflow run by ID
|
|
55
|
-
*/
|
|
56
58
|
getRun: <output extends keyof WorkflowMap[Name]>(runId: string) => Promise<WorkflowMap[Name][output]>;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Cancel a running workflow
|
|
60
|
-
*/
|
|
61
59
|
cancelRun: (runId: string) => Promise<boolean>;
|
|
62
60
|
}
|
|
63
61
|
|
|
64
|
-
/**
|
|
65
|
-
* Map of all registered workflows with type-safe client APIs
|
|
66
|
-
*/
|
|
67
62
|
export type TypedWorkflowClients = {
|
|
68
63
|
[Name in keyof WorkflowMap]: WorkflowClient<Name>;
|
|
69
64
|
}
|
|
70
|
-
|
|
65
|
+
`
|
|
71
66
|
}
|
|
72
67
|
|
|
73
68
|
function generateWorkflows(
|
|
@@ -76,13 +71,11 @@ function generateWorkflows(
|
|
|
76
71
|
typesMap: TypesMap,
|
|
77
72
|
requiredTypes: Set<string>
|
|
78
73
|
) {
|
|
79
|
-
// Initialize an object to collect workflows
|
|
80
74
|
const workflowsObj: Record<
|
|
81
75
|
string,
|
|
82
76
|
{ inputType: string; outputType: string }
|
|
83
77
|
> = {}
|
|
84
78
|
|
|
85
|
-
// Iterate through workflow metadata
|
|
86
79
|
for (const [workflowName, { pikkuFuncName }] of Object.entries(
|
|
87
80
|
workflowsMeta
|
|
88
81
|
)) {
|
|
@@ -96,27 +89,32 @@ function generateWorkflows(
|
|
|
96
89
|
const input = functionMeta.inputs ? functionMeta.inputs[0] : undefined
|
|
97
90
|
const output = functionMeta.outputs ? functionMeta.outputs[0] : undefined
|
|
98
91
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
92
|
+
let inputType = 'void'
|
|
93
|
+
if (input) {
|
|
94
|
+
try {
|
|
95
|
+
inputType = typesMap.getTypeMeta(input).uniqueName
|
|
96
|
+
} catch {
|
|
97
|
+
inputType = input
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
let outputType = 'void'
|
|
101
|
+
if (output) {
|
|
102
|
+
try {
|
|
103
|
+
outputType = typesMap.getTypeMeta(output).uniqueName
|
|
104
|
+
} catch {
|
|
105
|
+
outputType = output
|
|
106
|
+
}
|
|
107
|
+
}
|
|
102
108
|
|
|
103
109
|
requiredTypes.add(inputType)
|
|
104
110
|
requiredTypes.add(outputType)
|
|
105
|
-
|
|
106
|
-
// Add workflow entry
|
|
107
|
-
workflowsObj[workflowName] = {
|
|
108
|
-
inputType,
|
|
109
|
-
outputType,
|
|
110
|
-
}
|
|
111
|
+
workflowsObj[workflowName] = { inputType, outputType }
|
|
111
112
|
}
|
|
112
113
|
|
|
113
|
-
// Build the Workflows object as a string
|
|
114
114
|
let workflowsStr = 'export type WorkflowMap = {\n'
|
|
115
|
-
|
|
116
115
|
for (const [workflowName, handler] of Object.entries(workflowsObj)) {
|
|
117
116
|
workflowsStr += ` readonly '${workflowName}': WorkflowHandler<${handler.inputType}, ${handler.outputType}>,\n`
|
|
118
117
|
}
|
|
119
|
-
|
|
120
118
|
workflowsStr += '};\n'
|
|
121
119
|
|
|
122
120
|
return workflowsStr
|
|
@@ -1,33 +1,73 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Generate workflow meta aggregation file that imports individual workflow JSON files
|
|
3
|
+
* and registers them with pikkuState
|
|
4
|
+
*/
|
|
5
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js'
|
|
2
6
|
|
|
3
|
-
export const serializeWorkflowMeta = (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
supportsImportAttributes: boolean
|
|
7
|
+
export const serializeWorkflowMeta = (
|
|
8
|
+
outputPath: string,
|
|
9
|
+
metaDir: string,
|
|
10
|
+
workflowNames: string[],
|
|
11
|
+
packageMappings: Record<string, string>,
|
|
12
|
+
supportsImportAttributes: boolean,
|
|
13
|
+
packageName?: string
|
|
11
14
|
) => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const lines: string[] = []
|
|
16
|
+
|
|
17
|
+
if (workflowNames.length === 0) {
|
|
18
|
+
// Empty meta file - still need to register empty meta
|
|
19
|
+
lines.push("import { pikkuState } from '@pikku/core'")
|
|
20
|
+
lines.push(
|
|
21
|
+
"import type { SerializedWorkflowGraphs } from '@pikku/inspector/workflow-graph'"
|
|
22
|
+
)
|
|
23
|
+
lines.push('')
|
|
24
|
+
lines.push('const workflowsMeta: SerializedWorkflowGraphs = {}')
|
|
25
|
+
lines.push('')
|
|
26
|
+
const packageNameValue = packageName ? `'${packageName}'` : 'null'
|
|
27
|
+
lines.push(
|
|
28
|
+
`pikkuState(${packageNameValue}, 'workflows', 'meta', workflowsMeta)`
|
|
29
|
+
)
|
|
30
|
+
return lines.join('\n')
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Imports
|
|
34
|
+
lines.push("import { pikkuState } from '@pikku/core'")
|
|
35
|
+
lines.push(
|
|
36
|
+
"import type { SerializedWorkflowGraphs } from '@pikku/inspector/workflow-graph'"
|
|
23
37
|
)
|
|
24
|
-
|
|
38
|
+
lines.push('')
|
|
25
39
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
// Import each workflow meta JSON
|
|
41
|
+
const sortedNames = [...workflowNames].sort()
|
|
42
|
+
for (const name of sortedNames) {
|
|
43
|
+
const jsonPath = `${metaDir}/${name}.gen.json`
|
|
44
|
+
const importPath = getFileImportRelativePath(
|
|
45
|
+
outputPath,
|
|
46
|
+
jsonPath,
|
|
47
|
+
packageMappings
|
|
30
48
|
)
|
|
49
|
+
const importStatement = supportsImportAttributes
|
|
50
|
+
? `import ${name}Meta from '${importPath}' with { type: 'json' }`
|
|
51
|
+
: `import ${name}Meta from '${importPath}'`
|
|
52
|
+
lines.push(importStatement)
|
|
31
53
|
}
|
|
32
|
-
|
|
54
|
+
|
|
55
|
+
lines.push('')
|
|
56
|
+
|
|
57
|
+
// Create aggregated meta object (cast JSON imports to proper types)
|
|
58
|
+
lines.push('const workflowsMeta = {')
|
|
59
|
+
for (const name of sortedNames) {
|
|
60
|
+
lines.push(` '${name}': ${name}Meta,`)
|
|
61
|
+
}
|
|
62
|
+
lines.push('} as SerializedWorkflowGraphs')
|
|
63
|
+
|
|
64
|
+
lines.push('')
|
|
65
|
+
|
|
66
|
+
// Register meta with pikkuState
|
|
67
|
+
const packageNameValue = packageName ? `'${packageName}'` : 'null'
|
|
68
|
+
lines.push(
|
|
69
|
+
`pikkuState(${packageNameValue}, 'workflows', 'meta', workflowsMeta)`
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
return lines.join('\n')
|
|
33
73
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate workflow runtime registration
|
|
3
|
+
* Imports meta (which registers with pikkuState) and registers DSL workflows (addWorkflow) and graph workflows (addWorkflowGraph)
|
|
4
|
+
*/
|
|
5
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js'
|
|
6
|
+
|
|
7
|
+
export const serializeWorkflowRegistration = (
|
|
8
|
+
outputPath: string,
|
|
9
|
+
metaImportPath: string,
|
|
10
|
+
workflowNames: string[],
|
|
11
|
+
workflowFiles: Map<string, { path: string; exportedName: string }>,
|
|
12
|
+
graphFiles: Map<string, { path: string; exportedName: string }>,
|
|
13
|
+
packageMappings: Record<string, string>,
|
|
14
|
+
_packageName?: string
|
|
15
|
+
) => {
|
|
16
|
+
const lines: string[] = []
|
|
17
|
+
const hasWorkflows = workflowNames.length > 0
|
|
18
|
+
const hasDslWorkflows = workflowFiles.size > 0
|
|
19
|
+
const hasGraphWorkflows = graphFiles.size > 0
|
|
20
|
+
|
|
21
|
+
// Imports
|
|
22
|
+
const imports: string[] = []
|
|
23
|
+
if (hasDslWorkflows) {
|
|
24
|
+
imports.push('addWorkflow')
|
|
25
|
+
}
|
|
26
|
+
if (hasGraphWorkflows) {
|
|
27
|
+
imports.push('addWorkflowGraph')
|
|
28
|
+
}
|
|
29
|
+
if (imports.length > 0) {
|
|
30
|
+
lines.push(`import { ${imports.join(', ')} } from '@pikku/core/workflow'`)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Import meta file (which registers meta with pikkuState)
|
|
34
|
+
if (hasWorkflows) {
|
|
35
|
+
lines.push(`import '${metaImportPath}'`)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Import DSL workflow functions
|
|
39
|
+
const sortedWorkflows = Array.from(workflowFiles.entries()).sort((a, b) =>
|
|
40
|
+
a[0].localeCompare(b[0])
|
|
41
|
+
)
|
|
42
|
+
for (const [, { path, exportedName }] of sortedWorkflows) {
|
|
43
|
+
const importPath = getFileImportRelativePath(
|
|
44
|
+
outputPath,
|
|
45
|
+
path,
|
|
46
|
+
packageMappings
|
|
47
|
+
)
|
|
48
|
+
lines.push(`import { ${exportedName} } from '${importPath}'`)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Import graph workflow definitions
|
|
52
|
+
const sortedGraphWorkflows = Array.from(graphFiles.entries()).sort((a, b) =>
|
|
53
|
+
a[0].localeCompare(b[0])
|
|
54
|
+
)
|
|
55
|
+
for (const [, { path, exportedName }] of sortedGraphWorkflows) {
|
|
56
|
+
const importPath = getFileImportRelativePath(
|
|
57
|
+
outputPath,
|
|
58
|
+
path,
|
|
59
|
+
packageMappings
|
|
60
|
+
)
|
|
61
|
+
lines.push(`import { ${exportedName} } from '${importPath}'`)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
lines.push('')
|
|
65
|
+
|
|
66
|
+
// Register DSL workflows
|
|
67
|
+
for (const [pikkuFuncName, { exportedName }] of sortedWorkflows) {
|
|
68
|
+
lines.push(`addWorkflow('${pikkuFuncName}', ${exportedName})`)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Register graph workflows
|
|
72
|
+
for (const [workflowName, { exportedName }] of sortedGraphWorkflows) {
|
|
73
|
+
lines.push(`addWorkflowGraph('${workflowName}', ${exportedName})`)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Export workflow names type
|
|
77
|
+
if (hasWorkflows) {
|
|
78
|
+
lines.push('')
|
|
79
|
+
lines.push(`export type WorkflowNames = '${workflowNames.join("' | '")}'`)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return lines.join('\n')
|
|
83
|
+
}
|