@typicalday/firegraph 0.7.0 → 0.8.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/chunk-6OQW5OKO.js +110 -0
- package/dist/chunk-6OQW5OKO.js.map +1 -0
- package/dist/chunk-WOAJRVHD.js +699 -0
- package/dist/chunk-WOAJRVHD.js.map +1 -0
- package/dist/chunk-YUXOALMR.js +1653 -0
- package/dist/chunk-YUXOALMR.js.map +1 -0
- package/dist/codegen/index.d.cts +25 -1
- package/dist/codegen/index.d.ts +25 -1
- package/dist/d1.cjs +2416 -0
- package/dist/d1.cjs.map +1 -0
- package/dist/d1.d.cts +54 -0
- package/dist/d1.d.ts +54 -0
- package/dist/d1.js +75 -0
- package/dist/d1.js.map +1 -0
- package/dist/do-sqlite.cjs +2419 -0
- package/dist/do-sqlite.cjs.map +1 -0
- package/dist/do-sqlite.d.cts +41 -0
- package/dist/do-sqlite.d.ts +41 -0
- package/dist/do-sqlite.js +78 -0
- package/dist/do-sqlite.js.map +1 -0
- package/dist/editor/client/assets/{index-BIwgcRWJ.js → index-tyFcX6qG.js} +1 -1
- package/dist/editor/client/index.html +1 -1
- package/dist/editor/server/index.mjs +2054 -1984
- package/dist/index.cjs +2845 -2744
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +345 -233
- package/dist/index.d.ts +345 -233
- package/dist/index.js +710 -2295
- package/dist/index.js.map +1 -1
- package/dist/serialization-C6JNNOCS.js +13 -0
- package/dist/serialization-C6JNNOCS.js.map +1 -0
- package/dist/{index-B9aodfYD.d.cts → types-BVtx9zLv.d.cts} +26 -25
- package/dist/{index-B9aodfYD.d.ts → types-BVtx9zLv.d.ts} +26 -25
- package/package.json +39 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SERIALIZATION_TAG,
|
|
3
|
+
deserializeFirestoreTypes,
|
|
4
|
+
isTaggedValue,
|
|
5
|
+
serializeFirestoreTypes
|
|
6
|
+
} from "./chunk-6OQW5OKO.js";
|
|
7
|
+
export {
|
|
8
|
+
SERIALIZATION_TAG,
|
|
9
|
+
deserializeFirestoreTypes,
|
|
10
|
+
isTaggedValue,
|
|
11
|
+
serializeFirestoreTypes
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=serialization-C6JNNOCS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -104,6 +104,24 @@ declare function defineConfig(config: FiregraphConfig): FiregraphConfig;
|
|
|
104
104
|
*/
|
|
105
105
|
declare function resolveView(resolverConfig: ViewResolverConfig | undefined, availableViewNames: string[], context?: ViewContext): string;
|
|
106
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Backend-agnostic timestamp.
|
|
109
|
+
*
|
|
110
|
+
* Structurally compatible with `@google-cloud/firestore`'s `Timestamp` so
|
|
111
|
+
* that records returned by either the Firestore or SQLite backend can be
|
|
112
|
+
* consumed through the same `StoredGraphRecord` shape.
|
|
113
|
+
*
|
|
114
|
+
* Firestore's native `Timestamp` already satisfies this interface, so
|
|
115
|
+
* existing Firestore consumers see no behavior change. The SQLite backend
|
|
116
|
+
* returns instances of `GraphTimestampImpl` which also satisfies it.
|
|
117
|
+
*/
|
|
118
|
+
interface GraphTimestamp {
|
|
119
|
+
readonly seconds: number;
|
|
120
|
+
readonly nanoseconds: number;
|
|
121
|
+
toDate(): Date;
|
|
122
|
+
toMillis(): number;
|
|
123
|
+
}
|
|
124
|
+
|
|
107
125
|
interface GraphRecord {
|
|
108
126
|
aType: string;
|
|
109
127
|
aUid: string;
|
|
@@ -123,8 +141,13 @@ interface StoredGraphRecord {
|
|
|
123
141
|
bType: string;
|
|
124
142
|
bUid: string;
|
|
125
143
|
data: Record<string, unknown>;
|
|
126
|
-
|
|
127
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Backend-agnostic timestamp. Firestore returns its native `Timestamp`
|
|
146
|
+
* (which structurally satisfies `GraphTimestamp`); the SQLite backends
|
|
147
|
+
* return a `GraphTimestampImpl` instance.
|
|
148
|
+
*/
|
|
149
|
+
createdAt: GraphTimestamp;
|
|
150
|
+
updatedAt: GraphTimestamp;
|
|
128
151
|
/** Schema version — set automatically when the registry entry has migrations. */
|
|
129
152
|
v?: number;
|
|
130
153
|
}
|
|
@@ -618,26 +641,4 @@ interface CascadeResult extends BulkResult {
|
|
|
618
641
|
nodeDeleted: boolean;
|
|
619
642
|
}
|
|
620
643
|
|
|
621
|
-
|
|
622
|
-
* Code generation — produces TypeScript type definitions from JSON Schema
|
|
623
|
-
* files discovered via the entity folder convention.
|
|
624
|
-
*
|
|
625
|
-
* Uses `json-schema-to-typescript` to compile each entity's `schema.json`
|
|
626
|
-
* into a TypeScript interface.
|
|
627
|
-
*
|
|
628
|
-
* Naming convention:
|
|
629
|
-
* - Nodes: `{PascalName}Data` (e.g. `TaskData`)
|
|
630
|
-
* - Edges: `{PascalName}EdgeData` (e.g. `HasStepEdgeData`)
|
|
631
|
-
*/
|
|
632
|
-
|
|
633
|
-
interface CodegenOptions {
|
|
634
|
-
/** Add banner comment at top of output. Defaults to true. */
|
|
635
|
-
banner?: boolean;
|
|
636
|
-
}
|
|
637
|
-
/**
|
|
638
|
-
* Generate TypeScript type definitions from a DiscoveryResult.
|
|
639
|
-
* Returns the full file content as a string.
|
|
640
|
-
*/
|
|
641
|
-
declare function generateTypes(discovery: DiscoveryResult, options?: CodegenOptions): Promise<string>;
|
|
642
|
-
|
|
643
|
-
export { type ScanProtection as A, type BulkBatchError as B, type CascadeResult as C, type DynamicRegistryConfig as D, type EdgeTopology as E, type FindEdgesParams as F, type GraphClientOptions as G, type HopDefinition as H, type TraversalOptions as I, type TraversalResult as J, type ViewDefaultsConfig as K, type ViewResolverConfig as L, type MigrationExecutor as M, type NodeTypeData as N, defineConfig as O, generateTypes as P, type QueryPlan as Q, type RegistryEntry as R, type StoredMigrationStep as S, type TraversalBuilder as T, resolveView as U, type ViewContext as V, type WhereClause as W, type DynamicGraphClient as a, type GraphClient as b, type GraphRegistry as c, type DiscoveryResult as d, type GraphReader as e, type GraphRecord as f, type FindNodesParams as g, type MigrationFn as h, type MigrationStep as i, type StoredGraphRecord as j, type MigrationWriteBack as k, type QueryFilter as l, type BulkOptions as m, type BulkProgress as n, type BulkResult as o, type CodegenOptions as p, type DefineTypeOptions as q, type DiscoveredEntity as r, type EdgeTypeData as s, type FiregraphConfig as t, type GraphBatch as u, type GraphTransaction as v, type GraphWriter as w, type HopResult as x, type QueryMode as y, type QueryOptions as z };
|
|
644
|
+
export { type TraversalOptions as A, type BulkOptions as B, type CascadeResult as C, type DynamicRegistryConfig as D, type EdgeTopology as E, type FindEdgesParams as F, type GraphClientOptions as G, type HopDefinition as H, type TraversalResult as I, type ViewDefaultsConfig as J, type ViewResolverConfig as K, defineConfig as L, type MigrationExecutor as M, type NodeTypeData as N, resolveView as O, type QueryFilter as Q, type RegistryEntry as R, type StoredGraphRecord as S, type TraversalBuilder as T, type ViewContext as V, type WhereClause as W, type DynamicGraphClient as a, type GraphClient as b, type QueryOptions as c, type GraphReader as d, type BulkResult as e, type DiscoveryResult as f, type GraphRegistry as g, type MigrationWriteBack as h, type MigrationStep as i, type QueryPlan as j, type FindNodesParams as k, type GraphRecord as l, type MigrationFn as m, type StoredMigrationStep as n, type BulkBatchError as o, type BulkProgress as p, type DefineTypeOptions as q, type DiscoveredEntity as r, type EdgeTypeData as s, type FiregraphConfig as t, type GraphBatch as u, type GraphTransaction as v, type GraphWriter as w, type HopResult as x, type QueryMode as y, type ScanProtection as z };
|
|
@@ -104,6 +104,24 @@ declare function defineConfig(config: FiregraphConfig): FiregraphConfig;
|
|
|
104
104
|
*/
|
|
105
105
|
declare function resolveView(resolverConfig: ViewResolverConfig | undefined, availableViewNames: string[], context?: ViewContext): string;
|
|
106
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Backend-agnostic timestamp.
|
|
109
|
+
*
|
|
110
|
+
* Structurally compatible with `@google-cloud/firestore`'s `Timestamp` so
|
|
111
|
+
* that records returned by either the Firestore or SQLite backend can be
|
|
112
|
+
* consumed through the same `StoredGraphRecord` shape.
|
|
113
|
+
*
|
|
114
|
+
* Firestore's native `Timestamp` already satisfies this interface, so
|
|
115
|
+
* existing Firestore consumers see no behavior change. The SQLite backend
|
|
116
|
+
* returns instances of `GraphTimestampImpl` which also satisfies it.
|
|
117
|
+
*/
|
|
118
|
+
interface GraphTimestamp {
|
|
119
|
+
readonly seconds: number;
|
|
120
|
+
readonly nanoseconds: number;
|
|
121
|
+
toDate(): Date;
|
|
122
|
+
toMillis(): number;
|
|
123
|
+
}
|
|
124
|
+
|
|
107
125
|
interface GraphRecord {
|
|
108
126
|
aType: string;
|
|
109
127
|
aUid: string;
|
|
@@ -123,8 +141,13 @@ interface StoredGraphRecord {
|
|
|
123
141
|
bType: string;
|
|
124
142
|
bUid: string;
|
|
125
143
|
data: Record<string, unknown>;
|
|
126
|
-
|
|
127
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Backend-agnostic timestamp. Firestore returns its native `Timestamp`
|
|
146
|
+
* (which structurally satisfies `GraphTimestamp`); the SQLite backends
|
|
147
|
+
* return a `GraphTimestampImpl` instance.
|
|
148
|
+
*/
|
|
149
|
+
createdAt: GraphTimestamp;
|
|
150
|
+
updatedAt: GraphTimestamp;
|
|
128
151
|
/** Schema version — set automatically when the registry entry has migrations. */
|
|
129
152
|
v?: number;
|
|
130
153
|
}
|
|
@@ -618,26 +641,4 @@ interface CascadeResult extends BulkResult {
|
|
|
618
641
|
nodeDeleted: boolean;
|
|
619
642
|
}
|
|
620
643
|
|
|
621
|
-
|
|
622
|
-
* Code generation — produces TypeScript type definitions from JSON Schema
|
|
623
|
-
* files discovered via the entity folder convention.
|
|
624
|
-
*
|
|
625
|
-
* Uses `json-schema-to-typescript` to compile each entity's `schema.json`
|
|
626
|
-
* into a TypeScript interface.
|
|
627
|
-
*
|
|
628
|
-
* Naming convention:
|
|
629
|
-
* - Nodes: `{PascalName}Data` (e.g. `TaskData`)
|
|
630
|
-
* - Edges: `{PascalName}EdgeData` (e.g. `HasStepEdgeData`)
|
|
631
|
-
*/
|
|
632
|
-
|
|
633
|
-
interface CodegenOptions {
|
|
634
|
-
/** Add banner comment at top of output. Defaults to true. */
|
|
635
|
-
banner?: boolean;
|
|
636
|
-
}
|
|
637
|
-
/**
|
|
638
|
-
* Generate TypeScript type definitions from a DiscoveryResult.
|
|
639
|
-
* Returns the full file content as a string.
|
|
640
|
-
*/
|
|
641
|
-
declare function generateTypes(discovery: DiscoveryResult, options?: CodegenOptions): Promise<string>;
|
|
642
|
-
|
|
643
|
-
export { type ScanProtection as A, type BulkBatchError as B, type CascadeResult as C, type DynamicRegistryConfig as D, type EdgeTopology as E, type FindEdgesParams as F, type GraphClientOptions as G, type HopDefinition as H, type TraversalOptions as I, type TraversalResult as J, type ViewDefaultsConfig as K, type ViewResolverConfig as L, type MigrationExecutor as M, type NodeTypeData as N, defineConfig as O, generateTypes as P, type QueryPlan as Q, type RegistryEntry as R, type StoredMigrationStep as S, type TraversalBuilder as T, resolveView as U, type ViewContext as V, type WhereClause as W, type DynamicGraphClient as a, type GraphClient as b, type GraphRegistry as c, type DiscoveryResult as d, type GraphReader as e, type GraphRecord as f, type FindNodesParams as g, type MigrationFn as h, type MigrationStep as i, type StoredGraphRecord as j, type MigrationWriteBack as k, type QueryFilter as l, type BulkOptions as m, type BulkProgress as n, type BulkResult as o, type CodegenOptions as p, type DefineTypeOptions as q, type DiscoveredEntity as r, type EdgeTypeData as s, type FiregraphConfig as t, type GraphBatch as u, type GraphTransaction as v, type GraphWriter as w, type HopResult as x, type QueryMode as y, type QueryOptions as z };
|
|
644
|
+
export { type TraversalOptions as A, type BulkOptions as B, type CascadeResult as C, type DynamicRegistryConfig as D, type EdgeTopology as E, type FindEdgesParams as F, type GraphClientOptions as G, type HopDefinition as H, type TraversalResult as I, type ViewDefaultsConfig as J, type ViewResolverConfig as K, defineConfig as L, type MigrationExecutor as M, type NodeTypeData as N, resolveView as O, type QueryFilter as Q, type RegistryEntry as R, type StoredGraphRecord as S, type TraversalBuilder as T, type ViewContext as V, type WhereClause as W, type DynamicGraphClient as a, type GraphClient as b, type QueryOptions as c, type GraphReader as d, type BulkResult as e, type DiscoveryResult as f, type GraphRegistry as g, type MigrationWriteBack as h, type MigrationStep as i, type QueryPlan as j, type FindNodesParams as k, type GraphRecord as l, type MigrationFn as m, type StoredMigrationStep as n, type BulkBatchError as o, type BulkProgress as p, type DefineTypeOptions as q, type DiscoveredEntity as r, type EdgeTypeData as s, type FiregraphConfig as t, type GraphBatch as u, type GraphTransaction as v, type GraphWriter as w, type HopResult as x, type QueryMode as y, type ScanProtection as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typicalday/firegraph",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Generic Firestore adjacency graph client with smart query planning",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -46,6 +46,26 @@
|
|
|
46
46
|
"types": "./dist/query-client/index.d.cts",
|
|
47
47
|
"default": "./dist/query-client/index.cjs"
|
|
48
48
|
}
|
|
49
|
+
},
|
|
50
|
+
"./d1": {
|
|
51
|
+
"import": {
|
|
52
|
+
"types": "./dist/d1.d.ts",
|
|
53
|
+
"default": "./dist/d1.js"
|
|
54
|
+
},
|
|
55
|
+
"require": {
|
|
56
|
+
"types": "./dist/d1.d.cts",
|
|
57
|
+
"default": "./dist/d1.cjs"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"./do-sqlite": {
|
|
61
|
+
"import": {
|
|
62
|
+
"types": "./dist/do-sqlite.d.ts",
|
|
63
|
+
"default": "./dist/do-sqlite.js"
|
|
64
|
+
},
|
|
65
|
+
"require": {
|
|
66
|
+
"types": "./dist/do-sqlite.d.cts",
|
|
67
|
+
"default": "./dist/do-sqlite.cjs"
|
|
68
|
+
}
|
|
49
69
|
}
|
|
50
70
|
},
|
|
51
71
|
"bin": {
|
|
@@ -57,7 +77,11 @@
|
|
|
57
77
|
"skills"
|
|
58
78
|
],
|
|
59
79
|
"scripts": {
|
|
60
|
-
"prepare": "tsup && (npm run build:editor || true)",
|
|
80
|
+
"prepare": "husky && tsup && (npm run build:editor || true)",
|
|
81
|
+
"format": "prettier --write .",
|
|
82
|
+
"format:check": "prettier --check .",
|
|
83
|
+
"lint": "eslint .",
|
|
84
|
+
"lint:fix": "eslint --fix .",
|
|
61
85
|
"build": "tsup",
|
|
62
86
|
"build:editor:client": "cd editor && npx vite build",
|
|
63
87
|
"build:editor:server": "node editor/build-server.mjs",
|
|
@@ -68,6 +92,7 @@
|
|
|
68
92
|
"test": "vitest run",
|
|
69
93
|
"test:unit": "vitest run tests/unit/",
|
|
70
94
|
"test:integration": "vitest run tests/integration/",
|
|
95
|
+
"test:sqlite:integration": "BACKEND=sqlite vitest run tests/integration/",
|
|
71
96
|
"test:emulator": "bash tests/scripts/test-with-emulator.sh",
|
|
72
97
|
"test:emulator:unit": "bash tests/scripts/test-with-emulator.sh tests/unit/",
|
|
73
98
|
"test:emulator:integration": "bash tests/scripts/test-with-emulator.sh tests/integration/",
|
|
@@ -104,9 +129,21 @@
|
|
|
104
129
|
"ses": "^1.15.0"
|
|
105
130
|
},
|
|
106
131
|
"devDependencies": {
|
|
132
|
+
"@commitlint/cli": "^20.5.0",
|
|
133
|
+
"@commitlint/config-conventional": "^20.5.0",
|
|
107
134
|
"@google-cloud/firestore": "^8.3.0",
|
|
135
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
136
|
+
"@typescript-eslint/eslint-plugin": "^8.57.2",
|
|
137
|
+
"@typescript-eslint/parser": "^8.57.2",
|
|
108
138
|
"@vitest/coverage-v8": "^3.0.0",
|
|
139
|
+
"better-sqlite3": "^12.9.0",
|
|
140
|
+
"eslint": "^10.1.0",
|
|
141
|
+
"eslint-config-prettier": "^10.1.8",
|
|
142
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
143
|
+
"husky": "^9.1.7",
|
|
109
144
|
"json-schema-to-typescript": "^15.0.4",
|
|
145
|
+
"lint-staged": "^16.4.0",
|
|
146
|
+
"prettier": "^3.8.1",
|
|
110
147
|
"tsup": "^8.4.0",
|
|
111
148
|
"typescript": "^5.7.0",
|
|
112
149
|
"vitest": "^3.0.0"
|