repository-provider 25.5.11 → 26.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "25.5.11",
3
+ "version": "26.0.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,8 +35,8 @@
35
35
  "ava": "^3.15.0",
36
36
  "c8": "^7.10.0",
37
37
  "documentation": "^13.2.5",
38
- "repository-provider-test-support": "^1.8.3",
39
- "semantic-release": "^18.0.0"
38
+ "repository-provider-test-support": "^1.8.7",
39
+ "semantic-release": "^18.0.1"
40
40
  },
41
41
  "engines": {
42
42
  "node": ">=14.18.1"
package/src/attribute.mjs CHANGED
@@ -5,6 +5,7 @@
5
5
  * @property {string} type
6
6
  * @property {boolean} writable
7
7
  * @property {boolean} private
8
+ * @property {string} description
8
9
  */
9
10
 
10
11
  /**
@@ -145,12 +146,11 @@ export function getAttribute(object, name) {
145
146
  * In other words only produce key value pairs if value is defined.
146
147
  * @param {Object} object
147
148
  * @param {Object} initial
148
- * @param {string[]} skip keys not to put in the result
149
+ * @param {Object} attibutes to operator on
149
150
  * @return {Object} initial + defined values
150
151
  */
151
- export function optionJSON(object, initial = {}, skip = []) {
152
- return Object.keys(object.constructor.attributes || {})
153
- .filter(key => skip.indexOf(key) < 0)
152
+ export function optionJSON(object, initial = {}, attributes=object.constructor.attributes) {
153
+ return Object.keys(attributes || {})
154
154
  .reduce((a, c) => {
155
155
  const value = object[c];
156
156
  if (value !== undefined && !(value instanceof Function)) {
@@ -2,10 +2,11 @@ import { definePropertiesFromOptions, mapAttributes } from "./attribute.mjs";
2
2
 
3
3
  /**
4
4
  * @param {Object} options
5
+ * @param {Object} additionalProperties
5
6
  */
6
7
  export class BaseObject {
7
8
  /**
8
- * options
9
+ * Attributes definitions
9
10
  */
10
11
  static get attributes() {
11
12
  return {
@@ -37,10 +38,19 @@ export class BaseObject {
37
38
  */
38
39
  avatarURL: { type: "url" },
39
40
 
40
- homePageURL: { type: "url" }
41
+ homePageURL: { type: "url", writable: true }
41
42
  };
42
43
  }
43
44
 
45
+ /**
46
+ * @return {Object} writable attributes
47
+ */
48
+ static get writableAttributes() {
49
+ return Object.fromEntries(
50
+ Object.entries(this.attributes).filter(([k, v]) => v.writable)
51
+ );
52
+ }
53
+
44
54
  /**
45
55
  * Map attributes between external and internal representation.
46
56
  * @return {Object}
package/src/hook.mjs CHANGED
@@ -16,12 +16,12 @@ export class Hook extends BaseObject {
16
16
  static get attributes() {
17
17
  return {
18
18
  ...super.attributes,
19
- name: { type: "string" },
20
- url: { type: "url", description: "target url" },
21
- secret: { type: "string", private: true },
22
- content_type: { type: "string", default: "json" },
19
+ name: { type: "string", writable: true },
20
+ url: { type: "url", description: "target url", writable: true },
21
+ secret: { type: "string", private: true, writable: true },
22
+ content_type: { type: "string", default: "json", writable: true },
23
23
  insecure_ssl: { type: "boolean", default: false },
24
- active: { type: "boolean", default: true }
24
+ active: { type: "boolean", default: true, writable: true }
25
25
  };
26
26
  }
27
27
 
@@ -5,6 +5,7 @@ import { BaseObject } from "./base-object.mjs";
5
5
  * Object with a name.
6
6
  * @param {string} name
7
7
  * @param {Object} options
8
+ * @param {Object} additionalProperties
8
9
  *
9
10
  * @property {string} name
10
11
  */
@@ -33,6 +34,13 @@ export class NamedObject extends BaseObject {
33
34
  return this.name;
34
35
  }
35
36
 
37
+ /**
38
+ * Preserve object attributes in the backing store.
39
+ */
40
+ async update()
41
+ {
42
+ }
43
+
36
44
  toString() {
37
45
  return this.name;
38
46
  }
@@ -77,13 +77,13 @@ export class PullRequest extends NamedObject {
77
77
  * The one line description of the pull request.
78
78
  * @return {string}
79
79
  */
80
- title: { type: "string" },
80
+ title: { type: "string", writable: true },
81
81
 
82
82
  /**
83
83
  * The description of the pull request.
84
84
  * @return {string}
85
85
  */
86
- body: { type: "string" },
86
+ body: { type: "string", writable: true },
87
87
 
88
88
  /**
89
89
  * state of the pull request.
@@ -37,7 +37,7 @@ export class Repository extends NamedObject {
37
37
  * URLs of the repository
38
38
  * @return {string[]}
39
39
  */
40
- urls: {},
40
+ urls: { },
41
41
 
42
42
  cloneURL: { type: "url" },
43
43
 
@@ -54,7 +54,7 @@ export class Repository extends NamedObject {
54
54
  issuesURL: { type: "url" },
55
55
  size: { type: "integer" },
56
56
  language: { type: "string" },
57
- isArchived: { type: "boolean", default: false },
57
+ isArchived: { type: "boolean", default: false, writable: true },
58
58
  isLocked: { type: "boolean", default: false },
59
59
  isDisabled: { type: "boolean", default: false },
60
60
  isTemplate: { type: "boolean", default: false },
@@ -230,13 +230,6 @@ export class Repository extends NamedObject {
230
230
  return false;
231
231
  }
232
232
 
233
- /**
234
- * Updates repositroy attributes.
235
- */
236
- async update()
237
- {
238
- }
239
-
240
233
  /**
241
234
  * Lookup branch by name.
242
235
  * @param {string} name