@alwaysmeticulous/api 2.288.0 → 2.289.1

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.
@@ -0,0 +1,117 @@
1
+ import { HarRequest, HarResponse } from "./sdk-bundle-api/sdk-to-bundle/har-log";
2
+ /**
3
+ * Types for authoring custom checks. A custom check compares the snapshots
4
+ * captured during the base and head replays of a test run and returns a verdict
5
+ * plus a report that is surfaced in the Meticulous UI.
6
+ */
7
+ /**
8
+ * A piece of data captured at a point during a replay, to be compared by a
9
+ * custom check. A check may receive multiple snapshots sharing the same `type`,
10
+ * `sessionId` and `stageDuringSession`; it should align the base and head
11
+ * snapshots and base its verdict only on the differences (pre-existing issues
12
+ * are ignored, consistent with Meticulous's semantics).
13
+ */
14
+ export interface Snapshot<T = unknown> {
15
+ /** The snapshot kind, e.g. "network-requests" or a customer-defined type. */
16
+ type: string;
17
+ /** The recorded session the snapshot was captured during. */
18
+ sessionId: string;
19
+ /**
20
+ * Where in the session the snapshot was captured, identified by the screenshot
21
+ * taken at that point (e.g. "screenshot-after-event-2", "final-state").
22
+ */
23
+ stageDuringSession: string;
24
+ data: T;
25
+ }
26
+ /** The base and head snapshots passed to a custom check. */
27
+ export interface CustomCheckInput {
28
+ baseSnapshots: Snapshot[];
29
+ headSnapshots: Snapshot[];
30
+ }
31
+ /**
32
+ * The outcome of comparing the base and head snapshots:
33
+ * - `pass`: no regression; the check is green and no report is surfaced.
34
+ * - `warn`: the check is green but its report is shown to the user.
35
+ * - `fail`: the check is red.
36
+ *
37
+ * A check failing to *run* is not a verdict: an execution error applies to the
38
+ * custom check results as a whole (every check), not to an individual check, so
39
+ * it is reported at that level rather than as a per-check verdict.
40
+ */
41
+ export type CustomCheckVerdict = "pass" | "warn" | "fail";
42
+ /**
43
+ * Maximum length of a custom check `summary`. The summary is rendered inline in
44
+ * the UI, so it is truncated to this many characters when displayed rather than
45
+ * relying on plugin authors to keep it short.
46
+ */
47
+ export declare const CUSTOM_CHECK_SUMMARY_MAX_LENGTH = 500;
48
+ /** The result a custom check returns after comparing the snapshots. */
49
+ export interface CustomCheckOutput {
50
+ verdict: CustomCheckVerdict;
51
+ /**
52
+ * A short summary shown inline in the UI, e.g. "+30mb inc bundle size".
53
+ * Truncated to {@link CUSTOM_CHECK_SUMMARY_MAX_LENGTH} characters when displayed.
54
+ */
55
+ summary?: string;
56
+ report: CustomCheckReport;
57
+ }
58
+ /** A report rendered in the UI when the check is opened. Markdown for now. */
59
+ export type CustomCheckReport = MarkdownReport;
60
+ export interface MarkdownReport {
61
+ type: "markdown";
62
+ markdown: string;
63
+ }
64
+ /**
65
+ * The contract a custom check implements: `execute` compares the base and head
66
+ * snapshots and returns a verdict and report.
67
+ */
68
+ export interface CustomCheck {
69
+ execute: (input: CustomCheckInput) => Promise<CustomCheckOutput>;
70
+ }
71
+ /**
72
+ * Manifest describing a custom check plugin to Meticulous. It sits alongside the
73
+ * built entrypoint and is loaded (without executing the check) so the check can
74
+ * be discovered ahead of time.
75
+ */
76
+ export interface CustomCheckPluginManifest {
77
+ /** Stable identifier for the check, e.g. "accessibility-check". */
78
+ id: string;
79
+ type: "custom-check";
80
+ /** Plugin version, e.g. "1.0.0". */
81
+ version: string;
82
+ configuration: {
83
+ /** Name shown in the UI, e.g. "Accessibility". */
84
+ displayName: string;
85
+ /** The snapshot types this check consumes, e.g. ["network-requests"]. */
86
+ handlesSnapshotTypes: string[];
87
+ /** Path to the built entrypoint, relative to the manifest, e.g. "./entrypoint.js". */
88
+ entryPoint: string;
89
+ };
90
+ }
91
+ /** A Meticulous plugin manifest. Only custom checks are supported today. */
92
+ export type PluginManifest = CustomCheckPluginManifest;
93
+ /**
94
+ * The snapshot `type` of the built-in network requests snapshot. Checks that
95
+ * consume it receive `Snapshot<NetworkRequestSnapshotData>` values.
96
+ */
97
+ export declare const NETWORK_REQUESTS_SNAPSHOT_TYPE = "network-requests";
98
+ /**
99
+ * `data` of a built-in "network-requests" snapshot: a single xhr/fetch request
100
+ * captured during the replay, with the stubbed response that was served.
101
+ *
102
+ * `requestBody`/`responseBody` may be truncated (large bodies are ellipsized
103
+ * with an MD5 of the remainder, so body changes are still detectable); url,
104
+ * method, status and headers are captured in full.
105
+ */
106
+ export interface NetworkRequestSnapshotData {
107
+ url: string;
108
+ method: string;
109
+ requestHeaders: HarRequest["headers"];
110
+ requestBody?: string;
111
+ /** Status of the response served, or null if the request was not matched. */
112
+ status: number | null;
113
+ responseHeaders: HarResponse["headers"];
114
+ responseBody?: string;
115
+ /** Whether the request was matched to a recorded request and stubbed. */
116
+ matched: boolean;
117
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="ead46771-c69a-5d16-8a48-a04e6e5098b8")}catch(e){}}();
3
+
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.NETWORK_REQUESTS_SNAPSHOT_TYPE = exports.CUSTOM_CHECK_SUMMARY_MAX_LENGTH = void 0;
6
+ /**
7
+ * Maximum length of a custom check `summary`. The summary is rendered inline in
8
+ * the UI, so it is truncated to this many characters when displayed rather than
9
+ * relying on plugin authors to keep it short.
10
+ */
11
+ exports.CUSTOM_CHECK_SUMMARY_MAX_LENGTH = 500;
12
+ /**
13
+ * The snapshot `type` of the built-in network requests snapshot. Checks that
14
+ * consume it receive `Snapshot<NetworkRequestSnapshotData>` values.
15
+ */
16
+ exports.NETWORK_REQUESTS_SNAPSHOT_TYPE = "network-requests";
17
+ //# sourceMappingURL=custom-checks.types.js.map
18
+ //# debugId=ead46771-c69a-5d16-8a48-a04e6e5098b8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-checks.types.js","sources":["../src/custom-checks.types.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AAoDA;;;;GAIG;AACU,QAAA,+BAA+B,GAAG,GAAG,CAAC;AA4DnD;;;GAGG;AACU,QAAA,8BAA8B,GAAG,kBAAkB,CAAC","debugId":"ead46771-c69a-5d16-8a48-a04e6e5098b8"}
package/dist/index.d.ts CHANGED
@@ -21,3 +21,4 @@ export { AssetUploadMetadata } from "./sdk-bundle-api/sdk-to-bundle/asset-upload
21
21
  export { S3Location } from "./s3.types";
