theprogrammablemind_4wp 7.5.4-beta.9 → 7.5.5

Sign up to get free protection for your applications and to get access to all the features.
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)
@@ -1459,6 +1461,9 @@ const knowledgeModule = async ({
1459
1461
  for (const semantic of easyToRead) {
1460
1462
  semantic.match = semantic.match.toString()
1461
1463
  semantic.apply = semantic.apply.toString()
1464
+ if (semantic.applyWrapped) {
1465
+ semantic.applyWrapped = semantic.applyWrapped.toString()
1466
+ }
1462
1467
  }
1463
1468
  console.dir(easyToRead)
1464
1469
  }
package/package.json CHANGED
@@ -62,6 +62,6 @@
62
62
  "json-stable-stringify": "^1.0.1",
63
63
  "node-fetch": "^2.6.1"
64
64
  },
65
- "version": "7.5.4-beta.9",
65
+ "version": "7.5.5",
66
66
  "license": "ISC"
67
67
  }
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)
@@ -447,6 +451,15 @@ const multiApiImpl = (initializer) => {
447
451
 
448
452
  class Config {
449
453
 
454
+ inDevelopmentMode (call) {
455
+ config.developmentModeOn += 1
456
+ try {
457
+ call()
458
+ } finally {
459
+ config.developmentModeOn -= 1
460
+ }
461
+ }
462
+
450
463
  // return the config with just the elements from the included KM's
451
464
  baseConfig() {
452
465
  const operators = this.config.operators.filter((operator) => {
@@ -462,7 +475,6 @@ class Config {
462
475
  words[word] = defs
463
476
  }
464
477
  }
465
- debugger
466
478
  return {
467
479
  operators,
468
480
  bridges,
@@ -676,7 +688,20 @@ class Config {
676
688
  return !(instance && sameQueries && sameFragments)
677
689
  }
678
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
+
679
703
  load (template, instance, options = { rebuild: false } ) {
704
+ this.validifyTemplate(template)
680
705
  instance.template = template
681
706
  this.logs.push(`loading template for ${this.name}`)
682
707
  if (instance && instance.associations && !options.rebuild) {
@@ -1364,6 +1389,7 @@ class Config {
1364
1389
  this._api.config = () => this
1365
1390
  this._api.uuid = this._uuid
1366
1391
  }
1392
+ this.rebuild()
1367
1393
  }
1368
1394
  }
1369
1395
 
@@ -1939,10 +1965,6 @@ class Config {
1939
1965
  km.valid()
1940
1966
  })
1941
1967
 
1942
- if (addInternals.length !== inits.length || addInternals.length !== initAfterApis.length) {
1943
- debugger // bug
1944
- }
1945
-
1946
1968
  const generators = this.config.generators
1947
1969
  const semantics = this.config.semantics
1948
1970
  if (reverseIt) {
@@ -2590,7 +2612,6 @@ class Config {
2590
2612
  if (isDup(newOne, oldOne)) {
2591
2613
  if (oldOne.allowDups) {
2592
2614
  // the old one takes precedence to match what would happen during the original load
2593
- debugger
2594
2615
  this.config[key].splice(iOldOne, 1)
2595
2616
  break;
2596
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
- errorMessage = `Error applying generator '${generator.notes}'. Error is ${e.toString()} stack is ${e.stack}. Generator is ${generator.toString()}. ${help}`
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
- errorMessage = `Error applying generator '${generator.notes}'. Error is ${e.error.join()}. Generator is ${generator.toString()}. ${help}`
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
- errorMessage = `Error applying semantics '${semantic.notes}'. Error is ${e.toString()} stack is ${e.stack}. Semantic is ${semantic.toString()}. ${help}`
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
- errorMessage = `Error applying semantics '${semantic.notes}'. Error is ${e.error.join()}. Semantic is ${semantic.toString()}. ${help}`
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
  }