theprogrammablemind_4wp 9.5.1-beta.8 → 9.5.1-beta.9

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 CHANGED
@@ -62,6 +62,7 @@
62
62
  "dependencies": {
63
63
  "base-64": "^1.0.0",
64
64
  "deep-equal": "^2.0.4",
65
+ "flatted": "^3.3.3",
65
66
  "fs": "0.0.1-security",
66
67
  "json-diff": "^1.0.3",
67
68
  "json-stable-stringify": "^1.0.1",
@@ -72,6 +73,6 @@
72
73
  "sort-json": "^2.0.0",
73
74
  "uuid": "^8.3.2"
74
75
  },
75
- "version": "9.5.1-beta.8",
76
+ "version": "9.5.1-beta.9",
76
77
  "license": "UNLICENSED"
77
78
  }
package/src/generators.js CHANGED
@@ -1,3 +1,4 @@
1
+ const { stringify } = require('flatted');
1
2
  const { args: contextArgs, normalizeGenerator } = require('./helpers')
2
3
  const Lines = require('../lines')
3
4
  const helpers = require('./helpers')
@@ -182,7 +183,7 @@ class Generators {
182
183
  const generator = this.generators[igenerator]
183
184
  if (await generator.matches(args, objects, context, hierarchy, config, options)) {
184
185
  const log = (message) => { this.logs.push(message) }
185
- // this.logs.push(`Generators: applied ${generator.toString()}\n to\n ${JSON.stringify(context)}`)
186
+ // this.logs.push(`Generators: applied ${generator.toString()}\n to\n ${stringify(context)}`)
186
187
  let errorMessage = 'The apply function did not return a value'
187
188
  try {
188
189
  generated = await generator.apply(args, objects, context, hierarchy, config, response, log)
@@ -212,7 +213,7 @@ class Generators {
212
213
  lines.newRow()
213
214
  lines.setElement(0, 1, 'TO')
214
215
  lines.setElement(0, 2, `context_id: ${context.context_id}`)
215
- lines.setElement(1, 2, JSON.stringify(helpers.sortJson(context, { depth: 25 }), null, 2))
216
+ lines.setElement(1, 2, stringify(helpers.sortJson(context, { depth: 10 }), null, 2))
216
217
  lines.newRow()
217
218
  lines.setElement(0, 1, 'STACK')
218
219
  lines.setElement(0, 2, stack)
@@ -223,7 +224,7 @@ class Generators {
223
224
  lines.setElement(0, 1, 'ERROR')
224
225
  lines.setElement(0, 2, errorMessage)
225
226
  this.logs.push(lines.toString())
226
- const message = `ERROR while applying (${source}) ${generator.toLabel()}\n to\n ${JSON.stringify(context, null, 2)}.\n${errorMessage}'`
227
+ const message = `ERROR while applying (${source}) ${generator.toLabel()}\n to\n ${stringify(context, null, 2)}.\n${errorMessage}'`
227
228
  // this.logs.push(message)
228
229
  // return [message]
229
230
  args.calls.pop()
@@ -254,7 +255,7 @@ class Generators {
254
255
  lines.newRow()
255
256
  lines.setElement(0, 1, 'TO')
256
257
  lines.setElement(0, 2, `context_id: ${context.context_id}`)
257
- lines.setElement(1, 2, JSON.stringify(helpers.sortJson(context, { depth: 25 }), null, 2))
258
+ lines.setElement(1, 2, stringify(helpers.sortJson(context, { depth: 25 }), null, 2))
258
259
  this.logs.push(lines.toString())
259
260
  }
260
261
  applied = true
@@ -272,7 +273,7 @@ class Generators {
272
273
  lines.setElement(0, 2, stack)
273
274
  lines.newRow()
274
275
  lines.setElement(0, 1, 'TO')
275
- lines.setElement(0, 2, JSON.stringify(context, null, 2))
276
+ lines.setElement(0, 2, stringify(context, null, 2))
276
277
  this.logs.push(lines.toString())
277
278
  }
278
279
  return ((config || {}).parenthesized ? '(' + generated + ')' : generated)