@offscript/sdk 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +133 -2
  2. package/dist/adapters/nuxt.cjs +16 -0
  3. package/dist/adapters/nuxt.cjs.map +1 -0
  4. package/dist/adapters/nuxt.d.ts +10 -0
  5. package/dist/adapters/nuxt.js +14 -0
  6. package/dist/adapters/nuxt.js.map +1 -0
  7. package/dist/adapters/vanilla.cjs +18 -0
  8. package/dist/adapters/vanilla.cjs.map +1 -0
  9. package/dist/adapters/vanilla.d.ts +6 -0
  10. package/dist/adapters/vanilla.js +5 -0
  11. package/dist/adapters/vanilla.js.map +1 -0
  12. package/dist/adapters/vue.cjs +24 -0
  13. package/dist/adapters/vue.cjs.map +1 -0
  14. package/dist/adapters/vue.d.ts +18 -0
  15. package/dist/adapters/vue.js +21 -0
  16. package/dist/adapters/vue.js.map +1 -0
  17. package/dist/chunk-3NX2AGXM.cjs +2671 -0
  18. package/dist/chunk-3NX2AGXM.cjs.map +1 -0
  19. package/dist/chunk-3OSCH7J2.js +2658 -0
  20. package/dist/chunk-3OSCH7J2.js.map +1 -0
  21. package/dist/chunk-B6GO5FE5.cjs +442 -0
  22. package/dist/chunk-B6GO5FE5.cjs.map +1 -0
  23. package/dist/chunk-HAPNSHFG.cjs +20 -0
  24. package/dist/chunk-HAPNSHFG.cjs.map +1 -0
  25. package/dist/chunk-LFXHB4PN.js +426 -0
  26. package/dist/chunk-LFXHB4PN.js.map +1 -0
  27. package/dist/chunk-MBYNQSKA.js +17 -0
  28. package/dist/chunk-MBYNQSKA.js.map +1 -0
  29. package/dist/core/ApiClient.d.ts +24 -0
  30. package/dist/core/LifecycleManager.d.ts +26 -0
  31. package/dist/core/OffscriptSDK.d.ts +98 -0
  32. package/dist/core/SessionManager.d.ts +44 -0
  33. package/dist/core/config.d.ts +2 -0
  34. package/dist/index.cjs +98 -0
  35. package/dist/index.cjs.map +1 -0
  36. package/dist/index.d.ts +13 -0
  37. package/dist/index.js +5 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/playwright/ActionNormalizer.d.ts +37 -0
  40. package/dist/playwright/PlaywrightDataContract.d.ts +88 -0
  41. package/dist/playwright/SelectorGenerator.d.ts +26 -0
  42. package/dist/playwright/index.d.ts +3 -0
  43. package/dist/playwright.cjs +56 -0
  44. package/dist/playwright.cjs.map +1 -0
  45. package/dist/playwright.js +3 -0
  46. package/dist/playwright.js.map +1 -0
  47. package/dist/privacy/DataSanitizer.d.ts +32 -0
  48. package/dist/privacy/PrivacyConfig.d.ts +4 -0
  49. package/dist/recorders/ActionRecorder.d.ts +46 -0
  50. package/dist/recorders/ContextRecorder.d.ts +23 -0
  51. package/dist/recorders/ErrorRecorder.d.ts +20 -0
  52. package/dist/recorders/HTTPRecorder.d.ts +28 -0
  53. package/dist/recorders/IframeRecorder.d.ts +19 -0
  54. package/dist/recorders/RRWebRecorder.d.ts +29 -0
  55. package/dist/recorders/types.d.ts +25 -0
  56. package/dist/transport/EventQueue.d.ts +28 -0
  57. package/dist/transport/EventTransport.d.ts +84 -0
  58. package/dist/transport/PersistentBuffer.d.ts +60 -0
  59. package/dist/transport/RetryManager.d.ts +9 -0
  60. package/dist/types/config.d.ts +115 -0
  61. package/dist/types/events.d.ts +185 -0
  62. package/dist/types/session.d.ts +77 -0
  63. package/dist/utils/errors.d.ts +41 -0
  64. package/dist/utils/id.d.ts +1 -0
  65. package/dist/utils/misc.d.ts +20 -0
  66. package/docs/api-contract.md +56 -0
  67. package/docs/architecture.md +38 -0
  68. package/docs/event-contract.md +26 -0
  69. package/docs/playwright-contract.md +39 -0
  70. package/package.json +78 -3
