@@ -600,6 +600,8 @@ var Stack = function () {
600600 this . config = _config2 . default ;
601601 this . cachePolicy = _index2 . default . policies . IGNORE_CACHE ;
602602 this . provider = _index2 . default . providers ( 'localstorage' ) ;
603+ console . error ( stack_arguments . length ) ;
604+
603605 switch ( stack_arguments . length ) {
604606 case 1 :
605607 if ( _typeof ( stack_arguments [ 0 ] ) === "object" && typeof stack_arguments [ 0 ] . api_key === "string" && typeof stack_arguments [ 0 ] . delivery_token === "string" && typeof stack_arguments [ 0 ] . environment === "string" ) {
@@ -612,7 +614,36 @@ var Stack = function () {
612614 } else {
613615 console . error ( "Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid." ) ;
614616 }
615- case ( 3 , 4 , 5 ) :
617+ case 3 :
618+ if ( typeof stack_arguments [ 0 ] === "string" && typeof stack_arguments [ 1 ] === "string" && typeof stack_arguments [ 2 ] === "string" ) {
619+ this . headers = {
620+ api_key : stack_arguments [ 0 ] ,
621+ access_token : stack_arguments [ 1 ]
622+ } ;
623+ this . environment = stack_arguments [ 2 ] ;
624+ return this ;
625+ } else {
626+ console . error ( "Kindly provide valid string parameters." ) ;
627+ }
628+ case 4 :
629+ if ( typeof stack_arguments [ 0 ] === "string" && typeof stack_arguments [ 1 ] === "string" && typeof stack_arguments [ 2 ] === "string" ) {
630+ this . headers = {
631+ api_key : stack_arguments [ 0 ] ,
632+ access_token : stack_arguments [ 1 ]
633+ } ;
634+ this . environment = stack_arguments [ 2 ] ;
635+ return this ;
636+ } else {
637+ console . error ( "Kindly provide valid string parameters." ) ;
638+ }
639+ if ( stack_arguments [ 3 ] ) {
640+ if ( typeof stack_arguments [ 3 ] === "string" && stack_arguments [ 3 ] . region !== "us" && stack_arguments [ 3 ] . region === "eu" ) {
641+ _config2 . default [ 'host' ] = stack_arguments [ 0 ] . region + "-" + "cdn.contentstack.com" ;
642+ } else if ( _typeof ( stack_arguments [ 3 ] ) === 'object' ) {
643+ this . fetchOptions = stack_arguments [ 3 ] ;
644+ }
645+ }
646+ case 5 :
616647 if ( typeof stack_arguments [ 0 ] === "string" && typeof stack_arguments [ 1 ] === "string" && typeof stack_arguments [ 2 ] === "string" ) {
617648 this . headers = {
618649 api_key : stack_arguments [ 0 ] ,
@@ -630,7 +661,6 @@ var Stack = function () {
630661 this . fetchOptions = stack_arguments [ 3 ] ;
631662 }
632663 }
633-
634664 if ( stack_arguments [ 4 ] && _typeof ( stack_arguments [ 4 ] ) === 'object' ) {
635665 this . fetchOptions = stack_arguments [ 3 ] ;
636666 }
0 commit comments