ekms 8.0.0-beta.7 → 8.0.0-beta.71
Sign up to get free protection for your applications and to get access to all the features.
- package/common/animals.instance.json +2871 -1379
- package/common/animals.js +17 -20
- package/common/articles.js +103 -0
- package/common/articles.test.json +310 -0
- package/common/avatar.js +5 -9
- package/common/characters.js +22 -28
- package/common/colors.instance.json +7170 -3657
- package/common/colors.js +4 -8
- package/common/colors.test.json +345 -780
- package/common/comparable.instance.json +1750 -0
- package/common/comparable.js +36 -28
- package/common/comparable.test.json +438 -2
- package/common/concept.js +120 -118
- package/common/countable.js +19 -13
- package/common/countable.test.json +1050 -0
- package/common/crew.instance.json +13066 -6469
- package/common/crew.js +36 -41
- package/common/crew.test.json +714 -452
- package/common/currency.js +27 -45
- package/common/dialogues.js +161 -285
- package/common/dimension.instance.json +474 -253
- package/common/dimension.js +16 -22
- package/common/dimension.test.json +446 -1640
- package/common/edible.instance.json +20053 -10093
- package/common/edible.js +3 -8
- package/common/emotions.instance.json +147 -69
- package/common/emotions.js +35 -38
- package/common/evaluate.instance.json +2 -0
- package/common/evaluate.js +49 -0
- package/common/evaluate.test.json +574 -0
- package/common/events.js +10 -14
- package/common/fastfood.instance.json +221166 -111223
- package/common/fastfood.js +75 -85
- package/common/fastfood.test.json +268 -90
- package/common/formulas.instance.json +455 -249
- package/common/formulas.js +19 -26
- package/common/gdefaults.js +24 -26
- package/common/help.js +7 -12
- package/common/help.test.json +63 -8
- package/common/helpers/concept.js +10 -7
- package/common/helpers/dialogues.js +2 -3
- package/common/helpers/properties.js +54 -62
- package/common/helpers.js +6 -5
- package/common/hierarchy.js +16 -24
- package/common/javascript.js +11 -18
- package/common/kirk.instance.json +584 -290
- package/common/kirk.js +5 -8
- package/common/length.instance.json +8834 -4757
- package/common/length.js +4 -8
- package/common/listener.js +48 -0
- package/common/listener.test.json +104 -0
- package/common/math.instance.json +425 -1187
- package/common/math.js +16 -20
- package/common/meta.js +23 -47
- package/common/nameable.instance.json +2 -0
- package/common/nameable.js +144 -0
- package/common/nameable.test.json +3191 -0
- package/common/negation.instance.json +2 -0
- package/common/negation.js +38 -0
- package/common/negation.test.json +308 -0
- package/common/numbers.js +27 -31
- package/common/ordering.instance.json +366 -246
- package/common/ordering.js +80 -86
- package/common/people.instance.json +2074 -1022
- package/common/people.js +8 -13
- package/common/percentages.instance.json +2 -0
- package/common/percentages.js +53 -0
- package/common/percentages.test.json +751 -0
- package/common/pipboy.instance.json +11745 -6329
- package/common/pipboy.js +48 -59
- package/common/pokemon.instance.json +4226 -2081
- package/common/pokemon.js +7 -20
- package/common/pos.js +15 -13
- package/common/pressure.instance.json +2208 -1175
- package/common/pressure.js +4 -8
- package/common/properties.instance.json +131 -61
- package/common/properties.js +57 -134
- package/common/punctuation.js +15 -7
- package/common/reports.instance.json +1018 -530
- package/common/reports.js +77 -100
- package/common/reports.test.json +15623 -10458
- package/common/scorekeeper.js +18 -30
- package/common/sdefaults.js +16 -7
- package/common/sizeable.js +6 -10
- package/common/spock.instance.json +584 -290
- package/common/spock.js +5 -8
- package/common/stgame.js +19 -19
- package/common/stm.js +164 -27
- package/common/stm.test.json +1734 -1
- package/common/tell.js +14 -18
- package/common/temperature.instance.json +2271 -1222
- package/common/temperature.js +4 -8
- package/common/tester.js +15 -4
- package/common/testing.js +8 -12
- package/common/time.js +20 -25
- package/common/tokenize.js +5 -6
- package/common/ui.instance.json +459 -240
- package/common/ui.js +16 -22
- package/common/weight.instance.json +7646 -4026
- package/common/weight.js +4 -8
- package/common/yesno.js +5 -5
- package/main.js +14 -2
- package/package.json +28 -5
package/common/reports.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
const {
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
2
|
const { defaultContextCheck } = require('./helpers')
|
3
3
|
const currencyKM = require('./currency.js')
|
4
4
|
const events = require('./events.js')
|
@@ -38,7 +38,7 @@ const compareValue = (property, v1, v2) => {
|
|
38
38
|
const newReport = ({km, objects}) => {
|
39
39
|
objects.tempReportId += 1
|
40
40
|
const reportId = `tempReport${objects.tempReportId}`
|
41
|
-
km('stm').api.mentioned({ marker: "report", text: reportId, types: [ "report" ], value: reportId, word: reportId })
|
41
|
+
km('stm').api.mentioned({ context: { marker: "report", text: reportId, types: [ "report" ], value: reportId, word: reportId } })
|
42
42
|
// name to listing
|
43
43
|
objects.listings[reportId] = {
|
44
44
|
columns: ['name', 'supplier'],
|
@@ -100,7 +100,7 @@ const apiTemplate = (marker, testData) => {
|
|
100
100
|
},
|
101
101
|
productGenerator: {
|
102
102
|
match: ({context}) => context.marker == marker && context.isInstance,
|
103
|
-
apply: ({
|
103
|
+
apply: ({context}) => `${context.name}`,
|
104
104
|
}
|
105
105
|
}
|
106
106
|
}
|
@@ -110,7 +110,7 @@ const apiTemplate = (marker, testData) => {
|
|
110
110
|
const api1 = apiTemplate('models', testData2)
|
111
111
|
const api2 = apiTemplate('clothes', testData)
|
112
112
|
|
113
|
-
let
|
113
|
+
let config = {
|
114
114
|
name: 'reports',
|
115
115
|
operators: [
|
116
116
|
//"(([type]) [([(<less> ([than]))] ([amount]))])",
|
@@ -122,9 +122,9 @@ let configStruct = {
|
|
122
122
|
"(([product]) <(<that> ([cost] ([price])))>)",
|
123
123
|
"([answer] ([with] ([listingType|])))",
|
124
124
|
"([show] (<the> ([property|property,properties])))",
|
125
|
-
"([call] ([report|]) (rest))",
|
126
|
-
"(([property]) <ascending>)",
|
127
|
-
"(([property]) <descending>)",
|
125
|
+
"([call] ([report|]) (rest)*)",
|
126
|
+
// "(([property]) <ascending>)",
|
127
|
+
// "(([property]) <descending>)",
|
128
128
|
"([describe] ([report]))",
|
129
129
|
"([price])",
|
130
130
|
"([quantity])",
|
@@ -190,9 +190,9 @@ let configStruct = {
|
|
190
190
|
bridge: "{ ...next(operator), on: { marker: 'report', pullFromContext: true }, from: after[0], to: after[1] }",
|
191
191
|
directionBridge: "{ ...next(operator), on: { marker: 'report', pullFromContext: true }, directionBridge: true, from: after[0], to: after[1] }",
|
192
192
|
|
193
|
-
generatorp: ({context, gp}) => `move ${gp(context.from)} ${gp(context.to)}`,
|
194
|
-
semantic: ({context, e, objects, kms, insert}) => {
|
195
|
-
const report = e(context.on)
|
193
|
+
generatorp: async ({context, gp}) => `move ${await gp(context.from)} ${await gp(context.to)}`,
|
194
|
+
semantic: async ({context, e, objects, kms, insert}) => {
|
195
|
+
const report = await e(context.on)
|
196
196
|
const id = report.value.value
|
197
197
|
const listing = objects.listings[id]
|
198
198
|
|
@@ -218,9 +218,9 @@ let configStruct = {
|
|
218
218
|
where: where(),
|
219
219
|
id: "remove", level: 0,
|
220
220
|
bridge: "{ ...next(operator), on: { marker: 'report', pullFromContext: true }, removee: after[0] }",
|
221
|
-
generatorp: ({context, gp}) => `remove ${gp(context.removee)}`,
|
222
|
-
semantic: ({context, e, kms, insert, objects}) => {
|
223
|
-
const report = e(context.on)
|
221
|
+
generatorp: async ({context, gp}) => `remove ${await gp(context.removee)}`,
|
222
|
+
semantic: async ({context, e, kms, insert, objects}) => {
|
223
|
+
const report = await e(context.on)
|
224
224
|
const id = report.value.value
|
225
225
|
const listing = objects.listings[id]
|
226
226
|
const column = context.removee.index.value
|
@@ -232,7 +232,7 @@ let configStruct = {
|
|
232
232
|
where: where(),
|
233
233
|
id: "column", level: 0,
|
234
234
|
bridge: "{ ...next(operator), index: after[0] }",
|
235
|
-
generatorp: ({context, gp}) => `column ${gp(context.index)}`,
|
235
|
+
generatorp: async ({context, gp}) => `column ${await gp(context.index)}`,
|
236
236
|
},
|
237
237
|
{ id: "ordering", level: 0, bridge: "{ ...next(operator) }" },
|
238
238
|
{ id: "direction", level: 0, bridge: "{ ...next(operator) }" },
|
@@ -248,10 +248,10 @@ let configStruct = {
|
|
248
248
|
{
|
249
249
|
where: where(),
|
250
250
|
match: ({context}) => context.marker == 'report' && context.describe,
|
251
|
-
apply: ({context, apis,
|
251
|
+
apply: async ({context, apis, gs, objects}) => {
|
252
252
|
const listings = objects.listings[context.value]
|
253
253
|
// {"type":"tables","columns":["name"],"ordering":[]}
|
254
|
-
return `for ${listings.api}, showing the ${wordNumber('property', listings.columns.length > 1)} ${gs(listings.columns, ' ', ' and ')} as ${listings.type}`
|
254
|
+
return `for ${listings.api}, showing the ${wordNumber('property', listings.columns.length > 1)} ${await gs(listings.columns, ' ', ' and ')} as ${listings.type}`
|
255
255
|
}
|
256
256
|
},
|
257
257
|
{
|
@@ -262,8 +262,8 @@ let configStruct = {
|
|
262
262
|
],
|
263
263
|
},
|
264
264
|
|
265
|
-
{ id: "ascending", level: 0, bridge: "{ ...before[0], ordering: 'ascending' }" },
|
266
|
-
{ id: "descending", level: 0, bridge: "{ ...before[0], ordering: 'descending', modifiers: append(['ordering'], before[0].modifiers) }" },
|
265
|
+
// { id: "ascending", level: 0, bridge: "{ ...before[0], ordering: 'ascending' }" },
|
266
|
+
// { id: "descending", level: 0, bridge: "{ ...before[0], ordering: 'descending', modifiers: append(['ordering'], before[0].modifiers) }" },
|
267
267
|
|
268
268
|
{ id: "product", level: 0, bridge: "{ ...next(operator) }" },
|
269
269
|
{ id: "listAction", level: 0, bridge: "{ ...next(operator), what: after[0]}" },
|
@@ -295,10 +295,10 @@ let configStruct = {
|
|
295
295
|
where: where(),
|
296
296
|
id: "describe",
|
297
297
|
level: 0,
|
298
|
-
isA: ['
|
298
|
+
isA: ['verb'],
|
299
299
|
bridge: "{ ...next(operator), report: after[0] }",
|
300
|
-
"generatorp": ({g, context}) => `describe ${g(context.report)}`,
|
301
|
-
"generatorr": ({gp, context, apis, objects, config}) => {
|
300
|
+
"generatorp": async ({g, context}) => `describe ${await g(context.report)}`,
|
301
|
+
"generatorr": async ({gp, context, apis, objects, config}) => {
|
302
302
|
const reports = propertyToArray(context.report)
|
303
303
|
let response = ''
|
304
304
|
for (let report of reports) {
|
@@ -308,11 +308,11 @@ let configStruct = {
|
|
308
308
|
continue
|
309
309
|
}
|
310
310
|
const description = {describe: true, word: reportId, types:["report"], value: reportId, text: reportId, marker: "report"}
|
311
|
-
response += `${reportId}: ${gp(description)}\n`
|
311
|
+
response += `${reportId}: ${await gp(description)}\n`
|
312
312
|
}
|
313
313
|
} else {
|
314
314
|
// response += `${gp(report)}: ${describe(report.value)}\n`
|
315
|
-
response += `${gp(report)}: ${gp({ ...report, describe: true })}\n`
|
315
|
+
response += `${await gp(report)}: ${await gp({ ...report, describe: true })}\n`
|
316
316
|
}
|
317
317
|
}
|
318
318
|
return response
|
@@ -326,35 +326,39 @@ let configStruct = {
|
|
326
326
|
where: where(),
|
327
327
|
id: "call",
|
328
328
|
level: 0,
|
329
|
-
bridge: "{ ...next(operator), namee: after[0], name: after[1] }",
|
330
|
-
generatorp: ({g, context}) => `call ${g(context.namee)} ${
|
331
|
-
semantic: ({
|
332
|
-
const namee = e(context.namee).evalue
|
329
|
+
bridge: "{ ...next(operator), namee: after[0], name: after[1:] }",
|
330
|
+
generatorp: async ({g, gs, context}) => `call ${await g(context.namee)} ${await gs(context.name)}`,
|
331
|
+
semantic: async ({context, objects, e, config, km}) => {
|
332
|
+
const namee = (await e(context.namee)).evalue
|
333
333
|
const id = namee.value
|
334
334
|
const listing = objects.listings[id]
|
335
|
-
const name = context.name.text
|
335
|
+
// const name = context.name.text
|
336
|
+
const name = context.name.map((n) => n.text).join('')
|
336
337
|
objects.listings[name] = {...listing}
|
337
338
|
config.addWord(`${name}`, { id: 'report', initial: `{ value: "${name}" }` })
|
338
339
|
km('stm').api.mentioned({
|
340
|
+
context: {
|
339
341
|
marker: "report",
|
340
342
|
text: name,
|
341
343
|
types: [ "report" ],
|
342
344
|
value: id,
|
343
345
|
word: name
|
344
|
-
}
|
346
|
+
}
|
347
|
+
})
|
345
348
|
}
|
346
349
|
},
|
347
350
|
],
|
348
351
|
hierarchy: [
|
352
|
+
['property', 'comparable'],
|
349
353
|
['ascending', 'ordering'],
|
350
354
|
['descending', 'ordering'],
|
351
355
|
['property', 'theAble'],
|
352
356
|
['column', 'toAble'],
|
353
357
|
['report', 'it'],
|
354
358
|
['report', 'this'],
|
355
|
-
['describe', '
|
356
|
-
['call', '
|
357
|
-
['show', '
|
359
|
+
['describe', 'verb'],
|
360
|
+
['call', 'verb'],
|
361
|
+
['show', 'verb'],
|
358
362
|
['report', 'changeable'],
|
359
363
|
['show', 'action'],
|
360
364
|
['move', 'reportAction'],
|
@@ -375,49 +379,28 @@ let configStruct = {
|
|
375
379
|
"literals": {
|
376
380
|
"tables": [{"id": "listingType", "initial": "{ value: 'tables' }" }],
|
377
381
|
"sentences": [{"id": "listingType", "initial": "{ value: 'sentences' }" }],
|
378
|
-
//"product1": [{"id": "reportObject", "initial": "{ value: 'api1' }" }],
|
379
|
-
//"api2": [{"id": "reportObject", "initial": "{ value: 'api2' }" }],
|
380
|
-
//" ([0-9]+)": [{"id": "amount", "initial": "{ value: int(group[0]) }" }],
|
381
382
|
}
|
382
383
|
},
|
383
384
|
|
384
385
|
priorities: [
|
385
386
|
{ "context": [['ordering', 0], ['articlePOS', 0], ], "choose": [0] },
|
386
|
-
/*
|
387
|
-
[['the', 0], ['ordering', 0]],
|
388
|
-
[['listAction', 0], ['cost', 1]],
|
389
|
-
[['answer', 0], ['listAction', 0], ['the', 0]],
|
390
|
-
[['answer', 0], ['listAction', 0], ['the', 0], ['with', 0]],
|
391
|
-
*/
|
392
387
|
],
|
393
388
|
generators: [
|
394
389
|
{
|
395
390
|
notes: 'paraphrase show',
|
396
391
|
where: where(),
|
397
392
|
match: ({context, objects}) => context.marker == 'show' && context.paraphrase,
|
398
|
-
apply: ({gs,
|
393
|
+
apply: async ({gs, gp, e, apis, objects, context}) => {
|
399
394
|
if (context.report) {
|
400
|
-
return `show ${gp(context.report)}`
|
395
|
+
return `show ${await gp(context.report)}`
|
401
396
|
} else {
|
402
|
-
const report = e(context.on)
|
397
|
+
const report = await e(context.on)
|
403
398
|
const id = report.value.value
|
404
399
|
const listing = objects.listings[id]
|
405
|
-
return `the properties being shown are ${gs(listing.columns, ', ', ' and ')}`
|
400
|
+
return `the properties being shown are ${await gs(listing.columns, ', ', ' and ')}`
|
406
401
|
}
|
407
402
|
}
|
408
403
|
},
|
409
|
-
/*
|
410
|
-
{
|
411
|
-
where: where(),
|
412
|
-
match: ({context, isA}) => isA(context.marker, 'reportAction') && context.on && context.isResponse,
|
413
|
-
apply: ({context, g}) => `${g({...context, on: undefined})} on ${g(context.on)}`
|
414
|
-
},
|
415
|
-
{
|
416
|
-
where: where(),
|
417
|
-
match: ({context, isA}) => isA(context.marker, 'reportAction') && context.on && context.paraphrase,
|
418
|
-
apply: ({context, g}) => `${g({...context, on: undefined})} on ${g(context.on)}`
|
419
|
-
},
|
420
|
-
*/
|
421
404
|
{
|
422
405
|
where: where(),
|
423
406
|
match: ({context}) => context.marker == 'product' && !context.isInstance,
|
@@ -426,12 +409,12 @@ let configStruct = {
|
|
426
409
|
{
|
427
410
|
where: where(),
|
428
411
|
match: ({context}) => context.marker == 'listAction' && context.paraphrase,
|
429
|
-
apply: ({g, context}) => `list ${g(context.what)}`
|
412
|
+
apply: async ({g, context}) => `list ${await g(context.what)}`
|
430
413
|
},
|
431
414
|
{
|
432
415
|
notes: 'show the results as a sentence',
|
433
416
|
where: where(),
|
434
|
-
match: ({context, objects
|
417
|
+
match: ({context, objects}) => {
|
435
418
|
if (!(context.marker == 'listAction' && context.isResponse)) {
|
436
419
|
return false
|
437
420
|
}
|
@@ -439,15 +422,15 @@ let configStruct = {
|
|
439
422
|
return true
|
440
423
|
}
|
441
424
|
},
|
442
|
-
apply: ({g, gs, context, objects}) => {
|
425
|
+
apply: async ({g, gs, context, objects}) => {
|
443
426
|
const listing = objects.listings[context.id]
|
444
|
-
return `the ${g(listing.api)} are ${gs(context.listing, ' ', ' and ')}`
|
427
|
+
return `the ${await g(listing.api)} are ${await gs(context.listing, ' ', ' and ')}`
|
445
428
|
}
|
446
429
|
},
|
447
430
|
{
|
448
431
|
notes: 'show the results as a table',
|
449
432
|
where: where(),
|
450
|
-
match: ({context, objects
|
433
|
+
match: ({context, objects}) => {
|
451
434
|
if (!(context.marker == 'listAction' && context.isResponse && !context.paraphrase)) {
|
452
435
|
return false
|
453
436
|
}
|
@@ -455,7 +438,7 @@ let configStruct = {
|
|
455
438
|
return true
|
456
439
|
}
|
457
440
|
},
|
458
|
-
apply: ({
|
441
|
+
apply: async ({objects, context, e, kms}) => {
|
459
442
|
let report = '';
|
460
443
|
const products = context.listing
|
461
444
|
const columns = objects.listings[context.id].columns
|
@@ -463,21 +446,21 @@ let configStruct = {
|
|
463
446
|
kms.stm.api.setVariable('price', { marker: 'price', value: 23 })
|
464
447
|
kms.stm.api.setVariable('quantity', { marker: 'quantity', value: 3 })
|
465
448
|
const c1 = { marker: 'worth', value: 'worth' }
|
466
|
-
r1 = toEValue(e(c1));
|
467
|
-
r2 = e({ marker: 'supplier', value: 'supplier' })
|
468
|
-
// api.listing.api = context.what.api
|
449
|
+
r1 = toEValue(await e(c1));
|
450
|
+
r2 = await e({ marker: 'supplier', value: 'supplier' })
|
469
451
|
}
|
470
|
-
const data =
|
452
|
+
const data = []
|
453
|
+
for (const product of products) {
|
471
454
|
const row = []
|
472
455
|
for (let p of Object.keys(product)) {
|
473
456
|
kms.stm.api.setVariable(p, { marker: p, value: product[p] })
|
474
457
|
}
|
475
458
|
for (let property of columns) {
|
476
|
-
const value = toEValue(e({ marker: property, value: property }));
|
459
|
+
const value = toEValue(await e({ marker: property, value: property }));
|
477
460
|
row.push(value)
|
478
461
|
}
|
479
|
-
|
480
|
-
}
|
462
|
+
data.push(row)
|
463
|
+
};
|
481
464
|
report += table([columns].concat(data))
|
482
465
|
return report
|
483
466
|
}
|
@@ -485,12 +468,12 @@ let configStruct = {
|
|
485
468
|
{
|
486
469
|
where: where(),
|
487
470
|
match: ({context}) => context.marker == 'answer' && context.paraphrase,
|
488
|
-
apply: ({
|
471
|
+
apply: ({context}) => `answer with ${context.type}`
|
489
472
|
},
|
490
473
|
{
|
491
474
|
where: where(),
|
492
475
|
match: ({context}) => context.marker == 'answer' && !context.paraphrase,
|
493
|
-
apply: ({
|
476
|
+
apply: ({context}) => `answering with ${context.type}`
|
494
477
|
},
|
495
478
|
],
|
496
479
|
|
@@ -499,13 +482,13 @@ let configStruct = {
|
|
499
482
|
where: where(),
|
500
483
|
notes: 'handle show semantic',
|
501
484
|
match: ({context}) => context.marker == 'show',
|
502
|
-
apply: ({context, e, km, kms, apis, insert, config, objects}) => {
|
485
|
+
apply: async ({context, e, km, kms, apis, insert, config, objects}) => {
|
503
486
|
if (context.report) {
|
504
487
|
const values = propertyToArray(context.report)
|
505
488
|
const responses = []
|
506
489
|
for (let value of values) {
|
507
490
|
if (!value.value || value.pullFromContext) {
|
508
|
-
value = e(value)
|
491
|
+
value = await e(value)
|
509
492
|
}
|
510
493
|
let id = value.value
|
511
494
|
if (value.evalue) {
|
@@ -528,7 +511,7 @@ let configStruct = {
|
|
528
511
|
}
|
529
512
|
context.isResponse = true
|
530
513
|
} else {
|
531
|
-
const report = e(context.on)
|
514
|
+
const report = await e(context.on)
|
532
515
|
const id = report.value.value
|
533
516
|
const listing = objects.listings[id]
|
534
517
|
const values = propertyToArray(context.properties)
|
@@ -551,11 +534,11 @@ let configStruct = {
|
|
551
534
|
notes: 'get the report data',
|
552
535
|
where: where(),
|
553
536
|
match: ({context}) => context.marker == 'listAction',
|
554
|
-
apply: ({context, e, objects, apis, km, config}) => {
|
537
|
+
apply: async ({context, e, objects, apis, km, config}) => {
|
555
538
|
//const name = '***current***'
|
556
539
|
if (context.api) {
|
557
540
|
// id = newReport({km, objects})
|
558
|
-
const report = e({ marker: 'report', pullFromContext: true })
|
541
|
+
const report = await e({ marker: 'report', pullFromContext: true })
|
559
542
|
const id = report.value.value
|
560
543
|
const listing = objects.listings[id]
|
561
544
|
listing.api = context.api
|
@@ -563,7 +546,7 @@ let configStruct = {
|
|
563
546
|
context.id = id
|
564
547
|
context.listing = apis[listing.api].getAllProducts(listing)
|
565
548
|
} else {
|
566
|
-
const report = e({ marker: 'report', pullFromContext: true })
|
549
|
+
const report = await e({ marker: 'report', pullFromContext: true })
|
567
550
|
const id = report.evalue.value
|
568
551
|
const listing = objects.listings[id]
|
569
552
|
const api = apis[listing.api]
|
@@ -573,20 +556,20 @@ let configStruct = {
|
|
573
556
|
context.isResponse = true
|
574
557
|
},
|
575
558
|
},
|
576
|
-
|
577
|
-
({context}) => context.marker == 'answer',
|
578
|
-
({e, context, objects, kms, insert}) => {
|
579
|
-
const report = e({ marker: 'report', pullFromContext: true })
|
559
|
+
{
|
560
|
+
match: ({context}) => context.marker == 'answer',
|
561
|
+
apply: async ({e, context, objects, kms, insert}) => {
|
562
|
+
const report = await e({ marker: 'report', pullFromContext: true })
|
580
563
|
const id = report.value.value
|
581
564
|
const listing = objects.listings[id]
|
582
565
|
listing.type = context.type
|
583
566
|
kms.events.api.happens(insert, { marker: "changes", level: 1, changeable: { marker: 'report', pullFromContext: true } })
|
584
567
|
}
|
585
|
-
|
568
|
+
},
|
586
569
|
],
|
587
570
|
};
|
588
571
|
|
589
|
-
const initializeApi = (config, api
|
572
|
+
const initializeApi = (config, api) => {
|
590
573
|
const type = api.getName();
|
591
574
|
config.addWord(type, {"id": "product", "initial": "{ value: '" + type + `', api: '${type}'}` })
|
592
575
|
/*
|
@@ -604,18 +587,11 @@ const initializeApi = (config, api, km) => {
|
|
604
587
|
// config.addWord(type, {"id": "report", "initial": `${open} value: '${type}' ${close}` })
|
605
588
|
}
|
606
589
|
|
607
|
-
const
|
608
|
-
const config = new Config(configStruct, module)
|
609
|
-
config.stop_auto_rebuild()
|
610
|
-
config.add(currencyKM(), helpKM(), math(), events())
|
611
|
-
config.multiApi = initializeApi
|
612
|
-
// mode this to non-module init only
|
613
|
-
config.initializer(({config, objects, km, isModule}) => {
|
590
|
+
const initializer = async ({config, objects, km, kms, isModule}) => {
|
614
591
|
if (!isModule) {
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
// config.addAPI(api2)
|
592
|
+
debugger
|
593
|
+
await kms.reports.addAPI(api1)
|
594
|
+
await kms.reports.addAPI(api2)
|
619
595
|
}
|
620
596
|
objects.tempReportId = 0
|
621
597
|
objects.listings = {
|
@@ -624,15 +600,16 @@ const createConfig = () => {
|
|
624
600
|
if (!isModule) {
|
625
601
|
objects.listings[id].api = 'clothes'
|
626
602
|
}
|
627
|
-
}
|
628
|
-
config.restart_auto_rebuild()
|
629
|
-
return config
|
630
|
-
}
|
603
|
+
}
|
631
604
|
|
632
605
|
knowledgeModule({
|
606
|
+
config,
|
607
|
+
includes: [currencyKM, helpKM, math, events],
|
608
|
+
multiApiInitializer: initializeApi,
|
609
|
+
initializer,
|
610
|
+
|
633
611
|
module,
|
634
612
|
description: 'this module is for getting info about a concept with properties',
|
635
|
-
createConfig,
|
636
613
|
test: {
|
637
614
|
name: './reports.test.json',
|
638
615
|
contents: reports_tests,
|