@svadmin/elysia 0.9.0 → 0.10.1
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/package.json +2 -2
- package/src/data-provider.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/elysia",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Elysia DataProvider for svadmin — CRUD convention + InferResourceMap type utility",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
|
-
"@svadmin/core": "^0.
|
|
19
|
+
"@svadmin/core": "^0.19.3",
|
|
20
20
|
"elysia": ">=1.0.0",
|
|
21
21
|
"@elysiajs/eden": ">=1.0.0"
|
|
22
22
|
},
|
package/src/data-provider.ts
CHANGED
|
@@ -76,14 +76,14 @@ async function request<T>(url: string, headers: Record<string, string>, init?: R
|
|
|
76
76
|
*/
|
|
77
77
|
function defaultParseListResponse<T>(json: unknown): { data: T[]; total: number } {
|
|
78
78
|
if (Array.isArray(json)) {
|
|
79
|
-
return { data: json as T[], total: json.length };
|
|
79
|
+
return { data: json as unknown as T[], total: json.length };
|
|
80
80
|
}
|
|
81
81
|
const obj = json as Record<string, unknown>;
|
|
82
82
|
if (Array.isArray(obj.items)) {
|
|
83
|
-
return { data: obj.items as T[], total: obj.total !== undefined ? Number(obj.total) : obj.items.length };
|
|
83
|
+
return { data: obj.items as unknown as T[], total: obj.total !== undefined ? Number(obj.total) : obj.items.length };
|
|
84
84
|
}
|
|
85
85
|
if (Array.isArray(obj.data)) {
|
|
86
|
-
return { data: obj.data as T[], total: obj.total !== undefined ? Number(obj.total) : obj.data.length };
|
|
86
|
+
return { data: obj.data as unknown as T[], total: obj.total !== undefined ? Number(obj.total) : obj.data.length };
|
|
87
87
|
}
|
|
88
88
|
throw new Error('Unrecognized list response format. Expected { items, total }, { data, total }, or an array.');
|
|
89
89
|
}
|