repository-provider 28.3.12 → 28.3.15

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
@@ -940,9 +940,10 @@ Abstract branch.
940
940
 
941
941
  ### Parameters
942
942
 
943
- * `repository` **[Repository](#repository)**
944
- * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (optional, default `repository.defaultBranchName`)
943
+ * `owner`
944
+ * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (optional, default `owner.defaultBranchName`)
945
945
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
946
+ * `repository` **[Repository](#repository)**
946
947
 
947
948
  ### Properties
948
949
 
@@ -1182,7 +1183,7 @@ Check for equality.
1182
1183
 
1183
1184
  * `other` **[NamedObject](#namedobject)**
1184
1185
 
1185
- Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if names are equal and have the same owner
1186
+ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if names are equal and have the same provider
1186
1187
 
1187
1188
  ### fullName
1188
1189
 
@@ -1190,7 +1191,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
1190
1191
 
1191
1192
  ### toJSON
1192
1193
 
1193
- Provide name and all defined attributes.
1194
+ Provided name and all defined attributes.
1194
1195
 
1195
1196
  ## OwnedObject
1196
1197
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "28.3.12",
3
+ "version": "28.3.15",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,7 +36,7 @@
36
36
  "ava": "^4.2.0",
37
37
  "c8": "^7.11.2",
38
38
  "documentation": "^13.2.5",
39
- "repository-provider-test-support": "^2.1.9",
39
+ "repository-provider-test-support": "^2.1.10",
40
40
  "semantic-release": "^19.0.2",
41
41
  "typescript": "^4.6.3"
42
42
  },
package/src/branch.mjs CHANGED
@@ -21,8 +21,8 @@ export class Branch extends Ref {
21
21
  return "_addBranch";
22
22
  }
23
23
 
24
- constructor(repository, name = repository.defaultBranchName, options) {
25
- super(repository, name, options);
24
+ constructor(owner, name = owner.defaultBranchName, options) {
25
+ super(owner, name, options);
26
26
  }
27
27
 
28
28
  /**
@@ -31,8 +31,8 @@ export class Branch extends Ref {
31
31
  */
32
32
  get url() {
33
33
  return this.isDefault
34
- ? this.repository.url
35
- : `${this.repository.url}#${this.name}`;
34
+ ? this.owner.url
35
+ : `${this.owner.url}#${this.name}`;
36
36
  }
37
37
 
38
38
  /**
@@ -60,7 +60,7 @@ export class Branch extends Ref {
60
60
  * @return {boolean} true if name matches the repository default branch
61
61
  */
62
62
  get isDefault() {
63
- return this.name === this.repository.defaultBranchName;
63
+ return this.name === this.owner.defaultBranchName;
64
64
  }
65
65
 
66
66
  /**
@@ -69,7 +69,7 @@ export class Branch extends Ref {
69
69
  * @return {Promise<any>}
70
70
  */
71
71
  async delete() {
72
- return this.repository.deleteBranch(this.name);
72
+ return this.owner.deleteBranch(this.name);
73
73
  }
74
74
 
75
75
  /**
@@ -191,6 +191,6 @@ export class Branch extends Ref {
191
191
  * @return {Promise<Branch>} newly created branch (or already present old one with the same name)
192
192
  */
193
193
  async createBranch(name, options) {
194
- return this.repository.createBranch(name, this, options);
194
+ return this.owner.createBranch(name, this, options);
195
195
  }
196
196
  }
@@ -10,11 +10,8 @@ import { RepositoryGroup } from "./repository-group.mjs";
10
10
  *
11
11
  */
12
12
  export class MultiGroupProvider extends BaseProvider {
13
- constructor(options) {
14
- super(options, {
15
- _repositoryGroups: { value: new Map() }
16
- });
17
- }
13
+
14
+ #repositoryGroups = new Map();
18
15
 
19
16
  /**
20
17
  * Lookup a repository in the provider and all of its repository groups.
@@ -68,7 +65,7 @@ export class MultiGroupProvider extends BaseProvider {
68
65
  if (this.supportsBase(base)) {
69
66
  name = stripBaseNames(name, this.provider.repositoryBases);
70
67
  await this.initializeRepositories();
71
- return this._repositoryGroups.get(this.normalizeGroupName(name, true));
68
+ return this.#repositoryGroups.get(this.normalizeGroupName(name, true));
72
69
  }
73
70
  }
74
71
 
@@ -81,7 +78,7 @@ export class MultiGroupProvider extends BaseProvider {
81
78
  await this.initializeRepositories();
82
79
 
83
80
  yield* matcher(
84
- this._repositoryGroups.values(),
81
+ this.#repositoryGroups.values(),
85
82
  stripBaseNames(patterns, this.provider.repositoryBases),
86
83
  {
87
84
  caseSensitive: this.areGroupNamesCaseSensitive,
@@ -110,10 +107,10 @@ export class MultiGroupProvider extends BaseProvider {
110
107
  addRepositoryGroup(name, options) {
111
108
  const normalizedName = this.normalizeGroupName(name, true);
112
109
 
113
- let repositoryGroup = this._repositoryGroups.get(normalizedName);
110
+ let repositoryGroup = this.#repositoryGroups.get(normalizedName);
114
111
  if (repositoryGroup === undefined) {
115
112
  repositoryGroup = new this.repositoryGroupClass(this, name, options);
116
- this._repositoryGroups.set(normalizedName, repositoryGroup);
113
+ this.#repositoryGroups.set(normalizedName, repositoryGroup);
117
114
  }
118
115
  return repositoryGroup;
119
116
  }
@@ -20,7 +20,7 @@ export class NamedObject extends BaseObject {
20
20
  /**
21
21
  * Check for equality.
22
22
  * @param {NamedObject} other
23
- * @return {boolean} true if names are equal and have the same owner
23
+ * @return {boolean} true if names are equal and have the same provider
24
24
  */
25
25
  equals(other) {
26
26
  return (
@@ -37,7 +37,7 @@ export class NamedObject extends BaseObject {
37
37
  }
38
38
 
39
39
  /**
40
- * Provide name and all defined attributes.
40
+ * Provided name and all defined attributes.
41
41
  */
42
42
  toJSON() {
43
43
  return optionJSON(this, {
@@ -9,11 +9,8 @@ import { asArray, stripBaseName, stripBaseNames } from "./util.mjs";
9
9
  */
10
10
  export function RepositoryOwner(base) {
11
11
  return class RepositoryOwner extends base {
12
- constructor(...args) {
13
- super(...args);
14
12
 
15
- Object.defineProperties(this, { _repositories: { value: new Map() } });
16
- }
13
+ #repositories = new Map();
17
14
 
18
15
  /**
19
16
  * Normalizes a repository name.
@@ -51,7 +48,7 @@ export function RepositoryOwner(base) {
51
48
 
52
49
  await this.initializeRepositories();
53
50
 
54
- return this._repositories.get(this.normalizeRepositoryName(name, true));
51
+ return this.#repositories.get(this.normalizeRepositoryName(name, true));
55
52
  }
56
53
 
57
54
  /**
@@ -75,7 +72,7 @@ export function RepositoryOwner(base) {
75
72
 
76
73
  await this.initializeRepositories();
77
74
  yield* matcher(
78
- this._repositories.values(),
75
+ this.#repositories.values(),
79
76
  stripBaseNames(patterns, this.provider.repositoryBases),
80
77
  {
81
78
  caseSensitive: this.areRepositoryNamesCaseSensitive,
@@ -91,7 +88,7 @@ export function RepositoryOwner(base) {
91
88
  name = stripBaseName(name, this.provider.repositoryBases);
92
89
 
93
90
  const [repoName, typeName] = split ? split(name) : name.split("/");
94
- const repository = this._repositories.get(repoName);
91
+ const repository = this.#repositories.get(repoName);
95
92
 
96
93
  if (repository) {
97
94
  if (typeName === undefined && defaultItem) {
@@ -113,10 +110,10 @@ export function RepositoryOwner(base) {
113
110
  ? split(pattern)
114
111
  : pattern.split("/");
115
112
 
116
- for (const name of matcher(this._repositories.keys(), repoPattern, {
113
+ for (const name of matcher(this.#repositories.keys(), repoPattern, {
117
114
  caseSensitive: this.areRepositoriesCaseSensitive
118
115
  })) {
119
- const repository = this._repositories.get(name);
116
+ const repository = this.#repositories.get(name);
120
117
 
121
118
  if (typePattern === undefined && defaultItem) {
122
119
  const item = await defaultItem(repository);
@@ -150,7 +147,7 @@ export function RepositoryOwner(base) {
150
147
  */
151
148
  addRepository(name, options) {
152
149
  const normalizedName = this.normalizeRepositoryName(name, true);
153
- let repository = this._repositories.get(normalizedName);
150
+ let repository = this.#repositories.get(normalizedName);
154
151
  if (repository === undefined) {
155
152
  repository = new this.repositoryClass(this, name, options);
156
153
  }
@@ -160,7 +157,7 @@ export function RepositoryOwner(base) {
160
157
  _addRepository(repository)
161
158
  {
162
159
  const normalizedName = this.normalizeRepositoryName(repository.name, true);
163
- this._repositories.set(normalizedName, repository);
160
+ this.#repositories.set(normalizedName, repository);
164
161
  }
165
162
 
166
163
  /**
@@ -169,7 +166,7 @@ export function RepositoryOwner(base) {
169
166
  * @return {Promise<any>}
170
167
  */
171
168
  async deleteRepository(name) {
172
- this._repositories.delete(this.normalizeRepositoryName(name, true));
169
+ this.#repositories.delete(this.normalizeRepositoryName(name, true));
173
170
  }
174
171
 
175
172
  initializeRepositories() {}