Add regenerateCookieBannerTrackerPolicy mutation

Expose a non-destructive re-trigger that re-arms tracker policy
generation for a banner that already has a published version, so the
tracker-policy worker regenerates the document after iterating on the
generator. RegenerateTrackerPolicy returns a conflict when nothing has
been published yet.

Wire it across all API surfaces per the api-surface rule: the console
GraphQL mutation and resolver, the MCP tool, the prb cookie-banner
regenerate-policy command, and the n8n operation, with console e2e
coverage for the success and no-published-version paths.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-06-03 13:37:59 +02:00
parent c763f83b13
commit e6866f88a0
10 changed files with 354 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ import * as deleteOp from './delete.operation';
import * as activateOp from './activate.operation';
import * as deactivateOp from './deactivate.operation';
import * as publishOp from './publish.operation';
import * as regeneratePolicyOp from './regeneratePolicy.operation';
import * as translateOp from './translate.operation';
export const description: INodeProperties[] = [
@@ -77,6 +78,12 @@ export const description: INodeProperties[] = [
description: 'Publish a new cookie banner version',
action: 'Publish a cookie banner version',
},
{
name: 'Regenerate Policy',
value: 'regeneratePolicy',
description: 'Re-arm tracker policy generation for a published cookie banner',
action: 'Regenerate a cookie banner tracker policy',
},
{
name: 'Translate',
value: 'translate',
@@ -100,6 +107,7 @@ export const description: INodeProperties[] = [
...activateOp.description,
...deactivateOp.description,
...publishOp.description,
...regeneratePolicyOp.description,
...translateOp.description,
];
@@ -112,5 +120,6 @@ export {
activateOp as activate,
deactivateOp as deactivate,
publishOp as publish,
regeneratePolicyOp as regeneratePolicy,
translateOp as translate,
};

View File

@@ -0,0 +1,62 @@
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
import type { INodeProperties, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
import { proboApiRequest } from '../../GenericFunctions';
export const description: INodeProperties[] = [
{
displayName: 'Cookie Banner ID',
name: 'cookieBannerId',
type: 'string',
displayOptions: {
show: {
resource: ['cookieBanner'],
operation: ['regeneratePolicy'],
},
},
default: '',
description: 'The ID of the cookie banner to regenerate the tracker policy for',
required: true,
},
];
export async function execute(
this: IExecuteFunctions,
itemIndex: number,
): Promise<INodeExecutionData> {
const cookieBannerId = this.getNodeParameter('cookieBannerId', itemIndex) as string;
const query = `
mutation RegenerateCookieBannerTrackerPolicy($input: RegenerateCookieBannerTrackerPolicyInput!) {
regenerateCookieBannerTrackerPolicy(input: $input) {
cookieBanner {
id
name
origin
state
createdAt
updatedAt
}
}
}
`;
const responseData = await proboApiRequest.call(this, query, { input: { cookieBannerId } });
return {
json: responseData,
pairedItem: { item: itemIndex },
};
}