diff --git a/server/src/modules/licensing/configs/License.ts b/server/src/modules/licensing/configs/License.ts index 49d29c260c..dc88b1faf9 100644 --- a/server/src/modules/licensing/configs/License.ts +++ b/server/src/modules/licensing/configs/License.ts @@ -1,10 +1,11 @@ import LicenseBase from './LicenseBase'; +import { BASIC_PLAN_TERMS } from '../constants/PlanTerms'; //ce TERMS export default class License extends LicenseBase { private static _instance: License; private constructor(key: string, updatedDate: Date) { - super(); + super(BASIC_PLAN_TERMS); } public static Instance(): License { diff --git a/server/src/modules/licensing/configs/LicenseBase.ts b/server/src/modules/licensing/configs/LicenseBase.ts index 5c62bedeaf..c55f35db48 100644 --- a/server/src/modules/licensing/configs/LicenseBase.ts +++ b/server/src/modules/licensing/configs/LicenseBase.ts @@ -1,7 +1,6 @@ import { LICENSE_LIMIT, LICENSE_TYPE } from '@modules/licensing/constants'; import { Terms } from '@modules/licensing/interfaces/terms'; import { - BASIC_PLAN_TERMS, BUSINESS_PLAN_TERMS, ENTERPRISE_PLAN_TERMS, WORKFLOW_TEAM_PLAN_TERMS, @@ -42,8 +41,17 @@ export default class LicenseBase { private _ai: object; private _isExternalApis: boolean; private _isAppWhiteLabelling: boolean; + private BASIC_PLAN_TERMS: Partial; + + constructor( + BASIC_PLAN_TERMS?: Partial, + licenseData?: Partial, + updatedDate?: Date, + startDate?: Date, + expiryDate?: Date + ) { + this.BASIC_PLAN_TERMS = BASIC_PLAN_TERMS; - constructor(licenseData?: Partial, updatedDate?: Date, startDate?: Date, expiryDate?: Date) { if (process.env.NODE_ENV === 'test') { const now = new Date(); now.setMinutes(now.getMinutes() + 30); @@ -126,21 +134,21 @@ export default class LicenseBase { public get apps(): number | string { if (this.IsBasicPlan) { - return BASIC_PLAN_TERMS.apps || this._appsCount || LICENSE_LIMIT.UNLIMITED; + return this.BASIC_PLAN_TERMS.apps || this._appsCount || LICENSE_LIMIT.UNLIMITED; } return this._appsCount || LICENSE_LIMIT.UNLIMITED; } public get tables(): number | string { if (this.IsBasicPlan) { - return BASIC_PLAN_TERMS.database?.table || this._tablesCount || LICENSE_LIMIT.UNLIMITED; + return this.BASIC_PLAN_TERMS.database?.table || this._tablesCount || LICENSE_LIMIT.UNLIMITED; } return this._tablesCount || LICENSE_LIMIT.UNLIMITED; } public get maxDurationForAuditLogs(): number | string { if (this.IsBasicPlan) { - return BASIC_PLAN_TERMS.auditLogs?.maximumDays || 0; + return this.BASIC_PLAN_TERMS.auditLogs?.maximumDays || 0; } const maxDuration = typeof this._maxDurationForAuditLogs === 'string' @@ -160,35 +168,35 @@ export default class LicenseBase { public get users(): number | string { if (this.IsBasicPlan) { - return BASIC_PLAN_TERMS.users?.total || this._usersCount || LICENSE_LIMIT.UNLIMITED; + return this.BASIC_PLAN_TERMS.users?.total || this._usersCount || LICENSE_LIMIT.UNLIMITED; } return this._usersCount || LICENSE_LIMIT.UNLIMITED; } public get editorUsers(): number | string { if (this.IsBasicPlan) { - return BASIC_PLAN_TERMS.users?.editor || this._editorUsersCount || LICENSE_LIMIT.UNLIMITED; + return this.BASIC_PLAN_TERMS.users?.editor || this._editorUsersCount || LICENSE_LIMIT.UNLIMITED; } return this._editorUsersCount || LICENSE_LIMIT.UNLIMITED; } public get viewerUsers(): number | string { if (this.IsBasicPlan) { - return BASIC_PLAN_TERMS.users?.viewer || this._viewerUsersCount || LICENSE_LIMIT.UNLIMITED; + return this.BASIC_PLAN_TERMS.users?.viewer || this._viewerUsersCount || LICENSE_LIMIT.UNLIMITED; } return this._viewerUsersCount || LICENSE_LIMIT.UNLIMITED; } public get superadminUsers(): number | string { if (this.IsBasicPlan) { - return BASIC_PLAN_TERMS.users?.superadmin || this._superadminUsersCount || LICENSE_LIMIT.UNLIMITED; + return this.BASIC_PLAN_TERMS.users?.superadmin || this._superadminUsersCount || LICENSE_LIMIT.UNLIMITED; } return this._superadminUsersCount || LICENSE_LIMIT.UNLIMITED; } public get workspaces(): number | string { if (this.IsBasicPlan) { - return BASIC_PLAN_TERMS.workspaces || this._workspacesCount || LICENSE_LIMIT.UNLIMITED; + return this.BASIC_PLAN_TERMS.workspaces || this._workspacesCount || LICENSE_LIMIT.UNLIMITED; } return this._workspacesCount || LICENSE_LIMIT.UNLIMITED; } @@ -199,98 +207,98 @@ export default class LicenseBase { public get domains(): Array<{ hostname?: string; subpath?: string }> { if (this.IsBasicPlan) { - return BASIC_PLAN_TERMS.domains || this._domainsList || []; + return this.BASIC_PLAN_TERMS.domains || this._domainsList || []; } return this._domainsList || []; } public get auditLogs(): boolean { if (this.IsBasicPlan) { - return !!BASIC_PLAN_TERMS.features?.auditLogs; + return !!this.BASIC_PLAN_TERMS.features?.auditLogs; } return this._isAuditLogs; } public get oidc(): boolean { if (this.IsBasicPlan) { - return !!BASIC_PLAN_TERMS.features?.oidc; + return !!this.BASIC_PLAN_TERMS.features?.oidc; } return this._isOidc; } public get ldap(): boolean { if (this.IsBasicPlan) { - return !!BASIC_PLAN_TERMS.features?.ldap; + return !!this.BASIC_PLAN_TERMS.features?.ldap; } return this._isLdap; } public get gitSync(): boolean { if (this.IsBasicPlan) { - return !!BASIC_PLAN_TERMS.features?.gitSync; + return !!this.BASIC_PLAN_TERMS.features?.gitSync; } return this._isGitSync; } public get saml(): boolean { if (this.IsBasicPlan) { - return !!BASIC_PLAN_TERMS.features?.saml; + return !!this.BASIC_PLAN_TERMS.features?.saml; } return this._isSAML; } public get multiEnvironment(): boolean { if (this.IsBasicPlan) { - return !!BASIC_PLAN_TERMS.features?.multiEnvironment; + return !!this.BASIC_PLAN_TERMS.features?.multiEnvironment; } return this._isMultiEnvironment; } public get customStyling(): boolean { if (this.IsBasicPlan) { - return !!BASIC_PLAN_TERMS.features?.customStyling; + return !!this.BASIC_PLAN_TERMS.features?.customStyling; } return this._isCustomStyling; } public get whiteLabelling(): boolean { if (this.IsBasicPlan) { - return !!BASIC_PLAN_TERMS.features?.whiteLabelling; + return !!this.BASIC_PLAN_TERMS.features?.whiteLabelling; } return this._isWhiteLabelling; } public get appWhiteLabelling(): boolean { if (this.IsBasicPlan) { - return !!BASIC_PLAN_TERMS.features?.appWhiteLabelling; + return !!this.BASIC_PLAN_TERMS.features?.appWhiteLabelling; } return this._isAppWhiteLabelling; } public get customThemes(): boolean { if (this.IsBasicPlan) { - return !!BASIC_PLAN_TERMS.features?.customThemes; + return !!this.BASIC_PLAN_TERMS.features?.customThemes; } return this._isCustomThemes; } public get externalApis(): boolean { if (this.IsBasicPlan) { - return !!BASIC_PLAN_TERMS.features?.externalApi; + return !!this.BASIC_PLAN_TERMS.features?.externalApi; } return this._isExternalApis; } public get multiPlayerEdit(): boolean { if (this.IsBasicPlan) { - return !!BASIC_PLAN_TERMS.features?.multiPlayerEdit; + return !!this.BASIC_PLAN_TERMS.features?.multiPlayerEdit; } return this._isMultiPlayerEdit; } public get comments(): boolean { if (this.IsBasicPlan) { - return !!BASIC_PLAN_TERMS.features?.comments; + return !!this.BASIC_PLAN_TERMS.features?.comments; } return this._isComments; } @@ -301,7 +309,7 @@ export default class LicenseBase { public get aiFeature(): boolean { if (this.IsBasicPlan) { - return !!BASIC_PLAN_TERMS.features?.ai; + return !!this.BASIC_PLAN_TERMS.features?.ai; } return this._isAi; } @@ -376,7 +384,7 @@ export default class LicenseBase { public get workflows(): object { if (this.IsBasicPlan || this.licenseType === LICENSE_TYPE.TRIAL) { - return BASIC_PLAN_TERMS.workflows; + return this.BASIC_PLAN_TERMS.workflows; } return this._workflows ?? WORKFLOW_TEAM_PLAN_TERMS.workflows; } diff --git a/server/src/modules/licensing/constants/PlanTerms.ts b/server/src/modules/licensing/constants/PlanTerms.ts index 02db97f21b..6cbbd18564 100644 --- a/server/src/modules/licensing/constants/PlanTerms.ts +++ b/server/src/modules/licensing/constants/PlanTerms.ts @@ -2,12 +2,12 @@ import { LICENSE_LIMIT, LICENSE_FIELD } from '@modules/licensing/constants'; import { Terms } from '@modules/licensing/interfaces/terms'; export const BASIC_PLAN_TERMS: Partial = { - apps: 2, - workspaces: 1, + apps: LICENSE_LIMIT.UNLIMITED, + workspaces: LICENSE_LIMIT.UNLIMITED, users: { - total: 52, - editor: 2, - viewer: 50, + total: LICENSE_LIMIT.UNLIMITED, + editor: LICENSE_LIMIT.UNLIMITED, + viewer: LICENSE_LIMIT.UNLIMITED, superadmin: 1, }, database: { @@ -25,19 +25,17 @@ export const BASIC_PLAN_TERMS: Partial = { gitSync: false, comments: false, customThemes: false, - ai: true, - externalApi: false, }, domains: [], workflows: { execution_timeout: 60, workspace: { - total: 2, + total: 200, daily_executions: 500, monthly_executions: 10000, }, instance: { - total: 2, + total: 1000, daily_executions: 25000, monthly_executions: 50000, },