theprogrammablemind_4wp 7.12.8-beta.8 → 7.12.8-beta.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/config.js +2 -102
package/package.json CHANGED
@@ -65,6 +65,6 @@
65
65
  "json-stable-stringify": "^1.0.1",
66
66
  "node-fetch": "^2.6.1"
67
67
  },
68
- "version": "7.12.8-beta.8",
68
+ "version": "7.12.8-beta.9",
69
69
  "license": "UNLICENSED"
70
70
  }
package/src/config.js CHANGED
@@ -105,7 +105,6 @@ const validConfigProps = (config) => {
105
105
  'objects',
106
106
  'bridges',
107
107
  'operators',
108
- 'trie',
109
108
  'words',
110
109
  'priorities',
111
110
  'associations',
@@ -442,10 +441,6 @@ const isValidWordDef = (word, def, config) => {
442
441
  */
443
442
  }
444
443
 
445
- const isValidTrie = (trie) => {
446
- return true
447
- }
448
-
449
444
  const hierarchyToCanonical = (edge) => {
450
445
  if (Array.isArray(edge)) {
451
446
  return { child: edge[0], parent: edge[1] }
@@ -453,17 +448,6 @@ const hierarchyToCanonical = (edge) => {
453
448
  return edge
454
449
  }
455
450
 
456
- // for trie defs
457
-
458
- const addPattern = (config, uuid) => ({ pattern, defs }) => {
459
- if (!config.trie) {
460
- config.trie = []
461
- }
462
- const trie = config.trie
463
- const def = { id, initial, uuid }
464
- trie.unshift({ pattern, defs })
465
- }
466
-
467
451
  const addWord = (config, uuid) => ({ word, id, initial }) => {
468
452
  if (!config.words) {
469
453
  config.words = {
@@ -552,12 +536,6 @@ function setWordsUUIDs (words, uuid) {
552
536
  }
553
537
  }
554
538
 
555
- function setTrieUUIDs (patterns, uuid) {
556
- for (const pattern of patterns) {
557
- pattern.defs.map((def) => Object.assign(def, { uuid }))
558
- }
559
- }
560
-
561
539
  function applyUUID (config, uuid) {
562
540
  if (config instanceof Config) {
563
541
  config = config.config
@@ -588,9 +566,6 @@ function applyUUID (config, uuid) {
588
566
  if (config.words) {
589
567
  setWordsUUIDs(config.words, uuid)
590
568
  }
591
- if (config.trie) {
592
- setTrieUUIDs(config.trie, uuid)
593
- }
594
569
  for (const property of bags) {
595
570
  if (config[property]) {
596
571
  config[property].forEach((bag) => { bag.uuid = uuid })
@@ -890,7 +865,6 @@ class Config {
890
865
  namespaced: {}
891
866
  },
892
867
  description: '',
893
- trie: [],
894
868
  words: {
895
869
  literals: {},
896
870
  patterns: [],
@@ -923,7 +897,6 @@ class Config {
923
897
  'eqClasses',
924
898
  'priorities',
925
899
  'associations',
926
- 'trie',
927
900
  'words',
928
901
  'floaters',
929
902
  'implicits',
@@ -1473,18 +1446,6 @@ class Config {
1473
1446
  this._delta.json.operators.push({ action: 'add', operator })
1474
1447
  }
1475
1448
 
1476
- /*
1477
- addPattern (pattern, def, uuid) {
1478
- if (!this.config.trie) {
1479
- this.config.trie = []
1480
- }
1481
- const patterns = this.config.trie
1482
- def = Object.assign({}, def, { uuid: uuid || this._uuid })
1483
- patterns.unshift({ pattern, def })
1484
- this._delta.json.trie.push({ action: 'add', pattern, def })
1485
- }
1486
- */
1487
-
1488
1449
  addWord (word, def, uuid) {
1489
1450
  this.addWordInternal(word, def, uuid)
1490
1451
  }
@@ -1748,18 +1709,6 @@ class Config {
1748
1709
  }
1749
1710
  }
1750
1711
  config.words.hierarchy = hierarchyPrime
1751
-
1752
- const toDelete = []
1753
- for (const [index, pattern] of config.trie.entries()) {
1754
- const defs = pattern.defs
1755
- pattern.defs = defs.filter((def) => !def.development)
1756
- if (pattern.defs.length == 0) {
1757
- toDelete.unshift(index)
1758
- }
1759
- }
1760
- for (const index of toDelete) {
1761
- config.patterns.split(index, 1)
1762
- }
1763
1712
  }
1764
1713
 
1765
1714
  // configs = [ { config, namespace } ... ]
@@ -1773,7 +1722,6 @@ class Config {
1773
1722
 
1774
1723
  config.operators = config.operators || []
1775
1724
  config.bridges = config.bridges || []
1776
- config.trie = config.trie || []
1777
1725
  config.words = config.words || { literals: {}, patterns: [], hierarchy: [] }
1778
1726
  config.generators = config.generators || []
1779
1727
  config.semantics = config.semantics || []
@@ -1830,10 +1778,6 @@ class Config {
1830
1778
  isValidWordDef(config.words)
1831
1779
  }
1832
1780
 
1833
- if (config && config.trie) {
1834
- isValidTrie(config.trie)
1835
- }
1836
-
1837
1781
  if (config && config.priorities) {
1838
1782
  priorities_valid(config.priorities)
1839
1783
  }
@@ -1936,7 +1880,6 @@ class Config {
1936
1880
  this._delta = {
1937
1881
  cacheKey,
1938
1882
  json: {
1939
- trie: [],
1940
1883
  words: [],
1941
1884
  operators: [],
1942
1885
  bridges: [],
@@ -2121,7 +2064,6 @@ class Config {
2121
2064
  setUUIDs () {
2122
2065
  this.config.bridges && this.config.bridges.forEach((bridge) => { bridge.uuid = this._uuid })
2123
2066
  this.config.words && setWordsUUIDs(this.config.words, this._uuid)
2124
- this.config.trie && setTrieUUIDs(this.config.trie, this._uuid)
2125
2067
  this.config.operators && this.config.operators.forEach((operator) => { operator.uuid = this._uuid })
2126
2068
  const ids = Array.from(new Set(this.config.bridges.map((bridge) => bridge.id)))
2127
2069
  ids.sort()
@@ -2198,10 +2140,6 @@ class Config {
2198
2140
  }
2199
2141
  }
2200
2142
 
2201
- if (this.config.trie) {
2202
- mapDefList(this.config.trie)
2203
- }
2204
-
2205
2143
  if (this.config.bridges) {
2206
2144
  this.config.bridges.forEach((bridge) => {
2207
2145
  if (bridge.uuid) {
@@ -2385,9 +2323,6 @@ class Config {
2385
2323
  }
2386
2324
  }
2387
2325
 
2388
- // TODO trie
2389
- isValidTrie(this.config.trie)
2390
-
2391
2326
  const kmsUuids = this.configs.map((km) => km.uuid)
2392
2327
  const bridgesUuids = this.config.bridges.map((bridge) => bridge.uuid).filter((uuid) => uuid)
2393
2328
  let result = true
@@ -2590,7 +2525,6 @@ class Config {
2590
2525
  hierarchy: this.config.hierarchy,
2591
2526
  priorities: this.config.priorities,
2592
2527
  associations: this.config.associations,
2593
- trie: this.config.trie,
2594
2528
  words: this.config.words
2595
2529
  }
2596
2530
 
@@ -2601,8 +2535,6 @@ class Config {
2601
2535
  this.config.associations = { positive: [], negative: [] }
2602
2536
  this.config.words = initWords({})
2603
2537
 
2604
- this.config.trie = []
2605
-
2606
2538
  for (let i = 0; i < addInternals.length; ++i) {
2607
2539
  let name
2608
2540
  if (addInternals[i]) {
@@ -2809,19 +2741,6 @@ class Config {
2809
2741
  }
2810
2742
  }
2811
2743
 
2812
- if (config.trie) {
2813
- // TODO not currently used
2814
- /*
2815
- const words = {}
2816
- for (const word in config.words) {
2817
- words[word] = config.words[word].map((word) => {
2818
- return Object.assign({}, word, { id: toNS(word.id), uuid })
2819
- })
2820
- }
2821
- config.words = words
2822
- */
2823
- }
2824
-
2825
2744
  if (config.hierarchy) {
2826
2745
  helpers.mapInPlace(config.hierarchy, (h) => {
2827
2746
  if (Array.isArray(h)) {
@@ -2942,7 +2861,6 @@ class Config {
2942
2861
 
2943
2862
  // TODO trie
2944
2863
  if (property == 'words') {
2945
- throw "you need to fix this"
2946
2864
  for (const word in value) {
2947
2865
  for (const def of value[word]) {
2948
2866
  if (!def.uuid) {
@@ -2952,10 +2870,6 @@ class Config {
2952
2870
  }
2953
2871
  }
2954
2872
 
2955
- if (property == 'trie') {
2956
- isValidTrie(value)
2957
- }
2958
-
2959
2873
  if (['operators', 'bridges'].includes(property)) {
2960
2874
  for (const def of value) {
2961
2875
  if (!def.uuid) {
@@ -3092,17 +3006,7 @@ class Config {
3092
3006
  this.config[key] = value
3093
3007
  continue
3094
3008
  }
3095
- if (key === 'trie') {
3096
- const configTrie = this.config.trie
3097
- const morePatterns = more.trie
3098
- for (const pattern of morePatterns) {
3099
- if (addFirst) {
3100
- configTrie.unshift(pattern)
3101
- } else {
3102
- configTrie.push(pattern)
3103
- }
3104
- }
3105
- } else if (key === 'words') {
3009
+ if (key === 'words') {
3106
3010
  if (more.words.literals) {
3107
3011
  const literals = this.config.words.literals
3108
3012
  const moreLiterals = more.words.literals
@@ -3243,11 +3147,7 @@ class Config {
3243
3147
  this.config[key] = value
3244
3148
  continue
3245
3149
  }
3246
- if (key === 'trie') {
3247
- for (const pattern of more.trie) {
3248
- this.config.trie.unshift(pattern)
3249
- }
3250
- } else if (key === 'words') {
3150
+ if (key === 'words') {
3251
3151
  if (this.config.words.literals) {
3252
3152
  const literals = this.config.words.literals
3253
3153
  const moreLiterals = more.words.literals