@paris-ias/trees 2.0.15 → 2.0.17
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/dist/form/actions.cjs.js +47 -9
- package/dist/form/actions.js +47 -9
- package/dist/form/affiliations.cjs.js +47 -9
- package/dist/form/affiliations.js +47 -9
- package/dist/form/apps.cjs.js +47 -9
- package/dist/form/apps.js +47 -9
- package/dist/form/disciplines.cjs.js +47 -9
- package/dist/form/disciplines.js +47 -9
- package/dist/form/events.cjs.js +47 -9
- package/dist/form/events.js +47 -9
- package/dist/form/fellowships.cjs.js +47 -9
- package/dist/form/fellowships.js +47 -9
- package/dist/form/files.cjs.js +47 -9
- package/dist/form/files.js +47 -9
- package/dist/form/mailing.cjs.js +47 -9
- package/dist/form/mailing.js +47 -9
- package/dist/form/news.cjs.js +47 -9
- package/dist/form/news.js +47 -9
- package/dist/form/people.cjs.js +47 -9
- package/dist/form/people.js +47 -9
- package/dist/form/projects.cjs.js +47 -9
- package/dist/form/projects.js +47 -9
- package/dist/form/publications.cjs.js +47 -9
- package/dist/form/publications.js +47 -9
- package/dist/form/tags.cjs.js +47 -9
- package/dist/form/tags.js +47 -9
- package/dist/form/users.cjs.js +47 -9
- package/dist/form/users.js +47 -9
- package/dist/graphql/schemas/schema.apex.graphql +38 -25
- package/dist/graphql/schemas/schema.website.graphql +37 -25
- package/dist/list/actions.cjs.js +49 -10
- package/dist/list/actions.js +49 -10
- package/dist/list/affiliations.cjs.js +49 -10
- package/dist/list/affiliations.js +49 -10
- package/dist/list/apps.cjs.js +49 -10
- package/dist/list/apps.js +49 -10
- package/dist/list/disciplines.cjs.js +49 -10
- package/dist/list/disciplines.js +49 -10
- package/dist/list/events.cjs.js +65 -18
- package/dist/list/events.js +65 -18
- package/dist/list/fellowships.cjs.js +55 -13
- package/dist/list/fellowships.js +55 -13
- package/dist/list/files.cjs.js +49 -10
- package/dist/list/files.js +49 -10
- package/dist/list/mailing.cjs.js +49 -10
- package/dist/list/mailing.js +49 -10
- package/dist/list/news.cjs.js +51 -11
- package/dist/list/news.js +51 -11
- package/dist/list/people.cjs.js +57 -14
- package/dist/list/people.js +57 -14
- package/dist/list/projects.cjs.js +51 -11
- package/dist/list/projects.js +51 -11
- package/dist/list/publications.cjs.js +55 -13
- package/dist/list/publications.js +55 -13
- package/dist/list/tags.cjs.js +49 -10
- package/dist/list/tags.js +49 -10
- package/dist/list/users.cjs.js +57 -14
- package/dist/list/users.js +57 -14
- package/package.json +1 -1
|
@@ -1,17 +1,55 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// Deep freeze utility to make exports immutable
|
|
4
|
-
const
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const lockAllBut = (obj, mutableKeys = []) => {
|
|
5
|
+
for (const key of Object.getOwnPropertyNames(obj)) {
|
|
6
|
+
if (mutableKeys.includes(key)) continue;
|
|
7
|
+
|
|
8
|
+
const desc = Object.getOwnPropertyDescriptor(obj, key);
|
|
9
|
+
if (!desc) continue;
|
|
10
|
+
|
|
11
|
+
if ("value" in desc) {
|
|
12
|
+
Object.defineProperty(obj, key, {
|
|
13
|
+
...desc,
|
|
14
|
+
writable: false,
|
|
15
|
+
configurable: false,
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
Object.defineProperty(obj, key, {
|
|
19
|
+
...desc,
|
|
20
|
+
configurable: false,
|
|
21
|
+
});
|
|
11
22
|
}
|
|
12
|
-
}
|
|
23
|
+
}
|
|
24
|
+
Object.preventExtensions(obj);
|
|
13
25
|
return obj;
|
|
14
26
|
};
|
|
27
|
+
const selectiveDeepFreeze = (obj, path = []) => {
|
|
28
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
29
|
+
|
|
30
|
+
if (Array.isArray(obj)) {
|
|
31
|
+
obj.forEach((v, i) => selectiveDeepFreeze(v, path.concat(String(i))));
|
|
32
|
+
return Object.freeze(obj);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const parentKey = path.length >= 1 ? path[path.length - 1] : null;
|
|
36
|
+
const grandParentKey = path.length >= 2 ? path[path.length - 2] : null;
|
|
37
|
+
|
|
38
|
+
const isFilterEntry = grandParentKey === "filters";
|
|
39
|
+
|
|
40
|
+
if (isFilterEntry) {
|
|
41
|
+
for (const k of Object.getOwnPropertyNames(obj)) {
|
|
42
|
+
if (k === "value") continue; // laisser value libre
|
|
43
|
+
selectiveDeepFreeze(obj[k], path.concat(parentKey, k));
|
|
44
|
+
}
|
|
45
|
+
return lockAllBut(obj, ["value"]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
for (const prop of Object.getOwnPropertyNames(obj)) {
|
|
49
|
+
selectiveDeepFreeze(obj[prop], path.concat(prop));
|
|
50
|
+
}
|
|
51
|
+
return Object.freeze(obj);
|
|
52
|
+
};
|
|
15
53
|
|
|
16
54
|
const data = {
|
|
17
55
|
"items": [
|
|
@@ -133,7 +171,8 @@ const data = {
|
|
|
133
171
|
"Ongoing": "ONGOING",
|
|
134
172
|
"Finished": "FINISHED",
|
|
135
173
|
"Cancelled": "CANCELLED"
|
|
136
|
-
}
|
|
174
|
+
},
|
|
175
|
+
"value": ""
|
|
137
176
|
},
|
|
138
177
|
"fellowshipType": {
|
|
139
178
|
"type": "Select",
|
|
@@ -142,16 +181,19 @@ const data = {
|
|
|
142
181
|
"ShortStay": "SHORT_STAY",
|
|
143
182
|
"LongStay": "LONG_STAY",
|
|
144
183
|
"InGroup": "IN_GROUP"
|
|
145
|
-
}
|
|
184
|
+
},
|
|
185
|
+
"value": ""
|
|
146
186
|
},
|
|
147
187
|
"affiliation": {
|
|
148
188
|
"type": "Select",
|
|
149
189
|
"multiple": true,
|
|
150
|
-
"items": []
|
|
190
|
+
"items": [],
|
|
191
|
+
"value": ""
|
|
151
192
|
},
|
|
152
193
|
"disciplines": {
|
|
153
194
|
"type": "Select",
|
|
154
|
-
"multiple": true
|
|
195
|
+
"multiple": true,
|
|
196
|
+
"value": ""
|
|
155
197
|
}
|
|
156
198
|
},
|
|
157
199
|
"limit": 20,
|
|
@@ -163,6 +205,6 @@ const data = {
|
|
|
163
205
|
]
|
|
164
206
|
};
|
|
165
207
|
|
|
166
|
-
var fellowships =
|
|
208
|
+
var fellowships = selectiveDeepFreeze(data);
|
|
167
209
|
|
|
168
210
|
module.exports = fellowships;
|
package/dist/list/fellowships.js
CHANGED
|
@@ -1,15 +1,53 @@
|
|
|
1
1
|
// Deep freeze utility to make exports immutable
|
|
2
|
-
const
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
const lockAllBut = (obj, mutableKeys = []) => {
|
|
3
|
+
for (const key of Object.getOwnPropertyNames(obj)) {
|
|
4
|
+
if (mutableKeys.includes(key)) continue;
|
|
5
|
+
|
|
6
|
+
const desc = Object.getOwnPropertyDescriptor(obj, key);
|
|
7
|
+
if (!desc) continue;
|
|
8
|
+
|
|
9
|
+
if ("value" in desc) {
|
|
10
|
+
Object.defineProperty(obj, key, {
|
|
11
|
+
...desc,
|
|
12
|
+
writable: false,
|
|
13
|
+
configurable: false,
|
|
14
|
+
});
|
|
15
|
+
} else {
|
|
16
|
+
Object.defineProperty(obj, key, {
|
|
17
|
+
...desc,
|
|
18
|
+
configurable: false,
|
|
19
|
+
});
|
|
9
20
|
}
|
|
10
|
-
}
|
|
21
|
+
}
|
|
22
|
+
Object.preventExtensions(obj);
|
|
11
23
|
return obj;
|
|
12
24
|
};
|
|
25
|
+
const selectiveDeepFreeze = (obj, path = []) => {
|
|
26
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
27
|
+
|
|
28
|
+
if (Array.isArray(obj)) {
|
|
29
|
+
obj.forEach((v, i) => selectiveDeepFreeze(v, path.concat(String(i))));
|
|
30
|
+
return Object.freeze(obj);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const parentKey = path.length >= 1 ? path[path.length - 1] : null;
|
|
34
|
+
const grandParentKey = path.length >= 2 ? path[path.length - 2] : null;
|
|
35
|
+
|
|
36
|
+
const isFilterEntry = grandParentKey === "filters";
|
|
37
|
+
|
|
38
|
+
if (isFilterEntry) {
|
|
39
|
+
for (const k of Object.getOwnPropertyNames(obj)) {
|
|
40
|
+
if (k === "value") continue; // laisser value libre
|
|
41
|
+
selectiveDeepFreeze(obj[k], path.concat(parentKey, k));
|
|
42
|
+
}
|
|
43
|
+
return lockAllBut(obj, ["value"]);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (const prop of Object.getOwnPropertyNames(obj)) {
|
|
47
|
+
selectiveDeepFreeze(obj[prop], path.concat(prop));
|
|
48
|
+
}
|
|
49
|
+
return Object.freeze(obj);
|
|
50
|
+
};
|
|
13
51
|
|
|
14
52
|
const data = {
|
|
15
53
|
"items": [
|
|
@@ -131,7 +169,8 @@ const data = {
|
|
|
131
169
|
"Ongoing": "ONGOING",
|
|
132
170
|
"Finished": "FINISHED",
|
|
133
171
|
"Cancelled": "CANCELLED"
|
|
134
|
-
}
|
|
172
|
+
},
|
|
173
|
+
"value": ""
|
|
135
174
|
},
|
|
136
175
|
"fellowshipType": {
|
|
137
176
|
"type": "Select",
|
|
@@ -140,16 +179,19 @@ const data = {
|
|
|
140
179
|
"ShortStay": "SHORT_STAY",
|
|
141
180
|
"LongStay": "LONG_STAY",
|
|
142
181
|
"InGroup": "IN_GROUP"
|
|
143
|
-
}
|
|
182
|
+
},
|
|
183
|
+
"value": ""
|
|
144
184
|
},
|
|
145
185
|
"affiliation": {
|
|
146
186
|
"type": "Select",
|
|
147
187
|
"multiple": true,
|
|
148
|
-
"items": []
|
|
188
|
+
"items": [],
|
|
189
|
+
"value": ""
|
|
149
190
|
},
|
|
150
191
|
"disciplines": {
|
|
151
192
|
"type": "Select",
|
|
152
|
-
"multiple": true
|
|
193
|
+
"multiple": true,
|
|
194
|
+
"value": ""
|
|
153
195
|
}
|
|
154
196
|
},
|
|
155
197
|
"limit": 20,
|
|
@@ -161,6 +203,6 @@ const data = {
|
|
|
161
203
|
]
|
|
162
204
|
};
|
|
163
205
|
|
|
164
|
-
var fellowships =
|
|
206
|
+
var fellowships = selectiveDeepFreeze(data);
|
|
165
207
|
|
|
166
208
|
export { fellowships as default };
|
package/dist/list/files.cjs.js
CHANGED
|
@@ -1,17 +1,55 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// Deep freeze utility to make exports immutable
|
|
4
|
-
const
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const lockAllBut = (obj, mutableKeys = []) => {
|
|
5
|
+
for (const key of Object.getOwnPropertyNames(obj)) {
|
|
6
|
+
if (mutableKeys.includes(key)) continue;
|
|
7
|
+
|
|
8
|
+
const desc = Object.getOwnPropertyDescriptor(obj, key);
|
|
9
|
+
if (!desc) continue;
|
|
10
|
+
|
|
11
|
+
if ("value" in desc) {
|
|
12
|
+
Object.defineProperty(obj, key, {
|
|
13
|
+
...desc,
|
|
14
|
+
writable: false,
|
|
15
|
+
configurable: false,
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
Object.defineProperty(obj, key, {
|
|
19
|
+
...desc,
|
|
20
|
+
configurable: false,
|
|
21
|
+
});
|
|
11
22
|
}
|
|
12
|
-
}
|
|
23
|
+
}
|
|
24
|
+
Object.preventExtensions(obj);
|
|
13
25
|
return obj;
|
|
14
26
|
};
|
|
27
|
+
const selectiveDeepFreeze = (obj, path = []) => {
|
|
28
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
29
|
+
|
|
30
|
+
if (Array.isArray(obj)) {
|
|
31
|
+
obj.forEach((v, i) => selectiveDeepFreeze(v, path.concat(String(i))));
|
|
32
|
+
return Object.freeze(obj);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const parentKey = path.length >= 1 ? path[path.length - 1] : null;
|
|
36
|
+
const grandParentKey = path.length >= 2 ? path[path.length - 2] : null;
|
|
37
|
+
|
|
38
|
+
const isFilterEntry = grandParentKey === "filters";
|
|
39
|
+
|
|
40
|
+
if (isFilterEntry) {
|
|
41
|
+
for (const k of Object.getOwnPropertyNames(obj)) {
|
|
42
|
+
if (k === "value") continue; // laisser value libre
|
|
43
|
+
selectiveDeepFreeze(obj[k], path.concat(parentKey, k));
|
|
44
|
+
}
|
|
45
|
+
return lockAllBut(obj, ["value"]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
for (const prop of Object.getOwnPropertyNames(obj)) {
|
|
49
|
+
selectiveDeepFreeze(obj[prop], path.concat(prop));
|
|
50
|
+
}
|
|
51
|
+
return Object.freeze(obj);
|
|
52
|
+
};
|
|
15
53
|
|
|
16
54
|
const data = {
|
|
17
55
|
"items": [
|
|
@@ -134,7 +172,8 @@ const data = {
|
|
|
134
172
|
},
|
|
135
173
|
"filters": {
|
|
136
174
|
"year": {
|
|
137
|
-
"type": "Select"
|
|
175
|
+
"type": "Select",
|
|
176
|
+
"value": ""
|
|
138
177
|
}
|
|
139
178
|
},
|
|
140
179
|
"limit": 20,
|
|
@@ -146,6 +185,6 @@ const data = {
|
|
|
146
185
|
]
|
|
147
186
|
};
|
|
148
187
|
|
|
149
|
-
var files =
|
|
188
|
+
var files = selectiveDeepFreeze(data);
|
|
150
189
|
|
|
151
190
|
module.exports = files;
|
package/dist/list/files.js
CHANGED
|
@@ -1,15 +1,53 @@
|
|
|
1
1
|
// Deep freeze utility to make exports immutable
|
|
2
|
-
const
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
const lockAllBut = (obj, mutableKeys = []) => {
|
|
3
|
+
for (const key of Object.getOwnPropertyNames(obj)) {
|
|
4
|
+
if (mutableKeys.includes(key)) continue;
|
|
5
|
+
|
|
6
|
+
const desc = Object.getOwnPropertyDescriptor(obj, key);
|
|
7
|
+
if (!desc) continue;
|
|
8
|
+
|
|
9
|
+
if ("value" in desc) {
|
|
10
|
+
Object.defineProperty(obj, key, {
|
|
11
|
+
...desc,
|
|
12
|
+
writable: false,
|
|
13
|
+
configurable: false,
|
|
14
|
+
});
|
|
15
|
+
} else {
|
|
16
|
+
Object.defineProperty(obj, key, {
|
|
17
|
+
...desc,
|
|
18
|
+
configurable: false,
|
|
19
|
+
});
|
|
9
20
|
}
|
|
10
|
-
}
|
|
21
|
+
}
|
|
22
|
+
Object.preventExtensions(obj);
|
|
11
23
|
return obj;
|
|
12
24
|
};
|
|
25
|
+
const selectiveDeepFreeze = (obj, path = []) => {
|
|
26
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
27
|
+
|
|
28
|
+
if (Array.isArray(obj)) {
|
|
29
|
+
obj.forEach((v, i) => selectiveDeepFreeze(v, path.concat(String(i))));
|
|
30
|
+
return Object.freeze(obj);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const parentKey = path.length >= 1 ? path[path.length - 1] : null;
|
|
34
|
+
const grandParentKey = path.length >= 2 ? path[path.length - 2] : null;
|
|
35
|
+
|
|
36
|
+
const isFilterEntry = grandParentKey === "filters";
|
|
37
|
+
|
|
38
|
+
if (isFilterEntry) {
|
|
39
|
+
for (const k of Object.getOwnPropertyNames(obj)) {
|
|
40
|
+
if (k === "value") continue; // laisser value libre
|
|
41
|
+
selectiveDeepFreeze(obj[k], path.concat(parentKey, k));
|
|
42
|
+
}
|
|
43
|
+
return lockAllBut(obj, ["value"]);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (const prop of Object.getOwnPropertyNames(obj)) {
|
|
47
|
+
selectiveDeepFreeze(obj[prop], path.concat(prop));
|
|
48
|
+
}
|
|
49
|
+
return Object.freeze(obj);
|
|
50
|
+
};
|
|
13
51
|
|
|
14
52
|
const data = {
|
|
15
53
|
"items": [
|
|
@@ -132,7 +170,8 @@ const data = {
|
|
|
132
170
|
},
|
|
133
171
|
"filters": {
|
|
134
172
|
"year": {
|
|
135
|
-
"type": "Select"
|
|
173
|
+
"type": "Select",
|
|
174
|
+
"value": ""
|
|
136
175
|
}
|
|
137
176
|
},
|
|
138
177
|
"limit": 20,
|
|
@@ -144,6 +183,6 @@ const data = {
|
|
|
144
183
|
]
|
|
145
184
|
};
|
|
146
185
|
|
|
147
|
-
var files =
|
|
186
|
+
var files = selectiveDeepFreeze(data);
|
|
148
187
|
|
|
149
188
|
export { files as default };
|
package/dist/list/mailing.cjs.js
CHANGED
|
@@ -1,17 +1,55 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// Deep freeze utility to make exports immutable
|
|
4
|
-
const
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const lockAllBut = (obj, mutableKeys = []) => {
|
|
5
|
+
for (const key of Object.getOwnPropertyNames(obj)) {
|
|
6
|
+
if (mutableKeys.includes(key)) continue;
|
|
7
|
+
|
|
8
|
+
const desc = Object.getOwnPropertyDescriptor(obj, key);
|
|
9
|
+
if (!desc) continue;
|
|
10
|
+
|
|
11
|
+
if ("value" in desc) {
|
|
12
|
+
Object.defineProperty(obj, key, {
|
|
13
|
+
...desc,
|
|
14
|
+
writable: false,
|
|
15
|
+
configurable: false,
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
Object.defineProperty(obj, key, {
|
|
19
|
+
...desc,
|
|
20
|
+
configurable: false,
|
|
21
|
+
});
|
|
11
22
|
}
|
|
12
|
-
}
|
|
23
|
+
}
|
|
24
|
+
Object.preventExtensions(obj);
|
|
13
25
|
return obj;
|
|
14
26
|
};
|
|
27
|
+
const selectiveDeepFreeze = (obj, path = []) => {
|
|
28
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
29
|
+
|
|
30
|
+
if (Array.isArray(obj)) {
|
|
31
|
+
obj.forEach((v, i) => selectiveDeepFreeze(v, path.concat(String(i))));
|
|
32
|
+
return Object.freeze(obj);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const parentKey = path.length >= 1 ? path[path.length - 1] : null;
|
|
36
|
+
const grandParentKey = path.length >= 2 ? path[path.length - 2] : null;
|
|
37
|
+
|
|
38
|
+
const isFilterEntry = grandParentKey === "filters";
|
|
39
|
+
|
|
40
|
+
if (isFilterEntry) {
|
|
41
|
+
for (const k of Object.getOwnPropertyNames(obj)) {
|
|
42
|
+
if (k === "value") continue; // laisser value libre
|
|
43
|
+
selectiveDeepFreeze(obj[k], path.concat(parentKey, k));
|
|
44
|
+
}
|
|
45
|
+
return lockAllBut(obj, ["value"]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
for (const prop of Object.getOwnPropertyNames(obj)) {
|
|
49
|
+
selectiveDeepFreeze(obj[prop], path.concat(prop));
|
|
50
|
+
}
|
|
51
|
+
return Object.freeze(obj);
|
|
52
|
+
};
|
|
15
53
|
|
|
16
54
|
const data = {
|
|
17
55
|
"items": [
|
|
@@ -134,7 +172,8 @@ const data = {
|
|
|
134
172
|
},
|
|
135
173
|
"filters": {
|
|
136
174
|
"year": {
|
|
137
|
-
"type": "Select"
|
|
175
|
+
"type": "Select",
|
|
176
|
+
"value": ""
|
|
138
177
|
}
|
|
139
178
|
},
|
|
140
179
|
"limit": 20,
|
|
@@ -146,6 +185,6 @@ const data = {
|
|
|
146
185
|
]
|
|
147
186
|
};
|
|
148
187
|
|
|
149
|
-
var mailing =
|
|
188
|
+
var mailing = selectiveDeepFreeze(data);
|
|
150
189
|
|
|
151
190
|
module.exports = mailing;
|
package/dist/list/mailing.js
CHANGED
|
@@ -1,15 +1,53 @@
|
|
|
1
1
|
// Deep freeze utility to make exports immutable
|
|
2
|
-
const
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
const lockAllBut = (obj, mutableKeys = []) => {
|
|
3
|
+
for (const key of Object.getOwnPropertyNames(obj)) {
|
|
4
|
+
if (mutableKeys.includes(key)) continue;
|
|
5
|
+
|
|
6
|
+
const desc = Object.getOwnPropertyDescriptor(obj, key);
|
|
7
|
+
if (!desc) continue;
|
|
8
|
+
|
|
9
|
+
if ("value" in desc) {
|
|
10
|
+
Object.defineProperty(obj, key, {
|
|
11
|
+
...desc,
|
|
12
|
+
writable: false,
|
|
13
|
+
configurable: false,
|
|
14
|
+
});
|
|
15
|
+
} else {
|
|
16
|
+
Object.defineProperty(obj, key, {
|
|
17
|
+
...desc,
|
|
18
|
+
configurable: false,
|
|
19
|
+
});
|
|
9
20
|
}
|
|
10
|
-
}
|
|
21
|
+
}
|
|
22
|
+
Object.preventExtensions(obj);
|
|
11
23
|
return obj;
|
|
12
24
|
};
|
|
25
|
+
const selectiveDeepFreeze = (obj, path = []) => {
|
|
26
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
27
|
+
|
|
28
|
+
if (Array.isArray(obj)) {
|
|
29
|
+
obj.forEach((v, i) => selectiveDeepFreeze(v, path.concat(String(i))));
|
|
30
|
+
return Object.freeze(obj);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const parentKey = path.length >= 1 ? path[path.length - 1] : null;
|
|
34
|
+
const grandParentKey = path.length >= 2 ? path[path.length - 2] : null;
|
|
35
|
+
|
|
36
|
+
const isFilterEntry = grandParentKey === "filters";
|
|
37
|
+
|
|
38
|
+
if (isFilterEntry) {
|
|
39
|
+
for (const k of Object.getOwnPropertyNames(obj)) {
|
|
40
|
+
if (k === "value") continue; // laisser value libre
|
|
41
|
+
selectiveDeepFreeze(obj[k], path.concat(parentKey, k));
|
|
42
|
+
}
|
|
43
|
+
return lockAllBut(obj, ["value"]);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (const prop of Object.getOwnPropertyNames(obj)) {
|
|
47
|
+
selectiveDeepFreeze(obj[prop], path.concat(prop));
|
|
48
|
+
}
|
|
49
|
+
return Object.freeze(obj);
|
|
50
|
+
};
|
|
13
51
|
|
|
14
52
|
const data = {
|
|
15
53
|
"items": [
|
|
@@ -132,7 +170,8 @@ const data = {
|
|
|
132
170
|
},
|
|
133
171
|
"filters": {
|
|
134
172
|
"year": {
|
|
135
|
-
"type": "Select"
|
|
173
|
+
"type": "Select",
|
|
174
|
+
"value": ""
|
|
136
175
|
}
|
|
137
176
|
},
|
|
138
177
|
"limit": 20,
|
|
@@ -144,6 +183,6 @@ const data = {
|
|
|
144
183
|
]
|
|
145
184
|
};
|
|
146
185
|
|
|
147
|
-
var mailing =
|
|
186
|
+
var mailing = selectiveDeepFreeze(data);
|
|
148
187
|
|
|
149
188
|
export { mailing as default };
|
package/dist/list/news.cjs.js
CHANGED
|
@@ -1,17 +1,55 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// Deep freeze utility to make exports immutable
|
|
4
|
-
const
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const lockAllBut = (obj, mutableKeys = []) => {
|
|
5
|
+
for (const key of Object.getOwnPropertyNames(obj)) {
|
|
6
|
+
if (mutableKeys.includes(key)) continue;
|
|
7
|
+
|
|
8
|
+
const desc = Object.getOwnPropertyDescriptor(obj, key);
|
|
9
|
+
if (!desc) continue;
|
|
10
|
+
|
|
11
|
+
if ("value" in desc) {
|
|
12
|
+
Object.defineProperty(obj, key, {
|
|
13
|
+
...desc,
|
|
14
|
+
writable: false,
|
|
15
|
+
configurable: false,
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
Object.defineProperty(obj, key, {
|
|
19
|
+
...desc,
|
|
20
|
+
configurable: false,
|
|
21
|
+
});
|
|
11
22
|
}
|
|
12
|
-
}
|
|
23
|
+
}
|
|
24
|
+
Object.preventExtensions(obj);
|
|
13
25
|
return obj;
|
|
14
26
|
};
|
|
27
|
+
const selectiveDeepFreeze = (obj, path = []) => {
|
|
28
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
29
|
+
|
|
30
|
+
if (Array.isArray(obj)) {
|
|
31
|
+
obj.forEach((v, i) => selectiveDeepFreeze(v, path.concat(String(i))));
|
|
32
|
+
return Object.freeze(obj);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const parentKey = path.length >= 1 ? path[path.length - 1] : null;
|
|
36
|
+
const grandParentKey = path.length >= 2 ? path[path.length - 2] : null;
|
|
37
|
+
|
|
38
|
+
const isFilterEntry = grandParentKey === "filters";
|
|
39
|
+
|
|
40
|
+
if (isFilterEntry) {
|
|
41
|
+
for (const k of Object.getOwnPropertyNames(obj)) {
|
|
42
|
+
if (k === "value") continue; // laisser value libre
|
|
43
|
+
selectiveDeepFreeze(obj[k], path.concat(parentKey, k));
|
|
44
|
+
}
|
|
45
|
+
return lockAllBut(obj, ["value"]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
for (const prop of Object.getOwnPropertyNames(obj)) {
|
|
49
|
+
selectiveDeepFreeze(obj[prop], path.concat(prop));
|
|
50
|
+
}
|
|
51
|
+
return Object.freeze(obj);
|
|
52
|
+
};
|
|
15
53
|
|
|
16
54
|
const data = {
|
|
17
55
|
"items": [
|
|
@@ -111,7 +149,8 @@ const data = {
|
|
|
111
149
|
"filters": {
|
|
112
150
|
"tags": {
|
|
113
151
|
"type": "AutoComplete",
|
|
114
|
-
"multiple": true
|
|
152
|
+
"multiple": true,
|
|
153
|
+
"value": ""
|
|
115
154
|
},
|
|
116
155
|
"category": {
|
|
117
156
|
"type": "Select",
|
|
@@ -137,7 +176,8 @@ const data = {
|
|
|
137
176
|
"Publication": "PUBLICATION",
|
|
138
177
|
"Video": "VIDEO",
|
|
139
178
|
"Audio": "AUDIO"
|
|
140
|
-
}
|
|
179
|
+
},
|
|
180
|
+
"value": ""
|
|
141
181
|
}
|
|
142
182
|
},
|
|
143
183
|
"limit": 20,
|
|
@@ -149,6 +189,6 @@ const data = {
|
|
|
149
189
|
]
|
|
150
190
|
};
|
|
151
191
|
|
|
152
|
-
var news =
|
|
192
|
+
var news = selectiveDeepFreeze(data);
|
|
153
193
|
|
|
154
194
|
module.exports = news;
|