theprogrammablemind 8.6.0 → 8.7.0-beta.1

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/client.js CHANGED
@@ -1078,7 +1078,6 @@ const rebuildTemplate = async ({ config, target, previousResultss, startOfChange
1078
1078
  }
1079
1079
 
1080
1080
  const checkTemplate = (template) => {
1081
- return
1082
1081
  if (!template) {
1083
1082
  return
1084
1083
  }
@@ -1097,6 +1096,9 @@ const checkTest = (testConfig) => {
1097
1096
  if (!testConfig.contents) {
1098
1097
  throw new Error("The 'test' property is missing the 'contents' property that contains contents of the '<km>.test.json' file")
1099
1098
  }
1099
+ if (testConfig.checks?.context && typeof testConfig.checks.context == 'function') {
1100
+ throw new Error(`The 'test.check.context' property should not be a function for ${testConfig.name}. If you are using defaultContextCheck then do this defaultContextCheck().`)
1101
+ }
1100
1102
  }
1101
1103
 
1102
1104
  const knowledgeModuleImpl = async ({
@@ -1223,6 +1225,7 @@ const knowledgeModuleImpl = async ({
1223
1225
  parser.add_argument('-od', '--objectDiff', { action: 'store_true', help: 'When showing the objects use a colour diff' })
1224
1226
  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' })
1225
1227
  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.' })
1228
+ parser.add_argument('-fr', '--failRebuild', { action: 'store_true', help: 'If a rebuild is required fail out.' })
1226
1229
  parser.add_argument('-sd', '--saveDeveloper', { action: 'store_true', help: 'Same as -s but the query will not show up in the info command.' })
1227
1230
  parser.add_argument('-dl', '--debugLoops', { action: 'store_true', help: 'When running with the --debugLoops flag the logs calls to semantics and generators will be immediately written to the console ' })
1228
1231
  parser.add_argument('-d', '--debug', { action: 'store_true', help: 'When running with the --debug flag this set the debug flag in the config' })
@@ -1285,7 +1288,7 @@ const knowledgeModuleImpl = async ({
1285
1288
  throw new Error('Error for the checkForLoop argument. Expected a JSON array of operator keys of the form "[<id>, <level>]"')
1286
1289
  }
1287
1290
  } catch (e) {
1288
- throw new Error('Error for the checkForLoop argument. Expected a JSON array of operator keys of the form "[<id>, <level>]"')
1291
+ throw new Error('Error for the checkForLoop argument. Expected a JSON array of operator keys of the form "[<id>, <level>]". For example \'[["op1", 0], ["op2", 1]]\'.')
1289
1292
  }
1290
1293
  } else {
1291
1294
  if (process.argv.includes('--checkForLoop') || process.argv.includes('-cl')) {
@@ -1477,6 +1480,10 @@ const knowledgeModuleImpl = async ({
1477
1480
  if (needsRebuild.previousResultss) {
1478
1481
  console.log('Rebuild using the optimization to use previous results until a change is hit. For a full rebuild use -rtf')
1479
1482
  }
1483
+ if (args.failRebuild) {
1484
+ console.log('Needs rebuild and fail rebuild as specified so failing out')
1485
+ runtime.process.exit(-1)
1486
+ }
1480
1487
  console.log(`This module "${config.name}" needs rebuilding all other arguments will be ignored. Try again after the template is rebuilt.`)
1481
1488
  options.rebuild = true
1482
1489
  config.config.rebuild = true
package/package.json CHANGED
@@ -65,6 +65,6 @@
65
65
  "sort-json": "^2.0.0",
66
66
  "uuid": "^8.3.2"
67
67
  },
68
- "version": "8.6.0",
68
+ "version": "8.7.0-beta.1",
69
69
  "license": "UNLICENSED"
70
70
  }
package/src/helpers.js CHANGED
@@ -314,7 +314,8 @@ const functionsToStrings = (config) => {
314
314
  config = { ...config }
315
315
  defToStrings = (def) => {
316
316
  if (def.apply) {
317
- return { ...def, match: def.match.toString(), apply: def.apply.toString() }
317
+ // return { ...def, match: def.match.toString(), apply: def.apply.toString() }
318
+ return { match: def.match.toString(), apply: def.apply.toString() }
318
319
  } else {
319
320
  return [def[0].toString(), def[1].toString()]
320
321
  }