@utaba/deep-memory-storage-sqlserver 0.3.0 → 0.4.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/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -437,13 +437,13 @@ var SqlServerStorageProvider = class {
|
|
|
437
437
|
getPool() {
|
|
438
438
|
if (!this.pool) {
|
|
439
439
|
throw new import_deep_memory.ProviderError(
|
|
440
|
-
"SqlServerStorageProvider not
|
|
440
|
+
"SqlServerStorageProvider not initialized. Call initialize() first."
|
|
441
441
|
);
|
|
442
442
|
}
|
|
443
443
|
return this.pool;
|
|
444
444
|
}
|
|
445
445
|
// ─── Lifecycle ────────────────────────────────────────────────────
|
|
446
|
-
async
|
|
446
|
+
async initialize() {
|
|
447
447
|
if (this.config.connection instanceof import_mssql.default.ConnectionPool) {
|
|
448
448
|
this.pool = this.config.connection;
|
|
449
449
|
this.ownsPool = false;
|
|
@@ -1158,9 +1158,9 @@ var SqlServerStorageProvider = class {
|
|
|
1158
1158
|
return { deletedRelationships: result.rowsAffected[0] ?? 0 };
|
|
1159
1159
|
}
|
|
1160
1160
|
// ─── Graph Traversal ────────────────────────────────────────────
|
|
1161
|
-
async
|
|
1162
|
-
const
|
|
1163
|
-
if (!
|
|
1161
|
+
async exploreNeighborhood(repositoryId, entityId, options) {
|
|
1162
|
+
const center = await this.getEntityLight(repositoryId, entityId);
|
|
1163
|
+
if (!center) {
|
|
1164
1164
|
throw new import_deep_memory.EntityNotFoundError(entityId);
|
|
1165
1165
|
}
|
|
1166
1166
|
const layers = [];
|
|
@@ -1222,7 +1222,7 @@ var SqlServerStorageProvider = class {
|
|
|
1222
1222
|
currentFrontier = nextFrontier;
|
|
1223
1223
|
if (nextFrontier.size === 0) break;
|
|
1224
1224
|
}
|
|
1225
|
-
return {
|
|
1225
|
+
return { centerId: entityId, layers };
|
|
1226
1226
|
}
|
|
1227
1227
|
async findPaths(repositoryId, sourceId, targetId, options) {
|
|
1228
1228
|
const [source, target] = await Promise.all([
|
|
@@ -1604,7 +1604,7 @@ var SqlServerStorageProvider = class {
|
|
|
1604
1604
|
// src/SqlServerSearchProvider.ts
|
|
1605
1605
|
var import_mssql2 = __toESM(require("mssql"), 1);
|
|
1606
1606
|
var import_deep_memory2 = require("@utaba/deep-memory");
|
|
1607
|
-
function
|
|
1607
|
+
function normalizeRank(rank) {
|
|
1608
1608
|
return Math.min(1, Math.max(0, rank / 1e3));
|
|
1609
1609
|
}
|
|
1610
1610
|
function buildHighlights(query, row) {
|
|
@@ -1704,7 +1704,7 @@ var SqlServerSearchProvider = class {
|
|
|
1704
1704
|
const total = rows.length > 0 ? rows[0]["total_count"] : 0;
|
|
1705
1705
|
const items = rows.map((row) => ({
|
|
1706
1706
|
id: row["entity_id"],
|
|
1707
|
-
score:
|
|
1707
|
+
score: normalizeRank(row["ft_rank"]),
|
|
1708
1708
|
highlights: buildHighlights(query, row)
|
|
1709
1709
|
}));
|
|
1710
1710
|
return {
|