@credo-ts/askar-to-drizzle-storage-migration 0.6.0-alpha-20251016175322 → 0.6.0-alpha-20251017082229

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,7 +56,9 @@ declare class AskarToDrizzleStorageMigrator {
56
56
  }): Promise<AskarToDrizzleStorageMigrator>;
57
57
  private getAdapterForRecordType;
58
58
  migrate(): Promise<void>;
59
+ deleteStorageRecords(): Promise<void>;
59
60
  private migrateForContext;
61
+ private deleteForContext;
60
62
  }
61
63
  //#endregion
62
64
  export { AskarToDrizzleStorageMigrator };
@@ -1 +1 @@
1
- {"version":3,"file":"AskarToDrizzleStorageMigrator.d.mts","names":[],"sources":["../src/AskarToDrizzleStorageMigrator.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;AA4BA;;;;;;;;;AAiDI,cAjDS,6BAAA,CAiDT;UAEe,aAAA;UACF,WAAA;UACM,iBAAA;UACX,MAAA;UACQ,8BAAA;UAYjB,aAAA;UAAA,YAAA;YA6BmB,EAhFH,KAgFG,CAhGoB,eAAA,CAgBvB,UAAA,CAgFG;EAAA,QAAA,aAAA;;;;;;;;;;;mBA7CH;iBACF;uBACM;YACX;oBACQ;;;;;;;;;;;MAYjB,QAAA;;aA6BmB"}
1
+ {"version":3,"file":"AskarToDrizzleStorageMigrator.d.mts","names":[],"sources":["../src/AskarToDrizzleStorageMigrator.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;AA4BA;;;;;;;;;AAiDI,cAjDS,6BAAA,CAiDT;UAEe,aAAA;UACF,WAAA;UACM,iBAAA;UACX,MAAA;UACQ,8BAAA;UAYjB,aAAA;UAAA,YAAA;YA6BmB,EAhFH,KAgFG,CAhGoB,eAAA,CAgBvB,UAAA,CAgFG;UAuDa,aAAA;EAAA,QAAA,eAAA;;;;;;;;;;mBApGhB;iBACF;uBACM;YACX;oBACQ;;;;;;;;;;;MAYjB,QAAA;;aA6BmB;0BAuDa"}
@@ -56,7 +56,9 @@ declare class AskarToDrizzleStorageMigrator {
56
56
  }): Promise<AskarToDrizzleStorageMigrator>;
57
57
  private getAdapterForRecordType;
58
58
  migrate(): Promise<void>;
59
+ deleteStorageRecords(): Promise<void>;
59
60
  private migrateForContext;
61
+ private deleteForContext;
60
62
  }
61
63
  //#endregion
62
64
  export { AskarToDrizzleStorageMigrator };
