@typicalday/firegraph 0.1.0 → 0.3.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.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Firestore } from '@google-cloud/firestore';
2
- import { G as GraphClientOptions, D as DynamicRegistryConfig, a as DynamicGraphClient, b as GraphClient, R as RegistryEntry, c as DiscoveryResult, d as GraphRegistry, e as GraphReader, f as GraphRecord, F as FindEdgesParams, Q as QueryPlan, g as FindNodesParams, T as TraversalBuilder } from './index-CG3R68Hu.cjs';
3
- export { B as BulkBatchError, h as BulkOptions, i as BulkProgress, j as BulkResult, C as CascadeResult, k as CodegenOptions, l as DefineTypeOptions, m as DiscoveredEntity, E as EdgeTopology, n as EdgeTypeData, o as FiregraphConfig, p as GraphBatch, q as GraphTransaction, r as GraphWriter, H as HopDefinition, s as HopResult, N as NodeTypeData, t as QueryFilter, u as QueryMode, v as QueryOptions, S as StoredGraphRecord, w as TraversalOptions, x as TraversalResult, V as ViewContext, y as ViewDefaultsConfig, z as ViewResolverConfig, W as WhereClause, A as defineConfig, I as generateTypes, J as resolveView } from './index-CG3R68Hu.cjs';
2
+ import { G as GraphClientOptions, D as DynamicRegistryConfig, a as DynamicGraphClient, b as GraphClient, R as RegistryEntry, c as DiscoveryResult, d as GraphRegistry, e as GraphReader, f as GraphRecord, F as FindEdgesParams, Q as QueryPlan, g as FindNodesParams, T as TraversalBuilder, h as QueryFilter } from './index-CQkofEC_.cjs';
3
+ export { B as BulkBatchError, i as BulkOptions, j as BulkProgress, k as BulkResult, C as CascadeResult, l as CodegenOptions, m as DefineTypeOptions, n as DiscoveredEntity, E as EdgeTopology, o as EdgeTypeData, p as FiregraphConfig, q as GraphBatch, r as GraphTransaction, s as GraphWriter, H as HopDefinition, t as HopResult, N as NodeTypeData, u as QueryMode, v as QueryOptions, S as ScanProtection, w as StoredGraphRecord, x as TraversalOptions, y as TraversalResult, V as ViewContext, z as ViewDefaultsConfig, A as ViewResolverConfig, W as WhereClause, I as defineConfig, J as generateTypes, K as resolveView } from './index-CQkofEC_.cjs';
4
4
  export { E as EntityViewConfig, a as EntityViewMeta, V as ViewComponentClass, b as ViewMeta, c as ViewRegistry, d as ViewRegistryInput, e as defineViews } from './views-DL60k0cf.cjs';
5
5
  export { Q as QueryClient, a as QueryClientError, b as QueryClientErrorCode, c as QueryClientOptions } from './client-Bk2Cm6xv.cjs';
6
6
 
