gatsby-source-notion-churnotion 1.0.5 → 1.0.7

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.
@@ -83,19 +83,25 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
83
83
  }
84
84
  const nodeId = createNodeId(`${page.id}-page`);
85
85
  // Tag 노드 만들기
86
+ const tagIds = [];
86
87
  if (page.properties.tags && page.properties.tags.multi_select) {
87
- page.properties.tags.multi_select.map((tagData) => createNode({
88
- id: createNodeId(`${tagData.id}-tag`),
89
- tag_name: tagData.name,
90
- color: tagData.color,
91
- internal: {
92
- type: constants_1.NODE_TYPE.Tag,
93
- contentDigest: crypto_1.default
94
- .createHash(`md5`)
95
- .update(JSON.stringify(tagData.id))
96
- .digest(`hex`),
97
- },
98
- }));
88
+ page.properties.tags.multi_select.forEach((tagData) => {
89
+ const tagNodeId = createNodeId(`${tagData.id}-tag`);
90
+ tagIds.push(tagNodeId); // 태그 ID 저장
91
+ createNode({
92
+ id: tagNodeId,
93
+ tag_name: tagData.name,
94
+ color: tagData.color,
95
+ churnotions: [],
96
+ internal: {
97
+ type: constants_1.NODE_TYPE.Tag,
98
+ contentDigest: crypto_1.default
99
+ .createHash(`md5`)
100
+ .update(JSON.stringify(tagData))
101
+ .digest(`hex`),
102
+ },
103
+ });
104
+ });
99
105
  }
100
106
  const bookId = page.properties?.book?.relation?.[0]?.id || null;
101
107
  const markdownContent = await connector_1.n2m.pageToMarkdown(page.id);
@@ -114,14 +120,13 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
114
120
  category_list: categoryPath,
115
121
  children: [],
116
122
  internal: {
117
- owner: "a",
118
123
  type: constants_1.NODE_TYPE.Post,
119
124
  contentDigest: crypto_1.default
120
125
  .createHash(`md5`)
121
126
  .update(JSON.stringify(nodeId))
122
127
  .digest(`hex`),
123
128
  },
124
- tags: [],
129
+ tags: tagIds,
125
130
  parent: null,
126
131
  };
127
132
  await createNode(postNode);
@@ -8,7 +8,7 @@ const createSchemaCustomization = ({ actions }) => {
8
8
  type ${constants_1.NODE_TYPE.Post} implements Node {
9
9
  id: ID!
10
10
  category: ${constants_1.NODE_TYPE.Category}! @link(by: "id", from: "category")
11
- tags: ${constants_1.NODE_TYPE.Tag} @link(by: "id")
11
+ tags: [${constants_1.NODE_TYPE.Tag}] @link(by: "id")
12
12
  book_id: ${constants_1.NODE_TYPE.Book} @link(by: "id")
13
13
  title: String
14
14
  content: [JSON]
@@ -24,6 +24,7 @@ const createSchemaCustomization = ({ actions }) => {
24
24
  id: ID!
25
25
  tag_name: String!
26
26
  color: String!
27
+ churnotions: [${constants_1.NODE_TYPE.Post}] @link(by: "id", from: "tags")
27
28
  }
28
29
 
29
30
  type ${constants_1.NODE_TYPE.Category} implements Node {
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.5",
4
+ "version": "1.0.7",
5
5
  "skipLibCheck": true,
6
6
  "license": "0BSD",
7
7
  "main": "./dist/gatsby-node.js",