@cloudcare/browser-core 3.2.9 → 3.2.11
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/dataMap.js +8 -6
- package/cjs/dataMap.js.map +1 -1
- package/cjs/helper/sanitize.js +12 -5
- package/cjs/helper/sanitize.js.map +1 -1
- package/cjs/helper/taskQueue.js.map +1 -1
- package/cjs/helper/tools.js +1 -1
- package/cjs/helper/tools.js.map +1 -1
- package/cjs/tracekit/computeStackTrace.js +5 -1
- package/cjs/tracekit/computeStackTrace.js.map +1 -1
- package/esm/dataMap.js +8 -6
- package/esm/dataMap.js.map +1 -1
- package/esm/helper/sanitize.js +12 -5
- package/esm/helper/sanitize.js.map +1 -1
- package/esm/helper/taskQueue.js.map +1 -1
- package/esm/helper/tools.js +1 -1
- package/esm/helper/tools.js.map +1 -1
- package/esm/tracekit/computeStackTrace.js +5 -1
- package/esm/tracekit/computeStackTrace.js.map +1 -1
- package/package.json +2 -2
- package/src/dataMap.js +8 -6
- package/src/helper/sanitize.js +14 -5
- package/src/helper/taskQueue.js +1 -1
- package/src/helper/tools.js +1 -1
- package/src/tracekit/computeStackTrace.js +35 -14
package/cjs/dataMap.js
CHANGED
|
@@ -104,12 +104,6 @@ var dataMap = {
|
|
|
104
104
|
trace_id: '_gc.trace_id',
|
|
105
105
|
span_id: '_gc.span_id',
|
|
106
106
|
resource_id: 'resource.id',
|
|
107
|
-
resource_url: 'resource.url',
|
|
108
|
-
resource_url_host: 'resource.url_host',
|
|
109
|
-
resource_url_path: 'resource.url_path',
|
|
110
|
-
resource_url_path_group: 'resource.url_path_group',
|
|
111
|
-
resource_url_query: 'resource.url_query',
|
|
112
|
-
resource_type: 'resource.type',
|
|
113
107
|
resource_status: 'resource.status',
|
|
114
108
|
resource_status_group: 'resource.status_group',
|
|
115
109
|
resource_method: 'resource.method'
|
|
@@ -117,6 +111,14 @@ var dataMap = {
|
|
|
117
111
|
fields: {
|
|
118
112
|
duration: 'resource.duration',
|
|
119
113
|
resource_size: 'resource.size',
|
|
114
|
+
resource_url: 'resource.url',
|
|
115
|
+
resource_url_host: 'resource.url_host',
|
|
116
|
+
resource_url_path: 'resource.url_path',
|
|
117
|
+
resource_url_path_group: 'resource.url_path_group',
|
|
118
|
+
resource_url_query: 'resource.url_query',
|
|
119
|
+
resource_delivery_type: 'resource.delivery_type',
|
|
120
|
+
resource_type: 'resource.type',
|
|
121
|
+
resource_protocol: 'resource.protocol',
|
|
120
122
|
resource_encode_size: 'resource.encoded_body_size',
|
|
121
123
|
resource_decode_size: 'resource.decoded_body_size',
|
|
122
124
|
resource_transfer_size: 'resource.transfer_size',
|
package/cjs/dataMap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataMap.js","names":["_enums","require","commonTags","sdk_name","sdk_version","app_id","env","service","version","source","userid","user_email","user_name","session_id","session_type","session_sampling","is_signin","os","os_version","os_version_major","browser","browser_version","browser_version_major","screen_size","network_type","device","view_id","view_referrer","view_url","view_host","view_path","view_name","view_path_group","exports","commonFields","view_url_query","action_id","action_ids","view_in_foreground","display","session_has_replay","is_login","page_states","session_sample_rate","session_replay_sample_rate","drift","dataMap","view","type","RumEventType","VIEW","tags","view_loading_type","view_apdex_level","view_privacy_replay_level","fields","sampled_for_replay","is_active","session_replay_stats","session_is_active","view_error_count","view_resource_count","view_long_task_count","view_action_count","first_contentful_paint","largest_contentful_paint","largest_contentful_paint_element_selector","cumulative_layout_shift","cumulative_layout_shift_time","cumulative_layout_shift_target_selector","first_input_delay","loading_time","dom_interactive","dom_content_loaded","dom_complete","load_event","first_input_time","first_input_target_selector","first_paint_time","interaction_to_next_paint","interaction_to_next_paint_target_selector","resource_load_time","time_to_interactive","dom","dom_ready","time_spent","first_byte","frustration_count","custom_timings","resource","RESOURCE","trace_id","span_id","resource_id","resource_url","resource_url_host","resource_url_path","resource_url_path_group","resource_url_query","resource_type","resource_status","resource_status_group","resource_method","duration","resource_size","resource_encode_size","resource_decode_size","resource_transfer_size","resource_render_blocking_status","resource_dns","resource_tcp","resource_ssl","resource_ttfb","resource_trans","resource_redirect","resource_first_byte","resource_dns_time","resource_download_time","resource_first_byte_time","resource_connect_time","resource_ssl_time","resource_redirect_time","error","ERROR","error_id","error_source","error_type","error_handling","error_message","error_stack","error_causes","error_handling_stack","long_task","LONG_TASK","long_task_id","blocking_duration","first_ui_event_timestamp","render_start","style_and_layout_start","long_task_start_time","scripts","action","ACTION","action_type","action_name","action_error_count","action_resource_count","action_frustration_types","action_long_task_count","action_target","action_position","telemetry","status","message","error_kind","browser_log","LOGGER","error_resource_url","error_resource_url_host","error_resource_url_path","error_resource_url_path_group","error_resource_status","error_resource_status_group","error_resource_method"],"sources":["../src/dataMap.js"],"sourcesContent":["import { RumEventType } from './helper/enums'\nexport var commonTags = {\n sdk_name: '_gc.sdk_name',\n sdk_version: '_gc.sdk_version',\n app_id: 'application.id',\n env: 'env',\n service: 'service',\n version: 'version',\n source: 'source',\n userid: 'user.id',\n user_email: 'user.email',\n user_name: 'user.name',\n session_id: 'session.id',\n session_type: 'session.type',\n session_sampling: 'session.is_sampling',\n is_signin: 'user.is_signin',\n os: 'device.os',\n os_version: 'device.os_version',\n os_version_major: 'device.os_version_major',\n browser: 'device.browser',\n browser_version: 'device.browser_version',\n browser_version_major: 'device.browser_version_major',\n screen_size: 'device.screen_size',\n network_type: 'device.network_type',\n device: 'device.device',\n view_id: 'view.id',\n view_referrer: 'view.referrer',\n view_url: 'view.url',\n view_host: 'view.host',\n view_path: 'view.path',\n view_name: 'view.path', // 冗余一个字段\n view_path_group: 'view.path_group'\n}\nexport var commonFields = {\n view_url_query: 'view.url_query',\n action_id: 'action.id',\n action_ids: 'action.ids',\n view_in_foreground: 'view.in_foreground',\n display: 'display',\n session_has_replay: 'session.has_replay',\n is_login: 'user.is_login',\n page_states: '_gc.page_states',\n session_sample_rate: '_gc.configuration.session_sample_rate',\n session_replay_sample_rate: '_gc.configuration.session_replay_sample_rate',\n drift: '_gc.drift'\n}\n// 需要用双引号将字符串类型的field value括起来, 这里有数组标示[string, path]\nexport var dataMap = {\n view: {\n type: RumEventType.VIEW,\n tags: {\n view_loading_type: 'view.loading_type',\n view_apdex_level: 'view.apdex_level',\n view_privacy_replay_level: 'privacy.replay_level'\n },\n fields: {\n sampled_for_replay: 'session.sampled_for_replay',\n is_active: 'view.is_active',\n session_replay_stats: '_gc.replay_stats',\n session_is_active: 'session.is_active',\n view_error_count: 'view.error.count',\n view_resource_count: 'view.resource.count',\n view_long_task_count: 'view.long_task.count',\n view_action_count: 'view.action.count',\n first_contentful_paint: 'view.first_contentful_paint',\n largest_contentful_paint: 'view.largest_contentful_paint',\n largest_contentful_paint_element_selector:\n 'view.largest_contentful_paint_element_selector',\n cumulative_layout_shift: 'view.cumulative_layout_shift',\n cumulative_layout_shift_time: 'view.cumulative_layout_shift_time',\n cumulative_layout_shift_target_selector:\n 'view.cumulative_layout_shift_target_selector',\n first_input_delay: 'view.first_input_delay',\n loading_time: 'view.loading_time',\n dom_interactive: 'view.dom_interactive',\n dom_content_loaded: 'view.dom_content_loaded',\n dom_complete: 'view.dom_complete',\n load_event: 'view.load_event',\n first_input_time: 'view.first_input_time',\n first_input_target_selector: 'view.first_input_target_selector',\n first_paint_time: 'view.fpt',\n interaction_to_next_paint: 'view.interaction_to_next_paint',\n interaction_to_next_paint_target_selector:\n 'view.interaction_to_next_paint_target_selector',\n resource_load_time: 'view.resource_load_time',\n time_to_interactive: 'view.tti',\n dom: 'view.dom',\n dom_ready: 'view.dom_ready',\n time_spent: 'view.time_spent',\n first_byte: 'view.first_byte',\n frustration_count: 'view.frustration.count',\n custom_timings: 'view.custom_timings'\n }\n },\n resource: {\n type: RumEventType.RESOURCE,\n tags: {\n trace_id: '_gc.trace_id',\n span_id: '_gc.span_id',\n resource_id: 'resource.id',\n resource_url: 'resource.url',\n resource_url_host: 'resource.url_host',\n resource_url_path: 'resource.url_path',\n resource_url_path_group: 'resource.url_path_group',\n resource_url_query: 'resource.url_query',\n resource_type: 'resource.type',\n resource_status: 'resource.status',\n resource_status_group: 'resource.status_group',\n resource_method: 'resource.method'\n },\n fields: {\n duration: 'resource.duration',\n resource_size: 'resource.size',\n resource_encode_size: 'resource.encoded_body_size',\n resource_decode_size: 'resource.decoded_body_size',\n resource_transfer_size: 'resource.transfer_size',\n resource_render_blocking_status: 'resource.render_blocking_status',\n resource_dns: 'resource.dns',\n resource_tcp: 'resource.tcp',\n resource_ssl: 'resource.ssl',\n resource_ttfb: 'resource.ttfb',\n resource_trans: 'resource.trans',\n resource_redirect: 'resource.redirect',\n resource_first_byte: 'resource.firstbyte',\n resource_dns_time: 'resource.dns_time',\n resource_download_time: 'resource.download_time',\n resource_first_byte_time: 'resource.first_byte_time',\n resource_connect_time: 'resource.connect_time',\n resource_ssl_time: 'resource.ssl_time',\n resource_redirect_time: 'resource.redirect_time'\n }\n },\n error: {\n type: RumEventType.ERROR,\n tags: {\n error_id: 'error.id',\n trace_id: '_gc.trace_id',\n span_id: '_gc.span_id',\n error_source: 'error.source',\n error_type: 'error.type',\n error_handling: 'error.handling'\n // resource_url: 'error.resource.url',\n // resource_url_host: 'error.resource.url_host',\n // resource_url_path: 'error.resource.url_path',\n // resource_url_path_group: 'error.resource.url_path_group',\n // resource_status: 'error.resource.status',\n // resource_status_group: 'error.resource.status_group',\n // resource_method: 'error.resource.method'\n },\n fields: {\n error_message: ['string', 'error.message'],\n error_stack: ['string', 'error.stack'],\n error_causes: ['string', 'error.causes'],\n error_handling_stack: ['string', 'error.handling_stack']\n }\n },\n long_task: {\n type: RumEventType.LONG_TASK,\n tags: {\n long_task_id: 'long_task.id'\n },\n fields: {\n duration: 'long_task.duration',\n blocking_duration: 'long_task.blocking_duration',\n first_ui_event_timestamp: 'long_task.first_ui_event_timestamp',\n render_start: 'long_task.render_start',\n style_and_layout_start: 'long_task.style_and_layout_start',\n long_task_start_time: 'long_task.start_time',\n scripts: ['string', 'long_task.scripts']\n }\n },\n action: {\n type: RumEventType.ACTION,\n tags: {\n action_type: 'action.type'\n },\n fields: {\n action_name: 'action.target.name',\n duration: 'action.loading_time',\n action_error_count: 'action.error.count',\n action_resource_count: 'action.resource.count',\n action_frustration_types: 'action.frustration.type',\n action_long_task_count: 'action.long_task.count',\n action_target: '_gc.action.target',\n action_position: '_gc.action.position'\n }\n },\n telemetry: {\n type: 'telemetry',\n fields: {\n status: 'telemetry.status',\n message: ['string', 'telemetry.message'],\n type: 'telemetry.type',\n error_stack: ['string', 'telemetry.error.stack'],\n error_kind: ['string', 'telemetry.error.kind']\n }\n },\n browser_log: {\n type: RumEventType.LOGGER,\n tags: {\n error_source: 'error.source',\n error_type: 'error.type',\n error_resource_url: 'http.url',\n error_resource_url_host: 'http.url_host',\n error_resource_url_path: 'http.url_path',\n error_resource_url_path_group: 'http.url_path_group',\n error_resource_status: 'http.status_code',\n error_resource_status_group: 'http.status_group',\n error_resource_method: 'http.method',\n action_id: 'user_action.id',\n service: 'service',\n status: 'status'\n },\n fields: {\n message: ['string', 'message'],\n error_message: ['string', 'error.message'],\n error_stack: ['string', 'error.stack']\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACO,IAAIC,UAAU,GAAG;EACtBC,QAAQ,EAAE,cAAc;EACxBC,WAAW,EAAE,iBAAiB;EAC9BC,MAAM,EAAE,gBAAgB;EACxBC,GAAG,EAAE,KAAK;EACVC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE,QAAQ;EAChBC,MAAM,EAAE,SAAS;EACjBC,UAAU,EAAE,YAAY;EACxBC,SAAS,EAAE,WAAW;EACtBC,UAAU,EAAE,YAAY;EACxBC,YAAY,EAAE,cAAc;EAC5BC,gBAAgB,EAAE,qBAAqB;EACvCC,SAAS,EAAE,gBAAgB;EAC3BC,EAAE,EAAE,WAAW;EACfC,UAAU,EAAE,mBAAmB;EAC/BC,gBAAgB,EAAE,yBAAyB;EAC3CC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AE,SAAS;MAClBiJ,MAAM,EAAE;IACV,CAAC;IACDjG,MAAM,EAAE;MACNkG,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;MAC9BzB,aAAa,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC;MAC1CC,WAAW,EAAE,CAAC,QAAQ,EAAE,aAAa;IACvC;EACF;AACF,CAAC;AAAAhG,OAAA,CAAAa,OAAA,GAAAA,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"dataMap.js","names":["_enums","require","commonTags","sdk_name","sdk_version","app_id","env","service","version","source","userid","user_email","user_name","session_id","session_type","session_sampling","is_signin","os","os_version","os_version_major","browser","browser_version","browser_version_major","screen_size","network_type","device","view_id","view_referrer","view_url","view_host","view_path","view_name","view_path_group","exports","commonFields","view_url_query","action_id","action_ids","view_in_foreground","display","session_has_replay","is_login","page_states","session_sample_rate","session_replay_sample_rate","drift","dataMap","view","type","RumEventType","VIEW","tags","view_loading_type","view_apdex_level","view_privacy_replay_level","fields","sampled_for_replay","is_active","session_replay_stats","session_is_active","view_error_count","view_resource_count","view_long_task_count","view_action_count","first_contentful_paint","largest_contentful_paint","largest_contentful_paint_element_selector","cumulative_layout_shift","cumulative_layout_shift_time","cumulative_layout_shift_target_selector","first_input_delay","loading_time","dom_interactive","dom_content_loaded","dom_complete","load_event","first_input_time","first_input_target_selector","first_paint_time","interaction_to_next_paint","interaction_to_next_paint_target_selector","resource_load_time","time_to_interactive","dom","dom_ready","time_spent","first_byte","frustration_count","custom_timings","resource","RESOURCE","trace_id","span_id","resource_id","resource_status","resource_status_group","resource_method","duration","resource_size","resource_url","resource_url_host","resource_url_path","resource_url_path_group","resource_url_query","resource_delivery_type","resource_type","resource_protocol","resource_encode_size","resource_decode_size","resource_transfer_size","resource_render_blocking_status","resource_dns","resource_tcp","resource_ssl","resource_ttfb","resource_trans","resource_redirect","resource_first_byte","resource_dns_time","resource_download_time","resource_first_byte_time","resource_connect_time","resource_ssl_time","resource_redirect_time","error","ERROR","error_id","error_source","error_type","error_handling","error_message","error_stack","error_causes","error_handling_stack","long_task","LONG_TASK","long_task_id","blocking_duration","first_ui_event_timestamp","render_start","style_and_layout_start","long_task_start_time","scripts","action","ACTION","action_type","action_name","action_error_count","action_resource_count","action_frustration_types","action_long_task_count","action_target","action_position","telemetry","status","message","error_kind","browser_log","LOGGER","error_resource_url","error_resource_url_host","error_resource_url_path","error_resource_url_path_group","error_resource_status","error_resource_status_group","error_resource_method"],"sources":["../src/dataMap.js"],"sourcesContent":["import { RumEventType } from './helper/enums'\nexport var commonTags = {\n sdk_name: '_gc.sdk_name',\n sdk_version: '_gc.sdk_version',\n app_id: 'application.id',\n env: 'env',\n service: 'service',\n version: 'version',\n source: 'source',\n userid: 'user.id',\n user_email: 'user.email',\n user_name: 'user.name',\n session_id: 'session.id',\n session_type: 'session.type',\n session_sampling: 'session.is_sampling',\n is_signin: 'user.is_signin',\n os: 'device.os',\n os_version: 'device.os_version',\n os_version_major: 'device.os_version_major',\n browser: 'device.browser',\n browser_version: 'device.browser_version',\n browser_version_major: 'device.browser_version_major',\n screen_size: 'device.screen_size',\n network_type: 'device.network_type',\n device: 'device.device',\n view_id: 'view.id',\n view_referrer: 'view.referrer',\n view_url: 'view.url',\n view_host: 'view.host',\n view_path: 'view.path',\n view_name: 'view.path', // 冗余一个字段\n view_path_group: 'view.path_group'\n}\nexport var commonFields = {\n view_url_query: 'view.url_query',\n action_id: 'action.id',\n action_ids: 'action.ids',\n view_in_foreground: 'view.in_foreground',\n display: 'display',\n session_has_replay: 'session.has_replay',\n is_login: 'user.is_login',\n page_states: '_gc.page_states',\n session_sample_rate: '_gc.configuration.session_sample_rate',\n session_replay_sample_rate: '_gc.configuration.session_replay_sample_rate',\n drift: '_gc.drift'\n}\n// 需要用双引号将字符串类型的field value括起来, 这里有数组标示[string, path]\nexport var dataMap = {\n view: {\n type: RumEventType.VIEW,\n tags: {\n view_loading_type: 'view.loading_type',\n view_apdex_level: 'view.apdex_level',\n view_privacy_replay_level: 'privacy.replay_level'\n },\n fields: {\n sampled_for_replay: 'session.sampled_for_replay',\n is_active: 'view.is_active',\n session_replay_stats: '_gc.replay_stats',\n session_is_active: 'session.is_active',\n view_error_count: 'view.error.count',\n view_resource_count: 'view.resource.count',\n view_long_task_count: 'view.long_task.count',\n view_action_count: 'view.action.count',\n first_contentful_paint: 'view.first_contentful_paint',\n largest_contentful_paint: 'view.largest_contentful_paint',\n largest_contentful_paint_element_selector:\n 'view.largest_contentful_paint_element_selector',\n cumulative_layout_shift: 'view.cumulative_layout_shift',\n cumulative_layout_shift_time: 'view.cumulative_layout_shift_time',\n cumulative_layout_shift_target_selector:\n 'view.cumulative_layout_shift_target_selector',\n first_input_delay: 'view.first_input_delay',\n loading_time: 'view.loading_time',\n dom_interactive: 'view.dom_interactive',\n dom_content_loaded: 'view.dom_content_loaded',\n dom_complete: 'view.dom_complete',\n load_event: 'view.load_event',\n first_input_time: 'view.first_input_time',\n first_input_target_selector: 'view.first_input_target_selector',\n first_paint_time: 'view.fpt',\n interaction_to_next_paint: 'view.interaction_to_next_paint',\n interaction_to_next_paint_target_selector:\n 'view.interaction_to_next_paint_target_selector',\n resource_load_time: 'view.resource_load_time',\n time_to_interactive: 'view.tti',\n dom: 'view.dom',\n dom_ready: 'view.dom_ready',\n time_spent: 'view.time_spent',\n first_byte: 'view.first_byte',\n frustration_count: 'view.frustration.count',\n custom_timings: 'view.custom_timings'\n }\n },\n resource: {\n type: RumEventType.RESOURCE,\n tags: {\n trace_id: '_gc.trace_id',\n span_id: '_gc.span_id',\n resource_id: 'resource.id',\n resource_status: 'resource.status',\n resource_status_group: 'resource.status_group',\n resource_method: 'resource.method'\n },\n fields: {\n duration: 'resource.duration',\n resource_size: 'resource.size',\n resource_url: 'resource.url',\n resource_url_host: 'resource.url_host',\n resource_url_path: 'resource.url_path',\n resource_url_path_group: 'resource.url_path_group',\n resource_url_query: 'resource.url_query',\n resource_delivery_type: 'resource.delivery_type',\n resource_type: 'resource.type',\n resource_protocol: 'resource.protocol',\n resource_encode_size: 'resource.encoded_body_size',\n resource_decode_size: 'resource.decoded_body_size',\n resource_transfer_size: 'resource.transfer_size',\n resource_render_blocking_status: 'resource.render_blocking_status',\n resource_dns: 'resource.dns',\n resource_tcp: 'resource.tcp',\n resource_ssl: 'resource.ssl',\n resource_ttfb: 'resource.ttfb',\n resource_trans: 'resource.trans',\n resource_redirect: 'resource.redirect',\n resource_first_byte: 'resource.firstbyte',\n resource_dns_time: 'resource.dns_time',\n resource_download_time: 'resource.download_time',\n resource_first_byte_time: 'resource.first_byte_time',\n resource_connect_time: 'resource.connect_time',\n resource_ssl_time: 'resource.ssl_time',\n resource_redirect_time: 'resource.redirect_time'\n }\n },\n error: {\n type: RumEventType.ERROR,\n tags: {\n error_id: 'error.id',\n trace_id: '_gc.trace_id',\n span_id: '_gc.span_id',\n error_source: 'error.source',\n error_type: 'error.type',\n error_handling: 'error.handling'\n // resource_url: 'error.resource.url',\n // resource_url_host: 'error.resource.url_host',\n // resource_url_path: 'error.resource.url_path',\n // resource_url_path_group: 'error.resource.url_path_group',\n // resource_status: 'error.resource.status',\n // resource_status_group: 'error.resource.status_group',\n // resource_method: 'error.resource.method'\n },\n fields: {\n error_message: ['string', 'error.message'],\n error_stack: ['string', 'error.stack'],\n error_causes: ['string', 'error.causes'],\n error_handling_stack: ['string', 'error.handling_stack']\n }\n },\n long_task: {\n type: RumEventType.LONG_TASK,\n tags: {\n long_task_id: 'long_task.id'\n },\n fields: {\n duration: 'long_task.duration',\n blocking_duration: 'long_task.blocking_duration',\n first_ui_event_timestamp: 'long_task.first_ui_event_timestamp',\n render_start: 'long_task.render_start',\n style_and_layout_start: 'long_task.style_and_layout_start',\n long_task_start_time: 'long_task.start_time',\n scripts: ['string', 'long_task.scripts']\n }\n },\n action: {\n type: RumEventType.ACTION,\n tags: {\n action_type: 'action.type'\n },\n fields: {\n action_name: 'action.target.name',\n duration: 'action.loading_time',\n action_error_count: 'action.error.count',\n action_resource_count: 'action.resource.count',\n action_frustration_types: 'action.frustration.type',\n action_long_task_count: 'action.long_task.count',\n action_target: '_gc.action.target',\n action_position: '_gc.action.position'\n }\n },\n telemetry: {\n type: 'telemetry',\n fields: {\n status: 'telemetry.status',\n message: ['string', 'telemetry.message'],\n type: 'telemetry.type',\n error_stack: ['string', 'telemetry.error.stack'],\n error_kind: ['string', 'telemetry.error.kind']\n }\n },\n browser_log: {\n type: RumEventType.LOGGER,\n tags: {\n error_source: 'error.source',\n error_type: 'error.type',\n error_resource_url: 'http.url',\n error_resource_url_host: 'http.url_host',\n error_resource_url_path: 'http.url_path',\n error_resource_url_path_group: 'http.url_path_group',\n error_resource_status: 'http.status_code',\n error_resource_status_group: 'http.status_group',\n error_resource_method: 'http.method',\n action_id: 'user_action.id',\n service: 'service',\n status: 'status'\n },\n fields: {\n message: ['string', 'message'],\n error_message: ['string', 'error.message'],\n error_stack: ['string', 'error.stack']\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACO,IAAIC,UAAU,GAAG;EACtBC,QAAQ,EAAE,cAAc;EACxBC,WAAW,EAAE,iBAAiB;EAC9BC,MAAM,EAAE,gBAAgB;EACxBC,GAAG,EAAE,KAAK;EACVC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE,QAAQ;EAChBC,MAAM,EAAE,SAAS;EACjBC,UAAU,EAAE,YAAY;EACxBC,SAAS,EAAE,WAAW;EACtBC,UAAU,EAAE,YAAY;EACxBC,YAAY,EAAE,cAAc;EAC5BC,gBAAgB,EAAE,qBAAqB;EACvCC,SAAS,EAAE,gBAAgB;EAC3BC,EAAE,EAAE,WAAW;EACfC,UAAU,EAAE,mBAAmB;EAC/BC,gBAAgB,EAAE,yBAAyB;EAC3CC,OAAO,EAAE,gBAAgB;EACzBC,eAAe,EAAE,wBAAwB;EACzCC,qBAAqB,EAAE,8BAA8B;EACrDC,WAAW,EAAE,oBAAoB;EAC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,MAAM,EAAE;MACNoG,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;MAC9BzB,aAAa,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC;MAC1CC,WAAW,EAAE,CAAC,QAAQ,EAAE,aAAa;IACvC;EACF;AACF,CAAC;AAAAlG,OAAA,CAAAa,OAAA,GAAAA,OAAA","ignoreList":[]}
|
package/cjs/helper/sanitize.js
CHANGED
|
@@ -173,11 +173,11 @@ function sanitizeObjects(value) {
|
|
|
173
173
|
try {
|
|
174
174
|
// Handle events - Keep a simple implementation to avoid breaking changes
|
|
175
175
|
if (value instanceof Event) {
|
|
176
|
-
return
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
return sanitizeEvent(value);
|
|
177
|
+
}
|
|
178
|
+
if (value instanceof RegExp) {
|
|
179
|
+
return "[RegExp] ".concat(value.toString());
|
|
179
180
|
}
|
|
180
|
-
|
|
181
181
|
// Handle all remaining object types in a generic way
|
|
182
182
|
var result = Object.prototype.toString.call(value);
|
|
183
183
|
var match = result.match(/\[object (.*)\]/);
|
|
@@ -190,7 +190,14 @@ function sanitizeObjects(value) {
|
|
|
190
190
|
}
|
|
191
191
|
return '[Unserializable]';
|
|
192
192
|
}
|
|
193
|
-
|
|
193
|
+
function sanitizeEvent(event) {
|
|
194
|
+
return {
|
|
195
|
+
type: event.type,
|
|
196
|
+
isTrusted: event.isTrusted,
|
|
197
|
+
currentTarget: event.currentTarget ? sanitizeObjects(event.currentTarget) : null,
|
|
198
|
+
target: event.target ? sanitizeObjects(event.target) : null
|
|
199
|
+
};
|
|
200
|
+
}
|
|
194
201
|
/**
|
|
195
202
|
* Checks if a toJSON function exists and tries to execute it
|
|
196
203
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize.js","names":["_display","require","_byteUtils","_jsonStringify","_typeof","obj","Symbol","iterator","constructor","prototype","SANITIZE_DEFAULT_MAX_CHARACTER_COUNT","ONE_KIBI_BYTE","JSON_PATH_ROOT_ELEMENT","KEY_DECORATION_LENGTH","sanitize","source","maxCharacterCount","undefined","restoreObjectPrototypeToJson","detachToJsonMethod","Object","restoreArrayPrototypeToJson","Array","containerQueue","visitedObjectsWithPath","WeakMap","sanitizedData","sanitizeProcessor","accumulatedCharacterCount","JSON","stringify","length","warnOverCharacterLimit","containerToProcess","shift","separatorLength","isArray","key","targetData","path","target","hasOwnProperty","call","parentPath","queue","sourceToSanitize","tryToApplyToJSON","sanitizePrimitivesAndFunctions","sanitizedSource","sanitizeObjects","sourceAsObject","has","get","currentPath","set","push","value","toString","name","description","Event","isTrusted","result","match","_unused","object","toJSON","_unused2","changeType","display","warn"],"sources":["../../src/helper/sanitize.js"],"sourcesContent":["import { display } from './display'\nimport { ONE_KIBI_BYTE } from './byteUtils'\nimport { detachToJsonMethod } from './serialisation/jsonStringify'\n\n// The maximum size of a single event is 256KiB. By default, we ensure that user-provided data\n// going through sanitize fits inside our events, while leaving room for other contexts, metadata, ...\nvar SANITIZE_DEFAULT_MAX_CHARACTER_COUNT = 220 * ONE_KIBI_BYTE\n\n// Symbol for the root element of the JSONPath used for visited objects\nvar JSON_PATH_ROOT_ELEMENT = '$'\n\n// When serializing (using JSON.stringify) a key of an object, { key: 42 } gets wrapped in quotes as \"key\".\n// With the separator (:), we need to add 3 characters to the count.\nvar KEY_DECORATION_LENGTH = 3\n\n/**\n * Ensures user-provided data is 'safe' for the SDK\n * - Deep clones data\n * - Removes cyclic references\n * - Transforms unserializable types to a string representation\n *\n * LIMITATIONS:\n * - Size is in characters, not byte count (may differ according to character encoding)\n * - Size does not take into account indentation that can be applied to JSON.stringify\n * - Non-numerical properties of Arrays are ignored. Same behavior as JSON.stringify\n *\n * @param source User-provided data meant to be serialized using JSON.stringify\n * @param maxCharacterCount Maximum number of characters allowed in serialized form\n */\n\nexport function sanitize(source, maxCharacterCount) {\n if (maxCharacterCount === undefined) {\n maxCharacterCount = SANITIZE_DEFAULT_MAX_CHARACTER_COUNT\n }\n // Unbind any toJSON function we may have on [] or {} prototypes\n var restoreObjectPrototypeToJson = detachToJsonMethod(Object.prototype)\n var restoreArrayPrototypeToJson = detachToJsonMethod(Array.prototype)\n\n // Initial call to sanitizeProcessor - will populate containerQueue if source is an Array or a plain Object\n var containerQueue = []\n var visitedObjectsWithPath = new WeakMap()\n var sanitizedData = sanitizeProcessor(\n source,\n JSON_PATH_ROOT_ELEMENT,\n undefined,\n containerQueue,\n visitedObjectsWithPath\n )\n var accumulatedCharacterCount =\n (JSON.stringify(sanitizedData) && JSON.stringify(sanitizedData).length) || 0\n if (accumulatedCharacterCount > maxCharacterCount) {\n warnOverCharacterLimit(maxCharacterCount, 'discarded', source)\n return undefined\n }\n\n while (\n containerQueue.length > 0 &&\n accumulatedCharacterCount < maxCharacterCount\n ) {\n var containerToProcess = containerQueue.shift()\n var separatorLength = 0 // 0 for the first element, 1 for subsequent elements\n\n // Arrays and Objects have to be handled distinctly to ensure\n // we do not pick up non-numerical properties from Arrays\n if (Array.isArray(containerToProcess.source)) {\n for (var key = 0; key < containerToProcess.source.length; key++) {\n var targetData = sanitizeProcessor(\n containerToProcess.source[key],\n containerToProcess.path,\n key,\n containerQueue,\n visitedObjectsWithPath\n )\n\n if (targetData !== undefined) {\n accumulatedCharacterCount += JSON.stringify(targetData).length\n } else {\n // When an element of an Array (targetData) is undefined, it is serialized as null:\n // JSON.stringify([undefined]) => '[null]' - This accounts for 4 characters\n accumulatedCharacterCount += 4\n }\n accumulatedCharacterCount += separatorLength\n separatorLength = 1\n if (accumulatedCharacterCount > maxCharacterCount) {\n warnOverCharacterLimit(maxCharacterCount, 'truncated', source)\n break\n }\n containerToProcess.target[key] = targetData\n }\n } else {\n for (var key in containerToProcess.source) {\n if (\n Object.prototype.hasOwnProperty.call(containerToProcess.source, key)\n ) {\n var targetData = sanitizeProcessor(\n containerToProcess.source[key],\n containerToProcess.path,\n key,\n containerQueue,\n visitedObjectsWithPath\n )\n // When a property of an object has an undefined value, it will be dropped during serialization:\n // JSON.stringify({a:undefined}) => '{}'\n if (targetData !== undefined) {\n accumulatedCharacterCount +=\n JSON.stringify(targetData).length +\n separatorLength +\n key.length +\n KEY_DECORATION_LENGTH\n separatorLength = 1\n }\n if (accumulatedCharacterCount > maxCharacterCount) {\n warnOverCharacterLimit(maxCharacterCount, 'truncated', source)\n break\n }\n containerToProcess.target[key] = targetData\n }\n }\n }\n }\n\n // Rebind detached toJSON functions\n restoreObjectPrototypeToJson()\n restoreArrayPrototypeToJson()\n\n return sanitizedData\n}\n\n/**\n * Internal function to factorize the process common to the\n * initial call to sanitize, and iterations for Arrays and Objects\n *\n */\nfunction sanitizeProcessor(\n source,\n parentPath,\n key,\n queue,\n visitedObjectsWithPath\n) {\n // Start by handling toJSON, as we want to sanitize its output\n var sourceToSanitize = tryToApplyToJSON(source)\n\n if (!sourceToSanitize || typeof sourceToSanitize !== 'object') {\n return sanitizePrimitivesAndFunctions(sourceToSanitize)\n }\n\n var sanitizedSource = sanitizeObjects(sourceToSanitize)\n if (\n sanitizedSource !== '[Object]' &&\n sanitizedSource !== '[Array]' &&\n sanitizedSource !== '[Error]'\n ) {\n return sanitizedSource\n }\n\n // Handle potential cyclic references\n // We need to use source as sourceToSanitize could be a reference to a new object\n // At this stage, we know the source is an object type\n var sourceAsObject = source\n if (visitedObjectsWithPath.has(sourceAsObject)) {\n return (\n '[Reference seen at ' + visitedObjectsWithPath.get(sourceAsObject) + ']'\n )\n }\n\n // Add processed source to queue\n var currentPath = key !== undefined ? parentPath + '.' + key : parentPath\n var target = Array.isArray(sourceToSanitize) ? [] : {}\n visitedObjectsWithPath.set(sourceAsObject, currentPath)\n queue.push({ source: sourceToSanitize, target, path: currentPath })\n\n return target\n}\n\n/**\n * Handles sanitization of simple, non-object types\n *\n */\nfunction sanitizePrimitivesAndFunctions(value) {\n // BigInt cannot be serialized by JSON.stringify(), convert it to a string representation\n if (typeof value === 'bigint') {\n return '[BigInt] ' + value.toString()\n }\n // Functions cannot be serialized by JSON.stringify(). Moreover, if a faulty toJSON is present, it needs to be converted\n // so it won't prevent stringify from serializing later\n if (typeof value === 'function') {\n return '[Function] ' + value.name || 'unknown'\n }\n // JSON.stringify() does not serialize symbols.\n if (typeof value === 'symbol') {\n // symbol.description is part of ES2019+\n return '[Symbol] ' + value.description || value.toString()\n }\n\n return value\n}\n\n/**\n * Handles sanitization of object types\n *\n * LIMITATIONS\n * - If a class defines a toStringTag Symbol, it will fall in the catch-all method and prevent enumeration of properties.\n * To avoid this, a toJSON method can be defined.\n * - IE11 does not return a distinct type for objects such as Map, WeakMap, ... These objects will pass through and their\n * properties enumerated if any.\n *\n */\nfunction sanitizeObjects(value) {\n try {\n // Handle events - Keep a simple implementation to avoid breaking changes\n if (value instanceof Event) {\n return {\n isTrusted: value.isTrusted\n }\n }\n\n // Handle all remaining object types in a generic way\n var result = Object.prototype.toString.call(value)\n var match = result.match(/\\[object (.*)\\]/)\n if (match && match[1]) {\n return '[' + match[1] + ']'\n }\n } catch {\n // If the previous serialization attempts failed, and we cannot convert using\n // Object.prototype.toString, declare the value unserializable\n }\n return '[Unserializable]'\n}\n\n/**\n * Checks if a toJSON function exists and tries to execute it\n *\n */\nfunction tryToApplyToJSON(value) {\n var object = value\n if (object && typeof object.toJSON === 'function') {\n try {\n return object.toJSON()\n } catch {\n // If toJSON fails, we continue by trying to serialize the value manually\n }\n }\n\n return value\n}\n\n/**\n * Helper function to display the warning when the accumulated character count is over the limit\n */\nfunction warnOverCharacterLimit(maxCharacterCount, changeType, source) {\n display.warn(\n 'The data provided has been ' +\n changeType +\n ' as it is over the limit of ' +\n maxCharacterCount +\n ' characters:',\n source\n )\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAAkE,SAAAG,QAAAC,GAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAF,GAAA,kBAAAA,GAA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A,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG;IAC7B;EACF,CAAC,CAAC,OAAAC,OAAA,EAAM;IACN;IACA;EAAA;EAEF,OAAO,kBAAkB;AAC3B;;AAEA;AACA;AACA;AACA;AACA,SAASlB,gBAAgBA,CAACU,KAAK,EAAE;EAC/B,IAAIS,MAAM,GAAGT,KAAK;EAClB,IAAIS,MAAM,IAAI,OAAOA,MAAM,CAACC,MAAM,KAAK,UAAU,EAAE;IACjD,IAAI;MACF,OAAOD,MAAM,CAACC,MAAM,CAAC,CAAC;IACxB,CAAC,CAAC,OAAAC,QAAA,EAAM;MACN;IAAA;EAEJ;EAEA,OAAOX,KAAK;AACd;;AAEA;AACA;AACA;AACA,SAASxB,sBAAsBA,CAAChB,iBAAiB,EAAEoD,UAAU,EAAErD,MAAM,EAAE;EACrEsD,gBAAO,CAACC,IAAI,CACV,6BAA6B,GAC3BF,UAAU,GACV,8BAA8B,GAC9BpD,iBAAiB,GACjB,cAAc,EAChBD,MACF,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"sanitize.js","names":["_display","require","_byteUtils","_jsonStringify","_typeof","obj","Symbol","iterator","constructor","prototype","SANITIZE_DEFAULT_MAX_CHARACTER_COUNT","ONE_KIBI_BYTE","JSON_PATH_ROOT_ELEMENT","KEY_DECORATION_LENGTH","sanitize","source","maxCharacterCount","undefined","restoreObjectPrototypeToJson","detachToJsonMethod","Object","restoreArrayPrototypeToJson","Array","containerQueue","visitedObjectsWithPath","WeakMap","sanitizedData","sanitizeProcessor","accumulatedCharacterCount","JSON","stringify","length","warnOverCharacterLimit","containerToProcess","shift","separatorLength","isArray","key","targetData","path","target","hasOwnProperty","call","parentPath","queue","sourceToSanitize","tryToApplyToJSON","sanitizePrimitivesAndFunctions","sanitizedSource","sanitizeObjects","sourceAsObject","has","get","currentPath","set","push","value","toString","name","description","Event","sanitizeEvent","RegExp","concat","result","match","_unused","event","type","isTrusted","currentTarget","object","toJSON","_unused2","changeType","display","warn"],"sources":["../../src/helper/sanitize.js"],"sourcesContent":["import { display } from './display'\nimport { ONE_KIBI_BYTE } from './byteUtils'\nimport { detachToJsonMethod } from './serialisation/jsonStringify'\n\n// The maximum size of a single event is 256KiB. By default, we ensure that user-provided data\n// going through sanitize fits inside our events, while leaving room for other contexts, metadata, ...\nvar SANITIZE_DEFAULT_MAX_CHARACTER_COUNT = 220 * ONE_KIBI_BYTE\n\n// Symbol for the root element of the JSONPath used for visited objects\nvar JSON_PATH_ROOT_ELEMENT = '$'\n\n// When serializing (using JSON.stringify) a key of an object, { key: 42 } gets wrapped in quotes as \"key\".\n// With the separator (:), we need to add 3 characters to the count.\nvar KEY_DECORATION_LENGTH = 3\n\n/**\n * Ensures user-provided data is 'safe' for the SDK\n * - Deep clones data\n * - Removes cyclic references\n * - Transforms unserializable types to a string representation\n *\n * LIMITATIONS:\n * - Size is in characters, not byte count (may differ according to character encoding)\n * - Size does not take into account indentation that can be applied to JSON.stringify\n * - Non-numerical properties of Arrays are ignored. Same behavior as JSON.stringify\n *\n * @param source User-provided data meant to be serialized using JSON.stringify\n * @param maxCharacterCount Maximum number of characters allowed in serialized form\n */\n\nexport function sanitize(source, maxCharacterCount) {\n if (maxCharacterCount === undefined) {\n maxCharacterCount = SANITIZE_DEFAULT_MAX_CHARACTER_COUNT\n }\n // Unbind any toJSON function we may have on [] or {} prototypes\n var restoreObjectPrototypeToJson = detachToJsonMethod(Object.prototype)\n var restoreArrayPrototypeToJson = detachToJsonMethod(Array.prototype)\n\n // Initial call to sanitizeProcessor - will populate containerQueue if source is an Array or a plain Object\n var containerQueue = []\n var visitedObjectsWithPath = new WeakMap()\n var sanitizedData = sanitizeProcessor(\n source,\n JSON_PATH_ROOT_ELEMENT,\n undefined,\n containerQueue,\n visitedObjectsWithPath\n )\n var accumulatedCharacterCount =\n (JSON.stringify(sanitizedData) && JSON.stringify(sanitizedData).length) || 0\n if (accumulatedCharacterCount > maxCharacterCount) {\n warnOverCharacterLimit(maxCharacterCount, 'discarded', source)\n return undefined\n }\n\n while (\n containerQueue.length > 0 &&\n accumulatedCharacterCount < maxCharacterCount\n ) {\n var containerToProcess = containerQueue.shift()\n var separatorLength = 0 // 0 for the first element, 1 for subsequent elements\n\n // Arrays and Objects have to be handled distinctly to ensure\n // we do not pick up non-numerical properties from Arrays\n if (Array.isArray(containerToProcess.source)) {\n for (var key = 0; key < containerToProcess.source.length; key++) {\n var targetData = sanitizeProcessor(\n containerToProcess.source[key],\n containerToProcess.path,\n key,\n containerQueue,\n visitedObjectsWithPath\n )\n\n if (targetData !== undefined) {\n accumulatedCharacterCount += JSON.stringify(targetData).length\n } else {\n // When an element of an Array (targetData) is undefined, it is serialized as null:\n // JSON.stringify([undefined]) => '[null]' - This accounts for 4 characters\n accumulatedCharacterCount += 4\n }\n accumulatedCharacterCount += separatorLength\n separatorLength = 1\n if (accumulatedCharacterCount > maxCharacterCount) {\n warnOverCharacterLimit(maxCharacterCount, 'truncated', source)\n break\n }\n containerToProcess.target[key] = targetData\n }\n } else {\n for (var key in containerToProcess.source) {\n if (\n Object.prototype.hasOwnProperty.call(containerToProcess.source, key)\n ) {\n var targetData = sanitizeProcessor(\n containerToProcess.source[key],\n containerToProcess.path,\n key,\n containerQueue,\n visitedObjectsWithPath\n )\n // When a property of an object has an undefined value, it will be dropped during serialization:\n // JSON.stringify({a:undefined}) => '{}'\n if (targetData !== undefined) {\n accumulatedCharacterCount +=\n JSON.stringify(targetData).length +\n separatorLength +\n key.length +\n KEY_DECORATION_LENGTH\n separatorLength = 1\n }\n if (accumulatedCharacterCount > maxCharacterCount) {\n warnOverCharacterLimit(maxCharacterCount, 'truncated', source)\n break\n }\n containerToProcess.target[key] = targetData\n }\n }\n }\n }\n\n // Rebind detached toJSON functions\n restoreObjectPrototypeToJson()\n restoreArrayPrototypeToJson()\n\n return sanitizedData\n}\n\n/**\n * Internal function to factorize the process common to the\n * initial call to sanitize, and iterations for Arrays and Objects\n *\n */\nfunction sanitizeProcessor(\n source,\n parentPath,\n key,\n queue,\n visitedObjectsWithPath\n) {\n // Start by handling toJSON, as we want to sanitize its output\n var sourceToSanitize = tryToApplyToJSON(source)\n\n if (!sourceToSanitize || typeof sourceToSanitize !== 'object') {\n return sanitizePrimitivesAndFunctions(sourceToSanitize)\n }\n\n var sanitizedSource = sanitizeObjects(sourceToSanitize)\n if (\n sanitizedSource !== '[Object]' &&\n sanitizedSource !== '[Array]' &&\n sanitizedSource !== '[Error]'\n ) {\n return sanitizedSource\n }\n\n // Handle potential cyclic references\n // We need to use source as sourceToSanitize could be a reference to a new object\n // At this stage, we know the source is an object type\n var sourceAsObject = source\n if (visitedObjectsWithPath.has(sourceAsObject)) {\n return (\n '[Reference seen at ' + visitedObjectsWithPath.get(sourceAsObject) + ']'\n )\n }\n\n // Add processed source to queue\n var currentPath = key !== undefined ? parentPath + '.' + key : parentPath\n var target = Array.isArray(sourceToSanitize) ? [] : {}\n visitedObjectsWithPath.set(sourceAsObject, currentPath)\n queue.push({ source: sourceToSanitize, target, path: currentPath })\n\n return target\n}\n\n/**\n * Handles sanitization of simple, non-object types\n *\n */\nfunction sanitizePrimitivesAndFunctions(value) {\n // BigInt cannot be serialized by JSON.stringify(), convert it to a string representation\n if (typeof value === 'bigint') {\n return '[BigInt] ' + value.toString()\n }\n // Functions cannot be serialized by JSON.stringify(). Moreover, if a faulty toJSON is present, it needs to be converted\n // so it won't prevent stringify from serializing later\n if (typeof value === 'function') {\n return '[Function] ' + value.name || 'unknown'\n }\n // JSON.stringify() does not serialize symbols.\n if (typeof value === 'symbol') {\n // symbol.description is part of ES2019+\n return '[Symbol] ' + value.description || value.toString()\n }\n\n return value\n}\n\n/**\n * Handles sanitization of object types\n *\n * LIMITATIONS\n * - If a class defines a toStringTag Symbol, it will fall in the catch-all method and prevent enumeration of properties.\n * To avoid this, a toJSON method can be defined.\n * - IE11 does not return a distinct type for objects such as Map, WeakMap, ... These objects will pass through and their\n * properties enumerated if any.\n *\n */\nfunction sanitizeObjects(value) {\n try {\n // Handle events - Keep a simple implementation to avoid breaking changes\n if (value instanceof Event) {\n return sanitizeEvent(value)\n }\n if (value instanceof RegExp) {\n return `[RegExp] ${value.toString()}`\n }\n // Handle all remaining object types in a generic way\n var result = Object.prototype.toString.call(value)\n var match = result.match(/\\[object (.*)\\]/)\n if (match && match[1]) {\n return '[' + match[1] + ']'\n }\n } catch {\n // If the previous serialization attempts failed, and we cannot convert using\n // Object.prototype.toString, declare the value unserializable\n }\n return '[Unserializable]'\n}\nfunction sanitizeEvent(event) {\n return {\n type: event.type,\n isTrusted: event.isTrusted,\n currentTarget: event.currentTarget\n ? sanitizeObjects(event.currentTarget)\n : null,\n target: event.target ? sanitizeObjects(event.target) : null\n }\n}\n/**\n * Checks if a toJSON function exists and tries to execute it\n *\n */\nfunction tryToApplyToJSON(value) {\n var object = value\n if (object && typeof object.toJSON === 'function') {\n try {\n return object.toJSON()\n } catch {\n // If toJSON fails, we continue by trying to serialize the value manually\n }\n }\n\n return value\n}\n\n/**\n * Helper function to display the warning when the accumulated character count is over the limit\n */\nfunction warnOverCharacterLimit(maxCharacterCount, changeType, source) {\n display.warn(\n 'The data provided has been ' +\n changeType +\n ' as it is over the limit of ' +\n maxCharacterCount +\n ' characters:',\n source\n )\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAAkE,SAAAG,QAAAC,GAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAF,GAAA,kBAAAA,GAAA,gBAAAA,GAAA,WAAAA,GAAA,yBAAAC,MAAA,IAAAD,GAAA,CAAAG,WAAA,KAAAF,MAAA,IAAAD,GAAA,KAAAC,MAAA,CAAAG,SAAA,qBAAAJ,GAAA,KAAAD,OAAA,CAAAC,GAAA;AAElE;AACA;AACA,IAAIK,oCAAoC,GAAG,GAAG,GAAGC,wBAAa;;AAE9D;AAC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,KAAK,EAAE;EAC5B,OAAO;IACLC,IAAI,EAAED,KAAK,CAACC,IAAI;IAChBC,SAAS,EAAEF,KAAK,CAACE,SAAS;IAC1BC,aAAa,EAAEH,KAAK,CAACG,aAAa,GAC9BrB,eAAe,CAACkB,KAAK,CAACG,aAAa,CAAC,GACpC,IAAI;IACR9B,MAAM,EAAE2B,KAAK,CAAC3B,MAAM,GAAGS,eAAe,CAACkB,KAAK,CAAC3B,MAAM,CAAC,GAAG;EACzD,CAAC;AACH;AACA;AACA;AACA;AACA;AACA,SAASM,gBAAgBA,CAACU,KAAK,EAAE;EAC/B,IAAIe,MAAM,GAAGf,KAAK;EAClB,IAAIe,MAAM,IAAI,OAAOA,MAAM,CAACC,MAAM,KAAK,UAAU,EAAE;IACjD,IAAI;MACF,OAAOD,MAAM,CAACC,MAAM,CAAC,CAAC;IACxB,CAAC,CAAC,OAAAC,QAAA,EAAM;MACN;IAAA;EAEJ;EAEA,OAAOjB,KAAK;AACd;;AAEA;AACA;AACA;AACA,SAASxB,sBAAsBA,CAAChB,iBAAiB,EAAE0D,UAAU,EAAE3D,MAAM,EAAE;EACrE4D,gBAAO,CAACC,IAAI,CACV,6BAA6B,GAC3BF,UAAU,GACV,8BAA8B,GAC9B1D,iBAAiB,GACjB,cAAc,EAChBD,MACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taskQueue.js","names":["_tools","require","_requestIdleCallback","IDLE_CALLBACK_TIMEOUT","ONE_SECOND","MAX_EXECUTION_TIME_ON_TIMEOUT","exports","createTaskQueue","pendingTasks","run","deadline","executionTimeRemaining","didTimeout","start","performance","now","timeRemaining","bind","length","shift","scheduleNextRun","requestIdleCallback","timeout","push","task"],"sources":["../../src/helper/taskQueue.js"],"sourcesContent":["import { ONE_SECOND } from './tools'\nimport { requestIdleCallback } from './requestIdleCallback'\n\n/**\n * Maximum delay before starting to execute tasks in the queue. We don't want to wait too long\n * before running tasks, as it might hurt reliability (ex: if the user navigates away, we might lose\n * the opportunity to send some data). We also don't want to run tasks too often, as it might hurt\n * performance.\n */\nconst IDLE_CALLBACK_TIMEOUT = ONE_SECOND\n\n/**\n * Maximum amount of time allocated to running tasks when a timeout (`IDLE_CALLBACK_TIMEOUT`) is\n * reached. We should not run tasks for too long as it will hurt performance, but we should still\n * run some tasks to avoid postponing them forever.\n *\n * Rational: Running tasks for 30ms every second (IDLE_CALLBACK_TIMEOUT) should be acceptable.\n */\nexport const MAX_EXECUTION_TIME_ON_TIMEOUT = 30\n\nexport function createTaskQueue() {\n const pendingTasks = []\n\n function run(deadline) {\n let executionTimeRemaining\n if (deadline.didTimeout) {\n const start = performance.now()\n executionTimeRemaining = function () {\n return MAX_EXECUTION_TIME_ON_TIMEOUT - (performance.now() - start)\n }\n } else {\n executionTimeRemaining = deadline.timeRemaining.bind(deadline)\n }\n\n while (executionTimeRemaining() > 0 && pendingTasks.length) {\n pendingTasks.shift()()\n }\n\n if (pendingTasks.length) {\n scheduleNextRun()\n }\n }\n\n function scheduleNextRun() {\n requestIdleCallback(run, { timeout: IDLE_CALLBACK_TIMEOUT })\n }\n\n return {\n push(task) {\n if (pendingTasks.push(task) === 1) {\n scheduleNextRun()\n }\n }\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAME,qBAAqB,GAAGC,iBAAU;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMC,6BAA6B,GAAG,EAAE;AAAAC,OAAA,CAAAD,6BAAA,GAAAA,6BAAA;AAExC,SAASE,eAAeA,CAAA,EAAG;EAChC,IAAMC,YAAY,GAAG,EAAE;EAEvB,SAASC,GAAGA,CAACC,QAAQ,EAAE;IACrB,IAAIC,sBAAsB;IAC1B,IAAID,QAAQ,CAACE,UAAU,EAAE;MACvB,IAAMC,KAAK,GAAGC,WAAW,CAACC,GAAG,CAAC,CAAC;MAC/BJ,sBAAsB,GAAG,SAAAA,uBAAA,EAAY;QACnC,OAAON,6BAA6B,IAAIS,WAAW,CAACC,GAAG,CAAC,CAAC,GAAGF,KAAK,CAAC;MACpE,CAAC;IACH,CAAC,MAAM;MACLF,sBAAsB,GAAGD,QAAQ,CAACM,aAAa,CAACC,IAAI,CAACP,QAAQ,CAAC;IAChE;IAEA,OAAOC,sBAAsB,CAAC,CAAC,GAAG,CAAC,IAAIH,YAAY,CAACU,MAAM,EAAE;MAC1DV,YAAY,CAACW,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB;IAEA,IAAIX,YAAY,CAACU,MAAM,EAAE;MACvBE,eAAe,CAAC,CAAC;IACnB;EACF;EAEA,SAASA,eAAeA,CAAA,EAAG;IACzB,IAAAC,wCAAmB,EAACZ,GAAG,EAAE;MAAEa,OAAO,EAAEnB;IAAsB,CAAC,CAAC;EAC9D;EAEA,OAAO;IACLoB,IAAI,
|
|
1
|
+
{"version":3,"file":"taskQueue.js","names":["_tools","require","_requestIdleCallback","IDLE_CALLBACK_TIMEOUT","ONE_SECOND","MAX_EXECUTION_TIME_ON_TIMEOUT","exports","createTaskQueue","pendingTasks","run","deadline","executionTimeRemaining","didTimeout","start","performance","now","timeRemaining","bind","length","shift","scheduleNextRun","requestIdleCallback","timeout","push","task"],"sources":["../../src/helper/taskQueue.js"],"sourcesContent":["import { ONE_SECOND } from './tools'\nimport { requestIdleCallback } from './requestIdleCallback'\n\n/**\n * Maximum delay before starting to execute tasks in the queue. We don't want to wait too long\n * before running tasks, as it might hurt reliability (ex: if the user navigates away, we might lose\n * the opportunity to send some data). We also don't want to run tasks too often, as it might hurt\n * performance.\n */\nconst IDLE_CALLBACK_TIMEOUT = ONE_SECOND\n\n/**\n * Maximum amount of time allocated to running tasks when a timeout (`IDLE_CALLBACK_TIMEOUT`) is\n * reached. We should not run tasks for too long as it will hurt performance, but we should still\n * run some tasks to avoid postponing them forever.\n *\n * Rational: Running tasks for 30ms every second (IDLE_CALLBACK_TIMEOUT) should be acceptable.\n */\nexport const MAX_EXECUTION_TIME_ON_TIMEOUT = 30\n\nexport function createTaskQueue() {\n const pendingTasks = []\n\n function run(deadline) {\n let executionTimeRemaining\n if (deadline.didTimeout) {\n const start = performance.now()\n executionTimeRemaining = function () {\n return MAX_EXECUTION_TIME_ON_TIMEOUT - (performance.now() - start)\n }\n } else {\n executionTimeRemaining = deadline.timeRemaining.bind(deadline)\n }\n\n while (executionTimeRemaining() > 0 && pendingTasks.length) {\n pendingTasks.shift()()\n }\n\n if (pendingTasks.length) {\n scheduleNextRun()\n }\n }\n\n function scheduleNextRun() {\n requestIdleCallback(run, { timeout: IDLE_CALLBACK_TIMEOUT })\n }\n\n return {\n push: function (task) {\n if (pendingTasks.push(task) === 1) {\n scheduleNextRun()\n }\n }\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAME,qBAAqB,GAAGC,iBAAU;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMC,6BAA6B,GAAG,EAAE;AAAAC,OAAA,CAAAD,6BAAA,GAAAA,6BAAA;AAExC,SAASE,eAAeA,CAAA,EAAG;EAChC,IAAMC,YAAY,GAAG,EAAE;EAEvB,SAASC,GAAGA,CAACC,QAAQ,EAAE;IACrB,IAAIC,sBAAsB;IAC1B,IAAID,QAAQ,CAACE,UAAU,EAAE;MACvB,IAAMC,KAAK,GAAGC,WAAW,CAACC,GAAG,CAAC,CAAC;MAC/BJ,sBAAsB,GAAG,SAAAA,uBAAA,EAAY;QACnC,OAAON,6BAA6B,IAAIS,WAAW,CAACC,GAAG,CAAC,CAAC,GAAGF,KAAK,CAAC;MACpE,CAAC;IACH,CAAC,MAAM;MACLF,sBAAsB,GAAGD,QAAQ,CAACM,aAAa,CAACC,IAAI,CAACP,QAAQ,CAAC;IAChE;IAEA,OAAOC,sBAAsB,CAAC,CAAC,GAAG,CAAC,IAAIH,YAAY,CAACU,MAAM,EAAE;MAC1DV,YAAY,CAACW,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB;IAEA,IAAIX,YAAY,CAACU,MAAM,EAAE;MACvBE,eAAe,CAAC,CAAC;IACnB;EACF;EAEA,SAASA,eAAeA,CAAA,EAAG;IACzB,IAAAC,wCAAmB,EAACZ,GAAG,EAAE;MAAEa,OAAO,EAAEnB;IAAsB,CAAC,CAAC;EAC9D;EAEA,OAAO;IACLoB,IAAI,EAAE,SAAAA,KAAUC,IAAI,EAAE;MACpB,IAAIhB,YAAY,CAACe,IAAI,CAACC,IAAI,CAAC,KAAK,CAAC,EAAE;QACjCJ,eAAe,CAAC,CAAC;MACnB;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
package/cjs/helper/tools.js
CHANGED
|
@@ -1373,7 +1373,7 @@ var stringSplice = function stringSplice(src, k, e, sp) {
|
|
|
1373
1373
|
};
|
|
1374
1374
|
exports.stringSplice = stringSplice;
|
|
1375
1375
|
function getStatusGroup(status) {
|
|
1376
|
-
if (!status) return status;
|
|
1376
|
+
if (!status) return status === 0 ? undefined : status;
|
|
1377
1377
|
return String(status).substr(0, 1) + String(status).substr(1).replace(/\d*/g, 'x');
|
|
1378
1378
|
}
|
|
1379
1379
|
var getReferrer = function getReferrer() {
|