From 24576e253eab478230765ac328febef83c737c10 Mon Sep 17 00:00:00 2001 From: Prateek Surana Date: Thu, 8 Feb 2024 11:26:45 +0530 Subject: [PATCH 1/7] Add a new method to fetch the config as json --- src/main/java/io/supertokens/pluginInterface/Storage.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/io/supertokens/pluginInterface/Storage.java b/src/main/java/io/supertokens/pluginInterface/Storage.java index 51e28f57..154a2475 100644 --- a/src/main/java/io/supertokens/pluginInterface/Storage.java +++ b/src/main/java/io/supertokens/pluginInterface/Storage.java @@ -17,6 +17,7 @@ package io.supertokens.pluginInterface; +import com.google.gson.JsonArray; import com.google.gson.JsonObject; import io.supertokens.pluginInterface.exceptions.DbInitException; import io.supertokens.pluginInterface.exceptions.InvalidConfigException; @@ -89,6 +90,8 @@ boolean isUserIdBeingUsedInNonAuthRecipe(AppIdentifier appIdentifier, String cla Set getValidFieldsInConfig(); + JsonArray getConfigFieldsJson(); + void setLogLevels(Set logLevels); String[] getAllTablesInTheDatabase() throws StorageQueryException; From b98d7ed6f78fca14c49b7259f53a1988c0b8990a Mon Sep 17 00:00:00 2001 From: Prateek Surana Date: Thu, 8 Feb 2024 12:04:55 +0530 Subject: [PATCH 2/7] Update changelog --- CHANGELOG.md | 4 ++++ build.gradle | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cde904d4..1e2a71f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [4.0.6] - 2024-02-08 + +- Add a new method `getConfigFieldsJson` to fetch the plugin config as json + ## [4.0.5] - 2023-12-05 - Adds `InvalidConfigException` to throws list of `canBeUsed` function diff --git a/build.gradle b/build.gradle index 085f09f5..51bef070 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java-library' } -version = "4.0.5" +version = "4.0.6" repositories { mavenCentral() From fe78106e315c4c8266e36fa62395e0f9ccf83048 Mon Sep 17 00:00:00 2001 From: Prateek Surana Date: Wed, 21 Feb 2024 17:42:20 +0530 Subject: [PATCH 3/7] Revert version changes --- CHANGELOG.md | 2 -- build.gradle | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e2a71f6..c853b109 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,6 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] -## [4.0.6] - 2024-02-08 - - Add a new method `getConfigFieldsJson` to fetch the plugin config as json ## [4.0.5] - 2023-12-05 diff --git a/build.gradle b/build.gradle index 51bef070..085f09f5 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java-library' } -version = "4.0.6" +version = "4.0.5" repositories { mavenCentral() From 3b75f545f8ec11c667d00c5f74c1c2445361bf3f Mon Sep 17 00:00:00 2001 From: Prateek Surana Date: Thu, 22 Feb 2024 15:55:06 +0530 Subject: [PATCH 4/7] Update getConfigFieldInfo method implementation --- .../pluginInterface/ConfigFieldInfo.java | 37 +++++++++++++++++++ .../supertokens/pluginInterface/Storage.java | 4 +- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java diff --git a/src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java b/src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java new file mode 100644 index 00000000..3d46cbdd --- /dev/null +++ b/src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * 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 io.supertokens.pluginInterface; + +public class ConfigFieldInfo { + public String name; + public String description; + public boolean isDifferentAcrossTenants; + public String type; + public String[] options; + + public ConfigFieldInfo(String name, String description, boolean isDifferentAcrossTenants, String type) { + this(name, description, isDifferentAcrossTenants, type, null); + } + + public ConfigFieldInfo(String name, String description, boolean isDifferentAcrossTenants, String type, String[] options) { + this.name = name; + this.description = description; + this.isDifferentAcrossTenants = isDifferentAcrossTenants; + this.type = type; + this.options = options; + } +} diff --git a/src/main/java/io/supertokens/pluginInterface/Storage.java b/src/main/java/io/supertokens/pluginInterface/Storage.java index 154a2475..2ea5d28b 100644 --- a/src/main/java/io/supertokens/pluginInterface/Storage.java +++ b/src/main/java/io/supertokens/pluginInterface/Storage.java @@ -17,7 +17,6 @@ package io.supertokens.pluginInterface; -import com.google.gson.JsonArray; import com.google.gson.JsonObject; import io.supertokens.pluginInterface.exceptions.DbInitException; import io.supertokens.pluginInterface.exceptions.InvalidConfigException; @@ -26,6 +25,7 @@ import io.supertokens.pluginInterface.multitenancy.TenantIdentifier; import io.supertokens.pluginInterface.multitenancy.exceptions.TenantOrAppNotFoundException; +import java.util.ArrayList; import java.util.Set; public interface Storage { @@ -90,7 +90,7 @@ boolean isUserIdBeingUsedInNonAuthRecipe(AppIdentifier appIdentifier, String cla Set getValidFieldsInConfig(); - JsonArray getConfigFieldsJson(); + ArrayList getConfigFieldsInfo(); void setLogLevels(Set logLevels); From 539c707585ae3bc0e587972d5447457e5a5996c6 Mon Sep 17 00:00:00 2001 From: Prateek Surana Date: Fri, 23 Feb 2024 16:59:30 +0530 Subject: [PATCH 5/7] Add non null to not null fields --- .../java/io/supertokens/pluginInterface/ConfigFieldInfo.java | 5 +++++ src/main/java/io/supertokens/pluginInterface/Storage.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java b/src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java index 3d46cbdd..28cb0a71 100644 --- a/src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java +++ b/src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java @@ -16,10 +16,15 @@ */ package io.supertokens.pluginInterface; +import javax.annotation.Nonnull; + public class ConfigFieldInfo { + @Nonnull public String name; + @Nonnull public String description; public boolean isDifferentAcrossTenants; + @Nonnull public String type; public String[] options; diff --git a/src/main/java/io/supertokens/pluginInterface/Storage.java b/src/main/java/io/supertokens/pluginInterface/Storage.java index 2ea5d28b..0b85bbe0 100644 --- a/src/main/java/io/supertokens/pluginInterface/Storage.java +++ b/src/main/java/io/supertokens/pluginInterface/Storage.java @@ -90,7 +90,7 @@ boolean isUserIdBeingUsedInNonAuthRecipe(AppIdentifier appIdentifier, String cla Set getValidFieldsInConfig(); - ArrayList getConfigFieldsInfo(); + ArrayList getConfigFieldsInfo() throws InvalidConfigException; void setLogLevels(Set logLevels); From 768c35342246e0b51c96d5df448fd6501932f4d6 Mon Sep 17 00:00:00 2001 From: Prateek Surana Date: Fri, 23 Feb 2024 17:25:22 +0530 Subject: [PATCH 6/7] Update getConfigFieldsInfo method signature in Storage interface --- src/main/java/io/supertokens/pluginInterface/Storage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/supertokens/pluginInterface/Storage.java b/src/main/java/io/supertokens/pluginInterface/Storage.java index 0b85bbe0..2ea5d28b 100644 --- a/src/main/java/io/supertokens/pluginInterface/Storage.java +++ b/src/main/java/io/supertokens/pluginInterface/Storage.java @@ -90,7 +90,7 @@ boolean isUserIdBeingUsedInNonAuthRecipe(AppIdentifier appIdentifier, String cla Set getValidFieldsInConfig(); - ArrayList getConfigFieldsInfo() throws InvalidConfigException; + ArrayList getConfigFieldsInfo(); void setLogLevels(Set logLevels); From c97d596bc1ef750a5a8c6ca314ee908e68acf7b0 Mon Sep 17 00:00:00 2001 From: Prateek Surana Date: Fri, 23 Feb 2024 17:56:59 +0530 Subject: [PATCH 7/7] Add @Nullable annotation to ConfigFieldInfo class --- .../io/supertokens/pluginInterface/ConfigFieldInfo.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java b/src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java index 28cb0a71..ad7e283e 100644 --- a/src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java +++ b/src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java @@ -17,6 +17,7 @@ package io.supertokens.pluginInterface; import javax.annotation.Nonnull; +import javax.annotation.Nullable; public class ConfigFieldInfo { @Nonnull @@ -26,13 +27,14 @@ public class ConfigFieldInfo { public boolean isDifferentAcrossTenants; @Nonnull public String type; + @Nullable public String[] options; - public ConfigFieldInfo(String name, String description, boolean isDifferentAcrossTenants, String type) { + public ConfigFieldInfo(@Nonnull String name, @Nonnull String description, boolean isDifferentAcrossTenants, @Nonnull String type) { this(name, description, isDifferentAcrossTenants, type, null); } - public ConfigFieldInfo(String name, String description, boolean isDifferentAcrossTenants, String type, String[] options) { + public ConfigFieldInfo(@Nonnull String name, @Nonnull String description, boolean isDifferentAcrossTenants, @Nonnull String type, @Nullable String[] options) { this.name = name; this.description = description; this.isDifferentAcrossTenants = isDifferentAcrossTenants;