tpmkms_4wp 9.3.0-beta.46 → 9.3.0-beta.48

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.
@@ -3586,20 +3586,6 @@
3586
3586
  0
3587
3587
  ]
3588
3588
  ],
3589
- [
3590
- [
3591
- "is",
3592
- 0
3593
- ],
3594
- [
3595
- "list",
3596
- 1
3597
- ],
3598
- [
3599
- "unknown",
3600
- 0
3601
- ]
3602
- ],
3603
3589
  [
3604
3590
  [
3605
3591
  "is",
@@ -36049,20 +36035,6 @@
36049
36035
  0
36050
36036
  ]
36051
36037
  ],
36052
- [
36053
- [
36054
- "is",
36055
- 0
36056
- ],
36057
- [
36058
- "list",
36059
- 1
36060
- ],
36061
- [
36062
- "unknown",
36063
- 0
36064
- ]
36065
- ],
36066
36038
  [
36067
36039
  [
36068
36040
  "is",
@@ -2,9 +2,20 @@
2
2
  "configs": [
3
3
  {
4
4
  "operators": [
5
- "([dateTimeSelector] (onDate) (atTime))"
5
+ "([dateTimeSelector] (onDate) (atTime))",
6
+ "((day_dates/*) [dayOfMonth|of] (month_dates/*))"
6
7
  ],
7
8
  "bridges": [
9
+ {
10
+ "id": "dayOfMonth",
11
+ "after": [
12
+ "preposition"
13
+ ],
14
+ "before": [
15
+ "verb"
16
+ ],
17
+ "bridge": "{ ...next(operator), day: before[0], month: after[0], operator: operator, interpolate: '${day} ${operator} ${month}' }"
18
+ },
8
19
  {
9
20
  "id": "dateTimeSelector",
10
21
  "after": [
@@ -24,9 +35,15 @@
24
35
  ],
25
36
  "semantics": [
26
37
  {
27
- "match": "({context, isA}) => (isA(context.marker, 'onDateValue_dates') || isA(context.marker, 'dateTimeSelector')) && !!context.evaluate",
38
+ "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 }",
28
39
  "apply": "({context, isProcess, isTest, kms, isA}) => {\n context.evalue = instantiate(kms, isA, isProcess || isTest || context.isTest, context)\n }"
29
40
  }
41
+ ],
42
+ "hierarchy": [
43
+ [
44
+ "day_dates",
45
+ "orderable"
46
+ ]
30
47
  ]
31
48
  }
32
49
  ],
@@ -34,9 +51,20 @@
34
51
  {
35
52
  "extraConfig": true,
36
53
  "operators": [
37
- "([dateTimeSelector] (onDate) (atTime))"
54
+ "([dateTimeSelector] (onDate) (atTime))",
55
+ "((day_dates/*) [dayOfMonth|of] (month_dates/*))"
38
56
  ],
39
57
  "bridges": [
58
+ {
59
+ "id": "dayOfMonth",
60
+ "after": [
61
+ "preposition"
62
+ ],
63
+ "before": [
64
+ "verb"
65
+ ],
66
+ "bridge": "{ ...next(operator), day: before[0], month: after[0], operator: operator, interpolate: '${day} ${operator} ${month}' }"
67
+ },
40
68
  {
41
69
  "id": "dateTimeSelector",
42
70
  "after": [
@@ -56,6 +84,12 @@
56
84
  ],
57
85
  "semantics": [
58
86
  {}
87
+ ],
88
+ "hierarchy": [
89
+ [
90
+ "day_dates",
91
+ "orderable"
92
+ ]
59
93
  ]
60
94
  }
61
95
  ],
@@ -20,6 +20,7 @@ const dateTimeSelectors_helpers = require('./helpers/dateTimeSelectors')
20
20
  the last tuesday of every third month
21
21
  monday at 10 am
22
22
  10 am
23
+ first monday after jan 1
23
24
  */
24
25
 
25
26
  function instantiate(kms, isA, isProcessOrTest, dateTimeSelector) {
@@ -31,13 +32,37 @@ function instantiate(kms, isA, isProcessOrTest, dateTimeSelector) {
31
32
  }
32
33
  }
33
34
 
35
+ function removeDatesSuffix(str) {
36
+ if (str.endsWith('_dates')) {
37
+ return str.slice(0, -6); // Removes last 6 characters
38
+ }
39
+ return str;
40
+ }
41
+
42
+ function onOrIs(marker, context) {
43
+ if (context.marker === marker) {
44
+ return context
45
+ }
46
+ if (context.marker === 'onDate_dates' && context.date?.marker == marker) {
47
+ return context.date
48
+ }
49
+ }
50
+
34
51
  const template = {
35
52
  configs: [
36
53
  {
37
54
  operators: [
38
55
  "([dateTimeSelector] (onDate) (atTime))",
56
+ "((day_dates/*) [dayOfMonth|of] (month_dates/*))",
39
57
  ],
40
58
  bridges: [
59
+ {
60
+ id: 'dayOfMonth',
61
+ after: ['preposition'],
62
+ isA: ['onDateValue_dates'],
63
+ before: ['verb', 'onDate_dates'],
64
+ bridge: "{ ...next(operator), day: before[0], month: after[0], operator: operator, interpolate: '${day} ${operator} ${month}' }",
65
+ },
41
66
  {
42
67
  id: 'dateTimeSelector',
43
68
  after: ['preposition'],
@@ -49,12 +74,38 @@ const template = {
49
74
  ],
50
75
  semantics: [
51
76
  {
52
- match: ({context, isA}) => (isA(context.marker, 'onDateValue_dates') || isA(context.marker, 'dateTimeSelector')) && !!context.evaluate,
77
+ match: ({context, isA}) => context.evaluate && onOrIs('dayOfMonth', context),
78
+ apply: ({context, isProcess, isTest, kms, isA}) => {
79
+ try {
80
+ const now = kms.time.api.now()
81
+ const date = onOrIs('dayOfMonth', context)
82
+ debugger
83
+ context.evalue = dateTimeSelectors_helpers.getNthDayOfMonth(removeDatesSuffix(date.day.value), date.day.ordinal.value || 1, removeDatesSuffix(date.month.value), now)
84
+ } catch ( e ) {
85
+ context.evalue = `Implement instatiate for this type of date. See the dateTimeSelectors KM ${where()}. ${e}`
86
+ }
87
+ },
88
+ },
89
+ {
90
+ match: ({context, isA}) => {
91
+ if (!context.evaluate) {
92
+ return false
93
+ }
94
+ if (isA(context.marker, 'onDateValue_dates')) {
95
+ return true
96
+ }
97
+ if (isA(context.marker, 'dateTimeSelector')) {
98
+ return true
99
+ }
100
+ },
53
101
  apply: ({context, isProcess, isTest, kms, isA}) => {
54
102
  context.evalue = instantiate(kms, isA, isProcess || isTest || context.isTest, context)
55
103
  },
56
104
  }
57
105
  ],
106
+ hierarchy: [
107
+ ['day_dates', 'orderable'],
108
+ ],
58
109
  },
59
110
  ],
60
111
  }