UNPKG

@credo-ts/core

Version:

<p align="center"> <br /> <img alt="Credo Logo" src="https://github.com/openwallet-foundation/credo-ts/blob/c7886cb8377ceb8ee4efe8d264211e561a75072d/images/credo-logo.png" height="250px" /> </p> <h1 align="center"><b>Credo - Core</b></h1

1 lines • 1.84 kB
{"version":3,"file":"cache.mjs","names":[],"sources":["../../../../../src/storage/migration/updates/0.3.1-0.4/cache.ts"],"sourcesContent":["import type { BaseAgent } from '../../../../agent/BaseAgent'\nimport { InjectionSymbols } from '../../../../constants'\nimport { BaseRecord } from '../../../BaseRecord'\nimport type { StorageService } from '../../../StorageService'\n\n/**\n * removes the all cache records as used in 0.3.0, as they have been updated to use the new cache interface.\n */\nexport async function migrateCacheToV0_4<Agent extends BaseAgent>(agent: Agent) {\n agent.config.logger.info('Removing 0.3 cache records from storage')\n\n const storageService = agent.dependencyManager.resolve<StorageService<BaseRecord>>(InjectionSymbols.StorageService)\n\n agent.config.logger.debug('Fetching all cache records')\n const records = await storageService.getAll(agent.context, CacheRecord)\n\n for (const record of records) {\n agent.config.logger.debug(`Removing cache record with id ${record.id}`)\n await storageService.deleteById(agent.context, CacheRecord, record.id)\n agent.config.logger.debug(`Successfully removed cache record with id ${record.id}`)\n }\n}\n\nclass CacheRecord extends BaseRecord {\n public static readonly type = 'CacheRecord'\n public readonly type = CacheRecord.type\n\n public getTags() {\n return this._tags\n }\n}\n"],"mappings":";;;;;;;;;AAQA,eAAsB,mBAA4C,OAAc;AAC9E,OAAM,OAAO,OAAO,KAAK,0CAA0C;CAEnE,MAAM,iBAAiB,MAAM,kBAAkB,QAAoC,iBAAiB,eAAe;AAEnH,OAAM,OAAO,OAAO,MAAM,6BAA6B;CACvD,MAAM,UAAU,MAAM,eAAe,OAAO,MAAM,SAAS,YAAY;AAEvE,MAAK,MAAM,UAAU,SAAS;AAC5B,QAAM,OAAO,OAAO,MAAM,iCAAiC,OAAO,KAAK;AACvE,QAAM,eAAe,WAAW,MAAM,SAAS,aAAa,OAAO,GAAG;AACtE,QAAM,OAAO,OAAO,MAAM,6CAA6C,OAAO,KAAK;;;AAIvF,IAAM,cAAN,MAAM,oBAAoB,WAAW;;;OAEnB,OAAO,YAAY;;CAEnC,AAAO,UAAU;AACf,SAAO,KAAK;;;YAJS,OAAO"}