theprogrammablemind_4wp 7.6.0-beta.5 → 7.6.0-beta.7

Sign up to get free protection for your applications and to get access to all the features.
package/client.js CHANGED
@@ -175,8 +175,8 @@ const setupArgs = (args, config, logs, hierarchy) => {
175
175
  }
176
176
  args.s = (c) => config.getSemantics(logs).apply(args, c)
177
177
  args.g = (c) => config.getGenerators(logs).apply(args, c)
178
- args.gp = (c) => config.getGenerators(logs).apply(args, { ...c, paraphrase: true, isResponse: false, response: false})
179
- args.gr = (c) => config.getGenerators(logs).apply(args, { ...c, paraphrase: false, isResponse: true })
178
+ args.gp = (c) => config.getGenerators(logs).apply({...args, assumed: {paraphrase: true, isResponse: false, response: false}}, c, {paraphrase: true, isResponse: false, response: false})
179
+ args.gr = (c) => config.getGenerators(logs).apply({...args, assumed: {paraphrase: false, isResponse: true}}, { ...c, paraphrase: false, isResponse: true })
180
180
  if (!logs) {
181
181
  debugger
182
182
  }
@@ -189,6 +189,11 @@ const setupArgs = (args, config, logs, hierarchy) => {
189
189
  }
190
190
 
