theprogrammablemind 8.9.1-beta.27 → 8.9.1-beta.29
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 +113 -24
- package/package.json +1 -1
- package/src/config.js +43 -23
- package/src/configHelpers.js +1 -1
- package/src/digraph.js +0 -2
- package/src/generators.js +3 -9
- package/src/helpers.js +25 -1
- package/src/semantics.js +4 -6
package/client.js
CHANGED
@@ -12,7 +12,7 @@ const _ = require('lodash')
|
|
12
12
|
const stringify = require('json-stable-stringify')
|
13
13
|
const Lines = require('./lines')
|
14
14
|
const flattens = require('./src/flatten')
|
15
|
-
const { appendNoDups, InitCalls, updateQueries, safeNoDups, stableId, where } = require('./src/helpers')
|
15
|
+
const { appendNoDups, InitCalls, updateQueries, safeNoDups, stableId, where, suggestAssociationsFix, suggestAssociationsFixFromSummaries } = require('./src/helpers')
|
16
16
|
const runtime = require('./runtime')
|
17
17
|
const sortJson = runtime.sortJson
|
18
18
|
|
@@ -35,6 +35,16 @@ const getConfig_getObjectsCheck = (config, testConfig) => {
|
|
35
35
|
}
|
36
36
|
}
|
37
37
|
|
38
|
+
const getSuggestion = (diff) => {
|
39
|
+
return diff.map((element) => {
|
40
|
+
return element.marker
|
41
|
+
})
|
42
|
+
}
|
43
|
+
|
44
|
+
const getSuggestionMessage = (suggestion) => {
|
45
|
+
return `Try adding this to the associations: { context: ${JSON.stringify(getSuggestion(suggestion))}, choose: <indexOfMainElement> },\n If that does not work look at the logs and check when the operators become wrong during an interation. Deduce the change based on the previous iteration and what operator was applied.`
|
46
|
+
}
|
47
|
+
|
38
48
|
const getConfig_getContextCheck = (testConfig) => {
|
39
49
|
return (testConfig.checks && testConfig.checks.context) || []
|
40
50
|
}
|
@@ -277,7 +287,7 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
|
|
277
287
|
data.errors_ignore_contextual_priorities_non_existant_ops = true
|
278
288
|
}
|
279
289
|
let queries = query.split('\\n')
|
280
|
-
|
290
|
+
const summaries = [] // for error
|
281
291
|
try {
|
282
292
|
const response = {
|
283
293
|
hierarchy: [],
|
@@ -295,11 +305,11 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
|
|
295
305
|
paraphrasesParenthesized: [],
|
296
306
|
generatedParenthesized: [],
|
297
307
|
responses: [],
|
298
|
-
associations: []
|
308
|
+
associations: [],
|
309
|
+
summaries: []
|
299
310
|
}
|
300
311
|
|
301
312
|
let startCounter = 0
|
302
|
-
const summaries = []
|
303
313
|
while (true) {
|
304
314
|
if (queries.length === 0) {
|
305
315
|
break
|
@@ -328,9 +338,6 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
|
|
328
338
|
}
|
329
339
|
}
|
330
340
|
json.contexts = json.results
|
331
|
-
if (json.summaries) {
|
332
|
-
summaries.push(json.summaries)
|
333
|
-
}
|
334
341
|
startCounter = json.end_counter + 1
|
335
342
|
delete json.results
|
336
343
|
if (json.status !== 200) {
|
@@ -340,6 +347,8 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
|
|
340
347
|
if (isTest) {
|
341
348
|
start = runtime.performance.performance.now()
|
342
349
|
}
|
350
|
+
const summary = { summaries: json.summaries, length: json.contexts.length }
|
351
|
+
summaries.push(summary)
|
343
352
|
const { contextsPrime, generatedPrime, paraphrasesPrime, paraphrasesParenthesizedPrime, generatedParenthesizedPrime, responsesPrime } =
|
344
353
|
await processContextsB({ isTest, rebuildingTemplate, config, hierarchy, json, commandLineArgs /*, generators, semantics */ })
|
345
354
|
if (isTest) {
|
@@ -368,7 +377,7 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
|
|
368
377
|
response.paraphrasesParenthesized = response.paraphrasesParenthesized.concat(paraphrasesParenthesizedPrime)
|
369
378
|
response.generatedParenthesized = response.generatedParenthesized.concat(generatedParenthesizedPrime)
|
370
379
|
response.responses = response.responses.concat(responsesPrime)
|
371
|
-
response.summaries
|
380
|
+
response.summaries.push(summary)
|
372
381
|
queries = queries.slice(1)
|
373
382
|
}
|
374
383
|
}
|
@@ -380,11 +389,12 @@ const _process = async (config, query, { initializer, commandLineArgs, credentia
|
|
380
389
|
for (const km of config.configs) {
|
381
390
|
saveObjects.nameToUUID[km.name] = km.uuid
|
382
391
|
}
|
383
|
-
writeTest(testsFN, query, saveObjects, response.generated, response.paraphrases, response.responses, response.contexts, response.associations, response.metadata, actual_config, saveDeveloper, response.paraphrasesParenthesized, response.generatedParenthesized, summaries)
|
392
|
+
writeTest(testsFN, query, saveObjects, response.generated, response.paraphrases, response.responses, response.contexts, response.associations, response.metadata, actual_config, saveDeveloper, response.paraphrasesParenthesized, response.generatedParenthesized, response.summaries)
|
384
393
|
}
|
385
394
|
|
386
395
|
return response
|
387
396
|
} catch (error) {
|
397
|
+
error.summaries = summaries
|
388
398
|
error.query = query
|
389
399
|
errorHandler(error)
|
390
400
|
}
|
@@ -544,7 +554,8 @@ const runTest = async (config, expected, { args, verbose, testConfig, debug, tim
|
|
544
554
|
checked: expected_checked,
|
545
555
|
checkedContexts: pickedExpectedContexts,
|
546
556
|
objects: expected_objects,
|
547
|
-
config: expected.config
|
557
|
+
config: expected.config,
|
558
|
+
summaries: expected.summaries
|
548
559
|
},
|
549
560
|
actual: {
|
550
561
|
responses: result.responses,
|
@@ -555,7 +566,8 @@ const runTest = async (config, expected, { args, verbose, testConfig, debug, tim
|
|
555
566
|
checked: actual_checked,
|
556
567
|
checkedContexts: pickedResultContexts,
|
557
568
|
objects: actual_objects,
|
558
|
-
config: actual_config
|
569
|
+
config: actual_config,
|
570
|
+
summaries: result.summaries
|
559
571
|
}
|
560
572
|
}
|
561
573
|
}
|
@@ -909,12 +921,13 @@ const defaultProcess = ({ config, errorHandler }) => async (promise) => {
|
|
909
921
|
}
|
910
922
|
|
911
923
|
// builtTemplate saveInstance
|
912
|
-
const rebuildTemplate = async ({ config, target, previousResultss, startOfChanges, template, errorHandler = defaultErrorHandler }) => {
|
924
|
+
const rebuildTemplate = async ({ config, instance, target, previousResultss, rebuild, startOfChanges, template, errorHandler = defaultErrorHandler }) => {
|
913
925
|
const accumulators = {
|
914
926
|
resultss: [],
|
915
927
|
fragments: [],
|
916
928
|
semantics: [],
|
917
929
|
associations: [],
|
930
|
+
summaries: [],
|
918
931
|
learned_contextual_priorities: []
|
919
932
|
}
|
920
933
|
config.fragmentsBeingBuilt = []
|
@@ -948,12 +961,28 @@ const rebuildTemplate = async ({ config, target, previousResultss, startOfChange
|
|
948
961
|
try {
|
949
962
|
let results
|
950
963
|
let prMessage = ''
|
951
|
-
|
964
|
+
const suggestFix = (newSummaries) => {
|
965
|
+
if (!previousResults) {
|
966
|
+
return
|
967
|
+
}
|
968
|
+
const suggestion = suggestAssociationsFixFromSummaries(previousResults.summaries, newSummaries)
|
969
|
+
if (suggestion.length > 0) {
|
970
|
+
console.log(getSuggestionMessage(suggestion))
|
971
|
+
}
|
972
|
+
}
|
973
|
+
if (!rebuild && previousResults && previousResults.query == query.query) {
|
952
974
|
results = previousResults
|
953
975
|
prMessage = ' Using previous results. use -rtf for a hard rebuild of everything on the server side.'
|
954
976
|
await loadInstance(config, { resultss: [results] })
|
955
977
|
} else {
|
956
|
-
|
978
|
+
try {
|
979
|
+
results = await _process(config, query.query, { initializer, rebuildingTemplate: true })
|
980
|
+
} catch (e) {
|
981
|
+
if (e.summaries && e.summaries.length > 0) {
|
982
|
+
suggestFix(e.summaries)
|
983
|
+
}
|
984
|
+
throw e
|
985
|
+
}
|
957
986
|
}
|
958
987
|
if (config.config.debug) {
|
959
988
|
// TODO pass in the error handler like the other ones
|
@@ -961,9 +990,11 @@ const rebuildTemplate = async ({ config, target, previousResultss, startOfChange
|
|
961
990
|
}
|
962
991
|
if (results.contexts.length > 1) {
|
963
992
|
console.log(`query "${query.query}". There is ${results.contexts.length} contexts in the results. Make sure its producing the results that you expect.`)
|
993
|
+
suggestFix(results.summaries)
|
964
994
|
throw new Error(`query "${query.query}". There is ${results.contexts.length} contexts in the results. Make sure its producing the results that you expect.`)
|
965
995
|
} else if (results.paraphrases[0].toLowerCase() !== query.query.toLowerCase()) {
|
966
996
|
console.log(`query "${query.query}". The paraphrase is different from the query "${results.paraphrases[0]}".${prMessage}`)
|
997
|
+
// suggestFix(results.summaries)
|
967
998
|
} else {
|
968
999
|
console.log(`query ${isFragment ? 'fragment' : ''}"${query.query}".${prMessage}`)
|
969
1000
|
}
|
@@ -978,6 +1009,7 @@ const rebuildTemplate = async ({ config, target, previousResultss, startOfChange
|
|
978
1009
|
if (isFragment) {
|
979
1010
|
config.fragmentsBeingBuilt.push({ query: query.query, contexts: results.contexts })
|
980
1011
|
}
|
1012
|
+
accumulators.summaries = accumulators.summaries.concat(results.summaries)
|
981
1013
|
accumulators.associations = accumulators.associations.concat(results.associations)
|
982
1014
|
accumulators.learned_contextual_priorities = accumulators.learned_contextual_priorities.concat(results.learned_contextual_priorities)
|
983
1015
|
await looper(configs)
|
@@ -1070,16 +1102,31 @@ const rebuildTemplate = async ({ config, target, previousResultss, startOfChange
|
|
1070
1102
|
}
|
1071
1103
|
let todo = []
|
1072
1104
|
todo = todo.concat((template.initializers || []).map((query) => { return { initializer: true, property: 'resultss', query, skipSemantics: false || query.skipSemantics } }))
|
1105
|
+
/*
|
1073
1106
|
todo = todo.concat((template.configs || []).map((query, index) => {
|
1074
1107
|
let pr
|
1075
|
-
if (index < startOfChanges) {
|
1108
|
+
if (index < startOfChanges || (!startOfChanges && index < previousResultss.length)) {
|
1076
1109
|
pr = previousResultss[index]
|
1077
1110
|
}
|
1078
1111
|
return { property: 'resultss', query, previousResults: pr, skipSemantics: false || query.skipSemantics }
|
1079
1112
|
}))
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1113
|
+
*/
|
1114
|
+
if (template.configs) {
|
1115
|
+
for (let configsIndex = 0; configsIndex < template.configs.length; ++configsIndex) {
|
1116
|
+
const query = template.configs[configsIndex]
|
1117
|
+
// account for things for example associations being added to the config while debugginer
|
1118
|
+
const pr = previousResultss.find((pr) => pr.query == query)
|
1119
|
+
todo.push({ property: 'resultss', query, previousResults: pr, skipSemantics: false || query.skipSemantics })
|
1120
|
+
}
|
1121
|
+
}
|
1122
|
+
todo = todo.concat((template.fragments || []).map((query, index) => {
|
1123
|
+
const pr = instance.fragments[index]
|
1124
|
+
return Object.assign({}, toProperties(query), { property: 'fragments', previousResults: pr, skipSemantics: false })
|
1125
|
+
}))
|
1126
|
+
todo = todo.concat((template.semantics || []).map((definition) => {
|
1127
|
+
return { property: 'semantics', query: `${definition.from}\n${definition.to}`, skipSemantics: true }
|
1128
|
+
}))
|
1129
|
+
await looper([...todo])
|
1083
1130
|
}
|
1084
1131
|
|
1085
1132
|
const checkTemplate = (template) => {
|
@@ -1577,13 +1624,18 @@ const knowledgeModuleImpl = async ({
|
|
1577
1624
|
console.log('**************************** ERRORS ************************')
|
1578
1625
|
for (const result of results) {
|
1579
1626
|
console.log('Utterance: ', result.utterance)
|
1580
|
-
|
1627
|
+
if (!result.hasError) {
|
1628
|
+
continue
|
1629
|
+
}
|
1630
|
+
const show = (label, expected, actual, { console_log = true } = {}) => {
|
1581
1631
|
if (JSON.stringify(expected) !== JSON.stringify(actual)) {
|
1582
|
-
if (
|
1583
|
-
|
1632
|
+
if (console_log) {
|
1633
|
+
if (!headerShown) {
|
1634
|
+
console.log(' Failure')
|
1635
|
+
}
|
1636
|
+
console.log(` expected ${label}`, expected)
|
1637
|
+
console.log(` actual ${label} `, actual)
|
1584
1638
|
}
|
1585
|
-
console.log(` expected ${label}`, expected)
|
1586
|
-
console.log(` actual ${label} `, actual)
|
1587
1639
|
newError = true
|
1588
1640
|
headerShown = true
|
1589
1641
|
if (args.vimdiff) {
|
@@ -1592,6 +1644,44 @@ const knowledgeModuleImpl = async ({
|
|
1592
1644
|
result.hasError = true
|
1593
1645
|
}
|
1594
1646
|
}
|
1647
|
+
if (!deepEqual(result.expected.summaries, result.actual.summaries)) {
|
1648
|
+
/*
|
1649
|
+
const suggestion = suggestAssociationsFix(result.expected.summaries, result.actual.summaries)
|
1650
|
+
let suggestedFix
|
1651
|
+
if (suggestion) {
|
1652
|
+
suggestedFix = suggestion
|
1653
|
+
console.log(`Try adding this to the associations: { context: ${JSON.stringify(getSuggestion(suggestedFix))}, choose: <indexOfMainElement> }`)
|
1654
|
+
}
|
1655
|
+
*/
|
1656
|
+
|
1657
|
+
const checkForFix = () => {
|
1658
|
+
for (let iDiff = 0; iDiff < result.expected.paraphrases.length; ++iDiff) {
|
1659
|
+
if (result.expected.paraphrases[iDiff] !== result.actual.paraphrases[iDiff]) {
|
1660
|
+
// const context = result.expected.contexts[iDiff]
|
1661
|
+
let lengths = 0
|
1662
|
+
// just check where the results differ since earlier summaries can be different but dont matter if the result is the same
|
1663
|
+
for (let iSummaries = 0; iSummaries < result.expected.summaries.length; ++iSummaries) {
|
1664
|
+
const summary = result.expected.summaries[iSummaries]
|
1665
|
+
lengths += summary.length
|
1666
|
+
if (lengths > iDiff) {
|
1667
|
+
const suggestion = suggestAssociationsFix(result.expected.summaries[iSummaries].summaries, result.actual.summaries[iSummaries].summaries)
|
1668
|
+
if (suggestion) {
|
1669
|
+
suggestedFix = suggestion
|
1670
|
+
// console.log(`Try adding this to the associations: { context: ${JSON.stringify(getSuggestion(suggestedFix))}, choose: <indexOfMainElement> },`)
|
1671
|
+
console.log(getSuggestionMessage(suggestedFix))
|
1672
|
+
return
|
1673
|
+
}
|
1674
|
+
}
|
1675
|
+
}
|
1676
|
+
}
|
1677
|
+
}
|
1678
|
+
}
|
1679
|
+
checkForFix()
|
1680
|
+
|
1681
|
+
// find the context where the different is
|
1682
|
+
// select the first diff that has a different operator in the range
|
1683
|
+
// show that
|
1684
|
+
}
|
1595
1685
|
show('paraphrases', result.expected.paraphrases, result.actual.paraphrases)
|
1596
1686
|
if (!args.testNoParenthesized) {
|
1597
1687
|
show('paraphrases parenthesized', result.expected.paraphrasesParenthesized, result.actual.paraphrasesParenthesized)
|
@@ -1755,7 +1845,6 @@ const knowledgeModuleImpl = async ({
|
|
1755
1845
|
const initConfig = async (config) => {
|
1756
1846
|
if (template) {
|
1757
1847
|
if (config.needsRebuild(template.template, template.instance, { isModule: !isProcess }).needsRebuild) {
|
1758
|
-
debugger
|
1759
1848
|
config.needsRebuild(template.template, template.instance, { isModule: !isProcess })
|
1760
1849
|
const error = `This module "${config.name}" cannot be used because the instance file needs rebuilding. Run on the command line with no arguments or the -rt argument to rebuild.`
|
1761
1850
|
throw new Error(error)
|
package/package.json
CHANGED
package/src/config.js
CHANGED
@@ -50,7 +50,8 @@ const debugPriority = (priority) => {
|
|
50
50
|
}
|
51
51
|
if (global.entodictonDebugPriority) {
|
52
52
|
if (helpers.subPriority(entodictonDebugPriority, priority)) {
|
53
|
-
|
53
|
+
// debug hierarchy hit
|
54
|
+
debugger // eslint-disable-line no-debugger
|
54
55
|
}
|
55
56
|
}
|
56
57
|
}
|
@@ -61,7 +62,8 @@ const debugAssociation = (association) => {
|
|
61
62
|
}
|
62
63
|
if (global.entodictonDebugAssociation) {
|
63
64
|
if (helpers.safeEquals(global.entodictonDebugAssociation, association)) {
|
64
|
-
|
65
|
+
// debug association hit
|
66
|
+
debugger // eslint-disable-line no-debugger
|
65
67
|
}
|
66
68
|
}
|
67
69
|
}
|
@@ -72,7 +74,8 @@ const debugWord = (word) => {
|
|
72
74
|
}
|
73
75
|
if (global.entodictonDebugWord) {
|
74
76
|
if (helpers.safeEquals(global.entodictonDebugWord, word)) {
|
75
|
-
|
77
|
+
// debug word hit
|
78
|
+
debugger // eslint-disable-line no-debugger
|
76
79
|
}
|
77
80
|
}
|
78
81
|
}
|
@@ -83,7 +86,8 @@ const debugHierarchy = (pair) => {
|
|
83
86
|
}
|
84
87
|
if (global.entodictonDebugHierarchy) {
|
85
88
|
if (helpers.safeEquals(global.entodictonDebugHierarchy, pair)) {
|
86
|
-
|
89
|
+
// debug hierarchy hit
|
90
|
+
debugger // eslint-disable-line no-debugger
|
87
91
|
}
|
88
92
|
}
|
89
93
|
}
|
@@ -94,7 +98,8 @@ const debugBridge = (bridge) => {
|
|
94
98
|
}
|
95
99
|
if (global.entodictonDebugBridge) {
|
96
100
|
if (global.entodictonDebugBridge == bridge.id) {
|
97
|
-
|
101
|
+
// debug hierarchy hit
|
102
|
+
debugger // eslint-disable-line no-debugger
|
98
103
|
}
|
99
104
|
}
|
100
105
|
}
|
@@ -105,7 +110,8 @@ const debugOperator = (operator) => {
|
|
105
110
|
}
|
106
111
|
if (global.entodictonDebugOperator) {
|
107
112
|
if ((operator.pattern || operator) === global.entodictonDebugOperator) {
|
108
|
-
|
113
|
+
// debug operator hit
|
114
|
+
debugger // eslint-disable-line no-debugger
|
109
115
|
}
|
110
116
|
}
|
111
117
|
}
|
@@ -119,19 +125,35 @@ const debugConfigProps = (config) => {
|
|
119
125
|
}
|
120
126
|
const checkProps = [
|
121
127
|
{ property: 'priorities', check: (v) => debugPriority(v) },
|
122
|
-
{ property: '
|
123
|
-
|
128
|
+
{ property: 'associations', check: (v) => debugAssociation(v) },
|
129
|
+
// TODO implement debugWords
|
130
|
+
{ property: 'words', check: (v) => debugWords(v) },
|
124
131
|
{ property: 'hierarchy', check: (v) => debugHierarchy(v) },
|
125
132
|
{ property: 'operators', check: (v) => debugOperator(v) },
|
126
133
|
{ property: 'bridges', check: (v) => debugBridge(v) }
|
127
134
|
]
|
128
135
|
for (const { property, check } of checkProps) {
|
129
|
-
if (property == '
|
136
|
+
if (property == 'associations') {
|
137
|
+
if (config[property]) {
|
138
|
+
if (config[property].negative) {
|
139
|
+
for (const value of config[property].negative) {
|
140
|
+
check(value)
|
141
|
+
}
|
142
|
+
}
|
143
|
+
if (config[property].positive) {
|
144
|
+
for (const value of config[property].positive) {
|
145
|
+
check(value)
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
} else if (property == 'words') {
|
150
|
+
/*
|
130
151
|
if (config[property]) {
|
131
|
-
for (const value
|
152
|
+
for (const value of config[property].literals) {
|
132
153
|
check(value)
|
133
154
|
}
|
134
155
|
}
|
156
|
+
*/
|
135
157
|
} else if (config[property]) {
|
136
158
|
for (const value of config[property]) {
|
137
159
|
check(value)
|
@@ -173,6 +195,13 @@ const validConfigProps = (config) => {
|
|
173
195
|
'eqClasses'
|
174
196
|
]
|
175
197
|
helpers.validProps(valid, config, 'config')
|
198
|
+
|
199
|
+
// TODO add more type checks
|
200
|
+
if (config.associations) {
|
201
|
+
if (!config.associations.positive && !config.associations.negative) {
|
202
|
+
throw new Error('Expected the \'associations\' property to be a hash with \'positive\' and or \'negative\' properties')
|
203
|
+
}
|
204
|
+
}
|
176
205
|
}
|
177
206
|
|
178
207
|
const setupInitializerFNArgs = (config, args) => {
|
@@ -261,7 +290,7 @@ const handleBridgeProps = (config, bridge, { addFirst, uuid } = {}) => {
|
|
261
290
|
if (bridge.development && config.isModule) {
|
262
291
|
return
|
263
292
|
}
|
264
|
-
if (!bridge.bridge) {
|
293
|
+
if (false && !bridge.bridge) {
|
265
294
|
bridge.bridge = '{ ...next(operator) }'
|
266
295
|
}
|
267
296
|
if (!bridge.level) {
|
@@ -561,7 +590,7 @@ const normalizeConfig = (config) => {
|
|
561
590
|
if (!bridge.level) {
|
562
591
|
bridge.level = 0
|
563
592
|
}
|
564
|
-
if (!bridge.bridge) {
|
593
|
+
if (false && !bridge.bridge) {
|
565
594
|
bridge.bridge = '{ ...next(operator) }'
|
566
595
|
}
|
567
596
|
}
|
@@ -1172,7 +1201,7 @@ class Config {
|
|
1172
1201
|
delete bridge.evaluators
|
1173
1202
|
delete bridge.semantic
|
1174
1203
|
delete bridge.semantics
|
1175
|
-
if (!bridge.bridge) {
|
1204
|
+
if (false && !bridge.bridge) {
|
1176
1205
|
bridge.bridge = '{ ...next(operator) }'
|
1177
1206
|
}
|
1178
1207
|
return bridge
|
@@ -1305,7 +1334,7 @@ class Config {
|
|
1305
1334
|
// TODO fix beforeQuery
|
1306
1335
|
template = { fragments: [], configs: [], ...template }
|
1307
1336
|
template.fragments = template.fragments.concat(this.dynamicFragments)
|
1308
|
-
await rebuildTemplate({ config: this, target: this.name,
|
1337
|
+
await rebuildTemplate({ config: this, instance, target: this.name, startOfChanges: options.startOfChanges, beforeQuery: () => {}, template, ...options, previousResultss: options.previousResultss || instance.resultss })
|
1309
1338
|
} else {
|
1310
1339
|
// no change
|
1311
1340
|
// this.initInstances.push({ ...instance, name: config.name })
|
@@ -1984,9 +2013,6 @@ class Config {
|
|
1984
2013
|
Object.assign(args, addedArgs)
|
1985
2014
|
if (getUUIDScoped) {
|
1986
2015
|
const currentGetUUIDScoped = args.getUUIDScoped
|
1987
|
-
if (!currentGetUUIDScoped) {
|
1988
|
-
debugger
|
1989
|
-
}
|
1990
2016
|
args.getUUIDScoped = (uuid) => Object.assign(currentGetUUIDScoped(uuid), getUUIDScoped(uuid))
|
1991
2017
|
}
|
1992
2018
|
}
|
@@ -2114,7 +2140,6 @@ class Config {
|
|
2114
2140
|
// TODO add more details
|
2115
2141
|
equal (config) {
|
2116
2142
|
if (JSON.stringify(this.config) != JSON.stringify(config.config)) {
|
2117
|
-
debugger
|
2118
2143
|
return false
|
2119
2144
|
}
|
2120
2145
|
return true
|
@@ -2171,9 +2196,6 @@ class Config {
|
|
2171
2196
|
}
|
2172
2197
|
cp.mapUUIDs(map)
|
2173
2198
|
|
2174
|
-
if (cp._uuid == 'concept2') {
|
2175
|
-
// debugger
|
2176
|
-
}
|
2177
2199
|
if (options.callInitializers) {
|
2178
2200
|
await cp.rebuild(options) // in copy
|
2179
2201
|
} else {
|
@@ -2579,8 +2601,6 @@ class Config {
|
|
2579
2601
|
args.currentConfig.wasInitialized = true
|
2580
2602
|
}
|
2581
2603
|
*/
|
2582
|
-
// debugger
|
2583
|
-
// greg55
|
2584
2604
|
config.initializerFn(args, { dontCallFn: true })
|
2585
2605
|
initAfterApis.unshift({ config, args })
|
2586
2606
|
if (config._api) {
|
package/src/configHelpers.js
CHANGED
package/src/digraph.js
CHANGED
@@ -17,7 +17,6 @@ class Digraph {
|
|
17
17
|
|
18
18
|
// BFS
|
19
19
|
path (from, to) {
|
20
|
-
debugger
|
21
20
|
const frontier = { [from]: [[]] }
|
22
21
|
const done = new Set()
|
23
22
|
while (Object.keys(frontier).length > 0) {
|
@@ -155,7 +154,6 @@ class Digraph {
|
|
155
154
|
if (nodes.length === 0) {
|
156
155
|
return new Set([])
|
157
156
|
}
|
158
|
-
debugger
|
159
157
|
nodes = Array.from(nodes)
|
160
158
|
let common = this.ancestors(nodes[0], { includeSelf: true })
|
161
159
|
|
package/src/generators.js
CHANGED
@@ -66,7 +66,8 @@ class Generator {
|
|
66
66
|
const matches = await this.match(args)
|
67
67
|
if ((matches && (options.debug || {}).match) ||
|
68
68
|
callId == this.callId) {
|
69
|
-
|
69
|
+
// next line is the matcher
|
70
|
+
debugger // eslint-disable-line no-debugger
|
70
71
|
await this.match(args)
|
71
72
|
}
|
72
73
|
return matches
|
@@ -118,16 +119,9 @@ class Generator {
|
|
118
119
|
if (this.property == 'generatorp') {
|
119
120
|
args.g = args.gp
|
120
121
|
}
|
121
|
-
// if (this.callId) {
|
122
|
-
// greg
|
123
|
-
/*
|
124
|
-
if (callId == 'call11' && this.callId) {
|
125
|
-
debugger;
|
126
|
-
}
|
127
|
-
*/
|
128
122
|
if ((options.debug || {}).apply ||
|
129
123
|
callId == this.callId) {
|
130
|
-
debugger
|
124
|
+
debugger // eslint-disable-line no-debugger
|
131
125
|
}
|
132
126
|
return await this._apply(args)
|
133
127
|
}
|
package/src/helpers.js
CHANGED
@@ -27,6 +27,28 @@ function where (goUp = 2) {
|
|
27
27
|
}
|
28
28
|
}
|
29
29
|
|
30
|
+
function suggestAssociationsFix (esummary, asummary) {
|
31
|
+
for (let isummary = 0; isummary < esummary.length; ++isummary) {
|
32
|
+
if (!deepEqual(esummary[isummary], asummary[isummary])) {
|
33
|
+
return esummary[isummary].operators
|
34
|
+
}
|
35
|
+
}
|
36
|
+
return []
|
37
|
+
}
|
38
|
+
|
39
|
+
function suggestAssociationsFixFromSummaries (esummaries, asummaries) {
|
40
|
+
for (let isummaries = 0; isummaries < esummaries.length; ++isummaries) {
|
41
|
+
const esummary = esummaries[isummaries].summaries
|
42
|
+
const asummary = asummaries[isummaries].summaries
|
43
|
+
for (let isummary = 0; isummary < esummary.length; ++isummary) {
|
44
|
+
if (!deepEqual(esummary[isummary], asummary[isummary])) {
|
45
|
+
return esummary[isummary].operators
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
return []
|
50
|
+
}
|
51
|
+
|
30
52
|
function w (func) {
|
31
53
|
func.where = where(3)
|
32
54
|
return func
|
@@ -437,5 +459,7 @@ module.exports = {
|
|
437
459
|
sortJson,
|
438
460
|
subPriority,
|
439
461
|
where,
|
440
|
-
w
|
462
|
+
w,
|
463
|
+
suggestAssociationsFix,
|
464
|
+
suggestAssociationsFixFromSummaries
|
441
465
|
}
|
package/src/semantics.js
CHANGED
@@ -73,7 +73,8 @@ class Semantic {
|
|
73
73
|
this.fixUpArgs(args, context)
|
74
74
|
const matches = await this.matcher(args)
|
75
75
|
if (matches && (options.debug || {}).match || args.callId == this.callId) {
|
76
|
-
|
76
|
+
// next line is the matcher
|
77
|
+
debugger // eslint-disable-line no-debugger
|
77
78
|
await this.matcher(args)
|
78
79
|
}
|
79
80
|
return matches
|
@@ -92,10 +93,10 @@ class Semantic {
|
|
92
93
|
this.fixUpArgs(args, contextPrime)
|
93
94
|
|
94
95
|
if ((options.debug || {}).apply || args.callId == this.callId) {
|
95
|
-
debugger
|
96
|
+
debugger // eslint-disable-line no-debugger
|
96
97
|
}
|
97
98
|
if (args.breakOnSemantics) {
|
98
|
-
debugger
|
99
|
+
debugger // eslint-disable-line no-debugger
|
99
100
|
}
|
100
101
|
await this._apply(args)
|
101
102
|
return contextPrime
|
@@ -166,9 +167,6 @@ class Semantics {
|
|
166
167
|
args.log = (message) => { this.logs.push(message) }
|
167
168
|
for (const isemantic in this.semantics) {
|
168
169
|
const semantic = this.semantics[isemantic]
|
169
|
-
if (!semantic) {
|
170
|
-
debugger
|
171
|
-
}
|
172
170
|
// only one question at a time
|
173
171
|
if (semantic.isQuestion && seenQuestion) {
|
174
172
|
continue
|