@offscript/sdk 0.1.2 → 0.1.6
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/README.md +18 -115
- package/dist/adapters/nuxt.cjs +3 -3
- package/dist/adapters/nuxt.js +2 -2
- package/dist/adapters/vanilla.cjs +5 -5
- package/dist/adapters/vanilla.d.ts +2 -3
- package/dist/adapters/vanilla.js +3 -3
- package/dist/adapters/vue.cjs +3 -3
- package/dist/adapters/vue.js +2 -2
- package/dist/{chunk-IBEPWI7S.js → chunk-5ZBR6FI5.js} +522 -1231
- package/dist/chunk-5ZBR6FI5.js.map +1 -0
- package/dist/{chunk-WUFW7TEL.js → chunk-KHKIWCLM.js} +3 -5
- package/dist/chunk-KHKIWCLM.js.map +1 -0
- package/dist/{chunk-KQVK5EJR.cjs → chunk-MZXF2LF2.cjs} +3 -5
- package/dist/chunk-MZXF2LF2.cjs.map +1 -0
- package/dist/{chunk-I6JPZAQA.cjs → chunk-PCJRHW66.cjs} +525 -1239
- package/dist/chunk-PCJRHW66.cjs.map +1 -0
- package/dist/{chunk-HECPMGDC.js → chunk-R2PPPR4K.js} +5 -5
- package/dist/chunk-R2PPPR4K.js.map +1 -0
- package/dist/chunk-RAUSXUGS.cjs +20 -0
- package/dist/chunk-RAUSXUGS.cjs.map +1 -0
- package/dist/core/LifecycleManager.d.ts +1 -0
- package/dist/core/OffscriptSDK.d.ts +41 -70
- package/dist/core/RecordingStore.d.ts +26 -0
- package/dist/index.cjs +20 -40
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/playwright/PlaywrightDataContract.d.ts +0 -7
- package/dist/playwright.cjs +13 -13
- package/dist/playwright.js +1 -1
- package/dist/recorders/ActionRecorder.d.ts +1 -1
- package/dist/recorders/ContextRecorder.d.ts +2 -8
- package/dist/recorders/HTTPRecorder.d.ts +7 -2
- package/dist/types/config.d.ts +9 -45
- package/dist/types/events.d.ts +2 -23
- package/dist/types/recording.d.ts +20 -0
- package/dist/ui/RecordingControls.d.ts +6 -4
- package/dist/utils/errors.d.ts +1 -18
- package/docs/api-contract.md +4 -53
- package/docs/architecture.md +5 -34
- package/docs/event-contract.md +3 -24
- package/docs/playwright-contract.md +3 -37
- package/package.json +2 -2
- package/dist/chunk-HECPMGDC.js.map +0 -1
- package/dist/chunk-I6JPZAQA.cjs.map +0 -1
- package/dist/chunk-IBEPWI7S.js.map +0 -1
- package/dist/chunk-KQVK5EJR.cjs.map +0 -1
- package/dist/chunk-TBPD2LMI.cjs +0 -20
- package/dist/chunk-TBPD2LMI.cjs.map +0 -1
- package/dist/chunk-WUFW7TEL.js.map +0 -1
- package/dist/core/ApiClient.d.ts +0 -24
- package/dist/core/SessionManager.d.ts +0 -45
- package/dist/transport/EventQueue.d.ts +0 -28
- package/dist/transport/EventTransport.d.ts +0 -84
- package/dist/transport/PersistentBuffer.d.ts +0 -60
- package/dist/transport/RetryManager.d.ts +0 -9
- package/dist/types/session.d.ts +0 -77
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkPCJRHW66_cjs = require('./chunk-PCJRHW66.cjs');
|
|
4
|
+
|
|
5
|
+
// src/adapters/vanilla.ts
|
|
6
|
+
async function createOffscript(config) {
|
|
7
|
+
const sdk = new chunkPCJRHW66_cjs.Offscript(config);
|
|
8
|
+
await sdk.init();
|
|
9
|
+
return sdk;
|
|
10
|
+
}
|
|
11
|
+
async function startOffscript(config) {
|
|
12
|
+
const sdk = await createOffscript(config);
|
|
13
|
+
await sdk.startRecording();
|
|
14
|
+
return sdk;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
exports.createOffscript = createOffscript;
|
|
18
|
+
exports.startOffscript = startOffscript;
|
|
19
|
+
//# sourceMappingURL=chunk-RAUSXUGS.cjs.map
|
|
20
|
+
//# sourceMappingURL=chunk-RAUSXUGS.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/vanilla.ts"],"names":["Offscript"],"mappings":";;;;;AAIA,eAAsB,gBAAgB,MAAA,EAA6C;AACjF,EAAA,MAAM,GAAA,GAAM,IAAIA,2BAAA,CAAU,MAAM,CAAA;AAChC,EAAA,MAAM,IAAI,IAAA,EAAK;AACf,EAAA,OAAO,GAAA;AACT;AAEA,eAAsB,eAAe,MAAA,EAA6C;AAChF,EAAA,MAAM,GAAA,GAAM,MAAM,eAAA,CAAgB,MAAM,CAAA;AACxC,EAAA,MAAM,IAAI,cAAA,EAAe;AACzB,EAAA,OAAO,GAAA;AACT","file":"chunk-RAUSXUGS.cjs","sourcesContent":["import { Offscript } from \"../core/OffscriptSDK\";\nimport type { OffscriptConfig } from \"../types/config\";\n\n/** Atalho para aplicações JS tradicionais, Blade e MPA: inicializa a captura local. */\nexport async function createOffscript(config: OffscriptConfig): Promise<Offscript> {\n const sdk = new Offscript(config);\n await sdk.init();\n return sdk;\n}\n\nexport async function startOffscript(config: OffscriptConfig): Promise<Offscript> {\n const sdk = await createOffscript(config);\n await sdk.startRecording();\n return sdk;\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type NavigationKind = "pushState" | "replaceState" | "popstate" | "hashchange";
|
|
2
2
|
export interface LifecycleHandlers {
|
|
3
3
|
onPageHide(): void;
|
|
4
|
+
onPageShow?(): void;
|
|
4
5
|
onVisibility(hidden: boolean): void;
|
|
5
6
|
onConnectivity(online: boolean): void;
|
|
6
7
|
onNavigation(info: {
|
|
@@ -1,117 +1,88 @@
|
|
|
1
1
|
import type { OffscriptConfig, ResolvedConfig } from "../types/config";
|
|
2
2
|
import { type EventKind, type OffscriptEvent, type RecordedAction } from "../types/events";
|
|
3
|
-
import type {
|
|
3
|
+
import type { CompleteOptions, OffscriptState, RecordingPayload, RecordingStatus } from "../types/recording";
|
|
4
4
|
import { DataSanitizer } from "../privacy/DataSanitizer";
|
|
5
5
|
import type { EmitOptions, EventSink } from "../recorders/types";
|
|
6
|
-
import { OffscriptError } from "../utils/errors";
|
|
7
6
|
import { type PlaywrightRecording } from "../playwright/PlaywrightDataContract";
|
|
8
7
|
export type OffscriptEventMap = {
|
|
9
8
|
statusChange: {
|
|
10
9
|
from: RecordingStatus;
|
|
11
10
|
to: RecordingStatus;
|
|
12
11
|
};
|
|
13
|
-
error:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
sessionDiscard: {
|
|
17
|
-
sessionId: string;
|
|
18
|
-
};
|
|
19
|
-
flush: {
|
|
20
|
-
events: number;
|
|
21
|
-
batchId: string;
|
|
22
|
-
duplicate: boolean;
|
|
23
|
-
};
|
|
24
|
-
overflow: {
|
|
25
|
-
dropped: number;
|
|
26
|
-
};
|
|
27
|
-
disabled: {
|
|
28
|
-
reason?: string;
|
|
29
|
-
};
|
|
12
|
+
error: Error;
|
|
13
|
+
recordingStart: undefined;
|
|
14
|
+
recordingEnd: RecordingPayload;
|
|
30
15
|
};
|
|
31
16
|
export declare class Offscript implements EventSink {
|
|
32
|
-
|
|
17
|
+
static readonly version = "0.1.6";
|
|
33
18
|
readonly config: ResolvedConfig;
|
|
34
19
|
readonly sanitizer: DataSanitizer;
|
|
20
|
+
private readonly bus;
|
|
35
21
|
private status;
|
|
36
22
|
private lastError?;
|
|
37
|
-
private sessions;
|
|
38
|
-
private transport?;
|
|
39
|
-
private lifecycle?;
|
|
40
23
|
private recorders;
|
|
41
24
|
private rrweb?;
|
|
42
25
|
private actions?;
|
|
43
26
|
private context?;
|
|
27
|
+
private lifecycle?;
|
|
28
|
+
private controls?;
|
|
44
29
|
private accepting;
|
|
30
|
+
private destroyed;
|
|
45
31
|
private initPromise?;
|
|
32
|
+
private store?;
|
|
33
|
+
private suspended;
|
|
34
|
+
private restorePromise?;
|
|
46
35
|
private startPromise?;
|
|
47
36
|
private stopPromise?;
|
|
48
|
-
private
|
|
37
|
+
private completePromise?;
|
|
38
|
+
private events;
|
|
49
39
|
private recent;
|
|
50
40
|
private actionLog;
|
|
51
41
|
private contextLog;
|
|
52
|
-
private
|
|
53
|
-
private
|
|
54
|
-
private
|
|
55
|
-
private
|
|
56
|
-
private
|
|
57
|
-
|
|
42
|
+
private sequence;
|
|
43
|
+
private pageId;
|
|
44
|
+
private payload?;
|
|
45
|
+
private submitted;
|
|
46
|
+
private response;
|
|
47
|
+
private launchToken?;
|
|
48
|
+
private launchTokenChanged;
|
|
49
|
+
constructor(config?: OffscriptConfig);
|
|
58
50
|
getState(): OffscriptState;
|
|
59
51
|
capturesSensitiveValues(): boolean;
|
|
60
|
-
getMetrics(): {
|
|
61
|
-
emitted: number;
|
|
62
|
-
dropped: number;
|
|
63
|
-
avgEmitMs: number;
|
|
64
|
-
bufferKind?: string;
|
|
65
|
-
};
|
|
66
|
-
/** Idempotente. Prepara armazenamento/transporte e retoma sessão persistida (reload/MPA). */
|
|
67
52
|
init(): Promise<void>;
|
|
68
|
-
private
|
|
69
|
-
|
|
53
|
+
private initialize;
|
|
54
|
+
private resolveLaunchToken;
|
|
55
|
+
private getOrCreateDraftKey;
|
|
56
|
+
private readSessionValue;
|
|
57
|
+
private writeSessionValue;
|
|
58
|
+
private removeSessionValue;
|
|
59
|
+
private initializeDraft;
|
|
60
|
+
private restoreDraft;
|
|
61
|
+
private save;
|
|
62
|
+
startRecording(): Promise<void>;
|
|
70
63
|
private doStart;
|
|
71
|
-
private resumePersisted;
|
|
72
|
-
/** Guarda caso de teste e token para o botão de gravar, sem abrir a sessão. */
|
|
73
|
-
armRecording(opts: {
|
|
74
|
-
testCaseId: string;
|
|
75
|
-
sessionToken: string;
|
|
76
|
-
}): void;
|
|
77
|
-
/** Abre a coleta com os dados armados, ou com os da última sessão. */
|
|
78
|
-
startArmedRecording(): Promise<SessionInfo>;
|
|
79
|
-
/** Descarta a coleta atual e volta ao estado inicial, sem abrir outra. */
|
|
80
|
-
startNewSession(): Promise<void>;
|
|
81
|
-
private freshStart;
|
|
82
|
-
private discardRecording;
|
|
83
64
|
pauseRecording(): Promise<void>;
|
|
84
65
|
resumeRecording(): Promise<void>;
|
|
85
|
-
stopRecording(): Promise<
|
|
66
|
+
stopRecording(): Promise<RecordingPayload>;
|
|
86
67
|
private doStop;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
destroy(
|
|
92
|
-
complete?: boolean;
|
|
93
|
-
}): Promise<void>;
|
|
94
|
-
/** Dados estruturados para o motor Playwright, construídos a partir do que foi gravado nesta página. */
|
|
68
|
+
complete(options?: CompleteOptions): Promise<unknown>;
|
|
69
|
+
private doComplete;
|
|
70
|
+
finishRecording(): Promise<unknown>;
|
|
71
|
+
discardRecording(): Promise<void>;
|
|
72
|
+
destroy(): Promise<void>;
|
|
95
73
|
exportPlaywrightData(): PlaywrightRecording;
|
|
96
74
|
getRecordedActions(): readonly RecordedAction[];
|
|
97
75
|
on<K extends keyof OffscriptEventMap>(type: K, fn: (payload: OffscriptEventMap[K]) => void): () => void;
|
|
98
76
|
off<K extends keyof OffscriptEventMap>(type: K, fn: (payload: OffscriptEventMap[K]) => void): void;
|
|
99
|
-
/** Usado pelos recorders. Não confundir com os eventos públicos (`on`). */
|
|
100
77
|
emit<T>(kind: EventKind, data: T, opts?: EmitOptions): OffscriptEvent<T> | null;
|
|
101
78
|
private record;
|
|
102
79
|
private correlate;
|
|
103
80
|
private emitLifecycle;
|
|
104
81
|
private attach;
|
|
105
82
|
private startRecorders;
|
|
83
|
+
private buildPayload;
|
|
106
84
|
private stopRecorders;
|
|
107
|
-
private
|
|
108
|
-
private
|
|
109
|
-
private onHeartbeat;
|
|
110
|
-
/** Backend desativou a gravação: encerra com flush de melhor esforço. */
|
|
111
|
-
private shutdownRemote;
|
|
112
|
-
private onFatal;
|
|
113
|
-
private fail;
|
|
85
|
+
private clearRecording;
|
|
86
|
+
private assertAlive;
|
|
114
87
|
private setStatus;
|
|
115
|
-
private debug;
|
|
116
|
-
static readonly version = "0.1.0";
|
|
117
88
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { OffscriptEvent } from "../types/events";
|
|
2
|
+
export type SavedStatus = "recording" | "paused" | "stopped";
|
|
3
|
+
export interface SavedRecording {
|
|
4
|
+
status: SavedStatus;
|
|
5
|
+
events: OffscriptEvent[];
|
|
6
|
+
}
|
|
7
|
+
/** Local draft only. No destination, credentials or backend protocol. */
|
|
8
|
+
export declare class RecordingStore {
|
|
9
|
+
private readonly database;
|
|
10
|
+
private pending;
|
|
11
|
+
private failure?;
|
|
12
|
+
private uncommitted;
|
|
13
|
+
private status?;
|
|
14
|
+
private constructor();
|
|
15
|
+
static open(key: string): Promise<RecordingStore>;
|
|
16
|
+
load(): Promise<SavedRecording | null>;
|
|
17
|
+
append(event: OffscriptEvent): Promise<void>;
|
|
18
|
+
setStatus(status: SavedStatus): Promise<void>;
|
|
19
|
+
clear(): Promise<void>;
|
|
20
|
+
/** Synchronous handoff of the last uncommitted events before document unload. */
|
|
21
|
+
checkpoint(): void;
|
|
22
|
+
private get checkpointKey();
|
|
23
|
+
flush(): Promise<void>;
|
|
24
|
+
close(): Promise<void>;
|
|
25
|
+
private write;
|
|
26
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,98 +1,78 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkRAUSXUGS_cjs = require('./chunk-RAUSXUGS.cjs');
|
|
4
|
+
var chunkPCJRHW66_cjs = require('./chunk-PCJRHW66.cjs');
|
|
5
|
+
var chunkMZXF2LF2_cjs = require('./chunk-MZXF2LF2.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "createOffscript", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkRAUSXUGS_cjs.createOffscript; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "startOffscript", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(exports, "AuthError", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function () { return chunkI6JPZAQA_cjs.AuthError; }
|
|
15
|
+
get: function () { return chunkRAUSXUGS_cjs.startOffscript; }
|
|
20
16
|
});
|
|
21
17
|
Object.defineProperty(exports, "ConfigError", {
|
|
22
18
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkPCJRHW66_cjs.ConfigError; }
|
|
24
20
|
});
|
|
25
21
|
Object.defineProperty(exports, "DEFAULT_PRIVACY", {
|
|
26
22
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkPCJRHW66_cjs.DEFAULT_PRIVACY; }
|
|
28
24
|
});
|
|
29
25
|
Object.defineProperty(exports, "DEFAULT_RECORDING", {
|
|
30
26
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
32
|
-
});
|
|
33
|
-
Object.defineProperty(exports, "DEFAULT_TRANSPORT", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function () { return chunkI6JPZAQA_cjs.DEFAULT_TRANSPORT; }
|
|
27
|
+
get: function () { return chunkPCJRHW66_cjs.DEFAULT_RECORDING; }
|
|
36
28
|
});
|
|
37
29
|
Object.defineProperty(exports, "DataSanitizer", {
|
|
38
30
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkPCJRHW66_cjs.DataSanitizer; }
|
|
40
32
|
});
|
|
41
33
|
Object.defineProperty(exports, "InvalidStateError", {
|
|
42
34
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkPCJRHW66_cjs.InvalidStateError; }
|
|
44
36
|
});
|
|
45
37
|
Object.defineProperty(exports, "Offscript", {
|
|
46
38
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkPCJRHW66_cjs.Offscript; }
|
|
48
40
|
});
|
|
49
41
|
Object.defineProperty(exports, "OffscriptError", {
|
|
50
42
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
52
|
-
});
|
|
53
|
-
Object.defineProperty(exports, "SessionDisabledError", {
|
|
54
|
-
enumerable: true,
|
|
55
|
-
get: function () { return chunkI6JPZAQA_cjs.SessionDisabledError; }
|
|
56
|
-
});
|
|
57
|
-
Object.defineProperty(exports, "SessionExpiredError", {
|
|
58
|
-
enumerable: true,
|
|
59
|
-
get: function () { return chunkI6JPZAQA_cjs.SessionExpiredError; }
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperty(exports, "TransportError", {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
get: function () { return chunkI6JPZAQA_cjs.TransportError; }
|
|
43
|
+
get: function () { return chunkPCJRHW66_cjs.OffscriptError; }
|
|
64
44
|
});
|
|
65
45
|
Object.defineProperty(exports, "ACTION_SCHEMA_VERSION", {
|
|
66
46
|
enumerable: true,
|
|
67
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkMZXF2LF2_cjs.ACTION_SCHEMA_VERSION; }
|
|
68
48
|
});
|
|
69
49
|
Object.defineProperty(exports, "PLAYWRIGHT_CONTRACT_VERSION", {
|
|
70
50
|
enumerable: true,
|
|
71
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkMZXF2LF2_cjs.PLAYWRIGHT_CONTRACT_VERSION; }
|
|
72
52
|
});
|
|
73
53
|
Object.defineProperty(exports, "SCHEMA_VERSION", {
|
|
74
54
|
enumerable: true,
|
|
75
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkMZXF2LF2_cjs.SCHEMA_VERSION; }
|
|
76
56
|
});
|
|
77
57
|
Object.defineProperty(exports, "SDK_VERSION", {
|
|
78
58
|
enumerable: true,
|
|
79
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkMZXF2LF2_cjs.SDK_VERSION; }
|
|
80
60
|
});
|
|
81
61
|
Object.defineProperty(exports, "SelectorGenerator", {
|
|
82
62
|
enumerable: true,
|
|
83
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkMZXF2LF2_cjs.SelectorGenerator; }
|
|
84
64
|
});
|
|
85
65
|
Object.defineProperty(exports, "buildPlaywrightContract", {
|
|
86
66
|
enumerable: true,
|
|
87
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkMZXF2LF2_cjs.buildPlaywrightContract; }
|
|
88
68
|
});
|
|
89
69
|
Object.defineProperty(exports, "normalizeActions", {
|
|
90
70
|
enumerable: true,
|
|
91
|
-
get: function () { return
|
|
71
|
+
get: function () { return chunkMZXF2LF2_cjs.normalizeActions; }
|
|
92
72
|
});
|
|
93
73
|
Object.defineProperty(exports, "validatePlaywrightContract", {
|
|
94
74
|
enumerable: true,
|
|
95
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunkMZXF2LF2_cjs.validatePlaywrightContract; }
|
|
96
76
|
});
|
|
97
77
|
//# sourceMappingURL=index.cjs.map
|
|
98
78
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ export { Offscript } from "./core/OffscriptSDK";
|
|
|
2
2
|
export type { OffscriptEventMap } from "./core/OffscriptSDK";
|
|
3
3
|
export * from "./types/config";
|
|
4
4
|
export * from "./types/events";
|
|
5
|
-
export * from "./types/
|
|
6
|
-
export { OffscriptError, ConfigError,
|
|
5
|
+
export * from "./types/recording";
|
|
6
|
+
export { OffscriptError, ConfigError, InvalidStateError, } from "./utils/errors";
|
|
7
7
|
export type { OffscriptErrorCode } from "./utils/errors";
|
|
8
8
|
export { DataSanitizer } from "./privacy/DataSanitizer";
|
|
9
9
|
export { buildPlaywrightContract, validatePlaywrightContract, PLAYWRIGHT_CONTRACT_VERSION } from "./playwright/PlaywrightDataContract";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { createOffscript, startOffscript } from './chunk-
|
|
2
|
-
export {
|
|
3
|
-
export { ACTION_SCHEMA_VERSION, PLAYWRIGHT_CONTRACT_VERSION, SCHEMA_VERSION, SDK_VERSION, SelectorGenerator, buildPlaywrightContract, normalizeActions, validatePlaywrightContract } from './chunk-
|
|
1
|
+
export { createOffscript, startOffscript } from './chunk-R2PPPR4K.js';
|
|
2
|
+
export { ConfigError, DEFAULT_PRIVACY, DEFAULT_RECORDING, DataSanitizer, InvalidStateError, Offscript, OffscriptError } from './chunk-5ZBR6FI5.js';
|
|
3
|
+
export { ACTION_SCHEMA_VERSION, PLAYWRIGHT_CONTRACT_VERSION, SCHEMA_VERSION, SDK_VERSION, SelectorGenerator, buildPlaywrightContract, normalizeActions, validatePlaywrightContract } from './chunk-KHKIWCLM.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -43,12 +43,6 @@ export interface PlaywrightRecording {
|
|
|
43
43
|
kind: typeof PLAYWRIGHT_CONTRACT_KIND;
|
|
44
44
|
generatedAt: number;
|
|
45
45
|
sdkVersion: string;
|
|
46
|
-
session: {
|
|
47
|
-
sessionId: string;
|
|
48
|
-
executionId: string;
|
|
49
|
-
testCaseId: string;
|
|
50
|
-
platformId: string;
|
|
51
|
-
};
|
|
52
46
|
initialConditions: {
|
|
53
47
|
url?: string;
|
|
54
48
|
viewport?: {
|
|
@@ -76,7 +70,6 @@ export interface PlaywrightRecording {
|
|
|
76
70
|
}
|
|
77
71
|
export declare const CONTRACT_LIMITATIONS: string[];
|
|
78
72
|
export interface BuildInput {
|
|
79
|
-
session: PlaywrightRecording["session"];
|
|
80
73
|
actions: readonly RecordedAction[];
|
|
81
74
|
contexts?: readonly ContextEventData[];
|
|
82
75
|
extensions?: Record<string, unknown>;
|
package/dist/playwright.cjs
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMZXF2LF2_cjs = require('./chunk-MZXF2LF2.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "CONTRACT_LIMITATIONS", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkMZXF2LF2_cjs.CONTRACT_LIMITATIONS; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "PLAYWRIGHT_CONTRACT_KIND", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkMZXF2LF2_cjs.PLAYWRIGHT_CONTRACT_KIND; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "PLAYWRIGHT_CONTRACT_VERSION", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkMZXF2LF2_cjs.PLAYWRIGHT_CONTRACT_VERSION; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "SelectorGenerator", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkMZXF2LF2_cjs.SelectorGenerator; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "accessibleName", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkMZXF2LF2_cjs.accessibleName; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "buildPlaywrightContract", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkMZXF2LF2_cjs.buildPlaywrightContract; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "implicitRole", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkMZXF2LF2_cjs.implicitRole; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "isStableClass", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkMZXF2LF2_cjs.isStableClass; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "isStableId", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkMZXF2LF2_cjs.isStableId; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "labelText", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkMZXF2LF2_cjs.labelText; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "normalizeActions", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkMZXF2LF2_cjs.normalizeActions; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "validatePlaywrightContract", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkMZXF2LF2_cjs.validatePlaywrightContract; }
|
|
54
54
|
});
|
|
55
55
|
//# sourceMappingURL=playwright.cjs.map
|
|
56
56
|
//# sourceMappingURL=playwright.cjs.map
|
package/dist/playwright.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CONTRACT_LIMITATIONS, PLAYWRIGHT_CONTRACT_KIND, PLAYWRIGHT_CONTRACT_VERSION, SelectorGenerator, accessibleName, buildPlaywrightContract, implicitRole, isStableClass, isStableId, labelText, normalizeActions, validatePlaywrightContract } from './chunk-
|
|
1
|
+
export { CONTRACT_LIMITATIONS, PLAYWRIGHT_CONTRACT_KIND, PLAYWRIGHT_CONTRACT_VERSION, SelectorGenerator, accessibleName, buildPlaywrightContract, implicitRole, isStableClass, isStableId, labelText, normalizeActions, validatePlaywrightContract } from './chunk-KHKIWCLM.js';
|
|
2
2
|
//# sourceMappingURL=playwright.js.map
|
|
3
3
|
//# sourceMappingURL=playwright.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type RecordedAction } from "../types/events";
|
|
2
2
|
import { type EventSink, type Recorder } from "./types";
|
|
3
|
-
export type ActionDraft = Omit<RecordedAction, "id" | "
|
|
3
|
+
export type ActionDraft = Omit<RecordedAction, "id" | "sequence" | "timestamp">;
|
|
4
4
|
/** Ações semânticas do usuário. Eventos brutos → rascunhos de ação; a normalização é feita fora (ActionNormalizer). */
|
|
5
5
|
export declare class ActionRecorder implements Recorder {
|
|
6
6
|
private readonly sink;
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
import { type ContextEventData } from "../types/events";
|
|
2
2
|
import { type EventSink, type Recorder } from "./types";
|
|
3
|
-
export interface ContextIdentity {
|
|
4
|
-
platformId: string;
|
|
5
|
-
testCaseId: string;
|
|
6
|
-
executionId: string;
|
|
7
|
-
}
|
|
8
3
|
export declare function parseBrowser(ua: string): {
|
|
9
4
|
name?: string;
|
|
10
5
|
version?: string;
|
|
11
6
|
};
|
|
12
|
-
export declare function collectContext(
|
|
7
|
+
export declare function collectContext(reason: ContextEventData["reason"], captureSensitiveValues?: boolean): ContextEventData;
|
|
13
8
|
/** Metadados de investigação. Sem fingerprinting: apenas dados já expostos e úteis ao QA. */
|
|
14
9
|
export declare class ContextRecorder implements Recorder {
|
|
15
10
|
private readonly sink;
|
|
16
|
-
private readonly identity;
|
|
17
11
|
readonly name = "context";
|
|
18
12
|
private d;
|
|
19
|
-
constructor(sink: EventSink
|
|
13
|
+
constructor(sink: EventSink);
|
|
20
14
|
start(): void;
|
|
21
15
|
record(reason: ContextEventData["reason"]): void;
|
|
22
16
|
stop(): void;
|
|
@@ -5,14 +5,19 @@ import { type EventSink, type Recorder } from "./types";
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class HTTPRecorder implements Recorder {
|
|
7
7
|
private readonly sink;
|
|
8
|
-
private readonly ownApiUrl;
|
|
9
8
|
readonly name = "http";
|
|
10
9
|
private inflight;
|
|
11
10
|
private active;
|
|
11
|
+
private delivering;
|
|
12
|
+
private pending;
|
|
12
13
|
private restore;
|
|
13
|
-
constructor(sink: EventSink
|
|
14
|
+
constructor(sink: EventSink);
|
|
14
15
|
start(): void;
|
|
15
16
|
stop(): void;
|
|
17
|
+
private detach;
|
|
18
|
+
/** Stops new capture and allows up to two seconds for pending HTTP/body capture. */
|
|
19
|
+
drain(): Promise<void>;
|
|
20
|
+
private track;
|
|
16
21
|
private isIgnored;
|
|
17
22
|
private patchFetch;
|
|
18
23
|
private beginFetch;
|
package/dist/types/config.d.ts
CHANGED
|
@@ -64,63 +64,27 @@ export interface PrivacyConfig {
|
|
|
64
64
|
maxBodyBytes: number;
|
|
65
65
|
/** Content-types capturáveis como texto. */
|
|
66
66
|
textContentTypes: RegExp[];
|
|
67
|
-
/** Descrição da retenção local (ms) dos eventos não enviados no IndexedDB. */
|
|
68
|
-
localRetentionMs: number;
|
|
69
|
-
}
|
|
70
|
-
export interface TransportConfig {
|
|
71
|
-
batchMaxEvents: number;
|
|
72
|
-
batchMaxBytes: number;
|
|
73
|
-
flushIntervalMs: number;
|
|
74
|
-
maxMemoryEvents: number;
|
|
75
|
-
maxBufferBytes: number;
|
|
76
|
-
maxRetries: number;
|
|
77
|
-
retryBaseMs: number;
|
|
78
|
-
retryMaxMs: number;
|
|
79
|
-
/** Compressão gzip (requer suporte do backend: Content-Encoding: gzip). */
|
|
80
|
-
compress: boolean;
|
|
81
|
-
/** Limite para envio com keepalive no encerramento da página (browsers limitam a ~64KB). */
|
|
82
|
-
keepaliveMaxBytes: number;
|
|
83
|
-
/** Persistência em IndexedDB. Se indisponível, cai para memória. */
|
|
84
|
-
persist: boolean;
|
|
85
|
-
requestTimeoutMs: number;
|
|
86
67
|
}
|
|
87
68
|
export interface OffscriptConfig {
|
|
88
|
-
apiUrl: string;
|
|
89
|
-
platformId: string;
|
|
90
|
-
/** Versão/build da aplicação testada. */
|
|
91
|
-
appVersion?: string;
|
|
92
69
|
recording?: Partial<RecordingConfig>;
|
|
93
70
|
privacy?: Partial<PrivacyConfig>;
|
|
94
|
-
transport?: Partial<TransportConfig>;
|
|
95
|
-
/** Janela (ms) para relacionar requisições/erros à ação anterior. */
|
|
96
71
|
correlationWindowMs?: number;
|
|
97
|
-
/** Retoma automaticamente a sessão persistida em init() (após reload/navegação). Padrão: true. */
|
|
98
|
-
autoResume?: boolean;
|
|
99
|
-
/** Intervalo de heartbeat quando o backend não informar. */
|
|
100
|
-
heartbeatIntervalMs?: number;
|
|
101
|
-
/** Prefixo de chaves de storage. */
|
|
102
|
-
storagePrefix?: string;
|
|
103
|
-
debug?: boolean;
|
|
104
|
-
/**
|
|
105
|
-
* Mostra a barra de pausar, retomar, retornar, finalizar e nova sessão durante a gravação.
|
|
106
|
-
* Padrão: true. O overlay não entra no filme nem nas ações.
|
|
107
|
-
*/
|
|
108
72
|
controls?: boolean;
|
|
73
|
+
/** Endpoint that receives completed recordings. */
|
|
74
|
+
endpoint?: string;
|
|
75
|
+
/** Optional opaque key for a local draft; the SDK creates and stores one for tokenized sessions by default. */
|
|
76
|
+
persistenceKey?: string;
|
|
77
|
+
/** Optional custom handler called by the overlay when the user finishes. */
|
|
78
|
+
onComplete?: () => Promise<unknown>;
|
|
109
79
|
}
|
|
110
80
|
export interface ResolvedConfig {
|
|
111
|
-
apiUrl: string;
|
|
112
|
-
platformId: string;
|
|
113
|
-
appVersion?: string;
|
|
114
81
|
recording: RecordingConfig;
|
|
115
82
|
privacy: PrivacyConfig;
|
|
116
|
-
transport: TransportConfig;
|
|
117
83
|
correlationWindowMs: number;
|
|
118
|
-
autoResume: boolean;
|
|
119
|
-
heartbeatIntervalMs: number;
|
|
120
|
-
storagePrefix: string;
|
|
121
|
-
debug: boolean;
|
|
122
84
|
controls: boolean;
|
|
85
|
+
endpoint?: string;
|
|
86
|
+
persistenceKey?: string;
|
|
87
|
+
onComplete?: () => Promise<unknown>;
|
|
123
88
|
}
|
|
124
89
|
export declare const DEFAULT_RECORDING: RecordingConfig;
|
|
125
90
|
export declare const DEFAULT_PRIVACY: PrivacyConfig;
|
|
126
|
-
export declare const DEFAULT_TRANSPORT: TransportConfig;
|
package/dist/types/events.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
export declare const SCHEMA_VERSION = "1.0";
|
|
2
|
-
export declare const SDK_VERSION = "0.1.
|
|
2
|
+
export declare const SDK_VERSION = "0.1.6";
|
|
3
3
|
export type EventKind = "rrweb" | "action" | "http" | "console" | "error" | "context" | "iframe" | "lifecycle";
|
|
4
4
|
/** Envelope comum a todos os eventos. A ordem canônica é (tabId, sequence). */
|
|
5
5
|
export interface OffscriptEvent<T = unknown> {
|
|
6
6
|
/** Identificador único (idempotência). */
|
|
7
7
|
id: string;
|
|
8
8
|
kind: EventKind;
|
|
9
|
-
sessionId: string;
|
|
10
|
-
executionId: string;
|
|
11
9
|
tabId: string;
|
|
12
10
|
pageId: string;
|
|
13
11
|
/** Sequência monotônica por aba, persistida entre páginas. */
|
|
@@ -19,19 +17,6 @@ export interface OffscriptEvent<T = unknown> {
|
|
|
19
17
|
relatedActionDeltaMs?: number;
|
|
20
18
|
data: T;
|
|
21
19
|
}
|
|
22
|
-
export interface EventBatch {
|
|
23
|
-
schemaVersion: string;
|
|
24
|
-
batchId: string;
|
|
25
|
-
sessionId: string;
|
|
26
|
-
executionId: string;
|
|
27
|
-
tabId: string;
|
|
28
|
-
sequenceStart: number;
|
|
29
|
-
sequenceEnd: number;
|
|
30
|
-
createdAt: number;
|
|
31
|
-
sdkVersion: string;
|
|
32
|
-
events: OffscriptEvent[];
|
|
33
|
-
}
|
|
34
|
-
/** Contrato das ações semânticas (versionado por ACTION_SCHEMA_VERSION). */
|
|
35
20
|
export declare const ACTION_SCHEMA_VERSION = "1.0";
|
|
36
21
|
export type ActionType = "click" | "dblclick" | "hover" | "mousemove" | "drag" | "input" | "keydown" | "select" | "check" | "scroll" | "navigate" | "reload" | "focus" | "blur";
|
|
37
22
|
export interface SelectorCandidate {
|
|
@@ -63,8 +48,6 @@ export interface ElementDescriptor {
|
|
|
63
48
|
export interface RecordedAction {
|
|
64
49
|
schemaVersion: string;
|
|
65
50
|
id: string;
|
|
66
|
-
sessionId: string;
|
|
67
|
-
executionId: string;
|
|
68
51
|
timestamp: number;
|
|
69
52
|
/** Mesma sequência do envelope do evento. */
|
|
70
53
|
sequence: number;
|
|
@@ -158,11 +141,7 @@ export interface ContextEventData {
|
|
|
158
141
|
timezone?: string;
|
|
159
142
|
online: boolean;
|
|
160
143
|
visibility?: string;
|
|
161
|
-
platformId: string;
|
|
162
|
-
testCaseId: string;
|
|
163
|
-
executionId: string;
|
|
164
144
|
sdkVersion: string;
|
|
165
|
-
appVersion?: string;
|
|
166
145
|
/** A gravação guardou senhas, tokens e demais valores sem máscara. */
|
|
167
146
|
captureSensitiveValues?: boolean;
|
|
168
147
|
}
|
|
@@ -182,6 +161,6 @@ export interface IframeEventData {
|
|
|
182
161
|
limitation: string;
|
|
183
162
|
}
|
|
184
163
|
export interface LifecycleEventData {
|
|
185
|
-
type: "
|
|
164
|
+
type: "recording-start" | "page-start" | "page-end" | "pause" | "resume" | "stop" | "navigation" | "overflow" | "recorder-error";
|
|
186
165
|
detail?: Record<string, unknown>;
|
|
187
166
|
}
|