@contrail/flexplm 1.3.0-alpha.0 → 1.3.0-alpha.3

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.
Files changed (123) hide show
  1. package/.github/pull_request_template.md +31 -31
  2. package/.github/workflows/flexplm-lib.yml +27 -27
  3. package/CHANGELOG.md +1 -1
  4. package/lib/entity-processor/base-entity-processor.d.ts +42 -0
  5. package/lib/entity-processor/base-entity-processor.js +377 -0
  6. package/lib/entity-processor/base-entity-processor.spec.d.ts +1 -0
  7. package/lib/entity-processor/base-entity-processor.spec.js +426 -0
  8. package/lib/flexplm-request.d.ts +3 -0
  9. package/lib/flexplm-request.js +34 -0
  10. package/lib/flexplm-utils.d.ts +5 -0
  11. package/lib/flexplm-utils.js +33 -0
  12. package/lib/flexplm-utils.spec.d.ts +1 -0
  13. package/lib/flexplm-utils.spec.js +26 -0
  14. package/lib/index.d.ts +22 -0
  15. package/lib/index.js +38 -0
  16. package/lib/interfaces/interfaces.d.ts +105 -0
  17. package/lib/interfaces/interfaces.js +2 -0
  18. package/lib/interfaces/item-family-changes.d.ts +20 -0
  19. package/lib/interfaces/item-family-changes.js +56 -0
  20. package/lib/interfaces/publish-change-data.d.ts +19 -0
  21. package/lib/interfaces/publish-change-data.js +32 -0
  22. package/lib/publish/base-process-publish-assortment-callback.d.ts +9 -0
  23. package/lib/publish/base-process-publish-assortment-callback.js +38 -0
  24. package/lib/publish/base-process-publish-assortment.d.ts +93 -0
  25. package/lib/publish/base-process-publish-assortment.js +944 -0
  26. package/lib/publish/base-process-publish-assortment.spec.d.ts +1 -0
  27. package/lib/publish/base-process-publish-assortment.spec.js +1670 -0
  28. package/lib/publish/mockData.d.ts +1389 -0
  29. package/lib/publish/mockData.js +4519 -0
  30. package/lib/transform/identifier-conversion-spec-mockData.d.ts +0 -0
  31. package/lib/transform/identifier-conversion-spec-mockData.js +444 -0
  32. package/lib/transform/identifier-conversion.d.ts +15 -0
  33. package/lib/transform/identifier-conversion.js +212 -0
  34. package/lib/transform/identifier-conversion.spec.d.ts +1 -0
  35. package/lib/transform/identifier-conversion.spec.js +339 -0
  36. package/lib/util/config-defaults.d.ts +8 -0
  37. package/lib/util/config-defaults.js +85 -0
  38. package/lib/util/config-defaults.spec.d.ts +1 -0
  39. package/lib/util/config-defaults.spec.js +293 -0
  40. package/lib/util/data-converter-spec-mockData.d.ts +0 -0
  41. package/lib/util/data-converter-spec-mockData.js +205 -0
  42. package/lib/util/data-converter.d.ts +39 -0
  43. package/lib/util/data-converter.js +592 -0
  44. package/lib/util/data-converter.spec.d.ts +1 -0
  45. package/lib/util/data-converter.spec.js +904 -0
  46. package/lib/util/error-response-object.d.ts +4 -0
  47. package/lib/util/error-response-object.js +47 -0
  48. package/lib/util/error-response-object.spec.d.ts +1 -0
  49. package/lib/util/error-response-object.spec.js +99 -0
  50. package/lib/util/event-short-message-status.d.ts +18 -0
  51. package/lib/util/event-short-message-status.js +22 -0
  52. package/lib/util/federation.d.ts +15 -0
  53. package/lib/util/federation.js +149 -0
  54. package/lib/util/flexplm-connect.d.ts +22 -0
  55. package/lib/util/flexplm-connect.js +176 -0
  56. package/lib/util/flexplm-connect.spec.d.ts +1 -0
  57. package/lib/util/flexplm-connect.spec.js +88 -0
  58. package/lib/util/logger-config.d.ts +1 -0
  59. package/lib/util/logger-config.js +26 -0
  60. package/lib/util/map-util-spec-mockData.d.ts +0 -0
  61. package/lib/util/map-util-spec-mockData.js +205 -0
  62. package/lib/util/map-utils.d.ts +6 -0
  63. package/lib/util/map-utils.js +15 -0
  64. package/lib/util/map-utils.spec.d.ts +1 -0
  65. package/lib/util/map-utils.spec.js +89 -0
  66. package/lib/util/mockData.d.ts +79 -0
  67. package/lib/util/mockData.js +99 -0
  68. package/lib/util/thumbnail-util.d.ts +28 -0
  69. package/lib/util/thumbnail-util.js +202 -0
  70. package/lib/util/thumbnail-util.spec.d.ts +1 -0
  71. package/lib/util/thumbnail-util.spec.js +398 -0
  72. package/lib/util/type-conversion-utils-spec-mockData.d.ts +0 -0
  73. package/lib/util/type-conversion-utils-spec-mockData.js +259 -0
  74. package/lib/util/type-conversion-utils.d.ts +23 -0
  75. package/lib/util/type-conversion-utils.js +266 -0
  76. package/lib/util/type-conversion-utils.spec.d.ts +1 -0
  77. package/lib/util/type-conversion-utils.spec.js +868 -0
  78. package/lib/util/type-defaults.d.ts +16 -0
  79. package/lib/util/type-defaults.js +221 -0
  80. package/lib/util/type-defaults.spec.d.ts +1 -0
  81. package/lib/util/type-defaults.spec.js +516 -0
  82. package/lib/util/type-utils.d.ts +13 -0
  83. package/lib/util/type-utils.js +114 -0
  84. package/lib/util/type-utils.spec.d.ts +1 -0
  85. package/lib/util/type-utils.spec.js +190 -0
  86. package/package.json +1 -1
  87. package/publish.bat +4 -4
  88. package/publish.sh +4 -4
  89. package/src/entity-processor/base-entity-processor.spec.ts +157 -0
  90. package/src/entity-processor/base-entity-processor.ts +21 -2
  91. package/src/flexplm-request.ts +28 -28
  92. package/src/flexplm-utils.spec.ts +27 -27
  93. package/src/flexplm-utils.ts +29 -29
  94. package/src/index.ts +21 -21
  95. package/src/interfaces/item-family-changes.ts +66 -66
  96. package/src/interfaces/publish-change-data.ts +42 -42
  97. package/src/publish/base-process-publish-assortment-callback.ts +50 -50
  98. package/src/transform/identifier-conversion-spec-mockData.ts +495 -495
  99. package/src/transform/identifier-conversion.spec.ts +353 -353
  100. package/src/transform/identifier-conversion.ts +281 -281
  101. package/src/util/config-defaults.spec.ts +350 -350
  102. package/src/util/config-defaults.ts +92 -92
  103. package/src/util/data-converter-spec-mockData.ts +230 -230
  104. package/src/util/error-response-object.spec.ts +115 -115
  105. package/src/util/error-response-object.ts +49 -49
  106. package/src/util/federation.ts +172 -172
  107. package/src/util/logger-config.ts +19 -19
  108. package/src/util/map-util-spec-mockData.ts +230 -230
  109. package/src/util/map-utils.spec.ts +102 -102
  110. package/src/util/map-utils.ts +40 -40
  111. package/src/util/mockData.ts +97 -97
  112. package/src/util/thumbnail-util.spec.ts +190 -0
  113. package/src/util/thumbnail-util.ts +109 -1
  114. package/src/util/type-conversion-utils.spec.ts +25 -25
  115. package/src/util/type-conversion-utils.ts +10 -9
  116. package/src/util/type-defaults.spec.ts +668 -668
  117. package/src/util/type-defaults.ts +280 -280
  118. package/src/util/type-utils.spec.ts +227 -227
  119. package/src/util/type-utils.ts +144 -144
  120. package/tsconfig.json +28 -26
  121. package/tslint.json +57 -57
  122. package/scripts/output.png +0 -0
  123. package/scripts/test-get-request.ts +0 -35
