@eluvio/elv-client-js 3.1.77 → 3.1.81
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/ElvClient-min.js +2 -2
- package/dist/ElvClient-node-min.js +3 -3
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/src/AuthorizationClient.js +175 -142
- package/dist/src/ElvClient.js +12 -7
- package/dist/src/UserProfileClient.js +19 -12
- package/dist/src/client/ContentAccess.js +68 -58
- package/dist/src/client/ContentManagement.js +40 -17
- package/package-lock.json +1 -1
- package/package.json +1 -1
- package/src/AuthorizationClient.js +19 -1
- package/src/ElvClient.js +11 -5
- package/src/UserProfileClient.js +14 -6
- package/src/client/ContentAccess.js +28 -17
- package/src/client/ContentManagement.js +11 -0
- package/testScripts/CreateABRMezzanine.js +0 -1
- package/testScripts/OfferingRemoveDash.js +49 -0
- package/typeSpecs/DropEventSite.js +308 -105
- package/typeSpecs/EventTenant.js +1 -1
- package/typeSpecs/Marketplace.js +234 -148
- package/typeSpecs/NFTTemplate.js +26 -4
- package/typeSpecs/UpdateTypes.js +92 -0
- package/utilities/ChannelGetTestUrls.js +179 -0
- package/utilities/MezzanineCreate.js +0 -1
- package/typeSpecs/EventSite.js +0 -803
- package/utilities/ChannelGetLiveUrls.js +0 -136
package/typeSpecs/EventTenant.js
CHANGED
package/typeSpecs/Marketplace.js
CHANGED
|
@@ -4,7 +4,7 @@ const currencyOptions = [...new Set(Object.values(require("country-codes-list").
|
|
|
4
4
|
const MarketplaceSpec = {
|
|
5
5
|
"profile": {
|
|
6
6
|
"name": "Eluvio LIVE Marketplace",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.3",
|
|
8
8
|
},
|
|
9
9
|
"manageApp": "default",
|
|
10
10
|
"hide_image_tab": true,
|
|
@@ -17,50 +17,234 @@ const MarketplaceSpec = {
|
|
|
17
17
|
"controls": [],
|
|
18
18
|
"associated_assets": [],
|
|
19
19
|
"info_fields": [
|
|
20
|
+
{
|
|
21
|
+
"label": "Branding and Customization",
|
|
22
|
+
"name": "header_branding",
|
|
23
|
+
"type": "header"
|
|
24
|
+
},
|
|
20
25
|
{
|
|
21
26
|
"name": "tenant_id",
|
|
22
27
|
"label": "Tenant ID",
|
|
23
28
|
"type": "Text"
|
|
24
29
|
},
|
|
25
30
|
{
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
"name": "branding",
|
|
32
|
+
"type": "subsection",
|
|
33
|
+
"fields": [
|
|
34
|
+
{
|
|
35
|
+
"name": "name",
|
|
36
|
+
"type": "text"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "subheader",
|
|
40
|
+
"type": "text",
|
|
41
|
+
"default_value": "Marketplace"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "description",
|
|
45
|
+
"type": "textarea"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "round_logo",
|
|
49
|
+
"extensions": imageTypes,
|
|
50
|
+
"type": "file",
|
|
51
|
+
"hint": "This logo will be displayed in the list of available marketplaces"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "card_banner",
|
|
55
|
+
"extensions": imageTypes,
|
|
56
|
+
"type": "file",
|
|
57
|
+
"hint": "This banner will be displayed in the list of available marketplaces. It should be roughly 16:10 aspect ratio."
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "tags",
|
|
61
|
+
"type": "multiselect",
|
|
62
|
+
"hint": "These tags will be used to help users discover your marketplace based on their interests.",
|
|
63
|
+
"options": [
|
|
64
|
+
"Film",
|
|
65
|
+
"Music",
|
|
66
|
+
"Software",
|
|
67
|
+
"TV"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "color_scheme",
|
|
72
|
+
"type": "select",
|
|
73
|
+
"default_value": "Light",
|
|
74
|
+
"options": [
|
|
75
|
+
"Light",
|
|
76
|
+
"Dark",
|
|
77
|
+
"User Preference"
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "font",
|
|
82
|
+
"type": "select",
|
|
83
|
+
"options": [
|
|
84
|
+
"Helvetica Neue",
|
|
85
|
+
"Inter",
|
|
86
|
+
"Selawik"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
]
|
|
39
90
|
},
|
|
40
91
|
{
|
|
92
|
+
"name": "login_customization",
|
|
93
|
+
"label": "Login Customization",
|
|
94
|
+
"type": "subsection",
|
|
41
95
|
"fields": [
|
|
42
96
|
{
|
|
43
|
-
"
|
|
97
|
+
"label": "Login Page Logo",
|
|
44
98
|
"name": "logo",
|
|
45
|
-
"type": "file"
|
|
99
|
+
"type": "file",
|
|
100
|
+
"extensions": imageTypes
|
|
46
101
|
},
|
|
47
102
|
{
|
|
48
|
-
"
|
|
49
|
-
"name": "
|
|
50
|
-
"type": "file"
|
|
103
|
+
"label": "Login Page Background",
|
|
104
|
+
"name": "background",
|
|
105
|
+
"type": "file",
|
|
106
|
+
"extensions": imageTypes
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "background_mobile",
|
|
110
|
+
"label": "Login Page Background (Mobile)",
|
|
111
|
+
"type": "file",
|
|
112
|
+
"extensions": imageTypes
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "large_logo_mode",
|
|
116
|
+
"type": "checkbox",
|
|
117
|
+
"hint": "If specified, the logo in the login box will be significantly larger, but *the background image will NOT be visible in the Live app*."
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "log_in_button",
|
|
121
|
+
"type": "subsection",
|
|
122
|
+
"fields": [
|
|
123
|
+
{
|
|
124
|
+
"name": "text_color",
|
|
125
|
+
"type": "color",
|
|
126
|
+
"no_label": true,
|
|
127
|
+
"default_value": {
|
|
128
|
+
"color": "#FFFFFF"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "background_color",
|
|
133
|
+
"type": "color",
|
|
134
|
+
"no_label": true,
|
|
135
|
+
"default_value": {
|
|
136
|
+
"color": "#0885fb"
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "border_color",
|
|
141
|
+
"type": "color",
|
|
142
|
+
"no_label": true,
|
|
143
|
+
"default_value": {
|
|
144
|
+
"color": "#0885fb"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "sign_up_button",
|
|
151
|
+
"type": "subsection",
|
|
152
|
+
"fields": [
|
|
153
|
+
{
|
|
154
|
+
"name": "text_color",
|
|
155
|
+
"type": "color",
|
|
156
|
+
"no_label": true,
|
|
157
|
+
"default_value": {
|
|
158
|
+
"color": "#000000"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"name": "background_color",
|
|
163
|
+
"type": "color",
|
|
164
|
+
"no_label": true,
|
|
165
|
+
"default_value": {
|
|
166
|
+
"color": "#FFFFFF"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"name": "border_color",
|
|
171
|
+
"type": "color",
|
|
172
|
+
"no_label": true,
|
|
173
|
+
"default_value": {
|
|
174
|
+
"color": "#000000"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"name": "require_consent",
|
|
181
|
+
"type": "checkbox",
|
|
182
|
+
"default_value": false
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"name": "consent_form_text",
|
|
186
|
+
"type": "rich_text"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"name": "privacy_policy",
|
|
190
|
+
"type": "subsection",
|
|
191
|
+
"fields": [
|
|
192
|
+
{
|
|
193
|
+
"name": "link",
|
|
194
|
+
"type": "text",
|
|
195
|
+
"hint": "Specify a URL to your privacy policy"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"name": "rich_text",
|
|
199
|
+
"type": "rich_text",
|
|
200
|
+
"hint": "Input your privacy policy in the text editor"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"name": "html",
|
|
204
|
+
"label": "HTML",
|
|
205
|
+
"type": "file",
|
|
206
|
+
"hint": "Input your privacy policy as an HTML file",
|
|
207
|
+
"extensions": ["html"]
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "require_email_verification",
|
|
213
|
+
"type": "checkbox",
|
|
214
|
+
"default_value": true
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"name": "disable_third_party",
|
|
218
|
+
"label": "Disable third party login providers",
|
|
219
|
+
"type": "checkbox",
|
|
220
|
+
"default_value": false
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"name": "disable_private_key",
|
|
224
|
+
"label": "Disable Private Key Login",
|
|
225
|
+
"type": "checkbox",
|
|
226
|
+
"default_value": false
|
|
51
227
|
}
|
|
52
|
-
]
|
|
53
|
-
"name": "images",
|
|
54
|
-
"type": "subsection"
|
|
228
|
+
]
|
|
55
229
|
},
|
|
56
230
|
{
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
231
|
+
"label": "Terms and Conditions",
|
|
232
|
+
"name": "terms",
|
|
233
|
+
"type": "rich_text"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"label": "Terms and Conditions (HTML)",
|
|
237
|
+
"name": "terms_html",
|
|
238
|
+
"type": "file",
|
|
239
|
+
"extensions": ["html"]
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
{
|
|
245
|
+
"label": "Item Definitions",
|
|
246
|
+
"name": "header_items",
|
|
247
|
+
"type": "header"
|
|
64
248
|
},
|
|
65
249
|
{
|
|
66
250
|
"name": "payment_currencies",
|
|
@@ -105,6 +289,12 @@ const MarketplaceSpec = {
|
|
|
105
289
|
"type": "checkbox",
|
|
106
290
|
"default_value": true
|
|
107
291
|
},
|
|
292
|
+
{
|
|
293
|
+
"label": "Release date",
|
|
294
|
+
"name": "available_at",
|
|
295
|
+
"type": "datetime",
|
|
296
|
+
"hint": "(Optional) - If specified, this item will not be available for purchase until the specified time"
|
|
297
|
+
},
|
|
108
298
|
{
|
|
109
299
|
"name": "requires_permissions",
|
|
110
300
|
"type": "checkbox",
|
|
@@ -146,6 +336,13 @@ const MarketplaceSpec = {
|
|
|
146
336
|
"name": "items",
|
|
147
337
|
"type": "list"
|
|
148
338
|
},
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
{
|
|
342
|
+
"label": "Storefront Organization",
|
|
343
|
+
"name": "header_storefront",
|
|
344
|
+
"type": "header"
|
|
345
|
+
},
|
|
149
346
|
{
|
|
150
347
|
"name": "storefront",
|
|
151
348
|
"type": "subsection",
|
|
@@ -204,6 +401,14 @@ const MarketplaceSpec = {
|
|
|
204
401
|
},
|
|
205
402
|
]
|
|
206
403
|
},
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
{
|
|
408
|
+
"label": "Collections",
|
|
409
|
+
"name": "header_collections",
|
|
410
|
+
"type": "header"
|
|
411
|
+
},
|
|
207
412
|
{
|
|
208
413
|
"name": "collections",
|
|
209
414
|
"type": "list",
|
|
@@ -284,125 +489,6 @@ const MarketplaceSpec = {
|
|
|
284
489
|
"allow_null": true
|
|
285
490
|
}
|
|
286
491
|
]
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
"name": "login_customization",
|
|
290
|
-
"label": "Custom Branding",
|
|
291
|
-
"type": "subsection",
|
|
292
|
-
"fields": [
|
|
293
|
-
{
|
|
294
|
-
"name": "require_email_verification",
|
|
295
|
-
"type": "checkbox",
|
|
296
|
-
"default_value": true
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"name": "font",
|
|
300
|
-
"type": "select",
|
|
301
|
-
"options": [
|
|
302
|
-
"Helvetica Neue",
|
|
303
|
-
"Inter",
|
|
304
|
-
"Selawik"
|
|
305
|
-
]
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
"name": "logo",
|
|
309
|
-
"type": "file",
|
|
310
|
-
"extensions": imageTypes
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
"name": "background",
|
|
314
|
-
"type": "file",
|
|
315
|
-
"extensions": imageTypes
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
"name": "background_mobile",
|
|
319
|
-
"label": "Background (Mobile)",
|
|
320
|
-
"type": "file",
|
|
321
|
-
"extensions": imageTypes
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
"name": "large_logo_mode",
|
|
325
|
-
"type": "checkbox",
|
|
326
|
-
"hint": "If specified, the logo in the login box will be significantly larger, but *the background image will NOT be visible in the Live app*."
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
"name": "log_in_button",
|
|
330
|
-
"type": "subsection",
|
|
331
|
-
"fields": [
|
|
332
|
-
{
|
|
333
|
-
"name": "text_color",
|
|
334
|
-
"type": "color",
|
|
335
|
-
"no_label": true,
|
|
336
|
-
"default_value": {
|
|
337
|
-
"color": "#FFFFFF"
|
|
338
|
-
}
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
"name": "background_color",
|
|
342
|
-
"type": "color",
|
|
343
|
-
"no_label": true,
|
|
344
|
-
"default_value": {
|
|
345
|
-
"color": "#0885fb"
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
"name": "border_color",
|
|
350
|
-
"type": "color",
|
|
351
|
-
"no_label": true,
|
|
352
|
-
"default_value": {
|
|
353
|
-
"color": "#0885fb"
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
]
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
"name": "sign_up_button",
|
|
360
|
-
"type": "subsection",
|
|
361
|
-
"fields": [
|
|
362
|
-
{
|
|
363
|
-
"name": "text_color",
|
|
364
|
-
"type": "color",
|
|
365
|
-
"no_label": true,
|
|
366
|
-
"default_value": {
|
|
367
|
-
"color": "#000000"
|
|
368
|
-
}
|
|
369
|
-
},
|
|
370
|
-
{
|
|
371
|
-
"name": "background_color",
|
|
372
|
-
"type": "color",
|
|
373
|
-
"no_label": true,
|
|
374
|
-
"default_value": {
|
|
375
|
-
"color": "#FFFFFF"
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
{
|
|
379
|
-
"name": "border_color",
|
|
380
|
-
"type": "color",
|
|
381
|
-
"no_label": true,
|
|
382
|
-
"default_value": {
|
|
383
|
-
"color": "#000000"
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
]
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
"name": "disable_third_party",
|
|
390
|
-
"label": "Disable third party login providers",
|
|
391
|
-
"type": "checkbox",
|
|
392
|
-
"default_value": false
|
|
393
|
-
},
|
|
394
|
-
{
|
|
395
|
-
"name": "disable_private_key",
|
|
396
|
-
"label": "Disable Private Key Login",
|
|
397
|
-
"type": "checkbox",
|
|
398
|
-
"default_value": false
|
|
399
|
-
}
|
|
400
|
-
]
|
|
401
|
-
},
|
|
402
|
-
{
|
|
403
|
-
"label": "Terms and Conditions",
|
|
404
|
-
"name": "terms",
|
|
405
|
-
"type": "rich_text"
|
|
406
492
|
}
|
|
407
493
|
]
|
|
408
494
|
};
|
package/typeSpecs/NFTTemplate.js
CHANGED
|
@@ -3,7 +3,7 @@ const imageTypes = ["gif", "jpg", "jpeg", "png", "svg", "webp"];
|
|
|
3
3
|
const NFTTemplateSpec = {
|
|
4
4
|
"profile": {
|
|
5
5
|
"name": "NFT Template",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.3",
|
|
7
7
|
},
|
|
8
8
|
"playable": true,
|
|
9
9
|
"display_app": "default",
|
|
@@ -93,6 +93,20 @@ const NFTTemplateSpec = {
|
|
|
93
93
|
"name": "rich_text",
|
|
94
94
|
"type": "rich_text"
|
|
95
95
|
},
|
|
96
|
+
{
|
|
97
|
+
"name": "media_type",
|
|
98
|
+
"type": "select",
|
|
99
|
+
"options": [
|
|
100
|
+
"Video",
|
|
101
|
+
"Image",
|
|
102
|
+
"Ebook"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "media",
|
|
107
|
+
"type": "file",
|
|
108
|
+
"hint": "Additional media for this NFT, for example the Ebook file."
|
|
109
|
+
},
|
|
96
110
|
{
|
|
97
111
|
"name": "address",
|
|
98
112
|
"label": "NFT Contract Address",
|
|
@@ -129,6 +143,11 @@ const NFTTemplateSpec = {
|
|
|
129
143
|
"type": "checkbox",
|
|
130
144
|
"default_value": true
|
|
131
145
|
},
|
|
146
|
+
{
|
|
147
|
+
"name": "has_audio",
|
|
148
|
+
"type": "checkbox",
|
|
149
|
+
"default_value": false
|
|
150
|
+
},
|
|
132
151
|
{
|
|
133
152
|
"name": "token_uri",
|
|
134
153
|
"label": "Token URI",
|
|
@@ -145,7 +164,8 @@ const NFTTemplateSpec = {
|
|
|
145
164
|
"loop": true,
|
|
146
165
|
"hide_controls": true,
|
|
147
166
|
"muted": true,
|
|
148
|
-
"autoplay": true
|
|
167
|
+
"autoplay": true,
|
|
168
|
+
"check_has_audio_flag": true
|
|
149
169
|
},
|
|
150
170
|
{
|
|
151
171
|
"name": "external_url",
|
|
@@ -157,7 +177,8 @@ const NFTTemplateSpec = {
|
|
|
157
177
|
"loop": true,
|
|
158
178
|
"hide_controls": true,
|
|
159
179
|
"muted": true,
|
|
160
|
-
"autoplay": true
|
|
180
|
+
"autoplay": true,
|
|
181
|
+
"check_has_audio_flag": true
|
|
161
182
|
},
|
|
162
183
|
{
|
|
163
184
|
"name": "background_color",
|
|
@@ -185,7 +206,8 @@ const NFTTemplateSpec = {
|
|
|
185
206
|
"loop": true,
|
|
186
207
|
"hide_controls": true,
|
|
187
208
|
"muted": true,
|
|
188
|
-
"autoplay": true
|
|
209
|
+
"autoplay": true,
|
|
210
|
+
"check_has_audio_flag": true
|
|
189
211
|
}
|
|
190
212
|
]
|
|
191
213
|
},
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const { ElvClient } = require("../src/ElvClient");
|
|
2
|
+
const isEqual = require("lodash/isEqual");
|
|
3
|
+
|
|
4
|
+
if(!process.env.PRIVATE_KEY || !process.env.NETWORK) {
|
|
5
|
+
console.error("USAGE: PRIVATE_KEY=<key> NETWORK=<network-name> node UpdateTypes.js");
|
|
6
|
+
process.exit(-1);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const specs = {
|
|
10
|
+
"Event Site": {
|
|
11
|
+
spec: require("./DropEventSite"),
|
|
12
|
+
},
|
|
13
|
+
"Tenant": {
|
|
14
|
+
spec: require("./EventTenant"),
|
|
15
|
+
},
|
|
16
|
+
"NFT Collection": {
|
|
17
|
+
spec: require("./NFTCollection")
|
|
18
|
+
},
|
|
19
|
+
"NFT Template": {
|
|
20
|
+
spec: require("./NFTTemplate")
|
|
21
|
+
},
|
|
22
|
+
"Marketplace": {
|
|
23
|
+
spec: require("./Marketplace")
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const Test = async () => {
|
|
28
|
+
try {
|
|
29
|
+
const client = await ElvClient.FromNetworkName({
|
|
30
|
+
networkName: process.env.NETWORK
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
let wallet = client.GenerateWallet();
|
|
34
|
+
let signer = wallet.AddAccount({
|
|
35
|
+
privateKey: process.env.PRIVATE_KEY
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
client.SetSigner({signer});
|
|
39
|
+
|
|
40
|
+
const types = await client.ContentTypes();
|
|
41
|
+
|
|
42
|
+
await Promise.all(
|
|
43
|
+
Object.values(types).map(async (type) => {
|
|
44
|
+
try {
|
|
45
|
+
const typeName = (type.meta && type.meta.public && type.meta.public.name && type.meta.public.name) || "";
|
|
46
|
+
const typeSpec = Object.keys(specs)
|
|
47
|
+
.find(name => typeName.toLowerCase().includes(name.toLowerCase()));
|
|
48
|
+
|
|
49
|
+
if(!typeSpec) {
|
|
50
|
+
console.log("Skipping", typeName);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const specMetadata = specs[typeSpec].spec;
|
|
55
|
+
|
|
56
|
+
if(isEqual(specMetadata, type.meta.public.title_configuration || {})) {
|
|
57
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
58
|
+
console.log("Type already up to date: ", typeName);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
await client.EditAndFinalizeContentObject({
|
|
63
|
+
libraryId: client.contentSpaceLibraryId,
|
|
64
|
+
objectId: type.id,
|
|
65
|
+
commitMessage: "Updated type spec via UpdateTypes.js",
|
|
66
|
+
callback: async ({writeToken}) => {
|
|
67
|
+
await client.ReplaceMetadata({
|
|
68
|
+
libraryId: client.contentSpaceLibraryId,
|
|
69
|
+
objectId: type.id,
|
|
70
|
+
writeToken,
|
|
71
|
+
metadataSubtree: "public/title_configuration",
|
|
72
|
+
metadata: specMetadata
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
console.log("Updated", typeName);
|
|
78
|
+
} catch(error) {
|
|
79
|
+
console.log(type);
|
|
80
|
+
console.log(error);
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
} catch(error) {
|
|
85
|
+
console.error(error);
|
|
86
|
+
console.error(JSON.stringify(error, null, 2));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
process.exit(0);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
Test();
|