@nativescript-community/sentry 2.0.8 → 3.0.2

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +88 -4
  3. package/backend.d.ts +28 -0
  4. package/backend.js +18 -3
  5. package/backend.js.map +1 -1
  6. package/client.d.ts +8 -10
  7. package/client.js +11 -18
  8. package/client.js.map +1 -1
  9. package/index.d.ts +9 -4
  10. package/index.js +11 -5
  11. package/index.js.map +1 -1
  12. package/integrations/devicecontext.js +0 -1
  13. package/integrations/devicecontext.js.map +1 -1
  14. package/integrations/eventorigin.d.ts +16 -0
  15. package/integrations/eventorigin.js +26 -0
  16. package/integrations/eventorigin.js.map +1 -0
  17. package/integrations/nativescripterrorhandlers.js +0 -22
  18. package/integrations/nativescripterrorhandlers.js.map +1 -1
  19. package/integrations/release.js +24 -14
  20. package/integrations/release.js.map +1 -1
  21. package/integrations/sdkinfo.d.ts +17 -0
  22. package/integrations/sdkinfo.js +48 -0
  23. package/integrations/sdkinfo.js.map +1 -0
  24. package/nssentry.android.d.ts +20 -8
  25. package/nssentry.android.js +264 -202
  26. package/nssentry.android.js.map +1 -1
  27. package/nssentry.d.ts +25 -2
  28. package/nssentry.ios.d.ts +22 -5
  29. package/nssentry.ios.js +176 -72
  30. package/nssentry.ios.js.map +1 -1
  31. package/package.json +10 -9
  32. package/platforms/android/buildscript.gradle +1 -2
  33. package/platforms/android/include.gradle +1 -1
  34. package/platforms/android/sentry.aar +0 -0
  35. package/platforms/ios/Podfile +1 -1
  36. package/platforms/ios/src/Info.plist +0 -0
  37. package/platforms/ios/src/NSSentry.h +11 -0
  38. package/platforms/ios/src/NSSentry.m +5 -0
  39. package/platforms/ios/src/module.modulemap +4 -0
  40. package/pnpm-lock.yaml +74 -43
  41. package/scope.d.ts +45 -0
  42. package/scope.js +72 -0
  43. package/scope.js.map +1 -0
  44. package/sdk.d.ts +9 -0
  45. package/sdk.js +46 -12
  46. package/sdk.js.map +1 -1
  47. package/tracing/index.d.ts +1 -0
  48. package/tracing/index.js +8 -0
  49. package/tracing/index.js.map +1 -0
  50. package/tracing/nstracing.d.ts +65 -0
  51. package/tracing/nstracing.js +92 -0
  52. package/tracing/nstracing.js.map +1 -0
  53. package/tracing/utils.d.ts +6 -0
  54. package/tracing/utils.js +21 -0
  55. package/tracing/utils.js.map +1 -0
  56. package/version.d.ts +1 -1
  57. package/version.js +1 -1
  58. package/version.js.map +1 -1
package/pnpm-lock.yaml CHANGED
@@ -1,26 +1,27 @@
1
1
  dependencies:
2
- '@sentry/browser': 5.20.0
3
- '@sentry/core': 5.20.0
4
- '@sentry/hub': 5.20.0
5
- '@sentry/integrations': 5.20.0
6
- '@sentry/minimal': 5.20.0
7
- '@sentry/types': 5.20.0
8
- '@sentry/utils': 5.20.0
2
+ '@sentry/browser': 6.2.0
3
+ '@sentry/core': 6.2.0
4
+ '@sentry/hub': 6.2.0
5
+ '@sentry/integrations': 6.2.0
6
+ '@sentry/minimal': 6.2.0
7
+ '@sentry/tracing': 6.2.0
8
+ '@sentry/types': 6.2.0
9
+ '@sentry/utils': 6.2.0
9
10
  '@sentry/wizard': 1.1.4
10
11
  stacktrace-parser: 0.1.10
11
- lockfileVersion: 5.1
12
+ lockfileVersion: 5.2
12
13
  packages:
13
- /@sentry/browser/5.20.0:
14
+ /@sentry/browser/6.2.0:
14
15
  dependencies:
15
- '@sentry/core': 5.20.0
16
- '@sentry/types': 5.20.0
17
- '@sentry/utils': 5.20.0
16
+ '@sentry/core': 6.2.0
17
+ '@sentry/types': 6.2.0
18
+ '@sentry/utils': 6.2.0
18
19
  tslib: 1.10.0
19
20
  dev: false
20
21
  engines:
21
22
  node: '>=6'
22
23
  resolution:
23
- integrity: sha512-xVPL7/RuAPcemfSzXiyPHAt4M+0BfzkdTlN+PZb6frCEo4k6E0UiN6WLsGj/iwa2gXhyfTQXtbTuP+tDuNPEJw==
24
+ integrity: sha512-4r3paHcHXLemj471BtNDhUs2kvJxk5XDRplz1dbC/LHXN5PWEXP4anhGILxOlxqi4y33r53PIZu3xXFjznaVZA==
24
25
  /@sentry/cli/1.55.0:
25
26
  dependencies:
26
27
  https-proxy-agent: 5.0.0
@@ -35,63 +36,76 @@ packages:
35
36
  requiresBuild: true
36
37
  resolution:
37
38
  integrity: sha512-LOpM69Kvfaossq92wgP8cg3+0XBc9lg76udH4OdmpSZhtavS/qxWedBsnTicaT//7rQUNZBUnTPOpmCYnpGEIA==
38
- /@sentry/core/5.20.0:
39
+ /@sentry/core/6.2.0:
39
40
  dependencies:
40
- '@sentry/hub': 5.20.0
41
- '@sentry/minimal': 5.20.0
42
- '@sentry/types': 5.20.0
43
- '@sentry/utils': 5.20.0
41
+ '@sentry/hub': 6.2.0
42
+ '@sentry/minimal': 6.2.0
43
+ '@sentry/types': 6.2.0
44
+ '@sentry/utils': 6.2.0
44
45
  tslib: 1.10.0
45
46
  dev: false
46
47
  engines:
47
48
  node: '>=6'
48
49
  resolution:
49
- integrity: sha512-fzzWKEolc0O6H/phdDenzKs7JXDSb0sooxVn0QCUkwWSzACALQh+NR/UciOXyhyuoUiqu4zthYQx02qtGqizeQ==
50
- /@sentry/hub/5.20.0:
50
+ integrity: sha512-oTr2b25l+0bv/+d6IgMamPuGleWV7OgJb0NFfd+WZhw6UDRgr7CdEJy2gW6tK8SerwXgPHdn4ervxsT3WIBiXw==
51
+ /@sentry/hub/6.2.0:
51
52
  dependencies:
52
- '@sentry/types': 5.20.0
53
- '@sentry/utils': 5.20.0
53
+ '@sentry/types': 6.2.0
54
+ '@sentry/utils': 6.2.0
54
55
  tslib: 1.10.0
55
56
  dev: false
56
57
  engines:
57
58
  node: '>=6'
58
59
  resolution:
59
- integrity: sha512-DiU8fpjAAMOgSx5tsTekMtHPCAtSNWSNS91FFkDCqPn6fYG+/aK/hB5kTlJwr+GTM1815+WWrtXP6y2ecSmZuA==
60
- /@sentry/integrations/5.20.0:
60
+ integrity: sha512-BDTEFK8vlJydWXp/KMX0stvv73V7od224iLi+w3k7BcPwMKXBuURBXPU8d5XIC4G8nwg8X6cnDvwL+zBBlBbkg==
61
+ /@sentry/integrations/6.2.0:
61
62
  dependencies:
62
- '@sentry/types': 5.20.0
63
- '@sentry/utils': 5.20.0
63
+ '@sentry/types': 6.2.0
64
+ '@sentry/utils': 6.2.0
65
+ localforage: 1.8.1
64
66
  tslib: 1.10.0
65
67
  dev: false
66
68
  engines:
67
69
  node: '>=6'
68
70
  resolution:
69
- integrity: sha512-ADL6rBJbwYy4P30zjWiRzmAc+PDqMch2URj+Tj89oVK+tUDQQ9qOM9DD4rBTeidqO2h1ninyZAJ3Vu9UJ/5g9A==
70
- /@sentry/minimal/5.20.0:
71
+ integrity: sha512-gvAhP61qs2fog2xCTDs94ZT8cZbWEjFZmOWfT1VXlZDIVopIporj5Qe6IgrLTiCWL61Yko5h5nFnPZ4mpjf+0w==
72
+ /@sentry/minimal/6.2.0:
71
73
  dependencies:
72
- '@sentry/hub': 5.20.0
73
- '@sentry/types': 5.20.0
74
+ '@sentry/hub': 6.2.0
75
+ '@sentry/types': 6.2.0
74
76
  tslib: 1.10.0
75
77
  dev: false
76
78
  engines:
77
79
  node: '>=6'
78
80
  resolution:
79
- integrity: sha512-oA+0g7p3bapzjgGKQIkSjcjA85VG1HPmjxBD9wpRvNjmYuVmm80Cl1H/P+xg/hupw/kNmASAX4IOd5Z9pEeboA==
80
- /@sentry/types/5.20.0:
81
+ integrity: sha512-haxsx8/ZafhZUaGeeMtY7bJt9HbDlqeiaXrRMp1CxGtd0ZRQwHt60imEjl6IH1I73SEWxNfqScGsX2s3HzztMg==
82
+ /@sentry/tracing/6.2.0:
83
+ dependencies:
84
+ '@sentry/hub': 6.2.0
85
+ '@sentry/minimal': 6.2.0
86
+ '@sentry/types': 6.2.0
87
+ '@sentry/utils': 6.2.0
88
+ tslib: 1.10.0
81
89
  dev: false
82
90
  engines:
83
91
  node: '>=6'
84
92
  resolution:
85
- integrity: sha512-/9tiGiXBRsOKM66HeCpt0iSF0vnAIqHzXgC97icNQIstx/ZA8tcLs9540cHDeaN0cyZUyZF1o8ECqcLXGNODWQ==
86
- /@sentry/utils/5.20.0:
93
+ integrity: sha512-pzgM1dePPJysVnzaFCMp+BKtjM5q46HZeyShiR+KcQYvneD3fmUPJigDkkcsB2DcrY3mFvDcswjoqxaTIW7ZBQ==
94
+ /@sentry/types/6.2.0:
95
+ dev: false
96
+ engines:
97
+ node: '>=6'
98
+ resolution:
99
+ integrity: sha512-vN4P/a+QqAuVfWFB9G3nQ7d6bgnM9jd/RLVi49owMuqvM24pv5mTQHUk2Hk4S3k7ConrHFl69E7xH6Dv5VpQnQ==
100
+ /@sentry/utils/6.2.0:
87
101
  dependencies:
88
- '@sentry/types': 5.20.0
102
+ '@sentry/types': 6.2.0
89
103
  tslib: 1.10.0
90
104
  dev: false
91
105
  engines:
92
106
  node: '>=6'
93
107
  resolution:
94
- integrity: sha512-w0AeAzWEf35h9U9QL/4lgS9MqaTPjeSmQYNU/n4ef3FKr+u8HP68Ra7NZ0adiKgi67Yxr652kWopOLPl7CxvZg==
108
+ integrity: sha512-YToUC7xYf2E/pIluI7upYTlj8fKXOtdwoOBkcQZifHgX/dP+qDaHibbBFe5PyZwdmU2UiLnWFsBr0gjo0QFo1g==
95
109
  /@sentry/wizard/1.1.4:
96
110
  dependencies:
97
111
  '@sentry/cli': 1.55.0
@@ -383,6 +397,10 @@ packages:
383
397
  node: '>=0.10.0'
384
398
  resolution:
385
399
  integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
400
+ /immediate/3.0.6:
401
+ dev: false
402
+ resolution:
403
+ integrity: sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=
386
404
  /inflight/1.0.6:
387
405
  dependencies:
388
406
  once: 1.4.0
@@ -466,6 +484,18 @@ packages:
466
484
  node: '>=6'
467
485
  resolution:
468
486
  integrity: sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==
487
+ /lie/3.1.1:
488
+ dependencies:
489
+ immediate: 3.0.6
490
+ dev: false
491
+ resolution:
492
+ integrity: sha1-mkNrLMd0bKWd56QfpGmz77dr2H4=
493
+ /localforage/1.8.1:
494
+ dependencies:
495
+ lie: 3.1.1
496
+ dev: false
497
+ resolution:
498
+ integrity: sha512-azSSJJfc7h4bVpi0PGi+SmLQKJl2/8NErI+LhJsrORNikMZnhaQ7rv9fHj+ofwgSHrKRlsDCL/639a6nECIKuQ==
469
499
  /locate-path/3.0.0:
470
500
  dependencies:
471
501
  p-locate: 3.0.0
@@ -947,12 +977,13 @@ packages:
947
977
  resolution:
948
978
  integrity: sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==
949
979
  specifiers:
950
- '@sentry/browser': ^5.19.2
951
- '@sentry/core': ^5.19.2
952
- '@sentry/hub': ^5.19.2
953
- '@sentry/integrations': ^5.19.2
954
- '@sentry/minimal': ^5.19.2
955
- '@sentry/types': ^5.19.2
956
- '@sentry/utils': ^5.19.2
980
+ '@sentry/browser': 6.2.0
981
+ '@sentry/core': 6.2.0
982
+ '@sentry/hub': 6.2.0
983
+ '@sentry/integrations': 6.2.0
984
+ '@sentry/minimal': 6.2.0
985
+ '@sentry/tracing': 6.2.0
986
+ '@sentry/types': 6.2.0
987
+ '@sentry/utils': 6.2.0
957
988
  '@sentry/wizard': ^1.1.4
958
989
  stacktrace-parser: 0.1.10
package/scope.d.ts ADDED
@@ -0,0 +1,45 @@
1
+ import { Scope } from '@sentry/hub';
2
+ import { Breadcrumb, User } from '@sentry/types';
3
+ /**
4
+ * Extends the scope methods to set scope on the Native SDKs
5
+ */
6
+ export declare class NativescriptScope extends Scope {
7
+ /**
8
+ * @inheritDoc
9
+ */
10
+ setUser(user: User | null): this;
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ setTag(key: string, value: string): this;
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ setTags(tags: {
19
+ [key: string]: string;
20
+ }): this;
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ setExtras(extras: {
25
+ [key: string]: any;
26
+ }): this;
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ setExtra(key: string, extra: any): this;
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this;
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ clearBreadcrumbs(): this;
39
+ /**
40
+ * @inheritDoc
41
+ */
42
+ setContext(key: string, context: {
43
+ [key: string]: any;
44
+ } | null): this;
45
+ }
package/scope.js ADDED
@@ -0,0 +1,72 @@
1
+ import { Scope } from '@sentry/hub';
2
+ import { NSSentry } from './nssentry';
3
+ /**
4
+ * Extends the scope methods to set scope on the Native SDKs
5
+ */
6
+ export class NativescriptScope extends Scope {
7
+ /**
8
+ * @inheritDoc
9
+ */
10
+ setUser(user) {
11
+ NSSentry.setUser(user);
12
+ return super.setUser(user);
13
+ }
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ setTag(key, value) {
18
+ NSSentry.setTag(key, value);
19
+ return super.setTag(key, value);
20
+ }
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ setTags(tags) {
25
+ // As native only has setTag, we just loop through each tag key.
26
+ Object.keys(tags).forEach((key) => {
27
+ NSSentry.setTag(key, tags[key]);
28
+ });
29
+ return super.setTags(tags);
30
+ }
31
+ /**
32
+ * @inheritDoc
33
+ */
34
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
+ setExtras(extras) {
36
+ Object.keys(extras).forEach((key) => {
37
+ NSSentry.setExtra(key, extras[key]);
38
+ });
39
+ return super.setExtras(extras);
40
+ }
41
+ /**
42
+ * @inheritDoc
43
+ */
44
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any
45
+ setExtra(key, extra) {
46
+ NSSentry.setExtra(key, extra);
47
+ return super.setExtra(key, extra);
48
+ }
49
+ /**
50
+ * @inheritDoc
51
+ */
52
+ addBreadcrumb(breadcrumb, maxBreadcrumbs) {
53
+ NSSentry.addBreadcrumb(breadcrumb);
54
+ return super.addBreadcrumb(breadcrumb, maxBreadcrumbs);
55
+ }
56
+ /**
57
+ * @inheritDoc
58
+ */
59
+ clearBreadcrumbs() {
60
+ NSSentry.clearBreadcrumbs();
61
+ return super.clearBreadcrumbs();
62
+ }
63
+ /**
64
+ * @inheritDoc
65
+ */
66
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
67
+ setContext(key, context) {
68
+ NSSentry.setContext(key, context);
69
+ return super.setContext(key, context);
70
+ }
71
+ }
72
+ //# sourceMappingURL=scope.js.map
package/scope.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope.js","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACxC;;OAEG;IACI,OAAO,CAAC,IAAiB;QAC5B,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,GAAW,EAAE,KAAa;QACpC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5B,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,OAAO,CAAC,IAA+B;QAC1C,gEAAgE;QAChE,MAAM,CAAC,IAAI,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;IAC1C,CAAC;CACJ"}
package/sdk.d.ts CHANGED
@@ -20,3 +20,12 @@ export declare function setDist(dist: string): void;
20
20
  * Use this only for testing purposes.
