@crawlee/utils 4.0.0-beta.194 → 4.0.0-beta.195

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.
@@ -47,7 +47,7 @@ export declare const typedArray: z.ZodCustom<NodeJS.TypedArray<ArrayBufferLike>,
47
47
  */
48
48
  export declare const plainObject: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
49
49
  /**
50
- * Shape of a request stored in a request queue.
50
+ * Shape of a request stored in a request queue. Compiled: storage clients validate every request with it.
51
51
  * @internal
52
52
  */
53
53
  export declare const storageRequest: z.ZodObject<{
@@ -54,11 +54,7 @@ export const typedArray = z.custom((value) => ArrayBuffer.isView(value) && !(val
54
54
  * @internal
55
55
  */
56
56
  export const plainObject = z.custom((value) => typeof value === 'object' && value !== null && !Array.isArray(value), { message: 'Invalid input: expected an object' });
57
- /**
58
- * Shape of a request stored in a request queue.
59
- * @internal
60
- */
61
- export const storageRequest = z.looseObject({
57
+ const storageRequestShape = z.looseObject({
62
58
  id: z.string(),
63
59
  url: z.url({ protocol: /^https?$/ }),
64
60
  uniqueKey: z.string(),
@@ -66,11 +62,16 @@ export const storageRequest = z.looseObject({
66
62
  retryCount: z.number().int().optional(),
67
63
  handledAt: z.union([z.string(), z.date()]).optional(),
68
64
  });
65
+ /**
66
+ * Shape of a request stored in a request queue. Compiled: storage clients validate every request with it.
67
+ * @internal
68
+ */
69
+ export const storageRequest = z.compile(storageRequestShape);
69
70
  /**
70
71
  * {@link storageRequest} before an id is assigned.
71
72
  * @internal
72
73
  */
73
- export const storageRequestWithoutId = storageRequest.omit({ id: true });
74
+ export const storageRequestWithoutId = z.compile(storageRequestShape.omit({ id: true }));
74
75
  /**
75
76
  * `z.array(item)` whose top-level type error names the element type — ``expected an array of numbers`` —
76
77
  * instead of zod's bare `expected array`. Element failures keep zod's per-index messages, and `elements`
@@ -86,7 +87,7 @@ export function arrayOf(item, elements) {
86
87
  * Batch of {@link storageRequestWithoutId}.
87
88
  * @internal
88
89
  */
89
- export const storageRequestBatch = arrayOf(storageRequestWithoutId, 'requests');
90
+ export const storageRequestBatch = z.compile(arrayOf(storageRequestWithoutId, 'requests'));
90
91
  /**
91
92
  * Options of request queue add/update operations.
92
93
  * @internal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/utils",
3
- "version": "4.0.0-beta.194",
3
+ "version": "4.0.0-beta.195",
4
4
  "description": "A set of shared utilities that can be used by crawlers",
5
5
  "engines": {
6
6
  "node": ">=22.0.0"
@@ -44,8 +44,8 @@
44
44
  "dependencies": {
45
45
  "@apify/ps-tree": "^1.2.0",
46
46
  "@apify/validations": "^1.1.0",
47
- "@crawlee/http-client": "4.0.0-beta.194",
48
- "@crawlee/types": "4.0.0-beta.194",
47
+ "@crawlee/http-client": "4.0.0-beta.195",
48
+ "@crawlee/types": "4.0.0-beta.195",
49
49
  "@types/sax": "^1.2.7",
50
50
  "cheerio": "^1.0.0",
51
51
  "domhandler": "^5.0.3",
@@ -64,5 +64,5 @@
64
64
  }
65
65
  }
66
66
  },
67
- "gitHead": "c1f1ba3f6d24d5de59360c0616c49ce557ceb290"
67
+ "gitHead": "7ef1df353c43614acc1275a53ef8ca96e850fe3e"
68
68
  }