repository-provider 29.1.5 → 29.2.2

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
@@ -68,6 +68,8 @@ console.log(await readme.getString());
68
68
  * [toString](#tostring)
69
69
  * [displayName](#displayname)
70
70
  * [fullName](#fullname)
71
+ * [fullCondensedName](#fullcondensedname)
72
+ * [identifier](#identifier)
71
73
  * [isWritable](#iswritable)
72
74
  * [equals](#equals)
73
75
  * [Parameters](#parameters-8)
@@ -202,7 +204,7 @@ console.log(await readme.getString());
202
204
  * [Parameters](#parameters-46)
203
205
  * [equals](#equals-3)
204
206
  * [Parameters](#parameters-47)
205
- * [registerInstanceMethodName](#registerinstancemethodname)
207
+ * [addMethodName](#addmethodname)
206
208
  * [Project](#project)
207
209
  * [PullRequest](#pullrequest)
208
210
  * [Parameters](#parameters-48)
@@ -218,7 +220,7 @@ console.log(await readme.getString());
218
220
  * [Parameters](#parameters-50)
219
221
  * [decline](#decline)
220
222
  * [reviews](#reviews)
221
- * [identifier](#identifier)
223
+ * [identifier](#identifier-1)
222
224
  * [validStates](#validstates)
223
225
  * [defaultListStates](#defaultliststates)
224
226
  * [validMergeMethods](#validmergemethods)
@@ -247,8 +249,7 @@ console.log(await readme.getString());
247
249
  * [Parameters](#parameters-56)
248
250
  * [repository](#repository-2)
249
251
  * [fullName](#fullname-3)
250
- * [fullCondensedName](#fullcondensedname)
251
- * [identifier](#identifier-1)
252
+ * [fullCondensedName](#fullcondensedname-1)
252
253
  * [toString](#tostring-1)
253
254
  * [issuesURL](#issuesurl)
254
255
  * [homePageURL](#homepageurl-1)
@@ -271,7 +272,6 @@ console.log(await readme.getString());
271
272
  * [Properties](#properties-10)
272
273
  * [fullName](#fullname-4)
273
274
  * [slug](#slug)
274
- * [identifier](#identifier-2)
275
275
  * [entry](#entry-1)
276
276
  * [Parameters](#parameters-60)
277
277
  * [entries](#entries-1)
@@ -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
 
@@ -503,6 +502,18 @@ Complete name in the hierachy.
503
502
 
504
503
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
505
504
 
505
+ ### fullCondensedName
506
+
507
+ Complete name in the hierachy.
508
+
509
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
510
+
511
+ ### identifier
512
+
513
+ Short human readable identifier with provider and branch.
514
+
515
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
516
+
506
517
  ### isWritable
507
518
 
508
519
  By default cannot be written to.
@@ -1211,7 +1222,7 @@ Check for equality.
1211
1222
 
1212
1223
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if receiver and owner are equal
1213
1224
 
1214
- ### registerInstanceMethodName
1225
+ ### addMethodName
1215
1226
 
1216
1227
  Method name to be called to register one instance in the owner.
1217
1228
  sample: Application => \_addApplication
@@ -1485,12 +1496,6 @@ But skipping the branch name if it is the default branch.
1485
1496
 
1486
1497
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 'user/repo#branch'
1487
1498
 
1488
- ### identifier
1489
-
1490
- Short human readable identifier with provider and branch.
1491
-
1492
- Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1493
-
1494
1499
  ### toString
1495
1500
 
1496
1501
  Same as identifier.
@@ -1621,12 +1626,6 @@ Name of the repo as used in the URL.
1621
1626
 
1622
1627
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1623
1628
 
1624
- ### identifier
1625
-
1626
- Short human readable identifier with provider and branch.
1627
-
1628
- Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1629
-
1630
1629
  ### entry
1631
1630
 
1632
1631
  Lookup entries form the head of the default branch.
@@ -1921,12 +1920,6 @@ Get sha of a ref.
1921
1920
 
1922
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
1923
1922
 
1924
- ### toString
1925
-
1926
- full name.
1927
-
1928
- Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1929
-
1930
1923
  ### toJSON
1931
1924
 
1932
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.5",
3
+ "version": "29.2.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -27,21 +27,21 @@
27
27
  "docs": "documentation readme --section=API ./src/**/*.mjs",
28
28
  "lint": "npm run lint:docs && npm run lint:tsc",
29
29
  "lint:docs": "documentation lint ./src/**/*.mjs",
30
- "lint:tsc": "tsc --allowJs --checkJs --noEmit -t es2022 ./src/*.mjs"
30
+ "lint:tsc": "tsc --allowJs --checkJs --noEmit -t es2022 -m node16 ./src/*.mjs"
31
31
  },
32
32
  "dependencies": {
33
33
  "matching-iterator": "^2.0.4"
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.19",
40
40
  "semantic-release": "^19.0.2",
41
- "typescript": "^4.6.3"
41
+ "typescript": "^4.7.2"
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
@@ -7,7 +7,7 @@ import { Commit } from "./commit.mjs";
7
7
  /**
8
8
  * Abstract branch.
9
9
  * @see {@link Repository#_addBranch}
10
- * @param {Repository} repository
10
+ * @param {RepositoryOwner} owner
11
11
  * @param {string} name
12
12
  * @param {Object} options
13
13
  *
@@ -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
  /**
@@ -9,7 +9,7 @@ import { BaseProvider } from "./base-provider.mjs";
9
9
  * Abstract pull request.
10
10
  * {@link Repository#addPullRequest}
11
11
  * @param {Branch} source merge source
12
- * @param {Branch} destination merge target
12
+ * @param {Branch} owner merge target
13
13
  * @param {string} name
14
14
  * @param {Object} options
15
15
  * @param {string} [options.title]
@@ -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
 
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