@@ -1 +1 @@
1
- {"version":3,"file":"AskarToDrizzleStorageMigrator.d.ts","names":[],"sources":["../src/AskarToDrizzleStorageMigrator.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;AA4BA;;;;;;;;;AAiDI,cAjDS,6BAAA,CAiDT;UAEe,aAAA;UACF,WAAA;UACM,iBAAA;UACX,MAAA;UACQ,8BAAA;UAYjB,aAAA;UAAA,YAAA;YA6BmB,EAhFH,KAgFG,CAhGoB,eAAA,CAgBvB,UAAA,CAgFG;EAAA,QAAA,aAAA;;;;;;;;;;;mBA7CH;iBACF;uBACM;YACX;oBACQ;;;;;;;;;;;MAYjB,QAAA;;aA6BmB"}
1
+ {"version":3,"file":"AskarToDrizzleStorageMigrator.d.ts","names":[],"sources":["../src/AskarToDrizzleStorageMigrator.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;AA4BA;;;;;;;;;AAiDI,cAjDS,6BAAA,CAiDT;UAEe,aAAA;UACF,WAAA;UACM,iBAAA;UACX,MAAA;UACQ,8BAAA;UAYjB,aAAA;UAAA,YAAA;YA6BmB,EAhFH,KAgFG,CAhGoB,eAAA,CAgBvB,UAAA,CAgFG;UAuDa,aAAA;EAAA,QAAA,eAAA;;;;;;;;;;mBApGhB;iBACF;uBACM;YACX;oBACQ;;;;;;;;;;;MAYjB,QAAA;;aA6BmB;0BAuDa"}
@@ -93,6 +93,28 @@ var AskarToDrizzleStorageMigrator = class AskarToDrizzleStorageMigrator {
93
93
  if (this.askarAgent.isInitialized) await this.askarAgent.shutdown();
94
94
  }
95
95
  }
96
+ async deleteStorageRecords() {
97
+ try {
98
+ await this.askarAgent.initialize();
99
+ this.logger.info("Successfully initialized askar agent");
100
+ if (this.tenantsModule) {
101
+ const askarAgentWithTenants = this.askarAgent;
102
+ this.logger.info("Detected tenants module, deleting tenant records");
103
+ const allTenants = await askarAgentWithTenants.modules.tenants.getAllTenants();
104
+ this.logger.debug(`Retrieved '${allTenants.length}' tenants to delete non-KMS storage for.`);
105
+ for (const tenant of allTenants) {
106
+ this.logger.info(`Starting deletion of non-KMS records for tenant '${tenant.id}'`);
107
+ await askarAgentWithTenants.modules.tenants.withTenantAgent({ tenantId: tenant.id }, async (askarTenantAgent) => this.deleteForContext({ askarContext: askarTenantAgent.context }));
108
+ this.logger.info(`Succesfully removed non-KMS records for tenant '${tenant.id}'`);
109
+ }
110
+ }
111
+ this.logger.info("Starting deletion of non-KMS records for default agent context");
112
+ await this.deleteForContext({ askarContext: this.askarAgent.context });
113
+ this.logger.info("Succesfully removed non-KMS records for default agent context");
114
+ } finally {
115
+ if (this.askarAgent.isInitialized) await this.askarAgent.shutdown();
116
+ }
117
+ }
96
118
  async migrateForContext({ drizzleContext, askarContext }) {
97
119
  try {
98
120
  const storeManager = askarContext.resolve(__credo_ts_askar.AskarStoreManager);
@@ -163,6 +185,22 @@ var AskarToDrizzleStorageMigrator = class AskarToDrizzleStorageMigrator {
163
185
  throw new require_AskarToDrizzleStorageMigrationError.AskarToDrizzleStorageMigrationError(`Migration failed for context '${askarContext.contextCorrelationId}'. ${error.message}`, { cause: error });
164
186
  }
165
187
  }
188
+ async deleteForContext({ askarContext }) {
189
+ try {
190
+ const { store, profile } = await askarContext.resolve(__credo_ts_askar.AskarStoreManager).getInitializedStoreWithProfile(askarContext);
191
+ this.logger.debug(`Removing all non-KMS records from askar storage for context '${askarContext.contextCorrelationId}'`);
192
+ const session = await store.session(profile).open();
193
+ try {
194
+ await session.removeAll({});
195
+ this.logger.debug(`Succesfully removed all non-KMS records from Askar for context '${askarContext.contextCorrelationId}'`);
196
+ } finally {
197
+ await session.close();
198
+ }
199
+ } catch (error) {
200
+ this.logger.error(`Removing non-KMS records failed for context '${askarContext.contextCorrelationId}'. ${error.message}`);
201
+ throw new require_AskarToDrizzleStorageMigrationError.AskarToDrizzleStorageMigrationError(`Removing non-KMS record failed for context '${askarContext.contextCorrelationId}'. ${error.message}`, { cause: error });
202
+ }
203
+ }
166
204
  };
167
205
 
168
206
  //#endregion
@@ -88,6 +88,28 @@ var AskarToDrizzleStorageMigrator = class AskarToDrizzleStorageMigrator {
88
88
  if (this.askarAgent.isInitialized) await this.askarAgent.shutdown();
89
89
  }
90
90
  }
91
+ async deleteStorageRecords() {
92
+ try {
93
+ await this.askarAgent.initialize();
94
+ this.logger.info("Successfully initialized askar agent");
95
+ if (this.tenantsModule) {
96
+ const askarAgentWithTenants = this.askarAgent;
97
+ this.logger.info("Detected tenants module, deleting tenant records");
98
+ const allTenants = await askarAgentWithTenants.modules.tenants.getAllTenants();
99
+ this.logger.debug(`Retrieved '${allTenants.length}' tenants to delete non-KMS storage for.`);
100
+ for (const tenant of allTenants) {
101
+ this.logger.info(`Starting deletion of non-KMS records for tenant '${tenant.id}'`);
102
+ await askarAgentWithTenants.modules.tenants.withTenantAgent({ tenantId: tenant.id }, async (askarTenantAgent) => this.deleteForContext({ askarContext: askarTenantAgent.context }));
103
+ this.logger.info(`Succesfully removed non-KMS records for tenant '${tenant.id}'`);
104
+ }
105
+ }
106
+ this.logger.info("Starting deletion of non-KMS records for default agent context");
107
+ await this.deleteForContext({ askarContext: this.askarAgent.context });
108
+ this.logger.info("Succesfully removed non-KMS records for default agent context");
109
+ } finally {
110
+ if (this.askarAgent.isInitialized) await this.askarAgent.shutdown();
111
+ }
112
+ }
91
113
  async migrateForContext({ drizzleContext, askarContext }) {
92
114
  try {
93
115
  const storeManager = askarContext.resolve(AskarStoreManager);
@@ -158,6 +180,22 @@ var AskarToDrizzleStorageMigrator = class AskarToDrizzleStorageMigrator {
158
180
  throw new AskarToDrizzleStorageMigrationError(`Migration failed for context '${askarContext.contextCorrelationId}'. ${error.message}`, { cause: error });
159
181
  }
160
182
  }
183
+ async deleteForContext({ askarContext }) {
184
+ try {
185
+ const { store, profile } = await askarContext.resolve(AskarStoreManager).getInitializedStoreWithProfile(askarContext);
186
+ this.logger.debug(`Removing all non-KMS records from askar storage for context '${askarContext.contextCorrelationId}'`);
187
+ const session = await store.session(profile).open();
188
+ try {
189
+ await session.removeAll({});
190
+ this.logger.debug(`Succesfully removed all non-KMS records from Askar for context '${askarContext.contextCorrelationId}'`);
191
+ } finally {
192
+ await session.close();
193
+ }
194
+ } catch (error) {
195
+ this.logger.error(`Removing non-KMS records failed for context '${askarContext.contextCorrelationId}'. ${error.message}`);
196
+ throw new AskarToDrizzleStorageMigrationError(`Removing non-KMS record failed for context '${askarContext.contextCorrelationId}'. ${error.message}`, { cause: error });
197
+ }
198
+ }
161
199
  };
