@coralogix/react-native-plugin 0.6.0 → 0.6.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.6.1 (2026-06-09)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - **rum:** guard log() and init() against invalid inputs
6
+
1
7
  ## 0.6.0 (2026-06-04)
2
8
 
3
9
  ### 🚀 Features
package/index.cjs.js CHANGED
@@ -537,7 +537,7 @@ function stopJsRefreshRateSampler() {
537
537
  appStateSub = null;
538
538
  }
539
539
 
540
- var version = "0.6.0";
540
+ var version = "0.6.1";
541
541
  var pkg = {
542
542
  version: version};
543
543
 
@@ -996,6 +996,16 @@ function createErrorProxy(errorMessage) {
996
996
  }
997
997
  let isInited = false;
998
998
  let fetchInstrumentation;
999
+ function toSafeRecord(name, value) {
1000
+ if (value == null) {
1001
+ return {};
1002
+ }
1003
+ if (typeof value !== 'object' || Array.isArray(value)) {
1004
+ logger.warn(`CoralogixRum.log: \`${name}\` must be a plain object; received ${Array.isArray(value) ? 'array' : typeof value}. Ignoring.`);
1005
+ return {};
1006
+ }
1007
+ return value;
1008
+ }
999
1009
  const CoralogixRum = {
1000
1010
  get isInited() {
1001
1011
  return isInited;
@@ -1006,6 +1016,10 @@ const CoralogixRum = {
1006
1016
  console.warn('[Coralogix React Native SDK] - already initialized');
1007
1017
  return;
1008
1018
  }
1019
+ if (typeof (options == null ? void 0 : options.public_key) !== 'string' || options.public_key.length === 0) {
1020
+ console.warn('[Coralogix React Native SDK] - `public_key` is required and must be a non-empty string; initialization aborted.');
1021
+ return;
1022
+ }
1009
1023
  const resolvedOptions = resolveCoralogixOtelWebConfig(options);
1010
1024
  logger.shouldLog = (_resolvedOptions$debu = resolvedOptions.debug) != null ? _resolvedOptions$debu : false;
1011
1025
  const hasExcludeOverrides = ((_resolvedOptions$excl = (_resolvedOptions$excl2 = resolvedOptions.excludeFromSampling) == null ? void 0 : _resolvedOptions$excl2.length) != null ? _resolvedOptions$excl : 0) > 0;
@@ -1130,7 +1144,9 @@ const CoralogixRum = {
1130
1144
  logger.debug('CoralogixRum must be initiated before using log');
1131
1145
  return;
1132
1146
  }
1133
- CxSdk.log(severity, message, data != null ? data : {}, labels != null ? labels : {});
1147
+ const safeData = toSafeRecord('data', data);
1148
+ const safeLabels = toSafeRecord('labels', labels);
1149
+ CxSdk.log(severity, message, safeData, safeLabels);
1134
1150
  },
1135
1151
  debug(message, data) {
1136
1152
  this.log(CoralogixLogSeverity.Debug, message, data);
package/index.esm.js CHANGED
@@ -535,7 +535,7 @@ function stopJsRefreshRateSampler() {
535
535
  appStateSub = null;
536
536
  }
537
537
 
538
- var version = "0.6.0";
538
+ var version = "0.6.1";
539
539
  var pkg = {
540
540
  version: version};
541
541
 
@@ -994,6 +994,16 @@ function createErrorProxy(errorMessage) {
994
994
  }
995
995
  let isInited = false;
996
996
  let fetchInstrumentation;
997
+ function toSafeRecord(name, value) {
998
+ if (value == null) {
999
+ return {};
1000
+ }
1001
+ if (typeof value !== 'object' || Array.isArray(value)) {
1002
+ logger.warn(`CoralogixRum.log: \`${name}\` must be a plain object; received ${Array.isArray(value) ? 'array' : typeof value}. Ignoring.`);
1003
+ return {};
1004
+ }
1005
+ return value;
1006
+ }
997
1007
  const CoralogixRum = {
998
1008
  get isInited() {
999
1009
  return isInited;
@@ -1004,6 +1014,10 @@ const CoralogixRum = {
1004
1014
  console.warn('[Coralogix React Native SDK] - already initialized');
1005
1015
  return;
1006
1016
  }
1017
+ if (typeof (options == null ? void 0 : options.public_key) !== 'string' || options.public_key.length === 0) {
1018
+ console.warn('[Coralogix React Native SDK] - `public_key` is required and must be a non-empty string; initialization aborted.');
1019
+ return;
1020
+ }
1007
1021
  const resolvedOptions = resolveCoralogixOtelWebConfig(options);
1008
1022
  logger.shouldLog = (_resolvedOptions$debu = resolvedOptions.debug) != null ? _resolvedOptions$debu : false;
1009
1023
  const hasExcludeOverrides = ((_resolvedOptions$excl = (_resolvedOptions$excl2 = resolvedOptions.excludeFromSampling) == null ? void 0 : _resolvedOptions$excl2.length) != null ? _resolvedOptions$excl : 0) > 0;
@@ -1128,7 +1142,9 @@ const CoralogixRum = {
1128
1142
  logger.debug('CoralogixRum must be initiated before using log');
1129
1143
  return;
1130
1144
  }
1131
- CxSdk.log(severity, message, data != null ? data : {}, labels != null ? labels : {});
1145
+ const safeData = toSafeRecord('data', data);
1146
+ const safeLabels = toSafeRecord('labels', labels);
1147
+ CxSdk.log(severity, message, safeData, safeLabels);
1132
1148
  },
1133
1149
  debug(message, data) {
1134
1150
  this.log(CoralogixLogSeverity.Debug, message, data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coralogix/react-native-plugin",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Official Coralogix React Native plugin",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Coralogix",