@contrail/flexplm 1.3.0 → 1.3.1-alpha.585afc1

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 (149) hide show
  1. package/lib/cli/commands/compile.d.ts +1 -0
  2. package/lib/cli/commands/compile.js +71 -0
  3. package/lib/cli/commands/compile.spec.d.ts +1 -0
  4. package/lib/cli/commands/compile.spec.js +80 -0
  5. package/lib/cli/commands/create.d.ts +1 -0
  6. package/lib/cli/commands/create.js +75 -0
  7. package/lib/cli/commands/create.spec.d.ts +1 -0
  8. package/lib/cli/commands/create.spec.js +78 -0
  9. package/lib/cli/commands/upload.d.ts +10 -0
  10. package/lib/cli/commands/upload.js +219 -0
  11. package/lib/cli/commands/upload.spec.d.ts +1 -0
  12. package/lib/cli/commands/upload.spec.js +88 -0
  13. package/lib/cli/index.d.ts +2 -0
  14. package/lib/cli/index.js +64 -0
  15. package/lib/cli/index.spec.d.ts +1 -0
  16. package/lib/cli/index.spec.js +79 -0
  17. package/lib/cli/template/mapping-template.ts.template +18 -0
  18. package/lib/entity-processor/base-entity-processor.d.ts +89 -42
  19. package/lib/entity-processor/base-entity-processor.js +438 -385
  20. package/lib/entity-processor/base-entity-processor.spec.d.ts +1 -1
  21. package/lib/entity-processor/base-entity-processor.spec.js +398 -397
  22. package/lib/flexplm-request.d.ts +3 -3
  23. package/lib/flexplm-request.js +34 -34
  24. package/lib/flexplm-utils.d.ts +5 -5
  25. package/lib/flexplm-utils.js +33 -33
  26. package/lib/flexplm-utils.spec.d.ts +1 -1
  27. package/lib/flexplm-utils.spec.js +26 -26
  28. package/lib/index.d.ts +23 -22
  29. package/lib/index.js +39 -38
  30. package/lib/interfaces/interfaces.d.ts +105 -105
  31. package/lib/interfaces/interfaces.js +2 -2
  32. package/lib/interfaces/item-family-changes.d.ts +20 -20
  33. package/lib/interfaces/item-family-changes.js +56 -56
  34. package/lib/interfaces/mapping-file.d.ts +429 -0
  35. package/lib/interfaces/mapping-file.js +2 -0
  36. package/lib/interfaces/publish-change-data.d.ts +19 -19
  37. package/lib/interfaces/publish-change-data.js +32 -32
  38. package/lib/publish/base-process-publish-assortment-callback.d.ts +9 -9
  39. package/lib/publish/base-process-publish-assortment-callback.js +38 -38
  40. package/lib/publish/base-process-publish-assortment.d.ts +118 -93
  41. package/lib/publish/base-process-publish-assortment.js +998 -944
  42. package/lib/publish/base-process-publish-assortment.spec.d.ts +1 -1
  43. package/lib/publish/base-process-publish-assortment.spec.js +1688 -1670
  44. package/lib/publish/mockData.d.ts +1389 -1389
  45. package/lib/publish/mockData.js +4524 -4519
  46. package/lib/transform/identifier-conversion-spec-mockData.js +472 -444
  47. package/lib/transform/identifier-conversion.d.ts +51 -15
  48. package/lib/transform/identifier-conversion.js +248 -212
  49. package/lib/transform/identifier-conversion.spec.d.ts +1 -1
  50. package/lib/transform/identifier-conversion.spec.js +343 -339
  51. package/lib/util/config-defaults.d.ts +8 -8
  52. package/lib/util/config-defaults.js +88 -85
  53. package/lib/util/config-defaults.spec.d.ts +1 -1
  54. package/lib/util/config-defaults.spec.js +302 -293
  55. package/lib/util/data-converter-spec-mockData.js +219 -205
  56. package/lib/util/data-converter.d.ts +136 -39
  57. package/lib/util/data-converter.js +718 -592
  58. package/lib/util/data-converter.spec.d.ts +1 -1
  59. package/lib/util/data-converter.spec.js +906 -904
  60. package/lib/util/error-response-object.d.ts +9 -4
  61. package/lib/util/error-response-object.js +54 -47
  62. package/lib/util/error-response-object.spec.d.ts +1 -1
  63. package/lib/util/error-response-object.spec.js +99 -99
  64. package/lib/util/event-short-message-status.d.ts +19 -19
  65. package/lib/util/event-short-message-status.js +24 -23
  66. package/lib/util/federation.d.ts +15 -15
  67. package/lib/util/federation.js +157 -149
  68. package/lib/util/flexplm-connect.d.ts +29 -22
  69. package/lib/util/flexplm-connect.js +190 -176
  70. package/lib/util/flexplm-connect.spec.d.ts +1 -1
  71. package/lib/util/flexplm-connect.spec.js +88 -88
  72. package/lib/util/logger-config.d.ts +1 -1
  73. package/lib/util/logger-config.js +27 -26
  74. package/lib/util/map-util-spec-mockData.js +219 -205
  75. package/lib/util/map-utils.d.ts +33 -6
  76. package/lib/util/map-utils.js +42 -15
  77. package/lib/util/map-utils.spec.d.ts +1 -1
  78. package/lib/util/map-utils.spec.js +89 -89
  79. package/lib/util/mockData.d.ts +80 -80
  80. package/lib/util/mockData.js +103 -103
  81. package/lib/util/thumbnail-util.d.ts +55 -34
  82. package/lib/util/thumbnail-util.js +242 -215
  83. package/lib/util/thumbnail-util.spec.d.ts +1 -1
  84. package/lib/util/thumbnail-util.spec.js +440 -434
  85. package/lib/util/type-conversion-utils-spec-mockData.js +259 -259
  86. package/lib/util/type-conversion-utils.d.ts +163 -23
  87. package/lib/util/type-conversion-utils.js +408 -265
  88. package/lib/util/type-conversion-utils.spec.d.ts +1 -1
  89. package/lib/util/type-conversion-utils.spec.js +868 -868
  90. package/lib/util/type-defaults.d.ts +74 -16
  91. package/lib/util/type-defaults.js +279 -221
  92. package/lib/util/type-defaults.spec.d.ts +1 -1
  93. package/lib/util/type-defaults.spec.js +516 -516
  94. package/lib/util/type-utils.d.ts +34 -13
  95. package/lib/util/type-utils.js +137 -114
  96. package/lib/util/type-utils.spec.d.ts +1 -1
  97. package/lib/util/type-utils.spec.js +192 -190
  98. package/package.json +21 -6
  99. package/scripts/copy-template.js +10 -0
  100. package/.claude/settings.local.json +0 -8
  101. package/.github/pull_request_template.md +0 -31
  102. package/.github/workflows/flexplm-lib.yml +0 -27
  103. package/.github/workflows/publish-to-npm.yml +0 -124
  104. package/CHANGELOG.md +0 -32
  105. package/publish.bat +0 -5
  106. package/publish.sh +0 -5
  107. package/src/entity-processor/base-entity-processor.spec.ts +0 -460
  108. package/src/entity-processor/base-entity-processor.ts +0 -515
  109. package/src/flexplm-request.ts +0 -28
  110. package/src/flexplm-utils.spec.ts +0 -27
  111. package/src/flexplm-utils.ts +0 -29
  112. package/src/index.ts +0 -22
  113. package/src/interfaces/interfaces.ts +0 -122
  114. package/src/interfaces/item-family-changes.ts +0 -67
  115. package/src/interfaces/publish-change-data.ts +0 -43
  116. package/src/publish/base-process-publish-assortment-callback.ts +0 -50
  117. package/src/publish/base-process-publish-assortment.spec.ts +0 -1992
  118. package/src/publish/base-process-publish-assortment.ts +0 -1134
  119. package/src/publish/mockData.ts +0 -4561
  120. package/src/transform/identifier-conversion-spec-mockData.ts +0 -496
  121. package/src/transform/identifier-conversion.spec.ts +0 -354
  122. package/src/transform/identifier-conversion.ts +0 -282
  123. package/src/util/config-defaults.spec.ts +0 -350
  124. package/src/util/config-defaults.ts +0 -93
  125. package/src/util/data-converter-spec-mockData.ts +0 -231
  126. package/src/util/data-converter.spec.ts +0 -1041
  127. package/src/util/data-converter.ts +0 -762
  128. package/src/util/error-response-object.spec.ts +0 -116
  129. package/src/util/error-response-object.ts +0 -50
  130. package/src/util/event-short-message-status.ts +0 -22
  131. package/src/util/federation.ts +0 -172
  132. package/src/util/flexplm-connect.spec.ts +0 -132
  133. package/src/util/flexplm-connect.ts +0 -208
  134. package/src/util/logger-config.ts +0 -20
  135. package/src/util/map-util-spec-mockData.ts +0 -231
  136. package/src/util/map-utils.spec.ts +0 -103
  137. package/src/util/map-utils.ts +0 -41
  138. package/src/util/mockData.ts +0 -101
  139. package/src/util/thumbnail-util.spec.ts +0 -508
  140. package/src/util/thumbnail-util.ts +0 -272
  141. package/src/util/type-conversion-utils-spec-mockData.ts +0 -271
  142. package/src/util/type-conversion-utils.spec.ts +0 -968
  143. package/src/util/type-conversion-utils.ts +0 -460
  144. package/src/util/type-defaults.spec.ts +0 -669
  145. package/src/util/type-defaults.ts +0 -281
  146. package/src/util/type-utils.spec.ts +0 -227
  147. package/src/util/type-utils.ts +0 -144
  148. package/tsconfig.json +0 -29
  149. package/tslint.json +0 -57
