@content-island/gatsby-source-plugin 0.1.0 → 0.1.2
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.
|
@@ -10,13 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getContentList = void 0;
|
|
13
|
-
const
|
|
13
|
+
const api_client_1 = require("@content-island/api-client");
|
|
14
14
|
const mappers_1 = require("../mappers");
|
|
15
15
|
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 projects = yield client.get(
|
|
19
|
+
const projects = yield client.get(api_client_1.API_URLS.projectList());
|
|
20
20
|
CONTENT_TYPES = projects.flatMap(p => p.entities);
|
|
21
21
|
}
|
|
22
22
|
return CONTENT_TYPES;
|
|
@@ -25,10 +25,10 @@ let CONTENT_LIST = [];
|
|
|
25
25
|
const getContentList = (pluginOptions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
26
|
if (CONTENT_LIST.length === 0) {
|
|
27
27
|
const { accessToken } = pluginOptions;
|
|
28
|
-
const client = (0,
|
|
28
|
+
const client = (0, api_client_1.createContentIslandClient)({ accessToken });
|
|
29
29
|
const contentTypes = yield getContentTypes(client);
|
|
30
30
|
for (const contentType of contentTypes) {
|
|
31
|
-
const contents = yield client.get(
|
|
31
|
+
const contents = yield client.get(api_client_1.API_URLS.contentList({ filterList: [`contentType=${contentType.name}`] }));
|
|
32
32
|
CONTENT_LIST = [...CONTENT_LIST, ...(0, mappers_1.mapContentListFromApiToVm)(contents)];
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CreateNodeArgs, SourceNodesArgs } from 'gatsby';
|
|
2
|
-
import { Resource } from '@content-island/
|
|
2
|
+
import { Resource } from '@content-island/api-client';
|
|
3
3
|
import { Content, PreprocessedField } from '../models';
|
|
4
4
|
export declare const contentNodeBuilder: (gatsbyApi: SourceNodesArgs, content: Content) => Promise<void>;
|
|
5
5
|
export declare const mediaNodeBuilder: (gatsbyApi: CreateNodeArgs, mediaField: PreprocessedField<Resource>) => Promise<void>;
|
package/dist/mappers.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@content-island/gatsby-source-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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"
|
|
10
|
-
"gatsby-node.js"
|
|
9
|
+
"dist"
|
|
11
10
|
],
|
|
12
|
-
"module": "./dist/
|
|
13
|
-
"main": "./dist/
|
|
11
|
+
"module": "./dist/index.js",
|
|
12
|
+
"main": "./dist/index.js",
|
|
14
13
|
"types": "./dist/index.d.ts",
|
|
15
14
|
"exports": {
|
|
16
15
|
".": {
|
|
17
|
-
"import": "./dist/
|
|
18
|
-
"require": "./dist/
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"require": "./dist/index.js",
|
|
19
18
|
"types": "./dist/index.d.ts"
|
|
19
|
+
},
|
|
20
|
+
"./package.json": {
|
|
21
|
+
"import": "./package.json",
|
|
22
|
+
"require": "./package.json"
|
|
20
23
|
}
|
|
21
24
|
},
|
|
22
25
|
"scripts": {
|
|
23
26
|
"build": "tsc"
|
|
24
27
|
},
|
|
25
28
|
"dependencies": {
|
|
26
|
-
"@content-island/
|
|
29
|
+
"@content-island/api-client": "*"
|
|
27
30
|
},
|
|
28
31
|
"devDependencies": {
|
|
29
32
|
"gatsby": "^5.12.4",
|
package/gatsby-node.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require(`./dist/index`);
|