mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 00:48:25 +00:00
parent
ad4f432c50
commit
7bf2c3ae36
3 changed files with 43 additions and 36 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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<Terms>;
|
||||
|
||||
constructor(
|
||||
BASIC_PLAN_TERMS?: Partial<Terms>,
|
||||
licenseData?: Partial<Terms>,
|
||||
updatedDate?: Date,
|
||||
startDate?: Date,
|
||||
expiryDate?: Date
|
||||
) {
|
||||
this.BASIC_PLAN_TERMS = BASIC_PLAN_TERMS;
|
||||
|
||||
constructor(licenseData?: Partial<Terms>, 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Terms> = {
|
||||
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<Terms> = {
|
|||
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,
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue