@smartkomm/plexus-cli 0.1.120 → 0.1.121

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.
@@ -1 +1 @@
1
- 7f9d9aa30238e8f1b7ba59cab4a8e80e655b75cc2237e73220d79370cc235448
1
+ 613a42bd0361c7ad6d7b9731b03e93d13773c46921d2ff8d73bd385b4b3009a0
@@ -209,6 +209,7 @@ whole is the operator's (ask them; do not try).
209
209
  | [offer/declare-node-reads.md](references/offer/declare-node-reads.md) | Mandant + Plattform | Declare which form fields a document node reads and locks. |
210
210
  | [offer/edit-live-tenant-offer.md](references/offer/edit-live-tenant-offer.md) | Mandant + Plattform | Change a live offer: fresh export → change → plan → apply → plan shows all same (signing connection steps need the operator). |
211
211
  | [offer/edit-smartform.md](references/offer/edit-smartform.md) | Mandant | Change a SmartForm in detail (properties, order, English texts). |
212
+ | [offer/conditional-optional-action.md](references/offer/conditional-optional-action.md) | Mandant | Offer an optional action only under a condition over `$env`, e.g. for one stage |
212
213
  | [offer/consent-field.md](references/offer/consent-field.md) | Mandant | Add a consent field (a checkbox that must be ticked) or convert a preset yes/no into one. |
213
214
  | [offer/edit-workflow-node.md](references/offer/edit-workflow-node.md) | Mandant | Rename, rewire, rebind or reroute a node. |
214
215
  | [offer/engage-push-node.md](references/offer/engage-push-node.md) | Mandant + Plattform | Insert the Engage transfer node that pushes an accepted application to Engage SMIS once. |
@@ -2211,6 +2211,8 @@ Create or change one optional action (spawnTasks) of a decision node; validate b
2211
2211
  | `--trigger <value>` | Permission-group key that may press the entry (omitted: only the responsible person) |
2212
2212
  | `--clear-trigger` | Remove --trigger |
2213
2213
  | `--repeatable` | A finished round may run again (--no-repeatable: once) |
2214
+ | `--when <value>` | Offer condition: one expression over $env, e.g. "$env.stage.key == 'early-years-3'" |
2215
+ | `--clear-when` | Remove --when (always offered) |
2214
2216
 
2215
2217
  ### `offer workflow node reads`
2216
2218
 
@@ -0,0 +1,57 @@
1
+ # Offer an optional action only under a condition
2
+
3
+ **Use it to** show an entry under „Weiteres" only on the applications it is meant for —
4
+ a „Taster Day" only for one stage. On every other application the entry does not exist, not
5
+ even greyed out.
6
+
7
+ ## The model
8
+
9
+ - **`optionalActions[].when`** is one condition of the expression language over `$env`, the
10
+ checker an `if` node and an assignment rule use: `$env.stage.key == 'early-years-3'`. No
11
+ computed form field is needed, and a form address is refused.
12
+ - **`$env.stage.key` is the bundle key** (`program.stages[].key`), never the stored
13
+ `<program>-stufe-<key>`. Publish checks the literal against the offer's program.
14
+ - **It is read afresh on every load.** A stage change shows or hides the entry on the next load.
15
+ - **It rules the offer, never the round.** Tasks a press already spawned stay when the
16
+ condition turns false, and they keep holding the decision until they are closed.
17
+ - **Not in `requiresOneOf`.** A decision cannot wait for an action that may never be offered
18
+ (`[decision/requiresOneOfConditional]`).
19
+
20
+ ## CLI
21
+
22
+ Use a scratch dir for a real tenant
23
+ ([edit-live-tenant-offer.md](./edit-live-tenant-offer.md)).
24
+
25
+ ```bash
26
+ # The action must exist or be created in the same call (--label and --tasks when new).
27
+ plexus-cli offer workflow node optional-action set --dir <dir> --node <decision> --key tasterDay \
28
+ --when "\$env.stage.key == 'early-years-3'"
29
+
30
+ # Offer it to everyone again
31
+ plexus-cli offer workflow node optional-action set --dir <dir> --node <decision> --key tasterDay \
32
+ --clear-when
33
+
34
+ plexus-cli offer validate --dir <dir>
35
+ ```
36
+
37
+ In the workflow IDE: node → „Optionale Aktionen" → „Nur anbieten, wenn".
38
+
39
+ ## What publish refuses
40
+
41
+ | Code | Meaning |
42
+ |---|---|
43
+ | `[optionalAction/when]` with `condition/*` | The checker refuses it: unreadable, not yes/no, an unknown leaf, a form address, a literal on an unstable leaf such as `run.key` |
44
+ | `[optionalAction/when]` with `env/unknownStageKey` | No stage of the offer's program has this key |
45
+ | `[optionalAction/when]`, „names no key of this school" | A `$env.unit.key` or `$env.offer.key` literal no row has |
46
+ | `[decision/requiresOneOfConditional]` | The decision rule names this action |
47
+
48
+ A press that arrives anyway while the condition is false is refused with
49
+ `[optionalAction/conditionFalse]`.
50
+
51
+ ## Verify
52
+
53
+ 1. Two test applications, one for the stage and one for another.
54
+ 2. Cockpit, on the decision node: „Weiteres" lists the entry only on the first one.
55
+ 3. Press it there: its tasks appear. Change the stage: the entry goes, the task stays.
56
+
57
+ Test tenant: Grundschule, „Einschulung klären" on the Freigabe (offered only for Klassenstufe 1).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartkomm/plexus-cli",
3
- "version": "0.1.120",
3
+ "version": "0.1.121",
4
4
  "description": "Unified Plexus admin + admission-offer config CLI (Convex backend).",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",