@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.
Files changed (146) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/dist/function/functions.types.d.ts +9 -9
  3. package/dist/handle-error.d.ts +1 -1
  4. package/dist/index.d.ts +11 -10
  5. package/dist/index.js +11 -10
  6. package/dist/pikku-state.d.ts +9 -9
  7. package/dist/services/user-session-service.d.ts +1 -1
  8. package/dist/types/core.types.d.ts +5 -5
  9. package/dist/types/core.types.js +9 -9
  10. package/dist/wirings/channel/channel-handler.d.ts +3 -0
  11. package/dist/{events → wirings}/channel/channel-handler.js +3 -3
  12. package/dist/wirings/channel/channel-runner.d.ts +14 -0
  13. package/dist/{events → wirings}/channel/channel-runner.js +13 -13
  14. package/dist/{events → wirings}/channel/channel.types.d.ts +7 -7
  15. package/dist/{events → wirings}/channel/eventhub-service.d.ts +4 -4
  16. package/dist/wirings/channel/eventhub-store.d.ts +5 -0
  17. package/dist/wirings/channel/local/local-channel-runner.d.ts +3 -0
  18. package/dist/{events → wirings}/channel/local/local-eventhub-service.d.ts +4 -4
  19. package/dist/{events → wirings}/channel/local/local-eventhub-service.js +1 -1
  20. package/dist/{events → wirings}/channel/serverless/serverless-channel-runner.d.ts +2 -2
  21. package/dist/{events → wirings}/http/http-runner.d.ts +12 -12
  22. package/dist/{events → wirings}/http/http-runner.js +15 -15
  23. package/dist/{events → wirings}/http/http.types.d.ts +32 -27
  24. package/dist/{events → wirings}/http/index.d.ts +1 -1
  25. package/dist/{events → wirings}/http/index.js +1 -1
  26. package/dist/{events → wirings}/mcp/mcp-endpoint-registry.d.ts +0 -1
  27. package/dist/{events → wirings}/mcp/mcp-endpoint-registry.js +0 -10
  28. package/dist/{events → wirings}/mcp/mcp-runner.d.ts +4 -4
  29. package/dist/{events → wirings}/mcp/mcp-runner.js +4 -4
  30. package/dist/{events → wirings}/mcp/mcp.types.d.ts +7 -7
  31. package/dist/{events → wirings}/queue/index.d.ts +1 -1
  32. package/dist/{events → wirings}/queue/index.js +1 -1
  33. package/dist/{events → wirings}/queue/queue-runner.d.ts +2 -2
  34. package/dist/{events → wirings}/queue/queue-runner.js +1 -1
  35. package/dist/{events → wirings}/queue/queue.types.d.ts +3 -3
  36. package/dist/wirings/scheduler/index.d.ts +3 -0
  37. package/dist/wirings/scheduler/index.js +3 -0
  38. package/dist/{events → wirings}/scheduler/scheduler-runner.d.ts +2 -2
  39. package/dist/{events → wirings}/scheduler/scheduler-runner.js +1 -1
  40. package/dist/{events → wirings}/scheduler/scheduler.types.d.ts +3 -3
  41. package/lcov.info +3072 -2982
  42. package/package.json +9 -9
  43. package/src/function/functions.types.ts +13 -13
  44. package/src/handle-error.ts +1 -1
  45. package/src/index.ts +14 -13
  46. package/src/pikku-state.ts +11 -11
  47. package/src/services/user-session-service.ts +1 -1
  48. package/src/types/core.types.ts +5 -5
  49. package/src/{events → wirings}/channel/channel-handler.ts +5 -5
  50. package/src/{events → wirings}/channel/channel-runner.ts +18 -18
  51. package/src/{events → wirings}/channel/channel.types.ts +16 -16
  52. package/src/{events → wirings}/channel/eventhub-service.ts +12 -8
  53. package/src/wirings/channel/eventhub-store.ts +13 -0
  54. package/src/{events → wirings}/channel/local/local-channel-runner.test.ts +2 -2
  55. package/src/{events → wirings}/channel/local/local-channel-runner.ts +2 -2
  56. package/src/{events → wirings}/channel/local/local-eventhub-service.ts +16 -10
  57. package/src/{events → wirings}/channel/serverless/serverless-channel-runner.ts +2 -2
  58. package/src/{events → wirings}/http/http-runner.test.ts +4 -4
  59. package/src/{events → wirings}/http/http-runner.ts +32 -31
  60. package/src/{events → wirings}/http/http.types.ts +40 -35
  61. package/src/{events → wirings}/http/index.ts +1 -1
  62. package/src/wirings/mcp/mcp-endpoint-registry.test.js +338 -0
  63. package/src/wirings/mcp/mcp-endpoint-registry.test.js.map +1 -0
  64. package/src/{events → wirings}/mcp/mcp-endpoint-registry.ts +0 -10
  65. package/src/{events → wirings}/mcp/mcp-runner.ts +10 -10
  66. package/src/{events → wirings}/mcp/mcp.types.ts +9 -7
  67. package/src/{events → wirings}/queue/index.ts +1 -1
  68. package/src/{events → wirings}/queue/queue-runner.ts +5 -5
  69. package/src/{events → wirings}/queue/queue.types.ts +3 -3
  70. package/src/{events → wirings}/scheduler/index.ts +1 -1
  71. package/src/{events → wirings}/scheduler/scheduler-runner.ts +4 -4
  72. package/src/{events → wirings}/scheduler/scheduler.types.ts +3 -3
  73. package/tsconfig.tsbuildinfo +1 -1
  74. package/dist/events/channel/channel-handler.d.ts +0 -3
  75. package/dist/events/channel/channel-runner.d.ts +0 -14
  76. package/dist/events/channel/eventhub-store.d.ts +0 -5
  77. package/dist/events/channel/local/local-channel-runner.d.ts +0 -3
  78. package/dist/events/scheduler/index.d.ts +0 -3
  79. package/dist/events/scheduler/index.js +0 -3
  80. package/src/events/channel/eventhub-store.ts +0 -8
  81. /package/dist/{events → wirings}/channel/channel-store.d.ts +0 -0
  82. /package/dist/{events → wirings}/channel/channel-store.js +0 -0
  83. /package/dist/{events → wirings}/channel/channel.types.js +0 -0
  84. /package/dist/{events → wirings}/channel/eventhub-service.js +0 -0
  85. /package/dist/{events → wirings}/channel/eventhub-store.js +0 -0
  86. /package/dist/{events → wirings}/channel/index.d.ts +0 -0
  87. /package/dist/{events → wirings}/channel/index.js +0 -0
  88. /package/dist/{events → wirings}/channel/local/index.d.ts +0 -0
  89. /package/dist/{events → wirings}/channel/local/index.js +0 -0
  90. /package/dist/{events → wirings}/channel/local/local-channel-handler.d.ts +0 -0
  91. /package/dist/{events → wirings}/channel/local/local-channel-handler.js +0 -0
  92. /package/dist/{events → wirings}/channel/local/local-channel-runner.js +0 -0
  93. /package/dist/{events → wirings}/channel/log-channels.d.ts +0 -0
  94. /package/dist/{events → wirings}/channel/log-channels.js +0 -0
  95. /package/dist/{events → wirings}/channel/pikku-abstract-channel-handler.d.ts +0 -0
  96. /package/dist/{events → wirings}/channel/pikku-abstract-channel-handler.js +0 -0
  97. /package/dist/{events → wirings}/channel/serverless/index.d.ts +0 -0
  98. /package/dist/{events → wirings}/channel/serverless/index.js +0 -0
  99. /package/dist/{events → wirings}/channel/serverless/serverless-channel-runner.js +0 -0
  100. /package/dist/{events → wirings}/http/http.types.js +0 -0
  101. /package/dist/{events → wirings}/http/log-http-routes.d.ts +0 -0
  102. /package/dist/{events → wirings}/http/log-http-routes.js +0 -0
  103. /package/dist/{events → wirings}/http/pikku-fetch-http-request.d.ts +0 -0
  104. /package/dist/{events → wirings}/http/pikku-fetch-http-request.js +0 -0
  105. /package/dist/{events → wirings}/http/pikku-fetch-http-response.d.ts +0 -0
  106. /package/dist/{events → wirings}/http/pikku-fetch-http-response.js +0 -0
  107. /package/dist/{events → wirings}/mcp/index.d.ts +0 -0
  108. /package/dist/{events → wirings}/mcp/index.js +0 -0
  109. /package/dist/{events → wirings}/mcp/mcp.types.js +0 -0
  110. /package/dist/{events → wirings}/queue/queue.types.js +0 -0
  111. /package/dist/{events → wirings}/queue/register-queue-helper.d.ts +0 -0
  112. /package/dist/{events → wirings}/queue/register-queue-helper.js +0 -0
  113. /package/dist/{events → wirings}/queue/validate-worker-config.d.ts +0 -0
  114. /package/dist/{events → wirings}/queue/validate-worker-config.js +0 -0
  115. /package/dist/{events → wirings}/rpc/index.d.ts +0 -0
  116. /package/dist/{events → wirings}/rpc/index.js +0 -0
  117. /package/dist/{events → wirings}/rpc/rpc-runner.d.ts +0 -0
  118. /package/dist/{events → wirings}/rpc/rpc-runner.js +0 -0
  119. /package/dist/{events → wirings}/rpc/rpc-types.d.ts +0 -0
  120. /package/dist/{events → wirings}/rpc/rpc-types.js +0 -0
  121. /package/dist/{events → wirings}/scheduler/log-schedulers.d.ts +0 -0
  122. /package/dist/{events → wirings}/scheduler/log-schedulers.js +0 -0
  123. /package/dist/{events → wirings}/scheduler/scheduler.types.js +0 -0
  124. /package/src/{events → wirings}/channel/channel-store.ts +0 -0
  125. /package/src/{events → wirings}/channel/index.ts +0 -0
  126. /package/src/{events → wirings}/channel/local/index.ts +0 -0
  127. /package/src/{events → wirings}/channel/local/local-channel-handler.ts +0 -0
  128. /package/src/{events → wirings}/channel/local/local-eventhub-service.test.ts +0 -0
  129. /package/src/{events → wirings}/channel/log-channels.ts +0 -0
  130. /package/src/{events → wirings}/channel/pikku-abstract-channel-handler.test.ts +0 -0
  131. /package/src/{events → wirings}/channel/pikku-abstract-channel-handler.ts +0 -0
  132. /package/src/{events → wirings}/channel/serverless/index.ts +0 -0
  133. /package/src/{events → wirings}/http/log-http-routes.ts +0 -0
  134. /package/src/{events → wirings}/http/pikku-fetch-http-request.test.ts +0 -0
  135. /package/src/{events → wirings}/http/pikku-fetch-http-request.ts +0 -0
  136. /package/src/{events → wirings}/http/pikku-fetch-http-response.test.ts +0 -0
  137. /package/src/{events → wirings}/http/pikku-fetch-http-response.ts +0 -0
  138. /package/src/{events → wirings}/mcp/index.ts +0 -0
  139. /package/src/{events → wirings}/mcp/mcp-endpoint-registry.test.d.ts +0 -0
  140. /package/src/{events → wirings}/mcp/mcp-endpoint-registry.test.ts +0 -0
  141. /package/src/{events → wirings}/queue/register-queue-helper.ts +0 -0
  142. /package/src/{events → wirings}/queue/validate-worker-config.ts +0 -0
  143. /package/src/{events → wirings}/rpc/index.ts +0 -0
  144. /package/src/{events → wirings}/rpc/rpc-runner.ts +0 -0
  145. /package/src/{events → wirings}/rpc/rpc-types.ts +0 -0
  146. /package/src/{events → wirings}/scheduler/log-schedulers.ts +0 -0
