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:
@@ -58,6 +58,7 @@ export const cookieBannerConsentRecordPageQuery = graphql`
|
||||
userAgent
|
||||
sdkVersion
|
||||
regulation
|
||||
countryCode
|
||||
consentData
|
||||
createdAt
|
||||
}
|
||||
@@ -158,6 +159,11 @@ export default function CookieBannerConsentRecordPage({
|
||||
{record.regulation || "-"}
|
||||
</span>
|
||||
</PropertyRow>
|
||||
<PropertyRow label={__("Country")}>
|
||||
<span className="font-mono text-sm">
|
||||
{record.countryCode || "-"}
|
||||
</span>
|
||||
</PropertyRow>
|
||||
<PropertyRow label={__("Date")}>
|
||||
<time dateTime={record.createdAt}>
|
||||
{formatDate(record.createdAt)}
|
||||
|
||||
@@ -217,6 +217,7 @@ export default function CookieBannerConsentRecordsPage({
|
||||
<Th>{__("IP Address")}</Th>
|
||||
<Th>{__("SDK Version")}</Th>
|
||||
<Th>{__("Regulation")}</Th>
|
||||
<Th>{__("Country")}</Th>
|
||||
<SortableTh field="CREATED_AT">{__("Date")}</SortableTh>
|
||||
</Tr>
|
||||
</Thead>
|
||||
|
||||
@@ -36,6 +36,7 @@ const consentRecordFragment = graphql`
|
||||
ipAddress
|
||||
sdkVersion
|
||||
regulation
|
||||
countryCode
|
||||
createdAt
|
||||
}
|
||||
`;
|
||||
@@ -80,6 +81,11 @@ export function ConsentRecordRow({ recordKey }: ConsentRecordRowProps) {
|
||||
{record.regulation || "-"}
|
||||
</span>
|
||||
</Td>
|
||||
<Td>
|
||||
<span className="font-mono text-sm">
|
||||
{record.countryCode || "-"}
|
||||
</span>
|
||||
</Td>
|
||||
<Td>
|
||||
<time dateTime={record.createdAt}>
|
||||
{formatDate(record.createdAt)}
|
||||
|
||||
@@ -49,6 +49,8 @@ export async function execute(
|
||||
consentData
|
||||
action
|
||||
sdkVersion
|
||||
regulation
|
||||
countryCode
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,6 +152,8 @@ export async function execute(
|
||||
consentData
|
||||
action
|
||||
sdkVersion
|
||||
regulation
|
||||
countryCode
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -32,6 +32,70 @@ enum CookieConsentAction
|
||||
)
|
||||
}
|
||||
|
||||
enum Regulation
|
||||
@goModel(model: "go.probo.inc/probo/pkg/coredata.Regulation") {
|
||||
NONE
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RegulationNone"
|
||||
)
|
||||
GDPR
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RegulationGDPR"
|
||||
)
|
||||
UK_GDPR
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RegulationUKGDPR"
|
||||
)
|
||||
FADP
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RegulationFADP"
|
||||
)
|
||||
CCPA
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RegulationCCPA"
|
||||
)
|
||||
PIPEDA
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RegulationPIPEDA"
|
||||
)
|
||||
LGPD
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RegulationLGPD"
|
||||
)
|
||||
LFPDPPP
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RegulationLFPDPPP"
|
||||
)
|
||||
POPIA
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RegulationPOPIA"
|
||||
)
|
||||
PDPA
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RegulationPDPA"
|
||||
)
|
||||
PIPL
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RegulationPIPL"
|
||||
)
|
||||
PIPA
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RegulationPIPA"
|
||||
)
|
||||
APPI
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RegulationAPPI"
|
||||
)
|
||||
DPDP
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RegulationDPDP"
|
||||
)
|
||||
PDPL
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.RegulationPDPL"
|
||||
)
|
||||
}
|
||||
|
||||
enum CookieConsentRecordOrderField
|
||||
@goModel(
|
||||
model: "go.probo.inc/probo/pkg/coredata.CookieConsentRecordOrderField"
|
||||
@@ -66,7 +130,8 @@ type CookieConsentRecord implements Node {
|
||||
consentData: String!
|
||||
action: CookieConsentAction!
|
||||
sdkVersion: String!
|
||||
regulation: String!
|
||||
regulation: Regulation!
|
||||
countryCode: CountryCode!
|
||||
createdAt: Datetime!
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,8 @@ func NewCookieConsentRecord(r *coredata.CookieConsentRecord) *CookieConsentRecor
|
||||
ConsentData: string(r.ConsentData),
|
||||
Action: r.Action,
|
||||
SdkVersion: r.SdkVersion,
|
||||
Regulation: r.Regulation.String(),
|
||||
Regulation: r.Regulation,
|
||||
CountryCode: r.CountryCode,
|
||||
CreatedAt: r.CreatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,6 +187,280 @@ components:
|
||||
- INACTIVE
|
||||
go.probo.inc/mcpgen/type: go.probo.inc/probo/pkg/coredata.ProfileState
|
||||
|
||||
Regulation:
|
||||
type: string
|
||||
enum:
|
||||
- NONE
|
||||
- GDPR
|
||||
- UK_GDPR
|
||||
- FADP
|
||||
- CCPA
|
||||
- PIPEDA
|
||||
- LGPD
|
||||
- LFPDPPP
|
||||
- POPIA
|
||||
- PDPA
|
||||
- PIPL
|
||||
- PIPA
|
||||
- APPI
|
||||
- DPDP
|
||||
- PDPL
|
||||
go.probo.inc/mcpgen/type: go.probo.inc/probo/pkg/coredata.Regulation
|
||||
|
||||
CountryCode:
|
||||
type: string
|
||||
enum:
|
||||
- AD
|
||||
- AE
|
||||
- AF
|
||||
- AG
|
||||
- AI
|
||||
- AL
|
||||
- AM
|
||||
- AO
|
||||
- AQ
|
||||
- AR
|
||||
- AS
|
||||
- AT
|
||||
- AU
|
||||
- AW
|
||||
- AX
|
||||
- AZ
|
||||
- BA
|
||||
- BB
|
||||
- BD
|
||||
- BE
|
||||
- BF
|
||||
- BG
|
||||
- BH
|
||||
- BI
|
||||
- BJ
|
||||
- BL
|
||||
- BM
|
||||
- BN
|
||||
- BO
|
||||
- BQ
|
||||
- BR
|
||||
- BS
|
||||
- BT
|
||||
- BV
|
||||
- BW
|
||||
- BY
|
||||
- BZ
|
||||
- CA
|
||||
- CC
|
||||
- CD
|
||||
- CF
|
||||
- CG
|
||||
- CH
|
||||
- CI
|
||||
- CK
|
||||
- CL
|
||||
- CM
|
||||
- CN
|
||||
- CO
|
||||
- CR
|
||||
- CU
|
||||
- CV
|
||||
- CW
|
||||
- CX
|
||||
- CY
|
||||
- CZ
|
||||
- DE
|
||||
- DJ
|
||||
- DK
|
||||
- DM
|
||||
- DO
|
||||
- DZ
|
||||
- EC
|
||||
- EE
|
||||
- EG
|
||||
- EH
|
||||
- ER
|
||||
- ES
|
||||
- ET
|
||||
- EU
|
||||
- FI
|
||||
- FJ
|
||||
- FK
|
||||
- FM
|
||||
- FO
|
||||
- FR
|
||||
- GA
|
||||
- GB
|
||||
- GD
|
||||
- GE
|
||||
- GF
|
||||
- GG
|
||||
- GH
|
||||
- GI
|
||||
- GL
|
||||
- GM
|
||||
- GN
|
||||
- GP
|
||||
- GQ
|
||||
- GR
|
||||
- GT
|
||||
- GU
|
||||
- GW
|
||||
- GY
|
||||
- HK
|
||||
- HM
|
||||
- HN
|
||||
- HR
|
||||
- HT
|
||||
- HU
|
||||
- ID
|
||||
- IE
|
||||
- IL
|
||||
- IM
|
||||
- IN
|
||||
- IO
|
||||
- IQ
|
||||
- IR
|
||||
- IS
|
||||
- IT
|
||||
- JE
|
||||
- JM
|
||||
- JO
|
||||
- JP
|
||||
- KE
|
||||
- KG
|
||||
- KH
|
||||
- KI
|
||||
- KM
|
||||
- KN
|
||||
- KP
|
||||
- KR
|
||||
- KW
|
||||
- KY
|
||||
- KZ
|
||||
- LA
|
||||
- LB
|
||||
- LC
|
||||
- LI
|
||||
- LK
|
||||
- LR
|
||||
- LS
|
||||
- LT
|
||||
- LU
|
||||
- LV
|
||||
- LY
|
||||
- MA
|
||||
- MC
|
||||
- MD
|
||||
- ME
|
||||
- MF
|
||||
- MG
|
||||
- MH
|
||||
- MK
|
||||
- ML
|
||||
- MM
|
||||
- MN
|
||||
- MO
|
||||
- MP
|
||||
- MQ
|
||||
- MR
|
||||
- MS
|
||||
- MT
|
||||
- MU
|
||||
- MV
|
||||
- MW
|
||||
- MX
|
||||
- MY
|
||||
- MZ
|
||||
- NA
|
||||
- NC
|
||||
- NE
|
||||
- NF
|
||||
- NG
|
||||
- NI
|
||||
- NL
|
||||
- NO
|
||||
- NP
|
||||
- NR
|
||||
- NU
|
||||
- NZ
|
||||
- OM
|
||||
- PA
|
||||
- PE
|
||||
- PF
|
||||
- PG
|
||||
- PH
|
||||
- PK
|
||||
- PL
|
||||
- PM
|
||||
- PN
|
||||
- PR
|
||||
- PS
|
||||
- PT
|
||||
- PW
|
||||
- PY
|
||||
- QA
|
||||
- RE
|
||||
- RO
|
||||
- RS
|
||||
- RU
|
||||
- RW
|
||||
- SA
|
||||
- SB
|
||||
- SC
|
||||
- SD
|
||||
- SE
|
||||
- SG
|
||||
- SH
|
||||
- SI
|
||||
- SJ
|
||||
- SK
|
||||
- SL
|
||||
- SM
|
||||
- SN
|
||||
- SO
|
||||
- SR
|
||||
- SS
|
||||
- ST
|
||||
- SV
|
||||
- SX
|
||||
- SY
|
||||
- SZ
|
||||
- TC
|
||||
- TD
|
||||
- TF
|
||||
- TG
|
||||
- TH
|
||||
- TJ
|
||||
- TK
|
||||
- TL
|
||||
- TM
|
||||
- TN
|
||||
- TO
|
||||
- TR
|
||||
- TT
|
||||
- TV
|
||||
- TW
|
||||
- TZ
|
||||
- UA
|
||||
- UG
|
||||
- UM
|
||||
- US
|
||||
- UY
|
||||
- UZ
|
||||
- VA
|
||||
- VC
|
||||
- VE
|
||||
- VG
|
||||
- VI
|
||||
- VN
|
||||
- VU
|
||||
- WF
|
||||
- WS
|
||||
- YE
|
||||
- YT
|
||||
- ZA
|
||||
- ZM
|
||||
- ZW
|
||||
go.probo.inc/mcpgen/type: go.probo.inc/probo/pkg/coredata.CountryCode
|
||||
|
||||
Profile:
|
||||
type: object
|
||||
required:
|
||||
@@ -9291,6 +9565,8 @@ components:
|
||||
- consent_data
|
||||
- action
|
||||
- sdk_version
|
||||
- regulation
|
||||
- country_code
|
||||
- created_at
|
||||
properties:
|
||||
id:
|
||||
@@ -9325,6 +9601,12 @@ components:
|
||||
sdk_version:
|
||||
type: string
|
||||
description: SDK version
|
||||
regulation:
|
||||
$ref: "#/components/schemas/Regulation"
|
||||
description: Applicable regulation
|
||||
country_code:
|
||||
$ref: "#/components/schemas/CountryCode"
|
||||
description: Visitor country code (ISO 3166-1 alpha-2)
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
@@ -35,6 +35,8 @@ func NewCookieConsentRecord(r *coredata.CookieConsentRecord) *CookieConsentRecor
|
||||
ConsentData: consentData,
|
||||
Action: CookieConsentRecordAction(r.Action),
|
||||
SdkVersion: r.SdkVersion,
|
||||
Regulation: r.Regulation,
|
||||
CountryCode: r.CountryCode,
|
||||
CreatedAt: r.CreatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user