@feltdb/core 0.6.8 → 0.6.10

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 (99) hide show
  1. package/dist/cli/application.js +55 -88
  2. package/dist/cli/commands.js +206 -95
  3. package/dist/cli/index.js +1 -1
  4. package/dist/collection.d.ts +110 -2
  5. package/dist/collection.d.ts.map +1 -1
  6. package/dist/collection.js +228 -3
  7. package/dist/create/package-versions.js +1 -1
  8. package/dist/create/server-source/crates/feltdb/src/bin/feltdb_node.rs +408 -178
  9. package/dist/create/server-source/crates/feltdb/src/lib.rs +49 -5
  10. package/dist/create/server-source/crates/feltdb/src/multi_operation_transaction.rs +659 -0
  11. package/dist/create/server-source/crates/feltdb/src/p1_application_atomicity.rs +285 -0
  12. package/dist/create/server-source/crates/feltdb/src/p1_atomicity_acceptance.rs +582 -0
  13. package/dist/create/server-source/crates/feltdb-server/src/main.rs +141 -0
  14. package/dist/db.d.ts +59 -0
  15. package/dist/db.d.ts.map +1 -1
  16. package/dist/db.js +94 -2
  17. package/dist/embedded-transaction.d.ts +77 -0
  18. package/dist/embedded-transaction.d.ts.map +1 -0
  19. package/dist/embedded-transaction.js +102 -0
  20. package/dist/feltdb.d.ts +49 -1
  21. package/dist/feltdb.d.ts.map +1 -1
  22. package/dist/file-db.d.ts +33 -0
  23. package/dist/file-db.d.ts.map +1 -1
  24. package/dist/file-db.js +128 -4
  25. package/dist/freshness.d.ts +119 -0
  26. package/dist/freshness.d.ts.map +1 -0
  27. package/dist/freshness.js +115 -0
  28. package/dist/http-db.d.ts +48 -0
  29. package/dist/http-db.d.ts.map +1 -1
  30. package/dist/http-db.js +77 -1
  31. package/dist/index-backend.d.ts +8 -0
  32. package/dist/index-backend.d.ts.map +1 -1
  33. package/dist/index-backend.js +13 -0
  34. package/dist/index-core.d.ts +78 -0
  35. package/dist/index-core.d.ts.map +1 -0
  36. package/dist/index-core.js +72 -0
  37. package/dist/index-manager.d.ts +11 -0
  38. package/dist/index-manager.d.ts.map +1 -1
  39. package/dist/index-manager.js +30 -13
  40. package/dist/index-types.d.ts +17 -0
  41. package/dist/index-types.d.ts.map +1 -1
  42. package/dist/index.browser.d.ts +14 -0
  43. package/dist/index.browser.d.ts.map +1 -0
  44. package/dist/index.browser.js +13 -0
  45. package/dist/index.d.ts +8 -59
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +11 -54
  48. package/dist/indexeddb-db.d.ts +32 -0
  49. package/dist/indexeddb-db.d.ts.map +1 -1
  50. package/dist/indexeddb-db.js +151 -1
  51. package/dist/memory-db.d.ts +26 -0
  52. package/dist/memory-db.d.ts.map +1 -1
  53. package/dist/memory-db.js +86 -0
  54. package/dist/runtime-registry.d.ts +32 -0
  55. package/dist/runtime-registry.d.ts.map +1 -0
  56. package/dist/runtime-registry.js +38 -0
  57. package/dist/studio-app/assets/{feltdb_wasm-B4wq4mqp.js → feltdb_wasm-CJv3wHzi.js} +1 -1
  58. package/dist/studio-app/assets/feltdb_wasm_bg-C8TG8r2n.wasm +0 -0
  59. package/dist/studio-app/assets/index-D3rT0SJi.js +28 -0
  60. package/dist/studio-app/index.html +1 -1
  61. package/dist/transaction.d.ts +98 -0
  62. package/dist/transaction.d.ts.map +1 -0
  63. package/dist/transaction.js +86 -0
  64. package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
  65. package/dist/workspace/browser.d.ts +22 -0
  66. package/dist/workspace/browser.d.ts.map +1 -0
  67. package/dist/workspace/browser.js +17 -0
  68. package/dist/workspace/git-identity.d.ts +35 -0
  69. package/dist/workspace/git-identity.d.ts.map +1 -0
  70. package/dist/workspace/git-identity.js +81 -0
  71. package/dist/workspace/index.d.ts +11 -1
  72. package/dist/workspace/index.d.ts.map +1 -1
  73. package/dist/workspace/index.js +6 -0
  74. package/dist/workspace/investigation-analysis.d.ts +47 -0
  75. package/dist/workspace/investigation-analysis.d.ts.map +1 -0
  76. package/dist/workspace/investigation-analysis.js +181 -0
  77. package/dist/workspace/investigation-lifecycle-manager.d.ts +86 -0
  78. package/dist/workspace/investigation-lifecycle-manager.d.ts.map +1 -0
  79. package/dist/workspace/investigation-lifecycle-manager.js +229 -0
  80. package/dist/workspace/investigation-supervisor.d.ts +100 -0
  81. package/dist/workspace/investigation-supervisor.d.ts.map +1 -0
  82. package/dist/workspace/investigation-supervisor.js +236 -0
  83. package/dist/workspace/runtime-investigation.d.ts +1 -1
  84. package/dist/workspace/runtime-investigation.d.ts.map +1 -1
  85. package/dist/workspace/runtime-investigation.js +46 -21
  86. package/dist/workspace/runtime-observation.d.ts +79 -0
  87. package/dist/workspace/runtime-observation.d.ts.map +1 -0
  88. package/dist/workspace/runtime-observation.js +152 -0
  89. package/dist/workspace/runtime-observer.d.ts +51 -0
  90. package/dist/workspace/runtime-observer.d.ts.map +1 -0
  91. package/dist/workspace/runtime-observer.js +268 -0
  92. package/dist/workspace/workspace-connection.d.ts.map +1 -1
  93. package/dist/workspace/workspace-connection.js +14 -5
  94. package/dist/workspace/workspace-types.d.ts +113 -0
  95. package/dist/workspace/workspace-types.d.ts.map +1 -1
  96. package/package.json +12 -4
  97. package/dist/create/server-source/crates/feltdb/src/phase_1c_three_node.rs +0 -523
  98. package/dist/studio-app/assets/feltdb_wasm_bg-Ceyi7l21.wasm +0 -0
  99. package/dist/studio-app/assets/index-BF45M757.js +0 -28
