theprogrammablemind 8.0.0-beta.62 → 8.0.0-beta.64

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.
Files changed (2) hide show
  1. package/client.js +21 -6
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -388,7 +388,6 @@ const getConfigForTest = (config, testConfig) => {
388
388
  }
389
389
  const configForTest = {}
390
390
  for (const key of Object.keys(includes)) {
391
- // configForTest[key] = config.config[key]
392
391
  if (key === 'words') {
393
392
  const words = config.config.words
394
393
  configForTest.words = {
@@ -398,7 +397,14 @@ const getConfigForTest = (config, testConfig) => {
398
397
  }
399
398
 
400
399
  const literals = config.config.words.literals
400
+ let includesWord = (word) => true
401
+ if (Array.isArray(includes.words)) {
402
+ includesWord = (word) => includes.words.includes(word)
403
+ }
401
404
  for (const key in literals) {
405
+ if (!includesWord(key)) {
406
+ continue
407
+ }
402
408
  const defs = []
403
409
  for (const def of literals[key]) {
404
410
  // TODO handle thie uuids the right way
@@ -407,15 +413,23 @@ const getConfigForTest = (config, testConfig) => {
407
413
  configForTest.words.literals[key] = defs
408
414
  }
409
415
 
410
- const patterns = config.config.words.patterns
416
+ const patterns = config.config.words.patterns || []
411
417
  configForTest.words.patterns = patterns.map((pattern) => Object.assign({}, pattern, { uuid: undefined }))
412
418
 
413
- const hierarchy = config.config.words.hierarchy
419
+ const hierarchy = config.config.words.hierarchy || []
414
420
  configForTest.words.hierarchy = hierarchy.map((hierarchy) => Object.assign({}, hierarchy, { uuid: undefined }))
415
421
  } else if (key === 'operators') {
416
- configForTest.operators = config.config.operators.map((operator) => Object.assign({}, operator, { uuid: undefined }))
422
+ let include = (operator) => true
423
+ if (Array.isArray(includes.operators)) {
424
+ include = (operator) => includes.operators.includes(operator.pattern)
425
+ }
426
+ configForTest.operators = config.config.operators.filter( include ).map((operator) => Object.assign({}, operator, { uuid: undefined }))
417
427
  } else if (key === 'bridges') {
418
- configForTest.bridges = config.config.bridges.map((bridge) => Object.assign({}, bridge, { uuid: undefined }))
428
+ let include = (operator) => true
429
+ if (Array.isArray(includes.bridges)) {
430
+ include = (bridge) => includes.bridges.includes(bridge.id)
431
+ }
432
+ configForTest.bridges = config.config.bridges.filter(include).map((bridge) => Object.assign({}, bridge, { uuid: undefined }))
419
433
  } else {
420
434
  configForTest[key] = config.config[key]
421
435
  }
@@ -1816,5 +1830,6 @@ module.exports = {
1816
1830
  loadInstance,
1817
1831
  gs,
1818
1832
  flattens,
1819
- writeTest
1833
+ writeTest,
1834
+ getConfigForTest,
1820
1835
  }
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.0.0-beta.62",
68
+ "version": "8.0.0-beta.64",
69
69
  "license": "UNLICENSED"
70
70
  }