Skip to content

Document the two JavaScript APIs for contributors - #56

Open
christophdb wants to merge 1 commit into
mainfrom
docs/js-api-divergence-note
Open

Document the two JavaScript APIs for contributors#56
christophdb wants to merge 1 commit into
mainfrom
docs/js-api-divergence-note

Conversation

@christophdb

Copy link
Copy Markdown
Member

Why

PR #55 fixes the symptom: methods on the JavaScript pages that are undefined in the reader's context. This PR addresses why it happened.

docs/javascript/ documents two different APIs on shared pages — the scripting API and the external seatable-api client. Nothing in this repository stated that. There was no list of the divergences, no note on the marker convention, and no way to check a method's availability. Anyone editing those pages had to assume parity, because assuming parity was the only documented option.

Changes

README, new section "Editing the JavaScript reference" — placed with the other contributor instructions:

  • what the two contexts are
  • the capability divergence: columns are read-only in scripts, all write methods are external-only
  • the naming divergence: getRows/listRows, updateLinks/updateLink, getColumns/listColumns
  • the marker convention, with both markers spelled out, and the rule that a missing marker reads as "works in both"
  • how to enumerate either API
  • a warning that dtable-sdk on npm is not a stand-in for the scripting API — the script environment wraps it and adds methods, and the SDK has no link methods at all

scripts/dump-script-api.js — walks the prototype chain of base and prints every method, plus base.utils and base.context. The scripting API is not published as a package, so this is the only way to enumerate it. Run it in any base's script editor.

Notes

Merge after #55 — the section describes the "External client only" marker introduced there.

The divergence list will age. It is deliberately short and covers only the stable, surprising cases; the markers in the pages themselves stay authoritative per method, and the dump script is there for when something looks off.

tests/validate_docs.py and mkdocs build --strict pass.

🤖 Generated with Claude Code

docs/javascript/ describes the scripting API and the external seatable-api
client on shared pages. The two are not identical, but nothing in this
repository said so, so an editor had no way to know which methods need a
context marker. That is how methods ended up documented for readers whose
context does not have them.

- README: what the two contexts are, both kinds of divergence (columns are
  read-only in scripts; three methods differ only in name), the marker
  convention, and how to verify a method in either context
- scripts/dump-script-api.js: prints the method surface of `base` from a
  base's script editor -- the scripting API has no published package, so
  this is the only way to enumerate it

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant