theprogrammablemind_4wp 7.5.4-beta.3 → 7.5.4-beta.4
Sign up to get free protection for your applications and to get access to all the features.
- package/client.js +13 -7
- package/package.json +2 -1
- package/src/config.js +37 -1
package/client.js
CHANGED
@@ -478,7 +478,7 @@ const doWithRetries = async (n, url, queryParams, data) => {
|
|
478
478
|
}
|
479
479
|
}
|
480
480
|
|
481
|
-
const setupProcessB = ({ config, allowDelta=false } = {}) => {
|
481
|
+
const setupProcessB = ({ config, initializer, allowDelta=false } = {}) => {
|
482
482
|
const key = config._key
|
483
483
|
|
484
484
|
const data = Object.assign({ key, version: '3' }, { uuid: config._uuid })
|
@@ -526,7 +526,7 @@ const processInstance = (config, instance) => {
|
|
526
526
|
global.transitoryMode = transitoryMode
|
527
527
|
}
|
528
528
|
|
529
|
-
const _process = async (config, query, { commandLineArgs, credentials, writeTests, isTest, saveDeveloper, testConfig, testsFN, errorHandler = defaultErrorHandler } = {}) => {
|
529
|
+
const _process = async (config, query, { initializer, commandLineArgs, credentials, writeTests, isTest, saveDeveloper, testConfig, testsFN, errorHandler = defaultErrorHandler } = {}) => {
|
530
530
|
if (credentials) {
|
531
531
|
config.server(credentials.server, credentials.key)
|
532
532
|
}
|
@@ -546,7 +546,7 @@ const _process = async (config, query, { commandLineArgs, credentials, writeTest
|
|
546
546
|
throw error
|
547
547
|
}
|
548
548
|
|
549
|
-
let { data, /* generators, semantics, */ hierarchy } = setupProcessB({ config, allowDelta: true })
|
549
|
+
let { data, /* generators, semantics, */ hierarchy } = setupProcessB({ config, initializer, allowDelta: true })
|
550
550
|
if (commandLineArgs && commandLineArgs.checkForLoop) {
|
551
551
|
data.checkForLoop = true
|
552
552
|
}
|
@@ -1057,7 +1057,7 @@ const build = async ({ config, target, template, errorHandler = defaultErrorHand
|
|
1057
1057
|
finish()
|
1058
1058
|
return
|
1059
1059
|
}
|
1060
|
-
const { property, hierarchy, query: queryOrExtraConfig, skipSemantics } = queries.shift()
|
1060
|
+
const { property, hierarchy, query: queryOrExtraConfig, initializer, skipSemantics } = queries.shift()
|
1061
1061
|
// queries are strings or { query: "blah", development: true/false }
|
1062
1062
|
if (typeof queryOrExtraConfig === 'string' || queryOrExtraConfig.query) {
|
1063
1063
|
let query = queryOrExtraConfig;
|
@@ -1082,7 +1082,7 @@ const build = async ({ config, target, template, errorHandler = defaultErrorHand
|
|
1082
1082
|
}
|
1083
1083
|
|
1084
1084
|
try {
|
1085
|
-
const results = await _process(config, query.query, {})
|
1085
|
+
const results = await _process(config, query.query, {initializer})
|
1086
1086
|
if (config.config.debug) {
|
1087
1087
|
// TODO pass in the error handler like the other ones
|
1088
1088
|
defaultInnerProcess(config, defaultErrorHandler, results)
|
@@ -1160,7 +1160,9 @@ const build = async ({ config, target, template, errorHandler = defaultErrorHand
|
|
1160
1160
|
return queryStringOrProperties
|
1161
1161
|
}
|
1162
1162
|
}
|
1163
|
-
let todo =
|
1163
|
+
let todo = []
|
1164
|
+
todo = todo.concat((template.initializers || []).map((query) => { return { initializer: true, property: 'resultss', query, skipSemantics: false } }))
|
1165
|
+
todo = todo.concat((template.queries || []).map((query) => { return { property: 'resultss', query, skipSemantics: false } }))
|
1164
1166
|
todo = todo.concat((template.fragments || []).map((query) => { return Object.assign({}, toProperties(query), { property: 'fragments', skipSemantics: false }) }))
|
1165
1167
|
todo = todo.concat((template.semantics || []).map((definition) => { return { property: 'semantics', query: `${definition.from}\n${definition.to}`, skipSemantics: true } }))
|
1166
1168
|
await looper(Object.assign([], todo))
|
@@ -1265,7 +1267,6 @@ const knowledgeModule = async ({
|
|
1265
1267
|
config.load(template.template, template.instance)
|
1266
1268
|
}
|
1267
1269
|
}
|
1268
|
-
|
1269
1270
|
if (isProcess) {
|
1270
1271
|
// setup();
|
1271
1272
|
const parser = new runtime.ArgumentParser({
|
@@ -1299,6 +1300,7 @@ const knowledgeModule = async ({
|
|
1299
1300
|
parser.add_argument('-da', '--debugAssociation', { help: 'When running with the --debugAssociation flag the debugging will break when the specified association is added to the config' })
|
1300
1301
|
parser.add_argument('-dh', '--debugHierarchy', { help: 'When running with the --debugHierarchy flag the debugging will break when the specified child-parent pair is added to the config for the main config. Set DEBUG_HIERARCHY to debug any config loaded. For example DEBUG_HIERARCHY=\'["cat", "mammel"]\'' })
|
1301
1302
|
parser.add_argument('-db', '--debugBridge', { help: 'When running with the --debugBridge flag the debugging will break when the specified bridge is added to the config for the main config. Set DEBUG_BRIDGE to debug any config loaded. For example DEBUG_BRIDGE=\'id/level\'' })
|
1303
|
+
parser.add_argument('-do', '--debugOperator', { help: 'When running with the --debugOperator flag the debugging will break when the specified operator is added to the config for the main config. Set DEBUG_OPERATOR to debug any config loaded. For example DEBUG_OPERATOR=\'([operator] ([arg]))\'' })
|
1302
1304
|
|
1303
1305
|
const args = parser.parse_args()
|
1304
1306
|
args.count = args.count || 1
|
@@ -1316,6 +1318,10 @@ const knowledgeModule = async ({
|
|
1316
1318
|
console.log('Expected DEBUG_BRIDGE to be of the form "id/level"');
|
1317
1319
|
}
|
1318
1320
|
}
|
1321
|
+
if (args.debugOperator) {
|
1322
|
+
// id/level
|
1323
|
+
global.entodictonDebugOperator = args.debugOperator
|
1324
|
+
}
|
1319
1325
|
|
1320
1326
|
if (args.clean) {
|
1321
1327
|
const tests = JSON.parse(runtime.fs.readFileSync(testConfig.name))
|
package/package.json
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
"lint:fix": "eslint \"**/*.js\" --fix",
|
17
17
|
"lint": "eslint \"**/*.js\"",
|
18
18
|
"to": "node node_modules/.bin/jest --runInBand -t NEO23",
|
19
|
+
"tos": "node node_modules/.bin/jest --runInBand -t NEOS23",
|
19
20
|
"test": "jest --config ./jest.config.json",
|
20
21
|
"test:watch": "npm run test -- --watch"
|
21
22
|
},
|
@@ -61,6 +62,6 @@
|
|
61
62
|
"json-stable-stringify": "^1.0.1",
|
62
63
|
"node-fetch": "^2.6.1"
|
63
64
|
},
|
64
|
-
"version": "7.5.4-beta.
|
65
|
+
"version": "7.5.4-beta.4",
|
65
66
|
"license": "ISC"
|
66
67
|
}
|
package/src/config.js
CHANGED
@@ -117,6 +117,11 @@ if (runtime.process.env.DEBUG_BRIDGE) {
|
|
117
117
|
global.entodictonDebugBridge[1] = int(global.entodictonDebugBridge[1])
|
118
118
|
}
|
119
119
|
|
120
|
+
if (runtime.process.env.DEBUG_OPERATOR) {
|
121
|
+
// id/level
|
122
|
+
global.entodictonDebugOperator = runtime.process.env.DEBUG_OPERATOR
|
123
|
+
}
|
124
|
+
|
120
125
|
const hierarchyCanonical = (element) => {
|
121
126
|
if (element.child && element.parent) {
|
122
127
|
return element
|
@@ -417,6 +422,29 @@ const multiApiImpl = (initializer) => {
|
|
417
422
|
|
418
423
|
class Config {
|
419
424
|
|
425
|
+
// return the config with just the elements from the included KM's
|
426
|
+
baseConfig() {
|
427
|
+
const operators = this.config.operators.filter((operator) => {
|
428
|
+
return operator.uuid !== this.uuid
|
429
|
+
})
|
430
|
+
const bridges = this.config.bridges.filter((bridge) => {
|
431
|
+
return bridge.uuid !== this.uuid
|
432
|
+
})
|
433
|
+
const words = {}
|
434
|
+
for (let word in this.config.words) {
|
435
|
+
const defs = this.config.words[word].filter( (def) => def.uuid !== this.uuid )
|
436
|
+
if (defs.length > 0) {
|
437
|
+
words[word] = defs
|
438
|
+
}
|
439
|
+
}
|
440
|
+
debugger
|
441
|
+
return {
|
442
|
+
operators,
|
443
|
+
bridges,
|
444
|
+
words
|
445
|
+
}
|
446
|
+
}
|
447
|
+
|
420
448
|
getCounter (maybeName = '') {
|
421
449
|
const counter = this.configCounter
|
422
450
|
this.configCounter += 1
|
@@ -845,6 +873,7 @@ class Config {
|
|
845
873
|
if (!this.config.operators) {
|
846
874
|
this.config.operators = []
|
847
875
|
}
|
876
|
+
|
848
877
|
const operators = this.config.operators
|
849
878
|
|
850
879
|
let operator;
|
@@ -854,6 +883,12 @@ class Config {
|
|
854
883
|
operator = Object.assign({}, objectOrPattern, { uuid: this._uuid })
|
855
884
|
}
|
856
885
|
|
886
|
+
if (global.entodictonDebugOperator) {
|
887
|
+
if (operator.pattern === global.entodictonDebugOperator) {
|
888
|
+
debugger; // debug operator hit
|
889
|
+
}
|
890
|
+
}
|
891
|
+
|
857
892
|
if (operator.allowDups) {
|
858
893
|
if (operators.find( (o) => o.pattern == operator.pattern )) {
|
859
894
|
return;
|
@@ -1726,7 +1761,8 @@ class Config {
|
|
1726
1761
|
|
1727
1762
|
if (currentConfig.api) {
|
1728
1763
|
currentConfig.api.objects = args.objects
|
1729
|
-
currentConfig.api.config = () => this
|
1764
|
+
// GREG42 currentConfig.api.config = () => this
|
1765
|
+
currentConfig.api.config = () => args.baseConfig
|
1730
1766
|
currentConfig.api.uuid = currentConfig._uuid
|
1731
1767
|
}
|
1732
1768
|
// this.instances.forEach( (instance) => client.processInstance(this, instance) )
|