@@ -13,43 +13,68 @@ const NOTION_PAGE_PROPERTIES = {
1313 type : "string" ,
1414 example : "New Beauty Title" ,
1515 options : ( ) => undefined ,
16- convertToNotion : ( property ) => ( {
17- title : utils . buildTextProperty ( property . value ) ,
18- } ) ,
16+ convertToNotion : ( property ) => {
17+ if ( typeof property . value !== "string" ) {
18+ throw new Error ;
19+ }
20+ return {
21+ title : utils . buildTextProperty ( property . value ) ,
22+ } ;
23+ } ,
1924 } ,
2025 rich_text : {
2126 type : "string" ,
2227 example : "A beauty text value" ,
2328 options : ( ) => undefined ,
24- convertToNotion : ( property ) => ( {
25- rich_text : utils . buildTextProperty ( property . value ) ,
26- } ) ,
29+ convertToNotion : ( property ) => {
30+ if ( typeof property . value !== "string" ) {
31+ throw new Error ;
32+ }
33+ return {
34+ rich_text : utils . buildTextProperty ( property . value ) ,
35+ } ;
36+ } ,
2737 } ,
2838 number : {
2939 type : "integer" ,
3040 example : "59" ,
3141 options : ( ) => undefined ,
32- convertToNotion : ( property ) => ( {
33- number : property . value ,
34- } ) ,
42+ convertToNotion : ( property ) => {
43+ if ( isNaN ( property . value ) ) {
44+ throw new Error ;
45+ }
46+ return {
47+ number : property . value ,
48+ } ;
49+ } ,
3550 } ,
3651 status : {
3752 type : "string" ,
3853 options : ( property ) => property . status ?. options . map ( ( option ) => option . name ) ,
39- convertToNotion : ( property ) => ( {
40- status : {
41- name : property . value ,
42- } ,
43- } ) ,
54+ convertToNotion : ( property ) => {
55+ if ( typeof property . value !== "string" ) {
56+ throw new Error ;
57+ }
58+ return {
59+ status : {
60+ name : property . value ,
61+ } ,
62+ } ;
63+ } ,
4464 } ,
4565 select : {
4666 type : "string" ,
4767 options : ( property ) => property . select ?. options . map ( ( option ) => option . name ) ,
48- convertToNotion : ( property ) => ( {
49- select : {
50- name : property . value ,
51- } ,
52- } ) ,
68+ convertToNotion : ( property ) => {
69+ if ( typeof property . value !== "string" ) {
70+ throw new Error ;
71+ }
72+ return {
73+ select : {
74+ name : property . value ,
75+ } ,
76+ } ;
77+ } ,
5378 } ,
5479 multi_select : {
5580 type : "string[]" ,
@@ -113,25 +138,40 @@ const NOTION_PAGE_PROPERTIES = {
113138 type : "string" ,
114139 example : "https://pipedream.com" ,
115140 options : ( ) => undefined ,
116- convertToNotion : ( property ) => ( {
117- url : property . value ,
118- } ) ,
141+ convertToNotion : ( property ) => {
142+ if ( typeof property . value !== "string" ) {
143+ throw new Error ;
144+ }
145+ return {
146+ url : property . value ,
147+ } ;
148+ } ,
119149 } ,
120150 email : {
121151 type : "string" ,
122152123153 options : ( ) => undefined ,
124- convertToNotion : ( property ) => ( {
125- email : property . value ,
126- } ) ,
154+ convertToNotion : ( property ) => {
155+ if ( typeof property . value !== "string" ) {
156+ throw new Error ;
157+ }
158+ return {
159+ email : property . value ,
160+ } ;
161+ } ,
127162 } ,
128163 phone_number : {
129164 type : "string" ,
130165 example : "999-999-9999" ,
131166 options : ( ) => undefined ,
132- convertToNotion : ( property ) => ( {
133- phone_number : property . value ,
134- } ) ,
167+ convertToNotion : ( property ) => {
168+ if ( typeof property . value !== "string" ) {
169+ throw new Error ;
170+ }
171+ return {
172+ phone_number : property . value ,
173+ } ;
174+ } ,
135175 } ,
136176 relation : {
137177 type : "string[]" ,
0 commit comments