@pikku/cli 0.7.1 → 0.7.3
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 +17 -0
- package/bin/pikku-all.ts +5 -2
- package/bin/pikku-channels-map.ts +2 -33
- package/bin/pikku-channels.ts +2 -30
- package/bin/pikku-fetch.ts +3 -3
- package/bin/pikku-function-types.ts +8 -42
- package/bin/pikku-functions.ts +3 -16
- package/bin/pikku-http-map.ts +3 -32
- package/bin/pikku-http-routes.ts +2 -30
- package/bin/pikku-nextjs.ts +1 -1
- package/bin/pikku-openapi.ts +4 -2
- package/bin/pikku-rpc-map.ts +25 -0
- package/bin/pikku-rpc.ts +62 -7
- package/bin/pikku-scheduler.ts +2 -30
- package/bin/pikku-schemas.ts +5 -4
- package/bin/pikku-websocket.ts +1 -1
- package/bin/pikku.ts +0 -10
- package/dist/bin/pikku-all.d.ts +1 -1
- package/dist/bin/pikku-all.js +5 -2
- package/dist/bin/pikku-channels-map.d.ts +0 -2
- package/dist/bin/pikku-channels-map.js +1 -16
- package/dist/bin/pikku-channels.d.ts +0 -2
- package/dist/bin/pikku-channels.js +1 -16
- package/dist/bin/pikku-fetch.d.ts +1 -1
- package/dist/bin/pikku-fetch.js +1 -1
- package/dist/bin/pikku-function-types.d.ts +2 -4
- package/dist/bin/pikku-function-types.js +3 -22
- package/dist/bin/pikku-functions.js +3 -4
- package/dist/bin/pikku-http-map.d.ts +0 -2
- package/dist/bin/pikku-http-map.js +2 -17
- package/dist/bin/pikku-http-routes.d.ts +0 -2
- package/dist/bin/pikku-http-routes.js +1 -16
- package/dist/bin/pikku-nextjs.d.ts +1 -1
- package/dist/bin/pikku-nextjs.js +1 -1
- package/dist/bin/pikku-openapi.js +3 -3
- package/dist/bin/pikku-rpc-map.d.ts +3 -0
- package/dist/bin/pikku-rpc-map.js +8 -0
- package/dist/bin/pikku-rpc.d.ts +5 -1
- package/dist/bin/pikku-rpc.js +33 -6
- package/dist/bin/pikku-scheduler.d.ts +0 -2
- package/dist/bin/pikku-scheduler.js +1 -16
- package/dist/bin/pikku-schemas.d.ts +1 -1
- package/dist/bin/pikku-schemas.js +4 -4
- package/dist/bin/pikku-websocket.d.ts +1 -1
- package/dist/bin/pikku-websocket.js +1 -1
- package/dist/bin/pikku.js +0 -10
- package/dist/src/inspector-glob.js +1 -1
- package/dist/src/openapi-spec-generator.d.ts +2 -2
- package/dist/src/openapi-spec-generator.js +14 -5
- package/dist/src/pikku-cli-config.d.ts +7 -5
- package/dist/src/pikku-cli-config.js +6 -0
- package/dist/src/schema-generator.d.ts +3 -3
- package/dist/src/schema-generator.js +16 -34
- package/dist/src/serialize-pikku-types.d.ts +1 -1
- package/dist/src/serialize-pikku-types.js +6 -3
- package/dist/src/serialize-typed-channel-map.js +2 -2
- package/dist/src/serialize-typed-http-map.d.ts +2 -1
- package/dist/src/serialize-typed-http-map.js +11 -5
- package/dist/src/serialize-typed-rpc-map.d.ts +4 -0
- package/dist/src/serialize-typed-rpc-map.js +66 -0
- package/dist/src/{utils.d.ts → utils/utils.d.ts} +2 -1
- package/dist/src/{utils.js → utils/utils.js} +15 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/inspector-glob.ts +1 -1
- package/src/openapi-spec-generator.ts +23 -4
- package/src/pikku-cli-config.ts +31 -5
- package/src/schema-generator.ts +18 -36
- package/src/serialize-pikku-types.ts +6 -3
- package/src/serialize-typed-channel-map.ts +2 -2
- package/src/serialize-typed-http-map.ts +19 -3
- package/src/serialize-typed-rpc-map.ts +105 -0
- package/src/{utils.ts → utils/utils.ts} +20 -2
- package/dist/src/serialize-typed-function-map.d.ts +0 -4
- package/dist/src/serialize-typed-function-map.js +0 -107
- package/src/serialize-typed-function-map.ts +0 -151
- /package/dist/src/{serialize-import-map.d.ts → utils/serialize-import-map.d.ts} +0 -0
- /package/dist/src/{serialize-import-map.js → utils/serialize-import-map.js} +0 -0
- /package/src/{serialize-import-map.ts → utils/serialize-import-map.ts} +0 -0
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { logCommandInfoAndTime, logPikkuLogo, writeFileInDir, } from '../src/utils.js';
|
|
1
|
+
import { logCommandInfoAndTime, writeFileInDir } from '../src/utils/utils.js';
|
|
3
2
|
import { serializeTypedChannelsMap } from '../src/serialize-typed-channel-map.js';
|
|
4
|
-
import { inspectorGlob } from '../src/inspector-glob.js';
|
|
5
3
|
export const pikkuChannelsMap = async ({ channelsMapDeclarationFile, packageMappings }, state) => {
|
|
6
4
|
return await logCommandInfoAndTime('Creating channels map', 'Created channels map', [state.channels.files.size === 0], async () => {
|
|
7
5
|
const content = serializeTypedChannelsMap(channelsMapDeclarationFile, packageMappings, state.functions.typesMap, state.channels.meta);
|
|
8
6
|
await writeFileInDir(channelsMapDeclarationFile, content);
|
|
9
7
|
});
|
|
10
8
|
};
|
|
11
|
-
async function action(cliOptions) {
|
|
12
|
-
logPikkuLogo();
|
|
13
|
-
const cliConfig = await getPikkuCLIConfig(cliOptions.config, ['rootDir', 'srcDirectories', 'httpRoutesFile'], cliOptions.tags, false);
|
|
14
|
-
const visitState = await inspectorGlob(cliConfig.rootDir, cliConfig.srcDirectories, cliConfig.filters);
|
|
15
|
-
await pikkuChannelsMap(cliConfig, visitState);
|
|
16
|
-
}
|
|
17
|
-
export const channelsMap = (program) => {
|
|
18
|
-
program
|
|
19
|
-
.command('channels-map')
|
|
20
|
-
.description('Generate a map of all channels to aid in type checking')
|
|
21
|
-
.option('-c | --config <string>', 'The path to pikku cli config file')
|
|
22
|
-
.action(action);
|
|
23
|
-
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
1
|
import { PikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
3
2
|
import { InspectorState } from '@pikku/inspector';
|
|
4
3
|
export declare const pikkuChannels: (cliConfig: PikkuCLIConfig, visitState: InspectorState) => Promise<boolean>;
|
|
5
|
-
export declare const channels: (program: Command) => void;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { logCommandInfoAndTime, logPikkuLogo, serializeFileImports, writeFileInDir, } from '../src/utils.js';
|
|
3
|
-
import { inspectorGlob } from '../src/inspector-glob.js';
|
|
1
|
+
import { logCommandInfoAndTime, serializeFileImports, writeFileInDir, } from '../src/utils/utils.js';
|
|
4
2
|
export const pikkuChannels = async (cliConfig, visitState) => {
|
|
5
3
|
return await logCommandInfoAndTime('Finding Channels', 'Found channels', [visitState.channels.files.size === 0], async () => {
|
|
6
4
|
const { channelsFile, channelsMetaFile, packageMappings } = cliConfig;
|
|
@@ -9,16 +7,3 @@ export const pikkuChannels = async (cliConfig, visitState) => {
|
|
|
9
7
|
await writeFileInDir(channelsMetaFile, `import { pikkuState } from '@pikku/core'\npikkuState('channel', 'meta', ${JSON.stringify(channels.meta, null, 2)})`);
|
|
10
8
|
});
|
|
11
9
|
};
|
|
12
|
-
async function action(cliOptions) {
|
|
13
|
-
logPikkuLogo();
|
|
14
|
-
const cliConfig = await getPikkuCLIConfig(cliOptions.config, ['rootDir', 'srcDirectories', 'httpRoutesFile'], cliOptions.tags);
|
|
15
|
-
const visitState = await inspectorGlob(cliConfig.rootDir, cliConfig.srcDirectories, cliConfig.filters);
|
|
16
|
-
await pikkuChannels(cliConfig, visitState);
|
|
17
|
-
}
|
|
18
|
-
export const channels = (program) => {
|
|
19
|
-
program
|
|
20
|
-
.command('channels')
|
|
21
|
-
.description('Find all channels to import')
|
|
22
|
-
.option('-c | --config <string>', 'The path to pikku cli config file')
|
|
23
|
-
.action(action);
|
|
24
|
-
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import { PikkuCLIOptions } from '../src/utils.js';
|
|
3
2
|
import { PikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
3
|
+
import { PikkuCLIOptions } from '../src/utils/utils.js';
|
|
4
4
|
export declare const pikkuFetch: ({ fetchFile, httpRoutesMapDeclarationFile, packageMappings, }: PikkuCLIConfig) => Promise<void>;
|
|
5
5
|
export declare const action: (options: PikkuCLIOptions) => Promise<void>;
|
|
6
6
|
export declare const fetch: (program: Command) => void;
|
package/dist/bin/pikku-fetch.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getFileImportRelativePath, logCommandInfoAndTime, logPikkuLogo, writeFileInDir, } from '../src/utils.js';
|
|
2
1
|
import { getPikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
3
2
|
import { serializeFetchWrapper } from '../src/serialize-fetch-wrapper.js';
|
|
3
|
+
import { getFileImportRelativePath, logCommandInfoAndTime, logPikkuLogo, writeFileInDir, } from '../src/utils/utils.js';
|
|
4
4
|
export const pikkuFetch = async ({ fetchFile, httpRoutesMapDeclarationFile, packageMappings, }) => {
|
|
5
5
|
await logCommandInfoAndTime('Generating fetch wrapper', 'Generated fetch wrapper', [fetchFile === undefined, "fetchFile isn't set in the pikku config"], async () => {
|
|
6
6
|
if (!fetchFile) {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
1
|
import { PikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
3
2
|
import { InspectorState } from '@pikku/inspector';
|
|
4
|
-
import { PikkuCLIOptions } from '../src/utils.js';
|
|
5
|
-
export declare const pikkuFunctionTypes: ({ typesDeclarationFile: typesFile, packageMappings }: PikkuCLIConfig, options: PikkuCLIOptions, visitState: InspectorState) => Promise<void>;
|
|
6
|
-
export declare const functionTypes: (program: Command) => void;
|
|
3
|
+
import { PikkuCLIOptions } from '../src/utils/utils.js';
|
|
4
|
+
export declare const pikkuFunctionTypes: ({ typesDeclarationFile: typesFile, packageMappings, rpcMapDeclarationFile, }: PikkuCLIConfig, options: PikkuCLIOptions, visitState: InspectorState) => Promise<void>;
|
|
@@ -1,32 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getFileImportRelativePath, getPikkuFilesAndMethods, logCommandInfoAndTime, logPikkuLogo, writeFileInDir, } from '../src/utils.js';
|
|
3
|
-
import { pikkuHTTP } from './pikku-http-routes.js';
|
|
4
|
-
import { inspectorGlob } from '../src/inspector-glob.js';
|
|
1
|
+
import { getFileImportRelativePath, getPikkuFilesAndMethods, logCommandInfoAndTime, writeFileInDir, } from '../src/utils/utils.js';
|
|
5
2
|
import { serializePikkuTypes } from '../src/serialize-pikku-types.js';
|
|
6
|
-
export const pikkuFunctionTypes = async ({ typesDeclarationFile: typesFile, packageMappings }, options, visitState) => {
|
|
3
|
+
export const pikkuFunctionTypes = async ({ typesDeclarationFile: typesFile, packageMappings, rpcMapDeclarationFile, }, options, visitState) => {
|
|
7
4
|
await logCommandInfoAndTime('Creating api types', 'Created api types', [false], async () => {
|
|
8
5
|
const { userSessionType, sessionServicesType, singletonServicesType } = await getPikkuFilesAndMethods(visitState, packageMappings, typesFile, options, {
|
|
9
6
|
userSessionType: true,
|
|
10
7
|
sessionServiceType: true,
|
|
11
8
|
singletonServicesType: true,
|
|
12
9
|
});
|
|
13
|
-
const content = serializePikkuTypes(`import type { ${userSessionType.type} } from '${getFileImportRelativePath(typesFile, userSessionType.typePath, packageMappings)}'`, userSessionType.type, `import type { ${singletonServicesType.type} } from '${getFileImportRelativePath(typesFile, singletonServicesType.typePath, packageMappings)}'`, singletonServicesType.type, `import type { ${sessionServicesType.type} } from '${getFileImportRelativePath(typesFile, sessionServicesType.typePath, packageMappings)}'`,
|
|
10
|
+
const content = serializePikkuTypes(`import type { ${userSessionType.type} } from '${getFileImportRelativePath(typesFile, userSessionType.typePath, packageMappings)}'`, userSessionType.type, `import type { ${singletonServicesType.type} } from '${getFileImportRelativePath(typesFile, singletonServicesType.typePath, packageMappings)}'`, singletonServicesType.type, `import type { ${sessionServicesType.type} } from '${getFileImportRelativePath(typesFile, sessionServicesType.typePath, packageMappings)}'`, `import type { TypedPikkuRPC } from '${getFileImportRelativePath(typesFile, rpcMapDeclarationFile, packageMappings)}'`);
|
|
14
11
|
await writeFileInDir(typesFile, content);
|
|
15
12
|
});
|
|
16
13
|
};
|
|
17
|
-
async function action(cliOptions) {
|
|
18
|
-
logPikkuLogo();
|
|
19
|
-
const cliConfig = await getPikkuCLIConfig(cliOptions.config, ['rootDir', 'srcDirectories', 'typesDeclarationFile'], cliOptions.tags);
|
|
20
|
-
const visitState = await inspectorGlob(cliConfig.rootDir, cliConfig.srcDirectories, cliConfig.filters);
|
|
21
|
-
await pikkuHTTP(cliConfig, visitState);
|
|
22
|
-
}
|
|
23
|
-
export const functionTypes = (program) => {
|
|
24
|
-
program
|
|
25
|
-
.command('types')
|
|
26
|
-
.description('Generate the core API')
|
|
27
|
-
.option('-ct | --pikku-config-type', 'The type of your pikku config object')
|
|
28
|
-
.option('-ss | --singleton-services-factory-type', 'The type of your singleton services factory')
|
|
29
|
-
.option('-se | --session-services-factory-type', 'The type of your session services factory')
|
|
30
|
-
.option('-c | --config <string>', 'The path to pikku cli config file')
|
|
31
|
-
.action(action);
|
|
32
|
-
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { logCommandInfoAndTime,
|
|
1
|
+
import { logCommandInfoAndTime, writeFileInDir } from '../src/utils/utils.js';
|
|
2
2
|
export const pikkuFunctions = async (cliConfig, visitState) => {
|
|
3
|
-
return await logCommandInfoAndTime('Finding Pikku functions', 'Found Pikku functions', [
|
|
4
|
-
const {
|
|
3
|
+
return await logCommandInfoAndTime('Finding Pikku functions', 'Found Pikku functions', [true], async () => {
|
|
4
|
+
const { functionsMetaFile } = cliConfig;
|
|
5
5
|
const { functions } = visitState;
|
|
6
|
-
await writeFileInDir(functionsFile, serializeFileImports('addFunction', functionsFile, functions.files, packageMappings));
|
|
7
6
|
await writeFileInDir(functionsMetaFile, `import { pikkuState } from '@pikku/core'\npikkuState('function', 'meta', ${JSON.stringify(functions.meta, null, 2)})`);
|
|
8
7
|
});
|
|
9
8
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
1
|
import { PikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
3
2
|
import { InspectorState } from '@pikku/inspector';
|
|
4
3
|
export declare const pikkuHTTPMap: ({ httpRoutesMapDeclarationFile, packageMappings }: PikkuCLIConfig, { http, functions }: InspectorState) => Promise<boolean>;
|
|
5
|
-
export declare const routesMap: (program: Command) => void;
|
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { logCommandInfoAndTime, logPikkuLogo, writeFileInDir, } from '../src/utils.js';
|
|
1
|
+
import { logCommandInfoAndTime, writeFileInDir } from '../src/utils/utils.js';
|
|
3
2
|
import { serializeTypedRoutesMap } from '../src/serialize-typed-http-map.js';
|
|
4
|
-
import { inspectorGlob } from '../src/inspector-glob.js';
|
|
5
3
|
export const pikkuHTTPMap = async ({ httpRoutesMapDeclarationFile, packageMappings }, { http, functions }) => {
|
|
6
4
|
return await logCommandInfoAndTime('Creating HTTP map', 'Created HTTP map', [http.files.size === 0], async () => {
|
|
7
|
-
const content = serializeTypedRoutesMap(httpRoutesMapDeclarationFile, packageMappings, functions.typesMap, http.meta, http.metaInputTypes);
|
|
5
|
+
const content = serializeTypedRoutesMap(httpRoutesMapDeclarationFile, packageMappings, functions.typesMap, functions.meta, http.meta, http.metaInputTypes);
|
|
8
6
|
await writeFileInDir(httpRoutesMapDeclarationFile, content);
|
|
9
7
|
});
|
|
10
8
|
};
|
|
11
|
-
async function action(cliOptions) {
|
|
12
|
-
logPikkuLogo();
|
|
13
|
-
const cliConfig = await getPikkuCLIConfig(cliOptions.config, ['rootDir', 'srcDirectories', 'httpRoutesFile'], cliOptions.tags);
|
|
14
|
-
const visitState = await inspectorGlob(cliConfig.rootDir, cliConfig.srcDirectories, cliConfig.filters);
|
|
15
|
-
await pikkuHTTPMap(cliConfig, visitState);
|
|
16
|
-
}
|
|
17
|
-
export const routesMap = (program) => {
|
|
18
|
-
program
|
|
19
|
-
.command('map')
|
|
20
|
-
.description('Generate a map of all routes to aid in type checking')
|
|
21
|
-
.option('-c | --config <string>', 'The path to pikku cli config file')
|
|
22
|
-
.action(action);
|
|
23
|
-
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
1
|
import { PikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
3
2
|
import { InspectorState } from '@pikku/inspector';
|
|
4
3
|
export declare const pikkuHTTP: (cliConfig: PikkuCLIConfig, visitState: InspectorState) => Promise<boolean>;
|
|
5
|
-
export declare const routes: (program: Command) => void;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { logCommandInfoAndTime, logPikkuLogo, serializeFileImports, writeFileInDir, } from '../src/utils.js';
|
|
3
|
-
import { inspectorGlob } from '../src/inspector-glob.js';
|
|
1
|
+
import { logCommandInfoAndTime, serializeFileImports, writeFileInDir, } from '../src/utils/utils.js';
|
|
4
2
|
export const pikkuHTTP = async (cliConfig, visitState) => {
|
|
5
3
|
return await logCommandInfoAndTime('Finding HTTP routes', 'Found HTTP routes', [visitState.http.files.size === 0], async () => {
|
|
6
4
|
const { httpRoutesFile, httpRoutesMetaFile, packageMappings } = cliConfig;
|
|
@@ -9,16 +7,3 @@ export const pikkuHTTP = async (cliConfig, visitState) => {
|
|
|
9
7
|
await writeFileInDir(httpRoutesMetaFile, `import { pikkuState } from '@pikku/core'\npikkuState('http', 'meta', ${JSON.stringify(http.meta, null, 2)})`);
|
|
10
8
|
});
|
|
11
9
|
};
|
|
12
|
-
async function action(cliOptions) {
|
|
13
|
-
logPikkuLogo();
|
|
14
|
-
const cliConfig = await getPikkuCLIConfig(cliOptions.config, ['rootDir', 'srcDirectories', 'httpRoutesFile'], cliOptions.tags);
|
|
15
|
-
const visitState = await inspectorGlob(cliConfig.rootDir, cliConfig.srcDirectories, cliConfig.filters);
|
|
16
|
-
await pikkuHTTP(cliConfig, visitState);
|
|
17
|
-
}
|
|
18
|
-
export const routes = (program) => {
|
|
19
|
-
program
|
|
20
|
-
.command('routes')
|
|
21
|
-
.description('Find all routes to import')
|
|
22
|
-
.option('-c | --config <string>', 'The path to pikku cli config file')
|
|
23
|
-
.action(action);
|
|
24
|
-
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import { PikkuCLIOptions } from '../src/utils.js';
|
|
2
|
+
import { PikkuCLIOptions } from '../src/utils/utils.js';
|
|
3
3
|
import { PikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
4
4
|
import { InspectorState } from '@pikku/inspector';
|
|
5
5
|
export declare const pikkuNext: ({ nextBackendFile, nextHTTPFile, httpRoutesFile, httpRoutesMapDeclarationFile, schemaDirectory, packageMappings, fetchFile, }: PikkuCLIConfig, visitState: InspectorState, options: PikkuCLIOptions) => Promise<boolean>;
|
package/dist/bin/pikku-nextjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { serializeNextJsBackendWrapper as serializeNextBackendWrapper } from '../src/serialize-nextjs-backend-wrapper.js';
|
|
2
2
|
import { serializeNextJsHTTPWrapper as serializeNextHTTPWrapper } from '../src/serialize-nextjs-http-wrapper.js';
|
|
3
|
-
import { getFileImportRelativePath, getPikkuFilesAndMethods, logCommandInfoAndTime, logPikkuLogo, writeFileInDir, } from '../src/utils.js';
|
|
3
|
+
import { getFileImportRelativePath, getPikkuFilesAndMethods, logCommandInfoAndTime, logPikkuLogo, writeFileInDir, } from '../src/utils/utils.js';
|
|
4
4
|
import { getPikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
5
5
|
import { inspectorGlob } from '../src/inspector-glob.js';
|
|
6
6
|
export const pikkuNext = async ({ nextBackendFile, nextHTTPFile, httpRoutesFile, httpRoutesMapDeclarationFile, schemaDirectory, packageMappings, fetchFile, }, visitState, options) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logCommandInfoAndTime, logPikkuLogo, writeFileInDir, } from '../src/utils.js';
|
|
1
|
+
import { logCommandInfoAndTime, logPikkuLogo, writeFileInDir, } from '../src/utils/utils.js';
|
|
2
2
|
import { generateSchemas } from '../src/schema-generator.js';
|
|
3
3
|
import { generateOpenAPISpec } from '../src/openapi-spec-generator.js';
|
|
4
4
|
import { getPikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
@@ -9,8 +9,8 @@ export const pikkuOpenAPI = async ({ tsconfig, openAPI }, { http, functions }) =
|
|
|
9
9
|
if (!openAPI?.outputFile) {
|
|
10
10
|
throw new Error('openAPI is required');
|
|
11
11
|
}
|
|
12
|
-
const schemas = await generateSchemas(tsconfig,
|
|
13
|
-
const openAPISpec = await generateOpenAPISpec(http.meta, schemas, openAPI.additionalInfo);
|
|
12
|
+
const schemas = await generateSchemas(tsconfig, functions.typesMap, functions.meta, http.meta);
|
|
13
|
+
const openAPISpec = await generateOpenAPISpec(functions.meta, http.meta, schemas, openAPI.additionalInfo);
|
|
14
14
|
if (openAPI.outputFile.endsWith('.json')) {
|
|
15
15
|
await writeFileInDir(openAPI.outputFile, JSON.stringify(openAPISpec, null, 2), true);
|
|
16
16
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { logCommandInfoAndTime, writeFileInDir } from '../src/utils/utils.js';
|
|
2
|
+
import { serializeTypedRPCMap } from '../src/serialize-typed-rpc-map.js';
|
|
3
|
+
export const pikkuRPCMap = async ({ rpcMapDeclarationFile, packageMappings }, { functions, rpc }) => {
|
|
4
|
+
return await logCommandInfoAndTime('Creating RPC map', 'Created RPC map', [rpc.files.size === 0], async () => {
|
|
5
|
+
const content = serializeTypedRPCMap(rpcMapDeclarationFile, packageMappings, functions.typesMap, functions.meta, rpc.meta);
|
|
6
|
+
await writeFileInDir(rpcMapDeclarationFile, content);
|
|
7
|
+
});
|
|
8
|
+
};
|
package/dist/bin/pikku-rpc.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { PikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
2
2
|
import { InspectorState } from '@pikku/inspector';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const serializeRPCImports: (outputPath: string, functionsMap: Map<string, {
|
|
4
|
+
path: string;
|
|
5
|
+
exportedName: string;
|
|
6
|
+
}>, packageMappings?: Record<string, string>) => string;
|
|
7
|
+
export declare const pikkuRPC: ({ rpcFile, rpcMetaFile, packageMappings }: PikkuCLIConfig, { rpc }: InspectorState) => Promise<boolean>;
|
package/dist/bin/pikku-rpc.js
CHANGED
|
@@ -1,8 +1,35 @@
|
|
|
1
|
-
import { logCommandInfoAndTime, writeFileInDir } from '../src/utils.js';
|
|
2
|
-
export const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { getFileImportRelativePath, logCommandInfoAndTime, writeFileInDir, } from '../src/utils/utils.js';
|
|
2
|
+
export const serializeRPCImports = (outputPath, functionsMap, packageMappings = {}) => {
|
|
3
|
+
const serializedImports = [
|
|
4
|
+
`/* Import and register RPCs */`,
|
|
5
|
+
`import { addFunction } from '@pikku/core'`,
|
|
6
|
+
];
|
|
7
|
+
const serializedRegistrations = [];
|
|
8
|
+
// Sort by function name for consistent output
|
|
9
|
+
const sortedEntries = Array.from(functionsMap.entries()).sort((a, b) => a[0].localeCompare(b[0]));
|
|
10
|
+
for (const [name, { path, exportedName }] of sortedEntries) {
|
|
11
|
+
const filePath = getFileImportRelativePath(outputPath, path, packageMappings);
|
|
12
|
+
// For directly exported functions, we can just import and register them
|
|
13
|
+
if (name === exportedName) {
|
|
14
|
+
serializedImports.push(`import { ${exportedName} } from '${filePath}'`);
|
|
15
|
+
serializedRegistrations.push(`addFunction('${name}', { func: ${exportedName} })`);
|
|
16
|
+
}
|
|
17
|
+
// For renamed functions, we need to import and alias them
|
|
18
|
+
else {
|
|
19
|
+
serializedImports.push(`import { ${exportedName} as ${name} } from '${filePath}'`);
|
|
20
|
+
serializedRegistrations.push(`addFunction('${name}', ${name})`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// Add a blank line between imports and registrations
|
|
24
|
+
if (serializedImports.length > 0 && serializedRegistrations.length > 0) {
|
|
25
|
+
serializedImports.push('');
|
|
26
|
+
}
|
|
27
|
+
// Combine the imports and registrations
|
|
28
|
+
return [...serializedImports, ...serializedRegistrations].join('\n');
|
|
29
|
+
};
|
|
30
|
+
export const pikkuRPC = async ({ rpcFile, rpcMetaFile, packageMappings }, { rpc }) => {
|
|
31
|
+
return await logCommandInfoAndTime('Finding RPCs tasks', 'Found RPCs', [rpc.files.size === 0], async () => {
|
|
32
|
+
await writeFileInDir(rpcFile, serializeRPCImports(rpcFile, rpc.files, packageMappings));
|
|
33
|
+
await writeFileInDir(rpcMetaFile, `import { pikkuState } from '@pikku/core'\npikkuState('rpc', 'meta', ${JSON.stringify(rpc.meta, null, 2)})`);
|
|
7
34
|
});
|
|
8
35
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
1
|
import { PikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
3
2
|
import { InspectorState } from '@pikku/inspector';
|
|
4
3
|
export declare const pikkuScheduler: (cliConfig: PikkuCLIConfig, visitState: InspectorState) => Promise<boolean>;
|
|
5
|
-
export declare const schedules: (program: Command) => void;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { logCommandInfoAndTime, logPikkuLogo, serializeFileImports, writeFileInDir, } from '../src/utils.js';
|
|
1
|
+
import { logCommandInfoAndTime, serializeFileImports, writeFileInDir, } from '../src/utils/utils.js';
|
|
3
2
|
import { serializeSchedulerMeta } from '../src/serialize-scheduler-meta.js';
|
|
4
|
-
import { inspectorGlob } from '../src/inspector-glob.js';
|
|
5
3
|
export const pikkuScheduler = async (cliConfig, visitState) => {
|
|
6
4
|
return await logCommandInfoAndTime('Finding scheduled tasks', 'Found scheduled tasks', [visitState.scheduledTasks.files.size === 0], async () => {
|
|
7
5
|
const { schedulersFile, schedulersMetaFile, packageMappings } = cliConfig;
|
|
@@ -10,16 +8,3 @@ export const pikkuScheduler = async (cliConfig, visitState) => {
|
|
|
10
8
|
await writeFileInDir(schedulersFile, serializeFileImports('addSerializedTasks', schedulersFile, scheduledTasks.files, packageMappings));
|
|
11
9
|
});
|
|
12
10
|
};
|
|
13
|
-
async function action(options) {
|
|
14
|
-
logPikkuLogo();
|
|
15
|
-
const cliConfig = await getPikkuCLIConfig(options.config, ['rootDir', 'srcDirectories', 'httpRoutesFile'], options.tags);
|
|
16
|
-
const visitState = await inspectorGlob(cliConfig.rootDir, cliConfig.srcDirectories, cliConfig.filters);
|
|
17
|
-
await pikkuScheduler(cliConfig, visitState);
|
|
18
|
-
}
|
|
19
|
-
export const schedules = (program) => {
|
|
20
|
-
program
|
|
21
|
-
.command('scheduler')
|
|
22
|
-
.description('Find all scheduled tasks to import')
|
|
23
|
-
.option('-c | --config <string>', 'The path to pikku cli config file')
|
|
24
|
-
.action(action);
|
|
25
|
-
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { PikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
3
3
|
import { InspectorState } from '@pikku/inspector';
|
|
4
|
-
export declare const pikkuSchemas: ({ tsconfig, schemaDirectory, supportsImportAttributes }: PikkuCLIConfig, { functions, http
|
|
4
|
+
export declare const pikkuSchemas: ({ tsconfig, schemaDirectory, supportsImportAttributes }: PikkuCLIConfig, { functions, http }: InspectorState) => Promise<boolean>;
|
|
5
5
|
export declare const schemas: (program: Command) => void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { saveSchemas, generateSchemas } from '../src/schema-generator.js';
|
|
2
2
|
import { getPikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
3
|
-
import { logCommandInfoAndTime, logPikkuLogo } from '../src/utils.js';
|
|
3
|
+
import { logCommandInfoAndTime, logPikkuLogo } from '../src/utils/utils.js';
|
|
4
4
|
import { inspectorGlob } from '../src/inspector-glob.js';
|
|
5
|
-
export const pikkuSchemas = async ({ tsconfig, schemaDirectory, supportsImportAttributes }, { functions, http
|
|
5
|
+
export const pikkuSchemas = async ({ tsconfig, schemaDirectory, supportsImportAttributes }, { functions, http }) => {
|
|
6
6
|
return await logCommandInfoAndTime('Creating schemas', 'Created schemas', [false], async () => {
|
|
7
|
-
const schemas = await generateSchemas(tsconfig,
|
|
8
|
-
await saveSchemas(schemaDirectory, schemas, functions.typesMap,
|
|
7
|
+
const schemas = await generateSchemas(tsconfig, functions.typesMap, functions.meta, http.meta);
|
|
8
|
+
await saveSchemas(schemaDirectory, schemas, functions.typesMap, functions.meta, supportsImportAttributes);
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
async function action({ config }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import { PikkuCLIOptions } from '../src/utils.js';
|
|
2
|
+
import { PikkuCLIOptions } from '../src/utils/utils.js';
|
|
3
3
|
import { PikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
4
4
|
export declare const pikkuWebSocket: ({ websocketFile, channelsMapDeclarationFile, packageMappings, }: PikkuCLIConfig) => Promise<void>;
|
|
5
5
|
export declare const action: (options: PikkuCLIOptions) => Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getFileImportRelativePath, logCommandInfoAndTime, logPikkuLogo, writeFileInDir, } from '../src/utils.js';
|
|
1
|
+
import { getFileImportRelativePath, logCommandInfoAndTime, logPikkuLogo, writeFileInDir, } from '../src/utils/utils.js';
|
|
2
2
|
import { getPikkuCLIConfig } from '../src/pikku-cli-config.js';
|
|
3
3
|
import { serializeWebsocketWrapper } from '../src/serialize-websocket-wrapper.js';
|
|
4
4
|
export const pikkuWebSocket = async ({ websocketFile, channelsMapDeclarationFile, packageMappings, }) => {
|
package/dist/bin/pikku.js
CHANGED
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import { schemas } from './pikku-schemas.js';
|
|
4
|
-
import { routes } from './pikku-http-routes.js';
|
|
5
4
|
import { nextjs } from './pikku-nextjs.js';
|
|
6
5
|
import { all } from './pikku-all.js';
|
|
7
|
-
import { functionTypes } from './pikku-function-types.js';
|
|
8
|
-
import { routesMap } from './pikku-http-map.js';
|
|
9
6
|
import { fetch } from './pikku-fetch.js';
|
|
10
|
-
import { channels } from './pikku-channels.js';
|
|
11
|
-
import { schedules } from './pikku-scheduler.js';
|
|
12
7
|
const program = new Command('pikku');
|
|
13
8
|
program.usage('[command]');
|
|
14
9
|
all(program);
|
|
15
|
-
routes(program);
|
|
16
|
-
routesMap(program);
|
|
17
|
-
functionTypes(program);
|
|
18
10
|
schemas(program);
|
|
19
11
|
nextjs(program);
|
|
20
12
|
fetch(program);
|
|
21
|
-
channels(program);
|
|
22
|
-
schedules(program);
|
|
23
13
|
program.parse(process.argv);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
2
|
import { glob } from 'tinyglobby';
|
|
3
3
|
import { inspect } from '@pikku/inspector';
|
|
4
|
-
import { logCommandInfoAndTime } from './utils.js';
|
|
4
|
+
import { logCommandInfoAndTime } from './utils/utils.js';
|
|
5
5
|
export const inspectorGlob = async (rootDir, srcDirectories, filters) => {
|
|
6
6
|
let result;
|
|
7
7
|
await logCommandInfoAndTime('Inspecting codebase', 'Inspected codebase', [false], async () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTTPRoutesMeta } from '@pikku/core';
|
|
1
|
+
import { FunctionsMeta, HTTPRoutesMeta } from '@pikku/core';
|
|
2
2
|
interface OpenAPISpec {
|
|
3
3
|
openapi: string;
|
|
4
4
|
info: {
|
|
@@ -75,5 +75,5 @@ export interface OpenAPISpecInfo {
|
|
|
75
75
|
[key: string]: any[];
|
|
76
76
|
}[];
|
|
77
77
|
}
|
|
78
|
-
export declare function generateOpenAPISpec(routeMeta: HTTPRoutesMeta, schemas: Record<string, any>, additionalInfo: OpenAPISpecInfo): Promise<OpenAPISpec>;
|
|
78
|
+
export declare function generateOpenAPISpec(functionsMeta: FunctionsMeta, routeMeta: HTTPRoutesMeta, schemas: Record<string, any>, additionalInfo: OpenAPISpecInfo): Promise<OpenAPISpec>;
|
|
79
79
|
export {};
|
|
@@ -9,9 +9,12 @@ const getErrorResponseForConstructorName = (constructorName) => {
|
|
|
9
9
|
}
|
|
10
10
|
return undefined;
|
|
11
11
|
};
|
|
12
|
-
const convertSchemasToBodyPayloads = async (routesMeta, schemas) => {
|
|
12
|
+
const convertSchemasToBodyPayloads = async (functionsMeta, routesMeta, schemas) => {
|
|
13
13
|
const requiredSchemas = new Set(routesMeta
|
|
14
|
-
.map(({ inputTypes,
|
|
14
|
+
.map(({ inputTypes, pikkuFuncName }) => {
|
|
15
|
+
const output = functionsMeta[pikkuFuncName]?.outputs?.[0];
|
|
16
|
+
return [inputTypes?.body, output];
|
|
17
|
+
})
|
|
15
18
|
.flat()
|
|
16
19
|
.filter((schema) => !!schema));
|
|
17
20
|
const convertedEntries = await Promise.all(Object.entries(schemas).map(async ([key, schema]) => {
|
|
@@ -26,10 +29,16 @@ const convertSchemasToBodyPayloads = async (routesMeta, schemas) => {
|
|
|
26
29
|
}));
|
|
27
30
|
return Object.fromEntries(convertedEntries.filter((s) => !!s));
|
|
28
31
|
};
|
|
29
|
-
export async function generateOpenAPISpec(routeMeta, schemas, additionalInfo) {
|
|
32
|
+
export async function generateOpenAPISpec(functionsMeta, routeMeta, schemas, additionalInfo) {
|
|
30
33
|
const paths = {};
|
|
31
34
|
routeMeta.forEach((meta) => {
|
|
32
|
-
const { route, method, inputTypes,
|
|
35
|
+
const { route, method, inputTypes, pikkuFuncName, params, query, docs } = meta;
|
|
36
|
+
const functionMeta = functionsMeta[pikkuFuncName];
|
|
37
|
+
if (!functionMeta) {
|
|
38
|
+
console.error(`• No function metadata found for '${pikkuFuncName}' in route '${route}'.`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const output = functionMeta.outputs ? functionMeta.outputs[0] : undefined;
|
|
33
42
|
const path = route.replace(/:(\w+)/g, '{$1}'); // Convert ":param" to "{param}"
|
|
34
43
|
if (!paths[path]) {
|
|
35
44
|
paths[path] = {};
|
|
@@ -103,7 +112,7 @@ export async function generateOpenAPISpec(routeMeta, schemas, additionalInfo) {
|
|
|
103
112
|
servers: additionalInfo.servers,
|
|
104
113
|
paths,
|
|
105
114
|
components: {
|
|
106
|
-
schemas: await convertSchemasToBodyPayloads(routeMeta, schemas),
|
|
115
|
+
schemas: await convertSchemasToBodyPayloads(functionsMeta, routeMeta, schemas),
|
|
107
116
|
responses: {},
|
|
108
117
|
parameters: {},
|
|
109
118
|
examples: {},
|
|
@@ -2,19 +2,21 @@ import { OpenAPISpecInfo } from './openapi-spec-generator.js';
|
|
|
2
2
|
import { InspectorFilters } from '@pikku/inspector';
|
|
3
3
|
export interface PikkuCLICoreOutputFiles {
|
|
4
4
|
outDir?: string;
|
|
5
|
+
schemaDirectory: string;
|
|
6
|
+
typesDeclarationFile: string;
|
|
5
7
|
functionsFile: string;
|
|
6
8
|
functionsMetaFile: string;
|
|
7
9
|
httpRoutesFile: string;
|
|
8
10
|
httpRoutesMetaFile: string;
|
|
11
|
+
httpRoutesMapDeclarationFile: string;
|
|
9
12
|
channelsFile: string;
|
|
10
13
|
channelsMetaFile: string;
|
|
14
|
+
channelsMapDeclarationFile: string;
|
|
15
|
+
rpcFile: string;
|
|
16
|
+
rpcMetaFile: string;
|
|
17
|
+
rpcMapDeclarationFile: string;
|
|
11
18
|
schedulersFile: string;
|
|
12
19
|
schedulersMetaFile: string;
|
|
13
|
-
rpcFile: string;
|
|
14
|
-
schemaDirectory: string;
|
|
15
|
-
typesDeclarationFile: string;
|
|
16
|
-
httpRoutesMapDeclarationFile: string;
|
|
17
|
-
channelsMapDeclarationFile: string;
|
|
18
20
|
bootstrapFile: string;
|
|
19
21
|
}
|
|
20
22
|
export type PikkuCLIConfig = {
|
|
@@ -65,6 +65,12 @@ const _getPikkuCLIConfig = async (configFile = undefined, requiredFields, tags =
|
|
|
65
65
|
if (!result.rpcFile) {
|
|
66
66
|
result.rpcFile = join(result.outDir, 'pikku-rpc.gen.ts');
|
|
67
67
|
}
|
|
68
|
+
if (!result.rpcMetaFile) {
|
|
69
|
+
result.rpcMetaFile = join(result.outDir, 'pikku-rpc-meta.gen.ts');
|
|
70
|
+
}
|
|
71
|
+
if (!result.rpcMapDeclarationFile) {
|
|
72
|
+
result.rpcMapDeclarationFile = join(result.outDir, 'pikku-rpc-map.gen.ts');
|
|
73
|
+
}
|
|
68
74
|
if (!result.httpRoutesFile) {
|
|
69
75
|
result.httpRoutesFile = join(result.outDir, 'pikku-http-routes.gen.ts');
|
|
70
76
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JSONValue } from '@pikku/core';
|
|
1
|
+
import { FunctionsMeta, JSONValue } from '@pikku/core';
|
|
2
2
|
import { HTTPRoutesMeta } from '@pikku/core/http';
|
|
3
3
|
import { TypesMap } from '@pikku/inspector';
|
|
4
|
-
export declare function generateSchemas(tsconfig: string,
|
|
5
|
-
export declare function saveSchemas(schemaParentDir: string, schemas: Record<string, JSONValue>, typesMap: TypesMap,
|
|
4
|
+
export declare function generateSchemas(tsconfig: string, typesMap: TypesMap, functionMeta: FunctionsMeta, httpRoutesMeta: HTTPRoutesMeta): Promise<Record<string, JSONValue>>;
|
|
5
|
+
export declare function saveSchemas(schemaParentDir: string, schemas: Record<string, JSONValue>, typesMap: TypesMap, functionsMeta: FunctionsMeta, supportsImportAttributes: boolean): Promise<void>;
|
|
@@ -1,36 +1,18 @@
|
|
|
1
1
|
import { createGenerator, RootlessError } from 'ts-json-schema-generator';
|
|
2
|
-
import { logInfo, writeFileInDir } from './utils.js';
|
|
2
|
+
import { logInfo, writeFileInDir } from './utils/utils.js';
|
|
3
3
|
import { mkdir, writeFile } from 'fs/promises';
|
|
4
|
-
export async function generateSchemas(tsconfig,
|
|
5
|
-
const schemasSet = new Set(
|
|
6
|
-
for (const {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (uniqueName) {
|
|
13
|
-
found = true;
|
|
14
|
-
schemasSet.add(uniqueName);
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
catch (e) { }
|
|
19
|
-
}
|
|
20
|
-
if (!found) {
|
|
21
|
-
console.error('Input type not found in any types map:', input);
|
|
4
|
+
export async function generateSchemas(tsconfig, typesMap, functionMeta, httpRoutesMeta) {
|
|
5
|
+
const schemasSet = new Set(typesMap.customTypes.keys());
|
|
6
|
+
for (const { inputs, outputs } of Object.values(functionMeta)) {
|
|
7
|
+
const types = [...(inputs || []), ...(outputs || [])];
|
|
8
|
+
for (const type of types) {
|
|
9
|
+
const uniqueName = typesMap.getUniqueName(type);
|
|
10
|
+
if (uniqueName) {
|
|
11
|
+
schemasSet.add(uniqueName);
|
|
22
12
|
}
|
|
23
13
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// const uniqueName = typesMap.getUniqueName(output)
|
|
27
|
-
// if (uniqueName) {
|
|
28
|
-
// console.log('Adding output schema:', uniqueName)
|
|
29
|
-
// schemasSet.add(uniqueName)
|
|
30
|
-
// break
|
|
31
|
-
// }
|
|
32
|
-
// }
|
|
33
|
-
// }
|
|
14
|
+
}
|
|
15
|
+
for (const { inputTypes } of httpRoutesMeta) {
|
|
34
16
|
if (inputTypes?.body) {
|
|
35
17
|
schemasSet.add(inputTypes.body);
|
|
36
18
|
}
|
|
@@ -63,13 +45,13 @@ export async function generateSchemas(tsconfig, typesMaps, httpRoutesMeta) {
|
|
|
63
45
|
});
|
|
64
46
|
return schemas;
|
|
65
47
|
}
|
|
66
|
-
export async function saveSchemas(schemaParentDir, schemas, typesMap,
|
|
48
|
+
export async function saveSchemas(schemaParentDir, schemas, typesMap, functionsMeta, supportsImportAttributes) {
|
|
67
49
|
await writeFileInDir(`${schemaParentDir}/register.gen.ts`, 'export const empty = null;');
|
|
68
50
|
const desiredSchemas = new Set([
|
|
69
|
-
...
|
|
70
|
-
.map(({
|
|
71
|
-
|
|
72
|
-
|
|
51
|
+
...Object.values(functionsMeta)
|
|
52
|
+
.map(({ inputs, outputs }) => [
|
|
53
|
+
inputs?.[0] ? typesMap.getUniqueName(inputs[0]) : undefined,
|
|
54
|
+
outputs?.[0] ? typesMap.getUniqueName(outputs[0]) : undefined,
|
|
73
55
|
])
|
|
74
56
|
.flat()
|
|
75
57
|
.filter((s) => !!s &&
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
3
|
*/
|
|
4
|
-
export declare const serializePikkuTypes: (userSessionTypeImport: string, userSessionTypeName: string, singletonServicesTypeImport: string, singletonServicesTypeName: string, sessionServicesTypeImport: string,
|
|
4
|
+
export declare const serializePikkuTypes: (userSessionTypeImport: string, userSessionTypeName: string, singletonServicesTypeImport: string, singletonServicesTypeName: string, sessionServicesTypeImport: string, rpcMapTypeImport: string) => string;
|