tpmkms_4wp 9.3.0-beta.24 → 9.3.0-beta.25
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 +39 -5
- package/common/reminders.test.json +35 -64
- package/package.json +2 -2
package/common/reminders.js
CHANGED
@@ -13,9 +13,7 @@ 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
16
|
remind every truck driver to whatever tomorrow at 8 am
|
18
|
-
remind greg and bob to go to bolivia and see the xyz corporation
|
19
17
|
*/
|
20
18
|
|
21
19
|
class API {
|
@@ -23,6 +21,7 @@ class API {
|
|
23
21
|
this._objects = objects
|
24
22
|
this._objects.reminders = []
|
25
23
|
this._objects.id = 0
|
24
|
+
this._objects.current = null
|
26
25
|
}
|
27
26
|
|
28
27
|
async add(reminder) {
|
@@ -31,13 +30,28 @@ class API {
|
|
31
30
|
reminder.id = id
|
32
31
|
this._objects.reminders.push(reminder)
|
33
32
|
this.args.mentioned({ context: reminder })
|
33
|
+
this._objects.current = id
|
34
|
+
}
|
35
|
+
|
36
|
+
getCurrent() {
|
37
|
+
return this._objects.current
|
38
|
+
}
|
39
|
+
|
40
|
+
// addUser to current
|
41
|
+
addUser(user) {
|
42
|
+
const reminder = this._objects.reminders.find((r) => r.id == this._objects.current)
|
43
|
+
if (reminder) {
|
44
|
+
if (Array.isArray(reminder.who)) {
|
45
|
+
} else {
|
46
|
+
reminder.who = [reminder.who, user]
|
47
|
+
}
|
48
|
+
}
|
34
49
|
}
|
35
50
|
|
36
51
|
addRemindable(id, text) {
|
37
52
|
if (!text) {
|
38
53
|
text = id
|
39
54
|
}
|
40
|
-
debugger
|
41
55
|
this.args.makeObject({ ...this.args, context: { word: text, value: id, number: 'one', remindee_id: id }, initial: `remindee_id: "${id}"`, types: ['remindable'] })
|
42
56
|
}
|
43
57
|
|
@@ -46,6 +60,18 @@ class API {
|
|
46
60
|
reminder.nextISODate = value?.evalue
|
47
61
|
}
|
48
62
|
|
63
|
+
contextToWho(who) {
|
64
|
+
if (who.isList) {
|
65
|
+
const whos = []
|
66
|
+
for (const element of this.args.values(who)) {
|
67
|
+
whos.push(this.contextToWho(element))
|
68
|
+
}
|
69
|
+
return whos
|
70
|
+
} else {
|
71
|
+
return { id: who.value || who.text, text: who.text, remindee_id: who.remindee_id }
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
49
75
|
// the user of the KM can override this. this can be used to sync the GUI and the LUI
|
50
76
|
getCurrent() {
|
51
77
|
}
|
@@ -89,7 +115,6 @@ class API {
|
|
89
115
|
return
|
90
116
|
}
|
91
117
|
}
|
92
|
-
|
93
118
|
}
|
94
119
|
}
|
95
120
|
|
@@ -107,8 +132,17 @@ const template = {
|
|
107
132
|
"([remind:withDateAndTimeBridge] (remindable/*) (!@<= 'dateTimeSelector')* (dateTimeSelector) (atTime))",
|
108
133
|
"([show] ([reminders]))",
|
109
134
|
"([delete_reminders|delete,cancel] (number/*))",
|
135
|
+
"([add] (remindable/*))",
|
110
136
|
],
|
111
137
|
bridges: [
|
138
|
+
{
|
139
|
+
id: 'add',
|
140
|
+
isA: ['verb'],
|
141
|
+
bridge: "{ ...next(operator), arg: after[0], operator: operator, interpolate: '${operator} ${arg}' }",
|
142
|
+
semantic: ({api, context}) => {
|
143
|
+
api.addUser(context.arg)
|
144
|
+
}
|
145
|
+
},
|
112
146
|
{
|
113
147
|
id: 'addRemindable',
|
114
148
|
isA: ['verb'],
|
@@ -131,7 +165,7 @@ const template = {
|
|
131
165
|
withDateAndTimeBridge: "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], date: after[2], time: after[3], interpolate: '${operator} ${who} ${reminder} ${date} ${time}' }",
|
132
166
|
semantic: async ({api, gsp, gp, context}) => {
|
133
167
|
const text = await gsp(context.reminder.slice(1));
|
134
|
-
const who =
|
168
|
+
const who = api.contextToWho(context.who)
|
135
169
|
const reminder = { text, dateTimeSelector: context.date, who }
|
136
170
|
if (context.date) {
|
137
171
|
reminder.dateTimeSelector = context.date
|
@@ -960,6 +960,7 @@
|
|
960
960
|
"km": "punctuation2"
|
961
961
|
},
|
962
962
|
"reminders1": {
|
963
|
+
"current": 1,
|
963
964
|
"id": 1,
|
964
965
|
"km": "reminders1",
|
965
966
|
"reminders": [
|
@@ -3528,6 +3529,7 @@
|
|
3528
3529
|
"km": "punctuation2"
|
3529
3530
|
},
|
3530
3531
|
"reminders1": {
|
3532
|
+
"current": 1,
|
3531
3533
|
"id": 1,
|
3532
3534
|
"km": "reminders1",
|
3533
3535
|
"reminders": [
|
@@ -5329,6 +5331,7 @@
|
|
5329
5331
|
"km": "punctuation2"
|
5330
5332
|
},
|
5331
5333
|
"reminders1": {
|
5334
|
+
"current": 1,
|
5332
5335
|
"id": 1,
|
5333
5336
|
"km": "reminders1",
|
5334
5337
|
"reminders": [
|
@@ -7573,6 +7576,7 @@
|
|
7573
7576
|
"km": "punctuation2"
|
7574
7577
|
},
|
7575
7578
|
"reminders1": {
|
7579
|
+
"current": 1,
|
7576
7580
|
"id": 1,
|
7577
7581
|
"km": "reminders1",
|
7578
7582
|
"reminders": [
|
@@ -10966,6 +10970,7 @@
|
|
10966
10970
|
"km": "punctuation2"
|
10967
10971
|
},
|
10968
10972
|
"reminders1": {
|
10973
|
+
"current": 1,
|
10969
10974
|
"id": 1,
|
10970
10975
|
"km": "reminders1",
|
10971
10976
|
"reminders": [
|
@@ -14357,6 +14362,7 @@
|
|
14357
14362
|
"km": "punctuation2"
|
14358
14363
|
},
|
14359
14364
|
"reminders1": {
|
14365
|
+
"current": null,
|
14360
14366
|
"id": 0,
|
14361
14367
|
"km": "reminders1",
|
14362
14368
|
"reminders": [
|
@@ -16222,6 +16228,7 @@
|
|
16222
16228
|
"km": "punctuation2"
|
16223
16229
|
},
|
16224
16230
|
"reminders1": {
|
16231
|
+
"current": null,
|
16225
16232
|
"id": 0,
|
16226
16233
|
"km": "reminders1",
|
16227
16234
|
"reminders": [
|
@@ -18458,6 +18465,7 @@
|
|
18458
18465
|
"km": "punctuation2"
|
18459
18466
|
},
|
18460
18467
|
"reminders1": {
|
18468
|
+
"current": 1,
|
18461
18469
|
"id": 1,
|
18462
18470
|
"km": "reminders1",
|
18463
18471
|
"reminders": [
|
@@ -21350,6 +21358,7 @@
|
|
21350
21358
|
"km": "punctuation2"
|
21351
21359
|
},
|
21352
21360
|
"reminders1": {
|
21361
|
+
"current": 1,
|
21353
21362
|
"id": 1,
|
21354
21363
|
"km": "reminders1",
|
21355
21364
|
"reminders": [
|
@@ -24040,6 +24049,7 @@
|
|
24040
24049
|
"km": "punctuation2"
|
24041
24050
|
},
|
24042
24051
|
"reminders1": {
|
24052
|
+
"current": 1,
|
24043
24053
|
"id": 1,
|
24044
24054
|
"km": "reminders1",
|
24045
24055
|
"reminders": [
|
@@ -26896,6 +26906,7 @@
|
|
26896
26906
|
"km": "punctuation2"
|
26897
26907
|
},
|
26898
26908
|
"reminders1": {
|
26909
|
+
"current": 1,
|
26899
26910
|
"id": 1,
|
26900
26911
|
"km": "reminders1",
|
26901
26912
|
"reminders": [
|
@@ -26951,38 +26962,18 @@
|
|
26951
26962
|
"id": 1
|
26952
26963
|
},
|
26953
26964
|
"text": "go to europe",
|
26954
|
-
"who":
|
26955
|
-
|
26956
|
-
|
26957
|
-
|
26958
|
-
|
26959
|
-
|
26960
|
-
|
26961
|
-
|
26962
|
-
|
26963
|
-
|
26964
|
-
|
26965
|
-
|
26966
|
-
"text": "greg",
|
26967
|
-
"value": "greg",
|
26968
|
-
"word": "greg"
|
26969
|
-
},
|
26970
|
-
{
|
26971
|
-
"level": 0,
|
26972
|
-
"marker": "bob",
|
26973
|
-
"number": "one",
|
26974
|
-
"range": {
|
26975
|
-
"end": 18,
|
26976
|
-
"start": 16
|
26977
|
-
},
|
26978
|
-
"remindee_id": "bob",
|
26979
|
-
"text": "bob",
|
26980
|
-
"value": "bob",
|
26981
|
-
"word": "bob"
|
26982
|
-
}
|
26983
|
-
],
|
26984
|
-
"text": "greg and bob"
|
26985
|
-
}
|
26965
|
+
"who": [
|
26966
|
+
{
|
26967
|
+
"id": "greg",
|
26968
|
+
"remindee_id": "greg",
|
26969
|
+
"text": "greg"
|
26970
|
+
},
|
26971
|
+
{
|
26972
|
+
"id": "bob",
|
26973
|
+
"remindee_id": "bob",
|
26974
|
+
"text": "bob"
|
26975
|
+
}
|
26976
|
+
]
|
26986
26977
|
}
|
26987
26978
|
]
|
26988
26979
|
},
|
@@ -27047,38 +27038,18 @@
|
|
27047
27038
|
"id": 1
|
27048
27039
|
},
|
27049
27040
|
"text": "go to europe",
|
27050
|
-
"who":
|
27051
|
-
|
27052
|
-
|
27053
|
-
|
27054
|
-
|
27055
|
-
|
27056
|
-
|
27057
|
-
|
27058
|
-
|
27059
|
-
|
27060
|
-
|
27061
|
-
|
27062
|
-
"text": "greg",
|
27063
|
-
"value": "greg",
|
27064
|
-
"word": "greg"
|
27065
|
-
},
|
27066
|
-
{
|
27067
|
-
"level": 0,
|
27068
|
-
"marker": "bob",
|
27069
|
-
"number": "one",
|
27070
|
-
"range": {
|
27071
|
-
"end": 18,
|
27072
|
-
"start": 16
|
27073
|
-
},
|
27074
|
-
"remindee_id": "bob",
|
27075
|
-
"text": "bob",
|
27076
|
-
"value": "bob",
|
27077
|
-
"word": "bob"
|
27078
|
-
}
|
27079
|
-
],
|
27080
|
-
"text": "greg and bob"
|
27081
|
-
}
|
27041
|
+
"who": [
|
27042
|
+
{
|
27043
|
+
"id": "greg",
|
27044
|
+
"remindee_id": "greg",
|
27045
|
+
"text": "greg"
|
27046
|
+
},
|
27047
|
+
{
|
27048
|
+
"id": "bob",
|
27049
|
+
"remindee_id": "bob",
|
27050
|
+
"text": "bob"
|
27051
|
+
}
|
27052
|
+
]
|
27082
27053
|
}
|
27083
27054
|
],
|
27084
27055
|
"variables": {
|
package/package.json
CHANGED
@@ -341,8 +341,8 @@
|
|
341
341
|
"scriptjs": "^2.5.9",
|
342
342
|
"table": "^6.7.1",
|
343
343
|
"uuid": "^9.0.0",
|
344
|
-
"theprogrammablemind_4wp": "9.3.0-beta.
|
344
|
+
"theprogrammablemind_4wp": "9.3.0-beta.25"
|
345
345
|
},
|
346
|
-
"version": "9.3.0-beta.
|
346
|
+
"version": "9.3.0-beta.25",
|
347
347
|
"license": "UNLICENSED"
|
348
348
|
}
|