repository-provider 32.3.18 → 32.3.20
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 +0 -9
- package/package.json +2 -2
- package/src/attribute.mjs +31 -32
- package/src/base-object.mjs +1 -0
- package/src/branch.mjs +4 -0
- package/src/hook.mjs +4 -0
- package/src/multi-group-provider.mjs +2 -2
- package/src/named-object.mjs +5 -3
- package/src/owned-object.mjs +13 -5
- package/src/pull-request.mjs +6 -9
- package/src/ref.mjs +1 -1
- package/src/repository-group.mjs +4 -0
- package/src/repository.mjs +7 -2
- package/src/tag.mjs +4 -0
package/README.md
CHANGED
|
@@ -265,7 +265,6 @@ console.log(await readme.getString());
|
|
|
265
265
|
* [Properties](#properties-9)
|
|
266
266
|
* [attributeMapping](#attributemapping-1)
|
|
267
267
|
* [type](#type-1)
|
|
268
|
-
* [avatarURL](#avatarurl)
|
|
269
268
|
* [RepositoryOwner](#repositoryowner)
|
|
270
269
|
* [Parameters](#parameters-57)
|
|
271
270
|
* [Repository](#repository-3)
|
|
@@ -1565,14 +1564,6 @@ Map attributes between external and internal representation.
|
|
|
1565
1564
|
|
|
1566
1565
|
Type of the repository group either User or Organization.
|
|
1567
1566
|
|
|
1568
|
-
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
1569
|
-
|
|
1570
|
-
## avatarURL
|
|
1571
|
-
|
|
1572
|
-
Avatar.
|
|
1573
|
-
|
|
1574
|
-
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
1575
|
-
|
|
1576
1567
|
## RepositoryOwner
|
|
1577
1568
|
|
|
1578
1569
|
Mixin to define a class able to handle a collection of repositories.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repository-provider",
|
|
3
|
-
"version": "32.3.
|
|
3
|
+
"version": "32.3.20",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"browser-ava": "^1.3.13",
|
|
39
39
|
"c8": "^7.12.0",
|
|
40
40
|
"documentation": "^14.0.1",
|
|
41
|
-
"repository-provider-test-support": "^2.2.
|
|
41
|
+
"repository-provider-test-support": "^2.2.27",
|
|
42
42
|
"semantic-release": "^19.0.5",
|
|
43
43
|
"typescript": "^4.9.4"
|
|
44
44
|
},
|
package/src/attribute.mjs
CHANGED
|
@@ -135,6 +135,37 @@ export function defaultValues(attributes, object) {
|
|
|
135
135
|
);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Split property path into tokens
|
|
140
|
+
* @param {string} string
|
|
141
|
+
* @return {Iterator<string>}
|
|
142
|
+
*/
|
|
143
|
+
function* tokens(string) {
|
|
144
|
+
let identifier = "";
|
|
145
|
+
|
|
146
|
+
for (const c of string) {
|
|
147
|
+
switch (c) {
|
|
148
|
+
case "\t":
|
|
149
|
+
case " ": break;
|
|
150
|
+
case ".":
|
|
151
|
+
case "[":
|
|
152
|
+
case "]":
|
|
153
|
+
if (identifier.length) {
|
|
154
|
+
yield identifier;
|
|
155
|
+
identifier = "";
|
|
156
|
+
}
|
|
157
|
+
yield c;
|
|
158
|
+
break;
|
|
159
|
+
default:
|
|
160
|
+
identifier += c;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (identifier.length) {
|
|
165
|
+
yield identifier;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
138
169
|
/**
|
|
139
170
|
* Set Object attribute.
|
|
140
171
|
* The name may be a property path like 'a.b.c'.
|
|
@@ -143,7 +174,6 @@ export function defaultValues(attributes, object) {
|
|
|
143
174
|
* @param {any} value
|
|
144
175
|
*/
|
|
145
176
|
export function setAttribute(object, name, value) {
|
|
146
|
-
|
|
147
177
|
let lastObject = object;
|
|
148
178
|
let lastKey;
|
|
149
179
|
|
|
@@ -169,37 +199,6 @@ export function setAttribute(object, name, value) {
|
|
|
169
199
|
lastObject[lastKey] = value;
|
|
170
200
|
}
|
|
171
201
|
|
|
172
|
-
/**
|
|
173
|
-
* Split property path into tokens
|
|
174
|
-
* @param {string} string
|
|
175
|
-
* @return {Iterator<string>}
|
|
176
|
-
*/
|
|
177
|
-
function* tokens(string) {
|
|
178
|
-
let identifier = "";
|
|
179
|
-
|
|
180
|
-
for (const c of string) {
|
|
181
|
-
switch (c) {
|
|
182
|
-
case "\t":
|
|
183
|
-
case " ": break;
|
|
184
|
-
case ".":
|
|
185
|
-
case "[":
|
|
186
|
-
case "]":
|
|
187
|
-
if (identifier.length) {
|
|
188
|
-
yield identifier;
|
|
189
|
-
identifier = "";
|
|
190
|
-
}
|
|
191
|
-
yield c;
|
|
192
|
-
break;
|
|
193
|
-
default:
|
|
194
|
-
identifier += c;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (identifier.length) {
|
|
199
|
-
yield identifier;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
202
|
/**
|
|
204
203
|
* Deliver attribute value.
|
|
205
204
|
* The name may be a property path like 'a.b.c'.
|
package/src/base-object.mjs
CHANGED
package/src/branch.mjs
CHANGED
package/src/hook.mjs
CHANGED
|
@@ -47,7 +47,7 @@ export class MultiGroupProvider extends BaseProvider {
|
|
|
47
47
|
if (rg !== undefined) {
|
|
48
48
|
const r = await rg.repository(repository);
|
|
49
49
|
if (r !== undefined) {
|
|
50
|
-
return r.branch( branch ||
|
|
50
|
+
return r.branch( branch || r.defaultBranchName);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -104,7 +104,7 @@ export class MultiGroupProvider extends BaseProvider {
|
|
|
104
104
|
* @return {RepositoryGroup}
|
|
105
105
|
*/
|
|
106
106
|
addRepositoryGroup(name, options) {
|
|
107
|
-
return this.#repositoryGroups.get(this.normalizeGroupName(name, true)) ||
|
|
107
|
+
return this.#repositoryGroups.get(this.normalizeGroupName(name, true)) || new this.repositoryGroupClass(this, name, options);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
_addRepositoryGroup(repositoryGroup) {
|
package/src/named-object.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { optionJSON } from "./attribute.mjs";
|
|
2
2
|
import { BaseObject } from "./base-object.mjs";
|
|
3
|
-
import { name, url } from "./attributes.mjs";
|
|
3
|
+
import { name, url, description, id, uuid } from "./attributes.mjs";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Object with a name.
|
|
@@ -16,9 +16,11 @@ export class NamedObject extends BaseObject {
|
|
|
16
16
|
*/
|
|
17
17
|
static get attributes() {
|
|
18
18
|
return {
|
|
19
|
-
...super.attributes,
|
|
20
19
|
name,
|
|
21
|
-
|
|
20
|
+
id,
|
|
21
|
+
uuid,
|
|
22
|
+
description,
|
|
23
|
+
|
|
22
24
|
/**
|
|
23
25
|
* The url of home page.
|
|
24
26
|
* @return {string}
|
package/src/owned-object.mjs
CHANGED
|
@@ -13,15 +13,23 @@ export class OwnedObject extends NamedObject {
|
|
|
13
13
|
return "_add" + this.name;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
owner: { value: owner }
|
|
20
|
-
});
|
|
16
|
+
static get deleteMethodName() {
|
|
17
|
+
return "_delete" + this.name;
|
|
18
|
+
}
|
|
21
19
|
|
|
20
|
+
constructor(owner, name, options, additionalProperties) {
|
|
21
|
+
super(name, options, additionalProperties);
|
|
22
|
+
this.owner = owner;
|
|
22
23
|
owner[this.constructor.addMethodName](this);
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Removes the receiver from the owner.
|
|
28
|
+
*/
|
|
29
|
+
delete() {
|
|
30
|
+
this.owner[this.constructor.deleteMethodName](this);
|
|
31
|
+
}
|
|
32
|
+
|
|
25
33
|
/**
|
|
26
34
|
* Check for equality.
|
|
27
35
|
* @param {OwnedObject} other
|
package/src/pull-request.mjs
CHANGED
|
@@ -31,6 +31,10 @@ export class PullRequest extends OwnedObject {
|
|
|
31
31
|
return "_addPullRequest";
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
static get deleteMethodName() {
|
|
35
|
+
return "_deletePullRequest";
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
static get type() {
|
|
35
39
|
return "pull-request";
|
|
36
40
|
}
|
|
@@ -39,14 +43,6 @@ export class PullRequest extends OwnedObject {
|
|
|
39
43
|
return "pullRequests";
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
/**
|
|
43
|
-
* All valid states
|
|
44
|
-
* @return {Set<string>} valid states
|
|
45
|
-
*/
|
|
46
|
-
static get validStates() {
|
|
47
|
-
return new Set(["OPEN", "MERGED", "CLOSED"]);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
46
|
/**
|
|
51
47
|
* States to list pull request by default
|
|
52
48
|
* @return {Set<string>} states to list by default
|
|
@@ -103,6 +99,7 @@ export class PullRequest extends OwnedObject {
|
|
|
103
99
|
state: {
|
|
104
100
|
...state,
|
|
105
101
|
default: "OPEN",
|
|
102
|
+
values: new Set(["OPEN", "MERGED", "CLOSED"]),
|
|
106
103
|
writable: true
|
|
107
104
|
},
|
|
108
105
|
|
|
@@ -143,7 +140,7 @@ export class PullRequest extends OwnedObject {
|
|
|
143
140
|
state: {
|
|
144
141
|
set(value) {
|
|
145
142
|
value = value.toUpperCase();
|
|
146
|
-
if (this.constructor.
|
|
143
|
+
if (this.constructor.attributes.state.values.has(value)) {
|
|
147
144
|
state = value;
|
|
148
145
|
} else throw new Error(`Invalid Pull Request state ${value}`);
|
|
149
146
|
},
|
package/src/ref.mjs
CHANGED
package/src/repository-group.mjs
CHANGED
package/src/repository.mjs
CHANGED
|
@@ -8,13 +8,13 @@ import { url, size, language, boolean_attribute } from "./attributes.mjs";
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Abstract repository
|
|
11
|
-
* @param {
|
|
11
|
+
* @param {RepositoryOwner} owner
|
|
12
12
|
* @param {string} name (#branch) will be removed
|
|
13
13
|
* @param {Object} options
|
|
14
14
|
* @param {string} [options.description] human readable description
|
|
15
15
|
* @param {string} [options.id] internal id
|
|
16
16
|
*
|
|
17
|
-
* @property {
|
|
17
|
+
* @property {RepositoryOwner} owner
|
|
18
18
|
* @property {string} name without (#branch)
|
|
19
19
|
* @property {string} [description] from options.description
|
|
20
20
|
* @property {string} [id] from options.id
|
|
@@ -28,6 +28,11 @@ export class Repository extends OwnedObject {
|
|
|
28
28
|
return "_addRepository";
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
static get deleteMethodName()
|
|
32
|
+
{
|
|
33
|
+
return "_deleteRepository";
|
|
34
|
+
}
|
|
35
|
+
|
|
31
36
|
static get collectionName() {
|
|
32
37
|
return "repositories";
|
|
33
38
|
}
|