@pikku/core 0.12.69 → 0.12.70

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/CHANGELOG.md +334 -0
  2. package/README.md +34 -2
  3. package/dist/function/functions.types.d.ts +27 -0
  4. package/dist/index.d.ts +1 -1
  5. package/dist/internal.d.ts +1 -1
  6. package/dist/internal.js +1 -1
  7. package/dist/pikku-state.js +1 -0
  8. package/dist/services/http-scenario-actors.d.ts +12 -4
  9. package/dist/services/http-scenario-actors.js +47 -45
  10. package/dist/services/index.d.ts +2 -1
  11. package/dist/services/index.js +1 -0
  12. package/dist/services/meta-service.d.ts +5 -1
  13. package/dist/services/meta-service.js +44 -18
  14. package/dist/services/scenario-actors-service.d.ts +108 -2
  15. package/dist/services/scenario-actors-service.js +40 -1
  16. package/dist/types/core.types.d.ts +21 -3
  17. package/dist/types/state.types.d.ts +3 -1
  18. package/dist/wirings/actor-flow/actor-flow.types.d.ts +1 -1
  19. package/dist/wirings/actor-flow/index.d.ts +1 -1
  20. package/dist/wirings/actor-flow/run-conversation.d.ts +10 -10
  21. package/dist/wirings/actor-flow/run-conversation.js +27 -27
  22. package/dist/wirings/cli/command-parser.js +11 -1
  23. package/dist/wirings/rpc/rpc-runner.js +1 -1
  24. package/dist/wirings/workflow/dsl/workflow-dsl.types.d.ts +52 -3
  25. package/dist/wirings/workflow/feature.d.ts +28 -0
  26. package/dist/wirings/workflow/feature.js +57 -0
  27. package/dist/wirings/workflow/index.d.ts +13 -2
  28. package/dist/wirings/workflow/index.js +15 -0
  29. package/dist/wirings/workflow/pikku-scenario-service.d.ts +121 -0
  30. package/dist/wirings/workflow/pikku-scenario-service.js +419 -0
  31. package/dist/wirings/workflow/pikku-workflow-service.d.ts +103 -10
  32. package/dist/wirings/workflow/pikku-workflow-service.js +80 -135
  33. package/dist/wirings/workflow/scenario-cookie-jar.d.ts +29 -0
  34. package/dist/wirings/workflow/scenario-cookie-jar.js +51 -0
  35. package/dist/wirings/workflow/scenario-poll.d.ts +20 -0
  36. package/dist/wirings/workflow/scenario-poll.js +25 -0
  37. package/dist/wirings/workflow/scenario-prose.d.ts +38 -0
  38. package/dist/wirings/workflow/scenario-prose.js +45 -0
  39. package/dist/wirings/workflow/scenario-step-guards.d.ts +16 -0
  40. package/dist/wirings/workflow/scenario-step-guards.js +29 -0
  41. package/dist/wirings/workflow/scenario-step.types.d.ts +148 -0
  42. package/dist/wirings/workflow/scenario-step.types.js +1 -0
  43. package/dist/wirings/workflow/workflow.types.d.ts +81 -2
  44. package/package.json +3 -1
  45. package/src/function/functions.types.ts +32 -0
  46. package/src/index.ts +1 -0
  47. package/src/internal.ts +5 -1
  48. package/src/pikku-state.ts +1 -0
  49. package/src/services/http-scenario-actors.test.ts +85 -1
  50. package/src/services/http-scenario-actors.ts +65 -51
  51. package/src/services/index.ts +5 -0
  52. package/src/services/meta-service.test.ts +79 -0
  53. package/src/services/meta-service.ts +61 -26
  54. package/src/services/scenario-actors-service.ts +157 -2
  55. package/src/types/core.types.ts +27 -2
  56. package/src/types/state.types.ts +3 -0
  57. package/src/wirings/actor-flow/actor-flow.types.ts +1 -1
  58. package/src/wirings/actor-flow/index.ts +1 -1
  59. package/src/wirings/actor-flow/run-conversation.test.ts +12 -6
  60. package/src/wirings/actor-flow/run-conversation.ts +36 -41
  61. package/src/wirings/cli/command-parser.test.ts +60 -0
  62. package/src/wirings/cli/command-parser.ts +12 -1
  63. package/src/wirings/rpc/rpc-runner.test.ts +28 -5
  64. package/src/wirings/rpc/rpc-runner.ts +1 -1
  65. package/src/wirings/workflow/dsl/workflow-dsl.types.ts +86 -2
  66. package/src/wirings/workflow/feature.test.ts +131 -0
  67. package/src/wirings/workflow/feature.ts +78 -0
  68. package/src/wirings/workflow/index.ts +73 -0
  69. package/src/wirings/workflow/pikku-scenario-service.ts +682 -0
  70. package/src/wirings/workflow/pikku-workflow-service.test.ts +55 -0
  71. package/src/wirings/workflow/pikku-workflow-service.ts +196 -208
  72. package/src/wirings/workflow/scenario-cookie-jar.test.ts +108 -0
  73. package/src/wirings/workflow/scenario-cookie-jar.ts +65 -0
  74. package/src/wirings/workflow/scenario-hooks.test.ts +212 -0
  75. package/src/wirings/workflow/scenario-poll.test.ts +66 -0
  76. package/src/wirings/workflow/scenario-poll.ts +36 -0
  77. package/src/wirings/workflow/scenario-prose.test.ts +152 -0
  78. package/src/wirings/workflow/scenario-prose.ts +79 -0
  79. package/src/wirings/workflow/scenario-service.test.ts +155 -0
  80. package/src/wirings/workflow/scenario-step-guards.ts +43 -0
  81. package/src/wirings/workflow/scenario-step.test.ts +441 -8
  82. package/src/wirings/workflow/scenario-step.types.ts +157 -0
  83. package/src/wirings/workflow/workflow.types.ts +98 -1
  84. package/tsconfig.tsbuildinfo +1 -1
