repository-provider 29.1.4 → 29.2.1

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
@@ -202,7 +202,7 @@ console.log(await readme.getString());
202
202
  * [Parameters](#parameters-46)
203
203
  * [equals](#equals-3)
204
204
  * [Parameters](#parameters-47)
205
- * [registerInstanceMethodName](#registerinstancemethodname)
205
+ * [addMethodName](#addmethodname)
206
206
  * [Project](#project)
207
207
  * [PullRequest](#pullrequest)
208
208
  * [Parameters](#parameters-48)
@@ -327,7 +327,6 @@ console.log(await readme.getString());
327
327
  * [type](#type-1)
328
328
  * [refId](#refid-1)
329
329
  * [Parameters](#parameters-79)
330
- * [toString](#tostring-2)
331
330
  * [toJSON](#tojson-3)
332
331
  * [attributes](#attributes-2)
333
332
  * [defaultBranchName](#defaultbranchname)
@@ -489,7 +488,7 @@ Save object attributes in the backing store.
489
488
 
490
489
  ### toString
491
490
 
492
- Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name
491
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** fullName
493
492
 
494
493
  ### displayName
495
494
 
@@ -1211,7 +1210,7 @@ Check for equality.
1211
1210
 
1212
1211
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if receiver and owner are equal
1213
1212
 
1214
- ### registerInstanceMethodName
1213
+ ### addMethodName
1215
1214
 
1216
1215
  Method name to be called to register one instance in the owner.
1217
1216
  sample: Application => \_addApplication
@@ -1224,7 +1223,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
1224
1223
 
1225
1224
  ## PullRequest
1226
1225
 
1227
- **Extends NamedObject**
1226
+ **Extends OwnedObject**
1228
1227
 
1229
1228
  Abstract pull request.
1230
1229
  [Repository#addPullRequest](#repositoryaddpullrequest)
@@ -1232,7 +1231,7 @@ Abstract pull request.
1232
1231
  ### Parameters
1233
1232
 
1234
1233
  * `source` **[Branch](#branch)** merge source
1235
- * `destination` **[Branch](#branch)** merge target
1234
+ * `owner`
1236
1235
  * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1237
1236
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
1238
1237
 
@@ -1240,6 +1239,7 @@ Abstract pull request.
1240
1239
  * `options.state` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**
1241
1240
  * `options.merged` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**
1242
1241
  * `options.locked` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**
1242
+ * `destination` **[Branch](#branch)** merge target
1243
1243
 
1244
1244
  ### Properties
1245
1245
 
@@ -1920,12 +1920,6 @@ Get sha of a ref.
1920
1920
 
1921
1921
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** sha of the ref
1922
1922
 
1923
- ### toString
1924
-
1925
- full name.
1926
-
1927
- Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1928
-
1929
1923
  ### toJSON
1930
1924
 
1931
1925
  Provide name and all defined attributes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "29.1.4",
3
+ "version": "29.2.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,14 +34,14 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "ava": "^4.2.0",
37
- "c8": "^7.11.2",
37
+ "c8": "^7.11.3",
38
38
  "documentation": "^13.2.5",
39
- "repository-provider-test-support": "^2.1.17",
39
+ "repository-provider-test-support": "^2.1.18",
40
40
  "semantic-release": "^19.0.2",
41
41
  "typescript": "^4.6.3"
42
42
  },
43
43
  "engines": {
44
- "node": ">=16.14.2"
44
+ "node": ">=16.15.0"
45
45
  },
46
46
  "repository": {
47
47
  "type": "git",
@@ -82,10 +82,10 @@ export class BaseObject {
82
82
  async update() {}
83
83
 
84
84
  /**
85
- * @return {string} name
85
+ * @return {string} fullName
86
86
  */
87
87
  toString() {
88
- return this.name;
88
+ return this.fullName;
89
89
  }
90
90
 
91
91
  /**
@@ -104,6 +104,22 @@ export class BaseObject {
104
104
  return this.name;
105
105
  }
106
106
 
107
+ /**
108
+ * Complete name in the hierachy.
109
+ * @return {string}
110
+ */
111
+ get fullCondensedName() {
112
+ return this.fullName;
113
+ }
114
+
115
+ /**
116
+ * Short human readable identifier with provider and branch.
117
+ * @return {string}
118
+ */
119
+ get identifier() {
120
+ return `${this.provider.name}:${this.fullCondensedName}`;
121
+ }
122
+
107
123
  /**
108
124
  * By default cannot be written to.
109
125
  * @return {boolean} false
package/src/branch.mjs CHANGED
@@ -17,7 +17,7 @@ import { Commit } from "./commit.mjs";
17
17
  */
18
18
  export class Branch extends Ref {
19
19
 
20
- static get registerInstanceMethodName() {
20
+ static get addMethodName() {
21
21
  return "_addBranch";
22
22
  }
23
23
 
package/src/hook.mjs CHANGED
@@ -8,7 +8,6 @@ export class Hook extends OwnedObject {
8
8
  static get attributes() {
9
9
  return {
10
10
  ...super.attributes,
11
- id: { type: "string", writable: true },
12
11
  url: { type: "url", description: "target url", writable: true },
13
12
  secret: { type: "string", private: true, writable: true },
14
13
  content_type: { type: "string", default: "json", writable: true },
@@ -17,7 +16,7 @@ export class Hook extends OwnedObject {
17
16
  };
18
17
  }
19
18
 
20
- static get registerInstanceMethodName() {
19
+ static get addMethodName() {
21
20
  return "_addHook";
22
21
  }
23
22
 
@@ -34,3 +33,4 @@ export class Hook extends OwnedObject {
34
33
  return optionJSON(this, { name: this.name, id: this.id, events: [...this.events] });
35
34
  }
36
35
  }
36
+
@@ -33,7 +33,7 @@ export class NamedObject extends BaseObject {
33
33
  * @return {string} name with owner name
34
34
  */
35
35
  get fullName() {
36
- return this.owner.name + "/" + this.name;
36
+ return this.owner ? this.owner.name + "/" + this.name : this.name;
37
37
  }
38
38
 
39
39
  /**
@@ -9,7 +9,7 @@ export class OwnedObject extends NamedObject {
9
9
  * sample: Application => _addApplication
10
10
  * @return {string}
11
11
  */
12
- static get registerInstanceMethodName() {
12
+ static get addMethodName() {
13
13
  return "_add" + this.name;
14
14
  }
15
15
 
@@ -19,7 +19,7 @@ export class OwnedObject extends NamedObject {
19
19
  owner: { value: owner }
20
20
  });
21
21
 
22
- owner[this.constructor.registerInstanceMethodName](this);
22
+ owner[this.constructor.addMethodName](this);
23
23
  }
24
24
 
25
25
  /**
@@ -28,7 +28,7 @@ import { BaseProvider } from "./base-provider.mjs";
28
28
  */
29
29
  export class PullRequest extends OwnedObject {
30
30
 
31
- static get registerInstanceMethodName() {
31
+ static get addMethodName() {
32
32
  return "_addPullRequest";
33
33
  }
34
34
 
@@ -240,7 +240,7 @@ export class PullRequest extends OwnedObject {
240
240
  async delete() {
241
241
  return this.owner === undefined
242
242
  ? undefined
243
- : this.owner.deletePullRequest(this.number);
243
+ : this.owner.deletePullRequest(this.name);
244
244
  }
245
245
 
246
246
  /**
package/src/ref.mjs CHANGED
@@ -116,14 +116,6 @@ export class Ref extends OwnedObject {
116
116
  : `${this.owner.fullName}#${this.name}`;
117
117
  }
118
118
 
119
- /**
120
- * Short human readable identifier with provider and branch.
121
- * @return {string}
122
- */
123
- get identifier() {
124
- return `${this.provider.name}:${this.fullCondensedName}`;
125
- }
126
-
127
119
  /**
128
120
  * Same as identifier.
129
121
  * @return {string}
@@ -18,7 +18,7 @@ import { BaseProvider } from "./base-provider.mjs";
18
18
 
19
19
  export class RepositoryGroup extends RepositoryOwner(OwnedObject) {
20
20
 
21
- static get registerInstanceMethodName() {
21
+ static get addMethodName() {
22
22
  return "_addRepositoryGroup";
23
23
  }
24
24
 
@@ -26,7 +26,7 @@ import { BaseProvider } from "./base-provider.mjs";
26
26
  */
27
27
  export class Repository extends OwnedObject {
28
28
 
29
- static get registerInstanceMethodName() {
29
+ static get addMethodName() {
30
30
  return "_addRepository";
31
31
  }
32
32
 
@@ -69,6 +69,7 @@ export class Repository extends OwnedObject {
69
69
  #branches = new Map();
70
70
  #tags = new Map();
71
71
  #projects = new Map();
72
+ #applications = new Map();
72
73
  #milestones = new Map();
73
74
  #pullRequests = new Map();
74
75
  #hooks = [];
@@ -95,14 +96,6 @@ export class Repository extends OwnedObject {
95
96
  return `${this.owner.name}/${this.name}`;
96
97
  }
97
98
 
98
- /**
99
- * Short human readable identifier with provider and branch.
100
- * @return {string}
101
- */
102
- get identifier() {
103
- return `${this.provider.name}:${this.fullName}`;
104
- }
105
-
106
99
  /**
107
100
  * Lookup entries form the head of the default branch.
108
101
  * {@link Branch#entry}
@@ -461,6 +454,14 @@ export class Repository extends OwnedObject {
461
454
  return this.#projects.get(name);
462
455
  }
463
456
 
457
+ _addApplication(application) {
458
+ this.#applications.set(application.name, application);
459
+ }
460
+
461
+ async application(name) {
462
+ return this.#applications.get(name);
463
+ }
464
+
464
465
  /**
465
466
  * Get type of the repository.
466
467
  * @return {string} 'git'
@@ -477,14 +478,6 @@ export class Repository extends OwnedObject {
477
478
  async refId(ref) {
478
479
  }
479
480
 
480
- /**
481
- * full name.
482
- * @returns {string}
483
- */
484
- toString() {
485
- return this.fullName;
486
- }
487
-
488
481
  /**
489
482
  * Provide name and all defined attributes
490
483
  */
package/src/tag.mjs CHANGED
@@ -5,7 +5,7 @@ import { Ref } from "./ref.mjs";
5
5
  */
6
6
  export class Tag extends Ref {
7
7
 
8
- static get registerInstanceMethodName() {
8
+ static get addMethodName() {
9
9
  return "_addTag";
10
10
  }
11
11