Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add a new method to fetch the config as json #137

Merged
merged 7 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
sattvikc marked this conversation as resolved.
Show resolved Hide resolved

## [4.0.5] - 2023-12-05
sattvikc marked this conversation as resolved.
Show resolved Hide resolved

- Adds `InvalidConfigException` to throws list of `canBeUsed` function
Expand Down
44 changes: 44 additions & 0 deletions src/main/java/io/supertokens/pluginInterface/ConfigFieldInfo.java
Original file line number Diff line number Diff line change
@@ -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;
sattvikc marked this conversation as resolved.
Show resolved Hide resolved

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;
}
}
3 changes: 3 additions & 0 deletions src/main/java/io/supertokens/pluginInterface/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -89,6 +90,8 @@ boolean isUserIdBeingUsedInNonAuthRecipe(AppIdentifier appIdentifier, String cla

Set<String> getValidFieldsInConfig();

ArrayList<ConfigFieldInfo> getConfigFieldsInfo();

sattvikc marked this conversation as resolved.
Show resolved Hide resolved
void setLogLevels(Set<LOG_LEVEL> logLevels);

String[] getAllTablesInTheDatabase() throws StorageQueryException;
Expand Down
Loading