@crawlee/core 4.0.0-beta.250 → 4.0.0-beta.252

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.
Files changed (2) hide show
  1. package/package.json +6 -6
  2. package/request.js +7 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/core",
3
- "version": "4.0.0-beta.250",
3
+ "version": "4.0.0-beta.252",
4
4
  "description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
5
5
  "engines": {
6
6
  "node": ">=22.13.0"
@@ -53,10 +53,10 @@
53
53
  "@apify/log": "^3.0.1",
54
54
  "@apify/timeout": "^1.0.1",
55
55
  "@apify/utilities": "^3.1.0",
56
- "@crawlee/fs-storage": "4.0.0-beta.250",
57
- "@crawlee/http-client": "4.0.0-beta.250",
58
- "@crawlee/types": "4.0.0-beta.250",
59
- "@crawlee/utils": "4.0.0-beta.250",
56
+ "@crawlee/fs-storage": "4.0.0-beta.252",
57
+ "@crawlee/http-client": "4.0.0-beta.252",
58
+ "@crawlee/types": "4.0.0-beta.252",
59
+ "@crawlee/utils": "4.0.0-beta.252",
60
60
  "@sapphire/async-queue": "^1.5.5",
61
61
  "@standard-schema/spec": "^1.1.0",
62
62
  "@vladfrangu/async_event_emitter": "^2.4.7",
@@ -76,5 +76,5 @@
76
76
  }
77
77
  }
78
78
  },
79
- "gitHead": "894ea551fedd04fbf2394731fb85010468ccc31b"
79
+ "gitHead": "50081244ad848b4f3df48c19953166629909af49"
80
80
  }
package/request.js CHANGED
@@ -2,6 +2,7 @@ import crypto from 'node:crypto';
2
2
  import { z } from 'zod';
3
3
  import { cryptoRandomObjectId, normalizeUrl } from '@apify/utilities';
4
4
  import { serviceLocator } from './service-locator.js';
5
+ import { snapshotValue } from './storages/transaction.js';
5
6
  import { parseArgument, schemas } from './validators.js';
6
7
  // new properties on the Request object breaks serialization
7
8
  // Compiled once: every `Request` runs it, and the generated fast path skips zod's interpreter.
@@ -161,7 +162,10 @@ class CrawleeRequest {
161
162
  // Read `__crawlee` explicitly - on a `userData` coming from another Request instance the
162
163
  // bag is non-enumerable, so the spread alone would silently drop the internal state
163
164
  // (e.g. `skipNavigation`) when a request is re-wrapped after a storage round trip.
164
- this.#userData = { __crawlee: userData.__crawlee ?? {}, ...userData };
165
+ this.#userData = {
166
+ ...snapshotValue(userData),
167
+ __crawlee: snapshotValue(userData.__crawlee ?? {}),
168
+ };
165
169
  // `userData` must stay an enumerable own accessor — serialization in the storages relies on it
166
170
  Object.defineProperties(this, {
167
171
  userData: {
@@ -192,8 +196,8 @@ class CrawleeRequest {
192
196
  enumerable: true,
193
197
  },
194
198
  });
195
- // reassign userData to ensure internal `__crawlee` object is non-enumerable
196
- this.userData = userData;
199
+ // reassign the copy, not the possibly shared `userData`, so that internal `__crawlee` object is non-enumerable
200
+ this.userData = this.#userData;
197
201
  const crawlee = (this.userData.__crawlee ??= {});
198
202
  if (skipNavigation != null)
199
203
  crawlee.skipNavigation = skipNavigation;