@affectively/aeon 1.3.0 → 5.0.1
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/LICENSE +5 -11
- package/README.md +90 -10
- package/dist/compression/index.cjs +20 -3
- package/dist/compression/index.cjs.map +1 -1
- package/dist/compression/index.js +20 -3
- package/dist/compression/index.js.map +1 -1
- package/dist/crypto/index.cjs +30 -0
- package/dist/crypto/index.cjs.map +1 -1
- package/dist/crypto/index.js +29 -1
- package/dist/crypto/index.js.map +1 -1
- package/dist/distributed/index.cjs +15 -8
- package/dist/distributed/index.cjs.map +1 -1
- package/dist/distributed/index.js +15 -8
- package/dist/distributed/index.js.map +1 -1
- package/dist/index.cjs +2923 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2879 -47
- package/dist/index.js.map +1 -1
- package/dist/optimization/index.cjs +6 -3
- package/dist/optimization/index.cjs.map +1 -1
- package/dist/optimization/index.js +6 -3
- package/dist/optimization/index.js.map +1 -1
- package/dist/persistence/index.cjs +91 -29
- package/dist/persistence/index.cjs.map +1 -1
- package/dist/persistence/index.js +91 -29
- package/dist/persistence/index.js.map +1 -1
- package/dist/presence/index.cjs.map +1 -1
- package/dist/presence/index.js.map +1 -1
- package/dist/versioning/index.cjs +4 -3
- package/dist/versioning/index.cjs.map +1 -1
- package/dist/versioning/index.js +4 -3
- package/dist/versioning/index.js.map +1 -1
- package/package.json +7 -8
- package/dist/compression/index.d.cts +0 -189
- package/dist/compression/index.d.ts +0 -189
- package/dist/core/index.d.cts +0 -216
- package/dist/core/index.d.ts +0 -216
- package/dist/crypto/index.d.cts +0 -446
- package/dist/crypto/index.d.ts +0 -446
- package/dist/distributed/index.d.cts +0 -1016
- package/dist/distributed/index.d.ts +0 -1016
- package/dist/index.d.cts +0 -12
- package/dist/index.d.ts +0 -12
- package/dist/offline/index.d.cts +0 -154
- package/dist/offline/index.d.ts +0 -154
- package/dist/optimization/index.d.cts +0 -347
- package/dist/optimization/index.d.ts +0 -347
- package/dist/persistence/index.d.cts +0 -63
- package/dist/persistence/index.d.ts +0 -63
- package/dist/presence/index.d.cts +0 -283
- package/dist/presence/index.d.ts +0 -283
- package/dist/types-B7gCpNX9.d.cts +0 -33
- package/dist/types-B7gCpNX9.d.ts +0 -33
- package/dist/utils/index.d.cts +0 -38
- package/dist/utils/index.d.ts +0 -38
- package/dist/versioning/index.d.cts +0 -537
- package/dist/versioning/index.d.ts +0 -537
package/dist/index.d.cts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { BandwidthProfile, CRDTOperation, ConflictDetectionResult, EventCallback, EventUnsubscribe, IEventEmitter, NetworkState, Operation, OperationPriority, OperationStatus, OperationType, PresenceEmotion, PresenceInfo, PresenceInputState, PresenceScroll, PresenceSelection, PresenceTyping, PresenceViewport, ResolutionStrategy, SyncBatch, SyncCoordinatorConfig, SyncResult, VectorClock } from './core/index.cjs';
|
|
2
|
-
export { Logger, createNamespacedLogger, disableLogging, getLogger, logger, resetLogger, setLogger } from './utils/index.cjs';
|
|
3
|
-
export { DashStorageAdapter, DashStorageAdapterOptions, DashStorageBackend, DashStorageChange, DashSyncClient, InMemoryStorageAdapter } from './persistence/index.cjs';
|
|
4
|
-
export { P as PersistedEnvelope, a as PersistenceDeserializer, b as PersistenceSerializer, S as StorageAdapter } from './types-B7gCpNX9.cjs';
|
|
5
|
-
export { CompatibilityRule, DataTransformer, FieldTransformer, Migration, MigrationEngine, MigrationIntegrityEntry, MigrationRecord, MigrationResult, MigrationState, MigrationTracker, MigrationTrackerOptions, MigrationTrackerPersistenceConfig, MigrationTrackerPersistenceData, RollbackPath, SchemaVersion, SchemaVersionManager, TransformationResult, TransformationRule, VersionMetadata } from './versioning/index.cjs';
|
|
6
|
-
export { Handshake, MergeStrategy, ProtocolError, ReconciliationResult, Replica, ReplicationEvent, ReplicationManager, ReplicationManagerOptions, ReplicationPersistenceConfig, ReplicationPersistenceData, ReplicationPolicy, StateDiff, StateReconciler, StateVersion, SyncCoordinator, SyncEvent, SyncMessage, SyncNode, SyncProtocol, SyncProtocolOptions, SyncProtocolPersistenceConfig, SyncProtocolPersistenceData, SyncRequest, SyncResponse, SyncSession } from './distributed/index.cjs';
|
|
7
|
-
export { OfflineOperation, OfflineOperationQueue, OfflineOperationQueueOptions, OfflineQueueEvents, OfflineQueuePersistenceConfig, OfflineQueueStats, getOfflineOperationQueue, resetOfflineOperationQueue } from './offline/index.cjs';
|
|
8
|
-
export { CompressedBatch, CompressedChunk, CompressionEngine, CompressionStats, DeltaBatch, DeltaOperation, DeltaStats, DeltaSyncOptimizer, getCompressionEngine, getDeltaSyncOptimizer, resetCompressionEngine, resetDeltaSyncOptimizer } from './compression/index.cjs';
|
|
9
|
-
export { ActivityPattern, AdaptiveCompressionOptimizer, AdaptiveStats, BatchTimingOptimizer, BatchTimingStats, CompressionRecommendation, DeviceProfile, NetworkProfile, NetworkWindow, OperationPattern, OperationPrediction, PrefetchedBatch, PrefetchingEngine, PrefetchingStats, SchedulingDecision, getAdaptiveCompressionOptimizer, getBatchTimingOptimizer, getPrefetchingEngine, resetAdaptiveCompressionOptimizer, resetBatchTimingOptimizer, resetPrefetchingEngine } from './optimization/index.cjs';
|
|
10
|
-
export { AgentEmotionState, AgentInputState, AgentPresence, AgentPresenceManager, AgentScrollState, AgentSelectionRange, AgentTypingState, AgentViewportState, PresenceEvents, PresenceUpdate, clearAgentPresenceManager, getAgentPresenceManager } from './presence/index.cjs';
|
|
11
|
-
export { AEON_CAPABILITIES, AeonCapability, AeonCapabilityResult, AeonCryptoConfig, AeonEncryptionMode, AuthenticatedMessageFields, Capability, DEFAULT_CRYPTO_CONFIG, DID, DecryptionResult, DomainCategory, ECKeyPair, EncryptedPayload, EncryptionAlgorithm, ICryptoProvider, Identity, KeyPair, NullCryptoProvider, SecureNodeInfo, SecureSyncSession, SignedSyncData, SigningAlgorithm, UCANPayload, UCANToken, VerificationResult } from './crypto/index.cjs';
|
|
12
|
-
import 'eventemitter3';
|
package/dist/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { BandwidthProfile, CRDTOperation, ConflictDetectionResult, EventCallback, EventUnsubscribe, IEventEmitter, NetworkState, Operation, OperationPriority, OperationStatus, OperationType, PresenceEmotion, PresenceInfo, PresenceInputState, PresenceScroll, PresenceSelection, PresenceTyping, PresenceViewport, ResolutionStrategy, SyncBatch, SyncCoordinatorConfig, SyncResult, VectorClock } from './core/index.js';
|
|
2
|
-
export { Logger, createNamespacedLogger, disableLogging, getLogger, logger, resetLogger, setLogger } from './utils/index.js';
|
|
3
|
-
export { DashStorageAdapter, DashStorageAdapterOptions, DashStorageBackend, DashStorageChange, DashSyncClient, InMemoryStorageAdapter } from './persistence/index.js';
|
|
4
|
-
export { P as PersistedEnvelope, a as PersistenceDeserializer, b as PersistenceSerializer, S as StorageAdapter } from './types-B7gCpNX9.js';
|
|
5
|
-
export { CompatibilityRule, DataTransformer, FieldTransformer, Migration, MigrationEngine, MigrationIntegrityEntry, MigrationRecord, MigrationResult, MigrationState, MigrationTracker, MigrationTrackerOptions, MigrationTrackerPersistenceConfig, MigrationTrackerPersistenceData, RollbackPath, SchemaVersion, SchemaVersionManager, TransformationResult, TransformationRule, VersionMetadata } from './versioning/index.js';
|
|
6
|
-
export { Handshake, MergeStrategy, ProtocolError, ReconciliationResult, Replica, ReplicationEvent, ReplicationManager, ReplicationManagerOptions, ReplicationPersistenceConfig, ReplicationPersistenceData, ReplicationPolicy, StateDiff, StateReconciler, StateVersion, SyncCoordinator, SyncEvent, SyncMessage, SyncNode, SyncProtocol, SyncProtocolOptions, SyncProtocolPersistenceConfig, SyncProtocolPersistenceData, SyncRequest, SyncResponse, SyncSession } from './distributed/index.js';
|
|
7
|
-
export { OfflineOperation, OfflineOperationQueue, OfflineOperationQueueOptions, OfflineQueueEvents, OfflineQueuePersistenceConfig, OfflineQueueStats, getOfflineOperationQueue, resetOfflineOperationQueue } from './offline/index.js';
|
|
8
|
-
export { CompressedBatch, CompressedChunk, CompressionEngine, CompressionStats, DeltaBatch, DeltaOperation, DeltaStats, DeltaSyncOptimizer, getCompressionEngine, getDeltaSyncOptimizer, resetCompressionEngine, resetDeltaSyncOptimizer } from './compression/index.js';
|
|
9
|
-
export { ActivityPattern, AdaptiveCompressionOptimizer, AdaptiveStats, BatchTimingOptimizer, BatchTimingStats, CompressionRecommendation, DeviceProfile, NetworkProfile, NetworkWindow, OperationPattern, OperationPrediction, PrefetchedBatch, PrefetchingEngine, PrefetchingStats, SchedulingDecision, getAdaptiveCompressionOptimizer, getBatchTimingOptimizer, getPrefetchingEngine, resetAdaptiveCompressionOptimizer, resetBatchTimingOptimizer, resetPrefetchingEngine } from './optimization/index.js';
|
|
10
|
-
export { AgentEmotionState, AgentInputState, AgentPresence, AgentPresenceManager, AgentScrollState, AgentSelectionRange, AgentTypingState, AgentViewportState, PresenceEvents, PresenceUpdate, clearAgentPresenceManager, getAgentPresenceManager } from './presence/index.js';
|
|
11
|
-
export { AEON_CAPABILITIES, AeonCapability, AeonCapabilityResult, AeonCryptoConfig, AeonEncryptionMode, AuthenticatedMessageFields, Capability, DEFAULT_CRYPTO_CONFIG, DID, DecryptionResult, DomainCategory, ECKeyPair, EncryptedPayload, EncryptionAlgorithm, ICryptoProvider, Identity, KeyPair, NullCryptoProvider, SecureNodeInfo, SecureSyncSession, SignedSyncData, SigningAlgorithm, UCANPayload, UCANToken, VerificationResult } from './crypto/index.js';
|
|
12
|
-
import 'eventemitter3';
|
package/dist/offline/index.d.cts
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'eventemitter3';
|
|
2
|
-
import { Operation, OperationPriority } from '../core/index.cjs';
|
|
3
|
-
import { S as StorageAdapter, b as PersistenceSerializer, a as PersistenceDeserializer } from '../types-B7gCpNX9.cjs';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Offline Operation Queue (Phase 11)
|
|
7
|
-
*
|
|
8
|
-
* Manages pending operations for offline-first clients.
|
|
9
|
-
* Provides priority-based queuing, persistence, and retry logic.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
interface OfflineOperation {
|
|
13
|
-
id: string;
|
|
14
|
-
type: Operation['type'];
|
|
15
|
-
data: Record<string, unknown>;
|
|
16
|
-
sessionId: string;
|
|
17
|
-
priority: OperationPriority;
|
|
18
|
-
createdAt: number;
|
|
19
|
-
retryCount: number;
|
|
20
|
-
maxRetries: number;
|
|
21
|
-
lastError?: string;
|
|
22
|
-
status: 'pending' | 'syncing' | 'failed' | 'synced';
|
|
23
|
-
}
|
|
24
|
-
interface OfflineQueueStats {
|
|
25
|
-
pending: number;
|
|
26
|
-
syncing: number;
|
|
27
|
-
failed: number;
|
|
28
|
-
synced: number;
|
|
29
|
-
totalOperations: number;
|
|
30
|
-
oldestPendingMs: number;
|
|
31
|
-
averageRetries: number;
|
|
32
|
-
}
|
|
33
|
-
interface OfflineQueueEvents {
|
|
34
|
-
'operation-added': (operation: OfflineOperation) => void;
|
|
35
|
-
'operation-synced': (operation: OfflineOperation) => void;
|
|
36
|
-
'operation-failed': (operation: OfflineOperation, error: Error) => void;
|
|
37
|
-
'queue-empty': () => void;
|
|
38
|
-
'sync-started': () => void;
|
|
39
|
-
'sync-completed': (stats: { synced: number; failed: number }) => void;
|
|
40
|
-
}
|
|
41
|
-
interface OfflineQueuePersistenceConfig {
|
|
42
|
-
adapter: StorageAdapter;
|
|
43
|
-
key?: string;
|
|
44
|
-
autoPersist?: boolean;
|
|
45
|
-
autoLoad?: boolean;
|
|
46
|
-
persistDebounceMs?: number;
|
|
47
|
-
serializer?: PersistenceSerializer<OfflineOperation[]>;
|
|
48
|
-
deserializer?: PersistenceDeserializer<OfflineOperation[]>;
|
|
49
|
-
}
|
|
50
|
-
interface OfflineOperationQueueOptions {
|
|
51
|
-
maxQueueSize?: number;
|
|
52
|
-
defaultMaxRetries?: number;
|
|
53
|
-
persistence?: OfflineQueuePersistenceConfig;
|
|
54
|
-
}
|
|
55
|
-
declare class OfflineOperationQueue extends EventEmitter<OfflineQueueEvents> {
|
|
56
|
-
private static readonly DEFAULT_PERSIST_KEY;
|
|
57
|
-
private queue;
|
|
58
|
-
private syncingIds;
|
|
59
|
-
private maxQueueSize;
|
|
60
|
-
private defaultMaxRetries;
|
|
61
|
-
private persistence;
|
|
62
|
-
private persistTimer;
|
|
63
|
-
private persistInFlight;
|
|
64
|
-
private persistPending;
|
|
65
|
-
constructor(
|
|
66
|
-
maxQueueSizeOrOptions?: number | OfflineOperationQueueOptions,
|
|
67
|
-
defaultMaxRetries?: number
|
|
68
|
-
);
|
|
69
|
-
/**
|
|
70
|
-
* Add operation to the queue
|
|
71
|
-
*/
|
|
72
|
-
enqueue(
|
|
73
|
-
type: Operation['type'],
|
|
74
|
-
data: Record<string, unknown>,
|
|
75
|
-
sessionId: string,
|
|
76
|
-
priority?: OperationPriority,
|
|
77
|
-
maxRetries?: number
|
|
78
|
-
): OfflineOperation;
|
|
79
|
-
/**
|
|
80
|
-
* Get next operations to sync (by priority)
|
|
81
|
-
*/
|
|
82
|
-
getNextBatch(batchSize?: number): OfflineOperation[];
|
|
83
|
-
/**
|
|
84
|
-
* Mark operations as syncing
|
|
85
|
-
*/
|
|
86
|
-
markSyncing(operationIds: string[]): void;
|
|
87
|
-
/**
|
|
88
|
-
* Mark operation as synced
|
|
89
|
-
*/
|
|
90
|
-
markSynced(operationId: string): void;
|
|
91
|
-
/**
|
|
92
|
-
* Mark operation as failed
|
|
93
|
-
*/
|
|
94
|
-
markFailed(operationId: string, error: Error): void;
|
|
95
|
-
/**
|
|
96
|
-
* Get operation by ID
|
|
97
|
-
*/
|
|
98
|
-
getOperation(operationId: string): OfflineOperation | undefined;
|
|
99
|
-
/**
|
|
100
|
-
* Get all pending operations
|
|
101
|
-
*/
|
|
102
|
-
getPendingOperations(): OfflineOperation[];
|
|
103
|
-
/**
|
|
104
|
-
* Get pending count
|
|
105
|
-
*/
|
|
106
|
-
getPendingCount(): number;
|
|
107
|
-
/**
|
|
108
|
-
* Get queue statistics
|
|
109
|
-
*/
|
|
110
|
-
getStats(): OfflineQueueStats;
|
|
111
|
-
/**
|
|
112
|
-
* Clear all operations
|
|
113
|
-
*/
|
|
114
|
-
clear(): void;
|
|
115
|
-
/**
|
|
116
|
-
* Clear failed operations
|
|
117
|
-
*/
|
|
118
|
-
clearFailed(): void;
|
|
119
|
-
/**
|
|
120
|
-
* Retry failed operations
|
|
121
|
-
*/
|
|
122
|
-
retryFailed(): void;
|
|
123
|
-
/**
|
|
124
|
-
* Find oldest low-priority operation
|
|
125
|
-
*/
|
|
126
|
-
private findOldestLowPriority;
|
|
127
|
-
/**
|
|
128
|
-
* Export queue for persistence
|
|
129
|
-
*/
|
|
130
|
-
export(): OfflineOperation[];
|
|
131
|
-
/**
|
|
132
|
-
* Import queue from persistence
|
|
133
|
-
*/
|
|
134
|
-
import(operations: OfflineOperation[]): void;
|
|
135
|
-
/**
|
|
136
|
-
* Persist current queue snapshot.
|
|
137
|
-
*/
|
|
138
|
-
saveToPersistence(): Promise<void>;
|
|
139
|
-
/**
|
|
140
|
-
* Load queue snapshot from persistence.
|
|
141
|
-
*/
|
|
142
|
-
loadFromPersistence(): Promise<number>;
|
|
143
|
-
/**
|
|
144
|
-
* Remove persisted queue snapshot.
|
|
145
|
-
*/
|
|
146
|
-
clearPersistence(): Promise<void>;
|
|
147
|
-
private schedulePersist;
|
|
148
|
-
private persistSafely;
|
|
149
|
-
private isValidOfflineOperation;
|
|
150
|
-
}
|
|
151
|
-
declare function getOfflineOperationQueue(): OfflineOperationQueue;
|
|
152
|
-
declare function resetOfflineOperationQueue(): void;
|
|
153
|
-
|
|
154
|
-
export { type OfflineOperation, OfflineOperationQueue, type OfflineOperationQueueOptions, type OfflineQueueEvents, type OfflineQueuePersistenceConfig, type OfflineQueueStats, OperationPriority, getOfflineOperationQueue, resetOfflineOperationQueue };
|
package/dist/offline/index.d.ts
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'eventemitter3';
|
|
2
|
-
import { Operation, OperationPriority } from '../core/index.js';
|
|
3
|
-
import { S as StorageAdapter, b as PersistenceSerializer, a as PersistenceDeserializer } from '../types-B7gCpNX9.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Offline Operation Queue (Phase 11)
|
|
7
|
-
*
|
|
8
|
-
* Manages pending operations for offline-first clients.
|
|
9
|
-
* Provides priority-based queuing, persistence, and retry logic.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
interface OfflineOperation {
|
|
13
|
-
id: string;
|
|
14
|
-
type: Operation['type'];
|
|
15
|
-
data: Record<string, unknown>;
|
|
16
|
-
sessionId: string;
|
|
17
|
-
priority: OperationPriority;
|
|
18
|
-
createdAt: number;
|
|
19
|
-
retryCount: number;
|
|
20
|
-
maxRetries: number;
|
|
21
|
-
lastError?: string;
|
|
22
|
-
status: 'pending' | 'syncing' | 'failed' | 'synced';
|
|
23
|
-
}
|
|
24
|
-
interface OfflineQueueStats {
|
|
25
|
-
pending: number;
|
|
26
|
-
syncing: number;
|
|
27
|
-
failed: number;
|
|
28
|
-
synced: number;
|
|
29
|
-
totalOperations: number;
|
|
30
|
-
oldestPendingMs: number;
|
|
31
|
-
averageRetries: number;
|
|
32
|
-
}
|
|
33
|
-
interface OfflineQueueEvents {
|
|
34
|
-
'operation-added': (operation: OfflineOperation) => void;
|
|
35
|
-
'operation-synced': (operation: OfflineOperation) => void;
|
|
36
|
-
'operation-failed': (operation: OfflineOperation, error: Error) => void;
|
|
37
|
-
'queue-empty': () => void;
|
|
38
|
-
'sync-started': () => void;
|
|
39
|
-
'sync-completed': (stats: { synced: number; failed: number }) => void;
|
|
40
|
-
}
|
|
41
|
-
interface OfflineQueuePersistenceConfig {
|
|
42
|
-
adapter: StorageAdapter;
|
|
43
|
-
key?: string;
|
|
44
|
-
autoPersist?: boolean;
|
|
45
|
-
autoLoad?: boolean;
|
|
46
|
-
persistDebounceMs?: number;
|
|
47
|
-
serializer?: PersistenceSerializer<OfflineOperation[]>;
|
|
48
|
-
deserializer?: PersistenceDeserializer<OfflineOperation[]>;
|
|
49
|
-
}
|
|
50
|
-
interface OfflineOperationQueueOptions {
|
|
51
|
-
maxQueueSize?: number;
|
|
52
|
-
defaultMaxRetries?: number;
|
|
53
|
-
persistence?: OfflineQueuePersistenceConfig;
|
|
54
|
-
}
|
|
55
|
-
declare class OfflineOperationQueue extends EventEmitter<OfflineQueueEvents> {
|
|
56
|
-
private static readonly DEFAULT_PERSIST_KEY;
|
|
57
|
-
private queue;
|
|
58
|
-
private syncingIds;
|
|
59
|
-
private maxQueueSize;
|
|
60
|
-
private defaultMaxRetries;
|
|
61
|
-
private persistence;
|
|
62
|
-
private persistTimer;
|
|
63
|
-
private persistInFlight;
|
|
64
|
-
private persistPending;
|
|
65
|
-
constructor(
|
|
66
|
-
maxQueueSizeOrOptions?: number | OfflineOperationQueueOptions,
|
|
67
|
-
defaultMaxRetries?: number
|
|
68
|
-
);
|
|
69
|
-
/**
|
|
70
|
-
* Add operation to the queue
|
|
71
|
-
*/
|
|
72
|
-
enqueue(
|
|
73
|
-
type: Operation['type'],
|
|
74
|
-
data: Record<string, unknown>,
|
|
75
|
-
sessionId: string,
|
|
76
|
-
priority?: OperationPriority,
|
|
77
|
-
maxRetries?: number
|
|
78
|
-
): OfflineOperation;
|
|
79
|
-
/**
|
|
80
|
-
* Get next operations to sync (by priority)
|
|
81
|
-
*/
|
|
82
|
-
getNextBatch(batchSize?: number): OfflineOperation[];
|
|
83
|
-
/**
|
|
84
|
-
* Mark operations as syncing
|
|
85
|
-
*/
|
|
86
|
-
markSyncing(operationIds: string[]): void;
|
|
87
|
-
/**
|
|
88
|
-
* Mark operation as synced
|
|
89
|
-
*/
|
|
90
|
-
markSynced(operationId: string): void;
|
|
91
|
-
/**
|
|
92
|
-
* Mark operation as failed
|
|
93
|
-
*/
|
|
94
|
-
markFailed(operationId: string, error: Error): void;
|
|
95
|
-
/**
|
|
96
|
-
* Get operation by ID
|
|
97
|
-
*/
|
|
98
|
-
getOperation(operationId: string): OfflineOperation | undefined;
|
|
99
|
-
/**
|
|
100
|
-
* Get all pending operations
|
|
101
|
-
*/
|
|
102
|
-
getPendingOperations(): OfflineOperation[];
|
|
103
|
-
/**
|
|
104
|
-
* Get pending count
|
|
105
|
-
*/
|
|
106
|
-
getPendingCount(): number;
|
|
107
|
-
/**
|
|
108
|
-
* Get queue statistics
|
|
109
|
-
*/
|
|
110
|
-
getStats(): OfflineQueueStats;
|
|
111
|
-
/**
|
|
112
|
-
* Clear all operations
|
|
113
|
-
*/
|
|
114
|
-
clear(): void;
|
|
115
|
-
/**
|
|
116
|
-
* Clear failed operations
|
|
117
|
-
*/
|
|
118
|
-
clearFailed(): void;
|
|
119
|
-
/**
|
|
120
|
-
* Retry failed operations
|
|
121
|
-
*/
|
|
122
|
-
retryFailed(): void;
|
|
123
|
-
/**
|
|
124
|
-
* Find oldest low-priority operation
|
|
125
|
-
*/
|
|
126
|
-
private findOldestLowPriority;
|
|
127
|
-
/**
|
|
128
|
-
* Export queue for persistence
|
|
129
|
-
*/
|
|
130
|
-
export(): OfflineOperation[];
|
|
131
|
-
/**
|
|
132
|
-
* Import queue from persistence
|
|
133
|
-
*/
|
|
134
|
-
import(operations: OfflineOperation[]): void;
|
|
135
|
-
/**
|
|
136
|
-
* Persist current queue snapshot.
|
|
137
|
-
*/
|
|
138
|
-
saveToPersistence(): Promise<void>;
|
|
139
|
-
/**
|
|
140
|
-
* Load queue snapshot from persistence.
|
|
141
|
-
*/
|
|
142
|
-
loadFromPersistence(): Promise<number>;
|
|
143
|
-
/**
|
|
144
|
-
* Remove persisted queue snapshot.
|
|
145
|
-
*/
|
|
146
|
-
clearPersistence(): Promise<void>;
|
|
147
|
-
private schedulePersist;
|
|
148
|
-
private persistSafely;
|
|
149
|
-
private isValidOfflineOperation;
|
|
150
|
-
}
|
|
151
|
-
declare function getOfflineOperationQueue(): OfflineOperationQueue;
|
|
152
|
-
declare function resetOfflineOperationQueue(): void;
|
|
153
|
-
|
|
154
|
-
export { type OfflineOperation, OfflineOperationQueue, type OfflineOperationQueueOptions, type OfflineQueueEvents, type OfflineQueuePersistenceConfig, type OfflineQueueStats, OperationPriority, getOfflineOperationQueue, resetOfflineOperationQueue };
|
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
import { Operation } from '../core/index.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Prefetching Engine (Phase 13)
|
|
5
|
-
*
|
|
6
|
-
* Predictively pre-compresses batches based on detected operation patterns.
|
|
7
|
-
* Analyzes historical data to predict which operations are most likely to occur.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Pattern in operation sequence
|
|
12
|
-
*/
|
|
13
|
-
interface OperationPattern {
|
|
14
|
-
sequence: string[];
|
|
15
|
-
frequency: number;
|
|
16
|
-
probability: number;
|
|
17
|
-
lastOccurred: number;
|
|
18
|
-
avgIntervalMs: number;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Prediction for next operations
|
|
22
|
-
*/
|
|
23
|
-
interface OperationPrediction {
|
|
24
|
-
operationType: string;
|
|
25
|
-
probability: number;
|
|
26
|
-
reason: string;
|
|
27
|
-
shouldPrefetch: boolean;
|
|
28
|
-
estimatedTimeMs: number;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Prefetched batch
|
|
32
|
-
*/
|
|
33
|
-
interface PrefetchedBatch {
|
|
34
|
-
id: string;
|
|
35
|
-
operationType: string;
|
|
36
|
-
compressed: Uint8Array;
|
|
37
|
-
compressedSize: number;
|
|
38
|
-
originalSize: number;
|
|
39
|
-
compressionRatio: number;
|
|
40
|
-
compressed_at: number;
|
|
41
|
-
created_at: number;
|
|
42
|
-
ttl: number;
|
|
43
|
-
expiresAt: number;
|
|
44
|
-
hitCount: number;
|
|
45
|
-
missCount: number;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Prefetching statistics
|
|
49
|
-
*/
|
|
50
|
-
interface PrefetchingStats {
|
|
51
|
-
totalPrefetched: number;
|
|
52
|
-
totalHits: number;
|
|
53
|
-
totalMisses: number;
|
|
54
|
-
totalOverwrites: number;
|
|
55
|
-
hitRatio: number;
|
|
56
|
-
bandwidthSaved: number;
|
|
57
|
-
patternsDetected: number;
|
|
58
|
-
predictionAccuracy: number;
|
|
59
|
-
}
|
|
60
|
-
declare class PrefetchingEngine {
|
|
61
|
-
private operationHistory;
|
|
62
|
-
private patterns;
|
|
63
|
-
private prefetchCache;
|
|
64
|
-
private maxHistoryEntries;
|
|
65
|
-
private maxCachePerType;
|
|
66
|
-
private prefetchTTL;
|
|
67
|
-
private predictionThreshold;
|
|
68
|
-
private stats;
|
|
69
|
-
private lastPredictionTime;
|
|
70
|
-
private predictionInterval;
|
|
71
|
-
constructor();
|
|
72
|
-
/**
|
|
73
|
-
* Record operation for pattern analysis
|
|
74
|
-
*/
|
|
75
|
-
recordOperation(operationType: string, size: number): void;
|
|
76
|
-
/**
|
|
77
|
-
* Analyze patterns in operation history
|
|
78
|
-
*/
|
|
79
|
-
private analyzePatterns;
|
|
80
|
-
/**
|
|
81
|
-
* Predict next operations
|
|
82
|
-
*/
|
|
83
|
-
predictNextOperations(recentOperations: Operation[]): OperationPrediction[];
|
|
84
|
-
/**
|
|
85
|
-
* Add prefetched batch
|
|
86
|
-
*/
|
|
87
|
-
addPrefetchedBatch(operationType: string, compressed: Uint8Array, originalSize: number): PrefetchedBatch;
|
|
88
|
-
/**
|
|
89
|
-
* Try to use prefetched batch
|
|
90
|
-
*/
|
|
91
|
-
getPrefetchedBatch(operationType: string): PrefetchedBatch | null;
|
|
92
|
-
/**
|
|
93
|
-
* Update prediction accuracy metric
|
|
94
|
-
*/
|
|
95
|
-
private updatePredictionAccuracy;
|
|
96
|
-
/**
|
|
97
|
-
* Clean expired prefetches
|
|
98
|
-
*/
|
|
99
|
-
private cleanExpiredPrefetches;
|
|
100
|
-
/**
|
|
101
|
-
* Get statistics
|
|
102
|
-
*/
|
|
103
|
-
getStats(): PrefetchingStats;
|
|
104
|
-
/**
|
|
105
|
-
* Clear all caches
|
|
106
|
-
*/
|
|
107
|
-
clear(): void;
|
|
108
|
-
}
|
|
109
|
-
declare function getPrefetchingEngine(): PrefetchingEngine;
|
|
110
|
-
declare function resetPrefetchingEngine(): void;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Batch Timing Optimizer (Phase 13)
|
|
114
|
-
*
|
|
115
|
-
* Intelligently schedules batch transmission based on network conditions,
|
|
116
|
-
* device resources, and user activity patterns.
|
|
117
|
-
*/
|
|
118
|
-
/**
|
|
119
|
-
* Network window quality assessment
|
|
120
|
-
*/
|
|
121
|
-
interface NetworkWindow {
|
|
122
|
-
startTime: number;
|
|
123
|
-
endTime: number;
|
|
124
|
-
expectedDurationMs: number;
|
|
125
|
-
latencyMs: number;
|
|
126
|
-
bandwidthMbps: number;
|
|
127
|
-
quality: 'excellent' | 'good' | 'fair' | 'poor';
|
|
128
|
-
isStable: boolean;
|
|
129
|
-
congestionLevel: number;
|
|
130
|
-
recommendedBatchSize: number;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Activity pattern
|
|
134
|
-
*/
|
|
135
|
-
interface ActivityPattern {
|
|
136
|
-
type: 'user-active' | 'idle' | 'background' | 'sleep';
|
|
137
|
-
startTime: number;
|
|
138
|
-
duration: number;
|
|
139
|
-
probability: number;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Batch scheduling decision
|
|
143
|
-
*/
|
|
144
|
-
interface SchedulingDecision {
|
|
145
|
-
shouldSendNow: boolean;
|
|
146
|
-
nextOptimalWindowMs: number;
|
|
147
|
-
recommendedDelay: number;
|
|
148
|
-
reason: string;
|
|
149
|
-
priority: 'critical' | 'high' | 'normal' | 'low';
|
|
150
|
-
estimatedDeliveryMs: number;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Batch timing statistics
|
|
154
|
-
*/
|
|
155
|
-
interface BatchTimingStats {
|
|
156
|
-
totalBatches: number;
|
|
157
|
-
immediateDeliveries: number;
|
|
158
|
-
deferredBatches: number;
|
|
159
|
-
averageWaitTimeMs: number;
|
|
160
|
-
averageDeliveryTimeMs: number;
|
|
161
|
-
networkWindowsUsed: number;
|
|
162
|
-
congestionAvoided: number;
|
|
163
|
-
userFocusedOptimizations: number;
|
|
164
|
-
}
|
|
165
|
-
declare class BatchTimingOptimizer {
|
|
166
|
-
private networkHistory;
|
|
167
|
-
private activityHistory;
|
|
168
|
-
private stats;
|
|
169
|
-
private lastActivityTime;
|
|
170
|
-
private isUserActive;
|
|
171
|
-
private congestionDetectionWindow;
|
|
172
|
-
private optimalBatchSize;
|
|
173
|
-
constructor();
|
|
174
|
-
/**
|
|
175
|
-
* Record network measurement
|
|
176
|
-
*/
|
|
177
|
-
recordNetworkMeasurement(latencyMs: number, bandwidthMbps: number): void;
|
|
178
|
-
/**
|
|
179
|
-
* Assess network quality
|
|
180
|
-
*/
|
|
181
|
-
private assessNetworkQuality;
|
|
182
|
-
/**
|
|
183
|
-
* Detect congestion in network
|
|
184
|
-
*/
|
|
185
|
-
private detectCongestion;
|
|
186
|
-
/**
|
|
187
|
-
* Find next optimal network window
|
|
188
|
-
*/
|
|
189
|
-
private findOptimalWindow;
|
|
190
|
-
/**
|
|
191
|
-
* Get scheduling decision for a batch
|
|
192
|
-
*/
|
|
193
|
-
getSchedulingDecision(batchSize: number, batchPriority?: 'critical' | 'high' | 'normal' | 'low', isUserTriggered?: boolean): SchedulingDecision;
|
|
194
|
-
/**
|
|
195
|
-
* Apply scheduling and update stats
|
|
196
|
-
*/
|
|
197
|
-
applyScheduling(batchSize: number, sendNow: boolean, actualDelay: number): void;
|
|
198
|
-
/**
|
|
199
|
-
* Get optimal batch size recommendation
|
|
200
|
-
*/
|
|
201
|
-
getOptimalBatchSize(): number;
|
|
202
|
-
/**
|
|
203
|
-
* Get current network window
|
|
204
|
-
*/
|
|
205
|
-
getCurrentNetworkWindow(): NetworkWindow;
|
|
206
|
-
/**
|
|
207
|
-
* Set user activity state
|
|
208
|
-
*/
|
|
209
|
-
setUserActive(active: boolean): void;
|
|
210
|
-
/**
|
|
211
|
-
* Get statistics
|
|
212
|
-
*/
|
|
213
|
-
getStats(): BatchTimingStats;
|
|
214
|
-
/**
|
|
215
|
-
* Clear history
|
|
216
|
-
*/
|
|
217
|
-
clear(): void;
|
|
218
|
-
}
|
|
219
|
-
declare function getBatchTimingOptimizer(): BatchTimingOptimizer;
|
|
220
|
-
declare function resetBatchTimingOptimizer(): void;
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Adaptive Compression Optimizer (Phase 13)
|
|
224
|
-
*
|
|
225
|
-
* Automatically adjusts compression level based on network conditions,
|
|
226
|
-
* device capabilities, and real-time performance metrics.
|
|
227
|
-
*/
|
|
228
|
-
/**
|
|
229
|
-
* Network conditions affecting compression
|
|
230
|
-
*/
|
|
231
|
-
interface NetworkProfile {
|
|
232
|
-
estimatedSpeedKbps: number;
|
|
233
|
-
latencyMs: number;
|
|
234
|
-
isOnline: boolean;
|
|
235
|
-
isWifi: boolean;
|
|
236
|
-
isFast: boolean;
|
|
237
|
-
isSlow: boolean;
|
|
238
|
-
isEmpty: boolean;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Device capabilities for compression
|
|
242
|
-
*/
|
|
243
|
-
interface DeviceProfile {
|
|
244
|
-
cpuCores: number;
|
|
245
|
-
cpuUtilization: number;
|
|
246
|
-
memoryAvailableMB: number;
|
|
247
|
-
memoryTotalMB: number;
|
|
248
|
-
isConstrained: boolean;
|
|
249
|
-
isPremium: boolean;
|
|
250
|
-
supportsWebWorkers: boolean;
|
|
251
|
-
supportsWebAssembly: boolean;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Compression recommendation based on conditions
|
|
255
|
-
*/
|
|
256
|
-
interface CompressionRecommendation {
|
|
257
|
-
recommendedLevel: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
258
|
-
reason: string;
|
|
259
|
-
confidence: number;
|
|
260
|
-
estimatedCompressionMs: number;
|
|
261
|
-
estimatedRatio: number;
|
|
262
|
-
networkFactor: number;
|
|
263
|
-
deviceFactor: number;
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Adaptive compression statistics
|
|
267
|
-
*/
|
|
268
|
-
interface AdaptiveStats {
|
|
269
|
-
currentLevel: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
270
|
-
averageCompressionMs: number;
|
|
271
|
-
averageRatio: number;
|
|
272
|
-
levelsUsed: Set<number>;
|
|
273
|
-
adjustmentCount: number;
|
|
274
|
-
totalBatches: number;
|
|
275
|
-
networkCondition: 'fast' | 'normal' | 'slow' | 'offline';
|
|
276
|
-
}
|
|
277
|
-
declare class AdaptiveCompressionOptimizer {
|
|
278
|
-
private currentLevel;
|
|
279
|
-
private networkProfile;
|
|
280
|
-
private deviceProfile;
|
|
281
|
-
private compressionHistory;
|
|
282
|
-
private stats;
|
|
283
|
-
constructor();
|
|
284
|
-
/**
|
|
285
|
-
* Update network conditions
|
|
286
|
-
*/
|
|
287
|
-
updateNetworkConditions(speedKbps: number, latencyMs?: number, isOnline?: boolean): void;
|
|
288
|
-
/**
|
|
289
|
-
* Update device resource usage
|
|
290
|
-
*/
|
|
291
|
-
updateDeviceResources(cpuUtilization: number, memoryAvailableMB: number): void;
|
|
292
|
-
/**
|
|
293
|
-
* Record compression performance
|
|
294
|
-
*/
|
|
295
|
-
recordCompressionPerformance(level: number, compressionMs: number, ratio: number): void;
|
|
296
|
-
/**
|
|
297
|
-
* Get compression recommendation based on conditions
|
|
298
|
-
*/
|
|
299
|
-
getRecommendedLevel(): CompressionRecommendation;
|
|
300
|
-
/**
|
|
301
|
-
* Calculate network factor (0-1)
|
|
302
|
-
*/
|
|
303
|
-
private calculateNetworkFactor;
|
|
304
|
-
/**
|
|
305
|
-
* Calculate device factor (0-1)
|
|
306
|
-
*/
|
|
307
|
-
private calculateDeviceFactor;
|
|
308
|
-
/**
|
|
309
|
-
* Estimate compression time for a level (in ms)
|
|
310
|
-
*/
|
|
311
|
-
private estimateCompressionTime;
|
|
312
|
-
/**
|
|
313
|
-
* Estimate compression ratio for a level
|
|
314
|
-
*/
|
|
315
|
-
private estimateCompressionRatio;
|
|
316
|
-
/**
|
|
317
|
-
* Apply recommendation and get new level
|
|
318
|
-
*/
|
|
319
|
-
applyRecommendation(): 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
320
|
-
/**
|
|
321
|
-
* Get current level
|
|
322
|
-
*/
|
|
323
|
-
getCurrentLevel(): 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
324
|
-
/**
|
|
325
|
-
* Get statistics
|
|
326
|
-
*/
|
|
327
|
-
getStats(): AdaptiveStats;
|
|
328
|
-
/**
|
|
329
|
-
* Get detailed analysis
|
|
330
|
-
*/
|
|
331
|
-
getDetailedAnalysis(): {
|
|
332
|
-
stats: AdaptiveStats;
|
|
333
|
-
network: NetworkProfile;
|
|
334
|
-
device: DeviceProfile;
|
|
335
|
-
recommendation: CompressionRecommendation;
|
|
336
|
-
history: {
|
|
337
|
-
level: number;
|
|
338
|
-
ratio: number;
|
|
339
|
-
timeMs: number;
|
|
340
|
-
timestamp: number;
|
|
341
|
-
}[];
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
declare function getAdaptiveCompressionOptimizer(): AdaptiveCompressionOptimizer;
|
|
345
|
-
declare function resetAdaptiveCompressionOptimizer(): void;
|
|
346
|
-
|
|
347
|
-
export { type ActivityPattern, AdaptiveCompressionOptimizer, type AdaptiveStats, BatchTimingOptimizer, type BatchTimingStats, type CompressionRecommendation, type DeviceProfile, type NetworkProfile, type NetworkWindow, type OperationPattern, type OperationPrediction, type PrefetchedBatch, PrefetchingEngine, type PrefetchingStats, type SchedulingDecision, getAdaptiveCompressionOptimizer, getBatchTimingOptimizer, getPrefetchingEngine, resetAdaptiveCompressionOptimizer, resetBatchTimingOptimizer, resetPrefetchingEngine };
|