diff --git a/packages/n8n-node/nodes/Probo/actions/cookiePattern/get.operation.ts b/packages/n8n-node/nodes/Probo/actions/cookiePattern/get.operation.ts index 731a4b961..b6aff69e2 100644 --- a/packages/n8n-node/nodes/Probo/actions/cookiePattern/get.operation.ts +++ b/packages/n8n-node/nodes/Probo/actions/cookiePattern/get.operation.ts @@ -50,6 +50,7 @@ export async function execute( description source excluded + lastMatchedAt createdAt updatedAt } diff --git a/packages/n8n-node/nodes/Probo/actions/cookiePattern/getAll.operation.ts b/packages/n8n-node/nodes/Probo/actions/cookiePattern/getAll.operation.ts index 97e1a2512..c5d0ccac4 100644 --- a/packages/n8n-node/nodes/Probo/actions/cookiePattern/getAll.operation.ts +++ b/packages/n8n-node/nodes/Probo/actions/cookiePattern/getAll.operation.ts @@ -85,6 +85,7 @@ export async function execute( description source excluded + lastMatchedAt createdAt updatedAt } diff --git a/pkg/cmd/cookie-pattern/list/list.go b/pkg/cmd/cookie-pattern/list/list.go index 8bf90018f..ee2b15dd4 100644 --- a/pkg/cmd/cookie-pattern/list/list.go +++ b/pkg/cmd/cookie-pattern/list/list.go @@ -38,6 +38,7 @@ query($id: ID!, $first: Int, $after: CursorKey) { displayName source excluded + lastMatchedAt } } pageInfo { @@ -51,12 +52,13 @@ query($id: ID!, $first: Int, $after: CursorKey) { ` type cookiePattern struct { - ID string `json:"id"` - Pattern string `json:"pattern"` - MatchType string `json:"matchType"` - DisplayName string `json:"displayName"` - Source string `json:"source"` - Excluded bool `json:"excluded"` + ID string `json:"id"` + Pattern string `json:"pattern"` + MatchType string `json:"matchType"` + DisplayName string `json:"displayName"` + Source string `json:"source"` + Excluded bool `json:"excluded"` + LastMatchedAt *string `json:"lastMatchedAt"` } func NewCmdList(f *cmdutil.Factory) *cobra.Command { @@ -139,10 +141,14 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command { if p.Excluded { excluded = "yes" } - rows = append(rows, []string{p.ID, p.Pattern, p.MatchType, p.DisplayName, p.Source, excluded}) + lastMatched := "" + if p.LastMatchedAt != nil { + lastMatched = cmdutil.FormatTime(*p.LastMatchedAt) + } + rows = append(rows, []string{p.ID, p.Pattern, p.MatchType, p.DisplayName, p.Source, excluded, lastMatched}) } - t := cmdutil.NewTable("ID", "PATTERN", "MATCH TYPE", "DISPLAY NAME", "SOURCE", "EXCLUDED").Rows(rows...) + t := cmdutil.NewTable("ID", "PATTERN", "MATCH TYPE", "DISPLAY NAME", "SOURCE", "EXCLUDED", "LAST MATCHED").Rows(rows...) _, _ = fmt.Fprintln(f.IOStreams.Out, t) if totalCount > len(patterns) { diff --git a/pkg/cmd/cookie-pattern/view/view.go b/pkg/cmd/cookie-pattern/view/view.go index c242c3b2f..8d874a08e 100644 --- a/pkg/cmd/cookie-pattern/view/view.go +++ b/pkg/cmd/cookie-pattern/view/view.go @@ -37,6 +37,7 @@ query($id: ID!) { description source excluded + lastMatchedAt createdAt updatedAt } @@ -55,6 +56,7 @@ type viewResponse struct { Description *string `json:"description"` Source string `json:"source"` Excluded bool `json:"excluded"` + LastMatchedAt *string `json:"lastMatchedAt"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` } `json:"node"` @@ -126,6 +128,9 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command { if v.Description != nil && *v.Description != "" { _, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Description:"), *v.Description) } + if v.LastMatchedAt != nil { + _, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Last Matched:"), cmdutil.FormatTime(*v.LastMatchedAt)) + } _, _ = fmt.Fprintln(out) _, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Created:"), cmdutil.FormatTime(v.CreatedAt)) _, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Updated:"), cmdutil.FormatTime(v.UpdatedAt)) diff --git a/pkg/server/api/console/v1/graphql/cookie_banner.graphql b/pkg/server/api/console/v1/graphql/cookie_banner.graphql index e17f13d4d..1e2717f4e 100644 --- a/pkg/server/api/console/v1/graphql/cookie_banner.graphql +++ b/pkg/server/api/console/v1/graphql/cookie_banner.graphql @@ -205,6 +205,7 @@ type CookiePattern implements Node { source: CookieSource! excluded: Boolean! cookieCount: Int! @goField(forceResolver: true) + lastMatchedAt: Datetime createdAt: Datetime! updatedAt: Datetime! diff --git a/pkg/server/api/console/v1/types/cookie_pattern.go b/pkg/server/api/console/v1/types/cookie_pattern.go index 5e118a880..f4a539e8a 100644 --- a/pkg/server/api/console/v1/types/cookie_pattern.go +++ b/pkg/server/api/console/v1/types/cookie_pattern.go @@ -76,6 +76,7 @@ func NewCookiePattern(cp *coredata.CookiePattern) *CookiePattern { Description: cp.Description, Source: cp.Source, Excluded: cp.Excluded, + LastMatchedAt: cp.LastMatchedAt, CreatedAt: cp.CreatedAt, UpdatedAt: cp.UpdatedAt, } diff --git a/pkg/server/api/mcp/v1/specification.yaml b/pkg/server/api/mcp/v1/specification.yaml index d9f5bf8af..2119fc85c 100644 --- a/pkg/server/api/mcp/v1/specification.yaml +++ b/pkg/server/api/mcp/v1/specification.yaml @@ -9185,6 +9185,12 @@ components: excluded: type: boolean description: Whether this pattern is excluded from the consent banner + last_matched_at: + type: + - string + - "null" + format: date-time + description: Timestamp when a cookie last matched this pattern created_at: type: string format: date-time diff --git a/pkg/server/api/mcp/v1/types/cookie_pattern.go b/pkg/server/api/mcp/v1/types/cookie_pattern.go index 0e9a9eede..9fb4d8934 100644 --- a/pkg/server/api/mcp/v1/types/cookie_pattern.go +++ b/pkg/server/api/mcp/v1/types/cookie_pattern.go @@ -32,6 +32,7 @@ func NewCookiePattern(p *coredata.CookiePattern) *CookiePattern { Description: p.Description, Source: CookiePatternSource(p.Source), Excluded: p.Excluded, + LastMatchedAt: p.LastMatchedAt, CreatedAt: p.CreatedAt, UpdatedAt: p.UpdatedAt, }