@typicalday/firegraph 0.15.0 → 0.16.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.
Files changed (57) hide show
  1. package/README.md +39 -17
  2. package/dist/{backend-CvImIwTY.d.cts → backend-CE3pM9-T.d.ts} +32 -2
  3. package/dist/{backend-BpYLdwCW.d.cts → backend-DNzv8KSR.d.cts} +33 -19
  4. package/dist/{backend-BpYLdwCW.d.ts → backend-DNzv8KSR.d.ts} +33 -19
  5. package/dist/{backend-YH5HtawN.d.ts → backend-EjFfw9yO.d.cts} +32 -2
  6. package/dist/backend.cjs.map +1 -1
  7. package/dist/backend.d.cts +2 -2
  8. package/dist/backend.d.ts +2 -2
  9. package/dist/backend.js +1 -1
  10. package/dist/{chunk-FODIMIWY.js → chunk-5JBNLH5W.js} +17 -6
  11. package/dist/chunk-5JBNLH5W.js.map +1 -0
  12. package/dist/{chunk-5HIRYV2S.js → chunk-6IO74NKD.js} +12 -10
  13. package/dist/{chunk-5HIRYV2S.js.map → chunk-6IO74NKD.js.map} +1 -1
  14. package/dist/{chunk-ULRDQ6HZ.js → chunk-NZVSLWNY.js} +6 -1
  15. package/dist/chunk-NZVSLWNY.js.map +1 -0
  16. package/dist/{chunk-N5HFDWQX.js → chunk-PWIO46RT.js} +1 -1
  17. package/dist/{chunk-N5HFDWQX.js.map → chunk-PWIO46RT.js.map} +1 -1
  18. package/dist/{client-B5o39X79.d.ts → client-CNAwJayO.d.ts} +1 -1
  19. package/dist/{client-BGHwxwPg.d.cts → client-CaXH5D5C.d.cts} +1 -1
  20. package/dist/cloudflare/index.cjs +11 -9
  21. package/dist/cloudflare/index.cjs.map +1 -1
  22. package/dist/cloudflare/index.d.cts +3 -3
  23. package/dist/cloudflare/index.d.ts +3 -3
  24. package/dist/cloudflare/index.js +3 -3
  25. package/dist/codegen/index.d.cts +1 -1
  26. package/dist/codegen/index.d.ts +1 -1
  27. package/dist/firestore-enterprise/index.cjs +11 -9
  28. package/dist/firestore-enterprise/index.cjs.map +1 -1
  29. package/dist/firestore-enterprise/index.d.cts +3 -3
  30. package/dist/firestore-enterprise/index.d.ts +3 -3
  31. package/dist/firestore-enterprise/index.js +2 -2
  32. package/dist/firestore-standard/index.cjs +11 -9
  33. package/dist/firestore-standard/index.cjs.map +1 -1
  34. package/dist/firestore-standard/index.d.cts +3 -3
  35. package/dist/firestore-standard/index.d.ts +3 -3
  36. package/dist/firestore-standard/index.js +2 -2
  37. package/dist/index.cjs +11 -9
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.d.cts +4 -4
  40. package/dist/index.d.ts +4 -4
  41. package/dist/index.js +1 -1
  42. package/dist/{registry-tKTb5Kx1.d.ts → registry-By1i-zge.d.ts} +1 -1
  43. package/dist/{registry-BGh7Jqpb.d.cts → registry-CNToyEra.d.cts} +1 -1
  44. package/dist/sqlite/index.cjs +24 -12
  45. package/dist/sqlite/index.cjs.map +1 -1
  46. package/dist/sqlite/index.d.cts +4 -4
  47. package/dist/sqlite/index.d.ts +4 -4
  48. package/dist/sqlite/index.js +4 -4
  49. package/dist/sqlite/local.cjs +484 -47
  50. package/dist/sqlite/local.cjs.map +1 -1
  51. package/dist/sqlite/local.d.cts +31 -5
  52. package/dist/sqlite/local.d.ts +31 -5
  53. package/dist/sqlite/local.js +439 -4
  54. package/dist/sqlite/local.js.map +1 -1
  55. package/package.json +1 -1
  56. package/dist/chunk-FODIMIWY.js.map +0 -1
  57. package/dist/chunk-ULRDQ6HZ.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- export { c as createGraphClient, a as createGraphClientFromBackend } from './client-BGHwxwPg.cjs';
1
+ export { c as createGraphClient, a as createGraphClientFromBackend } from './client-CaXH5D5C.cjs';
2
2
  export { CodegenOptions, generateTypes } from './codegen/index.cjs';
3
- import { I as IndexSpec, l as DiscoveryResult, R as RegistryEntry, v as StoredGraphRecord, H as MigrationWriteBack, K as MigrationStep, p as GraphRegistry, F as FindEdgesParams, L as QueryPlan, N as FindNodesParams, Q as QueryFilter, M as MigrationExecutor, O as MigrationFn, P as StoredMigrationStep, o as GraphClient, q as GraphReader, V as TraversalBuilder } from './backend-BpYLdwCW.cjs';
4
- export { w as AggregateExtension, x as AggregateField, y as AggregateOp, z as AggregateResult, A as AggregateSpec, X as BulkBatchError, t as BulkOptions, Y as BulkProgress, u as BulkResult, b as BulkUpdatePatch, C as Capability, s as CascadeResult, Z as CoreGraphClient, _ as DefineTypeOptions, $ as DiscoveredEntity, a0 as DistanceMeasure, d as DmlExtension, n as DynamicGraphClient, a1 as DynamicGraphMethods, m as DynamicRegistryConfig, a2 as EdgeTopology, a3 as EdgeTypeData, E as ExpandParams, e as ExpandResult, a4 as FindEdgesProjectedParams, a5 as FindNearestParams, a6 as FiregraphConfig, a7 as FullTextSearchExtension, a8 as GeoExtension, a9 as GraphBatch, G as GraphClientOptions, aa as GraphRecord, ab as GraphTransaction, ac as GraphWriter, ad as HopDefinition, ae as HopResult, af as IndexFieldSpec, J as JoinExtension, ag as NodeTypeData, ah as ProjectedRow, ai as QueryMode, r as QueryOptions, aj as RawFirestoreExtension, ak as RawSqlExtension, al as RealtimeListenExtension, am as ScanProtection, an as SelectExtension, ao as TraversalOptions, ap as TraversalResult, aq as VectorExtension, ar as ViewContext, as as ViewDefaultsConfig, at as ViewResolverConfig, au as WhereClause, av as defineConfig, h as deleteField, aw as resolveView } from './backend-BpYLdwCW.cjs';
3
+ import { I as IndexSpec, l as DiscoveryResult, R as RegistryEntry, v as StoredGraphRecord, H as MigrationWriteBack, K as MigrationStep, p as GraphRegistry, F as FindEdgesParams, L as QueryPlan, N as FindNodesParams, Q as QueryFilter, M as MigrationExecutor, O as MigrationFn, P as StoredMigrationStep, o as GraphClient, q as GraphReader, V as TraversalBuilder } from './backend-DNzv8KSR.cjs';
4
+ export { w as AggregateExtension, x as AggregateField, y as AggregateOp, z as AggregateResult, A as AggregateSpec, X as BulkBatchError, t as BulkOptions, Y as BulkProgress, u as BulkResult, b as BulkUpdatePatch, C as Capability, s as CascadeResult, Z as CoreGraphClient, _ as DefineTypeOptions, $ as DiscoveredEntity, a0 as DistanceMeasure, d as DmlExtension, n as DynamicGraphClient, a1 as DynamicGraphMethods, m as DynamicRegistryConfig, a2 as EdgeTopology, a3 as EdgeTypeData, E as ExpandParams, e as ExpandResult, a4 as FindEdgesProjectedParams, a5 as FindNearestParams, a6 as FiregraphConfig, a7 as FullTextSearchExtension, a8 as GeoExtension, a9 as GraphBatch, G as GraphClientOptions, aa as GraphRecord, ab as GraphTransaction, ac as GraphWriter, ad as HopDefinition, ae as HopResult, af as IndexFieldSpec, J as JoinExtension, ag as NodeTypeData, ah as ProjectedRow, ai as QueryMode, r as QueryOptions, aj as RawFirestoreExtension, ak as RawSqlExtension, al as RealtimeListenExtension, am as ScanProtection, an as SelectExtension, ao as TraversalOptions, ap as TraversalResult, aq as VectorExtension, ar as ViewContext, as as ViewDefaultsConfig, at as ViewResolverConfig, au as WhereClause, av as defineConfig, h as deleteField, aw as resolveView } from './backend-DNzv8KSR.cjs';
5
5
  import { F as FiregraphError } from './errors-BRc3I_eH.cjs';
