repository-provider 26.7.6 → 27.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
@@ -198,13 +198,14 @@ console.log(await readme.getString());
198
198
  * [equals](#equals-3)
199
199
  * [Parameters](#parameters-50)
200
200
  * [displayName](#displayname)
201
+ * [fullName](#fullname-1)
201
202
  * [toJSON](#tojson-2)
202
203
  * [Project](#project)
203
204
  * [Parameters](#parameters-51)
204
205
  * [PullRequest](#pullrequest)
205
206
  * [Parameters](#parameters-52)
206
207
  * [Properties](#properties-7)
207
- * [fullName](#fullname-1)
208
+ * [fullName](#fullname-2)
208
209
  * [url](#url-2)
209
210
  * [repository](#repository-1)
210
211
  * [provider](#provider-2)
@@ -246,7 +247,7 @@ console.log(await readme.getString());
246
247
  * [entry](#entry)
247
248
  * [Parameters](#parameters-62)
248
249
  * [owner](#owner)
249
- * [fullName](#fullname-2)
250
+ * [fullName](#fullname-3)
250
251
  * [fullCondensedName](#fullcondensedname)
251
252
  * [identifier](#identifier-1)
252
253
  * [issuesURL](#issuesurl)
@@ -261,7 +262,6 @@ console.log(await readme.getString());
261
262
  * [RepositoryGroup](#repositorygroup-1)
262
263
  * [Parameters](#parameters-63)
263
264
  * [Properties](#properties-9)
264
- * [fullName](#fullname-3)
265
265
  * [attributeMapping](#attributemapping-1)
266
266
  * [type](#type)
267
267
  * [url](#url-3)
@@ -374,8 +374,11 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
374
374
  * `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
375
375
  * `writable` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**
376
376
  * `private` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** should the value be shown
377
+ * `depends` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** name of an attribute we depend on
377
378
  * `description` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
378
379
  * `default` **any?** the default value
380
+ * `set` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** set the value
381
+ * `get` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** get the value can be used to calculate default values
379
382
  * `env` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>)?** environment variable use to provide the value
380
383
 
381
384
  ## definePropertiesFromOptions
@@ -1181,7 +1184,7 @@ Check for equality.
1181
1184
 
1182
1185
  * `other` **[NamedObject](#namedobject)**
1183
1186
 
1184
- Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if names are equal
1187
+ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if names are equal and have the same owner
1185
1188
 
1186
1189
  ### displayName
1187
1190
 
@@ -1189,6 +1192,10 @@ Beautified name use for human displaying only.
1189
1192
 
1190
1193
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** human readable name
1191
1194
 
1195
+ ### fullName
1196
+
1197
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name with owner name
1198
+
1192
1199
  ### toJSON
1193
1200
 
1194
1201
  Provide name and all defined attributes.
@@ -1555,10 +1562,6 @@ Abstract repository collection.
1555
1562
  * `provider` **[BaseProvider](#baseprovider)**
1556
1563
  * `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
1557
1564
 
1558
- ### fullName
1559
-
1560
- Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name with owner name
1561
-
1562
1565
  ### attributeMapping
1563
1566
 
1564
1567
  Map attributes between external and internal representation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "26.7.6",
3
+ "version": "27.0.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -30,15 +30,15 @@
30
30
  "lint:tsc": "tsc --allowJs --checkJs --noEmit -module nodenext -t es2022 ./src/*.mjs"
31
31
  },
32
32
  "dependencies": {
33
- "matching-iterator": "^2.0.2"
33
+ "matching-iterator": "^2.0.3"
34
34
  },
35
35
  "devDependencies": {
36
36
  "ava": "^4.0.1",
37
37
  "c8": "^7.11.0",
38
38
  "documentation": "^13.2.5",
39
- "repository-provider-test-support": "^1.12.6",
39
+ "repository-provider-test-support": "^1.12.7",
40
40
  "semantic-release": "^19.0.2",
41
- "typescript": "^4.6.0-dev.20220209"
41
+ "typescript": "^4.7.0-dev.20220223"
42
42
  },
43
43
  "engines": {
44
44
  "node": ">=14.18.3"
package/src/attribute.mjs CHANGED
@@ -4,8 +4,11 @@
4
4
  * @property {string} type
5
5
  * @property {boolean} writable
6
6
  * @property {boolean} [private] should the value be shown
7
+ * @property {string} [depends] name of an attribute we depend on
7
8
  * @property {string} description
8
9
  * @property {any} [default] the default value
10
+ * @property {Function} [set] set the value
11
+ * @property {Function} [get] get the value can be used to calculate default values
9
12
  * @property {string|string[]} [env] environment variable use to provide the value
10
13
  */
11
14
 
@@ -48,8 +51,8 @@ export function definePropertiesFromOptions(
48
51
  let value = getAttribute(options, name);
49
52
 
50
53
  if (value === undefined) {
51
- if (attribute.getDefault) {
52
- value = attribute.getDefault(attribute, object, properties);
54
+ if (attribute.get) {
55
+ value = attribute.get(attribute, object, properties);
53
56
  } else if (
54
57
  attribute.default !== undefined &&
55
58
  attribute.default !== getAttribute(object, name)
@@ -115,8 +118,11 @@ export function defaultValues(attributes, object) {
115
118
 
116
119
  if (attribute.default !== undefined) {
117
120
  a.push([name, attribute.default]);
118
- } else if (attribute.getDefault !== undefined) {
119
- a.push([name, attribute.getDefault(attribute, object)]);
121
+ } else if (attribute.get !== undefined) {
122
+ const value = attribute.get(attribute, object);
123
+ if(value !== undefined) {
124
+ a.push([name, value]);
125
+ }
120
126
  }
121
127
 
122
128
  return a;
@@ -20,7 +20,7 @@ export class NamedObject extends BaseObject {
20
20
  /**
21
21
  * Check for equality.
22
22
  * @param {NamedObject} other
23
- * @return {boolean} true if names are equal
23
+ * @return {boolean} true if names are equal and have the same owner
24
24
  */
25
25
  equals(other) {
26
26
  return super.equals(other) && this.name === other.name;