Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@
# to run locally, so a green machine and a green CI mean the same thing.
name: check

# The schedule is for the drift nobody here causes. Every reference check
# compares this site with cap2UI5's main, and that moves without a push to
# this repository: a plugin release, a runtime pin, a renamed file. Without
# it the site went stale in silence - eleven references, when plugin 0.5.0
# and a runtime pin had landed over there - and the next pull request here,
# whatever it was about, would have been the one to go red. Once a week the
# job says so by itself, and workflow_dispatch runs it on demand, right
# after a plugin release for one.
on:
push:
branches: [main]
pull_request:
schedule:
- cron: '17 5 * * 1' # Mondays 05:17 UTC - off the hour, when Actions is less busy
workflow_dispatch:

concurrency:
group: check-${{ github.ref }}
Expand Down
51 changes: 38 additions & 13 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,31 @@ against the repos, don't guess):
| [abap2UI5/abap2UI5](https://github.com/abap2UI5/abap2UI5) | the framework itself, in ABAP. Downported and transpiled, it is published as `@abap2ui5/node-runtime` |
| [cap2UI5/docs](https://github.com/cap2UI5/docs) | this site |

On npm: `@cap2ui5/cds-plugin@0.4.0` (since 2026-09-30; Node ≥ 22, peer
On npm: `@cap2ui5/cds-plugin@0.5.0` (since 2026-10-14; Node ≥ 22, peer
`@sap/cds` ≥ 9), published by the npm organisation `cap2ui5`, and
`@cap2ui5/samples@0.2.0` (peer `^0.4.0`). The plugin pins
`@abap2ui5/node-runtime@1.146.0` **exactly**, the first runtime whose frontend
does the approuter's `X-CSRF-Token` handshake and has `accelerate( )`.
verify-refs reads that pin from `plugin/package.json`, not from the stand-in
`runtime/package.json`. Up to 0.2.0 the plugin was the unscoped
`@cap2ui5/samples@0.3.0` (peer `^0.5.0`; 76 of abap2UI5's 138 samples). The
plugin pins one `@abap2ui5/node-runtime` release **exactly**: 0.4.0 pinned
1.146.0 (the first runtime whose frontend does the approuter's `X-CSRF-Token`
handshake and has `accelerate( )`), 0.5.0 pins 1.147.0, and cap2UI5's `main`
pins 1.148.0.

**The site describes two things, and says which is which.** verify-refs
compares against cap2UI5's `main`, so `main`'s pin is the number it accepts
(read from `plugin/package.json`, not from the stand-in
`runtime/package.json`), and a reader installs the newest release on npm. What
is on `main` under the CHANGELOG's "Unreleased" — at the time of writing
`cds.requires.cap2ui5.timeout`, `purgeDrafts`, the queue warning, and
`client.window_bind_tab( )` / `window_get_row( )`, which also need a runtime
after 1.148.0 — is documented, and marked **not released yet** wherever it
appears. Move the mark when the release happens; do not present an unreleased
thing as installable. Older pins are named only with the plugin version they
belong to, and are in `docs/.verify-refs-ignore` for that reason.

Since 0.5.0 the plugin also serves an MCP endpoint for AI agents
(`cds.requires.cap2ui5.agent`, off by default; `plugin/lib/agent/`, ADR-009),
adds a second entity, `cap2ui5.AgentLog`, runs the roundtrips of a process one
at a time, and keeps a stateful ABAP app's session per CAP user in the process
(`plugin/lib/sessions.js`). Up to 0.2.0 the plugin was the unscoped
package `cap2ui5`. On npm that name is now only a deprecated placeholder,
`cap2ui5@0.0.1-placeholder` (since 2026-09-30, cap2UI5/cap2UI5#97): no `main`,
and a `cap2ui5` bin that prints where to go and exits 1. It installs nothing an
Expand All @@ -93,20 +111,27 @@ the roundtrip route answers a GET with embeds the whole UI5 component, so the
plugin serves no frontend files (`/z2ui5/webapp/index.html` answers 404, and
cap2UI5's `scripts/consumer-test.mjs` asserts it). `plugin/package.json`
defines `apps`, `roles` and `routes` under `cds.requires.cap2ui5` (next to
CAP's own `model`); the plugin also reads `body_parser.limit`, which has no
default there. 0.1.0's top-level `cds.cap2ui5`, with `requires` for the
CAP's own `model`); the plugin also reads `body_parser.limit`, `compression`,
`accelerate`, `timeout` and `agent`, which have no default there — their
defaults are in `plugin/lib/config.js`, and verify-refs, which reads the
option names from `package.json`, needs the ones the site writes as
`cds.requires.cap2ui5.<option>` listed in `docs/.verify-refs-ignore`. 0.1.0's top-level `cds.cap2ui5`, with `requires` for the
roles, is still read with a deprecation warning — the site teaches only the
new place.

Path conventions inside cap2UI5:

- `plugin/` — the package: `cds-plugin.js` (the route, the auth guard, the
startup lines naming each app's address), `index.cds` (the `cap2ui5.Drafts`
entity), `index.js` (what `import`/`require` of `@cap2ui5/cds-plugin`
startup lines naming each app's address, the queue that runs roundtrips one
at a time), `index.cds` (the `cap2ui5.Drafts` and `cap2ui5.AgentLog`
entities), `index.js` (what `import`/`require` of `@cap2ui5/cds-plugin`
returns), `index.d.ts` (its TypeScript declarations), `bin/cap2ui5.js`
(`npx --no-install cap2ui5 abap2js`) and `lib/` (`abap2js.js`, `add.js`,
`config.js`, `define-app.js`, `define-exit.js`, `draft-store.js`, `hints.js`,
`runtime.js`, `view-builder.js`)
(`npx --no-install cap2ui5 abap2js`) and `lib/` (`abap2js.js`,
`abaplint-core.js`, `add.js`, `compression.js`, `config.js`,
`define-app.js`, `define-exit.js`, `draft-store.js`, `hints.js`,
`module-format.js`, `runtime.js`, `sessions.js`, `view-builder.js`, and
`agent/` — the MCP endpoint: `mcp.js`, `index.js`, `policy.js`, `audit.js`
and `vendor/`, abap2UI5's MCP server code copied unchanged)
- `examples/bookshop/` — a CAP project using it, with the test suite. Its apps
are in `examples/bookshop/srv/apps/`
- `runtime/` — a stand-in for `@abap2ui5/node-runtime`. Only `package.json`
Expand Down
21 changes: 18 additions & 3 deletions docs/.verify-refs-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,24 @@ z2ui5_cl_caps_app_002 # cap2UI5/samples-stack's RFC sample, linked from exampl
# guide/vs-abap2ui5 — but "do not use this" is a recommendation, and this file
# is only about what exists.

# --- plugin options without a default in the plugin's package.json ---------
# verify-refs reads the option names from package.json#cds.requires.cap2ui5,
# which holds apps, roles and routes. These two are read by
# plugin/lib/config.js, which holds their defaults (60000 ms; off).
cap2ui5.timeout # the ms an async main( ) may take — config.js timeoutOf( ); on cap2UI5's main, after 0.5.0
cap2ui5.agent # the MCP endpoint's switch and settings — config.js / lib/agent/policy.js agentConfig( ), since 0.5.0

# --- release numbers that are NOT the pinned runtime release ----------------
# The pin itself (1.145.0 today) is read from the checkout and never listed
# here — listing it would keep the old number green after a pin move, which
# is the one defect the release check exists to catch.
# The pin itself (1.148.0 today, on cap2UI5's main) is read from the checkout
# and never listed here — listing it would keep the old number green after a
# pin move, which is the one defect the release check exists to catch.
#
# The two below WERE pins. They are listed because the site now says which
# plugin release pinned which runtime (reference/configuration, "The
# runtime"), and that stays true whatever main pins. The price: a page that
# still called one of them the current pin would pass — so name them only
# together with the plugin version they belong to.
1.146.0 # the runtime plugin 0.4.0 pinned — history, in the plugin-to-runtime table
1.147.0 # the runtime plugin 0.5.0 pins, the newest release on npm — main has moved to the next one
1.143.0 # the upstream release where _bind/_bind_edit merged — history, stays true whatever the pin says
1.113.0 # an OpenUI5 release — a UI5 number, not a framework release
1 change: 1 addition & 0 deletions docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export default defineConfig({
items: [
{ text: 'Developer Tools', link: '/guide/devtools' },
{ text: 'The User Exit', link: '/guide/user-exit' },
{ text: 'Agents (MCP)', link: '/guide/agents' },
{ text: 'Troubleshooting', link: '/guide/troubleshooting' }
]
},
Expand Down
5 changes: 5 additions & 0 deletions docs/api/app-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ it has [a page of its own](../guide/user-exit).
The package also exports `z2ui5_cl_ui5_view_builder` — abap2UI5's view
builder, see [Views](../guide/views) — and `z2ui5_if_client`, the client's
constants as an ABAP app reads them (`z2ui5_if_client.cs_event.set_title`).
For a project's own scheduled job there are two more:
[`purgeAgentLog`](../guide/agents#retention), since 0.5.0, and
[`purgeDrafts`](../reference/database#purgedrafts),
which is not released yet.

## `defineApp(name, class, opts?)`

Expand All @@ -27,6 +31,7 @@ defineApp("ZCL_HELLO", class {
| `name` | the app's name **on the wire** — what `?app_start=` takes and `client.nav_app_call()` resolves. Uppercased. The file name is irrelevant |
| `class` | a plain class with a `main(client)` method and its state as fields |
| `opts.interfaces` | rarely needed; defaults to `["Z2UI5_IF_APP", "IF_SERIALIZABLE_OBJECT"]` |
| `opts.agent` | since 0.5.0: whether AI agents may operate the app through the MCP endpoint, and which events they may fire — `true`, `false`, or `{ events, description }`. See [Agents](../guide/agents#an-app-opts-in) |

It returns the wrapped class and registers it, so `defineApp` may be called
more than once per file.
Expand Down
93 changes: 89 additions & 4 deletions docs/api/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Two rules for every method:
| `client.check_on_event(val)` | whether this roundtrip answers the event `val`; without `val`, whether it answers any event |
| `client.check_app_prev_stack()` | `true` if there is an app to return to — for a Page's `showNavButton` |
| `client.get_event()` | the event this roundtrip answers; `""` on an app start |
| `client.get_event_arg(v)` | the *v*-th event argument, **1-based**, `1` by default. The first 8 are resolved up front; beyond that, `client.raw` |
| `client.get_event_arg(v)` | the *v*-th event argument, **1-based**, `1` by default, and `""` past the last one, as in ABAP. Up to 0.4.0 only the first 8 could be read |
| `client.get()` | what the frontend sent with this roundtrip, as plain values under the ABAP component names: `event`, the draft ids (`s_draft`), the browser location (`s_config`), device, focus and scroll information, and `r_event_data` — what a returning app handed over |
| `client.get_app_prev()` | the app on the other side of the last navigation — inside a called app its caller, back in the caller the app that just returned. A `defineApp` app as its fields' plain values, an ABAP app as the instance |
| `client.get_app()` | without an id, the running app itself |
Expand Down Expand Up @@ -95,6 +95,8 @@ what its `stringify()` answered.
| | |
|---|---|
| `client.view_display(val)` | render the main view. An `mvc:View` |
| `client.view_display({ val, transition, transition_back })` | … with a page transition — see [Transitions](#transitions) |
| `client.view_display({ val, switch_default_model_path, switch_default_model_anno_uri })` | `view_display( )`'s other two options, as in ABAP: an OData V2 service as the view's default model |
| `client.view_destroy()` | remove it |
| `client.popup_display(val)` | a dialog on top. A `core:FragmentDefinition` |
| `client.popup_destroy()` | close it |
Expand All @@ -115,6 +117,84 @@ client.nest_view_display({

See [Views](../guide/views) and [Popups](../guide/popups).

### Transitions

Since plugin 0.4.0 — the first whose runtime has them — `view_display( )` can
bring the new main view in with a page transition:

```js
if (client.check_on_navigated()) {
client.view_display({ val: view, transition: client.cs_transition.slide });
}
```

| `client.cs_transition` | |
|---|---|
| `slide` | the new page comes in from the right |
| `base_slide` | the classic full-width slide. UI5 1.74 and newer; an older release plays `slide` |
| `fade` | the pages cross-fade |
| `flip` | the page turns over |
| `show` | no animation, but the old page stays up until the new one is built |

They are the names `sap.m.NavContainer.to( )` takes, and abap2UI5's rules
apply as they are:

- Without `transition` the view is swapped with no animation, as before.
- Pass it where the **screen** changes — the `check_on_navigated()` branch —
not on every re-render.
- Going back, the page being left runs the transition it arrived with in
reverse, whatever is passed.
- `transition_back: true` plays the change as a way **back**, for an app that
steps back between its own screens — a wizard's Previous button. It is not
needed after `nav_app_leave()` or the browser's Back button.

`cs_transition` is read from the runtime, like the other constants. On a
runtime from before transitions existed — the one plugin 0.3.x pins —
`client.cs_transition` is `undefined` and a `view_display( )` that sets
`transition` throws, naming the runtime, instead of silently doing nothing.

## The windowed table

::: warning Not released yet, and not in any pinned runtime
`client.window_bind_tab( )` and `client.window_get_row( )` are on cap2UI5's
`main`, after 0.5.0 — and they need an `@abap2ui5/node-runtime` **after**
`1.148.0`, the release `main` pins. On that runtime and every older one the
client does not have them, and a call throws:

```
client.window_bind_tab( ): z2ui5_if_client has no window_bind_tab in the abap2UI5 runtime this project runs on (@abap2ui5/node-runtime 1.148.0) - it came with a later release
```

What follows is read from the plugin's code and abap2UI5's interface. It has
not been run for this page.
:::

They are abap2UI5's windowed table: a **large** table bound to a list control
goes to the browser a window of rows at a time instead of whole.

| | |
|---|---|
| `client.window_bind_tab(name)` | the binding of a table field for a list control's `items` or `rows`, as `_bind( )` answers it |
| `client.window_bind_tab({ val, window, t_sort, t_filter })` | with its options. `window` is the rows the browser gets at a time, 100 unless set. `t_sort` is `[{ path, descending }]`, `t_filter` is `[{ group, path, operator, value1, value2 }]` — `path` a column of the table |
| `client.window_get_row({ val, row })` | which row of the table a row of the browser shows. `row` is the position there, **counted from 1** — the index of a binding path an event hands over, plus 1. Answers the row of the table, counted from 1, and `0` past the rows the filter lets through |

- The control asks the framework for the next rows itself as it grows or
scrolls — a roundtrip that does **not** run `main( )`.
- Sorting and filtering happen on the server, over all rows. The window's
state is in the model beside the rows, under `/__WINDOW/<path>/` — `TOTAL`,
`COUNT` and `SIZE`.
- `t_sort` and `t_filter` take effect when they differ from the ones the
previous `window_bind_tab( )` of that table passed; an empty array clears.
The conditions of one filter `group` are ORed, the groups ANDed.
- An unknown component, a `path` that is no column of the table and a value of
the wrong kind are refused.
- `window_get_row( )` answers for the order the roundtrip **started** with —
the one the browser shows. After a `window_bind_tab( )` that passed another
sort or filter in the same `main( )`, it is refused: ask before binding the
table anew.
- For a table that is a component of a structure, the binding is a placeholder
until `main( )` returns, as with `_bind( )`.

## Messages

| | |
Expand Down Expand Up @@ -148,7 +228,9 @@ thing a branch does. See [Navigation](../guide/navigation).
## Constants

`client.cs_event`, `client.cs_view`, `client.cs_nav_mode`, `client.cs_device`
are the interface's constant structures. The same are exported as
and `client.cs_transition` are the interface's constant structures, read from
the runtime — a constant upstream adds is one the client has. The same are
exported as
`z2ui5_if_client`, as an ABAP app reads them:

```js
Expand All @@ -167,17 +249,20 @@ Its methods are the ABAP ones with `~` written as `$`, and they answer ABAP
values:

```js
const ninth = (await client.raw.z2ui5_if_client$get_event_arg({ v: 9, result: 1 })).get();
const first = (await client.raw.z2ui5_if_client$get_event_arg({ v: 1, result: 1 })).get();
```

An app should not need it: since 0.5.0 `client.get_event_arg(v)` answers every
argument itself.

## Obsolete and unsupported

| | |
|---|---|
| `view_model_update()`, `popup_model_update()`, `popover_model_update()`, `nest_view_model_update()`, `nest2_view_model_update()` | obsolete in `z2ui5_if_client`; they **do nothing**, here as there. Changed bound data is pushed on its own |
| `_bind_edit()` | obsolete — `_bind()` under another name |
| `_event_client()` | obsolete — the embedded `follow_up_action()` under another name |
| `set_session_stateful()` | **not supported**, throws. The app's state is in its fields, which are in the draft |
| `set_session_stateful()` | **not supported in a JavaScript app**, throws. The app's state is in its fields, which are in the draft. A *transpiled ABAP* app can call it: since 0.5.0 its session is kept per CAP user, in the process — a restart or a second instance without sticky routing loses it. See [Deployment](../reference/deployment#scaling) |

The names of cap2UI5 0.1.0 (`c.isDisplay`, `c.bind()`, `c.navTo()` …) throw
an error naming the method that replaces each, rather than answering
Expand Down
Loading
Loading