@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.
Files changed (159) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/bin/pikku-all.ts +47 -33
  3. package/bin/pikku-fetch.ts +1 -1
  4. package/bin/pikku-openapi.ts +2 -2
  5. package/bin/pikku-queue-service.ts +2 -2
  6. package/bin/pikku-websocket.ts +1 -1
  7. package/cli.schema.json +30 -30
  8. package/dist/bin/pikku-all.js +38 -33
  9. package/dist/bin/pikku-fetch.js +1 -1
  10. package/dist/bin/pikku-openapi.js +2 -2
  11. package/dist/bin/pikku-queue-service.js +2 -2
  12. package/dist/bin/pikku-websocket.js +1 -1
  13. package/dist/src/inspector-glob.js +2 -2
  14. package/dist/src/pikku-cli-config.d.ts +17 -17
  15. package/dist/src/pikku-cli-config.js +31 -31
  16. package/dist/src/runtimes/nextjs/pikku-command-nextjs.js +3 -3
  17. package/dist/src/runtimes/nextjs/serialize-nextjs-backend-wrapper.js +29 -29
  18. package/dist/src/runtimes/nextjs/serialize-nextjs-http-wrapper.js +28 -28
  19. package/dist/src/schema-generator.d.ts +2 -2
  20. package/dist/src/schema-generator.js +2 -2
  21. package/dist/src/serialize-pikku-types.js +67 -67
  22. package/dist/src/utils.d.ts +5 -1
  23. package/dist/src/utils.js +17 -6
  24. package/dist/src/wirings/channels/pikku-channels.js +9 -0
  25. package/dist/src/wirings/channels/pikku-command-channels.js +9 -0
  26. package/dist/src/{events → wirings}/channels/serialize-typed-channel-map.js +3 -3
  27. package/dist/src/{events → wirings}/channels/serialize-websocket-wrapper.js +19 -5
  28. package/dist/src/{events → wirings}/fetch/index.js +2 -2
  29. package/dist/src/{events → wirings}/http/openapi-spec-generator.d.ts +2 -2
  30. package/dist/src/wirings/http/pikku-command-http-map.js +8 -0
  31. package/dist/src/{events → wirings}/http/pikku-command-http-routes.js +3 -3
  32. package/dist/src/{events → wirings}/http/pikku-http-routes.js +3 -3
  33. package/dist/src/wirings/http/serialize-fetch-wrapper.js +67 -0
  34. package/dist/src/wirings/http/serialize-typed-http-map.d.ts +4 -0
  35. package/dist/src/{events → wirings}/http/serialize-typed-http-map.js +13 -13
  36. package/dist/src/{events → wirings}/mcp/pikku-command-mcp.js +3 -3
  37. package/dist/src/wirings/queue/pikku-command-queue-service.js +15 -0
  38. package/dist/src/{events → wirings}/queue/pikku-command-queue.js +3 -3
  39. package/dist/src/{events → wirings}/queue/pikku-queue.js +3 -3
  40. package/dist/src/wirings/rpc/pikku-command-rpc-client.js +15 -0
  41. package/dist/src/wirings/rpc/pikku-command-rpc.js +6 -0
  42. package/dist/src/wirings/rpc/pikku-rpc.js +6 -0
  43. package/dist/src/wirings/rpc/serialize-rpc-wrapper.js +68 -0
  44. package/dist/src/{events → wirings}/scheduler/pikku-command-scheduler.js +3 -3
  45. package/dist/tsconfig.tsbuildinfo +1 -1
  46. package/package.json +3 -3
  47. package/src/inspector-glob.ts +2 -2
  48. package/src/pikku-cli-config.ts +67 -52
  49. package/src/runtimes/nextjs/pikku-command-nextjs.ts +3 -3
  50. package/src/runtimes/nextjs/serialize-nextjs-backend-wrapper.ts +29 -29
  51. package/src/runtimes/nextjs/serialize-nextjs-http-wrapper.ts +28 -28
  52. package/src/schema-generator.ts +3 -3
  53. package/src/serialize-pikku-types.ts +67 -67
  54. package/src/utils.ts +26 -6
  55. package/src/{events → wirings}/channels/pikku-channels.ts +5 -4
  56. package/src/{events → wirings}/channels/pikku-command-channels.ts +5 -4
  57. package/src/{events → wirings}/channels/serialize-typed-channel-map.ts +3 -3
  58. package/src/{events → wirings}/channels/serialize-websocket-wrapper.ts +19 -5
  59. package/src/{events → wirings}/fetch/index.ts +2 -2
  60. package/src/{events → wirings}/http/openapi-spec-generator.ts +3 -3
  61. package/src/{events → wirings}/http/pikku-command-http-map.ts +5 -5
  62. package/src/{events → wirings}/http/pikku-command-http-routes.ts +5 -5
  63. package/src/{events → wirings}/http/pikku-http-routes.ts +5 -5
  64. package/src/wirings/http/serialize-fetch-wrapper.ts +67 -0
  65. package/src/{events → wirings}/http/serialize-typed-http-map.ts +17 -17
  66. package/src/{events → wirings}/mcp/pikku-command-mcp.ts +5 -5
  67. package/src/{events → wirings}/queue/pikku-command-queue-service.ts +9 -6
  68. package/src/{events → wirings}/queue/pikku-command-queue.ts +8 -5
  69. package/src/{events → wirings}/queue/pikku-queue.ts +8 -5
  70. package/src/{events → wirings}/rpc/pikku-command-rpc-client.ts +9 -6
  71. package/src/{events → wirings}/rpc/pikku-command-rpc.ts +2 -2
  72. package/src/{events → wirings}/rpc/pikku-rpc.ts +2 -2
  73. package/src/wirings/rpc/serialize-rpc-wrapper.ts +68 -0
  74. package/src/{events → wirings}/scheduler/pikku-command-scheduler.ts +8 -4
  75. package/dist/src/events/channels/pikku-channels.js +0 -9
  76. package/dist/src/events/channels/pikku-command-channels.js +0 -9
  77. package/dist/src/events/http/pikku-command-http-map.js +0 -8
  78. package/dist/src/events/http/serialize-fetch-wrapper.js +0 -67
  79. package/dist/src/events/http/serialize-typed-http-map.d.ts +0 -4
  80. package/dist/src/events/queue/pikku-command-queue-service.js +0 -12
  81. package/dist/src/events/rpc/pikku-command-rpc-client.js +0 -12
  82. package/dist/src/events/rpc/pikku-command-rpc.js +0 -6
  83. package/dist/src/events/rpc/pikku-rpc.js +0 -6
  84. package/dist/src/events/rpc/serialize-rpc-wrapper.js +0 -29
  85. package/src/events/http/serialize-fetch-wrapper.ts +0 -67
  86. package/src/events/rpc/serialize-rpc-wrapper.ts +0 -29
  87. /package/dist/src/{events → wirings}/channels/pikku-channels.d.ts +0 -0
  88. /package/dist/src/{events → wirings}/channels/pikku-command-channels-map.d.ts +0 -0
  89. /package/dist/src/{events → wirings}/channels/pikku-command-channels-map.js +0 -0
  90. /package/dist/src/{events → wirings}/channels/pikku-command-channels.d.ts +0 -0
  91. /package/dist/src/{events → wirings}/channels/pikku-command-websocket-typed.d.ts +0 -0
  92. /package/dist/src/{events → wirings}/channels/pikku-command-websocket-typed.js +0 -0
  93. /package/dist/src/{events → wirings}/channels/serialize-typed-channel-map.d.ts +0 -0
  94. /package/dist/src/{events → wirings}/channels/serialize-websocket-wrapper.d.ts +0 -0
  95. /package/dist/src/{events → wirings}/fetch/index.d.ts +0 -0
  96. /package/dist/src/{events → wirings}/functions/pikku-command-function-types.d.ts +0 -0
  97. /package/dist/src/{events → wirings}/functions/pikku-command-function-types.js +0 -0
  98. /package/dist/src/{events → wirings}/functions/pikku-command-functions.d.ts +0 -0
  99. /package/dist/src/{events → wirings}/functions/pikku-command-functions.js +0 -0
  100. /package/dist/src/{events → wirings}/functions/pikku-command-services.d.ts +0 -0
  101. /package/dist/src/{events → wirings}/functions/pikku-command-services.js +0 -0
  102. /package/dist/src/{events → wirings}/functions/pikku-function-types.d.ts +0 -0
  103. /package/dist/src/{events → wirings}/functions/pikku-function-types.js +0 -0
  104. /package/dist/src/{events → wirings}/functions/pikku-functions.d.ts +0 -0
  105. /package/dist/src/{events → wirings}/functions/pikku-functions.js +0 -0
  106. /package/dist/src/{events → wirings}/http/openapi-spec-generator.js +0 -0
  107. /package/dist/src/{events → wirings}/http/pikku-command-http-map.d.ts +0 -0
  108. /package/dist/src/{events → wirings}/http/pikku-command-http-routes.d.ts +0 -0
  109. /package/dist/src/{events → wirings}/http/pikku-command-openapi.d.ts +0 -0
  110. /package/dist/src/{events → wirings}/http/pikku-command-openapi.js +0 -0
  111. /package/dist/src/{events → wirings}/http/pikku-http-routes.d.ts +0 -0
  112. /package/dist/src/{events → wirings}/http/serialize-fetch-wrapper.d.ts +0 -0
  113. /package/dist/src/{events → wirings}/mcp/pikku-command-mcp-json.d.ts +0 -0
  114. /package/dist/src/{events → wirings}/mcp/pikku-command-mcp-json.js +0 -0
  115. /package/dist/src/{events → wirings}/mcp/pikku-command-mcp.d.ts +0 -0
  116. /package/dist/src/{events → wirings}/mcp/serialize-mcp-json.d.ts +0 -0
  117. /package/dist/src/{events → wirings}/mcp/serialize-mcp-json.js +0 -0
  118. /package/dist/src/{events → wirings}/queue/pikku-command-queue-map.d.ts +0 -0
  119. /package/dist/src/{events → wirings}/queue/pikku-command-queue-map.js +0 -0
  120. /package/dist/src/{events → wirings}/queue/pikku-command-queue-service.d.ts +0 -0
  121. /package/dist/src/{events → wirings}/queue/pikku-command-queue.d.ts +0 -0
  122. /package/dist/src/{events → wirings}/queue/pikku-queue-map.d.ts +0 -0
  123. /package/dist/src/{events → wirings}/queue/pikku-queue-map.js +0 -0
  124. /package/dist/src/{events → wirings}/queue/pikku-queue.d.ts +0 -0
  125. /package/dist/src/{events → wirings}/queue/serialize-queue-map.d.ts +0 -0
  126. /package/dist/src/{events → wirings}/queue/serialize-queue-map.js +0 -0
  127. /package/dist/src/{events → wirings}/queue/serialize-queue-meta.d.ts +0 -0
  128. /package/dist/src/{events → wirings}/queue/serialize-queue-meta.js +0 -0
  129. /package/dist/src/{events → wirings}/queue/serialize-queue-wrapper.d.ts +0 -0
  130. /package/dist/src/{events → wirings}/queue/serialize-queue-wrapper.js +0 -0
  131. /package/dist/src/{events → wirings}/rpc/pikku-command-rpc-client.d.ts +0 -0
  132. /package/dist/src/{events → wirings}/rpc/pikku-command-rpc-map.d.ts +0 -0
  133. /package/dist/src/{events → wirings}/rpc/pikku-command-rpc-map.js +0 -0
  134. /package/dist/src/{events → wirings}/rpc/pikku-command-rpc.d.ts +0 -0
  135. /package/dist/src/{events → wirings}/rpc/pikku-rpc.d.ts +0 -0
  136. /package/dist/src/{events → wirings}/rpc/serialize-rpc-wrapper.d.ts +0 -0
  137. /package/dist/src/{events → wirings}/rpc/serialize-typed-rpc-map.d.ts +0 -0
  138. /package/dist/src/{events → wirings}/rpc/serialize-typed-rpc-map.js +0 -0
  139. /package/dist/src/{events → wirings}/scheduler/pikku-command-scheduler.d.ts +0 -0
  140. /package/dist/src/{events → wirings}/scheduler/serialize-scheduler-meta.d.ts +0 -0
  141. /package/dist/src/{events → wirings}/scheduler/serialize-scheduler-meta.js +0 -0
  142. /package/src/{events → wirings}/channels/pikku-command-channels-map.ts +0 -0
  143. /package/src/{events → wirings}/channels/pikku-command-websocket-typed.ts +0 -0
  144. /package/src/{events → wirings}/functions/pikku-command-function-types.ts +0 -0
  145. /package/src/{events → wirings}/functions/pikku-command-functions.ts +0 -0
  146. /package/src/{events → wirings}/functions/pikku-command-services.ts +0 -0
  147. /package/src/{events → wirings}/functions/pikku-function-types.ts +0 -0
  148. /package/src/{events → wirings}/functions/pikku-functions.ts +0 -0
  149. /package/src/{events → wirings}/http/pikku-command-openapi.ts +0 -0
  150. /package/src/{events → wirings}/mcp/pikku-command-mcp-json.ts +0 -0
  151. /package/src/{events → wirings}/mcp/serialize-mcp-json.ts +0 -0
  152. /package/src/{events → wirings}/queue/pikku-command-queue-map.ts +0 -0
  153. /package/src/{events → wirings}/queue/pikku-queue-map.ts +0 -0
  154. /package/src/{events → wirings}/queue/serialize-queue-map.ts +0 -0
  155. /package/src/{events → wirings}/queue/serialize-queue-meta.ts +0 -0
  156. /package/src/{events → wirings}/queue/serialize-queue-wrapper.ts +0 -0
  157. /package/src/{events → wirings}/rpc/pikku-command-rpc-map.ts +0 -0
  158. /package/src/{events → wirings}/rpc/serialize-typed-rpc-map.ts +0 -0
  159. /package/src/{events → wirings}/scheduler/serialize-scheduler-meta.ts +0 -0
