@sdux-vault/shared 0.9.0 → 0.9.2
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.
- package/README.md +9 -8
- package/fesm2022/sdux-vault-shared.mjs +65 -37
- package/fesm2022/sdux-vault-shared.mjs.map +1 -1
- package/package.json +3 -2
- package/types/sdux-vault-shared.d.ts +258 -113
package/README.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
Deterministic state management for every framework — one pipeline, zero ambiguity.
|
|
2
|
+
|
|
1
3
|
<p align="center">
|
|
2
4
|
<img src="https://raw.githubusercontent.com/sdux-vault/vault/main/apps/docs-app/assets/brand/sdux/brand-landscape.svg" height="80" alt="SDuX Vault" />
|
|
3
5
|
</p>
|
|
4
6
|
|
|
5
7
|
<h3 align="center">Plain TypeScript. Zero Magic.</h3>
|
|
6
|
-
<p align="center">Deterministic state management for every framework — one pipeline, zero ambiguity.</p>
|
|
7
8
|
|
|
8
9
|
# @sdux-vault/shared
|
|
9
10
|
|
|
@@ -87,13 +88,13 @@ npm install @sdux-vault/core
|
|
|
87
88
|
|
|
88
89
|
## Ecosystem
|
|
89
90
|
|
|
90
|
-
| Package
|
|
91
|
-
|
|
|
92
|
-
| [`@sdux-vault/engine`](https://www.npmjs.com/package/@sdux-vault/engine)
|
|
93
|
-
| [`@sdux-vault/core`](https://www.npmjs.com/package/@sdux-vault/core)
|
|
94
|
-
| [`@sdux-vault/addons`](https://www.npmjs.com/package/@sdux-vault/addons)
|
|
95
|
-
| [`@sdux-vault/core-extensions`](https://www.npmjs.com/package/@sdux-vault/core-extensions)
|
|
96
|
-
| [`@sdux-vault/devtools
|
|
91
|
+
| Package | Purpose |
|
|
92
|
+
| ------------------------------------------------------------------------------------------ | -------------------------------------------- |
|
|
93
|
+
| [`@sdux-vault/engine`](https://www.npmjs.com/package/@sdux-vault/engine) | Orchestration, conductor, decision engine |
|
|
94
|
+
| [`@sdux-vault/core`](https://www.npmjs.com/package/@sdux-vault/core) | Behavior runtime and pipeline execution |
|
|
95
|
+
| [`@sdux-vault/addons`](https://www.npmjs.com/package/@sdux-vault/addons) | Optional runtime policies and controllers |
|
|
96
|
+
| [`@sdux-vault/core-extensions`](https://www.npmjs.com/package/@sdux-vault/core-extensions) | Framework integrations (Angular, React, Vue) |
|
|
97
|
+
| [`@sdux-vault/devtools`](https://www.npmjs.com/package/@sdux-vault/devtools) | Observability and debugging |
|
|
97
98
|
|
|
98
99
|
---
|
|
99
100
|
|
|
@@ -1,47 +1,17 @@
|
|
|
1
1
|
import { BehaviorSubject, Subscription, tap } from 'rxjs';
|
|
2
2
|
|
|
3
|
-
/** Singleton accessor that detects whether code is running in a test environment. */
|
|
4
|
-
const isTestEnv = {
|
|
5
|
-
get active() {
|
|
6
|
-
return (
|
|
7
|
-
// eslint-disable-next-line
|
|
8
|
-
typeof globalThis.jasmine !== 'undefined' ||
|
|
9
|
-
// istanbul ignore next
|
|
10
|
-
// eslint-disable-next-line
|
|
11
|
-
typeof globalThis.jest !== 'undefined' ||
|
|
12
|
-
// istanbul ignore next
|
|
13
|
-
// eslint-disable-next-line
|
|
14
|
-
typeof globalThis.vitest !== 'undefined');
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/** Tracks whether Vault development mode has been enabled. */
|
|
19
|
-
let devMode = null;
|
|
20
|
-
/** Singleton accessor for Vault development mode state. */
|
|
21
|
-
const DevMode = {
|
|
22
|
-
get active() {
|
|
23
|
-
return devMode === true;
|
|
24
|
-
},
|
|
25
|
-
setDevMode(isDevMode) {
|
|
26
|
-
if (devMode !== null && !isTestEnv.active) {
|
|
27
|
-
throw new Error('[vault] DevMode has already been initialized.');
|
|
28
|
-
}
|
|
29
|
-
devMode = isDevMode;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
3
|
/**
|
|
34
|
-
* Registers a package version on the global SDuX
|
|
4
|
+
* Registers a package version on the global SDuX namespace.
|
|
35
5
|
*
|
|
36
6
|
* @param packageName - The npm package name to register.
|
|
37
7
|
* @param version - The semver version string.
|
|
38
8
|
*/
|
|
39
9
|
const registerVersion = (packageName, version) => {
|
|
40
|
-
|
|
10
|
+
// istanbul ignore next line - globalThis is always defined in supported runtimes
|
|
11
|
+
if (typeof globalThis === 'undefined')
|
|
41
12
|
return;
|
|
42
13
|
const sdux = (globalThis.sdux ??= {});
|
|
43
|
-
const
|
|
44
|
-
const versions = (debug.versions ??= {});
|
|
14
|
+
const versions = (sdux.versions ??= {});
|
|
45
15
|
if (versions[packageName] === version)
|
|
46
16
|
return;
|
|
47
17
|
versions[packageName] = version;
|
|
@@ -50,7 +20,7 @@ const registerVersion = (packageName, version) => {
|
|
|
50
20
|
/** Package name used for version registration. */
|
|
51
21
|
const SDUX_PACKAGE = '@sdux-vault/shared';
|
|
52
22
|
/** Current package version string. */
|
|
53
|
-
const SDUX_VERSION = '0.9.
|
|
23
|
+
const SDUX_VERSION = '0.9.3';
|
|
54
24
|
registerVersion(SDUX_PACKAGE, SDUX_VERSION);
|
|
55
25
|
|
|
56
26
|
/**
|
|
@@ -66,7 +36,6 @@ registerVersion(SDUX_PACKAGE, SDUX_VERSION);
|
|
|
66
36
|
const BehaviorTypes = {
|
|
67
37
|
CoreAfterTap: 'coreAfterTap',
|
|
68
38
|
CoreBeforeTap: 'coreBeforeTap',
|
|
69
|
-
ReplayGlobalError: 'replayGlobalError',
|
|
70
39
|
CoreError: 'coreError',
|
|
71
40
|
CoreErrorCallback: 'coreErrorCallback',
|
|
72
41
|
CoreState: 'coreState',
|
|
@@ -864,6 +833,7 @@ const DecisionOutcomeTypes = {
|
|
|
864
833
|
|
|
865
834
|
/** Enumeration of event boundary positions within a lifecycle span. */
|
|
866
835
|
const EventBoundaryTypes = {
|
|
836
|
+
Candidate: 'candidate',
|
|
867
837
|
End: 'end',
|
|
868
838
|
Notification: 'notification',
|
|
869
839
|
Start: 'start',
|
|
@@ -875,6 +845,7 @@ const EventTypes = {
|
|
|
875
845
|
Conductor: 'conductor',
|
|
876
846
|
Controller: 'controller',
|
|
877
847
|
Lifecycle: 'lifecycle',
|
|
848
|
+
Pipeline: 'pipeline',
|
|
878
849
|
Stage: 'stage',
|
|
879
850
|
Unknown: 'unknown'
|
|
880
851
|
};
|
|
@@ -886,6 +857,17 @@ const OperationTypes = {
|
|
|
886
857
|
Initialize: 'initialize'
|
|
887
858
|
};
|
|
888
859
|
|
|
860
|
+
/** Enumeration of pipeline stages that produce state-transforming snapshots for DevTools diffing. */
|
|
861
|
+
const PipelineStages = {
|
|
862
|
+
PipelineStart: 'pipeline-start',
|
|
863
|
+
Resolve: 'resolve',
|
|
864
|
+
ComputeMerge: 'compute-merge',
|
|
865
|
+
Operator: 'operator',
|
|
866
|
+
Filter: 'filter',
|
|
867
|
+
Reducer: 'reducer',
|
|
868
|
+
CoreState: 'core-state'
|
|
869
|
+
};
|
|
870
|
+
|
|
889
871
|
/**
|
|
890
872
|
* Enumerates the available resolve strategy identifiers used by resolve
|
|
891
873
|
* behaviors. These identifiers indicate how a FeatureCell obtains its initial
|
|
@@ -915,6 +897,22 @@ const StateEmitTypes = {
|
|
|
915
897
|
TabSync: 'Tab Sync'
|
|
916
898
|
};
|
|
917
899
|
|
|
900
|
+
/** Enumeration of Vault license tier classifications. */
|
|
901
|
+
const VaultLicensePayloadTypes = {
|
|
902
|
+
Development: 'development',
|
|
903
|
+
Pro: 'pro',
|
|
904
|
+
Enterprise: 'enterprise'
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
/** Enumeration of license validation statuses for FeatureCell registration. */
|
|
908
|
+
const VaultRegistrationLicenseStatusTypes = {
|
|
909
|
+
NotRequired: 'not-required',
|
|
910
|
+
Pending: 'pending',
|
|
911
|
+
Revoked: 'revoked',
|
|
912
|
+
Timeout: 'timeout',
|
|
913
|
+
Valid: 'valid'
|
|
914
|
+
};
|
|
915
|
+
|
|
918
916
|
/* -----------------------------------------------------------
|
|
919
917
|
* TYPES (USER-FACING)
|
|
920
918
|
* --------------------------------------------------------- */
|
|
@@ -1006,6 +1004,36 @@ function isDeferredFactory(value) {
|
|
|
1006
1004
|
typeof value.value === 'function');
|
|
1007
1005
|
}
|
|
1008
1006
|
|
|
1007
|
+
/** Singleton accessor that detects whether code is running in a test environment. */
|
|
1008
|
+
const isTestEnv = {
|
|
1009
|
+
get active() {
|
|
1010
|
+
return (
|
|
1011
|
+
// eslint-disable-next-line
|
|
1012
|
+
typeof globalThis.jasmine !== 'undefined' ||
|
|
1013
|
+
// istanbul ignore next
|
|
1014
|
+
// eslint-disable-next-line
|
|
1015
|
+
typeof globalThis.jest !== 'undefined' ||
|
|
1016
|
+
// istanbul ignore next
|
|
1017
|
+
// eslint-disable-next-line
|
|
1018
|
+
typeof globalThis.vitest !== 'undefined');
|
|
1019
|
+
}
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1022
|
+
/** Tracks whether Vault development mode has been enabled. */
|
|
1023
|
+
let devMode = null;
|
|
1024
|
+
/** Singleton accessor for Vault development mode state. */
|
|
1025
|
+
const DevMode = {
|
|
1026
|
+
get active() {
|
|
1027
|
+
return devMode === true;
|
|
1028
|
+
},
|
|
1029
|
+
setDevMode(isDevMode) {
|
|
1030
|
+
if (devMode !== null && !isTestEnv.active) {
|
|
1031
|
+
throw new Error('[vault] DevMode has already been initialized.');
|
|
1032
|
+
}
|
|
1033
|
+
devMode = isDevMode;
|
|
1034
|
+
}
|
|
1035
|
+
};
|
|
1036
|
+
|
|
1009
1037
|
/**
|
|
1010
1038
|
* Normalizes any thrown error into a canonical `VaultError` structure.
|
|
1011
1039
|
*
|
|
@@ -1323,5 +1351,5 @@ function isHttpResourceRef(obj) {
|
|
|
1323
1351
|
* Generated bundle index. Do not edit.
|
|
1324
1352
|
*/
|
|
1325
1353
|
|
|
1326
|
-
export { AbstractActiveController, AbstractErrorCallbackBehavior, AbstractErrorTransformBehavior, BEHAVIOR_META, BehaviorTypes, CONTROLLER_META, ControllerMessageTypes, ControllerTypes, ControllerVotes, DEVTOOLS_AGGREGATE_KEY_CONSTANT, DEVTOOLS_LOGGING_KEY_CONSTANT, DecisionOutcomeTypes, DevMode, EventBoundaryTypes, EventTypes, LogLevelTypes, OperationTypes, ResolveTypes, StateEmitTypes, VAULT_CLEAR_STATE, VAULT_CONTINUE, VAULT_NOOP, VAULT_STOP, VaultBehavior, VaultController, VaultEncryptionIntegrityError, VaultError, VaultErrorKindTypes, VaultErrorNameTypes, VaultErrorService, VaultErrorUsageKindTypes, VaultLicenseError, VaultPrivateErrorService, VaultUsageError, VaultUsagePromiseError, VaultUsagePromiseFactoryRequiredError, createVaultError, defineBehaviorKey, defineControllerKey, getVaultLogLevel, isDeferredFactory, isDefined, isFunction, isHttpResourceRef, isNull, isNullish, isObject, isPromise, isStateInputShape, isTestEnv, isUndefined, isVaultClearState, isVaultContinue, isVaultNoop, isolateValue, registerVersion, safeStringify, setVaultLogLevel, validateBehaviorKey, validateControllerKey, vaultDebug, vaultError, vaultLog, vaultWarn };
|
|
1354
|
+
export { AbstractActiveController, AbstractErrorCallbackBehavior, AbstractErrorTransformBehavior, BEHAVIOR_META, BehaviorTypes, CONTROLLER_META, ControllerMessageTypes, ControllerTypes, ControllerVotes, DEVTOOLS_AGGREGATE_KEY_CONSTANT, DEVTOOLS_LOGGING_KEY_CONSTANT, DecisionOutcomeTypes, DevMode, EventBoundaryTypes, EventTypes, LogLevelTypes, OperationTypes, PipelineStages, ResolveTypes, StateEmitTypes, VAULT_CLEAR_STATE, VAULT_CONTINUE, VAULT_NOOP, VAULT_STOP, VaultBehavior, VaultController, VaultEncryptionIntegrityError, VaultError, VaultErrorKindTypes, VaultErrorNameTypes, VaultErrorService, VaultErrorUsageKindTypes, VaultLicenseError, VaultLicensePayloadTypes, VaultPrivateErrorService, VaultRegistrationLicenseStatusTypes, VaultUsageError, VaultUsagePromiseError, VaultUsagePromiseFactoryRequiredError, createVaultError, defineBehaviorKey, defineControllerKey, getVaultLogLevel, isDeferredFactory, isDefined, isFunction, isHttpResourceRef, isNull, isNullish, isObject, isPromise, isStateInputShape, isTestEnv, isUndefined, isVaultClearState, isVaultContinue, isVaultNoop, isolateValue, registerVersion, safeStringify, setVaultLogLevel, validateBehaviorKey, validateControllerKey, vaultDebug, vaultError, vaultLog, vaultWarn };
|
|
1327
1355
|
//# sourceMappingURL=sdux-vault-shared.mjs.map
|