@nascentdigital/funnel-cms 8.1.1 → 8.1.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.
|
@@ -178,9 +178,15 @@ class ContentfulPageClient {
|
|
|
178
178
|
console.debug('[ContentfulPageClient/create/lang] returning existing page', existingPage);
|
|
179
179
|
return this.getGroup(Object.assign(Object.assign({}, existingPage), { version: 'draft' }));
|
|
180
180
|
}
|
|
181
|
-
//
|
|
181
|
+
// get page's template
|
|
182
182
|
existingPage = existingPages[0];
|
|
183
|
-
const
|
|
183
|
+
const site = funnel_core_1.Schema.Site.current();
|
|
184
|
+
const schema = site.regions[args.region][existingPage.type];
|
|
185
|
+
// bind data + update url
|
|
186
|
+
const draft = funnel_core_1.Schema.PageModel.fromDraft(Object.assign({ type: existingPage.type, slug: existingPage.slug, url: existingPage.url, name: existingPage.name, tags: existingPage.tags, meta: funnel_core_1.ArrayUtils.removeDuplicates([
|
|
187
|
+
...existingPage.meta,
|
|
188
|
+
...schema.meta.map(m => m.id)
|
|
189
|
+
]) }, args));
|
|
184
190
|
draft.sync();
|
|
185
191
|
console.debug('[ContentfulPageClient/create/lang] creating from', { draft, existingPages });
|
|
186
192
|
// create page
|
|
@@ -288,9 +294,10 @@ class ContentfulPageClient {
|
|
|
288
294
|
console.debug('[ContentfulPageClient/create/new] no existing group found');
|
|
289
295
|
}
|
|
290
296
|
// bind data + update url
|
|
291
|
-
const
|
|
297
|
+
const { meta = [] } = args, otherArgs = __rest(args, ["meta"]);
|
|
298
|
+
const draft = funnel_core_1.Schema.PageModel.fromDraft(Object.assign(Object.assign({}, otherArgs), { groupId: existingGroup.groupId === funnel_core_1.Schema.Page.GroupId.empty
|
|
292
299
|
? funnel_core_1.Value.uuid()
|
|
293
|
-
: existingGroup.groupId, url: '' }));
|
|
300
|
+
: existingGroup.groupId, url: '', meta: schema.meta.map(m => m.id) }));
|
|
294
301
|
draft.sync();
|
|
295
302
|
// create page
|
|
296
303
|
try {
|
|
@@ -469,11 +476,16 @@ class ContentfulPageClient {
|
|
|
469
476
|
// create duplicate page
|
|
470
477
|
try {
|
|
471
478
|
// setup data
|
|
479
|
+
const site = funnel_core_1.Schema.Site.current();
|
|
480
|
+
const schema = site.regions[sourceRef.region][sourceRef.type];
|
|
472
481
|
const targetData = Object.assign({ groupId: target.operation === 'extend'
|
|
473
482
|
? sourcePage.groupId
|
|
474
483
|
: funnel_core_1.Value.uuid(), type: sourcePage.type, brand: sourcePage.brand, region: target.region, language: target.language, slug: target.operation === 'extend'
|
|
475
484
|
? sourcePage.slug
|
|
476
|
-
: target.slug, name: sourcePage.name, meta:
|
|
485
|
+
: target.slug, name: sourcePage.name, meta: funnel_core_1.ArrayUtils.removeDuplicates([
|
|
486
|
+
...sourcePage.meta,
|
|
487
|
+
...schema.meta.map(m => m.id)
|
|
488
|
+
]), tags: sourcePage.tags, url: sourcePage.url, errors: true }, targetBody);
|
|
477
489
|
const targetModel = funnel_core_1.Schema.PageModel.from(targetData);
|
|
478
490
|
targetModel.sync();
|
|
479
491
|
console.debug('[ContentfulPageClient/duplicate] about to create page with data', targetData);
|
|
@@ -66,8 +66,6 @@ var ContentfulPageData;
|
|
|
66
66
|
break;
|
|
67
67
|
// arrays
|
|
68
68
|
case 'tags':
|
|
69
|
-
bindProp(prop, prop, value => value !== null && value !== void 0 ? value : []);
|
|
70
|
-
break;
|
|
71
69
|
case 'meta':
|
|
72
70
|
bindProp(prop, prop, value => value !== null && value !== void 0 ? value : []);
|
|
73
71
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nascentdigital/funnel-cms",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/nascentdigital/funnel.git",
|
|
6
6
|
"directory": "libs/cms"
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"ts-jest": "^29",
|
|
49
49
|
"type-fest": "^4"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "68d48abbc294945af6b56a8489644b210e5ac661"
|
|
52
52
|
}
|