@alwaysmeticulous/sdk-bundles-api 2.159.0 → 2.160.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 +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/dist/record/middleware.d.ts +135 -0
- package/dist/record/middleware.js +3 -0
- package/dist/record/middleware.js.map +1 -0
- package/dist/record/record-settings.d.ts +2 -10
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { RecordConfig, RecordSettings, RecordState } from "./record";
|
|
2
2
|
export { MeticulousWindowConfig, NetworkResponseSanitizer, } from "./record/record-settings";
|
|
3
|
+
export * from "./record/middleware";
|
|
3
4
|
export { ReplayAndStoreResultsOptions, ReplayTarget, SnapshottedAssetsReplayTarget, URLReplayTarget, OriginalRecordedURLReplayTarget, ReplayExecutionOptions, ReplayOrchestratorScreenshottingOptions, GeneratedBy, GeneratedByNotebookRun, GeneratedByTestRun, GeneratedByReplayCommand, ScreenshotComparisonOptions, ScreenshotComparisonEnabledOptions, CompareScreenshotsTo, CompareScreenshotsToSpecificReplay, CompareScreenshotsToTestRun, DoNotCompareScreenshots, OutOfDateClientError, BeforeUserEventOptions, AppUrlConfig, } from "./replay-orchestrator/sdk-to-bundle/execute-replay";
|
|
4
5
|
export { ExecuteTestRunOptions } from "./replay-orchestrator/sdk-to-bundle/execute-test-run";
|
|
5
6
|
export { ExecuteScheduledTestRunOptions } from "./replay-orchestrator/sdk-to-bundle/execute-scheduled-test-run";
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./record/middleware"), exports);
|
|
3
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAKA,sDAAoC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Cookie, HarRequest, HarResponse, IDBObjectStoreWithEntries, StorageEntry, WebSocketConnectionData } from "@alwaysmeticulous/api";
|
|
2
|
+
/**
|
|
3
|
+
* Transformations that are applied to a recorder payload before it is sent to Meticulous's servers. This is
|
|
4
|
+
* useful for redacting sensitive information from the payload before it is sent.
|
|
5
|
+
*
|
|
6
|
+
* Notes:
|
|
7
|
+
* - For each of these transforms returning `null` will cause that value to be dropped from the payload.
|
|
8
|
+
* - The sanitized responses should be designed such that the app can still correctly function at replay time.
|
|
9
|
+
* For example, if you want to sanitize email addresses, replace them with a dummy email address
|
|
10
|
+
* of a current format. That will ensure that the email address will still pass any validation the application may have.
|
|
11
|
+
* - Please ensure that these functions are fast to run, and handle errors gracefully, since they'll be applied to all
|
|
12
|
+
* data. Some of the data, such as network response bodies, may be very large.
|
|
13
|
+
* - Please do not mutate the objects. Instead return a new object with the desired changes.
|
|
14
|
+
* - New fields may be added to objects in future. This means that:
|
|
15
|
+
*
|
|
16
|
+
* `transformLocalStorageEntry: ({ key, value }) => ({ key, value: "REDACTED" })`
|
|
17
|
+
*
|
|
18
|
+
* Is unsafe. While:
|
|
19
|
+
*
|
|
20
|
+
* `transformLocalStorageEntry: ({ value, ...rest }) => ({ ...rest, value: "REDACTED" })`
|
|
21
|
+
*
|
|
22
|
+
* Is safe.
|
|
23
|
+
*/
|
|
24
|
+
export interface RecorderMiddleware {
|
|
25
|
+
/**
|
|
26
|
+
* Transforms local storage entries before they are sent to Meticulous's servers.
|
|
27
|
+
*
|
|
28
|
+
* Returning null will cause the entry to be dropped from the payload.
|
|
29
|
+
*
|
|
30
|
+
* See JSDoc for {@link RecorderMiddleware} before implementing.
|
|
31
|
+
*/
|
|
32
|
+
transformLocalStorageEntry?: (entry: StorageEntry) => StorageEntry | null;
|
|
33
|
+
/**
|
|
34
|
+
* Transforms session storage entries before they are sent to Meticulous's servers.
|
|
35
|
+
*
|
|
36
|
+
* Returning null will cause the entry to be dropped from the payload.
|
|
37
|
+
*
|
|
38
|
+
* See JSDoc for {@link RecorderMiddleware} before implementing.
|
|
39
|
+
*/
|
|
40
|
+
transformSessionStorageEntry?: (entry: StorageEntry) => StorageEntry | null;
|
|
41
|
+
/**
|
|
42
|
+
* Transforms IndexedDB entries before they are sent to Meticulous's servers.
|
|
43
|
+
*
|
|
44
|
+
* Returning null will cause the entry to be dropped from the payload.
|
|
45
|
+
*
|
|
46
|
+
* Please note that the entries for a single database may be split across multiple payloads.
|
|
47
|
+
*
|
|
48
|
+
* See JSDoc for {@link RecorderMiddleware} before implementing.
|
|
49
|
+
*/
|
|
50
|
+
transformIndexedDBEntries?: (entries: IndexedDBStoreEntries) => IndexedDBStoreEntries | null;
|
|
51
|
+
/**
|
|
52
|
+
* Transforms cookies before they are sent to Meticulous's servers.
|
|
53
|
+
*
|
|
54
|
+
* Returning null will cause the cookie to be dropped from the payload.
|
|
55
|
+
*
|
|
56
|
+
* See JSDoc for {@link RecorderMiddleware} before implementing.
|
|
57
|
+
*/
|
|
58
|
+
transformCookie?: (cookie: Cookie) => Cookie | null;
|
|
59
|
+
/**
|
|
60
|
+
* Transforms network requests before they are sent to Meticulous's servers.
|
|
61
|
+
*
|
|
62
|
+
* Please ensure you call tryLoadAndStartRecorder with your middleware, or set
|
|
63
|
+
* `window.METICULOUS_RECORDER_MIDDLEWARE_V1`, when Meticulous is replaying sessions at test time ('replay time'),
|
|
64
|
+
* and not just when you want to record. This allows Meticulous to auto-detect your middleware and transform the
|
|
65
|
+
* requests at replay time when finding an appropiate request to match with. This enables correctly matching
|
|
66
|
+
* requests with the corresponding saved responses even if the requests have been substantially transformed by
|
|
67
|
+
* your middleware.
|
|
68
|
+
*
|
|
69
|
+
* Please note however that enough unique information must still be preserved in the redacted network request
|
|
70
|
+
* to allow Meticulous to correctly match a request that is performed at replay time by your application with
|
|
71
|
+
* the correct corresponding saved request stored in the recording / recorded session.
|
|
72
|
+
*
|
|
73
|
+
* For example: if you replace all query string values with "[REDACTED]", and there are multiple distinct requests with
|
|
74
|
+
* identical paths but different query string values then Meticulous will not have enough information to match
|
|
75
|
+
* them correctly. However if instead you md5 hash all query string values then Meticulous would have enough
|
|
76
|
+
* information to match the requests correctly.
|
|
77
|
+
*
|
|
78
|
+
* Note: returning null will cause the request and the corresponding response to be dropped from the payload.
|
|
79
|
+
* If the request/response is dropped from the payload but at replay time your application still makes
|
|
80
|
+
* the request then Meticulous will look for another closely matching recorded request, and replay that,
|
|
81
|
+
* or if none can be found it will fail the request with 'net::ERR_FAILED'/'Failed to fetch'.
|
|
82
|
+
*
|
|
83
|
+
* See JSDoc for {@link RecorderMiddleware} before implementing.
|
|
84
|
+
*/
|
|
85
|
+
transformNetworkRequest?: (request: Omit<HarRequest, "queryString">, metadata: NetworkRequestMetadata) => Omit<HarRequest, "queryString"> | null;
|
|
86
|
+
/**
|
|
87
|
+
* Transforms network requests before they are sent to Meticulous's servers.
|
|
88
|
+
*
|
|
89
|
+
* Returning null will cause the request and the response to be dropped from the payload.
|
|
90
|
+
* If the request/response is dropped from the payload but at replay time your application still makes
|
|
91
|
+
* the request then Meticulous will look for another closely matching recorded request, and replay that,
|
|
92
|
+
* or if none can be found it will fail the request with 'net::ERR_FAILED'/'Failed to fetch'.
|
|
93
|
+
*
|
|
94
|
+
* See JSDoc for {@link RecorderMiddleware} before implementing.
|
|
95
|
+
*/
|
|
96
|
+
transformNetworkResponse?: (response: HarResponse, metadata: NetworkResponseMetadata) => HarResponse | null;
|
|
97
|
+
/**
|
|
98
|
+
* Transforms WebSocket messages before they are sent to Meticulous's servers.
|
|
99
|
+
*
|
|
100
|
+
* Returning null will cause the data to be dropped from the payload.
|
|
101
|
+
*
|
|
102
|
+
* Please note that the messages sent across a connection to a single URL may be split across multiple payloads.
|
|
103
|
+
*
|
|
104
|
+
* Note: we pass the WebSocketConnectionData to your middleware without the id field, and re-add the id field after
|
|
105
|
+
* you return the transformed data.
|
|
106
|
+
*
|
|
107
|
+
* See JSDoc for {@link RecorderMiddleware} before implementing.
|
|
108
|
+
*/
|
|
109
|
+
transformWebSocketConnectionData?: (entry: Omit<WebSocketConnectionData, "id">) => Omit<WebSocketConnectionData, "id"> | null;
|
|
110
|
+
}
|
|
111
|
+
export interface IndexedDBStoreEntries {
|
|
112
|
+
databaseName: string;
|
|
113
|
+
objectStoreName: string;
|
|
114
|
+
entries: IDBObjectStoreWithEntries["entries"];
|
|
115
|
+
}
|
|
116
|
+
export interface NetworkRequestMetadata {
|
|
117
|
+
/**
|
|
118
|
+
* Milliseconds since unix epoch when the request was sent
|
|
119
|
+
*
|
|
120
|
+
* Note: this is only defined at record time, not when we redact the requests at replay time
|
|
121
|
+
* for matching with the stored redacted requests in the original recording. See JSDoc on
|
|
122
|
+
* {@link RecorderMiddleware.transformNetworkRequest} for more information.
|
|
123
|
+
*/
|
|
124
|
+
requestStartedAt?: number;
|
|
125
|
+
}
|
|
126
|
+
export interface NetworkResponseMetadata {
|
|
127
|
+
/**
|
|
128
|
+
* Milliseconds since unix epoch when the request was sent
|
|
129
|
+
*/
|
|
130
|
+
requestStartedAt: number;
|
|
131
|
+
/**
|
|
132
|
+
* Milliseconds since unix epoch when the response was received
|
|
133
|
+
*/
|
|
134
|
+
responseReceivedAt: number;
|
|
135
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../src/record/middleware.ts"],"names":[],"mappings":""}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NetworkResponseMetadata, RecorderMiddleware } from "./middleware";
|
|
1
2
|
export interface MeticulousWindowConfig {
|
|
2
3
|
METICULOUS_RECORDING_TOKEN?: string;
|
|
3
4
|
METICULOUS_UPLOAD_INTERVAL_MS?: number;
|
|
@@ -6,6 +7,7 @@ export interface MeticulousWindowConfig {
|
|
|
6
7
|
METICULOUS_FORCE_RECORDING?: boolean;
|
|
7
8
|
METICULOUS_IS_PRODUCTION_ENVIRONMENT?: boolean;
|
|
8
9
|
METICULOUS_NETWORK_RESPONSE_SANITIZERS?: NetworkResponseSanitizer[];
|
|
10
|
+
METICULOUS_RECORDER_MIDDLEWARE_V1: RecorderMiddleware[];
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* Allows sanitizing network responses before they are sent to Meticulous's servers.
|
|
@@ -26,13 +28,3 @@ export interface NetworkResponseSanitizer {
|
|
|
26
28
|
*/
|
|
27
29
|
sanitizeBody: (body: string, metadata: NetworkResponseMetadata) => string;
|
|
28
30
|
}
|
|
29
|
-
export interface NetworkResponseMetadata {
|
|
30
|
-
/**
|
|
31
|
-
* Milliseconds since unix epoch when the request was sent
|
|
32
|
-
*/
|
|
33
|
-
requestStartedAt: number;
|
|
34
|
-
/**
|
|
35
|
-
* Milliseconds since unix epoch when the response was received
|
|
36
|
-
*/
|
|
37
|
-
responseReceivedAt: number;
|
|
38
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwaysmeticulous/sdk-bundles-api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.160.0",
|
|
4
4
|
"description": "Meticulous common types",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"bugs": {
|
|
47
47
|
"url": "https://github.com/alwaysmeticulous/meticulous-sdk/issues"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "d1e2c73931448733dd3ad91d9def2720bb5f3b47"
|
|
50
50
|
}
|