@offscript/sdk 0.1.1 → 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.
Files changed (57) hide show
  1. package/README.md +32 -119
  2. package/dist/adapters/nuxt.cjs +3 -3
  3. package/dist/adapters/nuxt.js +2 -2
  4. package/dist/adapters/vanilla.cjs +5 -5
  5. package/dist/adapters/vanilla.d.ts +2 -3
  6. package/dist/adapters/vanilla.js +3 -3
  7. package/dist/adapters/vue.cjs +3 -3
  8. package/dist/adapters/vue.js +2 -2
  9. package/dist/chunk-2MY2FWIA.cjs +20 -0
  10. package/dist/chunk-2MY2FWIA.cjs.map +1 -0
  11. package/dist/{chunk-LFXHB4PN.js → chunk-6ROP37WI.js} +5 -6
  12. package/dist/chunk-6ROP37WI.js.map +1 -0
  13. package/dist/{chunk-B6GO5FE5.cjs → chunk-HPDLEAAL.cjs} +5 -6
  14. package/dist/chunk-HPDLEAAL.cjs.map +1 -0
  15. package/dist/{chunk-MBYNQSKA.js → chunk-V2YYWGIA.js} +5 -5
  16. package/dist/chunk-V2YYWGIA.js.map +1 -0
  17. package/dist/{chunk-3NX2AGXM.cjs → chunk-VYCDQLP7.cjs} +1084 -1170
  18. package/dist/chunk-VYCDQLP7.cjs.map +1 -0
  19. package/dist/{chunk-3OSCH7J2.js → chunk-XBXFGCUT.js} +1081 -1162
  20. package/dist/chunk-XBXFGCUT.js.map +1 -0
  21. package/dist/core/LifecycleManager.d.ts +1 -0
  22. package/dist/core/OffscriptSDK.d.ts +34 -52
  23. package/dist/core/RecordingStore.d.ts +26 -0
  24. package/dist/index.cjs +20 -40
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.js +3 -3
  27. package/dist/playwright/PlaywrightDataContract.d.ts +0 -7
  28. package/dist/playwright.cjs +13 -13
  29. package/dist/playwright.js +1 -1
  30. package/dist/privacy/DataSanitizer.d.ts +1 -0
  31. package/dist/recorders/ActionRecorder.d.ts +1 -1
  32. package/dist/recorders/ContextRecorder.d.ts +2 -8
  33. package/dist/recorders/HTTPRecorder.d.ts +7 -2
  34. package/dist/types/config.d.ts +13 -41
  35. package/dist/types/events.d.ts +4 -23
  36. package/dist/types/recording.d.ts +20 -0
  37. package/dist/ui/RecordingControls.d.ts +62 -0
  38. package/dist/utils/errors.d.ts +1 -18
  39. package/docs/api-contract.md +4 -53
  40. package/docs/architecture.md +5 -34
  41. package/docs/event-contract.md +3 -24
  42. package/docs/playwright-contract.md +3 -37
  43. package/package.json +2 -2
  44. package/dist/chunk-3NX2AGXM.cjs.map +0 -1
  45. package/dist/chunk-3OSCH7J2.js.map +0 -1
  46. package/dist/chunk-B6GO5FE5.cjs.map +0 -1
  47. package/dist/chunk-HAPNSHFG.cjs +0 -20
  48. package/dist/chunk-HAPNSHFG.cjs.map +0 -1
  49. package/dist/chunk-LFXHB4PN.js.map +0 -1
  50. package/dist/chunk-MBYNQSKA.js.map +0 -1
  51. package/dist/core/ApiClient.d.ts +0 -24
  52. package/dist/core/SessionManager.d.ts +0 -44
  53. package/dist/transport/EventQueue.d.ts +0 -28
  54. package/dist/transport/EventTransport.d.ts +0 -84
  55. package/dist/transport/PersistentBuffer.d.ts +0 -60
  56. package/dist/transport/RetryManager.d.ts +0 -9
  57. package/dist/types/session.d.ts +0 -77
@@ -1,98 +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 { OffscriptState, RecordingStatus, SessionInfo, StartRecordingOptions, StopSummary } from "../types/session";
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: OffscriptError | Error;
14
- sessionStart: SessionInfo;
15
- sessionEnd: StopSummary;
16
- flush: {
17
- events: number;
18
- batchId: string;
19
- duplicate: boolean;
20
- };
21
- overflow: {
22
- dropped: number;
23
- };
24
- disabled: {
25
- reason?: string;
26
- };
12
+ error: Error;
13
+ recordingStart: undefined;
14
+ recordingEnd: RecordingPayload;
27
15
  };
28
16
  export declare class Offscript implements EventSink {
29
- private readonly bus;
17
+ static readonly version = "0.1.5";
30
18
  readonly config: ResolvedConfig;
31
19
  readonly sanitizer: DataSanitizer;
20
+ private readonly bus;
32
21
  private status;
33
22
  private lastError?;
34
- private sessions;
35
- private transport?;
36
- private lifecycle?;
37
23
  private recorders;
38
24
  private rrweb?;
39
25
  private actions?;
40
26
  private context?;
27
+ private lifecycle?;
28
+ private controls?;
41
29
  private accepting;
30
+ private destroyed;
42
31
  private initPromise?;
32
+ private store?;
33
+ private suspended;
34
+ private restorePromise?;
43
35
  private startPromise?;
44
36
  private stopPromise?;
45
- private destroyed;
37
+ private completePromise?;
38
+ private events;
46
39
  private recent;
47
40
  private actionLog;
48
41
  private contextLog;
49
- private eventCount;
50
- private metrics;
51
- constructor(config: OffscriptConfig);
42
+ private sequence;
43
+ private pageId;
44
+ private payload?;
45
+ private submitted;
46
+ private response;
47
+ constructor(config?: OffscriptConfig);
52
48
  getState(): OffscriptState;
53
- getMetrics(): {
54
- emitted: number;
55
- dropped: number;
56
- avgEmitMs: number;
57
- bufferKind?: string;
58
- };
59
- /** Idempotente. Prepara armazenamento/transporte e retoma sessão persistida (reload/MPA). */
49
+ capturesSensitiveValues(): boolean;
60
50
  init(): Promise<void>;
61
- private doInit;
62
- startRecording(opts: StartRecordingOptions): Promise<SessionInfo>;
51
+ private initializeDraft;
52
+ private restoreDraft;
53
+ private save;
54
+ startRecording(): Promise<void>;
63
55
  private doStart;
64
- private resumePersisted;
65
56
  pauseRecording(): Promise<void>;
66
57
  resumeRecording(): Promise<void>;
67
- stopRecording(): Promise<StopSummary>;
58
+ stopRecording(): Promise<RecordingPayload>;
68
59
  private doStop;
69
- /**
70
- * Libera todos os recursos. Por padrão encerra a gravação ativa; com `{ complete: false }` apenas
71
- * desanexa a instrumentação e mantém a sessão persistida para ser retomada por outra instância.
72
- */
73
- destroy(opts?: {
74
- complete?: boolean;
75
- }): Promise<void>;
76
- /** 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>;
77
65
  exportPlaywrightData(): PlaywrightRecording;
78
66
  getRecordedActions(): readonly RecordedAction[];
79
67
  on<K extends keyof OffscriptEventMap>(type: K, fn: (payload: OffscriptEventMap[K]) => void): () => void;
80
68
  off<K extends keyof OffscriptEventMap>(type: K, fn: (payload: OffscriptEventMap[K]) => void): void;
81
- /** Usado pelos recorders. Não confundir com os eventos públicos (`on`). */
82
69
  emit<T>(kind: EventKind, data: T, opts?: EmitOptions): OffscriptEvent<T> | null;
83
70
  private record;
84
71
  private correlate;
85
72
  private emitLifecycle;
86
73
  private attach;
87
74
  private startRecorders;
75
+ private buildPayload;
88
76
  private stopRecorders;
89
- private teardown;
90
- private onHeartbeat;
91
- /** Backend desativou a gravação: encerra com flush de melhor esforço. */
92
- private shutdownRemote;
93
- private onFatal;
94
- private fail;
77
+ private clearRecording;
78
+ private assertAlive;
95
79
  private setStatus;
96
- private debug;
97
- static readonly version = "0.1.0";
98
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 chunkHAPNSHFG_cjs = require('./chunk-HAPNSHFG.cjs');
4
- var chunk3NX2AGXM_cjs = require('./chunk-3NX2AGXM.cjs');
5
- var chunkB6GO5FE5_cjs = require('./chunk-B6GO5FE5.cjs');
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 chunkHAPNSHFG_cjs.createOffscript; }
11
+ get: function () { return chunk2MY2FWIA_cjs.createOffscript; }
12
12
  });