6
6
  export { C as CapabilityNotSupportedError, a as CrossBackendTransactionError, D as DynamicRegistryError, E as EdgeNotFoundError, I as InvalidQueryError, M as MigrationError, N as NodeNotFoundError, Q as QuerySafetyError, R as RegistryScopeError, b as RegistryViolationError, T as TraversalError, V as ValidationError } from './errors-BRc3I_eH.cjs';
7
- export { B as BOOTSTRAP_ENTRIES, E as EDGE_TYPE_SCHEMA, M as META_EDGE_TYPE, a as META_NODE_TYPE, N as NODE_TYPE_SCHEMA, d as createBootstrapRegistry, c as createMergedRegistry, b as createRegistry, e as createRegistryFromGraph, f as generateDeterministicUid, g as generateId } from './registry-BGh7Jqpb.cjs';
7
+ export { B as BOOTSTRAP_ENTRIES, E as EDGE_TYPE_SCHEMA, M as META_EDGE_TYPE, a as META_NODE_TYPE, N as NODE_TYPE_SCHEMA, d as createBootstrapRegistry, c as createMergedRegistry, b as createRegistry, e as createRegistryFromGraph, f as generateDeterministicUid, g as generateId } from './registry-CNToyEra.cjs';
8
8
  export { Q as QueryClient, f as QueryClientError, g as QueryClientErrorCode, h as QueryClientOptions } from './client-DoyEdJ5w.cjs';
9
9
  export { S as StorageScopeSegment, a as appendStorageScope, i as isAncestorScopeUid, p as parseStorageScope, r as resolveAncestorScope } from './scope-path-CROFZGr9.cjs';
10
10
  import { Firestore } from '@google-cloud/firestore';
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { c as createGraphClient, a as createGraphClientFromBackend } from './client-B5o39X79.js';
1
+ export { c as createGraphClient, a as createGraphClientFromBackend } from './client-CNAwJayO.js';
2
2
  export { CodegenOptions, generateTypes } from './codegen/index.js';
