From b2056e655c98033a9d7bfcd8d0099ca9a8c1e93d Mon Sep 17 00:00:00 2001 From: Vitor Gomes Date: Thu, 3 Oct 2024 09:57:29 -0300 Subject: [PATCH] Extend conflict resolver on promote to handle all pages-graphql files --- src/modules/promote.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/modules/promote.ts b/src/modules/promote.ts index 70147e0..95739b4 100644 --- a/src/modules/promote.ts +++ b/src/modules/promote.ts @@ -13,8 +13,9 @@ import { workspaceUse, COLORS, } from 'vtex' +import { MineWinsConflictsResolver } from '@vtex/api' -const { checkForConflicts } = VBase.createClient() +const vbase = VBase.createClient() const { promote, get } = createWorkspacesClient() const { account, workspace: currentWorkspace } = SessionManager.getSingleton() const workspaceUrl = authUrl() @@ -26,11 +27,17 @@ const throwIfIsMaster = (workspace: string) => { } const handleConflict = async () => { - const conflictsFound = await checkForConflicts() + const conflictsFound = await vbase.checkForConflicts() if (conflictsFound) { await axios.get(workspaceUrl) } + + // @vtex/api expects a full implementation of the client, so we need to cast it to any. + // The partial implementation is enough to solve conflicts. + const conflictsResolver = new MineWinsConflictsResolver((vbase as Partial) as any, 'userData', '') + + await conflictsResolver.resolveAll() } const isPromotable = async (workspace: string) => {