tpmkms_4wp 9.3.0-beta.35 → 9.3.0-beta.36
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/asking.js +4 -4
- package/common/dateTimeSelectors.instance.json +1 -1
- package/common/dateTimeSelectors.js +4 -4
- package/common/edible.instance.json +56 -0
- package/common/fastfood.instance.json +208 -36
- package/common/helpers/dateTimeSelectors.js +20 -8
- package/common/people.instance.json +0 -36
- package/common/reminders.instance.json +18 -1
- package/common/reminders.js +25 -7
- package/common/reminders.test.json +596 -23
- package/common/reports.instance.json +1 -1
- package/package.json +2 -2
package/common/asking.js
CHANGED
@@ -131,8 +131,8 @@ const getAsk = (config) => (uuid) => {
|
|
131
131
|
config.addSemantic({
|
132
132
|
uuid,
|
133
133
|
id: id_r,
|
134
|
-
|
135
|
-
tied_ids: s_ids,
|
134
|
+
tied_ids: [id_q],
|
135
|
+
// tied_ids: s_ids,
|
136
136
|
oneShot,
|
137
137
|
where: semantic.where || ask.where || where(2),
|
138
138
|
source: 'response',
|
@@ -148,8 +148,8 @@ const getAsk = (config) => (uuid) => {
|
|
148
148
|
uuid,
|
149
149
|
oneShot,
|
150
150
|
id: id_q,
|
151
|
-
|
152
|
-
tied_ids: s_ids,
|
151
|
+
tied_ids: id_rs,
|
152
|
+
// tied_ids: s_ids,
|
153
153
|
where: ask.where,
|
154
154
|
isQuestion: true, // do one question at a time
|
155
155
|
getWasAsked,
|
@@ -25,7 +25,7 @@
|
|
25
25
|
"semantics": [
|
26
26
|
{
|
27
27
|
"match": "({context, isA}) => (isA(context.marker, 'onDateValue_dates') || isA(context.marker, 'dateTimeSelector')) && !!context.evaluate",
|
28
|
-
"apply": "({context, isProcess, isTest, kms}) => {\n context.evalue = instantiate(kms, isProcess || isTest || context.isTest, context)\n }"
|
28
|
+
"apply": "({context, isProcess, isTest, kms, isA}) => {\n context.evalue = instantiate(kms, isA, isProcess || isTest || context.isTest, context)\n }"
|
29
29
|
}
|
30
30
|
]
|
31
31
|
}
|
@@ -22,9 +22,9 @@ const dateTimeSelectors_helpers = require('./helpers/dateTimeSelectors')
|
|
22
22
|
10 am
|
23
23
|
*/
|
24
24
|
|
25
|
-
function instantiate(kms, isProcessOrTest, dateTimeSelector) {
|
25
|
+
function instantiate(kms, isA, isProcessOrTest, dateTimeSelector) {
|
26
26
|
const now = kms.time.api.now()
|
27
|
-
return dateTimeSelectors_helpers.instantiate(now, dateTimeSelector)
|
27
|
+
return dateTimeSelectors_helpers.instantiate(isA, now, dateTimeSelector)
|
28
28
|
}
|
29
29
|
|
30
30
|
const template = {
|
@@ -46,8 +46,8 @@ const template = {
|
|
46
46
|
semantics: [
|
47
47
|
{
|
48
48
|
match: ({context, isA}) => (isA(context.marker, 'onDateValue_dates') || isA(context.marker, 'dateTimeSelector')) && !!context.evaluate,
|
49
|
-
apply: ({context, isProcess, isTest, kms}) => {
|
50
|
-
context.evalue = instantiate(kms, isProcess || isTest || context.isTest, context)
|
49
|
+
apply: ({context, isProcess, isTest, kms, isA}) => {
|
50
|
+
context.evalue = instantiate(kms, isA, isProcess || isTest || context.isTest, context)
|
51
51
|
},
|
52
52
|
}
|
53
53
|
],
|
@@ -45558,6 +45558,20 @@
|
|
45558
45558
|
0
|
45559
45559
|
]
|
45560
45560
|
],
|
45561
|
+
[
|
45562
|
+
[
|
45563
|
+
"a",
|
45564
|
+
0
|
45565
|
+
],
|
45566
|
+
[
|
45567
|
+
"is",
|
45568
|
+
0
|
45569
|
+
],
|
45570
|
+
[
|
45571
|
+
"unknown",
|
45572
|
+
0
|
45573
|
+
]
|
45574
|
+
],
|
45561
45575
|
[
|
45562
45576
|
[
|
45563
45577
|
"is",
|
@@ -48307,6 +48321,20 @@
|
|
48307
48321
|
0
|
48308
48322
|
]
|
48309
48323
|
],
|
48324
|
+
[
|
48325
|
+
[
|
48326
|
+
"a",
|
48327
|
+
0
|
48328
|
+
],
|
48329
|
+
[
|
48330
|
+
"is",
|
48331
|
+
0
|
48332
|
+
],
|
48333
|
+
[
|
48334
|
+
"unknown",
|
48335
|
+
0
|
48336
|
+
]
|
48337
|
+
],
|
48310
48338
|
[
|
48311
48339
|
[
|
48312
48340
|
"is",
|
@@ -68911,6 +68939,34 @@
|
|
68911
68939
|
0
|
68912
68940
|
]
|
68913
68941
|
],
|
68942
|
+
[
|
68943
|
+
[
|
68944
|
+
"a",
|
68945
|
+
0
|
68946
|
+
],
|
68947
|
+
[
|
68948
|
+
"is",
|
68949
|
+
0
|
68950
|
+
],
|
68951
|
+
[
|
68952
|
+
"unknown",
|
68953
|
+
0
|
68954
|
+
]
|
68955
|
+
],
|
68956
|
+
[
|
68957
|
+
[
|
68958
|
+
"a",
|
68959
|
+
0
|
68960
|
+
],
|
68961
|
+
[
|
68962
|
+
"is",
|
68963
|
+
0
|
68964
|
+
],
|
68965
|
+
[
|
68966
|
+
"unknown",
|
68967
|
+
0
|
68968
|
+
]
|
68969
|
+
],
|
68914
68970
|
[
|
68915
68971
|
[
|
68916
68972
|
"apple",
|
@@ -35,7 +35,7 @@ function getTime(time) {
|
|
35
35
|
const minute = 0
|
36
36
|
const second = 0
|
37
37
|
let hour_offset = 0
|
38
|
-
if (time.time
|
38
|
+
if (time.time?.ampm?.ampm == 'pm') {
|
39
39
|
hour_offset = 12
|
40
40
|
}
|
41
41
|
if (time.marker == 'integer') {
|
@@ -44,19 +44,31 @@ function getTime(time) {
|
|
44
44
|
hour = time.time.value
|
45
45
|
}
|
46
46
|
hour += hour_offset
|
47
|
+
if (time.hour) {
|
48
|
+
hour = time.hour
|
49
|
+
}
|
50
|
+
if (time.second) {
|
51
|
+
second = time.second
|
52
|
+
}
|
53
|
+
if (time.minute) {
|
54
|
+
minute = time.minute
|
55
|
+
}
|
47
56
|
return { hour, minute, second }
|
48
57
|
}
|
49
58
|
|
50
|
-
instantiate = (now, context) => {
|
51
|
-
if (context
|
59
|
+
instantiate = (isA, now, context) => {
|
60
|
+
if (isA(context?.marker, 'dateTimeSelector')) {
|
52
61
|
// (on date) OR (date)
|
53
62
|
const date = context.date?.date || context.date
|
54
63
|
const dateTimeSelector = getNextDayOfWeek(now, date.value)
|
55
|
-
const
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
64
|
+
const time = context.time || context.defaultTime
|
65
|
+
if (time) {
|
66
|
+
const hms = getTime(time)
|
67
|
+
dateTimeSelector.setHours(hms.hour)
|
68
|
+
dateTimeSelector.setMinutes(hms.minute)
|
69
|
+
dateTimeSelector.setSeconds(hms.second)
|
70
|
+
dateTimeSelector.setMilliseconds(0)
|
71
|
+
}
|
60
72
|
return dateTimeSelector.toISOString()
|
61
73
|
} else if (context.dateTimeSelector) {
|
62
74
|
const dateTimeSelector = getNextDayOfWeek(now, context.dateTimeSelector?.value)
|
@@ -8430,24 +8430,6 @@
|
|
8430
8430
|
0
|
8431
8431
|
]
|
8432
8432
|
],
|
8433
|
-
[
|
8434
|
-
[
|
8435
|
-
"by",
|
8436
|
-
0
|
8437
|
-
],
|
8438
|
-
[
|
8439
|
-
"isEd",
|
8440
|
-
0
|
8441
|
-
],
|
8442
|
-
[
|
8443
|
-
"owned",
|
8444
|
-
0
|
8445
|
-
],
|
8446
|
-
[
|
8447
|
-
"unknown",
|
8448
|
-
0
|
8449
|
-
]
|
8450
|
-
],
|
8451
8433
|
[
|
8452
8434
|
[
|
8453
8435
|
"isEd",
|
@@ -8846,24 +8828,6 @@
|
|
8846
8828
|
0
|
8847
8829
|
]
|
8848
8830
|
],
|
8849
|
-
[
|
8850
|
-
[
|
8851
|
-
"by",
|
8852
|
-
0
|
8853
|
-
],
|
8854
|
-
[
|
8855
|
-
"isEd",
|
8856
|
-
0
|
8857
|
-
],
|
8858
|
-
[
|
8859
|
-
"owned",
|
8860
|
-
0
|
8861
|
-
],
|
8862
|
-
[
|
8863
|
-
"unknown",
|
8864
|
-
0
|
8865
|
-
]
|
8866
|
-
],
|
8867
8831
|
[
|
8868
8832
|
[
|
8869
8833
|
"first",
|
@@ -11,6 +11,7 @@
|
|
11
11
|
"([remind] (remindable/*) (!@<= 'dateTimeSelector' && !@<= 'inAddition')*)",
|
12
12
|
"([remind:withDateBridge] (remindable/*) (!@<= 'dateTimeSelector' && !@<= 'inAddition')* (dateTimeSelector))",
|
13
13
|
"([remind:withDateAndTimeBridge] (remindable/*) (!@<= 'dateTimeSelector' && !@<= 'inAddition')* (dateTimeSelector) (atTime))",
|
14
|
+
"([remindResponse] (!@<= 'dateTimeSelector' && !@<= 'inAddition')* (dateTimeSelector))",
|
14
15
|
"([show] ([reminders]))",
|
15
16
|
"([delete_reminders|delete,cancel] (number/*))",
|
16
17
|
"([add] (remindable/*))",
|
@@ -60,6 +61,14 @@
|
|
60
61
|
"listable"
|
61
62
|
]
|
62
63
|
},
|
64
|
+
{
|
65
|
+
"id": "remindResponse",
|
66
|
+
"isA": [
|
67
|
+
"verb"
|
68
|
+
],
|
69
|
+
"bridge": "{ ...next(operator), operator: operator, reminder: after[0], date: after[1], interpolate: '${reminder} ${date}' }",
|
70
|
+
"semantic": "async ({context, api, gp, gsp}) => {\n const text = await gsp(context.reminder.slice(1));\n const update = { text }\n if (context.date) {\n update.dateTimeSelector = context.date\n update.dateTimeSelectorText = await gp(context.date)\n }\n await api.update(update)\n }"
|
71
|
+
},
|
63
72
|
{
|
64
73
|
"id": "remind",
|
65
74
|
"isA": [
|
@@ -76,7 +85,7 @@
|
|
76
85
|
"withDateBridge": "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], date: after[2], interpolate: '${operator} ${who} ${reminder} ${date}' }",
|
77
86
|
"withDateAndTimeBridge": "{ ...next(operator), operator: operator, who: after[0], reminder: after[1], date: after[2], time: after[3], interpolate: '${operator} ${who} ${reminder} ${date} ${time}' }",
|
78
87
|
"semantics": "[object Object]",
|
79
|
-
"semantic": "async ({ask, api, gsp, gp, context}) => {\n const who = api.contextToWho(context.who)\n let text;\n if (context.reminder) {\n text = await gsp(context.reminder.slice(1));\n }\n const reminder = { text, dateTimeSelector: context.date, who }\n if (context.date) {\n reminder.dateTimeSelector = context.date\n reminder.dateTimeSelectorText = await gp(context.date)\n }\n // await api.instantiate(reminder)\n await api.add(reminder)\n ask([\n query('missingReminder', reminder),\n query('missingDate', reminder),\n ])\n }"
|
88
|
+
"semantic": "async ({ask, api, gsp, gp, context}) => {\n const who = api.contextToWho(context.who)\n let text;\n if (context.reminder) {\n text = await gsp(context.reminder.slice(1));\n }\n const reminder = { text, dateTimeSelector: context.date, who }\n if (context.date) {\n reminder.dateTimeSelector = context.date\n reminder.dateTimeSelectorText = await gp(context.date)\n }\n // await api.instantiate(reminder)\n await api.add(reminder)\n reminder.cleanUp = ask([\n query('missingReminder', reminder.id),\n query('missingDate', reminder.id),\n ])\n }"
|
80
89
|
},
|
81
90
|
{
|
82
91
|
"id": "reminders",
|
@@ -116,6 +125,7 @@
|
|
116
125
|
"([remind] (remindable/*) (!@<= 'dateTimeSelector' && !@<= 'inAddition')*)",
|
117
126
|
"([remind:withDateBridge] (remindable/*) (!@<= 'dateTimeSelector' && !@<= 'inAddition')* (dateTimeSelector))",
|
118
127
|
"([remind:withDateAndTimeBridge] (remindable/*) (!@<= 'dateTimeSelector' && !@<= 'inAddition')* (dateTimeSelector) (atTime))",
|
128
|
+
"([remindResponse] (!@<= 'dateTimeSelector' && !@<= 'inAddition')* (dateTimeSelector))",
|
119
129
|
"([show] ([reminders]))",
|
120
130
|
"([delete_reminders|delete,cancel] (number/*))",
|
121
131
|
"([add] (remindable/*))",
|
@@ -162,6 +172,13 @@
|
|
162
172
|
"listable"
|
163
173
|
]
|
164
174
|
},
|
175
|
+
{
|
176
|
+
"id": "remindResponse",
|
177
|
+
"isA": [
|
178
|
+
"verb"
|
179
|
+
],
|
180
|
+
"bridge": "{ ...next(operator), operator: operator, reminder: after[0], date: after[1], interpolate: '${reminder} ${date}' }"
|
181
|
+
},
|
165
182
|
{
|
166
183
|
"id": "remind",
|
167
184
|
"isA": [
|
package/common/reminders.js
CHANGED
@@ -48,14 +48,13 @@ const query = (missing, reminder_id) => {
|
|
48
48
|
},
|
49
49
|
|
50
50
|
matchr: ({ isA, api, context }) => {
|
51
|
-
if (context.evaluate) {
|
51
|
+
if (context.evaluate || context.isControl || context.isResponse) {
|
52
52
|
return false
|
53
53
|
}
|
54
54
|
const gotADate = ((isA(context.marker, 'onDateValue_dates') || isA(context.marker, 'dateTimeSelector')) && api.missing(missing, reminder_id))
|
55
55
|
if (missing == 'missingDate') {
|
56
56
|
return gotADate
|
57
57
|
} else {
|
58
|
-
// debugger
|
59
58
|
// return !gotADate && !context.isControl
|
60
59
|
}
|
61
60
|
return false
|
@@ -73,6 +72,7 @@ class API {
|
|
73
72
|
this._objects.reminders = []
|
74
73
|
this._objects.id = 0
|
75
74
|
this._objects.current = null
|
75
|
+
this._objects.defaultTime = { hour: 9, minute: 0, second: 0, millisecond: 0 }
|
76
76
|
}
|
77
77
|
|
78
78
|
async add(reminder) {
|
@@ -84,7 +84,7 @@ class API {
|
|
84
84
|
this._objects.current = id
|
85
85
|
}
|
86
86
|
|
87
|
-
|
87
|
+
getCurrentId() {
|
88
88
|
return this._objects.current
|
89
89
|
}
|
90
90
|
|
@@ -115,6 +115,9 @@ class API {
|
|
115
115
|
}
|
116
116
|
|
117
117
|
async instantiate(reminder) {
|
118
|
+
if (reminder.dateTimeSelector) {
|
119
|
+
reminder.dateTimeSelector.defaultTime = this._objects.defaultTime
|
120
|
+
}
|
118
121
|
const value = await this.args.e(reminder.dateTimeSelector)
|
119
122
|
reminder.nextISODate = value?.evalue
|
120
123
|
}
|
@@ -131,10 +134,6 @@ class API {
|
|
131
134
|
}
|
132
135
|
}
|
133
136
|
|
134
|
-
// the user of the KM can override this. this can be used to sync the GUI and the LUI
|
135
|
-
getCurrent() {
|
136
|
-
}
|
137
|
-
|
138
137
|
missing(what, reminder_id) {
|
139
138
|
const reminder = this.reminder(reminder_id)
|
140
139
|
if (what == 'missingReminder' && !reminder.text) {
|
@@ -195,6 +194,9 @@ class API {
|
|
195
194
|
}
|
196
195
|
|
197
196
|
async update(update) {
|
197
|
+
if (!update.id) {
|
198
|
+
update.id = this.getCurrentId()
|
199
|
+
}
|
198
200
|
for (const item of this._objects.reminders) {
|
199
201
|
if (item.id == update.id) {
|
200
202
|
Object.assign(item, update)
|
@@ -218,6 +220,7 @@ const template = {
|
|
218
220
|
"([remind] (remindable/*) (!@<= 'dateTimeSelector' && !@<= 'inAddition')*)",
|
219
221
|
"([remind:withDateBridge] (remindable/*) (!@<= 'dateTimeSelector' && !@<= 'inAddition')* (dateTimeSelector))",
|
220
222
|
"([remind:withDateAndTimeBridge] (remindable/*) (!@<= 'dateTimeSelector' && !@<= 'inAddition')* (dateTimeSelector) (atTime))",
|
223
|
+
"([remindResponse] (!@<= 'dateTimeSelector' && !@<= 'inAddition')* (dateTimeSelector))",
|
221
224
|
"([show] ([reminders]))",
|
222
225
|
"([delete_reminders|delete,cancel] (number/*))",
|
223
226
|
"([add] (remindable/*))",
|
@@ -261,6 +264,21 @@ const template = {
|
|
261
264
|
id: 'remindable',
|
262
265
|
isA: ['listable'],
|
263
266
|
},
|
267
|
+
{
|
268
|
+
id: 'remindResponse',
|
269
|
+
isA: ['verb'],
|
270
|
+
// convolution: true,
|
271
|
+
bridge: "{ ...next(operator), operator: operator, reminder: after[0], date: after[1], interpolate: '${reminder} ${date}' }",
|
272
|
+
semantic: async ({context, api, gp, gsp}) => {
|
273
|
+
const text = await gsp(context.reminder.slice(1));
|
274
|
+
const update = { text }
|
275
|
+
if (context.date) {
|
276
|
+
update.dateTimeSelector = context.date
|
277
|
+
update.dateTimeSelectorText = await gp(context.date)
|
278
|
+
}
|
279
|
+
await api.update(update)
|
280
|
+
}
|
281
|
+
},
|
264
282
|
{
|
265
283
|
id: 'remind',
|
266
284
|
isA: ['verb'],
|