bdy 1.9.0-dev → 1.9.1-dev

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.9.0-dev",
4
+ "version": "1.9.1-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -42,6 +42,8 @@ exports.snapshotSchema = zod_1.z.object({
42
42
  .array(zod_1.z.object({
43
43
  name: zod_1.z.string(),
44
44
  value: zod_1.z.string(),
45
+ domain: zod_1.z.string().optional(),
46
+ path: zod_1.z.string().optional(),
45
47
  }))
46
48
  .optional()
47
49
  .default([]),
@@ -38,13 +38,28 @@ function prepareSnapshotPlugin(data) {
38
38
  try {
39
39
  const validatedData = schemas_js_1.snapshotSchema.parse(data);
40
40
  const { version, ...snapshot } = validatedData;
41
+ const cookies = snapshot.cookies.map((cookie) => {
42
+ if (cookie.domain) {
43
+ return cookie;
44
+ }
45
+ else if (cookie.path) {
46
+ return cookie;
47
+ }
48
+ else {
49
+ const domain = new URL(snapshot.url).hostname;
50
+ return {
51
+ ...cookie,
52
+ domain,
53
+ };
54
+ }
55
+ });
41
56
  return {
42
57
  ...snapshot,
43
58
  resources: snapshot.resources ?? [],
44
59
  devices: snapshot.devices ?? [],
45
60
  enableJavaScript: snapshot.enableJavaScript ?? false,
46
61
  resourceDiscoveryTimeout: snapshot.resourceDiscoveryTimeout ?? 0,
47
- cookies: snapshot.cookies ?? [],
62
+ cookies,
48
63
  };
49
64
  }
50
65
  catch (error) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.9.0-dev",
4
+ "version": "1.9.1-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {