@alwaysmeticulous/sdk-bundles-api 2.42.1 → 2.44.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 CHANGED
@@ -1 +1,3 @@
1
- # Meticulous Common Types
1
+ # SDK to Bundles API
2
+
3
+ Any interface used in the API for communicating between the bundles and the SDK should live in here, unless they are also used in the backend API, or persisted to a database in which case they should live in the 'sdk-bundle-api' sub-folder of the 'api' package.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  export { RecordConfig, RecordSettings, RecordState } from "./record";
2
2
  export { MeticulousWindowConfig, NetworkResponseSanitizer, } from "./record/record-settings";
3
- export { ReplayUserInteractionsResult, ReplayUserInteractionsResultFull, ReplayUserInteractionsResultShort, BeforeUserEventOptions, } from "./replay/bundle-to-sdk/index";
4
- export { BootstrapReplayUserInteractionsFn, BootstrapReplayUserInteractionsOptions, OnReplayTimelineEventFn, ReplayUserInteractionsFn, ReplayUserInteractionsOptions, VirtualTimeOptions, InstallVirtualEventLoopOpts, SetupReplayNetworkStubbingFn, NetworkStubbingOptions, BrowserContextSeedingOptions, SetupBrowserContextSeedingFn, ScreenshottingOptions, } from "./replay/sdk-to-bundle";
5
- export { ReplayAndStoreResultsOptions, ReplayTarget, SnapshottedAssetsReplayTarget, URLReplayTarget, OriginalRecordedURLReplayTarget, ReplayExecutionOptions, ReplayOrchestratorScreenshottingOptions, ScreenshottingEnabledOptions, StoryboardOptions, GeneratedBy, GeneratedByNotebookRun, GeneratedByTestRun, GeneratedByReplayCommand, ScreenshotComparisonOptions, ScreenshotComparisonEnabledOptions, CompareScreenshotsTo, CompareScreenshotsToSpecificReplay, CompareScreenshotsToTestRun, DoNotCompareScreenshots, OutOfDateClientError, } from "./replay-orchestrator/sdk-to-bundle/execute-replay";
3
+ export { ReplayAndStoreResultsOptions, ReplayTarget, SnapshottedAssetsReplayTarget, URLReplayTarget, OriginalRecordedURLReplayTarget, ReplayExecutionOptions, ReplayOrchestratorScreenshottingOptions, ScreenshottingEnabledOptions, StoryboardOptions, GeneratedBy, GeneratedByNotebookRun, GeneratedByTestRun, GeneratedByReplayCommand, ScreenshotComparisonOptions, ScreenshotComparisonEnabledOptions, CompareScreenshotsTo, CompareScreenshotsToSpecificReplay, CompareScreenshotsToTestRun, DoNotCompareScreenshots, OutOfDateClientError, BeforeUserEventOptions, } from "./replay-orchestrator/sdk-to-bundle/execute-replay";
6
4
  export { ExecuteTestRunOptions } from "./replay-orchestrator/sdk-to-bundle/execute-test-run";
7
5
  export { ExecuteTestRunResult, TestRunExecution, RunningTestRunExecution, FinishedTestRunExecution, TestRunProgress, DetailedTestCaseResult, } from "./replay-orchestrator/bundle-to-sdk/execute-test-run";
8
6
  export { ReplayAndStoreResultsResult, ReplayExecution, BeforeUserEventResult, } from "./replay-orchestrator/bundle-to-sdk/execute-replay";
@@ -1,12 +1,15 @@
1
- import { ScreenshotDiffResult, TestCaseResult, TestRun } from "@alwaysmeticulous/api";
1
+ import { Project, ScreenshotDiffResult, TestCaseResult, TestRunStatus } from "@alwaysmeticulous/api";
2
2
  export interface ExecuteTestRunResult {
3
3
  testRun: FinishedTestRunExecution;
4
4
  testCaseResults: DetailedTestCaseResult[];
5
5
  }
6
- export type TestRunExecution = Pick<TestRun, "id" | "url" | "status" | "project"> & {
6
+ export interface TestRunExecution {
7
+ id: string;
8
+ status: TestRunStatus;
9
+ project: Project;
7
10
  progress: TestRunProgress;
8
11
  url: string;
9
- };
12
+ }
10
13
  export interface RunningTestRunExecution extends TestRunExecution {
11
14
  status: "Running";
12
15
  }
@@ -1,5 +1,5 @@
1
1
  import { ScreenshotDiffOptions } from "@alwaysmeticulous/api";
2
- import { BeforeUserEventOptions } from "../../replay/bundle-to-sdk";
2
+ import { LogLevelNumbers } from "loglevel";
3
3
  import { BeforeUserEventResult } from "../bundle-to-sdk/execute-replay";
4
4
  export interface ReplayAndStoreResultsOptions {
5
5
  replayTarget: ReplayTarget;
@@ -12,6 +12,7 @@ export interface ReplayAndStoreResultsOptions {
12
12
  commitSha: string | null | undefined;
13
13
  sessionId: string;
14
14
  cookiesFile: string | null | undefined;
15
+ logLevel: LogLevelNumbers;
15
16
  /**
16
17
  * Called when the user or runner closes the page or browser window
17
18
  */
@@ -29,8 +30,17 @@ export interface ReplayAndStoreResultsOptions {
29
30
  * code to detect if it's being called by client that is not compatible with the latest version,
30
31
  * and if so throw an OutOfDateClientError. It is then up to the client to display a message to ask
31
32
  * the user to update to a newer version.
33
+ *
34
+ * Note: this is typed as a const of the latest known version, rather than a number, to ensure
35
+ * that all clients bump the version number passed when they upgrade to the types.
36
+ */
37
+ maxSemanticVersionSupported: 1;
38
+ }
39
+ export interface BeforeUserEventOptions {
40
+ /**
41
+ * The index of the next event in sessionData.userEvents.event_log
32
42
  */
33
- maxSemanticVersionSupported: number;
43
+ userEventIndex: number;
34
44
  }
35
45
  /**
36
46
  * See {@link ReplayAndStoreResultsOptions.maxSemanticVersionSupported} for more details.
@@ -1,4 +1,5 @@
1
1
  import { ScreenshotAssertionsEnabledOptions, TestCaseResult, TestRunEnvironment } from "@alwaysmeticulous/api";
2
+ import { LogLevelNumbers } from "loglevel";
2
3
  import { RunningTestRunExecution } from "../bundle-to-sdk/execute-test-run";
3
4
  import { ReplayExecutionOptions } from "./execute-replay";
4
5
  export interface ExecuteTestRunOptions {
@@ -46,6 +47,7 @@ export interface ExecuteTestRunOptions {
46
47
  */
47
48
  environment?: TestRunEnvironment;
48
49
  baseTestRunId: string | null;
50
+ logLevel: LogLevelNumbers;
49
51
  onTestRunCreated?: (testRun: RunningTestRunExecution) => void;
50
52
  onTestFinished?: (testRun: RunningTestRunExecution) => void;
51
53
  /**
@@ -56,6 +58,9 @@ export interface ExecuteTestRunOptions {
56
58
  * code to detect if it's being called by client that is not compatible with the latest version,
57
59
  * and if so throw an OutOfDateClientError. It is then up to the client to display a message to ask
58
60
  * the user to update to a newer version.
61
+ *
62
+ * Note: this is typed as a const of the latest known version, rather than a number, to ensure
63
+ * that all clients bump the version number passed when they upgrade to the types.
59
64
  */
60
- maxSemanticVersionSupported: number;
65
+ maxSemanticVersionSupported: 1;
61
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwaysmeticulous/sdk-bundles-api",
3
- "version": "2.42.1",
3
+ "version": "2.44.0",
4
4
  "description": "Meticulous common types",
5
5
  "license": "ISC",
6
6
  "main": "dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "depcheck": "depcheck --ignore-patterns=dist"
20
20
  },
21
21
  "devDependencies": {
22
- "@alwaysmeticulous/api": "^2.42.0"
22
+ "@alwaysmeticulous/api": "^2.44.0"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "loglevel": "^1.8.0",
@@ -50,5 +50,5 @@
50
50
  "bugs": {
51
51
  "url": "https://github.com/alwaysmeticulous/meticulous-sdk/issues"
52
52
  },
53
- "gitHead": "6c08f6e79f34f7efdc2ebd0e8e4e09baffeb8f04"
53
+ "gitHead": "3895b3036d7c97609f83e8b41593995eba5062ba"
54
54
  }
@@ -1,17 +0,0 @@
1
- /** Result of replaying user interactions */
2
- export type ReplayUserInteractionsResult = ReplayUserInteractionsResultFull | ReplayUserInteractionsResultShort;
3
- /** Returned when the recorded session has been fully replayed */
4
- export interface ReplayUserInteractionsResultFull {
5
- length: "full";
6
- }
7
- /** Returned when the recorded session has been cut short during replay */
8
- export interface ReplayUserInteractionsResultShort {
9
- length: "short";
10
- reason: "max events" | "max duration" | "full page navigation" | "error";
11
- }
12
- export interface BeforeUserEventOptions {
13
- /**
14
- * The index of the next event in sessionData.userEvents.event_log
15
- */
16
- userEventIndex: number;
17
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,73 +0,0 @@
1
- import { SessionData, SDKReplayTimelineEntry } from "@alwaysmeticulous/api";
2
- import type { LogLevelDesc } from "loglevel";
3
- import type { Page } from "puppeteer";
4
- import { BeforeUserEventOptions, ReplayUserInteractionsResult } from "../bundle-to-sdk";
5
- export interface ReplayUserInteractionsOptions {
6
- /**
7
- * A semantic version number for the SDK calling into the replay code.
8
- *
9
- * This version number is bumped on every API change, and allows the replay
10
- * code to detect if it's being called by an old version, and if so throw
11
- * and request the user updates to a newer version.
12
- */
13
- sdkSemanticVersion: number;
14
- page: Page;
15
- sessionData: unknown;
16
- moveBeforeClick: boolean;
17
- virtualTime?: VirtualTimeOptions;
18
- maxDurationMs?: number;
19
- maxEventCount?: number;
20
- sessionDurationMs: number;
21
- logLevel: LogLevelDesc;
22
- screenshots: ScreenshottingOptions;
23
- onTimelineEvent: OnReplayTimelineEventFn;
24
- /**
25
- * If present then will be called before executing each next user event,
26
- * and will wait for the completion of the returned promise before continuing.
27
- */
28
- onBeforeUserEvent?: OnBeforeUserEventFn;
29
- }
30
- export interface ScreenshottingOptions {
31
- screenshotsDirectory: string;
32
- takeIntermediateScreenshots: boolean;
33
- takeEndStateScreenshot: boolean;
34
- }
35
- /** Replay function for user interaction events */
36
- export type ReplayUserInteractionsFn = (options: ReplayUserInteractionsOptions) => Promise<ReplayUserInteractionsResult>;
37
- export interface BootstrapReplayUserInteractionsOptions {
38
- page: Page;
39
- logLevel: LogLevelDesc;
40
- }
41
- export type BootstrapReplayUserInteractionsFn = (options: BootstrapReplayUserInteractionsOptions) => Promise<ReplayUserInteractionsFn>;
42
- export type VirtualTimeOptions = {
43
- enabled: false;
44
- } | {
45
- enabled: true;
46
- };
47
- export type OnReplayTimelineEventFn = (entry: SDKReplayTimelineEntry) => void;
48
- export type OnBeforeUserEventFn = (options: BeforeUserEventOptions) => Promise<void>;
49
- export interface NetworkStubbingOptions {
50
- page: Page;
51
- logLevel: LogLevelDesc;
52
- sessionData: SessionData;
53
- startUrl: string;
54
- originalSessionStartUrl: string;
55
- onTimelineEvent: OnReplayTimelineEventFn;
56
- }
57
- export type SetupReplayNetworkStubbingFn = (options: NetworkStubbingOptions) => Promise<void>;
58
- export interface BrowserContextSeedingOptions {
59
- page: Page;
60
- sessionData: SessionData;
61
- startUrl: string;
62
- }
63
- export type SetupBrowserContextSeedingFn = (options: BrowserContextSeedingOptions) => Promise<void>;
64
- export interface InstallVirtualEventLoopOpts {
65
- /**
66
- * The start time of the original session in ms since unix epoch (Date.now()).
67
- *
68
- * This is used to ensure that the application code thinks it's running at the same
69
- * time as the original session during replay, to minimize differences vs the original
70
- * session.
71
- */
72
- sessionStartTime: number;
73
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });