theprogrammablemind 7.5.8-beta.51 → 7.5.8-beta.52

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 (3) hide show
  1. package/client.js +1 -1
  2. package/package.json +1 -1
  3. package/src/config.js +22 -20
package/client.js CHANGED
@@ -1491,7 +1491,7 @@ const knowledgeModule = async ({
1491
1491
 
1492
1492
  if (!isProcess) {
1493
1493
  if (template) {
1494
- if (config.needsRebuild(template.template, template.instance)) {
1494
+ if (config.needsRebuild(template.template, template.instance, { isTemplate: !isProcess })) {
1495
1495
  const error = `This module "${config.name}" cannot be used because the instance file needs rebuilding. Run on the command line with no arguments or the -rt argument to rebuild.`
1496
1496
  throw new Error(error)
1497
1497
  }
package/package.json CHANGED
@@ -63,6 +63,6 @@
63
63
  "json-stable-stringify": "^1.0.1",
64
64
  "node-fetch": "^2.6.1"
65
65
  },
66
- "version": "7.5.8-beta.51",
66
+ "version": "7.5.8-beta.52",
67
67
  "license": "ISC"
68
68
  }
package/src/config.js CHANGED
@@ -919,7 +919,7 @@ class Config {
919
919
  }
920
920
  }
921
921
 
922
- needsRebuild(template, instance, options = { rebuild: false }) {
922
+ needsRebuild(template, instance, options = { rebuild: false, isModule: false }) {
923
923
  if (options.rebuild) {
924
924
  return true
925
925
  }
@@ -939,21 +939,27 @@ class Config {
939
939
  return query
940
940
  } else {
941
941
  const config = { ...queryOrConfig }
942
- delete config.where
943
- config.generators = (config.generators || []).map((generator) => {
944
- generator = {...generator}
945
- delete generator.where
946
- generator.match = generator.match.toString()
947
- generator.apply = generator.apply.toString()
948
- return generator
949
- })
950
- config.semantics = (config.semantics || []).map((semantic) => {
951
- semantic = {...semantic}
952
- delete semantic.where
953
- semantic.match = semantic.match.toString()
954
- semantic.apply = semantic.apply.toString()
955
- return semantic
956
- })
942
+ if (options.isModule) {
943
+ // things like webpack rewrite the functions if there are constants so this compare does not work
944
+ delete config.generators
945
+ delete config.semantics
946
+ } else {
947
+ delete config.where
948
+ config.generators = (config.generators || []).map((generator) => {
949
+ generator = {...generator}
950
+ delete generator.where
951
+ generator.match = generator.match.toString()
952
+ generator.apply = generator.apply.toString()
953
+ return generator
954
+ })
955
+ config.semantics = (config.semantics || []).map((semantic) => {
956
+ semantic = {...semantic}
957
+ delete semantic.where
958
+ semantic.match = semantic.match.toString()
959
+ semantic.apply = semantic.apply.toString()
960
+ return semantic
961
+ })
962
+ }
957
963
  return config
958
964
  }
959
965
  }
@@ -962,10 +968,6 @@ class Config {
962
968
  }
963
969
 
964
970
  const sameQueries = helpers.safeEquals(toCanonicalQueries(template.queries || []).map(helpers.updateQueries), toCanonicalQueries(instance.queries || []))
965
- // greg99
966
- console.log("sameQueries", sameQueries)
967
- console.log('template.queries', toCanonicalQueries(template.queries || []).map(helpers.updateQueries))
968
- console.log('instance.queries', toCanonicalQueries(instance.queries || []))
969
971
  return !(instance && sameQueries && sameFragments)
970
972
  }
971
973