@content-island/gatsby-source-plugin 0.1.3 → 0.2.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.
|
@@ -16,8 +16,8 @@ let CONTENT_TYPES = [];
|
|
|
16
16
|
// Fetch all content types from Content Island
|
|
17
17
|
const getContentTypes = (client) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
18
|
if (CONTENT_TYPES.length === 0) {
|
|
19
|
-
const
|
|
20
|
-
CONTENT_TYPES =
|
|
19
|
+
const project = yield client.get(api_client_1.API_URLS.project);
|
|
20
|
+
CONTENT_TYPES = project.entities;
|
|
21
21
|
}
|
|
22
22
|
return CONTENT_TYPES;
|
|
23
23
|
});
|
package/dist/mappers.js
CHANGED
|
@@ -29,7 +29,7 @@ const mapContentFromApiToVm = (content, isLocalized, language) => {
|
|
|
29
29
|
const fields = isLocalized ? content.fields.filter(field => field.language === language) : content.fields;
|
|
30
30
|
return {
|
|
31
31
|
gatsbyNodeType,
|
|
32
|
-
gatsbyNode: Object.assign({ _id: content.id, _isContentIslandNode: true, _mediaFields: mapToPreprocessedFieldList(fields, gatsbyNodeType, 'media'), _markdownFields: mapToPreprocessedFieldList(fields, gatsbyNodeType, 'long-text'),
|
|
32
|
+
gatsbyNode: Object.assign({ _id: content.id, _isContentIslandNode: true, _mediaFields: mapToPreprocessedFieldList(fields, gatsbyNodeType, 'media'), _markdownFields: mapToPreprocessedFieldList(fields, gatsbyNodeType, 'long-text'), _lastUpdate: content.lastUpdate, _isLocalized: isLocalized, _language: language }, mapFieldListFromApiToVm(fields)),
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
const mapLocalizedContentFromApiToVm = (content) => {
|
|
@@ -11,7 +11,7 @@ export interface ContentIslandNode {
|
|
|
11
11
|
_isContentIslandNode: boolean;
|
|
12
12
|
_mediaFields: PreprocessedField<Resource>[];
|
|
13
13
|
_markdownFields: PreprocessedField<string>[];
|
|
14
|
-
|
|
14
|
+
_lastUpdate: Date;
|
|
15
15
|
_isLocalized: boolean;
|
|
16
16
|
_language?: string;
|
|
17
17
|
[key: string]: any;
|
package/gatsby-node.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require(`./dist/index`);
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@content-island/gatsby-source-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Content Island - B2B Gatsby Source Plugin",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Lemoncode",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"files": [
|
|
9
|
-
"dist"
|
|
9
|
+
"dist",
|
|
10
|
+
"gatsby-node.js"
|
|
10
11
|
],
|
|
11
12
|
"module": "./dist/index.js",
|
|
12
13
|
"main": "./dist/index.js",
|