stackpress
Version:
Incept is a content management framework.
117 lines (116 loc) • 2.66 kB
TypeScript
import type { Method, UnknownNest } from '@stackpress/lib/types';
import type { Data } from '@stackpress/idea-parser/types';
import type { LanguageConfig } from '../language/types.js';
import type { ViewConfig, BrandConfig } from '../view/types.js';
import type { Profile } from '../session/types.js';
export type ApiType = 'public' | 'app' | 'session';
export type APIType = ApiType;
export type ApiConfigProps = {
language: LanguageConfig;
view: ViewConfig;
brand: BrandConfig;
api: ApiConfig;
};
export type ApiOauthInputProps = {
client_id: string;
scope: string;
state: string;
redirect_uri: string;
};
export type ApiOauthFormProps = {
appName: string;
revert: string;
items: {
id: string;
icon: string | undefined;
name: string;
description: string;
}[];
};
export type Scopes = Record<string, {
icon?: string;
name: string;
description: string;
}>;
export type ApiEndpoint = {
name?: string;
description?: string;
example?: string;
method: Method;
route: string;
type: ApiType;
scopes?: string[];
cors?: boolean | string | string[];
event: string;
priority?: number;
data: Record<string, Data>;
};
export type ApiScope = {
icon?: string;
name: string;
description: string;
};
export type ApiWebhook = {
event: string;
uri: string;
method: Method;
validity: UnknownNest;
data: UnknownNest;
};
export type ApiConfig = {
expires?: number;
webhooks?: ApiWebhook[];
scopes?: Record<string, ApiScope>;
endpoints?: ApiEndpoint[];
};
export type Application = {
id: string;
name: string;
logo?: string;
website?: string;
secret: string;
scopes: string[];
active: boolean;
expires: Date;
created: Date;
updated: Date;
};
export type ApplicationExtended = Application;
export type ApplicationInput = {
id?: string;
name: string;
logo?: string;
website?: string;
secret?: string;
scopes?: string[];
active?: boolean;
expires: Date;
created?: Date;
updated?: Date;
};
export type Session = {
id: string;
applicationId: string;
profileId: string;
secret: string;
scopes: string[];
active: boolean;
expires: Date;
created: Date;
updated: Date;
};
export type SessionExtended = Session & {
application: Application;
profile: Profile;
};
export type SessionInput = {
id?: string;
applicationId: string;
profileId: string;
secret?: string;
scopes?: string[];
active?: boolean;
expires: Date;
created?: Date;
updated?: Date;
};