@pikku/cli 0.9.16-next.0 → 0.10.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/.pikku/channel/pikku-channel-types.gen.ts +28 -29
- package/.pikku/channel/pikku-channels-map.gen.d.ts +44 -0
- package/.pikku/channel/pikku-channels-meta.gen.ts +5 -0
- package/.pikku/channel/pikku-channels.gen.ts +4 -0
- package/.pikku/cli/pikku-cli-channel.gen.ts +34 -0
- package/.pikku/cli/pikku-cli-client.gen.ts +43 -0
- package/.pikku/cli/pikku-cli-types.gen.ts +14 -15
- package/.pikku/cli/pikku-cli-wirings-meta.gen.ts +142 -2
- package/.pikku/cli/pikku-cli-wirings.gen.ts +4 -2
- package/.pikku/cli/pikku-cli.gen.ts +41 -0
- package/.pikku/function/pikku-function-types.gen.ts +167 -19
- package/.pikku/function/pikku-functions-meta.gen.ts +220 -192
- package/.pikku/function/pikku-functions-meta.min.gen.ts +61 -56
- package/.pikku/function/pikku-functions.gen.ts +3 -1
- package/.pikku/http/pikku-http-types.gen.ts +28 -3
- package/.pikku/http/pikku-http-wirings-map.gen.d.ts +43 -0
- package/.pikku/http/pikku-http-wirings-meta.gen.ts +13 -0
- package/.pikku/http/pikku-http-wirings.gen.ts +4 -0
- package/.pikku/mcp/pikku-mcp-types.gen.ts +15 -13
- package/.pikku/mcp/pikku-mcp-wirings-meta.gen.ts +7 -0
- package/.pikku/mcp/pikku-mcp-wirings.gen.ts +4 -0
- package/.pikku/mcp/pikku-mcp.gen.json +5 -0
- package/.pikku/pikku-bootstrap.gen.ts +11 -1
- package/.pikku/pikku-services.gen.ts +1 -5
- package/.pikku/pikku-types.gen.ts +1 -2
- package/.pikku/pikku-websocket.gen.ts +76 -0
- package/.pikku/queue/pikku-queue-types.gen.ts +1 -2
- package/.pikku/queue/pikku-queue-workers-wirings-map.gen.d.ts +57 -0
- package/.pikku/queue/pikku-queue-workers-wirings-meta.gen.ts +5 -0
- package/.pikku/queue/pikku-queue-workers-wirings.gen.ts +4 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +5 -4
- package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +19 -17
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +15 -14
- package/.pikku/scheduler/pikku-scheduler-types.gen.ts +1 -2
- package/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.ts +5 -0
- package/.pikku/scheduler/pikku-schedulers-wirings.gen.ts +4 -0
- package/.pikku/schemas/register.gen.ts +15 -11
- package/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -1
- package/.pikku/schemas/schemas/PikkuPermissionsOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -1
- package/CHANGELOG.md +15 -0
- package/bin/pikku.ts +63 -11
- package/build.sh +1 -1
- package/cli.schema.json +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +11 -20
- package/dist/.pikku/channel/pikku-channel-types.gen.js +9 -11
- package/dist/.pikku/channel/pikku-channels-meta.gen.d.ts +1 -0
- package/dist/.pikku/channel/pikku-channels-meta.gen.js +5 -0
- package/dist/.pikku/channel/pikku-channels.gen.d.ts +4 -0
- package/dist/.pikku/channel/pikku-channels.gen.js +5 -0
- package/dist/.pikku/cli/pikku-cli-channel.gen.d.ts +1 -0
- package/dist/.pikku/cli/pikku-cli-channel.gen.js +33 -0
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +10 -0
- package/dist/.pikku/cli/pikku-cli-client.gen.js +34 -0
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +9 -12
- package/dist/.pikku/cli/pikku-cli-types.gen.js +5 -4
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +142 -2
- package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +3 -2
- package/dist/.pikku/cli/pikku-cli-wirings.gen.js +4 -3
- package/dist/.pikku/cli/pikku-cli.gen.d.ts +10 -0
- package/dist/.pikku/cli/pikku-cli.gen.js +38 -0
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +141 -20
- package/dist/.pikku/function/pikku-function-types.gen.js +108 -12
- package/dist/.pikku/function/pikku-functions-meta.gen.js +220 -192
- package/dist/.pikku/function/pikku-functions-meta.min.gen.js +61 -56
- package/dist/.pikku/function/pikku-functions.gen.js +3 -1
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +21 -2
- package/dist/.pikku/http/pikku-http-types.gen.js +24 -3
- package/dist/.pikku/http/pikku-http-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +13 -0
- package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +4 -0
- package/dist/.pikku/http/pikku-http-wirings.gen.js +5 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +11 -8
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +6 -6
- package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.js +7 -0
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.d.ts +4 -0
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.js +5 -0
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +11 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +11 -1
- package/dist/.pikku/pikku-services.gen.d.ts +1 -4
- package/dist/.pikku/pikku-services.gen.js +0 -6
- package/dist/.pikku/pikku-types.gen.d.ts +1 -2
- package/dist/.pikku/pikku-types.gen.js +1 -2
- package/dist/.pikku/pikku-websocket.gen.d.ts +31 -0
- package/dist/.pikku/pikku-websocket.gen.js +49 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -2
- package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -2
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +5 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +4 -0
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +5 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +15 -14
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -2
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -2
- package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.d.ts +1 -0
- package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.js +5 -0
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.d.ts +4 -0
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.js +5 -0
- package/dist/.pikku/schemas/register.gen.js +9 -7
- package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuChannelsOutput.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuPermissionsOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuSchemasOutput.schema.json +1 -1
- package/dist/bin/pikku.d.ts +1 -1
- package/dist/bin/pikku.js +37 -6
- package/dist/src/cli.wiring.js +99 -75
- package/dist/src/functions/commands/all.js +10 -0
- package/dist/src/functions/runtimes/nextjs/pikku-command-nextjs.js +10 -8
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.d.ts +1 -1
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.js +2 -2
- package/dist/src/functions/wirings/channels/pikku-channels.js +0 -5
- package/dist/src/functions/wirings/channels/pikku-command-channel-types.js +0 -2
- package/dist/src/functions/wirings/channels/pikku-command-channels-map.js +0 -5
- package/dist/src/functions/wirings/channels/pikku-command-channels.js +0 -5
- package/dist/src/functions/wirings/channels/pikku-command-websocket-typed.js +6 -3
- package/dist/src/functions/wirings/channels/serialize-channel-types.js +27 -28
- package/dist/src/functions/wirings/channels/serialize-typed-channel-map.js +4 -1
- package/dist/src/functions/wirings/cli/pikku-command-cli-entry.js +31 -8
- package/dist/src/functions/wirings/cli/pikku-command-cli-types.js +0 -2
- package/dist/src/functions/wirings/cli/pikku-command-cli.js +0 -2
- package/dist/src/functions/wirings/cli/serialize-channel-cli-client.d.ts +6 -2
- package/dist/src/functions/wirings/cli/serialize-channel-cli-client.js +88 -11
- package/dist/src/functions/wirings/cli/serialize-channel-cli.d.ts +1 -1
- package/dist/src/functions/wirings/cli/serialize-channel-cli.js +1 -18
- package/dist/src/functions/wirings/cli/serialize-cli-types.js +13 -14
- package/dist/src/functions/wirings/cli/serialize-local-cli-bootstrap.js +19 -14
- package/dist/src/functions/wirings/fetch/index.js +6 -3
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +6 -5
- package/dist/src/functions/wirings/functions/pikku-command-function-types.js +0 -2
- package/dist/src/functions/wirings/functions/pikku-command-functions.js +0 -2
- package/dist/src/functions/wirings/functions/pikku-command-services.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-services.js +11 -21
- package/dist/src/functions/wirings/functions/pikku-function-types.js +0 -2
- package/dist/src/functions/wirings/functions/schemas.js +0 -2
- package/dist/src/functions/wirings/functions/serialize-function-types.d.ts +1 -1
- package/dist/src/functions/wirings/functions/serialize-function-types.js +167 -19
- package/dist/src/functions/wirings/functions/serialize-pikku-types-hub.js +0 -1
- package/dist/src/functions/wirings/http/openapi-spec-generator.d.ts +2 -1
- package/dist/src/functions/wirings/http/pikku-command-http-map.js +0 -5
- package/dist/src/functions/wirings/http/pikku-command-http-routes.js +0 -5
- package/dist/src/functions/wirings/http/pikku-command-http-types.js +0 -2
- package/dist/src/functions/wirings/http/pikku-command-openapi.js +7 -4
- package/dist/src/functions/wirings/http/pikku-http-routes.js +0 -5
- package/dist/src/functions/wirings/http/serialize-http-types.js +27 -2
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-json.js +0 -5
- package/dist/src/functions/wirings/mcp/pikku-command-mcp-types.js +0 -2
- package/dist/src/functions/wirings/mcp/pikku-command-mcp.js +0 -5
- package/dist/src/functions/wirings/mcp/serialize-mcp-json.d.ts +1 -1
- package/dist/src/functions/wirings/mcp/serialize-mcp-types.js +14 -12
- package/dist/src/functions/wirings/middleware/pikku-command-middleware.js +0 -2
- package/dist/src/functions/wirings/middleware/serialize-middleware-groups-meta.js +1 -7
- package/dist/src/functions/wirings/permissions/pikku-command-permissions.d.ts +1 -0
- package/dist/src/functions/wirings/permissions/pikku-command-permissions.js +28 -0
- package/dist/src/functions/wirings/permissions/serialize-permissions-imports.d.ts +2 -0
- package/dist/src/functions/wirings/permissions/serialize-permissions-imports.js +43 -0
- package/dist/src/functions/wirings/queue/pikku-command-queue-map.js +0 -5
- package/dist/src/functions/wirings/queue/pikku-command-queue-service.js +6 -3
- package/dist/src/functions/wirings/queue/pikku-command-queue-types.js +0 -2
- package/dist/src/functions/wirings/queue/pikku-command-queue.js +0 -5
- package/dist/src/functions/wirings/queue/pikku-queue-map.js +0 -5
- package/dist/src/functions/wirings/queue/pikku-queue.js +1 -5
- package/dist/src/functions/wirings/queue/serialize-queue-meta.d.ts +1 -1
- package/dist/src/functions/wirings/queue/serialize-queue-types.js +0 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-client.js +5 -3
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.js +0 -4
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +0 -2
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler-types.js +0 -2
- package/dist/src/functions/wirings/scheduler/pikku-command-scheduler.js +0 -5
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-types.js +0 -1
- package/dist/src/middleware/log-command-info-and-time.d.ts +2 -8
- package/dist/src/middleware/log-command-info-and-time.js +2 -14
- package/dist/src/services/cli-logger-forwarder.service.d.ts +6 -2
- package/dist/src/services/cli-logger-forwarder.service.js +9 -0
- package/dist/src/services/cli-logger.service.d.ts +4 -0
- package/dist/src/services/cli-logger.service.js +11 -0
- package/dist/src/services.d.ts +5 -0
- package/dist/src/services.js +111 -13
- package/dist/src/utils/check-required-types.js +11 -1
- package/dist/src/utils/custom-types-generator.js +8 -2
- package/dist/src/utils/file-writer.d.ts +4 -1
- package/dist/src/utils/file-writer.js +13 -3
- package/dist/src/utils/get-cli-version.d.ts +5 -0
- package/dist/src/utils/get-cli-version.js +27 -0
- package/dist/src/utils/pikku-cli-config.d.ts +1 -2
- package/dist/src/utils/pikku-cli-config.js +9 -28
- package/dist/src/utils/schema-generator.js +3 -2
- package/dist/src/utils/serialize-import-map.js +0 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -8
- package/pikku.config.json +4 -2
- package/src/cli.wiring.ts +101 -74
- package/src/functions/commands/all.ts +12 -0
- package/src/functions/runtimes/nextjs/pikku-command-nextjs.ts +12 -12
- package/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.ts +2 -2
- package/src/functions/wirings/channels/pikku-channels.ts +0 -5
- package/src/functions/wirings/channels/pikku-command-channel-types.ts +0 -2
- package/src/functions/wirings/channels/pikku-command-channels-map.ts +0 -5
- package/src/functions/wirings/channels/pikku-command-channels.ts +0 -5
- package/src/functions/wirings/channels/pikku-command-websocket-typed.ts +7 -3
- package/src/functions/wirings/channels/serialize-channel-types.ts +27 -28
- package/src/functions/wirings/channels/serialize-typed-channel-map.ts +4 -1
- package/src/functions/wirings/cli/pikku-command-cli-entry.ts +52 -9
- package/src/functions/wirings/cli/pikku-command-cli-types.ts +0 -2
- package/src/functions/wirings/cli/pikku-command-cli.ts +0 -2
- package/src/functions/wirings/cli/serialize-channel-cli-client.ts +111 -12
- package/src/functions/wirings/cli/serialize-channel-cli.ts +2 -23
- package/src/functions/wirings/cli/serialize-cli-types.ts +13 -14
- package/src/functions/wirings/cli/serialize-local-cli-bootstrap.ts +19 -14
- package/src/functions/wirings/fetch/index.ts +7 -3
- package/src/functions/wirings/functions/pikku-command-function-types-split.ts +14 -5
- package/src/functions/wirings/functions/pikku-command-function-types.ts +0 -2
- package/src/functions/wirings/functions/pikku-command-functions.ts +0 -2
- package/src/functions/wirings/functions/pikku-command-services.ts +13 -24
- package/src/functions/wirings/functions/pikku-function-types.ts +0 -2
- package/src/functions/wirings/functions/schemas.ts +0 -2
- package/src/functions/wirings/functions/serialize-function-types.ts +169 -19
- package/src/functions/wirings/functions/serialize-pikku-types-hub.ts +0 -1
- package/src/functions/wirings/http/openapi-spec-generator.ts +2 -1
- package/src/functions/wirings/http/pikku-command-http-map.ts +0 -5
- package/src/functions/wirings/http/pikku-command-http-routes.ts +0 -5
- package/src/functions/wirings/http/pikku-command-http-types.ts +0 -2
- package/src/functions/wirings/http/pikku-command-openapi.ts +9 -4
- package/src/functions/wirings/http/pikku-http-routes.ts +0 -5
- package/src/functions/wirings/http/serialize-http-types.ts +27 -2
- package/src/functions/wirings/mcp/pikku-command-mcp-json.ts +0 -5
- package/src/functions/wirings/mcp/pikku-command-mcp-types.ts +0 -2
- package/src/functions/wirings/mcp/pikku-command-mcp.ts +0 -5
- package/src/functions/wirings/mcp/serialize-mcp-json.ts +1 -1
- package/src/functions/wirings/mcp/serialize-mcp-types.ts +14 -12
- package/src/functions/wirings/middleware/pikku-command-middleware.ts +0 -2
- package/src/functions/wirings/middleware/serialize-middleware-groups-meta.ts +1 -7
- package/src/functions/wirings/permissions/pikku-command-permissions.ts +49 -0
- package/src/functions/wirings/permissions/serialize-permissions-imports.test.ts +274 -0
- package/src/functions/wirings/permissions/serialize-permissions-imports.ts +78 -0
- package/src/functions/wirings/queue/pikku-command-queue-map.ts +0 -5
- package/src/functions/wirings/queue/pikku-command-queue-service.ts +7 -3
- package/src/functions/wirings/queue/pikku-command-queue-types.ts +0 -2
- package/src/functions/wirings/queue/pikku-command-queue.ts +0 -5
- package/src/functions/wirings/queue/pikku-queue-map.ts +0 -5
- package/src/functions/wirings/queue/pikku-queue.ts +3 -6
- package/src/functions/wirings/queue/serialize-queue-meta.ts +1 -1
- package/src/functions/wirings/queue/serialize-queue-types.ts +0 -1
- package/src/functions/wirings/rpc/pikku-command-rpc-client.ts +6 -3
- package/src/functions/wirings/rpc/pikku-command-rpc-map.ts +0 -4
- package/src/functions/wirings/rpc/pikku-command-rpc.ts +0 -2
- package/src/functions/wirings/scheduler/pikku-command-scheduler-types.ts +0 -2
- package/src/functions/wirings/scheduler/pikku-command-scheduler.ts +0 -5
- package/src/functions/wirings/scheduler/serialize-scheduler-types.ts +0 -1
- package/src/middleware/log-command-info-and-time.ts +2 -28
- package/src/services/cli-logger-forwarder.service.ts +15 -2
- package/src/services/cli-logger.service.ts +15 -0
- package/src/services.ts +148 -19
- package/src/utils/check-required-types.ts +16 -1
- package/src/utils/custom-types-generator.ts +8 -2
- package/src/utils/file-writer.ts +19 -3
- package/src/utils/get-cli-version.ts +28 -0
- package/src/utils/pikku-cli-config.ts +6 -35
- package/src/utils/schema-generator.ts +7 -3
- package/src/utils/serialize-import-map.ts +0 -4
- package/types/application-types.d.ts +4 -1
- package/types/config.d.ts +15 -3
- package/dist/.pikku/rpc/pikku-bootstrap-rpc.gen.d.ts +0 -6
- package/dist/.pikku/rpc/pikku-bootstrap-rpc.gen.js +0 -6
- package/dist/src/serialize-pikku-types.d.ts +0 -4
- package/dist/src/serialize-pikku-types.js +0 -605
- package/src/serialize-pikku-types.ts +0 -613
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { Logger, LogLevel
|
|
1
|
+
import { Logger, LogLevel } from '@pikku/core'
|
|
2
|
+
import { PikkuChannel } from '@pikku/core/channel'
|
|
3
|
+
import { ErrorCode } from '@pikku/inspector'
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Log message structure sent through the channel
|
|
@@ -18,7 +20,7 @@ export class CLILoggerForwarder implements Logger {
|
|
|
18
20
|
|
|
19
21
|
constructor(
|
|
20
22
|
private logger: Logger,
|
|
21
|
-
private channel: PikkuChannel<unknown,
|
|
23
|
+
private channel: PikkuChannel<unknown, any>
|
|
22
24
|
) {}
|
|
23
25
|
|
|
24
26
|
setLevel(level: LogLevel): void {
|
|
@@ -74,4 +76,15 @@ export class CLILoggerForwarder implements Logger {
|
|
|
74
76
|
trace(message: string, ..._meta: any[]) {
|
|
75
77
|
this.log('trace', LogLevel.trace, message)
|
|
76
78
|
}
|
|
79
|
+
|
|
80
|
+
critical(code: ErrorCode, message: string) {
|
|
81
|
+
const url = `https://pikku.dev/docs/cli-errors/${code.toLowerCase()}`
|
|
82
|
+
const formattedMessage = `[${code}] ${message}\n → ${url}`
|
|
83
|
+
this.error(formattedMessage)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
hasCriticalErrors(): boolean {
|
|
87
|
+
// The underlying logger (CLILogger) tracks critical errors
|
|
88
|
+
return (this.logger as any).hasCriticalErrors?.() ?? false
|
|
89
|
+
}
|
|
77
90
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
2
|
import { Logger, LogLevel } from '@pikku/core'
|
|
3
|
+
import { ErrorCode } from '@pikku/inspector'
|
|
3
4
|
|
|
4
5
|
const logo = `
|
|
5
6
|
______ _ _ _
|
|
@@ -10,9 +11,12 @@ const logo = `
|
|
|
10
11
|
|_| |_|_| _)_| _)____/
|
|
11
12
|
`
|
|
12
13
|
|
|
14
|
+
const BASE_ERROR_URL = 'https://pikku.dev/errors'
|
|
15
|
+
|
|
13
16
|
export class CLILogger implements Logger {
|
|
14
17
|
private silent: boolean
|
|
15
18
|
private level: LogLevel = LogLevel.info
|
|
19
|
+
private criticalErrors: string[] = []
|
|
16
20
|
|
|
17
21
|
constructor({
|
|
18
22
|
logLogo,
|
|
@@ -60,6 +64,17 @@ export class CLILogger implements Logger {
|
|
|
60
64
|
console.log(chalk.gray(message))
|
|
61
65
|
}
|
|
62
66
|
|
|
67
|
+
critical(code: ErrorCode, message: string) {
|
|
68
|
+
const url = `${BASE_ERROR_URL}/${code.toLowerCase()}`
|
|
69
|
+
const formattedMessage = `[${code}] ${message}\n → ${url}`
|
|
70
|
+
this.criticalErrors.push(formattedMessage)
|
|
71
|
+
console.error(chalk.red.bold(formattedMessage))
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
hasCriticalErrors(): boolean {
|
|
75
|
+
return this.criticalErrors.length > 0
|
|
76
|
+
}
|
|
77
|
+
|
|
63
78
|
private logPikkuLogo() {
|
|
64
79
|
this.primary(logo)
|
|
65
80
|
// // When running from dist/, __filename is dist/src/services/cli-logger.service.js
|
package/src/services.ts
CHANGED
|
@@ -8,12 +8,19 @@ import {
|
|
|
8
8
|
CreateConfig,
|
|
9
9
|
CreateSessionServices,
|
|
10
10
|
CreateSingletonServices,
|
|
11
|
-
pikkuCLIRender,
|
|
12
11
|
} from '@pikku/core'
|
|
12
|
+
import { pikkuCLIRender } from '@pikku/core/cli'
|
|
13
13
|
import { LocalVariablesService } from '@pikku/core/services'
|
|
14
14
|
import { CLILogger } from './services/cli-logger.service.js'
|
|
15
15
|
import { getPikkuCLIConfig } from './utils/pikku-cli-config.js'
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
inspect,
|
|
18
|
+
InspectorState,
|
|
19
|
+
InspectorFilters,
|
|
20
|
+
serializeInspectorState,
|
|
21
|
+
deserializeInspectorState,
|
|
22
|
+
filterInspectorState,
|
|
23
|
+
} from '@pikku/inspector'
|
|
17
24
|
import { glob } from 'tinyglobby'
|
|
18
25
|
import path from 'path'
|
|
19
26
|
import { PikkuCLIConfig } from '../types/config.js'
|
|
@@ -21,9 +28,66 @@ import {
|
|
|
21
28
|
CLILoggerForwarder,
|
|
22
29
|
ForwardedLogMessage,
|
|
23
30
|
} from './services/cli-logger-forwarder.service.js'
|
|
31
|
+
import { readFile, writeFile } from 'fs/promises'
|
|
24
32
|
|
|
25
33
|
const logger = new CLILogger({ logLogo: true, silent: false })
|
|
26
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Parse a comma-separated string or array into an array of trimmed, non-empty strings
|
|
37
|
+
* Returns undefined if the input is empty/undefined or results in an empty array
|
|
38
|
+
*/
|
|
39
|
+
function parseCommaSeparated(
|
|
40
|
+
value: string | string[] | undefined
|
|
41
|
+
): string[] | undefined {
|
|
42
|
+
if (!value) return undefined
|
|
43
|
+
|
|
44
|
+
// If already an array, flatten and split any comma-separated values
|
|
45
|
+
if (Array.isArray(value)) {
|
|
46
|
+
const flattened = value
|
|
47
|
+
.flatMap((item) => item.split(','))
|
|
48
|
+
.map((item) => item.trim())
|
|
49
|
+
.filter((item) => item.length > 0)
|
|
50
|
+
return flattened.length > 0 ? flattened : undefined
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// If string, split by comma
|
|
54
|
+
const parsed = value
|
|
55
|
+
.split(',')
|
|
56
|
+
.map((item) => item.trim())
|
|
57
|
+
.filter((item) => item.length > 0)
|
|
58
|
+
|
|
59
|
+
return parsed.length > 0 ? parsed : undefined
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Parse CLI filter arguments into InspectorFilters format
|
|
64
|
+
*/
|
|
65
|
+
function parseCLIFilters(data: any): InspectorFilters {
|
|
66
|
+
const filters: InspectorFilters = {}
|
|
67
|
+
|
|
68
|
+
if (data.filters) {
|
|
69
|
+
return JSON.parse(data.filters)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Parse each filter type from CLI arguments
|
|
73
|
+
const names = parseCommaSeparated(data.names)
|
|
74
|
+
const tags = parseCommaSeparated(data.tags)
|
|
75
|
+
const types = parseCommaSeparated(data.types)
|
|
76
|
+
const directories = parseCommaSeparated(data.directories)
|
|
77
|
+
const httpRoutes = parseCommaSeparated(data.httpRoutes)
|
|
78
|
+
const httpMethods = parseCommaSeparated(data.httpMethods)
|
|
79
|
+
|
|
80
|
+
// Only include non-undefined values in the result
|
|
81
|
+
if (names) filters.names = names
|
|
82
|
+
if (tags) filters.tags = tags
|
|
83
|
+
if (types) filters.types = types
|
|
84
|
+
if (directories) filters.directories = directories
|
|
85
|
+
if (httpRoutes) filters.httpRoutes = httpRoutes
|
|
86
|
+
if (httpMethods) filters.httpMethods = httpMethods
|
|
87
|
+
|
|
88
|
+
return filters
|
|
89
|
+
}
|
|
90
|
+
|
|
27
91
|
/**
|
|
28
92
|
* Default CLI renderer that logs output using the logger
|
|
29
93
|
*/
|
|
@@ -36,20 +100,50 @@ export const defaultCLIRenderer = pikkuCLIRender<
|
|
|
36
100
|
}
|
|
37
101
|
})
|
|
38
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Client-safe CLI renderer that outputs to console (no service dependencies)
|
|
105
|
+
* This renderer can be used in CLI-over-channel clients
|
|
106
|
+
*/
|
|
107
|
+
export const clientCLIRenderer = pikkuCLIRender<ForwardedLogMessage>(
|
|
108
|
+
(_services, data) => {
|
|
109
|
+
if (data) {
|
|
110
|
+
// Simple console output without service dependencies
|
|
111
|
+
const prefix = data.type ? `[${data.type}] ` : ''
|
|
112
|
+
console.log(`${prefix}${data.message}`)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
|
|
39
117
|
export const createConfig: CreateConfig<Config, [PikkuCLIConfig]> = async (
|
|
40
118
|
_variablesService,
|
|
41
119
|
data
|
|
42
120
|
) => {
|
|
43
|
-
const cliConfig = await getPikkuCLIConfig(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
)
|
|
121
|
+
const cliConfig = await getPikkuCLIConfig(logger, data.configFile, [], true)
|
|
122
|
+
|
|
123
|
+
// Load inspector state from file if stateInput is provided
|
|
124
|
+
let preloadedInspectorState: Omit<InspectorState, 'typesLookup'> | undefined =
|
|
125
|
+
undefined
|
|
126
|
+
|
|
127
|
+
if (data.stateInput) {
|
|
128
|
+
try {
|
|
129
|
+
logger.info(`Loading inspector state from ${data.stateInput}`)
|
|
130
|
+
const stateJson = await readFile(data.stateInput, 'utf-8')
|
|
131
|
+
const serializedState = JSON.parse(stateJson)
|
|
132
|
+
preloadedInspectorState = deserializeInspectorState(serializedState)
|
|
133
|
+
logger.info(`Inspector state loaded successfully`)
|
|
134
|
+
} catch (error: any) {
|
|
135
|
+
logger.error(
|
|
136
|
+
`Failed to load inspector state from ${data.stateInput}: ${error.message}`
|
|
137
|
+
)
|
|
138
|
+
throw error
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
50
142
|
return {
|
|
51
143
|
...cliConfig,
|
|
52
144
|
...data,
|
|
145
|
+
filters: parseCLIFilters(data),
|
|
146
|
+
preloadedInspectorState,
|
|
53
147
|
}
|
|
54
148
|
}
|
|
55
149
|
|
|
@@ -61,12 +155,25 @@ export const createSingletonServices: CreateSingletonServices<
|
|
|
61
155
|
Config,
|
|
62
156
|
SingletonServices
|
|
63
157
|
> = async (config) => {
|
|
64
|
-
const {
|
|
158
|
+
const {
|
|
159
|
+
rootDir,
|
|
160
|
+
srcDirectories,
|
|
161
|
+
filters,
|
|
162
|
+
preloadedInspectorState,
|
|
163
|
+
stateOutput,
|
|
164
|
+
} = config
|
|
65
165
|
const variables = new LocalVariablesService()
|
|
66
166
|
|
|
67
|
-
|
|
167
|
+
// Store unfiltered state
|
|
168
|
+
let unfilteredState:
|
|
169
|
+
| InspectorState
|
|
170
|
+
| Omit<InspectorState, 'typesLookup'>
|
|
171
|
+
| undefined = preloadedInspectorState
|
|
172
|
+
|
|
68
173
|
const getInspectorState = async (refresh: boolean = false) => {
|
|
69
|
-
|
|
174
|
+
// Get or refresh the unfiltered state
|
|
175
|
+
if (!unfilteredState || refresh) {
|
|
176
|
+
// Run inspector WITHOUT filters to get full state
|
|
70
177
|
const wiringFiles = (
|
|
71
178
|
await Promise.all(
|
|
72
179
|
srcDirectories.map((dir) =>
|
|
@@ -74,18 +181,40 @@ export const createSingletonServices: CreateSingletonServices<
|
|
|
74
181
|
)
|
|
75
182
|
)
|
|
76
183
|
).flat()
|
|
77
|
-
|
|
78
|
-
filters
|
|
184
|
+
unfilteredState = await inspect(logger, wiringFiles, {
|
|
185
|
+
// NO filters here - inspector returns full unfiltered state
|
|
79
186
|
types: {
|
|
80
187
|
configFileType: config.configFile,
|
|
81
|
-
userSessionType: config.
|
|
82
|
-
singletonServicesFactoryType:
|
|
83
|
-
sessionServicesFactoryType:
|
|
188
|
+
userSessionType: config.userSessionType,
|
|
189
|
+
singletonServicesFactoryType: config.singletonServicesFactoryType,
|
|
190
|
+
sessionServicesFactoryType: config.sessionServicesFactoryType,
|
|
84
191
|
},
|
|
85
192
|
})
|
|
86
|
-
|
|
193
|
+
|
|
194
|
+
// Save unfiltered inspector state to file if stateOutput is provided
|
|
195
|
+
if (stateOutput && 'typesLookup' in unfilteredState) {
|
|
196
|
+
try {
|
|
197
|
+
logger.info(`Saving inspector state to ${stateOutput}`)
|
|
198
|
+
const serialized = serializeInspectorState(unfilteredState)
|
|
199
|
+
await writeFile(
|
|
200
|
+
stateOutput,
|
|
201
|
+
JSON.stringify(serialized, null, 2),
|
|
202
|
+
'utf-8'
|
|
203
|
+
)
|
|
204
|
+
logger.info(`Inspector state saved successfully`)
|
|
205
|
+
} catch (error: any) {
|
|
206
|
+
logger.error(
|
|
207
|
+
`Failed to save inspector state to ${stateOutput}: ${error.message}`
|
|
208
|
+
)
|
|
209
|
+
// Don't throw - state saving is optional/nice-to-have
|
|
210
|
+
}
|
|
211
|
+
}
|
|
87
212
|
}
|
|
88
|
-
|
|
213
|
+
|
|
214
|
+
// Apply filters as a post-processing step
|
|
215
|
+
const filteredState = filterInspectorState(unfilteredState, filters, logger)
|
|
216
|
+
|
|
217
|
+
return filteredState as InspectorState
|
|
89
218
|
}
|
|
90
219
|
|
|
91
220
|
return {
|
|
@@ -13,8 +13,23 @@ export const checkRequiredTypes = (
|
|
|
13
13
|
errors: FilesAndMethodsErrors,
|
|
14
14
|
requires: RequiredTypes = {}
|
|
15
15
|
): void => {
|
|
16
|
+
// Filter out errors that are about missing Types when we have the corresponding Factory
|
|
17
|
+
// e.g., if we have a CreateConfig factory, we don't need a CoreConfig type
|
|
18
|
+
const errorMessages = Array.from(errors.keys())
|
|
19
|
+
const hasCreateConfigFactory = errorMessages.every(
|
|
20
|
+
(msg) => !msg.includes('No CreateConfig found')
|
|
21
|
+
)
|
|
22
|
+
|
|
16
23
|
// Only throw if there are errors AND we require those types
|
|
17
|
-
const hasRequiredErrors =
|
|
24
|
+
const hasRequiredErrors = errorMessages.some((message) => {
|
|
25
|
+
// Skip CoreConfig type errors if we have a CreateConfig factory
|
|
26
|
+
if (
|
|
27
|
+
requires.config &&
|
|
28
|
+
message.includes('No CoreConfig found') &&
|
|
29
|
+
hasCreateConfigFactory
|
|
30
|
+
) {
|
|
31
|
+
return false
|
|
32
|
+
}
|
|
18
33
|
if (requires.config && message.includes('CoreConfig')) return true
|
|
19
34
|
if (requires.sessionServiceType && message.includes('CoreServices'))
|
|
20
35
|
return true
|
|
@@ -9,8 +9,14 @@ export function generateCustomTypes(
|
|
|
9
9
|
// or are broken into simpler types
|
|
10
10
|
${Array.from(typesMap.customTypes.entries())
|
|
11
11
|
.map(([name, { type, references }]) => {
|
|
12
|
-
references.forEach((
|
|
13
|
-
|
|
12
|
+
references.forEach((refName) => {
|
|
13
|
+
// Skip __object types (including those with suffixes like __object_abc123)
|
|
14
|
+
// These are placeholder types created by the inspector for invalid/broken functions
|
|
15
|
+
// (e.g., functions with type errors or missing return statements). Attempting to
|
|
16
|
+
// import these would fail since the source files don't actually export __object.
|
|
17
|
+
if (refName !== '__object' && !refName.startsWith('__object_')) {
|
|
18
|
+
requiredTypes.add(refName)
|
|
19
|
+
}
|
|
14
20
|
})
|
|
15
21
|
|
|
16
22
|
// Extract type names from the type string that might not be in references
|
package/src/utils/file-writer.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { dirname } from 'path'
|
|
2
|
-
import { mkdir, readFile, writeFile } from 'fs/promises'
|
|
2
|
+
import { mkdir, readFile, writeFile, rm } from 'fs/promises'
|
|
3
|
+
import { existsSync } from 'fs'
|
|
3
4
|
import { CLILogger } from '../services/cli-logger.service.js'
|
|
5
|
+
import { getCLIVersion } from './get-cli-version.js'
|
|
4
6
|
|
|
5
|
-
// TODO: add version back in once the ESM dust settles
|
|
6
7
|
export const DO_NOT_MODIFY_COMMENT = `/**
|
|
7
|
-
* This file was generated by
|
|
8
|
+
* This file was generated by @pikku/cli@${getCLIVersion()}
|
|
8
9
|
*/
|
|
9
10
|
`
|
|
10
11
|
|
|
@@ -54,3 +55,18 @@ export const writeFileInDir = async (
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
}
|
|
58
|
+
|
|
59
|
+
export const removeFileInDir = async (
|
|
60
|
+
logger: CLILogger,
|
|
61
|
+
path: string,
|
|
62
|
+
{ logRemove = true }: { logRemove?: boolean } = {}
|
|
63
|
+
) => {
|
|
64
|
+
// Check if file exists before attempting removal
|
|
65
|
+
if (existsSync(path)) {
|
|
66
|
+
await rm(path, { force: true })
|
|
67
|
+
|
|
68
|
+
if (logRemove) {
|
|
69
|
+
logger.info({ message: `✓ File removed at ${path}`, type: 'success' })
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { dirname, join } from 'path'
|
|
2
|
+
import { readFile } from 'fs/promises'
|
|
3
|
+
import { fileURLToPath } from 'url'
|
|
4
|
+
|
|
5
|
+
// Get package version for generated file comments
|
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
7
|
+
let version = 'unknown'
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
// Try from src/ first (development), then from dist/src/ (built)
|
|
11
|
+
const pkgPath = join(__dirname, '..', '..', 'package.json')
|
|
12
|
+
const pkgJson = JSON.parse(await readFile(pkgPath, 'utf-8'))
|
|
13
|
+
version = pkgJson.version
|
|
14
|
+
} catch {
|
|
15
|
+
try {
|
|
16
|
+
const pkgPath = join(__dirname, '..', '..', '..', 'package.json')
|
|
17
|
+
const pkgJson = JSON.parse(await readFile(pkgPath, 'utf-8'))
|
|
18
|
+
version = pkgJson.version
|
|
19
|
+
} catch {
|
|
20
|
+
// Fallback to unknown if package.json can't be found
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Returns the CLI version string
|
|
26
|
+
* Works from both src/ and dist/src/ locations
|
|
27
|
+
*/
|
|
28
|
+
export const getCLIVersion = () => version
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { join, dirname, resolve, isAbsolute } from 'path'
|
|
2
2
|
import { readdir, readFile } from 'fs/promises'
|
|
3
3
|
import { PikkuCLIConfig } from '../../types/config.js'
|
|
4
|
-
import { InspectorFilters } from '@pikku/inspector'
|
|
5
|
-
import { PikkuWiringTypes } from '@pikku/core'
|
|
6
4
|
import { CLILogger } from '../services/cli-logger.service.js'
|
|
7
5
|
|
|
8
6
|
const CONFIG_DIR_FILES = [
|
|
@@ -19,14 +17,12 @@ export const getPikkuCLIConfig = async (
|
|
|
19
17
|
logger: CLILogger,
|
|
20
18
|
configFile: string | undefined = undefined,
|
|
21
19
|
requiredFields: Array<keyof PikkuCLIConfig>,
|
|
22
|
-
filters: InspectorFilters = {},
|
|
23
20
|
exitProcess: boolean = false
|
|
24
21
|
): Promise<PikkuCLIConfig> => {
|
|
25
22
|
const config = await _getPikkuCLIConfig(
|
|
26
23
|
logger,
|
|
27
24
|
configFile,
|
|
28
25
|
requiredFields,
|
|
29
|
-
filters,
|
|
30
26
|
exitProcess
|
|
31
27
|
)
|
|
32
28
|
return config
|
|
@@ -36,7 +32,6 @@ const _getPikkuCLIConfig = async (
|
|
|
36
32
|
logger: CLILogger,
|
|
37
33
|
configFile: string | undefined = undefined,
|
|
38
34
|
requiredFields: Array<keyof PikkuCLIConfig>,
|
|
39
|
-
filters: InspectorFilters = {},
|
|
40
35
|
exitProcess: boolean = false
|
|
41
36
|
): Promise<PikkuCLIConfig> => {
|
|
42
37
|
if (!configFile) {
|
|
@@ -59,7 +54,6 @@ const _getPikkuCLIConfig = async (
|
|
|
59
54
|
logger,
|
|
60
55
|
resolve(configDir, config.extends),
|
|
61
56
|
[],
|
|
62
|
-
filters,
|
|
63
57
|
exitProcess
|
|
64
58
|
)
|
|
65
59
|
result = {
|
|
@@ -246,6 +240,12 @@ const _getPikkuCLIConfig = async (
|
|
|
246
240
|
)
|
|
247
241
|
}
|
|
248
242
|
|
|
243
|
+
// Permissions
|
|
244
|
+
const permissionsDir = join(result.outDir, 'permissions')
|
|
245
|
+
if (!result.permissionsFile) {
|
|
246
|
+
result.permissionsFile = join(permissionsDir, 'pikku-permissions.gen.ts')
|
|
247
|
+
}
|
|
248
|
+
|
|
249
249
|
// Bootstrap files
|
|
250
250
|
if (!result.bootstrapFile) {
|
|
251
251
|
result.bootstrapFile = join(result.outDir, 'pikku-bootstrap.gen.ts')
|
|
@@ -279,15 +279,6 @@ const _getPikkuCLIConfig = async (
|
|
|
279
279
|
result.cliTypesFile = join(cliDir, 'pikku-cli-types.gen.ts')
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
result.bootstrapFiles = result.bootstrapFiles || {}
|
|
283
|
-
for (const key of Object.keys(PikkuWiringTypes)) {
|
|
284
|
-
const eventDir = join(result.outDir, key.toLowerCase())
|
|
285
|
-
result.bootstrapFiles[key] = join(
|
|
286
|
-
eventDir,
|
|
287
|
-
`pikku-bootstrap-${key}.gen.ts`
|
|
288
|
-
)
|
|
289
|
-
}
|
|
290
|
-
|
|
291
282
|
if (requiredFields.length > 0) {
|
|
292
283
|
validateCLIConfig(result, requiredFields)
|
|
293
284
|
}
|
|
@@ -306,26 +297,6 @@ const _getPikkuCLIConfig = async (
|
|
|
306
297
|
}
|
|
307
298
|
}
|
|
308
299
|
|
|
309
|
-
// Separately normalize bootstrapFiles (Record<string, string>)
|
|
310
|
-
if (result.bootstrapFiles && typeof result.bootstrapFiles === 'object') {
|
|
311
|
-
for (const [key, value] of Object.entries(result.bootstrapFiles)) {
|
|
312
|
-
if (typeof value === 'string' && !isAbsolute(value)) {
|
|
313
|
-
result.bootstrapFiles[key] = join(result.rootDir, value)
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
result.filters = result.filters || {}
|
|
319
|
-
if (filters.tags && filters.tags.length > 0) {
|
|
320
|
-
result.filters.tags = filters.tags
|
|
321
|
-
}
|
|
322
|
-
if (filters.types && filters.types.length > 0) {
|
|
323
|
-
result.filters.types = filters.types
|
|
324
|
-
}
|
|
325
|
-
if (filters.directories && filters.directories.length > 0) {
|
|
326
|
-
result.filters.directories = filters.directories
|
|
327
|
-
}
|
|
328
|
-
|
|
329
300
|
if (!isAbsolute(result.tsconfig)) {
|
|
330
301
|
result.tsconfig = join(result.rootDir, result.tsconfig)
|
|
331
302
|
}
|
|
@@ -3,7 +3,7 @@ import { writeFileInDir } from './file-writer.js'
|
|
|
3
3
|
import { mkdir, writeFile } from 'fs/promises'
|
|
4
4
|
import { FunctionsMeta, JSONValue } from '@pikku/core'
|
|
5
5
|
import { HTTPWiringsMeta } from '@pikku/core/http'
|
|
6
|
-
import { TypesMap } from '@pikku/inspector'
|
|
6
|
+
import { TypesMap, ErrorCode } from '@pikku/inspector'
|
|
7
7
|
import { CLILogger } from '../services/cli-logger.service.js'
|
|
8
8
|
|
|
9
9
|
export async function generateSchemas(
|
|
@@ -66,10 +66,14 @@ export async function generateSchemas(
|
|
|
66
66
|
} catch (e) {
|
|
67
67
|
// Ignore rootless errors
|
|
68
68
|
if (e instanceof RootlessError) {
|
|
69
|
-
logger.error(
|
|
69
|
+
logger.error(
|
|
70
|
+
`[${ErrorCode.SCHEMA_NO_ROOT}] Error generating schema since it has no root: ${schema}`
|
|
71
|
+
)
|
|
70
72
|
return
|
|
71
73
|
}
|
|
72
|
-
logger.error(
|
|
74
|
+
logger.error(
|
|
75
|
+
`[${ErrorCode.SCHEMA_GENERATION_ERROR}] Error generating schema: ${schema}. Message: ${e.message}`
|
|
76
|
+
)
|
|
73
77
|
}
|
|
74
78
|
})
|
|
75
79
|
|
|
@@ -8,7 +8,10 @@ import type { CLILogger } from '../src/services/cli-logger.service.js'
|
|
|
8
8
|
import { PikkuCLIConfig } from '../types/config.d.ts'
|
|
9
9
|
import { InspectorState } from '@pikku/inspector'
|
|
10
10
|
|
|
11
|
-
export interface Config extends CoreConfig<PikkuCLIConfig> {
|
|
11
|
+
export interface Config extends CoreConfig<PikkuCLIConfig> {
|
|
12
|
+
// Preloaded inspector state from stateInput file (if provided)
|
|
13
|
+
preloadedInspectorState?: Omit<InspectorState, 'typesLookup'>
|
|
14
|
+
}
|
|
12
15
|
|
|
13
16
|
export interface SingletonServices extends CoreSingletonServices<Config> {
|
|
14
17
|
logger: CLILogger
|
package/types/config.d.ts
CHANGED
|
@@ -64,9 +64,11 @@ export interface PikkuCLICoreOutputFiles {
|
|
|
64
64
|
middlewareFile: string
|
|
65
65
|
middlewareGroupsMetaFile: string
|
|
66
66
|
|
|
67
|
+
// Permissions
|
|
68
|
+
permissionsFile: string
|
|
69
|
+
|
|
67
70
|
// Application bootstrap
|
|
68
71
|
bootstrapFile: string
|
|
69
|
-
bootstrapFiles: Record<PikkuWiringTypes, string>
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
export type PikkuCLIInput = {
|
|
@@ -121,10 +123,13 @@ export type PikkuCLIInput = {
|
|
|
121
123
|
>
|
|
122
124
|
}
|
|
123
125
|
|
|
124
|
-
|
|
126
|
+
forceRequiredServices?: string[]
|
|
125
127
|
|
|
126
128
|
schemasFromTypes?: string[]
|
|
127
129
|
|
|
130
|
+
stateOutput?: string
|
|
131
|
+
stateInput?: string
|
|
132
|
+
|
|
128
133
|
filters: InspectorFilters
|
|
129
134
|
} & PikkuCLICoreOutputFiles
|
|
130
135
|
|
|
@@ -142,6 +147,10 @@ export type PikkuCLIConfig = {
|
|
|
142
147
|
tags?: string[]
|
|
143
148
|
types?: string[]
|
|
144
149
|
|
|
150
|
+
userSessionType?: string
|
|
151
|
+
singletonServicesFactoryType?: string
|
|
152
|
+
sessionServicesFactoryType?: string
|
|
153
|
+
|
|
145
154
|
configDir: string
|
|
146
155
|
tsconfig: string
|
|
147
156
|
|
|
@@ -184,9 +193,12 @@ export type PikkuCLIConfig = {
|
|
|
184
193
|
>
|
|
185
194
|
}
|
|
186
195
|
|
|
187
|
-
|
|
196
|
+
forceRequiredServices?: string[]
|
|
188
197
|
|
|
189
198
|
schemasFromTypes?: string[]
|
|
190
199
|
|
|
200
|
+
stateOutput?: string
|
|
201
|
+
stateInput?: string
|
|
202
|
+
|
|
191
203
|
filters: InspectorFilters
|
|
192
204
|
} & PikkuCLICoreOutputFiles
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*/
|
|
4
|
-
export declare const serializePikkuTypes: (userSessionTypeImport: string, userSessionTypeName: string, singletonServicesTypeImport: string, singletonServicesTypeName: string, sessionServicesTypeImport: string, sessionServicesTypeName: string, rpcMapTypeImport: string) => string;
|