zubbl-sdk 1.1.11 → 1.1.12

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.
@@ -21,7 +21,7 @@ function shouldSample() {
21
21
  }
22
22
 
23
23
  function setSamplingRatio(ratio) {
24
- if (ratio <= 0 || ratio > 1) throw new Error("Sampling ratio must be between 0 and 1");
24
+ if (ratio < 0 || ratio > 1) throw new Error("Sampling ratio must be between 0 and 1");
25
25
  sampleRatio = ratio;
26
26
  }
27
27
 
@@ -42,7 +42,7 @@ async function flushEndpointBuffer() {
42
42
  endpointBuffer = [];
43
43
  debounceTimer = null;
44
44
  try {
45
- await fetch("/api/sdk/telemetry/endpoints", {
45
+ await fetch(`${config.baseUrl}/sdk/telemetry/endpoints`, {
46
46
  method: "POST",
47
47
  headers: { "Content-Type": "application/json" },
48
48
  body: JSON.stringify(batch),
@@ -19,7 +19,7 @@ function shouldSample() {
19
19
  }
20
20
 
21
21
  function setSamplingRatio(ratio) {
22
- if (ratio <= 0 || ratio > 1) throw new Error("Sampling ratio must be between 0 and 1");
22
+ if (ratio < 0 || ratio > 1) throw new Error("Sampling ratio must be between 0 and 1");
23
23
  sampleRatio = ratio;
24
24
  }
25
25
 
@@ -40,7 +40,7 @@ async function flushEndpointBuffer() {
40
40
  endpointBuffer = [];
41
41
  debounceTimer = null;
42
42
  try {
43
- await fetch("/api/sdk/telemetry/endpoints", {
43
+ await fetch(`${config.baseUrl}/sdk/telemetry/endpoints`, {
44
44
  method: "POST",
45
45
  headers: { "Content-Type": "application/json" },
46
46
  body: JSON.stringify(batch),
@@ -23,7 +23,7 @@
23
23
  }
24
24
 
25
25
  function setSamplingRatio(ratio) {
26
- if (ratio <= 0 || ratio > 1) throw new Error("Sampling ratio must be between 0 and 1");
26
+ if (ratio < 0 || ratio > 1) throw new Error("Sampling ratio must be between 0 and 1");
27
27
  sampleRatio = ratio;
28
28
  }
29
29
 
@@ -44,7 +44,7 @@
44
44
  endpointBuffer = [];
45
45
  debounceTimer = null;
46
46
  try {
47
- await fetch("/api/sdk/telemetry/endpoints", {
47
+ await fetch(`${config.baseUrl}/sdk/telemetry/endpoints`, {
48
48
  method: "POST",
49
49
  headers: { "Content-Type": "application/json" },
50
50
  body: JSON.stringify(batch),
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "zubbl-sdk",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
+ "type": "module",
4
5
  "description": "Zubbl SDK for secure policy enforcement (browser, Node, universal)",
5
6
  "main": "dist/zubbl-sdk.cjs.js",
6
7
  "module": "dist/zubbl-sdk.esm.js",
@@ -21,13 +22,14 @@
21
22
  "scripts": {
22
23
  "build": "rollup -c",
23
24
  "prepublishOnly": "npm run build",
24
- "test": "echo 'Add tests!'"
25
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest"
25
26
  },
26
27
  "repository": "https://github.com/zubbl/zubbl-sdk",
27
28
  "author": "Zubbl",
28
29
  "license": "MIT",
29
30
  "devDependencies": {
30
31
  "@rollup/plugin-node-resolve": "^16.0.1",
32
+ "jest": "^30.1.3",
31
33
  "rollup": "^4.2.0"
32
34
  },
33
35
  "dependencies": {