theprogrammablemind 7.5.4-beta.6 → 7.5.4-beta.8
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 +13 -3
- package/package.json +1 -1
- package/src/config.js +14 -6
- package/src/generators.js +4 -2
- package/src/semantics.js +4 -2
package/client.js
CHANGED
@@ -515,10 +515,13 @@ const processInstance = (config, instance) => {
|
|
515
515
|
const transitoryMode = global.transitoryMode
|
516
516
|
global.transitoryMode = false
|
517
517
|
const { /* data, generators, semantics, */ hierarchy } = setupProcessB({ config })
|
518
|
-
for (const results of (instance.resultss || [])) {
|
518
|
+
// for (const results of (instance.resultss || [])) {
|
519
|
+
for (const i in (instance.resultss || [])) {
|
520
|
+
const results = instance.resultss[i]
|
519
521
|
if (results.extraConfig) {
|
520
522
|
// config.addInternal(results, useOldVersion = true, skipObjects = false, includeNamespaces = true, allowNameToBeNull = false)
|
521
|
-
config.addInternal(
|
523
|
+
// config.addInternal(config.template.queries[i], { handleCalculatedProps: true } )
|
524
|
+
config.addInternal(instance.template.queries[i], { handleCalculatedProps: true } )
|
522
525
|
} else {
|
523
526
|
processContextsB({ config, hierarchy, json: results/*, generators, semantics */ })
|
524
527
|
}
|
@@ -1662,7 +1665,14 @@ function where(goUp = 2) {
|
|
1662
1665
|
const e = new Error();
|
1663
1666
|
const regexForm1 = /\((.*):(\d+):(\d+)\)$/
|
1664
1667
|
const regexForm2 = /at (.*):(\d+):(\d+)$/
|
1665
|
-
const
|
1668
|
+
const lines = e.stack.split("\n")
|
1669
|
+
let line
|
1670
|
+
for (line of lines.slice(1)) {
|
1671
|
+
if (!(line.includes("config.js:") || line.includes("client.js:"))) {
|
1672
|
+
break;
|
1673
|
+
}
|
1674
|
+
}
|
1675
|
+
// const line = e.stack.split("\n")[goUp];
|
1666
1676
|
const match = regexForm1.exec(line) || regexForm2.exec(line);
|
1667
1677
|
if (match) {
|
1668
1678
|
return `${match[1]}:${match[2]}`
|
package/package.json
CHANGED
package/src/config.js
CHANGED
@@ -74,31 +74,39 @@ const handleBridgeProps = (config, bridge) => {
|
|
74
74
|
}
|
75
75
|
if (bridge.generatorp) {
|
76
76
|
config.config.generators.unshift({
|
77
|
-
where: bridge.generatorp.where || client.where(
|
77
|
+
where: bridge.generatorp.where || bridge.where || client.where(4),
|
78
78
|
match: ({context}) => bridge.id == context.marker && context.paraphrase,
|
79
79
|
apply: (args) => bridge.generatorp(args),
|
80
|
+
applyWrapped: bridge.generatorp,
|
81
|
+
property: 'generatorp',
|
80
82
|
})
|
81
83
|
}
|
82
84
|
if (bridge.generatorr) {
|
83
85
|
config.config.generators.unshift({
|
84
86
|
// TODO merge response and isResponse
|
85
|
-
where: bridge.generatorr.where || client.where(3),
|
87
|
+
where: bridge.generatorr.where || bridge.where || client.where(3),
|
86
88
|
match: ({context}) => bridge.id == context.marker && !context.paraphrase && (context.response || context.isResponse),
|
87
89
|
apply: (args) => bridge.generatorr(args),
|
90
|
+
applyWrapped: bridge.generatorr,
|
91
|
+
property: 'generatorr',
|
88
92
|
})
|
89
93
|
}
|
90
94
|
if (bridge.evaluator) {
|
91
95
|
config.config.semantics.unshift({
|
92
|
-
where: bridge.evaluator.where || client.where(3),
|
96
|
+
where: bridge.evaluator.where || bridge.where || client.where(3),
|
93
97
|
match: ({context}) => bridge.id == context.marker && context.evaluate,
|
94
98
|
apply: (args) => bridge.evaluator(args),
|
99
|
+
applyWrapped: bridge.evaluator,
|
100
|
+
property: 'evaluator',
|
95
101
|
})
|
96
102
|
}
|
97
103
|
if (bridge.semantic) {
|
98
104
|
config.config.semantics.unshift({
|
99
|
-
where: bridge.semantic.where || client.where(3),
|
105
|
+
where: bridge.semantic.where || bridge.where || client.where(3),
|
100
106
|
match: ({context}) => bridge.id == context.marker,
|
101
107
|
apply: (args) => bridge.semantic(args),
|
108
|
+
applyWrapped: bridge.semantic,
|
109
|
+
property: 'semantic',
|
102
110
|
})
|
103
111
|
}
|
104
112
|
}
|
@@ -106,7 +114,7 @@ const handleBridgeProps = (config, bridge) => {
|
|
106
114
|
const handleCalculatedProps = (baseConfig, moreConfig) => {
|
107
115
|
for (let bridge of moreConfig.bridges) {
|
108
116
|
const valid = [ 'before', 'bridge', 'development', 'evaluator', 'generatorp', 'generatorr', 'generators', 'id', 'convolution', 'inverted', 'isA', 'children', 'parents',
|
109
|
-
'level', 'optional', 'selector', 'semantic', 'words', /Bridge$/, 'localHierarchy' ]
|
117
|
+
'level', 'optional', 'selector', 'semantic', 'words', /Bridge$/, 'localHierarchy', 'where' ]
|
110
118
|
helpers.validProps(valid, bridge, 'bridge')
|
111
119
|
handleBridgeProps(baseConfig, bridge)
|
112
120
|
}
|
@@ -669,7 +677,7 @@ class Config {
|
|
669
677
|
}
|
670
678
|
|
671
679
|
load (template, instance, options = { rebuild: false } ) {
|
672
|
-
|
680
|
+
instance.template = template
|
673
681
|
this.logs.push(`loading template for ${this.name}`)
|
674
682
|
if (instance && instance.associations && !options.rebuild) {
|
675
683
|
this.addAssociations(instance.associations)
|
package/src/generators.js
CHANGED
@@ -6,9 +6,11 @@ class Generator {
|
|
6
6
|
// constructor ({ match, apply, uuid, index, km, priority, notes }) {
|
7
7
|
constructor (generator) {
|
8
8
|
generator = normalizeGenerator(generator)
|
9
|
-
const { match, apply, uuid, index, km, priority, where, notes, debug } = generator
|
9
|
+
const { match, apply, uuid, index, km, priority, where, notes, debug, applyWrapped, property } = generator
|
10
10
|
this.match = match
|
11
11
|
this._apply = apply
|
12
|
+
this._applyWrapped = applyWrapped
|
13
|
+
this.property = property
|
12
14
|
this.uuid = uuid
|
13
15
|
this.index = index
|
14
16
|
this.km = km
|
@@ -39,7 +41,7 @@ class Generator {
|
|
39
41
|
}
|
40
42
|
|
41
43
|
toString () {
|
42
|
-
return `Generator(${this.match}, ${this._apply})`
|
44
|
+
return `Generator(${this.match}, ${this._applyWrapped || this._apply})${this.property ? `\nsee the ${this.property} property` : ''}`
|
43
45
|
}
|
44
46
|
|
45
47
|
matches (baseArgs, objects, context, hierarchy, config, options = {}) {
|
package/src/semantics.js
CHANGED
@@ -6,9 +6,11 @@ class Semantic {
|
|
6
6
|
// constructor ({match, apply, uuid, index, km, notes}) {
|
7
7
|
constructor (semantic) {
|
8
8
|
semantic = normalizeSemantic(semantic)
|
9
|
-
const { match, apply, uuid, index, km, notes, priority, debug, where } = semantic
|
9
|
+
const { match, apply, uuid, index, km, notes, priority, debug, where, applyWrapped, property } = semantic
|
10
10
|
this.matcher = match
|
11
11
|
this._apply = apply
|
12
|
+
this._applyWrapped = applyWrapped
|
13
|
+
this.property = property
|
12
14
|
this.uuid = uuid
|
13
15
|
this.index = index
|
14
16
|
this.km = km
|
@@ -27,7 +29,7 @@ class Semantic {
|
|
27
29
|
}
|
28
30
|
|
29
31
|
toString () {
|
30
|
-
return `Semantic(${this.matcher}, ${this._apply})`
|
32
|
+
return `Semantic(${this.matcher}, ${this._applyWrapped || this._apply})${this.property ? `\nsee the ${this.property} property` : ''}`
|
31
33
|
}
|
32
34
|
|
33
35
|
getAPI (config) {
|