@alwaysmeticulous/api 2.288.0 → 2.288.2
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/custom-checks.types.d.ts +113 -0
- package/dist/custom-checks.types.js +18 -0
- package/dist/custom-checks.types.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,113 @@
|
|
|
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
|
+
* - `pass`: no regression; the check is green and no report is surfaced.
|
|
33
|
+
* - `warn`: the check is green but its report is shown to the user.
|
|
34
|
+
* - `fail`: the check is red.
|
|
35
|
+
* - `execution-error`: the check failed to run.
|
|
36
|
+
*/
|
|
37
|
+
export type CustomCheckVerdict = "pass" | "warn" | "fail" | "execution-error";
|
|
38
|
+
/**
|
|
39
|
+
* Maximum length of a custom check `summary`. The summary is rendered inline in
|
|
40
|
+
* the UI, so it is truncated to this many characters when displayed rather than
|
|
41
|
+
* relying on plugin authors to keep it short.
|
|
42
|
+
*/
|
|
43
|
+
export declare const CUSTOM_CHECK_SUMMARY_MAX_LENGTH = 500;
|
|
44
|
+
/** The result a custom check returns after comparing the snapshots. */
|
|
45
|
+
export interface CustomCheckOutput {
|
|
46
|
+
verdict: CustomCheckVerdict;
|
|
47
|
+
/**
|
|
48
|
+
* A short summary shown inline in the UI, e.g. "+30mb inc bundle size".
|
|
49
|
+
* Truncated to {@link CUSTOM_CHECK_SUMMARY_MAX_LENGTH} characters when displayed.
|
|
50
|
+
*/
|
|
51
|
+
summary?: string;
|
|
52
|
+
report: CustomCheckReport;
|
|
53
|
+
}
|
|
54
|
+
/** A report rendered in the UI when the check is opened. Markdown for now. */
|
|
55
|
+
export type CustomCheckReport = MarkdownReport;
|
|
56
|
+
export interface MarkdownReport {
|
|
57
|
+
type: "markdown";
|
|
58
|
+
markdown: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The contract a custom check implements: `execute` compares the base and head
|
|
62
|
+
* snapshots and returns a verdict and report.
|
|
63
|
+
*/
|
|
64
|
+
export interface CustomCheck {
|
|
65
|
+
execute: (input: CustomCheckInput) => Promise<CustomCheckOutput>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Manifest describing a custom check plugin to Meticulous. It sits alongside the
|
|
69
|
+
* built entrypoint and is loaded (without executing the check) so the check can
|
|
70
|
+
* be discovered ahead of time.
|
|
71
|
+
*/
|
|
72
|
+
export interface CustomCheckPluginManifest {
|
|
73
|
+
/** Stable identifier for the check, e.g. "accessibility-check". */
|
|
74
|
+
id: string;
|
|
75
|
+
type: "custom-check";
|
|
76
|
+
/** Plugin version, e.g. "1.0.0". */
|
|
77
|
+
version: string;
|
|
78
|
+
configuration: {
|
|
79
|
+
/** Name shown in the UI, e.g. "Accessibility". */
|
|
80
|
+
displayName: string;
|
|
81
|
+
/** The snapshot types this check consumes, e.g. ["network-requests"]. */
|
|
82
|
+
handlesSnapshotTypes: string[];
|
|
83
|
+
/** Path to the built entrypoint, relative to the manifest, e.g. "./entrypoint.js". */
|
|
84
|
+
entryPoint: string;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/** A Meticulous plugin manifest. Only custom checks are supported today. */
|
|
88
|
+
export type PluginManifest = CustomCheckPluginManifest;
|
|
89
|
+
/**
|
|
90
|
+
* The snapshot `type` of the built-in network requests snapshot. Checks that
|
|
91
|
+
* consume it receive `Snapshot<NetworkRequestSnapshotData>` values.
|
|
92
|
+
*/
|
|
93
|
+
export declare const NETWORK_REQUESTS_SNAPSHOT_TYPE = "network-requests";
|
|
94
|
+
/**
|
|
95
|
+
* `data` of a built-in "network-requests" snapshot: a single xhr/fetch request
|
|
96
|
+
* captured during the replay, with the stubbed response that was served.
|
|
97
|
+
*
|
|
98
|
+
* `requestBody`/`responseBody` may be truncated (large bodies are ellipsized
|
|
99
|
+
* with an MD5 of the remainder, so body changes are still detectable); url,
|
|
100
|
+
* method, status and headers are captured in full.
|
|
101
|
+
*/
|
|
102
|
+
export interface NetworkRequestSnapshotData {
|
|
103
|
+
url: string;
|
|
104
|
+
method: string;
|
|
105
|
+
requestHeaders: HarRequest["headers"];
|
|
106
|
+
requestBody?: string;
|
|
107
|
+
/** Status of the response served, or null if the request was not matched. */
|
|
108
|
+
status: number | null;
|
|
109
|
+
responseHeaders: HarResponse["headers"];
|
|
110
|
+
responseBody?: string;
|
|
111
|
+
/** Whether the request was matched to a recorded request and stubbed. */
|
|
112
|
+
matched: boolean;
|
|
113
|
+
}
|
|
@@ -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]="aaa133b4-907a-5e85-b83c-765d117cdeec")}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=aaa133b4-907a-5e85-b83c-765d117cdeec
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-checks.types.js","sources":["../src/custom-checks.types.ts"],"sourceRoot":"","names":[],"mappings":";;;;;AAgDA;;;;GAIG;AACU,QAAA,+BAA+B,GAAG,GAAG,CAAC;AA4DnD;;;GAGG;AACU,QAAA,8BAA8B,GAAG,kBAAkB,CAAC","debugId":"aaa133b4-907a-5e85-b83c-765d117cdeec"}
|
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]="
|
|
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=
|
|
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":"
|
|
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"}
|