import { AuthTypes, Categories, DataFormats, DataTypes, HttpMethods, InputsTypes, PublicStates, StatusCodes, SuccessMarkerType, TokenPeriods } from './enums'; import { IParsedInput, IParsedSample } from './inputs.types'; import { IActionRequest } from './productsBuilder.types'; import { IRequestExtension } from './requests.types'; export interface ICreateAppBuilder { app_name: string; description: string; unique?: boolean; returned?: string; /** When true, always create a new app instead of reusing an existing name match. */ forceNew?: boolean; } export interface ICreateApp extends ICreateAppBuilder { tag: string; } export interface IAppWebhook { _id?: string; name: string; tag: string; description: string; envs: IAppWebhookEnv[]; events: IAppWebhookEvent[]; } export interface IAppWebhookEnv { _id?: string; slug: string; registration_url?: string; method?: HttpMethods; sample?: IActionRequest; sample_data?: IParsedSample[]; __v?: number; } export interface IAppWebhookEvent { _id?: string; tag: string; name: string; selector: string; selectorValue?: string; description: string; sample: Record; sample_data?: IParsedSample[]; } export interface IAppAccess { access_tag: string; access: boolean; } export interface IAppAuth { _id: string; user_id: string; app_id: string; name: string; tag: string; setup_type: AuthTypes; expiry: number; period: TokenPeriods; action_tag?: string; tokens?: Omit; description: string; __v: number; } export interface IAppAuthEnv { _id?: string; setup_id?: string; env_id: string; __v?: number; base_url?: string; } /** Variable extracted from base_url (e.g. {{prefix}} in https://{{prefix}}-checkout.example.com). */ export interface IBaseUrlVariable { key: string; } export interface IAppEnv { _id?: string; env_name: string; slug: string; description?: string; whitelist?: boolean; active?: boolean; __v?: number; base_url?: string; /** Keys extracted from base_url placeholders ({{key}} or :key). Filled during integration. */ base_url_variables?: IBaseUrlVariable[]; request_type?: DataFormats; } export interface ICustomEnv { slug: string; base_url?: string; config?: Record; active: boolean; } export interface IActionUpdate { resource?: string; method?: HttpMethods; description?: string; request_type?: DataFormats; envs?: ICustomEnv[]; response?: { name?: string; tag?: string; success: boolean; body: Record | string; response_format: DataFormats; status_code: StatusCodes; }; body?: Record; query?: Record; params?: Record; headers?: Record; } export interface IAppAction { _id?: string; app_id?: string; user_id?: string; folder_id?: string; folder_level?: number; description: string; resource: string; name: string; method: HttpMethods; tag: string; request_type: DataFormats; base_url?: string; created?: Date; params?: ISample; query?: ISample; headers?: ISample; envs?: Array; body?: ISample; responses?: Array; } export interface IAppFolders { _id: string; name: string; description?: string; parent_id: string | null; level: number; } export interface IApp { _id?: string; workspace_id?: string; user_id: string; author: string; app_name: string; logo?: string; colors?: { primary?: string; secondary?: string; accent?: string; background?: string; }; tag: string; folders?: Array; get_started?: number; request_type?: string; description?: string; aboutText?: string; aboutHTML?: string; public_key?: string; private_key?: string; require_whitelist: boolean; versions: Array; status?: PublicStates; version?: string; created_at: Date; updated_at: Date; } export interface IVersion { version: string; } export interface IAppVersion { tag: string; latest: boolean; envs?: Array; folders?: Array; description?: string; active: boolean; webhooks?: Array; actions?: Array; constants?: Array; auths?: Array; variables?: Array; retries: any; actions_count?: number; events_count?: number; auths_count?: number; constants_count?: number; variables_count?: number; envs_count?: number; } export interface IAppRetryPolicy { max: number; policy: Record; } export interface IRetrySettings { available?: boolean; lag?: number; } export interface ILoginPayload { email: string; password: string; } export interface IPrivKeyLoginPayload { accessKey: string; } export interface IFetchSessionPayload { user_id: string; public_key: string; workspace_id: string; } export interface IBuilderSessionCreatePayload { private_key?: string; workspace_id: string; user_id: string; public_key: string; token: string; } export interface IAppNameExistsPayload { workspace_id: string; user_id: string; public_key: string; app_name: string; } export interface IAppActionExistsPayload { workspace_id: string; user_id: string; tag: string; } export interface IAppExistsResponse { _id: string; } export interface IBuilderSession extends IBuilderSessionCreatePayload { } export interface IUserAuthResponse { auth_token: string; public_key: string; user_id: string; workspace_id: string; active: boolean; } export interface IFetchAppPayload extends IRequestExtension { app_id: string; } export interface IAppActionBody extends Omit, IEntityData { app_id?: string; action_id?: string; type: InputsTypes; } export interface IEntityData { sample: object | string; data?: Array; } export interface Data extends IParsedSample { _id?: string; action_id: string; entity_id?: string; category: Categories; created?: Date; } export interface ISuccessValues { type: SuccessMarkerType; body: ISample; } export interface IAppActionResponseInfo { _id?: string; action_id?: string; name: string; tag?: string; response_format: DataFormats; status_code: StatusCodes; success: boolean; type?: InputsTypes; envs?: Array; body: ISample; marker_type?: SuccessMarkerType; success_markers?: Array; data?: ISample; success_values?: ISuccessValues; is_status_code_success?: boolean; created?: Date; } export interface KeyDescription { key: string; description: string; } export interface ISample extends IEntityData { type: InputsTypes; status_code?: StatusCodes; method?: HttpMethods; } export interface IAppAuthEnv { _id?: string; setup_id?: string; env_id: string; __v?: number; base_url?: string; } export interface IAppEventEnv { _id?: string; webhook_id: string; env_id: string; __v?: number; } export interface IAppVariables { _id?: string; key: string; type: DataTypes; required: boolean; description: string; minlength: number; maxlength: number; } export interface IAppConstants { _id?: string; key: string; value: string; type: DataTypes; description: string; }