@cloudcare/browser-core 3.2.26 → 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.
Files changed (52) hide show
  1. package/cjs/browser/asyncClocks.js +0 -4
  2. package/cjs/browser/asyncClocks.js.map +1 -1
  3. package/cjs/configuration/configuration.js +1 -1
  4. package/cjs/configuration/configuration.js.map +1 -1
  5. package/cjs/configuration/remoteConfiguration.js +0 -85
  6. package/cjs/configuration/remoteConfiguration.js.map +1 -1
  7. package/cjs/configuration/transportConfiguration.js +0 -2
  8. package/cjs/configuration/transportConfiguration.js.map +1 -1
  9. package/cjs/dataMap.js +0 -2
  10. package/cjs/dataMap.js.map +1 -1
  11. package/cjs/helper/deviceInfo.js +2 -41
  12. package/cjs/helper/deviceInfo.js.map +1 -1
  13. package/cjs/helper/mobileUtil.js +2 -2
  14. package/cjs/helper/mobileUtil.js.map +1 -1
  15. package/cjs/helper/serialisation/rowData.js +0 -1
  16. package/cjs/helper/serialisation/rowData.js.map +1 -1
  17. package/cjs/helper/tools.js +6 -21
  18. package/cjs/helper/tools.js.map +1 -1
  19. package/cjs/transport/batch.js +6 -10
  20. package/cjs/transport/batch.js.map +1 -1
  21. package/esm/browser/asyncClocks.js +0 -4
  22. package/esm/browser/asyncClocks.js.map +1 -1
  23. package/esm/configuration/configuration.js +1 -1
  24. package/esm/configuration/configuration.js.map +1 -1
  25. package/esm/configuration/remoteConfiguration.js +0 -85
  26. package/esm/configuration/remoteConfiguration.js.map +1 -1
  27. package/esm/configuration/transportConfiguration.js +0 -2
  28. package/esm/configuration/transportConfiguration.js.map +1 -1
  29. package/esm/dataMap.js +0 -2
  30. package/esm/dataMap.js.map +1 -1
  31. package/esm/helper/deviceInfo.js +2 -41
  32. package/esm/helper/deviceInfo.js.map +1 -1
  33. package/esm/helper/mobileUtil.js +2 -2
  34. package/esm/helper/mobileUtil.js.map +1 -1
  35. package/esm/helper/serialisation/rowData.js +0 -1
  36. package/esm/helper/serialisation/rowData.js.map +1 -1
  37. package/esm/helper/tools.js +6 -21
  38. package/esm/helper/tools.js.map +1 -1
  39. package/esm/transport/batch.js +6 -10
  40. package/esm/transport/batch.js.map +1 -1
  41. package/package.json +23 -24
  42. package/src/browser/asyncClocks.js +0 -3
  43. package/src/configuration/configuration.js +1 -1
  44. package/src/configuration/remoteConfiguration.js +0 -84
  45. package/src/configuration/transportConfiguration.js +0 -2
  46. package/src/dataMap.js +1 -2
  47. package/src/helper/deviceInfo.js +9 -37
  48. package/src/helper/mobileUtil.js +2 -2
  49. package/src/helper/serialisation/rowData.js +0 -1
  50. package/src/helper/tools.js +6 -23
  51. package/src/transport/batch.js +6 -10
  52. package/types/index.d.ts +57 -57
@@ -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] // 已经在datamap中定义过的fields和tags
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
- * openway 方式上报数据令牌,从观测云控制台获取,必填
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
- * 公共openway 方式上报数据地址,从观测云控制台获取,必填
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 数据上报 Origin 注释:
39
- * 协议(包括://),域名(或IP地址)[和端口号]
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
- * 数据上报采样率,100 表示全收集;0 表示不收集。默认 100
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
- /** Web 应用当前环境,如 prod:线上环境;gray:灰度环境;pre:预发布环境;common:日常环境;local:本地环境。 */
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
- /** Web 应用的版本号。 */
64
+ /** Version number of the web application. */
65
65
  version?: string | undefined
66
- /** 链路数据采样百分比:100 表示全收集;0 表示不收集。 */
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
- * 是否使用跨域 cookie,开启第三方 cookie 跨分区实现。默认不允许跨域,例如嵌套跨域 iframe 的情况。
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
- * 是否把公共数据存储到localstorage,默认不存储
79
+ * Whether to store public data in localStorage, default is not to store
80
80
  */
81
81
  storeContextsToLocal?: boolean | undefined
82
82
  /**
83
- * 定义存储到 localstorage key ,默认不填,自动生成, 该参数主要是为了区分在同一个域名下,不同子路径共用store 的问题
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
- * 数据以 application/json 的发送方式,默认text
87
+ * Send data as application/json, default is text
88
88
  */
89
89
  sendContentTypeByJson?: boolean | undefined
90
90
  /**
91
- * cookie 不可用的情况下,可以开启该选项,把数据储存到 localstorage
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
- /**从观测云创建的应用 ID */
141
+ /** Application ID created from TrueWatch Cloud */
142
142
  applicationId: string
143
143
  /**
144
- * 排除一些影响 loadingtime 的指标准确性的url,具体可参考下面文档
145
- * https://docs.guance.com/security/page-performance/#_3
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
- * 允许注入 trace 采集器所需 header 头部的所有请求列表。可以是请求的 origin,也可以是正则,origin: 协议(包括://),域名(或IP地址)[和端口号]。例如:
150
- ["https://api.example.com", /https:\\/\\/.*\\.my-api-domain\\.com/]
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
- * - 当会话未被 `sessionSampleRate` 采样时,若会话期间发生错误,则按此比例采集
157
- * 此类会话将在错误发生时开始记录事件,并持续记录直到会话结束。
158
- * - 取值范围 0-100100 表示全采错误会话,0 表示忽略错误会话
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
- * - 取值范围 0-100100 表示全量采集,0 表示不采集
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
- * - 当会话未被 `sessionReplaySampleRate` 采样时,若会话期间发生错误,则按此比例采集
171
- * 此类回放将记录错误发生前最多一分钟的事件,并持续记录直到会话结束。
172
- 100 表示全收集;0 表示不收集。
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
- * 指定 action 数据 name 获取方式,默认自动获取,可以指定元素特定属性名称,alt,name,title,aria-labelledby,aria-label,data-guance-action-name 这些属性
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 compressIntakeRequests数据压缩都是在 webwork 线程中完成,所以默认情况下,需要在开启csp 安全访问的情况下,允许 worker-src blob:; workerUrl 配置允许自行托管 worker 地址
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
- * 压缩 RUM 数据请求内容,以减少发送大量数据时的带宽使用量。压缩在 Worker 线程中完成。
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
- * 配置链路追踪工具类型,如果不配置默认为 ddtrace。目前支持 ddtracezipkinskywalking_v3jaegerzipkin_single_headerw3c_traceparent 6 种数据类型。
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
- * 是否以 128 字节的方式生成 traceID,与 traceType 对应,目前支持类型 zipkinjaeger
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 拦截之后,往请求 header 添加额外 header-key,受 allowedTracingUrls 影响
210
- * @param context 请求附带额外信息,包括traceid spanid url 等内容
211
- * @returns 返回 key: value 对象, 请求添加的额外 key
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 生成器,覆盖 SDK 内部traceId 实现,默认不配置。
216
- * @returns 返回对应 traceType 类型的traceId。
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
- * 是否开启 longAnimationFrame 采集,覆盖 longtask 采集,目前调试阶段
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 是否屏蔽某个节点数据,可用于实现对某些特定 node 屏蔽效果
225
- * @param node 节点对象
226
- * @param privacyLevel 当前隐私等级
227
- * @returns true 表示屏蔽该节点,false 表示不屏蔽节点 继续执行 privacyLevel 逻辑
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
  }