theprogrammablemind 7.3.9-beta.6 → 7.3.9-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/config.js +16 -13
package/package.json
CHANGED
package/src/config.js
CHANGED
@@ -172,7 +172,7 @@ class KM {
|
|
172
172
|
return this.toNS(this._name)
|
173
173
|
}
|
174
174
|
|
175
|
-
constructor ({ config, namespace = [], uuid, isSelf = false }) {
|
175
|
+
constructor ({ config, getCounter, namespace = [], uuid, isSelf = false }) {
|
176
176
|
if (uuid) {
|
177
177
|
this._uuid = uuid
|
178
178
|
this._class = 'KM'
|
@@ -226,6 +226,7 @@ class KM {
|
|
226
226
|
const config = configDup(this._config, options)
|
227
227
|
const km = new KM({
|
228
228
|
config,
|
229
|
+
getCounter: options.getCounter,
|
229
230
|
name: this._name,
|
230
231
|
_uuid: config._uuid,
|
231
232
|
namespace: this._namespace,
|
@@ -239,7 +240,8 @@ class KM {
|
|
239
240
|
name: this._name,
|
240
241
|
config: configDup(this._config),
|
241
242
|
// _uuid: uuidv4(),
|
242
|
-
_uuid: getCounter(this._config._name),
|
243
|
+
_uuid: this._config.getCounter(this._config._name),
|
244
|
+
getCounter: (name) => this._config.getCounter(name),
|
243
245
|
namespace: this._namespace,
|
244
246
|
isSelf: this._isSelf
|
245
247
|
})
|
@@ -319,15 +321,15 @@ const multiApiImpl = (initializer) => {
|
|
319
321
|
})
|
320
322
|
}
|
321
323
|
|
322
|
-
let configCounter = 1
|
323
|
-
|
324
|
-
const getCounter = (maybeName = '') => {
|
325
|
-
const counter = configCounter
|
326
|
-
configCounter += 1
|
327
|
-
return `${maybeName}${counter}`
|
328
|
-
}
|
329
324
|
|
330
325
|
class Config {
|
326
|
+
|
327
|
+
getCounter (maybeName = '') {
|
328
|
+
const counter = this.configCounter
|
329
|
+
this.configCounter += 1
|
330
|
+
return `${maybeName}${counter}`
|
331
|
+
}
|
332
|
+
|
331
333
|
defaultConfig () {
|
332
334
|
this.config = {
|
333
335
|
operators: [], // TODO
|
@@ -363,6 +365,7 @@ class Config {
|
|
363
365
|
for (const bag of bags) {
|
364
366
|
this.config[bag] = []
|
365
367
|
}
|
368
|
+
this.configCounter = 1
|
366
369
|
// this.wasInitialized = false
|
367
370
|
}
|
368
371
|
|
@@ -989,7 +992,7 @@ class Config {
|
|
989
992
|
this._namespace = []
|
990
993
|
this._eqClasses = []
|
991
994
|
// this._uuid = uuidv4()
|
992
|
-
this._uuid = getCounter(this.name)
|
995
|
+
this._uuid = this.getCounter(this.name)
|
993
996
|
if (config) {
|
994
997
|
config = _.cloneDeep(config)
|
995
998
|
this.config = config
|
@@ -1083,7 +1086,7 @@ class Config {
|
|
1083
1086
|
}
|
1084
1087
|
}
|
1085
1088
|
this.initConfig = _.cloneDeep(this.config)
|
1086
|
-
this.configs.push(new KM({ config: this.config, uuid: this._uuid }))
|
1089
|
+
this.configs.push(new KM({ config: this.config, getCounter: (name) => this.config.getCounter(name), uuid: this._uuid }))
|
1087
1090
|
|
1088
1091
|
/*
|
1089
1092
|
if (config) {
|
@@ -1240,7 +1243,7 @@ class Config {
|
|
1240
1243
|
const cp = new Config()
|
1241
1244
|
cp.logs = []
|
1242
1245
|
cp.transitoryMode = this.transitoryMode
|
1243
|
-
cp.configs = this.configs.map((km) => km.copy2(Object.assign({}, options, { callInitializers: false })))
|
1246
|
+
cp.configs = this.configs.map((km) => km.copy2(Object.assign({}, options, { getCounter: (name) => cp.getCounter(name), callInitializers: false })))
|
1244
1247
|
cp._uuid = cp.configs[0]._uuid
|
1245
1248
|
cp.initializerFn = this.initializerFn
|
1246
1249
|
cp.initAfterApi = this.initAfterApi
|
@@ -1982,7 +1985,7 @@ class Config {
|
|
1982
1985
|
// this.configs = this.configs.concat(new KM({config: more}));
|
1983
1986
|
// only set for the first one the rest have it set
|
1984
1987
|
const namespace = this._namespace.concat(more._namespace)
|
1985
|
-
const moreKMs1 = [new KM({ config: more, uuid: more.uuid, namespace })]
|
1988
|
+
const moreKMs1 = [new KM({ config: more, getCounter: (name) => this.getCounter(name), uuid: more.uuid, namespace })]
|
1986
1989
|
const moreKMs2 = more.configs.slice(1).map((km) => {
|
1987
1990
|
return km
|
1988
1991
|
// const cp = km.copy()
|