@a0n/aeon 5.0.1 → 5.0.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.
Files changed (39) hide show
  1. package/dist/AeonEventEmitter-B1DzaYFk.d.cts +23 -0
  2. package/dist/AeonEventEmitter-B1DzaYFk.d.ts +23 -0
  3. package/dist/compression/index.d.cts +1 -1
  4. package/dist/compression/index.d.ts +1 -1
  5. package/dist/core/index.cjs +89 -0
  6. package/dist/core/index.cjs.map +1 -1
  7. package/dist/core/index.d.cts +2 -212
  8. package/dist/core/index.d.ts +2 -212
  9. package/dist/core/index.js +88 -0
  10. package/dist/core/index.js.map +1 -1
  11. package/dist/distributed/index.cjs +88 -4
  12. package/dist/distributed/index.cjs.map +1 -1
  13. package/dist/distributed/index.d.cts +2 -2
  14. package/dist/distributed/index.d.ts +2 -2
  15. package/dist/distributed/index.js +88 -4
  16. package/dist/distributed/index.js.map +1 -1
  17. package/dist/index.cjs +98 -4
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +2 -2
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.js +98 -5
  22. package/dist/index.js.map +1 -1
  23. package/dist/offline/index.cjs +88 -4
  24. package/dist/offline/index.cjs.map +1 -1
  25. package/dist/offline/index.d.cts +3 -3
  26. package/dist/offline/index.d.ts +3 -3
  27. package/dist/offline/index.js +88 -4
  28. package/dist/offline/index.js.map +1 -1
  29. package/dist/optimization/index.d.cts +1 -1
  30. package/dist/optimization/index.d.ts +1 -1
  31. package/dist/presence/index.cjs +88 -4
  32. package/dist/presence/index.cjs.map +1 -1
  33. package/dist/presence/index.d.cts +2 -2
  34. package/dist/presence/index.d.ts +2 -2
  35. package/dist/presence/index.js +88 -4
  36. package/dist/presence/index.js.map +1 -1
  37. package/dist/types-Bj5EbkSK.d.cts +212 -0
  38. package/dist/types-Bj5EbkSK.d.ts +212 -0
  39. package/package.json +15 -17
