@integration-app/react 0.2.0 → 0.3.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 (57) hide show
  1. package/README.md +49 -34
  2. package/dist/index.d.ts +377 -160
  3. package/dist/index.js +517 -226
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.module.d.ts +377 -160
  6. package/dist/index.module.mjs +506 -227
  7. package/dist/index.module.mjs.map +1 -1
  8. package/dist/index.umd.d.ts +377 -160
  9. package/dist/index.umd.js +517 -230
  10. package/dist/index.umd.js.map +1 -1
  11. package/package.json +16 -9
  12. package/src/actions/useAction.ts +35 -0
  13. package/src/actions/useActionInstance.ts +56 -0
  14. package/src/actions/useActionInstances.ts +11 -0
  15. package/src/actions/useActions.ts +11 -0
  16. package/src/app-events/useAppEventSubscription.ts +6 -6
  17. package/src/app-events/useAppEventSubscriptions.ts +5 -4
  18. package/src/app-events/useAppEventType.ts +10 -7
  19. package/src/app-events/useAppEventTypes.ts +2 -4
  20. package/src/app-events/useAppEvents.ts +2 -4
  21. package/src/contexts/index.tsx +4 -0
  22. package/src/contexts/integration-app-context.tsx +11 -2
  23. package/src/data-collections/useDataCollectionSpec.ts +26 -0
  24. package/src/data-links/useDataLinkTable.ts +18 -0
  25. package/src/data-links/useDataLinkTableInstance.ts +39 -0
  26. package/src/data-links/useDataLinkTableInstances.ts +19 -0
  27. package/src/data-links/useDataLinkTables.ts +11 -0
  28. package/src/data-sources/useDataSource.ts +29 -6
  29. package/src/data-sources/useDataSourceEvents.ts +2 -4
  30. package/src/data-sources/useDataSourceInstance.ts +120 -26
  31. package/src/data-sources/useDataSourceInstanceCollection.ts +14 -4
  32. package/src/data-sources/useDataSourceInstanceLocations.ts +17 -6
  33. package/src/data-sources/useDataSourceInstances.ts +17 -0
  34. package/src/data-sources/useDataSources.ts +2 -4
  35. package/src/field-mappings/useFieldMapping.ts +29 -8
  36. package/src/field-mappings/useFieldMappingInstance.ts +37 -14
  37. package/src/field-mappings/useFieldMappingInstances.ts +6 -5
  38. package/src/field-mappings/useFieldMappings.ts +2 -4
  39. package/src/flows/useFlow.ts +28 -6
  40. package/src/flows/useFlowInstance.ts +62 -5
  41. package/src/flows/useFlowInstances.ts +2 -4
  42. package/src/flows/useFlowRun.ts +18 -6
  43. package/src/flows/useFlowRuns.ts +5 -5
  44. package/src/flows/useFlows.ts +5 -5
  45. package/src/hooks/useElement.tsx +142 -136
  46. package/src/hooks/useElements.tsx +44 -73
  47. package/src/hooks/useIntegrationAppSWR.tsx +13 -0
  48. package/src/index.tsx +29 -16
  49. package/src/integrations/useConnection.ts +14 -5
  50. package/src/integrations/useConnections.ts +3 -4
  51. package/src/integrations/useConnectorSpec.ts +14 -0
  52. package/src/integrations/useIntegration.ts +11 -7
  53. package/src/integrations/useIntegrations.ts +3 -4
  54. package/src/screens/useScreen.ts +19 -0
  55. package/rollup.config.mjs +0 -64
  56. package/src/hooks/useGetter.tsx +0 -38
  57. package/src/integrations/useConnectionSpec.ts +0 -25
@@ -6,43 +6,137 @@ import {
6
6
  DataSourceInstanceSelector,
7
7
  OpenDataSourceConfigurationOptions,
8
8
  DataSourceInstance,
9
+ UpdateDataSourceInstanceRequest,
10
+ DataDirectoryListRequest,
11
+ DataCollectionListRequest,
12
+ CreateDataSourceInstanceRequest,
9
13
  } from '@integration-app/sdk'
10
14
  import { useElement } from '../hooks/useElement'
11
15
 
