theprogrammablemind 7.4.3 → 7.5.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 +4 -4
- package/package.json +1 -1
- package/src/config.js +12 -3
- package/src/generators.js +4 -2
- package/src/semantics.js +4 -2
package/client.js
CHANGED
@@ -1254,7 +1254,7 @@ const knowledgeModule = async ({
|
|
1254
1254
|
parser.add_argument('-q', '--query', { help: 'Run the specified query' })
|
1255
1255
|
parser.add_argument('-ip ', '--server', { help: 'Server to run against' })
|
1256
1256
|
parser.add_argument('-qp ', '--queryParams', { help: 'Query params for the server call' })
|
1257
|
-
parser.add_argument('-
|
1257
|
+
parser.add_argument('-td', '--testDelete', { help: 'Delete the specified query from the tests file.' })
|
1258
1258
|
parser.add_argument('-c', '--clean', { help: 'Remove data from the test files. a === association' })
|
1259
1259
|
parser.add_argument('-od', '--objectDiff', { action: 'store_true', help: 'When showing the objects use a colour diff' })
|
1260
1260
|
parser.add_argument('-daa', '--dontAddAssociations', { action: 'store_true', help: 'Do not add associations from the tests.' })
|
@@ -1293,11 +1293,11 @@ const knowledgeModule = async ({
|
|
1293
1293
|
return
|
1294
1294
|
}
|
1295
1295
|
|
1296
|
-
if (args.
|
1296
|
+
if (args.testDelete) {
|
1297
1297
|
let tests = JSON.parse(runtime.fs.readFileSync(testConfig.name))
|
1298
|
-
tests = tests.filter( (test) => test.query !== args.
|
1298
|
+
tests = tests.filter( (test) => test.query !== args.testDelete );
|
1299
1299
|
writeTestFile(testConfig.name, tests)
|
1300
|
-
console.log(`Remove the test for "${args.
|
1300
|
+
console.log(`Remove the test for "${args.testDelete}"`)
|
1301
1301
|
return
|
1302
1302
|
}
|
1303
1303
|
|
package/package.json
CHANGED
package/src/config.js
CHANGED
@@ -412,11 +412,11 @@ class Config {
|
|
412
412
|
}
|
413
413
|
|
414
414
|
getSemantics (logs = []) {
|
415
|
-
return new Semantics(this.config.semantics || [], logs)
|
415
|
+
return new Semantics(this.config.semantics || [], logs, { km: this.name })
|
416
416
|
}
|
417
417
|
|
418
418
|
getGenerators (logs = []) {
|
419
|
-
return new Generators(this.config.generators || [], logs)
|
419
|
+
return new Generators(this.config.generators || [], logs, { km: this.name })
|
420
420
|
}
|
421
421
|
|
422
422
|
warningNotEvaluated (log, value) {
|
@@ -1063,6 +1063,15 @@ class Config {
|
|
1063
1063
|
// this.config.words = {}
|
1064
1064
|
}
|
1065
1065
|
for (let bridge of (this.config.bridges || [])) {
|
1066
|
+
const valid = [ 'before', 'bridge', 'development', 'evaluator', 'generatorp', 'generatorr', 'generators', 'hierarchy', 'id', 'inverted', 'isA',
|
1067
|
+
'level', 'optional', 'selector', 'semantic', 'uuid', 'words' ]
|
1068
|
+
for (let prop of Object.keys(bridge)) {
|
1069
|
+
if (!valid.includes(prop)) {
|
1070
|
+
if (!prop.endsWith("Bridge")) {
|
1071
|
+
throw `Unknown property "${prop}" in the bridge. Valid properties are ${valid}. The bridge is ${JSON.stringify(bridge)}`
|
1072
|
+
}
|
1073
|
+
}
|
1074
|
+
}
|
1066
1075
|
/*
|
1067
1076
|
if (bridge.generator) {
|
1068
1077
|
this.config.generators.push({
|
@@ -1084,7 +1093,7 @@ class Config {
|
|
1084
1093
|
if (bridge.words) {
|
1085
1094
|
for (let def of bridge.words) {
|
1086
1095
|
if (typeof def == 'string') {
|
1087
|
-
this.addWordInternal(def, {"id": bridge.id, "initial": "{}" })
|
1096
|
+
this.addWordInternal(def, {"id": bridge.id, "initial": `{ value: "${def}"}` })
|
1088
1097
|
} else {
|
1089
1098
|
const word = def.word
|
1090
1099
|
def = { initial: JSON.stringify(def), id: bridge.id, word: undefined }
|
package/src/generators.js
CHANGED
@@ -124,12 +124,14 @@ class Generator {
|
|
124
124
|
}
|
125
125
|
|
126
126
|
class Generators {
|
127
|
-
constructor (generators, logs = []) {
|
127
|
+
constructor (generators, logs = [], options = {}) {
|
128
|
+
let index = -1
|
128
129
|
generators = (generators || []).map((generator) => {
|
129
130
|
if (generator instanceof Generator) {
|
130
131
|
return generator
|
131
132
|
} else {
|
132
|
-
|
133
|
+
index += 1
|
134
|
+
return new Generator({ km: options.km, index, ...normalizeGenerator(generator) })
|
133
135
|
}
|
134
136
|
})
|
135
137
|
this.defaults = []
|
package/src/semantics.js
CHANGED
@@ -115,12 +115,14 @@ class Semantic {
|
|
115
115
|
}
|
116
116
|
|
117
117
|
class Semantics {
|
118
|
-
constructor (semantics, logs = []) {
|
118
|
+
constructor (semantics, logs = [], options = {}) {
|
119
|
+
let index = -1
|
119
120
|
semantics = semantics.map((semantic) => {
|
120
121
|
if (semantic instanceof Semantic) {
|
121
122
|
return semantic
|
122
123
|
} else {
|
123
|
-
|
124
|
+
index += 1
|
125
|
+
return new Semantic({ km: options.km, index, ...normalizeSemantic(semantic) })
|
124
126
|
}
|
125
127
|
})
|
126
128
|
|