tpmkms_4wp 9.3.0-beta.50 → 9.3.0-beta.52

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.
@@ -3,13 +3,14 @@
3
3
  {
4
4
  "operators": [
5
5
  "([dateTimeSelector] (onDate) (atTime))",
6
- "((day_dates/*) [dayOfMonth|of] (month_dates/*))"
6
+ "((day_dates/*) [dayOfMonth|of] (month_dates/*))",
7
+ "((day_dates/*) [dayAfterDate|after] (afterDateValue_dates/*))"
7
8
  ],
8
9
  "bridges": [
9
10
  {
10
11
  "id": "dayOfMonth",
11
12
  "after": [
12
- "preposition"
13
+ "article"
13
14
  ],
14
15
  "isA": [
15
16
  "onDateValue_dates"
@@ -20,6 +21,21 @@
20
21
  ],
21
22
  "bridge": "{ ...next(operator), day: before[0], month: after[0], operator: operator, interpolate: '${day} ${operator} ${month}' }"
22
23
  },
24
+ {
25
+ "id": "dayAfterDate",
26
+ "after": [
27
+ "article",
28
+ "monthDayYear_dates"
29
+ ],
30
+ "isA": [
31
+ "onDateValue_dates"
32
+ ],
33
+ "before": [
34
+ "verb",
35
+ "afterDate_dates"
36
+ ],
37
+ "bridge": "{ ...next(operator), day: before[0], after: after[0], operator: operator, interpolate: '${day} ${operator} ${after}' }"
38
+ },
23
39
  {
24
40
  "id": "dateTimeSelector",
25
41
  "after": [
@@ -38,9 +54,13 @@
38
54
  }
39
55
  ],
40
56
  "semantics": [
57
+ {
58
+ "match": "({context, isA}) => context.evaluate && onOrIs('dayAfterDate', context)",
59
+ "apply": "async ({context, isProcess, isTest, kms, isA, e}) => {\n try {\n const now = kms.time.api.now()\n const date = afterOrIs('dayAfterDate', context)\n const afterISO = (await e(date.after)).evalue\n const day_ordinal = date.day.day_ordinal\n const ordinal = date.day.ordinal.value\n context.evalue = dateTimeSelectors_helpers.getNthWeekdayAfterDate(afterISO, day_ordinal, ordinal)\n } catch ( e ) {\n context.evalue = `Implement instatiate for this type of date. See the dateTimeSelectors KM ${where()}. ${e}`\n }\n }"
60
+ },
41
61
  {
42
62
  "match": "({context, isA}) => context.evaluate && onOrIs('dayOfMonth', context)",
43
- "apply": "({context, isProcess, isTest, kms, isA}) => {\n try {\n const now = kms.time.api.now()\n const date = onOrIs('dayOfMonth', context)\n debugger\n context.evalue = dateTimeSelectors_helpers.getNthDayOfMonth(removeDatesSuffix(date.day.value), date.day.ordinal.value || 1, removeDatesSuffix(date.month.value), now)\n } catch ( e ) {\n context.evalue = `Implement instatiate for this type of date. See the dateTimeSelectors KM ${where()}. ${e}`\n }\n }"
63
+ "apply": "({context, isProcess, isTest, kms, isA}) => {\n try {\n const now = kms.time.api.now()\n const date = onOrIs('dayOfMonth', context)\n context.evalue = dateTimeSelectors_helpers.getNthDayOfMonth(removeDatesSuffix(date.day.value), date.day.ordinal.value || 1, removeDatesSuffix(date.month.value), now)\n } catch ( e ) {\n context.evalue = `Implement instatiate for this type of date. See the dateTimeSelectors KM ${where()}. ${e}`\n }\n }"
44
64
  },
45
65
  {
46
66
  "match": "({context, isA}) => {\n if (!context.evaluate) {\n return false\n }\n if (isA(context.marker, 'onDateValue_dates')) {\n return true\n }\n if (isA(context.marker, 'dateTimeSelector')) {\n return true\n }\n }",
@@ -60,13 +80,14 @@
60
80
  "extraConfig": true,
61
81
  "operators": [
62
82
  "([dateTimeSelector] (onDate) (atTime))",
63
- "((day_dates/*) [dayOfMonth|of] (month_dates/*))"
83
+ "((day_dates/*) [dayOfMonth|of] (month_dates/*))",
84
+ "((day_dates/*) [dayAfterDate|after] (afterDateValue_dates/*))"
64
85
  ],
65
86
  "bridges": [
66
87
  {
67
88
  "id": "dayOfMonth",
68
89
  "after": [
69
- "preposition"
90
+ "article"
70
91
  ],
71
92
  "isA": [
72
93
  "onDateValue_dates"
@@ -77,6 +98,21 @@
77
98
  ],
78
99
  "bridge": "{ ...next(operator), day: before[0], month: after[0], operator: operator, interpolate: '${day} ${operator} ${month}' }"
79
100
  },
101
+ {
102
+ "id": "dayAfterDate",
103
+ "after": [
104
+ "article",
105
+ "monthDayYear_dates"
106
+ ],
107
+ "isA": [
108
+ "onDateValue_dates"
109
+ ],
110
+ "before": [
111
+ "verb",
112
+ "afterDate_dates"
113
+ ],
114
+ "bridge": "{ ...next(operator), day: before[0], after: after[0], operator: operator, interpolate: '${day} ${operator} ${after}' }"
115
+ },
80
116
  {
81
117
  "id": "dateTimeSelector",
82
118
  "after": [
@@ -95,6 +131,7 @@
95
131
  }
96
132
  ],
97
133
  "semantics": [
134
+ {},
98
135
  {},
99
136
  {}
100
137
  ],
@@ -26,6 +26,7 @@ const dateTimeSelectors_helpers = require('./helpers/dateTimeSelectors')
26
26
  function instantiate(kms, isA, isProcessOrTest, dateTimeSelector) {
27
27
  try {
28
28
  const now = kms.time.api.now()
29
+ debugger
29
30
  return dateTimeSelectors_helpers.instantiate(isA, now, dateTimeSelector)
30
31
  } catch ( e ) {
31
32
  return `Implement instatiate for this type of date. See the dateTimeSelectors KM ${where()}`
@@ -52,7 +53,7 @@ function afterOrIs(marker, context) {
52
53
  if (context.marker === marker) {
53
54
  return context
54
55
  }
55
- if (context.marker === 'afterDate_dates' && context.date?.marker == marker) {
56
+ if (context.marker === 'onDate_dates' && context.date?.marker == marker) {
56
57
  return context.date
57
58
  }
58
59
  }
@@ -76,7 +77,7 @@ const template = {
76
77
  {
77
78
  id: 'dayAfterDate',
78
79
  after: ['article', 'monthDayYear_dates'],
79
- isA: ['afterDateValue_dates'],
80
+ isA: ['onDateValue_dates'],
80
81
  before: ['verb', 'afterDate_dates'],
81
82
  bridge: "{ ...next(operator), day: before[0], after: after[0], operator: operator, interpolate: '${day} ${operator} ${after}' }",
82
83
  },
@@ -92,12 +93,14 @@ const template = {
92
93
  semantics: [
93
94
  {
94
95
  match: ({context, isA}) => context.evaluate && onOrIs('dayAfterDate', context),
95
- apply: ({context, isProcess, isTest, kms, isA}) => {
96
+ apply: async ({context, isProcess, isTest, kms, isA, e}) => {
96
97
  try {
97
98
  const now = kms.time.api.now()
98
- debugger
99
- const date = afterOrIs('dayOfMonth', context)
100
- context.evalue = dateTimeSelectors_helpers.getNthDayOfMonth(removeDatesSuffix(date.day.value), date.day.ordinal.value || 1, removeDatesSuffix(date.month.value), now)
99
+ const date = afterOrIs('dayAfterDate', context)
100
+ const afterISO = (await e(date.after)).evalue
101
+ const day_ordinal = date.day.day_ordinal
102
+ const ordinal = date.day.ordinal.value
103
+ context.evalue = dateTimeSelectors_helpers.getNthWeekdayAfterDate(afterISO, day_ordinal, ordinal)
101
104
  } catch ( e ) {
102
105
  context.evalue = `Implement instatiate for this type of date. See the dateTimeSelectors KM ${where()}. ${e}`
103
106
  }
@@ -152,10 +155,15 @@ knowledgeModule( {
152
155
  context: defaultContextCheck([
153
156
  'date', 'time', 'response',
154
157
  {
158
+ after: {
159
+ day: [{ variable: 'defaults' }],
160
+ month: [{ variable: 'defaults' }, 'month_ordinal'],
161
+ year: { variable: 'defaults' },
162
+ },
155
163
  value: {
156
- date: 'defaults',
157
- time: 'defaults',
158
- evalue: 'defaults'
164
+ date: { variable: 'defaults' },
165
+ time: { variable: 'defaults' },
166
+ evalue: { variable: 'defaults' },
159
167
  },
160
168
  }
161
169
  ]),