@pikku/cli 0.12.76 → 0.12.78

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.
Files changed (84) hide show
  1. package/cli.schema.json +1 -1
  2. package/console-app/assets/{index-M7009WaW.js → index-NmNeixvK.js} +140 -140
  3. package/console-app/index.html +1 -1
  4. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
  5. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
  6. package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
  7. package/dist/.pikku/cli/pikku-cli-channel.js +1 -1
  8. package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
  9. package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -1
  10. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.d.ts +1 -1
  11. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.js +1 -1
  12. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
  13. package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
  14. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
  15. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +3 -0
  16. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
  17. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
  18. package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
  19. package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
  20. package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
  21. package/dist/.pikku/function/pikku-function-types.gen.d.ts +1 -1
  22. package/dist/.pikku/function/pikku-function-types.gen.js +1 -1
  23. package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
  24. package/dist/.pikku/function/pikku-functions-meta.gen.json +6 -6
  25. package/dist/.pikku/function/pikku-functions.gen.js +1 -1
  26. package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
  27. package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
  28. package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +1 -1
  29. package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
  30. package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -1
  31. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
  32. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
  33. package/dist/.pikku/pikku-bootstrap.gen.d.ts +1 -1
  34. package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
  35. package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
  36. package/dist/.pikku/pikku-meta-service.gen.js +1 -1
  37. package/dist/.pikku/pikku-services.gen.d.ts +1 -1
  38. package/dist/.pikku/pikku-types.gen.d.ts +1 -1
  39. package/dist/.pikku/pikku-types.gen.js +1 -1
  40. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  41. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  42. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
  43. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
  44. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
  45. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
  46. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  47. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  48. package/dist/.pikku/schemas/register.gen.js +1 -1
  49. package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
  50. package/dist/.pikku/schemas/schemas/PikkuNewAddonInput.schema.json +1 -1
  51. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  52. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  53. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  54. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  55. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  56. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  57. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  58. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  59. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  60. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  61. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +5 -4
  62. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
  63. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  64. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  65. package/dist/bin/pikku-bin.mjs +2 -2
  66. package/dist/src/cli.wiring.js +3 -0
  67. package/dist/src/functions/commands/db-migrate.js +3 -0
  68. package/dist/src/functions/commands/db-reset.js +3 -0
  69. package/dist/src/functions/commands/new-addon.d.ts +3 -0
  70. package/dist/src/functions/commands/new-addon.js +53 -4
  71. package/dist/src/functions/db/db-codegen.d.ts +7 -2
  72. package/dist/src/functions/db/db-codegen.js +32 -14
  73. package/dist/src/functions/db/db-introspector.d.ts +13 -0
  74. package/dist/src/functions/db/local-db.js +1 -2
  75. package/dist/src/functions/db/postgres/postgres-introspector.d.ts +3 -2
  76. package/dist/src/functions/db/postgres/postgres-introspector.js +109 -7
  77. package/dist/src/functions/db/sqlite/sqlite-introspector.d.ts +2 -0
  78. package/dist/src/functions/db/sqlite/sqlite-introspector.js +16 -0
  79. package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +2 -1
  80. package/dist/src/functions/wirings/workflow/serialize-workflow-types.d.ts +1 -1
  81. package/dist/src/functions/wirings/workflow/serialize-workflow-types.js +16 -4
  82. package/dist/src/services.d.ts +3 -0
  83. package/dist/src/services.js +8 -4
  84. package/package.json +11 -11
