Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

f5-conx-core

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

f5-conx-core - npm Package Compare versions

Comparing version 0.14.0 to 0.15.0

dist/bigip/nextClient.d.ts

155

dist/bigip/f5Client.js

@@ -74,2 +74,6 @@ /*

});
// setup ucsClient
this.ucs = new ucsClient_1.UcsClient(this.mgmtClient);
// setup qkviewClient
this.qkview = new qkviewClient_1.QkviewClient(this.mgmtClient);
// setup atc rpm ilx mgmt

@@ -110,2 +114,23 @@ this.atc = new atcMgmtClient_1.AtcMgmtClient(this.mgmtClient, this.extHttp);

const returnInfo = {};
// get device info
yield this.mgmtClient.makeRequest('/mgmt/shared/identified-devices/config/device-info')
.then(resp => {
// assign details to this and mgmtClient class
this.host = resp.data;
this.mgmtClient.hostInfo = resp.data;
returnInfo.hostname = this.host.hostname;
returnInfo.version = this.host.version;
returnInfo.product = this.host.product;
});
// check FAST installed by getting verion info
yield this.mgmtClient.makeRequest(this.atcMetaData.fast.endPoints.info)
.then(resp => {
this.fast = new fastClient_1.FastClient(resp.data, this.atcMetaData.fast, this.mgmtClient);
returnInfo.atc = {};
returnInfo.atc.fast = this.fast.version.version;
})
.catch(() => {
// do nothing... but catch the error from bubbling up and causing other issues
// this.logger.debug(err);
});
// check AS3 installed by getting verion info

@@ -122,97 +147,45 @@ yield this.mgmtClient.makeRequest(this.atcMetaData.as3.endPoints.info)

})
.catch(err => {
.catch(() => {
// do nothing... but catch the error from bubbling up and causing other issues
// this.logger.debug(err);
// debugger;
});
if (this.mgmtClient.bigType === 'cbip') {
// setup ucsClient
this.ucs = new ucsClient_1.UcsClient(this.mgmtClient);
// setup qkviewClient
this.qkview = new qkviewClient_1.QkviewClient(this.mgmtClient);
// get device info
yield this.mgmtClient.makeRequest('/mgmt/shared/identified-devices/config/device-info')
.then(resp => {
// assign details to this and mgmtClient class
this.host = resp.data;
this.mgmtClient.hostInfo = resp.data;
returnInfo.hostname = this.host.hostname;
returnInfo.version = this.host.version;
returnInfo.product = this.host.product;
})
.catch(() => {
// do nothing... but catch the error from bubbling up and causing other issues
// --- special does not have this endpoint... to catch, do nothing for now
// this.logger.debug(err);
});
// check FAST installed by getting verion info
yield this.mgmtClient.makeRequest(this.atcMetaData.fast.endPoints.info)
.then(resp => {
this.fast = new fastClient_1.FastClient(resp.data, this.atcMetaData.fast, this.mgmtClient);
// check DO installed by getting verion info
yield this.mgmtClient.makeRequest(this.atcMetaData.do.endPoints.info)
.then(resp => {
this.do = new doClient_1.DoClient(resp.data[0], this.atcMetaData.do, this.mgmtClient);
if (!returnInfo.atc) {
returnInfo.atc = {};
returnInfo.atc.fast = this.fast.version.version;
})
.catch(() => {
// do nothing... but catch the error from bubbling up and causing other issues
// this.logger.debug(err);
});
// check DO installed by getting verion info
yield this.mgmtClient.makeRequest(this.atcMetaData.do.endPoints.info)
.then(resp => {
this.do = new doClient_1.DoClient(resp.data[0], this.atcMetaData.do, this.mgmtClient);
if (!returnInfo.atc) {
returnInfo.atc = {};
}
returnInfo.atc.do = this.do.version.version;
})
.catch(() => {
// do nothing... but catch the error from bubbling up and causing other issues
// this.logger.debug(err);
});
// check TS installed by getting verion info
yield this.mgmtClient.makeRequest(this.atcMetaData.ts.endPoints.info)
.then(resp => {
this.ts = new tsClient_1.TsClient(resp.data, this.atcMetaData.ts, this.mgmtClient);
if (!returnInfo.atc) {
returnInfo.atc = {};
}
returnInfo.atc.ts = this.ts.version.version;
})
.catch(() => {
// do nothing... but catch the error from bubbling up and causing other issues
// this.logger.debug(err);
});
// check CF installed by getting verion info
yield this.mgmtClient.makeRequest(this.atcMetaData.cf.endPoints.info)
.then(resp => {
this.cf = new cfClient_1.CfClient(resp.data, this.mgmtClient);
if (!returnInfo.atc) {
returnInfo.atc = {};
}
returnInfo.atc.cf = this.cf.version.version;
})
.catch(() => {
// do nothing... but catch the error from bubbling up and causing other issues
// this.logger.debug(err);
});
}
else {
// mbip discover stuff
// check AS3 installed by getting verion info
yield this.mgmtClient.makeRequest(this.atcMetaData.as3.endPoints.info)
.then(resp => {
// if http 2xx, create as3 client
// notice the recast of resp.data type of "unknown" to "AtcInfo"
this.as3 = new as3Client_1.As3Client(resp.data, this.atcMetaData.as3, this.mgmtClient);
if (!returnInfo.atc) {
returnInfo.atc = {};
}
returnInfo.atc.as3 = this.as3.version.version;
})
.catch(err => {
// do nothing... but catch the error from bubbling up and causing other issues
// this.logger.debug(err);
debugger;
});
}
}
returnInfo.atc.do = this.do.version.version;
})
.catch(() => {
// do nothing... but catch the error from bubbling up and causing other issues
// this.logger.debug(err);
});
// check TS installed by getting verion info
yield this.mgmtClient.makeRequest(this.atcMetaData.ts.endPoints.info)
.then(resp => {
this.ts = new tsClient_1.TsClient(resp.data, this.atcMetaData.ts, this.mgmtClient);
if (!returnInfo.atc) {
returnInfo.atc = {};
}
returnInfo.atc.ts = this.ts.version.version;
})
.catch(() => {
// do nothing... but catch the error from bubbling up and causing other issues
// this.logger.debug(err);
});
// check CF installed by getting verion info
yield this.mgmtClient.makeRequest(this.atcMetaData.cf.endPoints.info)
.then(resp => {
this.cf = new cfClient_1.CfClient(resp.data, this.mgmtClient);
if (!returnInfo.atc) {
returnInfo.atc = {};
}
returnInfo.atc.cf = this.cf.version.version;
})
.catch(() => {
// do nothing... but catch the error from bubbling up and causing other issues
// this.logger.debug(err);
});
return returnInfo;

@@ -219,0 +192,0 @@ // return object of discovered services

@@ -21,3 +21,2 @@ /**

import { HttpResponse, uuidAxiosRequestConfig, AxiosResponseWithTimings } from "../utils/httpModels";
import { Mtoken } from './mModels';
/**

@@ -83,6 +82,2 @@ * F5 connectivity mgmt client

/**
* new token
*/
protected _mbip_token: Mtoken | undefined;
/**
* token timer value

@@ -129,4 +124,2 @@ *

private _cbip_auth;
private _mbip_auth;
bigType: 'cbip' | 'mbip';
/**

@@ -133,0 +126,0 @@ * @param options function options

@@ -59,2 +59,3 @@ /**

const atcAgent_1 = require("./atcAgent");
// import { Mtoken } from './mModels';
/**

@@ -83,2 +84,4 @@ * Used to inject http call timers

class MgmtClient {
// private _mbip_auth = '/api/v1/login'
// bigType: 'cbip' | 'mbip' = 'cbip';
/**

@@ -103,4 +106,2 @@ * @param options function options

this._cbip_auth = '/mgmt/shared/authn/login';
this._mbip_auth = '/api/v1/login';
this.bigType = 'cbip';
this.host = host;

@@ -135,3 +136,3 @@ this._user = user;

this._cbip_token = undefined;
this._mbip_token = undefined;
// this._mbip_token = undefined;
clearInterval(this._tokenIntervalId);

@@ -226,8 +227,35 @@ return tokenTimeOut;

this.events.emit('log-debug', `getting auth token from: ${this.host}:${this.port}`);
// GET basic auth -> /api/v1/login
yield this.axios({
url: this._mbip_auth,
auth: {
// // GET basic auth -> /api/v1/login
// await this.axios({
// url: this._mbip_auth,
// auth: {
// username: this._user,
// password: this._password
// }
// })
// .then(resp => {
// // capture entire token
// this._mbip_token = resp.data;
// // set token timeout for timer
// this.tokenTimeout = resp.data.expiresIn;
// this.events.emit('log-debug', `auth token aquired, timeout: ${this.tokenTimeout}`);
// this.tokenTimer(); // start token timer
// this.bigType = 'mbip';
// return;
// })
// .catch(err => {
// this.events.emit('log-debug', `special token request failed to ${this._mbip_auth}: ${err.message}`);
// // todo: add non http error details to log
// // no error here, we attemp the special api, then fallback to the original
// // reThrow the error back up the chain
// // return Promise.reject(err)
// })
// if (!this._mbip_token) {
return this.axios({
url: this._cbip_auth,
method: 'POST',
data: {
username: this._user,
password: this._password
password: this._password,
loginProviderName: this._provider
}

@@ -237,46 +265,18 @@ })

// capture entire token
this._mbip_token = resp.data;
this._cbip_token = resp.data['token'];
// set token timeout for timer
this.tokenTimeout = resp.data.expiresIn;
this.tokenTimeout = resp.data.token.timeout;
this.events.emit('log-debug', `auth token aquired, timeout: ${this.tokenTimeout}`);
this.tokenTimer(); // start token timer
this.bigType = 'mbip';
return;
})
.catch(err => {
this.events.emit('log-debug', `special token request failed to ${this._mbip_auth}: ${err.message}`);
this.events.emit('log-error', `token request failed: ${err.message}`);
// todo: add non http error details to log
// no error here, we attemp the special api, then fallback to the original
// reThrow the error back up the chain
// return Promise.reject(err)
return Promise.reject(err);
});
if (!this._mbip_token) {
return yield this.axios({
url: this._cbip_auth,
method: 'POST',
data: {
username: this._user,
password: this._password,
loginProviderName: this._provider
}
})
.then(resp => {
// capture entire token
this._cbip_token = resp.data['token'];
// set token timeout for timer
this.tokenTimeout = resp.data.token.timeout;
this.events.emit('log-debug', `auth token aquired, timeout: ${this.tokenTimeout}`);
this.tokenTimer(); // start token timer
return;
})
.catch(err => {
this.events.emit('log-error', `token request failed: ${err.message}`);
// todo: add non http error details to log
// reThrow the error back up the chain
return Promise.reject(err);
});
}
else {
return;
}
// } else {
// return;
// }
});

@@ -296,26 +296,25 @@ }

// if auth token has expired, it should have been cleared, get new one
if (!this._cbip_token && !this._mbip_token) {
if (!this._cbip_token) {
yield this.getToken();
}
if (this._cbip_token) {
// merge incoming options into requestDefaults object
options = Object.assign({
url: uri,
method: (options === null || options === void 0 ? void 0 : options.method) || undefined,
headers: Object.assign((options === null || options === void 0 ? void 0 : options.headers) || {}, {
'x-f5-auth-token': (_a = this._cbip_token) === null || _a === void 0 ? void 0 : _a.token
}),
data: (options === null || options === void 0 ? void 0 : options.data) || undefined
}, options);
}
else {
options = Object.assign({
url: uri,
method: (options === null || options === void 0 ? void 0 : options.method) || undefined,
headers: Object.assign((options === null || options === void 0 ? void 0 : options.headers) || {}, {
'Authorization': `Bearer ${this._mbip_token.token}`
}),
data: (options === null || options === void 0 ? void 0 : options.data) || undefined
}, options);
}
// if (this._cbip_token) {
// merge incoming options into requestDefaults object
options = Object.assign({
url: uri,
method: (options === null || options === void 0 ? void 0 : options.method) || undefined,
headers: Object.assign((options === null || options === void 0 ? void 0 : options.headers) || {}, {
'x-f5-auth-token': (_a = this._cbip_token) === null || _a === void 0 ? void 0 : _a.token
}),
data: (options === null || options === void 0 ? void 0 : options.data) || undefined
}, options);
// } else {
// options = Object.assign({
// url: uri,
// method: options?.method || undefined,
// headers: Object.assign(options?.headers || {}, {
// 'Authorization': `Bearer ${this._mbip_token.token}`
// }),
// data: options?.data || undefined
// }, options)
// }
// const requestDefaults = {

@@ -332,3 +331,3 @@ // url: uri,

// options = Object.assign(requestDefaults, options)
return yield this.axios.request(options);
return this.axios.request(options);
});

@@ -354,3 +353,3 @@ }

this._cbip_token = undefined; // clearing token details should get a new token
this._mbip_token = undefined;
// this._mbip_token = undefined;
}

@@ -357,0 +356,0 @@ // keep running the timer so everything looks good, but clear the rest when it reaches 0

@@ -147,3 +147,3 @@ /* eslint-disable @typescript-eslint/no-unused-vars */

