theprogrammablemind 7.5.8-beta.47 → 7.5.8-beta.49

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
@@ -1492,7 +1492,8 @@ const knowledgeModule = async ({
1492
1492
  if (!isProcess) {
1493
1493
  if (template) {
1494
1494
  if (config.needsRebuild(template.template, template.instance)) {
1495
- throw new 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.`)
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
+ throw new Error(error)
1496
1497
  }
1497
1498
  try {
1498
1499
  config.load(template.template, template.instance)
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.47",
66
+ "version": "7.5.8-beta.49",
67
67
  "license": "ISC"
68
68
  }
package/src/config.js CHANGED
@@ -933,17 +933,35 @@ class Config {
933
933
  const instanceFragments = (instance.fragments || []).map((fragment) => fragment.key || fragment.query).map( toCanonical )
934
934
  const templateFragments = (template.fragments || []).concat(this.dynamicFragments).map( toCanonical )
935
935
  const sameFragments = helpers.safeEquals(templateFragments, instanceFragments)
936
- const cleanupWhere = (query) => {
937
- if (typeof query == 'string') {
936
+ const toCanonicalQuery = (queryOrConfig) => {
937
+ if (typeof queryOrConfig == 'string') {
938
+ const query = queryOrConfig
938
939
  return query
939
940
  } else {
940
- return { ...query, where: undefined }
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
+ })
957
+ return config
941
958
  }
942
959
  }
943
- const cleanupWheres = (elements) => {
944
- return elements.map( cleanupWhere )
960
+ const toCanonicalQueries = (elements) => {
961
+ return elements.map( toCanonicalQuery )
945
962
  }
946
- const sameQueries = helpers.safeEquals(cleanupWheres(template.queries || []).map(helpers.updateQueries), cleanupWheres(instance.queries || []))
963
+
964
+ const sameQueries = helpers.safeEquals(toCanonicalQueries(template.queries || []).map(helpers.updateQueries), toCanonicalQueries(instance.queries || []))
947
965
  return !(instance && sameQueries && sameFragments)
948
966
  }
949
967