3
- import { I as IndexSpec, l as DiscoveryResult, R as RegistryEntry, v as StoredGraphRecord, H as MigrationWriteBack, K as MigrationStep, p as GraphRegistry, F as FindEdgesParams, L as QueryPlan, N as FindNodesParams, Q as QueryFilter, M as MigrationExecutor, O as MigrationFn, P as StoredMigrationStep, o as GraphClient, q as GraphReader, V as TraversalBuilder } from './backend-BpYLdwCW.js';
4
- export { w as AggregateExtension, x as AggregateField, y as AggregateOp, z as AggregateResult, A as AggregateSpec, X as BulkBatchError, t as BulkOptions, Y as BulkProgress, u as BulkResult, b as BulkUpdatePatch, C as Capability, s as CascadeResult, Z as CoreGraphClient, _ as DefineTypeOptions, $ as DiscoveredEntity, a0 as DistanceMeasure, d as DmlExtension, n as DynamicGraphClient, a1 as DynamicGraphMethods, m as DynamicRegistryConfig, a2 as EdgeTopology, a3 as EdgeTypeData, E as ExpandParams, e as ExpandResult, a4 as FindEdgesProjectedParams, a5 as FindNearestParams, a6 as FiregraphConfig, a7 as FullTextSearchExtension, a8 as GeoExtension, a9 as GraphBatch, G as GraphClientOptions, aa as GraphRecord, ab as GraphTransaction, ac as GraphWriter, ad as HopDefinition, ae as HopResult, af as IndexFieldSpec, J as JoinExtension, ag as NodeTypeData, ah as ProjectedRow, ai as QueryMode, r as QueryOptions, aj as RawFirestoreExtension, ak as RawSqlExtension, al as RealtimeListenExtension, am as ScanProtection, an as SelectExtension, ao as TraversalOptions, ap as TraversalResult, aq as VectorExtension, ar as ViewContext, as as ViewDefaultsConfig, at as ViewResolverConfig, au as WhereClause, av as defineConfig, h as deleteField, aw as resolveView } from './backend-BpYLdwCW.js';
3
+ import { I as IndexSpec, l as DiscoveryResult, R as RegistryEntry, v as StoredGraphRecord, H as MigrationWriteBack, K as MigrationStep, p as GraphRegistry, F as FindEdgesParams, L as QueryPlan, N as FindNodesParams, Q as QueryFilter, M as MigrationExecutor, O as MigrationFn, P as StoredMigrationStep, o as GraphClient, q as GraphReader, V as TraversalBuilder } from './backend-DNzv8KSR.js';
4
+ export { w as AggregateExtension, x as AggregateField, y as AggregateOp, z as AggregateResult, A as AggregateSpec, X as BulkBatchError, t as BulkOptions, Y as BulkProgress, u as BulkResult, b as BulkUpdatePatch, C as Capability, s as CascadeResult, Z as CoreGraphClient, _ as DefineTypeOptions, $ as DiscoveredEntity, a0 as DistanceMeasure, d as DmlExtension, n as DynamicGraphClient, a1 as DynamicGraphMethods, m as DynamicRegistryConfig, a2 as EdgeTopology, a3 as EdgeTypeData, E as ExpandParams, e as ExpandResult, a4 as FindEdgesProjectedParams, a5 as FindNearestParams, a6 as FiregraphConfig, a7 as FullTextSearchExtension, a8 as GeoExtension, a9 as GraphBatch, G as GraphClientOptions, aa as GraphRecord, ab as GraphTransaction, ac as GraphWriter, ad as HopDefinition, ae as HopResult, af as IndexFieldSpec, J as JoinExtension, ag as NodeTypeData, ah as ProjectedRow, ai as QueryMode, r as QueryOptions, aj as RawFirestoreExtension, ak as RawSqlExtension, al as RealtimeListenExtension, am as ScanProtection, an as SelectExtension, ao as TraversalOptions, ap as TraversalResult, aq as VectorExtension, ar as ViewContext, as as ViewDefaultsConfig, at as ViewResolverConfig, au as WhereClause, av as defineConfig, h as deleteField, aw as resolveView } from './backend-DNzv8KSR.js';
5
5
  import { F as FiregraphError } from './errors-BRc3I_eH.js';
6
6
  export { C as CapabilityNotSupportedError, a as CrossBackendTransactionError, D as DynamicRegistryError, E as EdgeNotFoundError, I as InvalidQueryError, M as MigrationError, N as NodeNotFoundError, Q as QuerySafetyError, R as RegistryScopeError, b as RegistryViolationError, T as TraversalError, V as ValidationError } from './errors-BRc3I_eH.js';
7
- export { B as BOOTSTRAP_ENTRIES, E as EDGE_TYPE_SCHEMA, M as META_EDGE_TYPE, a as META_NODE_TYPE, N as NODE_TYPE_SCHEMA, d as createBootstrapRegistry, c as createMergedRegistry, b as createRegistry, e as createRegistryFromGraph, f as generateDeterministicUid, g as generateId } from './registry-tKTb5Kx1.js';
7
+ export { B as BOOTSTRAP_ENTRIES, E as EDGE_TYPE_SCHEMA, M as META_EDGE_TYPE, a as META_NODE_TYPE, N as NODE_TYPE_SCHEMA, d as createBootstrapRegistry, c as createMergedRegistry, b as createRegistry, e as createRegistryFromGraph, f as generateDeterministicUid, g as generateId } from './registry-By1i-zge.js';
8
8
  export { Q as QueryClient, f as QueryClientError, g as QueryClientErrorCode, h as QueryClientOptions } from './client-DoyEdJ5w.js';
9
9
  export { S as StorageScopeSegment, a as appendStorageScope, i as isAncestorScopeUid, p as parseStorageScope, r as resolveAncestorScope } from './scope-path-CROFZGr9.js';
