@pikku/cli 0.11.0 → 0.11.2
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 +11 -12
- package/.pikku/channel/pikku-channels-map.gen.d.ts +9 -9
- package/.pikku/channel/pikku-channels-meta.gen.ts +1 -1
- package/.pikku/channel/pikku-channels.gen.ts +1 -1
- package/.pikku/cli/pikku-cli-channel.ts +92 -0
- package/.pikku/cli/pikku-cli-client.gen.ts +54 -0
- package/.pikku/cli/pikku-cli-types.gen.ts +3 -3
- package/.pikku/cli/pikku-cli-wirings-meta.gen.json +146 -0
- package/.pikku/cli/pikku-cli-wirings-meta.gen.ts +4 -34
- package/.pikku/cli/pikku-cli-wirings.gen.ts +2 -1
- package/.pikku/cli/pikku-cli.gen.ts +41 -0
- package/.pikku/function/pikku-function-types.gen.ts +49 -63
- package/.pikku/function/pikku-functions-meta.gen.json +988 -0
- package/.pikku/function/pikku-functions-meta.gen.ts +4 -970
- package/.pikku/function/pikku-functions-meta.min.gen.json +212 -0
- package/.pikku/function/pikku-functions-meta.min.gen.ts +4 -209
- package/.pikku/http/pikku-http-types.gen.ts +2 -2
- package/.pikku/http/pikku-http-wirings-map.gen.d.ts +9 -9
- package/.pikku/http/pikku-http-wirings-meta.gen.ts +1 -1
- package/.pikku/http/pikku-http-wirings.gen.ts +1 -1
- package/.pikku/mcp/pikku-mcp-types.gen.ts +13 -13
- package/.pikku/mcp/pikku-mcp-wirings-meta.gen.json +5 -0
- package/.pikku/mcp/pikku-mcp-wirings-meta.gen.ts +6 -4
- package/.pikku/mcp/pikku-mcp-wirings.gen.ts +1 -1
- package/.pikku/pikku-bootstrap.gen.ts +1 -4
- package/.pikku/pikku-services.gen.ts +6 -8
- package/.pikku/pikku-types.gen.ts +1 -1
- package/.pikku/pikku-websocket.gen.ts +1 -1
- package/.pikku/queue/pikku-queue-types.gen.ts +2 -2
- package/.pikku/queue/pikku-queue-workers-wirings-map.gen.d.ts +9 -9
- package/.pikku/queue/pikku-queue-workers-wirings-meta.gen.json +1 -0
- package/.pikku/queue/pikku-queue-workers-wirings-meta.gen.ts +5 -7
- package/.pikku/queue/pikku-queue-workers-wirings.gen.ts +1 -1
- package/.pikku/rpc/pikku-remote-rpc-workers.gen.ts +2 -2
- package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +9 -9
- package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +41 -40
- package/.pikku/scheduler/pikku-scheduler-types.gen.ts +2 -2
- package/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.json +1 -0
- package/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.ts +5 -2
- package/.pikku/scheduler/pikku-schedulers-wirings.gen.ts +1 -1
- package/.pikku/schemas/register.gen.ts +27 -27
- package/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -1
- package/.pikku/services/config.gen.json +99 -0
- package/.pikku/services/getInspectorState.gen.json +10 -0
- package/.pikku/services/jwt.gen.json +13 -0
- package/.pikku/services/logger.gen.json +25 -0
- package/.pikku/services/queueService.gen.json +14 -0
- package/.pikku/services/schedulerService.gen.json +17 -0
- package/.pikku/services/schema.gen.json +14 -0
- package/.pikku/services/variables.gen.json +13 -0
- package/.pikku/services/workflowService.gen.json +31 -0
- package/.pikku/workflow/pikku-workflow-map.gen.d.ts +9 -9
- package/.pikku/workflow/pikku-workflow-types.gen.ts +36 -31
- package/.pikku/workflow/pikku-workflow-wirings-meta.gen.json +1 -0
- package/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +5 -2
- package/.pikku/workflow/pikku-workflow-wirings.gen.ts +6 -2
- package/CHANGELOG.md +27 -1
- package/bin/pikku.ts +6 -32
- package/build.sh +53 -31
- package/cli.schema.json +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +6 -7
- package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
- package/dist/.pikku/channel/pikku-channels-meta.gen.js +1 -1
- 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 +91 -0
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +10 -0
- package/dist/.pikku/cli/pikku-cli-client.gen.js +44 -0
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +3 -3
- package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +3 -34
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +146 -0
- package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +2 -1
- package/dist/.pikku/cli/pikku-cli-wirings.gen.js +2 -1
- package/dist/.pikku/cli/pikku-cli.gen.d.ts +10 -0
- package/dist/.pikku/cli/pikku-cli.gen.js +38 -0
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +29 -79
- package/dist/.pikku/function/pikku-function-types.gen.js +19 -15
- package/dist/.pikku/function/pikku-functions-meta.gen.js +3 -969
- package/dist/.pikku/function/pikku-functions-meta.gen.json +988 -0
- package/dist/.pikku/function/pikku-functions-meta.min.gen.js +3 -208
- package/dist/.pikku/function/pikku-functions-meta.min.gen.json +212 -0
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +2 -2
- package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
- package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +1 -1
- 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 +13 -13
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.js +5 -4
- package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.json +5 -0
- 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 +1 -4
- package/dist/.pikku/pikku-bootstrap.gen.js +1 -4
- package/dist/.pikku/pikku-services.gen.d.ts +5 -8
- package/dist/.pikku/pikku-services.gen.js +3 -6
- package/dist/.pikku/pikku-types.gen.d.ts +1 -1
- package/dist/.pikku/pikku-types.gen.js +1 -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 +2 -2
- package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +3 -7
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.json +1 -0
- 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 +6 -9
- package/dist/.pikku/rpc/pikku-remote-rpc-workers.gen.js +2 -2
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +2 -2
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
- package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.js +3 -2
- package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.json +1 -0
- 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 +17 -17
- package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +29 -25
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +22 -8
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +3 -2
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.json +1 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +6 -2
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +6 -3
- package/dist/bin/pikku.js +5 -28
- package/dist/src/cli.wiring.js +108 -106
- package/dist/src/functions/commands/all.js +82 -42
- package/dist/src/functions/commands/bootstrap.js +22 -10
- package/dist/src/functions/commands/watch.js +6 -3
- package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.js +12 -7
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.d.ts +1 -1
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.js +42 -4
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.d.ts +1 -1
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.js +40 -2
- package/dist/src/functions/wirings/channels/pikku-channels.js +9 -2
- package/dist/src/functions/wirings/channels/serialize-channel-types.js +10 -11
- package/dist/src/functions/wirings/cli/pikku-command-cli-entry.js +4 -4
- package/dist/src/functions/wirings/cli/pikku-command-cli-types.js +1 -1
- package/dist/src/functions/wirings/cli/pikku-command-cli.js +9 -3
- package/dist/src/functions/wirings/cli/serialize-channel-cli.js +1 -1
- package/dist/src/functions/wirings/cli/serialize-cli-types.js +2 -2
- package/dist/src/functions/wirings/cli/serialize-local-cli-bootstrap.d.ts +1 -1
- package/dist/src/functions/wirings/cli/serialize-local-cli-bootstrap.js +4 -4
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +4 -4
- package/dist/src/functions/wirings/functions/pikku-command-functions.js +15 -5
- package/dist/src/functions/wirings/functions/pikku-command-services.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-services.js +23 -23
- package/dist/src/functions/wirings/functions/schemas.js +1 -1
- package/dist/src/functions/wirings/functions/serialize-function-types.d.ts +1 -1
- package/dist/src/functions/wirings/functions/serialize-function-types.js +50 -64
- package/dist/src/functions/wirings/http/openapi-spec-generator.js +4 -4
- package/dist/src/functions/wirings/http/pikku-http-routes.js +9 -2
- package/dist/src/functions/wirings/http/serialize-http-types.js +1 -1
- package/dist/src/functions/wirings/mcp/pikku-command-mcp.js +18 -4
- package/dist/src/functions/wirings/mcp/serialize-mcp-types.js +12 -12
- package/dist/src/functions/wirings/middleware/pikku-command-middleware.js +26 -2
- package/dist/src/functions/wirings/middleware/serialize-middleware-groups-meta.d.ts +5 -2
- package/dist/src/functions/wirings/middleware/serialize-middleware-groups-meta.js +5 -13
- package/dist/src/functions/wirings/queue/pikku-command-queue.js +9 -3
- package/dist/src/functions/wirings/queue/pikku-queue.js +9 -3
- package/dist/src/functions/wirings/queue/serialize-queue-meta.d.ts +2 -1
- package/dist/src/functions/wirings/queue/serialize-queue-meta.js +10 -1
- package/dist/src/functions/wirings/queue/serialize-queue-types.js +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +9 -2
- package/dist/src/functions/wirings/rpc/serialize-public-rpc.js +11 -4
- package/dist/src/functions/wirings/rpc/serialize-remote-rpc.js +1 -1
- package/dist/src/functions/wirings/rpc/serialize-rpc-wrapper.js +3 -3
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.js +6 -3
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-meta.d.ts +2 -1
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-meta.js +11 -1
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-types.js +1 -1
- package/dist/src/functions/wirings/services/pikku-command-service-metadata.d.ts +1 -0
- package/dist/src/functions/wirings/services/pikku-command-service-metadata.js +22 -0
- package/dist/src/functions/wirings/workflow/pikku-command-workflow-types.js +3 -1
- package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +12 -8
- package/dist/src/functions/wirings/workflow/serialize-workflow-meta.d.ts +2 -1
- package/dist/src/functions/wirings/workflow/serialize-workflow-meta.js +11 -1
- package/dist/src/functions/wirings/workflow/serialize-workflow-types.d.ts +1 -1
- package/dist/src/functions/wirings/workflow/serialize-workflow-types.js +36 -31
- package/dist/src/functions/wirings/workflow/serialize-workflow-wirings.d.ts +8 -0
- package/dist/src/functions/wirings/workflow/serialize-workflow-wirings.js +30 -0
- package/dist/src/functions/wirings/workflow/serialize-workflow-workers.js +2 -2
- package/dist/src/middleware/log-command-info-and-time.d.ts +2 -2
- package/dist/src/middleware/log-command-info-and-time.js +1 -4
- package/dist/src/services/cli-logger-forwarder.service.d.ts +3 -0
- package/dist/src/services/cli-logger-forwarder.service.js +9 -2
- package/dist/src/services.d.ts +2 -7
- package/dist/src/services.js +14 -12
- package/dist/src/utils/check-required-types.d.ts +2 -2
- package/dist/src/utils/check-required-types.js +2 -3
- package/dist/src/utils/pikku-cli-config.js +35 -2
- package/dist/src/utils/pikku-files-and-methods.d.ts +2 -2
- package/dist/src/utils/pikku-files-and-methods.js +4 -4
- package/dist/src/utils/schema-generator.d.ts +1 -1
- package/dist/src/utils/schema-generator.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -8
- package/src/cli.wiring.ts +110 -105
- package/src/functions/commands/all.ts +94 -45
- package/src/functions/commands/bootstrap.ts +25 -10
- package/src/functions/commands/watch.ts +6 -3
- package/src/functions/runtimes/nextjs/pikku-command-nextjs.ts +26 -5
- package/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.ts +43 -4
- package/src/functions/runtimes/nextjs/serialize-nextjs-http-wrapper.ts +40 -1
- package/src/functions/wirings/channels/pikku-channels.ts +27 -3
- package/src/functions/wirings/channels/serialize-channel-types.ts +10 -11
- package/src/functions/wirings/cli/pikku-command-cli-entry.ts +4 -4
- package/src/functions/wirings/cli/pikku-command-cli-types.ts +1 -1
- package/src/functions/wirings/cli/pikku-command-cli.ts +26 -3
- package/src/functions/wirings/cli/serialize-channel-cli.ts +1 -1
- package/src/functions/wirings/cli/serialize-cli-types.ts +2 -2
- package/src/functions/wirings/cli/serialize-local-cli-bootstrap.ts +5 -5
- package/src/functions/wirings/functions/pikku-command-function-types-split.ts +6 -6
- package/src/functions/wirings/functions/pikku-command-functions.ts +39 -4
- package/src/functions/wirings/functions/pikku-command-services.ts +25 -25
- package/src/functions/wirings/functions/schemas.ts +2 -2
- package/src/functions/wirings/functions/serialize-function-types.ts +51 -65
- package/src/functions/wirings/http/openapi-spec-generator.ts +14 -5
- package/src/functions/wirings/http/pikku-http-routes.ts +28 -2
- package/src/functions/wirings/http/serialize-http-types.ts +1 -1
- package/src/functions/wirings/mcp/pikku-command-mcp.ts +30 -4
- package/src/functions/wirings/mcp/serialize-mcp-types.ts +12 -12
- package/src/functions/wirings/middleware/pikku-command-middleware.ts +35 -2
- package/src/functions/wirings/middleware/serialize-middleware-groups-meta.ts +4 -19
- package/src/functions/wirings/permissions/pikku-command-permissions.ts +2 -2
- package/src/functions/wirings/queue/pikku-command-queue.ts +27 -2
- package/src/functions/wirings/queue/pikku-queue.ts +27 -2
- package/src/functions/wirings/queue/serialize-queue-meta.ts +15 -1
- package/src/functions/wirings/queue/serialize-queue-types.ts +1 -1
- package/src/functions/wirings/rpc/pikku-command-rpc.ts +25 -2
- package/src/functions/wirings/rpc/serialize-public-rpc.ts +11 -4
- package/src/functions/wirings/rpc/serialize-remote-rpc.ts +1 -1
- package/src/functions/wirings/rpc/serialize-rpc-wrapper.ts +3 -3
- package/src/functions/wirings/scheduler/pikku-command-scheduler.ts +30 -4
- package/src/functions/wirings/scheduler/serialize-scheduler-meta.ts +20 -1
- package/src/functions/wirings/scheduler/serialize-scheduler-types.ts +1 -1
- package/src/functions/wirings/services/pikku-command-service-metadata.ts +25 -0
- package/src/functions/wirings/workflow/pikku-command-workflow-types.ts +8 -1
- package/src/functions/wirings/workflow/pikku-command-workflow.ts +36 -8
- package/src/functions/wirings/workflow/serialize-workflow-meta.ts +18 -1
- package/src/functions/wirings/workflow/serialize-workflow-types.ts +39 -31
- package/src/functions/wirings/workflow/serialize-workflow-wirings.ts +47 -0
- package/src/functions/wirings/workflow/serialize-workflow-workers.ts +2 -2
- package/src/middleware/log-command-info-and-time.ts +3 -6
- package/src/services/cli-logger-forwarder.service.ts +11 -2
- package/src/services.ts +15 -15
- package/src/utils/check-required-types.ts +4 -7
- package/src/utils/pikku-cli-config.ts +69 -2
- package/src/utils/pikku-files-and-methods.ts +10 -13
- package/src/utils/schema-generator.ts +2 -2
- package/types/application-types.d.ts +1 -1
- package/types/config.d.ts +12 -1
- package/.pikku/function/pikku-functions.gen.ts +0 -84
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +0 -47
- package/dist/.pikku/function/pikku-functions.gen.js +0 -83
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts +0 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +0 -47
- package/dist/.pikku/schemas/schemas/PikkuRemoteInternalRPCInput.schema.json +0 -1
- /package/dist/.pikku/{function/pikku-functions.gen.d.ts → cli/pikku-cli-channel.d.ts} +0 -0
|
@@ -4,8 +4,54 @@ 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
|
+
import { pikkuFunctionTypes } from '../wirings/functions/pikku-command-function-types.js'
|
|
9
|
+
import { pikkuFunctionTypesSplit } from '../wirings/functions/pikku-command-function-types-split.js'
|
|
10
|
+
import { pikkuHTTPTypes } from '../wirings/http/pikku-command-http-types.js'
|
|
11
|
+
import { pikkuChannelTypes } from '../wirings/channels/pikku-command-channel-types.js'
|
|
12
|
+
import { pikkuSchedulerTypes } from '../wirings/scheduler/pikku-command-scheduler-types.js'
|
|
13
|
+
import { pikkuQueueTypes } from '../wirings/queue/pikku-command-queue-types.js'
|
|
14
|
+
import { pikkuWorkflowTypes } from '../wirings/workflow/pikku-command-workflow-types.js'
|
|
15
|
+
import { pikkuMCPTypes } from '../wirings/mcp/pikku-command-mcp-types.js'
|
|
16
|
+
import { pikkuCLITypes } from '../wirings/cli/pikku-command-cli-types.js'
|
|
17
|
+
import { pikkuFunctions } from '../wirings/functions/pikku-command-functions.js'
|
|
18
|
+
import { pikkuMiddleware } from '../wirings/middleware/pikku-command-middleware.js'
|
|
19
|
+
import { pikkuPermissions } from '../wirings/permissions/pikku-command-permissions.js'
|
|
20
|
+
import { pikkuServices } from '../wirings/functions/pikku-command-services.js'
|
|
21
|
+
import { pikkuServiceMetadata } from '../wirings/services/pikku-command-service-metadata.js'
|
|
22
|
+
import { pikkuRPC } from '../wirings/rpc/pikku-command-rpc.js'
|
|
23
|
+
import {
|
|
24
|
+
pikkuRPCExposedMap,
|
|
25
|
+
pikkuRPCInternalMap,
|
|
26
|
+
} from '../wirings/rpc/pikku-command-rpc-map.js'
|
|
27
|
+
import { pikkuPublicRPC } from '../wirings/rpc/pikku-command-public-rpc.js'
|
|
28
|
+
import { pikkuRPCClient } from '../wirings/rpc/pikku-command-rpc-client.js'
|
|
29
|
+
import { pikkuSchemas } from '../wirings/functions/schemas.js'
|
|
30
|
+
import { pikkuHTTP } from '../wirings/http/pikku-command-http-routes.js'
|
|
31
|
+
import { pikkuHTTPMap } from '../wirings/http/pikku-command-http-map.js'
|
|
32
|
+
import { pikkuFetch } from '../wirings/fetch/index.js'
|
|
33
|
+
import { pikkuScheduler } from '../wirings/scheduler/pikku-command-scheduler.js'
|
|
34
|
+
import { pikkuWorkflow } from '../wirings/workflow/pikku-command-workflow.js'
|
|
35
|
+
import { pikkuRemoteRPC } from '../wirings/rpc/pikku-command-remote-rpc.js'
|
|
36
|
+
import { pikkuWorkflowMap } from '../wirings/workflow/pikku-command-workflow-map.js'
|
|
37
|
+
import { pikkuQueue } from '../wirings/queue/pikku-command-queue.js'
|
|
38
|
+
import { pikkuQueueMap } from '../wirings/queue/pikku-command-queue-map.js'
|
|
39
|
+
import { pikkuQueueService } from '../wirings/queue/pikku-command-queue-service.js'
|
|
40
|
+
import { pikkuChannels } from '../wirings/channels/pikku-command-channels.js'
|
|
41
|
+
import { pikkuChannelsMap } from '../wirings/channels/pikku-command-channels-map.js'
|
|
42
|
+
import { pikkuWebSocketTyped } from '../wirings/channels/pikku-command-websocket-typed.js'
|
|
43
|
+
import { pikkuMCP } from '../wirings/mcp/pikku-command-mcp.js'
|
|
44
|
+
import { pikkuMCPJSON } from '../wirings/mcp/pikku-command-mcp-json.js'
|
|
45
|
+
import { pikkuCLI } from '../wirings/cli/pikku-command-cli.js'
|
|
46
|
+
import { pikkuCLIEntry } from '../wirings/cli/pikku-command-cli-entry.js'
|
|
47
|
+
import { pikkuNext } from '../runtimes/nextjs/pikku-command-nextjs.js'
|
|
48
|
+
import { pikkuOpenAPI } from '../wirings/http/pikku-command-openapi.js'
|
|
49
|
+
import { PikkuWire } from '@pikku/core'
|
|
50
|
+
|
|
7
51
|
export const all: any = pikkuVoidFunc({
|
|
8
|
-
func: async ({ logger, config,
|
|
52
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
53
|
+
const wire: PikkuWire = {}
|
|
54
|
+
const services = { logger, config, getInspectorState }
|
|
9
55
|
const summary = new CommandSummary('all')
|
|
10
56
|
const allImports: string[] = []
|
|
11
57
|
let typesDeclarationFileExists = true
|
|
@@ -14,7 +60,7 @@ export const all: any = pikkuVoidFunc({
|
|
|
14
60
|
typesDeclarationFileExists = false
|
|
15
61
|
}
|
|
16
62
|
|
|
17
|
-
await
|
|
63
|
+
await pikkuFunctionTypes.func(services, null, wire)
|
|
18
64
|
|
|
19
65
|
// This is needed since the wireHTTP function will add the routes to the visitState
|
|
20
66
|
if (!typesDeclarationFileExists) {
|
|
@@ -23,26 +69,30 @@ export const all: any = pikkuVoidFunc({
|
|
|
23
69
|
}
|
|
24
70
|
|
|
25
71
|
// Generate wiring-specific type files for tree-shaking
|
|
26
|
-
await
|
|
27
|
-
await
|
|
28
|
-
await
|
|
29
|
-
await
|
|
30
|
-
await
|
|
31
|
-
await
|
|
32
|
-
await
|
|
33
|
-
await
|
|
72
|
+
await pikkuFunctionTypesSplit.func(services, null, wire)
|
|
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 pikkuWorkflowTypes.func(services, null, wire)
|
|
78
|
+
await pikkuMCPTypes.func(services, null, wire)
|
|
79
|
+
await pikkuCLITypes.func(services, null, wire)
|
|
34
80
|
|
|
35
|
-
const hasFunctionRegistrations = await
|
|
81
|
+
const hasFunctionRegistrations = await pikkuFunctions.func(
|
|
82
|
+
services,
|
|
83
|
+
wire,
|
|
84
|
+
null
|
|
85
|
+
)
|
|
36
86
|
|
|
37
87
|
// Generate and register middleware
|
|
38
|
-
const middleware = await
|
|
88
|
+
const middleware = await pikkuMiddleware.func(services, null, wire)
|
|
39
89
|
// Middleware must be imported before functions meta to ensure registration happens first
|
|
40
90
|
if (middleware) {
|
|
41
91
|
allImports.push(config.middlewareFile)
|
|
42
92
|
}
|
|
43
93
|
|
|
44
94
|
// Generate and register permissions
|
|
45
|
-
const permissions = await
|
|
95
|
+
const permissions = await pikkuPermissions.func(services, null, wire)
|
|
46
96
|
// Permissions must be imported before functions meta to ensure registration happens first
|
|
47
97
|
if (permissions) {
|
|
48
98
|
allImports.push(config.permissionsFile)
|
|
@@ -57,32 +107,36 @@ export const all: any = pikkuVoidFunc({
|
|
|
57
107
|
}
|
|
58
108
|
|
|
59
109
|
// Generate services map
|
|
60
|
-
await
|
|
110
|
+
await pikkuServices.func(services, null, wire)
|
|
111
|
+
|
|
112
|
+
// Generate service metadata JSON files for AI consumption
|
|
113
|
+
await pikkuServiceMetadata.func(services, null, wire)
|
|
61
114
|
|
|
62
|
-
const hasInternalRPCs = await
|
|
63
|
-
await
|
|
64
|
-
await
|
|
65
|
-
await
|
|
115
|
+
const hasInternalRPCs = await pikkuRPC.func(services, null, wire)
|
|
116
|
+
await pikkuRPCInternalMap.func(services, null, wire)
|
|
117
|
+
await pikkuRPCExposedMap.func(services, null, wire)
|
|
118
|
+
await pikkuPublicRPC.func(services, null, wire)
|
|
119
|
+
await pikkuRPCClient.func(services, null, wire)
|
|
66
120
|
|
|
67
121
|
if (hasInternalRPCs) {
|
|
68
122
|
allImports.push(config.rpcInternalWiringMetaFile)
|
|
69
123
|
}
|
|
70
124
|
|
|
71
|
-
const schemas = await
|
|
125
|
+
const schemas = await pikkuSchemas.func(services, null, wire)
|
|
72
126
|
if (schemas) {
|
|
73
127
|
allImports.push(`${config.schemaDirectory}/register.gen.ts`)
|
|
74
128
|
}
|
|
75
129
|
|
|
76
130
|
// Generate HTTP
|
|
77
|
-
const http = await
|
|
131
|
+
const http = await pikkuHTTP.func(services, null, wire)
|
|
78
132
|
if (http) {
|
|
79
|
-
await
|
|
80
|
-
await
|
|
133
|
+
await pikkuHTTPMap.func(services, null, wire)
|
|
134
|
+
await pikkuFetch.func(services, null, wire)
|
|
81
135
|
allImports.push(config.httpWiringMetaFile, config.httpWiringsFile)
|
|
82
136
|
}
|
|
83
137
|
|
|
84
138
|
// Generate Scheduler
|
|
85
|
-
const scheduler = await
|
|
139
|
+
const scheduler = await pikkuScheduler.func(services, null, wire)
|
|
86
140
|
if (scheduler) {
|
|
87
141
|
allImports.push(
|
|
88
142
|
config.schedulersWiringMetaFile,
|
|
@@ -91,10 +145,10 @@ export const all: any = pikkuVoidFunc({
|
|
|
91
145
|
}
|
|
92
146
|
|
|
93
147
|
// Generate Workflows
|
|
94
|
-
const workflows = await
|
|
148
|
+
const workflows = await pikkuWorkflow.func(services, null, wire)
|
|
95
149
|
|
|
96
150
|
// Generate Remote RPC Workers (must be before queue discovery so wireQueueWorker calls are picked up)
|
|
97
|
-
const remoteRPC = await
|
|
151
|
+
const remoteRPC = await pikkuRemoteRPC.func(services, null, wire)
|
|
98
152
|
|
|
99
153
|
// Reinspect to pick up generated workflow workers and remote RPC workers BEFORE generating maps
|
|
100
154
|
if (workflows || remoteRPC) {
|
|
@@ -102,23 +156,18 @@ export const all: any = pikkuVoidFunc({
|
|
|
102
156
|
}
|
|
103
157
|
|
|
104
158
|
if (workflows) {
|
|
105
|
-
await
|
|
159
|
+
await pikkuWorkflowMap.func(services, null, wire)
|
|
106
160
|
allImports.push(
|
|
107
161
|
config.workflowsWiringMetaFile,
|
|
108
162
|
config.workflowsWiringFile
|
|
109
163
|
)
|
|
110
164
|
}
|
|
111
165
|
|
|
112
|
-
if (remoteRPC && config.rpc?.remoteRpcWorkersPath) {
|
|
113
|
-
// Only add to imports if we actually generated the file
|
|
114
|
-
allImports.push(config.rpc.remoteRpcWorkersPath)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
166
|
// Generate Queues
|
|
118
|
-
const queues = await
|
|
167
|
+
const queues = await pikkuQueue.func(services, null, wire)
|
|
119
168
|
if (queues) {
|
|
120
|
-
await
|
|
121
|
-
await
|
|
169
|
+
await pikkuQueueMap.func(services, null, wire)
|
|
170
|
+
await pikkuQueueService.func(services, null, wire)
|
|
122
171
|
allImports.push(
|
|
123
172
|
config.queueWorkersWiringMetaFile,
|
|
124
173
|
config.queueWorkersWiringFile
|
|
@@ -126,29 +175,29 @@ export const all: any = pikkuVoidFunc({
|
|
|
126
175
|
}
|
|
127
176
|
|
|
128
177
|
// Generate Channels
|
|
129
|
-
const channels = await
|
|
178
|
+
const channels = await pikkuChannels.func(services, null, wire)
|
|
130
179
|
if (channels) {
|
|
131
|
-
await
|
|
132
|
-
await
|
|
180
|
+
await pikkuChannelsMap.func(services, null, wire)
|
|
181
|
+
await pikkuWebSocketTyped.func(services, null, wire)
|
|
133
182
|
allImports.push(config.channelsWiringMetaFile, config.channelsWiringFile)
|
|
134
183
|
}
|
|
135
184
|
|
|
136
185
|
// Generate MCP
|
|
137
|
-
const mcp = await
|
|
186
|
+
const mcp = await pikkuMCP.func(services, null, wire)
|
|
138
187
|
if (mcp) {
|
|
139
|
-
await
|
|
188
|
+
await pikkuMCPJSON.func(services, null, wire)
|
|
140
189
|
allImports.push(config.mcpWiringsMetaFile, config.mcpWiringsFile)
|
|
141
190
|
}
|
|
142
191
|
|
|
143
192
|
// Generate CLI
|
|
144
|
-
const cli = await
|
|
193
|
+
const cli = await pikkuCLI.func(services, null, wire)
|
|
145
194
|
if (cli) {
|
|
146
|
-
await
|
|
195
|
+
await pikkuCLIEntry.func(services, null, wire)
|
|
147
196
|
allImports.push(config.cliWiringMetaFile, config.cliWiringsFile)
|
|
148
197
|
}
|
|
149
198
|
|
|
150
199
|
if (config.nextBackendFile || config.nextHTTPFile) {
|
|
151
|
-
await
|
|
200
|
+
await pikkuNext.func(services, null, wire)
|
|
152
201
|
}
|
|
153
202
|
|
|
154
203
|
if (config.openAPI) {
|
|
@@ -156,7 +205,7 @@ export const all: any = pikkuVoidFunc({
|
|
|
156
205
|
`• OpenAPI requires a reinspection to pickup new generated types..`
|
|
157
206
|
)
|
|
158
207
|
await getInspectorState(true)
|
|
159
|
-
await
|
|
208
|
+
await pikkuOpenAPI.func(services, null, wire)
|
|
160
209
|
}
|
|
161
210
|
|
|
162
211
|
// Generate main bootstrap file (pass all imports directly since this is the main file)
|
|
@@ -194,8 +243,8 @@ export const all: any = pikkuVoidFunc({
|
|
|
194
243
|
}
|
|
195
244
|
if (state.cli?.meta) {
|
|
196
245
|
// Count total CLI commands across all programs
|
|
197
|
-
const totalCommands = Object.values(state.cli.meta).reduce(
|
|
198
|
-
(sum, program) => sum + (program.commands?.length || 0),
|
|
246
|
+
const totalCommands: number = Object.values(state.cli.meta).reduce(
|
|
247
|
+
(sum: number, program: any) => sum + (program.commands?.length || 0),
|
|
199
248
|
0
|
|
200
249
|
)
|
|
201
250
|
if (totalCommands > 0) summary.set('cliCommands', totalCommands)
|
|
@@ -1,24 +1,39 @@
|
|
|
1
1
|
import { pikkuVoidFunc } from '../../../.pikku/pikku-types.gen.js'
|
|
2
2
|
|
|
3
|
+
// Import command functions directly
|
|
4
|
+
import { pikkuFunctionTypes } from '../wirings/functions/pikku-command-function-types.js'
|
|
5
|
+
import { pikkuFunctionTypesSplit } from '../wirings/functions/pikku-command-function-types-split.js'
|
|
6
|
+
import { pikkuHTTPTypes } from '../wirings/http/pikku-command-http-types.js'
|
|
7
|
+
import { pikkuChannelTypes } from '../wirings/channels/pikku-command-channel-types.js'
|
|
8
|
+
import { pikkuSchedulerTypes } from '../wirings/scheduler/pikku-command-scheduler-types.js'
|
|
9
|
+
import { pikkuQueueTypes } from '../wirings/queue/pikku-command-queue-types.js'
|
|
10
|
+
import { pikkuWorkflowTypes } from '../wirings/workflow/pikku-command-workflow-types.js'
|
|
11
|
+
import { pikkuMCPTypes } from '../wirings/mcp/pikku-command-mcp-types.js'
|
|
12
|
+
import { pikkuCLITypes } from '../wirings/cli/pikku-command-cli-types.js'
|
|
13
|
+
import { PikkuWire } from '@pikku/core'
|
|
14
|
+
|
|
3
15
|
export const bootstrap: any = pikkuVoidFunc({
|
|
4
|
-
func: async ({ logger, config,
|
|
16
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
17
|
+
const wire: PikkuWire = {}
|
|
18
|
+
const services = { logger, config, getInspectorState }
|
|
19
|
+
|
|
5
20
|
// Initialize inspector state in bootstrap mode with core types only
|
|
6
21
|
// This allows bootstrap to run immediately without inspecting the codebase
|
|
7
22
|
// All subsequent RPC commands will use this cached state
|
|
8
23
|
await getInspectorState(false, false, true)
|
|
9
24
|
|
|
10
|
-
await
|
|
25
|
+
await pikkuFunctionTypes.func(services, null, wire)
|
|
11
26
|
|
|
12
27
|
// Generate wiring-specific type files for tree-shaking
|
|
13
28
|
// These use the bootstrap mode state with core types
|
|
14
|
-
await
|
|
15
|
-
await
|
|
16
|
-
await
|
|
17
|
-
await
|
|
18
|
-
await
|
|
19
|
-
await
|
|
20
|
-
await
|
|
21
|
-
await
|
|
29
|
+
await pikkuFunctionTypesSplit.func(services, null, wire)
|
|
30
|
+
await pikkuHTTPTypes.func(services, null, wire)
|
|
31
|
+
await pikkuChannelTypes.func(services, null, wire)
|
|
32
|
+
await pikkuSchedulerTypes.func(services, null, wire)
|
|
33
|
+
await pikkuQueueTypes.func(services, null, wire)
|
|
34
|
+
await pikkuWorkflowTypes.func(services, null, wire)
|
|
35
|
+
await pikkuMCPTypes.func(services, null, wire)
|
|
36
|
+
await pikkuCLITypes.func(services, null, wire)
|
|
22
37
|
|
|
23
38
|
// Check for critical errors and exit if any were logged
|
|
24
39
|
if (logger.hasCriticalErrors()) {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { pikkuVoidFunc } from '../../../.pikku/pikku-types.gen.js'
|
|
2
2
|
import chokidar from 'chokidar'
|
|
3
|
+
import { all } from './all.js'
|
|
3
4
|
|
|
4
5
|
export const watch: any = pikkuVoidFunc({
|
|
5
|
-
func: async ({ logger, config,
|
|
6
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
7
|
+
const services = { logger, config, getInspectorState }
|
|
6
8
|
const configWatcher = chokidar.watch(config.srcDirectories, {
|
|
7
9
|
ignoreInitial: true,
|
|
8
10
|
ignored: /.*\.gen\.tsx?/,
|
|
@@ -25,13 +27,14 @@ export const watch: any = pikkuVoidFunc({
|
|
|
25
27
|
const handle = async () => {
|
|
26
28
|
try {
|
|
27
29
|
const start = Date.now()
|
|
28
|
-
await
|
|
30
|
+
await all.func(services, null, {})
|
|
29
31
|
logger.info({
|
|
30
32
|
message: `✓ Generated in ${Date.now() - start}ms`,
|
|
31
33
|
type: 'timing',
|
|
32
34
|
})
|
|
33
35
|
} catch (err) {
|
|
34
|
-
|
|
36
|
+
console.error(err)
|
|
37
|
+
logger.error('Error running watch')
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
|
|
@@ -12,6 +12,7 @@ export const pikkuNext: any = pikkuSessionlessFunc<void, void>({
|
|
|
12
12
|
nextBackendFile,
|
|
13
13
|
nextHTTPFile,
|
|
14
14
|
httpMapDeclarationFile,
|
|
15
|
+
rpcMapDeclarationFile,
|
|
15
16
|
packageMappings,
|
|
16
17
|
fetchFile,
|
|
17
18
|
} = config
|
|
@@ -34,31 +35,37 @@ export const pikkuNext: any = pikkuSessionlessFunc<void, void>({
|
|
|
34
35
|
)
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
if ((nextBackendFile || nextHTTPFile) && !rpcMapDeclarationFile) {
|
|
39
|
+
throw new Error(
|
|
40
|
+
'rpcMapDeclarationFile is required in pikku config in order for nextJS wrapper to work'
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
37
44
|
if (nextBackendFile) {
|
|
38
45
|
// Check for required types
|
|
39
46
|
checkRequiredTypes(visitState.filesAndMethodsErrors, {
|
|
40
47
|
config: true,
|
|
41
48
|
singletonServicesFactory: true,
|
|
42
|
-
|
|
49
|
+
wireServicesFactory: true,
|
|
43
50
|
})
|
|
44
51
|
|
|
45
52
|
const {
|
|
46
53
|
pikkuConfigFactory,
|
|
47
54
|
singletonServicesFactory,
|
|
48
|
-
|
|
55
|
+
wireServicesFactory,
|
|
49
56
|
} = visitState.filesAndMethods
|
|
50
57
|
|
|
51
58
|
if (
|
|
52
59
|
!pikkuConfigFactory ||
|
|
53
60
|
!singletonServicesFactory ||
|
|
54
|
-
!
|
|
61
|
+
!wireServicesFactory
|
|
55
62
|
) {
|
|
56
63
|
throw new Error('Required types not found')
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
const pikkuConfigImport = `import { ${pikkuConfigFactory.variable} as createConfig } from '${getFileImportRelativePath(nextBackendFile, pikkuConfigFactory.file, packageMappings)}'`
|
|
60
67
|
const singletonServicesImport = `import { ${singletonServicesFactory.variable} as createSingletonServices } from '${getFileImportRelativePath(nextBackendFile, singletonServicesFactory.file, packageMappings)}'`
|
|
61
|
-
const
|
|
68
|
+
const wireServicesImport = `import { ${wireServicesFactory.variable} as createWireServices } from '${getFileImportRelativePath(nextBackendFile, wireServicesFactory.file, packageMappings)}'`
|
|
62
69
|
|
|
63
70
|
const bootstrapPath = getFileImportRelativePath(
|
|
64
71
|
nextBackendFile,
|
|
@@ -72,12 +79,19 @@ export const pikkuNext: any = pikkuSessionlessFunc<void, void>({
|
|
|
72
79
|
packageMappings
|
|
73
80
|
)
|
|
74
81
|
|
|
82
|
+
const rpcMapDeclarationPath = getFileImportRelativePath(
|
|
83
|
+
nextBackendFile,
|
|
84
|
+
rpcMapDeclarationFile,
|
|
85
|
+
packageMappings
|
|
86
|
+
)
|
|
87
|
+
|
|
75
88
|
const content = serializeNextBackendWrapper(
|
|
76
89
|
bootstrapPath,
|
|
77
90
|
routesMapDeclarationPath,
|
|
91
|
+
rpcMapDeclarationPath,
|
|
78
92
|
pikkuConfigImport,
|
|
79
93
|
singletonServicesImport,
|
|
80
|
-
|
|
94
|
+
wireServicesImport
|
|
81
95
|
)
|
|
82
96
|
await writeFileInDir(logger, nextBackendFile, content)
|
|
83
97
|
}
|
|
@@ -89,6 +103,12 @@ export const pikkuNext: any = pikkuSessionlessFunc<void, void>({
|
|
|
89
103
|
packageMappings
|
|
90
104
|
)
|
|
91
105
|
|
|
106
|
+
const rpcMapDeclarationPath = getFileImportRelativePath(
|
|
107
|
+
nextHTTPFile,
|
|
108
|
+
rpcMapDeclarationFile,
|
|
109
|
+
packageMappings
|
|
110
|
+
)
|
|
111
|
+
|
|
92
112
|
const fetchPath = getFileImportRelativePath(
|
|
93
113
|
nextHTTPFile,
|
|
94
114
|
fetchFile,
|
|
@@ -97,6 +117,7 @@ export const pikkuNext: any = pikkuSessionlessFunc<void, void>({
|
|
|
97
117
|
|
|
98
118
|
const content = serializeNextHTTPWrapper(
|
|
99
119
|
routesMapDeclarationPath,
|
|
120
|
+
rpcMapDeclarationPath,
|
|
100
121
|
fetchPath
|
|
101
122
|
)
|
|
102
123
|
await writeFileInDir(logger, nextHTTPFile, content)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export const serializeNextJsBackendWrapper = (
|
|
2
2
|
bootstrapPath: string,
|
|
3
3
|
routesMapPath: string,
|
|
4
|
+
rpcMapPath: string,
|
|
4
5
|
configImport: string,
|
|
5
6
|
singleServicesFactoryImport: string,
|
|
6
|
-
|
|
7
|
+
wireServicesImport: string
|
|
7
8
|
) => {
|
|
8
9
|
return `'server-only'
|
|
9
10
|
|
|
@@ -14,12 +15,13 @@ export const serializeNextJsBackendWrapper = (
|
|
|
14
15
|
import { PikkuNextJS } from '@pikku/next'
|
|
15
16
|
import { NextRequest } from 'next/server.js'
|
|
16
17
|
import type { HTTPWiringsMap, HTTPWiringHandlerOf, HTTPWiringsWithMethod } from '${routesMapPath}'
|
|
18
|
+
import type { RPCMap } from '${rpcMapPath}'
|
|
17
19
|
|
|
18
20
|
type RouteContext = { params: Promise<Record<string, string | string[]>> }
|
|
19
21
|
|
|
20
22
|
${configImport}
|
|
21
23
|
${singleServicesFactoryImport}
|
|
22
|
-
${
|
|
24
|
+
${wireServicesImport}
|
|
23
25
|
|
|
24
26
|
import '${bootstrapPath}'
|
|
25
27
|
|
|
@@ -40,7 +42,7 @@ export const pikku = (_options?: any) => {
|
|
|
40
42
|
_pikku = new PikkuNextJS(
|
|
41
43
|
createConfig as any,
|
|
42
44
|
createSingletonServices as any,
|
|
43
|
-
|
|
45
|
+
createWireServices
|
|
44
46
|
)
|
|
45
47
|
}
|
|
46
48
|
|
|
@@ -180,13 +182,50 @@ export const pikku = (_options?: any) => {
|
|
|
180
182
|
return staticActionRequest(route, 'GET', data)
|
|
181
183
|
}
|
|
182
184
|
|
|
185
|
+
// RPC Requests
|
|
186
|
+
|
|
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
|
+
/**
|
|
196
|
+
* Makes a dynamic RPC request.
|
|
197
|
+
*
|
|
198
|
+
* @template Name - The RPC function name from the RPCMap.
|
|
199
|
+
* @param name - The RPC function identifier.
|
|
200
|
+
* @param data - The input data for the RPC request.
|
|
201
|
+
* @returns A promise that resolves to the output of the RPC handler.
|
|
202
|
+
*/
|
|
203
|
+
const rpc: RPCInvoke = async (name, data) => {
|
|
204
|
+
return dynamicActionRequest(\`/rpc/\${name}\` as any, 'POST', { data }) as any
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Makes a static RPC request.
|
|
209
|
+
* Note: In HTTP wrapper context, both rpc and staticRPC behave the same way.
|
|
210
|
+
*
|
|
211
|
+
* @template Name - The RPC function name from the RPCMap.
|
|
212
|
+
* @param name - The RPC function identifier.
|
|
213
|
+
* @param data - The input data for the RPC request.
|
|
214
|
+
* @returns A promise that resolves to the output of the RPC handler.
|
|
215
|
+
*/
|
|
216
|
+
const staticRPC: RPCInvoke = async (name, data) => {
|
|
217
|
+
return staticActionRequest(\`/rpc/\${name}\` as any, 'POST', { data }) as any
|
|
218
|
+
}
|
|
219
|
+
|
|
183
220
|
return {
|
|
221
|
+
rpc,
|
|
184
222
|
get: dynamicGet,
|
|
185
223
|
post: dynamicPost,
|
|
186
224
|
patch: dynamicPatch,
|
|
187
225
|
del: dynamicDel,
|
|
188
226
|
staticGet,
|
|
189
227
|
staticPost,
|
|
228
|
+
staticRPC,
|
|
190
229
|
}
|
|
191
230
|
}
|
|
192
231
|
|
|
@@ -210,7 +249,7 @@ export const pikkuAPIRequest = (
|
|
|
210
249
|
_pikku = new PikkuNextJS(
|
|
211
250
|
createConfig as any,
|
|
212
251
|
createSingletonServices as any,
|
|
213
|
-
|
|
252
|
+
createWireServices
|
|
214
253
|
)
|
|
215
254
|
}
|
|
216
255
|
if (_removeAPIPrefix) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const serializeNextJsHTTPWrapper = (
|
|
2
2
|
routesMapPath: string,
|
|
3
|
+
rpcMapPath: string,
|
|
3
4
|
pikkuFetchImport: string
|
|
4
5
|
) => {
|
|
5
6
|
return `'server-only'
|
|
@@ -10,6 +11,7 @@ export const serializeNextJsHTTPWrapper = (
|
|
|
10
11
|
*/
|
|
11
12
|
import { CorePikkuFetchOptions } from '@pikku/fetch'
|
|
12
13
|
import type { HTTPWiringsMap, HTTPWiringHandlerOf, HTTPWiringsWithMethod } from '${routesMapPath}'
|
|
14
|
+
import type { RPCMap } from '${rpcMapPath}'
|
|
13
15
|
import { PikkuFetch } from '${pikkuFetchImport}'
|
|
14
16
|
|
|
15
17
|
let _pikku: PikkuFetch | undefined
|
|
@@ -149,13 +151,50 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
149
151
|
return staticActionRequest(route, 'GET', data)
|
|
150
152
|
}
|
|
151
153
|
|
|
154
|
+
// RPC Requests
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Type definition for RPC invocation.
|
|
158
|
+
*/
|
|
159
|
+
type RPCInvoke = <Name extends keyof RPCMap>(
|
|
160
|
+
name: Name,
|
|
161
|
+
data: RPCMap[Name]['input']
|
|
162
|
+
) => Promise<RPCMap[Name]['output']>
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Makes a dynamic RPC request.
|
|
166
|
+
*
|
|
167
|
+
* @template Name - The RPC function name from the RPCMap.
|
|
168
|
+
* @param name - The RPC function identifier.
|
|
169
|
+
* @param data - The input data for the RPC request.
|
|
170
|
+
* @returns A promise that resolves to the output of the RPC handler.
|
|
171
|
+
*/
|
|
172
|
+
const rpc: RPCInvoke = async (rpcName, data) => {
|
|
173
|
+
return dynamicActionRequest(\`/rpc/\${rpcName}\` as any, 'POST', { data }) as any
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Makes a static RPC request.
|
|
178
|
+
* Note: In HTTP wrapper context, both rpc and rpcStatic behave the same way.
|
|
179
|
+
*
|
|
180
|
+
* @template Name - The RPC function name from the RPCMap.
|
|
181
|
+
* @param name - The RPC function identifier.
|
|
182
|
+
* @param data - The input data for the RPC request.
|
|
183
|
+
* @returns A promise that resolves to the output of the RPC handler.
|
|
184
|
+
*/
|
|
185
|
+
const staticRPC: RPCInvoke = async (rpcName, data) => {
|
|
186
|
+
return staticActionRequest(\`/rpc/\${rpcName}\` as any, 'POST', { data }) as any
|
|
187
|
+
}
|
|
188
|
+
|
|
152
189
|
return {
|
|
190
|
+
rpc,
|
|
153
191
|
get: dynamicGet,
|
|
154
192
|
post: dynamicPost,
|
|
155
193
|
patch: dynamicPatch,
|
|
156
194
|
del: dynamicDel,
|
|
157
195
|
staticGet,
|
|
158
|
-
staticPost
|
|
196
|
+
staticPost,
|
|
197
|
+
staticRPC
|
|
159
198
|
}
|
|
160
199
|
}
|
|
161
200
|
`
|
|
@@ -2,12 +2,18 @@ import { pikkuVoidFunc } from '../../../../.pikku/pikku-types.gen.js'
|
|
|
2
2
|
import { serializeFileImports } from '../../../utils/file-imports-serializer.js'
|
|
3
3
|
import { writeFileInDir } from '../../../utils/file-writer.js'
|
|
4
4
|
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js'
|
|
5
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js'
|
|
5
6
|
|
|
6
7
|
export const pikkuChannels: any = pikkuVoidFunc({
|
|
7
8
|
func: async ({ logger, config, getInspectorState }) => {
|
|
8
9
|
const visitState = await getInspectorState()
|
|
9
|
-
const {
|
|
10
|
-
|
|
10
|
+
const {
|
|
11
|
+
channelsWiringFile,
|
|
12
|
+
channelsWiringMetaFile,
|
|
13
|
+
channelsWiringMetaJsonFile,
|
|
14
|
+
packageMappings,
|
|
15
|
+
schema,
|
|
16
|
+
} = config
|
|
11
17
|
const { channels } = visitState
|
|
12
18
|
|
|
13
19
|
await writeFileInDir(
|
|
@@ -20,10 +26,28 @@ export const pikkuChannels: any = pikkuVoidFunc({
|
|
|
20
26
|
packageMappings
|
|
21
27
|
)
|
|
22
28
|
)
|
|
29
|
+
|
|
30
|
+
await writeFileInDir(
|
|
31
|
+
logger,
|
|
32
|
+
channelsWiringMetaJsonFile,
|
|
33
|
+
JSON.stringify(channels.meta, null, 2)
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
const jsonImportPath = getFileImportRelativePath(
|
|
37
|
+
channelsWiringMetaFile,
|
|
38
|
+
channelsWiringMetaJsonFile,
|
|
39
|
+
packageMappings
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
const supportsImportAttributes = schema?.supportsImportAttributes ?? false
|
|
43
|
+
const importStatement = supportsImportAttributes
|
|
44
|
+
? `import metaData from '${jsonImportPath}' with { type: 'json' }`
|
|
45
|
+
: `import metaData from '${jsonImportPath}'`
|
|
46
|
+
|
|
23
47
|
await writeFileInDir(
|
|
24
48
|
logger,
|
|
25
49
|
channelsWiringMetaFile,
|
|
26
|
-
`import { pikkuState } from '@pikku/core'\npikkuState('channel', 'meta',
|
|
50
|
+
`import { pikkuState } from '@pikku/core'\nimport { ChannelsMeta } from '@pikku/core/channel'\n${importStatement}\npikkuState('channel', 'meta', metaData as ChannelsMeta)`
|
|
27
51
|
)
|
|
28
52
|
},
|
|
29
53
|
middleware: [
|