@@ -1,30 +1,30 @@
1
- import { OpenAPISpecInfo } from './events/http/openapi-spec-generator.js';
1
+ import { OpenAPISpecInfo } from './wirings/http/openapi-spec-generator.js';
2
2
  import { InspectorFilters } from '@pikku/inspector';
3
- import { PikkuEventTypes } from '@pikku/core';
3
+ import { PikkuWiringTypes } from '@pikku/core';
4
4
  export interface PikkuCLICoreOutputFiles {
5
5
  outDir?: string;
6
6
  schemaDirectory: string;
7
7
  typesDeclarationFile: string;
8
8
  functionsFile: string;
9
9
  functionsMetaFile: string;
10
- httpRoutesFile: string;
11
- httpRoutesMetaFile: string;
12
- httpRoutesMapDeclarationFile: string;
13
- channelsFile: string;
14
- channelsMetaFile: string;
10
+ httpWiringsFile: string;
11
+ httpWiringMetaFile: string;
12
+ httpMapDeclarationFile: string;
13
+ channelsWiringFile: string;
14
+ channelsWiringMetaFile: string;
15
15
  channelsMapDeclarationFile: string;
16
- rpcMetaFile: string;
16
+ rpcWiringMetaFile: string;
17
17
  rpcMapDeclarationFile: string;
18
- schedulersFile: string;
19
- schedulersMetaFile: string;
20
- queueWorkersFile: string;
21
- queueWorkersMetaFile: string;
18
+ schedulersWiringFile: string;
19
+ schedulersWiringMetaFile: string;
20
+ queueWorkersWiringFile: string;
21
+ queueWorkersWiringMetaFile: string;
22
22
  queueMapDeclarationFile: string;
23
- mcpEndpointsFile: string;
24
- mcpEndpointsMetaFile: string;
23
+ mcpWiringsFile: string;
24
+ mcpWiringsMetaFile: string;
25
25
  servicesFile: string;
26
26
  bootstrapFile: string;
27
- bootstrapFiles: Record<PikkuEventTypes, string>;
27
+ bootstrapFiles: Record<PikkuWiringTypes, string>;
28
28
  }
