bitbucket-repository-provider 3.10.21 → 4.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitbucket-repository-provider",
3
- "version": "3.10.21",
3
+ "version": "4.0.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -30,21 +30,21 @@
30
30
  "lint:docs": "documentation lint ./src/**/*.mjs"
31
31
  },
32
32
  "dependencies": {
33
- "content-entry": "^4.1.7",
34
- "matching-iterator": "^2.0.3",
35
- "node-fetch": "^3.2.1",
36
- "one-time-execution-method": "^2.0.11",
37
- "repository-provider": "^27.0.3"
33
+ "content-entry": "^4.1.12",
34
+ "matching-iterator": "^2.0.4",
35
+ "node-fetch": "^3.2.3",
36
+ "one-time-execution-method": "^2.0.13",
37
+ "repository-provider": "^28.0.0"
38
38
  },
39
39
  "devDependencies": {
40
- "ava": "^4.0.1",
40
+ "ava": "^4.2.0",
41
41
  "c8": "^7.11.0",
42
42
  "documentation": "^13.2.5",
43
- "repository-provider-test-support": "^1.12.9",
43
+ "repository-provider-test-support": "^2.0.1",
44
44
  "semantic-release": "^19.0.2"
45
45
  },
46
46
  "engines": {
47
- "node": ">=14.19.0"
47
+ "node": ">=16.14.2"
48
48
  },
49
49
  "repository": {
50
50
  "type": "git",
@@ -39,7 +39,6 @@ const domain = "bitbucket.org";
39
39
  * @param {string} config.authentication.password
40
40
  */
41
41
  export class BitbucketProvider extends MultiGroupProvider {
42
-
43
42
  /**
44
43
  * We are called bitbucket.
45
44
  * @return {string} bitbucket
@@ -76,15 +75,17 @@ export class BitbucketProvider extends MultiGroupProvider {
76
75
  "authentication.token": {
77
76
  type: "string",
78
77
  description: "API token",
79
- // BB_TOKEN_BASIC_AUTH is this the same ?
80
- env: ["{{instanceIdentifier}}TOKEN", "BB_TOKEN"],
78
+ env: ["{{instanceIdentifier}}TOKEN"],
81
79
  additionalAttributes: { "authentication.type": "token" },
82
80
  private: true
83
81
  },
84
82
  "authentication.password": {
85
83
  type: "string",
86
84
  description: "Password for plain authentification",
87
- env: "{{instanceIdentifier}}PASSWORD",
85
+ env: [
86
+ "{{instanceIdentifier}}APP_PASSWORD",
87
+ "{{instanceIdentifier}}PASSWORD"
88
+ ],
88
89
  additionalAttributes: { "authentication.type": "basic" },
89
90
  private: true
90
91
  },
@@ -148,7 +149,6 @@ export class BitbucketProvider extends MultiGroupProvider {
148
149
  ]);
149
150
  }
150
151
 
151
-
152
152
  /**
153
153
  * {@link https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories}
154
154
  */
@@ -159,6 +159,7 @@ export class BitbucketProvider extends MultiGroupProvider {
159
159
  const response = await this.fetch(next);
160
160
 
161
161
  if (!response.ok) {
162
+ console.log(response);
162
163
  break;
163
164
  }
164
165
 
@@ -173,12 +174,22 @@ export class BitbucketProvider extends MultiGroupProvider {
173
174
  }
174
175
 
175
176
  fetch(url, options = {}) {
176
- const headers = {
177
- authorization:
177
+ let authorization;
178
+
179
+ if (this.authentication.username) {
180
+ authorization =
178
181
  "Basic " +
179
182
  Buffer.from(
180
183
  this.authentication.username + ":" + this.authentication.password
181
- ).toString("base64"),
184
+ ).toString("base64");
185
+ } else {
186
+ if (this.authentication.token) {
187
+ authorization = "Bearer " + this.authentication.token;
188
+ }
189
+ }
190
+
191
+ const headers = {
192
+ authorization,
182
193
  ...options.headers
183
194
  };
184
195