From cc99a3b624de58fed909e9d5b1791b1803897f1f Mon Sep 17 00:00:00 2001 From: Thomas Taylor Date: Tue, 24 Mar 2026 22:36:14 +0000 Subject: [PATCH] Fix: Use correct method to uninstall plugins during rollback The rollback called `this.contentplugin.uninstallPlugin()` which does not exist on ContentPluginModule. The correct method is `delete()`. This caused a TypeError that masked the original import error and prevented proper cleanup of newly installed plugins. --- lib/AdaptFrameworkImport.js | 2 +- tests/AdaptFrameworkImport.spec.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/AdaptFrameworkImport.js b/lib/AdaptFrameworkImport.js index ae87e31..cd34bef 100644 --- a/lib/AdaptFrameworkImport.js +++ b/lib/AdaptFrameworkImport.js @@ -881,7 +881,7 @@ class AdaptFrameworkImport { // Uninstall newly installed plugins if (this.contentplugin) { tasks.push(...Object.values(this.newContentPlugins).map(p => - this.contentplugin.uninstallPlugin(p._id) + this.contentplugin.delete({ _id: p._id }) .catch(e => log('warn', `failed to uninstall plugin '${p.name}'`, e)) )) } diff --git a/tests/AdaptFrameworkImport.spec.js b/tests/AdaptFrameworkImport.spec.js index 66d2967..432f1c4 100644 --- a/tests/AdaptFrameworkImport.spec.js +++ b/tests/AdaptFrameworkImport.spec.js @@ -416,7 +416,7 @@ describe('AdaptFrameworkImport', () => { const uninstalled = [] const ctx = makeRollbackCtx({ contentplugin: { - uninstallPlugin: async (id) => uninstalled.push(id) + delete: async ({ _id }) => uninstalled.push(_id) }, newContentPlugins: { 'adapt-contrib-text': { _id: 'p1', name: 'adapt-contrib-text' }, @@ -515,9 +515,9 @@ describe('AdaptFrameworkImport', () => { const uninstalled = [] const ctx = makeRollbackCtx({ contentplugin: { - uninstallPlugin: async (id) => { - if (id === 'p1') throw new Error('uninstall failed') - uninstalled.push(id) + delete: async ({ _id }) => { + if (_id === 'p1') throw new Error('uninstall failed') + uninstalled.push(_id) } }, newContentPlugins: {