2024-10-13 15:25:30 -07:00
|
|
|
import * as v from 'valibot';
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
/** @see {@link https://docs.joinmastodon.org/entities/WebPushSubscription/} */
|
2024-10-13 15:25:30 -07:00
|
|
|
const webPushSubscriptionSchema = v.object({
|
2024-10-14 13:50:34 -07:00
|
|
|
id: v.pipe(v.unknown(), v.transform(String)),
|
2024-10-13 15:25:30 -07:00
|
|
|
endpoint: v.string(),
|
2024-10-14 13:50:34 -07:00
|
|
|
alerts: v.record(v.string(), v.boolean()),
|
2024-10-13 15:25:30 -07:00
|
|
|
server_key: v.string(),
|
2024-08-28 04:43:23 -07:00
|
|
|
});
|
|
|
|
|
2024-10-13 15:25:30 -07:00
|
|
|
type WebPushSubscription = v.InferOutput<typeof webPushSubscriptionSchema>;
|
2024-08-28 04:43:23 -07:00
|
|
|
|
|
|
|
export { webPushSubscriptionSchema, type WebPushSubscription };
|