repository-provider 32.3.1 → 32.3.3
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 +5 -5
- package/src/attribute.mjs +20 -7
- package/src/base-object.mjs +6 -10
- package/src/owned-object.mjs +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repository-provider",
|
|
3
|
-
"version": "32.3.
|
|
3
|
+
"version": "32.3.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"ava": "^5.1.0",
|
|
38
|
-
"browser-ava": "^1.3.
|
|
38
|
+
"browser-ava": "^1.3.12",
|
|
39
39
|
"c8": "^7.12.0",
|
|
40
|
-
"documentation": "^14.0.
|
|
41
|
-
"repository-provider-test-support": "^2.2.
|
|
40
|
+
"documentation": "^14.0.1",
|
|
41
|
+
"repository-provider-test-support": "^2.2.21",
|
|
42
42
|
"semantic-release": "^19.0.5",
|
|
43
|
-
"typescript": "^4.
|
|
43
|
+
"typescript": "^4.9.4"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=16.18.1"
|
package/src/attribute.mjs
CHANGED
|
@@ -143,17 +143,30 @@ export function defaultValues(attributes, object) {
|
|
|
143
143
|
* @param {any} value
|
|
144
144
|
*/
|
|
145
145
|
export function setAttribute(object, name, value) {
|
|
146
|
-
const parts = name.split(/\./);
|
|
147
|
-
const last = parts.pop();
|
|
148
146
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
147
|
+
let lastObject = object;
|
|
148
|
+
let lastKey;
|
|
149
|
+
|
|
150
|
+
for (const token of tokens(name)) {
|
|
151
|
+
switch (token) {
|
|
152
|
+
case ".":
|
|
153
|
+
case "[":
|
|
154
|
+
case "]":
|
|
155
|
+
break;
|
|
156
|
+
|
|
157
|
+
default:
|
|
158
|
+
if (object[token] === undefined || typeof object[token] !== "object") {
|
|
159
|
+
object[token] = {};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
lastObject = object;
|
|
163
|
+
lastKey = token;
|
|
164
|
+
|
|
165
|
+
object = object[token];
|
|
152
166
|
}
|
|
153
|
-
object = object[p];
|
|
154
167
|
}
|
|
155
168
|
|
|
156
|
-
|
|
169
|
+
lastObject[lastKey] = value;
|
|
157
170
|
}
|
|
158
171
|
|
|
159
172
|
/**
|
package/src/base-object.mjs
CHANGED
|
@@ -13,6 +13,10 @@ export class BaseObject {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
+
* ```
|
|
17
|
+
* Tag -> tags
|
|
18
|
+
* Repository -> repositories
|
|
19
|
+
* ```
|
|
16
20
|
* @return {string} name of the collection holding us in the owner
|
|
17
21
|
*/
|
|
18
22
|
static get collectionName() {
|
|
@@ -21,6 +25,7 @@ export class BaseObject {
|
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
27
|
* Attributes definitions
|
|
28
|
+
* @return {Object}
|
|
24
29
|
*/
|
|
25
30
|
static get attributes() {
|
|
26
31
|
return {
|
|
@@ -150,16 +155,7 @@ export class BaseObject {
|
|
|
150
155
|
get provider() {
|
|
151
156
|
return this.owner.provider;
|
|
152
157
|
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* API as given by the owner.
|
|
156
|
-
* @return {string} url
|
|
157
|
-
*/
|
|
158
|
-
get api() {
|
|
159
|
-
// TODO move into owner-object
|
|
160
|
-
return this.owner?.api;
|
|
161
|
-
}
|
|
162
|
-
|
|
158
|
+
|
|
163
159
|
/**
|
|
164
160
|
* Forwarded to the owner.
|
|
165
161
|
* @param {...any} args
|
package/src/owned-object.mjs
CHANGED
|
@@ -30,4 +30,12 @@ export class OwnedObject extends NamedObject {
|
|
|
30
30
|
equals(other) {
|
|
31
31
|
return super.equals(other) && this.owner.equals(other.owner);
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* API as given by the owner.
|
|
36
|
+
* @return {string} url
|
|
37
|
+
*/
|
|
38
|
+
get api() {
|
|
39
|
+
return this.owner.api;
|
|
40
|
+
}
|
|
33
41
|
}
|