@contrail/flexplm 1.1.63 → 1.1.65
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/publish/base-process-publish-assortment.d.ts +10 -9
- package/lib/publish/base-process-publish-assortment.js +30 -17
- package/lib/publish/base-process-publish-assortment.spec.js +81 -9
- package/lib/publish/mockData.d.ts +68 -0
- package/lib/publish/mockData.js +257 -1
- package/lib/util/data-converter.d.ts +1 -0
- package/lib/util/data-converter.js +12 -2
- package/lib/util/data-converter.spec.js +40 -0
- package/package.json +2 -1
- package/src/publish/base-process-publish-assortment.spec.ts +131 -35
- package/src/publish/base-process-publish-assortment.ts +48 -29
- package/src/publish/mockData.ts +4817 -4560
- package/src/util/data-converter.spec.ts +45 -0
- package/src/util/data-converter.ts +19 -2
- package/src/util/flexplm-connect.ts +199 -199
- package/src/util/type-conversion-utils.spec.ts +643 -643
|
@@ -3,6 +3,7 @@ import { DataConverter } from '../util/data-converter';
|
|
|
3
3
|
import { ItemFamilyChanges } from '../interfaces/item-family-changes';
|
|
4
4
|
import { PublishChangeData } from '../interfaces/publish-change-data';
|
|
5
5
|
import { MapFileUtil } from '@contrail/transform-data';
|
|
6
|
+
import { AssortmentPublishChange } from '@contrail/entity-types';
|
|
6
7
|
export declare class BaseProcessPublishAssortment {
|
|
7
8
|
private TTL;
|
|
8
9
|
static ASSORTMENT_NOT_PUBLISHABLE: string;
|
|
@@ -35,16 +36,16 @@ export declare class BaseProcessPublishAssortment {
|
|
|
35
36
|
getSnapshotVersion(assortment: any, apc: any): Promise<number | string>;
|
|
36
37
|
getSeasonFederation(assortmentId: any): Promise<SeasonFederation>;
|
|
37
38
|
getAssortment(assortmentId: any): Promise<any>;
|
|
38
|
-
getSinceDate(assortmentId: any, assortmentPublishChangeId: any, apcHistory:
|
|
39
|
-
getApcHistory(assortmentId:
|
|
39
|
+
getSinceDate(assortmentId: any, assortmentPublishChangeId: any, apcHistory: AssortmentPublishChange[]): Promise<Date>;
|
|
40
|
+
getApcHistory(assortmentId: string): Promise<AssortmentPublishChange[]>;
|
|
40
41
|
protected updatedSinceDate(entity: any, sinceDate: Date): boolean;
|
|
41
|
-
getSinceDateFromAPCSpecificDate(apcHistory:
|
|
42
|
-
getSinceDateDaysPrevious(apcHistory:
|
|
43
|
-
getSinceDateFromAPCs(apcHistory:
|
|
44
|
-
protected getPublisher(assortmentPublishChange:
|
|
45
|
-
downloadAssortmentPublishChange(assortmentId: string, assortmentPublishChangeId: string): Promise<
|
|
46
|
-
downloadHydratedChangeDetail(assortmentPublishChange:
|
|
47
|
-
downloadAssortmentBaseline(assortmentPublishChange:
|
|
42
|
+
getSinceDateFromAPCSpecificDate(apcHistory: AssortmentPublishChange[], assortmentPublishChangeId: string, specificDate: Date): Date;
|
|
43
|
+
getSinceDateDaysPrevious(apcHistory: AssortmentPublishChange[], assortmentPublishChangeId: string, daysBack: any): Date;
|
|
44
|
+
getSinceDateFromAPCs(apcHistory: AssortmentPublishChange[], assortmentPublishChangeId: string, pastPublishCount?: number): Date;
|
|
45
|
+
protected getPublisher(assortmentPublishChange: AssortmentPublishChange): {};
|
|
46
|
+
downloadAssortmentPublishChange(assortmentId: string, assortmentPublishChangeId: string): Promise<AssortmentPublishChange>;
|
|
47
|
+
downloadHydratedChangeDetail(assortmentPublishChange: AssortmentPublishChange): Promise<any>;
|
|
48
|
+
downloadAssortmentBaseline(assortmentPublishChange: AssortmentPublishChange): Promise<any>;
|
|
48
49
|
getDeleteChanges(assortmentPublishChange: any, apcHistory: any[], assortmentBaseline: any, sinceDate: Date): Promise<[]>;
|
|
49
50
|
getBaselineItemIds(assortmentBaseline: any): string[];
|
|
50
51
|
downloadDeleteChanges(apc: any): Promise<any>;
|
|
@@ -200,14 +200,30 @@ class BaseProcessPublishAssortment {
|
|
|
200
200
|
return sinceDate;
|
|
201
201
|
}
|
|
202
202
|
async getApcHistory(assortmentId) {
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
203
|
+
const apcs = [];
|
|
204
|
+
const MAX_PAGES = 1000;
|
|
205
|
+
let nextPageKey = null;
|
|
206
|
+
const options = {
|
|
207
|
+
entityName: 'assortment',
|
|
208
|
+
id: assortmentId,
|
|
209
|
+
apiVersion: sdk_1.API_VERSION.V2,
|
|
210
|
+
nextPageKey,
|
|
211
|
+
relation: 'history',
|
|
212
|
+
};
|
|
213
|
+
let i = 0;
|
|
214
|
+
do {
|
|
215
|
+
const response = await new sdk_1.Entities().get(options);
|
|
216
|
+
if (response?.results) {
|
|
217
|
+
apcs.push(...response.results);
|
|
209
218
|
}
|
|
210
|
-
|
|
219
|
+
nextPageKey = response?.nextPageKey;
|
|
220
|
+
options.nextPageKey = nextPageKey;
|
|
221
|
+
i++;
|
|
222
|
+
} while (nextPageKey && i < MAX_PAGES);
|
|
223
|
+
if (i === MAX_PAGES && nextPageKey) {
|
|
224
|
+
throw new Error('Max pages reached getting APC history for assortmentId: ' + assortmentId);
|
|
225
|
+
}
|
|
226
|
+
return apcs;
|
|
211
227
|
}
|
|
212
228
|
updatedSinceDate(entity, sinceDate) {
|
|
213
229
|
const updatedOn = entity?.updatedOn;
|
|
@@ -261,13 +277,8 @@ class BaseProcessPublishAssortment {
|
|
|
261
277
|
if (apcHistory.length === 1) {
|
|
262
278
|
return new Date(0);
|
|
263
279
|
}
|
|
264
|
-
const
|
|
265
|
-
if (apcIndex === 0) {
|
|
266
|
-
return new Date(0);
|
|
267
|
-
}
|
|
268
|
-
const apc = apcHistory[apcIndex];
|
|
280
|
+
const apc = apcHistory.find(apc => apc.id === assortmentPublishChangeId);
|
|
269
281
|
const apcDate = new Date(apc?.createdOn);
|
|
270
|
-
let sinceDate = new Date(0);
|
|
271
282
|
const dateArray = [];
|
|
272
283
|
for (const tempapc of apcHistory) {
|
|
273
284
|
if (assortmentPublishChangeId !== tempapc?.id) {
|
|
@@ -277,10 +288,12 @@ class BaseProcessPublishAssortment {
|
|
|
277
288
|
}
|
|
278
289
|
}
|
|
279
290
|
}
|
|
280
|
-
dateArray.
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
return
|
|
291
|
+
if (dateArray.length === 0 || pastPublishCount > dateArray.length) {
|
|
292
|
+
return new Date(0);
|
|
293
|
+
}
|
|
294
|
+
dateArray.sort((a, b) => { return a.getTime() - b.getTime(); });
|
|
295
|
+
const arrIndex = dateArray.length - pastPublishCount;
|
|
296
|
+
return dateArray[arrIndex];
|
|
284
297
|
}
|
|
285
298
|
getPublisher(assortmentPublishChange) {
|
|
286
299
|
const createdBy = assortmentPublishChange?.createdBy;
|
|
@@ -624,8 +624,8 @@ describe('getSinceDateDaysPrevious', () => {
|
|
|
624
624
|
expect(sinceDate).toEqual(matchDate);
|
|
625
625
|
});
|
|
626
626
|
});
|
|
627
|
-
describe('getSinceDateFromAPCs', () => {
|
|
628
|
-
it('
|
|
627
|
+
describe('getSinceDateFromAPCs - plan history in ascending order', () => {
|
|
628
|
+
it('oldest / only apc', () => {
|
|
629
629
|
const history = new Array(...mockData_1.plan1_history).slice(0, 1);
|
|
630
630
|
const lastAPCId = 'v9BKkHo-tpL0wUZN';
|
|
631
631
|
const matchDate = new Date(0);
|
|
@@ -636,7 +636,7 @@ describe('getSinceDateFromAPCs', () => {
|
|
|
636
636
|
const sinceDate = ppa.getSinceDateFromAPCs(history, lastAPCId);
|
|
637
637
|
expect(sinceDate).toEqual(matchDate);
|
|
638
638
|
});
|
|
639
|
-
it('
|
|
639
|
+
it('oldest / multiple apcs in history -ascending order', () => {
|
|
640
640
|
const history = new Array(...mockData_1.plan1_history).slice(0, 3);
|
|
641
641
|
const lastAPCId = 'v9BKkHo-tpL0wUZN';
|
|
642
642
|
const matchDate = new Date(0);
|
|
@@ -647,7 +647,7 @@ describe('getSinceDateFromAPCs', () => {
|
|
|
647
647
|
const sinceDate = ppa.getSinceDateFromAPCs(history, lastAPCId);
|
|
648
648
|
expect(sinceDate).toEqual(matchDate);
|
|
649
649
|
});
|
|
650
|
-
it('
|
|
650
|
+
it('most recent apc -ascending order', () => {
|
|
651
651
|
const history = new Array(...mockData_1.plan1_history);
|
|
652
652
|
const lastAPCId = 'sJbGx1Fpq1v2MmcI';
|
|
653
653
|
const matchDate = new Date('2023-01-17T22:40:07.288Z');
|
|
@@ -658,7 +658,7 @@ describe('getSinceDateFromAPCs', () => {
|
|
|
658
658
|
const sinceDate = ppa.getSinceDateFromAPCs(history, lastAPCId);
|
|
659
659
|
expect(sinceDate).toEqual(matchDate);
|
|
660
660
|
});
|
|
661
|
-
it('apc in the middle', () => {
|
|
661
|
+
it('apc in the middle -ascending order', () => {
|
|
662
662
|
const history = new Array(...mockData_1.plan1_history);
|
|
663
663
|
const lastAPCId = 'GiT9CZXZGVljoYMR';
|
|
664
664
|
const matchDate = new Date('2023-01-16T21:50:42.742Z');
|
|
@@ -669,10 +669,10 @@ describe('getSinceDateFromAPCs', () => {
|
|
|
669
669
|
const sinceDate = ppa.getSinceDateFromAPCs(history, lastAPCId);
|
|
670
670
|
expect(sinceDate).toEqual(matchDate);
|
|
671
671
|
});
|
|
672
|
-
it('pastPublishCount greater than array size', () => {
|
|
672
|
+
it('pastPublishCount greater than array size -ascending order; so include all changes', () => {
|
|
673
673
|
const history = new Array(...mockData_1.plan1_history);
|
|
674
674
|
const lastAPCId = 'sJbGx1Fpq1v2MmcI';
|
|
675
|
-
const matchDate = new Date(
|
|
675
|
+
const matchDate = new Date(0);
|
|
676
676
|
const config = {};
|
|
677
677
|
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
678
678
|
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
@@ -680,7 +680,7 @@ describe('getSinceDateFromAPCs', () => {
|
|
|
680
680
|
const sinceDate = ppa.getSinceDateFromAPCs(history, lastAPCId, 20);
|
|
681
681
|
expect(sinceDate).toEqual(matchDate);
|
|
682
682
|
});
|
|
683
|
-
it('pastPublishCount at 3 ', () => {
|
|
683
|
+
it('pastPublishCount at 3 -ascending order', () => {
|
|
684
684
|
const history = new Array(...mockData_1.plan1_history);
|
|
685
685
|
const lastAPCId = 'sJbGx1Fpq1v2MmcI';
|
|
686
686
|
const matchDate = new Date('2023-01-17T22:35:20.517Z');
|
|
@@ -692,6 +692,74 @@ describe('getSinceDateFromAPCs', () => {
|
|
|
692
692
|
expect(sinceDate).toEqual(matchDate);
|
|
693
693
|
});
|
|
694
694
|
});
|
|
695
|
+
describe('getSinceDateFromAPCs - plan history in descending order', () => {
|
|
696
|
+
it('oldest / only apc', () => {
|
|
697
|
+
const history = new Array(...mockData_1.plan1_history_descending).slice(0, 1);
|
|
698
|
+
const lastAPCId = 'sJbGx1Fpq1v2MmcI';
|
|
699
|
+
const matchDate = new Date(0);
|
|
700
|
+
const config = {};
|
|
701
|
+
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
702
|
+
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
703
|
+
const ppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
704
|
+
const sinceDate = ppa.getSinceDateFromAPCs(history, lastAPCId);
|
|
705
|
+
expect(sinceDate).toEqual(matchDate);
|
|
706
|
+
});
|
|
707
|
+
it('oldest / multiple apcs in history -descending order', () => {
|
|
708
|
+
const history = new Array(...mockData_1.plan1_history_descending).slice(0, 3);
|
|
709
|
+
const lastAPCId = '4JM83QNiIO0IBkck';
|
|
710
|
+
const matchDate = new Date(0);
|
|
711
|
+
const config = {};
|
|
712
|
+
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
713
|
+
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
714
|
+
const ppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
715
|
+
const sinceDate = ppa.getSinceDateFromAPCs(history, lastAPCId);
|
|
716
|
+
expect(sinceDate).toEqual(matchDate);
|
|
717
|
+
});
|
|
718
|
+
it('most recent apc -descending order', () => {
|
|
719
|
+
const history = new Array(...mockData_1.plan1_history_descending);
|
|
720
|
+
const lastAPCId = 'sJbGx1Fpq1v2MmcI';
|
|
721
|
+
const matchDate = new Date('2023-01-17T22:40:07.288Z');
|
|
722
|
+
const config = {};
|
|
723
|
+
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
724
|
+
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
725
|
+
const ppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
726
|
+
const sinceDate = ppa.getSinceDateFromAPCs(history, lastAPCId);
|
|
727
|
+
expect(sinceDate).toEqual(matchDate);
|
|
728
|
+
});
|
|
729
|
+
it('apc in the middle -descending order', () => {
|
|
730
|
+
const history = new Array(...mockData_1.plan1_history_descending);
|
|
731
|
+
const lastAPCId = 'GiT9CZXZGVljoYMR';
|
|
732
|
+
const matchDate = new Date('2023-01-16T21:50:42.742Z');
|
|
733
|
+
const config = {};
|
|
734
|
+
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
735
|
+
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
736
|
+
const ppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
737
|
+
const sinceDate = ppa.getSinceDateFromAPCs(history, lastAPCId);
|
|
738
|
+
expect(sinceDate).toEqual(matchDate);
|
|
739
|
+
});
|
|
740
|
+
it('pastPublishCount greater than array size -descending order; so include all changes', () => {
|
|
741
|
+
const history = new Array(...mockData_1.plan1_history_descending);
|
|
742
|
+
const lastAPCId = 'sJbGx1Fpq1v2MmcI';
|
|
743
|
+
const matchDate = new Date(0);
|
|
744
|
+
const config = {};
|
|
745
|
+
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
746
|
+
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
747
|
+
const ppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
748
|
+
const sinceDate = ppa.getSinceDateFromAPCs(history, lastAPCId, 20);
|
|
749
|
+
expect(sinceDate).toEqual(matchDate);
|
|
750
|
+
});
|
|
751
|
+
it('pastPublishCount at 3 -descending order', () => {
|
|
752
|
+
const history = new Array(...mockData_1.plan1_history_descending);
|
|
753
|
+
const lastAPCId = 'sJbGx1Fpq1v2MmcI';
|
|
754
|
+
const matchDate = new Date('2023-01-17T22:35:20.517Z');
|
|
755
|
+
const config = {};
|
|
756
|
+
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
757
|
+
const dc = new data_converter_1.DataConverter(config, mapFileUtil);
|
|
758
|
+
const ppa = new base_process_publish_assortment_1.BaseProcessPublishAssortment(config, dc, mapFileUtil);
|
|
759
|
+
const sinceDate = ppa.getSinceDateFromAPCs(history, lastAPCId, 3);
|
|
760
|
+
expect(sinceDate).toEqual(matchDate);
|
|
761
|
+
});
|
|
762
|
+
});
|
|
695
763
|
describe('getDeleteChanges', () => {
|
|
696
764
|
const config = {};
|
|
697
765
|
const mapFileUtil = new transform_data_1.MapFileUtil(new sdk_1.Entities());
|
|
@@ -925,6 +993,7 @@ describe('buildDeleteChanges', () => {
|
|
|
925
993
|
];
|
|
926
994
|
const apc = {};
|
|
927
995
|
const fullAPC = {
|
|
996
|
+
id: 'apcId',
|
|
928
997
|
deleteDataDownloadLink: 'deleteDataDownloadLink',
|
|
929
998
|
returnedDeleteData
|
|
930
999
|
};
|
|
@@ -950,6 +1019,7 @@ describe('buildDeleteChanges', () => {
|
|
|
950
1019
|
];
|
|
951
1020
|
const apc = {};
|
|
952
1021
|
const fullAPC = {
|
|
1022
|
+
id: 'apcId',
|
|
953
1023
|
returnedDeleteData
|
|
954
1024
|
};
|
|
955
1025
|
const previousApc = undefined;
|
|
@@ -979,7 +1049,9 @@ describe('buildDeleteChanges', () => {
|
|
|
979
1049
|
deletes: [{ id: '1' }, { id: '3' }]
|
|
980
1050
|
}
|
|
981
1051
|
};
|
|
982
|
-
const previousApc = {
|
|
1052
|
+
const previousApc = {
|
|
1053
|
+
id: 'previousApcId',
|
|
1054
|
+
};
|
|
983
1055
|
const fullPreviousApc = {
|
|
984
1056
|
id: previousApcId,
|
|
985
1057
|
assortmentBaselineDownloadLink: 'assortmentBaselineDownloadLink'
|
|
@@ -66,6 +66,74 @@ export declare const plan1_history: ({
|
|
|
66
66
|
createdById: string;
|
|
67
67
|
adds: number;
|
|
68
68
|
})[];
|
|
69
|
+
export declare const plan1_history_descending: ({
|
|
70
|
+
summary: {
|
|
71
|
+
assortmentId: string;
|
|
72
|
+
count: number;
|
|
73
|
+
aggregates: {
|
|
74
|
+
flexCurrency: {
|
|
75
|
+
average: number;
|
|
76
|
+
total: number;
|
|
77
|
+
min: number;
|
|
78
|
+
max: number;
|
|
79
|
+
};
|
|
80
|
+
totalMargin: {};
|
|
81
|
+
};
|
|
82
|
+
updatedOn: string;
|
|
83
|
+
id: string;
|
|
84
|
+
updatedById: string;
|
|
85
|
+
createdOn: string;
|
|
86
|
+
createdById: string;
|
|
87
|
+
orgId: string;
|
|
88
|
+
};
|
|
89
|
+
deletes: number;
|
|
90
|
+
versionComments: string;
|
|
91
|
+
unchanged: number;
|
|
92
|
+
updatedOn: string;
|
|
93
|
+
versionName: string;
|
|
94
|
+
updates: number;
|
|
95
|
+
updatedById: string;
|
|
96
|
+
createdOn: string;
|
|
97
|
+
orgId: string;
|
|
98
|
+
familyItemsRemoved: number;
|
|
99
|
+
createdBy: string;
|
|
100
|
+
assortmentId: string;
|
|
101
|
+
id: string;
|
|
102
|
+
errors: number;
|
|
103
|
+
createdById: string;
|
|
104
|
+
adds: number;
|
|
105
|
+
} | {
|
|
106
|
+
summary: {
|
|
107
|
+
assortmentId: string;
|
|
108
|
+
count: number;
|
|
109
|
+
aggregates: {
|
|
110
|
+
totalMargin: {};
|
|
111
|
+
flexCurrency?: undefined;
|
|
112
|
+
};
|
|
113
|
+
updatedOn: string;
|
|
114
|
+
id: string;
|
|
115
|
+
updatedById: string;
|
|
116
|
+
createdOn: string;
|
|
117
|
+
createdById: string;
|
|
118
|
+
orgId: string;
|
|
119
|
+
};
|
|
120
|
+
deletes: number;
|
|
121
|
+
versionComments: string;
|
|
122
|
+
unchanged: number;
|
|
123
|
+
updatedOn: string;
|
|
124
|
+
versionName: string;
|
|
125
|
+
updates: number;
|
|
126
|
+
updatedById: string;
|
|
127
|
+
createdOn: string;
|
|
128
|
+
orgId: string;
|
|
129
|
+
familyItemsRemoved: number;
|
|
130
|
+
createdBy: string;
|
|
131
|
+
assortmentId: string;
|
|
132
|
+
id: string;
|
|
133
|
+
errors: number;
|
|
134
|
+
createdById: string;
|
|
135
|
+
adds: number;
|
|
136
|
+
})[];
|
|
69
137
|
export declare const plan1_across_month_DST: {
|
|
70
138
|
versionName: string;
|
|
71
139
|
createdOn: string;
|
package/lib/publish/mockData.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.apc_2bOWR2j9R0QThDVu_delete_history = exports.fall_2003_fedMapping = exports.fall_2003_deleteChanges_run2 = exports.fall_2003_fullChange_run2 = exports.fall_2003_hydratedDetails_run2 = exports.fall_2003_fullChange = exports.fall_2003_hydratedDetails = exports.plan1_across_month_DST = exports.plan1_history = void 0;
|
|
3
|
+
exports.apc_2bOWR2j9R0QThDVu_delete_history = exports.fall_2003_fedMapping = exports.fall_2003_deleteChanges_run2 = exports.fall_2003_fullChange_run2 = exports.fall_2003_hydratedDetails_run2 = exports.fall_2003_fullChange = exports.fall_2003_hydratedDetails = exports.plan1_across_month_DST = exports.plan1_history_descending = exports.plan1_history = void 0;
|
|
4
4
|
exports.plan1_history = [
|
|
5
5
|
{
|
|
6
6
|
summary: {
|
|
@@ -257,6 +257,262 @@ exports.plan1_history = [
|
|
|
257
257
|
adds: 4
|
|
258
258
|
}
|
|
259
259
|
];
|
|
260
|
+
exports.plan1_history_descending = [
|
|
261
|
+
{
|
|
262
|
+
summary: {
|
|
263
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
264
|
+
count: 13,
|
|
265
|
+
aggregates: {
|
|
266
|
+
flexCurrency: {
|
|
267
|
+
average: 444,
|
|
268
|
+
total: 444,
|
|
269
|
+
min: 444,
|
|
270
|
+
max: 444
|
|
271
|
+
},
|
|
272
|
+
totalMargin: {}
|
|
273
|
+
},
|
|
274
|
+
updatedOn: '2023-01-18T16:56:46.078Z',
|
|
275
|
+
id: 'oqIFX3ELRy8sFRd0',
|
|
276
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
277
|
+
createdOn: '2023-01-18T16:56:46.078Z',
|
|
278
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
279
|
+
orgId: 'cMkHW5GAD8ViOZj-'
|
|
280
|
+
},
|
|
281
|
+
deletes: 0,
|
|
282
|
+
versionComments: 'This sets up Jan 18 items for drop issue. That dropping the item family & only option produces only a delete entry for the option. Dropping an option of a family that has multiple options, also only produces a delete entry for the option.\n\nAnd dropping the only item option, from a family produces a delete entry for the option and an add for the item family',
|
|
283
|
+
unchanged: 9,
|
|
284
|
+
updatedOn: '2023-01-18T16:56:45.800Z',
|
|
285
|
+
versionName: 'Setup for demo of drop issue',
|
|
286
|
+
updates: 0,
|
|
287
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
288
|
+
createdOn: '2023-01-18T16:56:45.800Z',
|
|
289
|
+
orgId: 'cMkHW5GAD8ViOZj-',
|
|
290
|
+
familyItemsRemoved: 0,
|
|
291
|
+
createdBy: 'Eey3ZOi8znUA85i7',
|
|
292
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
293
|
+
id: 'sJbGx1Fpq1v2MmcI',
|
|
294
|
+
errors: 0,
|
|
295
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
296
|
+
adds: 4
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
summary: {
|
|
300
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
301
|
+
count: 9,
|
|
302
|
+
aggregates: {
|
|
303
|
+
totalMargin: {}
|
|
304
|
+
},
|
|
305
|
+
updatedOn: '2023-01-17T22:40:07.539Z',
|
|
306
|
+
id: 'oqIFX3ELRy8sFRd0',
|
|
307
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
308
|
+
createdOn: '2023-01-17T22:40:07.539Z',
|
|
309
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
310
|
+
orgId: 'cMkHW5GAD8ViOZj-'
|
|
311
|
+
},
|
|
312
|
+
deletes: 1,
|
|
313
|
+
versionComments: '',
|
|
314
|
+
unchanged: 8,
|
|
315
|
+
updatedOn: '2023-01-17T22:40:07.288Z',
|
|
316
|
+
versionName: 'remove only option on family but leave family in plan',
|
|
317
|
+
updates: 0,
|
|
318
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
319
|
+
createdOn: '2023-01-17T22:40:07.288Z',
|
|
320
|
+
orgId: 'cMkHW5GAD8ViOZj-',
|
|
321
|
+
familyItemsRemoved: 0,
|
|
322
|
+
createdBy: 'Eey3ZOi8znUA85i7',
|
|
323
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
324
|
+
id: 'V0iQE449Ckw1UB7a',
|
|
325
|
+
errors: 0,
|
|
326
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
327
|
+
adds: 1
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
summary: {
|
|
331
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
332
|
+
count: 9,
|
|
333
|
+
aggregates: {
|
|
334
|
+
totalMargin: {}
|
|
335
|
+
},
|
|
336
|
+
updatedOn: '2023-01-17T22:36:39.434Z',
|
|
337
|
+
id: 'oqIFX3ELRy8sFRd0',
|
|
338
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
339
|
+
createdOn: '2023-01-17T22:36:39.434Z',
|
|
340
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
341
|
+
orgId: 'cMkHW5GAD8ViOZj-'
|
|
342
|
+
},
|
|
343
|
+
deletes: 1,
|
|
344
|
+
versionComments: '',
|
|
345
|
+
unchanged: 9,
|
|
346
|
+
updatedOn: '2023-01-17T22:36:39.185Z',
|
|
347
|
+
versionName: 'drop 1 option (of 2)',
|
|
348
|
+
updates: 0,
|
|
349
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
350
|
+
createdOn: '2023-01-17T22:36:39.185Z',
|
|
351
|
+
orgId: 'cMkHW5GAD8ViOZj-',
|
|
352
|
+
familyItemsRemoved: 0,
|
|
353
|
+
createdBy: 'Eey3ZOi8znUA85i7',
|
|
354
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
355
|
+
id: '4JM83QNiIO0IBkck',
|
|
356
|
+
errors: 0,
|
|
357
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
358
|
+
adds: 0
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
summary: {
|
|
362
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
363
|
+
count: 10,
|
|
364
|
+
aggregates: {
|
|
365
|
+
totalMargin: {}
|
|
366
|
+
},
|
|
367
|
+
updatedOn: '2023-01-17T22:35:20.750Z',
|
|
368
|
+
id: 'oqIFX3ELRy8sFRd0',
|
|
369
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
370
|
+
createdOn: '2023-01-17T22:35:20.750Z',
|
|
371
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
372
|
+
orgId: 'cMkHW5GAD8ViOZj-'
|
|
373
|
+
},
|
|
374
|
+
deletes: 2,
|
|
375
|
+
versionComments: '',
|
|
376
|
+
unchanged: 6,
|
|
377
|
+
updatedOn: '2023-01-17T22:35:20.517Z',
|
|
378
|
+
versionName: 'adds & 2 drops',
|
|
379
|
+
updates: 0,
|
|
380
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
381
|
+
createdOn: '2023-01-17T22:35:20.517Z',
|
|
382
|
+
orgId: 'cMkHW5GAD8ViOZj-',
|
|
383
|
+
familyItemsRemoved: 0,
|
|
384
|
+
createdBy: 'Eey3ZOi8znUA85i7',
|
|
385
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
386
|
+
id: 'GiT9CZXZGVljoYMR',
|
|
387
|
+
errors: 0,
|
|
388
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
389
|
+
adds: 4
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
summary: {
|
|
393
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
394
|
+
count: 8,
|
|
395
|
+
aggregates: {
|
|
396
|
+
totalMargin: {}
|
|
397
|
+
},
|
|
398
|
+
updatedOn: '2023-01-16T21:50:43.045Z',
|
|
399
|
+
id: 'oqIFX3ELRy8sFRd0',
|
|
400
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
401
|
+
createdOn: '2023-01-16T21:50:43.045Z',
|
|
402
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
403
|
+
orgId: 'cMkHW5GAD8ViOZj-'
|
|
404
|
+
},
|
|
405
|
+
deletes: 0,
|
|
406
|
+
versionComments: '',
|
|
407
|
+
unchanged: 6,
|
|
408
|
+
updatedOn: '2023-01-16T21:50:42.742Z',
|
|
409
|
+
versionName: 'Add 2 Familys/Options',
|
|
410
|
+
updates: 0,
|
|
411
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
412
|
+
createdOn: '2023-01-16T21:50:42.742Z',
|
|
413
|
+
orgId: 'cMkHW5GAD8ViOZj-',
|
|
414
|
+
familyItemsRemoved: 0,
|
|
415
|
+
createdBy: 'Eey3ZOi8znUA85i7',
|
|
416
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
417
|
+
id: '_mj--7nlyp7mmDrK',
|
|
418
|
+
errors: 0,
|
|
419
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
420
|
+
adds: 2
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
summary: {
|
|
424
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
425
|
+
count: 6,
|
|
426
|
+
aggregates: {
|
|
427
|
+
totalMargin: {}
|
|
428
|
+
},
|
|
429
|
+
updatedOn: '2023-01-16T19:25:53.351Z',
|
|
430
|
+
id: 'oqIFX3ELRy8sFRd0',
|
|
431
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
432
|
+
createdOn: '2023-01-16T19:25:53.351Z',
|
|
433
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
434
|
+
orgId: 'cMkHW5GAD8ViOZj-'
|
|
435
|
+
},
|
|
436
|
+
deletes: 0,
|
|
437
|
+
versionComments: '',
|
|
438
|
+
unchanged: 4,
|
|
439
|
+
updatedOn: '2023-01-16T19:25:53.036Z',
|
|
440
|
+
versionName: 'add 1 family/option',
|
|
441
|
+
updates: 0,
|
|
442
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
443
|
+
createdOn: '2023-01-16T19:25:53.036Z',
|
|
444
|
+
orgId: 'cMkHW5GAD8ViOZj-',
|
|
445
|
+
familyItemsRemoved: 0,
|
|
446
|
+
createdBy: 'Eey3ZOi8znUA85i7',
|
|
447
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
448
|
+
id: '1MEzdQKVTjVtES8u',
|
|
449
|
+
errors: 0,
|
|
450
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
451
|
+
adds: 2
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
summary: {
|
|
455
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
456
|
+
count: 4,
|
|
457
|
+
aggregates: {
|
|
458
|
+
totalMargin: {}
|
|
459
|
+
},
|
|
460
|
+
updatedOn: '2023-01-16T19:16:06.502Z',
|
|
461
|
+
id: 'oqIFX3ELRy8sFRd0',
|
|
462
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
463
|
+
createdOn: '2023-01-16T19:16:06.502Z',
|
|
464
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
465
|
+
orgId: 'cMkHW5GAD8ViOZj-'
|
|
466
|
+
},
|
|
467
|
+
deletes: 0,
|
|
468
|
+
versionComments: '',
|
|
469
|
+
unchanged: 2,
|
|
470
|
+
updatedOn: '2023-01-16T19:16:06.233Z',
|
|
471
|
+
versionName: 'add 1 family/option & 1 family',
|
|
472
|
+
updates: 0,
|
|
473
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
474
|
+
createdOn: '2023-01-16T19:16:06.233Z',
|
|
475
|
+
orgId: 'cMkHW5GAD8ViOZj-',
|
|
476
|
+
familyItemsRemoved: 0,
|
|
477
|
+
createdBy: 'Eey3ZOi8znUA85i7',
|
|
478
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
479
|
+
id: 'LS2rVixKh2ojv56w',
|
|
480
|
+
errors: 0,
|
|
481
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
482
|
+
adds: 2
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
summary: {
|
|
486
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
487
|
+
count: 2,
|
|
488
|
+
aggregates: {
|
|
489
|
+
totalMargin: {}
|
|
490
|
+
},
|
|
491
|
+
updatedOn: '2023-01-16T19:13:59.080Z',
|
|
492
|
+
id: 'oqIFX3ELRy8sFRd0',
|
|
493
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
494
|
+
createdOn: '2023-01-16T19:13:59.080Z',
|
|
495
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
496
|
+
orgId: 'cMkHW5GAD8ViOZj-'
|
|
497
|
+
},
|
|
498
|
+
deletes: 0,
|
|
499
|
+
versionComments: '',
|
|
500
|
+
unchanged: 0,
|
|
501
|
+
updatedOn: '2023-01-15T19:13:58.902Z',
|
|
502
|
+
versionName: 'Add family/option & just family',
|
|
503
|
+
updates: 0,
|
|
504
|
+
updatedById: 'Eey3ZOi8znUA85i7',
|
|
505
|
+
createdOn: '2023-01-15T19:13:58.902Z',
|
|
506
|
+
orgId: 'cMkHW5GAD8ViOZj-',
|
|
507
|
+
familyItemsRemoved: 0,
|
|
508
|
+
createdBy: 'Eey3ZOi8znUA85i7',
|
|
509
|
+
assortmentId: 'oqIFX3ELRy8sFRd0',
|
|
510
|
+
id: 'v9BKkHo-tpL0wUZN',
|
|
511
|
+
errors: 0,
|
|
512
|
+
createdById: 'Eey3ZOi8znUA85i7',
|
|
513
|
+
adds: 2
|
|
514
|
+
}
|
|
515
|
+
];
|
|
260
516
|
exports.plan1_across_month_DST = [
|
|
261
517
|
{
|
|
262
518
|
versionName: 'Add family/option & just family',
|
|
@@ -30,6 +30,7 @@ export declare class DataConverter {
|
|
|
30
30
|
setObjectReferenceValue(prop: any, nd: any): Promise<any>;
|
|
31
31
|
getAllObjectReferences(entityType: string, rootTypeCriteria: any, postProcessCriteria?: any): Promise<any[]>;
|
|
32
32
|
checkKeysAndValues(criteria: any, arrayOfObjects: any, entityTypePath: any): any[];
|
|
33
|
+
filterOutArchivedAndTrashedEntities(entities: any[]): any[];
|
|
33
34
|
setUserListValue(prop: any, nd: any): Promise<any>;
|
|
34
35
|
getUserByEmail(nd: any): Promise<any>;
|
|
35
36
|
processGroupMemberCheck(prop: any, userEmail: any): Promise<void>;
|
|
@@ -415,7 +415,7 @@ class DataConverter {
|
|
|
415
415
|
nextPageKey = loadPage?.nextPageKey;
|
|
416
416
|
if (Object.keys(loadPage).includes('results')) {
|
|
417
417
|
usedV2 = true;
|
|
418
|
-
let postProcessedResults = loadPage
|
|
418
|
+
let postProcessedResults = this.filterOutArchivedAndTrashedEntities(loadPage?.results);
|
|
419
419
|
if (postProcessedResults?.length > 0 && postProcessCriteria && Object.keys(postProcessCriteria).length !== 0) {
|
|
420
420
|
const subEntityTypePath = rootTypeCriteria.typePath || entityType;
|
|
421
421
|
postProcessedResults = this.checkKeysAndValues(postProcessCriteria, postProcessedResults, subEntityTypePath);
|
|
@@ -437,7 +437,7 @@ class DataConverter {
|
|
|
437
437
|
take,
|
|
438
438
|
skip,
|
|
439
439
|
});
|
|
440
|
-
let postProcessedResults = loadPage;
|
|
440
|
+
let postProcessedResults = this.filterOutArchivedAndTrashedEntities(loadPage);
|
|
441
441
|
if (postProcessCriteria && Object.keys(postProcessCriteria).length !== 0) {
|
|
442
442
|
const subEntityTypePath = rootTypeCriteria.typePath || entityType;
|
|
443
443
|
postProcessedResults = this.checkKeysAndValues(postProcessCriteria, postProcessedResults, subEntityTypePath);
|
|
@@ -476,6 +476,16 @@ class DataConverter {
|
|
|
476
476
|
}
|
|
477
477
|
return arrOfMatchObjects;
|
|
478
478
|
}
|
|
479
|
+
filterOutArchivedAndTrashedEntities(entities) {
|
|
480
|
+
if (!entities || !Array.isArray(entities) || entities.length === 0) {
|
|
481
|
+
return [];
|
|
482
|
+
}
|
|
483
|
+
return entities.filter(entity => {
|
|
484
|
+
const isArchived = entity?.isArchived;
|
|
485
|
+
const isTrashed = entity?.isTrashed;
|
|
486
|
+
return !isArchived && !isTrashed;
|
|
487
|
+
});
|
|
488
|
+
}
|
|
479
489
|
async setUserListValue(prop, nd) {
|
|
480
490
|
if (!nd?.email) {
|
|
481
491
|
return "";
|