tpmkms_4wp 9.3.0-beta.15 → 9.3.0-beta.16
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/helpers/dialogues.js +6 -5
- package/common/reminders.js +29 -3
- package/common/reminders.test.json +6596 -0
- package/package.json +2 -2
@@ -78,11 +78,6 @@ class API {
|
|
78
78
|
|
79
79
|
// word is for one or many
|
80
80
|
makeObject({config, context, types=[], source_value=undefined, doPluralize=true} = {}) {
|
81
|
-
/*
|
82
|
-
if (!context.unknown) {
|
83
|
-
return context.value
|
84
|
-
}
|
85
|
-
*/
|
86
81
|
if (typeof context == 'string') {
|
87
82
|
context = { word: context, value: context }
|
88
83
|
}
|
@@ -119,6 +114,12 @@ class API {
|
|
119
114
|
this.setupObjectHierarchy(config, concept, {types: allTypes});
|
120
115
|
}
|
121
116
|
|
117
|
+
try {
|
118
|
+
pluralize.isSingular(word)
|
119
|
+
} catch ( e ) {
|
120
|
+
debugger
|
121
|
+
return
|
122
|
+
}
|
122
123
|
if (pluralize.isSingular(word)) {
|
123
124
|
addConcept(word, 'one')
|
124
125
|
doPluralize && addConcept(pluralize.plural(word), 'many')
|
package/common/reminders.js
CHANGED
@@ -13,6 +13,9 @@ const helpers = require('./helpers')
|
|
13
13
|
make it friday instead
|
14
14
|
2 sundays from now
|
15
15
|
the sunday after july 1st
|
16
|
+
remind greg to go to regina
|
17
|
+
remind every truck driver to whatever tomorrow at 8 am
|
18
|
+
remind greg and bob to go to bolivia and see the xyz corporation
|
16
19
|
*/
|
17
20
|
|
18
21
|
class API {
|
@@ -29,6 +32,13 @@ class API {
|
|
29
32
|
this.args.mentioned({ context: reminder })
|
30
33
|
}
|
31
34
|
|
35
|
+
addRemindable(id, text) {
|
36
|
+
if (!text) {
|
37
|
+
text = id
|
38
|
+
}
|
39
|
+
this.args.makeObject({ ...this.args, context: { word: text, value: id, number: 'one' }, types: ['remindable'] })
|
40
|
+
}
|
41
|
+
|
32
42
|
async instantiate(reminder) {
|
33
43
|
const value = await this.args.e(reminder.dateTimeSelector)
|
34
44
|
reminder.nextISODate = value?.evalue
|
@@ -87,16 +97,32 @@ const template = {
|
|
87
97
|
configs: [
|
88
98
|
{
|
89
99
|
operators: [
|
90
|
-
"([
|
91
|
-
"([
|
92
|
-
"([remind
|
100
|
+
"([remindable])",
|
101
|
+
{ pattern: "([addRemindable] (word)*)", development: true },
|
102
|
+
"([remind] (remindable/*) (!@<= 'dateTimeSelector')*)",
|
103
|
+
"([remind:withDateBridge] (remindable/*) (!@<= 'dateTimeSelector')* (dateTimeSelector))",
|
104
|
+
"([remind:withDateAndTimeBridge] (remindable/*) (!@<= 'dateTimeSelector')* (dateTimeSelector) (atTime))",
|
93
105
|
"([show] ([reminders]))",
|
94
106
|
"([delete_reminders|delete,cancel] (number/*))",
|
95
107
|
],
|
96
108
|
bridges: [
|
109
|
+
{
|
110
|
+
id: 'addRemindable',
|
111
|
+
isA: ['verb'],
|
112
|
+
development: true,
|
113
|
+
bridge: "{ ...next(operator), arg: after[0], operator: operator, interpolate: '${operator} ${arg}' }",
|
114
|
+
semantic: ({api, context}) => {
|
115
|
+
const name = context.arg.map( (word) => word.text ).join(' ')
|
116
|
+
api.addRemindable(name)
|
117
|
+
}
|
118
|
+
},
|
119
|
+
{
|
120
|
+
id: 'remindable',
|
121
|
+
},
|
97
122
|
{
|
98
123
|
id: 'remind',
|
99
124
|
isA: ['verb'],
|
125
|
+
localHierarchy: [['self', 'remindable']],
|
100
126
|
bridge: "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], interpolate: '${operator} ${who} ${reminder}' }",
|
101
127
|
withDateBridge: "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], date: after[2], interpolate: '${operator} ${who} ${reminder} ${date}' }",
|
102
128
|
withDateAndTimeBridge: "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], date: after[2], time: after[3], interpolate: '${operator} ${who} ${reminder} ${date} ${time}' }",
|