13
13
  Object.defineProperty(exports, "startOffscript", {
14
14
  enumerable: true,
15
- get: function () { return chunkHAPNSHFG_cjs.startOffscript; }
16
- });
17
- Object.defineProperty(exports, "AuthError", {
18
- enumerable: true,
19
- get: function () { return chunk3NX2AGXM_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 chunk3NX2AGXM_cjs.ConfigError; }
19
+ get: function () { return chunkVYCDQLP7_cjs.ConfigError; }
24
20
  });
25
21
  Object.defineProperty(exports, "DEFAULT_PRIVACY", {
26
22
  enumerable: true,
27
- get: function () { return chunk3NX2AGXM_cjs.DEFAULT_PRIVACY; }
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 chunk3NX2AGXM_cjs.DEFAULT_RECORDING; }
32
- });
33
- Object.defineProperty(exports, "DEFAULT_TRANSPORT", {
34
- enumerable: true,
35
- get: function () { return chunk3NX2AGXM_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 chunk3NX2AGXM_cjs.DataSanitizer; }
31
+ get: function () { return chunkVYCDQLP7_cjs.DataSanitizer; }
40
32
  });
41
33
  Object.defineProperty(exports, "InvalidStateError", {
42
34
  enumerable: true,
43
- get: function () { return chunk3NX2AGXM_cjs.InvalidStateError; }
35
+ get: function () { return chunkVYCDQLP7_cjs.InvalidStateError; }
44
36
  });
45
37
  Object.defineProperty(exports, "Offscript", {
46
38
  enumerable: true,
47
- get: function () { return chunk3NX2AGXM_cjs.Offscript; }
39
+ get: function () { return chunkVYCDQLP7_cjs.Offscript; }
48
40
  });
49
41
  Object.defineProperty(exports, "OffscriptError", {
50
42
  enumerable: true,
51
- get: function () { return chunk3NX2AGXM_cjs.OffscriptError; }
52
- });
53
- Object.defineProperty(exports, "SessionDisabledError", {
54
- enumerable: true,
55
- get: function () { return chunk3NX2AGXM_cjs.SessionDisabledError; }
56
- });
57
- Object.defineProperty(exports, "SessionExpiredError", {
58
- enumerable: true,
59
- get: function () { return chunk3NX2AGXM_cjs.SessionExpiredError; }
60
- });
61
- Object.defineProperty(exports, "TransportError", {
62
- enumerable: true,
63
- get: function () { return chunk3NX2AGXM_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 chunkB6GO5FE5_cjs.ACTION_SCHEMA_VERSION; }
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 chunkB6GO5FE5_cjs.PLAYWRIGHT_CONTRACT_VERSION; }
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 chunkB6GO5FE5_cjs.SCHEMA_VERSION; }
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 chunkB6GO5FE5_cjs.SDK_VERSION; }
59
+ get: function () { return chunkHPDLEAAL_cjs.SDK_VERSION; }
80
60
  });
81
61
  Object.defineProperty(exports, "SelectorGenerator", {
82
62
  enumerable: true,
83
- get: function () { return chunkB6GO5FE5_cjs.SelectorGenerator; }
63
+ get: function () { return chunkHPDLEAAL_cjs.SelectorGenerator; }
84
64
  });
85
65
  Object.defineProperty(exports, "buildPlaywrightContract", {
86
66
  enumerable: true,
87
- get: function () { return chunkB6GO5FE5_cjs.buildPlaywrightContract; }
67
+ get: function () { return chunkHPDLEAAL_cjs.buildPlaywrightContract; }
88
68
  });
89
69
  Object.defineProperty(exports, "normalizeActions", {
90
70
  enumerable: true,
91
- get: function () { return chunkB6GO5FE5_cjs.normalizeActions; }
71
+ get: function () { return chunkHPDLEAAL_cjs.normalizeActions; }
92
72
  });
