From e79f92acb48424a620f4a05633435050526fc25c Mon Sep 17 00:00:00 2001 From: Thisaru Guruge Date: Mon, 10 Mar 2025 10:20:23 +0530 Subject: [PATCH 1/3] [Automated] Update the native jar versions --- ballerina-tests/Ballerina.toml | 2 +- ballerina-tests/Dependencies.toml | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ballerina-tests/Ballerina.toml b/ballerina-tests/Ballerina.toml index 229ae3813..a6b158a65 100644 --- a/ballerina-tests/Ballerina.toml +++ b/ballerina-tests/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerina" name = "graphql_tests" -version = "1.13.3" +version = "1.13.4" [build-options] observabilityIncluded = true diff --git a/ballerina-tests/Dependencies.toml b/ballerina-tests/Dependencies.toml index ab325cc1e..ddca33c39 100644 --- a/ballerina-tests/Dependencies.toml +++ b/ballerina-tests/Dependencies.toml @@ -10,7 +10,7 @@ distribution-version = "2201.9.0" [[package]] org = "ballerina" name = "auth" -version = "2.11.0" +version = "2.11.2" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "jballerina.java"}, @@ -44,7 +44,7 @@ modules = [ [[package]] org = "ballerina" name = "crypto" -version = "2.7.0" +version = "2.7.2" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -67,7 +67,7 @@ modules = [ [[package]] org = "ballerina" name = "graphql" -version = "1.13.3" +version = "1.13.4" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, @@ -99,7 +99,7 @@ modules = [ [[package]] org = "ballerina" name = "graphql_tests" -version = "1.13.3" +version = "1.13.4" dependencies = [ {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "file"}, @@ -123,7 +123,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.11.0" +version = "2.11.9" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, @@ -155,7 +155,7 @@ modules = [ [[package]] org = "ballerina" name = "io" -version = "1.6.0" +version = "1.6.3" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.value"} @@ -388,7 +388,7 @@ modules = [ [[package]] org = "ballerina" name = "websocket" -version = "2.11.0" +version = "2.11.2" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "constraint"}, From d1ba32bd38d07ee0a0ed3822d7af311e0923757e Mon Sep 17 00:00:00 2001 From: Thisaru Guruge Date: Mon, 10 Mar 2025 10:27:19 +0530 Subject: [PATCH 2/3] [Automated] Update the native jar versions --- ballerina/Ballerina.toml | 10 +++++----- ballerina/CompilerPlugin.toml | 4 ++-- ballerina/Dependencies.toml | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 680140501..69e6b0d0c 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerina" name = "graphql" -version = "1.13.3" +version = "1.13.4" authors = ["Ballerina"] export=["graphql", "graphql.subgraph", "graphql.dataloader"] keywords = ["gql", "network", "query", "service"] @@ -16,11 +16,11 @@ graalvmCompatible = true [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" artifactId = "graphql-native" -version = "1.13.3" -path = "../native/build/libs/graphql-native-1.13.3.jar" +version = "1.13.4" +path = "../native/build/libs/graphql-native-1.13.4-SNAPSHOT.jar" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" artifactId = "graphql-commons" -version = "1.13.3" -path = "../commons/build/libs/graphql-commons-1.13.3.jar" +version = "1.13.4" +path = "../commons/build/libs/graphql-commons-1.13.4-SNAPSHOT.jar" diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index 8515d22c5..1306801ba 100644 --- a/ballerina/CompilerPlugin.toml +++ b/ballerina/CompilerPlugin.toml @@ -3,7 +3,7 @@ id = "graphql-compiler-plugin" class = "io.ballerina.stdlib.graphql.compiler.GraphqlCompilerPlugin" [[dependency]] -path = "../compiler-plugin/build/libs/graphql-compiler-plugin-1.13.3.jar" +path = "../compiler-plugin/build/libs/graphql-compiler-plugin-1.13.4-SNAPSHOT.jar" [[dependency]] -path = "../commons/build/libs/graphql-commons-1.13.3.jar" +path = "../commons/build/libs/graphql-commons-1.13.4-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index a86d4cc30..136b04045 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -10,7 +10,7 @@ distribution-version = "2201.9.0" [[package]] org = "ballerina" name = "auth" -version = "2.11.0" +version = "2.11.2" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "jballerina.java"}, @@ -47,7 +47,7 @@ dependencies = [ [[package]] org = "ballerina" name = "crypto" -version = "2.7.0" +version = "2.7.2" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -73,7 +73,7 @@ modules = [ [[package]] org = "ballerina" name = "graphql" -version = "1.13.3" +version = "1.13.4" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, @@ -106,7 +106,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.11.0" +version = "2.11.9" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, @@ -138,7 +138,7 @@ modules = [ [[package]] org = "ballerina" name = "io" -version = "1.6.0" +version = "1.6.3" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.value"} @@ -390,7 +390,7 @@ modules = [ [[package]] org = "ballerina" name = "websocket" -version = "2.11.0" +version = "2.11.2" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "constraint"}, From b5e55c808750446ac42d80020739317ce9555574 Mon Sep 17 00:00:00 2001 From: Thisaru Guruge Date: Mon, 10 Mar 2025 14:24:02 +0530 Subject: [PATCH 3/3] Move placeholder methods to native side --- ballerina/ping_message_job.bal | 23 ++++++++++--------- ballerina/place_holder.bal | 16 +++++-------- .../graphql/runtime/engine/Placeholder.java | 9 ++++++++ 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/ballerina/ping_message_job.bal b/ballerina/ping_message_job.bal index da785c757..22593d2ff 100644 --- a/ballerina/ping_message_job.bal +++ b/ballerina/ping_message_job.bal @@ -14,8 +14,8 @@ // specific language governing permissions and limitations // under the License. -import ballerina/websocket; import ballerina/task; +import ballerina/websocket; class PingMessageJob { *task:Job; @@ -49,18 +49,19 @@ class PingMessageJob { private isolated function sendPeriodicPingMessageRequests() { do { + task:JobId? id; lock { - task:JobId? id = self.id; - if id == () { - return; - } - if !self.caller.isOpen() { - check self.unschedule(); - return; - } - PingMessage message = {'type: WS_PING}; - check writeMessage(self.caller, message); + id = self.id; + } + if id == () { + return; + } + if !self.caller.isOpen() { + check self.unschedule(); + return; } + PingMessage message = {'type: WS_PING}; + check writeMessage(self.caller, message); } on fail error cause { string message = cause is websocket:Error ? "Failed to send ping message: " : "Failed to unschedule PingMessageJob: "; diff --git a/ballerina/place_holder.bal b/ballerina/place_holder.bal index 2fae8869c..1e1dd727a 100644 --- a/ballerina/place_holder.bal +++ b/ballerina/place_holder.bal @@ -24,17 +24,13 @@ isolated class Placeholder { self.setField('field); } - isolated function setValue(anydata value) { - lock { - self.value = value.clone(); - } - } + isolated function setValue(anydata value) = @java:Method { + 'class: "io.ballerina.stdlib.graphql.runtime.engine.Placeholder" + } external; - isolated function getValue() returns anydata { - lock { - return self.value.clone(); - } - } + isolated function getValue() returns anydata = @java:Method { + 'class: "io.ballerina.stdlib.graphql.runtime.engine.Placeholder" + } external; isolated function setField(Field 'field) = @java:Method { name: "setFieldValue", diff --git a/native/src/main/java/io/ballerina/stdlib/graphql/runtime/engine/Placeholder.java b/native/src/main/java/io/ballerina/stdlib/graphql/runtime/engine/Placeholder.java index 2cb6db734..fd21fe51d 100644 --- a/native/src/main/java/io/ballerina/stdlib/graphql/runtime/engine/Placeholder.java +++ b/native/src/main/java/io/ballerina/stdlib/graphql/runtime/engine/Placeholder.java @@ -26,11 +26,20 @@ * This class provides native implementations of the Ballerina Placeholder class. */ public class Placeholder { + private static final BString PLACE_HOLDER_VALUE_OBJECT = StringUtils.fromString("value"); private static final BString PLACE_HOLDER_FIELD_OBJECT = StringUtils.fromString("field"); private Placeholder() { } + public static void setValue(BObject placeholder, Object value) { + placeholder.set(PLACE_HOLDER_VALUE_OBJECT, value); + } + + public static Object getValue(BObject placeholder) { + return placeholder.get(PLACE_HOLDER_VALUE_OBJECT); + } + public static void setFieldValue(BObject placeholder, BObject field) { placeholder.set(PLACE_HOLDER_FIELD_OBJECT, field); }