@pikku/cli 0.12.46 → 0.12.47

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 (65) hide show
  1. package/console-app/assets/{index-ByiKUJ11.js → index-Cb-SEeMM.js} +139 -139
  2. package/console-app/index.html +1 -1
  3. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
  4. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
  5. package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
  6. package/dist/.pikku/cli/pikku-cli-channel.js +1 -1
  7. package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
  8. package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -1
  9. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.d.ts +1 -1
  10. package/dist/.pikku/cli/pikku-cli-contracts-meta.gen.js +1 -1
  11. package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
  12. package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
  13. package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
  14. package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
  15. package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
  16. package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
  17. package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
  18. package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
  19. package/dist/.pikku/function/pikku-function-types.gen.d.ts +1 -1
  20. package/dist/.pikku/function/pikku-function-types.gen.js +1 -1
  21. package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
  22. package/dist/.pikku/function/pikku-functions-meta.gen.json +60 -60
  23. package/dist/.pikku/function/pikku-functions.gen.js +1 -1
  24. package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
  25. package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
  26. package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +1 -1
  27. package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
  28. package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -1
  29. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
  30. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
  31. package/dist/.pikku/pikku-bootstrap.gen.d.ts +1 -1
  32. package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
  33. package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
  34. package/dist/.pikku/pikku-meta-service.gen.js +1 -1
  35. package/dist/.pikku/pikku-services.gen.d.ts +1 -1
  36. package/dist/.pikku/pikku-types.gen.d.ts +1 -1
  37. package/dist/.pikku/pikku-types.gen.js +1 -1
  38. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
  39. package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
  40. package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
  41. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
  42. package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
  43. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
  44. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +1 -1
  45. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
  46. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
  47. package/dist/.pikku/schemas/register.gen.js +3 -3
  48. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  49. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  50. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  51. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  52. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  53. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  54. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  55. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  56. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  57. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  58. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +1 -1
  59. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
  60. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  61. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  62. package/dist/bin/pikku-bin.mjs +2 -2
  63. package/dist/src/functions/commands/tests-init.js +54 -8
  64. package/dist/src/scaffold/rpc-remote.gen.js +1 -1
  65. package/package.json +4 -4
@@ -1,4 +1,4 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.46
2
+ * This file was generated by @pikku/cli@0.12.47
3
3
  */
4
4
  export { wireVariable } from '@pikku/core/variable';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.46
2
+ * This file was generated by @pikku/cli@0.12.47
3
3
  */
4
4
  import { TypedVariablesService as CoreTypedVariablesService } from '@pikku/core/services';
5
5
  import type { VariablesService } from '@pikku/core/services';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.46
2
+ * This file was generated by @pikku/cli@0.12.47
3
3
  */
4
4
  import { TypedVariablesService as CoreTypedVariablesService } from '@pikku/core/services';
5
5
  const VARIABLES_META = {};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.46
2
+ * This file was generated by @pikku/cli@0.12.47
3
3
  */
4
4
  import { WorkflowCancelledException } from '@pikku/core/workflow';
5
5
  import { template } from '@pikku/core/workflow';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.46
2
+ * This file was generated by @pikku/cli@0.12.47
3
3
  */
4
4
  import { WorkflowCancelledException } from '@pikku/core/workflow';
5
5
  import { template } from '@pikku/core/workflow';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.46
2
+ * This file was generated by @pikku/cli@0.12.47
3
3
  */
4
4
  import { pikkuState } from '@pikku/core/internal';
5
5
  import allWorkflowMeta from './meta/allWorkflow.gen.json' with { type: 'json' };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.46
2
+ * This file was generated by @pikku/cli@0.12.47
3
3
  */
4
4
  import { addWorkflow } from '@pikku/core/workflow';
5
5
  import './pikku-workflow-wirings-meta.gen.js';
@@ -11,8 +11,8 @@ async function checkForUpdate() {
11
11
  })
12
12
  if (!res.ok) return
13
13
  const { version: latest } = await res.json()
