-
Notifications
You must be signed in to change notification settings - Fork 6
Fix metadata filtering by package in Studio #1048
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -384,12 +384,14 @@ export class HttpDispatcher { | |
| // /metadata/:type/:name | ||
| if (parts.length === 2) { | ||
| const [type, name] = parts; | ||
| // Extract optional package filter from query string | ||
| const packageId = query?.package || undefined; | ||
|
|
||
| // PUT /metadata/:type/:name (Save) | ||
| if (method === 'PUT' && body) { | ||
| // Try to get the protocol service directly | ||
| const protocol = await this.resolveService('protocol'); | ||
|
|
||
| if (protocol && typeof protocol.saveMetaItem === 'function') { | ||
| try { | ||
| const result = await protocol.saveMetaItem({ type, name, item: body }); | ||
|
|
@@ -398,7 +400,7 @@ export class HttpDispatcher { | |
| return { handled: true, response: this.error(e.message, 400) }; | ||
| } | ||
| } | ||
|
|
||
| // Fallback to broker if protocol not available (legacy) | ||
| if (broker) { | ||
| try { | ||
|
|
@@ -430,12 +432,12 @@ export class HttpDispatcher { | |
| // If type is singular (e.g. 'app'), use it directly | ||
| // If plural (e.g. 'apps'), slice it | ||
| const singularType = type.endsWith('s') ? type.slice(0, -1) : type; | ||
|
|
||
| // Try Protocol Service First (Preferred) | ||
| const protocol = await this.resolveService('protocol'); | ||
| if (protocol && typeof protocol.getMetaItem === 'function') { | ||
| try { | ||
| const data = await protocol.getMetaItem({ type: singularType, name }); | ||
| const data = await protocol.getMetaItem({ type: singularType, name, packageId }); | ||
| return { handled: true, response: this.success(data) }; | ||
|
Comment on lines
436
to
441
|
||
| } catch (e: any) { | ||
| // Protocol might throw if not found or not supported | ||
|
Comment on lines
441
to
443
|
||
|
|
||
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.
There are existing unit tests for
handleMetadata, but none assert the newquery.package→packageIdbehavior forGET /meta/:type/:name. Add a test that passes aqueryobject withpackageset and verifies the protocol is invoked with thatpackageId(and/or that the scoped item is returned).