@knapsack/types 4.110.2 → 4.110.4
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.
- package/dist/git-providers.d.ts +20 -0
- package/dist/git-providers.d.ts.map +1 -1
- package/dist/git-providers.js +1 -1
- package/dist/git-providers.js.map +1 -1
- package/dist/git-providers.mjs +1 -1
- package/dist/git-providers.mjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/git-providers.d.ts
CHANGED
|
@@ -99,6 +99,24 @@ export interface Pr {
|
|
|
99
99
|
targetBranch?: string;
|
|
100
100
|
version?: string;
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* How far a commit has got, reported after each file by a provider that
|
|
104
|
+
* commits one file per request.
|
|
105
|
+
*/
|
|
106
|
+
export interface CommitProgress {
|
|
107
|
+
/** Files handled so far, written or skipped. */
|
|
108
|
+
readonly completed: number;
|
|
109
|
+
readonly total: number;
|
|
110
|
+
/** Files the provider answered with a new commit. */
|
|
111
|
+
readonly written: number;
|
|
112
|
+
/**
|
|
113
|
+
* Files the provider answered without a new commit: it already held the
|
|
114
|
+
* same content, or it refused the write without raising an error.
|
|
115
|
+
*/
|
|
116
|
+
readonly skipped: number;
|
|
117
|
+
/** The file just handled. */
|
|
118
|
+
readonly path: string;
|
|
119
|
+
}
|
|
102
120
|
export interface GitProvider {
|
|
103
121
|
type: GitProviderType;
|
|
104
122
|
createBranch: (opt: {
|
|
@@ -108,6 +126,8 @@ export interface GitProvider {
|
|
|
108
126
|
branch: string;
|
|
109
127
|
message: string;
|
|
110
128
|
fileChanges: FileChanges;
|
|
129
|
+
/** Called after each file by a provider that commits one file per request. */
|
|
130
|
+
onProgress?: (progress: CommitProgress) => void;
|
|
111
131
|
}) => Promise<Record<string, unknown> | void>;
|
|
112
132
|
getRepoLabels: () => Promise<RepoLabel[]>;
|
|
113
133
|
getRepoInfo: () => Promise<RepoInfo>;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;IACtB,YAAY,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC;QACxE,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC,CAAC;IACH;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC3E,yBAAyB,EAAE,CAAC,GAAG,EAAE;QAC/B,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KAChB,KAAK,OAAO,CAAC;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtD"}
|
package/dist/git-providers.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var i=(e=>(e.GitHub="GitHub",e.GitLab="GitLab",e.GitLabRest="GitLabRest",e.Bitbucket="Bitbucket",e.Azure="Azure",e))(i||{}),s=(
|
|
1
|
+
'use strict';var i=(e=>(e.GitHub="GitHub",e.GitLab="GitLab",e.GitLabRest="GitLabRest",e.Bitbucket="Bitbucket",e.Azure="Azure",e))(i||{}),s=(t=>(t.Conflicting="CONFLICTING",t.Mergeable="MERGEABLE",t.Unknown="UNKNOWN",t))(s||{}),o=(r=>(r.Create="CREATE",r.Move="MOVE",r.Update="UPDATE",r.Chmod="CHMOD",r))(o||{}),a=(n=>(n.Base64="BASE64",n.Text="TEXT",n))(a||{});exports.GitProviderType=i;exports.MergeableState=s;exports.RestActions=o;exports.TextEncoding=a;//# sourceMappingURL=git-providers.js.map
|
|
2
2
|
//# sourceMappingURL=git-providers.js.map
|
|
@@ -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.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
|
+
{"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\n/**\n * How far a commit has got, reported after each file by a provider that\n * commits one file per request.\n */\nexport interface CommitProgress {\n /** Files handled so far, written or skipped. */\n readonly completed: number;\n readonly total: number;\n /** Files the provider answered with a new commit. */\n readonly written: number;\n /**\n * Files the provider answered without a new commit: it already held the\n * same content, or it refused the write without raising an error.\n */\n readonly skipped: number;\n /** The file just handled. */\n readonly path: string;\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 /** Called after each file by a provider that commits one file per request. */\n onProgress?: (progress: CommitProgress) => void;\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"]}
|
package/dist/git-providers.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var i=(e=>(e.GitHub="GitHub",e.GitLab="GitLab",e.GitLabRest="GitLabRest",e.Bitbucket="Bitbucket",e.Azure="Azure",e))(i||{}),s=(
|
|
1
|
+
var i=(e=>(e.GitHub="GitHub",e.GitLab="GitLab",e.GitLabRest="GitLabRest",e.Bitbucket="Bitbucket",e.Azure="Azure",e))(i||{}),s=(t=>(t.Conflicting="CONFLICTING",t.Mergeable="MERGEABLE",t.Unknown="UNKNOWN",t))(s||{}),o=(r=>(r.Create="CREATE",r.Move="MOVE",r.Update="UPDATE",r.Chmod="CHMOD",r))(o||{}),a=(n=>(n.Base64="BASE64",n.Text="TEXT",n))(a||{});export{i as GitProviderType,s as MergeableState,o as RestActions,a as TextEncoding};//# sourceMappingURL=git-providers.mjs.map
|
|
2
2
|
//# sourceMappingURL=git-providers.mjs.map
|
|
@@ -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 /**\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
|
+
{"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\n/**\n * How far a commit has got, reported after each file by a provider that\n * commits one file per request.\n */\nexport interface CommitProgress {\n /** Files handled so far, written or skipped. */\n readonly completed: number;\n readonly total: number;\n /** Files the provider answered with a new commit. */\n readonly written: number;\n /**\n * Files the provider answered without a new commit: it already held the\n * same content, or it refused the write without raising an error.\n */\n readonly skipped: number;\n /** The file just handled. */\n readonly path: string;\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 /** Called after each file by a provider that commits one file per request. */\n onProgress?: (progress: CommitProgress) => void;\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"]}
|