theprogrammablemind_4wp 7.9.0 → 7.10.0-beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/client.js +8 -29
  2. package/package.json +1 -1
  3. package/src/config.js +27 -2
package/client.js CHANGED
@@ -146,7 +146,7 @@ class ErrorReason extends Error {
146
146
  }
147
147
  }
148
148
 
149
- const setupArgs = (args, config, logs, hierarchy) => {
149
+ const setupArgs = (args, config, logs, hierarchy, uuidForScoping) => {
150
150
  config.setArgs(args)
151
151
  args.calls = new InitCalls(args.isInstance ? `${args.isInstance}#${config.name}` : config.name)
152
152
  if (global.theprogrammablemind && global.theprogrammablemind.loadForTesting) {
@@ -184,7 +184,7 @@ const setupArgs = (args, config, logs, hierarchy) => {
184
184
  apis: getAPIs(uuid)
185
185
  }
186
186
  }
187
- Object.assign(args, args.getUUIDScoped(this.uuid))
187
+ Object.assign(args, args.getUUIDScoped(uuidForScoping))
188
188
  args.breakOnSemantics = false
189
189
  args.theDebugger = {
190
190
  breakOnSemantics: (value) => args.breakOnSemantics = value
@@ -636,7 +636,8 @@ const loadInstance = (config, instance) => {
636
636
  if (results.extraConfig) {
637
637
  // config.addInternal(results, useOldVersion = true, skipObjects = false, includeNamespaces = true, allowNameToBeNull = false)
638
638
  // config.addInternal(config.template.queries[i], { handleCalculatedProps: true } )
639
- config.addInternal(instance.template.queries[i], { addFirst: true, handleCalculatedProps: true } )
639
+ const uuid = config.nameToUUID(instance.name)
640
+ config.addInternal(instance.template.queries[i], { uuid, addFirst: true, handleCalculatedProps: true } )
640
641
  } else if (results.apply) {
641
642
  const objects = config.get('objects')
642
643
  const args = { objects, getObjects: getObjects(objects) }
@@ -644,7 +645,9 @@ const loadInstance = (config, instance) => {
644
645
  args.isInstance = `instance${i}`
645
646
  args.instance = instance.queries[i]
646
647
  }
647
- setupArgs(args, config, config.logs, hierarchy)
648
+
649
+ const uuid = config.nameToUUID(instance.name)
650
+ setupArgs(args, config, config.logs, hierarchy, uuid)
648
651
  results.apply(args)
649
652
  } else {
650
653
  if (results.skipSemantics) {
@@ -1022,31 +1025,7 @@ const showExamples = (testFile) => {
1022
1025
  */
1023
1026
 
1024
1027
  const showInfo = (description, section, config) => {
1025
- const name = config.name
1026
- const includes = config.configs.slice(1).map((km) => km.config.name)
1027
- const visibleExamples = []
1028
- for (const test of config.tests) {
1029
- if (!test.developerTest) {
1030
- visibleExamples.push(test.query)
1031
- }
1032
- }
1033
- const templateQueries = []
1034
- if (config.instances && config.instances.length > 0) {
1035
- for (let query of config.instances.slice(-1)[0].queries) {
1036
- if (typeof query == 'string') {
1037
- templateQueries.push(query)
1038
- }
1039
- }
1040
- }
1041
- const info = { name, description, examples: visibleExamples, template: templateQueries, section, includes, demo: config.demo }
1042
- /*
1043
- if (config.instances.length > 0) {
1044
- info.template = {
1045
- base: config.instances[0].base
1046
- }
1047
- }
1048
- */
1049
- console.log(JSON.stringify(info, null, 2))
1028
+ console.log(JSON.stringify(config.getInfo(), null, 2))
1050
1029
  }
1051
1030
 
1052
1031
  const submitBugToAPI = async (subscription_id, subscription_password, config) => {
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.9.0",
68
+ "version": "7.10.0-beta.1",
69
69
  "license": "ISC"
70
70
  }
package/src/config.js CHANGED
@@ -23,6 +23,7 @@ const indent = (string, indent) => {
23
23
  }
24
24
 
25
25
  const config_toServer = (config) => {
26
+ // cant change things because copy breaks something
26
27
  }
27
28
 
28
29
  const debugPriority = (priority) => {
@@ -721,6 +722,27 @@ class Config {
721
722
  return base
722
723
  }
723
724
 
725
+ getInfo () {
726
+ const name = this.name
727
+ const includes = this.configs.slice(1).map((km) => km.config.name)
728
+ const visibleExamples = []
729
+ for (const test of this.tests) {
730
+ if (!test.developerTest) {
731
+ visibleExamples.push(test.query)
732
+ }
733
+ }
734
+ const templateQueries = []
735
+ if (this.instances && this.instances.length > 0) {
736
+ for (let query of this.instances.slice(-1)[0].queries) {
737
+ if (typeof query == 'string') {
738
+ templateQueries.push(query)
739
+ }
740
+ }
741
+ }
742
+ const info = { name, description: this.description, examples: visibleExamples, template: templateQueries, includes }
743
+ return info
744
+ }
745
+
724
746
  getPseudoConfig (uuid, config) {
725
747
  return {
726
748
  description: "this is a pseudo config that has limited functionality due to being available in the initializer function context",
@@ -2401,6 +2423,9 @@ class Config {
2401
2423
  this.checkBridges()
2402
2424
  }
2403
2425
 
2426
+ nameToUUID(name) {
2427
+ return this.configs.find((km) => km._name == name)._uuid
2428
+ }
2404
2429
  // name: namespace name
2405
2430
  // others
2406
2431
  // if undefined namespace applies to first loaded config
@@ -2781,7 +2806,7 @@ class Config {
2781
2806
  }
2782
2807
 
2783
2808
  // TODO get rid of useOldVersion arg
2784
- addInternal (more, { addFirst = false, useOldVersion = true, skipObjects = false, includeNamespaces = true, allowNameToBeNull = false, handleCalculatedProps : hcps = false } = {}) {
2809
+ addInternal (more, { uuid, addFirst = false, useOldVersion = true, skipObjects = false, includeNamespaces = true, allowNameToBeNull = false, handleCalculatedProps : hcps = false } = {}) {
2785
2810
  validConfigProps(more)
2786
2811
  if (more instanceof Config) {
2787
2812
  more.initialize({ force: false })
@@ -2796,7 +2821,7 @@ class Config {
2796
2821
 
2797
2822
  if (hcps) {
2798
2823
  handleCalculatedProps(this, more, addFirst)
2799
- applyUUID(more, this._uuid)
2824
+ applyUUID(more, uuid || this._uuid)
2800
2825
  }
2801
2826
  for (const key of Object.keys(more)) {
2802
2827
  const value = more[key]