@@ -0,0 +1,212 @@
1
+ /**
2
+ * Aeon Core Types
3
+ *
4
+ * Shared type definitions for the Aeon synchronization and versioning system.
5
+ */
6
+ /**
7
+ * Operation type - what action is being performed
8
+ */
9
+ type OperationType = 'create' | 'update' | 'delete' | 'sync' | 'batch';
10
+ /**
11
+ * Operation priority for sync ordering
12
+ */
13
+ type OperationPriority = 'high' | 'normal' | 'low';
14
+ /**
15
+ * Operation sync status
16
+ */
17
+ type OperationStatus = 'pending' | 'syncing' | 'synced' | 'failed';
18
+ /**
19
+ * Queued operation for offline-first synchronization
20
+ */
21
+ interface Operation {
22
+ id: string;
23
+ type: OperationType;
24
+ sessionId: string;
25
+ status: OperationStatus;
26
+ data: Record<string, unknown>;
27
+ priority?: OperationPriority;
28
+ createdAt?: number;
29
+ syncedAt?: number;
30
+ retryCount?: number;
31
+ maxRetries?: number;
32
+ }
33
+ /**
34
+ * Conflict detection result
35
+ */
36
+ interface ConflictDetectionResult {
37
+ hasConflict: boolean;
38
+ type?: 'update_update' | 'delete_update' | 'update_delete' | 'concurrent';
39
+ severity?: 'low' | 'medium' | 'high';
40
+ similarity?: number;
41
+ }
42
+ /**
43
+ * Conflict resolution strategy
44
+ */
45
+ type ResolutionStrategy = 'local_wins' | 'remote_wins' | 'last_modified' | 'merge' | 'manual';
46
+ /**
47
+ * Sync batch for uploading multiple operations
48
+ */
49
+ interface SyncBatch {
50
+ batchId: string;
51
+ operations: Operation[];
52
+ totalSize: number;
53
+ createdAt: number;
54
+ priority: OperationPriority;
55
+ }
56
+ /**
57
+ * Sync result from server
58
+ */
59
+ interface SyncResult {
60
+ success: boolean;
61
+ synced: string[];
62
+ failed: Array<{
63
+ operationId: string;
64
+ error: string;
65
+ }>;
66
+ conflicts: Array<{
67
+ operationId: string;
68
+ remoteVersion: Record<string, unknown>;
69
+ strategy: ResolutionStrategy;
70
+ }>;
71
+ }
72
+ /**
73
+ * Network state for adaptive sync
74
+ */
75
+ type NetworkState = 'online' | 'offline' | 'poor' | 'unknown';
76
+ /**
77
+ * Bandwidth profile for sync adaptation
78
+ */
79
+ interface BandwidthProfile {
80
+ bandwidth: number;
81
+ latency: number;
82
+ timestamp: number;
83
+ reliability: number;
84
+ }
85
+ /**
86
+ * Sync coordinator configuration
87
+ */
88
+ interface SyncCoordinatorConfig {
89
+ maxBatchSize: number;
90
+ maxBatchBytes: number;
91
+ maxRetries: number;
92
+ retryDelayMs: number;
93
+ enableCompression: boolean;
94
+ enableDeltaSync: boolean;
95
+ adaptateBatchSize: boolean;
96
+ }
97
+ /**
98
+ * Vector clock for causality tracking
99
+ */
100
+ interface VectorClock {
101
+ [nodeId: string]: number;
102
+ }
103
+ /**
104
+ * CRDT operation for conflict-free updates
105
+ */
106
+ interface CRDTOperation {
107
+ id: string;
108
+ type: 'insert' | 'delete' | 'update';
109
+ path: string[];
110
+ value?: unknown;
111
+ timestamp: number;
112
+ nodeId: string;
113
+ vectorClock: VectorClock;
114
+ }
115
+ /**
116
+ * Presence selection range
117
+ */
118
+ interface PresenceSelection {
119
+ start: number;
120
+ end: number;
121
+ direction?: 'forward' | 'backward' | 'none';
122
+ path?: string;
123
+ }
124
+ /**
125
+ * Presence typing signal
126
+ */
127
+ interface PresenceTyping {
128
+ isTyping: boolean;
129
+ field?: string;
130
+ isComposing?: boolean;
131
+ startedAt?: number;
132
+ stoppedAt?: number;
133
+ }
134
+ /**
135
+ * Presence scroll signal
136
+ */
137
+ interface PresenceScroll {
138
+ depth: number;
139
+ y?: number;
140
+ viewportHeight?: number;
141
+ documentHeight?: number;
142
+ path?: string;
143
+ }
144
+ /**
145
+ * Presence viewport signal
146
+ */
147
+ interface PresenceViewport {
148
+ width: number;
149
+ height: number;
150
+ }
151
+ /**
152
+ * Presence input signal
153
+ */
154
+ interface PresenceInputState {
155
+ field: string;
156
+ hasFocus: boolean;
157
+ valueLength?: number;
158
+ selectionStart?: number;
159
+ selectionEnd?: number;
160
+ isComposing?: boolean;
161
+ inputMode?: string;
162
+ }
163
+ /**
164
+ * Presence emotional state signal
165
+ */
166
+ interface PresenceEmotion {
167
+ primary?: string;
168
+ secondary?: string;
169
+ confidence?: number;
170
+ intensity?: number;
171
+ valence?: number;
172
+ arousal?: number;
173
+ dominance?: number;
174
+ source?: 'self-report' | 'inferred' | 'sensor' | 'hybrid';
175
+ updatedAt?: number;
176
+ }
177
+ /**
178
+ * Presence information for real-time collaboration
179
+ */
180
+ interface PresenceInfo {
181
+ userId: string;
182
+ nodeId: string;
183
+ cursor?: {
184
+ x: number;
185
+ y: number;
186
+ path?: string;
187
+ };
188
+ focusNode?: string;
189
+ selection?: PresenceSelection;
190
+ typing?: PresenceTyping;
191
+ scroll?: PresenceScroll;
192
+ viewport?: PresenceViewport;
193
+ inputState?: PresenceInputState;
194
+ emotion?: PresenceEmotion;
195
+ metadata?: Record<string, unknown>;
196
+ lastActivity: number;
197
+ }
198
+ /**
199
+ * Event emitter types
200
+ */
201
+ type EventCallback<T = unknown> = (data: T) => void;
202
+ type EventUnsubscribe = () => void;
203
+ /**
204
+ * Generic event emitter interface
205
+ */
206
+ interface IEventEmitter {
207
+ on<T = unknown>(event: string, callback: EventCallback<T>): EventUnsubscribe;
208
+ off(event: string, callback: EventCallback): void;
209
+ emit<T = unknown>(event: string, data?: T): void;
210
+ }
211
+
212
+ export type { BandwidthProfile as B, CRDTOperation as C, EventCallback as E, IEventEmitter as I, NetworkState as N, Operation as O, PresenceEmotion as P, ResolutionStrategy as R, SyncBatch as S, VectorClock as V, ConflictDetectionResult as a, EventUnsubscribe as b, OperationPriority as c, OperationStatus as d, OperationType as e, PresenceInfo as f, PresenceInputState as g, PresenceScroll as h, PresenceSelection as i, PresenceTyping as j, PresenceViewport as k, SyncCoordinatorConfig as l, SyncResult as m };
@@ -0,0 +1,212 @@
1
+ /**
2
+ * Aeon Core Types
3
+ *
4
+ * Shared type definitions for the Aeon synchronization and versioning system.
5
+ */
6
+ /**
7
+ * Operation type - what action is being performed
8
+ */
9
+ type OperationType = 'create' | 'update' | 'delete' | 'sync' | 'batch';
10
+ /**
11
+ * Operation priority for sync ordering
12
+ */
13
+ type OperationPriority = 'high' | 'normal' | 'low';
14
+ /**
15
+ * Operation sync status
16
+ */
17
+ type OperationStatus = 'pending' | 'syncing' | 'synced' | 'failed';
18
+ /**
19
+ * Queued operation for offline-first synchronization
20
+ */
21
+ interface Operation {
22
+ id: string;
23
+ type: OperationType;
24
+ sessionId: string;
25
+ status: OperationStatus;
26
+ data: Record<string, unknown>;
27
+ priority?: OperationPriority;
28
+ createdAt?: number;
29
+ syncedAt?: number;
30
+ retryCount?: number;
31
+ maxRetries?: number;
32
+ }
33
+ /**
34
+ * Conflict detection result
35
+ */
36
+ interface ConflictDetectionResult {
37
+ hasConflict: boolean;
38
+ type?: 'update_update' | 'delete_update' | 'update_delete' | 'concurrent';
39
+ severity?: 'low' | 'medium' | 'high';
40
+ similarity?: number;
41
+ }
42
+ /**
43
+ * Conflict resolution strategy
44
+ */
45
+ type ResolutionStrategy = 'local_wins' | 'remote_wins' | 'last_modified' | 'merge' | 'manual';
46
+ /**
47
+ * Sync batch for uploading multiple operations
48
+ */
49
+ interface SyncBatch {
50
+ batchId: string;
51
+ operations: Operation[];
52
+ totalSize: number;
53
+ createdAt: number;
54
+ priority: OperationPriority;
55
+ }
56
+ /**
57
+ * Sync result from server
58
+ */
59
+ interface SyncResult {
60
+ success: boolean;
61
+ synced: string[];
62
+ failed: Array<{
63
+ operationId: string;
64
+ error: string;
65
+ }>;
66
+ conflicts: Array<{
67
+ operationId: string;
68
+ remoteVersion: Record<string, unknown>;
69
+ strategy: ResolutionStrategy;
70
+ }>;
71
+ }
72
+ /**
73
+ * Network state for adaptive sync
74
+ */
75
+ type NetworkState = 'online' | 'offline' | 'poor' | 'unknown';
76
+ /**
77
+ * Bandwidth profile for sync adaptation
78
+ */
79
+ interface BandwidthProfile {
80
+ bandwidth: number;
81
+ latency: number;
82
+ timestamp: number;
83
+ reliability: number;
84
+ }
85
+ /**
86
+ * Sync coordinator configuration
87
+ */
88
+ interface SyncCoordinatorConfig {
89
+ maxBatchSize: number;
90
+ maxBatchBytes: number;
91
+ maxRetries: number;
92
+ retryDelayMs: number;
93
+ enableCompression: boolean;
94
+ enableDeltaSync: boolean;
95
+ adaptateBatchSize: boolean;
96
+ }
97
+ /**
98
+ * Vector clock for causality tracking
99
+ */
100
+ interface VectorClock {
101
+ [nodeId: string]: number;
102
+ }
103
+ /**
104
+ * CRDT operation for conflict-free updates
105
+ */
106
+ interface CRDTOperation {
107
+ id: string;
108
+ type: 'insert' | 'delete' | 'update';
109
+ path: string[];
110
+ value?: unknown;
111
+ timestamp: number;
112
+ nodeId: string;
113
+ vectorClock: VectorClock;
114
+ }
115
+ /**
116
+ * Presence selection range
117
+ */
118
+ interface PresenceSelection {
119
+ start: number;
120
+ end: number;
121
+ direction?: 'forward' | 'backward' | 'none';
122
+ path?: string;
123
+ }
124
+ /**
125
+ * Presence typing signal
126
+ */
127
+ interface PresenceTyping {
128
+ isTyping: boolean;
129
+ field?: string;
130
+ isComposing?: boolean;
131
+ startedAt?: number;
132
+ stoppedAt?: number;
133
+ }
134
+ /**
135
+ * Presence scroll signal
136
+ */
137
+ interface PresenceScroll {
138
+ depth: number;
139
+ y?: number;
140
+ viewportHeight?: number;
141
+ documentHeight?: number;
142
+ path?: string;
143
+ }
144
+ /**
145
+ * Presence viewport signal
146
+ */
147
+ interface PresenceViewport {
148
+ width: number;
149
+ height: number;
150
+ }
151
+ /**
152
+ * Presence input signal
153
+ */
154
+ interface PresenceInputState {
155
+ field: string;
156
+ hasFocus: boolean;
157
+ valueLength?: number;
158
+ selectionStart?: number;
159
+ selectionEnd?: number;
160
+ isComposing?: boolean;
161
+ inputMode?: string;
162
+ }
163
+ /**
164
+ * Presence emotional state signal
165
+ */
166
+ interface PresenceEmotion {
167
+ primary?: string;
168
+ secondary?: string;
169
+ confidence?: number;
170
+ intensity?: number;
171
+ valence?: number;
172
+ arousal?: number;
173
+ dominance?: number;
174
+ source?: 'self-report' | 'inferred' | 'sensor' | 'hybrid';
175
+ updatedAt?: number;
176
+ }
177
+ /**
178
+ * Presence information for real-time collaboration
179
+ */
180
+ interface PresenceInfo {
181
+ userId: string;
182
+ nodeId: string;
183
+ cursor?: {
184
+ x: number;
185
+ y: number;
186
+ path?: string;
187
+ };
188
+ focusNode?: string;
189
+ selection?: PresenceSelection;
190
+ typing?: PresenceTyping;
191
+ scroll?: PresenceScroll;
192
+ viewport?: PresenceViewport;
193
+ inputState?: PresenceInputState;
194
+ emotion?: PresenceEmotion;
195
+ metadata?: Record<string, unknown>;
196
+ lastActivity: number;
197
+ }
198
+ /**
199
+ * Event emitter types
200
+ */
201
+ type EventCallback<T = unknown> = (data: T) => void;
202
+ type EventUnsubscribe = () => void;
203
+ /**
204
+ * Generic event emitter interface
205
+ */
206
+ interface IEventEmitter {
207
+ on<T = unknown>(event: string, callback: EventCallback<T>): EventUnsubscribe;
208
+ off(event: string, callback: EventCallback): void;
209
+ emit<T = unknown>(event: string, data?: T): void;
210
+ }
211
+
212
+ export type { BandwidthProfile as B, CRDTOperation as C, EventCallback as E, IEventEmitter as I, NetworkState as N, Operation as O, PresenceEmotion as P, ResolutionStrategy as R, SyncBatch as S, VectorClock as V, ConflictDetectionResult as a, EventUnsubscribe as b, OperationPriority as c, OperationStatus as d, OperationType as e, PresenceInfo as f, PresenceInputState as g, PresenceScroll as h, PresenceSelection as i, PresenceTyping as j, PresenceViewport as k, SyncCoordinatorConfig as l, SyncResult as m };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a0n/aeon",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "Distributed synchronization, schema versioning, and conflict resolution for real-time collaborative applications",
5
5
  "keywords": [
6
6
  "distributed",
@@ -150,12 +150,22 @@
150
150
  "README.md",
151
151
  "LICENSE"
152
152
  ],
