@seamapi/react 4.8.2 → 4.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +17 -2
  2. package/dist/elements.js +22079 -18028
  3. package/dist/elements.js.map +1 -1
  4. package/lib/index.d.ts +1 -0
  5. package/lib/index.js +1 -0
  6. package/lib/index.js.map +1 -1
  7. package/lib/seam/SeamProvider.d.ts +7 -16
  8. package/lib/seam/SeamProvider.js +12 -101
  9. package/lib/seam/SeamProvider.js.map +1 -1
  10. package/lib/seam/SeamQueryProvider.d.ts +34 -0
  11. package/lib/seam/SeamQueryProvider.js +136 -0
  12. package/lib/seam/SeamQueryProvider.js.map +1 -0
  13. package/lib/seam/access-codes/use-access-code.d.ts +2 -2
  14. package/lib/seam/access-codes/use-access-codes.d.ts +2 -2
  15. package/lib/seam/access-codes/use-create-access-code.d.ts +2 -7
  16. package/lib/seam/access-codes/use-create-access-code.js +3 -9
  17. package/lib/seam/access-codes/use-create-access-code.js.map +1 -1
  18. package/lib/seam/access-codes/use-generate-access-code-code.d.ts +2 -2
  19. package/lib/seam/client-sessions/use-client-session.d.ts +2 -2
  20. package/lib/seam/components/SupportedDeviceTable/use-device-model.d.ts +2 -2
  21. package/lib/seam/components/SupportedDeviceTable/use-device-models.d.ts +2 -2
  22. package/lib/seam/components/SupportedDeviceTable/use-manufacturer.d.ts +2 -2
  23. package/lib/seam/components/SupportedDeviceTable/use-manufacturers.d.ts +2 -2
  24. package/lib/seam/connected-accounts/use-connected-account.d.ts +2 -2
  25. package/lib/seam/devices/use-device-providers.d.ts +2 -2
  26. package/lib/seam/devices/use-device.d.ts +2 -2
  27. package/lib/seam/devices/use-devices.d.ts +2 -2
  28. package/lib/seam/events/use-events.d.ts +2 -2
  29. package/lib/seam/index.d.ts +2 -0
  30. package/lib/seam/index.js +2 -0
  31. package/lib/seam/index.js.map +1 -1
  32. package/lib/seam/noise-sensors/use-noise-thresholds.d.ts +2 -2
  33. package/lib/seam/thermostats/use-delete-thermostat-climate-preset.d.ts +2 -2
  34. package/lib/seam/use-seam-client.d.ts +3 -1
  35. package/lib/seam/use-seam-client.js +42 -9
  36. package/lib/seam/use-seam-client.js.map +1 -1
  37. package/lib/seam/use-seam-mutation.d.ts +8 -0
  38. package/lib/seam/use-seam-mutation.js +17 -0
  39. package/lib/seam/use-seam-mutation.js.map +1 -0
  40. package/lib/seam/use-seam-query-result.d.ts +1 -1
  41. package/lib/seam/use-seam-query.d.ts +8 -0
  42. package/lib/seam/use-seam-query.js +23 -0
  43. package/lib/seam/use-seam-query.js.map +1 -0
  44. package/lib/telemetry/hooks.js +2 -2
  45. package/lib/telemetry/hooks.js.map +1 -1
  46. package/lib/ui/DateTimePicker/DateTimePicker.d.ts +1 -1
  47. package/lib/version.d.ts +1 -1
  48. package/lib/version.js +1 -1
  49. package/package.json +3 -2
  50. package/src/lib/index.ts +1 -0
  51. package/src/lib/seam/SeamProvider.tsx +31 -182
  52. package/src/lib/seam/SeamQueryProvider.tsx +270 -0
  53. package/src/lib/seam/access-codes/use-access-code.ts +2 -2
  54. package/src/lib/seam/access-codes/use-access-codes.ts +2 -2
  55. package/src/lib/seam/access-codes/use-create-access-code.ts +7 -32
  56. package/src/lib/seam/access-codes/use-generate-access-code-code.ts +2 -2
  57. package/src/lib/seam/client-sessions/use-client-session.ts +2 -2
  58. package/src/lib/seam/components/SupportedDeviceTable/use-device-model.ts +2 -2
  59. package/src/lib/seam/components/SupportedDeviceTable/use-device-models.ts +2 -2
  60. package/src/lib/seam/components/SupportedDeviceTable/use-manufacturer.ts +2 -2
  61. package/src/lib/seam/components/SupportedDeviceTable/use-manufacturers.ts +2 -2
  62. package/src/lib/seam/connected-accounts/use-connected-account.ts +2 -2
  63. package/src/lib/seam/devices/use-device-providers.ts +2 -2
  64. package/src/lib/seam/devices/use-device.ts +2 -2
  65. package/src/lib/seam/devices/use-devices.ts +2 -2
  66. package/src/lib/seam/events/use-events.ts +2 -2
  67. package/src/lib/seam/index.ts +2 -0
  68. package/src/lib/seam/noise-sensors/use-noise-thresholds.ts +2 -2
  69. package/src/lib/seam/thermostats/use-delete-thermostat-climate-preset.ts +2 -2
  70. package/src/lib/seam/use-seam-client.ts +64 -10
  71. package/src/lib/seam/use-seam-mutation.ts +50 -0
  72. package/src/lib/seam/use-seam-query-result.ts +6 -4
  73. package/src/lib/seam/use-seam-query.ts +49 -0
  74. package/src/lib/telemetry/hooks.ts +2 -2
  75. package/src/lib/version.ts +1 -1
