@content-island/gatsby-source-plugin 0.3.1 → 0.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/dist/mappers.js +13 -1
- package/package.json +2 -2
package/dist/mappers.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.mapContentListFromApiToVm = void 0;
|
|
4
15
|
const apiModel = require("@content-island/api-client");
|
|
@@ -24,9 +35,10 @@ const mapToPreprocessedFieldList = (fields, gatsbyNodeType, fieldType) => Array.
|
|
|
24
35
|
const mapContentFromApiToVm = (content, isLocalized, language) => {
|
|
25
36
|
const gatsbyNodeType = `${constants_1.NODE_TYPE_PREFIX}${content.contentType.name}`;
|
|
26
37
|
const fields = isLocalized ? content.fields.filter(field => field.language === language) : content.fields;
|
|
38
|
+
const _a = apiModel.mapContentToModel(Object.assign(Object.assign({}, content), { fields })), { id } = _a, model = __rest(_a, ["id"]);
|
|
27
39
|
return {
|
|
28
40
|
gatsbyNodeType,
|
|
29
|
-
gatsbyNode: Object.assign({ _id:
|
|
41
|
+
gatsbyNode: Object.assign({ _id: id, _isContentIslandNode: true, _mediaFields: mapToPreprocessedFieldList(fields, gatsbyNodeType, 'media'), _markdownFields: mapToPreprocessedFieldList(fields, gatsbyNodeType, 'long-text'), _lastUpdate: content.lastUpdate, _isLocalized: isLocalized, _language: language }, model),
|
|
30
42
|
};
|
|
31
43
|
};
|
|
32
44
|
const mapLocalizedContentFromApiToVm = (content) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@content-island/gatsby-source-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Content Island - B2B Gatsby Source Plugin",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Lemoncode",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build": "tsc"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@content-island/api-client": "^0.
|
|
30
|
+
"@content-island/api-client": "^0.4.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"gatsby": "^5.12.4",
|