@objectql/studio 1.7.2 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/LICENSE +1 -1
- package/dist/assets/{index-c126GlTy.js → index-BZVSxINM.js} +2 -2
- package/dist/index.html +1 -1
- package/package.json +2 -1
- package/src/components/DataGrid.tsx +3 -2
- package/src/components/ObjectList.tsx +1 -1
- package/src/components/RecordDetail.tsx +4 -2
- package/src/components/SchemaInspector.tsx +4 -1
- package/src/hooks/use-metadata.ts +2 -2
- package/src/pages/MetadataBrowser.tsx +1 -1
- package/src/pages/ObjectView.tsx +7 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -18,14 +18,14 @@ export function useMetadata() {
|
|
|
18
18
|
const [error, setError] = useState<Error | null>(null);
|
|
19
19
|
|
|
20
20
|
useEffect(() => {
|
|
21
|
-
fetch('/api/metadata')
|
|
21
|
+
fetch('/api/metadata/object')
|
|
22
22
|
.then(async res => {
|
|
23
23
|
if (!res.ok) throw new Error('Failed to fetch metadata');
|
|
24
24
|
// The API might return { objects: [...] } or just [...]
|
|
25
25
|
// Assuming standard objectql server returns { objects: [...] } or Array
|
|
26
26
|
const data = await res.json();
|
|
27
27
|
// Check format
|
|
28
|
-
const list = Array.isArray(data) ? data : (data.
|
|
28
|
+
const list = Array.isArray(data) ? data : (data.items || []);
|
|
29
29
|
setObjects(list);
|
|
30
30
|
})
|
|
31
31
|
.catch(err => {
|
|
@@ -63,7 +63,7 @@ export function MetadataBrowser() {
|
|
|
63
63
|
const data = await res.json();
|
|
64
64
|
// API returns { [type]: [...] } or for object: { object: [...], objects: [...] }
|
|
65
65
|
// Handle singular/plural mismatch from API response
|
|
66
|
-
const list = data[selectedType] || data.
|
|
66
|
+
const list = data[selectedType] || data.items || [];
|
|
67
67
|
setItems(list);
|
|
68
68
|
})
|
|
69
69
|
.catch(err => setError(err.message))
|
package/src/pages/ObjectView.tsx
CHANGED
|
@@ -98,7 +98,8 @@ export function ObjectView({ objectName }: ObjectViewProps) {
|
|
|
98
98
|
})
|
|
99
99
|
});
|
|
100
100
|
const resJson = await response.json();
|
|
101
|
-
|
|
101
|
+
// Support new format (items) and old format (data)
|
|
102
|
+
const rows = resJson.items || resJson.data || resJson; // normalize
|
|
102
103
|
|
|
103
104
|
// 4. Fetch Count (for total pagination)
|
|
104
105
|
// Optimization: Only fetch count if we don't know it or filter changed?
|
|
@@ -113,11 +114,14 @@ export function ObjectView({ objectName }: ObjectViewProps) {
|
|
|
113
114
|
body: JSON.stringify({
|
|
114
115
|
op: 'count',
|
|
115
116
|
object: objectName,
|
|
116
|
-
args:
|
|
117
|
+
args: {
|
|
118
|
+
filters: filters.length > 0 ? filters : undefined
|
|
119
|
+
}
|
|
117
120
|
})
|
|
118
121
|
});
|
|
119
122
|
const countJson = await countRes.json();
|
|
120
|
-
|
|
123
|
+
// Count operation returns { count: number, '@type': string }
|
|
124
|
+
lastRow = typeof countJson === 'number' ? countJson : countJson.count;
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
params.successCallback(rows, lastRow);
|