fase(17): licensing module with RSA validation
This commit is contained in:
43
dist/modules/licensing/domain/value-objects/FeatureEntitlement.js
vendored
Normal file
43
dist/modules/licensing/domain/value-objects/FeatureEntitlement.js
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FeatureEntitlement = exports.ENTERPRISE_FEATURES = exports.PRO_FEATURES = exports.FREE_FEATURES = void 0;
|
||||
exports.FREE_FEATURES = [
|
||||
'exploration:basic',
|
||||
'findings:basic',
|
||||
'findings:export',
|
||||
'reports:basic',
|
||||
'auth:apikeys',
|
||||
];
|
||||
exports.PRO_FEATURES = [
|
||||
...exports.FREE_FEATURES,
|
||||
'exploration:scheduled',
|
||||
'reports:pdf',
|
||||
'integrations:webhook',
|
||||
'integrations:slack',
|
||||
'integrations:github',
|
||||
'integrations:jira',
|
||||
];
|
||||
exports.ENTERPRISE_FEATURES = [
|
||||
...exports.PRO_FEATURES,
|
||||
'auth:sso',
|
||||
'auth:ldap',
|
||||
'audit:logs',
|
||||
'branding:whitelabel',
|
||||
'data:retention',
|
||||
'infra:postgres',
|
||||
];
|
||||
class FeatureEntitlement {
|
||||
constructor(features) {
|
||||
this.features = features;
|
||||
}
|
||||
static forFeatures(features) {
|
||||
return new FeatureEntitlement(new Set(features));
|
||||
}
|
||||
has(feature) {
|
||||
return this.features.has(feature);
|
||||
}
|
||||
toArray() {
|
||||
return Array.from(this.features);
|
||||
}
|
||||
}
|
||||
exports.FeatureEntitlement = FeatureEntitlement;
|
||||
23
dist/modules/licensing/domain/value-objects/LicensePlan.js
vendored
Normal file
23
dist/modules/licensing/domain/value-objects/LicensePlan.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LicensePlan = void 0;
|
||||
class LicensePlan {
|
||||
constructor(value) {
|
||||
this.value = value;
|
||||
}
|
||||
static free() { return new LicensePlan('free'); }
|
||||
static pro() { return new LicensePlan('pro'); }
|
||||
static enterprise() { return new LicensePlan('enterprise'); }
|
||||
static fromString(value) {
|
||||
if (value === 'free' || value === 'pro' || value === 'enterprise') {
|
||||
return new LicensePlan(value);
|
||||
}
|
||||
throw new Error(`Invalid license plan: ${value}`);
|
||||
}
|
||||
get isFree() { return this.value === 'free'; }
|
||||
get isPro() { return this.value === 'pro'; }
|
||||
get isEnterprise() { return this.value === 'enterprise'; }
|
||||
toString() { return this.value; }
|
||||
equals(other) { return this.value === other.value; }
|
||||
}
|
||||
exports.LicensePlan = LicensePlan;
|
||||
Reference in New Issue
Block a user