repository-provider 25.5.12 → 26.0.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
@@ -66,6 +66,7 @@ console.log(await readme.getString());
66
66
  * [equals](#equals)
67
67
  * [Parameters](#parameters-8)
68
68
  * [attributes](#attributes)
69
+ * [writableAttributes](#writableattributes)
69
70
  * [attributeMapping](#attributemapping)
70
71
  * [description](#description)
71
72
  * [id](#id)
@@ -178,6 +179,7 @@ console.log(await readme.getString());
178
179
  * [equals](#equals-3)
179
180
  * [Parameters](#parameters-45)
180
181
  * [displayName](#displayname)
182
+ * [update](#update)
181
183
  * [toJSON](#tojson-2)
182
184
  * [Project](#project)
183
185
  * [Parameters](#parameters-46)
@@ -275,7 +277,6 @@ console.log(await readme.getString());
275
277
  * [isLocked](#islocked-1)
276
278
  * [isDisabled](#isdisabled-1)
277
279
  * [isTemplate](#istemplate)
278
- * [update](#update)
279
280
  * [branch](#branch-1)
280
281
  * [Parameters](#parameters-65)
281
282
  * [defaultBranch](#defaultbranch)
@@ -361,6 +362,7 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
361
362
  * `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
362
363
  * `writable` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
363
364
  * `private` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
365
+ * `description` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
364
366
 
365
367
  ## definePropertiesFromOptions
366
368
 
@@ -423,7 +425,8 @@ In other words only produce key value pairs if value is defined.
423
425
 
424
426
  * `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
425
427
  * `initial` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `{}`)
426
- * `skip` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** keys not to put in the result (optional, default `[]`)
428
+ * `attributes` (optional, default `object.constructor.attributes`)
429
+ * `attibutes` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** to operator on
427
430
 
428
431
  Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** initial + defined values
429
432
 
@@ -460,7 +463,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
460
463
  ### Parameters
461
464
 
462
465
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
463
- * `additionalProperties`
466
+ * `additionalProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
464
467
 
465
468
  ### equals
466
469
 
@@ -474,7 +477,11 @@ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
474
477
 
475
478
  ### attributes
476
479
 
477
- options
480
+ Attributes definitions
481
+
482
+ ### writableAttributes
483
+
484
+ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** writable attributes
478
485
 
479
486
  ### attributeMapping
480
487
 
@@ -1050,7 +1057,7 @@ Object with a name.
1050
1057
 
1051
1058
  * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1052
1059
  * `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
1053
- * `additionalProperties`
1060
+ * `additionalProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
1054
1061
 
1055
1062
  ### Properties
1056
1063
 
@@ -1072,6 +1079,10 @@ Beatified name use for human displaying only.
1072
1079
 
1073
1080
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** human readable name
1074
1081
 
1082
+ ### update
1083
+
1084
+ Preserve object attributes in the backing store.
1085
+
1075
1086
  ### toJSON
1076
1087
 
1077
1088
  Provide name and all defined attributes.
@@ -1639,10 +1650,6 @@ By default we are not a template.
1639
1650
 
1640
1651
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** false
1641
1652
 
1642
- ### update
1643
-
1644
- Updates repositroy attributes.
1645
-
1646
1653
  ### branch
1647
1654
 
1648
1655
  Lookup branch by name.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "25.5.12",
3
+ "version": "26.0.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,7 +35,7 @@
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.5",
38
+ "repository-provider-test-support": "^1.8.11",
39
39
  "semantic-release": "^18.0.1"
40
40
  },
41
41
  "engines": {
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