

const require_constants = require('../../../../constants.js');
const require_BaseRecord = require('../../../BaseRecord.js');

//#region src/storage/migration/updates/0.3.1-0.4/cache.ts
/**
* removes the all cache records as used in 0.3.0, as they have been updated to use the new cache interface.
*/
async function migrateCacheToV0_4(agent) {
	agent.config.logger.info("Removing 0.3 cache records from storage");
	const storageService = agent.dependencyManager.resolve(require_constants.InjectionSymbols.StorageService);
	agent.config.logger.debug("Fetching all cache records");
	const records = await storageService.getAll(agent.context, CacheRecord);
	for (const record of records) {
		agent.config.logger.debug(`Removing cache record with id ${record.id}`);
		await storageService.deleteById(agent.context, CacheRecord, record.id);
		agent.config.logger.debug(`Successfully removed cache record with id ${record.id}`);
	}
}
var CacheRecord = class CacheRecord extends require_BaseRecord.BaseRecord {
	constructor(..._args) {
		super(..._args);
		this.type = CacheRecord.type;
	}
	getTags() {
		return this._tags;
	}
};
CacheRecord.type = "CacheRecord";

//#endregion
exports.migrateCacheToV0_4 = migrateCacheToV0_4;