@bisondesk/documents-sdk 1.0.594 → 1.0.596

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.
@@ -0,0 +1,476 @@
1
+ export const DOC_DRAFT_MAPPING_FIELDS: {
2
+ 'doc.tags': {
3
+ esMapping: {
4
+ type: string;
5
+ };
6
+ };
7
+ 'doc.associations.businessEntityId': {
8
+ esMapping: {
9
+ type: string;
10
+ };
11
+ };
12
+ 'doc.associations.recordId': {
13
+ esMapping: {
14
+ type: string;
15
+ };
16
+ };
17
+ 'doc.associations.title': {
18
+ esMapping: {
19
+ type: string;
20
+ };
21
+ };
22
+ 'doc.associations.description': {
23
+ esMapping: {
24
+ type: string;
25
+ };
26
+ };
27
+ 'doc.associations.tags': {
28
+ esMapping: {
29
+ type: string;
30
+ };
31
+ };
32
+ 'doc.type': {
33
+ esMapping: {
34
+ type: string;
35
+ };
36
+ };
37
+ 'doc.subtype': {
38
+ esMapping: {
39
+ type: string;
40
+ };
41
+ };
42
+ 'doc.reference': {
43
+ esMapping: {
44
+ type: string;
45
+ boost: any;
46
+ };
47
+ };
48
+ 'doc.issueDate': {
49
+ esMapping: {
50
+ type: string;
51
+ ignore_malformed: boolean;
52
+ };
53
+ };
54
+ 'doc.dueDate': {
55
+ esMapping: {
56
+ type: string;
57
+ ignore_malformed: boolean;
58
+ };
59
+ };
60
+ 'doc.organizationSummary.name': {
61
+ esMapping: {
62
+ type: string;
63
+ };
64
+ };
65
+ 'doc.organizationSummary.id': {
66
+ esMapping: {
67
+ type: string;
68
+ };
69
+ };
70
+ 'doc.organizationSummary.code': {
71
+ esMapping: {
72
+ type: string;
73
+ };
74
+ };
75
+ 'doc.organizationSummary.vatNumber': {
76
+ esMapping: {
77
+ type: string;
78
+ };
79
+ };
80
+ 'doc.lines.associations.businessEntityId': {
81
+ esMapping: {
82
+ type: string;
83
+ };
84
+ };
85
+ 'doc.lines.associations.recordId': {
86
+ esMapping: {
87
+ type: string;
88
+ };
89
+ };
90
+ 'doc.lines.associations.title': {
91
+ esMapping: {
92
+ type: string;
93
+ };
94
+ };
95
+ 'doc.lines.associations.description': {
96
+ esMapping: {
97
+ type: string;
98
+ };
99
+ };
100
+ 'doc.lines.associations.tags': {
101
+ esMapping: {
102
+ type: string;
103
+ };
104
+ };
105
+ 'doc.invoiceId': {
106
+ esMapping: {
107
+ type: string;
108
+ };
109
+ };
110
+ 'custom.validators': {
111
+ esMapping: {
112
+ type: string;
113
+ };
114
+ };
115
+ 'doc.id': {
116
+ esMapping: {
117
+ type: string;
118
+ boost: any;
119
+ };
120
+ };
121
+ 'doc.status': {
122
+ esMapping: {
123
+ type: string;
124
+ };
125
+ };
126
+ 'doc.documentType': {
127
+ esMapping: {
128
+ type: string;
129
+ };
130
+ };
131
+ 'doc.category': {
132
+ esMapping: {
133
+ type: string;
134
+ };
135
+ };
136
+ 'doc.branchId': {
137
+ esMapping: {
138
+ type: string;
139
+ };
140
+ };
141
+ 'doc.attachment': {
142
+ esMapping: {
143
+ type: string;
144
+ enabled: boolean;
145
+ };
146
+ };
147
+ 'doc.createdAt': {
148
+ esMapping: {
149
+ type: string;
150
+ };
151
+ };
152
+ 'doc.createdBy': {
153
+ esMapping: {
154
+ type: string;
155
+ };
156
+ };
157
+ 'custom.stage': {
158
+ esMapping: {
159
+ type: string;
160
+ };
161
+ };
162
+ 'custom.rejected': {
163
+ esMapping: {
164
+ type: string;
165
+ };
166
+ };
167
+ 'custom.validationRulesStatus': {
168
+ esMapping: {
169
+ type: string;
170
+ };
171
+ };
172
+ };
173
+ export const DOC_DRAFT_DEFINITION_FIELDS: {
174
+ 'doc.id': {
175
+ id: string;
176
+ titles: any;
177
+ type: FieldTypes;
178
+ };
179
+ 'custom.stage': {
180
+ id: string;
181
+ titles: any;
182
+ type: FieldTypes;
183
+ };
184
+ 'doc.documentType': {
185
+ id: string;
186
+ titles: any;
187
+ type: FieldTypes;
188
+ };
189
+ 'doc.branchId': {
190
+ id: string;
191
+ titles: any;
192
+ type: FieldTypes;
193
+ };
194
+ 'doc.createdAt': {
195
+ id: string;
196
+ titles: any;
197
+ type: FieldTypes;
198
+ meta: {
199
+ granularity: DateGranularity;
200
+ };
201
+ };
202
+ 'custom.validationRulesStatus': {
203
+ id: string;
204
+ titles: any;
205
+ type: FieldTypes;
206
+ };
207
+ 'doc.createdBy': {
208
+ id: string;
209
+ titles: any;
210
+ type: FieldTypes;
211
+ };
212
+ 'doc.subtype': {
213
+ id: string;
214
+ titles: any;
215
+ type: FieldTypes;
216
+ };
217
+ 'custom.rejected': {
218
+ id: string;
219
+ titles: any;
220
+ type: FieldTypes;
221
+ };
222
+ };
223
+ export function getSearchDocumentDraftsAggs(): ({
224
+ titles: any;
225
+ fieldId: string;
226
+ fieldType: FieldTypes;
227
+ type: AggregationType;
228
+ orderBy: string;
229
+ step?: undefined;
230
+ ranges?: undefined;
231
+ } | {
232
+ titles: any;
233
+ fieldId: string;
234
+ step: number;
235
+ type: AggregationType;
236
+ ranges: {
237
+ start: number;
238
+ end: number;
239
+ }[];
240
+ fieldType?: undefined;
241
+ orderBy?: undefined;
242
+ })[];
243
+ export const SEARCH_DOC_DRAFT_FULL_TEXT_FIELDS: (() => string)[];
244
+ export namespace SEARCH_DOC_DRAFTS_MAPPINGS {
245
+ let name: string;
246
+ let nestedEsPaths: never[];
247
+ let fields: {
248
+ 'doc.tags': {
249
+ esMapping: {
250
+ type: string;
251
+ };
252
+ };
253
+ 'doc.associations.businessEntityId': {
254
+ esMapping: {
255
+ type: string;
256
+ };
257
+ };
258
+ 'doc.associations.recordId': {
259
+ esMapping: {
260
+ type: string;
261
+ };
262
+ };
263
+ 'doc.associations.title': {
264
+ esMapping: {
265
+ type: string;
266
+ };
267
+ };
268
+ 'doc.associations.description': {
269
+ esMapping: {
270
+ type: string;
271
+ };
272
+ };
273
+ 'doc.associations.tags': {
274
+ esMapping: {
275
+ type: string;
276
+ };
277
+ };
278
+ 'doc.type': {
279
+ esMapping: {
280
+ type: string;
281
+ };
282
+ };
283
+ 'doc.subtype': {
284
+ esMapping: {
285
+ type: string;
286
+ };
287
+ };
288
+ 'doc.reference': {
289
+ esMapping: {
290
+ type: string;
291
+ boost: any;
292
+ };
293
+ };
294
+ 'doc.issueDate': {
295
+ esMapping: {
296
+ type: string;
297
+ ignore_malformed: boolean;
298
+ };
299
+ };
300
+ 'doc.dueDate': {
301
+ esMapping: {
302
+ type: string;
303
+ ignore_malformed: boolean;
304
+ };
305
+ };
306
+ 'doc.organizationSummary.name': {
307
+ esMapping: {
308
+ type: string;
309
+ };
310
+ };
311
+ 'doc.organizationSummary.id': {
312
+ esMapping: {
313
+ type: string;
314
+ };
315
+ };
316
+ 'doc.organizationSummary.code': {
317
+ esMapping: {
318
+ type: string;
319
+ };
320
+ };
321
+ 'doc.organizationSummary.vatNumber': {
322
+ esMapping: {
323
+ type: string;
324
+ };
325
+ };
326
+ 'doc.lines.associations.businessEntityId': {
327
+ esMapping: {
328
+ type: string;
329
+ };
330
+ };
331
+ 'doc.lines.associations.recordId': {
332
+ esMapping: {
333
+ type: string;
334
+ };
335
+ };
336
+ 'doc.lines.associations.title': {
337
+ esMapping: {
338
+ type: string;
339
+ };
340
+ };
341
+ 'doc.lines.associations.description': {
342
+ esMapping: {
343
+ type: string;
344
+ };
345
+ };
346
+ 'doc.lines.associations.tags': {
347
+ esMapping: {
348
+ type: string;
349
+ };
350
+ };
351
+ 'doc.invoiceId': {
352
+ esMapping: {
353
+ type: string;
354
+ };
355
+ };
356
+ 'custom.validators': {
357
+ esMapping: {
358
+ type: string;
359
+ };
360
+ };
361
+ 'doc.id': {
362
+ esMapping: {
363
+ type: string;
364
+ boost: any;
365
+ };
366
+ };
367
+ 'doc.status': {
368
+ esMapping: {
369
+ type: string;
370
+ };
371
+ };
372
+ 'doc.documentType': {
373
+ esMapping: {
374
+ type: string;
375
+ };
376
+ };
377
+ 'doc.category': {
378
+ esMapping: {
379
+ type: string;
380
+ };
381
+ };
382
+ 'doc.branchId': {
383
+ esMapping: {
384
+ type: string;
385
+ };
386
+ };
387
+ 'doc.attachment': {
388
+ esMapping: {
389
+ type: string;
390
+ enabled: boolean;
391
+ };
392
+ };
393
+ 'doc.createdAt': {
394
+ esMapping: {
395
+ type: string;
396
+ };
397
+ };
398
+ 'doc.createdBy': {
399
+ esMapping: {
400
+ type: string;
401
+ };
402
+ };
403
+ 'custom.stage': {
404
+ esMapping: {
405
+ type: string;
406
+ };
407
+ };
408
+ 'custom.rejected': {
409
+ esMapping: {
410
+ type: string;
411
+ };
412
+ };
413
+ 'custom.validationRulesStatus': {
414
+ esMapping: {
415
+ type: string;
416
+ };
417
+ };
418
+ };
419
+ }
420
+ export namespace SEARCH_DOC_DRAFTS_DEFINITION {
421
+ let fields_1: {
422
+ 'doc.id': {
423
+ id: string;
424
+ titles: any;
425
+ type: FieldTypes;
426
+ };
427
+ 'custom.stage': {
428
+ id: string;
429
+ titles: any;
430
+ type: FieldTypes;
431
+ };
432
+ 'doc.documentType': {
433
+ id: string;
434
+ titles: any;
435
+ type: FieldTypes;
436
+ };
437
+ 'doc.branchId': {
438
+ id: string;
439
+ titles: any;
440
+ type: FieldTypes;
441
+ };
442
+ 'doc.createdAt': {
443
+ id: string;
444
+ titles: any;
445
+ type: FieldTypes;
446
+ meta: {
447
+ granularity: DateGranularity;
448
+ };
449
+ };
450
+ 'custom.validationRulesStatus': {
451
+ id: string;
452
+ titles: any;
453
+ type: FieldTypes;
454
+ };
455
+ 'doc.createdBy': {
456
+ id: string;
457
+ titles: any;
458
+ type: FieldTypes;
459
+ };
460
+ 'doc.subtype': {
461
+ id: string;
462
+ titles: any;
463
+ type: FieldTypes;
464
+ };
465
+ 'custom.rejected': {
466
+ id: string;
467
+ titles: any;
468
+ type: FieldTypes;
469
+ };
470
+ };
471
+ export { fields_1 as fields };
472
+ }
473
+ import { FieldTypes } from '@bisondesk/core-sdk/types/fields';
474
+ import { DateGranularity } from '@bisondesk/core-sdk/types/fields';
475
+ import { AggregationType } from '@bisondesk/core-sdk/types/search';
476
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"/","sources":["constants/search.js"],"names":[],"mappings":"AA+GA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDE;AACK;;;;;;;;;;;;;;;;;;;KAgDN;AACD,iEAWE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAhO0C,kCAAkC;gCAAlC,kCAAkC;gCAC9C,kCAAkC"}
@@ -0,0 +1,240 @@
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.id',
218
+ () => 'doc.reference',
219
+ () => 'doc.tags',
220
+ () => 'doc.lines.associations.tags',
221
+ () => 'doc.tags',
222
+ () => 'doc.associations.tags',
223
+ () => 'doc.organizationSummary.name',
224
+ () => 'doc.organizationSummary.id',
225
+ () => 'doc.organizationSummary.code',
226
+ () => 'doc.organizationSummary.vatNumber',
227
+ ];
228
+ export const SEARCH_DOC_DRAFTS_MAPPINGS = {
229
+ name: 'document_drafts',
230
+ nestedEsPaths: [],
231
+ fields: {
232
+ ...DOC_DRAFT_MAPPING_FIELDS,
233
+ },
234
+ };
235
+ export const SEARCH_DOC_DRAFTS_DEFINITION = {
236
+ fields: {
237
+ ...DOC_DRAFT_DEFINITION_FIELDS,
238
+ },
239
+ };
240
+ //# sourceMappingURL=search.js.map