14
- if (latest !== '0.12.46') {
15
- process.stderr.write(`\n Update available 0.12.46 → ${latest}\n brew upgrade pikku or npm install -g @pikku/cli\n\n`)
14
+ if (latest !== '0.12.47') {
15
+ process.stderr.write(`\n Update available 0.12.47 → ${latest}\n brew upgrade pikku or npm install -g @pikku/cli\n\n`)
16
16
  }
17
17
  } catch {}
18
18
  }
@@ -75,6 +75,33 @@ registerHooks({ Before, After, BeforeAll, AfterAll, setDefaultTimeout }, db)
75
75
  registerCommonSteps({ Given, When, Then })
76
76
  `;
77
77
  }
78
+ function starterFeature() {
79
+ return `Feature: Example function test
80
+
81
+ Starter scenario created by \`pikku tests init\`. It uses only the built-in
82
+ pikku/cucumber steps (no custom step code) and passes out of the box, so the
83
+ Run-tests button and coverage report work immediately. Replace it with real
84
+ scenarios that call your RPCs — see the commented example at the bottom.
85
+
86
+ Scenario: the function-test harness is wired up
87
+ Given the data "example" is:
88
+ | hello | world |
89
+ Then the data "example" is not empty
90
+
91
+ # Real example — call one of your RPCs and assert the outcome. Uncomment and
92
+ # adapt (run \`pikku meta\` to list versioned RPC names and input schemas):
93
+ #
94
+ # Scenario: an anonymous user cannot reach a protected RPC
95
+ # When an anonymous user calls "yourProtectedRpc"
96
+ # Then the call fails with "Unauthorized"
97
+ #
98
+ # Scenario: a public RPC returns data
99
+ # When an anonymous user calls "yourPublicRpc" with:
100
+ # | someField | someValue |
101
+ # Then the call succeeds
102
+ # And the result has "id"
103
+ `;
104
+ }
78
105
  function worldTs() {
79
106
  return `import { World, setWorldConstructor } from '@cucumber/cucumber'
80
107
  import { createFunctionWorld } from '@pikku/cucumber'
@@ -83,7 +110,7 @@ import { createStubServices } from './services.js'
83
110
  createFunctionWorld(World, setWorldConstructor, createStubServices)
84
111
  `;
85
112
  }
