@integration-app/react 2.0.0-beta.0 → 2.0.2

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 (145) hide show
  1. package/package.json +17 -10
  2. package/DEVELOPMENT.md +0 -82
  3. package/bundle-tests/test-frameworks/README.md +0 -4
  4. package/bundle-tests/test-frameworks/cra5react17/package-lock.json +0 -30749
  5. package/bundle-tests/test-frameworks/cra5react17/package.json +0 -42
  6. package/bundle-tests/test-frameworks/cra5react17/patches/react-scripts+5.0.0.patch +0 -15
  7. package/bundle-tests/test-frameworks/cra5react17/public/favicon.ico +0 -0
  8. package/bundle-tests/test-frameworks/cra5react17/public/index.html +0 -43
  9. package/bundle-tests/test-frameworks/cra5react17/public/logo192.png +0 -0
  10. package/bundle-tests/test-frameworks/cra5react17/public/logo512.png +0 -0
  11. package/bundle-tests/test-frameworks/cra5react17/public/manifest.json +0 -25
  12. package/bundle-tests/test-frameworks/cra5react17/public/robots.txt +0 -3
  13. package/bundle-tests/test-frameworks/cra5react17/src/IntegrationsTest.jsx +0 -42
  14. package/bundle-tests/test-frameworks/cra5react17/src/index.tsx +0 -10
  15. package/bundle-tests/test-frameworks/cra5react17/src/react-app-env.d.ts +0 -1
  16. package/bundle-tests/test-frameworks/cra5react17/tsconfig.json +0 -26
  17. package/bundle-tests/test-frameworks/cra5react18/package-lock.json +0 -30328
  18. package/bundle-tests/test-frameworks/cra5react18/package.json +0 -38
  19. package/bundle-tests/test-frameworks/cra5react18/public/favicon.ico +0 -0
  20. package/bundle-tests/test-frameworks/cra5react18/public/index.html +0 -43
  21. package/bundle-tests/test-frameworks/cra5react18/public/logo192.png +0 -0
  22. package/bundle-tests/test-frameworks/cra5react18/public/logo512.png +0 -0
  23. package/bundle-tests/test-frameworks/cra5react18/public/manifest.json +0 -25
  24. package/bundle-tests/test-frameworks/cra5react18/public/robots.txt +0 -3
  25. package/bundle-tests/test-frameworks/cra5react18/src/IntegrationsTest.jsx +0 -42
  26. package/bundle-tests/test-frameworks/cra5react18/src/index.tsx +0 -10
  27. package/bundle-tests/test-frameworks/cra5react18/src/logo.svg +0 -1
  28. package/bundle-tests/test-frameworks/cra5react18/src/react-app-env.d.ts +0 -1
  29. package/bundle-tests/test-frameworks/cra5react18/tsconfig.json +0 -26
  30. package/bundle-tests/test-frameworks/next12react17/next.config.js +0 -6
  31. package/bundle-tests/test-frameworks/next12react17/package.json +0 -18
  32. package/bundle-tests/test-frameworks/next12react17/pages/_app.js +0 -5
  33. package/bundle-tests/test-frameworks/next12react17/pages/index.js +0 -5
  34. package/bundle-tests/test-frameworks/next12react17/src/IntegrationsTest.jsx +0 -25
  35. package/bundle-tests/test-frameworks/next12react18/next.config.js +0 -6
  36. package/bundle-tests/test-frameworks/next12react18/package.json +0 -18
  37. package/bundle-tests/test-frameworks/next12react18/pages/_app.js +0 -5
  38. package/bundle-tests/test-frameworks/next12react18/pages/index.js +0 -5
  39. package/bundle-tests/test-frameworks/next12react18/src/IntegrationsTest.jsx +0 -41
  40. package/bundle-tests/test-frameworks/next13react18/app/layout.tsx +0 -18
  41. package/bundle-tests/test-frameworks/next13react18/app/page.tsx +0 -5
  42. package/bundle-tests/test-frameworks/next13react18/next-env.d.ts +0 -5
  43. package/bundle-tests/test-frameworks/next13react18/next.config.js +0 -6
  44. package/bundle-tests/test-frameworks/next13react18/package.json +0 -22
  45. package/bundle-tests/test-frameworks/next13react18/src/IntegrationsTest.tsx +0 -43
  46. package/bundle-tests/test-frameworks/next13react18/src/IntegrationsTestReact.tsx +0 -28
  47. package/bundle-tests/test-frameworks/next13react18/src/IntegrationsTestSdk.tsx +0 -19
  48. package/bundle-tests/test-frameworks/next13react18/tsconfig.json +0 -34
  49. package/bundle-tests/test-frameworks/parcel2react17/package.json +0 -21
  50. package/bundle-tests/test-frameworks/parcel2react17/src/IntegrationsTest.js +0 -41
  51. package/bundle-tests/test-frameworks/parcel2react17/src/index.html +0 -12
  52. package/bundle-tests/test-frameworks/parcel2react17/src/index.js +0 -12
  53. package/bundle-tests/test-frameworks/parcel2react18/package.json +0 -21
  54. package/bundle-tests/test-frameworks/parcel2react18/src/IntegrationsTest.js +0 -41
  55. package/bundle-tests/test-frameworks/parcel2react18/src/index.html +0 -12
  56. package/bundle-tests/test-frameworks/parcel2react18/src/index.js +0 -11
  57. package/bundle-tests/test-frameworks/vite3react17/index.html +0 -12
  58. package/bundle-tests/test-frameworks/vite3react17/package.json +0 -26
  59. package/bundle-tests/test-frameworks/vite3react17/src/IntegrationsTest.tsx +0 -41
  60. package/bundle-tests/test-frameworks/vite3react17/src/main.tsx +0 -10
  61. package/bundle-tests/test-frameworks/vite3react17/src/vite-env.d.ts +0 -1
  62. package/bundle-tests/test-frameworks/vite3react17/tsconfig.json +0 -25
  63. package/bundle-tests/test-frameworks/vite3react17/tsconfig.node.json +0 -10
  64. package/bundle-tests/test-frameworks/vite3react17/vite.config.ts +0 -7
  65. package/bundle-tests/test-frameworks/vite4react17/index.html +0 -12
  66. package/bundle-tests/test-frameworks/vite4react17/package.json +0 -26
  67. package/bundle-tests/test-frameworks/vite4react17/src/IntegrationsTest.tsx +0 -41
  68. package/bundle-tests/test-frameworks/vite4react17/src/main.tsx +0 -10
  69. package/bundle-tests/test-frameworks/vite4react17/src/vite-env.d.ts +0 -1
  70. package/bundle-tests/test-frameworks/vite4react17/tsconfig.json +0 -25
  71. package/bundle-tests/test-frameworks/vite4react17/tsconfig.node.json +0 -10
  72. package/bundle-tests/test-frameworks/vite4react17/vite.config.ts +0 -7
  73. package/bundle-tests/test-frameworks/vite4react18/index.html +0 -12
  74. package/bundle-tests/test-frameworks/vite4react18/package.json +0 -26
  75. package/bundle-tests/test-frameworks/vite4react18/src/IntegrationsTest.tsx +0 -41
  76. package/bundle-tests/test-frameworks/vite4react18/src/main.tsx +0 -11
  77. package/bundle-tests/test-frameworks/vite4react18/src/vite-env.d.ts +0 -1
  78. package/bundle-tests/test-frameworks/vite4react18/tsconfig.json +0 -25
  79. package/bundle-tests/test-frameworks/vite4react18/tsconfig.node.json +0 -10
  80. package/bundle-tests/test-frameworks/vite4react18/vite.config.ts +0 -7
  81. package/bundle-tests/test-package/package.json +0 -10
  82. package/bundle-tests/test-package/test-cjs.js +0 -11
  83. package/bundle-tests/test-package/test-esm.mjs +0 -11
  84. package/bundle-tests/test-package/test-umd.js +0 -25
  85. package/bundle-tests/test-package/test.sh +0 -29
  86. package/dist/index.umd.d.ts +0 -625
  87. package/dist/index.umd.js +0 -799
  88. package/dist/index.umd.js.map +0 -1
  89. package/src/_modules/README.txt +0 -1
  90. package/src/_modules/awesome-debounce-promise.ts +0 -8
  91. package/src/contexts/index.tsx +0 -4
  92. package/src/contexts/integration-app-context.tsx +0 -61
  93. package/src/hooks/actions/useAction.ts +0 -37
  94. package/src/hooks/actions/useActionInstance.ts +0 -60
  95. package/src/hooks/actions/useActionInstances.ts +0 -11
  96. package/src/hooks/actions/useActions.ts +0 -11
  97. package/src/hooks/app-data-schemas/useAppDataSchema.ts +0 -20
  98. package/src/hooks/app-data-schemas/useAppDataSchemaInstance.ts +0 -43
  99. package/src/hooks/app-data-schemas/useAppDataSchemaInstances.ts +0 -19
  100. package/src/hooks/app-data-schemas/useAppDataSchemas.ts +0 -11
  101. package/src/hooks/app-events/useAppEventSubscription.ts +0 -22
  102. package/src/hooks/app-events/useAppEventSubscriptions.ts +0 -19
  103. package/src/hooks/app-events/useAppEventType.ts +0 -20
  104. package/src/hooks/app-events/useAppEventTypes.ts +0 -11
  105. package/src/hooks/app-events/useAppEvents.ts +0 -11
  106. package/src/hooks/customers/useCustomer.ts +0 -19
  107. package/src/hooks/customers/useCustomers.ts +0 -11
  108. package/src/hooks/data-collections/useDataCollectionSpec.ts +0 -30
  109. package/src/hooks/data-form/index.tsx +0 -3
  110. package/src/hooks/data-links/useDataLinkTable.ts +0 -20
  111. package/src/hooks/data-links/useDataLinkTableInstance.ts +0 -39
  112. package/src/hooks/data-links/useDataLinkTableInstances.ts +0 -19
  113. package/src/hooks/data-links/useDataLinkTables.ts +0 -11
  114. package/src/hooks/data-sources/useDataSource.ts +0 -39
  115. package/src/hooks/data-sources/useDataSourceInstance.ts +0 -105
  116. package/src/hooks/data-sources/useDataSourceInstanceCollection.ts +0 -29
  117. package/src/hooks/data-sources/useDataSourceInstances.ts +0 -17
  118. package/src/hooks/data-sources/useDataSources.ts +0 -11
  119. package/src/hooks/external-events/useExternalEventSubscription.ts +0 -60
  120. package/src/hooks/external-events/useExternalEventSubscriptions.ts +0 -19
  121. package/src/hooks/field-mappings/useFieldMapping.ts +0 -39
  122. package/src/hooks/field-mappings/useFieldMappingInstance.ts +0 -56
  123. package/src/hooks/field-mappings/useFieldMappingInstances.ts +0 -19
  124. package/src/hooks/field-mappings/useFieldMappings.ts +0 -11
  125. package/src/hooks/flows/useFlow.ts +0 -35
  126. package/src/hooks/flows/useFlowInstance.ts +0 -79
  127. package/src/hooks/flows/useFlowInstances.ts +0 -11
  128. package/src/hooks/flows/useFlowRun.ts +0 -24
  129. package/src/hooks/flows/useFlowRuns.ts +0 -11
  130. package/src/hooks/flows/useFlows.ts +0 -11
  131. package/src/hooks/integrations/useConnection.ts +0 -21
  132. package/src/hooks/integrations/useConnections.ts +0 -12
  133. package/src/hooks/integrations/useConnectorSpec.ts +0 -16
  134. package/src/hooks/integrations/useIntegration.ts +0 -20
  135. package/src/hooks/integrations/useIntegrations.ts +0 -12
  136. package/src/hooks/scenarios/useScenario.tsx +0 -20
  137. package/src/hooks/scenarios/useScenarios.tsx +0 -11
  138. package/src/hooks/screens/useScreen.ts +0 -19
  139. package/src/hooks/useElement.tsx +0 -199
  140. package/src/hooks/useElements.tsx +0 -108
  141. package/src/hooks/useIntegrationAppSWR.tsx +0 -13
  142. package/src/hooks/useIntegrationElement.tsx +0 -19
  143. package/src/index.tsx +0 -70
  144. package/tsconfig.json +0 -40
  145. /package/dist/{index.module.d.ts → index.module.d.mts} +0 -0