@@ -1,5 +1,8 @@
1
1
  import type { SerializedError, CommonWireMeta } from '../../types/core.types.js'
2
- import type { CorePikkuFunctionConfig } from '../../function/functions.types.js'
2
+ import type {
3
+ CorePikkuFunctionConfig,
4
+ CorePikkuFunctionHook,
5
+ } from '../../function/functions.types.js'
3
6
  import type { GroupConcurrencyConfig } from '../queue/queue.types.js'
4
7
 
5
8
  // Re-export WorkflowService from services module
@@ -38,12 +41,23 @@ export type {
38
41
  SwitchStepMeta,
39
42
  FilterStepMeta,
40
43
  ArrayPredicateStepMeta,
44
+ ScenarioStepInvocation,
45
+ ScenarioStepMeta,
41
46
  WorkflowStepMeta,
42
47
  WorkflowStepWire,
43
48
  PikkuWorkflowWire,
44
49
  PikkuScenarioWire,
45
50
  } from './dsl/workflow-dsl.types.js'
46
51
 
52
+ // Re-export scenario step types
53
+ export type {
54
+ ScenarioStepPhase,
55
+ ScenarioStepOptions,
56
+ PikkuScenarioStepWire,
57
+ PikkuBrowserWire,
58
+ ScenarioBrowserProvider,
59
+ } from './scenario-step.types.js'
60
+
47
61
  import type { WorkflowStepMeta } from './dsl/workflow-dsl.types.js'
48
62
 
49
63
  export interface WorkflowRunWire {
@@ -329,6 +343,82 @@ export type CoreWorkflow<
329
343
  tags?: string[]
330
344
  }
331
345
 