@@ -71,7 +71,18 @@ declare function buildEdgeRecord(aType: string, aUid: string, axbType: string, b
71
71
  declare function buildEdgeQueryPlan(params: FindEdgesParams): QueryPlan;
72
72
  declare function buildNodeQueryPlan(params: FindNodesParams): QueryPlan;
73
73
 
74
- declare function createTraversal(reader: GraphReader, startUid: string): TraversalBuilder;
74
+ /**
75
+ * Create a traversal builder for multi-hop graph traversal.
76
+ *
77
+ * Accepts either a `GraphReader` (backwards compatible) or a `GraphClient`.
78
+ * When a `GraphClient` is provided, cross-graph traversal via `targetGraph`
79
+ * is supported — the traversal can follow edges into subgraphs.
80
+ *
81
+ * @param reader - A `GraphClient` or `GraphReader` to execute queries against
82
+ * @param startUid - UID of the starting node
83
+ * @param registry - Optional registry for automatic `targetGraph` resolution
84
+ */
85
+ declare function createTraversal(reader: GraphClient | GraphReader, startUid: string, registry?: GraphRegistry): TraversalBuilder;
75
86
 
76
87
  declare class FiregraphError extends Error {
77
88
  readonly code: string;
@@ -99,6 +110,12 @@ declare class TraversalError extends FiregraphError {
99
110
  declare class DynamicRegistryError extends FiregraphError {
100
111
  constructor(message: string);
101
112
  }
113
+ declare class QuerySafetyError extends FiregraphError {
114
+ constructor(message: string);
115
+ }
116
+ declare class RegistryScopeError extends FiregraphError {
117
+ constructor(aType: string, axbType: string, bType: string, scopePath: string, allowedIn: string[]);
118
+ }
102
119
 
103
120
  /**
104
121
  * Entity Discovery — convention-based auto-discovery of entities from
@@ -150,6 +167,83 @@ interface DiscoverResult {
150
167
  */
151
168
  declare function discoverEntities(entitiesDir: string): DiscoverResult;
152
169
 
170
+ /**
171
+ * Scope path matching for subgraph-level registry constraints.
172
+ *
173
+ * Scope paths are slash-separated names derived from the chain of
174
+ * `subgraph()` calls (e.g., `'agents'`, `'agents/memories'`).
175
+ * The root graph has an empty scope path (`''`).
176
+ *
177
+ * Patterns:
178
+ * - `'root'` — matches only the root graph (empty scope path)
179
+ * - `'agents'` — matches exactly `'agents'`
180
+ * - `'agents/memories'` — matches exactly `'agents/memories'`
181
+ * - `'*​/agents'` — `*` matches one segment: `'foo/agents'` but not `'a/b/agents'`
182
+ * - `'**​/memories'` — `**` matches zero or more segments
183
+ * - `'**'` — matches everything including root
184
+ */
185
+ /**
186
+ * Test whether a scope path matches a single pattern.
187
+ *
188
+ * @param scopePath - The current scope path (empty string for root)
189
+ * @param pattern - The pattern to match against
190
+ */
191
+ declare function matchScope(scopePath: string, pattern: string): boolean;
192
+ /**
193
+ * Test whether a scope path matches any pattern in a list.
194
+ * Returns `true` if the list is empty or undefined (allowed everywhere).
195
+ *
196
+ * @param scopePath - The current scope path (empty string for root)
197
+ * @param patterns - Array of patterns to match against
198
+ */
199
+ declare function matchScopeAny(scopePath: string, patterns: string[]): boolean;
200
+
201
+ /**
202
+ * Cross-graph edge resolution utilities.
203
+ *
204
+ * Provides path-scanning resolution for determining whether an edge's source
205
+ * (aUid) is an ancestor node by checking if the UID appears in the Firestore
206
+ * collection path.
207
+ *
208
+ * Firestore paths have a rigid alternating structure:
209
+ * collection / docId / collection / docId / collection
210
+ *
211
+ * Given a path like `graph/A/workspace/B/context`, segments at even indices
212
+ * are collection names and odd indices are document IDs. When we find a UID
213
+ * at an odd index, the collection containing that document is the path up to
214
+ * (and including) the preceding even-index segment.
215
+ */
216
+ /**
217
+ * Parse a Firestore collection path and determine the collection path
218
+ * where a given UID's document lives, if that UID is an ancestor in the path.
219
+ *
220
+ * @param collectionPath - The full Firestore collection path of the current client
221
+ * @param uid - The UID to search for in the path
222
+ * @returns The collection path containing the UID, or `null` if not found in the path
223
+ *
224
+ * @example
225
+ * ```ts
226
+ * // Path: graph/A/workspace/B/context
227
+ * resolveAncestorCollection('graph/A/workspace/B/context', 'A')
228
+ * // → 'graph'
229
+ *
230
+ * resolveAncestorCollection('graph/A/workspace/B/context', 'B')
231
+ * // → 'graph/A/workspace'
232
+ *
233
+ * resolveAncestorCollection('graph/A/workspace/B/context', 'unknown')
234
+ * // → null
235
+ * ```
236
+ */
237
+ declare function resolveAncestorCollection(collectionPath: string, uid: string): string | null;
238
+ /**
239
+ * Check whether a UID belongs to an ancestor node by scanning the collection path.
240
+ *
241
+ * @param collectionPath - The full Firestore collection path of the current client
242
+ * @param uid - The UID to check
243
+ * @returns `true` if the UID appears as a document segment in the path
244
+ */
245
+ declare function isAncestorUid(collectionPath: string, uid: string): boolean;
246
+
153
247
  /**
154
248
  * JSON Schema validation and introspection utilities.
155
249
  *
@@ -183,4 +277,63 @@ declare function compileSchema(schema: object, label?: string): (data: unknown)
183
277
  */
184
278
  declare function jsonSchemaToFieldMeta(schema: any): FieldMeta[];
185
279
 
186
- export { BOOTSTRAP_ENTRIES, type DiscoverResult, DiscoveryError, DiscoveryResult, type DiscoveryWarning, DynamicGraphClient, DynamicRegistryConfig, DynamicRegistryError, EDGE_TYPE_SCHEMA, EdgeNotFoundError, type FieldMeta, FindEdgesParams, FindNodesParams, FiregraphError, GraphClient, GraphClientOptions, GraphReader, GraphRecord, GraphRegistry, InvalidQueryError, META_EDGE_TYPE, META_NODE_TYPE, NODE_TYPE_SCHEMA, NodeNotFoundError, QueryPlan, RegistryEntry, RegistryViolationError, TraversalBuilder, TraversalError, ValidationError, buildEdgeQueryPlan, buildEdgeRecord, buildNodeQueryPlan, buildNodeRecord, compileSchema, computeEdgeDocId, computeNodeDocId, createBootstrapRegistry, createGraphClient, createRegistry, createRegistryFromGraph, createTraversal, discoverEntities, generateDeterministicUid, generateId, jsonSchemaToFieldMeta };
280
+ interface FirestoreIndexField {
281
+ fieldPath: string;
282
+ order: 'ASCENDING' | 'DESCENDING';
283
+ }
284
+ interface FirestoreIndex {
285
+ collectionGroup: string;
286
+ queryScope: 'COLLECTION' | 'COLLECTION_GROUP';
287
+ fields: FirestoreIndexField[];
288
+ }
289
+ interface FirestoreIndexConfig {
290
+ indexes: FirestoreIndex[];
291
+ fieldOverrides: unknown[];
292
+ }
293
+ /**
294
+ * Generates a Firestore index configuration for a firegraph collection.
295
+ *
296
+ * Always includes the 4 base composite indexes. If an entity discovery result
297
+ * is provided, generates additional data-field indexes for common query
298
+ * patterns on node data fields:
299
+ * (aType, axbType, data.{field})
300
+ *
301
+ * When registry entries with `targetGraph` are provided, also generates
302
+ * collection group indexes for `findEdgesGlobal()` queries. The collection
303
+ * group name defaults to `'graph'` (the standard subgraph name) but can be
304
+ * overridden per `targetGraph` value.
305
+ *
306
+ * @param collection - Firestore collection name (e.g. 'graph')
307
+ * @param entities - Optional discovery result for per-entity data field indexes
308
+ * @param registryEntries - Optional registry entries; when any have `targetGraph`,
309
+ * collection group indexes are generated for the distinct subgraph names
310
+ */
311
+ declare function generateIndexConfig(collection: string, entities?: DiscoveryResult, registryEntries?: ReadonlyArray<RegistryEntry>): FirestoreIndexConfig;
312
+
313
+ /**
314
+ * Result of analyzing a query for collection scan risk.
315
+ */
316
+ interface QuerySafetyResult {
317
+ /** Whether the query matches a known indexed pattern. */
318
+ safe: boolean;
319
+ /** Human-readable explanation when the query is unsafe. */
320
+ reason?: string;
321
+ }
322
+ /**
323
+ * Analyzes a set of query filters to determine whether the query would
324
+ * likely cause a full collection scan on Firestore Enterprise.
325
+ *
326
+ * A query is considered "safe" if the builtin fields present in the filters
327
+ * match at least one known composite index pattern. Queries that only use
328
+ * `data.*` fields without a safe base pattern are flagged as unsafe.
329
+ */
330
+ declare function analyzeQuerySafety(filters: QueryFilter[]): QuerySafetyResult;
331
+
332
+ /**
333
+ * Default result limit applied to findEdges/findNodes queries
334
+ * when no explicit limit is provided. Prevents unbounded result sets
335
+ * that could be expensive on Enterprise Firestore.
336
+ */
337
+ declare const DEFAULT_QUERY_LIMIT = 500;
338
+
339
+ export { BOOTSTRAP_ENTRIES, DEFAULT_QUERY_LIMIT, type DiscoverResult, DiscoveryError, DiscoveryResult, type DiscoveryWarning, DynamicGraphClient, DynamicRegistryConfig, DynamicRegistryError, EDGE_TYPE_SCHEMA, EdgeNotFoundError, type FieldMeta, FindEdgesParams, FindNodesParams, FiregraphError, type FirestoreIndex, type FirestoreIndexConfig, type FirestoreIndexField, GraphClient, GraphClientOptions, GraphReader, GraphRecord, GraphRegistry, InvalidQueryError, META_EDGE_TYPE, META_NODE_TYPE, NODE_TYPE_SCHEMA, NodeNotFoundError, QueryFilter, QueryPlan, QuerySafetyError, type QuerySafetyResult, RegistryEntry, RegistryScopeError, RegistryViolationError, TraversalBuilder, TraversalError, ValidationError, analyzeQuerySafety, buildEdgeQueryPlan, buildEdgeRecord, buildNodeQueryPlan, buildNodeRecord, compileSchema, computeEdgeDocId, computeNodeDocId, createBootstrapRegistry, createGraphClient, createRegistry, createRegistryFromGraph, createTraversal, discoverEntities, generateDeterministicUid, generateId, generateIndexConfig, isAncestorUid, jsonSchemaToFieldMeta, matchScope, matchScopeAny, resolveAncestorCollection };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Firestore } from '@google-cloud/firestore';
2
- import { G as GraphClientOptions, D as DynamicRegistryConfig, a as DynamicGraphClient, b as GraphClient, R as RegistryEntry, c as DiscoveryResult, d as GraphRegistry, e as GraphReader, f as GraphRecord, F as FindEdgesParams, Q as QueryPlan, g as FindNodesParams, T as TraversalBuilder } from './index-CG3R68Hu.js';
3
- export { B as BulkBatchError, h as BulkOptions, i as BulkProgress, j as BulkResult, C as CascadeResult, k as CodegenOptions, l as DefineTypeOptions, m as DiscoveredEntity, E as EdgeTopology, n as EdgeTypeData, o as FiregraphConfig, p as GraphBatch, q as GraphTransaction, r as GraphWriter, H as HopDefinition, s as HopResult, N as NodeTypeData, t as QueryFilter, u as QueryMode, v as QueryOptions, S as StoredGraphRecord, w as TraversalOptions, x as TraversalResult, V as ViewContext, y as ViewDefaultsConfig, z as ViewResolverConfig, W as WhereClause, A as defineConfig, I as generateTypes, J as resolveView } from './index-CG3R68Hu.js';
2
+ import { G as GraphClientOptions, D as DynamicRegistryConfig, a as DynamicGraphClient, b as GraphClient, R as RegistryEntry, c as DiscoveryResult, d as GraphRegistry, e as GraphReader, f as GraphRecord, F as FindEdgesParams, Q as QueryPlan, g as FindNodesParams, T as TraversalBuilder, h as QueryFilter } from './index-CQkofEC_.js';
3
+ export { B as BulkBatchError, i as BulkOptions, j as BulkProgress, k as BulkResult, C as CascadeResult, l as CodegenOptions, m as DefineTypeOptions, n as DiscoveredEntity, E as EdgeTopology, o as EdgeTypeData, p as FiregraphConfig, q as GraphBatch, r as GraphTransaction, s as GraphWriter, H as HopDefinition, t as HopResult, N as NodeTypeData, u as QueryMode, v as QueryOptions, S as ScanProtection, w as StoredGraphRecord, x as TraversalOptions, y as TraversalResult, V as ViewContext, z as ViewDefaultsConfig, A as ViewResolverConfig, W as WhereClause, I as defineConfig, J as generateTypes, K as resolveView } from './index-CQkofEC_.js';
4
4
  export { E as EntityViewConfig, a as EntityViewMeta, V as ViewComponentClass, b as ViewMeta, c as ViewRegistry, d as ViewRegistryInput, e as defineViews } from './views-DL60k0cf.js';
5
5
  export { Q as QueryClient, a as QueryClientError, b as QueryClientErrorCode, c as QueryClientOptions } from './client-Bk2Cm6xv.js';
6
6
 
@@ -71,7 +71,18 @@ declare function buildEdgeRecord(aType: string, aUid: string, axbType: string, b
71
71
  declare function buildEdgeQueryPlan(params: FindEdgesParams): QueryPlan;
72
72
  declare function buildNodeQueryPlan(params: FindNodesParams): QueryPlan;
73
73
 
74
- declare function createTraversal(reader: GraphReader, startUid: string): TraversalBuilder;
74
+ /**
75
+ * Create a traversal builder for multi-hop graph traversal.
76
+ *
77
+ * Accepts either a `GraphReader` (backwards compatible) or a `GraphClient`.
78
+ * When a `GraphClient` is provided, cross-graph traversal via `targetGraph`
79
+ * is supported — the traversal can follow edges into subgraphs.
80
+ *
81
+ * @param reader - A `GraphClient` or `GraphReader` to execute queries against
82
+ * @param startUid - UID of the starting node
83
+ * @param registry - Optional registry for automatic `targetGraph` resolution
84
+ */
85
+ declare function createTraversal(reader: GraphClient | GraphReader, startUid: string, registry?: GraphRegistry): TraversalBuilder;
75
86
 
76
87
  declare class FiregraphError extends Error {
77
88
  readonly code: string;
@@ -99,6 +110,12 @@ declare class TraversalError extends FiregraphError {
99
110
  declare class DynamicRegistryError extends FiregraphError {
100
111
  constructor(message: string);
101
112
  }
113
+ declare class QuerySafetyError extends FiregraphError {
114
+ constructor(message: string);
115
+ }
116
+ declare class RegistryScopeError extends FiregraphError {
117
+ constructor(aType: string, axbType: string, bType: string, scopePath: string, allowedIn: string[]);
118
+ }
102
119
 
103
120
  /**
104
121
  * Entity Discovery — convention-based auto-discovery of entities from
@@ -150,6 +167,83 @@ interface DiscoverResult {
150
167
  */
151
168
  declare function discoverEntities(entitiesDir: string): DiscoverResult;
152
169
 
170
+ /**
171
+ * Scope path matching for subgraph-level registry constraints.
172
+ *
173
+ * Scope paths are slash-separated names derived from the chain of
174
+ * `subgraph()` calls (e.g., `'agents'`, `'agents/memories'`).
175
+ * The root graph has an empty scope path (`''`).
176
+ *
177
+ * Patterns:
178
+ * - `'root'` — matches only the root graph (empty scope path)
179
+ * - `'agents'` — matches exactly `'agents'`
180
+ * - `'agents/memories'` — matches exactly `'agents/memories'`
181
+ * - `'*​/agents'` — `*` matches one segment: `'foo/agents'` but not `'a/b/agents'`
182
+ * - `'**​/memories'` — `**` matches zero or more segments
183
+ * - `'**'` — matches everything including root
184
+ */
185
+ /**
186
+ * Test whether a scope path matches a single pattern.
187
+ *
188
+ * @param scopePath - The current scope path (empty string for root)
189
+ * @param pattern - The pattern to match against
190
+ */
191
+ declare function matchScope(scopePath: string, pattern: string): boolean;
192
+ /**
193
+ * Test whether a scope path matches any pattern in a list.
194
+ * Returns `true` if the list is empty or undefined (allowed everywhere).
195
+ *
196
+ * @param scopePath - The current scope path (empty string for root)
197
+ * @param patterns - Array of patterns to match against
198
+ */
199
+ declare function matchScopeAny(scopePath: string, patterns: string[]): boolean;
200
+
201
+ /**
202
+ * Cross-graph edge resolution utilities.
203
+ *
204
+ * Provides path-scanning resolution for determining whether an edge's source
205
+ * (aUid) is an ancestor node by checking if the UID appears in the Firestore
206
+ * collection path.
207
+ *
208
+ * Firestore paths have a rigid alternating structure:
209
+ * collection / docId / collection / docId / collection
210
+ *
211
+ * Given a path like `graph/A/workspace/B/context`, segments at even indices
212
+ * are collection names and odd indices are document IDs. When we find a UID
213
+ * at an odd index, the collection containing that document is the path up to
214
+ * (and including) the preceding even-index segment.
215
+ */
216
+ /**
217
+ * Parse a Firestore collection path and determine the collection path
218
+ * where a given UID's document lives, if that UID is an ancestor in the path.
219
+ *
220
+ * @param collectionPath - The full Firestore collection path of the current client
221
+ * @param uid - The UID to search for in the path
222
+ * @returns The collection path containing the UID, or `null` if not found in the path
223
+ *
224
+ * @example
225
+ * ```ts
226
+ * // Path: graph/A/workspace/B/context
227
+ * resolveAncestorCollection('graph/A/workspace/B/context', 'A')
228
+ * // → 'graph'
229
+ *
230
+ * resolveAncestorCollection('graph/A/workspace/B/context', 'B')
231
+ * // → 'graph/A/workspace'
232
+ *
233
+ * resolveAncestorCollection('graph/A/workspace/B/context', 'unknown')
234
+ * // → null
235
+ * ```
236
+ */
237
+ declare function resolveAncestorCollection(collectionPath: string, uid: string): string | null;
238
+ /**
239
+ * Check whether a UID belongs to an ancestor node by scanning the collection path.
240
+ *
241
+ * @param collectionPath - The full Firestore collection path of the current client
242
+ * @param uid - The UID to check
243
+ * @returns `true` if the UID appears as a document segment in the path
244
+ */
245
+ declare function isAncestorUid(collectionPath: string, uid: string): boolean;
246
+
153
247
  /**
154
248
  * JSON Schema validation and introspection utilities.
155
249
  *
@@ -183,4 +277,63 @@ declare function compileSchema(schema: object, label?: string): (data: unknown)
183
277
  */
184
278
  declare function jsonSchemaToFieldMeta(schema: any): FieldMeta[];
185
279
 
186
- export { BOOTSTRAP_ENTRIES, type DiscoverResult, DiscoveryError, DiscoveryResult, type DiscoveryWarning, DynamicGraphClient, DynamicRegistryConfig, DynamicRegistryError, EDGE_TYPE_SCHEMA, EdgeNotFoundError, type FieldMeta, FindEdgesParams, FindNodesParams, FiregraphError, GraphClient, GraphClientOptions, GraphReader, GraphRecord, GraphRegistry, InvalidQueryError, META_EDGE_TYPE, META_NODE_TYPE, NODE_TYPE_SCHEMA, NodeNotFoundError, QueryPlan, RegistryEntry, RegistryViolationError, TraversalBuilder, TraversalError, ValidationError, buildEdgeQueryPlan, buildEdgeRecord, buildNodeQueryPlan, buildNodeRecord, compileSchema, computeEdgeDocId, computeNodeDocId, createBootstrapRegistry, createGraphClient, createRegistry, createRegistryFromGraph, createTraversal, discoverEntities, generateDeterministicUid, generateId, jsonSchemaToFieldMeta };
280
+ interface FirestoreIndexField {
281
+ fieldPath: string;
282
+ order: 'ASCENDING' | 'DESCENDING';
283
+ }
284
+ interface FirestoreIndex {
285
+ collectionGroup: string;
286
+ queryScope: 'COLLECTION' | 'COLLECTION_GROUP';
287
+ fields: FirestoreIndexField[];
288
+ }
289
+ interface FirestoreIndexConfig {
290
+ indexes: FirestoreIndex[];
291
+ fieldOverrides: unknown[];
292
+ }
293
+ /**
294
+ * Generates a Firestore index configuration for a firegraph collection.
295
+ *
296
+ * Always includes the 4 base composite indexes. If an entity discovery result
297
+ * is provided, generates additional data-field indexes for common query
298
+ * patterns on node data fields:
299
+ * (aType, axbType, data.{field})
300
+ *
301
+ * When registry entries with `targetGraph` are provided, also generates
302
+ * collection group indexes for `findEdgesGlobal()` queries. The collection
303
+ * group name defaults to `'graph'` (the standard subgraph name) but can be
304
+ * overridden per `targetGraph` value.
305
+ *
306
+ * @param collection - Firestore collection name (e.g. 'graph')
307
+ * @param entities - Optional discovery result for per-entity data field indexes
308
+ * @param registryEntries - Optional registry entries; when any have `targetGraph`,
309
+ * collection group indexes are generated for the distinct subgraph names
310
+ */
311
+ declare function generateIndexConfig(collection: string, entities?: DiscoveryResult, registryEntries?: ReadonlyArray<RegistryEntry>): FirestoreIndexConfig;
312
+
313
+ /**
314
+ * Result of analyzing a query for collection scan risk.
315
+ */
316
+ interface QuerySafetyResult {
317
+ /** Whether the query matches a known indexed pattern. */
318
+ safe: boolean;
319
+ /** Human-readable explanation when the query is unsafe. */
320
+ reason?: string;
321
+ }
322
+ /**
323
+ * Analyzes a set of query filters to determine whether the query would
324
+ * likely cause a full collection scan on Firestore Enterprise.
325
+ *
326
+ * A query is considered "safe" if the builtin fields present in the filters
327
+ * match at least one known composite index pattern. Queries that only use
328
+ * `data.*` fields without a safe base pattern are flagged as unsafe.
329
+ */
330
+ declare function analyzeQuerySafety(filters: QueryFilter[]): QuerySafetyResult;
331
+
332
+ /**
333
+ * Default result limit applied to findEdges/findNodes queries
334
+ * when no explicit limit is provided. Prevents unbounded result sets
335
+ * that could be expensive on Enterprise Firestore.
336
+ */
337
+ declare const DEFAULT_QUERY_LIMIT = 500;
338
+
339
+ export { BOOTSTRAP_ENTRIES, DEFAULT_QUERY_LIMIT, type DiscoverResult, DiscoveryError, DiscoveryResult, type DiscoveryWarning, DynamicGraphClient, DynamicRegistryConfig, DynamicRegistryError, EDGE_TYPE_SCHEMA, EdgeNotFoundError, type FieldMeta, FindEdgesParams, FindNodesParams, FiregraphError, type FirestoreIndex, type FirestoreIndexConfig, type FirestoreIndexField, GraphClient, GraphClientOptions, GraphReader, GraphRecord, GraphRegistry, InvalidQueryError, META_EDGE_TYPE, META_NODE_TYPE, NODE_TYPE_SCHEMA, NodeNotFoundError, QueryFilter, QueryPlan, QuerySafetyError, type QuerySafetyResult, RegistryEntry, RegistryScopeError, RegistryViolationError, TraversalBuilder, TraversalError, ValidationError, analyzeQuerySafety, buildEdgeQueryPlan, buildEdgeRecord, buildNodeQueryPlan, buildNodeRecord, compileSchema, computeEdgeDocId, computeNodeDocId, createBootstrapRegistry, createGraphClient, createRegistry, createRegistryFromGraph, createTraversal, discoverEntities, generateDeterministicUid, generateId, generateIndexConfig, isAncestorUid, jsonSchemaToFieldMeta, matchScope, matchScopeAny, resolveAncestorCollection };