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Aa,CAAC7B,KAAM,YAAP,CAAb,CAEFlC,EAAO4D,CAAAA,OAAP,CAAiBA,CAAQ7D,CAAAA,GAAR,CAAaiE,CAAD,EAAW,CACtCA,CAAOC,CAAAA,QAAP,CAAkB,EAAAC,EAChBT,CAAA,CAAezC,CAAf,CAA6BgD,CAAO9B,CAAAA,IAApC,CAA0CH,CAA1C,CACF,OAAOiC,EAH+B,CAAvB,CAKjB,OAAOhE,EAjBgC,CAAhC,CAFJ,CAVO,C,CGjLhBmE,MAAOC,CAAAA,MAAOC,CAAAA,OAAd,CAAsB,KAAOC,EAAP,EAAiB,CAAA,MAC/BC,EAA2B,IAAInC,CAAJ,CAAkBkC,CAAOlD,CAAAA,OAAP,EAAlB,CACjCkD,EAAOE,CAAAA,MAAP,EAAgBC,CAAAA,QAAhB,CAAyBF,CAAzB,CAFqC,CAAvC;",
"sources":["java/com/google/devtools/gerritcodereview/plugins/findings/web/util.ts","java/com/google/devtools/gerritcodereview/plugins/findings/web/checks-fetcher.ts","third_party/javascript/polygerrit/api/rest-api.ts","third_party/javascript/polygerrit/api/checks.ts","java/com/google/devtools/gerritcodereview/plugins/findings/web/plugin.ts"],
"sourcesContent":["/**\n * Converts a snake_case object to camelCase.\n *\n * This is useful for converting the CheckRun and CheckResult objects from\n * the Findings API to camelCase.\n */\nexport function snake2camel<T>(obj: T): T {\n  if (Array.isArray(obj)) {\n    return obj.map(snake2camel) as T;\n  }\n\n  if (typeof obj !== 'object' || obj === null) {\n    return obj;\n  }\n\n  const result: Record<string, unknown> = {};\n  for (const [snakeKey, value] of Object.entries(obj)) {\n    const camelKey = snakeKey.replace(/_([a-z])/g, (_, match) =>\n      match.toUpperCase(),\n    );\n    // We do not generally want to convert all nested fields recursively.\n    // For example, `range` has snake_case fields that should not be converted.\n    // However, `results` is a list of CheckResult objects that should be\n    // converted.\n    result[camelKey] = camelKey === 'results' ? snake2camel(value) : value;\n  }\n  return result as T;\n}\n","import {\n  Action,\n  ChangeData,\n  CheckRun,\n  ChecksProvider,\n  FetchResponse,\n  ResponseCode,\n} from 'google3/third_party/javascript/polygerrit/api/checks';\nimport {\n  HttpMethod,\n  RestPluginApi,\n} from 'google3/third_party/javascript/polygerrit/api/rest';\nimport {snake2camel} from './util';\n\n// See TriggerAction.Input in TriggerAction.java.\ndeclare interface TriggerActionInput {\n  name: string;\n  // tslint:disable:enforce-name-casing\n  finding_id: string;\n}\n\nclass ResponseError extends Error {\n  constructor(readonly response: Response) {\n    super();\n  }\n}\n\n/**\n * Fetches check runs from the ListChecks API of the Findings plugin.\n */\nexport class ChecksFetcher implements ChecksProvider {\n  constructor(private readonly restApi: RestPluginApi) {}\n\n  /**\n   * Call list_checks API with custom response-code handling. Unfortunately,\n   * the plugin REST API does not make it easier to handle 404 differently\n   * from other errors.\n   */\n  async listChecks(\n    changeNumber: number,\n    patchsetNumber: number,\n  ): Promise<CheckRun[]> {\n    // This errFn just makes the `Response` object available to the catch block.\n    const errFn = (response?: Response | null, error?: Error) => {\n      if (error) throw error;\n      if (response) throw new ResponseError(response);\n      throw new Error('Generic REST API error');\n    };\n    try {\n      return await this.restApi.send(\n        HttpMethod.GET,\n        `/changes/${changeNumber}/revisions/${patchsetNumber}/list_checks`,\n        undefined,\n        errFn,\n      );\n    } catch (err) {\n      // 404 may signal that you are not allowed to\n      if (err instanceof ResponseError) {\n        const text = await err.response.text();\n        if (err.response.status === 404) {\n          console.log(`Findings Checks Plugin 404: ${text}`);\n          return [];\n        }\n        throw new Error(\n          `${err.response.status}: ${text ?? 'No response text'}`,\n        );\n      }\n      throw err;\n    }\n  }\n\n  /**\n   * Call trigger_action API with custom response-code handling. Unfortunately,\n   * the plugin REST API does not make it easier to handle 404 differently\n   * from other errors.\n   */\n  async triggerAction(\n    changeNumber: number,\n    actionName: string,\n    findingId: string,\n  ): Promise<void> {\n    // This errFn just makes the `Response` object available to the catch block.\n    const errFn = (response?: Response | null, error?: Error) => {\n      if (error) throw error;\n      if (response) throw new ResponseError(response);\n      throw new Error('Generic REST API error');\n    };\n    try {\n      const input: TriggerActionInput = {\n        name: actionName,\n        finding_id: findingId,\n      };\n      await this.restApi.send(\n        HttpMethod.POST,\n        `/changes/${changeNumber}/trigger_action`,\n        input,\n        errFn,\n      );\n    } catch (err) {\n      // 404 may signal that you are not allowed to\n      if (err instanceof ResponseError) {\n        const text = await err.response.text();\n        if (err.response.status === 404) {\n          console.log(`Findings Checks Plugin 404: ${text}`);\n          return;\n        }\n        throw new Error(\n          `${err.response.status}: ${text ?? 'No response text'}`,\n        );\n      }\n      throw err;\n    }\n  }\n\n  fetch(changeData: ChangeData): Promise<FetchResponse> {\n    const {changeNumber, patchsetNumber} = changeData;\n    return this.listChecks(changeNumber, patchsetNumber)\n      .then((runs) => {\n        return {\n          responseCode: ResponseCode.OK,\n          runs: runs\n            .map(snake2camel)\n            .map((run) => addMissingFields(run, changeData))\n            .map(addAiPrefix)\n            .map((run) =>\n              addActionCallbacks(run, (changeNumber, actionName, findingId) => {\n                this.triggerAction(changeNumber, actionName, findingId);\n                // We need to return undefined to match the Action.Callback signature.\n                return undefined;\n              }),\n            ),\n        };\n      })\n      .catch((err) => {\n        return {\n          responseCode: ResponseCode.ERROR,\n          errorMessage: err.message ?? err?.toString() ?? 'Unknown error',\n          err,\n        };\n      });\n  }\n}\n\n/**\n * The CheckRun requires `change` and `patchset` to be set. If the backend does\n * not bother to set them, then we can easily infer this from the request data.\n * So let's fall back to the change data if the fields are not set.\n */\nfunction addMissingFields(\n  checkRun: CheckRun,\n  changeData: ChangeData,\n): CheckRun {\n  return {\n    ...checkRun,\n    change: checkRun.change || changeData.changeNumber,\n    patchset: checkRun.patchset || changeData.patchsetNumber,\n  };\n}\n\n/**\n * Add 'AI ' prefix to the check name if it is AI powered.\n */\nexport function addAiPrefix(checkRun: CheckRun): CheckRun {\n  if (!checkRun.isAiPowered) return checkRun;\n  if (checkRun.checkName.startsWith('AI ')) return checkRun;\n  return {\n    ...checkRun,\n    checkName: `AI ${checkRun.checkName}`,\n  };\n}\n\n/**\n * Adds callbacks to the actions of the check results. Also adds 'useful' and\n * 'not-useful' actions if they are not already present.\n */\nexport function addActionCallbacks(\n  checkRun: CheckRun,\n  actionCallback: (\n    changeNumber: number,\n    actionName: string,\n    findingId: string,\n  ) => undefined,\n): CheckRun {\n  if (!checkRun.results) return checkRun;\n  const changeNumber = checkRun.change;\n  if (!changeNumber) {\n    throw new Error(\n      '`checkRun.change` not set, maybe `addMissingFields()` was not called',\n    );\n  }\n\n  return {\n    ...checkRun,\n    results: checkRun.results.map((result) => {\n      const findingId = result.externalId;\n      if (!findingId) return result;\n      const actions = result.actions ?? [];\n      if (!actions.some((a) => a.name === 'useful')) {\n        // `callback` is not set yet, but will be set below.\n        actions.push({name: 'useful'} as Action);\n      }\n      if (!actions.some((a) => a.name === 'not-useful')) {\n        // `callback` is not set yet, but will be set below.\n        actions.push({name: 'not-useful'} as Action);\n      }\n      result.actions = actions.map((action) => {\n        action.callback = () =>\n          actionCallback(changeNumber, action.name, findingId);\n        return action;\n      });\n      return result;\n    }),\n  };\n}\n","/**\n * @license\n * Copyright 2021 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * rest-api.ts contains all entities from the Gerrit REST API that are also\n * relevant to plugins and gr-diff users. These entities should be exactly what\n * the backend defines and returns and should eventually be generated.\n *\n * Sorting order:\n * - enums in alphabetical order\n * - types and interfaces in alphabetical order\n *   - type checking functions after their corresponding type\n */\n\n/**\n * enums =======================================================================\n */\n\n/**\n * The authentication type that is configured on the server.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#auth-info\n */\nexport enum AuthType {\n  OPENID = 'OPENID',\n  OPENID_SSO = 'OPENID_SSO',\n  OAUTH = 'OAUTH',\n  HTTP = 'HTTP',\n  HTTP_LDAP = 'HTTP_LDAP',\n  CLIENT_SSL_CERT_LDAP = 'CLIENT_SSL_CERT_LDAP',\n  LDAP = 'LDAP',\n  LDAP_BIND = 'LDAP_BIND',\n  CUSTOM_EXTENSION = 'CUSTOM_EXTENSION',\n  DEVELOPMENT_BECOME_ANY_ACCOUNT = 'DEVELOPMENT_BECOME_ANY_ACCOUNT',\n}\n\n/**\n * Specifies status for a change\n */\nexport enum ChangeStatus {\n  ABANDONED = 'ABANDONED',\n  MERGED = 'MERGED',\n  NEW = 'NEW',\n}\n\n/**\n * The type in ConfigParameterInfo entity.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#config-parameter-info\n */\nexport enum ConfigParameterInfoType {\n  // Should be kept in sync with\n  // gerrit/java/com/google/gerrit/extensions/api/projects/ProjectConfigEntryType.java.\n  STRING = 'STRING',\n  INT = 'INT',\n  LONG = 'LONG',\n  BOOLEAN = 'BOOLEAN',\n  LIST = 'LIST',\n  ARRAY = 'ARRAY',\n}\n\n/**\n * Used for server config of accounts\n */\nexport enum DefaultDisplayNameConfig {\n  USERNAME = 'USERNAME',\n  FIRST_NAME = 'FIRST_NAME',\n  FULL_NAME = 'FULL_NAME',\n}\n\n/**\n * Account fields that are editable\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#auth-info\n */\nexport enum EditableAccountField {\n  FULL_NAME = 'FULL_NAME',\n  USER_NAME = 'USER_NAME',\n  REGISTER_NEW_EMAIL = 'REGISTER_NEW_EMAIL',\n}\n\n/**\n * The status of the file\n */\nexport enum FileInfoStatus {\n  ADDED = 'A',\n  DELETED = 'D',\n  RENAMED = 'R',\n  COPIED = 'C',\n  REWRITTEN = 'W',\n  MODIFIED = 'M', // Not returned by BE, M is the default\n  UNMODIFIED = 'U', // Not returned by BE, but added by UI for certain files\n  REVERTED = 'X', // Not returned by BE, but added by UI for certain files\n}\n\n/**\n * The status of the file\n */\nexport enum GpgKeyInfoStatus {\n  BAD = 'BAD',\n  OK = 'OK',\n  TRUSTED = 'TRUSTED',\n}\n\n/**\n * Enum for all http methods used in Gerrit.\n */\nexport enum HttpMethod {\n  HEAD = 'HEAD',\n  POST = 'POST',\n  GET = 'GET',\n  DELETE = 'DELETE',\n  PUT = 'PUT',\n}\n\n/**\n * Enum for possible configured value in InheritedBooleanInfo.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#inherited-boolean-info\n */\nexport enum InheritedBooleanInfoConfiguredValue {\n  TRUE = 'TRUE',\n  FALSE = 'FALSE',\n  INHERIT = 'INHERIT',\n}\n\n/**\n * This setting determines when Gerrit computes if a change is mergeable or not.\n * https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#change.mergeabilityComputationBehavior\n */\nexport enum MergeabilityComputationBehavior {\n  API_REF_UPDATED_AND_CHANGE_REINDEX = 'API_REF_UPDATED_AND_CHANGE_REINDEX',\n  REF_UPDATED_AND_CHANGE_REINDEX = 'REF_UPDATED_AND_CHANGE_REINDEX',\n  NEVER = 'NEVER',\n}\n\n/**\n * The status of fixing the problem\n */\nexport enum ProblemInfoStatus {\n  FIXED = 'FIXED',\n  FIX_FAILED = 'FIX_FAILED',\n}\n\n/**\n * The state of the repository\n */\nexport enum RepoState {\n  ACTIVE = 'ACTIVE',\n  READ_ONLY = 'READ_ONLY',\n  HIDDEN = 'HIDDEN',\n}\n\n/**\n * The reviewer state\n */\nexport enum RequirementStatus {\n  OK = 'OK',\n  NOT_READY = 'NOT_READY',\n  RULE_ERROR = 'RULE_ERROR',\n}\n\n/**\n * The reviewer state\n */\nexport enum ReviewerState {\n  REVIEWER = 'REVIEWER',\n  CC = 'CC',\n  REMOVED = 'REMOVED',\n}\n\n/**\n * The patchset kind\n */\nexport enum RevisionKind {\n  REWORK = 'REWORK',\n  TRIVIAL_REBASE = 'TRIVIAL_REBASE',\n  TRIVIAL_REBASE_WITH_MESSAGE_UPDATE = 'TRIVIAL_REBASE_WITH_MESSAGE_UPDATE',\n  MERGE_FIRST_PARENT_UPDATE = 'MERGE_FIRST_PARENT_UPDATE',\n  NO_CODE_CHANGE = 'NO_CODE_CHANGE',\n  NO_CHANGE = 'NO_CHANGE',\n}\n\n/**\n * All supported submit types.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#submit-type-info\n */\nexport enum SubmitType {\n  MERGE_IF_NECESSARY = 'MERGE_IF_NECESSARY',\n  FAST_FORWARD_ONLY = 'FAST_FORWARD_ONLY',\n  REBASE_IF_NECESSARY = 'REBASE_IF_NECESSARY',\n  REBASE_ALWAYS = 'REBASE_ALWAYS',\n  MERGE_ALWAYS = 'MERGE_ALWAYS ',\n  CHERRY_PICK = 'CHERRY_PICK',\n  INHERIT = 'INHERIT',\n}\n\n/**\n * The state of a flow stage.\n */\nexport enum FlowStageState {\n  DONE = 'DONE',\n  FAILED = 'FAILED',\n  PENDING = 'PENDING',\n  TERMINATED = 'TERMINATED',\n}\n\n/**\n * types and interfaces ========================================================\n */\n\n// This is a \"meta type\", so it comes first and is not sored alphabetically with\n// the other types.\nexport type BrandType<T, BrandName extends string> = T & {\n  [__brand in BrandName]: never;\n};\n\nexport type AccountId = BrandType<number, '_accountId'>;\n\n/**\n * The AccountInfo entity contains information about an account.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-info\n */\nexport declare interface AccountInfo {\n  // Normally _account_id is defined (for known Gerrit users), but users can\n  // also be CCed just with their email address. So you have to be prepared that\n  // _account_id is undefined, but then email must be set.\n  _account_id?: AccountId;\n  name?: string;\n  display_name?: string;\n  // Must be set, if _account_id is undefined.\n  email?: EmailAddress;\n  secondary_emails?: string[];\n  username?: string;\n  avatars?: AvatarInfo[];\n  _more_accounts?: boolean; // not set if false\n  status?: string; // status message of the account\n  inactive?: boolean; // not set if false\n  tags?: string[];\n  deleted?: boolean; // not set if false\n}\n\n/**\n * The AccountDetailInfo entity contains detailed information about an account.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#account-detail-info\n */\nexport declare interface AccountDetailInfo extends AccountInfo {\n  registered_on: Timestamp;\n}\n\n/**\n * The AccountsConfigInfo entity contains information about Gerrit configuration\n * from the accounts section.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#accounts-config-info\n */\nexport declare interface AccountsConfigInfo {\n  visibility: string;\n  default_display_name: DefaultDisplayNameConfig;\n}\n\n/**\n * The ActionInfo entity describes a REST API call the client can make to\n * manipulate a resource. These are frequently implemented by plugins and may\n * be discovered at runtime.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#action-info\n */\nexport declare interface ActionInfo {\n  method?: HttpMethod; // Most actions use POST, PUT or DELETE to cause state changes.\n  label?: string; // Short title to display to a user describing the action\n  title?: string; // Longer text to display describing the action\n  enabled?: boolean; // not set if false\n}\n\nexport declare interface ActionNameToActionInfoMap {\n  [actionType: string]: ActionInfo | undefined;\n  // List of actions explicitly used in code:\n  wip?: ActionInfo;\n  publishEdit?: ActionInfo;\n  rebaseEdit?: ActionInfo;\n  deleteEdit?: ActionInfo;\n  edit?: ActionInfo;\n  stopEdit?: ActionInfo;\n  download?: ActionInfo;\n  rebase?: ActionInfo;\n  cherrypick?: ActionInfo;\n  move?: ActionInfo;\n  revert?: ActionInfo;\n  revert_submission?: ActionInfo;\n  abandon?: ActionInfo;\n  submit?: ActionInfo;\n  topic?: ActionInfo;\n  hashtags?: ActionInfo;\n  ready?: ActionInfo;\n  includedIn?: ActionInfo;\n}\n\n/**\n * The ApprovalInfo entity contains information about an approval from auser\n * for a label on a change.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#approval-info\n */\nexport declare interface ApprovalInfo extends AccountInfo {\n  value?: number;\n  permitted_voting_range?: VotingRangeInfo;\n  date?: Timestamp;\n  tag?: ReviewInputTag;\n  post_submit?: boolean; // not set if false\n}\n\n/**\n * The AttentionSetInfo entity contains details of users that are in the attention set.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#attention-set-info\n */\nexport declare interface AttentionSetInfo {\n  account: AccountInfo;\n  last_update?: Timestamp;\n  reason?: string;\n  reason_account?: AccountInfo;\n}\n\n/**\n * The AuthInfo entity contains information about the authentication\n * configuration of the Gerrit server.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#auth-info\n */\nexport declare interface AuthInfo {\n  auth_type: AuthType; // docs incorrectly names it 'type'\n  use_contributor_agreements?: boolean;\n  contributor_agreements?: ContributorAgreementInfo[];\n  editable_account_fields: EditableAccountField[];\n  login_url?: string;\n  login_text?: string;\n  switch_account_url?: string;\n  register_url?: string;\n  register_text?: string;\n  edit_full_name_url?: string;\n  http_password_url?: string;\n  git_basic_auth_policy?: string;\n  max_token_lifetime?: string;\n}\n\n/**\n * The AvatarInfo entity contains information about an avatar image of an\n * account.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#avatar-info\n */\nexport declare interface AvatarInfo {\n  url: string;\n  height: number;\n}\n\n// The refs/heads/ prefix is omitted in Branch name\nexport type BranchName = BrandType<string, '_branchName'>;\n\n/**\n * The ChangeConfigInfo entity contains information about Gerrit configuration\n * from the change section.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#change-config-info\n */\nexport declare interface ChangeConfigInfo {\n  allow_blame?: boolean;\n  large_change: number;\n  update_delay: number;\n  submit_whole_topic?: boolean;\n  disable_private_changes?: boolean;\n  mergeability_computation_behavior: MergeabilityComputationBehavior;\n  conflicts_predicate_enabled?: boolean;\n  allow_markdown_base64_images_in_comments?: boolean;\n}\n\nexport type ChangeId = BrandType<string, '_changeId'>;\n\n/**\n * The ChangeInfo entity contains information about a change.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-info\n */\nexport declare interface ChangeInfo {\n  id: ChangeInfoId;\n  project: RepoName;\n  branch: BranchName;\n  topic?: TopicName;\n  attention_set?: IdToAttentionSetMap;\n  hashtags?: Hashtag[];\n  custom_keyed_values?: CustomKeyedValues;\n  change_id: ChangeId;\n  subject: string;\n  status: ChangeStatus;\n  created: Timestamp;\n  updated: Timestamp;\n  submitted?: Timestamp;\n  submitter?: AccountInfo;\n  starred?: boolean; // not set if false\n  submit_type?: SubmitType;\n  mergeable?: boolean;\n  submittable?: boolean;\n  insertions: number; // Number of inserted lines\n  deletions: number; // Number of deleted lines\n  total_comment_count?: number;\n  unresolved_comment_count?: number;\n  _number: NumericChangeId;\n  owner: AccountInfo;\n  actions?: ActionNameToActionInfoMap;\n  requirements?: Requirement[];\n  labels?: LabelNameToInfoMap;\n  permitted_labels?: LabelNameToValuesMap;\n  removable_reviewers?: AccountInfo[];\n  removable_labels?: {\n    [labelName: string]: {[labelValue: string]: AccountInfo[]};\n  };\n  // This is documented as optional, but actually always set.\n  reviewers: Reviewers;\n  pending_reviewers?: AccountInfo[];\n  reviewer_updates?: ReviewerUpdateInfo[];\n  messages?: ChangeMessageInfo[];\n  current_revision_number: PatchSetNumber;\n  current_revision?: CommitId;\n  revisions?: {[revisionId: string]: RevisionInfo};\n  tracking_ids?: TrackingIdInfo[];\n  _more_changes?: boolean; // not set if false\n  problems?: ProblemInfo[];\n  is_private?: boolean; // not set if false\n  work_in_progress?: boolean; // not set if false\n  has_review_started?: boolean; // not set if false\n  revert_of?: NumericChangeId;\n  submission_id?: ChangeSubmissionId;\n  cherry_pick_of_change?: NumericChangeId;\n  cherry_pick_of_patch_set?: RevisionPatchSetNum;\n  contains_git_conflicts?: boolean;\n  submit_requirements?: SubmitRequirementResultInfo[];\n  submit_records?: SubmitRecordInfo[];\n}\n\n// The ID of the change in the format \"'<project>~<branch>~<Change-Id>'\"\nexport type ChangeInfoId = BrandType<string, '_changeInfoId'>;\n\nexport type ChangeMessageId = BrandType<string, '_changeMessageId'>;\n\n/**\n * The ChangeMessageInfo entity contains information about a message attached\n * to a change.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-message-info\n */\nexport declare interface ChangeMessageInfo {\n  id: ChangeMessageId;\n  author?: AccountInfo;\n  reviewer?: AccountInfo;\n  updated_by?: AccountInfo;\n  real_author?: AccountInfo;\n  date: Timestamp;\n  message: string;\n  accounts_in_message?: AccountInfo[];\n  tag?: ReviewInputTag;\n  _revision_number?: PatchSetNum;\n}\n\n// This ID is equal to the numeric ID of the change that triggered the\n// submission. If the change that triggered the submission also has a topic, it\n// will be \"<id>-<topic>\" of the change that triggered the submission\n// The callers must not rely on the format of the submission ID.\nexport type ChangeSubmissionId = BrandType<\n  string | number,\n  '_changeSubmissionId'\n>;\n\nexport type CloneCommandMap = {[name: string]: string};\n\n/**\n * The CommentLinkInfo entity describes acommentlink.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#commentlink-info\n */\nexport declare interface CommentLinkInfo {\n  match: string;\n  link: string;\n  prefix?: string;\n  suffix?: string;\n  text?: string;\n  enabled?: boolean;\n}\n\nexport declare interface CommentLinks {\n  [name: string]: CommentLinkInfo;\n}\n\n/** 40 char string, see shorten() util, if you want 7 chars. */\nexport type CommitId = BrandType<string, '_commitId'>;\n\n/**\n * The CommitInfo entity contains information about a commit.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#commit-info\n */\nexport declare interface CommitInfo {\n  commit?: CommitId;\n  parents: ParentCommitInfo[];\n  author: GitPersonInfo;\n  committer: GitPersonInfo;\n  subject: string;\n  message: string;\n  web_links?: WebLinkInfo[];\n  resolve_conflicts_web_links?: WebLinkInfo[];\n}\n\nexport declare interface ConfigArrayParameterInfo\n  extends ConfigParameterInfoBase {\n  type: ConfigParameterInfoType.ARRAY;\n  values: string[];\n}\n\n/**\n * The ConfigInfo entity contains information about the effective\n * repository configuration.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#config-info\n */\nexport declare interface ConfigInfo {\n  description?: string;\n  use_contributor_agreements?: InheritedBooleanInfo;\n  use_content_merge?: InheritedBooleanInfo;\n  use_signed_off_by?: InheritedBooleanInfo;\n  create_new_change_for_all_not_in_target?: InheritedBooleanInfo;\n  require_change_id?: InheritedBooleanInfo;\n  enable_signed_push?: InheritedBooleanInfo;\n  require_signed_push?: InheritedBooleanInfo;\n  reject_implicit_merges?: InheritedBooleanInfo;\n  private_by_default: InheritedBooleanInfo;\n  work_in_progress_by_default: InheritedBooleanInfo;\n  max_object_size_limit: MaxObjectSizeLimitInfo;\n  default_submit_type: SubmitTypeInfo;\n  submit_type: SubmitType;\n  match_author_to_committer_date?: InheritedBooleanInfo;\n  state?: RepoState;\n  commentlinks: CommentLinks;\n  plugin_config?: PluginNameToPluginParametersMap;\n  actions?: {[viewName: string]: ActionInfo};\n  reject_empty_commit?: InheritedBooleanInfo;\n  enable_reviewer_by_email: InheritedBooleanInfo;\n}\n\n/**\n * The CommentInfo entity contains information about an inline comment.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#comment-info\n */\nexport declare interface CommentInfo {\n  id: UrlEncodedCommentId;\n  updated: Timestamp;\n  // TODO(TS): Make this required. Every comment must have patch_set set.\n  patch_set?: RevisionPatchSetNum;\n  path?: string;\n  side?: CommentSide;\n  parent?: number;\n  line?: number;\n  range?: CommentRange;\n  in_reply_to?: UrlEncodedCommentId;\n  message?: string;\n  author?: AccountInfo;\n  tag?: string;\n  unresolved?: boolean;\n  change_message_id?: string;\n  commit_id?: string;\n  context_lines?: ContextLine[];\n  source_content_type?: string;\n  fix_suggestions?: FixSuggestionInfo[];\n}\n\n/**\n * The CommentRange entity describes the range of an inline comment.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#comment-range\n *\n * The range includes all characters from the start position, specified by\n * start_line and start_character, to the end position, specified by end_line\n * and end_character. The start position is inclusive and the end position is\n * exclusive.\n *\n * So, a range over part of a line will have start_line equal to end_line;\n * however a range with end_line set to 5 and end_character equal to 0 will not\n * include any characters on line 5.\n */\nexport declare interface CommentRange {\n  /** The start line number of the range. (1-based) */\n  start_line: number;\n\n  /** The character position in the start line. (0-based) */\n  start_character: number;\n\n  /** The end line number of the range. (1-based) */\n  end_line: number;\n\n  /** The character position in the end line. (0-based) */\n  end_character: number;\n}\n\n/**\n * The side on which the comment was added\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#comment-info\n */\nexport enum CommentSide {\n  REVISION = 'REVISION',\n  PARENT = 'PARENT',\n}\n\nexport declare interface ConfigListParameterInfo\n  extends ConfigParameterInfoBase {\n  type: ConfigParameterInfoType.LIST;\n  permitted_values?: string[];\n}\n\nexport type ConfigParameterInfo =\n  | ConfigParameterInfoBase\n  | ConfigArrayParameterInfo\n  | ConfigListParameterInfo;\n\n/**\n * The ConfigParameterInfo entity describes a project configurationparameter.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#config-parameter-info\n */\nexport declare interface ConfigParameterInfoBase {\n  display_name?: string;\n  description?: string;\n  warning?: string;\n  type: ConfigParameterInfoType;\n  value?: string;\n  values?: string[];\n  editable?: boolean;\n  permitted_values?: string[];\n  inheritable?: boolean;\n  configured_value?: string;\n  inherited_value?: string;\n}\n\n/**\n * The ContextLine entity contains the line number and line text of a single line of the source file content.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#context-line\n */\nexport declare interface ContextLine {\n  line_number: number;\n  context_line: string;\n}\n\n// https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#contributor-agreement-info\nexport declare interface ContributorAgreementInfo {\n  name: string;\n  description: string;\n  url?: string;\n  auto_verify_group?: GroupInfo;\n}\n\n/**\n * LabelInfo when DETAILED_LABELS are requested.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#_fields_set_by_code_detailed_labels_code\n */\nexport declare interface DetailedLabelInfo extends LabelCommonInfo {\n  // This is not set when the change has no reviewers.\n  all?: ApprovalInfo[];\n  // Docs claim that 'values' is optional, but it is actually always set.\n  values?: LabelValueToDescriptionMap; // A map of all values that are allowed for this label\n  default_value?: number;\n}\n\nexport function isDetailedLabelInfo(\n  label: LabelInfo\n): label is DetailedLabelInfo | (QuickLabelInfo & DetailedLabelInfo) {\n  return !!(label as DetailedLabelInfo).values;\n}\n\n/**\n * The DownloadInfo entity contains information about supported download\n * options.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#download-info\n */\nexport declare interface DownloadInfo {\n  schemes: SchemesInfoMap;\n  archives: string[];\n}\n\n/**\n * The DownloadSchemeInfo entity contains information about a supported download\n * scheme and its commands.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html\n */\nexport declare interface DownloadSchemeInfo {\n  url: string;\n  description?: string;\n  is_auth_required: boolean;\n  is_auth_supported: boolean;\n  commands: string;\n  clone_commands: CloneCommandMap;\n}\n\nexport type EmailAddress = BrandType<string, '_emailAddress'>;\n\n/**\n * The EmailInfo entity contains information about an email address of a user\n * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#email-info\n */\nexport declare interface EmailInfo {\n  email: EmailAddress;\n  preferred?: boolean;\n  pending_confirmation?: boolean;\n}\n\n/**\n * The FetchInfo entity contains information about how to fetch a patchset via\n * a certain protocol.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#fetch-info\n */\nexport declare interface FetchInfo {\n  url: string;\n  ref: string;\n  commands?: {[commandName: string]: string};\n}\n\n/**\n * The FlowActionInfo entity contains information about a flow action.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#flow-action-info\n */\nexport declare interface FlowActionInfo {\n  name: string;\n  parameters?: string[];\n}\n\n/**\n * The FlowExpressionInfo entity contains information about a flow expression.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#flow-expression-info\n */\nexport declare interface FlowExpressionInfo {\n  condition: string;\n  action?: FlowActionInfo;\n}\n\n/**\n * The FlowInfo entity contains information about a flow.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#flow-info\n */\nexport declare interface FlowInfo {\n  uuid: string;\n  owner: AccountInfo;\n  created: Timestamp;\n  last_evaluated?: Timestamp;\n  stages: FlowStageInfo[];\n}\n\n/**\n * The FlowInput entity is used for creating a new flow.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#flow-input\n */\nexport declare interface FlowInput {\n  stage_expressions: FlowExpressionInfo[];\n}\n\n/**\n * The FlowStageInfo entity contains information about a flow stage.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#flow-stage-info\n */\nexport declare interface FlowStageInfo {\n  expression: FlowExpressionInfo;\n  state: FlowStageState;\n  message?: string;\n}\n\n/**\n * The FileInfo entity contains information about a file in a patch set.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#file-info\n */\nexport declare interface FileInfo {\n  status?: FileInfoStatus;\n  binary?: boolean; // not set if false\n  old_path?: string;\n  lines_inserted?: number;\n  lines_deleted?: number;\n  size_delta?: number; // in bytes\n  size?: number; // in bytes\n  old_mode?: number;\n  new_mode?: number;\n  old_sha?: string;\n  new_sha?: string;\n}\n\n/**\n * The GerritInfo entity contains information about Gerrit configuration from\n * the gerrit section.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#gerrit-info\n */\nexport declare interface GerritInfo {\n  all_projects: string; // Doc contains incorrect name\n  all_users: string; // Doc contains incorrect name\n  doc_search: boolean;\n  doc_url?: string;\n  edit_gpg_keys?: boolean;\n  project_state_predicate_enabled: boolean;\n  report_bug_url?: string;\n  // The following property is missed in doc\n  primary_weblink_name?: string;\n  instance_id?: string;\n  default_branch?: string;\n}\n\nexport type GitRef = BrandType<string, '_gitRef'>;\n// The 40-char (plus spaces) hex GPG key fingerprint\n\nexport type GpgKeyFingerprint = BrandType<string, '_gpgKeyFingerprint'>;\n// The 8-char hex GPG key ID.\n\nexport type GpgKeyId = BrandType<string, '_gpgKeyId'>;\n\n/**\n * The GpgKeyInfo entity contains information about a GPG public key.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#gpg-key-info\n */\nexport declare interface GpgKeyInfo {\n  id?: GpgKeyId;\n  fingerprint?: GpgKeyFingerprint;\n  user_ids?: OpenPgpUserIds[];\n  key?: string; // ASCII armored public key material\n  status?: GpgKeyInfoStatus;\n  problems?: string[];\n}\n\n/**\n * The GitPersonInfo entity contains information about theauthor/committer of\n * a commit.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#git-person-info\n */\nexport declare interface GitPersonInfo {\n  name: string;\n  email: EmailAddress;\n  date: Timestamp;\n}\n\nexport type GroupId = BrandType<string, '_groupId'>;\n\n/**\n * The GroupInfo entity contains information about a group. This can be a\n * Gerrit internal group, or an external group that is known to Gerrit.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#group-info\n */\nexport declare interface GroupInfo {\n  id: GroupId;\n  name?: GroupName;\n  url?: string;\n  options?: GroupOptionsInfo;\n  description?: string;\n  group_id?: number;\n  owner?: string;\n  owner_id?: string;\n  created_on?: string;\n  _more_groups?: boolean;\n  members?: AccountInfo[];\n  includes?: GroupInfo[];\n}\n\n/**\n * The GroupsInfo entity contains information about Gerrit configuration from\n * the gerrit section.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#groups-info\n */\nexport declare interface GroupsConfigInfo {\n  enable_delete_group?: boolean;\n}\n\nexport type GroupName = BrandType<string, '_groupName'>;\n\n/**\n * Options of the group.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html\n */\nexport declare interface GroupOptionsInfo {\n  visible_to_all: boolean;\n}\n\nexport type Hashtag = BrandType<string, '_hashtag'>;\n\nexport type CustomKey = BrandType<string, '_custom_key'>;\nexport type CustomValue = BrandType<string, '_custom_value'>;\n\n// A map from CustomKey to CustomValue\nexport type CustomKeyedValues = {[key: CustomKey]: CustomValue};\n\nexport type IdToAttentionSetMap = {[accountId: string]: AttentionSetInfo};\n\n/**\n * A boolean value that can also be inherited.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#inherited-boolean-info\n */\nexport declare interface InheritedBooleanInfo {\n  value: boolean;\n  configured_value: InheritedBooleanInfoConfiguredValue;\n  inherited_value?: boolean;\n}\n\nexport declare interface LabelCommonInfo {\n  optional?: boolean; // not set if false\n  description?: string;\n}\n\nexport type LabelNameToInfoMap = {[labelName: string]: LabelInfo};\n\n// {Verified: [\"-1\", \" 0\", \"+1\"]}\nexport type LabelNameToValuesMap = {[labelName: string]: string[]};\n\n/**\n * The LabelInfo entity contains information about a label on a change, always\n * corresponding to the current patch set.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#label-info\n */\nexport type LabelInfo =\n  | QuickLabelInfo\n  | DetailedLabelInfo\n  | (QuickLabelInfo & DetailedLabelInfo);\n\nexport type LabelNameToLabelTypeInfoMap = {[labelName: string]: LabelTypeInfo};\n\n/**\n * The LabelTypeInfo entity contains metadata about the labels that a repository\n * has.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#label-type-info\n */\nexport declare interface LabelTypeInfo {\n  values: LabelTypeInfoValues;\n  default_value: number;\n}\n\nexport type LabelTypeInfoValues = {[value: string]: string};\n\n// The map maps the values (\u201c-2\u201d, \u201c-1\u201d, \" `0`\", \u201c+1\u201d, \u201c+2\u201d) to the value descriptions.\nexport type LabelValueToDescriptionMap = {[labelValue: string]: string};\n\n/**\n * The MaxObjectSizeLimitInfo entity contains information about the max object\n * size limit of a repository.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#max-object-size-limit-info\n */\nexport declare interface MaxObjectSizeLimitInfo {\n  value?: string;\n  configured_value?: string;\n  summary?: string;\n}\n\nexport type NumericChangeId = BrandType<number, '_numericChangeId'>;\n// OpenPGP User IDs (https://tools.ietf.org/html/rfc4880#section-5.11).\n\nexport type OpenPgpUserIds = BrandType<string, '_openPgpUserIds'>;\n\n/**\n * The parent commits of this commit as a list of CommitInfo entities.\n * In each parent only the commit and subject fields are populated.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#commit-info\n */\nexport declare interface ParentCommitInfo {\n  commit: CommitId;\n  subject: string;\n}\n\nexport type PatchSetNumber = BrandType<number, '_patchSet'>;\n\nexport type EditPatchSet = BrandType<'edit', '_patchSet'>;\n\nexport const EDIT = 'edit' as EditPatchSet;\n\nexport type ParentPatchSet = BrandType<'PARENT', '_patchSet'>;\n\nexport const PARENT = 'PARENT' as ParentPatchSet;\n\nexport type PatchSetNum = PatchSetNumber | ParentPatchSet | EditPatchSet;\n\n// for the \"left\" side of a diff or the base of a patch range\nexport type BasePatchSetNum = PatchSetNumber | ParentPatchSet;\n\n// for the \"right\" side of a diff or the revision of a patch range\nexport type RevisionPatchSetNum = PatchSetNumber | EditPatchSet;\n\n/**\n * The PluginConfigInfo entity contains information about Gerrit extensions by\n * plugins.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#plugin-config-info\n */\nexport declare interface PluginConfigInfo {\n  has_avatars: boolean;\n  // Exists in Java class, but not mentioned in docs.\n  js_resource_paths: string[];\n}\n\n/**\n * Plugin configuration values as map which maps the plugin name to a map of parameter names to values\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#config-input\n */\nexport type PluginNameToPluginParametersMap = {\n  [pluginName: string]: PluginParameterToConfigParameterInfoMap;\n};\n\nexport type PluginParameterToConfigParameterInfoMap = {\n  [parameterName: string]: ConfigParameterInfo;\n};\n\n/**\n * The ProblemInfo entity contains a description of a potential consistency\n * problem with a change. These are not related to the code review process,\n * but rather indicate some inconsistency in Gerrit\u2019s database or repository\n * metadata related to the enclosing change.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#problem-info\n */\nexport declare interface ProblemInfo {\n  message: string;\n  status?: ProblemInfoStatus; // Only set if a fix was attempted\n  outcome?: string;\n}\n\n/**\n * The ProjectInfo entity contains information about a repository\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#project-info\n */\nexport declare interface ProjectInfo {\n  id: UrlEncodedRepoName;\n  // name is not set if returned in a map where the repo name is used as\n  // map key\n  name?: RepoName;\n  // ?-<n> if the parent repository is not visible (<n> is a number which\n  // is increased for each non-visible repository).\n  parent?: RepoName;\n  description?: string;\n  state?: RepoState;\n  branches?: {[branchName: string]: CommitId};\n  // labels is filled for Create Repo and Get Repo calls.\n  labels?: LabelNameToLabelTypeInfoMap;\n  // Links to the repository in external sites\n  web_links?: WebLinkInfo[];\n}\n\nexport declare interface ProjectInfoWithName extends ProjectInfo {\n  name: RepoName;\n}\n\n/**\n * The PushCertificateInfo entity contains information about a pushcertificate\n * provided when the user pushed for review with git push\n * --signed HEAD:refs/for/<branch>. Only used when signed push is\n * enabled on the server.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#push-certificate-info\n */\nexport declare interface PushCertificateInfo {\n  certificate: string;\n  key: GpgKeyInfo;\n}\n\nexport declare interface QuickLabelInfo extends LabelCommonInfo {\n  approved?: AccountInfo;\n  rejected?: AccountInfo;\n  recommended?: AccountInfo;\n  disliked?: AccountInfo;\n  blocking?: boolean; // not set if false\n  value?: number; // The voting value of the user who recommended/disliked this label on the change if it is not \u201c+1\u201d/\u201c-1\u201d.\n  default_value?: number;\n}\n\nexport function isQuickLabelInfo(\n  l: LabelInfo\n): l is QuickLabelInfo | (QuickLabelInfo & DetailedLabelInfo) {\n  const quickLabelInfo = l as QuickLabelInfo;\n  return (\n    quickLabelInfo.approved !== undefined ||\n    quickLabelInfo.rejected !== undefined ||\n    quickLabelInfo.recommended !== undefined ||\n    quickLabelInfo.disliked !== undefined ||\n    quickLabelInfo.blocking !== undefined ||\n    quickLabelInfo.blocking !== undefined ||\n    quickLabelInfo.value !== undefined\n  );\n}\n\n/**\n * The ReceiveInfo entity contains information about the configuration of\n * git-receive-pack behavior on the server.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#receive-info\n */\nexport declare interface ReceiveInfo {\n  enable_signed_push?: string;\n}\n\nexport type RepoName = BrandType<string, '_repoName'>;\n\n/**\n * The Requirement entity contains information about a requirement relative to\n * a change.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#requirement\n */\nexport declare interface Requirement {\n  status: RequirementStatus;\n  fallbackText: string; // A human readable reason\n  type: RequirementType;\n}\n\nexport type RequirementType = BrandType<string, '_requirementType'>;\n\n/**\n * The reviewers as a map that maps a reviewer state to a list of AccountInfo\n * entities. Possible reviewer states are REVIEWER, CC and REMOVED.\n * REVIEWER: Users with at least one non-zero vote on the change.\n * CC: Users that were added to the change, but have not voted.\n * REMOVED: Users that were previously reviewers on the change, but have been removed.\n */\nexport type Reviewers = Partial<Record<ReviewerState, AccountInfo[]>>;\n\n/**\n * The ReviewerUpdateInfo entity contains information about updates to change\u2019s\n * reviewers set.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#review-update-info\n */\nexport declare interface ReviewerUpdateInfo {\n  updated: Timestamp;\n  updated_by: AccountInfo;\n  reviewer: AccountInfo;\n  state: ReviewerState;\n}\n\nexport type ReviewInputTag = BrandType<string, '_reviewInputTag'>;\n\n/**\n * The RevisionInfo entity contains information about a patch set.Not all\n * fields are returned by default.  Additional fields can be obtained by\n * adding o parameters as described in Query Changes.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#revision-info\n */\nexport declare interface RevisionInfo {\n  kind: RevisionKind;\n  _number: RevisionPatchSetNum;\n  created: Timestamp;\n  uploader: AccountInfo;\n  ref: GitRef;\n  fetch?: {[protocol: string]: FetchInfo};\n  commit?: CommitInfo;\n  files?: {[filename: string]: FileInfo};\n  reviewed?: boolean;\n  commit_with_footers?: string;\n  push_certificate?: PushCertificateInfo;\n  description?: string;\n  parents_data?: ParentInfo[];\n}\n\n/**\n * The ParentInfo entity contains detailed information the parent commit of a revision.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#parent-info\n * basePatchNum is present in case RevisionInfo is of type 'edit'\n */\nexport declare interface ParentInfo {\n  branch_name?: string;\n  commit_id?: CommitId;\n  is_merged_in_target_branch?: boolean;\n  change_id?: ChangeId;\n  change_number?: NumericChangeId;\n  patch_set_number?: PatchSetNumber;\n  change_status?: ChangeStatus;\n}\n\nexport type SchemesInfoMap = {[name: string]: DownloadSchemeInfo};\n\n/**\n * The ServerInfo entity contains information about the configuration of the\n * Gerrit server.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#server-info\n */\nexport declare interface ServerInfo {\n  accounts: AccountsConfigInfo;\n  auth: AuthInfo;\n  change: ChangeConfigInfo;\n  download: DownloadInfo;\n  gerrit: GerritInfo;\n  groups: GroupsConfigInfo;\n  note_db_enabled?: boolean;\n  plugin: PluginConfigInfo;\n  receive?: ReceiveInfo;\n  sshd?: SshdInfo;\n  suggest: SuggestInfo;\n  user: UserConfigInfo;\n  default_theme?: string;\n  submit_requirement_dashboard_columns?: string[];\n  dashboard_show_all_labels?: boolean;\n  metadata?: MetadataInfo[];\n}\n\n/**\n * Contains the list of Validation options applicable to a change.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#validation-options\n */\nexport declare interface ValidationOptionsInfo {\n  validation_options: ValidationOptionInfo[];\n}\n\n/**\n * The push options that can be specified by the user on push\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#validation-option-info\n */\nexport declare interface ValidationOptionInfo {\n  name: string;\n  description: string;\n}\n\n/**\n * The SshdInfo entity contains information about Gerrit configuration from the sshd section.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#sshd-info\n * This entity doesn\u2019t contain any data, but the presence of this (empty) entity\n * in the ServerInfo entity means that SSHD is enabled on the server.\n */\nexport type SshdInfo = {};\n\n/**\n * The MetadataInfo entity contains contains metadata provided by plugins.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#metadata-info\n */\nexport declare interface MetadataInfo {\n  name: string;\n  value?: string;\n  description?: string;\n  web_links?: WebLinkInfo[];\n}\n\n// Timestamps are given in UTC and have the format\n// \"'yyyy-mm-dd hh:mm:ss.fffffffff'\"\n// where \"'ffffffffff'\" represents nanoseconds.\n\n/**\n * Information about the default submittype of a repository, taking into account\n * repository inheritance.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#submit-type-info\n */\nexport declare interface SubmitTypeInfo {\n  value: Exclude<SubmitType, SubmitType.INHERIT>;\n  configured_value: SubmitType;\n  inherited_value: Exclude<SubmitType, SubmitType.INHERIT>;\n}\n\n/**\n * The SuggestInfo entity contains information about Gerritconfiguration from\n * the suggest section.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#suggest-info\n */\nexport declare interface SuggestInfo {\n  from: number;\n}\n\nexport type Timestamp = BrandType<string, '_timestamp'>;\n// The timezone offset from UTC in minutes\n\nexport type TopicName = BrandType<string, '_topicName'>;\n\nexport type TrackingId = BrandType<string, '_trackingId'>;\n\n/**\n * The TrackingIdInfo entity describes a reference to an external tracking\n * system.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#tracking-id-info\n */\nexport declare interface TrackingIdInfo {\n  system: string;\n  id: TrackingId;\n}\n\n/**\n * The UserConfigInfo entity contains information about Gerrit configuration\n * from the user section.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#user-config-info\n */\nexport declare interface UserConfigInfo {\n  anonymous_coward_name: string;\n}\n\n/**\n * The VotingRangeInfo entity describes the continuous voting range from minto\n * max values.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#voting-range-info\n */\nexport declare interface VotingRangeInfo {\n  min: number;\n  max: number;\n}\n\n/**\n * The WebLinkInfo entity describes a link to an external site.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#web-link-info\n */\nexport declare interface WebLinkInfo {\n  /** The text to be linkified. */\n  name: string;\n  /** Tooltip to show when hovering over the link. */\n  tooltip?: string;\n  /** The link URL. */\n  url: string;\n  /** URL to the icon of the link. */\n  image_url?: string;\n}\n\n/**\n * The SubmitRequirementResultInfo describes the result of evaluating\n * a submit requirement on a change.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-requirement-result-info\n */\nexport declare interface SubmitRequirementResultInfo {\n  name: string;\n  description?: string;\n  status: SubmitRequirementStatus;\n  applicability_expression_result?: SubmitRequirementExpressionInfo;\n  submittability_expression_result: SubmitRequirementExpressionInfo;\n  override_expression_result?: SubmitRequirementExpressionInfo;\n  is_legacy?: boolean;\n}\n\n/**\n * The SubmitRequirementExpressionInfo describes the result of evaluating\n * a single submit requirement expression, for example label:code-review=+2.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-requirement-expression-info\n */\nexport declare interface SubmitRequirementExpressionInfo {\n  expression: string;\n  fulfilled?: boolean;\n  status?: SubmitRequirementExpressionInfoStatus;\n  passing_atoms?: string[];\n  failing_atoms?: string[];\n  atom_explanations?: {[atom: string]: string};\n  error_message?: string;\n}\n\nexport enum SubmitRequirementExpressionInfoStatus {\n  PASS = 'PASS',\n  FAIL = 'FAIL',\n  ERROR = 'ERROR',\n  NOT_EVALUATED = 'NOT_EVALUATED',\n}\n\n/**\n * Status describing the result of evaluating the submit requirement.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-requirement-result-info\n */\nexport enum SubmitRequirementStatus {\n  SATISFIED = 'SATISFIED',\n  UNSATISFIED = 'UNSATISFIED',\n  OVERRIDDEN = 'OVERRIDDEN',\n  NOT_APPLICABLE = 'NOT_APPLICABLE',\n  ERROR = 'ERROR',\n  FORCED = 'FORCED',\n}\n\nexport type UrlEncodedRepoName = BrandType<string, '_urlEncodedRepoName'>;\n\n/**\n * The SubmitRecordInfo entity describes results from a submit_rule.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-record-info\n */\nexport declare interface SubmitRecordInfo {\n  rule_name: string;\n  status?: SubmitRecordInfoStatus;\n  labels?: SubmitRecordInfoLabel[];\n  requirements?: Requirement[];\n  error_message?: string;\n}\n\nexport enum SubmitRecordInfoStatus {\n  OK = 'OK',\n  NOT_READY = 'NOT_READY',\n  CLOSED = 'CLOSED',\n  FORCED = 'FORCED',\n  RULE_ERROR = 'RULE_ERROR',\n}\n\nexport enum LabelStatus {\n  /**\n   * This label provides what is necessary for submission.\n   */\n  OK = 'OK',\n  /**\n   * This label prevents the change from being submitted.\n   */\n  REJECT = 'REJECT',\n  /**\n   * The label may be set, but it's neither necessary for submission\n   * nor does it block submission if set.\n   */\n  MAY = 'MAY',\n  /**\n   * The label is required for submission, but has not been satisfied.\n   */\n  NEED = 'NEED',\n  /**\n   * The label is required for submission, but is impossible to complete.\n   * The likely cause is access has not been granted correctly by the\n   * repository owner or site administrator.\n   */\n  IMPOSSIBLE = 'IMPOSSIBLE',\n  OPTIONAL = 'OPTIONAL',\n}\n\n/**\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-record-info\n */\nexport declare interface SubmitRecordInfoLabel {\n  label: string;\n  status: LabelStatus;\n  appliedBy: AccountInfo;\n}\n\n/**\n * Represent a file in a base64 encoding; GrRestApiInterface returns\n * it from some methods\n */\nexport declare interface Base64FileContent {\n  content: string | null;\n  type: string | null;\n  ok: true;\n}\n\nexport function isBase64FileContent(\n  res: Response | Base64FileContent\n): res is Base64FileContent {\n  return (res as Base64FileContent).ok;\n}\n\n// The URL encoded UUID of the comment\nexport type UrlEncodedCommentId = BrandType<string, '_urlEncodedCommentId'>;\n\n/**\n * The FixSuggestionInfo entity represents a suggested fix\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#fix-suggestion-info\n */\nexport declare interface FixSuggestionInfoInput {\n  description: string;\n  replacements: FixReplacementInfo[];\n}\n\n/**\n * The FixReplacementInfo entity describes how the content of a file should be replaced by another content\n * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#fix-replacement-info\n */\nexport declare interface FixReplacementInfo {\n  path: string;\n  range: CommentRange;\n  replacement: string;\n}\n// The UUID of the suggested fix.\nexport type FixId = BrandType<string, '_fixId'>;\n\nexport declare interface FixSuggestionInfo extends FixSuggestionInfoInput {\n  fix_id: FixId;\n  description: string;\n  replacements: FixReplacementInfo[];\n  log_probability?: number;\n}\n\n/**\n * The LabelDefinitionInfo entity describes a review label.\n *\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#label-definition-info\n */\nexport interface LabelDefinitionInfo {\n  name: string;\n  description?: string;\n  project_name: string;\n  function: LabelDefinitionInfoFunction;\n  values: LabelValueToDescriptionMap;\n  default_value: number;\n  branches?: string[];\n  can_override?: boolean;\n  copy_condition?: string;\n  allow_post_submit?: boolean;\n  ignore_self_approval?: boolean;\n}\n\nexport enum LabelDefinitionInfoFunction {\n  MaxWithBlock = 'MaxWithBlock',\n  AnyWithBlock = 'AnyWithBlock',\n  MaxNoBlock = 'MaxNoBlock',\n  NoBlock = 'NoBlock',\n  Noop = 'Noop',\n  PatchSetLock = 'PatchSetLock',\n}\n\n/**\n * The LabelDefinitionInput entity describes a label definition input.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#label-definition-input\n */\nexport interface LabelDefinitionInput {\n  commit_message?: string;\n  name?: string;\n  description?: string;\n  function?: LabelDefinitionInfoFunction;\n  values?: LabelValueToDescriptionMap;\n  default_value?: number;\n  branches?: string[];\n  can_override?: boolean;\n  copy_condition?: string;\n  unset_copy_condition?: boolean;\n  allow_post_submit?: boolean;\n  ignore_self_approval?: boolean;\n}\n\n/*\n * The DeleteLabelInput entity describes a delete label input\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#delete-label-input\n */\nexport interface DeleteLabelInput {\n  commit_message?: string;\n}\n\n/**\n * The BatchLabelInput entity describes a batch label input\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#batch-label-input\n */\nexport interface BatchLabelInput {\n  create?: LabelDefinitionInput[];\n  update?: {[labelName: string]: Partial<LabelDefinitionInput>};\n  delete?: string[];\n}\n\n/**\n * The SubmitRequirementInput entity describes a submit requirement input.\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#submit-requirement-input\n */\nexport interface SubmitRequirementInput {\n  name: string;\n  description?: string;\n  applicability_expression?: string;\n  submittability_expression: string;\n  override_expression?: string;\n  allow_override_in_child_projects?: boolean;\n}\n\n/**\n * The BatchSubmitRequirementInput entity describes a batch submit requirement input\n * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#batch-submit-requirement-input\n */\nexport interface BatchSubmitRequirementInput {\n  create?: SubmitRequirementInput[];\n  update?: {[submitRequirementName: string]: Partial<SubmitRequirementInput>};\n  delete?: string[];\n  commit_message?: string;\n}\n\n/**\n * The IsFlowsEnabledInfo entity contains information about whether flows are\n * enabled.\n */\nexport declare interface IsFlowsEnabledInfo {\n  enabled: boolean;\n}\n","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {ChangeInfo, CommentRange} from './rest-api';\n\nexport declare interface ChecksPluginApi {\n  /**\n   * Must only be called once. You cannot register twice. You cannot unregister.\n   */\n  register(provider: ChecksProvider, config?: ChecksApiConfig): void;\n\n  /**\n   * Forces Gerrit to call fetch() on the registered provider. Can be called\n   * when the provider has gotten an update and does not want wait for the next\n   * polling interval to pass.\n   */\n  announceUpdate(): void;\n\n  /**\n   * Updates an individual result.\n   *\n   * This can be used for lazy loading detailed information. For example, if you\n   * are using the `check-result-expanded` endpoint, then you can load more\n   * result details when the user expands a result row.\n   *\n   * The parameter `run` is only used to *find* the correct run for updating the\n   * result. It will only be used for comparing `change`, `patchset`, `attempt`\n   * and `checkName`. Its properties other than `results` will not be updated.\n   *\n   * For us being able to identify the result that you want to update you have\n   * to set the `externalId` property. An undefined `externalId` will result in\n   * an error.\n   */\n  updateResult(run: CheckRun, result: CheckResult): void;\n}\n\nexport declare interface ChecksApiConfig {\n  /**\n   * How often should the provider be called for new CheckData while the user\n   * navigates change related pages and the browser tab remains visible?\n   * Set to 0 to disable polling. Default is 60 seconds.\n   */\n  fetchPollingIntervalSeconds: number;\n}\n\nexport declare interface ChangeData {\n  changeNumber: number;\n  patchsetNumber: number;\n  patchsetSha: string;\n  repo: string;\n  commitMessage?: string;\n  changeInfo: ChangeInfo;\n}\n\nexport declare interface ChecksProvider {\n  /**\n   * Gerrit calls this method when ...\n   * - ... the change or diff page is loaded.\n   * - ... the user switches back to a Gerrit tab with a change or diff page.\n   * - ... while the tab is visible in a regular polling interval, see\n   *       ChecksApiConfig.\n   */\n  fetch(change: ChangeData): Promise<FetchResponse>;\n}\n\nexport declare interface FetchResponse {\n  responseCode: ResponseCode;\n\n  /** Only relevant when the responseCode is ERROR. */\n  errorMessage?: string;\n\n  /**\n   * Only relevant when the responseCode is NOT_LOGGED_IN.\n   * Gerrit displays a \"Login\" button and calls this callback when the user\n   * clicks on the button.\n   */\n  loginCallback?: () => void;\n\n  /**\n   * Top-level actions that are not associated with a specific run or result.\n   * Will be shown as buttons in the header of the Checks tab.\n   */\n  actions?: Action[];\n\n  /**\n   * Shown prominently in the change summary below the run chips. Interpreted\n   * as markdown.\n   */\n  summaryMessage?: string;\n\n  /**\n   * Top-level links that are not associated with a specific run or result.\n   * Will be shown as icons in the header of the Checks tab.\n   */\n  links?: Link[];\n\n  runs?: CheckRun[];\n}\n\nexport enum ResponseCode {\n  OK = 'OK',\n  ERROR = 'ERROR',\n  NOT_LOGGED_IN = 'NOT_LOGGED_IN',\n}\n\n/**\n * A CheckRun models an entity that has start/end timestamps and can be in\n * either of the states RUNNABLE, RUNNING, COMPLETED. By itself it cannot model\n * an error, neither can it be failed or successful by itself. A run can be\n * associated with 0 to n results (see below). So until runs are completed the\n * runs are more interesting for the user: What is going on at the moment? When\n * runs are completed the users' interest shifts to results: What do I have to\n * fix? The only actions that can be associated with runs are RUN and CANCEL.\n */\nexport declare interface CheckRun {\n  /**\n   * Gerrit requests check runs and results from the plugin by change number and\n   * patchset number. So these two properties can as well be left empty when\n   * returning results to the Gerrit UI and are thus optional.\n   */\n  change?: number;\n  /**\n   * Typically only runs for the latest patchset are requested and presented.\n   * Older runs and their results are only available on request, e.g. by\n   * switching to another patchset in a dropdown\n   *\n   * TBD: Check data providers may decide that runs and results are applicable\n   * to a newer patchset, even if they were produced for an older, e.g. because\n   * only the commit message was changed. Maybe that warrants the addition of\n   * another optional field, e.g. `original_patchset`.\n   */\n  patchset?: number;\n  /**\n   * The UI will focus on just the latest attempt per run. Former attempts are\n   * accessible, but initially collapsed/hidden. Lower number means older\n   * attempt. Every run has its own attempt numbering, so attempt 3 of run A is\n   * not directly related to attempt 3 of run B.\n   *\n   * The attempt number must be >=0. Only if you have just one RUNNABLE attempt,\n   * then you can leave it undefined.\n   *\n   * TBD: Optionally providing aggregate information about former attempts will\n   * probably be a useful feature, but we are deferring the exact data modeling\n   * of that to later.\n   */\n  attempt?: number;\n\n  /**\n   * An optional opaque identifier not used by Gerrit directly, but might be\n   * used by plugin extensions and callbacks.\n   */\n  externalId?: string;\n\n  // The following 3 properties are independent of this run *instance*. They\n  // just describe what the check is about and will be identical for other\n  // attempts or patchsets or changes.\n\n  /**\n   * The unique name of the check. There can\u2019t be two runs with the same\n   * change/patchset/attempt/checkName combination.\n   * Multiple attempts of the same run must have the same checkName.\n   * It should be expected that this string is cut off at ~30 chars in the UI.\n   * The full name will then be shown in a tooltip.\n   */\n  checkName: string;\n  /**\n   * Optional description of the check. Only shown as a tooltip or in a\n   * hovercard. Interpreted as markdown.\n   */\n  checkDescription?: string;\n  /**\n   * Optional http link to an external page with more detailed information about\n   * this run. Must begin with 'http'.\n   */\n  checkLink?: string;\n\n  /**\n   * Indicates that the check run is powered by Aritificial Intelligence. This\n   * allows the UI to add special treatment, e.g. an icon to be added to the\n   * check name. Defaults to `false`.\n   */\n  isAiPowered?: boolean;\n\n  /**\n   * RUNNABLE:  Not run (yet). Mostly useful for runs that the user can trigger\n   *            (see actions) and for indicating that a check was not run at a\n   *            later attempt. Cannot contain results.\n   * RUNNING:   The run is in progress.\n   * SCHEDULED: Refinement of RUNNING: The run was triggered, but is not yet\n   *            running. It may have to wait for resources or for some other run\n   *            to finish. The UI treats this mostly identical to RUNNING, but\n   *            uses a differnt icon.\n   * COMPLETED: The attempt of the run has finished. Does not indicate at all\n   *            whether the run was successful or not. Outcomes can and should\n   *            be modeled using the CheckResult entity.\n   */\n  status: RunStatus;\n  /**\n   * Optional short description of the run status. This is a plain string\n   * without styling or formatting options. It will only be shown as a tooltip\n   * or in a hovercard.\n   *\n   * Examples:\n   * \"40 tests running, 30 completed: 0 failing so far\",\n   * \"Scheduled 5 minutes ago, not running yet\".\n   */\n  statusDescription?: string;\n  /**\n   * Optional http link to an external page with more detailed information about\n   * the run status. Must begin with 'http'.\n   */\n  statusLink?: string;\n\n  /**\n   * Optional reference to a Gerrit label (e.g. \"Verified\") that this result\n   * influences. Allows the user to understand and navigate the relationship\n   * between check runs/results and submit requirements,\n   * see also https://gerrit-review.googlesource.com/c/homepage/+/279176.\n   */\n  labelName?: string;\n\n  /**\n   * Optional callbacks to the plugin. Must be implemented individually by\n   * each plugin. The most important actions (which get special UI treatment)\n   * are:\n   * \"Run\" for RUNNABLE and COMPLETED runs.\n   * \"Cancel\" for RUNNING and SCHEDULED runs.\n   */\n  actions?: Action[];\n\n  scheduledTimestamp?: Date;\n  startedTimestamp?: Date;\n  /**\n   * For RUNNING runs this is considered to be an estimate of when the run will\n   * be finished.\n   */\n  finishedTimestamp?: Date;\n\n  /**\n   * List of results produced by this run.\n   * RUNNABLE runs must not have results.\n   * RUNNING runs can contain (intermediate) results.\n   * Nesting the results in runs enforces that:\n   * - A run can have 0-n results.\n   * - A result is associated with exactly one run.\n   */\n  results?: CheckResult[];\n}\n\nexport declare interface Action {\n  name: string;\n  tooltip?: string;\n  /**\n   * Primary actions will get a more prominent treatment in the UI. For example\n   * top-level primary actions may appear as buttons instead of menu items in\n   * an overflow menu and primary actions associated with a CheckRun may render\n   * next to the run name.\n   */\n  primary?: boolean;\n  /**\n   * Summary actions will get an even more prominent treatment in the UI. They\n   * will show up in the checks summary right below the commit message. This\n   * only affects top-level actions (i.e. actions in FetchResponse).\n   */\n  summary?: boolean;\n  /**\n   * Renders the action button in a disabled state. That can be useful for\n   * actions that are present most of the time, but sometimes don't apply. Then\n   * a grayed out button with a tooltip makes it easier for the user to\n   * understand why an expected action is not available. The tooltip should then\n   * contain a message about why the disabled state was set, not just about what\n   * the action would normally do.\n   */\n  disabled?: boolean;\n  callback: ActionCallback;\n}\n\n/**\n * Action names that get special UI treatment.\n */\nexport const USEFUL = 'useful';\nexport const NOT_USEFUL = 'not-useful';\n\nexport type ActionCallback = (\n  change: number,\n  patchset: number,\n  /**\n   * Identical to 'attempt' property of CheckRun. Not set for top-level\n   * actions.\n   */\n  attempt: number | undefined,\n  /**\n   * Identical to 'externalId' property of CheckRun. Not set for top-level\n   * actions.\n   */\n  externalId: string | undefined,\n  /**\n   * Identical to 'checkName' property of CheckRun. Not set for top-level\n   * actions.\n   */\n  checkName: string | undefined,\n  /** Identical to 'name' property of Action entity. */\n  actionName: string\n  /**\n   * If the callback does not return a promise, then the user will get no\n   * feedback from the Gerrit UI. This is adequate when the plugin opens a\n   * dialog for example. If a Promise<ActionResult> is returned, then Gerrit\n   * will show toasts for user feedback, see ActionResult below.\n   */\n) => Promise<ActionResult> | undefined;\n\n/**\n * Until the Promise<ActionResult> resolves (max. 5 seconds) Gerrit will show a\n * toast with the message `Triggering action '${action.name}' ...`.\n *\n * When the promise resolves (within 5 seconds) then Gerrit will replace the\n * toast with a new one with the message `${message}` and show it for 5 seconds.\n * If `message` is empty or undefined, then the `Triggering ...` toast will just\n * be hidden and no further toast will be shown.\n */\nexport declare interface ActionResult {\n  /** An empty errorMessage means success. */\n  message?: string;\n  /**\n   * If true, then ChecksProvider.fetch() is called. Has the same affect as if\n   * the plugin would call announceUpdate(). So just for convenience.\n   */\n  shouldReload?: boolean;\n  /** DEPRECATED: Use `message` instead. */\n  errorMessage?: string;\n}\n\n/** See CheckRun.status for documentation. */\nexport enum RunStatus {\n  RUNNABLE = 'RUNNABLE',\n  RUNNING = 'RUNNING',\n  SCHEDULED = 'SCHEDULED',\n  COMPLETED = 'COMPLETED',\n}\n\nexport declare interface CheckResult {\n  /**\n   * An optional opaque identifier not used by Gerrit directly, but might be\n   * used by plugin extensions and callbacks.\n   */\n  externalId?: string;\n\n  /**\n   * SUCCESS: Indicates that some build, test or check is passing. A COMPLETED\n   *          run without results will also be treated as \"passing\" and will get\n   *          an artificial SUCCESS result. But you can also make this explicit,\n   *          which also allows one run to have multiple \"passing\" results,\n   *          maybe along with results of other categories.\n   * INFO:    The user will typically not bother to look into this category,\n   *          only for looking up something that they are searching for. Can be\n   *          used for reporting secondary metrics and analysis, or a wider\n   *          range of artifacts produced by the checks system.\n   * WARNING: A warning is something that should be read before submitting the\n   *          change. The user should not ignore it, but it is also not blocking\n   *          submit. It has a similar level of importance as an unresolved\n   *          comment.\n   * ERROR:   An error indicates that the change must not or cannot be submitted\n   *          without fixing the problem. Errors will be visualized very\n   *          prominently to the user.\n   *\n   * The \u2018tags\u2019 field below can be used for further categorization, e.g. for\n   * distinguishing FAILED vs TIMED_OUT.\n   */\n  category: Category;\n\n  /**\n   * Short description of the check result.\n   *\n   * It should be expected that this string might be cut off at ~80 chars in the\n   * UI. The full description will then be shown in a tooltip.\n   * This is a plain string without styling or formatting options.\n   *\n   * Examples:\n   * MessageConverterTest failed with: 'kermit' expected, but got 'ernie'.\n   * Binary size of javascript bundle has increased by 27%.\n   */\n  summary: string;\n\n  /**\n   * Exhaustive optional message describing the check result.\n   * Will be initially collapsed. Might potentially be very long, e.g. a log of\n   * MB size. The UI is not limiting this. Data providing plugins are\n   * responsible for not killing the browser. :-)\n   *\n   * For now this is just a plain unformatted string. The only formatting\n   * applied is the one that Gerrit also applies to human comments.\n   *\n   * To provide richer formatting to the check result messages you should use\n   * the `check-result-expanded` plugin endpoint to attach a Web Component.\n   * See `Documentation/pg-plugin-endpoints.txt`.\n   */\n  message?: string;\n\n  /**\n   * Tags allow a plugins to further categorize a result, e.g. making a list\n   * of results filterable by the end-user.\n   * The name is free-form, but there is a predefined set of TagColors to\n   * choose from with a recommendation of color for common tags, see below.\n   *\n   * Examples:\n   * PASS, FAIL, SCHEDULED, OBSOLETE, SKIPPED, TIMED_OUT, INFRA_ERROR, FLAKY\n   * WIN, MAC, LINUX\n   * BUILD, TEST, LINT\n   * INTEGRATION, E2E, SCREENSHOT\n   */\n  tags?: Tag[];\n\n  /**\n   * Links provide an opportunity for the end-user to easily access details and\n   * artifacts. Links are displayed by an icon+tooltip only. They don\u2019t have a\n   * name, making them clearly distinguishable from tags and actions.\n   *\n   * There is a fixed set of LinkIcons to choose from, see below.\n   *\n   * Examples:\n   * Link to test log.\n   * Link to result artifacts such as images and screenshots.\n   * Link to downloadable artifacts such as ZIP or APK files.\n   */\n  links?: Link[];\n\n  /**\n   * Link to lines of code. The referenced path must be part of this patchset.\n   *\n   * Only one code pointer is supported. If the array contains, more than one\n   * pointer, then all the other pointers will be ignored. Support for multiple\n   * code pointers will only added on demand.\n   */\n  codePointers?: CodePointer[];\n\n  /**\n   * Callbacks to the plugin. Must be implemented individually by each\n   * plugin. Actions are rendered as buttons. If there are more than two actions\n   * per result, then further actions are put into an overflow menu. Sort order\n   * is defined by the data provider.\n   *\n   * The actions with the names 'useful' and 'not-useful' will get special UI\n   * treatment (clickable thumbs-up and thumbs-down icons).\n   *\n   * Examples:\n   * Acknowledge/Dismiss, Delete, Report a bug, Report as not useful,\n   * Make blocking, Downgrade severity.\n   */\n  actions?: Action[];\n\n  /**\n   * Optionally you can provide fixes that would solve the issue reported. The\n   * user will then see a \"SHOW FIX\" button for previewing the fix in a dialog,\n   * whichs allows the user to apply the fix. That will create a new EDIT\n   * patchset or use the exiting EDIT patchset, so the user can also apply fixes\n   * from multiple check results.\n   *\n   * Normally, you would only provide one fix, but you can also provide multiple\n   * different options to the user to choose from. Each fix may contain one or\n   * more replacements, each being a modification of one file. These files do\n   * not have to be part of the change yet.\n   */\n  fixes?: Fix[];\n\n  /**\n   * If the result has a code pointer that points to an *unchanged* piece of\n   * code, then we hide the result, if this value is `false`.\n   *\n   * Default: true\n   */\n  show_on_unchanged_lines?: boolean;\n}\n\nexport declare interface Fix {\n  description?: string;\n  replacements: Replacement[];\n}\n\nexport declare interface Replacement {\n  /**\n   * For example `polygerrit-ui/app/package.json`.\n   * `/COMMIT_MSG` is not supported yet.\n   */\n  path: string;\n  range: CommentRange;\n  replacement: string;\n}\n\nexport enum Category {\n  SUCCESS = 'SUCCESS',\n  INFO = 'INFO',\n  WARNING = 'WARNING',\n  ERROR = 'ERROR',\n}\n\nexport declare interface Tag {\n  name: string;\n  tooltip?: string;\n  color?: TagColor;\n}\n\n// TBD: Clarify standard colors for common tags.\nexport enum TagColor {\n  GRAY = 'gray',\n  YELLOW = 'yellow',\n  PINK = 'pink',\n  PURPLE = 'purple',\n  CYAN = 'cyan',\n  BROWN = 'brown',\n}\n\nexport declare interface Link {\n  /** Must begin with 'http'. */\n  url: string;\n  tooltip?: string;\n  /**\n   * Primary links will get a more prominent treatment in the UI, e.g. being\n   * always visible in the results table or also showing up in the change page\n   * summary of checks.\n   */\n  primary: boolean;\n  icon: LinkIcon;\n}\n\nexport declare interface CodePointer {\n  path: string;\n  range: CommentRange;\n}\n\nexport enum LinkIcon {\n  EXTERNAL = 'external',\n  IMAGE = 'image',\n  HISTORY = 'history',\n  DOWNLOAD = 'download',\n  DOWNLOAD_MOBILE = 'download_mobile',\n  HELP_PAGE = 'help_page',\n  REPORT_BUG = 'report_bug',\n  CODE = 'code',\n  FILE_PRESENT = 'file_present',\n  VIEW_TIMELINE = 'view_timeline',\n}\n","import {ChecksProvider} from 'google3/third_party/javascript/polygerrit/api/checks';\nimport 'google3/third_party/javascript/polygerrit/api/gerrit';\nimport {ChecksFetcher} from './checks-fetcher';\n\nwindow.Gerrit.install(async (plugin) => {\n  const provider: ChecksProvider = new ChecksFetcher(plugin.restApi());\n  plugin.checks().register(provider);\n});\n"],
"names":["snake2camel","obj","Array","isArray","map","result","snakeKey__tsickle_destructured_1","value__tsickle_destructured_2","Object","entries","value","camelKey","replace","_","match","toUpperCase","ResponseError","Error","constructor","response","listChecks","changeNumber","patchsetNumber","errFn","error","restApi","send","GET","undefined","err","text","status","console","log","triggerAction","actionName","findingId","POST","input","name","finding_id","module$exports$google3$java$com$google$devtools$gerritcodereview$plugins$findings$web$checks$2dfetcher.ChecksFetcher","fetch","changeData","then","runs","responseCode","OK","run","change","patchset","addAiPrefix","addActionCallbacks","catch","message","ERROR","errorMessage","toString","checkRun","isAiPowered","checkName","startsWith","actionCallback","results","externalId","actions","some","a","push","action","callback","action.callback","window","Gerrit","install","plugin","provider","checks","register"]
}