93
73
  Object.defineProperty(exports, "validatePlaywrightContract", {
94
74
  enumerable: true,
95
- get: function () { return chunkB6GO5FE5_cjs.validatePlaywrightContract; }
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/session";
6
- export { OffscriptError, ConfigError, AuthError, SessionExpiredError, SessionDisabledError, InvalidStateError, TransportError, } from "./utils/errors";
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-MBYNQSKA.js';
2
- export { AuthError, ConfigError, DEFAULT_PRIVACY, DEFAULT_RECORDING, DEFAULT_TRANSPORT, DataSanitizer, InvalidStateError, Offscript, OffscriptError, SessionDisabledError, SessionExpiredError, TransportError } from './chunk-3OSCH7J2.js';
3
- export { ACTION_SCHEMA_VERSION, PLAYWRIGHT_CONTRACT_VERSION, SCHEMA_VERSION, SDK_VERSION, SelectorGenerator, buildPlaywrightContract, normalizeActions, validatePlaywrightContract } from './chunk-LFXHB4PN.js';
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>;
@@ -1,56 +1,56 @@
1
1
  'use strict';
2
2
 
3
- var chunkB6GO5FE5_cjs = require('./chunk-B6GO5FE5.cjs');
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 chunkB6GO5FE5_cjs.CONTRACT_LIMITATIONS; }
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 chunkB6GO5FE5_cjs.PLAYWRIGHT_CONTRACT_KIND; }
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 chunkB6GO5FE5_cjs.PLAYWRIGHT_CONTRACT_VERSION; }
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 chunkB6GO5FE5_cjs.SelectorGenerator; }
21
+ get: function () { return chunkHPDLEAAL_cjs.SelectorGenerator; }
22
22
  });
23
23
  Object.defineProperty(exports, "accessibleName", {
24
24
  enumerable: true,
25
- get: function () { return chunkB6GO5FE5_cjs.accessibleName; }
25
+ get: function () { return chunkHPDLEAAL_cjs.accessibleName; }
26
26
  });
27
27
  Object.defineProperty(exports, "buildPlaywrightContract", {
28
28
  enumerable: true,
29
- get: function () { return chunkB6GO5FE5_cjs.buildPlaywrightContract; }
29
+ get: function () { return chunkHPDLEAAL_cjs.buildPlaywrightContract; }
30
30
  });
31
31
  Object.defineProperty(exports, "implicitRole", {
32
32
  enumerable: true,
33
- get: function () { return chunkB6GO5FE5_cjs.implicitRole; }
33
+ get: function () { return chunkHPDLEAAL_cjs.implicitRole; }
34
34
  });
35
35
  Object.defineProperty(exports, "isStableClass", {
36
36
  enumerable: true,
37
- get: function () { return chunkB6GO5FE5_cjs.isStableClass; }
37
+ get: function () { return chunkHPDLEAAL_cjs.isStableClass; }
38
38
  });
39
39
  Object.defineProperty(exports, "isStableId", {
40
40
  enumerable: true,
41
- get: function () { return chunkB6GO5FE5_cjs.isStableId; }
41
+ get: function () { return chunkHPDLEAAL_cjs.isStableId; }
42
42
  });
43
43
  Object.defineProperty(exports, "labelText", {
44
44
  enumerable: true,
45
- get: function () { return chunkB6GO5FE5_cjs.labelText; }
45
+ get: function () { return chunkHPDLEAAL_cjs.labelText; }
46
46
  });
47
47
  Object.defineProperty(exports, "normalizeActions", {
48
48
  enumerable: true,
49
- get: function () { return chunkB6GO5FE5_cjs.normalizeActions; }
49
+ get: function () { return chunkHPDLEAAL_cjs.normalizeActions; }
50
50
  });
51
51
  Object.defineProperty(exports, "validatePlaywrightContract", {
52
52
  enumerable: true,
53
- get: function () { return chunkB6GO5FE5_cjs.validatePlaywrightContract; }
53
+ get: function () { return chunkHPDLEAAL_cjs.validatePlaywrightContract; }
54
54
  });
55
55
  //# sourceMappingURL=playwright.cjs.map
56
56
  //# sourceMappingURL=playwright.cjs.map
