tpmkms_4wp 9.3.0-beta.34 → 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 CHANGED
@@ -131,8 +131,8 @@ const getAsk = (config) => (uuid) => {
131
131
  config.addSemantic({
132
132
  uuid,
133
133
  id: id_r,
134
- // tied_ids: [id_q],
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
- // tied_ids: id_rs,
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
  ],
@@ -97389,6 +97389,24 @@
97389
97389
  1
97390
97390
  ]
97391
97391
  ],
97392
+ [
97393
+ [
97394
+ "countable",
97395
+ 0
97396
+ ],
97397
+ [
97398
+ "is",
97399
+ 0
97400
+ ],
97401
+ [
97402
+ "list",
97403
+ 1
97404
+ ],
97405
+ [
97406
+ "strawberry",
97407
+ 0
97408
+ ]
97409
+ ],
97392
97410
  [
97393
97411
  [
97394
97412
  "countable",
@@ -137495,6 +137513,60 @@
137495
137513
  0
137496
137514
  ]
137497
137515
  ],
137516
+ [
137517
+ [
137518
+ "asiago",
137519
+ 0
137520
+ ],
137521
+ [
137522
+ "chicken",
137523
+ 0
137524
+ ],
137525
+ [
137526
+ "club",
137527
+ 0
137528
+ ],
137529
+ [
137530
+ "cod",
137531
+ 0
137532
+ ],
137533
+ [
137534
+ "comma",
137535
+ 0
137536
+ ],
137537
+ [
137538
+ "grill",
137539
+ 0
137540
+ ],
137541
+ [
137542
+ "is",
137543
+ 0
137544
+ ],
137545
+ [
137546
+ "list",
137547
+ 0
137548
+ ],
137549
+ [
137550
+ "premium",
137551
+ 0
137552
+ ],
137553
+ [
137554
+ "ranch",
137555
+ 0
137556
+ ],
137557
+ [
137558
+ "sandwich",
137559
+ 0
137560
+ ],
137561
+ [
137562
+ "ultimate",
137563
+ 0
137564
+ ],
137565
+ [
137566
+ "unknown",
137567
+ 0
137568
+ ]
137569
+ ],
137498
137570
  [
137499
137571
  [
137500
137572
  "chicken",
@@ -137739,6 +137811,24 @@
137739
137811
  0
137740
137812
  ]
137741
137813
  ],
137814
+ [
137815
+ [
137816
+ "is",
137817
+ 0
137818
+ ],
137819
+ [
137820
+ "list",
137821
+ 1
137822
+ ],
137823
+ [
137824
+ "sandwich",
137825
+ 0
137826
+ ],
137827
+ [
137828
+ "unknown",
137829
+ 0
137830
+ ]
137831
+ ],
137742
137832
  [
137743
137833
  [
137744
137834
  "is",
@@ -151158,6 +151248,20 @@
151158
151248
  0
151159
151249
  ]
151160
151250
  ],
151251
+ [
151252
+ [
151253
+ "a",
151254
+ 0
151255
+ ],
151256
+ [
151257
+ "is",
151258
+ 0
151259
+ ],
151260
+ [
151261
+ "unknown",
151262
+ 0
151263
+ ]
151264
+ ],
151161
151265
  [
151162
151266
  [
151163
151267
  "is",
@@ -347789,24 +347893,6 @@
347789
347893
  0
347790
347894
  ]
347791
347895
  ],
347792
- [
347793
- [
347794
- "breakfast",
347795
- 0
347796
- ],
347797
- [
347798
- "is",
347799
- 0
347800
- ],
347801
- [
347802
- "list",
347803
- 1
347804
- ],
347805
- [
347806
- "meal",
347807
- 0
347808
- ]
347809
- ],
347810
347896
  [
347811
347897
  [
347812
347898
  "is",
@@ -609634,6 +609720,20 @@
609634
609720
  0
609635
609721
  ]
609636
609722
  ],
609723
+ [
609724
+ [
609725
+ "a",
609726
+ 0
609727
+ ],
609728
+ [
609729
+ "is",
609730
+ 0
609731
+ ],
609732
+ [
609733
+ "unknown",
609734
+ 0
609735
+ ]
609736
+ ],
609637
609737
  [
609638
609738
  [
609639
609739
  "apple",
@@ -609720,6 +609820,60 @@
609720
609820
  0
609721
609821
  ]
609722
609822
  ],
609823
+ [
609824
+ [
609825
+ "asiago",
609826
+ 0
609827
+ ],
609828
+ [
609829
+ "chicken",
609830
+ 0
609831
+ ],
609832
+ [
609833
+ "club",
609834
+ 0
609835
+ ],
609836
+ [
609837
+ "cod",
609838
+ 0
609839
+ ],
609840
+ [
609841
+ "comma",
609842
+ 0
609843
+ ],
609844
+ [
609845
+ "grill",
609846
+ 0
609847
+ ],
609848
+ [
609849
+ "is",
609850
+ 0
609851
+ ],
609852
+ [
609853
+ "list",
609854
+ 0
609855
+ ],
609856
+ [
609857
+ "premium",
609858
+ 0
609859
+ ],
609860
+ [
609861
+ "ranch",
609862
+ 0
609863
+ ],
609864
+ [
609865
+ "sandwich",
609866
+ 0
609867
+ ],
609868
+ [
609869
+ "ultimate",
609870
+ 0
609871
+ ],
609872
+ [
609873
+ "unknown",
609874
+ 0
609875
+ ]
609876
+ ],
609723
609877
  [
609724
609878
  [
609725
609879
  "bacon",
@@ -611462,24 +611616,6 @@
611462
611616
  0
611463
611617
  ]
611464
611618
  ],
