repository-provider 32.3.18 → 32.3.19

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
@@ -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.18",
3
+ "version": "32.3.19",
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.25",
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/branch.mjs CHANGED
@@ -19,6 +19,10 @@ export class Branch extends Ref {
19
19
  static get addMethodName() {
20
20
  return "_addBranch";
21
21
  }
22
+
23
+ static get deleteMethodName() {
24
+ return "_deleteBranch";
25
+ }
22
26
 
23
27
  static get collectionName() {
24
28
  return "branches";
package/src/hook.mjs CHANGED
@@ -20,4 +20,8 @@ export class Hook extends OwnedObject {
20
20
  static get addMethodName() {
21
21
  return "_addHook";
22
22
  }
23
+
24
+ static get delteteMethodName() {
25
+ return "_deleteHook";
26
+ }
23
27
  }
@@ -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)) || new this.repositoryGroupClass(this, name, options);
107
+ return this.#repositoryGroups.get(this.normalizeGroupName(name, true)) || new this.repositoryGroupClass(this, name, options);
108
108
  }
109
109
 
110
110
  _addRepositoryGroup(repositoryGroup) {
@@ -13,15 +13,20 @@ export class OwnedObject extends NamedObject {
13
13
  return "_add" + this.name;
14
14
  }
15
15
 
16
- constructor(owner, name, options, additionalProperties) {
17
- super(name, options, {
18
- ...additionalProperties,
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
+ delete() {
27
+ this.owner[this.constructor.deleteMethodName](this);
28
+ }
29
+
25
30
  /**
26
31
  * Check for equality.
27
32
  * @param {OwnedObject} other
@@ -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.validStates.has(value)) {
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
@@ -93,7 +93,7 @@ export class Ref extends OwnedObject {
93
93
  * Ref owner.
94
94
  * By default we provide the repository owner
95
95
  * @see {@link Repository#owner}
96
- * @return {string}
96
+ * @return {Repository}
97
97
  */
98
98
  get repository() {
99
99
  return this.owner;
@@ -23,6 +23,10 @@ export class RepositoryGroup extends RepositoryOwner(OwnedObject) {
23
23
  return "_addRepositoryGroup";
24
24
  }
25
25
 
26
+ static get deleteMethodName() {
27
+ return "_deleteRepositoryGroup";
28
+ }
29
+
26
30
  static get type() {
27
31
  return "repository-group";
28
32
  }
@@ -8,13 +8,13 @@ import { url, size, language, boolean_attribute } from "./attributes.mjs";
8
8
 
9
9
  /**
10
10
  * Abstract repository
11
- * @param {Owner} owner
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 {Owner} owner
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
  }
package/src/tag.mjs CHANGED
@@ -9,6 +9,10 @@ export class Tag extends Ref {
9
9
  return "_addTag";
10
10
  }
11
11
 
12
+ static get deleteMethodName() {
13
+ return "_deleteTag";
14
+ }
15
+
12
16
  /**
13
17
  * @return {string} tags
14
18
  */