Add getLayerCapabilities - #139
Draft
ChrisLoer wants to merge 1 commit into
Draft
Conversation
Layers created with createLayersFromGeoJson hold their data in the browser, so they support a different subset of the SDK than layers hosted by Felt. There was no way for a host app to ask which semantics apply to a layer, so it had to guess. getLayerCapabilities reports the layer's capabilities - serverPersistence, serverQuery, serverStats and localData - so callers can branch instead. The Felt-side handler lands separately. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Description
Layers created with
createLayersFromGeoJsonhold their whole GeoJSON collection in the browser, so they support a different subset of the SDK than layers hosted by Felt: no server-side query endpoint, no server-computed statistics, no server persistence — but the full feature collection is available locally. felt/felt PRs #21742, #21743 and #21744 make the unsupported methods fail loudly and implement many of the ones that can be served locally.What's still missing is discoverability (felt/felt ENG-526): a host app has no way to ask which semantics apply to a layer, so it has to guess or probe by calling a method and catching the rejection.
getLayerCapabilitiescloses that gap so a caller can branch up front.API
Hosted layers report the
server*capabilities; layers created withcreateLayersFromGeoJsonreportlocalData. Each token's JSDoc names the methods that need it, and the method's JSDoc notes that calling a method without its capability rejects with an error naming the missing capability.This PR is the client half only: the message schema, the controller method, the type, docs and the API spec. Felt does not handle
getLayerCapabilitiesyet — calling it against today's app will fail as an unknown message. The handler implementation lands in felt/felt once this change is published to npm, per the usual SDK flow inDEVELOPING.md.🧪 Test Plan
npm run checkpasses locally (client bundle, format, api-extractor + attw, knip, tsc, vitest, docs).tests/layers.test.tscovers the message round-trip: the layer id reaches the handler, the capability array comes back, a non-string layer id is reported as an invalid message and rejects, and a handler error surfaces as a promise rejection.etc/js-sdk.api.mdanddocs/are regenerated and committed (npm run update-api,npm run build:docs). The api spec diff is large because adding a public type rotates the bundled chunk hash and shifts every mangled export id — the only semantic change isLayerCapability.