@@ -1,105 +0,0 @@
1
- import {
2
- DataCollectionCreateRequest,
3
- DataCollectionFindRequest,
4
- DataCollectionUpdateRequest,
5
- DataSourceInstanceAccessor,
6
- DataSourceInstanceSelector,
7
- OpenDataSourceConfigurationOptions,
8
- DataSourceInstance,
9
- UpdateDataSourceInstanceRequest,
10
- DataCollectionListRequest,
11
- CreateDataSourceInstanceRequest,
12
- } from '@integration-app/sdk'
13
- import { useElement } from '../useElement'
14
-
15
- export function useDataSourceInstance(
16
- selector: string | DataSourceInstanceSelector | undefined,
17
- ) {
18
- const {
19
- item: dataSourceInstance,
20
- accessor,
21
- refresh,
22
- ...rest
23
- } = useElement<
24
- DataSourceInstance,
25
- UpdateDataSourceInstanceRequest,
26
- CreateDataSourceInstanceRequest,
27
- DataSourceInstanceAccessor
28
- >(selector, (integrationApp) =>
29
- selector ? integrationApp.dataSourceInstance(selector) : undefined,
30
- )
31
-
32
- async function setup() {
33
- await accessor?.setup()
34
- await refresh()
35
- }
36
-
37
- async function reset() {
38
- await accessor?.reset()
39
- await refresh()
40
- }
41
-
42
- async function openConfiguration(
43
- options?: OpenDataSourceConfigurationOptions,
44
- ) {
45
- return accessor?.openConfiguration(options)
46
- }
47
-
48
- async function listRecords(request?: DataCollectionListRequest) {
49
- return accessor?.listRecords(request)
50
- }
51
-
52
- async function findRecords(request?: DataCollectionFindRequest) {
53
- return accessor?.findRecords(request)
54
- }
55
-
56
- async function findRecordById(id: string) {
57
- return accessor?.findRecordById(id)
58
- }
59
-
60
- async function createRecord(request?: DataCollectionCreateRequest) {
61
- /* FIXME: strictNullCheck temporary fix */
62
- // @ts-expect-error TS(2345): Argument of type 'DataCollectionCreateRequest | un... Remove this comment to see the full error message
63
- return accessor?.createRecord(request)
64
- }
65
-
66
- async function updateRecord(request?: DataCollectionUpdateRequest) {
67
- /* FIXME: strictNullCheck temporary fix */
68
- // @ts-expect-error TS(2345): Argument of type 'DataCollectionUpdateRequest | un... Remove this comment to see the full error message
69
- return accessor?.updateRecord(request)
70
- }
71
-
72
- async function deleteRecord(id?: string) {
73
- /* FIXME: strictNullCheck temporary fix */
74
- // @ts-expect-error TS(2345): Argument of type 'string | undefined' is not assig... Remove this comment to see the full error message
75
- return accessor?.deleteRecord(id)
76
- }
77
-
78
- async function unifiedFieldsToNative(unifiedFields: any) {
79
- return accessor?.unifiedFieldsToNative(unifiedFields)
80
- }
81
-
82
- async function getCollection() {
83
- return accessor?.getCollection()
84
- }
85
-
86
- return {
87
- dataSourceInstance,
88
- accessor,
89
- refresh,
90
-
91
- setup,
92
- reset,
93
- openConfiguration,
94
- listRecords,
95
- findRecords,
96
- findRecordById,
97
- createRecord,
98
- updateRecord,
99
- deleteRecord,
100
- unifiedFieldsToNative,
101
- getCollection,
102
-
103
- ...rest,
104
- }
105
- }
@@ -1,29 +0,0 @@
1
- import { DataCollectionSpec, DataSourceInstance } from '@integration-app/sdk'
2
- import { useIntegrationApp } from '../../contexts/integration-app-context'
3
- import useSWR from 'swr'
4
-
5
- export function useDataSourceInstanceCollection(
6
- dataSourceInstance: DataSourceInstance,
7
- ) {
8
- const integrationApp = useIntegrationApp()
9
-
10
- const { data, error, isLoading, mutate } = useSWR<DataCollectionSpec>(
11
- dataSourceInstance ? `${dataSourceInstance.id}/collection` : null,
12
- () =>
13
- integrationApp.dataSourceInstance(dataSourceInstance.id).getCollection(),
14
- )
15
-
16
- async function refresh() {
17
- return await mutate()
18
- }
19
-
20
- const collection = data
21
-
22
- return {
23
- collection,
24
-
25
- refresh,
26
- error,
27
- loading: isLoading,
28
- }
29
- }
@@ -1,17 +0,0 @@
1
- import {
2
- FindDataSourceInstancesQuery,
3
- DataSourceInstance,
4
- } from '@integration-app/sdk'
5
- import { useElements } from '../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
- }
@@ -1,11 +0,0 @@
1
- import { DataSource, FindDataSourcesQuery } from '@integration-app/sdk'
2
- import { useElements } from '../useElements'
3
-
4
- export function useDataSources(query?: FindDataSourcesQuery) {
5
- const { ...rest } = useElements<DataSource>('data-sources', query)
6
-
7
- return {
8
- dataSources: rest.items,
9
- ...rest,
10
- }
11
- }
@@ -1,60 +0,0 @@
1
- import {
2
- ExternalEventSubscription,
3
- ExternalEventSubscriptionAccessor,
4
- } from '@integration-app/sdk'
5
- import { useElement } from '../useElement'
6
-
7
- export function useExternalEventSubscription(id: string | undefined) {
8
- const {
9
- item: externalEventSubscription,
10
- accessor,
11
- refresh,
12
- ...rest
13
- } = useElement<
14
- ExternalEventSubscription,
15
- undefined,
16
- undefined,
17
- ExternalEventSubscriptionAccessor
18
- >(id, (integrationApp) =>
19
- id ? integrationApp.externalEventSubscription(id) : undefined,
20
- )
21
-
22
- async function setup() {
23
- await accessor?.setup()
24
- await refresh()
25
- }
26
-
27
- async function subscribe() {
28
- await accessor?.subscribe()
29
- await refresh()
30
- }
31
-
32
- async function resubscribe() {
33
- await accessor?.resubscribe()
34
- await refresh()
35
- }
36
-
37
- async function unsubscribe() {
38
- await accessor?.unsubscribe()
39
- await refresh()
40
- }
41
-
42
- async function pullEvents() {
43
- await accessor?.pullEvents()
44
- await refresh()
45
- }
46
-
47
- return {
48
- externalEventSubscription,
49
- accessor,
50
- refresh,
51
-
52
- setup,
53
- subscribe,
54
- resubscribe,
55
- unsubscribe,
56
- pullEvents,
57
-
58
- ...rest,
59
- }
60
- }
@@ -1,19 +0,0 @@
1
- import {
2
- FindExternalEventSubscriptionsQuery,
3
- ExternalEventSubscription,
4
- } from '@integration-app/sdk'
5
- import { useElements } from '../useElements'
6
-
7
- export function useExternalEventSubscriptions(
8
- query?: FindExternalEventSubscriptionsQuery,
9
- ) {
10
- const { ...rest } = useElements<ExternalEventSubscription>(
11
- 'external-event-subscriptions',
12
- query,
13
- )
14
-
15
- return {
16
- externalEventSubscriptions: rest.items,
17
- ...rest,
18
- }
19
- }
@@ -1,39 +0,0 @@
1
- import {
2
- CreateFieldMappingRequest,
3
- FieldMapping,
4
- FieldMappingAccessor,
5
- FieldMappingSelector,
6
- UpdateFieldMappingRequest,
7
- } from '@integration-app/sdk'
8
- import { useElement } from '../useElement'
9
-
10
- export function useFieldMapping(
11
- selector: FieldMappingSelector | string | undefined,
12
- ) {
13
- const {
14
- item: fieldMapping,
15
- accessor,
16
- refresh,
17
- ...rest
18
- } = useElement<
19
- FieldMapping,
20
- UpdateFieldMappingRequest,
21
- CreateFieldMappingRequest,
22
- FieldMappingAccessor
23
- >(selector, (integrationApp) =>
24
- selector ? integrationApp.fieldMapping(selector) : undefined,
25
- )
26
-
27
- async function apply(integrationKeys: string[]): Promise<FieldMapping[]> {
28
- const result = await accessor?.apply(integrationKeys)
29
- await refresh()
30
- return result ?? []
31
- }
32
-
33
- async function reset() {
34
- await accessor?.reset()
35
- await refresh()
36
- }
37
-
38
- return { fieldMapping, apply, reset, refresh, accessor, ...rest }
39
- }
@@ -1,56 +0,0 @@
1
- import {
2
- FieldMappingInstanceAccessor,
3
- FieldMappingInstanceSelector,
4
- FieldMappingInstance,
5
- OpenFieldMappingInstanceConfigurationOptions,
6
- UpdateFieldMappingInstanceRequest,
7
- CreateFieldMappingInstanceRequest,
8
- } from '@integration-app/sdk'
9
- import { useElement } from '../useElement'
10
-
11
- export function useFieldMappingInstance(
12
- selector: string | FieldMappingInstanceSelector | undefined,
13
- ) {
14
- const {
15
- item: fieldMappingInstance,
16
- accessor,
17
- refresh,
18
- ...rest
19
- } = useElement<
20
- FieldMappingInstance,
21
- UpdateFieldMappingInstanceRequest,
22
- CreateFieldMappingInstanceRequest,
23
- FieldMappingInstanceAccessor
24
- >(selector, (integrationApp) =>
25
- selector ? integrationApp.fieldMappingInstance(selector) : undefined,
26
- )
27
-
28
- async function setup() {
29
- await accessor?.setup()
30
- await refresh()
31
- }
32
-
33
- async function reset() {
34
- await accessor?.reset()
35
- await refresh()
36
- }
37
-
38
- async function openConfiguration(
39
- options?: OpenFieldMappingInstanceConfigurationOptions,
40
- ) {
41
- return accessor?.openConfiguration(options)
42
- }
43
-
44
- return {
45
- fieldMappingInstance,
46
-
47
- accessor,
48
- refresh,
49
-
50
- setup,
51
- reset,
52
- openConfiguration,
53
-
54
- ...rest,
55
- }
56
- }
@@ -1,19 +0,0 @@
1
- import {
2
- FindFieldMappingInstancesQuery,
3
- FieldMappingInstance,
4
- } from '@integration-app/sdk'
5
- import { useElements } from '../useElements'
6
-
7
- export function useFieldMappingInstances(
8
- query?: FindFieldMappingInstancesQuery,
9
- ) {
10
- const { ...rest } = useElements<FieldMappingInstance>(
11
- 'field-mapping-instances',
12
- query,
13
- )
14
-
15
- return {
16
- fieldMappingInstances: rest.items,
17
- ...rest,
18
- }
19
- }
@@ -1,11 +0,0 @@
1
- import { FieldMapping, FindFieldMappingsQuery } from '@integration-app/sdk'
2
- import { useElements } from '../useElements'
3
-
4
- export function useFieldMappings(query?: FindFieldMappingsQuery) {
5
- const { ...rest } = useElements<FieldMapping>('field-mappings', query)
6
-
7
- return {
8
- fieldMappings: rest.items,
9
- ...rest,
10
- }
11
- }
@@ -1,35 +0,0 @@
1
- import {
2
- CreateFlowRequest,
3
- Flow,
4
- FlowAccessor,
5
- FlowSelector,
6
- UpdateFlowRequest,
7
- } from '@integration-app/sdk'
8
- import { useElement } from '../useElement'
9
-
10
- export function useFlow(selector: string | FlowSelector | undefined) {
11
- const {
12
- item: flow,
13
- accessor,
14
- refresh,
15
- ...rest
16
- } = useElement<Flow, UpdateFlowRequest, CreateFlowRequest, FlowAccessor>(
17
- selector,
18
- (integrationApp) => (selector ? integrationApp.flow(selector) : undefined),
19
- )
20
-
21
- async function apply(integrationKeys: string[]): Promise<Flow[]> {
22
- const result = await accessor?.apply(integrationKeys)
23
- await refresh()
24
- /* FIXME: strictNullCheck temporary fix */
25
- // @ts-expect-error TS(2322): Type 'Flow[] | undefined' is not assignable to typ... Remove this comment to see the full error message
26
- return result
27
- }
28
-
29
- async function reset(): Promise<Flow> {
30
- await accessor?.reset()
31
- return await refresh()
32
- }
33
-
34
- return { flow, apply, reset, refresh, accessor, ...rest }
35
- }
@@ -1,79 +0,0 @@
1
- import {
2
- CreateFlowInstanceRequestById,
3
- FlowInstance,
4
- FlowInstanceAccessor,
5
- FlowInstanceSelector,
6
- OpenFlowInstanceConfigurationOptions,
7
- ResetFlowInstanceOptions,
8
- RunFlowOptions,
9
- UpdateFlowInstanceRequest,
10
- } from '@integration-app/sdk'
11
- import { useElement } from '../useElement'
12
-
13
- export function useFlowInstance(
14
- selector: string | FlowInstanceSelector | undefined,
15
- ) {
16
- const {
17
- item: flowInstance,
18
- accessor,
19
- refresh,
20
- ...rest
21
- } = useElement<
22
- FlowInstance,
23
- UpdateFlowInstanceRequest,
24
- CreateFlowInstanceRequestById,
25
- FlowInstanceAccessor
26
- >(selector, (integrationApp) =>
27
- selector ? integrationApp.flowInstance(selector) : undefined,
28
- )
29
-
30
- async function enable() {
31
- await accessor?.enable()
32
- await refresh()
33
- }
34
-
35
- async function disable() {
36
- await accessor?.disable()
37
- await refresh()
38
- }
39
-
40
- async function reset(options?: ResetFlowInstanceOptions) {
41
- await accessor?.reset(options)
42
- await refresh()
43
- }
44
-
45
- async function setup() {
46
- await accessor?.setup()
47
- await refresh()
48
- }
49
-
50
- async function openConfiguration(
51
- options: OpenFlowInstanceConfigurationOptions,
52
- ) {
53
- return accessor?.openConfiguration(options)
54
- }
55
-
56
- async function run(options: RunFlowOptions = {}) {
57
- return accessor?.run(options)
58
- }
59
-
60
- async function startRun(options: RunFlowOptions = {}) {
61
- return accessor?.startRun(options)
62
- }
63
-
64
- return {
65
- flowInstance,
66
- accessor,
67
- refresh,
68
-
69
- enable,
70
- disable,
71
- reset,
72
- setup,
73
- openConfiguration,
74
- run,
75
- startRun,
76
-
77
- ...rest,
78
- }
79
- }
@@ -1,11 +0,0 @@
1
- import { FindFlowInstancesQuery, FlowInstance } from '@integration-app/sdk'
2
- import { useElements } from '../useElements'
3
-
4
- export function useFlowInstances(query?: FindFlowInstancesQuery) {
5
- const { ...rest } = useElements<FlowInstance>('flow-instances', query)
6
-
7
- return {
8
- flowInstances: rest.items,
9
- ...rest,
10
- }
11
- }
@@ -1,24 +0,0 @@
1
- import { FlowRun, FlowRunAccessor } from '@integration-app/sdk'
2
- import { useElement } from '../useElement'
3
-
4
- export function useFlowRun(id: string | undefined) {
5
- const {
6
- item: flowRun,
7
- archive,
8
- refresh,
9
- error,
10
- loading,
11
- } = useElement<FlowRun, never, never, FlowRunAccessor>(id, (integrationApp) =>
12
- id ? integrationApp.flowRun(id) : undefined,
13
- )
14
-
15
- return {
16
- flowRun,
17
-
18
- error,
19
- loading,
20
-
21
- refresh,
22
- archive,
23
- }
24
- }
@@ -1,11 +0,0 @@
1
- import { FindFlowRunsQuery, FlowRun } from '@integration-app/sdk'
2
- import { useElements } from '../useElements'
3
-
4
- export function useFlowRuns(query?: FindFlowRunsQuery) {
5
- const { ...rest } = useElements<FlowRun>('flow-runs', query)
6
-
7
- return {
8
- flowRuns: rest.items,
9
- ...rest,
10
- }
11
- }
@@ -1,11 +0,0 @@
1
- import { useElements } from '../useElements'
2
- import { FindFlowsQuery, Flow } from '@integration-app/sdk'
3
-
4
- export function useFlows(query?: FindFlowsQuery) {
5
- const { ...rest } = useElements<Flow>('flows', query)
6
-
7
- return {
8
- flows: rest.items,
9
- ...rest,
10
- }
11
- }
@@ -1,21 +0,0 @@
1
- import {
2
- Connection,
3
- ConnectionAccessor,
4
- CreateConnectionRequest,
5
- UpdateConnectionRequest,
6
- } from '@integration-app/sdk'
7
- import { useElement } from '../useElement'
8
-
9
- export function useConnection(id?: string | undefined) {
10
- const { item: connection, ...rest } = useElement<
11
- Connection,
12
- UpdateConnectionRequest,
13
- CreateConnectionRequest,
14
- ConnectionAccessor
15
- >(id, (integrationApp) => (id ? integrationApp.connection(id) : undefined))
16
-
17
- return {
18
- connection,
19
- ...rest,
20
- }
21
- }
@@ -1,12 +0,0 @@
1
- import { Connection, FindConnectionsQuery } from '@integration-app/sdk'
2
- import { useElements } from '../useElements'
3
-
4
- export function useConnections(query?: FindConnectionsQuery) {
5
- const { ...rest } = useElements<Connection>('connections', query)
6
-
7
- return {
8
- connections: rest.items,
9
-
10
- ...rest,
11
- }
12
- }
@@ -1,16 +0,0 @@
1
- import { ConnectionSpec } from '@integration-app/sdk'
2
- import useSWR from 'swr'
3
- import { useIntegrationApp } from '../../contexts/integration-app-context'
4
-
5
- export function useConnectorSpec(integrationIdOrKey: string) {
6
- const integrationApp = useIntegrationApp()
7
-
8
- const { data, isLoading, error } = useSWR<ConnectionSpec>(
9
- integrationIdOrKey
10
- ? `/integrations/${integrationIdOrKey}/connector-spec`
11
- : undefined,
12
- () => integrationApp.integration(integrationIdOrKey).getConnectorSpec(),
13
- )
14
-
15
- return { data, loading: isLoading, error }
16
- }
@@ -1,20 +0,0 @@
1
- import {
2
- CreateIntegrationRequest,
3
- Integration,
4
- IntegrationAccessor,
5
- UpdateIntegrationRequest,
6
- } from '@integration-app/sdk'
7
- import { useElement } from '../useElement'
8
-
9
- export function useIntegration(idOrKey: string | undefined) {
10
- const { item: integration, ...rest } = useElement<
11
- Integration,
12
- UpdateIntegrationRequest,
13
- CreateIntegrationRequest,
14
- IntegrationAccessor
15
- >(idOrKey, (integrationApp) =>
16
- idOrKey ? integrationApp.integration(idOrKey) : undefined,
17
- )
18
-
19
- return { integration, ...rest }
20
- }
@@ -1,12 +0,0 @@
1
- import { FindIntegrationsQuery, Integration } from '@integration-app/sdk'
2
- import { useElements } from '../useElements'
3
-
4
- export function useIntegrations(query?: FindIntegrationsQuery) {
5
- const { ...rest } = useElements<Integration>('integrations', query)
6
-
7
- return {
8
- integrations: rest.items,
9
-
10
- ...rest,
11
- }
12
- }
@@ -1,20 +0,0 @@
1
- import {
2
- CreateScenarioRequest,
3
- Scenario,
4
- ScenarioAccessor,
5
- UpdateScenarioRequest,
6
- } from '@integration-app/sdk'
7
- import { useElement } from '../useElement'
8
-
9
- export function useScenario(selector: string | undefined) {
10
- const { item: scenario, ...rest } = useElement<
11
- Scenario,
12
- UpdateScenarioRequest,
13
- CreateScenarioRequest,
14
- ScenarioAccessor
15
- >(selector, (integrationApp) =>
16
- selector ? integrationApp.scenario(selector) : undefined,
17
- )
18
-
19
- return { scenario, ...rest }
20
- }
@@ -1,11 +0,0 @@
1
- import { Scenario, FindScenariosQuery } from '@integration-app/sdk'
2
- import { useElements } from '../useElements'
3
-
4
- export function useScenarios(query?: FindScenariosQuery) {
5
- const { ...rest } = useElements<Scenario>('scenarios', query)
6
-
7
- return {
8
- scenarios: rest.items,
9
- ...rest,
10
- }
11
- }