2024-10-13 15:25:30 -07:00
|
|
|
import * as v from 'valibot';
|
2024-08-28 04:43:23 -07:00
|
|
|
|
2024-10-16 08:03:27 -07:00
|
|
|
import { datetimeSchema, mimeSchema } from './utils';
|
2024-08-28 04:43:23 -07:00
|
|
|
|
2024-10-29 14:26:53 -07:00
|
|
|
/**
|
|
|
|
* @category Schemas
|
|
|
|
* @see {@link https://docs.pleroma.social/backend/development/API/pleroma_api/#post-apiv1pleromabackups}
|
|
|
|
*/
|
2024-10-13 15:25:30 -07:00
|
|
|
const backupSchema = v.object({
|
2024-10-14 13:50:34 -07:00
|
|
|
id: v.pipe(v.unknown(), v.transform(String)),
|
2024-12-05 02:34:58 -08:00
|
|
|
content_type: mimeSchema,
|
2024-10-13 15:25:30 -07:00
|
|
|
file_size: v.fallback(v.number(), 0),
|
2024-10-16 08:03:27 -07:00
|
|
|
inserted_at: datetimeSchema,
|
2024-10-13 15:25:30 -07:00
|
|
|
processed: v.fallback(v.boolean(), false),
|
|
|
|
url: v.fallback(v.string(), ''),
|
2024-08-28 04:43:23 -07:00
|
|
|
});
|
|
|
|
|
2024-11-29 07:01:54 -08:00
|
|
|
/**
|
|
|
|
* @category Entity types
|
|
|
|
*/
|
2024-10-13 15:25:30 -07:00
|
|
|
type Backup = v.InferOutput<typeof backupSchema>;
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
export { backupSchema, type Backup };
|