koru-delta 2.0.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.
@@ -0,0 +1,206 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Initialize panic hook for better error messages in the browser console
5
+ */
6
+ export function init(): void;
7
+ /**
8
+ * WASM-friendly wrapper around KoruDelta
9
+ */
10
+ export class KoruDeltaWasm {
11
+ private constructor();
12
+ free(): void;
13
+ [Symbol.dispose](): void;
14
+ /**
15
+ * Get the complete history for a key
16
+ *
17
+ * # Arguments
18
+ * * `namespace` - The namespace
19
+ * * `key` - The key within the namespace
20
+ *
21
+ * # Returns
22
+ * Array of version history entries
23
+ */
24
+ history(namespace: string, key: string): Promise<any>;
25
+ /**
26
+ * Check if a key exists
27
+ */
28
+ contains(namespace: string, key: string): Promise<boolean>;
29
+ /**
30
+ * List all keys in a namespace
31
+ */
32
+ listKeys(namespace: string): Promise<any>;
33
+ /**
34
+ * Store multiple key-value pairs as a batch operation
35
+ *
36
+ * This is significantly faster than calling put() multiple times, especially
37
+ * when persistence is enabled, as it performs a single fsync for all items.
38
+ *
39
+ * # Arguments
40
+ * * `items` - A JavaScript array of objects with `namespace`, `key`, and `value` properties
41
+ *
42
+ * # Returns
43
+ * A JavaScript array of versioned metadata objects for each stored item
44
+ *
45
+ * # Example (JavaScript)
46
+ * ```javascript
47
+ * const items = [
48
+ * { namespace: 'users', key: 'alice', value: { name: 'Alice', age: 30 } },
49
+ * { namespace: 'users', key: 'bob', value: { name: 'Bob', age: 25 } }
50
+ * ];
51
+ * const results = await db.putBatch(items);
52
+ * ```
53
+ */
54
+ putBatch(items: any): Promise<any>;
55
+ /**
56
+ * Check if the database is using IndexedDB persistence
57
+ */
58
+ isPersistent(): boolean;
59
+ /**
60
+ * List all views
61
+ */
62
+ listViews(): Promise<any>;
63
+ /**
64
+ * Query a view
65
+ */
66
+ queryView(name: string): Promise<any>;
67
+ /**
68
+ * Create a materialized view
69
+ *
70
+ * # Arguments
71
+ * * `name` - View name
72
+ * * `source_namespace` - Source collection/namespace
73
+ */
74
+ createView(name: string, source_namespace: string): Promise<void>;
75
+ /**
76
+ * Delete a view
77
+ */
78
+ deleteView(name: string): Promise<void>;
79
+ /**
80
+ * Create a new persistent KoruDelta database instance with IndexedDB
81
+ *
82
+ * Data will be automatically saved to IndexedDB and loaded on startup.
83
+ * Falls back to memory-only if IndexedDB is unavailable.
84
+ *
85
+ * # Example (JavaScript)
86
+ * ```javascript
87
+ * const db = await KoruDeltaWasm.newPersistent();
88
+ *
89
+ * // Check if persistence is working
90
+ * if (db.isPersistent()) {
91
+ * console.log("Data will survive page refreshes!");
92
+ * }
93
+ * ```
94
+ */
95
+ static newPersistent(): Promise<KoruDeltaWasm>;
96
+ /**
97
+ * Delete an embedding
98
+ */
99
+ deleteEmbed(namespace: string, key: string): Promise<void>;
100
+ /**
101
+ * Search for similar documents by vector
102
+ *
103
+ * # Arguments
104
+ * * `namespace` - Namespace to search
105
+ * * `query` - Array of f32 values (the query embedding)
106
+ * * `limit` - Maximum number of results (default: 10)
107
+ *
108
+ * # Returns
109
+ * Array of search results with namespace, key, and similarity score
110
+ */
111
+ embedSearch(namespace: string, query: Float32Array, limit?: number | null): Promise<any>;
112
+ /**
113
+ * Refresh a view
114
+ */
115
+ refreshView(name: string): Promise<void>;
116
+ /**
117
+ * Clear all persisted data from IndexedDB
118
+ *
119
+ * This will delete all data stored in IndexedDB. Use with caution!
120
+ */
121
+ clearPersistence(): Promise<void>;
122
+ /**
123
+ * List all namespaces in the database
124
+ */
125
+ listNamespaces(): Promise<any>;
126
+ /**
127
+ * Check if IndexedDB is supported in the current environment
128
+ */
129
+ static isIndexedDbSupported(): boolean;
130
+ /**
131
+ * Create a new in-memory KoruDelta database instance
132
+ *
133
+ * Data will be lost when the page is refreshed. For persistent storage,
134
+ * use `newPersistent()` instead.
135
+ *
136
+ * # Example (JavaScript)
137
+ * ```javascript
138
+ * const db = await KoruDeltaWasm.new();
139
+ * ```
140
+ */
141
+ static new(): Promise<KoruDeltaWasm>;
142
+ /**
143
+ * Retrieve the current value for a key
144
+ *
145
+ * # Arguments
146
+ * * `namespace` - The namespace
147
+ * * `key` - The key within the namespace
148
+ *
149
+ * # Returns
150
+ * A JavaScript object with the value and metadata
151
+ */
152
+ get(namespace: string, key: string): Promise<any>;
153
+ /**
154
+ * Store a value in the database
155
+ *
156
+ * # Arguments
157
+ * * `namespace` - The namespace (e.g., "users")
158
+ * * `key` - The key within the namespace (e.g., "alice")
159
+ * * `value` - JSON value to store (as JavaScript object/value)
160
+ *
161
+ * # Returns
162
+ * A JavaScript object with version information
163
+ */
164
+ put(namespace: string, key: string, value: any): Promise<any>;
165
+ /**
166
+ * Store a vector embedding associated with a document
167
+ *
168
+ * # Arguments
169
+ * * `namespace` - Document namespace
170
+ * * `key` - Document key
171
+ * * `vector` - Array of f32 values (the embedding)
172
+ * * `model` - Optional model identifier
173
+ */
174
+ embed(namespace: string, key: string, vector: Float32Array, model?: string | null): Promise<void>;
175
+ /**
176
+ * Query the database with filters
177
+ *
178
+ * # Arguments
179
+ * * `namespace` - Namespace to query
180
+ * * `filter` - Filter object (e.g., {status: "active", age: 30})
181
+ * * `limit` - Maximum results
182
+ */
183
+ query(namespace: string, filter: any, limit?: number | null): Promise<any>;
184
+ /**
185
+ * Get database statistics
186
+ */
187
+ stats(): Promise<any>;
188
+ /**
189
+ * Delete a key
190
+ *
191
+ * Also removes the key from IndexedDB if persistence is enabled.
192
+ */
193
+ delete(namespace: string, key: string): Promise<void>;
194
+ /**
195
+ * Get value at a specific timestamp
196
+ *
197
+ * # Arguments
198
+ * * `namespace` - The namespace
199
+ * * `key` - The key
200
+ * * `timestamp_iso` - ISO 8601 timestamp string
201
+ *
202
+ * # Returns
203
+ * The value at that point in time
204
+ */
205
+ getAt(namespace: string, key: string, timestamp_iso: string): Promise<any>;
206
+ }