@@ -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-LFXHB4PN.js';
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
@@ -9,6 +9,7 @@ export declare class DataSanitizer {
9
9
  private readonly cfg;
10
10
  private readonly headerSet;
11
11
  private readonly extraKeys;
12
+ private readonly open;
12
13
  constructor(cfg: PrivacyConfig);
13
14
  isSensitiveKey(key: string): boolean;
14
15
  /** Mascara padrões sensíveis em texto livre (JWT, Bearer, CPF, CNPJ, cartões). */
@@ -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" | "sessionId" | "executionId" | "sequence" | "timestamp">;
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(id: ContextIdentity, reason: ContextEventData["reason"], appVersion?: string): ContextEventData;
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, identity: () => ContextIdentity);
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, ownApiUrl: string);
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;
@@ -55,61 +55,33 @@ export interface PrivacyConfig {
55
55
  redactHeaders: string[];
56
56
  /** Chaves adicionais (query/body/json) a redigir. */
57
57
  redactKeys: string[];
58
+ /**
59
+ * Guarda os valores sensíveis por completo: senha, token, cookie, CPF, cartão.
60
+ * Padrão: false. Quando true, nada vira [REDACTED].
61
+ */
62
+ captureSensitiveValues: boolean;
58
63
  /** Tamanho máximo (bytes) de cada body capturado. */
59
64
  maxBodyBytes: number;
60
65
  /** Content-types capturáveis como texto. */
61
66
  textContentTypes: RegExp[];
62
- /** Descrição da retenção local (ms) dos eventos não enviados no IndexedDB. */
63
- localRetentionMs: number;
64
- }
65
- export interface TransportConfig {
66
- batchMaxEvents: number;
67
- batchMaxBytes: number;
68
- flushIntervalMs: number;
69
- maxMemoryEvents: number;
70
- maxBufferBytes: number;
71
- maxRetries: number;
72
- retryBaseMs: number;
73
- retryMaxMs: number;
74
- /** Compressão gzip (requer suporte do backend: Content-Encoding: gzip). */
75
- compress: boolean;
76
- /** Limite para envio com keepalive no encerramento da página (browsers limitam a ~64KB). */
77
- keepaliveMaxBytes: number;
78
- /** Persistência em IndexedDB. Se indisponível, cai para memória. */
79
- persist: boolean;
80
- requestTimeoutMs: number;
81
67
  }
82
68
  export interface OffscriptConfig {
83
- apiUrl: string;
84
- platformId: string;
85
- /** Versão/build da aplicação testada. */
86
- appVersion?: string;
87
69
  recording?: Partial<RecordingConfig>;
88
70
  privacy?: Partial<PrivacyConfig>;
89
- transport?: Partial<TransportConfig>;
90
- /** Janela (ms) para relacionar requisições/erros à ação anterior. */
91
71
  correlationWindowMs?: number;
92
- /** Retoma automaticamente a sessão persistida em init() (após reload/navegação). Padrão: true. */
93
- autoResume?: boolean;
94
- /** Intervalo de heartbeat quando o backend não informar. */
95
- heartbeatIntervalMs?: number;
96
- /** Prefixo de chaves de storage. */
97
- storagePrefix?: string;
98
- debug?: boolean;
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>;
99
77
  }
100
78
  export interface ResolvedConfig {
101
- apiUrl: string;
102
- platformId: string;
103
- appVersion?: string;
104
79
  recording: RecordingConfig;
105
80
  privacy: PrivacyConfig;
106
- transport: TransportConfig;
107
81
  correlationWindowMs: number;
108
- autoResume: boolean;
109
- heartbeatIntervalMs: number;
110
- storagePrefix: string;
111
- debug: boolean;
82
+ controls: boolean;
83
+ persistenceKey?: string;
84
+ onComplete?: () => Promise<unknown>;
112
85
  }
113
86
  export declare const DEFAULT_RECORDING: RecordingConfig;
114
87
  export declare const DEFAULT_PRIVACY: PrivacyConfig;
115
- export declare const DEFAULT_TRANSPORT: TransportConfig;
@@ -1,13 +1,11 @@
1
1
  export declare const SCHEMA_VERSION = "1.0";
2
- export declare const SDK_VERSION = "0.1.0";
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,9 @@ 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;
145
+ /** A gravação guardou senhas, tokens e demais valores sem máscara. */
146
+ captureSensitiveValues?: boolean;
166
147
  }
167
148
  export interface IframeEventData {
168
149
  phase: "present" | "removed" | "focus" | "blur" | "resized";
@@ -180,6 +161,6 @@ export interface IframeEventData {
180
161
  limitation: string;
181
162
  }
182
163
  export interface LifecycleEventData {
183
- type: "session-start" | "session-resume" | "page-start" | "page-end" | "pause" | "resume" | "stop" | "navigation" | "overflow" | "recorder-error";
164
+ type: "recording-start" | "page-start" | "page-end" | "pause" | "resume" | "stop" | "navigation" | "overflow" | "recorder-error";
184
165
  detail?: Record<string, unknown>;
185
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
+ }