theprogrammablemind_4wp 8.0.0-beta.19 → 8.0.0-beta.20

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 +19 -63
package/package.json CHANGED
@@ -64,6 +64,6 @@
64
64
  "sort-json": "^2.0.0",
65
65
  "uuid": "^8.3.2"
66
66
  },
67
- "version": "8.0.0-beta.19",
67
+ "version": "8.0.0-beta.20",
68
68
  "license": "UNLICENSED"
69
69
  }
package/src/config.js CHANGED
@@ -1210,7 +1210,9 @@ class Config {
1210
1210
  // console.log("instanceFragments", instanceFragments)
1211
1211
  }
1212
1212
  }
1213
- if (startOfChanges || instance.resultss) {
1213
+ if (startOfChanges) {
1214
+ return { needsRebuild: true, startOfChanges, previousResultss: instance.resultss }
1215
+ } else if (startOfChanges || instance.resultss) {
1214
1216
  return { needsRebuild: !(instance && sameQueries && sameFragments), startOfChanges, previousResultss: instance.resultss }
1215
1217
  } else {
1216
1218
  return { needsRebuild: !(instance && sameQueries && sameFragments) }
@@ -1820,24 +1822,6 @@ class Config {
1820
1822
  // when running configs any bridges added are marked as transitory so that the associated will ignore those op's
1821
1823
  this.transitoryMode = false
1822
1824
 
1823
- // check for duplicate bridges
1824
- if (config && config.bridges) {
1825
- let duplicated = new Set()
1826
- const seen = new Set()
1827
- for (const bridge of config.bridges) {
1828
- const id = `${bridge.id}/${bridge.level}`
1829
- if (seen.has(id)) {
1830
- duplicated.add(id)
1831
- } else {
1832
- seen.add(id)
1833
- }
1834
- }
1835
- duplicated = Array.from(duplicated)
1836
- if (duplicated.length > 0) {
1837
- throw new Error(`In the KM ${config.name}, the following operators are duplicated in the bridges: ${duplicated}`)
1838
- }
1839
- }
1840
-
1841
1825
  if (config && config.words) {
1842
1826
  initWords(config.words)
1843
1827
  isValidWordDef(config.words)
@@ -1886,6 +1870,7 @@ class Config {
1886
1870
  }
1887
1871
  this.get('objects').namespaced[this._uuid] = {}
1888
1872
  this.valid()
1873
+ this.checks()
1889
1874
  debugConfigProps(this.config)
1890
1875
  }
1891
1876
 
@@ -2631,7 +2616,7 @@ class Config {
2631
2616
 
2632
2617
  this.hierarchy.edges = this.config.hierarchy
2633
2618
  this.valid()
2634
- this.checkBridges()
2619
+ this.checks()
2635
2620
  }
2636
2621
 
2637
2622
  nameToUUID (name) {
@@ -2845,6 +2830,11 @@ class Config {
2845
2830
  }
2846
2831
  }
2847
2832
 
2833
+ checks () {
2834
+ this.checkOperators()
2835
+ this.checkBridges()
2836
+ }
2837
+
2848
2838
  checkOperators () {
2849
2839
  if (!this.config.operators) {
2850
2840
  return
@@ -2865,53 +2855,19 @@ class Config {
2865
2855
  return
2866
2856
  }
2867
2857
 
2868
- /*
2869
- "namespaces": {
2870
- "634a678b-8d92-4464-bf65-943a82f404d8": {
2871
- "ids": [ "tankConcept" ],
2872
- "namespace": [ "ns1" ]
2873
- },
2874
- console.log('before check', JSON.stringify(this._eqClasses, null, 2))
2875
- */
2876
-
2877
- const errors = []
2878
- /*
2879
- const namespaces = this.config.namespaces
2880
- const nsToIds = {}
2881
- for (const uuid in namespaces) {
2882
- const namespace = namespaces[uuid].namespace
2883
- const ns = namespace.join('#')
2884
- if (!nsToIds[ns]) {
2885
- nsToIds[ns] = new Set()
2886
- }
2887
- const ids = nsToIds[ns]
2888
- for (const id of namespaces[uuid].ids) {
2889
- if (ids.has(id)) {
2890
- if (ns === '') {
2891
- const dups = this.config.bridges.filter( (bridge) => bridge.id == id )
2892
- errors.push(`Id '${id}' is defined more than once in the bridges of the base namespace of the KM ${this.name}, Dups are ${JSON.stringify(dups)}`)
2893
- } else {
2894
- errors.push(`Id '${id}' is defined more than once in the bridges of the ${ns} namespace of the KM ${this.name}`)
2895
- }
2896
- } else {
2897
- ids.add(id)
2898
- }
2899
- }
2900
- }
2901
- */
2902
-
2903
- const keyIsPresent = {}
2858
+ let duplicated = new Set()
2859
+ const seen = new Set()
2904
2860
  for (const bridge of this.config.bridges) {
2905
- const key = `${bridge.id}/${bridge.level} (namespace: ${bridge.uuid})`
2906
- if (keyIsPresent[key]) {
2907
- errors.push(new Error(`Id '${key}' is defined more than once in bridges of the base namespace of the KM ${this.name}`))
2861
+ const id = `${bridge.id}/${bridge.level} (namespace: ${bridge.uuid || this.uuid})`
2862
+ if (seen.has(id)) {
2863
+ duplicated.add(id)
2908
2864
  } else {
2909
- keyIsPresent[key] = key
2865
+ seen.add(id)
2910
2866
  }
2911
2867
  }
2912
-
2913
- if (errors.length > 0) {
2914
- throw errors
2868
+ duplicated = Array.from(duplicated)
2869
+ if (duplicated.length > 0) {
2870
+ throw new Error(`In the KM ${this.name}, the following operators are duplicated in the bridges: ${duplicated}`)
2915
2871
  }
2916
2872
  };
2917
2873