bitbucket-data-center-client 1.4.28 → 1.4.29
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/api/branches.d.ts
CHANGED
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
import { BaseApi } from './base.js';
|
|
2
|
-
import type { BranchesResponse, ListBranchesParams } from '../types/branch.js';
|
|
2
|
+
import type { BranchesResponse, DeleteAfterMergeSetting, DeleteBranchParams, GetDeleteAfterMergeSettingParams, ListBranchesParams } from '../types/branch.js';
|
|
3
|
+
import type { BitbucketClientConfig } from '../types/common.js';
|
|
3
4
|
export declare class BranchesApi extends BaseApi {
|
|
5
|
+
/**
|
|
6
|
+
* Secondary axios client for the branch-utils plugin endpoints. These live
|
|
7
|
+
* under /rest/branch-utils/latest, separate from the main /rest/api/latest
|
|
8
|
+
* surface used by `this.client`.
|
|
9
|
+
*/
|
|
10
|
+
private readonly branchUtilsClient;
|
|
11
|
+
constructor(config: BitbucketClientConfig);
|
|
4
12
|
/**
|
|
5
13
|
* List branches in a repository with optional filters.
|
|
6
14
|
*/
|
|
7
15
|
list(params: ListBranchesParams): Promise<BranchesResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* Delete a branch via the branch-utils plugin. Returns nothing on success
|
|
18
|
+
* (204). Fails with 400 if the ref is the default branch, has open pull
|
|
19
|
+
* requests pointing at it, or otherwise cannot be removed.
|
|
20
|
+
*/
|
|
21
|
+
delete(params: DeleteBranchParams): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Read the effective "delete source branch on merge" setting for a repo.
|
|
24
|
+
* Inherits from the project when no repo-level override exists. Used by
|
|
25
|
+
* callers (e.g. CLIs) that want to replicate the Bitbucket UI behavior of
|
|
26
|
+
* auto-deleting the source branch after a successful merge, since the merge
|
|
27
|
+
* REST endpoint itself does not honor this setting server-side.
|
|
28
|
+
*/
|
|
29
|
+
getDeleteAfterMergeSetting(params: GetDeleteAfterMergeSettingParams): Promise<DeleteAfterMergeSetting>;
|
|
8
30
|
}
|
|
9
31
|
//# sourceMappingURL=branches.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branches.d.ts","sourceRoot":"","sources":["../../src/api/branches.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"branches.d.ts","sourceRoot":"","sources":["../../src/api/branches.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,gCAAgC,EAChC,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,qBAAa,WAAY,SAAQ,OAAO;IACtC;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAgB;gBAE/B,MAAM,EAAE,qBAAqB;IAchD;;OAEG;IACU,IAAI,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAmBxE;;;;OAIG;IACU,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAW9D;;;;;;OAMG;IACU,0BAA0B,CAAC,MAAM,EAAE,gCAAgC,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAOpH"}
|
package/dist/api/branches.js
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
// packages/clients/bitbucket-data-center-client/src/api/branches.ts
|
|
2
|
+
import axios from 'axios';
|
|
2
3
|
import { BaseApi } from './base.js';
|
|
3
4
|
export class BranchesApi extends BaseApi {
|
|
5
|
+
/**
|
|
6
|
+
* Secondary axios client for the branch-utils plugin endpoints. These live
|
|
7
|
+
* under /rest/branch-utils/latest, separate from the main /rest/api/latest
|
|
8
|
+
* surface used by `this.client`.
|
|
9
|
+
*/
|
|
10
|
+
branchUtilsClient;
|
|
11
|
+
constructor(config) {
|
|
12
|
+
super(config);
|
|
13
|
+
const { token, baseUrl, axiosConfig = {} } = config;
|
|
14
|
+
this.branchUtilsClient = axios.create({
|
|
15
|
+
...axiosConfig,
|
|
16
|
+
baseURL: `${baseUrl}/rest/branch-utils/latest`,
|
|
17
|
+
headers: {
|
|
18
|
+
...axiosConfig.headers,
|
|
19
|
+
...(token !== undefined && { Authorization: `Bearer ${token}` }),
|
|
20
|
+
'Content-Type': 'application/json',
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
}
|
|
4
24
|
/**
|
|
5
25
|
* List branches in a repository with optional filters.
|
|
6
26
|
*/
|
|
@@ -24,5 +44,32 @@ export class BranchesApi extends BaseApi {
|
|
|
24
44
|
const response = await this.client.get(`/projects/${projectKey}/repos/${repositorySlug}/branches`, { params: queryParams });
|
|
25
45
|
return response.data;
|
|
26
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Delete a branch via the branch-utils plugin. Returns nothing on success
|
|
49
|
+
* (204). Fails with 400 if the ref is the default branch, has open pull
|
|
50
|
+
* requests pointing at it, or otherwise cannot be removed.
|
|
51
|
+
*/
|
|
52
|
+
async delete(params) {
|
|
53
|
+
const { projectKey, repositorySlug, name, dryRun, endPoint } = params;
|
|
54
|
+
await this.branchUtilsClient.delete(`/projects/${projectKey}/repos/${repositorySlug}/branches`, {
|
|
55
|
+
data: {
|
|
56
|
+
name,
|
|
57
|
+
...(dryRun !== undefined && { dryRun }),
|
|
58
|
+
...(endPoint !== undefined && { endPoint }),
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Read the effective "delete source branch on merge" setting for a repo.
|
|
64
|
+
* Inherits from the project when no repo-level override exists. Used by
|
|
65
|
+
* callers (e.g. CLIs) that want to replicate the Bitbucket UI behavior of
|
|
66
|
+
* auto-deleting the source branch after a successful merge, since the merge
|
|
67
|
+
* REST endpoint itself does not honor this setting server-side.
|
|
68
|
+
*/
|
|
69
|
+
async getDeleteAfterMergeSetting(params) {
|
|
70
|
+
const { projectKey, repositorySlug } = params;
|
|
71
|
+
const response = await this.branchUtilsClient.get(`/projects/${projectKey}/repos/${repositorySlug}/delete-after-merge`);
|
|
72
|
+
return response.data;
|
|
73
|
+
}
|
|
27
74
|
}
|
|
28
75
|
//# sourceMappingURL=branches.js.map
|
package/dist/api/branches.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branches.js","sourceRoot":"","sources":["../../src/api/branches.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"branches.js","sourceRoot":"","sources":["../../src/api/branches.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,OAAO,KAA6B,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,MAAM,OAAO,WAAY,SAAQ,OAAO;IACtC;;;;OAIG;IACc,iBAAiB,CAAgB;IAElD,YAAmB,MAA6B;QAC9C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;QACpD,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAC;YACpC,GAAG,WAAW;YACd,OAAO,EAAE,GAAG,OAAO,2BAA2B;YAC9C,OAAO,EAAE;gBACP,GAAG,WAAW,CAAC,OAAO;gBACtB,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE,CAAC;gBAChE,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAAC,MAA0B;QAC1C,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;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G,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;gBACvC,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,CAAC;aAC5C;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,0BAA0B,CAAC,MAAwC;QAC9E,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;QAC9C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAC/C,aAAa,UAAU,UAAU,cAAc,qBAAqB,CACrE,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF"}
|
package/dist/types/branch.d.ts
CHANGED
|
@@ -65,4 +65,33 @@ export interface GetDefaultBranchParams {
|
|
|
65
65
|
repositorySlug: string;
|
|
66
66
|
}
|
|
67
67
|
export type { RestMinimalCommit };
|
|
68
|
+
/**
|
|
69
|
+
* Parameters for deleteBranch on BranchesApi. Hits the branch-utils plugin
|
|
70
|
+
* endpoint, which lives outside the main /rest/api/latest namespace.
|
|
71
|
+
*/
|
|
72
|
+
export interface DeleteBranchParams {
|
|
73
|
+
projectKey: string;
|
|
74
|
+
repositorySlug: string;
|
|
75
|
+
/** Ref name to delete, e.g. "refs/heads/feature-x" or "feature-x" — Bitbucket accepts both. */
|
|
76
|
+
name: string;
|
|
77
|
+
/** Don't actually delete; validate only. */
|
|
78
|
+
dryRun?: boolean;
|
|
79
|
+
/** Expected current commit ID at the ref tip (safety guard). */
|
|
80
|
+
endPoint?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Parameters for getDeleteAfterMergeSetting on BranchesApi.
|
|
84
|
+
*/
|
|
85
|
+
export interface GetDeleteAfterMergeSettingParams {
|
|
86
|
+
projectKey: string;
|
|
87
|
+
repositorySlug: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Response from the branch-utils delete-after-merge endpoint. The repo-level
|
|
91
|
+
* endpoint resolves the effective setting (repo override or inherited from
|
|
92
|
+
* project).
|
|
93
|
+
*/
|
|
94
|
+
export interface DeleteAfterMergeSetting {
|
|
95
|
+
enabled: boolean;
|
|
96
|
+
}
|
|
68
97
|
//# sourceMappingURL=branch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../src/types/branch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,IAAI,EAAE,QAAQ,CAAC;IACf,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,cAAc,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,0BAA0B;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB;IACjB,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C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