@tracelog/lib 2.2.0 → 2.2.1

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.
@@ -2425,7 +2425,6 @@ declare const MAX_CUSTOM_EVENT_STRING_SIZE: number;
2425
2425
  declare const MAX_CUSTOM_EVENT_KEYS = 10;
2426
2426
  declare const MAX_CUSTOM_EVENT_ARRAY_SIZE = 10;
2427
2427
  declare const MAX_NESTED_OBJECT_KEYS = 20;
2428
- declare const MAX_METADATA_NESTING_DEPTH = 1;
2429
2428
  declare const MAX_STRING_LENGTH = 1000;
2430
2429
  declare const MAX_STRING_LENGTH_IN_ARRAY = 500;
2431
2430
  declare const MAX_ARRAY_LENGTH = 100;
@@ -2490,4 +2489,4 @@ declare const tracelog: {
2490
2489
  mergeGlobalMetadata: (metadata: Record<string, MetadataType>) => void;
2491
2490
  };
2492
2491
 
2493
- export { AppConfigValidationError, type BeforeBatchTransformer, type BeforeSendTransformer, type ClickCoordinates, type ClickData, type ClickTrackingElementData, type Config, type CustomEventData, type CustomHeadersProvider, DEFAULT_SESSION_TIMEOUT, DEFAULT_WEB_VITALS_MODE, type DeviceInfo, DeviceType, type EmitterCallback, EmitterEvent, type EmitterMap, type ErrorData, ErrorType, type EventData, EventType, type EventTypeName, type EventsQueue, InitializationTimeoutError, IntegrationValidationError, MAX_ARRAY_LENGTH, MAX_CUSTOM_EVENT_ARRAY_SIZE, MAX_CUSTOM_EVENT_KEYS, MAX_CUSTOM_EVENT_NAME_LENGTH, MAX_CUSTOM_EVENT_STRING_SIZE, MAX_METADATA_NESTING_DEPTH, MAX_NESTED_OBJECT_KEYS, MAX_STRING_LENGTH, MAX_STRING_LENGTH_IN_ARRAY, type MetadataType, Mode, PII_PATTERNS, type PageViewData, PermanentError, type PersistedEventsQueue, type PrimaryScrollEvent, SamplingRateValidationError, type ScrollData, ScrollDirection, type SecondaryScrollEvent, type SessionEventCounts, SessionTimeoutValidationError, SpecialApiUrl, type State, type TraceLogTestBridge, TraceLogValidationError, type TransformerHook, type TransformerMap, type UTM, type ViewportConfig, type ViewportElement, type ViewportEventData, WEB_VITALS_GOOD_THRESHOLDS, WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS, WEB_VITALS_POOR_THRESHOLDS, type WebVitalType, type WebVitalsData, type WebVitalsMode, getWebVitalsThresholds, isPrimaryScrollEvent, isSecondaryScrollEvent, tracelog };
2492
+ export { AppConfigValidationError, type BeforeBatchTransformer, type BeforeSendTransformer, type ClickCoordinates, type ClickData, type ClickTrackingElementData, type Config, type CustomEventData, type CustomHeadersProvider, DEFAULT_SESSION_TIMEOUT, DEFAULT_WEB_VITALS_MODE, type DeviceInfo, DeviceType, type EmitterCallback, EmitterEvent, type EmitterMap, type ErrorData, ErrorType, type EventData, EventType, type EventTypeName, type EventsQueue, InitializationTimeoutError, IntegrationValidationError, MAX_ARRAY_LENGTH, MAX_CUSTOM_EVENT_ARRAY_SIZE, MAX_CUSTOM_EVENT_KEYS, MAX_CUSTOM_EVENT_NAME_LENGTH, MAX_CUSTOM_EVENT_STRING_SIZE, MAX_NESTED_OBJECT_KEYS, MAX_STRING_LENGTH, MAX_STRING_LENGTH_IN_ARRAY, type MetadataType, Mode, PII_PATTERNS, type PageViewData, PermanentError, type PersistedEventsQueue, type PrimaryScrollEvent, SamplingRateValidationError, type ScrollData, ScrollDirection, type SecondaryScrollEvent, type SessionEventCounts, SessionTimeoutValidationError, SpecialApiUrl, type State, type TraceLogTestBridge, TraceLogValidationError, type TransformerHook, type TransformerMap, type UTM, type ViewportConfig, type ViewportElement, type ViewportEventData, WEB_VITALS_GOOD_THRESHOLDS, WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS, WEB_VITALS_POOR_THRESHOLDS, type WebVitalType, type WebVitalsData, type WebVitalsMode, getWebVitalsThresholds, isPrimaryScrollEvent, isSecondaryScrollEvent, tracelog };
@@ -2425,7 +2425,6 @@ declare const MAX_CUSTOM_EVENT_STRING_SIZE: number;
2425
2425
  declare const MAX_CUSTOM_EVENT_KEYS = 10;
2426
2426
  declare const MAX_CUSTOM_EVENT_ARRAY_SIZE = 10;
2427
2427
  declare const MAX_NESTED_OBJECT_KEYS = 20;
2428
- declare const MAX_METADATA_NESTING_DEPTH = 1;
2429
2428
  declare const MAX_STRING_LENGTH = 1000;
2430
2429
  declare const MAX_STRING_LENGTH_IN_ARRAY = 500;
2431
2430
  declare const MAX_ARRAY_LENGTH = 100;
@@ -2490,4 +2489,4 @@ declare const tracelog: {
2490
2489
  mergeGlobalMetadata: (metadata: Record<string, MetadataType>) => void;
2491
2490
  };
2492
2491
 
2493
- export { AppConfigValidationError, type BeforeBatchTransformer, type BeforeSendTransformer, type ClickCoordinates, type ClickData, type ClickTrackingElementData, type Config, type CustomEventData, type CustomHeadersProvider, DEFAULT_SESSION_TIMEOUT, DEFAULT_WEB_VITALS_MODE, type DeviceInfo, DeviceType, type EmitterCallback, EmitterEvent, type EmitterMap, type ErrorData, ErrorType, type EventData, EventType, type EventTypeName, type EventsQueue, InitializationTimeoutError, IntegrationValidationError, MAX_ARRAY_LENGTH, MAX_CUSTOM_EVENT_ARRAY_SIZE, MAX_CUSTOM_EVENT_KEYS, MAX_CUSTOM_EVENT_NAME_LENGTH, MAX_CUSTOM_EVENT_STRING_SIZE, MAX_METADATA_NESTING_DEPTH, MAX_NESTED_OBJECT_KEYS, MAX_STRING_LENGTH, MAX_STRING_LENGTH_IN_ARRAY, type MetadataType, Mode, PII_PATTERNS, type PageViewData, PermanentError, type PersistedEventsQueue, type PrimaryScrollEvent, SamplingRateValidationError, type ScrollData, ScrollDirection, type SecondaryScrollEvent, type SessionEventCounts, SessionTimeoutValidationError, SpecialApiUrl, type State, type TraceLogTestBridge, TraceLogValidationError, type TransformerHook, type TransformerMap, type UTM, type ViewportConfig, type ViewportElement, type ViewportEventData, WEB_VITALS_GOOD_THRESHOLDS, WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS, WEB_VITALS_POOR_THRESHOLDS, type WebVitalType, type WebVitalsData, type WebVitalsMode, getWebVitalsThresholds, isPrimaryScrollEvent, isSecondaryScrollEvent, tracelog };
2492
+ export { AppConfigValidationError, type BeforeBatchTransformer, type BeforeSendTransformer, type ClickCoordinates, type ClickData, type ClickTrackingElementData, type Config, type CustomEventData, type CustomHeadersProvider, DEFAULT_SESSION_TIMEOUT, DEFAULT_WEB_VITALS_MODE, type DeviceInfo, DeviceType, type EmitterCallback, EmitterEvent, type EmitterMap, type ErrorData, ErrorType, type EventData, EventType, type EventTypeName, type EventsQueue, InitializationTimeoutError, IntegrationValidationError, MAX_ARRAY_LENGTH, MAX_CUSTOM_EVENT_ARRAY_SIZE, MAX_CUSTOM_EVENT_KEYS, MAX_CUSTOM_EVENT_NAME_LENGTH, MAX_CUSTOM_EVENT_STRING_SIZE, MAX_NESTED_OBJECT_KEYS, MAX_STRING_LENGTH, MAX_STRING_LENGTH_IN_ARRAY, type MetadataType, Mode, PII_PATTERNS, type PageViewData, PermanentError, type PersistedEventsQueue, type PrimaryScrollEvent, SamplingRateValidationError, type ScrollData, ScrollDirection, type SecondaryScrollEvent, type SessionEventCounts, SessionTimeoutValidationError, SpecialApiUrl, type State, type TraceLogTestBridge, TraceLogValidationError, type TransformerHook, type TransformerMap, type UTM, type ViewportConfig, type ViewportElement, type ViewportEventData, WEB_VITALS_GOOD_THRESHOLDS, WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS, WEB_VITALS_POOR_THRESHOLDS, type WebVitalType, type WebVitalsData, type WebVitalsMode, getWebVitalsThresholds, isPrimaryScrollEvent, isSecondaryScrollEvent, tracelog };
@@ -39,12 +39,11 @@ var MAX_CUSTOM_EVENT_STRING_SIZE = 8 * 1024;
39
39
  var MAX_CUSTOM_EVENT_KEYS = 10;
40
40
  var MAX_CUSTOM_EVENT_ARRAY_SIZE = 10;
41
41
  var MAX_NESTED_OBJECT_KEYS = 20;
42
- var MAX_METADATA_NESTING_DEPTH = 1;
43
42
  var MAX_TEXT_LENGTH = 255;
44
43
  var MAX_STRING_LENGTH = 1e3;
45
44
  var MAX_STRING_LENGTH_IN_ARRAY = 500;
46
45
  var MAX_ARRAY_LENGTH = 100;
47
- var MAX_OBJECT_DEPTH = 3;
46
+ var MAX_OBJECT_DEPTH = 10;
48
47
  var PRECISION_TWO_DECIMALS = 2;
49
48
  var MAX_BEACON_PAYLOAD_SIZE = 64 * 1024;
50
49
  var MAX_FINGERPRINTS = 1500;
@@ -556,7 +555,7 @@ var LONG_TASK_THROTTLE_MS = 1e3;
556
555
  var MAX_NAVIGATION_HISTORY = 50;
557
556
 
558
557
  // package.json
559
- var version = "2.1.2";
558
+ var version = "2.2.0";
560
559
 
561
560
  // src/constants/version.constants.ts
562
561
  var LIB_VERSION = version;
@@ -852,9 +851,6 @@ var sanitizeString = (value) => {
852
851
  return result;
853
852
  };
854
853
  var sanitizeValue = (value, depth = 0) => {
855
- if (depth > MAX_OBJECT_DEPTH) {
856
- return null;
857
- }
858
854
  if (value === null || value === void 0) {
859
855
  return null;
860
856
  }
@@ -870,6 +866,9 @@ var sanitizeValue = (value, depth = 0) => {
870
866
  if (typeof value === "boolean") {
871
867
  return value;
872
868
  }
869
+ if (depth > MAX_OBJECT_DEPTH) {
870
+ return null;
871
+ }
873
872
  if (Array.isArray(value)) {
874
873
  const limitedArray = value.slice(0, MAX_ARRAY_LENGTH);
875
874
  const sanitizedArray = limitedArray.map((item) => sanitizeValue(item, depth + 1)).filter((item) => item !== null);
@@ -1128,69 +1127,34 @@ var validateAndNormalizeConfig = (config) => {
1128
1127
  };
1129
1128
 
1130
1129
  // src/utils/validations/type-guards.utils.ts
1131
- var isValidArrayItem = (item) => {
1132
- if (typeof item === "string") {
1130
+ var isSerializable = (value, seen = /* @__PURE__ */ new Set()) => {
1131
+ if (value === null || value === void 0) {
1133
1132
  return true;
1134
1133
  }
1135
- if (typeof item === "object" && item !== null && !Array.isArray(item)) {
1136
- const entries = Object.entries(item);
1137
- if (entries.length > MAX_NESTED_OBJECT_KEYS) {
1138
- return false;
1139
- }
1140
- for (const [, value] of entries) {
1141
- if (value === null || value === void 0) {
1142
- continue;
1143
- }
1144
- const type = typeof value;
1145
- if (type !== "string" && type !== "number" && type !== "boolean") {
1146
- return false;
1147
- }
1148
- }
1134
+ const type = typeof value;
1135
+ if (type === "string" || type === "number" || type === "boolean") {
1149
1136
  return true;
1150
1137
  }
1151
- return false;
1152
- };
1153
- var isOnlyPrimitiveFields = (object, depth = 0) => {
1154
- if (typeof object !== "object" || object === null) {
1138
+ if (type === "function" || type === "symbol" || type === "bigint") {
1155
1139
  return false;
1156
1140
  }
1157
- if (depth > MAX_METADATA_NESTING_DEPTH) {
1141
+ if (seen.has(value)) {
1158
1142
  return false;
1159
1143
  }
1160
- for (const value of Object.values(object)) {
1161
- if (value === null || value === void 0) {
1162
- continue;
1163
- }
1164
- const type = typeof value;
1165
- if (type === "string" || type === "number" || type === "boolean") {
1166
- continue;
1167
- }
1168
- if (Array.isArray(value)) {
1169
- if (value.length === 0) {
1170
- continue;
1171
- }
1172
- const firstItem = value[0];
1173
- const isStringArray = typeof firstItem === "string";
1174
- if (isStringArray) {
1175
- if (!value.every((item) => typeof item === "string")) {
1176
- return false;
1177
- }
1178
- } else {
1179
- if (!value.every((item) => isValidArrayItem(item))) {
1180
- return false;
1181
- }
1182
- }
1183
- continue;
1184
- }
1185
- if (type === "object" && depth === 0) {
1186
- if (!isOnlyPrimitiveFields(value, depth + 1)) {
1187
- return false;
1188
- }
1189
- continue;
1190
- }
1144
+ seen.add(value);
1145
+ if (Array.isArray(value)) {
1146
+ return value.every((item) => isSerializable(item, seen));
1147
+ }
1148
+ if (type === "object") {
1149
+ return Object.values(value).every((v) => isSerializable(v, seen));
1150
+ }
1151
+ return false;
1152
+ };
1153
+ var isOnlyPrimitiveFields = (object) => {
1154
+ if (typeof object !== "object" || object === null) {
1191
1155
  return false;
1192
1156
  }
1193
- return true;
1157
+ return isSerializable(object);
1194
1158
  };
1195
1159
 
1196
1160
  // src/utils/validations/metadata-validations.utils.ts
@@ -6690,6 +6654,6 @@ var tracelog = {
6690
6654
  mergeGlobalMetadata
6691
6655
  };
6692
6656
 
6693
- export { AppConfigValidationError, DEFAULT_SESSION_TIMEOUT, DEFAULT_WEB_VITALS_MODE, DeviceType, EmitterEvent, ErrorType, EventType, InitializationTimeoutError, IntegrationValidationError, MAX_ARRAY_LENGTH, MAX_CUSTOM_EVENT_ARRAY_SIZE, MAX_CUSTOM_EVENT_KEYS, MAX_CUSTOM_EVENT_NAME_LENGTH, MAX_CUSTOM_EVENT_STRING_SIZE, MAX_METADATA_NESTING_DEPTH, MAX_NESTED_OBJECT_KEYS, MAX_STRING_LENGTH, MAX_STRING_LENGTH_IN_ARRAY, Mode, PII_PATTERNS, PermanentError, SamplingRateValidationError, ScrollDirection, SessionTimeoutValidationError, SpecialApiUrl, TraceLogValidationError, WEB_VITALS_GOOD_THRESHOLDS, WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS, WEB_VITALS_POOR_THRESHOLDS, getWebVitalsThresholds, isPrimaryScrollEvent, isSecondaryScrollEvent, tracelog };
6657
+ export { AppConfigValidationError, DEFAULT_SESSION_TIMEOUT, DEFAULT_WEB_VITALS_MODE, DeviceType, EmitterEvent, ErrorType, EventType, InitializationTimeoutError, IntegrationValidationError, MAX_ARRAY_LENGTH, MAX_CUSTOM_EVENT_ARRAY_SIZE, MAX_CUSTOM_EVENT_KEYS, MAX_CUSTOM_EVENT_NAME_LENGTH, MAX_CUSTOM_EVENT_STRING_SIZE, MAX_NESTED_OBJECT_KEYS, MAX_STRING_LENGTH, MAX_STRING_LENGTH_IN_ARRAY, Mode, PII_PATTERNS, PermanentError, SamplingRateValidationError, ScrollDirection, SessionTimeoutValidationError, SpecialApiUrl, TraceLogValidationError, WEB_VITALS_GOOD_THRESHOLDS, WEB_VITALS_NEEDS_IMPROVEMENT_THRESHOLDS, WEB_VITALS_POOR_THRESHOLDS, getWebVitalsThresholds, isPrimaryScrollEvent, isSecondaryScrollEvent, tracelog };
6694
6658
  //# sourceMappingURL=public-api.js.map
6695
6659
  //# sourceMappingURL=public-api.js.map