12
16
  export function useDataSourceInstance(
13
- selector: DataSourceInstanceSelector | { id: string },
17
+ selector: string | DataSourceInstanceSelector,
14
18
  ) {
15
- const { data: dataSourceInstance, ...rest } = useElement<
19
+ const {
20
+ item: dataSourceInstance,
21
+ accessor,
22
+ refresh,
23
+ ...rest
24
+ } = useElement<
16
25
  DataSourceInstance,
17
- DataSourceInstanceSelector,
26
+ UpdateDataSourceInstanceRequest,
27
+ CreateDataSourceInstanceRequest,
18
28
  DataSourceInstanceAccessor
19
- >(selector, (integrationApp) =>
20
- integrationApp.dataSourceInstance.bind(integrationApp),
21
- )
29
+ >(selector, (integrationApp) => integrationApp.dataSourceInstance(selector))
22
30
 
23
- const accessor = rest.accessor
31
+ async function setup() {
32
+ await accessor?.setup()
33
+ await refresh()
34
+ }
35
+
36
+ async function reset() {
37
+ await accessor?.reset()
38
+ await refresh()
39
+ }
40
+
41
+ async function subscribe(eventType) {
42
+ await accessor?.subscribe(eventType)
43
+ await refresh()
44
+ }
45
+
46
+ async function resubscribe(eventType) {
47
+ await accessor?.resubscribe(eventType)
48
+ await refresh()
49
+ }
50
+
51
+ async function unsubscribe(eventType) {
52
+ await accessor?.unsubscribe(eventType)
53
+ await refresh()
54
+ }
55
+
56
+ async function pullUpdates() {
57
+ await accessor?.pullUpdates()
58
+ await refresh()
59
+ }
60
+
61
+ async function fullSync() {
62
+ await accessor?.fullSync()
63
+ await refresh()
64
+ }
65
+
66
+ async function getSyncsList() {
67
+ return await accessor?.getSyncsList()
68
+ }
69
+
70
+ async function openConfiguration(
71
+ options?: OpenDataSourceConfigurationOptions,
72
+ ) {
73
+ return accessor?.openConfiguration(options)
74
+ }
75
+
76
+ async function listRecords(request?: DataCollectionListRequest) {
77
+ return accessor?.listRecords(request)
78
+ }
79
+
80
+ async function findRecords(request?: DataCollectionFindRequest) {
81
+ return accessor?.findRecords(request)
82
+ }
83
+
84
+ async function findRecordById(id: string) {
85
+ return accessor?.findRecordById(id)
86
+ }
87
+
88
+ async function createRecord(request?: DataCollectionCreateRequest) {
89
+ return accessor?.createRecord(request)
90
+ }
91
+
92
+ async function updateRecord(request?: DataCollectionUpdateRequest) {
93
+ return accessor?.updateRecord(request)
94
+ }
95
+
96
+ async function deleteRecord(id?: string) {
97
+ return accessor?.deleteRecord(id)
98
+ }
99
+
100
+ async function unifiedFieldsToNative(unifiedFields: any) {
101
+ return accessor?.unifiedFieldsToNative(unifiedFields)
102
+ }
103
+
104
+ async function getCollection() {
105
+ return accessor?.getCollection()
106
+ }
107
+
108
+ async function getLocations(
109
+ request: DataDirectoryListRequest & {
110
+ path?: string
111
+ },
112
+ ) {
113
+ return accessor?.getLocations(request)
114
+ }
24
115
 
25
116
  return {
26
117
  dataSourceInstance,
27
- setup: () => accessor.setup(),
28
- subscribe: (eventType) => accessor.subscribe(eventType),
29
- resubscribe: (eventType) => accessor.resubscribe(eventType),
30
- unsubscribe: (eventType) => accessor.unsubscribe(eventType),
31
- pullUpdates: () => accessor.pullUpdates(),
32
- fullSync: () => accessor.fullSync(),
33
- reset: () => accessor.reset(),
34
- openConfiguration: (options?: OpenDataSourceConfigurationOptions) =>
35
- accessor.openConfiguration(options),
36
- findRecords: (request?: DataCollectionFindRequest) =>
37
- accessor.findRecords(request),
38
- findRecordById: (id: string) => accessor.findRecordById(id),
39
- createRecord: (request?: DataCollectionCreateRequest) =>
40
- accessor.createRecord(request),
41
- updateRecord: (request?: DataCollectionUpdateRequest) =>
42
- accessor.updateRecord(request),
43
- deleteRecord: (id?: string) => accessor.deleteRecord(id),
44
- unifiedFieldsToNative: (unifiedFields: any) =>
45
- accessor.unifiedFieldsToNative(unifiedFields),
118
+ accessor,
119
+ refresh,
120
+
121
+ setup,
122
+ reset,
123
+ subscribe,
124
+ resubscribe,
125
+ unsubscribe,
126
+ pullUpdates,
127
+ fullSync,
128
+ getSyncsList,
129
+ openConfiguration,
130
+ listRecords,
131
+ findRecords,
132
+ findRecordById,
133
+ createRecord,
134
+ updateRecord,
135
+ deleteRecord,
136
+ unifiedFieldsToNative,
137
+ getLocations,
138
+ getCollection,
139
+
46
140
  ...rest,
47
141
  }
48
142
  }