@@ -0,0 +1,270 @@
1
+ import type {
2
+ SeamHttp,
3
+ SeamHttpEndpoints,
4
+ SeamHttpOptionsWithClientSessionToken,
5
+ } from '@seamapi/http/connect'
6
+ import {
7
+ QueryClient,
8
+ QueryClientContext,
9
+ QueryClientProvider,
10
+ } from '@tanstack/react-query'
11
+ import {
12
+ createContext,
13
+ type PropsWithChildren,
14
+ useContext,
15
+ useEffect,
16
+ useMemo,
17
+ } from 'react'
18
+
19
+ import { useSeamClient } from './use-seam-client.js'
20
+
21
+ export interface SeamQueryContext {
22
+ client: SeamHttp | null
23
+ endpointClient: SeamHttpEndpoints | null
24
+ clientOptions?: SeamQueryProviderClientOptions | undefined
25
+ publishableKey?: string | undefined
26
+ userIdentifierKey?: string | undefined
27
+ clientSessionToken?: string | undefined
28
+ queryKeyPrefix?: string | undefined
29
+ }
30
+
31
+ export type SeamQueryProviderProps =
32
+ | SeamQueryProviderPropsWithClient
33
+ | SeamQueryProviderPropsWithPublishableKey
34
+ | SeamQueryProviderPropsWithClientSessionToken
35
+
36
+ export interface SeamQueryProviderPropsWithClient
37
+ extends SeamQueryProviderBaseProps {
38
+ client: SeamHttp
39
+ queryKeyPrefix: string
40
+ }
41
+
42
+ export interface SeamQueryProviderPropsWithPublishableKey
43
+ extends SeamQueryProviderBaseProps,
44
+ SeamQueryProviderClientOptions {
45
+ publishableKey: string
46
+ userIdentifierKey?: string
47
+ }
48
+
49
+ export interface SeamQueryProviderPropsWithClientSessionToken
50
+ extends SeamQueryProviderBaseProps,
51
+ SeamQueryProviderClientOptions {
52
+ clientSessionToken: string
53
+ }
54
+
55
+ interface SeamQueryProviderBaseProps extends PropsWithChildren {
56
+ queryClient?: QueryClient | undefined
57
+ onSessionUpdate?: (client: SeamHttp) => void
58
+ }
59
+
60
+ type SeamClientOptions = SeamHttpOptionsWithClientSessionToken
61
+
62
+ export type SeamQueryProviderClientOptions = Pick<SeamClientOptions, 'endpoint'>
63
+
64
+ const defaultQueryClient = new QueryClient()
65
+
66
+ export function SeamQueryProvider({
67
+ children,
68
+ onSessionUpdate = () => {},
69
+ queryClient,
70
+ ...props
71
+ }: SeamQueryProviderProps): JSX.Element {
72
+ const value = useMemo(() => {
73
+ const context = createSeamQueryContextValue(props)
74
+ if (
75
+ context.client == null &&
76
+ context.publishableKey == null &&
77
+ context.clientSessionToken == null
78
+ ) {
79
+ return defaultSeamQueryContextValue
80
+ }
81
+ return context
82
+ }, [props])
83
+
84
+ if (
85
+ value.client == null &&
86
+ value.publishableKey == null &&
87
+ value.clientSessionToken == null
88
+ ) {
89
+ throw new Error(
90
+ `Must provide either a Seam client, clientSessionToken, or a publishableKey.`
91
+ )
92
+ }
93
+
94
+ const { Provider } = seamContext
95
+ const queryClientFromContext = useContext(QueryClientContext)
96
+
97
+ if (
98
+ queryClientFromContext != null &&
99
+ queryClient != null &&
100
+ queryClientFromContext !== queryClient
101
+ ) {
102
+ throw new Error(
103
+ 'The QueryClient passed into SeamQueryProvider is different from the one in the existing QueryClientContext. Omit the queryClient prop from SeamProvider or SeamQueryProvider to use the existing QueryClient provided by the QueryClientProvider.'
104
+ )
105
+ }
106
+
107
+ return (
108
+ <QueryClientProvider
109
+ client={queryClientFromContext ?? queryClient ?? defaultQueryClient}
110
+ >
111
+ <Provider value={value}>
112
+ <Session onSessionUpdate={onSessionUpdate}>{children}</Session>
113
+ </Provider>
114
+ </QueryClientProvider>
115
+ )
116
+ }
117
+
118
+ function Session({
119
+ onSessionUpdate,
120
+ children,
121
+ }: Required<Pick<SeamQueryProviderProps, 'onSessionUpdate'>> &
122
+ PropsWithChildren): JSX.Element | null {
123
+ const { client } = useSeamClient()
124
+ useEffect(() => {
125
+ if (client != null) onSessionUpdate(client)
126
+ }, [onSessionUpdate, client])
127
+
128
+ return <>{children}</>
129
+ }
130
+
131
+ const createDefaultSeamQueryContextValue = (): SeamQueryContext => {
132
+ try {
133
+ if (globalThis.seam == null) {
134
+ return { client: null, endpointClient: null }
135
+ }
136
+ return createSeamQueryContextValue(globalThis.seam)
137
+ } catch (err) {
138
+ // eslint-disable-next-line no-console
139
+ console.warn(err)
140
+ return { client: null, endpointClient: null }
141
+ }
142
+ }
143
+
144
+ const createSeamQueryContextValue = (
145
+ options: SeamQueryProviderProps
146
+ ): SeamQueryContext => {
147
+ if (isSeamQueryProviderPropsWithClient(options)) {
148
+ if (options.queryKeyPrefix == null) {
149
+ throw new InvalidSeamQueryProviderProps(
150
+ 'The client prop must be used with a queryKeyPrefix prop.'
151
+ )
152
+ }
153
+ return {
154
+ ...options,
155
+ endpointClient: null,
156
+ }
157
+ }
158
+
159
+ if (isSeamQueryProviderPropsWithClientSessionToken(options)) {
160
+ const { clientSessionToken, ...clientOptions } = options
161
+ return {
162
+ clientSessionToken,
163
+ clientOptions,
164
+ client: null,
165
+ endpointClient: null,
166
+ }
167
+ }
168
+
169
+ if (isSeamQueryProviderPropsWithPublishableKey(options)) {
170
+ const { publishableKey, userIdentifierKey, ...clientOptions } = options
171
+ return {
172
+ publishableKey,
173
+ userIdentifierKey,
174
+ clientOptions,
175
+ client: null,
176
+ endpointClient: null,
177
+ }
178
+ }
179
+
180
+ return { client: null, endpointClient: null }
181
+ }
182
+
183
+ const defaultSeamQueryContextValue = createDefaultSeamQueryContextValue()
184
+
185
+ export const seamContext = createContext<SeamQueryContext>(
186
+ defaultSeamQueryContextValue
187
+ )
188
+
189
+ export function useSeamQueryContext(): SeamQueryContext {
190
+ return useContext(seamContext)
191
+ }
192
+
193
+ const isSeamQueryProviderPropsWithClient = (
194
+ props: SeamQueryProviderProps
195
+ ): props is SeamQueryProviderPropsWithClient => {
196
+ if (!('client' in props)) return false
197
+
198
+ const { client, ...otherProps } = props
199
+ if (client == null) return false
200
+
201
+ const otherNonNullProps = Object.values(otherProps).filter((v) => v != null)
202
+ if (otherNonNullProps.length > 0) {
203
+ throw new InvalidSeamQueryProviderProps(
204
+ `The client prop cannot be used with ${otherNonNullProps.join(' or ')}.`
205
+ )
206
+ }
207
+
208
+ return true
209
+ }
210
+
211
+ const isSeamQueryProviderPropsWithPublishableKey = (
212
+ props: SeamQueryProviderProps
213
+ ): props is SeamQueryProviderPropsWithPublishableKey &
214
+ SeamQueryProviderClientOptions => {
215
+ if (!('publishableKey' in props)) return false
216
+
217
+ const { publishableKey } = props
218
+ if (publishableKey == null) return false
219
+
220
+ if ('client' in props && props.client != null) {
221
+ throw new InvalidSeamQueryProviderProps(
222
+ 'The client prop cannot be used with the publishableKey prop.'
223
+ )
224
+ }
225
+
226
+ if ('clientSessionToken' in props && props.clientSessionToken != null) {
227
+ throw new InvalidSeamQueryProviderProps(
228
+ 'The clientSessionToken prop cannot be used with the publishableKey prop.'
229
+ )
230
+ }
231
+
232
+ return true
233
+ }
234
+
235
+ const isSeamQueryProviderPropsWithClientSessionToken = (
236
+ props: SeamQueryProviderProps
237
+ ): props is SeamQueryProviderPropsWithClientSessionToken &
238
+ SeamQueryProviderClientOptions => {
239
+ if (!('clientSessionToken' in props)) return false
240
+
241
+ const { clientSessionToken } = props
242
+ if (clientSessionToken == null) return false
243
+
244
+ if ('client' in props && props.client != null) {
245
+ throw new InvalidSeamQueryProviderProps(
246
+ 'The client prop cannot be used with the clientSessionToken prop.'
247
+ )
248
+ }
249
+
250
+ if ('publishableKey' in props && props.publishableKey != null) {
251
+ throw new InvalidSeamQueryProviderProps(
252
+ 'The publishableKey prop cannot be used with the clientSessionToken prop.'
253
+ )
254
+ }
255
+
256
+ if ('userIdentifierKey' in props && props.userIdentifierKey != null) {
257
+ throw new InvalidSeamQueryProviderProps(
258
+ 'The userIdentifierKey prop cannot be used with the clientSessionToken prop.'
259
+ )
260
+ }
261
+
262
+ return true
263
+ }
264
+
265
+ class InvalidSeamQueryProviderProps extends Error {
266
+ constructor(message: string) {
267
+ super(`SeamQueryProvider received invalid props: ${message}`)
268
+ this.name = this.constructor.name
269
+ }
270
+ }
@@ -6,7 +6,7 @@ import type { AccessCode } from '@seamapi/types/connect'
6
6
  import { useQuery } from '@tanstack/react-query'
