udsl-sdk 1.0.5 → 1.0.6

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.
Files changed (2) hide show
  1. package/README.md +154 -122
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,213 +1,243 @@
1
1
  # UDSL SDK
2
2
 
3
- Crash-Safe Data Recovery SDK for JavaScript and TypeScript applications.
3
+ Crash-Safe Data Recovery SDK using Write-Ahead Logging (WAL), Snapshots, Multi-Tenant Isolation, and Instant Recovery.
4
4
 
5
- UDSL (Universal Data Safety Layer) helps applications prevent data loss by using Write-Ahead Logging (WAL), Snapshots, Recovery, Version History, and Rollback mechanisms.
5
+ ## What is UDSL?
6
6
 
7
- ## Why UDSL?
8
-
9
- Applications can lose user data because of:
7
+ UDSL (Universal Data Safety Layer) helps applications prevent data loss caused by:
10
8
 
11
9
  * Application crashes
12
10
  * Power failures
13
- * Unexpected shutdowns
14
- * Network interruptions
15
- * Software bugs
11
+ * System shutdowns
12
+ * Unexpected errors
13
+ * Process termination
16
14
 
17
- UDSL provides a recovery layer that ensures user data can be restored even after failures.
15
+ Instead of storing data directly, applications write through UDSL, which maintains a Write-Ahead Log (WAL) and snapshots to ensure recoverability.
18
16
 
19
17
  ---
20
18
 
21
19
  ## Features
22
20
 
23
21
  * Write-Ahead Logging (WAL)
24
- * Snapshot-based recovery
25
- * Crash recovery
26
- * Version history
27
- * Rollback support
28
- * Multi-tenant architecture
29
- * API key authentication
30
- * Offline-first support
31
- * TypeScript support
22
+ * Instant Recovery Engine
23
+ * Snapshot-Based Recovery
24
+ * Multi-Tenant Isolation
25
+ * API Key Authentication
26
+ * Docker Deployment
27
+ * NPM SDK
28
+ * Version History
29
+ * Rollback Support
30
+ * Self-Hosted Infrastructure
32
31
 
33
32
  ---
34
33
 
35
34
  ## Installation
36
35
 
36
+ Install the SDK:
37
+
37
38
  ```bash
38
39
  npm install udsl-sdk
39
40
  ```
40
41
 
42
+ Start the recovery server:
43
+
44
+ ```bash
45
+ npx udsl-sdk start
46
+ ```
47
+
48
+ Expected output:
49
+
50
+ ```text
51
+ 🚀 Starting UDSL...
52
+ 📦 Pulling UDSL image...
53
+ 🔥 Starting server...
54
+ ✅ UDSL running at http://localhost:3001
55
+ ```
56
+
41
57
  ---
42
58
 
43
- ## Initialization
59
+ ## Quick Start
60
+
61
+ ### Initialize SDK
44
62
 
45
- ```typescript
46
- import { UDSL } from "udsl-sdk";
63
+ ```javascript
64
+ const { UDSL } = require("udsl-sdk");
47
65
 
48
66
  UDSL.init({
49
67
  baseUrl: "http://localhost:3001",
50
- apiKey: "your-api-key"
68
+ apiKey: "test-key-123"
51
69
  });
52
70
  ```
53
71
 
54
- ---
55
-
56
- ## Save Data
72
+ ### Save Data
57
73
 
58
- ```typescript
59
- await UDSL.save("doc1", {
60
- title: "Project Notes",
61
- content: "Building a crash-safe recovery system"
74
+ ```javascript
75
+ await UDSL.save("project1", {
76
+ name: "My Project",
77
+ progress: 50
62
78
  });
63
79
  ```
64
80
 
65
- ---
66
-
67
- ## Read Data
81
+ ### Recover Data
68
82
 
69
- ```typescript
70
- const data = await UDSL.get("doc1");
83
+ ```javascript
84
+ const data = await UDSL.get("project1");
71
85
 
72
86
  console.log(data);
73
87
  ```
74
88
 
75
- ---
76
-
77
- ## View History
78
-
79
- ```typescript
80
- const history = await UDSL.history("doc1");
81
-
82
- console.log(history);
89
+ Output:
90
+
91
+ ```javascript
92
+ {
93
+ key: "companyA:project1",
94
+ state: {
95
+ name: "My Project",
96
+ progress: 50
97
+ },
98
+ eventsCount: 1,
99
+ mode: "INSTANT_RECOVERY"
100
+ }
83
101
  ```
84
102
 
85
103
  ---
86
104
 
87
- ## Rollback
105
+ ## Multi-Tenant Architecture
88
106
 
89
- ```typescript
90
- await UDSL.rollback("doc1", 1);
91
- ```
92
-
93
- This restores the document to version 1.
94
-
95
- ---
107
+ UDSL automatically isolates data by tenant.
96
108
 
97
- ## How It Works
109
+ Example:
98
110
 
99
- ### Step 1
111
+ ```json
112
+ {
113
+ "test-key-123": {
114
+ "tenantId": "companyA"
115
+ },
116
+ "test-key-456": {
117
+ "tenantId": "companyB"
118
+ }
119
+ }
120
+ ```
100
121
 
101
- Application writes data.
122
+ Data written by Company A:
102
123
 
103
124
  ```text
104
- Application
105
-
106
- UDSL SDK
125
+ companyA:project1
107
126
  ```
108
127
 
109
- ### Step 2
110
-
111
- SDK sends data to the recovery engine.
128
+ Data written by Company B:
112
129
 
113
130
  ```text
114
- SDK
115
-
116
- Recovery Server
131
+ companyB:project1
117
132
  ```
118
133
 
119
- ### Step 3
120
-
121
- Server writes to WAL before acknowledging.
134
+ Each tenant can only access its own data.
122
135
 
123
- ```text
124
- Request
125
-
126
- WAL
127
-
128
- Snapshot
129
- ```
136
+ ---
130
137
 
131
- ### Step 4
138
+ ## Crash Recovery Example
132
139
 
133
- If a crash occurs, recovery rebuilds the latest state.
140
+ Save data:
134
141
 
135
- ```text
136
- Snapshot
137
- +
138
- WAL Replay
139
-
140
- Recovered State
142
+ ```javascript
143
+ await UDSL.save("document1", {
144
+ text: "Important content"
145
+ });
141
146
  ```
142
147
 
143
- ---
144
-
145
- ## Architecture
148
+ Stop server:
146
149
 
147
- ```text
148
- Application
149
-
150
- UDSL SDK
151
-
152
- Recovery API
153
-
154
- WAL
155
- Snapshot
156
- History
157
- Rollback
150
+ ```bash
151
+ docker stop udsl-server
158
152
  ```
159
153
 
160
- ---
154
+ Start again:
161
155
 
162
- ## Example Use Cases
156
+ ```bash
157
+ npx udsl-sdk start
158
+ ```
163
159
 
164
- ### Notes Applications
160
+ Recover:
165
161
 
166
- Recover user notes after crashes.
162
+ ```javascript
163
+ const data = await UDSL.get("document1");
164
+ ```
167
165
 
168
- ### Form Builders
166
+ Your data is restored from WAL and snapshots.
169
167
 
170
- Prevent loss of partially completed forms.
168
+ ---
171
169
 
172
- ### Code Editors
170
+ ## API
173
171
 
174
- Restore unsaved work automatically.
172
+ ### UDSL.init()
175
173
 
176
- ### Enterprise Applications
174
+ ```javascript
175
+ UDSL.init({
176
+ baseUrl: string,
177
+ apiKey: string
178
+ });
179
+ ```
177
180
 
178
- Maintain audit trails and recovery history.
181
+ ### UDSL.save()
179
182
 
180
- ### SaaS Platforms
183
+ ```javascript
184
+ await UDSL.save(key, value);
185
+ ```
181
186
 
182
- Provide reliable data recovery for customers.
187
+ ### UDSL.get()
188
+
189
+ ```javascript
190
+ const data = await UDSL.get(key);
191
+ ```
183
192
 
184
193
  ---
185
194
 
186
- ## Security
195
+ ## Docker
187
196
 
188
- * API Key Authentication
189
- * Tenant Isolation
190
- * Crash-Safe Writes
191
- * Recovery Validation
197
+ UDSL Server runs inside Docker.
198
+
199
+ Manual start:
200
+
201
+ ```bash
202
+ docker run -d -p 3001:3001 omghadage/udsl-server:latest
203
+ ```
192
204
 
193
205
  ---
194
206
 
195
- ## Roadmap
207
+ ## Architecture
196
208
 
197
- * Local Offline Queue
198
- * Background Sync Engine
199
- * Data Encryption
200
- * Cloud Dashboard
201
- * Analytics
202
- * Mobile SDK
203
- * React SDK
204
- * Automatic Backup System
209
+ ```text
210
+ Application
211
+
212
+
213
+ UDSL SDK
214
+
215
+
216
+ UDSL Server
217
+
218
+
219
+ Write-Ahead Log
220
+
221
+
222
+ Snapshot Store
223
+
224
+
225
+ Recovery Engine
226
+ ```
205
227
 
206
228
  ---
207
229
 
208
- ## License
230
+ ## Use Cases
209
231
 
210
- MIT License
232
+ * Note-taking applications
233
+ * Project management software
234
+ * IDEs and code editors
235
+ * CAD tools
236
+ * Form builders
237
+ * Offline-first applications
238
+ * Enterprise systems
239
+
240
+ Any application where user data must survive crashes.
211
241
 
212
242
  ---
213
243
 
@@ -215,4 +245,6 @@ MIT License
215
245
 
216
246
  Om Ghadage
217
247
 
218
- Building reliable systems that help applications recover data after failures.
248
+ ## License
249
+
250
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "udsl-sdk",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Crash-safe data recovery SDK (WAL + Snapshot based)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",