@replayci/replay 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.
- package/README.md +75 -0
- package/dist/index.cjs +2197 -0
- package/dist/index.d.cts +55 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.js +2184 -0
- package/package.json +76 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Contract } from '@replayci/contracts-core';
|
|
2
|
+
|
|
3
|
+
type ContractFailure = {
|
|
4
|
+
path: string;
|
|
5
|
+
operator: string;
|
|
6
|
+
expected: unknown;
|
|
7
|
+
found: unknown;
|
|
8
|
+
message?: string;
|
|
9
|
+
contract_file?: string;
|
|
10
|
+
};
|
|
11
|
+
type ValidationResult = {
|
|
12
|
+
pass: boolean;
|
|
13
|
+
failures: ContractFailure[];
|
|
14
|
+
matched_contracts: number;
|
|
15
|
+
unmatched_tools: string[];
|
|
16
|
+
evaluation_ms: number;
|
|
17
|
+
};
|
|
18
|
+
type CapturePrivacyTier = "metadata" | "redacted" | "full";
|
|
19
|
+
type ObserveDiagnosticEvent = {
|
|
20
|
+
type: "unsupported_client";
|
|
21
|
+
mode: "observe";
|
|
22
|
+
detail: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: "double_wrap";
|
|
25
|
+
mode: "observe" | "replay";
|
|
26
|
+
} | {
|
|
27
|
+
type: "buffer_overflow";
|
|
28
|
+
dropped: number;
|
|
29
|
+
};
|
|
30
|
+
type ObserveOptions = {
|
|
31
|
+
agent?: string;
|
|
32
|
+
apiKey?: string;
|
|
33
|
+
endpoint?: string;
|
|
34
|
+
captureLevel?: CapturePrivacyTier;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
maxBuffer?: number;
|
|
37
|
+
flushMs?: number;
|
|
38
|
+
timeoutMs?: number;
|
|
39
|
+
diagnostics?: (event: ObserveDiagnosticEvent) => void;
|
|
40
|
+
};
|
|
41
|
+
type ObserveHandle<T> = {
|
|
42
|
+
client: T;
|
|
43
|
+
restore: () => void;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
declare function observe<T extends object>(client: T, opts?: ObserveOptions): ObserveHandle<T>;
|
|
47
|
+
|
|
48
|
+
type ValidateOptions = {
|
|
49
|
+
contracts: Contract | Contract[];
|
|
50
|
+
unmatchedPolicy?: "deny" | "allow";
|
|
51
|
+
};
|
|
52
|
+
declare function prepareContracts(input: string | string[] | Contract | Contract[]): Contract[];
|
|
53
|
+
declare function validate(response: unknown, opts?: ValidateOptions): ValidationResult;
|
|
54
|
+
|
|
55
|
+
export { type ContractFailure, type ObserveDiagnosticEvent, type ObserveHandle, type ObserveOptions, type ValidationResult, observe, prepareContracts, validate };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Contract } from '@replayci/contracts-core';
|
|
2
|
+
|
|
3
|
+
type ContractFailure = {
|
|
4
|
+
path: string;
|
|
5
|
+
operator: string;
|
|
6
|
+
expected: unknown;
|
|
7
|
+
found: unknown;
|
|
8
|
+
message?: string;
|
|
9
|
+
contract_file?: string;
|
|
10
|
+
};
|
|
11
|
+
type ValidationResult = {
|
|
12
|
+
pass: boolean;
|
|
13
|
+
failures: ContractFailure[];
|
|
14
|
+
matched_contracts: number;
|
|
15
|
+
unmatched_tools: string[];
|
|
16
|
+
evaluation_ms: number;
|
|
17
|
+
};
|
|
18
|
+
type CapturePrivacyTier = "metadata" | "redacted" | "full";
|
|
19
|
+
type ObserveDiagnosticEvent = {
|
|
20
|
+
type: "unsupported_client";
|
|
21
|
+
mode: "observe";
|
|
22
|
+
detail: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: "double_wrap";
|
|
25
|
+
mode: "observe" | "replay";
|
|
26
|
+
} | {
|
|
27
|
+
type: "buffer_overflow";
|
|
28
|
+
dropped: number;
|
|
29
|
+
};
|
|
30
|
+
type ObserveOptions = {
|
|
31
|
+
agent?: string;
|
|
32
|
+
apiKey?: string;
|
|
33
|
+
endpoint?: string;
|
|
34
|
+
captureLevel?: CapturePrivacyTier;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
maxBuffer?: number;
|
|
37
|
+
flushMs?: number;
|
|
38
|
+
timeoutMs?: number;
|
|
39
|
+
diagnostics?: (event: ObserveDiagnosticEvent) => void;
|
|
40
|
+
};
|
|
41
|
+
type ObserveHandle<T> = {
|
|
42
|
+
client: T;
|
|
43
|
+
restore: () => void;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
declare function observe<T extends object>(client: T, opts?: ObserveOptions): ObserveHandle<T>;
|
|
47
|
+
|
|
48
|
+
type ValidateOptions = {
|
|
49
|
+
contracts: Contract | Contract[];
|
|
50
|
+
unmatchedPolicy?: "deny" | "allow";
|
|
51
|
+
};
|
|
52
|
+
declare function prepareContracts(input: string | string[] | Contract | Contract[]): Contract[];
|
|
53
|
+
declare function validate(response: unknown, opts?: ValidateOptions): ValidationResult;
|
|
54
|
+
|
|
55
|
+
export { type ContractFailure, type ObserveDiagnosticEvent, type ObserveHandle, type ObserveOptions, type ValidationResult, observe, prepareContracts, validate };
|