@@ -1,11 +1,11 @@
1
1
  import {
2
- CoreHTTPFunctionRoute,
3
- RunRouteOptions,
4
- RunRouteParams,
2
+ CoreHTTPFunctionWiring,
3
+ RunHTTPWiringOptions,
4
+ RunHTTPWiringParams,
5
5
  PikkuHTTP,
6
6
  PikkuHTTPRequest,
7
7
  PikkuHTTPResponse,
8
- HTTPRouteMeta,
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 APIFunction Type for the route handler function.
91
- * @template APIFunctionSessionless Type for a sessionless handler.
92
- * @template APIPermissionGroup Type representing required permissions.
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 {CoreHTTPFunctionRoute<In, Out, Route, APIFunction, APIFunctionSessionless, APIPermission, APIMiddleware>} route - The route configuration object.
94
+ * @param {CoreHTTPFunctionWiring<In, Out, Route, PikkuFunction, PikkuFunctionSessionless, PikkuPermission, APIMiddleware>} httpWiring - The HTTP wiring configuration object.
95
95
  */
96
- export const addHTTPRoute = <
96
+ export const wireHTTP = <
97
97
  In,
98
98
  Out,
99
99
  Route extends string,
100
- APIFunction,
101
- APIFunctionSessionless,
102
- APIPermissionGroup,
100
+ PikkuFunction,
101
+ PikkuFunctionSessionless,
102
+ PikkuPermissionGroup,
103
103
  APIMiddleware,
104
104
  >(
105
- httpRoute: CoreHTTPFunctionRoute<
105
+ httpWiring: CoreHTTPFunctionWiring<
106
106
  In,
107
107
  Out,
108
108
  Route,
109
- APIFunction,
110
- APIFunctionSessionless,
111
- APIPermissionGroup,
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) => meta.route === httpRoute.route && meta.method === httpRoute.method
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: httpRoute.func,
124
+ func: httpWiring.func,
124
125
  })