@@ -1 +1 @@
1
- {"version":3,"file":"http-db.d.ts","sourceRoot":"","sources":["../src/http-db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC,UAAU,QAAQ;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,kBAAkB;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,iFAAiF;AACjF,qBAAa,QAAS,YAAW,IAAI;IAC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;IAC5B,oBAAoB,IAAI,QAAQ;IAChC,2BAA2B,IAAI,QAAQ;IACvC,WAAW,IAAI,MAAM;IAErB;;;;;;;;OAQG;IACH,YAAY,IAAI,MAAM;IAEtB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,eAAe,CAAC,CAAS;IAE3B,SAAS,IAAI,OAAO,CAAC,mBAAmB,CAAC;IA0BzC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;YAKrB,IAAI;IAOlB,OAAO,CAAC,MAAM;CAIf"}
package/dist/http-db.js CHANGED
@@ -82,6 +82,25 @@ export class HttpJsDb {
82
82
  return { success: false, error: String(error) };
83
83
  }
84
84
  }
85
+ /**
86
+ * Commit a multi-operation transaction through the authority.
87
+ *
88
+ * The whole transaction travels as one request and is committed as one
89
+ * durable record on the server. A refusal means nothing was applied.
90
+ */
91
+ async commit_transaction(request) {
92
+ const response = await fetch(`${this.url}/transactions`, {
93
+ method: 'POST',
94
+ headers: this.headers(true),
95
+ body: JSON.stringify(request),
96
+ });
97
+ if (!response.ok) {
98
+ const failure = await this.failure(response);
99
+ throw new Error(failure.error || `transaction failed with HTTP ${response.status}`);
100
+ }
101
+ const body = await response.json();
102
+ return body;
103
+ }
85
104
  async cas(params) {
86
105
  try {
87
106
  const [collection, id] = this.splitKey(params.key);
@@ -220,7 +239,16 @@ export class HttpJsDb {
220
239
  if (controller.signal.aborted)
221
240
  return;
222
241
  }
223
- await new Promise(resolve => setTimeout(resolve, 1000));
242
+ if (controller.signal.aborted)
243
+ return;
244
+ // The retry timer must not keep a Node process alive on its own. An
245
+ // authority that has shut down would otherwise stop its clients from
246
+ // ever exiting, because this loop reconnects forever.
247
+ await new Promise(resolve => {
248
+ const timer = setTimeout(resolve, 1000);
249
+ timer?.unref?.();
250
+ controller.signal.addEventListener('abort', () => { clearTimeout(timer); resolve(); }, { once: true });
251
+ });
224
252
  }
225
253
  }
