@nicia-ai/typegraph 0.65.0 → 0.66.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/CHANGELOG.md +17 -0
- package/dist/{atomic-mutation-program-BznZQ06C.d.ts → atomic-mutation-program-BhP75Qn0.d.ts} +1 -1
- package/dist/{atomic-mutation-program-Bfu5z-je.d.cts → atomic-mutation-program-DMdmc4s0.d.cts} +1 -1
- package/dist/backend/drizzle/engine/index.cjs +13 -13
- package/dist/backend/drizzle/engine/index.d.cts +9 -9
- package/dist/backend/drizzle/engine/index.d.ts +9 -9
- package/dist/backend/drizzle/engine/index.js +8 -8
- package/dist/backend/drizzle/indexes.d.cts +1 -1
- package/dist/backend/drizzle/indexes.d.ts +1 -1
- package/dist/backend/index.cjs +91 -91
- package/dist/backend/index.d.cts +7 -7
- package/dist/backend/index.d.ts +7 -7
- package/dist/backend/index.js +8 -8
- package/dist/backend/postgres/index.cjs +23 -23
- package/dist/backend/postgres/index.d.cts +8 -8
- package/dist/backend/postgres/index.d.ts +8 -8
- package/dist/backend/postgres/index.js +8 -8
- package/dist/backend/postgres/pglite-store.cjs +1 -1
- package/dist/backend/postgres/pglite-store.d.cts +6 -6
- package/dist/backend/postgres/pglite-store.d.ts +6 -6
- package/dist/backend/postgres/pglite-store.js +1 -1
- package/dist/backend/postgres/pglite.cjs +10 -10
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +9 -9
- package/dist/backend/sqlite/index.cjs +21 -21
- package/dist/backend/sqlite/index.d.cts +7 -7
- package/dist/backend/sqlite/index.d.ts +7 -7
- package/dist/backend/sqlite/index.js +8 -8
- package/dist/backend/sqlite/libsql.cjs +14 -14
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +8 -8
- package/dist/backend/sqlite/local-store.cjs +1 -1
- package/dist/backend/sqlite/local-store.d.cts +6 -6
- package/dist/backend/sqlite/local-store.d.ts +6 -6
- package/dist/backend/sqlite/local-store.js +1 -1
- package/dist/backend/sqlite/local.cjs +10 -10
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +9 -9
- package/dist/{chunk-337ONI2I.js → chunk-3SUZXB5X.js} +146 -80
- package/dist/chunk-3SUZXB5X.js.map +1 -0
- package/dist/{chunk-4VTCIEK3.js → chunk-4TQOIBWH.js} +3 -3
- package/dist/{chunk-4VTCIEK3.js.map → chunk-4TQOIBWH.js.map} +1 -1
- package/dist/{chunk-JRWKRBI5.cjs → chunk-5JOCIMQ3.cjs} +6 -6
- package/dist/{chunk-JRWKRBI5.cjs.map → chunk-5JOCIMQ3.cjs.map} +1 -1
- package/dist/{chunk-BWQA3POT.cjs → chunk-6B3LQUYG.cjs} +206 -138
- package/dist/chunk-6B3LQUYG.cjs.map +1 -0
- package/dist/{chunk-RQPCUHIH.js → chunk-6ECNYQDW.js} +3 -3
- package/dist/{chunk-RQPCUHIH.js.map → chunk-6ECNYQDW.js.map} +1 -1
- package/dist/{chunk-OLB75LRQ.js → chunk-6GKKAQMW.js} +5 -5
- package/dist/{chunk-OLB75LRQ.js.map → chunk-6GKKAQMW.js.map} +1 -1
- package/dist/{chunk-OC5ROP7V.cjs → chunk-6JRVV2SS.cjs} +8 -2
- package/dist/chunk-6JRVV2SS.cjs.map +1 -0
- package/dist/{chunk-JERQGJKG.cjs → chunk-732VS5PW.cjs} +18 -18
- package/dist/{chunk-JERQGJKG.cjs.map → chunk-732VS5PW.cjs.map} +1 -1
- package/dist/{chunk-DSX3P4S5.cjs → chunk-76OB5RSH.cjs} +6 -6
- package/dist/{chunk-DSX3P4S5.cjs.map → chunk-76OB5RSH.cjs.map} +1 -1
- package/dist/{chunk-DHRLOQLQ.cjs → chunk-7LQTDGV5.cjs} +11 -11
- package/dist/{chunk-DHRLOQLQ.cjs.map → chunk-7LQTDGV5.cjs.map} +1 -1
- package/dist/{chunk-Q25QYSOH.js → chunk-7YJHUY4T.js} +9 -9
- package/dist/{chunk-Q25QYSOH.js.map → chunk-7YJHUY4T.js.map} +1 -1
- package/dist/{chunk-BBOMNH44.js → chunk-BABP4D5B.js} +3 -3
- package/dist/{chunk-BBOMNH44.js.map → chunk-BABP4D5B.js.map} +1 -1
- package/dist/{chunk-EVGZ2TRQ.js → chunk-BE75G3M5.js} +3 -3
- package/dist/{chunk-EVGZ2TRQ.js.map → chunk-BE75G3M5.js.map} +1 -1
- package/dist/{chunk-FXGZT3WO.cjs → chunk-BX42F7IJ.cjs} +41 -41
- package/dist/{chunk-FXGZT3WO.cjs.map → chunk-BX42F7IJ.cjs.map} +1 -1
- package/dist/{chunk-VROJKWZ7.js → chunk-C3HNC3S6.js} +5 -5
- package/dist/{chunk-VROJKWZ7.js.map → chunk-C3HNC3S6.js.map} +1 -1
- package/dist/{chunk-G6T23JU7.js → chunk-CDKNGCE7.js} +3 -3
- package/dist/{chunk-G6T23JU7.js.map → chunk-CDKNGCE7.js.map} +1 -1
- package/dist/{chunk-BNTJ5YFO.cjs → chunk-EACDHXJL.cjs} +4 -4
- package/dist/{chunk-BNTJ5YFO.cjs.map → chunk-EACDHXJL.cjs.map} +1 -1
- package/dist/{chunk-SNDJUTMB.cjs → chunk-EBQX7MYL.cjs} +72 -72
- package/dist/{chunk-SNDJUTMB.cjs.map → chunk-EBQX7MYL.cjs.map} +1 -1
- package/dist/{chunk-GKSAEUX6.js → chunk-FXOFJ4FS.js} +7 -7
- package/dist/{chunk-GKSAEUX6.js.map → chunk-FXOFJ4FS.js.map} +1 -1
- package/dist/{chunk-ZOWRACZQ.cjs → chunk-G7OKJDMG.cjs} +5 -5
- package/dist/{chunk-ZOWRACZQ.cjs.map → chunk-G7OKJDMG.cjs.map} +1 -1
- package/dist/{chunk-VZRXXABW.js → chunk-HSLP6CVG.js} +5 -5
- package/dist/{chunk-VZRXXABW.js.map → chunk-HSLP6CVG.js.map} +1 -1
- package/dist/{chunk-MKJPBSID.cjs → chunk-I7SBZJI2.cjs} +4 -4
- package/dist/{chunk-MKJPBSID.cjs.map → chunk-I7SBZJI2.cjs.map} +1 -1
- package/dist/{chunk-H346QK3V.cjs → chunk-K7YACILO.cjs} +9 -9
- package/dist/{chunk-H346QK3V.cjs.map → chunk-K7YACILO.cjs.map} +1 -1
- package/dist/{chunk-L2GBVYRU.cjs → chunk-MGCPSR4C.cjs} +11 -11
- package/dist/{chunk-L2GBVYRU.cjs.map → chunk-MGCPSR4C.cjs.map} +1 -1
- package/dist/{chunk-KDNRACRG.cjs → chunk-MRUOOAIQ.cjs} +4 -4
- package/dist/{chunk-KDNRACRG.cjs.map → chunk-MRUOOAIQ.cjs.map} +1 -1
- package/dist/{chunk-PFXNQFFY.js → chunk-MUEPEWMQ.js} +67 -8
- package/dist/chunk-MUEPEWMQ.js.map +1 -0
- package/dist/{chunk-HTSJTWUT.js → chunk-OF63ZHSD.js} +4 -4
- package/dist/{chunk-HTSJTWUT.js.map → chunk-OF63ZHSD.js.map} +1 -1
- package/dist/{chunk-NGA3THGU.cjs → chunk-QR7W37HG.cjs} +14 -14
- package/dist/{chunk-NGA3THGU.cjs.map → chunk-QR7W37HG.cjs.map} +1 -1
- package/dist/{chunk-QFEO4M5W.js → chunk-RTPMG6LQ.js} +11 -11
- package/dist/{chunk-QFEO4M5W.js.map → chunk-RTPMG6LQ.js.map} +1 -1
- package/dist/{chunk-PFD4NUYV.js → chunk-SSDHR2C2.js} +3 -3
- package/dist/{chunk-PFD4NUYV.js.map → chunk-SSDHR2C2.js.map} +1 -1
- package/dist/{chunk-THK3SCQA.js → chunk-SYXTWPX6.js} +5 -5
- package/dist/{chunk-THK3SCQA.js.map → chunk-SYXTWPX6.js.map} +1 -1
- package/dist/{chunk-XSLQYGNR.cjs → chunk-T3VU3YRQ.cjs} +69 -69
- package/dist/{chunk-XSLQYGNR.cjs.map → chunk-T3VU3YRQ.cjs.map} +1 -1
- package/dist/{chunk-MIBWA6HX.js → chunk-TR7QTODF.js} +213 -33
- package/dist/chunk-TR7QTODF.js.map +1 -0
- package/dist/{chunk-AD3NLSV5.js → chunk-TU22BFMP.js} +8 -2
- package/dist/chunk-TU22BFMP.js.map +1 -0
- package/dist/{chunk-WTMSUIRO.js → chunk-UFKYMQJ5.js} +3 -3
- package/dist/{chunk-WTMSUIRO.js.map → chunk-UFKYMQJ5.js.map} +1 -1
- package/dist/{chunk-35LDKSMM.cjs → chunk-VNJMM2QQ.cjs} +30 -30
- package/dist/{chunk-35LDKSMM.cjs.map → chunk-VNJMM2QQ.cjs.map} +1 -1
- package/dist/{chunk-53ZEBIMD.js → chunk-WB55URNM.js} +6 -6
- package/dist/{chunk-53ZEBIMD.js.map → chunk-WB55URNM.js.map} +1 -1
- package/dist/{chunk-D2JPOFRZ.cjs → chunk-WY3IFEKV.cjs} +191 -191
- package/dist/{chunk-D2JPOFRZ.cjs.map → chunk-WY3IFEKV.cjs.map} +1 -1
- package/dist/{chunk-3KWF25MF.cjs → chunk-XQNKN3UF.cjs} +305 -246
- package/dist/chunk-XQNKN3UF.cjs.map +1 -0
- package/dist/{chunk-3RSFLZ7A.cjs → chunk-Y4X6ODVY.cjs} +943 -763
- package/dist/chunk-Y4X6ODVY.cjs.map +1 -0
- package/dist/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/{ddl-DvW9aobX.d.ts → ddl-2q7xLM1X.d.ts} +3 -3
- package/dist/{ddl-BjuXbPfw.d.cts → ddl-D_09BfbN.d.cts} +3 -3
- package/dist/graph-extension/index.d.cts +2 -2
- package/dist/graph-extension/index.d.ts +2 -2
- package/dist/graph-merge/index.cjs +156 -156
- package/dist/graph-merge/index.d.cts +7 -7
- package/dist/graph-merge/index.d.ts +7 -7
- package/dist/graph-merge/index.js +14 -14
- package/dist/{graph-templates-1vMqlPsu.d.cts → graph-templates-B5Q7oYAA.d.cts} +2 -2
- package/dist/{graph-templates-Y52w16dH.d.ts → graph-templates-D9N-Z9kw.d.ts} +2 -2
- package/dist/index.cjs +99 -99
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +18 -18
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/{ingestion-import-target-CCKeXZbW.d.ts → ingestion-import-target-B8EU6ug2.d.ts} +1 -1
- package/dist/{ingestion-import-target-774QRgkF.d.cts → ingestion-import-target-C5sHNFJF.d.cts} +1 -1
- package/dist/interchange/index.cjs +34 -34
- package/dist/interchange/index.d.cts +7 -7
- package/dist/interchange/index.d.ts +7 -7
- package/dist/interchange/index.js +11 -11
- package/dist/{local-store-impl-3E4VLFCI.cjs → local-store-impl-J6TJG45N.cjs} +22 -22
- package/dist/{local-store-impl-3E4VLFCI.cjs.map → local-store-impl-J6TJG45N.cjs.map} +1 -1
- package/dist/{local-store-impl-DFKS7QTV.js → local-store-impl-XKWR46WQ.js} +18 -18
- package/dist/{local-store-impl-DFKS7QTV.js.map → local-store-impl-XKWR46WQ.js.map} +1 -1
- package/dist/{pglite-store-impl-T75O3LVQ.cjs → pglite-store-impl-KXD5VWC5.cjs} +22 -22
- package/dist/{pglite-store-impl-T75O3LVQ.cjs.map → pglite-store-impl-KXD5VWC5.cjs.map} +1 -1
- package/dist/{pglite-store-impl-N63GGBU2.js → pglite-store-impl-LRZ4TO3H.js} +18 -18
- package/dist/{pglite-store-impl-N63GGBU2.js.map → pglite-store-impl-LRZ4TO3H.js.map} +1 -1
- package/dist/{postgres-2FYdVYCm.d.cts → postgres-BIm6TDfF.d.cts} +3 -3
- package/dist/{postgres-C9gitL71.d.ts → postgres-CRRB2qzy.d.ts} +3 -3
- package/dist/{postgres-BONrXHb4.d.cts → postgres-DOBXcZVg.d.cts} +1 -1
- package/dist/{postgres-DAFRdnTr.d.ts → postgres-DhZixg92.d.ts} +1 -1
- package/dist/{profile-Bmcg07Ki.d.cts → profile-CjAffcQt.d.cts} +2 -2
- package/dist/{profile-CAD65CqS.d.ts → profile-DVd70NA-.d.ts} +2 -2
- package/dist/profiler/index.d.cts +8 -8
- package/dist/profiler/index.d.ts +8 -8
- package/dist/provenance/index.cjs +22 -22
- package/dist/provenance/index.d.cts +6 -6
- package/dist/provenance/index.d.ts +6 -6
- package/dist/provenance/index.js +6 -6
- package/dist/{repair-validity-windows-CinP91t7.d.cts → repair-validity-windows-CpP_GpIx.d.cts} +1 -1
- package/dist/{repair-validity-windows-BJz4nffP.d.ts → repair-validity-windows-lfe275bY.d.ts} +1 -1
- package/dist/{resolve-DgOSlXx_.d.ts → resolve-CoYqHqno.d.cts} +7 -2
- package/dist/{resolve-DQXSEN_A.d.cts → resolve-DV0Iposp.d.ts} +7 -2
- package/dist/schema/index.cjs +37 -37
- package/dist/schema/index.d.cts +7 -7
- package/dist/schema/index.d.ts +7 -7
- package/dist/schema/index.js +7 -7
- package/dist/{searchable-DMdCwkXO.d.cts → searchable-C7Xt6g45.d.cts} +1 -1
- package/dist/{searchable-BPRF0Bah.d.ts → searchable-KKXrPet3.d.ts} +1 -1
- package/dist/{sqlite-DcDAAYow.d.ts → sqlite-BNwQ5pd7.d.ts} +3 -3
- package/dist/{sqlite-DgbYa-1Y.d.cts → sqlite-BkQM9ZeI.d.cts} +1 -1
- package/dist/{sqlite-UlG5prJQ.d.ts → sqlite-CcCSeXGg.d.ts} +1 -1
- package/dist/{sqlite-Co_uIpfs.d.cts → sqlite-DX9H3L7z.d.cts} +3 -3
- package/dist/{store-HxoFyQMu.d.cts → store-3nfPQK5j.d.cts} +30 -7
- package/dist/{store-C9T1c9Az.d.ts → store-C8ZPl7OW.d.ts} +30 -7
- package/dist/{types-CRCyg1fJ.d.cts → types-BynPp5kU.d.cts} +18 -2
- package/dist/{types-CRCyg1fJ.d.ts → types-BynPp5kU.d.ts} +18 -2
- package/dist/{types-Dg_prBqC.d.ts → types-C9YwrkSe.d.ts} +1 -1
- package/dist/{types-B5AUesS1.d.cts → types-JG-4CG6P.d.cts} +1 -1
- package/dist/{where-gRyc3jj_.d.cts → where-D1gBDqQ_.d.cts} +1 -1
- package/dist/{where-D-NDKMPw.d.ts → where-D2GqMFp-.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-337ONI2I.js.map +0 -1
- package/dist/chunk-3KWF25MF.cjs.map +0 -1
- package/dist/chunk-3RSFLZ7A.cjs.map +0 -1
- package/dist/chunk-AD3NLSV5.js.map +0 -1
- package/dist/chunk-BWQA3POT.cjs.map +0 -1
- package/dist/chunk-MIBWA6HX.js.map +0 -1
- package/dist/chunk-OC5ROP7V.cjs.map +0 -1
- package/dist/chunk-PFXNQFFY.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSqlSchema } from './chunk-
|
|
1
|
+
import { createSqlSchema } from './chunk-TU22BFMP.js';
|
|
2
2
|
|
|
3
3
|
// src/backend/table-names.ts
|
|
4
4
|
var LEGACY_EMBEDDINGS_TABLE_NAME = "typegraph_node_embeddings";
|
|
@@ -16,5 +16,5 @@ function resolvedTableNames(backend, override) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export { LEGACY_EMBEDDINGS_TABLE_NAME, resolvedTableNames };
|
|
19
|
-
//# sourceMappingURL=chunk-
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
19
|
+
//# sourceMappingURL=chunk-BABP4D5B.js.map
|
|
20
|
+
//# sourceMappingURL=chunk-BABP4D5B.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/backend/table-names.ts"],"names":[],"mappings":";;;AAiBO,IAAM,4BAAA,GAA+B;AAE5C,SAAS,0BACP,QAAA,EACwB;AACxB,EAAA,IAAI,QAAA,KAAa,MAAA,EAAW,OAAO,EAAC;AACpC,EAAA,OAAO,MAAA,CAAO,WAAA;AAAA,IACZ,MAAA,CAAO,OAAA,CAAQ,QAAQ,CAAA,CAAE,MAAA,CAAO,CAAC,GAAG,SAAS,CAAA,KAAM,SAAA,KAAc,MAAS;AAAA,GAC5E;AACF;AAYO,SAAS,kBAAA,CACd,SACA,QAAA,EACuB;AACvB,EAAA,OAAO,eAAA,CAAgB;AAAA,IACrB,GAAG,OAAA,CAAQ,UAAA;AAAA,IACX,GAAG,0BAA0B,QAAQ;AAAA,GACtC,CAAA,CAAE,MAAA;AACL","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/backend/table-names.ts"],"names":[],"mappings":";;;AAiBO,IAAM,4BAAA,GAA+B;AAE5C,SAAS,0BACP,QAAA,EACwB;AACxB,EAAA,IAAI,QAAA,KAAa,MAAA,EAAW,OAAO,EAAC;AACpC,EAAA,OAAO,MAAA,CAAO,WAAA;AAAA,IACZ,MAAA,CAAO,OAAA,CAAQ,QAAQ,CAAA,CAAE,MAAA,CAAO,CAAC,GAAG,SAAS,CAAA,KAAM,SAAA,KAAc,MAAS;AAAA,GAC5E;AACF;AAYO,SAAS,kBAAA,CACd,SACA,QAAA,EACuB;AACvB,EAAA,OAAO,eAAA,CAAgB;AAAA,IACrB,GAAG,OAAA,CAAQ,UAAA;AAAA,IACX,GAAG,0BAA0B,QAAQ;AAAA,GACtC,CAAA,CAAE,MAAA;AACL","file":"chunk-BABP4D5B.js","sourcesContent":["/**\n * The one owner of \"which physical relations does this offline operation\n * touch?\" for the maintenance entrypoints that accept a `tableNames` override.\n */\nimport {\n createSqlSchema,\n type ResolvedSqlTableNames,\n type SqlTableNames,\n} from \"../query/compiler/schema\";\nimport type { GraphBackend } from \"./types\";\n\n/**\n * Physical name of the legacy single shared embeddings table, dropped in\n * the cross-backend vector cutover (the clean cut of #157). Strategies now\n * own per-`(nodeKind, fieldPath)` typed storage. Retained only so the\n * one-time migration utility can address and drain the old table.\n */\nexport const LEGACY_EMBEDDINGS_TABLE_NAME = \"typegraph_node_embeddings\";\n\nfunction definedTableNameOverrides(\n override: Partial<SqlTableNames> | undefined,\n): Partial<SqlTableNames> {\n if (override === undefined) return {};\n return Object.fromEntries(\n Object.entries(override).filter(([, tableName]) => tableName !== undefined),\n );\n}\n\n/**\n * Resolves the relations an offline maintenance call targets.\n *\n * An override is a PATCH over the backend's own names. This matches the\n * `Partial<SqlTableNames>` input contract: naming only `nodes`, for example,\n * must not silently retarget edges and recorded relations to the built-in\n * defaults. `migrateLegacyRecordedTime` and\n * `repairInvertedValidityWindows` share this owner so an offline write can never\n * resolve the same partial override two different ways.\n */\nexport function resolvedTableNames(\n backend: Pick<GraphBackend, \"tableNames\">,\n override: Partial<SqlTableNames> | undefined,\n): ResolvedSqlTableNames {\n return createSqlSchema({\n ...backend.tableNames,\n ...definedTableNameOverrides(override),\n }).tables;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CLAIMS, UNIQUE_SIDECAR_BATCH, BATCH_POINT_READ, ENDPOINT_SET_READ, STATEMENT_EXECUTION, CONTRIBUTION_HEALTH, RECORDED_REVISION_ORIGINS } from './chunk-
|
|
1
|
+
import { CLAIMS, UNIQUE_SIDECAR_BATCH, BATCH_POINT_READ, ENDPOINT_SET_READ, STATEMENT_EXECUTION, CONTRIBUTION_HEALTH, RECORDED_REVISION_ORIGINS } from './chunk-TU22BFMP.js';
|
|
2
2
|
import { requireDefined, createDataKeyedBag } from './chunk-QD2JFTSL.js';
|
|
3
3
|
import { ConfigurationError } from './chunk-GMKPIYHY.js';
|
|
4
4
|
|
|
@@ -187,5 +187,5 @@ function requireCatalog(backend, operation) {
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
export { REVISION_COLUMN_KINDS, WALL_TIME_COLUMN_KINDS, batchPointReadVerdict, claimsVerdict, contributionHealthVerdict, createClaimsVerdictThunk, endpointSetReadVerdict, missingRequiredExtras, recordedRevisionOriginsVerdict, requireCatalog, requireExtras, resolveBundle, statementExecutionVerdict, uniqueSidecarBatchVerdict };
|
|
190
|
-
//# sourceMappingURL=chunk-
|
|
191
|
-
//# sourceMappingURL=chunk-
|
|
190
|
+
//# sourceMappingURL=chunk-BE75G3M5.js.map
|
|
191
|
+
//# sourceMappingURL=chunk-BE75G3M5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/backend/capabilities/resolve.ts","../src/backend/capabilities/catalog.ts"],"names":[],"mappings":";;;;;AA8IA,SAAS,aAAA,CAMP,SACA,MAAA,EAIC;AACD,EAAA,MAAM,WACJ,kBAAA,EAA6D;AAC/D,EAAA,MAAM,gBAA0B,EAAC;AACjC,EAAA,KAAA,MAAW,SAAS,MAAA,EAAQ;AAC1B,IAAA,MAAM,OAAA,GAAU,MAAM,OAAA,CAAQ,MAAA;AAAA,MAC5B,CAAC,MAAA,KAAW,OAAA,CAAQ,MAAM,CAAA,KAAM;AAAA,KAClC;AACA,IAAA,IAAI,OAAA,CAAQ,WAAW,CAAA,EAAG;AACxB,MAAA,QAAA,CAAS,KAAA,CAAM,EAAE,CAAA,GAAI,EAAE,SAAS,IAAA,EAAM,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,IAC/D,CAAA,MAAO;AACL,MAAA,QAAA,CAAS,KAAA,CAAM,EAAE,CAAA,GAAI;AAAA,QACnB,OAAA,EAAS,KAAA;AAAA,QACT,OAAA;AAAA,QACA,aAAa,KAAA,CAAM;AAAA,OACrB;AACA,MAAA,aAAA,CAAc,IAAA,CAAK,MAAM,EAAE,CAAA;AAAA,IAC7B;AAAA,EACF;AACA,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,QAAA;AAAA,IACR;AAAA,GACF;AACF;AAgBA,SAAS,kCAAA,CACP,SACA,UAAA,EAKM;AACN,EAAA,IAAI,UAAA,CAAW,gBAAgB,MAAA,EAAW;AAC1C,EAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,YAAA,CAAa,UAAA,CAAW,WAAW,CAAA,KAAM,IAAA;AAClE,EAAA,MAAM,OAAA,GAAU,WAAW,IAAA,CAAK,MAAA;AAAA,IAC9B,CAAC,MAAA,KAAW,OAAA,CAAQ,MAAM,CAAA,KAAM;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AE,KAAA,EAAO,QAAA,EAAU,KAAA,EAAM;AAChC,QAAA,MAAM,KAAA;AAAA,MACR;AAAA,IACF;AACA,IAAA,IAAI,IAAA,CAAK,KAAA,KAAU,QAAA,EAAU,MAAM,IAAA,CAAK,KAAA;AACxC,IAAA,OAAO,IAAA,CAAK,OAAA;AAAA,EACd,CAAA;AAEA,EAAA,qBAAA,CAAsB,GAAA,CAAI,SAAS,KAAK,CAAA;AACxC,EAAA,OAAO,KAAA;AACT;;;ACzdO,IAAM,qBAAA,GAAyD;AAAA,EACpE;AACF;AAWO,IAAM,sBAAA,GAA0D;AAAA,EACrE,MAAA;AAAA,EACA;AACF;AAmHO,SAAS,cAAA,CACd,SACA,SAAA,EACsB;AACtB,EAAA,MAAM,UAAU,OAAA,CAAQ,OAAA;AACxB,EAAA,IAAI,YAAY,MAAA,EAAW;AACzB,IAAA,MAAM,IAAI,kBAAA;AAAA,MACR,GAAG,SAAS,CAAA,iFAAA,CAAA;AAAA,MACZ,EAAE,IAAA,EAAM,qBAAA,EAAuB,SAAA,EAAU;AAAA,MACzC;AAAA,QACE,UAAA,EACE;AAAA;AACJ,KACF;AAAA,EACF;AACA,EAAA,OAAO,OAAA;AACT","file":"chunk-EVGZ2TRQ.js","sourcesContent":["/**\n * The bundle verdict resolver — generalizing `claimSupport`\n * (`store/claims/backing.ts`).\n *\n * Resolution splits in two (ruling B1): the VERDICT — the support decision,\n * resolved once against `GraphBackend` and threaded — and the BINDING\n * (`bind.ts`) — the actual member functions, bound at the call site off\n * whichever port the site holds. A verdict carries names, never functions\n * (I19), so it crosses transaction boundaries safely.\n */\nimport { ConfigurationError } from \"../../errors\";\nimport { createDataKeyedBag } from \"../../utils/object\";\nimport { requireDefined } from \"../../utils/presence\";\nimport { type BackendCapabilities, type GraphBackend } from \"../types\";\nimport {\n BATCH_POINT_READ,\n type CapabilityBundleDefinition,\n type CapabilityBundleDisposition,\n type CapabilityBundleExtra,\n CLAIMS,\n CONTRIBUTION_HEALTH,\n ENDPOINT_SET_READ,\n type OptionalGraphBackendMember,\n RECORDED_REVISION_ORIGINS,\n STATEMENT_EXECUTION,\n UNIQUE_SIDECAR_BATCH,\n} from \"./bundle-registry\";\n\n/**\n * A bundle's extras, as a type-level map from extra id to the UNION of\n * member names that extra covers — derived from the definition's `extras`\n * array by `const` inference, never hand-written.\n */\nexport type CapabilityExtraSpec = Readonly<\n Record<string, OptionalGraphBackendMember>\n>;\n\n/**\n * One extra's verdict. `present: true` carries the member NAMES, not the\n * member functions (ruling B1) — the names are what the accessor binds\n * from, at the site, off the port.\n */\nexport type ExtraVerdict<M extends OptionalGraphBackendMember> =\n | Readonly<{ present: true; members: readonly M[] }>\n | Readonly<{\n present: false;\n missing: readonly M[];\n disposition: CapabilityBundleDisposition;\n }>;\n\n/** The verdict map: one entry per extra id, never a boolean. */\nexport type ExtraVerdicts<X extends CapabilityExtraSpec> = Readonly<{\n [K in keyof X]: ExtraVerdict<X[K]>;\n}>;\n\nexport type GatedBundleVerdict<\n MCore extends OptionalGraphBackendMember,\n X extends CapabilityExtraSpec,\n> =\n | Readonly<{\n supported: true;\n bundle: string;\n /** The core, guaranteed present. Names, not functions. */\n members: readonly MCore[];\n extras: ExtraVerdicts<X>;\n /** The `present: false` keys of `extras`. */\n missingExtras: readonly (keyof X)[];\n }>\n | Readonly<{\n supported: false;\n bundle: string;\n missing: readonly MCore[];\n /** Why it is unsupported: the bundle's own `disposition`, verbatim. */\n disposition: CapabilityBundleDisposition;\n }>;\n\n/** No `supported` field: a graduated bundle has no bundle-level verdict. */\nexport type GraduatedBundleVerdict<X extends CapabilityExtraSpec> = Readonly<{\n bundle: string;\n extras: ExtraVerdicts<X>;\n missingExtras: readonly (keyof X)[];\n}>;\n\n/**\n * Recovers the id→members map from a definition's `extras` TUPLE (not\n * `readonly CapabilityBundleExtra<XId, MExtra>[]` — over the array type the\n * id→members association is erased and `ExtraVerdicts<X>` degenerates to an\n * index signature).\n */\nexport type SpecOf<\n XS extends readonly CapabilityBundleExtra<\n string,\n OptionalGraphBackendMember\n >[],\n> = { [K in XS[number] as K[\"id\"]]: K[\"members\"][number] };\n\nexport type ExtrasOf<D extends CapabilityBundleDefinition> = SpecOf<\n NonNullable<D[\"extras\"]>\n>;\nexport type ExtraMember<\n D extends CapabilityBundleDefinition,\n X extends keyof ExtrasOf<D>,\n> = Extract<ExtrasOf<D>[X], OptionalGraphBackendMember>;\n\n/**\n * The definition union and the return-type mapping. Structural, matching\n * `bundle-registry.ts`'s `BundleMembers` helper's own lesson: reading `core`\n * off `D` directly (rather than re-matching `GatedBundleDefinition`) avoids\n * an unmatched `infer` silently widening to the member constraint.\n */\nexport type BundleVerdictOf<D extends CapabilityBundleDefinition> =\n D extends (\n {\n kind: \"graduated\";\n extras: infer XS extends readonly CapabilityBundleExtra<\n string,\n OptionalGraphBackendMember\n >[];\n }\n ) ?\n GraduatedBundleVerdict<SpecOf<XS>>\n : D extends (\n {\n kind: \"gated\";\n core: readonly (infer MCore extends OptionalGraphBackendMember)[];\n extras?: infer XS extends\n | readonly CapabilityBundleExtra<string, OptionalGraphBackendMember>[]\n | undefined;\n }\n ) ?\n GatedBundleVerdict<\n MCore,\n SpecOf<\n XS extends (\n readonly CapabilityBundleExtra<string, OptionalGraphBackendMember>[]\n ) ?\n XS\n : []\n >\n >\n : never;\n\nfunction resolveExtras<\n const XS extends readonly CapabilityBundleExtra<\n string,\n OptionalGraphBackendMember\n >[],\n>(\n backend: GraphBackend,\n extras: XS,\n): Readonly<{\n extras: ExtraVerdicts<SpecOf<XS>>;\n missingExtras: readonly (keyof SpecOf<XS>)[];\n}> {\n const verdicts =\n createDataKeyedBag<ExtraVerdict<OptionalGraphBackendMember>>();\n const missingExtras: string[] = [];\n for (const extra of extras) {\n const missing = extra.members.filter(\n (member) => backend[member] === undefined,\n );\n if (missing.length === 0) {\n verdicts[extra.id] = { present: true, members: extra.members };\n } else {\n verdicts[extra.id] = {\n present: false,\n missing,\n disposition: extra.disposition,\n };\n missingExtras.push(extra.id);\n }\n }\n return {\n extras: verdicts as ExtraVerdicts<SpecOf<XS>>,\n missingExtras: missingExtras,\n };\n}\n\n/**\n * The `claims` bidirectional cross-check (ruling F2), reproducing\n * `store/claims/backing.ts`'s pre-B7 message text, code and suggestion\n * BYTE-FOR-BYTE. B7 made `claimSupport` (`backing.ts`) delegate to\n * {@link resolveBundle}, so this is now the ONLY place the check runs — there\n * is no second copy left to keep in sync. `bidirectional` is `claims`-only by\n * design (§5.2.1): the two trailing sentences below name \"claim\"/\"fence\"\n * vocabulary that is specific to that one bundle, and a future bundle raising\n * `crossCheck` to `\"bidirectional\"` must carry its own justification row and,\n * with it, its own message pair here.\n *\n * @throws {ConfigurationError} when the declaration and the member surface\n * disagree in either direction.\n */\nfunction assertClaimsBidirectionalAgreement(\n backend: GraphBackend,\n definition: Readonly<{\n declaration?: keyof BackendCapabilities;\n core: readonly OptionalGraphBackendMember[];\n portSurfaceCode: string;\n }>,\n): void {\n if (definition.declaration === undefined) return;\n const declared = backend.capabilities[definition.declaration] === true;\n const present = definition.core.filter(\n (member) => backend[member] !== undefined,\n );\n if (declared && present.length === definition.core.length) return;\n if (!declared && present.length === 0) return;\n\n const missing = definition.core.filter(\n (member) => backend[member] === undefined,\n );\n const declarationName = definition.declaration;\n throw new ConfigurationError(\n declared ?\n `This backend declares \\`${declarationName}: true\\` but does not implement ${missing.join(\", \")}. ` +\n \"A declared constraint would then be written without the fence the declaration promises.\"\n : `This backend implements ${present.join(\", \")} but does not declare \\`${declarationName}: true\\`. ` +\n \"Claim support is read from the declaration, so these members would never be called.\",\n { code: definition.portSurfaceCode, missing, present },\n {\n suggestion:\n declared ?\n `Implement the missing members, or drop \\`${declarationName}\\` from the backend's capabilities.`\n : `Declare \\`${declarationName}: true\\` in the backend's capabilities, or drop the claim members.`,\n },\n );\n}\n\n/**\n * Resolved ONCE, at construction or entry, against the top-level backend —\n * never against a `TransactionBackend` (I15's `@ts-expect-error` row).\n *\n * Rules: the member surface is read always; the declaration is read only\n * when the definition names one AND `crossCheck !== \"none\"` (only `claims`\n * qualifies in the pilot registry); a gated bundle's core must be complete\n * or the bundle is unsupported with `missing`; a graduated bundle has no\n * bundle-level verdict, only per-extra verdicts. `missingExtras` is built by\n * the SAME fold that builds `extras` (one pass, one owner).\n */\nexport function resolveBundle<const D extends CapabilityBundleDefinition>(\n backend: GraphBackend,\n definition: D,\n): BundleVerdictOf<D> {\n const extras = (definition.extras ?? []) as readonly CapabilityBundleExtra<\n string,\n OptionalGraphBackendMember\n >[];\n const { extras: extraVerdicts, missingExtras } = resolveExtras(\n backend,\n extras,\n );\n\n // Rule 1: the declaration is read whenever `crossCheck !== \"none\"`,\n // regardless of kind — a graduated bundle's \"core\" for this purpose is the\n // union of every extra's members, since it has no core of its own. Only\n // `claims` (gated) exercises this in the pilot registry, but the check\n // itself must not silently no-op for a hypothetical graduated bidirectional\n // bundle (T11's mutation pins exactly this).\n if (definition.crossCheck === \"bidirectional\") {\n const memberSet =\n definition.kind === \"gated\" ?\n definition.core\n : extras.flatMap((extra) => extra.members);\n assertClaimsBidirectionalAgreement(backend, {\n ...(definition.declaration === undefined ?\n {}\n : { declaration: definition.declaration }),\n core: memberSet,\n portSurfaceCode: definition.portSurfaceCode,\n });\n }\n\n if (definition.kind === \"graduated\") {\n return {\n bundle: definition.id,\n extras: extraVerdicts,\n missingExtras,\n } as unknown as BundleVerdictOf<D>;\n }\n\n const missing = definition.core.filter(\n (member) => backend[member] === undefined,\n );\n if (missing.length > 0) {\n return {\n supported: false,\n bundle: definition.id,\n missing,\n disposition: definition.disposition,\n } as unknown as BundleVerdictOf<D>;\n }\n return {\n supported: true,\n bundle: definition.id,\n members: definition.core,\n extras: extraVerdicts,\n missingExtras,\n } as unknown as BundleVerdictOf<D>;\n}\n\n/** The literal operation names a bundle's `operations` table declares. */\nexport type OperationNames<D extends CapabilityBundleDefinition> =\n D[\"operations\"][number][\"operation\"];\n\n/** The extras a named operation `requires`, read from the ROW — never re-spelled at the call site. */\nexport type RequiredExtrasOf<\n D extends CapabilityBundleDefinition,\n Op extends OperationNames<D>,\n> =\n Extract<D[\"operations\"][number], { operation: Op }> extends (\n { requires: infer R extends readonly string[] }\n ) ?\n R[number]\n : never;\n\n/**\n * The registry's row lookup plus the presence fold, extracted verbatim from\n * {@link requireExtras}'s body (ruling B8 spec item 3): the ONE owner of\n * \"what this operation requires\" that both `requireExtras`'s default throw\n * and a call site's own `refuse` callback consult.\n *\n * `operation` is the literal key of the bundle's `operations` tuple, so the\n * required extras are looked up TYPE-LEVEL from the registry — no second\n * spelling of `requires` at the call site.\n *\n * @throws {ConfigurationError} naming the unknown operation when `operation`\n * is not a row of `definition.operations`.\n */\nexport function missingRequiredExtras<\n const D extends CapabilityBundleDefinition,\n Op extends OperationNames<D>,\n>(\n definition: D,\n verdict: BundleVerdictOf<D>,\n operation: Op,\n): readonly string[] {\n const row = definition.operations.find(\n (candidate) => candidate.operation === operation,\n );\n if (row === undefined) {\n throw new ConfigurationError(\n `Unknown operation \"${operation}\" for capability bundle \"${definition.id}\".`,\n { bundle: definition.id, operation },\n );\n }\n const required = row.requires ?? [];\n const extras:\n | Readonly<Record<string, ExtraVerdict<OptionalGraphBackendMember>>>\n | undefined = \"extras\" in verdict ? verdict.extras : undefined;\n return required.filter(\n (id) => extras === undefined || extras[id]?.present !== true,\n );\n}\n\n/**\n * The refusal for an operation whose `requires` extras are absent — how a\n * GRADUATED bundle refuses where the tree refuses today: the row names the\n * operation and the extras, this asserts they are present, and\n * {@link bindExtra} (`bind.ts`) binds them off the port.\n *\n * `refuse`, when supplied, is called instead of the registry-coded throw\n * below — this is how a call site keeps its OWN existing error text (message,\n * `details` shape, order relative to other refusals) while the registry\n * stays the one owner of \"what this operation requires\" (ruling B8 spec item\n * 3). Omitting it keeps the default behavior byte-identical to before this\n * parameter existed.\n *\n * @throws {ConfigurationError} naming the row's own `code` when one or more\n * required extras is absent from the verdict and no `refuse` callback is\n * supplied; otherwise calls `refuse(missing)`, which never returns.\n */\nexport function requireExtras<\n const D extends CapabilityBundleDefinition,\n Op extends OperationNames<D>,\n>(\n definition: D,\n verdict: BundleVerdictOf<D>,\n operation: Op,\n refuse?: (missing: readonly string[]) => never,\n): asserts verdict is BundleVerdictOf<D> & {\n extras: {\n [K in RequiredExtrasOf<D, Op> & keyof ExtrasOf<D>]: Extract<\n ExtraVerdict<ExtraMember<D, K>>,\n { present: true }\n >;\n };\n} {\n const missing = missingRequiredExtras(definition, verdict, operation);\n if (missing.length === 0) return;\n\n if (refuse !== undefined) refuse(missing);\n\n // `missingRequiredExtras` already threw the unknown-operation error above\n // when the row would be undefined, so `requireDefined` here is a redundant\n // (never-failing) narrowing, not a second lookup that could disagree.\n const { disposition } = requireDefined(\n definition.operations.find(\n (candidate) => candidate.operation === operation,\n ),\n );\n if (disposition.kind === \"refuse\") {\n throw new ConfigurationError(\n `Operation \"${operation}\" on capability bundle \"${definition.id}\" requires ${missing.join(\", \")}.`,\n { code: disposition.code, bundle: definition.id, operation, missing },\n );\n }\n // No pilot row reaches this: every row with a non-empty `requires` in the\n // registry disposes `refuse` (a graduated bundle's fallback rows never\n // name `requires` — the fallback IS the degrade path). Kept as a named,\n // typed refusal rather than a silent pass so a future `fallback` +\n // `requires` row cannot pass `requireExtras` unnoticed.\n throw new ConfigurationError(\n `Operation \"${operation}\" on capability bundle \"${definition.id}\" requires ${missing.join(\", \")}, and the registry names no refusal code for this fallback-dispositioned row.`,\n { bundle: definition.id, operation, missing },\n );\n}\n\n// ---------------------------------------------------------------------------\n// The seven named verdict accessors — GraphBackend-only, no exceptions (I15).\n// ---------------------------------------------------------------------------\n\nexport function claimsVerdict(\n backend: GraphBackend,\n): BundleVerdictOf<typeof CLAIMS> {\n return resolveBundle(backend, CLAIMS);\n}\n\nexport function uniqueSidecarBatchVerdict(\n backend: GraphBackend,\n): BundleVerdictOf<typeof UNIQUE_SIDECAR_BATCH> {\n return resolveBundle(backend, UNIQUE_SIDECAR_BATCH);\n}\n\nexport function batchPointReadVerdict(\n backend: GraphBackend,\n): BundleVerdictOf<typeof BATCH_POINT_READ> {\n return resolveBundle(backend, BATCH_POINT_READ);\n}\n\nexport function endpointSetReadVerdict(\n backend: GraphBackend,\n): BundleVerdictOf<typeof ENDPOINT_SET_READ> {\n return resolveBundle(backend, ENDPOINT_SET_READ);\n}\n\nexport function statementExecutionVerdict(\n backend: GraphBackend,\n): BundleVerdictOf<typeof STATEMENT_EXECUTION> {\n return resolveBundle(backend, STATEMENT_EXECUTION);\n}\n\nexport function contributionHealthVerdict(\n backend: GraphBackend,\n): BundleVerdictOf<typeof CONTRIBUTION_HEALTH> {\n return resolveBundle(backend, CONTRIBUTION_HEALTH);\n}\n\nexport function recordedRevisionOriginsVerdict(\n backend: GraphBackend,\n): BundleVerdictOf<typeof RECORDED_REVISION_ORIGINS> {\n return resolveBundle(backend, RECORDED_REVISION_ORIGINS);\n}\n\n// ---------------------------------------------------------------------------\n// The claims verdict THUNK — the reference implementation of §5.2.3's INTENT\n// (one owner, at-most-once resolution, no re-derivation) moved to WHEN it\n// resolves rather than IF (ruling B7 refinement 2).\n// ---------------------------------------------------------------------------\n\n/**\n * A memoized, at-most-once resolution of the `claims` bundle's verdict\n * against ONE backend.\n *\n * Eager resolution at store construction is forbidden: T14's\n * contradictory-declaration backends must still be able to construct a store\n * and create nodes — only a constrained edge write may legally reach the\n * bidirectional cross-check's throw, and it must do so lazily, at the first\n * write that needs the verdict.\n *\n * A cached verdict cannot go stale because `GraphBackend` is deep-frozen (B1):\n * nothing can flip `capabilities.constraintClaims` or add/remove a claim\n * member on a backend object after this thunk has already resolved it, so\n * \"resolve once and reuse forever\" is exactly as safe as \"resolve every\n * time\" — for one backend object, they observe the same immutable answer.\n */\nexport type ClaimsVerdictThunk = () => BundleVerdictOf<typeof CLAIMS>;\n\n/**\n * Interning: the same backend object always gets back the SAME thunk object.\n * This is what makes \"one shared thunk per backend\" structural rather than a\n * convention every population site has to honor — a second call to\n * {@link createClaimsVerdictThunk} for a backend already minted cannot produce\n * a second, independently-memoized verdict.\n */\nconst CLAIMS_VERDICT_THUNKS = new WeakMap<GraphBackend, ClaimsVerdictThunk>();\n\n/**\n * Mints — or returns the already-minted — {@link ClaimsVerdictThunk} for\n * `backend`.\n *\n * The thunk resolves {@link resolveBundle}`(backend, CLAIMS)` on its first\n * call and caches the outcome, INCLUDING a thrown `ConfigurationError`: a\n * refusal is cached and re-thrown on every subsequent call, never\n * re-resolved. Both layers — interning here, memoization inside the thunk —\n * are required: interning alone would still let two independently-memoized\n * thunks exist for one backend if a caller ignored the shared one; memoizing\n * alone would still let two different call sites mint two different thunks\n * that could disagree about whether they had already resolved.\n */\nexport function createClaimsVerdictThunk(\n backend: GraphBackend,\n): ClaimsVerdictThunk {\n const existing = CLAIMS_VERDICT_THUNKS.get(backend);\n if (existing !== undefined) return existing;\n\n type Memo =\n | Readonly<{ state: \"resolved\"; verdict: BundleVerdictOf<typeof CLAIMS> }>\n | Readonly<{ state: \"thrown\"; error: unknown }>;\n let memo: Memo | undefined;\n\n const thunk: ClaimsVerdictThunk = () => {\n if (memo === undefined) {\n try {\n memo = { state: \"resolved\", verdict: resolveBundle(backend, CLAIMS) };\n } catch (error) {\n memo = { state: \"thrown\", error };\n throw error;\n }\n }\n if (memo.state === \"thrown\") throw memo.error;\n return memo.verdict;\n };\n\n CLAIMS_VERDICT_THUNKS.set(backend, thunk);\n return thunk;\n}\n","/**\n * The backend's optional catalog-introspection surface: physical-schema\n * probes a store path consults directly, spelled once per dialect by the\n * two bundled profiles instead of a `dialect === \"postgres\"` branch at each\n * call site.\n *\n * Every member is a read-only probe except `dropInvalidIndex`, which issues\n * the one DDL statement that heals a crashed concurrent index build.\n * Nothing here writes a graph row, a sidecar row, or a status row.\n */\nimport { ConfigurationError } from \"../../errors\";\nimport { type GraphBackend } from \"../types\";\n\n/**\n * A physical index's presence and, on engines that can leave a build\n * half-finished, whether the leftover is usable.\n *\n * `invalid` is PostgreSQL's `pg_index.indisvalid = false` — an interrupted\n * `CREATE INDEX CONCURRENTLY` leaves a same-named index behind that a later\n * `IF NOT EXISTS` build would otherwise accept silently. SQLite has no such\n * state: `invalid` is always `false` there, and `exists` alone is the whole\n * answer.\n */\nexport type IndexState = Readonly<{\n /** The physical SQL index name that was probed. */\n name: string;\n /** Whether an index with this name exists in the engine catalog. */\n exists: boolean;\n /** PostgreSQL's invalid-build leftover flag; always `false` on SQLite. */\n invalid: boolean;\n}>;\n\n/**\n * A physical column's declared type, reduced to the family the two callers\n * that classify a recorded-time column actually distinguish: an integer\n * counter, text (SQLite's affinity for a wall-clock column stored as an\n * ISO-8601 string), PostgreSQL's exact `timestamp with time zone`, or\n * anything else. Kept this coarse on purpose — no caller needs a finer\n * classification, and each dialect's own probe decides which of these a\n * given declared type maps to, using that engine's own type rules (exact\n * match on PostgreSQL, affinity on SQLite).\n *\n * PostgreSQL's own normalizer never reports `\"text\"` — a declared `text`\n * column on that dialect falls through to `\"other\"`, since nothing\n * PostgreSQL-side stores a recorded-time column that way. That asymmetry is\n * why a revision or wall-time comparison must compare against\n * {@link REVISION_COLUMN_KINDS} / {@link WALL_TIME_COLUMN_KINDS} rather than\n * a single literal: the two dialects agree on the revision kind but not on\n * the wall-time one.\n */\nexport type NormalizedColumnKind =\n \"integer\" | \"text\" | \"timestamp-with-time-zone\" | \"other\";\n\n/**\n * The `columnTypes` kinds that count as a revision counter. Both dialects\n * normalize one to `\"integer\"`, so this is a single-member set today — named\n * and exported so a caller compares against ONE owned set instead of\n * re-spelling `=== \"integer\"` inline. Consumed by\n * `store/recorded-capture/schema-version.ts`'s `isCompatibleColumnKind`,\n * which replaced that file's dialect-branching `isCompatibleColumnType` and\n * its SQLite-affinity twin (`hasSqliteAffinity`) with this owned set.\n */\nexport const REVISION_COLUMN_KINDS: readonly NormalizedColumnKind[] = [\n \"integer\",\n];\n\n/**\n * The `columnTypes` kinds that count as a wall-clock timestamp. SQLite\n * stores one as an ISO-8601 string (`\"text\"`); PostgreSQL stores one as\n * `timestamp with time zone` (`\"timestamp-with-time-zone\"`) and never\n * normalizes a declared column to `\"text\"` at all — so this set stays exact\n * on both dialects without a caller ever branching on `dialect`. Consumed\n * by `store/recorded-capture/schema-version.ts`'s `isCompatibleColumnKind`,\n * alongside {@link REVISION_COLUMN_KINDS}.\n */\nexport const WALL_TIME_COLUMN_KINDS: readonly NormalizedColumnKind[] = [\n \"text\",\n \"timestamp-with-time-zone\",\n];\n\n/**\n * One physical column's name, normalized type family, and raw declared\n * type — trimmed and lower-cased, but otherwise exactly what the engine's\n * own catalog reports (`\"bigint\"`, `\"timestamp with time zone\"`, a SQLite\n * declared type such as `\"integer\"` or `\"text\"`, and so on). `kind` is what\n * a comparison should classify against; `declaredType` is what a\n * diagnostic should show a human, since `kind` discards the declared\n * spelling entirely.\n */\nexport type CatalogColumn = Readonly<{\n name: string;\n kind: NormalizedColumnKind;\n declaredType: string;\n}>;\n\n/** One physical table's catalog presence. See {@link BackendCatalogProbes.tablesExist}. */\nexport type TableState = Readonly<{\n /** The physical SQL table name that was probed. */\n name: string;\n /** Whether a table with this name exists in the engine catalog. */\n exists: boolean;\n}>;\n\n/**\n * The three facts index materialization used to keep in its own\n * dialect-keyed record: whether this engine can build an index\n * concurrently (without blocking readers/writers), whether a concurrent\n * build can be interrupted into a usable-but-invalid leftover, and whether\n * it offers the GIN index family fulltext/trigram indexing needs.\n */\nexport type CatalogIndexBehavior = Readonly<{\n concurrentBuilds: boolean;\n hasInvalidIndexState: boolean;\n supportsGinFamily: boolean;\n}>;\n\n/**\n * Physical-schema introspection a store path consults directly: table and\n * index presence, PostgreSQL's invalid-index leftover state and its\n * self-heal, normalized column types, and the per-dialect index-build\n * facts above.\n *\n * Optional: a custom backend that omits it loses the store paths that\n * consult it directly — index materialization (`store.materializeIndexes()`\n * refuses only once its empty-candidate short circuit and the status-table\n * ensure step have already run; `store.materializeSystemIndexes()`, which\n * has no candidate short circuit, refuses only once that same status-table\n * ensure step has run), the recorded-time schema check, and the\n * recorded-time migration's column read.\n */\nexport type BackendCatalogProbes = Readonly<{\n /**\n * Whether a table with this physical name exists in the engine catalog —\n * on PostgreSQL, anything an unqualified `DELETE`/`ANALYZE` against the\n * name could hit (ordinary and partitioned tables, views, materialized\n * views, foreign tables), matching the dialect operation strategy's own\n * DDL-target probe. A caller that means specifically \"is this a TABLE\",\n * as opposed to any relation an unqualified statement could resolve to,\n * wants {@link BackendCatalogProbes.tablesExist} instead — its narrower\n * predicate excludes views, materialized views, and foreign tables.\n */\n tableExists: (this: void, name: string) => Promise<boolean>;\n /**\n * The catalog state of each named physical TABLE, one entry per input\n * name (an absent name reports `exists: false`), resolved in one round\n * trip. On PostgreSQL this is ordinary and partitioned tables only\n * (`relkind IN ('r', 'p')`) — narrower than {@link tableExists}, which\n * also matches views, materialized views, and foreign tables. A caller\n * gating bulk, table-scoped work (a preload ahead of table DDL, say)\n * wants this member so it gets one round trip and the strict predicate,\n * rather than looping {@link tableExists} or accepting its wider match.\n */\n tablesExist: (\n this: void,\n names: readonly string[],\n ) => Promise<readonly TableState[]>;\n /**\n * The catalog state of each named physical index, one entry per input\n * name (an absent index reports `exists: false`), resolved in one\n * round trip.\n */\n indexStates: (\n this: void,\n names: readonly string[],\n ) => Promise<readonly IndexState[]>;\n /**\n * Drops the named index if — and only if — it is a PostgreSQL INVALID\n * leftover from an interrupted `CREATE INDEX CONCURRENTLY`. A no-op on\n * an engine whose `indexBehavior.hasInvalidIndexState` is `false`, and\n * a no-op for a valid or absent index on every engine.\n *\n * A ROOT-BACKEND operation on an engine with an invalid-index state:\n * PostgreSQL refuses `DROP INDEX CONCURRENTLY` inside a transaction\n * block, so there the `catalog` a `transaction()` handle exposes throws a\n * typed `ConfigurationError` from this member instead of attempting the\n * DDL. An engine whose `indexBehavior.hasInvalidIndexState` is `false`\n * (SQLite) has no invalid leftover to ever drop and stays a no-op in\n * both scopes — every other member here stays a plain read on that same\n * transaction-scoped bag regardless of engine.\n */\n dropInvalidIndex: (this: void, name: string) => Promise<void>;\n /** Every column's name and normalized type family for one physical table. */\n columnTypes: (this: void, table: string) => Promise<readonly CatalogColumn[]>;\n /** This engine's index-build facts. See {@link CatalogIndexBehavior}. */\n indexBehavior: CatalogIndexBehavior;\n}>;\n\n/**\n * THE refusal for a store path that needs the backend's catalog probes and\n * finds them absent, naming the missing port so a caller can add it — or\n * switch to a bundled backend — instead of chasing a `TypeError` two calls\n * deep into `materializeIndexes` or a recorded-time migration.\n */\nexport function requireCatalog(\n backend: Pick<GraphBackend, \"catalog\">,\n operation: string,\n): BackendCatalogProbes {\n const catalog = backend.catalog;\n if (catalog === undefined) {\n throw new ConfigurationError(\n `${operation} requires the backend's catalog probes, but this backend declares no \\`catalog\\`.`,\n { code: \"CATALOG_UNAVAILABLE\", operation },\n {\n suggestion:\n \"Implement `catalog` on this backend, or use a built-in SQLite or PostgreSQL backend.\",\n },\n );\n }\n return catalog;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/backend/capabilities/resolve.ts","../src/backend/capabilities/catalog.ts"],"names":[],"mappings":";;;;;AA8IA,SAAS,aAAA,CAMP,SACA,MAAA,EAIC;AACD,EAAA,MAAM,WACJ,kBAAA,EAA6D;AAC/D,EAAA,MAAM,gBAA0B,EAAC;AACjC,EAAA,KAAA,MAAW,SAAS,MAAA,EAAQ;AAC1B,IAAA,MAAM,OAAA,GAAU,MAAM,OAAA,CAAQ,MAAA;AAAA,MAC5B,CAAC,MAAA,KAAW,OAAA,CAAQ,MAAM,CAAA,KAAM;AAAA,KAClC;AACA,IAAA,IAAI,OAAA,CAAQ,WAAW,CAAA,EAAG;AACxB,MAAA,QAAA,CAAS,KAAA,CAAM,EAAE,CAAA,GAAI,EAAE,SAAS,IAAA,EAAM,OAAA,EAAS,MAAM,OAAA,EAAQ;AAAA,IAC/D,CAAA,MAAO;AACL,MAAA,QAAA,CAAS,KAAA,CAAM,EAAE,CAAA,GAAI;AAAA,QACnB,OAAA,EAAS,KAAA;AAAA,QACT,OAAA;AAAA,QACA,aAAa,KAAA,CAAM;A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cesContent":["/**\n * The bundle verdict resolver — generalizing `claimSupport`\n * (`store/claims/backing.ts`).\n *\n * Resolution splits in two (ruling B1): the VERDICT — the support decision,\n * resolved once against `GraphBackend` and threaded — and the BINDING\n * (`bind.ts`) — the actual member functions, bound at the call site off\n * whichever port the site holds. A verdict carries names, never functions\n * (I19), so it crosses transaction boundaries safely.\n */\nimport { ConfigurationError } from \"../../errors\";\nimport { createDataKeyedBag } from \"../../utils/object\";\nimport { requireDefined } from \"../../utils/presence\";\nimport { type BackendCapabilities, type GraphBackend } from \"../types\";\nimport {\n BATCH_POINT_READ,\n type CapabilityBundleDefinition,\n type CapabilityBundleDisposition,\n type CapabilityBundleExtra,\n CLAIMS,\n CONTRIBUTION_HEALTH,\n ENDPOINT_SET_READ,\n type OptionalGraphBackendMember,\n RECORDED_REVISION_ORIGINS,\n STATEMENT_EXECUTION,\n UNIQUE_SIDECAR_BATCH,\n} from \"./bundle-registry\";\n\n/**\n * A bundle's extras, as a type-level map from extra id to the UNION of\n * member names that extra covers — derived from the definition's `extras`\n * array by `const` inference, never hand-written.\n */\nexport type CapabilityExtraSpec = Readonly<\n Record<string, OptionalGraphBackendMember>\n>;\n\n/**\n * One extra's verdict. `present: true` carries the member NAMES, not the\n * member functions (ruling B1) — the names are what the accessor binds\n * from, at the site, off the port.\n */\nexport type ExtraVerdict<M extends OptionalGraphBackendMember> =\n | Readonly<{ present: true; members: readonly M[] }>\n | Readonly<{\n present: false;\n missing: readonly M[];\n disposition: CapabilityBundleDisposition;\n }>;\n\n/** The verdict map: one entry per extra id, never a boolean. */\nexport type ExtraVerdicts<X extends CapabilityExtraSpec> = Readonly<{\n [K in keyof X]: ExtraVerdict<X[K]>;\n}>;\n\nexport type GatedBundleVerdict<\n MCore extends OptionalGraphBackendMember,\n X extends CapabilityExtraSpec,\n> =\n | Readonly<{\n supported: true;\n bundle: string;\n /** The core, guaranteed present. Names, not functions. */\n members: readonly MCore[];\n extras: ExtraVerdicts<X>;\n /** The `present: false` keys of `extras`. */\n missingExtras: readonly (keyof X)[];\n }>\n | Readonly<{\n supported: false;\n bundle: string;\n missing: readonly MCore[];\n /** Why it is unsupported: the bundle's own `disposition`, verbatim. */\n disposition: CapabilityBundleDisposition;\n }>;\n\n/** No `supported` field: a graduated bundle has no bundle-level verdict. */\nexport type GraduatedBundleVerdict<X extends CapabilityExtraSpec> = Readonly<{\n bundle: string;\n extras: ExtraVerdicts<X>;\n missingExtras: readonly (keyof X)[];\n}>;\n\n/**\n * Recovers the id→members map from a definition's `extras` TUPLE (not\n * `readonly CapabilityBundleExtra<XId, MExtra>[]` — over the array type the\n * id→members association is erased and `ExtraVerdicts<X>` degenerates to an\n * index signature).\n */\nexport type SpecOf<\n XS extends readonly CapabilityBundleExtra<\n string,\n OptionalGraphBackendMember\n >[],\n> = { [K in XS[number] as K[\"id\"]]: K[\"members\"][number] };\n\nexport type ExtrasOf<D extends CapabilityBundleDefinition> = SpecOf<\n NonNullable<D[\"extras\"]>\n>;\nexport type ExtraMember<\n D extends CapabilityBundleDefinition,\n X extends keyof ExtrasOf<D>,\n> = Extract<ExtrasOf<D>[X], OptionalGraphBackendMember>;\n\n/**\n * The definition union and the return-type mapping. Structural, matching\n * `bundle-registry.ts`'s `BundleMembers` helper's own lesson: reading `core`\n * off `D` directly (rather than re-matching `GatedBundleDefinition`) avoids\n * an unmatched `infer` silently widening to the member constraint.\n */\nexport type BundleVerdictOf<D extends CapabilityBundleDefinition> =\n D extends (\n {\n kind: \"graduated\";\n extras: infer XS extends readonly CapabilityBundleExtra<\n string,\n OptionalGraphBackendMember\n >[];\n }\n ) ?\n GraduatedBundleVerdict<SpecOf<XS>>\n : D extends (\n {\n kind: \"gated\";\n core: readonly (infer MCore extends OptionalGraphBackendMember)[];\n extras?: infer XS extends\n | readonly CapabilityBundleExtra<string, OptionalGraphBackendMember>[]\n | undefined;\n }\n ) ?\n GatedBundleVerdict<\n MCore,\n SpecOf<\n XS extends (\n readonly CapabilityBundleExtra<string, OptionalGraphBackendMember>[]\n ) ?\n XS\n : []\n >\n >\n : never;\n\nfunction resolveExtras<\n const XS extends readonly CapabilityBundleExtra<\n string,\n OptionalGraphBackendMember\n >[],\n>(\n backend: GraphBackend,\n extras: XS,\n): Readonly<{\n extras: ExtraVerdicts<SpecOf<XS>>;\n missingExtras: readonly (keyof SpecOf<XS>)[];\n}> {\n const verdicts =\n createDataKeyedBag<ExtraVerdict<OptionalGraphBackendMember>>();\n const missingExtras: string[] = [];\n for (const extra of extras) {\n const missing = extra.members.filter(\n (member) => backend[member] === undefined,\n );\n if (missing.length === 0) {\n verdicts[extra.id] = { present: true, members: extra.members };\n } else {\n verdicts[extra.id] = {\n present: false,\n missing,\n disposition: extra.disposition,\n };\n missingExtras.push(extra.id);\n }\n }\n return {\n extras: verdicts as ExtraVerdicts<SpecOf<XS>>,\n missingExtras: missingExtras,\n };\n}\n\n/**\n * The `claims` bidirectional cross-check (ruling F2), reproducing\n * `store/claims/backing.ts`'s pre-B7 message text, code and suggestion\n * BYTE-FOR-BYTE. B7 made `claimSupport` (`backing.ts`) delegate to\n * {@link resolveBundle}, so this is now the ONLY place the check runs — there\n * is no second copy left to keep in sync. `bidirectional` is `claims`-only by\n * design (§5.2.1): the two trailing sentences below name \"claim\"/\"fence\"\n * vocabulary that is specific to that one bundle, and a future bundle raising\n * `crossCheck` to `\"bidirectional\"` must carry its own justification row and,\n * with it, its own message pair here.\n *\n * @throws {ConfigurationError} when the declaration and the member surface\n * disagree in either direction.\n */\nfunction assertClaimsBidirectionalAgreement(\n backend: GraphBackend,\n definition: Readonly<{\n declaration?: keyof BackendCapabilities;\n core: readonly OptionalGraphBackendMember[];\n portSurfaceCode: string;\n }>,\n): void {\n if (definition.declaration === undefined) return;\n const declared = backend.capabilities[definition.declaration] === true;\n const present = definition.core.filter(\n (member) => backend[member] !== undefined,\n );\n if (declared && present.length === definition.core.length) return;\n if (!declared && present.length === 0) return;\n\n const missing = definition.core.filter(\n (member) => backend[member] === undefined,\n );\n const declarationName = definition.declaration;\n throw new ConfigurationError(\n declared ?\n `This backend declares \\`${declarationName}: true\\` but does not implement ${missing.join(\", \")}. ` +\n \"A declared constraint would then be written without the fence the declaration promises.\"\n : `This backend implements ${present.join(\", \")} but does not declare \\`${declarationName}: true\\`. ` +\n \"Claim support is read from the declaration, so these members would never be called.\",\n { code: definition.portSurfaceCode, missing, present },\n {\n suggestion:\n declared ?\n `Implement the missing members, or drop \\`${declarationName}\\` from the backend's capabilities.`\n : `Declare \\`${declarationName}: true\\` in the backend's capabilities, or drop the claim members.`,\n },\n );\n}\n\n/**\n * Resolved ONCE, at construction or entry, against the top-level backend —\n * never against a `TransactionBackend` (I15's `@ts-expect-error` row).\n *\n * Rules: the member surface is read always; the declaration is read only\n * when the definition names one AND `crossCheck !== \"none\"` (only `claims`\n * qualifies in the pilot registry); a gated bundle's core must be complete\n * or the bundle is unsupported with `missing`; a graduated bundle has no\n * bundle-level verdict, only per-extra verdicts. `missingExtras` is built by\n * the SAME fold that builds `extras` (one pass, one owner).\n */\nexport function resolveBundle<const D extends CapabilityBundleDefinition>(\n backend: GraphBackend,\n definition: D,\n): BundleVerdictOf<D> {\n const extras = (definition.extras ?? []) as readonly CapabilityBundleExtra<\n string,\n OptionalGraphBackendMember\n >[];\n const { extras: extraVerdicts, missingExtras } = resolveExtras(\n backend,\n extras,\n );\n\n // Rule 1: the declaration is read whenever `crossCheck !== \"none\"`,\n // regardless of kind — a graduated bundle's \"core\" for this purpose is the\n // union of every extra's members, since it has no core of its own. Only\n // `claims` (gated) exercises this in the pilot registry, but the check\n // itself must not silently no-op for a hypothetical graduated bidirectional\n // bundle (T11's mutation pins exactly this).\n if (definition.crossCheck === \"bidirectional\") {\n const memberSet =\n definition.kind === \"gated\" ?\n definition.core\n : extras.flatMap((extra) => extra.members);\n assertClaimsBidirectionalAgreement(backend, {\n ...(definition.declaration === undefined ?\n {}\n : { declaration: definition.declaration }),\n core: memberSet,\n portSurfaceCode: definition.portSurfaceCode,\n });\n }\n\n if (definition.kind === \"graduated\") {\n return {\n bundle: definition.id,\n extras: extraVerdicts,\n missingExtras,\n } as unknown as BundleVerdictOf<D>;\n }\n\n const missing = definition.core.filter(\n (member) => backend[member] === undefined,\n );\n if (missing.length > 0) {\n return {\n supported: false,\n bundle: definition.id,\n missing,\n disposition: definition.disposition,\n } as unknown as BundleVerdictOf<D>;\n }\n return {\n supported: true,\n bundle: definition.id,\n members: definition.core,\n extras: extraVerdicts,\n missingExtras,\n } as unknown as BundleVerdictOf<D>;\n}\n\n/** The literal operation names a bundle's `operations` table declares. */\nexport type OperationNames<D extends CapabilityBundleDefinition> =\n D[\"operations\"][number][\"operation\"];\n\n/** The extras a named operation `requires`, read from the ROW — never re-spelled at the call site. */\nexport type RequiredExtrasOf<\n D extends CapabilityBundleDefinition,\n Op extends OperationNames<D>,\n> =\n Extract<D[\"operations\"][number], { operation: Op }> extends (\n { requires: infer R extends readonly string[] }\n ) ?\n R[number]\n : never;\n\n/**\n * The registry's row lookup plus the presence fold, extracted verbatim from\n * {@link requireExtras}'s body (ruling B8 spec item 3): the ONE owner of\n * \"what this operation requires\" that both `requireExtras`'s default throw\n * and a call site's own `refuse` callback consult.\n *\n * `operation` is the literal key of the bundle's `operations` tuple, so the\n * required extras are looked up TYPE-LEVEL from the registry — no second\n * spelling of `requires` at the call site.\n *\n * @throws {ConfigurationError} naming the unknown operation when `operation`\n * is not a row of `definition.operations`.\n */\nexport function missingRequiredExtras<\n const D extends CapabilityBundleDefinition,\n Op extends OperationNames<D>,\n>(\n definition: D,\n verdict: BundleVerdictOf<D>,\n operation: Op,\n): readonly string[] {\n const row = definition.operations.find(\n (candidate) => candidate.operation === operation,\n );\n if (row === undefined) {\n throw new ConfigurationError(\n `Unknown operation \"${operation}\" for capability bundle \"${definition.id}\".`,\n { bundle: definition.id, operation },\n );\n }\n const required = row.requires ?? [];\n const extras:\n | Readonly<Record<string, ExtraVerdict<OptionalGraphBackendMember>>>\n | undefined = \"extras\" in verdict ? verdict.extras : undefined;\n return required.filter(\n (id) => extras === undefined || extras[id]?.present !== true,\n );\n}\n\n/**\n * The refusal for an operation whose `requires` extras are absent — how a\n * GRADUATED bundle refuses where the tree refuses today: the row names the\n * operation and the extras, this asserts they are present, and\n * {@link bindExtra} (`bind.ts`) binds them off the port.\n *\n * `refuse`, when supplied, is called instead of the registry-coded throw\n * below — this is how a call site keeps its OWN existing error text (message,\n * `details` shape, order relative to other refusals) while the registry\n * stays the one owner of \"what this operation requires\" (ruling B8 spec item\n * 3). Omitting it keeps the default behavior byte-identical to before this\n * parameter existed.\n *\n * @throws {ConfigurationError} naming the row's own `code` when one or more\n * required extras is absent from the verdict and no `refuse` callback is\n * supplied; otherwise calls `refuse(missing)`, which never returns.\n */\nexport function requireExtras<\n const D extends CapabilityBundleDefinition,\n Op extends OperationNames<D>,\n>(\n definition: D,\n verdict: BundleVerdictOf<D>,\n operation: Op,\n refuse?: (missing: readonly string[]) => never,\n): asserts verdict is BundleVerdictOf<D> & {\n extras: {\n [K in RequiredExtrasOf<D, Op> & keyof ExtrasOf<D>]: Extract<\n ExtraVerdict<ExtraMember<D, K>>,\n { present: true }\n >;\n };\n} {\n const missing = missingRequiredExtras(definition, verdict, operation);\n if (missing.length === 0) return;\n\n if (refuse !== undefined) refuse(missing);\n\n // `missingRequiredExtras` already threw the unknown-operation error above\n // when the row would be undefined, so `requireDefined` here is a redundant\n // (never-failing) narrowing, not a second lookup that could disagree.\n const { disposition } = requireDefined(\n definition.operations.find(\n (candidate) => candidate.operation === operation,\n ),\n );\n if (disposition.kind === \"refuse\") {\n throw new ConfigurationError(\n `Operation \"${operation}\" on capability bundle \"${definition.id}\" requires ${missing.join(\", \")}.`,\n { code: disposition.code, bundle: definition.id, operation, missing },\n );\n }\n // No pilot row reaches this: every row with a non-empty `requires` in the\n // registry disposes `refuse` (a graduated bundle's fallback rows never\n // name `requires` — the fallback IS the degrade path). Kept as a named,\n // typed refusal rather than a silent pass so a future `fallback` +\n // `requires` row cannot pass `requireExtras` unnoticed.\n throw new ConfigurationError(\n `Operation \"${operation}\" on capability bundle \"${definition.id}\" requires ${missing.join(\", \")}, and the registry names no refusal code for this fallback-dispositioned row.`,\n { bundle: definition.id, operation, missing },\n );\n}\n\n// ---------------------------------------------------------------------------\n// The seven named verdict accessors — GraphBackend-only, no exceptions (I15).\n// ---------------------------------------------------------------------------\n\nexport function claimsVerdict(\n backend: GraphBackend,\n): BundleVerdictOf<typeof CLAIMS> {\n return resolveBundle(backend, CLAIMS);\n}\n\nexport function uniqueSidecarBatchVerdict(\n backend: GraphBackend,\n): BundleVerdictOf<typeof UNIQUE_SIDECAR_BATCH> {\n return resolveBundle(backend, UNIQUE_SIDECAR_BATCH);\n}\n\nexport function batchPointReadVerdict(\n backend: GraphBackend,\n): BundleVerdictOf<typeof BATCH_POINT_READ> {\n return resolveBundle(backend, BATCH_POINT_READ);\n}\n\nexport function endpointSetReadVerdict(\n backend: GraphBackend,\n): BundleVerdictOf<typeof ENDPOINT_SET_READ> {\n return resolveBundle(backend, ENDPOINT_SET_READ);\n}\n\nexport function statementExecutionVerdict(\n backend: GraphBackend,\n): BundleVerdictOf<typeof STATEMENT_EXECUTION> {\n return resolveBundle(backend, STATEMENT_EXECUTION);\n}\n\nexport function contributionHealthVerdict(\n backend: GraphBackend,\n): BundleVerdictOf<typeof CONTRIBUTION_HEALTH> {\n return resolveBundle(backend, CONTRIBUTION_HEALTH);\n}\n\nexport function recordedRevisionOriginsVerdict(\n backend: GraphBackend,\n): BundleVerdictOf<typeof RECORDED_REVISION_ORIGINS> {\n return resolveBundle(backend, RECORDED_REVISION_ORIGINS);\n}\n\n// ---------------------------------------------------------------------------\n// The claims verdict THUNK — the reference implementation of §5.2.3's INTENT\n// (one owner, at-most-once resolution, no re-derivation) moved to WHEN it\n// resolves rather than IF (ruling B7 refinement 2).\n// ---------------------------------------------------------------------------\n\n/**\n * A memoized, at-most-once resolution of the `claims` bundle's verdict\n * against ONE backend.\n *\n * Eager resolution at store construction is forbidden: T14's\n * contradictory-declaration backends must still be able to construct a store\n * and create nodes — only a constrained edge write may legally reach the\n * bidirectional cross-check's throw, and it must do so lazily, at the first\n * write that needs the verdict.\n *\n * A cached verdict cannot go stale because `GraphBackend` is deep-frozen (B1):\n * nothing can flip `capabilities.constraintClaims` or add/remove a claim\n * member on a backend object after this thunk has already resolved it, so\n * \"resolve once and reuse forever\" is exactly as safe as \"resolve every\n * time\" — for one backend object, they observe the same immutable answer.\n */\nexport type ClaimsVerdictThunk = () => BundleVerdictOf<typeof CLAIMS>;\n\n/**\n * Interning: the same backend object always gets back the SAME thunk object.\n * This is what makes \"one shared thunk per backend\" structural rather than a\n * convention every population site has to honor — a second call to\n * {@link createClaimsVerdictThunk} for a backend already minted cannot produce\n * a second, independently-memoized verdict.\n */\nconst CLAIMS_VERDICT_THUNKS = new WeakMap<GraphBackend, ClaimsVerdictThunk>();\n\n/**\n * Mints — or returns the already-minted — {@link ClaimsVerdictThunk} for\n * `backend`.\n *\n * The thunk resolves {@link resolveBundle}`(backend, CLAIMS)` on its first\n * call and caches the outcome, INCLUDING a thrown `ConfigurationError`: a\n * refusal is cached and re-thrown on every subsequent call, never\n * re-resolved. Both layers — interning here, memoization inside the thunk —\n * are required: interning alone would still let two independently-memoized\n * thunks exist for one backend if a caller ignored the shared one; memoizing\n * alone would still let two different call sites mint two different thunks\n * that could disagree about whether they had already resolved.\n */\nexport function createClaimsVerdictThunk(\n backend: GraphBackend,\n): ClaimsVerdictThunk {\n const existing = CLAIMS_VERDICT_THUNKS.get(backend);\n if (existing !== undefined) return existing;\n\n type Memo =\n | Readonly<{ state: \"resolved\"; verdict: BundleVerdictOf<typeof CLAIMS> }>\n | Readonly<{ state: \"thrown\"; error: unknown }>;\n let memo: Memo | undefined;\n\n const thunk: ClaimsVerdictThunk = () => {\n if (memo === undefined) {\n try {\n memo = { state: \"resolved\", verdict: resolveBundle(backend, CLAIMS) };\n } catch (error) {\n memo = { state: \"thrown\", error };\n throw error;\n }\n }\n if (memo.state === \"thrown\") throw memo.error;\n return memo.verdict;\n };\n\n CLAIMS_VERDICT_THUNKS.set(backend, thunk);\n return thunk;\n}\n","/**\n * The backend's optional catalog-introspection surface: physical-schema\n * probes a store path consults directly, spelled once per dialect by the\n * two bundled profiles instead of a `dialect === \"postgres\"` branch at each\n * call site.\n *\n * Every member is a read-only probe except `dropInvalidIndex`, which issues\n * the one DDL statement that heals a crashed concurrent index build.\n * Nothing here writes a graph row, a sidecar row, or a status row.\n */\nimport { ConfigurationError } from \"../../errors\";\nimport { type GraphBackend } from \"../types\";\n\n/**\n * A physical index's presence and, on engines that can leave a build\n * half-finished, whether the leftover is usable.\n *\n * `invalid` is PostgreSQL's `pg_index.indisvalid = false` — an interrupted\n * `CREATE INDEX CONCURRENTLY` leaves a same-named index behind that a later\n * `IF NOT EXISTS` build would otherwise accept silently. SQLite has no such\n * state: `invalid` is always `false` there, and `exists` alone is the whole\n * answer.\n */\nexport type IndexState = Readonly<{\n /** The physical SQL index name that was probed. */\n name: string;\n /** Whether an index with this name exists in the engine catalog. */\n exists: boolean;\n /** PostgreSQL's invalid-build leftover flag; always `false` on SQLite. */\n invalid: boolean;\n}>;\n\n/**\n * A physical column's declared type, reduced to the family the two callers\n * that classify a recorded-time column actually distinguish: an integer\n * counter, text (SQLite's affinity for a wall-clock column stored as an\n * ISO-8601 string), PostgreSQL's exact `timestamp with time zone`, or\n * anything else. Kept this coarse on purpose — no caller needs a finer\n * classification, and each dialect's own probe decides which of these a\n * given declared type maps to, using that engine's own type rules (exact\n * match on PostgreSQL, affinity on SQLite).\n *\n * PostgreSQL's own normalizer never reports `\"text\"` — a declared `text`\n * column on that dialect falls through to `\"other\"`, since nothing\n * PostgreSQL-side stores a recorded-time column that way. That asymmetry is\n * why a revision or wall-time comparison must compare against\n * {@link REVISION_COLUMN_KINDS} / {@link WALL_TIME_COLUMN_KINDS} rather than\n * a single literal: the two dialects agree on the revision kind but not on\n * the wall-time one.\n */\nexport type NormalizedColumnKind =\n \"integer\" | \"text\" | \"timestamp-with-time-zone\" | \"other\";\n\n/**\n * The `columnTypes` kinds that count as a revision counter. Both dialects\n * normalize one to `\"integer\"`, so this is a single-member set today — named\n * and exported so a caller compares against ONE owned set instead of\n * re-spelling `=== \"integer\"` inline. Consumed by\n * `store/recorded-capture/schema-version.ts`'s `isCompatibleColumnKind`,\n * which replaced that file's dialect-branching `isCompatibleColumnType` and\n * its SQLite-affinity twin (`hasSqliteAffinity`) with this owned set.\n */\nexport const REVISION_COLUMN_KINDS: readonly NormalizedColumnKind[] = [\n \"integer\",\n];\n\n/**\n * The `columnTypes` kinds that count as a wall-clock timestamp. SQLite\n * stores one as an ISO-8601 string (`\"text\"`); PostgreSQL stores one as\n * `timestamp with time zone` (`\"timestamp-with-time-zone\"`) and never\n * normalizes a declared column to `\"text\"` at all — so this set stays exact\n * on both dialects without a caller ever branching on `dialect`. Consumed\n * by `store/recorded-capture/schema-version.ts`'s `isCompatibleColumnKind`,\n * alongside {@link REVISION_COLUMN_KINDS}.\n */\nexport const WALL_TIME_COLUMN_KINDS: readonly NormalizedColumnKind[] = [\n \"text\",\n \"timestamp-with-time-zone\",\n];\n\n/**\n * One physical column's name, normalized type family, and raw declared\n * type — trimmed and lower-cased, but otherwise exactly what the engine's\n * own catalog reports (`\"bigint\"`, `\"timestamp with time zone\"`, a SQLite\n * declared type such as `\"integer\"` or `\"text\"`, and so on). `kind` is what\n * a comparison should classify against; `declaredType` is what a\n * diagnostic should show a human, since `kind` discards the declared\n * spelling entirely.\n */\nexport type CatalogColumn = Readonly<{\n name: string;\n kind: NormalizedColumnKind;\n declaredType: string;\n}>;\n\n/** One physical table's catalog presence. See {@link BackendCatalogProbes.tablesExist}. */\nexport type TableState = Readonly<{\n /** The physical SQL table name that was probed. */\n name: string;\n /** Whether a table with this name exists in the engine catalog. */\n exists: boolean;\n}>;\n\n/**\n * The three facts index materialization used to keep in its own\n * dialect-keyed record: whether this engine can build an index\n * concurrently (without blocking readers/writers), whether a concurrent\n * build can be interrupted into a usable-but-invalid leftover, and whether\n * it offers the GIN index family fulltext/trigram indexing needs.\n */\nexport type CatalogIndexBehavior = Readonly<{\n concurrentBuilds: boolean;\n hasInvalidIndexState: boolean;\n supportsGinFamily: boolean;\n}>;\n\n/**\n * Physical-schema introspection a store path consults directly: table and\n * index presence, PostgreSQL's invalid-index leftover state and its\n * self-heal, normalized column types, and the per-dialect index-build\n * facts above.\n *\n * Optional: a custom backend that omits it loses the store paths that\n * consult it directly — index materialization (`store.materializeIndexes()`\n * refuses only once its empty-candidate short circuit and the status-table\n * ensure step have already run; `store.materializeSystemIndexes()`, which\n * has no candidate short circuit, refuses only once that same status-table\n * ensure step has run), the recorded-time schema check, and the\n * recorded-time migration's column read.\n */\nexport type BackendCatalogProbes = Readonly<{\n /**\n * Whether a table with this physical name exists in the engine catalog —\n * on PostgreSQL, anything an unqualified `DELETE`/`ANALYZE` against the\n * name could hit (ordinary and partitioned tables, views, materialized\n * views, foreign tables), matching the dialect operation strategy's own\n * DDL-target probe. A caller that means specifically \"is this a TABLE\",\n * as opposed to any relation an unqualified statement could resolve to,\n * wants {@link BackendCatalogProbes.tablesExist} instead — its narrower\n * predicate excludes views, materialized views, and foreign tables.\n */\n tableExists: (this: void, name: string) => Promise<boolean>;\n /**\n * The catalog state of each named physical TABLE, one entry per input\n * name (an absent name reports `exists: false`), resolved in one round\n * trip. On PostgreSQL this is ordinary and partitioned tables only\n * (`relkind IN ('r', 'p')`) — narrower than {@link tableExists}, which\n * also matches views, materialized views, and foreign tables. A caller\n * gating bulk, table-scoped work (a preload ahead of table DDL, say)\n * wants this member so it gets one round trip and the strict predicate,\n * rather than looping {@link tableExists} or accepting its wider match.\n */\n tablesExist: (\n this: void,\n names: readonly string[],\n ) => Promise<readonly TableState[]>;\n /**\n * The catalog state of each named physical index, one entry per input\n * name (an absent index reports `exists: false`), resolved in one\n * round trip.\n */\n indexStates: (\n this: void,\n names: readonly string[],\n ) => Promise<readonly IndexState[]>;\n /**\n * Drops the named index if — and only if — it is a PostgreSQL INVALID\n * leftover from an interrupted `CREATE INDEX CONCURRENTLY`. A no-op on\n * an engine whose `indexBehavior.hasInvalidIndexState` is `false`, and\n * a no-op for a valid or absent index on every engine.\n *\n * A ROOT-BACKEND operation on an engine with an invalid-index state:\n * PostgreSQL refuses `DROP INDEX CONCURRENTLY` inside a transaction\n * block, so there the `catalog` a `transaction()` handle exposes throws a\n * typed `ConfigurationError` from this member instead of attempting the\n * DDL. An engine whose `indexBehavior.hasInvalidIndexState` is `false`\n * (SQLite) has no invalid leftover to ever drop and stays a no-op in\n * both scopes — every other member here stays a plain read on that same\n * transaction-scoped bag regardless of engine.\n */\n dropInvalidIndex: (this: void, name: string) => Promise<void>;\n /** Every column's name and normalized type family for one physical table. */\n columnTypes: (this: void, table: string) => Promise<readonly CatalogColumn[]>;\n /** This engine's index-build facts. See {@link CatalogIndexBehavior}. */\n indexBehavior: CatalogIndexBehavior;\n}>;\n\n/**\n * THE refusal for a store path that needs the backend's catalog probes and\n * finds them absent, naming the missing port so a caller can add it — or\n * switch to a bundled backend — instead of chasing a `TypeError` two calls\n * deep into `materializeIndexes` or a recorded-time migration.\n */\nexport function requireCatalog(\n backend: Pick<GraphBackend, \"catalog\">,\n operation: string,\n): BackendCatalogProbes {\n const catalog = backend.catalog;\n if (catalog === undefined) {\n throw new ConfigurationError(\n `${operation} requires the backend's catalog probes, but this backend declares no \\`catalog\\`.`,\n { code: \"CATALOG_UNAVAILABLE\", operation },\n {\n suggestion:\n \"Implement `catalog` on this backend, or use a built-in SQLite or PostgreSQL backend.\",\n },\n );\n }\n return catalog;\n}\n"]}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var chunk6YKISECL_cjs = require('./chunk-6YKISECL.cjs');
|
|
4
4
|
var chunkICOTLZBV_cjs = require('./chunk-ICOTLZBV.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
5
|
+
var chunkEBQX7MYL_cjs = require('./chunk-EBQX7MYL.cjs');
|
|
6
|
+
var chunk6B3LQUYG_cjs = require('./chunk-6B3LQUYG.cjs');
|
|
7
|
+
var chunk5JOCIMQ3_cjs = require('./chunk-5JOCIMQ3.cjs');
|
|
8
|
+
var chunk6JRVV2SS_cjs = require('./chunk-6JRVV2SS.cjs');
|
|
9
9
|
var chunk7D2ZLF4O_cjs = require('./chunk-7D2ZLF4O.cjs');
|
|
10
10
|
var chunk5ICDVLI3_cjs = require('./chunk-5ICDVLI3.cjs');
|
|
11
11
|
var chunkL4L4AV6F_cjs = require('./chunk-L4L4AV6F.cjs');
|
|
@@ -585,7 +585,7 @@ async function computeSchemaHash(schema) {
|
|
|
585
585
|
...schema.extension === void 0 ? {} : { extension: schema.extension },
|
|
586
586
|
...schema.deprecatedKinds === void 0 ? {} : { deprecatedKinds: schema.deprecatedKinds }
|
|
587
587
|
};
|
|
588
|
-
const json = JSON.stringify(hashable,
|
|
588
|
+
const json = JSON.stringify(hashable, chunk5JOCIMQ3_cjs.sortedReplacer);
|
|
589
589
|
return chunkZY4GXIVN_cjs.sha256Hex(json);
|
|
590
590
|
}
|
|
591
591
|
|
|
@@ -641,7 +641,7 @@ function computeSchemaDiff(before, after) {
|
|
|
641
641
|
};
|
|
642
642
|
}
|
|
643
643
|
function diffGraphAnnotations(before, after) {
|
|
644
|
-
if (
|
|
644
|
+
if (chunk5JOCIMQ3_cjs.canonicalEqual(before ?? {}, after ?? {})) return void 0;
|
|
645
645
|
return {
|
|
646
646
|
type: before === void 0 ? "added" : after === void 0 ? "removed" : "modified",
|
|
647
647
|
severity: "safe",
|
|
@@ -734,7 +734,7 @@ var SUBSCHEMA_MAP_KEYWORDS = /* @__PURE__ */ new Set([
|
|
|
734
734
|
]);
|
|
735
735
|
var DEPENDENT_REQUIRED_KEYWORD = "dependentRequired";
|
|
736
736
|
function canonicalKey(value) {
|
|
737
|
-
return JSON.stringify(value,
|
|
737
|
+
return JSON.stringify(value, chunk5JOCIMQ3_cjs.sortedReplacer);
|
|
738
738
|
}
|
|
739
739
|
function sortedByCanonicalForm(items) {
|
|
740
740
|
return items.toSorted(
|
|
@@ -786,7 +786,7 @@ function normalizedSubschemaMap(value) {
|
|
|
786
786
|
return normalized;
|
|
787
787
|
}
|
|
788
788
|
function propertySchemasEqual(before, after) {
|
|
789
|
-
return
|
|
789
|
+
return chunk5JOCIMQ3_cjs.canonicalEqual(
|
|
790
790
|
orderNormalizedSchema(before),
|
|
791
791
|
orderNormalizedSchema(after)
|
|
792
792
|
);
|
|
@@ -811,14 +811,14 @@ function getSerializedEdgePairs(edge) {
|
|
|
811
811
|
return pairs;
|
|
812
812
|
}
|
|
813
813
|
function endpointKindsEqual(before, after) {
|
|
814
|
-
return
|
|
814
|
+
return chunk5JOCIMQ3_cjs.canonicalEqual(before?.toSorted(), after?.toSorted());
|
|
815
815
|
}
|
|
816
816
|
function targetKindsBySourceEqual(before, after) {
|
|
817
817
|
if (before === void 0 && after === void 0) return true;
|
|
818
818
|
if (before === void 0 || after === void 0) return false;
|
|
819
819
|
const beforeKeys = Object.keys(before).toSorted();
|
|
820
820
|
const afterKeys = Object.keys(after).toSorted();
|
|
821
|
-
if (!
|
|
821
|
+
if (!chunk5JOCIMQ3_cjs.canonicalEqual(beforeKeys, afterKeys)) return false;
|
|
822
822
|
for (const key of beforeKeys) {
|
|
823
823
|
if (!endpointKindsEqual(before[key], after[key])) return false;
|
|
824
824
|
}
|
|
@@ -851,7 +851,7 @@ function diffNodeDef(name, before, after) {
|
|
|
851
851
|
after
|
|
852
852
|
});
|
|
853
853
|
}
|
|
854
|
-
if (!
|
|
854
|
+
if (!chunk5JOCIMQ3_cjs.canonicalEqual(before.uniqueConstraints, after.uniqueConstraints)) {
|
|
855
855
|
changes.push({
|
|
856
856
|
type: "modified",
|
|
857
857
|
kind: name,
|
|
@@ -949,7 +949,7 @@ function classifyPropertyChanges(kind, before, after) {
|
|
|
949
949
|
for (const [property, beforeProperty] of Object.entries(beforeProps)) {
|
|
950
950
|
const afterProperty = afterProps[property];
|
|
951
951
|
if (afterProperty === void 0) continue;
|
|
952
|
-
if (
|
|
952
|
+
if (chunk5JOCIMQ3_cjs.canonicalEqual(beforeProperty, afterProperty)) continue;
|
|
953
953
|
if (isBreakingPropertyChange(beforeProperty, afterProperty)) {
|
|
954
954
|
breakingProps.push(property);
|
|
955
955
|
}
|
|
@@ -1128,7 +1128,7 @@ function isMatchIdentityChange(change) {
|
|
|
1128
1128
|
function annotationsChanged(before, after) {
|
|
1129
1129
|
if (before === void 0 && after === void 0) return false;
|
|
1130
1130
|
if (before === void 0 || after === void 0) return true;
|
|
1131
|
-
return !
|
|
1131
|
+
return !chunk5JOCIMQ3_cjs.canonicalEqual(before, after);
|
|
1132
1132
|
}
|
|
1133
1133
|
function diffOntology(before, after) {
|
|
1134
1134
|
const changes = [];
|
|
@@ -1227,7 +1227,7 @@ function diffIndexes(before, after) {
|
|
|
1227
1227
|
for (const [name, beforeIndex] of beforeByName) {
|
|
1228
1228
|
const afterIndex = afterByName.get(name);
|
|
1229
1229
|
if (!afterIndex) continue;
|
|
1230
|
-
if (!
|
|
1230
|
+
if (!chunk5JOCIMQ3_cjs.canonicalEqual(beforeIndex, afterIndex)) {
|
|
1231
1231
|
changes.push({
|
|
1232
1232
|
type: "modified",
|
|
1233
1233
|
name,
|
|
@@ -1257,7 +1257,7 @@ function diffExtension(before, after) {
|
|
|
1257
1257
|
details: "Graph extension document was removed"
|
|
1258
1258
|
};
|
|
1259
1259
|
}
|
|
1260
|
-
if (
|
|
1260
|
+
if (chunk5JOCIMQ3_cjs.canonicalEqual(before, after)) return void 0;
|
|
1261
1261
|
return {
|
|
1262
1262
|
type: "modified",
|
|
1263
1263
|
severity: "safe",
|
|
@@ -1651,7 +1651,7 @@ function extensionKindNames(document) {
|
|
|
1651
1651
|
function mergeGraphExtension(graph, document) {
|
|
1652
1652
|
const existingDocument = graph.extension ?? Object.freeze({});
|
|
1653
1653
|
const unionDocument = unionDocuments(existingDocument, document);
|
|
1654
|
-
if (graph.extension !== void 0 &&
|
|
1654
|
+
if (graph.extension !== void 0 && chunk5JOCIMQ3_cjs.canonicalEqual(unionDocument, existingDocument)) {
|
|
1655
1655
|
return graph;
|
|
1656
1656
|
}
|
|
1657
1657
|
const validatedUnion = chunkHQU2SE74_cjs.unwrap(chunkHQU2SE74_cjs.validateGraphExtension(unionDocument));
|
|
@@ -2245,7 +2245,7 @@ async function ensureIdentitySchemaStorage(backend, schema, options) {
|
|
|
2245
2245
|
options.graphId,
|
|
2246
2246
|
missingTables
|
|
2247
2247
|
);
|
|
2248
|
-
const rebuildRequired = await
|
|
2248
|
+
const rebuildRequired = await chunkEBQX7MYL_cjs.separationRebuildRequired(
|
|
2249
2249
|
backend,
|
|
2250
2250
|
schema,
|
|
2251
2251
|
options.graphId,
|
|
@@ -2316,7 +2316,7 @@ function markIdentityDdlRace(error) {
|
|
|
2316
2316
|
return error;
|
|
2317
2317
|
}
|
|
2318
2318
|
function isIdentityDdlRace(error) {
|
|
2319
|
-
for (const link of
|
|
2319
|
+
for (const link of chunk6JRVV2SS_cjs.errorChain(error)) {
|
|
2320
2320
|
if (typeof link === "object" && link !== null && IDENTITY_DDL_RACES.has(link)) {
|
|
2321
2321
|
return true;
|
|
2322
2322
|
}
|
|
@@ -2328,7 +2328,7 @@ async function executeIdentityDdl(execute, statements) {
|
|
|
2328
2328
|
try {
|
|
2329
2329
|
await execute(statement);
|
|
2330
2330
|
} catch (error) {
|
|
2331
|
-
if (
|
|
2331
|
+
if (chunk6JRVV2SS_cjs.isPostgresConcurrentDdlRaceError(error)) {
|
|
2332
2332
|
throw markIdentityDdlRace(error);
|
|
2333
2333
|
}
|
|
2334
2334
|
throw error;
|
|
@@ -2344,8 +2344,8 @@ async function withIdentityDdlRaceRetry(attempt) {
|
|
|
2344
2344
|
}
|
|
2345
2345
|
}
|
|
2346
2346
|
async function lockIdentityDdl(target) {
|
|
2347
|
-
const plan =
|
|
2348
|
-
const fence =
|
|
2347
|
+
const plan = chunk6JRVV2SS_cjs.resolveWriteFencePlan(target);
|
|
2348
|
+
const fence = chunk6JRVV2SS_cjs.requireWriteFence(plan, "identity DDL", "keyed");
|
|
2349
2349
|
switch (fence.kind) {
|
|
2350
2350
|
case "lock":
|
|
2351
2351
|
case "row": {
|
|
@@ -2383,7 +2383,7 @@ async function identityKindCascadeNeeded(backend, schema, graphId, droppedNodeKi
|
|
|
2383
2383
|
provisionMissing: false
|
|
2384
2384
|
});
|
|
2385
2385
|
if (missingTables.length > 0) return false;
|
|
2386
|
-
return
|
|
2386
|
+
return chunkEBQX7MYL_cjs.hasAssertionsTouchingKinds(backend, schema, graphId, droppedNodeKinds);
|
|
2387
2387
|
}
|
|
2388
2388
|
function assertIdentityStoragePresent(graphId, missingTables) {
|
|
2389
2389
|
if (missingTables.length === 0) return;
|
|
@@ -2406,13 +2406,13 @@ function identitySchemaCommitPreflight(ctx, options) {
|
|
|
2406
2406
|
ctx.graphId,
|
|
2407
2407
|
options.provisionDerivedRelations ?? []
|
|
2408
2408
|
);
|
|
2409
|
-
await
|
|
2410
|
-
await
|
|
2409
|
+
await chunk6B3LQUYG_cjs.lockRecordedGraphWrite(target, ctx.graphId);
|
|
2410
|
+
await chunkEBQX7MYL_cjs.lockIdentityGraph(target, ctx.graphId);
|
|
2411
2411
|
if (options.enablement) {
|
|
2412
|
-
await
|
|
2413
|
-
await
|
|
2412
|
+
await chunkEBQX7MYL_cjs.lockIdentityEnablementNodes(target, ctx.schema);
|
|
2413
|
+
await chunk6B3LQUYG_cjs.withRecordedIdentityMutationTarget(
|
|
2414
2414
|
target,
|
|
2415
|
-
(rawTarget, touch) =>
|
|
2415
|
+
(rawTarget, touch) => chunkEBQX7MYL_cjs.purgeAssertionsWithUnregisteredKinds(
|
|
2416
2416
|
rawTarget,
|
|
2417
2417
|
ctx.schema,
|
|
2418
2418
|
ctx.graphId,
|
|
@@ -2423,9 +2423,9 @@ function identitySchemaCommitPreflight(ctx, options) {
|
|
|
2423
2423
|
}
|
|
2424
2424
|
const droppedNodeKinds = options.droppedNodeKinds ?? [];
|
|
2425
2425
|
if (droppedNodeKinds.length > 0) {
|
|
2426
|
-
await
|
|
2426
|
+
await chunk6B3LQUYG_cjs.withRecordedIdentityMutationTarget(
|
|
2427
2427
|
target,
|
|
2428
|
-
(rawTarget, touch) =>
|
|
2428
|
+
(rawTarget, touch) => chunkEBQX7MYL_cjs.deleteAssertionsTouchingKinds(
|
|
2429
2429
|
rawTarget,
|
|
2430
2430
|
ctx.schema,
|
|
2431
2431
|
ctx.graphId,
|
|
@@ -2434,7 +2434,7 @@ function identitySchemaCommitPreflight(ctx, options) {
|
|
|
2434
2434
|
)
|
|
2435
2435
|
);
|
|
2436
2436
|
}
|
|
2437
|
-
await
|
|
2437
|
+
await chunkEBQX7MYL_cjs.rebuildIdentityClosureForContext({ ...ctx, backend: target });
|
|
2438
2438
|
};
|
|
2439
2439
|
}
|
|
2440
2440
|
async function provisionDerivedRelationsInCommit(target, graphId, ddl) {
|
|
@@ -2448,11 +2448,11 @@ async function provisionDerivedRelationsInCommit(target, graphId, ddl) {
|
|
|
2448
2448
|
}
|
|
2449
2449
|
function identityKindCascadePreflight(ctx, droppedNodeKinds) {
|
|
2450
2450
|
return async (target) => {
|
|
2451
|
-
await
|
|
2452
|
-
await
|
|
2453
|
-
await
|
|
2451
|
+
await chunk6B3LQUYG_cjs.lockRecordedGraphWrite(target, ctx.graphId);
|
|
2452
|
+
await chunkEBQX7MYL_cjs.lockIdentityGraph(target, ctx.graphId);
|
|
2453
|
+
await chunk6B3LQUYG_cjs.withRecordedIdentityMutationTarget(
|
|
2454
2454
|
target,
|
|
2455
|
-
(rawTarget, touch) =>
|
|
2455
|
+
(rawTarget, touch) => chunkEBQX7MYL_cjs.deleteAssertionsTouchingKinds(
|
|
2456
2456
|
rawTarget,
|
|
2457
2457
|
ctx.schema,
|
|
2458
2458
|
ctx.graphId,
|
|
@@ -3159,7 +3159,7 @@ async function loadActiveSchemaWithBootstrap(backend, graphId) {
|
|
|
3159
3159
|
try {
|
|
3160
3160
|
return await backend.getActiveSchema(graphId);
|
|
3161
3161
|
} catch (error) {
|
|
3162
|
-
if (backend.bootstrapTables &&
|
|
3162
|
+
if (backend.bootstrapTables && chunk6JRVV2SS_cjs.isMissingTableError(error)) {
|
|
3163
3163
|
await backend.bootstrapTables();
|
|
3164
3164
|
return await backend.getActiveSchema(graphId);
|
|
3165
3165
|
}
|
|
@@ -3355,7 +3355,7 @@ async function readActiveSchemaPure(backend, graphId) {
|
|
|
3355
3355
|
try {
|
|
3356
3356
|
activeRow = await backend.getActiveSchema(graphId);
|
|
3357
3357
|
} catch (error) {
|
|
3358
|
-
if (
|
|
3358
|
+
if (chunk6JRVV2SS_cjs.isMissingTableError(error)) {
|
|
3359
3359
|
throw schemaNotInitializedError(graphId, error);
|
|
3360
3360
|
}
|
|
3361
3361
|
throw error;
|
|
@@ -3552,7 +3552,7 @@ function assertGraphEdgeMatchIdentitySupport(backend, graph) {
|
|
|
3552
3552
|
for (const [kind, registration] of Object.entries(graph.edges)) {
|
|
3553
3553
|
const identity = registration.matchIdentity;
|
|
3554
3554
|
if (identity === void 0) continue;
|
|
3555
|
-
|
|
3555
|
+
chunkEBQX7MYL_cjs.assertEdgeMatchIdentityBackendSupport(identity, backend.capabilities, kind);
|
|
3556
3556
|
}
|
|
3557
3557
|
}
|
|
3558
3558
|
function edgeKindsRequiringMatchIdentityMaterialization(target, storedSchema) {
|
|
@@ -3597,7 +3597,7 @@ function edgeMatchIdentityRekeyPopulatedError(graphId, currentVersion, edgeKinds
|
|
|
3597
3597
|
}
|
|
3598
3598
|
async function prepareIdentityKindCascade(backend, target, options) {
|
|
3599
3599
|
if (options.droppedNodeKinds.length === 0) return void 0;
|
|
3600
|
-
const schema = options.schema === void 0 ?
|
|
3600
|
+
const schema = options.schema === void 0 ? chunk6JRVV2SS_cjs.createSqlSchema(backend.tableNames) : chunk6JRVV2SS_cjs.requireSqlSchema(options.schema, "The schema option");
|
|
3601
3601
|
if (options.probeBeforeCascade) {
|
|
3602
3602
|
const needed = await identityKindCascadeNeeded(
|
|
3603
3603
|
backend,
|
|
@@ -3613,7 +3613,7 @@ async function prepareIdentityKindCascade(backend, target, options) {
|
|
|
3613
3613
|
);
|
|
3614
3614
|
}
|
|
3615
3615
|
async function prepareIdentitySchemaCommit(backend, target, options) {
|
|
3616
|
-
const schema = options.schema === void 0 ?
|
|
3616
|
+
const schema = options.schema === void 0 ? chunk6JRVV2SS_cjs.createSqlSchema(backend.tableNames) : chunk6JRVV2SS_cjs.requireSqlSchema(options.schema, "The schema option");
|
|
3617
3617
|
const registry = buildKindRegistry(target);
|
|
3618
3618
|
const provisioning = await ensureIdentitySchemaStorage(backend, schema, {
|
|
3619
3619
|
graphId: target.id,
|
|
@@ -3839,5 +3839,5 @@ exports.serializeSchema = serializeSchema;
|
|
|
3839
3839
|
exports.serializeSchemaProperties = serializeSchemaProperties;
|
|
3840
3840
|
exports.stripGraphExtension = stripGraphExtension;
|
|
3841
3841
|
exports.subClassOf = subClassOf;
|
|
3842
|
-
//# sourceMappingURL=chunk-
|
|
3843
|
-
//# sourceMappingURL=chunk-
|
|
3842
|
+
//# sourceMappingURL=chunk-BX42F7IJ.cjs.map
|
|
3843
|
+
//# sourceMappingURL=chunk-BX42F7IJ.cjs.map
|