@typicalday/firegraph 0.12.0 → 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 (70) hide show
  1. package/README.md +317 -73
  2. package/dist/backend-DuvHGgK1.d.cts +1897 -0
  3. package/dist/backend-DuvHGgK1.d.ts +1897 -0
  4. package/dist/backend.cjs +222 -3
  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 +197 -4
  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-D4J7Z4FE.js +67 -0
  15. package/dist/chunk-D4J7Z4FE.js.map +1 -0
  16. package/dist/chunk-N5HFDWQX.js +23 -0
  17. package/dist/chunk-N5HFDWQX.js.map +1 -0
  18. package/dist/chunk-PAD7WFFU.js +573 -0
  19. package/dist/chunk-PAD7WFFU.js.map +1 -0
  20. package/dist/{chunk-AWW4MUJ5.js → chunk-TK64DNVK.js} +12 -1
  21. package/dist/chunk-TK64DNVK.js.map +1 -0
  22. package/dist/{chunk-HONQY4HF.js → chunk-WRTFC5NG.js} +362 -17
  23. package/dist/chunk-WRTFC5NG.js.map +1 -0
  24. package/dist/client-BKi3vk0Q.d.ts +34 -0
  25. package/dist/client-BrsaXtDV.d.cts +34 -0
  26. package/dist/cloudflare/index.cjs +930 -3
  27. package/dist/cloudflare/index.cjs.map +1 -1
  28. package/dist/cloudflare/index.d.cts +213 -12
  29. package/dist/cloudflare/index.d.ts +213 -12
  30. package/dist/cloudflare/index.js +562 -281
  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/errors-BRc3I_eH.d.cts +73 -0
  35. package/dist/errors-BRc3I_eH.d.ts +73 -0
  36. package/dist/firestore-enterprise/index.cjs +3877 -0
  37. package/dist/firestore-enterprise/index.cjs.map +1 -0
  38. package/dist/firestore-enterprise/index.d.cts +141 -0
  39. package/dist/firestore-enterprise/index.d.ts +141 -0
  40. package/dist/firestore-enterprise/index.js +985 -0
  41. package/dist/firestore-enterprise/index.js.map +1 -0
  42. package/dist/firestore-standard/index.cjs +3117 -0
  43. package/dist/firestore-standard/index.cjs.map +1 -0
  44. package/dist/firestore-standard/index.d.cts +49 -0
  45. package/dist/firestore-standard/index.d.ts +49 -0
  46. package/dist/firestore-standard/index.js +283 -0
  47. package/dist/firestore-standard/index.js.map +1 -0
  48. package/dist/index.cjs +590 -550
  49. package/dist/index.cjs.map +1 -1
  50. package/dist/index.d.cts +9 -37
  51. package/dist/index.d.ts +9 -37
  52. package/dist/index.js +178 -555
  53. package/dist/index.js.map +1 -1
  54. package/dist/{registry-Fi074zVa.d.ts → registry-Bc7h6WTM.d.cts} +1 -1
  55. package/dist/{registry-B1qsVL0E.d.cts → registry-C2KUPVZj.d.ts} +1 -1
  56. package/dist/{scope-path-B1G3YiA7.d.cts → scope-path-CROFZGr9.d.cts} +1 -56
  57. package/dist/{scope-path-B1G3YiA7.d.ts → scope-path-CROFZGr9.d.ts} +1 -56
  58. package/dist/sqlite/index.cjs +3631 -0
  59. package/dist/sqlite/index.cjs.map +1 -0
  60. package/dist/sqlite/index.d.cts +111 -0
  61. package/dist/sqlite/index.d.ts +111 -0
  62. package/dist/sqlite/index.js +1164 -0
  63. package/dist/sqlite/index.js.map +1 -0
  64. package/package.json +33 -3
  65. package/dist/backend-BsR0lnFL.d.ts +0 -200
  66. package/dist/backend-Ct-fLlkG.d.cts +0 -200
  67. package/dist/chunk-AWW4MUJ5.js.map +0 -1
  68. package/dist/chunk-HONQY4HF.js.map +0 -1
  69. package/dist/types-DxYLy8Ol.d.cts +0 -770
  70. package/dist/types-DxYLy8Ol.d.ts +0 -770
