From 785bf79f8a1a6deb23e6825c8184fabc30bca72b Mon Sep 17 00:00:00 2001 From: Johannes Vogel Date: Tue, 1 Oct 2024 15:32:26 +0200 Subject: [PATCH] Revert "refactor: import of compareJSON (#814)" This reverts commit 3535a4e3ee4dd742931798d8e51381b1283f0e81. --- db-service/lib/deep-queries.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/db-service/lib/deep-queries.js b/db-service/lib/deep-queries.js index 23eb2e796..25d5312b4 100644 --- a/db-service/lib/deep-queries.js +++ b/db-service/lib/deep-queries.js @@ -3,7 +3,20 @@ const { _target_name4 } = require('./SQLService') const ROOT = Symbol('root') -const { compareJson } = require('@sap/cds/libx/_runtime/common/utils/compareJson') +// REVISIT: remove old path with cds^8 +let _compareJson +const compareJson = (...args) => { + if (!_compareJson) { + try { + // new path + _compareJson = require('@sap/cds/libx/_runtime/common/utils/compareJson').compareJson + } catch { + // old path + _compareJson = require('@sap/cds/libx/_runtime/cds-services/services/utils/compareJson').compareJson + } + } + return _compareJson(...args) +} const handledDeep = Symbol('handledDeep')