@datadog/mobile-react-native 1.7.1 → 1.8.0-rc0

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 (131) hide show
  1. package/DatadogSDKReactNative.podspec +14 -1
  2. package/android/build.gradle +20 -7
  3. package/android/src/main/kotlin/com/datadog/reactnative/{DdLogs.kt → DdLogsImplementation.kt} +3 -17
  4. package/android/src/main/kotlin/com/datadog/reactnative/{DdRum.kt → DdRumImplementation.kt} +2 -18
  5. package/android/src/main/kotlin/com/datadog/reactnative/{DdSdk.kt → DdSdkImplementation.kt} +3 -14
  6. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkReactNativePackage.kt +34 -17
  7. package/android/src/main/kotlin/com/datadog/reactnative/{DdTrace.kt → DdTraceImplementation.kt} +6 -11
  8. package/android/src/newarch/kotlin/com/datadog/reactnative/DdLogs.kt +148 -0
  9. package/android/src/newarch/kotlin/com/datadog/reactnative/DdRum.kt +199 -0
  10. package/android/src/newarch/kotlin/com/datadog/reactnative/DdSdk.kt +90 -0
  11. package/android/src/newarch/kotlin/com/datadog/reactnative/DdTrace.kt +46 -0
  12. package/android/src/oldarch/kotlin/com/datadog/reactnative/DdLogs.kt +163 -0
  13. package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +200 -0
  14. package/android/src/oldarch/kotlin/com/datadog/reactnative/DdSdk.kt +91 -0
  15. package/android/src/oldarch/kotlin/com/datadog/reactnative/DdTrace.kt +47 -0
  16. package/android/src/test/kotlin/com/datadog/reactnative/DdLogsTest.kt +3 -13
  17. package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +2 -6
  18. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +33 -33
  19. package/android/src/test/kotlin/com/datadog/reactnative/DdTraceTest.kt +2 -6
  20. package/ios/Sources/{DdSdkReactNative-Bridging-Header.h → DatadogSDKReactNative.h} +2 -1
  21. package/ios/Sources/DdLogs.h +24 -0
  22. package/ios/Sources/DdLogs.mm +149 -0
  23. package/ios/Sources/{DdLogs.swift → DdLogsImplementation.swift} +20 -29
  24. package/ios/Sources/DdRum.h +24 -0
  25. package/ios/Sources/DdRum.mm +188 -0
  26. package/ios/Sources/{DdRum.swift → DdRumImplementation.swift} +28 -35
  27. package/ios/Sources/DdSdk.h +24 -0
  28. package/ios/Sources/DdSdk.mm +119 -0
  29. package/ios/Sources/{DdSdk.swift → DdSdkImplementation.swift} +20 -25
  30. package/ios/Sources/DdTrace.h +24 -0
  31. package/ios/Sources/DdTrace.mm +66 -0
  32. package/ios/Sources/{DdTrace.swift → DdTraceImplementation.swift} +10 -17
  33. package/ios/Sources/QueueHolder.swift +8 -0
  34. package/jest/mock.js +3 -1
  35. package/lib/commonjs/DdSdkReactNative.js +32 -49
  36. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  37. package/lib/commonjs/DdSdkReactNativeConfiguration.js +18 -0
  38. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
  39. package/lib/commonjs/logs/DdLogs.js +33 -40
  40. package/lib/commonjs/logs/DdLogs.js.map +1 -1
  41. package/lib/commonjs/nativeModulesTypes.js +13 -0
  42. package/lib/commonjs/nativeModulesTypes.js.map +1 -1
  43. package/lib/commonjs/rum/DdRum.js +104 -106
  44. package/lib/commonjs/rum/DdRum.js.map +1 -1
  45. package/lib/commonjs/rum/eventMappers/errorEventMapper.js.map +1 -1
  46. package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +11 -1
  47. package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
  48. package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +6 -2
  49. package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
  50. package/lib/commonjs/sdk/DdSdk.js +3 -3
  51. package/lib/commonjs/sdk/DdSdk.js.map +1 -1
  52. package/lib/commonjs/specs/NativeDdLogs.js +20 -0
  53. package/lib/commonjs/specs/NativeDdLogs.js.map +1 -0
  54. package/lib/commonjs/specs/NativeDdRum.js +20 -0
  55. package/lib/commonjs/specs/NativeDdRum.js.map +1 -0
  56. package/lib/commonjs/specs/NativeDdSdk.js +20 -0
  57. package/lib/commonjs/specs/NativeDdSdk.js.map +1 -0
  58. package/lib/commonjs/specs/NativeDdTrace.js +20 -0
  59. package/lib/commonjs/specs/NativeDdTrace.js.map +1 -0
  60. package/lib/commonjs/trace/DdTrace.js +10 -12
  61. package/lib/commonjs/trace/DdTrace.js.map +1 -1
  62. package/lib/commonjs/version.js +1 -1
  63. package/lib/commonjs/version.js.map +1 -1
  64. package/lib/module/DdSdkReactNative.js +27 -44
  65. package/lib/module/DdSdkReactNative.js.map +1 -1
  66. package/lib/module/DdSdkReactNativeConfiguration.js +18 -0
  67. package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
  68. package/lib/module/logs/DdLogs.js +33 -39
  69. package/lib/module/logs/DdLogs.js.map +1 -1
  70. package/lib/module/nativeModulesTypes.js +13 -0
  71. package/lib/module/nativeModulesTypes.js.map +1 -1
  72. package/lib/module/rum/DdRum.js +100 -101
  73. package/lib/module/rum/DdRum.js.map +1 -1
  74. package/lib/module/rum/eventMappers/errorEventMapper.js.map +1 -1
  75. package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +11 -1
  76. package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
  77. package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +6 -2
  78. package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
  79. package/lib/module/sdk/DdSdk.js +3 -2
  80. package/lib/module/sdk/DdSdk.js.map +1 -1
  81. package/lib/module/specs/NativeDdLogs.js +14 -0
  82. package/lib/module/specs/NativeDdLogs.js.map +1 -0
  83. package/lib/module/specs/NativeDdRum.js +14 -0
  84. package/lib/module/specs/NativeDdRum.js.map +1 -0
  85. package/lib/module/specs/NativeDdSdk.js +14 -0
  86. package/lib/module/specs/NativeDdSdk.js.map +1 -0
  87. package/lib/module/specs/NativeDdTrace.js +14 -0
  88. package/lib/module/specs/NativeDdTrace.js.map +1 -0
  89. package/lib/module/trace/DdTrace.js +10 -11
  90. package/lib/module/trace/DdTrace.js.map +1 -1
  91. package/lib/module/version.js +1 -1
  92. package/lib/module/version.js.map +1 -1
  93. package/lib/typescript/DdSdkReactNative.d.ts +4 -4
  94. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +14 -0
  95. package/lib/typescript/logs/DdLogs.d.ts +4 -4
  96. package/lib/typescript/nativeModulesTypes.d.ts +28 -168
  97. package/lib/typescript/rum/DdRum.d.ts +12 -12
  98. package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +4 -4
  99. package/lib/typescript/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts +4 -0
  100. package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +3 -1
  101. package/lib/typescript/specs/NativeDdLogs.d.ts +69 -0
  102. package/lib/typescript/specs/NativeDdRum.d.ts +92 -0
  103. package/lib/typescript/specs/NativeDdSdk.d.ts +46 -0
  104. package/lib/typescript/specs/NativeDdTrace.d.ts +23 -0
  105. package/lib/typescript/version.d.ts +1 -1
  106. package/package.json +10 -2
  107. package/src/DdSdkReactNative.tsx +12 -10
  108. package/src/DdSdkReactNativeConfiguration.tsx +22 -0
  109. package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +3 -1
  110. package/src/__tests__/longTasksUtils.test.ts +5 -0
  111. package/src/__tests__/mock.test.ts +89 -0
  112. package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +54 -0
  113. package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +118 -68
  114. package/src/logs/DdLogs.ts +11 -11
  115. package/src/logs/__tests__/DdLogs.test.ts +1 -1
  116. package/src/nativeModulesTypes.ts +49 -254
  117. package/src/rum/DdRum.ts +36 -32
  118. package/src/rum/eventMappers/errorEventMapper.ts +4 -4
  119. package/src/rum/instrumentation/interactionTracking/DdEventsInterceptor.tsx +15 -0
  120. package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +6 -2
  121. package/src/sdk/DdSdk.ts +2 -3
  122. package/src/specs/NativeDdLogs.ts +110 -0
  123. package/src/specs/NativeDdRum.ts +151 -0
  124. package/src/specs/NativeDdSdk.ts +62 -0
  125. package/src/specs/NativeDdTrace.ts +42 -0
  126. package/src/trace/DdTrace.ts +9 -9
  127. package/src/version.ts +1 -1
  128. package/ios/Sources/DdLogs.m +0 -62
  129. package/ios/Sources/DdRum.m +0 -82
  130. package/ios/Sources/DdSdk.m +0 -41
  131. package/ios/Sources/DdTrace.m +0 -23
@@ -0,0 +1,110 @@
1
+ /*
2
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
+ * Copyright 2016-Present Datadog, Inc.
5
+ */
6
+
7
+ /* eslint-disable @typescript-eslint/ban-types */
8
+ import type { TurboModule } from 'react-native';
9
+ import { TurboModuleRegistry } from 'react-native';
10
+
11
+ /**
12
+ * Do not import this Spec directly, use DdNativeLogsType instead.
13
+ */
14
+ export interface Spec extends TurboModule {
15
+ readonly getConstants: () => {};
16
+
17
+ /**
18
+ * Send a log with DEBUG level.
19
+ * @param message: The message to send.
20
+ * @param context: The additional context to send.
21
+ */
22
+ readonly debug: (message: string, context?: Object) => Promise<void>;
23
+
24
+ /**
25
+ * Send a log with INFO level.
26
+ * @param message: The message to send.
27
+ * @param context: The additional context to send.
28
+ */
29
+ readonly info: (message: string, context?: Object) => Promise<void>;
30
+
31
+ /**
32
+ * Send a log with WARN level.
33
+ * @param message: The message to send.
34
+ * @param context: The additional context to send.
35
+ */
36
+ readonly warn: (message: string, context?: Object) => Promise<void>;
37
+
38
+ /**
39
+ * Send a log with ERROR level.
40
+ * @param message: The message to send.
41
+ * @param context: The additional context to send.
42
+ */
43
+ readonly error: (message: string, context?: Object) => Promise<void>;
44
+
45
+ /**
46
+ * Send a log containing an error with DEBUG level.
47
+ * @param message: The message to send.
48
+ * @param errorKind: The error kind to send.
49
+ * @param errorMessage: The error message to send.
50
+ * @param stacktrace: The stack trace to send.
51
+ * @param context: The additional context to send.
52
+ */
53
+ readonly debugWithError: (
54
+ message: string,
55
+ errorKind?: string,
56
+ errorMessage?: string,
57
+ stacktrace?: string,
58
+ context?: Object
59
+ ) => Promise<void>;
60
+
61
+ /**
62
+ * Send a log containing an error with INDO level.
63
+ * @param message: The message to send.
64
+ * @param errorKind: The error kind to send.
65
+ * @param errorMessage: The error message to send.
66
+ * @param stacktrace: The stack trace to send.
67
+ * @param context: The additional context to send.
68
+ */
69
+ readonly infoWithError: (
70
+ message: string,
71
+ errorKind?: string,
72
+ errorMessage?: string,
73
+ stacktrace?: string,
74
+ context?: Object
75
+ ) => Promise<void>;
76
+
77
+ /**
78
+ * Send a log containing an error with WARN level.
79
+ * @param message: The message to send.
80
+ * @param errorKind: The error kind to send.
81
+ * @param errorMessage: The error message to send.
82
+ * @param stacktrace: The stack trace to send.
83
+ * @param context: The additional context to send.
84
+ */
85
+ readonly warnWithError: (
86
+ message: string,
87
+ errorKind?: string,
88
+ errorMessage?: string,
89
+ stacktrace?: string,
90
+ context?: Object
91
+ ) => Promise<void>;
92
+
93
+ /**
94
+ * Send a log containing an error with ERROR level.
95
+ * @param message: The message to send.
96
+ * @param errorKind: The error kind to send.
97
+ * @param errorMessage: The error message to send.
98
+ * @param stacktrace: The stack trace to send.
99
+ * @param context: The additional context to send.
100
+ */
101
+ readonly errorWithError: (
102
+ message: string,
103
+ errorKind?: string,
104
+ errorMessage?: string,
105
+ stacktrace?: string,
106
+ context?: Object
107
+ ) => Promise<void>;
108
+ }
109
+
110
+ export default TurboModuleRegistry.get<Spec>('DdLogs');
@@ -0,0 +1,151 @@
1
+ /*
2
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
+ * Copyright 2016-Present Datadog, Inc.
5
+ */
6
+
7
+ /* eslint-disable @typescript-eslint/ban-types */
8
+ import type { TurboModule } from 'react-native';
9
+ import { TurboModuleRegistry } from 'react-native';
10
+
11
+ /**
12
+ * Do not import this Spec directly, use DdNativeRumType instead.
13
+ */
14
+ export interface Spec extends TurboModule {
15
+ readonly getConstants: () => {};
16
+
17
+ /**
18
+ * Start tracking a RUM View.
19
+ * @param key: The view unique key identifier.
20
+ * @param name: The view name.
21
+ * @param context: The additional context to send.
22
+ * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.
23
+ */
24
+ startView(
25
+ key: string,
26
+ name: string,
27
+ context: Object,
28
+ timestampMs: number
29
+ ): Promise<void>;
30
+
31
+ /**
32
+ * Stop tracking a RUM View.
33
+ * @param key: The view unique key identifier.
34
+ * @param context: The additional context to send.
35
+ * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.
36
+ */
37
+ stopView(key: string, context: Object, timestampMs: number): Promise<void>;
38
+
39
+ /**
40
+ * Start tracking a RUM Action.
41
+ * @param type: The action type (tap, scroll, swipe, back, custom).
42
+ * @param name: The action name.
43
+ * @param context: The additional context to send.
44
+ * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.
45
+ */
46
+ startAction(
47
+ type: string,
48
+ name: string,
49
+ context: Object,
50
+ timestampMs: number
51
+ ): Promise<void>;
52
+
53
+ /**
54
+ * Stop tracking the ongoing RUM Action.
55
+ * @param type: The action type (tap, scroll, swipe, back, custom).
56
+ * @param name: The action name.
57
+ * @param context: The additional context to send.
58
+ * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.
59
+ */
60
+ stopAction(
61
+ type: string,
62
+ name: string,
63
+ context: Object,
64
+ timestampMs: number
65
+ ): Promise<void>;
66
+
67
+ /**
68
+ * Add a RUM Action.
69
+ * @param type: The action type (tap, scroll, swipe, back, custom).
70
+ * @param name: The action name.
71
+ * @param context: The additional context to send.
72
+ * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.
73
+ */
74
+ addAction(
75
+ type: string,
76
+ name: string,
77
+ context: Object,
78
+ timestampMs: number
79
+ ): Promise<void>;
80
+
81
+ /**
82
+ * Start tracking a RUM Resource.
83
+ * @param key: The resource unique key identifier.
84
+ * @param method: The resource method (GET, POST, …).
85
+ * @param url: The resource url.
86
+ * @param context: The additional context to send.
87
+ * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.
88
+ */
89
+ startResource(
90
+ key: string,
91
+ method: string,
92
+ url: string,
93
+ context: Object,
94
+ timestampMs: number
95
+ ): Promise<void>;
96
+
97
+ /**
98
+ * Stop tracking a RUM Resource.
99
+ * @param key: The resource unique key identifier.
100
+ * @param statusCode: The resource status code.
101
+ * @param kind: The resource's kind (xhr, document, image, css, font, …).
102
+ * @param size: The resource size in bytes. If size is unknown, use -1.
103
+ * @param context: The additional context to send.
104
+ * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.
105
+ */
106
+ stopResource(
107
+ key: string,
108
+ statusCode: number,
109
+ kind: string,
110
+ size: number,
111
+ context: Object,
112
+ timestampMs: number
113
+ ): Promise<void>;
114
+
115
+ /**
116
+ * Add a RUM Error.
117
+ * @param message: The error message.
118
+ * @param source: The error source (network, source, console, webview, custom).
119
+ * @param stacktrace: The error stacktrace.
120
+ * @param context: The additional context to send.
121
+ * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.
122
+ */
123
+ addError(
124
+ message: string,
125
+ source: string,
126
+ stacktrace: string,
127
+ context: Object,
128
+ timestampMs: number
129
+ ): Promise<void>;
130
+
131
+ /**
132
+ * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.
133
+ * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.
134
+ */
135
+ addTiming(name: string): Promise<void>;
136
+
137
+ /**
138
+ * Stops the current RUM Session.
139
+ */
140
+ stopSession(): Promise<void>;
141
+
142
+ /**
143
+ * Adds the result of evaluating a feature flag with a given name and value to the view.
144
+ * Feature flag evaluations are local to the active view and are cleared when the view is stopped.
145
+ * @param name: The name of the feature flag
146
+ * @param value: The value of the feature flag, encapsulated in an Object to accept all types
147
+ */
148
+ addFeatureFlagEvaluation(name: string, value: Object): Promise<void>;
149
+ }
150
+
151
+ export default TurboModuleRegistry.get<Spec>('DdRum');
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
+ * Copyright 2016-Present Datadog, Inc.
5
+ */
6
+
7
+ /* eslint-disable @typescript-eslint/ban-types */
8
+ import type { TurboModule } from 'react-native';
9
+ import { TurboModuleRegistry } from 'react-native';
10
+
11
+ /**
12
+ * Do not import this Spec directly, use DdNativeSdkType instead.
13
+ */
14
+ export interface Spec extends TurboModule {
15
+ readonly getConstants: () => {};
16
+
17
+ /**
18
+ * Initializes Datadog's features.
19
+ * @param configuration: The configuration to use.
20
+ */
21
+ initialize(configuration: Object): Promise<void>;
22
+
23
+ /**
24
+ * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.
25
+ * @param attributes: The global context attributes.
26
+ */
27
+ setAttributes(attributes: Object): Promise<void>;
28
+
29
+ /**
30
+ * Set the user information.
31
+ * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).
32
+ */
33
+ setUser(user: Object): Promise<Object>;
34
+
35
+ /**
36
+ * Set the tracking consent regarding the data collection.
37
+ * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.
38
+ */
39
+ setTrackingConsent(trackingConsent: string): Promise<void>;
40
+
41
+ /**
42
+ * Sends internal telemetry debug message
43
+ * @param message debug message
44
+ */
45
+ telemetryDebug(message: string): Promise<void>;
46
+
47
+ /**
48
+ * Sends internal telemetry error
49
+ * @param message error message
50
+ * @param stack error stack
51
+ * @param kind error kind
52
+ */
53
+ telemetryError(message: string, stack: string, kind: string): Promise<void>;
54
+
55
+ /**
56
+ * Send webview telemetry logs
57
+ * @param message event description
58
+ */
59
+ consumeWebviewEvent(message: string): Promise<void>;
60
+ }
61
+
62
+ export default TurboModuleRegistry.get<Spec>('DdSdk');
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
+ * Copyright 2016-Present Datadog, Inc.
5
+ */
6
+
7
+ /* eslint-disable @typescript-eslint/ban-types */
8
+ import type { TurboModule } from 'react-native';
9
+ import { TurboModuleRegistry } from 'react-native';
10
+
11
+ /**
12
+ * Do not import this Spec directly, use DdNativeTraceType instead.
13
+ */
14
+ export interface Spec extends TurboModule {
15
+ readonly getConstants: () => {};
16
+
17
+ /**
18
+ * Start a span, and returns a unique identifier for the span.
19
+ * @param operation: The operation name of the span.
20
+ * @param context: The additional context to send.
21
+ * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.
22
+ */
23
+ startSpan(
24
+ operation: string,
25
+ context: Object,
26
+ timestampMs: number
27
+ ): Promise<string>;
28
+
29
+ /**
30
+ * Finish a started span.
31
+ * @param spanId: The unique identifier of the span.
32
+ * @param context: The additional context to send.
33
+ * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.
34
+ */
35
+ finishSpan(
36
+ spanId: string,
37
+ context: Object,
38
+ timestampMs: number
39
+ ): Promise<void>;
40
+ }
41
+
42
+ export default TurboModuleRegistry.get<Spec>('DdTrace');
@@ -4,8 +4,6 @@
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
6
 