@@ -0,0 +1,141 @@
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';
3
+ import { Firestore } from '@google-cloud/firestore';
4
+ import { S as StorageBackend } from '../backend-DuvHGgK1.cjs';
5
+
6
+ /**
7
+ * Firestore Enterprise edition `StorageBackend`.
8
+ *
9
+ * The Enterprise edition wires the classic Query API (transactions, single-
10
+ * doc reads/writes, listeners) alongside the Pipelines query engine. Pipeline
11
+ * mode is the default for `query()` outside the emulator; classic mode is
12
+ * always used for transactions and doc-level operations because pipelines
13
+ * have no transactional binding (per Firestore's GA notes — April 2026).
14
+ *
15
+ * Capability declarations target the full Enterprise surface that the
16
+ * shipped `@google-cloud/firestore@8.5.0` SDK exposes typed APIs for:
17
+ * core read/write/transactions/batch/subgraph, `query.aggregate`,
18
+ * `query.select`, `query.join` (via Pipelines `equalAny(field, values)`
19
+ * for single-statement multi-source fan-out), `query.dml` (gated by
20
+ * the opt-in `previewDml` flag — Pipeline `delete()` / `update(...)`
21
+ * stages are `@beta` in 8.5.0; see the per-capability rationale below),
22
+ * `search.vector` (via the classic `findNearest` API for parity with
23
+ * Standard), `search.fullText` (via Pipelines
24
+ * `search({ query: documentMatches(...) })`), `search.geo` (via
25
+ * Pipelines `search({ query: geoDistance(...).lessThanOrEqual(...) })`),
26
+ * and `raw.firestore`. Capabilities that remain fundamentally absent on
27
+ * 8.5.0 — `realtime.listen` — stay undeclared until the SDK exposes an
28
+ * addressable feature. See the comment block above
29
+ * `FirestoreEnterpriseCapability` for the per-capability rationale.
30
+ */
31
+
32
+ /**
33
+ * Capability union declared by the Firestore Enterprise backend.
34
+ *
35
+ * `core.transactions` is included because transactions are still supported
36
+ * via the classic Query API (pipelines themselves are not transactionally
37
+ * bound; the GA notes call this out explicitly). `search.vector` (Phase 8)
38
+ * is implemented via the classic `Query.findNearest(...)` API for parity
39
+ * with the Standard edition — see `findNearest()` below.
40
+ *
41
+ * `search.fullText` and `search.geo` (Phase 12) are implemented via the
42
+ * Pipelines `search(...)` stage exposed in `@google-cloud/firestore@8.5.0`.
43
+ * The 8.5.0 typed surface adds `documentMatches(...)`, `score()`, and
44
+ * `geoDistance(...)` as first-class expressions (all `@beta` and gated to
45
+ * the `Search` stage); the `Pipeline.search(options)` method itself is
46
+ * also first-class. Standard does NOT declare these caps — full-text
47
+ * search and geospatial queries are Enterprise-only product features
48
+ * regardless of SDK shape, so the routing invariant (declared cap ⇒
49
+ * method exists ⇒ index exists) demands that the cap stay edition-gated.
50
+ *
51
+ * Conservative declaration matters here: declaring a capability we don't
52
+ * implement turns the type-level gate (Phase 3) into a lie that throws at
53
+ * runtime instead of failing to compile. The inverse also matters:
54
+ * implementing without declaring leaves the surface accessible only via
55
+ * `as any` casts, which silently bypasses the capability gate.
56
+ *
57
+ * **`query.join` (Phase 13a) is implemented via Pipelines `equalAny`.**
58
+ * Multi-source fan-out collapses to a single round trip:
59
+ * `db.pipeline().collection(path).where(equalAny(sourceField, sources))
60
+ * .execute()`. The shared helper lives at `src/internal/firestore-expand.ts`.
61
+ * The classic Query API caps `'in'` at 30 elements per call, forcing
62
+ * `ceil(N/30)` round trips; pipeline `equalAny(field, values)` accepts
63
+ * an arbitrary list, so a 1k-source fan-out goes from ~34 round trips
64
+ * to one. When `queryMode === 'classic'` (emulator or explicit override),
65
+ * the classic chunked path in `firestore-classic-expand.ts` is used
66
+ * instead — same observable contract, different round-trip profile.
67
+ *
68
+ * **`query.dml` (Phase 13b) is wired through `runFirestorePipelineDelete`
69
+ * and `runFirestorePipelineUpdate` (`src/internal/firestore-bulk-dml.ts`)
70
+ * but is gated by an opt-in `FirestoreEnterpriseOptions.previewDml`
71
+ * flag.** The underlying `Pipeline.delete()` and
72
+ * `Pipeline.update(transformedFields)` stages are `@beta` in
73
+ * `@google-cloud/firestore@8.5.0` (`firestore.d.ts:12647` /
74
+ * `firestore.d.ts:12662`). When `previewDml: true`, the cap is declared
75
+ * and `bulkDelete` / `bulkUpdate` dispatch to single-statement Pipelines
76
+ * stages — same observable contract as SQLite/DO, one round trip per
77
+ * call, no fetch-then-write loop. A one-time `console.warn` fires on
78
+ * backend construction so the `@beta` status is visible. When
79
+ * `previewDml: false` (default), the cap is NOT declared; `bulk.ts`
80
+ * cascade and `client.bulkDelete()` / `client.bulkUpdate()` route
81
+ * through the existing `bulkRemoveEdges` fetch-then-write fallback.
82
+ * SQLite and Cloudflare DO declare `query.dml` unconditionally because
83
+ * their `DELETE … WHERE …` / `UPDATE … SET …` paths are GA, not preview.
84
+ */
85
+ type FirestoreEnterpriseCapability = 'core.read' | 'core.write' | 'core.transactions' | 'core.batch' | 'core.subgraph' | 'query.aggregate' | 'query.select' | 'query.join' | 'query.dml' | 'traversal.serverSide' | 'search.vector' | 'search.fullText' | 'search.geo' | 'raw.firestore';
86
+ type FirestoreEnterpriseQueryMode = 'pipeline' | 'classic';
87
+ interface FirestoreEnterpriseOptions {
88
+ /**
89
+ * Query execution mode for `findEdges` / `findNodes`. `'pipeline'` (the
90
+ * default outside the emulator) routes through the Pipeline query engine;
91
+ * `'classic'` falls back to the Query API. Pipeline-only capabilities
92
+ * (search, aggregate, etc., once implemented) always use pipelines
93
+ * regardless of this option.
94
+ *
95
+ * The emulator does not execute pipeline queries, so this option is
96
+ * forced to `'classic'` whenever `FIRESTORE_EMULATOR_HOST` is set, with
97
+ * a one-time `console.warn` if the caller explicitly asked for pipeline
98
+ * mode.
99
+ */
100
+ defaultQueryMode?: FirestoreEnterpriseQueryMode;
101
+ /**
102
+ * Opt in to Pipelines DML stages (`@beta` in `@google-cloud/firestore@8.5.0`:
103
+ * `Pipeline.delete()` at `firestore.d.ts:12647`,
104
+ * `Pipeline.update(transformedFields)` at `firestore.d.ts:12662`).
105
+ *
106
+ * When `false` (default), this backend does NOT declare `query.dml` and
107
+ * `client.bulkDelete()` / `client.bulkUpdate()` throw
108
+ * `UNSUPPORTED_OPERATION` (or, via `bulk.ts`'s cascade path, fall back
109
+ * to the read-then-write loop in `bulkRemoveEdges`).
110
+ *
111
+ * When `true`, the backend declares `query.dml` and dispatches both
112
+ * methods to single-statement Pipeline stages via
113
+ * `runFirestorePipelineDelete` / `runFirestorePipelineUpdate`. A
114
+ * one-time `console.warn` fires on the first backend created with the
115
+ * flag so the `@beta` status is visible without disrupting tests or
116
+ * production traffic. The flag intentionally has no effect on
117
+ * `defaultQueryMode: 'classic'` — the classic-API path has no DML stage
118
+ * to fall back to, so opting into preview DML in classic mode is a
119
+ * misconfiguration; we accept the flag silently rather than throw to
120
+ * keep the option surface ergonomic across the dual-mode toggle. The
121
+ * routing layer relies on `query.dml` being a structural cap, not a
122
+ * runtime promise — so the cap is still declared even in classic mode,
123
+ * and the methods still dispatch through Pipelines (Pipeline DML works
124
+ * regardless of the read-path `queryMode`).
125
+ */
126
+ previewDml?: boolean;
127
+ /** Internal: the logical scope path inherited from a parent subgraph. */
128
+ scopePath?: string;
129
+ }
130
+ /**
131
+ * Create a Firestore Enterprise-edition `StorageBackend`.
132
+ *
133
+ * Pipeline mode is the default. When `FIRESTORE_EMULATOR_HOST` is set the
134
+ * effective mode is forced to `'classic'` because the emulator does not
135
+ * execute pipelines; if the caller explicitly asked for pipeline mode in
136
+ * that environment, a one-time `console.warn` surfaces the override so
137
+ * the deployment mismatch is visible without breaking the test run.
138
+ */
139
+ declare function createFirestoreEnterpriseBackend(db: Firestore, collectionPath: string, options?: FirestoreEnterpriseOptions): StorageBackend<FirestoreEnterpriseCapability>;
140
+
141
+ export { type FirestoreEnterpriseCapability, type FirestoreEnterpriseOptions, type FirestoreEnterpriseQueryMode, createFirestoreEnterpriseBackend };
@@ -0,0 +1,141 @@
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';
3
+ import { Firestore } from '@google-cloud/firestore';
4
+ import { S as StorageBackend } from '../backend-DuvHGgK1.js';
5
+
6
+ /**
7
+ * Firestore Enterprise edition `StorageBackend`.
8
+ *
9
+ * The Enterprise edition wires the classic Query API (transactions, single-
10
+ * doc reads/writes, listeners) alongside the Pipelines query engine. Pipeline
11
+ * mode is the default for `query()` outside the emulator; classic mode is
12
+ * always used for transactions and doc-level operations because pipelines
13
+ * have no transactional binding (per Firestore's GA notes — April 2026).
14
+ *
15
+ * Capability declarations target the full Enterprise surface that the
16
+ * shipped `@google-cloud/firestore@8.5.0` SDK exposes typed APIs for:
17
+ * core read/write/transactions/batch/subgraph, `query.aggregate`,
18
+ * `query.select`, `query.join` (via Pipelines `equalAny(field, values)`
19
+ * for single-statement multi-source fan-out), `query.dml` (gated by
20
+ * the opt-in `previewDml` flag — Pipeline `delete()` / `update(...)`
21
+ * stages are `@beta` in 8.5.0; see the per-capability rationale below),
22
+ * `search.vector` (via the classic `findNearest` API for parity with
23
+ * Standard), `search.fullText` (via Pipelines
24
+ * `search({ query: documentMatches(...) })`), `search.geo` (via
25
+ * Pipelines `search({ query: geoDistance(...).lessThanOrEqual(...) })`),
26
+ * and `raw.firestore`. Capabilities that remain fundamentally absent on
27
+ * 8.5.0 — `realtime.listen` — stay undeclared until the SDK exposes an
28
+ * addressable feature. See the comment block above
29
+ * `FirestoreEnterpriseCapability` for the per-capability rationale.
30
+ */
31
+
32
+ /**
33
+ * Capability union declared by the Firestore Enterprise backend.
34
+ *
35
+ * `core.transactions` is included because transactions are still supported
36
+ * via the classic Query API (pipelines themselves are not transactionally
37
+ * bound; the GA notes call this out explicitly). `search.vector` (Phase 8)
38
+ * is implemented via the classic `Query.findNearest(...)` API for parity
39
+ * with the Standard edition — see `findNearest()` below.
40
+ *
41
+ * `search.fullText` and `search.geo` (Phase 12) are implemented via the
42
+ * Pipelines `search(...)` stage exposed in `@google-cloud/firestore@8.5.0`.
43
+ * The 8.5.0 typed surface adds `documentMatches(...)`, `score()`, and
44
+ * `geoDistance(...)` as first-class expressions (all `@beta` and gated to
45
+ * the `Search` stage); the `Pipeline.search(options)` method itself is
46
+ * also first-class. Standard does NOT declare these caps — full-text
47
+ * search and geospatial queries are Enterprise-only product features
48
+ * regardless of SDK shape, so the routing invariant (declared cap ⇒
49
+ * method exists ⇒ index exists) demands that the cap stay edition-gated.
50
+ *
51
+ * Conservative declaration matters here: declaring a capability we don't
52
+ * implement turns the type-level gate (Phase 3) into a lie that throws at
53
+ * runtime instead of failing to compile. The inverse also matters:
54
+ * implementing without declaring leaves the surface accessible only via
55
+ * `as any` casts, which silently bypasses the capability gate.
56
+ *
57
+ * **`query.join` (Phase 13a) is implemented via Pipelines `equalAny`.**
58
+ * Multi-source fan-out collapses to a single round trip:
59
+ * `db.pipeline().collection(path).where(equalAny(sourceField, sources))
60
+ * .execute()`. The shared helper lives at `src/internal/firestore-expand.ts`.
61
+ * The classic Query API caps `'in'` at 30 elements per call, forcing
62
+ * `ceil(N/30)` round trips; pipeline `equalAny(field, values)` accepts
63
+ * an arbitrary list, so a 1k-source fan-out goes from ~34 round trips
64
+ * to one. When `queryMode === 'classic'` (emulator or explicit override),
65
+ * the classic chunked path in `firestore-classic-expand.ts` is used
66
+ * instead — same observable contract, different round-trip profile.
67
+ *
68
+ * **`query.dml` (Phase 13b) is wired through `runFirestorePipelineDelete`
69
+ * and `runFirestorePipelineUpdate` (`src/internal/firestore-bulk-dml.ts`)
70
+ * but is gated by an opt-in `FirestoreEnterpriseOptions.previewDml`
71
+ * flag.** The underlying `Pipeline.delete()` and
72
+ * `Pipeline.update(transformedFields)` stages are `@beta` in
73
+ * `@google-cloud/firestore@8.5.0` (`firestore.d.ts:12647` /
74
+ * `firestore.d.ts:12662`). When `previewDml: true`, the cap is declared
75
+ * and `bulkDelete` / `bulkUpdate` dispatch to single-statement Pipelines
76
+ * stages — same observable contract as SQLite/DO, one round trip per
77
+ * call, no fetch-then-write loop. A one-time `console.warn` fires on
78
+ * backend construction so the `@beta` status is visible. When
79
+ * `previewDml: false` (default), the cap is NOT declared; `bulk.ts`
80
+ * cascade and `client.bulkDelete()` / `client.bulkUpdate()` route
81
+ * through the existing `bulkRemoveEdges` fetch-then-write fallback.
82
+ * SQLite and Cloudflare DO declare `query.dml` unconditionally because
83
+ * their `DELETE … WHERE …` / `UPDATE … SET …` paths are GA, not preview.
84
+ */
85
+ type FirestoreEnterpriseCapability = 'core.read' | 'core.write' | 'core.transactions' | 'core.batch' | 'core.subgraph' | 'query.aggregate' | 'query.select' | 'query.join' | 'query.dml' | 'traversal.serverSide' | 'search.vector' | 'search.fullText' | 'search.geo' | 'raw.firestore';
86
+ type FirestoreEnterpriseQueryMode = 'pipeline' | 'classic';
87
+ interface FirestoreEnterpriseOptions {
88
+ /**
89
+ * Query execution mode for `findEdges` / `findNodes`. `'pipeline'` (the
90
+ * default outside the emulator) routes through the Pipeline query engine;
91
+ * `'classic'` falls back to the Query API. Pipeline-only capabilities
92
+ * (search, aggregate, etc., once implemented) always use pipelines
93
+ * regardless of this option.
94
+ *
95
+ * The emulator does not execute pipeline queries, so this option is
96
+ * forced to `'classic'` whenever `FIRESTORE_EMULATOR_HOST` is set, with
97
+ * a one-time `console.warn` if the caller explicitly asked for pipeline
98
+ * mode.
99
+ */
100
+ defaultQueryMode?: FirestoreEnterpriseQueryMode;
101
+ /**
102
+ * Opt in to Pipelines DML stages (`@beta` in `@google-cloud/firestore@8.5.0`:
103
+ * `Pipeline.delete()` at `firestore.d.ts:12647`,
104
+ * `Pipeline.update(transformedFields)` at `firestore.d.ts:12662`).
105
+ *
106
+ * When `false` (default), this backend does NOT declare `query.dml` and
107
+ * `client.bulkDelete()` / `client.bulkUpdate()` throw
108
+ * `UNSUPPORTED_OPERATION` (or, via `bulk.ts`'s cascade path, fall back
109
+ * to the read-then-write loop in `bulkRemoveEdges`).
110
+ *
111
+ * When `true`, the backend declares `query.dml` and dispatches both
112
+ * methods to single-statement Pipeline stages via
113
+ * `runFirestorePipelineDelete` / `runFirestorePipelineUpdate`. A
114
+ * one-time `console.warn` fires on the first backend created with the
115
+ * flag so the `@beta` status is visible without disrupting tests or
116
+ * production traffic. The flag intentionally has no effect on
117
+ * `defaultQueryMode: 'classic'` — the classic-API path has no DML stage
118
+ * to fall back to, so opting into preview DML in classic mode is a
119
+ * misconfiguration; we accept the flag silently rather than throw to
120
+ * keep the option surface ergonomic across the dual-mode toggle. The
121
+ * routing layer relies on `query.dml` being a structural cap, not a
122
+ * runtime promise — so the cap is still declared even in classic mode,
123
+ * and the methods still dispatch through Pipelines (Pipeline DML works
124
+ * regardless of the read-path `queryMode`).
125
+ */
126
+ previewDml?: boolean;
127
+ /** Internal: the logical scope path inherited from a parent subgraph. */
128
+ scopePath?: string;
129
+ }
130
+ /**
131
+ * Create a Firestore Enterprise-edition `StorageBackend`.
132
+ *
133
+ * Pipeline mode is the default. When `FIRESTORE_EMULATOR_HOST` is set the
134
+ * effective mode is forced to `'classic'` because the emulator does not
135
+ * execute pipelines; if the caller explicitly asked for pipeline mode in
136
+ * that environment, a one-time `console.warn` surfaces the override so
137
+ * the deployment mismatch is visible without breaking the test run.
138
+ */
139
+ declare function createFirestoreEnterpriseBackend(db: Firestore, collectionPath: string, options?: FirestoreEnterpriseOptions): StorageBackend<FirestoreEnterpriseCapability>;
140
+
141
+ export { type FirestoreEnterpriseCapability, type FirestoreEnterpriseOptions, type FirestoreEnterpriseQueryMode, createFirestoreEnterpriseBackend };