ekms 8.0.0-beta.20 → 8.0.0-beta.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. package/common/animals.instance.json +0 -88
  2. package/common/animals.js +2 -2
  3. package/common/avatar.js +2 -2
  4. package/common/characters.js +12 -16
  5. package/common/colors.instance.json +0 -344
  6. package/common/colors.js +2 -2
  7. package/common/comparable.js +2 -15
  8. package/common/concept.js +13 -10
  9. package/common/countable.js +5 -5
  10. package/common/crew.instance.json +0 -416
  11. package/common/crew.js +4 -4
  12. package/common/currency.js +7 -7
  13. package/common/dialogues.js +52 -121
  14. package/common/dimension.instance.json +4 -4
  15. package/common/dimension.js +12 -12
  16. package/common/dimension.test.json +242 -1248
  17. package/common/edible.instance.json +30 -134
  18. package/common/edible.js +2 -2
  19. package/common/emotions.instance.json +0 -60
  20. package/common/emotions.js +4 -4
  21. package/common/events.js +6 -6
  22. package/common/fastfood.instance.json +929 -1408
  23. package/common/fastfood.js +24 -24
  24. package/common/formulas.instance.json +6 -6
  25. package/common/formulas.js +12 -12
  26. package/common/gdefaults.js +13 -13
  27. package/common/help.js +4 -4
  28. package/common/helpers/concept.js +0 -1
  29. package/common/helpers/dialogues.js +2 -3
  30. package/common/helpers/properties.js +48 -58
  31. package/common/hierarchy.js +12 -16
  32. package/common/javascript.js +8 -8
  33. package/common/kirk.js +2 -2
  34. package/common/length.instance.json +0 -60
  35. package/common/length.js +2 -2
  36. package/common/math.instance.json +12 -12
  37. package/common/math.js +7 -7
  38. package/common/meta.js +22 -29
  39. package/common/negation.js +1 -1
  40. package/common/numbers.js +2 -2
  41. package/common/ordering.js +5 -5
  42. package/common/people.js +4 -5
  43. package/common/percentages.js +4 -4
  44. package/common/pipboy.instance.json +30 -154
  45. package/common/pipboy.js +29 -32
  46. package/common/pokemon.instance.json +0 -44
  47. package/common/pokemon.js +4 -4
  48. package/common/pos.js +1 -1
  49. package/common/pressure.js +2 -2
  50. package/common/properties.js +52 -125
  51. package/common/punctuation.js +2 -2
  52. package/common/reports.instance.json +1 -1
  53. package/common/reports.js +59 -76
  54. package/common/scorekeeper.js +13 -21
  55. package/common/sdefaults.js +5 -5
  56. package/common/sizeable.js +2 -2
  57. package/common/spock.js +2 -2
  58. package/common/stgame.js +13 -9
  59. package/common/stm.js +4 -4
  60. package/common/tell.js +10 -10
  61. package/common/temperature.instance.json +0 -60
  62. package/common/temperature.js +2 -2
  63. package/common/tester.js +2 -2
  64. package/common/testing.js +5 -5
  65. package/common/time.js +7 -7
  66. package/common/tokenize.js +1 -1
  67. package/common/ui.js +9 -9
  68. package/common/weight.js +2 -2
  69. package/common/yesno.js +1 -1
  70. package/package.json +2 -2
@@ -5555,28 +5555,6 @@
5555
5555
  1
5556
5556
  ]
5557
5557
  ],
5558
- [
5559
- [
5560
- "is",
5561
- 0
5562
- ],
5563
- [
5564
- "list",
5565
- 0
5566
- ],
5567
- [
5568
- "mammal",
5569
- 0
5570
- ],
5571
- [
5572
- "unknown",
5573
- 0
5574
- ],
5575
- [
5576
- "unknown",
5577
- 1
5578
- ]
5579
- ],
5580
5558
  [
5581
5559
  [
5582
5560
  "is",
@@ -6601,28 +6579,6 @@
6601
6579
  1
6602
6580
  ]
6603
6581
  ],