191
191
  const gs = (g) => (contexts, separator, lastSeparator) => {
192
+ if (!Array.isArray(contexts)) {
193
+ debugger
194
+ throw new Error("Expected a list")
195
+ }
196
+
192
197
  let s = ''
193
198
  if (!separator) {
194
199
  separator = ' '
@@ -276,8 +281,9 @@ const processContext = (context, { objects = {}, config, logs = [] }) => {
276
281
  setupArgs(args, config, logs, hierarchy)
277
282
 
278
283
  context = semantics.apply(args, context)
279
- const generated = generators.apply(args, context)[0]
280
- const paraphrases = generators.apply(args, context, { paraphrase: true, response: false, isResponse: false })[0]
284
+ const generated = generators.apply(args, context)
285
+ const assumed = { paraphrase: true, response: false, isResponse: false }
286
+ const paraphrases = generators.apply({...args, assumed}, context, { paraphrase: true, response: false, isResponse: false })
281
287
  let responses = []
282
288
  if (context.isResponse) {
283
289
  responses = generated
@@ -447,37 +453,29 @@ const processContextsB = ({ config, hierarchy, semantics, generators, json, isTe
447
453
  continue
448
454
  }
449
455
  let assumed = { isResponse: true };
450
- const generated = contextPrime.isResponse ? config.getGenerators(json.logs).apply(args, contextPrime, assumed)[0] : ''
456
+ const generated = contextPrime.isResponse ? config.getGenerators(json.logs).apply({...args, assumed}, contextPrime, assumed) : ''
451
457
  let generatedParenthesized = []
452
458
  if (generateParenthesized) {
453
459
  config.parenthesized = true
454
- generatedParenthesized = contextPrime.isResponse ? config.getGenerators(json.logs).apply(args, contextPrime, assumed)[0] : ''
460
+ generatedParenthesized = contextPrime.isResponse ? config.getGenerators(json.logs).apply({...args, assumed}, contextPrime, assumed) : ''
455
461
  config.parenthesized = false
456
462
  }
457
463
  // assumed = { paraphrase: true, response: false };
458
- assumed = { paraphrase: true };
459
- args.g = (c) => config.getGenerators(json.logs).apply(args, c, assumed)
460
- args.gp = (c) => config.getGenerators(json.logs).apply(args, {...c, paraphrase: true, isResponse: false, response: false }, assumed)
461
- args.gr = (c) => config.getGenerators(json.logs).apply(args, {...c, paraphrase: false }, assumed)
464
+ assumed = { paraphrase: true, isResponse: false, response: false };
465
+ args.g = (c) => config.getGenerators(json.logs).apply({...args, assumed}, c, assumed)
462
466
  args.gs = gs(args.g)
463
- args.gsp = gs(args.gsp)
464
- args.gsr = gs(args.gr)
465
467
  if (generateParenthesized) {
466
468
  config.parenthesized = false
467
469
  }
468
- const paraphrases = config.getGenerators(json.logs).apply(args, contextPrime, assumed)[0]
470
+ const paraphrases = config.getGenerators(json.logs).apply({...args, assumed}, contextPrime, assumed)
469
471
  let paraphrasesParenthesized = []
470
472
  if (generateParenthesized) {
471
473
  config.parenthesized = true
472
- paraphrasesParenthesized = config.getGenerators(json.logs).apply(args, contextPrime, assumed)[0]
474
+ paraphrasesParenthesized = config.getGenerators(json.logs).apply({...args, assumed}, contextPrime, assumed)
473
475
  config.parenthesized = false
474
476
  }
475
477
  args.g = (c) => config.getGenerators(json.logs).apply(args, c)
476
- args.gp = (c) => config.getGenerators(json.logs).apply(args, {...c, paraphrase: true, isResponse: false, response: false })
477
- args.gr = (c) => config.getGenerators(json.logs).apply(args, {...c, paraphrase: false })
478
478
  args.gs = gs(args.g)
479
- args.gsp = gs(args.gp)
480
- args.gsr = gs(args.gr)
481
479
  contextsPrime.push(contextPrime)
482
480
  generatedPrime.push(generated)
483
481
  paraphrasesPrime.push(paraphrases)
@@ -660,6 +658,7 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
660
658
  opChoices: []
661
659
  },
662
660
  times: 0.0,
661
+ clientSideTimes: 0.0,
663
662
  trace: '',
664
663
  contexts: [],
665
664
  generated: [],
@@ -701,8 +700,16 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
701
700
  if (json.status !== 200) {
702
701
  throw json
703
702
  } else {
703
+ let clientSideTime
704
+ if (isTest) {
705
+ start = runtime.performance.performance.now()
706
+ }
704
707
  const { contextsPrime, generatedPrime, paraphrasesPrime, paraphrasesParenthesizedPrime, generatedParenthesizedPrime, responsesPrime } =
705
708
  processContextsB({ isTest, config, hierarchy, json, commandLineArgs /*, generators, semantics */ })
709
+ if (isTest) {
710
+ end = runtime.performance.performance.now()
711
+ clientSideTime = end - start
712
+ }
706
713
  response.associations = json.associations
707
714
  response.learned_contextual_priorities = json.learned_contextual_priorities
708
715
  response.hierarchy = json.hierarchy
@@ -713,6 +720,7 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
713
720
  // appendNoDups(response.metadata.priorities, json.metadata.priorities)
714
721
  appendNoDups(response.metadata.opChoices, json.metadata.opChoices)
715
722
  response.times += json.times
723
+ response.clientSideTimes += clientSideTime
716
724
  response.trace = response.trace.concat(json.trace)
717
725
  response.version = json.version
718
726
  response.explain_priorities = json.explain_priorities
@@ -802,10 +810,10 @@ const runTest = async (config, expected, { args, verbose, testConfig, debug }) =
802
810
  defaultInnerProcess(config, errorHandler, result)
803
811
  }
804
812
  if (verbose) {
805
- const widths = [100, 20]
813
+ const widths = [100, 60]
806
814
  const lines = new Lines(widths)
807
815
  lines.setElement(0, 0, test)
808
- lines.setElement(0, 1, `time on server ${result.times.toFixed(2)}`)
816
+ lines.setElement(0, 1, `time on server: ${result.times.toFixed(2)} client: ${(result.clientSideTimes/1000).toFixed(2)}`)
809
817
  lines.log()
810
818
  }
811
819
  const expected_objects = sortJson(convertToStable(expected.objects), { depth: 25 })
@@ -1323,6 +1331,7 @@ const rebuildTemplate = async ({ config, target, template, errorHandler = defaul
1323
1331
  } else {
1324
1332
  delete result.load_cache_time
1325
1333
  delete result.times
1334
+ delete result.clientSideTimes
1326
1335
  delete result.memory_free_percent
1327
1336
  delete result.logs
1328
1337
  delete result.version
@@ -1362,6 +1371,28 @@ const rebuildTemplate = async ({ config, target, template, errorHandler = defaul
1362
1371
  await looper(Object.assign([], todo))
1363
1372
  }
1364
1373
 
1374
+ const checkTemplate = (template) => {
1375
+ return
1376
+ if (!template) {
1377
+ return
1378
+ }
1379
+ if (template.checks) {
1380
+ throw new Error("The 'checks' property should be in the 'test' property not the 'template' property")
1381
+ }
1382
+ }
1383
+
1384
+ const checkTest = (testConfig) => {
1385
+ if (!testConfig) {
1386
+ return
1387
+ }
1388
+ if (!testConfig.name) {
1389
+ throw new Error("The 'test' property is missing the 'name' property that contains the name of the '<km>.test.json' file")
1390
+ }
1391
+ if (!testConfig.contents) {
1392
+ throw new Error("The 'test' property is missing the 'contents' property that contains contents of the '<km>.test.json' file")
1393
+ }
1394
+ }
1395
+
1365
1396
  const knowledgeModule = async ({
1366
1397
  module: moduleFromJSFile,
1367
1398
  description,
@@ -1395,9 +1426,10 @@ const knowledgeModule = async ({
1395
1426
  if (!description) {
1396
1427
  throw new Error("'description' is a required parameter. The value should the description of the knowledge module.")
1397
1428
  }
1398
- if (!test) {
1429
+ if (!testConfig) {
1399
1430
  throw new Error("'test' is a required parameter. The value should the path to the file used to store the tests of the knowledge module and the contents of the file in the form { name: <filePath>, contexts: <json> }.")
1400
1431
  }
1432
+ checkTest(testConfig)
1401
1433
 
1402
1434
  const isProcess = require.main === moduleFromJSFile
1403
1435
 
@@ -1666,6 +1698,8 @@ const knowledgeModule = async ({
1666
1698
  }
1667
1699
  }
1668
1700
 
1701
+ checkTemplate(template)
1702
+
1669
1703
  if (template) {
1670
1704
  const needsRebuild = config.needsRebuild(template.template, template.instance, options)
1671
1705
  if (needsRebuild) {
@@ -1689,7 +1723,6 @@ const knowledgeModule = async ({
1689
1723
  if (args.test || args.testVerbose || args.testAllVerbose || args.save) {
1690
1724
  global.transitoryMode = true
1691
1725
  }
1692
-
1693
1726
  if (!args.query && !args.test && !args.info && (args.save || args.saveDeveloper)) {
1694
1727
  global.transitoryMode = true
1695
1728
  saveTests(config, test, testConfig, args.saveDeveloper)
@@ -1711,7 +1744,6 @@ const knowledgeModule = async ({
1711
1744
  useTestConfig = config.getConfigs()[args.testModuleName].getTestConfig()
1712
1745
  useTestConfig.testModuleName = args.testModuleName
1713
1746
  test = useTestConfig.name
1714
-
1715
1747
  }
1716
1748
  runTests(config, test, { args, debug: args.debug, testConfig: useTestConfig, verbose: args.testVerbose || args.testAllVerbose, stopAtFirstError: !args.testAllVerbose }).then((results) => {
1717
1749
  let newError = false
@@ -1760,12 +1792,16 @@ const knowledgeModule = async ({
1760
1792
  show('paraphrases', result.expected.paraphrases, result.actual.paraphrases)
1761
1793
  if (!args.testNoParenthesized) {
1762
1794
  show('paraphrases parenthesized', result.expected.paraphrasesParenthesized, result.actual.paraphrasesParenthesized)
1795
+ if (args.vimdiff) {
1796
+ vimdiff(result.actual.paraphrasesParenthesized, result.expected.paraphrasesParenthesized)
1797
+ }
1798
+ }
1799
+ /*
1763
1800
  }
1764
1801
  show('responses', result.expected.responses, result.actual.responses)
1765
1802
  if (!args.testNoParenthesized) {
1766
1803
  show('responses parenthesized', result.expected.generatedParenthesized, result.actual.generatedParenthesized)
1767
1804
  }
1768
- /*
1769
1805
  if (JSON.stringify(result.expected.paraphrases) !== JSON.stringify(result.actual.paraphrases)) {
1770
1806
  if (!headerShown) {
1771
1807
  console.log(' Failure')
@@ -1829,16 +1865,18 @@ const knowledgeModule = async ({
1829
1865
  }
1830
1866
  }
1831
1867
  }
1832
- if (!headerShown) {
1868
+ if (hasError) {
1869
+ if (!headerShown) {
1870
+ if (!(useTestConfig.check && useTestConfig.check.length > 0)) {
1871
+ console.log('There are failures due to things other than paraphrases, responses and checked properties being different. They are not shown because you ran -tv or -tva which only shows difference in paraphrase and results. Usually what I do is -s and do a diff to make sure there are no other problems. If the paraphrases or results were different they would have shown here.')
1872
+ }
1873
+ }
1833
1874
  if (!(useTestConfig.check && useTestConfig.check.length > 0)) {
1834
- console.log('There are failures due to things other than paraphrases, responses and checked properties being different. They are not shown because you ran -tv or -tva which only shows difference in paraphrase and results. Usually what I do is -s and do a diff to make sure there are no other problems. If the paraphrases or results were different they would have shown here.')
1875
+ console.log('use -v arg to write files expected.json and actual.json in the current directory for detailed comparison. Or do -s and then git diff the changes.')
1876
+ // console.log(JSON.stringify(contexts))
1877
+ console.log('**************************** ERRORS ************************')
1835
1878
  }
1836
1879
  }
1837
- if (!(useTestConfig.check && useTestConfig.check.length > 0)) {
1838
- console.log('use -v arg to write files expected.json and actual.json in the current directory for detailed comparison. Or do -s and then git diff the changes.')
1839
- // console.log(JSON.stringify(contexts))
1840
- console.log('**************************** ERRORS ************************')
1841
- }
1842
1880
  }
1843
1881
  // const contexts = { failures: results }
1844
1882
  l(n - 1, hasError || newError)
package/package.json CHANGED
@@ -64,6 +64,6 @@
64
64
  "json-stable-stringify": "^1.0.1",
65
65
  "node-fetch": "^2.6.1"
66
66
  },
67
- "version": "7.6.0-beta.5",
67
+ "version": "7.6.0-beta.7",
68
68
  "license": "ISC"
69
69
  }
package/runtime.js CHANGED
@@ -14,4 +14,5 @@ module.exports = {
14
14
  jsonDiff: "Should not be called in the browser",
15
15
  sortJson: "Should not be called in the browser",
16
16
  util: "Should not be called in the browser",
17
+ performance: "Should not be called in the browser",
17
18
  }
package/src/generators.js CHANGED
@@ -165,136 +165,130 @@ class Generators {
165
165
  this.logs = logs
166
166
  };
167
167
 
168
- // assumed - properties added to contexts before the generators are called. For setting paraphrase property
169
- apply (args, contexts, assumed = {}, options = {}) {
168
+ // assumed - properties added to context before the generators are called. For setting paraphrase property
169
+ apply (args, context, assumed = {}, options = {}) {
170
+ if (Array.isArray(context)) {
171
+ return new Error("Expected a context not an array")
172
+ }
173
+ if (typeof context !== 'object') {
174
+ return String(context)
175
+ }
176
+
170
177
  const config = args.config
171
178
  const objects = args.objects
172
179
  const hierarchy = args.hierarchy
173
180
  const response = args.response
174
- if (Array.isArray(contexts)) {
175
- // no-op
176
- } else if (typeof contexts === 'object') {
177
- contexts = [contexts]
178
- } else {
179
- return String(contexts)
180
- }
181
181
 
182
- const contextsPrime = []
183
- for (const icontext in contexts) {
184
- let context = contexts[icontext]
185
- context = Object.assign({}, context, assumed)
186
- // let context_prime = JSON.stringify(context);
187
- let generated = context
188
- let applied = false
189
- const stack = args.calls.push()
190
- for (let igenerator = 0; igenerator < this.generators.length; ++igenerator) {
191
- const generator = this.generators[igenerator]
192
- if (generator.matches(args, objects, context, hierarchy, config, options)) {
193
- const g = (context, options) => {
194
- const r = this.apply(args, context, Object.assign({}, ((options||{}).assumed || {}), assumed), options)
195
- if (Array.isArray(r)) {
196
- return r.join(' ')
197
- } else {
198
- return r
199
- }
200
- }
201
- const log = (message) => { this.logs.push(message) }
202
- // this.logs.push(`Generators: applied ${generator.toString()}\n to\n ${JSON.stringify(context)}`)
203
- let errorMessage = 'The apply function did not return a value'
204
- try {
205
- generated= generator.apply(args, objects, g, args.gs, context, hierarchy, config, response, log)
206
- } catch( e ) {
207
- // the next if handle this
208
- generated = null
209
- e.retryCall = () => generator.apply(args, objects, g, args.gs, context, hierarchy, config, response, log)
210
- const help = 'The error has a retryCall property that will recall the function that failed.'
211
- if (e.stack && e.message) {
212
- const info = `${generator.notes ? generator.notes : ''}${generator.where ? generator.where : ''}`
213
- errorMessage = `Error applying generator '${info}. Error is ${e.toString()} stack is ${e.stack}. Generator is ${generator.toString()}. ${help}`
214
- } else if (e.error) {
215
- const info = `${generator.notes ? generator.notes : ''}${generator.where ? generator.where : ''}`
216
- errorMessage = `Error applying generator '${info}. Error is ${e.error.join()}. Generator is ${generator.toString()}. ${help}`
217
- } else {
218
- errorMessage = e.toString()
219
- }
182
+ context = Object.assign({}, context, args.assumed)
183
+ let generated = ''
184
+ let applied = false
185
+ const stack = args.calls.push()
186
+ for (let igenerator = 0; igenerator < this.generators.length; ++igenerator) {
187
+ const generator = this.generators[igenerator]
188
+ if (generator.matches(args, objects, context, hierarchy, config, options)) {
189
+ const g = (context, options) => {
190
+ const r = this.apply(args, context, Object.assign({}, ((options||{}).assumed || {}), assumed), options)
191
+ if (Array.isArray(r)) {
192
+ return r.join(' ')
193
+ } else {
194
+ return r
220
195
  }
221
- if (!generated && generated !== '') {
222
- const widths = [10, 10, 90]
223
- const lines = new Lines(widths)
224
- lines.setElement(0, 0, 'Generator')
225
- const source = `${generator.km}/#${generator.index}`
226
- lines.setElement(0, 2, `ERROR while applying (${source}) ${generator.toLabel()}`)
227
- lines.newRow()
228
- lines.setElement(0, 2, generator.toString())
229
- lines.newRow()
230
- lines.setElement(0, 1, 'TO')
231
- lines.setElement(0, 2, `(HASHCODE ${helpers.hashCode(JSON.stringify(helpers.sortJson(context, { depth: 25 })))})`)
232
- lines.setElement(1, 2, JSON.stringify(helpers.sortJson(context, { depth: 25 }), null, 2))
233
- lines.newRow()
234
- lines.setElement(0, 1, 'STACK')
235
- lines.setElement(0, 2, stack)
236
- lines.newRow()
237
- lines.setElement(0, 1, 'DEBUG')
238
- lines.setElement(0, 2, `To debug this use args.callId == '${args.calls.current()}'`)
239
- lines.newRow()
240
- lines.setElement(0, 1, 'ERROR')
241
- lines.setElement(0, 2, errorMessage)
242
- this.logs.push(lines.toString())
243
- const message = `ERROR while applying (${source}) ${generator.toLabel()}\n to\n ${JSON.stringify(context, null, 2)}.\n${errorMessage}'`
244
- // this.logs.push(message)
245
- // return [message]
246
- args.calls.pop()
247
- throw { error: [message], logs: this.logs }
196
+ }
197
+ const log = (message) => { this.logs.push(message) }
198
+ // this.logs.push(`Generators: applied ${generator.toString()}\n to\n ${JSON.stringify(context)}`)
199
+ let errorMessage = 'The apply function did not return a value'
200
+ try {
201
+ generated= generator.apply(args, objects, g, args.gs, context, hierarchy, config, response, log)
202
+ } catch( e ) {
203
+ // the next if handle this
204
+ generated = null
205
+ e.retryCall = () => generator.apply(args, objects, g, args.gs, context, hierarchy, config, response, log)
206
+ const help = 'The error has a retryCall property that will recall the function that failed.'
207
+ if (e.stack && e.message) {
208
+ const info = `${generator.notes ? generator.notes : ''}${generator.where ? generator.where : ''}`
209
+ errorMessage = `Error applying generator '${info}. Error is ${e.toString()} stack is ${e.stack}. Generator is ${generator.toString()}. ${help}`
210
+ } else if (e.error) {
211
+ const info = `${generator.notes ? generator.notes : ''}${generator.where ? generator.where : ''}`
212
+ errorMessage = `Error applying generator '${info}. Error is ${e.error.join()}. Generator is ${generator.toString()}. ${help}`
213
+ } else {
214
+ errorMessage = e.toString()
248
215
  }
249
- if (((config || {}).config || {}).debug) {
250
- const widths = [10, 10, 90]
251
- const lines = new Lines(widths)
252
- lines.setElement(0, 0, 'Generator')
253
- if (generator.index > -1 && generator.km) {
254
- // lines.setElement(0, 2, `KM '${generator.km}' ordinal: ${generator.index}`)
255
- lines.setElement(0, 2, generator.toLabel())
256
- }
257
- lines.newRow()
258
- lines.setElement(0, 1, 'APPLIED')
216
+ }
217
+ if (!generated && generated !== '') {
218
+ const widths = [10, 10, 90]
219
+ const lines = new Lines(widths)
220
+ lines.setElement(0, 0, 'Generator')
221
+ const source = `${generator.km}/#${generator.index}`
222
+ lines.setElement(0, 2, `ERROR while applying (${source}) ${generator.toLabel()}`)
223
+ lines.newRow()
224
+ lines.setElement(0, 2, generator.toString())
225
+ lines.newRow()
226
+ lines.setElement(0, 1, 'TO')
227
+ lines.setElement(0, 2, `(HASHCODE ${helpers.hashCode(JSON.stringify(helpers.sortJson(context, { depth: 25 })))})`)
228
+ lines.setElement(1, 2, JSON.stringify(helpers.sortJson(context, { depth: 25 }), null, 2))
229
+ lines.newRow()
230
+ lines.setElement(0, 1, 'STACK')
231
+ lines.setElement(0, 2, stack)
232
+ lines.newRow()
233
+ lines.setElement(0, 1, 'DEBUG')
234
+ lines.setElement(0, 2, `To debug this use args.callId == '${args.calls.current()}'`)
235
+ lines.newRow()
236
+ lines.setElement(0, 1, 'ERROR')
237
+ lines.setElement(0, 2, errorMessage)
238
+ this.logs.push(lines.toString())
239
+ const message = `ERROR while applying (${source}) ${generator.toLabel()}\n to\n ${JSON.stringify(context, null, 2)}.\n${errorMessage}'`
240
+ // this.logs.push(message)
241
+ // return [message]
242
+ args.calls.pop()
243
+ throw { error: [message], logs: this.logs }
244
+ }
245
+ if (((config || {}).config || {}).debug) {
246
+ const widths = [10, 10, 90]
247
+ const lines = new Lines(widths)
248
+ lines.setElement(0, 0, 'Generator')
249
+ if (generator.index > -1 && generator.km) {
250
+ // lines.setElement(0, 2, `KM '${generator.km}' ordinal: ${generator.index}`)
259
251
  lines.setElement(0, 2, generator.toLabel())
260
- lines.newRow()
261
- lines.setElement(0, 2, generator.toString())
262
- lines.newRow()
263
- lines.setElement(0, 1, 'RESULT')
264
- lines.setElement(0, 2, generated)
265
- lines.newRow()
266
- lines.setElement(0, 1, 'STACK')
267
- lines.setElement(0, 2, stack)
268
- lines.newRow()
269
- lines.setElement(0, 1, 'DEBUG')
270
- lines.setElement(0, 2, `To debug this use args.callId == '${args.calls.current()}'`)
271
- lines.newRow()
272
- lines.setElement(0, 1, 'TO')
273
- lines.setElement(0, 2, `(HASHCODE ${helpers.hashCode(JSON.stringify(helpers.sortJson(context, { depth: 25 })))})`)
274
- lines.setElement(1, 2, JSON.stringify(helpers.sortJson(context, { depth: 25 }), null, 2))
275
- this.logs.push(lines.toString())
276
252
  }
277
- applied = true
278
- break
253
+ lines.newRow()
254
+ lines.setElement(0, 1, 'APPLIED')
255
+ lines.setElement(0, 2, generator.toLabel())
256
+ lines.newRow()
257
+ lines.setElement(0, 2, generator.toString())
258
+ lines.newRow()
259
+ lines.setElement(0, 1, 'RESULT')
260
+ lines.setElement(0, 2, generated)
261
+ lines.newRow()
262
+ lines.setElement(0, 1, 'STACK')
263
+ lines.setElement(0, 2, stack)
264
+ lines.newRow()
265
+ lines.setElement(0, 1, 'DEBUG')
266
+ lines.setElement(0, 2, `To debug this use args.callId == '${args.calls.current()}'`)
267
+ lines.newRow()
268
+ lines.setElement(0, 1, 'TO')
269
+ lines.setElement(0, 2, `(HASHCODE ${helpers.hashCode(JSON.stringify(helpers.sortJson(context, { depth: 25 })))})`)
270
+ lines.setElement(1, 2, JSON.stringify(helpers.sortJson(context, { depth: 25 }), null, 2))
271
+ this.logs.push(lines.toString())
279
272
  }
273
+ applied = true
274
+ break
280
275
  }
281
- args.calls.pop()
282
- if (!applied && ((config || {}).config || {}).debug) {
283
- const widths = [10, 10, 90]
284
- const lines = new Lines(widths)
285
- lines.setElement(0, 0, 'Generator')
286
- lines.setElement(0, 2, 'No generator applied')
287
- lines.newRow()
288
- lines.setElement(0, 1, 'STACK')
289
- lines.setElement(0, 2, stack)
290
- lines.newRow()
291
- lines.setElement(0, 1, 'TO')
292
- lines.setElement(0, 2, JSON.stringify(context, null, 2))
293
- this.logs.push(lines.toString())
294
- }
295
- contextsPrime.push((config || {}).parenthesized ? "(" + generated + ")" : generated)
296
276
  }
297
- return contextsPrime
277
+ args.calls.pop()
278
+ if (!applied && ((config || {}).config || {}).debug) {
279
+ const widths = [10, 10, 90]
280
+ const lines = new Lines(widths)
281
+ lines.setElement(0, 0, 'Generator')
282
+ lines.setElement(0, 2, 'No generator applied')
283
+ lines.newRow()
284
+ lines.setElement(0, 1, 'STACK')
285
+ lines.setElement(0, 2, stack)
286
+ lines.newRow()
287
+ lines.setElement(0, 1, 'TO')
288
+ lines.setElement(0, 2, JSON.stringify(context, null, 2))
289
+ this.logs.push(lines.toString())
290
+ }
291
+ return ((config || {}).parenthesized ? "(" + generated + ")" : generated)
298
292
  }
299
293
  }
300
294
 
package/src/project.js CHANGED
@@ -45,7 +45,6 @@ const project = (object, filter) => {
45
45
  if (properties.property) {
46
46
  const property = properties.property
47
47
  if (properties.isPropertyList) {
48
- debugger
49
48
  if (!Array.isArray(object[property])) {
50
49
  return projection
51
50
  }