theprogrammablemind 9.1.1-beta.5 → 9.1.1-beta.7
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 +10 -1
- package/package.json +3 -2
- package/src/config.js +5 -2
package/client.js
CHANGED
@@ -15,6 +15,7 @@ const flattens = require('./src/flatten')
|
|
15
15
|
const { appendNoDups, InitCalls, updateQueries, safeNoDups, stableId, where, suggestAssociationsFix, suggestAssociationsFixFromSummaries, validProps } = require('./src/helpers')
|
16
16
|
const runtime = require('./runtime')
|
17
17
|
const sortJson = runtime.sortJson
|
18
|
+
const debug = require('./src/debug')
|
18
19
|
|
19
20
|
const getConfig_getObjectsCheck = (config, testConfig) => {
|
20
21
|
let testConfigName = config.name
|
@@ -1237,6 +1238,7 @@ const knowledgeModuleImpl = async ({
|
|
1237
1238
|
const createConfig = async () => {
|
1238
1239
|
const config = new Config(configStruct, moduleFromJSFile, _process)
|
1239
1240
|
setupConfig(config)
|
1241
|
+
config.expect_template = !!template
|
1240
1242
|
config.setTerminator(terminator)
|
1241
1243
|
config.stop_auto_rebuild()
|
1242
1244
|
await config.add(...(includes || []))
|
@@ -1324,7 +1326,6 @@ const knowledgeModuleImpl = async ({
|
|
1324
1326
|
if (args.rebuildTemplateFull) {
|
1325
1327
|
args.rebuildTemplate = true
|
1326
1328
|
}
|
1327
|
-
|
1328
1329
|
config = await createConfig()
|
1329
1330
|
|
1330
1331
|
// dont debug the load of the KM's if rebuild template is on since we want to debug the template rebuild not the load
|
@@ -1568,6 +1569,7 @@ const knowledgeModuleImpl = async ({
|
|
1568
1569
|
}
|
1569
1570
|
try {
|
1570
1571
|
await config.load(rebuildTemplate, template.template, template.instance, { rebuild: needsRebuild.needsRebuild || options.rebuild, previousResultss: needsRebuild.previousResultss, startOfChanges: needsRebuild.startOfChanges })
|
1572
|
+
config.fixtures()
|
1571
1573
|
} catch (e) {
|
1572
1574
|
console.error(`Error loading template for ${config.name}. ${e.error ? e.error : e}${e.stack ? e.stack : ''}`)
|
1573
1575
|
runtime.process.exit(-1)
|
@@ -1867,6 +1869,7 @@ const knowledgeModuleImpl = async ({
|
|
1867
1869
|
config.terminate()
|
1868
1870
|
}
|
1869
1871
|
}
|
1872
|
+
moduleFromJSFile.exports = createConfig
|
1870
1873
|
} else {
|
1871
1874
|
const initConfig = async (config) => {
|
1872
1875
|
if (template) {
|
@@ -1936,6 +1939,11 @@ const test = (name) => {
|
|
1936
1939
|
}
|
1937
1940
|
*/
|
1938
1941
|
|
1942
|
+
// for testing
|
1943
|
+
const getRequireMain = () => {
|
1944
|
+
return require.main
|
1945
|
+
}
|
1946
|
+
|
1939
1947
|
const ensureTestFile = (module, name, type) => {
|
1940
1948
|
const isProcess = require.main === module
|
1941
1949
|
if (isProcess) {
|
@@ -1957,6 +1965,7 @@ const knowledgeModule = async (...args) => {
|
|
1957
1965
|
module.exports = {
|
1958
1966
|
process: _process,
|
1959
1967
|
stableId,
|
1968
|
+
getRequireMain, // for testing
|
1960
1969
|
ensureTestFile,
|
1961
1970
|
rebuildTemplate,
|
1962
1971
|
processContext,
|
package/package.json
CHANGED
@@ -9,7 +9,8 @@
|
|
9
9
|
"eslint-plugin-node": "^11.1.0",
|
10
10
|
"eslint-plugin-promise": "^5.1.0",
|
11
11
|
"globals": "^16.0.0",
|
12
|
-
"jest": "^29.7.0"
|
12
|
+
"jest": "^29.7.0",
|
13
|
+
"argparse": "^2.0.1"
|
13
14
|
},
|
14
15
|
"scripts": {
|
15
16
|
"to:debug": "node inspect node_modules/.bin/jest --runInBand -t NEO23",
|
@@ -68,6 +69,6 @@
|
|
68
69
|
"sort-json": "^2.0.0",
|
69
70
|
"uuid": "^8.3.2"
|
70
71
|
},
|
71
|
-
"version": "9.1.1-beta.
|
72
|
+
"version": "9.1.1-beta.7",
|
72
73
|
"license": "UNLICENSED"
|
73
74
|
}
|
package/src/config.js
CHANGED
@@ -1372,6 +1372,7 @@ class Config {
|
|
1372
1372
|
this.instances.push(instance)
|
1373
1373
|
await configHelpers.loadInstance(this, instance)
|
1374
1374
|
}
|
1375
|
+
this.expect_template = false
|
1375
1376
|
}
|
1376
1377
|
}
|
1377
1378
|
|
@@ -1952,7 +1953,7 @@ class Config {
|
|
1952
1953
|
this.resetDelta()
|
1953
1954
|
|
1954
1955
|
this.addedArgss = []
|
1955
|
-
|
1956
|
+
const isProcess = require.main === module
|
1956
1957
|
if (global.theprogrammablemind && config) {
|
1957
1958
|
if (global.theprogrammablemind.loadForTesting[config.name]) {
|
1958
1959
|
isProcess = true
|
@@ -2717,7 +2718,9 @@ class Config {
|
|
2717
2718
|
this.hierarchy.edges = this.config.hierarchy
|
2718
2719
|
|
2719
2720
|
if (!this.isModule) {
|
2720
|
-
|
2721
|
+
if (this.template || !this.expect_template) {
|
2722
|
+
await this.fixtures()
|
2723
|
+
}
|
2721
2724
|
}
|
2722
2725
|
|
2723
2726
|
this.valid()
|