@integration-app/react 2.0.1 → 2.0.3-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +19953 -3
- package/dist/index.js +807 -65
- package/dist/index.js.map +1 -1
- package/dist/index.module.d.mts +20575 -0
- package/dist/index.module.mjs +809 -68
- package/dist/index.module.mjs.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +46 -15
- package/DEVELOPMENT.md +0 -82
- package/bundle-tests/test-frameworks/README.md +0 -4
- package/bundle-tests/test-frameworks/cra5react17/package-lock.json +0 -30749
- package/bundle-tests/test-frameworks/cra5react17/package.json +0 -42
- package/bundle-tests/test-frameworks/cra5react17/patches/react-scripts+5.0.0.patch +0 -15
- package/bundle-tests/test-frameworks/cra5react17/public/favicon.ico +0 -0
- package/bundle-tests/test-frameworks/cra5react17/public/index.html +0 -43
- package/bundle-tests/test-frameworks/cra5react17/public/logo192.png +0 -0
- package/bundle-tests/test-frameworks/cra5react17/public/logo512.png +0 -0
- package/bundle-tests/test-frameworks/cra5react17/public/manifest.json +0 -25
- package/bundle-tests/test-frameworks/cra5react17/public/robots.txt +0 -3
- package/bundle-tests/test-frameworks/cra5react17/src/IntegrationsTest.jsx +0 -42
- package/bundle-tests/test-frameworks/cra5react17/src/index.tsx +0 -10
- package/bundle-tests/test-frameworks/cra5react17/src/react-app-env.d.ts +0 -1
- package/bundle-tests/test-frameworks/cra5react17/tsconfig.json +0 -26
- package/bundle-tests/test-frameworks/cra5react18/package-lock.json +0 -30328
- package/bundle-tests/test-frameworks/cra5react18/package.json +0 -38
- package/bundle-tests/test-frameworks/cra5react18/public/favicon.ico +0 -0
- package/bundle-tests/test-frameworks/cra5react18/public/index.html +0 -43
- package/bundle-tests/test-frameworks/cra5react18/public/logo192.png +0 -0
- package/bundle-tests/test-frameworks/cra5react18/public/logo512.png +0 -0
- package/bundle-tests/test-frameworks/cra5react18/public/manifest.json +0 -25
- package/bundle-tests/test-frameworks/cra5react18/public/robots.txt +0 -3
- package/bundle-tests/test-frameworks/cra5react18/src/IntegrationsTest.jsx +0 -42
- package/bundle-tests/test-frameworks/cra5react18/src/index.tsx +0 -10
- package/bundle-tests/test-frameworks/cra5react18/src/logo.svg +0 -1
- package/bundle-tests/test-frameworks/cra5react18/src/react-app-env.d.ts +0 -1
- package/bundle-tests/test-frameworks/cra5react18/tsconfig.json +0 -26
- package/bundle-tests/test-frameworks/next12react17/next.config.js +0 -6
- package/bundle-tests/test-frameworks/next12react17/package.json +0 -18
- package/bundle-tests/test-frameworks/next12react17/pages/_app.js +0 -5
- package/bundle-tests/test-frameworks/next12react17/pages/index.js +0 -5
- package/bundle-tests/test-frameworks/next12react17/src/IntegrationsTest.jsx +0 -25
- package/bundle-tests/test-frameworks/next12react18/next.config.js +0 -6
- package/bundle-tests/test-frameworks/next12react18/package.json +0 -18
- package/bundle-tests/test-frameworks/next12react18/pages/_app.js +0 -5
- package/bundle-tests/test-frameworks/next12react18/pages/index.js +0 -5
- package/bundle-tests/test-frameworks/next12react18/src/IntegrationsTest.jsx +0 -41
- package/bundle-tests/test-frameworks/next13react18/app/layout.tsx +0 -18
- package/bundle-tests/test-frameworks/next13react18/app/page.tsx +0 -5
- package/bundle-tests/test-frameworks/next13react18/next-env.d.ts +0 -5
- package/bundle-tests/test-frameworks/next13react18/next.config.js +0 -6
- package/bundle-tests/test-frameworks/next13react18/package.json +0 -22
- package/bundle-tests/test-frameworks/next13react18/src/IntegrationsTest.tsx +0 -43
- package/bundle-tests/test-frameworks/next13react18/src/IntegrationsTestReact.tsx +0 -28
- package/bundle-tests/test-frameworks/next13react18/src/IntegrationsTestSdk.tsx +0 -19
- package/bundle-tests/test-frameworks/next13react18/tsconfig.json +0 -34
- package/bundle-tests/test-frameworks/parcel2react17/package.json +0 -21
- package/bundle-tests/test-frameworks/parcel2react17/src/IntegrationsTest.js +0 -41
- package/bundle-tests/test-frameworks/parcel2react17/src/index.html +0 -12
- package/bundle-tests/test-frameworks/parcel2react17/src/index.js +0 -12
- package/bundle-tests/test-frameworks/parcel2react18/package.json +0 -21
- package/bundle-tests/test-frameworks/parcel2react18/src/IntegrationsTest.js +0 -41
- package/bundle-tests/test-frameworks/parcel2react18/src/index.html +0 -12
- package/bundle-tests/test-frameworks/parcel2react18/src/index.js +0 -11
- package/bundle-tests/test-frameworks/vite3react17/index.html +0 -12
- package/bundle-tests/test-frameworks/vite3react17/package.json +0 -26
- package/bundle-tests/test-frameworks/vite3react17/src/IntegrationsTest.tsx +0 -41
- package/bundle-tests/test-frameworks/vite3react17/src/main.tsx +0 -10
- package/bundle-tests/test-frameworks/vite3react17/src/vite-env.d.ts +0 -1
- package/bundle-tests/test-frameworks/vite3react17/tsconfig.json +0 -25
- package/bundle-tests/test-frameworks/vite3react17/tsconfig.node.json +0 -10
- package/bundle-tests/test-frameworks/vite3react17/vite.config.ts +0 -7
- package/bundle-tests/test-frameworks/vite4react17/index.html +0 -12
- package/bundle-tests/test-frameworks/vite4react17/package.json +0 -26
- package/bundle-tests/test-frameworks/vite4react17/src/IntegrationsTest.tsx +0 -41
- package/bundle-tests/test-frameworks/vite4react17/src/main.tsx +0 -10
- package/bundle-tests/test-frameworks/vite4react17/src/vite-env.d.ts +0 -1
- package/bundle-tests/test-frameworks/vite4react17/tsconfig.json +0 -25
- package/bundle-tests/test-frameworks/vite4react17/tsconfig.node.json +0 -10
- package/bundle-tests/test-frameworks/vite4react17/vite.config.ts +0 -7
- package/bundle-tests/test-frameworks/vite4react18/index.html +0 -12
- package/bundle-tests/test-frameworks/vite4react18/package.json +0 -26
- package/bundle-tests/test-frameworks/vite4react18/src/IntegrationsTest.tsx +0 -41
- package/bundle-tests/test-frameworks/vite4react18/src/main.tsx +0 -11
- package/bundle-tests/test-frameworks/vite4react18/src/vite-env.d.ts +0 -1
- package/bundle-tests/test-frameworks/vite4react18/tsconfig.json +0 -25
- package/bundle-tests/test-frameworks/vite4react18/tsconfig.node.json +0 -10
- package/bundle-tests/test-frameworks/vite4react18/vite.config.ts +0 -7
- package/bundle-tests/test-package/package.json +0 -10
- package/bundle-tests/test-package/test-cjs.js +0 -11
- package/bundle-tests/test-package/test-esm.mjs +0 -11
- package/bundle-tests/test-package/test-umd.js +0 -25
- package/bundle-tests/test-package/test.sh +0 -30
- package/dist/index.module.d.ts +0 -625
- package/src/_modules/README.txt +0 -1
- package/src/_modules/awesome-debounce-promise.ts +0 -8
- package/src/contexts/index.tsx +0 -4
- package/src/contexts/integration-app-context.tsx +0 -61
- package/src/hooks/actions/useAction.ts +0 -37
- package/src/hooks/actions/useActionInstance.ts +0 -60
- package/src/hooks/actions/useActionInstances.ts +0 -11
- package/src/hooks/actions/useActions.ts +0 -11
- package/src/hooks/app-data-schemas/useAppDataSchema.ts +0 -20
- package/src/hooks/app-data-schemas/useAppDataSchemaInstance.ts +0 -43
- package/src/hooks/app-data-schemas/useAppDataSchemaInstances.ts +0 -19
- package/src/hooks/app-data-schemas/useAppDataSchemas.ts +0 -11
- package/src/hooks/app-events/useAppEventSubscription.ts +0 -22
- package/src/hooks/app-events/useAppEventSubscriptions.ts +0 -19
- package/src/hooks/app-events/useAppEventType.ts +0 -20
- package/src/hooks/app-events/useAppEventTypes.ts +0 -11
- package/src/hooks/app-events/useAppEvents.ts +0 -11
- package/src/hooks/customers/useCustomer.ts +0 -19
- package/src/hooks/customers/useCustomers.ts +0 -11
- package/src/hooks/data-collections/useDataCollectionSpec.ts +0 -30
- package/src/hooks/data-form/index.tsx +0 -3
- package/src/hooks/data-links/useDataLinkTable.ts +0 -20
- package/src/hooks/data-links/useDataLinkTableInstance.ts +0 -39
- package/src/hooks/data-links/useDataLinkTableInstances.ts +0 -19
- package/src/hooks/data-links/useDataLinkTables.ts +0 -11
- package/src/hooks/data-sources/useDataSource.ts +0 -39
- package/src/hooks/data-sources/useDataSourceInstance.ts +0 -105
- package/src/hooks/data-sources/useDataSourceInstanceCollection.ts +0 -29
- package/src/hooks/data-sources/useDataSourceInstances.ts +0 -17
- package/src/hooks/data-sources/useDataSources.ts +0 -11
- package/src/hooks/external-events/useExternalEventSubscription.ts +0 -60
- package/src/hooks/external-events/useExternalEventSubscriptions.ts +0 -19
- package/src/hooks/field-mappings/useFieldMapping.ts +0 -39
- package/src/hooks/field-mappings/useFieldMappingInstance.ts +0 -56
- package/src/hooks/field-mappings/useFieldMappingInstances.ts +0 -19
- package/src/hooks/field-mappings/useFieldMappings.ts +0 -11
- package/src/hooks/flows/useFlow.ts +0 -35
- package/src/hooks/flows/useFlowInstance.ts +0 -79
- package/src/hooks/flows/useFlowInstances.ts +0 -11
- package/src/hooks/flows/useFlowRun.ts +0 -24
- package/src/hooks/flows/useFlowRuns.ts +0 -11
- package/src/hooks/flows/useFlows.ts +0 -11
- package/src/hooks/integrations/useConnection.ts +0 -21
- package/src/hooks/integrations/useConnections.ts +0 -12
- package/src/hooks/integrations/useConnectorSpec.ts +0 -16
- package/src/hooks/integrations/useIntegration.ts +0 -20
- package/src/hooks/integrations/useIntegrations.ts +0 -12
- package/src/hooks/scenarios/useScenario.tsx +0 -20
- package/src/hooks/scenarios/useScenarios.tsx +0 -11
- package/src/hooks/screens/useScreen.ts +0 -19
- package/src/hooks/useElement.tsx +0 -199
- package/src/hooks/useElements.tsx +0 -108
- package/src/hooks/useIntegrationAppSWR.tsx +0 -13
- package/src/hooks/useIntegrationElement.tsx +0 -19
- package/src/index.tsx +0 -70
- package/tsconfig.json +0 -40
@@ -1,61 +0,0 @@
|
|
1
|
-
import { IntegrationAppClient } from '@integration-app/sdk'
|
2
|
-
import { createContext, ReactNode, useContext, useMemo } from 'react'
|
3
|
-
|
4
|
-
/* FIXME: strictNullCheck temporary fix */
|
5
|
-
// @ts-expect-error TS(2345): Argument of type 'null' is not assignable to param... Remove this comment to see the full error message
|
6
|
-
const IntegrationAppContext = createContext<IntegrationAppClient>(null)
|
7
|
-
|
8
|
-
IntegrationAppContext.displayName = 'IntegrationAppClientContext'
|
9
|
-
|
10
|
-
/**
|
11
|
-
* @interface
|
12
|
-
*/
|
13
|
-
interface IntegrationAppProviderProps {
|
14
|
-
token?: string
|
15
|
-
fetchToken?: () => Promise<string>
|
16
|
-
credentials?: any
|
17
|
-
fetchCredentials?: () => Promise<any>
|
18
|
-
apiUri?: string
|
19
|
-
uiUri?: string
|
20
|
-
children: ReactNode
|
21
|
-
}
|
22
|
-
|
23
|
-
/**
|
24
|
-
* Provides an IntegrationAppClient instance to the React tree.
|
25
|
-
*/
|
26
|
-
export const IntegrationAppProvider = ({
|
27
|
-
token,
|
28
|
-
fetchToken,
|
29
|
-
credentials,
|
30
|
-
fetchCredentials,
|
31
|
-
/* FIXME: strictNullCheck temporary fix */
|
32
|
-
// @ts-expect-error TS(2322): Type 'null' is not assignable to type 'string'.
|
33
|
-
apiUri = null,
|
34
|
-
/* FIXME: strictNullCheck temporary fix */
|
35
|
-
// @ts-expect-error TS(2322): Type 'null' is not assignable to type 'string'.
|
36
|
-
uiUri = null,
|
37
|
-
children,
|
38
|
-
}: IntegrationAppProviderProps) => {
|
39
|
-
const client = useMemo(
|
40
|
-
() =>
|
41
|
-
new IntegrationAppClient({
|
42
|
-
token,
|
43
|
-
fetchToken,
|
44
|
-
credentials,
|
45
|
-
fetchCredentials,
|
46
|
-
apiUri,
|
47
|
-
uiUri,
|
48
|
-
}),
|
49
|
-
[token, JSON.stringify(credentials), apiUri, uiUri],
|
50
|
-
)
|
51
|
-
|
52
|
-
return (
|
53
|
-
<IntegrationAppContext.Provider value={client}>
|
54
|
-
{children}
|
55
|
-
</IntegrationAppContext.Provider>
|
56
|
-
)
|
57
|
-
}
|
58
|
-
|
59
|
-
export function useIntegrationApp(): IntegrationAppClient {
|
60
|
-
return useContext(IntegrationAppContext)
|
61
|
-
}
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
CreateActionRequest,
|
3
|
-
Action,
|
4
|
-
ActionAccessor,
|
5
|
-
ActionSelector,
|
6
|
-
UpdateActionRequest,
|
7
|
-
} from '@integration-app/sdk'
|
8
|
-
import { useElement } from '../useElement'
|
9
|
-
|
10
|
-
export function useAction(selector: ActionSelector | string | undefined) {
|
11
|
-
const {
|
12
|
-
item: action,
|
13
|
-
accessor,
|
14
|
-
refresh,
|
15
|
-
...rest
|
16
|
-
} = useElement<
|
17
|
-
Action,
|
18
|
-
UpdateActionRequest,
|
19
|
-
CreateActionRequest,
|
20
|
-
ActionAccessor
|
21
|
-
>(selector, (integrationApp) =>
|
22
|
-
selector ? integrationApp.action(selector) : undefined,
|
23
|
-
)
|
24
|
-
|
25
|
-
async function apply(integrationKeys: string[]) {
|
26
|
-
const result = await accessor?.apply(integrationKeys)
|
27
|
-
await refresh()
|
28
|
-
return result
|
29
|
-
}
|
30
|
-
|
31
|
-
async function reset() {
|
32
|
-
await accessor?.reset()
|
33
|
-
await refresh()
|
34
|
-
}
|
35
|
-
|
36
|
-
return { action, apply, reset, refresh, accessor, ...rest }
|
37
|
-
}
|
@@ -1,60 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
ActionInstanceAccessor,
|
3
|
-
ActionInstanceSelector,
|
4
|
-
ActionInstance,
|
5
|
-
OpenActionConfigurationOptions,
|
6
|
-
UpdateActionInstanceRequest,
|
7
|
-
CreateActionInstanceRequest,
|
8
|
-
} from '@integration-app/sdk'
|
9
|
-
import { useElement } from '../useElement'
|
10
|
-
|
11
|
-
export function useActionInstance(
|
12
|
-
selector: string | ActionInstanceSelector | undefined,
|
13
|
-
) {
|
14
|
-
const {
|
15
|
-
item: actionInstance,
|
16
|
-
accessor,
|
17
|
-
refresh,
|
18
|
-
...rest
|
19
|
-
} = useElement<
|
20
|
-
ActionInstance,
|
21
|
-
UpdateActionInstanceRequest,
|
22
|
-
CreateActionInstanceRequest,
|
23
|
-
ActionInstanceAccessor
|
24
|
-
>(selector, (integrationApp) =>
|
25
|
-
selector ? integrationApp.actionInstance(selector) : undefined,
|
26
|
-
)
|
27
|
-
|
28
|
-
async function run(input?: any) {
|
29
|
-
return accessor?.run(input)
|
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(options?: OpenActionConfigurationOptions) {
|
43
|
-
return accessor?.open(options)
|
44
|
-
}
|
45
|
-
|
46
|
-
return {
|
47
|
-
actionInstance,
|
48
|
-
|
49
|
-
accessor,
|
50
|
-
refresh,
|
51
|
-
|
52
|
-
setup,
|
53
|
-
reset,
|
54
|
-
openConfiguration,
|
55
|
-
|
56
|
-
run,
|
57
|
-
|
58
|
-
...rest,
|
59
|
-
}
|
60
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { FindActionInstancesQuery, ActionInstance } from '@integration-app/sdk'
|
2
|
-
import { useElements } from '../useElements'
|
3
|
-
|
4
|
-
export function useActionInstances(query?: FindActionInstancesQuery) {
|
5
|
-
const { ...rest } = useElements<ActionInstance>('action-instances', query)
|
6
|
-
|
7
|
-
return {
|
8
|
-
actionInstances: rest.items,
|
9
|
-
...rest,
|
10
|
-
}
|
11
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { Action, FindActionsQuery } from '@integration-app/sdk'
|
2
|
-
import { useElements } from '../useElements'
|
3
|
-
|
4
|
-
export function useActions(query?: FindActionsQuery) {
|
5
|
-
const { ...rest } = useElements<Action>('actions', query)
|
6
|
-
|
7
|
-
return {
|
8
|
-
actions: rest.items,
|
9
|
-
...rest,
|
10
|
-
}
|
11
|
-
}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
CreateAppDataSchemaRequest,
|
3
|
-
AppDataSchema,
|
4
|
-
AppDataSchemaAccessor,
|
5
|
-
UpdateAppDataSchemaRequest,
|
6
|
-
} from '@integration-app/sdk'
|
7
|
-
import { useElement } from '../useElement'
|
8
|
-
|
9
|
-
export function useAppDataSchema(selector: string | undefined) {
|
10
|
-
const { item: appDataSchema, ...rest } = useElement<
|
11
|
-
AppDataSchema,
|
12
|
-
UpdateAppDataSchemaRequest,
|
13
|
-
CreateAppDataSchemaRequest,
|
14
|
-
AppDataSchemaAccessor
|
15
|
-
>(selector, (integrationApp) =>
|
16
|
-
selector ? integrationApp.appDataSchema(selector) : undefined,
|
17
|
-
)
|
18
|
-
|
19
|
-
return { appDataSchema, ...rest }
|
20
|
-
}
|
@@ -1,43 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
AppDataSchemaInstanceAccessor,
|
3
|
-
AppDataSchemaInstanceSelector,
|
4
|
-
UpdateAppDataSchemaInstanceRequest,
|
5
|
-
CreateAppDataSchemaInstanceRequest,
|
6
|
-
AppDataSchemaInstance,
|
7
|
-
} from '@integration-app/sdk'
|
8
|
-
import { useElement } from '../useElement'
|
9
|
-
|
10
|
-
export function useAppDataSchemaInstance(
|
11
|
-
selector: string | AppDataSchemaInstanceSelector | undefined,
|
12
|
-
) {
|
13
|
-
const {
|
14
|
-
item: appDataSchemaInstance,
|
15
|
-
accessor,
|
16
|
-
refresh,
|
17
|
-
...rest
|
18
|
-
} = useElement<
|
19
|
-
AppDataSchemaInstance,
|
20
|
-
UpdateAppDataSchemaInstanceRequest,
|
21
|
-
CreateAppDataSchemaInstanceRequest,
|
22
|
-
AppDataSchemaInstanceAccessor
|
23
|
-
>(selector, (integrationApp) =>
|
24
|
-
selector ? integrationApp.appDataSchemaInstance(selector) : undefined,
|
25
|
-
)
|
26
|
-
|
27
|
-
async function setup() {
|
28
|
-
await accessor?.setup()
|
29
|
-
await refresh()
|
30
|
-
}
|
31
|
-
|
32
|
-
return {
|
33
|
-
appDataSchemaInstance,
|
34
|
-
|
35
|
-
accessor,
|
36
|
-
|
37
|
-
refresh,
|
38
|
-
|
39
|
-
setup,
|
40
|
-
|
41
|
-
...rest,
|
42
|
-
}
|
43
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
AppDataSchemaInstance,
|
3
|
-
FindAppDataSchemaInstancesQuery,
|
4
|
-
} from '@integration-app/sdk'
|
5
|
-
import { useElements } from '../useElements'
|
6
|
-
|
7
|
-
export function useAppDataSchemaInstances(
|
8
|
-
query?: FindAppDataSchemaInstancesQuery,
|
9
|
-
) {
|
10
|
-
const { ...rest } = useElements<AppDataSchemaInstance>(
|
11
|
-
'app-data-schema-instances',
|
12
|
-
query,
|
13
|
-
)
|
14
|
-
|
15
|
-
return {
|
16
|
-
appDataSchemaInstances: rest.items,
|
17
|
-
...rest,
|
18
|
-
}
|
19
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { AppDataSchema, FindAppDataSchemasQuery } from '@integration-app/sdk'
|
2
|
-
import { useElements } from '../useElements'
|
3
|
-
|
4
|
-
export function useAppDataSchemas(query?: FindAppDataSchemasQuery) {
|
5
|
-
const { ...rest } = useElements<AppDataSchema>('app-data-schemas', query)
|
6
|
-
|
7
|
-
return {
|
8
|
-
appDataSchemas: rest.items,
|
9
|
-
...rest,
|
10
|
-
}
|
11
|
-
}
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
AppEventSubscription,
|
3
|
-
AppEventSubscriptionAccessor,
|
4
|
-
AppEventSubscriptionSelector,
|
5
|
-
AppEventSubscriptionUpdateRequest,
|
6
|
-
} from '@integration-app/sdk'
|
7
|
-
import { useElement } from '../useElement'
|
8
|
-
|
9
|
-
export function useAppEventSubscription(
|
10
|
-
selector: string | AppEventSubscriptionSelector | undefined,
|
11
|
-
) {
|
12
|
-
const { item: appEventSubscription, ...rest } = useElement<
|
13
|
-
AppEventSubscription,
|
14
|
-
AppEventSubscriptionUpdateRequest,
|
15
|
-
AppEventSubscriptionUpdateRequest,
|
16
|
-
AppEventSubscriptionAccessor
|
17
|
-
>(selector, (integrationApp) =>
|
18
|
-
selector ? integrationApp.appEventSubscription(selector) : undefined,
|
19
|
-
)
|
20
|
-
|
21
|
-
return { appEventSubscription, ...rest }
|
22
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
AppEventSubscription,
|
3
|
-
FindAppEventSubscriptionsQuery,
|
4
|
-
} from '@integration-app/sdk'
|
5
|
-
import { useElements } from '../useElements'
|
6
|
-
|
7
|
-
export function useAppEventSubscriptions(
|
8
|
-
query?: FindAppEventSubscriptionsQuery,
|
9
|
-
) {
|
10
|
-
const { ...rest } = useElements<AppEventSubscription>(
|
11
|
-
'app-event-subscriptions',
|
12
|
-
query,
|
13
|
-
)
|
14
|
-
|
15
|
-
return {
|
16
|
-
appEventSubscriptions: rest.items,
|
17
|
-
...rest,
|
18
|
-
}
|
19
|
-
}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
AppEventType,
|
3
|
-
CreateAppEventTypeRequest,
|
4
|
-
UpdateAppEventTypeRequest,
|
5
|
-
} from '@integration-app/sdk'
|
6
|
-
import { AppEventTypeAccessor } from '@integration-app/sdk'
|
7
|
-
import { useElement } from '../useElement'
|
8
|
-
|
9
|
-
export function useAppEventType(selector: string | undefined) {
|
10
|
-
const { item: appEventType, ...rest } = useElement<
|
11
|
-
AppEventType,
|
12
|
-
UpdateAppEventTypeRequest,
|
13
|
-
CreateAppEventTypeRequest,
|
14
|
-
AppEventTypeAccessor
|
15
|
-
>(selector, (integrationApp) =>
|
16
|
-
selector ? integrationApp.appEventType(selector) : undefined,
|
17
|
-
)
|
18
|
-
|
19
|
-
return { appEventType, ...rest }
|
20
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { AppEventType, FindAppEventTypesQuery } from '@integration-app/sdk'
|
2
|
-
import { useElements } from '../useElements'
|
3
|
-
|
4
|
-
export function useAppEventTypes(query?: FindAppEventTypesQuery) {
|
5
|
-
const { ...rest } = useElements<AppEventType>('app-event-types', query)
|
6
|
-
|
7
|
-
return {
|
8
|
-
appEventTypes: rest.items,
|
9
|
-
...rest,
|
10
|
-
}
|
11
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { AppEvent, FindAppEventsQuery } from '@integration-app/sdk'
|
2
|
-
import { useElements } from '../useElements'
|
3
|
-
|
4
|
-
export function useAppEvents(query?: FindAppEventsQuery) {
|
5
|
-
const { ...rest } = useElements<AppEvent>('app-events', query)
|
6
|
-
|
7
|
-
return {
|
8
|
-
appEvents: rest.items,
|
9
|
-
...rest,
|
10
|
-
}
|
11
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
Customer,
|
3
|
-
CustomerSelector,
|
4
|
-
UpdateCustomerRequest,
|
5
|
-
CreateCustomerRequest,
|
6
|
-
CustomerAccessor,
|
7
|
-
} from '@integration-app/sdk'
|
8
|
-
import { useElement } from '../useElement'
|
9
|
-
|
10
|
-
export function useCustomer(selector: CustomerSelector | string | undefined) {
|
11
|
-
const { item: customer, ...rest } = useElement<
|
12
|
-
Customer,
|
13
|
-
UpdateCustomerRequest,
|
14
|
-
CreateCustomerRequest,
|
15
|
-
CustomerAccessor
|
16
|
-
>(selector, (c) => (selector ? c.customer(selector) : undefined))
|
17
|
-
|
18
|
-
return { customer, ...rest }
|
19
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { Customer, FindCustomersQuery } from '@integration-app/sdk'
|
2
|
-
import { useElements } from '../useElements'
|
3
|
-
|
4
|
-
export function useCustomers(query?: FindCustomersQuery) {
|
5
|
-
const { ...rest } = useElements<Customer>('customers', query)
|
6
|
-
|
7
|
-
return {
|
8
|
-
customers: rest.items,
|
9
|
-
...rest,
|
10
|
-
}
|
11
|
-
}
|
@@ -1,30 +0,0 @@
|
|
1
|
-
import { DataCollectionSpec, parseDataLocationPath } from '@integration-app/sdk'
|
2
|
-
import { useIntegrationApp } from 'contexts/integration-app-context'
|
3
|
-
import useSWR from 'swr'
|
4
|
-
|
5
|
-
export function useDataCollectionSpec({
|
6
|
-
path,
|
7
|
-
key,
|
8
|
-
integrationId,
|
9
|
-
}: {
|
10
|
-
path?: string | undefined
|
11
|
-
key?: string | undefined
|
12
|
-
integrationId: string
|
13
|
-
}): DataCollectionSpec | undefined {
|
14
|
-
const client = useIntegrationApp()
|
15
|
-
|
16
|
-
const dataCollectionKey = key ?? parseDataLocationPath(path)?.key
|
17
|
-
|
18
|
-
const { data: dataCollectionSpec } = useSWR<DataCollectionSpec>(
|
19
|
-
dataCollectionKey && integrationId
|
20
|
-
? `/integrations/${integrationId}/data/${dataCollectionKey}`
|
21
|
-
: null,
|
22
|
-
async () => {
|
23
|
-
return client
|
24
|
-
.integration(integrationId)
|
25
|
-
.getDataCollection(dataCollectionKey as string)
|
26
|
-
},
|
27
|
-
)
|
28
|
-
|
29
|
-
return dataCollectionSpec
|
30
|
-
}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
CreateDataLinkTableRequest,
|
3
|
-
DataLinkTable,
|
4
|
-
DataLinkTableAccessor,
|
5
|
-
UpdateDataLinkTableRequest,
|
6
|
-
} from '@integration-app/sdk'
|
7
|
-
import { useElement } from '../useElement'
|
8
|
-
|
9
|
-
export function useDataLinkTable(selector: string | undefined) {
|
10
|
-
const { item: dataLinkTable, ...rest } = useElement<
|
11
|
-
DataLinkTable,
|
12
|
-
UpdateDataLinkTableRequest,
|
13
|
-
CreateDataLinkTableRequest,
|
14
|
-
DataLinkTableAccessor
|
15
|
-
>(selector, (integrationApp) =>
|
16
|
-
selector ? integrationApp.dataLinkTable(selector) : undefined,
|
17
|
-
)
|
18
|
-
|
19
|
-
return { dataLinkTable, ...rest }
|
20
|
-
}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
DataLinkTableInstanceAccessor,
|
3
|
-
DataLinkTableInstanceSelector,
|
4
|
-
DataLinkTableInstance,
|
5
|
-
UpdateDataLinkTableInstanceRequest,
|
6
|
-
CreateDataLinkTableInstanceRequest,
|
7
|
-
} from '@integration-app/sdk'
|
8
|
-
import { useElement } from '../useElement'
|
9
|
-
|
10
|
-
export function useDataLinkTableInstance(
|
11
|
-
selector: string | DataLinkTableInstanceSelector | undefined,
|
12
|
-
) {
|
13
|
-
const {
|
14
|
-
item: dataLinkTableInstance,
|
15
|
-
accessor,
|
16
|
-
refresh,
|
17
|
-
...rest
|
18
|
-
} = useElement<
|
19
|
-
DataLinkTableInstance,
|
20
|
-
UpdateDataLinkTableInstanceRequest,
|
21
|
-
CreateDataLinkTableInstanceRequest,
|
22
|
-
DataLinkTableInstanceAccessor
|
23
|
-
>(selector, (integrationApp) =>
|
24
|
-
selector ? integrationApp.dataLinkTableInstance(selector) : undefined,
|
25
|
-
)
|
26
|
-
|
27
|
-
return {
|
28
|
-
dataLinkTableInstance,
|
29
|
-
|
30
|
-
accessor,
|
31
|
-
refresh,
|
32
|
-
|
33
|
-
findLinks: accessor?.findLinks,
|
34
|
-
createLink: accessor?.createLink,
|
35
|
-
deleteLink: accessor?.deleteLink,
|
36
|
-
|
37
|
-
...rest,
|
38
|
-
}
|
39
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
FindDataLinkTableInstancesQuery,
|
3
|
-
DataLinkTableInstance,
|
4
|
-
} from '@integration-app/sdk'
|
5
|
-
import { useElements } from '../useElements'
|
6
|
-
|
7
|
-
export function useDataLinkTableInstances(
|
8
|
-
query?: FindDataLinkTableInstancesQuery,
|
9
|
-
) {
|
10
|
-
const { ...rest } = useElements<DataLinkTableInstance>(
|
11
|
-
'data-link-table-instances',
|
12
|
-
query,
|
13
|
-
)
|
14
|
-
|
15
|
-
return {
|
16
|
-
dataLinkTableInstances: rest.items,
|
17
|
-
...rest,
|
18
|
-
}
|
19
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { DataLinkTable, FindDataLinkTablesQuery } from '@integration-app/sdk'
|
2
|
-
import { useElements } from '../useElements'
|
3
|
-
|
4
|
-
export function useDataLinkTables(query?: FindDataLinkTablesQuery) {
|
5
|
-
const { ...rest } = useElements<DataLinkTable>('data-link-tables', query)
|
6
|
-
|
7
|
-
return {
|
8
|
-
dataLinkTables: rest.items,
|
9
|
-
...rest,
|
10
|
-
}
|
11
|
-
}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
CreateDataSourceRequest,
|
3
|
-
DataSource,
|
4
|
-
DataSourceAccessor,
|
5
|
-
DataSourceSelector,
|
6
|
-
UpdateDataSourceRequest,
|
7
|
-
} from '@integration-app/sdk'
|
8
|
-
import { useElement } from '../useElement'
|
9
|
-
|
10
|
-
export function useDataSource(
|
11
|
-
selector: string | DataSourceSelector | undefined,
|
12
|
-
) {
|
13
|
-
const {
|
14
|
-
item: dataSource,
|
15
|
-
refresh,
|
16
|
-
accessor,
|
17
|
-
...rest
|
18
|
-
} = useElement<
|
19
|
-
DataSource,
|
20
|
-
UpdateDataSourceRequest,
|
21
|
-
CreateDataSourceRequest,
|
22
|
-
DataSourceAccessor
|
23
|
-
>(selector, (integrationApp) =>
|
24
|
-
selector ? integrationApp.dataSource(selector) : undefined,
|
25
|
-
)
|
26
|
-
|
27
|
-
async function apply(integrationKeys: string[]): Promise<DataSource[]> {
|
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 { dataSource, apply, reset, refresh, accessor, ...rest }
|
39
|
-
}
|
@@ -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
|
-
}
|