diff --git a/apps/cli/src/differ/differv3.ts b/apps/cli/src/differ/differv3.ts index 28dca70..1611ce6 100644 --- a/apps/cli/src/differ/differv3.ts +++ b/apps/cli/src/differ/differv3.ts @@ -315,10 +315,10 @@ export class DifferV3 { stream_routes: (remoteItem as ADCSDK.Service).stream_routes, } : resourceType === ADCSDK.ResourceType.CONSUMER_GROUP - ? { - consumers: (remoteItem as ADCSDK.ConsumerGroup).consumers, - } - : {}, + ? { + consumers: (remoteItem as ADCSDK.ConsumerGroup).consumers, + } + : {}, this.defaultValue, ).map(this.postprocessSubEvent(remoteName, remoteId)), }); @@ -328,6 +328,8 @@ export class DifferV3 { // to identify locally added resources. checkedRemoteId.push(remoteId); + const originalLocalItem = cloneDeep(localItem); + // For special handling of SSL resources, since neither APISIX nor // API7 outputs certificate private keys in plaintext, the local // and remote key fields should be removed, and the check item should @@ -374,20 +376,20 @@ export class DifferV3 { stream_routes: (localItem as ADCSDK.Service).stream_routes, } : resourceType === ADCSDK.ResourceType.CONSUMER_GROUP - ? { - consumers: (localItem as ADCSDK.ConsumerGroup).consumers, - } - : {}, + ? { + consumers: (localItem as ADCSDK.ConsumerGroup).consumers, + } + : {}, resourceType === ADCSDK.ResourceType.SERVICE ? { routes: (remoteItem as ADCSDK.Service).routes, stream_routes: (remoteItem as ADCSDK.Service).stream_routes, } : resourceType === ADCSDK.ResourceType.CONSUMER_GROUP - ? { - consumers: (remoteItem as ADCSDK.ConsumerGroup).consumers, - } - : {}, + ? { + consumers: (remoteItem as ADCSDK.ConsumerGroup).consumers, + } + : {}, this.defaultValue, ).map(this.postprocessSubEvent(remoteName, remoteId)), ); @@ -409,7 +411,7 @@ export class DifferV3 { }); } - let outputLocalItem: ADCSDK.Resource = cloneDeep(mergedLocalItem); + let outputLocalItem: ADCSDK.Resource = cloneDeep(originalLocalItem); let outputRemoteItem: ADCSDK.Resource = cloneDeep(remoteItem); // If the resource may contain plugin configurations, perform a @@ -461,6 +463,7 @@ export class DifferV3 { remote: outputRemoteItem, realRemote: remoteItem, realLocal: mergedLocalItem, + originalLocal: localItem, transactionId: this.transactionId, }); @@ -519,10 +522,10 @@ export class DifferV3 { stream_routes: (localItem as ADCSDK.Service).stream_routes, } : resourceType === ADCSDK.ResourceType.CONSUMER_GROUP - ? { - consumers: (localItem as ADCSDK.ConsumerGroup).consumers, - } - : {}, + ? { + consumers: (localItem as ADCSDK.ConsumerGroup).consumers, + } + : {}, {}, this.defaultValue, ).map(this.postprocessSubEvent(localName, localId)),