@mui/x-license
Advanced tools
Comparing version 7.16.0 to 7.17.0
@@ -1,12 +0,18 @@ | ||
import { LicenseScope, PlanVersion } from '../utils/licenseScope'; | ||
import { LicensingModel } from '../utils/licensingModel'; | ||
import { PlanScope, PlanVersion } from '../utils/plan'; | ||
import { LicenseModel } from '../utils/licenseModel'; | ||
export interface LicenseDetails { | ||
orderNumber: string; | ||
expiryDate: Date; | ||
scope?: LicenseScope; | ||
planScope?: LicenseScope; | ||
licenseModel?: LicensingModel; | ||
licensingModel?: LicensingModel; | ||
/** | ||
* @deprecated Use planScope instead. | ||
*/ | ||
scope?: PlanScope; | ||
planScope?: PlanScope; | ||
/** | ||
* @deprecated Use licenseModel instead. | ||
*/ | ||
licensingModel?: LicenseModel; | ||
licenseModel?: LicenseModel; | ||
planVersion: PlanVersion; | ||
} | ||
export declare function generateLicense(details: LicenseDetails): string; |
import { md5 } from "../encoding/md5.js"; | ||
import { base64Encode } from "../encoding/base64.js"; | ||
import { LICENSE_SCOPES } from "../utils/licenseScope.js"; | ||
import { LICENSING_MODELS } from "../utils/licensingModel.js"; | ||
import { PLAN_SCOPES } from "../utils/plan.js"; | ||
import { LICENSE_MODELS } from "../utils/licenseModel.js"; | ||
const licenseVersion = '2'; | ||
@@ -15,6 +15,6 @@ function getClearLicenseString(details) { | ||
} | ||
if (details.planScope && !LICENSE_SCOPES.includes(details.planScope)) { | ||
if (details.planScope && !PLAN_SCOPES.includes(details.planScope)) { | ||
throw new Error('MUI X: Invalid scope'); | ||
} | ||
if (details.licenseModel && !LICENSING_MODELS.includes(details.licenseModel)) { | ||
if (details.licenseModel && !LICENSE_MODELS.includes(details.licenseModel)) { | ||
throw new Error('MUI X: Invalid licensing model'); | ||
@@ -21,0 +21,0 @@ } |
/** | ||
* @mui/x-license v7.16.0 | ||
* @mui/x-license v7.17.0 | ||
* | ||
@@ -4,0 +4,0 @@ * @license MUI X Commercial |
import { md5 } from "../encoding/md5.js"; | ||
import { base64Encode } from "../encoding/base64.js"; | ||
import { LICENSE_SCOPES } from "../utils/licenseScope.js"; | ||
import { LICENSING_MODELS } from "../utils/licensingModel.js"; | ||
import { PLAN_SCOPES } from "../utils/plan.js"; | ||
import { LICENSE_MODELS } from "../utils/licenseModel.js"; | ||
const licenseVersion = '2'; | ||
@@ -15,6 +15,6 @@ function getClearLicenseString(details) { | ||
} | ||
if (details.planScope && !LICENSE_SCOPES.includes(details.planScope)) { | ||
if (details.planScope && !PLAN_SCOPES.includes(details.planScope)) { | ||
throw new Error('MUI X: Invalid scope'); | ||
} | ||
if (details.licenseModel && !LICENSING_MODELS.includes(details.licenseModel)) { | ||
if (details.licenseModel && !LICENSE_MODELS.includes(details.licenseModel)) { | ||
throw new Error('MUI X: Invalid licensing model'); | ||
@@ -21,0 +21,0 @@ } |
/** | ||
* @mui/x-license v7.16.0 | ||
* @mui/x-license v7.17.0 | ||
* | ||
@@ -4,0 +4,0 @@ * @license MUI X Commercial |
import { base64Decode, base64Encode } from "../encoding/base64.js"; | ||
import { md5 } from "../encoding/md5.js"; | ||
import { LICENSE_STATUS } from "../utils/licenseStatus.js"; | ||
import { LICENSE_SCOPES } from "../utils/licenseScope.js"; | ||
import { LICENSING_MODELS } from "../utils/licensingModel.js"; | ||
import { PLAN_SCOPES } from "../utils/plan.js"; | ||
import { LICENSE_MODELS } from "../utils/licenseModel.js"; | ||
const getDefaultReleaseDate = () => { | ||
@@ -14,3 +14,3 @@ const today = new Date(); | ||
} | ||
function isLicenseScopeSufficient(packageName, licenseScope) { | ||
function isPlanScopeSufficient(packageName, planScope) { | ||
let acceptedScopes; | ||
@@ -24,3 +24,3 @@ if (packageName.includes('-pro')) { | ||
} | ||
return acceptedScopes.includes(licenseScope); | ||
return acceptedScopes.includes(planScope); | ||
} | ||
@@ -44,4 +44,4 @@ const expiryReg = /^.*EXPIRY=([0-9]+),.*$/; | ||
return { | ||
scope: 'pro', | ||
licensingModel: 'perpetual', | ||
planScope: 'pro', | ||
licenseModel: 'perpetual', | ||
expiryTimestamp, | ||
@@ -53,8 +53,8 @@ planVersion: 'initial' | ||
/** | ||
* Format: O=${orderNumber},E=${expiryTimestamp},S=${scope},LM=${licensingModel},PV=${planVersion},KV=2`; | ||
* Format: O=${orderNumber},E=${expiryTimestamp},S=${planScope},LM=${licenseModel},PV=${planVersion},KV=2`; | ||
*/ | ||
const decodeLicenseVersion2 = license => { | ||
const licenseInfo = { | ||
scope: null, | ||
licensingModel: null, | ||
planScope: null, | ||
licenseModel: null, | ||
expiryTimestamp: null, | ||
@@ -65,6 +65,6 @@ planVersion: 'initial' | ||
if (key === 'S') { | ||
licenseInfo.scope = value; | ||
licenseInfo.planScope = value; | ||
} | ||
if (key === 'LM') { | ||
licenseInfo.licensingModel = value; | ||
licenseInfo.licenseModel = value; | ||
} | ||
@@ -124,3 +124,3 @@ if (key === 'E') { | ||
} | ||
if (license.licensingModel == null || !LICENSING_MODELS.includes(license.licensingModel)) { | ||
if (license.licenseModel == null || !LICENSE_MODELS.includes(license.licenseModel)) { | ||
console.error('MUI X: Error checking license. Licensing model not found or invalid!'); | ||
@@ -137,3 +137,3 @@ return { | ||
} | ||
if (license.licensingModel === 'perpetual' || process.env.NODE_ENV === 'production') { | ||
if (license.licenseModel === 'perpetual' || process.env.NODE_ENV === 'production') { | ||
const pkgTimestamp = parseInt(base64Decode(releaseInfo), 10); | ||
@@ -148,3 +148,3 @@ if (Number.isNaN(pkgTimestamp)) { | ||
} | ||
} else if (license.licensingModel === 'subscription' || license.licensingModel === 'annual') { | ||
} else if (license.licenseModel === 'subscription' || license.licenseModel === 'annual') { | ||
if (new Date().getTime() > license.expiryTimestamp) { | ||
@@ -171,4 +171,4 @@ if ( | ||
} | ||
if (license.scope == null || !LICENSE_SCOPES.includes(license.scope)) { | ||
console.error('MUI X: Error checking license. scope not found or invalid!'); | ||
if (license.planScope == null || !PLAN_SCOPES.includes(license.planScope)) { | ||
console.error('MUI X: Error checking license. planScope not found or invalid!'); | ||
return { | ||
@@ -178,3 +178,3 @@ status: LICENSE_STATUS.Invalid | ||
} | ||
if (!isLicenseScopeSufficient(packageName, license.scope)) { | ||
if (!isPlanScopeSufficient(packageName, license.planScope)) { | ||
return { | ||
@@ -186,3 +186,3 @@ status: LICENSE_STATUS.OutOfScope | ||
// 'charts-pro' or 'tree-view-pro' can only be used with a newer Pro license | ||
if (license.planVersion === 'initial' && license.scope === 'pro' && !PRO_PACKAGES_AVAILABLE_IN_INITIAL_PRO_PLAN.includes(packageName)) { | ||
if (license.planVersion === 'initial' && license.planScope === 'pro' && !PRO_PACKAGES_AVAILABLE_IN_INITIAL_PRO_PLAN.includes(packageName)) { | ||
return { | ||
@@ -189,0 +189,0 @@ status: LICENSE_STATUS.NotAvailableInInitialProPlan |
@@ -9,4 +9,4 @@ "use strict"; | ||
var _base = require("../encoding/base64"); | ||
var _licenseScope = require("../utils/licenseScope"); | ||
var _licensingModel = require("../utils/licensingModel"); | ||
var _plan = require("../utils/plan"); | ||
var _licenseModel = require("../utils/licenseModel"); | ||
const licenseVersion = '2'; | ||
@@ -22,6 +22,6 @@ function getClearLicenseString(details) { | ||
} | ||
if (details.planScope && !_licenseScope.LICENSE_SCOPES.includes(details.planScope)) { | ||
if (details.planScope && !_plan.PLAN_SCOPES.includes(details.planScope)) { | ||
throw new Error('MUI X: Invalid scope'); | ||
} | ||
if (details.licenseModel && !_licensingModel.LICENSING_MODELS.includes(details.licenseModel)) { | ||
if (details.licenseModel && !_licenseModel.LICENSE_MODELS.includes(details.licenseModel)) { | ||
throw new Error('MUI X: Invalid licensing model'); | ||
@@ -28,0 +28,0 @@ } |
/** | ||
* @mui/x-license v7.16.0 | ||
* @mui/x-license v7.17.0 | ||
* | ||
@@ -4,0 +4,0 @@ * @license MUI X Commercial |
@@ -11,4 +11,4 @@ "use strict"; | ||
var _licenseStatus = require("../utils/licenseStatus"); | ||
var _licenseScope = require("../utils/licenseScope"); | ||
var _licensingModel = require("../utils/licensingModel"); | ||
var _plan = require("../utils/plan"); | ||
var _licenseModel = require("../utils/licenseModel"); | ||
const getDefaultReleaseDate = () => { | ||
@@ -22,3 +22,3 @@ const today = new Date(); | ||
} | ||
function isLicenseScopeSufficient(packageName, licenseScope) { | ||
function isPlanScopeSufficient(packageName, planScope) { | ||
let acceptedScopes; | ||
@@ -32,3 +32,3 @@ if (packageName.includes('-pro')) { | ||
} | ||
return acceptedScopes.includes(licenseScope); | ||
return acceptedScopes.includes(planScope); | ||
} | ||
@@ -52,4 +52,4 @@ const expiryReg = /^.*EXPIRY=([0-9]+),.*$/; | ||
return { | ||
scope: 'pro', | ||
licensingModel: 'perpetual', | ||
planScope: 'pro', | ||
licenseModel: 'perpetual', | ||
expiryTimestamp, | ||
@@ -61,8 +61,8 @@ planVersion: 'initial' | ||
/** | ||
* Format: O=${orderNumber},E=${expiryTimestamp},S=${scope},LM=${licensingModel},PV=${planVersion},KV=2`; | ||
* Format: O=${orderNumber},E=${expiryTimestamp},S=${planScope},LM=${licenseModel},PV=${planVersion},KV=2`; | ||
*/ | ||
const decodeLicenseVersion2 = license => { | ||
const licenseInfo = { | ||
scope: null, | ||
licensingModel: null, | ||
planScope: null, | ||
licenseModel: null, | ||
expiryTimestamp: null, | ||
@@ -73,6 +73,6 @@ planVersion: 'initial' | ||
if (key === 'S') { | ||
licenseInfo.scope = value; | ||
licenseInfo.planScope = value; | ||
} | ||
if (key === 'LM') { | ||
licenseInfo.licensingModel = value; | ||
licenseInfo.licenseModel = value; | ||
} | ||
@@ -132,3 +132,3 @@ if (key === 'E') { | ||
} | ||
if (license.licensingModel == null || !_licensingModel.LICENSING_MODELS.includes(license.licensingModel)) { | ||
if (license.licenseModel == null || !_licenseModel.LICENSE_MODELS.includes(license.licenseModel)) { | ||
console.error('MUI X: Error checking license. Licensing model not found or invalid!'); | ||
@@ -145,3 +145,3 @@ return { | ||
} | ||
if (license.licensingModel === 'perpetual' || process.env.NODE_ENV === 'production') { | ||
if (license.licenseModel === 'perpetual' || process.env.NODE_ENV === 'production') { | ||
const pkgTimestamp = parseInt((0, _base.base64Decode)(releaseInfo), 10); | ||
@@ -156,3 +156,3 @@ if (Number.isNaN(pkgTimestamp)) { | ||
} | ||
} else if (license.licensingModel === 'subscription' || license.licensingModel === 'annual') { | ||
} else if (license.licenseModel === 'subscription' || license.licenseModel === 'annual') { | ||
if (new Date().getTime() > license.expiryTimestamp) { | ||
@@ -179,4 +179,4 @@ if ( | ||
} | ||
if (license.scope == null || !_licenseScope.LICENSE_SCOPES.includes(license.scope)) { | ||
console.error('MUI X: Error checking license. scope not found or invalid!'); | ||
if (license.planScope == null || !_plan.PLAN_SCOPES.includes(license.planScope)) { | ||
console.error('MUI X: Error checking license. planScope not found or invalid!'); | ||
return { | ||
@@ -186,3 +186,3 @@ status: _licenseStatus.LICENSE_STATUS.Invalid | ||
} | ||
if (!isLicenseScopeSufficient(packageName, license.scope)) { | ||
if (!isPlanScopeSufficient(packageName, license.planScope)) { | ||
return { | ||
@@ -194,3 +194,3 @@ status: _licenseStatus.LICENSE_STATUS.OutOfScope | ||
// 'charts-pro' or 'tree-view-pro' can only be used with a newer Pro license | ||
if (license.planVersion === 'initial' && license.scope === 'pro' && !PRO_PACKAGES_AVAILABLE_IN_INITIAL_PRO_PLAN.includes(packageName)) { | ||
if (license.planVersion === 'initial' && license.planScope === 'pro' && !PRO_PACKAGES_AVAILABLE_IN_INITIAL_PRO_PLAN.includes(packageName)) { | ||
return { | ||
@@ -197,0 +197,0 @@ status: _licenseStatus.LICENSE_STATUS.NotAvailableInInitialProPlan |
{ | ||
"name": "@mui/x-license", | ||
"version": "7.16.0", | ||
"version": "7.17.0", | ||
"description": "MUI X License verification", | ||
@@ -5,0 +5,0 @@ "author": "MUI Team", |
export * from './licenseErrorMessageUtils'; | ||
export * from './licenseInfo'; | ||
export * from './licenseStatus'; | ||
export type { LicenseScope } from './licenseScope'; | ||
export type { LicensingModel } from './licensingModel'; | ||
export type { PlanScope } from './plan'; | ||
export type { LicenseModel } from './licenseModel'; | ||
export type { MuiCommercialPackageName } from './commercialPackages'; |
import { base64Decode, base64Encode } from "../encoding/base64.js"; | ||
import { md5 } from "../encoding/md5.js"; | ||
import { LICENSE_STATUS } from "../utils/licenseStatus.js"; | ||
import { LICENSE_SCOPES } from "../utils/licenseScope.js"; | ||
import { LICENSING_MODELS } from "../utils/licensingModel.js"; | ||
import { PLAN_SCOPES } from "../utils/plan.js"; | ||
import { LICENSE_MODELS } from "../utils/licenseModel.js"; | ||
const getDefaultReleaseDate = () => { | ||
@@ -14,3 +14,3 @@ const today = new Date(); | ||
} | ||
function isLicenseScopeSufficient(packageName, licenseScope) { | ||
function isPlanScopeSufficient(packageName, planScope) { | ||
let acceptedScopes; | ||
@@ -24,3 +24,3 @@ if (packageName.includes('-pro')) { | ||
} | ||
return acceptedScopes.includes(licenseScope); | ||
return acceptedScopes.includes(planScope); | ||
} | ||
@@ -44,4 +44,4 @@ const expiryReg = /^.*EXPIRY=([0-9]+),.*$/; | ||
return { | ||
scope: 'pro', | ||
licensingModel: 'perpetual', | ||
planScope: 'pro', | ||
licenseModel: 'perpetual', | ||
expiryTimestamp, | ||
@@ -53,8 +53,8 @@ planVersion: 'initial' | ||
/** | ||
* Format: O=${orderNumber},E=${expiryTimestamp},S=${scope},LM=${licensingModel},PV=${planVersion},KV=2`; | ||
* Format: O=${orderNumber},E=${expiryTimestamp},S=${planScope},LM=${licenseModel},PV=${planVersion},KV=2`; | ||
*/ | ||
const decodeLicenseVersion2 = license => { | ||
const licenseInfo = { | ||
scope: null, | ||
licensingModel: null, | ||
planScope: null, | ||
licenseModel: null, | ||
expiryTimestamp: null, | ||
@@ -65,6 +65,6 @@ planVersion: 'initial' | ||
if (key === 'S') { | ||
licenseInfo.scope = value; | ||
licenseInfo.planScope = value; | ||
} | ||
if (key === 'LM') { | ||
licenseInfo.licensingModel = value; | ||
licenseInfo.licenseModel = value; | ||
} | ||
@@ -124,3 +124,3 @@ if (key === 'E') { | ||
} | ||
if (license.licensingModel == null || !LICENSING_MODELS.includes(license.licensingModel)) { | ||
if (license.licenseModel == null || !LICENSE_MODELS.includes(license.licenseModel)) { | ||
console.error('MUI X: Error checking license. Licensing model not found or invalid!'); | ||
@@ -137,3 +137,3 @@ return { | ||
} | ||
if (license.licensingModel === 'perpetual' || process.env.NODE_ENV === 'production') { | ||
if (license.licenseModel === 'perpetual' || process.env.NODE_ENV === 'production') { | ||
const pkgTimestamp = parseInt(base64Decode(releaseInfo), 10); | ||
@@ -148,3 +148,3 @@ if (Number.isNaN(pkgTimestamp)) { | ||
} | ||
} else if (license.licensingModel === 'subscription' || license.licensingModel === 'annual') { | ||
} else if (license.licenseModel === 'subscription' || license.licenseModel === 'annual') { | ||
if (new Date().getTime() > license.expiryTimestamp) { | ||
@@ -171,4 +171,4 @@ if ( | ||
} | ||
if (license.scope == null || !LICENSE_SCOPES.includes(license.scope)) { | ||
console.error('MUI X: Error checking license. scope not found or invalid!'); | ||
if (license.planScope == null || !PLAN_SCOPES.includes(license.planScope)) { | ||
console.error('MUI X: Error checking license. planScope not found or invalid!'); | ||
return { | ||
@@ -178,3 +178,3 @@ status: LICENSE_STATUS.Invalid | ||
} | ||
if (!isLicenseScopeSufficient(packageName, license.scope)) { | ||
if (!isPlanScopeSufficient(packageName, license.planScope)) { | ||
return { | ||
@@ -186,3 +186,3 @@ status: LICENSE_STATUS.OutOfScope | ||
// 'charts-pro' or 'tree-view-pro' can only be used with a newer Pro license | ||
if (license.planVersion === 'initial' && license.scope === 'pro' && !PRO_PACKAGES_AVAILABLE_IN_INITIAL_PRO_PLAN.includes(packageName)) { | ||
if (license.planVersion === 'initial' && license.planScope === 'pro' && !PRO_PACKAGES_AVAILABLE_IN_INITIAL_PRO_PLAN.includes(packageName)) { | ||
return { | ||
@@ -189,0 +189,0 @@ status: LICENSE_STATUS.NotAvailableInInitialProPlan |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
279245
2000
3