Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/cloudflare/patches/browser-rendering/getCrawl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"response": {
"properties": {
"records[].metadata": { "optional": true },
"cursor": { "type": "number", "nullable": true }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,6 @@ paths:
type: string
description: Markdown of the content of the crawled URL.
required:
- metadata
- status
- url
description: List of crawl job records.
Expand All @@ -427,7 +426,9 @@ paths:
type: number
description: Total current number of URLs in the crawl job.
cursor:
type: string
oneOf:
- type: number
nullable: true
description: Cursor for pagination.
required:
- id
Expand Down
21 changes: 13 additions & 8 deletions packages/cloudflare/src/services/browser-rendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ export interface GetCrawlResponse {
finished: number;
/** List of crawl job records. */
records: {
metadata: { status: number; url: string; title?: string | null };
metadata?: { status: number; url: string; title?: string | null } | null;
status:
| "queued"
| "errored"
Expand All @@ -433,7 +433,7 @@ export interface GetCrawlResponse {
/** Total current number of URLs in the crawl job. */
total: number;
/** Cursor for pagination. */
cursor?: string | null;
cursor?: number | null;
}

export const GetCrawlResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
Expand All @@ -442,11 +442,16 @@ export const GetCrawlResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
finished: Schema.Number,
records: Schema.Array(
Schema.Struct({
metadata: Schema.Struct({
status: Schema.Number,
url: Schema.String,
title: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}),
metadata: Schema.optional(
Schema.Union([
Schema.Struct({
status: Schema.Number,
url: Schema.String,
title: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}),
Schema.Null,
]),
),
status: Schema.Union([
Schema.Literals([
"queued",
Expand All @@ -472,7 +477,7 @@ export const GetCrawlResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
skipped: Schema.Number,
status: Schema.String,
total: Schema.Number,
cursor: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
cursor: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
}).pipe(T.ResponsePath("result")) as unknown as Schema.Schema<GetCrawlResponse>;

export type GetCrawlError = DefaultErrors;
Expand Down