bitbucket-repository-provider 6.0.15 → 6.0.17

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/README.md CHANGED
@@ -195,13 +195,13 @@ Result will be filtered by source branch, destination branch and states
195
195
  #### Parameters
196
196
 
197
197
  * `repository` **Repository** 
198
- * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `{}`)
198
+ * `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
199
199
 
200
200
  * `filter.source` **Branch?** 
201
201
  * `filter.destination` **Branch?** 
202
202
  * `filter.states` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>?**&#x20;
203
203
 
204
- Returns **AsyncIterator\<PullRequest>**&#x20;
204
+ Returns **AsyncIterable\<PullRequest>**&#x20;
205
205
 
206
206
  ### open
207
207
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitbucket-repository-provider",
3
- "version": "6.0.15",
3
+ "version": "6.0.17",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -34,18 +34,18 @@
34
34
  "lint:tsc": "tsc --allowJs --checkJs --noEmit -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
35
35
  },
36
36
  "dependencies": {
37
- "content-entry": "^8.0.1",
37
+ "content-entry": "^9.0.0",
38
38
  "fetch-rate-limit-util": "^4.2.1",
39
39
  "matching-iterator": "^2.1.3",
40
40
  "one-time-execution-method": "^3.1.1",
41
- "repository-provider": "^35.2.10"
41
+ "repository-provider": "^35.2.14"
42
42
  },
43
43
  "devDependencies": {
44
- "@types/node": "^20.11.19",
44
+ "@types/node": "^20.11.20",
45
45
  "ava": "^6.1.1",
46
46
  "c8": "^9.1.0",
47
47
  "documentation": "^14.0.3",
48
- "repository-provider-test-support": "^3.1.2",
48
+ "repository-provider-test-support": "^3.1.3",
49
49
  "semantic-release": "^23.0.2",
50
50
  "typescript": "^5.3.3"
51
51
  },
@@ -32,20 +32,20 @@ export class BitbucketPullRequest extends PullRequest {
32
32
  * List all pull request for a given repo.
33
33
  * Result will be filtered by source branch, destination branch and states
34
34
  * @param {Repository} repository
35
- * @param {Object} filter
35
+ * @param {Object} [filter]
36
36
  * @param {Branch} [filter.source]
37
37
  * @param {Branch} [filter.destination]
38
38
  * @param {Set<string>} [filter.states]
39
- * @return {AsyncIterator<PullRequest>}
39
+ * @return {AsyncIterable<PullRequest>}
40
40
  */
41
- static async *list(repository, filter = {}) {
41
+ static async *list(repository, filter) {
42
42
  const getBranch = async u =>
43
43
  repository.provider.branch(
44
44
  [u.repository.full_name, u.branch.name].join("#")
45
45
  );
46
46
 
47
- const query = filter.states?.size
48
- ? "?" + [...filter.states].map(state => `state=${state}`).join("&")
47
+ const query = filter?.states?.size
48
+ ? "?" + [...filter?.states].map(state => `state=${state}`).join("&")
49
49
  : "";
50
50
  let url = `${repository.api}/pullrequests${query}`;
51
51
 
@@ -54,16 +54,17 @@ export class BitbucketPullRequest extends PullRequest {
54
54
  url = json.next;
55
55
 
56
56
  if (json.values) {
57
+ console.log("N",json.values.length);
57
58
  for (const p of json.values) {
58
59
  const source = await getBranch(p.source);
59
60
 
60
- if (filter.source && !filter.source.equals(source)) {
61
+ if (filter?.source && !filter.source.equals(source)) {
61
62
  continue;
62
63
  }
63
64
 
64
65
  const destination = await getBranch(p.destination);
65
66
 
66
- if (filter.destination && !filter.destination.equals(destination)) {
67
+ if (filter?.destination && !filter.destination.equals(destination)) {
67
68
  continue;
68
69
  }
69
70
 
@@ -7,6 +7,7 @@ import {
7
7
  language_attribute,
8
8
  default_attribute
9
9
  } from "repository-provider";
10
+ import { BitbucketBranch } from "./bitbucket-branch.mjs";
10
11
 
11
12
  /**
12
13
  * a repository hosted on bitbucket
@@ -64,7 +65,7 @@ export class BitbucketRepository extends Repository {
64
65
  }
65
66
 
66
67
  /**
67
- * @link https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-put
68
+ * @see https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-put
68
69
  */
69
70
  async update() {
70
71
  return this.provider.fetch(this.api, {
@@ -79,7 +80,7 @@ export class BitbucketRepository extends Repository {
79
80
  }
80
81
 
81
82
  /**
82
- * @link https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-hooks-get
83
+ * @see https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-hooks-get
83
84
  */
84
85
  async initializeHooks() {
85
86
  let url = `${this.api}/hooks`;
@@ -116,7 +117,7 @@ export class BitbucketRepository extends Repository {
116
117
  * @param {string} name of the new branch to create
117
118
  * @param {BitbucketBranch} from
118
119
  * @param {Object} options
119
- * @param {string} options.message
120
+ * @param {string} [options.message]
120
121
  */
121
122
  async createBranch(name, from = this.defaultBranch, options) {
122
123
  const branch = await super.branch(name);
@@ -34,21 +34,6 @@ export class BitbucketPullRequest extends PullRequest {
34
34
  name: import("pacc").AttributeDefinition;
35
35
  description: import("pacc").AttributeDefinition;
36
36
  };
37
- /**
38
- * List all pull request for a given repo.
39
- * Result will be filtered by source branch, destination branch and states
40
- * @param {Repository} repository
41
- * @param {Object} filter
42
- * @param {Branch} [filter.source]
43
- * @param {Branch} [filter.destination]
44
- * @param {Set<string>} [filter.states]
45
- * @return {AsyncIterator<PullRequest>}
46
- */
47
- static list(repository: Repository, filter?: {
48
- source?: Branch;
49
- destination?: Branch;
50
- states?: Set<string>;
51
- }): AsyncIterator<PullRequest>;
52
37
  /**
53
38
  * {@link https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pullrequests#post}
54
39
  */
@@ -59,5 +44,3 @@ export class BitbucketPullRequest extends PullRequest {
59
44
  _merge(merge_strategy?: string): Promise<any>;
60
45
  }
61
46
  import { PullRequest } from "repository-provider";
62
- import { Repository } from "repository-provider";
63
- import { Branch } from "repository-provider";
@@ -57,11 +57,11 @@ export class BitbucketRepository extends Repository {
57
57
  static get attributMapping(): any;
58
58
  get user(): any;
59
59
  /**
60
- * @link https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-put
60
+ * @see https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-put
61
61
  */
62
62
  update(): Promise<any>;
63
63
  /**
64
- * @link https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-hooks-get
64
+ * @see https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-hooks-get
65
65
  */
66
66
  initializeHooks(): Promise<void>;
67
67
  /**
@@ -74,10 +74,10 @@ export class BitbucketRepository extends Repository {
74
74
  * @param {string} name of the new branch to create
75
75
  * @param {BitbucketBranch} from
76
76
  * @param {Object} options
77
- * @param {string} options.message
77
+ * @param {string} [options.message]
78
78
  */
79
79
  createBranch(name: string, from: BitbucketBranch, options: {
80
- message: string;
80
+ message?: string;
81
81
  }): Promise<import("repository-provider").Branch>;
82
82
  /**
83
83
  * {@link https://docs.atlassian.com/bitbucket-server/rest/5.8.0/bitbucket-branch-rest.html#idm45555984542992}
@@ -86,3 +86,4 @@ export class BitbucketRepository extends Repository {
86
86
  deleteBranch(name: any): Promise<any>;
87
87
  }
88
88
  import { Repository } from "repository-provider";
89
+ import { BitbucketBranch } from "./bitbucket-branch.mjs";