repository-provider 28.3.13 → 28.3.14
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 +5 -4
- package/package.json +2 -2
- package/src/repository-owner.mjs +9 -12
package/README.md
CHANGED
|
@@ -940,9 +940,10 @@ Abstract branch.
|
|
|
940
940
|
|
|
941
941
|
### Parameters
|
|
942
942
|
|
|
943
|
-
* `
|
|
944
|
-
* `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** (optional, default `
|
|
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
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "28.3.14",
|
|
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.
|
|
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/repository-owner.mjs
CHANGED
|
@@ -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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
113
|
+
for (const name of matcher(this.#repositories.keys(), repoPattern, {
|
|
117
114
|
caseSensitive: this.areRepositoriesCaseSensitive
|
|
118
115
|
})) {
|
|
119
|
-
const repository = this.
|
|
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.
|
|
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.
|
|
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.
|
|
169
|
+
this.#repositories.delete(this.normalizeRepositoryName(name, true));
|
|
173
170
|
}
|
|
174
171
|
|
|
175
172
|
initializeRepositories() {}
|