@feltdb/core 0.4.5 → 0.4.7

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 (38) hide show
  1. package/README.md +9 -0
  2. package/bin/create-feltdb.js +3 -0
  3. package/bin/feltdb.js +3 -0
  4. package/dist/analytics-backend.js +1 -1
  5. package/dist/cli/api-client.js +236 -0
  6. package/dist/cli/cli.js +18 -0
  7. package/dist/cli/commands.js +795 -0
  8. package/dist/cli/config.js +66 -0
  9. package/dist/cli/index.js +399 -0
  10. package/dist/create/application-identity.js +132 -0
  11. package/dist/create/cli-scripts-generator.js +211 -0
  12. package/dist/create/cli.js +251 -0
  13. package/dist/create/create.js +1862 -0
  14. package/dist/create/docker-compose-generator.js +258 -0
  15. package/dist/create/index.js +4 -0
  16. package/dist/create/package-versions.js +4 -0
  17. package/dist/create/runtime-templates.js +272 -0
  18. package/dist/index-backend.js +1 -1
  19. package/dist/react/useFeltDB.d.ts +1 -1
  20. package/dist/react/useFeltDB.js +1 -1
  21. package/dist/studio/KeyManagementPanel-B0s0xAXz.js +298 -0
  22. package/dist/studio/components/KeyManagementPanel.d.ts.map +1 -1
  23. package/dist/studio/components/KeyManagementPanel.js +1 -1
  24. package/dist/studio/components/index.js +2 -2
  25. package/dist/studio/{components-BRYUceo9.js → components-BAycgZhP.js} +1 -1
  26. package/dist/studio/index.js +2 -2
  27. package/dist/studio-app/assets/{feltdb_wasm-BXMn9UxO.js → feltdb_wasm-Bb1Pg6qz.js} +1 -1
  28. package/dist/studio-app/assets/feltdb_wasm_bg-2_wVudcZ.wasm +0 -0
  29. package/dist/studio-app/assets/{index-B-lZjdtI.js → index-DKVLtS37.js} +2 -2
  30. package/dist/studio-app/index.html +1 -1
  31. package/dist/wasm/feltdb_wasm.d.ts +461 -0
  32. package/dist/wasm/feltdb_wasm.js +1690 -0
  33. package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
  34. package/dist/wasm/feltdb_wasm_bg.wasm.d.ts +84 -0
  35. package/dist/wasm/package.json +16 -0
  36. package/package.json +11 -5
  37. package/dist/studio/KeyManagementPanel-BOvWTRyH.js +0 -246
  38. package/dist/studio-app/assets/feltdb_wasm_bg-bYYbZeRM.wasm +0 -0
@@ -1,3 +1,3 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#17211b"/><title>FeltDB Studio</title> <script type="module" crossorigin src="/assets/index-B-lZjdtI.js"></script>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#17211b"/><title>FeltDB Studio</title> <script type="module" crossorigin src="/assets/index-DKVLtS37.js"></script>
2
2
  <link rel="stylesheet" crossorigin href="/assets/index-CB-Eed9V.css">
3
3
  </head><body><div id="root"></div></body></html>
