@pikku/cli 0.9.6 → 0.9.7
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 +7 -0
- package/bin/pikku-all.ts +1 -2
- package/dist/bin/pikku-all.js +1 -2
- package/dist/src/pikku-cli-config.d.ts +0 -1
- package/dist/src/pikku-cli-config.js +0 -3
- package/dist/src/serialize-import-map.js +5 -5
- package/dist/src/serialize-pikku-types.js +1 -1
- package/dist/src/wirings/rpc/pikku-command-rpc-client.js +1 -1
- package/dist/src/wirings/rpc/pikku-command-rpc.js +1 -4
- package/package.json +1 -1
- package/src/pikku-cli-config.ts +0 -7
- package/src/serialize-import-map.ts +6 -4
- package/src/serialize-pikku-types.ts +1 -1
- package/src/wirings/rpc/pikku-command-rpc-client.ts +1 -6
- package/src/wirings/rpc/pikku-command-rpc.ts +1 -9
package/CHANGELOG.md
CHANGED
package/bin/pikku-all.ts
CHANGED
|
@@ -115,7 +115,6 @@ const runAll = async (
|
|
|
115
115
|
await pikkuRPCInternalMap(logger, cliConfig, visitState)
|
|
116
116
|
await pikkuRPCExposedMap(logger, cliConfig, visitState)
|
|
117
117
|
await pikkuRPCClient(logger, cliConfig)
|
|
118
|
-
allImports.push(cliConfig.rpcWiringMetaFile)
|
|
119
118
|
|
|
120
119
|
const schemas = await pikkuSchemas(logger, cliConfig, visitState)
|
|
121
120
|
if (schemas) {
|
|
@@ -127,7 +126,7 @@ const runAll = async (
|
|
|
127
126
|
logger,
|
|
128
127
|
cliConfig,
|
|
129
128
|
cliConfig.bootstrapFiles.rpc,
|
|
130
|
-
[
|
|
129
|
+
[],
|
|
131
130
|
schemas
|
|
132
131
|
)
|
|
133
132
|
|
package/dist/bin/pikku-all.js
CHANGED
|
@@ -67,13 +67,12 @@ const runAll = async (logger, cliConfig, options) => {
|
|
|
67
67
|
await pikkuRPCInternalMap(logger, cliConfig, visitState);
|
|
68
68
|
await pikkuRPCExposedMap(logger, cliConfig, visitState);
|
|
69
69
|
await pikkuRPCClient(logger, cliConfig);
|
|
70
|
-
allImports.push(cliConfig.rpcWiringMetaFile);
|
|
71
70
|
const schemas = await pikkuSchemas(logger, cliConfig, visitState);
|
|
72
71
|
if (schemas) {
|
|
73
72
|
allImports.push(`${cliConfig.schemaDirectory}/register.gen.ts`);
|
|
74
73
|
}
|
|
75
74
|
// RPC bootstrap is always generated since RPC is always present
|
|
76
|
-
await generateBootstrapFile(logger, cliConfig, cliConfig.bootstrapFiles.rpc, [
|
|
75
|
+
await generateBootstrapFile(logger, cliConfig, cliConfig.bootstrapFiles.rpc, [], schemas);
|
|
77
76
|
const http = await pikkuHTTP(logger, cliConfig, visitState);
|
|
78
77
|
if (http) {
|
|
79
78
|
await pikkuHTTPMap(logger, cliConfig, visitState);
|
|
@@ -16,7 +16,6 @@ export interface PikkuCLICoreOutputFiles {
|
|
|
16
16
|
channelsMapDeclarationFile: string;
|
|
17
17
|
rpcInternalWiringMetaFile: string;
|
|
18
18
|
rpcInternalMapDeclarationFile: string;
|
|
19
|
-
rpcWiringMetaFile: string;
|
|
20
19
|
rpcMapDeclarationFile: string;
|
|
21
20
|
schedulersWiringFile: string;
|
|
22
21
|
schedulersWiringMetaFile: string;
|
|
@@ -111,9 +111,6 @@ const _getPikkuCLIConfig = async (configFile = undefined, requiredFields, filter
|
|
|
111
111
|
result.rpcInternalMapDeclarationFile = join(internalRPCDirectory, 'pikku-rpc-wirings-map.internal.gen.d.ts');
|
|
112
112
|
}
|
|
113
113
|
// External
|
|
114
|
-
if (!result.rpcWiringMetaFile) {
|
|
115
|
-
result.rpcWiringMetaFile = join(externalRPCDirectory, 'pikku-rpc-wirings-meta.gen.ts');
|
|
116
|
-
}
|
|
117
114
|
if (!result.rpcMapDeclarationFile) {
|
|
118
115
|
result.rpcMapDeclarationFile = join(externalRPCDirectory, 'pikku-rpc-wirings-map.gen.d.ts');
|
|
119
116
|
}
|
|
@@ -72,11 +72,11 @@ export const serializeImportMap = (relativeToPath, packageMappings, typesMap, re
|
|
|
72
72
|
if (uniqueName === '__object') {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
variables.push(
|
|
75
|
+
const importName = originalName === uniqueName
|
|
76
|
+
? originalName
|
|
77
|
+
: `${originalName} as ${uniqueName}`;
|
|
78
|
+
if (!variables.includes(importName)) {
|
|
79
|
+
variables.push(importName);
|
|
80
80
|
}
|
|
81
81
|
paths.set(path, variables);
|
|
82
82
|
});
|
|
@@ -340,7 +340,7 @@ export const pikkuChannelFunc = <In = unknown, Out = unknown, ChannelData = unkn
|
|
|
340
340
|
export const pikkuVoidFunc = (
|
|
341
341
|
func:
|
|
342
342
|
| PikkuFunctionSessionless<void, void>
|
|
343
|
-
| CorePikkuFunctionConfig<
|
|
343
|
+
| CorePikkuFunctionConfig<PikkuFunctionSessionless<void, void>, PikkuPermission<void>>
|
|
344
344
|
) => {
|
|
345
345
|
return typeof func === 'function' ? func : func.func
|
|
346
346
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { serializeRPCWrapper } from './serialize-rpc-wrapper.js';
|
|
2
2
|
import { getFileImportRelativePath, logCommandInfoAndTime, writeFileInDir, } from '../../utils.js';
|
|
3
|
-
export const pikkuRPCClient = async (logger, { rpcWiringsFile, rpcMapDeclarationFile,
|
|
3
|
+
export const pikkuRPCClient = async (logger, { rpcWiringsFile, rpcMapDeclarationFile, packageMappings }) => {
|
|
4
4
|
return await logCommandInfoAndTime(logger, 'Generating RPC wrappers', 'Generated RPC wrappers', [
|
|
5
5
|
rpcWiringsFile === undefined || rpcWiringsFile === null,
|
|
6
6
|
"rpcWiringsFile isn't set in the pikku config",
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { logCommandInfoAndTime, writeFileInDir } from '../../utils.js';
|
|
2
|
-
export const pikkuRPC = async (logger, { rpcInternalWiringMetaFile
|
|
2
|
+
export const pikkuRPC = async (logger, { rpcInternalWiringMetaFile }, { rpc }) => {
|
|
3
3
|
return await logCommandInfoAndTime(logger, 'Finding RPCs tasks', 'Found RPCs', [false], async () => {
|
|
4
4
|
if (rpc.internalFiles.size > 0) {
|
|
5
5
|
await writeFileInDir(logger, rpcInternalWiringMetaFile, `import { pikkuState } from '@pikku/core'\npikkuState('rpc', 'meta', ${JSON.stringify(rpc.internalMeta, null, 2)})`);
|
|
6
6
|
}
|
|
7
|
-
if (rpc.exposedFiles.size > 0) {
|
|
8
|
-
await writeFileInDir(logger, rpcWiringMetaFile, `import { pikkuState } from '@pikku/core'\npikkuState('rpc', 'meta', ${JSON.stringify(rpc.exposedFiles, null, 2)})`);
|
|
9
|
-
}
|
|
10
7
|
});
|
|
11
8
|
};
|
package/package.json
CHANGED
package/src/pikku-cli-config.ts
CHANGED
|
@@ -32,7 +32,6 @@ export interface PikkuCLICoreOutputFiles {
|
|
|
32
32
|
rpcInternalMapDeclarationFile: string
|
|
33
33
|
|
|
34
34
|
// RPC Exposed
|
|
35
|
-
rpcWiringMetaFile: string
|
|
36
35
|
rpcMapDeclarationFile: string
|
|
37
36
|
|
|
38
37
|
// Schedulers
|
|
@@ -253,12 +252,6 @@ const _getPikkuCLIConfig = async (
|
|
|
253
252
|
}
|
|
254
253
|
|
|
255
254
|
// External
|
|
256
|
-
if (!result.rpcWiringMetaFile) {
|
|
257
|
-
result.rpcWiringMetaFile = join(
|
|
258
|
-
externalRPCDirectory,
|
|
259
|
-
'pikku-rpc-wirings-meta.gen.ts'
|
|
260
|
-
)
|
|
261
|
-
}
|
|
262
255
|
if (!result.rpcMapDeclarationFile) {
|
|
263
256
|
result.rpcMapDeclarationFile = join(
|
|
264
257
|
externalRPCDirectory,
|
|
@@ -86,10 +86,12 @@ export const serializeImportMap = (
|
|
|
86
86
|
return
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
const importName =
|
|
90
|
+
originalName === uniqueName
|
|
91
|
+
? originalName
|
|
92
|
+
: `${originalName} as ${uniqueName}`
|
|
93
|
+
if (!variables.includes(importName)) {
|
|
94
|
+
variables.push(importName)
|
|
93
95
|
}
|
|
94
96
|
paths.set(path, variables)
|
|
95
97
|
})
|
|
@@ -348,7 +348,7 @@ export const pikkuChannelFunc = <In = unknown, Out = unknown, ChannelData = unkn
|
|
|
348
348
|
export const pikkuVoidFunc = (
|
|
349
349
|
func:
|
|
350
350
|
| PikkuFunctionSessionless<void, void>
|
|
351
|
-
| CorePikkuFunctionConfig<
|
|
351
|
+
| CorePikkuFunctionConfig<PikkuFunctionSessionless<void, void>, PikkuPermission<void>>
|
|
352
352
|
) => {
|
|
353
353
|
return typeof func === 'function' ? func : func.func
|
|
354
354
|
}
|
|
@@ -8,12 +8,7 @@ import { PikkuCommandWithoutState } from '../../types.js'
|
|
|
8
8
|
|
|
9
9
|
export const pikkuRPCClient: PikkuCommandWithoutState = async (
|
|
10
10
|
logger,
|
|
11
|
-
{
|
|
12
|
-
rpcWiringsFile,
|
|
13
|
-
rpcMapDeclarationFile,
|
|
14
|
-
rpcInternalMapDeclarationFile,
|
|
15
|
-
packageMappings,
|
|
16
|
-
}
|
|
11
|
+
{ rpcWiringsFile, rpcMapDeclarationFile, packageMappings }
|
|
17
12
|
) => {
|
|
18
13
|
return await logCommandInfoAndTime(
|
|
19
14
|
logger,
|
|
@@ -3,7 +3,7 @@ import { PikkuCommand } from '../../types.js'
|
|
|
3
3
|
|
|
4
4
|
export const pikkuRPC: PikkuCommand = async (
|
|
5
5
|
logger,
|
|
6
|
-
{ rpcInternalWiringMetaFile
|
|
6
|
+
{ rpcInternalWiringMetaFile },
|
|
7
7
|
{ rpc }
|
|
8
8
|
) => {
|
|
9
9
|
return await logCommandInfoAndTime(
|
|
@@ -19,14 +19,6 @@ export const pikkuRPC: PikkuCommand = async (
|
|
|
19
19
|
`import { pikkuState } from '@pikku/core'\npikkuState('rpc', 'meta', ${JSON.stringify(rpc.internalMeta, null, 2)})`
|
|
20
20
|
)
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
if (rpc.exposedFiles.size > 0) {
|
|
24
|
-
await writeFileInDir(
|
|
25
|
-
logger,
|
|
26
|
-
rpcWiringMetaFile,
|
|
27
|
-
`import { pikkuState } from '@pikku/core'\npikkuState('rpc', 'meta', ${JSON.stringify(rpc.exposedFiles, null, 2)})`
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
22
|
}
|
|
31
23
|
)
|
|
32
24
|
}
|