|
1 |
| -import { |
2 |
| - APSConnectorClientConfig |
3 |
| -} from "../_generated/@solace-iot-team/apim-server-openapi-browser"; |
4 |
| -import { Mutex, MutexInterface } from 'async-mutex'; |
5 |
| -import { APClientConnectorOpenApi } from './APClientConnectorOpenApi'; |
| 1 | +// import { |
| 2 | +// APSConnectorClientConfig |
| 3 | +// } from "../_generated/@solace-iot-team/apim-server-openapi-browser"; |
| 4 | +// import { Mutex, MutexInterface } from 'async-mutex'; |
| 5 | +// import { APClientConnectorOpenApi } from './APClientConnectorOpenApi'; |
6 | 6 | import { APTimeoutError } from './APError';
|
7 | 7 | import { APFetch, APFetchResult } from './APFetch';
|
8 | 8 | import { APSClientOpenApi } from './APSClientOpenApi';
|
@@ -79,49 +79,49 @@ export class APClientServerRaw {
|
79 | 79 | }
|
80 | 80 | }
|
81 | 81 |
|
82 |
| -export class APClientConnectorRaw { |
83 |
| - private static componentName = 'APClientConnectorRaw'; |
84 |
| - private static baseUrl: string; |
85 |
| - private static basePath: string; |
86 |
| - private static mutex = new Mutex(); |
87 |
| - private static mutexReleaser: MutexInterface.Releaser; |
| 82 | +// class APClientConnectorRaw { |
| 83 | +// private static componentName = 'APClientConnectorRaw'; |
| 84 | +// private static baseUrl: string; |
| 85 | +// private static basePath: string; |
| 86 | +// private static mutex = new Mutex(); |
| 87 | +// private static mutexReleaser: MutexInterface.Releaser; |
88 | 88 |
|
89 |
| - public static initialize = async (connectorClientConfig: APSConnectorClientConfig) => { |
90 |
| - // const funcName = 'initialize'; |
91 |
| - // const logName= `${APClientConnectorRaw.componentName}.${funcName}()`; |
92 |
| - APClientConnectorRaw.mutexReleaser = await APClientConnectorRaw.mutex.acquire(); |
93 |
| - APClientConnectorRaw.baseUrl = APClientConnectorOpenApi.constructBaseUrl(connectorClientConfig); |
94 |
| - // console.log(`${logName}: APClientConnectorRaw.baseUrl = ${APClientConnectorRaw.baseUrl}`); |
95 |
| - APClientConnectorRaw.basePath = APClientConnectorOpenApi.constructOpenApiBase(connectorClientConfig); |
96 |
| - // console.log(`${logName}: APClientConnectorRaw.basePath = ${APClientConnectorRaw.basePath}`); |
97 |
| - } |
| 89 | +// public static initialize = async (connectorClientConfig: APSConnectorClientConfig) => { |
| 90 | +// const funcName = 'initialize'; |
| 91 | +// const logName= `${APClientConnectorRaw.componentName}.${funcName}()`; |
| 92 | +// APClientConnectorRaw.mutexReleaser = await APClientConnectorRaw.mutex.acquire(); |
| 93 | +// APClientConnectorRaw.baseUrl = APClientConnectorOpenApi.constructBaseUrl(connectorClientConfig); |
| 94 | +// console.log(`${logName}: APClientConnectorRaw.baseUrl = ${APClientConnectorRaw.baseUrl}`); |
| 95 | +// APClientConnectorRaw.basePath = APClientConnectorOpenApi.constructOpenApiBase(connectorClientConfig); |
| 96 | +// console.log(`${logName}: APClientConnectorRaw.basePath = ${APClientConnectorRaw.basePath}`); |
| 97 | +// } |
98 | 98 |
|
99 |
| - public static unInitialize = async (): Promise<void> => { |
100 |
| - APClientConnectorRaw.mutexReleaser(); |
101 |
| - } |
| 99 | +// public static unInitialize = async (): Promise<void> => { |
| 100 | +// APClientConnectorRaw.mutexReleaser(); |
| 101 | +// } |
102 | 102 |
|
103 |
| - public static getBasePath = (): string => { |
104 |
| - return APClientConnectorRaw.basePath; |
105 |
| - } |
106 |
| - public static httpGET_BasePath = async (): Promise<any> => { |
107 |
| - const funcName = 'httpGET_BasePath'; |
108 |
| - const logName= `${APClientConnectorRaw.componentName}.${funcName}()`; |
109 |
| - let response: Response; |
110 |
| - let responseBody: any; |
111 |
| - try { |
112 |
| - try { |
113 |
| - response = await APFetch.fetchWithTimeoutAndRandomBasicAuth(APClientConnectorRaw.basePath, FetchTimeout_ms); |
114 |
| - } catch (e: any) { |
115 |
| - if(e.name === 'AbortError') { |
116 |
| - throw new APTimeoutError(logName, "fetch timeout", { url: APClientConnectorRaw.basePath, timeout_ms: FetchTimeout_ms}); |
117 |
| - } else throw e; |
118 |
| - } |
119 |
| - const result: APFetchResult = await APFetch.getFetchResult(response); |
120 |
| - responseBody = result.body; |
121 |
| - if(!response.ok) APClientRaw.handleError(logName, response, responseBody); |
122 |
| - return responseBody; |
123 |
| - } catch (e) { |
124 |
| - throw e; |
125 |
| - } |
126 |
| - } |
127 |
| -} |
| 103 | +// public static getBasePath = (): string => { |
| 104 | +// return APClientConnectorRaw.basePath; |
| 105 | +// } |
| 106 | +// public static httpGET_BasePath = async (): Promise<any> => { |
| 107 | +// const funcName = 'httpGET_BasePath'; |
| 108 | +// const logName= `${APClientConnectorRaw.componentName}.${funcName}()`; |
| 109 | +// let response: Response; |
| 110 | +// let responseBody: any; |
| 111 | +// try { |
| 112 | +// try { |
| 113 | +// response = await APFetch.fetchWithTimeoutAndRandomBasicAuth(APClientConnectorRaw.basePath, FetchTimeout_ms); |
| 114 | +// } catch (e: any) { |
| 115 | +// if(e.name === 'AbortError') { |
| 116 | +// throw new APTimeoutError(logName, "fetch timeout", { url: APClientConnectorRaw.basePath, timeout_ms: FetchTimeout_ms}); |
| 117 | +// } else throw e; |
| 118 | +// } |
| 119 | +// const result: APFetchResult = await APFetch.getFetchResult(response); |
| 120 | +// responseBody = result.body; |
| 121 | +// if(!response.ok) APClientRaw.handleError(logName, response, responseBody); |
| 122 | +// return responseBody; |
| 123 | +// } catch (e) { |
| 124 | +// throw e; |
| 125 | +// } |
| 126 | +// } |
| 127 | +// } |
0 commit comments