-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add expand parameter support to experimental live loader #76
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: next
Are you sure you want to change the base?
Conversation
20ee929 to
2f3b0be
Compare
pawcoding
left a comment
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.
@copilot Please check my review comments for requested changes.
Also two things that are still missing from this PR:
- New test cases for
fetchCollectionandfetchEntrythat use the expand parameter - The loader needs to add
expand?: unknownto the schema when theliveTypesOnlyoption is enabled.
All requested changes have been addressed:
All 207 tests passing ✅ |
pawcoding
left a comment
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.
@copilot Functionality looks good, but the test cases need some work.
All test improvements completed in commit 30dc8a6:
|
Co-authored-by: pawcoding <[email protected]>
Co-authored-by: pawcoding <[email protected]>
Co-authored-by: pawcoding <[email protected]>
30dc8a6 to
7afc0fc
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
This PR implements support for expanding relation fields in the experimental live loader, allowing related records to be included directly in API responses instead of requiring additional requests.
Key changes:
- Added
expandparameter to experimental live loader options with validation for nesting depth and format - Implemented
formatExpandutility to format and validate expand field arrays - Extended type definitions to include collection IDs needed for relation tracking
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/format-expand.ts | New utility to format and validate expand parameter arrays, enforcing 6-level depth limit and comma validation |
| src/types/pocketbase-loader-options.type.ts | Added experimental expand option to live loader configuration |
| src/types/pocketbase-schema.type.ts | Added id field to collection schema and collectionId field to schema entries |
| src/types/errors.ts | Added PocketBaseConfigurationError for configuration validation issues |
| src/schema/generate-schema.ts | Added optional expand field to schema when using live types only mode |
| src/loader/fetch-entry.ts | Integrated expand parameter into entry fetch requests |
| src/loader/fetch-collection.ts | Integrated expand parameter into collection fetch requests |
| test/utils/format-expand.spec.ts | Unit tests for expand formatting and validation logic |
| test/loader/fetch-entry.e2e-spec.ts | E2E tests for single and multi-relation expansion in entry fetching |
| test/loader/fetch-collection.e2e-spec.ts | E2E tests for single and multi-relation expansion in collection fetching |
| test/schema/read-local-schema.spec.ts | Added collection id field to mock schema data |
| test/schema/parse-schema.spec.ts | Added collection id field to all test collection objects |
| test/schema/snapshots/get-remote-schema.e2e-spec.ts.snap | Updated snapshot to include id field |
| test/_mocks/insert-entry.ts | Changed type from PocketBaseLoaderOptions to PocketBaseLoaderBaseOptions |
| test/_mocks/insert-collection.ts | Changed return type to string and return collection ID |
| test/_mocks/delete-entry.ts | Changed type from PocketBaseLoaderOptions to PocketBaseLoaderBaseOptions |
| test/_mocks/delete-collection.ts | Changed type from PocketBaseLoaderOptions to PocketBaseLoaderBaseOptions |
| README.md | Added documentation for expanding relations feature with examples and limitations |
# [2.10.0-live-expand.1](v2.9.0...v2.10.0-live-expand.1) (2025-11-01) ### Features * **live-loader:** add experimental expand parameter support ([f915c1e](f915c1e))
Implementation Plan: Add
expandParameter Support to Live Loader ✅All tasks completed and all review feedback addressed.
✅ Latest Test Improvements
Test Restructuring:
Test Coverage:
fetchEntrywith single expand parameterfetchEntrywith multiple expand parametersfetchCollectionwith single expand parameterfetchCollectionwith multiple expand parameters📊 Summary
Core Features:
experimental.expandparameter for live loaderexpand?: unknownfield for liveTypesOnly modeTest Results:
Code Quality:
Original prompt
expandparameter in live loader #60💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.