@exodus/error-tracking 1.1.2 → 1.2.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.2.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/error-tracking@1.1.3...@exodus/error-tracking@1.2.0) (2024-08-08)
7
+
8
+ ### Features
9
+
10
+ - **error-tracking:** add remote error tracking api node ([#8169](https://github.com/ExodusMovement/exodus-hydra/issues/8169)) ([5a2d702](https://github.com/ExodusMovement/exodus-hydra/commit/5a2d702126d81bfb934c2598b732e62d23370f03))
11
+
12
+ ## [1.1.3](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/error-tracking@1.1.2...@exodus/error-tracking@1.1.3) (2024-07-25)
13
+
14
+ ### Bug Fixes
15
+
16
+ - migrate definitions ([#8030](https://github.com/ExodusMovement/exodus-hydra/issues/8030)) ([d2dfde5](https://github.com/ExodusMovement/exodus-hydra/commit/d2dfde55dfa843eb52842f64b3aac3a6f9a59069))
17
+
6
18
  ## [1.1.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/error-tracking@1.1.1...@exodus/error-tracking@1.1.2) (2024-07-18)
7
19
 
8
20
  **Note:** Version bump only for package @exodus/error-tracking
package/api/index.js CHANGED
@@ -1,22 +1,38 @@
1
1
  import { createErrorTracking } from '../module/create-error-tracking.js'
2
2
 
3
- // Implementation Note: It would have made more sense to add the `errorTracking` module as a dependency instead of
4
- // just its factory function. However, the issue is that adding errorTracking as a dependency to this API node
5
- // will cause the error-tracking-preprocessor to change the track function definition, which is not what we require here.
6
-
7
- const errorTrackingApiDefinition = {
3
+ export const errorTrackingApiDefinition = {
8
4
  id: 'errorTrackingApi',
9
5
  type: 'api',
10
- factory: ({ errorsAtom, config }) => {
6
+ factory: ({ errorsAtom, config, logger, remoteErrorTracking }) => {
11
7
  const { track } = createErrorTracking({ errorsAtom, config })
12
8
 
9
+ let trackRemote
10
+ if (remoteErrorTracking) {
11
+ trackRemote = async ({ error }) => {
12
+ try {
13
+ await remoteErrorTracking.captureError({
14
+ error,
15
+ })
16
+ } catch (err) {
17
+ logger.error('failed to remote track error', err)
18
+ }
19
+ }
20
+ } else {
21
+ trackRemote = async ({ error }) => {
22
+ logger.debug('remote error tracking is disabled', error)
23
+ }
24
+ }
25
+
13
26
  return {
14
27
  errors: {
15
28
  track,
29
+ trackRemote,
16
30
  },
17
31
  }
18
32
  },
19
- dependencies: ['config', 'errorsAtom'],
33
+ dependencies: ['config', 'errorsAtom', 'logger', 'remoteErrorTracking?'],
20
34
  }
21
35
 
22
- export default errorTrackingApiDefinition
36
+ // Implementation Note: It would have made more sense to add the `errorTracking` module as a dependency instead of
37
+ // just its factory function. However, the issue is that adding errorTracking as a dependency to this API node
38
+ // will cause the error-tracking-preprocessor to change the track function definition, which is not what we require here.
package/atoms/index.js CHANGED
@@ -7,7 +7,6 @@ import { createInMemoryAtom } from '@exodus/atoms'
7
7
  */
8
8
  const errorsAtomDefinition = {
9
9
  id: 'errorsAtom',
10
- private: true,
11
10
  type: 'atom',
12
11
  factory: () => createInMemoryAtom({ defaultValue: { errors: [] } }),
13
12
  dependencies: [],
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { isEmpty } from './is-empty.js'
2
2
 
3
- import errorTrackingApiDefinition from './api/index.js'
3
+ import { errorTrackingApiDefinition } from './api/index.js'
4
+
4
5
  import errorTrackingAtomDefinition from './atoms/index.js'
5
6
  import errorTrackingReportDefinition from './report/index.js'
6
7
  import { errorTrackingDefinition, remoteErrorTrackingDefinition } from './module/index.js'
@@ -7,4 +7,5 @@ export const errorTrackingDefinition = {
7
7
  type: 'module',
8
8
  factory: createErrorTracking,
9
9
  dependencies: ['config', 'errorsAtom'],
10
+ public: true,
10
11
  }
@@ -5,7 +5,6 @@ import createFetchival from '@exodus/fetch/create-fetchival'
5
5
  export const remoteErrorTrackingDefinition = {
6
6
  id: 'remoteErrorTracking',
7
7
  type: 'module',
8
- private: true,
9
8
  factory: ({ config, fetch, defaultStackTraceParser }) => {
10
9
  const fetchival = createFetchival({ fetch })
11
10
  return createSentryClient({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/error-tracking",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "description": "A simple error tracking package to let any feature collect errors and create the report",
6
6
  "author": "Exodus Movement, Inc.",
@@ -38,5 +38,5 @@
38
38
  "@exodus/sentry-client": "^3.2.0",
39
39
  "@exodus/typeforce": "^1.19.0"
40
40
  },
41
- "gitHead": "a76a22c96445bcaa05e18de0e0c323cf9dd04cba"
41
+ "gitHead": "795fabca74101cee3be6c9a0581b327e9cc3293f"
42
42
  }
package/report/index.js CHANGED
@@ -8,6 +8,7 @@ const errorTrackingReportDefinition = {
8
8
  },
9
9
  }),
10
10
  dependencies: ['errorsAtom'],
11
+ public: true,
11
12
  }
12
13
 
13
14
  export default errorTrackingReportDefinition