this._mgmtClient.events.emit('log-debug', {
message: 'mini_ucs creationg confirmed',
message: 'mini_ucs creation confirmed',
data: resp.data

@@ -150,0 +150,0 @@ });

@@ -71,7 +71,11 @@ /*

// #####################################
// add option to allow self-signed cert
if ((reqBase === null || reqBase === void 0 ? void 0 : reqBase.rejectUnauthorized) === false) {
// add agent option
reqBase.httpsAgent = new https_1.default.Agent({ rejectUnauthorized: false });
}
// // add option to allow self-signed cert
// if (reqBase?.rejectUnauthorized === false) {
// // add agent option
// reqBase.httpsAgent = new https.Agent({ rejectUnauthorized: false });
// }
reqBase.httpsAgent =
(reqBase === null || reqBase === void 0 ? void 0 : reqBase.rejectUnauthorized) === false ?
new https_1.default.Agent({ rejectUnauthorized: false }) :
new https_1.default.Agent({ rejectUnauthorized: true });
// remove param

@@ -78,0 +82,0 @@ reqBase === null || reqBase === void 0 ? true : delete reqBase.rejectUnauthorized;

@@ -130,2 +130,3 @@ /*

// use logging level env to log "info" or "debug" request information
const url = config.baseURL ? `${config.baseURL}${config.url}` : config.url;
if (process.env[this.logEnv] === 'DEBUG') {

@@ -135,3 +136,3 @@ this.debug('debug-http-request', config);

else {
this.info(`HTTPS-REQU [${config.uuid}]: ${config.method} -> ${config.baseURL}${config.url}`);
this.info(`HTTPS-REQU [${config.uuid}]: ${config.method} -> ${url}`);
}

@@ -138,0 +139,0 @@ });

@@ -0,1 +1,2 @@

import { AxiosRequestHeaders } from 'axios';
/**

@@ -14,3 +15,3 @@ * Make generic HTTP request

body?: object;
headers?: object;
headers?: AxiosRequestHeaders;
basicAuth?: object;

@@ -17,0 +18,0 @@ advancedReturn?: boolean;

@@ -69,3 +69,3 @@ /* eslint-disable @typescript-eslint/ban-types */

url: uri,
headers: options['headers'] !== undefined ? options['headers'] : {},
headers: (options === null || options === void 0 ? void 0 : options.headers) ? options.headers : {},
data: options['body'] || null,

@@ -72,0 +72,0 @@ auth: options['basicAuth'] !== undefined ? {

{
"name": "f5-conx-core",
"author": "F5 Networks",
"version": "0.14.0",
"version": "0.15.0",
"description": "F5 SDK for JavaScript with Typescript type definitions",

@@ -6,0 +6,0 @@ "license": "SEE LICENSE IN LICENSE file",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc