From a1e726ec49b255299e99c231eb289652409dd8b7 Mon Sep 17 00:00:00 2001
From: Sacha Al Himdani
Date: Fri, 13 Feb 2026 12:16:15 +0100
Subject: [PATCH] Change webhook table names
Signed-off-by: Sacha Al Himdani
---
.../core/WebhooksSettingsPageQuery.graphql.ts | 18 +-
...bhooksSettingsPage_eventsQuery.graphql.ts} | 38 +-
.../settings/WebhooksSettingsPage.tsx | 98 +-
pkg/coredata/entity_type_reg.go | 8 +-
pkg/coredata/migrations/20260210T135740Z.sql | 14 +-
pkg/coredata/webhook_call.go | 166 --
pkg/coredata/webhook_data.go | 159 ++
..._call_status.go => webhook_data_status.go} | 27 +-
pkg/coredata/webhook_event.go | 196 +-
..._field.go => webhook_event_order_field.go} | 20 +-
pkg/coredata/webhook_event_status.go | 7 +-
pkg/probo/webhook_configuration_service.go | 22 +-
pkg/server/api/console/v1/schema.graphql | 42 +-
pkg/server/api/console/v1/schema/schema.go | 1808 ++++++++---------
pkg/server/api/console/v1/types/types.go | 38 +-
.../{webhook_call.go => webhook_event.go} | 46 +-
pkg/server/api/console/v1/v1_resolver.go | 66 +-
pkg/webhook/data.go | 10 +-
pkg/webhook/sender.go | 97 +-
19 files changed, 1444 insertions(+), 1436 deletions(-)
rename apps/console/src/__generated__/core/{WebhooksSettingsPage_callsQuery.graphql.ts => WebhooksSettingsPage_eventsQuery.graphql.ts} (78%)
delete mode 100644 pkg/coredata/webhook_call.go
create mode 100644 pkg/coredata/webhook_data.go
rename pkg/coredata/{webhook_call_status.go => webhook_data_status.go} (58%)
rename pkg/coredata/{webhook_call_order_field.go => webhook_event_order_field.go} (65%)
rename pkg/server/api/console/v1/types/{webhook_call.go => webhook_event.go} (55%)
diff --git a/apps/console/src/__generated__/core/WebhooksSettingsPageQuery.graphql.ts b/apps/console/src/__generated__/core/WebhooksSettingsPageQuery.graphql.ts
index 5b549801b..19b5343fc 100644
--- a/apps/console/src/__generated__/core/WebhooksSettingsPageQuery.graphql.ts
+++ b/apps/console/src/__generated__/core/WebhooksSettingsPageQuery.graphql.ts
@@ -1,5 +1,5 @@
/**
- * @generated SignedSource<>
+ * @generated SignedSource<<18c0948adc229a75b1d980e64730b423>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -20,10 +20,10 @@ export type WebhooksSettingsPageQuery$data = {
readonly webhookConfigurations: {
readonly edges: ReadonlyArray<{
readonly node: {
- readonly calls: {
+ readonly endpointUrl: string;
+ readonly events: {
readonly totalCount: number;
};
- readonly endpointUrl: string;
readonly id: string;
readonly selectedEvents: ReadonlyArray;
};
@@ -110,9 +110,9 @@ v4 = [
"value": 0
}
],
- "concreteType": "WebhookCallConnection",
+ "concreteType": "WebhookEventConnection",
"kind": "LinkedField",
- "name": "calls",
+ "name": "events",
"plural": false,
"selections": [
{
@@ -123,7 +123,7 @@ v4 = [
"storageKey": null
}
],
- "storageKey": "calls(first:0)"
+ "storageKey": "events(first:0)"
},
(v2/*: any*/)
],
@@ -265,7 +265,7 @@ return {
]
},
"params": {
- "cacheID": "97b7c454586fe958e456fa7929b46686",
+ "cacheID": "b5ca3cf4d05d2cb81c744e760433cb94",
"id": null,
"metadata": {
"connection": [
@@ -282,11 +282,11 @@ return {
},
"name": "WebhooksSettingsPageQuery",
"operationKind": "query",
- "text": "query WebhooksSettingsPageQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n webhookConfigurations(first: 50) {\n edges {\n node {\n id\n endpointUrl\n selectedEvents\n calls(first: 0) {\n totalCount\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n"
+ "text": "query WebhooksSettingsPageQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n webhookConfigurations(first: 50) {\n edges {\n node {\n id\n endpointUrl\n selectedEvents\n events(first: 0) {\n totalCount\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n"
}
};
})();
-(node as any).hash = "58012f55644dae31fe5e18c2c1e193a7";
+(node as any).hash = "bac1812903d6f495d15bb0e70ce5ed48";
export default node;
diff --git a/apps/console/src/__generated__/core/WebhooksSettingsPage_callsQuery.graphql.ts b/apps/console/src/__generated__/core/WebhooksSettingsPage_eventsQuery.graphql.ts
similarity index 78%
rename from apps/console/src/__generated__/core/WebhooksSettingsPage_callsQuery.graphql.ts
rename to apps/console/src/__generated__/core/WebhooksSettingsPage_eventsQuery.graphql.ts
index 807b4d3d5..6a47964d3 100644
--- a/apps/console/src/__generated__/core/WebhooksSettingsPage_callsQuery.graphql.ts
+++ b/apps/console/src/__generated__/core/WebhooksSettingsPage_eventsQuery.graphql.ts
@@ -1,5 +1,5 @@
/**
- * @generated SignedSource<>
+ * @generated SignedSource<<70389123cd52ffd010e2b8f0109aedcd>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,22 +9,22 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
-export type WebhookCallStatus = "FAILED" | "SUCCEEDED";
-export type WebhooksSettingsPage_callsQuery$variables = {
+export type WebhookEventStatus = "FAILED" | "SUCCEEDED";
+export type WebhooksSettingsPage_eventsQuery$variables = {
after?: string | null | undefined;
first?: number | null | undefined;
webhookConfigurationId: string;
};
-export type WebhooksSettingsPage_callsQuery$data = {
+export type WebhooksSettingsPage_eventsQuery$data = {
readonly node: {
- readonly calls?: {
+ readonly events?: {
readonly edges: ReadonlyArray<{
readonly node: {
readonly createdAt: string;
readonly endpointUrl: string;
readonly id: string;
readonly response: string | null | undefined;
- readonly status: WebhookCallStatus;
+ readonly status: WebhookEventStatus;
};
}>;
readonly pageInfo: {
@@ -35,9 +35,9 @@ export type WebhooksSettingsPage_callsQuery$data = {
};
};
};
-export type WebhooksSettingsPage_callsQuery = {
- response: WebhooksSettingsPage_callsQuery$data;
- variables: WebhooksSettingsPage_callsQuery$variables;
+export type WebhooksSettingsPage_eventsQuery = {
+ response: WebhooksSettingsPage_eventsQuery$data;
+ variables: WebhooksSettingsPage_eventsQuery$variables;
};
const node: ConcreteRequest = (function(){
@@ -87,9 +87,9 @@ v5 = {
"variableName": "first"
}
],
- "concreteType": "WebhookCallConnection",
+ "concreteType": "WebhookEventConnection",
"kind": "LinkedField",
- "name": "calls",
+ "name": "events",
"plural": false,
"selections": [
{
@@ -127,7 +127,7 @@ v5 = {
{
"alias": null,
"args": null,
- "concreteType": "WebhookCallEdge",
+ "concreteType": "WebhookEventEdge",
"kind": "LinkedField",
"name": "edges",
"plural": true,
@@ -135,7 +135,7 @@ v5 = {
{
"alias": null,
"args": null,
- "concreteType": "WebhookCall",
+ "concreteType": "WebhookEvent",
"kind": "LinkedField",
"name": "node",
"plural": false,
@@ -191,7 +191,7 @@ return {
],
"kind": "Fragment",
"metadata": null,
- "name": "WebhooksSettingsPage_callsQuery",
+ "name": "WebhooksSettingsPage_eventsQuery",
"selections": [
{
"alias": null,
@@ -217,7 +217,7 @@ return {
(v0/*: any*/)
],
"kind": "Operation",
- "name": "WebhooksSettingsPage_callsQuery",
+ "name": "WebhooksSettingsPage_eventsQuery",
"selections": [
{
"alias": null,
@@ -242,16 +242,16 @@ return {
]
},
"params": {
- "cacheID": "9371a8918daebbb2a660b02649ba0241",
+ "cacheID": "507b568e987ce78e58b171810a60bce8",
"id": null,
"metadata": {},
- "name": "WebhooksSettingsPage_callsQuery",
+ "name": "WebhooksSettingsPage_eventsQuery",
"operationKind": "query",
- "text": "query WebhooksSettingsPage_callsQuery(\n $webhookConfigurationId: ID!\n $first: Int\n $after: CursorKey\n) {\n node(id: $webhookConfigurationId) {\n __typename\n ... on WebhookConfiguration {\n calls(first: $first, after: $after) {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n node {\n id\n status\n endpointUrl\n createdAt\n response\n }\n }\n }\n }\n id\n }\n}\n"
+ "text": "query WebhooksSettingsPage_eventsQuery(\n $webhookConfigurationId: ID!\n $first: Int\n $after: CursorKey\n) {\n node(id: $webhookConfigurationId) {\n __typename\n ... on WebhookConfiguration {\n events(first: $first, after: $after) {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n node {\n id\n status\n endpointUrl\n createdAt\n response\n }\n }\n }\n }\n id\n }\n}\n"
}
};
})();
-(node as any).hash = "de18874117b6272fdf2e22871adc4a5d";
+(node as any).hash = "2e528e16c34c33138858f92215af2ab4";
export default node;
diff --git a/apps/console/src/pages/organizations/settings/WebhooksSettingsPage.tsx b/apps/console/src/pages/organizations/settings/WebhooksSettingsPage.tsx
index 5e3d07548..b99d89554 100644
--- a/apps/console/src/pages/organizations/settings/WebhooksSettingsPage.tsx
+++ b/apps/console/src/pages/organizations/settings/WebhooksSettingsPage.tsx
@@ -23,9 +23,9 @@ import { type PreloadedQuery, usePreloadedQuery, useRelayEnvironment } from "rea
import { ConnectionHandler, fetchQuery, graphql } from "relay-runtime";
import { z } from "zod";
-import type { WebhooksSettingsPage_callsQuery } from "#/__generated__/core/WebhooksSettingsPage_callsQuery.graphql";
import type { WebhooksSettingsPage_createMutation } from "#/__generated__/core/WebhooksSettingsPage_createMutation.graphql";
import type { WebhooksSettingsPage_deleteMutation } from "#/__generated__/core/WebhooksSettingsPage_deleteMutation.graphql";
+import type { WebhooksSettingsPage_eventsQuery } from "#/__generated__/core/WebhooksSettingsPage_eventsQuery.graphql";
import type { WebhooksSettingsPage_signingSecretQuery } from "#/__generated__/core/WebhooksSettingsPage_signingSecretQuery.graphql";
import type { WebhooksSettingsPage_updateMutation } from "#/__generated__/core/WebhooksSettingsPage_updateMutation.graphql";
import type { WebhooksSettingsPageQuery } from "#/__generated__/core/WebhooksSettingsPageQuery.graphql";
@@ -45,7 +45,7 @@ export const webhooksSettingsPageQuery = graphql`
id
endpointUrl
selectedEvents
- calls(first: 0) {
+ events(first: 0) {
totalCount
}
}
@@ -98,15 +98,15 @@ const signingSecretQuery = graphql`
}
`;
-const webhookCallsQuery = graphql`
- query WebhooksSettingsPage_callsQuery(
+const webhookEventsQuery = graphql`
+ query WebhooksSettingsPage_eventsQuery(
$webhookConfigurationId: ID!
$first: Int
$after: CursorKey
) {
node(id: $webhookConfigurationId) {
... on WebhookConfiguration {
- calls(first: $first, after: $after) {
+ events(first: $first, after: $after) {
totalCount
pageInfo {
hasNextPage
@@ -285,7 +285,7 @@ function WebhookFormDialog({
);
}
-function CallStatusBadge({ status }: { status: string }) {
+function EventStatusBadge({ status }: { status: string }) {
const { __ } = useTranslate();
if (status === "SUCCEEDED") {
return {__("Succeeded")};
@@ -297,7 +297,7 @@ function formatDate(iso: string) {
return new Date(iso).toLocaleString();
}
-function WebhookCallsDialog({
+function WebhookEventsDialog({
webhookConfigurationId,
endpointUrl,
onClose,
@@ -307,10 +307,11 @@ function WebhookCallsDialog({
onClose: () => void;
}) {
const { __ } = useTranslate();
+ const { toast } = useToast();
const environment = useRelayEnvironment();
const dialogRef = useDialogRef();
- type CallNode = NonNullable["edges"][number]["node"];
- const [calls, setCalls] = useState([]);
+ type EventNode = NonNullable["edges"][number]["node"];
+ const [events, setEvents] = useState([]);
const [loading, setLoading] = useState(true);
const [hasNextPage, setHasNextPage] = useState(false);
const [endCursor, setEndCursor] = useState(null);
@@ -318,13 +319,13 @@ function WebhookCallsDialog({
const PAGE_SIZE = 20;
- const loadCalls = useCallback(
+ const loadEvents = useCallback(
async (after?: string | null) => {
setLoading(true);
try {
- const data = await fetchQuery(
+ const data = await fetchQuery(
environment,
- webhookCallsQuery,
+ webhookEventsQuery,
{
webhookConfigurationId,
first: PAGE_SIZE,
@@ -332,30 +333,36 @@ function WebhookCallsDialog({
},
).toPromise();
- const connection = data?.node?.calls;
+ const connection = data?.node?.events;
if (connection) {
- const newCalls = connection.edges.map(e => e.node);
- setCalls(prev => after ? [...prev, ...newCalls] : newCalls);
+ const newEvents = connection.edges.map(e => e.node);
+ setEvents(prev => after ? [...prev, ...newEvents] : newEvents);
setHasNextPage(connection.pageInfo.hasNextPage);
setEndCursor(connection.pageInfo.endCursor ?? null);
setTotalCount(connection.totalCount);
}
+ } catch {
+ toast({
+ title: __("Error"),
+ description: __("Failed to load webhook events."),
+ variant: "error",
+ });
} finally {
setLoading(false);
}
},
- [environment, webhookConfigurationId],
+ [environment, webhookConfigurationId, toast, __],
);
useEffect(() => {
- void loadCalls();
+ void loadEvents();
dialogRef.current?.open();
- }, []); // eslint-disable-line react-hooks/exhaustive-deps
+ }, [loadEvents]);
return (
- {calls.length === 0 && !loading
+ {events.length === 0 && !loading
? (
- {__("No webhook calls recorded yet.")}
+ {__("No webhook events recorded yet.")}
)
: (
- {calls.map(call => (
+ {events.map(event => (
-
+
- {formatDate(call.createdAt)}
+ {formatDate(event.createdAt)}
- {call.endpointUrl}
+ {event.endpointUrl}
- {call.response && (
+ {event.response && (
{__("Response")}
@@ -398,9 +405,9 @@ function WebhookCallsDialog({
{(() => {
try {
- return JSON.stringify(JSON.parse(call.response), null, 2);
+ return JSON.stringify(JSON.parse(event.response), null, 2);
} catch {
- return call.response;
+ return event.response;
}
})()}
@@ -420,7 +427,7 @@ function WebhookCallsDialog({
@@ -441,7 +448,7 @@ export function WebhooksSettingsPage(props: {
const [deletingId, setDeletingId] = useState(null);
const [revealedSecrets, setRevealedSecrets] = useState>({});
const [loadingSecrets, setLoadingSecrets] = useState>(new Set());
- const [viewingCallsId, setViewingCallsId] = useState(null);
+ const [viewingEventsId, setViewingEventsId] = useState(null);
const fetchSigningSecret = useCallback(
async (webhookConfigurationId: string): Promise => {
@@ -543,6 +550,9 @@ export function WebhooksSettingsPage(props: {
);
const webhooks = organization.webhookConfigurations?.edges ?? [];
+ const viewingEventsWebhook = viewingEventsId
+ ? webhooks.find(e => e.node.id === viewingEventsId)?.node ?? null
+ : null;
const connectionId = ConnectionHandler.getConnectionID(
organization.id,
@@ -683,9 +693,9 @@ export function WebhooksSettingsPage(props: {
deletingId && handleDelete(deletingId)}
disabled={isDeleting}
- icon={isDeleting ? Spinner : IconTrashCan}
+ icon={isDeleting ? undefined : IconTrashCan}
>
{isDeleting
- ? __("Deleting...")
+ ? <> {__("Deleting...")}>
: __("Delete")}
- {viewingCallsId && (() => {
- const webhook = webhooks.find(e => e.node.id === viewingCallsId);
- if (!webhook) return null;
- return (
- setViewingCallsId(null)}
- />
- );
- })()}
+ {viewingEventsWebhook && viewingEventsId && (
+ setViewingEventsId(null)}
+ />
+ )}
);
}
diff --git a/pkg/coredata/entity_type_reg.go b/pkg/coredata/entity_type_reg.go
index fc7d3c441..9cc752060 100644
--- a/pkg/coredata/entity_type_reg.go
+++ b/pkg/coredata/entity_type_reg.go
@@ -80,8 +80,8 @@ const (
TokenEntityType uint16 = 54
SCIMBridgeEntityType uint16 = 55
WebhookConfigurationEntityType uint16 = 56
- WebhookEventEntityType uint16 = 57
- WebhookCallEntityType uint16 = 58
+ WebhookDataEntityType uint16 = 57
+ WebhookEventEntityType uint16 = 58
)
func NewEntityFromID(id gid.GID) (any, bool) {
@@ -196,10 +196,10 @@ func NewEntityFromID(id gid.GID) (any, bool) {
return &SCIMBridge{ID: id}, true
case WebhookConfigurationEntityType:
return &WebhookConfiguration{ID: id}, true
+ case WebhookDataEntityType:
+ return &WebhookData{ID: id}, true
case WebhookEventEntityType:
return &WebhookEvent{ID: id}, true
- case WebhookCallEntityType:
- return &WebhookCall{ID: id}, true
default:
return nil, false
}
diff --git a/pkg/coredata/migrations/20260210T135740Z.sql b/pkg/coredata/migrations/20260210T135740Z.sql
index 6662a56e5..e2a9bb96b 100644
--- a/pkg/coredata/migrations/20260210T135740Z.sql
+++ b/pkg/coredata/migrations/20260210T135740Z.sql
@@ -18,35 +18,35 @@ CREATE TABLE webhook_configurations (
updated_at TIMESTAMP WITH TIME ZONE NOT NULL
);
-CREATE TYPE webhook_event_status AS ENUM (
+CREATE TYPE webhook_data_status AS ENUM (
'PENDING',
'PROCESSING',
'DELIVERED'
);
-CREATE TABLE webhook_events (
+CREATE TABLE webhook_data (
id TEXT PRIMARY KEY,
tenant_id TEXT NOT NULL,
organization_id TEXT NOT NULL REFERENCES organizations(id) ON UPDATE CASCADE ON DELETE CASCADE,
event_type webhook_event_type NOT NULL,
- status webhook_event_status NOT NULL,
+ status webhook_data_status NOT NULL,
data JSONB NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
processed_at TIMESTAMP WITH TIME ZONE
);
-CREATE TYPE webhook_call_status AS ENUM (
+CREATE TYPE webhook_event_status AS ENUM (
'SUCCEEDED',
'FAILED'
);
-CREATE TABLE webhook_calls (
+CREATE TABLE webhook_events (
id TEXT PRIMARY KEY,
tenant_id TEXT NOT NULL,
- webhook_event_id TEXT NOT NULL REFERENCES webhook_events(id) ON UPDATE CASCADE ON DELETE CASCADE,
+ webhook_data_id TEXT NOT NULL REFERENCES webhook_data(id) ON UPDATE CASCADE ON DELETE CASCADE,
webhook_configuration_id TEXT NOT NULL REFERENCES webhook_configurations(id) ON UPDATE CASCADE ON DELETE CASCADE,
endpoint_url TEXT NOT NULL,
- status webhook_call_status NOT NULL,
+ status webhook_event_status NOT NULL,
response JSONB,
created_at TIMESTAMP WITH TIME ZONE NOT NULL
);
diff --git a/pkg/coredata/webhook_call.go b/pkg/coredata/webhook_call.go
deleted file mode 100644
index 560b2156a..000000000
--- a/pkg/coredata/webhook_call.go
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright (c) 2025 Probo Inc .
-//
-// 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.
-
-package coredata
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "maps"
- "time"
-
- "github.com/jackc/pgx/v5"
- "go.gearno.de/kit/pg"
- "go.probo.inc/probo/pkg/gid"
- "go.probo.inc/probo/pkg/page"
-)
-
-type (
- WebhookCall struct {
- ID gid.GID `db:"id"`
- WebhookEventID gid.GID `db:"webhook_event_id"`
- WebhookConfigurationID gid.GID `db:"webhook_configuration_id"`
- EndpointURL string `db:"endpoint_url"`
- Status WebhookCallStatus `db:"status"`
- Response json.RawMessage `db:"response"`
- CreatedAt time.Time `db:"created_at"`
- }
-
- WebhookCalls []*WebhookCall
-)
-
-func (w WebhookCall) CursorKey(orderBy WebhookCallOrderField) page.CursorKey {
- switch orderBy {
- case WebhookCallOrderFieldCreatedAt:
- return page.NewCursorKey(w.ID, w.CreatedAt)
- }
-
- panic(fmt.Sprintf("unsupported order by: %s", orderBy))
-}
-
-func (w *WebhookCalls) LoadByConfigurationID(
- ctx context.Context,
- conn pg.Conn,
- scope Scoper,
- webhookConfigurationID gid.GID,
- cursor *page.Cursor[WebhookCallOrderField],
-) error {
- q := `
-SELECT
- id,
- webhook_event_id,
- webhook_configuration_id,
- endpoint_url,
- status,
- response,
- created_at
-FROM
- webhook_calls
-WHERE
- %s
- AND webhook_configuration_id = @webhook_configuration_id
- AND %s
-`
- q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment())
-
- args := pgx.NamedArgs{"webhook_configuration_id": webhookConfigurationID}
- maps.Copy(args, scope.SQLArguments())
- maps.Copy(args, cursor.SQLArguments())
-
- rows, err := conn.Query(ctx, q, args)
- if err != nil {
- return fmt.Errorf("cannot query webhook calls: %w", err)
- }
-
- calls, err := pgx.CollectRows(rows, pgx.RowToAddrOfStructByName[WebhookCall])
- if err != nil {
- return fmt.Errorf("cannot collect webhook calls: %w", err)
- }
-
- *w = calls
- return nil
-}
-
-func (w *WebhookCalls) CountByConfigurationID(
- ctx context.Context,
- conn pg.Conn,
- scope Scoper,
- webhookConfigurationID gid.GID,
-) (int, error) {
- q := `
-SELECT COUNT(*)
-FROM webhook_calls
-WHERE %s
- AND webhook_configuration_id = @webhook_configuration_id
-`
- q = fmt.Sprintf(q, scope.SQLFragment())
-
- args := pgx.StrictNamedArgs{"webhook_configuration_id": webhookConfigurationID}
- maps.Copy(args, scope.SQLArguments())
-
- var count int
- if err := conn.QueryRow(ctx, q, args).Scan(&count); err != nil {
- return 0, fmt.Errorf("cannot count webhook calls: %w", err)
- }
-
- return count, nil
-}
-
-func (w *WebhookCall) Insert(
- ctx context.Context,
- conn pg.Conn,
- scope Scoper,
-) error {
- q := `
-INSERT INTO webhook_calls (
- id,
- tenant_id,
- webhook_event_id,
- webhook_configuration_id,
- endpoint_url,
- status,
- response,
- created_at
-)
-VALUES (
- @id,
- @tenant_id,
- @webhook_event_id,
- @webhook_configuration_id,
- @endpoint_url,
- @status,
- @response,
- @created_at
-)
-`
-
- args := pgx.StrictNamedArgs{
- "id": w.ID,
- "tenant_id": scope.GetTenantID(),
- "webhook_event_id": w.WebhookEventID,
- "webhook_configuration_id": w.WebhookConfigurationID,
- "endpoint_url": w.EndpointURL,
- "status": w.Status,
- "response": w.Response,
- "created_at": w.CreatedAt,
- }
-
- _, err := conn.Exec(ctx, q, args)
- if err != nil {
- return fmt.Errorf("cannot insert webhook call: %w", err)
- }
-
- return nil
-}
diff --git a/pkg/coredata/webhook_data.go b/pkg/coredata/webhook_data.go
new file mode 100644
index 000000000..9317eab39
--- /dev/null
+++ b/pkg/coredata/webhook_data.go
@@ -0,0 +1,159 @@
+// Copyright (c) 2025 Probo Inc .
+//
+// 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.
+
+package coredata
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "maps"
+ "time"
+
+ "github.com/jackc/pgx/v5"
+ "go.gearno.de/kit/pg"
+ "go.probo.inc/probo/pkg/gid"
+)
+
+type (
+ WebhookData struct {
+ ID gid.GID `db:"id"`
+ OrganizationID gid.GID `db:"organization_id"`
+ EventType WebhookEventType `db:"event_type"`
+ Status WebhookDataStatus `db:"status"`
+ Data json.RawMessage `db:"data"`
+ CreatedAt time.Time `db:"created_at"`
+ ProcessedAt *time.Time `db:"processed_at"`
+ }
+
+ WebhookDataList []*WebhookData
+)
+
+func (w *WebhookData) Insert(
+ ctx context.Context,
+ conn pg.Conn,
+ scope Scoper,
+) error {
+ q := `
+INSERT INTO webhook_data (
+ id,
+ tenant_id,
+ organization_id,
+ event_type,
+ status,
+ data,
+ created_at
+)
+VALUES (
+ @id,
+ @tenant_id,
+ @organization_id,
+ @event_type,
+ @status,
+ @data,
+ @created_at
+)
+`
+
+ args := pgx.StrictNamedArgs{
+ "id": w.ID,
+ "tenant_id": scope.GetTenantID(),
+ "organization_id": w.OrganizationID,
+ "event_type": w.EventType,
+ "status": w.Status,
+ "data": w.Data,
+ "created_at": w.CreatedAt,
+ }
+
+ _, err := conn.Exec(ctx, q, args)
+ if err != nil {
+ return fmt.Errorf("cannot insert webhook data: %w", err)
+ }
+
+ return nil
+}
+
+func (w *WebhookData) LoadNextPendingForUpdate(
+ ctx context.Context,
+ conn pg.Conn,
+) error {
+ q := `
+SELECT
+ id,
+ organization_id,
+ event_type,
+ status,
+ data,
+ created_at,
+ processed_at
+FROM webhook_data
+WHERE status = 'PENDING'
+ORDER BY created_at ASC
+LIMIT 1
+FOR UPDATE SKIP LOCKED
+`
+
+ rows, err := conn.Query(ctx, q)
+ if err != nil {
+ return fmt.Errorf("cannot query pending webhook data: %w", err)
+ }
+
+ data, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[WebhookData])
+ if err != nil {
+ if errors.Is(err, pgx.ErrNoRows) {
+ return ErrResourceNotFound
+ }
+
+ return fmt.Errorf("cannot collect webhook data: %w", err)
+ }
+
+ *w = data
+ return nil
+}
+
+func (w *WebhookData) UpdateStatus(
+ ctx context.Context,
+ conn pg.Conn,
+ scope Scoper,
+) error {
+ q := `
+UPDATE webhook_data
+SET
+ status = @status,
+ processed_at = @processed_at
+WHERE %s
+ AND id = @id
+`
+
+ q = fmt.Sprintf(q, scope.SQLFragment())
+
+ args := pgx.StrictNamedArgs{
+ "id": w.ID,
+ "status": w.Status.String(),
+ "processed_at": w.ProcessedAt,
+ }
+ maps.Copy(args, scope.SQLArguments())
+
+ result, err := conn.Exec(ctx, q, args)
+ if err != nil {
+ return fmt.Errorf("cannot update webhook data: %w", err)
+ }
+
+ if result.RowsAffected() == 0 {
+ return ErrResourceNotFound
+ }
+
+ return nil
+}
diff --git a/pkg/coredata/webhook_call_status.go b/pkg/coredata/webhook_data_status.go
similarity index 58%
rename from pkg/coredata/webhook_call_status.go
rename to pkg/coredata/webhook_data_status.go
index 034e37c3a..d759a7bb4 100644
--- a/pkg/coredata/webhook_call_status.go
+++ b/pkg/coredata/webhook_data_status.go
@@ -19,46 +19,47 @@ import (
"fmt"
)
-type WebhookCallStatus string
+type WebhookDataStatus string
const (
- WebhookCallStatusSucceeded WebhookCallStatus = "SUCCEEDED"
- WebhookCallStatusFailed WebhookCallStatus = "FAILED"
+ WebhookDataStatusPending WebhookDataStatus = "PENDING"
+ WebhookDataStatusProcessing WebhookDataStatus = "PROCESSING"
+ WebhookDataStatusDelivered WebhookDataStatus = "DELIVERED"
)
-func (s WebhookCallStatus) String() string {
+func (s WebhookDataStatus) String() string {
return string(s)
}
-func (s WebhookCallStatus) IsValid() bool {
+func (s WebhookDataStatus) IsValid() bool {
switch s {
- case WebhookCallStatusSucceeded, WebhookCallStatusFailed:
+ case WebhookDataStatusPending, WebhookDataStatusProcessing, WebhookDataStatusDelivered:
return true
}
return false
}
-func (s WebhookCallStatus) MarshalText() ([]byte, error) {
+func (s WebhookDataStatus) MarshalText() ([]byte, error) {
return []byte(s.String()), nil
}
-func (s *WebhookCallStatus) UnmarshalText(text []byte) error {
- *s = WebhookCallStatus(text)
+func (s *WebhookDataStatus) UnmarshalText(text []byte) error {
+ *s = WebhookDataStatus(text)
if !s.IsValid() {
- return fmt.Errorf("%s is not a valid WebhookCallStatus", string(text))
+ return fmt.Errorf("%s is not a valid WebhookDataStatus", string(text))
}
return nil
}
-func (s *WebhookCallStatus) Scan(value any) error {
+func (s *WebhookDataStatus) Scan(value any) error {
str, ok := value.(string)
if !ok {
- return fmt.Errorf("unsupported type for WebhookCallStatus: %T", value)
+ return fmt.Errorf("unsupported type for WebhookDataStatus: %T", value)
}
return s.UnmarshalText([]byte(str))
}
-func (s WebhookCallStatus) Value() (driver.Value, error) {
+func (s WebhookDataStatus) Value() (driver.Value, error) {
return s.String(), nil
}
diff --git a/pkg/coredata/webhook_event.go b/pkg/coredata/webhook_event.go
index ff2123a42..83a546fce 100644
--- a/pkg/coredata/webhook_event.go
+++ b/pkg/coredata/webhook_event.go
@@ -17,7 +17,6 @@ package coredata
import (
"context"
"encoding/json"
- "errors"
"fmt"
"maps"
"time"
@@ -25,23 +24,100 @@ import (
"github.com/jackc/pgx/v5"
"go.gearno.de/kit/pg"
"go.probo.inc/probo/pkg/gid"
+ "go.probo.inc/probo/pkg/page"
)
type (
WebhookEvent struct {
- ID gid.GID `db:"id"`
- OrganizationID gid.GID `db:"organization_id"`
- EventType WebhookEventType `db:"event_type"`
- Status WebhookEventStatus `db:"status"`
- Data json.RawMessage `db:"data"`
- CreatedAt time.Time `db:"created_at"`
- ProcessedAt *time.Time `db:"processed_at"`
+ ID gid.GID `db:"id"`
+ WebhookDataID gid.GID `db:"webhook_data_id"`
+ WebhookConfigurationID gid.GID `db:"webhook_configuration_id"`
+ EndpointURL string `db:"endpoint_url"`
+ Status WebhookEventStatus `db:"status"`
+ Response json.RawMessage `db:"response"`
+ CreatedAt time.Time `db:"created_at"`
}
WebhookEvents []*WebhookEvent
-
)
+func (w WebhookEvent) CursorKey(orderBy WebhookEventOrderField) page.CursorKey {
+ switch orderBy {
+ case WebhookEventOrderFieldCreatedAt:
+ return page.NewCursorKey(w.ID, w.CreatedAt)
+ }
+
+ panic(fmt.Sprintf("unsupported order by: %s", orderBy))
+}
+
+func (w *WebhookEvents) LoadByConfigurationID(
+ ctx context.Context,
+ conn pg.Conn,
+ scope Scoper,
+ webhookConfigurationID gid.GID,
+ cursor *page.Cursor[WebhookEventOrderField],
+) error {
+ q := `
+SELECT
+ id,
+ webhook_data_id,
+ webhook_configuration_id,
+ endpoint_url,
+ status,
+ response,
+ created_at
+FROM
+ webhook_events
+WHERE
+ %s
+ AND webhook_configuration_id = @webhook_configuration_id
+ AND %s
+`
+ q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment())
+
+ args := pgx.NamedArgs{"webhook_configuration_id": webhookConfigurationID}
+ maps.Copy(args, scope.SQLArguments())
+ maps.Copy(args, cursor.SQLArguments())
+
+ rows, err := conn.Query(ctx, q, args)
+ if err != nil {
+ return fmt.Errorf("cannot query webhook events: %w", err)
+ }
+
+ events, err := pgx.CollectRows(rows, pgx.RowToAddrOfStructByName[WebhookEvent])
+ if err != nil {
+ return fmt.Errorf("cannot collect webhook events: %w", err)
+ }
+
+ *w = events
+ return nil
+}
+
+func (w *WebhookEvents) CountByConfigurationID(
+ ctx context.Context,
+ conn pg.Conn,
+ scope Scoper,
+ webhookConfigurationID gid.GID,
+) (int, error) {
+ q := `
+SELECT COUNT(*)
+FROM webhook_events
+WHERE %s
+ AND webhook_configuration_id = @webhook_configuration_id
+`
+ q = fmt.Sprintf(q, scope.SQLFragment())
+
+ args := pgx.StrictNamedArgs{"webhook_configuration_id": webhookConfigurationID}
+ maps.Copy(args, scope.SQLArguments())
+
+ var count int
+ if err := conn.QueryRow(ctx, q, args).Scan(&count); err != nil {
+ return 0, fmt.Errorf("cannot count webhook events: %w", err)
+ }
+
+ return count, nil
+}
+
func (w *WebhookEvent) Insert(
ctx context.Context,
conn pg.Conn,
@@ -51,31 +127,34 @@ func (w *WebhookEvent) Insert(
INSERT INTO webhook_events (
id,
tenant_id,
- organization_id,
- event_type,
+ webhook_data_id,
+ webhook_configuration_id,
+ endpoint_url,
status,
- data,
+ response,
created_at
)
VALUES (
@id,
@tenant_id,
- @organization_id,
- @event_type,
+ @webhook_data_id,
+ @webhook_configuration_id,
+ @endpoint_url,
@status,
- @data,
+ @response,
@created_at
)
`
args := pgx.StrictNamedArgs{
- "id": w.ID,
- "tenant_id": scope.GetTenantID(),
- "organization_id": w.OrganizationID,
- "event_type": w.EventType,
- "status": w.Status,
- "data": w.Data,
- "created_at": w.CreatedAt,
+ "id": w.ID,
+ "tenant_id": scope.GetTenantID(),
+ "webhook_data_id": w.WebhookDataID,
+ "webhook_configuration_id": w.WebhookConfigurationID,
+ "endpoint_url": w.EndpointURL,
+ "status": w.Status,
+ "response": w.Response,
+ "created_at": w.CreatedAt,
}
_, err := conn.Exec(ctx, q, args)
@@ -85,76 +164,3 @@ VALUES (
return nil
}
-
-func (w *WebhookEvent) LoadNextPendingForUpdate(
- ctx context.Context,
- conn pg.Conn,
-) error {
- q := `
-SELECT
- id,
- organization_id,
- event_type,
- status,
- data,
- created_at,
- processed_at
-FROM webhook_events
-WHERE status = 'PENDING'
-ORDER BY created_at ASC
-LIMIT 1
-FOR UPDATE SKIP LOCKED
-`
-
- rows, err := conn.Query(ctx, q)
- if err != nil {
- return fmt.Errorf("cannot query pending webhook events: %w", err)
- }
-
- event, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[WebhookEvent])
- if err != nil {
- if errors.Is(err, pgx.ErrNoRows) {
- return ErrResourceNotFound
- }
-
- return fmt.Errorf("cannot collect webhook event: %w", err)
- }
-
- *w = event
- return nil
-}
-
-func (w *WebhookEvent) UpdateStatus(
- ctx context.Context,
- conn pg.Conn,
- scope Scoper,
-) error {
- q := `
-UPDATE webhook_events
-SET
- status = @status,
- processed_at = @processed_at
-WHERE %s
- AND id = @id
-`
-
- q = fmt.Sprintf(q, scope.SQLFragment())
-
- args := pgx.StrictNamedArgs{
- "id": w.ID,
- "status": w.Status.String(),
- "processed_at": w.ProcessedAt,
- }
- maps.Copy(args, scope.SQLArguments())
-
- result, err := conn.Exec(ctx, q, args)
- if err != nil {
- return fmt.Errorf("cannot update webhook event: %w", err)
- }
-
- if result.RowsAffected() == 0 {
- return ErrResourceNotFound
- }
-
- return nil
-}
diff --git a/pkg/coredata/webhook_call_order_field.go b/pkg/coredata/webhook_event_order_field.go
similarity index 65%
rename from pkg/coredata/webhook_call_order_field.go
rename to pkg/coredata/webhook_event_order_field.go
index cf6a59364..a536e046b 100644
--- a/pkg/coredata/webhook_call_order_field.go
+++ b/pkg/coredata/webhook_event_order_field.go
@@ -19,37 +19,37 @@ import (
)
type (
- WebhookCallOrderField string
+ WebhookEventOrderField string
)
const (
- WebhookCallOrderFieldCreatedAt WebhookCallOrderField = "CREATED_AT"
+ WebhookEventOrderFieldCreatedAt WebhookEventOrderField = "CREATED_AT"
)
-func (p WebhookCallOrderField) Column() string {
+func (p WebhookEventOrderField) Column() string {
return string(p)
}
-func (p WebhookCallOrderField) String() string {
+func (p WebhookEventOrderField) String() string {
return string(p)
}
-func (p WebhookCallOrderField) IsValid() bool {
+func (p WebhookEventOrderField) IsValid() bool {
switch p {
- case WebhookCallOrderFieldCreatedAt:
+ case WebhookEventOrderFieldCreatedAt:
return true
}
return false
}
-func (p WebhookCallOrderField) MarshalText() ([]byte, error) {
+func (p WebhookEventOrderField) MarshalText() ([]byte, error) {
return []byte(p.String()), nil
}
-func (p *WebhookCallOrderField) UnmarshalText(text []byte) error {
- *p = WebhookCallOrderField(text)
+func (p *WebhookEventOrderField) UnmarshalText(text []byte) error {
+ *p = WebhookEventOrderField(text)
if !p.IsValid() {
- return fmt.Errorf("%s is not a valid WebhookCallOrderField", string(text))
+ return fmt.Errorf("%s is not a valid WebhookEventOrderField", string(text))
}
return nil
}
diff --git a/pkg/coredata/webhook_event_status.go b/pkg/coredata/webhook_event_status.go
index 80ebe4c8c..53157bdab 100644
--- a/pkg/coredata/webhook_event_status.go
+++ b/pkg/coredata/webhook_event_status.go
@@ -22,9 +22,8 @@ import (
type WebhookEventStatus string
const (
- WebhookEventStatusPending WebhookEventStatus = "PENDING"
- WebhookEventStatusProcessing WebhookEventStatus = "PROCESSING"
- WebhookEventStatusDelivered WebhookEventStatus = "DELIVERED"
+ WebhookEventStatusSucceeded WebhookEventStatus = "SUCCEEDED"
+ WebhookEventStatusFailed WebhookEventStatus = "FAILED"
)
func (s WebhookEventStatus) String() string {
@@ -33,7 +32,7 @@ func (s WebhookEventStatus) String() string {
func (s WebhookEventStatus) IsValid() bool {
switch s {
- case WebhookEventStatusPending, WebhookEventStatusProcessing, WebhookEventStatusDelivered:
+ case WebhookEventStatusSucceeded, WebhookEventStatusFailed:
return true
}
return false
diff --git a/pkg/probo/webhook_configuration_service.go b/pkg/probo/webhook_configuration_service.go
index 1eb174373..2b404b5f8 100644
--- a/pkg/probo/webhook_configuration_service.go
+++ b/pkg/probo/webhook_configuration_service.go
@@ -261,18 +261,18 @@ func (s WebhookConfigurationService) GetSigningSecret(
return wc.DecryptSigningSecret(s.svc.encryptionKey)
}
-func (s WebhookConfigurationService) ListCallsForConfigurationID(
+func (s WebhookConfigurationService) ListEventsForConfigurationID(
ctx context.Context,
webhookConfigurationID gid.GID,
- cursor *page.Cursor[coredata.WebhookCallOrderField],
-) (*page.Page[*coredata.WebhookCall, coredata.WebhookCallOrderField], error) {
- var calls coredata.WebhookCalls
+ cursor *page.Cursor[coredata.WebhookEventOrderField],
+) (*page.Page[*coredata.WebhookEvent, coredata.WebhookEventOrderField], error) {
+ var events coredata.WebhookEvents
err := s.svc.pg.WithConn(
ctx,
func(conn pg.Conn) error {
- if err := calls.LoadByConfigurationID(ctx, conn, s.svc.scope, webhookConfigurationID, cursor); err != nil {
- return fmt.Errorf("cannot load webhook calls: %w", err)
+ if err := events.LoadByConfigurationID(ctx, conn, s.svc.scope, webhookConfigurationID, cursor); err != nil {
+ return fmt.Errorf("cannot load webhook events: %w", err)
}
return nil
@@ -283,10 +283,10 @@ func (s WebhookConfigurationService) ListCallsForConfigurationID(
return nil, err
}
- return page.NewPage(calls, cursor), nil
+ return page.NewPage(events, cursor), nil
}
-func (s WebhookConfigurationService) CountCallsForConfigurationID(
+func (s WebhookConfigurationService) CountEventsForConfigurationID(
ctx context.Context,
webhookConfigurationID gid.GID,
) (int, error) {
@@ -295,11 +295,11 @@ func (s WebhookConfigurationService) CountCallsForConfigurationID(
err := s.svc.pg.WithConn(
ctx,
func(conn pg.Conn) (err error) {
- calls := &coredata.WebhookCalls{}
- count, err = calls.CountByConfigurationID(ctx, conn, s.svc.scope, webhookConfigurationID)
+ events := &coredata.WebhookEvents{}
+ count, err = events.CountByConfigurationID(ctx, conn, s.svc.scope, webhookConfigurationID)
if err != nil {
- return fmt.Errorf("cannot count webhook calls: %w", err)
+ return fmt.Errorf("cannot count webhook events: %w", err)
}
return nil
diff --git a/pkg/server/api/console/v1/schema.graphql b/pkg/server/api/console/v1/schema.graphql
index e65428fb5..efdd58559 100644
--- a/pkg/server/api/console/v1/schema.graphql
+++ b/pkg/server/api/console/v1/schema.graphql
@@ -2293,13 +2293,13 @@ type WebhookConfiguration implements Node {
createdAt: Datetime!
updatedAt: Datetime!
- calls(
+ events(
first: Int
after: CursorKey
last: Int
before: CursorKey
- orderBy: WebhookCallOrder
- ): WebhookCallConnection! @goField(forceResolver: true)
+ orderBy: WebhookEventOrder
+ ): WebhookEventConnection! @goField(forceResolver: true)
permission(action: String!): Boolean! @goField(forceResolver: true)
}
@@ -2318,54 +2318,54 @@ type WebhookConfigurationEdge {
node: WebhookConfiguration!
}
-enum WebhookCallStatus
- @goModel(model: "go.probo.inc/probo/pkg/coredata.WebhookCallStatus") {
+enum WebhookEventStatus
+ @goModel(model: "go.probo.inc/probo/pkg/coredata.WebhookEventStatus") {
SUCCEEDED
- @goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookCallStatusSucceeded")
+ @goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventStatusSucceeded")
FAILED
- @goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookCallStatusFailed")
+ @goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventStatusFailed")
}
-enum WebhookCallOrderField
+enum WebhookEventOrderField
@goModel(
- model: "go.probo.inc/probo/pkg/coredata.WebhookCallOrderField"
+ model: "go.probo.inc/probo/pkg/coredata.WebhookEventOrderField"
) {
CREATED_AT
@goEnum(
- value: "go.probo.inc/probo/pkg/coredata.WebhookCallOrderFieldCreatedAt"
+ value: "go.probo.inc/probo/pkg/coredata.WebhookEventOrderFieldCreatedAt"
)
}
-input WebhookCallOrder
+input WebhookEventOrder
@goModel(
- model: "go.probo.inc/probo/pkg/server/api/console/v1/types.WebhookCallOrderBy"
+ model: "go.probo.inc/probo/pkg/server/api/console/v1/types.WebhookEventOrderBy"
) {
- field: WebhookCallOrderField!
+ field: WebhookEventOrderField!
direction: OrderDirection!
}
-type WebhookCall implements Node {
+type WebhookEvent implements Node {
id: ID!
- webhookEventId: ID!
+ webhookDataId: ID!
webhookConfigurationId: ID!
endpointUrl: String!
- status: WebhookCallStatus!
+ status: WebhookEventStatus!
response: String
createdAt: Datetime!
}
-type WebhookCallConnection
+type WebhookEventConnection
@goModel(
- model: "go.probo.inc/probo/pkg/server/api/console/v1/types.WebhookCallConnection"
+ model: "go.probo.inc/probo/pkg/server/api/console/v1/types.WebhookEventConnection"
) {
- edges: [WebhookCallEdge!]!
+ edges: [WebhookEventEdge!]!
pageInfo: PageInfo!
totalCount: Int! @goField(forceResolver: true)
}
-type WebhookCallEdge {
+type WebhookEventEdge {
cursor: CursorKey!
- node: WebhookCall!
+ node: WebhookEvent!
}
type StateOfApplicability implements Node {
diff --git a/pkg/server/api/console/v1/schema/schema.go b/pkg/server/api/console/v1/schema/schema.go
index 7edfc6409..e22e89de6 100644
--- a/pkg/server/api/console/v1/schema/schema.go
+++ b/pkg/server/api/console/v1/schema/schema.go
@@ -119,9 +119,9 @@ type ResolverRoot interface {
VendorRiskAssessment() VendorRiskAssessmentResolver
VendorService() VendorServiceResolver
Viewer() ViewerResolver
- WebhookCallConnection() WebhookCallConnectionResolver
WebhookConfiguration() WebhookConfigurationResolver
WebhookConfigurationConnection() WebhookConfigurationConnectionResolver
+ WebhookEventConnection() WebhookEventConnectionResolver
}
type DirectiveRoot struct {
@@ -1930,31 +1930,10 @@ type ComplexityRoot struct {
SignableDocuments func(childComplexity int, organizationID gid.GID, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentOrderBy) int
}
- WebhookCall struct {
- CreatedAt func(childComplexity int) int
- EndpointURL func(childComplexity int) int
- ID func(childComplexity int) int
- Response func(childComplexity int) int
- Status func(childComplexity int) int
- WebhookConfigurationID func(childComplexity int) int
- WebhookEventID func(childComplexity int) int
- }
-
- WebhookCallConnection struct {
- Edges func(childComplexity int) int
- PageInfo func(childComplexity int) int
- TotalCount func(childComplexity int) int
- }
-
- WebhookCallEdge struct {
- Cursor func(childComplexity int) int
- Node func(childComplexity int) int
- }
-
WebhookConfiguration struct {
- Calls func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.WebhookCallOrderBy) int
CreatedAt func(childComplexity int) int
EndpointURL func(childComplexity int) int
+ Events func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.WebhookEventOrderBy) int
ID func(childComplexity int) int
Organization func(childComplexity int) int
Permission func(childComplexity int, action string) int
@@ -1973,6 +1952,27 @@ type ComplexityRoot struct {
Cursor func(childComplexity int) int
Node func(childComplexity int) int
}
+
+ WebhookEvent struct {
+ CreatedAt func(childComplexity int) int
+ EndpointURL func(childComplexity int) int
+ ID func(childComplexity int) int
+ Response func(childComplexity int) int
+ Status func(childComplexity int) int
+ WebhookConfigurationID func(childComplexity int) int
+ WebhookDataID func(childComplexity int) int
+ }
+
+ WebhookEventConnection struct {
+ Edges func(childComplexity int) int
+ PageInfo func(childComplexity int) int
+ TotalCount func(childComplexity int) int
+ }
+
+ WebhookEventEdge struct {
+ Cursor func(childComplexity int) int
+ Node func(childComplexity int) int
+ }
}
type ApplicabilityStatementResolver interface {
@@ -2528,20 +2528,20 @@ type ViewerResolver interface {
SignableDocuments(ctx context.Context, obj *types.Viewer, organizationID gid.GID, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentOrderBy) (*types.SignableDocumentConnection, error)
SignableDocument(ctx context.Context, obj *types.Viewer, id gid.GID) (*types.SignableDocument, error)
}
-type WebhookCallConnectionResolver interface {
- TotalCount(ctx context.Context, obj *types.WebhookCallConnection) (int, error)
-}
type WebhookConfigurationResolver interface {
Organization(ctx context.Context, obj *types.WebhookConfiguration) (*types.Organization, error)
SigningSecret(ctx context.Context, obj *types.WebhookConfiguration) (string, error)
- Calls(ctx context.Context, obj *types.WebhookConfiguration, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.WebhookCallOrderBy) (*types.WebhookCallConnection, error)
+ Events(ctx context.Context, obj *types.WebhookConfiguration, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.WebhookEventOrderBy) (*types.WebhookEventConnection, error)
Permission(ctx context.Context, obj *types.WebhookConfiguration, action string) (bool, error)
}
type WebhookConfigurationConnectionResolver interface {
TotalCount(ctx context.Context, obj *types.WebhookConfigurationConnection) (int, error)
}
+type WebhookEventConnectionResolver interface {
+ TotalCount(ctx context.Context, obj *types.WebhookEventConnection) (int, error)
+}
type executableSchema struct {
schema *ast.Schema
@@ -10127,92 +10127,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.Viewer.SignableDocuments(childComplexity, args["organizationId"].(gid.GID), args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey), args["orderBy"].(*types.DocumentOrderBy)), true
- case "WebhookCall.createdAt":
- if e.complexity.WebhookCall.CreatedAt == nil {
- break
- }
-
- return e.complexity.WebhookCall.CreatedAt(childComplexity), true
- case "WebhookCall.endpointUrl":
- if e.complexity.WebhookCall.EndpointURL == nil {
- break
- }
-
- return e.complexity.WebhookCall.EndpointURL(childComplexity), true
- case "WebhookCall.id":
- if e.complexity.WebhookCall.ID == nil {
- break
- }
-
- return e.complexity.WebhookCall.ID(childComplexity), true
- case "WebhookCall.response":
- if e.complexity.WebhookCall.Response == nil {
- break
- }
-
- return e.complexity.WebhookCall.Response(childComplexity), true
- case "WebhookCall.status":
- if e.complexity.WebhookCall.Status == nil {
- break
- }
-
- return e.complexity.WebhookCall.Status(childComplexity), true
- case "WebhookCall.webhookConfigurationId":
- if e.complexity.WebhookCall.WebhookConfigurationID == nil {
- break
- }
-
- return e.complexity.WebhookCall.WebhookConfigurationID(childComplexity), true
- case "WebhookCall.webhookEventId":
- if e.complexity.WebhookCall.WebhookEventID == nil {
- break
- }
-
- return e.complexity.WebhookCall.WebhookEventID(childComplexity), true
-
- case "WebhookCallConnection.edges":
- if e.complexity.WebhookCallConnection.Edges == nil {
- break
- }
-
- return e.complexity.WebhookCallConnection.Edges(childComplexity), true
- case "WebhookCallConnection.pageInfo":
- if e.complexity.WebhookCallConnection.PageInfo == nil {
- break
- }
-
- return e.complexity.WebhookCallConnection.PageInfo(childComplexity), true
- case "WebhookCallConnection.totalCount":
- if e.complexity.WebhookCallConnection.TotalCount == nil {
- break
- }
-
- return e.complexity.WebhookCallConnection.TotalCount(childComplexity), true
-
- case "WebhookCallEdge.cursor":
- if e.complexity.WebhookCallEdge.Cursor == nil {
- break
- }
-
- return e.complexity.WebhookCallEdge.Cursor(childComplexity), true
- case "WebhookCallEdge.node":
- if e.complexity.WebhookCallEdge.Node == nil {
- break
- }
-
- return e.complexity.WebhookCallEdge.Node(childComplexity), true
-
- case "WebhookConfiguration.calls":
- if e.complexity.WebhookConfiguration.Calls == nil {
- break
- }
-
- args, err := ec.field_WebhookConfiguration_calls_args(ctx, rawArgs)
- if err != nil {
- return 0, false
- }
-
- return e.complexity.WebhookConfiguration.Calls(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey), args["orderBy"].(*types.WebhookCallOrderBy)), true
case "WebhookConfiguration.createdAt":
if e.complexity.WebhookConfiguration.CreatedAt == nil {
break
@@ -10225,6 +10139,17 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
}
return e.complexity.WebhookConfiguration.EndpointURL(childComplexity), true
+ case "WebhookConfiguration.events":
+ if e.complexity.WebhookConfiguration.Events == nil {
+ break
+ }
+
+ args, err := ec.field_WebhookConfiguration_events_args(ctx, rawArgs)
+ if err != nil {
+ return 0, false
+ }
+
+ return e.complexity.WebhookConfiguration.Events(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey), args["orderBy"].(*types.WebhookEventOrderBy)), true
case "WebhookConfiguration.id":
if e.complexity.WebhookConfiguration.ID == nil {
break
@@ -10299,6 +10224,81 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.WebhookConfigurationEdge.Node(childComplexity), true
+ case "WebhookEvent.createdAt":
+ if e.complexity.WebhookEvent.CreatedAt == nil {
+ break
+ }
+
+ return e.complexity.WebhookEvent.CreatedAt(childComplexity), true
+ case "WebhookEvent.endpointUrl":
+ if e.complexity.WebhookEvent.EndpointURL == nil {
+ break
+ }
+
+ return e.complexity.WebhookEvent.EndpointURL(childComplexity), true
+ case "WebhookEvent.id":
+ if e.complexity.WebhookEvent.ID == nil {
+ break
+ }
+
+ return e.complexity.WebhookEvent.ID(childComplexity), true
+ case "WebhookEvent.response":
+ if e.complexity.WebhookEvent.Response == nil {
+ break
+ }
+
+ return e.complexity.WebhookEvent.Response(childComplexity), true
+ case "WebhookEvent.status":
+ if e.complexity.WebhookEvent.Status == nil {
+ break
+ }
+
+ return e.complexity.WebhookEvent.Status(childComplexity), true
+ case "WebhookEvent.webhookConfigurationId":
+ if e.complexity.WebhookEvent.WebhookConfigurationID == nil {
+ break
+ }
+
+ return e.complexity.WebhookEvent.WebhookConfigurationID(childComplexity), true
+ case "WebhookEvent.webhookDataId":
+ if e.complexity.WebhookEvent.WebhookDataID == nil {
+ break
+ }
+
+ return e.complexity.WebhookEvent.WebhookDataID(childComplexity), true
+
+ case "WebhookEventConnection.edges":
+ if e.complexity.WebhookEventConnection.Edges == nil {
+ break
+ }
+
+ return e.complexity.WebhookEventConnection.Edges(childComplexity), true
+ case "WebhookEventConnection.pageInfo":
+ if e.complexity.WebhookEventConnection.PageInfo == nil {
+ break
+ }
+
+ return e.complexity.WebhookEventConnection.PageInfo(childComplexity), true
+ case "WebhookEventConnection.totalCount":
+ if e.complexity.WebhookEventConnection.TotalCount == nil {
+ break
+ }
+
+ return e.complexity.WebhookEventConnection.TotalCount(childComplexity), true
+
+ case "WebhookEventEdge.cursor":
+ if e.complexity.WebhookEventEdge.Cursor == nil {
+ break
+ }
+
+ return e.complexity.WebhookEventEdge.Cursor(childComplexity), true
+ case "WebhookEventEdge.node":
+ if e.complexity.WebhookEventEdge.Node == nil {
+ break
+ }
+
+ return e.complexity.WebhookEventEdge.Node(childComplexity), true
+
}
return 0, false
}
@@ -10500,8 +10500,8 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
ec.unmarshalInputVendorOrder,
ec.unmarshalInputVendorRiskAssessmentOrder,
ec.unmarshalInputVendorServiceOrder,
- ec.unmarshalInputWebhookCallOrder,
ec.unmarshalInputWebhookConfigurationOrder,
+ ec.unmarshalInputWebhookEventOrder,
)
first := true
@@ -12894,13 +12894,13 @@ type WebhookConfiguration implements Node {
createdAt: Datetime!
updatedAt: Datetime!
- calls(
+ events(
first: Int
after: CursorKey
last: Int
before: CursorKey
- orderBy: WebhookCallOrder
- ): WebhookCallConnection! @goField(forceResolver: true)
+ orderBy: WebhookEventOrder
+ ): WebhookEventConnection! @goField(forceResolver: true)
permission(action: String!): Boolean! @goField(forceResolver: true)
}
@@ -12919,54 +12919,54 @@ type WebhookConfigurationEdge {
node: WebhookConfiguration!
}
-enum WebhookCallStatus
- @goModel(model: "go.probo.inc/probo/pkg/coredata.WebhookCallStatus") {
+enum WebhookEventStatus
+ @goModel(model: "go.probo.inc/probo/pkg/coredata.WebhookEventStatus") {
SUCCEEDED
- @goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookCallStatusSucceeded")
+ @goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventStatusSucceeded")
FAILED
- @goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookCallStatusFailed")
+ @goEnum(value: "go.probo.inc/probo/pkg/coredata.WebhookEventStatusFailed")
}
-enum WebhookCallOrderField
+enum WebhookEventOrderField
@goModel(
- model: "go.probo.inc/probo/pkg/coredata.WebhookCallOrderField"
+ model: "go.probo.inc/probo/pkg/coredata.WebhookEventOrderField"
) {
CREATED_AT
@goEnum(
- value: "go.probo.inc/probo/pkg/coredata.WebhookCallOrderFieldCreatedAt"
+ value: "go.probo.inc/probo/pkg/coredata.WebhookEventOrderFieldCreatedAt"
)
}
-input WebhookCallOrder
+input WebhookEventOrder
@goModel(
- model: "go.probo.inc/probo/pkg/server/api/console/v1/types.WebhookCallOrderBy"
+ model: "go.probo.inc/probo/pkg/server/api/console/v1/types.WebhookEventOrderBy"
) {
- field: WebhookCallOrderField!
+ field: WebhookEventOrderField!
direction: OrderDirection!
}
-type WebhookCall implements Node {
+type WebhookEvent implements Node {
id: ID!
- webhookEventId: ID!
+ webhookDataId: ID!
webhookConfigurationId: ID!
endpointUrl: String!
- status: WebhookCallStatus!
+ status: WebhookEventStatus!
response: String
createdAt: Datetime!
}
-type WebhookCallConnection
+type WebhookEventConnection
@goModel(
- model: "go.probo.inc/probo/pkg/server/api/console/v1/types.WebhookCallConnection"
+ model: "go.probo.inc/probo/pkg/server/api/console/v1/types.WebhookEventConnection"
) {
- edges: [WebhookCallEdge!]!
+ edges: [WebhookEventEdge!]!
pageInfo: PageInfo!
totalCount: Int! @goField(forceResolver: true)
}
-type WebhookCallEdge {
+type WebhookEventEdge {
cursor: CursorKey!
- node: WebhookCall!
+ node: WebhookEvent!
}
type StateOfApplicability implements Node {
@@ -19929,7 +19929,7 @@ func (ec *executionContext) field_Viewer_signableDocuments_args(ctx context.Cont
return args, nil
}
-func (ec *executionContext) field_WebhookConfiguration_calls_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
+func (ec *executionContext) field_WebhookConfiguration_events_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]any{}
arg0, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint)
@@ -19952,7 +19952,7 @@ func (ec *executionContext) field_WebhookConfiguration_calls_args(ctx context.Co
return nil, err
}
args["before"] = arg3
- arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOWebhookCallOrder2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookCallOrderBy)
+ arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOWebhookEventOrder2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEventOrderBy)
if err != nil {
return nil, err
}
@@ -55429,8 +55429,8 @@ func (ec *executionContext) fieldContext_UpdateWebhookConfigurationPayload_webho
return ec.fieldContext_WebhookConfiguration_createdAt(ctx, field)
case "updatedAt":
return ec.fieldContext_WebhookConfiguration_updatedAt(ctx, field)
- case "calls":
- return ec.fieldContext_WebhookConfiguration_calls(ctx, field)
+ case "events":
+ return ec.fieldContext_WebhookConfiguration_events(ctx, field)
case "permission":
return ec.fieldContext_WebhookConfiguration_permission(ctx, field)
}
@@ -59926,386 +59926,6 @@ func (ec *executionContext) fieldContext_Viewer_signableDocument(ctx context.Con
return fc, nil
}
-func (ec *executionContext) _WebhookCall_id(ctx context.Context, field graphql.CollectedField, obj *types.WebhookCall) (ret graphql.Marshaler) {
- return graphql.ResolveField(
- ctx,
- ec.OperationContext,
- field,
- ec.fieldContext_WebhookCall_id,
- func(ctx context.Context) (any, error) {
- return obj.ID, nil
- },
- nil,
- ec.marshalNID2goᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID,
- true,
- true,
- )
-}
-
-func (ec *executionContext) fieldContext_WebhookCall_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebhookCall",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebhookCall_webhookEventId(ctx context.Context, field graphql.CollectedField, obj *types.WebhookCall) (ret graphql.Marshaler) {
- return graphql.ResolveField(
- ctx,
- ec.OperationContext,
- field,
- ec.fieldContext_WebhookCall_webhookEventId,
- func(ctx context.Context) (any, error) {
- return obj.WebhookEventID, nil
- },
- nil,
- ec.marshalNID2goᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID,
- true,
- true,
- )
-}
-
-func (ec *executionContext) fieldContext_WebhookCall_webhookEventId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebhookCall",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebhookCall_webhookConfigurationId(ctx context.Context, field graphql.CollectedField, obj *types.WebhookCall) (ret graphql.Marshaler) {
- return graphql.ResolveField(
- ctx,
- ec.OperationContext,
- field,
- ec.fieldContext_WebhookCall_webhookConfigurationId,
- func(ctx context.Context) (any, error) {
- return obj.WebhookConfigurationID, nil
- },
- nil,
- ec.marshalNID2goᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID,
- true,
- true,
- )
-}
-
-func (ec *executionContext) fieldContext_WebhookCall_webhookConfigurationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebhookCall",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type ID does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebhookCall_endpointUrl(ctx context.Context, field graphql.CollectedField, obj *types.WebhookCall) (ret graphql.Marshaler) {
- return graphql.ResolveField(
- ctx,
- ec.OperationContext,
- field,
- ec.fieldContext_WebhookCall_endpointUrl,
- func(ctx context.Context) (any, error) {
- return obj.EndpointURL, nil
- },
- nil,
- ec.marshalNString2string,
- true,
- true,
- )
-}
-
-func (ec *executionContext) fieldContext_WebhookCall_endpointUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebhookCall",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebhookCall_status(ctx context.Context, field graphql.CollectedField, obj *types.WebhookCall) (ret graphql.Marshaler) {
- return graphql.ResolveField(
- ctx,
- ec.OperationContext,
- field,
- ec.fieldContext_WebhookCall_status,
- func(ctx context.Context) (any, error) {
- return obj.Status, nil
- },
- nil,
- ec.marshalNWebhookCallStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookCallStatus,
- true,
- true,
- )
-}
-
-func (ec *executionContext) fieldContext_WebhookCall_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebhookCall",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type WebhookCallStatus does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebhookCall_response(ctx context.Context, field graphql.CollectedField, obj *types.WebhookCall) (ret graphql.Marshaler) {
- return graphql.ResolveField(
- ctx,
- ec.OperationContext,
- field,
- ec.fieldContext_WebhookCall_response,
- func(ctx context.Context) (any, error) {
- return obj.Response, nil
- },
- nil,
- ec.marshalOString2ᚖstring,
- true,
- false,
- )
-}
-
-func (ec *executionContext) fieldContext_WebhookCall_response(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebhookCall",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type String does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebhookCall_createdAt(ctx context.Context, field graphql.CollectedField, obj *types.WebhookCall) (ret graphql.Marshaler) {
- return graphql.ResolveField(
- ctx,
- ec.OperationContext,
- field,
- ec.fieldContext_WebhookCall_createdAt,
- func(ctx context.Context) (any, error) {
- return obj.CreatedAt, nil
- },
- nil,
- ec.marshalNDatetime2timeᚐTime,
- true,
- true,
- )
-}
-
-func (ec *executionContext) fieldContext_WebhookCall_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebhookCall",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Datetime does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebhookCallConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.WebhookCallConnection) (ret graphql.Marshaler) {
- return graphql.ResolveField(
- ctx,
- ec.OperationContext,
- field,
- ec.fieldContext_WebhookCallConnection_edges,
- func(ctx context.Context) (any, error) {
- return obj.Edges, nil
- },
- nil,
- ec.marshalNWebhookCallEdge2ᚕᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookCallEdgeᚄ,
- true,
- true,
- )
-}
-
-func (ec *executionContext) fieldContext_WebhookCallConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebhookCallConnection",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "cursor":
- return ec.fieldContext_WebhookCallEdge_cursor(ctx, field)
- case "node":
- return ec.fieldContext_WebhookCallEdge_node(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type WebhookCallEdge", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebhookCallConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *types.WebhookCallConnection) (ret graphql.Marshaler) {
- return graphql.ResolveField(
- ctx,
- ec.OperationContext,
- field,
- ec.fieldContext_WebhookCallConnection_pageInfo,
- func(ctx context.Context) (any, error) {
- return obj.PageInfo, nil
- },
- nil,
- ec.marshalNPageInfo2goᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPageInfo,
- true,
- true,
- )
-}
-
-func (ec *executionContext) fieldContext_WebhookCallConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebhookCallConnection",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "hasNextPage":
- return ec.fieldContext_PageInfo_hasNextPage(ctx, field)
- case "hasPreviousPage":
- return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field)
- case "startCursor":
- return ec.fieldContext_PageInfo_startCursor(ctx, field)
- case "endCursor":
- return ec.fieldContext_PageInfo_endCursor(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name)
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebhookCallConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *types.WebhookCallConnection) (ret graphql.Marshaler) {
- return graphql.ResolveField(
- ctx,
- ec.OperationContext,
- field,
- ec.fieldContext_WebhookCallConnection_totalCount,
- func(ctx context.Context) (any, error) {
- return ec.resolvers.WebhookCallConnection().TotalCount(ctx, obj)
- },
- nil,
- ec.marshalNInt2int,
- true,
- true,
- )
-}
-
-func (ec *executionContext) fieldContext_WebhookCallConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebhookCallConnection",
- Field: field,
- IsMethod: true,
- IsResolver: true,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type Int does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebhookCallEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *types.WebhookCallEdge) (ret graphql.Marshaler) {
- return graphql.ResolveField(
- ctx,
- ec.OperationContext,
- field,
- ec.fieldContext_WebhookCallEdge_cursor,
- func(ctx context.Context) (any, error) {
- return obj.Cursor, nil
- },
- nil,
- ec.marshalNCursorKey2goᚗproboᚗincᚋproboᚋpkgᚋpageᚐCursorKey,
- true,
- true,
- )
-}
-
-func (ec *executionContext) fieldContext_WebhookCallEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebhookCallEdge",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- return nil, errors.New("field of type CursorKey does not have child fields")
- },
- }
- return fc, nil
-}
-
-func (ec *executionContext) _WebhookCallEdge_node(ctx context.Context, field graphql.CollectedField, obj *types.WebhookCallEdge) (ret graphql.Marshaler) {
- return graphql.ResolveField(
- ctx,
- ec.OperationContext,
- field,
- ec.fieldContext_WebhookCallEdge_node,
- func(ctx context.Context) (any, error) {
- return obj.Node, nil
- },
- nil,
- ec.marshalNWebhookCall2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookCall,
- true,
- true,
- )
-}
-
-func (ec *executionContext) fieldContext_WebhookCallEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
- fc = &graphql.FieldContext{
- Object: "WebhookCallEdge",
- Field: field,
- IsMethod: false,
- IsResolver: false,
- Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
- switch field.Name {
- case "id":
- return ec.fieldContext_WebhookCall_id(ctx, field)
- case "webhookEventId":
- return ec.fieldContext_WebhookCall_webhookEventId(ctx, field)
- case "webhookConfigurationId":
- return ec.fieldContext_WebhookCall_webhookConfigurationId(ctx, field)
- case "endpointUrl":
- return ec.fieldContext_WebhookCall_endpointUrl(ctx, field)
- case "status":
- return ec.fieldContext_WebhookCall_status(ctx, field)
- case "response":
- return ec.fieldContext_WebhookCall_response(ctx, field)
- case "createdAt":
- return ec.fieldContext_WebhookCall_createdAt(ctx, field)
- }
- return nil, fmt.Errorf("no field named %q was found under type WebhookCall", field.Name)
- },
- }
- return fc, nil
-}
-
func (ec *executionContext) _WebhookConfiguration_id(ctx context.Context, field graphql.CollectedField, obj *types.WebhookConfiguration) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
@@ -60587,24 +60207,24 @@ func (ec *executionContext) fieldContext_WebhookConfiguration_updatedAt(_ contex
return fc, nil
}
-func (ec *executionContext) _WebhookConfiguration_calls(ctx context.Context, field graphql.CollectedField, obj *types.WebhookConfiguration) (ret graphql.Marshaler) {
+func (ec *executionContext) _WebhookConfiguration_events(ctx context.Context, field graphql.CollectedField, obj *types.WebhookConfiguration) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
ec.OperationContext,
field,
- ec.fieldContext_WebhookConfiguration_calls,
+ ec.fieldContext_WebhookConfiguration_events,
func(ctx context.Context) (any, error) {
fc := graphql.GetFieldContext(ctx)
- return ec.resolvers.WebhookConfiguration().Calls(ctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey), fc.Args["orderBy"].(*types.WebhookCallOrderBy))
+ return ec.resolvers.WebhookConfiguration().Events(ctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey), fc.Args["orderBy"].(*types.WebhookEventOrderBy))
},
nil,
- ec.marshalNWebhookCallConnection2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookCallConnection,
+ ec.marshalNWebhookEventConnection2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEventConnection,
true,
true,
)
}
-func (ec *executionContext) fieldContext_WebhookConfiguration_calls(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+func (ec *executionContext) fieldContext_WebhookConfiguration_events(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "WebhookConfiguration",
Field: field,
@@ -60613,13 +60233,13 @@ func (ec *executionContext) fieldContext_WebhookConfiguration_calls(ctx context.
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "edges":
- return ec.fieldContext_WebhookCallConnection_edges(ctx, field)
+ return ec.fieldContext_WebhookEventConnection_edges(ctx, field)
case "pageInfo":
- return ec.fieldContext_WebhookCallConnection_pageInfo(ctx, field)
+ return ec.fieldContext_WebhookEventConnection_pageInfo(ctx, field)
case "totalCount":
- return ec.fieldContext_WebhookCallConnection_totalCount(ctx, field)
+ return ec.fieldContext_WebhookEventConnection_totalCount(ctx, field)
}
- return nil, fmt.Errorf("no field named %q was found under type WebhookCallConnection", field.Name)
+ return nil, fmt.Errorf("no field named %q was found under type WebhookEventConnection", field.Name)
},
}
defer func() {
@@ -60629,7 +60249,7 @@ func (ec *executionContext) fieldContext_WebhookConfiguration_calls(ctx context.
}
}()
ctx = graphql.WithFieldContext(ctx, fc)
- if fc.Args, err = ec.field_WebhookConfiguration_calls_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
+ if fc.Args, err = ec.field_WebhookConfiguration_events_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
ec.Error(ctx, err)
return fc, err
}
@@ -60847,8 +60467,8 @@ func (ec *executionContext) fieldContext_WebhookConfigurationEdge_node(_ context
return ec.fieldContext_WebhookConfiguration_createdAt(ctx, field)
case "updatedAt":
return ec.fieldContext_WebhookConfiguration_updatedAt(ctx, field)
- case "calls":
- return ec.fieldContext_WebhookConfiguration_calls(ctx, field)
+ case "events":
+ return ec.fieldContext_WebhookConfiguration_events(ctx, field)
case "permission":
return ec.fieldContext_WebhookConfiguration_permission(ctx, field)
}
@@ -60858,6 +60478,386 @@ func (ec *executionContext) fieldContext_WebhookConfigurationEdge_node(_ context
return fc, nil
}
+func (ec *executionContext) _WebhookEvent_id(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) {
+ return graphql.ResolveField(
+ ctx,
+ ec.OperationContext,
+ field,
+ ec.fieldContext_WebhookEvent_id,
+ func(ctx context.Context) (any, error) {
+ return obj.ID, nil
+ },
+ nil,
+ ec.marshalNID2goᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID,
+ true,
+ true,
+ )
+}
+
+func (ec *executionContext) fieldContext_WebhookEvent_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "WebhookEvent",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type ID does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _WebhookEvent_webhookDataId(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) {
+ return graphql.ResolveField(
+ ctx,
+ ec.OperationContext,
+ field,
+ ec.fieldContext_WebhookEvent_webhookDataId,
+ func(ctx context.Context) (any, error) {
+ return obj.WebhookDataID, nil
+ },
+ nil,
+ ec.marshalNID2goᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID,
+ true,
+ true,
+ )
+}
+
+func (ec *executionContext) fieldContext_WebhookEvent_webhookDataId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "WebhookEvent",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type ID does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _WebhookEvent_webhookConfigurationId(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) {
+ return graphql.ResolveField(
+ ctx,
+ ec.OperationContext,
+ field,
+ ec.fieldContext_WebhookEvent_webhookConfigurationId,
+ func(ctx context.Context) (any, error) {
+ return obj.WebhookConfigurationID, nil
+ },
+ nil,
+ ec.marshalNID2goᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID,
+ true,
+ true,
+ )
+}
+
+func (ec *executionContext) fieldContext_WebhookEvent_webhookConfigurationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "WebhookEvent",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type ID does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _WebhookEvent_endpointUrl(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) {
+ return graphql.ResolveField(
+ ctx,
+ ec.OperationContext,
+ field,
+ ec.fieldContext_WebhookEvent_endpointUrl,
+ func(ctx context.Context) (any, error) {
+ return obj.EndpointURL, nil
+ },
+ nil,
+ ec.marshalNString2string,
+ true,
+ true,
+ )
+}
+
+func (ec *executionContext) fieldContext_WebhookEvent_endpointUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "WebhookEvent",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type String does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _WebhookEvent_status(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) {
+ return graphql.ResolveField(
+ ctx,
+ ec.OperationContext,
+ field,
+ ec.fieldContext_WebhookEvent_status,
+ func(ctx context.Context) (any, error) {
+ return obj.Status, nil
+ },
+ nil,
+ ec.marshalNWebhookEventStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventStatus,
+ true,
+ true,
+ )
+}
+
+func (ec *executionContext) fieldContext_WebhookEvent_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "WebhookEvent",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type WebhookEventStatus does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _WebhookEvent_response(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) {
+ return graphql.ResolveField(
+ ctx,
+ ec.OperationContext,
+ field,
+ ec.fieldContext_WebhookEvent_response,
+ func(ctx context.Context) (any, error) {
+ return obj.Response, nil
+ },
+ nil,
+ ec.marshalOString2ᚖstring,
+ true,
+ false,
+ )
+}
+
+func (ec *executionContext) fieldContext_WebhookEvent_response(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "WebhookEvent",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type String does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _WebhookEvent_createdAt(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEvent) (ret graphql.Marshaler) {
+ return graphql.ResolveField(
+ ctx,
+ ec.OperationContext,
+ field,
+ ec.fieldContext_WebhookEvent_createdAt,
+ func(ctx context.Context) (any, error) {
+ return obj.CreatedAt, nil
+ },
+ nil,
+ ec.marshalNDatetime2timeᚐTime,
+ true,
+ true,
+ )
+}
+
+func (ec *executionContext) fieldContext_WebhookEvent_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "WebhookEvent",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type Datetime does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _WebhookEventConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEventConnection) (ret graphql.Marshaler) {
+ return graphql.ResolveField(
+ ctx,
+ ec.OperationContext,
+ field,
+ ec.fieldContext_WebhookEventConnection_edges,
+ func(ctx context.Context) (any, error) {
+ return obj.Edges, nil
+ },
+ nil,
+ ec.marshalNWebhookEventEdge2ᚕᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEventEdgeᚄ,
+ true,
+ true,
+ )
+}
+
+func (ec *executionContext) fieldContext_WebhookEventConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "WebhookEventConnection",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "cursor":
+ return ec.fieldContext_WebhookEventEdge_cursor(ctx, field)
+ case "node":
+ return ec.fieldContext_WebhookEventEdge_node(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type WebhookEventEdge", field.Name)
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _WebhookEventConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEventConnection) (ret graphql.Marshaler) {
+ return graphql.ResolveField(
+ ctx,
+ ec.OperationContext,
+ field,
+ ec.fieldContext_WebhookEventConnection_pageInfo,
+ func(ctx context.Context) (any, error) {
+ return obj.PageInfo, nil
+ },
+ nil,
+ ec.marshalNPageInfo2goᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPageInfo,
+ true,
+ true,
+ )
+}
+
+func (ec *executionContext) fieldContext_WebhookEventConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "WebhookEventConnection",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "hasNextPage":
+ return ec.fieldContext_PageInfo_hasNextPage(ctx, field)
+ case "hasPreviousPage":
+ return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field)
+ case "startCursor":
+ return ec.fieldContext_PageInfo_startCursor(ctx, field)
+ case "endCursor":
+ return ec.fieldContext_PageInfo_endCursor(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name)
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _WebhookEventConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEventConnection) (ret graphql.Marshaler) {
+ return graphql.ResolveField(
+ ctx,
+ ec.OperationContext,
+ field,
+ ec.fieldContext_WebhookEventConnection_totalCount,
+ func(ctx context.Context) (any, error) {
+ return ec.resolvers.WebhookEventConnection().TotalCount(ctx, obj)
+ },
+ nil,
+ ec.marshalNInt2int,
+ true,
+ true,
+ )
+}
+
+func (ec *executionContext) fieldContext_WebhookEventConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "WebhookEventConnection",
+ Field: field,
+ IsMethod: true,
+ IsResolver: true,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type Int does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _WebhookEventEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEventEdge) (ret graphql.Marshaler) {
+ return graphql.ResolveField(
+ ctx,
+ ec.OperationContext,
+ field,
+ ec.fieldContext_WebhookEventEdge_cursor,
+ func(ctx context.Context) (any, error) {
+ return obj.Cursor, nil
+ },
+ nil,
+ ec.marshalNCursorKey2goᚗproboᚗincᚋproboᚋpkgᚋpageᚐCursorKey,
+ true,
+ true,
+ )
+}
+
+func (ec *executionContext) fieldContext_WebhookEventEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "WebhookEventEdge",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type CursorKey does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _WebhookEventEdge_node(ctx context.Context, field graphql.CollectedField, obj *types.WebhookEventEdge) (ret graphql.Marshaler) {
+ return graphql.ResolveField(
+ ctx,
+ ec.OperationContext,
+ field,
+ ec.fieldContext_WebhookEventEdge_node,
+ func(ctx context.Context) (any, error) {
+ return obj.Node, nil
+ },
+ nil,
+ ec.marshalNWebhookEvent2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEvent,
+ true,
+ true,
+ )
+}
+
+func (ec *executionContext) fieldContext_WebhookEventEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "WebhookEventEdge",
+ Field: field,
+ IsMethod: false,
+ IsResolver: false,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ switch field.Name {
+ case "id":
+ return ec.fieldContext_WebhookEvent_id(ctx, field)
+ case "webhookDataId":
+ return ec.fieldContext_WebhookEvent_webhookDataId(ctx, field)
+ case "webhookConfigurationId":
+ return ec.fieldContext_WebhookEvent_webhookConfigurationId(ctx, field)
+ case "endpointUrl":
+ return ec.fieldContext_WebhookEvent_endpointUrl(ctx, field)
+ case "status":
+ return ec.fieldContext_WebhookEvent_status(ctx, field)
+ case "response":
+ return ec.fieldContext_WebhookEvent_response(ctx, field)
+ case "createdAt":
+ return ec.fieldContext_WebhookEvent_createdAt(ctx, field)
+ }
+ return nil, fmt.Errorf("no field named %q was found under type WebhookEvent", field.Name)
+ },
+ }
+ return fc, nil
+}
+
func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
@@ -70525,40 +70525,6 @@ func (ec *executionContext) unmarshalInputVendorServiceOrder(ctx context.Context
return it, nil
}
-func (ec *executionContext) unmarshalInputWebhookCallOrder(ctx context.Context, obj any) (types.WebhookCallOrderBy, error) {
- var it types.WebhookCallOrderBy
- asMap := map[string]any{}
- for k, v := range obj.(map[string]any) {
- asMap[k] = v
- }
-
- fieldsInOrder := [...]string{"field", "direction"}
- for _, k := range fieldsInOrder {
- v, ok := asMap[k]
- if !ok {
- continue
- }
- switch k {
- case "field":
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field"))
- data, err := ec.unmarshalNWebhookCallOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookCallOrderField(ctx, v)
- if err != nil {
- return it, err
- }
- it.Field = data
- case "direction":
- ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction"))
- data, err := ec.unmarshalNOrderDirection2goᚗproboᚗincᚋproboᚋpkgᚋpageᚐOrderDirection(ctx, v)
- if err != nil {
- return it, err
- }
- it.Direction = data
- }
- }
-
- return it, nil
-}
-
func (ec *executionContext) unmarshalInputWebhookConfigurationOrder(ctx context.Context, obj any) (types.WebhookConfigurationOrderBy, error) {
var it types.WebhookConfigurationOrderBy
asMap := map[string]any{}
@@ -70593,6 +70559,40 @@ func (ec *executionContext) unmarshalInputWebhookConfigurationOrder(ctx context.
return it, nil
}
+func (ec *executionContext) unmarshalInputWebhookEventOrder(ctx context.Context, obj any) (types.WebhookEventOrderBy, error) {
+ var it types.WebhookEventOrderBy
+ asMap := map[string]any{}
+ for k, v := range obj.(map[string]any) {
+ asMap[k] = v
+ }
+
+ fieldsInOrder := [...]string{"field", "direction"}
+ for _, k := range fieldsInOrder {
+ v, ok := asMap[k]
+ if !ok {
+ continue
+ }
+ switch k {
+ case "field":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field"))
+ data, err := ec.unmarshalNWebhookEventOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventOrderField(ctx, v)
+ if err != nil {
+ return it, err
+ }
+ it.Field = data
+ case "direction":
+ ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction"))
+ data, err := ec.unmarshalNOrderDirection2goᚗproboᚗincᚋproboᚋpkgᚋpageᚐOrderDirection(ctx, v)
+ if err != nil {
+ return it, err
+ }
+ it.Direction = data
+ }
+ }
+
+ return it, nil
+}
+
// endregion **************************** input.gotpl *****************************
// region ************************** interface.gotpl ***************************
@@ -70601,6 +70601,13 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj
switch obj := (obj).(type) {
case nil:
return graphql.Null
+ case types.WebhookEvent:
+ return ec._WebhookEvent(ctx, sel, &obj)
+ case *types.WebhookEvent:
+ if obj == nil {
+ return graphql.Null
+ }
+ return ec._WebhookEvent(ctx, sel, obj)
case types.WebhookConfiguration:
return ec._WebhookConfiguration(ctx, sel, &obj)
case *types.WebhookConfiguration:
@@ -70608,13 +70615,6 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj
return graphql.Null
}
return ec._WebhookConfiguration(ctx, sel, obj)
- case types.WebhookCall:
- return ec._WebhookCall(ctx, sel, &obj)
- case *types.WebhookCall:
- if obj == nil {
- return graphql.Null
- }
- return ec._WebhookCall(ctx, sel, obj)
case types.VendorService:
return ec._VendorService(ctx, sel, &obj)
case *types.VendorService:
@@ -91362,196 +91362,6 @@ func (ec *executionContext) _Viewer(ctx context.Context, sel ast.SelectionSet, o
return out
}
-var webhookCallImplementors = []string{"WebhookCall", "Node"}
-
-func (ec *executionContext) _WebhookCall(ctx context.Context, sel ast.SelectionSet, obj *types.WebhookCall) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, webhookCallImplementors)
-
- out := graphql.NewFieldSet(fields)
- deferred := make(map[string]*graphql.FieldSet)
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("WebhookCall")
- case "id":
- out.Values[i] = ec._WebhookCall_id(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- out.Invalids++
- }
- case "webhookEventId":
- out.Values[i] = ec._WebhookCall_webhookEventId(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- out.Invalids++
- }
- case "webhookConfigurationId":
- out.Values[i] = ec._WebhookCall_webhookConfigurationId(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- out.Invalids++
- }
- case "endpointUrl":
- out.Values[i] = ec._WebhookCall_endpointUrl(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- out.Invalids++
- }
- case "status":
- out.Values[i] = ec._WebhookCall_status(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- out.Invalids++
- }
- case "response":
- out.Values[i] = ec._WebhookCall_response(ctx, field, obj)
- case "createdAt":
- out.Values[i] = ec._WebhookCall_createdAt(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- out.Invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch(ctx)
- if out.Invalids > 0 {
- return graphql.Null
- }
-
- atomic.AddInt32(&ec.deferred, int32(len(deferred)))
-
- for label, dfs := range deferred {
- ec.processDeferredGroup(graphql.DeferredGroup{
- Label: label,
- Path: graphql.GetPath(ctx),
- FieldSet: dfs,
- Context: ctx,
- })
- }
-
- return out
-}
-
-var webhookCallConnectionImplementors = []string{"WebhookCallConnection"}
-
-func (ec *executionContext) _WebhookCallConnection(ctx context.Context, sel ast.SelectionSet, obj *types.WebhookCallConnection) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, webhookCallConnectionImplementors)
-
- out := graphql.NewFieldSet(fields)
- deferred := make(map[string]*graphql.FieldSet)
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("WebhookCallConnection")
- case "edges":
- out.Values[i] = ec._WebhookCallConnection_edges(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&out.Invalids, 1)
- }
- case "pageInfo":
- out.Values[i] = ec._WebhookCallConnection_pageInfo(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- atomic.AddUint32(&out.Invalids, 1)
- }
- case "totalCount":
- field := field
-
- innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._WebhookCallConnection_totalCount(ctx, field, obj)
- if res == graphql.Null {
- atomic.AddUint32(&fs.Invalids, 1)
- }
- return res
- }
-
- if field.Deferrable != nil {
- dfs, ok := deferred[field.Deferrable.Label]
- di := 0
- if ok {
- dfs.AddField(field)
- di = len(dfs.Values) - 1
- } else {
- dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
- deferred[field.Deferrable.Label] = dfs
- }
- dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
- return innerFunc(ctx, dfs)
- })
-
- // don't run the out.Concurrently() call below
- out.Values[i] = graphql.Null
- continue
- }
-
- out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch(ctx)
- if out.Invalids > 0 {
- return graphql.Null
- }
-
- atomic.AddInt32(&ec.deferred, int32(len(deferred)))
-
- for label, dfs := range deferred {
- ec.processDeferredGroup(graphql.DeferredGroup{
- Label: label,
- Path: graphql.GetPath(ctx),
- FieldSet: dfs,
- Context: ctx,
- })
- }
-
- return out
-}
-
-var webhookCallEdgeImplementors = []string{"WebhookCallEdge"}
-
-func (ec *executionContext) _WebhookCallEdge(ctx context.Context, sel ast.SelectionSet, obj *types.WebhookCallEdge) graphql.Marshaler {
- fields := graphql.CollectFields(ec.OperationContext, sel, webhookCallEdgeImplementors)
-
- out := graphql.NewFieldSet(fields)
- deferred := make(map[string]*graphql.FieldSet)
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString("WebhookCallEdge")
- case "cursor":
- out.Values[i] = ec._WebhookCallEdge_cursor(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- out.Invalids++
- }
- case "node":
- out.Values[i] = ec._WebhookCallEdge_node(ctx, field, obj)
- if out.Values[i] == graphql.Null {
- out.Invalids++
- }
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch(ctx)
- if out.Invalids > 0 {
- return graphql.Null
- }
-
- atomic.AddInt32(&ec.deferred, int32(len(deferred)))
-
- for label, dfs := range deferred {
- ec.processDeferredGroup(graphql.DeferredGroup{
- Label: label,
- Path: graphql.GetPath(ctx),
- FieldSet: dfs,
- Context: ctx,
- })
- }
-
- return out
-}
-
var webhookConfigurationImplementors = []string{"WebhookConfiguration", "Node"}
func (ec *executionContext) _WebhookConfiguration(ctx context.Context, sel ast.SelectionSet, obj *types.WebhookConfiguration) graphql.Marshaler {
@@ -91657,7 +91467,7 @@ func (ec *executionContext) _WebhookConfiguration(ctx context.Context, sel ast.S
if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1)
}
- case "calls":
+ case "events":
field := field
innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
@@ -91666,7 +91476,7 @@ func (ec *executionContext) _WebhookConfiguration(ctx context.Context, sel ast.S
ec.Error(ctx, ec.Recover(ctx, r))
}
}()
- res = ec._WebhookConfiguration_calls(ctx, field, obj)
+ res = ec._WebhookConfiguration_events(ctx, field, obj)
if res == graphql.Null {
atomic.AddUint32(&fs.Invalids, 1)
}
@@ -91876,6 +91686,196 @@ func (ec *executionContext) _WebhookConfigurationEdge(ctx context.Context, sel a
return out
}
+var webhookEventImplementors = []string{"WebhookEvent", "Node"}
+
+func (ec *executionContext) _WebhookEvent(ctx context.Context, sel ast.SelectionSet, obj *types.WebhookEvent) graphql.Marshaler {
+ fields := graphql.CollectFields(ec.OperationContext, sel, webhookEventImplementors)
+
+ out := graphql.NewFieldSet(fields)
+ deferred := make(map[string]*graphql.FieldSet)
+ for i, field := range fields {
+ switch field.Name {
+ case "__typename":
+ out.Values[i] = graphql.MarshalString("WebhookEvent")
+ case "id":
+ out.Values[i] = ec._WebhookEvent_id(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ case "webhookDataId":
+ out.Values[i] = ec._WebhookEvent_webhookDataId(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ case "webhookConfigurationId":
+ out.Values[i] = ec._WebhookEvent_webhookConfigurationId(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ case "endpointUrl":
+ out.Values[i] = ec._WebhookEvent_endpointUrl(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ case "status":
+ out.Values[i] = ec._WebhookEvent_status(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ case "response":
+ out.Values[i] = ec._WebhookEvent_response(ctx, field, obj)
+ case "createdAt":
+ out.Values[i] = ec._WebhookEvent_createdAt(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ default:
+ panic("unknown field " + strconv.Quote(field.Name))
+ }
+ }
+ out.Dispatch(ctx)
+ if out.Invalids > 0 {
+ return graphql.Null
+ }
+
+ atomic.AddInt32(&ec.deferred, int32(len(deferred)))
+
+ for label, dfs := range deferred {
+ ec.processDeferredGroup(graphql.DeferredGroup{
+ Label: label,
+ Path: graphql.GetPath(ctx),
+ FieldSet: dfs,
+ Context: ctx,
+ })
+ }
+
+ return out
+}
+
+var webhookEventConnectionImplementors = []string{"WebhookEventConnection"}
+
+func (ec *executionContext) _WebhookEventConnection(ctx context.Context, sel ast.SelectionSet, obj *types.WebhookEventConnection) graphql.Marshaler {
+ fields := graphql.CollectFields(ec.OperationContext, sel, webhookEventConnectionImplementors)
+
+ out := graphql.NewFieldSet(fields)
+ deferred := make(map[string]*graphql.FieldSet)
+ for i, field := range fields {
+ switch field.Name {
+ case "__typename":
+ out.Values[i] = graphql.MarshalString("WebhookEventConnection")
+ case "edges":
+ out.Values[i] = ec._WebhookEventConnection_edges(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&out.Invalids, 1)
+ }
+ case "pageInfo":
+ out.Values[i] = ec._WebhookEventConnection_pageInfo(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&out.Invalids, 1)
+ }
+ case "totalCount":
+ field := field
+
+ innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._WebhookEventConnection_totalCount(ctx, field, obj)
+ if res == graphql.Null {
+ atomic.AddUint32(&fs.Invalids, 1)
+ }
+ return res
+ }
+
+ if field.Deferrable != nil {
+ dfs, ok := deferred[field.Deferrable.Label]
+ di := 0
+ if ok {
+ dfs.AddField(field)
+ di = len(dfs.Values) - 1
+ } else {
+ dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
+ deferred[field.Deferrable.Label] = dfs
+ }
+ dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
+ return innerFunc(ctx, dfs)
+ })
+
+ // don't run the out.Concurrently() call below
+ out.Values[i] = graphql.Null
+ continue
+ }
+
+ out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
+ default:
+ panic("unknown field " + strconv.Quote(field.Name))
+ }
+ }
+ out.Dispatch(ctx)
+ if out.Invalids > 0 {
+ return graphql.Null
+ }
+
+ atomic.AddInt32(&ec.deferred, int32(len(deferred)))
+
+ for label, dfs := range deferred {
+ ec.processDeferredGroup(graphql.DeferredGroup{
+ Label: label,
+ Path: graphql.GetPath(ctx),
+ FieldSet: dfs,
+ Context: ctx,
+ })
+ }
+
+ return out
+}
+
+var webhookEventEdgeImplementors = []string{"WebhookEventEdge"}
+
+func (ec *executionContext) _WebhookEventEdge(ctx context.Context, sel ast.SelectionSet, obj *types.WebhookEventEdge) graphql.Marshaler {
+ fields := graphql.CollectFields(ec.OperationContext, sel, webhookEventEdgeImplementors)
+
+ out := graphql.NewFieldSet(fields)
+ deferred := make(map[string]*graphql.FieldSet)
+ for i, field := range fields {
+ switch field.Name {
+ case "__typename":
+ out.Values[i] = graphql.MarshalString("WebhookEventEdge")
+ case "cursor":
+ out.Values[i] = ec._WebhookEventEdge_cursor(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ case "node":
+ out.Values[i] = ec._WebhookEventEdge_node(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ out.Invalids++
+ }
+ default:
+ panic("unknown field " + strconv.Quote(field.Name))
+ }
+ }
+ out.Dispatch(ctx)
+ if out.Invalids > 0 {
+ return graphql.Null
+ }
+
+ atomic.AddInt32(&ec.deferred, int32(len(deferred)))
+
+ for label, dfs := range deferred {
+ ec.processDeferredGroup(graphql.DeferredGroup{
+ Label: label,
+ Path: graphql.GetPath(ctx),
+ FieldSet: dfs,
+ Context: ctx,
+ })
+ }
+
+ return out
+}
+
var __DirectiveImplementors = []string{"__Directive"}
func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler {
@@ -100782,138 +100782,6 @@ func (ec *executionContext) marshalNViewer2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋs
return ec._Viewer(ctx, sel, v)
}
-func (ec *executionContext) marshalNWebhookCall2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookCall(ctx context.Context, sel ast.SelectionSet, v *types.WebhookCall) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._WebhookCall(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNWebhookCallConnection2goᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookCallConnection(ctx context.Context, sel ast.SelectionSet, v types.WebhookCallConnection) graphql.Marshaler {
- return ec._WebhookCallConnection(ctx, sel, &v)
-}
-
-func (ec *executionContext) marshalNWebhookCallConnection2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookCallConnection(ctx context.Context, sel ast.SelectionSet, v *types.WebhookCallConnection) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._WebhookCallConnection(ctx, sel, v)
-}
-
-func (ec *executionContext) marshalNWebhookCallEdge2ᚕᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookCallEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*types.WebhookCallEdge) graphql.Marshaler {
- ret := make(graphql.Array, len(v))
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- for i := range v {
- i := i
- fc := &graphql.FieldContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithFieldContext(ctx, fc)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.marshalNWebhookCallEdge2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookCallEdge(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
-
- }
- wg.Wait()
-
- for _, e := range ret {
- if e == graphql.Null {
- return graphql.Null
- }
- }
-
- return ret
-}
-
-func (ec *executionContext) marshalNWebhookCallEdge2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookCallEdge(ctx context.Context, sel ast.SelectionSet, v *types.WebhookCallEdge) graphql.Marshaler {
- if v == nil {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow")
- }
- return graphql.Null
- }
- return ec._WebhookCallEdge(ctx, sel, v)
-}
-
-func (ec *executionContext) unmarshalNWebhookCallOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookCallOrderField(ctx context.Context, v any) (coredata.WebhookCallOrderField, error) {
- tmp, err := graphql.UnmarshalString(v)
- res := unmarshalNWebhookCallOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookCallOrderField[tmp]
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNWebhookCallOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookCallOrderField(ctx context.Context, sel ast.SelectionSet, v coredata.WebhookCallOrderField) graphql.Marshaler {
- _ = sel
- res := graphql.MarshalString(marshalNWebhookCallOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookCallOrderField[v])
- if res == graphql.Null {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow")
- }
- }
- return res
-}
-
-var (
- unmarshalNWebhookCallOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookCallOrderField = map[string]coredata.WebhookCallOrderField{
- "CREATED_AT": coredata.WebhookCallOrderFieldCreatedAt,
- }
- marshalNWebhookCallOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookCallOrderField = map[coredata.WebhookCallOrderField]string{
- coredata.WebhookCallOrderFieldCreatedAt: "CREATED_AT",
- }
-)
-
-func (ec *executionContext) unmarshalNWebhookCallStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookCallStatus(ctx context.Context, v any) (coredata.WebhookCallStatus, error) {
- tmp, err := graphql.UnmarshalString(v)
- res := unmarshalNWebhookCallStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookCallStatus[tmp]
- return res, graphql.ErrorOnPath(ctx, err)
-}
-
-func (ec *executionContext) marshalNWebhookCallStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookCallStatus(ctx context.Context, sel ast.SelectionSet, v coredata.WebhookCallStatus) graphql.Marshaler {
- _ = sel
- res := graphql.MarshalString(marshalNWebhookCallStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookCallStatus[v])
- if res == graphql.Null {
- if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
- graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow")
- }
- }
- return res
-}
-
-var (
- unmarshalNWebhookCallStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookCallStatus = map[string]coredata.WebhookCallStatus{
- "SUCCEEDED": coredata.WebhookCallStatusSucceeded,
- "FAILED": coredata.WebhookCallStatusFailed,
- }
- marshalNWebhookCallStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookCallStatus = map[coredata.WebhookCallStatus]string{
- coredata.WebhookCallStatusSucceeded: "SUCCEEDED",
- coredata.WebhookCallStatusFailed: "FAILED",
- }
-)
-
func (ec *executionContext) marshalNWebhookConfiguration2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookConfiguration(ctx context.Context, sel ast.SelectionSet, v *types.WebhookConfiguration) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
@@ -101018,6 +100886,138 @@ var (
}
)
+func (ec *executionContext) marshalNWebhookEvent2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEvent(ctx context.Context, sel ast.SelectionSet, v *types.WebhookEvent) graphql.Marshaler {
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ return graphql.Null
+ }
+ return ec._WebhookEvent(ctx, sel, v)
+}
+
+func (ec *executionContext) marshalNWebhookEventConnection2goᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEventConnection(ctx context.Context, sel ast.SelectionSet, v types.WebhookEventConnection) graphql.Marshaler {
+ return ec._WebhookEventConnection(ctx, sel, &v)
+}
+
+func (ec *executionContext) marshalNWebhookEventConnection2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEventConnection(ctx context.Context, sel ast.SelectionSet, v *types.WebhookEventConnection) graphql.Marshaler {
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ return graphql.Null
+ }
+ return ec._WebhookEventConnection(ctx, sel, v)
+}
+
+func (ec *executionContext) marshalNWebhookEventEdge2ᚕᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEventEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*types.WebhookEventEdge) graphql.Marshaler {
+ ret := make(graphql.Array, len(v))
+ var wg sync.WaitGroup
+ isLen1 := len(v) == 1
+ if !isLen1 {
+ wg.Add(len(v))
+ }
+ for i := range v {
+ i := i
+ fc := &graphql.FieldContext{
+ Index: &i,
+ Result: &v[i],
+ }
+ ctx := graphql.WithFieldContext(ctx, fc)
+ f := func(i int) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ ret = nil
+ }
+ }()
+ if !isLen1 {
+ defer wg.Done()
+ }
+ ret[i] = ec.marshalNWebhookEventEdge2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEventEdge(ctx, sel, v[i])
+ }
+ if isLen1 {
+ f(i)
+ } else {
+ go f(i)
+ }
+
+ }
+ wg.Wait()
+
+ for _, e := range ret {
+ if e == graphql.Null {
+ return graphql.Null
+ }
+ }
+
+ return ret
+}
+
+func (ec *executionContext) marshalNWebhookEventEdge2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEventEdge(ctx context.Context, sel ast.SelectionSet, v *types.WebhookEventEdge) graphql.Marshaler {
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ return graphql.Null
+ }
+ return ec._WebhookEventEdge(ctx, sel, v)
+}
+
+func (ec *executionContext) unmarshalNWebhookEventOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventOrderField(ctx context.Context, v any) (coredata.WebhookEventOrderField, error) {
+ tmp, err := graphql.UnmarshalString(v)
+ res := unmarshalNWebhookEventOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventOrderField[tmp]
+ return res, graphql.ErrorOnPath(ctx, err)
+}
+
+func (ec *executionContext) marshalNWebhookEventOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventOrderField(ctx context.Context, sel ast.SelectionSet, v coredata.WebhookEventOrderField) graphql.Marshaler {
+ _ = sel
+ res := graphql.MarshalString(marshalNWebhookEventOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventOrderField[v])
+ if res == graphql.Null {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ }
+ return res
+}
+
+var (
+ unmarshalNWebhookEventOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventOrderField = map[string]coredata.WebhookEventOrderField{
+ "CREATED_AT": coredata.WebhookEventOrderFieldCreatedAt,
+ }
+ marshalNWebhookEventOrderField2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventOrderField = map[coredata.WebhookEventOrderField]string{
+ coredata.WebhookEventOrderFieldCreatedAt: "CREATED_AT",
+ }
+)
+
+func (ec *executionContext) unmarshalNWebhookEventStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventStatus(ctx context.Context, v any) (coredata.WebhookEventStatus, error) {
+ tmp, err := graphql.UnmarshalString(v)
+ res := unmarshalNWebhookEventStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventStatus[tmp]
+ return res, graphql.ErrorOnPath(ctx, err)
+}
+
+func (ec *executionContext) marshalNWebhookEventStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventStatus(ctx context.Context, sel ast.SelectionSet, v coredata.WebhookEventStatus) graphql.Marshaler {
+ _ = sel
+ res := graphql.MarshalString(marshalNWebhookEventStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventStatus[v])
+ if res == graphql.Null {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow")
+ }
+ }
+ return res
+}
+
+var (
+ unmarshalNWebhookEventStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventStatus = map[string]coredata.WebhookEventStatus{
+ "SUCCEEDED": coredata.WebhookEventStatusSucceeded,
+ "FAILED": coredata.WebhookEventStatusFailed,
+ }
+ marshalNWebhookEventStatus2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventStatus = map[coredata.WebhookEventStatus]string{
+ coredata.WebhookEventStatusSucceeded: "SUCCEEDED",
+ coredata.WebhookEventStatusFailed: "FAILED",
+ }
+)
+
func (ec *executionContext) unmarshalNWebhookEventType2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventType(ctx context.Context, v any) (coredata.WebhookEventType, error) {
tmp, err := graphql.UnmarshalString(v)
res := unmarshalNWebhookEventType2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventType[tmp]
@@ -103189,14 +103189,6 @@ func (ec *executionContext) unmarshalOVendorServiceOrder2ᚖgoᚗproboᚗincᚋp
return &res, graphql.ErrorOnPath(ctx, err)
}
-func (ec *executionContext) unmarshalOWebhookCallOrder2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookCallOrderBy(ctx context.Context, v any) (*types.WebhookCallOrderBy, error) {
- if v == nil {
- return nil, nil
- }
- res, err := ec.unmarshalInputWebhookCallOrder(ctx, v)
- return &res, graphql.ErrorOnPath(ctx, err)
-}
-
func (ec *executionContext) unmarshalOWebhookConfigurationOrder2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookConfigurationOrderBy(ctx context.Context, v any) (*types.WebhookConfigurationOrderBy, error) {
if v == nil {
return nil, nil
@@ -103205,6 +103197,14 @@ func (ec *executionContext) unmarshalOWebhookConfigurationOrder2ᚖgoᚗproboᚗ
return &res, graphql.ErrorOnPath(ctx, err)
}
+func (ec *executionContext) unmarshalOWebhookEventOrder2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐWebhookEventOrderBy(ctx context.Context, v any) (*types.WebhookEventOrderBy, error) {
+ if v == nil {
+ return nil, nil
+ }
+ res, err := ec.unmarshalInputWebhookEventOrder(ctx, v)
+ return &res, graphql.ErrorOnPath(ctx, err)
+}
+
func (ec *executionContext) unmarshalOWebhookEventType2ᚕgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐWebhookEventTypeᚄ(ctx context.Context, v any) ([]coredata.WebhookEventType, error) {
if v == nil {
return nil, nil
diff --git a/pkg/server/api/console/v1/types/types.go b/pkg/server/api/console/v1/types/types.go
index b1d49d5c9..64989947b 100644
--- a/pkg/server/api/console/v1/types/types.go
+++ b/pkg/server/api/console/v1/types/types.go
@@ -2623,24 +2623,6 @@ type Viewer struct {
SignableDocument *SignableDocument `json:"signableDocument,omitempty"`
}
-type WebhookCall struct {
- ID gid.GID `json:"id"`
- WebhookEventID gid.GID `json:"webhookEventId"`
- WebhookConfigurationID gid.GID `json:"webhookConfigurationId"`
- EndpointURL string `json:"endpointUrl"`
- Status coredata.WebhookCallStatus `json:"status"`
- Response *string `json:"response,omitempty"`
- CreatedAt time.Time `json:"createdAt"`
-}
-
-func (WebhookCall) IsNode() {}
-func (this WebhookCall) GetID() gid.GID { return this.ID }
-
-type WebhookCallEdge struct {
- Cursor page.CursorKey `json:"cursor"`
- Node *WebhookCall `json:"node"`
-}
-
type WebhookConfiguration struct {
ID gid.GID `json:"id"`
Organization *Organization `json:"organization,omitempty"`
@@ -2649,7 +2631,7 @@ type WebhookConfiguration struct {
SelectedEvents []coredata.WebhookEventType `json:"selectedEvents"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
- Calls *WebhookCallConnection `json:"calls"`
+ Events *WebhookEventConnection `json:"events"`
Permission bool `json:"permission"`
}
@@ -2660,3 +2642,21 @@ type WebhookConfigurationEdge struct {
Cursor page.CursorKey `json:"cursor"`
Node *WebhookConfiguration `json:"node"`
}
+
+type WebhookEvent struct {
+ ID gid.GID `json:"id"`
+ WebhookDataID gid.GID `json:"webhookDataId"`
+ WebhookConfigurationID gid.GID `json:"webhookConfigurationId"`
+ EndpointURL string `json:"endpointUrl"`
+ Status coredata.WebhookEventStatus `json:"status"`
+ Response *string `json:"response,omitempty"`
+ CreatedAt time.Time `json:"createdAt"`
+}
+
+func (WebhookEvent) IsNode() {}
+func (this WebhookEvent) GetID() gid.GID { return this.ID }
+
+type WebhookEventEdge struct {
+ Cursor page.CursorKey `json:"cursor"`
+ Node *WebhookEvent `json:"node"`
+}
diff --git a/pkg/server/api/console/v1/types/webhook_call.go b/pkg/server/api/console/v1/types/webhook_event.go
similarity index 55%
rename from pkg/server/api/console/v1/types/webhook_call.go
rename to pkg/server/api/console/v1/types/webhook_event.go
index f48c5b0b2..15b65f378 100644
--- a/pkg/server/api/console/v1/types/webhook_call.go
+++ b/pkg/server/api/console/v1/types/webhook_event.go
@@ -21,11 +21,11 @@ import (
)
type (
- WebhookCallOrderBy OrderBy[coredata.WebhookCallOrderField]
+ WebhookEventOrderBy OrderBy[coredata.WebhookEventOrderField]
- WebhookCallConnection struct {
+ WebhookEventConnection struct {
TotalCount int
- Edges []*WebhookCallEdge
+ Edges []*WebhookEventEdge
PageInfo PageInfo
Resolver any
@@ -33,18 +33,18 @@ type (
}
)
-func NewWebhookCallConnection(
- p *page.Page[*coredata.WebhookCall, coredata.WebhookCallOrderField],
+func NewWebhookEventConnection(
+ p *page.Page[*coredata.WebhookEvent, coredata.WebhookEventOrderField],
parentType any,
parentID gid.GID,
-) *WebhookCallConnection {
- var edges = make([]*WebhookCallEdge, len(p.Data))
+) *WebhookEventConnection {
+ var edges = make([]*WebhookEventEdge, len(p.Data))
for i := range edges {
- edges[i] = NewWebhookCallEdge(p.Data[i], p.Cursor.OrderBy.Field)
+ edges[i] = NewWebhookEventEdge(p.Data[i], p.Cursor.OrderBy.Field)
}
- return &WebhookCallConnection{
+ return &WebhookEventConnection{
Edges: edges,
PageInfo: *NewPageInfo(p),
@@ -53,27 +53,27 @@ func NewWebhookCallConnection(
}
}
-func NewWebhookCallEdge(wc *coredata.WebhookCall, orderBy coredata.WebhookCallOrderField) *WebhookCallEdge {
- return &WebhookCallEdge{
- Cursor: wc.CursorKey(orderBy),
- Node: NewWebhookCall(wc),
+func NewWebhookEventEdge(we *coredata.WebhookEvent, orderBy coredata.WebhookEventOrderField) *WebhookEventEdge {
+ return &WebhookEventEdge{
+ Cursor: we.CursorKey(orderBy),
+ Node: NewWebhookEvent(we),
}
}
-func NewWebhookCall(wc *coredata.WebhookCall) *WebhookCall {
+func NewWebhookEvent(we *coredata.WebhookEvent) *WebhookEvent {
var response *string
- if len(wc.Response) > 0 {
- s := string(wc.Response)
+ if len(we.Response) > 0 {
+ s := string(we.Response)
response = &s
}
- return &WebhookCall{
- ID: wc.ID,
- WebhookEventID: wc.WebhookEventID,
- WebhookConfigurationID: wc.WebhookConfigurationID,
- EndpointURL: wc.EndpointURL,
- Status: wc.Status,
+ return &WebhookEvent{
+ ID: we.ID,
+ WebhookDataID: we.WebhookDataID,
+ WebhookConfigurationID: we.WebhookConfigurationID,
+ EndpointURL: we.EndpointURL,
+ Status: we.Status,
Response: response,
- CreatedAt: wc.CreatedAt,
+ CreatedAt: we.CreatedAt,
}
}
diff --git a/pkg/server/api/console/v1/v1_resolver.go b/pkg/server/api/console/v1/v1_resolver.go
index 5bbe1cd7a..86dff4d2d 100644
--- a/pkg/server/api/console/v1/v1_resolver.go
+++ b/pkg/server/api/console/v1/v1_resolver.go
@@ -8559,23 +8559,6 @@ func (r *viewerResolver) SignableDocument(ctx context.Context, obj *types.Viewer
}, nil
}
-// TotalCount is the resolver for the totalCount field.
-func (r *webhookCallConnectionResolver) TotalCount(ctx context.Context, obj *types.WebhookCallConnection) (int, error) {
- if err := r.authorize(ctx, obj.ParentID, probo.ActionWebhookConfigurationGet); err != nil {
- return 0, err
- }
-
- prb := r.ProboService(ctx, obj.ParentID.TenantID())
-
- count, err := prb.WebhookConfigurations.CountCallsForConfigurationID(ctx, obj.ParentID)
- if err != nil {
- r.logger.ErrorCtx(ctx, "cannot count webhook calls", log.Error(err))
- return 0, gqlutils.Internal(ctx)
- }
-
- return count, nil
-}
-
// Organization is the resolver for the organization field.
func (r *webhookConfigurationResolver) Organization(ctx context.Context, obj *types.WebhookConfiguration) (*types.Organization, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionOrganizationGet); err != nil {
@@ -8599,6 +8582,10 @@ func (r *webhookConfigurationResolver) Organization(ctx context.Context, obj *ty
// SigningSecret is the resolver for the signingSecret field.
func (r *webhookConfigurationResolver) SigningSecret(ctx context.Context, obj *types.WebhookConfiguration) (string, error) {
+ if err := r.authorize(ctx, obj.ID, probo.ActionWebhookConfigurationUpdate); err != nil {
+ return "", err
+ }
+
prb := r.ProboService(ctx, obj.ID.TenantID())
signingSecret, err := prb.WebhookConfigurations.GetSigningSecret(ctx, obj.ID)
@@ -8610,20 +8597,20 @@ func (r *webhookConfigurationResolver) SigningSecret(ctx context.Context, obj *t
return signingSecret, nil
}
-// Calls is the resolver for the calls field.
-func (r *webhookConfigurationResolver) Calls(ctx context.Context, obj *types.WebhookConfiguration, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.WebhookCallOrderBy) (*types.WebhookCallConnection, error) {
+// Events is the resolver for the events field.
+func (r *webhookConfigurationResolver) Events(ctx context.Context, obj *types.WebhookConfiguration, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.WebhookEventOrderBy) (*types.WebhookEventConnection, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionWebhookConfigurationGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
- pageOrderBy := page.OrderBy[coredata.WebhookCallOrderField]{
- Field: coredata.WebhookCallOrderFieldCreatedAt,
+ pageOrderBy := page.OrderBy[coredata.WebhookEventOrderField]{
+ Field: coredata.WebhookEventOrderFieldCreatedAt,
Direction: page.OrderDirectionDesc,
}
if orderBy != nil {
- pageOrderBy = page.OrderBy[coredata.WebhookCallOrderField]{
+ pageOrderBy = page.OrderBy[coredata.WebhookEventOrderField]{
Field: orderBy.Field,
Direction: orderBy.Direction,
}
@@ -8631,13 +8618,13 @@ func (r *webhookConfigurationResolver) Calls(ctx context.Context, obj *types.Web
cursor := types.NewCursor(first, after, last, before, pageOrderBy)
- page, err := prb.WebhookConfigurations.ListCallsForConfigurationID(ctx, obj.ID, cursor)
+ page, err := prb.WebhookConfigurations.ListEventsForConfigurationID(ctx, obj.ID, cursor)
if err != nil {
- r.logger.ErrorCtx(ctx, "cannot list webhook calls", log.Error(err))
+ r.logger.ErrorCtx(ctx, "cannot list webhook events", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
- return types.NewWebhookCallConnection(page, r, obj.ID), nil
+ return types.NewWebhookEventConnection(page, r, obj.ID), nil
}
// Permission is the resolver for the permission field.
@@ -8667,6 +8654,23 @@ func (r *webhookConfigurationConnectionResolver) TotalCount(ctx context.Context,
return 0, gqlutils.Internal(ctx)
}
+// TotalCount is the resolver for the totalCount field.
+func (r *webhookEventConnectionResolver) TotalCount(ctx context.Context, obj *types.WebhookEventConnection) (int, error) {
+ if err := r.authorize(ctx, obj.ParentID, probo.ActionWebhookConfigurationGet); err != nil {
+ return 0, err
+ }
+
+ prb := r.ProboService(ctx, obj.ParentID.TenantID())
+
+ count, err := prb.WebhookConfigurations.CountEventsForConfigurationID(ctx, obj.ParentID)
+ if err != nil {
+ r.logger.ErrorCtx(ctx, "cannot count webhook events", log.Error(err))
+ return 0, gqlutils.Internal(ctx)
+ }
+
+ return count, nil
+}
+
// ApplicabilityStatement returns schema.ApplicabilityStatementResolver implementation.
func (r *Resolver) ApplicabilityStatement() schema.ApplicabilityStatementResolver {
return &applicabilityStatementResolver{r}
@@ -8969,11 +8973,6 @@ func (r *Resolver) VendorService() schema.VendorServiceResolver { return &vendor
// Viewer returns schema.ViewerResolver implementation.
func (r *Resolver) Viewer() schema.ViewerResolver { return &viewerResolver{r} }
-// WebhookCallConnection returns schema.WebhookCallConnectionResolver implementation.
-func (r *Resolver) WebhookCallConnection() schema.WebhookCallConnectionResolver {
- return &webhookCallConnectionResolver{r}
-}
-
// WebhookConfiguration returns schema.WebhookConfigurationResolver implementation.
func (r *Resolver) WebhookConfiguration() schema.WebhookConfigurationResolver {
return &webhookConfigurationResolver{r}
@@ -8984,6 +8983,11 @@ func (r *Resolver) WebhookConfigurationConnection() schema.WebhookConfigurationC
return &webhookConfigurationConnectionResolver{r}
}
+// WebhookEventConnection returns schema.WebhookEventConnectionResolver implementation.
+func (r *Resolver) WebhookEventConnection() schema.WebhookEventConnectionResolver {
+ return &webhookEventConnectionResolver{r}
+}
+
type applicabilityStatementResolver struct{ *Resolver }
type applicabilityStatementConnectionResolver struct{ *Resolver }
type assetResolver struct{ *Resolver }
@@ -9056,6 +9060,6 @@ type vendorDataPrivacyAgreementResolver struct{ *Resolver }
type vendorRiskAssessmentResolver struct{ *Resolver }
type vendorServiceResolver struct{ *Resolver }
type viewerResolver struct{ *Resolver }
-type webhookCallConnectionResolver struct{ *Resolver }
type webhookConfigurationResolver struct{ *Resolver }
type webhookConfigurationConnectionResolver struct{ *Resolver }
+type webhookEventConnectionResolver struct{ *Resolver }
diff --git a/pkg/webhook/data.go b/pkg/webhook/data.go
index 06d6791e8..285d3baa9 100644
--- a/pkg/webhook/data.go
+++ b/pkg/webhook/data.go
@@ -48,17 +48,17 @@ func InsertEvent(
return fmt.Errorf("cannot marshal webhook event data: %w", err)
}
- event := &coredata.WebhookEvent{
- ID: gid.New(scope.GetTenantID(), coredata.WebhookEventEntityType),
+ webhookData := &coredata.WebhookData{
+ ID: gid.New(scope.GetTenantID(), coredata.WebhookDataEntityType),
OrganizationID: organizationID,
EventType: eventType,
- Status: coredata.WebhookEventStatusPending,
+ Status: coredata.WebhookDataStatusPending,
Data: raw,
CreatedAt: time.Now(),
}
- if err = event.Insert(ctx, conn, scope); err != nil {
- return fmt.Errorf("cannot insert webhook event: %w", err)
+ if err = webhookData.Insert(ctx, conn, scope); err != nil {
+ return fmt.Errorf("cannot insert webhook data: %w", err)
}
return nil
diff --git a/pkg/webhook/sender.go b/pkg/webhook/sender.go
index 1fb064772..04f20449d 100644
--- a/pkg/webhook/sender.go
+++ b/pkg/webhook/sender.go
@@ -91,7 +91,7 @@ func (s *Sender) Run(ctx context.Context) error {
func (s *Sender) processEvents(ctx context.Context) error {
for {
- event, err := s.claimNextEvent(ctx)
+ webhookData, err := s.claimNextWebhookData(ctx)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil
@@ -99,24 +99,24 @@ func (s *Sender) processEvents(ctx context.Context) error {
return err
}
- s.processEvent(ctx, event)
+ s.processWebhookData(ctx, webhookData)
}
}
-func (s *Sender) claimNextEvent(ctx context.Context) (*coredata.WebhookEvent, error) {
- var event coredata.WebhookEvent
+func (s *Sender) claimNextWebhookData(ctx context.Context) (*coredata.WebhookData, error) {
+ var webhookData coredata.WebhookData
err := s.pg.WithTx(ctx, func(tx pg.Conn) error {
- if err := event.LoadNextPendingForUpdate(ctx, tx); err != nil {
+ if err := webhookData.LoadNextPendingForUpdate(ctx, tx); err != nil {
return err
}
- scope := coredata.NewScopeFromObjectID(event.ID)
+ scope := coredata.NewScopeFromObjectID(webhookData.ID)
- event.Status = coredata.WebhookEventStatusProcessing
+ webhookData.Status = coredata.WebhookDataStatusProcessing
- if err := event.UpdateStatus(ctx, tx, scope); err != nil {
- return fmt.Errorf("cannot update webhook event to processing: %w", err)
+ if err := webhookData.UpdateStatus(ctx, tx, scope); err != nil {
+ return fmt.Errorf("cannot update webhook data to processing: %w", err)
}
return nil
@@ -126,77 +126,77 @@ func (s *Sender) claimNextEvent(ctx context.Context) (*coredata.WebhookEvent, er
return nil, err
}
- return &event, nil
+ return &webhookData, nil
}
-func (s *Sender) processEvent(ctx context.Context, event *coredata.WebhookEvent) {
- scope := coredata.NewScopeFromObjectID(event.ID)
+func (s *Sender) processWebhookData(ctx context.Context, webhookData *coredata.WebhookData) {
+ scope := coredata.NewScopeFromObjectID(webhookData.ID)
var configs coredata.WebhookConfigurations
err := s.pg.WithConn(ctx, func(conn pg.Conn) error {
return configs.LoadMatchingByOrganizationIDAndEventType(
- ctx, conn, scope, event.OrganizationID, event.EventType,
+ ctx, conn, scope, webhookData.OrganizationID, webhookData.EventType,
)
})
if err != nil {
s.logger.ErrorCtx(ctx, "cannot load matching webhook configurations",
log.Error(err),
- log.String("event_id", event.ID.String()),
+ log.String("webhook_data_id", webhookData.ID.String()),
)
return
}
for _, config := range configs {
- s.deliverToConfiguration(ctx, event, config, scope)
+ s.deliverToConfiguration(ctx, webhookData, config, scope)
}
now := time.Now()
- event.Status = coredata.WebhookEventStatusDelivered
- event.ProcessedAt = &now
+ webhookData.Status = coredata.WebhookDataStatusDelivered
+ webhookData.ProcessedAt = &now
err = s.pg.WithConn(ctx, func(conn pg.Conn) error {
- return event.UpdateStatus(ctx, conn, scope)
+ return webhookData.UpdateStatus(ctx, conn, scope)
})
if err != nil {
- s.logger.ErrorCtx(ctx, "cannot update webhook event to delivered",
+ s.logger.ErrorCtx(ctx, "cannot update webhook data to delivered",
log.Error(err),
- log.String("event_id", event.ID.String()),
+ log.String("webhook_data_id", webhookData.ID.String()),
)
}
}
func (s *Sender) deliverToConfiguration(
ctx context.Context,
- event *coredata.WebhookEvent,
+ webhookData *coredata.WebhookData,
config *coredata.WebhookConfiguration,
scope coredata.Scoper,
) {
- callID := gid.New(event.ID.TenantID(), coredata.WebhookCallEntityType)
+ eventID := gid.New(webhookData.ID.TenantID(), coredata.WebhookEventEntityType)
signingSecret, err := s.getSigningSecret(config.ID.String(), config.EncryptedSigningSecret)
if err != nil {
s.logger.ErrorCtx(ctx, "cannot get signing secret",
log.Error(err),
- log.String("event_id", event.ID.String()),
+ log.String("webhook_data_id", webhookData.ID.String()),
log.String("configuration_id", config.ID.String()),
)
- s.recordCall(ctx, callID, event, config, scope, coredata.WebhookCallStatusFailed, nil)
+ s.recordEvent(ctx, eventID, webhookData, config, scope, coredata.WebhookEventStatusFailed, nil)
return
}
- response, sendErr := s.doHTTPCall(ctx, callID, config.EndpointURL, event, config.ID, signingSecret)
+ response, sendErr := s.doHTTPCall(ctx, eventID, config.EndpointURL, webhookData, config.ID, signingSecret)
- callStatus := coredata.WebhookCallStatusSucceeded
+ eventStatus := coredata.WebhookEventStatusSucceeded
if sendErr != nil {
- callStatus = coredata.WebhookCallStatusFailed
- s.logger.ErrorCtx(ctx, "error delivering webhook event",
+ eventStatus = coredata.WebhookEventStatusFailed
+ s.logger.ErrorCtx(ctx, "error delivering webhook",
log.Error(sendErr),
- log.String("event_id", event.ID.String()),
+ log.String("webhook_data_id", webhookData.ID.String()),
log.String("endpoint_url", config.EndpointURL),
)
}
- s.recordCall(ctx, callID, event, config, scope, callStatus, response)
+ s.recordEvent(ctx, eventID, webhookData, config, scope, eventStatus, response)
}
func (s *Sender) getSigningSecret(webhookConfigurationID string, encryptedSigningSecret []byte) (string, error) {
@@ -217,20 +217,19 @@ func (s *Sender) getSigningSecret(webhookConfigurationID string, encryptedSignin
func (s *Sender) doHTTPCall(
ctx context.Context,
- callID gid.GID,
+ eventID gid.GID,
endpointURL string,
- event *coredata.WebhookEvent,
+ webhookData *coredata.WebhookData,
configurationID gid.GID,
signingSecret string,
) (json.RawMessage, error) {
payload := map[string]any{
- "eventId": event.ID.String(),
- "callId": callID.String(),
+ "eventId": eventID.String(),
"configurationId": configurationID.String(),
- "organizationId": event.OrganizationID.String(),
- "eventType": event.EventType.String(),
- "createdAt": event.CreatedAt,
- "data": event.Data,
+ "organizationId": webhookData.OrganizationID.String(),
+ "eventType": webhookData.EventType.String(),
+ "createdAt": webhookData.CreatedAt,
+ "data": webhookData.Data,
}
body, err := json.Marshal(payload)
@@ -250,7 +249,7 @@ func (s *Sender) doHTTPCall(
signature := computeSignature(signingSecret, timestamp, body)
req.Header.Set("Content-Type", "application/json")
- req.Header.Set("X-Probo-Webhook-Event", event.EventType.String())
+ req.Header.Set("X-Probo-Webhook-Event", webhookData.EventType.String())
req.Header.Set("X-Probo-Webhook-Timestamp", timestamp)
req.Header.Set("X-Probo-Webhook-Signature", signature)
@@ -275,18 +274,18 @@ func (s *Sender) doHTTPCall(
}
}
-func (s *Sender) recordCall(
+func (s *Sender) recordEvent(
ctx context.Context,
- callID gid.GID,
- event *coredata.WebhookEvent,
+ eventID gid.GID,
+ webhookData *coredata.WebhookData,
config *coredata.WebhookConfiguration,
scope coredata.Scoper,
- status coredata.WebhookCallStatus,
+ status coredata.WebhookEventStatus,
response json.RawMessage,
) {
- call := coredata.WebhookCall{
- ID: callID,
- WebhookEventID: event.ID,
+ event := coredata.WebhookEvent{
+ ID: eventID,
+ WebhookDataID: webhookData.ID,
WebhookConfigurationID: config.ID,
EndpointURL: config.EndpointURL,
Status: status,
@@ -295,12 +294,12 @@ func (s *Sender) recordCall(
}
err := s.pg.WithConn(ctx, func(conn pg.Conn) error {
- return call.Insert(ctx, conn, scope)
+ return event.Insert(ctx, conn, scope)
})
if err != nil {
- s.logger.ErrorCtx(ctx, "cannot insert webhook call",
+ s.logger.ErrorCtx(ctx, "cannot insert webhook event",
log.Error(err),
- log.String("event_id", event.ID.String()),
+ log.String("webhook_data_id", webhookData.ID.String()),
log.String("configuration_id", config.ID.String()),
)
}