Skip to content

Move the site to the 0.2.0 client and configuration - #31

Merged
oblomov-dev merged 3 commits into
mainfrom
claude/client-api-0.2
Sep 29, 2026
Merged

oblomov-dev merged 3 commits into
mainfrom
claude/client-api-0.2

Conversation

@oblomov-dev

Copy link
Copy Markdown
Member

Follow-up to #30. cap2UI5 0.2.0 renamed the client after z2ui5_if_client and moved the configuration. The site still taught 0.1.0, so the quickstart installed 0.3.0 and then showed code that fails. The 0.1.0 names (c.isDisplay, c.bind, c.view, c.navTo …) now throw. This PR also fixes the red check on main.

Sources: cap2UI5/cap2UI5 plugin/README.md, plugin/CHANGELOG.md (0.2.0, 0.3.0) and plugin/index.d.ts. Code examples are modelled on the verified apps in examples/bookshop/srv/apps/.

Commit 1: configuration (cds.requires.cap2ui5)

  • scripts/verify-refs.mjs
    • Reads the plugin's options from package.json#cds.requires.cap2ui5, which yields apps, roles and routes. It used to read cds.cap2ui5, which no longer exists, so it flagged every option and main has been red since 0.2.0.
    • Now reports 0.1.0's cds.cap2ui5.<key> as the deprecated place.
  • Configuration page
    • The settings are under cds.requires.cap2ui5, and requires is now roles.
    • Adds body_parser.limit and the "cap2ui5": false switch.
    • A logged-in user without the role now gets 403; a caller who is not logged in still gets 401. Both come back in CAP's error format.
    • The runtime resolves as the plugin's own dependency; use npm overrides to load another release.
    • A box explains how to move settings from 0.1.0.
  • Troubleshooting
    • An app module that fails to load (such as a require in an ES-module project) now fails the start. It used to make every roundtrip answer 500.
    • 401 and 403 now have their own explanations.
    • Log lines show the [cap2ui5] - prefix.
  • User exit, deployment, project-structure and AGENTS.md now use the new keys. AGENTS.md also records the plugin's current layout and a rule to teach the client by its ABAP names.

Commit 2: the client, by its z2ui5_if_client names

  • API reference: client.md is rewritten as the reference for z2ui5_if_client, covering every method in index.d.ts. app-interface.md adds the view builder and constants exports, t.numc/date/time, this.client for helper methods, and the Client<> TypeScript annotation. protocol.md and architecture.md are corrected.
  • Guide pages (lifecycle, events, data binding, popups, navigation) now document:
    • check_on_init vs check_on_navigated
    • _event with t_arg, arg and s_ctrl
    • follow_up_action and _event_nav_app_leave
    • cell and option bindings
    • popovers and nest_view_display with explicit method_insert/method_destroy
    • nav_app_call presets
    • typed r_data read via get().r_event_data
    • get_app(id) and the hash methods
  • Quickstart: both apps run on 0.3.0 and the log lines are current. The app/…/index.html redirect tip is replaced by the fact that CAP's start page lists the apps in development. The ES-module failure is described as it now happens.
  • Views: a new section on z2ui5_cl_ui5_view_builder. The abap.Classes workaround and the 0.1.0 c.event() warning are removed.
  • vs-abap2ui5 and migration: the ABAP↔JS table, "what is JavaScript's own", and npx cap2ui5 abap2js with its limits and the samples it translated.
  • Examples: all five are rewritten. hello-world and list are the bookshop apps in ES-module form, and the pages say so, since the bookshop itself is CommonJS.
  • Roadmap: drops what 0.2.0/0.3.0 delivered and keeps the approuter CSRF limit.
  • The sidebar entry now reads "client — z2ui5_if_client".

Checks

npm run check against current cap2UI5 and abap2UI5 main: verify-refs reports OK (no findings), and the VitePress build passes, including dead links. The code examples were not run: the runtime isn't assembled here. They follow the bookshop apps the plugin's CI runs.

Worth knowing

  • Plugin bug, outside this repo: in 0.3.0, cds add cap2ui5 always writes srv/apps/hello.js with require, even in the ES-module project that cds init --nodejs creates, where that file fails the start. The fix belongs in cap2UI5's plugin/lib/add.js, which should honour "type": "module". Until then the docs mention cds add with that caveat and keep the hand-written, import-based hello.js as the main path.
  • Not re-measured: the tiny-sample data the quickstart searches ("Raven"), and the client.raw example on the client page. That example uses the same call form as the plugin itself: { v, result: 1 }.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NwpbkojNzGmuJrFdbwo5JF


Generated by Claude Code

cap2UI5 0.2.0 moved the plugin's settings to cds.requires.cap2ui5, where
SAP's own plugins keep theirs, and renamed `requires` to `roles`. A user
without the role now gets 403 in CAP's format instead of a 401, and an app
module that fails to load fails the start instead of every roundtrip. The
site still taught cds.cap2ui5 and the old symptoms, and verify-refs read
the options from package.json#cds.cap2ui5, which no longer exists - so it
flagged every option the docs named and check has been red since.

verify-refs now reads cds.requires.cap2ui5 and reports 0.1.0's
cds.cap2ui5.<key> as the deprecated place. Configuration, troubleshooting,
user exit, deployment and project structure describe the current keys and
behaviour; AGENTS.md records them and the plugin's current layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NwpbkojNzGmuJrFdbwo5JF
Since cap2UI5 0.2.0 the client an app's main( ) receives is abap2UI5's
z2ui5_if_client under its own method names - client.check_on_navigated(),
client._bind("name"), client.view_display(xml) - and the 0.1.0 names the
whole site taught (c.isDisplay, c.bind, c.view, c.navTo ...) throw. The
quickstart installed 0.3.0 and then showed code that fails on its first
roundtrip.

Every page that teaches app code now uses the current client: the
quickstart, the guide (lifecycle, events, data binding, popups,
navigation, views, persistence), the examples, the API reference and the
comparison and migration pages. What 0.2.0 and 0.3.0 added is documented
where it belongs: the view builder z2ui5_cl_ui5_view_builder, popovers and
the second nested slot, follow_up_action and _event's s_ctrl, cell and
option bindings, preset fields on nav_app_call and typed r_data,
get_app(id), the hash methods, t.numc/date/time, this.client for helper
methods, the TypeScript declarations, and npx cap2ui5 abap2js, which
translates an ABAP app line for line. CAP's start page lists the apps in
development, so the index.html redirect tip is gone. The roadmap drops
what these releases delivered.

`cds add cap2ui5` is mentioned with a caveat: in 0.3.0 it writes its
hello.js with require, which fails the start of the ES module project
`cds init --nodejs` creates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NwpbkojNzGmuJrFdbwo5JF
The why page sent "use the OData model (see set_odata_model)" to the
external-OData example's "Where the data goes", which is about keeping
fetched rows in a field and says nothing about the OData model. It now names
the front-end action, z2ui5_if_client.cs_event.set_odata_model, and links the
client reference's section on follow_up_action( ), which runs it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NwpbkojNzGmuJrFdbwo5JF
@oblomov-dev
oblomov-dev merged commit 469468c into main Sep 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants