@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
@@ -0,0 +1,19 @@
|
|
1
|
+
import {
|
2
|
+
CreateScreenRequest,
|
3
|
+
Screen,
|
4
|
+
ScreenAccessor,
|
5
|
+
ScreenSelector,
|
6
|
+
UpdateScreenRequest,
|
7
|
+
} from '@integration-app/sdk'
|
8
|
+
import { useElement } from '../hooks/useElement'
|
9
|
+
|
10
|
+
export function useScreen(selector: ScreenSelector | string) {
|
11
|
+
const { item: screen, ...rest } = useElement<
|
12
|
+
Screen,
|
13
|
+
UpdateScreenRequest,
|
14
|
+
CreateScreenRequest,
|
15
|
+
ScreenAccessor
|
16
|
+
>(selector, (integrationApp) => integrationApp.screen(selector))
|
17
|
+
|
18
|
+
return { screen, ...rest }
|
19
|
+
}
|
package/rollup.dts.config.mjs
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
// Flat dts files into one
|
2
|
-
import dts from 'rollup-plugin-dts'
|
3
|
-
|
4
|
-
const config = [
|
5
|
-
// Generate dts files for each bundle from *.d.ts files
|
6
|
-
{
|
7
|
-
input: './dist/dts/index.d.ts',
|
8
|
-
output: [
|
9
|
-
{ file: 'dist/index.d.ts', format: 'commonjs' },
|
10
|
-
{ file: 'dist/index.module.d.ts', format: 'es' },
|
11
|
-
{
|
12
|
-
file: 'dist/index.umd.d.ts',
|
13
|
-
format: 'umd',
|
14
|
-
name: 'integrationAppReact',
|
15
|
-
},
|
16
|
-
],
|
17
|
-
plugins: [dts()],
|
18
|
-
},
|
19
|
-
]
|
20
|
-
|
21
|
-
export default config
|
File without changes
|
File without changes
|
package/src/hooks/useGetter.tsx
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from 'react'
|
2
|
-
import { useIntegrationApp } from '../contexts/integration-app-context'
|
3
|
-
|
4
|
-
export default function useGetter<Type = any>(
|
5
|
-
key: string,
|
6
|
-
getter: () => Promise<Type>,
|
7
|
-
) {
|
8
|
-
const integrationApp = useIntegrationApp()
|
9
|
-
const [data, setData] = useState<Type>()
|
10
|
-
const [loading, setLoading] = useState<boolean>(true)
|
11
|
-
const [error, setError] = useState<Error>(null)
|
12
|
-
const [refreshCounter, setRefreshCounter] = useState<number>(0)
|
13
|
-
|
14
|
-
function refresh() {
|
15
|
-
setRefreshCounter(refreshCounter + 1)
|
16
|
-
}
|
17
|
-
|
18
|
-
useEffect(() => {
|
19
|
-
if (key !== undefined) {
|
20
|
-
setLoading(true)
|
21
|
-
setError(null)
|
22
|
-
if (integrationApp) {
|
23
|
-
getter()
|
24
|
-
.then(setData)
|
25
|
-
.catch(setError)
|
26
|
-
.finally(() => setLoading(false))
|
27
|
-
} else {
|
28
|
-
setError(
|
29
|
-
new Error(
|
30
|
-
'IntegrationApp not found. Was this component wrapped in <IntegrationAppProvider>?',
|
31
|
-
),
|
32
|
-
)
|
33
|
-
}
|
34
|
-
}
|
35
|
-
}, [integrationApp, key, refreshCounter])
|
36
|
-
|
37
|
-
return { data, loading, error, refresh }
|
38
|
-
}
|