162
200
 
163
201
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"AskarToDrizzleStorageMigrator.mjs","names":["drizzleModule: DrizzleStorageModule","askarModule: AskarModule","agentDependencies: AgentDependencies","logger: Logger","skipMigrationforMissingAdapter: boolean","tenantsModule?: TenantsModule","adapter","scanHandle: ScanHandle | undefined","entryListHandle: EntryListHandle | null","skippedRecordTypes: string[]"],"sources":["../src/AskarToDrizzleStorageMigrator.ts"],"sourcesContent":["import { AskarModule, AskarModuleConfig, AskarStoreManager, recordToInstance } from '@credo-ts/askar'\nimport {\n Agent,\n AgentContext,\n type AgentDependencies,\n BaseRecord,\n ConsoleLogger,\n type Logger,\n LogLevel,\n StorageVersionRecord,\n} from '@credo-ts/core'\nimport { BaseDrizzleRecordAdapter, DrizzleStorageModule, DrizzleStorageModuleConfig } from '@credo-ts/drizzle-storage'\nimport { TenantsModule } from '@credo-ts/tenants'\nimport { EntryList, EntryListHandle, ScanHandle } from '@openwallet-foundation/askar-shared'\nimport { AskarToDrizzleStorageMigrationError } from './errors/AskarToDrizzleStorageMigrationError'\n\n/**\n * Migration class to move storage from Askar to Drizzle. Note that this does not migrate\n * the KMS part of Askar (the keys), and only the normal record storage.\n *\n * No backups are created during the process. The askar store is only used for reading, the\n * drizzle store is also used for writing. Ensure the drizzle target is empty when starting the\n * migration.\n *\n * Note that if you were previously using `AskarMultiWalletDatabaseScheme.DatabasePerWallet`, that all storage will be moved\n * to a single database. You can still keep using multiiple databases for the Askar storage, but Drizzle only supports\n * a single database per main agent instance (including sub agents for tenants).\n */\nexport class AskarToDrizzleStorageMigrator {\n private drizzleAgent = new Agent({\n dependencies: this.agentDependencies,\n config: {\n logger: this.logger,\n },\n modules: this.tenantsModule\n ? {\n drizzle: this.drizzleModule,\n tenants: this.tenantsModule,\n }\n : {\n drizzle: this.drizzleModule,\n },\n })\n\n public askarAgent = new Agent({\n modules: this.tenantsModule\n ? {\n askar: this.askarModule,\n tenants: this.tenantsModule,\n }\n : {\n askar: this.askarModule,\n },\n config: {\n logger: this.logger,\n },\n dependencies: this.agentDependencies,\n })\n\n private drizzleConfig = this.drizzleAgent.context.resolve(DrizzleStorageModuleConfig)\n private drizzleAdapters = this.drizzleConfig.adapters\n\n private constructor(\n private drizzleModule: DrizzleStorageModule,\n private askarModule: AskarModule,\n private agentDependencies: AgentDependencies,\n private logger: Logger,\n private skipMigrationforMissingAdapter: boolean,\n private tenantsModule?: TenantsModule\n ) {}\n\n public static async initialize({\n drizzleModule,\n askarModule,\n agentDependencies,\n logger = new ConsoleLogger(LogLevel.trace),\n skipMigrationForMissingAdapter = false,\n tenantsModule,\n }: {\n drizzleModule: DrizzleStorageModule\n askarModule: AskarModule\n agentDependencies: AgentDependencies\n logger: Logger\n tenantsModule?: TenantsModule\n\n /**\n * When set to `true`, the migration of any records in the Askar store that don't\n * have an adapter registered will be skipped. Note that this can be dangerous and\n * result in loss of data in the new store. Use this only if you have records with a\n * category in your askar store, for which there is no adapter registered, and should\n * not be migrated.\n *\n * @default false\n */\n skipMigrationForMissingAdapter?: boolean\n }) {\n if (!askarModule.config.enableStorage) {\n throw new AskarToDrizzleStorageMigrationError(\n 'Askar module has enableStorage set to false. Make sure the storage is enabled on the askar module'\n )\n }\n\n const migrator = new AskarToDrizzleStorageMigrator(\n drizzleModule,\n askarModule,\n agentDependencies,\n logger,\n skipMigrationForMissingAdapter,\n tenantsModule\n )\n\n return migrator\n }\n\n private getAdapterForRecordType(recordType: string) {\n const adapter = this.drizzleAdapters.find((adapter) => adapter.recordClass.type === recordType)\n if (!adapter) {\n return null\n }\n\n // biome-ignore lint/suspicious/noExplicitAny: no explanation\n return adapter as BaseDrizzleRecordAdapter<BaseRecord, any, any, any, any>\n }\n\n public async migrate() {\n try {\n await this.drizzleAgent.initialize()\n this.logger.info('Successfully initialized drizzle agent')\n await this.askarAgent.initialize()\n this.logger.info('Successfully initialized askar agent')\n\n this.logger.info('Starting migration of default agent context')\n await this.migrateForContext({\n askarContext: this.askarAgent.context,\n drizzleContext: this.drizzleAgent.context,\n })\n this.logger.info('Succesfully migrated default agent context')\n\n if (this.tenantsModule) {\n const askarAgentWithTenants = this.askarAgent as Agent<{ tenants: TenantsModule }>\n const drizzleAgentWithTenants = this.drizzleAgent as Agent<{ tenants: TenantsModule }>\n\n this.logger.info('Detected tenants module, migrating tenants context')\n const allTenants = await askarAgentWithTenants.modules.tenants.getAllTenants()\n\n this.logger.debug(`Retrieved '${allTenants.length}' tenant records to migrate.`)\n\n for (const tenant of allTenants) {\n this.logger.info(`Starting migration of tenant '${tenant.id}'`)\n\n // NOTE: we create a nested withTenantAgent, as we need to have the context for both the askar and drizzle module/agent.\n // Using `withTenantAgent` ensures the session is always correctly closed, so it's the safest way\n await askarAgentWithTenants.modules.tenants.withTenantAgent(\n { tenantId: tenant.id },\n async (askarTenantAgent) => {\n await drizzleAgentWithTenants.modules.tenants.withTenantAgent(\n { tenantId: tenant.id },\n (drizzleTenantAgent) =>\n this.migrateForContext({\n askarContext: askarTenantAgent.context,\n drizzleContext: drizzleTenantAgent.context,\n })\n )\n }\n )\n this.logger.info(`Succesfully migrated tenant '${tenant.id}'`)\n }\n }\n } finally {\n if (this.drizzleAgent.isInitialized) {\n await this.drizzleAgent.shutdown()\n }\n\n if (this.askarAgent.isInitialized) {\n await this.askarAgent.shutdown()\n }\n }\n }\n\n private async migrateForContext({\n drizzleContext,\n askarContext,\n }: {\n drizzleContext: AgentContext\n askarContext: AgentContext\n }) {\n try {\n const storeManager = askarContext.resolve(AskarStoreManager)\n const askar = askarContext.resolve(AskarModuleConfig).askar\n\n const { store, profile } = await storeManager.getInitializedStoreWithProfile(askarContext)\n\n // We need to make sure that the drizzle storage is provisioned for the context\n // In case of root agent context this will alreayd be handled on initialization\n // but for tenants agents we need to make sure a row exists in the `Context` table\n await this.drizzleModule.onProvisionContext(drizzleContext)\n\n let scanHandle: ScanHandle | undefined\n let entryListHandle: EntryListHandle | null = null\n let migratedRecordCount = 0\n let skippedRecordCount = 0\n const skippedRecordTypes: string[] = []\n try {\n this.logger.debug(\n `Initializing retrieval of records from askar storage for context '${askarContext.contextCorrelationId}'`\n )\n scanHandle = await askar.scanStart({\n storeHandle: store.handle,\n profile,\n })\n while (true) {\n this.logger.debug(\n `Fetching batch of records from askar storage for context '${askarContext.contextCorrelationId}'`\n )\n entryListHandle = await askar.scanNext({ scanHandle })\n\n // We reached the end of the scan\n if (!entryListHandle) {\n this.logger.debug(\n `No records returned in batch from askar storage. No records left to migrate for context '${askarContext.contextCorrelationId}'`\n )\n break\n }\n\n const list = new EntryList({ handle: entryListHandle })\n this.logger.debug(\n `Retrieved batch of '${list.length}' records from askar storage for context '${askarContext.contextCorrelationId}'`\n )\n for (let index = 0; index < list.length; index++) {\n const entry = list.getEntryByIndex(index)\n const entryObject = entry.toJson()\n this.logger.trace(\n `Retrieved record with index '${index}', id '${entryObject.name}' and type '${entryObject.category}' from batch for context '${askarContext.contextCorrelationId}'`\n )\n\n const adapter = this.getAdapterForRecordType(entryObject.category)\n if (!adapter) {\n if (this.skipMigrationforMissingAdapter) {\n this.logger.info(\n `Skippping migration of record '${entry.name}' with type '${entry.category}' due to missing drizzle adapter for context '${askarContext.contextCorrelationId}'.`\n )\n skippedRecordCount++\n skippedRecordTypes.push(entryObject.category)\n continue\n }\n\n throw new AskarToDrizzleStorageMigrationError(\n `Could not find a registered drizzle adapter for record type '${entry.category}'. Make sure to register the record type in the DrizzleStorageModule.`\n )\n }\n const record = recordToInstance(entryObject, adapter.recordClass)\n\n if (record instanceof StorageVersionRecord && record.id === StorageVersionRecord.storageVersionRecordId) {\n this.logger.debug(\n `Updating record '${record.id}' with type '${record.type}' into drizzle storage for context '${askarContext.contextCorrelationId}'`\n )\n // A new storage version record is created when we first initialize the agent\n // so in this case we need to update the record\n await adapter.update(drizzleContext, record)\n } else {\n this.logger.debug(\n `Inserting record '${record.id}' with type '${record.type}' into drizzle storage for context '${askarContext.contextCorrelationId}'`\n )\n await adapter.insert(drizzleContext, record)\n }\n\n migratedRecordCount++\n }\n\n this.logger.debug(`Processed all records from batch for context '${askarContext.contextCorrelationId}'`)\n\n // Free and clear handle\n entryListHandle.free()\n entryListHandle = null\n }\n\n this.logger.debug(\n `Succesfully migrated '${migratedRecordCount}' records from Askar to Drizzle for context '${askarContext.contextCorrelationId}'`,\n {\n migratedRecordCount,\n skippedRecordCount,\n skippedRecordTypes,\n }\n )\n } finally {\n // Free entry list handle if we didn't free it yet (in case of error)\n entryListHandle?.free()\n entryListHandle = null\n\n scanHandle?.free()\n scanHandle = undefined\n }\n } catch (error) {\n this.logger.error(`Migration failed for context '${askarContext.contextCorrelationId}'. ${error.message}`)\n throw new AskarToDrizzleStorageMigrationError(\n `Migration failed for context '${askarContext.contextCorrelationId}'. ${error.message}`,\n {\n cause: error,\n }\n )\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BA,IAAa,gCAAb,MAAa,8BAA8B;CAkCzC,AAAQ,YACN,AAAQA,eACR,AAAQC,aACR,AAAQC,mBACR,AAAQC,QACR,AAAQC,gCACR,AAAQC,eACR;EANQ;EACA;EACA;EACA;EACA;EACA;OAvCF,eAAe,IAAI,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O;AAER,qBAAiB,MAAM;AACvB,sBAAkB;AAElB,gBAAY,MAAM;AAClB,iBAAa;;WAER,OAAO;AACd,QAAK,OAAO,MAAM,iCAAiC,aAAa,qBAAqB,KAAK,MAAM,UAAU;AAC1G,SAAM,IAAI,oCACR,iCAAiC,aAAa,qBAAqB,KAAK,MAAM,WAC9E,EACE,OAAO,OACR,CACF"}
1
+ {"version":3,"file":"AskarToDrizzleStorageMigrator.mjs","names":["drizzleModule: DrizzleStorageModule","askarModule: AskarModule","agentDependencies: AgentDependencies","logger: Logger","skipMigrationforMissingAdapter: boolean","tenantsModule?: TenantsModule","adapter","scanHandle: ScanHandle | undefined","entryListHandle: EntryListHandle | null","skippedRecordTypes: string[]"],"sources":["../src/AskarToDrizzleStorageMigrator.ts"],"sourcesContent":["import { AskarModule, AskarModuleConfig, AskarStoreManager, recordToInstance } from '@credo-ts/askar'\nimport {\n Agent,\n AgentContext,\n type AgentDependencies,\n BaseRecord,\n ConsoleLogger,\n type Logger,\n LogLevel,\n StorageVersionRecord,\n} from '@credo-ts/core'\nimport { BaseDrizzleRecordAdapter, DrizzleStorageModule, DrizzleStorageModuleConfig } from '@credo-ts/drizzle-storage'\nimport { TenantsModule } from '@credo-ts/tenants'\nimport { EntryList, EntryListHandle, ScanHandle } from '@openwallet-foundation/askar-shared'\nimport { AskarToDrizzleStorageMigrationError } from './errors/AskarToDrizzleStorageMigrationError'\n\n/**\n * Migration class to move storage from Askar to Drizzle. Note that this does not migrate\n * the KMS part of Askar (the keys), and only the normal record storage.\n *\n * No backups are created during the process. The askar store is only used for reading, the\n * drizzle store is also used for writing. Ensure the drizzle target is empty when starting the\n * migration.\n *\n * Note that if you were previously using `AskarMultiWalletDatabaseScheme.DatabasePerWallet`, that all storage will be moved\n * to a single database. You can still keep using multiiple databases for the Askar storage, but Drizzle only supports\n * a single database per main agent instance (including sub agents for tenants).\n */\nexport class AskarToDrizzleStorageMigrator {\n private drizzleAgent = new Agent({\n dependencies: this.agentDependencies,\n config: {\n logger: this.logger,\n },\n modules: this.tenantsModule\n ? {\n drizzle: this.drizzleModule,\n tenants: this.tenantsModule,\n }\n : {\n drizzle: this.drizzleModule,\n },\n })\n\n public askarAgent = new Agent({\n modules: this.tenantsModule\n ? {\n askar: this.askarModule,\n tenants: this.tenantsModule,\n }\n : {\n askar: this.askarModule,\n },\n config: {\n logger: this.logger,\n },\n dependencies: this.agentDependencies,\n })\n\n private drizzleConfig = this.drizzleAgent.context.resolve(DrizzleStorageModuleConfig)\n private drizzleAdapters = this.drizzleConfig.adapters\n\n private constructor(\n private drizzleModule: DrizzleStorageModule,\n private askarModule: AskarModule,\n private agentDependencies: AgentDependencies,\n private logger: Logger,\n private skipMigrationforMissingAdapter: boolean,\n private tenantsModule?: TenantsModule\n ) {}\n\n public static async initialize({\n drizzleModule,\n askarModule,\n agentDependencies,\n logger = new ConsoleLogger(LogLevel.trace),\n skipMigrationForMissingAdapter = false,\n tenantsModule,\n }: {\n drizzleModule: DrizzleStorageModule\n askarModule: AskarModule\n agentDependencies: AgentDependencies\n logger: Logger\n tenantsModule?: TenantsModule\n\n /**\n * When set to `true`, the migration of any records in the Askar store that don't\n * have an adapter registered will be skipped. Note that this can be dangerous and\n * result in loss of data in the new store. Use this only if you have records with a\n * category in your askar store, for which there is no adapter registered, and should\n * not be migrated.\n *\n * @default false\n */\n skipMigrationForMissingAdapter?: boolean\n }) {\n if (!askarModule.config.enableStorage) {\n throw new AskarToDrizzleStorageMigrationError(\n 'Askar module has enableStorage set to false. Make sure the storage is enabled on the askar module'\n )\n }\n\n const migrator = new AskarToDrizzleStorageMigrator(\n drizzleModule,\n askarModule,\n agentDependencies,\n logger,\n skipMigrationForMissingAdapter,\n tenantsModule\n )\n\n return migrator\n }\n\n private getAdapterForRecordType(recordType: string) {\n const adapter = this.drizzleAdapters.find((adapter) => adapter.recordClass.type === recordType)\n if (!adapter) {\n return null\n }\n\n // biome-ignore lint/suspicious/noExplicitAny: no explanation\n return adapter as BaseDrizzleRecordAdapter<BaseRecord, any, any, any, any>\n }\n\n public async migrate() {\n try {\n await this.drizzleAgent.initialize()\n this.logger.info('Successfully initialized drizzle agent')\n await this.askarAgent.initialize()\n this.logger.info('Successfully initialized askar agent')\n\n this.logger.info('Starting migration of default agent context')\n await this.migrateForContext({\n askarContext: this.askarAgent.context,\n drizzleContext: this.drizzleAgent.context,\n })\n this.logger.info('Succesfully migrated default agent context')\n\n if (this.tenantsModule) {\n const askarAgentWithTenants = this.askarAgent as Agent<{ tenants: TenantsModule }>\n const drizzleAgentWithTenants = this.drizzleAgent as Agent<{ tenants: TenantsModule }>\n\n this.logger.info('Detected tenants module, migrating tenants context')\n const allTenants = await askarAgentWithTenants.modules.tenants.getAllTenants()\n\n this.logger.debug(`Retrieved '${allTenants.length}' tenant records to migrate.`)\n\n for (const tenant of allTenants) {\n this.logger.info(`Starting migration of tenant '${tenant.id}'`)\n\n // NOTE: we create a nested withTenantAgent, as we need to have the context for both the askar and drizzle module/agent.\n // Using `withTenantAgent` ensures the session is always correctly closed, so it's the safest way\n await askarAgentWithTenants.modules.tenants.withTenantAgent(\n { tenantId: tenant.id },\n async (askarTenantAgent) => {\n await drizzleAgentWithTenants.modules.tenants.withTenantAgent(\n { tenantId: tenant.id },\n (drizzleTenantAgent) =>\n this.migrateForContext({\n askarContext: askarTenantAgent.context,\n drizzleContext: drizzleTenantAgent.context,\n })\n )\n }\n )\n this.logger.info(`Succesfully migrated tenant '${tenant.id}'`)\n }\n }\n } finally {\n if (this.drizzleAgent.isInitialized) {\n await this.drizzleAgent.shutdown()\n }\n\n if (this.askarAgent.isInitialized) {\n await this.askarAgent.shutdown()\n }\n }\n }\n\n public async deleteStorageRecords() {\n try {\n await this.askarAgent.initialize()\n this.logger.info('Successfully initialized askar agent')\n\n if (this.tenantsModule) {\n const askarAgentWithTenants = this.askarAgent as Agent<{ tenants: TenantsModule }>\n\n this.logger.info('Detected tenants module, deleting tenant records')\n const allTenants = await askarAgentWithTenants.modules.tenants.getAllTenants()\n\n this.logger.debug(`Retrieved '${allTenants.length}' tenants to delete non-KMS storage for.`)\n\n for (const tenant of allTenants) {\n this.logger.info(`Starting deletion of non-KMS records for tenant '${tenant.id}'`)\n\n // NOTE: we create a nested withTenantAgent, as we need to have the context for both the askar and drizzle module/agent.\n // Using `withTenantAgent` ensures the session is always correctly closed, so it's the safest way\n await askarAgentWithTenants.modules.tenants.withTenantAgent(\n { tenantId: tenant.id },\n async (askarTenantAgent) =>\n this.deleteForContext({\n askarContext: askarTenantAgent.context,\n })\n )\n this.logger.info(`Succesfully removed non-KMS records for tenant '${tenant.id}'`)\n }\n }\n\n this.logger.info('Starting deletion of non-KMS records for default agent context')\n await this.deleteForContext({\n askarContext: this.askarAgent.context,\n })\n this.logger.info('Succesfully removed non-KMS records for default agent context')\n } finally {\n if (this.askarAgent.isInitialized) {\n await this.askarAgent.shutdown()\n }\n }\n }\n\n private async migrateForContext({\n drizzleContext,\n askarContext,\n }: {\n drizzleContext: AgentContext\n askarContext: AgentContext\n }) {\n try {\n const storeManager = askarContext.resolve(AskarStoreManager)\n const askar = askarContext.resolve(AskarModuleConfig).askar\n\n const { store, profile } = await storeManager.getInitializedStoreWithProfile(askarContext)\n\n // We need to make sure that the drizzle storage is provisioned for the context\n // In case of root agent context this will alreayd be handled on initialization\n // but for tenants agents we need to make sure a row exists in the `Context` table\n await this.drizzleModule.onProvisionContext(drizzleContext)\n\n let scanHandle: ScanHandle | undefined\n let entryListHandle: EntryListHandle | null = null\n let migratedRecordCount = 0\n let skippedRecordCount = 0\n const skippedRecordTypes: string[] = []\n try {\n this.logger.debug(\n `Initializing retrieval of records from askar storage for context '${askarContext.contextCorrelationId}'`\n )\n scanHandle = await askar.scanStart({\n storeHandle: store.handle,\n profile,\n })\n while (true) {\n this.logger.debug(\n `Fetching batch of records from askar storage for context '${askarContext.contextCorrelationId}'`\n )\n entryListHandle = await askar.scanNext({ scanHandle })\n\n // We reached the end of the scan\n if (!entryListHandle) {\n this.logger.debug(\n `No records returned in batch from askar storage. No records left to migrate for context '${askarContext.contextCorrelationId}'`\n )\n break\n }\n\n const list = new EntryList({ handle: entryListHandle })\n this.logger.debug(\n `Retrieved batch of '${list.length}' records from askar storage for context '${askarContext.contextCorrelationId}'`\n )\n for (let index = 0; index < list.length; index++) {\n const entry = list.getEntryByIndex(index)\n const entryObject = entry.toJson()\n this.logger.trace(\n `Retrieved record with index '${index}', id '${entryObject.name}' and type '${entryObject.category}' from batch for context '${askarContext.contextCorrelationId}'`\n )\n\n const adapter = this.getAdapterForRecordType(entryObject.category)\n if (!adapter) {\n if (this.skipMigrationforMissingAdapter) {\n this.logger.info(\n `Skippping migration of record '${entry.name}' with type '${entry.category}' due to missing drizzle adapter for context '${askarContext.contextCorrelationId}'.`\n )\n skippedRecordCount++\n skippedRecordTypes.push(entryObject.category)\n continue\n }\n\n throw new AskarToDrizzleStorageMigrationError(\n `Could not find a registered drizzle adapter for record type '${entry.category}'. Make sure to register the record type in the DrizzleStorageModule.`\n )\n }\n const record = recordToInstance(entryObject, adapter.recordClass)\n\n if (record instanceof StorageVersionRecord && record.id === StorageVersionRecord.storageVersionRecordId) {\n this.logger.debug(\n `Updating record '${record.id}' with type '${record.type}' into drizzle storage for context '${askarContext.contextCorrelationId}'`\n )\n // A new storage version record is created when we first initialize the agent\n // so in this case we need to update the record\n await adapter.update(drizzleContext, record)\n } else {\n this.logger.debug(\n `Inserting record '${record.id}' with type '${record.type}' into drizzle storage for context '${askarContext.contextCorrelationId}'`\n )\n await adapter.insert(drizzleContext, record)\n }\n\n migratedRecordCount++\n }\n\n this.logger.debug(`Processed all records from batch for context '${askarContext.contextCorrelationId}'`)\n\n // Free and clear handle\n entryListHandle.free()\n entryListHandle = null\n }\n\n this.logger.debug(\n `Succesfully migrated '${migratedRecordCount}' records from Askar to Drizzle for context '${askarContext.contextCorrelationId}'`,\n {\n migratedRecordCount,\n skippedRecordCount,\n skippedRecordTypes,\n }\n )\n } finally {\n // Free entry list handle if we didn't free it yet (in case of error)\n entryListHandle?.free()\n entryListHandle = null\n\n scanHandle?.free()\n scanHandle = undefined\n }\n } catch (error) {\n this.logger.error(`Migration failed for context '${askarContext.contextCorrelationId}'. ${error.message}`)\n throw new AskarToDrizzleStorageMigrationError(\n `Migration failed for context '${askarContext.contextCorrelationId}'. ${error.message}`,\n {\n cause: error,\n }\n )\n }\n }\n\n private async deleteForContext({ askarContext }: { askarContext: AgentContext }) {\n try {\n const storeManager = askarContext.resolve(AskarStoreManager)\n const { store, profile } = await storeManager.getInitializedStoreWithProfile(askarContext)\n\n this.logger.debug(\n `Removing all non-KMS records from askar storage for context '${askarContext.contextCorrelationId}'`\n )\n const session = await store.session(profile).open()\n try {\n await session.removeAll({})\n\n this.logger.debug(\n `Succesfully removed all non-KMS records from Askar for context '${askarContext.contextCorrelationId}'`\n )\n } finally {\n await session.close()\n }\n } catch (error) {\n this.logger.error(\n `Removing non-KMS records failed for context '${askarContext.contextCorrelationId}'. ${error.message}`\n )\n throw new AskarToDrizzleStorageMigrationError(\n `Removing non-KMS record failed for context '${askarContext.contextCorrelationId}'. ${error.message}`,\n {\n cause: error,\n }\n )\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BA,IAAa,gCAAb,MAAa,8BAA8B;CAkCzC,AAAQ,YACN,AAAQA,eACR,AAAQC,aACR,AAAQC,mBACR,AAAQC,QACR,AAAQC,gCACR,AAAQC,eACR;EANQ;EACA;EACA;EACA;EACA;EACA;OAvCF,eAAe,IAAI,MAAM;GAC/B,cAAc,KAAK;GACnB,QAAQ,EACN,QAAQ,KAAK,QACd;GACD,SAAS,KAAK,gBACV;IACE,SAAS,KAAK;IACd,SAAS,KAAK;IACf,GACD,EACE,SAAS,KAAK,eACf;GACN,CAAC;OAEK,aAAa,IAAI,MAAM;GAC5B,SAAS,KAAK,gBACV;IACE,OAAO,KAAK;IACZ,SAAS,KAAK;IACf,GACD,EACE,OAAO,KAAK,aACb;GACL,QAAQ,EACN,QAAQ,KAAK,QACd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@
8
8
  },
9
9
  "./package.json": "./package.json"
10
10
  },
11
- "version": "0.6.0-alpha-20251016175322",
11
+ "version": "0.6.0-alpha-20251017082229",
12
12
  "files": [
13
13
  "build"
14
14
  ],
@@ -23,10 +23,10 @@
23
23
  "directory": "packages/askar-to-drizzle-storage-migration"
24
24
  },
25
25
  "dependencies": {
26
- "@credo-ts/askar": "0.6.0-alpha-20251016175322",
27
- "@credo-ts/tenants": "0.6.0-alpha-20251016175322",
28
- "@credo-ts/drizzle-storage": "0.6.0-alpha-20251016175322",
29
- "@credo-ts/core": "0.6.0-alpha-20251016175322"
26
+ "@credo-ts/askar": "0.6.0-alpha-20251017082229",
27
+ "@credo-ts/tenants": "0.6.0-alpha-20251017082229",
28
+ "@credo-ts/drizzle-storage": "0.6.0-alpha-20251017082229",
29
+ "@credo-ts/core": "0.6.0-alpha-20251017082229"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@openwallet-foundation/askar-shared": "^0.4.2"