611465
- [
611466
- [
611467
- "breakfast",
611468
- 0
611469
- ],
611470
- [
611471
- "is",
611472
- 0
611473
- ],
611474
- [
611475
- "list",
611476
- 1
611477
- ],
611478
- [
611479
- "meal",
611480
- 0
611481
- ]
611482
- ],
611483
611619
  [
611484
611620
  [
611485
611621
  "breakfast",
@@ -612966,6 +613102,24 @@
612966
613102
  0
612967
613103
  ]
612968
613104
  ],
613105
+ [
613106
+ [
613107
+ "countable",
613108
+ 0
613109
+ ],
613110
+ [
613111
+ "is",
613112
+ 0
613113
+ ],
613114
+ [
613115
+ "list",
613116
+ 1
613117
+ ],
613118
+ [
613119
+ "strawberry",
613120
+ 0
613121
+ ]
613122
+ ],
612969
613123
  [
612970
613124
  [
612971
613125
  "double",
@@ -613734,6 +613888,24 @@
613734
613888
  0
613735
613889
  ]
613736
613890
  ],
613891
+ [
613892
+ [
613893
+ "is",
613894
+ 0
613895
+ ],
613896
+ [
613897
+ "list",
613898
+ 1
613899
+ ],
613900
+ [
613901
+ "sandwich",
613902
+ 0
613903
+ ],
613904
+ [
613905
+ "unknown",
613906
+ 0
613907
+ ]
613908
+ ],
613737
613909
  [
613738
613910
  [
613739
613911
  "is",
@@ -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.ampm.ampm == 'pm') {
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.marker == 'dateTimeSelector') {
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 hms = getTime(context.time)
56
- dateTimeSelector.setHours(hms.hour)
57
- dateTimeSelector.setMinutes(hms.minute)
58
- dateTimeSelector.setSeconds(hms.second)
59
- dateTimeSelector.setMilliseconds(0)
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": [
@@ -48,11 +48,13 @@ const query = (missing, reminder_id) => {
48
48
  },
49
49
 
50
50
  matchr: ({ isA, api, context }) => {
51
+ if (context.evaluate || context.isControl || context.isResponse) {
52
+ return false
53
+ }
51
54
  const gotADate = ((isA(context.marker, 'onDateValue_dates') || isA(context.marker, 'dateTimeSelector')) && api.missing(missing, reminder_id))
52
55
  if (missing == 'missingDate') {
53
56
  return gotADate
54
57
  } else {
55
- // debugger
56
58
  // return !gotADate && !context.isControl
57
59
  }
58
60
  return false
@@ -70,6 +72,7 @@ class API {
70
72
  this._objects.reminders = []
71
73
  this._objects.id = 0
72
74
  this._objects.current = null
75
+ this._objects.defaultTime = { hour: 9, minute: 0, second: 0, millisecond: 0 }
73
76
  }
74
77
 
75
78
  async add(reminder) {
@@ -81,7 +84,7 @@ class API {
81
84
  this._objects.current = id
82
85
  }
83
86
 
84
- getCurrent() {
87
+ getCurrentId() {
85
88
  return this._objects.current
86
89
  }
87
90
 
@@ -112,6 +115,9 @@ class API {
112
115
  }
113
116
 
114
117
  async instantiate(reminder) {
118
+ if (reminder.dateTimeSelector) {
119
+ reminder.dateTimeSelector.defaultTime = this._objects.defaultTime
120
+ }
115
121
  const value = await this.args.e(reminder.dateTimeSelector)
116
122
  reminder.nextISODate = value?.evalue
117
123
  }
@@ -128,10 +134,6 @@ class API {
128
134
  }
129
135
  }
130
136
 
131
- // the user of the KM can override this. this can be used to sync the GUI and the LUI
132
- getCurrent() {
133
- }
134
-
135
137
  missing(what, reminder_id) {
136
138
  const reminder = this.reminder(reminder_id)
137
139
  if (what == 'missingReminder' && !reminder.text) {
@@ -192,6 +194,9 @@ class API {
192
194
  }
193
195
 
194
196
  async update(update) {
197
+ if (!update.id) {
198
+ update.id = this.getCurrentId()
199
+ }
195
200
  for (const item of this._objects.reminders) {
196
201
  if (item.id == update.id) {
197
202
  Object.assign(item, update)
@@ -215,6 +220,7 @@ const template = {
215
220
  "([remind] (remindable/*) (!@<= 'dateTimeSelector' && !@<= 'inAddition')*)",
216
221
  "([remind:withDateBridge] (remindable/*) (!@<= 'dateTimeSelector' && !@<= 'inAddition')* (dateTimeSelector))",
217
222
  "([remind:withDateAndTimeBridge] (remindable/*) (!@<= 'dateTimeSelector' && !@<= 'inAddition')* (dateTimeSelector) (atTime))",
223
+ "([remindResponse] (!@<= 'dateTimeSelector' && !@<= 'inAddition')* (dateTimeSelector))",
218
224
  "([show] ([reminders]))",
219
225
  "([delete_reminders|delete,cancel] (number/*))",
220
226
  "([add] (remindable/*))",
@@ -258,6 +264,21 @@ const template = {
258
264
  id: 'remindable',
259
265
  isA: ['listable'],
260
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
+ },
261
282
  {
262
283
  id: 'remind',
263
284
  isA: ['verb'],