tpmkms_4wp 9.3.0-beta.4 → 9.3.0-beta.41

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.
Files changed (54) hide show
  1. package/common/animals.instance.json +0 -65
  2. package/common/asking.js +16 -2
  3. package/common/colors.instance.json +28 -70
  4. package/common/comparable.instance.json +0 -15
  5. package/common/concept.test.json +279 -193
  6. package/common/crew.instance.json +0 -202
  7. package/common/dateTimeSelectors.instance.json +67 -0
  8. package/common/dateTimeSelectors.js +85 -0
  9. package/common/dateTimeSelectors.test.json +4529 -0
  10. package/common/dates.instance.json +136 -27
  11. package/common/dates.js +13 -0
  12. package/common/dates.test.json +1787 -0
  13. package/common/dialogues.js +5 -43
  14. package/common/dimension.instance.json +0 -5
  15. package/common/edible.instance.json +56 -160
  16. package/common/emotions.instance.json +0 -5
  17. package/common/evaluate.js +1 -1
  18. package/common/events.js +1 -1
  19. package/common/fastfood.instance.json +180 -879
  20. package/common/fastfood.test.json +16291 -6597
  21. package/common/formulas.instance.json +0 -5
  22. package/common/helpers/dateTimeSelectors.js +92 -0
  23. package/common/helpers/dialogues.js +3 -7
  24. package/common/helpers.js +24 -7
  25. package/common/kirk.instance.json +0 -5
  26. package/common/length.instance.json +0 -75
  27. package/common/math.instance.json +0 -5
  28. package/common/menus.instance.json +0 -35
  29. package/common/numbers.js +1 -1
  30. package/common/numbers.test.json +89 -23
  31. package/common/ordering.instance.json +0 -10
  32. package/common/people.instance.json +0 -40
  33. package/common/percentages.js +1 -1
  34. package/common/pipboy.instance.json +56 -85
  35. package/common/pipboy.test.json +4377 -3386
  36. package/common/pokemon.instance.json +0 -65
  37. package/common/pressure.instance.json +0 -20
  38. package/common/properties.instance.json +0 -5
  39. package/common/reminders.instance.json +196 -10
  40. package/common/reminders.js +270 -78
  41. package/common/reminders.test.json +55544 -23
  42. package/common/reports.instance.json +2 -12
  43. package/common/scorekeeper.test.json +3565 -7550
  44. package/common/spock.instance.json +0 -5
  45. package/common/temperature.instance.json +0 -20
  46. package/common/time.js +63 -30
  47. package/common/time.test.json +4124 -124
  48. package/common/ui.instance.json +0 -5
  49. package/common/ui.js +3 -1
  50. package/common/weight.instance.json +0 -60
  51. package/common/wp.instance.json +56 -70
  52. package/common/wp.test.json +8057 -3867
  53. package/main.js +2 -0
  54. package/package.json +8 -4
@@ -278,11 +278,6 @@
278
278
  "article",
279
279
  false
280
280
  ],
