@pikku/cli 0.8.3 → 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 +6 -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/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/{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
|
@@ -6,7 +6,7 @@ export const serializeNextJsBackendWrapper = (httpBootstrapPath, routesMapPath,
|
|
|
6
6
|
* It ensures type safety for route handling methods when integrating with the @pikku/core framework.
|
|
7
7
|
*/
|
|
8
8
|
import { PikkuNextJS } from '@pikku/next'
|
|
9
|
-
import type {
|
|
9
|
+
import type { HTTPWiringsMap, HTTPWiringHandlerOf, HTTPWiringsWithMethod } from '${routesMapPath}'
|
|
10
10
|
|
|
11
11
|
${configImport}
|
|
12
12
|
${singleServicesFactoryImport}
|
|
@@ -34,7 +34,7 @@ export const pikku = (_options?: any) => {
|
|
|
34
34
|
* Makes a dynamic action request for a specified route and method.
|
|
35
35
|
* Dynamic requests may access headers and cookies and are therefore unsuitable for precompile stages.
|
|
36
36
|
*
|
|
37
|
-
* @template Route - The route key from the
|
|
37
|
+
* @template Route - The route key from the HTTPWiringsMap.
|
|
38
38
|
* @template Method - The method key from the specified route.
|
|
39
39
|
* @param route - The route identifier.
|
|
40
40
|
* @param method - The HTTP method to be used for the request.
|
|
@@ -42,13 +42,13 @@ export const pikku = (_options?: any) => {
|
|
|
42
42
|
* @returns A promise that resolves to the output of the route handler.
|
|
43
43
|
*/
|
|
44
44
|
const dynamicActionRequest = async <
|
|
45
|
-
Route extends keyof
|
|
46
|
-
Method extends keyof
|
|
45
|
+
Route extends keyof HTTPWiringsMap,
|
|
46
|
+
Method extends keyof HTTPWiringsMap[Route]
|
|
47
47
|
>(
|
|
48
48
|
route: Route,
|
|
49
49
|
method: Method,
|
|
50
|
-
data:
|
|
51
|
-
): Promise<
|
|
50
|
+
data: HTTPWiringHandlerOf<Route, Method>['input'] = null
|
|
51
|
+
): Promise<HTTPWiringHandlerOf<Route, Method>['output']> => {
|
|
52
52
|
return _pikku!.actionRequest(route, method, data as any)
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -56,7 +56,7 @@ export const pikku = (_options?: any) => {
|
|
|
56
56
|
* Makes a static action request for a specified route and method.
|
|
57
57
|
* Static requests do not depend on headers or cookies and are suitable for precompile stages.
|
|
58
58
|
*
|
|
59
|
-
* @template Route - The route key from the
|
|
59
|
+
* @template Route - The route key from the HTTPWiringsMap.
|
|
60
60
|
* @template Method - The method key from the specified route.
|
|
61
61
|
* @param route - The route identifier.
|
|
62
62
|
* @param method - The HTTP method to be used for the request.
|
|
@@ -64,13 +64,13 @@ export const pikku = (_options?: any) => {
|
|
|
64
64
|
* @returns A promise that resolves to the output of the route handler.
|
|
65
65
|
*/
|
|
66
66
|
const staticActionRequest = async <
|
|
67
|
-
Route extends keyof
|
|
68
|
-
Method extends keyof
|
|
67
|
+
Route extends keyof HTTPWiringsMap,
|
|
68
|
+
Method extends keyof HTTPWiringsMap[Route]
|
|
69
69
|
>(
|
|
70
70
|
route: Route,
|
|
71
71
|
method: Method,
|
|
72
|
-
data:
|
|
73
|
-
): Promise<
|
|
72
|
+
data: HTTPWiringHandlerOf<Route, Method>['input'] = null
|
|
73
|
+
): Promise<HTTPWiringHandlerOf<Route, Method>['output']> => {
|
|
74
74
|
return _pikku!.staticActionRequest(route, method, data as any)
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -82,10 +82,10 @@ export const pikku = (_options?: any) => {
|
|
|
82
82
|
* @param data - The input data for the POST request, defaults to null.
|
|
83
83
|
* @returns A promise that resolves to the output of the POST handler.
|
|
84
84
|
*/
|
|
85
|
-
const dynamicPost = <Route extends
|
|
85
|
+
const dynamicPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
|
|
86
86
|
route: Route,
|
|
87
|
-
data:
|
|
88
|
-
): Promise<
|
|
87
|
+
data: HTTPWiringHandlerOf<Route, 'POST'>['input'] = null
|
|
88
|
+
): Promise<HTTPWiringHandlerOf<Route, 'POST'>['output']> => {
|
|
89
89
|
return dynamicActionRequest(route, 'POST', data)
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -97,10 +97,10 @@ export const pikku = (_options?: any) => {
|
|
|
97
97
|
* @param data - The input data for the GET request, defaults to null.
|
|
98
98
|
* @returns A promise that resolves to the output of the GET handler.
|
|
99
99
|
*/
|
|
100
|
-
const dynamicGet = <Route extends
|
|
100
|
+
const dynamicGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
|
|
101
101
|
route: Route,
|
|
102
|
-
data:
|
|
103
|
-
): Promise<
|
|
102
|
+
data: HTTPWiringHandlerOf<Route, 'GET'>['input'] = null
|
|
103
|
+
): Promise<HTTPWiringHandlerOf<Route, 'GET'>['output']> => {
|
|
104
104
|
return dynamicActionRequest(route, 'GET', data)
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -112,10 +112,10 @@ export const pikku = (_options?: any) => {
|
|
|
112
112
|
* @param data - The input data for the PATCH request, defaults to null.
|
|
113
113
|
* @returns A promise that resolves to the output of the PATCH handler.
|
|
114
114
|
*/
|
|
115
|
-
const dynamicPatch = <Route extends
|
|
115
|
+
const dynamicPatch = <Route extends HTTPWiringsWithMethod<'PATCH'>>(
|
|
116
116
|
route: Route,
|
|
117
|
-
data:
|
|
118
|
-
): Promise<
|
|
117
|
+
data: HTTPWiringHandlerOf<Route, 'PATCH'>['input'] = null
|
|
118
|
+
): Promise<HTTPWiringHandlerOf<Route, 'PATCH'>['output']> => {
|
|
119
119
|
return dynamicActionRequest(route, 'PATCH', data)
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -127,10 +127,10 @@ export const pikku = (_options?: any) => {
|
|
|
127
127
|
* @param data - The input data for the DELETE request, defaults to null.
|
|
128
128
|
* @returns A promise that resolves to the output of the DELETE handler.
|
|
129
129
|
*/
|
|
130
|
-
const dynamicDel = <Route extends
|
|
130
|
+
const dynamicDel = <Route extends HTTPWiringsWithMethod<'DELETE'>>(
|
|
131
131
|
route: Route,
|
|
132
|
-
data:
|
|
133
|
-
): Promise<
|
|
132
|
+
data: HTTPWiringHandlerOf<Route, 'DELETE'>['input'] = null
|
|
133
|
+
): Promise<HTTPWiringHandlerOf<Route, 'DELETE'>['output']> => {
|
|
134
134
|
return dynamicActionRequest(route, 'DELETE', data)
|
|
135
135
|
}
|
|
136
136
|
|
|
@@ -144,10 +144,10 @@ export const pikku = (_options?: any) => {
|
|
|
144
144
|
* @param data - The input data for the POST request, defaults to null.
|
|
145
145
|
* @returns A promise that resolves to the output of the POST handler.
|
|
146
146
|
*/
|
|
147
|
-
const staticPost = <Route extends
|
|
147
|
+
const staticPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
|
|
148
148
|
route: Route,
|
|
149
|
-
data:
|
|
150
|
-
): Promise<
|
|
149
|
+
data: HTTPWiringHandlerOf<Route, 'POST'>['input'] = null
|
|
150
|
+
): Promise<HTTPWiringHandlerOf<Route, 'POST'>['output']> => {
|
|
151
151
|
return staticActionRequest(route, 'POST', data)
|
|
152
152
|
}
|
|
153
153
|
|
|
@@ -159,10 +159,10 @@ export const pikku = (_options?: any) => {
|
|
|
159
159
|
* @param data - The input data for the GET request, defaults to null.
|
|
160
160
|
* @returns A promise that resolves to the output of the GET handler.
|
|
161
161
|
*/
|
|
162
|
-
const staticGet = <Route extends
|
|
162
|
+
const staticGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
|
|
163
163
|
route: Route,
|
|
164
|
-
data:
|
|
165
|
-
): Promise<
|
|
164
|
+
data: HTTPWiringHandlerOf<Route, 'GET'>['input'] = null
|
|
165
|
+
): Promise<HTTPWiringHandlerOf<Route, 'GET'>['output']> => {
|
|
166
166
|
return staticActionRequest(route, 'GET', data)
|
|
167
167
|
}
|
|
168
168
|
|
|
@@ -6,7 +6,7 @@ export const serializeNextJsHTTPWrapper = (routesMapPath, pikkuFetchImport) => {
|
|
|
6
6
|
* It ensures type safety for route handling methods when integrating with the @pikku/core framework.
|
|
7
7
|
*/
|
|
8
8
|
import { CorePikkuFetchOptions } from '@pikku/fetch'
|
|
9
|
-
import type {
|
|
9
|
+
import type { HTTPWiringsMap, HTTPWiringHandlerOf, HTTPWiringsWithMethod } from '${routesMapPath}'
|
|
10
10
|
import { PikkuFetch } from '${pikkuFetchImport}'
|
|
11
11
|
|
|
12
12
|
let _pikku: PikkuFetch | undefined
|
|
@@ -22,13 +22,13 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const dynamicActionRequest = async <
|
|
25
|
-
Route extends keyof
|
|
26
|
-
Method extends keyof
|
|
25
|
+
Route extends keyof HTTPWiringsMap,
|
|
26
|
+
Method extends keyof HTTPWiringsMap[Route]
|
|
27
27
|
>(
|
|
28
28
|
route: Route,
|
|
29
29
|
method: Method,
|
|
30
|
-
data:
|
|
31
|
-
): Promise<
|
|
30
|
+
data: HTTPWiringHandlerOf<Route, Method>['input'] = null
|
|
31
|
+
): Promise<HTTPWiringHandlerOf<Route, Method>['output']> => {
|
|
32
32
|
return (_pikku! as any)[(method as string).toLowerCase()](route, data as any)
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
36
36
|
* Makes a static action request for a specified route and method.
|
|
37
37
|
* Static requests do not depend on headers or cookies and are suitable for precompile stages.
|
|
38
38
|
*
|
|
39
|
-
* @template Route - The route key from the
|
|
39
|
+
* @template Route - The route key from the HTTPWiringsMap.
|
|
40
40
|
* @template Method - The method key from the specified route.
|
|
41
41
|
* @param route - The route identifier.
|
|
42
42
|
* @param method - The HTTP method to be used for the request.
|
|
@@ -44,13 +44,13 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
44
44
|
* @returns A promise that resolves to the output of the route handler.
|
|
45
45
|
*/
|
|
46
46
|
const staticActionRequest = async <
|
|
47
|
-
Route extends keyof
|
|
48
|
-
Method extends keyof
|
|
47
|
+
Route extends keyof HTTPWiringsMap,
|
|
48
|
+
Method extends keyof HTTPWiringsMap[Route]
|
|
49
49
|
>(
|
|
50
50
|
route: Route,
|
|
51
51
|
method: Method,
|
|
52
|
-
data:
|
|
53
|
-
): Promise<
|
|
52
|
+
data: HTTPWiringHandlerOf<Route, Method>['input'] = null
|
|
53
|
+
): Promise<HTTPWiringHandlerOf<Route, Method>['output']> => {
|
|
54
54
|
return (_pikku! as any)[(method as string).toLowerCase()](route, data as any)
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -62,10 +62,10 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
62
62
|
* @param data - The input data for the POST request, defaults to null.
|
|
63
63
|
* @returns A promise that resolves to the output of the POST handler.
|
|
64
64
|
*/
|
|
65
|
-
const dynamicPost = <Route extends
|
|
65
|
+
const dynamicPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
|
|
66
66
|
route: Route,
|
|
67
|
-
data:
|
|
68
|
-
): Promise<
|
|
67
|
+
data: HTTPWiringHandlerOf<Route, 'POST'>['input'] = null
|
|
68
|
+
): Promise<HTTPWiringHandlerOf<Route, 'POST'>['output']> => {
|
|
69
69
|
return dynamicActionRequest(route, 'POST', data)
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -77,10 +77,10 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
77
77
|
* @param data - The input data for the GET request, defaults to null.
|
|
78
78
|
* @returns A promise that resolves to the output of the GET handler.
|
|
79
79
|
*/
|
|
80
|
-
const dynamicGet = <Route extends
|
|
80
|
+
const dynamicGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
|
|
81
81
|
route: Route,
|
|
82
|
-
data:
|
|
83
|
-
): Promise<
|
|
82
|
+
data: HTTPWiringHandlerOf<Route, 'GET'>['input'] = null
|
|
83
|
+
): Promise<HTTPWiringHandlerOf<Route, 'GET'>['output']> => {
|
|
84
84
|
return dynamicActionRequest(route, 'GET', data)
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -92,10 +92,10 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
92
92
|
* @param data - The input data for the PATCH request, defaults to null.
|
|
93
93
|
* @returns A promise that resolves to the output of the PATCH handler.
|
|
94
94
|
*/
|
|
95
|
-
const dynamicPatch = <Route extends
|
|
95
|
+
const dynamicPatch = <Route extends HTTPWiringsWithMethod<'PATCH'>>(
|
|
96
96
|
route: Route,
|
|
97
|
-
data:
|
|
98
|
-
): Promise<
|
|
97
|
+
data: HTTPWiringHandlerOf<Route, 'PATCH'>['input'] = null
|
|
98
|
+
): Promise<HTTPWiringHandlerOf<Route, 'PATCH'>['output']> => {
|
|
99
99
|
return dynamicActionRequest(route, 'PATCH', data)
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -107,10 +107,10 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
107
107
|
* @param data - The input data for the DELETE request, defaults to null.
|
|
108
108
|
* @returns A promise that resolves to the output of the DELETE handler.
|
|
109
109
|
*/
|
|
110
|
-
const dynamicDel = <Route extends
|
|
110
|
+
const dynamicDel = <Route extends HTTPWiringsWithMethod<'DELETE'>>(
|
|
111
111
|
route: Route,
|
|
112
|
-
data:
|
|
113
|
-
): Promise<
|
|
112
|
+
data: HTTPWiringHandlerOf<Route, 'DELETE'>['input'] = null
|
|
113
|
+
): Promise<HTTPWiringHandlerOf<Route, 'DELETE'>['output']> => {
|
|
114
114
|
return dynamicActionRequest(route, 'DELETE', data)
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -124,10 +124,10 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
124
124
|
* @param data - The input data for the POST request, defaults to null.
|
|
125
125
|
* @returns A promise that resolves to the output of the POST handler.
|
|
126
126
|
*/
|
|
127
|
-
const staticPost = <Route extends
|
|
127
|
+
const staticPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
|
|
128
128
|
route: Route,
|
|
129
|
-
data:
|
|
130
|
-
): Promise<
|
|
129
|
+
data: HTTPWiringHandlerOf<Route, 'POST'>['input'] = null
|
|
130
|
+
): Promise<HTTPWiringHandlerOf<Route, 'POST'>['output']> => {
|
|
131
131
|
return staticActionRequest(route, 'POST', data)
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -139,10 +139,10 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
139
139
|
* @param data - The input data for the GET request, defaults to null.
|
|
140
140
|
* @returns A promise that resolves to the output of the GET handler.
|
|
141
141
|
*/
|
|
142
|
-
const staticGet = <Route extends
|
|
142
|
+
const staticGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
|
|
143
143
|
route: Route,
|
|
144
|
-
data:
|
|
145
|
-
): Promise<
|
|
144
|
+
data: HTTPWiringHandlerOf<Route, 'GET'>['input'] = null
|
|
145
|
+
): Promise<HTTPWiringHandlerOf<Route, 'GET'>['output']> => {
|
|
146
146
|
return staticActionRequest(route, 'GET', data)
|
|
147
147
|
}
|
|
148
148
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CLILogger } from './utils.js';
|
|
2
2
|
import { FunctionsMeta, JSONValue } from '@pikku/core';
|
|
3
|
-
import {
|
|
3
|
+
import { HTTPWiringsMeta } from '@pikku/core/http';
|
|
4
4
|
import { TypesMap } from '@pikku/inspector';
|
|
5
|
-
export declare function generateSchemas(logger: CLILogger, tsconfig: string, typesMap: TypesMap, functionMeta: FunctionsMeta,
|
|
5
|
+
export declare function generateSchemas(logger: CLILogger, tsconfig: string, typesMap: TypesMap, functionMeta: FunctionsMeta, httpWiringsMeta: HTTPWiringsMeta): Promise<Record<string, JSONValue>>;
|
|
6
6
|
export declare function saveSchemas(logger: CLILogger, schemaParentDir: string, schemas: Record<string, JSONValue>, typesMap: TypesMap, functionsMeta: FunctionsMeta, supportsImportAttributes: boolean): Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createGenerator, RootlessError } from 'ts-json-schema-generator';
|
|
2
2
|
import { writeFileInDir } from './utils.js';
|
|
3
3
|
import { mkdir, writeFile } from 'fs/promises';
|
|
4
|
-
export async function generateSchemas(logger, tsconfig, typesMap, functionMeta,
|
|
4
|
+
export async function generateSchemas(logger, tsconfig, typesMap, functionMeta, httpWiringsMeta) {
|
|
5
5
|
const schemasSet = new Set(typesMap.customTypes.keys());
|
|
6
6
|
for (const { inputs, outputs } of Object.values(functionMeta)) {
|
|
7
7
|
const types = [...(inputs || []), ...(outputs || [])];
|
|
@@ -12,7 +12,7 @@ export async function generateSchemas(logger, tsconfig, typesMap, functionMeta,
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
for (const { inputTypes } of
|
|
15
|
+
for (const { inputTypes } of httpWiringsMeta) {
|
|
16
16
|
if (inputTypes?.body) {
|
|
17
17
|
schemasSet.add(inputTypes.body);
|
|
18
18
|
}
|
|
@@ -6,13 +6,13 @@ export const serializePikkuTypes = (userSessionTypeImport, userSessionTypeName,
|
|
|
6
6
|
* This is used to provide the application types in the typescript project
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { CoreScheduledTask,
|
|
13
|
-
import {
|
|
14
|
-
import { CoreQueueWorker,
|
|
15
|
-
import { CoreMCPResource, CoreMCPTool, CoreMCPPrompt,
|
|
9
|
+
import { CorePikkuPermission, PikkuMiddleware } from '@pikku/core'
|
|
10
|
+
import { CorePikkuFunction, CorePikkuFunctionSessionless } from '@pikku/core/function'
|
|
11
|
+
import { CoreHTTPFunctionWiring, AssertHTTPWiringParams, wireHTTP as wireHTTPCore } from '@pikku/core/http'
|
|
12
|
+
import { CoreScheduledTask, wireScheduler as wireSchedulerCore } from '@pikku/core/scheduler'
|
|
13
|
+
import { CoreChannel, PikkuChannel, wireChannel as wireChannelCore } from '@pikku/core/channel'
|
|
14
|
+
import { CoreQueueWorker, wireQueueWorker as wireQueueWorkerCore } from '@pikku/core/queue'
|
|
15
|
+
import { CoreMCPResource, CoreMCPTool, CoreMCPPrompt, wireMCPResource as wireMCPResourceCore, wireMCPTool as wireMCPToolCore, wireMCPPrompt as wireMCPPromptCore, MCPResourceResponse, MCPToolResponse, MCPPromptResponse, PikkuMCP } from '@pikku/core'
|
|
16
16
|
|
|
17
17
|
${userSessionTypeImport}
|
|
18
18
|
${singletonServicesTypeImport}
|
|
@@ -26,11 +26,11 @@ ${rpcMapTypeImport}
|
|
|
26
26
|
* @template In - The input type that the permission check will receive
|
|
27
27
|
* @template RequiredServices - The services required for this permission check
|
|
28
28
|
*/
|
|
29
|
-
export type
|
|
29
|
+
export type PikkuPermission<In = unknown, RequiredServices extends ${singletonServicesTypeName} = ${singletonServicesTypeName}> = CorePikkuPermission<In, RequiredServices, ${userSessionTypeName}>
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Type-safe middleware definition that can access your application's services and session.
|
|
33
|
-
* Use this to define reusable middleware that can be applied to multiple
|
|
33
|
+
* Use this to define reusable middleware that can be applied to multiple HTTP wirings.
|
|
34
34
|
*
|
|
35
35
|
* @template RequiredServices - The services required for this middleware
|
|
36
36
|
*/
|
|
@@ -46,7 +46,7 @@ export type APIMiddleware<RequiredServices extends ${singletonServicesTypeName}
|
|
|
46
46
|
* @template MCPData - MCP data type (null = optional MCP)
|
|
47
47
|
* @template RequiredServices - Services required by this function
|
|
48
48
|
*/
|
|
49
|
-
type
|
|
49
|
+
type PikkuFunctionSessionless<
|
|
50
50
|
In = unknown,
|
|
51
51
|
Out = never,
|
|
52
52
|
ChannelData = null, // null means optional channel
|
|
@@ -60,7 +60,7 @@ type APIFunctionSessionless<
|
|
|
60
60
|
? { mcp?: PikkuMCP } // Optional MCP
|
|
61
61
|
: { mcp: PikkuMCP } // Required MCP
|
|
62
62
|
)
|
|
63
|
-
> =
|
|
63
|
+
> = CorePikkuFunctionSessionless<In, Out, ChannelData, RequiredServices, ${userSessionTypeName}>
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* A session-aware API function that requires user authentication.
|
|
@@ -72,7 +72,7 @@ type APIFunctionSessionless<
|
|
|
72
72
|
* @template MCPData - MCP data type (null = optional MCP)
|
|
73
73
|
* @template RequiredServices - Services required by this function
|
|
74
74
|
*/
|
|
75
|
-
type
|
|
75
|
+
type PikkuFunction<
|
|
76
76
|
In = unknown,
|
|
77
77
|
Out = never,
|
|
78
78
|
ChannelData = null, // null means optional channel
|
|
@@ -86,17 +86,17 @@ type APIFunction<
|
|
|
86
86
|
? { mcp?: PikkuMCP } // Optional MCP
|
|
87
87
|
: { mcp: PikkuMCP } // Required MCP
|
|
88
88
|
)
|
|
89
|
-
> =
|
|
89
|
+
> = CorePikkuFunction<In, Out, ChannelData, RequiredServices, ${userSessionTypeName}>
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
|
-
* Type definition for HTTP API
|
|
92
|
+
* Type definition for HTTP API wirings with type-safe path parameters.
|
|
93
93
|
* Supports both authenticated and unauthenticated functions.
|
|
94
94
|
*
|
|
95
|
-
* @template In - Input type for the
|
|
96
|
-
* @template Out - Output type for the
|
|
97
|
-
* @template Route - String literal type for the
|
|
95
|
+
* @template In - Input type for the HTTP wiring
|
|
96
|
+
* @template Out - Output type for the HTTP wiring
|
|
97
|
+
* @template Route - String literal type for the HTTP path (e.g., "/users/:id")
|
|
98
98
|
*/
|
|
99
|
-
type
|
|
99
|
+
type HTTPWiring<In, Out, Route extends string> = CoreHTTPFunctionWiring<In, Out, Route, PikkuFunction<In, Out>, PikkuFunctionSessionless<In, Out>, PikkuPermission<In>, APIMiddleware>
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
102
|
* Type definition for WebSocket channels with typed data exchange.
|
|
@@ -105,13 +105,13 @@ type APIRoute<In, Out, Route extends string> = CoreHTTPFunctionRoute<In, Out, Ro
|
|
|
105
105
|
* @template ChannelData - Type of data exchanged through the channel
|
|
106
106
|
* @template Channel - String literal type for the channel name
|
|
107
107
|
*/
|
|
108
|
-
type
|
|
108
|
+
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>
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
111
|
* Type definition for scheduled tasks that run at specified intervals.
|
|
112
112
|
* These are sessionless functions that execute based on cron expressions.
|
|
113
113
|
*/
|
|
114
|
-
type
|
|
114
|
+
type SchedulerWiring = CoreScheduledTask<PikkuFunctionSessionless<void, void>>
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
117
|
* Type definition for queue workers that process background jobs.
|
|
@@ -119,28 +119,28 @@ type ScheduledTask = CoreScheduledTask<APIFunctionSessionless<void, void>>
|
|
|
119
119
|
* @template In - Input type for the queue job
|
|
120
120
|
* @template Out - Output type for the queue job
|
|
121
121
|
*/
|
|
122
|
-
type
|
|
122
|
+
type QueueWiring<In, Out> = CoreQueueWorker<PikkuFunctionSessionless<In, Out>>
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* Type definition for MCP resources that provide data to AI models.
|
|
126
126
|
*
|
|
127
127
|
* @template In - Input type for the resource request
|
|
128
128
|
*/
|
|
129
|
-
type
|
|
129
|
+
type MCPResourceWiring<In> = CoreMCPResource<PikkuFunctionSessionless<In, MCPResourceResponse, null, true>>
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
132
|
* Type definition for MCP tools that AI models can invoke.
|
|
133
133
|
*
|
|
134
134
|
* @template In - Input type for the tool invocation
|
|
135
135
|
*/
|
|
136
|
-
type
|
|
136
|
+
type MCPToolWiring<In> = CoreMCPTool<PikkuFunctionSessionless<In, MCPToolResponse, null, true>>
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
139
|
* Type definition for MCP prompts that provide templates to AI models.
|
|
140
140
|
*
|
|
141
141
|
* @template In - Input type for the prompt parameters
|
|
142
142
|
*/
|
|
143
|
-
type
|
|
143
|
+
type MCPPromptWiring<In> = CoreMCPPrompt<PikkuFunctionSessionless<In, MCPPromptResponse, null, true>>
|
|
144
144
|
|
|
145
145
|
/**
|
|
146
146
|
* Creates a Pikku function that can be either session-aware or sessionless.
|
|
@@ -165,14 +165,14 @@ type MCPPrompt<In> = CoreMCPPrompt<APIFunctionSessionless<In, MCPPromptResponse,
|
|
|
165
165
|
*/
|
|
166
166
|
export const pikkuFunc = <In, Out = unknown>(
|
|
167
167
|
func:
|
|
168
|
-
|
|
|
168
|
+
| PikkuFunction<In, Out>
|
|
169
169
|
| {
|
|
170
|
-
func:
|
|
170
|
+
func: PikkuFunction<In, Out>
|
|
171
171
|
auth?: true
|
|
172
172
|
name?: string
|
|
173
173
|
}
|
|
174
174
|
| {
|
|
175
|
-
func:
|
|
175
|
+
func: PikkuFunctionSessionless<In, Out>
|
|
176
176
|
auth: false
|
|
177
177
|
name?: string
|
|
178
178
|
}
|
|
@@ -202,9 +202,9 @@ export const pikkuFunc = <In, Out = unknown>(
|
|
|
202
202
|
*/
|
|
203
203
|
export const pikkuSessionlessFunc = <In, Out = unknown>(
|
|
204
204
|
func:
|
|
205
|
-
|
|
|
205
|
+
| PikkuFunctionSessionless<In, Out>
|
|
206
206
|
| {
|
|
207
|
-
func:
|
|
207
|
+
func: PikkuFunctionSessionless<In, Out>
|
|
208
208
|
name?: string
|
|
209
209
|
}
|
|
210
210
|
) => {
|
|
@@ -233,9 +233,9 @@ export const pikkuSessionlessFunc = <In, Out = unknown>(
|
|
|
233
233
|
*/
|
|
234
234
|
export const pikkuChannelConnectionFunc = <Out = unknown, ChannelData = unknown>(
|
|
235
235
|
func:
|
|
236
|
-
|
|
|
236
|
+
| PikkuFunctionSessionless<void, Out, ChannelData>
|
|
237
237
|
| {
|
|
238
|
-
func:
|
|
238
|
+
func: PikkuFunctionSessionless<void, Out, ChannelData>
|
|
239
239
|
name?: string
|
|
240
240
|
}
|
|
241
241
|
) => {
|
|
@@ -262,9 +262,9 @@ export const pikkuChannelConnectionFunc = <Out = unknown, ChannelData = unknown>
|
|
|
262
262
|
*/
|
|
263
263
|
export const pikkuChannelDisconnectionFunc = <ChannelData = unknown>(
|
|
264
264
|
func:
|
|
265
|
-
|
|
|
265
|
+
| PikkuFunctionSessionless<void, void, ChannelData>
|
|
266
266
|
| {
|
|
267
|
-
func:
|
|
267
|
+
func: PikkuFunction<void, void, ChannelData>
|
|
268
268
|
name?: string
|
|
269
269
|
}
|
|
270
270
|
) => {
|
|
@@ -292,9 +292,9 @@ export const pikkuChannelDisconnectionFunc = <ChannelData = unknown>(
|
|
|
292
292
|
*/
|
|
293
293
|
export const pikkuChannelFunc = <In = unknown, Out = unknown, ChannelData = unknown>(
|
|
294
294
|
func:
|
|
295
|
-
|
|
|
295
|
+
| PikkuFunctionSessionless<In, Out, ChannelData>
|
|
296
296
|
| {
|
|
297
|
-
func:
|
|
297
|
+
func: PikkuFunctionSessionless<In, Out, ChannelData>
|
|
298
298
|
name?: string
|
|
299
299
|
}
|
|
300
300
|
) => {
|
|
@@ -319,9 +319,9 @@ export const pikkuChannelFunc = <In = unknown, Out = unknown, ChannelData = unkn
|
|
|
319
319
|
*/
|
|
320
320
|
export const pikkuVoidFunc = (
|
|
321
321
|
func:
|
|
322
|
-
|
|
|
322
|
+
| PikkuFunctionSessionless<void, void>
|
|
323
323
|
| {
|
|
324
|
-
func:
|
|
324
|
+
func: PikkuFunctionSessionless<void, void>
|
|
325
325
|
name?: string
|
|
326
326
|
}
|
|
327
327
|
) => {
|
|
@@ -335,24 +335,24 @@ export const pikkuVoidFunc = (
|
|
|
335
335
|
* @template Channel - String literal type for the channel name
|
|
336
336
|
* @param channel - Channel definition with connection, disconnection, and message handlers
|
|
337
337
|
*/
|
|
338
|
-
export const
|
|
339
|
-
channel:
|
|
338
|
+
export const wireChannel = <ChannelData, Channel extends string>(
|
|
339
|
+
channel: ChannelWiring<ChannelData, Channel> & AssertHTTPWiringParams<ChannelData, Channel>
|
|
340
340
|
) => {
|
|
341
|
-
|
|
341
|
+
wireChannelCore(channel as any) // TODO
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
/**
|
|
345
|
-
* Registers an HTTP
|
|
345
|
+
* Registers an HTTP wiring with the Pikku framework.
|
|
346
346
|
*
|
|
347
|
-
* @template In - Input type for the
|
|
348
|
-
* @template Out - Output type for the
|
|
349
|
-
* @template Route - String literal type for the
|
|
350
|
-
* @param
|
|
347
|
+
* @template In - Input type for the HTTP wiring
|
|
348
|
+
* @template Out - Output type for the HTTP wiring
|
|
349
|
+
* @template Route - String literal type for the HTTP path (e.g., "/users/:id")
|
|
350
|
+
* @param httpWiring - HTTP wiring definition with handler, method, and optional middleware
|
|
351
351
|
*/
|
|
352
|
-
export const
|
|
353
|
-
|
|
352
|
+
export const wireHTTP = <In, Out, Route extends string>(
|
|
353
|
+
httpWiring: HTTPWiring<In, Out, Route> & AssertHTTPWiringParams<In, Route>
|
|
354
354
|
) => {
|
|
355
|
-
|
|
355
|
+
wireHTTPCore(httpWiring)
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
/**
|
|
@@ -361,8 +361,8 @@ export const addHTTPRoute = <In, Out, Route extends string>(
|
|
|
361
361
|
*
|
|
362
362
|
* @param task - Scheduled task definition with cron expression and handler
|
|
363
363
|
*/
|
|
364
|
-
export const
|
|
365
|
-
|
|
364
|
+
export const wireScheduler = (task: SchedulerWiring) => {
|
|
365
|
+
wireSchedulerCore(task as any) // TODO
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
/**
|
|
@@ -371,8 +371,8 @@ export const addScheduledTask = (task: ScheduledTask) => {
|
|
|
371
371
|
*
|
|
372
372
|
* @param queueWorker - Queue worker definition with job handler
|
|
373
373
|
*/
|
|
374
|
-
export const
|
|
375
|
-
|
|
374
|
+
export const wireQueueWorker = (queueWorker: QueueWiring<any, any>) => {
|
|
375
|
+
wireQueueWorkerCore(queueWorker as any) // TODO
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
/**
|
|
@@ -382,10 +382,10 @@ export const addQueueWorker = (queueWorker: QueueWorker<any, any>) => {
|
|
|
382
382
|
* @template In - Input type for the resource request
|
|
383
383
|
* @param mcpResource - MCP resource definition with data provider function
|
|
384
384
|
*/
|
|
385
|
-
export const
|
|
386
|
-
mcpResource:
|
|
385
|
+
export const wireMCPResource = <In>(
|
|
386
|
+
mcpResource: MCPResourceWiring<In>
|
|
387
387
|
) => {
|
|
388
|
-
|
|
388
|
+
wireMCPResourceCore(mcpResource as any)
|
|
389
389
|
}
|
|
390
390
|
|
|
391
391
|
/**
|
|
@@ -395,10 +395,10 @@ export const addMCPResource = <In>(
|
|
|
395
395
|
* @template In - Input type for the tool invocation
|
|
396
396
|
* @param mcpTool - MCP tool definition with action function
|
|
397
397
|
*/
|
|
398
|
-
export const
|
|
399
|
-
mcpTool:
|
|
398
|
+
export const wireMCPTool = <In>(
|
|
399
|
+
mcpTool: MCPToolWiring<In>
|
|
400
400
|
) => {
|
|
401
|
-
|
|
401
|
+
wireMCPToolCore(mcpTool as any)
|
|
402
402
|
}
|
|
403
403
|
|
|
404
404
|
/**
|
|
@@ -408,10 +408,10 @@ export const addMCPTool = <In>(
|
|
|
408
408
|
* @template In - Input type for the prompt parameters
|
|
409
409
|
* @param mcpPrompt - MCP prompt definition with template function
|
|
410
410
|
*/
|
|
411
|
-
export const
|
|
412
|
-
mcpPrompt:
|
|
411
|
+
export const wireMCPPrompt = <In>(
|
|
412
|
+
mcpPrompt: MCPPromptWiring<In>
|
|
413
413
|
) => {
|
|
414
|
-
|
|
414
|
+
wireMCPPromptCore(mcpPrompt as any)
|
|
415
415
|
}
|
|
416
416
|
|
|
417
417
|
/**
|
|
@@ -439,9 +439,9 @@ export const addMCPPrompt = <In>(
|
|
|
439
439
|
*/
|
|
440
440
|
export const pikkuMCPPromptFunc = <In>(
|
|
441
441
|
func:
|
|
442
|
-
|
|
|
442
|
+
| PikkuFunctionSessionless<In, MCPPromptResponse>
|
|
443
443
|
| {
|
|
444
|
-
func:
|
|
444
|
+
func: PikkuFunctionSessionless<In, MCPPromptResponse>
|
|
445
445
|
name?: string
|
|
446
446
|
}
|
|
447
447
|
) => {
|
|
@@ -471,9 +471,9 @@ export const pikkuMCPPromptFunc = <In>(
|
|
|
471
471
|
*/
|
|
472
472
|
export const pikkuMCPToolFunc = <In>(
|
|
473
473
|
func:
|
|
474
|
-
|
|
|
474
|
+
| PikkuFunctionSessionless<In, MCPToolResponse, null, true>
|
|
475
475
|
| {
|
|
476
|
-
func:
|
|
476
|
+
func: PikkuFunctionSessionless<In, MCPToolResponse, null, true>
|
|
477
477
|
name?: string
|
|
478
478
|
}
|
|
479
479
|
) => {
|
|
@@ -504,9 +504,9 @@ export const pikkuMCPToolFunc = <In>(
|
|
|
504
504
|
*/
|
|
505
505
|
export const pikkuMCPResourceFunc = <In>(
|
|
506
506
|
func:
|
|
507
|
-
|
|
|
507
|
+
| PikkuFunctionSessionless<In, MCPResourceResponse, null, true>
|
|
508
508
|
| {
|
|
509
|
-
func:
|
|
509
|
+
func: PikkuFunctionSessionless<In, MCPResourceResponse, null, true>
|
|
510
510
|
name?: string
|
|
511
511
|
}
|
|
512
512
|
) => {
|