ekms 8.0.0 → 8.1.0-beta.1
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/common/animals.instance.json +3055 -1651
- package/common/animals.js +17 -20
- package/common/articles.js +103 -0
- package/common/articles.test.json +310 -0
- package/common/asking.instance.json +2 -0
- package/common/asking.js +253 -0
- package/common/asking.test.json +2290 -0
- package/common/avatar.js +6 -10
- package/common/characters.js +23 -30
- package/common/colors.instance.json +25666 -0
- package/common/colors.js +67 -0
- package/common/colors.test.json +4425 -0
- package/common/comparable.instance.json +1750 -0
- package/common/comparable.js +36 -28
- package/common/comparable.test.json +1196 -2
- package/common/concept.js +121 -119
- package/common/concept.test.json +688 -0
- package/common/conjunction.instance.json +2 -0
- package/common/conjunction.js +104 -0
- package/common/conjunction.test.json +322 -0
- package/common/countable.js +20 -14
- package/common/countable.test.json +1050 -0
- package/common/crew.instance.json +16432 -9850
- package/common/crew.js +39 -42
- package/common/crew.test.json +714 -452
- package/common/currency.js +28 -46
- package/common/dialogues.js +187 -429
- package/common/dialogues.test.json +684 -450
- package/common/dimension.instance.json +517 -289
- package/common/dimension.js +22 -24
- package/common/dimension.test.json +727 -1944
- package/common/edible.instance.json +20506 -10664
- package/common/edible.js +4 -9
- package/common/emotions.instance.json +195 -123
- package/common/emotions.js +36 -39
- package/common/evaluate.instance.json +2 -0
- package/common/evaluate.js +53 -0
- package/common/evaluate.test.json +574 -0
- package/common/events.js +11 -15
- package/common/fastfood.instance.json +223185 -113172
- package/common/fastfood.js +77 -87
- package/common/fastfood.test.json +8205 -3733
- package/common/formulas.instance.json +444 -244
- package/common/formulas.js +20 -27
- package/common/formulas.test.json +1027 -955
- package/common/gdefaults.js +45 -32
- package/common/help.js +9 -14
- package/common/help.test.json +71 -18
- package/common/helpers/concept.js +37 -10
- package/common/helpers/dialogues.js +22 -4
- package/common/helpers/formulas.js +0 -14
- package/common/helpers/meta.js +0 -1
- package/common/helpers/properties.js +92 -84
- package/common/helpers.js +35 -24
- package/common/hierarchy.js +18 -25
- package/common/javascript.js +12 -19
- package/common/kirk.instance.json +583 -300
- package/common/kirk.js +6 -9
- package/common/length.instance.json +8995 -4964
- package/common/length.js +5 -9
- package/common/listener.js +48 -0
- package/common/listener.test.json +104 -0
- package/common/math.instance.json +409 -1202
- package/common/math.js +17 -21
- package/common/meta.js +24 -50
- 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 +28 -32
- package/common/ordering.instance.json +459 -274
- package/common/ordering.js +81 -87
- package/common/ordinals.instance.json +2 -0
- package/common/ordinals.js +61 -0
- package/common/ordinals.test.json +412 -0
- package/common/people.instance.json +2138 -1321
- package/common/people.js +9 -14
- package/common/people.test.json +1815 -1073
- 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 +12261 -6898
- package/common/pipboy.js +53 -62
- package/common/pipboy.test.json +2835 -0
- package/common/pokemon.instance.json +4432 -2351
- package/common/pokemon.js +8 -21
- package/common/pos.js +16 -14
- package/common/pressure.instance.json +2311 -1303
- package/common/pressure.js +5 -9
- package/common/properties.instance.json +151 -87
- package/common/properties.js +164 -167
- package/common/properties.test.json +17605 -4030
- package/common/punctuation.js +24 -8
- package/common/punctuation.test.json +233 -5
- package/common/reports.instance.json +1037 -551
- package/common/reports.js +77 -103
- package/common/reports.test.json +15623 -10458
- package/common/scorekeeper.js +19 -31
- package/common/sdefaults.js +17 -8
- package/common/sizeable.js +13 -12
- package/common/spock.instance.json +582 -299
- package/common/spock.js +6 -9
- package/common/stgame.js +20 -20
- package/common/stm.js +182 -29
- package/common/stm.test.json +1734 -1
- package/common/tell.js +15 -19
- package/common/temperature.instance.json +2379 -1355
- package/common/temperature.js +5 -9
- package/common/tester.js +15 -4
- package/common/testing.js +8 -13
- package/common/time.js +21 -26
- package/common/tokenize.js +8 -8
- package/common/tokenize.test.json +86 -1
- package/common/ui.instance.json +151 -460
- package/common/ui.js +22 -34
- package/common/ui.test.json +641 -5357
- package/common/weight.instance.json +7957 -4350
- package/common/weight.js +5 -9
- package/common/weight.test.json +242 -238
- package/common/yesno.js +6 -6
- package/main.js +68 -45
- package/package.json +44 -6
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,30 +438,29 @@ 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
|
462
445
|
if (false) {
|
463
|
-
debugger;
|
464
446
|
kms.stm.api.setVariable('price', { marker: 'price', value: 23 })
|
465
447
|
kms.stm.api.setVariable('quantity', { marker: 'quantity', value: 3 })
|
466
448
|
const c1 = { marker: 'worth', value: 'worth' }
|
467
|
-
r1 = toEValue(e(c1));
|
468
|
-
r2 = e({ marker: 'supplier', value: 'supplier' })
|
469
|
-
// api.listing.api = context.what.api
|
449
|
+
r1 = toEValue(await e(c1));
|
450
|
+
r2 = await e({ marker: 'supplier', value: 'supplier' })
|
470
451
|
}
|
471
|
-
const data =
|
452
|
+
const data = []
|
453
|
+
for (const product of products) {
|
472
454
|
const row = []
|
473
455
|
for (let p of Object.keys(product)) {
|
474
456
|
kms.stm.api.setVariable(p, { marker: p, value: product[p] })
|
475
457
|
}
|
476
458
|
for (let property of columns) {
|
477
|
-
const value = toEValue(e({ marker: property, value: property }));
|
459
|
+
const value = toEValue(await e({ marker: property, value: property }));
|
478
460
|
row.push(value)
|
479
461
|
}
|
480
|
-
|
481
|
-
}
|
462
|
+
data.push(row)
|
463
|
+
};
|
482
464
|
report += table([columns].concat(data))
|
483
465
|
return report
|
484
466
|
}
|
@@ -486,12 +468,12 @@ let configStruct = {
|
|
486
468
|
{
|
487
469
|
where: where(),
|
488
470
|
match: ({context}) => context.marker == 'answer' && context.paraphrase,
|
489
|
-
apply: ({
|
471
|
+
apply: ({context}) => `answer with ${context.type}`
|
490
472
|
},
|
491
473
|
{
|
492
474
|
where: where(),
|
493
475
|
match: ({context}) => context.marker == 'answer' && !context.paraphrase,
|
494
|
-
apply: ({
|
476
|
+
apply: ({context}) => `answering with ${context.type}`
|
495
477
|
},
|
496
478
|
],
|
497
479
|
|
@@ -500,14 +482,13 @@ let configStruct = {
|
|
500
482
|
where: where(),
|
501
483
|
notes: 'handle show semantic',
|
502
484
|
match: ({context}) => context.marker == 'show',
|
503
|
-
apply: ({context, e, km, kms, apis, insert, config, objects}) => {
|
485
|
+
apply: async ({context, e, km, kms, apis, insert, config, objects}) => {
|
504
486
|
if (context.report) {
|
505
487
|
const values = propertyToArray(context.report)
|
506
488
|
const responses = []
|
507
489
|
for (let value of values) {
|
508
490
|
if (!value.value || value.pullFromContext) {
|
509
|
-
|
510
|
-
value = e(value)
|
491
|
+
value = await e(value)
|
511
492
|
}
|
512
493
|
let id = value.value
|
513
494
|
if (value.evalue) {
|
@@ -530,7 +511,7 @@ let configStruct = {
|
|
530
511
|
}
|
531
512
|
context.isResponse = true
|
532
513
|
} else {
|
533
|
-
const report = e(context.on)
|
514
|
+
const report = await e(context.on)
|
534
515
|
const id = report.value.value
|
535
516
|
const listing = objects.listings[id]
|
536
517
|
const values = propertyToArray(context.properties)
|
@@ -553,11 +534,11 @@ let configStruct = {
|
|
553
534
|
notes: 'get the report data',
|
554
535
|
where: where(),
|
555
536
|
match: ({context}) => context.marker == 'listAction',
|
556
|
-
apply: ({context, e, objects, apis, km, config}) => {
|
537
|
+
apply: async ({context, e, objects, apis, km, config}) => {
|
557
538
|
//const name = '***current***'
|
558
539
|
if (context.api) {
|
559
540
|
// id = newReport({km, objects})
|
560
|
-
const report = e({ marker: 'report', pullFromContext: true })
|
541
|
+
const report = await e({ marker: 'report', pullFromContext: true })
|
561
542
|
const id = report.value.value
|
562
543
|
const listing = objects.listings[id]
|
563
544
|
listing.api = context.api
|
@@ -565,7 +546,7 @@ let configStruct = {
|
|
565
546
|
context.id = id
|
566
547
|
context.listing = apis[listing.api].getAllProducts(listing)
|
567
548
|
} else {
|
568
|
-
const report = e({ marker: 'report', pullFromContext: true })
|
549
|
+
const report = await e({ marker: 'report', pullFromContext: true })
|
569
550
|
const id = report.evalue.value
|
570
551
|
const listing = objects.listings[id]
|
571
552
|
const api = apis[listing.api]
|
@@ -575,20 +556,20 @@ let configStruct = {
|
|
575
556
|
context.isResponse = true
|
576
557
|
},
|
577
558
|
},
|
578
|
-
|
579
|
-
({context}) => context.marker == 'answer',
|
580
|
-
({e, context, objects, kms, insert}) => {
|
581
|
-
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 })
|
582
563
|
const id = report.value.value
|
583
564
|
const listing = objects.listings[id]
|
584
565
|
listing.type = context.type
|
585
566
|
kms.events.api.happens(insert, { marker: "changes", level: 1, changeable: { marker: 'report', pullFromContext: true } })
|
586
567
|
}
|
587
|
-
|
568
|
+
},
|
588
569
|
],
|
589
570
|
};
|
590
571
|
|
591
|
-
const initializeApi = (config, api
|
572
|
+
const initializeApi = (config, api) => {
|
592
573
|
const type = api.getName();
|
593
574
|
config.addWord(type, {"id": "product", "initial": "{ value: '" + type + `', api: '${type}'}` })
|
594
575
|
/*
|
@@ -606,18 +587,10 @@ const initializeApi = (config, api, km) => {
|
|
606
587
|
// config.addWord(type, {"id": "report", "initial": `${open} value: '${type}' ${close}` })
|
607
588
|
}
|
608
589
|
|
609
|
-
const
|
610
|
-
const config = new Config(configStruct, module)
|
611
|
-
config.stop_auto_rebuild()
|
612
|
-
config.add(currencyKM(), helpKM(), math(), events())
|
613
|
-
config.multiApi = initializeApi
|
614
|
-
// mode this to non-module init only
|
615
|
-
config.initializer(({config, objects, km, isModule}) => {
|
590
|
+
const initializer = async ({config, objects, km, kms, isModule}) => {
|
616
591
|
if (!isModule) {
|
617
|
-
|
618
|
-
|
619
|
-
// config.addAPI(api1)
|
620
|
-
// config.addAPI(api2)
|
592
|
+
await kms.reports.addAPI(api1)
|
593
|
+
await kms.reports.addAPI(api2)
|
621
594
|
}
|
622
595
|
objects.tempReportId = 0
|
623
596
|
objects.listings = {
|
@@ -626,20 +599,21 @@ const createConfig = () => {
|
|
626
599
|
if (!isModule) {
|
627
600
|
objects.listings[id].api = 'clothes'
|
628
601
|
}
|
629
|
-
}
|
630
|
-
config.restart_auto_rebuild()
|
631
|
-
return config
|
632
|
-
}
|
602
|
+
}
|
633
603
|
|
634
604
|
knowledgeModule({
|
605
|
+
config,
|
606
|
+
includes: [currencyKM, helpKM, math, events],
|
607
|
+
multiApiInitializer: initializeApi,
|
608
|
+
initializer,
|
609
|
+
|
635
610
|
module,
|
636
611
|
description: 'this module is for getting info about a concept with properties',
|
637
|
-
createConfig,
|
638
612
|
test: {
|
639
613
|
name: './reports.test.json',
|
640
614
|
contents: reports_tests,
|
641
615
|
checks: {
|
642
|
-
context: defaultContextCheck,
|
616
|
+
context: defaultContextCheck(),
|
643
617
|
},
|
644
618
|
},
|
645
619
|
template: {
|