153
- "dependencies": {
154
- "eventemitter3": "^5.0.4"
153
+ "scripts": {
154
+ "build": "tsup",
155
+ "dev": "tsup --watch",
156
+ "test": "vitest run",
157
+ "test:watch": "vitest",
158
+ "test:coverage": "vitest run --coverage",
159
+ "lint": "eslint src --ext .ts",
160
+ "lint:fix": "eslint src --ext .ts --fix",
161
+ "format": "prettier --write src",
162
+ "type-check": "tsc --noEmit",
163
+ "clean": "rm -rf dist",
164
+ "prepublishOnly": "npm run build"
155
165
  },
156
166
  "peerDependencies": {
157
167
  "@affectively/auth": "^0.1.0",
158
- "@a0n/aeon-flux-react": "5.0.0"
168
+ "@a0n/aeon-flux-react": "workspace:*"
159
169
  },
160
170
  "peerDependenciesMeta": {
161
171
  "@affectively/auth": {
@@ -178,17 +188,5 @@
178
188
  },
179
189
  "publishConfig": {
180
190
  "access": "public"
181
- },
182
- "scripts": {
183
- "build": "tsup",
184
- "dev": "tsup --watch",
185
- "test": "vitest run",
186
- "test:watch": "vitest",
187
- "test:coverage": "vitest run --coverage",
188
- "lint": "eslint src --ext .ts",
189
- "lint:fix": "eslint src --ext .ts --fix",
190
- "format": "prettier --write src",
191
- "type-check": "tsc --noEmit",
192
- "clean": "rm -rf dist"
193
191
  }
194
- }
192
+ }