File tree Expand file tree Collapse file tree 6 files changed +16
-11
lines changed Expand file tree Collapse file tree 6 files changed +16
-11
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @vesselapi/integrations" ,
3- "version" : " 0.0.49 " ,
3+ "version" : " 0.0.50 " ,
44 "description" : " Vessel integrations" ,
55 "main" : " dist/index.js" ,
66 "module" : " dist/index.mjs" ,
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ const BASE_URL = `${API_DOMAIN}/${API_VERSION}` as HttpsUrl;
1818
1919const request = makeRequestFactory ( async ( auth , options ) => ( {
2020 ...options ,
21- url : `${ BASE_URL } / ${ options . url } ` ,
21+ url : `${ BASE_URL } ${ options . url } ` ,
2222 headers : {
2323 ...options . headers ,
2424 Accept : 'application/json' ,
@@ -74,11 +74,15 @@ const makeClient = (): DialpadClient => {
7474 list : listObject ( 'contacts' , listResponseSchema ( dialpadContactSchema ) ) ,
7575 create : createObject < DialpadContactCreate > (
7676 'contacts' ,
77- dialpadContactSchema ,
77+ dialpadContactSchema . partial ( ) . required ( {
78+ id : true ,
79+ } ) ,
7880 ) ,
7981 update : updateObject < DialpadContactUpdate > (
8082 'contacts' ,
81- dialpadContactSchema ,
83+ dialpadContactSchema . partial ( ) . required ( {
84+ id : true ,
85+ } ) ,
8286 ) ,
8387 } ,
8488 calls : {
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export const dialpadUserSchema = z
3333 license : z . string ( ) ,
3434 muted : z . boolean ( ) ,
3535 office_id : z . string ( ) ,
36- phone_numbers : z . array ( z . string ( ) ) ,
36+ phone_numbers : z . array ( custom . formattedPhoneNumber ( ) ) ,
3737 state : z . string ( ) ,
3838 timezone : z . string ( ) ,
3939 } )
@@ -49,9 +49,9 @@ export const dialpadContactSchema = z.object({
4949 extension : z . string ( ) ,
5050 job_title : z . string ( ) ,
5151 owner_id : z . string ( ) ,
52- phones : z . array ( z . string ( ) ) ,
52+ phones : z . array ( custom . formattedPhoneNumber ( ) ) ,
5353 primary_email : z . string ( ) ,
54- primary_phone : z . string ( ) ,
54+ primary_phone : custom . formattedPhoneNumber ( ) ,
5555 type : z . enum ( [ 'shared' , 'local' ] ) ,
5656 urls : z . array ( z . string ( ) ) ,
5757} ) ;
@@ -119,7 +119,7 @@ const targetSchema = z
119119 email : z . string ( ) ,
120120 id : z . string ( ) ,
121121 name : z . string ( ) ,
122- phone : z . string ( ) ,
122+ phone : custom . formattedPhoneNumber ( ) ,
123123 type : z . string ( ) ,
124124 } )
125125 . passthrough ( ) ;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ const BASE_URL = `${API_DOMAIN}/${API_VERSION}` as HttpsUrl;
1919
2020const request = makeRequestFactory ( async ( auth , options ) => ( {
2121 ...options ,
22- url : `${ BASE_URL } / ${ options . url } ` ,
22+ url : `${ BASE_URL } ${ options . url } ` ,
2323 headers : {
2424 ...options . headers ,
2525 Authorization : `Bearer ${ await auth . getToken ( ) } ` ,
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ export const ringcentralContactSchema = z
8787 lastName : z . string ( ) ,
8888 company : z . string ( ) . optional ( ) ,
8989 email : z . string ( ) . optional ( ) ,
90- businessPhone : z . string ( ) ,
90+ businessPhone : custom . formattedPhoneNumber ( ) ,
9191 } )
9292 . passthrough ( ) ;
9393
Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ export const json = () => z.object({}).catchall(z.any()).optional();
1515export const formattedPhoneNumber = ( format ?: NumberFormat ) =>
1616 z
1717 . string ( )
18- . refine ( ( value ) => {
18+ . refine ( ( value ?) => {
19+ if ( ! value ) return false ;
1920 return parsePhoneNumber ( value ) ?. isValid ( ) ;
2021 } )
2122 . transform ( ( value ) => {
You can’t perform that action at this time.
0 commit comments