@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
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export const serializeFetchWrapper = (routesMapPath) => {
|
|
2
|
+
return `
|
|
3
|
+
import { CorePikkuFetch, HTTPMethod } from '@pikku/fetch'
|
|
4
|
+
import type { HTTPWiringsMap, HTTPWiringHandlerOf, HTTPWiringsWithMethod } from '${routesMapPath}'
|
|
5
|
+
|
|
6
|
+
export class PikkuFetch extends CorePikkuFetch {
|
|
7
|
+
public async post<Route extends HTTPWiringsWithMethod<'POST'>>(
|
|
8
|
+
route: Route,
|
|
9
|
+
...args: null extends HTTPWiringHandlerOf<Route, 'POST'>['input']
|
|
10
|
+
? [data?: Exclude<HTTPWiringHandlerOf<Route, 'POST'>['input'], null>, options?: Omit<RequestInit, 'body'>]
|
|
11
|
+
: [data: HTTPWiringHandlerOf<Route, 'POST'>['input'], options?: Omit<RequestInit, 'body'>]
|
|
12
|
+
): Promise<HTTPWiringHandlerOf<Route, 'POST'>['output']> {
|
|
13
|
+
const [data, options] = args;
|
|
14
|
+
return super.api(route, 'POST', data, options);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public async get<Route extends HTTPWiringsWithMethod<'GET'>>(
|
|
18
|
+
route: Route,
|
|
19
|
+
...args: null extends HTTPWiringHandlerOf<Route, 'GET'>['input']
|
|
20
|
+
? [data?: Exclude<HTTPWiringHandlerOf<Route, 'GET'>['input'], null>, options?: Omit<RequestInit, 'body'>]
|
|
21
|
+
: [data: HTTPWiringHandlerOf<Route, 'GET'>['input'], options?: Omit<RequestInit, 'body'>]
|
|
22
|
+
): Promise<HTTPWiringHandlerOf<Route, 'GET'>['output']> {
|
|
23
|
+
const [data, options] = args;
|
|
24
|
+
return super.api(route, 'GET', data, options);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public async patch<Route extends HTTPWiringsWithMethod<'PATCH'>>(
|
|
28
|
+
route: Route,
|
|
29
|
+
...args: null extends HTTPWiringHandlerOf<Route, 'PATCH'>['input']
|
|
30
|
+
? [data?: Exclude<HTTPWiringHandlerOf<Route, 'PATCH'>['input'], null>, options?: Omit<RequestInit, 'body'>]
|
|
31
|
+
: [data: HTTPWiringHandlerOf<Route, 'PATCH'>['input'], options?: Omit<RequestInit, 'body'>]
|
|
32
|
+
): Promise<HTTPWiringHandlerOf<Route, 'PATCH'>['output']> {
|
|
33
|
+
const [data, options] = args;
|
|
34
|
+
return super.api(route, 'PATCH', data, options);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public async head<Route extends HTTPWiringsWithMethod<'HEAD'>>(
|
|
38
|
+
route: Route,
|
|
39
|
+
...args: null extends HTTPWiringHandlerOf<Route, 'HEAD'>['input']
|
|
40
|
+
? [data?: Exclude<HTTPWiringHandlerOf<Route, 'HEAD'>['input'], null>, options?: Omit<RequestInit, 'body'>]
|
|
41
|
+
: [data: HTTPWiringHandlerOf<Route, 'HEAD'>['input'], options?: Omit<RequestInit, 'body'>]
|
|
42
|
+
): Promise<HTTPWiringHandlerOf<Route, 'HEAD'>['output']> {
|
|
43
|
+
const [data, options] = args;
|
|
44
|
+
return super.api(route, 'HEAD', data, options);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public async delete<Route extends HTTPWiringsWithMethod<'DELETE'>>(
|
|
48
|
+
route: Route,
|
|
49
|
+
...args: null extends HTTPWiringHandlerOf<Route, 'DELETE'>['input']
|
|
50
|
+
? [data?: Exclude<HTTPWiringHandlerOf<Route, 'DELETE'>['input'], null>, options?: Omit<RequestInit, 'body'>]
|
|
51
|
+
: [data: HTTPWiringHandlerOf<Route, 'DELETE'>['input'], options?: Omit<RequestInit, 'body'>]
|
|
52
|
+
): Promise<HTTPWiringHandlerOf<Route, 'DELETE'>['output']> {
|
|
53
|
+
const [data, options] = args;
|
|
54
|
+
return super.api(route, 'DELETE', data, options);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public async fetch<
|
|
58
|
+
Route extends keyof HTTPWiringsMap,
|
|
59
|
+
Method extends keyof HTTPWiringsMap[Route]
|
|
60
|
+
>(route: Route, method: Method, data: HTTPWiringHandlerOf<Route, Method>['input'], options?: Omit<RequestInit, 'body'>): Promise<Response> {
|
|
61
|
+
return await super.fetch(route, method as HTTPMethod, data, options);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const pikkuFetch = new PikkuFetch();
|
|
66
|
+
`;
|
|
67
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { HTTPWiringsMeta } from '@pikku/core/http';
|
|
2
|
+
import { MetaInputTypes, TypesMap } from '@pikku/inspector';
|
|
3
|
+
import { FunctionsMeta } from '@pikku/core';
|
|
4
|
+
export declare const serializeTypedHTTPWiringsMap: (relativeToPath: string, packageMappings: Record<string, string>, typesMap: TypesMap, functionsMeta: FunctionsMeta, wiringsMeta: HTTPWiringsMeta, metaTypes: MetaInputTypes) => string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { serializeImportMap } from '../../serialize-import-map.js';
|
|
2
2
|
import { generateCustomTypes } from '../../utils.js';
|
|
3
|
-
export const
|
|
3
|
+
export const serializeTypedHTTPWiringsMap = (relativeToPath, packageMappings, typesMap, functionsMeta, wiringsMeta, metaTypes) => {
|
|
4
4
|
const requiredTypes = new Set();
|
|
5
5
|
const serializedCustomTypes = generateCustomTypes(typesMap, requiredTypes);
|
|
6
6
|
const serializedMetaTypes = generateMetaTypes(metaTypes, typesMap);
|
|
7
|
-
const
|
|
7
|
+
const serializedHTTPWirings = generateHTTPWirings(wiringsMeta, functionsMeta, typesMap, requiredTypes);
|
|
8
8
|
const serializedImportMap = serializeImportMap(relativeToPath, packageMappings, typesMap, requiredTypes);
|
|
9
9
|
return `/**
|
|
10
10
|
* This provides the structure needed for typescript to be aware of routes and their return types
|
|
@@ -14,24 +14,24 @@ ${serializedImportMap}
|
|
|
14
14
|
${serializedCustomTypes}
|
|
15
15
|
${serializedMetaTypes}
|
|
16
16
|
|
|
17
|
-
interface
|
|
17
|
+
interface HTTPWiringHandler<I, O> {
|
|
18
18
|
input: I;
|
|
19
19
|
output: O;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
${
|
|
22
|
+
${serializedHTTPWirings}
|
|
23
23
|
|
|
24
|
-
export type
|
|
25
|
-
|
|
26
|
-
?
|
|
24
|
+
export type HTTPWiringHandlerOf<HTTPWiring extends keyof HTTPWiringsMap, Method extends keyof HTTPWiringsMap[HTTPWiring]> =
|
|
25
|
+
HTTPWiringsMap[HTTPWiring][Method] extends { input: infer I; output: infer O }
|
|
26
|
+
? HTTPWiringHandler<I, O>
|
|
27
27
|
: never;
|
|
28
28
|
|
|
29
|
-
export type
|
|
30
|
-
[
|
|
31
|
-
}[keyof
|
|
29
|
+
export type HTTPWiringsWithMethod<Method extends string> = {
|
|
30
|
+
[HTTPWiring in keyof HTTPWiringsMap]: Method extends keyof HTTPWiringsMap[HTTPWiring] ? HTTPWiring : never;
|
|
31
|
+
}[keyof HTTPWiringsMap];
|
|
32
32
|
`;
|
|
33
33
|
};
|
|
34
|
-
function
|
|
34
|
+
function generateHTTPWirings(routesMeta, functionsMeta, typesMap, requiredTypes) {
|
|
35
35
|
// Initialize an object to collect routes
|
|
36
36
|
const routesObj = {};
|
|
37
37
|
for (const meta of routesMeta) {
|
|
@@ -58,11 +58,11 @@ function generateRoutes(routesMeta, functionsMeta, typesMap, requiredTypes) {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
// Build the routes object as a string
|
|
61
|
-
let routesStr = 'export type
|
|
61
|
+
let routesStr = 'export type HTTPWiringsMap = {\n';
|
|
62
62
|
for (const [routePath, methods] of Object.entries(routesObj)) {
|
|
63
63
|
routesStr += ` readonly '${routePath}': {\n`;
|
|
64
64
|
for (const [method, handler] of Object.entries(methods)) {
|
|
65
|
-
routesStr += ` readonly ${method.toUpperCase()}:
|
|
65
|
+
routesStr += ` readonly ${method.toUpperCase()}: HTTPWiringHandler<${handler.inputType}, ${handler.outputType}>,\n`;
|
|
66
66
|
}
|
|
67
67
|
routesStr += ' },\n';
|
|
68
68
|
}
|
|
@@ -34,9 +34,9 @@ const generateArgumentsFromSchema = async (inputSchema, schemaDirectory, typesMa
|
|
|
34
34
|
return [];
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
export const pikkuMCP = async (logger, {
|
|
37
|
+
export const pikkuMCP = async (logger, { mcpWiringsFile, mcpWiringsMetaFile, packageMappings, schemaDirectory }, { mcpEndpoints, functions }) => {
|
|
38
38
|
return await logCommandInfoAndTime(logger, 'Finding MCP endpoints', 'Found MCP endpoints', [mcpEndpoints.files.size === 0], async () => {
|
|
39
|
-
await writeFileInDir(logger,
|
|
39
|
+
await writeFileInDir(logger, mcpWiringsFile, serializeFileImports('wireMCPResource or wireMCPTool', mcpWiringsFile, mcpEndpoints.files, packageMappings));
|
|
40
40
|
// Populate arguments for prompts meta before serializing
|
|
41
41
|
const promptsMetaWithArguments = { ...mcpEndpoints.promptsMeta };
|
|
42
42
|
for (const promptMeta of Object.values(promptsMetaWithArguments)) {
|
|
@@ -46,7 +46,7 @@ export const pikkuMCP = async (logger, { mcpEndpointsFile, mcpEndpointsMetaFile,
|
|
|
46
46
|
promptMeta.arguments = await generateArgumentsFromSchema(inputType || null, schemaDirectory || '', functions.typesMap, logger);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
await writeFileInDir(logger,
|
|
49
|
+
await writeFileInDir(logger, mcpWiringsMetaFile, `import { pikkuState } from '@pikku/core'
|
|
50
50
|
pikkuState('mcp', 'resourcesMeta', ${JSON.stringify(mcpEndpoints.resourcesMeta, null, 2)})
|
|
51
51
|
pikkuState('mcp', 'toolsMeta', ${JSON.stringify(mcpEndpoints.toolsMeta, null, 2)})
|
|
52
52
|
pikkuState('mcp', 'promptsMeta', ${JSON.stringify(promptsMetaWithArguments, null, 2)})`);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { serializeQueueWrapper } from './serialize-queue-wrapper.js';
|
|
2
|
+
import { getFileImportRelativePath, logCommandInfoAndTime, writeFileInDir, } from '../../utils.js';
|
|
3
|
+
export const pikkuQueueService = async (logger, { queueWiringsFile, queueMapDeclarationFile, packageMappings }) => {
|
|
4
|
+
return await logCommandInfoAndTime(logger, 'Generating queue service wrapper', 'Generated queue service wrapper', [
|
|
5
|
+
queueWiringsFile === undefined,
|
|
6
|
+
"queueWiringsFile isn't set in the pikku config",
|
|
7
|
+
], async () => {
|
|
8
|
+
if (!queueWiringsFile) {
|
|
9
|
+
throw new Error("queueWiringsFile is isn't set in the pikku config");
|
|
10
|
+
}
|
|
11
|
+
const queueMapDeclarationPath = getFileImportRelativePath(queueWiringsFile, queueMapDeclarationFile, packageMappings);
|
|
12
|
+
const content = [serializeQueueWrapper(queueMapDeclarationPath)];
|
|
13
|
+
await writeFileInDir(logger, queueWiringsFile, content.join('\n'));
|
|
14
|
+
});
|
|
15
|
+
};
|
|
@@ -2,9 +2,9 @@ import { logCommandInfoAndTime, serializeFileImports, writeFileInDir, } from '..
|
|
|
2
2
|
import { serializeQueueMeta } from './serialize-queue-meta.js';
|
|
3
3
|
export const pikkuQueue = async (logger, cliConfig, visitState) => {
|
|
4
4
|
return await logCommandInfoAndTime(logger, 'Finding queues', 'Found queue', [visitState.queueWorkers.files.size === 0], async () => {
|
|
5
|
-
const {
|
|
5
|
+
const { queueWorkersWiringFile, queueWorkersWiringMetaFile, packageMappings, } = cliConfig;
|
|
6
6
|
const { queueWorkers } = visitState;
|
|
7
|
-
await writeFileInDir(logger,
|
|
8
|
-
await writeFileInDir(logger,
|
|
7
|
+
await writeFileInDir(logger, queueWorkersWiringMetaFile, serializeQueueMeta(queueWorkers.meta));
|
|
8
|
+
await writeFileInDir(logger, queueWorkersWiringFile, serializeFileImports('addQueueWorkers', queueWorkersWiringFile, queueWorkers.files, packageMappings));
|
|
9
9
|
});
|
|
10
10
|
};
|
|
@@ -2,9 +2,9 @@ import { logCommandInfoAndTime, serializeFileImports, writeFileInDir, } from '..
|
|
|
2
2
|
import { serializeQueueMeta } from './serialize-queue-meta.js';
|
|
3
3
|
export const pikkuQueue = async (logger, cliConfig, visitState) => {
|
|
4
4
|
return await logCommandInfoAndTime(logger, 'Finding queues', 'Found queue', [visitState.queueWorkers.files.size === 0], async () => {
|
|
5
|
-
const {
|
|
5
|
+
const { queueWorkersWiringFile, queueWorkersWiringMetaFile, packageMappings, } = cliConfig;
|
|
6
6
|
const { queueWorkers } = visitState;
|
|
7
|
-
await writeFileInDir(logger,
|
|
8
|
-
await writeFileInDir(logger,
|
|
7
|
+
await writeFileInDir(logger, queueWorkersWiringMetaFile, serializeQueueMeta(queueWorkers.meta));
|
|
8
|
+
await writeFileInDir(logger, queueWorkersWiringFile, serializeFileImports('addQueueWorkers', queueWorkersWiringFile, queueWorkers.files, packageMappings));
|
|
9
9
|
});
|
|
10
10
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { serializeRPCWrapper } from './serialize-rpc-wrapper.js';
|
|
2
|
+
import { getFileImportRelativePath, logCommandInfoAndTime, writeFileInDir, } from '../../utils.js';
|
|
3
|
+
export const pikkuRPCClient = async (logger, { rpcWiringsFile, rpcMapDeclarationFile, packageMappings }) => {
|
|
4
|
+
return await logCommandInfoAndTime(logger, 'Generating RPC wrapper', 'Generated RPC wrapper', [
|
|
5
|
+
rpcWiringsFile === undefined,
|
|
6
|
+
"rpcWiringsFile isn't set in the pikku config",
|
|
7
|
+
], async () => {
|
|
8
|
+
if (!rpcWiringsFile) {
|
|
9
|
+
throw new Error("rpcWiringsFile isn't set in the pikku config");
|
|
10
|
+
}
|
|
11
|
+
const rpcMapDeclarationPath = getFileImportRelativePath(rpcWiringsFile, rpcMapDeclarationFile, packageMappings);
|
|
12
|
+
const content = [serializeRPCWrapper(rpcMapDeclarationPath)];
|
|
13
|
+
await writeFileInDir(logger, rpcWiringsFile, content.join('\n'));
|
|
14
|
+
});
|
|
15
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { logCommandInfoAndTime, writeFileInDir } from '../../utils.js';
|
|
2
|
+
export const pikkuRPC = async (logger, { rpcWiringMetaFile }, { rpc }) => {
|
|
3
|
+
return await logCommandInfoAndTime(logger, 'Finding RPCs tasks', 'Found RPCs', [false], async () => {
|
|
4
|
+
await writeFileInDir(logger, rpcWiringMetaFile, `import { pikkuState } from '@pikku/core'\npikkuState('rpc', 'meta', ${JSON.stringify(rpc.meta, null, 2)})`);
|
|
5
|
+
});
|
|
6
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { logCommandInfoAndTime, writeFileInDir } from '../../utils.js';
|
|
2
|
+
export const pikkuRPC = async (logger, { rpcWiringMetaFile }, { rpc }) => {
|
|
3
|
+
return await logCommandInfoAndTime(logger, 'Finding RPCs tasks', 'Found RPCs', [false], async () => {
|
|
4
|
+
await writeFileInDir(logger, rpcWiringMetaFile, `import { pikkuState } from '@pikku/core'\npikkuState('rpc', 'meta', ${JSON.stringify(rpc.meta, null, 2)})`);
|
|
5
|
+
});
|
|
6
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export const serializeRPCWrapper = (rpcMapPath) => {
|
|
2
|
+
return `
|
|
3
|
+
import { PikkuFetch } from "./pikku-fetch.gen.js"
|
|
4
|
+
import type { RPCInvoke } from '${rpcMapPath}'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* PikkuRPC provides a type-safe client for making Remote Procedure Calls (RPC)
|
|
8
|
+
* to your Pikku server. It wraps the underlying HTTP client and provides a
|
|
9
|
+
* simple interface for invoking server-side functions.
|
|
10
|
+
*/
|
|
11
|
+
export class PikkuRPC {
|
|
12
|
+
/** The underlying HTTP client used for making RPC calls */
|
|
13
|
+
pikkuFetch = new PikkuFetch()
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Sets a custom PikkuFetch instance to use for RPC calls.
|
|
17
|
+
* This allows you to configure custom settings or use a shared client instance.
|
|
18
|
+
*
|
|
19
|
+
* @param pikkuFetch - The PikkuFetch instance to use
|
|
20
|
+
*/
|
|
21
|
+
setPikkuFetch(pikkuFetch: PikkuFetch): void {
|
|
22
|
+
this.pikkuFetch = pikkuFetch
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Sets the base server URL for all RPC calls.
|
|
27
|
+
*
|
|
28
|
+
* @param serverUrl - The base URL of your Pikku server (e.g., 'https://api.example.com')
|
|
29
|
+
*/
|
|
30
|
+
setServerUrl(serverUrl: string): void {
|
|
31
|
+
this.pikkuFetch.setServerUrl(serverUrl)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Sets the JWT token for authorization on all RPC calls.
|
|
36
|
+
*
|
|
37
|
+
* @param jwt - The JWT token to use for authorization, or null to remove authorization
|
|
38
|
+
*/
|
|
39
|
+
setAuthorizationJWT(jwt: string | null): void {
|
|
40
|
+
this.pikkuFetch.setAuthorizationJWT(jwt)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Sets the API key for authorization on all RPC calls.
|
|
45
|
+
*
|
|
46
|
+
* @param apiKey - The API key to use for authorization, or null to remove the API key
|
|
47
|
+
*/
|
|
48
|
+
setAPIKey(apiKey: string | null): void {
|
|
49
|
+
this.pikkuFetch.setAPIKey(apiKey)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Invokes a remote procedure call on the server.
|
|
54
|
+
* This is a generic method that routes to the appropriate server function
|
|
55
|
+
* based on the function name and passes the provided data.
|
|
56
|
+
*
|
|
57
|
+
* @param name - The name of the server function to invoke
|
|
58
|
+
* @param data - The data to pass to the server function
|
|
59
|
+
* @returns A promise that resolves with the function's return value
|
|
60
|
+
*/
|
|
61
|
+
invoke: RPCInvoke = async (name, data) => {
|
|
62
|
+
return await this.pikkuFetch.post('/rpc', { name, data })
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const pikkuRPC = new PikkuRPC();
|
|
67
|
+
`;
|
|
68
|
+
};
|
|
@@ -2,9 +2,9 @@ import { logCommandInfoAndTime, serializeFileImports, writeFileInDir, } from '..
|
|
|
2
2
|
import { serializeSchedulerMeta } from './serialize-scheduler-meta.js';
|
|
3
3
|
export const pikkuScheduler = async (logger, cliConfig, visitState) => {
|
|
4
4
|
return await logCommandInfoAndTime(logger, 'Finding scheduled tasks', 'Found scheduled tasks', [visitState.scheduledTasks.files.size === 0], async () => {
|
|
5
|
-
const {
|
|
5
|
+
const { schedulersWiringFile, schedulersWiringMetaFile, packageMappings, } = cliConfig;
|
|
6
6
|
const { scheduledTasks } = visitState;
|
|
7
|
-
await writeFileInDir(logger,
|
|
8
|
-
await writeFileInDir(logger,
|
|
7
|
+
await writeFileInDir(logger, schedulersWiringMetaFile, serializeSchedulerMeta(scheduledTasks.meta));
|
|
8
|
+
await writeFileInDir(logger, schedulersWiringFile, serializeFileImports('addScheduledTasks', schedulersWiringFile, scheduledTasks.files, packageMappings));
|
|
9
9
|
});
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../bin/pikku-all.ts","../bin/pikku-fetch.ts","../bin/pikku-nextjs.ts","../bin/pikku-openapi.ts","../bin/pikku-queue-service.ts","../bin/pikku-schemas.ts","../bin/pikku-websocket.ts","../bin/pikku.ts","../src/inspector-glob.ts","../src/pikku-cli-config.ts","../src/pikku-command-schemas.ts","../src/schema-generator.ts","../src/schemas.ts","../src/serialize-import-map.ts","../src/serialize-pikku-types.ts","../src/types.ts","../src/utils.ts","../src/
|
|
1
|
+
{"root":["../bin/pikku-all.ts","../bin/pikku-fetch.ts","../bin/pikku-nextjs.ts","../bin/pikku-openapi.ts","../bin/pikku-queue-service.ts","../bin/pikku-schemas.ts","../bin/pikku-websocket.ts","../bin/pikku.ts","../src/inspector-glob.ts","../src/pikku-cli-config.ts","../src/pikku-command-schemas.ts","../src/schema-generator.ts","../src/schemas.ts","../src/serialize-import-map.ts","../src/serialize-pikku-types.ts","../src/types.ts","../src/utils.ts","../src/runtimes/nextjs/pikku-command-nextjs.ts","../src/runtimes/nextjs/serialize-nextjs-backend-wrapper.ts","../src/runtimes/nextjs/serialize-nextjs-http-wrapper.ts","../src/wirings/channels/pikku-channels.ts","../src/wirings/channels/pikku-command-channels-map.ts","../src/wirings/channels/pikku-command-channels.ts","../src/wirings/channels/pikku-command-websocket-typed.ts","../src/wirings/channels/serialize-typed-channel-map.ts","../src/wirings/channels/serialize-websocket-wrapper.ts","../src/wirings/fetch/index.ts","../src/wirings/functions/pikku-command-function-types.ts","../src/wirings/functions/pikku-command-functions.ts","../src/wirings/functions/pikku-command-services.ts","../src/wirings/functions/pikku-function-types.ts","../src/wirings/functions/pikku-functions.ts","../src/wirings/http/openapi-spec-generator.ts","../src/wirings/http/pikku-command-http-map.ts","../src/wirings/http/pikku-command-http-routes.ts","../src/wirings/http/pikku-command-openapi.ts","../src/wirings/http/pikku-http-routes.ts","../src/wirings/http/serialize-fetch-wrapper.ts","../src/wirings/http/serialize-typed-http-map.ts","../src/wirings/mcp/pikku-command-mcp-json.ts","../src/wirings/mcp/pikku-command-mcp.ts","../src/wirings/mcp/serialize-mcp-json.ts","../src/wirings/queue/pikku-command-queue-map.ts","../src/wirings/queue/pikku-command-queue-service.ts","../src/wirings/queue/pikku-command-queue.ts","../src/wirings/queue/pikku-queue-map.ts","../src/wirings/queue/pikku-queue.ts","../src/wirings/queue/serialize-queue-map.ts","../src/wirings/queue/serialize-queue-meta.ts","../src/wirings/queue/serialize-queue-wrapper.ts","../src/wirings/rpc/pikku-command-rpc-client.ts","../src/wirings/rpc/pikku-command-rpc-map.ts","../src/wirings/rpc/pikku-command-rpc.ts","../src/wirings/rpc/pikku-rpc.ts","../src/wirings/rpc/serialize-rpc-wrapper.ts","../src/wirings/rpc/serialize-typed-rpc-map.ts","../src/wirings/scheduler/pikku-command-scheduler.ts","../src/wirings/scheduler/serialize-scheduler-meta.ts"],"version":"5.8.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikku/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"author": "yasser.fadl@gmail.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@openapi-contrib/json-schema-to-openapi-schema": "^3.0.2",
|
|
25
|
-
"@pikku/core": "^0.
|
|
26
|
-
"@pikku/inspector": "^0.
|
|
25
|
+
"@pikku/core": "^0.9.1",
|
|
26
|
+
"@pikku/inspector": "^0.9.1",
|
|
27
27
|
"@types/cookie": "^0.6.0",
|
|
28
28
|
"@types/uuid": "^10.0.0",
|
|
29
29
|
"chalk": "^5.4.1",
|
package/src/inspector-glob.ts
CHANGED
|
@@ -16,14 +16,14 @@ export const inspectorGlob = async (
|
|
|
16
16
|
'Inspected codebase',
|
|
17
17
|
[false],
|
|
18
18
|
async () => {
|
|
19
|
-
const
|
|
19
|
+
const wiringFiles = (
|
|
20
20
|
await Promise.all(
|
|
21
21
|
srcDirectories.map((dir) =>
|
|
22
22
|
glob(`${path.join(rootDir, dir)}/**/*.ts`)
|
|
23
23
|
)
|
|
24
24
|
)
|
|
25
25
|
).flat()
|
|
26
|
-
result = await inspect(logger,
|
|
26
|
+
result = await inspect(logger, wiringFiles, filters)
|
|
27
27
|
}
|
|
28
28
|
)
|
|
29
29
|
return result!
|
package/src/pikku-cli-config.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { join, dirname, resolve, isAbsolute } from 'path'
|
|
2
2
|
import { readdir, readFile } from 'fs/promises'
|
|
3
|
-
import { OpenAPISpecInfo } from './
|
|
3
|
+
import { OpenAPISpecInfo } from './wirings/http/openapi-spec-generator.js'
|
|
4
4
|
import { InspectorFilters } from '@pikku/inspector'
|
|
5
|
-
import {
|
|
5
|
+
import { PikkuWiringTypes } from '@pikku/core'
|
|
6
6
|
|
|
7
7
|
export interface PikkuCLICoreOutputFiles {
|
|
8
8
|
// Base directory
|
|
@@ -16,39 +16,39 @@ export interface PikkuCLICoreOutputFiles {
|
|
|
16
16
|
functionsFile: string
|
|
17
17
|
functionsMetaFile: string
|
|
18
18
|
|
|
19
|
-
// HTTP
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
// HTTP
|
|
20
|
+
httpWiringsFile: string
|
|
21
|
+
httpWiringMetaFile: string
|
|
22
|
+
httpMapDeclarationFile: string
|
|
23
23
|
|
|
24
24
|
// Channels
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
channelsWiringFile: string
|
|
26
|
+
channelsWiringMetaFile: string
|
|
27
27
|
channelsMapDeclarationFile: string
|
|
28
28
|
|
|
29
29
|
// RPC
|
|
30
|
-
|
|
30
|
+
rpcWiringMetaFile: string
|
|
31
31
|
rpcMapDeclarationFile: string
|
|
32
32
|
|
|
33
33
|
// Schedulers
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
schedulersWiringFile: string
|
|
35
|
+
schedulersWiringMetaFile: string
|
|
36
36
|
|
|
37
37
|
// Queue processors
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
queueWorkersWiringFile: string
|
|
39
|
+
queueWorkersWiringMetaFile: string
|
|
40
40
|
queueMapDeclarationFile: string
|
|
41
41
|
|
|
42
42
|
// MCP
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
mcpWiringsFile: string
|
|
44
|
+
mcpWiringsMetaFile: string
|
|
45
45
|
|
|
46
46
|
// Services
|
|
47
47
|
servicesFile: string
|
|
48
48
|
|
|
49
49
|
// Application bootstrap
|
|
50
50
|
bootstrapFile: string
|
|
51
|
-
bootstrapFiles: Record<
|
|
51
|
+
bootstrapFiles: Record<PikkuWiringTypes, string>
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export type PikkuCLIConfig = {
|
|
@@ -68,8 +68,8 @@ export type PikkuCLIConfig = {
|
|
|
68
68
|
nextHTTPFile?: string
|
|
69
69
|
fetchFile?: string
|
|
70
70
|
websocketFile?: string
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
rpcWiringsFile?: string
|
|
72
|
+
queueWiringsFile?: string
|
|
73
73
|
mcpJsonFile?: string
|
|
74
74
|
|
|
75
75
|
openAPI?: {
|
|
@@ -87,8 +87,8 @@ const CONFIG_DIR_FILES = [
|
|
|
87
87
|
'nextHTTPFile',
|
|
88
88
|
'fetchFile',
|
|
89
89
|
'websocketFile',
|
|
90
|
-
'
|
|
91
|
-
'
|
|
90
|
+
'rpcWiringsFile',
|
|
91
|
+
'queueWiringsFile',
|
|
92
92
|
'mcpJsonFile',
|
|
93
93
|
]
|
|
94
94
|
|
|
@@ -192,28 +192,31 @@ const _getPikkuCLIConfig = async (
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
// HTTP
|
|
195
|
-
if (!result.
|
|
196
|
-
result.
|
|
195
|
+
if (!result.httpWiringsFile) {
|
|
196
|
+
result.httpWiringsFile = join(httpDir, 'pikku-http-wirings.gen.ts')
|
|
197
197
|
}
|
|
198
|
-
if (!result.
|
|
199
|
-
result.
|
|
198
|
+
if (!result.httpWiringMetaFile) {
|
|
199
|
+
result.httpWiringMetaFile = join(
|
|
200
200
|
httpDir,
|
|
201
|
-
'pikku-http-
|
|
201
|
+
'pikku-http-wirings-meta.gen.ts'
|
|
202
202
|
)
|
|
203
203
|
}
|
|
204
|
-
if (!result.
|
|
205
|
-
result.
|
|
204
|
+
if (!result.httpMapDeclarationFile) {
|
|
205
|
+
result.httpMapDeclarationFile = join(
|
|
206
206
|
httpDir,
|
|
207
|
-
'pikku-http-
|
|
207
|
+
'pikku-http-wirings-map.gen.d.ts'
|
|
208
208
|
)
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
// Channels/WebSocket
|
|
212
|
-
if (!result.
|
|
213
|
-
result.
|
|
212
|
+
if (!result.channelsWiringFile) {
|
|
213
|
+
result.channelsWiringFile = join(channelDir, 'pikku-channels.gen.ts')
|
|
214
214
|
}
|
|
215
|
-
if (!result.
|
|
216
|
-
result.
|
|
215
|
+
if (!result.channelsWiringMetaFile) {
|
|
216
|
+
result.channelsWiringMetaFile = join(
|
|
217
|
+
channelDir,
|
|
218
|
+
'pikku-channels-meta.gen.ts'
|
|
219
|
+
)
|
|
217
220
|
}
|
|
218
221
|
if (!result.channelsMapDeclarationFile) {
|
|
219
222
|
result.channelsMapDeclarationFile = join(
|
|
@@ -223,38 +226,47 @@ const _getPikkuCLIConfig = async (
|
|
|
223
226
|
}
|
|
224
227
|
|
|
225
228
|
// RPC
|
|
226
|
-
if (!result.
|
|
227
|
-
result.
|
|
229
|
+
if (!result.rpcWiringMetaFile) {
|
|
230
|
+
result.rpcWiringMetaFile = join(rpcDir, 'pikku-rpc-wirings-meta.gen.ts')
|
|
228
231
|
}
|
|
229
232
|
if (!result.rpcMapDeclarationFile) {
|
|
230
|
-
result.rpcMapDeclarationFile = join(
|
|
233
|
+
result.rpcMapDeclarationFile = join(
|
|
234
|
+
rpcDir,
|
|
235
|
+
'pikku-rpc-wirings-map.gen.d.ts'
|
|
236
|
+
)
|
|
231
237
|
}
|
|
232
238
|
|
|
233
239
|
// Scheduler
|
|
234
|
-
if (!result.
|
|
235
|
-
result.
|
|
240
|
+
if (!result.schedulersWiringFile) {
|
|
241
|
+
result.schedulersWiringFile = join(
|
|
242
|
+
schedulerDir,
|
|
243
|
+
'pikku-schedulers-wirings.gen.ts'
|
|
244
|
+
)
|
|
236
245
|
}
|
|
237
|
-
if (!result.
|
|
238
|
-
result.
|
|
246
|
+
if (!result.schedulersWiringMetaFile) {
|
|
247
|
+
result.schedulersWiringMetaFile = join(
|
|
239
248
|
schedulerDir,
|
|
240
|
-
'pikku-
|
|
249
|
+
'pikku-schedulers-wirings-meta.gen.ts'
|
|
241
250
|
)
|
|
242
251
|
}
|
|
243
252
|
|
|
244
253
|
// Queue
|
|
245
|
-
if (!result.
|
|
246
|
-
result.
|
|
254
|
+
if (!result.queueWorkersWiringFile) {
|
|
255
|
+
result.queueWorkersWiringFile = join(
|
|
256
|
+
queueDir,
|
|
257
|
+
'pikku-queue-workers-wirings.gen.ts'
|
|
258
|
+
)
|
|
247
259
|
}
|
|
248
|
-
if (!result.
|
|
249
|
-
result.
|
|
260
|
+
if (!result.queueWorkersWiringMetaFile) {
|
|
261
|
+
result.queueWorkersWiringMetaFile = join(
|
|
250
262
|
queueDir,
|
|
251
|
-
'pikku-queue-workers-meta.gen.ts'
|
|
263
|
+
'pikku-queue-workers-wirings-meta.gen.ts'
|
|
252
264
|
)
|
|
253
265
|
}
|
|
254
266
|
if (!result.queueMapDeclarationFile) {
|
|
255
267
|
result.queueMapDeclarationFile = join(
|
|
256
268
|
queueDir,
|
|
257
|
-
'pikku-queue-map.gen.ts'
|
|
269
|
+
'pikku-queue-workers-wirings-map.gen.d.ts'
|
|
258
270
|
)
|
|
259
271
|
}
|
|
260
272
|
|
|
@@ -269,18 +281,21 @@ const _getPikkuCLIConfig = async (
|
|
|
269
281
|
}
|
|
270
282
|
|
|
271
283
|
// MCP
|
|
272
|
-
if (!result.
|
|
273
|
-
result.
|
|
284
|
+
if (!result.mcpWiringsMetaFile) {
|
|
285
|
+
result.mcpWiringsMetaFile = join(
|
|
286
|
+
mcpDir,
|
|
287
|
+
'pikku-mcp-wirings-meta.gen.ts'
|
|
288
|
+
)
|
|
274
289
|
}
|
|
275
|
-
if (!result.
|
|
276
|
-
result.
|
|
290
|
+
if (!result.mcpWiringsFile) {
|
|
291
|
+
result.mcpWiringsFile = join(mcpDir, 'pikku-mcp-wirings.gen.ts')
|
|
277
292
|
}
|
|
278
293
|
if (!result.mcpJsonFile) {
|
|
279
|
-
result.mcpJsonFile = join(mcpDir, 'mcp.gen.json')
|
|
294
|
+
result.mcpJsonFile = join(mcpDir, 'pikku-mcp.gen.json')
|
|
280
295
|
}
|
|
281
296
|
|
|
282
297
|
result.bootstrapFiles = result.bootstrapFiles || {}
|
|
283
|
-
for (const key of Object.keys(
|
|
298
|
+
for (const key of Object.keys(PikkuWiringTypes)) {
|
|
284
299
|
const eventDir = join(result.outDir, key.toLowerCase())
|
|
285
300
|
result.bootstrapFiles[key] = join(
|
|
286
301
|
eventDir,
|
|
@@ -13,7 +13,7 @@ export const pikkuNext: PikkuCommand = async (
|
|
|
13
13
|
{
|
|
14
14
|
nextBackendFile,
|
|
15
15
|
nextHTTPFile,
|
|
16
|
-
|
|
16
|
+
httpMapDeclarationFile,
|
|
17
17
|
packageMappings,
|
|
18
18
|
fetchFile,
|
|
19
19
|
bootstrapFiles,
|
|
@@ -72,7 +72,7 @@ export const pikkuNext: PikkuCommand = async (
|
|
|
72
72
|
|
|
73
73
|
const routesMapDeclarationPath = getFileImportRelativePath(
|
|
74
74
|
nextBackendFile,
|
|
75
|
-
|
|
75
|
+
httpMapDeclarationFile,
|
|
76
76
|
packageMappings
|
|
77
77
|
)
|
|
78
78
|
|
|
@@ -89,7 +89,7 @@ export const pikkuNext: PikkuCommand = async (
|
|
|
89
89
|
if (nextHTTPFile && fetchFile) {
|
|
90
90
|
const routesMapDeclarationPath = getFileImportRelativePath(
|
|
91
91
|
nextHTTPFile,
|
|
92
|
-
|
|
92
|
+
httpMapDeclarationFile,
|
|
93
93
|
packageMappings
|
|
94
94
|
)
|
|
95
95
|
|