Skip to content

Commit cd9989a

Browse files
committed
minor type improvements
1 parent 636c1db commit cd9989a

2 files changed

Lines changed: 4 additions & 24 deletions

File tree

apps/sim/hooks/queries/notifications.ts

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@ import { createLogger } from '@sim/logger'
22
import { keepPreviousData, useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
33
import { requestJson } from '@/lib/api/client/request'
44
import {
5+
type ContractBodyInput,
56
createNotificationContract,
67
deleteNotificationContract,
78
listNotificationsContract,
8-
type NotificationAlertConfig,
9-
type NotificationLogLevel,
10-
type NotificationSlackConfig,
119
type NotificationSubscription,
12-
type NotificationType,
13-
type NotificationWebhookConfig,
1410
testNotificationContract,
1511
updateNotificationContract,
1612
} from '@/lib/api/contracts'
@@ -32,8 +28,6 @@ export const notificationKeys = {
3228
[...notificationKeys.details(), workspaceId, notificationId] as const,
3329
}
3430

35-
type TriggerType = string
36-
3731
/**
3832
* Fetch notifications for a workspace
3933
*/
@@ -63,21 +57,7 @@ export function useNotifications(workspaceId?: string) {
6357

6458
interface CreateNotificationParams {
6559
workspaceId: string
66-
data: {
67-
notificationType: NotificationType
68-
workflowIds: string[]
69-
allWorkflows: boolean
70-
levelFilter: NotificationLogLevel[]
71-
triggerFilter: TriggerType[]
72-
includeFinalOutput: boolean
73-
includeTraceSpans: boolean
74-
includeRateLimits: boolean
75-
includeUsageData: boolean
76-
alertConfig?: NotificationAlertConfig | null
77-
webhookConfig?: NotificationWebhookConfig
78-
emailRecipients?: string[]
79-
slackConfig?: NotificationSlackConfig
80-
}
60+
data: ContractBodyInput<typeof createNotificationContract>
8161
}
8262

8363
/**
@@ -105,7 +85,7 @@ export function useCreateNotification() {
10585
interface UpdateNotificationParams {
10686
workspaceId: string
10787
notificationId: string
108-
data: Partial<CreateNotificationParams['data']> & { active?: boolean }
88+
data: ContractBodyInput<typeof updateNotificationContract>
10989
}
11090

11191
/**

apps/sim/hooks/queries/workspace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export function useCreateWorkspace() {
129129
return useMutation({
130130
mutationFn: async ({ name }: CreateWorkspaceParams) => {
131131
const data = await requestJson(createWorkspaceContract, { body: { name } })
132-
return data.workspace as Workspace
132+
return data.workspace
133133
},
134134
onSuccess: (newWorkspace) => {
135135
queryClient.setQueryData<WorkspacesResponse>(workspaceKeys.list('active'), (previous) => {

0 commit comments

Comments
 (0)