6604
- [
6605
- [
6606
- "bird",
6607
- 0
6608
- ],
6609
- [
6610
- "is",
6611
- 0
6612
- ],
6613
- [
6614
- "list",
6615
- 0
6616
- ],
6617
- [
6618
- "unknown",
6619
- 0
6620
- ],
6621
- [
6622
- "unknown",
6623
- 1
6624
- ]
6625
- ],
6626
6582
  [
6627
6583
  [
6628
6584
  "bird",
@@ -9873,28 +9829,6 @@
9873
9829
  1
9874
9830
  ]
9875
9831
  ],
9876
- [
9877
- [
9878
- "bird",
9879
- 0
9880
- ],
9881
- [
9882
- "is",
9883
- 0
9884
- ],
9885
- [
9886
- "list",
9887
- 0
9888
- ],
9889
- [
9890
- "unknown",
9891
- 0
9892
- ],
9893
- [
9894
- "unknown",
9895
- 1
9896
- ]
9897
- ],
9898
9832
  [
9899
9833
  [
9900
9834
  "bird",
@@ -10271,28 +10205,6 @@
10271
10205
  1
10272
10206
  ]
10273
10207
  ],
10274
- [
10275
- [
10276
- "is",
10277
- 0
10278
- ],
10279
- [
10280
- "list",
10281
- 0
10282
- ],
10283
- [
10284
- "mammal",
10285
- 0
10286
- ],
10287
- [
10288
- "unknown",
10289
- 0
10290
- ],
10291
- [
10292
- "unknown",
10293
- 1
10294
- ]
10295
- ],
10296
10208
  [
10297
10209
  [
10298
10210
  "is",
package/common/animals.js CHANGED
@@ -25,9 +25,9 @@ const template = {
25
25
  ],
26
26
  }
27
27
 
28
- const createConfig = () => {
28
+ const createConfig = async () => {
29
29
  const config = new Config({ name: 'animals' }, module)
30
- config.add(hierarchy())
30
+ await config.add(hierarchy)
31
31
  return config
32
32
  }
33
33
 
package/common/avatar.js CHANGED
@@ -68,9 +68,9 @@ let configStruct = {
68
68
 
69
69
  };
70
70
 
71
- const createConfig = () => {
71
+ const createConfig = async () => {
72
72
  const config = new Config(configStruct, module)
73
- config.add(hierarchy(), emotions())
73
+ await config.add(hierarchy, emotions)
74
74
  return config
75
75
  }
76
76
 
@@ -173,27 +173,23 @@ const initializeApi = (config, api) => {
173
173
  }
174
174
 
175
175
 
176
- const createConfig = () => {
177
- const timeKM = createTimeKM()
178
- const currencyKM = createCurrencyKM()
176
+ const createConfig = async () => {
177
+ const timeKM = await createTimeKM()
178
+ const currencyKM = await createCurrencyKM()
179
179
  const api = new Sally(timeKM)
180
180
  const api2 = new Bob(currencyKM)
181
181
 
182
182
  const config = new Config(configStruct, module)
183
183
  config.stop_auto_rebuild()
184
- config.add(gdefaults())
185
-
186
- config.multiApi = initializeApi
187
- config.initializer( ({isModule, config, km}) => {
188
- if (!isModule) {
189
- // config.api = api2
190
- // config.api = api
191
- const config = km('characters')
192
- config.api = api2
193
- config.api = api
194
- }
195
- })
196
- config.restart_auto_rebuild()
184
+ await config.add(gdefaults)
185
+
186
+ await config.setMultiApi(initializeApi)
187
+ const isModule = require.main !== module
188
+ if (!isModule) {
189
+ await config.setApi(api2)
190
+ await config.setApi(api)
191
+ }
192
+ await config.restart_auto_rebuild()
197
193
  return config
198
194
  }
199
195
 
@@ -3103,28 +3103,6 @@
3103
3103
  1
3104
3104
  ]
3105
3105
  ],
3106
- [
3107
- [
3108
- "comma",
3109
- 0
3110
- ],
3111
- [
3112
- "is",
3113
- 0
3114
- ],
3115
- [
3116
- "list",
3117
- 0
3118
- ],
3119
- [
3120
- "unknown",
3121
- 0
3122
- ],
3123
- [
3124
- "unknown",
3125
- 1
3126
- ]
3127
- ],
3128
3106
  [
3129
3107
  [
3130
3108
  "comma",
@@ -7076,36 +7054,6 @@
7076
7054
  1
7077
7055
  ]
7078
7056
  ],
7079
- [
7080
- [
7081
- "a",
7082
- 0
7083
- ],
7084
- [
7085
- "comma",
7086
- 0
7087
- ],
7088
- [
7089
- "is",
7090
- 0
7091
- ],
7092
- [
7093
- "list",
7094
- 0
7095
- ],
7096
- [
7097
- "purple_colors",
7098
- 0
7099
- ],
7100
- [
7101
- "unknown",
7102
- 0
7103
- ],
7104
- [
7105
- "unknown",
7106
- 1
7107
- ]
7108
- ],
7109
7057
  [
7110
7058
  [
7111
7059
  "a",
@@ -8942,36 +8890,6 @@
8942
8890
  1
8943
8891
  ]
8944
8892
  ],
8945
- [
8946
- [
8947
- "a",
8948
- 0
8949
- ],
8950
- [
8951
- "comma",
8952
- 0
8953
- ],
8954
- [
8955
- "green_colors",
8956
- 0
8957
- ],
8958
- [
8959
- "is",
8960
- 0
8961
- ],
8962
- [
8963
- "list",
8964
- 0
8965
- ],
8966
- [
8967
- "unknown",
8968
- 0
8969
- ],
8970
- [
8971
- "unknown",
8972
- 1
8973
- ]
8974
- ],
8975
8893
  [
8976
8894
  [
8977
8895
  "a",
@@ -11131,36 +11049,6 @@
11131
11049
  1
11132
11050
  ]
11133
11051
  ],
11134
- [
11135
- [
11136
- "a",
11137
- 0
11138
- ],
11139
- [
11140
- "blue_colors",
11141
- 0
11142
- ],
11143
- [
11144
- "comma",
11145
- 0
11146
- ],
11147
- [
11148
- "is",
11149
- 0
11150
- ],
11151
- [
11152
- "list",
11153
- 0
11154
- ],
11155
- [
11156
- "unknown",
11157
- 0
11158
- ],
11159
- [
11160
- "unknown",
11161
- 1
11162
- ]
11163
- ],
11164
11052
  [
11165
11053
  [
11166
11054
  "a",
@@ -13210,36 +13098,6 @@
13210
13098
  1
13211
13099
  ]
13212
13100
  ],
13213
- [
13214
- [
13215
- "a",
13216
- 0
13217
- ],
13218
- [
13219
- "brown_colors",
13220
- 0
13221
- ],
13222
- [
13223
- "comma",
13224
- 0
13225
- ],
13226
- [
13227
- "is",
13228
- 0
13229
- ],
13230
- [
13231
- "list",
13232
- 0
13233
- ],
13234
- [
13235
- "unknown",
13236
- 0
13237
- ],
13238
- [
13239
- "unknown",
13240
- 1
13241
- ]
13242
- ],
13243
13101
  [
13244
13102
  [
13245
13103
  "a",
@@ -15530,36 +15388,6 @@
15530
15388
  0
15531
15389
  ]
15532
15390
  ],
15533
- [
15534
- [
15535
- "a",
15536
- 0
15537
- ],
15538
- [
15539
- "comma",
15540
- 0
15541
- ],
15542
- [
15543
- "is",
15544
- 0
15545
- ],
15546
- [
15547
- "list",
15548
- 0
15549
- ],
15550
- [
15551
- "unknown",
15552
- 0
15553
- ],
15554
- [
15555
- "unknown",
15556
- 1
15557
- ],
15558
- [
15559
- "white_colors",
15560
- 0
15561
- ]
15562
- ],
15563
15391
  [
15564
15392
  [
15565
15393
  "a",
@@ -24128,36 +23956,6 @@
24128
23956
  1
24129
23957
  ]
24130
23958
  ],
24131
- [
24132
- [
24133
- "a",
24134
- 0
24135
- ],
24136
- [
24137
- "blue_colors",
24138
- 0
24139
- ],
24140
- [
24141
- "comma",
24142
- 0
24143
- ],
24144
- [
24145
- "is",
24146
- 0
24147
- ],
24148
- [
24149
- "list",
24150
- 0
24151
- ],
24152
- [
24153
- "unknown",
24154
- 0
24155
- ],
24156
- [
24157
- "unknown",
24158
- 1
24159
- ]
24160
- ],
24161
23959
  [
24162
23960
  [
24163
23961
  "a",
@@ -24302,36 +24100,6 @@
24302
24100
  1
24303
24101
  ]
24304
24102
  ],
24305
- [
24306
- [
24307
- "a",
24308
- 0
24309
- ],
24310
- [
24311
- "brown_colors",
24312
- 0
24313
- ],
24314
- [
24315
- "comma",
24316
- 0
24317
- ],
24318
- [
24319
- "is",
24320
- 0
24321
- ],
24322
- [
24323
- "list",
24324
- 0
24325
- ],
24326
- [
24327
- "unknown",
24328
- 0
24329
- ],
24330
- [
24331
- "unknown",
24332
- 1
24333
- ]
24334
- ],
24335
24103
  [
24336
24104
  [
24337
24105
  "a",
@@ -24476,36 +24244,6 @@
24476
24244
  1
24477
24245
  ]
24478
24246
  ],
24479
- [
24480
- [
24481
- "a",
24482
- 0
24483
- ],
24484
- [
24485
- "comma",
24486
- 0
24487
- ],
24488
- [
24489
- "green_colors",
24490
- 0
24491
- ],
24492
- [
24493
- "is",
24494
- 0
24495
- ],
24496
- [
24497
- "list",
24498
- 0
24499
- ],
24500
- [
24501
- "unknown",
24502
- 0
24503
- ],
24504
- [
24505
- "unknown",
24506
- 1
24507
- ]
24508
- ],
24509
24247
  [
24510
24248
  [
24511
24249
  "a",
@@ -24609,69 +24347,9 @@
24609
24347
  "purple_colors",
24610
24348
  0
24611
24349
  ],
24612
- [
24613
- "unknown",
24614
- 0
24615
- ],
24616
- [
24617
- "unknown",
24618
- 1
24619
- ]
24620
- ],
24621
- [
24622
- [
24623
- "a",
24624
- 0
24625
- ],
24626
- [
24627
- "comma",
24628
- 0
24629
- ],
24630
- [
24631
- "is",
24632
- 0
24633
- ],
24634
- [
24635
- "list",
24636
- 0
24637
- ],
24638
- [
24639
- "purple_colors",
24640
- 0
24641
- ],
24642
- [
24643
- "unknown",
24644
- 1
24645
- ]
24646
- ],
24647
- [
24648
- [
24649
- "a",
24650
- 0
24651
- ],
24652
- [
24653
- "comma",
24654
- 0
24655
- ],
24656
- [
24657
- "is",
24658
- 0
24659
- ],
24660
- [
24661
- "list",
24662
- 0
24663
- ],
24664
- [
24665
- "unknown",
24666
- 0
24667
- ],
24668
24350
  [
24669
24351
  "unknown",
24670
24352
  1
24671
- ],
24672
- [
24673
- "white_colors",
24674
- 0
24675
24353
  ]
24676
24354
  ],
24677
24355
  [
@@ -25358,28 +25036,6 @@
25358
25036
  1
25359
25037
  ]
25360
25038
  ],
25361
- [
25362
- [
25363
- "comma",
25364
- 0
25365
- ],
25366
- [
25367
- "is",
25368
- 0
25369
- ],
25370
- [
25371
- "list",
25372
- 0
25373
- ],
25374
- [
25375
- "unknown",
25376
- 0
25377
- ],
25378
- [
25379
- "unknown",
25380
- 1
25381
- ]
25382
- ],
25383
25039
  [
25384
25040
  [
25385
25041
  "comma",
package/common/colors.js CHANGED
@@ -46,9 +46,9 @@ const template = {
46
46
  ],
47
47
  }
48
48
 
49
- const createConfig = () => {
49
+ const createConfig = async () => {
50
50
  const config = new Config({ name: 'colors' }, module)
51
- config.add(hierarchy())
51
+ await config.add(hierarchy)
52
52
  return config
53
53
  }
54
54
 
@@ -45,24 +45,11 @@ let configStruct = {
45
45
  bridge: "{ ...next(operator) }"
46
46
  },
47
47
  ],
48
-
49
- /*
50
- generators: [
51
- {
52
- where: where(),
53
- match: ({context}) => false && context.quantity,
54
- apply: ({context, g}) => {
55
- const countable = g({ ...context, quantity: undefined, number: context.quanity == 1 ? 'one' : 'many' })
56
- return `${g(context.quantity)} ${countable}`
57
- }
58
- },
59
- ]
60
- */
61
48
  };
62
49
 
63
- const createConfig = () => {
50
+ const createConfig = async () => {
64
51
  const config = new Config(configStruct, module)
65
- config.add(dialogues(), numbers())
52
+ await config.add(dialogues, numbers)
66
53
  return config
67
54
  }
68
55
 
package/common/concept.js CHANGED
@@ -14,7 +14,7 @@ const concept_instance = require('./concept.instance.json')
14
14
  plain and regular fries mean the same thing
15
15
  */
16
16
 
17
- const createConfig = () => {
17
+ const createConfig = async () => {
18
18
  const config = new Config({
19
19
  name: 'concept',
20
20
  operators: [
@@ -85,7 +85,7 @@ const createConfig = () => {
85
85
  }
86
86
  return true
87
87
  },
88
- apply: ({g, context}) => {
88
+ apply: async ({g, context}) => {
89
89
  const modifiers = context.value.map( (p) => p[p.modifiers[0]] )
90
90
  context.word = context.value[0].word
91
91
  context.value = null
@@ -96,17 +96,21 @@ const createConfig = () => {
96
96
  value: modifiers
97
97
  }
98
98
  context.paraphrase = true
99
- return g(context)
99
+ return await g(context)
100
100
  }
101
101
  },
102
102
  {
103
103
  where: where(),
104
104
  match: ({context}) => context.marker == 'modifies' && context.paraphrase,
105
- apply: ({context, gp, gw}) => {
105
+ apply: async ({context, gp, gw}) => {
106
+ const modifiers = []
107
+ for (modifier of context.modifiers) {
108
+ modifiers.push(await gp(modifier))
109
+ }
106
110
  if (context.literally) {
107
- return `${context.modifiers.map(gp).join(" ")} literally ${gw(context, { number: context.modifiers[context.modifiers.length - 1] })} ${gp(context.concept)}`
111
+ return `${modifiers.join(" ")} literally ${await gw(context, { number: context.modifiers[context.modifiers.length - 1] })} ${await gp(context.concept)}`
108
112
  } else {
109
- return `${context.modifiers.map(gp).join(" ")} ${gw(context, { number: context.modifiers[context.modifiers.length - 1] })} ${gp(context.concept)}`
113
+ return `${modifiers.join(" ")} ${await gw(context, { number: context.modifiers[context.modifiers.length - 1] })} ${await gp(context.concept)}`
110
114
  }
111
115
  }
112
116
  // const chosen = chooseNumber(context, word.singular, word.plural)
@@ -121,7 +125,6 @@ const createConfig = () => {
121
125
  let modifiers
122
126
  if (context.literally) {
123
127
  literalModifiers = context.modifiers[0]
124
- debugger
125
128
  // modifiers = literalModifiers.value.map(modifier => modifier.value)
126
129
  modifiers = literalModifiers.value
127
130
  modifiers = modifiers.slice(0, -1).concat([literalModifiers.marker]).concat(modifiers.slice(-1))
@@ -136,9 +139,9 @@ const createConfig = () => {
136
139
  ],
137
140
  }, module)
138
141
  config.stop_auto_rebuild()
139
- config.api = new API()
140
- config.add(dialogues())
141
- config.restart_auto_rebuild()
142
+ await config.setApi(new API())
143
+ await config.add(dialogues)
144
+ await config.restart_auto_rebuild()
142
145
  return config
143
146
  }
144
147