@sdux-vault/shared 0.6.0 → 0.9.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.
- package/README.md +53 -209
- package/fesm2022/sdux-vault-shared.mjs +248 -232
- package/fesm2022/sdux-vault-shared.mjs.map +1 -1
- package/package.json +26 -2
- package/types/sdux-vault-shared.d.ts +1116 -122
package/README.md
CHANGED
|
@@ -1,80 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<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
|
+
</p>
|
|
2
4
|
|
|
3
|
-
>
|
|
5
|
+
<h3 align="center">Plain TypeScript. Zero Magic.</h3>
|
|
6
|
+
<p align="center">Deterministic state management for every framework — one pipeline, zero ambiguity.</p>
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
It defines the universal language used across all SDuX packages, including types, contracts, behaviors, and utilities.
|
|
8
|
+
# @sdux-vault/shared
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
> Core primitives, contracts, and utilities for the SDuX Vault platform.
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://www.sdux-vault.com"><strong>Docs</strong></a> ·
|
|
14
|
+
<a href="https://www.sdux-vault.com/stackblitz"><strong>Live Examples</strong></a> ·
|
|
15
|
+
<a href="https://www.sdux-vault.com/builder"><strong>Pipeline Builder</strong></a> ·
|
|
16
|
+
<a href="https://github.com/sdux-vault/vault/issues"><strong>Issues</strong></a>
|
|
17
|
+
</p>
|
|
11
18
|
|
|
12
|
-
|
|
13
|
-
https://
|
|
19
|
+
<p align="center">
|
|
20
|
+
<img src="https://img.shields.io/badge/license-MIT-blue" alt="License" />
|
|
21
|
+
<img src="https://img.shields.io/badge/TypeScript-first-3178C6?logo=typescript&logoColor=white" alt="TypeScript" />
|
|
22
|
+
<img src="https://img.shields.io/badge/frameworks-Angular%20·%20React%20·%20Vue%20·%20Svelte%20·%20Node-333" alt="Frameworks" />
|
|
23
|
+
</p>
|
|
14
24
|
|
|
15
|
-
|
|
25
|
+
## What is SDuX Vault?
|
|
16
26
|
|
|
17
|
-
|
|
27
|
+
SDuX Vault is a **framework-agnostic, deterministic state management system** built around a reactive execution pipeline. It replaces the unpredictable sprawl of action/reducer architectures with a single, ordered, traceable pipeline where every transition is explicit and every output is guaranteed.
|
|
18
28
|
|
|
19
|
-
|
|
29
|
+
## What is SDuX Vault Shared?
|
|
20
30
|
|
|
21
|
-
|
|
22
|
-
shared → engine → core → core-extensions → apps
|
|
23
|
-
└─────────---------───────────→ devtools
|
|
24
|
-
```
|
|
31
|
+
`@sdux-vault/shared` is the **foundation of the SDuX ecosystem**. It defines the universal language used across all SDuX packages — types, contracts, behaviors, and utilities. Every SDuX package depends on `shared`. It is the lowest layer in the dependency graph and has **zero external dependencies**.
|
|
25
32
|
|
|
26
|
-
|
|
27
|
-
- **core** → behavior runtime + execution layer
|
|
28
|
-
- **core-extensions** → framework integrations (Angular, React, etc.)
|
|
29
|
-
- **devtools** → end-user tooling
|
|
30
|
-
- **engine** → runtime engine and orchestration
|
|
31
|
-
- **shared** → contracts, types, utilities (this package)
|
|
33
|
+
**Features:**
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
- **Core contracts** — interfaces, shapes, and types that define the SDuX API surface
|
|
36
|
+
- **Behavior and controller abstractions** — base types for pipeline stages
|
|
37
|
+
- **Utility functions** — type guards, safe helpers, runtime utilities
|
|
38
|
+
- **Configuration primitives** — options, settings, and feature flags
|
|
39
|
+
- **Error models** — structured error types and services
|
|
40
|
+
- **Runtime instrumentation hooks** — DevTools integration points
|
|
34
41
|
|
|
35
|
-
|
|
42
|
+
**Key Characteristics:**
|
|
36
43
|
|
|
37
|
-
-
|
|
38
|
-
- **
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
41
|
-
- **Error models and services**
|
|
42
|
-
- **Runtime instrumentation hooks (DevTools integration)**
|
|
44
|
+
- ✅ **Framework-agnostic** — pure TypeScript, zero dependencies
|
|
45
|
+
- ✅ **Tree-shakable** — domain-based exports, minimal runtime footprint
|
|
46
|
+
- ✅ **SSR-safe and browser-safe** — works everywhere
|
|
47
|
+
- ✅ **Stable public API** — domain-driven, designed for composition
|
|
43
48
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
## Key Characteristics
|
|
47
|
-
|
|
48
|
-
- ✅ Framework-agnostic TypeScript
|
|
49
|
-
- ✅ Tree-shakable
|
|
50
|
-
- ✅ SSR-safe and browser-safe
|
|
51
|
-
- ✅ Designed for composition and extensibility
|
|
52
|
-
- ✅ Stable, domain-driven public API
|
|
49
|
+
For full documentation, guides, and API references: [sdux-vault.com](https://www.sdux-vault.com)
|
|
53
50
|
|
|
54
51
|
---
|
|
55
52
|
|
|
56
|
-
##
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
npm install @sdux-vault/shared
|
|
60
|
-
```
|
|
53
|
+
## Example
|
|
61
54
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
## Usage
|
|
65
|
-
|
|
66
|
-
### Basic Import
|
|
67
|
-
|
|
68
|
-
```ts
|
|
55
|
+
```typescript
|
|
69
56
|
import { VaultError, BehaviorTypes } from '@sdux-vault/shared';
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
### Example: Utility Usage
|
|
75
|
-
|
|
76
|
-
```ts
|
|
77
57
|
import { isPromise } from '@sdux-vault/shared';
|
|
58
|
+
import type { BehaviorType, StateSnapshotShape } from '@sdux-vault/shared';
|
|
78
59
|
|
|
79
60
|
if (isPromise(value)) {
|
|
80
61
|
// handle async flow
|
|
@@ -83,176 +64,39 @@ if (isPromise(value)) {
|
|
|
83
64
|
|
|
84
65
|
---
|
|
85
66
|
|
|
86
|
-
### Example: Type Usage
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
import type { BehaviorType } from '@sdux-vault/shared';
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
---
|
|
93
|
-
|
|
94
|
-
## Public API Structure
|
|
95
|
-
|
|
96
|
-
### Tree-Shakable by Default
|
|
97
|
-
|
|
98
|
-
- No unnecessary side effects
|
|
99
|
-
- Domain-based exports
|
|
100
|
-
- Minimal runtime footprint
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
### Framework-Agnostic Core
|
|
105
|
-
|
|
106
|
-
This package:
|
|
107
|
-
|
|
108
|
-
- has zero framework dependencies
|
|
109
|
-
- supports multiple adapters
|
|
110
|
-
- acts as the foundation for integrations like:
|
|
111
|
-
|
|
112
|
-
```plaintext
|
|
113
|
-
@sdux-vault/core-extensions/*
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
---
|
|
117
|
-
|
|
118
|
-
### Safe Runtime Instrumentation
|
|
119
|
-
|
|
120
|
-
Includes dev-only instrumentation:
|
|
121
|
-
|
|
122
|
-
- version registration
|
|
123
|
-
- DevTools integration
|
|
124
|
-
|
|
125
|
-
These are:
|
|
126
|
-
|
|
127
|
-
- environment guarded
|
|
128
|
-
- idempotent
|
|
129
|
-
- safe in SSR and production
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## Environment Utilities
|
|
134
|
-
|
|
135
|
-
```ts
|
|
136
|
-
import { DevMode } from '@sdux-vault/shared';
|
|
137
|
-
import { isTestEnv } from '@sdux-vault/shared';
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Provides runtime awareness for:
|
|
141
|
-
|
|
142
|
-
- development mode
|
|
143
|
-
- test environments
|
|
144
|
-
|
|
145
|
-
These are part of the **runtime platform**, not test-only helpers.
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## Utilities
|
|
150
|
-
|
|
151
|
-
The `utils` domain includes:
|
|
152
|
-
|
|
153
|
-
- type guards
|
|
154
|
-
- safe helpers
|
|
155
|
-
- logging utilities
|
|
156
|
-
- runtime helpers
|
|
157
|
-
|
|
158
|
-
All utilities are:
|
|
159
|
-
|
|
160
|
-
- side-effect free (except controlled instrumentation)
|
|
161
|
-
- safe for universal usage
|
|
162
|
-
|
|
163
|
-
---
|
|
164
|
-
|
|
165
67
|
## Side Effects
|
|
166
68
|
|
|
167
|
-
This package
|
|
168
|
-
|
|
169
|
-
```ts
|
|
170
|
-
import '@sdux-vault/shared';
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
Triggers:
|
|
174
|
-
|
|
175
|
-
- version registration for DevTools
|
|
176
|
-
|
|
177
|
-
Behavior:
|
|
178
|
-
|
|
179
|
-
- no-op in production
|
|
180
|
-
- idempotent
|
|
181
|
-
- safe across all runtimes
|
|
182
|
-
|
|
183
|
-
---
|
|
184
|
-
|
|
185
|
-
## Development
|
|
186
|
-
|
|
187
|
-
### Build
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
npm run build:shared
|
|
191
|
-
```
|
|
69
|
+
This package includes intentional side effects for:
|
|
192
70
|
|
|
193
|
-
|
|
71
|
+
- Global TypeScript typing augmentation
|
|
72
|
+
- Runtime version registration for DevTools
|
|
194
73
|
|
|
195
|
-
|
|
196
|
-
dist/shared
|
|
197
|
-
```
|
|
74
|
+
These are environment-guarded, idempotent, and safe in SSR and production.
|
|
198
75
|
|
|
199
76
|
---
|
|
200
77
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
npm run test:shared
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
---
|
|
78
|
+
## Installation
|
|
208
79
|
|
|
209
|
-
|
|
80
|
+
This package is installed automatically as a dependency of `@sdux-vault/core`.
|
|
210
81
|
|
|
211
82
|
```bash
|
|
212
|
-
npm
|
|
83
|
+
npm install @sdux-vault/core
|
|
213
84
|
```
|
|
214
85
|
|
|
215
|
-
Includes:
|
|
216
|
-
|
|
217
|
-
- linting
|
|
218
|
-
- formatting
|
|
219
|
-
- type checking
|
|
220
|
-
- tests
|
|
221
|
-
|
|
222
|
-
---
|
|
223
|
-
|
|
224
|
-
## Publishing
|
|
225
|
-
|
|
226
|
-
See [RELEASE.md](./RELEASE.md) for full publishing instructions.
|
|
227
|
-
|
|
228
86
|
---
|
|
229
87
|
|
|
230
88
|
## Ecosystem
|
|
231
89
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
### Tree Shaking & Side Effects
|
|
241
|
-
|
|
242
|
-
This package includes intentional side effects for:
|
|
243
|
-
|
|
244
|
-
- global TypeScript typing augmentation
|
|
245
|
-
- runtime version registration for devtools
|
|
246
|
-
|
|
247
|
-
These are required for correct framework behavior.
|
|
248
|
-
|
|
249
|
-
As a result, the bundle is marked as side-effectful.
|
|
90
|
+
| Package | Purpose |
|
|
91
|
+
| -------------------------------------------------------------------------------------------- | -------------------------------------------- |
|
|
92
|
+
| [`@sdux-vault/engine`](https://www.npmjs.com/package/@sdux-vault/engine) | Orchestration, conductor, decision engine |
|
|
93
|
+
| [`@sdux-vault/core`](https://www.npmjs.com/package/@sdux-vault/core) | Behavior runtime and pipeline execution |
|
|
94
|
+
| [`@sdux-vault/addons`](https://www.npmjs.com/package/@sdux-vault/addons) | Optional runtime policies and controllers |
|
|
95
|
+
| [`@sdux-vault/core-extensions`](https://www.npmjs.com/package/@sdux-vault/core-extensions) | Framework integrations (Angular, React, Vue) |
|
|
96
|
+
| [`@sdux-vault/devtools-tooling`](https://www.npmjs.com/package/@sdux-vault/devtools-tooling) | Observability and debugging |
|
|
250
97
|
|
|
251
98
|
---
|
|
252
99
|
|
|
253
100
|
## License
|
|
254
101
|
|
|
255
|
-
|
|
256
|
-
https://www.sdux-vault.com/docs/welcome/license#license-texts
|
|
257
|
-
|
|
258
|
-
MIT © SDuX Vault
|
|
102
|
+
[MIT (with SDuX Clarification Notice)](https://www.sdux-vault.com/docs/welcome/license#license-texts) © SDuX Vault
|