{"version":3,"file":"w3cCredentialRecord.mjs","names":[],"sources":["../../../../../src/storage/migration/updates/0.3.1-0.4/w3cCredentialRecord.ts"],"sourcesContent":["import type { BaseAgent } from '../../../../agent/BaseAgent'\n\nimport { W3cCredentialRepository } from '../../../../modules/vc/repository'\n\n/**\n * Re-saves the w3c credential records to add the new claimFormat tag.\n */\nexport async function migrateW3cCredentialRecordToV0_4<Agent extends BaseAgent>(agent: Agent) {\n  agent.config.logger.info('Migration w3c credential records records to storage version 0.4')\n\n  const w3cCredentialRepository = agent.dependencyManager.resolve(W3cCredentialRepository)\n\n  agent.config.logger.debug('Fetching all w3c credential records from storage')\n  const records = await w3cCredentialRepository.getAll(agent.context)\n\n  agent.config.logger.debug(`Found a total of ${records.length} w3c credential records to update.`)\n\n  for (const record of records) {\n    agent.config.logger.debug(\n      `Re-saving w3c credential record with id ${record.id} to add claimFormat tag for storage version 0.4`\n    )\n\n    // Save updated record\n    await w3cCredentialRepository.update(agent.context, record)\n\n    agent.config.logger.debug(`Successfully migrated w3c credential record with id ${record.id} to storage version 0.4`)\n  }\n}\n"],"mappings":";;;;;;;;;AAOA,eAAsB,iCAA0D,OAAc;AAC5F,OAAM,OAAO,OAAO,KAAK,kEAAkE;CAE3F,MAAM,0BAA0B,MAAM,kBAAkB,QAAQ,wBAAwB;AAExF,OAAM,OAAO,OAAO,MAAM,mDAAmD;CAC7E,MAAM,UAAU,MAAM,wBAAwB,OAAO,MAAM,QAAQ;AAEnE,OAAM,OAAO,OAAO,MAAM,oBAAoB,QAAQ,OAAO,oCAAoC;AAEjG,MAAK,MAAM,UAAU,SAAS;AAC5B,QAAM,OAAO,OAAO,MAClB,2CAA2C,OAAO,GAAG,iDACtD;AAGD,QAAM,wBAAwB,OAAO,MAAM,SAAS,OAAO;AAE3D,QAAM,OAAO,OAAO,MAAM,uDAAuD,OAAO,GAAG,yBAAyB"}