86
- function servicesTs(configImport, servicesImport, schemaImport, coercionImport, configVar, servicesVar, repoRootRel, hasDb) {
113
+ function servicesTs(configImport, servicesImport, schemaImport, coercionImport, configVar, servicesVar, repoRootRel, hasDb, migrationsRel, seedRel) {
87
114
  if (!hasDb) {
88
115
  return `import { createDbUtils, type StubTracker } from '@pikku/cucumber'
89
116
  import { ${configVar} } from '${configImport}'
@@ -114,8 +141,8 @@ const __dirname = dirname(fileURLToPath(import.meta.url))
114
141
  const repoRoot = (p: string) => resolve(__dirname, '${repoRootRel}', p)
115
142
 
116
143
  export const db = createDbUtils({
117
- migrationsDir: repoRoot('db/migrations'),
118
- seedFile: repoRoot('db/seed.sql'),
144
+ migrationsDir: repoRoot('${migrationsRel}'),
145
+ seedFile: repoRoot('${seedRel}'),
119
146
  })
120
147
 
121
148
  type StubKysely = ReturnType<typeof createNodeSqliteKysely<DB>>
@@ -198,9 +225,28 @@ export const pikkuTestsInit = pikkuSessionlessFunc({
198
225
  const schemaImport = toJs(rel(schemaFile));
199
226
  const coercionImport = toJs(rel(coercionFile));
200
227
  const repoRootRel = relative(supportDir, config.rootDir);
201
- const hasDb = existsSync(join(config.rootDir, 'db', 'migrations'));
228
+ // Engine-aware db layout: stages live under db/sqlite or db/postgres with a
229
+ // matching db/<engine>-seed.sql (see the deploy convention). Pick whichever
230
+ // engine the project actually ships migrations for.
231
+ const engine = existsSync(join(config.rootDir, 'db', 'sqlite'))
232
+ ? 'sqlite'
233
+ : existsSync(join(config.rootDir, 'db', 'postgres'))
234
+ ? 'postgres'
235
+ : null;
236
+ // Only sqlite runs in the harness today (node:sqlite); postgres falls back
237
+ // to stubbed services until a pglite-backed harness lands.
238
+ const hasDb = engine === 'sqlite';
239
+ const migrationsRel = engine ? `db/${engine}` : '';
240
+ const seedRel = engine ? `db/${engine}-seed.sql` : '';
241
+ if (engine === 'postgres') {
242
+ logger.info('Note: Postgres function-test harness support is not wired yet (the harness runs on node:sqlite). Tracking in pikkujs/pikku#758 — the scaffold falls back to stubbed services.');
243
+ }
202
244
  const files = [
203
245
  [join(ftestDir, '.env.test'), envTest()],
246
+ // Empty lockfile so Yarn Berry treats tests/ as a standalone project
247
+ // rather than expecting it in the parent repo's workspaces (the harness
248
+ // is intentionally outside the workspace graph).
249
+ [join(ftestDir, 'yarn.lock'), ''],
204
250
  [join(ftestDir, 'package.json'), packageJson()],
205
251
  [join(ftestDir, 'tsconfig.json'), tsconfig()],
206
252
  [join(ftestDir, 'tests', 'cucumber.mjs'), cucumberMjs()],
@@ -208,9 +254,9 @@ export const pikkuTestsInit = pikkuSessionlessFunc({
208
254
  [join(supportDir, 'world.ts'), worldTs()],
209
255
  [
210
256
  join(supportDir, 'services.ts'),
211
- servicesTs(configImport, servicesImport, schemaImport, coercionImport, pikkuConfigFactory.variable, singletonServicesFactory.variable, repoRootRel, hasDb),
257
+ servicesTs(configImport, servicesImport, schemaImport, coercionImport, pikkuConfigFactory.variable, singletonServicesFactory.variable, repoRootRel, hasDb, migrationsRel, seedRel),
212
258
  ],
213
- [join(ftestDir, 'tests', 'features', '.gitkeep'), ''],
259
+ [join(ftestDir, 'tests', 'features', 'example.feature'), starterFeature()],
214
260
  ];
215
261
  for (const [filePath, content] of files) {
216
262
  await mkdir(dirname(filePath), { recursive: true });
@@ -219,7 +265,7 @@ export const pikkuTestsInit = pikkuSessionlessFunc({
219
265
  }
220
266
  logger.info('\nFunction test harness initialized.');
221
267
  logger.info('Next steps:');
222
- logger.info(' 1. Add your first .feature file under tests/features/');
223
- logger.info(' 2. Install @pikku/cucumber and run: yarn test');
268
+ logger.info(' 1. Install deps in tests/ and run: yarn test');
269
+ logger.info(' 2. Edit tests/tests/features/example.feature add scenarios that call your RPCs');
224
270
  },
225
271
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.46
2
+ * This file was generated by @pikku/cli@0.12.47
3
3
  */
4
4
  /**
5
5
  * Auto-generated remote internal RPC queue worker and HTTP endpoint
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/cli",
3
- "version": "0.12.46",
3
+ "version": "0.12.47",
4
4
  "author": "yasser.fadl@gmail.com",
5
5
  "license": "BUSL-1.1",
6
6
  "imports": {
@@ -27,10 +27,10 @@
27
27
  "dependencies": {
28
28
  "@electric-sql/pglite": "^0.5.1",
29
29
  "@openapi-contrib/json-schema-to-openapi-schema": "^4.3.1",
30
- "@pikku/better-auth": "^0.12.9",
31
- "@pikku/core": "^0.12.35",
30
+ "@pikku/better-auth": "^0.12.10",
31
+ "@pikku/core": "^0.12.36",
32
32
  "@pikku/deploy-cloudflare": "^0.12.4",
33
- "@pikku/fetch": "^0.12.3",
33
+ "@pikku/fetch": "^0.12.4",
34
34
  "@pikku/inspector": "^0.12.24",
35
35
  "@pikku/kysely": "^0.12.16",
36
36
  "@pikku/kysely-node-sqlite": "^0.12.2",