@@ -2,7 +2,7 @@ import axios from "axios";
22import * as httpsModule from "https" ;
33import * as vscode from "vscode" ;
44import * as semver from "semver" ;
5- import {
5+ import BasicAuthorization , {
66 getResolvedConnectionSpec ,
77 config ,
88 extensionContext ,
@@ -57,7 +57,7 @@ export interface ConnectionSettings {
5757 port : number ;
5858 superserverPort ?: number ;
5959 pathPrefix ?: string ;
60- ns : string ;
60+ ns : string | undefined ;
6161 auth : Authorization ;
6262 docker ?: boolean ;
6363 dockerService ?: string ;
@@ -171,7 +171,7 @@ export class AtelierAPI {
171171 webServer : { scheme, host, port, pathPrefix = "" } ,
172172 auth,
173173 } = connSpec ;
174- this . _config . auth = auth ;
174+ this . _config . auth = auth ?? new BasicAuthorization ( ) ;
175175 this . _config . https = scheme == "https" ;
176176 this . _config . host = host ;
177177 this . _config . port = port ;
@@ -200,7 +200,7 @@ export class AtelierAPI {
200200
201201 public terminalUrl ( ) : string {
202202 const { host, https, port, apiVersion, pathPrefix } = this . config ;
203- return apiVersion >= 7
203+ return apiVersion ! >= 7
204204 ? `${ https ? "wss" : "ws" } ://${ host } :${ port } ${ pathPrefix } /api/atelier/v${ apiVersion } /%25SYS/terminal`
205205 : "" ;
206206 }
@@ -232,7 +232,11 @@ export class AtelierAPI {
232232
233233 private setConnection ( workspaceFolderName : string , namespace ?: string ) : void {
234234 this . configName = workspaceFolderName ;
235- const conn = config ( "conn" , workspaceFolderName ) ;
235+ const rawConn = config ( "conn" , workspaceFolderName ) ;
236+ const conn = {
237+ ...rawConn ,
238+ auth : new BasicAuthorization ( rawConn . username , rawConn . password ) ,
239+ } ;
236240 let serverName = workspaceFolderName . toLowerCase ( ) ;
237241 if ( config ( "intersystems.servers" , workspaceFolderName ) . has ( serverName ) ) {
238242 this . externalServer = true ;
@@ -254,7 +258,7 @@ export class AtelierAPI {
254258 webServer : { scheme, host, port, pathPrefix = "" } ,
255259 auth,
256260 superServer,
257- } = getResolvedConnectionSpec ( serverName , config ( "intersystems.servers" , workspaceFolderName ) . get ( serverName ) ) ;
261+ } = getResolvedConnectionSpec ( serverName , config ( "intersystems.servers" , workspaceFolderName ) . get ( serverName ) ) ! ;
258262 this . _config = {
259263 serverName,
260264 active : this . externalServer ? ! inactiveServerIds . has ( serverName ) : conn . active ,
@@ -333,7 +337,7 @@ export class AtelierAPI {
333337 if ( ! active || ! port || ! host ) {
334338 return Promise . reject ( ) ;
335339 }
336- if ( minVersion > apiVersion ) {
340+ if ( minVersion > apiVersion ! ) {
337341 return Promise . reject ( `${ path } not supported by API version ${ apiVersion } ` ) ;
338342 }
339343 const originalPath = path ;
@@ -348,7 +352,7 @@ export class AtelierAPI {
348352 if ( ! params ) {
349353 return "" ;
350354 }
351- const result = [ ] ;
355+ const result : string [ ] = [ ] ;
352356 Object . keys ( params ) . forEach ( ( key ) => {
353357 const value = params [ key ] ;
354358 if ( typeof value === "boolean" ) {
@@ -379,7 +383,7 @@ export class AtelierAPI {
379383
380384 const cookies = this . cookies ;
381385 const mapKey = this . mapKey ( ) ;
382- let auth : Promise < any > ;
386+ let auth : Promise < any > | undefined ;
383387 let authRequest = authRequestMap . get ( mapKey ) ;
384388 if ( cookies . length || ( method === "HEAD" && ! originalPath ) ) {
385389 // Only send basic authorization if username and password specified (including blank, for unauthenticated access)
@@ -417,7 +421,7 @@ export class AtelierAPI {
417421 }
418422 } ;
419423 try {
420- cookie = await auth ;
424+ cookie = await auth ! ;
421425 reqTs = new Date ( ) ;
422426 const response = await axios . request ( {
423427 method,
@@ -598,7 +602,7 @@ export class AtelierAPI {
598602 . slice ( data . version . indexOf ( ") " ) + 2 )
599603 . split ( " " )
600604 . shift ( )
601- ) . version ;
605+ ) ! . version ;
602606 if ( this . ns && this . ns . length && ! data . namespaces . includes ( this . ns ) && checkNs ) {
603607 throw {
604608 code : "WrongNamespace" ,
@@ -649,7 +653,7 @@ export class AtelierAPI {
649653 const params : Record < string , string > = { } ;
650654 name = this . transformNameIfCsp ( name ) ;
651655 if (
652- this . config . apiVersion >= 4 &&
656+ this . config . apiVersion ! >= 4 &&
653657 vscode . workspace
654658 . getConfiguration (
655659 "objectscript" ,
0 commit comments