@pikku/cli 0.12.68 → 0.12.69

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 (91) hide show
  1. package/cli.schema.json +1 -1
  2. package/console-app/assets/{index-CttM2Aiz.js → index-BY60UXB6.js} +132 -132
  3. package/console-app/index.html +2 -2
  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 +7 -12
  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 +8 -31
  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 +37 -52
  25. package/dist/.pikku/function/pikku-functions.gen.js +1 -3
  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/rpc/pikku-rpc-wirings-meta.internal.gen.json +2 -3
  47. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  48. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  49. package/dist/.pikku/schemas/register.gen.js +5 -7
  50. package/dist/.pikku/schemas/schemas/DevInput.schema.json +1 -1
  51. package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
  52. package/dist/.pikku/schemas/schemas/ServeInput.schema.json +1 -1
  53. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  54. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  55. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  56. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  57. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  58. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  59. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  60. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  61. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  62. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  63. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +4 -4
  64. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +2 -2
  65. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  66. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  67. package/dist/bin/pikku-bin.mjs +2 -2
  68. package/dist/bin/pikku.js +1 -1
  69. package/dist/src/cli.wiring.js +8 -31
  70. package/dist/src/functions/commands/dev.d.ts +0 -3
  71. package/dist/src/functions/commands/dev.js +8 -6
  72. package/dist/src/functions/commands/{user-flow.d.ts → scenario.d.ts} +2 -2
  73. package/dist/src/functions/commands/{user-flow.js → scenario.js} +21 -21
  74. package/dist/src/functions/commands/serve-console.d.ts +2 -3
  75. package/dist/src/functions/commands/serve-console.js +5 -51
  76. package/dist/src/functions/commands/serve.d.ts +3 -3
  77. package/dist/src/functions/commands/serve.js +11 -6
  78. package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +6 -5
  79. package/dist/src/functions/wirings/workflow/serialize-scenario-actors.d.ts +8 -0
  80. package/dist/src/functions/wirings/workflow/serialize-scenario-actors.js +43 -0
  81. package/dist/src/functions/wirings/workflow/serialize-workflow-types.js +4 -4
  82. package/dist/src/utils/pikku-cli-config.js +2 -2
  83. package/dist/tsconfig.tsbuildinfo +1 -1
  84. package/package.json +6 -6
  85. package/dist/.pikku/schemas/schemas/ConsoleCommandInput.schema.json +0 -1
  86. package/dist/src/functions/commands/console.d.ts +0 -13
  87. package/dist/src/functions/commands/console.js +0 -122
  88. package/dist/src/functions/wirings/workflow/serialize-user-flow-actors.d.ts +0 -8
  89. package/dist/src/functions/wirings/workflow/serialize-user-flow-actors.js +0 -36
  90. /package/dist/.pikku/schemas/schemas/{UserFlowListInput.schema.json → ScenarioListInput.schema.json} +0 -0
  91. /package/dist/.pikku/schemas/schemas/{UserFlowRunInput.schema.json → ScenarioRunInput.schema.json} +0 -0
