@outliant/sunrise-utils 1.0.3 → 1.0.4
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 +57 -0
- package/index.d.ts +61 -2
- package/lib/projectPipeline.js +6 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,10 +4,17 @@ 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.0.4](https://github.com/outliant/sunrise-utils/compare/1.0.3...1.0.4)
|
|
8
|
+
|
|
9
|
+
- chore: project pipeline default columns #860pt9g1t [`194852e`](https://github.com/outliant/sunrise-utils/commit/194852e8250a92c82775187588c427ed5b7aaef8)
|
|
10
|
+
|
|
7
11
|
#### [1.0.3](https://github.com/outliant/sunrise-utils/compare/1.0.2...1.0.3)
|
|
8
12
|
|
|
13
|
+
> 24 February 2023
|
|
14
|
+
|
|
9
15
|
- chore: project pipeline filter query and sorting script #860pt9g1t [`533484f`](https://github.com/outliant/sunrise-utils/commit/533484fc97909d2ba45d425db57bc5942109c6f0)
|
|
10
16
|
- chore: updated README [`62743ce`](https://github.com/outliant/sunrise-utils/commit/62743ce921655c3c1b64395268d3c1acf624071f)
|
|
17
|
+
- chore(release): 1.0.3 [`02b8819`](https://github.com/outliant/sunrise-utils/commit/02b881974f9e63a54d7ce30cbb567b5ad76e139f)
|
|
11
18
|
|
|
12
19
|
#### [1.0.2](https://github.com/outliant/sunrise-utils/compare/1.0.1...1.0.2)
|
|
13
20
|
|
|
@@ -5,6 +5,63 @@ const buildIsGeneratedFilter = require('./isGeneratedFilter');
|
|
|
5
5
|
const buildTagFilter = require('./tagFilter');
|
|
6
6
|
const buildProjectFieldFilter = require('./projectFieldFilter');
|
|
7
7
|
|
|
8
|
+
module.exports.defaultCustomColumns = [
|
|
9
|
+
{
|
|
10
|
+
name: 'Region',
|
|
11
|
+
value: 'region',
|
|
12
|
+
type: 'region',
|
|
13
|
+
field_type: 'checkbox'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'Tags',
|
|
17
|
+
value: 'tags',
|
|
18
|
+
type: 'tags',
|
|
19
|
+
field_type: 'checkbox'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'Critical Path Stage',
|
|
23
|
+
value: 'criticalPathStage',
|
|
24
|
+
type: 'criticalPathStage',
|
|
25
|
+
field_type: 'select'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'Cancelled',
|
|
29
|
+
value: 'on_hold',
|
|
30
|
+
type: 'on_hold',
|
|
31
|
+
field_type: 'select'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'Is Generated',
|
|
35
|
+
value: 'is_generated',
|
|
36
|
+
type: 'is_generated',
|
|
37
|
+
field_type: 'select'
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'Project ID',
|
|
41
|
+
value: 'project_id',
|
|
42
|
+
type: 'project_id',
|
|
43
|
+
field_type: 'text'
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'Last Pulse Comment',
|
|
47
|
+
value: 'lastPulseComment',
|
|
48
|
+
type: 'lastPulseComment',
|
|
49
|
+
field_type: 'textarea'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'Last Pulse Comment User',
|
|
53
|
+
value: 'lastPulseCommentUser',
|
|
54
|
+
type: 'lastPulseCommentUser',
|
|
55
|
+
field_type: 'select'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'Last Pulse Comment Date',
|
|
59
|
+
value: 'lastPulseCommentDate',
|
|
60
|
+
type: 'lastPulseCommentDate',
|
|
61
|
+
field_type: 'date'
|
|
62
|
+
}
|
|
63
|
+
];
|
|
64
|
+
|
|
8
65
|
module.exports.buildProjectPipelineFilter = (filter) => {
|
|
9
66
|
switch (filter.type) {
|
|
10
67
|
case 'tags':
|
package/index.d.ts
CHANGED
|
@@ -1,11 +1,70 @@
|
|
|
1
1
|
declare namespace Utils {
|
|
2
|
+
export interface FilterConditionOption {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface Column {
|
|
8
|
+
name: string;
|
|
9
|
+
value: string;
|
|
10
|
+
type: string;
|
|
11
|
+
field_type: string;
|
|
12
|
+
options?: FilterConditionOption[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface Filter {
|
|
16
|
+
condition: string;
|
|
17
|
+
field_id: string;
|
|
18
|
+
type: string;
|
|
19
|
+
field_type: string;
|
|
20
|
+
value: string;
|
|
21
|
+
second_value?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface Query {
|
|
25
|
+
projectId?: string;
|
|
26
|
+
search?: string;
|
|
27
|
+
sort?: string;
|
|
28
|
+
sortBy?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
2
31
|
namespace log {
|
|
3
32
|
export function info(msg: any): void;
|
|
4
|
-
|
|
5
33
|
export function warn(msg: any): void;
|
|
6
|
-
|
|
7
34
|
export function error(msg: any): void;
|
|
8
35
|
}
|
|
36
|
+
|
|
37
|
+
namespace fieldConditions {
|
|
38
|
+
export const conditions: Record<string, FilterConditionOption[]>;
|
|
39
|
+
export function getConditions(filedType: string): FilterConditionOption[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
namespace taskPipeline {
|
|
43
|
+
export const taskStatusOptions: FilterConditionOption[];
|
|
44
|
+
export const defaultCustomColumns: Column[];
|
|
45
|
+
export function buildFilter(filter: Filter): any;
|
|
46
|
+
export function buildFiltersQuery(
|
|
47
|
+
orgId: string,
|
|
48
|
+
departmentId: string,
|
|
49
|
+
filters?: Filter[],
|
|
50
|
+
query?: Query,
|
|
51
|
+
searchFields?: string[]
|
|
52
|
+
): any;
|
|
53
|
+
export function buildSortScript(query?: Query, customSort?: any[]): any;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
namespace projectPipeline {
|
|
57
|
+
export const defaultCustomColumns: Column[];
|
|
58
|
+
export function buildFilter(filter: Filter): any;
|
|
59
|
+
export function buildFiltersQuery(
|
|
60
|
+
orgId: string,
|
|
61
|
+
departmentId: string,
|
|
62
|
+
filters?: Filter[],
|
|
63
|
+
query?: Query,
|
|
64
|
+
searchFields?: string[]
|
|
65
|
+
): any;
|
|
66
|
+
export function buildSortScript(query?: Query, customSort?: any[]): any;
|
|
67
|
+
}
|
|
9
68
|
}
|
|
10
69
|
|
|
11
70
|
export = Utils;
|
package/lib/projectPipeline.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
const { validate: isUuid } = require('uuid');
|
|
2
|
-
const {
|
|
2
|
+
const {
|
|
3
|
+
defaultCustomColumns,
|
|
4
|
+
buildProjectPipelineFilter
|
|
5
|
+
} = require('../helpers/projectFilter');
|
|
3
6
|
const searchFilter = require('../helpers/searchFilter');
|
|
4
7
|
const sortScript = require('../helpers/sortScript');
|
|
5
8
|
|
|
6
9
|
class ProjectPipeline {
|
|
10
|
+
defaultCustomColumns = defaultCustomColumns;
|
|
11
|
+
buildFilter = buildProjectPipelineFilter;
|
|
7
12
|
buildFiltersQuery(
|
|
8
13
|
orgId,
|
|
9
14
|
departmentId,
|