Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: update plan feature & unify feature matrix (#4432)
ecmadao03d5392e491f
diff --git a/backend/enterprise/config/config.go b/backend/enterprise/config/config.goindex 5e5c83f15b..4522c2878c 100644--- a/backend/enterprise/config/config.go+++ b/backend/enterprise/config/config.go@@ -24,8 +24,6 @@ type Config struct {Issuer string// Audience is the license audience, it should always be "bb.license".Audience string- // MinimumInstance is the minimum instance count in each plan.- MinimumInstance int}const (@@ -35,10 +33,12 @@ const (issuer = "bytebase"// audience is the license token audience.audience = "bb.license"- // minimumInstance is the minimum instance count in subscribed plan.- minimumInstance = 5- // SeatForFreePlan is the seat limit for the FREE plan.- SeatForFreePlan = 2+ // MaximumSeat is the maximum seat limit for the FREE and TEAM plan.+ MaximumSeat = 10+ // MaximumInstanceForFreePlan is the maximum instance limit for the FREE plan.+ MaximumInstanceForFreePlan = 5+ // MaximumInstanceForTeamPlan is the maximum instance limit for the TEAM plan.+ MaximumInstanceForTeamPlan = 10)// NewConfig will create a new enterprise config instance.@@ -49,10 +49,9 @@ func NewConfig(mode common.ReleaseMode) (*Config, error) {}return &Config{- PublicKey: string(licensePubKey),- Version: keyID,- Issuer: issuer,- Audience: audience,- MinimumInstance: minimumInstance,+ PublicKey: string(licensePubKey),+ Version: keyID,+ Issuer: issuer,+ Audience: audience,}, nil}diff --git a/backend/enterprise/service/license.go b/backend/enterprise/service/license.goindex 190d34f374..498cf2c75b 100644--- a/backend/enterprise/service/license.go+++ b/backend/enterprise/service/license.go@@ -83,10 +83,9 @@ func (s *LicenseService) LoadSubscription(ctx context.Context) enterpriseAPI.Subreturn enterpriseAPI.Subscription{Plan: api.FREE,// -1 means not expire, just for free plan- ExpiresTs: -1,- // -1 means no limit for instance count.- InstanceCount: -1,- Seat: config.SeatForFreePlan,+ ExpiresTs: -1,+ InstanceCount: config.MaximumInstanceForFreePlan,+ Seat: config.MaximumSeat,}}@@ -236,26 +235,31 @@ func (s *LicenseService) parseClaims(claims *Claims) (*enterpriseAPI.License, erreturn nil, common.Errorf(common.Invalid, "aud is not valid, expect %s but found '%v'", s.config.Audience, claims.Audience)}- instanceCount := claims.InstanceCount- if instanceCount < s.config.MinimumInstance {- return nil, common.Errorf(common.Invalid, "license instance count '%v' is not valid, minimum instance requirement is %d", instanceCount, s.config.MinimumInstance)- }-planType, err := convertPlanType(claims.Plan)if err != nil {return nil, common.Errorf(common.Invalid, "plan type %q is not valid", planType)}+ instanceCount := claims.InstanceCount+ seatCount := claims.Seat+ if planType == api.TEAM {+ if instanceCount > config.MaximumInstanceForTeamPlan {+ return nil, common.Errorf(common.Invalid, "license instance count '%v' is not valid, maximum instance is %d", instanceCount, config.MaximumInstanceForTeamPlan)+ }+ if seatCount > config.MaximumSeat {+ return nil, common.Errorf(common.Invalid, "license seat count '%v' is not valid, maximum seat is %d", seatCount, config.MaximumSeat)+ }+ }+license := &enterpriseAPI.License{InstanceCount: instanceCount,- // TODO(ed): validate the seat in claim.- Seat: claims.Seat,- ExpiresTs: claims.ExpiresAt.Unix(),- IssuedTs: claims.IssuedAt.Unix(),- Plan: planType,- Subject: claims.Subject,- Trialing: claims.Trialing,- OrgName: claims.OrgName,+ Seat: claims.Seat,+ ExpiresTs: claims.ExpiresAt.Unix(),+ IssuedTs: claims.IssuedAt.Unix(),+ Plan: planType,+ Subject: claims.Subject,+ Trialing: claims.Trialing,+ OrgName: claims.OrgName,}if err := license.Valid(); err != nil {diff --git a/backend/legacyapi/plan.go b/backend/legacyapi/plan.goindex 15d515f7e4..daac178db3 100644--- a/backend/legacyapi/plan.go+++ b/backend/legacyapi/plan.go@@ -214,7 +214,7 @@ func (e FeatureType) AccessErrorMessage() string {// minimumSupportedPlan will find the minimum plan which supports the target feature.func (e FeatureType) minimumSupportedPlan() PlanType {- for i, enabled := range featureMatrix[e] {+ for i, enabled := range FeatureMatrix[e] {if enabled {return PlanType(i)}@@ -223,12 +223,12 @@ func (e FeatureType) minimumSupportedPlan() PlanType {return ENTERPRISE}-// featureMatrix is a map from the a particular feature to the respective enablement of a particular+// FeatureMatrix is a map from the a particular feature to the respective enablement of a particular// plan in [FREE, TEAM, Enterprise].-var featureMatrix = map[FeatureType][3]bool{+var FeatureMatrix = map[FeatureType][3]bool{// Admin & SecurityFeature3rdPartyAuth: {false, true, true},- FeatureRBAC: {true, true, true},+ FeatureRBAC: {false, true, true},// BrandingFeatureBranding: {false, false, true},// Change Workflow@@ -239,7 +239,7 @@ var featureMatrix = map[FeatureType][3]bool{FeatureMultiTenancy: {false, false, true},FeatureOnlineMigration: {false, true, true},FeatureSchemaDrift: {false, false, true},- FeatureSQLReview: {true, true, true},+ FeatureSQLReview: {false, true, true},FeatureTaskScheduleTime: {false, true, true},// VCS IntegrationFeatureVCSSchemaWriteBack: {false, false, true},@@ -292,5 +292,5 @@ var PlanLimitValues = map[PlanLimit][3]int64{// Feature returns whether a particular feature is available in a particular plan.func Feature(feature FeatureType, plan PlanType) bool {- return featureMatrix[feature][plan]+ return FeatureMatrix[feature][plan]}diff --git a/backend/server/acl_casbin_policy_dba.csv b/backend/server/acl_casbin_policy_dba.csvindex de10c4fa21..ecc6fb97db 100644--- a/backend/server/acl_casbin_policy_dba.csv+++ b/backend/server/acl_casbin_policy_dba.csv@@ -101,6 +101,7 @@ p, DBA, /vcs/{vcsID}/external-repository, GETp, DBA, /setting, GETp, DBA, /label, GETp, DBA, /label/{labelID}, PATCH+p, DBA, /feature, GETp, DBA, /subscription, GETp, DBA, /subscription/trial, POSTp, DBA, /sheet, POSTdiff --git a/backend/server/acl_casbin_policy_developer.csv b/backend/server/acl_casbin_policy_developer.csvindex baf522931c..c68a727594 100644--- a/backend/server/acl_casbin_policy_developer.csv+++ b/backend/server/acl_casbin_policy_developer.csv@@ -85,6 +85,7 @@ p, DEVELOPER, /vcs/{vcsID}, GETp, DEVELOPER, /vcs/{vcsID}/external-repository, GETp, DEVELOPER, /setting, GETp, DEVELOPER, /label, GET+p, DEVELOPER, /feature, GETp, DEVELOPER, /subscription, GETp, DEVELOPER, /sheet, POSTp, DEVELOPER, /sheet/my, GETdiff --git a/backend/server/acl_casbin_policy_owner.csv b/backend/server/acl_casbin_policy_owner.csvindex 6a846fb675..0d0368d0cd 100644--- a/backend/server/acl_casbin_policy_owner.csv+++ b/backend/server/acl_casbin_policy_owner.csv@@ -109,6 +109,7 @@ p, OWNER, /setting, GETp, OWNER, /setting/{name}, PATCHp, OWNER, /label, GETp, OWNER, /label/{labelID}, PATCH+p, OWNER, /feature, GETp, OWNER, /subscription, GETp, OWNER, /subscription, PATCHp, OWNER, /subscription/trial, POSTdiff --git a/backend/server/plan.go b/backend/server/plan.gonew file mode 100644index 0000000000..ce2ffed1eb--- /dev/null+++ b/backend/server/plan.go@@ -0,0 +1,15 @@+package server++import (+ "net/http"++ "github.com/labstack/echo/v4"++ api "github.com/bytebase/bytebase/backend/legacyapi"+)++func (*Server) registerPlanRoutes(g *echo.Group) {+ g.GET("/feature", func(c echo.Context) error {+ return c.JSON(http.StatusOK, api.FeatureMatrix)+ })+}diff --git a/backend/server/server.go b/backend/server/server.goindex 1f9090a99b..8081240ae4 100644--- a/backend/server/server.go+++ b/backend/server/server.go@@ -422,6 +422,7 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {s.registerSQLRoutes(apiGroup)s.registerVCSRoutes(apiGroup)s.registerSubscriptionRoutes(apiGroup)+ s.registerPlanRoutes(apiGroup)s.registerSheetRoutes(apiGroup)s.registerSheetOrganizerRoutes(apiGroup)s.registerAnomalyRoutes(apiGroup)diff --git a/frontend/src/components/FeatureAttention.vue b/frontend/src/components/FeatureAttention.vueindex 30a15fc79a..22a32e950f 100644--- a/frontend/src/components/FeatureAttention.vue+++ b/frontend/src/components/FeatureAttention.vue@@ -11,13 +11,7 @@<script lang="ts" setup>import { PropType, computed } from "vue";-import {- FeatureType,- getMinimumRequiredPlan,- PlanType,- planTypeToString,- FEATURE_MATRIX,-} from "@/types";+import { FeatureType, PlanType, planTypeToString } from "@/types";import { useRouter } from "vue-router";import { useI18n } from "vue-i18n";import { useSubscriptionStore, pushNotification } from "@/store";@@ -61,16 +55,16 @@ const descriptionText = computed(() => {: t("subscription.trial-for-days", {days: subscriptionStore.trialingDays,});- if (!Array.isArray(FEATURE_MATRIX.get(props.feature))) {+ if (!Array.isArray(subscriptionStore.featureMatrix.get(props.feature))) {return `${props.description}\n${startTrial}`;}- const requiredPlan = getMinimumRequiredPlan(props.feature);+ const requiredPlan = subscriptionStore.getMinimumRequiredPlan(props.feature);const trialText = t("subscription.required-plan-with-trial", {requiredPlan: t(`subscription.plan.${planTypeToString(requiredPlan)}.title`),- startTrial,+ startTrial: startTrial.toLowerCase(),});return `${props.description}\n${trialText}`;diff --git a/frontend/src/components/FeatureModal.vue b/frontend/src/components/FeatureModal.vueindex 67c17cb464..e557d0f778 100644--- a/frontend/src/components/FeatureModal.vue+++ b/frontend/src/components/FeatureModal.vue@@ -112,13 +112,7 @@ import { PropType } from "vue";import { useRouter } from "vue-router";import { useI18n } from "vue-i18n";import { useSubscriptionStore, pushNotification } from "@/store";-import {- FeatureType,- getMinimumRequiredPlan,- PlanType,- planTypeToString,- FEATURE_MATRIX,-} from "@/types";+import { FeatureType, PlanType, planTypeToString } from "@/types";const props = defineProps({feature: {@@ -137,8 +131,10 @@ const ok = () => {const subscriptionStore = useSubscriptionStore();-const isRequiredInPlan = Array.isArray(FEATURE_MATRIX.get(props.feature));-const requiredPlan = getMinimumRequiredPlan(props.feature);+const isRequiredInPlan = Array.isArray(+ subscriptionStore.featureMatrix.get(props.feature)+);+const requiredPlan = subscriptionStore.getMinimumRequiredPlan(props.feature);const featureKey = props.feature.split(".").join("-");diff --git a/frontend/src/components/RepositoryForm.vue b/frontend/src/components/RepositoryForm.vueindex 62a100da59..c7bf0a49f2 100644--- a/frontend/src/components/RepositoryForm.vue+++ b/frontend/src/components/RepositoryForm.vue@@ -301,14 +301,13 @@ import { reactive, PropType, defineComponent, computed } from "vue";import { useI18n } from "vue-i18n";import {ExternalRepositoryInfo,- getRquiredPlanString,Project,RepositoryConfig,SchemaChangeType,VCSType,} from "@/types";import BBBetaBadge from "@/bbkit/BBBetaBadge.vue";-import { hasFeature } from "@/store";+import { hasFeature, useSubscriptionStore } from "@/store";const FILE_REQUIRED_PLACEHOLDER = "{{DB_NAME}}, {{VERSION}}, {{TYPE}}";const SCHEMA_REQUIRED_PLACEHOLDER = "{{DB_NAME}}";@@ -366,6 +365,8 @@ export default defineComponent({showFeatureModal: false,});+ const subscriptionStore = useSubscriptionStore();+const isTenantProject = computed(() => {return props.project.tenantMode === "TENANT";});@@ -471,7 +472,7 @@ export default defineComponent({schemaOptionalTagPlaceholder,state,hasFeature,- getRquiredPlanString,+ getRquiredPlanString: subscriptionStore.getRquiredPlanString,isProjectSchemaChangeTypeDDL,enableSQLReviewTitle,sampleFilePath,diff --git a/frontend/src/locales/subscription/en-US.json b/frontend/src/locales/subscription/en-US.jsonindex 1ec06ee6d3..f9a214bd39 100644--- a/frontend/src/locales/subscription/en-US.json+++ b/frontend/src/locales/subscription/en-US.json@@ -16,8 +16,8 @@"billed-annually": "Billed annually","billed-monthly": "Billed monthly","per-instance": "Per instance",- "free-price-intro": "Up to 2 seats",- "team-price-intro": "Per seat, billed monthly",+ "free-price-intro": "Up to 10 seats",+ "team-price-intro": "Per seat & Per instance, billed monthly","enterprise-price-intro": "Customized, billed annually","deploy": "Deploy","contact-us": "Contact us",@@ -54,6 +54,8 @@"features": {"instance-count": "Instance count","instance-customized": "Customized",+ "instance-maximum-5": "Up to 5",+ "instance-maximum-10": "Up to 10","instance-unlimited": "Unlimited","environment-count": "Environment count","environment-unlimited": "Unlimited",@@ -93,7 +95,6 @@"title": "Collaboration","features": {"seat-count": "Seat count",- "seat-maximum-2": "Up to 2","seat-maximum-10": "Up to 10","seat-customized": "Customized","ui-based-sql-review": "UI based SQL review",diff --git a/frontend/src/locales/subscription/zh-CN.json b/frontend/src/locales/subscription/zh-CN.jsonindex 7b2b9fbc98..8253b7467a 100644--- a/frontend/src/locales/subscription/zh-CN.json+++ b/frontend/src/locales/subscription/zh-CN.json@@ -54,6 +54,8 @@"features": {"instance-count": "实例数","instance-customized": "自定义",+ "instance-maximum-5": "不超过 5 个",+ "instance-maximum-10": "不超过 10 个","instance-unlimited": "无限制","environment-count": "环境数","environment-unlimited": "无限制",@@ -93,7 +95,6 @@"title": "团队协作","features": {"seat-count": "席位",- "seat-maximum-2": "不超过 2 个","seat-maximum-10": "不超过 10 个","seat-customized": "自定义","ui-based-sql-review": "基于 UI 的 SQL 审查",diff --git a/frontend/src/main.ts b/frontend/src/main.tsindex bd4ace3d39..9b1284727a 100644--- a/frontend/src/main.ts+++ b/frontend/src/main.ts@@ -149,11 +149,20 @@ const initSubscription = () => {const subscriptionStore = useSubscriptionStore();return subscriptionStore.fetchSubscription();};+const initFeatureMatrix = () => {+ const subscriptionStore = useSubscriptionStore();+ return subscriptionStore.fetchFeatureMatrix();+};const restoreUser = () => {const authStore = useAuthStore();return authStore.restoreUser();};-Promise.all([initActuator(), initSubscription(), restoreUser()]).finally(() => {+Promise.all([+ initActuator(),+ initFeatureMatrix(),+ initSubscription(),+ restoreUser(),+]).finally(() => {// Install router after the necessary data fetching is complete.app.use(router).use(highlight).use(i18n).use(NaiveUI);app.mount("#app");diff --git a/frontend/src/store/modules/subscription.ts b/frontend/src/store/modules/subscription.tsindex dd6f3edc4d..0ccc60b3a1 100644--- a/frontend/src/store/modules/subscription.ts+++ b/frontend/src/store/modules/subscription.ts@@ -2,29 +2,31 @@ import { defineStore } from "pinia";import axios from "axios";import dayjs from "dayjs";import { computed, Ref } from "vue";+import { useI18n } from "vue-i18n";import {Subscription,FeatureType,PlanType,- FEATURE_MATRIX,SubscriptionState,+ planTypeToString,} from "@/types";export const useSubscriptionStore = defineStore("subscription", {state: (): SubscriptionState => ({+ featureMatrix: new Map<FeatureType, boolean[]>(),subscription: undefined,trialingDays: 14,}),getters: {seatCount(state): number {- const count = state.subscription?.seat ?? 2;+ const count = state.subscription?.seat ?? 0;if (count <= 0) {return Number.MAX_VALUE;}return count;},instanceCount(state): number {- const count = state.subscription?.instanceCount ?? 5;+ const count = state.subscription?.instanceCount ?? 0;if (count <= 0) {return Number.MAX_VALUE;}@@ -91,7 +93,34 @@ export const useSubscriptionStore = defineStore("subscription", {},actions: {hasFeature(type: FeatureType) {- return !this.isExpired && FEATURE_MATRIX.get(type)![this.currentPlan];+ const matrix = this.featureMatrix.get(type);+ if (!Array.isArray(matrix)) {+ return false;+ }++ return !this.isExpired && matrix[this.currentPlan];+ },+ getMinimumRequiredPlan(type: FeatureType): PlanType {+ const matrix = this.featureMatrix.get(type);+ if (!Array.isArray(matrix)) {+ return PlanType.FREE;+ }++ for (let i = 0; i < matrix.length; i++) {+ if (matrix[i]) {+ return i as PlanType;+ }+ }+ return PlanType.FREE;+ },+ getRquiredPlanString(type: FeatureType): string {+ const { t } = useI18n();+ const plan = t(+ `subscription.plan.${planTypeToString(+ this.getMinimumRequiredPlan(type)+ )}.title`+ );+ return t("subscription.require-subscription", { requiredPlan: plan });},setSubscription(subscription: Subscription) {this.subscription = subscription;@@ -106,6 +135,18 @@ export const useSubscriptionStore = defineStore("subscription", {console.error(e);}},+ async fetchFeatureMatrix() {+ try {+ const { data } = await axios.get<{+ [key: string]: boolean[];+ }>(`/api/feature`);+ for (const [key, value] of Object.entries(data)) {+ this.featureMatrix.set(key as FeatureType, value);+ }+ } catch (e) {+ console.error(e);+ }+ },async patchSubscription(license: string) {const data = (await axios.patch(`/api/subscription`, {diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.tsindex d7b632decf..200acf0af7 100644--- a/frontend/src/types/plan.ts+++ b/frontend/src/types/plan.ts@@ -73,47 +73,6 @@ export interface Plan {featureList: PlanFeature[];}-// A map from a particular feature to the respective enablement of a particular plan.-// The key is the feature type and the value is the [FREE, TEAM, ENTERPRISE] triplet.-// Make sure this is consistent with the matrix in plan.go-//-// TODO: fetch the matrix from the backend instead of duplicating it here or use a JSON/YAML file-// so that it can be shared between frontend/backend.-export const FEATURE_MATRIX: Map<FeatureType, boolean[]> = new Map([- // Admin & Security- ["bb.feature.3rd-party-auth", [false, true, true]],- ["bb.feature.rbac", [true, true, true]],- // Branding- ["bb.feature.branding", [false, false, true]],- // Change Workflow- ["bb.feature.data-source", [false, false, false]],- ["bb.feature.dba-workflow", [false, false, true]],- ["bb.feature.lgtm", [false, false, true]],- ["bb.feature.im.approval", [false, false, true]],- ["bb.feature.multi-tenancy", [false, false, true]],- ["bb.feature.online-migration", [false, true, true]],- ["bb.feature.schema-drift", [false, false, true]],- ["bb.feature.sql-review", [true, true, true]],- ["bb.feature.task-schedule-time", [false, true, true]],- // VCS Integration- ["bb.feature.vcs-schema-write-back", [false, false, true]],- ["bb.feature.vcs-sheet-sync", [false, false, true]],- ["bb.feature.vcs-sql-review", [false, false, true]],- // Database management- ["bb.feature.pitr", [false, true, true]],- ["bb.feature.read-replica-connection", [false, false, true]],- // This feature type is specifically means that all schema versions can be selected.- // Sync schema is free to all plans. But in non-enterprise plan, we only show the- // latest schema version and it's not selectable.- ["bb.feature.sync-schema-all-versions", [false, false, true]],- // Policy Control- ["bb.feature.approval-policy", [false, true, true]],- ["bb.feature.backup-policy", [false, true, true]],- ["bb.feature.environment-tier-policy", [false, false, true]],- ["bb.feature.sensitive-data", [false, false, true]],- ["bb.feature.access-control", [false, false, true]],-]);-export const FEATURE_SECTIONS: { type: string; featureList: string[] }[] =planData.categoryList;@@ -144,25 +103,3 @@ export const getFeatureLocalization = (feature: PlanFeature): PlanFeature => {return feature;};--export const getMinimumRequiredPlan = (type: FeatureType): PlanType => {- const matrix = FEATURE_MATRIX.get(type);- if (!Array.isArray(matrix)) {- return PlanType.FREE;- }-- for (let i = 0; i < matrix.length; i++) {- if (matrix[i]) {- return i as PlanType;- }- }- return PlanType.FREE;-};--export const getRquiredPlanString = (type: FeatureType): string => {- const { t } = useI18n();- const plan = t(- `subscription.plan.${planTypeToString(getMinimumRequiredPlan(type))}.title`- );- return t("subscription.require-subscription", { requiredPlan: plan });-};diff --git a/frontend/src/types/plan.yaml b/frontend/src/types/plan.yamlindex e8e66ef6fc..283426b84c 100644--- a/frontend/src/types/plan.yaml+++ b/frontend/src/types/plan.yaml@@ -44,13 +44,13 @@ planList:trialDays: 0unitPrice: 0trialPrice: 0- freeInstanceCount: -1- freeSeatCount: 2- maximumSeatCount: 2+ freeInstanceCount: 5+ maximumInstanceCount: 5+ maximumSeatCount: 10pricePerSeatPerMonth: 0featureList:- type: instance-count- content: instance-unlimited+ content: instance-maximum-5- type: environment-countcontent: environment-unlimited- type: task-count-in-issue@@ -66,13 +66,13 @@ planList:tooltip: disaster-recovery-basic-tooltip- type: archiving- type: sql-check- content: sql-check-advanced- tooltip: sql-check-advanced-tooltip+ content: sql-check-basic+ tooltip: sql-check-basic-tooltip- type: anomaly-detectioncontent: anomaly-detection-basictooltip: anomaly-detection-basic-tooltip- type: seat-count- content: seat-maximum-2+ content: seat-maximum-10- type: ui-based-sql-review- type: vsc-workflowcontent: vsc-workflow-basic@@ -95,13 +95,13 @@ planList:trialDays: 14unitPrice: 29trialPrice: 0- freeInstanceCount: -1- freeSeatCount: 1+ freeInstanceCount: 5+ maximumInstanceCount: 10maximumSeatCount: 10pricePerSeatPerMonth: 29featureList:- type: instance-count- content: instance-unlimited+ content: instance-maximum-10- type: environment-countcontent: environment-unlimited- type: task-count-in-issue@@ -153,8 +153,8 @@ planList:trialDays: 0unitPrice: 90trialPrice: 0- freeInstanceCount: -1- freeSeatCount: 1+ freeInstanceCount: 5+ maximumInstanceCount: -1maximumSeatCount: -1pricePerSeatPerMonth: 90featureList:diff --git a/frontend/src/types/sqlReview.ts b/frontend/src/types/sqlReview.tsindex e9ac52e4e7..e47a7bdff9 100644--- a/frontend/src/types/sqlReview.ts+++ b/frontend/src/types/sqlReview.ts@@ -650,11 +650,17 @@ export const getRuleLocalization = (};};-// We decide to make the SQL review policy free to use for all plans in issue BYT-2321.-// Return true to ignore the feature guard for SQL review rules.+const availableRulesForFreePlan: RuleType[] = [+ "statement.where.require",+ "column.no-null",+];+export const ruleIsAvailableInSubscription = (ruleType: RuleType,subscriptionPlan: PlanType): boolean => {+ if (subscriptionPlan === PlanType.FREE) {+ return availableRulesForFreePlan.indexOf(ruleType) >= 0;+ }return true;};diff --git a/frontend/src/types/subscription.ts b/frontend/src/types/subscription.tsindex 483f44f6c5..aaa130466c 100644--- a/frontend/src/types/subscription.ts+++ b/frontend/src/types/subscription.ts@@ -1,4 +1,4 @@-import { PlanType } from "./plan";+import { PlanType, FeatureType } from "./plan";export interface Subscription {instanceCount: number;@@ -10,6 +10,7 @@ export interface Subscription {}export interface SubscriptionState {+ featureMatrix: Map<FeatureType, boolean[]>;subscription: Subscription | undefined;trialingDays: number;}