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.86 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;CAC9E,MAAM,OAAO,OAAO,KAAK,yCAAyC;CAElE,MAAM,iBAAiB,MAAM,kBAAkB,QAAoC,iBAAiB,cAAc;CAElH,MAAM,OAAO,OAAO,MAAM,4BAA4B;CACtD,MAAM,UAAU,MAAM,eAAe,OAAO,MAAM,SAAS,WAAW;CAEtE,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,OAAO,OAAO,MAAM,iCAAiC,OAAO,IAAI;EACtE,MAAM,eAAe,WAAW,MAAM,SAAS,aAAa,OAAO,EAAE;EACrE,MAAM,OAAO,OAAO,MAAM,6CAA6C,OAAO,IAAI;CACpF;AACF;AAEA,IAAM,cAAN,MAAM,oBAAoB,WAAW;;;EAEnC,KAAgB,OAAO,YAAY;;CAEnC,UAAiB;EACf,OAAO,KAAK;CACd;AACF;AANE,YAAuB,OAAO"}