@integration-app/react 0.2.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. package/README.md +49 -34
  2. package/dist/index.d.ts +377 -160
  3. package/dist/index.js +517 -226
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.module.d.ts +377 -160
  6. package/dist/index.module.mjs +506 -227
  7. package/dist/index.module.mjs.map +1 -1
  8. package/dist/index.umd.d.ts +377 -160
  9. package/dist/index.umd.js +517 -230
  10. package/dist/index.umd.js.map +1 -1
  11. package/package.json +16 -9
  12. package/src/actions/useAction.ts +35 -0
  13. package/src/actions/useActionInstance.ts +56 -0
  14. package/src/actions/useActionInstances.ts +11 -0
  15. package/src/actions/useActions.ts +11 -0
  16. package/src/app-events/useAppEventSubscription.ts +6 -6
  17. package/src/app-events/useAppEventSubscriptions.ts +5 -4
  18. package/src/app-events/useAppEventType.ts +10 -7
  19. package/src/app-events/useAppEventTypes.ts +2 -4
  20. package/src/app-events/useAppEvents.ts +2 -4
  21. package/src/contexts/index.tsx +4 -0
  22. package/src/contexts/integration-app-context.tsx +11 -2
  23. package/src/data-collections/useDataCollectionSpec.ts +26 -0
  24. package/src/data-links/useDataLinkTable.ts +18 -0
  25. package/src/data-links/useDataLinkTableInstance.ts +39 -0
  26. package/src/data-links/useDataLinkTableInstances.ts +19 -0
  27. package/src/data-links/useDataLinkTables.ts +11 -0
  28. package/src/data-sources/useDataSource.ts +29 -6
  29. package/src/data-sources/useDataSourceEvents.ts +2 -4
  30. package/src/data-sources/useDataSourceInstance.ts +120 -26
  31. package/src/data-sources/useDataSourceInstanceCollection.ts +14 -4
  32. package/src/data-sources/useDataSourceInstanceLocations.ts +17 -6
  33. package/src/data-sources/useDataSourceInstances.ts +17 -0
  34. package/src/data-sources/useDataSources.ts +2 -4
  35. package/src/field-mappings/useFieldMapping.ts +29 -8
  36. package/src/field-mappings/useFieldMappingInstance.ts +37 -14
  37. package/src/field-mappings/useFieldMappingInstances.ts +6 -5
  38. package/src/field-mappings/useFieldMappings.ts +2 -4
  39. package/src/flows/useFlow.ts +28 -6
  40. package/src/flows/useFlowInstance.ts +62 -5
  41. package/src/flows/useFlowInstances.ts +2 -4
  42. package/src/flows/useFlowRun.ts +18 -6
  43. package/src/flows/useFlowRuns.ts +5 -5
  44. package/src/flows/useFlows.ts +5 -5
  45. package/src/hooks/useElement.tsx +142 -136
  46. package/src/hooks/useElements.tsx +44 -73
  47. package/src/hooks/useIntegrationAppSWR.tsx +13 -0
  48. package/src/index.tsx +29 -16
  49. package/src/integrations/useConnection.ts +14 -5
  50. package/src/integrations/useConnections.ts +3 -4
  51. package/src/integrations/useConnectorSpec.ts +14 -0
  52. package/src/integrations/useIntegration.ts +11 -7
  53. package/src/integrations/useIntegrations.ts +3 -4
  54. package/src/screens/useScreen.ts +19 -0
  55. package/rollup.config.mjs +0 -64
  56. package/src/hooks/useGetter.tsx +0 -38
  57. package/src/integrations/useConnectionSpec.ts +0 -25
package/README.md CHANGED
@@ -7,23 +7,63 @@ To release a new version of a package (@integration-app/sdk, @integration-app/ui
7
7
  * Merge the PR.
8
8
  * Run a Github Action to publish a package.
9
9
 
10
- # Rollup config
11
10
 
12
- Check out the [rollup.config.mjs](rollup.config.mjs) file for the full config.
11
+ # Rollup Configuration
13
12
 
14
- It's pretty self-explanatory, but here's some additional info:
13
+ To see the complete configuration, refer to the `rollup.config.mjs` and `rollup.dts.config.mjs` files. Although these files are self-explanatory, here's some additional information:
14
+
15
+ In `rollup.config.mjs`, we set `{external: [/node_modules/]}` to exclude our dependencies from being bundled.
16
+
17
+ ## Bundle and DTS File Generation
18
+
19
+ We encountered issues with `rollup-plugin-dts` generating incorrect DTS files when used in the same configuration as `@rollup/plugin-typescript`. To resolve this, we use two Rollup configurations:
20
+ - `rollup.config.mjs` for bundle generation
21
+ - `rollup.dts.config.mjs` for DTS file generation.
15
22
 
16
23
  ## Externals
17
24
 
18
- We set `{external: [/node_modules/]}` because we don't want to bundle any of our dependencies.
19
- If we need to bundle some dependencies and some not, we can use [`rollup-plugin-peer-deps-external`](https://www.npmjs.com/package/rollup-plugin-peer-deps-external) plugin instead of this.
25
+ We set external dependencies in `rollup.config.mjs`:
26
+ - `{external: [/node_modules/]}` to exclude all `node_modules`.
27
+ - `@integration-app/sdk` to prevent Rollup from bundling the `@integration-app/sdk` package during local development, when it is used via a symlink to the SDK in the root folder.
28
+ - `react` and `react/jsx-runtime` are excluded to avoid unresolved dependency errors, as React is a peer dependency.
29
+
30
+ ## Bundle and DTS File Generation Workflow
31
+
32
+ When using `rollup-plugin-dts` and `@rollup/plugin-typescript` in the same configuration, we experienced issues with generating incorrect DTS files. To solve this, we use two Rollup configurations:
33
+ - `rollup.config.mjs` for generating bundles
34
+ - `rollup.dts.config.mjs` for generating DTS files.
35
+
36
+ ### Build
37
+
38
+ For local build, the following steps are taken:
39
+
40
+ - Clean the `/dist` folder.
41
+ - Install local `@integration-app/sdk` pointed to `sdk` folder
42
+ - Remove `react` and `react-dom` packages from `node_modules` folder
43
+ - We should do it to allow out package work in `console`, `engine` and other local projects
44
+ - Rollup with `rollup.config.mjs` configuration generates bundle files and basic DTS files, which are placed in the `dist/dts` folder.
45
+ - Rollup with `rollup.dts.config.mjs` configuration uses the basic DTS files to generate `*.d.ts` files for each bundle.
46
+
47
+ ### Development
48
+
49
+ During development, the following steps are taken:
50
+
51
+ - Run `build` to generate bundle and DTS files.
52
+ - If not, Rollup with `rollup.dts.config.mjs` in watch mode fails due to missing DTS files (race condition).
53
+ - Concurrently run two Rollup processes **in watch mode**:
54
+ - Rollup with `rollup.config.mjs` configuration to generate bundle files and basic DTS files.
55
+ - Rollup with `rollup.dts.config.mjs` configuration to generate DTS files for each bundle.
56
+
57
+ ### Publish via GitHub
20
58
 
21
- To prevent Rollup from bundling the `@integration-app/sdk` package during local development, we specify it as an external dependency since Rollup does not match locally placed packages with the `/node_modules/` rule.
59
+ During publishing via GitHub, the following steps are taken:
22
60
 
23
- ## DTS
61
+ - Clean the `/dist` folder.
62
+ - Install `@integration-app/sdk@latest` package
63
+ - Rollup with `rollup.config.mjs` configuration generates bundle files and basic DTS files, which are placed in the `dist/dts` folder.
64
+ - Rollup with `rollup.dts.config.mjs` configuration uses the basic DTS files to generate `*.d.ts` files for each bundle.
24
65
 
25
- DTS files are generated by `tsc` and placed in `dist/dts` folder.
26
- After that plugin `rollup-plugin-dts` is used to generate `*.d.ts` files for each bundle.
66
+ The `build:publish` command is used in GitHub Actions to ensure that the package uses the latest `@integration-app/sdk` package.
27
67
 
28
68
  # Package.json exports
29
69
 
@@ -41,28 +81,3 @@ After that plugin `rollup-plugin-dts` is used to generate `*.d.ts` files for eac
41
81
  }
42
82
  ```
43
83
 
44
- # Local and publish build workflow
45
-
46
- For a local development, we use locally placed `@integration-app/sdk` package.
47
-
48
- And for publishing, we use `@integration-app/sdk@latest` package.
49
-
50
- To make it work, we use `dev` and `build` commands.
51
-
52
- ## `dev` workflow
53
-
54
- - Delete `dist` folders
55
- - Install local `@integration-app/sdk` pointed to `sdk` folder
56
- - Remove `react` and `react-dom` packages from `node_modules` folder
57
- - We should do it to allow out package work in `console`, `engine` and other local projects
58
- - Run `rollup` in watch mode to build a package
59
-
60
- ## `build` workflow
61
-
62
- - Delete `dist` folders
63
- - Install `@integration-app/sdk@latest` package
64
- - Run `rollup` to build a package
65
-
66
- Because GitHub Actions use `build` command, we could be sure that package uses the latest `@integration-app/sdk` package.
67
-
68
-