diff --git a/CHANGELOG.md b/CHANGELOG.md index cde904d4..c853b109 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +- 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/src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java b/src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java new file mode 100644 index 00000000..ad7e283e --- /dev/null +++ b/src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java @@ -0,0 +1,44 @@ +/* + * 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; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class ConfigFieldInfo { + @Nonnull + public String name; + @Nonnull + public String description; + public boolean isDifferentAcrossTenants; + @Nonnull + public String type; + @Nullable + public String[] options; + + public ConfigFieldInfo(@Nonnull String name, @Nonnull String description, boolean isDifferentAcrossTenants, @Nonnull String type) { + this(name, description, isDifferentAcrossTenants, type, null); + } + + 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; + 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 51e28f57..2ea5d28b 100644 --- a/src/main/java/io/supertokens/pluginInterface/Storage.java +++ b/src/main/java/io/supertokens/pluginInterface/Storage.java @@ -25,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 { @@ -89,6 +90,8 @@ boolean isUserIdBeingUsedInNonAuthRecipe(AppIdentifier appIdentifier, String cla Set getValidFieldsInConfig(); + ArrayList getConfigFieldsInfo(); + void setLogLevels(Set logLevels); String[] getAllTablesInTheDatabase() throws StorageQueryException;