@@ -67,7 +67,7 @@ export type CreateServerClientOpts = {
6767 */
6868export enum HTTPAuthType {
6969 None = "none" ,
70- StaticBearer = "static-bearer " ,
70+ StaticBearer = "static_bearer_token " ,
7171 OAuth = "oauth"
7272}
7373
@@ -775,40 +775,45 @@ export class ServerClient {
775775 }
776776
777777 /**
778- * Builds a full workflow URL based on the input.
779- *
780- * @param input - Either a full URL (with or without protocol) or just an endpoint ID.
781- *
782- * @returns The fully constructed URL.
783- *
784- * @throws If the input is not a valid URL and not an ID, the function assumes it's an endpoint ID .
785- *
786- * @example
787- * // Full URL input
788- * this.buildWorkflowUrl("https://en123.m.pipedream.net");
789- * // Returns: "https://en123.m.pipedream.net"
790- *
791- * @example
792- * // Partial URL (without protocol)
793- * this.buildWorkflowUrl("en123.m.pipedream.net");
794- * // Returns: "https://en123.m.pipedream.net"
795- *
796- * @example
797- * // ID only input
798- * this.buildWorkflowUrl("en123");
799- * // Returns: "https://en123.yourdomain.com" (where `yourdomain.com` is set in `baseWorkflowDomain`)
800- */
778+ * Builds a full workflow URL based on the input.
779+ *
780+ * @param input - Either a full URL (with or without protocol) or just an endpoint ID.
781+ *
782+ * @returns The fully constructed URL.
783+ *
784+ * @throws If the input is a malformed URL, throws an error with a clear message .
785+ *
786+ * @example
787+ * // Full URL input
788+ * this.buildWorkflowUrl("https://en123.m.pipedream.net");
789+ * // Returns: "https://en123.m.pipedream.net"
790+ *
791+ * @example
792+ * // Partial URL (without protocol)
793+ * this.buildWorkflowUrl("en123.m.pipedream.net");
794+ * // Returns: "https://en123.m.pipedream.net"
795+ *
796+ * @example
797+ * // ID only input
798+ * this.buildWorkflowUrl("en123");
799+ * // Returns: "https://en123.yourdomain.com" (where `yourdomain.com` is set in `baseWorkflowDomain`)
800+ */
801801 private buildWorkflowUrl ( input : string ) : string {
802802 let url : string ;
803803
804804 const isUrl = input . includes ( "." ) || input . startsWith ( "http" ) ;
805805
806806 if ( isUrl ) {
807807 // Try to parse the input as a URL
808- const parsedUrl = new URL ( input . startsWith ( "http" )
809- ? input
810- : `https://${ input } ` ) ;
811- url = parsedUrl . href ;
808+ try {
809+ const urlString = input . startsWith ( "http" )
810+ ? input
811+ : `https://${ input } ` ;
812+ const parsedUrl = new URL ( urlString ) ;
813+ url = parsedUrl . href ;
814+ } catch ( error ) {
815+ throw new Error ( `The provided URL is malformed: "${ input } ". Please provide a valid URL.` ) ;
816+ }
812817 } else {
813818 // If the input is an ID, construct the full URL using the base domain
814819 url = `https://${ input } .${ this . baseWorkflowDomain } ` ;
0 commit comments