theprogrammablemind
Advanced tools
Comparing version 7.3.9-beta.7 to 7.3.9-beta.8
@@ -64,4 +64,4 @@ { | ||
}, | ||
"version": "7.3.9-beta.7", | ||
"version": "7.3.9-beta.8", | ||
"license": "ISC" | ||
} |
@@ -175,3 +175,3 @@ // lookup = (name) => returns <config> | ||
constructor ({ config, namespace = [], uuid, isSelf = false }) { | ||
constructor ({ config, getCounter, namespace = [], uuid, isSelf = false }) { | ||
if (uuid) { | ||
@@ -230,2 +230,3 @@ this._uuid = uuid | ||
config, | ||
getCounter: options.getCounter, | ||
name: this._name, | ||
@@ -244,3 +245,4 @@ _uuid: config._uuid, | ||
// _uuid: uuidv4(), | ||
_uuid: getCounter(this._config._name), | ||
_uuid: this._config.getCounter(this._config._name), | ||
getCounter: (name) => this._config.getCounter(name), | ||
namespace: this._namespace, | ||
@@ -325,11 +327,11 @@ isSelf: this._isSelf | ||
let configCounter = 1 | ||
const getCounter = (maybeName = '') => { | ||
const counter = configCounter | ||
configCounter += 1 | ||
return `${maybeName}${counter}` | ||
} | ||
class Config { | ||
class Config { | ||
getCounter (maybeName = '') { | ||
const counter = this.configCounter | ||
this.configCounter += 1 | ||
return `${maybeName}${counter}` | ||
} | ||
defaultConfig () { | ||
@@ -370,2 +372,3 @@ this.config = { | ||
} | ||
this.configCounter = 1 | ||
// this.wasInitialized = false | ||
@@ -997,3 +1000,3 @@ } | ||
// this._uuid = uuidv4() | ||
this._uuid = getCounter(this.name) | ||
this._uuid = this.getCounter(this.name) | ||
if (config) { | ||
@@ -1092,3 +1095,3 @@ config = _.cloneDeep(config) | ||
this.initConfig = _.cloneDeep(this.config) | ||
this.configs.push(new KM({ config: this.config, uuid: this._uuid })) | ||
this.configs.push(new KM({ config: this.config, getCounter: (name) => this.config.getCounter(name), uuid: this._uuid })) | ||
@@ -1250,3 +1253,3 @@ /* | ||
cp.transitoryMode = this.transitoryMode | ||
cp.configs = this.configs.map((km) => km.copy2(Object.assign({}, options, { callInitializers: false }))) | ||
cp.configs = this.configs.map((km) => km.copy2(Object.assign({}, options, { getCounter: (name) => cp.getCounter(name), callInitializers: false }))) | ||
cp._uuid = cp.configs[0]._uuid | ||
@@ -1993,3 +1996,3 @@ cp.initializerFn = this.initializerFn | ||
const namespace = this._namespace.concat(more._namespace) | ||
const moreKMs1 = [new KM({ config: more, uuid: more.uuid, namespace })] | ||
const moreKMs1 = [new KM({ config: more, getCounter: (name) => this.getCounter(name), uuid: more.uuid, namespace })] | ||
const moreKMs2 = more.configs.slice(1).map((km) => { | ||
@@ -1996,0 +1999,0 @@ return km |
160588
4609