@pikku/core 0.8.1 → 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 +13 -1
- package/dist/function/functions.types.d.ts +9 -9
- package/dist/handle-error.d.ts +1 -1
- package/dist/index.d.ts +11 -10
- package/dist/index.js +11 -10
- package/dist/pikku-state.d.ts +9 -9
- package/dist/services/user-session-service.d.ts +1 -1
- package/dist/types/core.types.d.ts +5 -5
- package/dist/types/core.types.js +9 -9
- package/dist/wirings/channel/channel-handler.d.ts +3 -0
- package/dist/{events → wirings}/channel/channel-handler.js +3 -3
- package/dist/wirings/channel/channel-runner.d.ts +14 -0
- package/dist/{events → wirings}/channel/channel-runner.js +13 -13
- package/dist/{events → wirings}/channel/channel.types.d.ts +7 -7
- package/dist/{events → wirings}/channel/eventhub-service.d.ts +4 -4
- package/dist/wirings/channel/eventhub-store.d.ts +5 -0
- package/dist/wirings/channel/local/local-channel-runner.d.ts +3 -0
- package/dist/{events → wirings}/channel/local/local-eventhub-service.d.ts +4 -4
- package/dist/{events → wirings}/channel/local/local-eventhub-service.js +1 -1
- package/dist/{events → wirings}/channel/serverless/serverless-channel-runner.d.ts +2 -2
- package/dist/{events → wirings}/http/http-runner.d.ts +12 -12
- package/dist/{events → wirings}/http/http-runner.js +15 -15
- package/dist/{events → wirings}/http/http.types.d.ts +32 -27
- package/dist/{events → wirings}/http/index.d.ts +1 -1
- package/dist/{events → wirings}/http/index.js +1 -1
- package/dist/{events → wirings}/mcp/mcp-endpoint-registry.d.ts +0 -1
- package/dist/{events → wirings}/mcp/mcp-endpoint-registry.js +0 -10
- package/dist/{events → wirings}/mcp/mcp-runner.d.ts +4 -4
- package/dist/{events → wirings}/mcp/mcp-runner.js +4 -4
- package/dist/{events → wirings}/mcp/mcp.types.d.ts +7 -7
- package/dist/{events → wirings}/queue/index.d.ts +1 -1
- package/dist/{events → wirings}/queue/index.js +1 -1
- package/dist/{events → wirings}/queue/queue-runner.d.ts +2 -2
- package/dist/{events → wirings}/queue/queue-runner.js +1 -1
- package/dist/{events → wirings}/queue/queue.types.d.ts +3 -3
- package/dist/wirings/scheduler/index.d.ts +3 -0
- package/dist/wirings/scheduler/index.js +3 -0
- package/dist/{events → wirings}/scheduler/scheduler-runner.d.ts +2 -2
- package/dist/{events → wirings}/scheduler/scheduler-runner.js +1 -1
- package/dist/{events → wirings}/scheduler/scheduler.types.d.ts +3 -3
- package/lcov.info +3072 -2982
- package/package.json +9 -9
- package/src/function/functions.types.ts +13 -13
- package/src/handle-error.ts +1 -1
- package/src/index.ts +14 -13
- package/src/pikku-state.ts +11 -11
- package/src/services/user-session-service.ts +1 -1
- package/src/types/core.types.ts +5 -5
- package/src/{events → wirings}/channel/channel-handler.ts +5 -5
- package/src/{events → wirings}/channel/channel-runner.ts +18 -18
- package/src/{events → wirings}/channel/channel.types.ts +16 -16
- package/src/{events → wirings}/channel/eventhub-service.ts +12 -8
- package/src/wirings/channel/eventhub-store.ts +13 -0
- package/src/{events → wirings}/channel/local/local-channel-runner.test.ts +2 -2
- package/src/{events → wirings}/channel/local/local-channel-runner.ts +2 -2
- package/src/{events → wirings}/channel/local/local-eventhub-service.ts +16 -10
- package/src/{events → wirings}/channel/serverless/serverless-channel-runner.ts +2 -2
- package/src/{events → wirings}/http/http-runner.test.ts +4 -4
- package/src/{events → wirings}/http/http-runner.ts +32 -31
- package/src/{events → wirings}/http/http.types.ts +40 -35
- package/src/{events → wirings}/http/index.ts +1 -1
- package/src/wirings/mcp/mcp-endpoint-registry.test.js +338 -0
- package/src/wirings/mcp/mcp-endpoint-registry.test.js.map +1 -0
- package/src/{events → wirings}/mcp/mcp-endpoint-registry.ts +0 -10
- package/src/{events → wirings}/mcp/mcp-runner.ts +10 -10
- package/src/{events → wirings}/mcp/mcp.types.ts +9 -7
- package/src/{events → wirings}/queue/index.ts +1 -1
- package/src/{events → wirings}/queue/queue-runner.ts +5 -5
- package/src/{events → wirings}/queue/queue.types.ts +3 -3
- package/src/{events → wirings}/scheduler/index.ts +1 -1
- package/src/{events → wirings}/scheduler/scheduler-runner.ts +4 -4
- package/src/{events → wirings}/scheduler/scheduler.types.ts +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/events/channel/channel-handler.d.ts +0 -3
- package/dist/events/channel/channel-runner.d.ts +0 -14
- package/dist/events/channel/eventhub-store.d.ts +0 -5
- package/dist/events/channel/local/local-channel-runner.d.ts +0 -3
- package/dist/events/scheduler/index.d.ts +0 -3
- package/dist/events/scheduler/index.js +0 -3
- package/src/events/channel/eventhub-store.ts +0 -8
- /package/dist/{events → wirings}/channel/channel-store.d.ts +0 -0
- /package/dist/{events → wirings}/channel/channel-store.js +0 -0
- /package/dist/{events → wirings}/channel/channel.types.js +0 -0
- /package/dist/{events → wirings}/channel/eventhub-service.js +0 -0
- /package/dist/{events → wirings}/channel/eventhub-store.js +0 -0
- /package/dist/{events → wirings}/channel/index.d.ts +0 -0
- /package/dist/{events → wirings}/channel/index.js +0 -0
- /package/dist/{events → wirings}/channel/local/index.d.ts +0 -0
- /package/dist/{events → wirings}/channel/local/index.js +0 -0
- /package/dist/{events → wirings}/channel/local/local-channel-handler.d.ts +0 -0
- /package/dist/{events → wirings}/channel/local/local-channel-handler.js +0 -0
- /package/dist/{events → wirings}/channel/local/local-channel-runner.js +0 -0
- /package/dist/{events → wirings}/channel/log-channels.d.ts +0 -0
- /package/dist/{events → wirings}/channel/log-channels.js +0 -0
- /package/dist/{events → wirings}/channel/pikku-abstract-channel-handler.d.ts +0 -0
- /package/dist/{events → wirings}/channel/pikku-abstract-channel-handler.js +0 -0
- /package/dist/{events → wirings}/channel/serverless/index.d.ts +0 -0
- /package/dist/{events → wirings}/channel/serverless/index.js +0 -0
- /package/dist/{events → wirings}/channel/serverless/serverless-channel-runner.js +0 -0
- /package/dist/{events → wirings}/http/http.types.js +0 -0
- /package/dist/{events → wirings}/http/log-http-routes.d.ts +0 -0
- /package/dist/{events → wirings}/http/log-http-routes.js +0 -0
- /package/dist/{events → wirings}/http/pikku-fetch-http-request.d.ts +0 -0
- /package/dist/{events → wirings}/http/pikku-fetch-http-request.js +0 -0
- /package/dist/{events → wirings}/http/pikku-fetch-http-response.d.ts +0 -0
- /package/dist/{events → wirings}/http/pikku-fetch-http-response.js +0 -0
- /package/dist/{events → wirings}/mcp/index.d.ts +0 -0
- /package/dist/{events → wirings}/mcp/index.js +0 -0
- /package/dist/{events → wirings}/mcp/mcp.types.js +0 -0
- /package/dist/{events → wirings}/queue/queue.types.js +0 -0
- /package/dist/{events → wirings}/queue/register-queue-helper.d.ts +0 -0
- /package/dist/{events → wirings}/queue/register-queue-helper.js +0 -0
- /package/dist/{events → wirings}/queue/validate-worker-config.d.ts +0 -0
- /package/dist/{events → wirings}/queue/validate-worker-config.js +0 -0
- /package/dist/{events → wirings}/rpc/index.d.ts +0 -0
- /package/dist/{events → wirings}/rpc/index.js +0 -0
- /package/dist/{events → wirings}/rpc/rpc-runner.d.ts +0 -0
- /package/dist/{events → wirings}/rpc/rpc-runner.js +0 -0
- /package/dist/{events → wirings}/rpc/rpc-types.d.ts +0 -0
- /package/dist/{events → wirings}/rpc/rpc-types.js +0 -0
- /package/dist/{events → wirings}/scheduler/log-schedulers.d.ts +0 -0
- /package/dist/{events → wirings}/scheduler/log-schedulers.js +0 -0
- /package/dist/{events → wirings}/scheduler/scheduler.types.js +0 -0
- /package/src/{events → wirings}/channel/channel-store.ts +0 -0
- /package/src/{events → wirings}/channel/index.ts +0 -0
- /package/src/{events → wirings}/channel/local/index.ts +0 -0
- /package/src/{events → wirings}/channel/local/local-channel-handler.ts +0 -0
- /package/src/{events → wirings}/channel/local/local-eventhub-service.test.ts +0 -0
- /package/src/{events → wirings}/channel/log-channels.ts +0 -0
- /package/src/{events → wirings}/channel/pikku-abstract-channel-handler.test.ts +0 -0
- /package/src/{events → wirings}/channel/pikku-abstract-channel-handler.ts +0 -0
- /package/src/{events → wirings}/channel/serverless/index.ts +0 -0
- /package/src/{events → wirings}/http/log-http-routes.ts +0 -0
- /package/src/{events → wirings}/http/pikku-fetch-http-request.test.ts +0 -0
- /package/src/{events → wirings}/http/pikku-fetch-http-request.ts +0 -0
- /package/src/{events → wirings}/http/pikku-fetch-http-response.test.ts +0 -0
- /package/src/{events → wirings}/http/pikku-fetch-http-response.ts +0 -0
- /package/src/{events → wirings}/mcp/index.ts +0 -0
- /package/src/{events → wirings}/mcp/mcp-endpoint-registry.test.d.ts +0 -0
- /package/src/{events → wirings}/mcp/mcp-endpoint-registry.test.ts +0 -0
- /package/src/{events → wirings}/queue/register-queue-helper.ts +0 -0
- /package/src/{events → wirings}/queue/validate-worker-config.ts +0 -0
- /package/src/{events → wirings}/rpc/index.ts +0 -0
- /package/src/{events → wirings}/rpc/rpc-runner.ts +0 -0
- /package/src/{events → wirings}/rpc/rpc-types.ts +0 -0
- /package/src/{events → wirings}/scheduler/log-schedulers.ts +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
CoreHTTPFunctionWiring,
|
|
3
|
+
RunHTTPWiringOptions,
|
|
4
|
+
RunHTTPWiringParams,
|
|
5
5
|
PikkuHTTP,
|
|
6
6
|
PikkuHTTPRequest,
|
|
7
7
|
PikkuHTTPResponse,
|
|
8
|
-
|
|
8
|
+
HTTPWiringMeta,
|
|
9
9
|
HTTPMethod,
|
|
10
10
|
} from './http.types.js'
|
|
11
11
|
import {
|
|
@@ -87,48 +87,49 @@ export const addMiddleware = <APIMiddleware extends PikkuMiddleware>(
|
|
|
87
87
|
* @template In Expected input type.
|
|
88
88
|
* @template Out Expected output type.
|
|
89
89
|
* @template Route Route pattern as a string.
|
|
90
|
-
* @template
|
|
91
|
-
* @template
|
|
92
|
-
* @template
|
|
90
|
+
* @template PikkuFunction Type for the route handler function.
|
|
91
|
+
* @template PikkuFunctionSessionless Type for a sessionless handler.
|
|
92
|
+
* @template PikkuPermissionGroup Type representing required permissions.
|
|
93
93
|
* @template APIMiddleware Middleware type to be used with the route.
|
|
94
|
-
* @param {
|
|
94
|
+
* @param {CoreHTTPFunctionWiring<In, Out, Route, PikkuFunction, PikkuFunctionSessionless, PikkuPermission, APIMiddleware>} httpWiring - The HTTP wiring configuration object.
|
|
95
95
|
*/
|
|
96
|
-
export const
|
|
96
|
+
export const wireHTTP = <
|
|
97
97
|
In,
|
|
98
98
|
Out,
|
|
99
99
|
Route extends string,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
PikkuFunction,
|
|
101
|
+
PikkuFunctionSessionless,
|
|
102
|
+
PikkuPermissionGroup,
|
|
103
103
|
APIMiddleware,
|
|
104
104
|
>(
|
|
105
|
-
|
|
105
|
+
httpWiring: CoreHTTPFunctionWiring<
|
|
106
106
|
In,
|
|
107
107
|
Out,
|
|
108
108
|
Route,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
PikkuFunction,
|
|
110
|
+
PikkuFunctionSessionless,
|
|
111
|
+
PikkuPermissionGroup,
|
|
112
112
|
APIMiddleware
|
|
113
113
|
>
|
|
114
114
|
) => {
|
|
115
115
|
const httpMeta = pikkuState('http', 'meta')
|
|
116
116
|
const routeMeta = httpMeta.find(
|
|
117
|
-
(meta) =>
|
|
117
|
+
(meta) =>
|
|
118
|
+
meta.route === httpWiring.route && meta.method === httpWiring.method
|
|
118
119
|
)
|
|
119
120
|
if (!routeMeta) {
|
|
120
121
|
throw new Error('Route metadata not found')
|
|
121
122
|
}
|
|
122
123
|
addFunction(routeMeta.pikkuFuncName, {
|
|
123
|
-
func:
|
|
124
|
+
func: httpWiring.func,
|
|
124
125
|
})
|
|
125
126
|
const routes = pikkuState('http', 'routes')
|
|
126
|
-
if (!routes.has(
|
|
127
|
-
routes.set(
|
|
127
|
+
if (!routes.has(httpWiring.method)) {
|
|
128
|
+
routes.set(httpWiring.method, new Map())
|
|
128
129
|
}
|
|
129
130
|
pikkuState('http', 'routes')
|
|
130
|
-
.get(
|
|
131
|
-
?.set(
|
|
131
|
+
.get(httpWiring.method)
|
|
132
|
+
?.set(httpWiring.route, httpWiring as any)
|
|
132
133
|
}
|
|
133
134
|
|
|
134
135
|
/**
|
|
@@ -242,9 +243,9 @@ const executeRouteWithMiddleware = async (
|
|
|
242
243
|
matchedRoute: {
|
|
243
244
|
matchedPath: any
|
|
244
245
|
params: any
|
|
245
|
-
route:
|
|
246
|
+
route: CoreHTTPFunctionWiring<any, any, any>
|
|
246
247
|
middleware: any[]
|
|
247
|
-
meta:
|
|
248
|
+
meta: HTTPWiringMeta
|
|
248
249
|
},
|
|
249
250
|
http: PikkuHTTP,
|
|
250
251
|
options: {
|
|
@@ -290,7 +291,7 @@ const executeRouteWithMiddleware = async (
|
|
|
290
291
|
throw new MissingSessionError()
|
|
291
292
|
}
|
|
292
293
|
|
|
293
|
-
const data = http.request!.data()
|
|
294
|
+
const data = await http.request!.data()
|
|
294
295
|
|
|
295
296
|
const getAllServices = async () => {
|
|
296
297
|
let channel: PikkuChannel<unknown, unknown> | undefined
|
|
@@ -382,12 +383,12 @@ const executeRouteWithMiddleware = async (
|
|
|
382
383
|
* @template In Expected input data type.
|
|
383
384
|
* @template Out Expected output data type.
|
|
384
385
|
* @param {Request} request - The native Fetch API Request object.
|
|
385
|
-
* @param {
|
|
386
|
+
* @param {RunHTTPWiringOptions & RunHTTPWiringParams} params - Additional options including services and session management.
|
|
386
387
|
* @returns {Promise<Response>} A promise that resolves to a Fetch API Response object.
|
|
387
388
|
*/
|
|
388
389
|
export const fetch = async <In, Out>(
|
|
389
390
|
request: Request,
|
|
390
|
-
params:
|
|
391
|
+
params: RunHTTPWiringOptions & RunHTTPWiringParams
|
|
391
392
|
): Promise<Response> => {
|
|
392
393
|
const pikkuResponse = new PikkuFetchHTTPResponse()
|
|
393
394
|
await fetchData<In, Out>(request, pikkuResponse, params)
|
|
@@ -403,12 +404,12 @@ export const fetch = async <In, Out>(
|
|
|
403
404
|
* @template In Expected input data type.
|
|
404
405
|
* @template Out Expected output data type.
|
|
405
406
|
* @param {Request | PikkuHTTPRequest} request - The request object.
|
|
406
|
-
* @param {
|
|
407
|
+
* @param {RunHTTPWiringOptions & RunHTTPWiringParams} params - Execution options including services and session configuration.
|
|
407
408
|
* @returns {Promise<PikkuFetchHTTPResponse>} A promise that resolves to a PikkuFetchHTTPResponse object.
|
|
408
409
|
*/
|
|
409
410
|
export const pikkuFetch = async <In, Out>(
|
|
410
411
|
request: Request | PikkuHTTPRequest,
|
|
411
|
-
params:
|
|
412
|
+
params: RunHTTPWiringOptions & RunHTTPWiringParams
|
|
412
413
|
): Promise<PikkuFetchHTTPResponse> => {
|
|
413
414
|
const pikkuResponse = new PikkuFetchHTTPResponse()
|
|
414
415
|
await fetchData<In, Out>(request, pikkuResponse, params)
|
|
@@ -430,7 +431,7 @@ export const pikkuFetch = async <In, Out>(
|
|
|
430
431
|
* @template Out Expected output data type.
|
|
431
432
|
* @param {Request | PikkuHTTPRequest} request - The incoming HTTP request.
|
|
432
433
|
* @param {PikkuHTTPResponse} response - The response object to be populated.
|
|
433
|
-
* @param {
|
|
434
|
+
* @param {RunHTTPWiringOptions & RunHTTPWiringParams} options - Options such as singleton services, session handling, and error configuration.
|
|
434
435
|
* @returns {Promise<Out | void>} The output from the route handler or void if an error occurred.
|
|
435
436
|
*/
|
|
436
437
|
export const fetchData = async <In, Out>(
|
|
@@ -446,7 +447,7 @@ export const fetchData = async <In, Out>(
|
|
|
446
447
|
bubbleErrors = false,
|
|
447
448
|
generateRequestId,
|
|
448
449
|
ignoreMiddleware = false,
|
|
449
|
-
}:
|
|
450
|
+
}: RunHTTPWiringOptions & RunHTTPWiringParams
|
|
450
451
|
): Promise<Out | void> => {
|
|
451
452
|
const requestId =
|
|
452
453
|
(request as any).getHeader?.('x-request-id') ||
|
|
@@ -9,25 +9,30 @@ import type {
|
|
|
9
9
|
PikkuMiddleware,
|
|
10
10
|
} from '../../types/core.types.js'
|
|
11
11
|
import type {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
CorePikkuFunction,
|
|
13
|
+
CorePikkuFunctionSessionless,
|
|
14
|
+
CorePikkuPermission,
|
|
15
15
|
CorePermissionGroup,
|
|
16
16
|
} from '../../function/functions.types.js'
|
|
17
17
|
|
|
18
|
-
type
|
|
18
|
+
type ExtractHTTPWiringParams<S extends string> =
|
|
19
19
|
S extends `${string}:${infer Param}/${infer Rest}`
|
|
20
|
-
? Param |
|
|
20
|
+
? Param | ExtractHTTPWiringParams<`/${Rest}`>
|
|
21
21
|
: S extends `${string}:${infer Param}`
|
|
22
22
|
? Param
|
|
23
23
|
: never
|
|
24
24
|
|
|
25
|
-
export type
|
|
26
|
-
|
|
25
|
+
export type AssertHTTPWiringParams<In, HTTPWiring extends string> =
|
|
26
|
+
ExtractHTTPWiringParams<HTTPWiring> extends keyof In
|
|
27
27
|
? unknown
|
|
28
|
-
: [
|
|
28
|
+
: [
|
|
29
|
+
'Error: HTTPWiring parameters',
|
|
30
|
+
ExtractHTTPWiringParams<HTTPWiring>,
|
|
31
|
+
'not in',
|
|
32
|
+
keyof In,
|
|
33
|
+
]
|
|
29
34
|
|
|
30
|
-
export type
|
|
35
|
+
export type RunHTTPWiringOptions = Partial<{
|
|
31
36
|
skipUserSession: boolean
|
|
32
37
|
respondWith404: boolean
|
|
33
38
|
logWarningsForStatusCodes: number[]
|
|
@@ -37,7 +42,7 @@ export type RunRouteOptions = Partial<{
|
|
|
37
42
|
ignoreMiddleware: boolean
|
|
38
43
|
}>
|
|
39
44
|
|
|
40
|
-
export type
|
|
45
|
+
export type RunHTTPWiringParams = {
|
|
41
46
|
singletonServices: CoreSingletonServices
|
|
42
47
|
createSessionServices: CreateSessionServices<
|
|
43
48
|
CoreSingletonServices,
|
|
@@ -47,8 +52,8 @@ export type RunRouteParams = {
|
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
/**
|
|
50
|
-
* Represents the HTTP methods supported for API
|
|
51
|
-
*/
|
|
55
|
+
* Represents the HTTP methods supported for API HTTP wirings.
|
|
56
|
+
t */
|
|
52
57
|
export type HTTPMethod =
|
|
53
58
|
| 'post'
|
|
54
59
|
| 'get'
|
|
@@ -59,7 +64,7 @@ export type HTTPMethod =
|
|
|
59
64
|
| 'options'
|
|
60
65
|
|
|
61
66
|
/**
|
|
62
|
-
* Represents an API
|
|
67
|
+
* Represents an API HTTP wiring without a function, including metadata such as content type, route, and timeout settings.
|
|
63
68
|
*/
|
|
64
69
|
export type CoreHTTPFunction = {
|
|
65
70
|
contentType?: 'xml' | 'json'
|
|
@@ -98,29 +103,29 @@ export type PikkuQuery<T = Record<string, string | undefined>> = Record<
|
|
|
98
103
|
>
|
|
99
104
|
|
|
100
105
|
/**
|
|
101
|
-
* Represents a core API
|
|
106
|
+
* Represents a core API HTTP wiring, which can have different configurations depending on whether it requires authentication and permissions.
|
|
102
107
|
*
|
|
103
108
|
* @template In - The input type.
|
|
104
109
|
* @template Out - The output type.
|
|
105
110
|
* @template R - The route string type.
|
|
106
|
-
* @template
|
|
107
|
-
* @template
|
|
108
|
-
* @template
|
|
111
|
+
* @template PikkuFunction - The API function type, defaults to `CorePikkuFunction`.
|
|
112
|
+
* @template PikkuFunctionSessionless - The sessionless API function type, defaults to `CorePikkuFunctionSessionless`.
|
|
113
|
+
* @template PikkuPermission - The permission function type, defaults to `CorePikkuPermission`.
|
|
109
114
|
*/
|
|
110
|
-
export type
|
|
115
|
+
export type CoreHTTPFunctionWiring<
|
|
111
116
|
In,
|
|
112
117
|
Out,
|
|
113
118
|
R extends string,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
119
|
+
PikkuFunction = CorePikkuFunction<In, Out>,
|
|
120
|
+
PikkuFunctionSessionless = CorePikkuFunctionSessionless<In, Out>,
|
|
121
|
+
PikkuPermission = CorePikkuPermission<In>,
|
|
117
122
|
APIMiddleware = PikkuMiddleware,
|
|
118
123
|
> =
|
|
119
124
|
| (CoreHTTPFunction & {
|
|
120
125
|
route: R
|
|
121
126
|
method: HTTPMethod
|
|
122
|
-
func:
|
|
123
|
-
permissions?: CorePermissionGroup<
|
|
127
|
+
func: PikkuFunction
|
|
128
|
+
permissions?: CorePermissionGroup<PikkuPermission>
|
|
124
129
|
auth?: true
|
|
125
130
|
tags?: string[]
|
|
126
131
|
middleware?: APIMiddleware[]
|
|
@@ -129,7 +134,7 @@ export type CoreHTTPFunctionRoute<
|
|
|
129
134
|
| (CoreHTTPFunction & {
|
|
130
135
|
route: R
|
|
131
136
|
method: HTTPMethod
|
|
132
|
-
func:
|
|
137
|
+
func: PikkuFunctionSessionless
|
|
133
138
|
permissions?: undefined
|
|
134
139
|
auth?: false
|
|
135
140
|
tags?: string[]
|
|
@@ -139,8 +144,8 @@ export type CoreHTTPFunctionRoute<
|
|
|
139
144
|
| (CoreHTTPFunction & {
|
|
140
145
|
route: R
|
|
141
146
|
method: 'get'
|
|
142
|
-
func:
|
|
143
|
-
permissions?: CorePermissionGroup<
|
|
147
|
+
func: PikkuFunction
|
|
148
|
+
permissions?: CorePermissionGroup<PikkuPermission>
|
|
144
149
|
auth?: true
|
|
145
150
|
sse?: boolean
|
|
146
151
|
tags?: string[]
|
|
@@ -149,7 +154,7 @@ export type CoreHTTPFunctionRoute<
|
|
|
149
154
|
| (CoreHTTPFunction & {
|
|
150
155
|
route: R
|
|
151
156
|
method: 'get'
|
|
152
|
-
func:
|
|
157
|
+
func: PikkuFunctionSessionless
|
|
153
158
|
permissions?: undefined
|
|
154
159
|
auth?: false
|
|
155
160
|
sse?: boolean
|
|
@@ -159,8 +164,8 @@ export type CoreHTTPFunctionRoute<
|
|
|
159
164
|
| (CoreHTTPFunction & {
|
|
160
165
|
route: R
|
|
161
166
|
method: 'post'
|
|
162
|
-
func:
|
|
163
|
-
permissions?: CorePermissionGroup<
|
|
167
|
+
func: PikkuFunction
|
|
168
|
+
permissions?: CorePermissionGroup<PikkuPermission>
|
|
164
169
|
auth?: true
|
|
165
170
|
query?: Array<keyof In>
|
|
166
171
|
tags?: string[]
|
|
@@ -170,7 +175,7 @@ export type CoreHTTPFunctionRoute<
|
|
|
170
175
|
| (CoreHTTPFunction & {
|
|
171
176
|
route: R
|
|
172
177
|
method: 'post'
|
|
173
|
-
func:
|
|
178
|
+
func: PikkuFunctionSessionless
|
|
174
179
|
permissions?: undefined
|
|
175
180
|
auth?: false
|
|
176
181
|
query?: Array<keyof In>
|
|
@@ -180,7 +185,7 @@ export type CoreHTTPFunctionRoute<
|
|
|
180
185
|
})
|
|
181
186
|
|
|
182
187
|
/**
|
|
183
|
-
* Represents the input types for
|
|
188
|
+
* Represents the input types for HTTP wiring metadata, including parameters, query, and body types.
|
|
184
189
|
*/
|
|
185
190
|
export type HTTPFunctionMetaInputTypes = {
|
|
186
191
|
params?: string
|
|
@@ -189,9 +194,9 @@ export type HTTPFunctionMetaInputTypes = {
|
|
|
189
194
|
}
|
|
190
195
|
|
|
191
196
|
/**
|
|
192
|
-
* Represents metadata for a set of
|
|
197
|
+
* Represents metadata for a set of HTTP wirings, including HTTP wiring details, methods, input/output types, and documentation.
|
|
193
198
|
*/
|
|
194
|
-
export type
|
|
199
|
+
export type HTTPWiringMeta = {
|
|
195
200
|
pikkuFuncName: string
|
|
196
201
|
route: string
|
|
197
202
|
method: HTTPMethod
|
|
@@ -202,7 +207,7 @@ export type HTTPRouteMeta = {
|
|
|
202
207
|
tags?: string[]
|
|
203
208
|
sse?: true
|
|
204
209
|
}
|
|
205
|
-
export type
|
|
210
|
+
export type HTTPWiringsMeta = Array<HTTPWiringMeta>
|
|
206
211
|
|
|
207
212
|
export type HTTPFunctionsMeta = Array<{
|
|
208
213
|
name: string
|
|
@@ -210,7 +215,7 @@ export type HTTPFunctionsMeta = Array<{
|
|
|
210
215
|
outputs: string[] | null
|
|
211
216
|
}>
|
|
212
217
|
|
|
213
|
-
export type
|
|
218
|
+
export type HTTPWiringMiddleware = {
|
|
214
219
|
route: string
|
|
215
220
|
middleware: PikkuMiddleware[]
|
|
216
221
|
}
|
|
@@ -2,6 +2,6 @@ export * from './pikku-fetch-http-request.js'
|
|
|
2
2
|
export * from './pikku-fetch-http-response.js'
|
|
3
3
|
export * from './log-http-routes.js'
|
|
4
4
|
|
|
5
|
-
export { fetch, fetchData,
|
|
5
|
+
export { fetch, fetchData, wireHTTP } from './http-runner.js'
|
|
6
6
|
|
|
7
7
|
export type * from './http.types.js'
|