{"version":3,"file":"updates.mjs","names":[],"sources":["../../../src/storage/migration/updates.ts"],"sourcesContent":["import type { BaseAgent } from '../../agent/BaseAgent'\nimport type { VersionString } from '../../utils/version'\nimport { updateV0_3_1ToV0_4 } from './updates/0.3.1-0.4'\nimport { updateV0_3ToV0_3_1 } from './updates/0.3-0.3.1'\nimport { updateV0_4ToV0_5 } from './updates/0.4-0.5'\n\nexport const INITIAL_STORAGE_VERSION = '0.1'\n\nexport interface UpdateConfig {\n  v0_1ToV0_2: V0_1ToV0_2UpdateConfig\n}\n\nexport interface Update {\n  fromVersion: VersionString\n  toVersion: VersionString\n  doUpdate: <Agent extends BaseAgent>(agent: Agent, updateConfig: UpdateConfig) => Promise<void>\n}\n\nexport interface V0_1ToV0_2UpdateConfig {\n  mediationRoleUpdateStrategy: 'allMediator' | 'allRecipient' | 'recipientIfEndpoint' | 'doNotChange'\n}\n\nexport const DEFAULT_UPDATE_CONFIG: UpdateConfig = {\n  v0_1ToV0_2: {\n    mediationRoleUpdateStrategy: 'recipientIfEndpoint',\n  },\n}\n\nexport const supportedUpdates = [\n  {\n    fromVersion: '0.1',\n    toVersion: '0.2',\n    doUpdate: () => {}, // Nothing to do in Core module\n  },\n  {\n    fromVersion: '0.2',\n    toVersion: '0.3',\n    doUpdate: () => {}, // Nothing to do in Core module\n  },\n  {\n    fromVersion: '0.3',\n    toVersion: '0.3.1',\n    doUpdate: updateV0_3ToV0_3_1,\n  },\n  {\n    fromVersion: '0.3.1',\n    toVersion: '0.4',\n    doUpdate: updateV0_3_1ToV0_4,\n  },\n  {\n    fromVersion: '0.4',\n    toVersion: '0.5',\n    doUpdate: updateV0_4ToV0_5,\n  },\n] as const\n\n// Current version is last toVersion from the supported updates\nexport const CURRENT_FRAMEWORK_STORAGE_VERSION = supportedUpdates[supportedUpdates.length - 1].toVersion as LastItem<\n  typeof supportedUpdates\n>['toVersion']\n\nexport const STORAGE_VERSION_RECORD_ID = 'STORAGE_VERSION_RECORD_ID'\n\ntype LastItem<T extends readonly unknown[]> = T extends readonly [...infer _, infer U] ? U : T[0] | undefined\nexport type UpdateToVersion = (typeof supportedUpdates)[number]['toVersion']\n"],"mappings":";;;;;;;AAMA,MAAa,0BAA0B;AAgBvC,MAAa,wBAAsC,EACjD,YAAY,EACV,6BAA6B,uBAC9B,EACF;AAED,MAAa,mBAAmB;CAC9B;EACE,aAAa;EACb,WAAW;EACX,gBAAgB;EACjB;CACD;EACE,aAAa;EACb,WAAW;EACX,gBAAgB;EACjB;CACD;EACE,aAAa;EACb,WAAW;EACX,UAAU;EACX;CACD;EACE,aAAa;EACb,WAAW;EACX,UAAU;EACX;CACD;EACE,aAAa;EACb,WAAW;EACX,UAAU;EACX;CACF;AAGD,MAAa,oCAAoC,iBAAiB,iBAAiB,SAAS,GAAG;AAI/F,MAAa,4BAA4B"}