@beehexa/hexasync-ai-toolkit 2611.8.2 → 2611.14.1
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/mcp.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/.mcp.json +1 -1
- package/README.md +27 -8
- package/dist/cli.js +7 -3
- package/gemini-extension.json +2 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -2
- package/plugin.json +1 -1
- package/skills/hexasync-connections/SKILL.md +20 -8
- package/skills/hexasync-connections/references/INDEX.md +18 -0
- package/skills/hexasync-connections/references/INSTALL.md +22 -6
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.expressions-and-tooling.md +35 -0
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.fail.md +48 -0
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.frontend-step-fields.md +83 -0
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.grouped-readiness-flows.md +54 -0
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.md +16 -0
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.preview-and-source-navigation.md +26 -0
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.publish_event.md +44 -0
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.records_form.file-import-path.md +208 -0
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.records_form.md +42 -0
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.records_form.records_form-change-set-path.md +208 -0
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.rejected-forms-non-copyable.md +23 -0
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.return.md +84 -0
- package/skills/hexasync-connections/references/frontend.FRONTEND-FLOWS.task-and-reference-data-changes.md +92 -0
- package/skills/hexasync-error-handling/SKILL.md +9 -7
- package/skills/hexasync-error-handling/references/INSTALL.md +22 -6
- package/skills/hexasync-expressions/SKILL.md +21 -9
- package/skills/hexasync-expressions/references/INDEX.md +18 -0
- package/skills/hexasync-expressions/references/INSTALL.md +22 -6
- package/skills/hexasync-expressions/references/expressions.CONTEXT-AND-IO.md +1 -1
- package/skills/hexasync-expressions/references/expressions.CONTEXT-AND-IO.quick-reference-the-three-expression-dialects.md +1 -1
- package/skills/hexasync-expressions/references/expressions.CONTEXT-AND-IO.runtime-scope.md +20 -1
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.expressions-and-tooling.md +35 -0
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.fail.md +48 -0
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.frontend-step-fields.md +83 -0
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.grouped-readiness-flows.md +54 -0
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.md +16 -0
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.preview-and-source-navigation.md +26 -0
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.publish_event.md +44 -0
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.records_form.file-import-path.md +208 -0
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.records_form.md +42 -0
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.records_form.records_form-change-set-path.md +208 -0
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.rejected-forms-non-copyable.md +23 -0
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.return.md +84 -0
- package/skills/hexasync-expressions/references/frontend.FRONTEND-FLOWS.task-and-reference-data-changes.md +92 -0
- package/skills/hexasync-field-mapping/SKILL.md +10 -9
- package/skills/hexasync-field-mapping/references/INSTALL.md +22 -6
- package/skills/hexasync-metrics-reports/SKILL.md +9 -7
- package/skills/hexasync-metrics-reports/references/INSTALL.md +22 -6
- package/skills/hexasync-pullers/SKILL.md +9 -7
- package/skills/hexasync-pullers/references/INSTALL.md +22 -6
- package/skills/hexasync-pushers/SKILL.md +10 -10
- package/skills/hexasync-pushers/references/INSTALL.md +22 -6
- package/skills/hexasync-pushers/references/steps.UPDATE_ITEM_SYNC_PROCESS.md +35 -8
- package/skills/hexasync-query-dsl/SKILL.md +10 -10
- package/skills/hexasync-query-dsl/references/INDEX.md +1 -1
- package/skills/hexasync-query-dsl/references/INSTALL.md +22 -6
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.filter-dsl-language-contract.filter-request-envelope.md +16 -8
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.filter-dsl-language-contract.md +1 -1
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.the-shape.query-envelope.md +1 -1
- package/skills/hexasync-query-dsl/references/query-dsl.QUERY-DSL.troubleshooting-and-canonical-references.md +1 -1
- package/skills/hexasync-startup-tasks-scheduling/SKILL.md +9 -7
- package/skills/hexasync-startup-tasks-scheduling/references/INSTALL.md +22 -6
- package/skills/hexasync-steps-api-http/SKILL.md +22 -17
- package/skills/hexasync-steps-api-http/references/INDEX.md +18 -0
- package/skills/hexasync-steps-api-http/references/INSTALL.md +22 -6
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.expressions-and-tooling.md +35 -0
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.fail.md +48 -0
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.frontend-step-fields.md +83 -0
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.grouped-readiness-flows.md +54 -0
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.md +16 -0
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.preview-and-source-navigation.md +26 -0
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.publish_event.md +44 -0
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.records_form.file-import-path.md +208 -0
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.records_form.md +42 -0
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.records_form.records_form-change-set-path.md +208 -0
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.rejected-forms-non-copyable.md +23 -0
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.return.md +84 -0
- package/skills/hexasync-steps-api-http/references/frontend.FRONTEND-FLOWS.task-and-reference-data-changes.md +92 -0
- package/skills/hexasync-steps-api-http/references/steps.STEP-ENVELOPE.executor-selection-is-exact.md +6 -0
- package/skills/hexasync-steps-control-data/SKILL.md +22 -18
- package/skills/hexasync-steps-control-data/references/INDEX.md +18 -0
- package/skills/hexasync-steps-control-data/references/INSTALL.md +22 -6
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.expressions-and-tooling.md +35 -0
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.fail.md +48 -0
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.frontend-step-fields.md +83 -0
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.grouped-readiness-flows.md +54 -0
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.md +16 -0
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.preview-and-source-navigation.md +26 -0
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.publish_event.md +44 -0
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.records_form.file-import-path.md +208 -0
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.records_form.md +42 -0
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.records_form.records_form-change-set-path.md +208 -0
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.rejected-forms-non-copyable.md +23 -0
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.return.md +84 -0
- package/skills/hexasync-steps-control-data/references/frontend.FRONTEND-FLOWS.task-and-reference-data-changes.md +92 -0
- package/skills/hexasync-tables-tasks-objects/SKILL.md +9 -7
- package/skills/hexasync-tables-tasks-objects/references/INSTALL.md +22 -6
- package/skills/hexasync-templates/SKILL.md +22 -9
- package/skills/hexasync-templates/references/AI-INDEX.md +10 -7
- package/skills/hexasync-templates/references/INDEX.md +19 -0
- package/skills/hexasync-templates/references/INSTALL.md +22 -6
- package/skills/hexasync-templates/references/KB-INDEX.md +5 -0
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.frontend-steps-creationsteps-setupsteps-authorizationsteps.api--gateway_api.md +13 -2
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.frontend-steps-creationsteps-setupsteps-authorizationsteps.fail.md +76 -0
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.frontend-steps-creationsteps-setupsteps-authorizationsteps.md +6 -4
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.frontend-steps-creationsteps-setupsteps-authorizationsteps.records_form.md +205 -0
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.frontend-steps-creationsteps-setupsteps-authorizationsteps.step-envelope-fields.md +11 -9
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.getreadyflows.md +31 -0
- package/skills/hexasync-templates/references/PROFILE-ROOT.profile-root-fields-1.md +2 -1
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.expressions-and-tooling.md +35 -0
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.fail.md +48 -0
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.frontend-step-fields.md +83 -0
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.grouped-readiness-flows.md +54 -0
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.md +16 -0
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.preview-and-source-navigation.md +26 -0
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.publish_event.md +44 -0
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.records_form.file-import-path.md +208 -0
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.records_form.md +42 -0
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.records_form.records_form-change-set-path.md +208 -0
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.rejected-forms-non-copyable.md +23 -0
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.return.md +84 -0
- package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.task-and-reference-data-changes.md +92 -0
- package/skills/hexasync-transformations/SKILL.md +9 -7
- package/skills/hexasync-transformations/references/INSTALL.md +22 -6
- package/skills/hexasync-validations/SKILL.md +9 -7
- package/skills/hexasync-validations/references/INSTALL.md +22 -6
- package/skills/hexasync-webhooks/SKILL.md +9 -7
- package/skills/hexasync-webhooks/references/INSTALL.md +22 -6
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Frontend workflows
|
|
2
|
+
|
|
3
|
+
Frontend workflows guide a user through browser actions. They use `type`, `root` and `metadata`, not worker `displayType`, `rootStep` or `data`. Authoring support does not establish that a deployed dashboard supports these actions. Deploy compatible runtime and profile services before enabling grouped declarations.
|
|
4
|
+
|
|
5
|
+
This page is served as 10 separate resources. Read the one you need:
|
|
6
|
+
|
|
7
|
+
- [Grouped readiness flows](frontend.FRONTEND-FLOWS.grouped-readiness-flows.md) — getReadyFlows is the registered ordered group at the profile root.
|
|
8
|
+
- [Frontend Step fields](frontend.FRONTEND-FLOWS.frontend-step-fields.md) — The examples on this page are full root declarations; each step belongs inside its flow's steps array.
|
|
9
|
+
- [`RETURN`](frontend.FRONTEND-FLOWS.return.md) — RETURN terminates one invocation before ordinary output postprocessing or successor advancement.
|
|
10
|
+
- [`FAIL`](frontend.FRONTEND-FLOWS.fail.md) — FAIL ends the run as failed, on purpose, with a code and message you write.
|
|
11
|
+
- [`PUBLISH_EVENT`](frontend.FRONTEND-FLOWS.publish_event.md) — Frontend PUBLISH_EVENT performs one authenticated profiles-owned public event request.
|
|
12
|
+
- [Task and reference data changes](frontend.FRONTEND-FLOWS.task-and-reference-data-changes.md) — Save a form's row changes in one request and use the returned outcomes to tell the user what happened.
|
|
13
|
+
- [`RECORDS_FORM`](frontend.FRONTEND-FLOWS.records_form.md) — RECORDS_FORM lets the user add, change and remove several records in one paged table, then hands the changes to the steps after it.
|
|
14
|
+
- [Rejected forms (non-copyable)](frontend.FRONTEND-FLOWS.rejected-forms-non-copyable.md) — These counterexamples are deliberately excluded from copyable example search.
|
|
15
|
+
- [Preview and source navigation](frontend.FRONTEND-FLOWS.preview-and-source-navigation.md) — Grouped declarations use the existing project/external/partial composition pipeline.
|
|
16
|
+
- [Expressions and tooling](frontend.FRONTEND-FLOWS.expressions-and-tooling.md) — Frontend position is frontend-step.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
> Part of [Frontend workflows](frontend.FRONTEND-FLOWS.md).
|
|
2
|
+
|
|
3
|
+
## Preview and source navigation
|
|
4
|
+
|
|
5
|
+
Grouped declarations use the existing project/external/partial composition pipeline. A group may exist only in a split YAML file; preview resolves the effective project, not only the literal `main.yaml`. Keyed overrides update an inherited flow or step in place; they do not reorder it or erase untouched envelope fields. The effective owning-level array controls display order.
|
|
6
|
+
|
|
7
|
+
Each `getReadyFlows` entry is a separate frontend graph with its authored title. Identity uses the flow key and step key, never title or array index. Equal step keys in different flows cannot form an edge or share a click target. RETURN is terminal and displays its declared SUCCESS, FAILED or CANCELLED status; FAIL is terminal and displays as FAIL; an anonymous END is not a successful RETURN. Dynamic route destinations remain uncertain.
|
|
8
|
+
|
|
9
|
+
Missing, null or blank successors, omitted conditional arms, omitted SWITCH defaults and a blank `onCancelled` are `MISSING_RETURN` boundaries in grouped graphs, located at the nearest authored field; validation rejects them on every step, reachable or not, as dashboard admission does. Legacy direct arrays retain their implicit END behavior. Only a Liquid tag (`{{ … }}`, `{% … %}`) or a `jsonata::` prefix makes a destination dynamic: it remains uncertain with its dialect preserved, and previews never evaluate it or invent a target. Any other text — including `liquid::DONE` or `${inputs.target}` — is rendered literally at runtime, so it is a literal key matched exactly and a missing one is reported (`FFE-5`).
|
|
10
|
+
|
|
11
|
+
An `API` or `GATEWAY_API` step's controlled failure follows its plain `next`, so in a grouped flow a literal `next` straight into a SUCCESS RETURN is rejected (`FFE-13`, the same rule the dashboard applies at admission). Classify the result first with an `IF` step or a NextBranch `{if, then, else}`; a FAILED RETURN, a FAIL step, an intermediate step or a templated `next` is allowed.
|
|
12
|
+
|
|
13
|
+
Handle a failed request before reporting success. `FFE-14` (medium) warns when a grouped `API` or `GATEWAY_API` has no possible recovery route: a `failed` arm, a result read in its own `next`, or a reachable step that can read `outputs.<KEY>`. Analysis follows every route, including cancellation, IF/SWITCH arms and possible dynamic destinations; it does not prove which branch will run. A step already reported by `FFE-13` is not reported again.
|
|
14
|
+
|
|
15
|
+
A possible reader is not proof that the error was handled. The runtime keeps the failed request pending until an actual workflow expression reads that same run's result; it cannot save a successful completion while that failure remains unread. Comments, regular-expression text, quoted prose, unused functions, untaken branches and diagnostic preparation do not count as recovery. Read and classify the result where you recover, or end the run failed.
|
|
16
|
+
|
|
17
|
+
Field grammar matters: use Liquid `outputs["KEY"]` or JSONata dot/backtick paths, not JSONata's namespace predicate `outputs["KEY"]`. Raw response-only output projections and `RECORDS_FORM.search.items` read response data, not workflow results. Whole `${…}` control expressions belong only to IF conditions and SWITCH expressions; generic text stays literal. `PUBLISH_EVENT` never routes on failure and is not checked by this advisory.
|
|
18
|
+
|
|
19
|
+
Staged Liquid/JSONata recovery references are parsed one structural candidate at a time, without executing either language. Exact literal emission and known non-emission preserve syntax and lexical focus; opaque emitted syntax cannot certify a recovery reader, and shadowed `$$` does not identify the workflow root. This does not infer binding values or certify arbitrary generated programs. Correlated structural fragments can require exponential total work; editor and MCP validation yield between candidates and cancel superseded requests. Cancellation means validation is incomplete, never that a template is valid or has no findings.
|
|
20
|
+
|
|
21
|
+
Duplicate flow keys decline every matching envelope, including malformed ones, rather than merging their nodes or choosing an occurrence. Both preview surfaces and Markdown output expose located `DUPLICATE_FRONTEND_FLOW_KEY` diagnostics. Unrelated valid scopes remain drawable.
|
|
22
|
+
|
|
23
|
+
Selected-flow previews admit the complete effective root before narrowing to a key, so an indexed duplicate cannot hide another envelope. Present but malformed groups, missing/invalid keys and non-array or empty executable step lists expose located admission diagnostics instead of masquerading as an unconfigured project. An omitted group is unconfigured; `[]` explicitly configures an empty, ready group. Neither group state contributes executable nodes.
|
|
24
|
+
|
|
25
|
+
Use **HexaSync IDE: Preview Creation Steps** on the project manifest (the existing command also previews grouped flows), or the existing component preview for a selected flow. Source clicks resolve the exact contributed field from the prefetched source snapshot: an inherited step may open one file while an overridden branch opens another. Ambiguous or unavailable source locations are reported; there is no first-matching-key fallback. These are frontend execution previews, not the worker component dependency graph.
|
|
26
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
> Part of [Frontend workflows](frontend.FRONTEND-FLOWS.md).
|
|
2
|
+
|
|
3
|
+
## `PUBLISH_EVENT`
|
|
4
|
+
|
|
5
|
+
Frontend PUBLISH_EVENT performs one authenticated profiles-owned public event request. Metadata is closed: exactly `eventName` and `payload`. It cannot select URL, HTTP method, profile, producer/source, destination, connection, headers or credentials. Server authorization and a supported published binding remain runtime prerequisites; arbitrary names do not grant event authority.
|
|
6
|
+
|
|
7
|
+
| Syntax | Meaning | Default and choice |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `eventName: PUBLIC_ACTION_REQUESTED` | Public event name after mapping. | Required string, nonempty after runtime mapping; no default. |
|
|
10
|
+
| `payload: {request: review}` | JSON-object public payload, recursively mapped. | Required object; no default. Only the selected profiles-owned event contract determines allowed payload fields. |
|
|
11
|
+
|
|
12
|
+
A grouped `PUBLISH_EVENT` step cannot set `dryRun: true` (or `"true"`): a dry run never reaches router acceptance, so the step could never succeed, and admission rejects it (`FFE-7`).
|
|
13
|
+
|
|
14
|
+
The following is a generic declaration example, not a supported live event registration or send demonstration:
|
|
15
|
+
|
|
16
|
+
```yaml
|
|
17
|
+
getReadyFlows:
|
|
18
|
+
- key: REQUEST_ACTION
|
|
19
|
+
title: Request an authorized action
|
|
20
|
+
action: { label: Request }
|
|
21
|
+
completionVersion: "1"
|
|
22
|
+
steps:
|
|
23
|
+
- key: PUBLISH
|
|
24
|
+
type: PUBLISH_EVENT
|
|
25
|
+
root: true
|
|
26
|
+
metadata:
|
|
27
|
+
eventName: PUBLIC_ACTION_REQUESTED
|
|
28
|
+
payload: { request: review }
|
|
29
|
+
next: DONE
|
|
30
|
+
- key: DONE
|
|
31
|
+
type: RETURN
|
|
32
|
+
metadata:
|
|
33
|
+
status: SUCCESS
|
|
34
|
+
outputs:
|
|
35
|
+
event_id: "{{ outputs.PUBLISH.eventId }}"
|
|
36
|
+
publish_status: "{{ outputs.PUBLISH.publishStatus }}"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Only HTTP 202 with a valid acceptance body exposes `outputs.PUBLISH.eventId`, `.eventName`, `.publishStatus` (`router_accepted`) and `._response` through the existing API envelope. This proves router acceptance, not worker/provider execution, delivery or user receipt. Non-2xx, malformed acceptance and network uncertainty fail the step and the run: unlike `API`, a failed PUBLISH_EVENT follows no `next` (plain or conditional recovery route) and exposes no invented success. Aborting before the request is sent cancels; aborting after it is sent fails with `ACTION_OUTCOME_UNKNOWN`, because the event may already be accepted. Never automatically retry a possibly accepted publication; explicit rerun can duplicate external effects.
|
|
40
|
+
|
|
41
|
+
Required support before enabling declarations: a compatible grouped frontend runtime and profile-progress service; profiles-owned public event admission with PROFILE UPDATE authorization; and an unambiguous authorized binding in the published definition plus its existing transport/consumer. The example name/payload above are placeholders for an approved public contract, not a registration. Browser metadata cannot provision any prerequisite.
|
|
42
|
+
|
|
43
|
+
Router acceptance, downstream provider acceptance, delivery and user receipt are separate observations. This unit action never waits for a provider or asks for receipt. A flow needing affirmative receipt must author a separate user-confirmation step and make successful RETURN conditional on that evidence. No durable deduplication, exactly-once delivery, implicit retry or synchronous downstream status is promised.
|
|
44
|
+
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
> Part of [Frontend workflows](frontend.FRONTEND-FLOWS.md) › [RECORDS_FORM](frontend.FRONTEND-FLOWS.records_form.md).
|
|
2
|
+
|
|
3
|
+
### File-import path
|
|
4
|
+
|
|
5
|
+
The existing example below is the **file-import path**, retained for callers using the original full-row import contract. It is also the compatible path before the new worker.proxy capability is deployed. Its status mapping and read-back belong to that import contract; they are unnecessary on the changes route.
|
|
6
|
+
|
|
7
|
+
**Remove means disable, never delete.** Map `removes` to the target's disable representation in your import step:
|
|
8
|
+
|
|
9
|
+
- **TASK target** — send upserts with `__status: 1` and removes with `__status: 3` (Removed|Changed, enabling the apply pusher to re-evaluate an already-applied override) in ONE `POST /proxy/workers/api/tasks/<taskId>/data/import/data?r=false` call. Set `__status` explicitly on every row: a REFERENCE task imports a missing or blank status as Removed. Rows must be full because the import requires every table column and rejects unknown ones; with `allow.add`, declare every table column (readonly where users must not edit it), because added rows carry only declared columns. Loaded rows also carry system keys (`__id`, `__hashed_keys`, …) that the import does not accept, and the import takes its columns from the first row, so send one uniform key set: every non-`__` column, `__status`, and `__destination_id` only when every row carries it; drop the other `__` keys. The import also needs a change note (`notes`): the dashboard's own import asks for at least 32 characters and a super-admin account is refused below 256, so ask the user for a real reason rather than sending fixed text. Then read back with `__status not_hbw 6` (active rows only): every upserted identity must be present with the intended values and every removed identity absent, matched on every identity key; otherwise the outcome is unverified, never success, and is never resent automatically.
|
|
10
|
+
- **Never** use `r=true` (it disables every row missing from the payload), a physical delete or `…/data/statuses` (an empty item list applies to every row).
|
|
11
|
+
- **WORKER_SETTINGS target** — persist with the existing `PUT …/worker-settings/` call carrying `{values: {…}}`. Worker settings have no disable status, so keep `allow.remove` false unless your `PUT` step defines what removing a setting means.
|
|
12
|
+
|
|
13
|
+
**Quoting and limits.** Values the user types can contain an apostrophe, which would end a single-quoted `--data '…'` body and make the request unreadable. Render JSON inside such a body as `{{ value | json | replace: "'", "\\u0027" }}`: `json` makes a JSON value and the replace turns each apostrophe into the JSON escape `\u0027`. A search request returns at most its `limit` rows: size the initial read above the largest table you expect, because rows that are not loaded cannot be edited or removed, and adding an identity that exists beyond the limit overwrites that row. A read-back can only confirm as many rows as its `limit`, so a save touching more identities than that is unverified.
|
|
14
|
+
|
|
15
|
+
The following is a complete generic declaration: the tasks and tables the form edits and searches, then the flow.
|
|
16
|
+
|
|
17
|
+
```yaml
|
|
18
|
+
objects:
|
|
19
|
+
- id: "**Example_Records_Task_Id**"
|
|
20
|
+
name: Example records
|
|
21
|
+
type: REFERENCE
|
|
22
|
+
priority: 1000
|
|
23
|
+
description: "!md[./tasks/example-records.md]"
|
|
24
|
+
valueTableName: __hsm_example_records
|
|
25
|
+
ignoreRemoval: true
|
|
26
|
+
ignoreChange: false
|
|
27
|
+
- id: "**Example_Catalog_Task_Id**"
|
|
28
|
+
name: Example catalog
|
|
29
|
+
type: REFERENCE
|
|
30
|
+
priority: 1000
|
|
31
|
+
description: "!md[./tasks/example-catalog.md]"
|
|
32
|
+
valueTableName: __hsm_example_catalog
|
|
33
|
+
ignoreRemoval: true
|
|
34
|
+
ignoreChange: false
|
|
35
|
+
objectAssociations:
|
|
36
|
+
"**Example_Records_Task_Id**":
|
|
37
|
+
table: { id: "**Example_Records_Table_Id**" }
|
|
38
|
+
"**Example_Catalog_Task_Id**":
|
|
39
|
+
table: { id: "**Example_Catalog_Table_Id**" }
|
|
40
|
+
tables:
|
|
41
|
+
- id: "**Example_Records_Table_Id**"
|
|
42
|
+
columns:
|
|
43
|
+
code: { name: Code }
|
|
44
|
+
name: { name: Name }
|
|
45
|
+
quantity: { name: Quantity, dataType: Numeric }
|
|
46
|
+
note: { name: Note }
|
|
47
|
+
- id: "**Example_Catalog_Table_Id**"
|
|
48
|
+
columns:
|
|
49
|
+
code: { name: Code }
|
|
50
|
+
name: { name: Name }
|
|
51
|
+
getReadyFlows:
|
|
52
|
+
- key: EDIT_RECORDS
|
|
53
|
+
title: Edit records
|
|
54
|
+
action: { label: Edit records }
|
|
55
|
+
completionVersion: "1"
|
|
56
|
+
steps:
|
|
57
|
+
- key: READ_RECORDS
|
|
58
|
+
type: API
|
|
59
|
+
root: true
|
|
60
|
+
name: Read the current records
|
|
61
|
+
metadata: |-
|
|
62
|
+
curl --location '/proxy/workers/api/tasks/**Example_Records_Task_Id**/data/search' --request POST \
|
|
63
|
+
--header 'HSS-PROFILE-ID: {{ inputs.PROFILE_ID }}' \
|
|
64
|
+
--header 'Content-Type: application/json' \
|
|
65
|
+
--data '{"fields":[],"offset":0,"limit":500,"filters":{"condition":"AND","rightOp":[{"leftOp":"__status","condition":"not_hbw","rightOp":6}]}}'
|
|
66
|
+
next: EDIT
|
|
67
|
+
- key: EDIT
|
|
68
|
+
type: RECORDS_FORM
|
|
69
|
+
name: Edit records
|
|
70
|
+
description: Add, change or remove records. Nothing is saved until you confirm.
|
|
71
|
+
metadata:
|
|
72
|
+
target: { kind: TASK, taskId: "**Example_Records_Task_Id**" }
|
|
73
|
+
identity: [code]
|
|
74
|
+
initial: "jsonata:: outputs.READ_RECORDS.items"
|
|
75
|
+
columns:
|
|
76
|
+
- { key: code, name: Code, type: TEXT, required: true, readonly: true }
|
|
77
|
+
- { key: name, name: Name, type: TEXT, required: true }
|
|
78
|
+
- { key: quantity, name: Quantity, type: NUMBER, min: 0 }
|
|
79
|
+
- { key: note, name: Note, type: MULTILINE_TEXT }
|
|
80
|
+
allow: { add: true, edit: true, remove: true }
|
|
81
|
+
pageSize: 20
|
|
82
|
+
search:
|
|
83
|
+
request: |-
|
|
84
|
+
curl --location '/proxy/workers/api/tasks/**Example_Catalog_Task_Id**/data/search' --request POST \
|
|
85
|
+
--header 'HSS-PROFILE-ID: {{ inputs.PROFILE_ID }}' \
|
|
86
|
+
--header 'Content-Type: application/json' \
|
|
87
|
+
--data '{"fields":[],"offset":0,"limit":20,"filters":{"condition":"AND","rightOp":[{"leftOp":"__status","condition":"not_hbw","rightOp":6},{"leftOp":"code","condition":"ct","rightOp":{{ search.text | json | replace: "'", "\\u0027" }}}]}}'
|
|
88
|
+
items: "jsonata:: items"
|
|
89
|
+
label: "{{ item.code }} — {{ item.name }}"
|
|
90
|
+
fill: { code: "{{ item.code }}", name: "{{ item.name }}" }
|
|
91
|
+
next: BUILD_IMPORT
|
|
92
|
+
onCancelled: CANCELLED
|
|
93
|
+
- key: BUILD_IMPORT
|
|
94
|
+
type: JSONATA
|
|
95
|
+
metadata:
|
|
96
|
+
expression: |-
|
|
97
|
+
(
|
|
98
|
+
$rows := [
|
|
99
|
+
outputs.EDIT.upserts.$merge([$, {"__status": 1}]),
|
|
100
|
+
outputs.EDIT.removes.$merge([$, {"__status": 3}])
|
|
101
|
+
];
|
|
102
|
+
$keepDestination := $count($rows) > 0 and $count($rows[$exists(__destination_id)]) = $count($rows);
|
|
103
|
+
{
|
|
104
|
+
"hasChanges": $count($rows) > 0,
|
|
105
|
+
"identities": [outputs.EDIT.upserts.code, outputs.EDIT.removes.code],
|
|
106
|
+
"items": [$rows.$sift(function($v, $k) {
|
|
107
|
+
$substring($k, 0, 2) != "__" or $k = "__status" or ($keepDestination and $k = "__destination_id")
|
|
108
|
+
})]
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
next: HAS_CHANGES
|
|
112
|
+
- key: HAS_CHANGES
|
|
113
|
+
type: IF
|
|
114
|
+
metadata:
|
|
115
|
+
condition: "{{ outputs.BUILD_IMPORT.hasChanges }}"
|
|
116
|
+
then: CHANGE_NOTE
|
|
117
|
+
else: NO_CHANGES
|
|
118
|
+
- key: CHANGE_NOTE
|
|
119
|
+
type: FORM
|
|
120
|
+
name: Why are you changing these records?
|
|
121
|
+
metadata:
|
|
122
|
+
fields:
|
|
123
|
+
- key: REASON
|
|
124
|
+
type: MULTILINE_TEXT
|
|
125
|
+
name: Reason for this change (kept in the import history)
|
|
126
|
+
required: true
|
|
127
|
+
next: SAVE
|
|
128
|
+
onCancelled: CANCELLED
|
|
129
|
+
- key: SAVE
|
|
130
|
+
type: API
|
|
131
|
+
name: Save the changes
|
|
132
|
+
metadata: |-
|
|
133
|
+
curl --location '/proxy/workers/api/tasks/**Example_Records_Task_Id**/data/import/data?r=false' --request POST \
|
|
134
|
+
--header 'HSS-PROFILE-ID: {{ inputs.PROFILE_ID }}' \
|
|
135
|
+
--header 'Content-Type: application/json' \
|
|
136
|
+
--data '{"notes":{{ outputs.CHANGE_NOTE.REASON | json | replace: "'", "\\u0027" }},"items":{{ outputs.BUILD_IMPORT.items | json | replace: "'", "\\u0027" }}}'
|
|
137
|
+
next: READ_BACK
|
|
138
|
+
- key: READ_BACK
|
|
139
|
+
type: API
|
|
140
|
+
name: Confirm what was saved
|
|
141
|
+
metadata: |-
|
|
142
|
+
curl --location '/proxy/workers/api/tasks/**Example_Records_Task_Id**/data/search' --request POST \
|
|
143
|
+
--header 'HSS-PROFILE-ID: {{ inputs.PROFILE_ID }}' \
|
|
144
|
+
--header 'Content-Type: application/json' \
|
|
145
|
+
--data '{"fields":[],"offset":0,"limit":500,"filters":{"condition":"AND","rightOp":[{"leftOp":"__status","condition":"not_hbw","rightOp":6},{"leftOp":"code","condition":"in","rightOp":{{ outputs.BUILD_IMPORT.identities | json | replace: "'", "\\u0027" }}}]}}'
|
|
146
|
+
next: VERIFY
|
|
147
|
+
- key: VERIFY
|
|
148
|
+
type: JSONATA
|
|
149
|
+
metadata:
|
|
150
|
+
expression: |-
|
|
151
|
+
(
|
|
152
|
+
$saved := [outputs.READ_BACK.items];
|
|
153
|
+
$removed := [outputs.EDIT.removes.code];
|
|
154
|
+
$columns := ["code", "name", "quantity", "note"];
|
|
155
|
+
$text := function($v) { $exists($v) and $v != null ? $string($v) : "" };
|
|
156
|
+
$isSaved := function($row) { (
|
|
157
|
+
$found := $saved[code = $row.code][0];
|
|
158
|
+
$exists($found) and $count($columns[$text($lookup($found, $)) != $text($lookup($row, $))]) = 0
|
|
159
|
+
) };
|
|
160
|
+
{
|
|
161
|
+
"verified": outputs.SAVE._response.statusCode >= 200 and outputs.SAVE._response.statusCode < 300
|
|
162
|
+
and outputs.READ_BACK._response.statusCode = 200
|
|
163
|
+
and $count([outputs.BUILD_IMPORT.identities]) <= 500
|
|
164
|
+
and $count([outputs.EDIT.upserts][$not($isSaved($))]) = 0
|
|
165
|
+
and $count($saved[code in $removed]) = 0
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
next: CHECK_SAVED
|
|
169
|
+
- key: CHECK_SAVED
|
|
170
|
+
type: IF
|
|
171
|
+
metadata:
|
|
172
|
+
condition: "{{ outputs.VERIFY.verified }}"
|
|
173
|
+
then: SHOW_SAVED
|
|
174
|
+
else: SHOW_UNVERIFIED
|
|
175
|
+
- key: SHOW_SAVED
|
|
176
|
+
type: SHOW_INFO
|
|
177
|
+
msg: Your changes are saved.
|
|
178
|
+
metadata: { type: SUCCESS, button_title: Finish }
|
|
179
|
+
next: DONE
|
|
180
|
+
- key: SHOW_UNVERIFIED
|
|
181
|
+
type: SHOW_INFO
|
|
182
|
+
msg: The save could not be confirmed. Reopen the records and check them before trying again.
|
|
183
|
+
metadata: { type: WARNING, button_title: Close }
|
|
184
|
+
next: UNVERIFIED
|
|
185
|
+
- key: DONE
|
|
186
|
+
type: RETURN
|
|
187
|
+
metadata:
|
|
188
|
+
status: SUCCESS
|
|
189
|
+
outputs:
|
|
190
|
+
upserted: "jsonata:: $count(outputs.EDIT.upserts)"
|
|
191
|
+
removed: "jsonata:: $count(outputs.EDIT.removes)"
|
|
192
|
+
- key: NO_CHANGES
|
|
193
|
+
type: RETURN
|
|
194
|
+
metadata:
|
|
195
|
+
status: SUCCESS
|
|
196
|
+
outputs: { upserted: 0, removed: 0 }
|
|
197
|
+
- key: UNVERIFIED
|
|
198
|
+
type: RETURN
|
|
199
|
+
metadata:
|
|
200
|
+
status: FAILED
|
|
201
|
+
error: { code: SAVE_UNVERIFIED, message: The saved records could not be confirmed }
|
|
202
|
+
- key: CANCELLED
|
|
203
|
+
type: RETURN
|
|
204
|
+
metadata: { status: CANCELLED }
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The JSONATA step after the form is where removes become disables: it is the only place `__status` is set, other system keys are dropped, and the single import carries both lists. A failed import or read-back is an `API` controlled failure: it follows the plain `next` like a success, so the read-back still runs and `VERIFY` classifies the outcome — success needs a 2xx import, a 200 read-back and every intended row confirmed. Anything else ends in the FAILED RETURN; nothing is resent automatically, because a lost response does not prove the rows were not saved.
|
|
208
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
> Part of [Frontend workflows](frontend.FRONTEND-FLOWS.md).
|
|
2
|
+
|
|
3
|
+
## `RECORDS_FORM`
|
|
4
|
+
|
|
5
|
+
RECORDS_FORM lets the user add, change and remove several records in one paged table, then hands the changes to the steps after it. It is a pause step like FORM. **It never writes anything**: save with an explicit `API` step, then check the returned outcomes. Use the [changes route](frontend.FRONTEND-FLOWS.task-and-reference-data-changes.md#changes-apply-a-row-change-set) after its worker.proxy deployment; the file-import example below remains available.
|
|
6
|
+
|
|
7
|
+
```mermaid
|
|
8
|
+
flowchart LR
|
|
9
|
+
READ[API: read rows] --> EDIT[RECORDS_FORM: edit] --> HAS{IF: any changes?}
|
|
10
|
+
HAS -- no --> NONE[RETURN SUCCESS]
|
|
11
|
+
HAS -- yes --> NOTE[FORM: change note] --> SAVE[API: changes] --> SAVED{IF: check returned outcomes}
|
|
12
|
+
SAVED -- yes --> OK[SHOW_INFO + RETURN SUCCESS]
|
|
13
|
+
SAVED -- no --> KO[SHOW_INFO + RETURN FAILED]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
| Syntax | Meaning | Default and choice |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| `target: {kind: TASK, taskId: "**Records_Task_Id**"}` | Where the rows belong: a task table (`TASK` + `taskId`, a UUID or `**Variable**`) or worker settings (`WORKER_SETTINGS`, no `taskId`). Declarative only. | Required; no default. Only `TASK` and `WORKER_SETTINGS`. Validation checks a TASK target's table (FFE-12). |
|
|
19
|
+
| `identity: [code]` | Column keys that identify a row: blocks duplicates, matches edits, reports removes. | Required, at least one key; each must be a `columns[].key`. Loaded identity values cannot be edited. |
|
|
20
|
+
| `initial: "jsonata:: outputs.READ_ROWS.items"` | Rows shown at start: an array of objects, or a Liquid / `jsonata::` expression of this workflow returning one. | Optional; absent means an empty table. A non-array or non-object row fails the step. |
|
|
21
|
+
| `columns: [{key, name, type, required?, readonly?, min?}]` | Hand-written editable columns. `type` is `TEXT`, `NUMBER` or `MULTILINE_TEXT`; `min` only on `NUMBER`. | Required, at least one; each `key` once. `required`/`readonly` default to false. Never generated from table metadata; keys must exist in the TASK table. |
|
|
22
|
+
| `allow: {add: true, edit: true, remove: true}` | Which changes the user may make. | Optional; absent means `{add: false, edit: true, remove: false}`; each omitted member keeps its own default. |
|
|
23
|
+
| `pageSize: 20` | Rows per table page. | Optional integer ≥ 1; defaults to 20. |
|
|
24
|
+
| `search: {request, items, label, fill}` | Optional entity search adding one row per selection. `request` is a Liquid cURL with `{{ search.text }}`; `items` is a `jsonata::` expression over the response only (shaped like an `API` result: body members plus `_response`); `label` and `fill` render with `{{ item }}`. | Optional; absent means no search. When present all four are required and `fill` maps at least one column key to a Liquid value. `fill` keys must be columns. Needs `allow.add: true`; with search, new rows come only from a selection. |
|
|
25
|
+
|
|
26
|
+
`search.text` exists only inside `search.request`, and `item` only inside `search.label` and `search.fill`. `search.items` sees only the search response, never `inputs`/`outputs`. `fill` also sees this workflow's context, so it can copy a value chosen in an earlier step. A failed search shows inline and is never retried automatically.
|
|
27
|
+
|
|
28
|
+
**Rows the user adds** carry only the declared columns and the `search.fill` values. A `readonly` cell takes its value only from `initial` or `search.fill`, so with `allow.add` a readonly column that is required or part of `identity` must be a `fill` key — otherwise an added row can never be submitted. Validation (FFE-12) reports both, plus a TASK table column an added row would lack.
|
|
29
|
+
|
|
30
|
+
**Output.** On submit the step stores, without spreading, `outputs.<KEY> = {rows, upserts, removes, unchanged}`:
|
|
31
|
+
|
|
32
|
+
- `rows` — the final active rows.
|
|
33
|
+
- `upserts` — added rows and changed loaded rows, as **full rows**: every declared column plus every key from `initial` that is not a column (including system keys such as `__status`), kept verbatim.
|
|
34
|
+
- `removes` — removed loaded rows, **full and unmodified**, identity unchanged.
|
|
35
|
+
- `unchanged` — the count of loaded rows neither changed nor removed. Editing a value back to its original leaves the row unchanged.
|
|
36
|
+
|
|
37
|
+
An identity never appears in both `upserts` and `removes`: re-adding a removed identity restores the loaded row. Cancel follows `onCancelled` and stores no output. Completion exposes only these four members; RECORDS_FORM does not apply output post-processors, and row members are not inferred.
|
|
38
|
+
|
|
39
|
+
This section is served as 2 separate resources. Read the one you need:
|
|
40
|
+
|
|
41
|
+
- [`RECORDS_FORM` change-set path](frontend.FRONTEND-FLOWS.records_form.records_form-change-set-path.md) — This complete generic declaration uses the deployed changes capability: RECORDS_FORM → one changes API step → one outcome check.
|
|
42
|
+
- [File-import path](frontend.FRONTEND-FLOWS.records_form.file-import-path.md) — The existing example below is the file-import path, retained for callers using the original full-row import contract.
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
> Part of [Frontend workflows](frontend.FRONTEND-FLOWS.md) › [RECORDS_FORM](frontend.FRONTEND-FLOWS.records_form.md).
|
|
2
|
+
|
|
3
|
+
### `RECORDS_FORM` change-set path
|
|
4
|
+
|
|
5
|
+
This complete generic declaration uses the deployed [changes capability](frontend.FRONTEND-FLOWS.task-and-reference-data-changes.md#availability-of-the-data-routes): `RECORDS_FORM` → one changes API step → one outcome check. It keeps the form's rows intact, sends no status numbers, and performs no verification read. Its TASK table declares `code` as the stored key, matching the form identity. The host supplies `inputs.PROFILE_ID`; the example identities stand for real published tasks/tables.
|
|
6
|
+
|
|
7
|
+
The check treats a disable `notFound` as already absent, which satisfies this example's remove action. A different business action may require reporting it instead. Initial and search reads still use the existing search route: load all rows the user needs (here at most 500) before editing, because unloaded rows cannot be removed in this form. The change set itself is limited to 5,000 rows.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
objects:
|
|
11
|
+
- id: "**Example_Records_Task_Id**"
|
|
12
|
+
name: Example records
|
|
13
|
+
type: REFERENCE
|
|
14
|
+
priority: 1000
|
|
15
|
+
description: "!md[./tasks/example-records.md]"
|
|
16
|
+
valueTableName: __hsm_example_records
|
|
17
|
+
ignoreRemoval: true
|
|
18
|
+
ignoreChange: false
|
|
19
|
+
- id: "**Example_Catalog_Task_Id**"
|
|
20
|
+
name: Example catalog
|
|
21
|
+
type: REFERENCE
|
|
22
|
+
priority: 1000
|
|
23
|
+
description: "!md[./tasks/example-catalog.md]"
|
|
24
|
+
valueTableName: __hsm_example_catalog
|
|
25
|
+
ignoreRemoval: true
|
|
26
|
+
ignoreChange: false
|
|
27
|
+
objectAssociations:
|
|
28
|
+
"**Example_Records_Task_Id**":
|
|
29
|
+
table: { id: "**Example_Records_Table_Id**" }
|
|
30
|
+
"**Example_Catalog_Task_Id**":
|
|
31
|
+
table: { id: "**Example_Catalog_Table_Id**" }
|
|
32
|
+
tables:
|
|
33
|
+
- id: "**Example_Records_Table_Id**"
|
|
34
|
+
columns:
|
|
35
|
+
code: { name: Code, indexGroups: [SOURCE_ID, KEYS] }
|
|
36
|
+
name: { name: Name }
|
|
37
|
+
quantity: { name: Quantity, dataType: Numeric }
|
|
38
|
+
note: { name: Note }
|
|
39
|
+
- id: "**Example_Catalog_Table_Id**"
|
|
40
|
+
columns:
|
|
41
|
+
code: { name: Code, indexGroups: [SOURCE_ID, KEYS] }
|
|
42
|
+
name: { name: Name }
|
|
43
|
+
getReadyFlows:
|
|
44
|
+
- key: EDIT_RECORDS_CHANGES
|
|
45
|
+
title: Edit records
|
|
46
|
+
action: { label: Edit records }
|
|
47
|
+
completionVersion: "1"
|
|
48
|
+
steps:
|
|
49
|
+
- key: READ_RECORDS
|
|
50
|
+
type: API
|
|
51
|
+
root: true
|
|
52
|
+
name: Read the current records
|
|
53
|
+
metadata: |-
|
|
54
|
+
curl --location '/proxy/workers/api/tasks/**Example_Records_Task_Id**/data/search' --request POST \
|
|
55
|
+
--header 'HSS-PROFILE-ID: {{ inputs.PROFILE_ID }}' \
|
|
56
|
+
--header 'Content-Type: application/json' \
|
|
57
|
+
--data '{"fields":[],"offset":0,"limit":500,"filters":{"condition":"AND","rightOp":[{"leftOp":"__status","condition":"not_hbw","rightOp":6}]}}'
|
|
58
|
+
next: EDIT
|
|
59
|
+
- key: EDIT
|
|
60
|
+
type: RECORDS_FORM
|
|
61
|
+
name: Edit records
|
|
62
|
+
description: Add, change or remove records. Nothing is saved until you confirm.
|
|
63
|
+
metadata:
|
|
64
|
+
target: { kind: TASK, taskId: "**Example_Records_Task_Id**" }
|
|
65
|
+
identity: [code]
|
|
66
|
+
initial: "jsonata:: outputs.READ_RECORDS.items"
|
|
67
|
+
columns:
|
|
68
|
+
- { key: code, name: Code, type: TEXT, required: true, readonly: true }
|
|
69
|
+
- { key: name, name: Name, type: TEXT, required: true }
|
|
70
|
+
- { key: quantity, name: Quantity, type: NUMBER, min: 0 }
|
|
71
|
+
- { key: note, name: Note, type: MULTILINE_TEXT }
|
|
72
|
+
allow: { add: true, edit: true, remove: true }
|
|
73
|
+
pageSize: 20
|
|
74
|
+
search:
|
|
75
|
+
request: |-
|
|
76
|
+
curl --location '/proxy/workers/api/tasks/**Example_Catalog_Task_Id**/data/search' --request POST \
|
|
77
|
+
--header 'HSS-PROFILE-ID: {{ inputs.PROFILE_ID }}' \
|
|
78
|
+
--header 'Content-Type: application/json' \
|
|
79
|
+
--data '{"fields":[],"offset":0,"limit":20,"filters":{"condition":"AND","rightOp":[{"leftOp":"__status","condition":"not_hbw","rightOp":6},{"leftOp":"code","condition":"ct","rightOp":{{ search.text | json | replace: "'", "\\u0027" }}}]}}'
|
|
80
|
+
items: "jsonata:: items"
|
|
81
|
+
label: "{{ item.code }} — {{ item.name }}"
|
|
82
|
+
fill: { code: "{{ item.code }}", name: "{{ item.name }}" }
|
|
83
|
+
next: HAS_CHANGES
|
|
84
|
+
onCancelled: CANCELLED
|
|
85
|
+
- key: HAS_CHANGES
|
|
86
|
+
type: IF
|
|
87
|
+
metadata:
|
|
88
|
+
condition: "${ $count(outputs.EDIT.upserts) + $count(outputs.EDIT.removes) > 0 }"
|
|
89
|
+
then: CHANGE_NOTE
|
|
90
|
+
else: NO_CHANGES
|
|
91
|
+
- key: CHANGE_NOTE
|
|
92
|
+
type: FORM
|
|
93
|
+
name: Why are you changing these records?
|
|
94
|
+
metadata:
|
|
95
|
+
fields:
|
|
96
|
+
- key: REASON
|
|
97
|
+
type: MULTILINE_TEXT
|
|
98
|
+
name: Reason (at least 32 characters, or 256 for a super admin)
|
|
99
|
+
required: true
|
|
100
|
+
next: SAVE
|
|
101
|
+
onCancelled: CANCELLED
|
|
102
|
+
- key: SAVE
|
|
103
|
+
type: API
|
|
104
|
+
name: Save the changes
|
|
105
|
+
metadata: |-
|
|
106
|
+
curl --location '/proxy/workers/api/v2/tasks/**Example_Records_Task_Id**/data/changes' --request POST \
|
|
107
|
+
--header 'HSS-PROFILE-ID: {{ inputs.PROFILE_ID }}' \
|
|
108
|
+
--header 'Content-Type: application/json' \
|
|
109
|
+
--data '{"notes":{{ outputs.CHANGE_NOTE.REASON | json | replace: "'", "\\u0027" }},"changes":{"upsert":{{ outputs.EDIT.upserts | json | replace: "'", "\\u0027" }},"disable":{{ outputs.EDIT.removes | json | replace: "'", "\\u0027" }}}}'
|
|
110
|
+
next: CHECK_SAVED
|
|
111
|
+
- key: CHECK_SAVED
|
|
112
|
+
type: IF
|
|
113
|
+
metadata:
|
|
114
|
+
condition: >-
|
|
115
|
+
${ (
|
|
116
|
+
$result := outputs.SAVE;
|
|
117
|
+
$rows := $result.rows;
|
|
118
|
+
$summary := $result.summary;
|
|
119
|
+
$upsertCount := $count(outputs.EDIT.upserts);
|
|
120
|
+
$disableCount := $count(outputs.EDIT.removes);
|
|
121
|
+
$upserts := $rows[op = "upsert"];
|
|
122
|
+
$disables := $rows[op = "disable"];
|
|
123
|
+
$whole := function($value) {
|
|
124
|
+
$type($value) = "number" ? $value >= 0 and $value = $floor($value) : false
|
|
125
|
+
};
|
|
126
|
+
$stored := function($value) {
|
|
127
|
+
$type($value) = "object" and $type($value.code) = "string"
|
|
128
|
+
};
|
|
129
|
+
$result._response.statusCode = 200 and $not($exists($result.error))
|
|
130
|
+
and $not($exists($result.errorCode)) and $type($result.changeId) = "string"
|
|
131
|
+
and $length($trim($result.changeId)) > 0
|
|
132
|
+
and $type($rows) = "array" and $count($rows[$type($) != "object"]) = 0
|
|
133
|
+
and $count($rows) = $upsertCount + $disableCount
|
|
134
|
+
and $count($upserts) = $upsertCount and $count($disables) = $disableCount
|
|
135
|
+
and $count($upserts[$whole(index) and index < $upsertCount
|
|
136
|
+
and outcome in ["inserted", "updated", "unchanged"] and $stored(row)]) = $upsertCount
|
|
137
|
+
and $count($disables[$whole(index) and index < $disableCount
|
|
138
|
+
and ((outcome in ["disabled", "unchanged"] and $stored(row))
|
|
139
|
+
or (outcome = "notFound" and ($not($exists(row)) or row = null)))]) = $disableCount
|
|
140
|
+
and $count($distinct($upserts.index)) = $upsertCount
|
|
141
|
+
and $count($distinct($disables.index)) = $disableCount
|
|
142
|
+
and $type($summary) = "object"
|
|
143
|
+
and $whole($summary.inserted) and $whole($summary.updated) and $whole($summary.unchanged)
|
|
144
|
+
and $whole($summary.disabled) and $whole($summary.enabled) and $whole($summary.notFound)
|
|
145
|
+
and $whole($summary.healed) and $summary.enabled = 0
|
|
146
|
+
and $summary.inserted = $count($rows[outcome = "inserted"])
|
|
147
|
+
and $summary.updated = $count($rows[outcome = "updated"])
|
|
148
|
+
and $summary.unchanged = $count($rows[outcome = "unchanged"])
|
|
149
|
+
and $summary.disabled = $count($rows[outcome = "disabled"])
|
|
150
|
+
and $summary.notFound = $count($rows[outcome = "notFound"])
|
|
151
|
+
) }
|
|
152
|
+
then: SHOW_SAVED
|
|
153
|
+
else: SHOW_FAILED
|
|
154
|
+
- key: SHOW_SAVED
|
|
155
|
+
type: SHOW_INFO
|
|
156
|
+
msg: Your changes are saved.
|
|
157
|
+
metadata: { type: SUCCESS, button_title: Finish }
|
|
158
|
+
next: DONE
|
|
159
|
+
- key: SHOW_FAILED
|
|
160
|
+
type: SHOW_INFO
|
|
161
|
+
msg: >-
|
|
162
|
+
{%- assign problem = outputs.SAVE.error.detail.rawData -%}
|
|
163
|
+
{%- assign expected_status = 0 -%}
|
|
164
|
+
{%- assign expected_retryable = false -%}
|
|
165
|
+
{%- case problem.code -%}
|
|
166
|
+
{%- when 'INVALID_REQUEST' -%}{%- assign expected_status = 400 -%}
|
|
167
|
+
{%- when 'FORBIDDEN' -%}{%- assign expected_status = 403 -%}
|
|
168
|
+
{%- when 'ENTITY_NOT_FOUND' -%}{%- assign expected_status = 404 -%}
|
|
169
|
+
{%- when 'TASK_BUSY' -%}{%- assign expected_status = 409 -%}{%- assign expected_retryable = true -%}
|
|
170
|
+
{%- when 'IDENTITY_CONFLICT', 'KEY_AMBIGUOUS', 'IDENTITY_UNREPAIRABLE', 'IDENTITY_REPAIR_REQUIRED' -%}{%- assign expected_status = 409 -%}
|
|
171
|
+
{%- when 'NOTES_TOO_SHORT', 'UNKNOWN_COLUMN', 'KEY_MISSING', 'DUPLICATE_ROWS', 'INVALID_VALUE', 'ENTITY_NOT_WRITABLE' -%}{%- assign expected_status = 422 -%}
|
|
172
|
+
{%- when 'AUDIT_UNAVAILABLE' -%}{%- assign expected_status = 502 -%}{%- assign expected_retryable = true -%}
|
|
173
|
+
{%- endcase -%}
|
|
174
|
+
{%- assign detail_json = problem.detail | json -%}
|
|
175
|
+
{%- assign detail_marker = detail_json | slice: 0, 1 -%}
|
|
176
|
+
{%- if outputs.SAVE._response == nil and expected_status != 0 and outputs.SAVE.error.detail.status == expected_status and problem.status == expected_status and problem.retryable == expected_retryable and detail_marker == '"' and problem.detail != empty -%}
|
|
177
|
+
{{ problem.code }} — {{ problem.detail }}
|
|
178
|
+
{%- else -%}
|
|
179
|
+
SAVE_UNVERIFIED — The service could not confirm the save. The changes may have been saved. Check the dataset before running this action again. Nothing was resent automatically.
|
|
180
|
+
{%- endif -%}
|
|
181
|
+
metadata: { type: ERROR, button_title: Close }
|
|
182
|
+
next: FAILED
|
|
183
|
+
- key: DONE
|
|
184
|
+
type: RETURN
|
|
185
|
+
metadata:
|
|
186
|
+
status: SUCCESS
|
|
187
|
+
outputs:
|
|
188
|
+
changeId: "{{ outputs.SAVE.changeId }}"
|
|
189
|
+
summary: "jsonata:: outputs.SAVE.summary"
|
|
190
|
+
upserted: "jsonata:: $count(outputs.EDIT.upserts)"
|
|
191
|
+
removed: "jsonata:: $count(outputs.EDIT.removes)"
|
|
192
|
+
- key: NO_CHANGES
|
|
193
|
+
type: RETURN
|
|
194
|
+
metadata:
|
|
195
|
+
status: SUCCESS
|
|
196
|
+
outputs: { upserted: 0, removed: 0 }
|
|
197
|
+
- key: FAILED
|
|
198
|
+
type: RETURN
|
|
199
|
+
metadata:
|
|
200
|
+
status: FAILED
|
|
201
|
+
error: { code: SAVE_FAILED, message: The row changes were refused or their outcome is unknown }
|
|
202
|
+
- key: CANCELLED
|
|
203
|
+
type: RETURN
|
|
204
|
+
metadata: { status: CANCELLED }
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
A controlled API refusal follows `next` to `CHECK_SAVED`. The failure display reads the nested error problem and checks the known code/status/retryable contract before showing its code/detail. HTTP500 `INTERNAL_ERROR`, malformed or contradictory answers and network loss instead show `SAVE_UNVERIFIED`, explain that the changes may have been saved and return FAILED. The display never claims rollback for an unknown outcome. The flow never retries automatically. SUCCESS confirms the change-set outcome, not downstream engine or provider execution. A no-change submission returns SUCCESS without calling changes, which refuses an empty set. IF metadata uses its native `${ … }` JSONata form; `jsonata::` is used in ordinary mapped fields and branch `next.if`, not this IF metadata slot.
|
|
208
|
+
|
package/skills/hexasync-templates/references/frontend.FRONTEND-FLOWS.rejected-forms-non-copyable.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
> Part of [Frontend workflows](frontend.FRONTEND-FLOWS.md).
|
|
2
|
+
|
|
3
|
+
## Rejected forms (non-copyable)
|
|
4
|
+
|
|
5
|
+
These counterexamples are deliberately excluded from copyable example search. They are invalid declarations, not alternate spellings.
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
getReadyFlows:
|
|
9
|
+
- key: WRONG
|
|
10
|
+
id: not-an-alias
|
|
11
|
+
title: Invalid declaration
|
|
12
|
+
action: { label: Do not copy }
|
|
13
|
+
completionVersion: 1
|
|
14
|
+
steps:
|
|
15
|
+
- key: DONE
|
|
16
|
+
type: RETURN
|
|
17
|
+
root: "True"
|
|
18
|
+
dryRun: null
|
|
19
|
+
metadata:
|
|
20
|
+
status: SUCCESS
|
|
21
|
+
outputs: { foreign: "{{ outputs.SIBLING_ONLY.value }}" }
|
|
22
|
+
```
|
|
23
|
+
|