tpmkms_4wp 9.3.0-beta.23 → 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/helpers/dialogues.js +2 -2
- package/common/reminders.js +40 -5
- package/common/reminders.test.json +49 -62
- package/package.json +2 -2
@@ -77,7 +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} = {}) {
|
80
|
+
makeObject({config, context, types=[], source_value=undefined, doPluralize=true, initial=''} = {}) {
|
81
81
|
if (typeof context == 'string') {
|
82
82
|
context = { word: context, value: context }
|
83
83
|
}
|
@@ -102,7 +102,7 @@ class API {
|
|
102
102
|
config.addOperator({ pattern: `(["${concept}"])`, allowDups: true })
|
103
103
|
config.addBridge({ id: concept, level: 0, bridge: `{ ...next(operator), value: or(operator.value, '${source_value || concept}') }` , allowDups: true })
|
104
104
|
const addConcept = (word, number) => {
|
105
|
-
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} }` } )
|
106
106
|
const baseTypes = [
|
107
107
|
'theAble',
|
108
108
|
'queryable',
|
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,29 @@ 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
|
-
this.args.makeObject({ ...this.args, context: { word: text, value: id, number: 'one' }, types: ['remindable'] })
|
55
|
+
this.args.makeObject({ ...this.args, context: { word: text, value: id, number: 'one', remindee_id: id }, initial: `remindee_id: "${id}"`, types: ['remindable'] })
|
41
56
|
}
|
42
57
|
|
43
58
|
async instantiate(reminder) {
|
@@ -45,6 +60,18 @@ class API {
|
|
45
60
|
reminder.nextISODate = value?.evalue
|
46
61
|
}
|
47
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
|
+
|
48
75
|
// the user of the KM can override this. this can be used to sync the GUI and the LUI
|
49
76
|
getCurrent() {
|
50
77
|
}
|
@@ -88,7 +115,6 @@ class API {
|
|
88
115
|
return
|
89
116
|
}
|
90
117
|
}
|
91
|
-
|
92
118
|
}
|
93
119
|
}
|
94
120
|
|
@@ -106,8 +132,17 @@ const template = {
|
|
106
132
|
"([remind:withDateAndTimeBridge] (remindable/*) (!@<= 'dateTimeSelector')* (dateTimeSelector) (atTime))",
|
107
133
|
"([show] ([reminders]))",
|
108
134
|
"([delete_reminders|delete,cancel] (number/*))",
|
135
|
+
"([add] (remindable/*))",
|
109
136
|
],
|
110
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
|
+
},
|
111
146
|
{
|
112
147
|
id: 'addRemindable',
|
113
148
|
isA: ['verb'],
|
@@ -130,7 +165,7 @@ const template = {
|
|
130
165
|
withDateAndTimeBridge: "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], date: after[2], time: after[3], interpolate: '${operator} ${who} ${reminder} ${date} ${time}' }",
|
131
166
|
semantic: async ({api, gsp, gp, context}) => {
|
132
167
|
const text = await gsp(context.reminder.slice(1));
|
133
|
-
const who =
|
168
|
+
const who = api.contextToWho(context.who)
|
134
169
|
const reminder = { text, dateTimeSelector: context.date, who }
|
135
170
|
if (context.date) {
|
136
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": [
|
@@ -13643,6 +13648,7 @@
|
|
13643
13648
|
"context_index": 1,
|
13644
13649
|
"dead": true,
|
13645
13650
|
"default": true,
|
13651
|
+
"flatten": true,
|
13646
13652
|
"interpolate": "${operator} ${arg}",
|
13647
13653
|
"level": 1,
|
13648
13654
|
"marker": "addRemindable",
|
@@ -14356,6 +14362,7 @@
|
|
14356
14362
|
"km": "punctuation2"
|
14357
14363
|
},
|
14358
14364
|
"reminders1": {
|
14365
|
+
"current": null,
|
14359
14366
|
"id": 0,
|
14360
14367
|
"km": "reminders1",
|
14361
14368
|
"reminders": [
|
@@ -14407,6 +14414,7 @@
|
|
14407
14414
|
"context_index": 1,
|
14408
14415
|
"dead": true,
|
14409
14416
|
"default": true,
|
14417
|
+
"flatten": true,
|
14410
14418
|
"interpolate": "${operator} ${arg}",
|
14411
14419
|
"level": 1,
|
14412
14420
|
"marker": "addRemindable",
|
@@ -15485,6 +15493,7 @@
|
|
15485
15493
|
"context_index": 1,
|
15486
15494
|
"dead": true,
|
15487
15495
|
"default": true,
|
15496
|
+
"flatten": true,
|
15488
15497
|
"interpolate": "${operator} ${arg}",
|
15489
15498
|
"level": 1,
|
15490
15499
|
"marker": "addRemindable",
|
@@ -16219,6 +16228,7 @@
|
|
16219
16228
|
"km": "punctuation2"
|
16220
16229
|
},
|
16221
16230
|
"reminders1": {
|
16231
|
+
"current": null,
|
16222
16232
|
"id": 0,
|
16223
16233
|
"km": "reminders1",
|
16224
16234
|
"reminders": [
|
@@ -16283,6 +16293,7 @@
|
|
16283
16293
|
"context_index": 1,
|
16284
16294
|
"dead": true,
|
16285
16295
|
"default": true,
|
16296
|
+
"flatten": true,
|
16286
16297
|
"interpolate": "${operator} ${arg}",
|
16287
16298
|
"level": 1,
|
16288
16299
|
"marker": "addRemindable",
|
@@ -17460,6 +17471,7 @@
|
|
17460
17471
|
"context_index": 1,
|
17461
17472
|
"dead": true,
|
17462
17473
|
"default": true,
|
17474
|
+
"flatten": true,
|
17463
17475
|
"interpolate": "${operator} ${arg}",
|
17464
17476
|
"level": 1,
|
17465
17477
|
"marker": "addRemindable",
|
@@ -17599,6 +17611,7 @@
|
|
17599
17611
|
"end": 20,
|
17600
17612
|
"start": 7
|
17601
17613
|
},
|
17614
|
+
"remindee_id": "greg mcclement",
|
17602
17615
|
"text": "greg mcclement",
|
17603
17616
|
"types": [
|
17604
17617
|
"greg mcclement"
|
@@ -18452,6 +18465,7 @@
|
|
18452
18465
|
"km": "punctuation2"
|
18453
18466
|
},
|
18454
18467
|
"reminders1": {
|
18468
|
+
"current": 1,
|
18455
18469
|
"id": 1,
|
18456
18470
|
"km": "reminders1",
|
18457
18471
|
"reminders": [
|
@@ -18509,6 +18523,7 @@
|
|
18509
18523
|
"text": "go",
|
18510
18524
|
"who": {
|
18511
18525
|
"id": "greg mcclement",
|
18526
|
+
"remindee_id": "greg mcclement",
|
18512
18527
|
"text": "greg mcclement"
|
18513
18528
|
}
|
18514
18529
|
}
|
@@ -18577,6 +18592,7 @@
|
|
18577
18592
|
"text": "go",
|
18578
18593
|
"who": {
|
18579
18594
|
"id": "greg mcclement",
|
18595
|
+
"remindee_id": "greg mcclement",
|
18580
18596
|
"text": "greg mcclement"
|
18581
18597
|
}
|
18582
18598
|
}
|
@@ -18707,6 +18723,7 @@
|
|
18707
18723
|
"end": 20,
|
18708
18724
|
"start": 7
|
18709
18725
|
},
|
18726
|
+
"remindee_id": "greg mcclement",
|
18710
18727
|
"text": "greg mcclement",
|
18711
18728
|
"types": [
|
18712
18729
|
"greg mcclement"
|
@@ -18760,6 +18777,7 @@
|
|
18760
18777
|
"context_index": 1,
|
18761
18778
|
"dead": true,
|
18762
18779
|
"default": true,
|
18780
|
+
"flatten": true,
|
18763
18781
|
"interpolate": "${operator} ${arg}",
|
18764
18782
|
"level": 1,
|
18765
18783
|
"marker": "addRemindable",
|
@@ -21340,6 +21358,7 @@
|
|
21340
21358
|
"km": "punctuation2"
|
21341
21359
|
},
|
21342
21360
|
"reminders1": {
|
21361
|
+
"current": 1,
|
21343
21362
|
"id": 1,
|
21344
21363
|
"km": "reminders1",
|
21345
21364
|
"reminders": [
|
@@ -23186,7 +23205,6 @@
|
|
23186
23205
|
]
|
23187
23206
|
}
|
23188
23207
|
],
|
23189
|
-
"developerTest": false,
|
23190
23208
|
"generatedParenthesized": [
|
23191
23209
|
"",
|
23192
23210
|
"(When should I remind you to go)",
|
@@ -24031,6 +24049,7 @@
|
|
24031
24049
|
"km": "punctuation2"
|
24032
24050
|
},
|
24033
24051
|
"reminders1": {
|
24052
|
+
"current": 1,
|
24034
24053
|
"id": 1,
|
24035
24054
|
"km": "reminders1",
|
24036
24055
|
"reminders": [
|
@@ -25856,6 +25875,7 @@
|
|
25856
25875
|
"end": 10,
|
25857
25876
|
"start": 7
|
25858
25877
|
},
|
25878
|
+
"remindee_id": "greg",
|
25859
25879
|
"text": "greg",
|
25860
25880
|
"value": "greg",
|
25861
25881
|
"word": "greg"
|
@@ -25868,6 +25888,7 @@
|
|
25868
25888
|
"end": 18,
|
25869
25889
|
"start": 16
|
25870
25890
|
},
|
25891
|
+
"remindee_id": "bob",
|
25871
25892
|
"text": "bob",
|
25872
25893
|
"value": "bob",
|
25873
25894
|
"word": "bob"
|
@@ -25878,7 +25899,6 @@
|
|
25878
25899
|
"word": "remind"
|
25879
25900
|
}
|
25880
25901
|
],
|
25881
|
-
"developerTest": false,
|
25882
25902
|
"generatedParenthesized": [
|
25883
25903
|
"",
|
25884
25904
|
""
|
@@ -26886,6 +26906,7 @@
|
|
26886
26906
|
"km": "punctuation2"
|
26887
26907
|
},
|
26888
26908
|
"reminders1": {
|
26909
|
+
"current": 1,
|
26889
26910
|
"id": 1,
|
26890
26911
|
"km": "reminders1",
|
26891
26912
|
"reminders": [
|
@@ -26941,36 +26962,18 @@
|
|
26941
26962
|
"id": 1
|
26942
26963
|
},
|
26943
26964
|
"text": "go to europe",
|
26944
|
-
"who":
|
26945
|
-
|
26946
|
-
|
26947
|
-
|
26948
|
-
|
26949
|
-
|
26950
|
-
|
26951
|
-
|
26952
|
-
|
26953
|
-
|
26954
|
-
|
26955
|
-
|
26956
|
-
"value": "greg",
|
26957
|
-
"word": "greg"
|
26958
|
-
},
|
26959
|
-
{
|
26960
|
-
"level": 0,
|
26961
|
-
"marker": "bob",
|
26962
|
-
"number": "one",
|
26963
|
-
"range": {
|
26964
|
-
"end": 18,
|
26965
|
-
"start": 16
|
26966
|
-
},
|
26967
|
-
"text": "bob",
|
26968
|
-
"value": "bob",
|
26969
|
-
"word": "bob"
|
26970
|
-
}
|
26971
|
-
],
|
26972
|
-
"text": "greg and bob"
|
26973
|
-
}
|
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
|
+
]
|
26974
26977
|
}
|
26975
26978
|
]
|
26976
26979
|
},
|
@@ -27035,36 +27038,18 @@
|
|
27035
27038
|
"id": 1
|
27036
27039
|
},
|
27037
27040
|
"text": "go to europe",
|
27038
|
-
"who":
|
27039
|
-
|
27040
|
-
|
27041
|
-
|
27042
|
-
|
27043
|
-
|
27044
|
-
|
27045
|
-
|
27046
|
-
|
27047
|
-
|
27048
|
-
|
27049
|
-
|
27050
|
-
"value": "greg",
|
27051
|
-
"word": "greg"
|
27052
|
-
},
|
27053
|
-
{
|
27054
|
-
"level": 0,
|
27055
|
-
"marker": "bob",
|
27056
|
-
"number": "one",
|
27057
|
-
"range": {
|
27058
|
-
"end": 18,
|
27059
|
-
"start": 16
|
27060
|
-
},
|
27061
|
-
"text": "bob",
|
27062
|
-
"value": "bob",
|
27063
|
-
"word": "bob"
|
27064
|
-
}
|
27065
|
-
],
|
27066
|
-
"text": "greg and bob"
|
27067
|
-
}
|
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
|
+
]
|
27068
27053
|
}
|
27069
27054
|
],
|
27070
27055
|
"variables": {
|
@@ -27236,6 +27221,7 @@
|
|
27236
27221
|
"end": 10,
|
27237
27222
|
"start": 7
|
27238
27223
|
},
|
27224
|
+
"remindee_id": "greg",
|
27239
27225
|
"text": "greg",
|
27240
27226
|
"value": "greg",
|
27241
27227
|
"word": "greg"
|
@@ -27248,6 +27234,7 @@
|
|
27248
27234
|
"end": 18,
|
27249
27235
|
"start": 16
|
27250
27236
|
},
|
27237
|
+
"remindee_id": "bob",
|
27251
27238
|
"text": "bob",
|
27252
27239
|
"value": "bob",
|
27253
27240
|
"word": "bob"
|
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
|
}
|