226
254
  async failure(response) {
@@ -242,5 +270,53 @@ export class HttpJsDb {
242
270
  get_pending_for_peer() { return { success: false, error: 'Operation transport is server-managed' }; }
243
271
  acknowledge_peer_operations() { return { success: false, error: 'Operation transport is server-managed' }; }
244
272
  instance_id() { return `remote:${this.url}`; }
273
+ /**
274
+ * `get_sequence()` is a hardcoded `0` here, and that is why it could never be
275
+ * the freshness contract: the client has no local counter worth reporting.
276
+ *
277
+ * The authority does have one. A single process advances `inner.sequence`
278
+ * inside the same critical section that writes the durable transaction
279
+ * record, so concurrent clients are serialized by the server and the revision
280
+ * is totally ordered. `GET /revision` reads it without performing a write.
281
+ */
245
282
  get_sequence() { return 0; }
283
+ async freshness() {
284
+ if (this.advertisedScope === undefined) {
285
+ // An authority that predates `/revision` cannot validate a cache by
286
+ // revision, and saying so is a real answer rather than a failure: the
287
+ // caller falls back to refresh, which is always correct. Only a 404
288
+ // degrades — a network error or a 500 is not evidence about what the
289
+ // server supports, so it is raised rather than reported as a capability.
290
+ const probe = await fetch(`${this.url}/revision`, { headers: this.headers() });
291
+ if (probe.status === 404) {
292
+ return {
293
+ domain: 'single-authority',
294
+ validation: 'refresh',
295
+ invalidation: true,
296
+ reason: 'this authority does not serve GET /revision, so it cannot report a committed revision',
297
+ };
298
+ }
299
+ this.absorb(await this.body(probe));
300
+ }
301
+ return {
302
+ domain: 'single-authority',
303
+ validation: 'revision',
304
+ invalidation: true,
305
+ revisionScope: this.advertisedScope,
306
+ };
307
+ }
308
+ async revision() {
309
+ const body = this.absorb(await this.body(await fetch(`${this.url}/revision`, { headers: this.headers() })));
310
+ return { value: body.revision, scope: body.scope };
311
+ }
312
+ async body(response) {
313
+ if (!response.ok) {
314
+ throw new Error(`revision request failed: ${response.status} ${response.statusText}`);
315
+ }
316
+ return await response.json();
317
+ }
318
+ absorb(body) {
319
+ this.advertisedScope ?? (this.advertisedScope = body.scope);
320
+ return body;
321
+ }
246
322
  }
@@ -19,6 +19,14 @@ export declare class IndexBackend implements IIndexBackend {
19
19
  initializeWasm(): Promise<void>;
20
20
  createIndex(config: IndexConfig): void;
21
21
  updateRecord(recordId: string, oldValue: Record<string, any> | null, newValue: Record<string, any>): void;
22
+ /**
23
+ * Discard indexed entries, keeping definitions. Reports whether it worked.
24
+ *
25
+ * The WASM backend exposes no reset, so a caller that needs the index to
26
+ * reflect a specific snapshot must treat `false` as "do not trust the index"
27
+ * rather than assuming the reset happened.
28
+ */
29
+ resetEntries(): boolean;
22
30
  queryIndex(name: string, query: IndexQuery): string[];
23
31
  queryCompoundIndex(name: string, values: Record<string, any>): string[];
24
32
  listIndexes(): IndexConfig[];
@@ -1 +1 @@
1
- {"version":3,"file":"index-backend.d.ts","sourceRoot":"","sources":["../src/index-backend.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEhE,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IACvC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAC1G,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE,CAAC;IACtD,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,EAAE,CAAC;IACxE,WAAW,IAAI,WAAW,EAAE,CAAC;CAC9B;AAyBD,qBAAa,YAAa,YAAW,aAAa;IAChD,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,OAAO,CAAkB;;IAM3B,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAcrC,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAYtC,YAA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WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAYtC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAezG;;;;;;OAMG;IACH,YAAY,IAAI,OAAO;IAMvB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE;IAYrD,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,EAAE;IAgBvE,WAAW,IAAI,WAAW,EAAE;CAW7B"}
@@ -72,6 +72,19 @@ export class IndexBackend {
72
72
  }
73
73
  this.tsBackend?.updateRecord(recordId, oldValue, newValue);
74
74
  }
75
+ /**
76
+ * Discard indexed entries, keeping definitions. Reports whether it worked.
77
+ *
78
+ * The WASM backend exposes no reset, so a caller that needs the index to
79
+ * reflect a specific snapshot must treat `false` as "do not trust the index"
80
+ * rather than assuming the reset happened.
81
+ */
82
+ resetEntries() {
83
+ if (this.useWasm && this.wasmBackend)
84
+ return false;
85
+ this.tsBackend?.resetEntries();
86
+ return this.tsBackend !== null;
87
+ }
75
88
  queryIndex(name, query) {
76
89
  if (this.useWasm && this.wasmBackend) {
77
90
  try {
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Shared @feltdb/core surface.
3
+ *
4
+ * Everything here loads in any JavaScript environment. Modules that need Node
5
+ * built-ins are re-exported by `index.ts` (the Node entry) instead, so that a
6
+ * browser can load this graph without hitting a bare `fs` or `path`
7
+ * specifier.
8
+ *
9
+ * Applications import `@feltdb/core`, not this module directly.
10
+ */
11
+ export * from './db.js';
12
+ export * from './collection.js';
13
+ export * from './transaction.js';
14
+ export * from './freshness.js';
15
+ export * from './cell.js';
16
+ export * from './reactive-graph.js';
17
+ export * from './index-types.js';
18
+ export * from './index-backend.js';
19
+ export * from './index-store.js';
20
+ export * from './index-recovery.js';
21
+ export * from './query-planner.js';
22
+ export * from './index-analytics.js';
23
+ export * from './analytics-backend.js';
24
+ export * from './index-dashboard.js';
25
+ export * from './index-monitoring.js';
26
+ export * from './distributed-indexing.js';
27
+ export * from './sharding.js';
28
+ export * from './recovery.js';
29
+ export * from './execution.js';
30
+ export * from './workflow.js';
31
+ export * from './capability.js';
32
+ export * from './memory-db.js';
33
+ export * from './http-db.js';
34
+ export * from './http-client.js';
35
+ export * from './indexeddb-db.js';
36
+ export * from './flowspec.js';
37
+ export * from './application-manifest.js';
38
+ export * from './state-contract.js';
39
+ export * from './revision-recovery.js';
40
+ export * from './operation-admission.js';
41
+ export * from './error-codes.js';
42
+ export * from './authorization.js';
43
+ export * from './sync-contract.js';
44
+ export * from './workload.js';
45
+ export * from './worker.js';
46
+ export * from './artifact.js';
47
+ export * from './bundle.js';
48
+ export * from './release.js';
49
+ export * from './observe.js';
50
+ export * from './provider.js';
51
+ export * from './identity.js';
52
+ export * from './application-contract.js';
53
+ export { ProtocolHandler, type Message, type Operation as ProtocolOperation, type Response as ProtocolResponse, } from './protocol.js';
54
+ /**
55
+ * Agent Runtime APIs
56
+ */
57
+ export * from './agent.js';
58
+ export * from './agent-observation.js';
59
+ export * from './agent-decision.js';
60
+ export * from './agent-memory.js';
61
+ export * from './agent-registry.js';
62
+ export * from './agent-runtime.js';
63
+ /**
64
+ * Telemetry APIs
65
+ */
66
+ export { emitTelemetry, getTelemetryClient } from './telemetry.js';
67
+ export type { TelemetryEvent, TelemetryEventType } from './telemetry.js';
68
+ /**
69
+ * Observability and inspection APIs
70
+ */
71
+ export type { ProvenanceGraph, ProvenanceNode, ProvenanceEdge, ProvenanceEdgeType, RuntimeDiagnostics, } from './db.js';
72
+ /**
73
+ * Development Workspace APIs
74
+ *
75
+ * Shared development state for coordinating Browser, IDE, and Agent clients.
76
+ */
77
+ export * from './workspace/browser.js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,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,KAAK,OAAO,EACZ,KAAK,SAAS,IAAI,iBAAiB,EACnC,KAAK,QAAQ,IAAI,gBAAgB,GAClC,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AAEnC;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACnE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzE;;GAEG;AACH,YAAY,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Shared @feltdb/core surface.
3
+ *
4
+ * Everything here loads in any JavaScript environment. Modules that need Node
5
+ * built-ins are re-exported by `index.ts` (the Node entry) instead, so that a
6
+ * browser can load this graph without hitting a bare `fs` or `path`
7
+ * specifier.
8
+ *
9
+ * Applications import `@feltdb/core`, not this module directly.
10
+ */
11
+ export * from './db.js';
12
+ export * from './collection.js';
13
+ export * from './transaction.js';
14
+ export * from './freshness.js';
15
+ export * from './cell.js';
16
+ export * from './reactive-graph.js';
17
+ export * from './index-types.js';
18
+ export * from './index-backend.js';
19
+ export * from './index-store.js';
20
+ export * from './index-recovery.js';
21
+ export * from './query-planner.js';
22
+ export * from './index-analytics.js';
23
+ export * from './analytics-backend.js';
24
+ export * from './index-dashboard.js';
25
+ export * from './index-monitoring.js';
26
+ export * from './distributed-indexing.js';
27
+ export * from './sharding.js';
28
+ export * from './recovery.js';
29
+ export * from './execution.js';
30
+ export * from './workflow.js';
31
+ export * from './capability.js';
32
+ export * from './memory-db.js';
33
+ export * from './http-db.js';
34
+ export * from './http-client.js';
35
+ export * from './indexeddb-db.js';
36
+ export * from './flowspec.js';
37
+ export * from './application-manifest.js';
38
+ export * from './state-contract.js';
39
+ export * from './revision-recovery.js';
40
+ export * from './operation-admission.js';
41
+ export * from './error-codes.js';
42
+ export * from './authorization.js';
43
+ export * from './sync-contract.js';
44
+ export * from './workload.js';
45
+ export * from './worker.js';
46
+ export * from './artifact.js';
47
+ export * from './bundle.js';
48
+ export * from './release.js';
49
+ export * from './observe.js';
50
+ export * from './provider.js';
51
+ export * from './identity.js';
52
+ export * from './application-contract.js';
53
+ export { ProtocolHandler, } from './protocol.js';
54
+ /**
55
+ * Agent Runtime APIs
56
+ */
57
+ export * from './agent.js';
58
+ export * from './agent-observation.js';
59
+ export * from './agent-decision.js';
60
+ export * from './agent-memory.js';
61
+ export * from './agent-registry.js';
62
+ export * from './agent-runtime.js';
63
+ /**
64
+ * Telemetry APIs
65
+ */
66
+ export { emitTelemetry, getTelemetryClient } from './telemetry.js';
67
+ /**
68
+ * Development Workspace APIs
69
+ *
70
+ * Shared development state for coordinating Browser, IDE, and Agent clients.
71
+ */
72
+ export * from './workspace/browser.js';
@@ -8,6 +8,17 @@ export declare class IndexManager {
8
8
  private indexes;
9
9
  private config;
10
10
  private indexStats;
11
+ /** Construct an empty index from its configuration. */
12
+ private buildIndex;
13
+ /**
14
+ * Discard every indexed entry while keeping the index definitions.
15
+ *
16
+ * A caller that derives its indexes from a snapshot of the data needs to
17
+ * rebuild them when that snapshot is replaced. Without this, entries for
18
+ * records that are no longer present would linger and a query could return
19
+ * ids the caller can no longer resolve.
20
+ */
21
+ resetEntries(): void;
11
22
  createIndex(config: IndexConfig): void;
12
23
  updateRecord(recordId: string, oldValue: Record<string, any> | null, newValue: Record<string, any>): void;
13
24
  queryIndex(name: string, query: IndexQuery): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"index-manager.d.ts","sourceRoot":"","sources":["../src/index-manager.ts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G,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IA6BzG,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE;IA0BrD,WAAW,IAAI,WAAW,EAAE;IAI5B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAIzC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS;CAwCvC"}
@@ -201,23 +201,40 @@ export class IndexManager {
201
201
  this.config = new Map();
202
202
  this.indexStats = new Map();
203
203
  }
204
+ /** Construct an empty index from its configuration. */
205
+ buildIndex(config) {
206
+ if (config.type === 'hash' && config.field)
207
+ return new HashIndex(config.field);
208
+ if (config.type === 'sorted' && config.field)
209
+ return new SortedIndex(config.field);
210
+ if (config.type === 'text' && config.textFields)
211
+ return new TextIndex(config.textFields);
212
+ throw new Error(`Invalid index config: ${JSON.stringify(config)}`);
213
+ }
214
+ /**
215
+ * Discard every indexed entry while keeping the index definitions.
216
+ *
217
+ * A caller that derives its indexes from a snapshot of the data needs to
218
+ * rebuild them when that snapshot is replaced. Without this, entries for
219
+ * records that are no longer present would linger and a query could return
220
+ * ids the caller can no longer resolve.
221
+ */
222
+ resetEntries() {
223
+ for (const [name, config] of this.config) {
224
+ this.indexes.set(name, this.buildIndex(config));
225
+ const stats = this.indexStats.get(name);
226
+ if (stats) {
227
+ stats.entries = 0;
228
+ stats.size = 0;
229
+ stats.lastUpdated = Date.now();
230
+ }
231
+ }
232
+ }
204
233
  createIndex(config) {
205
234
  if (this.indexes.has(config.name)) {
206
235
  throw new Error(`Index ${config.name} already exists`);
207
236
  }
208
- let index;
209
- if (config.type === 'hash' && config.field) {
210
- index = new HashIndex(config.field);
211
- }
212
- else if (config.type === 'sorted' && config.field) {
213
- index = new SortedIndex(config.field);
214
- }
215
- else if (config.type === 'text' && config.textFields) {
216
- index = new TextIndex(config.textFields);
217
- }
218
- else {
219
- throw new Error(`Invalid index config: ${JSON.stringify(config)}`);
220
- }
237
+ const index = this.buildIndex(config);
221
238
  this.indexes.set(config.name, index);
222
239
  this.config.set(config.name, config);
223
240
  this.indexStats.set(config.name, {
@@ -35,6 +35,23 @@ export interface IndexQuery {
35
35
  min?: any;
36
36
  max?: any;
37
37
  }
38
+ /**
39
+ * How a `Collection.find` call was answered.
40
+ *
41
+ * Distinct from `QueryPlan`, which describes the cost-based planner's output.
42
+ * This records what a single collection read actually did.
43
+ */
44
+ export interface CollectionQueryPlan {
45
+ strategy: 'index' | 'scan';
46
+ /** Present when the index was used. */
47
+ indexName?: string;
48
+ field?: string;
49
+ /** Present when a scan was chosen, explaining why. */
50
+ reason?: string;
51
+ /** Records the predicate was applied to. */
52
+ candidatesExamined: number;
53
+ recordsReturned: number;
54
+ }
38
55
  export interface IndexScanPlan {
39
56
  indexName: string;
40
57
  indexType: IndexType;
@@ -1 +1 @@
1
- {"version":3,"file":"index-types.d.ts","sourceRoot":"","sources":["../src/index-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;AAEhE,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IAEb,mDAAmD;IACnD,IAAI,EAAE,SAAS,CAAC;IAEhB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAU,CAAC,CAA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 -0,0 +1,14 @@
1
+ /**
2
+ * Browser entry point for @feltdb/core.
3
+ *
4
+ * Selected by the `browser` condition in the package exports map, so a browser
5
+ * application writing `import { createFeltDB } from '@feltdb/core'` gets a
6
+ * module graph with no Node built-ins in it.
7
+ *
8
+ * The browser runtime itself has no Node dependencies, so it is imported
9
+ * directly by `db.ts`. What this entry does is leave the file runtime out of
10
+ * the graph, which is what makes `createFeltDB({ browser: true })` — and
11
+ * therefore `db.transaction()` — reachable through the public package entry.
12
+ */
13
+ export * from './index-core.js';
14
+ //# sourceMappingURL=index.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Browser entry point for @feltdb/core.
3
+ *
4
+ * Selected by the `browser` condition in the package exports map, so a browser
5
+ * application writing `import { createFeltDB } from '@feltdb/core'` gets a
6
+ * module graph with no Node built-ins in it.
7
+ *
8
+ * The browser runtime itself has no Node dependencies, so it is imported
9
+ * directly by `db.ts`. What this entry does is leave the file runtime out of
10
+ * the graph, which is what makes `createFeltDB({ browser: true })` — and
11
+ * therefore `db.transaction()` — reachable through the public package entry.
12
+ */
13
+ export * from './index-core.js';
package/dist/index.d.ts CHANGED
@@ -4,71 +4,20 @@
4
4
  * The primary interface for developers using FeltDB.
5
5
  * Provides a simple, state-first API for data persistence,
6
6
  * reactivity, and distributed operations.
7
+ *
8
+ * This is the Node entry point. It adds the runtimes and workspace tooling
9
+ * that need Node built-ins on top of the shared surface in `index-core.ts`.
10
+ * Browsers resolve `index.browser.ts` instead, through the package exports
11
+ * map, so that a bare `fs` import never enters a browser module graph.
7
12
  */
8
- export * from './db.js';
9
- export * from './collection.js';
10
- export * from './cell.js';
11
- export * from './reactive-graph.js';
12
- export * from './index-types.js';
13
- export * from './index-backend.js';
14
- export * from './index-store.js';
15
- export * from './index-recovery.js';
16
- export * from './query-planner.js';
17
- export * from './index-analytics.js';
18
- export * from './analytics-backend.js';
19
- export * from './index-dashboard.js';
20
- export * from './index-monitoring.js';
21
- export * from './distributed-indexing.js';
22
- export * from './sharding.js';
23
- export * from './recovery.js';
24
- export * from './execution.js';
25
- export * from './workflow.js';
26
- export * from './capability.js';
27
- export * from './memory-db.js';
28
- export * from './http-db.js';
29
- export * from './http-client.js';
30
- export * from './indexeddb-db.js';
13
+ export * from './index-core.js';
31
14
  export * from './file-db.js';
32
- export * from './flowspec.js';
33
- export * from './application-manifest.js';
34
- export * from './state-contract.js';
35
- export * from './revision-recovery.js';
36
- export * from './operation-admission.js';
37
- export * from './error-codes.js';
38
- export * from './authorization.js';
39
- export * from './sync-contract.js';
40
- export * from './workload.js';
41
- export * from './worker.js';
42
- export * from './artifact.js';
43
- export * from './bundle.js';
44
- export * from './release.js';
45
- export * from './observe.js';
46
- export * from './provider.js';
47
- export * from './identity.js';
48
- export * from './application-contract.js';
49
- export { ProtocolHandler, type Message, type Operation as ProtocolOperation, type Response as ProtocolResponse, } from './protocol.js';
50
- /**
51
- * Agent Runtime APIs
52
- */
53
- export * from './agent.js';
54
- export * from './agent-observation.js';
55
- export * from './agent-decision.js';
56
- export * from './agent-memory.js';
57
- export * from './agent-registry.js';
58
- export * from './agent-runtime.js';
59
- /**
60
- * Telemetry APIs
61
- */
62
- export { emitTelemetry, getTelemetryClient } from './telemetry.js';
63
- export type { TelemetryEvent, TelemetryEventType } from './telemetry.js';
64
- /**
65
- * Observability and inspection APIs
66
- */
67
- export type { ProvenanceGraph, ProvenanceNode, ProvenanceEdge, ProvenanceEdgeType, RuntimeDiagnostics, } from './db.js';
68
15
  /**
69
16
  * Development Workspace APIs
70
17
  *
71
18
  * Shared development state for coordinating Browser, IDE, and Agent clients.
19
+ * The Node-only pieces (durable investigation store, supervisor, local
20
+ * development authority, Git inspection) are available from this entry only.
72
21
  */
73
22
  export * from './workspace/index.js';
74
23
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EACZ,KAAK,SAAS,IAAI,iBAAiB,EACnC,KAAK,QAAQ,IAAI,gBAAgB,GAClC,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AAEnC;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACnE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzE;;GAEG;AACH,YAAY,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAE7B;;;;;;GAMG;AACH,cAAc,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -4,65 +4,22 @@
4
4
  * The primary interface for developers using FeltDB.
5
5
  * Provides a simple, state-first API for data persistence,
6
6
  * reactivity, and distributed operations.
7
+ *
8
+ * This is the Node entry point. It adds the runtimes and workspace tooling
9
+ * that need Node built-ins on top of the shared surface in `index-core.ts`.
10
+ * Browsers resolve `index.browser.ts` instead, through the package exports
11
+ * map, so that a bare `fs` import never enters a browser module graph.
7
12
  */
8
- export * from './db.js';
9
- export * from './collection.js';
10
- export * from './cell.js';
11
- export * from './reactive-graph.js';
12
- export * from './index-types.js';
13
- export * from './index-backend.js';
14
- export * from './index-store.js';
15
- export * from './index-recovery.js';
16
- export * from './query-planner.js';
17
- export * from './index-analytics.js';
18
- export * from './analytics-backend.js';
19
- export * from './index-dashboard.js';
20
- export * from './index-monitoring.js';
21
- export * from './distributed-indexing.js';
22
- export * from './sharding.js';
23
- export * from './recovery.js';
24
- export * from './execution.js';
25
- export * from './workflow.js';
26
- export * from './capability.js';
27
- export * from './memory-db.js';
28
- export * from './http-db.js';
29
- export * from './http-client.js';
30
- export * from './indexeddb-db.js';
13
+ import { registerRuntime } from './runtime-registry.js';
14
+ import { FileJsDb } from './file-db.js';
15
+ registerRuntime('file', path => new FileJsDb(path));
16
+ export * from './index-core.js';
31
17
  export * from './file-db.js';
32
- export * from './flowspec.js';
33
- export * from './application-manifest.js';
34
- export * from './state-contract.js';
35
- export * from './revision-recovery.js';
36
- export * from './operation-admission.js';
37
- export * from './error-codes.js';
38
- export * from './authorization.js';
39
- export * from './sync-contract.js';
40
- export * from './workload.js';
41
- export * from './worker.js';
42
- export * from './artifact.js';
43
- export * from './bundle.js';
44
- export * from './release.js';
45
- export * from './observe.js';
46
- export * from './provider.js';
47
- export * from './identity.js';
48
- export * from './application-contract.js';
49
- export { ProtocolHandler, } from './protocol.js';
50
- /**
51
- * Agent Runtime APIs
52
- */
53
- export * from './agent.js';
54
- export * from './agent-observation.js';
55
- export * from './agent-decision.js';
56
- export * from './agent-memory.js';
57
- export * from './agent-registry.js';
58
- export * from './agent-runtime.js';
59
- /**
60
- * Telemetry APIs
61
- */
62
- export { emitTelemetry, getTelemetryClient } from './telemetry.js';
63
18
  /**
64
19
  * Development Workspace APIs
65
20
  *
66
21
  * Shared development state for coordinating Browser, IDE, and Agent clients.
22
+ * The Node-only pieces (durable investigation store, supervisor, local
23
+ * development authority, Git inspection) are available from this entry only.
67
24
  */
68
25
  export * from './workspace/index.js';