@typicalday/firegraph 0.14.1 → 0.16.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.
Files changed (72) hide show
  1. package/README.md +62 -20
  2. package/dist/backend-CE3pM9-T.d.ts +167 -0
  3. package/dist/{backend-DuvHGgK1.d.cts → backend-DNzv8KSR.d.cts} +34 -20
  4. package/dist/{backend-DuvHGgK1.d.ts → backend-DNzv8KSR.d.ts} +34 -20
  5. package/dist/backend-EjFfw9yO.d.cts +167 -0
  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-5JBNLH5W.js +732 -0
  11. package/dist/chunk-5JBNLH5W.js.map +1 -0
  12. package/dist/{chunk-3AHHXMWX.js → chunk-6IO74NKD.js} +23 -44
  13. package/dist/chunk-6IO74NKD.js.map +1 -0
  14. package/dist/{chunk-DJI3VXXA.js → chunk-7IEZ6IYY.js} +2 -2
  15. package/dist/chunk-7IEZ6IYY.js.map +1 -0
  16. package/dist/chunk-NGAJCALM.js +34 -0
  17. package/dist/chunk-NGAJCALM.js.map +1 -0
  18. package/dist/chunk-NZVSLWNY.js +867 -0
  19. package/dist/chunk-NZVSLWNY.js.map +1 -0
  20. package/dist/{chunk-N5HFDWQX.js → chunk-PWIO46RT.js} +1 -1
  21. package/dist/{chunk-N5HFDWQX.js.map → chunk-PWIO46RT.js.map} +1 -1
  22. package/dist/{client-BKi3vk0Q.d.ts → client-CNAwJayO.d.ts} +1 -1
  23. package/dist/{client-BrsaXtDV.d.cts → client-CaXH5D5C.d.cts} +1 -1
  24. package/dist/{client-Bk2Cm6xv.d.cts → client-DoyEdJ5w.d.cts} +1 -1
  25. package/dist/{client-Bk2Cm6xv.d.ts → client-DoyEdJ5w.d.ts} +1 -1
  26. package/dist/cloudflare/index.cjs +159 -167
  27. package/dist/cloudflare/index.cjs.map +1 -1
  28. package/dist/cloudflare/index.d.cts +73 -70
  29. package/dist/cloudflare/index.d.ts +73 -70
  30. package/dist/cloudflare/index.js +54 -589
  31. package/dist/cloudflare/index.js.map +1 -1
  32. package/dist/codegen/index.d.cts +1 -1
  33. package/dist/codegen/index.d.ts +1 -1
  34. package/dist/firestore-enterprise/index.cjs +11 -9
  35. package/dist/firestore-enterprise/index.cjs.map +1 -1
  36. package/dist/firestore-enterprise/index.d.cts +3 -3
  37. package/dist/firestore-enterprise/index.d.ts +3 -3
  38. package/dist/firestore-enterprise/index.js +6 -4
  39. package/dist/firestore-enterprise/index.js.map +1 -1
  40. package/dist/firestore-standard/index.cjs +11 -9
  41. package/dist/firestore-standard/index.cjs.map +1 -1
  42. package/dist/firestore-standard/index.d.cts +3 -3
  43. package/dist/firestore-standard/index.d.ts +3 -3
  44. package/dist/firestore-standard/index.js +4 -3
  45. package/dist/firestore-standard/index.js.map +1 -1
  46. package/dist/index.cjs +11 -9
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.d.cts +5 -5
  49. package/dist/index.d.ts +5 -5
  50. package/dist/index.js +6 -4
  51. package/dist/index.js.map +1 -1
  52. package/dist/query-client/index.d.cts +2 -2
  53. package/dist/query-client/index.d.ts +2 -2
  54. package/dist/{registry-C2KUPVZj.d.ts → registry-By1i-zge.d.ts} +2 -2
  55. package/dist/{registry-Bc7h6WTM.d.cts → registry-CNToyEra.d.cts} +2 -2
  56. package/dist/sqlite/index.cjs +599 -380
  57. package/dist/sqlite/index.cjs.map +1 -1
  58. package/dist/sqlite/index.d.cts +4 -110
  59. package/dist/sqlite/index.d.ts +4 -110
  60. package/dist/sqlite/index.js +7 -1144
  61. package/dist/sqlite/index.js.map +1 -1
  62. package/dist/sqlite/local.cjs +2262 -0
  63. package/dist/sqlite/local.cjs.map +1 -0
  64. package/dist/sqlite/local.d.cts +109 -0
  65. package/dist/sqlite/local.d.ts +109 -0
  66. package/dist/sqlite/local.js +546 -0
  67. package/dist/sqlite/local.js.map +1 -0
  68. package/package.json +15 -1
  69. package/dist/chunk-3AHHXMWX.js.map +0 -1
  70. package/dist/chunk-DJI3VXXA.js.map +0 -1
  71. package/dist/chunk-NNBSUOOF.js +0 -289
  72. package/dist/chunk-NNBSUOOF.js.map +0 -1
