@sdux-vault/engine 0.8.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,7 +11,7 @@ import { EventBus, initDevtoolsWidget } from '@sdux-vault/devtools';
|
|
|
11
11
|
// cmd+alt+j (see .vscode/keybindings.json)
|
|
12
12
|
// --- END AI MODEL FILE PATH ---
|
|
13
13
|
const SDUX_PACKAGE = '@sdux-vault/engine';
|
|
14
|
-
const SDUX_VERSION = '0.
|
|
14
|
+
const SDUX_VERSION = '0.11.0';
|
|
15
15
|
registerVersion(SDUX_PACKAGE, SDUX_VERSION);
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -1573,6 +1573,7 @@ const VAULT_LICENSE_ID = 'sdux-vault';
|
|
|
1573
1573
|
// Generated by pathcomment [tab] (see .vscode/typescript.code-snippets) or
|
|
1574
1574
|
// cmd+alt+j (see .vscode/keybindings.json)
|
|
1575
1575
|
// --- END AI MODEL FILE PATH ---
|
|
1576
|
+
const CORE_LICENSE_BEHAVIOR_KEY = 'SDUX::Behavior::Core::License';
|
|
1576
1577
|
let instance = null;
|
|
1577
1578
|
function VaultCore(config = {}) {
|
|
1578
1579
|
if (!instance) {
|
|
@@ -1584,7 +1585,8 @@ class VaultCoreInstance {
|
|
|
1584
1585
|
#validaionSub;
|
|
1585
1586
|
#licenseMap = new Map();
|
|
1586
1587
|
#terminalStatus = new Map();
|
|
1587
|
-
#
|
|
1588
|
+
#aiAssistEnabled = false;
|
|
1589
|
+
#bypassLicensing = false;
|
|
1588
1590
|
#licenseTimeoutMs;
|
|
1589
1591
|
// eslint-disable-next-line
|
|
1590
1592
|
#licenseTimers = new Map();
|
|
@@ -1828,6 +1830,9 @@ class VaultCoreInstance {
|
|
|
1828
1830
|
return;
|
|
1829
1831
|
this.#applyLicenseValidation(record.behaviors, key, licenseToken, valid);
|
|
1830
1832
|
this.#applyLicenseValidation(record.controllers, key, licenseToken, valid);
|
|
1833
|
+
if (valid && key === CORE_LICENSE_BEHAVIOR_KEY) {
|
|
1834
|
+
this.#enableAiAssist();
|
|
1835
|
+
}
|
|
1831
1836
|
}
|
|
1832
1837
|
#applyLicenseValidation(entities, key, licenseId, valid) {
|
|
1833
1838
|
if (!entities?.has(key))
|
|
@@ -1906,6 +1911,20 @@ class VaultCoreInstance {
|
|
|
1906
1911
|
}
|
|
1907
1912
|
return this.#registry.get(key);
|
|
1908
1913
|
}
|
|
1914
|
+
#enableAiAssist() {
|
|
1915
|
+
if (this.#aiAssistEnabled)
|
|
1916
|
+
return;
|
|
1917
|
+
if (!DevMode.active)
|
|
1918
|
+
return;
|
|
1919
|
+
// istanbul ignore next -- SSR guard; document is always defined in browser tests
|
|
1920
|
+
if (typeof document === 'undefined')
|
|
1921
|
+
return;
|
|
1922
|
+
this.#aiAssistEnabled = true;
|
|
1923
|
+
globalThis.sdux ??= {};
|
|
1924
|
+
globalThis.sdux.debugWidget ??= {};
|
|
1925
|
+
globalThis.sdux.debugWidget.aiAssistEnabled = true;
|
|
1926
|
+
document.dispatchEvent(new CustomEvent('sdux-license-resolved'));
|
|
1927
|
+
}
|
|
1909
1928
|
#injectDebugWidget() {
|
|
1910
1929
|
if (!DevMode.active)
|
|
1911
1930
|
return;
|
|
@@ -2020,6 +2039,11 @@ function isAuthorizedKey(key) {
|
|
|
2020
2039
|
return true;
|
|
2021
2040
|
return instance.isAuthorizedKey(key);
|
|
2022
2041
|
}
|
|
2042
|
+
function isBypassLicensing() {
|
|
2043
|
+
if (!instance)
|
|
2044
|
+
return false;
|
|
2045
|
+
return instance.isBypassLicensing();
|
|
2046
|
+
}
|
|
2023
2047
|
function hasVaultLicense() {
|
|
2024
2048
|
if (!instance)
|
|
2025
2049
|
return false;
|
|
@@ -2103,7 +2127,7 @@ class BehaviorInitializationClass {
|
|
|
2103
2127
|
behaviorConfig = behaviorConfigs.get(meta.configKey);
|
|
2104
2128
|
}
|
|
2105
2129
|
let licensePayload = undefined;
|
|
2106
|
-
if (meta.needsLicense) {
|
|
2130
|
+
if (meta.needsLicense && !isBypassLicensing()) {
|
|
2107
2131
|
if (!meta.licenseId) {
|
|
2108
2132
|
isCritical = true;
|
|
2109
2133
|
throw new Error(`[vault] Behavior "${behaviorKey}" declares needsLicense but has no licenseId.`);
|
|
@@ -2493,7 +2517,7 @@ withCoreLicenseBehavior = __decorate([
|
|
|
2493
2517
|
key: defineBehaviorKey('Core', 'License'),
|
|
2494
2518
|
critical: true,
|
|
2495
2519
|
needsLicense: true,
|
|
2496
|
-
licenseId:
|
|
2520
|
+
licenseId: VAULT_LICENSE_ID
|
|
2497
2521
|
})
|
|
2498
2522
|
], withCoreLicenseBehavior);
|
|
2499
2523
|
|
|
@@ -3361,7 +3385,7 @@ class ControllerInitializationClass {
|
|
|
3361
3385
|
controllerConfig = controllerConfigs.get(meta.configKey);
|
|
3362
3386
|
}
|
|
3363
3387
|
let licensePayload = undefined;
|
|
3364
|
-
if (meta.needsLicense) {
|
|
3388
|
+
if (meta.needsLicense && !isBypassLicensing()) {
|
|
3365
3389
|
if (!meta.licenseId) {
|
|
3366
3390
|
isCritical = true;
|
|
3367
3391
|
throw new Error(`[vault] Controller "${controllerKey}" declares needsLicense but has no licenseId.`);
|
|
@@ -4386,5 +4410,5 @@ function resetFeatureCellToken() {
|
|
|
4386
4410
|
* Generated bundle index. Do not edit.
|
|
4387
4411
|
*/
|
|
4388
4412
|
|
|
4389
|
-
export { Conductor, FeatureCellClass, LicensingAbstract, VAULT_LICENSE_ID, VaultCore, createFeatureCellToken, getFeatureCellToken, getLicensePayload, getVaultRegistryForTests, hasVaultLicense, isAuthorizedKey, isPipelineTerminal, registerFeatureCell, registerVaultSettled, resetFeatureCellRegistry, resetVaultForTests, vaultAllSettled, vaultSettled };
|
|
4413
|
+
export { Conductor, FeatureCellClass, LicensingAbstract, VAULT_LICENSE_ID, VaultCore, VerifyLicenseToken, createFeatureCellToken, getFeatureCellToken, getLicensePayload, getVaultRegistryForTests, hasVaultLicense, isAuthorizedKey, isBypassLicensing, isPipelineTerminal, registerFeatureCell, registerVaultSettled, resetFeatureCellRegistry, resetVaultForTests, vaultAllSettled, vaultSettled };
|
|
4390
4414
|
//# sourceMappingURL=sdux-vault-engine.mjs.map
|