diff --git a/cds-feature-notifications/pom.xml b/cds-feature-notifications/pom.xml index 686d1a9..fac513c 100644 --- a/cds-feature-notifications/pom.xml +++ b/cds-feature-notifications/pom.xml @@ -43,13 +43,13 @@ com.sap.cloud.sdk.cloudplatform connectivity-destination-service - 5.32.0 + 5.33.0 com.sap.cloud.sdk.cloudplatform cloudplatform-connectivity - 5.32.0 + 5.33.0 diff --git a/cds-feature-notifications/src/main/java/com/sap/cds/notifications/handlers/EntityNotificationHandler.java b/cds-feature-notifications/src/main/java/com/sap/cds/notifications/handlers/EntityNotificationHandler.java index b57d123..282e947 100644 --- a/cds-feature-notifications/src/main/java/com/sap/cds/notifications/handlers/EntityNotificationHandler.java +++ b/cds-feature-notifications/src/main/java/com/sap/cds/notifications/handlers/EntityNotificationHandler.java @@ -3,9 +3,12 @@ */ package com.sap.cds.notifications.handlers; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import com.sap.cds.CdsData; import com.sap.cds.Result; import com.sap.cds.Struct; +import com.sap.cds.impl.parser.ExpressionParser; import com.sap.cds.notifications.assemblers.NotificationAssembler; import com.sap.cds.ql.CQL; import com.sap.cds.ql.cqn.CqnContainmentTest; @@ -78,6 +81,7 @@ public class EntityNotificationHandler implements EventHandler { private static final Logger logger = LoggerFactory.getLogger(EntityNotificationHandler.class); + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); @After(event = "*") public void onEntityChange(EventContext context) { @@ -364,8 +368,22 @@ private Object resolveRecipients(Object recipientsConfig, Map en private boolean evaluateWhereCondition( Object whereCondition, Map entityData, EventContext context) { - // Complex CDS expression: CqnValue (e.g., $self.stock > 50) - if (!(whereCondition instanceof CqnValue cqnValue)) { + // CDS annotation expressions come back from the reflection API as a raw Map (CSN xpr format). + // In some SDK versions they may already be typed as CqnValue — accept both. + CqnValue cqnValue; + if (whereCondition instanceof CqnValue v) { + cqnValue = v; + } else if (whereCondition instanceof Map) { + try { + JsonNode jsonNode = OBJECT_MAPPER.valueToTree(whereCondition); + cqnValue = ExpressionParser.parsePredicate(jsonNode); + } catch (Exception e) { + throw new IllegalArgumentException( + "Where condition must be a boolean expression (e.g., '($self.stock > 50)'), got: " + + whereCondition.getClass().getName(), + e); + } + } else { throw new IllegalArgumentException( "Where condition must be a boolean expression (e.g., '($self.stock > 50)'), got: " + whereCondition.getClass().getName()); diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 6a2d037..72bc480 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -23,7 +23,7 @@ 21 - 5.0.0 + 5.0.2 4.1.0 https://nodejs.org/dist/ diff --git a/package-lock.json b/package-lock.json index 19995de..ca6be4f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -256,9 +256,9 @@ } }, "node_modules/@sap/cds-dk": { - "version": "10.0.6", - "resolved": "https://registry.npmjs.org/@sap/cds-dk/-/cds-dk-10.0.6.tgz", - "integrity": "sha512-rukYYrovNkpaRPgF6tI+tBHhel9WcpZRW2KFjVCVPCufrbTFqzz6PdCaQrb7tEctrRk5GBIL2bmN28s051Vt3w==", + "version": "10.0.7", + "resolved": "https://registry.npmjs.org/@sap/cds-dk/-/cds-dk-10.0.7.tgz", + "integrity": "sha512-M1INFmdNzr7dOoYzJ1MVhTyqYSg+vi8oH96N96CHo/cIM+wxMBJ9G/0OPppNs+pPrBPqkF91Xhy/FSGzwr7mfA==", "bundleDependencies": [ "@cap-js/asyncapi", "@cap-js/db-service", @@ -375,10 +375,10 @@ "@cap-js/db-service": "*", "@cap-js/openapi": "^1.0.0", "@cap-js/sqlite": "^3", - "@sap/cds": ">=9", + "@sap/cds": "^10", "@sap/cds-compiler": "*", "@sap/cds-fiori": "*", - "@sap/cds-mtxs": ">=3", + "@sap/cds-mtxs": "^4", "@sap/hdi": "*", "@sap/hdi-deploy": "^5", "@sap/xsenv": "*", @@ -407,7 +407,7 @@ "es-object-atoms": "*", "escape-html": "*", "etag": "*", - "express": "^4.22.1 || ^5", + "express": "^5", "extsprintf": "*", "fill-range": "*", "finalhandler": "*", @@ -512,7 +512,7 @@ } }, "node_modules/@sap/cds-dk/node_modules/@cap-js/openapi": { - "version": "1.5.0", + "version": "1.6.0", "dev": true, "inBundle": true, "license": "Apache-2.0", @@ -566,7 +566,7 @@ } }, "node_modules/@sap/cds-dk/node_modules/@sap/cds": { - "version": "10.0.4", + "version": "10.0.5", "dev": true, "inBundle": true, "license": "SEE LICENSE IN LICENSE", @@ -617,7 +617,7 @@ } }, "node_modules/@sap/cds-dk/node_modules/@sap/cds-mtxs": { - "version": "3.9.5", + "version": "4.0.2", "dev": true, "inBundle": true, "license": "SEE LICENSE IN LICENSE", @@ -1572,7 +1572,7 @@ "license": "MIT" }, "node_modules/@sap/cds-dk/node_modules/sax": { - "version": "1.6.0", + "version": "1.6.1", "dev": true, "inBundle": true, "license": "BlueOak-1.0.0", @@ -1842,7 +1842,7 @@ "license": "ISC" }, "node_modules/@sap/cds-dk/node_modules/ws": { - "version": "8.21.1", + "version": "8.21.2", "dev": true, "inBundle": true, "license": "MIT", @@ -2298,9 +2298,9 @@ } }, "node_modules/eslint": { - "version": "10.8.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.8.0.tgz", - "integrity": "sha512-nuKKvN+oIBO0koN7Tm7dlkmnkc21mtt0QJLwAKzjLq14y6lRTdVG36MZHJ8eQHwdJMwZbQNMlPOYedMq/oVJvQ==", + "version": "10.8.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.8.1.tgz", + "integrity": "sha512-wqA7W2jbsC/BnV9Iv1UZpKVFkO1AdNoSmYW8NWG4HNOBbkAMvIqDZ27pI2f07dqn583NcIC44ckjAcOXDL1QbQ==", "dev": true, "license": "MIT", "workspaces": [ diff --git a/pom.xml b/pom.xml index 4be5059..08e7d24 100644 --- a/pom.xml +++ b/pom.xml @@ -64,7 +64,7 @@ - 5.0.0 + 5.0.2 10.0.4 @@ -84,7 +84,7 @@ com.sap.cloud.sdk sdk-bom - 5.32.0 + 5.33.0 pom import @@ -92,7 +92,7 @@ org.junit junit-bom - 6.1.2 + 6.1.3 pom import @@ -108,14 +108,14 @@ ch.qos.logback logback-classic - 1.6.0 + 1.6.1 runtime ch.qos.logback logback-core - 1.6.0 + 1.6.1 runtime @@ -275,7 +275,7 @@ com.diffplug.spotless spotless-maven-plugin - 3.8.0 + 3.9.0