@bisondesk/documents-sdk 1.0.589 → 1.0.590

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.
@@ -1,12 +1,476 @@
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;
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
+ };
4
172
  };
5
- export declare const DOC_DRAFT_DEFINITION_FIELDS: {
6
- [fieldId: string]: SearchField;
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
+ };
7
222
  };
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;
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';
12
476
  //# sourceMappingURL=search.d.ts.map
@@ -1 +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;AAgI/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;CAwDhC,CAAC;AAEF,eAAO,MAAM,2BAA2B,QAAO,wBAuD9C,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,0BAc/C,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,YAMxC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,gBAI1C,CAAC"}
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"}
@@ -38,9 +38,6 @@ const BASE_DOC_DRAFT_MAPPING_FIELDS = {
38
38
  'custom.validationRulesStatus': {
39
39
  esMapping: { type: 'keyword' },
40
40
  },
41
- 'custom.businessValidationAt': {
42
- esMapping: { type: 'date' },
43
- },
44
41
  };
45
42
  const FINANCE_DOC_DRAFT_MAPPING_FIELDS = {
46
43
  'doc.type': {
@@ -91,9 +88,6 @@ const FINANCE_DOC_DRAFT_MAPPING_FIELDS = {
91
88
  'custom.validators': {
92
89
  esMapping: { type: 'keyword' },
93
90
  },
94
- 'custom.restrictedDraftUsers': {
95
- esMapping: { type: 'keyword' },
96
- },
97
91
  };
98
92
  const ADMIN_DOC_DRAFT_MAPPING_FIELDS = {
99
93
  'doc.tags': {
@@ -169,11 +163,6 @@ export const DOC_DRAFT_DEFINITION_FIELDS = {
169
163
  titles: getTranslatedTitles('aggs.draft.rejected'),
170
164
  type: FieldTypes.checkbox,
171
165
  },
172
- 'custom.restrictedDraftUsers': {
173
- id: 'custom.restrictedDraftUsers',
174
- titles: getTranslatedTitles('agg.drafts.restrictedDraftUsers'),
175
- type: FieldTypes.text,
176
- },
177
166
  };
178
167
  export const getSearchDocumentDraftsAggs = () => [
179
168
  {
@@ -223,13 +212,6 @@ export const getSearchDocumentDraftsAggs = () => [
223
212
  },
224
213
  ],
225
214
  },
226
- {
227
- titles: getTranslatedTitles('aggs.draft.restrictedDraftUsers'),
228
- fieldId: 'custom.restrictedDraftUsers',
229
- fieldType: FieldTypes.text,
230
- type: AggregationType.term,
231
- orderBy: 'count',
232
- },
233
215
  ];
234
216
  export const SEARCH_DOC_DRAFT_FULL_TEXT_FIELDS = [
235
217
  () => 'doc.id',
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","sourceRoot":"/","sources":["constants/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAStE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE/E,MAAM,6BAA6B,GAE/B;IACF,QAAQ,EAAE;QACR,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,yBAAyB,EAAE;KACjE;IACD,YAAY,EAAE;QACZ,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC/B;IACD,kBAAkB,EAAE;QAClB,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC/B;IACD,cAAc,EAAE;QACd,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC/B;IACD,cAAc,EAAE;QACd,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC/B;IACD,gBAAgB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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 'custom.businessValidationAt': {\n esMapping: { type: 'date' },\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 'custom.restrictedDraftUsers': {\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 'custom.restrictedDraftUsers': {\n id: 'custom.restrictedDraftUsers',\n titles: getTranslatedTitles('agg.drafts.restrictedDraftUsers'),\n type: FieldTypes.text,\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 titles: getTranslatedTitles('aggs.draft.restrictedDraftUsers'),\n fieldId: 'custom.restrictedDraftUsers',\n fieldType: FieldTypes.text,\n type: AggregationType.term,\n orderBy: 'count',\n },\n];\n\nexport const SEARCH_DOC_DRAFT_FULL_TEXT_FIELDS: EsFullTextSearchDefinition = [\n // finance fields\n () => 'doc.id',\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"]}
1
+ {"version":3,"file":"search.js","sourceRoot":"/","sources":["constants/search.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,E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ACvC,SAAS,EAAE,UAAU,CAAC,IAAI;QAC1B,IAAI,EAAE,eAAe,CAAC,IAAI;QAC1B,OAAO,EAAE,OAAO;KACnB;IACD;QACI,MAAM,EAAE,mBAAmB,CAAC,mBAAmB,CAAC;QAChD,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,eAAe,CAAC,KAAK;QAC3B,MAAM,EAAE;YACJ;gBACI,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;gBACtC,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;aAC5E;SACJ;KACJ;CACJ,CAAC;AACF,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC7C,GAAG,EAAE,CAAC,QAAQ;IACd,GAAG,EAAE,CAAC,eAAe;IACrB,GAAG,EAAE,CAAC,UAAU;IAChB,GAAG,EAAE,CAAC,6BAA6B;IACnC,GAAG,EAAE,CAAC,UAAU;IAChB,GAAG,EAAE,CAAC,uBAAuB;IAC7B,GAAG,EAAE,CAAC,8BAA8B;IACpC,GAAG,EAAE,CAAC,4BAA4B;IAClC,GAAG,EAAE,CAAC,8BAA8B;IACpC,GAAG,EAAE,CAAC,mCAAmC;CAC5C,CAAC;AACF,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACtC,IAAI,EAAE,iBAAiB;IACvB,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE;QACJ,GAAG,wBAAwB;KAC9B;CACJ,CAAC;AACF,MAAM,CAAC,MAAM,4BAA4B,GAAG;IACxC,MAAM,EAAE;QACJ,GAAG,2BAA2B;KACjC;CACJ,CAAC","sourcesContent":["import { DEFAULT_EXACT_MATCH_BOOST } from '@bisondesk/commons/es';\nimport { getTranslatedTitles } from '@bisondesk/commons/translations';\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';\nconst BASE_DOC_DRAFT_MAPPING_FIELDS = {\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};\nconst FINANCE_DOC_DRAFT_MAPPING_FIELDS = {\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 '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 '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};\nconst ADMIN_DOC_DRAFT_MAPPING_FIELDS = {\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};\nexport const DOC_DRAFT_MAPPING_FIELDS = {\n ...BASE_DOC_DRAFT_MAPPING_FIELDS,\n ...FINANCE_DOC_DRAFT_MAPPING_FIELDS,\n ...ADMIN_DOC_DRAFT_MAPPING_FIELDS,\n};\nexport const DOC_DRAFT_DEFINITION_FIELDS = {\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 '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};\nexport const getSearchDocumentDraftsAggs = () => [\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];\nexport const SEARCH_DOC_DRAFT_FULL_TEXT_FIELDS = [\n () => 'doc.id',\n () => 'doc.reference',\n () => 'doc.tags',\n () => 'doc.lines.associations.tags',\n () => 'doc.tags',\n () => 'doc.associations.tags',\n () => 'doc.organizationSummary.name',\n () => 'doc.organizationSummary.id',\n () => 'doc.organizationSummary.code',\n () => 'doc.organizationSummary.vatNumber',\n];\nexport const SEARCH_DOC_DRAFTS_MAPPINGS = {\n name: 'document_drafts',\n nestedEsPaths: [],\n fields: {\n ...DOC_DRAFT_MAPPING_FIELDS,\n },\n};\nexport const SEARCH_DOC_DRAFTS_DEFINITION = {\n fields: {\n ...DOC_DRAFT_DEFINITION_FIELDS,\n },\n};\n//# sourceMappingURL=search.js.map"]}
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@bisondesk/documents-sdk",
3
- "version": "1.0.589",
3
+ "version": "1.0.590",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "author": "TheTruckCompany",
7
7
  "dependencies": {
8
- "@bisondesk/commons": "*",
9
8
  "@bisondesk/commons-sdk": "*",
10
9
  "@bisondesk/core-sdk": "*",
11
10
  "@date-fns/utc": "1.1.1",
@@ -0,0 +1,45 @@
1
+ import { AppRoles, SYSTEM_USER_ID } from '@bisondesk/commons-sdk/constants';
2
+ import { getPdfPreviewSrc } from '../utils/previews.js';
3
+ export const DOCUMENT_PROCESSING_SETTINGS_ID = 'document-processing';
4
+ export const PRIVATE_DOCUMENT_ROLES = [
5
+ AppRoles.Board,
6
+ AppRoles.GeneralManager,
7
+ AppRoles.SeniorAccountant,
8
+ ];
9
+ export const DEFAULT_DOCUMENT_ROLES = [
10
+ AppRoles.Accountant,
11
+ AppRoles.Admin,
12
+ AppRoles.Administrative,
13
+ AppRoles.Board,
14
+ AppRoles.GeneralManager,
15
+ AppRoles.SalesManager,
16
+ AppRoles.SeniorAccountant,
17
+ ];
18
+ export const SALE_USED_VEHICLES_DOC_CATEGORY_ID = 'used_vehicles_sale';
19
+ export const SALE_USED_VEHICLES_COST_CENTER_ID = 'USED';
20
+ export const SALE_NEW_VEHICLES_DOC_CATEGORY_ID = 'new_vehicles_sale';
21
+ export const SALE_NEW_VEHICLES_COST_CENTER_ID = 'NEW';
22
+ export const SALE_OTHERS_DOC_CATEGORY_ID = 'others_sale';
23
+ export const SALE_OTHERS_COST_CENTER_ID = 'OTHERS';
24
+ export const HEAVY_VEHICLES_LINE_CATEGORY_ID = 'heavy_vehicles';
25
+ export const LIGHT_VEHICLES_LINE_CATEGORY_ID = 'light_vehicles';
26
+ export const ADMIN_IC_LINE_CATEGORY_ID = 'admin_ic';
27
+ export const ADMIN_NOT_IC_LINE_CATEGORY_ID = 'admin_not_ic';
28
+ export const DIVERSE_IC_LINE_CATEGORY_ID = 'diverse_ic';
29
+ export const DIVERSE_NOT_IC_LINE_CATEGORY_ID = 'diverse_not_ic';
30
+ export const OWN_WORK_LINE_CATEGORY_ID = 'own_work';
31
+ export const ENV_CONTRIBUTION_TYRES_LINE_CATEGORY_ID = 'env_contribution_tyres';
32
+ export const STANDARD_VAT_CODE_ID = 'standard';
33
+ export const SALE_EU_INTRA_COMMUNITY_VAT_CODE_ID = 'eu_ics_sale';
34
+ export const SALE_EU_EXTRA_COMMUNITY_VAT_CODE_ID = 'eu_ecs_sale';
35
+ export const GENERATING_PLACEHOLDER_ATTACHMENT = {
36
+ id: 'generating',
37
+ contentType: 'application/pdf',
38
+ fileName: 'generating.pdf',
39
+ uploadedBy: SYSTEM_USER_ID,
40
+ uploadedAt: '2024-04-08T14:51:55.785Z',
41
+ size: 95749,
42
+ url: '/storage/public/generating.pdf',
43
+ previewSrc: getPdfPreviewSrc('/storage/public/generating.pdf'),
44
+ };
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,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,CAA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