@@ -1,56 +1,56 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ItemFamilyChanges = void 0;
4
- class ItemFamilyChanges {
5
- get itemFamilyId() { return this._itemFamilyId; }
6
- get sinceDate() { return this._sinceDate; }
7
- constructor(itemFamilyId, sinceDate) {
8
- this.familyAdd = false;
9
- this.familyDelete = false;
10
- this.familyUpdate = false;
11
- this.familyItemRemoved = false;
12
- this.itemFamilyObject = undefined;
13
- this.colorAdds = [];
14
- this.colorDeletes = [];
15
- this.colorUpdates = [];
16
- this.colorUnchanged = [];
17
- this.assortmentItemFullChangeMap = new Map();
18
- this.assortmentItemDeleteMap = new Map();
19
- this.itemToFederatedIdMapping = new Map();
20
- this._itemFamilyId = itemFamilyId;
21
- this._sinceDate = sinceDate;
22
- }
23
- toString() {
24
- let s = 'ItemFamilyChanges\n'
25
- + ' itemFamilyId: ' + this._itemFamilyId + '\n'
26
- + ' sinceDate: ' + this._sinceDate + '\n'
27
- + ' familyAdd: ' + this.familyAdd + '\n'
28
- + ' familyDelete: ' + this.familyDelete + '\n'
29
- + ' familyUpdate: ' + this.familyUpdate + '\n'
30
- + ' familyItemRemoved: ' + this.familyItemRemoved + '\n';
31
- s += ' colorAdds: [' + this.colorAdds + ']\n';
32
- s += ' colorDeletes: [' + this.colorDeletes + ']\n';
33
- s += ' colorUpdates: [' + this.colorUpdates + ']\n';
34
- s += ' colorUnchanged: [' + this.colorUnchanged + ']\n';
35
- s += 'assortmentItemFullChangeMap:\n';
36
- s += 'size: ' + this.assortmentItemFullChangeMap.size + '\n[';
37
- for (const key of this.assortmentItemFullChangeMap.keys()) {
38
- s += key + ', ';
39
- }
40
- s += ']\n';
41
- s += 'assortmentItemDeleteMap:\n';
42
- s += 'size: ' + this.assortmentItemDeleteMap.size + '\n[';
43
- for (const key of this.assortmentItemDeleteMap.keys()) {
44
- s += key + ', ';
45
- }
46
- s += ']\n';
47
- s += 'itemToFederatedIdMapping:\n';
48
- s += 'size: ' + this.itemToFederatedIdMapping.size + '\n[';
49
- for (const key of this.itemToFederatedIdMapping.keys()) {
50
- s += key + ', ';
51
- }
52
- s += ']\n';
53
- return s;
54
- }
55
- }
56
- exports.ItemFamilyChanges = ItemFamilyChanges;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ItemFamilyChanges = void 0;
4
+ class ItemFamilyChanges {
5
+ get itemFamilyId() { return this._itemFamilyId; }
6
+ get sinceDate() { return this._sinceDate; }
7
+ constructor(itemFamilyId, sinceDate) {
8
+ this.familyAdd = false;
9
+ this.familyDelete = false;
10
+ this.familyUpdate = false;
11
+ this.familyItemRemoved = false;
12
+ this.itemFamilyObject = undefined;
13
+ this.colorAdds = [];
14
+ this.colorDeletes = [];
15
+ this.colorUpdates = [];
16
+ this.colorUnchanged = [];
17
+ this.assortmentItemFullChangeMap = new Map();
18
+ this.assortmentItemDeleteMap = new Map();
19
+ this.itemToFederatedIdMapping = new Map();
20
+ this._itemFamilyId = itemFamilyId;
21
+ this._sinceDate = sinceDate;
22
+ }
23
+ toString() {
24
+ let s = 'ItemFamilyChanges\n'
25
+ + ' itemFamilyId: ' + this._itemFamilyId + '\n'
26
+ + ' sinceDate: ' + this._sinceDate + '\n'
27
+ + ' familyAdd: ' + this.familyAdd + '\n'
28
+ + ' familyDelete: ' + this.familyDelete + '\n'
29
+ + ' familyUpdate: ' + this.familyUpdate + '\n'
30
+ + ' familyItemRemoved: ' + this.familyItemRemoved + '\n';
31
+ s += ' colorAdds: [' + this.colorAdds + ']\n';
32
+ s += ' colorDeletes: [' + this.colorDeletes + ']\n';
33
+ s += ' colorUpdates: [' + this.colorUpdates + ']\n';
34
+ s += ' colorUnchanged: [' + this.colorUnchanged + ']\n';
35
+ s += 'assortmentItemFullChangeMap:\n';
36
+ s += 'size: ' + this.assortmentItemFullChangeMap.size + '\n[';
37
+ for (const key of this.assortmentItemFullChangeMap.keys()) {
38
+ s += key + ', ';
39
+ }
40
+ s += ']\n';
41
+ s += 'assortmentItemDeleteMap:\n';
42
+ s += 'size: ' + this.assortmentItemDeleteMap.size + '\n[';
43
+ for (const key of this.assortmentItemDeleteMap.keys()) {
44
+ s += key + ', ';
45
+ }
46
+ s += ']\n';
47
+ s += 'itemToFederatedIdMapping:\n';
48
+ s += 'size: ' + this.itemToFederatedIdMapping.size + '\n[';
49
+ for (const key of this.itemToFederatedIdMapping.keys()) {
50
+ s += key + ', ';
51
+ }
52
+ s += ']\n';
53
+ return s;
54
+ }
55
+ }
56
+ exports.ItemFamilyChanges = ItemFamilyChanges;
@@ -0,0 +1,429 @@
1
+ import { FunctionTransformers, RekeyTransformers, TransformDefinition, TransformTask } from "@contrail/transform-data";
2
+ /**
3
+ * One direction of a {@link MappingSection} (either `vibe2flex` or `flex2vibe`).
4
+ *
5
+ * Holds the per-direction transform pipeline plus the named lookup tables
6
+ * (`rekey`, `removeKey`, `valueTransform`) that the tasks in
7
+ * {@link DirectionalSection.transformOrder} reference by key. A REKEY task
8
+ * configured with `rekeyTransformersKey: 'rekey'` resolves to
9
+ * {@link DirectionalSection.rekey} on the same directional section.
10
+ *
11
+ * The named members below cover the conventional shape, but the section
12
+ * is open: each task in a pipeline resolves its config by reading the
13
+ * sibling property whose name is supplied by the matching `*Key` pointer
14
+ * on the task. That means a directional section can hold:
15
+ * - additional `TransformTask[]` pipelines under names other than
16
+ * `transformOrder` (selected by passing a non-default `orderKey` to
17
+ * `MapFileUtil.getTransformTasks`)
18
+ * - additional REKEY / REMOVE / MORPH / VALUE_TRANSFORM / CONDITIONAL
19
+ * lookup tables under arbitrary names referenced by the task's
20
+ * `rekeyTransformersKey`, `removeKeysKey`, `functionTransformersKey`,
21
+ * or `conditionalTransformDefinitionsKey`.
22
+ *
23
+ * @example
24
+ * vibe2flex: {
25
+ * transformOrder: [
26
+ * { processor: 'VALUE_TRANSFORM', functionTransformersKey: 'valueTransform' },
27
+ * { processor: 'REKEY', rekeyDelete: true, rekeyKeepEmptyValues: true, rekeyTransformersKey: 'rekey' },
28
+ * { processor: 'REMOVE', removeKeysKey: 'removeKey' },
29
+ * ],
30
+ * rekey: { productName: 'name', custBrand: 'brand' },
31
+ * valueTransform: {
32
+ * itemNumber: (row) => '' + row['itemNumber'],
33
+ * },
34
+ * removeKey: ['patternReference', 'vibeOnlyProp'],
35
+ * }
36
+ */
37
+ export interface DirectionalSection {
38
+ /**
39
+ * Ordered pipeline of transforms applied to each row in this direction.
40
+ *
41
+ * Each task is dispatched by its `processor` discriminator
42
+ * (REKEY, REMOVE, VALUE_TRANSFORM, MORPH, CONDITIONAL) and reads its
43
+ * configuration from the corresponding sibling property on this section
44
+ * (e.g. a REKEY task with `rekeyTransformersKey: 'rekey'` reads
45
+ * {@link DirectionalSection.rekey}).
46
+ *
47
+ * @example
48
+ * transformOrder: [
49
+ * { processor: 'REKEY', rekeyDelete: true, rekeyKeepEmptyValues: true, rekeyTransformersKey: 'rekey' },
50
+ * { processor: 'REMOVE', removeKeysKey: 'removeKey' },
51
+ * ]
52
+ */
53
+ transformOrder?: TransformTask[];
54
+ /**
55
+ * Resolves the FlexPLM object class (vibe2flex) or VibeIQ entity class
56
+ * (flex2vibe) for a row when it cannot be derived from the row itself.
57
+ *
58
+ * Consulted by `TypeConversionUtils.getObjectClass` /
59
+ * `getEntityClassFromObject` after the explicit `flexPLMObjectClass` /
60
+ * `vibeIQEntityClass` property and before the `TypeDefaults` fallback.
61
+ *
62
+ * @example
63
+ * // vibe2flex
64
+ * getClass: () => 'LCSRevisableEntity'
65
+ * // flex2vibe
66
+ * getClass: () => 'custom-entity'
67
+ */
68
+ getClass?: (entity: Record<string, unknown>) => string;
69
+ /**
70
+ * Resolves the FlexPLM type path (vibe2flex) or VibeIQ type path
71
+ * (flex2vibe) for a row when it cannot be derived from the row itself.
72
+ *
73
+ * Consulted by `TypeConversionUtils.getObjectTypePath` /
74
+ * `getEntityTypePathFromObject` after the explicit `flexPLMTypePath` /
75
+ * `vibeIQTypePath` property and before the `TypeDefaults` fallback.
76
+ *
77
+ * @example
78
+ * // vibe2flex
79
+ * getSoftType: () => 'Revisable Entity\\Product Concept'
80
+ * // flex2vibe
81
+ * getSoftType: () => 'custom-entity:styleConcept'
82
+ */
83
+ getSoftType?: (entity: Record<string, unknown>) => string;
84
+ /**
85
+ * Lookup table consumed by REKEY tasks in {@link DirectionalSection.transformOrder}.
86
+ *
87
+ * Keyed `newKey` → `existingKey`: each entry copies (or moves, when the
88
+ * task sets `rekeyDelete: true`) the value at `existingKey` onto `newKey`.
89
+ * Referenced by `rekeyTransformersKey` on the REKEY task.
90
+ *
91
+ * @example
92
+ * rekey: {
93
+ * productName: 'name',
94
+ * custBrand: 'brand',
95
+ * custStyleNumber: 'styleNumber',
96
+ * }
97
+ */
98
+ rekey?: RekeyTransformers;
99
+ /**
100
+ * Lookup table consumed by REMOVE tasks in {@link DirectionalSection.transformOrder}.
101
+ *
102
+ * Names of keys to delete from each row. Referenced by `removeKeysKey`
103
+ * on the REMOVE task.
104
+ *
105
+ * @example
106
+ * removeKey: ['patternReference', 'vibeOnlyProp']
107
+ */
108
+ removeKey?: string[];
109
+ /**
110
+ * Lookup table consumed by VALUE_TRANSFORM tasks in
111
+ * {@link DirectionalSection.transformOrder}.
112
+ *
113
+ * Each entry's key is the property the function's return value is written
114
+ * to on the row; the function receives the full row plus optional
115
+ * dependencies. Referenced by `functionTransformersKey` on the
116
+ * VALUE_TRANSFORM task.
117
+ *
118
+ * @example
119
+ * valueTransform: {
120
+ * itemNumber: (row) => {
121
+ * const numValue = parseInt(row['itemNumber'], 10);
122
+ * return isNaN(numValue) ? row['itemNumber'] : numValue;
123
+ * },
124
+ * }
125
+ */
126
+ valueTransform?: Record<string, (row: Record<string, unknown>, dependencies?: unknown) => unknown>;
127
+ /**
128
+ * Lookup table consumed by MORPH tasks in {@link DirectionalSection.transformOrder}.
129
+ *
130
+ * Each entry's function receives the full row plus optional dependencies
131
+ * and may rewrite/augment it in place; unlike {@link DirectionalSection.valueTransform},
132
+ * the function key is just an identifier and is not the destination
133
+ * property. Referenced by `functionTransformersKey` on the MORPH task.
134
+ *
135
+ * @example
136
+ * morphTransform: {
137
+ * morph1: (row) => {
138
+ * const val = row['productStatus'];
139
+ * if (val && Object.keys(val).length === 0) {
140
+ * delete row['productStatus'];
141
+ * }
142
+ * },
143
+ * }
144
+ */
145
+ morphTransform?: Record<string, (row: Record<string, unknown>, dependencies?: unknown) => unknown>;
146
+ /**
147
+ * Catch-all for additional pipelines and per-processor lookup tables
148
+ * referenced by sibling `*Key` pointers on tasks. Each entry should be
149
+ * one of:
150
+ * - {@link TransformTask}[] — alternate pipeline (read it by passing
151
+ * its property name as `orderKey` to `MapFileUtil.getTransformTasks`)
152
+ * - {@link RekeyTransformers} — `newKey` → `existingKey` map for REKEY
153
+ * - `string[]` — keys to delete for REMOVE
154
+ * - {@link FunctionTransformers} — Record<string, Function> for MORPH or VALUE_TRANSFORM
155
+ * - {@link TransformDefinition}[] — conditional rules for CONDITIONAL
156
+ */
157
+ [key: string]: TransformTask[] | TransformDefinition[] | RekeyTransformers | FunctionTransformers | Record<string, unknown> | string[] | ((entity: Record<string, unknown>) => string) | ((entity: Record<string, unknown>) => string[]) | ((row: Record<string, unknown>, dependencies?: unknown) => unknown) | undefined;
158
+ }
159
+ /**
160
+ * Per-entity-type configuration block, keyed in the {@link MappingFile}
161
+ * by the section key returned from
162
+ * {@link TypeConversionEntry.getMapKey} (e.g. `LCSProduct`,
163
+ * `'Exchange Rate'`).
164
+ *
165
+ * Holds direction-agnostic settings (ownership, identifier/informational
166
+ * properties, creation and image-sync gates) plus the two
167
+ * {@link DirectionalSection}s that drive the actual data transforms.
168
+ *
169
+ * @example
170
+ * LCSProduct: {
171
+ * vibeOwningKeys: ['itemNumber', 'lifecycleStage'],
172
+ * getIdentifierProperties: () => ['styleNumber'],
173
+ * vibe2flex: {
174
+ * transformOrder: [
175
+ * { processor: 'REKEY', rekeyDelete: true, rekeyKeepEmptyValues: true, rekeyTransformersKey: 'rekey' },
176
+ * ],
177
+ * rekey: { productName: 'name' },
178
+ * },
179
+ * flex2vibe: {
180
+ * transformOrder: [
181
+ * { processor: 'REKEY', rekeyDelete: true, rekeyKeepEmptyValues: true, rekeyTransformersKey: 'rekey' },
182
+ * ],
183
+ * rekey: { name: 'productName' },
184
+ * },
185
+ * }
186
+ */
187
+ export interface MappingSection {
188
+ /**
189
+ * These are the slugs of the properties that the VibeIQ system owns. So
190
+ * even if data comes in from an external source, it is ignored and the
191
+ * values are not overwritten.
192
+ *
193
+ * @example
194
+ * vibeOwningKeys: ['itemNumber', 'lifecycleStage']
195
+ */
196
+ vibeOwningKeys?: string[];
197
+ /**
198
+ * Tag identifying which identity service uniqueness pool this entity participates in.
199
+ * There can only be one entity with a given value for the property(defined by `getIdentifierProperties`) within the same uniqueness pool.
200
+ *
201
+ * @example
202
+ * uniquenessPool: 'item'
203
+ */
204
+ uniquenessPool?: string;
205
+ /**
206
+ * Gate controlling whether an inbound FlexPLM object is allowed to
207
+ * create a new VibeIQ entity. When the function returns `false`, the
208
+ * inbound row may still update an existing entity but will not create
209
+ * one. Consulted by `TypeConversionUtils.isInboundCreatableFromObject`;
210
+ * defaults to `false` when the function is absent.
211
+ *
212
+ * @example
213
+ * isInboundCreatable: () => true
214
+ */
215
+ isInboundCreatable?: (entity: Record<string, unknown>, context?: unknown) => boolean;
216
+ /**
217
+ * Gate controlling whether an outbound VibeIQ entity is allowed to
218
+ * create a new FlexPLM object. When the function returns `false`, the
219
+ * outbound publish becomes an update-only operation. Consulted by
220
+ * `TypeConversionUtils.isOutboundCreatableFromEntity`; defaults to
221
+ * `true` when the function is absent.
222
+ *
223
+ * @example
224
+ * isOutboundCreatable: () => false
225
+ */
226
+ isOutboundCreatable?: (entity: Record<string, unknown>, context?: unknown) => boolean;
227
+ /**
228
+ * Gate controlling whether image/thumbnail content should be synced
229
+ * from FlexPLM into VibeIQ for this entity type. Consulted by
230
+ * `TypeConversionUtils.syncInboundImages`; defaults to `false` when
231
+ * the function is absent. Typically aligned with whichever system
232
+ * owns creation of the entity.
233
+ *
234
+ * @example
235
+ * syncInboundImages: () => true
236
+ */
237
+ syncInboundImages?: (entity: Record<string, unknown>, context?: unknown) => boolean;
238
+ /**
239
+ * Gate controlling whether image/thumbnail content should be synced
240
+ * from VibeIQ out to FlexPLM for this entity type. Consulted by
241
+ * `TypeConversionUtils.syncOutboundImages`; defaults to `true` when
242
+ * the function is absent. Typically aligned with whichever system
243
+ * owns creation of the entity.
244
+ *
245
+ * @example
246
+ * syncOutboundImages: () => false
247
+ */
248
+ syncOutboundImages?: (entity: Record<string, unknown>, context?: unknown) => boolean;
249
+ /**
250
+ * Returns the property names that uniquely identify this entity. Used
251
+ * by `TypeConversionUtils.getIdentifierProperties` to drive lookup and
252
+ * matching when an explicit `flexPLMIdentifierProperties` /
253
+ * `vibeIQIdentifierProperties` is not present on the row, falling
254
+ * back to `TypeDefaults` when this is absent.
255
+ *
256
+ * @example
257
+ * getIdentifierProperties: () => ['itemNumber']
258
+ */
259
+ getIdentifierProperties?: (entity: Record<string, unknown>) => string[];
260
+ /**
261
+ * Returns supplemental property names that should be carried alongside
262
+ * identifiers (e.g. display names) but do not participate in identity.
263
+ * Consulted by `TypeConversionUtils.getInformationalProperties` with
264
+ * the same lookup precedence as {@link MappingSection.getIdentifierProperties}.
265
+ *
266
+ * @example
267
+ * getInformationalProperties: () => ['longName']
268
+ */
269
+ getInformationalProperties?: (entity: Record<string, unknown>) => string[];
270
+ /** Transform configuration applied when sending data from VibeIQ to FlexPLM. */
271
+ vibe2flex?: DirectionalSection;
272
+ /** Transform configuration applied when receiving data from FlexPLM into VibeIQ. */
273
+ flex2vibe?: DirectionalSection;
274
+ }
275
+ /**
276
+ * Entry in the {@link TypeConversionSection} that maps a single source
277
+ * type onto the {@link MappingSection} key that should handle it.
278
+ *
279
+ * Useful for fanning a single VibeIQ `entityType` (e.g. `'custom-entity'`)
280
+ * out to multiple sections based on the row's `typePath`.
281
+ */
282
+ export interface TypeConversionEntry {
283
+ /**
284
+ * Returns the {@link MappingFile} key whose {@link MappingSection}
285
+ * should be used to transform `entity`. Returning an empty string
286
+ * signals that no section applies and the row should be skipped.
287
+ *
288
+ * @example
289
+ * getMapKey: (entity) => {
290
+ * switch (entity['typePath']) {
291
+ * case 'custom-entity:exchangeRate': return 'Exchange Rate';
292
+ * case 'custom-entity:styleConcept': return 'Style Concept Master';
293
+ * default: return '';
294
+ * }
295
+ * }
296
+ */
297
+ getMapKey: (entity: Record<string, unknown>) => string;
298
+ }
299
+ /**
300
+ * One direction of {@link TypeConversion}, keyed by the source-system
301
+ * type:
302
+ * - In `vibe2flex`, keys are VibeIQ entity types (e.g. `'custom-entity'`,
303
+ * `'size-range-template'`) — see `TypeConversionUtils.getEntityType`.
304
+ * - In `flex2vibe`, keys are FlexPLM object classes (e.g. `LCSProduct`) —
305
+ * see `TypeConversionUtils.getObjectType`.
306
+ */
307
+ export interface TypeConversionSection {
308
+ [type: string]: TypeConversionEntry;
309
+ }
310
+ /**
311
+ * Top-level routing table that resolves a row to its
312
+ * {@link MappingSection} key for each direction.
313
+ *
314
+ * `TypeConversionUtils.getMapKey` / `getMapKeyFromObject` look up the
315
+ * row's type in the appropriate side, invoke
316
+ * {@link TypeConversionEntry.getMapKey}, and use the returned string
317
+ * as the key into the rest of the {@link MappingFile}.
318
+ *
319
+ * @example
320
+ * typeConversion: {
321
+ * vibe2flex: {
322
+ * 'custom-entity': {
323
+ * getMapKey: (entity) => {
324
+ * switch (entity['typePath']) {
325
+ * case 'custom-entity:exchangeRate': return 'Exchange Rate';
326
+ * default: return '';
327
+ * }
328
+ * },
329
+ * },
330
+ * 'size-range-template': {
331
+ * getMapKey: () => 'size-range-template',
332
+ * },
333
+ * },
334
+ * flex2vibe: {
335
+ * LCSRevisableEntity: {
336
+ * getMapKey: (object) => {
337
+ * switch (object['flexPLMTypePath']) {
338
+ * case 'Revisable Entity\\Exchange Rate': return 'Exchange Rate';
339
+ * default: return '';
340
+ * }
341
+ * },
342
+ * },
343
+ * },
344
+ * }
345
+ */
346
+ export interface TypeConversion {
347
+ /** Routes outbound VibeIQ entities to their FlexPLM mapping sections. */
348
+ vibe2flex: TypeConversionSection;
349
+ /** Routes inbound FlexPLM objects to their VibeIQ mapping sections. */
350
+ flex2vibe: TypeConversionSection;
351
+ }
352
+ /** Identifies the application and tenant that owns a {@link MappingFile}. */
353
+ export interface OrgInfo {
354
+ /** This is the identifier for the application, and is used to set the owner of the mapping file */
355
+ appIdentifier: '@vibeiq/flexplm-connector';
356
+ /** The name of the organization using the mapping file. */
357
+ orgName: string;
358
+ }
359
+ interface MappingFileBase {
360
+ /** The information about the organization using the mapping file */
361
+ orgInfo: OrgInfo;
362
+ /** The type conversion information for the mapping file. */
363
+ typeConversion: TypeConversion;
364
+ }
365
+ /**
366
+ * Full mapping file driving bidirectional sync between VibeIQ and FlexPLM
367
+ * for a single tenant.
368
+ *
369
+ * Combines the fixed {@link MappingFileBase} fields (`orgInfo`,
370
+ * `typeConversion`) with an open set of {@link MappingSection} entries
371
+ * keyed by the strings returned from
372
+ * {@link TypeConversionEntry.getMapKey} (e.g. `LCSProduct`, `LCSSKU`,
373
+ * `'Exchange Rate'`).
374
+ *
375
+ * @example
376
+ * export const mapping: MappingFile = {
377
+ * orgInfo: {
378
+ * appIdentifier: '@vibeiq/flexplm-connector',
379
+ * orgName: 'acme',
380
+ * },
381
+ * typeConversion: {
382
+ * vibe2flex: {
383
+ * 'custom-entity': {
384
+ * getMapKey: (entity) => {
385
+ * switch (entity['typePath']) {
386
+ * case 'custom-entity:exchangeRate': return 'Exchange Rate';
387
+ * default: return '';
388
+ * }
389
+ * },
390
+ * },
391
+ * 'size-range-template': {
392
+ * getMapKey: () => 'size-range-template',
393
+ * },
394
+ * },
395
+ * flex2vibe: {
396
+ * LCSRevisableEntity: {
397
+ * getMapKey: (object) => {
398
+ * switch (object['flexPLMTypePath']) {
399
+ * case 'Revisable Entity\\Exchange Rate': return 'Exchange Rate';
400
+ * default: return '';
401
+ * }
402
+ * },
403
+ * },
404
+ * },
405
+ * },
406
+ * 'Exchange Rate': {
407
+ * vibe2flex: {
408
+ * transformOrder: [
409
+ * { processor: 'REKEY', rekeyDelete: true, rekeyKeepEmptyValues: true, rekeyTransformersKey: 'rekey' },
410
+ * ],
411
+ * rekey: { exchangeRateDescription: 'name' },
412
+ * getClass: () => 'LCSRevisableEntity',
413
+ * getSoftType: () => 'Revisable Entity\\Exchange Rate',
414
+ * },
415
+ * flex2vibe: {
416
+ * transformOrder: [
417
+ * { processor: 'REKEY', rekeyDelete: true, rekeyKeepEmptyValues: true, rekeyTransformersKey: 'rekey' },
418
+ * ],
419
+ * rekey: { name: 'exchangeRateDescription' },
420
+ * getClass: () => 'custom-entity',
421
+ * getSoftType: () => 'custom-entity:exchangeRate',
422
+ * },
423
+ * },
424
+ * };
425
+ */
426
+ export type MappingFile = MappingFileBase & {
427
+ [mapKey: string]: MappingSection | MappingFileBase[keyof MappingFileBase];
428
+ };
429
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,19 +1,19 @@
1
- import { SeasonFederation } from './interfaces';
2
- import { ItemFamilyChanges } from './item-family-changes';
3
- export declare class PublishChangeData {
4
- private _assortmentId;
5
- get assortmentId(): string;
6
- private _seasonFed;
7
- get seasonFed(): SeasonFederation;
8
- private _assortmentPublishChangeId;
9
- get assortmentPublishChangeId(): string;
10
- private _sinceDate;
11
- get sinceDate(): Date;
12
- private _publisher;
13
- get publisher(): object;
14
- itemToFederatedIdMapping: Map<string, string>;
15
- releasedForDevelopmentItemIds: string[];
16
- itemFamilyChanges: Map<string, ItemFamilyChanges>;
17
- constructor(_assortmentId: string, _seasonFed: SeasonFederation, _assortmentPublishChangeId: string, _sinceDate: Date, _publisher?: {});
18
- toString(): string;
19
- }
1
+ import { SeasonFederation } from './interfaces';
2
+ import { ItemFamilyChanges } from './item-family-changes';
3
+ export declare class PublishChangeData {
4
+ private _assortmentId;
5
+ get assortmentId(): string;
6
+ private _seasonFed;
7
+ get seasonFed(): SeasonFederation;
8
+ private _assortmentPublishChangeId;
9
+ get assortmentPublishChangeId(): string;
10
+ private _sinceDate;
11
+ get sinceDate(): Date;
12
+ private _publisher;
13
+ get publisher(): object;
14
+ itemToFederatedIdMapping: Map<string, string>;
15
+ releasedForDevelopmentItemIds: string[];
16
+ itemFamilyChanges: Map<string, ItemFamilyChanges>;
17
+ constructor(_assortmentId: string, _seasonFed: SeasonFederation, _assortmentPublishChangeId: string, _sinceDate: Date, _publisher?: {});
18
+ toString(): string;
19
+ }
@@ -1,32 +1,32 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PublishChangeData = void 0;
4
- class PublishChangeData {
5
- get assortmentId() { return this._assortmentId; }
6
- get seasonFed() { return Object.assign({}, this._seasonFed); }
7
- get assortmentPublishChangeId() { return this._assortmentPublishChangeId; }
8
- get sinceDate() { return this._sinceDate; }
9
- get publisher() { return this._publisher; }
10
- constructor(_assortmentId, _seasonFed, _assortmentPublishChangeId, _sinceDate, _publisher = {}) {
11
- this.releasedForDevelopmentItemIds = [];
12
- this.itemFamilyChanges = new Map();
13
- this._assortmentId = _assortmentId;
14
- this._seasonFed = _seasonFed;
15
- this._assortmentPublishChangeId = _assortmentPublishChangeId;
16
- this._sinceDate = _sinceDate;
17
- this._publisher = _publisher;
18
- }
19
- toString() {
20
- let s = 'PublishChangeData\n'
21
- + 'assortmentId: ' + this._assortmentId + '\n'
22
- + 'seasonFed: ' + JSON.stringify(this._seasonFed) + '\n'
23
- + 'assortmentPublishChangeId: ' + this._assortmentPublishChangeId + '\n';
24
- s += ' itemToFederatedIdMapping: ' + JSON.stringify(Object.fromEntries(this.itemToFederatedIdMapping)) + '\n';
25
- s += 'itemFamilyChanges:\n';
26
- for (const [key, value] of this.itemFamilyChanges) {
27
- s += ' ' + key + ' => ' + value.toString();
28
- }
29
- return s;
30
- }
31
- }
32
- exports.PublishChangeData = PublishChangeData;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PublishChangeData = void 0;
4
+ class PublishChangeData {
5
+ get assortmentId() { return this._assortmentId; }
6
+ get seasonFed() { return Object.assign({}, this._seasonFed); }
7
+ get assortmentPublishChangeId() { return this._assortmentPublishChangeId; }
8
+ get sinceDate() { return this._sinceDate; }
9
+ get publisher() { return this._publisher; }
10
+ constructor(_assortmentId, _seasonFed, _assortmentPublishChangeId, _sinceDate, _publisher = {}) {
11
+ this.releasedForDevelopmentItemIds = [];
12
+ this.itemFamilyChanges = new Map();
13
+ this._assortmentId = _assortmentId;
14
+ this._seasonFed = _seasonFed;
15
+ this._assortmentPublishChangeId = _assortmentPublishChangeId;
16
+ this._sinceDate = _sinceDate;
17
+ this._publisher = _publisher;
18
+ }
19
+ toString() {
20
+ let s = 'PublishChangeData\n'
21
+ + 'assortmentId: ' + this._assortmentId + '\n'
22
+ + 'seasonFed: ' + JSON.stringify(this._seasonFed) + '\n'
23
+ + 'assortmentPublishChangeId: ' + this._assortmentPublishChangeId + '\n';
24
+ s += ' itemToFederatedIdMapping: ' + JSON.stringify(Object.fromEntries(this.itemToFederatedIdMapping)) + '\n';
25
+ s += 'itemFamilyChanges:\n';
26
+ for (const [key, value] of this.itemFamilyChanges) {
27
+ s += ' ' + key + ' => ' + value.toString();
28
+ }
29
+ return s;
30
+ }
31
+ }
32
+ exports.PublishChangeData = PublishChangeData;
@@ -1,9 +1,9 @@
1
- import { FCConfig } from "../interfaces/interfaces";
2
- export declare class BaseProcessPublishAssortmentCallback {
3
- private config;
4
- constructor(_config: FCConfig);
5
- process(event: any): Promise<{
6
- message: string;
7
- }>;
8
- private checkFailuresAndSendNotification;
9
- }
1
+ import { FCConfig } from "../interfaces/interfaces";
2
+ export declare class BaseProcessPublishAssortmentCallback {
3
+ private config;
4
+ constructor(_config: FCConfig);
5
+ process(event: any): Promise<{
6
+ message: string;
7
+ }>;
8
+ private checkFailuresAndSendNotification;
9
+ }