@cloudcare/browser-core 3.2.25 → 3.2.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/browser/asyncClocks.js +0 -4
- package/cjs/browser/asyncClocks.js.map +1 -1
- package/cjs/configuration/configuration.js +1 -1
- package/cjs/configuration/configuration.js.map +1 -1
- package/cjs/configuration/remoteConfiguration.js +0 -85
- package/cjs/configuration/remoteConfiguration.js.map +1 -1
- package/cjs/configuration/transportConfiguration.js +0 -2
- package/cjs/configuration/transportConfiguration.js.map +1 -1
- package/cjs/dataMap.js +0 -2
- package/cjs/dataMap.js.map +1 -1
- package/cjs/helper/deviceInfo.js +2 -41
- package/cjs/helper/deviceInfo.js.map +1 -1
- package/cjs/helper/errorTools.js +2 -1
- package/cjs/helper/errorTools.js.map +1 -1
- package/cjs/helper/mobileUtil.js +2 -2
- package/cjs/helper/mobileUtil.js.map +1 -1
- package/cjs/helper/serialisation/rowData.js +0 -1
- package/cjs/helper/serialisation/rowData.js.map +1 -1
- package/cjs/helper/tools.js +6 -21
- package/cjs/helper/tools.js.map +1 -1
- package/cjs/transport/batch.js +6 -10
- package/cjs/transport/batch.js.map +1 -1
- package/esm/browser/asyncClocks.js +0 -4
- package/esm/browser/asyncClocks.js.map +1 -1
- package/esm/configuration/configuration.js +1 -1
- package/esm/configuration/configuration.js.map +1 -1
- package/esm/configuration/remoteConfiguration.js +0 -85
- package/esm/configuration/remoteConfiguration.js.map +1 -1
- package/esm/configuration/transportConfiguration.js +0 -2
- package/esm/configuration/transportConfiguration.js.map +1 -1
- package/esm/dataMap.js +0 -2
- package/esm/dataMap.js.map +1 -1
- package/esm/helper/deviceInfo.js +2 -41
- package/esm/helper/deviceInfo.js.map +1 -1
- package/esm/helper/errorTools.js +2 -1
- package/esm/helper/errorTools.js.map +1 -1
- package/esm/helper/mobileUtil.js +2 -2
- package/esm/helper/mobileUtil.js.map +1 -1
- package/esm/helper/serialisation/rowData.js +0 -1
- package/esm/helper/serialisation/rowData.js.map +1 -1
- package/esm/helper/tools.js +6 -21
- package/esm/helper/tools.js.map +1 -1
- package/esm/transport/batch.js +6 -10
- package/esm/transport/batch.js.map +1 -1
- package/package.json +23 -24
- package/src/browser/asyncClocks.js +0 -3
- package/src/configuration/configuration.js +1 -1
- package/src/configuration/remoteConfiguration.js +0 -84
- package/src/configuration/transportConfiguration.js +0 -2
- package/src/dataMap.js +1 -2
- package/src/helper/deviceInfo.js +9 -37
- package/src/helper/errorTools.js +2 -1
- package/src/helper/mobileUtil.js +2 -2
- package/src/helper/serialisation/rowData.js +0 -1
- package/src/helper/tools.js +6 -23
- package/src/transport/batch.js +6 -10
- package/types/index.d.ts +57 -57
package/src/transport/batch.js
CHANGED
|
@@ -39,7 +39,7 @@ export var processedMessageByDataMap = function (message) {
|
|
|
39
39
|
rowData.measurement = key
|
|
40
40
|
var tagsStr = []
|
|
41
41
|
var tags = extend({}, commonTags, value.tags)
|
|
42
|
-
var filterFileds = ['date', 'type', CUSTOM_KEYS]
|
|
42
|
+
var filterFileds = ['date', 'type', CUSTOM_KEYS]
|
|
43
43
|
each(tags, function (value_path, _key) {
|
|
44
44
|
var _value = findByPath(message, value_path)
|
|
45
45
|
filterFileds.push(_key)
|
|
@@ -57,7 +57,7 @@ export var processedMessageByDataMap = function (message) {
|
|
|
57
57
|
var _valueData = findByPath(message, value_path)
|
|
58
58
|
filterFileds.push(_key)
|
|
59
59
|
if (_valueData !== undefined && _valueData !== null) {
|
|
60
|
-
rowData.fields[_key] = escapeJsonValue(_valueData)
|
|
60
|
+
rowData.fields[_key] = escapeJsonValue(_valueData)
|
|
61
61
|
fieldsStr.push(
|
|
62
62
|
escapeRowData(_key) + '=' + escapeRowField(_valueData)
|
|
63
63
|
)
|
|
@@ -66,7 +66,7 @@ export var processedMessageByDataMap = function (message) {
|
|
|
66
66
|
var _valueData = findByPath(message, _value)
|
|
67
67
|
filterFileds.push(_key)
|
|
68
68
|
if (_valueData !== undefined && _valueData !== null) {
|
|
69
|
-
rowData.fields[_key] = escapeJsonValue(_valueData)
|
|
69
|
+
rowData.fields[_key] = escapeJsonValue(_valueData)
|
|
70
70
|
fieldsStr.push(
|
|
71
71
|
escapeRowData(_key) + '=' + escapeRowField(_valueData)
|
|
72
72
|
)
|
|
@@ -78,15 +78,13 @@ export var processedMessageByDataMap = function (message) {
|
|
|
78
78
|
isObject(message.context) &&
|
|
79
79
|
!isEmptyObject(message.context)
|
|
80
80
|
) {
|
|
81
|
-
// 自定义tag, 存储成field
|
|
82
81
|
var _tagKeys = []
|
|
83
82
|
each(message.context, function (_value, _key) {
|
|
84
|
-
// 如果和之前tag重名,则舍弃
|
|
85
83
|
if (filterFileds.indexOf(_key) > -1) return
|
|
86
84
|
filterFileds.push(_key)
|
|
87
85
|
if (_value !== undefined && _value !== null) {
|
|
88
86
|
_tagKeys.push(_key)
|
|
89
|
-
rowData.fields[_key] = escapeJsonValue(_value)
|
|
87
|
+
rowData.fields[_key] = escapeJsonValue(_value)
|
|
90
88
|
fieldsStr.push(escapeRowData(_key) + '=' + escapeRowField(_value))
|
|
91
89
|
}
|
|
92
90
|
})
|
|
@@ -98,14 +96,13 @@ export var processedMessageByDataMap = function (message) {
|
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
98
|
if (message.type === RumEventType.LOGGER) {
|
|
101
|
-
// 这里处理日志类型数据自定义字段
|
|
102
99
|
each(message, function (value, key) {
|
|
103
100
|
if (
|
|
104
101
|
filterFileds.indexOf(key) === -1 &&
|
|
105
102
|
value !== undefined &&
|
|
106
103
|
value !== null
|
|
107
104
|
) {
|
|
108
|
-
rowData.fields[key] = escapeJsonValue(value)
|
|
105
|
+
rowData.fields[key] = escapeJsonValue(value)
|
|
109
106
|
fieldsStr.push(escapeRowData(key) + '=' + escapeRowField(value))
|
|
110
107
|
}
|
|
111
108
|
})
|
|
@@ -119,7 +116,7 @@ export var processedMessageByDataMap = function (message) {
|
|
|
119
116
|
hasFileds = true
|
|
120
117
|
}
|
|
121
118
|
rowStr = rowStr + ' ' + message.date
|
|
122
|
-
rowData.time = message.date
|
|
119
|
+
rowData.time = message.date
|
|
123
120
|
}
|
|
124
121
|
})
|
|
125
122
|
return {
|
|
@@ -231,7 +228,6 @@ export function createBatch(options) {
|
|
|
231
228
|
// it and always send a single request.
|
|
232
229
|
encoder.isAsync
|
|
233
230
|
) {
|
|
234
|
-
// 咱不支持json 模式
|
|
235
231
|
var encoderResult = encoder.finishSync()
|
|
236
232
|
|
|
237
233
|
// Send encoded messages
|
package/types/index.d.ts
CHANGED
|
@@ -25,70 +25,70 @@ export type RawReportType = (typeof RawReportType)[keyof typeof RawReportType]
|
|
|
25
25
|
|
|
26
26
|
export interface SiteInitConfiguration {
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Data reporting token in openway mode, obtained from the TrueWatch Cloud console. Required.
|
|
29
29
|
*/
|
|
30
30
|
clientToken: string | undefined
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Data reporting address in public openway mode, obtained from the TrueWatch Cloud console. Required.
|
|
34
34
|
*/
|
|
35
35
|
site: string | undefined
|
|
36
36
|
}
|
|
37
37
|
export interface DatakitInitConfiguration {
|
|
38
|
-
/** DataKit
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* https://www.datakit.com
|
|
42
|
-
* http://100.20.34.3:8088
|
|
38
|
+
/** DataKit data reporting Origin:
|
|
39
|
+
* Protocol (including ://), domain name (or IP address) [and port number]
|
|
40
|
+
* For example:
|
|
41
|
+
* https://www.datakit.com;
|
|
42
|
+
* http://100.20.34.3:8088.
|
|
43
43
|
*/
|
|
44
44
|
datakitOrigin: string
|
|
45
45
|
}
|
|
46
46
|
export interface InitConfiguration {
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
49
|
-
* @param event
|
|
50
|
-
* @param context
|
|
48
|
+
* Interceptor before sending data
|
|
49
|
+
* @param event Event content
|
|
50
|
+
* @param context Additional event properties
|
|
51
51
|
* @returns
|
|
52
52
|
*/
|
|
53
53
|
beforeSend?: (event: any, context?: any) => unknown | undefined
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* Data reporting sample rate, 100 means collect all; 0 means do not collect. Default is 100
|
|
56
56
|
*/
|
|
57
57
|
sessionSampleRate?: number | undefined
|
|
58
58
|
telemetrySampleRate?: number | undefined
|
|
59
59
|
silentMultipleInit?: boolean | undefined
|
|
60
60
|
|
|
61
61
|
service?: string | undefined
|
|
62
|
-
/**
|
|
62
|
+
/** Current environment of the web application, such as prod: production; gray: gray environment; pre: pre-release; common: daily; local: local environment. */
|
|
63
63
|
env?: string | undefined
|
|
64
|
-
/**
|
|
64
|
+
/** Version number of the web application. */
|
|
65
65
|
version?: string | undefined
|
|
66
|
-
/**
|
|
66
|
+
/** Trace data sampling percentage: 100 means collect all; 0 means do not collect. */
|
|
67
67
|
tracingSampleRate?: number | undefined
|
|
68
68
|
/**
|
|
69
69
|
* @deprecated use usePartitionedCrossSiteSessionCookie instead
|
|
70
70
|
*/
|
|
71
71
|
useCrossSiteSessionCookie?: boolean | undefined
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
73
|
+
* Whether to use cross-site cookies, enabling third-party cookie partitioning. By default, cross-site is not allowed, such as nested cross-domain iframes.
|
|
74
74
|
*/
|
|
75
75
|
usePartitionedCrossSiteSessionCookie?: boolean | undefined
|
|
76
76
|
useSecureSessionCookie?: boolean | undefined
|
|
77
77
|
trackSessionAcrossSubdomains?: boolean | undefined
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
79
|
+
* Whether to store public data in localStorage, default is not to store
|
|
80
80
|
*/
|
|
81
81
|
storeContextsToLocal?: boolean | undefined
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* Define the key for storing in localStorage. If not filled, it is automatically generated. This parameter is mainly to distinguish the problem of sharing store under different subpaths of the same domain.
|
|
84
84
|
*/
|
|
85
85
|
storeContextsKey?: string | undefined
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
87
|
+
* Send data as application/json, default is text
|
|
88
88
|
*/
|
|
89
89
|
sendContentTypeByJson?: boolean | undefined
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
91
|
+
* When cookies are not available, you can enable this option to store data in localStorage
|
|
92
92
|
*/
|
|
93
93
|
allowFallbackToLocalStorage?: boolean | undefined
|
|
94
94
|
}
|
|
@@ -138,93 +138,93 @@ export declare function matchList(
|
|
|
138
138
|
): boolean
|
|
139
139
|
|
|
140
140
|
export interface RumBaseInitConfiguration extends InitConfiguration {
|
|
141
|
-
|
|
141
|
+
/** Application ID created from TrueWatch Cloud */
|
|
142
142
|
applicationId: string
|
|
143
143
|
/**
|
|
144
|
-
*
|
|
145
|
-
* https://docs.
|
|
144
|
+
* Exclude some URLs that affect the accuracy of loadingtime indicators. See the following documentation for details:
|
|
145
|
+
* https://docs.truewatch.com/security/page-performance/#_3
|
|
146
146
|
*/
|
|
147
147
|
excludedActivityUrls?: MatchOption[] | undefined
|
|
148
148
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
* List of all requests allowed to inject trace collector required headers. Can be the request origin or a regex. Origin: protocol (including ://), domain name (or IP address) [and port number]. For example:
|
|
150
|
+
["https://api.example.com", /https:\\/\\/.*\\.my-api-domain\\.com/].
|
|
151
|
+
*/
|
|
152
152
|
allowedTracingUrls?: Array<MatchOption | TracingOption> | undefined
|
|
153
153
|
defaultPrivacyLevel?: DefaultPrivacyLevel | undefined
|
|
154
154
|
/**
|
|
155
|
-
*
|
|
156
|
-
* -
|
|
157
|
-
*
|
|
158
|
-
* -
|
|
155
|
+
* Error session compensation sample rate:
|
|
156
|
+
* - When the session is not sampled by `sessionSampleRate`, if an error occurs during the session, it will be collected according to this ratio.
|
|
157
|
+
* Such sessions will start recording events when an error occurs and continue until the session ends.
|
|
158
|
+
* - Value range 0-100, 100 means collect all error sessions, 0 means ignore error sessions
|
|
159
159
|
*/
|
|
160
160
|
sessionOnErrorSampleRate?: number | undefined
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
|
-
* Session Replay
|
|
164
|
-
* -
|
|
165
|
-
* -
|
|
163
|
+
* Session Replay full collection sample rate:
|
|
164
|
+
* - Used to control the proportion of full data collection for all session replays
|
|
165
|
+
* - Value range 0-100, 100 means full collection, 0 means no collection
|
|
166
166
|
**/
|
|
167
167
|
sessionReplaySampleRate?: number | undefined
|
|
168
168
|
|
|
169
|
-
/**
|
|
170
|
-
* -
|
|
171
|
-
*
|
|
172
|
-
100
|
|
173
|
-
|
|
169
|
+
/** Error session replay compensation sample rate:
|
|
170
|
+
* - When the session is not sampled by `sessionReplaySampleRate`, if an error occurs during the session, it will be collected according to this ratio.
|
|
171
|
+
* Such replays will record up to one minute of events before the error occurs and continue recording until the session ends.
|
|
172
|
+
* 100 means collect all; 0 means do not collect.
|
|
173
|
+
*/
|
|
174
174
|
sessionReplayOnErrorSampleRate?: number | undefined
|
|
175
175
|
/**
|
|
176
|
-
*
|
|
176
|
+
* Whether to enable user interaction collection.
|
|
177
177
|
*/
|
|
178
178
|
trackUserInteractions?: boolean | undefined
|
|
179
179
|
/**
|
|
180
|
-
*
|
|
180
|
+
* Specify how to get the action data name. By default, it is obtained automatically. You can specify the element's specific attribute name, such as alt, name, title, aria-labelledby, aria-label, data-truewatch-action-name, etc.
|
|
181
181
|
*/
|
|
182
182
|
actionNameAttribute?: string | undefined
|
|
183
183
|
trackViewsManually?: boolean | undefined
|
|
184
184
|
/**
|
|
185
|
-
* sessionReplay
|
|
185
|
+
* sessionReplay and compressIntakeRequests data compression are both done in the web worker thread, so by default, you need to allow worker-src blob: under CSP security access, or use workerUrl to host the worker address yourself
|
|
186
186
|
*/
|
|
187
187
|
workerUrl?: string
|
|
188
188
|
/**
|
|
189
|
-
*
|
|
189
|
+
* Compress RUM data request content to reduce bandwidth usage when sending large amounts of data. Compression is done in the Worker thread.
|
|
190
190
|
*/
|
|
191
191
|
compressIntakeRequests?: boolean | undefined
|
|
192
192
|
/**
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
193
|
+
* Whether to enable remote configuration for data collection. Disabled by default.
|
|
194
|
+
* The remote configuration feature allows you to dynamically modify data collection configuration items without releasing a new version.
|
|
195
|
+
* For example: you can modify the sampling rate, whether to enable user interaction collection, etc. in the remote configuration.
|
|
196
|
+
* The remote configuration feature needs to be enabled in the TrueWatch Cloud console.
|
|
197
197
|
*
|
|
198
198
|
*/
|
|
199
199
|
remoteConfiguration?: boolean | undefined
|
|
200
200
|
/**
|
|
201
|
-
*
|
|
201
|
+
* Configure the type of trace tool. If not configured, ddtrace is used by default. Currently supports 6 types: ddtrace, zipkin, skywalking_v3, jaeger, zipkin_single_header, w3c_traceparent.
|
|
202
202
|
*/
|
|
203
203
|
traceType?: TraceType
|
|
204
204
|
/**
|
|
205
|
-
*
|
|
205
|
+
* Whether to generate traceID in 128-bit mode, corresponding to traceType. Currently supported types: zipkin, jaeger.
|
|
206
206
|
*/
|
|
207
207
|
traceId128Bit?: boolean | undefined
|
|
208
208
|
/**
|
|
209
|
-
* Fetch/Xhr
|
|
210
|
-
* @param context
|
|
211
|
-
* @returns
|
|
209
|
+
* After Fetch/Xhr interception, add extra header-keys to the request header, affected by allowedTracingUrls
|
|
210
|
+
* @param context Additional information attached to the request, including traceid, spanid, url, etc.
|
|
211
|
+
* @returns Returns a key: value object, the extra keys to be added to the request
|
|
212
212
|
*/
|
|
213
213
|
injectTraceHeader?: (content: any) => { [key: string]: string } | undefined
|
|
214
214
|
/**
|
|
215
|
-
* traceId
|
|
216
|
-
* @returns
|
|
215
|
+
* traceId generator, overrides the SDK's internal traceId implementation. Default is not configured.
|
|
216
|
+
* @returns Returns the traceId corresponding to the traceType type.
|
|
217
217
|
*/
|
|
218
218
|
generateTraceId?: () => string
|
|
219
219
|
/**
|
|
220
|
-
*
|
|
220
|
+
* Whether to enable longAnimationFrame collection, overriding longtask collection. Currently in debugging stage.
|
|
221
221
|
*/
|
|
222
222
|
enableLongAnimationFrame?: boolean | undefined
|
|
223
223
|
/**
|
|
224
|
-
* session replay
|
|
225
|
-
* @param node
|
|
226
|
-
* @param privacyLevel
|
|
227
|
-
* @returns true
|
|
224
|
+
* Whether to mask a node's data in session replay, can be used to implement masking for specific nodes
|
|
225
|
+
* @param node Node object
|
|
226
|
+
* @param privacyLevel Current privacy level
|
|
227
|
+
* @returns true means mask the node, false means do not mask and continue privacyLevel logic
|
|
228
228
|
*/
|
|
229
229
|
shouldMaskNode?: (node: Node, privacyLevel: NodePrivacyLevel) => boolean
|
|
230
230
|
}
|