@pikku/cli 0.8.3 → 0.9.1
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 +16 -0
- package/bin/pikku-all.ts +47 -33
- 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 +38 -33
- 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/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.d.ts +5 -1
- package/dist/src/utils.js +17 -6
- package/dist/src/wirings/channels/pikku-channels.js +9 -0
- package/dist/src/wirings/channels/pikku-command-channels.js +9 -0
- package/dist/src/{events → wirings}/channels/serialize-typed-channel-map.js +3 -3
- package/dist/src/{events → wirings}/channels/serialize-websocket-wrapper.js +19 -5
- package/dist/src/{events → wirings}/fetch/index.js +2 -2
- package/dist/src/{events → wirings}/http/openapi-spec-generator.d.ts +2 -2
- package/dist/src/wirings/http/pikku-command-http-map.js +8 -0
- package/dist/src/{events → wirings}/http/pikku-command-http-routes.js +3 -3
- package/dist/src/{events → wirings}/http/pikku-http-routes.js +3 -3
- 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/{events → wirings}/http/serialize-typed-http-map.js +13 -13
- package/dist/src/{events → wirings}/mcp/pikku-command-mcp.js +3 -3
- package/dist/src/wirings/queue/pikku-command-queue-service.js +15 -0
- package/dist/src/{events → wirings}/queue/pikku-command-queue.js +3 -3
- package/dist/src/{events → wirings}/queue/pikku-queue.js +3 -3
- package/dist/src/wirings/rpc/pikku-command-rpc-client.js +15 -0
- package/dist/src/wirings/rpc/pikku-command-rpc.js +6 -0
- package/dist/src/wirings/rpc/pikku-rpc.js +6 -0
- package/dist/src/wirings/rpc/serialize-rpc-wrapper.js +68 -0
- package/dist/src/{events → wirings}/scheduler/pikku-command-scheduler.js +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- 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.ts +26 -6
- 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/dist/src/events/channels/pikku-channels.js +0 -9
- package/dist/src/events/channels/pikku-command-channels.js +0 -9
- package/dist/src/events/http/pikku-command-http-map.js +0 -8
- package/dist/src/events/http/serialize-fetch-wrapper.js +0 -67
- package/dist/src/events/http/serialize-typed-http-map.d.ts +0 -4
- package/dist/src/events/queue/pikku-command-queue-service.js +0 -12
- package/dist/src/events/rpc/pikku-command-rpc-client.js +0 -12
- package/dist/src/events/rpc/pikku-command-rpc.js +0 -6
- package/dist/src/events/rpc/pikku-rpc.js +0 -6
- package/dist/src/events/rpc/serialize-rpc-wrapper.js +0 -29
- package/src/events/http/serialize-fetch-wrapper.ts +0 -67
- package/src/events/rpc/serialize-rpc-wrapper.ts +0 -29
- /package/dist/src/{events → wirings}/channels/pikku-channels.d.ts +0 -0
- /package/dist/src/{events → wirings}/channels/pikku-command-channels-map.d.ts +0 -0
- /package/dist/src/{events → wirings}/channels/pikku-command-channels-map.js +0 -0
- /package/dist/src/{events → wirings}/channels/pikku-command-channels.d.ts +0 -0
- /package/dist/src/{events → wirings}/channels/pikku-command-websocket-typed.d.ts +0 -0
- /package/dist/src/{events → wirings}/channels/pikku-command-websocket-typed.js +0 -0
- /package/dist/src/{events → wirings}/channels/serialize-typed-channel-map.d.ts +0 -0
- /package/dist/src/{events → wirings}/channels/serialize-websocket-wrapper.d.ts +0 -0
- /package/dist/src/{events → wirings}/fetch/index.d.ts +0 -0
- /package/dist/src/{events → wirings}/functions/pikku-command-function-types.d.ts +0 -0
- /package/dist/src/{events → wirings}/functions/pikku-command-function-types.js +0 -0
- /package/dist/src/{events → wirings}/functions/pikku-command-functions.d.ts +0 -0
- /package/dist/src/{events → wirings}/functions/pikku-command-functions.js +0 -0
- /package/dist/src/{events → wirings}/functions/pikku-command-services.d.ts +0 -0
- /package/dist/src/{events → wirings}/functions/pikku-command-services.js +0 -0
- /package/dist/src/{events → wirings}/functions/pikku-function-types.d.ts +0 -0
- /package/dist/src/{events → wirings}/functions/pikku-function-types.js +0 -0
- /package/dist/src/{events → wirings}/functions/pikku-functions.d.ts +0 -0
- /package/dist/src/{events → wirings}/functions/pikku-functions.js +0 -0
- /package/dist/src/{events → wirings}/http/openapi-spec-generator.js +0 -0
- /package/dist/src/{events → wirings}/http/pikku-command-http-map.d.ts +0 -0
- /package/dist/src/{events → wirings}/http/pikku-command-http-routes.d.ts +0 -0
- /package/dist/src/{events → wirings}/http/pikku-command-openapi.d.ts +0 -0
- /package/dist/src/{events → wirings}/http/pikku-command-openapi.js +0 -0
- /package/dist/src/{events → wirings}/http/pikku-http-routes.d.ts +0 -0
- /package/dist/src/{events → wirings}/http/serialize-fetch-wrapper.d.ts +0 -0
- /package/dist/src/{events → wirings}/mcp/pikku-command-mcp-json.d.ts +0 -0
- /package/dist/src/{events → wirings}/mcp/pikku-command-mcp-json.js +0 -0
- /package/dist/src/{events → wirings}/mcp/pikku-command-mcp.d.ts +0 -0
- /package/dist/src/{events → wirings}/mcp/serialize-mcp-json.d.ts +0 -0
- /package/dist/src/{events → wirings}/mcp/serialize-mcp-json.js +0 -0
- /package/dist/src/{events → wirings}/queue/pikku-command-queue-map.d.ts +0 -0
- /package/dist/src/{events → wirings}/queue/pikku-command-queue-map.js +0 -0
- /package/dist/src/{events → wirings}/queue/pikku-command-queue-service.d.ts +0 -0
- /package/dist/src/{events → wirings}/queue/pikku-command-queue.d.ts +0 -0
- /package/dist/src/{events → wirings}/queue/pikku-queue-map.d.ts +0 -0
- /package/dist/src/{events → wirings}/queue/pikku-queue-map.js +0 -0
- /package/dist/src/{events → wirings}/queue/pikku-queue.d.ts +0 -0
- /package/dist/src/{events → wirings}/queue/serialize-queue-map.d.ts +0 -0
- /package/dist/src/{events → wirings}/queue/serialize-queue-map.js +0 -0
- /package/dist/src/{events → wirings}/queue/serialize-queue-meta.d.ts +0 -0
- /package/dist/src/{events → wirings}/queue/serialize-queue-meta.js +0 -0
- /package/dist/src/{events → wirings}/queue/serialize-queue-wrapper.d.ts +0 -0
- /package/dist/src/{events → wirings}/queue/serialize-queue-wrapper.js +0 -0
- /package/dist/src/{events → wirings}/rpc/pikku-command-rpc-client.d.ts +0 -0
- /package/dist/src/{events → wirings}/rpc/pikku-command-rpc-map.d.ts +0 -0
- /package/dist/src/{events → wirings}/rpc/pikku-command-rpc-map.js +0 -0
- /package/dist/src/{events → wirings}/rpc/pikku-command-rpc.d.ts +0 -0
- /package/dist/src/{events → wirings}/rpc/pikku-rpc.d.ts +0 -0
- /package/dist/src/{events → wirings}/rpc/serialize-rpc-wrapper.d.ts +0 -0
- /package/dist/src/{events → wirings}/rpc/serialize-typed-rpc-map.d.ts +0 -0
- /package/dist/src/{events → wirings}/rpc/serialize-typed-rpc-map.js +0 -0
- /package/dist/src/{events → wirings}/scheduler/pikku-command-scheduler.d.ts +0 -0
- /package/dist/src/{events → wirings}/scheduler/serialize-scheduler-meta.d.ts +0 -0
- /package/dist/src/{events → wirings}/scheduler/serialize-scheduler-meta.js +0 -0
- /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
|
@@ -12,7 +12,7 @@ export const serializeNextJsBackendWrapper = (
|
|
|
12
12
|
* It ensures type safety for route handling methods when integrating with the @pikku/core framework.
|
|
13
13
|
*/
|
|
14
14
|
import { PikkuNextJS } from '@pikku/next'
|
|
15
|
-
import type {
|
|
15
|
+
import type { HTTPWiringsMap, HTTPWiringHandlerOf, HTTPWiringsWithMethod } from '${routesMapPath}'
|
|
16
16
|
|
|
17
17
|
${configImport}
|
|
18
18
|
${singleServicesFactoryImport}
|
|
@@ -40,7 +40,7 @@ export const pikku = (_options?: any) => {
|
|
|
40
40
|
* Makes a dynamic action request for a specified route and method.
|
|
41
41
|
* Dynamic requests may access headers and cookies and are therefore unsuitable for precompile stages.
|
|
42
42
|
*
|
|
43
|
-
* @template Route - The route key from the
|
|
43
|
+
* @template Route - The route key from the HTTPWiringsMap.
|
|
44
44
|
* @template Method - The method key from the specified route.
|
|
45
45
|
* @param route - The route identifier.
|
|
46
46
|
* @param method - The HTTP method to be used for the request.
|
|
@@ -48,13 +48,13 @@ export const pikku = (_options?: any) => {
|
|
|
48
48
|
* @returns A promise that resolves to the output of the route handler.
|
|
49
49
|
*/
|
|
50
50
|
const dynamicActionRequest = async <
|
|
51
|
-
Route extends keyof
|
|
52
|
-
Method extends keyof
|
|
51
|
+
Route extends keyof HTTPWiringsMap,
|
|
52
|
+
Method extends keyof HTTPWiringsMap[Route]
|
|
53
53
|
>(
|
|
54
54
|
route: Route,
|
|
55
55
|
method: Method,
|
|
56
|
-
data:
|
|
57
|
-
): Promise<
|
|
56
|
+
data: HTTPWiringHandlerOf<Route, Method>['input'] = null
|
|
57
|
+
): Promise<HTTPWiringHandlerOf<Route, Method>['output']> => {
|
|
58
58
|
return _pikku!.actionRequest(route, method, data as any)
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -62,7 +62,7 @@ export const pikku = (_options?: any) => {
|
|
|
62
62
|
* Makes a static action request for a specified route and method.
|
|
63
63
|
* Static requests do not depend on headers or cookies and are suitable for precompile stages.
|
|
64
64
|
*
|
|
65
|
-
* @template Route - The route key from the
|
|
65
|
+
* @template Route - The route key from the HTTPWiringsMap.
|
|
66
66
|
* @template Method - The method key from the specified route.
|
|
67
67
|
* @param route - The route identifier.
|
|
68
68
|
* @param method - The HTTP method to be used for the request.
|
|
@@ -70,13 +70,13 @@ export const pikku = (_options?: any) => {
|
|
|
70
70
|
* @returns A promise that resolves to the output of the route handler.
|
|
71
71
|
*/
|
|
72
72
|
const staticActionRequest = async <
|
|
73
|
-
Route extends keyof
|
|
74
|
-
Method extends keyof
|
|
73
|
+
Route extends keyof HTTPWiringsMap,
|
|
74
|
+
Method extends keyof HTTPWiringsMap[Route]
|
|
75
75
|
>(
|
|
76
76
|
route: Route,
|
|
77
77
|
method: Method,
|
|
78
|
-
data:
|
|
79
|
-
): Promise<
|
|
78
|
+
data: HTTPWiringHandlerOf<Route, Method>['input'] = null
|
|
79
|
+
): Promise<HTTPWiringHandlerOf<Route, Method>['output']> => {
|
|
80
80
|
return _pikku!.staticActionRequest(route, method, data as any)
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -88,10 +88,10 @@ export const pikku = (_options?: any) => {
|
|
|
88
88
|
* @param data - The input data for the POST request, defaults to null.
|
|
89
89
|
* @returns A promise that resolves to the output of the POST handler.
|
|
90
90
|
*/
|
|
91
|
-
const dynamicPost = <Route extends
|
|
91
|
+
const dynamicPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
|
|
92
92
|
route: Route,
|
|
93
|
-
data:
|
|
94
|
-
): Promise<
|
|
93
|
+
data: HTTPWiringHandlerOf<Route, 'POST'>['input'] = null
|
|
94
|
+
): Promise<HTTPWiringHandlerOf<Route, 'POST'>['output']> => {
|
|
95
95
|
return dynamicActionRequest(route, 'POST', data)
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -103,10 +103,10 @@ export const pikku = (_options?: any) => {
|
|
|
103
103
|
* @param data - The input data for the GET request, defaults to null.
|
|
104
104
|
* @returns A promise that resolves to the output of the GET handler.
|
|
105
105
|
*/
|
|
106
|
-
const dynamicGet = <Route extends
|
|
106
|
+
const dynamicGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
|
|
107
107
|
route: Route,
|
|
108
|
-
data:
|
|
109
|
-
): Promise<
|
|
108
|
+
data: HTTPWiringHandlerOf<Route, 'GET'>['input'] = null
|
|
109
|
+
): Promise<HTTPWiringHandlerOf<Route, 'GET'>['output']> => {
|
|
110
110
|
return dynamicActionRequest(route, 'GET', data)
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -118,10 +118,10 @@ export const pikku = (_options?: any) => {
|
|
|
118
118
|
* @param data - The input data for the PATCH request, defaults to null.
|
|
119
119
|
* @returns A promise that resolves to the output of the PATCH handler.
|
|
120
120
|
*/
|
|
121
|
-
const dynamicPatch = <Route extends
|
|
121
|
+
const dynamicPatch = <Route extends HTTPWiringsWithMethod<'PATCH'>>(
|
|
122
122
|
route: Route,
|
|
123
|
-
data:
|
|
124
|
-
): Promise<
|
|
123
|
+
data: HTTPWiringHandlerOf<Route, 'PATCH'>['input'] = null
|
|
124
|
+
): Promise<HTTPWiringHandlerOf<Route, 'PATCH'>['output']> => {
|
|
125
125
|
return dynamicActionRequest(route, 'PATCH', data)
|
|
126
126
|
}
|
|
127
127
|
|
|
@@ -133,10 +133,10 @@ export const pikku = (_options?: any) => {
|
|
|
133
133
|
* @param data - The input data for the DELETE request, defaults to null.
|
|
134
134
|
* @returns A promise that resolves to the output of the DELETE handler.
|
|
135
135
|
*/
|
|
136
|
-
const dynamicDel = <Route extends
|
|
136
|
+
const dynamicDel = <Route extends HTTPWiringsWithMethod<'DELETE'>>(
|
|
137
137
|
route: Route,
|
|
138
|
-
data:
|
|
139
|
-
): Promise<
|
|
138
|
+
data: HTTPWiringHandlerOf<Route, 'DELETE'>['input'] = null
|
|
139
|
+
): Promise<HTTPWiringHandlerOf<Route, 'DELETE'>['output']> => {
|
|
140
140
|
return dynamicActionRequest(route, 'DELETE', data)
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -150,10 +150,10 @@ export const pikku = (_options?: any) => {
|
|
|
150
150
|
* @param data - The input data for the POST request, defaults to null.
|
|
151
151
|
* @returns A promise that resolves to the output of the POST handler.
|
|
152
152
|
*/
|
|
153
|
-
const staticPost = <Route extends
|
|
153
|
+
const staticPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
|
|
154
154
|
route: Route,
|
|
155
|
-
data:
|
|
156
|
-
): Promise<
|
|
155
|
+
data: HTTPWiringHandlerOf<Route, 'POST'>['input'] = null
|
|
156
|
+
): Promise<HTTPWiringHandlerOf<Route, 'POST'>['output']> => {
|
|
157
157
|
return staticActionRequest(route, 'POST', data)
|
|
158
158
|
}
|
|
159
159
|
|
|
@@ -165,10 +165,10 @@ export const pikku = (_options?: any) => {
|
|
|
165
165
|
* @param data - The input data for the GET request, defaults to null.
|
|
166
166
|
* @returns A promise that resolves to the output of the GET handler.
|
|
167
167
|
*/
|
|
168
|
-
const staticGet = <Route extends
|
|
168
|
+
const staticGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
|
|
169
169
|
route: Route,
|
|
170
|
-
data:
|
|
171
|
-
): Promise<
|
|
170
|
+
data: HTTPWiringHandlerOf<Route, 'GET'>['input'] = null
|
|
171
|
+
): Promise<HTTPWiringHandlerOf<Route, 'GET'>['output']> => {
|
|
172
172
|
return staticActionRequest(route, 'GET', data)
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -9,7 +9,7 @@ export const serializeNextJsHTTPWrapper = (
|
|
|
9
9
|
* It ensures type safety for route handling methods when integrating with the @pikku/core framework.
|
|
10
10
|
*/
|
|
11
11
|
import { CorePikkuFetchOptions } from '@pikku/fetch'
|
|
12
|
-
import type {
|
|
12
|
+
import type { HTTPWiringsMap, HTTPWiringHandlerOf, HTTPWiringsWithMethod } from '${routesMapPath}'
|
|
13
13
|
import { PikkuFetch } from '${pikkuFetchImport}'
|
|
14
14
|
|
|
15
15
|
let _pikku: PikkuFetch | undefined
|
|
@@ -25,13 +25,13 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const dynamicActionRequest = async <
|
|
28
|
-
Route extends keyof
|
|
29
|
-
Method extends keyof
|
|
28
|
+
Route extends keyof HTTPWiringsMap,
|
|
29
|
+
Method extends keyof HTTPWiringsMap[Route]
|
|
30
30
|
>(
|
|
31
31
|
route: Route,
|
|
32
32
|
method: Method,
|
|
33
|
-
data:
|
|
34
|
-
): Promise<
|
|
33
|
+
data: HTTPWiringHandlerOf<Route, Method>['input'] = null
|
|
34
|
+
): Promise<HTTPWiringHandlerOf<Route, Method>['output']> => {
|
|
35
35
|
return (_pikku! as any)[(method as string).toLowerCase()](route, data as any)
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -39,7 +39,7 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
39
39
|
* Makes a static action request for a specified route and method.
|
|
40
40
|
* Static requests do not depend on headers or cookies and are suitable for precompile stages.
|
|
41
41
|
*
|
|
42
|
-
* @template Route - The route key from the
|
|
42
|
+
* @template Route - The route key from the HTTPWiringsMap.
|
|
43
43
|
* @template Method - The method key from the specified route.
|
|
44
44
|
* @param route - The route identifier.
|
|
45
45
|
* @param method - The HTTP method to be used for the request.
|
|
@@ -47,13 +47,13 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
47
47
|
* @returns A promise that resolves to the output of the route handler.
|
|
48
48
|
*/
|
|
49
49
|
const staticActionRequest = async <
|
|
50
|
-
Route extends keyof
|
|
51
|
-
Method extends keyof
|
|
50
|
+
Route extends keyof HTTPWiringsMap,
|
|
51
|
+
Method extends keyof HTTPWiringsMap[Route]
|
|
52
52
|
>(
|
|
53
53
|
route: Route,
|
|
54
54
|
method: Method,
|
|
55
|
-
data:
|
|
56
|
-
): Promise<
|
|
55
|
+
data: HTTPWiringHandlerOf<Route, Method>['input'] = null
|
|
56
|
+
): Promise<HTTPWiringHandlerOf<Route, Method>['output']> => {
|
|
57
57
|
return (_pikku! as any)[(method as string).toLowerCase()](route, data as any)
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -65,10 +65,10 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
65
65
|
* @param data - The input data for the POST request, defaults to null.
|
|
66
66
|
* @returns A promise that resolves to the output of the POST handler.
|
|
67
67
|
*/
|
|
68
|
-
const dynamicPost = <Route extends
|
|
68
|
+
const dynamicPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
|
|
69
69
|
route: Route,
|
|
70
|
-
data:
|
|
71
|
-
): Promise<
|
|
70
|
+
data: HTTPWiringHandlerOf<Route, 'POST'>['input'] = null
|
|
71
|
+
): Promise<HTTPWiringHandlerOf<Route, 'POST'>['output']> => {
|
|
72
72
|
return dynamicActionRequest(route, 'POST', data)
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -80,10 +80,10 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
80
80
|
* @param data - The input data for the GET request, defaults to null.
|
|
81
81
|
* @returns A promise that resolves to the output of the GET handler.
|
|
82
82
|
*/
|
|
83
|
-
const dynamicGet = <Route extends
|
|
83
|
+
const dynamicGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
|
|
84
84
|
route: Route,
|
|
85
|
-
data:
|
|
86
|
-
): Promise<
|
|
85
|
+
data: HTTPWiringHandlerOf<Route, 'GET'>['input'] = null
|
|
86
|
+
): Promise<HTTPWiringHandlerOf<Route, 'GET'>['output']> => {
|
|
87
87
|
return dynamicActionRequest(route, 'GET', data)
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -95,10 +95,10 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
95
95
|
* @param data - The input data for the PATCH request, defaults to null.
|
|
96
96
|
* @returns A promise that resolves to the output of the PATCH handler.
|
|
97
97
|
*/
|
|
98
|
-
const dynamicPatch = <Route extends
|
|
98
|
+
const dynamicPatch = <Route extends HTTPWiringsWithMethod<'PATCH'>>(
|
|
99
99
|
route: Route,
|
|
100
|
-
data:
|
|
101
|
-
): Promise<
|
|
100
|
+
data: HTTPWiringHandlerOf<Route, 'PATCH'>['input'] = null
|
|
101
|
+
): Promise<HTTPWiringHandlerOf<Route, 'PATCH'>['output']> => {
|
|
102
102
|
return dynamicActionRequest(route, 'PATCH', data)
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -110,10 +110,10 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
110
110
|
* @param data - The input data for the DELETE request, defaults to null.
|
|
111
111
|
* @returns A promise that resolves to the output of the DELETE handler.
|
|
112
112
|
*/
|
|
113
|
-
const dynamicDel = <Route extends
|
|
113
|
+
const dynamicDel = <Route extends HTTPWiringsWithMethod<'DELETE'>>(
|
|
114
114
|
route: Route,
|
|
115
|
-
data:
|
|
116
|
-
): Promise<
|
|
115
|
+
data: HTTPWiringHandlerOf<Route, 'DELETE'>['input'] = null
|
|
116
|
+
): Promise<HTTPWiringHandlerOf<Route, 'DELETE'>['output']> => {
|
|
117
117
|
return dynamicActionRequest(route, 'DELETE', data)
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -127,10 +127,10 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
127
127
|
* @param data - The input data for the POST request, defaults to null.
|
|
128
128
|
* @returns A promise that resolves to the output of the POST handler.
|
|
129
129
|
*/
|
|
130
|
-
const staticPost = <Route extends
|
|
130
|
+
const staticPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
|
|
131
131
|
route: Route,
|
|
132
|
-
data:
|
|
133
|
-
): Promise<
|
|
132
|
+
data: HTTPWiringHandlerOf<Route, 'POST'>['input'] = null
|
|
133
|
+
): Promise<HTTPWiringHandlerOf<Route, 'POST'>['output']> => {
|
|
134
134
|
return staticActionRequest(route, 'POST', data)
|
|
135
135
|
}
|
|
136
136
|
|
|
@@ -142,10 +142,10 @@ export const pikku = (options?: CorePikkuFetchOptions) => {
|
|
|
142
142
|
* @param data - The input data for the GET request, defaults to null.
|
|
143
143
|
* @returns A promise that resolves to the output of the GET handler.
|
|
144
144
|
*/
|
|
145
|
-
const staticGet = <Route extends
|
|
145
|
+
const staticGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
|
|
146
146
|
route: Route,
|
|
147
|
-
data:
|
|
148
|
-
): Promise<
|
|
147
|
+
data: HTTPWiringHandlerOf<Route, 'GET'>['input'] = null
|
|
148
|
+
): Promise<HTTPWiringHandlerOf<Route, 'GET'>['output']> => {
|
|
149
149
|
return staticActionRequest(route, 'GET', data)
|
|
150
150
|
}
|
|
151
151
|
|
package/src/schema-generator.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { createGenerator, RootlessError } from 'ts-json-schema-generator'
|
|
|
2
2
|
import { CLILogger, writeFileInDir } from './utils.js'
|
|
3
3
|
import { mkdir, writeFile } from 'fs/promises'
|
|
4
4
|
import { FunctionsMeta, JSONValue } from '@pikku/core'
|
|
5
|
-
import {
|
|
5
|
+
import { HTTPWiringsMeta } from '@pikku/core/http'
|
|
6
6
|
import { TypesMap } from '@pikku/inspector'
|
|
7
7
|
|
|
8
8
|
export async function generateSchemas(
|
|
@@ -10,7 +10,7 @@ export async function generateSchemas(
|
|
|
10
10
|
tsconfig: string,
|
|
11
11
|
typesMap: TypesMap,
|
|
12
12
|
functionMeta: FunctionsMeta,
|
|
13
|
-
|
|
13
|
+
httpWiringsMeta: HTTPWiringsMeta
|
|
14
14
|
): Promise<Record<string, JSONValue>> {
|
|
15
15
|
const schemasSet = new Set(typesMap.customTypes.keys())
|
|
16
16
|
for (const { inputs, outputs } of Object.values(functionMeta)) {
|
|
@@ -22,7 +22,7 @@ export async function generateSchemas(
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
for (const { inputTypes } of
|
|
25
|
+
for (const { inputTypes } of httpWiringsMeta) {
|
|
26
26
|
if (inputTypes?.body) {
|
|
27
27
|
schemasSet.add(inputTypes.body)
|
|
28
28
|
}
|
|
@@ -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
|
) => {
|