@sailfish-ai/recorder 1.5.9 → 1.6.0
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 +4 -7
- package/dist/recording.js +12 -5
- 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/dist/types/recording.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { gatherAndCacheDeviceInfo } from "./deviceInfo";
|
|
|
4
4
|
import { sendRecordingEvents } from "./eventCache";
|
|
5
5
|
import { fetchCaptureSettings, sendDomainsToNotPropagateHeaderTo, startRecordingSession, } from "./graphql";
|
|
6
6
|
import { sendMapUuidIfAvailable } from "./mapUuid";
|
|
7
|
-
import { initializeRecording } from "./recording";
|
|
7
|
+
import { initializeConsolePlugin, initializeRecording } from "./recording";
|
|
8
8
|
import { sendMessage } from "./websocket";
|
|
9
9
|
// Default list of domains to ignore
|
|
10
10
|
const DOMAINS_TO_NOT_PROPAGATE_HEADER_TO_DEFAULT = [
|
|
@@ -320,6 +320,7 @@ function setupFetchInterceptor(domainsToNotPropagateHeadersTo, domainsToPropagat
|
|
|
320
320
|
}
|
|
321
321
|
// Main Recording Function
|
|
322
322
|
export async function startRecording({ apiKey, backendApi = "https://api-service.sailfishqa.com", domainsToPropagateHeaderTo = [], domainsToNotPropagateHeaderTo = [], serviceVersion = "", }) {
|
|
323
|
+
initializeConsolePlugin(DEFAULT_CONSOLE_RECORDING_SETTINGS);
|
|
323
324
|
let sessionId = getOrSetSessionId();
|
|
324
325
|
storeCredentialsAndConnection({ apiKey, backendApi });
|
|
325
326
|
trackDomainChanges();
|
|
@@ -337,16 +338,12 @@ export async function startRecording({ apiKey, backendApi = "https://api-service
|
|
|
337
338
|
DEFAULT_CAPTURE_SETTINGS;
|
|
338
339
|
const sessionResponse = await startRecordingSession(apiKey, sessionId, backendApi);
|
|
339
340
|
if (sessionResponse.data?.startRecordingSession) {
|
|
340
|
-
const websocket = await initializeRecording(captureSettings,
|
|
341
|
+
const websocket = await initializeRecording(captureSettings,
|
|
341
342
|
// DEFAULT_NETWORK_CAPTURE_SETTINGS,
|
|
342
343
|
backendApi, apiKey, sessionId);
|
|
343
344
|
// Send parameters once before starting interval
|
|
344
345
|
sendMapUuidIfAvailable(serviceVersion);
|
|
345
|
-
setInterval(() =>
|
|
346
|
-
if (websocket && websocket.readyState === WebSocket.OPEN) {
|
|
347
|
-
sendRecordingEvents(websocket);
|
|
348
|
-
}
|
|
349
|
-
}, 10000);
|
|
346
|
+
setInterval(() => sendRecordingEvents(websocket), 10000);
|
|
350
347
|
}
|
|
351
348
|
else {
|
|
352
349
|
console.error("Failed to start recording session:", sessionResponse.errors || sessionResponse);
|
package/dist/recording.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getRecordConsolePlugin, } from "@sailfish-rrweb/rrweb-plugin-console-record";
|
|
2
2
|
import record from "@sailfish-rrweb/rrweb-record-only";
|
|
3
|
+
import { EventType } from "@sailfish-rrweb/types";
|
|
3
4
|
import { cacheEvents, sendRecordingEvents } from "./eventCache";
|
|
4
5
|
import { initializeWebSocket } from "./websocket";
|
|
5
6
|
const MASK_CLASS = "sailfishSanitize";
|
|
@@ -36,8 +37,18 @@ function maskInputFn(text, node) {
|
|
|
36
37
|
// Default to returning the original text
|
|
37
38
|
return text;
|
|
38
39
|
}
|
|
40
|
+
export function initializeConsolePlugin(consoleRecordSettings) {
|
|
41
|
+
const { name, observer } = getRecordConsolePlugin(consoleRecordSettings);
|
|
42
|
+
observer((payload) => cacheEvents({
|
|
43
|
+
type: EventType.Plugin,
|
|
44
|
+
timestamp: Date.now(),
|
|
45
|
+
data: {
|
|
46
|
+
plugin: name,
|
|
47
|
+
payload,
|
|
48
|
+
},
|
|
49
|
+
}), window, consoleRecordSettings);
|
|
50
|
+
}
|
|
39
51
|
export async function initializeRecording(captureSettings, // TODO - Sibyl post-launch - replace type
|
|
40
|
-
consoleRecordSettings,
|
|
41
52
|
// networkRecordSettings: NetworkRecordOptions,
|
|
42
53
|
backendApi, apiKey, sessionId) {
|
|
43
54
|
const webSocket = initializeWebSocket(backendApi, apiKey, sessionId);
|
|
@@ -46,10 +57,6 @@ backendApi, apiKey, sessionId) {
|
|
|
46
57
|
emit(event) {
|
|
47
58
|
cacheEvents(event);
|
|
48
59
|
},
|
|
49
|
-
plugins: [
|
|
50
|
-
getRecordConsolePlugin(consoleRecordSettings),
|
|
51
|
-
// getRecordNetworkPlugin(networkRecordSettings),
|
|
52
|
-
],
|
|
53
60
|
maskInputOptions: { text: true }, // Fix the incorrect property name
|
|
54
61
|
maskInputFn,
|
|
55
62
|
maskTextClass: MASK_CLASS,
|