@contrail/flexplm 1.1.32 → 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
|
|
157
|
-
if (
|
|
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
|
}
|
package/package.json
CHANGED
|
@@ -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
|
|
203
|
-
if(
|
|
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
|
}
|