22
22
  export { CompanionAssetsInfo } from "./sdk-bundle-api/sdk-to-bundle/companion-assets";
23
23
  export { DeploymentArchiveType } from "./sdk-bundle-api/sdk-to-bundle/deployment-archive-type";
24
+ export { Snapshot, CustomCheckInput, CustomCheckVerdict, CustomCheckOutput, CustomCheckReport, MarkdownReport, CustomCheck, CustomCheckPluginManifest, PluginManifest, NetworkRequestSnapshotData, NETWORK_REQUESTS_SNAPSHOT_TYPE, CUSTOM_CHECK_SUMMARY_MAX_LENGTH, } from "./custom-checks.types";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9e91b78d-59c2-5275-9eb5-0d4021984eb6")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="78889a89-65b0-5901-8866-651c405305a4")}catch(e){}}();
3
3
 
4
4
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
5
  if (k2 === undefined) k2 = k;
@@ -16,7 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.CustomDataSingletonInternalKey = exports.isPrAuthorRelevance = exports.SessionRelevance = void 0;
19
+ exports.CUSTOM_CHECK_SUMMARY_MAX_LENGTH = exports.NETWORK_REQUESTS_SNAPSHOT_TYPE = exports.CustomDataSingletonInternalKey = exports.isPrAuthorRelevance = exports.SessionRelevance = void 0;
20
20
  var test_run_types_1 = require("./replay/test-run.types");
