atajox-lib
Advanced tools
Comparing version 0.0.16 to 0.0.17
import { ConfigState, ConfigStateSocketOptionsQuery } from "./config.model"; | ||
import { ConsulConfig } from "../consul/consul.model"; | ||
export declare class AtajoXConfig { | ||
storeName: string; | ||
STATE: ConfigState; | ||
setCore(consulConfig: ConsulConfig): void; | ||
/** | ||
@@ -6,0 +8,0 @@ * Set a new value in the existing STATE |
@@ -20,2 +20,3 @@ 'use strict'; | ||
consulClientToken: '', | ||
consulConfigManuallySet: false, | ||
consulConfig: { | ||
@@ -73,2 +74,15 @@ domain: '', | ||
} | ||
AtajoXConfig.prototype.setCore = function (consulConfig) { | ||
if (this.STATE.domain === '') { | ||
console.error('Set domain first'); | ||
return; | ||
} | ||
this.STATE.consulConfigManuallySet = true; | ||
this.STATE.consulConfig = consulConfig; | ||
this.saveState().then(function () { | ||
console.log('[setCore] Core set successfully'); | ||
}, function () { | ||
console.error('[setCore] Could not save config state'); | ||
}); | ||
}; | ||
/** | ||
@@ -176,2 +190,10 @@ * Set a new value in the existing STATE | ||
} | ||
if (_this.STATE.consulConfigManuallySet) { | ||
_this.loadSocketQueryIntoState().then(function () { | ||
resolve(); | ||
}, function () { | ||
reject('Could not load socket query into state'); | ||
}); | ||
return; | ||
} | ||
if (reset) { | ||
@@ -184,7 +206,3 @@ _this.STATE.consulClientToken = ''; | ||
_this.loadSocketQueryIntoState().then(function () { | ||
_this.saveState().then(function () { | ||
resolve(); | ||
}, function () { | ||
reject('Could not save config state'); | ||
}); | ||
resolve(); | ||
}, function () { | ||
@@ -219,3 +237,7 @@ reject('Could not load socket query into state'); | ||
_this.STATE.socket.options.query = socketQuery; | ||
resolve(socketQuery); | ||
_this.saveState().then(function () { | ||
resolve(socketQuery); | ||
}, function () { | ||
reject('Could not save config state'); | ||
}); | ||
}, function () { | ||
@@ -222,0 +244,0 @@ reject(); |
@@ -50,2 +50,3 @@ import { ConsulConfig } from "../consul/consul.model"; | ||
consulClientToken: string; | ||
consulConfigManuallySet: boolean; | ||
consulConfig: ConsulConfig; | ||
@@ -52,0 +53,0 @@ update: ConfigStateUpdate; |
{ | ||
"name": "atajox-lib", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "AtajoX API Library", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
333889
5317