@nicia-ai/typegraph 0.24.1 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/dist/backend/postgres/index.cjs +178 -55
  2. package/dist/backend/postgres/index.cjs.map +1 -1
  3. package/dist/backend/postgres/index.d.cts +6 -7
  4. package/dist/backend/postgres/index.d.ts +6 -7
  5. package/dist/backend/postgres/index.js +151 -28
  6. package/dist/backend/postgres/index.js.map +1 -1
  7. package/dist/backend/sqlite/index.cjs +19 -17
  8. package/dist/backend/sqlite/index.d.cts +6 -7
  9. package/dist/backend/sqlite/index.d.ts +6 -7
  10. package/dist/backend/sqlite/index.js +9 -7
  11. package/dist/backend/sqlite/libsql.cjs +12 -10
  12. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  13. package/dist/backend/sqlite/libsql.d.cts +4 -5
  14. package/dist/backend/sqlite/libsql.d.ts +4 -5
  15. package/dist/backend/sqlite/libsql.js +9 -7
  16. package/dist/backend/sqlite/libsql.js.map +1 -1
  17. package/dist/backend/sqlite/local.cjs +14 -12
  18. package/dist/backend/sqlite/local.cjs.map +1 -1
  19. package/dist/backend/sqlite/local.d.cts +4 -5
  20. package/dist/backend/sqlite/local.d.ts +4 -5
  21. package/dist/backend/sqlite/local.js +9 -7
  22. package/dist/backend/sqlite/local.js.map +1 -1
  23. package/dist/chunk-4BOWVUGQ.js +2029 -0
  24. package/dist/chunk-4BOWVUGQ.js.map +1 -0
  25. package/dist/{chunk-SUHW2UYL.cjs → chunk-7CDXX3QZ.cjs} +2 -2
  26. package/dist/chunk-7CDXX3QZ.cjs.map +1 -0
  27. package/dist/chunk-7V335GHG.cjs +112 -0
  28. package/dist/chunk-7V335GHG.cjs.map +1 -0
  29. package/dist/chunk-7W3KAMVQ.cjs +2678 -0
  30. package/dist/chunk-7W3KAMVQ.cjs.map +1 -0
  31. package/dist/chunk-CTHNVU6K.cjs +551 -0
  32. package/dist/chunk-CTHNVU6K.cjs.map +1 -0
  33. package/dist/chunk-D2GO3RBL.cjs +12 -0
  34. package/dist/chunk-D2GO3RBL.cjs.map +1 -0
  35. package/dist/{chunk-WFMTAEEN.js → chunk-DOTEN2FG.js} +81 -7
  36. package/dist/chunk-DOTEN2FG.js.map +1 -0
  37. package/dist/chunk-E5JZSEGJ.cjs +301 -0
  38. package/dist/chunk-E5JZSEGJ.cjs.map +1 -0
  39. package/dist/chunk-EG6TJ3I5.js +286 -0
  40. package/dist/chunk-EG6TJ3I5.js.map +1 -0
  41. package/dist/chunk-EJCDOA37.js +537 -0
  42. package/dist/chunk-EJCDOA37.js.map +1 -0
  43. package/dist/{chunk-UVZHTBZ5.cjs → chunk-EK6RJ373.cjs} +7 -150
  44. package/dist/chunk-EK6RJ373.cjs.map +1 -0
  45. package/dist/{chunk-GUTQTMOV.js → chunk-FPCOUJSL.js} +2 -2
  46. package/dist/chunk-FPCOUJSL.js.map +1 -0
  47. package/dist/{chunk-3JK66E3I.cjs → chunk-JTI5WT4P.cjs} +630 -59
  48. package/dist/chunk-JTI5WT4P.cjs.map +1 -0
  49. package/dist/chunk-LVCSL6A3.js +2626 -0
  50. package/dist/chunk-LVCSL6A3.js.map +1 -0
  51. package/dist/chunk-NHQWXSTS.js +10 -0
  52. package/dist/chunk-NHQWXSTS.js.map +1 -0
  53. package/dist/chunk-NZ5PMBTG.js +105 -0
  54. package/dist/chunk-NZ5PMBTG.js.map +1 -0
  55. package/dist/{chunk-5HVDOPZU.cjs → chunk-O2P3KAUT.cjs} +416 -93
  56. package/dist/chunk-O2P3KAUT.cjs.map +1 -0
  57. package/dist/{chunk-QOLTW7OZ.js → chunk-OJ6IQVZG.js} +151 -13
  58. package/dist/chunk-OJ6IQVZG.js.map +1 -0
  59. package/dist/{chunk-EYELZHKY.js → chunk-OOS2RKRH.js} +5 -140
  60. package/dist/chunk-OOS2RKRH.js.map +1 -0
  61. package/dist/chunk-RCAJZG67.cjs +2069 -0
  62. package/dist/chunk-RCAJZG67.cjs.map +1 -0
  63. package/dist/{chunk-O5PST6TB.cjs → chunk-W5MTHMTE.cjs} +83 -6
  64. package/dist/chunk-W5MTHMTE.cjs.map +1 -0
  65. package/dist/{chunk-EY4LBX3F.js → chunk-WI5VRP3X.js} +337 -26
  66. package/dist/chunk-WI5VRP3X.js.map +1 -0
  67. package/dist/chunk-WVQXAFP3.js +79 -0
  68. package/dist/chunk-WVQXAFP3.js.map +1 -0
  69. package/dist/chunk-X3244EKP.cjs +84 -0
  70. package/dist/chunk-X3244EKP.cjs.map +1 -0
  71. package/dist/{chunk-753F33CV.js → chunk-YZZBDCLV.js} +617 -44
  72. package/dist/chunk-YZZBDCLV.js.map +1 -0
  73. package/dist/{chunk-OVJ2BE5Q.cjs → chunk-ZEMNF3QK.cjs} +171 -33
  74. package/dist/chunk-ZEMNF3QK.cjs.map +1 -0
  75. package/dist/{ddl-B_H8JM-E.d.cts → ddl-B2jjLjpR.d.cts} +762 -99
  76. package/dist/{ddl-1tFIvt9V.d.ts → ddl-DpaeAKPp.d.ts} +762 -99
  77. package/dist/extension-types-D07e_NTw.d.cts +543 -0
  78. package/dist/extension-types-D07e_NTw.d.ts +543 -0
  79. package/dist/graph-extension/index.cjs +71 -0
  80. package/dist/graph-extension/index.cjs.map +1 -0
  81. package/dist/graph-extension/index.d.cts +278 -0
  82. package/dist/graph-extension/index.d.ts +278 -0
  83. package/dist/graph-extension/index.js +6 -0
  84. package/dist/graph-extension/index.js.map +1 -0
  85. package/dist/{index-DXkEXpNz.d.ts → index-CT6nvtxL.d.cts} +114 -5
  86. package/dist/{index-DXkEXpNz.d.cts → index-DQheiVQV.d.ts} +114 -5
  87. package/dist/index.cjs +2672 -901
  88. package/dist/index.cjs.map +1 -1
  89. package/dist/index.d.cts +29 -10
  90. package/dist/index.d.ts +29 -10
  91. package/dist/index.js +2248 -598
  92. package/dist/index.js.map +1 -1
  93. package/dist/indexes/index.cjs +25 -23
  94. package/dist/indexes/index.d.cts +40 -22
  95. package/dist/indexes/index.d.ts +40 -22
  96. package/dist/indexes/index.js +5 -3
  97. package/dist/interchange/index.cjs +8 -7
  98. package/dist/interchange/index.cjs.map +1 -1
  99. package/dist/interchange/index.d.cts +5 -4
  100. package/dist/interchange/index.d.ts +5 -4
  101. package/dist/interchange/index.js +3 -2
  102. package/dist/interchange/index.js.map +1 -1
  103. package/dist/{manager-nIhmttD-.d.ts → manager-BKaPQbns.d.ts} +189 -6
  104. package/dist/{manager-Vkz28eAC.d.cts → manager-BpjBW1JK.d.cts} +189 -6
  105. package/dist/materialize-indexes-BB9N5uQl.d.cts +68 -0
  106. package/dist/materialize-indexes-BYpU2RKh.d.ts +68 -0
  107. package/dist/profiler/index.cjs +10 -8
  108. package/dist/profiler/index.cjs.map +1 -1
  109. package/dist/profiler/index.d.cts +8 -7
  110. package/dist/profiler/index.d.ts +8 -7
  111. package/dist/profiler/index.js +3 -1
  112. package/dist/profiler/index.js.map +1 -1
  113. package/dist/schema/index.cjs +43 -22
  114. package/dist/schema/index.cjs.map +1 -1
  115. package/dist/schema/index.d.cts +17 -8
  116. package/dist/schema/index.d.ts +17 -8
  117. package/dist/schema/index.js +9 -4
  118. package/dist/schema/index.js.map +1 -1
  119. package/dist/{sqlite-D0aceIe0.d.cts → sqlite-CU3j6rc7.d.ts} +837 -120
  120. package/dist/{sqlite-SUxbZqfy.d.ts → sqlite-Myo8e3Lr.d.cts} +837 -120
  121. package/dist/{store-U3i2tUch.d.ts → store-BAGuOHDh.d.cts} +659 -23
  122. package/dist/{store-CpvwTMxV.d.cts → store-De98Lod4.d.ts} +659 -23
  123. package/dist/types--0EslBx5.d.cts +2123 -0
  124. package/dist/{types-qYFZ9SqD.d.ts → types-BLmJq4wI.d.ts} +3 -2
  125. package/dist/types-BNWYZ-0-.d.ts +2123 -0
  126. package/dist/{types-yH4_p0XB.d.cts → types-CYga3lZp.d.cts} +3 -2
  127. package/dist/where-CluR73rs.d.ts +11 -0
  128. package/dist/where-m1uWsdua.d.cts +11 -0
  129. package/package.json +33 -73
  130. package/dist/ast-C8S37w1A.d.ts +0 -497
  131. package/dist/ast-dgLhLOg0.d.cts +0 -497
  132. package/dist/chunk-3JK66E3I.cjs.map +0 -1
  133. package/dist/chunk-3PPEHLGK.js +0 -1116
  134. package/dist/chunk-3PPEHLGK.js.map +0 -1
  135. package/dist/chunk-5HVDOPZU.cjs.map +0 -1
  136. package/dist/chunk-753F33CV.js.map +0 -1
  137. package/dist/chunk-EY4LBX3F.js.map +0 -1
  138. package/dist/chunk-EYELZHKY.js.map +0 -1
  139. package/dist/chunk-GFGVREHH.js +0 -1381
  140. package/dist/chunk-GFGVREHH.js.map +0 -1
  141. package/dist/chunk-GUTQTMOV.js.map +0 -1
  142. package/dist/chunk-LBORRUNJ.js +0 -135
  143. package/dist/chunk-LBORRUNJ.js.map +0 -1
  144. package/dist/chunk-O5PST6TB.cjs.map +0 -1
  145. package/dist/chunk-OLROXS2S.cjs +0 -147
  146. package/dist/chunk-OLROXS2S.cjs.map +0 -1
  147. package/dist/chunk-OVJ2BE5Q.cjs.map +0 -1
  148. package/dist/chunk-PAUN562Y.cjs +0 -1417
  149. package/dist/chunk-PAUN562Y.cjs.map +0 -1
  150. package/dist/chunk-PEE4EWXZ.cjs +0 -1131
  151. package/dist/chunk-PEE4EWXZ.cjs.map +0 -1
  152. package/dist/chunk-QOLTW7OZ.js.map +0 -1
  153. package/dist/chunk-SUHW2UYL.cjs.map +0 -1
  154. package/dist/chunk-UVZHTBZ5.cjs.map +0 -1
  155. package/dist/chunk-WFMTAEEN.js.map +0 -1
  156. package/dist/types-C-zfYDJB.d.ts +0 -159
  157. package/dist/types-CQx4iW5Y.d.cts +0 -159
  158. package/dist/types-Qk2l3IkQ.d.cts +0 -1254
  159. package/dist/types-Qk2l3IkQ.d.ts +0 -1254
