tpmkms_4wp 9.3.0-beta.45 → 9.3.0-beta.47

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,27 @@ 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
+
34
42
  const template = {
35
43
  configs: [
36
44
  {
37
45
  operators: [
38
46
  "([dateTimeSelector] (onDate) (atTime))",
47
+ "((day_dates/*) [dayOfMonth|of] (month_dates/*))",
39
48
  ],
40
49
  bridges: [
50
+ {
51
+ id: 'dayOfMonth',
52
+ after: ['preposition'],
53
+ before: ['verb'],
54
+ bridge: "{ ...next(operator), day: before[0], month: after[0], operator: operator, interpolate: '${day} ${operator} ${month}' }",
55
+ },
41
56
  {
42
57
  id: 'dateTimeSelector',
43
58
  after: ['preposition'],
@@ -49,12 +64,38 @@ const template = {
49
64
  ],
50
65
  semantics: [
51
66
  {
52
- match: ({context, isA}) => (isA(context.marker, 'onDateValue_dates') || isA(context.marker, 'dateTimeSelector')) && !!context.evaluate,
67
+ evaluator: true,
68
+ match: ({context, isA}) => context.evaluate && context.marker === 'dayOfMonth',
69
+ apply: ({context, isProcess, isTest, kms, isA}) => {
70
+ debugger
71
+ try {
72
+ const now = kms.time.api.now()
73
+ context.evalue = dateTimeSelectors_helpers.getNthDayOfMonth(removeDatesSuffix(context.day.value), context.day.ordinal.value || 1, removeDatesSuffix(context.month.value), now)
74
+ } catch ( e ) {
75
+ context.evalue = `Implement instatiate for this type of date. See the dateTimeSelectors KM ${where()}. ${e}`
76
+ }
77
+ },
78
+ },
79
+ {
80
+ match: ({context, isA}) => {
81
+ if (!context.evaluate) {
82
+ return false
83
+ }
84
+ if (isA(context.marker, 'onDateValue_dates')) {
85
+ return true
86
+ }
87
+ if (isA(context.marker, 'dateTimeSelector')) {
88
+ return true
89
+ }
90
+ },
53
91
  apply: ({context, isProcess, isTest, kms, isA}) => {
54
92
  context.evalue = instantiate(kms, isA, isProcess || isTest || context.isTest, context)
55
93
  },
56
94
  }
57
95
  ],
96
+ hierarchy: [
97
+ ['day_dates', 'orderable'],
98
+ ],
58
99
  },
59
100
  ],
60
101
  }