@@ -1,6 +1,8 @@
|
||||
import * as v from 'valibot';
|
||||
|
||||
import { filterSchema } from './filter';
|
||||
import { baseFilterSchema } from './filter';
|
||||
|
||||
const filterSchema = v.omit(baseFilterSchema, ['keywords', 'statuses']);
|
||||
|
||||
/**
|
||||
* @category Schemas
|
||||
|
||||
@@ -21,6 +21,16 @@ const filterStatusSchema = v.object({
|
||||
status_id: v.string(),
|
||||
});
|
||||
|
||||
const baseFilterSchema = v.object({
|
||||
id: v.string(),
|
||||
title: v.string(),
|
||||
context: v.array(v.picklist(['home', 'notifications', 'public', 'thread', 'account'])),
|
||||
expires_at: v.fallback(v.nullable(datetimeSchema), null),
|
||||
filter_action: v.fallback(v.picklist(['warn', 'hide', 'blur']), 'warn'),
|
||||
keywords: filteredArray(filterKeywordSchema),
|
||||
statuses: filteredArray(filterStatusSchema),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Schemas
|
||||
* @see {@link https://docs.joinmastodon.org/entities/Filter/}
|
||||
@@ -42,15 +52,7 @@ const filterSchema = v.pipe(
|
||||
}
|
||||
return filter;
|
||||
}),
|
||||
v.object({
|
||||
id: v.string(),
|
||||
title: v.string(),
|
||||
context: v.array(v.picklist(['home', 'notifications', 'public', 'thread', 'account'])),
|
||||
expires_at: v.fallback(v.nullable(datetimeSchema), null),
|
||||
filter_action: v.fallback(v.picklist(['warn', 'hide', 'blur']), 'warn'),
|
||||
keywords: v.optional(filteredArray(filterKeywordSchema), undefined),
|
||||
statuses: v.optional(filteredArray(filterStatusSchema), undefined),
|
||||
}),
|
||||
baseFilterSchema,
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -58,4 +60,4 @@ const filterSchema = v.pipe(
|
||||
*/
|
||||
type Filter = v.InferOutput<typeof filterSchema>;
|
||||
|
||||
export { filterKeywordSchema, filterStatusSchema, filterSchema, type Filter };
|
||||
export { filterKeywordSchema, filterStatusSchema, baseFilterSchema, filterSchema, type Filter };
|
||||
|
||||
19
packages/pl-api/lib/entities/privacy-policy.ts
Normal file
19
packages/pl-api/lib/entities/privacy-policy.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import * as v from 'valibot';
|
||||
|
||||
import { datetimeSchema } from './utils';
|
||||
|
||||
/**
|
||||
* @category Schemas
|
||||
* @see {@link https://docs.joinmastodon.org/entities/PrivacyPolicy/}
|
||||
*/
|
||||
const privacyPolicySchema = v.object({
|
||||
updated_at: datetimeSchema,
|
||||
content: v.string(),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Entity types
|
||||
*/
|
||||
type PrivacyPolicy = v.InferOutput<typeof privacyPolicySchema>;
|
||||
|
||||
export { privacyPolicySchema, type PrivacyPolicy };
|
||||
21
packages/pl-api/lib/entities/terms-of-service.ts
Normal file
21
packages/pl-api/lib/entities/terms-of-service.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as v from 'valibot';
|
||||
|
||||
import { dateSchema } from './utils';
|
||||
|
||||
/**
|
||||
* @category Schemas
|
||||
* @see {@link https://docs.joinmastodon.org/entities/TermfsOfService/}
|
||||
*/
|
||||
const termfsOfServiceSchema = v.object({
|
||||
effective_date: dateSchema,
|
||||
effective: v.boolean(),
|
||||
content: v.string(),
|
||||
succeeded_by: v.fallback(v.nullable(dateSchema), null),
|
||||
});
|
||||
|
||||
/**
|
||||
* @category Entity types
|
||||
*/
|
||||
type TermfsOfService = v.InferOutput<typeof termfsOfServiceSchema>;
|
||||
|
||||
export { termfsOfServiceSchema, type TermfsOfService };
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pl-api",
|
||||
"version": "1.0.0-rc.68",
|
||||
"version": "1.0.0-rc.69",
|
||||
"type": "module",
|
||||
"homepage": "https://github.com/mkljczk/pl-fe/tree/develop/packages/pl-api",
|
||||
"repository": {
|
||||
|
||||
Reference in New Issue
Block a user