File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export default {
77 key : "notion-create-database" ,
88 name : "Create Database" ,
99 description : "Create a database and its initial data source. [See the documentation](https://developers.notion.com/reference/database-create)" ,
10- version : "0.1.7 " ,
10+ version : "0.1.8 " ,
1111 annotations : {
1212 destructiveHint : false ,
1313 openWorldHint : true ,
@@ -37,6 +37,42 @@ export default {
3737 } ,
3838 } ,
3939 async run ( { $ } ) {
40+ const parsedProperties = utils . parseObject ( this . properties ) ;
41+ const properties = parsedProperties && typeof parsedProperties === "object"
42+ ? Object . fromEntries (
43+ Object . entries ( parsedProperties ) . map ( ( [
44+ key ,
45+ value ,
46+ ] ) => {
47+ if ( typeof value === "string" ) {
48+ return [
49+ key ,
50+ {
51+ [ value ] : { } ,
52+ } ,
53+ ] ;
54+ }
55+ // Normalize {type:"X"} objects missing their type-key: {type:"checkbox"} → {checkbox:{}}
56+ if ( value && typeof value === "object" && "type" in value ) {
57+ const typeKey = value . type ;
58+ if ( typeKey && typeof typeKey === "string" && ! ( typeKey in value ) ) {
59+ return [
60+ key ,
61+ {
62+ ...value ,
63+ [ typeKey ] : { } ,
64+ } ,
65+ ] ;
66+ }
67+ }
68+ return [
69+ key ,
70+ value ,
71+ ] ;
72+ } ) ,
73+ )
74+ : parsedProperties ;
75+
4076 const response = await this . notion . createDatabase ( {
4177 parent : {
4278 type : "page_id" ,
@@ -51,7 +87,7 @@ export default {
5187 } ,
5288 ] ,
5389 initial_data_source : {
54- properties : utils . parseObject ( this . properties ) ,
90+ properties,
5591 } ,
5692 } ) ;
5793
Original file line number Diff line number Diff line change 11{
22 "name" : " @pipedream/notion" ,
3- "version" : " 1.0.10 " ,
3+ "version" : " 1.0.11 " ,
44 "description" : " Pipedream Notion Components" ,
55 "main" : " notion.app.mjs" ,
66 "keywords" : [
You can’t perform that action at this time.
0 commit comments