repository-provider 28.3.1 → 28.3.4

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
@@ -198,6 +198,7 @@ console.log(await readme.getString());
198
198
  * [Parameters](#parameters-47)
199
199
  * [displayName](#displayname)
200
200
  * [fullName](#fullname-1)
201
+ * [toString](#tostring)
201
202
  * [toJSON](#tojson-2)
202
203
  * [OwnedObject](#ownedobject)
203
204
  * [Parameters](#parameters-48)
@@ -251,7 +252,7 @@ console.log(await readme.getString());
251
252
  * [fullName](#fullname-3)
252
253
  * [fullCondensedName](#fullcondensedname)
253
254
  * [identifier](#identifier-1)
254
- * [toString](#tostring)
255
+ * [toString](#tostring-1)
255
256
  * [issuesURL](#issuesurl)
256
257
  * [homePageURL](#homepageurl-1)
257
258
  * [isLocked](#islocked)
@@ -330,7 +331,7 @@ console.log(await readme.getString());
330
331
  * [type](#type-1)
331
332
  * [refId](#refid-1)
332
333
  * [Parameters](#parameters-82)
333
- * [toString](#tostring-1)
334
+ * [toString](#tostring-2)
334
335
  * [toJSON](#tojson-3)
335
336
  * [attributes](#attributes-2)
336
337
  * [defaultBranchName](#defaultbranchname)
@@ -1192,6 +1193,10 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
1192
1193
 
1193
1194
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name with owner name
1194
1195
 
1196
+ ### toString
1197
+
1198
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name
1199
+
1195
1200
  ### toJSON
1196
1201
 
1197
1202
  Provide name and all defined attributes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "28.3.1",
3
+ "version": "28.3.4",
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.4",
39
+ "repository-provider-test-support": "^2.1.6",
40
40
  "semantic-release": "^19.0.2",
41
41
  "typescript": "^4.6.3"
42
42
  },
package/src/hook.mjs CHANGED
@@ -1,23 +1,14 @@
1
1
  import { optionJSON } from "./attribute.mjs";
2
- import { BaseObject } from "./base-object.mjs";
3
- import { Repository } from "./repository.mjs";
2
+ import { OwnedObject } from "./owned-object.mjs";
4
3
 
5
4
  /**
6
5
  * Repository hook.
7
- * @param {Repository} repository
8
- * @param {string} id
9
- * @param {Set<string>} events
10
- * @param {Object} options
11
- *
12
- * @property {Repository} repository
13
- * @property {URL} url
14
- * @property {Set<string>} events
15
6
  */
16
- export class Hook extends BaseObject {
7
+ export class Hook extends OwnedObject {
17
8
  static get attributes() {
18
9
  return {
19
10
  ...super.attributes,
20
- name: { type: "string", writable: true },
11
+ id: { type: "string", writable: true },
21
12
  url: { type: "url", description: "target url", writable: true },
22
13
  secret: { type: "string", private: true, writable: true },
23
14
  content_type: { type: "string", default: "json", writable: true },
@@ -26,42 +17,16 @@ export class Hook extends BaseObject {
26
17
  };
27
18
  }
28
19
 
29
- constructor(repository, id, events = new Set(["*"]), options) {
30
- super(options, {
31
- id: { value: id },
32
- repository: { value: repository },
20
+ constructor(owner, name, events = new Set(["*"]), options) {
21
+ super(owner, name, options, {
33
22
  events: { value: events }
34
23
  });
35
-
36
- repository._addHook(this);
37
- }
38
-
39
- get owner()
40
- {
41
- return this.repository;
42
- }
43
-
44
- get fullName() {
45
- return `${this.repository.fullName}/${this.id}`;
46
- }
47
-
48
- get displayName() {
49
- return this.id;
50
- }
51
-
52
- /**
53
- * Check for equality.
54
- * @param {Hook} other
55
- * @return {boolean} true if name and repository are equal
56
- */
57
- equals(other) {
58
- return super.equals(other) && this.repository.equals(other.repository);
59
24
  }
60
25
 
61
26
  /**
62
27
  * Provide name, events and all defined attributes.
63
28
  */
64
29
  toJSON() {
65
- return optionJSON(this, { id: this.id, events: [...this.events] });
30
+ return optionJSON(this, { name: this.name, id: this.id, events: [...this.events] });
66
31
  }
67
32
  }
@@ -13,8 +13,9 @@ export class OwnedObject extends NamedObject {
13
13
  return "_add" + this.name;
14
14
  }
15
15
 
16
- constructor(owner, name, options) {
16
+ constructor(owner, name, options, additionalProperties) {
17
17
  super(name, options, {
18
+ ...additionalProperties,
18
19
  owner: { value: owner }
19
20
  });
20
21