346
+ /**
347
+ * A scenario as a feature references it: either the scenario itself, or the
348
+ * scenario paired with the input to run it with. The paired form is gherkin's
349
+ * `Examples:` — the same scenario run once per row, written as an ordinary
350
+ * loop rather than a table.
351
+ */
352
+ export type CoreFeatureScenario =
353
+ | CorePikkuFunctionConfig<any, any, any>
354
+ | { scenario: CorePikkuFunctionConfig<any, any, any>; data: unknown }
355
+
356
+ /**
357
+ * A feature: an ordered group of scenarios, mirroring gherkin's Feature ↔
358
+ * Scenario structure. Scenarios are referenced by imported identifier, so a
359
+ * renamed or deleted scenario is a compile error rather than a silent skip.
360
+ *
361
+ * Hooks run **once around the whole group** (`before → a → b → c → after`),
362
+ * not per scenario — per-scenario setup is the scenario's own `before`. That
363
+ * is the one thing a feature deliberately cannot express: gherkin's
364
+ * `Background:` runs per scenario.
365
+ */
366
+ export type CoreFeature = {
367
+ /** Human-readable name. The export identifier is the id. */
368
+ name: string
369
+ description?: string
370
+ tags?: string[]
371
+ /** Readonly because `pikkuFeature`'s `const` generic infers a readonly tuple. */
372
+ scenarios: readonly CoreFeatureScenario[]
373
+ before?: CorePikkuFunctionHook
374
+ after?: CorePikkuFunctionHook
375
+ }
376
+
377
+ /** One entry of a feature's scenario list, as extracted from the source. */
378
+ export type FeatureMetaEntry = {
379
+ /** The scenario's declared export name — its key in `WorkflowsMeta`. */
380
+ scenario: string
381
+ /** The input this entry runs the scenario with — gherkin's `Examples:`. */
382
+ data?: unknown
383
+ }
384
+
385
+ /**
386
+ * A feature as the console reads it: the document structure around a group of
387
+ * scenarios. Generated to `scenarios/features.gen.json` and read off disk, so
388
+ * nothing app-facing has to import the scenario bootstrap to describe one.
389
+ */
390
+ export type FeatureMeta = {
391
+ /** The export identifier. */
392
+ id: string
393
+ name: string
394
+ description?: string
395
+ tags: string[]
396
+ /** In declared order — a feature's reading order is its declaration order. */
397
+ entries: FeatureMetaEntry[]
398
+ /**
399
+ * Entries that could not be read statically (a spread, a `.map()`). Their
400
+ * membership is only known once the scenario bootstrap has been evaluated,
401
+ * so a non-zero count means this listing is partial.
402
+ */
403
+ unresolvedEntries: number
404
+ /** Hooks are runtime-only; only their presence is knowable from meta. */
405
+ hasBefore: boolean
406
+ hasAfter: boolean
407
+ }
408
+
409
+ export type FeaturesMeta = Record<string, FeatureMeta>
410
+
411
+ /** One planned scenario run, resolved from a feature's scenario list. */
412
+ export type FeaturePlanEntry = {
413
+ featureId: string
414
+ featureName: string
415
+ scenarioName: string
416
+ /** The input this entry runs the scenario with, if the feature supplied one. */
417
+ data?: unknown
418
+ /** The scenario's own tags unioned with the containing feature's. */
419
+ tags: string[]
420
+ }
421
+
332
422
  /**
333
423
  * Workflow client interface
334
424
  */
@@ -371,6 +461,13 @@ export type WorkflowsMeta = Record<
371
461
  expose?: boolean
372
462
  /** True for pikkuScenario workflows (complex + actor steps). */
373
463
  scenario?: boolean
464
+ /**
465
+ * Why a scenario is held out of a default run. Stating the reason in code
466
+ * keeps the quarantine next to the scenario it applies to, rather than in
467
+ * a CI invocation nobody reads. Naming the scenario with `--flows` runs it
468
+ * regardless.
469
+ */
470
+ skip?: string
374
471
  /** Actor names a scenario declares (personas it runs steps as). */
375
472
  actors?: string[]
376
473
  }