@knapsack/types 4.95.0 → 4.95.1--canary.7832.692f3e0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -145,6 +145,16 @@ export interface GitProvider {
145
145
  }) => Promise<{
146
146
  clientMutationId?: string;
147
147
  }>;
148
+ /**
149
+ * Force-updates the branch ref to point at the base branch's HEAD,
150
+ * discarding the branch's existing commits. Used instead of
151
+ * `deleteBranch` + `createBranch` when the branch has an open PR, since
152
+ * deleting the branch would close the PR. Optional: only providers whose
153
+ * API can force-move a ref implement this.
154
+ */
155
+ resetBranchToBase?: (opt: {
156
+ branch: string;
157
+ }) => Promise<BranchInfoResult>;
148
158
  getFileInfoOnBranchByPath: (opt: {
149
159
  filePath: string;
150
160
  branch: string;
@@ -1 +1 @@
1
- {"version":3,"file":"git-providers.d.ts","sourceRoot":"","sources":["../src/git-providers.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,aAAa;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,iEAAiE;IACjE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,oBAAY,cAAc;IACxB,WAAW,gBAAgB;I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AAAA,CAAA,UAAA,CAAa,YAAA,CACbA,CAAAA,CAAA,SAAA,CAAY,YACZA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CALEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CA+BAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,EAAA,WAAA,CAAc,aAAA,CACdA,CAAAA,CAAA,SAAA,CAAY,WAAA,CACZA,CAAAA,CAAA,QAAU,SAAA,CAHAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAMAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,MAAA,CAAS,SACTA,CAAAA,CAAA,IAAA,CAAO,MAAA,CACPA,CAAAA,CAAA,MAAA,CAAS,QAAA,CACTA,EAAA,KAAA,CAAQ,OAAA,CAJEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAOAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,OAAS,QAAA,CACTA,CAAAA,CAAA,IAAA,CAAO,MAAA,CAFGA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA","file":"git-providers.js","sourcesContent":["export enum GitProviderType {\n GitHub = 'GitHub',\n GitLab = 'GitLab',\n GitLabRest = 'GitLabRest',\n Bitbucket = 'Bitbucket',\n Azure = 'Azure',\n}\n\nexport type FileAddition = {\n /** base64 */\n contents: string;\n path: string;\n\n /** Action to perform: create, delete, move, update, or chmod. */\n action?: RestActions;\n /** Content of the file. */\n content?: string;\n /** Full path to the file. */\n filePath?: string;\n /** Encoding of the file. Default is text. */\n encoding?: TextEncoding;\n /** Last known file commit ID. */\n lastCommitId?: string;\n /** Original full path to the file being moved. */\n previousPath?: string;\n};\n\nexport type FileDeletion = {\n path: string;\n};\n\nexport enum MergeableState {\n Conflicting = 'CONFLICTING',\n Mergeable = 'MERGEABLE',\n Unknown = 'UNKNOWN',\n}\n\nexport enum RestActions {\n Create = 'CREATE',\n Move = 'MOVE',\n Update = 'UPDATE',\n Chmod = 'CHMOD',\n}\n\nexport enum TextEncoding {\n Base64 = 'BASE64',\n Text = 'TEXT',\n}\n\nexport type FileChanges = {\n /** File to add or change. */\n additions?: FileAddition[];\n\n /** Files to delete. */\n deletions?: FileDeletion[];\n\n /** Last known file commit ID. */\n lastCommitId?: string;\n};\n\nexport type CommitAction = Record<string, unknown>;\n\nexport interface RepoLabel {\n name: string;\n /** ID optional because bitbucket does not provide id. We might be able to generate one if its required, eg. reponame-labelname */\n id?: string;\n}\n\nexport interface RepoInfo {\n id: string;\n url: string;\n name: string;\n ownerName?: string;\n defaultBranch?: any;\n}\n\n// 'BranchInfo' name is currently taken by GitLab generated queries. Thus 'BranchInfoResult'\nexport interface BranchInfoResult {\n sha?: string; // If branch info is not found, this can be undefined\n shortSha?: string;\n associatedPullRequests?: Pr[];\n additions?: number;\n commitUrl?: string;\n deletions?: number;\n id?: string; // In GitLab, this is the branch name. Modelled this way to make deleteBranch work.\n default?: boolean;\n}\n\nexport interface PrInfo {\n url: string;\n number: number;\n id: string;\n}\n\nexport interface Pr {\n id: string;\n title: string;\n createdAt: string;\n headRef: {\n id?: string;\n name?: string;\n target: BranchInfoResult;\n };\n mergeable: MergeableState;\n merged: boolean;\n number: number;\n body: string;\n isDraft: boolean;\n url: string;\n author: {\n login: string;\n avatarUrl?: string;\n };\n diffHeadSha?: string;\n targetBranch?: string;\n version?: string; // needed for bitbucket merge\n}\n\nexport interface GitProvider {\n type: GitProviderType;\n createBranch: (opt: { branch: string }) => Promise<BranchInfoResult>;\n commitOnBranch: (opt: {\n branch: string;\n message: string;\n fileChanges: FileChanges;\n }) => Promise<Record<string, unknown> | void>;\n getRepoLabels: () => Promise<RepoLabel[]>;\n getRepoInfo: () => Promise<RepoInfo>;\n getBranchInfo: ({ branch }: { branch: string }) => Promise<BranchInfoResult>;\n getPrs: () => Promise<Pr[]>;\n getPr: ({ prNumber }: { prNumber: number }) => Promise<Pr>;\n getTree?: (opt: { branch: string }) => Promise<{\n treeItems: {\n path: string;\n type: 'blob';\n /** SHA-1, use https://www.npmjs.com/package/git-hash-object */\n sha: string;\n url?: string;\n }[];\n }>;\n mergePr: ({ prNumber }: { prNumber: number }) => Promise<boolean>;\n createPr: ({\n siteId,\n branch,\n title,\n body,\n labelIds,\n }: {\n siteId: string;\n branch: string;\n title: string;\n body?: string;\n labelIds?: string[];\n }) => Promise<PrInfo>;\n deleteBranch: ({ id, branch }: { id: string; branch: string }) => Promise<{\n clientMutationId?: string;\n }>;\n getFileInfoOnBranchByPath: (opt: {\n filePath: string;\n branch: string;\n }) => Promise<{ exists: boolean; filePath: string }>;\n}\n"]}
1
+ {"version":3,"sources":["../src/git-providers.ts"],"names":["GitProviderType","MergeableState","RestActions","TextEncoding"],"mappings":"aAAO,IAAKA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,MAAA,CAAS,QAAA,CACTA,CAAAA,CAAA,OAAS,QAAA,CACTA,CAAAA,CAAA,UAAA,CAAa,YAAA,CACbA,CAAAA,CAAA,SAAA,CAAY,YACZA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CALEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CA+BAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,EAAA,WAAA,CAAc,aAAA,CACdA,CAAAA,CAAA,SAAA,CAAY,WAAA,CACZA,CAAAA,CAAA,QAAU,SAAA,CAHAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAMAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,MAAA,CAAS,SACTA,CAAAA,CAAA,IAAA,CAAO,MAAA,CACPA,CAAAA,CAAA,MAAA,CAAS,QAAA,CACTA,EAAA,KAAA,CAAQ,OAAA,CAJEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAOAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,OAAS,QAAA,CACTA,CAAAA,CAAA,IAAA,CAAO,MAAA,CAFGA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA","file":"git-providers.js","sourcesContent":["export enum GitProviderType {\n GitHub = 'GitHub',\n GitLab = 'GitLab',\n GitLabRest = 'GitLabRest',\n Bitbucket = 'Bitbucket',\n Azure = 'Azure',\n}\n\nexport type FileAddition = {\n /** base64 */\n contents: string;\n path: string;\n\n /** Action to perform: create, delete, move, update, or chmod. */\n action?: RestActions;\n /** Content of the file. */\n content?: string;\n /** Full path to the file. */\n filePath?: string;\n /** Encoding of the file. Default is text. */\n encoding?: TextEncoding;\n /** Last known file commit ID. */\n lastCommitId?: string;\n /** Original full path to the file being moved. */\n previousPath?: string;\n};\n\nexport type FileDeletion = {\n path: string;\n};\n\nexport enum MergeableState {\n Conflicting = 'CONFLICTING',\n Mergeable = 'MERGEABLE',\n Unknown = 'UNKNOWN',\n}\n\nexport enum RestActions {\n Create = 'CREATE',\n Move = 'MOVE',\n Update = 'UPDATE',\n Chmod = 'CHMOD',\n}\n\nexport enum TextEncoding {\n Base64 = 'BASE64',\n Text = 'TEXT',\n}\n\nexport type FileChanges = {\n /** File to add or change. */\n additions?: FileAddition[];\n\n /** Files to delete. */\n deletions?: FileDeletion[];\n\n /** Last known file commit ID. */\n lastCommitId?: string;\n};\n\nexport type CommitAction = Record<string, unknown>;\n\nexport interface RepoLabel {\n name: string;\n /** ID optional because bitbucket does not provide id. We might be able to generate one if its required, eg. reponame-labelname */\n id?: string;\n}\n\nexport interface RepoInfo {\n id: string;\n url: string;\n name: string;\n ownerName?: string;\n defaultBranch?: any;\n}\n\n// 'BranchInfo' name is currently taken by GitLab generated queries. Thus 'BranchInfoResult'\nexport interface BranchInfoResult {\n sha?: string; // If branch info is not found, this can be undefined\n shortSha?: string;\n associatedPullRequests?: Pr[];\n additions?: number;\n commitUrl?: string;\n deletions?: number;\n id?: string; // In GitLab, this is the branch name. Modelled this way to make deleteBranch work.\n default?: boolean;\n}\n\nexport interface PrInfo {\n url: string;\n number: number;\n id: string;\n}\n\nexport interface Pr {\n id: string;\n title: string;\n createdAt: string;\n headRef: {\n id?: string;\n name?: string;\n target: BranchInfoResult;\n };\n mergeable: MergeableState;\n merged: boolean;\n number: number;\n body: string;\n isDraft: boolean;\n url: string;\n author: {\n login: string;\n avatarUrl?: string;\n };\n diffHeadSha?: string;\n targetBranch?: string;\n version?: string; // needed for bitbucket merge\n}\n\nexport interface GitProvider {\n type: GitProviderType;\n createBranch: (opt: { branch: string }) => Promise<BranchInfoResult>;\n commitOnBranch: (opt: {\n branch: string;\n message: string;\n fileChanges: FileChanges;\n }) => Promise<Record<string, unknown> | void>;\n getRepoLabels: () => Promise<RepoLabel[]>;\n getRepoInfo: () => Promise<RepoInfo>;\n getBranchInfo: ({ branch }: { branch: string }) => Promise<BranchInfoResult>;\n getPrs: () => Promise<Pr[]>;\n getPr: ({ prNumber }: { prNumber: number }) => Promise<Pr>;\n getTree?: (opt: { branch: string }) => Promise<{\n treeItems: {\n path: string;\n type: 'blob';\n /** SHA-1, use https://www.npmjs.com/package/git-hash-object */\n sha: string;\n url?: string;\n }[];\n }>;\n mergePr: ({ prNumber }: { prNumber: number }) => Promise<boolean>;\n createPr: ({\n siteId,\n branch,\n title,\n body,\n labelIds,\n }: {\n siteId: string;\n branch: string;\n title: string;\n body?: string;\n labelIds?: string[];\n }) => Promise<PrInfo>;\n deleteBranch: ({ id, branch }: { id: string; branch: string }) => Promise<{\n clientMutationId?: string;\n }>;\n /**\n * Force-updates the branch ref to point at the base branch's HEAD,\n * discarding the branch's existing commits. Used instead of\n * `deleteBranch` + `createBranch` when the branch has an open PR, since\n * deleting the branch would close the PR. Optional: only providers whose\n * API can force-move a ref implement this.\n */\n resetBranchToBase?: (opt: { branch: string }) => Promise<BranchInfoResult>;\n getFileInfoOnBranchByPath: (opt: {\n filePath: string;\n branch: string;\n }) => Promise<{ exists: boolean; filePath: string }>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/git-providers.ts"],"names":["GitProviderType","MergeableState","RestActions","TextEncoding"],"mappings":"AAAO,IAAKA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,MAAA,CAAS,QAAA,CACTA,CAAAA,CAAA,OAAS,QAAA,CACTA,CAAAA,CAAA,UAAA,CAAa,YAAA,CACbA,CAAAA,CAAA,SAAA,CAAY,YACZA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CALEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CA+BAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,EAAA,WAAA,CAAc,aAAA,CACdA,CAAAA,CAAA,SAAA,CAAY,WAAA,CACZA,CAAAA,CAAA,QAAU,SAAA,CAHAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAMAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,MAAA,CAAS,SACTA,CAAAA,CAAA,IAAA,CAAO,MAAA,CACPA,CAAAA,CAAA,MAAA,CAAS,QAAA,CACTA,EAAA,KAAA,CAAQ,OAAA,CAJEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAOAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,OAAS,QAAA,CACTA,CAAAA,CAAA,IAAA,CAAO,MAAA,CAFGA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA","file":"git-providers.mjs","sourcesContent":["export enum GitProviderType {\n GitHub = 'GitHub',\n GitLab = 'GitLab',\n GitLabRest = 'GitLabRest',\n Bitbucket = 'Bitbucket',\n Azure = 'Azure',\n}\n\nexport type FileAddition = {\n /** base64 */\n contents: string;\n path: string;\n\n /** Action to perform: create, delete, move, update, or chmod. */\n action?: RestActions;\n /** Content of the file. */\n content?: string;\n /** Full path to the file. */\n filePath?: string;\n /** Encoding of the file. Default is text. */\n encoding?: TextEncoding;\n /** Last known file commit ID. */\n lastCommitId?: string;\n /** Original full path to the file being moved. */\n previousPath?: string;\n};\n\nexport type FileDeletion = {\n path: string;\n};\n\nexport enum MergeableState {\n Conflicting = 'CONFLICTING',\n Mergeable = 'MERGEABLE',\n Unknown = 'UNKNOWN',\n}\n\nexport enum RestActions {\n Create = 'CREATE',\n Move = 'MOVE',\n Update = 'UPDATE',\n Chmod = 'CHMOD',\n}\n\nexport enum TextEncoding {\n Base64 = 'BASE64',\n Text = 'TEXT',\n}\n\nexport type FileChanges = {\n /** File to add or change. */\n additions?: FileAddition[];\n\n /** Files to delete. */\n deletions?: FileDeletion[];\n\n /** Last known file commit ID. */\n lastCommitId?: string;\n};\n\nexport type CommitAction = Record<string, unknown>;\n\nexport interface RepoLabel {\n name: string;\n /** ID optional because bitbucket does not provide id. We might be able to generate one if its required, eg. reponame-labelname */\n id?: string;\n}\n\nexport interface RepoInfo {\n id: string;\n url: string;\n name: string;\n ownerName?: string;\n defaultBranch?: any;\n}\n\n// 'BranchInfo' name is currently taken by GitLab generated queries. Thus 'BranchInfoResult'\nexport interface BranchInfoResult {\n sha?: string; // If branch info is not found, this can be undefined\n shortSha?: string;\n associatedPullRequests?: Pr[];\n additions?: number;\n commitUrl?: string;\n deletions?: number;\n id?: string; // In GitLab, this is the branch name. Modelled this way to make deleteBranch work.\n default?: boolean;\n}\n\nexport interface PrInfo {\n url: string;\n number: number;\n id: string;\n}\n\nexport interface Pr {\n id: string;\n title: string;\n createdAt: string;\n headRef: {\n id?: string;\n name?: string;\n target: BranchInfoResult;\n };\n mergeable: MergeableState;\n merged: boolean;\n number: number;\n body: string;\n isDraft: boolean;\n url: string;\n author: {\n login: string;\n avatarUrl?: string;\n };\n diffHeadSha?: string;\n targetBranch?: string;\n version?: string; // needed for bitbucket merge\n}\n\nexport interface GitProvider {\n type: GitProviderType;\n createBranch: (opt: { branch: string }) => Promise<BranchInfoResult>;\n commitOnBranch: (opt: {\n branch: string;\n message: string;\n fileChanges: FileChanges;\n }) => Promise<Record<string, unknown> | void>;\n getRepoLabels: () => Promise<RepoLabel[]>;\n getRepoInfo: () => Promise<RepoInfo>;\n getBranchInfo: ({ branch }: { branch: string }) => Promise<BranchInfoResult>;\n getPrs: () => Promise<Pr[]>;\n getPr: ({ prNumber }: { prNumber: number }) => Promise<Pr>;\n getTree?: (opt: { branch: string }) => Promise<{\n treeItems: {\n path: string;\n type: 'blob';\n /** SHA-1, use https://www.npmjs.com/package/git-hash-object */\n sha: string;\n url?: string;\n }[];\n }>;\n mergePr: ({ prNumber }: { prNumber: number }) => Promise<boolean>;\n createPr: ({\n siteId,\n branch,\n title,\n body,\n labelIds,\n }: {\n siteId: string;\n branch: string;\n title: string;\n body?: string;\n labelIds?: string[];\n }) => Promise<PrInfo>;\n deleteBranch: ({ id, branch }: { id: string; branch: string }) => Promise<{\n clientMutationId?: string;\n }>;\n getFileInfoOnBranchByPath: (opt: {\n filePath: string;\n branch: string;\n }) => Promise<{ exists: boolean; filePath: string }>;\n}\n"]}
1
+ {"version":3,"sources":["../src/git-providers.ts"],"names":["GitProviderType","MergeableState","RestActions","TextEncoding"],"mappings":"AAAO,IAAKA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,MAAA,CAAS,QAAA,CACTA,CAAAA,CAAA,OAAS,QAAA,CACTA,CAAAA,CAAA,UAAA,CAAa,YAAA,CACbA,CAAAA,CAAA,SAAA,CAAY,YACZA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CALEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CA+BAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,EAAA,WAAA,CAAc,aAAA,CACdA,CAAAA,CAAA,SAAA,CAAY,WAAA,CACZA,CAAAA,CAAA,QAAU,SAAA,CAHAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAMAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,MAAA,CAAS,SACTA,CAAAA,CAAA,IAAA,CAAO,MAAA,CACPA,CAAAA,CAAA,MAAA,CAAS,QAAA,CACTA,EAAA,KAAA,CAAQ,OAAA,CAJEA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA,CAAA,CAOAC,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAAA,CAAA,OAAS,QAAA,CACTA,CAAAA,CAAA,IAAA,CAAO,MAAA,CAFGA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAAA","file":"git-providers.mjs","sourcesContent":["export enum GitProviderType {\n GitHub = 'GitHub',\n GitLab = 'GitLab',\n GitLabRest = 'GitLabRest',\n Bitbucket = 'Bitbucket',\n Azure = 'Azure',\n}\n\nexport type FileAddition = {\n /** base64 */\n contents: string;\n path: string;\n\n /** Action to perform: create, delete, move, update, or chmod. */\n action?: RestActions;\n /** Content of the file. */\n content?: string;\n /** Full path to the file. */\n filePath?: string;\n /** Encoding of the file. Default is text. */\n encoding?: TextEncoding;\n /** Last known file commit ID. */\n lastCommitId?: string;\n /** Original full path to the file being moved. */\n previousPath?: string;\n};\n\nexport type FileDeletion = {\n path: string;\n};\n\nexport enum MergeableState {\n Conflicting = 'CONFLICTING',\n Mergeable = 'MERGEABLE',\n Unknown = 'UNKNOWN',\n}\n\nexport enum RestActions {\n Create = 'CREATE',\n Move = 'MOVE',\n Update = 'UPDATE',\n Chmod = 'CHMOD',\n}\n\nexport enum TextEncoding {\n Base64 = 'BASE64',\n Text = 'TEXT',\n}\n\nexport type FileChanges = {\n /** File to add or change. */\n additions?: FileAddition[];\n\n /** Files to delete. */\n deletions?: FileDeletion[];\n\n /** Last known file commit ID. */\n lastCommitId?: string;\n};\n\nexport type CommitAction = Record<string, unknown>;\n\nexport interface RepoLabel {\n name: string;\n /** ID optional because bitbucket does not provide id. We might be able to generate one if its required, eg. reponame-labelname */\n id?: string;\n}\n\nexport interface RepoInfo {\n id: string;\n url: string;\n name: string;\n ownerName?: string;\n defaultBranch?: any;\n}\n\n// 'BranchInfo' name is currently taken by GitLab generated queries. Thus 'BranchInfoResult'\nexport interface BranchInfoResult {\n sha?: string; // If branch info is not found, this can be undefined\n shortSha?: string;\n associatedPullRequests?: Pr[];\n additions?: number;\n commitUrl?: string;\n deletions?: number;\n id?: string; // In GitLab, this is the branch name. Modelled this way to make deleteBranch work.\n default?: boolean;\n}\n\nexport interface PrInfo {\n url: string;\n number: number;\n id: string;\n}\n\nexport interface Pr {\n id: string;\n title: string;\n createdAt: string;\n headRef: {\n id?: string;\n name?: string;\n target: BranchInfoResult;\n };\n mergeable: MergeableState;\n merged: boolean;\n number: number;\n body: string;\n isDraft: boolean;\n url: string;\n author: {\n login: string;\n avatarUrl?: string;\n };\n diffHeadSha?: string;\n targetBranch?: string;\n version?: string; // needed for bitbucket merge\n}\n\nexport interface GitProvider {\n type: GitProviderType;\n createBranch: (opt: { branch: string }) => Promise<BranchInfoResult>;\n commitOnBranch: (opt: {\n branch: string;\n message: string;\n fileChanges: FileChanges;\n }) => Promise<Record<string, unknown> | void>;\n getRepoLabels: () => Promise<RepoLabel[]>;\n getRepoInfo: () => Promise<RepoInfo>;\n getBranchInfo: ({ branch }: { branch: string }) => Promise<BranchInfoResult>;\n getPrs: () => Promise<Pr[]>;\n getPr: ({ prNumber }: { prNumber: number }) => Promise<Pr>;\n getTree?: (opt: { branch: string }) => Promise<{\n treeItems: {\n path: string;\n type: 'blob';\n /** SHA-1, use https://www.npmjs.com/package/git-hash-object */\n sha: string;\n url?: string;\n }[];\n }>;\n mergePr: ({ prNumber }: { prNumber: number }) => Promise<boolean>;\n createPr: ({\n siteId,\n branch,\n title,\n body,\n labelIds,\n }: {\n siteId: string;\n branch: string;\n title: string;\n body?: string;\n labelIds?: string[];\n }) => Promise<PrInfo>;\n deleteBranch: ({ id, branch }: { id: string; branch: string }) => Promise<{\n clientMutationId?: string;\n }>;\n /**\n * Force-updates the branch ref to point at the base branch's HEAD,\n * discarding the branch's existing commits. Used instead of\n * `deleteBranch` + `createBranch` when the branch has an open PR, since\n * deleting the branch would close the PR. Optional: only providers whose\n * API can force-move a ref implement this.\n */\n resetBranchToBase?: (opt: { branch: string }) => Promise<BranchInfoResult>;\n getFileInfoOnBranchByPath: (opt: {\n filePath: string;\n branch: string;\n }) => Promise<{ exists: boolean; filePath: string }>;\n}\n"]}