@integration-app/react 0.2.1 → 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.
- package/dist/index.d.ts +371 -165
- package/dist/index.js +510 -234
- package/dist/index.js.map +1 -1
- package/dist/index.module.d.ts +371 -165
- package/dist/index.module.mjs +500 -235
- package/dist/index.module.mjs.map +1 -1
- package/dist/index.umd.d.ts +371 -165
- package/dist/index.umd.js +510 -238
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -2
- package/src/actions/useAction.ts +35 -0
- package/src/actions/useActionInstance.ts +56 -0
- package/src/actions/useActionInstances.ts +11 -0
- package/src/actions/useActions.ts +11 -0
- package/src/app-events/useAppEventSubscription.ts +6 -6
- package/src/app-events/useAppEventSubscriptions.ts +5 -4
- package/src/app-events/useAppEventType.ts +10 -7
- package/src/app-events/useAppEventTypes.ts +2 -4
- package/src/app-events/useAppEvents.ts +2 -4
- package/src/contexts/index.tsx +4 -0
- package/src/data-collections/useDataCollectionSpec.ts +26 -0
- package/src/data-links/useDataLinkTable.ts +18 -0
- package/src/data-links/useDataLinkTableInstance.ts +39 -0
- package/src/data-links/useDataLinkTableInstances.ts +19 -0
- package/src/data-links/useDataLinkTables.ts +11 -0
- package/src/data-sources/useDataSource.ts +29 -6
- package/src/data-sources/useDataSourceEvents.ts +2 -4
- package/src/data-sources/useDataSourceInstance.ts +120 -26
- package/src/data-sources/useDataSourceInstanceCollection.ts +14 -4
- package/src/data-sources/useDataSourceInstanceLocations.ts +17 -6
- package/src/data-sources/useDataSourceInstances.ts +5 -4
- package/src/data-sources/useDataSources.ts +2 -4
- package/src/field-mappings/useFieldMapping.ts +29 -8
- package/src/field-mappings/useFieldMappingInstance.ts +35 -12
- package/src/field-mappings/useFieldMappingInstances.ts +5 -4
- package/src/field-mappings/useFieldMappings.ts +2 -4
- package/src/flows/useFlow.ts +29 -8
- package/src/flows/useFlowInstance.ts +62 -5
- package/src/flows/useFlowInstances.ts +2 -4
- package/src/flows/useFlowRun.ts +18 -6
- package/src/flows/useFlowRuns.ts +5 -5
- package/src/flows/useFlows.ts +5 -5
- package/src/hooks/useElement.tsx +137 -149
- package/src/hooks/useElements.tsx +44 -73
- package/src/hooks/useIntegrationAppSWR.tsx +13 -0
- package/src/index.tsx +27 -14
- package/src/integrations/useConnection.ts +14 -5
- package/src/integrations/useConnections.ts +3 -4
- package/src/integrations/useConnectorSpec.ts +7 -18
- package/src/integrations/useIntegration.ts +11 -7
- package/src/integrations/useIntegrations.ts +3 -4
- package/src/screens/useScreen.ts +19 -0
- package/rollup.dts.config.mjs +0 -21
- package/src/flows/useFlowTemplate.ts +0 -0
- package/src/flows/useFlowTemplates.ts +0 -0
- package/src/hooks/useGetter.tsx +0 -38
@@ -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:
|
17
|
+
selector: string | DataSourceInstanceSelector,
|
14
18
|
) {
|
15
|
-
const {
|
19
|
+
const {
|
20
|
+
item: dataSourceInstance,
|
21
|
+
accessor,
|
22
|
+
refresh,
|
23
|
+
...rest
|
24
|
+
} = useElement<
|
16
25
|
DataSourceInstance,
|
17
|
-
|
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
|
-
|
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
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
3
|
+
import useSWR from 'swr'
|
4
4
|
|
5
5
|
export function useDataSourceInstanceCollection(
|
6
6
|
dataSourceInstance: DataSourceInstance,
|
7
7
|
) {
|
8
8
|
const integrationApp = useIntegrationApp()
|
9
|
-
|
10
|
-
|
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
|
-
|
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
|
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
|
-
|
17
|
+
|
18
|
+
const { data, error, isLoading, mutate } = useSWR<DataDirectoryListResponse>(
|
17
19
|
dataSourceInstance
|
18
|
-
? `${dataSourceInstance.id}
|
19
|
-
:
|
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
|
28
|
-
|
35
|
+
locations,
|
36
|
+
|
37
|
+
refresh,
|
38
|
+
error,
|
39
|
+
loading: isLoading,
|
29
40
|
}
|
30
41
|
}
|
@@ -5,12 +5,13 @@ import {
|
|
5
5
|
import { useElements } from '../hooks/useElements'
|
6
6
|
|
7
7
|
export function useDataSourceInstances(query?: FindDataSourceInstancesQuery) {
|
8
|
-
const { ...rest } = useElements<
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
const { ...rest } = useElements<DataSourceInstance>(
|
9
|
+
'data-source-instances',
|
10
|
+
query,
|
11
|
+
)
|
12
12
|
|
13
13
|
return {
|
14
|
+
dataSourceInstances: rest.items,
|
14
15
|
...rest,
|
15
16
|
}
|
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,
|
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 {
|
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(
|
5
|
-
const {
|
10
|
+
export function useFieldMapping(selector: FieldMappingSelector | string) {
|
11
|
+
const {
|
12
|
+
item: fieldMapping,
|
13
|
+
accessor,
|
14
|
+
refresh,
|
15
|
+
...rest
|
16
|
+
} = useElement<
|
6
17
|
FieldMapping,
|
7
|
-
|
18
|
+
UpdateFieldMappingRequest,
|
19
|
+
CreateFieldMappingRequest,
|
8
20
|
FieldMappingAccessor
|
9
|
-
>(
|
10
|
-
integrationApp.fieldMapping.bind(integrationApp),
|
11
|
-
)
|
21
|
+
>(selector, (integrationApp) => integrationApp.fieldMapping(selector))
|
12
22
|
|
13
|
-
|
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
|
}
|
@@ -3,29 +3,52 @@ import {
|
|
3
3
|
FieldMappingInstanceSelector,
|
4
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:
|
12
|
+
selector: string | FieldMappingInstanceSelector,
|
11
13
|
) {
|
12
|
-
const {
|
14
|
+
const {
|
15
|
+
item: fieldMappingInstance,
|
16
|
+
accessor,
|
17
|
+
refresh,
|
18
|
+
...rest
|
19
|
+
} = useElement<
|
13
20
|
FieldMappingInstance,
|
14
|
-
|
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
|
-
|
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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
44
|
+
|
45
|
+
accessor,
|
46
|
+
refresh,
|
47
|
+
|
48
|
+
setup,
|
49
|
+
reset,
|
50
|
+
openConfiguration,
|
51
|
+
|
29
52
|
...rest,
|
30
53
|
}
|
31
54
|
}
|
@@ -7,12 +7,13 @@ import { useElements } from '../hooks/useElements'
|
|
7
7
|
export function useFieldMappingInstances(
|
8
8
|
query?: FindFieldMappingInstancesQuery,
|
9
9
|
) {
|
10
|
-
const { ...rest } = useElements<
|
11
|
-
|
12
|
-
|
13
|
-
|
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,
|
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
|
}
|
package/src/flows/useFlow.ts
CHANGED
@@ -1,12 +1,33 @@
|
|
1
|
-
import {
|
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(
|
5
|
-
const {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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),
|
19
|
+
)
|
10
20
|
|
11
|
-
|
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 }
|
12
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(
|
9
|
-
const {
|
11
|
+
export function useFlowInstance(selector: string | FlowInstanceSelector) {
|
12
|
+
const {
|
13
|
+
item: flowInstance,
|
14
|
+
accessor,
|
15
|
+
refresh,
|
16
|
+
...rest
|
17
|
+
} = useElement<
|
10
18
|
FlowInstance,
|
11
|
-
|
19
|
+
UpdateFlowInstanceRequest,
|
20
|
+
UpdateFlowInstanceRequest,
|
12
21
|
FlowInstanceAccessor
|
13
|
-
>(
|
22
|
+
>(selector, (integrationApp) => integrationApp.flowInstance(selector))
|
14
23
|
|
15
|
-
|
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,
|
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
|
}
|
package/src/flows/useFlowRun.ts
CHANGED
@@ -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 {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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 {
|
15
|
+
return {
|
16
|
+
flowRun,
|
17
|
+
|
18
|
+
error,
|
19
|
+
loading,
|
20
|
+
|
21
|
+
refresh,
|
22
|
+
archive,
|
23
|
+
}
|
12
24
|
}
|
package/src/flows/useFlowRuns.ts
CHANGED
@@ -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,
|
6
|
-
query,
|
7
|
-
(integrationApp) => integrationApp.flowRuns,
|
8
|
-
)
|
5
|
+
const { ...rest } = useElements<FlowRun>('flow-runs', query)
|
9
6
|
|
10
|
-
return {
|
7
|
+
return {
|
8
|
+
flowRuns: rest.items,
|
9
|
+
...rest,
|
10
|
+
}
|
11
11
|
}
|
package/src/flows/useFlows.ts
CHANGED
@@ -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,
|
6
|
-
query,
|
7
|
-
(integrationApp) => integrationApp.flows,
|
8
|
-
)
|
5
|
+
const { ...rest } = useElements<Flow>('flows', query)
|
9
6
|
|
10
|
-
return {
|
7
|
+
return {
|
8
|
+
flows: rest.items,
|
9
|
+
...rest,
|
10
|
+
}
|
11
11
|
}
|