Surface regulation and country code enums across API layers

Add proper enum types for Regulation and CountryCode in GraphQL
(with @goModel/@goEnum directives) and MCP (as standalone reusable
schemas with $ref). Update CLI, console UI, and n8n to include
the new fields.

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-05-07 14:38:10 +04:00
parent b4d8bd8de2
commit 806bd672ed
11 changed files with 386 additions and 9 deletions

View File

@@ -36,6 +36,8 @@ query($id: ID!, $first: Int, $after: CursorKey, $filter: CookieConsentRecordFilt
visitorId
action
sdkVersion
regulation
countryCode
createdAt
}
}
@@ -50,11 +52,13 @@ query($id: ID!, $first: Int, $after: CursorKey, $filter: CookieConsentRecordFilt
`
type consentRecord struct {
ID string `json:"id"`
VisitorID string `json:"visitorId"`
Action string `json:"action"`
SDKVersion string `json:"sdkVersion"`
CreatedAt string `json:"createdAt"`
ID string `json:"id"`
VisitorID string `json:"visitorId"`
Action string `json:"action"`
SDKVersion string `json:"sdkVersion"`
Regulation string `json:"regulation"`
CountryCode string `json:"countryCode"`
CreatedAt string `json:"createdAt"`
}
func NewCmdList(f *cmdutil.Factory) *cobra.Command {
@@ -150,10 +154,10 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
rows := make([][]string, 0, len(records))
for _, r := range records {
rows = append(rows, []string{r.ID, r.VisitorID, r.Action, r.SDKVersion, r.CreatedAt})
rows = append(rows, []string{r.ID, r.VisitorID, r.Action, r.SDKVersion, r.Regulation, r.CountryCode, r.CreatedAt})
}
t := cmdutil.NewTable("ID", "VISITOR ID", "ACTION", "SDK VERSION", "CREATED AT").Rows(rows...)
t := cmdutil.NewTable("ID", "VISITOR ID", "ACTION", "SDK VERSION", "REGULATION", "COUNTRY", "CREATED AT").Rows(rows...)
_, _ = fmt.Fprintln(f.IOStreams.Out, t)
if totalCount > len(records) {

View File

@@ -36,6 +36,8 @@ query($id: ID!) {
consentData
action
sdkVersion
regulation
countryCode
createdAt
}
}
@@ -52,6 +54,8 @@ type viewResponse struct {
ConsentData string `json:"consentData"`
Action string `json:"action"`
SdkVersion string `json:"sdkVersion"`
Regulation string `json:"regulation"`
CountryCode string `json:"countryCode"`
CreatedAt string `json:"createdAt"`
} `json:"node"`
}
@@ -115,6 +119,8 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Visitor ID:"), v.VisitorID)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Action:"), v.Action)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("SDK Version:"), v.SdkVersion)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Regulation:"), v.Regulation)
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Country Code:"), v.CountryCode)
if v.IPAddress != nil && *v.IPAddress != "" {
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("IP Address:"), *v.IPAddress)
}