Sync excluded field to MCP and CLI
Add excluded boolean to the MCP CookiePattern schema and UpdateCookiePatternInput. Expose it in CLI cookie-pattern view, list, and update commands. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -37,6 +37,7 @@ query($id: ID!, $first: Int, $after: CursorKey) {
|
|||||||
matchType
|
matchType
|
||||||
displayName
|
displayName
|
||||||
source
|
source
|
||||||
|
excluded
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pageInfo {
|
pageInfo {
|
||||||
@@ -55,6 +56,7 @@ type cookiePattern struct {
|
|||||||
MatchType string `json:"matchType"`
|
MatchType string `json:"matchType"`
|
||||||
DisplayName string `json:"displayName"`
|
DisplayName string `json:"displayName"`
|
||||||
Source string `json:"source"`
|
Source string `json:"source"`
|
||||||
|
Excluded bool `json:"excluded"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||||
@@ -133,10 +135,14 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
|||||||
|
|
||||||
rows := make([][]string, 0, len(patterns))
|
rows := make([][]string, 0, len(patterns))
|
||||||
for _, p := range patterns {
|
for _, p := range patterns {
|
||||||
rows = append(rows, []string{p.ID, p.Pattern, p.MatchType, p.DisplayName, p.Source})
|
excluded := ""
|
||||||
|
if p.Excluded {
|
||||||
|
excluded = "yes"
|
||||||
|
}
|
||||||
|
rows = append(rows, []string{p.ID, p.Pattern, p.MatchType, p.DisplayName, p.Source, excluded})
|
||||||
}
|
}
|
||||||
|
|
||||||
t := cmdutil.NewTable("ID", "PATTERN", "MATCH TYPE", "DISPLAY NAME", "SOURCE").Rows(rows...)
|
t := cmdutil.NewTable("ID", "PATTERN", "MATCH TYPE", "DISPLAY NAME", "SOURCE", "EXCLUDED").Rows(rows...)
|
||||||
_, _ = fmt.Fprintln(f.IOStreams.Out, t)
|
_, _ = fmt.Fprintln(f.IOStreams.Out, t)
|
||||||
|
|
||||||
if totalCount > len(patterns) {
|
if totalCount > len(patterns) {
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
|||||||
flagDisplayName string
|
flagDisplayName string
|
||||||
flagDescription string
|
flagDescription string
|
||||||
flagMaxAge int
|
flagMaxAge int
|
||||||
|
flagExcluded bool
|
||||||
)
|
)
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
@@ -87,6 +88,9 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
|||||||
if cmd.Flags().Changed("max-age-seconds") {
|
if cmd.Flags().Changed("max-age-seconds") {
|
||||||
input["maxAgeSeconds"] = flagMaxAge
|
input["maxAgeSeconds"] = flagMaxAge
|
||||||
}
|
}
|
||||||
|
if cmd.Flags().Changed("excluded") {
|
||||||
|
input["excluded"] = flagExcluded
|
||||||
|
}
|
||||||
|
|
||||||
if len(input) == 1 {
|
if len(input) == 1 {
|
||||||
return fmt.Errorf("at least one field must be specified for update")
|
return fmt.Errorf("at least one field must be specified for update")
|
||||||
@@ -112,6 +116,7 @@ func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
|
|||||||
cmd.Flags().StringVar(&flagDisplayName, "display-name", "", "Display name")
|
cmd.Flags().StringVar(&flagDisplayName, "display-name", "", "Display name")
|
||||||
cmd.Flags().StringVar(&flagDescription, "description", "", "Description")
|
cmd.Flags().StringVar(&flagDescription, "description", "", "Description")
|
||||||
cmd.Flags().IntVar(&flagMaxAge, "max-age-seconds", 0, "Maximum age in seconds")
|
cmd.Flags().IntVar(&flagMaxAge, "max-age-seconds", 0, "Maximum age in seconds")
|
||||||
|
cmd.Flags().BoolVar(&flagExcluded, "excluded", false, "Exclude pattern from consent banner")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ query($id: ID!) {
|
|||||||
maxAgeSeconds
|
maxAgeSeconds
|
||||||
description
|
description
|
||||||
source
|
source
|
||||||
|
excluded
|
||||||
createdAt
|
createdAt
|
||||||
updatedAt
|
updatedAt
|
||||||
}
|
}
|
||||||
@@ -53,6 +54,7 @@ type viewResponse struct {
|
|||||||
MaxAgeSeconds *int `json:"maxAgeSeconds"`
|
MaxAgeSeconds *int `json:"maxAgeSeconds"`
|
||||||
Description *string `json:"description"`
|
Description *string `json:"description"`
|
||||||
Source string `json:"source"`
|
Source string `json:"source"`
|
||||||
|
Excluded bool `json:"excluded"`
|
||||||
CreatedAt string `json:"createdAt"`
|
CreatedAt string `json:"createdAt"`
|
||||||
UpdatedAt string `json:"updatedAt"`
|
UpdatedAt string `json:"updatedAt"`
|
||||||
} `json:"node"`
|
} `json:"node"`
|
||||||
@@ -117,6 +119,7 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
|
|||||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Pattern:"), v.Pattern)
|
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Pattern:"), v.Pattern)
|
||||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Match Type:"), v.MatchType)
|
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Match Type:"), v.MatchType)
|
||||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Source:"), v.Source)
|
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Source:"), v.Source)
|
||||||
|
_, _ = fmt.Fprintf(out, "%s%v\n", label.Render("Excluded:"), v.Excluded)
|
||||||
if v.MaxAgeSeconds != nil {
|
if v.MaxAgeSeconds != nil {
|
||||||
_, _ = fmt.Fprintf(out, "%s%d\n", label.Render("Max Age (seconds):"), *v.MaxAgeSeconds)
|
_, _ = fmt.Fprintf(out, "%s%d\n", label.Render("Max Age (seconds):"), *v.MaxAgeSeconds)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5093,6 +5093,9 @@ func (r *Resolver) UpdateCookiePatternTool(ctx context.Context, req *mcp.CallToo
|
|||||||
if v := UnwrapOmittable(input.Description); v != nil && *v != nil {
|
if v := UnwrapOmittable(input.Description); v != nil && *v != nil {
|
||||||
updateReq.Description = *v
|
updateReq.Description = *v
|
||||||
}
|
}
|
||||||
|
if v := UnwrapOmittable(input.Excluded); v != nil && *v != nil {
|
||||||
|
updateReq.Excluded = *v
|
||||||
|
}
|
||||||
pattern, err := r.cookieBanner.UpdateCookiePattern(ctx, scope, updateReq)
|
pattern, err := r.cookieBanner.UpdateCookiePattern(ctx, scope, updateReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, types.UpdateCookiePatternOutput{}, fmt.Errorf("cannot update cookie pattern: %w", err)
|
return nil, types.UpdateCookiePatternOutput{}, fmt.Errorf("cannot update cookie pattern: %w", err)
|
||||||
|
|||||||
@@ -9320,6 +9320,7 @@ components:
|
|||||||
- display_name
|
- display_name
|
||||||
- description
|
- description
|
||||||
- source
|
- source
|
||||||
|
- excluded
|
||||||
- created_at
|
- created_at
|
||||||
- updated_at
|
- updated_at
|
||||||
properties:
|
properties:
|
||||||
@@ -9357,6 +9358,9 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
enum: [SCRIPT, PRE_EXISTING]
|
enum: [SCRIPT, PRE_EXISTING]
|
||||||
description: How the pattern was discovered
|
description: How the pattern was discovered
|
||||||
|
excluded:
|
||||||
|
type: boolean
|
||||||
|
description: Whether this pattern is excluded from the consent banner
|
||||||
created_at:
|
created_at:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
@@ -9889,6 +9893,11 @@ components:
|
|||||||
- string
|
- string
|
||||||
- "null"
|
- "null"
|
||||||
go.probo.inc/mcpgen/omittable: true
|
go.probo.inc/mcpgen/omittable: true
|
||||||
|
excluded:
|
||||||
|
type:
|
||||||
|
- boolean
|
||||||
|
- "null"
|
||||||
|
go.probo.inc/mcpgen/omittable: true
|
||||||
|
|
||||||
UpdateCookiePatternOutput:
|
UpdateCookiePatternOutput:
|
||||||
type: object
|
type: object
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ func NewCookiePattern(p *coredata.CookiePattern) *CookiePattern {
|
|||||||
MaxAgeSeconds: p.MaxAgeSeconds,
|
MaxAgeSeconds: p.MaxAgeSeconds,
|
||||||
Description: p.Description,
|
Description: p.Description,
|
||||||
Source: CookiePatternSource(p.Source),
|
Source: CookiePatternSource(p.Source),
|
||||||
|
Excluded: p.Excluded,
|
||||||
CreatedAt: p.CreatedAt,
|
CreatedAt: p.CreatedAt,
|
||||||
UpdatedAt: p.UpdatedAt,
|
UpdatedAt: p.UpdatedAt,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user