@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.
- package/README.md +62 -20
- package/dist/backend-CE3pM9-T.d.ts +167 -0
- package/dist/{backend-DuvHGgK1.d.cts → backend-DNzv8KSR.d.cts} +34 -20
- package/dist/{backend-DuvHGgK1.d.ts → backend-DNzv8KSR.d.ts} +34 -20
- package/dist/backend-EjFfw9yO.d.cts +167 -0
- package/dist/backend.cjs.map +1 -1
- package/dist/backend.d.cts +2 -2
- package/dist/backend.d.ts +2 -2
- package/dist/backend.js +1 -1
- package/dist/chunk-5JBNLH5W.js +732 -0
- package/dist/chunk-5JBNLH5W.js.map +1 -0
- package/dist/{chunk-3AHHXMWX.js → chunk-6IO74NKD.js} +23 -44
- package/dist/chunk-6IO74NKD.js.map +1 -0
- package/dist/{chunk-DJI3VXXA.js → chunk-7IEZ6IYY.js} +2 -2
- package/dist/chunk-7IEZ6IYY.js.map +1 -0
- package/dist/chunk-NGAJCALM.js +34 -0
- package/dist/chunk-NGAJCALM.js.map +1 -0
- package/dist/chunk-NZVSLWNY.js +867 -0
- package/dist/chunk-NZVSLWNY.js.map +1 -0
- package/dist/{chunk-N5HFDWQX.js → chunk-PWIO46RT.js} +1 -1
- package/dist/{chunk-N5HFDWQX.js.map → chunk-PWIO46RT.js.map} +1 -1
- package/dist/{client-BKi3vk0Q.d.ts → client-CNAwJayO.d.ts} +1 -1
- package/dist/{client-BrsaXtDV.d.cts → client-CaXH5D5C.d.cts} +1 -1
- package/dist/{client-Bk2Cm6xv.d.cts → client-DoyEdJ5w.d.cts} +1 -1
- package/dist/{client-Bk2Cm6xv.d.ts → client-DoyEdJ5w.d.ts} +1 -1
- package/dist/cloudflare/index.cjs +159 -167
- package/dist/cloudflare/index.cjs.map +1 -1
- package/dist/cloudflare/index.d.cts +73 -70
- package/dist/cloudflare/index.d.ts +73 -70
- package/dist/cloudflare/index.js +54 -589
- package/dist/cloudflare/index.js.map +1 -1
- package/dist/codegen/index.d.cts +1 -1
- package/dist/codegen/index.d.ts +1 -1
- package/dist/firestore-enterprise/index.cjs +11 -9
- package/dist/firestore-enterprise/index.cjs.map +1 -1
- package/dist/firestore-enterprise/index.d.cts +3 -3
- package/dist/firestore-enterprise/index.d.ts +3 -3
- package/dist/firestore-enterprise/index.js +6 -4
- package/dist/firestore-enterprise/index.js.map +1 -1
- package/dist/firestore-standard/index.cjs +11 -9
- package/dist/firestore-standard/index.cjs.map +1 -1
- package/dist/firestore-standard/index.d.cts +3 -3
- package/dist/firestore-standard/index.d.ts +3 -3
- package/dist/firestore-standard/index.js +4 -3
- package/dist/firestore-standard/index.js.map +1 -1
- package/dist/index.cjs +11 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/query-client/index.d.cts +2 -2
- package/dist/query-client/index.d.ts +2 -2
- package/dist/{registry-C2KUPVZj.d.ts → registry-By1i-zge.d.ts} +2 -2
- package/dist/{registry-Bc7h6WTM.d.cts → registry-CNToyEra.d.cts} +2 -2
- package/dist/sqlite/index.cjs +599 -380
- package/dist/sqlite/index.cjs.map +1 -1
- package/dist/sqlite/index.d.cts +4 -110
- package/dist/sqlite/index.d.ts +4 -110
- package/dist/sqlite/index.js +7 -1144
- package/dist/sqlite/index.js.map +1 -1
- package/dist/sqlite/local.cjs +2262 -0
- package/dist/sqlite/local.cjs.map +1 -0
- package/dist/sqlite/local.d.cts +109 -0
- package/dist/sqlite/local.d.ts +109 -0
- package/dist/sqlite/local.js +546 -0
- package/dist/sqlite/local.js.map +1 -0
- package/package.json +15 -1
- package/dist/chunk-3AHHXMWX.js.map +0 -1
- package/dist/chunk-DJI3VXXA.js.map +0 -1
- package/dist/chunk-NNBSUOOF.js +0 -289
- package/dist/chunk-NNBSUOOF.js.map +0 -1
|
@@ -1,22 +1,57 @@
|
|
|
1
|
-
import { W as WritableRecord, f as WriteMode, U as UpdatePayload,
|
|
2
|
-
export {
|
|
1
|
+
import { W as WritableRecord, f as WriteMode, U as UpdatePayload, p as GraphRegistry, I as IndexSpec, Q as QueryFilter, r as QueryOptions, A as AggregateSpec, s as CascadeResult, F as FindEdgesParams, t as BulkOptions, u as BulkResult, b as BulkUpdatePatch, E as ExpandParams, S as StorageBackend, B as BackendCapabilities, o as GraphClient, n as DynamicGraphClient, v as StoredGraphRecord, T as TransactionBackend, a as BatchBackend, q as GraphReader, e as ExpandResult, G as GraphClientOptions, m as DynamicRegistryConfig } from '../backend-DNzv8KSR.cjs';
|
|
2
|
+
export { w as AggregateExtension, x as AggregateField, y as AggregateOp, z as AggregateResult, C as Capability, d as DmlExtension, J as JoinExtension, g as createCapabilities, h as deleteField, j as intersectCapabilities } from '../backend-DNzv8KSR.cjs';
|
|
3
3
|
import { DurableObject } from 'cloudflare:workers';
|
|
4
|
-
export { M as META_EDGE_TYPE, a as META_NODE_TYPE,
|
|
4
|
+
export { M as META_EDGE_TYPE, a as META_NODE_TYPE, c as createMergedRegistry, b as createRegistry, g as generateId } from '../registry-CNToyEra.cjs';
|
|
5
5
|
export { C as CapabilityNotSupportedError } from '../errors-BRc3I_eH.cjs';
|
|
6
6
|
import '@google-cloud/firestore';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* SQL compilation for
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* `QueryFilter[]` shape
|
|
9
|
+
* SQL compilation for SQLite-shaped firegraph backends.
|
|
10
|
+
*
|
|
11
|
+
* One table holds exactly one graph's triples — there is no `scope` column
|
|
12
|
+
* and no scope discriminator on any statement. Subgraph isolation is
|
|
13
|
+
* physical: the shared SQLite backend (`src/sqlite/`) maps each graph to
|
|
14
|
+
* its own table, and the Cloudflare DO backend (`src/cloudflare/`) maps
|
|
15
|
+
* each graph to its own Durable Object. Every compiler in this module is
|
|
16
|
+
* parameterized by the target table name.
|
|
17
|
+
*
|
|
18
|
+
* Filter compilation, JSON-path validation, and value binding are shared so
|
|
19
|
+
* the query planner (`src/query.ts`) emits the same `QueryFilter[]` shape
|
|
20
|
+
* regardless of backend.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Discriminator for one projected column. The decoder uses this to recover
|
|
25
|
+
* the JS-shape of the requested field.
|
|
26
|
+
*/
|
|
27
|
+
type ProjectedColumnKind = 'builtin-text' | 'builtin-int' | 'builtin-timestamp' | 'data' | 'json';
|
|
28
|
+
/** Per-column metadata returned alongside the compiled projection statement. */
|
|
29
|
+
interface ProjectedColumnSpec {
|
|
30
|
+
/** Original caller-supplied field name. Used as the alias in the SQL
|
|
31
|
+
* projection list AND as the key in the returned JS row. */
|
|
32
|
+
field: string;
|
|
33
|
+
/** Kind discriminator — see `ProjectedColumnKind`. */
|
|
34
|
+
kind: ProjectedColumnKind;
|
|
35
|
+
/**
|
|
36
|
+
* For `kind === 'json'` only: alias of the paired `json_type` companion
|
|
37
|
+
* column. Uses a positional sentinel (`__fg_t_<idx>`) keyed by the
|
|
38
|
+
* field's position in the unique projection list rather than the
|
|
39
|
+
* historical `<field>__t` suffix, which would collide if the caller
|
|
40
|
+
* projected both `'foo'` and `'foo__t'` (both legal user input).
|
|
41
|
+
*/
|
|
42
|
+
typeAlias?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* DO RPC wire helpers for the Cloudflare backend.
|
|
47
|
+
*
|
|
48
|
+
* SQL compilation lives in the shared scope-free compiler
|
|
49
|
+
* (`src/internal/sqlite-sql.ts`) — every `FiregraphDO` owns one SQLite
|
|
50
|
+
* database holding exactly one subgraph's triples, the same one-table /
|
|
51
|
+
* one-graph shape the shared SQLite edition uses, so the compilers are
|
|
52
|
+
* identical. This module keeps only what is specific to crossing the DO
|
|
53
|
+
* RPC boundary: the structured-clone-safe record shape and its
|
|
54
|
+
* serialize / hydrate pair.
|
|
20
55
|
*/
|
|
21
56
|
|
|
22
57
|
/**
|
|
@@ -42,30 +77,6 @@ interface DORecordWire {
|
|
|
42
77
|
createdAtMs: number;
|
|
43
78
|
updatedAtMs: number;
|
|
44
79
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Discriminator for one projected column on the DO backend. The decoder
|
|
47
|
-
* uses this to recover the JS-shape of the requested field. Mirrors the
|
|
48
|
-
* shared-SQLite `ProjectedColumnKind` — same kinds, same decode rules. The
|
|
49
|
-
* two share no module so the symbol is duplicated; the contract is locked
|
|
50
|
-
* by the cross-backend test in `tests/unit/cloudflare-sql.test.ts`.
|
|
51
|
-
*/
|
|
52
|
-
type DOProjectedColumnKind = 'builtin-text' | 'builtin-int' | 'builtin-timestamp' | 'data' | 'json';
|
|
53
|
-
/** Per-column metadata returned alongside the compiled projection statement. */
|
|
54
|
-
interface DOProjectedColumnSpec {
|
|
55
|
-
/** Original caller-supplied field name. Used as the alias in the SQL
|
|
56
|
-
* projection list AND as the key in the returned JS row. */
|
|
57
|
-
field: string;
|
|
58
|
-
/** Kind discriminator — see `DOProjectedColumnKind`. */
|
|
59
|
-
kind: DOProjectedColumnKind;
|
|
60
|
-
/**
|
|
61
|
-
* For `kind === 'json'` only: alias of the paired `json_type` companion
|
|
62
|
-
* column. Uses a positional sentinel (`__fg_t_<idx>`) keyed by the
|
|
63
|
-
* field's position in the unique projection list rather than the
|
|
64
|
-
* historical `<field>__t` suffix, which would collide if the caller
|
|
65
|
-
* projected both `'foo'` and `'foo__t'` (both legal user input).
|
|
66
|
-
*/
|
|
67
|
-
typeAlias?: string;
|
|
68
|
-
}
|
|
69
80
|
|
|
70
81
|
/**
|
|
71
82
|
* `FiregraphDO` — the Durable Object class that holds a single subgraph's
|
|
@@ -237,7 +248,7 @@ declare class FiregraphDO extends DurableObject<unknown> {
|
|
|
237
248
|
_fgExpand(params: ExpandParams): Promise<ExpandResultWire>;
|
|
238
249
|
_fgFindEdgesProjected(select: ReadonlyArray<string>, filters: QueryFilter[], options?: QueryOptions): Promise<{
|
|
239
250
|
rows: Array<Record<string, unknown>>;
|
|
240
|
-
columns:
|
|
251
|
+
columns: ProjectedColumnSpec[];
|
|
241
252
|
}>;
|
|
242
253
|
/**
|
|
243
254
|
* Run a DML statement with `RETURNING "doc_id"` so the affected-row count
|
|
@@ -366,7 +377,7 @@ interface FiregraphStub {
|
|
|
366
377
|
*/
|
|
367
378
|
_fgFindEdgesProjected?(select: ReadonlyArray<string>, filters: QueryFilter[], options?: QueryOptions): Promise<{
|
|
368
379
|
rows: Array<Record<string, unknown>>;
|
|
369
|
-
columns:
|
|
380
|
+
columns: ProjectedColumnSpec[];
|
|
370
381
|
}>;
|
|
371
382
|
_fgDestroy(): Promise<void>;
|
|
372
383
|
}
|
|
@@ -703,56 +714,48 @@ declare function createSiblingClient(client: DOGraphClient, siblingRootKey: stri
|
|
|
703
714
|
declare function createSiblingClient(client: DODynamicGraphClient, siblingRootKey: string): DODynamicGraphClient;
|
|
704
715
|
|
|
705
716
|
/**
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
* Each `FiregraphDO` instance owns its own SQLite database and holds exactly
|
|
709
|
-
* one subgraph's triples. Subgraph isolation is physical (one DO per
|
|
710
|
-
* subgraph), so there is no `scope` column — every row in this DO belongs to
|
|
711
|
-
* the same logical scope. This is the Cloudflare-native design: the scope
|
|
712
|
-
* discriminator used by the legacy shared-table SQLite backend
|
|
713
|
-
* (`src/internal/sqlite-schema.ts`) does not exist here.
|
|
717
|
+
* SQLite schema for firegraph triples.
|
|
714
718
|
*
|
|
715
|
-
*
|
|
716
|
-
*
|
|
717
|
-
*
|
|
719
|
+
* Single-table design — both nodes (self-loops with `axbType = 'is'`) and
|
|
720
|
+
* edges share one row shape. Each table holds exactly one graph's triples:
|
|
721
|
+
* subgraph isolation is physical (one table per graph, or one Durable
|
|
722
|
+
* Object per graph on Cloudflare), so there is no `scope` discriminator
|
|
723
|
+
* column. The table a row lives in *is* its scope.
|
|
718
724
|
*
|
|
719
|
-
*
|
|
725
|
+
* `data` is a JSON string. Built-in fields are projected to typed columns so
|
|
726
|
+
* the query planner can use indexes without going through `json_extract`.
|
|
720
727
|
*
|
|
721
|
-
*
|
|
722
|
-
* `FiregraphDOOptions.coreIndexes`.
|
|
723
|
-
* 2. Per-registry-entry `indexes` declared on `RegistryEntry` (from code or
|
|
724
|
-
* `meta.json` via entity discovery).
|
|
728
|
+
* ## Indexes
|
|
725
729
|
*
|
|
726
|
-
*
|
|
727
|
-
*
|
|
728
|
-
*
|
|
730
|
+
* Index specs come from the core preset (overridable via
|
|
731
|
+
* `BuildSchemaOptions.coreIndexes`) plus per-entry `indexes` declared on
|
|
732
|
+
* registry entries. Specs are deduplicated by canonical fingerprint before
|
|
733
|
+
* emission.
|
|
729
734
|
*/
|
|
730
735
|
|
|
731
736
|
/**
|
|
732
|
-
* Options controlling DDL emission for `
|
|
737
|
+
* Options controlling DDL emission for `buildSchemaStatements`.
|
|
733
738
|
*/
|
|
734
|
-
interface
|
|
739
|
+
interface BuildSchemaOptions {
|
|
735
740
|
/**
|
|
736
741
|
* Replaces the built-in core preset. Defaults to `DEFAULT_CORE_INDEXES`.
|
|
737
742
|
* Pass `[]` to disable core indexes entirely.
|
|
738
743
|
*/
|
|
739
744
|
coreIndexes?: IndexSpec[];
|
|
740
745
|
/**
|
|
741
|
-
* Registry contributing per-triple `indexes` declarations.
|
|
742
|
-
* no `indexes` field are ignored; the rest are flattened and deduplicated
|
|
743
|
-
* against the core preset by canonical fingerprint.
|
|
746
|
+
* Registry contributing per-triple `indexes` declarations.
|
|
744
747
|
*/
|
|
745
748
|
registry?: GraphRegistry;
|
|
746
749
|
}
|
|
747
750
|
/**
|
|
748
|
-
* DDL statements that create
|
|
749
|
-
* as separate statements because
|
|
750
|
-
*
|
|
751
|
+
* Build the DDL statements that create one graph's triple table and its
|
|
752
|
+
* indexes. Returned as separate statements because some drivers (D1, DO
|
|
753
|
+
* SQLite's `exec()`) require one statement per call.
|
|
751
754
|
*
|
|
752
755
|
* The CREATE TABLE statement is always first; index statements follow in
|
|
753
756
|
* deterministic order. Same specs across runs produce the same statements,
|
|
754
|
-
* so `CREATE
|
|
757
|
+
* so `CREATE … IF NOT EXISTS` is idempotent.
|
|
755
758
|
*/
|
|
756
|
-
declare function
|
|
759
|
+
declare function buildSchemaStatements(table: string, options?: BuildSchemaOptions): string[];
|
|
757
760
|
|
|
758
|
-
export { AggregateSpec, BackendCapabilities, type BatchOp, type BuildDOSchemaOptions, BulkUpdatePatch, type CloudflareCapability, type DOClientOptions, DORPCBackend, type DORPCBackendOptions, type DOSqlCursor, type DOSqlExecutor, type DOStorage, type DurableObjectIdLike, type DurableObjectStateLike, ExpandParams, ExpandResult, FiregraphDO, type FiregraphDOOptions, type FiregraphNamespace, type FiregraphStub, buildDOSchemaStatements, createDOClient, createSiblingClient };
|
|
761
|
+
export { AggregateSpec, BackendCapabilities, type BatchOp, type BuildSchemaOptions as BuildDOSchemaOptions, BulkUpdatePatch, type CloudflareCapability, type DOClientOptions, DORPCBackend, type DORPCBackendOptions, type DOSqlCursor, type DOSqlExecutor, type DOStorage, type DurableObjectIdLike, type DurableObjectStateLike, ExpandParams, ExpandResult, FiregraphDO, type FiregraphDOOptions, type FiregraphNamespace, type FiregraphStub, buildSchemaStatements as buildDOSchemaStatements, createDOClient, createSiblingClient };
|
|
@@ -1,22 +1,57 @@
|
|
|
1
|
-
import { W as WritableRecord, f as WriteMode, U as UpdatePayload,
|
|
2
|
-
export {
|
|
1
|
+
import { W as WritableRecord, f as WriteMode, U as UpdatePayload, p as GraphRegistry, I as IndexSpec, Q as QueryFilter, r as QueryOptions, A as AggregateSpec, s as CascadeResult, F as FindEdgesParams, t as BulkOptions, u as BulkResult, b as BulkUpdatePatch, E as ExpandParams, S as StorageBackend, B as BackendCapabilities, o as GraphClient, n as DynamicGraphClient, v as StoredGraphRecord, T as TransactionBackend, a as BatchBackend, q as GraphReader, e as ExpandResult, G as GraphClientOptions, m as DynamicRegistryConfig } from '../backend-DNzv8KSR.js';
|
|
2
|
+
export { w as AggregateExtension, x as AggregateField, y as AggregateOp, z as AggregateResult, C as Capability, d as DmlExtension, J as JoinExtension, g as createCapabilities, h as deleteField, j as intersectCapabilities } from '../backend-DNzv8KSR.js';
|
|
3
3
|
import { DurableObject } from 'cloudflare:workers';
|
|
4
|
-
export { M as META_EDGE_TYPE, a as META_NODE_TYPE,
|
|
4
|
+
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';
|
|
5
5
|
export { C as CapabilityNotSupportedError } from '../errors-BRc3I_eH.js';
|
|
6
6
|
import '@google-cloud/firestore';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* SQL compilation for
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* `QueryFilter[]` shape
|
|
9
|
+
* SQL compilation for SQLite-shaped firegraph backends.
|
|
10
|
+
*
|
|
11
|
+
* One table holds exactly one graph's triples — there is no `scope` column
|
|
12
|
+
* and no scope discriminator on any statement. Subgraph isolation is
|
|
13
|
+
* physical: the shared SQLite backend (`src/sqlite/`) maps each graph to
|
|
14
|
+
* its own table, and the Cloudflare DO backend (`src/cloudflare/`) maps
|
|
15
|
+
* each graph to its own Durable Object. Every compiler in this module is
|
|
16
|
+
* parameterized by the target table name.
|
|
17
|
+
*
|
|
18
|
+
* Filter compilation, JSON-path validation, and value binding are shared so
|
|
19
|
+
* the query planner (`src/query.ts`) emits the same `QueryFilter[]` shape
|
|
20
|
+
* regardless of backend.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Discriminator for one projected column. The decoder uses this to recover
|
|
25
|
+
* the JS-shape of the requested field.
|
|
26
|
+
*/
|
|
27
|
+
type ProjectedColumnKind = 'builtin-text' | 'builtin-int' | 'builtin-timestamp' | 'data' | 'json';
|
|
28
|
+
/** Per-column metadata returned alongside the compiled projection statement. */
|
|
29
|
+
interface ProjectedColumnSpec {
|
|
30
|
+
/** Original caller-supplied field name. Used as the alias in the SQL
|
|
31
|
+
* projection list AND as the key in the returned JS row. */
|
|
32
|
+
field: string;
|
|
33
|
+
/** Kind discriminator — see `ProjectedColumnKind`. */
|
|
34
|
+
kind: ProjectedColumnKind;
|
|
35
|
+
/**
|
|
36
|
+
* For `kind === 'json'` only: alias of the paired `json_type` companion
|
|
37
|
+
* column. Uses a positional sentinel (`__fg_t_<idx>`) keyed by the
|
|
38
|
+
* field's position in the unique projection list rather than the
|
|
39
|
+
* historical `<field>__t` suffix, which would collide if the caller
|
|
40
|
+
* projected both `'foo'` and `'foo__t'` (both legal user input).
|
|
41
|
+
*/
|
|
42
|
+
typeAlias?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* DO RPC wire helpers for the Cloudflare backend.
|
|
47
|
+
*
|
|
48
|
+
* SQL compilation lives in the shared scope-free compiler
|
|
49
|
+
* (`src/internal/sqlite-sql.ts`) — every `FiregraphDO` owns one SQLite
|
|
50
|
+
* database holding exactly one subgraph's triples, the same one-table /
|
|
51
|
+
* one-graph shape the shared SQLite edition uses, so the compilers are
|
|
52
|
+
* identical. This module keeps only what is specific to crossing the DO
|
|
53
|
+
* RPC boundary: the structured-clone-safe record shape and its
|
|
54
|
+
* serialize / hydrate pair.
|
|
20
55
|
*/
|
|
21
56
|
|
|
22
57
|
/**
|
|
@@ -42,30 +77,6 @@ interface DORecordWire {
|
|
|
42
77
|
createdAtMs: number;
|
|
43
78
|
updatedAtMs: number;
|
|
44
79
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Discriminator for one projected column on the DO backend. The decoder
|
|
47
|
-
* uses this to recover the JS-shape of the requested field. Mirrors the
|
|
48
|
-
* shared-SQLite `ProjectedColumnKind` — same kinds, same decode rules. The
|
|
49
|
-
* two share no module so the symbol is duplicated; the contract is locked
|
|
50
|
-
* by the cross-backend test in `tests/unit/cloudflare-sql.test.ts`.
|
|
51
|
-
*/
|
|
52
|
-
type DOProjectedColumnKind = 'builtin-text' | 'builtin-int' | 'builtin-timestamp' | 'data' | 'json';
|
|
53
|
-
/** Per-column metadata returned alongside the compiled projection statement. */
|
|
54
|
-
interface DOProjectedColumnSpec {
|
|
55
|
-
/** Original caller-supplied field name. Used as the alias in the SQL
|
|
56
|
-
* projection list AND as the key in the returned JS row. */
|
|
57
|
-
field: string;
|
|
58
|
-
/** Kind discriminator — see `DOProjectedColumnKind`. */
|
|
59
|
-
kind: DOProjectedColumnKind;
|
|
60
|
-
/**
|
|
61
|
-
* For `kind === 'json'` only: alias of the paired `json_type` companion
|
|
62
|
-
* column. Uses a positional sentinel (`__fg_t_<idx>`) keyed by the
|
|
63
|
-
* field's position in the unique projection list rather than the
|
|
64
|
-
* historical `<field>__t` suffix, which would collide if the caller
|
|
65
|
-
* projected both `'foo'` and `'foo__t'` (both legal user input).
|
|
66
|
-
*/
|
|
67
|
-
typeAlias?: string;
|
|
68
|
-
}
|
|
69
80
|
|
|
70
81
|
/**
|
|
71
82
|
* `FiregraphDO` — the Durable Object class that holds a single subgraph's
|
|
@@ -237,7 +248,7 @@ declare class FiregraphDO extends DurableObject<unknown> {
|
|
|
237
248
|
_fgExpand(params: ExpandParams): Promise<ExpandResultWire>;
|
|
238
249
|
_fgFindEdgesProjected(select: ReadonlyArray<string>, filters: QueryFilter[], options?: QueryOptions): Promise<{
|
|
239
250
|
rows: Array<Record<string, unknown>>;
|
|
240
|
-
columns:
|
|
251
|
+
columns: ProjectedColumnSpec[];
|
|
241
252
|
}>;
|
|
242
253
|
/**
|
|
243
254
|
* Run a DML statement with `RETURNING "doc_id"` so the affected-row count
|
|
@@ -366,7 +377,7 @@ interface FiregraphStub {
|
|
|
366
377
|
*/
|
|
367
378
|
_fgFindEdgesProjected?(select: ReadonlyArray<string>, filters: QueryFilter[], options?: QueryOptions): Promise<{
|
|
368
379
|
rows: Array<Record<string, unknown>>;
|
|
369
|
-
columns:
|
|
380
|
+
columns: ProjectedColumnSpec[];
|
|
370
381
|
}>;
|
|
371
382
|
_fgDestroy(): Promise<void>;
|
|
372
383
|
}
|
|
@@ -703,56 +714,48 @@ declare function createSiblingClient(client: DOGraphClient, siblingRootKey: stri
|
|
|
703
714
|
declare function createSiblingClient(client: DODynamicGraphClient, siblingRootKey: string): DODynamicGraphClient;
|
|
704
715
|
|
|
705
716
|
/**
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
* Each `FiregraphDO` instance owns its own SQLite database and holds exactly
|
|
709
|
-
* one subgraph's triples. Subgraph isolation is physical (one DO per
|
|
710
|
-
* subgraph), so there is no `scope` column — every row in this DO belongs to
|
|
711
|
-
* the same logical scope. This is the Cloudflare-native design: the scope
|
|
712
|
-
* discriminator used by the legacy shared-table SQLite backend
|
|
713
|
-
* (`src/internal/sqlite-schema.ts`) does not exist here.
|
|
717
|
+
* SQLite schema for firegraph triples.
|
|
714
718
|
*
|
|
715
|
-
*
|
|
716
|
-
*
|
|
717
|
-
*
|
|
719
|
+
* Single-table design — both nodes (self-loops with `axbType = 'is'`) and
|
|
720
|
+
* edges share one row shape. Each table holds exactly one graph's triples:
|
|
721
|
+
* subgraph isolation is physical (one table per graph, or one Durable
|
|
722
|
+
* Object per graph on Cloudflare), so there is no `scope` discriminator
|
|
723
|
+
* column. The table a row lives in *is* its scope.
|
|
718
724
|
*
|
|
719
|
-
*
|
|
725
|
+
* `data` is a JSON string. Built-in fields are projected to typed columns so
|
|
726
|
+
* the query planner can use indexes without going through `json_extract`.
|
|
720
727
|
*
|
|
721
|
-
*
|
|
722
|
-
* `FiregraphDOOptions.coreIndexes`.
|
|
723
|
-
* 2. Per-registry-entry `indexes` declared on `RegistryEntry` (from code or
|
|
724
|
-
* `meta.json` via entity discovery).
|
|
728
|
+
* ## Indexes
|
|
725
729
|
*
|
|
726
|
-
*
|
|
727
|
-
*
|
|
728
|
-
*
|
|
730
|
+
* Index specs come from the core preset (overridable via
|
|
731
|
+
* `BuildSchemaOptions.coreIndexes`) plus per-entry `indexes` declared on
|
|
732
|
+
* registry entries. Specs are deduplicated by canonical fingerprint before
|
|
733
|
+
* emission.
|
|
729
734
|
*/
|
|
730
735
|
|
|
731
736
|
/**
|
|
732
|
-
* Options controlling DDL emission for `
|
|
737
|
+
* Options controlling DDL emission for `buildSchemaStatements`.
|
|
733
738
|
*/
|
|
734
|
-
interface
|
|
739
|
+
interface BuildSchemaOptions {
|
|
735
740
|
/**
|
|
736
741
|
* Replaces the built-in core preset. Defaults to `DEFAULT_CORE_INDEXES`.
|
|
737
742
|
* Pass `[]` to disable core indexes entirely.
|
|
738
743
|
*/
|
|
739
744
|
coreIndexes?: IndexSpec[];
|
|
740
745
|
/**
|
|
741
|
-
* Registry contributing per-triple `indexes` declarations.
|
|
742
|
-
* no `indexes` field are ignored; the rest are flattened and deduplicated
|
|
743
|
-
* against the core preset by canonical fingerprint.
|
|
746
|
+
* Registry contributing per-triple `indexes` declarations.
|
|
744
747
|
*/
|
|
745
748
|
registry?: GraphRegistry;
|
|
746
749
|
}
|
|
747
750
|
/**
|
|
748
|
-
* DDL statements that create
|
|
749
|
-
* as separate statements because
|
|
750
|
-
*
|
|
751
|
+
* Build the DDL statements that create one graph's triple table and its
|
|
752
|
+
* indexes. Returned as separate statements because some drivers (D1, DO
|
|
753
|
+
* SQLite's `exec()`) require one statement per call.
|
|
751
754
|
*
|
|
752
755
|
* The CREATE TABLE statement is always first; index statements follow in
|
|
753
756
|
* deterministic order. Same specs across runs produce the same statements,
|
|
754
|
-
* so `CREATE
|
|
757
|
+
* so `CREATE … IF NOT EXISTS` is idempotent.
|
|
755
758
|
*/
|
|
756
|
-
declare function
|
|
759
|
+
declare function buildSchemaStatements(table: string, options?: BuildSchemaOptions): string[];
|
|
757
760
|
|
|
758
|
-
export { AggregateSpec, BackendCapabilities, type BatchOp, type BuildDOSchemaOptions, BulkUpdatePatch, type CloudflareCapability, type DOClientOptions, DORPCBackend, type DORPCBackendOptions, type DOSqlCursor, type DOSqlExecutor, type DOStorage, type DurableObjectIdLike, type DurableObjectStateLike, ExpandParams, ExpandResult, FiregraphDO, type FiregraphDOOptions, type FiregraphNamespace, type FiregraphStub, buildDOSchemaStatements, createDOClient, createSiblingClient };
|
|
761
|
+
export { AggregateSpec, BackendCapabilities, type BatchOp, type BuildSchemaOptions as BuildDOSchemaOptions, BulkUpdatePatch, type CloudflareCapability, type DOClientOptions, DORPCBackend, type DORPCBackendOptions, type DOSqlCursor, type DOSqlExecutor, type DOStorage, type DurableObjectIdLike, type DurableObjectStateLike, ExpandParams, ExpandResult, FiregraphDO, type FiregraphDOOptions, type FiregraphNamespace, type FiregraphStub, buildSchemaStatements as buildDOSchemaStatements, createDOClient, createSiblingClient };
|