@@ -1,122 +0,0 @@
1
- import { createServer } from 'http';
2
- import { readFile, stat } from 'fs/promises';
3
- import { join, extname } from 'path';
4
- import { fileURLToPath } from 'url';
5
- import { pikkuSessionlessFunc } from '#pikku';
6
- import chokidar from 'chokidar';
7
- import open from 'open';
8
- import { pikkuDevReloader } from '@pikku/core/dev';
9
- const MIME_TYPES = {
10
- '.html': 'text/html',
11
- '.js': 'application/javascript',
12
- '.css': 'text/css',
13
- '.json': 'application/json',
14
- '.png': 'image/png',
15
- '.svg': 'image/svg+xml',
16
- '.ico': 'image/x-icon',
17
- '.webmanifest': 'application/manifest+json',
18
- '.woff': 'font/woff',
19
- '.woff2': 'font/woff2',
20
- '.ttf': 'font/ttf',
21
- '.map': 'application/json',
22
- };
23
- export const consoleCommand = pikkuSessionlessFunc({
24
- remote: true,
25
- func: async ({ logger, config }, { port, open: openBrowser, hmr }, { rpc }) => {
26
- const watchDirectories = [
27
- ...new Set([config.emailTemplatesDir, ...config.srcDirectories].filter(Boolean)),
28
- ];
29
- if (!config.scaffold?.console) {
30
- logger.error('Console is not enabled. Add { "scaffold": { "console": "auth" } } to your pikku.config.json (the console requires an authenticated session — set up Better Auth)');
31
- return;
32
- }
33
- const consoleDir = join(fileURLToPath(import.meta.url), '..', '..', '..', '..', '..', 'console-app');
34
- const resolvedPort = parseInt(port || '51442', 10);
35
- try {
36
- await stat(consoleDir);
37
- }
38
- catch {
39
- logger.error('Console app not found. Please rebuild @pikku/cli with the console app bundled.');
40
- return;
41
- }
42
- const server = createServer(async (req, res) => {
43
- const url = new URL(req.url || '/', `http://localhost:${resolvedPort}`);
44
- let filePath = join(consoleDir, url.pathname);
45
- try {
46
- const fileStat = await stat(filePath);
47
- if (fileStat.isDirectory()) {
48
- filePath = join(filePath, 'index.html');
49
- }
50
- }
51
- catch {
52
- filePath = join(consoleDir, 'index.html');
53
- }
54
- try {
55
- const content = await readFile(filePath);
56
- const ext = extname(filePath);
57
- const contentType = MIME_TYPES[ext] || 'application/octet-stream';
58
- res.writeHead(200, { 'Content-Type': contentType });
59
- res.end(content);
60
- }
61
- catch {
62
- res.writeHead(404, { 'Content-Type': 'text/plain' });
63
- res.end('Not Found');
64
- }
65
- });
66
- server.listen(resolvedPort, () => {
67
- logger.info(`Pikku Console running at http://localhost:${resolvedPort}`);
68
- if (openBrowser === 'true') {
69
- open(`http://localhost:${resolvedPort}`);
70
- }
71
- });
72
- if (hmr) {
73
- await pikkuDevReloader({
74
- srcDirectories: watchDirectories,
75
- logger,
76
- });
77
- }
78
- const configWatcher = chokidar.watch(watchDirectories, {
79
- ignoreInitial: true,
80
- ignored: /.*\.gen\.tsx?/,
81
- });
82
- let watcher = new chokidar.FSWatcher({});
83
- const generatorWatcher = () => {
84
- watcher.close();
85
- logger.info(`• Watching directories: \n - ${watchDirectories.join('\n - ')}`);
86
- watcher = chokidar.watch(watchDirectories, {
87
- ignoreInitial: true,
88
- ignored: /.*\.gen\.ts/,
89
- });
90
- watcher.on('ready', async () => {
91
- const handle = async () => {
92
- try {
93
- const start = Date.now();
94
- await rpc.invoke('all');
95
- logger.info({
96
- message: `✓ Generated in ${Date.now() - start}ms`,
97
- type: 'timing',
98
- });
99
- }
100
- catch (err) {
101
- console.error(err);
102
- logger.error('Error running watch');
103
- }
104
- };
105
- await handle();
106
- let timeout;
107
- const deduped = (_file) => {
108
- if (timeout) {
109
- clearTimeout(timeout);
110
- }
111
- timeout = setTimeout(handle, 10);
112
- };
113
- watcher.on('change', deduped);
114
- watcher.on('add', deduped);
115
- watcher.on('unlink', deduped);
116
- });
117
- };
118
- configWatcher.on('ready', generatorWatcher);
119
- configWatcher.on('change', generatorWatcher);
120
- await new Promise(() => { });
121
- },
122
- });
@@ -1,8 +0,0 @@
1
- import type { PikkuCLIConfig } from '../../../../types/config.js';
2
- /**
3
- * Generate the typed user-flow actor registry from pikku.config.json's
4
- * `userFlows.actors`. Apps wire the result as the `actors` singleton service:
5
- *
6
- * actors: createUserFlowActors({ apiUrl, secret })
7
- */
8
- export declare const serializeUserFlowActors: (actors: NonNullable<NonNullable<PikkuCLIConfig["userFlows"]>["actors"]>) => string;
@@ -1,36 +0,0 @@
1
- /**
2
- * Generate the typed user-flow actor registry from pikku.config.json's
3
- * `userFlows.actors`. Apps wire the result as the `actors` singleton service:
4
- *
5
- * actors: createUserFlowActors({ apiUrl, secret })
6
- */
7
- export const serializeUserFlowActors = (actors) => {
8
- return `/**
9
- * User-flow actors declared in pikku.config.json (\`userFlows.actors\`).
10
- * Any user flow can impersonate any actor.
11
- */
12
- import {
13
- createHttpUserFlowActors,
14
- type HttpUserFlowActorsConfig,
15
- type UserFlowActor,
16
- type UserFlowActorConfig,
17
- } from '@pikku/core/services'
18
-
19
- export const userFlowActorConfigs = ${JSON.stringify(actors, null, 2)} as const satisfies Record<string, UserFlowActorConfig>
20
-
21
- export type UserFlowActorName = keyof typeof userFlowActorConfigs
22
- export type TypedUserFlowActors = Record<UserFlowActorName, UserFlowActor>
23
-
24
- /**
25
- * Build the injected \`actors\` service: one lazy HTTP actor per registry
26
- * entry, signing in via the Better Auth actor plugin on first invoke.
27
- */
28
- export const createUserFlowActors = (
29
- options: Omit<HttpUserFlowActorsConfig, 'actors'>
30
- ): TypedUserFlowActors =>
31
- createHttpUserFlowActors({
32
- ...options,
33
- actors: userFlowActorConfigs,
34
- }) as TypedUserFlowActors
35
- `;
36
- };