@pikku/cli 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/bin/pikku-all.ts +41 -32
- package/bin/pikku-fetch.ts +1 -1
- package/bin/pikku-openapi.ts +2 -2
- package/bin/pikku-queue-service.ts +2 -2
- package/bin/pikku-websocket.ts +1 -1
- package/cli.schema.json +30 -30
- package/dist/bin/pikku-all.js +32 -32
- package/dist/bin/pikku-fetch.js +1 -1
- package/dist/bin/pikku-openapi.js +2 -2
- package/dist/bin/pikku-queue-service.js +2 -2
- package/dist/bin/pikku-websocket.js +1 -1
- package/dist/bin/pikku.js +0 -0
- package/dist/src/events/channels/pikku-channels.js +3 -3
- package/dist/src/events/channels/pikku-command-channels.js +3 -3
- package/dist/src/events/channels/serialize-typed-channel-map.js +2 -2
- package/dist/src/events/channels/serialize-websocket-wrapper.js +15 -1
- package/dist/src/events/fetch/index.js +2 -2
- package/dist/src/events/http/openapi-spec-generator.d.ts +2 -2
- package/dist/src/events/http/pikku-command-http-map.js +4 -4
- package/dist/src/events/http/pikku-command-http-routes.js +3 -3
- package/dist/src/events/http/pikku-command-nextjs.d.ts +2 -0
- package/dist/src/events/http/pikku-command-nextjs.js +36 -0
- package/dist/src/events/http/pikku-http-routes.js +3 -3
- package/dist/src/events/http/serialize-typed-http-map.d.ts +2 -2
- package/dist/src/events/http/serialize-typed-http-map.js +11 -11
- package/dist/src/events/mcp/pikku-command-mcp.js +3 -3
- package/dist/src/events/queue/pikku-command-queue-service.js +6 -6
- package/dist/src/events/queue/pikku-command-queue.js +3 -3
- package/dist/src/events/queue/pikku-queue.js +3 -3
- package/dist/src/events/rpc/index.d.ts +2 -0
- package/dist/src/events/rpc/index.js +12 -0
- package/dist/src/events/rpc/pikku-command-rpc-client.js +6 -6
- package/dist/src/events/rpc/pikku-command-rpc.js +2 -2
- package/dist/src/events/rpc/pikku-rpc.js +2 -2
- package/dist/src/events/rpc/serialize-rpc-wrapper.js +40 -1
- package/dist/src/events/scheduler/pikku-command-scheduler.js +3 -3
- package/dist/src/inspector-glob.js +2 -2
- package/dist/src/pikku-cli-config.d.ts +17 -17
- package/dist/src/pikku-cli-config.js +31 -31
- package/dist/src/runtimes/nextjs/pikku-command-nextjs.js +3 -3
- package/dist/src/runtimes/nextjs/serialize-nextjs-backend-wrapper.js +29 -29
- package/dist/src/runtimes/nextjs/serialize-nextjs-http-wrapper.js +28 -28
- package/dist/src/schema-generator.d.ts +2 -2
- package/dist/src/schema-generator.js +2 -2
- package/dist/src/serialize-pikku-types.js +67 -67
- package/dist/src/utils.js +8 -0
- package/dist/src/wirings/channels/pikku-channels.d.ts +2 -0
- package/dist/src/wirings/channels/pikku-channels.js +9 -0
- package/dist/src/wirings/channels/pikku-command-channels-map.d.ts +2 -0
- package/dist/src/wirings/channels/pikku-command-channels-map.js +8 -0
- package/dist/src/wirings/channels/pikku-command-channels.d.ts +2 -0
- package/dist/src/wirings/channels/pikku-command-channels.js +9 -0
- package/dist/src/wirings/channels/pikku-command-websocket-typed.d.ts +2 -0
- package/dist/src/wirings/channels/pikku-command-websocket-typed.js +15 -0
- package/dist/src/wirings/channels/serialize-typed-channel-map.d.ts +4 -0
- package/dist/src/wirings/channels/serialize-typed-channel-map.js +111 -0
- package/dist/src/wirings/channels/serialize-websocket-wrapper.d.ts +1 -0
- package/dist/src/wirings/channels/serialize-websocket-wrapper.js +75 -0
- package/dist/src/wirings/fetch/index.d.ts +2 -0
- package/dist/src/wirings/fetch/index.js +12 -0
- package/dist/src/wirings/functions/pikku-command-function-types.d.ts +2 -0
- package/dist/src/wirings/functions/pikku-command-function-types.js +13 -0
- package/dist/src/wirings/functions/pikku-command-functions.d.ts +6 -0
- package/dist/src/wirings/functions/pikku-command-functions.js +35 -0
- package/dist/src/wirings/functions/pikku-command-services.d.ts +3 -0
- package/dist/src/wirings/functions/pikku-command-services.js +73 -0
- package/dist/src/wirings/functions/pikku-function-types.d.ts +2 -0
- package/dist/src/wirings/functions/pikku-function-types.js +13 -0
- package/dist/src/wirings/functions/pikku-functions.d.ts +6 -0
- package/dist/src/wirings/functions/pikku-functions.js +35 -0
- package/dist/src/wirings/http/openapi-spec-generator.d.ts +79 -0
- package/dist/src/wirings/http/openapi-spec-generator.js +145 -0
- package/dist/src/wirings/http/pikku-command-http-map.d.ts +2 -0
- package/dist/src/wirings/http/pikku-command-http-map.js +8 -0
- package/dist/src/wirings/http/pikku-command-http-routes.d.ts +2 -0
- package/dist/src/wirings/http/pikku-command-http-routes.js +9 -0
- package/dist/src/wirings/http/pikku-command-openapi.d.ts +2 -0
- package/dist/src/wirings/http/pikku-command-openapi.js +20 -0
- package/dist/src/wirings/http/pikku-http-routes.d.ts +2 -0
- package/dist/src/wirings/http/pikku-http-routes.js +9 -0
- package/dist/src/wirings/http/serialize-fetch-wrapper.d.ts +1 -0
- package/dist/src/wirings/http/serialize-fetch-wrapper.js +67 -0
- package/dist/src/wirings/http/serialize-typed-http-map.d.ts +4 -0
- package/dist/src/wirings/http/serialize-typed-http-map.js +100 -0
- package/dist/src/wirings/mcp/pikku-command-mcp-json.d.ts +2 -0
- package/dist/src/wirings/mcp/pikku-command-mcp-json.js +13 -0
- package/dist/src/wirings/mcp/pikku-command-mcp.d.ts +2 -0
- package/dist/src/wirings/mcp/pikku-command-mcp.js +54 -0
- package/dist/src/wirings/mcp/serialize-mcp-json.d.ts +5 -0
- package/dist/src/wirings/mcp/serialize-mcp-json.js +101 -0
- package/dist/src/wirings/queue/pikku-command-queue-map.d.ts +2 -0
- package/dist/src/wirings/queue/pikku-command-queue-map.js +8 -0
- package/dist/src/wirings/queue/pikku-command-queue-service.d.ts +2 -0
- package/dist/src/wirings/queue/pikku-command-queue-service.js +15 -0
- package/dist/src/wirings/queue/pikku-command-queue.d.ts +2 -0
- package/dist/src/wirings/queue/pikku-command-queue.js +10 -0
- package/dist/src/wirings/queue/pikku-queue-map.d.ts +2 -0
- package/dist/src/wirings/queue/pikku-queue-map.js +8 -0
- package/dist/src/wirings/queue/pikku-queue.d.ts +2 -0
- package/dist/src/wirings/queue/pikku-queue.js +10 -0
- package/dist/src/wirings/queue/serialize-queue-map.d.ts +4 -0
- package/dist/src/wirings/queue/serialize-queue-map.js +77 -0
- package/dist/src/wirings/queue/serialize-queue-meta.d.ts +2 -0
- package/dist/src/wirings/queue/serialize-queue-meta.js +6 -0
- package/dist/src/wirings/queue/serialize-queue-wrapper.d.ts +1 -0
- package/dist/src/wirings/queue/serialize-queue-wrapper.js +35 -0
- package/dist/src/wirings/rpc/pikku-command-rpc-client.d.ts +2 -0
- package/dist/src/wirings/rpc/pikku-command-rpc-client.js +15 -0
- package/dist/src/wirings/rpc/pikku-command-rpc-map.d.ts +2 -0
- package/dist/src/wirings/rpc/pikku-command-rpc-map.js +8 -0
- package/dist/src/wirings/rpc/pikku-command-rpc.d.ts +2 -0
- package/dist/src/wirings/rpc/pikku-command-rpc.js +6 -0
- package/dist/src/wirings/rpc/pikku-rpc.d.ts +2 -0
- package/dist/src/wirings/rpc/pikku-rpc.js +6 -0
- package/dist/src/wirings/rpc/serialize-rpc-wrapper.d.ts +1 -0
- package/dist/src/wirings/rpc/serialize-rpc-wrapper.js +68 -0
- package/dist/src/wirings/rpc/serialize-typed-rpc-map.d.ts +4 -0
- package/dist/src/wirings/rpc/serialize-typed-rpc-map.js +66 -0
- package/dist/src/wirings/scheduler/pikku-command-scheduler.d.ts +2 -0
- package/dist/src/wirings/scheduler/pikku-command-scheduler.js +10 -0
- package/dist/src/wirings/scheduler/serialize-scheduler-meta.d.ts +2 -0
- package/dist/src/wirings/scheduler/serialize-scheduler-meta.js +10 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/lcov.info +582 -0
- package/package.json +3 -3
- package/src/inspector-glob.ts +2 -2
- package/src/pikku-cli-config.ts +67 -52
- package/src/runtimes/nextjs/pikku-command-nextjs.ts +3 -3
- package/src/runtimes/nextjs/serialize-nextjs-backend-wrapper.ts +29 -29
- package/src/runtimes/nextjs/serialize-nextjs-http-wrapper.ts +28 -28
- package/src/schema-generator.ts +3 -3
- package/src/serialize-pikku-types.ts +67 -67
- package/src/utils.test.ts +38 -0
- package/src/utils.ts +9 -0
- package/src/{events → wirings}/channels/pikku-channels.ts +5 -4
- package/src/{events → wirings}/channels/pikku-command-channels.ts +5 -4
- package/src/{events → wirings}/channels/serialize-typed-channel-map.ts +3 -3
- package/src/{events → wirings}/channels/serialize-websocket-wrapper.ts +19 -5
- package/src/{events → wirings}/fetch/index.ts +2 -2
- package/src/{events → wirings}/http/openapi-spec-generator.ts +3 -3
- package/src/{events → wirings}/http/pikku-command-http-map.ts +5 -5
- package/src/{events → wirings}/http/pikku-command-http-routes.ts +5 -5
- package/src/{events → wirings}/http/pikku-http-routes.ts +5 -5
- package/src/wirings/http/serialize-fetch-wrapper.ts +67 -0
- package/src/{events → wirings}/http/serialize-typed-http-map.ts +17 -17
- package/src/{events → wirings}/mcp/pikku-command-mcp.ts +5 -5
- package/src/{events → wirings}/queue/pikku-command-queue-service.ts +9 -6
- package/src/{events → wirings}/queue/pikku-command-queue.ts +8 -5
- package/src/{events → wirings}/queue/pikku-queue.ts +8 -5
- package/src/{events → wirings}/rpc/pikku-command-rpc-client.ts +9 -6
- package/src/{events → wirings}/rpc/pikku-command-rpc.ts +2 -2
- package/src/{events → wirings}/rpc/pikku-rpc.ts +2 -2
- package/src/wirings/rpc/serialize-rpc-wrapper.ts +68 -0
- package/src/{events → wirings}/scheduler/pikku-command-scheduler.ts +8 -4
- package/src/events/http/serialize-fetch-wrapper.ts +0 -67
- package/src/events/rpc/serialize-rpc-wrapper.ts +0 -29
- /package/src/{events → wirings}/channels/pikku-command-channels-map.ts +0 -0
- /package/src/{events → wirings}/channels/pikku-command-websocket-typed.ts +0 -0
- /package/src/{events → wirings}/functions/pikku-command-function-types.ts +0 -0
- /package/src/{events → wirings}/functions/pikku-command-functions.ts +0 -0
- /package/src/{events → wirings}/functions/pikku-command-services.ts +0 -0
- /package/src/{events → wirings}/functions/pikku-function-types.ts +0 -0
- /package/src/{events → wirings}/functions/pikku-functions.ts +0 -0
- /package/src/{events → wirings}/http/pikku-command-openapi.ts +0 -0
- /package/src/{events → wirings}/mcp/pikku-command-mcp-json.ts +0 -0
- /package/src/{events → wirings}/mcp/serialize-mcp-json.ts +0 -0
- /package/src/{events → wirings}/queue/pikku-command-queue-map.ts +0 -0
- /package/src/{events → wirings}/queue/pikku-queue-map.ts +0 -0
- /package/src/{events → wirings}/queue/serialize-queue-map.ts +0 -0
- /package/src/{events → wirings}/queue/serialize-queue-meta.ts +0 -0
- /package/src/{events → wirings}/queue/serialize-queue-wrapper.ts +0 -0
- /package/src/{events → wirings}/rpc/pikku-command-rpc-map.ts +0 -0
- /package/src/{events → wirings}/rpc/serialize-typed-rpc-map.ts +0 -0
- /package/src/{events → wirings}/scheduler/serialize-scheduler-meta.ts +0 -0
|
@@ -13,13 +13,13 @@ export const serializePikkuTypes = (
|
|
|
13
13
|
* This is used to provide the application types in the typescript project
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { CoreScheduledTask,
|
|
20
|
-
import {
|
|
21
|
-
import { CoreQueueWorker,
|
|
22
|
-
import { CoreMCPResource, CoreMCPTool, CoreMCPPrompt,
|
|
16
|
+
import { CorePikkuPermission, PikkuMiddleware } from '@pikku/core'
|
|
17
|
+
import { CorePikkuFunction, CorePikkuFunctionSessionless } from '@pikku/core/function'
|
|
18
|
+
import { CoreHTTPFunctionWiring, AssertHTTPWiringParams, wireHTTP as wireHTTPCore } from '@pikku/core/http'
|
|
19
|
+
import { CoreScheduledTask, wireScheduler as wireSchedulerCore } from '@pikku/core/scheduler'
|
|
20
|
+
import { CoreChannel, PikkuChannel, wireChannel as wireChannelCore } from '@pikku/core/channel'
|
|
21
|
+
import { CoreQueueWorker, wireQueueWorker as wireQueueWorkerCore } from '@pikku/core/queue'
|
|
22
|
+
import { CoreMCPResource, CoreMCPTool, CoreMCPPrompt, wireMCPResource as wireMCPResourceCore, wireMCPTool as wireMCPToolCore, wireMCPPrompt as wireMCPPromptCore, MCPResourceResponse, MCPToolResponse, MCPPromptResponse, PikkuMCP } from '@pikku/core'
|
|
23
23
|
|
|
24
24
|
${userSessionTypeImport}
|
|
25
25
|
${singletonServicesTypeImport}
|
|
@@ -33,11 +33,11 @@ ${rpcMapTypeImport}
|
|
|
33
33
|
* @template In - The input type that the permission check will receive
|
|
34
34
|
* @template RequiredServices - The services required for this permission check
|
|
35
35
|
*/
|
|
36
|
-
export type
|
|
36
|
+
export type PikkuPermission<In = unknown, RequiredServices extends ${singletonServicesTypeName} = ${singletonServicesTypeName}> = CorePikkuPermission<In, RequiredServices, ${userSessionTypeName}>
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Type-safe middleware definition that can access your application's services and session.
|
|
40
|
-
* Use this to define reusable middleware that can be applied to multiple
|
|
40
|
+
* Use this to define reusable middleware that can be applied to multiple HTTP wirings.
|
|
41
41
|
*
|
|
42
42
|
* @template RequiredServices - The services required for this middleware
|
|
43
43
|
*/
|
|
@@ -53,7 +53,7 @@ export type APIMiddleware<RequiredServices extends ${singletonServicesTypeName}
|
|
|
53
53
|
* @template MCPData - MCP data type (null = optional MCP)
|
|
54
54
|
* @template RequiredServices - Services required by this function
|
|
55
55
|
*/
|
|
56
|
-
type
|
|
56
|
+
type PikkuFunctionSessionless<
|
|
57
57
|
In = unknown,
|
|
58
58
|
Out = never,
|
|
59
59
|
ChannelData = null, // null means optional channel
|
|
@@ -67,7 +67,7 @@ type APIFunctionSessionless<
|
|
|
67
67
|
? { mcp?: PikkuMCP } // Optional MCP
|
|
68
68
|
: { mcp: PikkuMCP } // Required MCP
|
|
69
69
|
)
|
|
70
|
-
> =
|
|
70
|
+
> = CorePikkuFunctionSessionless<In, Out, ChannelData, RequiredServices, ${userSessionTypeName}>
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* A session-aware API function that requires user authentication.
|
|
@@ -79,7 +79,7 @@ type APIFunctionSessionless<
|
|
|
79
79
|
* @template MCPData - MCP data type (null = optional MCP)
|
|
80
80
|
* @template RequiredServices - Services required by this function
|
|
81
81
|
*/
|
|
82
|
-
type
|
|
82
|
+
type PikkuFunction<
|
|
83
83
|
In = unknown,
|
|
84
84
|
Out = never,
|
|
85
85
|
ChannelData = null, // null means optional channel
|
|
@@ -93,17 +93,17 @@ type APIFunction<
|
|
|
93
93
|
? { mcp?: PikkuMCP } // Optional MCP
|
|
94
94
|
: { mcp: PikkuMCP } // Required MCP
|
|
95
95
|
)
|
|
96
|
-
> =
|
|
96
|
+
> = CorePikkuFunction<In, Out, ChannelData, RequiredServices, ${userSessionTypeName}>
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
|
-
* Type definition for HTTP API
|
|
99
|
+
* Type definition for HTTP API wirings with type-safe path parameters.
|
|
100
100
|
* Supports both authenticated and unauthenticated functions.
|
|
101
101
|
*
|
|
102
|
-
* @template In - Input type for the
|
|
103
|
-
* @template Out - Output type for the
|
|
104
|
-
* @template Route - String literal type for the
|
|
102
|
+
* @template In - Input type for the HTTP wiring
|
|
103
|
+
* @template Out - Output type for the HTTP wiring
|
|
104
|
+
* @template Route - String literal type for the HTTP path (e.g., "/users/:id")
|
|
105
105
|
*/
|
|
106
|
-
type
|
|
106
|
+
type HTTPWiring<In, Out, Route extends string> = CoreHTTPFunctionWiring<In, Out, Route, PikkuFunction<In, Out>, PikkuFunctionSessionless<In, Out>, PikkuPermission<In>, APIMiddleware>
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* Type definition for WebSocket channels with typed data exchange.
|
|
@@ -112,13 +112,13 @@ type APIRoute<In, Out, Route extends string> = CoreHTTPFunctionRoute<In, Out, Ro
|
|
|
112
112
|
* @template ChannelData - Type of data exchanged through the channel
|
|
113
113
|
* @template Channel - String literal type for the channel name
|
|
114
114
|
*/
|
|
115
|
-
type
|
|
115
|
+
type ChannelWiring<ChannelData, Channel extends string> = CoreChannel<ChannelData, Channel, PikkuFunction<void, unknown> | PikkuFunction<void, unknown, ChannelData>, PikkuFunction<void, void> | PikkuFunction<void, void, ChannelData>, PikkuFunction<any, any> | PikkuFunction<any, any, ChannelData>, PikkuPermission>
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
* Type definition for scheduled tasks that run at specified intervals.
|
|
119
119
|
* These are sessionless functions that execute based on cron expressions.
|
|
120
120
|
*/
|
|
121
|
-
type
|
|
121
|
+
type SchedulerWiring = CoreScheduledTask<PikkuFunctionSessionless<void, void>>
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* Type definition for queue workers that process background jobs.
|
|
@@ -126,28 +126,28 @@ type ScheduledTask = CoreScheduledTask<APIFunctionSessionless<void, void>>
|
|
|
126
126
|
* @template In - Input type for the queue job
|
|
127
127
|
* @template Out - Output type for the queue job
|
|
128
128
|
*/
|
|
129
|
-
type
|
|
129
|
+
type QueueWiring<In, Out> = CoreQueueWorker<PikkuFunctionSessionless<In, Out>>
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
132
|
* Type definition for MCP resources that provide data to AI models.
|
|
133
133
|
*
|
|
134
134
|
* @template In - Input type for the resource request
|
|
135
135
|
*/
|
|
136
|
-
type
|
|
136
|
+
type MCPResourceWiring<In> = CoreMCPResource<PikkuFunctionSessionless<In, MCPResourceResponse, null, true>>
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
139
|
* Type definition for MCP tools that AI models can invoke.
|
|
140
140
|
*
|
|
141
141
|
* @template In - Input type for the tool invocation
|
|
142
142
|
*/
|
|
143
|
-
type
|
|
143
|
+
type MCPToolWiring<In> = CoreMCPTool<PikkuFunctionSessionless<In, MCPToolResponse, null, true>>
|
|
144
144
|
|
|
145
145
|
/**
|
|
146
146
|
* Type definition for MCP prompts that provide templates to AI models.
|
|
147
147
|
*
|
|
148
148
|
* @template In - Input type for the prompt parameters
|
|
149
149
|
*/
|
|
150
|
-
type
|
|
150
|
+
type MCPPromptWiring<In> = CoreMCPPrompt<PikkuFunctionSessionless<In, MCPPromptResponse, null, true>>
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
153
|
* Creates a Pikku function that can be either session-aware or sessionless.
|
|
@@ -172,14 +172,14 @@ type MCPPrompt<In> = CoreMCPPrompt<APIFunctionSessionless<In, MCPPromptResponse,
|
|
|
172
172
|
*/
|
|
173
173
|
export const pikkuFunc = <In, Out = unknown>(
|
|
174
174
|
func:
|
|
175
|
-
|
|
|
175
|
+
| PikkuFunction<In, Out>
|
|
176
176
|
| {
|
|
177
|
-
func:
|
|
177
|
+
func: PikkuFunction<In, Out>
|
|
178
178
|
auth?: true
|
|
179
179
|
name?: string
|
|
180
180
|
}
|
|
181
181
|
| {
|
|
182
|
-
func:
|
|
182
|
+
func: PikkuFunctionSessionless<In, Out>
|
|
183
183
|
auth: false
|
|
184
184
|
name?: string
|
|
185
185
|
}
|
|
@@ -209,9 +209,9 @@ export const pikkuFunc = <In, Out = unknown>(
|
|
|
209
209
|
*/
|
|
210
210
|
export const pikkuSessionlessFunc = <In, Out = unknown>(
|
|
211
211
|
func:
|
|
212
|
-
|
|
|
212
|
+
| PikkuFunctionSessionless<In, Out>
|
|
213
213
|
| {
|
|
214
|
-
func:
|
|
214
|
+
func: PikkuFunctionSessionless<In, Out>
|
|
215
215
|
name?: string
|
|
216
216
|
}
|
|
217
217
|
) => {
|
|
@@ -240,9 +240,9 @@ export const pikkuSessionlessFunc = <In, Out = unknown>(
|
|
|
240
240
|
*/
|
|
241
241
|
export const pikkuChannelConnectionFunc = <Out = unknown, ChannelData = unknown>(
|
|
242
242
|
func:
|
|
243
|
-
|
|
|
243
|
+
| PikkuFunctionSessionless<void, Out, ChannelData>
|
|
244
244
|
| {
|
|
245
|
-
func:
|
|
245
|
+
func: PikkuFunctionSessionless<void, Out, ChannelData>
|
|
246
246
|
name?: string
|
|
247
247
|
}
|
|
248
248
|
) => {
|
|
@@ -269,9 +269,9 @@ export const pikkuChannelConnectionFunc = <Out = unknown, ChannelData = unknown>
|
|
|
269
269
|
*/
|
|
270
270
|
export const pikkuChannelDisconnectionFunc = <ChannelData = unknown>(
|
|
271
271
|
func:
|
|
272
|
-
|
|
|
272
|
+
| PikkuFunctionSessionless<void, void, ChannelData>
|
|
273
273
|
| {
|
|
274
|
-
func:
|
|
274
|
+
func: PikkuFunction<void, void, ChannelData>
|
|
275
275
|
name?: string
|
|
276
276
|
}
|
|
277
277
|
) => {
|
|
@@ -299,9 +299,9 @@ export const pikkuChannelDisconnectionFunc = <ChannelData = unknown>(
|
|
|
299
299
|
*/
|
|
300
300
|
export const pikkuChannelFunc = <In = unknown, Out = unknown, ChannelData = unknown>(
|
|
301
301
|
func:
|
|
302
|
-
|
|
|
302
|
+
| PikkuFunctionSessionless<In, Out, ChannelData>
|
|
303
303
|
| {
|
|
304
|
-
func:
|
|
304
|
+
func: PikkuFunctionSessionless<In, Out, ChannelData>
|
|
305
305
|
name?: string
|
|
306
306
|
}
|
|
307
307
|
) => {
|
|
@@ -326,9 +326,9 @@ export const pikkuChannelFunc = <In = unknown, Out = unknown, ChannelData = unkn
|
|
|
326
326
|
*/
|
|
327
327
|
export const pikkuVoidFunc = (
|
|
328
328
|
func:
|
|
329
|
-
|
|
|
329
|
+
| PikkuFunctionSessionless<void, void>
|
|
330
330
|
| {
|
|
331
|
-
func:
|
|
331
|
+
func: PikkuFunctionSessionless<void, void>
|
|
332
332
|
name?: string
|
|
333
333
|
}
|
|
334
334
|
) => {
|
|
@@ -342,24 +342,24 @@ export const pikkuVoidFunc = (
|
|
|
342
342
|
* @template Channel - String literal type for the channel name
|
|
343
343
|
* @param channel - Channel definition with connection, disconnection, and message handlers
|
|
344
344
|
*/
|
|
345
|
-
export const
|
|
346
|
-
channel:
|
|
345
|
+
export const wireChannel = <ChannelData, Channel extends string>(
|
|
346
|
+
channel: ChannelWiring<ChannelData, Channel> & AssertHTTPWiringParams<ChannelData, Channel>
|
|
347
347
|
) => {
|
|
348
|
-
|
|
348
|
+
wireChannelCore(channel as any) // TODO
|
|
349
349
|
}
|
|
350
350
|
|
|
351
351
|
/**
|
|
352
|
-
* Registers an HTTP
|
|
352
|
+
* Registers an HTTP wiring with the Pikku framework.
|
|
353
353
|
*
|
|
354
|
-
* @template In - Input type for the
|
|
355
|
-
* @template Out - Output type for the
|
|
356
|
-
* @template Route - String literal type for the
|
|
357
|
-
* @param
|
|
354
|
+
* @template In - Input type for the HTTP wiring
|
|
355
|
+
* @template Out - Output type for the HTTP wiring
|
|
356
|
+
* @template Route - String literal type for the HTTP path (e.g., "/users/:id")
|
|
357
|
+
* @param httpWiring - HTTP wiring definition with handler, method, and optional middleware
|
|
358
358
|
*/
|
|
359
|
-
export const
|
|
360
|
-
|
|
359
|
+
export const wireHTTP = <In, Out, Route extends string>(
|
|
360
|
+
httpWiring: HTTPWiring<In, Out, Route> & AssertHTTPWiringParams<In, Route>
|
|
361
361
|
) => {
|
|
362
|
-
|
|
362
|
+
wireHTTPCore(httpWiring)
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
/**
|
|
@@ -368,8 +368,8 @@ export const addHTTPRoute = <In, Out, Route extends string>(
|
|
|
368
368
|
*
|
|
369
369
|
* @param task - Scheduled task definition with cron expression and handler
|
|
370
370
|
*/
|
|
371
|
-
export const
|
|
372
|
-
|
|
371
|
+
export const wireScheduler = (task: SchedulerWiring) => {
|
|
372
|
+
wireSchedulerCore(task as any) // TODO
|
|
373
373
|
}
|
|
374
374
|
|
|
375
375
|
/**
|
|
@@ -378,8 +378,8 @@ export const addScheduledTask = (task: ScheduledTask) => {
|
|
|
378
378
|
*
|
|
379
379
|
* @param queueWorker - Queue worker definition with job handler
|
|
380
380
|
*/
|
|
381
|
-
export const
|
|
382
|
-
|
|
381
|
+
export const wireQueueWorker = (queueWorker: QueueWiring<any, any>) => {
|
|
382
|
+
wireQueueWorkerCore(queueWorker as any) // TODO
|
|
383
383
|
}
|
|
384
384
|
|
|
385
385
|
/**
|
|
@@ -389,10 +389,10 @@ export const addQueueWorker = (queueWorker: QueueWorker<any, any>) => {
|
|
|
389
389
|
* @template In - Input type for the resource request
|
|
390
390
|
* @param mcpResource - MCP resource definition with data provider function
|
|
391
391
|
*/
|
|
392
|
-
export const
|
|
393
|
-
mcpResource:
|
|
392
|
+
export const wireMCPResource = <In>(
|
|
393
|
+
mcpResource: MCPResourceWiring<In>
|
|
394
394
|
) => {
|
|
395
|
-
|
|
395
|
+
wireMCPResourceCore(mcpResource as any)
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
/**
|
|
@@ -402,10 +402,10 @@ export const addMCPResource = <In>(
|
|
|
402
402
|
* @template In - Input type for the tool invocation
|
|
403
403
|
* @param mcpTool - MCP tool definition with action function
|
|
404
404
|
*/
|
|
405
|
-
export const
|
|
406
|
-
mcpTool:
|
|
405
|
+
export const wireMCPTool = <In>(
|
|
406
|
+
mcpTool: MCPToolWiring<In>
|
|
407
407
|
) => {
|
|
408
|
-
|
|
408
|
+
wireMCPToolCore(mcpTool as any)
|
|
409
409
|
}
|
|
410
410
|
|
|
411
411
|
/**
|
|
@@ -415,10 +415,10 @@ export const addMCPTool = <In>(
|
|
|
415
415
|
* @template In - Input type for the prompt parameters
|
|
416
416
|
* @param mcpPrompt - MCP prompt definition with template function
|
|
417
417
|
*/
|
|
418
|
-
export const
|
|
419
|
-
mcpPrompt:
|
|
418
|
+
export const wireMCPPrompt = <In>(
|
|
419
|
+
mcpPrompt: MCPPromptWiring<In>
|
|
420
420
|
) => {
|
|
421
|
-
|
|
421
|
+
wireMCPPromptCore(mcpPrompt as any)
|
|
422
422
|
}
|
|
423
423
|
|
|
424
424
|
/**
|
|
@@ -446,9 +446,9 @@ export const addMCPPrompt = <In>(
|
|
|
446
446
|
*/
|
|
447
447
|
export const pikkuMCPPromptFunc = <In>(
|
|
448
448
|
func:
|
|
449
|
-
|
|
|
449
|
+
| PikkuFunctionSessionless<In, MCPPromptResponse>
|
|
450
450
|
| {
|
|
451
|
-
func:
|
|
451
|
+
func: PikkuFunctionSessionless<In, MCPPromptResponse>
|
|
452
452
|
name?: string
|
|
453
453
|
}
|
|
454
454
|
) => {
|
|
@@ -478,9 +478,9 @@ export const pikkuMCPPromptFunc = <In>(
|
|
|
478
478
|
*/
|
|
479
479
|
export const pikkuMCPToolFunc = <In>(
|
|
480
480
|
func:
|
|
481
|
-
|
|
|
481
|
+
| PikkuFunctionSessionless<In, MCPToolResponse, null, true>
|
|
482
482
|
| {
|
|
483
|
-
func:
|
|
483
|
+
func: PikkuFunctionSessionless<In, MCPToolResponse, null, true>
|
|
484
484
|
name?: string
|
|
485
485
|
}
|
|
486
486
|
) => {
|
|
@@ -511,9 +511,9 @@ export const pikkuMCPToolFunc = <In>(
|
|
|
511
511
|
*/
|
|
512
512
|
export const pikkuMCPResourceFunc = <In>(
|
|
513
513
|
func:
|
|
514
|
-
|
|
|
514
|
+
| PikkuFunctionSessionless<In, MCPResourceResponse, null, true>
|
|
515
515
|
| {
|
|
516
|
-
func:
|
|
516
|
+
func: PikkuFunctionSessionless<In, MCPResourceResponse, null, true>
|
|
517
517
|
name?: string
|
|
518
518
|
}
|
|
519
519
|
) => {
|
package/src/utils.test.ts
CHANGED
|
@@ -134,4 +134,42 @@ describe('getFileImportRelativePath', () => {
|
|
|
134
134
|
|
|
135
135
|
assert.strictEqual(result, './file2.tsx'.replace('.ts', '.js'))
|
|
136
136
|
})
|
|
137
|
+
|
|
138
|
+
test('should strip everything before and including node_modules/', () => {
|
|
139
|
+
const from =
|
|
140
|
+
'/project/packages/functions/.pikku/http/pikku-http-routes-map.gen.d.ts'
|
|
141
|
+
const to =
|
|
142
|
+
'/project/packages/functions/../../../../node_modules/@pikku/core/dist/types/core.types.d.ts'
|
|
143
|
+
const packageMappings = {}
|
|
144
|
+
|
|
145
|
+
const result = getFileImportRelativePath(from, to, packageMappings)
|
|
146
|
+
|
|
147
|
+
assert.strictEqual(result, '@pikku/core/dist/types/core.types.d.js')
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
test('should handle node_modules path with package mappings', () => {
|
|
151
|
+
const from = '/project/packages/app/src/file1.ts'
|
|
152
|
+
const to = '/project/packages/app/node_modules/@myorg/utils/dist/utils.d.ts'
|
|
153
|
+
const packageMappings = {
|
|
154
|
+
'packages/app': '@myorg/app',
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const result = getFileImportRelativePath(from, to, packageMappings)
|
|
158
|
+
|
|
159
|
+
assert.strictEqual(result, '@myorg/utils/dist/utils.d.js')
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
test('should handle deeply nested node_modules paths', () => {
|
|
163
|
+
const from =
|
|
164
|
+
'/Users/user/project/workspace-starter/packages/functions/.pikku/http/pikku-http-routes-map.gen.d.ts'
|
|
165
|
+
const to =
|
|
166
|
+
'/Users/user/project/workspace-starter/packages/functions/../../../../node_modules/@pikku/core/dist/types/core.types.d.ts'
|
|
167
|
+
const packageMappings = {
|
|
168
|
+
'packages/functions': '@workspace/functions',
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const result = getFileImportRelativePath(from, to, packageMappings)
|
|
172
|
+
|
|
173
|
+
assert.strictEqual(result, '@pikku/core/dist/types/core.types.d.js')
|
|
174
|
+
})
|
|
137
175
|
})
|
package/src/utils.ts
CHANGED
|
@@ -63,6 +63,15 @@ export const getFileImportRelativePath = (
|
|
|
63
63
|
filePath = `./${filePath}`
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
// If the path includes node_modules, strip everything before and including node_modules/
|
|
67
|
+
if (filePath.includes('node_modules')) {
|
|
68
|
+
const nodeModulesIndex = filePath.indexOf('node_modules/')
|
|
69
|
+
if (nodeModulesIndex !== -1) {
|
|
70
|
+
filePath = filePath.substring(nodeModulesIndex + 'node_modules/'.length)
|
|
71
|
+
}
|
|
72
|
+
return filePath.replace('.ts', '.js')
|
|
73
|
+
}
|
|
74
|
+
|
|
66
75
|
const absolutePath = resolve(dirname(from), to)
|
|
67
76
|
const fromAbsolutePath = resolve(dirname(from))
|
|
68
77
|
|
|
@@ -18,21 +18,22 @@ export const pikkuChannels: PikkuCommand = async (
|
|
|
18
18
|
'Found channels',
|
|
19
19
|
[visitState.channels.files.size === 0],
|
|
20
20
|
async () => {
|
|
21
|
-
const {
|
|
21
|
+
const { channelsWiringFile, channelsWiringMetaFile, packageMappings } =
|
|
22
|
+
cliConfig
|
|
22
23
|
const { channels } = visitState
|
|
23
24
|
await writeFileInDir(
|
|
24
25
|
logger,
|
|
25
|
-
|
|
26
|
+
channelsWiringFile,
|
|
26
27
|
serializeFileImports(
|
|
27
28
|
'addChannel',
|
|
28
|
-
|
|
29
|
+
channelsWiringFile,
|
|
29
30
|
channels.files,
|
|
30
31
|
packageMappings
|
|
31
32
|
)
|
|
32
33
|
)
|
|
33
34
|
await writeFileInDir(
|
|
34
35
|
logger,
|
|
35
|
-
|
|
36
|
+
channelsWiringMetaFile,
|
|
36
37
|
`import { pikkuState } from '@pikku/core'\npikkuState('channel', 'meta', ${JSON.stringify(channels.meta, null, 2)})`
|
|
37
38
|
)
|
|
38
39
|
}
|
|
@@ -16,21 +16,22 @@ export const pikkuChannels: PikkuCommand = async (
|
|
|
16
16
|
'Found channels',
|
|
17
17
|
[visitState.channels.files.size === 0],
|
|
18
18
|
async () => {
|
|
19
|
-
const {
|
|
19
|
+
const { channelsWiringFile, channelsWiringMetaFile, packageMappings } =
|
|
20
|
+
cliConfig
|
|
20
21
|
const { channels } = visitState
|
|
21
22
|
await writeFileInDir(
|
|
22
23
|
logger,
|
|
23
|
-
|
|
24
|
+
channelsWiringFile,
|
|
24
25
|
serializeFileImports(
|
|
25
26
|
'addChannel',
|
|
26
|
-
|
|
27
|
+
channelsWiringFile,
|
|
27
28
|
channels.files,
|
|
28
29
|
packageMappings
|
|
29
30
|
)
|
|
30
31
|
)
|
|
31
32
|
await writeFileInDir(
|
|
32
33
|
logger,
|
|
33
|
-
|
|
34
|
+
channelsWiringMetaFile,
|
|
34
35
|
`import { pikkuState } from '@pikku/core'\npikkuState('channel', 'meta', ${JSON.stringify(channels.meta, null, 2)})`
|
|
35
36
|
)
|
|
36
37
|
}
|
|
@@ -46,7 +46,7 @@ export type ChannelDefaultHandlerOf<Channel extends keyof ChannelsMap> =
|
|
|
46
46
|
? ChannelHandler<I, O>
|
|
47
47
|
: never;
|
|
48
48
|
|
|
49
|
-
export type
|
|
49
|
+
export type ChannelWiringHandlerOf<
|
|
50
50
|
Channel extends keyof ChannelsMap,
|
|
51
51
|
Route extends keyof ChannelsMap[Channel]['routes'],
|
|
52
52
|
Method extends keyof ChannelsMap[Channel]['routes'][Route],
|
|
@@ -80,7 +80,7 @@ function generateChannels(
|
|
|
80
80
|
> = {}
|
|
81
81
|
|
|
82
82
|
for (const meta of Object.values(channelsMeta)) {
|
|
83
|
-
const { name,
|
|
83
|
+
const { name, messageWirings, message } = meta
|
|
84
84
|
|
|
85
85
|
if (!channelsObject[name]) {
|
|
86
86
|
channelsObject[name] = { message: null, routes: {} }
|
|
@@ -103,7 +103,7 @@ function generateChannels(
|
|
|
103
103
|
outputTypes?.forEach((type) => requiredTypes.add(type))
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
for (const [key, route] of Object.entries(
|
|
106
|
+
for (const [key, route] of Object.entries(messageWirings)) {
|
|
107
107
|
if (!channelsObject[name].routes[key]) {
|
|
108
108
|
channelsObject[name].routes[key] = {}
|
|
109
109
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export const serializeWebsocketWrapper = (channelsMapPath: string) => {
|
|
2
2
|
return `import { CorePikkuWebsocket, CorePikkuRouteHandler } from '@pikku/websocket'
|
|
3
|
-
import { ChannelDefaultHandlerOf,
|
|
3
|
+
import { ChannelDefaultHandlerOf, ChannelWiringHandlerOf, ChannelsMap } from '${channelsMapPath}';
|
|
4
4
|
|
|
5
5
|
class PikkuWebSocketRoute<Channel extends keyof ChannelsMap, Route extends keyof ChannelsMap[Channel]['routes']> extends CorePikkuRouteHandler {
|
|
6
6
|
public subscribe<
|
|
7
7
|
Method extends keyof ChannelsMap[Channel]['routes'][Route],
|
|
8
|
-
Data extends
|
|
8
|
+
Data extends ChannelWiringHandlerOf<Channel, Route, Method>['output']
|
|
9
9
|
>(method: Method, callback: (data: Data) => void
|
|
10
10
|
) {
|
|
11
11
|
super.subscribe(method.toString(), callback)
|
|
@@ -13,20 +13,20 @@ class PikkuWebSocketRoute<Channel extends keyof ChannelsMap, Route extends keyof
|
|
|
13
13
|
|
|
14
14
|
public unsubscribe<
|
|
15
15
|
Method extends keyof ChannelsMap[Channel]['routes'][Route],
|
|
16
|
-
Data extends
|
|
16
|
+
Data extends ChannelWiringHandlerOf<Channel, Route, Method>['output']
|
|
17
17
|
>(method: Method, callback?: (data: Data) => void) {
|
|
18
18
|
super.unsubscribe(method.toString(), callback)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
public send<
|
|
22
22
|
Method extends keyof ChannelsMap[Channel]['routes'][Route],
|
|
23
|
-
Data extends
|
|
23
|
+
Data extends ChannelWiringHandlerOf<Channel, Route, Method>['input']
|
|
24
24
|
>(method: Method, data: Data) {
|
|
25
25
|
super.send(method.toString(), data)
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export class PikkuWebSocket<Channel extends keyof ChannelsMap> extends CorePikkuWebsocket {
|
|
29
|
+
export class PikkuWebSocket<Channel extends keyof ChannelsMap, EventHubTopics extends Record<string, any> = {}> extends CorePikkuWebsocket {
|
|
30
30
|
/**
|
|
31
31
|
* Send a message to a specific route and method.
|
|
32
32
|
* Validates the input data type.
|
|
@@ -56,6 +56,20 @@ export class PikkuWebSocket<Channel extends keyof ChannelsMap> extends CorePikku
|
|
|
56
56
|
public send(data: ChannelDefaultHandlerOf<Channel>['input']) {
|
|
57
57
|
super.send(data)
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Subscribe to a topic from the EventHub system with strong typing.
|
|
62
|
+
*/
|
|
63
|
+
public subscribeToEventHub<Topic extends keyof EventHubTopics>(
|
|
64
|
+
topic: Topic,
|
|
65
|
+
callback: (data: EventHubTopics[Topic]) => void
|
|
66
|
+
) {
|
|
67
|
+
super.subscribe((data) => {
|
|
68
|
+
if (data.topic === topic) {
|
|
69
|
+
callback(data as EventHubTopics[Topic])
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
}
|
|
59
73
|
}
|
|
60
74
|
`
|
|
61
75
|
}
|
|
@@ -8,7 +8,7 @@ import { PikkuCommandWithoutState } from '../../types.js'
|
|
|
8
8
|
|
|
9
9
|
export const pikkuFetch: PikkuCommandWithoutState = async (
|
|
10
10
|
logger,
|
|
11
|
-
{ fetchFile,
|
|
11
|
+
{ fetchFile, httpMapDeclarationFile, packageMappings }
|
|
12
12
|
) => {
|
|
13
13
|
return await logCommandInfoAndTime(
|
|
14
14
|
logger,
|
|
@@ -22,7 +22,7 @@ export const pikkuFetch: PikkuCommandWithoutState = async (
|
|
|
22
22
|
|
|
23
23
|
const routesMapDeclarationPath = getFileImportRelativePath(
|
|
24
24
|
fetchFile,
|
|
25
|
-
|
|
25
|
+
httpMapDeclarationFile,
|
|
26
26
|
packageMappings
|
|
27
27
|
)
|
|
28
28
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FunctionsMeta,
|
|
1
|
+
import { FunctionsMeta, HTTPWiringsMeta, pikkuState } from '@pikku/core'
|
|
2
2
|
import _convertSchema from '@openapi-contrib/json-schema-to-openapi-schema'
|
|
3
3
|
const convertSchema =
|
|
4
4
|
'default' in _convertSchema ? (_convertSchema.default as any) : _convertSchema
|
|
@@ -76,7 +76,7 @@ const getErrorResponseForConstructorName = (constructorName: string) => {
|
|
|
76
76
|
|
|
77
77
|
const convertSchemasToBodyPayloads = async (
|
|
78
78
|
functionsMeta: FunctionsMeta,
|
|
79
|
-
routesMeta:
|
|
79
|
+
routesMeta: HTTPWiringsMeta,
|
|
80
80
|
schemas: Record<string, any>
|
|
81
81
|
) => {
|
|
82
82
|
const requiredSchemas = new Set(
|
|
@@ -105,7 +105,7 @@ const convertSchemasToBodyPayloads = async (
|
|
|
105
105
|
|
|
106
106
|
export async function generateOpenAPISpec(
|
|
107
107
|
functionsMeta: FunctionsMeta,
|
|
108
|
-
routeMeta:
|
|
108
|
+
routeMeta: HTTPWiringsMeta,
|
|
109
109
|
schemas: Record<string, any>,
|
|
110
110
|
additionalInfo: OpenAPISpecInfo
|
|
111
111
|
): Promise<OpenAPISpec> {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { logCommandInfoAndTime, writeFileInDir } from '../../utils.js'
|
|
2
|
-
import {
|
|
2
|
+
import { serializeTypedHTTPWiringsMap } from './serialize-typed-http-map.js'
|
|
3
3
|
import { PikkuCommand } from '../../types.js'
|
|
4
4
|
|
|
5
5
|
export const pikkuHTTPMap: PikkuCommand = async (
|
|
6
6
|
logger,
|
|
7
|
-
{
|
|
7
|
+
{ httpMapDeclarationFile, packageMappings },
|
|
8
8
|
{ http, functions }
|
|
9
9
|
) => {
|
|
10
10
|
return await logCommandInfoAndTime(
|
|
@@ -13,15 +13,15 @@ export const pikkuHTTPMap: PikkuCommand = async (
|
|
|
13
13
|
'Created HTTP map',
|
|
14
14
|
[http.files.size === 0],
|
|
15
15
|
async () => {
|
|
16
|
-
const content =
|
|
17
|
-
|
|
16
|
+
const content = serializeTypedHTTPWiringsMap(
|
|
17
|
+
httpMapDeclarationFile,
|
|
18
18
|
packageMappings,
|
|
19
19
|
functions.typesMap,
|
|
20
20
|
functions.meta,
|
|
21
21
|
http.meta,
|
|
22
22
|
http.metaInputTypes
|
|
23
23
|
)
|
|
24
|
-
await writeFileInDir(logger,
|
|
24
|
+
await writeFileInDir(logger, httpMapDeclarationFile, content)
|
|
25
25
|
}
|
|
26
26
|
)
|
|
27
27
|
}
|
|
@@ -18,21 +18,21 @@ export const pikkuHTTP: PikkuCommand = async (
|
|
|
18
18
|
'Found HTTP routes',
|
|
19
19
|
[visitState.http.files.size === 0],
|
|
20
20
|
async () => {
|
|
21
|
-
const {
|
|
21
|
+
const { httpWiringsFile, httpWiringMetaFile, packageMappings } = cliConfig
|
|
22
22
|
const { http } = visitState
|
|
23
23
|
await writeFileInDir(
|
|
24
24
|
logger,
|
|
25
|
-
|
|
25
|
+
httpWiringsFile,
|
|
26
26
|
serializeFileImports(
|
|
27
|
-
'
|
|
28
|
-
|
|
27
|
+
'wireHTTP',
|
|
28
|
+
httpWiringsFile,
|
|
29
29
|
http.files,
|
|
30
30
|
packageMappings
|
|
31
31
|
)
|
|
32
32
|
)
|
|
33
33
|
await writeFileInDir(
|
|
34
34
|
logger,
|
|
35
|
-
|
|
35
|
+
httpWiringMetaFile,
|
|
36
36
|
`import { pikkuState } from '@pikku/core'\npikkuState('http', 'meta', ${JSON.stringify(http.meta, null, 2)})`
|
|
37
37
|
)
|
|
38
38
|
}
|