@bisondesk/documents-sdk 1.0.404 → 1.0.405
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/lib/{constants.d.ts → constants/index.d.ts} +1 -1
- package/lib/constants/index.d.ts.map +1 -0
- package/lib/{constants.js → constants/index.js} +1 -1
- package/lib/constants/index.js.map +1 -0
- package/lib/constants/search.d.ts +12 -0
- package/lib/constants/search.d.ts.map +1 -0
- package/lib/constants/search.js +239 -0
- package/lib/constants/search.js.map +1 -0
- package/package.json +1 -1
- package/src/constants/search.ts +271 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/constants.d.ts.map +0 -1
- package/lib/constants.js.map +0 -1
- /package/src/{constants.ts → constants/index.ts} +0 -0
|
@@ -19,4 +19,4 @@ export declare const ENV_CONTRIBUTION_TYRES_LINE_CATEGORY_ID = "env_contribution
|
|
|
19
19
|
export declare const STANDARD_VAT_CODE_ID = "standard";
|
|
20
20
|
export declare const SALE_EU_INTRA_COMMUNITY_VAT_CODE_ID = "eu_ics_sale";
|
|
21
21
|
export declare const SALE_EU_EXTRA_COMMUNITY_VAT_CODE_ID = "eu_ecs_sale";
|
|
22
|
-
//# sourceMappingURL=
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["constants/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAE5D,eAAO,MAAM,+BAA+B,wBAAwB,CAAC;AAErE,eAAO,MAAM,sBAAsB,YAIlC,CAAC;AACF,eAAO,MAAM,sBAAsB,YAQlC,CAAC;AAEF,eAAO,MAAM,kCAAkC,uBAAuB,CAAC;AACvE,eAAO,MAAM,iCAAiC,SAAS,CAAC;AAExD,eAAO,MAAM,iCAAiC,sBAAsB,CAAC;AACrE,eAAO,MAAM,gCAAgC,QAAQ,CAAC;AAEtD,eAAO,MAAM,2BAA2B,gBAAgB,CAAC;AACzD,eAAO,MAAM,0BAA0B,WAAW,CAAC;AAEnD,eAAO,MAAM,+BAA+B,mBAAmB,CAAC;AAChE,eAAO,MAAM,+BAA+B,mBAAmB,CAAC;AAChE,eAAO,MAAM,yBAAyB,aAAa,CAAC;AACpD,eAAO,MAAM,6BAA6B,iBAAiB,CAAC;AAC5D,eAAO,MAAM,2BAA2B,eAAe,CAAC;AACxD,eAAO,MAAM,+BAA+B,mBAAmB,CAAC;AAChE,eAAO,MAAM,yBAAyB,aAAa,CAAC;AACpD,eAAO,MAAM,uCAAuC,2BAA2B,CAAC;AAEhF,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAC/C,eAAO,MAAM,mCAAmC,gBAAgB,CAAC;AACjE,eAAO,MAAM,mCAAmC,gBAAgB,CAAC"}
|
|
@@ -31,4 +31,4 @@ export const ENV_CONTRIBUTION_TYRES_LINE_CATEGORY_ID = 'env_contribution_tyres';
|
|
|
31
31
|
export const STANDARD_VAT_CODE_ID = 'standard';
|
|
32
32
|
export const SALE_EU_INTRA_COMMUNITY_VAT_CODE_ID = 'eu_ics_sale';
|
|
33
33
|
export const SALE_EU_EXTRA_COMMUNITY_VAT_CODE_ID = 'eu_ecs_sale';
|
|
34
|
-
//# sourceMappingURL=
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["constants/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAE5D,MAAM,CAAC,MAAM,+BAA+B,GAAG,qBAAqB,CAAC;AAErE,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,QAAQ,CAAC,KAAK;IACd,QAAQ,CAAC,cAAc;IACvB,QAAQ,CAAC,gBAAgB;CAC1B,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,QAAQ,CAAC,UAAU;IACnB,QAAQ,CAAC,KAAK;IACd,QAAQ,CAAC,cAAc;IACvB,QAAQ,CAAC,KAAK;IACd,QAAQ,CAAC,cAAc;IACvB,QAAQ,CAAC,YAAY;IACrB,QAAQ,CAAC,gBAAgB;CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,kCAAkC,GAAG,oBAAoB,CAAC;AACvE,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC;AAExD,MAAM,CAAC,MAAM,iCAAiC,GAAG,mBAAmB,CAAC;AACrE,MAAM,CAAC,MAAM,gCAAgC,GAAG,KAAK,CAAC;AAEtD,MAAM,CAAC,MAAM,2BAA2B,GAAG,aAAa,CAAC;AACzD,MAAM,CAAC,MAAM,0BAA0B,GAAG,QAAQ,CAAC;AAEnD,MAAM,CAAC,MAAM,+BAA+B,GAAG,gBAAgB,CAAC;AAChE,MAAM,CAAC,MAAM,+BAA+B,GAAG,gBAAgB,CAAC;AAChE,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CAAC;AACpD,MAAM,CAAC,MAAM,6BAA6B,GAAG,cAAc,CAAC;AAC5D,MAAM,CAAC,MAAM,2BAA2B,GAAG,YAAY,CAAC;AACxD,MAAM,CAAC,MAAM,+BAA+B,GAAG,gBAAgB,CAAC;AAChE,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CAAC;AACpD,MAAM,CAAC,MAAM,uCAAuC,GAAG,wBAAwB,CAAC;AAEhF,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAC/C,MAAM,CAAC,MAAM,mCAAmC,GAAG,aAAa,CAAC;AACjE,MAAM,CAAC,MAAM,mCAAmC,GAAG,aAAa,CAAC","sourcesContent":["import { AppRoles } from '@bisondesk/commons-sdk/constants';\n\nexport const DOCUMENT_PROCESSING_SETTINGS_ID = 'document-processing';\n\nexport const PRIVATE_DOCUMENT_ROLES = [\n AppRoles.Board,\n AppRoles.GeneralManager,\n AppRoles.SeniorAccountant,\n];\nexport const DEFAULT_DOCUMENT_ROLES = [\n AppRoles.Accountant,\n AppRoles.Admin,\n AppRoles.Administrative,\n AppRoles.Board,\n AppRoles.GeneralManager,\n AppRoles.SalesManager,\n AppRoles.SeniorAccountant,\n];\n\nexport const SALE_USED_VEHICLES_DOC_CATEGORY_ID = 'used_vehicles_sale';\nexport const SALE_USED_VEHICLES_COST_CENTER_ID = 'USED';\n\nexport const SALE_NEW_VEHICLES_DOC_CATEGORY_ID = 'new_vehicles_sale';\nexport const SALE_NEW_VEHICLES_COST_CENTER_ID = 'NEW';\n\nexport const SALE_OTHERS_DOC_CATEGORY_ID = 'others_sale';\nexport const SALE_OTHERS_COST_CENTER_ID = 'OTHERS';\n\nexport const HEAVY_VEHICLES_LINE_CATEGORY_ID = 'heavy_vehicles';\nexport const LIGHT_VEHICLES_LINE_CATEGORY_ID = 'light_vehicles';\nexport const ADMIN_IC_LINE_CATEGORY_ID = 'admin_ic';\nexport const ADMIN_NOT_IC_LINE_CATEGORY_ID = 'admin_not_ic';\nexport const DIVERSE_IC_LINE_CATEGORY_ID = 'diverse_ic';\nexport const DIVERSE_NOT_IC_LINE_CATEGORY_ID = 'diverse_not_ic';\nexport const OWN_WORK_LINE_CATEGORY_ID = 'own_work';\nexport const ENV_CONTRIBUTION_TYRES_LINE_CATEGORY_ID = 'env_contribution_tyres';\n\nexport const STANDARD_VAT_CODE_ID = 'standard';\nexport const SALE_EU_INTRA_COMMUNITY_VAT_CODE_ID = 'eu_ics_sale';\nexport const SALE_EU_EXTRA_COMMUNITY_VAT_CODE_ID = 'eu_ecs_sale';\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EsAggregationsDefinition, EsDefinition, EsDefinitionField, EsFullTextSearchDefinition, SearchDefinition, SearchField } from '@bisondesk/core-sdk/types/definitions';
|
|
2
|
+
export declare const DOC_DRAFT_MAPPING_FIELDS: {
|
|
3
|
+
[fieldId: string]: EsDefinitionField;
|
|
4
|
+
};
|
|
5
|
+
export declare const DOC_DRAFT_DEFINITION_FIELDS: {
|
|
6
|
+
[fieldId: string]: SearchField;
|
|
7
|
+
};
|
|
8
|
+
export declare const getSearchDocumentDraftsAggs: () => EsAggregationsDefinition;
|
|
9
|
+
export declare const SEARCH_DOC_DRAFT_FULL_TEXT_FIELDS: EsFullTextSearchDefinition;
|
|
10
|
+
export declare const SEARCH_DOC_DRAFTS_MAPPINGS: EsDefinition;
|
|
11
|
+
export declare const SEARCH_DOC_DRAFTS_DEFINITION: SearchDefinition;
|
|
12
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"/","sources":["constants/search.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,wBAAwB,EACxB,YAAY,EACZ,iBAAiB,EACjB,0BAA0B,EAC1B,gBAAgB,EAChB,WAAW,EACZ,MAAM,uCAAuC,CAAC;AA0H/C,eAAO,MAAM,wBAAwB,EAAE;IACrC,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAAC;CAKtC,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE;IACxC,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC;CAmDhC,CAAC;AAEF,eAAO,MAAM,2BAA2B,QAAO,wBAgD9C,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,0BAa/C,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,YAMxC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,gBAI1C,CAAC"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { DEFAULT_EXACT_MATCH_BOOST } from '@bisondesk/commons/es';
|
|
2
|
+
import { getTranslatedTitles } from '@bisondesk/commons/translations';
|
|
3
|
+
import { DateGranularity, FieldTypes } from '@bisondesk/core-sdk/types/fields';
|
|
4
|
+
import { AggregationType } from '@bisondesk/core-sdk/types/search';
|
|
5
|
+
import { UTCDate } from '@date-fns/utc';
|
|
6
|
+
import { getTime, parseISO, setHours, setMinutes, setSeconds } from 'date-fns';
|
|
7
|
+
const BASE_DOC_DRAFT_MAPPING_FIELDS = {
|
|
8
|
+
'doc.id': {
|
|
9
|
+
esMapping: { type: 'keyword', boost: DEFAULT_EXACT_MATCH_BOOST },
|
|
10
|
+
},
|
|
11
|
+
'doc.status': {
|
|
12
|
+
esMapping: { type: 'keyword' },
|
|
13
|
+
},
|
|
14
|
+
'doc.documentType': {
|
|
15
|
+
esMapping: { type: 'keyword' },
|
|
16
|
+
},
|
|
17
|
+
'doc.category': {
|
|
18
|
+
esMapping: { type: 'keyword' },
|
|
19
|
+
},
|
|
20
|
+
'doc.branchId': {
|
|
21
|
+
esMapping: { type: 'keyword' },
|
|
22
|
+
},
|
|
23
|
+
'doc.attachment': {
|
|
24
|
+
esMapping: { type: 'object', enabled: false },
|
|
25
|
+
},
|
|
26
|
+
'doc.createdAt': {
|
|
27
|
+
esMapping: { type: 'date' },
|
|
28
|
+
},
|
|
29
|
+
'doc.createdBy': {
|
|
30
|
+
esMapping: { type: 'keyword' },
|
|
31
|
+
},
|
|
32
|
+
'custom.stage': {
|
|
33
|
+
esMapping: { type: 'keyword' },
|
|
34
|
+
},
|
|
35
|
+
'custom.rejected': {
|
|
36
|
+
esMapping: { type: 'boolean' },
|
|
37
|
+
},
|
|
38
|
+
'custom.validationRulesStatus': {
|
|
39
|
+
esMapping: { type: 'keyword' },
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const FINANCE_DOC_DRAFT_MAPPING_FIELDS = {
|
|
43
|
+
'doc.type': {
|
|
44
|
+
esMapping: { type: 'keyword' },
|
|
45
|
+
},
|
|
46
|
+
'doc.subtype': {
|
|
47
|
+
esMapping: { type: 'keyword' },
|
|
48
|
+
},
|
|
49
|
+
'doc.reference': {
|
|
50
|
+
esMapping: { type: 'keyword', boost: DEFAULT_EXACT_MATCH_BOOST },
|
|
51
|
+
},
|
|
52
|
+
'doc.issueDate': {
|
|
53
|
+
esMapping: { type: 'date', ignore_malformed: true },
|
|
54
|
+
},
|
|
55
|
+
'doc.dueDate': {
|
|
56
|
+
esMapping: { type: 'date', ignore_malformed: true },
|
|
57
|
+
},
|
|
58
|
+
'doc.organizationSummary.name': {
|
|
59
|
+
esMapping: { type: 'text' },
|
|
60
|
+
},
|
|
61
|
+
'doc.organizationSummary.id': {
|
|
62
|
+
esMapping: { type: 'keyword' },
|
|
63
|
+
},
|
|
64
|
+
'doc.organizationSummary.code': {
|
|
65
|
+
esMapping: { type: 'keyword' },
|
|
66
|
+
},
|
|
67
|
+
'doc.organizationSummary.vatNumber': {
|
|
68
|
+
esMapping: { type: 'text' },
|
|
69
|
+
},
|
|
70
|
+
'doc.lines.associations.businessEntityId': {
|
|
71
|
+
esMapping: { type: 'keyword' },
|
|
72
|
+
},
|
|
73
|
+
'doc.lines.associations.recordId': {
|
|
74
|
+
esMapping: { type: 'keyword' },
|
|
75
|
+
},
|
|
76
|
+
'doc.lines.associations.title': {
|
|
77
|
+
esMapping: { type: 'text' },
|
|
78
|
+
},
|
|
79
|
+
'doc.lines.associations.description': {
|
|
80
|
+
esMapping: { type: 'text' },
|
|
81
|
+
},
|
|
82
|
+
'doc.lines.associations.tags': {
|
|
83
|
+
esMapping: { type: 'keyword' },
|
|
84
|
+
},
|
|
85
|
+
'doc.invoiceId': {
|
|
86
|
+
esMapping: { type: 'keyword' },
|
|
87
|
+
},
|
|
88
|
+
'custom.validators': {
|
|
89
|
+
esMapping: { type: 'keyword' },
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
const ADMIN_DOC_DRAFT_MAPPING_FIELDS = {
|
|
93
|
+
'doc.tags': {
|
|
94
|
+
esMapping: { type: 'text' },
|
|
95
|
+
},
|
|
96
|
+
'doc.associations.businessEntityId': {
|
|
97
|
+
esMapping: { type: 'keyword' },
|
|
98
|
+
},
|
|
99
|
+
'doc.associations.recordId': {
|
|
100
|
+
esMapping: { type: 'keyword' },
|
|
101
|
+
},
|
|
102
|
+
'doc.associations.title': {
|
|
103
|
+
esMapping: { type: 'text' },
|
|
104
|
+
},
|
|
105
|
+
'doc.associations.description': {
|
|
106
|
+
esMapping: { type: 'text' },
|
|
107
|
+
},
|
|
108
|
+
'doc.associations.tags': {
|
|
109
|
+
esMapping: { type: 'keyword' },
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
export const DOC_DRAFT_MAPPING_FIELDS = {
|
|
113
|
+
...BASE_DOC_DRAFT_MAPPING_FIELDS,
|
|
114
|
+
...FINANCE_DOC_DRAFT_MAPPING_FIELDS,
|
|
115
|
+
...ADMIN_DOC_DRAFT_MAPPING_FIELDS,
|
|
116
|
+
};
|
|
117
|
+
export const DOC_DRAFT_DEFINITION_FIELDS = {
|
|
118
|
+
'doc.id': {
|
|
119
|
+
id: 'doc.id',
|
|
120
|
+
titles: getTranslatedTitles('id'),
|
|
121
|
+
type: FieldTypes.text,
|
|
122
|
+
},
|
|
123
|
+
'custom.stage': {
|
|
124
|
+
id: 'custom.stage',
|
|
125
|
+
titles: getTranslatedTitles('aggs.draft.stage'),
|
|
126
|
+
type: FieldTypes.text,
|
|
127
|
+
},
|
|
128
|
+
'doc.documentType': {
|
|
129
|
+
id: 'doc.documentType',
|
|
130
|
+
titles: getTranslatedTitles('aggs.draft.documentType'),
|
|
131
|
+
type: FieldTypes.text,
|
|
132
|
+
},
|
|
133
|
+
'doc.branchId': {
|
|
134
|
+
id: 'doc.branchId',
|
|
135
|
+
titles: getTranslatedTitles('branch'),
|
|
136
|
+
type: FieldTypes.text,
|
|
137
|
+
},
|
|
138
|
+
'doc.createdAt': {
|
|
139
|
+
id: 'doc.createdAt',
|
|
140
|
+
titles: getTranslatedTitles('aggs.creationDate'),
|
|
141
|
+
type: FieldTypes.date,
|
|
142
|
+
meta: {
|
|
143
|
+
granularity: DateGranularity.yearMonthDayTime,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
'custom.validationRulesStatus': {
|
|
147
|
+
id: 'custom.validationRulesStatus',
|
|
148
|
+
titles: getTranslatedTitles('aggs.draft.validationRules'),
|
|
149
|
+
type: FieldTypes.text,
|
|
150
|
+
},
|
|
151
|
+
'doc.createdBy': {
|
|
152
|
+
id: 'doc.createdBy',
|
|
153
|
+
titles: getTranslatedTitles('aggs.createdBy'),
|
|
154
|
+
type: FieldTypes.collaborator,
|
|
155
|
+
},
|
|
156
|
+
'doc.subtype': {
|
|
157
|
+
id: 'doc.subtype',
|
|
158
|
+
titles: getTranslatedTitles('type'),
|
|
159
|
+
type: FieldTypes.text,
|
|
160
|
+
},
|
|
161
|
+
'custom.rejected': {
|
|
162
|
+
id: 'custom.rejected',
|
|
163
|
+
titles: getTranslatedTitles('aggs.draft.rejected'),
|
|
164
|
+
type: FieldTypes.checkbox,
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
export const getSearchDocumentDraftsAggs = () => [
|
|
168
|
+
{
|
|
169
|
+
titles: getTranslatedTitles('aggs.draft.stage'),
|
|
170
|
+
fieldId: 'custom.stage',
|
|
171
|
+
fieldType: FieldTypes.text,
|
|
172
|
+
type: AggregationType.term,
|
|
173
|
+
orderBy: 'count',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
titles: getTranslatedTitles('aggs.draft.documentType'),
|
|
177
|
+
fieldId: 'doc.documentType',
|
|
178
|
+
fieldType: FieldTypes.text,
|
|
179
|
+
type: AggregationType.term,
|
|
180
|
+
orderBy: 'count',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
titles: getTranslatedTitles('type'),
|
|
184
|
+
fieldId: 'doc.subtype',
|
|
185
|
+
fieldType: FieldTypes.text,
|
|
186
|
+
type: AggregationType.term,
|
|
187
|
+
orderBy: 'count',
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
titles: getTranslatedTitles('aggs.draft.rejected'),
|
|
191
|
+
fieldId: 'custom.rejected',
|
|
192
|
+
fieldType: FieldTypes.checkbox,
|
|
193
|
+
type: AggregationType.term,
|
|
194
|
+
orderBy: 'count',
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
titles: getTranslatedTitles('aggs.draft.validationRules'),
|
|
198
|
+
fieldId: 'custom.validationRulesStatus',
|
|
199
|
+
fieldType: FieldTypes.text,
|
|
200
|
+
type: AggregationType.term,
|
|
201
|
+
orderBy: 'count',
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
titles: getTranslatedTitles('aggs.creationDate'),
|
|
205
|
+
fieldId: 'doc.createdAt',
|
|
206
|
+
step: 1,
|
|
207
|
+
type: AggregationType.range,
|
|
208
|
+
ranges: [
|
|
209
|
+
{
|
|
210
|
+
start: getTime(parseISO('2015-01-01')),
|
|
211
|
+
end: getTime(setSeconds(setMinutes(setHours(new UTCDate(), 23), 59), 59)),
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
];
|
|
216
|
+
export const SEARCH_DOC_DRAFT_FULL_TEXT_FIELDS = [
|
|
217
|
+
() => 'doc.reference',
|
|
218
|
+
() => 'doc.tags',
|
|
219
|
+
() => 'doc.lines.associations.tags',
|
|
220
|
+
() => 'doc.tags',
|
|
221
|
+
() => 'doc.associations.tags',
|
|
222
|
+
() => 'doc.organizationSummary.name',
|
|
223
|
+
() => 'doc.organizationSummary.id',
|
|
224
|
+
() => 'doc.organizationSummary.code',
|
|
225
|
+
() => 'doc.organizationSummary.vatNumber',
|
|
226
|
+
];
|
|
227
|
+
export const SEARCH_DOC_DRAFTS_MAPPINGS = {
|
|
228
|
+
name: 'document_drafts',
|
|
229
|
+
nestedEsPaths: [],
|
|
230
|
+
fields: {
|
|
231
|
+
...DOC_DRAFT_MAPPING_FIELDS,
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
export const SEARCH_DOC_DRAFTS_DEFINITION = {
|
|
235
|
+
fields: {
|
|
236
|
+
...DOC_DRAFT_DEFINITION_FIELDS,
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
//# sourceMappingURL=search.js.map
|
|
@@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E,CAAC,8BAA8B;IACpC,GAAG,EAAE,CAAC,mCAAmC;CAC1C,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAiB;IACtD,IAAI,EAAE,iBAAiB;IACvB,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE;QACN,GAAG,wBAAwB;KAC5B;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAqB;IAC5D,MAAM,EAAE;QACN,GAAG,2BAA2B;KAC/B;CACF,CAAC","sourcesContent":["import { DEFAULT_EXACT_MATCH_BOOST } from '@bisondesk/commons/es';\nimport { getTranslatedTitles } from '@bisondesk/commons/translations';\nimport {\n EsAggregationsDefinition,\n EsDefinition,\n EsDefinitionField,\n EsFullTextSearchDefinition,\n SearchDefinition,\n SearchField,\n} from '@bisondesk/core-sdk/types/definitions';\nimport { DateGranularity, FieldTypes } from '@bisondesk/core-sdk/types/fields';\nimport { AggregationType } from '@bisondesk/core-sdk/types/search';\nimport { UTCDate } from '@date-fns/utc';\nimport { getTime, parseISO, setHours, setMinutes, setSeconds } from 'date-fns';\n\nconst BASE_DOC_DRAFT_MAPPING_FIELDS: {\n [fieldId: string]: EsDefinitionField;\n} = {\n 'doc.id': {\n esMapping: { type: 'keyword', boost: DEFAULT_EXACT_MATCH_BOOST },\n },\n 'doc.status': {\n esMapping: { type: 'keyword' },\n },\n 'doc.documentType': {\n esMapping: { type: 'keyword' },\n },\n 'doc.category': {\n esMapping: { type: 'keyword' },\n },\n 'doc.branchId': {\n esMapping: { type: 'keyword' },\n },\n 'doc.attachment': {\n esMapping: { type: 'object', enabled: false },\n },\n 'doc.createdAt': {\n esMapping: { type: 'date' },\n },\n 'doc.createdBy': {\n esMapping: { type: 'keyword' },\n },\n 'custom.stage': {\n esMapping: { type: 'keyword' },\n },\n 'custom.rejected': {\n esMapping: { type: 'boolean' },\n },\n 'custom.validationRulesStatus': {\n esMapping: { type: 'keyword' },\n },\n};\n\nconst FINANCE_DOC_DRAFT_MAPPING_FIELDS: {\n [fieldId: string]: EsDefinitionField;\n} = {\n 'doc.type': {\n esMapping: { type: 'keyword' },\n },\n 'doc.subtype': {\n esMapping: { type: 'keyword' },\n },\n 'doc.reference': {\n esMapping: { type: 'keyword', boost: DEFAULT_EXACT_MATCH_BOOST },\n },\n 'doc.issueDate': {\n esMapping: { type: 'date', ignore_malformed: true },\n },\n 'doc.dueDate': {\n esMapping: { type: 'date', ignore_malformed: true },\n },\n\n 'doc.organizationSummary.name': {\n esMapping: { type: 'text' },\n },\n 'doc.organizationSummary.id': {\n esMapping: { type: 'keyword' },\n },\n 'doc.organizationSummary.code': {\n esMapping: { type: 'keyword' },\n },\n 'doc.organizationSummary.vatNumber': {\n esMapping: { type: 'text' },\n },\n\n 'doc.lines.associations.businessEntityId': {\n esMapping: { type: 'keyword' },\n },\n 'doc.lines.associations.recordId': {\n esMapping: { type: 'keyword' },\n },\n 'doc.lines.associations.title': {\n esMapping: { type: 'text' },\n },\n 'doc.lines.associations.description': {\n esMapping: { type: 'text' },\n },\n 'doc.lines.associations.tags': {\n esMapping: { type: 'keyword' },\n },\n 'doc.invoiceId': {\n esMapping: { type: 'keyword' },\n },\n 'custom.validators': {\n esMapping: { type: 'keyword' },\n },\n};\n\nconst ADMIN_DOC_DRAFT_MAPPING_FIELDS: {\n [fieldId: string]: EsDefinitionField;\n} = {\n 'doc.tags': {\n esMapping: { type: 'text' },\n },\n 'doc.associations.businessEntityId': {\n esMapping: { type: 'keyword' },\n },\n 'doc.associations.recordId': {\n esMapping: { type: 'keyword' },\n },\n 'doc.associations.title': {\n esMapping: { type: 'text' },\n },\n 'doc.associations.description': {\n esMapping: { type: 'text' },\n },\n 'doc.associations.tags': {\n esMapping: { type: 'keyword' },\n },\n};\n\nexport const DOC_DRAFT_MAPPING_FIELDS: {\n [fieldId: string]: EsDefinitionField;\n} = {\n ...BASE_DOC_DRAFT_MAPPING_FIELDS,\n ...FINANCE_DOC_DRAFT_MAPPING_FIELDS,\n ...ADMIN_DOC_DRAFT_MAPPING_FIELDS,\n};\n\nexport const DOC_DRAFT_DEFINITION_FIELDS: {\n [fieldId: string]: SearchField;\n} = {\n 'doc.id': {\n id: 'doc.id',\n titles: getTranslatedTitles('id'),\n type: FieldTypes.text,\n },\n 'custom.stage': {\n id: 'custom.stage',\n titles: getTranslatedTitles('aggs.draft.stage'),\n type: FieldTypes.text,\n },\n 'doc.documentType': {\n id: 'doc.documentType',\n titles: getTranslatedTitles('aggs.draft.documentType'),\n type: FieldTypes.text,\n },\n 'doc.branchId': {\n id: 'doc.branchId',\n titles: getTranslatedTitles('branch'),\n type: FieldTypes.text,\n },\n 'doc.createdAt': {\n id: 'doc.createdAt',\n titles: getTranslatedTitles('aggs.creationDate'),\n type: FieldTypes.date,\n meta: {\n granularity: DateGranularity.yearMonthDayTime,\n },\n },\n 'custom.validationRulesStatus': {\n id: 'custom.validationRulesStatus',\n titles: getTranslatedTitles('aggs.draft.validationRules'),\n type: FieldTypes.text,\n },\n 'doc.createdBy': {\n id: 'doc.createdBy',\n titles: getTranslatedTitles('aggs.createdBy'),\n type: FieldTypes.collaborator,\n },\n // Finance fields\n 'doc.subtype': {\n id: 'doc.subtype',\n titles: getTranslatedTitles('type'),\n type: FieldTypes.text,\n },\n 'custom.rejected': {\n id: 'custom.rejected',\n titles: getTranslatedTitles('aggs.draft.rejected'),\n type: FieldTypes.checkbox,\n },\n};\n\nexport const getSearchDocumentDraftsAggs = (): EsAggregationsDefinition => [\n {\n titles: getTranslatedTitles('aggs.draft.stage'),\n fieldId: 'custom.stage',\n fieldType: FieldTypes.text,\n type: AggregationType.term,\n orderBy: 'count',\n },\n {\n titles: getTranslatedTitles('aggs.draft.documentType'),\n fieldId: 'doc.documentType',\n fieldType: FieldTypes.text,\n type: AggregationType.term,\n orderBy: 'count',\n },\n {\n titles: getTranslatedTitles('type'),\n fieldId: 'doc.subtype',\n fieldType: FieldTypes.text,\n type: AggregationType.term,\n orderBy: 'count',\n },\n {\n titles: getTranslatedTitles('aggs.draft.rejected'),\n fieldId: 'custom.rejected',\n fieldType: FieldTypes.checkbox,\n type: AggregationType.term,\n orderBy: 'count',\n },\n {\n titles: getTranslatedTitles('aggs.draft.validationRules'),\n fieldId: 'custom.validationRulesStatus',\n fieldType: FieldTypes.text,\n type: AggregationType.term,\n orderBy: 'count',\n },\n {\n titles: getTranslatedTitles('aggs.creationDate'),\n fieldId: 'doc.createdAt',\n step: 1,\n type: AggregationType.range,\n ranges: [\n {\n start: getTime(parseISO('2015-01-01')),\n end: getTime(setSeconds(setMinutes(setHours(new UTCDate(), 23), 59), 59)),\n },\n ],\n },\n];\n\nexport const SEARCH_DOC_DRAFT_FULL_TEXT_FIELDS: EsFullTextSearchDefinition = [\n // finance fields\n () => 'doc.reference',\n () => 'doc.tags',\n () => 'doc.lines.associations.tags',\n // administrative fields\n () => 'doc.tags',\n () => 'doc.associations.tags',\n // OrgSummary fields\n () => 'doc.organizationSummary.name',\n () => 'doc.organizationSummary.id',\n () => 'doc.organizationSummary.code',\n () => 'doc.organizationSummary.vatNumber',\n];\n\nexport const SEARCH_DOC_DRAFTS_MAPPINGS: EsDefinition = {\n name: 'document_drafts',\n nestedEsPaths: [],\n fields: {\n ...DOC_DRAFT_MAPPING_FIELDS,\n },\n};\n\nexport const SEARCH_DOC_DRAFTS_DEFINITION: SearchDefinition = {\n fields: {\n ...DOC_DRAFT_DEFINITION_FIELDS,\n },\n};\n"]}
|
package/package.json
CHANGED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { DEFAULT_EXACT_MATCH_BOOST } from '@bisondesk/commons/es';
|
|
2
|
+
import { getTranslatedTitles } from '@bisondesk/commons/translations';
|
|
3
|
+
import {
|
|
4
|
+
EsAggregationsDefinition,
|
|
5
|
+
EsDefinition,
|
|
6
|
+
EsDefinitionField,
|
|
7
|
+
EsFullTextSearchDefinition,
|
|
8
|
+
SearchDefinition,
|
|
9
|
+
SearchField,
|
|
10
|
+
} from '@bisondesk/core-sdk/types/definitions';
|
|
11
|
+
import { DateGranularity, FieldTypes } from '@bisondesk/core-sdk/types/fields';
|
|
12
|
+
import { AggregationType } from '@bisondesk/core-sdk/types/search';
|
|
13
|
+
import { UTCDate } from '@date-fns/utc';
|
|
14
|
+
import { getTime, parseISO, setHours, setMinutes, setSeconds } from 'date-fns';
|
|
15
|
+
|
|
16
|
+
const BASE_DOC_DRAFT_MAPPING_FIELDS: {
|
|
17
|
+
[fieldId: string]: EsDefinitionField;
|
|
18
|
+
} = {
|
|
19
|
+
'doc.id': {
|
|
20
|
+
esMapping: { type: 'keyword', boost: DEFAULT_EXACT_MATCH_BOOST },
|
|
21
|
+
},
|
|
22
|
+
'doc.status': {
|
|
23
|
+
esMapping: { type: 'keyword' },
|
|
24
|
+
},
|
|
25
|
+
'doc.documentType': {
|
|
26
|
+
esMapping: { type: 'keyword' },
|
|
27
|
+
},
|
|
28
|
+
'doc.category': {
|
|
29
|
+
esMapping: { type: 'keyword' },
|
|
30
|
+
},
|
|
31
|
+
'doc.branchId': {
|
|
32
|
+
esMapping: { type: 'keyword' },
|
|
33
|
+
},
|
|
34
|
+
'doc.attachment': {
|
|
35
|
+
esMapping: { type: 'object', enabled: false },
|
|
36
|
+
},
|
|
37
|
+
'doc.createdAt': {
|
|
38
|
+
esMapping: { type: 'date' },
|
|
39
|
+
},
|
|
40
|
+
'doc.createdBy': {
|
|
41
|
+
esMapping: { type: 'keyword' },
|
|
42
|
+
},
|
|
43
|
+
'custom.stage': {
|
|
44
|
+
esMapping: { type: 'keyword' },
|
|
45
|
+
},
|
|
46
|
+
'custom.rejected': {
|
|
47
|
+
esMapping: { type: 'boolean' },
|
|
48
|
+
},
|
|
49
|
+
'custom.validationRulesStatus': {
|
|
50
|
+
esMapping: { type: 'keyword' },
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const FINANCE_DOC_DRAFT_MAPPING_FIELDS: {
|
|
55
|
+
[fieldId: string]: EsDefinitionField;
|
|
56
|
+
} = {
|
|
57
|
+
'doc.type': {
|
|
58
|
+
esMapping: { type: 'keyword' },
|
|
59
|
+
},
|
|
60
|
+
'doc.subtype': {
|
|
61
|
+
esMapping: { type: 'keyword' },
|
|
62
|
+
},
|
|
63
|
+
'doc.reference': {
|
|
64
|
+
esMapping: { type: 'keyword', boost: DEFAULT_EXACT_MATCH_BOOST },
|
|
65
|
+
},
|
|
66
|
+
'doc.issueDate': {
|
|
67
|
+
esMapping: { type: 'date', ignore_malformed: true },
|
|
68
|
+
},
|
|
69
|
+
'doc.dueDate': {
|
|
70
|
+
esMapping: { type: 'date', ignore_malformed: true },
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
'doc.organizationSummary.name': {
|
|
74
|
+
esMapping: { type: 'text' },
|
|
75
|
+
},
|
|
76
|
+
'doc.organizationSummary.id': {
|
|
77
|
+
esMapping: { type: 'keyword' },
|
|
78
|
+
},
|
|
79
|
+
'doc.organizationSummary.code': {
|
|
80
|
+
esMapping: { type: 'keyword' },
|
|
81
|
+
},
|
|
82
|
+
'doc.organizationSummary.vatNumber': {
|
|
83
|
+
esMapping: { type: 'text' },
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
'doc.lines.associations.businessEntityId': {
|
|
87
|
+
esMapping: { type: 'keyword' },
|
|
88
|
+
},
|
|
89
|
+
'doc.lines.associations.recordId': {
|
|
90
|
+
esMapping: { type: 'keyword' },
|
|
91
|
+
},
|
|
92
|
+
'doc.lines.associations.title': {
|
|
93
|
+
esMapping: { type: 'text' },
|
|
94
|
+
},
|
|
95
|
+
'doc.lines.associations.description': {
|
|
96
|
+
esMapping: { type: 'text' },
|
|
97
|
+
},
|
|
98
|
+
'doc.lines.associations.tags': {
|
|
99
|
+
esMapping: { type: 'keyword' },
|
|
100
|
+
},
|
|
101
|
+
'doc.invoiceId': {
|
|
102
|
+
esMapping: { type: 'keyword' },
|
|
103
|
+
},
|
|
104
|
+
'custom.validators': {
|
|
105
|
+
esMapping: { type: 'keyword' },
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const ADMIN_DOC_DRAFT_MAPPING_FIELDS: {
|
|
110
|
+
[fieldId: string]: EsDefinitionField;
|
|
111
|
+
} = {
|
|
112
|
+
'doc.tags': {
|
|
113
|
+
esMapping: { type: 'text' },
|
|
114
|
+
},
|
|
115
|
+
'doc.associations.businessEntityId': {
|
|
116
|
+
esMapping: { type: 'keyword' },
|
|
117
|
+
},
|
|
118
|
+
'doc.associations.recordId': {
|
|
119
|
+
esMapping: { type: 'keyword' },
|
|
120
|
+
},
|
|
121
|
+
'doc.associations.title': {
|
|
122
|
+
esMapping: { type: 'text' },
|
|
123
|
+
},
|
|
124
|
+
'doc.associations.description': {
|
|
125
|
+
esMapping: { type: 'text' },
|
|
126
|
+
},
|
|
127
|
+
'doc.associations.tags': {
|
|
128
|
+
esMapping: { type: 'keyword' },
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export const DOC_DRAFT_MAPPING_FIELDS: {
|
|
133
|
+
[fieldId: string]: EsDefinitionField;
|
|
134
|
+
} = {
|
|
135
|
+
...BASE_DOC_DRAFT_MAPPING_FIELDS,
|
|
136
|
+
...FINANCE_DOC_DRAFT_MAPPING_FIELDS,
|
|
137
|
+
...ADMIN_DOC_DRAFT_MAPPING_FIELDS,
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const DOC_DRAFT_DEFINITION_FIELDS: {
|
|
141
|
+
[fieldId: string]: SearchField;
|
|
142
|
+
} = {
|
|
143
|
+
'doc.id': {
|
|
144
|
+
id: 'doc.id',
|
|
145
|
+
titles: getTranslatedTitles('id'),
|
|
146
|
+
type: FieldTypes.text,
|
|
147
|
+
},
|
|
148
|
+
'custom.stage': {
|
|
149
|
+
id: 'custom.stage',
|
|
150
|
+
titles: getTranslatedTitles('aggs.draft.stage'),
|
|
151
|
+
type: FieldTypes.text,
|
|
152
|
+
},
|
|
153
|
+
'doc.documentType': {
|
|
154
|
+
id: 'doc.documentType',
|
|
155
|
+
titles: getTranslatedTitles('aggs.draft.documentType'),
|
|
156
|
+
type: FieldTypes.text,
|
|
157
|
+
},
|
|
158
|
+
'doc.branchId': {
|
|
159
|
+
id: 'doc.branchId',
|
|
160
|
+
titles: getTranslatedTitles('branch'),
|
|
161
|
+
type: FieldTypes.text,
|
|
162
|
+
},
|
|
163
|
+
'doc.createdAt': {
|
|
164
|
+
id: 'doc.createdAt',
|
|
165
|
+
titles: getTranslatedTitles('aggs.creationDate'),
|
|
166
|
+
type: FieldTypes.date,
|
|
167
|
+
meta: {
|
|
168
|
+
granularity: DateGranularity.yearMonthDayTime,
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
'custom.validationRulesStatus': {
|
|
172
|
+
id: 'custom.validationRulesStatus',
|
|
173
|
+
titles: getTranslatedTitles('aggs.draft.validationRules'),
|
|
174
|
+
type: FieldTypes.text,
|
|
175
|
+
},
|
|
176
|
+
'doc.createdBy': {
|
|
177
|
+
id: 'doc.createdBy',
|
|
178
|
+
titles: getTranslatedTitles('aggs.createdBy'),
|
|
179
|
+
type: FieldTypes.collaborator,
|
|
180
|
+
},
|
|
181
|
+
// Finance fields
|
|
182
|
+
'doc.subtype': {
|
|
183
|
+
id: 'doc.subtype',
|
|
184
|
+
titles: getTranslatedTitles('type'),
|
|
185
|
+
type: FieldTypes.text,
|
|
186
|
+
},
|
|
187
|
+
'custom.rejected': {
|
|
188
|
+
id: 'custom.rejected',
|
|
189
|
+
titles: getTranslatedTitles('aggs.draft.rejected'),
|
|
190
|
+
type: FieldTypes.checkbox,
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export const getSearchDocumentDraftsAggs = (): EsAggregationsDefinition => [
|
|
195
|
+
{
|
|
196
|
+
titles: getTranslatedTitles('aggs.draft.stage'),
|
|
197
|
+
fieldId: 'custom.stage',
|
|
198
|
+
fieldType: FieldTypes.text,
|
|
199
|
+
type: AggregationType.term,
|
|
200
|
+
orderBy: 'count',
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
titles: getTranslatedTitles('aggs.draft.documentType'),
|
|
204
|
+
fieldId: 'doc.documentType',
|
|
205
|
+
fieldType: FieldTypes.text,
|
|
206
|
+
type: AggregationType.term,
|
|
207
|
+
orderBy: 'count',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
titles: getTranslatedTitles('type'),
|
|
211
|
+
fieldId: 'doc.subtype',
|
|
212
|
+
fieldType: FieldTypes.text,
|
|
213
|
+
type: AggregationType.term,
|
|
214
|
+
orderBy: 'count',
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
titles: getTranslatedTitles('aggs.draft.rejected'),
|
|
218
|
+
fieldId: 'custom.rejected',
|
|
219
|
+
fieldType: FieldTypes.checkbox,
|
|
220
|
+
type: AggregationType.term,
|
|
221
|
+
orderBy: 'count',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
titles: getTranslatedTitles('aggs.draft.validationRules'),
|
|
225
|
+
fieldId: 'custom.validationRulesStatus',
|
|
226
|
+
fieldType: FieldTypes.text,
|
|
227
|
+
type: AggregationType.term,
|
|
228
|
+
orderBy: 'count',
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
titles: getTranslatedTitles('aggs.creationDate'),
|
|
232
|
+
fieldId: 'doc.createdAt',
|
|
233
|
+
step: 1,
|
|
234
|
+
type: AggregationType.range,
|
|
235
|
+
ranges: [
|
|
236
|
+
{
|
|
237
|
+
start: getTime(parseISO('2015-01-01')),
|
|
238
|
+
end: getTime(setSeconds(setMinutes(setHours(new UTCDate(), 23), 59), 59)),
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
},
|
|
242
|
+
];
|
|
243
|
+
|
|
244
|
+
export const SEARCH_DOC_DRAFT_FULL_TEXT_FIELDS: EsFullTextSearchDefinition = [
|
|
245
|
+
// finance fields
|
|
246
|
+
() => 'doc.reference',
|
|
247
|
+
() => 'doc.tags',
|
|
248
|
+
() => 'doc.lines.associations.tags',
|
|
249
|
+
// administrative fields
|
|
250
|
+
() => 'doc.tags',
|
|
251
|
+
() => 'doc.associations.tags',
|
|
252
|
+
// OrgSummary fields
|
|
253
|
+
() => 'doc.organizationSummary.name',
|
|
254
|
+
() => 'doc.organizationSummary.id',
|
|
255
|
+
() => 'doc.organizationSummary.code',
|
|
256
|
+
() => 'doc.organizationSummary.vatNumber',
|
|
257
|
+
];
|
|
258
|
+
|
|
259
|
+
export const SEARCH_DOC_DRAFTS_MAPPINGS: EsDefinition = {
|
|
260
|
+
name: 'document_drafts',
|
|
261
|
+
nestedEsPaths: [],
|
|
262
|
+
fields: {
|
|
263
|
+
...DOC_DRAFT_MAPPING_FIELDS,
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export const SEARCH_DOC_DRAFTS_DEFINITION: SearchDefinition = {
|
|
268
|
+
fields: {
|
|
269
|
+
...DOC_DRAFT_DEFINITION_FIELDS,
|
|
270
|
+
},
|
|
271
|
+
};
|