10
10
  import { Firestore } from '@google-cloud/firestore';
package/dist/index.js CHANGED
@@ -51,7 +51,7 @@ import {
51
51
  migrateRecords,
52
52
  precompileSource,
53
53
  validateMigrationChain
54
- } from "./chunk-5HIRYV2S.js";
54
+ } from "./chunk-6IO74NKD.js";
55
55
  import {
56
56
  DEFAULT_QUERY_LIMIT,
57
57
  computeEdgeDocId,
@@ -1,4 +1,4 @@
1
- import { R as RegistryEntry, p as GraphRegistry, q as GraphReader, M as MigrationExecutor, l as DiscoveryResult } from './backend-BpYLdwCW.js';
1
+ import { R as RegistryEntry, p as GraphRegistry, q as GraphReader, M as MigrationExecutor, l as DiscoveryResult } from './backend-DNzv8KSR.js';
2
2
 
3
3
  /** The aType used for node type definition meta-nodes. */
4
4
  declare const META_NODE_TYPE = "nodeType";
@@ -1,4 +1,4 @@
1
- import { R as RegistryEntry, p as GraphRegistry, q as GraphReader, M as MigrationExecutor, l as DiscoveryResult } from './backend-BpYLdwCW.cjs';
1
+ import { R as RegistryEntry, p as GraphRegistry, q as GraphReader, M as MigrationExecutor, l as DiscoveryResult } from './backend-DNzv8KSR.cjs';
2
2
 
3
3
  /** The aType used for node type definition meta-nodes. */
4
4
  declare const META_NODE_TYPE = "nodeType";
@@ -2048,7 +2048,7 @@ var GraphClientImpl = class _GraphClientImpl {
2048
2048
  async findNearest(params) {
2049
2049
  if (!this.backend.findNearest) {
2050
2050
  throw new FiregraphError(
2051
- "findNearest() is not supported by the current storage backend. Vector search requires a backend that declares `search.vector` (currently Firestore Standard and Enterprise). There is no client-side fallback because emulating ANN on top of the generic backend surface does not scale beyond toy datasets.",
2051
+ "findNearest() is not supported by the current storage backend. Vector search requires a backend that declares `search.vector` (currently Firestore Standard, Firestore Enterprise, and the local better-sqlite3 backend). There is no client-side fallback because emulating ANN on top of the generic backend surface does not scale beyond toy datasets.",
2052
2052
  "UNSUPPORTED_OPERATION"
2053
2053
  );
2054
2054
  }
@@ -2064,13 +2064,15 @@ var GraphClientImpl = class _GraphClientImpl {
2064
2064
  * Native full-text search (capability `search.fullText`).
2065
2065
  *
2066
2066
  * Returns the top-N records by relevance, ordered by the search
2067
- * index's score. Only Firestore Enterprise declares this capability
2068
- * today — the underlying Pipelines `search({ query: documentMatches(...) })`
2069
- * stage requires Enterprise's FTS index. Standard does not declare
2070
- * the cap (FTS is an Enterprise-only product feature, not a
2071
- * typed-API gap), and the SQLite-shaped backends have no native
2072
- * FTS index. Backends without `search.fullText` throw
2073
- * `UNSUPPORTED_OPERATION` from this wrapper.
2067
+ * index's score. Firestore Enterprise declares this capability (via
2068
+ * the Pipelines `search({ query: documentMatches(...) })` stage over
2069
+ * Enterprise's FTS index), as does the local better-sqlite3 backend
2070
+ * (`firegraph/sqlite-local`, via a trigger-synced FTS5 index ranked
2071
+ * by `bm25()`). Standard does not declare the cap (FTS is an
2072
+ * Enterprise-only product feature, not a typed-API gap); D1 and the
2073
+ * Cloudflare DO edition have no FTS trigger infrastructure. Backends
2074
+ * without `search.fullText` throw `UNSUPPORTED_OPERATION` from this
2075
+ * wrapper.
2074
2076
  *
2075
2077
  * Scan-protection mirrors `findNearest`: a search with no
2076
2078
  * identifying filters (`aType` / `axbType` / `bType`) walks every
@@ -2086,7 +2088,7 @@ var GraphClientImpl = class _GraphClientImpl {
2086
2088
  async fullTextSearch(params) {
2087
2089
  if (!this.backend.fullTextSearch) {
2088
2090
  throw new FiregraphError(
2089
- "fullTextSearch() is not supported by the current storage backend. Full-text search requires a backend that declares `search.fullText` (currently Firestore Enterprise only \u2014 FTS is an Enterprise product feature). There is no client-side fallback because emulating FTS over the generic backend surface would not scale beyond toy datasets.",
2091
+ "fullTextSearch() is not supported by the current storage backend. Full-text search requires a backend that declares `search.fullText` (currently Firestore Enterprise and the local better-sqlite3 backend). There is no client-side fallback because emulating FTS over the generic backend surface would not scale beyond toy datasets.",
2090
2092
  "UNSUPPORTED_OPERATION"
2091
2093
  );
2092
2094
  }
@@ -3299,7 +3301,7 @@ var SQLITE_CORE_CAPS = [
3299
3301
  "raw.sql"
3300
3302
  ];
3301
3303
  var SqliteBackendImpl = class _SqliteBackendImpl {
3302
- constructor(executor, rootTable, storageScope, scopePath, registry, coreIndexes) {
3304
+ constructor(executor, rootTable, storageScope, scopePath, registry, coreIndexes, extraTableDDL) {
3303
3305
  this.executor = executor;
3304
3306
  validateTableName(rootTable);
3305
3307
  this.rootTable = rootTable;
@@ -3308,6 +3310,7 @@ var SqliteBackendImpl = class _SqliteBackendImpl {
3308
3310
  this.scopePath = scopePath;
3309
3311
  this.registry = registry;
3310
3312
  this.coreIndexes = coreIndexes;
3313
+ this.extraTableDDL = extraTableDDL;
3311
3314
  const caps = new Set(SQLITE_CORE_CAPS);
3312
3315
  if (typeof executor.transaction === "function") {
3313
3316
  caps.add("core.transactions");
@@ -3324,6 +3327,7 @@ var SqliteBackendImpl = class _SqliteBackendImpl {
3324
3327
  rootTable;
3325
3328
  registry;
3326
3329
  coreIndexes;
3330
+ extraTableDDL;
3327
3331
  ensured = null;
3328
3332
  /**
3329
3333
  * Lazily create this graph's table + indexes + the catalog, and register
@@ -3340,12 +3344,18 @@ var SqliteBackendImpl = class _SqliteBackendImpl {
3340
3344
  }
3341
3345
  return this.ensured;
3342
3346
  }
3347
+ /** @internal See `SqliteStorageBackend.ensureReady`. */
3348
+ async ensureReady(force = false) {
3349
+ if (force) this.ensured = null;
3350
+ await this.ensureSchema();
3351
+ }
3343
3352
  async doEnsureSchema() {
3344
3353
  const ddl = [
3345
3354
  ...buildSchemaStatements(this.collectionPath, {
3346
3355
  coreIndexes: this.coreIndexes,
3347
3356
  registry: this.registry
3348
3357
  }),
3358
+ ...this.extraTableDDL ? this.extraTableDDL(this.collectionPath) : [],
3349
3359
  buildCatalogDDL(this.rootTable)
3350
3360
  ];
3351
3361
  const statements = ddl.map((sql) => ({ sql, params: [] }));
@@ -3476,7 +3486,8 @@ var SqliteBackendImpl = class _SqliteBackendImpl {
3476
3486
  newStorageScope,
3477
3487
  newScope,
3478
3488
  this.registry,
3479
- this.coreIndexes
3489
+ this.coreIndexes,
3490
+ this.extraTableDDL
3480
3491
  );
3481
3492
  }
3482
3493
  // --- Cascade & bulk ---
@@ -3822,7 +3833,8 @@ function createSqliteBackend(executor, tableName, options = {}) {
3822
3833
  storageScope,
3823
3834
  scopePath,
3824
3835
  options.registry,
3825
- options.coreIndexes
3836
+ options.coreIndexes,
3837
+ options.extraTableDDL
3826
3838
  );
3827
3839
  }
3828
3840
  // Annotate the CommonJS export names for ESM import in node: