-
Notifications
You must be signed in to change notification settings - Fork 526
feat(core): add ky based api client #70693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging
Are you sure you want to change the base?
Conversation
🖼️ Storybook Visual Comparison Report✅ No Storybook eyes differences detected! |
39093a3 to
6925828
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds a new ky-backed Dashboard API client to @code-dot-org/core (with a singleton instance + typed “noun”-style access), and updates dev configuration to support local CORS/host access for Code Studio + Vite apps.
Changes:
- Introduces
@code-dot-org/core/apientrypoint exportingDashboardApiClientand related dashboard response/request types. - Adds typed endpoints for Labs level properties and user preference theme, using a bound ky transport.
- Updates dev configs to allow requests from
localhost-studio.code.org(Vite allowed hosts; Rails dev CORS).
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/packages/labs/music/vite.config.ts | Allows Vite dev server access when using localhost-studio.code.org. |
| frontend/packages/labs/music/src/App.tsx | Demonstrates using DashboardApiClient to fetch level properties and theme. |
| frontend/packages/core/vite.config.ts | Adds an additional library entrypoint for the new API bundle. |
| frontend/packages/core/src/api/index.ts | Exposes DashboardApiClient and dashboard API types from a new ./api export path. |
| frontend/packages/core/src/api/dashboard/** | Adds ky-bound dashboard client factory, singleton transport, and initial endpoint modules/types. |
| frontend/packages/core/package.json | Adds ./api subpath export and ky dependency. |
| frontend/apps/studio/package.json | Adds ky dependency for the studio app. |
| dashboard/config/initializers/development_cors.rb | Enables dev-only CORS for localhost-studio.code.org:<port> with credentials. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
frontend/packages/core/src/api/dashboard/users/userPreference/index.ts
Outdated
Show resolved
Hide resolved
6925828 to
b7309dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b7309dc to
7368665
Compare
This PR introduces a new API client for interacting with Dashboard. The client uses "type-ahead" syntax to improve the understanding of different API nouns and predict what data may be retrieved. Additionally, this PR adds a blanket allow for the development rails server to allow CORS when visiting code studio via `localhost-studio.code.org:*`. This allows the vite local and rails-vite apps to be able to communicate with the development server. This does not allow CORS outside of development.
7368665 to
a55cc25
Compare
This PR introduces a new API client for interacting with Dashboard. The client uses "type-ahead" syntax to improve the understanding of different API nouns and predict what data may be retrieved.
Additionally, this PR adds a blanket allow for the development rails server to allow CORS when visiting code studio via
localhost-studio.code.org:*. This allows the vite local and rails-vite apps to be able to communicate with the development server. This does not allow CORS outside of development.