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

osactl

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

osactl - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

lib/osa/account.js

17

lib/main.js

@@ -6,3 +6,3 @@ 'use strict';

});
exports.default = exports.SSHSession = exports.Session = exports.EndpointHost = exports.Host = exports.APSSession = exports.APSToken = exports.BAAPIClient = exports.OAAPIClient = exports.XAPIDouble = exports.XAPIBigInt = exports.Credentials = exports.OSAVersion = exports.OSACtl = undefined;
exports.default = exports.SSHSession = exports.Session = exports.EndpointHost = exports.Host = exports.NameProvider = exports.APSSession = exports.APSToken = exports.BAAPIClient = exports.OAAPIClient = exports.XAPIDouble = exports.XAPIBigInt = exports.Credentials = exports.OSAVersion = exports.OSACtl = undefined;

@@ -36,2 +36,11 @@ var _clients = require('./api/clients.js');

var _account = require('./osa/account.js');
Object.defineProperty(exports, 'NameProvider', {
enumerable: true,
get: function () {
return _account.NameProvider;
}
});
var _ctl = require('./osa/ctl.js');

@@ -48,5 +57,5 @@

var _osaver = require('./util/osaver.js');
var _osaVersion = require('./util/osa-version.js');
var _osaver2 = _interopRequireDefault(_osaver);
var _osaVersion2 = _interopRequireDefault(_osaVersion);

@@ -84,3 +93,3 @@ var _credentials = require('./util/credentials.js');

exports.OSACtl = _ctl2.default;
exports.OSAVersion = _osaver2.default;
exports.OSAVersion = _osaVersion2.default;
exports.Credentials = _credentials2.default;

@@ -87,0 +96,0 @@ exports.APSToken = _token2.default;

@@ -29,6 +29,2 @@ 'use strict';

var _entity = require('./entity.js');
var _entity2 = _interopRequireDefault(_entity);
var _credentials = require('../util/credentials.js');

@@ -38,5 +34,5 @@

var _osaver = require('../util/osaver.js');
var _osaVersion = require('../util/osa-version.js');
var _osaver2 = _interopRequireDefault(_osaver);
var _osaVersion2 = _interopRequireDefault(_osaVersion);

@@ -65,2 +61,4 @@ var _clients = require('../api/clients.js');

var _account = require('./account.js');
var _session3 = require('../cp/session.js');

@@ -70,2 +68,6 @@

var _entity = require('./entity.js');
var _entity2 = _interopRequireDefault(_entity);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -76,16 +78,12 @@

