@sailfish-ai/recorder 1.2.6 → 1.2.7
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.js +9 -4
- package/dist/sailfish-recorder.cjs.js +1 -1
- package/dist/sailfish-recorder.cjs.js.br +0 -0
- package/dist/sailfish-recorder.cjs.js.gz +0 -0
- package/dist/sailfish-recorder.es.js +1 -1
- package/dist/sailfish-recorder.es.js.br +0 -0
- package/dist/sailfish-recorder.es.js.gz +0 -0
- package/dist/sailfish-recorder.umd.js +1 -1
- package/dist/sailfish-recorder.umd.js.br +0 -0
- package/dist/sailfish-recorder.umd.js.gz +0 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -93,6 +93,7 @@ function storeCredentialsAndConnection({ apiKey, backendApi, }) {
|
|
|
93
93
|
}
|
|
94
94
|
// Utility function to match domains or paths with wildcard support
|
|
95
95
|
export function matchUrlWithWildcard(url, patterns) {
|
|
96
|
+
console.log(`Calling matchUrlWithWildcard against ${url}`);
|
|
96
97
|
if (!url || typeof url !== "string") {
|
|
97
98
|
throw new Error("Invalid URL input");
|
|
98
99
|
}
|
|
@@ -157,8 +158,6 @@ export function matchUrlWithWildcard(url, patterns) {
|
|
|
157
158
|
});
|
|
158
159
|
}
|
|
159
160
|
// Updated XMLHttpRequest interceptor with single check function
|
|
160
|
-
// Updated XMLHttpRequest interceptor to bypass for CORS-sensitive domains
|
|
161
|
-
// Updated XMLHttpRequest interceptor with exclusion handling
|
|
162
161
|
function setupXMLHttpRequestInterceptor(domainsToNotPropagateHeaderTo, domainsToPropagateHeadersTo = []) {
|
|
163
162
|
const originalOpen = XMLHttpRequest.prototype.open;
|
|
164
163
|
const originalSend = XMLHttpRequest.prototype.send;
|
|
@@ -170,11 +169,13 @@ function setupXMLHttpRequestInterceptor(domainsToNotPropagateHeaderTo, domainsTo
|
|
|
170
169
|
];
|
|
171
170
|
// Store URL during open()
|
|
172
171
|
XMLHttpRequest.prototype.open = function (method, url, ...args) {
|
|
172
|
+
console.log("Sailfish XMLHttpRequest.prototype.open");
|
|
173
173
|
this._requestUrl = typeof url === "string" && url.length > 0 ? url : null;
|
|
174
174
|
return originalOpen.apply(this, [method, url, ...args]);
|
|
175
175
|
};
|
|
176
176
|
// Intercept send()
|
|
177
177
|
XMLHttpRequest.prototype.send = function (...args) {
|
|
178
|
+
console.log("Sailfish XMLHttpRequest.prototype.send");
|
|
178
179
|
const url = this._requestUrl;
|
|
179
180
|
if (!url)
|
|
180
181
|
return originalSend.apply(this, args);
|
|
@@ -218,6 +219,7 @@ function setupFetchInterceptor(domainsToNotPropagateHeadersTo, domainsToPropagat
|
|
|
218
219
|
url = input.href;
|
|
219
220
|
}
|
|
220
221
|
else {
|
|
222
|
+
console.log("Unsupported args -->", args);
|
|
221
223
|
return target.apply(thisArg, args); // Skip unsupported inputs
|
|
222
224
|
}
|
|
223
225
|
// Cache check
|
|
@@ -234,16 +236,16 @@ function setupFetchInterceptor(domainsToNotPropagateHeadersTo, domainsToPropagat
|
|
|
234
236
|
}
|
|
235
237
|
// Check domain exclusion
|
|
236
238
|
if (matchUrlWithWildcard(url, combinedIgnoreDomains)) {
|
|
237
|
-
cache.set(url, "ignore");
|
|
238
239
|
console.log(`[InIgnoreDomains] IGNORE --> ${url}`);
|
|
240
|
+
cache.set(url, "ignore");
|
|
239
241
|
return target.apply(thisArg, args);
|
|
240
242
|
}
|
|
241
243
|
// Check domain propagation
|
|
242
244
|
const shouldPropagateHeader = domainsToPropagateHeadersTo.length === 0 ||
|
|
243
245
|
matchUrlWithWildcard(url, domainsToPropagateHeadersTo);
|
|
244
246
|
if (!shouldPropagateHeader) {
|
|
245
|
-
cache.set(url, "ignore");
|
|
246
247
|
console.log(`[NOT InPropagateDomans] IGNORE --> ${url}`);
|
|
248
|
+
cache.set(url, "ignore");
|
|
247
249
|
return target.apply(thisArg, args);
|
|
248
250
|
}
|
|
249
251
|
cache.set(url, "propagate");
|
|
@@ -262,6 +264,7 @@ function setupFetchInterceptor(domainsToNotPropagateHeadersTo, domainsToPropagat
|
|
|
262
264
|
const modifiedRequest = new Request(clonedRequest, {
|
|
263
265
|
headers: newHeaders,
|
|
264
266
|
});
|
|
267
|
+
console.log(`[modified call] newHeaders --> `, newHeaders);
|
|
265
268
|
return target.call(thisArg, modifiedRequest, init);
|
|
266
269
|
}
|
|
267
270
|
else {
|
|
@@ -270,10 +273,12 @@ function setupFetchInterceptor(domainsToNotPropagateHeadersTo, domainsToPropagat
|
|
|
270
273
|
const newHeaders = new Headers(init.headers || {});
|
|
271
274
|
newHeaders.set("X-Sf3-Rid", sessionId);
|
|
272
275
|
modifiedInit.headers = newHeaders;
|
|
276
|
+
console.log(`[modified call] newHeaders --> `, newHeaders);
|
|
273
277
|
return target.call(thisArg, input, modifiedInit);
|
|
274
278
|
}
|
|
275
279
|
}
|
|
276
280
|
else {
|
|
281
|
+
console.log("[UNMODIFIED CALL]");
|
|
277
282
|
return target.apply(thisArg, args);
|
|
278
283
|
}
|
|
279
284
|
}
|