@nicia-ai/typegraph 0.27.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/postgres/index.cjs +99 -57
- package/dist/backend/postgres/index.cjs.map +1 -1
- package/dist/backend/postgres/index.d.cts +4 -4
- package/dist/backend/postgres/index.d.ts +4 -4
- package/dist/backend/postgres/index.js +47 -5
- package/dist/backend/postgres/index.js.map +1 -1
- package/dist/backend/sqlite/index.cjs +13 -13
- package/dist/backend/sqlite/index.d.cts +5 -5
- package/dist/backend/sqlite/index.d.ts +5 -5
- package/dist/backend/sqlite/index.js +3 -3
- package/dist/backend/sqlite/libsql.cjs +6 -6
- package/dist/backend/sqlite/libsql.d.cts +2 -2
- package/dist/backend/sqlite/libsql.d.ts +2 -2
- package/dist/backend/sqlite/libsql.js +3 -3
- package/dist/backend/sqlite/local.cjs +7 -7
- package/dist/backend/sqlite/local.d.cts +2 -2
- package/dist/backend/sqlite/local.d.ts +2 -2
- package/dist/backend/sqlite/local.js +3 -3
- package/dist/{chunk-TVUARC7S.cjs → chunk-2E4VTD2E.cjs} +50 -22
- package/dist/chunk-2E4VTD2E.cjs.map +1 -0
- package/dist/{chunk-RVT2N4RF.cjs → chunk-33K3ZYFG.cjs} +46 -46
- package/dist/{chunk-RVT2N4RF.cjs.map → chunk-33K3ZYFG.cjs.map} +1 -1
- package/dist/{chunk-RF5EUQWS.js → chunk-DFHLG75V.js} +50 -22
- package/dist/chunk-DFHLG75V.js.map +1 -0
- package/dist/{chunk-DN4RUDF3.cjs → chunk-LYRUNG6E.cjs} +2 -2
- package/dist/chunk-LYRUNG6E.cjs.map +1 -0
- package/dist/{chunk-ENXJLDRK.js → chunk-PCHTTG42.js} +2 -2
- package/dist/chunk-PCHTTG42.js.map +1 -0
- package/dist/{chunk-DDVA4QBA.js → chunk-UKG7XHZ3.js} +4 -4
- package/dist/{chunk-DDVA4QBA.js.map → chunk-UKG7XHZ3.js.map} +1 -1
- package/dist/{ddl-9kw8UADK.d.ts → ddl-0Ooc2dpL.d.ts} +2 -2
- package/dist/{ddl-Cw82BPM4.d.cts → ddl-Dza3kDrI.d.cts} +2 -2
- package/dist/index.cjs +17 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/interchange/index.d.cts +3 -3
- package/dist/interchange/index.d.ts +3 -3
- package/dist/{manager-CWa9cgwb.d.cts → manager-c1MGaVVR.d.cts} +1 -1
- package/dist/{manager-Cfcb2sJL.d.ts → manager-ehLTTNq0.d.ts} +1 -1
- package/dist/profiler/index.d.cts +5 -5
- package/dist/profiler/index.d.ts +5 -5
- package/dist/schema/index.d.cts +4 -4
- package/dist/schema/index.d.ts +4 -4
- package/dist/{sqlite-GKvcDPVn.d.ts → sqlite-BxZUPbyD.d.ts} +1 -1
- package/dist/{sqlite-BvSEbybu.d.cts → sqlite-mvpXjEeB.d.cts} +1 -1
- package/dist/{store-Ojf0NOKk.d.cts → store-D7YEMg2v.d.cts} +26 -2
- package/dist/{store-C57kdvAa.d.ts → store-Ufc1Eoey.d.ts} +26 -2
- package/dist/{types-Cars4JZ1.d.ts → types-B-sJJ4GQ.d.ts} +1 -1
- package/dist/{types-DZPBXZOK.d.cts → types-CMQymcwk.d.cts} +11 -0
- package/dist/{types-Dzkr0Eqi.d.ts → types-CQ7xXJMP.d.ts} +11 -0
- package/dist/{types-CF7nDH3q.d.cts → types-CmUA9sal.d.cts} +1 -1
- package/dist/{where-BmtjfWuS.d.cts → where-5zf15aFZ.d.cts} +1 -1
- package/dist/{where-kk1Zz2En.d.ts → where-CtrLu1Zf.d.ts} +1 -1
- package/package.json +8 -8
- package/dist/chunk-DN4RUDF3.cjs.map +0 -1
- package/dist/chunk-ENXJLDRK.js.map +0 -1
- package/dist/chunk-RF5EUQWS.js.map +0 -1
- package/dist/chunk-TVUARC7S.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createSqliteBackend } from '../../chunk-
|
|
2
|
-
import { tables2, generateSqliteDDL } from '../../chunk-
|
|
3
|
-
import { wrapWithManagedClose } from '../../chunk-
|
|
1
|
+
import { createSqliteBackend } from '../../chunk-UKG7XHZ3.js';
|
|
2
|
+
import { tables2, generateSqliteDDL } from '../../chunk-DFHLG75V.js';
|
|
3
|
+
import { wrapWithManagedClose } from '../../chunk-PCHTTG42.js';
|
|
4
4
|
import '../../chunk-5H3BAMTB.js';
|
|
5
5
|
import '../../chunk-ZTREJOGB.js';
|
|
6
6
|
import '../../chunk-EJCDOA37.js';
|
|
@@ -1157,39 +1157,56 @@ function createContributionMaterializer(deps) {
|
|
|
1157
1157
|
error: void 0
|
|
1158
1158
|
});
|
|
1159
1159
|
}
|
|
1160
|
+
async function readContributionState(graphId, contribution) {
|
|
1161
|
+
const signature = await computeContributionSignature(
|
|
1162
|
+
dialect,
|
|
1163
|
+
contribution,
|
|
1164
|
+
contribution.createDdl
|
|
1165
|
+
);
|
|
1166
|
+
const identity = identityOf(graphId, contribution);
|
|
1167
|
+
try {
|
|
1168
|
+
const existing = await deps.getMarker(identity);
|
|
1169
|
+
return {
|
|
1170
|
+
kind: "state",
|
|
1171
|
+
state: evaluateContributionState(existing, signature)
|
|
1172
|
+
};
|
|
1173
|
+
} catch (error) {
|
|
1174
|
+
if (!chunkIUIWCFG3_cjs.isMissingTableError(error)) throw error;
|
|
1175
|
+
return { kind: "missing-table", error };
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
async function allContributionsInitialized(graphId, contributions) {
|
|
1179
|
+
for (const contribution of contributions) {
|
|
1180
|
+
const read = await readContributionState(graphId, contribution);
|
|
1181
|
+
if (read.kind !== "state" || read.state !== "initialized") return false;
|
|
1182
|
+
}
|
|
1183
|
+
return true;
|
|
1184
|
+
}
|
|
1160
1185
|
async function ensureRuntimeContributions(graphId) {
|
|
1161
1186
|
if (initializedGraphIds.has(graphId)) return;
|
|
1162
1187
|
const contributions = runtimeContributions();
|
|
1163
|
-
if (
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1188
|
+
if (await allContributionsInitialized(graphId, contributions)) {
|
|
1189
|
+
initializedGraphIds.add(graphId);
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
await deps.ensureMarkerTable();
|
|
1193
|
+
for (const contribution of contributions) {
|
|
1194
|
+
await materializeOne(graphId, contribution);
|
|
1168
1195
|
}
|
|
1169
1196
|
initializedGraphIds.add(graphId);
|
|
1170
1197
|
}
|
|
1171
1198
|
async function assertInitialized(graphId) {
|
|
1172
1199
|
if (initializedGraphIds.has(graphId)) return;
|
|
1173
1200
|
for (const contribution of runtimeContributions()) {
|
|
1174
|
-
const
|
|
1175
|
-
|
|
1176
|
-
contribution,
|
|
1177
|
-
contribution.createDdl
|
|
1178
|
-
);
|
|
1179
|
-
const identity = identityOf(graphId, contribution);
|
|
1180
|
-
let existing;
|
|
1181
|
-
try {
|
|
1182
|
-
existing = await deps.getMarker(identity);
|
|
1183
|
-
} catch (error) {
|
|
1184
|
-
if (!chunkIUIWCFG3_cjs.isMissingTableError(error)) throw error;
|
|
1201
|
+
const read = await readContributionState(graphId, contribution);
|
|
1202
|
+
if (read.kind === "missing-table") {
|
|
1185
1203
|
throw new chunkYEDQLNVE_cjs.StoreNotInitializedError(graphId, "missing", {
|
|
1186
|
-
cause: error,
|
|
1204
|
+
cause: read.error,
|
|
1187
1205
|
details: { logicalName: contribution.logicalName }
|
|
1188
1206
|
});
|
|
1189
1207
|
}
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
throw new chunkYEDQLNVE_cjs.StoreNotInitializedError(graphId, state, {
|
|
1208
|
+
if (read.state !== "initialized") {
|
|
1209
|
+
throw new chunkYEDQLNVE_cjs.StoreNotInitializedError(graphId, read.state, {
|
|
1193
1210
|
details: { logicalName: contribution.logicalName }
|
|
1194
1211
|
});
|
|
1195
1212
|
}
|
|
@@ -2407,6 +2424,7 @@ function buildCheckUniqueBatch(tables3, params) {
|
|
|
2407
2424
|
AND ${uniques3.deletedAt} IS NULL
|
|
2408
2425
|
`;
|
|
2409
2426
|
}
|
|
2427
|
+
var MAX_HNSW_EF_SEARCH = 1e3;
|
|
2410
2428
|
function assertFiniteNumberArray(array, name) {
|
|
2411
2429
|
for (const [index3, value] of array.entries()) {
|
|
2412
2430
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
@@ -2548,11 +2566,21 @@ function assertVectorSearchBounds(params) {
|
|
|
2548
2566
|
if (!Number.isInteger(params.limit) || params.limit <= 0) {
|
|
2549
2567
|
throw new Error(`limit must be a positive integer, got: ${params.limit}`);
|
|
2550
2568
|
}
|
|
2569
|
+
if (params.efSearch !== void 0 && (!Number.isInteger(params.efSearch) || params.efSearch <= 0)) {
|
|
2570
|
+
throw new Error(
|
|
2571
|
+
`efSearch must be a positive integer, got: ${params.efSearch}`
|
|
2572
|
+
);
|
|
2573
|
+
}
|
|
2551
2574
|
}
|
|
2552
2575
|
function buildVectorSearchPostgres(tables3, params) {
|
|
2553
2576
|
const { embeddings: embeddings3 } = tables3;
|
|
2554
2577
|
const queryLiteral = formatEmbeddingLiteral(params.queryEmbedding);
|
|
2555
2578
|
assertVectorSearchBounds(params);
|
|
2579
|
+
if (params.efSearch !== void 0 && params.efSearch > MAX_HNSW_EF_SEARCH) {
|
|
2580
|
+
throw new RangeError(
|
|
2581
|
+
`efSearch must be \u2264 ${MAX_HNSW_EF_SEARCH} (pgvector's hnsw.ef_search valid range is 1..${MAX_HNSW_EF_SEARCH}), got: ${params.efSearch}`
|
|
2582
|
+
);
|
|
2583
|
+
}
|
|
2556
2584
|
const embeddingColumn = drizzleOrm.sql`${embeddings3.embedding}`;
|
|
2557
2585
|
const distanceExpression = buildDistanceExpression(
|
|
2558
2586
|
embeddingColumn,
|
|
@@ -3034,5 +3062,5 @@ exports.tables = tables;
|
|
|
3034
3062
|
exports.tables2 = tables2;
|
|
3035
3063
|
exports.uniques = uniques;
|
|
3036
3064
|
exports.uniques2 = uniques2;
|
|
3037
|
-
//# sourceMappingURL=chunk-
|
|
3038
|
-
//# sourceMappingURL=chunk-
|
|
3065
|
+
//# sourceMappingURL=chunk-2E4VTD2E.cjs.map
|
|
3066
|
+
//# sourceMappingURL=chunk-2E4VTD2E.cjs.map
|