@nascentdigital/funnel-cms 8.0.3 → 8.1.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/dist/api/PageClient.d.ts +1 -0
- package/dist/contentful/ContentfulPageClient.js +16 -5
- package/dist/contentful/models/ContentfulData.js +16 -5
- package/dist/contentful/models/ContentfulPageData.js +3 -0
- package/dist/strapi/StrapiPageClient.js +4 -2
- package/dist/strapi/serialization/PageData.d.ts +4 -3
- package/dist/strapi/serialization/PageData.js +5 -2
- package/package.json +2 -2
package/dist/api/PageClient.d.ts
CHANGED
|
@@ -180,7 +180,7 @@ class ContentfulPageClient {
|
|
|
180
180
|
}
|
|
181
181
|
// bind data + update url
|
|
182
182
|
existingPage = existingPages[0];
|
|
183
|
-
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 }, args));
|
|
183
|
+
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: existingPage.meta }, args));
|
|
184
184
|
draft.sync();
|
|
185
185
|
console.debug('[ContentfulPageClient/create/lang] creating from', { draft, existingPages });
|
|
186
186
|
// create page
|
|
@@ -195,6 +195,7 @@ class ContentfulPageClient {
|
|
|
195
195
|
region: draftData.region,
|
|
196
196
|
language: draftData.language,
|
|
197
197
|
name: draftData.name,
|
|
198
|
+
meta: draftData.meta,
|
|
198
199
|
tags: draftData.tags,
|
|
199
200
|
slug: draftData.slug,
|
|
200
201
|
url: draftData.url,
|
|
@@ -221,7 +222,7 @@ class ContentfulPageClient {
|
|
|
221
222
|
slug: page.slug,
|
|
222
223
|
instances: [
|
|
223
224
|
// map exiting entries
|
|
224
|
-
...existingPages.map(({ id, url, region, language, name, slug, tags, state, errors, createdOn, updatedOn, publishedOn }) => ({ id, url, region, language, name, slug, tags, state, errors, createdOn, updatedOn, publishedOn })),
|
|
225
|
+
...existingPages.map(({ id, url, region, language, name, slug, meta, tags, state, errors, createdOn, updatedOn, publishedOn }) => ({ id, url, region, language, name, slug, meta, tags, state, errors, createdOn, updatedOn, publishedOn })),
|
|
225
226
|
// add new entry
|
|
226
227
|
{
|
|
227
228
|
id: page.id,
|
|
@@ -230,6 +231,7 @@ class ContentfulPageClient {
|
|
|
230
231
|
language: page.language,
|
|
231
232
|
name: page.name,
|
|
232
233
|
slug: page.slug,
|
|
234
|
+
meta: page.meta,
|
|
233
235
|
tags: page.tags,
|
|
234
236
|
state: page.state,
|
|
235
237
|
errors: page.errors,
|
|
@@ -303,6 +305,7 @@ class ContentfulPageClient {
|
|
|
303
305
|
region: draftData.region,
|
|
304
306
|
language: draftData.language,
|
|
305
307
|
name: draftData.name,
|
|
308
|
+
meta: draftData.meta,
|
|
306
309
|
tags: draftData.tags,
|
|
307
310
|
slug: draftData.slug,
|
|
308
311
|
url: draftData.url,
|
|
@@ -336,6 +339,7 @@ class ContentfulPageClient {
|
|
|
336
339
|
language: page.language,
|
|
337
340
|
name: page.name,
|
|
338
341
|
slug: page.slug,
|
|
342
|
+
meta: page.meta,
|
|
339
343
|
tags: page.tags,
|
|
340
344
|
state: page.state,
|
|
341
345
|
errors: page.errors,
|
|
@@ -469,12 +473,12 @@ class ContentfulPageClient {
|
|
|
469
473
|
? sourcePage.groupId
|
|
470
474
|
: funnel_core_1.Value.uuid(), type: sourcePage.type, brand: sourcePage.brand, region: target.region, language: target.language, slug: target.operation === 'extend'
|
|
471
475
|
? sourcePage.slug
|
|
472
|
-
: target.slug, name: sourcePage.name, tags: sourcePage.tags, url: sourcePage.url, errors: true }, targetBody);
|
|
476
|
+
: target.slug, name: sourcePage.name, meta: sourcePage.meta, tags: sourcePage.tags, url: sourcePage.url, errors: true }, targetBody);
|
|
473
477
|
const targetModel = funnel_core_1.Schema.PageModel.from(targetData);
|
|
474
478
|
targetModel.sync();
|
|
475
479
|
console.debug('[ContentfulPageClient/duplicate] about to create page with data', targetData);
|
|
476
480
|
// create target page using content of source
|
|
477
|
-
const targetEntry = await cms.createEntry(models_1.ContentfulPageData.contentType, Object.assign(Object.assign({}, targetData), { references: ((_c = sourceEntry.references) !== null && _c !== void 0 ? _c : []).map(link => {
|
|
481
|
+
const targetEntry = await cms.createEntry(models_1.ContentfulPageData.contentType, Object.assign(Object.assign({}, targetData), { valid: !sourcePage.errors, references: ((_c = sourceEntry.references) !== null && _c !== void 0 ? _c : []).map(link => {
|
|
478
482
|
var _a, _b;
|
|
479
483
|
// replace entry ids if mapped
|
|
480
484
|
if (link.sys.linkType === 'Entry') {
|
|
@@ -542,7 +546,7 @@ class ContentfulPageClient {
|
|
|
542
546
|
exports.ContentfulPageClient = ContentfulPageClient;
|
|
543
547
|
function getPageQueryParams(query) {
|
|
544
548
|
// build filters
|
|
545
|
-
const { ids = [], groupId, brand, type, slug, region, language, name, tags = [], tagsMatch = 'any' } = query;
|
|
549
|
+
const { ids = [], groupId, brand, type, slug, region, language, name, meta = [], tags = [], tagsMatch = 'any' } = query;
|
|
546
550
|
const filters = {};
|
|
547
551
|
// filter id(s)
|
|
548
552
|
if (ids.length === 1) {
|
|
@@ -598,6 +602,12 @@ function getPageQueryParams(query) {
|
|
|
598
602
|
.filter((tag) => !!tag)
|
|
599
603
|
.join(',');
|
|
600
604
|
}
|
|
605
|
+
// filter by meta
|
|
606
|
+
if (meta.length > 0) {
|
|
607
|
+
filters['fields.meta[all]'] = meta
|
|
608
|
+
.filter(funnel_core_1.Value.isDefined)
|
|
609
|
+
.join(',');
|
|
610
|
+
}
|
|
601
611
|
// return filters
|
|
602
612
|
return filters;
|
|
603
613
|
}
|
|
@@ -615,6 +625,7 @@ function getPageSelect(props) {
|
|
|
615
625
|
case 'region':
|
|
616
626
|
case 'language':
|
|
617
627
|
case 'name':
|
|
628
|
+
case 'meta':
|
|
618
629
|
case 'tags':
|
|
619
630
|
case 'discover':
|
|
620
631
|
case 'preview':
|
|
@@ -20,11 +20,22 @@ var ContentfulData;
|
|
|
20
20
|
})(Link = ContentfulData.Link || (ContentfulData.Link = {}));
|
|
21
21
|
// helpers
|
|
22
22
|
function calcState({ updatedOn, publishedOn }) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
// never published
|
|
24
|
+
if (publishedOn === undefined) {
|
|
25
|
+
return 'draft';
|
|
26
|
+
}
|
|
27
|
+
// updated after publish
|
|
28
|
+
else if (updatedOn > publishedOn) {
|
|
29
|
+
return 'draft';
|
|
30
|
+
}
|
|
31
|
+
// published same time as update
|
|
32
|
+
else if (updatedOn === publishedOn) {
|
|
33
|
+
return 'published';
|
|
34
|
+
}
|
|
35
|
+
// otherwise
|
|
36
|
+
else {
|
|
37
|
+
return 'unpublished';
|
|
38
|
+
}
|
|
28
39
|
}
|
|
29
40
|
ContentfulData.calcState = calcState;
|
|
30
41
|
function toEntryData(entry, locale) {
|
|
@@ -68,6 +68,9 @@ var ContentfulPageData;
|
|
|
68
68
|
case 'tags':
|
|
69
69
|
bindProp(prop, prop, value => value !== null && value !== void 0 ? value : []);
|
|
70
70
|
break;
|
|
71
|
+
case 'meta':
|
|
72
|
+
bindProp(prop, prop, value => value !== null && value !== void 0 ? value : []);
|
|
73
|
+
break;
|
|
71
74
|
// content
|
|
72
75
|
case 'discover':
|
|
73
76
|
case 'content':
|
|
@@ -224,7 +224,7 @@ class StrapiPageClient {
|
|
|
224
224
|
}
|
|
225
225
|
// bind data + update url
|
|
226
226
|
existingPage = existingPages[0];
|
|
227
|
-
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 }, args));
|
|
227
|
+
const draft = funnel_core_1.Schema.PageModel.fromDraft(Object.assign({ type: existingPage.type, slug: existingPage.slug, url: existingPage.url, name: existingPage.name, meta: existingPage.meta, tags: existingPage.tags }, args));
|
|
228
228
|
draft.sync();
|
|
229
229
|
// resolve change set (rebind)
|
|
230
230
|
const { provider } = this;
|
|
@@ -271,7 +271,7 @@ class StrapiPageClient {
|
|
|
271
271
|
type: page.type,
|
|
272
272
|
slug: page.slug,
|
|
273
273
|
instances: [
|
|
274
|
-
...existingPages.map(({ id, url, region, language, name, slug, tags, state, errors, createdOn, updatedOn, publishedOn }) => ({ id, url, region, language, name, slug, tags, state, errors, createdOn, updatedOn, publishedOn })),
|
|
274
|
+
...existingPages.map(({ id, url, region, language, name, slug, meta, tags, state, errors, createdOn, updatedOn, publishedOn }) => ({ id, url, region, language, name, slug, meta, tags, state, errors, createdOn, updatedOn, publishedOn })),
|
|
275
275
|
{
|
|
276
276
|
id: page.id,
|
|
277
277
|
url: page.url,
|
|
@@ -279,6 +279,7 @@ class StrapiPageClient {
|
|
|
279
279
|
language: page.language,
|
|
280
280
|
name: page.name,
|
|
281
281
|
slug: page.slug,
|
|
282
|
+
meta: page.meta,
|
|
282
283
|
tags: page.tags,
|
|
283
284
|
state: page.state,
|
|
284
285
|
errors: page.errors,
|
|
@@ -389,6 +390,7 @@ class StrapiPageClient {
|
|
|
389
390
|
language: page.language,
|
|
390
391
|
name: page.name,
|
|
391
392
|
slug: page.slug,
|
|
393
|
+
meta: page.meta,
|
|
392
394
|
tags: page.tags,
|
|
393
395
|
state: page.state,
|
|
394
396
|
errors: page.errors,
|
|
@@ -9,6 +9,7 @@ export type PageData = StrapiData & {
|
|
|
9
9
|
brand: string;
|
|
10
10
|
region: string;
|
|
11
11
|
lang: Language;
|
|
12
|
+
meta: string;
|
|
12
13
|
tags: string;
|
|
13
14
|
name: string;
|
|
14
15
|
slug: string | null;
|
|
@@ -35,13 +36,13 @@ export declare namespace PageData {
|
|
|
35
36
|
populate: string;
|
|
36
37
|
};
|
|
37
38
|
pageRefs: {
|
|
38
|
-
fields: ("content" | "brand" | "preview" | "type" | "tags" | "name" | "url" | "groupId" | "publishedOn" | "errors" | "state" | "changeSetId" | "snapshot" | "slug" | "region" | "discover" | "publication" | keyof StrapiData | "lang" | "assetRefs" | "collectionRefs" | "pageRefs")[];
|
|
39
|
+
fields: ("content" | "brand" | "preview" | "type" | "tags" | "name" | "url" | "groupId" | "publishedOn" | "errors" | "state" | "changeSetId" | "snapshot" | "meta" | "slug" | "region" | "discover" | "publication" | keyof StrapiData | "lang" | "assetRefs" | "collectionRefs" | "pageRefs")[];
|
|
39
40
|
populate: {
|
|
40
41
|
assetRefs: {
|
|
41
42
|
populate: string;
|
|
42
43
|
};
|
|
43
44
|
pageRefs: {
|
|
44
|
-
fields: ("content" | "brand" | "preview" | "type" | "tags" | "name" | "url" | "groupId" | "publishedOn" | "errors" | "state" | "changeSetId" | "snapshot" | "slug" | "region" | "discover" | "publication" | keyof StrapiData | "lang" | "assetRefs" | "collectionRefs" | "pageRefs")[];
|
|
45
|
+
fields: ("content" | "brand" | "preview" | "type" | "tags" | "name" | "url" | "groupId" | "publishedOn" | "errors" | "state" | "changeSetId" | "snapshot" | "meta" | "slug" | "region" | "discover" | "publication" | keyof StrapiData | "lang" | "assetRefs" | "collectionRefs" | "pageRefs")[];
|
|
45
46
|
populate: string;
|
|
46
47
|
};
|
|
47
48
|
collectionRefs: {
|
|
@@ -75,7 +76,7 @@ export declare namespace PageData {
|
|
|
75
76
|
populate: string;
|
|
76
77
|
};
|
|
77
78
|
pageRefs: {
|
|
78
|
-
fields: ("content" | "brand" | "preview" | "type" | "tags" | "name" | "url" | "groupId" | "publishedOn" | "errors" | "state" | "changeSetId" | "snapshot" | "slug" | "region" | "discover" | "publication" | keyof StrapiData | "lang" | "assetRefs" | "collectionRefs" | "pageRefs")[];
|
|
79
|
+
fields: ("content" | "brand" | "preview" | "type" | "tags" | "name" | "url" | "groupId" | "publishedOn" | "errors" | "state" | "changeSetId" | "snapshot" | "meta" | "slug" | "region" | "discover" | "publication" | keyof StrapiData | "lang" | "assetRefs" | "collectionRefs" | "pageRefs")[];
|
|
79
80
|
populate: {
|
|
80
81
|
assetRefs: {
|
|
81
82
|
populate: string;
|
|
@@ -172,6 +172,7 @@ var PageData;
|
|
|
172
172
|
}
|
|
173
173
|
break;
|
|
174
174
|
// tags
|
|
175
|
+
case 'meta':
|
|
175
176
|
case 'tags':
|
|
176
177
|
bindProp(prop, prop, value => JSON.parse(value !== null && value !== void 0 ? value : '[]'));
|
|
177
178
|
break;
|
|
@@ -308,6 +309,7 @@ var PageData;
|
|
|
308
309
|
}
|
|
309
310
|
break;
|
|
310
311
|
// tags
|
|
312
|
+
case 'meta':
|
|
311
313
|
case 'tags':
|
|
312
314
|
bindProp(prop, prop, value => JSON.parse(value !== null && value !== void 0 ? value : '[]'));
|
|
313
315
|
break;
|
|
@@ -348,11 +350,11 @@ var PageData;
|
|
|
348
350
|
PageData.deserializeLegacy = deserializeLegacy;
|
|
349
351
|
// deserialize ref
|
|
350
352
|
function deserializeRef(data) {
|
|
351
|
-
var _a, _b, _c, _d;
|
|
353
|
+
var _a, _b, _c, _d, _e;
|
|
352
354
|
// transform directly (easier because we know what we're looking for)
|
|
353
355
|
const createdOn = Date.parse(data.createdAt);
|
|
354
356
|
const updatedOn = data.updatedAt ? Date.parse(data.updatedAt) : createdOn;
|
|
355
|
-
return Object.assign(Object.assign({}, models_1.StrapiData.deserialize(data)), { type: data.type,
|
|
357
|
+
return Object.assign(Object.assign({}, models_1.StrapiData.deserialize(data)), { type: data.type, meta: JSON.parse((_a = data.meta) !== null && _a !== void 0 ? _a : '[]'), tags: JSON.parse((_b = data.tags) !== null && _b !== void 0 ? _b : '[]'), region: data.region, language: (_c = data.lang) !== null && _c !== void 0 ? _c : undefined, groupId: data.groupId, brand: data.brand, slug: (_d = data.slug) !== null && _d !== void 0 ? _d : undefined, url: data.url, name: data.name, state: data.state, changeSetId: (_e = data.changeSetId) !== null && _e !== void 0 ? _e : undefined, errors: data.errors, createdOn,
|
|
356
358
|
updatedOn, publishedOn: data.publishedOn ? parseInt(data.publishedOn) : undefined, publication: data.publication ? parseInt(data.publication) : undefined });
|
|
357
359
|
}
|
|
358
360
|
PageData.deserializeRef = deserializeRef;
|
|
@@ -362,6 +364,7 @@ var PageData;
|
|
|
362
364
|
const base = {
|
|
363
365
|
groupId: page.groupId,
|
|
364
366
|
type: page.type,
|
|
367
|
+
meta: JSON.stringify(page.meta),
|
|
365
368
|
tags: JSON.stringify(page.tags),
|
|
366
369
|
brand: page.brand,
|
|
367
370
|
lang: page.language,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nascentdigital/funnel-cms",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.1.0",
|
|
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": "fdf586ac394c06b0ed2f08377c605e3fa317788a"
|
|
52
52
|
}
|