repository-provider 26.4.5 → 26.5.0

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
@@ -146,33 +146,31 @@ console.log(await readme.getString());
146
146
  * [priority](#priority)
147
147
  * [name](#name-1)
148
148
  * [messageDestination](#messagedestination-1)
149
- * [Commit](#commit)
150
- * [Properties](#properties-2)
151
- * [Commit](#commit-1)
152
- * [Parameters](#parameters-32)
153
- * [Properties](#properties-3)
154
- * [CommitResult](#commitresult)
155
- * [Properties](#properties-4)
156
149
  * [Branch](#branch)
157
- * [Parameters](#parameters-33)
158
- * [Properties](#properties-5)
150
+ * [Parameters](#parameters-32)
151
+ * [Properties](#properties-2)
159
152
  * [url](#url-1)
160
153
  * [refType](#reftype)
161
154
  * [isDefault](#isdefault)
162
155
  * [delete](#delete)
163
- * [commit](#commit-2)
164
- * [Parameters](#parameters-34)
156
+ * [commit](#commit)
157
+ * [Parameters](#parameters-33)
165
158
  * [commitIntoPullRequest](#commitintopullrequest)
166
- * [Parameters](#parameters-35)
159
+ * [Parameters](#parameters-34)
167
160
  * [removeEntries](#removeentries)
168
- * [Parameters](#parameters-36)
161
+ * [Parameters](#parameters-35)
169
162
  * [createPullRequest](#createpullrequest)
170
- * [Parameters](#parameters-37)
163
+ * [Parameters](#parameters-36)
171
164
  * [createBranch](#createbranch)
172
- * [Parameters](#parameters-38)
165
+ * [Parameters](#parameters-37)
166
+ * [CommitResult](#commitresult)
167
+ * [Properties](#properties-3)
168
+ * [Commit](#commit-1)
169
+ * [Parameters](#parameters-38)
170
+ * [Properties](#properties-4)
173
171
  * [Hook](#hook)
174
172
  * [Parameters](#parameters-39)
175
- * [Properties](#properties-6)
173
+ * [Properties](#properties-5)
176
174
  * [equals](#equals-2)
177
175
  * [Parameters](#parameters-40)
178
176
  * [toJSON](#tojson-1)
@@ -196,7 +194,7 @@ console.log(await readme.getString());
196
194
  * [Parameters](#parameters-49)
197
195
  * [NamedObject](#namedobject)
198
196
  * [Parameters](#parameters-50)
199
- * [Properties](#properties-7)
197
+ * [Properties](#properties-6)
200
198
  * [equals](#equals-3)
201
199
  * [Parameters](#parameters-51)
202
200
  * [displayName](#displayname)
@@ -205,7 +203,7 @@ console.log(await readme.getString());
205
203
  * [Parameters](#parameters-52)
206
204
  * [PullRequest](#pullrequest)
207
205
  * [Parameters](#parameters-53)
208
- * [Properties](#properties-8)
206
+ * [Properties](#properties-7)
209
207
  * [fullName](#fullname)
210
208
  * [url](#url-2)
211
209
  * [repository](#repository-1)
@@ -232,7 +230,7 @@ console.log(await readme.getString());
232
230
  * [merged](#merged)
233
231
  * [draft](#draft)
234
232
  * [ContentEntry](#contententry)
235
- * [Properties](#properties-9)
233
+ * [Properties](#properties-8)
236
234
  * [Ref](#ref)
237
235
  * [Parameters](#parameters-58)
238
236
  * [equals](#equals-5)
@@ -262,7 +260,7 @@ console.log(await readme.getString());
262
260
  * [isProtected](#isprotected-1)
263
261
  * [RepositoryGroup](#repositorygroup-1)
264
262
  * [Parameters](#parameters-64)
265
- * [Properties](#properties-10)
263
+ * [Properties](#properties-9)
266
264
  * [attributeMapping](#attributemapping-1)
267
265
  * [type](#type)
268
266
  * [url](#url-3)
@@ -270,7 +268,7 @@ console.log(await readme.getString());
270
268
  * [Parameters](#parameters-65)
271
269
  * [Repository](#repository-2)
272
270
  * [Parameters](#parameters-66)
273
- * [Properties](#properties-11)
271
+ * [Properties](#properties-10)
274
272
  * [fullName](#fullname-2)
275
273
  * [slug](#slug)
276
274
  * [provider](#provider-3)
@@ -905,35 +903,6 @@ Name of the provider
905
903
 
906
904
  to forward info/warn and error messages to
907
905
 
908
- ## Commit
909
-
910
- Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
911
-
912
- ### Properties
913
-
914
- * `message` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
915
- * `updates` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[ContentEntry](#contententry)>**
916
-
917
- ## Commit
918
-
919
- ### Parameters
920
-
921
- * `repository`
922
-
923
- ### Properties
924
-
925
- * `repository` **[Repository](#repository)**
926
- * `message` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
927
- * `sha` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
928
-
929
- ## CommitResult
930
-
931
- Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
932
-
933
- ### Properties
934
-
935
- * `ref` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
936
-
937
906
  ## Branch
938
907
 
939
908
  **Extends Ref**
@@ -1038,6 +1007,26 @@ Simply calls Repository.createBranch() with the receiver as source branch
1038
1007
 
1039
1008
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Branch](#branch)>** newly created branch (or already present old one with the same name)
1040
1009
 
1010
+ ## CommitResult
1011
+
1012
+ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
1013
+
1014
+ ### Properties
1015
+
1016
+ * `ref` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1017
+
1018
+ ## Commit
1019
+
1020
+ ### Parameters
1021
+
1022
+ * `repository`
1023
+
1024
+ ### Properties
1025
+
1026
+ * `repository` **[Repository](#repository)**
1027
+ * `message` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1028
+ * `sha` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1029
+
1041
1030
  ## Hook
1042
1031
 
1043
1032
  **Extends BaseObject**
@@ -1436,7 +1425,7 @@ List entries of the branch.
1436
1425
 
1437
1426
  #### Parameters
1438
1427
 
1439
- * `matchingPatterns` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>**
1428
+ * `matchingPatterns` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>?**
1440
1429
 
1441
1430
  Returns **AsyncIterator<[ContentEntry](#contententry)>** all matching entries in the branch
1442
1431
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "26.4.5",
3
+ "version": "26.5.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,7 +38,7 @@
38
38
  "documentation": "^13.2.5",
39
39
  "repository-provider-test-support": "^1.11.1",
40
40
  "semantic-release": "^19.0.2",
41
- "typescript": "^4.6.0-dev.20220201"
41
+ "typescript": "^4.6.0-dev.20220203"
42
42
  },
43
43
  "engines": {
44
44
  "node": ">=14.18.3"
package/src/attribute.mjs CHANGED
@@ -3,8 +3,9 @@
3
3
  *
4
4
  * @property {string} type
5
5
  * @property {boolean} writable
6
- * @property {boolean} private
6
+ * @property {boolean} [private] should the value be shown
7
7
  * @property {string} description
8
+ * @property {any} [default] the default value
8
9
  */
9
10
 
10
11
  /**
@@ -43,7 +44,8 @@ export function definePropertiesFromOptions(
43
44
  const first = path.shift();
44
45
  const property = properties[first];
45
46
 
46
- let value = options[name];
47
+ let value = getAttribute(options, name);
48
+
47
49
  if (value === undefined) {
48
50
  if (attribute.getDefault) {
49
51
  value = attribute.getDefault(attribute, object);
@@ -152,6 +154,10 @@ export function setAttribute(object, name, value) {
152
154
  export function getAttribute(object, name) {
153
155
  let value = object;
154
156
 
157
+ if(value && value[name] !== undefined) {
158
+ return value[name];
159
+ }
160
+
155
161
  for (const p of name.split(/\./)) {
156
162
  if (value === undefined) {
157
163
  break;
@@ -65,8 +65,8 @@ export class BaseObject {
65
65
 
66
66
  /**
67
67
  * Creates an instance of BaseObject.
68
- * @param {*} options
69
- * @param {*} additionalProperties
68
+ * @param {object} options
69
+ * @param {object} additionalProperties
70
70
  */
71
71
  constructor(options, additionalProperties) {
72
72
  definePropertiesFromOptions(
@@ -8,6 +8,7 @@ import { Tag } from "./tag.mjs";
8
8
  import { Hook } from "./hook.mjs";
9
9
  import { Project } from "./project.mjs";
10
10
  import { Milestone } from "./milestone.mjs";
11
+ import { BaseObject } from "./base-object.mjs";
11
12
 
12
13
  /**
13
14
  * @typedef {Object} MessageDestination
@@ -20,7 +21,7 @@ import { Milestone } from "./milestone.mjs";
20
21
  /**
21
22
  * @property {MessageDestination} messageDestination
22
23
  */
23
- export class BaseProvider {
24
+ export class BaseProvider extends BaseObject {
24
25
  /**
25
26
  * @return {string} identifier for environment options
26
27
  */
@@ -87,6 +88,7 @@ export class BaseProvider {
87
88
 
88
89
  static get attributes() {
89
90
  return {
91
+ ...super.attributes,
90
92
  /**
91
93
  * In case there are several provider able to support a given source which one sould be used ?
92
94
  * this defines the order
@@ -141,10 +143,6 @@ export class BaseProvider {
141
143
  }
142
144
  }
143
145
 
144
- constructor(options, properties) {
145
- definePropertiesFromOptions(this, options, properties);
146
- }
147
-
148
146
  /**
149
147
  * @return {boolean} true if other provider is the same as the receiver
150
148
  */
@@ -401,6 +399,11 @@ export class BaseProvider {
401
399
  return this.constructor.name;
402
400
  }
403
401
 
402
+ get fullName()
403
+ {
404
+ return this.name;
405
+ }
406
+
404
407
  /**
405
408
  * We are our own provider.
406
409
  * @return {BaseProvider} this