@typicalday/firegraph 0.11.2 → 0.13.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 (78) hide show
  1. package/README.md +355 -78
  2. package/dist/backend-DuvHGgK1.d.cts +1897 -0
  3. package/dist/backend-DuvHGgK1.d.ts +1897 -0
  4. package/dist/backend.cjs +365 -5
  5. package/dist/backend.cjs.map +1 -1
  6. package/dist/backend.d.cts +25 -5
  7. package/dist/backend.d.ts +25 -5
  8. package/dist/backend.js +209 -7
  9. package/dist/backend.js.map +1 -1
  10. package/dist/chunk-2DHMNTV6.js +16 -0
  11. package/dist/chunk-2DHMNTV6.js.map +1 -0
  12. package/dist/chunk-4MMQ5W74.js +288 -0
  13. package/dist/chunk-4MMQ5W74.js.map +1 -0
  14. package/dist/{chunk-5753Y42M.js → chunk-C2QMD7RY.js} +6 -10
  15. package/dist/chunk-C2QMD7RY.js.map +1 -0
  16. package/dist/chunk-D4J7Z4FE.js +67 -0
  17. package/dist/chunk-D4J7Z4FE.js.map +1 -0
  18. package/dist/chunk-EQJUUVFG.js +14 -0
  19. package/dist/chunk-EQJUUVFG.js.map +1 -0
  20. package/dist/chunk-N5HFDWQX.js +23 -0
  21. package/dist/chunk-N5HFDWQX.js.map +1 -0
  22. package/dist/chunk-PAD7WFFU.js +573 -0
  23. package/dist/chunk-PAD7WFFU.js.map +1 -0
  24. package/dist/chunk-TK64DNVK.js +256 -0
  25. package/dist/chunk-TK64DNVK.js.map +1 -0
  26. package/dist/{chunk-NJSOD64C.js → chunk-WRTFC5NG.js} +438 -30
  27. package/dist/chunk-WRTFC5NG.js.map +1 -0
  28. package/dist/client-BKi3vk0Q.d.ts +34 -0
  29. package/dist/client-BrsaXtDV.d.cts +34 -0
  30. package/dist/cloudflare/index.cjs +1386 -74
  31. package/dist/cloudflare/index.cjs.map +1 -1
  32. package/dist/cloudflare/index.d.cts +217 -13
  33. package/dist/cloudflare/index.d.ts +217 -13
  34. package/dist/cloudflare/index.js +639 -180
  35. package/dist/cloudflare/index.js.map +1 -1
  36. package/dist/codegen/index.d.cts +1 -1
  37. package/dist/codegen/index.d.ts +1 -1
  38. package/dist/errors-BRc3I_eH.d.cts +73 -0
  39. package/dist/errors-BRc3I_eH.d.ts +73 -0
  40. package/dist/firestore-enterprise/index.cjs +3877 -0
  41. package/dist/firestore-enterprise/index.cjs.map +1 -0
  42. package/dist/firestore-enterprise/index.d.cts +141 -0
  43. package/dist/firestore-enterprise/index.d.ts +141 -0
  44. package/dist/firestore-enterprise/index.js +985 -0
  45. package/dist/firestore-enterprise/index.js.map +1 -0
  46. package/dist/firestore-standard/index.cjs +3117 -0
  47. package/dist/firestore-standard/index.cjs.map +1 -0
  48. package/dist/firestore-standard/index.d.cts +49 -0
  49. package/dist/firestore-standard/index.d.ts +49 -0
  50. package/dist/firestore-standard/index.js +283 -0
  51. package/dist/firestore-standard/index.js.map +1 -0
  52. package/dist/index.cjs +809 -534
  53. package/dist/index.cjs.map +1 -1
  54. package/dist/index.d.cts +24 -100
  55. package/dist/index.d.ts +24 -100
  56. package/dist/index.js +184 -531
  57. package/dist/index.js.map +1 -1
  58. package/dist/registry-Bc7h6WTM.d.cts +64 -0
  59. package/dist/registry-C2KUPVZj.d.ts +64 -0
  60. package/dist/{scope-path-B1G3YiA7.d.ts → scope-path-CROFZGr9.d.cts} +1 -56
  61. package/dist/{scope-path-B1G3YiA7.d.cts → scope-path-CROFZGr9.d.ts} +1 -56
  62. package/dist/{serialization-ZZ7RSDRX.js → serialization-OE2PFZMY.js} +6 -4
  63. package/dist/sqlite/index.cjs +3631 -0
  64. package/dist/sqlite/index.cjs.map +1 -0
  65. package/dist/sqlite/index.d.cts +111 -0
  66. package/dist/sqlite/index.d.ts +111 -0
  67. package/dist/sqlite/index.js +1164 -0
  68. package/dist/sqlite/index.js.map +1 -0
  69. package/package.json +33 -3
  70. package/dist/backend-U-MLShlg.d.ts +0 -97
  71. package/dist/backend-np4gEVhB.d.cts +0 -97
  72. package/dist/chunk-5753Y42M.js.map +0 -1
  73. package/dist/chunk-NJSOD64C.js.map +0 -1
  74. package/dist/chunk-R7CRGYY4.js +0 -94
  75. package/dist/chunk-R7CRGYY4.js.map +0 -1
  76. package/dist/types-BGWxcpI_.d.cts +0 -736
  77. package/dist/types-BGWxcpI_.d.ts +0 -736
  78. /package/dist/{serialization-ZZ7RSDRX.js.map → serialization-OE2PFZMY.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -1,23 +1,15 @@
1
- import { S as StorageBackend } from './backend-np4gEVhB.cjs';
2
- import { G as GraphClientOptions, a as GraphClient, D as DynamicGraphClient, I as IndexSpec, b as DiscoveryResult, R as RegistryEntry, c as GraphRegistry, d as GraphReader, M as MigrationExecutor, e as DynamicRegistryConfig, S as StoredGraphRecord, f as MigrationWriteBack, g as MigrationStep, F as FindEdgesParams, Q as QueryPlan, h as FindNodesParams, i as QueryFilter, j as GraphRecord, k as MigrationFn, l as StoredMigrationStep, T as TraversalBuilder } from './types-BGWxcpI_.cjs';
3
- export { B as BulkBatchError, m as BulkOptions, n as BulkProgress, o as BulkResult, C as CascadeResult, p as DefineTypeOptions, q as DiscoveredEntity, E as EdgeTopology, r as EdgeTypeData, s as FiregraphConfig, t as GraphBatch, u as GraphTransaction, v as GraphWriter, H as HopDefinition, w as HopResult, x as IndexFieldSpec, N as NodeTypeData, y as QueryMode, z as QueryOptions, A as ScanProtection, J as TraversalOptions, K as TraversalResult, V as ViewContext, L as ViewDefaultsConfig, O as ViewResolverConfig, W as WhereClause, P as defineConfig, U as resolveView } from './types-BGWxcpI_.cjs';
1
+ export { c as createGraphClient, a as createGraphClientFromBackend } from './client-BrsaXtDV.cjs';
4
2
  export { CodegenOptions, generateTypes } from './codegen/index.cjs';
5
- import { F as FiregraphError } from './scope-path-B1G3YiA7.cjs';
6
- export { C 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, S as StorageScopeSegment, T as TraversalError, V as ValidationError, a as appendStorageScope, i as isAncestorScopeUid, p as parseStorageScope, r as resolveAncestorScope } from './scope-path-B1G3YiA7.cjs';
7
- import { Firestore } from '@google-cloud/firestore';
3
+ import { I as IndexSpec, l as DiscoveryResult, R as RegistryEntry, m as StoredGraphRecord, M as MigrationWriteBack, n as MigrationStep, G as GraphRegistry, F as FindEdgesParams, Q as QueryPlan, o as FindNodesParams, p as QueryFilter, q as MigrationExecutor, r as MigrationFn, s as StoredMigrationStep, t as GraphClient, u as GraphReader, v as TraversalBuilder } from './backend-DuvHGgK1.cjs';
4
+ export { A as AggregateExtension, w as AggregateField, x as AggregateOp, y as AggregateResult, z as AggregateSpec, C as BulkBatchError, H as BulkOptions, K as BulkProgress, L as BulkResult, b as BulkUpdatePatch, N as Capability, O as CascadeResult, P as CoreGraphClient, V as DefineTypeOptions, X as DiscoveredEntity, Y as DistanceMeasure, d as DmlExtension, Z as DynamicGraphClient, _ as DynamicGraphMethods, $ as DynamicRegistryConfig, a0 as EdgeTopology, a1 as EdgeTypeData, E as ExpandParams, e as ExpandResult, a2 as FindEdgesProjectedParams, a3 as FindNearestParams, a4 as FiregraphConfig, a5 as FullTextSearchExtension, a6 as GeoExtension, a7 as GraphBatch, a8 as GraphClientOptions, a9 as GraphRecord, aa as GraphTransaction, ab as GraphWriter, ac as HopDefinition, ad as HopResult, ae as IndexFieldSpec, J as JoinExtension, af as NodeTypeData, ag as ProjectedRow, ah as QueryMode, ai 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-DuvHGgK1.cjs';
5
+ import { F as FiregraphError } from './errors-BRc3I_eH.cjs';
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, c as createBootstrapRegistry, b as createMergedRegistry, d as createRegistry, e as createRegistryFromGraph, g as generateDeterministicUid, f as generateId } from './registry-Bc7h6WTM.cjs';
8
8
  export { Q as QueryClient, a as QueryClientError, b as QueryClientErrorCode, c as QueryClientOptions } from './client-Bk2Cm6xv.cjs';
9
+ export { S as StorageScopeSegment, a as appendStorageScope, i as isAncestorScopeUid, p as parseStorageScope, r as resolveAncestorScope } from './scope-path-CROFZGr9.cjs';
10
+ import { Firestore } from '@google-cloud/firestore';
9
11
  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';
10
12
 
11
- /**
12
- * Create a `GraphClient` backed by an arbitrary `StorageBackend`.
13
- *
14
- * Used by backend-specific factories (e.g. `createDOClient` in
15
- * `firegraph/cloudflare`) — most callers should use the higher-level
16
- * `createGraphClient(firestore, ...)` overload below for Firestore, or the
17
- * Cloudflare factory for DO-backed graphs.
18
- */
19
- declare function createGraphClientFromBackend(backend: StorageBackend, options?: GraphClientOptions, metaBackend?: StorageBackend): GraphClient | DynamicGraphClient;
20
-
21
13
  /**
22
14
  * Cross-graph edge resolution utilities.
23
15
  *
@@ -165,53 +157,6 @@ declare function discoverEntities(entitiesDir: string): DiscoverResult;
165
157
  declare function computeNodeDocId(uid: string): string;
166
158
  declare function computeEdgeDocId(aUid: string, axbType: string, bUid: string): string;
167
159
 
168
- /** The aType used for node type definition meta-nodes. */
169
- declare const META_NODE_TYPE = "nodeType";
170
- /** The aType used for edge type definition meta-nodes. */
171
- declare const META_EDGE_TYPE = "edgeType";
172
- /** JSON Schema for the `data` payload of a `nodeType` meta-node. */
173
- declare const NODE_TYPE_SCHEMA: object;
174
- /** JSON Schema for the `data` payload of an `edgeType` meta-node. */
175
- declare const EDGE_TYPE_SCHEMA: object;
176
- /** Registry entries for the two meta-types (always present). */
177
- declare const BOOTSTRAP_ENTRIES: readonly RegistryEntry[];
178
- declare function createBootstrapRegistry(): GraphRegistry;
179
- /**
180
- * Generate a deterministic UID for a meta-type definition.
181
- * This ensures that defining the same type name always targets the same
182
- * Firestore document, enabling upsert semantics.
183
- *
184
- * Format: 21-char base64url substring of SHA-256(`metaType:name`).
185
- */
186
- declare function generateDeterministicUid(metaType: string, name: string): string;
187
- /**
188
- * Read meta-type nodes from the graph and compile them into a GraphRegistry.
189
- *
190
- * The returned registry includes both the dynamic entries AND the bootstrap
191
- * meta-type entries, so meta-type writes remain validateable after a reload.
192
- *
193
- * @param reader - A GraphReader pointed at the collection containing meta-nodes.
194
- * @param executor - Optional custom executor for compiling stored migration source strings.
195
- */
196
- declare function createRegistryFromGraph(reader: GraphReader, executor?: MigrationExecutor): Promise<GraphRegistry>;
197
-
198
- /**
199
- * Firestore-specific client factory.
200
- *
201
- * Kept in its own module so that bundlers don't pull
202
- * `@google-cloud/firestore` into non-Firestore entry points — most
203
- * importantly the Cloudflare DO backend (`firegraph/cloudflare`) and the
204
- * routing primitive (`firegraph/backend`), both of which must load cleanly
205
- * in a Workers environment where the Node Firestore SDK is unavailable.
206
- */
207
-
208
- declare function createGraphClient(db: Firestore, collectionPath: string, options: GraphClientOptions & {
209
- registryMode: DynamicRegistryConfig;
210
- }): DynamicGraphClient;
211
- declare function createGraphClient(db: Firestore, collectionPath: string, options?: GraphClientOptions): GraphClient;
212
-
213
- declare function generateId(): string;
214
-
215
160
  /**
216
161
  * Firestore composite index generator.
217
162
  *
@@ -425,38 +370,6 @@ interface QuerySafetyResult {
425
370
  */
426
371
  declare function analyzeQuerySafety(filters: QueryFilter[]): QuerySafetyResult;
427
372
 
428
- declare function buildNodeRecord(aType: string, uid: string, data: Record<string, unknown>): GraphRecord;
429
- declare function buildEdgeRecord(aType: string, aUid: string, axbType: string, bType: string, bUid: string, data: Record<string, unknown>): GraphRecord;
430
-
431
- /**
432
- * Build a registry from either explicit entries or a DiscoveryResult.
433
- *
434
- * @example
435
- * ```ts
436
- * // From explicit entries (programmatic)
437
- * const registry = createRegistry([
438
- * { aType: 'user', axbType: 'is', bType: 'user', jsonSchema: userSchema },
439
- * { aType: 'user', axbType: 'follows', bType: 'user', jsonSchema: followsSchema },
440
- * ]);
441
- *
442
- * // From discovery result (folder convention)
443
- * const discovered = await discoverEntities('./entities');
444
- * const registry = createRegistry(discovered);
445
- * ```
446
- */
447
- declare function createRegistry(input: RegistryEntry[] | DiscoveryResult): GraphRegistry;
448
- /**
449
- * Create a merged registry where `base` entries take priority and `extension`
450
- * entries fill in gaps. Lookups and validation check `base` first; only if the
451
- * triple is not found there does the merged registry fall through to
452
- * `extension`.
453
- *
454
- * The `entries()` method returns a deduplicated list (base wins on collision).
455
- * The `lookupByAxbType()` method merges results from both registries,
456
- * deduplicating by triple key with base entries winning.
457
- */
458
- declare function createMergedRegistry(base: GraphRegistry, extension: GraphRegistry): GraphRegistry;
459
-
460
373
  /**
461
374
  * Sandbox module for compiling dynamic registry migration source strings
462
375
  * into executable functions.
@@ -561,6 +474,21 @@ declare function matchScope(scopePath: string, pattern: string): boolean;
561
474
  */
562
475
  declare function matchScopeAny(scopePath: string, patterns: string[]): boolean;
563
476
 
477
+ /**
478
+ * Firegraph serialization tag — split from `src/serialization.ts` so it can
479
+ * be imported from Workers-facing code without dragging in
480
+ * `@google-cloud/firestore`.
481
+ *
482
+ * The full serialization module (with Timestamp/GeoPoint round-tripping)
483
+ * lives one folder up because the sandbox migration pipeline needs it; the
484
+ * write-plan helper only needs to recognise tagged objects to keep them
485
+ * terminal during patch flattening, so it imports just the tag from here.
486
+ */
487
+ /** Sentinel key used to tag serialized Firestore types. */
488
+ declare const SERIALIZATION_TAG: "__firegraph_ser__";
489
+ /** Check if a value is a tagged serialized Firestore type. */
490
+ declare function isTaggedValue(value: unknown): boolean;
491
+
564
492
  /**
565
493
  * Firestore-aware serialization for the sandbox migration pipeline.
566
494
  *
@@ -574,10 +502,6 @@ declare function matchScopeAny(scopePath: string, patterns: string[]): boolean;
574
502
  * (in-memory functions) receive raw Firestore objects directly.
575
503
  */
576
504
 
577
- /** Sentinel key used to tag serialized Firestore types. */
578
- declare const SERIALIZATION_TAG: "__firegraph_ser__";
579
- /** Check if a value is a tagged serialized Firestore type. */
580
- declare function isTaggedValue(value: unknown): boolean;
581
505
  /**
582
506
  * Recursively walk a data object and replace Firestore types with tagged
583
507
  * plain objects suitable for JSON serialization.
@@ -610,4 +534,4 @@ declare function deserializeFirestoreTypes(data: Record<string, unknown>, db?: F
610
534
  */
611
535
  declare function createTraversal(reader: GraphClient | GraphReader, startUid: string, registry?: GraphRegistry): TraversalBuilder;
612
536
 
613
- export { BOOTSTRAP_ENTRIES, DEFAULT_CORE_INDEXES, DEFAULT_QUERY_LIMIT, type DiscoverResult, DiscoveryError, DiscoveryResult, type DiscoveryWarning, DynamicGraphClient, DynamicRegistryConfig, EDGE_TYPE_SCHEMA, type FieldMeta, FindEdgesParams, FindNodesParams, FiregraphError, type FirestoreIndex, type FirestoreIndexConfig, type FirestoreIndexField, type GenerateIndexOptions, GraphClient, GraphClientOptions, GraphReader, GraphRecord, GraphRegistry, IndexSpec, META_EDGE_TYPE, META_NODE_TYPE, MigrationExecutor, MigrationFn, type MigrationResult, MigrationStep, MigrationWriteBack, NODE_TYPE_SCHEMA, QueryFilter, QueryPlan, type QuerySafetyResult, RegistryEntry, SERIALIZATION_TAG, StoredGraphRecord, StoredMigrationStep, TraversalBuilder, analyzeQuerySafety, applyMigrationChain, buildEdgeQueryPlan, buildEdgeRecord, buildNodeQueryPlan, buildNodeRecord, compileMigrationFn, compileMigrations, compileSchema, computeEdgeDocId, computeNodeDocId, createBootstrapRegistry, createGraphClient, createGraphClientFromBackend, createMergedRegistry, createRegistry, createRegistryFromGraph, createTraversal, defaultExecutor, deserializeFirestoreTypes, destroySandboxWorker, discoverEntities, generateDeterministicUid, generateId, generateIndexConfig, isAncestorUid, isTaggedValue, jsonSchemaToFieldMeta, matchScope, matchScopeAny, migrateRecord, migrateRecords, precompileSource, resolveAncestorCollection, serializeFirestoreTypes, validateMigrationChain };
537
+ export { DEFAULT_CORE_INDEXES, DEFAULT_QUERY_LIMIT, type DiscoverResult, DiscoveryError, DiscoveryResult, type DiscoveryWarning, type FieldMeta, FindEdgesParams, FindNodesParams, FiregraphError, type FirestoreIndex, type FirestoreIndexConfig, type FirestoreIndexField, type GenerateIndexOptions, GraphClient, GraphReader, GraphRegistry, IndexSpec, MigrationExecutor, MigrationFn, type MigrationResult, MigrationStep, MigrationWriteBack, QueryFilter, QueryPlan, type QuerySafetyResult, RegistryEntry, SERIALIZATION_TAG, StoredGraphRecord, StoredMigrationStep, TraversalBuilder, analyzeQuerySafety, applyMigrationChain, buildEdgeQueryPlan, buildNodeQueryPlan, compileMigrationFn, compileMigrations, compileSchema, computeEdgeDocId, computeNodeDocId, createTraversal, defaultExecutor, deserializeFirestoreTypes, destroySandboxWorker, discoverEntities, generateIndexConfig, isAncestorUid, isTaggedValue, jsonSchemaToFieldMeta, matchScope, matchScopeAny, migrateRecord, migrateRecords, precompileSource, resolveAncestorCollection, serializeFirestoreTypes, validateMigrationChain };
package/dist/index.d.ts CHANGED
@@ -1,23 +1,15 @@
1
- import { S as StorageBackend } from './backend-U-MLShlg.js';
2
- import { G as GraphClientOptions, a as GraphClient, D as DynamicGraphClient, I as IndexSpec, b as DiscoveryResult, R as RegistryEntry, c as GraphRegistry, d as GraphReader, M as MigrationExecutor, e as DynamicRegistryConfig, S as StoredGraphRecord, f as MigrationWriteBack, g as MigrationStep, F as FindEdgesParams, Q as QueryPlan, h as FindNodesParams, i as QueryFilter, j as GraphRecord, k as MigrationFn, l as StoredMigrationStep, T as TraversalBuilder } from './types-BGWxcpI_.js';
3
- export { B as BulkBatchError, m as BulkOptions, n as BulkProgress, o as BulkResult, C as CascadeResult, p as DefineTypeOptions, q as DiscoveredEntity, E as EdgeTopology, r as EdgeTypeData, s as FiregraphConfig, t as GraphBatch, u as GraphTransaction, v as GraphWriter, H as HopDefinition, w as HopResult, x as IndexFieldSpec, N as NodeTypeData, y as QueryMode, z as QueryOptions, A as ScanProtection, J as TraversalOptions, K as TraversalResult, V as ViewContext, L as ViewDefaultsConfig, O as ViewResolverConfig, W as WhereClause, P as defineConfig, U as resolveView } from './types-BGWxcpI_.js';
1
+ export { c as createGraphClient, a as createGraphClientFromBackend } from './client-BKi3vk0Q.js';
4
2
  export { CodegenOptions, generateTypes } from './codegen/index.js';
5
- import { F as FiregraphError } from './scope-path-B1G3YiA7.js';
6
- export { C 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, S as StorageScopeSegment, T as TraversalError, V as ValidationError, a as appendStorageScope, i as isAncestorScopeUid, p as parseStorageScope, r as resolveAncestorScope } from './scope-path-B1G3YiA7.js';
7
- import { Firestore } from '@google-cloud/firestore';
3
+ import { I as IndexSpec, l as DiscoveryResult, R as RegistryEntry, m as StoredGraphRecord, M as MigrationWriteBack, n as MigrationStep, G as GraphRegistry, F as FindEdgesParams, Q as QueryPlan, o as FindNodesParams, p as QueryFilter, q as MigrationExecutor, r as MigrationFn, s as StoredMigrationStep, t as GraphClient, u as GraphReader, v as TraversalBuilder } from './backend-DuvHGgK1.js';
4
+ export { A as AggregateExtension, w as AggregateField, x as AggregateOp, y as AggregateResult, z as AggregateSpec, C as BulkBatchError, H as BulkOptions, K as BulkProgress, L as BulkResult, b as BulkUpdatePatch, N as Capability, O as CascadeResult, P as CoreGraphClient, V as DefineTypeOptions, X as DiscoveredEntity, Y as DistanceMeasure, d as DmlExtension, Z as DynamicGraphClient, _ as DynamicGraphMethods, $ as DynamicRegistryConfig, a0 as EdgeTopology, a1 as EdgeTypeData, E as ExpandParams, e as ExpandResult, a2 as FindEdgesProjectedParams, a3 as FindNearestParams, a4 as FiregraphConfig, a5 as FullTextSearchExtension, a6 as GeoExtension, a7 as GraphBatch, a8 as GraphClientOptions, a9 as GraphRecord, aa as GraphTransaction, ab as GraphWriter, ac as HopDefinition, ad as HopResult, ae as IndexFieldSpec, J as JoinExtension, af as NodeTypeData, ag as ProjectedRow, ah as QueryMode, ai 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-DuvHGgK1.js';
5
+ import { F as FiregraphError } from './errors-BRc3I_eH.js';
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, c as createBootstrapRegistry, b as createMergedRegistry, d as createRegistry, e as createRegistryFromGraph, g as generateDeterministicUid, f as generateId } from './registry-C2KUPVZj.js';
8
8
  export { Q as QueryClient, a as QueryClientError, b as QueryClientErrorCode, c as QueryClientOptions } from './client-Bk2Cm6xv.js';
9
+ export { S as StorageScopeSegment, a as appendStorageScope, i as isAncestorScopeUid, p as parseStorageScope, r as resolveAncestorScope } from './scope-path-CROFZGr9.js';
10
+ import { Firestore } from '@google-cloud/firestore';
9
11
  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';
10
12
 
11
- /**
12
- * Create a `GraphClient` backed by an arbitrary `StorageBackend`.
13
- *
14
- * Used by backend-specific factories (e.g. `createDOClient` in
15
- * `firegraph/cloudflare`) — most callers should use the higher-level
16
- * `createGraphClient(firestore, ...)` overload below for Firestore, or the
17
- * Cloudflare factory for DO-backed graphs.
18
- */
19
- declare function createGraphClientFromBackend(backend: StorageBackend, options?: GraphClientOptions, metaBackend?: StorageBackend): GraphClient | DynamicGraphClient;
20
-
21
13
  /**
22
14
  * Cross-graph edge resolution utilities.
23
15
  *
@@ -165,53 +157,6 @@ declare function discoverEntities(entitiesDir: string): DiscoverResult;
165
157
  declare function computeNodeDocId(uid: string): string;
166
158
  declare function computeEdgeDocId(aUid: string, axbType: string, bUid: string): string;
167
159
 
168
- /** The aType used for node type definition meta-nodes. */
169
- declare const META_NODE_TYPE = "nodeType";
170
- /** The aType used for edge type definition meta-nodes. */
171
- declare const META_EDGE_TYPE = "edgeType";
172
- /** JSON Schema for the `data` payload of a `nodeType` meta-node. */
173
- declare const NODE_TYPE_SCHEMA: object;
174
- /** JSON Schema for the `data` payload of an `edgeType` meta-node. */
175
- declare const EDGE_TYPE_SCHEMA: object;
176
- /** Registry entries for the two meta-types (always present). */
177
- declare const BOOTSTRAP_ENTRIES: readonly RegistryEntry[];
178
- declare function createBootstrapRegistry(): GraphRegistry;
179
- /**
180
- * Generate a deterministic UID for a meta-type definition.
181
- * This ensures that defining the same type name always targets the same
182
- * Firestore document, enabling upsert semantics.
183
- *
184
- * Format: 21-char base64url substring of SHA-256(`metaType:name`).
185
- */
186
- declare function generateDeterministicUid(metaType: string, name: string): string;
187
- /**
188
- * Read meta-type nodes from the graph and compile them into a GraphRegistry.
189
- *
190
- * The returned registry includes both the dynamic entries AND the bootstrap
191
- * meta-type entries, so meta-type writes remain validateable after a reload.
192
- *
193
- * @param reader - A GraphReader pointed at the collection containing meta-nodes.
194
- * @param executor - Optional custom executor for compiling stored migration source strings.
195
- */
196
- declare function createRegistryFromGraph(reader: GraphReader, executor?: MigrationExecutor): Promise<GraphRegistry>;
197
-
198
- /**
199
- * Firestore-specific client factory.
200
- *
201
- * Kept in its own module so that bundlers don't pull
202
- * `@google-cloud/firestore` into non-Firestore entry points — most
203
- * importantly the Cloudflare DO backend (`firegraph/cloudflare`) and the
204
- * routing primitive (`firegraph/backend`), both of which must load cleanly
205
- * in a Workers environment where the Node Firestore SDK is unavailable.
206
- */
207
-
208
- declare function createGraphClient(db: Firestore, collectionPath: string, options: GraphClientOptions & {
209
- registryMode: DynamicRegistryConfig;
210
- }): DynamicGraphClient;
211
- declare function createGraphClient(db: Firestore, collectionPath: string, options?: GraphClientOptions): GraphClient;
212
-
213
- declare function generateId(): string;
214
-
215
160
  /**
216
161
  * Firestore composite index generator.
217
162
  *
@@ -425,38 +370,6 @@ interface QuerySafetyResult {
425
370
  */
426
371
  declare function analyzeQuerySafety(filters: QueryFilter[]): QuerySafetyResult;
427
372
 
428
- declare function buildNodeRecord(aType: string, uid: string, data: Record<string, unknown>): GraphRecord;
429
- declare function buildEdgeRecord(aType: string, aUid: string, axbType: string, bType: string, bUid: string, data: Record<string, unknown>): GraphRecord;
430
-
431
- /**
432
- * Build a registry from either explicit entries or a DiscoveryResult.
433
- *
434
- * @example
435
- * ```ts
436
- * // From explicit entries (programmatic)
437
- * const registry = createRegistry([
438
- * { aType: 'user', axbType: 'is', bType: 'user', jsonSchema: userSchema },
439
- * { aType: 'user', axbType: 'follows', bType: 'user', jsonSchema: followsSchema },
440
- * ]);
441
- *
442
- * // From discovery result (folder convention)
443
- * const discovered = await discoverEntities('./entities');
444
- * const registry = createRegistry(discovered);
445
- * ```
446
- */
447
- declare function createRegistry(input: RegistryEntry[] | DiscoveryResult): GraphRegistry;
448
- /**
449
- * Create a merged registry where `base` entries take priority and `extension`
450
- * entries fill in gaps. Lookups and validation check `base` first; only if the
451
- * triple is not found there does the merged registry fall through to
452
- * `extension`.
453
- *
454
- * The `entries()` method returns a deduplicated list (base wins on collision).
455
- * The `lookupByAxbType()` method merges results from both registries,
456
- * deduplicating by triple key with base entries winning.
457
- */
458
- declare function createMergedRegistry(base: GraphRegistry, extension: GraphRegistry): GraphRegistry;
459
-
460
373
  /**
461
374
  * Sandbox module for compiling dynamic registry migration source strings
462
375
  * into executable functions.
@@ -561,6 +474,21 @@ declare function matchScope(scopePath: string, pattern: string): boolean;
561
474
  */
562
475
  declare function matchScopeAny(scopePath: string, patterns: string[]): boolean;
563
476
 
477
+ /**
478
+ * Firegraph serialization tag — split from `src/serialization.ts` so it can
479
+ * be imported from Workers-facing code without dragging in
480
+ * `@google-cloud/firestore`.
481
+ *
482
+ * The full serialization module (with Timestamp/GeoPoint round-tripping)
483
+ * lives one folder up because the sandbox migration pipeline needs it; the
484
+ * write-plan helper only needs to recognise tagged objects to keep them
485
+ * terminal during patch flattening, so it imports just the tag from here.
486
+ */
487
+ /** Sentinel key used to tag serialized Firestore types. */
488
+ declare const SERIALIZATION_TAG: "__firegraph_ser__";
489
+ /** Check if a value is a tagged serialized Firestore type. */
490
+ declare function isTaggedValue(value: unknown): boolean;
491
+
564
492
  /**
565
493
  * Firestore-aware serialization for the sandbox migration pipeline.
566
494
  *
@@ -574,10 +502,6 @@ declare function matchScopeAny(scopePath: string, patterns: string[]): boolean;
574
502
  * (in-memory functions) receive raw Firestore objects directly.
575
503
  */
576
504
 
577
- /** Sentinel key used to tag serialized Firestore types. */
578
- declare const SERIALIZATION_TAG: "__firegraph_ser__";
579
- /** Check if a value is a tagged serialized Firestore type. */
580
- declare function isTaggedValue(value: unknown): boolean;
581
505
  /**
582
506
  * Recursively walk a data object and replace Firestore types with tagged
583
507
  * plain objects suitable for JSON serialization.
@@ -610,4 +534,4 @@ declare function deserializeFirestoreTypes(data: Record<string, unknown>, db?: F
610
534
  */
611
535
  declare function createTraversal(reader: GraphClient | GraphReader, startUid: string, registry?: GraphRegistry): TraversalBuilder;
612
536
 
613
- export { BOOTSTRAP_ENTRIES, DEFAULT_CORE_INDEXES, DEFAULT_QUERY_LIMIT, type DiscoverResult, DiscoveryError, DiscoveryResult, type DiscoveryWarning, DynamicGraphClient, DynamicRegistryConfig, EDGE_TYPE_SCHEMA, type FieldMeta, FindEdgesParams, FindNodesParams, FiregraphError, type FirestoreIndex, type FirestoreIndexConfig, type FirestoreIndexField, type GenerateIndexOptions, GraphClient, GraphClientOptions, GraphReader, GraphRecord, GraphRegistry, IndexSpec, META_EDGE_TYPE, META_NODE_TYPE, MigrationExecutor, MigrationFn, type MigrationResult, MigrationStep, MigrationWriteBack, NODE_TYPE_SCHEMA, QueryFilter, QueryPlan, type QuerySafetyResult, RegistryEntry, SERIALIZATION_TAG, StoredGraphRecord, StoredMigrationStep, TraversalBuilder, analyzeQuerySafety, applyMigrationChain, buildEdgeQueryPlan, buildEdgeRecord, buildNodeQueryPlan, buildNodeRecord, compileMigrationFn, compileMigrations, compileSchema, computeEdgeDocId, computeNodeDocId, createBootstrapRegistry, createGraphClient, createGraphClientFromBackend, createMergedRegistry, createRegistry, createRegistryFromGraph, createTraversal, defaultExecutor, deserializeFirestoreTypes, destroySandboxWorker, discoverEntities, generateDeterministicUid, generateId, generateIndexConfig, isAncestorUid, isTaggedValue, jsonSchemaToFieldMeta, matchScope, matchScopeAny, migrateRecord, migrateRecords, precompileSource, resolveAncestorCollection, serializeFirestoreTypes, validateMigrationChain };
537
+ export { DEFAULT_CORE_INDEXES, DEFAULT_QUERY_LIMIT, type DiscoverResult, DiscoveryError, DiscoveryResult, type DiscoveryWarning, type FieldMeta, FindEdgesParams, FindNodesParams, FiregraphError, type FirestoreIndex, type FirestoreIndexConfig, type FirestoreIndexField, type GenerateIndexOptions, GraphClient, GraphReader, GraphRegistry, IndexSpec, MigrationExecutor, MigrationFn, type MigrationResult, MigrationStep, MigrationWriteBack, QueryFilter, QueryPlan, type QuerySafetyResult, RegistryEntry, SERIALIZATION_TAG, StoredGraphRecord, StoredMigrationStep, TraversalBuilder, analyzeQuerySafety, applyMigrationChain, buildEdgeQueryPlan, buildNodeQueryPlan, compileMigrationFn, compileMigrations, compileSchema, computeEdgeDocId, computeNodeDocId, createTraversal, defaultExecutor, deserializeFirestoreTypes, destroySandboxWorker, discoverEntities, generateIndexConfig, isAncestorUid, isTaggedValue, jsonSchemaToFieldMeta, matchScope, matchScopeAny, migrateRecord, migrateRecords, precompileSource, resolveAncestorCollection, serializeFirestoreTypes, validateMigrationChain };