@pikku/cli 0.9.7 → 0.9.9
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/cli.schema.json +13 -3
- package/dist/src/pikku-cli-config.d.ts +1 -0
- package/dist/src/pikku-command-schemas.js +3 -3
- package/dist/src/schema-generator.d.ts +2 -2
- package/dist/src/schema-generator.js +12 -3
- package/dist/src/schemas.js +3 -3
- package/dist/src/serialize-pikku-types.js +3 -3
- package/dist/src/wirings/http/pikku-command-openapi.js +2 -2
- package/package.json +2 -2
- package/run-tests.sh +1 -1
- package/src/pikku-cli-config.ts +2 -0
- package/src/pikku-command-schemas.ts +5 -3
- package/src/schema-generator.ts +20 -5
- package/src/schemas.ts +5 -3
- package/src/serialize-pikku-types.ts +3 -3
- package/src/wirings/http/pikku-command-openapi.ts +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @pikku/cli
|
|
2
2
|
|
|
3
|
+
## 0.9.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 99c2b3a: fix: removing duplicated interaction values from pikku functions
|
|
8
|
+
- Updated dependencies [99c2b3a]
|
|
9
|
+
- @pikku/core@0.9.9
|
|
10
|
+
|
|
11
|
+
## 0.9.8
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- ea89575: feat: adding the ability for custom schema validation / retrieving schemas to use (for example with openapi json_response)
|
|
16
|
+
- Updated dependencies [ea89575]
|
|
17
|
+
- @pikku/core@0.9.8
|
|
18
|
+
|
|
3
19
|
## 0.9.7
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/cli.schema.json
CHANGED
|
@@ -269,10 +269,13 @@
|
|
|
269
269
|
"rootDir": {
|
|
270
270
|
"type": "string"
|
|
271
271
|
},
|
|
272
|
-
"
|
|
272
|
+
"rpcInternalMapDeclarationFile": {
|
|
273
273
|
"type": "string"
|
|
274
274
|
},
|
|
275
|
-
"
|
|
275
|
+
"rpcInternalWiringMetaFile": {
|
|
276
|
+
"type": "string"
|
|
277
|
+
},
|
|
278
|
+
"rpcMapDeclarationFile": {
|
|
276
279
|
"type": "string"
|
|
277
280
|
},
|
|
278
281
|
"rpcWiringsFile": {
|
|
@@ -287,6 +290,12 @@
|
|
|
287
290
|
"schemaDirectory": {
|
|
288
291
|
"type": "string"
|
|
289
292
|
},
|
|
293
|
+
"schemasFromTypes": {
|
|
294
|
+
"items": {
|
|
295
|
+
"type": "string"
|
|
296
|
+
},
|
|
297
|
+
"type": "array"
|
|
298
|
+
},
|
|
290
299
|
"servicesFile": {
|
|
291
300
|
"type": "string"
|
|
292
301
|
},
|
|
@@ -330,8 +339,9 @@
|
|
|
330
339
|
"queueWorkersWiringFile",
|
|
331
340
|
"queueWorkersWiringMetaFile",
|
|
332
341
|
"rootDir",
|
|
342
|
+
"rpcInternalMapDeclarationFile",
|
|
343
|
+
"rpcInternalWiringMetaFile",
|
|
333
344
|
"rpcMapDeclarationFile",
|
|
334
|
-
"rpcWiringMetaFile",
|
|
335
345
|
"schedulersWiringFile",
|
|
336
346
|
"schedulersWiringMetaFile",
|
|
337
347
|
"schemaDirectory",
|
|
@@ -49,6 +49,7 @@ export type PikkuCLIConfig = {
|
|
|
49
49
|
additionalInfo: OpenAPISpecInfo;
|
|
50
50
|
};
|
|
51
51
|
middlewareServices?: string[];
|
|
52
|
+
schemasFromTypes?: string[];
|
|
52
53
|
filters: InspectorFilters;
|
|
53
54
|
} & PikkuCLICoreOutputFiles;
|
|
54
55
|
export declare const getPikkuCLIConfig: (configFile: string | undefined, requiredFields: Array<keyof PikkuCLIConfig>, filters?: InspectorFilters, exitProcess?: boolean) => Promise<PikkuCLIConfig>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { generateSchemas, saveSchemas } from './schema-generator.js';
|
|
2
2
|
import { logCommandInfoAndTime } from './utils.js';
|
|
3
|
-
export const pikkuSchemas = async (logger, { tsconfig, schemaDirectory, supportsImportAttributes }, { functions, http }) => {
|
|
3
|
+
export const pikkuSchemas = async (logger, { tsconfig, schemaDirectory, supportsImportAttributes, schemasFromTypes }, { functions, http }) => {
|
|
4
4
|
return await logCommandInfoAndTime(logger, 'Creating schemas', 'Created schemas', [false], async () => {
|
|
5
|
-
const schemas = await generateSchemas(logger, tsconfig, functions.typesMap, functions.meta, http.meta);
|
|
6
|
-
await saveSchemas(logger, schemaDirectory, schemas, functions.typesMap, functions.meta, supportsImportAttributes);
|
|
5
|
+
const schemas = await generateSchemas(logger, tsconfig, functions.typesMap, functions.meta, http.meta, schemasFromTypes);
|
|
6
|
+
await saveSchemas(logger, schemaDirectory, schemas, functions.typesMap, functions.meta, supportsImportAttributes, schemasFromTypes);
|
|
7
7
|
});
|
|
8
8
|
};
|
|
@@ -2,5 +2,5 @@ import { CLILogger } from './utils.js';
|
|
|
2
2
|
import { FunctionsMeta, JSONValue } from '@pikku/core';
|
|
3
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, httpWiringsMeta: HTTPWiringsMeta): Promise<Record<string, JSONValue>>;
|
|
6
|
-
export declare function saveSchemas(logger: CLILogger, schemaParentDir: string, schemas: Record<string, JSONValue>, typesMap: TypesMap, functionsMeta: FunctionsMeta, supportsImportAttributes: boolean): Promise<void>;
|
|
5
|
+
export declare function generateSchemas(logger: CLILogger, tsconfig: string, typesMap: TypesMap, functionMeta: FunctionsMeta, httpWiringsMeta: HTTPWiringsMeta, additionalTypes?: string[]): Promise<Record<string, JSONValue>>;
|
|
6
|
+
export declare function saveSchemas(logger: CLILogger, schemaParentDir: string, schemas: Record<string, JSONValue>, typesMap: TypesMap, functionsMeta: FunctionsMeta, supportsImportAttributes: boolean, additionalTypes?: string[]): 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, httpWiringsMeta) {
|
|
4
|
+
export async function generateSchemas(logger, tsconfig, typesMap, functionMeta, httpWiringsMeta, additionalTypes) {
|
|
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 || [])];
|
|
@@ -25,6 +25,12 @@ export async function generateSchemas(logger, tsconfig, typesMap, functionMeta,
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
// Add additional types from schemasFromTypes config
|
|
29
|
+
if (additionalTypes) {
|
|
30
|
+
for (const type of additionalTypes) {
|
|
31
|
+
schemasSet.add(type);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
28
34
|
const generator = createGenerator({
|
|
29
35
|
tsconfig,
|
|
30
36
|
skipTypeCheck: true,
|
|
@@ -53,7 +59,7 @@ export async function generateSchemas(logger, tsconfig, typesMap, functionMeta,
|
|
|
53
59
|
});
|
|
54
60
|
return schemas;
|
|
55
61
|
}
|
|
56
|
-
export async function saveSchemas(logger, schemaParentDir, schemas, typesMap, functionsMeta, supportsImportAttributes) {
|
|
62
|
+
export async function saveSchemas(logger, schemaParentDir, schemas, typesMap, functionsMeta, supportsImportAttributes, additionalTypes) {
|
|
57
63
|
await writeFileInDir(logger, `${schemaParentDir}/register.gen.ts`, 'export const empty = null;');
|
|
58
64
|
const desiredSchemas = new Set([
|
|
59
65
|
...Object.values(functionsMeta)
|
|
@@ -65,6 +71,7 @@ export async function saveSchemas(logger, schemaParentDir, schemas, typesMap, fu
|
|
|
65
71
|
.filter((s) => !!s &&
|
|
66
72
|
!['boolean', 'string', 'number', 'null', 'undefined'].includes(s)),
|
|
67
73
|
...typesMap.customTypes.keys(),
|
|
74
|
+
...(additionalTypes || []),
|
|
68
75
|
]);
|
|
69
76
|
if (desiredSchemas.size === 0) {
|
|
70
77
|
logger.info(`• Skipping schemas since none found.\x1b[0m`);
|
|
@@ -76,7 +83,9 @@ export async function saveSchemas(logger, schemaParentDir, schemas, typesMap, fu
|
|
|
76
83
|
await writeFile(`${schemaParentDir}/schemas/${schemaName}.schema.json`, JSON.stringify(schema), 'utf-8');
|
|
77
84
|
}
|
|
78
85
|
}));
|
|
79
|
-
|
|
86
|
+
// Only include schemas that were successfully generated
|
|
87
|
+
const availableSchemas = Array.from(desiredSchemas).filter((schema) => schemas[schema]);
|
|
88
|
+
const schemaImports = availableSchemas
|
|
80
89
|
.map((schema) => `
|
|
81
90
|
import * as ${schema} from './schemas/${schema}.schema.json' ${supportsImportAttributes ? `with { type: 'json' }` : ''}
|
|
82
91
|
addSchema('${schema}', ${schema})
|
package/dist/src/schemas.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { saveSchemas, generateSchemas } from './schema-generator.js';
|
|
2
2
|
import { logCommandInfoAndTime } from './utils.js';
|
|
3
|
-
export const pikkuSchemas = async (logger, { tsconfig, schemaDirectory, supportsImportAttributes }, { functions, http }) => {
|
|
3
|
+
export const pikkuSchemas = async (logger, { tsconfig, schemaDirectory, supportsImportAttributes, schemasFromTypes }, { functions, http }) => {
|
|
4
4
|
return await logCommandInfoAndTime(logger, 'Creating schemas', 'Created schemas', [false], async () => {
|
|
5
|
-
const schemas = await generateSchemas(logger, tsconfig, functions.typesMap, functions.meta, http.meta);
|
|
6
|
-
await saveSchemas(logger, schemaDirectory, schemas, functions.typesMap, functions.meta, supportsImportAttributes);
|
|
5
|
+
const schemas = await generateSchemas(logger, tsconfig, functions.typesMap, functions.meta, http.meta, schemasFromTypes);
|
|
6
|
+
await saveSchemas(logger, schemaDirectory, schemas, functions.typesMap, functions.meta, supportsImportAttributes, schemasFromTypes);
|
|
7
7
|
});
|
|
8
8
|
};
|
|
@@ -6,7 +6,7 @@ export const serializePikkuTypes = (userSessionTypeImport, userSessionTypeName,
|
|
|
6
6
|
* This is used to provide the application types in the typescript project
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { CorePikkuFunctionConfig, CorePikkuPermission, CorePikkuMiddleware, addHTTPMiddleware, addMiddleware, addPermission } from '@pikku/core'
|
|
9
|
+
import { CorePikkuFunctionConfig, CorePikkuPermission, CorePikkuMiddleware, addHTTPMiddleware, addMiddleware, addPermission, PikkuInteraction } from '@pikku/core'
|
|
10
10
|
import { CorePikkuFunction, CorePikkuFunctionSessionless } from '@pikku/core/function'
|
|
11
11
|
import { CoreHTTPFunctionWiring, AssertHTTPWiringParams, wireHTTP as wireHTTPCore } from '@pikku/core/http'
|
|
12
12
|
import { CoreScheduledTask, wireScheduler as wireSchedulerCore } from '@pikku/core/scheduler'
|
|
@@ -86,7 +86,7 @@ type PikkuFunctionSessionless<
|
|
|
86
86
|
Out = never,
|
|
87
87
|
ChannelData = null, // null means optional channel
|
|
88
88
|
MCPData = null, // null means optional MCP
|
|
89
|
-
RequiredServices extends Services = Omit<Services,
|
|
89
|
+
RequiredServices extends Services = Omit<Services, keyof PikkuInteraction> &
|
|
90
90
|
{ rpc: TypedPikkuRPC } & (
|
|
91
91
|
[ChannelData] extends [null]
|
|
92
92
|
? { channel?: PikkuChannel<unknown, Out> } // Optional channel
|
|
@@ -112,7 +112,7 @@ type PikkuFunction<
|
|
|
112
112
|
Out = never,
|
|
113
113
|
ChannelData = null, // null means optional channel
|
|
114
114
|
MCPData = null, // null means optional MCP
|
|
115
|
-
RequiredServices extends Services = Omit<Services,
|
|
115
|
+
RequiredServices extends Services = Omit<Services, keyof PikkuInteraction> &
|
|
116
116
|
{ rpc: TypedPikkuRPC } & (
|
|
117
117
|
[ChannelData] extends [null]
|
|
118
118
|
? { channel?: PikkuChannel<unknown, Out> } // Optional channel
|
|
@@ -2,12 +2,12 @@ import { logCommandInfoAndTime, writeFileInDir } from '../../utils.js';
|
|
|
2
2
|
import { generateSchemas } from '../../schema-generator.js';
|
|
3
3
|
import { generateOpenAPISpec } from './openapi-spec-generator.js';
|
|
4
4
|
import { stringify } from 'yaml';
|
|
5
|
-
export const pikkuOpenAPI = async (logger, { tsconfig, openAPI }, { http, functions }) => {
|
|
5
|
+
export const pikkuOpenAPI = async (logger, { tsconfig, openAPI, schemasFromTypes }, { http, functions }) => {
|
|
6
6
|
return await logCommandInfoAndTime(logger, 'Creating OpenAPI spec', 'Created OpenAPI spec', [openAPI?.outputFile === undefined, 'openAPI outfile is not defined'], async () => {
|
|
7
7
|
if (!openAPI?.outputFile) {
|
|
8
8
|
throw new Error('openAPI is required');
|
|
9
9
|
}
|
|
10
|
-
const schemas = await generateSchemas(logger, tsconfig, functions.typesMap, functions.meta, http.meta);
|
|
10
|
+
const schemas = await generateSchemas(logger, tsconfig, functions.typesMap, functions.meta, http.meta, schemasFromTypes);
|
|
11
11
|
const openAPISpec = await generateOpenAPISpec(functions.meta, http.meta, schemas, openAPI.additionalInfo);
|
|
12
12
|
if (openAPI.outputFile.endsWith('.json')) {
|
|
13
13
|
await writeFileInDir(logger, openAPI.outputFile, JSON.stringify(openAPISpec, null, 2), { ignoreModifyComment: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikku/cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"author": "yasser.fadl@gmail.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@openapi-contrib/json-schema-to-openapi-schema": "^4.0.2",
|
|
25
|
-
"@pikku/core": "^0.9.
|
|
25
|
+
"@pikku/core": "^0.9.9",
|
|
26
26
|
"@pikku/inspector": "^0.9.4",
|
|
27
27
|
"@types/cookie": "^1.0.0",
|
|
28
28
|
"@types/uuid": "^10.0.0",
|
package/run-tests.sh
CHANGED
|
@@ -46,7 +46,7 @@ if [ "$watch_mode" = true ]; then
|
|
|
46
46
|
fi
|
|
47
47
|
|
|
48
48
|
if [ "$coverage_mode" = true ]; then
|
|
49
|
-
node_cmd="$node_cmd --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=lcov.info"
|
|
49
|
+
node_cmd="$node_cmd --test-coverage-include=\"src/**/*.{ts,js}\" --test-coverage-exclude=\"**/dist/**\" --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=lcov.info"
|
|
50
50
|
fi
|
|
51
51
|
|
|
52
52
|
# Execute the node command with the expanded list of files
|
package/src/pikku-cli-config.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { PikkuCommand } from './types.js'
|
|
|
4
4
|
|
|
5
5
|
export const pikkuSchemas: PikkuCommand = async (
|
|
6
6
|
logger,
|
|
7
|
-
{ tsconfig, schemaDirectory, supportsImportAttributes },
|
|
7
|
+
{ tsconfig, schemaDirectory, supportsImportAttributes, schemasFromTypes },
|
|
8
8
|
{ functions, http }
|
|
9
9
|
) => {
|
|
10
10
|
return await logCommandInfoAndTime(
|
|
@@ -18,7 +18,8 @@ export const pikkuSchemas: PikkuCommand = async (
|
|
|
18
18
|
tsconfig,
|
|
19
19
|
functions.typesMap,
|
|
20
20
|
functions.meta,
|
|
21
|
-
http.meta
|
|
21
|
+
http.meta,
|
|
22
|
+
schemasFromTypes
|
|
22
23
|
)
|
|
23
24
|
await saveSchemas(
|
|
24
25
|
logger,
|
|
@@ -26,7 +27,8 @@ export const pikkuSchemas: PikkuCommand = async (
|
|
|
26
27
|
schemas,
|
|
27
28
|
functions.typesMap,
|
|
28
29
|
functions.meta,
|
|
29
|
-
supportsImportAttributes
|
|
30
|
+
supportsImportAttributes,
|
|
31
|
+
schemasFromTypes
|
|
30
32
|
)
|
|
31
33
|
}
|
|
32
34
|
)
|
package/src/schema-generator.ts
CHANGED
|
@@ -10,7 +10,8 @@ export async function generateSchemas(
|
|
|
10
10
|
tsconfig: string,
|
|
11
11
|
typesMap: TypesMap,
|
|
12
12
|
functionMeta: FunctionsMeta,
|
|
13
|
-
httpWiringsMeta: HTTPWiringsMeta
|
|
13
|
+
httpWiringsMeta: HTTPWiringsMeta,
|
|
14
|
+
additionalTypes?: string[]
|
|
14
15
|
): Promise<Record<string, JSONValue>> {
|
|
15
16
|
const schemasSet = new Set(typesMap.customTypes.keys())
|
|
16
17
|
for (const { inputs, outputs } of Object.values(functionMeta)) {
|
|
@@ -37,6 +38,13 @@ export async function generateSchemas(
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
// Add additional types from schemasFromTypes config
|
|
42
|
+
if (additionalTypes) {
|
|
43
|
+
for (const type of additionalTypes) {
|
|
44
|
+
schemasSet.add(type)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
40
48
|
const generator = createGenerator({
|
|
41
49
|
tsconfig,
|
|
42
50
|
skipTypeCheck: true,
|
|
@@ -72,7 +80,8 @@ export async function saveSchemas(
|
|
|
72
80
|
schemas: Record<string, JSONValue>,
|
|
73
81
|
typesMap: TypesMap,
|
|
74
82
|
functionsMeta: FunctionsMeta,
|
|
75
|
-
supportsImportAttributes: boolean
|
|
83
|
+
supportsImportAttributes: boolean,
|
|
84
|
+
additionalTypes?: string[]
|
|
76
85
|
) {
|
|
77
86
|
await writeFileInDir(
|
|
78
87
|
logger,
|
|
@@ -80,7 +89,7 @@ export async function saveSchemas(
|
|
|
80
89
|
'export const empty = null;'
|
|
81
90
|
)
|
|
82
91
|
|
|
83
|
-
const desiredSchemas = new Set([
|
|
92
|
+
const desiredSchemas = new Set<string>([
|
|
84
93
|
...Object.values(functionsMeta)
|
|
85
94
|
.map(({ inputs, outputs }) => [
|
|
86
95
|
inputs?.[0] ? typesMap.getUniqueName(inputs[0]) : undefined,
|
|
@@ -88,11 +97,12 @@ export async function saveSchemas(
|
|
|
88
97
|
])
|
|
89
98
|
.flat()
|
|
90
99
|
.filter(
|
|
91
|
-
(s) =>
|
|
100
|
+
(s): s is string =>
|
|
92
101
|
!!s &&
|
|
93
102
|
!['boolean', 'string', 'number', 'null', 'undefined'].includes(s)
|
|
94
103
|
),
|
|
95
104
|
...typesMap.customTypes.keys(),
|
|
105
|
+
...(additionalTypes || []),
|
|
96
106
|
])
|
|
97
107
|
|
|
98
108
|
if (desiredSchemas.size === 0) {
|
|
@@ -113,7 +123,12 @@ export async function saveSchemas(
|
|
|
113
123
|
})
|
|
114
124
|
)
|
|
115
125
|
|
|
116
|
-
|
|
126
|
+
// Only include schemas that were successfully generated
|
|
127
|
+
const availableSchemas = Array.from(desiredSchemas).filter(
|
|
128
|
+
(schema) => schemas[schema]
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
const schemaImports = availableSchemas
|
|
117
132
|
.map(
|
|
118
133
|
(schema) => `
|
|
119
134
|
import * as ${schema} from './schemas/${schema}.schema.json' ${supportsImportAttributes ? `with { type: 'json' }` : ''}
|
package/src/schemas.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { PikkuCommand } from './types.js'
|
|
|
4
4
|
|
|
5
5
|
export const pikkuSchemas: PikkuCommand = async (
|
|
6
6
|
logger,
|
|
7
|
-
{ tsconfig, schemaDirectory, supportsImportAttributes },
|
|
7
|
+
{ tsconfig, schemaDirectory, supportsImportAttributes, schemasFromTypes },
|
|
8
8
|
{ functions, http }
|
|
9
9
|
) => {
|
|
10
10
|
return await logCommandInfoAndTime(
|
|
@@ -18,7 +18,8 @@ export const pikkuSchemas: PikkuCommand = async (
|
|
|
18
18
|
tsconfig,
|
|
19
19
|
functions.typesMap,
|
|
20
20
|
functions.meta,
|
|
21
|
-
http.meta
|
|
21
|
+
http.meta,
|
|
22
|
+
schemasFromTypes
|
|
22
23
|
)
|
|
23
24
|
await saveSchemas(
|
|
24
25
|
logger,
|
|
@@ -26,7 +27,8 @@ export const pikkuSchemas: PikkuCommand = async (
|
|
|
26
27
|
schemas,
|
|
27
28
|
functions.typesMap,
|
|
28
29
|
functions.meta,
|
|
29
|
-
supportsImportAttributes
|
|
30
|
+
supportsImportAttributes,
|
|
31
|
+
schemasFromTypes
|
|
30
32
|
)
|
|
31
33
|
}
|
|
32
34
|
)
|
|
@@ -14,7 +14,7 @@ export const serializePikkuTypes = (
|
|
|
14
14
|
* This is used to provide the application types in the typescript project
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { CorePikkuFunctionConfig, CorePikkuPermission, CorePikkuMiddleware, addHTTPMiddleware, addMiddleware, addPermission } from '@pikku/core'
|
|
17
|
+
import { CorePikkuFunctionConfig, CorePikkuPermission, CorePikkuMiddleware, addHTTPMiddleware, addMiddleware, addPermission, PikkuInteraction } from '@pikku/core'
|
|
18
18
|
import { CorePikkuFunction, CorePikkuFunctionSessionless } from '@pikku/core/function'
|
|
19
19
|
import { CoreHTTPFunctionWiring, AssertHTTPWiringParams, wireHTTP as wireHTTPCore } from '@pikku/core/http'
|
|
20
20
|
import { CoreScheduledTask, wireScheduler as wireSchedulerCore } from '@pikku/core/scheduler'
|
|
@@ -94,7 +94,7 @@ type PikkuFunctionSessionless<
|
|
|
94
94
|
Out = never,
|
|
95
95
|
ChannelData = null, // null means optional channel
|
|
96
96
|
MCPData = null, // null means optional MCP
|
|
97
|
-
RequiredServices extends Services = Omit<Services,
|
|
97
|
+
RequiredServices extends Services = Omit<Services, keyof PikkuInteraction> &
|
|
98
98
|
{ rpc: TypedPikkuRPC } & (
|
|
99
99
|
[ChannelData] extends [null]
|
|
100
100
|
? { channel?: PikkuChannel<unknown, Out> } // Optional channel
|
|
@@ -120,7 +120,7 @@ type PikkuFunction<
|
|
|
120
120
|
Out = never,
|
|
121
121
|
ChannelData = null, // null means optional channel
|
|
122
122
|
MCPData = null, // null means optional MCP
|
|
123
|
-
RequiredServices extends Services = Omit<Services,
|
|
123
|
+
RequiredServices extends Services = Omit<Services, keyof PikkuInteraction> &
|
|
124
124
|
{ rpc: TypedPikkuRPC } & (
|
|
125
125
|
[ChannelData] extends [null]
|
|
126
126
|
? { channel?: PikkuChannel<unknown, Out> } // Optional channel
|
|
@@ -6,7 +6,7 @@ import { PikkuCommand } from '../../types.js'
|
|
|
6
6
|
|
|
7
7
|
export const pikkuOpenAPI: PikkuCommand = async (
|
|
8
8
|
logger,
|
|
9
|
-
{ tsconfig, openAPI },
|
|
9
|
+
{ tsconfig, openAPI, schemasFromTypes },
|
|
10
10
|
{ http, functions }
|
|
11
11
|
) => {
|
|
12
12
|
return await logCommandInfoAndTime(
|
|
@@ -23,7 +23,8 @@ export const pikkuOpenAPI: PikkuCommand = async (
|
|
|
23
23
|
tsconfig,
|
|
24
24
|
functions.typesMap,
|
|
25
25
|
functions.meta,
|
|
26
|
-
http.meta
|
|
26
|
+
http.meta,
|
|
27
|
+
schemasFromTypes
|
|
27
28
|
)
|
|
28
29
|
const openAPISpec = await generateOpenAPISpec(
|
|
29
30
|
functions.meta,
|