@crawlee/utils 4.0.0-beta.46 → 4.0.0-beta.48
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/internals/debug.d.ts +10 -0
- package/internals/debug.d.ts.map +1 -1
- package/internals/debug.js +22 -0
- package/internals/debug.js.map +1 -1
- package/package.json +5 -5
package/internals/debug.d.ts
CHANGED
|
@@ -27,6 +27,16 @@ interface Request<UserData extends Dictionary = Dictionary> {
|
|
|
27
27
|
* @param [additionalFields] Object containing additional fields to be added.
|
|
28
28
|
*/
|
|
29
29
|
export declare function createRequestDebugInfo(request: Request, response?: IncomingMessage | Partial<BrowserResponseLike>, additionalFields?: Dictionary): Dictionary;
|
|
30
|
+
/**
|
|
31
|
+
* Returns a human-readable label for an unknown value,
|
|
32
|
+
* suitable for embedding in error messages and log output.
|
|
33
|
+
*
|
|
34
|
+
* Returns `constructor.name` when available (e.g. `"Configuration"`, `"Number"`),
|
|
35
|
+
* otherwise falls back to `util.inspect` (e.g. for `null`, `undefined`).
|
|
36
|
+
*
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export declare function inspectValue(value: unknown): string;
|
|
30
40
|
export declare function getObjectType(value: unknown): string;
|
|
31
41
|
export {};
|
|
32
42
|
//# sourceMappingURL=debug.d.ts.map
|
package/internals/debug.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/internals/debug.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/internals/debug.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGrE,UAAU,mBAAmB;IACzB,MAAM,IAAI,MAAM,CAAC;CACpB;AAED,UAAU,OAAO,CAAC,QAAQ,SAAS,UAAU,GAAG,UAAU;IACtD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAClC,OAAO,EAAE,OAAO,EAChB,QAAQ,GAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAM,EAC7D,gBAAgB,GAAE,UAAe,GAClC,UAAU,CAmBZ;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAYnD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAepD"}
|
package/internals/debug.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { inspect } from 'node:util';
|
|
1
2
|
import ow from 'ow';
|
|
2
3
|
/**
|
|
3
4
|
* Creates a standardized debug info from request and response. This info is usually added to dataset under the hidden `#debug` field.
|
|
@@ -26,6 +27,27 @@ export function createRequestDebugInfo(request, response = {}, additionalFields
|
|
|
26
27
|
...additionalFields,
|
|
27
28
|
};
|
|
28
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Returns a human-readable label for an unknown value,
|
|
32
|
+
* suitable for embedding in error messages and log output.
|
|
33
|
+
*
|
|
34
|
+
* Returns `constructor.name` when available (e.g. `"Configuration"`, `"Number"`),
|
|
35
|
+
* otherwise falls back to `util.inspect` (e.g. for `null`, `undefined`).
|
|
36
|
+
*
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export function inspectValue(value) {
|
|
40
|
+
if (typeof value === 'object' && value !== null && value.constructor?.name) {
|
|
41
|
+
return value.constructor.name;
|
|
42
|
+
}
|
|
43
|
+
return inspect(value, {
|
|
44
|
+
depth: 0,
|
|
45
|
+
compact: true,
|
|
46
|
+
maxStringLength: 64,
|
|
47
|
+
breakLength: Infinity,
|
|
48
|
+
colors: false,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
29
51
|
export function getObjectType(value) {
|
|
30
52
|
const simple = typeof value;
|
|
31
53
|
if (['string', 'number', 'boolean', 'bigint'].includes(simple)) {
|
package/internals/debug.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/internals/debug.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/internals/debug.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,MAAM,IAAI,CAAC;AAqBpB;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAClC,OAAgB,EAChB,WAA2D,EAAE,EAC7D,mBAA+B,EAAE;IAEjC,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;IACvB,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;IACxB,EAAE,CAAC,gBAAgB,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;IAEhC,OAAO;QACH,SAAS,EAAE,OAAO,CAAC,EAAE;QACrB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,MAAM,EAAE,OAAO,C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,QAAQ,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;AACnF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/utils",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.48",
|
|
4
4
|
"description": "A set of shared utilities that can be used by crawlers",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.0.0"
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://crawlee.dev",
|
|
37
37
|
"scripts": {
|
|
38
|
-
"build": "
|
|
38
|
+
"build": "pnpm clean && pnpm compile && pnpm copy",
|
|
39
39
|
"clean": "rimraf ./dist",
|
|
40
40
|
"compile": "tsc -p tsconfig.build.json",
|
|
41
41
|
"copy": "tsx ../../scripts/copy.ts"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@apify/ps-tree": "^1.2.0",
|
|
45
|
-
"@crawlee/http-client": "4.0.0-beta.
|
|
46
|
-
"@crawlee/types": "4.0.0-beta.
|
|
45
|
+
"@crawlee/http-client": "4.0.0-beta.48",
|
|
46
|
+
"@crawlee/types": "4.0.0-beta.48",
|
|
47
47
|
"@types/sax": "^1.2.7",
|
|
48
48
|
"cheerio": "^1.0.0",
|
|
49
49
|
"domhandler": "^5.0.3",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "67b9224bb33304565d8eedbeaa68a282bc8384a1"
|
|
65
65
|
}
|