@@ -62,7 +62,8 @@ export const pikkuWorkflow = pikkuSessionlessFunc({
62
62
  const functionTypesImportPath = getFileImportRelativePath(workflowTypesFile, functionTypesFile, packageMappings);
63
63
  const rpcMapImportPath = getFileImportRelativePath(workflowTypesFile, config.rpcInternalMapDeclarationFile, packageMappings);
64
64
  const workflowMapImportPath = getFileImportRelativePath(workflowTypesFile, workflowMapDeclarationFile, packageMappings);
65
- await writeFileInDir(logger, workflowTypesFile, serializeWorkflowTypes(functionTypesImportPath, rpcMapImportPath, workflowMapImportPath));
65
+ const agentMapImportPath = getFileImportRelativePath(workflowTypesFile, config.agentMapDeclarationFile, packageMappings);
66
+ await writeFileInDir(logger, workflowTypesFile, serializeWorkflowTypes(functionTypesImportPath, rpcMapImportPath, workflowMapImportPath, agentMapImportPath));
66
67
  const scenarioActors = config.scenarios?.actors;
67
68
  if (scenarioActors && Object.keys(scenarioActors).length > 0) {
68
69
  const agentMapImportPath = getFileImportRelativePath(config.scenarioActorsFile, config.agentMapDeclarationFile, packageMappings);
@@ -1 +1 @@
1
- export declare const serializeWorkflowTypes: (functionTypesImportPath: string, rpcMapImportPath: string, workflowMapImportPath: string) => string;
1
+ export declare const serializeWorkflowTypes: (functionTypesImportPath: string, rpcMapImportPath: string, workflowMapImportPath: string, agentMapImportPath: string) => string;
@@ -1,4 +1,4 @@
1
- export const serializeWorkflowTypes = (functionTypesImportPath, rpcMapImportPath, workflowMapImportPath) => {
1
+ export const serializeWorkflowTypes = (functionTypesImportPath, rpcMapImportPath, workflowMapImportPath, agentMapImportPath) => {
2
2
  return `import { WorkflowCancelledException } from '@pikku/core/workflow'
3
3
  import { template } from '@pikku/core/workflow'
4
4
  import {
@@ -12,6 +12,7 @@ export { WorkflowCancelledException }
12
12
  import type { PikkuFunctionSessionless, PikkuFunctionConfig } from '${functionTypesImportPath}'
13
13
  import type { FlattenedRPCMap } from '${rpcMapImportPath}'
14
14
  import type { FlattenedWorkflowMap } from '${workflowMapImportPath}'
15
+ import type { AgentMap as FlattenedAgentMap } from '${agentMapImportPath}'
15
16
 
16
17
  export { template }
17
18
 
@@ -144,13 +145,19 @@ type InputWithRefs<T> = {
144
145
  type NodeInputType<FuncMap extends Record<string, string>, K extends keyof FuncMap> =
145
146
  FuncMap[K] extends keyof FlattenedRPCMap
146
147
  ? InputWithRefs<FlattenedRPCMap[FuncMap[K]]['input']>
147
- : Record<string, unknown>
148
+ : FuncMap[K] extends keyof FlattenedWorkflowMap
149
+ ? InputWithRefs<FlattenedWorkflowMap[FuncMap[K]]['input']>
150
+ : Record<string, unknown>
148
151
 
149
152
  type NodeOutputKeys<FuncMap extends Record<string, string>, N extends string> =
150
153
  N extends keyof FuncMap
151
154
  ? FuncMap[N] extends keyof FlattenedRPCMap
152
155
  ? keyof FlattenedRPCMap[FuncMap[N]]['output'] & string
153
- : string
156
+ : FuncMap[N] extends keyof FlattenedWorkflowMap
157
+ ? keyof FlattenedWorkflowMap[FuncMap[N]]['output'] & string
158
+ : FuncMap[N] extends keyof FlattenedAgentMap
159
+ ? keyof FlattenedAgentMap[FuncMap[N]]['output'] & string
160
+ : string
154
161
  : string
155
162
 
156
163
  type RefFunction<FuncMap extends Record<string, string>> = {
@@ -177,7 +184,12 @@ type GraphNodeConfigMap<FuncMap extends Record<string, string>> = {
177
184
  type NextConfig<NodeIds extends string> = NodeIds | NodeIds[] | { if: string; then: NodeIds; else?: NodeIds }
178
185
 
179
186
  export function pikkuWorkflowGraph<
180
- const FuncMap extends Record<string, keyof FlattenedRPCMap & string>
187
+ const FuncMap extends Record<
188
+ string,
189
+ | (keyof FlattenedRPCMap & string)
190
+ | (keyof FlattenedWorkflowMap & string)
191
+ | (keyof FlattenedAgentMap & string)
192
+ >
181
193
  >(
182
194
  config: PikkuWorkflowGraphConfig<FuncMap, GraphNodeConfigMap<FuncMap>>
183
195
  ): PikkuWorkflowGraphResult {
@@ -2,8 +2,11 @@ import type { Config, Services, SingletonServices, UserSession } from '../types/
2
2
  import type { CreateConfig } from '@pikku/core';
3
3
  import type { CreateWireServices, CreateSingletonServices } from '@pikku/core/internal';
4
4
  import { LogLevel } from '@pikku/core/services';
5
+ import { CLILogger } from './services/cli-logger.service.js';
6
+ import type { InspectorDiagnostic } from '@pikku/inspector';
5
7
  import type { PikkuCLIConfig } from '../types/config.js';
6
8
  import type { ForwardedLogMessage } from './services/cli-logger-forwarder.service.js';
9
+ export declare function processDiagnostics(diagnostics: InspectorDiagnostic[], lint?: PikkuCLIConfig['lint'], log?: Pick<CLILogger, 'warn' | 'critical'>): void;
7
10
  /**
8
11
  * Default CLI renderer that logs output using the logger
9
12
  */
@@ -20,6 +20,7 @@ import { parseCLIFilters } from './utils/parse-cli-filters.js';
20
20
  const DIAGNOSTIC_CODE_TO_LINT_KEY = {
21
21
  [ErrorCode.SERVICES_NOT_DESTRUCTURED]: 'servicesNotDestructured',
22
22
  [ErrorCode.WIRES_NOT_DESTRUCTURED]: 'wiresNotDestructured',
23
+ [ErrorCode.FUNCTION_DYNAMIC_IMPORT]: 'functionDynamicImport',
23
24
  };
24
25
  // Default severity for each lint rule when not explicitly configured.
25
26
  // 'error' routes through logger.critical and always fails the build. Both
@@ -30,16 +31,19 @@ const DIAGNOSTIC_CODE_TO_LINT_KEY = {
30
31
  const LINT_DEFAULTS = {
31
32
  servicesNotDestructured: 'error',
32
33
  wiresNotDestructured: 'error',
34
+ functionDynamicImport: 'warn',
33
35
  };
34
- function processDiagnostics(diagnostics, lint) {
36
+ export function processDiagnostics(diagnostics, lint, log = logger) {
35
37
  for (const diagnostic of diagnostics) {
36
38
  const lintKey = DIAGNOSTIC_CODE_TO_LINT_KEY[diagnostic.code];
37
- const severity = lintKey ? (lint?.[lintKey] ?? LINT_DEFAULTS[lintKey] ?? 'off') : 'off';
39
+ const severity = lintKey
40
+ ? (lint?.[lintKey] ?? LINT_DEFAULTS[lintKey] ?? 'off')
41
+ : 'off';
38
42
  if (severity === 'error') {
39
- logger.critical(diagnostic.code, diagnostic.message);
43
+ log.critical(diagnostic.code, diagnostic.message);
40
44
  }
41
45
  else if (severity === 'warn') {
42
- logger.warn(`[${diagnostic.code}] ${diagnostic.message}`);
46
+ log.warn(`[${diagnostic.code}] ${diagnostic.message}`);
43
47
  }
44
48
  }
45
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/cli",
3
- "version": "0.12.76",
3
+ "version": "0.12.78",
4
4
  "author": "yasser.fadl@gmail.com",
5
5
  "license": "BUSL-1.1",
6
6
  "imports": {
@@ -28,17 +28,17 @@
28
28
  "@electric-sql/pglite": "^0.5.1",
29
29
  "@jridgewell/trace-mapping": "^0.3.25",
30
30
  "@openapi-contrib/json-schema-to-openapi-schema": "^4.3.1",
31
- "@pikku/better-auth": "^0.12.15",
31
+ "@pikku/better-auth": "^0.12.17",
32
32
  "@pikku/bun-server": "^0.12.4",
33
33
  "@pikku/deploy-cloudflare": "^0.12.8",
34
- "@pikku/fetch": "^0.12.6",
35
- "@pikku/inspector": "^0.12.38",
34
+ "@pikku/fetch": "^0.12.7",
35
+ "@pikku/inspector": "^0.12.40",
36
36
  "@pikku/kysely": "^0.13.0",
37
37
  "@pikku/kysely-node-sqlite": "^0.12.3",
38
- "@pikku/node-http-server": "^0.12.5",
39
- "@pikku/openapi-parser": "^0.12.11",
40
- "@pikku/schedule": "^0.12.3",
41
- "@pikku/ws": "^0.12.3",
38
+ "@pikku/node-http-server": "^0.12.6",
39
+ "@pikku/openapi-parser": "^0.12.13",
40
+ "@pikku/schedule": "^0.12.4",
41
+ "@pikku/ws": "^0.12.4",
42
42
  "@types/cookie": "^1.0.0",
43
43
  "@types/json-schema": "^7.0.15",
44
44
  "chalk": "^5.6.2",
@@ -59,10 +59,10 @@
59
59
  "zod-to-ts": "^2.1.0"
60
60
  },
61
61
  "peerDependencies": {
62
- "@pikku/core": "^0.12.57"
62
+ "@pikku/core": "^0.12.59"
63
63
  },
64
64
  "devDependencies": {
65
- "@pikku/core": "^0.12.57",
65
+ "@pikku/core": "^0.12.59",
66
66
  "@types/istanbul-lib-instrument": "^1.7.7",
67
67
  "@types/node": "^24.11.0",
68
68
  "@types/pg": "^8.11.0",
@@ -75,7 +75,7 @@
75
75
  "cli.schema.json"
76
76
  ],
77
77
  "engines": {
78
- "node": ">=22"
78
+ "node": ">=24"
79
79
  },
80
80
  "exports": {
81
81
  ".": "./dist/bin/pikku.js"