const DEFAULTS = {
VERSION: null,
HUB_URL: 'http://127.0.0.1:4444/wd/hub',
BROWSER: _seleniumWebdriver2.default.Browser.FIREFOX
};
class OSACtl extends _entityMap.EntityMap {
constructor(version) {
// defaults
constructor(config) {
super();
this._version = DEFAULTS.VERSION;
this._hasBA = true;
this._version = null;
this._apscURL = null;
this._builder = new _seleniumWebdriver2.default.Builder().forBrowser(DEFAULTS.BROWSER).usingServer(DEFAULTS.HUB_URL);
this._builder = new _seleniumWebdriver2.default.Builder().forBrowser(_seleniumWebdriver2.default.Browser.FIREFOX).usingServer('http://127.0.0.1:4444/wd/hub');
this._provider = new _account.Provider(this);
this.oaAPI = new Proxy((name, parameters) => {

@@ -137,7 +135,17 @@ this._assertOAAPI();

});
if (version) {
if (_util2.default.isString(version) && _osaver2.default.isValidVersion(version)) {
this._version = new _osaver2.default(version);
if (!_util2.default.isObject(config)) {
return;
}
const { hasBA, version } = config;
if ('hasBA' in config) {
this._hasBA = Boolean(hasBA);
}
if ('version' in config) {
if (_osaVersion2.default.isVersionString(version)) {
this._version = new _osaVersion2.default(version);
} else {
throw new Error('\'version\' must be a string containing a valid OSA version or a falsy value');
throw new Error('\'version\' must be a string containing a valid OSA version or a falsy value if it is defined');
}

@@ -147,2 +155,10 @@ }

get hasBA() {
return this._hasBA;
}
set hasBA(_) {
throw new Error('BA availablility cannot be changed');
}
get version() {

@@ -153,3 +169,3 @@ return this._version;

set version(_) {
throw new Error('Version cannot be changed after instantiation');
throw new Error('Version cannot be changed');
}

@@ -308,2 +324,6 @@

setBAAPI(url, options, credentials) {
if (!this.hasBA) {
throw new Error('This OSA installation does not have BA, check \'config.hasBA\' argument to the constructor');
}
this._baAPI = new _clients.BAAPIClient(url, options, credentials);

@@ -405,6 +425,14 @@

createCustomer(parameters) {
this._assertOAAPI();
get provider() {
return this._provider;
}
set provider(_) {
throw new Error('Provider account cannot be changed');
}
createCustomer(parameters, contactInfo) {
return this.provider.createCustomer(parameters, contactInfo);
}
createServicePlan(parameters) {

@@ -416,7 +444,7 @@ this._assertOAAPI();

OSACtl._ENTITY_TYPES = {
CP_URL: Symbol('OSACtl._ENTITY_TYPES.CP_URL'),
APPLICATION: _application2.default,
ENTITY: _entity2.default
CP_URL: Symbol('OSACtl.ENTITY_TYPES.CP_URL'),
ENTITY: _entity2.default,
APPLICATION: _application2.default
};
OSACtl.APSTOKEN_TYPES = _token2.default.TYPES;
exports.default = OSACtl;

@@ -7,11 +7,19 @@ 'use strict';

var _ctl = require('./ctl.js');
var _util = require('../util/util.js');
var _ctl2 = _interopRequireDefault(_ctl);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// import OSACtl from './ctl.js';
class OSAEntity {
static isOSACtl(osa) {
return _util2.default.isObject(osa) && _util2.default.isFunction(osa.constructor) && osa.constructor.name === 'OSACtl'; // temporary
//return osa instanceof OSACtl;
}
constructor(osa) {
if (!(osa instanceof _ctl2.default)) {
if (!this.constructor.isOSACtl(osa)) {
throw new Error('\'osa\' must be an instance of \'OSACtl\'');

@@ -21,7 +29,13 @@ }

this._osa = osa;
osa._addEntity(this.constructor, this, this);
//osa._addEntity(this.constructor, this, this);
}
get osa() {
return this._osa;
const osa = this._osa;
if (_util2.default.isNull(osa)) {
throw new Error('This OSA entity is no longer attached to an \'OSACtl\' instance');
}
return osa;
}

@@ -32,4 +46,9 @@

}
delete() {
this.osa._removeEntity(this.constructor, this);
this._osa = null;
}
}
exports.default = OSAEntity;

@@ -15,2 +15,6 @@ 'use strict';

var _crypto = require('crypto');
var _crypto2 = _interopRequireDefault(_crypto);
var _coreUtilIs = require('core-util-is');

@@ -28,3 +32,2 @@

const util = Object.assign({}, _util2.default, _coreUtilIs2.default, {
isNonEmptyString(value) {

@@ -142,14 +145,20 @@ return util.isString(value) && value.length > 0;

isEncoding: Buffer.isEncoding,
isNaN: Number.isNaN,
pad(string, char, length) {
// negative length will pad from the left, positive - from the right
string = String(string);
char = String(char)[0] || '';
if (!util.isString(string)) {
throw new Error('\'string\' must be a string');
}
length = parseInt(length, 10);
if (!util.isString(char)) {
throw new Error('\'char\' must be a string');
}
if (!Number.isSafeInteger(length)) {
throw new Error('\'length\' must be a safe integer');
if (!util.isSafeInteger(length)) {
throw new Error('\'length\' must be a number');
}
char = char[0] || '';
const have = string.length,

@@ -165,7 +174,44 @@ need = Math.abs(length),

return String(char.repeat(need) + string).slice(-need);
} else {
return String(string + char.repeat(need)).slice(0, need);
}
},
return String(string + char.repeat(need)).slice(0, need);
arrayUnique(array) {
if (!util.isArray(array)) {
throw new Error('\'array\' must be an array');
}
const result = [],
map = new Map();
array.forEach(value => map.set(value));
map.forEach((_, key) => result.push(key));
return result;
},
randomUInt8() {
return _crypto2.default.randomBytes(1).readUInt8();
},
arrayShuffle(array) {
if (!util.isArray(array)) {
throw new Error('\'array\' must be an array');
}
array = array.slice();
let j, temp;
for (let i = array.length - 1; i > 0; i -= 1) {
j = _crypto2.default.randomBytes(4).readUInt32BE() % (i + 1);
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
return array;
},
classToFactory(constructor) {

@@ -172,0 +218,0 @@ if (!util.isFunction(constructor)) {

{
"name": "osactl",
"version": "0.0.7",
"version": "0.0.8",
"description": "Odin Automation control framework",

@@ -5,0 +5,0 @@ "main": "./lib/main.js",

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