Skip to content

Commit c25ec8e

Browse files
authored
Merge pull request #356 from objectstack-ai/copilot/fix-build-issue-in-actions
2 parents f8f5a90 + 4dfca1a commit c25ec8e

5 files changed

Lines changed: 24 additions & 6 deletions

File tree

.storybook/msw-browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export async function startMockServer() {
6565
}),
6666

6767
// Metadata endpoints
68-
http.get('/api/v1/metadata/object/:objectName', async ({ params }) => {
68+
http.get('/api/v1/meta/object/:objectName', async ({ params }) => {
6969
console.log('[MSW] Get Meta:', params.objectName);
7070
try {
7171
const response = await protocol.getMetaItem({

apps/console/src/mocks/server.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,24 @@ function createHandlers(baseUrl: string, kernel: ObjectKernel, driver: InMemoryD
120120
}
121121
}),
122122

123+
http.get(`${baseUrl}/meta/object/:objectName`, async ({ params }) => {
124+
console.log('MSW: getting meta item for /meta/object', params.objectName);
125+
try {
126+
const response = await protocol.getMetaItem({
127+
type: 'object',
128+
name: params.objectName as string
129+
});
130+
131+
// Unwrap item if present
132+
const payload = (response && response.item) ? response.item : response;
133+
134+
return HttpResponse.json(payload || { error: 'Not found' }, { status: payload ? 200 : 404 });
135+
} catch (e) {
136+
console.error('MSW: error getting meta item', e);
137+
return HttpResponse.json({ error: String(e) }, { status: 500 });
138+
}
139+
}),
140+
123141
http.get(`${baseUrl}/metadata/object/:objectName`, async ({ params }) => {
124142
console.log('MSW: getting meta item for', params.objectName);
125143
try {

packages/plugin-calendar/src/ObjectCalendar.msw.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const handlers = [
4646
}),
4747

4848
// Metadata Query
49-
http.get(`${BASE_URL}/api/v1/metadata/object/events`, () => {
49+
http.get(`${BASE_URL}/api/v1/meta/object/events`, () => {
5050
return HttpResponse.json({ fields: {} });
5151
})
5252
];

packages/plugin-form/src/ObjectForm.msw.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ const handlers = [
4646
return HttpResponse.json({ status: 'ok', version: '1.0.0' });
4747
}),
4848

49-
// Mock Schema Fetch: GET /api/v1/metadata/object/:name
50-
http.get(`${BASE_URL}/api/v1/metadata/object/:name`, ({ params }) => {
49+
// Mock Schema Fetch: GET /api/v1/meta/object/:name
50+
http.get(`${BASE_URL}/api/v1/meta/object/:name`, ({ params }) => {
5151
const { name } = params;
5252
if (name === 'contact') {
5353
return HttpResponse.json(mockSchema);

packages/plugin-grid/src/ObjectGrid.msw.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ const handlers = [
4848
return HttpResponse.json({ status: 'ok', version: '1.0.0' });
4949
}),
5050

51-
// Schema: /api/v1/metadata/object/:name
52-
http.get(`${BASE_URL}/api/v1/metadata/object/contact`, () => {
51+
// Schema: /api/v1/meta/object/:name
52+
http.get(`${BASE_URL}/api/v1/meta/object/contact`, () => {
5353
return HttpResponse.json(mockSchema);
5454
}),
5555

0 commit comments

Comments
 (0)