theprogrammablemind 7.5.8-beta.1 → 7.5.8-beta.2
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/client.js +108 -88
- package/package.json +1 -1
- package/src/config.js +110 -92
- package/src/helpers.js +9 -0
package/client.js
CHANGED
@@ -663,7 +663,7 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
|
|
663
663
|
return response
|
664
664
|
} catch(error) {
|
665
665
|
error.query = query
|
666
|
-
|
666
|
+
errorHandler(error)
|
667
667
|
}
|
668
668
|
}
|
669
669
|
|
@@ -697,11 +697,13 @@ const getConfigForTest = (config, testConfig) => {
|
|
697
697
|
return configForTest
|
698
698
|
}
|
699
699
|
|
700
|
-
const runTest = async (config, expected, { verbose, afterTest, testConfig, debug }) => {
|
700
|
+
const runTest = async (config, expected, { args, verbose, afterTest, testConfig, debug }) => {
|
701
701
|
const test = expected.query
|
702
702
|
// initialize in between test so state is not preserved since the test was adding without state
|
703
703
|
config.rebuild()
|
704
|
-
|
704
|
+
if (!args.dontAddAssociations) {
|
705
|
+
config.addAssociationsFromTests(config.tests)
|
706
|
+
}
|
705
707
|
// config.addAssocationsFromTests(
|
706
708
|
const errorHandler = (error) => {
|
707
709
|
if (error.metadata) {
|
@@ -866,12 +868,10 @@ const saveTest = async (testFile, config, test, expected, testConfig, saveDevelo
|
|
866
868
|
const args = {
|
867
869
|
}
|
868
870
|
const saveObjects = {...config.config.objects}
|
869
|
-
/*
|
870
871
|
saveObjects.nameToUUID = {}
|
871
872
|
for (let km of config.configs) {
|
872
873
|
saveObjects.nameToUUID[km.name] = km.uuid
|
873
874
|
}
|
874
|
-
*/
|
875
875
|
writeTest(testFile, test, saveObjects, result.generated, result.paraphrases, result.responses, result.contexts, result.associations, result.metadata, actualConfig, saveDeveloper)
|
876
876
|
}
|
877
877
|
|
@@ -1368,6 +1368,13 @@ const knowledgeModule = async ({
|
|
1368
1368
|
description: 'Entodicton knowledge module'
|
1369
1369
|
})
|
1370
1370
|
|
1371
|
+
const helpDebugAssociation = 'In order to get a debug break when a specific association is created set the DEBUG_ASSOCIATION environment variable to the JSON of the association to break on. For example DEBUG_ASSOCIATION=\'["the#0", "mammel#0"]\' })'
|
1372
|
+
const helpDebugHierarchy = 'In order to get a debug break when a specific hierarchy is created set the DEBUG_HIERARCHY environment variable to the JSON of the child-parent pair to break on. For example DEBUG_HIERARCHY=\'["cat#1", "mammel#1"]\' })'
|
1373
|
+
const helpDebugPriority = 'In order to get a debug break when a specific set of priorities is created set set DEBUG_PRIORITY environment variable to the JSON of the priorities that you want to break on. For example DEBUG_PRIORITY=\'["verb#0", "article#0"]\' })'
|
1374
|
+
const helpDebugBridge = 'In order to get a debug break when a specific bridge is created set the DEBUG_BRIDGE environment variable to id/level to break on. For example DEBUG_BRIDGE=\'id#level\' })'
|
1375
|
+
const helpDebugOperator = 'In order to get a debug break when a specific hierarcy is created set the DEBUG_OPERATOR environment variable to debug any config loaded. For example DEBUG_OPERATOR=\'([operator] ([arg]))\' })'
|
1376
|
+
|
1377
|
+
|
1371
1378
|
parser.add_argument('-tmn', '--testModuleName', { help: 'When running tests instead of using the current modules tests use the specified modules tests' })
|
1372
1379
|
parser.add_argument('-t', '--test', { action: 'store_true', help: 'Run the tests. Create tests by running with the --query + --save flag' })
|
1373
1380
|
parser.add_argument('-tv', '--testVerbose', { action: 'store_true', help: 'Run the tests in verbose mode. Create tests by running with the --query or --loop with the --save flag' })
|
@@ -1394,30 +1401,34 @@ const knowledgeModule = async ({
|
|
1394
1401
|
parser.add_argument('-dic', '--debugIncludeConvolutions', { action: 'store_true', help: 'When running with the --debugIncludeConvolutions flag the logs will include convolutions which are somewhat annoying verbose. Default is false' })
|
1395
1402
|
parser.add_argument('-dl', '--debugLoops', { action: 'store_true', help: 'When running with the --debugLoops flag the logs calls to semantics and generators will be immediately written to the console '})
|
1396
1403
|
parser.add_argument('-d', '--debug', { action: 'store_true', help: 'When running with the --debug flag this set the debug flag in the config' })
|
1397
|
-
parser.add_argument('-da', '--debugAssociation', { help:
|
1398
|
-
parser.add_argument('-dh', '--debugHierarchy', { help:
|
1399
|
-
parser.add_argument('-
|
1400
|
-
parser.add_argument('-
|
1404
|
+
parser.add_argument('-da', '--debugAssociation', { help: helpDebugAssociation })
|
1405
|
+
parser.add_argument('-dh', '--debugHierarchy', { help: helpDebugHierarchy })
|
1406
|
+
parser.add_argument('-dp', '--debugPriority', { help: helpDebugPriority })
|
1407
|
+
parser.add_argument('-db', '--debugBridge', { help: helpDebugBridge })
|
1408
|
+
parser.add_argument('-do', '--debugOperator', { help: helpDebugOperator })
|
1401
1409
|
|
1402
1410
|
const args = parser.parse_args()
|
1403
1411
|
args.count = args.count || 1
|
1404
1412
|
|
1405
1413
|
if (args.debugAssociation) {
|
1406
|
-
|
1414
|
+
console.log(helpDebugAssociation)
|
1415
|
+
runtime.process.exit(-1)
|
1407
1416
|
}
|
1408
1417
|
if (args.debugHierarchy) {
|
1409
|
-
|
1418
|
+
console.log(helpDebugHierarchy)
|
1419
|
+
runtime.process.exit(-1)
|
1420
|
+
}
|
1421
|
+
if (args.debugPriority) {
|
1422
|
+
console.log(helpDebugPriority)
|
1423
|
+
runtime.process.exit(-1)
|
1410
1424
|
}
|
1411
1425
|
if (args.debugBridge) {
|
1412
|
-
|
1413
|
-
|
1414
|
-
if (global.entodictonDebugBridge.length !== 2) {
|
1415
|
-
console.log('Expected DEBUG_BRIDGE to be of the form "id/level"');
|
1416
|
-
}
|
1426
|
+
console.log(helpDebugBridge)
|
1427
|
+
runtime.process.exit(-1)
|
1417
1428
|
}
|
1418
1429
|
if (args.debugOperator) {
|
1419
|
-
|
1420
|
-
|
1430
|
+
console.log(helpDebugOperator)
|
1431
|
+
runtime.process.exit(-1)
|
1421
1432
|
}
|
1422
1433
|
|
1423
1434
|
if (args.clean) {
|
@@ -1486,87 +1497,94 @@ const knowledgeModule = async ({
|
|
1486
1497
|
}
|
1487
1498
|
*/
|
1488
1499
|
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
for (const test of config.tests) {
|
1494
|
-
console.log(`${counter} - ${test.query}`)
|
1495
|
-
counter += 1
|
1496
|
-
}
|
1497
|
-
}
|
1498
|
-
if (args.print.includes('c')) {
|
1499
|
-
const { data } = setupProcessB({ config })
|
1500
|
-
console.log("Config as sent to server")
|
1501
|
-
console.log(JSON.stringify(data, null, 2));
|
1500
|
+
let configPrinted = false
|
1501
|
+
const printConfig = () => {
|
1502
|
+
if (configPrinted) {
|
1503
|
+
return
|
1502
1504
|
}
|
1505
|
+
configPrinted = true
|
1506
|
+
if (args.print) {
|
1507
|
+
if (args.print.includes('t')) {
|
1508
|
+
console.log("Test queries")
|
1509
|
+
let counter = 0
|
1510
|
+
for (const test of config.tests) {
|
1511
|
+
console.log(`${counter} - ${test.query}`)
|
1512
|
+
counter += 1
|
1513
|
+
}
|
1514
|
+
}
|
1515
|
+
if (args.print.includes('c')) {
|
1516
|
+
const { data } = setupProcessB({ config })
|
1517
|
+
console.log("Config as sent to server")
|
1518
|
+
console.log(JSON.stringify(data, null, 2));
|
1519
|
+
}
|
1503
1520
|
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1521
|
+
if (args.print.includes('l')) {
|
1522
|
+
console.log('Module load ordering')
|
1523
|
+
for (const km of config.configs) {
|
1524
|
+
console.log(` ${km.name}`)
|
1525
|
+
}
|
1508
1526
|
}
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1527
|
+
if (args.print.includes('w')) {
|
1528
|
+
for (const word in config.config.words) {
|
1529
|
+
console.log(word.concat(' ', ...config.config.words[word].map((def) => JSON.stringify(def))))
|
1530
|
+
}
|
1513
1531
|
}
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1532
|
+
if (args.print.includes('b')) {
|
1533
|
+
for (const bridge of config.config.bridges) {
|
1534
|
+
console.log(JSON.stringify(bridge))
|
1535
|
+
}
|
1518
1536
|
}
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1537
|
+
if (args.print.includes('o')) {
|
1538
|
+
for (const operator of config.config.operators) {
|
1539
|
+
console.log(JSON.stringify(operator))
|
1540
|
+
}
|
1523
1541
|
}
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1542
|
+
if (args.print.includes('j')) {
|
1543
|
+
const { data } = setupProcessB( { config } )
|
1544
|
+
console.log(JSON.stringify(data, null, 2))
|
1545
|
+
}
|
1546
|
+
if (args.print.includes('a')) {
|
1547
|
+
console.log('associations ================')
|
1548
|
+
const properties = ['negative', 'positive']
|
1549
|
+
for (let property of properties) {
|
1550
|
+
console.log(` ${property} ===============`)
|
1551
|
+
for (let association of config.config.associations[property]) {
|
1552
|
+
console.log(` ${JSON.stringify(association)}`)
|
1553
|
+
}
|
1536
1554
|
}
|
1537
1555
|
}
|
1538
|
-
|
1539
|
-
|
1540
|
-
console.log(JSON.stringify(config.config.objects, null, 2))
|
1541
|
-
}
|
1542
|
-
if (args.print.includes('p')) {
|
1543
|
-
for (let priority of config.config.priorities) {
|
1544
|
-
console.log(JSON.stringify(priority))
|
1556
|
+
if (args.print.includes('d')) {
|
1557
|
+
console.log(JSON.stringify(config.config.objects, null, 2))
|
1545
1558
|
}
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1559
|
+
if (args.print.includes('p')) {
|
1560
|
+
for (let priority of config.config.priorities) {
|
1561
|
+
console.log(JSON.stringify(priority))
|
1562
|
+
}
|
1550
1563
|
}
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
for (const semantic of easyToRead) {
|
1555
|
-
semantic.match = semantic.match.toString()
|
1556
|
-
semantic.apply = semantic.apply.toString()
|
1557
|
-
if (semantic.applyWrapped) {
|
1558
|
-
semantic.applyWrapped = semantic.applyWrapped.toString()
|
1564
|
+
if (args.print.includes('h')) {
|
1565
|
+
for (let edge of config.config.hierarchy) {
|
1566
|
+
console.log(JSON.stringify(edge))
|
1559
1567
|
}
|
1560
1568
|
}
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1569
|
+
if (args.print.includes('g')) {
|
1570
|
+
const easyToRead = _.cloneDeep(config.config.generators)
|
1571
|
+
for (const semantic of easyToRead) {
|
1572
|
+
semantic.match = semantic.match.toString()
|
1573
|
+
semantic.apply = semantic.apply.toString()
|
1574
|
+
if (semantic.applyWrapped) {
|
1575
|
+
semantic.applyWrapped = semantic.applyWrapped.toString()
|
1576
|
+
}
|
1577
|
+
}
|
1578
|
+
console.dir(easyToRead)
|
1579
|
+
}
|
1580
|
+
if (args.print.includes('s')) {
|
1581
|
+
const easyToRead = _.cloneDeep(config.config.semantics)
|
1582
|
+
for (const semantic of easyToRead) {
|
1583
|
+
semantic.match = semantic.match.toString()
|
1584
|
+
semantic.apply = semantic.apply.toString()
|
1585
|
+
}
|
1586
|
+
console.dir(easyToRead)
|
1568
1587
|
}
|
1569
|
-
console.dir(easyToRead)
|
1570
1588
|
}
|
1571
1589
|
}
|
1572
1590
|
|
@@ -1601,7 +1619,7 @@ const knowledgeModule = async ({
|
|
1601
1619
|
test = useTestConfig.name
|
1602
1620
|
|
1603
1621
|
}
|
1604
|
-
runTests(config, test, { debug: args.debug, testConfig: useTestConfig, verbose: args.testVerbose || args.testAllVerbose, stopAtFirstError: !args.testAllVerbose }).then((results) => {
|
1622
|
+
runTests(config, test, { args, debug: args.debug, testConfig: useTestConfig, verbose: args.testVerbose || args.testAllVerbose, stopAtFirstError: !args.testAllVerbose }).then((results) => {
|
1605
1623
|
let newError = false
|
1606
1624
|
if (results.length > 0) {
|
1607
1625
|
let headerShown = false
|
@@ -1727,11 +1745,12 @@ const knowledgeModule = async ({
|
|
1727
1745
|
}
|
1728
1746
|
config.beforeQuery({ query: args.query, isModule: false, objects })
|
1729
1747
|
try {
|
1730
|
-
processResults(_process(config, args.query, { commandLineArgs: args, dontAddAssociations: args.dontAddAssociations, writeTests: args.save || args.saveDeveloper, saveDeveloper: args.saveDeveloper, testConfig, testsFN: test }))
|
1748
|
+
await processResults(_process(config, args.query, { commandLineArgs: args, dontAddAssociations: args.dontAddAssociations, writeTests: args.save || args.saveDeveloper, saveDeveloper: args.saveDeveloper, testConfig, testsFN: test }))
|
1731
1749
|
} catch( error ) {
|
1732
1750
|
console.log('Error', error);
|
1733
1751
|
}
|
1734
1752
|
}
|
1753
|
+
printConfig()
|
1735
1754
|
} else {
|
1736
1755
|
config.addAssociationsFromTests(config.tests);
|
1737
1756
|
//for (let query in config.tests) {
|
@@ -1739,6 +1758,7 @@ const knowledgeModule = async ({
|
|
1739
1758
|
//}
|
1740
1759
|
module()
|
1741
1760
|
}
|
1761
|
+
|
1742
1762
|
}
|
1743
1763
|
|
1744
1764
|
/*
|
package/package.json
CHANGED
package/src/config.js
CHANGED
@@ -5,6 +5,7 @@ const { Generators } = require('./generators')
|
|
5
5
|
const client = require('../client')
|
6
6
|
const DigraphInternal = require('./digraph_internal')
|
7
7
|
const helpers = require('./helpers')
|
8
|
+
const { ecatch } = require('./helpers')
|
8
9
|
const runtime = require('../runtime')
|
9
10
|
const _ = require('lodash')
|
10
11
|
|
@@ -22,98 +23,102 @@ const indent = (string, indent) => {
|
|
22
23
|
}
|
23
24
|
|
24
25
|
const handleBridgeProps = (config, bridge) => {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
bridge.level = 0
|
30
|
-
}
|
31
|
-
if (bridge.children) {
|
32
|
-
for (let child of bridge.children) {
|
33
|
-
config.addHierarchy(child, bridge.id)
|
34
|
-
}
|
35
|
-
}
|
36
|
-
if (bridge.parents) {
|
37
|
-
for (let parent of bridge.parents) {
|
38
|
-
config.addHierarchy(bridge.id, parent)
|
39
|
-
}
|
40
|
-
}
|
41
|
-
if (bridge.isA) {
|
42
|
-
for (let parent of bridge.isA) {
|
43
|
-
config.addHierarchy(bridge.id, parent)
|
44
|
-
}
|
45
|
-
}
|
46
|
-
if (bridge.before) {
|
47
|
-
for (let after of bridge.before) {
|
48
|
-
if (typeof after == 'string') {
|
49
|
-
after = [after, 0]
|
26
|
+
ecatch(`While processing the bridge for ${bridge.id}#${bridge.level}`,
|
27
|
+
() => {
|
28
|
+
if (!bridge.bridge) {
|
29
|
+
bridge.bridge = "{ ...next(operator) }"
|
50
30
|
}
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
}
|
59
|
-
|
60
|
-
|
61
|
-
|
31
|
+
if (!bridge.level) {
|
32
|
+
bridge.level = 0
|
33
|
+
}
|
34
|
+
if (bridge.children) {
|
35
|
+
for (let child of bridge.children) {
|
36
|
+
config.addHierarchy(child, bridge.id)
|
37
|
+
}
|
38
|
+
}
|
39
|
+
if (bridge.parents) {
|
40
|
+
for (let parent of bridge.parents) {
|
41
|
+
config.addHierarchy(bridge.id, parent)
|
42
|
+
}
|
43
|
+
}
|
44
|
+
if (bridge.isA) {
|
45
|
+
for (let parent of bridge.isA) {
|
46
|
+
config.addHierarchy(bridge.id, parent)
|
47
|
+
}
|
48
|
+
}
|
49
|
+
if (bridge.before) {
|
50
|
+
for (let after of bridge.before) {
|
51
|
+
if (typeof after == 'string') {
|
52
|
+
after = [after, 0]
|
53
|
+
}
|
54
|
+
config.addPriorities([after, [bridge.id, bridge.level]])
|
55
|
+
}
|
56
|
+
}
|
57
|
+
if (bridge.words) {
|
58
|
+
for (let def of bridge.words) {
|
59
|
+
if (typeof def == 'string') {
|
60
|
+
config.addWordInternal(def, {"id": bridge.id, "initial": `{ value: "${def}"}` })
|
61
|
+
} else {
|
62
|
+
const word = def.word
|
63
|
+
def = { initial: JSON.stringify(def), id: bridge.id, word: undefined }
|
64
|
+
config.addWordInternal(word, def)
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
if (bridge.generator) {
|
69
|
+
config.config.generators.unshift(bridge.generator)
|
70
|
+
}
|
71
|
+
if (bridge.generators) {
|
72
|
+
const generators = [...bridge.generators]
|
73
|
+
generators.reverse()
|
74
|
+
for (let generator of generators) {
|
75
|
+
config.config.generators.unshift(generator)
|
76
|
+
}
|
77
|
+
}
|
78
|
+
if (bridge.generatorpr) {
|
79
|
+
bridge.generatorp = bridge.generatorpr
|
80
|
+
bridge.generatorr = bridge.generatorpr
|
81
|
+
}
|
82
|
+
if (bridge.generatorp) {
|
83
|
+
config.config.generators.unshift({
|
84
|
+
where: bridge.generatorp.where || bridge.where || client.where(4),
|
85
|
+
// match: ({context}) => bridge.id == context.marker && context.paraphrase,
|
86
|
+
match: ({context}) => bridge.id == context.marker && context.level == bridge.level + 1 && context.paraphrase,
|
87
|
+
apply: (args) => bridge.generatorp(args),
|
88
|
+
applyWrapped: bridge.generatorp,
|
89
|
+
property: 'generatorp',
|
90
|
+
})
|
91
|
+
}
|
92
|
+
if (bridge.generatorr) {
|
93
|
+
config.config.generators.unshift({
|
94
|
+
// TODO merge response and isResponse
|
95
|
+
where: bridge.generatorr.where || bridge.where || client.where(3),
|
96
|
+
match: ({context}) => bridge.id == context.marker && !context.paraphrase && (context.response || context.isResponse),
|
97
|
+
apply: (args) => bridge.generatorr(args),
|
98
|
+
applyWrapped: bridge.generatorr,
|
99
|
+
property: 'generatorr',
|
100
|
+
})
|
101
|
+
}
|
102
|
+
if (bridge.evaluator) {
|
103
|
+
config.config.semantics.unshift({
|
104
|
+
where: bridge.evaluator.where || bridge.where || client.where(3),
|
105
|
+
match: ({context}) => bridge.id == context.marker && context.evaluate,
|
106
|
+
apply: (args) => bridge.evaluator(args),
|
107
|
+
applyWrapped: bridge.evaluator,
|
108
|
+
property: 'evaluator',
|
109
|
+
})
|
110
|
+
}
|
111
|
+
if (bridge.semantic) {
|
112
|
+
config.config.semantics.unshift({
|
113
|
+
where: bridge.semantic.where || bridge.where || client.where(3),
|
114
|
+
match: ({context}) => bridge.id == context.marker,
|
115
|
+
apply: (args) => bridge.semantic(args),
|
116
|
+
applyWrapped: bridge.semantic,
|
117
|
+
property: 'semantic',
|
118
|
+
})
|
62
119
|
}
|
63
120
|
}
|
64
|
-
|
65
|
-
if (bridge.generator) {
|
66
|
-
config.config.generators.unshift(bridge.generator)
|
67
|
-
}
|
68
|
-
if (bridge.generators) {
|
69
|
-
const generators = [...bridge.generators]
|
70
|
-
generators.reverse()
|
71
|
-
for (let generator of generators) {
|
72
|
-
config.config.generators.unshift(generator)
|
73
|
-
}
|
74
|
-
}
|
75
|
-
if (bridge.generatorpr) {
|
76
|
-
bridge.generatorp = bridge.generatorpr
|
77
|
-
bridge.generatorr = bridge.generatorpr
|
78
|
-
}
|
79
|
-
if (bridge.generatorp) {
|
80
|
-
config.config.generators.unshift({
|
81
|
-
where: bridge.generatorp.where || bridge.where || client.where(4),
|
82
|
-
// match: ({context}) => bridge.id == context.marker && context.paraphrase,
|
83
|
-
match: ({context}) => bridge.id == context.marker && context.level == bridge.level + 1 && context.paraphrase,
|
84
|
-
apply: (args) => bridge.generatorp(args),
|
85
|
-
applyWrapped: bridge.generatorp,
|
86
|
-
property: 'generatorp',
|
87
|
-
})
|
88
|
-
}
|
89
|
-
if (bridge.generatorr) {
|
90
|
-
config.config.generators.unshift({
|
91
|
-
// TODO merge response and isResponse
|
92
|
-
where: bridge.generatorr.where || bridge.where || client.where(3),
|
93
|
-
match: ({context}) => bridge.id == context.marker && !context.paraphrase && (context.response || context.isResponse),
|
94
|
-
apply: (args) => bridge.generatorr(args),
|
95
|
-
applyWrapped: bridge.generatorr,
|
96
|
-
property: 'generatorr',
|
97
|
-
})
|
98
|
-
}
|
99
|
-
if (bridge.evaluator) {
|
100
|
-
config.config.semantics.unshift({
|
101
|
-
where: bridge.evaluator.where || bridge.where || client.where(3),
|
102
|
-
match: ({context}) => bridge.id == context.marker && context.evaluate,
|
103
|
-
apply: (args) => bridge.evaluator(args),
|
104
|
-
applyWrapped: bridge.evaluator,
|
105
|
-
property: 'evaluator',
|
106
|
-
})
|
107
|
-
}
|
108
|
-
if (bridge.semantic) {
|
109
|
-
config.config.semantics.unshift({
|
110
|
-
where: bridge.semantic.where || bridge.where || client.where(3),
|
111
|
-
match: ({context}) => bridge.id == context.marker,
|
112
|
-
apply: (args) => bridge.semantic(args),
|
113
|
-
applyWrapped: bridge.semantic,
|
114
|
-
property: 'semantic',
|
115
|
-
})
|
116
|
-
}
|
121
|
+
)
|
117
122
|
}
|
118
123
|
|
119
124
|
const handleCalculatedProps = (baseConfig, moreConfig) => {
|
@@ -138,6 +143,14 @@ if (runtime.process.env.DEBUG_HIERARCHY) {
|
|
138
143
|
global.entodictonDebugHierarchy = JSON.parse(runtime.process.env.DEBUG_HIERARCHY)
|
139
144
|
}
|
140
145
|
|
146
|
+
if (runtime.process.env.DEBUG_PRIORITY) {
|
147
|
+
global.entodictonDebugPriority = JSON.parse(runtime.process.env.DEBUG_PRIORITY)
|
148
|
+
}
|
149
|
+
|
150
|
+
if (runtime.process.env.DEBUG_ASSOCIATION) {
|
151
|
+
global.entodictonDebugAssociation = JSON.parse(runtime.process.env.DEBUG_ASSOCIATION)
|
152
|
+
}
|
153
|
+
|
141
154
|
if (runtime.process.env.DEBUG_BRIDGE) {
|
142
155
|
// id/level
|
143
156
|
global.entodictonDebugBridge = runtime.process.env.DEBUG_BRIDGE.split('/')
|
@@ -779,10 +792,15 @@ class Config {
|
|
779
792
|
if (!this.config.priorities) {
|
780
793
|
this.config.priorities = []
|
781
794
|
}
|
795
|
+
if (global.entodictonDebugPriority) {
|
796
|
+
if (helpers.safeEquals(entodictonDebugPriority, priorities)) {
|
797
|
+
debugger; // debug hierarchy hit
|
798
|
+
}
|
799
|
+
}
|
782
800
|
this.config.priorities.push(priorities)
|
783
801
|
this._delta.json.priorities.push({ action: 'add', priorities })
|
784
802
|
}
|
785
|
-
|
803
|
+
|
786
804
|
addHierarchy (child, parent) {
|
787
805
|
if (child && parent || !child || Array.isArray(child) || (typeof child == 'string' && !parent)) {
|
788
806
|
this.addHierarchyChildParent(child, parent)
|
@@ -801,7 +819,7 @@ class Config {
|
|
801
819
|
throw `addHierarchy expected parent property to be a string. got ${JSON.stringify(parent)}`
|
802
820
|
}
|
803
821
|
if (global.entodictonDebugHierarchy) {
|
804
|
-
if (
|
822
|
+
if (helpers.safeEquals(entodictonDebugHierarchy, [child, parent])) {
|
805
823
|
debugger; // debug hierarchy hit
|
806
824
|
}
|
807
825
|
}
|
@@ -848,7 +866,7 @@ class Config {
|
|
848
866
|
}
|
849
867
|
const bridges = this.config.bridges
|
850
868
|
const def = Object.assign({}, bridge, { uuid: this._uuid })
|
851
|
-
|
869
|
+
|
852
870
|
if (global.entodictonDebugBridge) {
|
853
871
|
if (global.entodictonDebugBridge[0] == bridge.id && global.entodictonDebugBridge[1] == bridge.level) {
|
854
872
|
debugger; // debug hierarchy hit
|
package/src/helpers.js
CHANGED
@@ -309,7 +309,16 @@ const functionsToStrings = (config) => {
|
|
309
309
|
return config
|
310
310
|
}
|
311
311
|
|
312
|
+
const ecatch = (where, call) => {
|
313
|
+
try {
|
314
|
+
return call()
|
315
|
+
} catch( e ) {
|
316
|
+
throw new Error(`${where} ${e}`)
|
317
|
+
}
|
318
|
+
}
|
319
|
+
|
312
320
|
module.exports = {
|
321
|
+
ecatch,
|
313
322
|
functionsToStrings,
|
314
323
|
updateQueries,
|
315
324
|
mapInPlace,
|