@leanbase-giangnd/js 0.0.3 → 0.0.4
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.cjs +30 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +30 -1
- package/dist/index.mjs.map +1 -1
- package/dist/leanbase.iife.js +30 -1
- package/dist/leanbase.iife.js.map +1 -1
- package/package.json +47 -46
- package/src/leanbase.ts +31 -1
- package/src/version.ts +1 -1
- package/LICENSE +0 -37
package/dist/leanbase.iife.js
CHANGED
|
@@ -2863,7 +2863,7 @@ var leanbase = (function () {
|
|
|
2863
2863
|
}
|
|
2864
2864
|
};
|
|
2865
2865
|
|
|
2866
|
-
var version = "0.0.
|
|
2866
|
+
var version = "0.0.4";
|
|
2867
2867
|
var packageInfo = {
|
|
2868
2868
|
version: version};
|
|
2869
2869
|
|
|
@@ -13487,6 +13487,35 @@ var leanbase = (function () {
|
|
|
13487
13487
|
// eslint-disable-next-line no-console
|
|
13488
13488
|
console.debug('[Leanbase.fetch] parsed.batch.length=', parsed.batch.length, 'hasSnapshot=', hasSnapshot);
|
|
13489
13489
|
} catch {}
|
|
13490
|
+
// If remote config has explicitly disabled session recording, drop snapshot events
|
|
13491
|
+
try {
|
|
13492
|
+
// Read persisted remote config that SessionRecording stores
|
|
13493
|
+
const persisted = this.get_property(SESSION_RECORDING_REMOTE_CONFIG);
|
|
13494
|
+
const serverAllowsRecording = !(persisted && persisted.enabled === false || this.config.disable_session_recording === true);
|
|
13495
|
+
if (!serverAllowsRecording && hasSnapshot) {
|
|
13496
|
+
// remove snapshot events from the batch before sending to /batch/
|
|
13497
|
+
parsed.batch = parsed.batch.filter(item => !(item && item.event === '$snapshot'));
|
|
13498
|
+
// If no events remain, short-circuit and avoid sending an empty batch
|
|
13499
|
+
if (!parsed.batch.length) {
|
|
13500
|
+
try {
|
|
13501
|
+
// eslint-disable-next-line no-console
|
|
13502
|
+
console.debug('[Leanbase.fetch] sessionRecording disabled, dropping snapshot-only batch');
|
|
13503
|
+
} catch {}
|
|
13504
|
+
return {
|
|
13505
|
+
status: 200,
|
|
13506
|
+
json: async () => ({})
|
|
13507
|
+
};
|
|
13508
|
+
}
|
|
13509
|
+
// re-encode the body so the underlying fetch receives the modified batch
|
|
13510
|
+
try {
|
|
13511
|
+
const newBody = JSON.stringify(parsed);
|
|
13512
|
+
options = {
|
|
13513
|
+
...options,
|
|
13514
|
+
body: newBody
|
|
13515
|
+
};
|
|
13516
|
+
} catch {}
|
|
13517
|
+
}
|
|
13518
|
+
} catch {}
|
|
13490
13519
|
if (hasSnapshot) {
|
|
13491
13520
|
const host = this.config && this.config.host || '';
|
|
13492
13521
|
const newUrl = host ? `${host.replace(/\/$/, '')}/s/` : url;
|