@affectively/dash 5.2.1 → 5.3.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/dist/index.d.ts +62 -0
- package/dist/index.js +31 -0
- package/dist/sync/index.d.ts +6 -0
- package/dist/sync/index.js +4 -0
- package/package.json +45 -66
- package/README.md +0 -193
- package/dist/src/api/firebase/auth/index.d.ts +0 -137
- package/dist/src/api/firebase/auth/index.js +0 -352
- package/dist/src/api/firebase/auth/providers.d.ts +0 -254
- package/dist/src/api/firebase/auth/providers.js +0 -518
- package/dist/src/api/firebase/database/index.d.ts +0 -108
- package/dist/src/api/firebase/database/index.js +0 -368
- package/dist/src/api/firebase/errors.d.ts +0 -15
- package/dist/src/api/firebase/errors.js +0 -215
- package/dist/src/api/firebase/firestore/data-types.d.ts +0 -116
- package/dist/src/api/firebase/firestore/data-types.js +0 -280
- package/dist/src/api/firebase/firestore/index.d.ts +0 -7
- package/dist/src/api/firebase/firestore/index.js +0 -13
- package/dist/src/api/firebase/firestore/listeners.d.ts +0 -20
- package/dist/src/api/firebase/firestore/listeners.js +0 -50
- package/dist/src/api/firebase/firestore/operations.d.ts +0 -123
- package/dist/src/api/firebase/firestore/operations.js +0 -490
- package/dist/src/api/firebase/firestore/query.d.ts +0 -118
- package/dist/src/api/firebase/firestore/query.js +0 -418
- package/dist/src/api/firebase/index.d.ts +0 -11
- package/dist/src/api/firebase/index.js +0 -17
- package/dist/src/api/firebase/storage/index.d.ts +0 -100
- package/dist/src/api/firebase/storage/index.js +0 -286
- package/dist/src/api/firebase/types.d.ts +0 -341
- package/dist/src/api/firebase/types.js +0 -4
- package/dist/src/auth/manager.d.ts +0 -182
- package/dist/src/auth/manager.js +0 -598
- package/dist/src/engine/ai.d.ts +0 -10
- package/dist/src/engine/ai.js +0 -76
- package/dist/src/engine/sqlite.d.ts +0 -298
- package/dist/src/engine/sqlite.js +0 -1088
- package/dist/src/engine/vec_extension.d.ts +0 -5
- package/dist/src/engine/vec_extension.js +0 -10
- package/dist/src/index.d.ts +0 -15
- package/dist/src/index.js +0 -24
- package/dist/src/mcp/server.d.ts +0 -8
- package/dist/src/mcp/server.js +0 -87
- package/dist/src/reactivity/signal.d.ts +0 -3
- package/dist/src/reactivity/signal.js +0 -31
- package/dist/src/schema/lens.d.ts +0 -29
- package/dist/src/schema/lens.js +0 -122
- package/dist/src/sync/aeon/config.d.ts +0 -21
- package/dist/src/sync/aeon/config.js +0 -14
- package/dist/src/sync/aeon/delta-adapter.d.ts +0 -62
- package/dist/src/sync/aeon/delta-adapter.js +0 -98
- package/dist/src/sync/aeon/index.d.ts +0 -18
- package/dist/src/sync/aeon/index.js +0 -19
- package/dist/src/sync/aeon/offline-adapter.d.ts +0 -110
- package/dist/src/sync/aeon/offline-adapter.js +0 -227
- package/dist/src/sync/aeon/presence-adapter.d.ts +0 -114
- package/dist/src/sync/aeon/presence-adapter.js +0 -157
- package/dist/src/sync/aeon/schema-adapter.d.ts +0 -95
- package/dist/src/sync/aeon/schema-adapter.js +0 -163
- package/dist/src/sync/backup.d.ts +0 -12
- package/dist/src/sync/backup.js +0 -44
- package/dist/src/sync/connection.d.ts +0 -20
- package/dist/src/sync/connection.js +0 -50
- package/dist/src/sync/d1-provider.d.ts +0 -97
- package/dist/src/sync/d1-provider.js +0 -345
- package/dist/src/sync/hybrid-provider.d.ts +0 -172
- package/dist/src/sync/hybrid-provider.js +0 -477
- package/dist/src/sync/provider.d.ts +0 -11
- package/dist/src/sync/provider.js +0 -67
- package/dist/src/sync/verify.d.ts +0 -1
- package/dist/src/sync/verify.js +0 -23
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
import { LensEngine } from '../schema/lens.js';
|
|
2
|
-
/**
|
|
3
|
-
* Cloud sync configuration - enables automatic D1/R2 sync
|
|
4
|
-
*
|
|
5
|
-
* Cloud sync is ON BY DEFAULT when:
|
|
6
|
-
* - Running in a Cloudflare environment (detected via env vars)
|
|
7
|
-
* - A sync endpoint is available
|
|
8
|
-
*
|
|
9
|
-
* It gracefully degrades if sync fails - local data still works.
|
|
10
|
-
*/
|
|
11
|
-
export interface CloudConfig {
|
|
12
|
-
/** Base URL for the sync endpoint (e.g., 'https://api.example.com'). Auto-detected from env if not provided. */
|
|
13
|
-
baseUrl?: string;
|
|
14
|
-
/** Auth token getter - called before each sync */
|
|
15
|
-
getAuthToken?: () => Promise<string | null>;
|
|
16
|
-
/** Sync interval in ms (default: 30000 = 30s). Set to 0 to disable auto-sync. */
|
|
17
|
-
syncInterval?: number;
|
|
18
|
-
/** Tables to exclude from sync (internal tables are always excluded) */
|
|
19
|
-
excludeTables?: string[];
|
|
20
|
-
/** Callback when sync completes */
|
|
21
|
-
onSyncComplete?: (result: CloudSyncResult) => void;
|
|
22
|
-
/** Callback when sync fails */
|
|
23
|
-
onSyncError?: (error: Error) => void;
|
|
24
|
-
/** Explicitly disable cloud sync (default: false - sync is enabled if endpoint available) */
|
|
25
|
-
disabled?: boolean;
|
|
26
|
-
}
|
|
27
|
-
export interface CloudSyncResult {
|
|
28
|
-
pushed: number;
|
|
29
|
-
pulled: number;
|
|
30
|
-
errors: string[];
|
|
31
|
-
timestamp: number;
|
|
32
|
-
}
|
|
33
|
-
export declare class DashEngine {
|
|
34
|
-
private db;
|
|
35
|
-
private readyPromise;
|
|
36
|
-
private listeners;
|
|
37
|
-
lens: LensEngine;
|
|
38
|
-
currentSchemaVersion: number;
|
|
39
|
-
private cloudConfig;
|
|
40
|
-
private cloudSyncTimer;
|
|
41
|
-
private isCloudSyncing;
|
|
42
|
-
private lastCloudSyncTime;
|
|
43
|
-
private cloudSyncEnabled;
|
|
44
|
-
private syncedTables;
|
|
45
|
-
private readonly INTERNAL_TABLES;
|
|
46
|
-
constructor();
|
|
47
|
-
private init;
|
|
48
|
-
/**
|
|
49
|
-
* Try to auto-enable cloud sync from environment
|
|
50
|
-
* Cloud sync is ON BY DEFAULT when a sync endpoint is detected
|
|
51
|
-
*/
|
|
52
|
-
private tryAutoEnableCloudSync;
|
|
53
|
-
/**
|
|
54
|
-
* Detect sync endpoint from environment variables or same-origin
|
|
55
|
-
*/
|
|
56
|
-
private detectSyncEndpoint;
|
|
57
|
-
/**
|
|
58
|
-
* Get default auth token from common auth patterns
|
|
59
|
-
*/
|
|
60
|
-
private getDefaultAuthToken;
|
|
61
|
-
private initializeSchema;
|
|
62
|
-
ready(): Promise<void>;
|
|
63
|
-
private tableListeners;
|
|
64
|
-
subscribe(table: string, callback: () => void): () => void;
|
|
65
|
-
private notify;
|
|
66
|
-
private notifyChanges;
|
|
67
|
-
execute(sql: string, bind?: any[]): any[];
|
|
68
|
-
getFloat32(sql: string, bind?: any[]): Float32Array | null;
|
|
69
|
-
addWithEmbedding(id: string, content: string, spatial?: {
|
|
70
|
-
x: number;
|
|
71
|
-
y: number;
|
|
72
|
-
z: number;
|
|
73
|
-
}): Promise<never[]>;
|
|
74
|
-
search(query: string, limit?: number): Promise<any[]>;
|
|
75
|
-
spatialQuery(bounds: {
|
|
76
|
-
minX: number;
|
|
77
|
-
maxX: number;
|
|
78
|
-
minY: number;
|
|
79
|
-
maxY: number;
|
|
80
|
-
minZ: number;
|
|
81
|
-
maxZ: number;
|
|
82
|
-
}): Promise<any[]>;
|
|
83
|
-
close(): void;
|
|
84
|
-
/**
|
|
85
|
-
* Enable cloud sync - changes automatically sync to D1/R2
|
|
86
|
-
* Just call this once with your config, and sync happens magically.
|
|
87
|
-
*
|
|
88
|
-
* Cloud sync is ON BY DEFAULT when running in a Cloudflare environment.
|
|
89
|
-
* Call this to customize the config or explicitly enable/disable.
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* ```ts
|
|
93
|
-
* await dash.ready();
|
|
94
|
-
* // Option 1: Use auto-detected endpoint (default)
|
|
95
|
-
* // Cloud sync is already enabled if DASH_SYNC_URL env var is set
|
|
96
|
-
*
|
|
97
|
-
* // Option 2: Explicit config
|
|
98
|
-
* dash.enableCloudSync({
|
|
99
|
-
* baseUrl: 'https://api.example.com',
|
|
100
|
-
* getAuthToken: async () => auth.token,
|
|
101
|
-
* });
|
|
102
|
-
*
|
|
103
|
-
* // Option 3: Disable cloud sync
|
|
104
|
-
* dash.enableCloudSync({ disabled: true });
|
|
105
|
-
* ```
|
|
106
|
-
*/
|
|
107
|
-
enableCloudSync(config?: CloudConfig): void;
|
|
108
|
-
/**
|
|
109
|
-
* Initialize cloud sync schema (queue and metadata tables)
|
|
110
|
-
*/
|
|
111
|
-
private initializeCloudSyncSchema;
|
|
112
|
-
/**
|
|
113
|
-
* Set up sync triggers for all user tables
|
|
114
|
-
*/
|
|
115
|
-
private setupAllTableTriggers;
|
|
116
|
-
/**
|
|
117
|
-
* Check if a table should be synced
|
|
118
|
-
*/
|
|
119
|
-
private shouldSyncTable;
|
|
120
|
-
/**
|
|
121
|
-
* Set up sync triggers for a specific table
|
|
122
|
-
*/
|
|
123
|
-
private setupTableSyncTriggers;
|
|
124
|
-
/**
|
|
125
|
-
* Build json_object() arguments for a table's columns
|
|
126
|
-
*/
|
|
127
|
-
private buildJsonObjectArgs;
|
|
128
|
-
/**
|
|
129
|
-
* Start automatic cloud sync
|
|
130
|
-
*/
|
|
131
|
-
private startCloudSync;
|
|
132
|
-
/**
|
|
133
|
-
* Stop automatic cloud sync
|
|
134
|
-
*/
|
|
135
|
-
stopCloudSync(): void;
|
|
136
|
-
/**
|
|
137
|
-
* Perform a sync to cloud (D1/R2)
|
|
138
|
-
*/
|
|
139
|
-
syncToCloud(): Promise<CloudSyncResult>;
|
|
140
|
-
/**
|
|
141
|
-
* Apply a single server change locally
|
|
142
|
-
*/
|
|
143
|
-
private applyServerChange;
|
|
144
|
-
/**
|
|
145
|
-
* Force a full cloud sync (reset last sync time)
|
|
146
|
-
*/
|
|
147
|
-
forceCloudSync(): Promise<CloudSyncResult>;
|
|
148
|
-
/**
|
|
149
|
-
* Get cloud sync status
|
|
150
|
-
*/
|
|
151
|
-
getCloudSyncStatus(): {
|
|
152
|
-
enabled: boolean;
|
|
153
|
-
syncing: boolean;
|
|
154
|
-
lastSyncTime: number;
|
|
155
|
-
pendingChanges: number;
|
|
156
|
-
syncedTables: string[];
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* Disable cloud sync
|
|
160
|
-
*/
|
|
161
|
-
disableCloudSync(): void;
|
|
162
|
-
/**
|
|
163
|
-
* Get information about all tables in the database
|
|
164
|
-
*/
|
|
165
|
-
getAllTables(): TableInfo[];
|
|
166
|
-
/**
|
|
167
|
-
* Get detailed schema information for a specific table
|
|
168
|
-
*/
|
|
169
|
-
getTableSchema(tableName: string): TableSchema | null;
|
|
170
|
-
/**
|
|
171
|
-
* Get the row count for a specific table
|
|
172
|
-
*/
|
|
173
|
-
getTableRowCount(tableName: string): number;
|
|
174
|
-
/**
|
|
175
|
-
* Get statistics about the vector index
|
|
176
|
-
*/
|
|
177
|
-
getVectorIndexStats(): VectorIndexStats;
|
|
178
|
-
/**
|
|
179
|
-
* Get all embeddings from the vector index
|
|
180
|
-
*/
|
|
181
|
-
getAllEmbeddings(limit?: number, offset?: number): EmbeddingEntry[];
|
|
182
|
-
/**
|
|
183
|
-
* Search for similar vectors given a raw vector
|
|
184
|
-
*/
|
|
185
|
-
searchSimilarByVector(vector: number[], k?: number): SimilarityResult[];
|
|
186
|
-
/**
|
|
187
|
-
* Get statistics about the spatial R-Tree index
|
|
188
|
-
*/
|
|
189
|
-
getSpatialIndexStats(): SpatialIndexStats;
|
|
190
|
-
/**
|
|
191
|
-
* Get all spatial bounds from the R-Tree index
|
|
192
|
-
*/
|
|
193
|
-
getAllSpatialBounds(limit?: number, offset?: number): SpatialBound[];
|
|
194
|
-
/**
|
|
195
|
-
* Get information about active table subscriptions
|
|
196
|
-
*/
|
|
197
|
-
getActiveSubscriptions(): SubscriptionInfo[];
|
|
198
|
-
/**
|
|
199
|
-
* Get table listener counts as a map
|
|
200
|
-
*/
|
|
201
|
-
getTableListenerCounts(): Record<string, number>;
|
|
202
|
-
/**
|
|
203
|
-
* Check if the database is ready
|
|
204
|
-
*/
|
|
205
|
-
isReady(): boolean;
|
|
206
|
-
/**
|
|
207
|
-
* Get database metadata
|
|
208
|
-
*/
|
|
209
|
-
getDatabaseInfo(): DatabaseInfo;
|
|
210
|
-
}
|
|
211
|
-
export interface TableInfo {
|
|
212
|
-
name: string;
|
|
213
|
-
type: 'table' | 'virtual';
|
|
214
|
-
rowCount: number;
|
|
215
|
-
isVirtual: boolean;
|
|
216
|
-
}
|
|
217
|
-
export interface TableSchema {
|
|
218
|
-
name: string;
|
|
219
|
-
columns: ColumnInfo[];
|
|
220
|
-
indexes: IndexInfo[];
|
|
221
|
-
foreignKeys: ForeignKeyInfo[];
|
|
222
|
-
rowCount: number;
|
|
223
|
-
}
|
|
224
|
-
export interface ColumnInfo {
|
|
225
|
-
cid: number;
|
|
226
|
-
name: string;
|
|
227
|
-
type: string;
|
|
228
|
-
notNull: boolean;
|
|
229
|
-
defaultValue: string | null;
|
|
230
|
-
isPrimaryKey: boolean;
|
|
231
|
-
}
|
|
232
|
-
export interface IndexInfo {
|
|
233
|
-
name: string;
|
|
234
|
-
unique: boolean;
|
|
235
|
-
origin: string;
|
|
236
|
-
}
|
|
237
|
-
export interface ForeignKeyInfo {
|
|
238
|
-
id: number;
|
|
239
|
-
table: string;
|
|
240
|
-
from: string;
|
|
241
|
-
to: string;
|
|
242
|
-
}
|
|
243
|
-
export interface VectorIndexStats {
|
|
244
|
-
totalEmbeddings: number;
|
|
245
|
-
dimensions: number;
|
|
246
|
-
indexExists: boolean;
|
|
247
|
-
tableName?: string;
|
|
248
|
-
error?: string;
|
|
249
|
-
}
|
|
250
|
-
export interface EmbeddingEntry {
|
|
251
|
-
id: string;
|
|
252
|
-
content: string | null;
|
|
253
|
-
embedding: number[] | null;
|
|
254
|
-
}
|
|
255
|
-
export interface SimilarityResult {
|
|
256
|
-
id: string;
|
|
257
|
-
content: string | null;
|
|
258
|
-
distance: number;
|
|
259
|
-
score: number;
|
|
260
|
-
}
|
|
261
|
-
export interface SpatialIndexStats {
|
|
262
|
-
totalEntries: number;
|
|
263
|
-
indexExists: boolean;
|
|
264
|
-
tableName?: string;
|
|
265
|
-
globalBounds?: {
|
|
266
|
-
minX: number;
|
|
267
|
-
maxX: number;
|
|
268
|
-
minY: number;
|
|
269
|
-
maxY: number;
|
|
270
|
-
minZ: number;
|
|
271
|
-
maxZ: number;
|
|
272
|
-
};
|
|
273
|
-
error?: string;
|
|
274
|
-
}
|
|
275
|
-
export interface SpatialBound {
|
|
276
|
-
id: string;
|
|
277
|
-
rowid: number;
|
|
278
|
-
bounds: {
|
|
279
|
-
minX: number;
|
|
280
|
-
maxX: number;
|
|
281
|
-
minY: number;
|
|
282
|
-
maxY: number;
|
|
283
|
-
minZ: number;
|
|
284
|
-
maxZ: number;
|
|
285
|
-
};
|
|
286
|
-
content: string | null;
|
|
287
|
-
}
|
|
288
|
-
export interface SubscriptionInfo {
|
|
289
|
-
table: string;
|
|
290
|
-
listenerCount: number;
|
|
291
|
-
}
|
|
292
|
-
export interface DatabaseInfo {
|
|
293
|
-
ready: boolean;
|
|
294
|
-
schemaVersion: number;
|
|
295
|
-
tableCount: number;
|
|
296
|
-
tables?: string[];
|
|
297
|
-
}
|
|
298
|
-
export declare const dash: DashEngine;
|