@@ -1,12 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkHTGDWIDE_cjs = require('../../chunk-HTGDWIDE.cjs');
4
- var chunk5HVDOPZU_cjs = require('../../chunk-5HVDOPZU.cjs');
5
- var chunkSUHW2UYL_cjs = require('../../chunk-SUHW2UYL.cjs');
6
- require('../../chunk-O5PST6TB.cjs');
7
- require('../../chunk-PEE4EWXZ.cjs');
8
- var chunk3JK66E3I_cjs = require('../../chunk-3JK66E3I.cjs');
9
- require('../../chunk-UVZHTBZ5.cjs');
4
+ var chunkO2P3KAUT_cjs = require('../../chunk-O2P3KAUT.cjs');
5
+ var chunk7CDXX3QZ_cjs = require('../../chunk-7CDXX3QZ.cjs');
6
+ var chunkJTI5WT4P_cjs = require('../../chunk-JTI5WT4P.cjs');
7
+ require('../../chunk-CTHNVU6K.cjs');
8
+ require('../../chunk-EK6RJ373.cjs');
9
+ require('../../chunk-X3244EKP.cjs');
10
+ var chunkW5MTHMTE_cjs = require('../../chunk-W5MTHMTE.cjs');
11
+ require('../../chunk-7V335GHG.cjs');
10
12
  var drizzleOrm = require('drizzle-orm');
