ramu11 commented on code in PR #25778:
URL: https://github.com/apache/camel/pull/25778#discussion_r3869555500


##########
components/camel-quickjs/src/main/java/org/apache/camel/language/quickjs/QuickjsHelper.java:
##########
@@ -0,0 +1,258 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.language.quickjs;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.Reader;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.roastedroot.quickjs4j.core.Engine;
+import io.roastedroot.quickjs4j.core.GuestException;
+import io.roastedroot.quickjs4j.core.GuestFunction;
+import io.roastedroot.quickjs4j.core.Invokables;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.ExpressionEvaluationException;
+import org.apache.camel.ExpressionIllegalSyntaxException;
+import org.apache.camel.Message;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.StreamCache;
+
+/**
+ * Helpers for evaluating JavaScript with QuickJS4J using JSON-serializable 
Exchange bindings.
+ */
+final class QuickjsHelper {
+
+    static final String MODULE_NAME = "camelQuickjs";
+    static final String FUNCTION_NAME = "camelEval";
+
+    /**
+     * Evaluates {@code script} with a copy of {@code bindings} as function 
parameters so {@code var} declarations do
+     * not leak into {@code globalThis} between Camel exchanges. Binding names 
must be valid JavaScript identifiers.

Review Comment:
   Addressed. Generic evaluate() now validates binding names and rejects 
invalid identifiers/reserved words with a clear ExpressionEvaluationException. 
The route-DSL bindings remain unchanged. The behavior is also documented.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to