21
21
  */
22
22
  export declare function nativeCrash(): void;
23
+ /**
24
+ * Flushes all pending events in the queue to disk.
25
+ * Use this before applying any realtime updates such as code-push or expo updates.
26
+ */
27
+ export declare function flush(): Promise<boolean>;
28
+ /**
29
+ * Closes the SDK, stops sending events.
30
+ */
31
+ export declare function close(): Promise<void>;
package/sdk.js CHANGED
@@ -1,23 +1,31 @@
1
1
  import { Integrations, defaultIntegrations, getCurrentHub } from '@sentry/browser';
2
2
  import { initAndBind, setExtra } from '@sentry/core';
3
+ import { Hub, makeMain } from '@sentry/hub';
3
4
  import { RewriteFrames } from '@sentry/integrations';
4
5
  import { NativescriptClient } from './client';
5
- import { DeviceContext, NativescriptErrorHandlers, Release } from './integrations';
6
+ import { NativescriptScope } from './scope';
7
+ import { NativescriptErrorHandlers, Release } from './integrations';
8
+ import { EventOrigin } from './integrations/eventorigin';
9
+ import { SdkInfo } from './integrations/sdkinfo';
6
10
  const IGNORED_DEFAULT_INTEGRATIONS = [
7
11
  'GlobalHandlers',
8
12
  'Breadcrumbs',
9
- 'TryCatch',
13
+ 'CaptureConsole',
14
+ 'TryCatch' // We don't need this
10
15
  ];
11
16
  export let rewriteFrameIntegration;
12
17
  /**
13
18
  * Inits the SDK
14
19
  */
