tpmkms_4wp 9.3.0 → 9.4.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/common/animals.instance.json +0 -65
- package/common/animals.js +2 -3
- package/common/animals.test.json +1607 -1
- package/common/articles.js +2 -4
- package/common/asking.js +21 -5
- package/common/avatar.js +4 -12
- package/common/characters.js +2 -2
- package/common/colors.instance.json +0 -70
- package/common/colors.js +2 -2
- package/common/comparable.instance.json +0 -15
- package/common/comparable.js +2 -2
- package/common/concept.js +1 -2
- package/common/concept.test.json +279 -193
- package/common/conjunction.js +3 -5
- package/common/countable.js +2 -14
- package/common/crew.instance.json +0 -130
- package/common/crew.js +2 -2
- package/common/currency.js +2 -3
- package/common/dateTimeSelectors.instance.json +175 -0
- package/common/dateTimeSelectors.js +168 -0
- package/common/dateTimeSelectors.test.json +85622 -0
- package/common/dates.instance.json +504 -486
- package/common/dates.js +128 -16
- package/common/dates.test.json +16867 -373
- package/common/dialogues.js +13 -49
- package/common/dimension.instance.json +0 -5
- package/common/dimension.js +4 -4
- package/common/edible.instance.json +0 -216
- package/common/edible.js +2 -2
- package/common/emotions.instance.json +0 -5
- package/common/emotions.js +2 -2
- package/common/errors.js +3 -0
- package/common/evaluate.js +2 -2
- package/common/events.js +1 -2
- package/common/fastfood.instance.json +28 -975
- package/common/fastfood.js +2 -4
- package/common/fastfood.test.json +16291 -6597
- package/common/formulas.instance.json +0 -5
- package/common/formulas.js +3 -1
- package/common/gdefaults.js +7 -4
- package/common/help.js +2 -2
- package/common/helpers/dateTimeSelectors.js +198 -0
- package/common/helpers/dialogues.js +11 -8
- package/common/helpers/properties.js +2 -2
- package/common/helpers.js +23 -47
- package/common/hierarchy.js +12 -13
- package/common/javascript.js +2 -3
- package/common/kirk.instance.json +30 -119
- package/common/kirk.js +2 -3
- package/common/length.instance.json +0 -75
- package/common/length.js +2 -3
- package/common/listener.js +3 -1
- package/common/math.instance.json +0 -5
- package/common/math.js +2 -3
- package/common/menus.instance.json +0 -35
- package/common/menus.js +3 -1
- package/common/meta.js +4 -5
- package/common/nameable.js +3 -1
- package/common/negation.js +2 -2
- package/common/numbers.js +7 -4
- package/common/numbers.test.json +89 -23
- package/common/ordering.instance.json +0 -10
- package/common/ordering.js +2 -3
- package/common/ordinals.js +2 -3
- package/common/people.instance.json +0 -40
- package/common/people.js +2 -3
- package/common/percentages.js +3 -4
- package/common/percentages.test.json +57 -11
- package/common/pipboy.instance.json +0 -85
- package/common/pipboy.js +1 -1
- package/common/pipboy.test.json +4377 -3386
- package/common/pokemon.instance.json +0 -65
- package/common/pokemon.js +1 -2
- package/common/pos.js +2 -2
- package/common/pressure.instance.json +0 -20
- package/common/pressure.js +2 -2
- package/common/properties.instance.json +0 -5
- package/common/properties.js +11 -13
- package/common/punctuation.js +2 -2
- package/common/reminders.instance.json +237 -0
- package/common/reminders.js +394 -0
- package/common/reminders.test.json +81932 -0
- package/common/reports.instance.json +2 -12
- package/common/reports.js +1 -1
- package/common/scorekeeper.js +2 -2
- package/common/scorekeeper.test.json +3565 -7550
- package/common/sdefaults.js +1 -1
- package/common/self.instance.json +2 -0
- package/common/self.js +49 -0
- package/common/self.test.json +2 -0
- package/common/sizeable.js +2 -2
- package/common/spock.instance.json +30 -119
- package/common/spock.js +1 -1
- package/common/stgame.js +1 -1
- package/common/stm.js +1 -1
- package/common/tell.js +2 -2
- package/common/temperature.instance.json +84 -20
- package/common/temperature.js +2 -2
- package/common/tester.js +0 -1
- package/common/testing.js +0 -1
- package/common/time.js +57 -30
- package/common/time.test.json +4159 -205
- package/common/tokenize.js +1 -1
- package/common/ui.instance.json +0 -5
- package/common/ui.js +4 -2
- package/common/weight.instance.json +0 -60
- package/common/weight.js +2 -2
- package/common/wp.instance.json +386 -72
- package/common/wp.js +1 -5
- package/common/wp.test.json +8057 -3867
- package/common/yesno.js +2 -2
- package/main.js +6 -0
- package/package.json +16 -4
@@ -0,0 +1,168 @@
|
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
2
|
+
const { defaultContextCheck } = require('./helpers')
|
3
|
+
const dateTimeSelectors_tests = require('./dateTimeSelectors.test.json')
|
4
|
+
const dateTimeSelectors_instance = require('./dateTimeSelectors.instance.json')
|
5
|
+
const dates = require('./dates')
|
6
|
+
const time = require('./time')
|
7
|
+
const dateTimeSelectors_helpers = require('./helpers/dateTimeSelectors')
|
8
|
+
|
9
|
+
/*
|
10
|
+
friday instead
|
11
|
+
change it to friday
|
12
|
+
delete it
|
13
|
+
make it friday instead
|
14
|
+
2 sundays from now
|
15
|
+
2 sundays from last tuesday
|
16
|
+
the sunday after july 1st
|
17
|
+
the first tuesday after july 1st
|
18
|
+
the first tuesday on or after july 1st
|
19
|
+
the last tuesday of every month
|
20
|
+
the last tuesday of every third month
|
21
|
+
monday at 10 am
|
22
|
+
10 am
|
23
|
+
first monday after jan 1
|
24
|
+
*/
|
25
|
+
|
26
|
+
function instantiate(kms, isA, isProcessOrTest, dateTimeSelector) {
|
27
|
+
try {
|
28
|
+
const now = kms.time.api.now()
|
29
|
+
return dateTimeSelectors_helpers.instantiate(isA, now, dateTimeSelector)
|
30
|
+
} catch ( e ) {
|
31
|
+
return `Implement instatiate for this type of date. See the dateTimeSelectors KM ${where()}`
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
function removeDatesSuffix(str) {
|
36
|
+
if (str.endsWith('_dates')) {
|
37
|
+
return str.slice(0, -6); // Removes last 6 characters
|
38
|
+
}
|
39
|
+
return str;
|
40
|
+
}
|
41
|
+
|
42
|
+
function onOrIs(marker, context) {
|
43
|
+
if (context.marker === marker) {
|
44
|
+
return context
|
45
|
+
}
|
46
|
+
if (context.marker === 'onDate_dates' && context.date?.marker == marker) {
|
47
|
+
return context.date
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
function afterOrIs(marker, context) {
|
52
|
+
if (context.marker === marker) {
|
53
|
+
return context
|
54
|
+
}
|
55
|
+
if (context.marker === 'onDate_dates' && context.date?.marker == marker) {
|
56
|
+
return context.date
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
const template = {
|
61
|
+
configs: [
|
62
|
+
{
|
63
|
+
operators: [
|
64
|
+
"([dateTimeSelector] (onDate) (atTime))",
|
65
|
+
"((day_dates/*) [dayOfMonth|of] (month_dates/*))",
|
66
|
+
"((day_dates/*) [dayAfterDate|after] (afterDateValue_dates/*))",
|
67
|
+
],
|
68
|
+
bridges: [
|
69
|
+
{
|
70
|
+
id: 'dayOfMonth',
|
71
|
+
after: ['article'],
|
72
|
+
isA: ['onDateValue_dates'],
|
73
|
+
before: ['verb', 'onDate_dates'],
|
74
|
+
bridge: "{ ...next(operator), day: before[0], month: after[0], operator: operator, interpolate: '${day} ${operator} ${month}' }",
|
75
|
+
check: ['day', 'month'],
|
76
|
+
},
|
77
|
+
{
|
78
|
+
id: 'dayAfterDate',
|
79
|
+
after: ['article', 'monthDayYear_dates'],
|
80
|
+
isA: ['onDateValue_dates'],
|
81
|
+
before: ['verb', 'afterDate_dates'],
|
82
|
+
bridge: "{ ...next(operator), day: before[0], after: after[0], operator: operator, interpolate: '${day} ${operator} ${after}' }",
|
83
|
+
check: ['day', 'after'],
|
84
|
+
},
|
85
|
+
{
|
86
|
+
id: 'dateTimeSelector',
|
87
|
+
after: ['preposition'],
|
88
|
+
before: ['verb'],
|
89
|
+
convolution: true,
|
90
|
+
children: ['onDate_dates', 'atTime', 'date_dates'],
|
91
|
+
bridge: "{ ...next(operator), date: after[0], time: after[1], interpolate: '${date} ${time}' }",
|
92
|
+
check: ['time', 'date'],
|
93
|
+
},
|
94
|
+
],
|
95
|
+
semantics: [
|
96
|
+
{
|
97
|
+
match: ({context, isA}) => context.evaluate && onOrIs('dayAfterDate', context),
|
98
|
+
apply: async ({context, isProcess, isTest, kms, isA, e}) => {
|
99
|
+
try {
|
100
|
+
const now = kms.time.api.now()
|
101
|
+
const date = afterOrIs('dayAfterDate', context)
|
102
|
+
const afterISO = (await e(date.after)).evalue
|
103
|
+
const day_ordinal = date.day.day_ordinal
|
104
|
+
const ordinal = date.day.ordinal.value
|
105
|
+
context.evalue = dateTimeSelectors_helpers.getNthWeekdayAfterDate(afterISO, day_ordinal, ordinal)
|
106
|
+
} catch ( e ) {
|
107
|
+
context.evalue = `Implement instatiate for this type of date. See the dateTimeSelectors KM ${where()}. ${e}`
|
108
|
+
}
|
109
|
+
},
|
110
|
+
},
|
111
|
+
{
|
112
|
+
match: ({context, isA}) => context.evaluate && onOrIs('dayOfMonth', context),
|
113
|
+
apply: ({context, isProcess, isTest, kms, isA}) => {
|
114
|
+
try {
|
115
|
+
const now = kms.time.api.now()
|
116
|
+
const date = onOrIs('dayOfMonth', context)
|
117
|
+
context.evalue = dateTimeSelectors_helpers.getNthDayOfMonth(removeDatesSuffix(date.day.value), date.day.ordinal.value || 1, removeDatesSuffix(date.month.value), now)
|
118
|
+
} catch ( e ) {
|
119
|
+
context.evalue = `Implement instatiate for this type of date. See the dateTimeSelectors KM ${where()}. ${e}`
|
120
|
+
}
|
121
|
+
},
|
122
|
+
},
|
123
|
+
{
|
124
|
+
match: ({context, isA}) => {
|
125
|
+
if (!context.evaluate) {
|
126
|
+
return false
|
127
|
+
}
|
128
|
+
if (isA(context.marker, 'onDateValue_dates')) {
|
129
|
+
return true
|
130
|
+
}
|
131
|
+
if (isA(context.marker, 'dateTimeSelector')) {
|
132
|
+
return true
|
133
|
+
}
|
134
|
+
},
|
135
|
+
apply: ({context, isProcess, isTest, kms, isA}) => {
|
136
|
+
context.evalue = instantiate(kms, isA, isProcess || isTest || context.isTest, context)
|
137
|
+
},
|
138
|
+
}
|
139
|
+
],
|
140
|
+
hierarchy: [
|
141
|
+
['day_dates', 'orderable'],
|
142
|
+
],
|
143
|
+
},
|
144
|
+
],
|
145
|
+
}
|
146
|
+
|
147
|
+
knowledgeModule( {
|
148
|
+
config: { name: 'dateTimeSelectors' },
|
149
|
+
includes: [time, dates],
|
150
|
+
|
151
|
+
module,
|
152
|
+
description: 'talking about date and time selectors',
|
153
|
+
test: {
|
154
|
+
name: './dateTimeSelectors.test.json',
|
155
|
+
contents: dateTimeSelectors_tests,
|
156
|
+
checks: {
|
157
|
+
context: [
|
158
|
+
// defaultContextCheck({ extra: ['date', 'time', 'response', 'after', 'day', 'month', 'year', 'evalue'] }),
|
159
|
+
defaultContextCheck({ extra: ['date', 'time', 'response', 'after', 'evalue'] }),
|
160
|
+
],
|
161
|
+
}
|
162
|
+
},
|
163
|
+
template: {
|
164
|
+
template,
|
165
|
+
instance: dateTimeSelectors_instance,
|
166
|
+
},
|
167
|
+
|
168
|
+
})
|