refactor(schema): simplify validation and OpenAPI generation (#2709)

This commit is contained in:
Hampus
2026-09-11 23:24:26 +02:00
committed by GitHub
parent 4bc5593f9f
commit de1fd95a99
510 changed files with 29494 additions and 36131 deletions
+3 -1
View File
@@ -11,7 +11,9 @@
"typecheck": "tsgo --noEmit"
},
"dependencies": {
"@fluxer/limits": "workspace:*"
"@fluxer/constants": "workspace:*",
"@fluxer/limits": "workspace:*",
"@fluxer/schema": "workspace:*"
},
"devDependencies": {
"@types/node": "catalog:",
+3 -5
View File
@@ -1,9 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import ageGeos from '@fluxer/constants/src/AgeGeos.json' with {type: 'json'};
import type {GeoEntry} from './Types';
export const AGE_RESTRICTED_GEOS: ReadonlyArray<GeoEntry> = [
{countryCode: 'GB', regionCode: null},
{countryCode: 'BR', regionCode: null},
];
export const AGE_BLOCKED_GEOS: ReadonlyArray<GeoEntry> = [{countryCode: 'US', regionCode: 'MS'}];
export const AGE_RESTRICTED_GEOS: ReadonlyArray<GeoEntry> = ageGeos.ageRestrictedGeos;
export const AGE_BLOCKED_GEOS: ReadonlyArray<GeoEntry> = ageGeos.ageBlockedGeos;
+20 -114
View File
@@ -1,125 +1,31 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import type {LimitConfigSnapshot, LimitConfigWireFormat} from '@fluxer/limits/src/LimitTypes';
import type {
GeoEntry,
GeolocationResponse as GeolocationWireResponse,
} from '@fluxer/schema/src/domains/geolocation/GeolocationSchemas';
import type {WellKnownFluxerResponse} from '@fluxer/schema/src/domains/instance/InstanceSchemas';
export interface InstanceEndpoints {
api: string;
api_client: string;
api_public: string;
gateway: string;
media: string;
static_cdn: string;
marketing: string;
admin: string;
invite: string;
gift: string;
webapp: string;
}
export type {GeoEntry} from '@fluxer/schema/src/domains/geolocation/GeolocationSchemas';
export type {
InstanceAppPublic,
InstanceCaptcha,
InstanceCommunity,
InstanceEndpoints,
InstanceFeatures,
InstanceGif,
InstancePush,
InstanceRegistration,
InstanceServices,
InstanceSso,
} from '@fluxer/schema/src/domains/instance/InstanceSchemas';
export interface InstanceCaptcha {
provider: 'hcaptcha' | 'turnstile' | 'none';
hcaptcha_site_key: string | null;
turnstile_site_key: string | null;
}
export interface InstanceFeatures {
voice_enabled: boolean;
stripe_enabled: boolean;
self_hosted: boolean;
presigned_attachment_uploads: boolean;
emails_enabled: boolean;
}
export interface InstanceGif {
provider: string;
display_name: string;
attribution_required: boolean;
}
export interface InstanceSso {
enabled: boolean;
enforced: boolean;
display_name: string | null;
redirect_uri: string;
}
export interface InstanceRegistration {
mode: 'open' | 'approval' | 'closed';
admin_registration_urls_enabled: boolean;
}
export interface InstanceCommunity {
single_community: boolean;
single_community_guild_id: string | null;
direct_messages_disabled: boolean;
}
export interface InstanceServices {
gif_enabled: boolean;
youtube_enabled: boolean;
bluesky_enabled: boolean;
}
export interface InstancePush {
public_vapid_key: string | null;
}
export interface InstanceBranding {
product_name: string;
icon_url: string | null;
symbol_url: string | null;
logo_url: string | null;
wordmark_url: string | null;
favicon_url: string | null;
theme_color: string | null;
}
export interface InstanceSetup {
configured: boolean;
admin_url: string | null;
}
export interface InstanceLegal {
terms_url: string | null;
privacy_url: string | null;
}
export interface InstanceAppRegistration {
collect_date_of_birth: boolean;
}
export interface InstanceAppPublic {
branding: InstanceBranding;
setup: InstanceSetup;
legal: InstanceLegal;
registration: InstanceAppRegistration;
}
export interface InstanceDiscoveryResponse {
api_code_version: number;
endpoints: InstanceEndpoints;
captcha: InstanceCaptcha;
features: InstanceFeatures;
gif: InstanceGif;
sso: InstanceSso;
registration: InstanceRegistration;
community: InstanceCommunity;
services: InstanceServices;
export interface InstanceDiscoveryResponse extends Omit<WellKnownFluxerResponse, 'limits'> {
limits: LimitConfigSnapshot | LimitConfigWireFormat;
push: InstancePush;
app_public: InstanceAppPublic;
}
export interface GeoEntry {
countryCode: string;
regionCode: string | null;
}
export interface GeolocationResponse {
countryCode: string | null;
regionCode: string | null;
latitude: string | null;
longitude: string | null;
export interface GeolocationResponse extends Omit<GeolocationWireResponse, 'ageRestrictedGeos' | 'ageBlockedGeos'> {
ageRestrictedGeos: ReadonlyArray<GeoEntry>;
ageBlockedGeos: ReadonlyArray<GeoEntry>;
}