Conversation
…al-app-sdk addition
|
|
…ents from a grafana PR build
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.
What this PR does / why we need it:
Extends the
experimental-app-sdkaddition so an app plugin also gets typed RTK Query clients for its kinds and custom routes, generated the same way core Grafana generates@grafana/api-clients:Added to the scaffold, following the shape of
generate-kinds.mjs:.config/app-sdk/generate-api-client.mjs— downloads the pinned Grafana release'sgrafanabinary once intonode_modules/.cache/grafana/<version>/(GRAFANA_BINoverrides), runswrite-openapi, thennpx grafana-api-clients generate.generate:api-clientandgenerate(kinds + clients); existing scripts are never overwritten.@grafana/api-clients,@reduxjs/toolkit,react-redux..gitignoreentry for the intermediate OpenAPI documents.generateand checkssrc/api/generatedtoo..config/app-sdk/README.md,kinds/README.md,.config/AGENTS/app-sdk.mddescribe the hooks and store wiring.Today every app plugin hand-rolls a
getBackendSrv()wrapper per kind; this gives them the same generated hooks core's frontend uses (useList<Kind>Query,useCreate<Kind>Mutation, …), with cache invalidation, for free.Which issue(s) this PR fixes:
Related to grafana/grafana-app-sdk#1493, grafana/grafana-app-platform-squad#111
Special notes for your reviewer:
grafana cli write-openapiis onmainonly. The script pins nightly build13.3.0-35040200895(commitb8b4b49a, resolvable via the build id = Actions run id) and documents how to pick another. Switch to13.3.0once tagged.grafana-api-clientsbin is API Clients: add grafana-api-clients generate CLI for app plugins grafana#132913. The script installs@grafana/api-clients@^13.3.0on first run; until that is on npm,GRAFANA_PR=132913 npm run generate:api-clientinstalls the tarball that PR's CI built (every grafana PR packs all@grafana/*into thebuildPrartifact) usinggh. The addition itself no longer adds@grafana/api-clientstopackage.json, soadd experimental-app-sdkinstalls cleanly.add experimental-app-sdkfrom this branch on a clean checkout, thenGRAFANA_PR=132913 npm run generate:api-client— installed the PR build, downloaded Grafana, renderedv0alpha1+v1alpha1, generated both clients;tscreports 0 errors insrc/api/generated.main, not your fork (the addition isn't onstevesg/main). Happy to retarget.PR involved assistance from anthropic:claude-fable-5-1