@datadog/mobile-react-native-apollo-client 2.0.0-rc.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.
Files changed (87) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +93 -0
  3. package/lib/commonjs/DatadogLink.js +44 -0
  4. package/lib/commonjs/DatadogLink.js.map +1 -0
  5. package/lib/commonjs/helpers.js +58 -0
  6. package/lib/commonjs/helpers.js.map +1 -0
  7. package/lib/commonjs/index.js +14 -0
  8. package/lib/commonjs/index.js.map +1 -0
  9. package/lib/module/DatadogLink.js +32 -0
  10. package/lib/module/DatadogLink.js.map +1 -0
  11. package/lib/module/helpers.js +44 -0
  12. package/lib/module/helpers.js.map +1 -0
  13. package/lib/module/index.js +7 -0
  14. package/lib/module/index.js.map +1 -0
  15. package/lib/typescript/core/src/DdSdkReactNative.d.ts +66 -0
  16. package/lib/typescript/core/src/DdSdkReactNativeConfiguration.d.ts +269 -0
  17. package/lib/typescript/core/src/InternalLog.d.ts +12 -0
  18. package/lib/typescript/core/src/ProxyConfiguration.d.ts +56 -0
  19. package/lib/typescript/core/src/SdkVerbosity.d.ts +9 -0
  20. package/lib/typescript/core/src/TrackingConsent.d.ts +8 -0
  21. package/lib/typescript/core/src/index.d.ts +13 -0
  22. package/lib/typescript/core/src/logs/DdLogs.d.ts +22 -0
  23. package/lib/typescript/core/src/logs/eventMapper.d.ts +11 -0
  24. package/lib/typescript/core/src/logs/types.d.ts +80 -0
  25. package/lib/typescript/core/src/nativeModulesTypes.d.ts +92 -0
  26. package/lib/typescript/core/src/rum/DdRum.d.ts +38 -0
  27. package/lib/typescript/core/src/rum/eventMappers/actionEventMapper.d.ts +21 -0
  28. package/lib/typescript/core/src/rum/eventMappers/errorEventMapper.d.ts +21 -0
  29. package/lib/typescript/core/src/rum/eventMappers/resourceEventMapper.d.ts +24 -0
  30. package/lib/typescript/core/src/rum/instrumentation/DdRumErrorTracking.d.ts +16 -0
  31. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts +15 -0
  32. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +21 -0
  33. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/EventsInterceptor.d.ts +3 -0
  34. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.d.ts +4 -0
  35. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.d.ts +7 -0
  36. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/getJsxRuntime.d.ts +1 -0
  37. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +16 -0
  38. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +45 -0
  39. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +21 -0
  40. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts +8 -0
  41. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.d.ts +4 -0
  42. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.d.ts +8 -0
  43. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.d.ts +6 -0
  44. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.d.ts +17 -0
  45. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.d.ts +6 -0
  46. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts +20 -0
  47. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.d.ts +2 -0
  48. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts +13 -0
  49. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +27 -0
  50. package/lib/typescript/core/src/rum/types.d.ts +131 -0
  51. package/lib/typescript/core/src/sdk/AttributesSingleton/AttributesSingleton.d.ts +12 -0
  52. package/lib/typescript/core/src/sdk/AttributesSingleton/types.d.ts +3 -0
  53. package/lib/typescript/core/src/sdk/DatadogProvider/Buffer/BoundedBuffer.d.ts +15 -0
  54. package/lib/typescript/core/src/sdk/DatadogProvider/Buffer/BufferSingleton.d.ts +7 -0
  55. package/lib/typescript/core/src/sdk/DatadogProvider/Buffer/DatadogBuffer.d.ts +20 -0
  56. package/lib/typescript/core/src/sdk/DatadogProvider/Buffer/PassThroughBuffer.d.ts +7 -0
  57. package/lib/typescript/core/src/sdk/DatadogProvider/Buffer/bufferNativeCall.d.ts +3 -0
  58. package/lib/typescript/core/src/sdk/DatadogProvider/DatadogProvider.d.ts +26 -0
  59. package/lib/typescript/core/src/sdk/DdSdk.d.ts +3 -0
  60. package/lib/typescript/core/src/sdk/EventMappers/EventMapper.d.ts +24 -0
  61. package/lib/typescript/core/src/sdk/EventMappers/utils/deepClone.d.ts +10 -0
  62. package/lib/typescript/core/src/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +12 -0
  63. package/lib/typescript/core/src/sdk/UserInfoSingleton/types.d.ts +6 -0
  64. package/lib/typescript/core/src/specs/NativeDdLogs.d.ts +69 -0
  65. package/lib/typescript/core/src/specs/NativeDdRum.d.ts +92 -0
  66. package/lib/typescript/core/src/specs/NativeDdSdk.d.ts +46 -0
  67. package/lib/typescript/core/src/specs/NativeDdTrace.d.ts +23 -0
  68. package/lib/typescript/core/src/trace/DdTrace.d.ts +3 -0
  69. package/lib/typescript/core/src/types.d.ts +81 -0
  70. package/lib/typescript/core/src/utils/TimeProvider.d.ts +20 -0
  71. package/lib/typescript/core/src/utils/Timer.d.ts +21 -0
  72. package/lib/typescript/core/src/utils/errorUtils.d.ts +14 -0
  73. package/lib/typescript/core/src/utils/jsUtils.d.ts +1 -0
  74. package/lib/typescript/core/src/utils/longTasksUtils.d.ts +6 -0
  75. package/lib/typescript/core/src/version.d.ts +1 -0
  76. package/lib/typescript/react-native-apollo-client/src/DatadogLink.d.ts +4 -0
  77. package/lib/typescript/react-native-apollo-client/src/helpers.d.ts +7 -0
  78. package/lib/typescript/react-native-apollo-client/src/index.d.ts +1 -0
  79. package/package.json +82 -0
  80. package/src/DatadogLink.ts +46 -0
  81. package/src/__tests__/__utils__/createCat.json +125 -0
  82. package/src/__tests__/__utils__/getCountries.json +103 -0
  83. package/src/__tests__/__utils__/getCountry.json +96 -0
  84. package/src/__tests__/__utils__/operationMock.ts +32 -0
  85. package/src/__tests__/helpers.test.ts +65 -0
  86. package/src/helpers.ts +54 -0
  87. package/src/index.ts +7 -0
@@ -0,0 +1,269 @@
1
+ import type { ProxyConfiguration } from './ProxyConfiguration';
2
+ import type { SdkVerbosity } from './SdkVerbosity';
3
+ import { TrackingConsent } from './TrackingConsent';
4
+ import type { LogEventMapper } from './logs/types';
5
+ import type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';
6
+ import type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';
7
+ import type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';
8
+ import type { FirstPartyHost } from './rum/types';
9
+ export declare enum VitalsUpdateFrequency {
10
+ FREQUENT = "FREQUENT",
11
+ AVERAGE = "AVERAGE",
12
+ RARE = "RARE",
13
+ NEVER = "NEVER"
14
+ }
15
+ export declare enum UploadFrequency {
16
+ /**
17
+ * Upload data every 1000ms.
18
+ */
19
+ FREQUENT = "FREQUENT",
20
+ /**
21
+ * Upload data every 5000ms.
22
+ */
23
+ AVERAGE = "AVERAGE",
24
+ /**
25
+ * Upload data every 10000ms.
26
+ */
27
+ RARE = "RARE"
28
+ }
29
+ export declare enum BatchSize {
30
+ /**
31
+ * Upload less frequent, larger batches of data
32
+ */
33
+ LARGE = "LARGE",
34
+ /**
35
+ * Use default size for batches of data
36
+ */
37
+ MEDIUM = "MEDIUM",
38
+ /**
39
+ * Upload more frequent, smaller batches of data
40
+ */
41
+ SMALL = "SMALL"
42
+ }
43
+ export declare type FirstPartyHostsConfiguration = (FirstPartyHost | LegacyFirstPartyHost)[];
44
+ export declare type LegacyFirstPartyHost = string;
45
+ /**
46
+ * Defaults legacy first party hosts format to Datadog first party hosts to keep
47
+ * retro-compatibility before OTel support was introduced.
48
+ */
49
+ export declare const formatFirstPartyHosts: (firstPartyHosts: FirstPartyHostsConfiguration) => FirstPartyHost[];
50
+ /**
51
+ * The SDK configuration class.
52
+ * It will be used to configure the SDK functionality at initialization.
53
+ */
54
+ export declare class DdSdkReactNativeConfiguration {
55
+ readonly clientToken: string;
56
+ readonly env: string;
57
+ readonly applicationId: string;
58
+ readonly trackInteractions: boolean;
59
+ readonly trackResources: boolean;
60
+ readonly trackErrors: boolean;
61
+ readonly trackingConsent: TrackingConsent;
62
+ /**
63
+ * Enables crash reporting for native plaforms (iOS, Android). Default `false`.
64
+ */
65
+ nativeCrashReportEnabled: boolean;
66
+ /**
67
+ * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.
68
+ */
69
+ sampleRate?: number;
70
+ /**
71
+ * Percentage of sampled RUM sessions. Range `0`-`100`.
72
+ */
73
+ sessionSamplingRate: number;
74
+ /**
75
+ * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.
76
+ */
77
+ resourceTracingSamplingRate: number;
78
+ site: string;
79
+ /**
80
+ * Verbosity for internal SDK logging.
81
+ * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.
82
+ */
83
+ verbosity: SdkVerbosity | undefined;
84
+ /**
85
+ * Enables native views tracking.
86
+ * Set to `true` if you use a custom navigation system relying on native views.
87
+ */
88
+ nativeViewTracking: boolean;
89
+ /**
90
+ * Enables native interaction tracking.
91
+ * Set to `true` if you want to track interactions on native screens.
92
+ */
93
+ nativeInteractionTracking: boolean;
94
+ proxyConfig?: ProxyConfiguration;
95
+ serviceName?: string;
96
+ /**
97
+ * List of your backends hosts to enable tracing with.
98
+ * Regular expressions are NOT supported.
99
+ *
100
+ * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.
101
+ */
102
+ firstPartyHosts: FirstPartyHostsConfiguration;
103
+ /**
104
+ * Overrides the reported version of the app.
105
+ * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.
106
+ * Other special characters are converted to underscores.
107
+ *
108
+ * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.
109
+ *
110
+ * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.
111
+ */
112
+ version?: string;
113
+ /**
114
+ * Add a suffix to the reported version of the app.
115
+ * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.
116
+ * Other special characters are converted to underscores.
117
+ *
118
+ * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.
119
+ *
120
+ * A dash (`-`) will be automatically added between the version and the suffix
121
+ */
122
+ versionSuffix?: string;
123
+ /**
124
+ * The sampling rate for Internal Telemetry (info related to the work of the
125
+ * SDK internals).
126
+ *
127
+ * The sampling rate must be a value between 0 and 100. A value of 0 means no
128
+ * telemetry will be sent, 100 means all telemetry will be sent. When
129
+ * `telemetrySampleRate` is not set, the default value from the iOS and
130
+ * Android SDK is used, which is 20.
131
+ */
132
+ telemetrySampleRate: number;
133
+ /**
134
+ * The threshold for native long tasks reporting in milliseconds.
135
+ *
136
+ * - Setting it to `0` or `false` disables native long task reporting.
137
+ * - Values below `100` will be raised to `100`.
138
+ * - Values above `5000` will be lowered to `5000`.
139
+ *
140
+ * Default value is `200`.
141
+ */
142
+ nativeLongTaskThresholdMs: number | false;
143
+ /**
144
+ * The threshold for javascript long tasks reporting in milliseconds.
145
+ *
146
+ * - Setting it to `0` or `false` disables javascript long task reporting.
147
+ * - Values below `100` will be raised to `100`.
148
+ * - Values above `5000` will be lowered to `5000`.
149
+ *
150
+ * Default value is `0`
151
+ */
152
+ longTaskThresholdMs: number | false;
153
+ /**
154
+ * Sets the preferred frequency for collecting mobile vitals.
155
+ */
156
+ vitalsUpdateFrequency: VitalsUpdateFrequency;
157
+ /**
158
+ * Enables tracking of frustration signals (error taps). Defaults to `true`.
159
+ */
160
+ trackFrustrations: boolean;
161
+ /**
162
+ * Sets the preferred frequency for uploading batches of data.
163
+ */
164
+ uploadFrequency: UploadFrequency;
165
+ /**
166
+ * Defines the Datadog SDK policy when batching data together before uploading it to Datadog servers.
167
+ * Smaller batches mean smaller but more network requests, whereas larger batches mean fewer but larger network requests.
168
+ */
169
+ batchSize: BatchSize;
170
+ /**
171
+ * Enables tracking of RUM event when no RUM View is active.
172
+ *
173
+ * By default, background events are not tracked. Enabling this feature might increase the
174
+ * number of sessions tracked and impact your billing.
175
+ */
176
+ trackBackgroundEvents: boolean;
177
+ /**
178
+ * Specifies a custom prop to name RUM actions on elements having an `onPress` prop.
179
+ *
180
+ * For example if you set it to `testID`, the value of the `testID` prop is used as a custom action name:
181
+ *
182
+ * ```js
183
+ * <TouchableOpacity testID="Dismiss notification" onPress={() => dismiss()}>
184
+ * ```
185
+ *
186
+ * `dd-action-name` is favored when both attributes are present on an element.
187
+ */
188
+ actionNameAttribute?: string;
189
+ logEventMapper: LogEventMapper | null;
190
+ errorEventMapper: ErrorEventMapper | null;
191
+ resourceEventMapper: ResourceEventMapper | null;
192
+ actionEventMapper: ActionEventMapper | null;
193
+ additionalConfig: {
194
+ [k: string]: any;
195
+ };
196
+ constructor(clientToken: string, env: string, applicationId: string, trackInteractions?: boolean, trackResources?: boolean, trackErrors?: boolean, trackingConsent?: TrackingConsent);
197
+ }
198
+ /**
199
+ * Auto Instrumentation configuration passed to DatadogProvider.
200
+ * Does not include default values.
201
+ */
202
+ export declare type AutoInstrumentationConfiguration = {
203
+ readonly trackInteractions: boolean;
204
+ readonly trackResources: boolean;
205
+ readonly firstPartyHosts?: FirstPartyHostsConfiguration;
206
+ readonly resourceTracingSamplingRate?: number;
207
+ readonly trackErrors: boolean;
208
+ readonly logEventMapper?: LogEventMapper | null;
209
+ readonly errorEventMapper?: ErrorEventMapper | null;
210
+ readonly resourceEventMapper?: ResourceEventMapper | null;
211
+ readonly actionEventMapper?: ActionEventMapper | null;
212
+ readonly actionNameAttribute?: string;
213
+ };
214
+ /**
215
+ * Parameters needed to start auto instrumentation. Includes default values.
216
+ */
217
+ export declare type AutoInstrumentationParameters = {
218
+ readonly trackInteractions: boolean;
219
+ readonly trackResources: boolean;
220
+ readonly firstPartyHosts: FirstPartyHostsConfiguration;
221
+ readonly resourceTracingSamplingRate: number;
222
+ readonly trackErrors: boolean;
223
+ readonly logEventMapper: LogEventMapper | null;
224
+ readonly errorEventMapper: ErrorEventMapper | null;
225
+ readonly resourceEventMapper: ResourceEventMapper | null;
226
+ readonly actionEventMapper: ActionEventMapper | null;
227
+ readonly actionNameAttribute?: string;
228
+ };
229
+ /**
230
+ * We could use `Proxy` instead of this function, but `Proxy` is not available on
231
+ * the older android jsc that can still be used.
232
+ */
233
+ export declare const addDefaultValuesToAutoInstrumentationConfiguration: (features: AutoInstrumentationConfiguration) => AutoInstrumentationParameters;
234
+ export declare type PartialInitializationConfiguration = {
235
+ readonly clientToken: string;
236
+ readonly env: string;
237
+ readonly applicationId: string;
238
+ readonly sessionSamplingRate?: number;
239
+ readonly site?: string;
240
+ readonly verbosity?: SdkVerbosity | undefined;
241
+ readonly nativeViewTracking?: boolean;
242
+ readonly nativeInteractionTracking?: boolean;
243
+ readonly proxyConfig?: ProxyConfiguration;
244
+ readonly serviceName?: string;
245
+ readonly version?: string;
246
+ versionSuffix?: string;
247
+ readonly additionalConfig?: {
248
+ [k: string]: any;
249
+ };
250
+ readonly trackingConsent?: TrackingConsent;
251
+ readonly longTaskThresholdMs?: number | false;
252
+ readonly nativeLongTaskThresholdMs?: number | false;
253
+ readonly nativeCrashReportEnabled?: boolean;
254
+ readonly telemetrySampleRate?: number;
255
+ readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;
256
+ readonly trackFrustrations?: boolean;
257
+ readonly uploadFrequency?: UploadFrequency;
258
+ readonly batchSize?: BatchSize;
259
+ readonly trackBackgroundEvents?: boolean;
260
+ };
261
+ export declare const buildConfigurationFromPartialConfiguration: (features: AutoInstrumentationConfiguration, configuration: PartialInitializationConfiguration) => DdSdkReactNativeConfiguration;
262
+ export declare class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {
263
+ initializationMode: InitializationMode;
264
+ }
265
+ export declare enum InitializationMode {
266
+ SYNC = "SYNC",
267
+ ASYNC = "ASYNC"
268
+ }
269
+ export declare type InitializationModeForTelemetry = 'LEGACY' | 'SYNC' | 'ASYNC' | 'PARTIAL';
@@ -0,0 +1,12 @@
1
+ import { SdkVerbosity } from './SdkVerbosity';
2
+ export declare const DATADOG_MESSAGE_PREFIX = "DATADOG:";
3
+ /**
4
+ * /!\ DO NOT USE THIS IN YOUR APP /!\\
5
+ *
6
+ * This logger is only for debugging the Datadog SDK.
7
+ */
8
+ export declare class InternalLog {
9
+ private static levelMap;
10
+ static verbosity: SdkVerbosity | undefined;
11
+ static log(message: string, verbosity: SdkVerbosity): void;
12
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Proxy server configuration.
3
+ */
4
+ declare class ProxyConfiguration {
5
+ /**
6
+ * Proxy type.
7
+ */
8
+ readonly type: ProxyType;
9
+ /**
10
+ * Proxy address. Can be either in the IP address format, ex. "1.1.1.1", or hostname, ex. "example.com".
11
+ */
12
+ readonly address: string;
13
+ /**
14
+ * Proxy port.
15
+ */
16
+ readonly port: number;
17
+ /**
18
+ * Username for Basic authentication scheme.
19
+ *
20
+ * Note: "SOCKS + authentication" scheme is not supported.
21
+ */
22
+ readonly username?: string | undefined;
23
+ /**
24
+ * Password for Basic authentication scheme.
25
+ */
26
+ readonly password?: string | undefined;
27
+ constructor(
28
+ /**
29
+ * Proxy type.
30
+ */
31
+ type: ProxyType,
32
+ /**
33
+ * Proxy address. Can be either in the IP address format, ex. "1.1.1.1", or hostname, ex. "example.com".
34
+ */
35
+ address: string,
36
+ /**
37
+ * Proxy port.
38
+ */
39
+ port: number,
40
+ /**
41
+ * Username for Basic authentication scheme.
42
+ *
43
+ * Note: "SOCKS + authentication" scheme is not supported.
44
+ */
45
+ username?: string | undefined,
46
+ /**
47
+ * Password for Basic authentication scheme.
48
+ */
49
+ password?: string | undefined);
50
+ }
51
+ declare enum ProxyType {
52
+ HTTP = "http",
53
+ HTTPS = "https",
54
+ SOCKS = "socks"
55
+ }
56
+ export { ProxyConfiguration, ProxyType };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Enum specifying possible log levels for DD SDK.
3
+ */
4
+ export declare enum SdkVerbosity {
5
+ DEBUG = "debug",
6
+ INFO = "info",
7
+ WARN = "warn",
8
+ ERROR = "error"
9
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Enum specifying possible consent options for DD SDK.
3
+ */
4
+ export declare enum TrackingConsent {
5
+ PENDING = "pending",
6
+ GRANTED = "granted",
7
+ NOT_GRANTED = "not_granted"
8
+ }
@@ -0,0 +1,13 @@
1
+ import { DatadogProviderConfiguration, DdSdkReactNativeConfiguration, InitializationMode, VitalsUpdateFrequency, UploadFrequency, BatchSize } from './DdSdkReactNativeConfiguration';
2
+ import { DdSdkReactNative } from './DdSdkReactNative';
3
+ import { InternalLog } from './InternalLog';
4
+ import { ProxyConfiguration, ProxyType } from './ProxyConfiguration';
5
+ import { SdkVerbosity } from './SdkVerbosity';
6
+ import { TrackingConsent } from './TrackingConsent';
7
+ import { DdLogs } from './logs/DdLogs';
8
+ import { DdRum } from './rum/DdRum';
9
+ import { DATADOG_GRAPH_QL_OPERATION_TYPE_HEADER, DATADOG_GRAPH_QL_OPERATION_NAME_HEADER, DATADOG_GRAPH_QL_VARIABLES_HEADER } from './rum/instrumentation/resourceTracking/graphql/graphqlHeaders';
10
+ import { RumActionType, ErrorSource, PropagatorType } from './rum/types';
11
+ import { DatadogProvider } from './sdk/DatadogProvider/DatadogProvider';
12
+ import { DdTrace } from './trace/DdTrace';
13
+ export { DatadogProvider, DatadogProviderConfiguration, InitializationMode, DdLogs, DdTrace, DdRum, RumActionType, ErrorSource, DdSdkReactNativeConfiguration, DdSdkReactNative, InternalLog, ProxyConfiguration, ProxyType, TrackingConsent, SdkVerbosity, VitalsUpdateFrequency, PropagatorType, UploadFrequency, BatchSize, DATADOG_GRAPH_QL_OPERATION_TYPE_HEADER, DATADOG_GRAPH_QL_OPERATION_NAME_HEADER, DATADOG_GRAPH_QL_VARIABLES_HEADER };
@@ -0,0 +1,22 @@
1
+ import type { DdLogsType, LogArguments, LogEventMapper, LogWithErrorArguments } from './types';
2
+ declare class DdLogsWrapper implements DdLogsType {
3
+ private nativeLogs;
4
+ private logEventMapper;
5
+ debug: (...args: LogArguments | LogWithErrorArguments) => Promise<void>;
6
+ info: (...args: LogArguments | LogWithErrorArguments) => Promise<void>;
7
+ warn: (...args: LogArguments | LogWithErrorArguments) => Promise<void>;
8
+ error: (...args: LogArguments | LogWithErrorArguments) => Promise<void>;
9
+ /**
10
+ * Since the InternalLog does not have a verbosity set yet in this case,
11
+ * we use console.warn to warn the user in dev mode.
12
+ */
13
+ private printLogDroppedSdkNotInitialized;
14
+ private printlogDroppedByMapper;
15
+ private printLogTracked;
16
+ private log;
17
+ private logWithError;
18
+ registerLogEventMapper(logEventMapper: LogEventMapper): void;
19
+ unregisterLogEventMapper(): void;
20
+ }
21
+ export declare const DdLogs: DdLogsWrapper;
22
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { Attributes } from '../sdk/AttributesSingleton/types';
2
+ import { EventMapper } from '../sdk/EventMappers/EventMapper';
3
+ import type { UserInfo } from '../sdk/UserInfoSingleton/types';
4
+ import type { LogEvent, LogEventMapper, NativeLog, NativeLogWithError, RawLog, RawLogWithError } from './types';
5
+ export declare const formatLogEventToNativeLog: (logEvent: LogEvent) => NativeLog | NativeLogWithError;
6
+ export declare const formatRawLogToNativeEvent: (rawLog: RawLog | RawLogWithError) => NativeLog | NativeLogWithError;
7
+ export declare const formatRawLogToLogEvent: (rawLog: RawLog | RawLogWithError, additionalInformation: {
8
+ userInfo: UserInfo;
9
+ attributes: Attributes;
10
+ }) => LogEvent;
11
+ export declare const generateEventMapper: (logEventMapper: LogEventMapper | undefined) => EventMapper<RawLog | RawLogWithError, LogEvent, NativeLog | NativeLogWithError>;
@@ -0,0 +1,80 @@
1
+ import type { UserInfo } from '../sdk/UserInfoSingleton/types';
2
+ /**
3
+ * The entry point to use Datadog's Logs feature.
4
+ */
5
+ export declare type DdLogsType = {
6
+ /**
7
+ * Send a log with debug level.
8
+ * @param message: The message to send.
9
+ * @param context: The additional context to send.
10
+ */
11
+ debug(...args: LogArguments | LogWithErrorArguments): Promise<void>;
12
+ /**
13
+ * Send a log with info level.
14
+ * @param message: The message to send.
15
+ * @param context: The additional context to send.
16
+ */
17
+ info(...args: LogArguments | LogWithErrorArguments): Promise<void>;
18
+ /**
19
+ * Send a log with warn level.
20
+ * @param message: The message to send.
21
+ * @param context: The additional context to send.
22
+ */
23
+ warn(...args: LogArguments | LogWithErrorArguments): Promise<void>;
24
+ /**
25
+ * Send a log with error level.
26
+ * @param message: The message to send.
27
+ * @param context: The additional context to send.
28
+ */
29
+ error(...args: LogArguments | LogWithErrorArguments): Promise<void>;
30
+ };
31
+ /**
32
+ * Log input from developers
33
+ */
34
+ export declare type RawLog = {
35
+ message: string;
36
+ context: object;
37
+ status: LogStatus;
38
+ };
39
+ export declare type RawLogWithError = {
40
+ message: string;
41
+ errorKind: string;
42
+ errorMessage: string;
43
+ stacktrace: string;
44
+ context: object;
45
+ status: LogStatus;
46
+ };
47
+ /**
48
+ * Log input for native SDKs
49
+ */
50
+ export declare type NativeLog = {
51
+ message: string;
52
+ context: object;
53
+ };
54
+ export declare type NativeLogWithError = {
55
+ message: string;
56
+ errorKind: string;
57
+ errorMessage: string;
58
+ stacktrace: string;
59
+ context: object;
60
+ };
61
+ export declare type LogStatus = 'debug' | 'info' | 'warn' | 'error';
62
+ export declare type LogEvent = {
63
+ message: string;
64
+ context: object;
65
+ errorKind?: string;
66
+ errorMessage?: string;
67
+ stacktrace?: string;
68
+ readonly status: LogStatus;
69
+ readonly userInfo: UserInfo;
70
+ readonly attributes?: object;
71
+ };
72
+ export declare type LogEventMapper = (logEvent: LogEvent) => LogEvent | null;
73
+ export declare type LogArguments = [message: string, context?: object];
74
+ export declare type LogWithErrorArguments = [
75
+ message: string,
76
+ errorKind?: string,
77
+ errorMessage?: string,
78
+ stacktrace?: string,
79
+ context?: object
80
+ ];
@@ -0,0 +1,92 @@
1
+ import type { Spec as NativeDdLogs } from './specs/NativeDdLogs';
2
+ import type { Spec as NativeDdRum } from './specs/NativeDdRum';
3
+ import type { Spec as NativeDdSdk } from './specs/NativeDdSdk';
4
+ import type { Spec as NativeDdTrace } from './specs/NativeDdTrace';
5
+ /**
6
+ * In this file, native modules types extend the specs for TurboModules.
7
+ * As we cannot use enums or classes in the specs, we override methods using them here.
8
+ */
9
+ /**
10
+ * The entry point to use Datadog's Logs feature.
11
+ */
12
+ export declare type DdNativeLogsType = NativeDdLogs;
13
+ /**
14
+ * The entry point to use Datadog's Trace feature.
15
+ */
16
+ export declare type DdNativeTraceType = NativeDdTrace;
17
+ /**
18
+ * A configuration object to initialize Datadog's features.
19
+ */
20
+ export declare class DdNativeSdkConfiguration {
21
+ readonly clientToken: string;
22
+ readonly env: string;
23
+ readonly applicationId: string;
24
+ readonly nativeCrashReportEnabled: boolean;
25
+ readonly sampleRate: number;
26
+ readonly site: string;
27
+ readonly trackingConsent: string;
28
+ readonly additionalConfig: object;
29
+ constructor(clientToken: string, env: string, applicationId: string, nativeCrashReportEnabled: boolean, sampleRate: number, site: string, trackingConsent: string, additionalConfig: object);
30
+ }
31
+ /**
32
+ * The entry point to initialize Datadog's features.
33
+ */
34
+ export interface DdNativeSdkType extends NativeDdSdk {
35
+ /**
36
+ * Initializes Datadog's features.
37
+ * @param configuration: The configuration to use.
38
+ */
39
+ initialize(configuration: DdNativeSdkConfiguration): Promise<void>;
40
+ }
41
+ declare type ActionType = 'TAP' | 'SCROLL' | 'SWIPE' | 'BACK' | 'CUSTOM';
42
+ declare type ResourceKind = 'image' | 'xhr' | 'beacon' | 'css' | 'document' | 'fetch' | 'font' | 'js' | 'media' | 'other' | 'native';
43
+ declare type ErrorSource = 'NETWORK' | 'SOURCE' | 'CONSOLE' | 'WEBVIEW' | 'CUSTOM';
44
+ /**
45
+ * The entry point to use Datadog's RUM feature.
46
+ */
47
+ export interface DdNativeRumType extends NativeDdRum {
48
+ /**
49
+ * Start tracking a RUM Action.
50
+ * @param type: The action type (tap, scroll, swipe, back, custom).
51
+ * @param name: The action name.
52
+ * @param context: The additional context to send.
53
+ * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.
54
+ */
55
+ startAction(type: ActionType, name: string, context: object, timestampMs: number): Promise<void>;
56
+ /**
57
+ * Stop tracking the ongoing RUM Action.
58
+ * @param type: The action type (tap, scroll, swipe, back, custom).
59
+ * @param name: The action name.
60
+ * @param context: The additional context to send.
61
+ * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.
62
+ */
63
+ stopAction(type: ActionType, name: string, context: object, timestampMs: number): Promise<void>;
64
+ /**
65
+ * Add a RUM Action.
66
+ * @param type: The action type (tap, scroll, swipe, back, custom).
67
+ * @param name: The action name.
68
+ * @param context: The additional context to send.
69
+ * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.
70
+ */
71
+ addAction(type: ActionType, name: string, context: object, timestampMs: number): Promise<void>;
72
+ /**
73
+ * Stop tracking a RUM Resource.
74
+ * @param key: The resource unique key identifier.
75
+ * @param statusCode: The resource status code.
76
+ * @param kind: The resource's kind (xhr, document, image, css, font, …).
77
+ * @param size: The resource size in bytes. If size is unknown, use -1.
78
+ * @param context: The additional context to send.
79
+ * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.
80
+ */
81
+ stopResource(key: string, statusCode: number, kind: ResourceKind, size: number, context: object, timestampMs: number): Promise<void>;
82
+ /**
83
+ * Add a RUM Error.
84
+ * @param message: The error message.
85
+ * @param source: The error source (network, source, console, webview, custom).
86
+ * @param stacktrace: The error stacktrace.
87
+ * @param context: The additional context to send.
88
+ * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.
89
+ */
90
+ addError(message: string, source: ErrorSource, stacktrace: string, context: object, timestampMs: number): Promise<void>;
91
+ }
92
+ export {};
@@ -0,0 +1,38 @@
1
+ import type { GestureResponderEvent } from 'react-native';
2
+ import type { ActionEventMapper } from './eventMappers/actionEventMapper';
3
+ import type { ErrorEventMapper } from './eventMappers/errorEventMapper';
4
+ import type { ResourceEventMapper } from './eventMappers/resourceEventMapper';
5
+ import type { DdRumType, RumActionType, ResourceKind, ErrorSource } from './types';
6
+ declare class DdRumWrapper implements DdRumType {
7
+ private nativeRum;
8
+ private lastActionData?;
9
+ private errorEventMapper;
10
+ private resourceEventMapper;
11
+ private actionEventMapper;
12
+ startView: (key: string, name: string, context?: object, timestampMs?: number) => Promise<void>;
13
+ stopView: (key: string, context?: object, timestampMs?: number) => Promise<void>;
14
+ startAction: (type: RumActionType, name: string, context?: object, timestampMs?: number) => Promise<void>;
15
+ stopAction: (...args: [
16
+ type: RumActionType,
17
+ name: string,
18
+ context?: object,
19
+ timestampMs?: number
20
+ ] | [context?: object, timestampMs?: number]) => Promise<void>;
21
+ private callNativeStopAction;
22
+ private getStopActionNativeCallArgs;
23
+ addAction: (type: RumActionType, name: string, context?: object, timestampMs?: number, actionContext?: GestureResponderEvent) => Promise<void>;
24
+ startResource: (key: string, method: string, url: string, context?: object, timestampMs?: number) => Promise<void>;
25
+ stopResource: (key: string, statusCode: number, kind: ResourceKind, size?: number, context?: object, timestampMs?: number, resourceContext?: XMLHttpRequest) => Promise<void>;
26
+ addError: (message: string, source: ErrorSource, stacktrace: string, context?: object, timestampMs?: number) => Promise<void>;
27
+ addTiming: (name: string) => Promise<void>;
28
+ stopSession: () => Promise<void>;
29
+ addFeatureFlagEvaluation: (name: string, value: unknown) => Promise<void>;
30
+ registerErrorEventMapper(errorEventMapper: ErrorEventMapper): void;
31
+ unregisterErrorEventMapper(): void;
32
+ registerResourceEventMapper(resourceEventMapper: ResourceEventMapper): void;
33
+ unregisterResourceEventMapper(): void;
34
+ registerActionEventMapper(actionEventMapper: ActionEventMapper): void;
35
+ unregisterActionEventMapper(): void;
36
+ }
37
+ export declare const DdRum: DdRumWrapper;
38
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { GestureResponderEvent } from 'react-native';
2
+ import type { AdditionalEventDataForMapper } from '../../sdk/EventMappers/EventMapper';
3
+ import { EventMapper } from '../../sdk/EventMappers/EventMapper';
4
+ import type { RumActionType } from '../types';
5
+ declare type RawAction = {
6
+ readonly type: RumActionType;
7
+ readonly name: string;
8
+ context: object;
9
+ readonly timestampMs: number;
10
+ actionContext?: GestureResponderEvent;
11
+ };
12
+ declare type ActionEvent = RawAction & AdditionalEventDataForMapper;
13
+ declare type NativeAction = {
14
+ type: RumActionType;
15
+ name: string;
16
+ context: object;
17
+ timestampMs: number;
18
+ };
19
+ export declare type ActionEventMapper = (event: ActionEvent) => ActionEvent | null;
20
+ export declare const generateActionEventMapper: (eventMapper: ActionEventMapper | undefined) => EventMapper<RawAction, ActionEvent, NativeAction>;
21
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { AdditionalEventDataForMapper } from '../../sdk/EventMappers/EventMapper';
2
+ import { EventMapper } from '../../sdk/EventMappers/EventMapper';
3
+ import type { ErrorSource } from '../types';
4
+ declare type RawError = {
5
+ message: string;
6
+ source: ErrorSource;
7
+ stacktrace: string;
8
+ context: object;
9
+ timestampMs: number;
10
+ };
11
+ declare type ErrorEvent = RawError & AdditionalEventDataForMapper;
12
+ declare type NativeError = {
13
+ message: string;
14
+ source: ErrorSource;
15
+ stacktrace: string;
16
+ context: object;
17
+ timestampMs: number;
18
+ };
19
+ export declare type ErrorEventMapper = (event: ErrorEvent) => ErrorEvent | null;
20
+ export declare const generateErrorEventMapper: (eventMapper: ErrorEventMapper | undefined) => EventMapper<RawError, ErrorEvent, NativeError>;
21
+ export {};