11
13
 
12
14
  // src/backend/drizzle/execution/postgres-execution.ts
@@ -31,7 +33,7 @@ var DEFAULT_POSTGRES_STATEMENT_CACHE_MAX = 256;
31
33
  var STATEMENT_NAME_CACHE = /* @__PURE__ */ new Map();
32
34
  var nextStatementId = 0;
33
35
  function statementNameFor(sqlText, cacheMax) {
34
- return chunk5HVDOPZU_cjs.getOrCreateLru(STATEMENT_NAME_CACHE, sqlText, cacheMax, () => {
36
+ return chunkO2P3KAUT_cjs.getOrCreateLru(STATEMENT_NAME_CACHE, sqlText, cacheMax, () => {
35
37
  const name = `tg_${nextStatementId}`;
36
38
  nextStatementId += 1;
37
39
  return name;
@@ -122,7 +124,7 @@ function createPostgresExecutionAdapter(db, options = {}) {
122
124
  const cacheMax = options.preparedStatementCacheMax ?? DEFAULT_POSTGRES_STATEMENT_CACHE_MAX;
123
125
  const pgClient = resolvePgClient(db, prepareStatements, cacheMax);
124
126
  function compile(query) {
125
- return chunk5HVDOPZU_cjs.compileQueryWithDialect(db, query, "PostgreSQL");
127
+ return chunkO2P3KAUT_cjs.compileQueryWithDialect(db, query, "PostgreSQL");
126
128
  }
127
129
  if (pgClient === void 0) {
128
130
  return {
@@ -178,10 +180,10 @@ var POSTGRES_CHECK_UNIQUE_BATCH_CHUNK_SIZE = Math.max(
178
180
  1,
179
181
  POSTGRES_MAX_BIND_PARAMETERS - CHECK_UNIQUE_BATCH_FIXED_PARAM_COUNT
180
182
  );
181
- var toNodeRow = chunk5HVDOPZU_cjs.createNodeRowMapper(chunk5HVDOPZU_cjs.POSTGRES_ROW_MAPPER_CONFIG);
182
- var toEdgeRow = chunk5HVDOPZU_cjs.createEdgeRowMapper(chunk5HVDOPZU_cjs.POSTGRES_ROW_MAPPER_CONFIG);
183
- var toUniqueRow = chunk5HVDOPZU_cjs.createUniqueRowMapper(chunk5HVDOPZU_cjs.POSTGRES_ROW_MAPPER_CONFIG);
184
- var toSchemaVersionRow = chunk5HVDOPZU_cjs.createSchemaVersionRowMapper(chunk5HVDOPZU_cjs.POSTGRES_ROW_MAPPER_CONFIG);
183
+ var toNodeRow = chunkO2P3KAUT_cjs.createNodeRowMapper(chunkO2P3KAUT_cjs.POSTGRES_ROW_MAPPER_CONFIG);
184
+ var toEdgeRow = chunkO2P3KAUT_cjs.createEdgeRowMapper(chunkO2P3KAUT_cjs.POSTGRES_ROW_MAPPER_CONFIG);
185
+ var toUniqueRow = chunkO2P3KAUT_cjs.createUniqueRowMapper(chunkO2P3KAUT_cjs.POSTGRES_ROW_MAPPER_CONFIG);
186
+ var toSchemaVersionRow = chunkO2P3KAUT_cjs.createSchemaVersionRowMapper(chunkO2P3KAUT_cjs.POSTGRES_ROW_MAPPER_CONFIG);
185
187
  function toEmbeddingRow(row) {
186
188
  let embedding;
187
189
  if (typeof row.embedding === "string") {
@@ -199,8 +201,8 @@ function toEmbeddingRow(row) {
199
201
  field_path: row.field_path,
200
202
  embedding,
201
203
  dimensions: row.dimensions,
202
- created_at: chunk5HVDOPZU_cjs.formatPostgresTimestamp(row.created_at) ?? "",
203
- updated_at: chunk5HVDOPZU_cjs.formatPostgresTimestamp(row.updated_at) ?? ""
204
+ created_at: chunkO2P3KAUT_cjs.formatPostgresTimestamp(row.created_at) ?? "",
205
+ updated_at: chunkO2P3KAUT_cjs.formatPostgresTimestamp(row.updated_at) ?? ""
204
206
  };
205
207
  }
206
208
  function coerceNumericScore(value) {
@@ -215,7 +217,7 @@ function coerceNumericScore(value) {
215
217
  }
216
218
  function buildPostgresCapabilities(strategy) {
217
219
  return {
218
- ...chunkSUHW2UYL_cjs.POSTGRES_CAPABILITIES,
220
+ ...chunk7CDXX3QZ_cjs.POSTGRES_CAPABILITIES,
219
221
  vector: {
220
222
  supported: true,
221
223
  metrics: ["cosine", "l2", "inner_product"],
@@ -223,12 +225,12 @@ function buildPostgresCapabilities(strategy) {
223
225
  maxDimensions: 16e3
224
226
  // pgvector limit
225
227
  },
226
- fulltext: chunk3JK66E3I_cjs.buildFulltextCapabilities(strategy)
228
+ fulltext: chunkJTI5WT4P_cjs.buildFulltextCapabilities(strategy)
227
229
  };
228
230
  }
229
231
  function createPostgresBackend(db, options = {}) {
230
- const tables2 = options.tables ?? chunk5HVDOPZU_cjs.tables;
231
- const fulltextStrategy = options.fulltext ?? chunk3JK66E3I_cjs.tsvectorStrategy;
232
+ const tables2 = options.tables ?? chunkO2P3KAUT_cjs.tables;
233
+ const fulltextStrategy = options.fulltext ?? chunkJTI5WT4P_cjs.tsvectorStrategy;
232
234
  const baseCapabilities = buildPostgresCapabilities(fulltextStrategy);
233
235
  const httpOnlyOverrides = isNeonHttpClient(db) ? { transactions: false } : {};
234
236
  const capabilities = {
@@ -245,7 +247,8 @@ function createPostgresBackend(db, options = {}) {
245
247
  nodes: drizzleOrm.getTableName(tables2.nodes),
246
248
  edges: drizzleOrm.getTableName(tables2.edges),
247
249
  embeddings: drizzleOrm.getTableName(tables2.embeddings),
248
- fulltext: tables2.fulltextTableName
250
+ fulltext: tables2.fulltextTableName,
251
+ uniques: drizzleOrm.getTableName(tables2.uniques)
249
252
  };
250
253
  const analyzeStatement = drizzleOrm.sql`ANALYZE ${drizzleOrm.sql.join(
251
254
  [
@@ -257,7 +260,7 @@ function createPostgresBackend(db, options = {}) {
257
260
  ].map((name) => chunkHTGDWIDE_cjs.quoteIdentifier(name)),
258
261
  drizzleOrm.sql`, `
259
262
  )}`;
260
- const operationStrategy = chunk5HVDOPZU_cjs.createPostgresOperationStrategy(
263
+ const operationStrategy = chunkO2P3KAUT_cjs.createPostgresOperationStrategy(
261
264
  tables2,
262
265
  fulltextStrategy
263
266
  );
@@ -269,22 +272,139 @@ function createPostgresBackend(db, options = {}) {
269
272
  capabilities,
270
273
  fulltextStrategy
271
274
  });
275
+ function runSchemaWriteTransaction(graphId, fn) {
276
+ if (!capabilities.transactions) {
277
+ throw new chunkW5MTHMTE_cjs.ConfigurationError(
278
+ "commitSchemaVersion and setActiveVersion require atomic transactions, but this Postgres backend does not provide them. The drizzle-orm/neon-http driver communicates over HTTP and cannot hold a session across statements; use drizzle-orm/neon-serverless (websocket) for transactional writes.",
279
+ {
280
+ backend: "postgres",
281
+ capability: "transactions",
282
+ supportsTransactions: false
283
+ }
284
+ );
285
+ }
286
+ return db.transaction(async (tx) => {
287
+ await tx.execute(
288
+ drizzleOrm.sql`SELECT pg_advisory_xact_lock(hashtext(${graphId}))`
289
+ );
290
+ const txBackend = createTransactionBackend({
291
+ db: tx,
292
+ adapterOptions,
293
+ operationStrategy,
294
+ tableNames,
295
+ capabilities,
296
+ fulltextStrategy
297
+ });
298
+ return fn(txBackend);
299
+ });
300
+ }
272
301
  const backend = {
273
302
  ...operations,
274
303
  async bootstrapTables() {
275
- const statements = chunk5HVDOPZU_cjs.generatePostgresDDL(tables2, fulltextStrategy);
304
+ const statements = chunkO2P3KAUT_cjs.generatePostgresDDL(tables2, fulltextStrategy);
276
305
  for (const statement of statements) {
277
306
  await db.execute(drizzleOrm.sql.raw(statement));
278
307
  }
279
308
  },
309
+ async executeDdl(ddl) {
310
+ await db.execute(drizzleOrm.sql.raw(ddl));
311
+ },
312
+ async ensureIndexMaterializationsTable() {
313
+ await db.execute(
314
+ drizzleOrm.sql.raw(chunkO2P3KAUT_cjs.generatePgCreateTableSQL(tables2.indexMaterializations))
315
+ );
316
+ },
317
+ async getIndexMaterialization(indexName) {
318
+ const t = tables2.indexMaterializations;
319
+ const rows = await db.select().from(t).where(drizzleOrm.eq(t.indexName, indexName));
320
+ const row = rows[0];
321
+ if (row === void 0) return void 0;
322
+ return chunkO2P3KAUT_cjs.mapMaterializationRow(row, chunkO2P3KAUT_cjs.POSTGRES_INDEX_MAT_TIMESTAMPS.decode);
323
+ },
324
+ async getIndexMaterializations(statusKeys) {
325
+ if (statusKeys.length === 0) return [];
326
+ const t = tables2.indexMaterializations;
327
+ const rows = await db.select().from(t).where(drizzleOrm.inArray(t.indexName, [...statusKeys]));
328
+ return rows.map(
329
+ (row) => chunkO2P3KAUT_cjs.mapMaterializationRow(row, chunkO2P3KAUT_cjs.POSTGRES_INDEX_MAT_TIMESTAMPS.decode)
330
+ );
331
+ },
332
+ async recordIndexMaterialization(params) {
333
+ const t = tables2.indexMaterializations;
334
+ await db.insert(t).values(
335
+ chunkO2P3KAUT_cjs.buildMaterializationInsertValues(
336
+ params,
337
+ chunkO2P3KAUT_cjs.POSTGRES_INDEX_MAT_TIMESTAMPS.encode
338
+ )
339
+ ).onConflictDoUpdate({
340
+ target: t.indexName,
341
+ set: chunkO2P3KAUT_cjs.buildMaterializationOnConflictSet(
342
+ t.materializedAt,
343
+ params.materializedAt
344
+ )
345
+ });
346
+ },
347
+ async ensureKindRemovalsTable() {
348
+ await db.execute(
349
+ drizzleOrm.sql.raw(chunkO2P3KAUT_cjs.generatePgCreateTableSQL(tables2.kindRemovals))
350
+ );
351
+ },
352
+ async getPendingKindRemovals(graphId) {
353
+ const t = tables2.kindRemovals;
354
+ const rows = await db.select().from(t).where(drizzleOrm.and(drizzleOrm.eq(t.graphId, graphId), drizzleOrm.isNull(t.removedAt)));
355
+ return rows.map(
356
+ (row) => chunkO2P3KAUT_cjs.mapKindRemovalRow(row, chunkO2P3KAUT_cjs.POSTGRES_KIND_REMOVAL_TIMESTAMPS.decode)
357
+ );
358
+ },
359
+ async getAllKindRemovals(graphId) {
360
+ const t = tables2.kindRemovals;
361
+ const rows = await db.select().from(t).where(drizzleOrm.eq(t.graphId, graphId));
362
+ return rows.map(
363
+ (row) => chunkO2P3KAUT_cjs.mapKindRemovalRow(row, chunkO2P3KAUT_cjs.POSTGRES_KIND_REMOVAL_TIMESTAMPS.decode)
364
+ );
365
+ },
366
+ async recordKindRemoval(params) {
367
+ const t = tables2.kindRemovals;
368
+ await db.insert(t).values(
369
+ chunkO2P3KAUT_cjs.buildKindRemovalInsertValues(
370
+ params,
371
+ chunkO2P3KAUT_cjs.POSTGRES_KIND_REMOVAL_TIMESTAMPS.encode
372
+ )
373
+ ).onConflictDoUpdate({
374
+ target: [t.graphId, t.kindName, t.entity, t.schemaVersion],
375
+ set: chunkO2P3KAUT_cjs.buildKindRemovalOnConflictSet(t.removedAt, params.removedAt)
376
+ });
377
+ },
378
+ async ensureReconciliationMarkersTable() {
379
+ await db.execute(
380
+ drizzleOrm.sql.raw(chunkO2P3KAUT_cjs.generatePgCreateTableSQL(tables2.reconciliationMarkers))
381
+ );
382
+ },
383
+ async getReconciliationMarker(graphId) {
384
+ const t = tables2.reconciliationMarkers;
385
+ const rows = await db.select().from(t).where(drizzleOrm.eq(t.graphId, graphId));
386
+ return rows[0]?.reconciledToVersion;
387
+ },
388
+ async setReconciliationMarker(graphId, version) {
389
+ const t = tables2.reconciliationMarkers;
390
+ await db.insert(t).values({ graphId, reconciledToVersion: version }).onConflictDoUpdate({
391
+ target: t.graphId,
392
+ set: { reconciledToVersion: version }
393
+ });
394
+ },
280
395
  async refreshStatistics() {
281
396
  await db.execute(analyzeStatement);
282
397
  },
283
- async setActiveSchema(graphId, version) {
284
- await chunkSUHW2UYL_cjs.runOptionallyInTransaction(
285
- backend,
286
- (target) => target.setActiveSchema(graphId, version),
287
- operations
398
+ async commitSchemaVersion(params) {
399
+ return runSchemaWriteTransaction(
400
+ params.graphId,
401
+ (target) => target.commitSchemaVersion(params)
402
+ );
403
+ },
404
+ async setActiveVersion(params) {
405
+ await runSchemaWriteTransaction(
406
+ params.graphId,
407
+ (target) => target.setActiveVersion(params)
288
408
  );
289
409
  },
290
410
  async transaction(fn, options2) {
@@ -327,7 +447,7 @@ function createPostgresOperationBackend(options) {
327
447
  async function execRun(query) {
328
448
  await executionAdapter.execute(query);
329
449
  }
330
- const commonBackend = chunk5HVDOPZU_cjs.createCommonOperationBackend({
450
+ const commonBackend = chunkO2P3KAUT_cjs.createCommonOperationBackend({
331
451
  batchConfig: {
332
452
  checkUniqueBatchChunkSize: POSTGRES_CHECK_UNIQUE_BATCH_CHUNK_SIZE,
333
453
  edgeInsertBatchSize: POSTGRES_EDGE_INSERT_BATCH_SIZE,
@@ -340,7 +460,7 @@ function createPostgresOperationBackend(options) {
340
460
  execGet,
341
461
  execRun
342
462
  },
343
- nowIso: chunk5HVDOPZU_cjs.nowIso,
463
+ nowIso: chunkO2P3KAUT_cjs.nowIso,
344
464
  operationStrategy,
345
465
  rowMappers: {
346
466
  toEdgeRow,
@@ -364,7 +484,7 @@ function createPostgresOperationBackend(options) {
364
484
  tableNames,
365
485
  // === Embedding Operations ===
366
486
  async upsertEmbedding(params) {
367
- const timestamp = chunk5HVDOPZU_cjs.nowIso();
487
+ const timestamp = chunkO2P3KAUT_cjs.nowIso();
368
488
  const query = operationStrategy.buildUpsertEmbedding(params, timestamp);
369
489
  await execRun(query);
370
490
  },
@@ -401,9 +521,10 @@ function createPostgresOperationBackend(options) {
401
521
  metric: params.metric,
402
522
  ...params.indexParams?.m === void 0 ? {} : { hnswM: params.indexParams.m },
403
523
  ...params.indexParams?.efConstruction === void 0 ? {} : { hnswEfConstruction: params.indexParams.efConstruction },
404
- ...params.indexParams?.lists === void 0 ? {} : { ivfflatLists: params.indexParams.lists }
524
+ ...params.indexParams?.lists === void 0 ? {} : { ivfflatLists: params.indexParams.lists },
525
+ ...params.concurrent === true ? { concurrent: true } : {}
405
526
  };
406
- const result = await chunk5HVDOPZU_cjs.createPostgresVectorIndex(db, indexOptions);
527
+ const result = await chunkO2P3KAUT_cjs.createPostgresVectorIndex(db, indexOptions);
407
528
  if (!result.success) {
408
529
  throw new Error(
409
530
  result.message ?? "Failed to create PostgreSQL vector index"
@@ -412,7 +533,7 @@ function createPostgresOperationBackend(options) {
412
533
  },
413
534
  // === Fulltext Operations ===
414
535
  async upsertFulltext(params) {
415
- const timestamp = chunk5HVDOPZU_cjs.nowIso();
536
+ const timestamp = chunkO2P3KAUT_cjs.nowIso();
416
537
  const statements = operationStrategy.buildUpsertFulltext(
417
538
  params,
418
539
  timestamp
@@ -429,7 +550,7 @@ function createPostgresOperationBackend(options) {
429
550
  },
430
551
  async upsertFulltextBatch(params) {
431
552
  if (params.rows.length === 0) return;
432
- const timestamp = chunk5HVDOPZU_cjs.nowIso();
553
+ const timestamp = chunkO2P3KAUT_cjs.nowIso();
433
554
  const statements = operationStrategy.buildUpsertFulltextBatch(
434
555
  params,
435
556
  timestamp
@@ -457,20 +578,22 @@ function createPostgresOperationBackend(options) {
457
578
  },
458
579
  async dropVectorIndex(params) {
459
580
  const metrics = capabilities.vector?.metrics ?? ["cosine"];
460
- for (const metric of metrics) {
461
- const indexName = chunk5HVDOPZU_cjs.generateVectorIndexName(
462
- params.graphId,
463
- params.nodeKind,
464
- params.fieldPath,
465
- metric
466
- );
467
- const result = await chunk5HVDOPZU_cjs.dropPostgresVectorIndex(db, indexName);
468
- if (!result.success) {
469
- throw new Error(
470
- result.message ?? "Failed to drop PostgreSQL vector index"
581
+ await Promise.all(
582
+ metrics.map(async (metric) => {
583
+ const indexName = chunkO2P3KAUT_cjs.generateVectorIndexName(
584
+ params.graphId,
585
+ params.nodeKind,
586
+ params.fieldPath,
587
+ metric
471
588
  );
472
- }
473
- }
589
+ const result = await chunkO2P3KAUT_cjs.dropPostgresVectorIndex(db, indexName);
590
+ if (!result.success) {
591
+ throw new Error(
592
+ result.message ?? "Failed to drop PostgreSQL vector index"
593
+ );
594
+ }
595
+ })
596
+ );
474
597
  },
475
598
  // === Query Execution ===
476
599
  async execute(query) {
@@ -496,39 +619,39 @@ function createTransactionBackend(options) {
496
619
 
497
620
  Object.defineProperty(exports, "createPostgresTables", {
498
621
  enumerable: true,
499
- get: function () { return chunk5HVDOPZU_cjs.createPostgresTables; }
622
+ get: function () { return chunkO2P3KAUT_cjs.createPostgresTables; }
500
623
  });
501
624
  Object.defineProperty(exports, "edges", {
502
625
  enumerable: true,
503
- get: function () { return chunk5HVDOPZU_cjs.edges; }
626
+ get: function () { return chunkO2P3KAUT_cjs.edges; }
504
627
  });
505
628
  Object.defineProperty(exports, "embeddings", {
506
629
  enumerable: true,
507
- get: function () { return chunk5HVDOPZU_cjs.embeddings; }
630
+ get: function () { return chunkO2P3KAUT_cjs.embeddings; }
508
631
  });
509
632
  Object.defineProperty(exports, "generatePostgresDDL", {
510
633
  enumerable: true,
511
- get: function () { return chunk5HVDOPZU_cjs.generatePostgresDDL; }
634
+ get: function () { return chunkO2P3KAUT_cjs.generatePostgresDDL; }
512
635
  });
513
636
  Object.defineProperty(exports, "generatePostgresMigrationSQL", {
514
637
  enumerable: true,
515
- get: function () { return chunk5HVDOPZU_cjs.generatePostgresMigrationSQL; }
638
+ get: function () { return chunkO2P3KAUT_cjs.generatePostgresMigrationSQL; }
516
639
  });
517
640
  Object.defineProperty(exports, "nodes", {
518
641
  enumerable: true,
519
- get: function () { return chunk5HVDOPZU_cjs.nodes; }
642
+ get: function () { return chunkO2P3KAUT_cjs.nodes; }
520
643
  });
521
644
  Object.defineProperty(exports, "schemaVersions", {
522
645
  enumerable: true,
523
- get: function () { return chunk5HVDOPZU_cjs.schemaVersions; }
646
+ get: function () { return chunkO2P3KAUT_cjs.schemaVersions; }
524
647
  });
525
648
  Object.defineProperty(exports, "tables", {
526
649
  enumerable: true,
527
- get: function () { return chunk5HVDOPZU_cjs.tables; }
650
+ get: function () { return chunkO2P3KAUT_cjs.tables; }
528
651
  });
529
652
  Object.defineProperty(exports, "uniques", {
530
653
  enumerable: true,
531
- get: function () { return chunk5HVDOPZU_cjs.uniques; }
654
+ get: function () { return chunkO2P3KAUT_cjs.uniques; }
532
655
  });
533
656
  exports.createPostgresBackend = createPostgresBackend;
534
657
  //# sourceMappingURL=index.cjs.map