@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.
Files changed (149) hide show
  1. package/dist/index.d.ts +19953 -3
  2. package/dist/index.js +807 -65
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.module.d.mts +20575 -0
  5. package/dist/index.module.mjs +809 -68
  6. package/dist/index.module.mjs.map +1 -1
  7. package/dist/tsconfig.tsbuildinfo +1 -0
  8. package/package.json +46 -15
  9. package/DEVELOPMENT.md +0 -82
  10. package/bundle-tests/test-frameworks/README.md +0 -4
  11. package/bundle-tests/test-frameworks/cra5react17/package-lock.json +0 -30749
  12. package/bundle-tests/test-frameworks/cra5react17/package.json +0 -42
  13. package/bundle-tests/test-frameworks/cra5react17/patches/react-scripts+5.0.0.patch +0 -15
  14. package/bundle-tests/test-frameworks/cra5react17/public/favicon.ico +0 -0
  15. package/bundle-tests/test-frameworks/cra5react17/public/index.html +0 -43
  16. package/bundle-tests/test-frameworks/cra5react17/public/logo192.png +0 -0
  17. package/bundle-tests/test-frameworks/cra5react17/public/logo512.png +0 -0
  18. package/bundle-tests/test-frameworks/cra5react17/public/manifest.json +0 -25
  19. package/bundle-tests/test-frameworks/cra5react17/public/robots.txt +0 -3
  20. package/bundle-tests/test-frameworks/cra5react17/src/IntegrationsTest.jsx +0 -42
  21. package/bundle-tests/test-frameworks/cra5react17/src/index.tsx +0 -10
  22. package/bundle-tests/test-frameworks/cra5react17/src/react-app-env.d.ts +0 -1
  23. package/bundle-tests/test-frameworks/cra5react17/tsconfig.json +0 -26
  24. package/bundle-tests/test-frameworks/cra5react18/package-lock.json +0 -30328
  25. package/bundle-tests/test-frameworks/cra5react18/package.json +0 -38
  26. package/bundle-tests/test-frameworks/cra5react18/public/favicon.ico +0 -0
  27. package/bundle-tests/test-frameworks/cra5react18/public/index.html +0 -43
  28. package/bundle-tests/test-frameworks/cra5react18/public/logo192.png +0 -0
  29. package/bundle-tests/test-frameworks/cra5react18/public/logo512.png +0 -0
  30. package/bundle-tests/test-frameworks/cra5react18/public/manifest.json +0 -25
  31. package/bundle-tests/test-frameworks/cra5react18/public/robots.txt +0 -3
  32. package/bundle-tests/test-frameworks/cra5react18/src/IntegrationsTest.jsx +0 -42
  33. package/bundle-tests/test-frameworks/cra5react18/src/index.tsx +0 -10
  34. package/bundle-tests/test-frameworks/cra5react18/src/logo.svg +0 -1
  35. package/bundle-tests/test-frameworks/cra5react18/src/react-app-env.d.ts +0 -1
  36. package/bundle-tests/test-frameworks/cra5react18/tsconfig.json +0 -26
  37. package/bundle-tests/test-frameworks/next12react17/next.config.js +0 -6
  38. package/bundle-tests/test-frameworks/next12react17/package.json +0 -18
  39. package/bundle-tests/test-frameworks/next12react17/pages/_app.js +0 -5
  40. package/bundle-tests/test-frameworks/next12react17/pages/index.js +0 -5
  41. package/bundle-tests/test-frameworks/next12react17/src/IntegrationsTest.jsx +0 -25
  42. package/bundle-tests/test-frameworks/next12react18/next.config.js +0 -6
  43. package/bundle-tests/test-frameworks/next12react18/package.json +0 -18
  44. package/bundle-tests/test-frameworks/next12react18/pages/_app.js +0 -5
  45. package/bundle-tests/test-frameworks/next12react18/pages/index.js +0 -5
  46. package/bundle-tests/test-frameworks/next12react18/src/IntegrationsTest.jsx +0 -41
  47. package/bundle-tests/test-frameworks/next13react18/app/layout.tsx +0 -18
  48. package/bundle-tests/test-frameworks/next13react18/app/page.tsx +0 -5
  49. package/bundle-tests/test-frameworks/next13react18/next-env.d.ts +0 -5
  50. package/bundle-tests/test-frameworks/next13react18/next.config.js +0 -6
  51. package/bundle-tests/test-frameworks/next13react18/package.json +0 -22
  52. package/bundle-tests/test-frameworks/next13react18/src/IntegrationsTest.tsx +0 -43
  53. package/bundle-tests/test-frameworks/next13react18/src/IntegrationsTestReact.tsx +0 -28
  54. package/bundle-tests/test-frameworks/next13react18/src/IntegrationsTestSdk.tsx +0 -19
  55. package/bundle-tests/test-frameworks/next13react18/tsconfig.json +0 -34
  56. package/bundle-tests/test-frameworks/parcel2react17/package.json +0 -21
  57. package/bundle-tests/test-frameworks/parcel2react17/src/IntegrationsTest.js +0 -41
  58. package/bundle-tests/test-frameworks/parcel2react17/src/index.html +0 -12
  59. package/bundle-tests/test-frameworks/parcel2react17/src/index.js +0 -12
  60. package/bundle-tests/test-frameworks/parcel2react18/package.json +0 -21
  61. package/bundle-tests/test-frameworks/parcel2react18/src/IntegrationsTest.js +0 -41
  62. package/bundle-tests/test-frameworks/parcel2react18/src/index.html +0 -12
  63. package/bundle-tests/test-frameworks/parcel2react18/src/index.js +0 -11
  64. package/bundle-tests/test-frameworks/vite3react17/index.html +0 -12
  65. package/bundle-tests/test-frameworks/vite3react17/package.json +0 -26
  66. package/bundle-tests/test-frameworks/vite3react17/src/IntegrationsTest.tsx +0 -41
  67. package/bundle-tests/test-frameworks/vite3react17/src/main.tsx +0 -10
  68. package/bundle-tests/test-frameworks/vite3react17/src/vite-env.d.ts +0 -1
  69. package/bundle-tests/test-frameworks/vite3react17/tsconfig.json +0 -25
  70. package/bundle-tests/test-frameworks/vite3react17/tsconfig.node.json +0 -10
  71. package/bundle-tests/test-frameworks/vite3react17/vite.config.ts +0 -7
  72. package/bundle-tests/test-frameworks/vite4react17/index.html +0 -12
  73. package/bundle-tests/test-frameworks/vite4react17/package.json +0 -26
  74. package/bundle-tests/test-frameworks/vite4react17/src/IntegrationsTest.tsx +0 -41
  75. package/bundle-tests/test-frameworks/vite4react17/src/main.tsx +0 -10
  76. package/bundle-tests/test-frameworks/vite4react17/src/vite-env.d.ts +0 -1
  77. package/bundle-tests/test-frameworks/vite4react17/tsconfig.json +0 -25
  78. package/bundle-tests/test-frameworks/vite4react17/tsconfig.node.json +0 -10
  79. package/bundle-tests/test-frameworks/vite4react17/vite.config.ts +0 -7
  80. package/bundle-tests/test-frameworks/vite4react18/index.html +0 -12
  81. package/bundle-tests/test-frameworks/vite4react18/package.json +0 -26
  82. package/bundle-tests/test-frameworks/vite4react18/src/IntegrationsTest.tsx +0 -41
  83. package/bundle-tests/test-frameworks/vite4react18/src/main.tsx +0 -11
  84. package/bundle-tests/test-frameworks/vite4react18/src/vite-env.d.ts +0 -1
  85. package/bundle-tests/test-frameworks/vite4react18/tsconfig.json +0 -25
  86. package/bundle-tests/test-frameworks/vite4react18/tsconfig.node.json +0 -10
  87. package/bundle-tests/test-frameworks/vite4react18/vite.config.ts +0 -7
  88. package/bundle-tests/test-package/package.json +0 -10
  89. package/bundle-tests/test-package/test-cjs.js +0 -11
  90. package/bundle-tests/test-package/test-esm.mjs +0 -11
  91. package/bundle-tests/test-package/test-umd.js +0 -25
  92. package/bundle-tests/test-package/test.sh +0 -30
  93. package/dist/index.module.d.ts +0 -625
  94. package/src/_modules/README.txt +0 -1
  95. package/src/_modules/awesome-debounce-promise.ts +0 -8
  96. package/src/contexts/index.tsx +0 -4
  97. package/src/contexts/integration-app-context.tsx +0 -61
  98. package/src/hooks/actions/useAction.ts +0 -37
  99. package/src/hooks/actions/useActionInstance.ts +0 -60
  100. package/src/hooks/actions/useActionInstances.ts +0 -11
  101. package/src/hooks/actions/useActions.ts +0 -11
  102. package/src/hooks/app-data-schemas/useAppDataSchema.ts +0 -20
  103. package/src/hooks/app-data-schemas/useAppDataSchemaInstance.ts +0 -43
  104. package/src/hooks/app-data-schemas/useAppDataSchemaInstances.ts +0 -19
  105. package/src/hooks/app-data-schemas/useAppDataSchemas.ts +0 -11
  106. package/src/hooks/app-events/useAppEventSubscription.ts +0 -22
  107. package/src/hooks/app-events/useAppEventSubscriptions.ts +0 -19
  108. package/src/hooks/app-events/useAppEventType.ts +0 -20
  109. package/src/hooks/app-events/useAppEventTypes.ts +0 -11
  110. package/src/hooks/app-events/useAppEvents.ts +0 -11
  111. package/src/hooks/customers/useCustomer.ts +0 -19
  112. package/src/hooks/customers/useCustomers.ts +0 -11
  113. package/src/hooks/data-collections/useDataCollectionSpec.ts +0 -30
  114. package/src/hooks/data-form/index.tsx +0 -3
  115. package/src/hooks/data-links/useDataLinkTable.ts +0 -20
  116. package/src/hooks/data-links/useDataLinkTableInstance.ts +0 -39
  117. package/src/hooks/data-links/useDataLinkTableInstances.ts +0 -19
  118. package/src/hooks/data-links/useDataLinkTables.ts +0 -11
  119. package/src/hooks/data-sources/useDataSource.ts +0 -39
  120. package/src/hooks/data-sources/useDataSourceInstance.ts +0 -105
  121. package/src/hooks/data-sources/useDataSourceInstanceCollection.ts +0 -29
  122. package/src/hooks/data-sources/useDataSourceInstances.ts +0 -17
  123. package/src/hooks/data-sources/useDataSources.ts +0 -11
  124. package/src/hooks/external-events/useExternalEventSubscription.ts +0 -60
  125. package/src/hooks/external-events/useExternalEventSubscriptions.ts +0 -19
  126. package/src/hooks/field-mappings/useFieldMapping.ts +0 -39
  127. package/src/hooks/field-mappings/useFieldMappingInstance.ts +0 -56
  128. package/src/hooks/field-mappings/useFieldMappingInstances.ts +0 -19
  129. package/src/hooks/field-mappings/useFieldMappings.ts +0 -11
  130. package/src/hooks/flows/useFlow.ts +0 -35
  131. package/src/hooks/flows/useFlowInstance.ts +0 -79
  132. package/src/hooks/flows/useFlowInstances.ts +0 -11
  133. package/src/hooks/flows/useFlowRun.ts +0 -24
  134. package/src/hooks/flows/useFlowRuns.ts +0 -11
  135. package/src/hooks/flows/useFlows.ts +0 -11
  136. package/src/hooks/integrations/useConnection.ts +0 -21
  137. package/src/hooks/integrations/useConnections.ts +0 -12
  138. package/src/hooks/integrations/useConnectorSpec.ts +0 -16
  139. package/src/hooks/integrations/useIntegration.ts +0 -20
  140. package/src/hooks/integrations/useIntegrations.ts +0 -12
  141. package/src/hooks/scenarios/useScenario.tsx +0 -20
  142. package/src/hooks/scenarios/useScenarios.tsx +0 -11
  143. package/src/hooks/screens/useScreen.ts +0 -19
  144. package/src/hooks/useElement.tsx +0 -199
  145. package/src/hooks/useElements.tsx +0 -108
  146. package/src/hooks/useIntegrationAppSWR.tsx +0 -13
  147. package/src/hooks/useIntegrationElement.tsx +0 -19
  148. package/src/index.tsx +0 -70
  149. 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,3 +0,0 @@
1
- export default function DataForm() {
2
- return <p>Data Form</p>
3
- }
@@ -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
- }