@nicia-ai/typegraph 0.47.0 → 0.48.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/backend/drizzle/indexes.d.cts +1 -1
- package/dist/backend/drizzle/indexes.d.ts +1 -1
- package/dist/backend/index.cjs +27 -19
- package/dist/backend/index.d.cts +37 -55
- package/dist/backend/index.d.ts +37 -55
- package/dist/backend/index.js +4 -4
- package/dist/backend/postgres/index.cjs +7 -7
- package/dist/backend/postgres/index.d.cts +21 -7
- package/dist/backend/postgres/index.d.ts +21 -7
- package/dist/backend/postgres/index.js +6 -6
- package/dist/backend/postgres/pglite-store.cjs +17 -17
- package/dist/backend/postgres/pglite-store.d.cts +8 -8
- package/dist/backend/postgres/pglite-store.d.ts +8 -8
- package/dist/backend/postgres/pglite-store.js +14 -14
- package/dist/backend/postgres/pglite.cjs +8 -8
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +7 -7
- package/dist/backend/sqlite/index.cjs +7 -7
- package/dist/backend/sqlite/index.d.cts +20 -7
- package/dist/backend/sqlite/index.d.ts +20 -7
- package/dist/backend/sqlite/index.js +6 -6
- package/dist/backend/sqlite/libsql.cjs +8 -8
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +6 -6
- package/dist/backend/sqlite/local-store.cjs +18 -18
- package/dist/backend/sqlite/local-store.d.cts +8 -8
- package/dist/backend/sqlite/local-store.d.ts +8 -8
- package/dist/backend/sqlite/local-store.js +15 -15
- package/dist/backend/sqlite/local.cjs +9 -9
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +7 -7
- package/dist/{chunk-EMIB2RXD.cjs → chunk-2HIYYMWY.cjs} +99 -96
- package/dist/chunk-2HIYYMWY.cjs.map +1 -0
- package/dist/{chunk-6KFLYYOC.cjs → chunk-2QGYQBS2.cjs} +5 -5
- package/dist/{chunk-6KFLYYOC.cjs.map → chunk-2QGYQBS2.cjs.map} +1 -1
- package/dist/{chunk-5FT3TLPK.js → chunk-2SYZXD54.js} +16 -13
- package/dist/chunk-2SYZXD54.js.map +1 -0
- package/dist/{chunk-XYBQI6LE.js → chunk-2TYSSBU5.js} +6 -6
- package/dist/{chunk-XYBQI6LE.js.map → chunk-2TYSSBU5.js.map} +1 -1
- package/dist/{chunk-6JVZSOHQ.cjs → chunk-3FPR224C.cjs} +26 -26
- package/dist/{chunk-6JVZSOHQ.cjs.map → chunk-3FPR224C.cjs.map} +1 -1
- package/dist/{chunk-MFZR4QKM.cjs → chunk-3KOY4FH3.cjs} +181 -4
- package/dist/chunk-3KOY4FH3.cjs.map +1 -0
- package/dist/{chunk-6FWSNSRE.js → chunk-4WMMBDS5.js} +4 -4
- package/dist/chunk-4WMMBDS5.js.map +1 -0
- package/dist/{chunk-NG2RB5WL.js → chunk-5K2BKEBD.js} +18 -3
- package/dist/chunk-5K2BKEBD.js.map +1 -0
- package/dist/chunk-5PRKMB24.cjs +124 -0
- package/dist/chunk-5PRKMB24.cjs.map +1 -0
- package/dist/chunk-6LN7FIVU.js +107 -0
- package/dist/chunk-6LN7FIVU.js.map +1 -0
- package/dist/{chunk-I4G3SQPF.cjs → chunk-7XUYFFR4.cjs} +7 -7
- package/dist/chunk-7XUYFFR4.cjs.map +1 -0
- package/dist/{chunk-KH7XW7VV.js → chunk-ACGSAMD3.js} +24 -27
- package/dist/chunk-ACGSAMD3.js.map +1 -0
- package/dist/{chunk-QS3NQZVC.js → chunk-AX6JGVTZ.js} +16 -11
- package/dist/chunk-AX6JGVTZ.js.map +1 -0
- package/dist/{chunk-DJZTXBWY.js → chunk-BRRP76WO.js} +71 -30
- package/dist/chunk-BRRP76WO.js.map +1 -0
- package/dist/{chunk-5UMTUOM5.js → chunk-CT3ZKTOF.js} +5 -4
- package/dist/chunk-CT3ZKTOF.js.map +1 -0
- package/dist/{chunk-XY5OMOJD.js → chunk-DZAICA5J.js} +3 -3
- package/dist/{chunk-XY5OMOJD.js.map → chunk-DZAICA5J.js.map} +1 -1
- package/dist/{chunk-OIFSOPSR.cjs → chunk-EZEEWCFJ.cjs} +38 -156
- package/dist/chunk-EZEEWCFJ.cjs.map +1 -0
- package/dist/{chunk-AMMWA76F.cjs → chunk-FA2AFWLP.cjs} +6 -6
- package/dist/{chunk-AMMWA76F.cjs.map → chunk-FA2AFWLP.cjs.map} +1 -1
- package/dist/{chunk-FNOMT74T.js → chunk-I4GAZH5Z.js} +180 -5
- package/dist/chunk-I4GAZH5Z.js.map +1 -0
- package/dist/{chunk-WGX7JH7E.cjs → chunk-JB6T4GLL.cjs} +106 -134
- package/dist/chunk-JB6T4GLL.cjs.map +1 -0
- package/dist/{chunk-MX4DHSQP.cjs → chunk-JFRT7S3B.cjs} +92 -98
- package/dist/chunk-JFRT7S3B.cjs.map +1 -0
- package/dist/{chunk-SE6EGQSD.js → chunk-KF6K7TGH.js} +38 -66
- package/dist/chunk-KF6K7TGH.js.map +1 -0
- package/dist/{chunk-ZHNXLS3C.js → chunk-NACVVDWB.js} +208 -8
- package/dist/chunk-NACVVDWB.js.map +1 -0
- package/dist/{chunk-M35DF33T.js → chunk-OD4SSY2U.js} +29 -16
- package/dist/chunk-OD4SSY2U.js.map +1 -0
- package/dist/{chunk-U5EDAVOJ.cjs → chunk-OTUPEF2W.cjs} +54 -49
- package/dist/chunk-OTUPEF2W.cjs.map +1 -0
- package/dist/{chunk-BCQ76AXA.cjs → chunk-PFBRJBUL.cjs} +107 -94
- package/dist/chunk-PFBRJBUL.cjs.map +1 -0
- package/dist/{chunk-AVGUJWVX.js → chunk-S5TERQVW.js} +15 -132
- package/dist/chunk-S5TERQVW.js.map +1 -0
- package/dist/chunk-SIT26LAZ.cjs +614 -0
- package/dist/chunk-SIT26LAZ.cjs.map +1 -0
- package/dist/{chunk-BR7SHKGM.cjs → chunk-SR725PWF.cjs} +548 -507
- package/dist/chunk-SR725PWF.cjs.map +1 -0
- package/dist/{chunk-5FBRVORR.cjs → chunk-TKZXMWQF.cjs} +8 -7
- package/dist/chunk-TKZXMWQF.cjs.map +1 -0
- package/dist/{chunk-425IZOQ5.cjs → chunk-TQHGE7UC.cjs} +20 -2
- package/dist/chunk-TQHGE7UC.cjs.map +1 -0
- package/dist/{chunk-GYUJZARH.cjs → chunk-TUNPBZY3.cjs} +4 -4
- package/dist/{chunk-GYUJZARH.cjs.map → chunk-TUNPBZY3.cjs.map} +1 -1
- package/dist/chunk-UGHG7PGX.js +592 -0
- package/dist/chunk-UGHG7PGX.js.map +1 -0
- package/dist/{chunk-KABFHAL7.cjs → chunk-UMGZDVOA.cjs} +213 -12
- package/dist/chunk-UMGZDVOA.cjs.map +1 -0
- package/dist/{chunk-UPAJHMW3.cjs → chunk-WCCATHMB.cjs} +54 -57
- package/dist/chunk-WCCATHMB.cjs.map +1 -0
- package/dist/{chunk-LEWHMOUY.js → chunk-YIURNGXI.js} +4 -4
- package/dist/{chunk-LEWHMOUY.js.map → chunk-YIURNGXI.js.map} +1 -1
- package/dist/{chunk-EP4RUYD6.js → chunk-YVF2EM7B.js} +3 -3
- package/dist/{chunk-EP4RUYD6.js.map → chunk-YVF2EM7B.js.map} +1 -1
- package/dist/{chunk-NNQ6A3RM.js → chunk-ZFMCDJGB.js} +7 -12
- package/dist/chunk-ZFMCDJGB.js.map +1 -0
- package/dist/core/index.cjs +6 -6
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +2 -2
- package/dist/ddl-BL1NZLMY.d.cts +78 -0
- package/dist/ddl-D_oW-EVO.d.ts +78 -0
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-merge/index.cjs +334 -191
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +65 -15
- package/dist/graph-merge/index.d.ts +65 -15
- package/dist/graph-merge/index.js +174 -32
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-CHTv4XMZ.d.cts → index-COs_z6nV.d.cts} +2 -2
- package/dist/{index-CzoJ3MUw.d.ts → index-D7d1u2gr.d.ts} +2 -2
- package/dist/index.cjs +90 -86
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +13 -13
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/interchange/index.cjs +38 -38
- package/dist/interchange/index.d.cts +7 -7
- package/dist/interchange/index.d.ts +7 -7
- package/dist/interchange/index.js +10 -10
- package/dist/{manager-DlY1vlla.d.cts → manager-CYaff3n3.d.cts} +2 -2
- package/dist/{manager-B6sOQzcQ.d.ts → manager-D9eRT_ns.d.ts} +2 -2
- package/dist/{materialize-indexes-DQL4xcpf.d.ts → materialize-indexes-DJ3ykH59.d.ts} +1 -1
- package/dist/{materialize-indexes-sskhp-c_.d.cts → materialize-indexes-DTtAnvfY.d.cts} +1 -1
- package/dist/{postgres-BXy_nyMs.d.cts → postgres-CcL4bAHS.d.ts} +1 -1
- package/dist/{postgres-B6YOUcaK.d.ts → postgres-DMj39MEu.d.cts} +1 -1
- package/dist/profiler/index.d.cts +9 -9
- package/dist/profiler/index.d.ts +9 -9
- package/dist/provenance/index.cjs +25 -26
- package/dist/provenance/index.cjs.map +1 -1
- package/dist/provenance/index.d.cts +7 -7
- package/dist/provenance/index.d.ts +7 -7
- package/dist/provenance/index.js +9 -10
- package/dist/provenance/index.js.map +1 -1
- package/dist/repair-validity-windows-BFNZvd_H.d.cts +166 -0
- package/dist/repair-validity-windows-DlUSqwCg.d.ts +166 -0
- package/dist/schema/index.cjs +35 -35
- package/dist/schema/index.d.cts +6 -6
- package/dist/schema/index.d.ts +6 -6
- package/dist/schema/index.js +8 -8
- package/dist/{searchable-D9gMiwcS.d.ts → searchable-DHJMh_nj.d.cts} +1 -1
- package/dist/{searchable-0Cn_lY8U.d.cts → searchable-bpE1bBfc.d.ts} +1 -1
- package/dist/{sqlite-DioSxaPe.d.cts → sqlite-D7Oz0SQh.d.ts} +1 -1
- package/dist/{sqlite-ClXuBYAj.d.ts → sqlite-YppHrNFb.d.cts} +1 -1
- package/dist/{store-5j-w5onJ.d.ts → store-JUVvtmR4.d.cts} +113 -26
- package/dist/{store-CFedKGU5.d.cts → store-UzrGvZOo.d.ts} +113 -26
- package/dist/{temporal-CjO9FH1l.d.ts → temporal-5GqpYCk2.d.cts} +1 -1
- package/dist/{temporal-Ce1pG0S1.d.cts → temporal-CbnLzTmM.d.ts} +1 -1
- package/dist/{types-DKkMJZjR.d.cts → types-BqFZTQmV.d.cts} +29 -4
- package/dist/{types-DKkMJZjR.d.ts → types-BqFZTQmV.d.ts} +29 -4
- package/dist/{types-BrdOFu48.d.ts → types-Bx74kaTt.d.ts} +1 -1
- package/dist/{types-oj_OGAaZ.d.cts → types-CXAhpW-c.d.cts} +1 -1
- package/dist/{where-D1wKCJ4Q.d.cts → where-DI_Fqz-X.d.cts} +1 -1
- package/dist/{where-C8w2627G.d.ts → where-O-k2wgYm.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-3HGRTCDU.cjs +0 -269
- package/dist/chunk-3HGRTCDU.cjs.map +0 -1
- package/dist/chunk-425IZOQ5.cjs.map +0 -1
- package/dist/chunk-5FBRVORR.cjs.map +0 -1
- package/dist/chunk-5FT3TLPK.js.map +0 -1
- package/dist/chunk-5UMTUOM5.js.map +0 -1
- package/dist/chunk-6FWSNSRE.js.map +0 -1
- package/dist/chunk-AVGUJWVX.js.map +0 -1
- package/dist/chunk-BCQ76AXA.cjs.map +0 -1
- package/dist/chunk-BR7SHKGM.cjs.map +0 -1
- package/dist/chunk-DJZTXBWY.js.map +0 -1
- package/dist/chunk-EMIB2RXD.cjs.map +0 -1
- package/dist/chunk-FNOMT74T.js.map +0 -1
- package/dist/chunk-I4G3SQPF.cjs.map +0 -1
- package/dist/chunk-JR6SX5RH.cjs +0 -268
- package/dist/chunk-JR6SX5RH.cjs.map +0 -1
- package/dist/chunk-KABFHAL7.cjs.map +0 -1
- package/dist/chunk-KH7XW7VV.js.map +0 -1
- package/dist/chunk-M35DF33T.js.map +0 -1
- package/dist/chunk-MFZR4QKM.cjs.map +0 -1
- package/dist/chunk-MX4DHSQP.cjs.map +0 -1
- package/dist/chunk-NAZ2RA4L.js +0 -254
- package/dist/chunk-NAZ2RA4L.js.map +0 -1
- package/dist/chunk-NG2RB5WL.js.map +0 -1
- package/dist/chunk-NNQ6A3RM.js.map +0 -1
- package/dist/chunk-OIFSOPSR.cjs.map +0 -1
- package/dist/chunk-QS3NQZVC.js.map +0 -1
- package/dist/chunk-SE6EGQSD.js.map +0 -1
- package/dist/chunk-SHSSRCFR.js +0 -246
- package/dist/chunk-SHSSRCFR.js.map +0 -1
- package/dist/chunk-U5EDAVOJ.cjs.map +0 -1
- package/dist/chunk-UPAJHMW3.cjs.map +0 -1
- package/dist/chunk-WGX7JH7E.cjs.map +0 -1
- package/dist/chunk-ZHNXLS3C.js.map +0 -1
- package/dist/ddl-CprnMXJ-.d.ts +0 -38
- package/dist/ddl-DJA7Lci5.d.cts +0 -38
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { createPostgresBackend } from './chunk-
|
|
1
|
+
import { createPostgresBackend } from './chunk-OD4SSY2U.js';
|
|
2
2
|
import { tables, generatePostgresMigrationSQL, generatePostgresDDL } from './chunk-6SWPJEYN.js';
|
|
3
|
-
import { wrapWithManagedClose
|
|
3
|
+
import { wrapWithManagedClose } from './chunk-UGHG7PGX.js';
|
|
4
|
+
import { closeAfterFailure } from './chunk-6LN7FIVU.js';
|
|
4
5
|
import { ConfigurationError } from './chunk-ZLONH2UD.js';
|
|
5
6
|
import { PGlite } from '@electric-sql/pglite';
|
|
6
7
|
import { drizzle } from 'drizzle-orm/pglite';
|
|
@@ -43,5 +44,5 @@ async function createLocalPgliteBackend(options = {}) {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
export { createLocalPgliteBackend };
|
|
46
|
-
//# sourceMappingURL=chunk-
|
|
47
|
-
//# sourceMappingURL=chunk-
|
|
47
|
+
//# sourceMappingURL=chunk-CT3ZKTOF.js.map
|
|
48
|
+
//# sourceMappingURL=chunk-CT3ZKTOF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/backend/postgres/pglite.ts"],"names":["tables"],"mappings":";;;;;;;;AAqIA,eAAe,4BAAA,GAAmD;AAChE,EAAA,IAAI;AACF,IAAA,MAAM,OAAA,GAAU,MAAM,OAAO,+BAA+B,CAAA;AAC5D,IAAA,OAAO,OAAA,CAAQ,MAAA;AAAA,EACjB,SAAS,KAAA,EAAO;AACd,IAAA,MAAM,IAAI,kBAAA;AAAA,MACR,2PAAA;AAAA,MAIA,EAAE,OAAA,EAAS,QAAA,EAAU,UAAA,EAAY,+BAAA,EAAgC;AAAA,MACjE,EAAE,OAAO,KAAA;AAAM,KACjB;AAAA,EACF;AACF;AAoBA,eAAsB,wBAAA,CACpB,OAAA,GAAqC,EAAC,EACH;AACnC,EAAA,MAAMA,OAAAA,GAAS,QAAQ,MAAA,IAAU,MAAA;AAMjC,EAAA,MAAM,eAAA,GACJ,QAAQ,MAAA,KAAW,KAAA,GACjB,SACC,OAAA,CAAQ,MAAA,IAAW,MAAM,4BAAA,EAA6B;AAC3D,EAAA,MAAM,gBAAgB,eAAA,KAAoB,MAAA;AAO1C,EAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,MAAA,CAAO;AAAA,IACjC,GAAI,QAAQ,OAAA,KAAY,MAAA,GAAY,EAAC,GAAI,EAAE,OAAA,EAAS,OAAA,CAAQ,OAAA,EAAQ;AAAA,IACpE,GAAI,eAAA,KAAoB,MAAA,GACtB,EAAC,GACD,EAAE,UAAA,EAAY,EAAE,MAAA,EAAQ,eAAA,EAAgB;AAAE,GAC7C,CAAA;AAED,EAAA,IAAI;AAGF,IAAA,MAAM,YAAA,GACJ,gBACE,4BAAA,CAA6BA,OAAM,IACnC,mBAAA,CAAoBA,OAAM,CAAA,CAAE,IAAA,CAAK,MAAM,CAAA;AAC3C,IAAA,MAAM,MAAA,CAAO,KAAK,YAAY,CAAA;AAE9B,IAAA,MAAM,EAAA,GAAK,QAAQ,MAAM,CAAA;AACzB,IAAA,MAAM,OAAA,GAAU,sBAAsB,EAAA,EAAI;AAAA,MACxC,MAAA,EAAAA,OAAAA;AAAA,MACA,GAAI,aAAA,GAAgB,EAAC,GAAI,EAAE,QAAQ,KAAA;AAAM,KAC1C,CAAA;AACD,IAAA,MAAM,cAAA,GAAiB,oBAAA,CAAqB,OAAA,EAAS,YAAY;AAC/D,MAAA,MAAM,OAAO,KAAA,EAAM;AAAA,IACrB,CAAC,CAAA;AAED,IAAA,OAAO,EAAE,OAAA,EAAS,cAAA,EAAgB,EAAA,EAAI,MAAA,EAAO;AAAA,EAC/C,SAAS,KAAA,EAAO;AACd,IAAA,OAAO,iBAAA,CAAkB,QAAQ,KAAK,CAAA;AAAA,EACxC;AACF","file":"chunk-CT3ZKTOF.js","sourcesContent":["/**\n * Local PGlite backend — Postgres-in-WASM, running in-process.\n *\n * [PGlite](https://pglite.dev/) is a full Postgres compiled to WebAssembly\n * that runs inside the Node/Bun/Deno/browser process with no server and no\n * native addon. This is the batteries-included Postgres analog of\n * `createLocalSqliteBackend`: it constructs a PGlite instance, loads the\n * pgvector extension, runs the schema DDL, and returns a ready\n * `{ backend, db }` pair whose `close()` disposes the engine.\n *\n * `@electric-sql/pglite` is an optional peer dependency. Vector support\n * additionally needs `@electric-sql/pglite-pgvector` (PGlite ≥ 0.5 ships\n * pgvector as a separate package). Install what you need:\n *\n * ```bash\n * pnpm add @electric-sql/pglite @electric-sql/pglite-pgvector\n * ```\n *\n * @example In-memory database (default, vector enabled)\n * ```typescript\n * import { createLocalPgliteBackend } from \"@nicia-ai/typegraph/adapters/drizzle/postgres/pglite\";\n *\n * const { backend } = await createLocalPgliteBackend();\n * const store = createStore(graph, backend);\n * ```\n *\n * @example Persistent on-disk database\n * ```typescript\n * const { backend, db } = await createLocalPgliteBackend({ dataDir: \"./pgdata\" });\n * ```\n *\n * @example No vector support (skip the pgvector extension)\n * ```typescript\n * const { backend } = await createLocalPgliteBackend({ vector: false });\n * ```\n *\n * PGlite is single-connection and serial: there is no pooling, so concurrent\n * `store.transaction()` calls queue rather than run in parallel.\n */\nimport { type Extension, PGlite } from \"@electric-sql/pglite\";\nimport { drizzle, type PgliteDatabase } from \"drizzle-orm/pglite\";\n\nimport { ConfigurationError } from \"../../errors\";\nimport { wrapWithManagedClose } from \"../derive-backend\";\nexport type { GraphIdentityConfig } from \"../../core/define-graph\";\nimport {\n generatePostgresDDL,\n generatePostgresMigrationSQL,\n} from \"../drizzle/ddl\";\nimport { type AnyPgTransaction } from \"../drizzle/execution\";\nexport type { AnyPgDatabase, AnyPgTransaction } from \"../drizzle/execution\";\nimport {\n createPostgresBackend,\n type PostgresTables,\n tables as defaultTables,\n} from \"../drizzle/postgres\";\nimport { type AdapterBackend, closeAfterFailure } from \"../types\";\nexport type {\n ContributionDiagnostic,\n ContributionDiagnosticState,\n ContributionRepairEntry,\n ContributionRepairResult,\n} from \"../types\";\n\n// ============================================================\n// Types\n// ============================================================\n\n/**\n * Options for creating a local PGlite backend.\n */\nexport type LocalPgliteBackendOptions = Readonly<{\n /**\n * PGlite data directory. Omit for an in-memory database (the default).\n * Accepts any PGlite data-dir spec: a filesystem path (`\"./pgdata\"`),\n * `\"memory://\"`, or a browser/runtime-specific scheme such as\n * `\"idb://my-db\"`.\n */\n dataDir?: string;\n\n /**\n * Custom table definitions. Defaults to standard TypeGraph table names.\n */\n tables?: PostgresTables;\n\n /**\n * Controls the pgvector stack:\n *\n * - **omitted (default)** — load pgvector from `@electric-sql/pglite-pgvector`\n * and run `CREATE EXTENSION vector`, so embedding fields work out of the\n * box. Throws a {@link ConfigurationError} if the package isn't installed.\n * - **`false`** — skip the extension entirely; the backend advertises no\n * vector capability (mirroring a SQLite connection without sqlite-vec).\n * Use when a graph carries no embeddings, or to avoid the extension dep.\n * - **a PGlite `Extension`** — bring your own pgvector build or custom\n * extension packaging. Decouples this helper from a specific pgvector\n * package version.\n */\n vector?: false | Extension;\n}>;\n\n/**\n * Result of creating a local PGlite backend.\n */\nexport type LocalPgliteBackendResult = Readonly<{\n /**\n * The GraphBackend instance for use with createStore. Its `close()`\n * disposes the underlying PGlite engine.\n */\n backend: AdapterBackend<AnyPgTransaction>;\n\n /**\n * The underlying Drizzle database instance. Useful for direct SQL access.\n */\n db: PgliteDatabase;\n\n /**\n * The raw PGlite instance, for engine-specific operations such as\n * `dumpDataDir()` / `clone()` not surfaced through Drizzle.\n */\n client: PGlite;\n}>;\n\n// ============================================================\n// Vector extension loading\n// ============================================================\n\n/**\n * Dynamically loads the default pgvector extension from\n * `@electric-sql/pglite-pgvector`. Kept as a runtime import so the package\n * stays an optional peer dependency — callers using `vector: false` or\n * supplying their own extension never need it installed.\n */\nasync function loadDefaultPgvectorExtension(): Promise<Extension> {\n try {\n const module_ = await import(\"@electric-sql/pglite-pgvector\");\n return module_.vector;\n } catch (error) {\n throw new ConfigurationError(\n \"createLocalPgliteBackend needs the pgvector extension but \" +\n \"`@electric-sql/pglite-pgvector` could not be loaded. Install it \" +\n \"(`pnpm add @electric-sql/pglite-pgvector`), pass your own `vector` \" +\n \"extension, or set `vector: false` to disable vector support.\",\n { backend: \"pglite\", dependency: \"@electric-sql/pglite-pgvector\" },\n { cause: error },\n );\n }\n}\n\n// ============================================================\n// Factory Function\n// ============================================================\n\n/**\n * Creates a TypeGraph backend backed by an in-process PGlite database.\n *\n * Constructs the PGlite engine (loading pgvector unless disabled), executes\n * the schema DDL, and wires the standard Postgres backend. The returned\n * backend owns the engine: call `backend.close()` to dispose it.\n *\n * For production Postgres, or a PGlite instance you construct yourself,\n * use `createPostgresBackend` directly with your own Drizzle database — the\n * execution fast path detects PGlite and routes it correctly.\n *\n * @param options - Configuration options\n * @returns Backend, Drizzle database, and raw PGlite client\n */\nexport async function createLocalPgliteBackend(\n options: LocalPgliteBackendOptions = {},\n): Promise<LocalPgliteBackendResult> {\n const tables = options.tables ?? defaultTables;\n\n // pgvector lives in the WASM instance, so the extension must be passed at\n // construction — `CREATE EXTENSION vector` alone can't pull it in. An\n // explicitly supplied extension wins; `false` disables; otherwise load the\n // default package.\n const vectorExtension =\n options.vector === false ?\n undefined\n : (options.vector ?? (await loadDefaultPgvectorExtension()));\n const vectorEnabled = vectorExtension !== undefined;\n\n // Construct via the single options-object form (passing `dataDir` as a\n // field), not the positional `create(dataDir, options)` overload: with a\n // leading `undefined` dataDir, that overload silently drops `extensions`\n // (\"extension vector is not available\"). The options form loads them for\n // both the in-memory and on-disk cases.\n const client = await PGlite.create({\n ...(options.dataDir === undefined ? {} : { dataDir: options.dataDir }),\n ...(vectorExtension === undefined ?\n {}\n : { extensions: { vector: vectorExtension } }),\n });\n\n try {\n // `exec` runs a multi-statement batch (DDL + the pgvector `CREATE\n // EXTENSION` when enabled) in one round trip.\n const migrationSql =\n vectorEnabled ?\n generatePostgresMigrationSQL(tables)\n : generatePostgresDDL(tables).join(\"\\n\\n\");\n await client.exec(migrationSql);\n\n const db = drizzle(client);\n const backend = createPostgresBackend(db, {\n tables,\n ...(vectorEnabled ? {} : { vector: false }),\n });\n const managedBackend = wrapWithManagedClose(backend, async () => {\n await client.close();\n });\n\n return { backend: managedBackend, db, client };\n } catch (error) {\n return closeAfterFailure(client, error);\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { validateCanonicalIsoDate } from './chunk-
|
|
1
|
+
import { validateCanonicalIsoDate } from './chunk-5K2BKEBD.js';
|
|
2
2
|
import { ValidationError } from './chunk-ZLONH2UD.js';
|
|
3
3
|
|
|
4
4
|
// src/core/temporal.ts
|
|
@@ -143,5 +143,5 @@ function coordinateContext(coordinate) {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
export { RECORDED_MAX_REVISION, asRecordedInstant, assertValidRecordedInstant, compareRecordedInstants, coordinateContext, createRecordedInstant, describeCoordinate, optionalRecordedInstantParts, parseRecordedInstant, recordedInstantRevision, recordedInstantWallTime, resolveReadCoordinate, withRecordedCoordinate };
|
|
146
|
-
//# sourceMappingURL=chunk-
|
|
147
|
-
//# sourceMappingURL=chunk-
|
|
146
|
+
//# sourceMappingURL=chunk-DZAICA5J.js.map
|
|
147
|
+
//# sourceMappingURL=chunk-DZAICA5J.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/temporal.ts"],"names":[],"mappings":";;;;AAOA,IAAM,wBAAA,GAA2B,IAAA;AACjC,IAAM,uBAAA,GAA0B,EAAA;AAEzB,IAAM,wBAAwB,MAAA,CAAO;AAC5C,IAAM,wBAAA,GACJ,6DAAA;AA2BF,SAAS,sBAAA,CAAuB,OAAe,IAAA,EAA+B;AAC5E,EAAA,OAAO,IAAI,eAAA;AAAA,IACT,GAAG,IAAI,CAAA,gDAAA,CAAA;AAAA,IACP;AAAA,MACE,MAAA,EAAQ;AAAA,QACN;AAAA,UACE,IAAA;AAAA,UACA,SAAS,CAAA,SAAA,EAAY,wBAAwB,CAAA,EAAA,EAAK,uBAAuB,mDAAmD,KAAK,CAAA,CAAA;AAAA;AACnI;AACF,KACF;AAAA,IACA;AAAA,MACE,UAAA,EACE;AAAA;AACJ,GACF;AACF;AAEO,SAAS,oBAAA,CACd,KAAA,EACA,IAAA,GAAO,iBAAA,EACe;AACtB,EAAA,MAAM,KAAA,GAAQ,wBAAA,CAAyB,IAAA,CAAK,KAAK,CAAA;AACjD,EAAA,IAAI,KAAA,KAAU,IAAA,EAAM,MAAM,sBAAA,CAAuB,OAAO,IAAI,CAAA;AAC5D,EAAA,MAAM,YAAA,GAAe,MAAM,CAAC,CAAA;AAC5B,EAAA,MAAM,UAAA,GAAa,MAAM,CAAC,CAAA;AAC1B,EAAA,IAAI,YAAA,KAAiB,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d,GAAI,IAAA,KAAS,MAAA,IAAa,EAAE,IAAA,EAAK;AAAA,IACjC,GAAI,UAAA,CAAW,QAAA,KAAa,MAAA,GAC1B,KACA,EAAE,YAAA,EAAc,UAAA,CAAW,QAAA,CAAS,IAAA;AAAK,GAC7C;AACF","file":"chunk-XY5OMOJD.js","sourcesContent":["/**\n * Shared temporal coordinate + validation.\n */\nimport { ValidationError } from \"../errors\";\nimport { validateCanonicalIsoDate } from \"../utils/date\";\nimport { type TemporalMode } from \"./types\";\n\nconst RECORDED_INSTANT_VERSION = \"r1\";\nconst RECORDED_REVISION_WIDTH = 16;\n/** Open interval ceiling for numeric recorded-revision columns. */\nexport const RECORDED_MAX_REVISION = Number.MAX_SAFE_INTEGER;\nconst RECORDED_INSTANT_PATTERN =\n /^r1:(\\d{16}):(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z)$/;\n\ndeclare const RECORDED_INSTANT_BRAND: unique symbol;\n\n/**\n * A versioned recorded-time anchor containing a fixed-width logical revision\n * and a canonical UTC physical timestamp:\n * `r1:0000000000000001:YYYY-MM-DDTHH:mm:ss.sssZ`.\n *\n * Logical revisions are strictly monotonic per graph and make every commit\n * addressable even when many commits share one wall-clock millisecond. The\n * timestamp is a non-decreasing physical wall-time high-water mark used by\n * diagonal valid-time reads. Same-millisecond commits repeat it; backward clock\n * corrections hold it at the previous value until wall time catches up. The\n * string is canonical and lexicographically ordered by revision, so it can\n * round-trip through plain string checkpoint columns without a custom\n * serializer.\n */\nexport type RecordedInstant = string & {\n readonly [RECORDED_INSTANT_BRAND]: \"RecordedInstant\";\n};\n\nexport type RecordedInstantParts = Readonly<{\n revision: number;\n recordedAt: string;\n}>;\n\nfunction invalidRecordedInstant(value: string, path: string): ValidationError {\n return new ValidationError(\n `${path} must be a canonical versioned recorded instant.`,\n {\n issues: [\n {\n path,\n message: `Expected ${RECORDED_INSTANT_VERSION}:<${RECORDED_REVISION_WIDTH}-digit revision>:YYYY-MM-DDTHH:mm:ss.sssZ, got \"${value}\"`,\n },\n ],\n },\n {\n suggestion:\n \"Persist the exact string returned by store.recordedNow(); migrate preview-schema checkpoints with migrateLegacyRecordedTime() and migrateRecordedAnchor().\",\n },\n );\n}\n\nexport function parseRecordedInstant(\n value: string,\n path = \"RecordedInstant\",\n): RecordedInstantParts {\n const match = RECORDED_INSTANT_PATTERN.exec(value);\n if (match === null) throw invalidRecordedInstant(value, path);\n const revisionText = match[1];\n const recordedAt = match[2];\n if (revisionText === undefined || recordedAt === undefined) {\n throw invalidRecordedInstant(value, path);\n }\n const revision = Number(revisionText);\n if (\n !Number.isSafeInteger(revision) ||\n revision < 1 ||\n revision >= RECORDED_MAX_REVISION\n ) {\n throw invalidRecordedInstant(value, path);\n }\n validateCanonicalIsoDate(recordedAt, path);\n return { revision, recordedAt };\n}\n\nexport function assertValidRecordedInstant(value: string, path: string): void {\n parseRecordedInstant(value, path);\n}\n\n/**\n * Splits an optional recorded anchor into the numeric revision that recorded\n * relations store their `recorded_from`/`recorded_to` boundaries as, and the\n * wall time that valid-time windows are measured against. Compilers that\n * consult both halves parse once through this instead of per predicate.\n */\nexport function optionalRecordedInstantParts(\n value: string | undefined,\n path = \"RecordedInstant\",\n): RecordedInstantParts | undefined {\n return value === undefined ? undefined : parseRecordedInstant(value, path);\n}\n\nexport function createRecordedInstant(\n revision: number,\n recordedAt: string,\n): RecordedInstant {\n if (\n !Number.isSafeInteger(revision) ||\n revision < 1 ||\n revision >= RECORDED_MAX_REVISION\n ) {\n throw new ValidationError(\n \"createRecordedInstant revision must be a valid recorded revision.\",\n {\n issues: [\n {\n path: \"createRecordedInstant.revision\",\n message: `Expected a safe integer from 1 through ${String(RECORDED_MAX_REVISION - 1)}, got ${String(revision)}`,\n },\n ],\n },\n );\n }\n const revisionText = revision\n .toString()\n .padStart(RECORDED_REVISION_WIDTH, \"0\");\n return asRecordedInstant(\n `${RECORDED_INSTANT_VERSION}:${revisionText}:${recordedAt}`,\n );\n}\n\n/**\n * Returns the canonical UTC wall-time component of a recorded anchor.\n *\n * The value is non-decreasing per graph, but it is not the commit-order key;\n * use the complete {@link RecordedInstant} when ordering or replaying commits.\n */\nexport function recordedInstantWallTime(instant: RecordedInstant): string {\n return parseRecordedInstant(instant).recordedAt;\n}\n\n/** Returns the strict per-graph logical revision carried by an anchor. */\nexport function recordedInstantRevision(instant: RecordedInstant): number {\n return parseRecordedInstant(instant).revision;\n}\n\n/**\n * Compares two recorded anchors by logical revision.\n *\n * Revisions are local to a graph, so only compare anchors produced by the same\n * graph. The physical wall-time component deliberately does not participate.\n */\nexport function compareRecordedInstants(\n left: RecordedInstant,\n right: RecordedInstant,\n): -1 | 0 | 1 {\n const leftRevision = recordedInstantRevision(left);\n const rightRevision = recordedInstantRevision(right);\n if (leftRevision < rightRevision) return -1;\n if (leftRevision > rightRevision) return 1;\n return 0;\n}\n\n/**\n * Brands a canonical versioned anchor string as a {@link RecordedInstant}.\n *\n * The escape hatch for an instant that round-trips through untyped storage:\n * captured from {@link Store.recordedNow}, persisted as a plain string, read\n * back, and replayed into `asOfRecorded`. Validates the canonical form eagerly —\n * the same check `asOfRecorded` applies — so a malformed value fails here, at the\n * brand site, rather than deeper in a read. Does *not* assert the instant is a\n * real captured commit; it only guarantees the value is well-formed enough to\n * compare correctly against the recorded relations.\n *\n * @throws {ValidationError} when `value` is not a canonical versioned anchor.\n */\nexport function asRecordedInstant(value: string): RecordedInstant {\n assertValidRecordedInstant(value, \"asRecordedInstant\");\n return value as RecordedInstant;\n}\n\n/**\n * The single opaque temporal coordinate every pinned read is resolved\n * against. It carries the valid-time axis plus an optional recorded/system-time\n * axis, so every surface can inject one coordinate object instead of threading\n * each temporal dimension separately.\n */\nexport type ReadCoordinate = Readonly<{\n /**\n * The valid-time axis: a resolved temporal mode and (only for `\"asOf\"`) the\n * instant it is pinned to.\n */\n valid: Readonly<{\n mode: TemporalMode;\n /** Defined only when `mode` is `\"asOf\"`. */\n asOf?: string;\n }>;\n /** The recorded/system-time axis. Defined only for recorded-pinned views. */\n recorded?: Readonly<{ asOf: RecordedInstant }>;\n}>;\n\n/**\n * Resolves and validates a `(mode, asOf)` pair into a {@link ReadCoordinate}.\n * Rejects an `asOf` paired with any non-`\"asOf\"` mode rather than silently\n * dropping it — pinning an instant is only meaningful in `\"asOf\"` mode, so a\n * `view({ mode: \"current\", asOf })` is a caller mistake, not a coordinate to\n * quietly discard. Then validates via {@link assertValidAsOf}.\n *\n * @param mode - The temporal mode to pin.\n * @param asOf - The supplied timestamp. Required for `\"asOf\"`; rejected for\n * every other mode.\n * @param suggestion - Caller-specific remediation hint for the\n * missing/invalid-timestamp case.\n */\nexport function resolveReadCoordinate(\n mode: TemporalMode,\n asOf: string | undefined,\n suggestion?: string,\n): ReadCoordinate {\n if (mode !== \"asOf\" && asOf !== undefined) {\n throw new ValidationError(\n `Temporal mode \"${mode}\" does not take an asOf timestamp.`,\n {\n issues: [\n {\n path: \"asOf\",\n message: `asOf is only valid with mode \"asOf\", not \"${mode}\"`,\n },\n ],\n },\n {\n suggestion:\n 'Pin an instant with store.asOf(timestamp) or store.view({ mode: \"asOf\", asOf }); drop asOf for other modes.',\n },\n );\n }\n assertValidAsOf(\n mode,\n asOf,\n suggestion === undefined ? undefined : { suggestion },\n );\n return { valid: asOf === undefined ? { mode } : { mode, asOf } };\n}\n\n/**\n * Adds a recorded/system-time pin to an existing valid-time coordinate.\n * Direct `store.asOfRecorded(T)` passes the diagonal valid-time coordinate\n * (`mode: \"asOf\", asOf: T`); `store.asOf(vt).asOfRecorded(rt)` passes the\n * already-resolved valid coordinate and adds the recorded sibling.\n */\nexport function withRecordedCoordinate(\n coordinate: ReadCoordinate,\n recordedAsOf: RecordedInstant,\n): ReadCoordinate {\n assertValidRecordedInstant(recordedAsOf, \"asOfRecorded\");\n return {\n ...coordinate,\n recorded: { asOf: recordedAsOf },\n };\n}\n\n/**\n * Validates the `asOf` coordinate of a temporal read: `\"asOf\"` mode\n * requires a timestamp, and any supplied timestamp must be a canonical\n * fixed-width UTC ISO-8601 string (`YYYY-MM-DDTHH:mm:ss.sssZ`). The latter\n * is load-bearing — temporal filters compare `asOf` against `valid_from` /\n * `valid_to` as text on SQLite, so a non-canonical value (date-only, an\n * offset, natural language, or variable-width / missing milliseconds like\n * `.1Z`) would sort and compare wrong rather than error. Reached only through\n * {@link resolveReadCoordinate}, which every temporal read entry point routes\n * through (direct reads, queries, subgraphs, algorithms, and StoreView), so\n * they all fail identically.\n *\n * @param mode - The resolved temporal mode.\n * @param asOf - The supplied timestamp (may be `undefined`).\n * @param options.suggestion - A caller-specific remediation hint for the\n * missing-timestamp case.\n *\n * @throws {ValidationError} when `mode` is `\"asOf\"` and `asOf` is missing, or\n * when any supplied `asOf` is not a canonical UTC ISO-8601 timestamp. The\n * canonical check runs for *every* mode that consumes `asOf`, so a\n * non-canonical value can never reach a text comparison.\n */\nfunction assertValidAsOf(\n mode: TemporalMode,\n asOf: string | undefined,\n options?: Readonly<{ suggestion?: string }>,\n): void {\n if (mode === \"asOf\" && asOf === undefined) {\n throw new ValidationError(\n 'Temporal mode \"asOf\" requires a timestamp',\n {\n issues: [\n { path: \"asOf\", message: \"Timestamp is required for asOf mode\" },\n ],\n },\n {\n suggestion:\n options?.suggestion ??\n 'Provide an ISO-8601 timestamp for asOf mode, e.g. \"2026-01-01T00:00:00.000Z\".',\n },\n );\n }\n if (asOf !== undefined) {\n validateCanonicalIsoDate(asOf, \"asOf\");\n }\n}\n\n/**\n * A human-readable description of a coordinate for error messages, e.g.\n * `mode \"current\"` or `mode \"asOf\" asOf 2026-01-01T00:00:00.000Z`. Shared by\n * every refusal path (the `StoreView` read-only / current-only / search facades\n * and the sealed-query builder) so they describe a coordinate identically — and\n * a future axis (recorded time) is reflected everywhere from one place.\n */\nexport function describeCoordinate(coordinate: ReadCoordinate): string {\n const { mode, asOf } = coordinate.valid;\n const valid =\n asOf === undefined ? `mode \"${mode}\"` : `mode \"${mode}\" asOf ${asOf}`;\n return coordinate.recorded === undefined ?\n valid\n : `${valid}, recorded asOf ${coordinate.recorded.asOf}`;\n}\n\n/**\n * The structured error-context fields describing a coordinate, shared by the\n * same refusal paths as {@link describeCoordinate}.\n */\nexport function coordinateContext(\n coordinate: ReadCoordinate,\n): Record<string, unknown> {\n const { mode, asOf } = coordinate.valid;\n return {\n temporalMode: mode,\n ...(asOf !== undefined && { asOf }),\n ...(coordinate.recorded === undefined ?\n {}\n : { recordedAsOf: coordinate.recorded.asOf }),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/temporal.ts"],"names":[],"mappings":";;;;AAOA,IAAM,wBAAA,GAA2B,IAAA;AACjC,IAAM,uBAAA,GAA0B,EAAA;AAEzB,IAAM,wBAAwB,MAAA,CAAO;AAC5C,IAAM,wBAAA,GACJ,6DAAA;AA2BF,SAAS,sBAAA,CAAuB,OAAe,IAAA,EAA+B;AAC5E,EAAA,OAAO,IAAI,eAAA;AAAA,IACT,GAAG,IAAI,CAAA,gDAAA,CAAA;AAAA,IACP;AAAA,MACE,MAAA,EAAQ;AAAA,QACN;AAAA,UACE,IAAA;AAAA,UACA,SAAS,CAAA,SAAA,EAAY,wBAAwB,CAAA,EAAA,EAAK,uBAAuB,mDAAmD,KAAK,CAAA,CAAA;AAAA;AACnI;AACF,KACF;AAAA,IACA;AAAA,MACE,UAAA,EACE;AAAA;AACJ,GACF;AACF;AAEO,SAAS,oBAAA,CACd,KAAA,EACA,IAAA,GAAO,iBAAA,EACe;AACtB,EAAA,MAAM,KAAA,GAAQ,wBAAA,CAAyB,IAAA,CAAK,KAAK,CAAA;AACjD,EAAA,IAAI,KAAA,KAAU,IAAA,EAAM,MAAM,sBAAA,CAAuB,OAAO,IAAI,CAAA;AAC5D,EAAA,MAAM,YAAA,GAAe,MAAM,CAAC,CAAA;AAC5B,EAAA,MAAM,UAAA,GAAa,MAAM,CAAC,CAAA;AAC1B,EAAA,IAAI,YAAA,KAAiB,MAAA,IAAa,UAAA,KAAe,MAAA,EAAW;A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,IAAA,EAAK;AAAA,IACjC,GAAI,UAAA,CAAW,QAAA,KAAa,MAAA,GAC1B,KACA,EAAE,YAAA,EAAc,UAAA,CAAW,QAAA,CAAS,IAAA;AAAK,GAC7C;AACF","file":"chunk-DZAICA5J.js","sourcesContent":["/**\n * Shared temporal coordinate + validation.\n */\nimport { ValidationError } from \"../errors\";\nimport { validateCanonicalIsoDate } from \"../utils/date\";\nimport { type TemporalMode } from \"./types\";\n\nconst RECORDED_INSTANT_VERSION = \"r1\";\nconst RECORDED_REVISION_WIDTH = 16;\n/** Open interval ceiling for numeric recorded-revision columns. */\nexport const RECORDED_MAX_REVISION = Number.MAX_SAFE_INTEGER;\nconst RECORDED_INSTANT_PATTERN =\n /^r1:(\\d{16}):(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z)$/;\n\ndeclare const RECORDED_INSTANT_BRAND: unique symbol;\n\n/**\n * A versioned recorded-time anchor containing a fixed-width logical revision\n * and a canonical UTC physical timestamp:\n * `r1:0000000000000001:YYYY-MM-DDTHH:mm:ss.sssZ`.\n *\n * Logical revisions are strictly monotonic per graph and make every commit\n * addressable even when many commits share one wall-clock millisecond. The\n * timestamp is a non-decreasing physical wall-time high-water mark used by\n * diagonal valid-time reads. Same-millisecond commits repeat it; backward clock\n * corrections hold it at the previous value until wall time catches up. The\n * string is canonical and lexicographically ordered by revision, so it can\n * round-trip through plain string checkpoint columns without a custom\n * serializer.\n */\nexport type RecordedInstant = string & {\n readonly [RECORDED_INSTANT_BRAND]: \"RecordedInstant\";\n};\n\nexport type RecordedInstantParts = Readonly<{\n revision: number;\n recordedAt: string;\n}>;\n\nfunction invalidRecordedInstant(value: string, path: string): ValidationError {\n return new ValidationError(\n `${path} must be a canonical versioned recorded instant.`,\n {\n issues: [\n {\n path,\n message: `Expected ${RECORDED_INSTANT_VERSION}:<${RECORDED_REVISION_WIDTH}-digit revision>:YYYY-MM-DDTHH:mm:ss.sssZ, got \"${value}\"`,\n },\n ],\n },\n {\n suggestion:\n \"Persist the exact string returned by store.recordedNow(); migrate preview-schema checkpoints with migrateLegacyRecordedTime() and migrateRecordedAnchor().\",\n },\n );\n}\n\nexport function parseRecordedInstant(\n value: string,\n path = \"RecordedInstant\",\n): RecordedInstantParts {\n const match = RECORDED_INSTANT_PATTERN.exec(value);\n if (match === null) throw invalidRecordedInstant(value, path);\n const revisionText = match[1];\n const recordedAt = match[2];\n if (revisionText === undefined || recordedAt === undefined) {\n throw invalidRecordedInstant(value, path);\n }\n const revision = Number(revisionText);\n if (\n !Number.isSafeInteger(revision) ||\n revision < 1 ||\n revision >= RECORDED_MAX_REVISION\n ) {\n throw invalidRecordedInstant(value, path);\n }\n validateCanonicalIsoDate(recordedAt, path);\n return { revision, recordedAt };\n}\n\nexport function assertValidRecordedInstant(value: string, path: string): void {\n parseRecordedInstant(value, path);\n}\n\n/**\n * Splits an optional recorded anchor into the numeric revision that recorded\n * relations store their `recorded_from`/`recorded_to` boundaries as, and the\n * wall time that valid-time windows are measured against. Compilers that\n * consult both halves parse once through this instead of per predicate.\n */\nexport function optionalRecordedInstantParts(\n value: string | undefined,\n path = \"RecordedInstant\",\n): RecordedInstantParts | undefined {\n return value === undefined ? undefined : parseRecordedInstant(value, path);\n}\n\nexport function createRecordedInstant(\n revision: number,\n recordedAt: string,\n): RecordedInstant {\n if (\n !Number.isSafeInteger(revision) ||\n revision < 1 ||\n revision >= RECORDED_MAX_REVISION\n ) {\n throw new ValidationError(\n \"createRecordedInstant revision must be a valid recorded revision.\",\n {\n issues: [\n {\n path: \"createRecordedInstant.revision\",\n message: `Expected a safe integer from 1 through ${String(RECORDED_MAX_REVISION - 1)}, got ${String(revision)}`,\n },\n ],\n },\n );\n }\n const revisionText = revision\n .toString()\n .padStart(RECORDED_REVISION_WIDTH, \"0\");\n return asRecordedInstant(\n `${RECORDED_INSTANT_VERSION}:${revisionText}:${recordedAt}`,\n );\n}\n\n/**\n * Returns the canonical UTC wall-time component of a recorded anchor.\n *\n * The value is non-decreasing per graph, but it is not the commit-order key;\n * use the complete {@link RecordedInstant} when ordering or replaying commits.\n */\nexport function recordedInstantWallTime(instant: RecordedInstant): string {\n return parseRecordedInstant(instant).recordedAt;\n}\n\n/** Returns the strict per-graph logical revision carried by an anchor. */\nexport function recordedInstantRevision(instant: RecordedInstant): number {\n return parseRecordedInstant(instant).revision;\n}\n\n/**\n * Compares two recorded anchors by logical revision.\n *\n * Revisions are local to a graph, so only compare anchors produced by the same\n * graph. The physical wall-time component deliberately does not participate.\n */\nexport function compareRecordedInstants(\n left: RecordedInstant,\n right: RecordedInstant,\n): -1 | 0 | 1 {\n const leftRevision = recordedInstantRevision(left);\n const rightRevision = recordedInstantRevision(right);\n if (leftRevision < rightRevision) return -1;\n if (leftRevision > rightRevision) return 1;\n return 0;\n}\n\n/**\n * Brands a canonical versioned anchor string as a {@link RecordedInstant}.\n *\n * The escape hatch for an instant that round-trips through untyped storage:\n * captured from {@link Store.recordedNow}, persisted as a plain string, read\n * back, and replayed into `asOfRecorded`. Validates the canonical form eagerly —\n * the same check `asOfRecorded` applies — so a malformed value fails here, at the\n * brand site, rather than deeper in a read. Does *not* assert the instant is a\n * real captured commit; it only guarantees the value is well-formed enough to\n * compare correctly against the recorded relations.\n *\n * @throws {ValidationError} when `value` is not a canonical versioned anchor.\n */\nexport function asRecordedInstant(value: string): RecordedInstant {\n assertValidRecordedInstant(value, \"asRecordedInstant\");\n return value as RecordedInstant;\n}\n\n/**\n * The single opaque temporal coordinate every pinned read is resolved\n * against. It carries the valid-time axis plus an optional recorded/system-time\n * axis, so every surface can inject one coordinate object instead of threading\n * each temporal dimension separately.\n */\nexport type ReadCoordinate = Readonly<{\n /**\n * The valid-time axis: a resolved temporal mode and (only for `\"asOf\"`) the\n * instant it is pinned to.\n */\n valid: Readonly<{\n mode: TemporalMode;\n /** Defined only when `mode` is `\"asOf\"`. */\n asOf?: string;\n }>;\n /** The recorded/system-time axis. Defined only for recorded-pinned views. */\n recorded?: Readonly<{ asOf: RecordedInstant }>;\n}>;\n\n/**\n * Resolves and validates a `(mode, asOf)` pair into a {@link ReadCoordinate}.\n * Rejects an `asOf` paired with any non-`\"asOf\"` mode rather than silently\n * dropping it — pinning an instant is only meaningful in `\"asOf\"` mode, so a\n * `view({ mode: \"current\", asOf })` is a caller mistake, not a coordinate to\n * quietly discard. Then validates via {@link assertValidAsOf}.\n *\n * @param mode - The temporal mode to pin.\n * @param asOf - The supplied timestamp. Required for `\"asOf\"`; rejected for\n * every other mode.\n * @param suggestion - Caller-specific remediation hint for the\n * missing/invalid-timestamp case.\n */\nexport function resolveReadCoordinate(\n mode: TemporalMode,\n asOf: string | undefined,\n suggestion?: string,\n): ReadCoordinate {\n if (mode !== \"asOf\" && asOf !== undefined) {\n throw new ValidationError(\n `Temporal mode \"${mode}\" does not take an asOf timestamp.`,\n {\n issues: [\n {\n path: \"asOf\",\n message: `asOf is only valid with mode \"asOf\", not \"${mode}\"`,\n },\n ],\n },\n {\n suggestion:\n 'Pin an instant with store.asOf(timestamp) or store.view({ mode: \"asOf\", asOf }); drop asOf for other modes.',\n },\n );\n }\n assertValidAsOf(\n mode,\n asOf,\n suggestion === undefined ? undefined : { suggestion },\n );\n return { valid: asOf === undefined ? { mode } : { mode, asOf } };\n}\n\n/**\n * Adds a recorded/system-time pin to an existing valid-time coordinate.\n * Direct `store.asOfRecorded(T)` passes the diagonal valid-time coordinate\n * (`mode: \"asOf\", asOf: T`); `store.asOf(vt).asOfRecorded(rt)` passes the\n * already-resolved valid coordinate and adds the recorded sibling.\n */\nexport function withRecordedCoordinate(\n coordinate: ReadCoordinate,\n recordedAsOf: RecordedInstant,\n): ReadCoordinate {\n assertValidRecordedInstant(recordedAsOf, \"asOfRecorded\");\n return {\n ...coordinate,\n recorded: { asOf: recordedAsOf },\n };\n}\n\n/**\n * Validates the `asOf` coordinate of a temporal read: `\"asOf\"` mode\n * requires a timestamp, and any supplied timestamp must be a canonical\n * fixed-width UTC ISO-8601 string (`YYYY-MM-DDTHH:mm:ss.sssZ`). The latter\n * is load-bearing — temporal filters compare `asOf` against `valid_from` /\n * `valid_to` as text on SQLite, so a non-canonical value (date-only, an\n * offset, natural language, or variable-width / missing milliseconds like\n * `.1Z`) would sort and compare wrong rather than error. Reached only through\n * {@link resolveReadCoordinate}, which every temporal read entry point routes\n * through (direct reads, queries, subgraphs, algorithms, and StoreView), so\n * they all fail identically.\n *\n * @param mode - The resolved temporal mode.\n * @param asOf - The supplied timestamp (may be `undefined`).\n * @param options.suggestion - A caller-specific remediation hint for the\n * missing-timestamp case.\n *\n * @throws {ValidationError} when `mode` is `\"asOf\"` and `asOf` is missing, or\n * when any supplied `asOf` is not a canonical UTC ISO-8601 timestamp. The\n * canonical check runs for *every* mode that consumes `asOf`, so a\n * non-canonical value can never reach a text comparison.\n */\nfunction assertValidAsOf(\n mode: TemporalMode,\n asOf: string | undefined,\n options?: Readonly<{ suggestion?: string }>,\n): void {\n if (mode === \"asOf\" && asOf === undefined) {\n throw new ValidationError(\n 'Temporal mode \"asOf\" requires a timestamp',\n {\n issues: [\n { path: \"asOf\", message: \"Timestamp is required for asOf mode\" },\n ],\n },\n {\n suggestion:\n options?.suggestion ??\n 'Provide an ISO-8601 timestamp for asOf mode, e.g. \"2026-01-01T00:00:00.000Z\".',\n },\n );\n }\n if (asOf !== undefined) {\n validateCanonicalIsoDate(asOf, \"asOf\");\n }\n}\n\n/**\n * A human-readable description of a coordinate for error messages, e.g.\n * `mode \"current\"` or `mode \"asOf\" asOf 2026-01-01T00:00:00.000Z`. Shared by\n * every refusal path (the `StoreView` read-only / current-only / search facades\n * and the sealed-query builder) so they describe a coordinate identically — and\n * a future axis (recorded time) is reflected everywhere from one place.\n */\nexport function describeCoordinate(coordinate: ReadCoordinate): string {\n const { mode, asOf } = coordinate.valid;\n const valid =\n asOf === undefined ? `mode \"${mode}\"` : `mode \"${mode}\" asOf ${asOf}`;\n return coordinate.recorded === undefined ?\n valid\n : `${valid}, recorded asOf ${coordinate.recorded.asOf}`;\n}\n\n/**\n * The structured error-context fields describing a coordinate, shared by the\n * same refusal paths as {@link describeCoordinate}.\n */\nexport function coordinateContext(\n coordinate: ReadCoordinate,\n): Record<string, unknown> {\n const { mode, asOf } = coordinate.valid;\n return {\n temporalMode: mode,\n ...(asOf !== undefined && { asOf }),\n ...(coordinate.recorded === undefined ?\n {}\n : { recordedAsOf: coordinate.recorded.asOf }),\n };\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkSIT26LAZ_cjs = require('./chunk-SIT26LAZ.cjs');
|
|
4
4
|
var chunk3U5ABFDW_cjs = require('./chunk-3U5ABFDW.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
5
|
+
var chunk5PRKMB24_cjs = require('./chunk-5PRKMB24.cjs');
|
|
6
|
+
var chunk2QGYQBS2_cjs = require('./chunk-2QGYQBS2.cjs');
|
|
7
|
+
var chunkTQHGE7UC_cjs = require('./chunk-TQHGE7UC.cjs');
|
|
8
8
|
var chunkEDN4Y4ZG_cjs = require('./chunk-EDN4Y4ZG.cjs');
|
|
9
9
|
var chunkRT5ZY4XA_cjs = require('./chunk-RT5ZY4XA.cjs');
|
|
10
10
|
var chunkMRDBBHIZ_cjs = require('./chunk-MRDBBHIZ.cjs');
|
|
@@ -16,7 +16,7 @@ var nanoid = require('nanoid');
|
|
|
16
16
|
var pinnedReadInstant;
|
|
17
17
|
function withPinnedReadInstant(emit) {
|
|
18
18
|
if (pinnedReadInstant !== void 0) return emit();
|
|
19
|
-
pinnedReadInstant =
|
|
19
|
+
pinnedReadInstant = chunkTQHGE7UC_cjs.nowIso();
|
|
20
20
|
try {
|
|
21
21
|
return emit();
|
|
22
22
|
} finally {
|
|
@@ -24,7 +24,7 @@ function withPinnedReadInstant(emit) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
function currentReadInstant() {
|
|
27
|
-
return chunkEDN4Y4ZG_cjs.sql`${pinnedReadInstant ??
|
|
27
|
+
return chunkEDN4Y4ZG_cjs.sql`${pinnedReadInstant ?? chunkTQHGE7UC_cjs.nowIso()}`;
|
|
28
28
|
}
|
|
29
29
|
var CURRENT_READ_INSTANT_PLACEHOLDER = "__typegraph_current_read_instant__";
|
|
30
30
|
function currentReadInstantPlaceholder() {
|
|
@@ -35,7 +35,7 @@ function currentReadInstantFor(mode) {
|
|
|
35
35
|
}
|
|
36
36
|
function compileTemporalFilter(options) {
|
|
37
37
|
const { mode, asOf, tableAlias, currentTimestamp, recordedAsOf } = options;
|
|
38
|
-
const recorded =
|
|
38
|
+
const recorded = chunk2QGYQBS2_cjs.optionalRecordedInstantParts(recordedAsOf, "recordedAsOf");
|
|
39
39
|
const prefix = tableAlias ? chunkEDN4Y4ZG_cjs.sql.raw(`${tableAlias}.`) : chunkEDN4Y4ZG_cjs.sql.raw("");
|
|
40
40
|
const deletedAt = chunkEDN4Y4ZG_cjs.sql`${prefix}deleted_at`;
|
|
41
41
|
const validFrom = chunkEDN4Y4ZG_cjs.sql`${prefix}valid_from`;
|
|
@@ -928,13 +928,13 @@ function failInvalidClock(value, cause) {
|
|
|
928
928
|
}
|
|
929
929
|
function recordedClockRevision(value) {
|
|
930
930
|
const revision = typeof value === "bigint" ? Number(value) : typeof value === "string" && /^\d+$/.test(value) ? Number(value) : value;
|
|
931
|
-
if (typeof revision !== "number" || !Number.isSafeInteger(revision) || revision < RECORDED_MIN_REVISION || revision >=
|
|
931
|
+
if (typeof revision !== "number" || !Number.isSafeInteger(revision) || revision < RECORDED_MIN_REVISION || revision >= chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION) {
|
|
932
932
|
return failInvalidClock(value);
|
|
933
933
|
}
|
|
934
934
|
return revision;
|
|
935
935
|
}
|
|
936
936
|
function recordedClockWallTime(value) {
|
|
937
|
-
return
|
|
937
|
+
return chunkTQHGE7UC_cjs.canonicalizeDatabaseTimestamp(value) ?? failInvalidClock(value);
|
|
938
938
|
}
|
|
939
939
|
function recordedClockParts(row) {
|
|
940
940
|
const revision = recordedClockRevision(row.revision);
|
|
@@ -942,7 +942,7 @@ function recordedClockParts(row) {
|
|
|
942
942
|
return { revision, recordedAt: recordedClockWallTime(row.recorded_at) };
|
|
943
943
|
}
|
|
944
944
|
function nextRecordedCommitParts(previous) {
|
|
945
|
-
const wallTime =
|
|
945
|
+
const wallTime = chunkTQHGE7UC_cjs.nowIso();
|
|
946
946
|
if (previous === void 0) {
|
|
947
947
|
return { revision: 1, recordedAt: wallTime };
|
|
948
948
|
}
|
|
@@ -960,7 +960,7 @@ function nonDecreasingWallTime(current, previous) {
|
|
|
960
960
|
}
|
|
961
961
|
async function readRecordedClock(target, schema, graphId) {
|
|
962
962
|
const parts = await readRecordedClockParts(target, schema, graphId);
|
|
963
|
-
return parts === void 0 ? void 0 :
|
|
963
|
+
return parts === void 0 ? void 0 : chunk2QGYQBS2_cjs.createRecordedInstant(parts.revision, parts.recordedAt);
|
|
964
964
|
}
|
|
965
965
|
async function readRecordedClockParts(target, schema, graphId) {
|
|
966
966
|
const rows = await target.execute(
|
|
@@ -1070,18 +1070,18 @@ async function lockRecordedClock(target, schema, graphId, ownsWriteLock) {
|
|
|
1070
1070
|
}
|
|
1071
1071
|
async function allocateRecordedCommit(target, schema, graphId, ownsWriteLock, previousRevision) {
|
|
1072
1072
|
await lockRecordedClock(target, schema, graphId, ownsWriteLock);
|
|
1073
|
-
const previous = previousRevision === void 0 ? await readRecordedClockParts(target, schema, graphId) :
|
|
1073
|
+
const previous = previousRevision === void 0 ? await readRecordedClockParts(target, schema, graphId) : chunk2QGYQBS2_cjs.parseRecordedInstant(previousRevision, "previous recorded revision");
|
|
1074
1074
|
const { revision, recordedAt } = nextRecordedCommitParts(previous);
|
|
1075
|
-
if (revision >=
|
|
1075
|
+
if (revision >= chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION) {
|
|
1076
1076
|
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
1077
|
-
`Recorded commit clock reached the open revision sentinel ${
|
|
1077
|
+
`Recorded commit clock reached the open revision sentinel ${chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION}`,
|
|
1078
1078
|
{ graphId, revision },
|
|
1079
1079
|
{
|
|
1080
1080
|
suggestion: "Start a new graph before exhausting the per-graph recorded revision space."
|
|
1081
1081
|
}
|
|
1082
1082
|
);
|
|
1083
1083
|
}
|
|
1084
|
-
const instant =
|
|
1084
|
+
const instant = chunk2QGYQBS2_cjs.createRecordedInstant(revision, recordedAt);
|
|
1085
1085
|
await writeRecordedClock(target, schema, graphId, { revision, recordedAt });
|
|
1086
1086
|
if (previousRevision !== void 0) {
|
|
1087
1087
|
await assertRecordedClockAdvanced(target, schema, graphId, revision);
|
|
@@ -1099,128 +1099,6 @@ async function advanceRevisionClock(target, schema, graphId, ownsWriteLock, prev
|
|
|
1099
1099
|
return commit.instant;
|
|
1100
1100
|
}
|
|
1101
1101
|
|
|
1102
|
-
// src/backend/graph-backend-projection.ts
|
|
1103
|
-
var GRAPH_BACKEND_PROJECTION_KEYS = [
|
|
1104
|
-
"dialect",
|
|
1105
|
-
"capabilities",
|
|
1106
|
-
"tableNames",
|
|
1107
|
-
"fulltextStrategy",
|
|
1108
|
-
"vectorStrategy",
|
|
1109
|
-
"insertNode",
|
|
1110
|
-
"insertNodeNoReturn",
|
|
1111
|
-
"insertNodesBatch",
|
|
1112
|
-
"insertNodesBatchReturning",
|
|
1113
|
-
"updateNode",
|
|
1114
|
-
"updateNodeSet",
|
|
1115
|
-
"deleteNode",
|
|
1116
|
-
"hardDeleteNode",
|
|
1117
|
-
"getNode",
|
|
1118
|
-
"getNodes",
|
|
1119
|
-
"insertEdge",
|
|
1120
|
-
"insertEdgeNoReturn",
|
|
1121
|
-
"insertEdgesBatch",
|
|
1122
|
-
"insertEdgesBatchReturning",
|
|
1123
|
-
"updateEdge",
|
|
1124
|
-
"deleteEdge",
|
|
1125
|
-
"hardDeleteEdge",
|
|
1126
|
-
"deleteEdgesBatch",
|
|
1127
|
-
"hardDeleteEdgesBatch",
|
|
1128
|
-
"getEdge",
|
|
1129
|
-
"getEdges",
|
|
1130
|
-
"countEdgesFrom",
|
|
1131
|
-
"edgeExistsBetween",
|
|
1132
|
-
"findEdgesConnectedTo",
|
|
1133
|
-
"findNodesByKind",
|
|
1134
|
-
"countNodesByKind",
|
|
1135
|
-
"findEdgesByKind",
|
|
1136
|
-
"findEdgesByEndpointSet",
|
|
1137
|
-
"findEdgesByHeterogeneousEndpointSet",
|
|
1138
|
-
"countEdgesByKind",
|
|
1139
|
-
"insertUnique",
|
|
1140
|
-
"insertUniqueBatch",
|
|
1141
|
-
"deleteUnique",
|
|
1142
|
-
"hardDeleteUniquesByNodeIds",
|
|
1143
|
-
"checkUnique",
|
|
1144
|
-
"checkUniqueBatch",
|
|
1145
|
-
"getActiveSchema",
|
|
1146
|
-
"getSchemaVersion",
|
|
1147
|
-
"commitSchemaVersion",
|
|
1148
|
-
"commitSchemaVersionIfKindsEmpty",
|
|
1149
|
-
"lockSchemaVersionForWrite",
|
|
1150
|
-
"commitSchemaVersionWithPreflight",
|
|
1151
|
-
"setActiveVersion",
|
|
1152
|
-
"schemaWriteTransaction",
|
|
1153
|
-
"upsertEmbedding",
|
|
1154
|
-
"upsertEmbeddingBatch",
|
|
1155
|
-
"deleteEmbedding",
|
|
1156
|
-
"deleteEmbeddingBatch",
|
|
1157
|
-
"vectorSearch",
|
|
1158
|
-
"createVectorIndex",
|
|
1159
|
-
"dropVectorIndex",
|
|
1160
|
-
"hybridSearch",
|
|
1161
|
-
"upsertFulltext",
|
|
1162
|
-
"deleteFulltext",
|
|
1163
|
-
"upsertFulltextBatch",
|
|
1164
|
-
"deleteFulltextBatch",
|
|
1165
|
-
"fulltextSearch",
|
|
1166
|
-
"ensureIndexMaterializationsTable",
|
|
1167
|
-
"ensureTrigramExtension",
|
|
1168
|
-
"ensureRevisionOriginsTable",
|
|
1169
|
-
"getIndexMaterialization",
|
|
1170
|
-
"getIndexMaterializations",
|
|
1171
|
-
"recordIndexMaterialization",
|
|
1172
|
-
"claimIndexMaterialization",
|
|
1173
|
-
"releaseIndexMaterializationClaim",
|
|
1174
|
-
"ensureContributionMaterializationsTable",
|
|
1175
|
-
"getContributionMaterialization",
|
|
1176
|
-
"recordContributionMaterialization",
|
|
1177
|
-
"assertRuntimeContributionsInitialized",
|
|
1178
|
-
"ensureKindRemovalsTable",
|
|
1179
|
-
"getPendingKindRemovals",
|
|
1180
|
-
"getAllKindRemovals",
|
|
1181
|
-
"recordKindRemoval",
|
|
1182
|
-
"ensureReconciliationMarkersTable",
|
|
1183
|
-
"ensureRuntimeContributions",
|
|
1184
|
-
"ensureVectorSlotContribution",
|
|
1185
|
-
"ensureVectorSlotContributions",
|
|
1186
|
-
"assertVectorSlotInitialized",
|
|
1187
|
-
"assertVectorSlotsInitialized",
|
|
1188
|
-
"deleteVectorSlotContribution",
|
|
1189
|
-
"verifyContributions",
|
|
1190
|
-
"repairContributions",
|
|
1191
|
-
"probeContributions",
|
|
1192
|
-
"rebuildContribution",
|
|
1193
|
-
"ensureFulltextTable",
|
|
1194
|
-
"ensureIdentityTables",
|
|
1195
|
-
"identityTableDdl",
|
|
1196
|
-
"getReconciliationMarker",
|
|
1197
|
-
"setReconciliationMarker",
|
|
1198
|
-
"clearGraph",
|
|
1199
|
-
"bootstrapTables",
|
|
1200
|
-
"refreshStatistics",
|
|
1201
|
-
"trustedImport",
|
|
1202
|
-
"execute",
|
|
1203
|
-
"executeStatement",
|
|
1204
|
-
"executeTemporaryStatement",
|
|
1205
|
-
"executeRaw",
|
|
1206
|
-
"compileSql",
|
|
1207
|
-
"executeDdl",
|
|
1208
|
-
"transaction",
|
|
1209
|
-
"close"
|
|
1210
|
-
];
|
|
1211
|
-
function projectBackendMembers(backend, keys) {
|
|
1212
|
-
const entries = keys.flatMap((key) => {
|
|
1213
|
-
if (!Reflect.has(backend, key)) return [];
|
|
1214
|
-
return [[key, Reflect.get(backend, key)]];
|
|
1215
|
-
});
|
|
1216
|
-
const projection = Object.fromEntries(entries);
|
|
1217
|
-
chunk3HGRTCDU_cjs.inheritSerializedTransactionResource(projection, backend);
|
|
1218
|
-
return projection;
|
|
1219
|
-
}
|
|
1220
|
-
function createGraphBackendProjection(backend) {
|
|
1221
|
-
return projectBackendMembers(backend, GRAPH_BACKEND_PROJECTION_KEYS);
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
1102
|
// src/store/insert-dispatch.ts
|
|
1225
1103
|
function nodeInsertDispatch(backend) {
|
|
1226
1104
|
return {
|
|
@@ -1290,7 +1168,7 @@ function identitySqlCoordinate(coordinate, currentInstant) {
|
|
|
1290
1168
|
return {
|
|
1291
1169
|
validMode: coordinate?.valid.mode ?? "current",
|
|
1292
1170
|
validAsOf: coordinate?.valid.asOf,
|
|
1293
|
-
recorded:
|
|
1171
|
+
recorded: chunk2QGYQBS2_cjs.optionalRecordedInstantParts(
|
|
1294
1172
|
coordinate?.recorded?.asOf,
|
|
1295
1173
|
"recorded.asOf"
|
|
1296
1174
|
),
|
|
@@ -2267,14 +2145,14 @@ function recordedCommonCells() {
|
|
|
2267
2145
|
graph_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.graph_id}`,
|
|
2268
2146
|
id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.id}`,
|
|
2269
2147
|
kind: (row) => chunkEDN4Y4ZG_cjs.sql`${row.kind}`,
|
|
2270
|
-
props: (row) => chunkEDN4Y4ZG_cjs.sql`${
|
|
2148
|
+
props: (row) => chunkEDN4Y4ZG_cjs.sql`${chunk5PRKMB24_cjs.rowPropsToJsonText(row.props)}`,
|
|
2271
2149
|
valid_from: (row) => chunkEDN4Y4ZG_cjs.sql`${sqlNull(row.valid_from)}`,
|
|
2272
2150
|
valid_to: (row) => chunkEDN4Y4ZG_cjs.sql`${sqlNull(row.valid_to)}`,
|
|
2273
2151
|
created_at: (row) => chunkEDN4Y4ZG_cjs.sql`${row.created_at}`,
|
|
2274
2152
|
updated_at: (row) => chunkEDN4Y4ZG_cjs.sql`${row.updated_at}`,
|
|
2275
2153
|
deleted_at: (row) => chunkEDN4Y4ZG_cjs.sql`${sqlNull(row.deleted_at)}`,
|
|
2276
2154
|
recorded_from: (_row, recordedRevision) => chunkEDN4Y4ZG_cjs.sql`${recordedRevision}`,
|
|
2277
|
-
recorded_to: () => chunkEDN4Y4ZG_cjs.sql`${
|
|
2155
|
+
recorded_to: () => chunkEDN4Y4ZG_cjs.sql`${chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION}`,
|
|
2278
2156
|
op: (_row, _recordedCommit, operation) => chunkEDN4Y4ZG_cjs.sql`${operation}`,
|
|
2279
2157
|
schema_version: () => chunkEDN4Y4ZG_cjs.sql`NULL`,
|
|
2280
2158
|
tx_id: () => chunkEDN4Y4ZG_cjs.sql`NULL`,
|
|
@@ -2309,7 +2187,7 @@ var recordedIdentityAssertionCells = {
|
|
|
2309
2187
|
ended_by_kind: (row) => chunkEDN4Y4ZG_cjs.sql`${row.ended_by_kind ?? chunkEDN4Y4ZG_cjs.sql.raw("NULL")}`,
|
|
2310
2188
|
ended_by_id: (row) => chunkEDN4Y4ZG_cjs.sql`${row.ended_by_id ?? chunkEDN4Y4ZG_cjs.sql.raw("NULL")}`,
|
|
2311
2189
|
recorded_from: (_row, recordedRevision) => chunkEDN4Y4ZG_cjs.sql`${recordedRevision}`,
|
|
2312
|
-
recorded_to: () => chunkEDN4Y4ZG_cjs.sql`${
|
|
2190
|
+
recorded_to: () => chunkEDN4Y4ZG_cjs.sql`${chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION}`,
|
|
2313
2191
|
op: (_row, _recordedRevision, operation) => chunkEDN4Y4ZG_cjs.sql`${operation}`
|
|
2314
2192
|
};
|
|
2315
2193
|
function recordedValuesTuple(columns, cells, row, recordedRevision, operation) {
|
|
@@ -2402,7 +2280,7 @@ async function closeOpenReturning(target, table, graphId, ids, recordedRevision,
|
|
|
2402
2280
|
SET recorded_to = ${recordedRevision}
|
|
2403
2281
|
WHERE graph_id = ${graphId}
|
|
2404
2282
|
${kindFilter}
|
|
2405
|
-
AND recorded_to = ${
|
|
2283
|
+
AND recorded_to = ${chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION}
|
|
2406
2284
|
AND id IN (${sqlValueList(ids)})
|
|
2407
2285
|
RETURNING id, deleted_at
|
|
2408
2286
|
`)
|
|
@@ -2447,7 +2325,7 @@ function recordedInsertsFor(afterById, closed) {
|
|
|
2447
2325
|
async function flushNodes(target, schema, graphId, entities, recordedRevision) {
|
|
2448
2326
|
const chunkSize = recordedNodeChunkSize(target);
|
|
2449
2327
|
for (const [kind, group] of groupNodesByKind(entities)) {
|
|
2450
|
-
for (const entityChunk of
|
|
2328
|
+
for (const entityChunk of chunkSIT26LAZ_cjs.chunk(group, chunkSize)) {
|
|
2451
2329
|
const ids = entityChunk.map((entity) => entity.id);
|
|
2452
2330
|
const closed = await closeOpenReturning(
|
|
2453
2331
|
target,
|
|
@@ -2472,7 +2350,7 @@ async function flushNodes(target, schema, graphId, entities, recordedRevision) {
|
|
|
2472
2350
|
}
|
|
2473
2351
|
async function flushEdges(target, schema, graphId, entities, recordedRevision) {
|
|
2474
2352
|
const chunkSize = recordedEdgeChunkSize(target);
|
|
2475
|
-
for (const entityChunk of
|
|
2353
|
+
for (const entityChunk of chunkSIT26LAZ_cjs.chunk(entities, chunkSize)) {
|
|
2476
2354
|
const ids = entityChunk.map((entity) => entity.id);
|
|
2477
2355
|
const closed = await closeOpenReturning(
|
|
2478
2356
|
target,
|
|
@@ -2508,7 +2386,7 @@ async function getIdentityAssertionRowsByIds(target, schema, graphId, ids) {
|
|
|
2508
2386
|
async function flushIdentityAssertions(target, schema, graphId, entities, recordedRevision) {
|
|
2509
2387
|
if (entities.length === 0) return;
|
|
2510
2388
|
const chunkSize = recordedIdentityAssertionChunkSize(target);
|
|
2511
|
-
for (const entityChunk of
|
|
2389
|
+
for (const entityChunk of chunkSIT26LAZ_cjs.chunk(entities, chunkSize)) {
|
|
2512
2390
|
const ids = entityChunk.map((entity) => entity.id);
|
|
2513
2391
|
const closed = await closeOpenReturning(
|
|
2514
2392
|
target,
|
|
@@ -2537,7 +2415,7 @@ async function closeOpenByKind(target, table, graphId, kind, recordedRevision) {
|
|
|
2537
2415
|
SET recorded_to = ${recordedRevision}
|
|
2538
2416
|
WHERE graph_id = ${graphId}
|
|
2539
2417
|
AND kind = ${kind}
|
|
2540
|
-
AND recorded_to = ${
|
|
2418
|
+
AND recorded_to = ${chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION}
|
|
2541
2419
|
`
|
|
2542
2420
|
);
|
|
2543
2421
|
}
|
|
@@ -2549,7 +2427,7 @@ async function closeOpenEdgesByNodeKind(target, schema, graphId, nodeKind, recor
|
|
|
2549
2427
|
SET recorded_to = ${recordedRevision}
|
|
2550
2428
|
WHERE graph_id = ${graphId}
|
|
2551
2429
|
AND (from_kind = ${nodeKind} OR to_kind = ${nodeKind})
|
|
2552
|
-
AND recorded_to = ${
|
|
2430
|
+
AND recorded_to = ${chunk2QGYQBS2_cjs.RECORDED_MAX_REVISION}
|
|
2553
2431
|
`
|
|
2554
2432
|
);
|
|
2555
2433
|
}
|
|
@@ -2813,7 +2691,7 @@ function createRecordedCaptureSession() {
|
|
|
2813
2691
|
if (touched.size === 0 && forcedGraphRevisions.size === 0)
|
|
2814
2692
|
return /* @__PURE__ */ new Map();
|
|
2815
2693
|
const recordedByGraph = /* @__PURE__ */ new Map();
|
|
2816
|
-
const byGraph =
|
|
2694
|
+
const byGraph = chunkSIT26LAZ_cjs.groupBy(touched.values(), (entity) => entity.graphId);
|
|
2817
2695
|
for (const graphId of forcedGraphRevisions) {
|
|
2818
2696
|
if (!byGraph.has(graphId)) byGraph.set(graphId, []);
|
|
2819
2697
|
}
|
|
@@ -2898,7 +2776,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
2898
2776
|
await lockRecordedGraphWrite(target, graphId, graphLocks);
|
|
2899
2777
|
}
|
|
2900
2778
|
}
|
|
2901
|
-
const overlay =
|
|
2779
|
+
const overlay = chunkSIT26LAZ_cjs.deriveBackend(target, {
|
|
2902
2780
|
...rawWriteGuards(target, "tx.backend"),
|
|
2903
2781
|
async insertNode(params) {
|
|
2904
2782
|
session.assertOpen();
|
|
@@ -3078,7 +2956,7 @@ function createRecordedTransactionScope(target, schema, ownsWriteLock = false) {
|
|
|
3078
2956
|
return {
|
|
3079
2957
|
backend: createRecordedTransactionBackend(target, session, resolvedSchema),
|
|
3080
2958
|
async flush() {
|
|
3081
|
-
return
|
|
2959
|
+
return chunkSIT26LAZ_cjs.withRecordedRelationsPrecondition(
|
|
3082
2960
|
session.flush(target, resolvedSchema, ownsWriteLock),
|
|
3083
2961
|
{ dialect: target.dialect, surface: "capture-flush" }
|
|
3084
2962
|
);
|
|
@@ -3098,8 +2976,8 @@ async function runCapturedAutocommit(backend, schema, fn, options) {
|
|
|
3098
2976
|
function createRecordedBackend(backend, schema) {
|
|
3099
2977
|
assertCapturableBackend(backend);
|
|
3100
2978
|
const capture = (fn) => runCapturedAutocommit(backend, schema, fn);
|
|
3101
|
-
const projectedBackend =
|
|
3102
|
-
return
|
|
2979
|
+
const projectedBackend = chunkSIT26LAZ_cjs.projectGraphBackend(backend);
|
|
2980
|
+
return chunkSIT26LAZ_cjs.deriveBackend(projectedBackend, {
|
|
3103
2981
|
...rawWriteGuards(backend, "backend"),
|
|
3104
2982
|
async insertNode(params) {
|
|
3105
2983
|
return capture((target) => target.insertNode(params));
|
|
@@ -3234,6 +3112,11 @@ function compareCodePoints(left, right) {
|
|
|
3234
3112
|
return leftExhausted ? -1 : 1;
|
|
3235
3113
|
}
|
|
3236
3114
|
|
|
3115
|
+
// src/utils/tuple-key.ts
|
|
3116
|
+
function encodeTupleKey(values) {
|
|
3117
|
+
return JSON.stringify(values);
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3237
3120
|
exports.CURRENT_READ_INSTANT_PLACEHOLDER = CURRENT_READ_INSTANT_PLACEHOLDER;
|
|
3238
3121
|
exports.IDENTITY_ASSERTION_COLUMNS = IDENTITY_ASSERTION_COLUMNS;
|
|
3239
3122
|
exports.IDENTITY_PEER_CLASS_COLUMNS = IDENTITY_PEER_CLASS_COLUMNS;
|
|
@@ -3254,13 +3137,13 @@ exports.compilePredicateClauses = compilePredicateClauses;
|
|
|
3254
3137
|
exports.compilePredicateExpression = compilePredicateExpression;
|
|
3255
3138
|
exports.compileTemporalFilter = compileTemporalFilter;
|
|
3256
3139
|
exports.createFulltextAccessor = createFulltextAccessor;
|
|
3257
|
-
exports.createGraphBackendProjection = createGraphBackendProjection;
|
|
3258
3140
|
exports.createRecordedBackend = createRecordedBackend;
|
|
3259
3141
|
exports.createRecordedTransactionScope = createRecordedTransactionScope;
|
|
3260
3142
|
exports.currentReadInstant = currentReadInstant;
|
|
3261
3143
|
exports.currentReadInstantFor = currentReadInstantFor;
|
|
3262
3144
|
exports.dateField = dateField;
|
|
3263
3145
|
exports.edgeInsertDispatch = edgeInsertDispatch;
|
|
3146
|
+
exports.encodeTupleKey = encodeTupleKey;
|
|
3264
3147
|
exports.ensureRevisionOrigin = ensureRevisionOrigin;
|
|
3265
3148
|
exports.exists = exists;
|
|
3266
3149
|
exports.extractFulltextMatchPredicates = extractFulltextMatchPredicates;
|
|
@@ -3290,7 +3173,6 @@ exports.notInSubquery = notInSubquery;
|
|
|
3290
3173
|
exports.numberField = numberField;
|
|
3291
3174
|
exports.objectField = objectField;
|
|
3292
3175
|
exports.param = param;
|
|
3293
|
-
exports.projectBackendMembers = projectBackendMembers;
|
|
3294
3176
|
exports.readRecordedClock = readRecordedClock;
|
|
3295
3177
|
exports.readRevisionOrigin = readRevisionOrigin;
|
|
3296
3178
|
exports.recordedBindParamBudget = recordedBindParamBudget;
|
|
@@ -3307,5 +3189,5 @@ exports.uncapturedGraphWriteLock = uncapturedGraphWriteLock;
|
|
|
3307
3189
|
exports.withPinnedReadInstant = withPinnedReadInstant;
|
|
3308
3190
|
exports.withRecordedFlushObserver = withRecordedFlushObserver;
|
|
3309
3191
|
exports.withRecordedIdentityMutationTarget = withRecordedIdentityMutationTarget;
|
|
3310
|
-
//# sourceMappingURL=chunk-
|
|
3311
|
-
//# sourceMappingURL=chunk-
|
|
3192
|
+
//# sourceMappingURL=chunk-EZEEWCFJ.cjs.map
|
|
3193
|
+
//# sourceMappingURL=chunk-EZEEWCFJ.cjs.map
|