pacc 10.3.0 → 10.4.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/package.json
CHANGED
|
@@ -51,6 +51,14 @@ export const default_attribute_writable = {
|
|
|
51
51
|
writable: true
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* @type {AttributeDefinition}
|
|
56
|
+
*/
|
|
57
|
+
export const default_collection_attribute = {
|
|
58
|
+
...default_attribute,
|
|
59
|
+
collection: true
|
|
60
|
+
};
|
|
61
|
+
|
|
54
62
|
/**
|
|
55
63
|
* @type {AttributeDefinition}
|
|
56
64
|
*/
|
package/src/extract.mjs
CHANGED
|
@@ -19,19 +19,18 @@ export function extract(object, type = object.constructor) {
|
|
|
19
19
|
result[name] = value;
|
|
20
20
|
}
|
|
21
21
|
} else {
|
|
22
|
-
const key = value.constructor.key;
|
|
23
|
-
|
|
24
22
|
if (attribute.backpointer) {
|
|
25
23
|
if (attribute.collection) {
|
|
26
24
|
if ((value.size ?? value.length) > 0) {
|
|
27
25
|
result[name] = Object.fromEntries(
|
|
28
|
-
[...value.values()].map(v => [v[key], v])
|
|
26
|
+
[...value.values()].map(v => [v[v.constructor.key], extract(v)])
|
|
29
27
|
);
|
|
30
28
|
}
|
|
31
29
|
} else {
|
|
32
30
|
result[name] = extract(value);
|
|
33
31
|
}
|
|
34
32
|
} else {
|
|
33
|
+
const key = value.constructor.key;
|
|
35
34
|
result[name] = { [key]: value[key], type: value.constructor.name };
|
|
36
35
|
}
|
|
37
36
|
}
|
|
@@ -34,6 +34,10 @@ export const default_attribute: AttributeDefinition;
|
|
|
34
34
|
* @type {AttributeDefinition}
|
|
35
35
|
*/
|
|
36
36
|
export const default_attribute_writable: AttributeDefinition;
|
|
37
|
+
/**
|
|
38
|
+
* @type {AttributeDefinition}
|
|
39
|
+
*/
|
|
40
|
+
export const default_collection_attribute: AttributeDefinition;
|
|
37
41
|
/**
|
|
38
42
|
* @type {AttributeDefinition}
|
|
39
43
|
*/
|