@echoteam/signoz-react 1.0.6 → 1.0.7-beta.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/dist/index.esm.js +25 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +25 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15283,13 +15283,17 @@ function getConfigValue(key) {
|
|
|
15283
15283
|
}
|
|
15284
15284
|
// Fungsi untuk memvalidasi konfigurasi
|
|
15285
15285
|
function validateConfig(config) {
|
|
15286
|
-
const requiredFields = ['serviceName', 'serviceVersion', 'environment', 'serviceNamespace', 'url'];
|
|
15286
|
+
const requiredFields = ['serviceName', 'serviceVersion', 'environment', 'serviceNamespace', 'url', 'allowedOrigins'];
|
|
15287
15287
|
const missingFields = [];
|
|
15288
15288
|
for (const field of requiredFields) {
|
|
15289
15289
|
if (!config[field]) {
|
|
15290
15290
|
missingFields.push(field);
|
|
15291
15291
|
}
|
|
15292
15292
|
}
|
|
15293
|
+
// Khusus validasi allowedOrigins: pastikan array tidak kosong
|
|
15294
|
+
if (config.allowedOrigins && config.allowedOrigins.length === 0) {
|
|
15295
|
+
missingFields.push('allowedOrigins tidak boleh kosong demi keamanan CORS');
|
|
15296
|
+
}
|
|
15293
15297
|
return {
|
|
15294
15298
|
isValid: missingFields.length === 0,
|
|
15295
15299
|
missingFields
|
|
@@ -15297,14 +15301,19 @@ function validateConfig(config) {
|
|
|
15297
15301
|
}
|
|
15298
15302
|
// Fungsi untuk mengkonversi string allowed origins ke array
|
|
15299
15303
|
function parseAllowedOrigins(originsStr) {
|
|
15304
|
+
// Jika tidak ada origins yang diset, izinkan semua URL
|
|
15300
15305
|
if (!originsStr)
|
|
15301
|
-
return [
|
|
15306
|
+
return ['*'];
|
|
15302
15307
|
return originsStr.split(',').map(origin => {
|
|
15303
15308
|
origin = origin.trim();
|
|
15304
15309
|
// Jika string dimulai dan diakhiri dengan '/', anggap sebagai RegExp
|
|
15305
15310
|
if (origin.startsWith('/') && origin.endsWith('/')) {
|
|
15306
15311
|
return new RegExp(origin.slice(1, -1));
|
|
15307
15312
|
}
|
|
15313
|
+
// Jika origin adalah '*', itu berarti allow all
|
|
15314
|
+
if (origin === '*') {
|
|
15315
|
+
return '.*';
|
|
15316
|
+
}
|
|
15308
15317
|
return origin;
|
|
15309
15318
|
});
|
|
15310
15319
|
}
|
|
@@ -15384,10 +15393,22 @@ function initializeSignOzTracing(config) {
|
|
|
15384
15393
|
}),
|
|
15385
15394
|
],
|
|
15386
15395
|
});
|
|
15387
|
-
console.log('SignOz tracing
|
|
15396
|
+
console.log('SignOz: Konfigurasi tracing:', {
|
|
15397
|
+
serviceName: effectiveConfig.serviceName,
|
|
15398
|
+
environment: effectiveConfig.environment,
|
|
15399
|
+
allowedOrigins: effectiveConfig.allowedOrigins,
|
|
15400
|
+
traceSampleRate: effectiveConfig.traceSampleRate
|
|
15401
|
+
});
|
|
15402
|
+
console.log('SignOz: Tracing berhasil diinisialisasi');
|
|
15388
15403
|
}
|
|
15389
|
-
catch (
|
|
15404
|
+
catch (e) {
|
|
15405
|
+
const error = e;
|
|
15390
15406
|
console.error('SignOz: Gagal menginisialisasi tracing:', error);
|
|
15407
|
+
console.error('SignOz: Detail error:', {
|
|
15408
|
+
name: error.name,
|
|
15409
|
+
message: error.message,
|
|
15410
|
+
stack: error.stack
|
|
15411
|
+
});
|
|
15391
15412
|
}
|
|
15392
15413
|
}
|
|
15393
15414
|
|