21
21
  Object.defineProperty(exports, "SessionRelevance", { enumerable: true, get: function () { return test_run_types_1.SessionRelevance; } });
22
22
  Object.defineProperty(exports, "isPrAuthorRelevance", { enumerable: true, get: function () { return test_run_types_1.isPrAuthorRelevance; } });
@@ -24,5 +24,8 @@ __exportStar(require("./sdk-bundle-api/sdk-to-bundle/test-run-environment"), exp
24
24
  var session_data_1 = require("./sdk-bundle-api/sdk-to-bundle/session-data");
25
25
  Object.defineProperty(exports, "CustomDataSingletonInternalKey", { enumerable: true, get: function () { return session_data_1.CustomDataSingletonInternalKey; } });
26
26
  __exportStar(require("./sdk-bundle-api/sdk-to-bundle/event-source-data"), exports);
27
+ var custom_checks_types_1 = require("./custom-checks.types");
28
+ Object.defineProperty(exports, "NETWORK_REQUESTS_SNAPSHOT_TYPE", { enumerable: true, get: function () { return custom_checks_types_1.NETWORK_REQUESTS_SNAPSHOT_TYPE; } });
29
+ Object.defineProperty(exports, "CUSTOM_CHECK_SUMMARY_MAX_LENGTH", { enumerable: true, get: function () { return custom_checks_types_1.CUSTOM_CHECK_SUMMARY_MAX_LENGTH; } });
27
30
  //# sourceMappingURL=index.js.map
28
- //# debugId=9e91b78d-59c2-5275-9eb5-0d4021984eb6
31
+ //# debugId=78889a89-65b0-5901-8866-651c405305a4
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourceRoot":"","names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAuBA,0DAaiC;AAZ/B,kHAAA,gBAAgB,OAAA;AAChB,qHAAA,mBAAmB,OAAA;AAsBrB,sFAAoE;AAQpE,4EAsBqD;AATnD,8HAAA,8BAA8B,OAAA;AAsBhC,mFAAiE","debugId":"9e91b78d-59c2-5275-9eb5-0d4021984eb6"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourceRoot":"","names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAuBA,0DAaiC;AAZ/B,kHAAA,gBAAgB,OAAA;AAChB,qHAAA,mBAAmB,OAAA;AAsBrB,sFAAoE;AAQpE,4EAsBqD;AATnD,8HAAA,8BAA8B,OAAA;AAsBhC,mFAAiE;AA0DjE,6DAa+B;AAF7B,qIAAA,8BAA8B,OAAA;AAC9B,sIAAA,+BAA+B,OAAA","debugId":"78889a89-65b0-5901-8866-651c405305a4"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwaysmeticulous/api",
3
- "version": "2.288.0",
3
+ "version": "2.289.1",
4
4
  "description": "Meticulous API types",
5
5
  "license": "ISC",
6
6
  "main": "dist/index.js",