theprogrammablemind_4wp 7.5.4-beta.10 → 7.5.4-beta.12
Sign up to get free protection for your applications and to get access to all the features.
- package/client.js +2 -0
- package/package.json +1 -1
- package/src/config.js +18 -2
- package/src/generators.js +4 -2
- package/src/semantics.js +4 -2
package/client.js
CHANGED
@@ -1299,6 +1299,7 @@ const knowledgeModule = async ({
|
|
1299
1299
|
parser.add_argument('-p', '--print', { help: 'Print the specified elements c === config, w === words, b === bridges, o === operators d === objects (d for data), h === hierarchy, g === generators, s === semantics, l === load t=tests ordering p === priorities a == associations j == JSON sent to server. for example --print wb' })
|
1300
1300
|
parser.add_argument('-s', '--save', { action: 'store_true', help: 'When running with the --query flag this will save the current run to the test file. When running without the --query flag all tests will be run and resaved.' })
|
1301
1301
|
parser.add_argument('-sd', '--saveDeveloper', { action: 'store_true', help: 'Same as -s but the query will not show up in the info command.' })
|
1302
|
+
parser.add_argument('-dic', '--debugIncludeConvolutions', { action: 'store_true', help: 'When running with the --debugIncludeConvolutions flag the logs will include convolutions which are somewhat annoying verbose. Default is false' })
|
1302
1303
|
parser.add_argument('-d', '--debug', { action: 'store_true', help: 'When running with the --debug flag this set the debug flag in the config' })
|
1303
1304
|
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' })
|
1304
1305
|
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"]\'' })
|
@@ -1362,6 +1363,7 @@ const knowledgeModule = async ({
|
|
1362
1363
|
if (args.debug) {
|
1363
1364
|
config.config.debug = true
|
1364
1365
|
}
|
1366
|
+
config.config.debugIncludeConvolutions = args.debugIncludeConvolutions
|
1365
1367
|
|
1366
1368
|
if (template) {
|
1367
1369
|
const needsRebuild = config.needsRebuild(template.template, template.instance, options)
|
package/package.json
CHANGED
package/src/config.js
CHANGED
@@ -72,6 +72,10 @@ const handleBridgeProps = (config, bridge) => {
|
|
72
72
|
config.config.generators.unshift(generator)
|
73
73
|
}
|
74
74
|
}
|
75
|
+
if (bridge.generatorpr) {
|
76
|
+
bridge.generatorp = bridge.generatorpr
|
77
|
+
bridge.generatorr = bridge.generatorpr
|
78
|
+
}
|
75
79
|
if (bridge.generatorp) {
|
76
80
|
config.config.generators.unshift({
|
77
81
|
where: bridge.generatorp.where || bridge.where || client.where(4),
|
@@ -113,7 +117,7 @@ const handleBridgeProps = (config, bridge) => {
|
|
113
117
|
|
114
118
|
const handleCalculatedProps = (baseConfig, moreConfig) => {
|
115
119
|
for (let bridge of moreConfig.bridges) {
|
116
|
-
const valid = [ 'before', 'bridge', 'development', 'evaluator', 'generatorp', 'generatorr', 'generators', 'id', 'convolution', 'inverted', 'isA', 'children', 'parents',
|
120
|
+
const valid = [ 'before', 'bridge', 'development', 'evaluator', 'generatorp', 'generatorr', 'generatorpr', 'generators', 'id', 'convolution', 'inverted', 'isA', 'children', 'parents',
|
117
121
|
'level', 'optional', 'selector', 'semantic', 'words', /Bridge$/, 'localHierarchy', 'levelSpecificHierarchy', 'where' ]
|
118
122
|
helpers.validProps(valid, bridge, 'bridge')
|
119
123
|
handleBridgeProps(baseConfig, bridge)
|
@@ -684,7 +688,20 @@ class Config {
|
|
684
688
|
return !(instance && sameQueries && sameFragments)
|
685
689
|
}
|
686
690
|
|
691
|
+
validifyTemplate (template) {
|
692
|
+
if (!template.queries && !template.fragments) {
|
693
|
+
throw new Error(`Expected the template for ${this.name} to be an object that can have the properties: queries and fragments`)
|
694
|
+
}
|
695
|
+
for (let query of template.queries || []) {
|
696
|
+
if (typeof query == 'string') {
|
697
|
+
} else if (query instanceof Config) {
|
698
|
+
throw new Error(`For the template for ${this.name}, each element in queries should be either a string or a structure with a config (not a Config object).`)
|
699
|
+
}
|
700
|
+
}
|
701
|
+
}
|
702
|
+
|
687
703
|
load (template, instance, options = { rebuild: false } ) {
|
704
|
+
this.validifyTemplate(template)
|
688
705
|
instance.template = template
|
689
706
|
this.logs.push(`loading template for ${this.name}`)
|
690
707
|
if (instance && instance.associations && !options.rebuild) {
|
@@ -2595,7 +2612,6 @@ class Config {
|
|
2595
2612
|
if (isDup(newOne, oldOne)) {
|
2596
2613
|
if (oldOne.allowDups) {
|
2597
2614
|
// the old one takes precedence to match what would happen during the original load
|
2598
|
-
debugger
|
2599
2615
|
this.config[key].splice(iOldOne, 1)
|
2600
2616
|
break;
|
2601
2617
|
}
|
package/src/generators.js
CHANGED
@@ -200,9 +200,11 @@ class Generators {
|
|
200
200
|
e.retryCall = () => generator.apply(args, objects, g, args.gs, context, hierarchy, config, response, log)
|
201
201
|
const help = 'The error has a retryCall property that will recall the function that failed.'
|
202
202
|
if (e.stack && e.message) {
|
203
|
-
|
203
|
+
const info = `${generator.notes ? generator.notes : ''}${generator.where ? generator.where : ''}`
|
204
|
+
errorMessage = `Error applying generator '${info}. Error is ${e.toString()} stack is ${e.stack}. Generator is ${generator.toString()}. ${help}`
|
204
205
|
} else if (e.error) {
|
205
|
-
|
206
|
+
const info = `${generator.notes ? generator.notes : ''}${generator.where ? generator.where : ''}`
|
207
|
+
errorMessage = `Error applying generator '${info}. Error is ${e.error.join()}. Generator is ${generator.toString()}. ${help}`
|
206
208
|
} else {
|
207
209
|
errorMessage = e.toString()
|
208
210
|
}
|
package/src/semantics.js
CHANGED
@@ -194,9 +194,11 @@ class Semantics {
|
|
194
194
|
e.retryCall = () => semantic.apply(args, context, s, log, options)
|
195
195
|
const help = 'The error has a retryCall property that will recall the function that failed.'
|
196
196
|
if (e.stack && e.message) {
|
197
|
-
|
197
|
+
const info = `${semantic.notes ? semantic.notes : ''}${semantic.where ? semantic.where : ''}`
|
198
|
+
errorMessage = `Error applying semantics '${info}'. Error is ${e.toString()} stack is ${e.stack}. Semantic is ${semantic.toString()}. ${help}`
|
198
199
|
} else if (e.error) {
|
199
|
-
|
200
|
+
const info = `${semantic.notes ? semantic.notes : ''}${semantic.where ? semantic.where : ''}`
|
201
|
+
errorMessage = `Error applying semantics '${info}'. Error is ${e.error.join()}. Semantic is ${semantic.toString()}. ${help}`
|
200
202
|
} else {
|
201
203
|
errorMessage = e.toString();
|
202
204
|
}
|