15
20
  export function init(options = {
21
+ flushSendEvent: true,
16
22
  enableNative: true,
17
23
  enableNativeCrashHandling: true,
24
+ enableAutoPerformanceTracking: true
18
25
  }) {
26
+ const nativescriptHub = new Hub(undefined, new NativescriptScope());
27
+ makeMain(nativescriptHub);
19
28
  // tslint:disable: strict-comparisons
20
- console.log('init');
21
29
  if (options.defaultIntegrations === undefined) {
22
30
  rewriteFrameIntegration = new RewriteFrames({
23
31
  iteratee: (frame) => {
@@ -40,21 +48,16 @@ export function init(options = {
40
48
  // We always want to have a tripple slash
41
49
  }
42
50
  return frame;
43
- },
51
+ }
44
52
  });
45
53
  options.defaultIntegrations = [
46
54
  new NativescriptErrorHandlers(options),
47
55
  new Release(),
48
56
  ...defaultIntegrations.filter((i) => !IGNORED_DEFAULT_INTEGRATIONS.includes(i.name)),
49
- new Integrations.Breadcrumbs({
50
- // console: false,
51
- xhr: false,
52
- dom: false,
53
- fetch: false,
54
- }),
55
- // new DebugSymbolicator(),
57
+ new Integrations.Breadcrumbs(Object.assign({ console: false, xhr: false, dom: false, fetch: false }, (options.breadcrumbs || {}))),
56
58
  rewriteFrameIntegration,
57
- new DeviceContext(),
59
+ new EventOrigin(),
60
+ new SdkInfo()
58
61
  ];
59
62
  }
60
63
  if (options.enableNative === undefined) {
@@ -90,4 +93,35 @@ export function nativeCrash() {
90
93
  client.nativeCrash();
91
94
  }
92
95
  }
96
+ /**
97
+ * Flushes all pending events in the queue to disk.
98
+ * Use this before applying any realtime updates such as code-push or expo updates.
99
+ */
100
+ export async function flush() {
101
+ try {
102
+ const client = getCurrentHub().getClient();
103
+ if (client) {
104
+ const result = await client.flush();
105
+ return result;
106
+ }
107
+ // eslint-disable-next-line no-empty
108
+ }
109
+ catch (_) { }
110
+ console.error('Failed to flush the event queue.');
111
+ return false;
112
+ }
113
+ /**
114
+ * Closes the SDK, stops sending events.
115
+ */
116
+ export async function close() {
117
+ try {
118
+ const client = getCurrentHub().getClient();
119
+ if (client) {
120
+ await client.close();
121
+ }
122
+ }
123
+ catch (e) {
124
+ console.error('Failed to close the SDK');
125
+ }
126
+ }
93
127
  //# sourceMappingURL=sdk.js.map
package/sdk.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,s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,MAAM,UAAU,WAAW;IACvB,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAsB,CAAC;IAC/D,IAAI,MAAM,EAAE;QACR,MAAM,CAAC,WAAW,EAAE,CAAC;KACxB;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK;IACvB,IAAI;QACA,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAsB,CAAC;QAE/D,IAAI,MAAM,EAAE;YACR,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;YAEpC,OAAO,MAAM,CAAC;SACjB;QACD,oCAAoC;KACvC;IAAC,OAAO,CAAC,EAAE,GAAE;IAEd,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAElD,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK;IACvB,IAAI;QACA,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,EAAsB,CAAC;QAE/D,IAAI,MAAM,EAAE;YACR,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;SACxB;KACJ;IAAC,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC5C;AACL,CAAC"}
@@ -0,0 +1 @@
1
+ export { NSTracing } from './nstracing';
@@ -0,0 +1,8 @@
1
+ export { NSTracing } from './nstracing';
2
+ // export { ReactNavigationV5Instrumentation } from "./reactnavigationv5";
3
+ // export { ReactNavigationV4Instrumentation } from "./reactnavigationv4";
4
+ // export {
5
+ // RoutingInstrumentation,
6
+ // RoutingInstrumentationInstance,
7
+ // } from "./routingInstrumentation";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tracing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,0EAA0E;AAC1E,0EAA0E;AAC1E,WAAW;AACX,4BAA4B;AAC5B,oCAAoC;AACpC,qCAAqC"}
@@ -0,0 +1,65 @@
1
+ import { RequestInstrumentationOptions } from '@sentry/tracing';
2
+ import { EventProcessor, Hub, Integration, TransactionContext } from '@sentry/types';
3
+ export interface NSTracingOptions extends RequestInstrumentationOptions {
4
+ /**
5
+ * The time to wait in ms until the transaction will be finished. The transaction will use the end timestamp of
6
+ * the last finished span as the endtime for the transaction.
7
+ * Time is in ms.
8
+ *
9
+ * Default: 1000
10
+ */
11
+ idleTimeout: number;
12
+ /**
13
+ * The maximum duration of a transaction before it will be marked as "deadline_exceeded".
14
+ * If you never want to mark a transaction set it to 0.
15
+ * Time is in seconds.
16
+ *
17
+ * Default: 600
18
+ */
19
+ maxTransactionDuration: number;
20
+ /**
21
+ * The routing instrumentation to be used with the tracing integration.
22
+ * There is no routing instrumentation if nothing is passed.
23
+ */
24
+ /**
25
+ * Does not sample transactions that are from routes that have been seen any more and don't have any spans.
26
+ * This removes a lot of the clutter as most back navigation transactions are now ignored.
27
+ *
28
+ * Default: true
29
+ */
30
+ ignoreEmptyBackNavigationTransactions?: boolean;
31
+ /**
32
+ * beforeNavigate is called before a navigation transaction is created and allows users to modify transaction
33
+ * context data, or drop the transaction entirely (by setting `sampled = false` in the context).
34
+ *
35
+ * @param context: The context data which will be passed to `startTransaction` by default
36
+ *
37
+ * @returns A (potentially) modified context object, with `sampled = false` if the transaction should be dropped.
38
+ */
39
+ beforeNavigate?(context: TransactionContext): TransactionContext;
40
+ }
41
+ /**
42
+ * Tracing integration for React Native.
43
+ */
44
+ export declare class NSTracing implements Integration {
45
+ /**
46
+ * @inheritDoc
47
+ */
48
+ static id: string;
49
+ /**
50
+ * @inheritDoc
51
+ */
52
+ name: string;
53
+ /** NSTracing options */
54
+ options: NSTracingOptions;
55
+ private _getCurrentHub?;
56
+ constructor(options?: Partial<NSTracingOptions>);
57
+ /**
58
+ * Registers routing and request instrumentation.
59
+ */
60
+ setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void;
61
+ /** To be called when the route changes, but BEFORE the components of the new route mount. */
62
+ private _onRouteWillChange;
63
+ /** Create routing idle transaction. */
64
+ private _createRouteTransaction;
65
+ }
@@ -0,0 +1,92 @@
1
+ import { defaultRequestInstrumentationOptions, registerRequestInstrumentation, startIdleTransaction, } from '@sentry/tracing';
2
+ import { logger } from '@sentry/utils';
3
+ // import { RoutingInstrumentationInstance } from '../tracing/routingInstrumentation';
4
+ import { adjustTransactionDuration } from './utils';
5
+ const defaultNSTracingOptions = Object.assign(Object.assign({}, defaultRequestInstrumentationOptions), { idleTimeout: 1000, maxTransactionDuration: 600, ignoreEmptyBackNavigationTransactions: true });
6
+ /**
7
+ * Tracing integration for React Native.
8
+ */
9
+ export class NSTracing {
10
+ constructor(options = {}) {
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ this.name = NSTracing.id;
15
+ this.options = Object.assign(Object.assign({}, defaultNSTracingOptions), options);
16
+ }
17
+ /**
18
+ * Registers routing and request instrumentation.
19
+ */
20
+ setupOnce(
21
+ // @ts-ignore TODO
22
+ addGlobalEventProcessor, getCurrentHub) {
23
+ // eslint-disable-next-line @typescript-eslint/unbound-method
24
+ const { traceFetch, traceXHR, tracingOrigins,
25
+ // @ts-ignore TODO
26
+ shouldCreateSpanForRequest, } = this.options;
27
+ this._getCurrentHub = getCurrentHub;
28
+ // routingInstrumentation?.registerRoutingInstrumentation(
29
+ // this._onRouteWillChange.bind(this)
30
+ // );
31
+ // if (!routingInstrumentation) {
32
+ // logger.log(
33
+ // '[NSTracing] Not instrumenting route changes as routingInstrumentation has not been set.'
34
+ // );
35
+ // }
36
+ registerRequestInstrumentation({
37
+ traceFetch,
38
+ traceXHR,
39
+ tracingOrigins,
40
+ shouldCreateSpanForRequest,
41
+ });
42
+ addGlobalEventProcessor((event) => {
43
+ // eslint-disable-next-line no-empty
44
+ if (event.type === 'transaction') {
45
+ }
46
+ return event;
47
+ });
48
+ }
49
+ /** To be called when the route changes, but BEFORE the components of the new route mount. */
50
+ _onRouteWillChange(context) {
51
+ // TODO: Consider more features on route change, one example is setting a tag of what route the user is on
52
+ return this._createRouteTransaction(context);
53
+ }
54
+ /** Create routing idle transaction. */
55
+ _createRouteTransaction(context) {
56
+ if (!this._getCurrentHub) {
57
+ logger.warn(`[NSTracing] Did not create ${context.op} transaction because _getCurrentHub is invalid.`);
58
+ return undefined;
59
+ }
60
+ // eslint-disable-next-line @typescript-eslint/unbound-method
61
+ const { beforeNavigate, idleTimeout, maxTransactionDuration, } = this.options;
62
+ const expandedContext = Object.assign(Object.assign({}, context), { trimEnd: true });
63
+ const modifiedContext = typeof beforeNavigate === 'function'
64
+ ? beforeNavigate(expandedContext)
65
+ : expandedContext;
66
+ if (modifiedContext.sampled === false) {
67
+ logger.log(`[NSTracing] Will not send ${context.op} transaction.`);
68
+ }
69
+ const hub = this._getCurrentHub();
70
+ const idleTransaction = startIdleTransaction(hub, context, idleTimeout, true);
71
+ logger.log(`[NSTracing] Starting ${context.op} transaction on scope`);
72
+ idleTransaction.registerBeforeFinishCallback((transaction, endTimestamp) => {
73
+ adjustTransactionDuration(maxTransactionDuration, transaction, endTimestamp);
74
+ });
75
+ if (this.options.ignoreEmptyBackNavigationTransactions) {
76
+ idleTransaction.registerBeforeFinishCallback((transaction) => {
77
+ if (transaction.data['routing.route.hasBeenSeen'] &&
78
+ (!transaction.spanRecorder ||
79
+ transaction.spanRecorder.spans.filter((span) => span.spanId !== transaction.spanId).length === 0)) {
80
+ // Route has been seen before and has no child spans.
81
+ transaction.sampled = false;
82
+ }
83
+ });
84
+ }
85
+ return idleTransaction;
86
+ }
87
+ }
88
+ /**
89
+ * @inheritDoc
90
+ */
91
+ NSTracing.id = 'NSTracing';
92
+ //# sourceMappingURL=nstracing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nstracing.js","sourceRoot":"","sources":["../../src/tracing/nstracing.ts"],"names":[],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K,CAAC,MAAM,CACjC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,CAC/C,CAAC,MAAM,KAAK,CAAC,CAAC,EACX;oBACE,qDAAqD;oBACrD,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;iBAC/B;YACL,CAAC,CAAC,CAAC;SACN;QAED,OAAO,eAAkC,CAAC;IAC9C,CAAC;;AAjJD;;GAEG;AACW,YAAE,GAAW,WAAW,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { IdleTransaction } from '@sentry/tracing';
2
+ /**
3
+ *
4
+ */
5
+ export declare function adjustTransactionDuration(maxDuration: number, // in seconds
6
+ transaction: IdleTransaction, endTimestamp: number): void;
@@ -0,0 +1,21 @@
1
+ import { SpanStatus } from '@sentry/tracing';
2
+ /**
3
+ * Converts from seconds to milliseconds
4
+ * @param time time in seconds
5
+ */
6
+ function secToMs(time) {
7
+ return time * 1000;
8
+ }
9
+ /**
10
+ *
11
+ */
12
+ export function adjustTransactionDuration(maxDuration, // in seconds
13
+ transaction, endTimestamp) {
14
+ const diff = endTimestamp - transaction.startTimestamp;
15
+ const isOutdatedTransaction = endTimestamp && (diff > secToMs(maxDuration) || diff < 0);
16
+ if (isOutdatedTransaction) {
17
+ transaction.setStatus(SpanStatus.DeadlineExceeded);
18
+ transaction.setTag('maxTransactionDurationExceeded', 'true');
19
+ }
20
+ }
21
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/tracing/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;;GAGG;AACH,SAAS,OAAO,CAAC,IAAY;IACzB,OAAO,IAAI,GAAG,IAAI,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACrC,WAAmB,EAAE,aAAa;AAClC,WAA4B,EAC5B,YAAoB;IAEpB,MAAM,IAAI,GAAG,YAAY,GAAG,WAAW,CAAC,cAAc,CAAC;IACvD,MAAM,qBAAqB,GAC3B,YAAY,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC;IAC1D,IAAI,qBAAqB,EAAE;QACvB,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;QACnD,WAAW,CAAC,MAAM,CAAC,gCAAgC,EAAE,MAAM,CAAC,CAAC;KAChE;AACL,CAAC"}
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export declare const SDK_NAME = "sentry.nativescript";
2
- export declare const SDK_VERSION = "1.0.0-beta.0";
2
+ export declare const SDK_VERSION = "3.0.0";