7
7
 
8
8
  import { useSeamClient } from 'lib/seam/use-seam-client.js'
9
- import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
9
+ import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
10
10
 
11
11
  export type UseAccessCodeParams = AccessCodesGetParams
12
12
 
@@ -14,7 +14,7 @@ export type UseAccessCodeData = AccessCode | null
14
14
 
15
15
  export function useAccessCode(
16
16
  params: UseAccessCodeParams
17
- ): UseSeamQueryResult<'accessCode', UseAccessCodeData> {
17
+ ): UseSeamQueryResultLegacy<'accessCode', UseAccessCodeData> {
18
18
  const { client } = useSeamClient()
19
19
  const { data, ...rest } = useQuery<UseAccessCodeData, SeamHttpApiError>({
20
20
  enabled: client != null,
@@ -6,7 +6,7 @@ import type { AccessCode } from '@seamapi/types/connect'
6
6
  import { useQuery, useQueryClient } from '@tanstack/react-query'
7
7
 
8
8
  import { useSeamClient } from 'lib/seam/use-seam-client.js'
9
- import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
9
+ import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
10
10
 
11
11
  export type UseAccessCodesParams = AccessCodesListParams
12
12
 
@@ -14,7 +14,7 @@ export type UseAccessCodesData = AccessCode[]
14
14
 
15
15
  export function useAccessCodes(
16
16
  params: UseAccessCodesParams
17
- ): UseSeamQueryResult<'accessCodes', UseAccessCodesData> {
17
+ ): UseSeamQueryResultLegacy<'accessCodes', UseAccessCodesData> {
18
18
  const { client } = useSeamClient()
19
19
  const queryClient = useQueryClient()
20
20
 
@@ -1,39 +1,14 @@
1
- import type {
2
- AccessCodesCreateBody,
3
- SeamHttpApiError,
4
- } from '@seamapi/http/connect'
5
- import type { AccessCode } from '@seamapi/types/connect'
6
- import {
7
- useMutation,
8
- type UseMutationResult,
9
- useQueryClient,
10
- } from '@tanstack/react-query'
11
-
12
- import { NullSeamClientError, useSeamClient } from 'lib/seam/use-seam-client.js'
13
-
14
- export type UseCreateAccessCodeParams = never
1
+ import { useQueryClient } from '@tanstack/react-query'
15
2
 
16
- export type UseCreateAccessCodeData = AccessCode
17
-
18
- export type UseCreateAccessCodeMutationVariables = AccessCodesCreateBody
3
+ import {
4
+ useSeamMutation,
5
+ type UseSeamMutationResult,
6
+ } from '../use-seam-mutation.js'
19
7
 
20
- export function useCreateAccessCode(): UseMutationResult<
21
- UseCreateAccessCodeData,
22
- SeamHttpApiError,
23
- UseCreateAccessCodeMutationVariables
24
- > {
25
- const { client } = useSeamClient()
8
+ export function useCreateAccessCode(): UseSeamMutationResult<'/access_codes/create'> {
26
9
  const queryClient = useQueryClient()
27
10
 
28
- return useMutation<
29
- UseCreateAccessCodeData,
30
- SeamHttpApiError,
31
- UseCreateAccessCodeMutationVariables
32
- >({
33
- mutationFn: async (variables) => {
34
- if (client === null) throw new NullSeamClientError()
35
- return await client.accessCodes.create(variables)
36
- },
11
+ return useSeamMutation('/access_codes/create', {
37
12
  onSuccess: (data) => {
38
13
  queryClient.setQueryData(
39
14
  ['access_codes', 'get', { access_code_id: data.access_code_id }],
@@ -1,5 +1,5 @@
1
1
  import type {
2
- AccessCodesGenerateCodeBody,
2
+ AccessCodesGenerateCodeParams,
3
3
  SeamHttpApiError,
4
4
  } from '@seamapi/http/connect'
5
5
  import { useMutation, type UseMutationResult } from '@tanstack/react-query'
@@ -11,7 +11,7 @@ export type UseGenerateAccessCodeCodeParams = never
11
11
  export type UseGenerateAccessCodeCodeData = string
12
12
 
13
13
  export type UseGenerateAccessCodeCodeMutationVariables =
14
- AccessCodesGenerateCodeBody
14
+ AccessCodesGenerateCodeParams
15
15
 
16
16
  export function useGenerateAccessCodeCode(): UseMutationResult<
17
17
  UseGenerateAccessCodeCodeData,
@@ -3,13 +3,13 @@ import type { ClientSession } from '@seamapi/types/connect'
3
3
  import { useQuery } from '@tanstack/react-query'
4
4
 
5
5
  import { useSeamClient } from 'lib/seam/use-seam-client.js'
6
- import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
6
+ import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
7
7
 
8
8
  export type UseClientSessionParams = never
9
9
 
10
10
  export type UseClientSessionData = ClientSession | null
11
11
 
12
- export function useClientSession(): UseSeamQueryResult<
12
+ export function useClientSession(): UseSeamQueryResultLegacy<
13
13
  'clientSession',
14
14
  UseClientSessionData
15
15
  > {
@@ -7,7 +7,7 @@ import type {
7
7
  import { useQuery } from '@tanstack/react-query'
8
8
 
9
9
  import { useSeamClient } from 'lib/seam/use-seam-client.js'
10
- import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
10
+ import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
11
11
 
12
12
  export type UseDeviceModelParams = DeviceModelsGetParams
13
13
 
@@ -15,7 +15,7 @@ export type UseDeviceModelData = DeviceModel | null
15
15
 
16
16
  export function useDeviceModel(
17
17
  params: UseDeviceModelParams
18
- ): UseSeamQueryResult<'deviceModel', UseDeviceModelData> {
18
+ ): UseSeamQueryResultLegacy<'deviceModel', UseDeviceModelData> {
19
19
  const { client: seam } = useSeamClient()
20
20
  const { data, ...rest } = useQuery<UseDeviceModelData, SeamHttpApiError>({
21
21
  enabled: seam != null,
@@ -7,7 +7,7 @@ import type {
7
7
  import { useQuery, useQueryClient } from '@tanstack/react-query'
8
8
 
9
9
  import { useSeamClient } from 'lib/seam/use-seam-client.js'
10
- import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
10
+ import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
11
11
 
12
12
  export type UseDeviceModelsParams = DeviceModelsListParams
13
13
 
@@ -15,7 +15,7 @@ export type UseDeviceModelsData = DeviceModel[]
15
15
 
16
16
  export function useDeviceModels(
17
17
  params?: UseDeviceModelsParams
18
- ): UseSeamQueryResult<'deviceModels', UseDeviceModelsData> {
18
+ ): UseSeamQueryResultLegacy<'deviceModels', UseDeviceModelsData> {
19
19
  const { client: seam } = useSeamClient()
20
20
  const queryClient = useQueryClient()
21
21
 
@@ -7,7 +7,7 @@ import type {
7
7
  import { useQuery } from '@tanstack/react-query'
8
8
 
9
9
  import { useSeamClient } from 'lib/seam/use-seam-client.js'
10
- import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
10
+ import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
11
11
 
12
12
  export type UseManufacturerParams = ManufacturersGetParams
13
13
 
@@ -15,7 +15,7 @@ export type UseManufacturerData = Manufacturer | null
15
15
 
16
16
  export function useManufacturer(
17
17
  params: UseManufacturerParams
18
- ): UseSeamQueryResult<'manufacturer', UseManufacturerData> {
18
+ ): UseSeamQueryResultLegacy<'manufacturer', UseManufacturerData> {
19
19
  const { client: seam } = useSeamClient()
20
20
  const { data, ...rest } = useQuery<UseManufacturerData, SeamHttpApiError>({
21
21
  enabled: seam != null,
@@ -7,7 +7,7 @@ import type {
7
7
  import { useQuery, useQueryClient } from '@tanstack/react-query'
8
8
 
9
9
  import { useSeamClient } from 'lib/seam/use-seam-client.js'
10
- import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
10
+ import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
11
11
 
12
12
  export type UseManufacturersParams = ManufacturersListParams
13
13
 
@@ -15,7 +15,7 @@ export type UseManufacturersData = Manufacturer[]
15
15
 
16
16
  export function useManufacturers(
17
17
  params?: UseManufacturersParams
18
- ): UseSeamQueryResult<'manufacturers', UseManufacturersData> {
18
+ ): UseSeamQueryResultLegacy<'manufacturers', UseManufacturersData> {
19
19
  const { client: seam } = useSeamClient()
20
20
  const queryClient = useQueryClient()
21
21
 
@@ -6,7 +6,7 @@ import type { ConnectedAccount } from '@seamapi/types/connect'
6
6
  import { useQuery } from '@tanstack/react-query'
7
7
 
8
8
  import { useSeamClient } from 'lib/seam/use-seam-client.js'
9
- import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
9
+ import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
10
10
 
11
11
  export type UseConnectedAccountParams = ConnectedAccountsGetParams
12
12
 
@@ -14,7 +14,7 @@ export type UseConnectedAccountData = ConnectedAccount | null
14
14
 
15
15
  export function useConnectedAccount(
16
16
  params: UseConnectedAccountParams
17
- ): UseSeamQueryResult<'connectedAccount', UseConnectedAccountData> {
17
+ ): UseSeamQueryResultLegacy<'connectedAccount', UseConnectedAccountData> {
18
18
  const { client } = useSeamClient()
19
19
  const { data, ...rest } = useQuery<UseConnectedAccountData, SeamHttpApiError>(
20
20
  {
@@ -6,7 +6,7 @@ import type { DeviceProvider } from '@seamapi/types/connect'
6
6
  import { useQuery } from '@tanstack/react-query'
7
7
 
8
8
  import { useSeamClient } from 'lib/seam/use-seam-client.js'
9
- import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
9
+ import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
10
10
 
11
11
  export type UseDeviceProvidersParams = DevicesListDeviceProvidersParams
12
12
 
@@ -14,7 +14,7 @@ export type UseDeviceProvidersData = DeviceProvider[]
14
14
 
15
15
  export function useDeviceProviders(
16
16
  params?: UseDeviceProvidersParams
17
- ): UseSeamQueryResult<'deviceProviders', UseDeviceProvidersData> {
17
+ ): UseSeamQueryResultLegacy<'deviceProviders', UseDeviceProvidersData> {
18
18
  const { client } = useSeamClient()
19
19
 
20
20
  const { data, ...rest } = useQuery<UseDeviceProvidersData, SeamHttpApiError>({
@@ -3,7 +3,7 @@ import type { Device } from '@seamapi/types/connect'
3
3
  import { useQuery } from '@tanstack/react-query'
4
4
 
5
5
  import { useSeamClient } from 'lib/seam/use-seam-client.js'
6
- import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
6
+ import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
7
7
 
8
8
  export type UseDeviceParams = DevicesGetParams
9
9
 
@@ -11,7 +11,7 @@ export type UseDeviceData = Device | null
11
11
 
12
12
  export function useDevice(
13
13
  params: UseDeviceParams
14
- ): UseSeamQueryResult<'device', UseDeviceData> {
14
+ ): UseSeamQueryResultLegacy<'device', UseDeviceData> {
15
15
  const { client } = useSeamClient()
16
16
  const { data, ...rest } = useQuery<UseDeviceData, SeamHttpApiError>({
17
17
  enabled: client != null,
@@ -3,7 +3,7 @@ import type { Device } from '@seamapi/types/connect'
3
3
  import { useQuery, useQueryClient } from '@tanstack/react-query'
4
4
 
5
5
  import { useSeamClient } from 'lib/seam/use-seam-client.js'
6
- import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
6
+ import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
7
7
 
8
8
  export type UseDevicesParams = DevicesListParams
9
9
 
@@ -11,7 +11,7 @@ export type UseDevicesData = Device[]
11
11
 
12
12
  export function useDevices(
13
13
  params?: UseDevicesParams
14
- ): UseSeamQueryResult<'devices', UseDevicesData> {
14
+ ): UseSeamQueryResultLegacy<'devices', UseDevicesData> {
15
15
  const { client } = useSeamClient()
16
16
  const queryClient = useQueryClient()
17
17
 
@@ -3,7 +3,7 @@ import type { SeamEvent } from '@seamapi/types/connect'
3
3
  import { useQuery, useQueryClient } from '@tanstack/react-query'
4
4
 
5
5
  import { useSeamClient } from 'lib/seam/use-seam-client.js'
6
- import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
6
+ import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
7
7
 
8
8
  export type UseEventsParams = EventsListParams
9
9
 
@@ -16,7 +16,7 @@ export interface UseEventsOptions {
16
16
  export function useEvents(
17
17
  params?: UseEventsParams,
18
18
  { refetchInterval }: UseEventsOptions = {}
19
- ): UseSeamQueryResult<'events', UseEventsData> {
19
+ ): UseSeamQueryResultLegacy<'events', UseEventsData> {
20
20
  const { client } = useSeamClient()
21
21
  const queryClient = useQueryClient()
22
22
 
@@ -12,4 +12,6 @@ export * from './devices/use-device-providers.js'
12
12
  export * from './devices/use-devices.js'
13
13
  export * from './SeamProvider.js'
14
14
  export * from './use-seam-client.js'
15
+ export * from './use-seam-mutation.js'
16
+ export * from './use-seam-query.js'
15
17
  export * from './use-seam-query-result.js'
@@ -6,7 +6,7 @@ import type { NoiseThreshold } from '@seamapi/types/connect'
6
6
  import { useQuery, useQueryClient } from '@tanstack/react-query'
7
7
 
8
8
  import { useSeamClient } from 'lib/seam/use-seam-client.js'
9
- import type { UseSeamQueryResult } from 'lib/seam/use-seam-query-result.js'
9
+ import type { UseSeamQueryResultLegacy } from 'lib/seam/use-seam-query-result.js'
10
10
 
11
11
  export type UseNoiseThresholdsParams = NoiseSensorsNoiseThresholdsListParams
12
12
 
@@ -14,7 +14,7 @@ export type UseNoiseThresholdsData = NoiseThreshold[]
14
14
 
15
15
  export function useNoiseThresholds(
16
16
  params: UseNoiseThresholdsParams
17
- ): UseSeamQueryResult<'noiseThresholds', UseNoiseThresholdsData> {
17
+ ): UseSeamQueryResultLegacy<'noiseThresholds', UseNoiseThresholdsData> {
18
18
  const { client } = useSeamClient()
19
19
  const queryClient = useQueryClient()
20
20
 
@@ -1,6 +1,6 @@
1
1
  import type {
2
2
  SeamHttpApiError,
3
- ThermostatsDeleteClimatePresetBody,
3
+ ThermostatsDeleteClimatePresetParams,
4
4
  } from '@seamapi/http/connect'
5
5
  import {
6
6
  useMutation,
@@ -16,7 +16,7 @@ export type UseDeleteThermostatClimatePresetParams = never
16
16
  export type UseDeleteThermostatClimatePresetData = undefined
17
17
 
18
18
  export type UseDeleteThermostatClimatePresetVariables =
19
- ThermostatsDeleteClimatePresetBody
19
+ ThermostatsDeleteClimatePresetParams
20
20
 
21
21
  export function useDeleteThermostatClimatePreset(): UseMutationResult<
22
22
  UseDeleteThermostatClimatePresetData,