@outliant/sunrise-utils 2.0.1 → 2.0.3
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 +15 -2
- package/helpers/sourceParams.js +5 -31
- package/index.js +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,11 +4,24 @@ 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
|
-
#### [2.0.
|
|
7
|
+
#### [2.0.3](https://github.com/outliant/sunrise-utils/compare/2.0.2...2.0.3)
|
|
8
|
+
|
|
9
|
+
- chore: migrated buildSourceParams [`a971ed9`](https://github.com/outliant/sunrise-utils/commit/a971ed9152f0aa9b75ba609420960b2821d1326f)
|
|
10
|
+
|
|
11
|
+
#### [2.0.2](https://github.com/outliant/sunrise-utils/compare/2.0.1...2.0.2)
|
|
12
|
+
|
|
13
|
+
> 11 November 2025
|
|
14
|
+
|
|
15
|
+
- chore(release): 2.0.2 [`5265058`](https://github.com/outliant/sunrise-utils/commit/5265058e80d272d68537850678660e44b54d5585)
|
|
16
|
+
- chore: add common utils [`4d5ebec`](https://github.com/outliant/sunrise-utils/commit/4d5ebec0e4db2eaa7a8abef960e5c3ef68157fab)
|
|
17
|
+
|
|
18
|
+
### [2.0.1](https://github.com/outliant/sunrise-utils/compare/1.4.8...2.0.1)
|
|
19
|
+
|
|
20
|
+
> 11 November 2025
|
|
8
21
|
|
|
9
22
|
- chore: project/task pipeline project field filter updates [`7ec12ff`](https://github.com/outliant/sunrise-utils/commit/7ec12ffc786912f20df034c2d71becfebbd313fc)
|
|
10
23
|
- updated readme [`ec2d6ac`](https://github.com/outliant/sunrise-utils/commit/ec2d6acaf51d2d0ad63a276cedb633b4c1fd785c)
|
|
11
|
-
- chore:
|
|
24
|
+
- chore(release): 2.0.1 [`3f98d22`](https://github.com/outliant/sunrise-utils/commit/3f98d22963432535a4d208f9d14c641fb731ea61)
|
|
12
25
|
|
|
13
26
|
#### [1.4.8](https://github.com/outliant/sunrise-utils/compare/1.4.7...1.4.8)
|
|
14
27
|
|
package/helpers/sourceParams.js
CHANGED
|
@@ -1,45 +1,19 @@
|
|
|
1
|
-
const { validate: isUuid } = require('uuid');
|
|
2
1
|
const _ = require('lodash');
|
|
3
2
|
|
|
4
3
|
module.exports = (columns = [], filterColumns = []) => {
|
|
5
4
|
let _source = [];
|
|
6
5
|
if (_.isEmpty(columns)) return { _source };
|
|
7
6
|
|
|
8
|
-
const projectFields = [];
|
|
9
7
|
_.each(columns, (c) => {
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const columnData = filterColumns.find((x) => x.value === c);
|
|
9
|
+
if (columnData && !_.isEmpty(columnData.select_fields)) {
|
|
10
|
+
_source = _.concat(_source, columnData.select_fields);
|
|
12
11
|
} else {
|
|
13
|
-
|
|
14
|
-
if (columnData && !_.isEmpty(columnData.select_fields)) {
|
|
15
|
-
_source = _.concat(_source, columnData.select_fields);
|
|
16
|
-
} else {
|
|
17
|
-
_source.push(c);
|
|
18
|
-
}
|
|
12
|
+
_source.push(c);
|
|
19
13
|
}
|
|
20
14
|
});
|
|
21
15
|
|
|
22
16
|
_source = _.uniq(_source);
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
_source,
|
|
28
|
-
script_fields: {
|
|
29
|
-
filtered_fields: {
|
|
30
|
-
script: {
|
|
31
|
-
source: `
|
|
32
|
-
def fieldIds = [${projectFields.join(',')}];
|
|
33
|
-
def result = [];
|
|
34
|
-
for (f in params['_source']['fields']) {
|
|
35
|
-
if (fieldIds.contains(f['id'])) {
|
|
36
|
-
result.add(f);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return result;
|
|
40
|
-
`
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
};
|
|
18
|
+
return { _source };
|
|
45
19
|
};
|
package/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const log = require('./lib/logger');
|
|
2
|
+
const common = require('./lib/common');
|
|
2
3
|
const fieldConditions = require('./lib/fieldConditions');
|
|
3
4
|
const taskPipeline = require('./lib/taskPipeline');
|
|
4
5
|
const projectPipeline = require('./lib/projectPipeline');
|
|
@@ -7,6 +8,7 @@ const queries = require('./lib/queries');
|
|
|
7
8
|
const EventService = require('./lib/eventService');
|
|
8
9
|
|
|
9
10
|
module.exports = {
|
|
11
|
+
common,
|
|
10
12
|
log,
|
|
11
13
|
fieldConditions,
|
|
12
14
|
taskPipeline,
|