tpmkms_4wp 9.3.0-beta.26 → 9.3.0-beta.28
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/reminders.js +17 -7
- package/common/reminders.test.json +6164 -4
- package/package.json +2 -2
package/common/reminders.js
CHANGED
@@ -88,7 +88,7 @@ class API {
|
|
88
88
|
const items = []
|
89
89
|
for (const item of this._objects.reminders) {
|
90
90
|
if (!item.dateTimeSelector) {
|
91
|
-
items.push({ when: true, text: item.text, id: item.id })
|
91
|
+
items.push({ when: true, who: item.who, text: item.text, id: item.id })
|
92
92
|
}
|
93
93
|
}
|
94
94
|
return items
|
@@ -142,7 +142,7 @@ const template = {
|
|
142
142
|
"([show] ([reminders]))",
|
143
143
|
"([delete_reminders|delete,cancel] (number/*))",
|
144
144
|
"([add] (remindable/*))",
|
145
|
-
"([remove] (remindable/*))",
|
145
|
+
"([remove|] (remindable/*))",
|
146
146
|
"((verb/*) [inAddition|also,too])",
|
147
147
|
],
|
148
148
|
bridges: [
|
@@ -161,6 +161,7 @@ const template = {
|
|
161
161
|
},
|
162
162
|
{
|
163
163
|
id: 'remove',
|
164
|
+
words: ['delete', 'remove'],
|
164
165
|
isA: ['verb'],
|
165
166
|
bridge: "{ ...next(operator), arg: after[0], operator: operator, interpolate: '${operator} ${arg}' }",
|
166
167
|
semantic: ({api, context}) => {
|
@@ -186,7 +187,7 @@ const template = {
|
|
186
187
|
isA: ['verb'],
|
187
188
|
localHierarchy: [['self', 'remindable']],
|
188
189
|
bridge: "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], interpolate: '${operator} ${who} ${reminder}' }",
|
189
|
-
justWhoBridge: "{ ...next(operator), operator: operator, who: after[0], interpolate: '${operator} ${who}' }",
|
190
|
+
justWhoBridge: "{ ...next(operator), bridge: 'justWhoBridge', operator: operator, who: after[0], interpolate: '${operator} ${who}' }",
|
190
191
|
withDateBridge: "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], date: after[2], interpolate: '${operator} ${who} ${reminder} ${date}' }",
|
191
192
|
withDateAndTimeBridge: "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], date: after[2], time: after[3], interpolate: '${operator} ${who} ${reminder} ${date} ${time}' }",
|
192
193
|
semantics: [
|
@@ -198,8 +199,11 @@ const template = {
|
|
198
199
|
},
|
199
200
|
],
|
200
201
|
semantic: async ({api, gsp, gp, context}) => {
|
201
|
-
const text = await gsp(context.reminder.slice(1));
|
202
202
|
const who = api.contextToWho(context.who)
|
203
|
+
let text;
|
204
|
+
if (context.reminder) {
|
205
|
+
text = await gsp(context.reminder.slice(1));
|
206
|
+
}
|
203
207
|
const reminder = { text, dateTimeSelector: context.date, who }
|
204
208
|
if (context.date) {
|
205
209
|
reminder.dateTimeSelector = context.date
|
@@ -250,11 +254,17 @@ const template = {
|
|
250
254
|
},
|
251
255
|
|
252
256
|
matchq: ({ api, context }) => api.askAbout().length > 0 && context.marker == 'controlEnd',
|
253
|
-
applyq: ({ api, context }) => {
|
257
|
+
applyq: async ({ api, context, gs }) => {
|
254
258
|
context.cascade = false
|
255
259
|
const items = api.askAbout()
|
256
260
|
const item = items[0]
|
257
|
-
|
261
|
+
let who
|
262
|
+
if (Array.isArray(item.who)) {
|
263
|
+
who = await gs(item.who.map((who) => who.text), ', ', ' and ')
|
264
|
+
} else {
|
265
|
+
who = 'you'
|
266
|
+
}
|
267
|
+
return `When should I remind ${who} to ${item.text}`
|
258
268
|
},
|
259
269
|
|
260
270
|
matchr: ({ isA, api, context }) => {
|
@@ -284,7 +294,7 @@ knowledgeModule( {
|
|
284
294
|
name: './reminders.test.json',
|
285
295
|
contents: reminders_tests,
|
286
296
|
checks: {
|
287
|
-
context: defaultContextCheck(['who', 'reminder']),
|
297
|
+
context: defaultContextCheck(['who', 'reminder', 'verbatim']),
|
288
298
|
objects: [
|
289
299
|
{
|
290
300
|
property: 'reminders',
|