theprogrammablemind 9.6.0-beta.2 → 9.6.0
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 -8
- package/package.json +1 -1
- package/src/config.js +1 -2
- package/src/digraph.js +0 -3
- package/src/project2.js +2 -4
package/client.js
CHANGED
|
@@ -1184,7 +1184,10 @@ const checkTemplate = (template) => {
|
|
|
1184
1184
|
if (!template) {
|
|
1185
1185
|
return
|
|
1186
1186
|
}
|
|
1187
|
-
|
|
1187
|
+
if (template.checks) {
|
|
1188
|
+
throw new Error("The 'checks' property should be in the 'test' property not the 'template' property")
|
|
1189
|
+
}
|
|
1190
|
+
validProps(['fragments', 'configs'], template.template, 'template.template')
|
|
1188
1191
|
}
|
|
1189
1192
|
|
|
1190
1193
|
const checkTest = (testConfig) => {
|
|
@@ -1218,7 +1221,6 @@ const knowledgeModuleImpl = async ({
|
|
|
1218
1221
|
demo,
|
|
1219
1222
|
test,
|
|
1220
1223
|
template,
|
|
1221
|
-
instance, // instance file
|
|
1222
1224
|
errorHandler = defaultErrorHandler,
|
|
1223
1225
|
process: processResults = defaultProcess,
|
|
1224
1226
|
stopAtFirstFailure = true,
|
|
@@ -1634,10 +1636,10 @@ const knowledgeModuleImpl = async ({
|
|
|
1634
1636
|
let needsRebuild
|
|
1635
1637
|
if (args.rebuildTemplate && !args.rebuildTemplateFull) {
|
|
1636
1638
|
// get the startOfChanges for the partial rebuild
|
|
1637
|
-
needsRebuild = config.needsRebuild(template, instance, { ...options, rebuild: false })
|
|
1639
|
+
needsRebuild = config.needsRebuild(template.template, template.instance, { ...options, rebuild: false })
|
|
1638
1640
|
} else {
|
|
1639
1641
|
// do a check or full rebuild
|
|
1640
|
-
needsRebuild = config.needsRebuild(template, instance, options)
|
|
1642
|
+
needsRebuild = config.needsRebuild(template.template, template.instance, options)
|
|
1641
1643
|
}
|
|
1642
1644
|
|
|
1643
1645
|
if (needsRebuild.needsRebuild) {
|
|
@@ -1653,7 +1655,7 @@ const knowledgeModuleImpl = async ({
|
|
|
1653
1655
|
config.config.rebuild = true
|
|
1654
1656
|
}
|
|
1655
1657
|
try {
|
|
1656
|
-
await config.load(rebuildTemplate, template, instance, { rebuild: needsRebuild.needsRebuild || options.rebuild, previousResultss: needsRebuild.previousResultss, startOfChanges: needsRebuild.startOfChanges })
|
|
1658
|
+
await config.load(rebuildTemplate, template.template, template.instance, { rebuild: needsRebuild.needsRebuild || options.rebuild, previousResultss: needsRebuild.previousResultss, startOfChanges: needsRebuild.startOfChanges })
|
|
1657
1659
|
config.fixtures()
|
|
1658
1660
|
} catch (e) {
|
|
1659
1661
|
console.error(`Error loading template for ${config.name}. ${e.error ? e.error : e}${e.stack ? e.stack : ''}`)
|
|
@@ -1975,8 +1977,8 @@ const knowledgeModuleImpl = async ({
|
|
|
1975
1977
|
} else {
|
|
1976
1978
|
const initConfig = async (config) => {
|
|
1977
1979
|
if (template) {
|
|
1978
|
-
if (config.needsRebuild(template, instance, { isModule: !isProcess }).needsRebuild) {
|
|
1979
|
-
config.needsRebuild(template, instance, { isModule: !isProcess })
|
|
1980
|
+
if (config.needsRebuild(template.template, template.instance, { isModule: !isProcess }).needsRebuild) {
|
|
1981
|
+
config.needsRebuild(template.template, template.instance, { isModule: !isProcess })
|
|
1980
1982
|
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.`
|
|
1981
1983
|
throw new Error(error)
|
|
1982
1984
|
}
|
|
@@ -1991,7 +1993,7 @@ const knowledgeModuleImpl = async ({
|
|
|
1991
1993
|
}
|
|
1992
1994
|
if (template) {
|
|
1993
1995
|
try {
|
|
1994
|
-
await config.load(rebuildTemplate, template, instance)
|
|
1996
|
+
await config.load(rebuildTemplate, template.template, template.instance)
|
|
1995
1997
|
} catch (e) {
|
|
1996
1998
|
errorHandler(e)
|
|
1997
1999
|
}
|
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -553,8 +553,7 @@ const handleCalculatedProps = (baseConfig, moreConfig, { addFirst, uuid } = {})
|
|
|
553
553
|
'skipable',
|
|
554
554
|
'uuid',
|
|
555
555
|
'where',
|
|
556
|
-
'words',
|
|
557
|
-
/Bridge$/,
|
|
556
|
+
'words', /Bridge$/,
|
|
558
557
|
]
|
|
559
558
|
helpers.validProps(valid, bridge, 'bridge')
|
|
560
559
|
handleBridgeProps(baseConfig, bridge, { addFirst, uuid })
|
package/src/digraph.js
CHANGED
package/src/project2.js
CHANGED
|
@@ -11,7 +11,7 @@ function areFirstNEqual(arr1, arr2, n) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function project(source, filters, path=[]) {
|
|
14
|
-
if (['
|
|
14
|
+
if (['string', 'number'].includes(typeof source)) {
|
|
15
15
|
return source
|
|
16
16
|
}
|
|
17
17
|
if (Array.isArray(source)) {
|
|
@@ -63,9 +63,7 @@ function project(source, filters, path=[]) {
|
|
|
63
63
|
properties.forEach(prop => {
|
|
64
64
|
if (prop.path && (prop.path.length === path.length + 1) && areFirstNEqual(path, prop.path, path.length) && source.hasOwnProperty(prop.path[path.length])) {
|
|
65
65
|
const endProp = prop.path[path.length]
|
|
66
|
-
if (
|
|
67
|
-
result[endProp] = source[endProp]
|
|
68
|
-
} else if (Array.isArray(source[endProp])) {
|
|
66
|
+
if (Array.isArray(source[endProp])) {
|
|
69
67
|
result[endProp] = []
|
|
70
68
|
for (const key in source[endProp]) {
|
|
71
69
|
result[endProp].push(project(source[endProp][key], filters, [...path, endProp, key]))
|