@crawlee/core 3.18.2-beta.5 → 3.18.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/package.json +6 -6
- package/serialization.d.ts +1 -1
- package/serialization.js +5 -4
- package/storages/request_list.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/core",
|
|
3
|
-
"version": "3.18.2
|
|
3
|
+
"version": "3.18.2",
|
|
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": ">=16.0.0"
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"@apify/pseudo_url": "^2.0.30",
|
|
60
60
|
"@apify/timeout": "^0.4.0",
|
|
61
61
|
"@apify/utilities": "^2.7.10",
|
|
62
|
-
"@crawlee/memory-storage": "3.18.2
|
|
63
|
-
"@crawlee/types": "3.18.2
|
|
64
|
-
"@crawlee/utils": "3.18.2
|
|
62
|
+
"@crawlee/memory-storage": "3.18.2",
|
|
63
|
+
"@crawlee/types": "3.18.2",
|
|
64
|
+
"@crawlee/utils": "3.18.2",
|
|
65
65
|
"@sapphire/async-queue": "^1.5.1",
|
|
66
66
|
"@standard-schema/spec": "^1.0.0",
|
|
67
67
|
"@vladfrangu/async_event_emitter": "^2.2.2",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"json5": "^2.2.3",
|
|
72
72
|
"minimatch": "^9.0.0",
|
|
73
73
|
"ow": "^0.28.1",
|
|
74
|
-
"stream-json": "
|
|
74
|
+
"stream-json": "~3.7.0",
|
|
75
75
|
"tldts": "^7.0.0",
|
|
76
76
|
"tough-cookie": "^6.0.0",
|
|
77
77
|
"tslib": "^2.4.0",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "96ed398b26954f0e7818cc862f33ff4bb706c84b"
|
|
88
88
|
}
|
package/serialization.d.ts
CHANGED
|
@@ -28,4 +28,4 @@ export declare function deserializeArray<T extends string | Buffer>(compressedDa
|
|
|
28
28
|
* optimized to ingest a Stream if and when apify-client supports streams.
|
|
29
29
|
* @internal
|
|
30
30
|
*/
|
|
31
|
-
export declare function createDeserialize(compressedData: Buffer | Uint8Array): Readable
|
|
31
|
+
export declare function createDeserialize(compressedData: Buffer | Uint8Array): Promise<Readable>;
|
package/serialization.js
CHANGED
|
@@ -8,7 +8,6 @@ const node_stream_1 = require("node:stream");
|
|
|
8
8
|
const node_util_1 = tslib_1.__importDefault(require("node:util"));
|
|
9
9
|
const node_zlib_1 = tslib_1.__importDefault(require("node:zlib"));
|
|
10
10
|
const ow_1 = tslib_1.__importDefault(require("ow"));
|
|
11
|
-
const StreamArray_1 = tslib_1.__importDefault(require("stream-json/streamers/StreamArray"));
|
|
12
11
|
const pipeline = node_util_1.default.promisify(node_stream_1.pipeline);
|
|
13
12
|
/**
|
|
14
13
|
* Transforms an array of items to a JSON in a streaming
|
|
@@ -94,8 +93,9 @@ async function serializeArray(data) {
|
|
|
94
93
|
*/
|
|
95
94
|
async function deserializeArray(compressedData) {
|
|
96
95
|
(0, ow_1.default)(compressedData, ow_1.default.uint8Array);
|
|
96
|
+
const { default: StreamArray } = await import('stream-json/streamers/stream-array.js');
|
|
97
97
|
const { chunks, collector } = createChunkCollector({ fromValuesStream: true });
|
|
98
|
-
await pipeline(node_stream_1.Readable.from([compressedData]), node_zlib_1.default.createGunzip(),
|
|
98
|
+
await pipeline(node_stream_1.Readable.from([compressedData]), node_zlib_1.default.createGunzip(), StreamArray.withParserAsStream(), collector);
|
|
99
99
|
return chunks;
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
@@ -107,9 +107,10 @@ async function deserializeArray(compressedData) {
|
|
|
107
107
|
* optimized to ingest a Stream if and when apify-client supports streams.
|
|
108
108
|
* @internal
|
|
109
109
|
*/
|
|
110
|
-
function createDeserialize(compressedData) {
|
|
110
|
+
async function createDeserialize(compressedData) {
|
|
111
111
|
(0, ow_1.default)(compressedData, ow_1.default.uint8Array);
|
|
112
|
-
const
|
|
112
|
+
const { default: StreamArray } = await import('stream-json/streamers/stream-array.js');
|
|
113
|
+
const streamArray = StreamArray.withParserAsStream();
|
|
113
114
|
const destination = pluckValue(streamArray);
|
|
114
115
|
(0, node_stream_1.pipeline)(node_stream_1.Readable.from([compressedData]), node_zlib_1.default.createGunzip(), destination,
|
|
115
116
|
// @ts-expect-error Something's wrong here, the types are wrong but tests fail if we correct the code to make them right
|
package/storages/request_list.js
CHANGED
|
@@ -291,7 +291,7 @@ class RequestList {
|
|
|
291
291
|
}
|
|
292
292
|
this.sources = [];
|
|
293
293
|
this.areRequestsPersisted = true;
|
|
294
|
-
const requestStream = (0, serialization_1.createDeserialize)(persistedRequests);
|
|
294
|
+
const requestStream = await (0, serialization_1.createDeserialize)(persistedRequests);
|
|
295
295
|
for await (const request of requestStream) {
|
|
296
296
|
this._addRequest(request);
|
|
297
297
|
}
|