@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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _utaba_deep_memory_types from '@utaba/deep-memory/types';
2
- import { StorageRepositoryConfig, StoredRepository, RepositoryFilter, PaginatedResult, StoredRepositorySummary, RepositoryUpdate, RepositoryStats, MemoryVocabulary, PaginationOptions, VocabularyChangeRecord, StoredEntity, StoredEntityUpdate, StorageFindQuery, StoredRelationship, RelationshipQueryOptions, StorageExploreOptions, StorageNeighbourhood, StoragePathOptions, StoragePathResult, StorageTimelineOptions, StorageTimelineResult, ExportChunk, ImportChunk, BulkImportResult, SearchOptions, SearchHit } from '@utaba/deep-memory/types';
2
+ import { StorageRepositoryConfig, StoredRepository, RepositoryFilter, PaginatedResult, StoredRepositorySummary, RepositoryUpdate, RepositoryStats, MemoryVocabulary, PaginationOptions, VocabularyChangeRecord, StoredEntity, StoredEntityUpdate, StorageFindQuery, StoredRelationship, RelationshipQueryOptions, StorageExploreOptions, StorageNeighborhood, StoragePathOptions, StoragePathResult, StorageTimelineOptions, StorageTimelineResult, ExportChunk, ImportChunk, BulkImportResult, SearchOptions, SearchHit } from '@utaba/deep-memory/types';
3
3
  import sql from 'mssql';
4
4
  import { StorageProvider, EnsureSchemaResult, SearchProvider, SearchableEntity } from '@utaba/deep-memory/providers';
5
5
 
