theprogrammablemind 9.1.1-beta.12 → 9.1.1-beta.14
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 +1 -1
- package/package.json +1 -1
- package/src/config.js +44 -14
- package/src/configHelpers.js +7 -4
package/client.js
CHANGED
@@ -1161,7 +1161,7 @@ const checkTemplate = (template) => {
|
|
1161
1161
|
if (template.checks) {
|
1162
1162
|
throw new Error("The 'checks' property should be in the 'test' property not the 'template' property")
|
1163
1163
|
}
|
1164
|
-
validProps([
|
1164
|
+
validProps(['fragments', 'configs'], template.template, 'template.template')
|
1165
1165
|
}
|
1166
1166
|
|
1167
1167
|
const checkTest = (testConfig) => {
|
package/package.json
CHANGED
package/src/config.js
CHANGED
@@ -865,6 +865,7 @@ class Config {
|
|
865
865
|
async fixtures () {
|
866
866
|
if (this.testConfig?.fixtures) {
|
867
867
|
const args = {}
|
868
|
+
args.uuid = this._uuid
|
868
869
|
configHelpers.setupArgs(args, this)
|
869
870
|
return this.testConfig.fixtures(args)
|
870
871
|
}
|
@@ -893,7 +894,7 @@ class Config {
|
|
893
894
|
|
894
895
|
getPseudoConfig (uuid, config) {
|
895
896
|
return {
|
896
|
-
description: 'this is a pseudo config that has limited functionality due to being available in the initializer function context',
|
897
|
+
description: 'this is a pseudo config that has limited functionality due to being available in the initializer and fixtures function context',
|
897
898
|
addAssociation: (...args) => this.addAssociation(...args),
|
898
899
|
addAssociations: (...args) => this.addAssociations(...args),
|
899
900
|
addBridge: (...args) => this.addBridge(...args, uuid),
|
@@ -1951,7 +1952,7 @@ class Config {
|
|
1951
1952
|
this.resetDelta()
|
1952
1953
|
|
1953
1954
|
this.addedArgss = []
|
1954
|
-
|
1955
|
+
let isProcess = require.main === module
|
1955
1956
|
if (global.theprogrammablemind && config) {
|
1956
1957
|
if (global.theprogrammablemind.loadForTesting[config.name]) {
|
1957
1958
|
isProcess = true
|
@@ -2090,6 +2091,10 @@ class Config {
|
|
2090
2091
|
}
|
2091
2092
|
|
2092
2093
|
get api () {
|
2094
|
+
if (this._stop_auto_rebuild) {
|
2095
|
+
throw new Error('The API cannot be accessed until the auto rebuild is restarted')
|
2096
|
+
}
|
2097
|
+
|
2093
2098
|
if (this._api && this._api.multiApi) {
|
2094
2099
|
return this._api.api(this._api)
|
2095
2100
|
} else {
|
@@ -2117,8 +2122,20 @@ class Config {
|
|
2117
2122
|
throw new Error(`Expected the argument to be an API constructor for ${this.name}.`)
|
2118
2123
|
}
|
2119
2124
|
const value = constructor()
|
2120
|
-
if (
|
2121
|
-
|
2125
|
+
if (this._apiKMs.length > 0) {
|
2126
|
+
for (const name of this._apiKMs) {
|
2127
|
+
const api = value[name]
|
2128
|
+
if (!api) {
|
2129
|
+
throw new Error(`The API for ${this.name} is not being provided by the API constructor.`)
|
2130
|
+
}
|
2131
|
+
if (!api.initialize) {
|
2132
|
+
throw new Error(`Expected the API for ${this.name} to have an initialize function.`)
|
2133
|
+
}
|
2134
|
+
}
|
2135
|
+
} else {
|
2136
|
+
if (!value.initialize) {
|
2137
|
+
throw new Error(`Expected the API to have an initialize function for ${this.name}.`)
|
2138
|
+
}
|
2122
2139
|
}
|
2123
2140
|
|
2124
2141
|
if (this._api && this._api.multiApi) {
|
@@ -2131,13 +2148,13 @@ class Config {
|
|
2131
2148
|
return api
|
2132
2149
|
}
|
2133
2150
|
} else {
|
2134
|
-
this._api = value
|
2135
2151
|
this._apiConstructor = constructor
|
2136
|
-
|
2137
|
-
|
2138
|
-
|
2152
|
+
if (this._apiKMs.length > 0) {
|
2153
|
+
for (const name of this._apiKMs) {
|
2154
|
+
this.km(name)._api = value[name]
|
2139
2155
|
}
|
2140
|
-
|
2156
|
+
} else {
|
2157
|
+
this._api = value
|
2141
2158
|
}
|
2142
2159
|
await this.rebuild()
|
2143
2160
|
}
|
@@ -2206,10 +2223,21 @@ class Config {
|
|
2206
2223
|
// update uuid here set the uuid in the objects and add error checking
|
2207
2224
|
cp.initializerFn = this.initializerFn
|
2208
2225
|
cp.terminatorFn = this.terminatorFn
|
2209
|
-
|
2210
|
-
|
2211
|
-
|
2212
|
-
|
2226
|
+
cp._apiKMs = this._apiKMs
|
2227
|
+
cp._apiConstructor = this._apiConstructor
|
2228
|
+
if (cp._apiConstructor) {
|
2229
|
+
if (this._apiKMs.length > 0) {
|
2230
|
+
const apis = cp._apiConstructor(cp)
|
2231
|
+
for (const name of this._apiKMs) {
|
2232
|
+
if (name == this.name) {
|
2233
|
+
cp._api = apis[name]
|
2234
|
+
} else {
|
2235
|
+
cp.km(name)._api = apis[name]
|
2236
|
+
}
|
2237
|
+
}
|
2238
|
+
} else {
|
2239
|
+
cp._api = cp._apiConstructor(cp)
|
2240
|
+
}
|
2213
2241
|
}
|
2214
2242
|
cp._namespace = this._namespace
|
2215
2243
|
cp._eqClasses = this._eqClasses
|
@@ -2589,7 +2617,9 @@ class Config {
|
|
2589
2617
|
const initAfterApis = []
|
2590
2618
|
this.configs.forEach((km) => {
|
2591
2619
|
const namespace = km.namespace
|
2592
|
-
this.config.objects.namespaced[km._uuid] = {
|
2620
|
+
this.config.objects.namespaced[km._uuid] = {
|
2621
|
+
km: km._uuid
|
2622
|
+
}
|
2593
2623
|
const namespacedObjects = this.config.objects.namespaced[km._uuid]
|
2594
2624
|
this.setupNamespace(km)
|
2595
2625
|
// const aw = (word, def) => this.addWord(word, def)
|
package/src/configHelpers.js
CHANGED
@@ -85,6 +85,9 @@ const setupArgs = (args, config, logs, hierarchy, uuidForScoping) => {
|
|
85
85
|
args.objects = config.get('objects')
|
86
86
|
args.getObjects = getObjects(args.objects)
|
87
87
|
}
|
88
|
+
if (args.uuid) {
|
89
|
+
args.objects = args.getObjects(args.uuid)
|
90
|
+
}
|
88
91
|
if (!hierarchy) {
|
89
92
|
hierarchy = config.hierarchy
|
90
93
|
}
|
@@ -249,7 +252,7 @@ const setupContexts = (rawContexts) => {
|
|
249
252
|
let first = true
|
250
253
|
const contexts = []
|
251
254
|
contexts.push({ marker: 'controlStart', controlRemove: true })
|
252
|
-
let previous
|
255
|
+
let previous
|
253
256
|
for (const context of rawContexts) {
|
254
257
|
if (first) {
|
255
258
|
first = false
|
@@ -337,9 +340,9 @@ const processContextsB = async ({ config, hierarchy, semantics, generators, json
|
|
337
340
|
if (contextPrime.controlRemove) {
|
338
341
|
continue
|
339
342
|
}
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
+
const paraphrases = []
|
344
|
+
const paraphrasesParenthesized = []
|
345
|
+
const generatedParenthesized = []
|
343
346
|
if (forTemplate) {
|
344
347
|
// noop
|
345
348
|
} else {
|