@@ -0,0 +1,461 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Wrapper around FeltDb for JavaScript interop
6
+ */
7
+ export class JsDb {
8
+ private constructor();
9
+ free(): void;
10
+ [Symbol.dispose](): void;
11
+ /**
12
+ * Acknowledge receipt of operations from a peer
13
+ *
14
+ * # Arguments
15
+ * * `peer_id` - Unique identifier for the peer
16
+ * * `sequence` - Acknowledge operations up to this sequence number
17
+ *
18
+ * # Returns
19
+ * JsResult with success status
20
+ */
21
+ acknowledge_peer_operations(peer_id: string, sequence: bigint): JsResult;
22
+ /**
23
+ * Add a peer for synchronization
24
+ *
25
+ * # Arguments
26
+ * * `peer_id` - Unique identifier for the peer
27
+ *
28
+ * # Returns
29
+ * JsResult with success status
30
+ */
31
+ add_sync_peer(peer_id: string): JsResult;
32
+ /**
33
+ * Delete a record from the database.
34
+ */
35
+ delete(key: string): JsResult;
36
+ execute_canonical_query(schema: string, authorization: string, state_namespace: string, query: string): JsResult;
37
+ execute_canonical_transaction(schema: string, request: string): JsResult;
38
+ /**
39
+ * Retrieve a record from the database
40
+ *
41
+ * # Arguments
42
+ * * `key` - Key for the record
43
+ *
44
+ * # Returns
45
+ * JSON string of the record or error
46
+ */
47
+ get(key: string): JsResult;
48
+ /**
49
+ * Get all records in a capability namespace
50
+ *
51
+ * # Arguments
52
+ * * `capability` - Capability/namespace name
53
+ *
54
+ * # Returns
55
+ * JSON array string of all records in the capability
56
+ */
57
+ get_capability_records(capability: string): JsResult;
58
+ /**
59
+ * Get pending operations for a peer since a given sequence
60
+ *
61
+ * # Arguments
62
+ * * `peer_id` - Unique identifier for the peer
63
+ * * `since_sequence` - Get operations after this sequence number
64
+ *
65
+ * # Returns
66
+ * JSON array of operations as a string
67
+ */
68
+ get_pending_for_peer(peer_id: string, since_sequence: bigint): JsResult;
69
+ /**
70
+ * Get the current sequence number for this instance
71
+ *
72
+ * # Returns
73
+ * The current sequence number
74
+ */
75
+ get_sequence(): bigint;
76
+ /**
77
+ * Insert a record into the database
78
+ *
79
+ * # Arguments
80
+ * * `key` - Key for the record (e.g., "users:123")
81
+ * * `value` - JSON object as a string
82
+ *
83
+ * # Returns
84
+ * JsResult with success status
85
+ */
86
+ insert(key: string, value: string): JsResult;
87
+ /**
88
+ * Get the instance ID for this FeltDB instance
89
+ *
90
+ * # Returns
91
+ * The unique instance ID as a string
92
+ */
93
+ instance_id(): string;
94
+ /**
95
+ * Check if a type is auto-indexed
96
+ *
97
+ * # Returns
98
+ * Whether the default (generic JSON) type is auto-indexed
99
+ */
100
+ is_auto_indexed(): boolean;
101
+ /**
102
+ * Query records in the database with a predicate
103
+ *
104
+ * For now, this returns all records of a given type namespace as a simplified implementation.
105
+ * The full closure-based predicate from Rust cannot be directly represented in WASM bindings.
106
+ *
107
+ * # Arguments
108
+ * * `capability` - Capability/namespace to query (e.g., "users")
109
+ *
110
+ * # Returns
111
+ * JSON array string of matching records
112
+ */
113
+ query(capability: string): JsResult;
114
+ /**
115
+ * Remove a peer from synchronization
116
+ *
117
+ * # Arguments
118
+ * * `peer_id` - Unique identifier for the peer
119
+ *
120
+ * # Returns
121
+ * JsResult with success status
122
+ */
123
+ remove_sync_peer(peer_id: string): JsResult;
124
+ /**
125
+ * Get current sync state information
126
+ *
127
+ * # Returns
128
+ * JSON string containing sync state metrics
129
+ */
130
+ sync_info(): JsResult;
131
+ /**
132
+ * Update an existing record through the canonical update operation.
133
+ */
134
+ update(key: string, value: string): JsResult;
135
+ }
136
+
137
+ /**
138
+ * Result type for WASM operations
139
+ */
140
+ export class JsResult {
141
+ private constructor();
142
+ free(): void;
143
+ [Symbol.dispose](): void;
144
+ readonly data: string | undefined;
145
+ readonly error: string | undefined;
146
+ readonly success: boolean;
147
+ }
148
+
149
+ /**
150
+ * High-performance analytics engine for index monitoring.
151
+ * Tracks metrics, generates reports, and provides tuning recommendations.
152
+ */
153
+ export class WasmAnalytics {
154
+ free(): void;
155
+ [Symbol.dispose](): void;
156
+ /**
157
+ * Generate performance report for a collection.
158
+ */
159
+ generate_report(collection_name: string, period: string): string;
160
+ /**
161
+ * Get metrics for all indexes.
162
+ */
163
+ get_all_metrics(): string;
164
+ /**
165
+ * Get most frequently accessed fields.
166
+ */
167
+ get_frequent_fields(limit: number): string;
168
+ /**
169
+ * Get metrics for a specific index.
170
+ */
171
+ get_index_metrics(index_name: string): string;
172
+ /**
173
+ * Get slowest queries.
174
+ */
175
+ get_slowest_queries(limit: number): string;
176
+ constructor();
177
+ /**
178
+ * Record an index usage event.
179
+ */
180
+ record_index_usage(index_name: string, operation: string, time_ms: number): void;
181
+ /**
182
+ * Record a query execution with performance metrics.
183
+ */
184
+ record_query(fields_json: string, operator: string, execution_time_ms: number, rows_scanned: bigint, result_count: bigint, index_used?: string | null): void;
185
+ /**
186
+ * Reset all collected metrics.
187
+ */
188
+ reset(): void;
189
+ }
190
+
191
+ /**
192
+ * Distributed index manager for multi-node synchronization.
193
+ * Coordinates index replication, consistency, and conflict resolution.
194
+ */
195
+ export class WasmDistributedIndexManager {
196
+ free(): void;
197
+ [Symbol.dispose](): void;
198
+ /**
199
+ * Create a replicated index
200
+ */
201
+ create_replicated_index(name: string, field: string, index_type: string): void;
202
+ /**
203
+ * Detect version conflicts
204
+ */
205
+ detect_conflicts(index_name: string): string;
206
+ /**
207
+ * Get replication status for an index
208
+ */
209
+ get_replication_status(index_name: string): string;
210
+ /**
211
+ * Get list of peers needing replication for an index
212
+ */
213
+ get_replication_targets(index_name: string): string;
214
+ /**
215
+ * Get overall synchronization status
216
+ */
217
+ get_sync_status(): string;
218
+ /**
219
+ * Merge concurrent versions
220
+ */
221
+ merge_versions(index_name: string): void;
222
+ constructor(peer_id: string);
223
+ /**
224
+ * Register a peer for replication
225
+ */
226
+ register_peer(peer_id: string): void;
227
+ /**
228
+ * Set peer reachability
229
+ */
230
+ set_peer_reachable(peer_id: string, reachable: boolean): void;
231
+ }
232
+
233
+ /**
234
+ * High-performance index manager for collections.
235
+ * Wraps Rust IndexManager for optimal query performance.
236
+ */
237
+ export class WasmIndexManager {
238
+ free(): void;
239
+ [Symbol.dispose](): void;
240
+ /**
241
+ * Create a new index on the collection.
242
+ */
243
+ create_index(config: string): void;
244
+ /**
245
+ * Get statistics for an index.
246
+ */
247
+ get_stats(name: string): string;
248
+ /**
249
+ * List all indexes.
250
+ */
251
+ list_indexes(): string;
252
+ constructor();
253
+ /**
254
+ * Query an index.
255
+ */
256
+ query_index(index_name: string, operator: string, value: string): string;
257
+ /**
258
+ * Update a record's index entries.
259
+ */
260
+ update_record(record_id: string, old_value: string | null | undefined, new_value: string): void;
261
+ }
262
+
263
+ /**
264
+ * Shard manager for horizontal scaling.
265
+ * Distributes data across shards and handles rebalancing.
266
+ */
267
+ export class WasmShardManager {
268
+ free(): void;
269
+ [Symbol.dispose](): void;
270
+ /**
271
+ * Detect hotspots
272
+ */
273
+ detect_hotspots(): string;
274
+ /**
275
+ * Generate rebalance operations
276
+ */
277
+ generate_rebalance_ops(): string;
278
+ /**
279
+ * Get all shard metrics
280
+ */
281
+ get_all_metrics(): string;
282
+ /**
283
+ * Get distribution summary
284
+ */
285
+ get_distribution_summary(): string;
286
+ /**
287
+ * Get shard for a key
288
+ */
289
+ get_shard_for_key(key: string): string;
290
+ /**
291
+ * Initialize shards
292
+ */
293
+ initialize_shards(shard_ids_json: string): void;
294
+ constructor(shard_field: string, strategy: string);
295
+ /**
296
+ * Record a shard operation
297
+ */
298
+ record_shard_operation(shard_id: string, operation: string, time_ms: number, records_affected: number, size_bytes: bigint): void;
299
+ }
300
+
301
+ export function apply_sync_result(local_runtime: string, result: string): string;
302
+
303
+ export function authorize_offline(signed_grant: string, key_id: string, verification_key: string, request: string, grant_chain: string, revocations: string): string;
304
+
305
+ export function canonical_bundle_hash(bundle_json: string): string;
306
+
307
+ /**
308
+ * Canonicalizes a typed application manifest using the same Rust implementation
309
+ * used by the server. JavaScript never defines revision identity independently.
310
+ */
311
+ export function canonicalize_application_manifest(input: string): string;
312
+
313
+ export function compare_state_schemas(before: string, after: string): string;
314
+
315
+ export function diff_application_revisions(from: string | null | undefined, to: string): string;
316
+
317
+ export function hash_application_manifest(input: string): string;
318
+
319
+ export function hash_application_runtime(revision: string, environment: string): string;
320
+
321
+ export function hash_state_schema(schema: string): string;
322
+
323
+ /**
324
+ * Opens or creates a FeltDB database
325
+ *
326
+ * # Arguments
327
+ * * `path` - Path to the database file
328
+ *
329
+ * # Returns
330
+ * JsDb instance or error
331
+ */
332
+ export function open(path: string): JsDb;
333
+
334
+ export function resolve_application_runtime(revision: string, environment: string): string;
335
+
336
+ export function validate_mesh_claim(claim: string, worker: string, workload: string, now: bigint): void;
337
+
338
+ export function validate_state_schema(schema: string): string;
339
+
340
+ export function validate_sync_operation(operation: string): string;
341
+
342
+ export function validate_worker_transition(from: string, to: string): boolean;
343
+
344
+ export function validate_workload_transition(from: string, to: string): boolean;
345
+
346
+ export function verify_bundle_integrity(bundle_json: string): boolean;
347
+
348
+ /**
349
+ * Verify a portable signed grant with the exact Rust canonicalization used by
350
+ * the server. The verification key is provisioned with the offline app shell.
351
+ */
352
+ export function verify_signed_grant(signed_grant: string, key_id: string, verification_key: string, request: string, grant_chain: string, revocations: string): string;
353
+
354
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
355
+
356
+ export interface InitOutput {
357
+ readonly memory: WebAssembly.Memory;
358
+ readonly __wbg_jsdb_free: (a: number, b: number) => void;
359
+ readonly __wbg_jsresult_free: (a: number, b: number) => void;
360
+ readonly __wbg_wasmanalytics_free: (a: number, b: number) => void;
361
+ readonly __wbg_wasmdistributedindexmanager_free: (a: number, b: number) => void;
362
+ readonly __wbg_wasmindexmanager_free: (a: number, b: number) => void;
363
+ readonly __wbg_wasmshardmanager_free: (a: number, b: number) => void;
364
+ readonly apply_sync_result: (a: number, b: number, c: number, d: number) => [number, number, number, number];
365
+ readonly authorize_offline: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
366
+ readonly canonical_bundle_hash: (a: number, b: number) => [number, number, number, number];
367
+ readonly canonicalize_application_manifest: (a: number, b: number) => [number, number, number, number];
368
+ readonly compare_state_schemas: (a: number, b: number, c: number, d: number) => [number, number, number, number];
369
+ readonly diff_application_revisions: (a: number, b: number, c: number, d: number) => [number, number, number, number];
370
+ readonly hash_application_manifest: (a: number, b: number) => [number, number, number, number];
371
+ readonly hash_application_runtime: (a: number, b: number, c: number, d: number) => [number, number, number, number];
372
+ readonly hash_state_schema: (a: number, b: number) => [number, number, number, number];
373
+ readonly jsdb_acknowledge_peer_operations: (a: number, b: number, c: number, d: bigint) => number;
374
+ readonly jsdb_add_sync_peer: (a: number, b: number, c: number) => number;
375
+ readonly jsdb_delete: (a: number, b: number, c: number) => number;
376
+ readonly jsdb_execute_canonical_query: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
377
+ readonly jsdb_execute_canonical_transaction: (a: number, b: number, c: number, d: number, e: number) => number;
378
+ readonly jsdb_get: (a: number, b: number, c: number) => number;
379
+ readonly jsdb_get_capability_records: (a: number, b: number, c: number) => number;
380
+ readonly jsdb_get_pending_for_peer: (a: number, b: number, c: number, d: bigint) => number;
381
+ readonly jsdb_get_sequence: (a: number) => bigint;
382
+ readonly jsdb_insert: (a: number, b: number, c: number, d: number, e: number) => number;
383
+ readonly jsdb_instance_id: (a: number) => [number, number];
384
+ readonly jsdb_is_auto_indexed: (a: number) => number;
385
+ readonly jsdb_query: (a: number, b: number, c: number) => number;
386
+ readonly jsdb_remove_sync_peer: (a: number, b: number, c: number) => number;
387
+ readonly jsdb_sync_info: (a: number) => number;
388
+ readonly jsdb_update: (a: number, b: number, c: number, d: number, e: number) => number;
389
+ readonly jsresult_data: (a: number) => [number, number];
390
+ readonly jsresult_error: (a: number) => [number, number];
391
+ readonly jsresult_success: (a: number) => number;
392
+ readonly open: (a: number, b: number) => [number, number, number];
393
+ readonly resolve_application_runtime: (a: number, b: number, c: number, d: number) => [number, number, number, number];
394
+ readonly validate_mesh_claim: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint) => [number, number];
395
+ readonly validate_state_schema: (a: number, b: number) => [number, number, number, number];
396
+ readonly validate_sync_operation: (a: number, b: number) => [number, number, number, number];
397
+ readonly validate_worker_transition: (a: number, b: number, c: number, d: number) => [number, number, number];
398
+ readonly validate_workload_transition: (a: number, b: number, c: number, d: number) => [number, number, number];
399
+ readonly verify_bundle_integrity: (a: number, b: number) => [number, number, number];
400
+ readonly verify_signed_grant: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
401
+ readonly wasmanalytics_generate_report: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
402
+ readonly wasmanalytics_get_all_metrics: (a: number) => [number, number, number, number];
403
+ readonly wasmanalytics_get_frequent_fields: (a: number, b: number) => [number, number, number, number];
404
+ readonly wasmanalytics_get_index_metrics: (a: number, b: number, c: number) => [number, number, number, number];
405
+ readonly wasmanalytics_get_slowest_queries: (a: number, b: number) => [number, number, number, number];
406
+ readonly wasmanalytics_new: () => number;
407
+ readonly wasmanalytics_record_index_usage: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
408
+ readonly wasmanalytics_record_query: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: bigint, i: number, j: number) => [number, number];
409
+ readonly wasmanalytics_reset: (a: number) => void;
410
+ readonly wasmdistributedindexmanager_create_replicated_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
411
+ readonly wasmdistributedindexmanager_detect_conflicts: (a: number, b: number, c: number) => [number, number, number, number];
412
+ readonly wasmdistributedindexmanager_get_replication_status: (a: number, b: number, c: number) => [number, number, number, number];
413
+ readonly wasmdistributedindexmanager_get_replication_targets: (a: number, b: number, c: number) => [number, number, number, number];
414
+ readonly wasmdistributedindexmanager_get_sync_status: (a: number) => [number, number, number, number];
415
+ readonly wasmdistributedindexmanager_merge_versions: (a: number, b: number, c: number) => [number, number];
416
+ readonly wasmdistributedindexmanager_new: (a: number, b: number) => number;
417
+ readonly wasmdistributedindexmanager_register_peer: (a: number, b: number, c: number) => void;
418
+ readonly wasmdistributedindexmanager_set_peer_reachable: (a: number, b: number, c: number, d: number) => void;
419
+ readonly wasmindexmanager_create_index: (a: number, b: number, c: number) => [number, number];
420
+ readonly wasmindexmanager_get_stats: (a: number, b: number, c: number) => [number, number, number, number];
421
+ readonly wasmindexmanager_list_indexes: (a: number) => [number, number, number, number];
422
+ readonly wasmindexmanager_new: () => number;
423
+ readonly wasmindexmanager_query_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
424
+ readonly wasmindexmanager_update_record: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
425
+ readonly wasmshardmanager_detect_hotspots: (a: number) => [number, number, number, number];
426
+ readonly wasmshardmanager_generate_rebalance_ops: (a: number) => [number, number, number, number];
427
+ readonly wasmshardmanager_get_all_metrics: (a: number) => [number, number, number, number];
428
+ readonly wasmshardmanager_get_distribution_summary: (a: number) => [number, number, number, number];
429
+ readonly wasmshardmanager_get_shard_for_key: (a: number, b: number, c: number) => [number, number, number, number];
430
+ readonly wasmshardmanager_initialize_shards: (a: number, b: number, c: number) => [number, number];
431
+ readonly wasmshardmanager_new: (a: number, b: number, c: number, d: number) => number;
432
+ readonly wasmshardmanager_record_shard_operation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: bigint) => void;
433
+ readonly __wbindgen_externrefs: WebAssembly.Table;
434
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
435
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
436
+ readonly __externref_table_dealloc: (a: number) => void;
437
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
438
+ readonly __wbindgen_start: () => void;
439
+ }
440
+
441
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
442
+
443
+ /**
444
+ * Instantiates the given `module`, which can either be bytes or
445
+ * a precompiled `WebAssembly.Module`.
446
+ *
447
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
448
+ *
449
+ * @returns {InitOutput}
450
+ */
451
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
452
+
453
+ /**
454
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
455
+ * for everything else, calls `WebAssembly.instantiate` directly.
456
+ *
457
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
458
+ *
459
+ * @returns {Promise<InitOutput>}
460
+ */
461
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;