7
- import { NativeModules } from 'react-native';
8
-
9
7
  import { InternalLog } from '../InternalLog';
10
8
  import { SdkVerbosity } from '../SdkVerbosity';
11
9
  import { TimeProvider } from '../TimeProvider';
@@ -19,13 +17,15 @@ import type { DdTraceType } from '../types';
19
17
  const timeProvider = new TimeProvider();
20
18
 
21
19
  class DdTraceWrapper implements DdTraceType {
22
- private nativeTrace: DdNativeTraceType = NativeModules.DdTrace;
20
+ // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
21
+ private nativeTrace: DdNativeTraceType = require('../specs/NativeDdTrace')
22
+ .default;
23
23
 
24
- startSpan(
24
+ startSpan = (
25
25
  operation: string,
26
26
  context: object = {},
27
27
  timestampMs: number = timeProvider.now()
28
- ): Promise<string> {
28
+ ): Promise<string> => {
29
29
  const spanId = bufferNativeCallReturningId(() =>
30
30
  this.nativeTrace.startSpan(operation, context, timestampMs)
31
31
  );
@@ -34,19 +34,19 @@ class DdTraceWrapper implements DdTraceType {
34
34
  SdkVerbosity.DEBUG
35
35
  );
36
36
  return spanId;
37
- }
37
+ };
38
38
 
39
- finishSpan(
39
+ finishSpan = (
40
40
  spanId: string,
41
41
  context: object = {},
42
42
  timestampMs: number = timeProvider.now()
43
- ): Promise<void> {
43
+ ): Promise<void> => {
44
44
  InternalLog.log(`Finishing span #${spanId}`, SdkVerbosity.DEBUG);
45
45
  return bufferNativeCallWithId(
46
46
  id => this.nativeTrace.finishSpan(id, context, timestampMs),
47
47
  spanId
48
48
  );
49
- }
49
+ };
50
50
  }
