@contrail/flexplm 1.1.31 → 1.1.33

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.
@@ -28,6 +28,7 @@ export declare abstract class BaseEntityProcessor {
28
28
  protected abstract getCreateEntity(inboundData: any): Promise<IncomingEntityResponse>;
29
29
  outbound(event: any): Promise<any>;
30
30
  handleOutgoingUpsert(entityType: any, event: any): Promise<any>;
31
+ getOutboundEntityUpdates(event: any, flexResponse: any): Promise<any>;
31
32
  handleOutgoingDelete(entityType: any, event: any): Promise<void>;
32
33
  protected abstract getOutgoingUpsertPayload(entityType: any, event: any): Promise<EntityPayloadType>;
33
34
  }
@@ -153,14 +153,21 @@ class BaseEntityProcessor {
153
153
  }
154
154
  const payload = await this.getOutgoingUpsertPayload(entityType, event);
155
155
  const flexResponse = await new flexplm_connect_1.FlexPLMConnect(this.config).sendToFlexPLM(payload);
156
- const flexPayload = flexResponse?.data?.payload[0];
157
- if (flexPayload) {
158
- const inboundData = await this.getTransformedData(flexPayload);
159
- const outboundEntityUpdates = await this.getUpdatesForEntity(event.newData, inboundData);
156
+ const outboundEntityUpdates = await this.getOutboundEntityUpdates(event, flexResponse);
157
+ if (outboundEntityUpdates) {
160
158
  flexResponse['outboundEntityUpdates'] = outboundEntityUpdates;
161
159
  }
162
160
  return flexResponse;
163
161
  }
162
+ async getOutboundEntityUpdates(event, flexResponse) {
163
+ const flexPayload = flexResponse?.data?.payload[0];
164
+ let outboundEntityUpdates = undefined;
165
+ if (flexPayload && 'OK' === flexPayload.status) {
166
+ const inboundData = await this.getTransformedData(flexPayload);
167
+ outboundEntityUpdates = await this.getUpdatesForEntity(event.newData, inboundData);
168
+ }
169
+ return outboundEntityUpdates;
170
+ }
164
171
  async handleOutgoingDelete(entityType, event) {
165
172
  console.warn('delete is not configured', entityType, event.oldData);
166
173
  }
@@ -12,7 +12,7 @@ class BaseProcessPublishAssortmentCallback {
12
12
  console.log("ProcessPublishAssortmentCallback-config: " + JSON.stringify(this.config));
13
13
  const statusCounts = this.config["statusCounts"];
14
14
  console.log("statusCounts: " + JSON.stringify(statusCounts));
15
- const statMessage = (statusCounts)
15
+ const statMessage = (statusCounts && 'undefined' !== statusCounts)
16
16
  ? await this.checkFailuresAndSendNotification(event)
17
17
  : 'no statusCount';
18
18
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/flexplm",
3
- "version": "1.1.31",
3
+ "version": "1.1.33",
4
4
  "description": "Library used for integration with flexplm.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -199,16 +199,24 @@ export abstract class BaseEntityProcessor {
199
199
  const payload = await this.getOutgoingUpsertPayload(entityType, event);
200
200
  const flexResponse: any = await new FlexPLMConnect(this.config).sendToFlexPLM(payload);
201
201
 
202
- const flexPayload = flexResponse?.data?.payload[0];
203
- if(flexPayload) {
204
- const inboundData = await this.getTransformedData(flexPayload);
205
- const outboundEntityUpdates = await this.getUpdatesForEntity(event.newData, inboundData)
202
+ const outboundEntityUpdates = await this.getOutboundEntityUpdates(event, flexResponse);
203
+ if(outboundEntityUpdates){
206
204
  flexResponse['outboundEntityUpdates'] = outboundEntityUpdates;
207
205
  }
208
206
 
209
207
  return flexResponse;
210
208
  }
211
209
 
210
+ async getOutboundEntityUpdates(event, flexResponse): Promise<any> {
211
+ const flexPayload = flexResponse?.data?.payload[0];
212
+ let outboundEntityUpdates = undefined;
213
+ if(flexPayload && 'OK' === flexPayload.status) {
214
+ const inboundData = await this.getTransformedData(flexPayload);
215
+ outboundEntityUpdates = await this.getUpdatesForEntity(event.newData, inboundData)
216
+ }
217
+ return outboundEntityUpdates;
218
+ }
219
+
212
220
  async handleOutgoingDelete(entityType, event) {
213
221
  console.warn('delete is not configured', entityType, event.oldData);
214
222
  }
@@ -21,7 +21,7 @@ export class BaseProcessPublishAssortmentCallback {
21
21
  const statusCounts = this.config["statusCounts"];
22
22
  console.log("statusCounts: " + JSON.stringify(statusCounts));
23
23
 
24
- const statMessage =(statusCounts)
24
+ const statMessage =(statusCounts && 'undefined' !== statusCounts)
25
25
  ?await this.checkFailuresAndSendNotification(event)
26
26
  :'no statusCount';
27
27