theprogrammablemind_4wp 8.3.0-beta.6 → 8.3.0-beta.8

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -65,6 +65,6 @@
65
65
  "sort-json": "^2.0.0",
66
66
  "uuid": "^8.3.2"
67
67
  },
68
- "version": "8.3.0-beta.6",
68
+ "version": "8.3.0-beta.8",
69
69
  "license": "UNLICENSED"
70
70
  }
package/src/config.js CHANGED
@@ -418,14 +418,22 @@ const handleBridgeProps = (config, bridge, { addFirst, uuid } = {}) => {
418
418
  }
419
419
 
420
420
  if (bridge.evaluators) {
421
- for (const evaluator of bridge.evaluators) {
422
- addSemantic(evaluator, true)
421
+ const evaluators = [...bridge.evaluators]
422
+ evaluators.reverse()
423
+ if (evaluators) {
424
+ for (const evaluator of evaluators) {
425
+ addSemantic(evaluator, true)
426
+ }
423
427
  }
424
428
  }
425
429
 
426
430
  if (bridge.semantics) {
427
- for (const semantic of bridge.semantics) {
428
- addSemantic(semantic, false)
431
+ const semantics = [...bridge.semantics]
432
+ semantics.reverse()
433
+ if (semantics) {
434
+ for (const semantic of semantics) {
435
+ addSemantic(semantic, false)
436
+ }
429
437
  }
430
438
  }
431
439
  }
@@ -1171,47 +1179,42 @@ class Config {
1171
1179
  return bridge
1172
1180
  })
1173
1181
  } else {
1174
- const toCanonical = (def) => {
1175
- if (typeof def == 'function') {
1176
- return def.toString()
1177
- } else if (typeof def == 'string') {
1178
- return def
1179
- }
1180
- def = { ...def }
1181
- delete def.where
1182
- def.match = def.match ? def.match.toString() : ""
1183
- def.apply = def.apply ? def.apply.toString() : ""
1184
- return def
1185
- }
1186
-
1187
- config.generators = (config.generators || []).map(toCanonical)
1188
- config.semantics = (config.semantics || []).map(toCanonical)
1182
+ /* done in updateQueries now
1183
+ config.generators = (config.generators || []).map((generator) => {
1184
+ generator = { ...generator }
1185
+ delete generator.where
1186
+ generator.match = generator.match.toString()
1187
+ generator.apply = generator.apply.toString()
1188
+ return generator
1189
+ })
1190
+ config.semantics = (config.semantics || []).map((semantic) => {
1191
+ semantic = { ...semantic }
1192
+ delete semantic.where
1193
+ semantic.match = semantic.match.toString()
1194
+ semantic.apply = semantic.apply.toString()
1195
+ return semantic
1196
+ })
1189
1197
  config.bridges = (config.bridges || []).map((bridge) => {
1190
1198
  bridge = { ...bridge }
1191
1199
  delete bridge.where
1192
1200
  if (bridge.generatorp) {
1193
- bridge.generatorp = toCanonical(bridge.generatorp)
1201
+ bridge.generatorp = bridge.generatorp.toString()
1194
1202
  }
1195
1203
  if (bridge.generatorr) {
1196
- bridge.generatorr = toCanonical(bridge.generatorr)
1204
+ bridge.generatorr = bridge.generatorr.toString()
1197
1205
  }
1198
1206
  if (bridge.generatorpr) {
1199
- bridge.generatorpr = toCanonical(bridge.generatorpr)
1207
+ bridge.generatorpr = bridge.generatorpr.toString()
1200
1208
  }
1201
1209
  if (bridge.evaluator) {
1202
- bridge.evaluator = toCanonical(bridge.evaluator)
1210
+ bridge.evaluator = bridge.evaluator.toString()
1203
1211
  }
1204
1212
  if (bridge.semantic) {
1205
- bridge.semantic = toCanonical(bridge.semantic)
1206
- }
1207
- if (bridge.evaluators) {
1208
- bridge.evaluators = bridge.evaluators.map(toCanonical).toString()
1209
- }
1210
- if (bridge.semantics) {
1211
- bridge.semantics = bridge.semantics.map(toCanonical).toString()
1213
+ bridge.semantic = bridge.semantic.toString()
1212
1214
  }
1213
1215
  return bridge
1214
1216
  })
1217
+ */
1215
1218
  }
1216
1219
  return config
1217
1220
  }
package/src/helpers.js CHANGED
@@ -312,24 +312,18 @@ const updateQueries = (queryOrConfig) => {
312
312
 
313
313
  const functionsToStrings = (config) => {
314
314
  config = { ...config }
315
- const mapGenerator = (generator) => {
316
- if (generator.apply) {
317
- return { ...generator, match: generator.match.toString(), apply: generator.apply.toString() }
315
+ defToStrings = (def) => {
316
+ if (def.apply) {
317
+ return { ...def, match: def.match.toString(), apply: def.apply.toString() }
318
318
  } else {
319
- return [generator[0].toString(), generator[1].toString()]
319
+ return [def[0].toString(), def[1].toString()]
320
320
  }
321
321
  }
322
322
  if (config.generators) {
323
- config.generators = config.generators.map(mapGenerator)
323
+ config.generators = config.generators.map(defToStrings)
324
324
  }
325
325
  if (config.semantics) {
326
- config.semantics = config.semantics.map((semantic) => {
327
- if (semantic.apply) {
328
- return { ...semantic, match: semantic.match.toString(), apply: semantic.apply.toString() }
329
- } else {
330
- return [semantic[0].toString(), semantic[1].toString()]
331
- }
332
- })
326
+ config.semantics = config.semantics.map(defToStrings)
333
327
  }
334
328
  if (config.bridges) {
335
329
  config.bridges = config.bridges.map((bridge) => {
@@ -338,7 +332,7 @@ const functionsToStrings = (config) => {
338
332
  bridge.generator = bridge.generator.toString()
339
333
  }
340
334
  if (bridge.generators) {
341
- bridge.generators = bridge.generators.map(mapGenerator)
335
+ bridge.generators = bridge.generators.map(defToStrings)
342
336
  }
343
337
  if (bridge.generatorp) {
344
338
  bridge.generatorp = bridge.generatorp.toString()
@@ -349,9 +343,15 @@ const functionsToStrings = (config) => {
349
343
  if (bridge.semantic) {
350
344
  bridge.semantic = bridge.semantic.toString()
351
345
  }
346
+ if (bridge.semantics) {
347
+ bridge.semantics = bridge.semantics.toString()
348
+ }
352
349
  if (bridge.evaluator) {
353
350
  bridge.evaluator = bridge.evaluator.toString()
354
351
  }
352
+ if (bridge.evaluators) {
353
+ bridge.evaluators = bridge.evaluators.toString()
354
+ }
355
355
  return bridge
356
356
  })
357
357
  }