@@ -1,19 +1,29 @@
1
1
  import { DataCollectionSpec, DataSourceInstance } from '@integration-app/sdk'
2
2
  import { useIntegrationApp } from '../contexts/integration-app-context'
3
- import useGetter from '../hooks/useGetter'
3
+ import useSWR from 'swr'
4
4
 
5
5
  export function useDataSourceInstanceCollection(
6
6
  dataSourceInstance: DataSourceInstance,
7
7
  ) {
8
8
  const integrationApp = useIntegrationApp()
9
- const { data: collection, ...rest } = useGetter<DataCollectionSpec>(
10
- dataSourceInstance?.id,
9
+
10
+ const { data, error, isLoading, mutate } = useSWR<DataCollectionSpec>(
11
+ dataSourceInstance ? `${dataSourceInstance.id}/collection` : null,
11
12
  () =>
12
13
  integrationApp.dataSourceInstance(dataSourceInstance.id).getCollection(),
13
14
  )
14
15
 
16
+ async function refresh() {
17
+ return await mutate()
18
+ }
19
+
20
+ const collection = data
21
+
15
22
  return {
16
23
  collection,
17
- ...rest,
24
+
25
+ refresh,
26
+ error,
27
+ loading: isLoading,
18
28
  }
19
29
  }
@@ -3,7 +3,8 @@ import {
3
3
  DataSourceInstance,
4
4
  } from '@integration-app/sdk'
5
5
  import { useIntegrationApp } from '../contexts/integration-app-context'
6
- import useGetter from '../hooks/useGetter'
6
+ import useSWR from 'swr'
7
+ import qs from 'query-string'
7
8
 
8
9
  export function useDataSourceInstanceLocations(
9
10
  dataSourceInstance: DataSourceInstance,
@@ -13,18 +14,28 @@ export function useDataSourceInstanceLocations(
13
14
  },
14
15
  ) {
15
16
  const integrationApp = useIntegrationApp()
16
- const { data, ...rest } = useGetter<DataDirectoryListResponse>(
17
+
18
+ const { data, error, isLoading, mutate } = useSWR<DataDirectoryListResponse>(
17
19
  dataSourceInstance
18
- ? `${dataSourceInstance.id}/${JSON.stringify(args)}`
19
- : undefined,
20
+ ? `${dataSourceInstance.id}/locations?${qs.stringify(args)}`
21
+ : null,
20
22
  () =>
21
23
  integrationApp
22
24
  .dataSourceInstance(dataSourceInstance.id)
23
25
  .getLocations(args),
24
26
  )
25
27
 
28
+ async function refresh() {
29
+ return await mutate()
30
+ }
31
+
32
+ const locations = data?.locations ?? []
33
+
26
34
  return {
27
- locations: data?.locations ?? [],
28
- ...rest,
35
+ locations,
36
+
37
+ refresh,
38
+ error,
39
+ loading: isLoading,
29
40
  }
30
41
  }
@@ -0,0 +1,17 @@
1
+ import {
2
+ FindDataSourceInstancesQuery,
3
+ DataSourceInstance,
4
+ } from '@integration-app/sdk'
5
+ import { useElements } from '../hooks/useElements'
6
+
7
+ export function useDataSourceInstances(query?: FindDataSourceInstancesQuery) {
8
+ const { ...rest } = useElements<DataSourceInstance>(
9
+ 'data-source-instances',
10
+ query,
11
+ )
12
+
13
+ return {
14
+ dataSourceInstances: rest.items,
15
+ ...rest,
16
+ }
17
+ }
@@ -2,12 +2,10 @@ import { DataSource, FindDataSourcesQuery } from '@integration-app/sdk'
2
2
  import { useElements } from '../hooks/useElements'
3
3
 
4
4
  export function useDataSources(query?: FindDataSourcesQuery) {
5
- const { ...rest } = useElements<DataSource, FindDataSourcesQuery>(
6
- query,
7
- (integrationApp) => integrationApp.dataSources,
8
- )
5
+ const { ...rest } = useElements<DataSource>('data-sources', query)
9
6
 
10
7
  return {
8
+ dataSources: rest.items,
11
9
  ...rest,
12
10
  }
13
11
  }
@@ -1,14 +1,35 @@
1
- import { FieldMapping, FieldMappingAccessor } from '@integration-app/sdk'
1
+ import {
2
+ CreateFieldMappingRequest,
3
+ FieldMapping,
4
+ FieldMappingAccessor,
5
+ FieldMappingSelector,
6
+ UpdateFieldMappingRequest,
7
+ } from '@integration-app/sdk'
2
8
  import { useElement } from '../hooks/useElement'
3
9
 
4
- export function useFieldMapping(idOrKey: string) {
5
- const { data: fieldMapping, ...rest } = useElement<
10
+ export function useFieldMapping(selector: FieldMappingSelector | string) {
11
+ const {
12
+ item: fieldMapping,
13
+ accessor,
14
+ refresh,
15
+ ...rest
16
+ } = useElement<
6
17
  FieldMapping,
7
- string,
18
+ UpdateFieldMappingRequest,
19
+ CreateFieldMappingRequest,
8
20
  FieldMappingAccessor
9
- >(idOrKey, (integrationApp) =>
10
- integrationApp.fieldMapping.bind(integrationApp),
11
- )
21
+ >(selector, (integrationApp) => integrationApp.fieldMapping(selector))
12
22
 
13
- return { fieldMapping, ...rest }
23
+ async function apply(integrationKeys: string[]): Promise<FieldMapping[]> {
24
+ const result = await accessor?.apply(integrationKeys)
25
+ await refresh()
26
+ return result
27
+ }
28
+
29
+ async function reset() {
30
+ await accessor?.reset()
31
+ await refresh()
32
+ }
33
+
34
+ return { fieldMapping, apply, reset, refresh, accessor, ...rest }
14
35
  }
@@ -1,31 +1,54 @@
1
1
  import {
2
2
  FieldMappingInstanceAccessor,
3
3
  FieldMappingInstanceSelector,
4
- IFieldMappingInstance,
4
+ FieldMappingInstance,
5
5
  OpenFieldMappingInstanceConfigurationOptions,
6
+ UpdateFieldMappingInstanceRequest,
7
+ CreateFieldMappingInstanceRequest,
6
8
  } from '@integration-app/sdk'
7
9
  import { useElement } from '../hooks/useElement'
8
10
 
9
11
  export function useFieldMappingInstance(
10
- selector: FieldMappingInstanceSelector | { id: string },
12
+ selector: string | FieldMappingInstanceSelector,
11
13
  ) {
12
- const { data: fieldMappingInstance, ...rest } = useElement<
13
- IFieldMappingInstance,
14
- FieldMappingInstanceSelector,
14
+ const {
15
+ item: fieldMappingInstance,
16
+ accessor,
17
+ refresh,
18
+ ...rest
19
+ } = useElement<
20
+ FieldMappingInstance,
21
+ UpdateFieldMappingInstanceRequest,
22
+ CreateFieldMappingInstanceRequest,
15
23
  FieldMappingInstanceAccessor
16
- >(selector, (integrationApp) =>
17
- integrationApp.fieldMappingInstance.bind(integrationApp),
18
- )
24
+ >(selector, (integrationApp) => integrationApp.fieldMappingInstance(selector))
19
25
 
20
- const accessor = rest.accessor
26
+ async function setup() {
27
+ await accessor?.setup()
28
+ await refresh()
29
+ }
30
+
31
+ async function reset() {
32
+ await accessor?.reset()
33
+ await refresh()
34
+ }
35
+
36
+ async function openConfiguration(
37
+ options?: OpenFieldMappingInstanceConfigurationOptions,
38
+ ) {
39
+ return accessor?.openConfiguration(options)
40
+ }
21
41
 
22
42
  return {
23
43
  fieldMappingInstance,
24
- setup: () => accessor.setup(),
25
- reset: () => accessor.reset(),
26
- openConfiguration: (
27
- options?: OpenFieldMappingInstanceConfigurationOptions,
28
- ) => accessor.openConfiguration(options),
44
+
45
+ accessor,
46
+ refresh,
47
+
48
+ setup,
49
+ reset,
50
+ openConfiguration,
51
+
29
52
  ...rest,
30
53
  }
31
54
  }
@@ -1,18 +1,19 @@
1
1
  import {
2
2
  FindFieldMappingInstancesQuery,
3
- IFieldMappingInstance,
3
+ FieldMappingInstance,
4
4
  } from '@integration-app/sdk'
5
5
  import { useElements } from '../hooks/useElements'
6
6
 
7
7
  export function useFieldMappingInstances(
8
8
  query?: FindFieldMappingInstancesQuery,
9
9
  ) {
10
- const { ...rest } = useElements<
11
- IFieldMappingInstance,
12
- FindFieldMappingInstancesQuery
13
- >(query, (integrationApp) => integrationApp.fieldMappingInstances)
10
+ const { ...rest } = useElements<FieldMappingInstance>(
11
+ 'field-mapping-instances',
12
+ query,
13
+ )
14
14
 
15
15
  return {
16
+ fieldMappingInstances: rest.items,
16
17
  ...rest,
17
18
  }
18
19
  }
@@ -2,12 +2,10 @@ import { FieldMapping, FindFieldMappingsQuery } from '@integration-app/sdk'
2
2
  import { useElements } from '../hooks/useElements'
3
3
 
4
4
  export function useFieldMappings(query?: FindFieldMappingsQuery) {
5
- const { ...rest } = useElements<FieldMapping, FindFieldMappingsQuery>(
6
- query,
7
- (integrationApp) => integrationApp.fieldMappings,
8
- )
5
+ const { ...rest } = useElements<FieldMapping>('field-mappings', query)
9
6
 
10
7
  return {
8
+ fieldMappings: rest.items,
11
9
  ...rest,
12
10
  }
13
11
  }
@@ -1,11 +1,33 @@
1
- import { Flow, FlowAccessor } from '@integration-app/sdk'
1
+ import {
2
+ CreateFlowRequest,
3
+ Flow,
4
+ FlowAccessor,
5
+ FlowSelector,
6
+ UpdateFlowRequest,
7
+ } from '@integration-app/sdk'
2
8
  import { useElement } from '../hooks/useElement'
3
9
 
4
- export function useFlow(idOrKey: string) {
5
- const { data: flow, ...rest } = useElement<Flow, string, FlowAccessor>(
6
- idOrKey,
7
- (integrationApp) => integrationApp.flow.bind(integrationApp),
10
+ export function useFlow(selector: string | FlowSelector) {
11
+ const {
12
+ item: flow,
13
+ accessor,
14
+ refresh,
15
+ ...rest
16
+ } = useElement<Flow, UpdateFlowRequest, CreateFlowRequest, FlowAccessor>(
17
+ selector,
18
+ (integrationApp) => integrationApp.flow(selector),
8
19
  )
9
20
 
10
- return { flow, ...rest }
21
+ async function apply(integrationKeys: string[]): Promise<Flow[]> {
22
+ const result = await accessor?.apply(integrationKeys)
23
+ await refresh()
24
+ return result
25
+ }
26
+
27
+ async function reset(): Promise<Flow> {
28
+ await accessor?.reset()
29
+ return await refresh()
30
+ }
31
+
32
+ return { flow, apply, reset, refresh, accessor, ...rest }
11
33
  }
@@ -2,15 +2,72 @@ import {
2
2
  FlowInstance,
3
3
  FlowInstanceAccessor,
4
4
  FlowInstanceSelector,
5
+ OpenFlowInstanceConfigurationOptions,
6
+ RunFlowOptions,
7
+ UpdateFlowInstanceRequest,
5
8
  } from '@integration-app/sdk'
6
9
  import { useElement } from '../hooks/useElement'
7
10
 
8
- export function useFlowInstance(props: FlowInstanceSelector | { id: string }) {
9
- const { data: flowInstance, ...rest } = useElement<
11
+ export function useFlowInstance(selector: string | FlowInstanceSelector) {
12
+ const {
13
+ item: flowInstance,
14
+ accessor,
15
+ refresh,
16
+ ...rest
17
+ } = useElement<
10
18
  FlowInstance,
11
- FlowInstanceSelector,
19
+ UpdateFlowInstanceRequest,
20
+ UpdateFlowInstanceRequest,
12
21
  FlowInstanceAccessor
13
- >(props, (integrationApp) => integrationApp.flowInstance.bind(integrationApp))
22
+ >(selector, (integrationApp) => integrationApp.flowInstance(selector))
14
23
 
15
- return { flowInstance, ...rest }
24
+ async function enable() {
25
+ await accessor?.enable()
26
+ await refresh()
27
+ }
28
+
29
+ async function disable() {
30
+ await accessor?.disable()
31
+ await refresh()
32
+ }
33
+
34
+ async function reset() {
35
+ await accessor?.reset()
36
+ await refresh()
37
+ }
38
+
39
+ async function setup() {
40
+ await accessor?.setup()
41
+ await refresh()
42
+ }
43
+
44
+ async function openConfiguration(
45
+ options: OpenFlowInstanceConfigurationOptions,
46
+ ) {
47
+ return accessor?.openConfiguration(options)
48
+ }
49
+
50
+ async function run(options: RunFlowOptions = {}) {
51
+ return accessor?.run(options)
52
+ }
53
+
54
+ async function startRun(options: RunFlowOptions = {}) {
55
+ return accessor?.startRun(options)
56
+ }
57
+
58
+ return {
59
+ flowInstance,
60
+ accessor,
61
+ refresh,
62
+
63
+ enable,
64
+ disable,
65
+ reset,
66
+ setup,
67
+ openConfiguration,
68
+ run,
69
+ startRun,
70
+
71
+ ...rest,
72
+ }
16
73
  }
@@ -2,12 +2,10 @@ import { FindFlowInstancesQuery, FlowInstance } from '@integration-app/sdk'
2
2
  import { useElements } from '../hooks/useElements'
3
3
 
4
4
  export function useFlowInstances(query?: FindFlowInstancesQuery) {
5
- const { ...rest } = useElements<FlowInstance, FindFlowInstancesQuery>(
6
- query,
7
- (integrationApp) => integrationApp.flowInstances,
8
- )
5
+ const { ...rest } = useElements<FlowInstance>('flow-instances', query)
9
6
 
10
7
  return {
8
+ flowInstances: rest.items,
11
9
  ...rest,
12
10
  }
13
11
  }
@@ -2,11 +2,23 @@ import { FlowRun, FlowRunAccessor } from '@integration-app/sdk'
2
2
  import { useElement } from '../hooks/useElement'
3
3
 
4
4
  export function useFlowRun(id: string) {
5
- const { data: flowRun, ...rest } = useElement<
6
- FlowRun,
7
- string,
8
- FlowRunAccessor
9
- >(id, (integrationApp) => integrationApp.flowRun.bind(integrationApp))
5
+ const {
6
+ item: flowRun,
7
+ archive,
8
+ refresh,
9
+ error,
10
+ loading,
11
+ } = useElement<FlowRun, never, never, FlowRunAccessor>(id, (integrationApp) =>
12
+ integrationApp.flowRun(id),
13
+ )
10
14
 
11
- return { flowRun, ...rest }
15
+ return {
16
+ flowRun,
17
+
18
+ error,
19
+ loading,
20
+
21
+ refresh,
22
+ archive,
23
+ }
12
24
  }
@@ -2,10 +2,10 @@ import { FindFlowRunsRequest, FlowRun } from '@integration-app/sdk'
2
2
  import { useElements } from '../hooks/useElements'
3
3
 
4
4
  export function useFlowRuns(query?: FindFlowRunsRequest) {
5
- const { ...rest } = useElements<FlowRun, FindFlowRunsRequest>(
6
- query,
7
- (integrationApp) => integrationApp.flowRuns,
8
- )
5
+ const { ...rest } = useElements<FlowRun>('flow-runs', query)
9
6
 
10
- return { ...rest }
7
+ return {
8
+ flowRuns: rest.items,
9
+ ...rest,
10
+ }
11
11
  }
@@ -2,10 +2,10 @@ import { useElements } from '../hooks/useElements'
2
2
  import { FindFlowsRequest, Flow } from '@integration-app/sdk'
3
3
 
4
4
  export function useFlows(query?: FindFlowsRequest) {
5
- const { ...rest } = useElements<Flow, FindFlowsRequest>(
6
- query,
7
- (integrationApp) => integrationApp.flows,
8
- )
5
+ const { ...rest } = useElements<Flow>('flows', query)
9
6
 
10
- return { ...rest }
7
+ return {
8
+ flows: rest.items,
9
+ ...rest,
10
+ }
11
11
  }