chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:28:13 +08:00
commit 0878425be3
1160 changed files with 491311 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
export const baseUrl = '/api/v1';
+34
View File
@@ -0,0 +1,34 @@
import type { User } from './User';
export interface AuthInfo {
develop?: boolean;
expires_at?: string;
issued_at?: string;
oauth?: boolean;
privileges?: string[];
providers?: string[];
role?: Role;
type: AuthInfoType;
user?: User;
}
export interface AuthInfoResponse {
data?: AuthInfo;
error?: string;
status: AuthResponseStatus;
}
export type AuthInfoType = 'guest' | 'user';
export interface AuthLoginResponse {
data?: unknown;
error?: string;
status: AuthResponseStatus;
}
export type AuthResponseStatus = 'error' | 'success';
export interface Role {
id: number;
name: string;
}
+43
View File
@@ -0,0 +1,43 @@
import { ProviderType } from '@/graphql/types';
export interface Provider {
name: string;
type: ProviderType;
}
/**
* Generates a display name for a provider
* If the name matches the type, only the name is returned
* Otherwise, returns "name - type"
*/
export const getProviderDisplayName = (provider: Provider): string => {
return provider.name;
};
/**
* Checks if a provider exists in the list of providers
*/
export const isProviderValid = (provider: Provider, providers: Provider[]): boolean => {
return providers.some((p) => p.name === provider.name && p.type === provider.type);
};
/**
* Finds a provider by name and type
*/
export const findProvider = (provider: Provider, providers: Provider[]): Provider | undefined => {
return providers.find((p) => p.name === provider.name && p.type === provider.type);
};
/**
* Finds a provider by name
*/
export const findProviderByName = (providerName: string, providers: Provider[]): Provider | undefined => {
return providers.find((provider) => provider.name === providerName);
};
/**
* Sorts providers by name alphabetically
*/
export const sortProviders = (providers: Provider[]): Provider[] => {
return [...providers].sort((a, b) => a.name.localeCompare(b.name));
};
+12
View File
@@ -0,0 +1,12 @@
export interface User {
created_at: string;
hash: string;
id: number;
mail: string;
name: string;
password_change_required: boolean;
provide: string;
role_id: number;
status: 'active' | 'blocked' | 'created';
type: 'local' | 'oauth';
}