UNPKG

@lcap/cli

Version:

utils for lcap

397 lines 9.14 kB
/// <reference types="node" /> export type FileEncoding = 'text' | 'base64'; /** * 项目访问密钥 * * @link https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html */ export interface GitlabTokenData { tokenId: string; } /** * 项目数据 */ export interface Project { /** * 项目编号/路径 * * @description 路径就是指项目的网址,比如项目网址是`https://g.hz.netease.com/vusion/cache-script`,那么这里的 id 就是`vusion%2Fcache-script`,反斜杠要转义。 */ id: number | string; } interface CreateCommitBaseData extends Project { /** * 提交信息 */ commit_message: string; /** * 当前提交的行为 */ actions: CommitActionData[]; /** * 作者邮箱 */ author_email?: string; /** * 作者姓名 */ author_name?: string; /** * 提交状态 * * @default true */ stats?: boolean; /** * 强行提交 * * @description `true`的时候将会覆盖掉`start_branch`和`start_sha`的提交信息 */ force?: boolean; } interface CreateCommitExistBranch extends CreateCommitBaseData { /** * 当前提交的基点分支 */ branch: string; } /** 提交数据 */ export type CreateCommitData = CreateCommitExistBranch; interface CommitBaseData { /** * 文件路径 */ file_path: string; /** * 编码方式 * * @default 'text' */ encoding?: FileEncoding; } interface CommitCreateActionData extends CommitBaseData { /** * 创建文件 */ action: 'create'; /** * 文件内容 */ content: string; } interface CommitDeleteActionData extends CommitBaseData { /** * 删除文件 */ action: 'delete'; /** * 文件上次提交的编号 */ last_commit_id: string; } interface CommitMoveActionData extends CommitBaseData { /** * 移动文件 */ action: 'move'; /** * 文件之前的路径 */ previous_path: string; /** * 文件上次提交的编号 */ last_commit_id: string; } interface CommitUpdateActionData extends CommitBaseData { /** * 更新文件 */ action: 'update'; /** * 文件内容 */ content: string; /** * 文件上次提交的编号 */ last_commit_id: string; } interface CommitChmodActionData extends CommitBaseData { /** * 更新文件 */ action: 'chmod'; /** * 文件能否被执行 */ execute_filemode: boolean; } /** 提交行为数据 */ export type CommitActionData = CommitCreateActionData | CommitDeleteActionData | CommitMoveActionData | CommitUpdateActionData | CommitChmodActionData; export interface LsTreeData extends Project { /** * 检出文件的基路径 * * @default '/' */ path?: string; /** * 递归检出所有文件 * * @default false */ recursive?: boolean; /** * 是否启用分页 * * @default 'keyset' */ pagination?: 'keyset'; /** * 使用分页时每页的文件数量 * * @default 20 */ per_page?: number; /** * 下一页标记 * * @description 此值保存在返回值的`headers`里,字段为`x-next-page` * @link https://docs.gitlab.com/ee/api/rest/index.html#other-pagination-headers * @description gitlab 升级到 15 之后,此字段将会改为`page_token` * @link https://docs.gitlab.com/ee/api/repositories.html#list-repository-tree * */ page?: number; /** * 检出文件所在的分支或者是标签 * * @default 默认分支 */ ref?: string; } export interface LsTreeItemData { id: string; name: string; path: string; type: 'blob' | 'tree'; mode: '100644' | '040000'; } export interface FileMetaData { blob_id: string; content_sha256: string; encoding: FileEncoding; ref: string; size: number; commit_id: string; last_commit_id: string; file_name: string; file_path: string; } export interface FileData extends FileMetaData { content: string; execute_filemode: string; } /** 文件数据 */ export interface InputFileData { /** 文件硬盘路径 */ diskPath: string; /** 文件远端路径 */ remotePath: string; /** * 文件内容 */ content: Buffer; /** * 文件大小 */ size: number; } export interface CreateCommitResponseData { id: string; short_id: string; title: string; author_name: string; author_email: string; committer_name: string; committer_email: string; created_at: string; message: string; parent_ids: string[]; committed_date: string; authored_date: string; stats: { additions: number; deletions: number; total: number; }; status: null; web_url: string; } export interface CreateMrData extends Project { source_branch: string; target_branch: string; title: string; allow_collaboration?: boolean; /** allow_collaboration 的别名 */ allow_maintainer_to_push?: boolean; assignee_id?: number; assignee_ids?: number[]; description?: string; /** * MR 的标签 * * @description 使用分号分割 */ labels?: string; milestone_id?: number; remove_source_branch?: boolean; reviewer_ids?: number; /** MR 是否使用压缩提交 */ squash?: boolean; /** 目标项目 */ target_project_id?: string; } export interface CreateMrResponseData extends Project { id: number; iid: number; project_id: number; title: string; description: string; state: string; created_at: string; updated_at: string; target_branch: string; source_branch: string; upvotes: number; downvotes: number; author: { id: number; name: string; username: string; state: string; avatar_url?: string; web_url: string; }; assignee: { id: number; name: string; username: string; state: string; avatar_url?: string; web_url: string; }; source_project_id: number; target_project_id: number; labels: string[]; draft: boolean; work_in_progress: boolean; milestone: { id: number; iid: number; project_id: number; title: string; description: string; state: string; created_at: string; updated_at: string; due_date: string; start_date: string; web_url: string; }; merge_when_pipeline_succeeds: boolean; merge_status: string; detailed_merge_status: string; merge_error?: string; sha: string; merge_commit_sha?: string; squash_commit_sha?: string; user_notes_count: number; discussion_locked?: string; should_remove_source_branch: boolean; force_remove_source_branch: boolean; allow_collaboration: boolean; allow_maintainer_to_push: boolean; web_url: string; references: { short: string; relative: string; full: string; }; time_stats: { time_estimate: number; total_time_spent: number; human_time_estimate?: string; human_total_time_spent?: string; }; squash: boolean; subscribed: boolean; changes_count: string; merge_user: { id: number; name: string; username: string; state: string; avatar_url: string; web_url: string; }; merged_at: string; prepared_at: string; closed_by?: string; closed_at?: string; latest_build_started_at: string; latest_build_finished_at: string; first_deployed_to_production_at?: string; pipeline: { id: number; sha: string; ref: string; status: string; web_url: string; }; diff_refs: { base_sha: string; head_sha: string; start_sha: string; }; diverged_commits_count: number; task_completion_status: { count: number; completed_count: number; }; } export interface CreateBranchData extends Project { /** 新分支的名称 */ branch: string; /** 基准分支 */ ref: string; } export interface CreateBranchResponseData extends Project { commit: { id: string; short_id: string; created_at: string; parent_ids: string[]; title: string; message: string; author_name: string; author_email: string; authored_date: string; committer_name: string; committer_email: string; committed_date: string; "trailers": {}; web_url: string; }; name: string; merged: boolean; protected: boolean; default: boolean; developers_can_push: boolean; developers_can_merge: boolean; can_push: boolean; web_url: string; } export {}; //# sourceMappingURL=types.d.ts.map