@utaba/deep-memory-storage-sqlserver 0.2.0 → 0.3.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 CHANGED
@@ -698,13 +698,23 @@ var SqlServerStorageProvider = class {
698
698
  if (!updated) throw new import_deep_memory.RepositoryNotFoundError(repositoryId);
699
699
  return updated;
700
700
  }
701
- async deleteRepository(repositoryId) {
701
+ async deleteRepository(repositoryId, _onProgress) {
702
702
  const pool = this.getPool();
703
703
  const result = await pool.request().input("id", import_mssql.default.UniqueIdentifier, repositoryId).query(`DELETE FROM ${this.t("dm_repositories")} WHERE [repository_id] = @id`);
704
704
  if (result.rowsAffected[0] === 0) {
705
705
  throw new import_deep_memory.RepositoryNotFoundError(repositoryId);
706
706
  }
707
707
  }
708
+ async deleteAllContents(repositoryId, _onProgress) {
709
+ await this.assertRepository(repositoryId);
710
+ const pool = this.getPool();
711
+ const relResult = await pool.request().input("id", import_mssql.default.UniqueIdentifier, repositoryId).query(`DELETE FROM ${this.t("dm_relationships")} WHERE [repository_id] = @id`);
712
+ const entityResult = await pool.request().input("id", import_mssql.default.UniqueIdentifier, repositoryId).query(`DELETE FROM ${this.t("dm_entities")} WHERE [repository_id] = @id`);
713
+ return {
714
+ deletedEntities: entityResult.rowsAffected[0] ?? 0,
715
+ deletedRelationships: relResult.rowsAffected[0] ?? 0
716
+ };
717
+ }
708
718
  async getRepositoryStats(repositoryId) {
709
719
  await this.assertRepository(repositoryId);
710
720
  const pool = this.getPool();
@@ -1394,7 +1404,7 @@ var SqlServerStorageProvider = class {
1394
1404
  }
1395
1405
  }
1396
1406
  }
1397
- async importBulk(repositoryId, data) {
1407
+ async importBulk(repositoryId, data, _options) {
1398
1408
  await this.assertRepository(repositoryId);
1399
1409
  const pool = this.getPool();
1400
1410
  let entitiesImported = 0;