diff --git a/packages/pl-api/lib/entities/admin/account.ts b/packages/pl-api/lib/entities/admin/account.ts index 7d5274dc6..6aee599f7 100644 --- a/packages/pl-api/lib/entities/admin/account.ts +++ b/packages/pl-api/lib/entities/admin/account.ts @@ -6,7 +6,10 @@ import { datetimeSchema, filteredArray } from '../utils'; import { adminIpSchema } from './ip'; -/** @see {@link https://docs.joinmastodon.org/entities/Admin_Account/} */ +/** + * @category Admin schemas + * @see {@link https://docs.joinmastodon.org/entities/Admin_Account/} + */ const adminAccountSchema = v.pipe( v.any(), v.transform((account: any) => { @@ -65,6 +68,9 @@ const adminAccountSchema = v.pipe( }), ); +/** + * @category Admin types + */ type AdminAccount = v.InferOutput; export { diff --git a/packages/pl-api/lib/entities/admin/announcement.ts b/packages/pl-api/lib/entities/admin/announcement.ts index 93d9bca26..41310b72d 100644 --- a/packages/pl-api/lib/entities/admin/announcement.ts +++ b/packages/pl-api/lib/entities/admin/announcement.ts @@ -3,7 +3,10 @@ import * as v from 'valibot'; import { announcementSchema } from '../announcement'; -/** @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#get-apiv1pleromaadminannouncements} */ +/** + * @category Admin schemas + * @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#get-apiv1pleromaadminannouncements} + */ const adminAnnouncementSchema = v.pipe( v.any(), v.transform((announcement: any) => ({ @@ -16,6 +19,9 @@ const adminAnnouncementSchema = v.pipe( }), ); +/** + * @category Admin types + */ type AdminAnnouncement = v.InferOutput; export { adminAnnouncementSchema, type AdminAnnouncement }; diff --git a/packages/pl-api/lib/entities/admin/canonical-email-block.ts b/packages/pl-api/lib/entities/admin/canonical-email-block.ts index 2394bb44b..b086b4e7a 100644 --- a/packages/pl-api/lib/entities/admin/canonical-email-block.ts +++ b/packages/pl-api/lib/entities/admin/canonical-email-block.ts @@ -1,11 +1,17 @@ import * as v from 'valibot'; -/** @see {@link https://docs.joinmastodon.org/entities/Admin_CanonicalEmailBlock/} */ +/** + * @category Admin schemas + * @see {@link https://docs.joinmastodon.org/entities/Admin_CanonicalEmailBlock/} + */ const adminCanonicalEmailBlockSchema = v.object({ id: v.string(), canonical_email_hash: v.string(), }); +/** + * @category Admin types + */ type AdminCanonicalEmailBlock = v.InferOutput; export { diff --git a/packages/pl-api/lib/entities/admin/cohort.ts b/packages/pl-api/lib/entities/admin/cohort.ts index c536f107b..af31b394e 100644 --- a/packages/pl-api/lib/entities/admin/cohort.ts +++ b/packages/pl-api/lib/entities/admin/cohort.ts @@ -2,7 +2,10 @@ import * as v from 'valibot'; import { datetimeSchema } from '../utils'; -/** @see {@link https://docs.joinmastodon.org/entities/Admin_Cohort/} */ +/** + * @category Admin schemas + * @see {@link https://docs.joinmastodon.org/entities/Admin_Cohort/} + */ const adminCohortSchema = v.object({ period: datetimeSchema, frequency: v.picklist(['day', 'month']), @@ -13,6 +16,9 @@ const adminCohortSchema = v.object({ })), }); +/** + * @category Admin types + */ type AdminCohort = v.InferOutput; export { diff --git a/packages/pl-api/lib/entities/admin/dimension.ts b/packages/pl-api/lib/entities/admin/dimension.ts index b382da6a7..f01a5f997 100644 --- a/packages/pl-api/lib/entities/admin/dimension.ts +++ b/packages/pl-api/lib/entities/admin/dimension.ts @@ -1,6 +1,9 @@ import * as v from 'valibot'; -/** @see {@link https://docs.joinmastodon.org/entities/Admin_Dimension/} */ +/** + * @category Admin schemas + * @see {@link https://docs.joinmastodon.org/entities/Admin_Dimension/} + */ const adminDimensionSchema = v.object({ key: v.string(), data: v.object({ @@ -12,6 +15,9 @@ const adminDimensionSchema = v.object({ }), }); +/** + * @category Admin types + */ type AdminDimension = v.InferOutput; export { diff --git a/packages/pl-api/lib/entities/admin/domain-allow.ts b/packages/pl-api/lib/entities/admin/domain-allow.ts index 5024d2b12..e8a95d6be 100644 --- a/packages/pl-api/lib/entities/admin/domain-allow.ts +++ b/packages/pl-api/lib/entities/admin/domain-allow.ts @@ -2,13 +2,19 @@ import * as v from 'valibot'; import { datetimeSchema } from '../utils'; -/** @see {@link https://docs.joinmastodon.org/entities/Admin_DomainAllow/} */ +/** + * @category Admin schemas + * @see {@link https://docs.joinmastodon.org/entities/Admin_DomainAllow/} + */ const adminDomainAllowSchema = v.object({ id: v.string(), domain: v.string(), created_at: datetimeSchema, }); +/** + * @category Admin types + */ type AdminDomainAllow = v.InferOutput; export { diff --git a/packages/pl-api/lib/entities/admin/domain-block.ts b/packages/pl-api/lib/entities/admin/domain-block.ts index 0dca14241..186d559d2 100644 --- a/packages/pl-api/lib/entities/admin/domain-block.ts +++ b/packages/pl-api/lib/entities/admin/domain-block.ts @@ -2,7 +2,10 @@ import * as v from 'valibot'; import { datetimeSchema } from '../utils'; -/** @see {@link https://docs.joinmastodon.org/entities/Admin_DomainBlock/} */ +/** + * @category Admin schemas + * @see {@link https://docs.joinmastodon.org/entities/Admin_DomainBlock/} + */ const adminDomainBlockSchema = v.object({ id: v.string(), domain: v.string(), @@ -16,6 +19,9 @@ const adminDomainBlockSchema = v.object({ obfuscate: v.boolean(), }); +/** + * @category Admin types + */ type AdminDomainBlock = v.InferOutput; export { diff --git a/packages/pl-api/lib/entities/admin/domain.ts b/packages/pl-api/lib/entities/admin/domain.ts index f0b566670..ad117483f 100644 --- a/packages/pl-api/lib/entities/admin/domain.ts +++ b/packages/pl-api/lib/entities/admin/domain.ts @@ -10,6 +10,9 @@ const adminDomainSchema = v.object({ last_checked_at: v.fallback(v.nullable(datetimeSchema), null), }); +/** + * @category Admin types + */ type AdminDomain = v.InferOutput export { adminDomainSchema, type AdminDomain }; diff --git a/packages/pl-api/lib/entities/admin/email-domain-block.ts b/packages/pl-api/lib/entities/admin/email-domain-block.ts index 724f44bb0..917b5005c 100644 --- a/packages/pl-api/lib/entities/admin/email-domain-block.ts +++ b/packages/pl-api/lib/entities/admin/email-domain-block.ts @@ -2,7 +2,10 @@ import * as v from 'valibot'; import { datetimeSchema } from '../utils'; -/** @see {@link https://docs.joinmastodon.org/entities/Admin_EmailDomainBlock/} */ +/** + * @category Admin schemas + * @see {@link https://docs.joinmastodon.org/entities/Admin_EmailDomainBlock/} + */ const adminEmailDomainBlockSchema = v.object({ id: v.string(), domain: v.string(), @@ -14,6 +17,9 @@ const adminEmailDomainBlockSchema = v.object({ })), }); +/** + * @category Admin types + */ type AdminEmailDomainBlock = v.InferOutput; export { diff --git a/packages/pl-api/lib/entities/admin/ip-block.ts b/packages/pl-api/lib/entities/admin/ip-block.ts index 1a3a62108..de764e264 100644 --- a/packages/pl-api/lib/entities/admin/ip-block.ts +++ b/packages/pl-api/lib/entities/admin/ip-block.ts @@ -2,7 +2,10 @@ import * as v from 'valibot'; import { datetimeSchema } from '../utils'; -/** @see {@link https://docs.joinmastodon.org/entities/Admin_IpBlock/} */ +/** + * @category Admin schemas + * @see {@link https://docs.joinmastodon.org/entities/Admin_IpBlock/} + */ const adminIpBlockSchema = v.object({ id: v.string(), ip: v.pipe(v.string(), v.ip()), @@ -12,6 +15,9 @@ const adminIpBlockSchema = v.object({ expires_at: v.fallback(v.nullable(datetimeSchema), null), }); +/** + * @category Admin types + */ type AdminIpBlock = v.InferOutput; export { diff --git a/packages/pl-api/lib/entities/admin/ip.ts b/packages/pl-api/lib/entities/admin/ip.ts index f1adce518..c77dc5d4c 100644 --- a/packages/pl-api/lib/entities/admin/ip.ts +++ b/packages/pl-api/lib/entities/admin/ip.ts @@ -2,12 +2,18 @@ import * as v from 'valibot'; import { datetimeSchema } from '../utils'; -/** @see {@link https://docs.joinmastodon.org/entities/Admin_Ip/} */ +/** + * @category Admin schemas + * @see {@link https://docs.joinmastodon.org/entities/Admin_Ip/} + */ const adminIpSchema = v.object({ ip: v.pipe(v.string(), v.ip()), used_at: datetimeSchema, }); +/** + * @category Admin types + */ type AdminIp = v.InferOutput; export { diff --git a/packages/pl-api/lib/entities/admin/measure.ts b/packages/pl-api/lib/entities/admin/measure.ts index fed8a988f..296abfc43 100644 --- a/packages/pl-api/lib/entities/admin/measure.ts +++ b/packages/pl-api/lib/entities/admin/measure.ts @@ -2,7 +2,10 @@ import * as v from 'valibot'; import { datetimeSchema } from '../utils'; -/** @see {@link https://docs.joinmastodon.org/entities/Admin_Measure/} */ +/** + * @category Admin schemas + * @see {@link https://docs.joinmastodon.org/entities/Admin_Measure/} + */ const adminMeasureSchema = v.object({ key: v.string(), unit: v.fallback(v.nullable(v.string()), null), @@ -15,6 +18,9 @@ const adminMeasureSchema = v.object({ })), }); +/** + * @category Admin types + */ type AdminMeasure = v.InferOutput; export { diff --git a/packages/pl-api/lib/entities/admin/moderation-log-entry.ts b/packages/pl-api/lib/entities/admin/moderation-log-entry.ts index 81300d5c3..3b8b1b9bd 100644 --- a/packages/pl-api/lib/entities/admin/moderation-log-entry.ts +++ b/packages/pl-api/lib/entities/admin/moderation-log-entry.ts @@ -1,6 +1,9 @@ import * as v from 'valibot'; -/** @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#get-apiv1pleromaadminmoderation_log} */ +/** + * @category Admin schemas + * @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#get-apiv1pleromaadminmoderation_log} + */ const adminModerationLogEntrySchema = v.object({ id: v.pipe(v.unknown(), v.transform(String)), data: v.fallback(v.record(v.string(), v.any()), {}), @@ -8,6 +11,9 @@ const adminModerationLogEntrySchema = v.object({ message: v.fallback(v.string(), ''), }); +/** + * @category Admin types + */ type AdminModerationLogEntry = v.InferOutput export { adminModerationLogEntrySchema, type AdminModerationLogEntry }; diff --git a/packages/pl-api/lib/entities/admin/pleroma-config.ts b/packages/pl-api/lib/entities/admin/pleroma-config.ts index e55e936fd..8dd089506 100644 --- a/packages/pl-api/lib/entities/admin/pleroma-config.ts +++ b/packages/pl-api/lib/entities/admin/pleroma-config.ts @@ -1,7 +1,7 @@ import * as v from 'valibot'; /** - * @category Schemas + * @category Admin schemas */ const pleromaConfigSchema = v.object({ configs: v.array(v.object({ @@ -12,6 +12,9 @@ const pleromaConfigSchema = v.object({ need_reboot: v.boolean(), }); +/** + * @category Admin types + */ type PleromaConfig = v.InferOutput export { pleromaConfigSchema, type PleromaConfig }; diff --git a/packages/pl-api/lib/entities/admin/relay.ts b/packages/pl-api/lib/entities/admin/relay.ts index e5d4e6993..a4b48baaf 100644 --- a/packages/pl-api/lib/entities/admin/relay.ts +++ b/packages/pl-api/lib/entities/admin/relay.ts @@ -10,6 +10,9 @@ const adminRelaySchema = v.pipe( }), ); +/** + * @category Admin types + */ type AdminRelay = v.InferOutput export { adminRelaySchema, type AdminRelay }; diff --git a/packages/pl-api/lib/entities/admin/report.ts b/packages/pl-api/lib/entities/admin/report.ts index 6a0526f75..bdfda3f5d 100644 --- a/packages/pl-api/lib/entities/admin/report.ts +++ b/packages/pl-api/lib/entities/admin/report.ts @@ -7,7 +7,10 @@ import { datetimeSchema, filteredArray } from '../utils'; import { adminAccountSchema } from './account'; -/** @see {@link https://docs.joinmastodon.org/entities/Admin_Report/} */ +/** + * @category Admin schemas + * @see {@link https://docs.joinmastodon.org/entities/Admin_Report/} + */ const adminReportSchema = v.pipe( v.any(), v.transform((report: any) => { @@ -45,6 +48,9 @@ const adminReportSchema = v.pipe( }), ); +/** + * @category Admin types + */ type AdminReport = v.InferOutput; export { adminReportSchema, type AdminReport }; diff --git a/packages/pl-api/lib/entities/admin/rule.ts b/packages/pl-api/lib/entities/admin/rule.ts index 41838af6a..e8803d83a 100644 --- a/packages/pl-api/lib/entities/admin/rule.ts +++ b/packages/pl-api/lib/entities/admin/rule.ts @@ -1,6 +1,9 @@ import * as v from 'valibot'; -/** @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#get-apiv1pleromaadminrules} */ +/** + * @category Admin schemas + * @see {@link https://docs.pleroma.social/backend/development/API/admin_api/#get-apiv1pleromaadminrules} + */ const adminRuleSchema = v.object({ id: v.string(), text: v.fallback(v.string(), ''), @@ -8,6 +11,9 @@ const adminRuleSchema = v.object({ priority: v.fallback(v.nullable(v.number()), null), }); +/** + * @category Admin types + */ type AdminRule = v.InferOutput; export { adminRuleSchema, type AdminRule }; diff --git a/packages/pl-api/lib/entities/admin/tag.ts b/packages/pl-api/lib/entities/admin/tag.ts index aaa2818f6..44dedb9f1 100644 --- a/packages/pl-api/lib/entities/admin/tag.ts +++ b/packages/pl-api/lib/entities/admin/tag.ts @@ -2,7 +2,10 @@ import * as v from 'valibot'; import { tagSchema } from '../tag'; -/** @see {@link https://docs.joinmastodon.org/entities/Tag/#admin} */ +/** + * @category Admin schemas + * @see {@link https://docs.joinmastodon.org/entities/Tag/#admin} + */ const adminTagSchema = v.object({ ...tagSchema.entries, id: v.string(), @@ -11,6 +14,9 @@ const adminTagSchema = v.object({ requires_review: v.boolean(), }); +/** + * @category Admin types + */ type AdminTag = v.InferOutput; export { diff --git a/packages/pl-api/lib/entities/directory/category.ts b/packages/pl-api/lib/entities/directory/category.ts index c9dbca386..c80d69131 100644 --- a/packages/pl-api/lib/entities/directory/category.ts +++ b/packages/pl-api/lib/entities/directory/category.ts @@ -1,10 +1,16 @@ import * as v from 'valibot'; +/** + * @category Directory schemas + */ const directoryCategorySchema = v.object({ category: v.string(), servers_count: v.fallback(v.nullable(v.pipe(v.unknown(), v.transform(Number))), null), }); +/** + * @category Directory types + */ type DirectoryCategory = v.InferOutput; export { directoryCategorySchema, type DirectoryCategory }; diff --git a/packages/pl-api/lib/entities/directory/language.ts b/packages/pl-api/lib/entities/directory/language.ts index 346873325..4e7c9bb92 100644 --- a/packages/pl-api/lib/entities/directory/language.ts +++ b/packages/pl-api/lib/entities/directory/language.ts @@ -1,11 +1,17 @@ import * as v from 'valibot'; +/** + * @category Directory schemas + */ const directoryLanguageSchema = v.object({ locale: v.string(), language: v.string(), servers_count: v.fallback(v.nullable(v.pipe(v.unknown(), v.transform(Number))), null), }); +/** + * @category Directory types + */ type DirectoryLanguage = v.InferOutput; export { directoryLanguageSchema, type DirectoryLanguage }; diff --git a/packages/pl-api/lib/entities/directory/server.ts b/packages/pl-api/lib/entities/directory/server.ts index ef8ea1b12..a0589b29f 100644 --- a/packages/pl-api/lib/entities/directory/server.ts +++ b/packages/pl-api/lib/entities/directory/server.ts @@ -1,5 +1,8 @@ import * as v from 'valibot'; +/** + * @category Directory schemas + */ const directoryServerSchema = v.object({ domain: v.string(), version: v.string(), @@ -16,6 +19,9 @@ const directoryServerSchema = v.object({ category: v.string(), }); +/** + * @category Directory types + */ type DirectoryServer = v.InferOutput; export { directoryServerSchema, type DirectoryServer }; diff --git a/packages/pl-api/lib/entities/directory/statistics-period.ts b/packages/pl-api/lib/entities/directory/statistics-period.ts index ea37a321d..f97642e6f 100644 --- a/packages/pl-api/lib/entities/directory/statistics-period.ts +++ b/packages/pl-api/lib/entities/directory/statistics-period.ts @@ -1,5 +1,8 @@ import * as v from 'valibot'; +/** + * @category Directory schemas + */ const directoryStatisticsPeriodSchema = v.object({ period: v.pipe(v.string(), v.isoDate()), server_count: v.fallback(v.nullable(v.pipe(v.unknown(), v.transform(Number))), null), @@ -7,6 +10,9 @@ const directoryStatisticsPeriodSchema = v.object({ active_user_count: v.fallback(v.nullable(v.pipe(v.unknown(), v.transform(Number))), null), }); +/** + * @category Directory types + */ type DirectoryStatisticsPeriod = v.InferOutput; export { directoryStatisticsPeriodSchema, type DirectoryStatisticsPeriod }; diff --git a/packages/pl-api/lib/params/grouped-notifications.ts b/packages/pl-api/lib/params/grouped-notifications.ts index 165b98f0d..a46ab2024 100644 --- a/packages/pl-api/lib/params/grouped-notifications.ts +++ b/packages/pl-api/lib/params/grouped-notifications.ts @@ -1,5 +1,8 @@ import type { PaginationParams } from './common'; +/** + * @category Request params + */ interface GetGroupedNotificationsParams extends PaginationParams { /** Types to include in the result. */ types?: Array; @@ -15,6 +18,9 @@ interface GetGroupedNotificationsParams extends PaginationParams { include_filtered?: boolean; } +/** + * @category Request params + */ interface GetUnreadNotificationGroupCountParams { /** Maximum number of results to return. Defaults to 100 notifications. Max 1000 notifications. */ limit?: number; diff --git a/packages/pl-api/lib/responses.ts b/packages/pl-api/lib/responses.ts index 4a44ad3a5..fc5f528fa 100644 --- a/packages/pl-api/lib/responses.ts +++ b/packages/pl-api/lib/responses.ts @@ -1,3 +1,6 @@ +/** + * @category Utils + */ interface PaginatedResponse { previous: (() => Promise>) | null; next: (() => Promise>) | null;