@alwaysmeticulous/api 2.149.0 → 2.153.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/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { Cookie, SessionData, UrlHistoryEvent, WindowData, ApplicationSpecificDa
9
9
  export { SequenceNumber, WebSocketConnectionData, WebSocketConnectionEvent, WebSocketConnectionCreatedEvent, WebSocketConnectionOpenedEvent, EncodedArrayBuffer, EncodedBlob, WebSocketConnectionMessageEvent, WebSocketConnectionErrorEvent, WebSocketConnectionClosedEvent, } from "./sdk-bundle-api/sdk-to-bundle/websocket-data";
10
10
  export { Replay } from "./replay/replay.types";
11
11
  export { ScreenshotAssertionsOptions, ScreenshotAssertionsEnabledOptions, ScreenshottingEnabledOptions, StoryboardOptions, ScreenshotDiffOptions, ElementToIgnore, CSSSelectorToIgnore, } from "./sdk-bundle-api/sdk-to-bundle/screenshotting-options";
12
- export { NetworkStubbingMode, StubAllRequests, StubNonSSRRequests, NoStubbing, CustomStubbing, RequestFilter, } from "./sdk-bundle-api/sdk-to-bundle/network-stubbing";
12
+ export { NetworkStubbingMode, StubAllRequests, StubNonSSRRequests, NoStubbing, CustomStubbing, RequestFilter, CustomTransformation, } from "./sdk-bundle-api/sdk-to-bundle/network-stubbing";
13
13
  export { ConsoleMessageWithStackTracePointer, VirtualTimeChange, MeticulousConsoleMessage, ApplicationConsoleMessage, ConsoleMessageCoreData, ConsoleMessageType, ConsoleMessageLocation, } from "./sdk-bundle-api/bundle-to-sdk/console-message";
14
14
  export { InjectableRequestHeader, StaticHeaderValue, DynamicHeaderValue, AllRequests, AppUrlRequestsOnly, CustomRequests, } from "./sdk-bundle-api/sdk-to-bundle/header-injection";
15
15
  export { ConsoleErrorDivergenceIndicator, Divergence, DivergenceConsoleError, DivergenceIndicator, InitialNavigationDivergenceIndicator, NetworkActivityDivergenceIndicator, ScreenshotDivergenceIdentifier, UrlChangeEventDivergenceIndicator, UserEventDivergenceIndicator, } from "./sdk-bundle-api/bundle-to-sdk/replay-divergence";
@@ -1,8 +1,15 @@
1
1
  export type NetworkStubbingMode = StubAllRequests | StubNonSSRRequests | CustomStubbing;
2
+ interface NetworkStubbingBase {
3
+ /**
4
+ * When looking for a request to use as a stub, these transformations will be applied to the request before any other transformations.
5
+ * They will be applied in the order they are defined.
6
+ */
7
+ customRequestTransformations?: CustomTransformation[];
8
+ }
2
9
  /**
3
10
  * The default mode. Stubs all requests, apart from ones for _next/static/ files.
4
11
  */
5
- export interface StubAllRequests {
12
+ export interface StubAllRequests extends NetworkStubbingBase {
6
13
  type: "stub-all-requests";
7
14
  }
8
15
  /**
@@ -10,10 +17,10 @@ export interface StubAllRequests {
10
17
  *
11
18
  * Used for NextJs 13 /app directory & server components.
12
19
  */
13
- export interface StubNonSSRRequests {
20
+ export interface StubNonSSRRequests extends NetworkStubbingBase {
14
21
  type: "stub-non-ssr-requests";
15
22
  }
16
- export interface CustomStubbing {
23
+ export interface CustomStubbing extends NetworkStubbingBase {
17
24
  type: "custom-stubbing";
18
25
  requestsToNotStub: RequestFilter[];
19
26
  }
@@ -36,3 +43,28 @@ export interface ConnectionTypesFilter {
36
43
  xhr: boolean;
37
44
  webSockets: boolean;
38
45
  }
46
+ type TransformableRequestData = Pick<Request, "body" | "method" | "url">;
47
+ interface CustomTransformationBase {
48
+ /**
49
+ * The regex to match against the request component.
50
+ */
51
+ matchRegex: string;
52
+ /**
53
+ * The replacement for any matches with matchRegex.
54
+ * This can reference groups in the matchRegex, for example:
55
+ * - matchRegex = `id_(\w*)=[^&]*`, replacement = `id_$1=<redacted>`
56
+ * - matchRegex= `id_(?<param_name>\w*)=[^&]*`, replacement = `id_$<param_name>=<redacted>`
57
+ */
58
+ replacement: string;
59
+ requestComponent: keyof TransformableRequestData;
60
+ }
61
+ type TransformableUrlFields = keyof Pick<URL, "hash" | "host" | "hostname" | "href" | "password" | "pathname" | "port" | "protocol" | "search" | "username">;
62
+ interface CustomUrlTransformation extends CustomTransformationBase {
63
+ requestComponent: keyof Pick<TransformableRequestData, "url">;
64
+ urlComponent: TransformableUrlFields;
65
+ }
66
+ interface CustomRequestTransformation extends CustomTransformationBase {
67
+ requestComponent: keyof Omit<TransformableRequestData, "url">;
68
+ }
69
+ export type CustomTransformation = CustomRequestTransformation | CustomUrlTransformation;
70
+ export {};
@@ -21,6 +21,8 @@ export interface TestRunGitHubPullRequestContext {
21
21
  headSha: string;
22
22
  /** Head ref (usually /refs/head/<branch>) */
23
23
  headRef?: string;
24
+ /** GitHub Actions run ID that triggered this test run */
25
+ runId?: number;
24
26
  }
25
27
  export interface TestRunGitHubPushContext {
26
28
  type: "github";
@@ -31,6 +33,8 @@ export interface TestRunGitHubPushContext {
31
33
  afterSha: string;
32
34
  /** Git ref (usually /refs/head/<branch>) */
33
35
  ref: string;
36
+ /** GitHub Actions run ID that triggered this test run */
37
+ runId?: number;
34
38
  }
35
39
  export interface TestRunGitHubWorkflowDispatchContext {
36
40
  type: "github";
@@ -43,6 +47,8 @@ export interface TestRunGitHubWorkflowDispatchContext {
43
47
  };
44
48
  /** Resolved head commit hash */
45
49
  headSha: string;
50
+ /** GitHub Actions run ID that triggered this test run */
51
+ runId?: number;
46
52
  }
47
53
  export type TestRunGitLabContext = TestRunGitLabMergeRequestContext | TestRunGitLabPushContext;
48
54
  export interface TestRunGitLabMergeRequestContext {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwaysmeticulous/api",
3
- "version": "2.149.0",
3
+ "version": "2.153.0",
4
4
  "description": "Meticulous API types",
5
5
  "license": "ISC",
6
6
  "main": "dist/index.js",
@@ -35,5 +35,5 @@
35
35
  "bugs": {
36
36
  "url": "https://github.com/alwaysmeticulous/meticulous-sdk/issues"
37
37
  },
38
- "gitHead": "a4db0d275545f9d58415dcb32da999a4a98f9f65"
38
+ "gitHead": "97b550636b6c7bef9e68801cb8798e58f0089251"
39
39
  }