@outliant/sunrise-utils 1.1.12 → 1.1.13
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
CHANGED
|
@@ -4,10 +4,18 @@ 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.1.13](https://github.com/outliant/sunrise-utils/compare/1.1.12...1.1.13)
|
|
8
|
+
|
|
9
|
+
- chore: change equal condition [`#18`](https://github.com/outliant/sunrise-utils/pull/18)
|
|
10
|
+
- chore: update isPaused filter [`99d882d`](https://github.com/outliant/sunrise-utils/commit/99d882d74cb7fb6d7aba3048a2328343017ca512)
|
|
11
|
+
|
|
7
12
|
#### [1.1.12](https://github.com/outliant/sunrise-utils/compare/1.1.11...1.1.12)
|
|
8
13
|
|
|
14
|
+
> 7 November 2023
|
|
15
|
+
|
|
9
16
|
- chore: add isPaused [`#17`](https://github.com/outliant/sunrise-utils/pull/17)
|
|
10
17
|
- chore: add unit test for is_paused [`aa5fada`](https://github.com/outliant/sunrise-utils/commit/aa5fada660f2883004a1a72ddb0603f412dec18e)
|
|
18
|
+
- chore(release): 1.1.12 [`56f3083`](https://github.com/outliant/sunrise-utils/commit/56f30836a6b021e0d57cfabf9541b063ddb92afd)
|
|
11
19
|
|
|
12
20
|
#### [1.1.11](https://github.com/outliant/sunrise-utils/compare/1.1.10...1.1.11)
|
|
13
21
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const buildRegionFilter = require('./regionFilter');
|
|
2
2
|
const buildCriticalPathFilter = require('./criticalPathFilter');
|
|
3
3
|
const buildOnHoldFilter = require('./onHoldFilter');
|
|
4
|
-
const buildIsPausedFilter = require('
|
|
4
|
+
const buildIsPausedFilter = require('./isPausedFilter');
|
|
5
5
|
const buildIsGeneratedFilter = require('./isGeneratedFilter');
|
|
6
6
|
const buildTagFilter = require('./tagFilter');
|
|
7
7
|
const buildProjectFieldFilter = require('./projectFieldFilter');
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module.exports = (filter) => {
|
|
2
|
+
switch (filter.condition) {
|
|
3
|
+
case 'is_equal':
|
|
4
|
+
return module.exports.isEqual();
|
|
5
|
+
case 'not_equal':
|
|
6
|
+
return module.exports.isNotEqual();
|
|
7
|
+
default:
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
module.exports.isEqual = () => {
|
|
13
|
+
return {
|
|
14
|
+
match: {
|
|
15
|
+
is_paused: true
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
module.exports.isNotEqual = () => {
|
|
21
|
+
return {
|
|
22
|
+
bool: {
|
|
23
|
+
should: [
|
|
24
|
+
{
|
|
25
|
+
match: {
|
|
26
|
+
is_paused: false
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
bool: {
|
|
31
|
+
must_not: {
|
|
32
|
+
exists: {
|
|
33
|
+
field: 'is_paused'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -46,13 +46,38 @@ module.exports.isNotEmpty = () => {
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
module.exports.isEqual = (filter) => {
|
|
49
|
+
const isYes = filter.value === 'Yes';
|
|
50
|
+
|
|
51
|
+
if (isYes) {
|
|
52
|
+
return {
|
|
53
|
+
bool: {
|
|
54
|
+
must: [
|
|
55
|
+
{
|
|
56
|
+
term: {
|
|
57
|
+
is_paused: {
|
|
58
|
+
value: true
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
49
67
|
return {
|
|
50
68
|
bool: {
|
|
51
|
-
|
|
69
|
+
should: [
|
|
52
70
|
{
|
|
53
|
-
|
|
54
|
-
is_paused:
|
|
55
|
-
|
|
71
|
+
match: {
|
|
72
|
+
is_paused: false
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
bool: {
|
|
77
|
+
must_not: {
|
|
78
|
+
exists: {
|
|
79
|
+
field: 'is_paused'
|
|
80
|
+
}
|
|
56
81
|
}
|
|
57
82
|
}
|
|
58
83
|
}
|
|
@@ -65,13 +90,7 @@ module.exports.isNotEqual = (filter) => {
|
|
|
65
90
|
return {
|
|
66
91
|
bool: {
|
|
67
92
|
must_not: [
|
|
68
|
-
|
|
69
|
-
term: {
|
|
70
|
-
is_paused: {
|
|
71
|
-
value: filter.value === 'Yes'
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
93
|
+
module.exports.isEqual(filter)
|
|
75
94
|
]
|
|
76
95
|
}
|
|
77
96
|
};
|