@cratis/pi 7.14.1 → 7.14.3
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/package/corpus/agents/security-reviewer.md +2 -1
- package/package/corpus/rules/concepts.md +13 -7
- package/package/corpus/rules/glossary.md +2 -1
- package/package/corpus/rules/vertical-slices.md +5 -4
- package/package/corpus/skills/cratis-application-slice-conformance/SKILL.md +11 -2
- package/package/corpus/skills/cratis-application-slice-conformance/references/build-prompts.md +8 -0
- package/package/corpus/skills/cratis-application-slice-conformance/references/checklists.md +10 -6
- package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/SKILL.md +11 -7
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authentication.md +12 -2
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authorization.md +16 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/frontend.md +7 -0
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/observable-emission-guards.md +9 -0
- package/package/corpus/skills/cratis-arc-command/SKILL.md +24 -16
- package/package/corpus/skills/cratis-arc-command/references/command-result.md +7 -0
- package/package/corpus/skills/cratis-arc-command/references/handler-shapes.md +10 -3
- package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-command-operation/SKILL.md +5 -1
- package/package/corpus/skills/cratis-arc-command-operation/references/execution-and-recovery.md +12 -0
- package/package/corpus/skills/cratis-arc-command-operation/references/testing.md +10 -3
- package/package/corpus/skills/cratis-arc-command-typescript/SKILL.md +20 -116
- package/package/corpus/skills/cratis-arc-command-typescript/references/chronicle-events.md +11 -8
- package/package/corpus/skills/cratis-arc-command-typescript/references/command-specifications.md +63 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/hosting-and-storage.md +10 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/proxy-generation.md +38 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/slice-layout.md +19 -0
- package/package/corpus/skills/cratis-arc-command-typescript/verification.json +1 -1
- package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +11 -10
- package/package/corpus/skills/cratis-arc-react-page/SKILL.md +30 -19
- package/package/corpus/skills/cratis-arc-react-page/references/data-page.md +11 -0
- package/package/corpus/skills/cratis-arc-react-page/references/data-tables.md +10 -0
- package/package/corpus/skills/cratis-arc-react-page/references/dialogs.md +12 -10
- package/package/corpus/skills/cratis-arc-react-page/references/from-screenplay.md +10 -0
- package/package/corpus/skills/cratis-arc-react-page/references/mvvm.md +11 -0
- package/package/corpus/skills/cratis-arc-react-page/references/queries-and-commands.md +7 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/SKILL.md +58 -122
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/compatibility-check.md +26 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/discovery.md +22 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/hosting.md +31 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/SKILL.md +52 -131
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/append-api.md +19 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/variants.md +73 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/SKILL.md +29 -232
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/connection-lifecycle.md +20 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/discovery-and-registration.md +44 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/java-api.md +33 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/spring-boot.md +54 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/variants.md +77 -0
- package/package/corpus/skills/cratis-chronicle-client-typescript/SKILL.md +26 -102
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/read-models-and-projections.md +23 -0
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/variants.md +63 -0
- package/package/corpus/skills/cratis-chronicle-compliance/SKILL.md +11 -2
- package/package/corpus/skills/cratis-chronicle-event-modeling/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +13 -13
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +13 -4
- package/package/corpus/skills/cratis-chronicle-projection/references/fluent-builder.md +10 -0
- package/package/corpus/skills/cratis-chronicle-projection/references/model-bound-attributes.md +14 -6
- package/package/corpus/skills/cratis-chronicle-projection/references/variants.md +9 -0
- package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +7 -49
- package/package/corpus/skills/cratis-chronicle-reactor/references/domain-failures.md +19 -0
- package/package/corpus/skills/cratis-chronicle-reactor/references/specifications.md +33 -0
- package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-read-model/references/queries.md +11 -0
- package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +1 -0
- package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +24 -24
- package/package/corpus/skills/cratis-content-length/SKILL.md +1 -1
- package/package/corpus/skills/cratis-content-length/references/length-evidence.md +12 -0
- package/package/corpus/skills/cratis-developer-marketing/SKILL.md +19 -19
- package/package/corpus/skills/cratis-developer-marketing/references/measurement.md +10 -0
- package/package/corpus/skills/cratis-developer-marketing/references/playbook-evidence.md +10 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +5 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/code-style.md +15 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/exceptions-logging-and-di.md +9 -4
- package/package/corpus/skills/cratis-engineering-decision-record/SKILL.md +1 -2
- package/package/corpus/skills/cratis-engineering-decision-record/references/record-format.md +8 -0
- package/package/corpus/skills/cratis-engineering-docs-authoring/SKILL.md +1 -2
- package/package/corpus/skills/cratis-engineering-effect-boundaries/references/failure-archetypes.md +10 -0
- package/package/corpus/skills/cratis-fundamentals-concept/SKILL.md +4 -4
- package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +1 -1
- package/package/corpus/skills/cratis-lens-browser-extension/SKILL.md +18 -18
- package/package/corpus/skills/cratis-performance-review/SKILL.md +1 -1
- package/package/corpus/skills/cratis-release-notes/SKILL.md +1 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +29 -4
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +16 -4
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/effects-and-idempotency.md +4 -15
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/todo-list-example.md +6 -2
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translation-patterns.md +1 -6
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +45 -245
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/capture-map-and-example.md +42 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/complete-examples.md +155 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/specifying-triggers-and-clock.md +27 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/trigger-reads-example.md +21 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +70 -221
- package/package/corpus/skills/cratis-screenplay-command-surface/references/context.md +10 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/generated-values-and-responses.md +51 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/inline-events.md +62 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/policy-persona-seed.md +46 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/validate-rules.md +36 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +11 -11
- package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +10 -3
- package/package/corpus/skills/cratis-screenplay-discovery/references/facilitation.md +1 -6
- package/package/corpus/skills/cratis-screenplay-discovery/references/human-workshop.md +13 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/personas-and-causes.md +8 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/plotting-and-handoff.md +11 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/storming-loop.md +7 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +75 -198
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/file-layout.md +89 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/naming-primitives.md +26 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +14 -1
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +8 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/provenance.md +10 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/slice-type-rules.md +12 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +12 -6
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +5 -6
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/candidate-inventory.md +11 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/prologue-safety.md +8 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/side-car-migration.md +11 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/ui-observation.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +33 -10
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +8 -0
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +13 -17
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +11 -0
- package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +9 -9
- package/package/corpus/skills/cratis-screenplay-model-review/references/business-questions.md +9 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +16 -1
- package/package/corpus/skills/cratis-screenplay-model-review/references/report-template.md +9 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/worked-example.md +9 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +17 -8
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/handoff-template.md +8 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/identity-and-edits.md +1 -6
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +19 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/safety.md +1 -1
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/verdicts-and-modes.md +11 -1
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +2 -2
- package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +3 -4
- package/package/corpus/skills/cratis-screenplay-projections/references/pdl-grammar.md +8 -0
- package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +2 -2
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +3 -3
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +1 -1
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +1 -1
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/worked-example.md +8 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +10 -10
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/coverage-matrix.md +8 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/invoicing-dues-example.md +4 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +17 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-examples.md +10 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-workshop.md +11 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/view-and-story-specs.md +12 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +2 -2
- package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +7 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +8 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +16 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +10 -0
- package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +52 -360
- package/package/corpus/skills/cratis-screenplay-specifications/references/actions-beyond-commands.md +34 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/concept-rules.md +77 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/generated-fixtures.md +39 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/reactions-and-cascades.md +72 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/worked-example.md +110 -0
- package/package/corpus/skills/cratis-screenplay-specifications/verification.json +6 -6
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +23 -3
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +13 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +3 -3
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +16 -20
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +16 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +13 -7
- package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +10 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/doc-contradictions.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +12 -2
- package/package/corpus/skills/cratis-screenplay-toolchain/references/generated-responses-example.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/provenance.md +2 -2
- package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +10 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +15 -5
- package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +11 -13
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/flow-review.md +1 -1
- package/package/corpus/skills/cratis-security-review/SKILL.md +13 -8
- package/package/corpus/skills/cratis-social-feed-post/SKILL.md +10 -10
- package/package/corpus/skills/cratis-social-feed-post/references/engagement-evidence.md +12 -0
- package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +13 -2
- package/package/corpus/skills/cratis-specifications-csharp/references/application-scenarios.md +10 -10
- package/package/corpus/skills/cratis-specifications-csharp/references/csharp-patterns.md +10 -0
- package/package/corpus/skills/cratis-specifications-csharp/references/integration-specs.md +9 -0
- package/package/corpus/skills/cratis-specifications-typescript/SKILL.md +1 -2
- package/package/corpus/skills/cratis-specifications-typescript/references/typescript-patterns.md +11 -1
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +30 -21
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +9 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/render-example.md +5 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +2 -4
- package/package/corpus/skills/cratis-studio-mcp-safety-guidance/SKILL.md +2 -2
- package/package/corpus/skills/cratis-writing-voice-and-cadence/SKILL.md +39 -39
- package/package/corpus/skills/cratis-writing-voice-and-cadence/references/ai-tells.md +10 -0
- package/package.json +1 -1
|
@@ -63,182 +63,49 @@ decides, not the slice type:
|
|
|
63
63
|
as the contract: `cratis-screenplay-render-and-gap-fill`.
|
|
64
64
|
|
|
65
65
|
Model them whenever the `.play` file is the deliverable, and say which tool bound
|
|
66
|
-
them.
|
|
66
|
+
them. Read `cratis-screenplay-toolchain` (`references/versions.md`) when selecting a compiler version or interpreting version-dependent messages.
|
|
67
67
|
Method (the four-part automation test, loops, translations versus automations):
|
|
68
68
|
`cratis-screenplay-automations-and-translations`.
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
`3baf4a4`; execution from ESM v6, checked at `v4.66.0`): `when clock "<instant>"`
|
|
72
|
-
for a reaction on `every` or `at`, `when trigger <Trigger>` with its values for one
|
|
73
|
-
on an application trigger, and `given capture` / `when capture <Capture>` with the
|
|
74
|
-
source record's fields for a capture, then the events that should follow.
|
|
75
|
-
`given clock` fixes the occurrence time, so values mapped from `$context.occurred`
|
|
76
|
-
can be asserted. Excerpt of the complete example below:
|
|
70
|
+
## Specify what sets them off
|
|
77
71
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
72
|
+
A specification names what sets the automation off: `when clock`, `when trigger` or `when capture`. No command runs these specifications; report one as authored, not executed.
|
|
73
|
+
|
|
74
|
+
Read [references/specifying-triggers-and-clock.md](references/specifying-triggers-and-clock.md) when writing a specification for a reaction, trigger or capture, or when the clock, occurrence or limit rules matter.
|
|
75
|
+
|
|
76
|
+
## Caller-less invokes and unprotected reads
|
|
77
|
+
|
|
78
|
+
**Who is the caller of an `invokes`?** Nobody. In the reference execution the invoked
|
|
79
|
+
command runs its full pipeline - authorization, validation, requirements,
|
|
80
|
+
constraints - **with no caller**; a command that needs one rejects, and the
|
|
81
|
+
rejection ends the scenario. Each invoked command is atomic, but the cascade is not,
|
|
82
|
+
so facts accepted earlier remain. There is no syntax for a trusted identity in the verified Screenplay versions
|
|
83
|
+
(Screenplay#383, open): never invent `runs as` or a `given caller` for a reaction.
|
|
84
|
+
Say so in the model: a `description` on the reaction that names the trusted actor
|
|
85
|
+
the target must use. At code level a rendered or hand-written target runs such a
|
|
86
|
+
command as the system with `[ExecuteCommandsAsSystem]` (Arc 20.56.0 and later, so
|
|
87
|
+
also in a rendered application's Arc 22.25.0). An authorized command a reaction
|
|
88
|
+
invokes needs that decision made explicit, in the model's description and in the
|
|
89
|
+
gap-fill code, not left to a rejection nobody expected. Cascades and their
|
|
90
|
+
specification limits: `cratis-screenplay-specifications`.
|
|
86
91
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
`
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
⚠️ **Declared, not enforced.** A trigger `reads` gives no runtime protection. From
|
|
93
|
+
ESM v6 the binder refuses to treat it as one: a trigger with `reads` that **produces
|
|
94
|
+
directly**, or whose effect is an opaque body (`file` or an inline block), fails
|
|
95
|
+
binding, because its decision dependency cannot be protected. A reaction that only
|
|
96
|
+
`invokes` a command binds, and the decision, and any protection, belong to that
|
|
97
|
+
command's own reads. Command `reads` give none yet either (`PLAY0271`, #129).
|
|
98
|
+
Decision 0006 leaves `where` over read paths out of scope, and `where` needs
|
|
99
|
+
every operand to resolve from the trigger's declared scalar occurrence shape (listed in
|
|
100
|
+
the input selection or not; nested paths and read aliases fail binding): keep the logic that uses the state in
|
|
101
|
+
the invoked command or the implementation. Under `cratis` before 3.28.2 none of this
|
|
102
|
+
bound at all (`PLAY0268`); `cratis` 3.28.2 binds it like the standalone tool.
|
|
95
103
|
|
|
96
104
|
## Complete example (ESM v6)
|
|
97
105
|
|
|
98
|
-
One document with every construct
|
|
99
|
-
event, on a trigger (with `where` and `invokes`), on a view read and on the clock, and
|
|
100
|
-
a capture with its specifications. The excerpts later in this skill have their own
|
|
101
|
-
complete parent documents in `references/complete-examples.md`.
|
|
106
|
+
One document with every construct (application trigger, reactions on an event, a trigger, a view read and the clock, and a capture with specifications) is kept in the reference file.
|
|
102
107
|
|
|
103
|
-
|
|
104
|
-
concept InvoiceId : Uuid
|
|
105
|
-
trigger PaymentFileArrived
|
|
106
|
-
description "The bank's payment file listed a payment for an invoice"
|
|
107
|
-
invoiceId InvoiceId
|
|
108
|
-
amount Decimal
|
|
109
|
-
module Collections
|
|
110
|
-
feature Invoices
|
|
111
|
-
slice StateChange SendInvoice
|
|
112
|
-
command SendInvoice
|
|
113
|
-
invoiceId InvoiceId identifier
|
|
114
|
-
amount Decimal
|
|
115
|
-
produces InvoiceSent
|
|
116
|
-
for invoiceId
|
|
117
|
-
invoiceId = invoiceId
|
|
118
|
-
amount = amount
|
|
119
|
-
sentAt = $context.occurred
|
|
120
|
-
event InvoiceSent
|
|
121
|
-
invoiceId InvoiceId
|
|
122
|
-
amount Decimal
|
|
123
|
-
sentAt DateTime
|
|
124
|
-
slice StateChange CloseInvoice
|
|
125
|
-
command CloseInvoice
|
|
126
|
-
invoiceId InvoiceId identifier
|
|
127
|
-
reason String
|
|
128
|
-
validate
|
|
129
|
-
reason not empty message "A reason is required"
|
|
130
|
-
produces InvoiceClosed
|
|
131
|
-
for invoiceId
|
|
132
|
-
reason = reason
|
|
133
|
-
event InvoiceClosed
|
|
134
|
-
reason String
|
|
135
|
-
constraint OnlyClosedOnce
|
|
136
|
-
unique event InvoiceClosed
|
|
137
|
-
slice StateView InvoiceBalances
|
|
138
|
-
readmodel InvoiceBalance
|
|
139
|
-
invoiceId InvoiceId
|
|
140
|
-
outstanding Decimal
|
|
141
|
-
query InvoiceBalanceById => InvoiceBalance optional
|
|
142
|
-
by invoiceId InvoiceId
|
|
143
|
-
projection InvoiceBalances => InvoiceBalance
|
|
144
|
-
from InvoiceSent
|
|
145
|
-
invoiceId = $eventSourceId
|
|
146
|
-
outstanding = amount
|
|
147
|
-
slice StateChange SendPaymentReminder
|
|
148
|
-
command SendPaymentReminder
|
|
149
|
-
invoiceId InvoiceId identifier
|
|
150
|
-
produces PaymentReminderSent
|
|
151
|
-
for invoiceId
|
|
152
|
-
reminderNumber = 1
|
|
153
|
-
event PaymentReminderSent
|
|
154
|
-
reminderNumber Int
|
|
155
|
-
slice Automation Reminders
|
|
156
|
-
reaction RemindOnDueDate
|
|
157
|
-
description "Reminds the customer when an invoice falls due unpaid"
|
|
158
|
-
when InvoiceFellDue
|
|
159
|
-
invoiceId
|
|
160
|
-
reads InvoiceBalance as balance by invoiceId
|
|
161
|
-
invokes SendPaymentReminder
|
|
162
|
-
invoiceId = invoiceId
|
|
163
|
-
reaction ReminderScheduler
|
|
164
|
-
description "Schedules a reminder when an invoice is sent"
|
|
165
|
-
when InvoiceSent
|
|
166
|
-
invoiceId
|
|
167
|
-
produces ReminderScheduled
|
|
168
|
-
scheduledAt = $context.occurred
|
|
169
|
-
reaction PaymentImporter
|
|
170
|
-
description "Closes an invoice the bank file shows as paid"
|
|
171
|
-
when PaymentFileArrived
|
|
172
|
-
invoiceId
|
|
173
|
-
amount
|
|
174
|
-
invokes CloseInvoice
|
|
175
|
-
invoiceId = invoiceId
|
|
176
|
-
reason = "paid"
|
|
177
|
-
where amount > 0
|
|
178
|
-
reaction WeeklyDigest
|
|
179
|
-
description "Issues the collections digest every Monday morning"
|
|
180
|
-
at 07:30 on Monday
|
|
181
|
-
produces DigestIssued
|
|
182
|
-
for "weekly"
|
|
183
|
-
issuedAt = $context.occurred
|
|
184
|
-
event InvoiceFellDue
|
|
185
|
-
invoiceId InvoiceId
|
|
186
|
-
event ReminderScheduled
|
|
187
|
-
scheduledAt DateTime
|
|
188
|
-
event DigestIssued
|
|
189
|
-
issuedAt DateTime
|
|
190
|
-
specification SchedulingAReminderWhenAnInvoiceIsSent
|
|
191
|
-
given clock "2026-10-02T09:00:00Z"
|
|
192
|
-
when append InvoiceSent
|
|
193
|
-
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
194
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
195
|
-
amount = 120
|
|
196
|
-
sentAt = "2026-10-02T09:00:00Z"
|
|
197
|
-
then ReminderScheduled
|
|
198
|
-
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
199
|
-
scheduledAt = "2026-10-02T09:00:00Z"
|
|
200
|
-
specification ClosingAPaidInvoice
|
|
201
|
-
when trigger PaymentFileArrived
|
|
202
|
-
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
203
|
-
amount = 120
|
|
204
|
-
then InvoiceClosed
|
|
205
|
-
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
206
|
-
reason = "paid"
|
|
207
|
-
specification IssuingTheWeeklyDigest
|
|
208
|
-
given clock "2026-10-05T07:00:00Z"
|
|
209
|
-
when clock "2026-10-05T07:30:00Z"
|
|
210
|
-
then DigestIssued
|
|
211
|
-
for "weekly"
|
|
212
|
-
issuedAt = "2026-10-05T07:30:00Z"
|
|
213
|
-
slice Translate LegacyInvoiceSync
|
|
214
|
-
capture LegacyInvoiceCapture
|
|
215
|
-
source api
|
|
216
|
-
api LegacyInvoicingApi
|
|
217
|
-
route /invoices
|
|
218
|
-
poll 5m
|
|
219
|
-
key id
|
|
220
|
-
map
|
|
221
|
-
status = status translate
|
|
222
|
-
"sendt" => sent
|
|
223
|
-
"betalt" => paid
|
|
224
|
-
append LegacyInvoicePaid
|
|
225
|
-
tag legacy
|
|
226
|
-
when status from "sent" to "paid"
|
|
227
|
-
paidAt = $context.occurred
|
|
228
|
-
event LegacyInvoicePaid
|
|
229
|
-
paidAt DateTime
|
|
230
|
-
specification SeeingALegacyPayment
|
|
231
|
-
given clock "2026-10-02T12:00:00Z"
|
|
232
|
-
given capture LegacyInvoiceCapture
|
|
233
|
-
id = "inv-42"
|
|
234
|
-
status = "sendt"
|
|
235
|
-
when capture LegacyInvoiceCapture
|
|
236
|
-
id = "inv-42"
|
|
237
|
-
status = "betalt"
|
|
238
|
-
then LegacyInvoicePaid
|
|
239
|
-
for "inv-42"
|
|
240
|
-
paidAt = "2026-10-02T12:00:00Z"
|
|
241
|
-
```
|
|
108
|
+
Read [references/complete-examples.md](references/complete-examples.md) when you need a complete, compiling parent document for an excerpt or want to check the authoring and binding prerequisites.
|
|
242
109
|
|
|
243
110
|
## `capture` — the Change Data Capture Language
|
|
244
111
|
|
|
@@ -246,34 +113,9 @@ Captures live in `Translate` slices and are the anti-corruption layer: external
|
|
|
246
113
|
shapes in, domain events out. Excerpt; complete document: `references/complete-examples.md`,
|
|
247
114
|
"Capture with `source`, `map`, `append` and `children`".
|
|
248
115
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
source api
|
|
253
|
-
api LegacyInvoicingApi
|
|
254
|
-
route /invoices
|
|
255
|
-
poll 5m
|
|
256
|
-
key id
|
|
257
|
-
map
|
|
258
|
-
status = status translate
|
|
259
|
-
"utkast" => draft
|
|
260
|
-
"sendt" => sent
|
|
261
|
-
"betalt" => paid
|
|
262
|
-
append InvoiceStatusChanged
|
|
263
|
-
tag legacy
|
|
264
|
-
when status
|
|
265
|
-
invoiceId = $.id
|
|
266
|
-
status = $.status
|
|
267
|
-
changedAt = $context.occurred
|
|
268
|
-
append InvoicePaidFromSent
|
|
269
|
-
when status from "sent" to "paid"
|
|
270
|
-
invoiceId = $.id
|
|
271
|
-
children lineItems identified by lineNumber
|
|
272
|
-
append InvoiceLineItemAdded
|
|
273
|
-
when added
|
|
274
|
-
invoiceId = $.id
|
|
275
|
-
lineNumber = $.lineNumber
|
|
276
|
-
```
|
|
116
|
+
The full capture excerpt (`source`, `key`, `map` with `translate`, two `append` blocks and `children`) is in the reference file.
|
|
117
|
+
|
|
118
|
+
Read [references/capture-map-and-example.md](references/capture-map-and-example.md) when writing a capture's `map` block, or when you need the excerpt of a capture with `append` and `children`.
|
|
277
119
|
|
|
278
120
|
**`source <kind>`** with indented settings. The documented kinds and settings are
|
|
279
121
|
`api` (`api`, `route`, `poll`), `webhook` (`path`) and `message` (`topic`).
|
|
@@ -289,15 +131,9 @@ record's `key` names, and `$context.occurred` is the scenario's `given clock`.
|
|
|
289
131
|
|
|
290
132
|
Declaring an event's external origin on the `event` itself is accepted as
|
|
291
133
|
Screenplay decision 0009 but **not in the language**; a `capture` in a
|
|
292
|
-
`Translate` slice is how outside data enters a model
|
|
293
|
-
|
|
294
|
-
**`map`** reshapes before events are appended: direct rename
|
|
295
|
-
(`productName = name`), a backtick template, `translate` with indented
|
|
296
|
-
`"source" => target` entries, and `split <source> by "<sep>"` with indented target
|
|
297
|
-
properties.
|
|
134
|
+
`Translate` slice is how outside data enters a model in the verified Screenplay versions.
|
|
298
135
|
|
|
299
|
-
|
|
300
|
-
capture context, `$env.` for an environment variable, plus literals and templates.
|
|
136
|
+
**`map`** reshapes properties before events are appended (rename, template, `translate`, `split`; mapping sources are `$.`, `$context.` and `$env.`); syntax is in the reference file linked above.
|
|
301
137
|
|
|
302
138
|
**`append <Event>`** with optional `tag` lines and one `when` clause:
|
|
303
139
|
|
|
@@ -402,19 +238,7 @@ append-time constraints. `invokes` asks for a command, which additionally runs t
|
|
|
402
238
|
command's authorization, validation and requirements, and may reject.
|
|
403
239
|
Using `produces` for both would say those are the same kind of consequence.
|
|
404
240
|
|
|
405
|
-
**Who is the caller of an `invokes`?** Nobody
|
|
406
|
-
command runs its full pipeline - authorization, validation, requirements,
|
|
407
|
-
constraints - **with no caller**; a command that needs one rejects, and the
|
|
408
|
-
rejection ends the scenario. Each invoked command is atomic, but the cascade is not,
|
|
409
|
-
so facts accepted earlier remain. There is no syntax for a trusted identity today
|
|
410
|
-
(Screenplay#383, open): never invent `runs as` or a `given caller` for a reaction.
|
|
411
|
-
Say so in the model: a `description` on the reaction that names the trusted actor
|
|
412
|
-
the target must use. At code level a rendered or hand-written target runs such a
|
|
413
|
-
command as the system with `[ExecuteCommandsAsSystem]` (Arc 20.56.0 and later, so
|
|
414
|
-
also in a rendered application's Arc 22.25.0). An authorized command a reaction
|
|
415
|
-
invokes needs that decision made explicit, in the model's description and in the
|
|
416
|
-
gap-fill code, not left to a rejection nobody expected. Cascades and their
|
|
417
|
-
specification limits: `cratis-screenplay-specifications`.
|
|
241
|
+
**Who is the caller of an `invokes`?** Nobody; see *Caller-less invokes and unprotected reads* above before writing one.
|
|
418
242
|
|
|
419
243
|
Both are declarations of *what happens*, not of how — a trigger can state its
|
|
420
244
|
consequences **and** carry a `file` or an inline block in a tagged fence
|
|
@@ -429,23 +253,9 @@ a command's `reads`: the state the behavior decides from. Excerpt; complete
|
|
|
429
253
|
document: `references/complete-examples.md`, "Trigger `reads` on an event and on the
|
|
430
254
|
clock" (authoring-valid; the `file` bodies stop it binding at ESM v6).
|
|
431
255
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
description "Reminds the customer when an invoice falls due unpaid"
|
|
436
|
-
when InvoiceFellDue
|
|
437
|
-
invoiceId
|
|
438
|
-
reads InvoiceBalance as balance by invoiceId
|
|
439
|
-
invokes SendPaymentReminder
|
|
440
|
-
invoiceId = invoiceId
|
|
441
|
-
channel = "email"
|
|
442
|
-
file Reactions/RemindOnDueDate.cs
|
|
443
|
-
reaction SweepOverdueInvoices
|
|
444
|
-
description "Re-checks every overdue invoice each morning"
|
|
445
|
-
at 08:00
|
|
446
|
-
reads OverdueInvoice
|
|
447
|
-
file Reactions/SweepOverdueInvoices.cs
|
|
448
|
-
```
|
|
256
|
+
The excerpt of a reaction with `reads` on an event and on the clock is in the reference file.
|
|
257
|
+
|
|
258
|
+
Read [references/trigger-reads-example.md](references/trigger-reads-example.md) when writing a trigger `reads` with `by` or an alias, or a clock trigger that reads a whole view.
|
|
449
259
|
|
|
450
260
|
- `reads` sits **under a trigger**, beside the values it takes and its effects.
|
|
451
261
|
Each trigger declares its own.
|
|
@@ -461,19 +271,9 @@ slice Automation ChaseOverdueInvoices
|
|
|
461
271
|
written `@reads`. A bare `reads` line is error `PLAY0175`, and
|
|
462
272
|
`reads <PrimitiveType>` is warning `PLAY0444`; both messages name the escape.
|
|
463
273
|
- `for each <View>` is reserved for a future view-driven trigger. It is not a
|
|
464
|
-
trigger
|
|
274
|
+
trigger in the verified Screenplay versions (`PLAY0137`).
|
|
465
275
|
|
|
466
|
-
⚠️ **Declared, not enforced.**
|
|
467
|
-
ESM v6 the binder refuses to treat it as one: a trigger with `reads` that **produces
|
|
468
|
-
directly**, or whose effect is an opaque body (`file` or an inline block), fails
|
|
469
|
-
binding, because its decision dependency cannot be protected. A reaction that only
|
|
470
|
-
`invokes` a command binds, and the decision, and any protection, belong to that
|
|
471
|
-
command's own reads. Command `reads` give none yet either (`PLAY0271`, #129).
|
|
472
|
-
Decision 0006 leaves `where` over read paths out of scope, and `where` needs
|
|
473
|
-
every operand to resolve from the trigger's declared scalar occurrence shape (listed in
|
|
474
|
-
the input selection or not; nested paths and read aliases fail binding): keep the logic that uses the state in
|
|
475
|
-
the invoked command or the implementation. Under `cratis` before 3.28.2 none of this
|
|
476
|
-
bound at all (`PLAY0268`); `cratis` 3.28.2 binds it like the standalone tool.
|
|
276
|
+
⚠️ **Declared, not enforced.** See *Caller-less invokes and unprotected reads* above.
|
|
477
277
|
|
|
478
278
|
## `trigger`
|
|
479
279
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Capture map and example
|
|
2
|
+
|
|
3
|
+
## Capture excerpt
|
|
4
|
+
|
|
5
|
+
```screenplay excerpt
|
|
6
|
+
slice Translate LegacyInvoiceSync
|
|
7
|
+
capture LegacyInvoiceCapture
|
|
8
|
+
source api
|
|
9
|
+
api LegacyInvoicingApi
|
|
10
|
+
route /invoices
|
|
11
|
+
poll 5m
|
|
12
|
+
key id
|
|
13
|
+
map
|
|
14
|
+
status = status translate
|
|
15
|
+
"utkast" => draft
|
|
16
|
+
"sendt" => sent
|
|
17
|
+
"betalt" => paid
|
|
18
|
+
append InvoiceStatusChanged
|
|
19
|
+
tag legacy
|
|
20
|
+
when status
|
|
21
|
+
invoiceId = $.id
|
|
22
|
+
status = $.status
|
|
23
|
+
changedAt = $context.occurred
|
|
24
|
+
append InvoicePaidFromSent
|
|
25
|
+
when status from "sent" to "paid"
|
|
26
|
+
invoiceId = $.id
|
|
27
|
+
children lineItems identified by lineNumber
|
|
28
|
+
append InvoiceLineItemAdded
|
|
29
|
+
when added
|
|
30
|
+
invoiceId = $.id
|
|
31
|
+
lineNumber = $.lineNumber
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Capture `map`
|
|
35
|
+
|
|
36
|
+
**`map`** reshapes before events are appended: direct rename
|
|
37
|
+
(`productName = name`), a backtick template, `translate` with indented
|
|
38
|
+
`"source" => target` entries, and `split <source> by "<sep>"` with indented target
|
|
39
|
+
properties.
|
|
40
|
+
|
|
41
|
+
**Mapping sources:** `$.` for a value from the current source item, `$context.` for
|
|
42
|
+
capture context, `$env.` for an environment variable, plus literals and templates.
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Complete examples for the excerpts in SKILL.md
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Capture with `source`, `map`, `append` and `children`
|
|
6
|
+
- Reaction on a declared trigger with `where` and `invokes`
|
|
7
|
+
- Reaction with `produces` and `invokes`
|
|
8
|
+
- Trigger `reads` on an event and on the clock
|
|
9
|
+
- Complete example (ESM v6)
|
|
10
|
+
|
|
3
11
|
Each document below is complete and compiles with the standalone `screenplay` 4.68.0
|
|
4
12
|
(`--warnaserror`). The SKILL.md excerpts show the reaction, capture or trigger part of
|
|
5
13
|
these documents. Documents marked ESM v6 need Screenplay 4.61 or later: the standalone tool and `cratis` 3.28.2
|
|
@@ -181,3 +189,150 @@ module Collections
|
|
|
181
189
|
reads OverdueInvoice
|
|
182
190
|
file Reactions/SweepOverdueInvoices.cs
|
|
183
191
|
```
|
|
192
|
+
|
|
193
|
+
## Complete example (ESM v6)
|
|
194
|
+
|
|
195
|
+
One document with every construct below: an application trigger, a reaction on an
|
|
196
|
+
event, on a trigger (with `where` and `invokes`), on a view read and on the clock, and
|
|
197
|
+
a capture with its specifications. The excerpts later in this skill have their own
|
|
198
|
+
complete parent documents in `references/complete-examples.md`.
|
|
199
|
+
|
|
200
|
+
```screenplay
|
|
201
|
+
concept InvoiceId : Uuid
|
|
202
|
+
trigger PaymentFileArrived
|
|
203
|
+
description "The bank's payment file listed a payment for an invoice"
|
|
204
|
+
invoiceId InvoiceId
|
|
205
|
+
amount Decimal
|
|
206
|
+
module Collections
|
|
207
|
+
feature Invoices
|
|
208
|
+
slice StateChange SendInvoice
|
|
209
|
+
command SendInvoice
|
|
210
|
+
invoiceId InvoiceId identifier
|
|
211
|
+
amount Decimal
|
|
212
|
+
produces InvoiceSent
|
|
213
|
+
for invoiceId
|
|
214
|
+
invoiceId = invoiceId
|
|
215
|
+
amount = amount
|
|
216
|
+
sentAt = $context.occurred
|
|
217
|
+
event InvoiceSent
|
|
218
|
+
invoiceId InvoiceId
|
|
219
|
+
amount Decimal
|
|
220
|
+
sentAt DateTime
|
|
221
|
+
slice StateChange CloseInvoice
|
|
222
|
+
command CloseInvoice
|
|
223
|
+
invoiceId InvoiceId identifier
|
|
224
|
+
reason String
|
|
225
|
+
validate
|
|
226
|
+
reason not empty message "A reason is required"
|
|
227
|
+
produces InvoiceClosed
|
|
228
|
+
for invoiceId
|
|
229
|
+
reason = reason
|
|
230
|
+
event InvoiceClosed
|
|
231
|
+
reason String
|
|
232
|
+
constraint OnlyClosedOnce
|
|
233
|
+
unique event InvoiceClosed
|
|
234
|
+
slice StateView InvoiceBalances
|
|
235
|
+
readmodel InvoiceBalance
|
|
236
|
+
invoiceId InvoiceId
|
|
237
|
+
outstanding Decimal
|
|
238
|
+
query InvoiceBalanceById => InvoiceBalance optional
|
|
239
|
+
by invoiceId InvoiceId
|
|
240
|
+
projection InvoiceBalances => InvoiceBalance
|
|
241
|
+
from InvoiceSent
|
|
242
|
+
invoiceId = $eventSourceId
|
|
243
|
+
outstanding = amount
|
|
244
|
+
slice StateChange SendPaymentReminder
|
|
245
|
+
command SendPaymentReminder
|
|
246
|
+
invoiceId InvoiceId identifier
|
|
247
|
+
produces PaymentReminderSent
|
|
248
|
+
for invoiceId
|
|
249
|
+
reminderNumber = 1
|
|
250
|
+
event PaymentReminderSent
|
|
251
|
+
reminderNumber Int
|
|
252
|
+
slice Automation Reminders
|
|
253
|
+
reaction RemindOnDueDate
|
|
254
|
+
description "Reminds the customer when an invoice falls due unpaid"
|
|
255
|
+
when InvoiceFellDue
|
|
256
|
+
invoiceId
|
|
257
|
+
reads InvoiceBalance as balance by invoiceId
|
|
258
|
+
invokes SendPaymentReminder
|
|
259
|
+
invoiceId = invoiceId
|
|
260
|
+
reaction ReminderScheduler
|
|
261
|
+
description "Schedules a reminder when an invoice is sent"
|
|
262
|
+
when InvoiceSent
|
|
263
|
+
invoiceId
|
|
264
|
+
produces ReminderScheduled
|
|
265
|
+
scheduledAt = $context.occurred
|
|
266
|
+
reaction PaymentImporter
|
|
267
|
+
description "Closes an invoice the bank file shows as paid"
|
|
268
|
+
when PaymentFileArrived
|
|
269
|
+
invoiceId
|
|
270
|
+
amount
|
|
271
|
+
invokes CloseInvoice
|
|
272
|
+
invoiceId = invoiceId
|
|
273
|
+
reason = "paid"
|
|
274
|
+
where amount > 0
|
|
275
|
+
reaction WeeklyDigest
|
|
276
|
+
description "Issues the collections digest every Monday morning"
|
|
277
|
+
at 07:30 on Monday
|
|
278
|
+
produces DigestIssued
|
|
279
|
+
for "weekly"
|
|
280
|
+
issuedAt = $context.occurred
|
|
281
|
+
event InvoiceFellDue
|
|
282
|
+
invoiceId InvoiceId
|
|
283
|
+
event ReminderScheduled
|
|
284
|
+
scheduledAt DateTime
|
|
285
|
+
event DigestIssued
|
|
286
|
+
issuedAt DateTime
|
|
287
|
+
specification SchedulingAReminderWhenAnInvoiceIsSent
|
|
288
|
+
given clock "2026-10-02T09:00:00Z"
|
|
289
|
+
when append InvoiceSent
|
|
290
|
+
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
291
|
+
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
292
|
+
amount = 120
|
|
293
|
+
sentAt = "2026-10-02T09:00:00Z"
|
|
294
|
+
then ReminderScheduled
|
|
295
|
+
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
296
|
+
scheduledAt = "2026-10-02T09:00:00Z"
|
|
297
|
+
specification ClosingAPaidInvoice
|
|
298
|
+
when trigger PaymentFileArrived
|
|
299
|
+
invoiceId = "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
300
|
+
amount = 120
|
|
301
|
+
then InvoiceClosed
|
|
302
|
+
for "9c858901-8a57-4791-81fe-4c455b099bc9"
|
|
303
|
+
reason = "paid"
|
|
304
|
+
specification IssuingTheWeeklyDigest
|
|
305
|
+
given clock "2026-10-05T07:00:00Z"
|
|
306
|
+
when clock "2026-10-05T07:30:00Z"
|
|
307
|
+
then DigestIssued
|
|
308
|
+
for "weekly"
|
|
309
|
+
issuedAt = "2026-10-05T07:30:00Z"
|
|
310
|
+
slice Translate LegacyInvoiceSync
|
|
311
|
+
capture LegacyInvoiceCapture
|
|
312
|
+
source api
|
|
313
|
+
api LegacyInvoicingApi
|
|
314
|
+
route /invoices
|
|
315
|
+
poll 5m
|
|
316
|
+
key id
|
|
317
|
+
map
|
|
318
|
+
status = status translate
|
|
319
|
+
"sendt" => sent
|
|
320
|
+
"betalt" => paid
|
|
321
|
+
append LegacyInvoicePaid
|
|
322
|
+
tag legacy
|
|
323
|
+
when status from "sent" to "paid"
|
|
324
|
+
paidAt = $context.occurred
|
|
325
|
+
event LegacyInvoicePaid
|
|
326
|
+
paidAt DateTime
|
|
327
|
+
specification SeeingALegacyPayment
|
|
328
|
+
given clock "2026-10-02T12:00:00Z"
|
|
329
|
+
given capture LegacyInvoiceCapture
|
|
330
|
+
id = "inv-42"
|
|
331
|
+
status = "sendt"
|
|
332
|
+
when capture LegacyInvoiceCapture
|
|
333
|
+
id = "inv-42"
|
|
334
|
+
status = "betalt"
|
|
335
|
+
then LegacyInvoicePaid
|
|
336
|
+
for "inv-42"
|
|
337
|
+
paidAt = "2026-10-02T12:00:00Z"
|
|
338
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Specifying triggers and the clock
|
|
2
|
+
|
|
3
|
+
**Specify what sets them off** (v4.48.0, checked at tag `v4.48.0`, commit
|
|
4
|
+
`3baf4a4`; execution from ESM v6, checked at `v4.66.0`): `when clock "<instant>"`
|
|
5
|
+
for a reaction on `every` or `at`, `when trigger <Trigger>` with its values for one
|
|
6
|
+
on an application trigger, and `given capture` / `when capture <Capture>` with the
|
|
7
|
+
source record's fields for a capture, then the events that should follow.
|
|
8
|
+
`given clock` fixes the occurrence time, so values mapped from `$context.occurred`
|
|
9
|
+
can be asserted. Excerpt of the complete example in [complete-examples.md](complete-examples.md):
|
|
10
|
+
|
|
11
|
+
```screenplay excerpt
|
|
12
|
+
specification IssuingTheWeeklyDigest
|
|
13
|
+
given clock "2026-10-05T07:00:00Z"
|
|
14
|
+
when clock "2026-10-05T07:30:00Z"
|
|
15
|
+
then DigestIssued
|
|
16
|
+
for "weekly"
|
|
17
|
+
issuedAt = "2026-10-05T07:30:00Z"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Under `cratis` before 3.28.2 these actions parsed and were checked against the application
|
|
21
|
+
but bound to nothing (`PLAY0268` names ESM v6, decision 0022); on 3.28.2 they bind. Either way
|
|
22
|
+
no command runs them: report such a specification as authored, not executed. Clock rules: the clock is UTC and exact; an
|
|
23
|
+
occurrence fires once when it is **due after `given clock` and at or before
|
|
24
|
+
`when clock`**, in time order; intervals count from the Unix epoch; `when clock`
|
|
25
|
+
needs `given clock`, so equal instants fire nothing. Limits: 10,000 occurrences per
|
|
26
|
+
advance, 1,000 new facts per scenario. Spec grammar and outcome comparison:
|
|
27
|
+
`cratis-screenplay-specifications`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Trigger reads example
|
|
2
|
+
|
|
3
|
+
## Trigger `reads` excerpt
|
|
4
|
+
|
|
5
|
+
```screenplay excerpt
|
|
6
|
+
slice Automation ChaseOverdueInvoices
|
|
7
|
+
reaction RemindOnDueDate
|
|
8
|
+
description "Reminds the customer when an invoice falls due unpaid"
|
|
9
|
+
when InvoiceFellDue
|
|
10
|
+
invoiceId
|
|
11
|
+
reads InvoiceBalance as balance by invoiceId
|
|
12
|
+
invokes SendPaymentReminder
|
|
13
|
+
invoiceId = invoiceId
|
|
14
|
+
channel = "email"
|
|
15
|
+
file Reactions/RemindOnDueDate.cs
|
|
16
|
+
reaction SweepOverdueInvoices
|
|
17
|
+
description "Re-checks every overdue invoice each morning"
|
|
18
|
+
at 08:00
|
|
19
|
+
reads OverdueInvoice
|
|
20
|
+
file Reactions/SweepOverdueInvoices.cs
|
|
21
|
+
```
|