@cloudcare/browser-core 3.1.5 → 3.1.7
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 +2 -2
- package/cjs/dataMap.js.map +1 -1
- package/cjs/session/sessionCookieStore.js +1 -0
- package/cjs/session/sessionCookieStore.js.map +1 -1
- package/cjs/session/sessionStore.js +1 -1
- package/cjs/session/sessionStore.js.map +1 -1
- package/esm/dataMap.js +2 -2
- package/esm/dataMap.js.map +1 -1
- package/esm/session/sessionCookieStore.js +1 -1
- package/esm/session/sessionCookieStore.js.map +1 -1
- package/esm/session/sessionStore.js +2 -2
- package/esm/session/sessionStore.js.map +1 -1
- package/package.json +2 -2
- package/src/dataMap.js +2 -2
- package/src/session/sessionCookieStore.js +1 -1
- package/src/session/sessionStore.js +6 -2
package/cjs/dataMap.js
CHANGED
|
@@ -35,11 +35,11 @@ var commonTags = {
|
|
|
35
35
|
view_path: 'view.path',
|
|
36
36
|
view_name: 'view.path',
|
|
37
37
|
// 冗余一个字段
|
|
38
|
-
view_path_group: 'view.path_group'
|
|
39
|
-
view_url_query: 'view.url_query'
|
|
38
|
+
view_path_group: 'view.path_group'
|
|
40
39
|
};
|
|
41
40
|
exports.commonTags = commonTags;
|
|
42
41
|
var commonFields = {
|
|
42
|
+
view_url_query: 'view.url_query',
|
|
43
43
|
action_id: 'action.id',
|
|
44
44
|
action_ids: 'action.ids',
|
|
45
45
|
view_in_foreground: 'view.in_foreground',
|
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","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","view_url_query","exports","commonFields","action_id","action_ids","view_in_foreground","display","session_has_replay","is_login","page_states","dataMap","view","type","RumEventType","VIEW","tags","view_loading_type","view_apdex_level","view_privacy_replay_level","fields","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_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_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_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","long_task","LONG_TASK","long_task_id","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 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 view_url_query: 'view.url_query'\n}\nexport var commonFields = {\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}\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 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_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_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.encode_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 }\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 }\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 }\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,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;EACjCC,YAAY,EAAE,qBAAq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,kBAAkB;MAC1BC,OAAO,EAAE,CAAC,QAAQ,EAAE,mBAAmB,CAAC;MACxC7F,IAAI,EAAE,gBAAgB;MACtB4E,WAAW,EAAE,CAAC,QAAQ,EAAE,uBAAuB,CAAC;MAChDkB,UAAU,EAAE,CAAC,QAAQ,EAAE,sBAAsB;IAC/C;EACF,CAAC;EACDC,WAAW,EAAE;IACX/F,IAAI,EAAEC,mBAAY,CAAC+F,MAAM;IACzB7F,IAAI,EAAE;MACJqE,YAAY,EAAE,cAAc;MAC5BC,UAAU,EAAE,YAAY;MACxBwB,kBAAkB,EAAE,UAAU;MAC9BC,uBAAuB,EAAE,eAAe;MACxCC,uBAAuB,EAAE,eAAe;MACxCC,6BAA6B,EAAE,qBAAqB;MACpDC,qBAAqB,EAAE,kBAAkB;MACzCC,2BAA2B,EAAE,mBAAmB;MAChDC,qBAAqB,EAAE,aAAa;MACpChH,SAAS,EAAE,gBAAgB;MAC3B5B,OAAO,EAAE,SAAS;MAClBiI,MAAM,EAAE;IACV,CAAC;IACDrF,MAAM,EAAE;MACNsF,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS;IAC/B;EACF;AACF,CAAC;AAAAxG,OAAA,CAAAS,OAAA,GAAAA,OAAA"}
|
|
1
|
+
{"version":3,"file":"dataMap.js","names":["_enums","require","commonTags","sdk_name","sdk_version","app_id","env","service","version","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","dataMap","view","type","RumEventType","VIEW","tags","view_loading_type","view_apdex_level","view_privacy_replay_level","fields","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_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_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_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","long_task","LONG_TASK","long_task_id","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 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}\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 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_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_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.encode_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 }\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 }\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 }\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,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;EACjCC,YAAY,EAAE,qBAAqB;EACnCC,MAAM,EAAE,eAAe;EACvBC,OAAO,EAAE,SAAS;EAClBC,aAAa,EAAE,eAAe;EAC9BC,QAAQ,EAAE,UAAU;EACpBC,SAAS,EAAE,WAAW;EACtBC,SAAS,EAAE,WAAW;EACtBC,SAAS,EAAE,WAAW;EAAE;EACxBC,eAAe,EAAE;AACnB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EACDC,WAAW,EAAE;IACX/F,IAAI,EAAEC,mBAAY,CAAC+F,MAAM;IACzB7F,IAAI,EAAE;MACJqE,YAAY,EAAE,cAAc;MAC5BC,UAAU,EAAE,YAAY;MACxBwB,kBAAkB,EAAE,UAAU;MAC9BC,uBAAuB,EAAE,eAAe;MACxCC,uBAAuB,EAAE,eAAe;MACxCC,6BAA6B,EAAE,qBAAqB;MACpDC,qBAAqB,EAAE,kBAAkB;MACzCC,2BAA2B,EAAE,mBAAmB;MAChDC,qBAAqB,EAAE,aAAa;MACpChH,SAAS,EAAE,gBAAgB;MAC3B5B,OAAO,EAAE,SAAS;MAClBiI,MAAM,EAAE;IACV,CAAC;IACDrF,MAAM,EAAE;MACNsF,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS;IAC/B;EACF;AACF,CAAC;AAAAzG,OAAA,CAAAU,OAAA,GAAAA,OAAA"}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.SESSION_COOKIE_NAME = exports.MAX_NUMBER_OF_LOCK_RETRIES = exports.LOCK_RETRY_DELAY = void 0;
|
|
7
|
+
exports.clearSession = clearSession;
|
|
7
8
|
exports.persistSession = persistSession;
|
|
8
9
|
exports.retrieveSession = retrieveSession;
|
|
9
10
|
exports.toSessionString = toSessionString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionCookieStore.js","names":["_cookie","require","_tools","_sessionConstants","_timer","SESSION_ENTRY_REGEXP","SESSION_ENTRY_SEPARATOR","SESSION_COOKIE_NAME","exports","LOCK_RETRY_DELAY","MAX_NUMBER_OF_LOCK_RETRIES","bufferedOperations","ongoingOperations","withCookieLockAccess","operations","numberOfRetries","push","next","currentLock","currentSession","retrieveSession","isCookieLockEnabled","lock","retryLater","UUID","setSession","options","processedSession","process","persistSession","isExpiredState","after","isChromium","currentNumberOfRetries","setTimeout","undefined","nextOperations","shift","session","clearSession","expire","String","dateNow","SESSION_EXPIRATION_DELAY","setCookie","toSessionString","map","objectEntries","item","join","sessionString","getCookie","isValidSessionString","each","split","entry","matches","exec","key","value","indexOf","test","isEmptyObject"],"sources":["../../src/session/sessionCookieStore.js"],"sourcesContent":["import { getCookie, setCookie } from '../browser/cookie'\nimport {\n isChromium,\n dateNow,\n isEmptyObject,\n UUID,\n objectEntries,\n map,\n each\n} from '../helper/tools'\nimport { SESSION_EXPIRATION_DELAY } from './sessionConstants'\nimport { setTimeout } from '../helper/timer'\nvar SESSION_ENTRY_REGEXP = /^([a-z]+)=([a-z0-9-]+)$/\nvar SESSION_ENTRY_SEPARATOR = '&'\n\nexport var SESSION_COOKIE_NAME = '_dataflux_s'\n\n// arbitrary values\nexport var LOCK_RETRY_DELAY = 10\nexport var MAX_NUMBER_OF_LOCK_RETRIES = 100\n\nvar bufferedOperations = []\nvar ongoingOperations\n\nexport function withCookieLockAccess(operations, numberOfRetries) {\n if (typeof numberOfRetries === 'undefined') {\n numberOfRetries = 0\n }\n if (!ongoingOperations) {\n ongoingOperations = operations\n }\n if (operations !== ongoingOperations) {\n bufferedOperations.push(operations)\n return\n }\n if (numberOfRetries >= MAX_NUMBER_OF_LOCK_RETRIES) {\n next()\n return\n }\n var currentLock\n var currentSession = retrieveSession()\n if (isCookieLockEnabled()) {\n // if someone has lock, retry later\n if (currentSession.lock) {\n retryLater(operations, numberOfRetries)\n return\n }\n // acquire lock\n currentLock = UUID()\n currentSession.lock = currentLock\n setSession(currentSession, operations.options)\n // if lock is not acquired, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n var processedSession = operations.process(currentSession)\n if (isCookieLockEnabled()) {\n // if lock corrupted after process, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n if (processedSession) {\n persistSession(processedSession, operations.options)\n }\n if (isCookieLockEnabled()) {\n // correctly handle lock around expiration would require to handle this case properly at several levels\n // since we don't have evidence of lock issues around expiration, let's just not do the corruption check for it\n if (!(processedSession && isExpiredState(processedSession))) {\n // if lock corrupted after persist, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n delete currentSession.lock\n setSession(currentSession, operations.options)\n processedSession = currentSession\n }\n }\n // call after even if session is not persisted in order to perform operations on\n // up-to-date cookie value, the value could have been modified by another tab\n if (operations.after) {\n operations.after(processedSession || currentSession)\n }\n next()\n}\n\n/**\n * Cookie lock strategy allows mitigating issues due to concurrent access to cookie.\n * This issue concerns only chromium browsers and enabling this on firefox increase cookie write failures.\n */\nfunction isCookieLockEnabled() {\n return isChromium()\n}\n\nfunction retryLater(operations, currentNumberOfRetries) {\n setTimeout(function () {\n withCookieLockAccess(operations, currentNumberOfRetries + 1)\n }, LOCK_RETRY_DELAY)\n}\n\nfunction next() {\n ongoingOperations = undefined\n var nextOperations = bufferedOperations.shift()\n if (nextOperations) {\n withCookieLockAccess(nextOperations)\n }\n}\n\nexport function persistSession(session, options) {\n if (isExpiredState(session)) {\n clearSession(options)\n return\n }\n session.expire = String(dateNow() + SESSION_EXPIRATION_DELAY)\n setSession(session, options)\n}\n\nfunction setSession(session, options) {\n setCookie(\n SESSION_COOKIE_NAME,\n toSessionString(session),\n SESSION_EXPIRATION_DELAY,\n options\n )\n}\n\nexport function toSessionString(session) {\n return map(objectEntries(session), function (item) {\n return item[0] + '=' + item[1]\n }).join(SESSION_ENTRY_SEPARATOR)\n}\n\nexport function retrieveSession() {\n var sessionString = getCookie(SESSION_COOKIE_NAME)\n var session = {}\n if (isValidSessionString(sessionString)) {\n each(sessionString.split(SESSION_ENTRY_SEPARATOR), function (entry) {\n var matches = SESSION_ENTRY_REGEXP.exec(entry)\n if (matches !== null) {\n var key = matches[1]\n var value = matches[2]\n session[key] = value\n }\n })\n }\n return session\n}\n\nfunction isValidSessionString(sessionString) {\n return (\n sessionString !== undefined &&\n (sessionString.indexOf(SESSION_ENTRY_SEPARATOR) !== -1 ||\n SESSION_ENTRY_REGEXP.test(sessionString))\n )\n}\n\nfunction isExpiredState(session) {\n return isEmptyObject(session)\n}\
|
|
1
|
+
{"version":3,"file":"sessionCookieStore.js","names":["_cookie","require","_tools","_sessionConstants","_timer","SESSION_ENTRY_REGEXP","SESSION_ENTRY_SEPARATOR","SESSION_COOKIE_NAME","exports","LOCK_RETRY_DELAY","MAX_NUMBER_OF_LOCK_RETRIES","bufferedOperations","ongoingOperations","withCookieLockAccess","operations","numberOfRetries","push","next","currentLock","currentSession","retrieveSession","isCookieLockEnabled","lock","retryLater","UUID","setSession","options","processedSession","process","persistSession","isExpiredState","after","isChromium","currentNumberOfRetries","setTimeout","undefined","nextOperations","shift","session","clearSession","expire","String","dateNow","SESSION_EXPIRATION_DELAY","setCookie","toSessionString","map","objectEntries","item","join","sessionString","getCookie","isValidSessionString","each","split","entry","matches","exec","key","value","indexOf","test","isEmptyObject"],"sources":["../../src/session/sessionCookieStore.js"],"sourcesContent":["import { getCookie, setCookie } from '../browser/cookie'\nimport {\n isChromium,\n dateNow,\n isEmptyObject,\n UUID,\n objectEntries,\n map,\n each\n} from '../helper/tools'\nimport { SESSION_EXPIRATION_DELAY } from './sessionConstants'\nimport { setTimeout } from '../helper/timer'\nvar SESSION_ENTRY_REGEXP = /^([a-z]+)=([a-z0-9-]+)$/\nvar SESSION_ENTRY_SEPARATOR = '&'\n\nexport var SESSION_COOKIE_NAME = '_dataflux_s'\n\n// arbitrary values\nexport var LOCK_RETRY_DELAY = 10\nexport var MAX_NUMBER_OF_LOCK_RETRIES = 100\n\nvar bufferedOperations = []\nvar ongoingOperations\n\nexport function withCookieLockAccess(operations, numberOfRetries) {\n if (typeof numberOfRetries === 'undefined') {\n numberOfRetries = 0\n }\n if (!ongoingOperations) {\n ongoingOperations = operations\n }\n if (operations !== ongoingOperations) {\n bufferedOperations.push(operations)\n return\n }\n if (numberOfRetries >= MAX_NUMBER_OF_LOCK_RETRIES) {\n next()\n return\n }\n var currentLock\n var currentSession = retrieveSession()\n if (isCookieLockEnabled()) {\n // if someone has lock, retry later\n if (currentSession.lock) {\n retryLater(operations, numberOfRetries)\n return\n }\n // acquire lock\n currentLock = UUID()\n currentSession.lock = currentLock\n setSession(currentSession, operations.options)\n // if lock is not acquired, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n var processedSession = operations.process(currentSession)\n if (isCookieLockEnabled()) {\n // if lock corrupted after process, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n if (processedSession) {\n persistSession(processedSession, operations.options)\n }\n if (isCookieLockEnabled()) {\n // correctly handle lock around expiration would require to handle this case properly at several levels\n // since we don't have evidence of lock issues around expiration, let's just not do the corruption check for it\n if (!(processedSession && isExpiredState(processedSession))) {\n // if lock corrupted after persist, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n delete currentSession.lock\n setSession(currentSession, operations.options)\n processedSession = currentSession\n }\n }\n // call after even if session is not persisted in order to perform operations on\n // up-to-date cookie value, the value could have been modified by another tab\n if (operations.after) {\n operations.after(processedSession || currentSession)\n }\n next()\n}\n\n/**\n * Cookie lock strategy allows mitigating issues due to concurrent access to cookie.\n * This issue concerns only chromium browsers and enabling this on firefox increase cookie write failures.\n */\nfunction isCookieLockEnabled() {\n return isChromium()\n}\n\nfunction retryLater(operations, currentNumberOfRetries) {\n setTimeout(function () {\n withCookieLockAccess(operations, currentNumberOfRetries + 1)\n }, LOCK_RETRY_DELAY)\n}\n\nfunction next() {\n ongoingOperations = undefined\n var nextOperations = bufferedOperations.shift()\n if (nextOperations) {\n withCookieLockAccess(nextOperations)\n }\n}\n\nexport function persistSession(session, options) {\n if (isExpiredState(session)) {\n clearSession(options)\n return\n }\n session.expire = String(dateNow() + SESSION_EXPIRATION_DELAY)\n setSession(session, options)\n}\n\nfunction setSession(session, options) {\n setCookie(\n SESSION_COOKIE_NAME,\n toSessionString(session),\n SESSION_EXPIRATION_DELAY,\n options\n )\n}\n\nexport function toSessionString(session) {\n return map(objectEntries(session), function (item) {\n return item[0] + '=' + item[1]\n }).join(SESSION_ENTRY_SEPARATOR)\n}\n\nexport function retrieveSession() {\n var sessionString = getCookie(SESSION_COOKIE_NAME)\n var session = {}\n if (isValidSessionString(sessionString)) {\n each(sessionString.split(SESSION_ENTRY_SEPARATOR), function (entry) {\n var matches = SESSION_ENTRY_REGEXP.exec(entry)\n if (matches !== null) {\n var key = matches[1]\n var value = matches[2]\n session[key] = value\n }\n })\n }\n return session\n}\n\nfunction isValidSessionString(sessionString) {\n return (\n sessionString !== undefined &&\n (sessionString.indexOf(SESSION_ENTRY_SEPARATOR) !== -1 ||\n SESSION_ENTRY_REGEXP.test(sessionString))\n )\n}\n\nfunction isExpiredState(session) {\n return isEmptyObject(session)\n}\nexport function clearSession(options) {\n setCookie(SESSION_COOKIE_NAME, '', 0, options)\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AASA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAII,oBAAoB,GAAG,yBAAyB;AACpD,IAAIC,uBAAuB,GAAG,GAAG;AAE1B,IAAIC,mBAAmB,GAAG,aAAa;;AAE9C;AAAAC,OAAA,CAAAD,mBAAA,GAAAA,mBAAA;AACO,IAAIE,gBAAgB,GAAG,EAAE;AAAAD,OAAA,CAAAC,gBAAA,GAAAA,gBAAA;AACzB,IAAIC,0BAA0B,GAAG,GAAG;AAAAF,OAAA,CAAAE,0BAAA,GAAAA,0BAAA;AAE3C,IAAIC,kBAAkB,GAAG,EAAE;AAC3B,IAAIC,iBAAiB;AAEd,SAASC,oBAAoBA,CAACC,UAAU,EAAEC,eAAe,EAAE;EAChE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AcA,CAACQ,OAAO,EAAE;EAC/B,OAAO,IAAAwB,oBAAa,EAACxB,OAAO,CAAC;AAC/B;AACO,SAASC,YAAYA,CAACb,OAAO,EAAE;EACpC,IAAAkB,iBAAS,EAACrC,mBAAmB,EAAE,EAAE,EAAE,CAAC,EAAEmB,OAAO,CAAC;AAChD"}
|
|
@@ -120,7 +120,7 @@ function startSessionStore(options, productKey, computeSessionState) {
|
|
|
120
120
|
renewObservable: renewObservable,
|
|
121
121
|
expireObservable: expireObservable,
|
|
122
122
|
expire: function expire() {
|
|
123
|
-
|
|
123
|
+
(0, _sessionCookieStore.clearSession)(options);
|
|
124
124
|
synchronizeSession({});
|
|
125
125
|
},
|
|
126
126
|
stop: function stop() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionStore.js","names":["_cookie","require","_observable","_tools","_sessionConstants","_sessionCookieStore","_timer","startSessionStore","options","productKey","computeSessionState","renewObservable","Observable","expireObservable","watchSessionTimeoutId","setInterval","watchSession","COOKIE_ACCESS_DELAY","sessionCache","retrieveActiveSession","expandOrRenewSession","isTracked","withCookieLockAccess","process","cookieSession","synchronizedSession","synchronizeSession","expandOrRenewCookie","after","hasSessionInCache","renewSession","expandSession","undefined","isActiveSession","isSessionInCacheOutdated","expireSessionInCache","sessionState","trackingType","id","UUID","created","String","dateNow","notify","session","retrieveSession","Number","SESSION_TIME_OUT_DELAY","expire","throttle","throttled","getSession","
|
|
1
|
+
{"version":3,"file":"sessionStore.js","names":["_cookie","require","_observable","_tools","_sessionConstants","_sessionCookieStore","_timer","startSessionStore","options","productKey","computeSessionState","renewObservable","Observable","expireObservable","watchSessionTimeoutId","setInterval","watchSession","COOKIE_ACCESS_DELAY","sessionCache","retrieveActiveSession","expandOrRenewSession","isTracked","withCookieLockAccess","process","cookieSession","synchronizedSession","synchronizeSession","expandOrRenewCookie","after","hasSessionInCache","renewSession","expandSession","undefined","isActiveSession","isSessionInCacheOutdated","expireSessionInCache","sessionState","trackingType","id","UUID","created","String","dateNow","notify","session","retrieveSession","Number","SESSION_TIME_OUT_DELAY","expire","throttle","throttled","getSession","clearSession","stop","clearInterval"],"sources":["../../src/session/sessionStore.js"],"sourcesContent":["import { COOKIE_ACCESS_DELAY } from '../browser/cookie'\nimport { Observable } from '../helper/observable'\nimport { dateNow, UUID, throttle } from '../helper/tools'\nimport { SESSION_TIME_OUT_DELAY } from './sessionConstants'\nimport {\n retrieveSession,\n withCookieLockAccess,\n clearSession\n} from './sessionCookieStore'\nimport { clearInterval, setInterval } from '../helper/timer'\n\n/**\n * Different session concepts:\n * - tracked, the session has an id and is updated along the user navigation\n * - not tracked, the session does not have an id but it is updated along the user navigation\n * - inactive, no session in store or session expired, waiting for a renew session\n */\nexport function startSessionStore(options, productKey, computeSessionState) {\n var renewObservable = new Observable()\n var expireObservable = new Observable()\n\n var watchSessionTimeoutId = setInterval(watchSession, COOKIE_ACCESS_DELAY)\n var sessionCache = retrieveActiveSession()\n\n function expandOrRenewSession() {\n var isTracked\n withCookieLockAccess({\n options: options,\n process: function (cookieSession) {\n var synchronizedSession = synchronizeSession(cookieSession)\n isTracked = expandOrRenewCookie(synchronizedSession)\n return synchronizedSession\n },\n after: function (cookieSession) {\n if (isTracked && !hasSessionInCache()) {\n renewSession(cookieSession)\n }\n sessionCache = cookieSession\n }\n })\n }\n\n function expandSession() {\n withCookieLockAccess({\n options: options,\n process: function (cookieSession) {\n return hasSessionInCache()\n ? synchronizeSession(cookieSession)\n : undefined\n }\n })\n }\n\n /**\n * allows two behaviors:\n * - if the session is active, synchronize the session cache without updating the session cookie\n * - if the session is not active, clear the session cookie and expire the session cache\n */\n function watchSession() {\n withCookieLockAccess({\n options: options,\n process: function (cookieSession) {\n return !isActiveSession(cookieSession) ? {} : undefined\n },\n after: synchronizeSession\n })\n }\n\n function synchronizeSession(cookieSession) {\n if (!isActiveSession(cookieSession)) {\n cookieSession = {}\n }\n if (hasSessionInCache()) {\n if (isSessionInCacheOutdated(cookieSession)) {\n expireSessionInCache()\n } else {\n sessionCache = cookieSession\n }\n }\n return cookieSession\n }\n\n function expandOrRenewCookie(cookieSession) {\n var sessionState = computeSessionState(cookieSession[productKey])\n var trackingType = sessionState.trackingType\n var isTracked = sessionState.isTracked\n cookieSession[productKey] = trackingType\n if (isTracked && !cookieSession.id) {\n cookieSession.id = UUID()\n cookieSession.created = String(dateNow())\n }\n return isTracked\n }\n\n function hasSessionInCache() {\n return sessionCache[productKey] !== undefined\n }\n\n function isSessionInCacheOutdated(cookieSession) {\n return (\n sessionCache.id !== cookieSession.id ||\n sessionCache[productKey] !== cookieSession[productKey]\n )\n }\n\n function expireSessionInCache() {\n sessionCache = {}\n expireObservable.notify()\n }\n\n function renewSession(cookieSession) {\n sessionCache = cookieSession\n renewObservable.notify()\n }\n\n function retrieveActiveSession() {\n var session = retrieveSession()\n if (isActiveSession(session)) {\n return session\n }\n return {}\n }\n\n function isActiveSession(session) {\n // created and expire can be undefined for versions which was not storing them\n // these checks could be removed when older versions will not be available/live anymore\n return (\n (session.created === undefined ||\n dateNow() - Number(session.created) < SESSION_TIME_OUT_DELAY) &&\n (session.expire === undefined || dateNow() < Number(session.expire))\n )\n }\n\n return {\n expandOrRenewSession: throttle(expandOrRenewSession, COOKIE_ACCESS_DELAY)\n .throttled,\n expandSession: expandSession,\n getSession: function () {\n return sessionCache\n },\n renewObservable: renewObservable,\n expireObservable: expireObservable,\n expire: function () {\n clearSession(options)\n synchronizeSession({})\n },\n stop: function () {\n clearInterval(watchSessionTimeoutId)\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,iBAAiBA,CAACC,OAAO,EAAEC,UAAU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YAAYA,CAACN,aAAa,EAAE;IACnCN,YAAY,GAAGM,aAAa;IAC5Bb,eAAe,CAACgC,MAAM,CAAC,CAAC;EAC1B;EAEA,SAASxB,qBAAqBA,CAAA,EAAG;IAC/B,IAAIyB,OAAO,GAAG,IAAAC,mCAAe,EAAC,CAAC;IAC/B,IAAIZ,eAAe,CAACW,OAAO,CAAC,EAAE;MAC5B,OAAOA,OAAO;IAChB;IACA,OAAO,CAAC,CAAC;EACX;EAEA,SAASX,eAAeA,CAACW,OAAO,EAAE;IAChC;IACA;IACA,OACE,CAACA,OAAO,CAACJ,OAAO,KAAKR,SAAS,IAC5B,IAAAU,cAAO,EAAC,CAAC,GAAGI,MAAM,CAACF,OAAO,CAACJ,OAAO,CAAC,GAAGO,wCAAsB,MAC7DH,OAAO,CAACI,MAAM,KAAKhB,SAAS,IAAI,IAAAU,cAAO,EAAC,CAAC,GAAGI,MAAM,CAACF,OAAO,CAACI,MAAM,CAAC,CAAC;EAExE;EAEA,OAAO;IACL5B,oBAAoB,EAAE,IAAA6B,eAAQ,EAAC7B,oBAAoB,EAAEH,2BAAmB,CAAC,CACtEiC,SAAS;IACZnB,aAAa,EAAEA,aAAa;IAC5BoB,UAAU,EAAE,SAAAA,WAAA,EAAY;MACtB,OAAOjC,YAAY;IACrB,CAAC;IACDP,eAAe,EAAEA,eAAe;IAChCE,gBAAgB,EAAEA,gBAAgB;IAClCmC,MAAM,EAAE,SAAAA,OAAA,EAAY;MAClB,IAAAI,gCAAY,EAAC5C,OAAO,CAAC;MACrBkB,kBAAkB,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IACD2B,IAAI,EAAE,SAAAA,KAAA,EAAY;MAChB,IAAAC,oBAAa,EAACxC,qBAAqB,CAAC;IACtC;EACF,CAAC;AACH"}
|
package/esm/dataMap.js
CHANGED
|
@@ -29,10 +29,10 @@ export var commonTags = {
|
|
|
29
29
|
view_path: 'view.path',
|
|
30
30
|
view_name: 'view.path',
|
|
31
31
|
// 冗余一个字段
|
|
32
|
-
view_path_group: 'view.path_group'
|
|
33
|
-
view_url_query: 'view.url_query'
|
|
32
|
+
view_path_group: 'view.path_group'
|
|
34
33
|
};
|
|
35
34
|
export var commonFields = {
|
|
35
|
+
view_url_query: 'view.url_query',
|
|
36
36
|
action_id: 'action.id',
|
|
37
37
|
action_ids: 'action.ids',
|
|
38
38
|
view_in_foreground: 'view.in_foreground',
|
package/esm/dataMap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataMap.js","names":["RumEventType","commonTags","sdk_name","sdk_version","app_id","env","service","version","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","view_url_query","commonFields","action_id","action_ids","view_in_foreground","display","session_has_replay","is_login","page_states","dataMap","view","type","VIEW","tags","view_loading_type","view_apdex_level","view_privacy_replay_level","fields","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_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_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_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","long_task","LONG_TASK","long_task_id","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 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 view_url_query: 'view.url_query'\n}\nexport var commonFields = {\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}\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 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_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_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.encode_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 }\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 }\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 }\n }\n}\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,OAAO,IAAIC,UAAU,GAAG;EACtBC,QAAQ,EAAE,cAA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names":["RumEventType","commonTags","sdk_name","sdk_version","app_id","env","service","version","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","commonFields","view_url_query","action_id","action_ids","view_in_foreground","display","session_has_replay","is_login","page_states","dataMap","view","type","VIEW","tags","view_loading_type","view_apdex_level","view_privacy_replay_level","fields","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_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_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_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","long_task","LONG_TASK","long_task_id","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 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}\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 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_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_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.encode_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 }\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 }\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 }\n }\n}\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,OAAO,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,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,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wB;MAChDC,aAAa,EAAE,mBAAmB;MAClCC,eAAe,EAAE;IACnB;EACF,CAAC;EACDC,SAAS,EAAE;IACT1F,IAAI,EAAE,WAAW;IACjBM,MAAM,EAAE;MACNqF,MAAM,EAAE,kBAAkB;MAC1BC,OAAO,EAAE,CAAC,QAAQ,EAAE,mBAAmB,CAAC;MACxC5F,IAAI,EAAE,gBAAgB;MACtB2E,WAAW,EAAE,CAAC,QAAQ,EAAE,uBAAuB,CAAC;MAChDkB,UAAU,EAAE,CAAC,QAAQ,EAAE,sBAAsB;IAC/C;EACF,CAAC;EACDC,WAAW,EAAE;IACX9F,IAAI,EAAE1C,YAAY,CAACyI,MAAM;IACzB7F,IAAI,EAAE;MACJqE,YAAY,EAAE,cAAc;MAC5BC,UAAU,EAAE,YAAY;MACxBwB,kBAAkB,EAAE,UAAU;MAC9BC,uBAAuB,EAAE,eAAe;MACxCC,uBAAuB,EAAE,eAAe;MACxCC,6BAA6B,EAAE,qBAAqB;MACpDC,qBAAqB,EAAE,kBAAkB;MACzCC,2BAA2B,EAAE,mBAAmB;MAChDC,qBAAqB,EAAE,aAAa;MACpC/G,SAAS,EAAE,gBAAgB;MAC3B3B,OAAO,EAAE,SAAS;MAClB+H,MAAM,EAAE;IACV,CAAC;IACDrF,MAAM,EAAE;MACNsF,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS;IAC/B;EACF;AACF,CAAC"}
|
|
@@ -136,7 +136,7 @@ function isValidSessionString(sessionString) {
|
|
|
136
136
|
function isExpiredState(session) {
|
|
137
137
|
return isEmptyObject(session);
|
|
138
138
|
}
|
|
139
|
-
function clearSession(options) {
|
|
139
|
+
export function clearSession(options) {
|
|
140
140
|
setCookie(SESSION_COOKIE_NAME, '', 0, options);
|
|
141
141
|
}
|
|
142
142
|
//# sourceMappingURL=sessionCookieStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionCookieStore.js","names":["getCookie","setCookie","isChromium","dateNow","isEmptyObject","UUID","objectEntries","map","each","SESSION_EXPIRATION_DELAY","setTimeout","SESSION_ENTRY_REGEXP","SESSION_ENTRY_SEPARATOR","SESSION_COOKIE_NAME","LOCK_RETRY_DELAY","MAX_NUMBER_OF_LOCK_RETRIES","bufferedOperations","ongoingOperations","withCookieLockAccess","operations","numberOfRetries","push","next","currentLock","currentSession","retrieveSession","isCookieLockEnabled","lock","retryLater","setSession","options","processedSession","process","persistSession","isExpiredState","after","currentNumberOfRetries","undefined","nextOperations","shift","session","clearSession","expire","String","toSessionString","item","join","sessionString","isValidSessionString","split","entry","matches","exec","key","value","indexOf","test"],"sources":["../../src/session/sessionCookieStore.js"],"sourcesContent":["import { getCookie, setCookie } from '../browser/cookie'\nimport {\n isChromium,\n dateNow,\n isEmptyObject,\n UUID,\n objectEntries,\n map,\n each\n} from '../helper/tools'\nimport { SESSION_EXPIRATION_DELAY } from './sessionConstants'\nimport { setTimeout } from '../helper/timer'\nvar SESSION_ENTRY_REGEXP = /^([a-z]+)=([a-z0-9-]+)$/\nvar SESSION_ENTRY_SEPARATOR = '&'\n\nexport var SESSION_COOKIE_NAME = '_dataflux_s'\n\n// arbitrary values\nexport var LOCK_RETRY_DELAY = 10\nexport var MAX_NUMBER_OF_LOCK_RETRIES = 100\n\nvar bufferedOperations = []\nvar ongoingOperations\n\nexport function withCookieLockAccess(operations, numberOfRetries) {\n if (typeof numberOfRetries === 'undefined') {\n numberOfRetries = 0\n }\n if (!ongoingOperations) {\n ongoingOperations = operations\n }\n if (operations !== ongoingOperations) {\n bufferedOperations.push(operations)\n return\n }\n if (numberOfRetries >= MAX_NUMBER_OF_LOCK_RETRIES) {\n next()\n return\n }\n var currentLock\n var currentSession = retrieveSession()\n if (isCookieLockEnabled()) {\n // if someone has lock, retry later\n if (currentSession.lock) {\n retryLater(operations, numberOfRetries)\n return\n }\n // acquire lock\n currentLock = UUID()\n currentSession.lock = currentLock\n setSession(currentSession, operations.options)\n // if lock is not acquired, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n var processedSession = operations.process(currentSession)\n if (isCookieLockEnabled()) {\n // if lock corrupted after process, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n if (processedSession) {\n persistSession(processedSession, operations.options)\n }\n if (isCookieLockEnabled()) {\n // correctly handle lock around expiration would require to handle this case properly at several levels\n // since we don't have evidence of lock issues around expiration, let's just not do the corruption check for it\n if (!(processedSession && isExpiredState(processedSession))) {\n // if lock corrupted after persist, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n delete currentSession.lock\n setSession(currentSession, operations.options)\n processedSession = currentSession\n }\n }\n // call after even if session is not persisted in order to perform operations on\n // up-to-date cookie value, the value could have been modified by another tab\n if (operations.after) {\n operations.after(processedSession || currentSession)\n }\n next()\n}\n\n/**\n * Cookie lock strategy allows mitigating issues due to concurrent access to cookie.\n * This issue concerns only chromium browsers and enabling this on firefox increase cookie write failures.\n */\nfunction isCookieLockEnabled() {\n return isChromium()\n}\n\nfunction retryLater(operations, currentNumberOfRetries) {\n setTimeout(function () {\n withCookieLockAccess(operations, currentNumberOfRetries + 1)\n }, LOCK_RETRY_DELAY)\n}\n\nfunction next() {\n ongoingOperations = undefined\n var nextOperations = bufferedOperations.shift()\n if (nextOperations) {\n withCookieLockAccess(nextOperations)\n }\n}\n\nexport function persistSession(session, options) {\n if (isExpiredState(session)) {\n clearSession(options)\n return\n }\n session.expire = String(dateNow() + SESSION_EXPIRATION_DELAY)\n setSession(session, options)\n}\n\nfunction setSession(session, options) {\n setCookie(\n SESSION_COOKIE_NAME,\n toSessionString(session),\n SESSION_EXPIRATION_DELAY,\n options\n )\n}\n\nexport function toSessionString(session) {\n return map(objectEntries(session), function (item) {\n return item[0] + '=' + item[1]\n }).join(SESSION_ENTRY_SEPARATOR)\n}\n\nexport function retrieveSession() {\n var sessionString = getCookie(SESSION_COOKIE_NAME)\n var session = {}\n if (isValidSessionString(sessionString)) {\n each(sessionString.split(SESSION_ENTRY_SEPARATOR), function (entry) {\n var matches = SESSION_ENTRY_REGEXP.exec(entry)\n if (matches !== null) {\n var key = matches[1]\n var value = matches[2]\n session[key] = value\n }\n })\n }\n return session\n}\n\nfunction isValidSessionString(sessionString) {\n return (\n sessionString !== undefined &&\n (sessionString.indexOf(SESSION_ENTRY_SEPARATOR) !== -1 ||\n SESSION_ENTRY_REGEXP.test(sessionString))\n )\n}\n\nfunction isExpiredState(session) {\n return isEmptyObject(session)\n}\
|
|
1
|
+
{"version":3,"file":"sessionCookieStore.js","names":["getCookie","setCookie","isChromium","dateNow","isEmptyObject","UUID","objectEntries","map","each","SESSION_EXPIRATION_DELAY","setTimeout","SESSION_ENTRY_REGEXP","SESSION_ENTRY_SEPARATOR","SESSION_COOKIE_NAME","LOCK_RETRY_DELAY","MAX_NUMBER_OF_LOCK_RETRIES","bufferedOperations","ongoingOperations","withCookieLockAccess","operations","numberOfRetries","push","next","currentLock","currentSession","retrieveSession","isCookieLockEnabled","lock","retryLater","setSession","options","processedSession","process","persistSession","isExpiredState","after","currentNumberOfRetries","undefined","nextOperations","shift","session","clearSession","expire","String","toSessionString","item","join","sessionString","isValidSessionString","split","entry","matches","exec","key","value","indexOf","test"],"sources":["../../src/session/sessionCookieStore.js"],"sourcesContent":["import { getCookie, setCookie } from '../browser/cookie'\nimport {\n isChromium,\n dateNow,\n isEmptyObject,\n UUID,\n objectEntries,\n map,\n each\n} from '../helper/tools'\nimport { SESSION_EXPIRATION_DELAY } from './sessionConstants'\nimport { setTimeout } from '../helper/timer'\nvar SESSION_ENTRY_REGEXP = /^([a-z]+)=([a-z0-9-]+)$/\nvar SESSION_ENTRY_SEPARATOR = '&'\n\nexport var SESSION_COOKIE_NAME = '_dataflux_s'\n\n// arbitrary values\nexport var LOCK_RETRY_DELAY = 10\nexport var MAX_NUMBER_OF_LOCK_RETRIES = 100\n\nvar bufferedOperations = []\nvar ongoingOperations\n\nexport function withCookieLockAccess(operations, numberOfRetries) {\n if (typeof numberOfRetries === 'undefined') {\n numberOfRetries = 0\n }\n if (!ongoingOperations) {\n ongoingOperations = operations\n }\n if (operations !== ongoingOperations) {\n bufferedOperations.push(operations)\n return\n }\n if (numberOfRetries >= MAX_NUMBER_OF_LOCK_RETRIES) {\n next()\n return\n }\n var currentLock\n var currentSession = retrieveSession()\n if (isCookieLockEnabled()) {\n // if someone has lock, retry later\n if (currentSession.lock) {\n retryLater(operations, numberOfRetries)\n return\n }\n // acquire lock\n currentLock = UUID()\n currentSession.lock = currentLock\n setSession(currentSession, operations.options)\n // if lock is not acquired, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n var processedSession = operations.process(currentSession)\n if (isCookieLockEnabled()) {\n // if lock corrupted after process, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n if (processedSession) {\n persistSession(processedSession, operations.options)\n }\n if (isCookieLockEnabled()) {\n // correctly handle lock around expiration would require to handle this case properly at several levels\n // since we don't have evidence of lock issues around expiration, let's just not do the corruption check for it\n if (!(processedSession && isExpiredState(processedSession))) {\n // if lock corrupted after persist, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n delete currentSession.lock\n setSession(currentSession, operations.options)\n processedSession = currentSession\n }\n }\n // call after even if session is not persisted in order to perform operations on\n // up-to-date cookie value, the value could have been modified by another tab\n if (operations.after) {\n operations.after(processedSession || currentSession)\n }\n next()\n}\n\n/**\n * Cookie lock strategy allows mitigating issues due to concurrent access to cookie.\n * This issue concerns only chromium browsers and enabling this on firefox increase cookie write failures.\n */\nfunction isCookieLockEnabled() {\n return isChromium()\n}\n\nfunction retryLater(operations, currentNumberOfRetries) {\n setTimeout(function () {\n withCookieLockAccess(operations, currentNumberOfRetries + 1)\n }, LOCK_RETRY_DELAY)\n}\n\nfunction next() {\n ongoingOperations = undefined\n var nextOperations = bufferedOperations.shift()\n if (nextOperations) {\n withCookieLockAccess(nextOperations)\n }\n}\n\nexport function persistSession(session, options) {\n if (isExpiredState(session)) {\n clearSession(options)\n return\n }\n session.expire = String(dateNow() + SESSION_EXPIRATION_DELAY)\n setSession(session, options)\n}\n\nfunction setSession(session, options) {\n setCookie(\n SESSION_COOKIE_NAME,\n toSessionString(session),\n SESSION_EXPIRATION_DELAY,\n options\n )\n}\n\nexport function toSessionString(session) {\n return map(objectEntries(session), function (item) {\n return item[0] + '=' + item[1]\n }).join(SESSION_ENTRY_SEPARATOR)\n}\n\nexport function retrieveSession() {\n var sessionString = getCookie(SESSION_COOKIE_NAME)\n var session = {}\n if (isValidSessionString(sessionString)) {\n each(sessionString.split(SESSION_ENTRY_SEPARATOR), function (entry) {\n var matches = SESSION_ENTRY_REGEXP.exec(entry)\n if (matches !== null) {\n var key = matches[1]\n var value = matches[2]\n session[key] = value\n }\n })\n }\n return session\n}\n\nfunction isValidSessionString(sessionString) {\n return (\n sessionString !== undefined &&\n (sessionString.indexOf(SESSION_ENTRY_SEPARATOR) !== -1 ||\n SESSION_ENTRY_REGEXP.test(sessionString))\n )\n}\n\nfunction isExpiredState(session) {\n return isEmptyObject(session)\n}\nexport function clearSession(options) {\n setCookie(SESSION_COOKIE_NAME, '', 0, options)\n}\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,SAAS,QAAQ,mBAAmB;AACxD,SACEC,UAAU,EACVC,OAAO,EACPC,aAAa,EACbC,IAAI,EACJC,aAAa,EACbC,GAAG,EACHC,IAAI,QACC,iBAAiB;AACxB,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,IAAIC,oBAAoB,GAAG,yBAAyB;AACpD,IAAIC,uBAAuB,GAAG,GAAG;AAEjC,OAAO,IAAIC,mBAAmB,GAAG,aAAa;;A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C,OACEA,aAAa,KAAKV,SAAS,KAC1BU,aAAa,CAACQ,OAAO,CAAC3C,uBAAuB,CAAC,KAAK,CAAC,CAAC,IACpDD,oBAAoB,CAAC6C,IAAI,CAACT,aAAa,CAAC,CAAC;AAE/C;AAEA,SAASb,cAAcA,CAACM,OAAO,EAAE;EAC/B,OAAOpC,aAAa,CAACoC,OAAO,CAAC;AAC/B;AACA,OAAO,SAASC,YAAYA,CAACX,OAAO,EAAE;EACpC7B,SAAS,CAACY,mBAAmB,EAAE,EAAE,EAAE,CAAC,EAAEiB,OAAO,CAAC;AAChD"}
|
|
@@ -2,7 +2,7 @@ import { COOKIE_ACCESS_DELAY } from '../browser/cookie';
|
|
|
2
2
|
import { Observable } from '../helper/observable';
|
|
3
3
|
import { dateNow, UUID, throttle } from '../helper/tools';
|
|
4
4
|
import { SESSION_TIME_OUT_DELAY } from './sessionConstants';
|
|
5
|
-
import { retrieveSession, withCookieLockAccess } from './sessionCookieStore';
|
|
5
|
+
import { retrieveSession, withCookieLockAccess, clearSession } from './sessionCookieStore';
|
|
6
6
|
import { clearInterval, setInterval } from '../helper/timer';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -115,7 +115,7 @@ export function startSessionStore(options, productKey, computeSessionState) {
|
|
|
115
115
|
renewObservable: renewObservable,
|
|
116
116
|
expireObservable: expireObservable,
|
|
117
117
|
expire: function expire() {
|
|
118
|
-
|
|
118
|
+
clearSession(options);
|
|
119
119
|
synchronizeSession({});
|
|
120
120
|
},
|
|
121
121
|
stop: function stop() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionStore.js","names":["COOKIE_ACCESS_DELAY","Observable","dateNow","UUID","throttle","SESSION_TIME_OUT_DELAY","retrieveSession","withCookieLockAccess","clearInterval","setInterval","startSessionStore","options","productKey","computeSessionState","renewObservable","expireObservable","watchSessionTimeoutId","watchSession","sessionCache","retrieveActiveSession","expandOrRenewSession","isTracked","process","cookieSession","synchronizedSession","synchronizeSession","expandOrRenewCookie","after","hasSessionInCache","renewSession","expandSession","undefined","isActiveSession","isSessionInCacheOutdated","expireSessionInCache","sessionState","trackingType","id","created","String","notify","session","Number","expire","throttled","getSession","
|
|
1
|
+
{"version":3,"file":"sessionStore.js","names":["COOKIE_ACCESS_DELAY","Observable","dateNow","UUID","throttle","SESSION_TIME_OUT_DELAY","retrieveSession","withCookieLockAccess","clearSession","clearInterval","setInterval","startSessionStore","options","productKey","computeSessionState","renewObservable","expireObservable","watchSessionTimeoutId","watchSession","sessionCache","retrieveActiveSession","expandOrRenewSession","isTracked","process","cookieSession","synchronizedSession","synchronizeSession","expandOrRenewCookie","after","hasSessionInCache","renewSession","expandSession","undefined","isActiveSession","isSessionInCacheOutdated","expireSessionInCache","sessionState","trackingType","id","created","String","notify","session","Number","expire","throttled","getSession","stop"],"sources":["../../src/session/sessionStore.js"],"sourcesContent":["import { COOKIE_ACCESS_DELAY } from '../browser/cookie'\nimport { Observable } from '../helper/observable'\nimport { dateNow, UUID, throttle } from '../helper/tools'\nimport { SESSION_TIME_OUT_DELAY } from './sessionConstants'\nimport {\n retrieveSession,\n withCookieLockAccess,\n clearSession\n} from './sessionCookieStore'\nimport { clearInterval, setInterval } from '../helper/timer'\n\n/**\n * Different session concepts:\n * - tracked, the session has an id and is updated along the user navigation\n * - not tracked, the session does not have an id but it is updated along the user navigation\n * - inactive, no session in store or session expired, waiting for a renew session\n */\nexport function startSessionStore(options, productKey, computeSessionState) {\n var renewObservable = new Observable()\n var expireObservable = new Observable()\n\n var watchSessionTimeoutId = setInterval(watchSession, COOKIE_ACCESS_DELAY)\n var sessionCache = retrieveActiveSession()\n\n function expandOrRenewSession() {\n var isTracked\n withCookieLockAccess({\n options: options,\n process: function (cookieSession) {\n var synchronizedSession = synchronizeSession(cookieSession)\n isTracked = expandOrRenewCookie(synchronizedSession)\n return synchronizedSession\n },\n after: function (cookieSession) {\n if (isTracked && !hasSessionInCache()) {\n renewSession(cookieSession)\n }\n sessionCache = cookieSession\n }\n })\n }\n\n function expandSession() {\n withCookieLockAccess({\n options: options,\n process: function (cookieSession) {\n return hasSessionInCache()\n ? synchronizeSession(cookieSession)\n : undefined\n }\n })\n }\n\n /**\n * allows two behaviors:\n * - if the session is active, synchronize the session cache without updating the session cookie\n * - if the session is not active, clear the session cookie and expire the session cache\n */\n function watchSession() {\n withCookieLockAccess({\n options: options,\n process: function (cookieSession) {\n return !isActiveSession(cookieSession) ? {} : undefined\n },\n after: synchronizeSession\n })\n }\n\n function synchronizeSession(cookieSession) {\n if (!isActiveSession(cookieSession)) {\n cookieSession = {}\n }\n if (hasSessionInCache()) {\n if (isSessionInCacheOutdated(cookieSession)) {\n expireSessionInCache()\n } else {\n sessionCache = cookieSession\n }\n }\n return cookieSession\n }\n\n function expandOrRenewCookie(cookieSession) {\n var sessionState = computeSessionState(cookieSession[productKey])\n var trackingType = sessionState.trackingType\n var isTracked = sessionState.isTracked\n cookieSession[productKey] = trackingType\n if (isTracked && !cookieSession.id) {\n cookieSession.id = UUID()\n cookieSession.created = String(dateNow())\n }\n return isTracked\n }\n\n function hasSessionInCache() {\n return sessionCache[productKey] !== undefined\n }\n\n function isSessionInCacheOutdated(cookieSession) {\n return (\n sessionCache.id !== cookieSession.id ||\n sessionCache[productKey] !== cookieSession[productKey]\n )\n }\n\n function expireSessionInCache() {\n sessionCache = {}\n expireObservable.notify()\n }\n\n function renewSession(cookieSession) {\n sessionCache = cookieSession\n renewObservable.notify()\n }\n\n function retrieveActiveSession() {\n var session = retrieveSession()\n if (isActiveSession(session)) {\n return session\n }\n return {}\n }\n\n function isActiveSession(session) {\n // created and expire can be undefined for versions which was not storing them\n // these checks could be removed when older versions will not be available/live anymore\n return (\n (session.created === undefined ||\n dateNow() - Number(session.created) < SESSION_TIME_OUT_DELAY) &&\n (session.expire === undefined || dateNow() < Number(session.expire))\n )\n }\n\n return {\n expandOrRenewSession: throttle(expandOrRenewSession, COOKIE_ACCESS_DELAY)\n .throttled,\n expandSession: expandSession,\n getSession: function () {\n return sessionCache\n },\n renewObservable: renewObservable,\n expireObservable: expireObservable,\n expire: function () {\n clearSession(options)\n synchronizeSession({})\n },\n stop: function () {\n clearInterval(watchSessionTimeoutId)\n }\n }\n}\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,mBAAmB;AACvD,SAASC,UAAU,QAAQ,sBAAsB;AACjD,SAASC,OAAO,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,iBAAiB;AACzD,SAASC,sBAAsB,QAAQ,oBAAoB;AAC3D,SACEC,eAAe,EACfC,oBAAoB,EACpBC,YAAY,QACP,sBAAsB;AAC7B,SAASC,aAAa,EAAEC,WAAW,QAAQ,iBAAiB;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,OAAO,EAAEC,UAAU,EAAEC,mBAAmB,EAAE;EAC1E,IAAIC,eAAe,GAAG,IAAId,UAAU,CAAC,CAAC;EACtC,IAAIe,gBAAgB,GAAG,IAAIf,UAAU,CAAC,CAAC;EAEvC,IAAIgB,qBAAqB,GAAGP,WAAW,CAACQ,YAAY,EAAElB,mBAAmB,CAAC;EAC1E,IAAImB,YAAY,GAAGC,qBAAqB,CAAC,CAAC;EAE1C,SAASC,oBAAoBA,CAAA,EAAG;IAC9B,IAAIC,SAAS;IACbf,oBAAoB,CAAC;MACnBK,OAAO,EAAEA,OAAO;MAChBW,OAAO,EAAE,SAAAA,QAAUC,aAAa,EAAE;QAChC,IAAIC,mBAAmB,GAAGC,kBAAkB,CAACF,aAAa,CAAC;QAC3DF,SAAS,GAAGK,mBAAmB,CAACF,mBAAmB,CAAC;QACpD,OAAOA,mBAAmB;MAC5B,CAAC;MACDG,KAAK,EAAE,SAAAA,MAAUJ,aAAa,EAAE;QAC9B,IAAIF,SAAS,IAAI,CAACO,iBAAiB,CAAC,CAAC,EAAE;UACrCC,YAAY,CAACN,aAAa,CAAC;QAC7B;QACAL,YAAY,GAAGK,aAAa;MAC9B;IACF,CAAC,CAAC;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;IACrB,CAAC;IACDJ,eAAe,EAAEA,eAAe;IAChCC,gBAAgB,EAAEA,gBAAgB;IAClC4B,MAAM,EAAE,SAAAA,OAAA,EAAY;MAClBpC,YAAY,CAACI,OAAO,CAAC;MACrBc,kBAAkB,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IACDqB,IAAI,EAAE,SAAAA,KAAA,EAAY;MAChBtC,aAAa,CAACQ,qBAAqB,CAAC;IACtC;EACF,CAAC;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcare/browser-core",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.7",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"author": "dataflux",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"description": "DataFlux RUM Web 端数据指标监控",
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "4093a664f46522339538f008980660cdc772bd39"
|
|
24
24
|
}
|
package/src/dataMap.js
CHANGED
|
@@ -28,10 +28,10 @@ export var commonTags = {
|
|
|
28
28
|
view_host: 'view.host',
|
|
29
29
|
view_path: 'view.path',
|
|
30
30
|
view_name: 'view.path', // 冗余一个字段
|
|
31
|
-
view_path_group: 'view.path_group'
|
|
32
|
-
view_url_query: 'view.url_query'
|
|
31
|
+
view_path_group: 'view.path_group'
|
|
33
32
|
}
|
|
34
33
|
export var commonFields = {
|
|
34
|
+
view_url_query: 'view.url_query',
|
|
35
35
|
action_id: 'action.id',
|
|
36
36
|
action_ids: 'action.ids',
|
|
37
37
|
view_in_foreground: 'view.in_foreground',
|
|
@@ -164,6 +164,6 @@ function isValidSessionString(sessionString) {
|
|
|
164
164
|
function isExpiredState(session) {
|
|
165
165
|
return isEmptyObject(session)
|
|
166
166
|
}
|
|
167
|
-
function clearSession(options) {
|
|
167
|
+
export function clearSession(options) {
|
|
168
168
|
setCookie(SESSION_COOKIE_NAME, '', 0, options)
|
|
169
169
|
}
|
|
@@ -2,7 +2,11 @@ import { COOKIE_ACCESS_DELAY } from '../browser/cookie'
|
|
|
2
2
|
import { Observable } from '../helper/observable'
|
|
3
3
|
import { dateNow, UUID, throttle } from '../helper/tools'
|
|
4
4
|
import { SESSION_TIME_OUT_DELAY } from './sessionConstants'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
retrieveSession,
|
|
7
|
+
withCookieLockAccess,
|
|
8
|
+
clearSession
|
|
9
|
+
} from './sessionCookieStore'
|
|
6
10
|
import { clearInterval, setInterval } from '../helper/timer'
|
|
7
11
|
|
|
8
12
|
/**
|
|
@@ -137,7 +141,7 @@ export function startSessionStore(options, productKey, computeSessionState) {
|
|
|
137
141
|
renewObservable: renewObservable,
|
|
138
142
|
expireObservable: expireObservable,
|
|
139
143
|
expire: function () {
|
|
140
|
-
|
|
144
|
+
clearSession(options)
|
|
141
145
|
synchronizeSession({})
|
|
142
146
|
},
|
|
143
147
|
stop: function () {
|