@@ -1,67 +1,67 @@
1
- export class ItemFamilyChanges {
2
- private _itemFamilyId:string;
3
- public get itemFamilyId(){ return this._itemFamilyId; }
4
- private _sinceDate:Date;
5
- public get sinceDate(){ return this._sinceDate; }
6
-
7
- familyAdd = false;
8
- familyDelete = false;
9
- familyUpdate = false;
10
- familyItemRemoved = false;
11
- itemFamilyObject = undefined;
12
-
13
- colorAdds: string[] = [];
14
- colorDeletes: string[] = [];
15
- colorUpdates: string[] = [];
16
- colorUnchanged: string[] = [];
17
-
18
- assortmentItemFullChangeMap = new Map<string, any>();
19
- assortmentItemDeleteMap = new Map<string, any>();
20
- itemToFederatedIdMapping = new Map<string, string>();
21
- constructor(itemFamilyId: string, sinceDate: Date){
22
- this._itemFamilyId = itemFamilyId;
23
- this._sinceDate = sinceDate;
24
- }
25
-
26
- public toString(): string{
27
- let s = 'ItemFamilyChanges\n'
28
- + ' itemFamilyId: ' + this._itemFamilyId + '\n'
29
- + ' sinceDate: ' + this._sinceDate + '\n'
30
- + ' familyAdd: ' + this.familyAdd + '\n'
31
- + ' familyDelete: ' + this.familyDelete + '\n'
32
- + ' familyUpdate: ' + this.familyUpdate + '\n'
33
- + ' familyItemRemoved: ' + this.familyItemRemoved + '\n'
34
- ;
35
-
36
- s += ' colorAdds: ['+ this.colorAdds + ']\n';
37
-
38
- s += ' colorDeletes: ['+ this.colorDeletes + ']\n';
39
-
40
- s += ' colorUpdates: ['+ this.colorUpdates + ']\n';
41
-
42
- s += ' colorUnchanged: ['+ this.colorUnchanged + ']\n';
43
-
44
- s += 'assortmentItemFullChangeMap:\n';
45
- s += 'size: ' + this.assortmentItemFullChangeMap.size +'\n[';
46
- for(const key of this.assortmentItemFullChangeMap.keys()){
47
- s += key + ', ';
48
- }
49
- s += ']\n';
50
-
51
- s += 'assortmentItemDeleteMap:\n';
52
- s += 'size: ' + this.assortmentItemDeleteMap.size +'\n[';
53
- for(const key of this.assortmentItemDeleteMap.keys()){
54
- s += key + ', ';
55
- }
56
- s += ']\n';
57
-
58
- s += 'itemToFederatedIdMapping:\n';
59
- s += 'size: ' + this.itemToFederatedIdMapping.size +'\n[';
60
- for(const key of this.itemToFederatedIdMapping.keys()){
61
- s += key + ', ';
62
- }
63
- s += ']\n';
64
-
65
- return s;
66
- }
1
+ export class ItemFamilyChanges {
2
+ private _itemFamilyId:string;
3
+ public get itemFamilyId(){ return this._itemFamilyId; }
4
+ private _sinceDate:Date;
5
+ public get sinceDate(){ return this._sinceDate; }
6
+
7
+ familyAdd = false;
8
+ familyDelete = false;
9
+ familyUpdate = false;
10
+ familyItemRemoved = false;
11
+ itemFamilyObject = undefined;
12
+
13
+ colorAdds: string[] = [];
14
+ colorDeletes: string[] = [];
15
+ colorUpdates: string[] = [];
16
+ colorUnchanged: string[] = [];
17
+
18
+ assortmentItemFullChangeMap = new Map<string, any>();
19
+ assortmentItemDeleteMap = new Map<string, any>();
20
+ itemToFederatedIdMapping = new Map<string, string>();
21
+ constructor(itemFamilyId: string, sinceDate: Date){
22
+ this._itemFamilyId = itemFamilyId;
23
+ this._sinceDate = sinceDate;
24
+ }
25
+
26
+ public toString(): string{
27
+ let s = 'ItemFamilyChanges\n'
28
+ + ' itemFamilyId: ' + this._itemFamilyId + '\n'
29
+ + ' sinceDate: ' + this._sinceDate + '\n'
30
+ + ' familyAdd: ' + this.familyAdd + '\n'
31
+ + ' familyDelete: ' + this.familyDelete + '\n'
32
+ + ' familyUpdate: ' + this.familyUpdate + '\n'
33
+ + ' familyItemRemoved: ' + this.familyItemRemoved + '\n'
34
+ ;
35
+
36
+ s += ' colorAdds: ['+ this.colorAdds + ']\n';
37
+
38
+ s += ' colorDeletes: ['+ this.colorDeletes + ']\n';
39
+
40
+ s += ' colorUpdates: ['+ this.colorUpdates + ']\n';
41
+
42
+ s += ' colorUnchanged: ['+ this.colorUnchanged + ']\n';
43
+
44
+ s += 'assortmentItemFullChangeMap:\n';
45
+ s += 'size: ' + this.assortmentItemFullChangeMap.size +'\n[';
46
+ for(const key of this.assortmentItemFullChangeMap.keys()){
47
+ s += key + ', ';
48
+ }
49
+ s += ']\n';
50
+
51
+ s += 'assortmentItemDeleteMap:\n';
52
+ s += 'size: ' + this.assortmentItemDeleteMap.size +'\n[';
53
+ for(const key of this.assortmentItemDeleteMap.keys()){
54
+ s += key + ', ';
55
+ }
56
+ s += ']\n';
57
+
58
+ s += 'itemToFederatedIdMapping:\n';
59
+ s += 'size: ' + this.itemToFederatedIdMapping.size +'\n[';
60
+ for(const key of this.itemToFederatedIdMapping.keys()){
61
+ s += key + ', ';
62
+ }
63
+ s += ']\n';
64
+
65
+ return s;
66
+ }
67
67
  }
@@ -1,43 +1,43 @@
1
- import { SeasonFederation } from './interfaces';
2
- import { ItemFamilyChanges } from './item-family-changes';
3
-
4
- export class PublishChangeData {
5
-
6
- private _assortmentId: string;
7
- public get assortmentId(){ return this._assortmentId; }
8
- private _seasonFed: SeasonFederation;
9
- public get seasonFed() { return Object.assign({}, this._seasonFed); }
10
- private _assortmentPublishChangeId: string;
11
- public get assortmentPublishChangeId() { return this._assortmentPublishChangeId; }
12
- private _sinceDate: Date;
13
- public get sinceDate(){ return this._sinceDate; }
14
- private _publisher: object;
15
- public get publisher(){ return this._publisher; }
16
-
17
- itemToFederatedIdMapping: Map<string, string>;
18
- releasedForDevelopmentItemIds: string[] = [];
19
- itemFamilyChanges = new Map<string, ItemFamilyChanges>();
20
- constructor(_assortmentId: string, _seasonFed: SeasonFederation, _assortmentPublishChangeId: string, _sinceDate: Date, _publisher = {}) {
21
- this._assortmentId = _assortmentId;
22
- this._seasonFed = _seasonFed;
23
- this._assortmentPublishChangeId = _assortmentPublishChangeId;
24
- this._sinceDate = _sinceDate;
25
- this._publisher = _publisher;
26
- }
27
-
28
- toString(){
29
- let s = 'PublishChangeData\n'
30
- + 'assortmentId: ' + this._assortmentId + '\n'
31
- + 'seasonFed: ' + JSON.stringify(this._seasonFed) + '\n'
32
- + 'assortmentPublishChangeId: ' + this._assortmentPublishChangeId + '\n'
33
- ;
34
-
35
- s += ' itemToFederatedIdMapping: ' + JSON.stringify(Object.fromEntries(this.itemToFederatedIdMapping)) + '\n';
36
- s += 'itemFamilyChanges:\n';
37
- for(const [key, value] of this.itemFamilyChanges){
38
- s += ' ' + key + ' => ' + value.toString();
39
- }
40
- return s;
41
- }
42
-
1
+ import { SeasonFederation } from './interfaces';
2
+ import { ItemFamilyChanges } from './item-family-changes';
3
+
4
+ export class PublishChangeData {
5
+
6
+ private _assortmentId: string;
7
+ public get assortmentId(){ return this._assortmentId; }
8
+ private _seasonFed: SeasonFederation;
9
+ public get seasonFed() { return Object.assign({}, this._seasonFed); }
10
+ private _assortmentPublishChangeId: string;
11
+ public get assortmentPublishChangeId() { return this._assortmentPublishChangeId; }
12
+ private _sinceDate: Date;
13
+ public get sinceDate(){ return this._sinceDate; }
14
+ private _publisher: object;
15
+ public get publisher(){ return this._publisher; }
16
+
17
+ itemToFederatedIdMapping: Map<string, string>;
18
+ releasedForDevelopmentItemIds: string[] = [];
19
+ itemFamilyChanges = new Map<string, ItemFamilyChanges>();
20
+ constructor(_assortmentId: string, _seasonFed: SeasonFederation, _assortmentPublishChangeId: string, _sinceDate: Date, _publisher = {}) {
21
+ this._assortmentId = _assortmentId;
22
+ this._seasonFed = _seasonFed;
23
+ this._assortmentPublishChangeId = _assortmentPublishChangeId;
24
+ this._sinceDate = _sinceDate;
25
+ this._publisher = _publisher;
26
+ }
27
+
28
+ toString(){
29
+ let s = 'PublishChangeData\n'
30
+ + 'assortmentId: ' + this._assortmentId + '\n'
31
+ + 'seasonFed: ' + JSON.stringify(this._seasonFed) + '\n'
32
+ + 'assortmentPublishChangeId: ' + this._assortmentPublishChangeId + '\n'
33
+ ;
34
+
35
+ s += ' itemToFederatedIdMapping: ' + JSON.stringify(Object.fromEntries(this.itemToFederatedIdMapping)) + '\n';
36
+ s += 'itemFamilyChanges:\n';
37
+ for(const [key, value] of this.itemFamilyChanges){
38
+ s += ' ' + key + ' => ' + value.toString();
39
+ }
40
+ return s;
41
+ }
42
+
43
43
  }
@@ -1,50 +1,50 @@
1
- import { LogLevel, Notification } from "@contrail/sdk";
2
- import { FCConfig } from "../interfaces/interfaces";
3
-
4
- export class BaseProcessPublishAssortmentCallback {
5
- private config: FCConfig;
6
-
7
- constructor(_config: FCConfig) {
8
- this.config = _config;
9
- }
10
-
11
- public async process(event) {
12
- console.log("ProcessPublishAssortmentCallback-process()");
13
-
14
- console.log(
15
- "ProcessPublishAssortmentCallback-event: " + JSON.stringify(event)
16
- );
17
- console.log(
18
- "ProcessPublishAssortmentCallback-config: " + JSON.stringify(this.config)
19
- );
20
-
21
- const statusCounts = this.config["statusCounts"];
22
- console.log("statusCounts: " + JSON.stringify(statusCounts));
23
-
24
- const statMessage =(statusCounts && 'undefined' !== statusCounts)
25
- ?await this.checkFailuresAndSendNotification(event)
26
- :'no statusCount';
27
-
28
- return {
29
- message: "Done ProcessPublishAssortmentCallback-process(): " + statMessage,
30
- };
31
- }
32
-
33
- private async checkFailuresAndSendNotification(event): Promise<string> {
34
- const statusCounts = JSON.parse(this.config["statusCounts"]);
35
-
36
- if (statusCounts["INVALID"] > 0 || statusCounts["FAILURE"] > 0) {
37
- await new Notification().Dispatch({
38
- message: `There were errors when publishing the season data. Please review the event and config information from context.`,
39
- level: LogLevel.WARN,
40
- context: {
41
- event,
42
- config: this.config,
43
- },
44
- });
45
- return 'sent notification';
46
- }
47
-
48
- return 'no notification needed';
49
- }
50
- }
1
+ import { LogLevel, Notification } from "@contrail/sdk";
2
+ import { FCConfig } from "../interfaces/interfaces";
3
+
4
+ export class BaseProcessPublishAssortmentCallback {
5
+ private config: FCConfig;
6
+
7
+ constructor(_config: FCConfig) {
8
+ this.config = _config;
9
+ }
10
+
11
+ public async process(event) {
12
+ console.log("ProcessPublishAssortmentCallback-process()");
13
+
14
+ console.log(
15
+ "ProcessPublishAssortmentCallback-event: " + JSON.stringify(event)
16
+ );
17
+ console.log(
18
+ "ProcessPublishAssortmentCallback-config: " + JSON.stringify(this.config)
19
+ );
20
+
21
+ const statusCounts = this.config["statusCounts"];
22
+ console.log("statusCounts: " + JSON.stringify(statusCounts));
23
+
24
+ const statMessage =(statusCounts && 'undefined' !== statusCounts)
25
+ ?await this.checkFailuresAndSendNotification(event)
26
+ :'no statusCount';
27
+
28
+ return {
29
+ message: "Done ProcessPublishAssortmentCallback-process(): " + statMessage,
30
+ };
31
+ }
32
+
33
+ private async checkFailuresAndSendNotification(event): Promise<string> {
34
+ const statusCounts = JSON.parse(this.config["statusCounts"]);
35
+
36
+ if (statusCounts["INVALID"] > 0 || statusCounts["FAILURE"] > 0) {
37
+ await new Notification().Dispatch({
38
+ message: `There were errors when publishing the season data. Please review the event and config information from context.`,
39
+ level: LogLevel.WARN,
40
+ context: {
41
+ event,
42
+ config: this.config,
43
+ },
44
+ });
45
+ return 'sent notification';
46
+ }
47
+
48
+ return 'no notification needed';
49
+ }
50
+ }