gatsby-source-notion-churnotion 1.0.24 → 1.0.25
Sign up to get free protection for your applications and to get access to all the features.
package/dist/api/getPages.js
CHANGED
@@ -125,11 +125,11 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
|
|
125
125
|
}
|
126
126
|
const bookId = page.properties?.book?.relation?.[0]?.id || null;
|
127
127
|
const markdownContent = await connector_1.n2m.pageToMarkdown(page.id);
|
128
|
-
const
|
128
|
+
const imageNode = await (0, imageProcessor_1.processBlocks)(markdownContent, actions, getCache, createNodeId, reporter);
|
129
129
|
const gatsbyImageData = {
|
130
130
|
childImageSharp: {
|
131
|
-
gatsbyImageData:
|
132
|
-
? `childImageSharp___NODE___${
|
131
|
+
gatsbyImageData: imageNode
|
132
|
+
? `childImageSharp___NODE___${imageNode}`
|
133
133
|
: null,
|
134
134
|
},
|
135
135
|
};
|
@@ -157,7 +157,7 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
|
|
157
157
|
tags: tagIds,
|
158
158
|
parent: null,
|
159
159
|
url: `${constants_1.COMMON_URI}/${constants_1.POST_URI}${categoryUrl}/${slug}`,
|
160
|
-
|
160
|
+
thumbnail: imageNode,
|
161
161
|
...gatsbyImageData,
|
162
162
|
};
|
163
163
|
await createNode(postNode);
|
@@ -20,7 +20,7 @@ const createSchemaCustomization = ({ actions }) => {
|
|
20
20
|
slug: String
|
21
21
|
category_list: [${constants_1.NODE_TYPE.Category}]
|
22
22
|
url: String!
|
23
|
-
|
23
|
+
thumbnail: File @link(by: "id", from: "thumbnail")
|
24
24
|
}
|
25
25
|
|
26
26
|
type ${constants_1.NODE_TYPE.Tag} implements Node {
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { Actions, GatsbyCache, Reporter } from "gatsby";
|
2
2
|
import { MdBlock } from "notion-to-md/build/types";
|
3
|
-
export declare const processBlocks: (blocks: MdBlock[], actions: Actions, getCache: (this: void, id: string) => GatsbyCache, createNodeId: (this: void, input: string) => string, reporter: Reporter) => Promise<
|
3
|
+
export declare const processBlocks: (blocks: MdBlock[], actions: Actions, getCache: (this: void, id: string) => GatsbyCache, createNodeId: (this: void, input: string) => string, reporter: Reporter) => Promise<import("gatsby-source-filesystem").FileSystemNode | null>;
|
@@ -4,7 +4,7 @@ exports.processBlocks = void 0;
|
|
4
4
|
const gatsby_source_filesystem_1 = require("gatsby-source-filesystem");
|
5
5
|
const processBlocks = async (blocks, actions, getCache, createNodeId, reporter) => {
|
6
6
|
const { createNode } = actions;
|
7
|
-
let
|
7
|
+
let thumbnail = null;
|
8
8
|
for (const block of blocks) {
|
9
9
|
if (block.type === `image` &&
|
10
10
|
typeof block.parent === `string` &&
|
@@ -23,9 +23,9 @@ const processBlocks = async (blocks, actions, getCache, createNodeId, reporter)
|
|
23
23
|
});
|
24
24
|
if (fileNode) {
|
25
25
|
block.parent = fileNode.id;
|
26
|
-
if (
|
27
|
-
|
28
|
-
reporter.info(`[SUCCESS] Image processed: ${fileNode.
|
26
|
+
if (!thumbnail)
|
27
|
+
thumbnail = fileNode;
|
28
|
+
reporter.info(`[SUCCESS] Image processed: ${fileNode.id}`);
|
29
29
|
}
|
30
30
|
}
|
31
31
|
catch (error) {
|
@@ -34,6 +34,6 @@ const processBlocks = async (blocks, actions, getCache, createNodeId, reporter)
|
|
34
34
|
}
|
35
35
|
}
|
36
36
|
}
|
37
|
-
return
|
37
|
+
return thumbnail;
|
38
38
|
};
|
39
39
|
exports.processBlocks = processBlocks;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "gatsby-source-notion-churnotion",
|
3
3
|
"description": "Gatsby plugin that can connect with One Notion Database RECURSIVELY using official API",
|
4
|
-
"version": "1.0.
|
4
|
+
"version": "1.0.25",
|
5
5
|
"skipLibCheck": true,
|
6
6
|
"license": "0BSD",
|
7
7
|
"main": "./dist/gatsby-node.js",
|