125
126
  const routes = pikkuState('http', 'routes')
126
- if (!routes.has(httpRoute.method)) {
127
- routes.set(httpRoute.method, new Map())
127
+ if (!routes.has(httpWiring.method)) {
128
+ routes.set(httpWiring.method, new Map())
128
129
  }
129
130
  pikkuState('http', 'routes')
130
- .get(httpRoute.method)
131
- ?.set(httpRoute.route, httpRoute as any)
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: CoreHTTPFunctionRoute<any, any, any>
246
+ route: CoreHTTPFunctionWiring<any, any, any>
246
247
  middleware: any[]
247
- meta: HTTPRouteMeta
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 {RunRouteOptions & RunRouteParams} params - Additional options including services and session management.
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: RunRouteOptions & RunRouteParams
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 {RunRouteOptions & RunRouteParams} params - Execution options including services and session configuration.
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: RunRouteOptions & RunRouteParams
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 {RunRouteOptions & RunRouteParams} options - Options such as singleton services, session handling, and error configuration.
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
- }: RunRouteOptions & RunRouteParams
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
- CoreAPIFunction,
13
- CoreAPIFunctionSessionless,
14
- CoreAPIPermission,
12
+ CorePikkuFunction,
13
+ CorePikkuFunctionSessionless,
14
+ CorePikkuPermission,
15
15
  CorePermissionGroup,
