@alwaysmeticulous/sdk-bundles-api 2.163.0 → 2.164.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.
@@ -59,26 +59,37 @@ export interface RecorderMiddleware {
59
59
  /**
60
60
  * Transforms network requests before they are sent to Meticulous's servers.
61
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'.
62
+ * If you are only transforming headers, and nothing else then set {@link applyRequestTransformationAtReplayTime}
63
+ * to false.
64
+ *
65
+ * If you are transforming URLs, query strings or request bodies, or sometimes returning null, then:
66
+ *
67
+ * 1. Please ensure you call tryLoadAndStartRecorder with your middleware, or set
68
+ * `window.METICULOUS_RECORDER_MIDDLEWARE_V1`, when Meticulous is replaying sessions at test time
69
+ * ('replay time'), and not just when you want to record. This allows Meticulous to auto-detect your
70
+ * middleware and transform the requests at replay time when finding an appropiate request to match
71
+ * with. This enables correctly matching requests with the corresponding saved responses even if the
72
+ * requests have been substantially transformed by your middleware.
73
+ *
74
+ * 2. Please avoid changing the transformations applied based on context that may differ at replay time.
75
+ * For example, if you change whether you apply transformNetworkRequest based on whether the current URL contains
76
+ * 'staging', then when replaying the recorded session that network request transformer would not be applied
77
+ * (URL does not contain 'staging', even if the original session was recorded on a staging environment), and
78
+ * so the request may not be able to be matched correctly.
79
+ *
80
+ * 3. Enough unique information must still be preserved in the redacted network request to allow Meticulous
81
+ * to correctly match a request that is performed at replay time by your application with
82
+ * the correct corresponding saved request stored in the recording / recorded session.
83
+ *
84
+ * For example: if you replace all query string values with "[REDACTED]", and there are multiple distinct
85
+ * requests with identical paths but different query string values then Meticulous will not have enough
86
+ * information to match them correctly. However if instead you md5 hash all query string values then
87
+ * Meticulous would have enough information to match the requests correctly.
88
+ *
89
+ * 4. Returning null will cause the request and the corresponding response to be dropped from the payload.
90
+ * At replay time if there is no exact match for a request that is transformed to null then the request
91
+ * will be failed with 'net::ERR_FAILED'/'Failed to fetch' rather than automatically trying to find a
92
+ * 'closest match' in the recorded session.
82
93
  *
83
94
  * See JSDoc for {@link RecorderMiddleware} before implementing.
84
95
  */
@@ -107,6 +118,13 @@ export interface RecorderMiddleware {
107
118
  * See JSDoc for {@link RecorderMiddleware} before implementing.
108
119
  */
109
120
  transformWebSocketConnectionData?: (entry: Omit<WebSocketConnectionData, "id">) => Omit<WebSocketConnectionData, "id"> | null;
121
+ /**
122
+ * Defaults to true. Set to false if transformNetworkRequest only transforms the headers and not the URL or body of the request,
123
+ * and transformNetworkRequest never returns null. Setting to false when not required improves replay performance.
124
+ *
125
+ * See {@link transformNetworkRequest} for more details.
126
+ */
127
+ applyRequestTransformationAtReplayTime?: boolean;
110
128
  }
111
129
  export interface IndexedDBStoreEntries {
112
130
  databaseName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwaysmeticulous/sdk-bundles-api",
3
- "version": "2.163.0",
3
+ "version": "2.164.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.163.0"
22
+ "@alwaysmeticulous/api": "^2.164.0"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "loglevel": "^1.8.0"
@@ -46,5 +46,5 @@
46
46
  "bugs": {
47
47
  "url": "https://github.com/alwaysmeticulous/meticulous-sdk/issues"
48
48
  },
49
- "gitHead": "3433132494bcd861f837662603d25556521dbeac"
49
+ "gitHead": "bdd7d1efdfb45a6d49618f369d56000a1eef337e"
50
50
  }