281
- [
282
- "evaluate",
283
- "verb",
284
- false
285
- ],
286
281
  [
287
282
  "every",
288
283
  "article",
@@ -0,0 +1,92 @@
1
+ const pluralize = require('pluralize')
2
+ const deepEqual = require('deep-equal')
3
+ const { chooseNumber, zip } = require('../helpers.js')
4
+ const { compose, translationMapping, translationMappingToInstantiatorMappings } = require('./meta.js')
5
+
6
+ function getNextDayOfWeek(date, targetDay) {
7
+ const dayMap = {
8
+ 'sunday_dates': 0,
9
+ 'monday_dates': 1,
10
+ 'tuesday_dates': 2,
11
+ 'wednesday_dates': 3,
12
+ 'thursday_dates': 4,
13
+ 'friday_dates': 5,
14
+ 'saturday_dates': 6
15
+ };
16
+
17
+ const targetDayNum = dayMap[targetDay.toLowerCase()]
18
+ if (!targetDayNum) {
19
+ return
20
+ }
21
+ const currentDay = date.getDay();
22
+
23
+ let daysUntilNext = targetDayNum - currentDay;
24
+ if (daysUntilNext <= 0) {
25
+ daysUntilNext += 7; // If target day is today or past, get next week's occurrence
26
+ }
27
+
28
+ const nextDate = new Date(date);
29
+ nextDate.setDate(date.getDate() + daysUntilNext);
30
+ return nextDate;
31
+ }
32
+
33
+ function getTime(time) {
34
+ let hour = 0
35
+ const minute = 0
36
+ const second = 0
37
+ let hour_offset = 0
38
+ if (time.time?.ampm?.ampm == 'pm') {
39
+ hour_offset = 12
40
+ }
41
+ if (time.marker == 'integer') {
42
+ hour = time.value
43
+ } else if (time.marker == 'atTime') {
44
+ hour = time.time.value
45
+ }
46
+ hour += hour_offset
47
+ if (time.hour) {
48
+ hour = time.hour
49
+ }
50
+ if (time.second) {
51
+ second = time.second
52
+ }
53
+ if (time.minute) {
54
+ minute = time.minute
55
+ }
56
+ return { hour, minute, second }
57
+ }
58
+
59
+ instantiate = (isA, now, context) => {
60
+ if (isA(context?.marker, 'dateTimeSelector')) {
61
+ // (on date) OR (date)
62
+ const date = context.date?.date || context.date
63
+ const dateTimeSelector = getNextDayOfWeek(now, date.value)
64
+ const time = context.time || context.defaultTime
65
+ if (time) {
66
+ const hms = getTime(time)
67
+ dateTimeSelector.setHours(hms.hour)
68
+ dateTimeSelector.setMinutes(hms.minute)
69
+ dateTimeSelector.setSeconds(hms.second)
70
+ dateTimeSelector.setMilliseconds(0)
71
+ }
72
+ return dateTimeSelector.toISOString()
73
+ } else if (context.dateTimeSelector) {
74
+ const dateTimeSelector = getNextDayOfWeek(now, context.dateTimeSelector?.value)
75
+ if (dateTimeSelector) {
76
+ return dateTimeSelector.toISOString()
77
+ }
78
+ } else if (context.value) {
79
+ const dateTimeSelector = getNextDayOfWeek(now, context.value)
80
+ if (dateTimeSelector) {
81
+ return dateTimeSelector.toISOString()
82
+ }
83
+ }
84
+ }
85
+
86
+ until = (time) => {
87
+ }
88
+
89
+ module.exports = {
90
+ instantiate,
91
+ until,
92
+ }
@@ -77,12 +77,7 @@ class API {
77
77
  }
78
78
 
79
79
  // word is for one or many
80
- makeObject({config, context, types=[], source_value=undefined, doPluralize=true} = {}) {
81
- /*
82
- if (!context.unknown) {
83
- return context.value
84
- }
85
- */
80
+ makeObject({config, context, types=[], source_value=undefined, doPluralize=true, initial=''} = {}) {
86
81
  if (typeof context == 'string') {
87
82
  context = { word: context, value: context }
88
83
  }
@@ -107,7 +102,7 @@ class API {
107
102
  config.addOperator({ pattern: `(["${concept}"])`, allowDups: true })
108
103
  config.addBridge({ id: concept, level: 0, bridge: `{ ...next(operator), value: or(operator.value, '${source_value || concept}') }` , allowDups: true })
109
104
  const addConcept = (word, number) => {
110
- config.addWord(word, { id: concept, initial: `{ value: "${source_value || concept}", number: "${number}" }` } )
105
+ config.addWord(word, { id: concept, initial: `{ value: "${source_value || concept}", number: "${number}" ${initial ? ', ': ''}${initial} }` } )
111
106
  const baseTypes = [
112
107
  'theAble',
113
108
  'queryable',
@@ -119,6 +114,7 @@ class API {
119
114
  this.setupObjectHierarchy(config, concept, {types: allTypes});
120
115
  }
121
116
 
117
+ pluralize.isSingular(word)
122
118
  if (pluralize.isSingular(word)) {
123
119
  addConcept(word, 'one')
124
120
  doPluralize && addConcept(pluralize.plural(word), 'many')
package/common/helpers.js CHANGED
@@ -152,6 +152,7 @@ const toEValue = (context) => {
152
152
  }
153
153
 
154
154
  const defaultContextCheckValidify = (properties) => {
155
+ return // new way
155
156
  for (const value of properties) {
156
157
  if (typeof value == 'string') {
157
158
  continue
@@ -163,19 +164,35 @@ const defaultContextCheckValidify = (properties) => {
163
164
  }
164
165
  }
165
166
 
166
- const defaultContextCheckProperties = ['marker', 'text', 'verbatim', 'isResponse', { property: 'response', filter: ['marker', 'text', 'verbatim'] }]
167
+ const defaultContextCheckProperties = ['marker', 'text', 'verbatim', 'isResponse', 'types', { property: 'response', filter: ['marker', 'text', 'verbatim'] }]
167
168
 
168
169
  const expand_checks = (properties) => {
169
- const expanded = []
170
- for (const property of properties) {
171
- defaultContextCheckValidify(properties)
172
- if (typeof property == 'string') {
173
- expanded.push({ property, filter: defaultContextCheckProperties })
170
+ let expanded = []
171
+ if (properties == 'defaults') {
172
+ return defaultContextCheckProperties
173
+ }
174
+ if (Array.isArray(properties)) {
175
+ for (const property of properties) {
176
+ defaultContextCheckValidify(properties)
177
+ if (typeof property == 'string') {
178
+ expanded.push({ property, filter: defaultContextCheckProperties })
179
+ } else if (property.property && property.filter) {
180
+ expanded.push({ property: property.property, filter: [defaultContextCheckProperties, ...expand_checks(property.filter)] })
181
+ } else {
182
+ expanded = [...expanded, ...expand_checks(property)]
183
+ }
184
+ }
185
+ return expanded
186
+ }
187
+ for (const key of Object.keys(properties)) {
188
+ if (key === '_') {
189
+ expanded = [...expanded, ...defaultContextCheckProperties]
174
190
  } else {
175
- expanded.push({ property: property.property, filter: [...defaultContextCheckProperties, ...expand_checks(property.filter)] })
191
+ expanded.push({ property: key, filter: [...expand_checks(properties[key])] })
176
192
  }
177
193
  }
178
194
  return expanded
195
+
179
196
  }
180
197
 
181
198
  const defaultContextCheck = (properties = []) => {
@@ -500,11 +500,6 @@
500
500
  "theAble",
501
501
  false
502
502
  ],
503
- [
504
- "evaluate",
505
- "verb",
506
- false
507
- ],
508
503
  [
509
504
  "every",
510
505
  "article",
@@ -254,11 +254,6 @@
254
254
  "article",
255
255
  false
256
256
  ],
257
- [
258
- "evaluate",
259
- "verb",
260
- false
261
- ],
262
257
  [
263
258
  "every",
264
259
  "article",
@@ -1686,11 +1681,6 @@
1686
1681
  "article",
1687
1682
  false
1688
1683
  ],
1689
- [
1690
- "evaluate",
1691
- "verb",
1692
- false
1693
- ],
1694
1684
  [
1695
1685
  "every",
1696
1686
  "article",
@@ -4182,11 +4172,6 @@
4182
4172
  "article",
4183
4173
  false
4184
4174
  ],
4185
- [
4186
- "evaluate",
4187
- "verb",
4188
- false
4189
- ],
4190
4175
  [
4191
4176
  "every",
4192
4177
  "article",
@@ -5898,11 +5883,6 @@
5898
5883
  "article",
5899
5884
  false
5900
5885
  ],
5901
- [
5902
- "evaluate",
5903
- "verb",
5904
- false
5905
- ],
5906
5886
  [
5907
5887
  "every",
5908
5888
  "article",
@@ -7614,11 +7594,6 @@
7614
7594
  "article",
7615
7595
  false
7616
7596
  ],
7617
- [
7618
- "evaluate",
7619
- "verb",
7620
- false
7621
- ],
7622
7597
  [
7623
7598
  "every",
7624
7599
  "article",
@@ -9321,11 +9296,6 @@
9321
9296
  "article",
9322
9297
  false
9323
9298
  ],
9324
- [
9325
- "evaluate",
9326
- "verb",
9327
- false
9328
- ],
9329
9299
  [
9330
9300
  "every",
9331
9301
  "article",
@@ -11038,11 +11008,6 @@
11038
11008
  "article",
11039
11009
  false
11040
11010
  ],
11041
- [
11042
- "evaluate",
11043
- "verb",
11044
- false
11045
- ],
11046
11011
  [
11047
11012
  "every",
11048
11013
  "article",
@@ -12755,11 +12720,6 @@
12755
12720
  "article",
12756
12721
  false
12757
12722
  ],
12758
- [
12759
- "evaluate",
12760
- "verb",
12761
- false
12762
- ],
12763
12723
  [
12764
12724
  "every",
12765
12725
  "article",
@@ -14462,11 +14422,6 @@
14462
14422
  "article",
14463
14423
  false
14464
14424
  ],
14465
- [
14466
- "evaluate",
14467
- "verb",
14468
- false
14469
- ],
14470
14425
  [
14471
14426
  "every",
14472
14427
  "article",
@@ -16178,11 +16133,6 @@
16178
16133
  "article",
16179
16134
  false
16180
16135
  ],
16181
- [
16182
- "evaluate",
16183
- "verb",
16184
- false
16185
- ],
16186
16136
  [
16187
16137
  "every",
16188
16138
  "article",
@@ -17894,11 +17844,6 @@
17894
17844
  "article",
17895
17845
  false
17896
17846
  ],
17897
- [
17898
- "evaluate",
17899
- "verb",
17900
- false
17901
- ],
17902
17847
  [
17903
17848
  "every",
17904
17849
  "article",
@@ -19610,11 +19555,6 @@
19610
19555
  "article",
19611
19556
  false
19612
19557
  ],
19613
- [
19614
- "evaluate",
19615
- "verb",
19616
- false
19617
- ],
19618
19558
  [
19619
19559
  "every",
19620
19560
  "article",
@@ -21240,11 +21180,6 @@
21240
21180
  "article",
21241
21181
  false
21242
21182
  ],
21243
- [
21244
- "evaluate",
21245
- "verb",
21246
- false
21247
- ],
21248
21183
  [
21249
21184
  "every",
21250
21185
  "article",
@@ -22947,11 +22882,6 @@
22947
22882
  "article",
22948
22883
  false
22949
22884
  ],
22950
- [
22951
- "evaluate",
22952
- "verb",
22953
- false
22954
- ],
22955
22885
  [
22956
22886
  "every",
22957
22887
  "article",
@@ -24664,11 +24594,6 @@
24664
24594
  "article",
24665
24595
  false
24666
24596
  ],
24667
- [
24668
- "evaluate",
24669
- "verb",
24670
- false
24671
- ],
24672
24597
  [
24673
24598
  "every",
24674
24599
  "article",
@@ -364,11 +364,6 @@
364
364
  "article",
365
365
  false
366
366
  ],
367
- [
368
- "evaluate",
369
- "verb",
370
- false
371
- ],
372
367
  [
373
368
  "every",
374
369
  "article",
@@ -237,11 +237,6 @@
237
237
  "article",
238
238
  false
239
239
  ],
240
- [
241
- "evaluate",
242
- "verb",
243
- false
244
- ],
245
240
  [
246
241
  "every",
247
242
  "article",
@@ -1296,11 +1291,6 @@
1296
1291
  "article",
1297
1292
  false
1298
1293
  ],
1299
- [
1300
- "evaluate",
1301
- "verb",
1302
- false
1303
- ],
1304
1294
  [
1305
1295
  "every",
1306
1296
  "article",
@@ -2539,11 +2529,6 @@
2539
2529
  "article",
2540
2530
  false
2541
2531
  ],
2542
- [
2543
- "evaluate",
2544
- "verb",
2545
- false
2546
- ],
2547
2532
  [
2548
2533
  "every",
2549
2534
  "article",
@@ -3822,11 +3807,6 @@
3822
3807
  "article",
3823
3808
  false
3824
3809
  ],
3825
- [
3826
- "evaluate",
3827
- "verb",
3828
- false
3829
- ],
3830
3810
  [
3831
3811
  "every",
3832
3812
  "article",
@@ -5066,11 +5046,6 @@
5066
5046
  "article",
5067
5047
  false
5068
5048
  ],
5069
- [
5070
- "evaluate",
5071
- "verb",
5072
- false
5073
- ],
5074
5049
  [
5075
5050
  "every",
5076
5051
  "article",
@@ -6773,11 +6748,6 @@
6773
6748
  "article",
6774
6749
  false
6775
6750
  ],
6776
- [
6777
- "evaluate",
6778
- "verb",
6779
- false
6780
- ],
6781
6751
  [
6782
6752
  "every",
6783
6753
  "article",
@@ -7929,11 +7899,6 @@
7929
7899
  "article",
7930
7900
  false
7931
7901
  ],
7932
- [
7933
- "evaluate",
7934
- "verb",
7935
- false
7936
- ],
7937
7902
  [
7938
7903
  "every",
7939
7904
  "article",
package/common/numbers.js CHANGED
@@ -93,7 +93,7 @@ const config = {
93
93
  },
94
94
  {
95
95
  where: where(),
96
- match: ({context}) => ['number', 'integer'].includes(context.marker),
96
+ match: ({context}) => false && ['number', 'integer'].includes(context.marker),
97
97
  apply: ({context}) => `${context.value}`
98
98
  },
99
99
  ],