@sailfish-ai/recorder 1.7.29 → 1.7.34
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/graphql.js +33 -3
- package/dist/{modal.js → inAppReportIssueModal.js} +62 -18
- package/dist/index.js +56 -5
- package/dist/recording.js +12 -7
- 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/suppressConsoleLogsDuringCall.js +16 -0
- package/dist/types/graphql.d.ts +1 -1
- package/dist/types/{modal.d.ts → inAppReportIssueModal.d.ts} +1 -1
- package/dist/types/index.d.ts +8 -4
- package/dist/types/suppressConsoleLogsDuringCall.d.ts +1 -0
- package/dist/websocket.js +13 -9
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default function suppressConsoleLogsDuringCall(fn) {
|
|
2
|
+
const originalLog = console.log;
|
|
3
|
+
const originalWarn = console.warn;
|
|
4
|
+
const originalError = console.error;
|
|
5
|
+
console.log = () => { };
|
|
6
|
+
console.warn = () => { };
|
|
7
|
+
console.error = () => { };
|
|
8
|
+
try {
|
|
9
|
+
fn();
|
|
10
|
+
}
|
|
11
|
+
finally {
|
|
12
|
+
console.log = originalLog;
|
|
13
|
+
console.warn = originalWarn;
|
|
14
|
+
console.error = originalError;
|
|
15
|
+
}
|
|
16
|
+
}
|
package/dist/types/graphql.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ export declare function sendGraphQLRequest<T>(operationName: string, query: stri
|
|
|
3
3
|
initialBackoff?: number, // Initial backoff in milliseconds
|
|
4
4
|
backoffFactor?: number): Promise<GraphQLResponse<T>>;
|
|
5
5
|
export declare function fetchCaptureSettings(apiKey: string, backendApi: string): Promise<GraphQLResponse<CaptureSettingsResponse>>;
|
|
6
|
-
export declare function startRecordingSession(apiKey: string, recordingId: string, backendApi: string): Promise<GraphQLResponse<StartSessionResponse>>;
|
|
6
|
+
export declare function startRecordingSession(apiKey: string, recordingId: string, backendApi: string, serviceIdentifier: string, serviceVersion?: string, mapUuid?: string, gitSha?: string, library?: string, serviceAdditionalMetadata?: Record<string, any>): Promise<GraphQLResponse<StartSessionResponse>>;
|
|
7
7
|
export declare function sendDomainsToNotPropagateHeaderTo(apiKey: string, domains: string[], backendApi: string): Promise<GraphQLResponse<void>>;
|
|
8
8
|
export declare function createTriageFromRecorder(apiKey: string, backendApi: string, recordingSessionId: string, timestampStart: string, timestampEnd: string, description?: string): Promise<GraphQLResponse<CreateTriageResponse>>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,25 +15,29 @@ export declare function consolidateDynamicExclusions(hostPathSet: Set<string>, t
|
|
|
15
15
|
export declare const DEFAULT_CAPTURE_SETTINGS: CaptureSettings;
|
|
16
16
|
export declare const DEFAULT_CONSOLE_RECORDING_SETTINGS: LogRecordOptions;
|
|
17
17
|
export declare function matchUrlWithWildcard(url: string, patterns: string[]): boolean;
|
|
18
|
-
export declare function startRecording({ apiKey, backendApi, domainsToPropagateHeaderTo, domainsToNotPropagateHeaderTo, serviceVersion, serviceIdentifier, }: {
|
|
18
|
+
export declare function startRecording({ apiKey, backendApi, domainsToPropagateHeaderTo, domainsToNotPropagateHeaderTo, serviceVersion, serviceIdentifier, gitSha, serviceAdditionalMetadata, }: {
|
|
19
19
|
apiKey: string;
|
|
20
20
|
backendApi?: string;
|
|
21
21
|
domainsToPropagateHeaderTo?: string[];
|
|
22
22
|
domainsToNotPropagateHeaderTo?: string[];
|
|
23
23
|
serviceVersion?: string;
|
|
24
24
|
serviceIdentifier?: string;
|
|
25
|
+
gitSha?: string;
|
|
26
|
+
serviceAdditionalMetadata?: Record<string, any>;
|
|
25
27
|
}): Promise<void>;
|
|
26
28
|
export declare const initRecorder: (options: {
|
|
27
29
|
apiKey: string;
|
|
28
30
|
backendApi?: string;
|
|
29
|
-
serviceVersion?: string;
|
|
30
|
-
serviceIdentifier?: string;
|
|
31
31
|
domainsToPropagateHeaderTo?: string[];
|
|
32
32
|
domainsToNotPropagateHeaderTo?: string[];
|
|
33
33
|
enableShortcuts?: boolean;
|
|
34
|
+
serviceVersion?: string;
|
|
35
|
+
serviceIdentifier?: string;
|
|
36
|
+
gitSha?: string;
|
|
37
|
+
serviceAdditionalMetadata?: Record<string, any>;
|
|
34
38
|
}) => Promise<void>;
|
|
35
39
|
export * from "./graphql";
|
|
36
|
-
export { openReportIssueModal } from "./
|
|
40
|
+
export { openReportIssueModal } from "./inAppReportIssueModal";
|
|
37
41
|
export * from "./recording";
|
|
38
42
|
export * from "./sendSailfishMessages";
|
|
39
43
|
export * from "./types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function suppressConsoleLogsDuringCall(fn: () => void): void;
|
package/dist/websocket.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import ReconnectingWebSocket from "reconnecting-websocket";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { deleteEventsByIds, getAllIndexedEvents, saveEventToIDB, } from './eventStore';
|
|
2
|
+
import { deleteEventsByIds, getAllIndexedEvents, saveEventToIDB, } from "./eventStore";
|
|
3
|
+
import { deleteNotifyMessageById, getAllNotifyMessages, saveNotifyMessageToIDB, } from "./notifyEventStore";
|
|
5
4
|
import { buildBatches, eventSize } from "./utils";
|
|
5
|
+
import version from "./version";
|
|
6
6
|
const MAX_MESSAGE_SIZE_MB = 50;
|
|
7
7
|
const MAX_MESSAGE_SIZE_BYTES = MAX_MESSAGE_SIZE_MB * 1024 * 1024;
|
|
8
|
+
const DEBUG = import.meta.env.VITE_DEBUG ? import.meta.env.VITE_DEBUG : false;
|
|
8
9
|
let webSocket = null;
|
|
9
10
|
function isWebSocketOpen(ws) {
|
|
10
11
|
return ws?.readyState === WebSocket.OPEN;
|
|
@@ -27,7 +28,7 @@ export async function flushBufferedEvents() {
|
|
|
27
28
|
const persisted = await getAllIndexedEvents();
|
|
28
29
|
const groupedBySession = {};
|
|
29
30
|
for (const event of persisted) {
|
|
30
|
-
const sessionId = event?.data?.data?.sessionId ??
|
|
31
|
+
const sessionId = event?.data?.data?.sessionId ?? "unknown-session";
|
|
31
32
|
if (!groupedBySession[sessionId])
|
|
32
33
|
groupedBySession[sessionId] = [];
|
|
33
34
|
groupedBySession[sessionId].push(event);
|
|
@@ -37,11 +38,13 @@ export async function flushBufferedEvents() {
|
|
|
37
38
|
for (const batch of idbBatches) {
|
|
38
39
|
if (!isWebSocketOpen(webSocket))
|
|
39
40
|
break;
|
|
40
|
-
const eventsToSend = batch.map(e => e.data);
|
|
41
|
-
const idsToDelete = batch
|
|
41
|
+
const eventsToSend = batch.map((e) => e.data);
|
|
42
|
+
const idsToDelete = batch
|
|
43
|
+
.map((e) => e.id)
|
|
44
|
+
.filter((id) => id != null);
|
|
42
45
|
try {
|
|
43
46
|
const message = JSON.stringify({
|
|
44
|
-
type:
|
|
47
|
+
type: "events",
|
|
45
48
|
events: eventsToSend,
|
|
46
49
|
mapUuid: window.sfMapUuid,
|
|
47
50
|
});
|
|
@@ -54,7 +57,7 @@ export async function flushBufferedEvents() {
|
|
|
54
57
|
}
|
|
55
58
|
export function sendEvent(event) {
|
|
56
59
|
const msg = JSON.stringify({
|
|
57
|
-
type:
|
|
60
|
+
type: "event",
|
|
58
61
|
event,
|
|
59
62
|
mapUuid: window.sfMapUuid,
|
|
60
63
|
});
|
|
@@ -80,7 +83,8 @@ export function initializeWebSocket(backendApi, apiKey, sessionId) {
|
|
|
80
83
|
};
|
|
81
84
|
webSocket = new ReconnectingWebSocket(wsUrl, [], options);
|
|
82
85
|
webSocket.addEventListener("open", () => {
|
|
83
|
-
|
|
86
|
+
if (DEBUG)
|
|
87
|
+
console.log("WebSocket opened.");
|
|
84
88
|
(async () => {
|
|
85
89
|
await flushNotifyQueue();
|
|
86
90
|
setInterval(() => flushBufferedEvents(), 10000);
|