@@ -18,7 +18,7 @@ declare class SqlServerStorageProvider implements StorageProvider {
18
18
  constructor(config: SqlServerStorageProviderConfig);
19
19
  private t;
20
20
  private getPool;
21
- initialise(): Promise<void>;
21
+ initialize(): Promise<void>;
22
22
  dispose(): Promise<void>;
23
23
  /**
24
24
  * Ensure the target database exists. If constructed with a sql.config and the
@@ -65,7 +65,7 @@ declare class SqlServerStorageProvider implements StorageProvider {
65
65
  deleteRelationshipsByType(repositoryId: string, relationshipType: string): Promise<{
66
66
  deletedRelationships: number;
67
67
  }>;
68
- exploreNeighbourhood(repositoryId: string, entityId: string, options: StorageExploreOptions): Promise<StorageNeighbourhood>;
68
+ exploreNeighborhood(repositoryId: string, entityId: string, options: StorageExploreOptions): Promise<StorageNeighborhood>;
69
69
  findPaths(repositoryId: string, sourceId: string, targetId: string, options: StoragePathOptions): Promise<StoragePathResult>;
70
70
  getTimeline(repositoryId: string, entityId: string, options: StorageTimelineOptions): Promise<StorageTimelineResult>;
71
71
  exportAll(repositoryId: string): AsyncIterable<ExportChunk>;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _utaba_deep_memory_types from '@utaba/deep-memory/types';
2
- import { StorageRepositoryConfig, StoredRepository, RepositoryFilter, PaginatedResult, StoredRepositorySummary, RepositoryUpdate, RepositoryStats, MemoryVocabulary, PaginationOptions, VocabularyChangeRecord, StoredEntity, StoredEntityUpdate, StorageFindQuery, StoredRelationship, RelationshipQueryOptions, StorageExploreOptions, StorageNeighbourhood, StoragePathOptions, StoragePathResult, StorageTimelineOptions, StorageTimelineResult, ExportChunk, ImportChunk, BulkImportResult, SearchOptions, SearchHit } from '@utaba/deep-memory/types';
2
+ import { StorageRepositoryConfig, StoredRepository, RepositoryFilter, PaginatedResult, StoredRepositorySummary, RepositoryUpdate, RepositoryStats, MemoryVocabulary, PaginationOptions, VocabularyChangeRecord, StoredEntity, StoredEntityUpdate, StorageFindQuery, StoredRelationship, RelationshipQueryOptions, StorageExploreOptions, StorageNeighborhood, StoragePathOptions, StoragePathResult, StorageTimelineOptions, StorageTimelineResult, ExportChunk, ImportChunk, BulkImportResult, SearchOptions, SearchHit } from '@utaba/deep-memory/types';
3
3
  import sql from 'mssql';
4
4
  import { StorageProvider, EnsureSchemaResult, SearchProvider, SearchableEntity } from '@utaba/deep-memory/providers';
5
5
 
@@ -18,7 +18,7 @@ declare class SqlServerStorageProvider implements StorageProvider {
18
18
  constructor(config: SqlServerStorageProviderConfig);
19
19
  private t;
20
20
  private getPool;
21
- initialise(): Promise<void>;
21
+ initialize(): Promise<void>;
22
22
  dispose(): Promise<void>;
23
23
  /**
24
24
  * Ensure the target database exists. If constructed with a sql.config and the
@@ -65,7 +65,7 @@ declare class SqlServerStorageProvider implements StorageProvider {
65
65
  deleteRelationshipsByType(repositoryId: string, relationshipType: string): Promise<{
66
66
  deletedRelationships: number;
67
67
  }>;
68
- exploreNeighbourhood(repositoryId: string, entityId: string, options: StorageExploreOptions): Promise<StorageNeighbourhood>;
68
+ exploreNeighborhood(repositoryId: string, entityId: string, options: StorageExploreOptions): Promise<StorageNeighborhood>;
69
69
  findPaths(repositoryId: string, sourceId: string, targetId: string, options: StoragePathOptions): Promise<StoragePathResult>;
70
70
  getTimeline(repositoryId: string, entityId: string, options: StorageTimelineOptions): Promise<StorageTimelineResult>;
71
71
  exportAll(repositoryId: string): AsyncIterable<ExportChunk>;
package/dist/index.js CHANGED
@@ -406,13 +406,13 @@ var SqlServerStorageProvider = class {
406
406
  getPool() {
407
407
  if (!this.pool) {
408
408
  throw new ProviderError(
409
- "SqlServerStorageProvider not initialised. Call initialise() first."
409
+ "SqlServerStorageProvider not initialized. Call initialize() first."
410
410
  );
411
411
  }
412
412
  return this.pool;
413
413
  }
414
414
  // ─── Lifecycle ────────────────────────────────────────────────────
415
- async initialise() {
415
+ async initialize() {
416
416
  if (this.config.connection instanceof sql.ConnectionPool) {
417
417
  this.pool = this.config.connection;
418
418
  this.ownsPool = false;
@@ -1127,9 +1127,9 @@ var SqlServerStorageProvider = class {
1127
1127
  return { deletedRelationships: result.rowsAffected[0] ?? 0 };
1128
1128
  }
1129
1129
  // ─── Graph Traversal ────────────────────────────────────────────
1130
- async exploreNeighbourhood(repositoryId, entityId, options) {
1131
- const centre = await this.getEntityLight(repositoryId, entityId);
1132
- if (!centre) {
1130
+ async exploreNeighborhood(repositoryId, entityId, options) {
1131
+ const center = await this.getEntityLight(repositoryId, entityId);
1132
+ if (!center) {
1133
1133
  throw new EntityNotFoundError(entityId);
1134
1134
  }
1135
1135
  const layers = [];
@@ -1191,7 +1191,7 @@ var SqlServerStorageProvider = class {
1191
1191
  currentFrontier = nextFrontier;
1192
1192
  if (nextFrontier.size === 0) break;
1193
1193
  }
1194
- return { centreId: entityId, layers };
1194
+ return { centerId: entityId, layers };
1195
1195
  }
1196
1196
  async findPaths(repositoryId, sourceId, targetId, options) {
1197
1197
  const [source, target] = await Promise.all([
@@ -1573,7 +1573,7 @@ var SqlServerStorageProvider = class {
1573
1573
  // src/SqlServerSearchProvider.ts
1574
1574
  import sql2 from "mssql";
1575
1575
  import { ProviderError as ProviderError2 } from "@utaba/deep-memory";
1576
- function normaliseRank(rank) {
1576
+ function normalizeRank(rank) {
1577
1577
  return Math.min(1, Math.max(0, rank / 1e3));
1578
1578
  }
1579
1579
  function buildHighlights(query, row) {
@@ -1673,7 +1673,7 @@ var SqlServerSearchProvider = class {
1673
1673
  const total = rows.length > 0 ? rows[0]["total_count"] : 0;
1674
1674
  const items = rows.map((row) => ({
1675
1675
  id: row["entity_id"],
1676
- score: normaliseRank(row["ft_rank"]),
1676
+ score: normalizeRank(row["ft_rank"]),
1677
1677
  highlights: buildHighlights(query, row)
1678
1678
  }));
1679
1679
  return {