51
51
 
52
52
  const DdTrace: DdTraceType = new DdTraceWrapper();
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '1.7.1';
2
+ export const version = '1.8.0-rc0';
@@ -1,62 +0,0 @@
1
- /*
2
- * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
- * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
- * Copyright 2016-Present Datadog, Inc.
5
- */
6
-
7
- #import <React/RCTBridgeModule.h>
8
-
9
- @interface RCT_EXTERN_MODULE(DdLogs, NSObject)
10
-
11
- RCT_EXTERN_METHOD(debug:(NSString)message
12
- withContext:(NSDictionary)context
13
- withResolver:(RCTPromiseResolveBlock)resolve
14
- withRejecter:(RCTPromiseRejectBlock)reject)
15
-
16
- RCT_EXTERN_METHOD(info:(NSString)message
17
- withContext:(NSDictionary)context
18
- withResolver:(RCTPromiseResolveBlock)resolve
19
- withRejecter:(RCTPromiseRejectBlock)reject)
20
-
21
- RCT_EXTERN_METHOD(warn:(NSString)message
22
- withContext:(NSDictionary)context
23
- withResolver:(RCTPromiseResolveBlock)resolve
24
- withRejecter:(RCTPromiseRejectBlock)reject)
25
-
26
- RCT_EXTERN_METHOD(error:(NSString)message
27
- withContext:(NSDictionary)context
28
- withResolver:(RCTPromiseResolveBlock)resolve
29
- withRejecter:(RCTPromiseRejectBlock)reject)
30
-
31
- RCT_EXTERN_METHOD(debugWithError:(NSString)message
32
- withErrorKind:(NSString)errorKind
33
- withErrorMessage:(NSString)errorMessage
34
- withStacktrace:(NSString)stacktrace
35
- withContext:(NSDictionary)context
36
- withResolver:(RCTPromiseResolveBlock)resolve
37
- withRejecter:(RCTPromiseRejectBlock)reject)
38
-
39
- RCT_EXTERN_METHOD(infoWithError:(NSString)message
40
- withErrorKind:(NSString)errorKind
41
- withErrorMessage:(NSString)errorMessage
42
- withStacktrace:(NSString)stacktrace
43
- withContext:(NSDictionary)context
44
- withResolver:(RCTPromiseResolveBlock)resolve
45
- withRejecter:(RCTPromiseRejectBlock)reject)
46
-
47
- RCT_EXTERN_METHOD(warnWithError:(NSString)message
48
- withErrorKind:(NSString)errorKind
49
- withErrorMessage:(NSString)errorMessage
50
- withStacktrace:(NSString)stacktrace
51
- withContext:(NSDictionary)context
52
- withResolver:(RCTPromiseResolveBlock)resolve
53
- withRejecter:(RCTPromiseRejectBlock)reject)
54
-
55
- RCT_EXTERN_METHOD(errorWithError:(NSString)message
56
- withErrorKind:(NSString)errorKind
57
- withErrorMessage:(NSString)errorMessage
58
- withStacktrace:(NSString)stacktrace
59
- withContext:(NSDictionary)context
60
- withResolver:(RCTPromiseResolveBlock)resolve
61
- withRejecter:(RCTPromiseRejectBlock)reject)
62
- @end
@@ -1,82 +0,0 @@
1
- /*
2
- * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
- * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
- * Copyright 2016-Present Datadog, Inc.
5
- */
6
-
7
- #import <React/RCTBridgeModule.h>
8
-
9
- @interface RCT_EXTERN_MODULE(DdRum, NSObject)
10
-
11
- RCT_EXTERN_METHOD(startView:(NSString)key
12
- withName:(NSString)name
13
- withContext:(NSDictionary)context
14
- withTimestampms:(NSInteger)timestampMs
15
- withResolver:(RCTPromiseResolveBlock)resolve
16
- withRejecter:(RCTPromiseRejectBlock)reject)
17
-
18
- RCT_EXTERN_METHOD(stopView:(NSString)key
19
- withContext:(NSDictionary)context
20
- withTimestampms:(NSInteger)timestampMs
21
- withResolver:(RCTPromiseResolveBlock)resolve
22
- withRejecter:(RCTPromiseRejectBlock)reject)
23
-
24
- RCT_EXTERN_METHOD(startAction:(NSString)type
25
- withName:(NSString)name
26
- withContext:(NSDictionary)context
27
- withTimestampms:(NSInteger)timestampMs
28
- withResolver:(RCTPromiseResolveBlock)resolve
29
- withRejecter:(RCTPromiseRejectBlock)reject)
30
-
31
- RCT_EXTERN_METHOD(stopAction:(NSString)type
32
- withName:(NSString)name
33
- withContext:(NSDictionary)context
34
- withTimestampms:(NSInteger)timestampMs
35
- withResolver:(RCTPromiseResolveBlock)resolve
36
- withRejecter:(RCTPromiseRejectBlock)reject)
37
-
38
- RCT_EXTERN_METHOD(addAction:(NSString)type
39
- withName:(NSString)name
40
- withContext:(NSDictionary)context
41
- withTimestampms:(NSInteger)timestampMs
42
- withResolver:(RCTPromiseResolveBlock)resolve
43
- withRejecter:(RCTPromiseRejectBlock)reject)
44
-
45
- RCT_EXTERN_METHOD(startResource:(NSString)key
46
- withMethod:(NSString)method
47
- withUrl:(NSString)url
48
- withContext:(NSDictionary)context
49
- withTimestampms:(NSInteger)timestampMs
50
- withResolver:(RCTPromiseResolveBlock)resolve
51
- withRejecter:(RCTPromiseRejectBlock)reject)
52
-
53
- RCT_EXTERN_METHOD(stopResource:(NSString)key
54
- withStatuscode:(NSInteger)statusCode
55
- withKind:(NSString)kind
56
- withSize:(NSInteger)size
57
- withContext:(NSDictionary)context
58
- withTimestampms:(NSInteger)timestampMs
59
- withResolver:(RCTPromiseResolveBlock)resolve
60
- withRejecter:(RCTPromiseRejectBlock)reject)
61
-
62
- RCT_EXTERN_METHOD(addError:(NSString)message
63
- withSource:(NSString)source
64
- withStacktrace:(NSString)stacktrace
65
- withContext:(NSDictionary)context
66
- withTimestampms:(NSInteger)timestampMs
67
- withResolver:(RCTPromiseResolveBlock)resolve
68
- withRejecter:(RCTPromiseRejectBlock)reject)
69
-
70
- RCT_EXTERN_METHOD(addTiming:(NSString)name
71
- withResolver:(RCTPromiseResolveBlock)resolve
72
- withRejecter:(RCTPromiseRejectBlock)reject)
73
-
74
- RCT_EXTERN_METHOD(stopSession:(RCTPromiseResolveBlock)resolve
75
- withRejecter:(RCTPromiseRejectBlock)reject)
76
-
77
- RCT_EXTERN_METHOD(addFeatureFlagEvaluation:(NSString)name
78
- withValue:(NSDictionary)value
79
- withResolver:(RCTPromiseResolveBlock)resolve
80
- withRejecter:(RCTPromiseRejectBlock)reject)
81
-
82
- @end
@@ -1,41 +0,0 @@
1
- /*
2
- * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
- * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
- * Copyright 2016-Present Datadog, Inc.
5
- */
6
-
7
- #import <React/RCTBridgeModule.h>
8
-
9
- @interface RCT_EXTERN_MODULE(DdSdk, NSObject)
10
-
11
- RCT_EXTERN_METHOD(initialize:(NSDictionary)configuration
12
- withResolver:(RCTPromiseResolveBlock)resolve
13
- withRejecter:(RCTPromiseRejectBlock)reject)
14
-
15
- RCT_EXTERN_METHOD(setAttributes:(NSDictionary)attributes
16
- withResolver:(RCTPromiseResolveBlock)resolve
17
- withRejecter:(RCTPromiseRejectBlock)reject)
18
-
19
- RCT_EXTERN_METHOD(setUser:(NSDictionary)user
20
- withResolver:(RCTPromiseResolveBlock)resolve
21
- withRejecter:(RCTPromiseRejectBlock)reject)
22
-
23
- RCT_EXTERN_METHOD(setTrackingConsent:(NSString)trackingConsent
24
- withResolver:(RCTPromiseResolveBlock)resolve
25
- withRejecter:(RCTPromiseRejectBlock)reject)
26
-
27
- RCT_EXTERN_METHOD(telemetryDebug:(NSString)message
28
- withResolver:(RCTPromiseResolveBlock)resolve
29
- withRejecter:(RCTPromiseRejectBlock)reject)
30
-
31
- RCT_EXTERN_METHOD(telemetryError:(NSString)message
32
- withStack:(NSString)stack
33
- withKind:(NSString)kind
34
- withResolver:(RCTPromiseResolveBlock)resolve
35
- withRejecter:(RCTPromiseRejectBlock)reject)
36
-
37
- RCT_EXTERN_METHOD(consumeWebviewEvent:(NSString)message
38
- withResolver:(RCTPromiseResolveBlock)resolve
39
- withRejecter:(RCTPromiseRejectBlock)reject)
40
-
41
- @end
@@ -1,23 +0,0 @@
1
- /*
2
- * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
- * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
- * Copyright 2016-Present Datadog, Inc.
5
- */
6
-
7
- #import <React/RCTBridgeModule.h>
8
-
9
- @interface RCT_EXTERN_MODULE(DdTrace, NSObject)
10
-
11
- RCT_EXTERN_METHOD(startSpan:(NSString)operation
12
- withContext:(NSDictionary)context
13
- withTimestampms:(NSInteger)timestampMs
14
- withResolver:(RCTPromiseResolveBlock)resolve
15
- withRejecter:(RCTPromiseRejectBlock)reject)
16
-
17
- RCT_EXTERN_METHOD(finishSpan:(NSString)spanId
18
- withContext:(NSDictionary)context
19
- withTimestampms:(NSInteger)timestampMs
20
- withResolver:(RCTPromiseResolveBlock)resolve
21
- withRejecter:(RCTPromiseRejectBlock)reject)
22
-
23
- @end