@@ -0,0 +1,98 @@
1
+ import type { OffscriptConfig, ResolvedConfig } from "../types/config";
2
+ import { type EventKind, type OffscriptEvent, type RecordedAction } from "../types/events";
3
+ import type { OffscriptState, RecordingStatus, SessionInfo, StartRecordingOptions, StopSummary } from "../types/session";
4
+ import { DataSanitizer } from "../privacy/DataSanitizer";
5
+ import type { EmitOptions, EventSink } from "../recorders/types";
6
+ import { OffscriptError } from "../utils/errors";
7
+ import { type PlaywrightRecording } from "../playwright/PlaywrightDataContract";
8
+ export type OffscriptEventMap = {
9
+ statusChange: {
10
+ from: RecordingStatus;
11
+ to: RecordingStatus;
12
+ };
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
+ };
27
+ };
28
+ export declare class Offscript implements EventSink {
29
+ private readonly bus;
30
+ readonly config: ResolvedConfig;
31
+ readonly sanitizer: DataSanitizer;
32
+ private status;
33
+ private lastError?;
34
+ private sessions;
35
+ private transport?;
36
+ private lifecycle?;
37
+ private recorders;
38
+ private rrweb?;
39
+ private actions?;
40
+ private context?;
41
+ private accepting;
42
+ private initPromise?;
43
+ private startPromise?;
44
+ private stopPromise?;
45
+ private destroyed;
46
+ private recent;
47
+ private actionLog;
48
+ private contextLog;
49
+ private eventCount;
50
+ private metrics;
51
+ constructor(config: OffscriptConfig);
52
+ 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). */
60
+ init(): Promise<void>;
61
+ private doInit;
62
+ startRecording(opts: StartRecordingOptions): Promise<SessionInfo>;
63
+ private doStart;
64
+ private resumePersisted;
65
+ pauseRecording(): Promise<void>;
66
+ resumeRecording(): Promise<void>;
67
+ stopRecording(): Promise<StopSummary>;
68
+ 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. */
77
+ exportPlaywrightData(): PlaywrightRecording;
78
+ getRecordedActions(): readonly RecordedAction[];
79
+ on<K extends keyof OffscriptEventMap>(type: K, fn: (payload: OffscriptEventMap[K]) => void): () => void;
80
+ 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
+ emit<T>(kind: EventKind, data: T, opts?: EmitOptions): OffscriptEvent<T> | null;
83
+ private record;
84
+ private correlate;
85
+ private emitLifecycle;
86
+ private attach;
87
+ private startRecorders;
88
+ 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;
95
+ private setStatus;
96
+ private debug;
97
+ static readonly version = "0.1.0";
98
+ }
@@ -0,0 +1,44 @@
1
+ import type { ResolvedConfig } from "../types/config";
2
+ import type { CreateSessionResponse, HeartbeatResponse, PersistedSessionState, SessionInfo, StartRecordingOptions } from "../types/session";
3
+ import { ApiClient } from "./ApiClient";
4
+ /**
5
+ * Identidade da sessão, persistência por aba (sessionStorage), sequência e heartbeat.
6
+ *
7
+ * Política multi-aba: cada aba grava de forma independente na MESMA sessão/execução, com `tabId`
8
+ * próprio e sequência própria. A ordem canônica é (tabId, sequence); entre abas usa-se o timestamp.
9
+ * Abas clonadas (window.open copia o sessionStorage) recebem um novo tabId via Web Locks quando disponível.
10
+ */
11
+ export declare class SessionManager {
12
+ private readonly cfg;
13
+ private state;
14
+ private info;
15
+ private seq;
16
+ private heartbeatTimer?;
17
+ private token;
18
+ private readonly storageKey;
19
+ private readonly seqKey;
20
+ readonly api: ApiClient;
21
+ disabledReason?: string;
22
+ constructor(cfg: ResolvedConfig);
23
+ get session(): SessionInfo | null;
24
+ get tabId(): string | undefined;
25
+ get currentToken(): string;
26
+ loadPersisted(): PersistedSessionState | null;
27
+ private persist;
28
+ setStatus(status: "recording" | "paused"): void;
29
+ clearPersisted(): void;
30
+ nextSequence(): number;
31
+ get lastSequence(): number;
32
+ /** Sobe a sequência até pelo menos `n` (ex.: maior sequência encontrada no buffer). */
33
+ ensureSequenceAtLeast(n: number): void;
34
+ newPage(): string;
35
+ get pageCount(): number;
36
+ /** Cria (ou obtém, de forma idempotente) a sessão no backend. */
37
+ create(opts: StartRecordingOptions, context: Record<string, unknown>): Promise<CreateSessionResponse>;
38
+ /** Reidrata sessão persistida (reload/navegação MPA) após validar no backend. */
39
+ resume(state: PersistedSessionState): Promise<HeartbeatResponse>;
40
+ startHeartbeat(onResult: (r: HeartbeatResponse) => void, onError: (e: unknown) => void, pending: () => number, status: () => string): void;
41
+ stopHeartbeat(): void;
42
+ complete(summary: Record<string, unknown>): Promise<boolean>;
43
+ reset(): void;
44
+ }
@@ -0,0 +1,2 @@
1
+ import { type OffscriptConfig, type ResolvedConfig } from "../types/config";
2
+ export declare function resolveConfig(input: OffscriptConfig): ResolvedConfig;
package/dist/index.cjs ADDED
@@ -0,0 +1,98 @@
1
+ 'use strict';
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');
6
+
7
+
8
+
9
+ Object.defineProperty(exports, "createOffscript", {
10
+ enumerable: true,
11
+ get: function () { return chunkHAPNSHFG_cjs.createOffscript; }
12
+ });
13
+ Object.defineProperty(exports, "startOffscript", {
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; }
20
+ });
21
+ Object.defineProperty(exports, "ConfigError", {
22
+ enumerable: true,
23
+ get: function () { return chunk3NX2AGXM_cjs.ConfigError; }
24
+ });
25
+ Object.defineProperty(exports, "DEFAULT_PRIVACY", {
26
+ enumerable: true,
27
+ get: function () { return chunk3NX2AGXM_cjs.DEFAULT_PRIVACY; }
28
+ });
29
+ Object.defineProperty(exports, "DEFAULT_RECORDING", {
30
+ 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; }
36
+ });
37
+ Object.defineProperty(exports, "DataSanitizer", {
38
+ enumerable: true,
39
+ get: function () { return chunk3NX2AGXM_cjs.DataSanitizer; }
40
+ });
41
+ Object.defineProperty(exports, "InvalidStateError", {
42
+ enumerable: true,
43
+ get: function () { return chunk3NX2AGXM_cjs.InvalidStateError; }
44
+ });
45
+ Object.defineProperty(exports, "Offscript", {
46
+ enumerable: true,
47
+ get: function () { return chunk3NX2AGXM_cjs.Offscript; }
48
+ });
49
+ Object.defineProperty(exports, "OffscriptError", {
50
+ 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; }
64
+ });
65
+ Object.defineProperty(exports, "ACTION_SCHEMA_VERSION", {
66
+ enumerable: true,
67
+ get: function () { return chunkB6GO5FE5_cjs.ACTION_SCHEMA_VERSION; }
68
+ });
69
+ Object.defineProperty(exports, "PLAYWRIGHT_CONTRACT_VERSION", {
70
+ enumerable: true,
71
+ get: function () { return chunkB6GO5FE5_cjs.PLAYWRIGHT_CONTRACT_VERSION; }
72
+ });
73
+ Object.defineProperty(exports, "SCHEMA_VERSION", {
74
+ enumerable: true,
75
+ get: function () { return chunkB6GO5FE5_cjs.SCHEMA_VERSION; }
76
+ });
77
+ Object.defineProperty(exports, "SDK_VERSION", {
78
+ enumerable: true,
79
+ get: function () { return chunkB6GO5FE5_cjs.SDK_VERSION; }
80
+ });
81
+ Object.defineProperty(exports, "SelectorGenerator", {
82
+ enumerable: true,
83
+ get: function () { return chunkB6GO5FE5_cjs.SelectorGenerator; }
84
+ });
85
+ Object.defineProperty(exports, "buildPlaywrightContract", {
86
+ enumerable: true,
87
+ get: function () { return chunkB6GO5FE5_cjs.buildPlaywrightContract; }
88
+ });
89
+ Object.defineProperty(exports, "normalizeActions", {
90
+ enumerable: true,
91
+ get: function () { return chunkB6GO5FE5_cjs.normalizeActions; }
92
+ });
93
+ Object.defineProperty(exports, "validatePlaywrightContract", {
94
+ enumerable: true,
95
+ get: function () { return chunkB6GO5FE5_cjs.validatePlaywrightContract; }
96
+ });
97
+ //# sourceMappingURL=index.cjs.map
98
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
@@ -0,0 +1,13 @@
1
+ export { Offscript } from "./core/OffscriptSDK";
2
+ export type { OffscriptEventMap } from "./core/OffscriptSDK";
3
+ export * from "./types/config";
4
+ export * from "./types/events";
5
+ export * from "./types/session";
6
+ export { OffscriptError, ConfigError, AuthError, SessionExpiredError, SessionDisabledError, InvalidStateError, TransportError, } from "./utils/errors";
7
+ export type { OffscriptErrorCode } from "./utils/errors";
8
+ export { DataSanitizer } from "./privacy/DataSanitizer";
9
+ export { buildPlaywrightContract, validatePlaywrightContract, PLAYWRIGHT_CONTRACT_VERSION } from "./playwright/PlaywrightDataContract";
10
+ export type { PlaywrightRecording, PlaywrightStep } from "./playwright/PlaywrightDataContract";
11
+ export { normalizeActions } from "./playwright/ActionNormalizer";
12
+ export { SelectorGenerator } from "./playwright/SelectorGenerator";
13
+ export { createOffscript, startOffscript } from "./adapters/vanilla";
package/dist/index.js ADDED
@@ -0,0 +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';
4
+ //# sourceMappingURL=index.js.map
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,37 @@
1
+ import type { RecordedAction } from "../types/events";
2
+ export type StepType = "click" | "dblclick" | "fill" | "press" | "select" | "check" | "uncheck" | "hover" | "drag" | "scroll" | "navigate" | "reload";
3
+ export interface NormalizedStep {
4
+ type: StepType;
5
+ timestamp: number;
6
+ url: string;
7
+ selector?: string;
8
+ selectorUnique?: boolean;
9
+ selectorCandidates?: RecordedAction["selectorCandidates"];
10
+ element?: RecordedAction["element"];
11
+ coordinates?: {
12
+ x: number;
13
+ y: number;
14
+ };
15
+ viewport?: {
16
+ width: number;
17
+ height: number;
18
+ };
19
+ args?: Record<string, unknown>;
20
+ expectsNavigation?: {
21
+ to: string;
22
+ };
23
+ sourceActionIds: string[];
24
+ causedByActionId?: string;
25
+ metadata?: Record<string, unknown>;
26
+ }
27
+ /**
28
+ * Converte ações brutas em passos semânticos mínimos, sem perder rastreabilidade:
29
+ * - click, click, dblclick → dblclick
30
+ * - click em checkbox/radio + check → check/uncheck
31
+ * - vários input no mesmo campo → um único fill
32
+ * - input + Enter → fill + press
33
+ * - focus/blur/mousemove/hover isolados são descartados (preservados apenas nos eventos brutos)
34
+ * - scrolls consecutivos no mesmo alvo → um scroll
35
+ * - navigate logo após click/Enter → vira `expectsNavigation` do passo causador
36
+ */
37
+ export declare function normalizeActions(actions: readonly RecordedAction[]): NormalizedStep[];
@@ -0,0 +1,88 @@
1
+ import type { ActionType, ContextEventData, RecordedAction, SelectorCandidate } from "../types/events";
2
+ import { type NormalizedStep } from "./ActionNormalizer";
3
+ /**
4
+ * Contrato versionado entre o SDK e o futuro motor de automação (serviço externo).
5
+ * O SDK NÃO executa Playwright. Uma reprodução bem-sucedida dos passos não equivale a aprovação do teste:
6
+ * assertions continuam vinculadas aos casos de teste no painel.
7
+ */
8
+ export declare const PLAYWRIGHT_CONTRACT_VERSION = "1.0";
9
+ export declare const PLAYWRIGHT_CONTRACT_KIND = "offscript.playwright-recording";
10
+ export interface PlaywrightStep {
11
+ index: number;
12
+ type: NormalizedStep["type"];
13
+ timestamp: number;
14
+ /** Intervalo desde o passo anterior (ms), limitado a 30s. */
15
+ waitBeforeMs: number;
16
+ url: string;
17
+ /** Melhor seletor (sintaxe Playwright) e alternativas em ordem de preferência. */
18
+ selector?: string;
19
+ selectorUnique?: boolean;
20
+ selectorCandidates?: SelectorCandidate[];
21
+ element?: RecordedAction["element"];
22
+ coordinates?: {
23
+ x: number;
24
+ y: number;
25
+ };
26
+ viewport?: {
27
+ width: number;
28
+ height: number;
29
+ };
30
+ /** Parâmetros do passo (valor permitido, tecla, destino...). Valores sensíveis chegam como `valueRef`. */
31
+ args?: Record<string, unknown>;
32
+ /** Navegação esperada após este passo. */
33
+ expectsNavigation?: {
34
+ to: string;
35
+ };
36
+ /** Rastreabilidade para investigação: ações brutas que originaram o passo. */
37
+ sourceActionIds: string[];
38
+ causedByActionId?: string;
39
+ metadata?: Record<string, unknown>;
40
+ }
41
+ export interface PlaywrightRecording {
42
+ contractVersion: string;
43
+ kind: typeof PLAYWRIGHT_CONTRACT_KIND;
44
+ generatedAt: number;
45
+ sdkVersion: string;
46
+ session: {
47
+ sessionId: string;
48
+ executionId: string;
49
+ testCaseId: string;
50
+ platformId: string;
51
+ };
52
+ initialConditions: {
53
+ url?: string;
54
+ viewport?: {
55
+ width: number;
56
+ height: number;
57
+ };
58
+ userAgent?: string;
59
+ language?: string;
60
+ timezone?: string;
61
+ deviceScaleFactor?: number;
62
+ browser?: {
63
+ name?: string;
64
+ version?: string;
65
+ };
66
+ };
67
+ steps: PlaywrightStep[];
68
+ stats: {
69
+ rawActions: number;
70
+ steps: number;
71
+ merged: number;
72
+ };
73
+ limitations: string[];
74
+ /** Campo livre para extensões compatíveis. */
75
+ extensions?: Record<string, unknown>;
76
+ }
77
+ export declare const CONTRACT_LIMITATIONS: string[];
78
+ export interface BuildInput {
79
+ session: PlaywrightRecording["session"];
80
+ actions: readonly RecordedAction[];
81
+ contexts?: readonly ContextEventData[];
82
+ extensions?: Record<string, unknown>;
83
+ }
84
+ /** Constrói o contrato a partir das ações gravadas. Pode ser usado no navegador ou no backend. */
85
+ export declare function buildPlaywrightContract(input: BuildInput): PlaywrightRecording;
86
+ /** Validação estrutural do contrato (usada em testes e por consumidores). Retorna a lista de problemas. */
87
+ export declare function validatePlaywrightContract(c: unknown): string[];
88
+ export type { ActionType };
@@ -0,0 +1,26 @@
1
+ import type { ElementDescriptor, SelectorCandidate } from "../types/events";
2
+ export interface SelectorOptions {
3
+ testIdAttributes: string[];
4
+ stableAttributes: string[];
5
+ }
6
+ export interface SelectorResult {
7
+ selector: string;
8
+ unique: boolean;
9
+ candidates: SelectorCandidate[];
10
+ }
11
+ export declare function isStableId(id: string): boolean;
12
+ export declare function isStableClass(c: string): boolean;
13
+ export declare function implicitRole(el: Element): string | undefined;
14
+ export declare function labelText(el: Element): string;
15
+ /** Nome acessível simplificado (aria-labelledby, aria-label, label, alt, title, conteúdo). */
16
+ export declare function accessibleName(el: Element): string;
17
+ export declare class SelectorGenerator {
18
+ private readonly opts;
19
+ constructor(opts: SelectorOptions);
20
+ generate(el: Element): SelectorResult;
21
+ private countRole;
22
+ private countByLabel;
23
+ /** CSS estrutural: ancora no ancestral estável mais próximo; usa tag + classes estáveis + nth-of-type. */
24
+ structuralCss(el: Element): string;
25
+ describe(el: Element): ElementDescriptor;
26
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./PlaywrightDataContract";
2
+ export * from "./ActionNormalizer";
3
+ export * from "./SelectorGenerator";
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ var chunkB6GO5FE5_cjs = require('./chunk-B6GO5FE5.cjs');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "CONTRACT_LIMITATIONS", {
8
+ enumerable: true,
9
+ get: function () { return chunkB6GO5FE5_cjs.CONTRACT_LIMITATIONS; }
10
+ });
11
+ Object.defineProperty(exports, "PLAYWRIGHT_CONTRACT_KIND", {
12
+ enumerable: true,
13
+ get: function () { return chunkB6GO5FE5_cjs.PLAYWRIGHT_CONTRACT_KIND; }
14
+ });
15
+ Object.defineProperty(exports, "PLAYWRIGHT_CONTRACT_VERSION", {
16
+ enumerable: true,
17
+ get: function () { return chunkB6GO5FE5_cjs.PLAYWRIGHT_CONTRACT_VERSION; }
18
+ });
19
+ Object.defineProperty(exports, "SelectorGenerator", {
20
+ enumerable: true,
21
+ get: function () { return chunkB6GO5FE5_cjs.SelectorGenerator; }
22
+ });
23
+ Object.defineProperty(exports, "accessibleName", {
24
+ enumerable: true,
25
+ get: function () { return chunkB6GO5FE5_cjs.accessibleName; }
26
+ });
27
+ Object.defineProperty(exports, "buildPlaywrightContract", {
28
+ enumerable: true,
29
+ get: function () { return chunkB6GO5FE5_cjs.buildPlaywrightContract; }
30
+ });
31
+ Object.defineProperty(exports, "implicitRole", {
32
+ enumerable: true,
33
+ get: function () { return chunkB6GO5FE5_cjs.implicitRole; }
34
+ });
35
+ Object.defineProperty(exports, "isStableClass", {
36
+ enumerable: true,
37
+ get: function () { return chunkB6GO5FE5_cjs.isStableClass; }
38
+ });
39
+ Object.defineProperty(exports, "isStableId", {
40
+ enumerable: true,
41
+ get: function () { return chunkB6GO5FE5_cjs.isStableId; }
42
+ });
43
+ Object.defineProperty(exports, "labelText", {
44
+ enumerable: true,
45
+ get: function () { return chunkB6GO5FE5_cjs.labelText; }
46
+ });
47
+ Object.defineProperty(exports, "normalizeActions", {
48
+ enumerable: true,
49
+ get: function () { return chunkB6GO5FE5_cjs.normalizeActions; }
50
+ });
51
+ Object.defineProperty(exports, "validatePlaywrightContract", {
52
+ enumerable: true,
53
+ get: function () { return chunkB6GO5FE5_cjs.validatePlaywrightContract; }
54
+ });
55
+ //# sourceMappingURL=playwright.cjs.map
56
+ //# sourceMappingURL=playwright.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"playwright.cjs"}
@@ -0,0 +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';
2
+ //# sourceMappingURL=playwright.js.map
3
+ //# sourceMappingURL=playwright.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"playwright.js"}
@@ -0,0 +1,32 @@
1
+ import type { CapturedBody, SelectorCandidate } from "../types/events";
2
+ import type { PrivacyConfig } from "../types/config";
3
+ export declare const REDACTED = "[REDACTED]";
4
+ /**
5
+ * Sanitização feita ANTES de qualquer persistência ou envio.
6
+ * Todas as funções são puras e nunca lançam.
7
+ */
8
+ export declare class DataSanitizer {
9
+ private readonly cfg;
10
+ private readonly headerSet;
11
+ private readonly extraKeys;
12
+ constructor(cfg: PrivacyConfig);
13
+ isSensitiveKey(key: string): boolean;
14
+ /** Mascara padrões sensíveis em texto livre (JWT, Bearer, CPF, CNPJ, cartões). */
15
+ scrubString(input: string): string;
16
+ sanitizeHeaders(headers: Record<string, string>): Record<string, string>;
17
+ /** Redige query params sensíveis e credenciais embutidas (user:pass@). */
18
+ sanitizeUrl(raw: string, base?: string): string;
19
+ /** Redige query/fragmento de um valor de atributo de URL preservando a forma original (relativa ou absoluta). */
20
+ redactUrlAttribute(value: string): string;
21
+ parseQuery(raw: string): Record<string, string | string[]> | undefined;
22
+ /** Redação profunda de objetos (chaves sensíveis + padrões em strings). */
23
+ sanitizeValue(value: unknown, depth?: number): unknown;
24
+ /** Converte um corpo textual em CapturedBody sanitizado, respeitando o limite. */
25
+ sanitizeTextBody(text: string, contentType: string, size?: number): CapturedBody;
26
+ isTextual(contentType: string): boolean;
27
+ isIgnoredUrl(url: string): boolean;
28
+ /** Referência opaca para valores não autorizados. */
29
+ redactedRef(value: string, salt: string): string;
30
+ /** Remove valores de atributos de seletor que podem conter dados sensíveis. */
31
+ sanitizeSelectorCandidates(list: SelectorCandidate[]): SelectorCandidate[];
32
+ }
@@ -0,0 +1,4 @@
1
+ import { type PrivacyConfig } from "../types/config";
2
+ export declare function resolvePrivacy(user?: Partial<PrivacyConfig>): PrivacyConfig;
3
+ export declare const BASE_SENSITIVE_HEADERS: string[];
4
+ export declare const BASE_SENSITIVE_KEY_PATTERN: RegExp;
@@ -0,0 +1,46 @@
1
+ import { type RecordedAction } from "../types/events";
2
+ import { type EventSink, type Recorder } from "./types";
3
+ export type ActionDraft = Omit<RecordedAction, "id" | "sessionId" | "executionId" | "sequence" | "timestamp">;
4
+ /** Ações semânticas do usuário. Eventos brutos → rascunhos de ação; a normalização é feita fora (ActionNormalizer). */
5
+ export declare class ActionRecorder implements Recorder {
6
+ private readonly sink;
7
+ readonly name = "actions";
8
+ private d;
9
+ private gen;
10
+ private paused;
11
+ private pendingInput?;
12
+ private inputTimer?;
13
+ private salt;
14
+ private lastClick?;
15
+ private scrollState;
16
+ private hover?;
17
+ private drag?;
18
+ private move;
19
+ private moveFlush?;
20
+ constructor(sink: EventSink);
21
+ start(): void;
22
+ pause(): void;
23
+ resume(): void;
24
+ stop(): void;
25
+ /** Descarrega estados pendentes (input em edição, scroll, trajetória do mouse). */
26
+ flushAll(): void;
27
+ recordNavigation(from: string, to: string, kind: string): void;
28
+ recordPageLoad(navType: string | undefined, referrer: string): void;
29
+ private emit;
30
+ private target;
31
+ private onClick;
32
+ private onDblClick;
33
+ private onInput;
34
+ private flushInput;
35
+ private onChange;
36
+ private onKey;
37
+ private onFocus;
38
+ private onScroll;
39
+ private onOver;
40
+ private onOut;
41
+ private endHover;
42
+ private onDown;
43
+ private onUp;
44
+ private onMove;
45
+ private flushMove;
46
+ }
@@ -0,0 +1,23 @@
1
+ import { type ContextEventData } from "../types/events";
2
+ import { type EventSink, type Recorder } from "./types";
3
+ export interface ContextIdentity {
4
+ platformId: string;
5
+ testCaseId: string;
6
+ executionId: string;
7
+ }
8
+ export declare function parseBrowser(ua: string): {
9
+ name?: string;
10
+ version?: string;
11
+ };
12
+ export declare function collectContext(id: ContextIdentity, reason: ContextEventData["reason"], appVersion?: string): ContextEventData;
13
+ /** Metadados de investigação. Sem fingerprinting: apenas dados já expostos e úteis ao QA. */
14
+ export declare class ContextRecorder implements Recorder {
15
+ private readonly sink;
16
+ private readonly identity;
17
+ readonly name = "context";
18
+ private d;
19
+ constructor(sink: EventSink, identity: () => ContextIdentity);
20
+ start(): void;
21
+ record(reason: ContextEventData["reason"]): void;
22
+ stop(): void;
23
+ }
@@ -0,0 +1,20 @@
1
+ import { type EventSink, type Recorder } from "./types";
2
+ export declare function serializeArg(v: unknown, depth?: number, seen?: WeakSet<object>): unknown;
3
+ export declare function firstFrame(stack?: string): {
4
+ file?: string;
5
+ line?: number;
6
+ column?: number;
7
+ };
8
+ /** Console + erros globais. Nunca altera argumentos, nem suprime saída, nem lança. */
9
+ export declare class ErrorRecorder implements Recorder {
10
+ private readonly sink;
11
+ readonly name = "errors";
12
+ private d;
13
+ private busy;
14
+ constructor(sink: EventSink);
15
+ start(): void;
16
+ private report;
17
+ private wrapConsole;
18
+ private captureConsole;
19
+ stop(): void;
20
+ }
@@ -0,0 +1,28 @@
1
+ import { type EventSink, type Recorder } from "./types";
2
+ /**
3
+ * Instrumentação de fetch e XMLHttpRequest. Não altera assinatura, retorno, headers, credenciais,
4
+ * AbortController nem consome streams do usuário (usa clone/leitura limitada e apenas quando habilitado).
5
+ */
6
+ export declare class HTTPRecorder implements Recorder {
7
+ private readonly sink;
8
+ private readonly ownApiUrl;
9
+ readonly name = "http";
10
+ private inflight;
11
+ private active;
12
+ private restore;
13
+ constructor(sink: EventSink, ownApiUrl: string);
14
+ start(): void;
15
+ stop(): void;
16
+ private isIgnored;
17
+ private patchFetch;
18
+ private beginFetch;
19
+ private endFetch;
20
+ private readBounded;
21
+ private failFetch;
22
+ private patchXhr;
23
+ private beginXhr;
24
+ private endXhr;
25
+ private base;
26
+ private emit;
27
+ private describeBody;
28
+ }