pl-fe: steal more dashboard code from mastodon
Signed-off-by: Nicole Mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -4411,7 +4411,7 @@ class PlApiClient {
|
||||
getRetention: async (start_at: string, end_at: string, frequency: 'day' | 'month') => {
|
||||
const response = await this.request('/api/v1/admin/retention', { method: 'POST', params: { start_at, end_at, frequency } });
|
||||
|
||||
return v.parse(adminCohortSchema, response.json);
|
||||
return v.parse(filteredArray(adminCohortSchema), response.json);
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ const adminCohortSchema = v.object({
|
||||
data: v.array(v.object({
|
||||
date: datetimeSchema,
|
||||
rate: v.number(),
|
||||
value: v.pipe(v.number(), v.integer()),
|
||||
value: v.pipe(v.unknown(), v.transform(Number)),
|
||||
})),
|
||||
});
|
||||
|
||||
|
||||
@ -6,13 +6,13 @@ import * as v from 'valibot';
|
||||
*/
|
||||
const adminDimensionSchema = v.object({
|
||||
key: v.string(),
|
||||
data: v.object({
|
||||
data: v.array(v.object({
|
||||
key: v.string(),
|
||||
human_key: v.string(),
|
||||
value: v.string(),
|
||||
unit: v.fallback(v.optional(v.string()), undefined),
|
||||
human_value: v.fallback(v.optional(v.string()), undefined),
|
||||
}),
|
||||
})),
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pl-api",
|
||||
"version": "1.0.0-rc.57",
|
||||
"version": "1.0.0-rc.58",
|
||||
"type": "module",
|
||||
"homepage": "https://github.com/mkljczk/pl-fe/tree/develop/packages/pl-api",
|
||||
"repository": {
|
||||
|
||||
Reference in New Issue
Block a user