feat: Support Checkly group variables (ENG-3478) (#4418)

* feat: checkly group sync

* fix: remove scope discriminator

* fix: forms

* fix: queries

* fix: 500 error

* fix: update docs

* lint: fix

* fix: review changes

* fix: PR changes

* fix: resolve group select UI not clearing

---------

Co-authored-by: Scott Wilson <[email protected]>
This commit is contained in:
Sid
2025-08-28 21:55:53 +05:30
committed by GitHub
co-authored by Scott Wilson
parent c7987772e3
commit a0da2f2d4c
15 changed files with 428 additions and 47 deletions
@@ -8,7 +8,9 @@ import { TChecklyAccount } from "./types";
const checklyConnectionKeys = {
all: [...appConnectionKeys.all, "checkly"] as const,
listAccounts: (connectionId: string) =>
[...checklyConnectionKeys.all, "workspace-scopes", connectionId] as const
[...checklyConnectionKeys.all, "workspace-scopes", connectionId] as const,
listGroups: (connectionId: string, accountId: string) =>
[...checklyConnectionKeys.all, "groups", connectionId, accountId] as const
};
export const useChecklyConnectionListAccounts = (
@@ -35,3 +37,29 @@ export const useChecklyConnectionListAccounts = (
...options
});
};
export const useChecklyConnectionListGroups = (
connectionId: string,
accountId: string,
options?: Omit<
UseQueryOptions<
TChecklyAccount[],
unknown,
TChecklyAccount[],
ReturnType<typeof checklyConnectionKeys.listGroups>
>,
"queryKey" | "queryFn"
>
) => {
return useQuery({
queryKey: checklyConnectionKeys.listGroups(connectionId, accountId),
queryFn: async () => {
const { data } = await apiRequest.get<{ groups: TChecklyAccount[] }>(
`/api/v1/app-connections/checkly/${connectionId}/accounts/${accountId}/groups`
);
return data.groups;
},
...options
});
};
@@ -3,11 +3,17 @@ import { AppConnection } from "@app/hooks/api/appConnections/enums";
import { SecretSync } from "@app/hooks/api/secretSyncs";
import { TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
export enum ChecklySyncScope {
Global = "global",
Group = "group"
}
export type TChecklySync = TRootSecretSync & {
destination: SecretSync.Checkly;
destinationConfig: {
accountId: string;
accountName: string;
groupId?: string;
groupName?: string;
};
connection: {
app: AppConnection.Checkly;