16
16
  } from '../../function/functions.types.js'
17
17
 
18
- type ExtractRouteParams<S extends string> =
18
+ type ExtractHTTPWiringParams<S extends string> =
19
19
  S extends `${string}:${infer Param}/${infer Rest}`
20
- ? Param | ExtractRouteParams<`/${Rest}`>
20
+ ? Param | ExtractHTTPWiringParams<`/${Rest}`>
21
21
  : S extends `${string}:${infer Param}`
22
22
  ? Param
23
23
  : never
24
24
 
25
- export type AssertRouteParams<In, Route extends string> =
26
- ExtractRouteParams<Route> extends keyof In
25
+ export type AssertHTTPWiringParams<In, HTTPWiring extends string> =
26
+ ExtractHTTPWiringParams<HTTPWiring> extends keyof In
27
27
  ? unknown
28
- : ['Error: Route parameters', ExtractRouteParams<Route>, 'not in', keyof In]
28
+ : [
29
+ 'Error: HTTPWiring parameters',
30
+ ExtractHTTPWiringParams<HTTPWiring>,
31
+ 'not in',
32
+ keyof In,
33
+ ]
29
34
 
30
- export type RunRouteOptions = Partial<{
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 RunRouteParams = {
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 routes.
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 route without a function, including metadata such as content type, route, and timeout settings.
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 route, which can have different configurations depending on whether it requires authentication and permissions.
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 APIFunction - The API function type, defaults to `CoreAPIFunction`.
107
- * @template APIFunctionSessionless - The sessionless API function type, defaults to `CoreAPIFunctionSessionless`.
108
- * @template APIPermission - The permission function type, defaults to `CoreAPIPermission`.
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 CoreHTTPFunctionRoute<
115
+ export type CoreHTTPFunctionWiring<
111
116
  In,
112
117
  Out,
113
118
  R extends string,
114
- APIFunction = CoreAPIFunction<In, Out>,
115
- APIFunctionSessionless = CoreAPIFunctionSessionless<In, Out>,
116
- APIPermission = CoreAPIPermission<In>,
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: APIFunction
123
- permissions?: CorePermissionGroup<APIPermission>
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: APIFunctionSessionless
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: APIFunction
143
- permissions?: CorePermissionGroup<APIPermission>
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: APIFunctionSessionless
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: APIFunction
163
- permissions?: CorePermissionGroup<APIPermission>
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: APIFunctionSessionless
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 route metadata, including parameters, query, and body types.
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 routes, including route details, methods, input/output types, and documentation.
197
+ * Represents metadata for a set of HTTP wirings, including HTTP wiring details, methods, input/output types, and documentation.
193
198
  */
194
- export type HTTPRouteMeta = {
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 HTTPRoutesMeta = Array<HTTPRouteMeta>
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 HTTPRouteMiddleware = {
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, addHTTPRoute } from './http-runner.js'
5
+ export { fetch, fetchData, wireHTTP } from './http-runner.js'
6
6
 
7
7
  export type * from './http.types.js'