@offscript/sdk 0.1.2 → 0.1.5
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 +32 -119
- 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-2MY2FWIA.cjs +20 -0
- package/dist/chunk-2MY2FWIA.cjs.map +1 -0
- package/dist/{chunk-WUFW7TEL.js → chunk-6ROP37WI.js} +3 -5
- package/dist/chunk-6ROP37WI.js.map +1 -0
- package/dist/{chunk-KQVK5EJR.cjs → chunk-HPDLEAAL.cjs} +3 -5
- package/dist/chunk-HPDLEAAL.cjs.map +1 -0
- package/dist/{chunk-HECPMGDC.js → chunk-V2YYWGIA.js} +5 -5
- package/dist/chunk-V2YYWGIA.js.map +1 -0
- package/dist/{chunk-I6JPZAQA.cjs → chunk-VYCDQLP7.cjs} +449 -1242
- package/dist/chunk-VYCDQLP7.cjs.map +1 -0
- package/dist/{chunk-IBEPWI7S.js → chunk-XBXFGCUT.js} +446 -1234
- package/dist/chunk-XBXFGCUT.js.map +1 -0
- package/dist/core/LifecycleManager.d.ts +1 -0
- package/dist/core/OffscriptSDK.d.ts +33 -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 +6 -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
|
@@ -1,117 +1,80 @@
|
|
|
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.5";
|
|
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
|
-
constructor(config
|
|
42
|
+
private sequence;
|
|
43
|
+
private pageId;
|
|
44
|
+
private payload?;
|
|
45
|
+
private submitted;
|
|
46
|
+
private response;
|
|
47
|
+
constructor(config?: OffscriptConfig);
|
|
58
48
|
getState(): OffscriptState;
|
|
59
49
|
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
50
|
init(): Promise<void>;
|
|
68
|
-
private
|
|
69
|
-
|
|
51
|
+
private initializeDraft;
|
|
52
|
+
private restoreDraft;
|
|
53
|
+
private save;
|
|
54
|
+
startRecording(): Promise<void>;
|
|
70
55
|
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
56
|
pauseRecording(): Promise<void>;
|
|
84
57
|
resumeRecording(): Promise<void>;
|
|
85
|
-
stopRecording(): Promise<
|
|
58
|
+
stopRecording(): Promise<RecordingPayload>;
|
|
86
59
|
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. */
|
|
60
|
+
complete(options: CompleteOptions): Promise<unknown>;
|
|
61
|
+
private doComplete;
|
|
62
|
+
finishRecording(): Promise<unknown>;
|
|
63
|
+
discardRecording(): Promise<void>;
|
|
64
|
+
destroy(): Promise<void>;
|
|
95
65
|
exportPlaywrightData(): PlaywrightRecording;
|
|
96
66
|
getRecordedActions(): readonly RecordedAction[];
|
|
97
67
|
on<K extends keyof OffscriptEventMap>(type: K, fn: (payload: OffscriptEventMap[K]) => void): () => void;
|
|
98
68
|
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
69
|
emit<T>(kind: EventKind, data: T, opts?: EmitOptions): OffscriptEvent<T> | null;
|
|
101
70
|
private record;
|
|
102
71
|
private correlate;
|
|
103
72
|
private emitLifecycle;
|
|
104
73
|
private attach;
|
|
105
74
|
private startRecorders;
|
|
75
|
+
private buildPayload;
|
|
106
76
|
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;
|
|
77
|
+
private clearRecording;
|
|
78
|
+
private assertAlive;
|
|
114
79
|
private setStatus;
|
|
115
|
-
private debug;
|
|
116
|
-
static readonly version = "0.1.0";
|
|
117
80
|
}
|
|
@@ -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 chunk2MY2FWIA_cjs = require('./chunk-2MY2FWIA.cjs');
|
|
4
|
+
var chunkVYCDQLP7_cjs = require('./chunk-VYCDQLP7.cjs');
|
|
5
|
+
var chunkHPDLEAAL_cjs = require('./chunk-HPDLEAAL.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 chunk2MY2FWIA_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 chunk2MY2FWIA_cjs.startOffscript; }
|
|
20
16
|
});
|
|
21
17
|
Object.defineProperty(exports, "ConfigError", {
|
|
22
18
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkVYCDQLP7_cjs.ConfigError; }
|
|
24
20
|
});
|
|
25
21
|
Object.defineProperty(exports, "DEFAULT_PRIVACY", {
|
|
26
22
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkVYCDQLP7_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 chunkVYCDQLP7_cjs.DEFAULT_RECORDING; }
|
|
36
28
|
});
|
|
37
29
|
Object.defineProperty(exports, "DataSanitizer", {
|
|
38
30
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkVYCDQLP7_cjs.DataSanitizer; }
|
|
40
32
|
});
|
|
41
33
|
Object.defineProperty(exports, "InvalidStateError", {
|
|
42
34
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkVYCDQLP7_cjs.InvalidStateError; }
|
|
44
36
|
});
|
|
45
37
|
Object.defineProperty(exports, "Offscript", {
|
|
46
38
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkVYCDQLP7_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 chunkVYCDQLP7_cjs.OffscriptError; }
|
|
64
44
|
});
|
|
65
45
|
Object.defineProperty(exports, "ACTION_SCHEMA_VERSION", {
|
|
66
46
|
enumerable: true,
|
|
67
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkHPDLEAAL_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 chunkHPDLEAAL_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 chunkHPDLEAAL_cjs.SCHEMA_VERSION; }
|
|
76
56
|
});
|
|
77
57
|
Object.defineProperty(exports, "SDK_VERSION", {
|
|
78
58
|
enumerable: true,
|
|
79
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkHPDLEAAL_cjs.SDK_VERSION; }
|
|
80
60
|
});
|
|
81
61
|
Object.defineProperty(exports, "SelectorGenerator", {
|
|
82
62
|
enumerable: true,
|
|
83
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkHPDLEAAL_cjs.SelectorGenerator; }
|
|
84
64
|
});
|
|
85
65
|
Object.defineProperty(exports, "buildPlaywrightContract", {
|
|
86
66
|
enumerable: true,
|
|
87
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkHPDLEAAL_cjs.buildPlaywrightContract; }
|
|
88
68
|
});
|
|
89
69
|
Object.defineProperty(exports, "normalizeActions", {
|
|
90
70
|
enumerable: true,
|
|
91
|
-
get: function () { return
|
|
71
|
+
get: function () { return chunkHPDLEAAL_cjs.normalizeActions; }
|
|
92
72
|
});
|
|
93
73
|
Object.defineProperty(exports, "validatePlaywrightContract", {
|
|
94
74
|
enumerable: true,
|
|
95
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunkHPDLEAAL_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-V2YYWGIA.js';
|
|
2
|
+
export { ConfigError, DEFAULT_PRIVACY, DEFAULT_RECORDING, DataSanitizer, InvalidStateError, Offscript, OffscriptError } from './chunk-XBXFGCUT.js';
|
|
3
|
+
export { ACTION_SCHEMA_VERSION, PLAYWRIGHT_CONTRACT_VERSION, SCHEMA_VERSION, SDK_VERSION, SelectorGenerator, buildPlaywrightContract, normalizeActions, validatePlaywrightContract } from './chunk-6ROP37WI.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 chunkHPDLEAAL_cjs = require('./chunk-HPDLEAAL.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 chunkHPDLEAAL_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 chunkHPDLEAAL_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 chunkHPDLEAAL_cjs.PLAYWRIGHT_CONTRACT_VERSION; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "SelectorGenerator", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkHPDLEAAL_cjs.SelectorGenerator; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "accessibleName", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkHPDLEAAL_cjs.accessibleName; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "buildPlaywrightContract", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkHPDLEAAL_cjs.buildPlaywrightContract; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "implicitRole", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkHPDLEAAL_cjs.implicitRole; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "isStableClass", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkHPDLEAAL_cjs.isStableClass; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "isStableId", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkHPDLEAAL_cjs.isStableId; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "labelText", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkHPDLEAAL_cjs.labelText; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "normalizeActions", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkHPDLEAAL_cjs.normalizeActions; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "validatePlaywrightContract", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkHPDLEAAL_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-6ROP37WI.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,24 @@ 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
|
+
/** Opaque per-tab key supplied by the host to preserve a local draft across documents. */
|
|
74
|
+
persistenceKey?: string;
|
|
75
|
+
/** Called by the overlay when the user finishes. The host supplies endpoint and token here. */
|
|
76
|
+
onComplete?: () => Promise<unknown>;
|
|
109
77
|
}
|
|
110
78
|
export interface ResolvedConfig {
|
|
111
|
-
apiUrl: string;
|
|
112
|
-
platformId: string;
|
|
113
|
-
appVersion?: string;
|
|
114
79
|
recording: RecordingConfig;
|
|
115
80
|
privacy: PrivacyConfig;
|
|
116
|
-
transport: TransportConfig;
|
|
117
81
|
correlationWindowMs: number;
|
|
118
|
-
autoResume: boolean;
|
|
119
|
-
heartbeatIntervalMs: number;
|
|
120
|
-
storagePrefix: string;
|
|
121
|
-
debug: boolean;
|
|
122
82
|
controls: boolean;
|
|
83
|
+
persistenceKey?: string;
|
|
84
|
+
onComplete?: () => Promise<unknown>;
|
|
123
85
|
}
|
|
124
86
|
export declare const DEFAULT_RECORDING: RecordingConfig;
|
|
125
87
|
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.5";
|
|
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
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { OffscriptEvent } from "./events";
|
|
2
|
+
import type { PlaywrightRecording } from "../playwright/PlaywrightDataContract";
|
|
3
|
+
export type RecordingStatus = "idle" | "initializing" | "recording" | "paused" | "stopping" | "stopped" | "error";
|
|
4
|
+
export interface OffscriptState {
|
|
5
|
+
status: RecordingStatus;
|
|
6
|
+
pending: number;
|
|
7
|
+
lastError?: {
|
|
8
|
+
code: string;
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface CompleteOptions {
|
|
13
|
+
endpoint: string;
|
|
14
|
+
token: string;
|
|
15
|
+
}
|
|
16
|
+
export interface RecordingPayload {
|
|
17
|
+
recording: OffscriptEvent[];
|
|
18
|
+
request: OffscriptEvent[];
|
|
19
|
+
regression: PlaywrightRecording;
|
|
20
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OffscriptState, RecordingStatus
|
|
1
|
+
import type { OffscriptState, RecordingStatus } from "../types/recording";
|
|
2
2
|
/**
|
|
3
3
|
* Alvo mínimo para o overlay não importar a classe do SDK.
|
|
4
4
|
*/
|
|
@@ -10,9 +10,9 @@ export interface RecordingControlTarget {
|
|
|
10
10
|
}) => void): () => void;
|
|
11
11
|
pauseRecording(): Promise<void>;
|
|
12
12
|
resumeRecording(): Promise<void>;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
finishRecording(): Promise<unknown>;
|
|
14
|
+
startRecording(): Promise<void>;
|
|
15
|
+
discardRecording(): Promise<void>;
|
|
16
16
|
capturesSensitiveValues(): boolean;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
@@ -38,6 +38,8 @@ export declare class RecordingControls {
|
|
|
38
38
|
private readonly onViewport;
|
|
39
39
|
constructor(sdk: RecordingControlTarget);
|
|
40
40
|
mount(): void;
|
|
41
|
+
/** Independent notice so the host may destroy the controls after successful upload. */
|
|
42
|
+
showSuccess(): void;
|
|
41
43
|
unmount(): void;
|
|
42
44
|
private place;
|
|
43
45
|
private watchDom;
|