theprogrammablemind 9.1.1-beta.7 → 9.1.1-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 +2 -2
- package/package.json +1 -1
- package/src/config.js +14 -10
- package/src/configHelpers.js +4 -2
- package/src/semantics.js +9 -0
package/client.js
CHANGED
@@ -1182,7 +1182,7 @@ const checkTest = (testConfig) => {
|
|
1182
1182
|
const knowledgeModuleImpl = async ({
|
1183
1183
|
includes,
|
1184
1184
|
config: configStruct,
|
1185
|
-
api,
|
1185
|
+
api, apiKMs,
|
1186
1186
|
initializer,
|
1187
1187
|
terminator,
|
1188
1188
|
multiApiInitializer,
|
@@ -1243,7 +1243,7 @@ const knowledgeModuleImpl = async ({
|
|
1243
1243
|
config.stop_auto_rebuild()
|
1244
1244
|
await config.add(...(includes || []))
|
1245
1245
|
if (api) {
|
1246
|
-
config.setApi(api)
|
1246
|
+
config.setApi(api, apiKMs)
|
1247
1247
|
}
|
1248
1248
|
if (multiApiInitializer) {
|
1249
1249
|
await config.setMultiApi(multiApiInitializer)
|
package/package.json
CHANGED
package/src/config.js
CHANGED
@@ -845,14 +845,6 @@ const multiApiImpl = (initializer) => {
|
|
845
845
|
}
|
846
846
|
},
|
847
847
|
|
848
|
-
/*
|
849
|
-
set objects (value) {
|
850
|
-
for (const key in Object.keys(this.apis)) {
|
851
|
-
this.apis[key].objects = value
|
852
|
-
}
|
853
|
-
},
|
854
|
-
*/
|
855
|
-
|
856
848
|
// "product1": apiInstance(testData1),
|
857
849
|
apis: {
|
858
850
|
},
|
@@ -2113,7 +2105,11 @@ class Config {
|
|
2113
2105
|
}
|
2114
2106
|
}
|
2115
2107
|
|
2116
|
-
|
2108
|
+
// constructors is a constructor
|
2109
|
+
async setApi (constructor, apiKMs) {
|
2110
|
+
if (!apiKMs) {
|
2111
|
+
apiKMs = [this.name]
|
2112
|
+
}
|
2117
2113
|
if (typeof constructor !== 'function') {
|
2118
2114
|
throw new Error(`Expected the argument to be an API constructor for ${this.name}.`)
|
2119
2115
|
}
|
@@ -2134,6 +2130,13 @@ class Config {
|
|
2134
2130
|
} else {
|
2135
2131
|
this._api = value
|
2136
2132
|
this._apiConstructor = constructor
|
2133
|
+
this._apiKMs = apiKMs
|
2134
|
+
for (const name of this._apiKMs) {
|
2135
|
+
if (this.name == name) {
|
2136
|
+
continue
|
2137
|
+
}
|
2138
|
+
this.km(name).setApi(() => this._api)
|
2139
|
+
}
|
2137
2140
|
await this.rebuild()
|
2138
2141
|
}
|
2139
2142
|
}
|
@@ -2201,10 +2204,10 @@ class Config {
|
|
2201
2204
|
// update uuid here set the uuid in the objects and add error checking
|
2202
2205
|
cp.initializerFn = this.initializerFn
|
2203
2206
|
cp.terminatorFn = this.terminatorFn
|
2204
|
-
// cp._api = _.cloneDeep(this._api)
|
2205
2207
|
if (this._apiConstructor) {
|
2206
2208
|
cp._api = this._apiConstructor(cp)
|
2207
2209
|
cp._apiConstructor = this._apiConstructor
|
2210
|
+
cp._apiKMs = this._apiKMs
|
2208
2211
|
}
|
2209
2212
|
cp._namespace = this._namespace
|
2210
2213
|
cp._eqClasses = this._eqClasses
|
@@ -2622,6 +2625,7 @@ class Config {
|
|
2622
2625
|
currentConfig: config,
|
2623
2626
|
uuid: config._uuid,
|
2624
2627
|
objects: namespacedObjects,
|
2628
|
+
globals: this.config.objects,
|
2625
2629
|
namespace,
|
2626
2630
|
api: config.api
|
2627
2631
|
}))
|
package/src/configHelpers.js
CHANGED
@@ -249,15 +249,17 @@ const setupContexts = (rawContexts) => {
|
|
249
249
|
let first = true
|
250
250
|
const contexts = []
|
251
251
|
contexts.push({ marker: 'controlStart', controlRemove: true })
|
252
|
+
let previous;
|
252
253
|
for (const context of rawContexts) {
|
253
254
|
if (first) {
|
254
255
|
first = false
|
255
256
|
} else {
|
256
|
-
contexts.push({ marker: 'controlBetween', controlRemove: true })
|
257
|
+
contexts.push({ marker: 'controlBetween', controlRemove: true, previous })
|
257
258
|
}
|
258
259
|
contexts.push(context)
|
260
|
+
previous = context
|
259
261
|
}
|
260
|
-
contexts.push({ marker: 'controlEnd', controlRemove: true })
|
262
|
+
contexts.push({ marker: 'controlEnd', controlRemove: true, previous })
|
261
263
|
|
262
264
|
let _index = 0
|
263
265
|
const id = (context) => {
|
package/src/semantics.js
CHANGED
@@ -183,7 +183,16 @@ class Semantics {
|
|
183
183
|
deferWasCalled = true
|
184
184
|
}
|
185
185
|
args.defer = defer
|
186
|
+
|
187
|
+
let continueWasCalled = false
|
188
|
+
const _continue = () => {
|
189
|
+
continueWasCalled = true
|
190
|
+
}
|
191
|
+
args._continue = _continue
|
186
192
|
contextPrime = await semantic.apply(args, context, s, options)
|
193
|
+
if (continueWasCalled) {
|
194
|
+
continue
|
195
|
+
}
|
187
196
|
if (deferWasCalled) {
|
188
197
|
continue
|
189
198
|
}
|