Comparing version 0.6.9 to 0.7.0
@@ -0,0 +0,0 @@ { |
{ | ||
"name": "notabase", | ||
"version": "0.6.9", | ||
"version": "0.7.0", | ||
"description": "API Wrapper For Notion's Database", | ||
@@ -5,0 +5,0 @@ "main": "src/notabase.js", |
@@ -0,0 +0,0 @@ # Notabase (WIP) |
@@ -0,0 +0,0 @@ // just for code block |
@@ -0,0 +0,0 @@ const token_v2 = undefined |
@@ -38,3 +38,2 @@ class Row { | ||
makeRow(rowBlockId, schema) { | ||
if (!schema) return undefined | ||
let rowData = rowBlockId in this.client.blockStore ? this.client.blockStore[rowBlockId].value : undefined | ||
@@ -106,8 +105,3 @@ let props = Object.entries(schema).map(item => { | ||
let _blockId = item[1][0][1] | ||
if (_schema) { | ||
return this.makeRow(_blockId, _schema) | ||
} else { | ||
console.log(`failed to get relation of ${_blockId}`) | ||
return undefined | ||
} | ||
return this.makeRow(_blockId, _schema) | ||
}) | ||
@@ -142,2 +136,23 @@ break | ||
break | ||
case 'file': | ||
if (value.length === 1 && value[0]) { | ||
newV = [[value[0], [["a", value[0]]]]] | ||
} else if (value.length === 0) { | ||
newV = [] | ||
} else { | ||
newV = value.reduce((a, b, index) => { | ||
if (index === 1) { | ||
return [[a, [["a", a]]]].concat([ | ||
[","], | ||
[b, [["a", b]]] | ||
]) | ||
} else { | ||
return a.concat([ | ||
[","], | ||
[b, [["a", b]]] | ||
]) | ||
} | ||
}) | ||
} | ||
break | ||
case 'multi_select': | ||
@@ -144,0 +159,0 @@ if (value instanceof Array) { |
@@ -65,2 +65,12 @@ const Collection = require('./collection') | ||
async searchBlocks(fullTableID, query) { | ||
let data = await this.reqeust.post(`/api/v3/searchBlocks`, { | ||
"query": query, | ||
"table": "block", | ||
"id": fullTableID, | ||
"limit": 20 | ||
}) | ||
return data | ||
} | ||
async getBrowseableUrlByCollectionPageId(pageId) { | ||
@@ -67,0 +77,0 @@ let r = await this.getRecordValues([pageId], []) |
@@ -0,0 +0,0 @@ // just for collection row page |
@@ -0,0 +0,0 @@ const NOTION_BASE_URL = "https://www.notion.so" |
@@ -0,0 +0,0 @@ const Notabase = require('./src/notabase') |
28382
11
555