29
29
  export type PikkuCLIConfig = {
30
30
  $schema?: string;
@@ -39,8 +39,8 @@ export type PikkuCLIConfig = {
39
39
  nextHTTPFile?: string;
40
40
  fetchFile?: string;
41
41
  websocketFile?: string;
42
- rpcFile?: string;
43
- queueFile?: string;
42
+ rpcWiringsFile?: string;
43
+ queueWiringsFile?: string;
44
44
  mcpJsonFile?: string;
45
45
  openAPI?: {
46
46
  outputFile: string;
@@ -1,13 +1,13 @@
1
1
  import { join, dirname, resolve, isAbsolute } from 'path';
2
2
  import { readdir, readFile } from 'fs/promises';
3
- import { PikkuEventTypes } from '@pikku/core';
3
+ import { PikkuWiringTypes } from '@pikku/core';
4
4
  const CONFIG_DIR_FILES = [
5
5
  'nextBackendFile',
6
6
  'nextHTTPFile',
7
7
  'fetchFile',
8
8
  'websocketFile',
9
- 'rpcFile',
10
- 'queueFile',
9
+ 'rpcWiringsFile',
10
+ 'queueWiringsFile',
11
11
  'mcpJsonFile',
12
12
  ];
13
13
  export const getPikkuCLIConfig = async (configFile = undefined, requiredFields, filters = {}, exitProcess = false) => {
@@ -80,48 +80,48 @@ const _getPikkuCLIConfig = async (configFile = undefined, requiredFields, filter
80
80
  result.typesDeclarationFile = join(result.outDir, 'pikku-types.gen.ts');
81
81
  }
82
82
  // HTTP
83
- if (!result.httpRoutesFile) {
84
- result.httpRoutesFile = join(httpDir, 'pikku-http-routes.gen.ts');
83
+ if (!result.httpWiringsFile) {
84
+ result.httpWiringsFile = join(httpDir, 'pikku-http-wirings.gen.ts');
85
85
  }
86
- if (!result.httpRoutesMetaFile) {
87
- result.httpRoutesMetaFile = join(httpDir, 'pikku-http-routes-meta.gen.ts');
86
+ if (!result.httpWiringMetaFile) {
87
+ result.httpWiringMetaFile = join(httpDir, 'pikku-http-wirings-meta.gen.ts');
88
88
  }
89
- if (!result.httpRoutesMapDeclarationFile) {
90
- result.httpRoutesMapDeclarationFile = join(httpDir, 'pikku-http-routes-map.gen.d.ts');
89
+ if (!result.httpMapDeclarationFile) {
90
+ result.httpMapDeclarationFile = join(httpDir, 'pikku-http-wirings-map.gen.d.ts');
91
91
  }
92
92
  // Channels/WebSocket
93
- if (!result.channelsFile) {
94
- result.channelsFile = join(channelDir, 'pikku-channels.gen.ts');
93
+ if (!result.channelsWiringFile) {
94
+ result.channelsWiringFile = join(channelDir, 'pikku-channels.gen.ts');
95
95
  }
96
- if (!result.channelsMetaFile) {
97
- result.channelsMetaFile = join(channelDir, 'pikku-channels-meta.gen.ts');
96
+ if (!result.channelsWiringMetaFile) {
97
+ result.channelsWiringMetaFile = join(channelDir, 'pikku-channels-meta.gen.ts');
98
98
  }
99
99
  if (!result.channelsMapDeclarationFile) {
100
100
  result.channelsMapDeclarationFile = join(channelDir, 'pikku-channels-map.gen.d.ts');
101
101
  }
102
102
  // RPC
103
- if (!result.rpcMetaFile) {
104
- result.rpcMetaFile = join(rpcDir, 'pikku-rpc-meta.gen.ts');
103
+ if (!result.rpcWiringMetaFile) {
104
+ result.rpcWiringMetaFile = join(rpcDir, 'pikku-rpc-wirings-meta.gen.ts');
105
105
  }
106
106
  if (!result.rpcMapDeclarationFile) {
107
- result.rpcMapDeclarationFile = join(rpcDir, 'pikku-rpc-map.gen.ts');
107
+ result.rpcMapDeclarationFile = join(rpcDir, 'pikku-rpc-wirings-map.gen.d.ts');
108
108
  }
109
109
  // Scheduler
110
- if (!result.schedulersFile) {
111
- result.schedulersFile = join(schedulerDir, 'pikku-scheduler.gen.ts');
110
+ if (!result.schedulersWiringFile) {
111
+ result.schedulersWiringFile = join(schedulerDir, 'pikku-schedulers-wirings.gen.ts');
112
112
  }
113
- if (!result.schedulersMetaFile) {
114
- result.schedulersMetaFile = join(schedulerDir, 'pikku-scheduler-meta.gen.ts');
113
+ if (!result.schedulersWiringMetaFile) {
114
+ result.schedulersWiringMetaFile = join(schedulerDir, 'pikku-schedulers-wirings-meta.gen.ts');
115
115
  }
116
116
  // Queue
117
- if (!result.queueWorkersFile) {
118
- result.queueWorkersFile = join(queueDir, 'pikku-queue-workers.gen.ts');
117
+ if (!result.queueWorkersWiringFile) {
118
+ result.queueWorkersWiringFile = join(queueDir, 'pikku-queue-workers-wirings.gen.ts');
119
119
  }
120
- if (!result.queueWorkersMetaFile) {
121
- result.queueWorkersMetaFile = join(queueDir, 'pikku-queue-workers-meta.gen.ts');
120
+ if (!result.queueWorkersWiringMetaFile) {
121
+ result.queueWorkersWiringMetaFile = join(queueDir, 'pikku-queue-workers-wirings-meta.gen.ts');
122
122
  }
123
123
  if (!result.queueMapDeclarationFile) {
124
- result.queueMapDeclarationFile = join(queueDir, 'pikku-queue-map.gen.ts');
124
+ result.queueMapDeclarationFile = join(queueDir, 'pikku-queue-workers-wirings-map.gen.d.ts');
125
125
  }
126
126
  // Services
127
127
  if (!result.servicesFile) {
@@ -132,17 +132,17 @@ const _getPikkuCLIConfig = async (configFile = undefined, requiredFields, filter
132
132
  result.bootstrapFile = join(result.outDir, 'pikku-bootstrap.gen.ts');
133
133
  }
134
134
  // MCP
135
- if (!result.mcpEndpointsMetaFile) {
136
- result.mcpEndpointsMetaFile = join(mcpDir, 'mcp-endpoints-meta.gen.ts');
135
+ if (!result.mcpWiringsMetaFile) {
136
+ result.mcpWiringsMetaFile = join(mcpDir, 'pikku-mcp-wirings-meta.gen.ts');
137
137
  }
138
- if (!result.mcpEndpointsFile) {
139
- result.mcpEndpointsFile = join(mcpDir, 'mcp-endpoints.gen.ts');
138
+ if (!result.mcpWiringsFile) {
139
+ result.mcpWiringsFile = join(mcpDir, 'pikku-mcp-wirings.gen.ts');
140
140
  }
141
141
  if (!result.mcpJsonFile) {
142
- result.mcpJsonFile = join(mcpDir, 'mcp.gen.json');
142
+ result.mcpJsonFile = join(mcpDir, 'pikku-mcp.gen.json');
143
143
  }
144
144
  result.bootstrapFiles = result.bootstrapFiles || {};
145
- for (const key of Object.keys(PikkuEventTypes)) {
145
+ for (const key of Object.keys(PikkuWiringTypes)) {
146
146
  const eventDir = join(result.outDir, key.toLowerCase());
147
147
  result.bootstrapFiles[key] = join(eventDir, `pikku-bootstrap-${key}.gen.ts`);
148
148
  }
@@ -1,7 +1,7 @@
1
1
  import { logCommandInfoAndTime, getPikkuFilesAndMethods, getFileImportRelativePath, writeFileInDir, } from '../../utils.js';
2
2
  import { serializeNextJsBackendWrapper as serializeNextBackendWrapper } from './serialize-nextjs-backend-wrapper.js';
3
3
  import { serializeNextJsHTTPWrapper as serializeNextHTTPWrapper } from './serialize-nextjs-http-wrapper.js';
4
- export const pikkuNext = async (logger, { nextBackendFile, nextHTTPFile, httpRoutesMapDeclarationFile, packageMappings, fetchFile, bootstrapFiles, }, visitState, options = {}) => {
4
+ export const pikkuNext = async (logger, { nextBackendFile, nextHTTPFile, httpMapDeclarationFile, packageMappings, fetchFile, bootstrapFiles, }, visitState, options = {}) => {
5
5
  return await logCommandInfoAndTime(logger, 'Generating nextjs wrapper', 'Generated nextjs wrapper', [
6
6
  nextBackendFile === undefined && nextHTTPFile === undefined,
7
7
  'nextjs outfile is not defined',
@@ -22,12 +22,12 @@ export const pikkuNext = async (logger, { nextBackendFile, nextHTTPFile, httpRou
22
22
  const singletonServicesImport = `import { ${singletonServicesFactory.variable} as createSingletonServices } from '${getFileImportRelativePath(nextBackendFile, singletonServicesFactory.file, packageMappings)}'`;
23
23
  const sessionServicesImport = `import { ${sessionServicesFactory.variable} as createSessionServices } from '${getFileImportRelativePath(nextBackendFile, sessionServicesFactory.file, packageMappings)}'`;
24
24
  const httpBootstrapPath = getFileImportRelativePath(nextBackendFile, bootstrapFiles.http, packageMappings);
25
- const routesMapDeclarationPath = getFileImportRelativePath(nextBackendFile, httpRoutesMapDeclarationFile, packageMappings);
25
+ const routesMapDeclarationPath = getFileImportRelativePath(nextBackendFile, httpMapDeclarationFile, packageMappings);
26
26
  const content = serializeNextBackendWrapper(httpBootstrapPath, routesMapDeclarationPath, pikkuConfigImport, singletonServicesImport, sessionServicesImport);
27
27
  await writeFileInDir(logger, nextBackendFile, content);
28
28
  }
29
29
  if (nextHTTPFile && fetchFile) {
30
- const routesMapDeclarationPath = getFileImportRelativePath(nextHTTPFile, httpRoutesMapDeclarationFile, packageMappings);
30
+ const routesMapDeclarationPath = getFileImportRelativePath(nextHTTPFile, httpMapDeclarationFile, packageMappings);
31
31
  const fetchPath = getFileImportRelativePath(nextHTTPFile, fetchFile, packageMappings);
32
32
  const content = serializeNextHTTPWrapper(routesMapDeclarationPath, fetchPath);
33
33
  await writeFileInDir(logger, nextHTTPFile, content);
@@ -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 { RoutesMap, RouteHandlerOf, RoutesWithMethod } from '${routesMapPath}'
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 RoutesMap.
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 RoutesMap,
46
- Method extends keyof RoutesMap[Route]
45
+ Route extends keyof HTTPWiringsMap,
46
+ Method extends keyof HTTPWiringsMap[Route]
47
47
  >(
48
48
  route: Route,
49
49
  method: Method,
50
- data: RouteHandlerOf<Route, Method>['input'] = null
51
- ): Promise<RouteHandlerOf<Route, Method>['output']> => {
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 RoutesMap.
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 RoutesMap,
68
- Method extends keyof RoutesMap[Route]
67
+ Route extends keyof HTTPWiringsMap,
68
+ Method extends keyof HTTPWiringsMap[Route]
69
69
  >(
70
70
  route: Route,
71
71
  method: Method,
72
- data: RouteHandlerOf<Route, Method>['input'] = null
73
- ): Promise<RouteHandlerOf<Route, Method>['output']> => {
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 RoutesWithMethod<'POST'>>(
85
+ const dynamicPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
86
86
  route: Route,
87
- data: RouteHandlerOf<Route, 'POST'>['input'] = null
88
- ): Promise<RouteHandlerOf<Route, 'POST'>['output']> => {
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 RoutesWithMethod<'GET'>>(
100
+ const dynamicGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
101
101
  route: Route,
102
- data: RouteHandlerOf<Route, 'GET'>['input'] = null
103
- ): Promise<RouteHandlerOf<Route, 'GET'>['output']> => {
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 RoutesWithMethod<'PATCH'>>(
115
+ const dynamicPatch = <Route extends HTTPWiringsWithMethod<'PATCH'>>(
116
116
  route: Route,
117
- data: RouteHandlerOf<Route, 'PATCH'>['input'] = null
118
- ): Promise<RouteHandlerOf<Route, 'PATCH'>['output']> => {
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 RoutesWithMethod<'DELETE'>>(
130
+ const dynamicDel = <Route extends HTTPWiringsWithMethod<'DELETE'>>(
131
131
  route: Route,
132
- data: RouteHandlerOf<Route, 'DELETE'>['input'] = null
133
- ): Promise<RouteHandlerOf<Route, 'DELETE'>['output']> => {
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 RoutesWithMethod<'POST'>>(
147
+ const staticPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
148
148
  route: Route,
149
- data: RouteHandlerOf<Route, 'POST'>['input'] = null
150
- ): Promise<RouteHandlerOf<Route, 'POST'>['output']> => {
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 RoutesWithMethod<'GET'>>(
162
+ const staticGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
163
163
  route: Route,
164
- data: RouteHandlerOf<Route, 'GET'>['input'] = null
165
- ): Promise<RouteHandlerOf<Route, 'GET'>['output']> => {
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 { RoutesMap, RouteHandlerOf, RoutesWithMethod } from '${routesMapPath}'
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 RoutesMap,
26
- Method extends keyof RoutesMap[Route]
25
+ Route extends keyof HTTPWiringsMap,
26
+ Method extends keyof HTTPWiringsMap[Route]
27
27
  >(
28
28
  route: Route,
29
29
  method: Method,
30
- data: RouteHandlerOf<Route, Method>['input'] = null
31
- ): Promise<RouteHandlerOf<Route, Method>['output']> => {
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 RoutesMap.
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 RoutesMap,
48
- Method extends keyof RoutesMap[Route]
47
+ Route extends keyof HTTPWiringsMap,
48
+ Method extends keyof HTTPWiringsMap[Route]
49
49
  >(
50
50
  route: Route,
51
51
  method: Method,
52
- data: RouteHandlerOf<Route, Method>['input'] = null
53
- ): Promise<RouteHandlerOf<Route, Method>['output']> => {
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 RoutesWithMethod<'POST'>>(
65
+ const dynamicPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
66
66
  route: Route,
67
- data: RouteHandlerOf<Route, 'POST'>['input'] = null
68
- ): Promise<RouteHandlerOf<Route, 'POST'>['output']> => {
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 RoutesWithMethod<'GET'>>(
80
+ const dynamicGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
81
81
  route: Route,
82
- data: RouteHandlerOf<Route, 'GET'>['input'] = null
83
- ): Promise<RouteHandlerOf<Route, 'GET'>['output']> => {
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 RoutesWithMethod<'PATCH'>>(
95
+ const dynamicPatch = <Route extends HTTPWiringsWithMethod<'PATCH'>>(
96
96
  route: Route,
97
- data: RouteHandlerOf<Route, 'PATCH'>['input'] = null
98
- ): Promise<RouteHandlerOf<Route, 'PATCH'>['output']> => {
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 RoutesWithMethod<'DELETE'>>(
110
+ const dynamicDel = <Route extends HTTPWiringsWithMethod<'DELETE'>>(
111
111
  route: Route,
112
- data: RouteHandlerOf<Route, 'DELETE'>['input'] = null
113
- ): Promise<RouteHandlerOf<Route, 'DELETE'>['output']> => {
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 RoutesWithMethod<'POST'>>(
127
+ const staticPost = <Route extends HTTPWiringsWithMethod<'POST'>>(
128
128
  route: Route,
129
- data: RouteHandlerOf<Route, 'POST'>['input'] = null
130
- ): Promise<RouteHandlerOf<Route, 'POST'>['output']> => {
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 RoutesWithMethod<'GET'>>(
142
+ const staticGet = <Route extends HTTPWiringsWithMethod<'GET'>>(
143
143
  route: Route,
144
- data: RouteHandlerOf<Route, 'GET'>['input'] = null
145
- ): Promise<RouteHandlerOf<Route, 'GET'>['output']> => {
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 { HTTPRoutesMeta } from '@pikku/core/http';
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, httpRoutesMeta: HTTPRoutesMeta): Promise<Record<string, JSONValue>>;
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, httpRoutesMeta) {
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 httpRoutesMeta) {
15
+ for (const { inputTypes } of httpWiringsMeta) {
16
16
  if (inputTypes?.body) {
17
17
  schemasSet.add(inputTypes.body);
18
18
  }