theprogrammablemind_4wp 7.3.9-beta.12 → 7.3.9-beta.14
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/package.json +1 -1
- package/src/config.js +5 -4
- package/src/generators.js +6 -6
    
        package/package.json
    CHANGED
    
    
    
        package/src/config.js
    CHANGED
    
    | @@ -1257,6 +1257,7 @@ class Config { | |
| 1257 1257 | 
             
                cp.isModule = this.isModule
         | 
| 1258 1258 | 
             
                cp.initInstances = this.initInstances.slice()
         | 
| 1259 1259 | 
             
                cp.instances = this.instances.slice()
         | 
| 1260 | 
            +
                cp.configCounter = this.configCounter
         | 
| 1260 1261 |  | 
| 1261 1262 | 
             
                cp.initConfig = _.cloneDeep(this.initConfig)
         | 
| 1262 1263 | 
             
                cp.defaultConfig()
         | 
| @@ -1267,6 +1268,7 @@ class Config { | |
| 1267 1268 | 
             
                  Object.assign(cp.config.objects, _.cloneDeep(this.initConfig.objects || {}))
         | 
| 1268 1269 | 
             
                }
         | 
| 1269 1270 | 
             
                // cp.initializeConfigFromConfigs({ others: [], objects: cp.config.objects.namespaced, moreNames: [], ...options })
         | 
| 1271 | 
            +
                // cp.initializeConfigFromConfigs(Object.assign({ others: [], objects: cp.config.objects.namespaced, moreNames: [] }, { callInitializers: false }))
         | 
| 1270 1272 | 
             
                cp.initializeConfigFromConfigs(Object.assign({ others: [], objects: cp.config.objects.namespaced, moreNames: [] }, options))
         | 
| 1271 1273 | 
             
                const map = {}
         | 
| 1272 1274 | 
             
                for (let i = 0; i < this.configs.length; ++i) {
         | 
| @@ -1274,6 +1276,9 @@ class Config { | |
| 1274 1276 | 
             
                }
         | 
| 1275 1277 | 
             
                cp.mapUUIDs(map)
         | 
| 1276 1278 |  | 
| 1279 | 
            +
                if (options.callInitializers) {
         | 
| 1280 | 
            +
                  cp.rebuild(options)
         | 
| 1281 | 
            +
                }
         | 
| 1277 1282 | 
             
                if (cp._api) {
         | 
| 1278 1283 | 
             
                  cp._api.objects = cp.config.objects
         | 
| 1279 1284 | 
             
                  cp._api.config = () => (cp instanceof Config) ? cp : cp.config
         | 
| @@ -1290,9 +1295,6 @@ class Config { | |
| 1290 1295 | 
             
                  cp.config.objects.namespaced[km._uuid] = {}
         | 
| 1291 1296 | 
             
                })
         | 
| 1292 1297 |  | 
| 1293 | 
            -
                if (options.callInitializers) {
         | 
| 1294 | 
            -
                  cp.rebuild(options)
         | 
| 1295 | 
            -
                }
         | 
| 1296 1298 | 
             
                cp.valid()
         | 
| 1297 1299 | 
             
                return cp
         | 
| 1298 1300 | 
             
              }
         | 
| @@ -1771,7 +1773,6 @@ class Config { | |
| 1771 1773 |  | 
| 1772 1774 | 
             
                if (callInitializers) {
         | 
| 1773 1775 | 
             
                  [...this.configs].reverse().forEach(({ namespace, uuid, config, isSelf }) => {
         | 
| 1774 | 
            -
                    console.log(config.name)
         | 
| 1775 1776 | 
             
                    if (isSelf) {
         | 
| 1776 1777 | 
             
                      config = this
         | 
| 1777 1778 | 
             
                    }
         | 
    
        package/src/generators.js
    CHANGED
    
    | @@ -171,7 +171,7 @@ class Generators { | |
| 171 171 | 
             
                  let context = contexts[icontext]
         | 
| 172 172 | 
             
                  context = Object.assign({}, context, assumed)
         | 
| 173 173 | 
             
                  // let context_prime = JSON.stringify(context);
         | 
| 174 | 
            -
                  let  | 
| 174 | 
            +
                  let generated = context
         | 
| 175 175 | 
             
                  let applied = false
         | 
| 176 176 | 
             
                  const stack = args.calls.push()
         | 
| 177 177 | 
             
                  for (let igenerator = 0; igenerator < this.generators.length; ++igenerator) {
         | 
| @@ -189,10 +189,10 @@ class Generators { | |
| 189 189 | 
             
                      // this.logs.push(`Generators: applied ${generator.toString()}\n to\n ${JSON.stringify(context)}`)
         | 
| 190 190 | 
             
                      let errorMessage = 'The apply function did not return a value'
         | 
| 191 191 | 
             
                      try {
         | 
| 192 | 
            -
                         | 
| 192 | 
            +
                        generated= generator.apply(args, objects, g, args.gs, context, hierarchy, config, response, log)
         | 
| 193 193 | 
             
                      } catch( e ) {
         | 
| 194 194 | 
             
                        // the next if handle this
         | 
| 195 | 
            -
                         | 
| 195 | 
            +
                        generated = null
         | 
| 196 196 | 
             
                        if (e.stack && e.message) {
         | 
| 197 197 | 
             
                          errorMessage = `Error applying generator '${generator.notes}'. Error is ${e.toString()} stack is ${e.stack}. Generator is ${generator.toString()}`
         | 
| 198 198 | 
             
                        } else if (e.error) {
         | 
| @@ -201,7 +201,7 @@ class Generators { | |
| 201 201 | 
             
            							errorMessage = e.toString()
         | 
| 202 202 | 
             
            						}
         | 
| 203 203 | 
             
                      }
         | 
| 204 | 
            -
                      if (! | 
| 204 | 
            +
                      if (!generated && generated !== '') {
         | 
| 205 205 | 
             
                        const widths = [10, 10, 90]
         | 
| 206 206 | 
             
                        const lines = new Lines(widths)
         | 
| 207 207 | 
             
                        lines.setElement(0, 0, 'Generator')
         | 
| @@ -244,7 +244,7 @@ class Generators { | |
| 244 244 | 
             
                        lines.setElement(0, 2, generator.toString())
         | 
| 245 245 | 
             
                        lines.newRow()
         | 
| 246 246 | 
             
                        lines.setElement(0, 1, 'RESULT')
         | 
| 247 | 
            -
                        lines.setElement(0, 2,  | 
| 247 | 
            +
                        lines.setElement(0, 2, generated)
         | 
| 248 248 | 
             
                        lines.newRow()
         | 
| 249 249 | 
             
                        lines.setElement(0, 1, 'STACK')
         | 
| 250 250 | 
             
                        lines.setElement(0, 2, stack)
         | 
| @@ -275,7 +275,7 @@ class Generators { | |
| 275 275 | 
             
                    lines.setElement(0, 2, JSON.stringify(context, null, 2))
         | 
| 276 276 | 
             
                    this.logs.push(lines.toString())
         | 
| 277 277 | 
             
                  }
         | 
| 278 | 
            -
                  contextsPrime.push( | 
| 278 | 
            +
                  contextsPrime.push(generated)
         | 
| 279 279 | 
             
                }
         | 
| 280 280 | 
             
                return contextsPrime
         | 
| 281 281 | 
             
              }
         |