@outliant/sunrise-utils 1.2.5 → 1.3.0
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/CHANGELOG.md +7 -0
- package/helpers/projectFilter/index.js +6 -3
- package/helpers/projectFilter/isGeneratedFilter.js +43 -0
- package/helpers/projectFilter/isPausedFilter.js +43 -0
- package/helpers/projectFilter/onHoldFilter.js +45 -0
- package/helpers/projectFilter/projectFieldFilter.js +7 -18
- package/helpers/taskFilter/index.js +9 -3
- package/helpers/taskFilter/isPausedFilter.js +46 -8
- package/helpers/taskFilter/onHoldFilter.js +47 -5
- package/helpers/taskFilter/wasMarkedIncomplete.js +51 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,9 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [1.3.0](https://github.com/outliant/sunrise-utils/compare/1.2.5...1.3.0)
|
|
8
|
+
|
|
9
|
+
- chore: fix boolean columns [`17269be`](https://github.com/outliant/sunrise-utils/commit/17269be8df001b5f625a98a85fc045eb85d916ce)
|
|
10
|
+
|
|
7
11
|
#### [1.2.5](https://github.com/outliant/sunrise-utils/compare/1.2.4...1.2.5)
|
|
8
12
|
|
|
13
|
+
> 6 December 2024
|
|
14
|
+
|
|
9
15
|
- chore: added task archived status [`602a04a`](https://github.com/outliant/sunrise-utils/commit/602a04a95d8592c85237a74607e3acea130ec278)
|
|
16
|
+
- chore(release): 1.2.5 [`9172f49`](https://github.com/outliant/sunrise-utils/commit/9172f49da27b2a4c02d5c60acd02b3013433f3a0)
|
|
10
17
|
|
|
11
18
|
#### [1.2.4](https://github.com/outliant/sunrise-utils/compare/1.2.3...1.2.4)
|
|
12
19
|
|
|
@@ -42,7 +42,8 @@ module.exports.defaultCustomColumns = [
|
|
|
42
42
|
name: 'Cancelled',
|
|
43
43
|
value: 'on_hold',
|
|
44
44
|
type: 'on_hold',
|
|
45
|
-
field_type: '
|
|
45
|
+
field_type: 'boolean',
|
|
46
|
+
// Not used anymore
|
|
46
47
|
select_fields: ['on_hold']
|
|
47
48
|
},
|
|
48
49
|
{
|
|
@@ -51,7 +52,8 @@ module.exports.defaultCustomColumns = [
|
|
|
51
52
|
name: 'Is Paused',
|
|
52
53
|
value: 'is_paused',
|
|
53
54
|
type: 'is_paused',
|
|
54
|
-
field_type: '
|
|
55
|
+
field_type: 'boolean',
|
|
56
|
+
// Not used anymore
|
|
55
57
|
options: [
|
|
56
58
|
{
|
|
57
59
|
label: 'Yes',
|
|
@@ -68,7 +70,8 @@ module.exports.defaultCustomColumns = [
|
|
|
68
70
|
name: 'Is Generated',
|
|
69
71
|
value: 'is_generated',
|
|
70
72
|
type: 'is_generated',
|
|
71
|
-
field_type: '
|
|
73
|
+
field_type: 'boolean',
|
|
74
|
+
// Not used anymore
|
|
72
75
|
select_fields: ['is_generated']
|
|
73
76
|
},
|
|
74
77
|
{
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
module.exports = (filter) => {
|
|
2
2
|
switch (filter.condition) {
|
|
3
|
+
case 'is_true':
|
|
4
|
+
return module.exports.isTrue();
|
|
5
|
+
case 'is_false':
|
|
6
|
+
return module.exports.isFalse();
|
|
3
7
|
case 'is_equal':
|
|
4
8
|
return module.exports.isEqual();
|
|
5
9
|
case 'not_equal':
|
|
@@ -39,3 +43,42 @@ module.exports.isNotEqual = () => {
|
|
|
39
43
|
}
|
|
40
44
|
};
|
|
41
45
|
};
|
|
46
|
+
|
|
47
|
+
exports.isTrue = () => {
|
|
48
|
+
return {
|
|
49
|
+
bool: {
|
|
50
|
+
must: [
|
|
51
|
+
{
|
|
52
|
+
term: {
|
|
53
|
+
is_generated: {
|
|
54
|
+
value: true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
module.exports.isFalse = () => {
|
|
64
|
+
return {
|
|
65
|
+
bool: {
|
|
66
|
+
should: [
|
|
67
|
+
{
|
|
68
|
+
match: {
|
|
69
|
+
is_generated: false
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
bool: {
|
|
74
|
+
must_not: {
|
|
75
|
+
exists: {
|
|
76
|
+
field: 'is_generated'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
module.exports = (filter) => {
|
|
2
2
|
switch (filter.condition) {
|
|
3
|
+
case 'is_true':
|
|
4
|
+
return module.exports.isTrue();
|
|
5
|
+
case 'is_false':
|
|
6
|
+
return module.exports.isFalse();
|
|
3
7
|
case 'is_equal':
|
|
4
8
|
return module.exports.isEqual();
|
|
5
9
|
case 'not_equal':
|
|
@@ -39,3 +43,42 @@ module.exports.isNotEqual = () => {
|
|
|
39
43
|
}
|
|
40
44
|
};
|
|
41
45
|
};
|
|
46
|
+
|
|
47
|
+
module.exports.isTrue = () => {
|
|
48
|
+
return {
|
|
49
|
+
bool: {
|
|
50
|
+
must: [
|
|
51
|
+
{
|
|
52
|
+
term: {
|
|
53
|
+
is_paused: {
|
|
54
|
+
value: true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
module.exports.isFalse = () => {
|
|
64
|
+
return {
|
|
65
|
+
bool: {
|
|
66
|
+
should: [
|
|
67
|
+
{
|
|
68
|
+
match: {
|
|
69
|
+
is_paused: false
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
bool: {
|
|
74
|
+
must_not: {
|
|
75
|
+
exists: {
|
|
76
|
+
field: 'is_paused'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
module.exports = (filter) => {
|
|
2
2
|
switch (filter.condition) {
|
|
3
|
+
case 'is_true':
|
|
4
|
+
return module.exports.isTrue();
|
|
5
|
+
case 'is_false':
|
|
6
|
+
return module.exports.isFalse();
|
|
3
7
|
case 'is_equal':
|
|
4
8
|
return module.exports.isEqual();
|
|
5
9
|
case 'not_equal':
|
|
@@ -39,3 +43,44 @@ module.exports.isNotEqual = () => {
|
|
|
39
43
|
}
|
|
40
44
|
};
|
|
41
45
|
};
|
|
46
|
+
|
|
47
|
+
module.exports.isTrue = () => {
|
|
48
|
+
return {
|
|
49
|
+
bool: {
|
|
50
|
+
must: [
|
|
51
|
+
{
|
|
52
|
+
term: {
|
|
53
|
+
on_hold: {
|
|
54
|
+
value: true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
module.exports.isFalse = () => {
|
|
64
|
+
return {
|
|
65
|
+
bool: {
|
|
66
|
+
should: [
|
|
67
|
+
{
|
|
68
|
+
term: {
|
|
69
|
+
on_hold: {
|
|
70
|
+
value: false
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
bool: {
|
|
76
|
+
must_not: {
|
|
77
|
+
exists: {
|
|
78
|
+
field: 'on_hold'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
};
|
|
@@ -46,10 +46,7 @@ module.exports = (filter) => {
|
|
|
46
46
|
case 'not_equal':
|
|
47
47
|
return module.exports.isNotEqual(filter);
|
|
48
48
|
case 'is_none_of':
|
|
49
|
-
return isNoneOf(
|
|
50
|
-
filter,
|
|
51
|
-
module.exports.isEqual
|
|
52
|
-
);
|
|
49
|
+
return isNoneOf(filter, module.exports.isEqual);
|
|
53
50
|
case 'before':
|
|
54
51
|
case 'less_than':
|
|
55
52
|
return module.exports.isBefore(filter);
|
|
@@ -514,12 +511,9 @@ module.exports.nextNDays = (filter) => {
|
|
|
514
511
|
return null;
|
|
515
512
|
}
|
|
516
513
|
|
|
517
|
-
const today = moment()
|
|
518
|
-
.startOf('day');
|
|
514
|
+
const today = moment().startOf('day');
|
|
519
515
|
|
|
520
|
-
const nextNDays = moment()
|
|
521
|
-
.add(filter.value, 'd')
|
|
522
|
-
.endOf('day');
|
|
516
|
+
const nextNDays = moment().add(filter.value, 'd').endOf('day');
|
|
523
517
|
|
|
524
518
|
const res = {
|
|
525
519
|
bool: {
|
|
@@ -566,12 +560,9 @@ module.exports.lastNDays = (filter) => {
|
|
|
566
560
|
return null;
|
|
567
561
|
}
|
|
568
562
|
|
|
569
|
-
const today = moment()
|
|
570
|
-
.startOf('day');
|
|
563
|
+
const today = moment().startOf('day');
|
|
571
564
|
|
|
572
|
-
const lastNDays = moment()
|
|
573
|
-
.subtract(filter.value, 'd')
|
|
574
|
-
.endOf('day');
|
|
565
|
+
const lastNDays = moment().subtract(filter.value, 'd').endOf('day');
|
|
575
566
|
|
|
576
567
|
const res = {
|
|
577
568
|
bool: {
|
|
@@ -617,9 +608,7 @@ module.exports.greaterNDaysAgo = (filter) => {
|
|
|
617
608
|
return null;
|
|
618
609
|
}
|
|
619
610
|
|
|
620
|
-
const greaterNDaysAgo = moment()
|
|
621
|
-
.subtract(filter.value, 'd')
|
|
622
|
-
.endOf('day');
|
|
611
|
+
const greaterNDaysAgo = moment().subtract(filter.value, 'd').endOf('day');
|
|
623
612
|
|
|
624
613
|
const res = {
|
|
625
614
|
bool: {
|
|
@@ -654,7 +643,7 @@ module.exports.greaterNDaysAgo = (filter) => {
|
|
|
654
643
|
};
|
|
655
644
|
|
|
656
645
|
return res;
|
|
657
|
-
}
|
|
646
|
+
};
|
|
658
647
|
|
|
659
648
|
module.exports.isBeforeIncludeParam = (filter) => {
|
|
660
649
|
if (!!filter.field_id) {
|
|
@@ -9,6 +9,7 @@ const buildIsPausedFilter = require('./isPausedFilter');
|
|
|
9
9
|
const buildIsStarredFilter = require('./isStarredFilter');
|
|
10
10
|
const buildDaysToCompleteFilter = require('./daysToComplete');
|
|
11
11
|
const buildAgeColorFilter = require('./buildAgeColorFilter');
|
|
12
|
+
const buildWasMarkedIncompleteFilter = require('./wasMarkedIncomplete');
|
|
12
13
|
const buildProjectFieldFilter = require('../projectFilter/projectFieldFilter');
|
|
13
14
|
const { PROJECT_BANNERS } = require('../../constants');
|
|
14
15
|
const splitString = require('../splitString');
|
|
@@ -135,7 +136,8 @@ module.exports.defaultCustomColumns = [
|
|
|
135
136
|
name: 'Cancelled',
|
|
136
137
|
value: 'on_hold',
|
|
137
138
|
type: 'on_hold',
|
|
138
|
-
field_type: '
|
|
139
|
+
field_type: 'boolean',
|
|
140
|
+
// Not used anymore
|
|
139
141
|
options: [
|
|
140
142
|
{
|
|
141
143
|
label: 'Yes',
|
|
@@ -154,7 +156,8 @@ module.exports.defaultCustomColumns = [
|
|
|
154
156
|
name: 'Is Paused',
|
|
155
157
|
value: 'is_paused',
|
|
156
158
|
type: 'is_paused',
|
|
157
|
-
field_type: '
|
|
159
|
+
field_type: 'boolean',
|
|
160
|
+
// Not used anymore
|
|
158
161
|
options: [
|
|
159
162
|
{
|
|
160
163
|
label: 'Yes',
|
|
@@ -229,7 +232,8 @@ module.exports.defaultCustomColumns = [
|
|
|
229
232
|
name: 'Was Marked Incomplete',
|
|
230
233
|
value: 'was_marked_incomplete',
|
|
231
234
|
type: 'was_marked_incomplete',
|
|
232
|
-
field_type: '
|
|
235
|
+
field_type: 'boolean',
|
|
236
|
+
// Not used anymore
|
|
233
237
|
options: [
|
|
234
238
|
{
|
|
235
239
|
label: 'Yes',
|
|
@@ -327,6 +331,8 @@ module.exports.buildTaskPipelineFilter = (filter, starredTaskIds) => {
|
|
|
327
331
|
return buildOnHoldFilter(filter);
|
|
328
332
|
case 'is_paused':
|
|
329
333
|
return buildIsPausedFilter(filter);
|
|
334
|
+
case 'was_marked_incomplete':
|
|
335
|
+
return buildWasMarkedIncompleteFilter(filter);
|
|
330
336
|
case 'days_to_complete':
|
|
331
337
|
return buildDaysToCompleteFilter(filter);
|
|
332
338
|
// Always expected as is_equal condition
|
|
@@ -3,6 +3,10 @@ const { isNoneOf } = require('../common');
|
|
|
3
3
|
|
|
4
4
|
module.exports = (filter) => {
|
|
5
5
|
switch (filter.condition) {
|
|
6
|
+
case 'is_true':
|
|
7
|
+
return module.exports.isTrue();
|
|
8
|
+
case 'is_false':
|
|
9
|
+
return module.exports.isFalse();
|
|
6
10
|
case 'is_empty':
|
|
7
11
|
return module.exports.isEmpty();
|
|
8
12
|
case 'is_not_empty':
|
|
@@ -14,10 +18,7 @@ module.exports = (filter) => {
|
|
|
14
18
|
case 'is_any_of':
|
|
15
19
|
return module.exports.isAnyOf(filter); // if is any, means all tasks that have value
|
|
16
20
|
case 'is_none_of':
|
|
17
|
-
return isNoneOf(
|
|
18
|
-
filter,
|
|
19
|
-
module.exports.isEqual
|
|
20
|
-
);
|
|
21
|
+
return isNoneOf(filter, module.exports.isEqual);
|
|
21
22
|
default:
|
|
22
23
|
return null;
|
|
23
24
|
}
|
|
@@ -95,9 +96,7 @@ module.exports.isEqual = (filter) => {
|
|
|
95
96
|
module.exports.isNotEqual = (filter) => {
|
|
96
97
|
return {
|
|
97
98
|
bool: {
|
|
98
|
-
must_not: [
|
|
99
|
-
module.exports.isEqual(filter)
|
|
100
|
-
]
|
|
99
|
+
must_not: [module.exports.isEqual(filter)]
|
|
101
100
|
}
|
|
102
101
|
};
|
|
103
102
|
};
|
|
@@ -125,4 +124,43 @@ module.exports.isAnyOf = (filter) => {
|
|
|
125
124
|
should
|
|
126
125
|
}
|
|
127
126
|
};
|
|
128
|
-
};
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
module.exports.isTrue = () => {
|
|
130
|
+
return {
|
|
131
|
+
bool: {
|
|
132
|
+
must: [
|
|
133
|
+
{
|
|
134
|
+
term: {
|
|
135
|
+
is_paused: {
|
|
136
|
+
value: true
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
module.exports.isFalse = () => {
|
|
146
|
+
return {
|
|
147
|
+
bool: {
|
|
148
|
+
should: [
|
|
149
|
+
{
|
|
150
|
+
match: {
|
|
151
|
+
is_paused: false
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
bool: {
|
|
156
|
+
must_not: {
|
|
157
|
+
exists: {
|
|
158
|
+
field: 'is_paused'
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
};
|
|
@@ -3,6 +3,10 @@ const { isNoneOf } = require('../common');
|
|
|
3
3
|
|
|
4
4
|
module.exports = (filter) => {
|
|
5
5
|
switch (filter.condition) {
|
|
6
|
+
case 'is_true':
|
|
7
|
+
return module.exports.isTrue();
|
|
8
|
+
case 'is_false':
|
|
9
|
+
return module.exports.isFalse();
|
|
6
10
|
case 'is_empty':
|
|
7
11
|
return module.exports.isEmpty();
|
|
8
12
|
case 'is_not_empty':
|
|
@@ -14,10 +18,7 @@ module.exports = (filter) => {
|
|
|
14
18
|
case 'is_any_of':
|
|
15
19
|
return module.exports.isAnyOf(filter); // if is any, means all tasks that have value
|
|
16
20
|
case 'is_none_of':
|
|
17
|
-
return isNoneOf(
|
|
18
|
-
filter,
|
|
19
|
-
module.exports.isEqual
|
|
20
|
-
);
|
|
21
|
+
return isNoneOf(filter, module.exports.isEqual);
|
|
21
22
|
default:
|
|
22
23
|
return null;
|
|
23
24
|
}
|
|
@@ -106,4 +107,45 @@ module.exports.isAnyOf = (filter) => {
|
|
|
106
107
|
should
|
|
107
108
|
}
|
|
108
109
|
};
|
|
109
|
-
};
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
module.exports.isTrue = () => {
|
|
113
|
+
return {
|
|
114
|
+
bool: {
|
|
115
|
+
must: [
|
|
116
|
+
{
|
|
117
|
+
term: {
|
|
118
|
+
on_hold: {
|
|
119
|
+
value: true
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
module.exports.isFalse = () => {
|
|
129
|
+
return {
|
|
130
|
+
bool: {
|
|
131
|
+
should: [
|
|
132
|
+
{
|
|
133
|
+
term: {
|
|
134
|
+
on_hold: {
|
|
135
|
+
value: false
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
bool: {
|
|
141
|
+
must_not: {
|
|
142
|
+
exists: {
|
|
143
|
+
field: 'on_hold'
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module.exports = (filter) => {
|
|
2
|
+
switch (filter.condition) {
|
|
3
|
+
case 'is_true':
|
|
4
|
+
return module.exports.isTrue();
|
|
5
|
+
case 'is_false':
|
|
6
|
+
return module.exports.isFalse();
|
|
7
|
+
default:
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
module.exports.isTrue = () => {
|
|
13
|
+
return {
|
|
14
|
+
bool: {
|
|
15
|
+
must: [
|
|
16
|
+
{
|
|
17
|
+
term: {
|
|
18
|
+
was_marked_incomplete: {
|
|
19
|
+
value: true
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
module.exports.isFalse = () => {
|
|
29
|
+
return {
|
|
30
|
+
bool: {
|
|
31
|
+
should: [
|
|
32
|
+
{
|
|
33
|
+
term: {
|
|
34
|
+
was_marked_incomplete: {
|
|
35
|
+
value: false
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
bool: {
|
|
41
|
+
must_not: {
|
|
42
|
+
exists: {
|
|
43
|
+
field: 'was_marked_incomplete'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
};
|