feat: Remove sales channels from pub keys (#6876)

**What**
- Add workflow + step for detaching sales channels from pub API keys
- Tweak linking error message to be more helpful
- Add `removeRemoteLink` step to delete API key workflow
This commit is contained in:
Oli Juhl
2024-03-29 16:01:10 +01:00
committed by GitHub
parent 8fd1488938
commit 1bcb13f892
16 changed files with 351 additions and 26 deletions

View File

@@ -0,0 +1,24 @@
const typeToMethod = new Map([
[`dismiss`, `dismiss`],
[`link`, `create`],
])
type LinkingErrorMessageInput = {
moduleA: string
moduleAKey: string
moduleB: string
moduleBKey: string
type: "dismiss" | "link"
}
/**
*
* Example: Module to dismiss salesChannel and apiKey by keys sales_channel_id and api_key_id was not found. Ensure the link exists, keys are correct, and the link is passed in the correct order to method 'remoteLink.dismiss'
*/
export const linkingErrorMessage = (input: LinkingErrorMessageInput) => {
const { moduleA, moduleB, moduleAKey, moduleBKey, type } = input
return `Module to type ${moduleA} and ${moduleB} by keys ${moduleAKey} and ${moduleBKey} was not found. Ensure the link exists, keys are correct, and link is passed in the correct order to method 'remoteLink.${typeToMethod.get(
type
)}'.
`
}