@@ -1,7 +1,7 @@
1
- export { c as createGraphClient } from '../client-BrsaXtDV.cjs';
2
- export { M as META_EDGE_TYPE, a as META_NODE_TYPE, b as createMergedRegistry, d as createRegistry, f as generateId } from '../registry-Bc7h6WTM.cjs';
1
+ export { c as createGraphClient } from '../client-CaXH5D5C.cjs';
2
+ export { M as META_EDGE_TYPE, a as META_NODE_TYPE, c as createMergedRegistry, b as createRegistry, g as generateId } from '../registry-CNToyEra.cjs';
3
3
  import { Firestore } from '@google-cloud/firestore';
4
- import { S as StorageBackend } from '../backend-DuvHGgK1.cjs';
4
+ import { S as StorageBackend } from '../backend-DNzv8KSR.cjs';
5
5
 
6
6
  /**
7
7
  * Firestore Standard edition `StorageBackend`.
@@ -1,7 +1,7 @@
1
- export { c as createGraphClient } from '../client-BKi3vk0Q.js';
2
- export { M as META_EDGE_TYPE, a as META_NODE_TYPE, b as createMergedRegistry, d as createRegistry, f as generateId } from '../registry-C2KUPVZj.js';
1
+ export { c as createGraphClient } from '../client-CNAwJayO.js';
2
+ export { M as META_EDGE_TYPE, a as META_NODE_TYPE, c as createMergedRegistry, b as createRegistry, g as generateId } from '../registry-By1i-zge.js';
3
3
  import { Firestore } from '@google-cloud/firestore';
4
- import { S as StorageBackend } from '../backend-DuvHGgK1.js';
4
+ import { S as StorageBackend } from '../backend-DNzv8KSR.js';
5
5
 
6
6
  /**
7
7
  * Firestore Standard edition `StorageBackend`.
@@ -9,11 +9,11 @@ import {
9
9
  runFirestoreClassicExpand,
10
10
  runFirestoreFindEdgesProjected,
11
11
  runFirestoreFindNearest
12
- } from "../chunk-DJI3VXXA.js";
12
+ } from "../chunk-7IEZ6IYY.js";
13
13
  import "../chunk-C2QMD7RY.js";
14
14
  import {
15
15
  createCapabilities
16
- } from "../chunk-N5HFDWQX.js";
16
+ } from "../chunk-PWIO46RT.js";
17
17
  import {
18
18
  META_EDGE_TYPE,
19
19
  META_NODE_TYPE,
@@ -22,7 +22,8 @@ import {
22
22
  createMergedRegistry,
23
23
  createRegistry,
24
24
  generateId
25
- } from "../chunk-3AHHXMWX.js";
25
+ } from "../chunk-6IO74NKD.js";
26
+ import "../chunk-NGAJCALM.js";
26
27
  import {
27
28
  FiregraphError
28
29
  } from "../chunk-SIHE4UY4.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/firestore-standard/backend.ts"],"sourcesContent":["/**\n * Firestore Standard edition `StorageBackend`.\n *\n * The Standard edition only has the classic Query API — pipelines and\n * Enterprise-only product features (full-text search, geo) are not\n * available. This file deliberately does not import the pipeline adapter so\n * a Standard-only deployment never pulls Pipeline code into its bundle.\n *\n * Capability declarations follow the conservative invariant established in\n * Phase 1: only declare what the file actually implements at runtime.\n * `query.aggregate` (Phase 6), `query.select` (Phase 7), `search.vector`\n * (Phase 8), and `query.join` (Phase 13a — chunked classic-API fan-out)\n * are wired; `realtime.listen` will be added in a later phase once the\n * matching backend method exists. `query.dml` stays unwired because the\n * classic Query API has no server-side DML statement; mass-delete /\n * mass-update are still routed through the existing `bulkRemoveEdges`\n * fetch-then-write loop.\n */\n\nimport type { Firestore, Query, Transaction } from '@google-cloud/firestore';\nimport { FieldValue } from '@google-cloud/firestore';\n\nimport {\n bulkRemoveEdges as bulkRemoveEdgesImpl,\n removeNodeCascade as removeNodeCascadeImpl,\n} from '../bulk.js';\nimport { FiregraphError } from '../errors.js';\nimport type {\n BackendCapabilities,\n BatchBackend,\n StorageBackend,\n TransactionBackend,\n UpdatePayload,\n WritableRecord,\n WriteMode,\n} from '../internal/backend.js';\nimport { createCapabilities } from '../internal/backend.js';\nimport { runFirestoreAggregate } from '../internal/firestore-aggregate.js';\nimport type {\n BatchAdapter,\n FirestoreAdapter,\n TransactionAdapter,\n} from '../internal/firestore-classic-adapter.js';\nimport {\n createBatchAdapter,\n createFirestoreAdapter,\n createTransactionAdapter,\n} from '../internal/firestore-classic-adapter.js';\nimport { runFirestoreClassicExpand } from '../internal/firestore-classic-expand.js';\nimport { runFirestoreFindEdgesProjected } from '../internal/firestore-projection.js';\nimport { buildFirestoreUpdateArgs } from '../internal/firestore-update.js';\nimport { runFirestoreFindNearest } from '../internal/firestore-vector.js';\nimport { buildEdgeQueryPlan } from '../query.js';\nimport type {\n AggregateSpec,\n BulkOptions,\n BulkResult,\n CascadeResult,\n ExpandParams,\n ExpandResult,\n FindEdgesParams,\n FindNearestParams,\n GraphReader,\n QueryFilter,\n QueryOptions,\n StoredGraphRecord,\n} from '../types.js';\n\n/**\n * Capability union declared by the Firestore Standard backend.\n *\n * Conservative declaration: only capabilities backed by an actual runtime\n * method are listed. `query.aggregate` (Phase 6) and `query.select`\n * (Phase 7) are now wired; `search.vector` and `realtime.listen` will be\n * layered in by their respective phases — this union and the matching\n * cap-set literal are updated in lockstep.\n */\nexport type FirestoreStandardCapability =\n | 'core.read'\n | 'core.write'\n | 'core.transactions'\n | 'core.batch'\n | 'core.subgraph'\n | 'query.aggregate'\n | 'query.select'\n | 'query.join'\n | 'search.vector'\n | 'raw.firestore';\n\nconst STANDARD_CAPS: ReadonlySet<FirestoreStandardCapability> =\n new Set<FirestoreStandardCapability>([\n 'core.read',\n 'core.write',\n 'core.transactions',\n 'core.batch',\n 'core.subgraph',\n 'query.aggregate',\n 'query.select',\n 'query.join',\n 'search.vector',\n 'raw.firestore',\n ]);\n\nexport interface FirestoreStandardOptions {\n /** Internal: the logical scope path inherited from a parent subgraph. */\n scopePath?: string;\n}\n\nfunction stampWritableRecord(record: WritableRecord): Record<string, unknown> {\n const now = FieldValue.serverTimestamp();\n const out: Record<string, unknown> = {\n aType: record.aType,\n aUid: record.aUid,\n axbType: record.axbType,\n bType: record.bType,\n bUid: record.bUid,\n data: record.data,\n createdAt: now,\n updatedAt: now,\n };\n if (record.v !== undefined) out.v = record.v;\n return out;\n}\n\nclass FirestoreStandardTransactionBackend implements TransactionBackend {\n constructor(\n private readonly adapter: TransactionAdapter,\n private readonly db: Firestore,\n ) {}\n\n getDoc(docId: string): Promise<StoredGraphRecord | null> {\n return this.adapter.getDoc(docId);\n }\n\n query(filters: QueryFilter[], options?: QueryOptions): Promise<StoredGraphRecord[]> {\n return this.adapter.query(filters, options);\n }\n\n async setDoc(docId: string, record: WritableRecord, mode: WriteMode): Promise<void> {\n this.adapter.setDoc(\n docId,\n stampWritableRecord(record),\n mode === 'merge' ? { merge: true } : undefined,\n );\n }\n\n async updateDoc(docId: string, update: UpdatePayload): Promise<void> {\n this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));\n }\n\n async deleteDoc(docId: string): Promise<void> {\n this.adapter.deleteDoc(docId);\n }\n}\n\nclass FirestoreStandardBatchBackend implements BatchBackend {\n constructor(\n private readonly adapter: BatchAdapter,\n private readonly db: Firestore,\n ) {}\n\n setDoc(docId: string, record: WritableRecord, mode: WriteMode): void {\n this.adapter.setDoc(\n docId,\n stampWritableRecord(record),\n mode === 'merge' ? { merge: true } : undefined,\n );\n }\n\n updateDoc(docId: string, update: UpdatePayload): void {\n this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));\n }\n\n deleteDoc(docId: string): void {\n this.adapter.deleteDoc(docId);\n }\n\n commit(): Promise<void> {\n return this.adapter.commit();\n }\n}\n\nclass FirestoreStandardBackendImpl implements StorageBackend<FirestoreStandardCapability> {\n readonly capabilities: BackendCapabilities<FirestoreStandardCapability> =\n createCapabilities(STANDARD_CAPS);\n readonly collectionPath: string;\n readonly scopePath: string;\n private readonly adapter: FirestoreAdapter;\n\n constructor(\n private readonly db: Firestore,\n collectionPath: string,\n scopePath: string,\n ) {\n this.collectionPath = collectionPath;\n this.scopePath = scopePath;\n this.adapter = createFirestoreAdapter(db, collectionPath);\n }\n\n // --- Reads ---\n\n getDoc(docId: string): Promise<StoredGraphRecord | null> {\n return this.adapter.getDoc(docId);\n }\n\n query(filters: QueryFilter[], options?: QueryOptions): Promise<StoredGraphRecord[]> {\n return this.adapter.query(filters, options);\n }\n\n // --- Writes ---\n\n setDoc(docId: string, record: WritableRecord, mode: WriteMode): Promise<void> {\n return this.adapter.setDoc(\n docId,\n stampWritableRecord(record),\n mode === 'merge' ? { merge: true } : undefined,\n );\n }\n\n updateDoc(docId: string, update: UpdatePayload): Promise<void> {\n return this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));\n }\n\n deleteDoc(docId: string): Promise<void> {\n return this.adapter.deleteDoc(docId);\n }\n\n // --- Transactions / Batches ---\n\n runTransaction<T>(fn: (tx: TransactionBackend) => Promise<T>): Promise<T> {\n return this.db.runTransaction(async (firestoreTx: Transaction) => {\n const txAdapter = createTransactionAdapter(this.db, this.collectionPath, firestoreTx);\n return fn(new FirestoreStandardTransactionBackend(txAdapter, this.db));\n });\n }\n\n createBatch(): BatchBackend {\n const batchAdapter = createBatchAdapter(this.db, this.collectionPath);\n return new FirestoreStandardBatchBackend(batchAdapter, this.db);\n }\n\n // --- Subgraphs ---\n\n subgraph(parentNodeUid: string, name: string): StorageBackend {\n const subPath = `${this.collectionPath}/${parentNodeUid}/${name}`;\n const newScope = this.scopePath ? `${this.scopePath}/${name}` : name;\n return new FirestoreStandardBackendImpl(this.db, subPath, newScope);\n }\n\n // --- Cascade & bulk ---\n\n removeNodeCascade(\n uid: string,\n reader: GraphReader,\n options?: BulkOptions,\n ): Promise<CascadeResult> {\n return removeNodeCascadeImpl(this.db, this.collectionPath, reader, uid, options);\n }\n\n bulkRemoveEdges(\n params: FindEdgesParams,\n reader: GraphReader,\n options?: BulkOptions,\n ): Promise<BulkResult> {\n return bulkRemoveEdgesImpl(this.db, this.collectionPath, reader, params, options);\n }\n\n // --- Cross-collection ---\n\n async findEdgesGlobal(\n params: FindEdgesParams,\n collectionName?: string,\n ): Promise<StoredGraphRecord[]> {\n const name = collectionName ?? this.collectionPath.split('/').pop()!;\n const plan = buildEdgeQueryPlan(params);\n\n if (plan.strategy === 'get') {\n throw new FiregraphError(\n 'findEdgesGlobal() requires a query, not a direct document lookup. ' +\n 'Omit one of aUid/axbType/bUid to force a query strategy.',\n 'INVALID_QUERY',\n );\n }\n\n const collectionGroupRef = this.db.collectionGroup(name);\n let q: Query = collectionGroupRef;\n for (const f of plan.filters) {\n q = q.where(f.field, f.op, f.value);\n }\n if (plan.options?.orderBy) {\n q = q.orderBy(plan.options.orderBy.field, plan.options.orderBy.direction ?? 'asc');\n }\n if (plan.options?.limit !== undefined) {\n q = q.limit(plan.options.limit);\n }\n const snap = await q.get();\n return snap.docs.map((doc) => doc.data() as StoredGraphRecord);\n }\n\n // --- Aggregate ---\n\n aggregate(spec: AggregateSpec, filters: QueryFilter[]): Promise<Record<string, number>> {\n return runFirestoreAggregate(this.db.collection(this.collectionPath), spec, filters, {\n edition: 'standard',\n });\n }\n\n // --- Server-side projection (capability: query.select) ---\n\n /**\n * Run a projecting query via the shared classic-API helper. Both Firestore\n * editions delegate to one implementation so the projection contract\n * (bare-name normalization, builtin / `data.*` resolution, dedup,\n * original-key preservation) stays consistent across editions. See\n * `runFirestoreFindEdgesProjected` for the resolution rules.\n */\n findEdgesProjected(\n select: ReadonlyArray<string>,\n filters: QueryFilter[],\n options?: QueryOptions,\n ): Promise<Array<Record<string, unknown>>> {\n return runFirestoreFindEdgesProjected(\n this.db.collection(this.collectionPath),\n select,\n filters,\n options,\n );\n }\n\n // --- Native vector / nearest-neighbour search (capability: search.vector) ---\n\n /**\n * Run a vector / nearest-neighbour query via the shared classic-API\n * helper. Both Firestore editions delegate to one implementation so the\n * field-path normalisation and result shape stay consistent across\n * editions. See `runFirestoreFindNearest` for the resolution rules and\n * the validation surface.\n *\n * Standard-edition note: vector search requires a single-field vector\n * index on the indexed `vectorField`, plus a composite index whenever\n * additional `where` filters narrow the candidate set before the ANN\n * walk. Both indexes are configured per project in the Firestore\n * console — firegraph does not auto-provision them.\n */\n findNearest(params: FindNearestParams): Promise<StoredGraphRecord[]> {\n return runFirestoreFindNearest(this.db.collection(this.collectionPath), params);\n }\n\n // --- Server-side multi-source fan-out (capability: query.join) ---\n\n /**\n * Fan out from `params.sources` over a single edge type via the chunked\n * classic-API helper. The classic `'in'` operator caps at 30 elements\n * per call, so the helper splits sources into 30-element chunks and\n * dispatches them in parallel via `Promise.all`. With 100 sources this\n * is `ceil(100/30) = 4` round trips; the per-source `findEdges` loop in\n * `traverse.ts` would have been 100. Enterprise can collapse this\n * further to a single Pipelines `equalAny(...)` call — Standard cannot,\n * so chunked classic is the best Standard can do.\n *\n * The helper applies a cross-chunk re-sort + total-limit slice so the\n * observable contract matches the SQL backends'\n * `WHERE … IN (?,?,…) ORDER BY … LIMIT N` semantics.\n */\n expand(params: ExpandParams): Promise<ExpandResult> {\n return runFirestoreClassicExpand(this.adapter, params);\n }\n}\n\n/**\n * Create a Firestore Standard-edition `StorageBackend`.\n *\n * Standard Firestore does not support pipelines or any Enterprise-only\n * features. `data.*` filters require composite indexes; callers that mostly\n * filter on built-in fields (`aUid`, `axbType`, `bUid`) avoid that\n * requirement.\n */\nexport function createFirestoreStandardBackend(\n db: Firestore,\n collectionPath: string,\n options: FirestoreStandardOptions = {},\n): StorageBackend<FirestoreStandardCapability> {\n const scopePath = options.scopePath ?? '';\n return new FirestoreStandardBackendImpl(db, collectionPath, scopePath);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,kBAAkB;AAqE3B,IAAM,gBACJ,oBAAI,IAAiC;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAOH,SAAS,oBAAoB,QAAiD;AAC5E,QAAM,MAAM,WAAW,gBAAgB;AACvC,QAAM,MAA+B;AAAA,IACnC,OAAO,OAAO;AAAA,IACd,MAAM,OAAO;AAAA,IACb,SAAS,OAAO;AAAA,I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AAS;AAAA,MACnF,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,mBACE,QACA,SACA,SACyC;AACzC,WAAO;AAAA,MACL,KAAK,GAAG,WAAW,KAAK,cAAc;AAAA,MACtC;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,YAAY,QAAyD;AACnE,WAAO,wBAAwB,KAAK,GAAG,WAAW,KAAK,cAAc,GAAG,MAAM;AAAA,EAChF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBA,OAAO,QAA6C;AAClD,WAAO,0BAA0B,KAAK,SAAS,MAAM;AAAA,EACvD;AACF;AAUO,SAAS,+BACd,IACA,gBACA,UAAoC,CAAC,GACQ;AAC7C,QAAM,YAAY,QAAQ,aAAa;AACvC,SAAO,IAAI,6BAA6B,IAAI,gBAAgB,SAAS;AACvE;","names":[]}
1
+ {"version":3,"sources":["../../src/firestore-standard/backend.ts"],"sourcesContent":["/**\n * Firestore Standard edition `StorageBackend`.\n *\n * The Standard edition only has the classic Query API — pipelines and\n * Enterprise-only product features (full-text search, geo) are not\n * available. This file deliberately does not import the pipeline adapter so\n * a Standard-only deployment never pulls Pipeline code into its bundle.\n *\n * Capability declarations follow the conservative invariant established in\n * Phase 1: only declare what the file actually implements at runtime.\n * `query.aggregate` (Phase 6), `query.select` (Phase 7), `search.vector`\n * (Phase 8), and `query.join` (Phase 13a — chunked classic-API fan-out)\n * are wired; `realtime.listen` will be added in a later phase once the\n * matching backend method exists. `query.dml` stays unwired because the\n * classic Query API has no server-side DML statement; mass-delete /\n * mass-update are still routed through the existing `bulkRemoveEdges`\n * fetch-then-write loop.\n */\n\nimport type { Firestore, Query, Transaction } from '@google-cloud/firestore';\nimport { FieldValue } from '@google-cloud/firestore';\n\nimport {\n bulkRemoveEdges as bulkRemoveEdgesImpl,\n removeNodeCascade as removeNodeCascadeImpl,\n} from '../bulk.js';\nimport { FiregraphError } from '../errors.js';\nimport type {\n BackendCapabilities,\n BatchBackend,\n StorageBackend,\n TransactionBackend,\n UpdatePayload,\n WritableRecord,\n WriteMode,\n} from '../internal/backend.js';\nimport { createCapabilities } from '../internal/backend.js';\nimport { runFirestoreAggregate } from '../internal/firestore-aggregate.js';\nimport type {\n BatchAdapter,\n FirestoreAdapter,\n TransactionAdapter,\n} from '../internal/firestore-classic-adapter.js';\nimport {\n createBatchAdapter,\n createFirestoreAdapter,\n createTransactionAdapter,\n} from '../internal/firestore-classic-adapter.js';\nimport { runFirestoreClassicExpand } from '../internal/firestore-classic-expand.js';\nimport { runFirestoreFindEdgesProjected } from '../internal/firestore-projection.js';\nimport { buildFirestoreUpdateArgs } from '../internal/firestore-update.js';\nimport { runFirestoreFindNearest } from '../internal/firestore-vector.js';\nimport { buildEdgeQueryPlan } from '../query.js';\nimport type {\n AggregateSpec,\n BulkOptions,\n BulkResult,\n CascadeResult,\n ExpandParams,\n ExpandResult,\n FindEdgesParams,\n FindNearestParams,\n GraphReader,\n QueryFilter,\n QueryOptions,\n StoredGraphRecord,\n} from '../types.js';\n\n/**\n * Capability union declared by the Firestore Standard backend.\n *\n * Conservative declaration: only capabilities backed by an actual runtime\n * method are listed. `query.aggregate` (Phase 6) and `query.select`\n * (Phase 7) are now wired; `search.vector` and `realtime.listen` will be\n * layered in by their respective phases — this union and the matching\n * cap-set literal are updated in lockstep.\n */\nexport type FirestoreStandardCapability =\n | 'core.read'\n | 'core.write'\n | 'core.transactions'\n | 'core.batch'\n | 'core.subgraph'\n | 'query.aggregate'\n | 'query.select'\n | 'query.join'\n | 'search.vector'\n | 'raw.firestore';\n\nconst STANDARD_CAPS: ReadonlySet<FirestoreStandardCapability> =\n new Set<FirestoreStandardCapability>([\n 'core.read',\n 'core.write',\n 'core.transactions',\n 'core.batch',\n 'core.subgraph',\n 'query.aggregate',\n 'query.select',\n 'query.join',\n 'search.vector',\n 'raw.firestore',\n ]);\n\nexport interface FirestoreStandardOptions {\n /** Internal: the logical scope path inherited from a parent subgraph. */\n scopePath?: string;\n}\n\nfunction stampWritableRecord(record: WritableRecord): Record<string, unknown> {\n const now = FieldValue.serverTimestamp();\n const out: Record<string, unknown> = {\n aType: record.aType,\n aUid: record.aUid,\n axbType: record.axbType,\n bType: record.bType,\n bUid: record.bUid,\n data: record.data,\n createdAt: now,\n updatedAt: now,\n };\n if (record.v !== undefined) out.v = record.v;\n return out;\n}\n\nclass FirestoreStandardTransactionBackend implements TransactionBackend {\n constructor(\n private readonly adapter: TransactionAdapter,\n private readonly db: Firestore,\n ) {}\n\n getDoc(docId: string): Promise<StoredGraphRecord | null> {\n return this.adapter.getDoc(docId);\n }\n\n query(filters: QueryFilter[], options?: QueryOptions): Promise<StoredGraphRecord[]> {\n return this.adapter.query(filters, options);\n }\n\n async setDoc(docId: string, record: WritableRecord, mode: WriteMode): Promise<void> {\n this.adapter.setDoc(\n docId,\n stampWritableRecord(record),\n mode === 'merge' ? { merge: true } : undefined,\n );\n }\n\n async updateDoc(docId: string, update: UpdatePayload): Promise<void> {\n this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));\n }\n\n async deleteDoc(docId: string): Promise<void> {\n this.adapter.deleteDoc(docId);\n }\n}\n\nclass FirestoreStandardBatchBackend implements BatchBackend {\n constructor(\n private readonly adapter: BatchAdapter,\n private readonly db: Firestore,\n ) {}\n\n setDoc(docId: string, record: WritableRecord, mode: WriteMode): void {\n this.adapter.setDoc(\n docId,\n stampWritableRecord(record),\n mode === 'merge' ? { merge: true } : undefined,\n );\n }\n\n updateDoc(docId: string, update: UpdatePayload): void {\n this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));\n }\n\n deleteDoc(docId: string): void {\n this.adapter.deleteDoc(docId);\n }\n\n commit(): Promise<void> {\n return this.adapter.commit();\n }\n}\n\nclass FirestoreStandardBackendImpl implements StorageBackend<FirestoreStandardCapability> {\n readonly capabilities: BackendCapabilities<FirestoreStandardCapability> =\n createCapabilities(STANDARD_CAPS);\n readonly collectionPath: string;\n readonly scopePath: string;\n private readonly adapter: FirestoreAdapter;\n\n constructor(\n private readonly db: Firestore,\n collectionPath: string,\n scopePath: string,\n ) {\n this.collectionPath = collectionPath;\n this.scopePath = scopePath;\n this.adapter = createFirestoreAdapter(db, collectionPath);\n }\n\n // --- Reads ---\n\n getDoc(docId: string): Promise<StoredGraphRecord | null> {\n return this.adapter.getDoc(docId);\n }\n\n query(filters: QueryFilter[], options?: QueryOptions): Promise<StoredGraphRecord[]> {\n return this.adapter.query(filters, options);\n }\n\n // --- Writes ---\n\n setDoc(docId: string, record: WritableRecord, mode: WriteMode): Promise<void> {\n return this.adapter.setDoc(\n docId,\n stampWritableRecord(record),\n mode === 'merge' ? { merge: true } : undefined,\n );\n }\n\n updateDoc(docId: string, update: UpdatePayload): Promise<void> {\n return this.adapter.updateDoc(docId, buildFirestoreUpdateArgs(update, this.db));\n }\n\n deleteDoc(docId: string): Promise<void> {\n return this.adapter.deleteDoc(docId);\n }\n\n // --- Transactions / Batches ---\n\n runTransaction<T>(fn: (tx: TransactionBackend) => Promise<T>): Promise<T> {\n return this.db.runTransaction(async (firestoreTx: Transaction) => {\n const txAdapter = createTransactionAdapter(this.db, this.collectionPath, firestoreTx);\n return fn(new FirestoreStandardTransactionBackend(txAdapter, this.db));\n });\n }\n\n createBatch(): BatchBackend {\n const batchAdapter = createBatchAdapter(this.db, this.collectionPath);\n return new FirestoreStandardBatchBackend(batchAdapter, this.db);\n }\n\n // --- Subgraphs ---\n\n subgraph(parentNodeUid: string, name: string): StorageBackend {\n const subPath = `${this.collectionPath}/${parentNodeUid}/${name}`;\n const newScope = this.scopePath ? `${this.scopePath}/${name}` : name;\n return new FirestoreStandardBackendImpl(this.db, subPath, newScope);\n }\n\n // --- Cascade & bulk ---\n\n removeNodeCascade(\n uid: string,\n reader: GraphReader,\n options?: BulkOptions,\n ): Promise<CascadeResult> {\n return removeNodeCascadeImpl(this.db, this.collectionPath, reader, uid, options);\n }\n\n bulkRemoveEdges(\n params: FindEdgesParams,\n reader: GraphReader,\n options?: BulkOptions,\n ): Promise<BulkResult> {\n return bulkRemoveEdgesImpl(this.db, this.collectionPath, reader, params, options);\n }\n\n // --- Cross-collection ---\n\n async findEdgesGlobal(\n params: FindEdgesParams,\n collectionName?: string,\n ): Promise<StoredGraphRecord[]> {\n const name = collectionName ?? this.collectionPath.split('/').pop()!;\n const plan = buildEdgeQueryPlan(params);\n\n if (plan.strategy === 'get') {\n throw new FiregraphError(\n 'findEdgesGlobal() requires a query, not a direct document lookup. ' +\n 'Omit one of aUid/axbType/bUid to force a query strategy.',\n 'INVALID_QUERY',\n );\n }\n\n const collectionGroupRef = this.db.collectionGroup(name);\n let q: Query = collectionGroupRef;\n for (const f of plan.filters) {\n q = q.where(f.field, f.op, f.value);\n }\n if (plan.options?.orderBy) {\n q = q.orderBy(plan.options.orderBy.field, plan.options.orderBy.direction ?? 'asc');\n }\n if (plan.options?.limit !== undefined) {\n q = q.limit(plan.options.limit);\n }\n const snap = await q.get();\n return snap.docs.map((doc) => doc.data() as StoredGraphRecord);\n }\n\n // --- Aggregate ---\n\n aggregate(spec: AggregateSpec, filters: QueryFilter[]): Promise<Record<string, number>> {\n return runFirestoreAggregate(this.db.collection(this.collectionPath), spec, filters, {\n edition: 'standard',\n });\n }\n\n // --- Server-side projection (capability: query.select) ---\n\n /**\n * Run a projecting query via the shared classic-API helper. Both Firestore\n * editions delegate to one implementation so the projection contract\n * (bare-name normalization, builtin / `data.*` resolution, dedup,\n * original-key preservation) stays consistent across editions. See\n * `runFirestoreFindEdgesProjected` for the resolution rules.\n */\n findEdgesProjected(\n select: ReadonlyArray<string>,\n filters: QueryFilter[],\n options?: QueryOptions,\n ): Promise<Array<Record<string, unknown>>> {\n return runFirestoreFindEdgesProjected(\n this.db.collection(this.collectionPath),\n select,\n filters,\n options,\n );\n }\n\n // --- Native vector / nearest-neighbour search (capability: search.vector) ---\n\n /**\n * Run a vector / nearest-neighbour query via the shared classic-API\n * helper. Both Firestore editions delegate to one implementation so the\n * field-path normalisation and result shape stay consistent across\n * editions. See `runFirestoreFindNearest` for the resolution rules and\n * the validation surface.\n *\n * Standard-edition note: vector search requires a single-field vector\n * index on the indexed `vectorField`, plus a composite index whenever\n * additional `where` filters narrow the candidate set before the ANN\n * walk. Both indexes are configured per project in the Firestore\n * console — firegraph does not auto-provision them.\n */\n findNearest(params: FindNearestParams): Promise<StoredGraphRecord[]> {\n return runFirestoreFindNearest(this.db.collection(this.collectionPath), params);\n }\n\n // --- Server-side multi-source fan-out (capability: query.join) ---\n\n /**\n * Fan out from `params.sources` over a single edge type via the chunked\n * classic-API helper. The classic `'in'` operator caps at 30 elements\n * per call, so the helper splits sources into 30-element chunks and\n * dispatches them in parallel via `Promise.all`. With 100 sources this\n * is `ceil(100/30) = 4` round trips; the per-source `findEdges` loop in\n * `traverse.ts` would have been 100. Enterprise can collapse this\n * further to a single Pipelines `equalAny(...)` call — Standard cannot,\n * so chunked classic is the best Standard can do.\n *\n * The helper applies a cross-chunk re-sort + total-limit slice so the\n * observable contract matches the SQL backends'\n * `WHERE … IN (?,?,…) ORDER BY … LIMIT N` semantics.\n */\n expand(params: ExpandParams): Promise<ExpandResult> {\n return runFirestoreClassicExpand(this.adapter, params);\n }\n}\n\n/**\n * Create a Firestore Standard-edition `StorageBackend`.\n *\n * Standard Firestore does not support pipelines or any Enterprise-only\n * features. `data.*` filters require composite indexes; callers that mostly\n * filter on built-in fields (`aUid`, `axbType`, `bUid`) avoid that\n * requirement.\n */\nexport function createFirestoreStandardBackend(\n db: Firestore,\n collectionPath: string,\n options: FirestoreStandardOptions = {},\n): StorageBackend<FirestoreStandardCapability> {\n const scopePath = options.scopePath ?? '';\n return new FirestoreStandardB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est(params) {
2222
2222
  if (!this.backend.findNearest) {
2223
2223
  throw new FiregraphError(
2224
- "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.",
2224
+ "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.",
2225
2225
  "UNSUPPORTED_OPERATION"
2226
2226
  );
2227
2227
  }
@@ -2237,13 +2237,15 @@ var GraphClientImpl = class _GraphClientImpl {
2237
2237
  * Native full-text search (capability `search.fullText`).
2238
2238
  *
2239
2239
  * Returns the top-N records by relevance, ordered by the search
2240
- * index's score. Only Firestore Enterprise declares this capability
2241
- * today — the underlying Pipelines `search({ query: documentMatches(...) })`
2242
- * stage requires Enterprise's FTS index. Standard does not declare
2243
- * the cap (FTS is an Enterprise-only product feature, not a
2244
- * typed-API gap), and the SQLite-shaped backends have no native
2245
- * FTS index. Backends without `search.fullText` throw
2246
- * `UNSUPPORTED_OPERATION` from this wrapper.
2240
+ * index's score. Firestore Enterprise declares this capability (via
2241
+ * the Pipelines `search({ query: documentMatches(...) })` stage over
2242
+ * Enterprise's FTS index), as does the local better-sqlite3 backend
2243
+ * (`firegraph/sqlite-local`, via a trigger-synced FTS5 index ranked
2244
+ * by `bm25()`). Standard does not declare the cap (FTS is an
2245
+ * Enterprise-only product feature, not a typed-API gap); D1 and the
2246
+ * Cloudflare DO edition have no FTS trigger infrastructure. Backends
2247
+ * without `search.fullText` throw `UNSUPPORTED_OPERATION` from this
2248
+ * wrapper.
2247
2249
  *
2248
2250
  * Scan-protection mirrors `findNearest`: a search with no
2249
2251
  * identifying filters (`aType` / `axbType` / `bType`) walks every
@@ -2259,7 +2261,7 @@ var GraphClientImpl = class _GraphClientImpl {
2259
2261
  async fullTextSearch(params) {
2260
2262
  if (!this.backend.fullTextSearch) {
2261
2263
  throw new FiregraphError(
2262
- "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.",
2264
+ "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.",
2263
2265
  "UNSUPPORTED_OPERATION"
2264
2266
  );
2265
2267
  }