zubbl-sdk 1.1.13 → 1.1.14

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.
@@ -25,7 +25,6 @@ function setSamplingRatio(ratio) {
25
25
  sampleRatio = ratio;
26
26
  }
27
27
 
28
- // ✅ Updated emitEndpoint to use new telemetry pipeline
29
28
  function emitEndpoint(payload) {
30
29
  if (!shouldSample()) return;
31
30
  const enriched = { ...payload, ts: Date.now(), source: "sdk" };
@@ -49,20 +48,25 @@ async function flushEndpointBuffer() {
49
48
  const telemetryUrl =
50
49
  process.env.ZUBBL_TELEMETRY_URL || `${config.baseUrl.replace(/\/$/, "")}/sdk/log`;
51
50
 
51
+ const headers = {
52
+ "Content-Type": "application/json",
53
+ Authorization: `Bearer ${config.apiKey}`,
54
+ "X-Tenant-Id": config.tenantId,
55
+ "X-App-Id": config.appId,
56
+ };
57
+
52
58
  console.log("[Zubbl SDK][Telemetry] Flushing batch:", {
53
59
  url: telemetryUrl,
54
60
  count: batch.length,
55
61
  sampleRatio,
56
62
  payload: batch,
63
+ headers,
57
64
  });
58
65
 
59
66
  try {
60
67
  const resp = await fetch(telemetryUrl, {
61
68
  method: "POST",
62
- headers: {
63
- "Content-Type": "application/json",
64
- "X-Zubbl-SDK-Token": config.apiKey || "missing",
65
- },
69
+ headers,
66
70
  body: JSON.stringify(batch),
67
71
  });
68
72
 
@@ -91,7 +95,7 @@ async function zubblFetch(input, init = {}, context = {}) {
91
95
  app_id: context.app_id || config.appId,
92
96
  external_user_id: context.external_user_id,
93
97
  method: init.method || "GET",
94
- path: url.pathname, // 🔥 fixed: always "path"
98
+ path: url.pathname, // fixed to "path"
95
99
  status: response?.status ?? 0,
96
100
  latency_ms,
97
101
  });
@@ -23,7 +23,6 @@ function setSamplingRatio(ratio) {
23
23
  sampleRatio = ratio;
24
24
  }
25
25
 
26
- // ✅ Updated emitEndpoint to use new telemetry pipeline
27
26
  function emitEndpoint(payload) {
28
27
  if (!shouldSample()) return;
29
28
  const enriched = { ...payload, ts: Date.now(), source: "sdk" };
@@ -47,20 +46,25 @@ async function flushEndpointBuffer() {
47
46
  const telemetryUrl =
48
47
  process.env.ZUBBL_TELEMETRY_URL || `${config.baseUrl.replace(/\/$/, "")}/sdk/log`;
49
48
 
49
+ const headers = {
50
+ "Content-Type": "application/json",
51
+ Authorization: `Bearer ${config.apiKey}`,
52
+ "X-Tenant-Id": config.tenantId,
53
+ "X-App-Id": config.appId,
54
+ };
55
+
50
56
  console.log("[Zubbl SDK][Telemetry] Flushing batch:", {
51
57
  url: telemetryUrl,
52
58
  count: batch.length,
53
59
  sampleRatio,
54
60
  payload: batch,
61
+ headers,
55
62
  });
56
63
 
57
64
  try {
58
65
  const resp = await fetch(telemetryUrl, {
59
66
  method: "POST",
60
- headers: {
61
- "Content-Type": "application/json",
62
- "X-Zubbl-SDK-Token": config.apiKey || "missing",
63
- },
67
+ headers,
64
68
  body: JSON.stringify(batch),
65
69
  });
66
70
 
@@ -89,7 +93,7 @@ async function zubblFetch(input, init = {}, context = {}) {
89
93
  app_id: context.app_id || config.appId,
90
94
  external_user_id: context.external_user_id,
91
95
  method: init.method || "GET",
92
- path: url.pathname, // 🔥 fixed: always "path"
96
+ path: url.pathname, // fixed to "path"
93
97
  status: response?.status ?? 0,
94
98
  latency_ms,
95
99
  });
@@ -27,7 +27,6 @@
27
27
  sampleRatio = ratio;
28
28
  }
29
29
 
30
- // ✅ Updated emitEndpoint to use new telemetry pipeline
31
30
  function emitEndpoint(payload) {
32
31
  if (!shouldSample()) return;
33
32
  const enriched = { ...payload, ts: Date.now(), source: "sdk" };
@@ -51,20 +50,25 @@
51
50
  const telemetryUrl =
52
51
  process.env.ZUBBL_TELEMETRY_URL || `${config.baseUrl.replace(/\/$/, "")}/sdk/log`;
53
52
 
53
+ const headers = {
54
+ "Content-Type": "application/json",
55
+ Authorization: `Bearer ${config.apiKey}`,
56
+ "X-Tenant-Id": config.tenantId,
57
+ "X-App-Id": config.appId,
58
+ };
59
+
54
60
  console.log("[Zubbl SDK][Telemetry] Flushing batch:", {
55
61
  url: telemetryUrl,
56
62
  count: batch.length,
57
63
  sampleRatio,
58
64
  payload: batch,
65
+ headers,
59
66
  });
60
67
 
61
68
  try {
62
69
  const resp = await fetch(telemetryUrl, {
63
70
  method: "POST",
64
- headers: {
65
- "Content-Type": "application/json",
66
- "X-Zubbl-SDK-Token": config.apiKey || "missing",
67
- },
71
+ headers,
68
72
  body: JSON.stringify(batch),
69
73
  });
70
74
 
@@ -93,7 +97,7 @@
93
97
  app_id: context.app_id || config.appId,
94
98
  external_user_id: context.external_user_id,
95
99
  method: init.method || "GET",
96
- path: url.pathname, // 🔥 fixed: always "path"
100
+ path: url.pathname, // fixed to "path"
97
101
  status: response?.status ?? 0,
98
102
  latency_ms,
99
103
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zubbl-sdk",
3
- "version": "1.1.13",
3
+ "version": "1.1.14",
4
4
  "type": "module",
5
5
  "description": "Zubbl SDK for secure policy enforcement (browser, Node, universal)",
6
6
  "main": "dist/zubbl-sdk.cjs.js",