@icebreakers/monorepo-templates 1.0.10 → 1.0.12
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/assets/.github/workflows/ci.yml +7 -2
- package/assets/.github/workflows/release.yml +3 -5
- package/assets/package.json +16 -16
- package/assets/pnpm-workspace.yaml +9 -5
- package/dist/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{prepare-B_OwUnAH.mjs → prepare-BBSJX9-U.mjs} +5 -5
- package/package.json +2 -2
- package/templates/cli/package.json +1 -1
- package/templates/client/package.json +18 -18
- package/templates/client/worker-configuration.d.ts +1061 -151
- package/templates/server/package.json +4 -4
- package/templates/server/worker-configuration.d.ts +1061 -151
- package/templates/vitepress/package.json +6 -6
- package/templates/vue-lib/package.json +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
// Generated by Wrangler by running `wrangler types` (hash: bf05258867cf7490d4c96f4ea30bd0ef)
|
|
3
|
-
// Runtime types generated with workerd@1.
|
|
3
|
+
// Runtime types generated with workerd@1.20260625.1 2025-10-16 nodejs_compat
|
|
4
4
|
interface __BaseEnv_Env {
|
|
5
5
|
}
|
|
6
6
|
declare namespace Cloudflare {
|
|
@@ -433,7 +433,8 @@ interface ExecutionContext<Props = unknown> {
|
|
|
433
433
|
passThroughOnException(): void;
|
|
434
434
|
readonly props: Props;
|
|
435
435
|
cache?: CacheContext;
|
|
436
|
-
|
|
436
|
+
readonly access?: CloudflareAccessContext;
|
|
437
|
+
tracing: Tracing;
|
|
437
438
|
}
|
|
438
439
|
type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown, Props = unknown> = (request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>, env: Env, ctx: ExecutionContext<Props>) => Response | Promise<Response>;
|
|
439
440
|
type ExportedHandlerConnectHandler<Env = unknown, Props = unknown> = (socket: Socket, env: Env, ctx: ExecutionContext<Props>) => void | Promise<void>;
|
|
@@ -489,6 +490,10 @@ interface CachePurgeOptions {
|
|
|
489
490
|
interface CacheContext {
|
|
490
491
|
purge(options: CachePurgeOptions): Promise<CachePurgeResult>;
|
|
491
492
|
}
|
|
493
|
+
interface CloudflareAccessContext {
|
|
494
|
+
readonly aud: string;
|
|
495
|
+
getIdentity(): Promise<CloudflareAccessIdentity | undefined>;
|
|
496
|
+
}
|
|
492
497
|
declare abstract class ColoLocalActorNamespace {
|
|
493
498
|
get(actorId: string): Fetcher;
|
|
494
499
|
}
|
|
@@ -522,7 +527,7 @@ type DurableObjectJurisdiction = "eu" | "fedramp" | "fedramp-high";
|
|
|
522
527
|
interface DurableObjectNamespaceNewUniqueIdOptions {
|
|
523
528
|
jurisdiction?: DurableObjectJurisdiction;
|
|
524
529
|
}
|
|
525
|
-
type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "oc" | "afr" | "me";
|
|
530
|
+
type DurableObjectLocationHint = "wnam" | "enam" | "sam" | "weur" | "eeur" | "apac" | "apac-ne" | "apac-se" | "oc" | "afr" | "me";
|
|
526
531
|
type DurableObjectRoutingMode = "primary-only";
|
|
527
532
|
interface DurableObjectNamespaceGetDurableObjectOptions {
|
|
528
533
|
locationHint?: DurableObjectLocationHint;
|
|
@@ -617,6 +622,7 @@ interface DurableObjectFacets {
|
|
|
617
622
|
get<T extends Rpc.DurableObjectBranded | undefined = undefined>(name: string, getStartupOptions: () => FacetStartupOptions<T> | Promise<FacetStartupOptions<T>>): Fetcher<T>;
|
|
618
623
|
abort(name: string, reason: any): void;
|
|
619
624
|
delete(name: string): void;
|
|
625
|
+
clone(src: string, dst: string): void;
|
|
620
626
|
}
|
|
621
627
|
interface FacetStartupOptions<T extends Rpc.DurableObjectBranded | undefined = undefined> {
|
|
622
628
|
id?: DurableObjectId | string;
|
|
@@ -3292,6 +3298,28 @@ interface EventSourceEventSourceInit {
|
|
|
3292
3298
|
withCredentials?: boolean;
|
|
3293
3299
|
fetcher?: Fetcher;
|
|
3294
3300
|
}
|
|
3301
|
+
interface ExecOutput {
|
|
3302
|
+
readonly stdout: ArrayBuffer;
|
|
3303
|
+
readonly stderr: ArrayBuffer;
|
|
3304
|
+
readonly exitCode: number;
|
|
3305
|
+
}
|
|
3306
|
+
interface ContainerExecOptions {
|
|
3307
|
+
cwd?: string;
|
|
3308
|
+
env?: Record<string, string>;
|
|
3309
|
+
user?: string;
|
|
3310
|
+
stdin?: ReadableStream | "pipe";
|
|
3311
|
+
stdout?: "pipe" | "ignore";
|
|
3312
|
+
stderr?: "pipe" | "ignore" | "combined";
|
|
3313
|
+
}
|
|
3314
|
+
interface ExecProcess {
|
|
3315
|
+
readonly stdin: WritableStream | null;
|
|
3316
|
+
readonly stdout: ReadableStream | null;
|
|
3317
|
+
readonly stderr: ReadableStream | null;
|
|
3318
|
+
readonly pid: number;
|
|
3319
|
+
readonly exitCode: Promise<number>;
|
|
3320
|
+
output(): Promise<ExecOutput>;
|
|
3321
|
+
kill(signal?: number): void;
|
|
3322
|
+
}
|
|
3295
3323
|
interface Container {
|
|
3296
3324
|
get running(): boolean;
|
|
3297
3325
|
start(options?: ContainerStartupOptions): void;
|
|
@@ -3305,6 +3333,7 @@ interface Container {
|
|
|
3305
3333
|
snapshotDirectory(options: ContainerDirectorySnapshotOptions): Promise<ContainerDirectorySnapshot>;
|
|
3306
3334
|
snapshotContainer(options: ContainerSnapshotOptions): Promise<ContainerSnapshot>;
|
|
3307
3335
|
interceptOutboundHttps(addr: string, binding: Fetcher): Promise<void>;
|
|
3336
|
+
exec(cmd: string[], options?: ContainerExecOptions): Promise<ExecProcess>;
|
|
3308
3337
|
}
|
|
3309
3338
|
interface ContainerDirectorySnapshot {
|
|
3310
3339
|
id: string;
|
|
@@ -3475,11 +3504,281 @@ declare abstract class Performance {
|
|
|
3475
3504
|
}
|
|
3476
3505
|
interface Tracing {
|
|
3477
3506
|
enterSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;
|
|
3507
|
+
startActiveSpan<T, A extends unknown[]>(name: string, callback: (span: Span, ...args: A) => T, ...args: A): T;
|
|
3478
3508
|
Span: typeof Span;
|
|
3479
3509
|
}
|
|
3480
3510
|
declare abstract class Span {
|
|
3481
3511
|
get isTraced(): boolean;
|
|
3482
3512
|
setAttribute(key: string, value?: (boolean | number | string)): void;
|
|
3513
|
+
end(): void;
|
|
3514
|
+
}
|
|
3515
|
+
/**
|
|
3516
|
+
* Represents the identity of a user authenticated via Cloudflare Access.
|
|
3517
|
+
* This matches the result of calling /cdn-cgi/access/get-identity.
|
|
3518
|
+
*
|
|
3519
|
+
* The exact structure of the returned object depends on the identity provider
|
|
3520
|
+
* configuration for the Access application. The fields below represent commonly
|
|
3521
|
+
* available properties, but additional provider-specific fields may be present.
|
|
3522
|
+
*/
|
|
3523
|
+
interface CloudflareAccessIdentity extends Record<string, unknown> {
|
|
3524
|
+
/** The user's email address, if available from the identity provider. */
|
|
3525
|
+
email?: string;
|
|
3526
|
+
/** The user's display name. */
|
|
3527
|
+
name?: string;
|
|
3528
|
+
/** The user's unique identifier. */
|
|
3529
|
+
user_uuid?: string;
|
|
3530
|
+
/** The Cloudflare account ID. */
|
|
3531
|
+
account_id?: string;
|
|
3532
|
+
/** Login timestamp (Unix epoch seconds). */
|
|
3533
|
+
iat?: number;
|
|
3534
|
+
/** The user's IP address at authentication time. */
|
|
3535
|
+
ip?: string;
|
|
3536
|
+
/** Authentication methods used (e.g., "pwd"). */
|
|
3537
|
+
amr?: string[];
|
|
3538
|
+
/** Identity provider information. */
|
|
3539
|
+
idp?: {
|
|
3540
|
+
id: string;
|
|
3541
|
+
type: string;
|
|
3542
|
+
};
|
|
3543
|
+
/** Geographic information about where the user authenticated. */
|
|
3544
|
+
geo?: {
|
|
3545
|
+
country: string;
|
|
3546
|
+
};
|
|
3547
|
+
/** Group memberships from the identity provider. */
|
|
3548
|
+
groups?: Array<{
|
|
3549
|
+
id: string;
|
|
3550
|
+
name: string;
|
|
3551
|
+
email?: string;
|
|
3552
|
+
}>;
|
|
3553
|
+
/** Device posture check results, keyed by check ID. */
|
|
3554
|
+
devicePosture?: Record<string, unknown>;
|
|
3555
|
+
/** True if the user connected via Cloudflare WARP. */
|
|
3556
|
+
is_warp?: boolean;
|
|
3557
|
+
/** True if the user is authenticated via Cloudflare Gateway. */
|
|
3558
|
+
is_gateway?: boolean;
|
|
3559
|
+
}
|
|
3560
|
+
// ============================================================================
|
|
3561
|
+
// Agent Memory
|
|
3562
|
+
//
|
|
3563
|
+
// Public type surface for user Workers binding to an Agent Memory namespace.
|
|
3564
|
+
// ============================================================================
|
|
3565
|
+
/** Memory type — every memory is classified into exactly one. */
|
|
3566
|
+
type AgentMemoryMemoryType = "fact" | "event" | "instruction" | "task";
|
|
3567
|
+
/** Search intensity for recall. */
|
|
3568
|
+
type AgentMemoryThinkingLevel = "low" | "medium" | "high";
|
|
3569
|
+
/** Response verbosity for recall. */
|
|
3570
|
+
type AgentMemoryResponseLength = "short" | "medium" | "long";
|
|
3571
|
+
/** A conversation message passed to ingest(). */
|
|
3572
|
+
interface AgentMemoryMessage {
|
|
3573
|
+
role: "system" | "user" | "assistant";
|
|
3574
|
+
content: string;
|
|
3575
|
+
/** Optional message timestamp. */
|
|
3576
|
+
timestamp?: Date;
|
|
3577
|
+
}
|
|
3578
|
+
/** Raw memory content passed to remember(). */
|
|
3579
|
+
interface AgentMemoryIncomingMemory {
|
|
3580
|
+
/** Raw memory content. The service classifies and summarizes automatically. */
|
|
3581
|
+
content: string;
|
|
3582
|
+
/** Optional session identifier to associate with this memory. */
|
|
3583
|
+
sessionId?: string | null | undefined;
|
|
3584
|
+
}
|
|
3585
|
+
/** A stored memory returned from remember(), get(), and delete(). */
|
|
3586
|
+
interface AgentMemoryMemory {
|
|
3587
|
+
/** Memory ID. */
|
|
3588
|
+
id: string;
|
|
3589
|
+
/** Memory type. */
|
|
3590
|
+
type: AgentMemoryMemoryType;
|
|
3591
|
+
/** Text summary. */
|
|
3592
|
+
summary: string;
|
|
3593
|
+
/** Memory text. */
|
|
3594
|
+
content: string;
|
|
3595
|
+
/** Session that created this memory. */
|
|
3596
|
+
sessionId: string | null;
|
|
3597
|
+
/** Memory creation time. */
|
|
3598
|
+
createdAt: Date;
|
|
3599
|
+
/** Memory last-update time. */
|
|
3600
|
+
updatedAt: Date;
|
|
3601
|
+
}
|
|
3602
|
+
/** Single entry in a list() response. Same shape as Memory minus full content. */
|
|
3603
|
+
type AgentMemoryMemoryListEntry = Omit<AgentMemoryMemory, "content">;
|
|
3604
|
+
/** A scored memory candidate in a recall result. */
|
|
3605
|
+
interface AgentMemoryScoredCandidate {
|
|
3606
|
+
/** Candidate ID. */
|
|
3607
|
+
id: string;
|
|
3608
|
+
/** Text summary. */
|
|
3609
|
+
summary: string;
|
|
3610
|
+
/** Session that created this candidate, when known. */
|
|
3611
|
+
sessionId: string | null;
|
|
3612
|
+
/** Relevance score (higher is better). Comparable only within a single query. */
|
|
3613
|
+
score: number;
|
|
3614
|
+
}
|
|
3615
|
+
/** Options for the ingest() method. */
|
|
3616
|
+
interface AgentMemoryIngestOptions {
|
|
3617
|
+
/** Session identifier to associate with memories created during ingestion. */
|
|
3618
|
+
sessionId?: string | null | undefined;
|
|
3619
|
+
}
|
|
3620
|
+
/** Options for the getSummary() method. */
|
|
3621
|
+
interface AgentMemoryGetSummaryOptions {
|
|
3622
|
+
/** Session identifier to retrieve session summary for. */
|
|
3623
|
+
sessionId?: string | null | undefined;
|
|
3624
|
+
}
|
|
3625
|
+
/** Response from the getSummary() method. */
|
|
3626
|
+
interface AgentMemoryGetSummaryResponse {
|
|
3627
|
+
/** Markdown summary. */
|
|
3628
|
+
summary: string;
|
|
3629
|
+
}
|
|
3630
|
+
/**
|
|
3631
|
+
* Options for the recall() method.
|
|
3632
|
+
*
|
|
3633
|
+
* `referenceDate` accepts a Date object, an ISO-8601 date string
|
|
3634
|
+
* (YYYY-MM-DD), or a full ISO-8601 datetime string. When provided, this
|
|
3635
|
+
* date is used as "today" for resolving relative time references
|
|
3636
|
+
* ("how many days ago", "last week") instead of the server's wall-clock time.
|
|
3637
|
+
*/
|
|
3638
|
+
interface AgentMemoryRecallOptions {
|
|
3639
|
+
/** Recall intensity: "low" (default), "medium", or "high". */
|
|
3640
|
+
thinkingLevel?: AgentMemoryThinkingLevel;
|
|
3641
|
+
/** Response verbosity: "short", "medium" (default), or "long". */
|
|
3642
|
+
responseLength?: AgentMemoryResponseLength;
|
|
3643
|
+
/** Temporal anchor for date arithmetic. */
|
|
3644
|
+
referenceDate?: Date | string;
|
|
3645
|
+
}
|
|
3646
|
+
/** Response from the recall() method. */
|
|
3647
|
+
interface AgentMemoryRecallResult {
|
|
3648
|
+
/** Number of memories retrieved. */
|
|
3649
|
+
count: number;
|
|
3650
|
+
/** LLM-generated answer synthesizing the matching memories. */
|
|
3651
|
+
answer: string;
|
|
3652
|
+
/** Matching memories ranked by relevance. */
|
|
3653
|
+
candidates: AgentMemoryScoredCandidate[];
|
|
3654
|
+
}
|
|
3655
|
+
/**
|
|
3656
|
+
* Options for the list() method.
|
|
3657
|
+
*
|
|
3658
|
+
* `cursor` is the opaque continuation token returned by the previous page;
|
|
3659
|
+
* pass it back unchanged to fetch the next page. `sessionId` and `type`
|
|
3660
|
+
* are exact-match filters; combining them is allowed.
|
|
3661
|
+
*/
|
|
3662
|
+
interface AgentMemoryListMemoriesOptions {
|
|
3663
|
+
/** Maximum number of memories to return. Default 20, max 500. */
|
|
3664
|
+
limit?: number;
|
|
3665
|
+
/** Opaque cursor from a previous page. */
|
|
3666
|
+
cursor?: string;
|
|
3667
|
+
/** Exact-match session filter. */
|
|
3668
|
+
sessionId?: string;
|
|
3669
|
+
/** Exact-match memory-type filter. */
|
|
3670
|
+
type?: AgentMemoryMemoryType;
|
|
3671
|
+
}
|
|
3672
|
+
/** Response from the list() method. */
|
|
3673
|
+
interface AgentMemoryListMemoriesResult {
|
|
3674
|
+
memories: AgentMemoryMemoryListEntry[];
|
|
3675
|
+
/** Continuation cursor; absent when this page exhausted the result set. */
|
|
3676
|
+
cursor?: string;
|
|
3677
|
+
}
|
|
3678
|
+
/**
|
|
3679
|
+
* A single Agent Memory profile, scoped to a profile name.
|
|
3680
|
+
*
|
|
3681
|
+
* Returned by {@link AgentMemoryNamespace.getProfile}.
|
|
3682
|
+
*/
|
|
3683
|
+
declare abstract class AgentMemoryProfile {
|
|
3684
|
+
/**
|
|
3685
|
+
* Retrieve a memory by ID.
|
|
3686
|
+
*
|
|
3687
|
+
* @param memoryId - ULID of the memory to retrieve.
|
|
3688
|
+
* @throws if the memory does not exist.
|
|
3689
|
+
*/
|
|
3690
|
+
get(memoryId: string): Promise<AgentMemoryMemory>;
|
|
3691
|
+
/**
|
|
3692
|
+
* Delete a memory by ID.
|
|
3693
|
+
*
|
|
3694
|
+
* Removes the memory and any source messages linked by the memory's
|
|
3695
|
+
* source message IDs.
|
|
3696
|
+
*
|
|
3697
|
+
* @param memoryId - ULID of the memory to delete.
|
|
3698
|
+
* @throws if the memory does not exist.
|
|
3699
|
+
*/
|
|
3700
|
+
delete(memoryId: string): Promise<AgentMemoryMemory>;
|
|
3701
|
+
/**
|
|
3702
|
+
* Store a memory in this profile. The content is automatically classified,
|
|
3703
|
+
* summarized, and indexed.
|
|
3704
|
+
*
|
|
3705
|
+
* @param memory - Raw memory content to persist.
|
|
3706
|
+
*/
|
|
3707
|
+
remember(memory: AgentMemoryIncomingMemory): Promise<AgentMemoryMemory>;
|
|
3708
|
+
/**
|
|
3709
|
+
* Extract memories from a conversation.
|
|
3710
|
+
*
|
|
3711
|
+
* @param messages - Conversation messages to extract memories from.
|
|
3712
|
+
* @param options - Optional ingest options.
|
|
3713
|
+
*/
|
|
3714
|
+
ingest(messages: Iterable<AgentMemoryMessage>, options?: AgentMemoryIngestOptions): Promise<void>;
|
|
3715
|
+
/**
|
|
3716
|
+
* Get a profile summary.
|
|
3717
|
+
*
|
|
3718
|
+
* @param options - Optional getSummary options.
|
|
3719
|
+
*/
|
|
3720
|
+
getSummary(options?: AgentMemoryGetSummaryOptions): Promise<AgentMemoryGetSummaryResponse>;
|
|
3721
|
+
/**
|
|
3722
|
+
* Recall memories in this profile.
|
|
3723
|
+
*
|
|
3724
|
+
* @param query - Recall query matched against memory content and keywords.
|
|
3725
|
+
* @param options - Optional recall parameters.
|
|
3726
|
+
* @returns Matching memories with relevance scores and a synthesized answer.
|
|
3727
|
+
*/
|
|
3728
|
+
recall(query: string, options?: AgentMemoryRecallOptions): Promise<AgentMemoryRecallResult>;
|
|
3729
|
+
/**
|
|
3730
|
+
* List active memories in this profile.
|
|
3731
|
+
*
|
|
3732
|
+
* Returns a paginated, filterable view of stored memories. Superseded
|
|
3733
|
+
* versions are excluded. Use the returned `cursor` (when present) to
|
|
3734
|
+
* fetch the next page.
|
|
3735
|
+
*
|
|
3736
|
+
* @param options - Optional pagination and filter options.
|
|
3737
|
+
*/
|
|
3738
|
+
list(options?: AgentMemoryListMemoriesOptions): Promise<AgentMemoryListMemoriesResult>;
|
|
3739
|
+
/**
|
|
3740
|
+
* Soft-delete every memory and message in this profile that is tagged
|
|
3741
|
+
* with `sessionId`.
|
|
3742
|
+
*
|
|
3743
|
+
* Idempotent: deleting a sessionId that has no rows is a no-op.
|
|
3744
|
+
*
|
|
3745
|
+
* @param sessionId - Session to delete.
|
|
3746
|
+
*/
|
|
3747
|
+
deleteSession(sessionId: string): Promise<void>;
|
|
3748
|
+
}
|
|
3749
|
+
/**
|
|
3750
|
+
* Namespace-level Agent Memory binding.
|
|
3751
|
+
*
|
|
3752
|
+
* Used as the type of an `env.MEMORY`-style binding backed by the Agent
|
|
3753
|
+
* Memory product.
|
|
3754
|
+
*
|
|
3755
|
+
* @example
|
|
3756
|
+
* ```ts
|
|
3757
|
+
* export default {
|
|
3758
|
+
* async fetch(_request: Request, env: Env): Promise<Response> {
|
|
3759
|
+
* const profile = await env.MEMORY.getProfile("wrangler-e2e");
|
|
3760
|
+
* const summary = await profile.getSummary();
|
|
3761
|
+
* return Response.json(summary);
|
|
3762
|
+
* },
|
|
3763
|
+
* };
|
|
3764
|
+
* ```
|
|
3765
|
+
*/
|
|
3766
|
+
declare abstract class AgentMemoryNamespace {
|
|
3767
|
+
/**
|
|
3768
|
+
* Get a memory profile by name. Profiles are isolated by namespace and
|
|
3769
|
+
* addressed by a compound key (namespaceId:profileName).
|
|
3770
|
+
*
|
|
3771
|
+
* @param profileName - Profile name (validated against naming rules).
|
|
3772
|
+
* @returns RPC target for interacting with the profile.
|
|
3773
|
+
*/
|
|
3774
|
+
getProfile(profileName: string): Promise<AgentMemoryProfile>;
|
|
3775
|
+
/**
|
|
3776
|
+
* Soft-delete a profile and schedule deferred purge. Marks all
|
|
3777
|
+
* memories and messages as deleted.
|
|
3778
|
+
*
|
|
3779
|
+
* @param profileName - Name of the profile to delete.
|
|
3780
|
+
*/
|
|
3781
|
+
deleteProfile(profileName: string): Promise<void>;
|
|
3483
3782
|
}
|
|
3484
3783
|
// ============ AI Search Error Interfaces ============
|
|
3485
3784
|
interface AiSearchInternalError extends Error {
|
|
@@ -10403,77 +10702,451 @@ declare abstract class AutoRAG {
|
|
|
10403
10702
|
*/
|
|
10404
10703
|
aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>;
|
|
10405
10704
|
}
|
|
10406
|
-
|
|
10705
|
+
type BrowserRunLifecycleEvent = 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
|
|
10706
|
+
type BrowserRunResourceType = 'document' | 'stylesheet' | 'image' | 'media' | 'font' | 'script' | 'texttrack' | 'xhr' | 'fetch' | 'prefetch' | 'eventsource' | 'websocket' | 'manifest' | 'signedexchange' | 'ping' | 'cspviolationreport' | 'preflight' | 'other';
|
|
10707
|
+
/** Options fields shared by all quick actions. */
|
|
10708
|
+
interface BrowserRunBaseOptions {
|
|
10709
|
+
/** Adds `<script>` tags into the page with the desired URL or content.
|
|
10710
|
+
* @see https://pptr.dev/api/puppeteer.frameaddscripttagoptions
|
|
10711
|
+
*/
|
|
10712
|
+
addScriptTag?: Array<{
|
|
10713
|
+
content?: string;
|
|
10714
|
+
url?: string;
|
|
10715
|
+
type?: string;
|
|
10716
|
+
id?: string;
|
|
10717
|
+
}>;
|
|
10718
|
+
/** Adds `<link rel="stylesheet">` or `<style>` tags into the page.
|
|
10719
|
+
* @see https://pptr.dev/api/puppeteer.frameaddstyletagoptions
|
|
10720
|
+
*/
|
|
10721
|
+
addStyleTag?: Array<{
|
|
10722
|
+
content?: string;
|
|
10723
|
+
url?: string;
|
|
10724
|
+
}>;
|
|
10725
|
+
/** Provide credentials for HTTP authentication. @see https://pptr.dev/api/puppeteer.credentials */
|
|
10726
|
+
authenticate?: {
|
|
10727
|
+
username: string;
|
|
10728
|
+
password: string;
|
|
10729
|
+
};
|
|
10730
|
+
/** Set cookies before navigating. @see https://pptr.dev/api/puppeteer.cookieparam */
|
|
10731
|
+
cookies?: Array<{
|
|
10732
|
+
name: string;
|
|
10733
|
+
value: string;
|
|
10734
|
+
url?: string;
|
|
10735
|
+
domain?: string;
|
|
10736
|
+
path?: string;
|
|
10737
|
+
secure?: boolean;
|
|
10738
|
+
httpOnly?: boolean;
|
|
10739
|
+
sameSite?: 'Strict' | 'Lax' | 'None';
|
|
10740
|
+
expires?: number;
|
|
10741
|
+
priority?: 'Low' | 'Medium' | 'High';
|
|
10742
|
+
sameParty?: boolean;
|
|
10743
|
+
sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';
|
|
10744
|
+
sourcePort?: number;
|
|
10745
|
+
partitionKey?: string;
|
|
10746
|
+
}>;
|
|
10747
|
+
/** Emulate a specific CSS media type (e.g. `"screen"`, `"print"`). */
|
|
10748
|
+
emulateMediaType?: string;
|
|
10749
|
+
/** Navigation options. @see https://pptr.dev/api/puppeteer.gotooptions */
|
|
10750
|
+
gotoOptions?: {
|
|
10751
|
+
/** Navigation timeout in milliseconds (max 60 000). @default 30000 */
|
|
10752
|
+
timeout?: number;
|
|
10753
|
+
/** When to consider navigation complete. @default "domcontentloaded" */
|
|
10754
|
+
waitUntil?: BrowserRunLifecycleEvent | BrowserRunLifecycleEvent[];
|
|
10755
|
+
referer?: string;
|
|
10756
|
+
referrerPolicy?: string;
|
|
10757
|
+
};
|
|
10758
|
+
/** Block requests matching these regex patterns. Mutually exclusive with `allowRequestPattern`. */
|
|
10759
|
+
rejectRequestPattern?: string[];
|
|
10760
|
+
/** Only allow requests matching these regex patterns. Mutually exclusive with `rejectRequestPattern`. */
|
|
10761
|
+
allowRequestPattern?: string[];
|
|
10762
|
+
/** Block requests of these resource types. Mutually exclusive with `allowResourceTypes`. */
|
|
10763
|
+
rejectResourceTypes?: BrowserRunResourceType[];
|
|
10764
|
+
/** Only allow requests of these resource types. Mutually exclusive with `rejectResourceTypes`. */
|
|
10765
|
+
allowResourceTypes?: BrowserRunResourceType[];
|
|
10766
|
+
/** Additional HTTP headers sent with every request. */
|
|
10767
|
+
setExtraHTTPHeaders?: Record<string, string>;
|
|
10768
|
+
/** Whether JavaScript is enabled on the page. */
|
|
10769
|
+
setJavaScriptEnabled?: boolean;
|
|
10770
|
+
/** Override the default user agent string.
|
|
10771
|
+
* @default "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
|
|
10772
|
+
* */
|
|
10773
|
+
userAgent?: string;
|
|
10774
|
+
/** Set the browser viewport size.
|
|
10775
|
+
* @see https://pptr.dev/api/puppeteer.viewport
|
|
10776
|
+
* @default {width:1920,height:1080}
|
|
10777
|
+
* */
|
|
10778
|
+
viewport?: {
|
|
10779
|
+
width: number;
|
|
10780
|
+
height: number;
|
|
10781
|
+
deviceScaleFactor?: number;
|
|
10782
|
+
isMobile?: boolean;
|
|
10783
|
+
isLandscape?: boolean;
|
|
10784
|
+
hasTouch?: boolean;
|
|
10785
|
+
};
|
|
10786
|
+
/** Wait for a CSS selector to appear in the page before proceeding.
|
|
10787
|
+
* @see https://pptr.dev/api/puppeteer.waitforselectoroptions
|
|
10788
|
+
*/
|
|
10789
|
+
waitForSelector?: {
|
|
10790
|
+
selector: string;
|
|
10791
|
+
hidden?: true;
|
|
10792
|
+
visible?: true;
|
|
10793
|
+
/** Timeout in milliseconds. Max 120000 */
|
|
10794
|
+
timeout?: number;
|
|
10795
|
+
};
|
|
10796
|
+
/** Wait for a fixed delay in milliseconds before proceeding. Max 120000 */
|
|
10797
|
+
waitForTimeout?: number;
|
|
10798
|
+
/** When true, continue on best-effort when awaited events fail or timeout. */
|
|
10799
|
+
bestAttempt?: boolean;
|
|
10800
|
+
/** Maximum duration in milliseconds for the browser action after page load. Max 120000 */
|
|
10801
|
+
actionTimeout?: number;
|
|
10802
|
+
/** Cache time to live in seconds (0-86400). Set to 0 to disable.
|
|
10803
|
+
* @default 5
|
|
10804
|
+
*/
|
|
10805
|
+
cacheTTL?: number;
|
|
10806
|
+
}
|
|
10807
|
+
/** Common options shared by all quick actions. Exactly one of `url` or `html` must be provided.*/
|
|
10808
|
+
type BrowserRunCommonOptions = (BrowserRunBaseOptions & {
|
|
10809
|
+
/** URL to navigate to, e.g. `"https://example.com"`. */
|
|
10810
|
+
url: string;
|
|
10811
|
+
}) | (BrowserRunBaseOptions & {
|
|
10812
|
+
/** Set the HTML content of the page directly. */
|
|
10813
|
+
html: string;
|
|
10814
|
+
});
|
|
10815
|
+
type BrowserRunPuppeteerScreenshotOptions = {
|
|
10816
|
+
/** @default "png" */
|
|
10817
|
+
type?: 'png' | 'jpeg' | 'webp';
|
|
10818
|
+
/** @default "binary" */
|
|
10819
|
+
encoding?: 'binary' | 'base64';
|
|
10820
|
+
quality?: number;
|
|
10821
|
+
fullPage?: boolean;
|
|
10822
|
+
clip?: {
|
|
10823
|
+
x: number;
|
|
10824
|
+
y: number;
|
|
10825
|
+
width: number;
|
|
10826
|
+
height: number;
|
|
10827
|
+
scale?: number;
|
|
10828
|
+
};
|
|
10829
|
+
omitBackground?: boolean;
|
|
10830
|
+
optimizeForSpeed?: boolean;
|
|
10831
|
+
captureBeyondViewport?: boolean;
|
|
10832
|
+
fromSurface?: boolean;
|
|
10833
|
+
};
|
|
10834
|
+
type BrowserRunScreenshotOptions = BrowserRunCommonOptions & {
|
|
10835
|
+
/** CSS selector of the element to screenshot. */
|
|
10836
|
+
selector?: string;
|
|
10837
|
+
/** When true, scroll the entire page before taking the screenshot. */
|
|
10838
|
+
scrollPage?: boolean;
|
|
10839
|
+
/** @see https://pptr.dev/api/puppeteer.screenshotoptions */
|
|
10840
|
+
screenshotOptions?: BrowserRunPuppeteerScreenshotOptions;
|
|
10841
|
+
};
|
|
10842
|
+
type BrowserRunPDFOptions = BrowserRunCommonOptions & {
|
|
10843
|
+
/** @see https://pptr.dev/api/puppeteer.pdfoptions */
|
|
10844
|
+
pdfOptions?: {
|
|
10845
|
+
/** @default 1 */
|
|
10846
|
+
scale?: number;
|
|
10847
|
+
/** @default false */
|
|
10848
|
+
displayHeaderFooter?: boolean;
|
|
10849
|
+
headerTemplate?: string;
|
|
10850
|
+
footerTemplate?: string;
|
|
10851
|
+
/** @default false */
|
|
10852
|
+
printBackground?: boolean;
|
|
10853
|
+
/** @default false */
|
|
10854
|
+
landscape?: boolean;
|
|
10855
|
+
pageRanges?: string;
|
|
10856
|
+
/** @default "letter" */
|
|
10857
|
+
format?: 'letter' | 'legal' | 'tabloid' | 'ledger' | 'a0' | 'a1' | 'a2' | 'a3' | 'a4' | 'a5' | 'a6';
|
|
10858
|
+
width?: string | number;
|
|
10859
|
+
height?: string | number;
|
|
10860
|
+
/** @default false */
|
|
10861
|
+
preferCSSPageSize?: boolean;
|
|
10862
|
+
margin?: {
|
|
10863
|
+
top?: string | number;
|
|
10864
|
+
right?: string | number;
|
|
10865
|
+
bottom?: string | number;
|
|
10866
|
+
left?: string | number;
|
|
10867
|
+
};
|
|
10868
|
+
/** @default false */
|
|
10869
|
+
omitBackground?: boolean;
|
|
10870
|
+
/** @default true */
|
|
10871
|
+
tagged?: boolean;
|
|
10872
|
+
/** @default false */
|
|
10873
|
+
outline?: boolean;
|
|
10874
|
+
/** @default 30000 */
|
|
10875
|
+
timeout?: number;
|
|
10876
|
+
};
|
|
10877
|
+
};
|
|
10878
|
+
type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
|
|
10879
|
+
/** CSS selectors to scrape. At least one element is required. */
|
|
10880
|
+
elements: Array<{
|
|
10881
|
+
selector: string;
|
|
10882
|
+
}>;
|
|
10883
|
+
};
|
|
10884
|
+
type BrowserRunLinksOptions = BrowserRunCommonOptions & {
|
|
10885
|
+
/** When true, only return links that are visible on the page. @default false */
|
|
10886
|
+
visibleLinksOnly?: boolean;
|
|
10887
|
+
/** When true, exclude links pointing to external domains. @default false */
|
|
10888
|
+
excludeExternalLinks?: boolean;
|
|
10889
|
+
};
|
|
10890
|
+
type BrowserRunSnapshotOptions = BrowserRunCommonOptions & {
|
|
10891
|
+
/** @see https://pptr.dev/api/puppeteer.screenshotoptions */
|
|
10892
|
+
screenshotOptions?: Omit<BrowserRunPuppeteerScreenshotOptions, 'encoding'>;
|
|
10893
|
+
};
|
|
10894
|
+
interface BrowserRunJsonBaseOptions {
|
|
10895
|
+
/** Custom AI models to try in order. Max 3. Falls back to next on error. */
|
|
10896
|
+
custom_ai?: Array<{
|
|
10897
|
+
/** Model ID in `<provider>/<model_name>` format, e.g. `"workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast"`. */
|
|
10898
|
+
model: string;
|
|
10899
|
+
/** Bearer token. Not needed for workers-ai models. */
|
|
10900
|
+
authorization?: string;
|
|
10901
|
+
}>;
|
|
10902
|
+
}
|
|
10903
|
+
/**
|
|
10904
|
+
* Options for the `json` quick action.
|
|
10905
|
+
* At least one of `prompt` or `response_format` must be provided.
|
|
10906
|
+
*/
|
|
10907
|
+
type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunJsonBaseOptions & ({
|
|
10908
|
+
/** Natural-language prompt describing what data to extract. */
|
|
10909
|
+
prompt: string;
|
|
10910
|
+
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
|
|
10911
|
+
response_format?: AiTextGenerationResponseFormat;
|
|
10912
|
+
} | {
|
|
10913
|
+
/** Natural-language prompt describing what data to extract. */
|
|
10914
|
+
prompt?: string;
|
|
10915
|
+
/** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
|
|
10916
|
+
response_format: AiTextGenerationResponseFormat;
|
|
10917
|
+
});
|
|
10918
|
+
type BrowserRunContentOptions = BrowserRunCommonOptions;
|
|
10919
|
+
type BrowserRunMarkdownOptions = BrowserRunCommonOptions;
|
|
10920
|
+
type BrowserRunResponseMeta = {
|
|
10921
|
+
/** HTTP status code of the rendered page */
|
|
10922
|
+
status: number;
|
|
10923
|
+
/** Page title */
|
|
10924
|
+
title: string;
|
|
10925
|
+
};
|
|
10926
|
+
/** Success response for `content` action. */
|
|
10927
|
+
type BrowserRunContentSuccessResponse = {
|
|
10928
|
+
success: true;
|
|
10929
|
+
/** Extracted HTML content */
|
|
10930
|
+
result: string;
|
|
10931
|
+
meta: BrowserRunResponseMeta;
|
|
10932
|
+
};
|
|
10933
|
+
/** Success response for `links` action. */
|
|
10934
|
+
type BrowserRunLinksSuccessResponse = {
|
|
10935
|
+
success: true;
|
|
10936
|
+
/** Extracted links */
|
|
10937
|
+
result: string[];
|
|
10938
|
+
};
|
|
10939
|
+
/** Success response for `scrape` action. */
|
|
10940
|
+
type BrowserRunScrapeSuccessResponse = {
|
|
10941
|
+
success: true;
|
|
10942
|
+
result: Array<{
|
|
10943
|
+
/** The CSS selector used to find elements. */
|
|
10944
|
+
selector: string;
|
|
10945
|
+
/** Array of elements matching the selector. */
|
|
10946
|
+
results: Array<{
|
|
10947
|
+
/** Outer HTML of the element. */
|
|
10948
|
+
html: string;
|
|
10949
|
+
/** Text content of the element. */
|
|
10950
|
+
text: string;
|
|
10951
|
+
/** Width of the element in pixels. */
|
|
10952
|
+
width: number;
|
|
10953
|
+
/** Height of the element in pixels. */
|
|
10954
|
+
height: number;
|
|
10955
|
+
/** Top position of the element relative to the viewport in pixels. */
|
|
10956
|
+
top: number;
|
|
10957
|
+
/** Left position of the element relative to the viewport in pixels. */
|
|
10958
|
+
left: number;
|
|
10959
|
+
/** Array of HTML attributes on the element. */
|
|
10960
|
+
attributes: Array<{
|
|
10961
|
+
/** Attribute name. */
|
|
10962
|
+
name: string;
|
|
10963
|
+
/** Attribute value. */
|
|
10964
|
+
value: string;
|
|
10965
|
+
}>;
|
|
10966
|
+
}>;
|
|
10967
|
+
}>;
|
|
10968
|
+
};
|
|
10969
|
+
/** Success response for `snapshot` action. */
|
|
10970
|
+
type BrowserRunSnapshotSuccessResponse = {
|
|
10971
|
+
success: true;
|
|
10972
|
+
result: {
|
|
10973
|
+
/** HTML content of the page. */
|
|
10974
|
+
content: string;
|
|
10975
|
+
/** Base64-encoded screenshot image. */
|
|
10976
|
+
screenshot: string;
|
|
10977
|
+
};
|
|
10978
|
+
meta: BrowserRunResponseMeta;
|
|
10979
|
+
};
|
|
10980
|
+
/** Success response for `json` action. */
|
|
10981
|
+
type BrowserRunJsonSuccessResponse = {
|
|
10982
|
+
success: true;
|
|
10983
|
+
/** JSON data extracted from the page using an AI model */
|
|
10984
|
+
result: Record<string, unknown>;
|
|
10985
|
+
};
|
|
10986
|
+
/** Success response for `markdown` action. */
|
|
10987
|
+
type BrowserRunMarkdownSuccessResponse = {
|
|
10988
|
+
success: true;
|
|
10989
|
+
/** Extracted markdown content */
|
|
10990
|
+
result: string;
|
|
10991
|
+
};
|
|
10992
|
+
/** Error response for BrowserRun actions. */
|
|
10993
|
+
type BrowserRunErrorResponse = {
|
|
10994
|
+
success: false;
|
|
10995
|
+
errors: {
|
|
10996
|
+
message: string;
|
|
10997
|
+
code?: number;
|
|
10998
|
+
detail?: string;
|
|
10999
|
+
path?: string;
|
|
11000
|
+
}[];
|
|
11001
|
+
};
|
|
11002
|
+
/** Error response for BrowserRun `json` action. */
|
|
11003
|
+
type BrowserRunJsonErrorResponse = BrowserRunErrorResponse & {
|
|
11004
|
+
/** Raw AI response text for debugging */
|
|
11005
|
+
rawAiResponse?: string;
|
|
11006
|
+
};
|
|
11007
|
+
/**
|
|
11008
|
+
* Browser Run API binding for automating headless browsers.
|
|
11009
|
+
* @see https://developers.cloudflare.com/browser-run/
|
|
11010
|
+
*/
|
|
11011
|
+
declare abstract class BrowserRun {
|
|
10407
11012
|
/**
|
|
10408
|
-
*
|
|
11013
|
+
* Send a raw HTTP request to the Browser Run API.
|
|
11014
|
+
* Used by libraries like `@cloudflare/puppeteer` to acquire and connect to a browser instance.
|
|
11015
|
+
* @see https://developers.cloudflare.com/browser-run/
|
|
10409
11016
|
*/
|
|
10410
|
-
|
|
11017
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
10411
11018
|
/**
|
|
10412
|
-
*
|
|
11019
|
+
* Take a screenshot of a web page.
|
|
11020
|
+
* @param action - Must be `'screenshot'`.
|
|
11021
|
+
* @param options - Screenshot options including viewport, selectors, and image format.
|
|
11022
|
+
* @returns A `Response` containing one of:
|
|
11023
|
+
*
|
|
11024
|
+
* **Success (HTTP 200):**
|
|
11025
|
+
* - Binary image data with `Content-Type: image/png`, `image/jpeg`, or `image/webp` (when `encoding: 'binary'`, the default)
|
|
11026
|
+
* - Data URI string with `Content-Type: text/plain` (when `encoding: 'base64'`)
|
|
11027
|
+
*
|
|
11028
|
+
* **Error:**
|
|
11029
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
11030
|
+
*
|
|
11031
|
+
* **Headers:**
|
|
11032
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
10413
11033
|
*/
|
|
10414
|
-
|
|
11034
|
+
quickAction(action: 'screenshot', options: BrowserRunScreenshotOptions): Promise<Response>;
|
|
10415
11035
|
/**
|
|
10416
|
-
*
|
|
10417
|
-
*
|
|
10418
|
-
*
|
|
10419
|
-
*
|
|
10420
|
-
*
|
|
10421
|
-
*
|
|
10422
|
-
*
|
|
10423
|
-
*
|
|
10424
|
-
*
|
|
10425
|
-
*
|
|
10426
|
-
*
|
|
10427
|
-
*
|
|
10428
|
-
*
|
|
10429
|
-
* specified by width and height. The image will not be enlarged. For images
|
|
10430
|
-
* smaller than the given dimensions it's the same as scale-down. For
|
|
10431
|
-
* images larger than the given dimensions, it's the same as cover.
|
|
10432
|
-
* See also trim.
|
|
10433
|
-
* - pad: Resizes to the maximum size that fits within the given width and
|
|
10434
|
-
* height, and then fills the remaining area with a background color
|
|
10435
|
-
* (white by default). Use of this mode is not recommended, as the same
|
|
10436
|
-
* effect can be more efficiently achieved with the contain mode and the
|
|
10437
|
-
* CSS object-fit: contain property.
|
|
10438
|
-
* - squeeze: Stretches and deforms to the width and height given, even if it
|
|
10439
|
-
* breaks aspect ratio
|
|
11036
|
+
* Generate a PDF of a web page.
|
|
11037
|
+
* @param action - Must be `'pdf'`.
|
|
11038
|
+
* @param options - PDF generation options including page size, margins, and headers/footers.
|
|
11039
|
+
* @returns A `Response` containing one of:
|
|
11040
|
+
*
|
|
11041
|
+
* **Success (HTTP 200):**
|
|
11042
|
+
* - Binary PDF data with `Content-Type: application/pdf`
|
|
11043
|
+
*
|
|
11044
|
+
* **Error:**
|
|
11045
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
11046
|
+
*
|
|
11047
|
+
* **Headers:**
|
|
11048
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
10440
11049
|
*/
|
|
10441
|
-
|
|
11050
|
+
quickAction(action: 'pdf', options: BrowserRunPDFOptions): Promise<Response>;
|
|
10442
11051
|
/**
|
|
10443
|
-
*
|
|
10444
|
-
*
|
|
10445
|
-
*
|
|
11052
|
+
* Get the HTML content of a web page.
|
|
11053
|
+
* @param action - Must be `'content'`.
|
|
11054
|
+
* @param options - Navigation and page interaction options.
|
|
11055
|
+
* @returns A `Response` containing one of:
|
|
11056
|
+
*
|
|
11057
|
+
* **Success (HTTP 200):**
|
|
11058
|
+
* - `BrowserRunContentSuccessResponse` JSON with `Content-Type: application/json`
|
|
11059
|
+
*
|
|
11060
|
+
* **Error:**
|
|
11061
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
11062
|
+
*
|
|
11063
|
+
* **Headers:**
|
|
11064
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
10446
11065
|
*/
|
|
10447
|
-
|
|
11066
|
+
quickAction(action: 'content', options: BrowserRunContentOptions): Promise<Response>;
|
|
10448
11067
|
/**
|
|
10449
|
-
*
|
|
10450
|
-
*
|
|
10451
|
-
*
|
|
10452
|
-
*
|
|
10453
|
-
*
|
|
10454
|
-
* (
|
|
10455
|
-
*
|
|
10456
|
-
*
|
|
10457
|
-
*
|
|
10458
|
-
*
|
|
11068
|
+
* Scrape elements from a web page by CSS selector.
|
|
11069
|
+
* @param action - Must be `'scrape'`.
|
|
11070
|
+
* @param options - Scrape options with CSS selectors for elements to extract.
|
|
11071
|
+
* @returns A `Response` containing one of:
|
|
11072
|
+
*
|
|
11073
|
+
* **Success (HTTP 200):**
|
|
11074
|
+
* - `BrowserRunScrapeSuccessResponse` JSON with `Content-Type: application/json`
|
|
11075
|
+
*
|
|
11076
|
+
* **Error:**
|
|
11077
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
11078
|
+
*
|
|
11079
|
+
* **Headers:**
|
|
11080
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
10459
11081
|
*/
|
|
10460
|
-
|
|
11082
|
+
quickAction(action: 'scrape', options: BrowserRunScrapeOptions): Promise<Response>;
|
|
10461
11083
|
/**
|
|
10462
|
-
*
|
|
10463
|
-
*
|
|
10464
|
-
*
|
|
11084
|
+
* Extract all links from a web page.
|
|
11085
|
+
* @param action - Must be `'links'`.
|
|
11086
|
+
* @param options - Options to filter visible or internal links only.
|
|
11087
|
+
* @returns A `Response` containing one of:
|
|
11088
|
+
*
|
|
11089
|
+
* **Success (HTTP 200):**
|
|
11090
|
+
* - `BrowserRunLinksSuccessResponse` JSON with `Content-Type: application/json`
|
|
11091
|
+
*
|
|
11092
|
+
* **Error:**
|
|
11093
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
11094
|
+
*
|
|
11095
|
+
* **Headers:**
|
|
11096
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
10465
11097
|
*/
|
|
10466
|
-
|
|
11098
|
+
quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;
|
|
10467
11099
|
/**
|
|
10468
|
-
*
|
|
10469
|
-
*
|
|
11100
|
+
* Get both the HTML content and a base64-encoded screenshot of a web page.
|
|
11101
|
+
* @param action - Must be `'snapshot'`.
|
|
11102
|
+
* @param options - Snapshot options including screenshot settings (encoding is always base64).
|
|
11103
|
+
* @returns A `Response` containing one of:
|
|
11104
|
+
*
|
|
11105
|
+
* **Success (HTTP 200):**
|
|
11106
|
+
* - `BrowserRunSnapshotSuccessResponse` JSON with `Content-Type: application/json`
|
|
11107
|
+
*
|
|
11108
|
+
* **Error:**
|
|
11109
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
11110
|
+
*
|
|
11111
|
+
* **Headers:**
|
|
11112
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
10470
11113
|
*/
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
11114
|
+
quickAction(action: 'snapshot', options: BrowserRunSnapshotOptions): Promise<Response>;
|
|
11115
|
+
/**
|
|
11116
|
+
* Extract structured JSON data from a web page using AI.
|
|
11117
|
+
* @param action - Must be `'json'`.
|
|
11118
|
+
* @param options - JSON extraction options with prompt or response_format schema.
|
|
11119
|
+
* @returns A `Response` containing one of:
|
|
11120
|
+
*
|
|
11121
|
+
* **Success (HTTP 200):**
|
|
11122
|
+
* - `BrowserRunJsonSuccessResponse` JSON with `Content-Type: application/json`
|
|
11123
|
+
*
|
|
11124
|
+
* **Error:**
|
|
11125
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
11126
|
+
* - HTTP 422 with code `2012` for HTML-to-markdown conversion failures
|
|
11127
|
+
* - HTTP 422/500 for AI extraction failures (may include `rawAiResponse` field)
|
|
11128
|
+
*
|
|
11129
|
+
* **Headers:**
|
|
11130
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
11131
|
+
*/
|
|
11132
|
+
quickAction(action: 'json', options: BrowserRunJsonOptions): Promise<Response>;
|
|
11133
|
+
/**
|
|
11134
|
+
* Convert a web page to Markdown.
|
|
11135
|
+
* @param action - Must be `'markdown'`.
|
|
11136
|
+
* @param options - Navigation and page interaction options.
|
|
11137
|
+
* @returns A `Response` containing one of:
|
|
11138
|
+
*
|
|
11139
|
+
* **Success (HTTP 200):**
|
|
11140
|
+
* - `BrowserRunMarkdownSuccessResponse` JSON with `Content-Type: application/json`
|
|
11141
|
+
*
|
|
11142
|
+
* **Error:**
|
|
11143
|
+
* - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
|
|
11144
|
+
* - HTTP 422 with code `2012` for HTML-to-markdown conversion failures
|
|
11145
|
+
*
|
|
11146
|
+
* **Headers:**
|
|
11147
|
+
* - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
|
|
11148
|
+
*/
|
|
11149
|
+
quickAction(action: 'markdown', options: BrowserRunMarkdownOptions): Promise<Response>;
|
|
10477
11150
|
}
|
|
10478
11151
|
/**
|
|
10479
11152
|
* In addition to the properties you can set in the RequestInit dict
|
|
@@ -10513,6 +11186,8 @@ interface RequestInitCfProperties extends Record<string, unknown> {
|
|
|
10513
11186
|
* (e.g. { '200-299': 86400, '404': 1, '500-599': 0 })
|
|
10514
11187
|
*/
|
|
10515
11188
|
cacheTtlByStatus?: Record<string, number>;
|
|
11189
|
+
/** Controls how responses with a `Vary` header are cached for this request. */
|
|
11190
|
+
vary?: RequestInitCfPropertiesVary;
|
|
10516
11191
|
/**
|
|
10517
11192
|
* Explicit Cache-Control header value to set on the response stored in cache.
|
|
10518
11193
|
* This gives full control over cache directives (e.g. 'public, max-age=3600, s-maxage=86400').
|
|
@@ -10550,6 +11225,17 @@ interface RequestInitCfProperties extends Record<string, unknown> {
|
|
|
10550
11225
|
cacheReserveMinimumFileSize?: number;
|
|
10551
11226
|
scrapeShield?: boolean;
|
|
10552
11227
|
apps?: boolean;
|
|
11228
|
+
/**
|
|
11229
|
+
* Controls whether an outbound gRPC-web subrequest from this Worker is
|
|
11230
|
+
* converted to gRPC at the Cloudflare edge.
|
|
11231
|
+
*
|
|
11232
|
+
* - `"passthrough"`: forward the subrequest unchanged as gRPC-web (default).
|
|
11233
|
+
* - `"convert"`: convert the gRPC-web subrequest to gRPC at the edge.
|
|
11234
|
+
*
|
|
11235
|
+
* Provides per-request control over the same edge conversion behavior
|
|
11236
|
+
* gated by the `auto_grpc_convert` compatibility flag.
|
|
11237
|
+
*/
|
|
11238
|
+
grpcWeb?: "passthrough" | "convert";
|
|
10553
11239
|
image?: RequestInitCfPropertiesImage;
|
|
10554
11240
|
minify?: RequestInitCfPropertiesImageMinify;
|
|
10555
11241
|
mirage?: boolean;
|
|
@@ -10570,49 +11256,122 @@ interface RequestInitCfProperties extends Record<string, unknown> {
|
|
|
10570
11256
|
*/
|
|
10571
11257
|
resolveOverride?: string;
|
|
10572
11258
|
}
|
|
10573
|
-
|
|
11259
|
+
/**
|
|
11260
|
+
* Controls how Workers Standard Vary handles a request header listed by an
|
|
11261
|
+
* origin `Vary` response header:
|
|
11262
|
+
*
|
|
11263
|
+
* - `"normalize"`: normalize the request header value before it is used in the
|
|
11264
|
+
* cache variance key.
|
|
11265
|
+
* - `"passthrough"`: use the raw request header value in the cache variance
|
|
11266
|
+
* key.
|
|
11267
|
+
* - `"bypass"`: bypass cache when the header appears in the origin `Vary`
|
|
11268
|
+
* response header.
|
|
11269
|
+
*/
|
|
11270
|
+
type RequestInitCfPropertiesVaryAction = "normalize" | "passthrough" | "bypass";
|
|
11271
|
+
/** Configuration for Workers Standard Vary support. */
|
|
11272
|
+
interface RequestInitCfPropertiesVary {
|
|
11273
|
+
/** The fallback action for varied request headers not listed in `headers`. */
|
|
11274
|
+
default: RequestInitCfPropertiesVaryHeader;
|
|
10574
11275
|
/**
|
|
10575
|
-
*
|
|
10576
|
-
*
|
|
10577
|
-
*
|
|
11276
|
+
* Lowercase request header names and their Vary configuration.
|
|
11277
|
+
*
|
|
11278
|
+
* The `accept` header can include `media_types`, the `accept-language`
|
|
11279
|
+
* header can include `languages`, and other headers support only `action`.
|
|
10578
11280
|
*/
|
|
10579
|
-
|
|
11281
|
+
headers?: RequestInitCfPropertiesVaryHeaders;
|
|
11282
|
+
}
|
|
11283
|
+
/** Common Vary behavior for a single request header. */
|
|
11284
|
+
interface RequestInitCfPropertiesVaryHeader {
|
|
11285
|
+
/** How this request header contributes to cache variance. */
|
|
11286
|
+
action: RequestInitCfPropertiesVaryAction;
|
|
11287
|
+
}
|
|
11288
|
+
/** Vary behavior for the `accept` request header. */
|
|
11289
|
+
interface RequestInitCfPropertiesVaryAcceptHeader extends RequestInitCfPropertiesVaryHeader {
|
|
10580
11290
|
/**
|
|
10581
|
-
*
|
|
10582
|
-
*
|
|
11291
|
+
* Media types to keep when normalizing the `Accept` request header.
|
|
11292
|
+
*
|
|
11293
|
+
* Named `media_types` to match the serialized `cf.vary` configuration.
|
|
10583
11294
|
*/
|
|
10584
|
-
|
|
11295
|
+
media_types?: string[];
|
|
11296
|
+
}
|
|
11297
|
+
/** Vary behavior for the `accept-language` request header. */
|
|
11298
|
+
interface RequestInitCfPropertiesVaryAcceptLanguageHeader extends RequestInitCfPropertiesVaryHeader {
|
|
10585
11299
|
/**
|
|
10586
|
-
*
|
|
10587
|
-
*
|
|
10588
|
-
* - If set to "x", the overlay image will be tiled horizontally only
|
|
10589
|
-
* (form a line).
|
|
10590
|
-
* - If set to "y", the overlay image will be tiled vertically only
|
|
10591
|
-
* (form a line).
|
|
11300
|
+
* Language tags to keep when normalizing the `Accept-Language` request
|
|
11301
|
+
* header.
|
|
10592
11302
|
*/
|
|
10593
|
-
|
|
11303
|
+
languages?: string[];
|
|
11304
|
+
}
|
|
11305
|
+
/**
|
|
11306
|
+
* Lowercase request header names and their Vary behavior.
|
|
11307
|
+
*
|
|
11308
|
+
* The index signature allows arbitrary custom request headers beyond the
|
|
11309
|
+
* well-known `accept` and `accept-language` specializations.
|
|
11310
|
+
*/
|
|
11311
|
+
interface RequestInitCfPropertiesVaryHeaders {
|
|
11312
|
+
accept?: RequestInitCfPropertiesVaryAcceptHeader;
|
|
11313
|
+
"accept-language"?: RequestInitCfPropertiesVaryAcceptLanguageHeader;
|
|
11314
|
+
[header: string]: RequestInitCfPropertiesVaryHeader | RequestInitCfPropertiesVaryAcceptHeader | RequestInitCfPropertiesVaryAcceptLanguageHeader | undefined;
|
|
11315
|
+
}
|
|
11316
|
+
interface BasicImageTransformations {
|
|
10594
11317
|
/**
|
|
10595
|
-
*
|
|
10596
|
-
* an offset in pixels. 0 aligns exactly to the edge. For example, left: 10
|
|
10597
|
-
* positions left side of the overlay 10 pixels from the left edge of the
|
|
10598
|
-
* image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom
|
|
10599
|
-
* of the background image.
|
|
10600
|
-
*
|
|
10601
|
-
* Setting both left & right, or both top & bottom is an error.
|
|
10602
|
-
*
|
|
10603
|
-
* If no position is specified, the image will be centered.
|
|
11318
|
+
* Maximum width in image pixels. The value must be an integer.
|
|
10604
11319
|
*/
|
|
10605
|
-
|
|
10606
|
-
left?: number;
|
|
10607
|
-
bottom?: number;
|
|
10608
|
-
right?: number;
|
|
10609
|
-
}
|
|
10610
|
-
interface RequestInitCfPropertiesImage extends BasicImageTransformations {
|
|
11320
|
+
width?: number;
|
|
10611
11321
|
/**
|
|
10612
|
-
*
|
|
10613
|
-
* easier to specify higher-DPI sizes in <img srcset>.
|
|
11322
|
+
* Maximum height in image pixels. The value must be an integer.
|
|
10614
11323
|
*/
|
|
10615
|
-
|
|
11324
|
+
height?: number;
|
|
11325
|
+
/**
|
|
11326
|
+
* When cropping with fit: "cover", this defines the side or point that should
|
|
11327
|
+
* be left uncropped. The value is either a string
|
|
11328
|
+
* "left", "right", "top", "bottom", "auto", or "center" (the default),
|
|
11329
|
+
* or an object {x, y} containing focal point coordinates in the original
|
|
11330
|
+
* image expressed as fractions ranging from 0.0 (top or left) to 1.0
|
|
11331
|
+
* (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
|
|
11332
|
+
* crop bottom or left and right sides as necessary, but won’t crop anything
|
|
11333
|
+
* from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
|
|
11334
|
+
* preserve as much as possible around a point at 20% of the height of the
|
|
11335
|
+
* source image.
|
|
11336
|
+
*/
|
|
11337
|
+
gravity?: 'face' | 'left' | 'right' | 'top' | 'bottom' | 'center' | 'auto' | 'entropy' | BasicImageTransformationsGravityCoordinates;
|
|
11338
|
+
/**
|
|
11339
|
+
* Specifies how closely the image is cropped toward detected faces when combined
|
|
11340
|
+
* with the gravity=face option. Accepts a valid range between 0.0 (includes as much
|
|
11341
|
+
* of the background as possible) and 1.0 (crops the image as closely to the face as
|
|
11342
|
+
* possible). The default is 0.
|
|
11343
|
+
*/
|
|
11344
|
+
zoom?: number;
|
|
11345
|
+
/**
|
|
11346
|
+
* Resizing mode as a string. It affects interpretation of width and height
|
|
11347
|
+
* options:
|
|
11348
|
+
* - scale-down: Similar to contain, but the image is never enlarged. If
|
|
11349
|
+
* the image is larger than given width or height, it will be resized.
|
|
11350
|
+
* Otherwise its original size will be kept.
|
|
11351
|
+
* - scale-up: Similar to contain, but the image is never shrunk. If the
|
|
11352
|
+
* image is smaller than the given width or height, it will be resized.
|
|
11353
|
+
* Otherwise its original size will be kept.
|
|
11354
|
+
* - contain: Resizes to maximum size that fits within the given width and
|
|
11355
|
+
* height. If only a single dimension is given (e.g. only width), the
|
|
11356
|
+
* image will be shrunk or enlarged to exactly match that dimension.
|
|
11357
|
+
* Aspect ratio is always preserved.
|
|
11358
|
+
* - cover: Resizes (shrinks or enlarges) to fill the entire area of width
|
|
11359
|
+
* and height. If the image has an aspect ratio different from the ratio
|
|
11360
|
+
* of width and height, it will be cropped to fit.
|
|
11361
|
+
* - crop: The image will be shrunk and cropped to fit within the area
|
|
11362
|
+
* specified by width and height. The image will not be enlarged. For images
|
|
11363
|
+
* smaller than the given dimensions it's the same as scale-down. For
|
|
11364
|
+
* images larger than the given dimensions, it's the same as cover.
|
|
11365
|
+
* See also trim.
|
|
11366
|
+
* - pad: Resizes to the maximum size that fits within the given width and
|
|
11367
|
+
* height, and then fills the remaining area with a background color
|
|
11368
|
+
* (white by default). Use of this mode is not recommended, as the same
|
|
11369
|
+
* effect can be more efficiently achieved with the contain mode and the
|
|
11370
|
+
* CSS object-fit: contain property.
|
|
11371
|
+
* - squeeze: Stretches and deforms to the width and height given, even if it
|
|
11372
|
+
* breaks aspect ratio
|
|
11373
|
+
*/
|
|
11374
|
+
fit?: "scale-down" | "scale-up" | "contain" | "cover" | "crop" | "pad" | "squeeze";
|
|
10616
11375
|
/**
|
|
10617
11376
|
* Allows you to trim your image. Takes dpr into account and is performed before
|
|
10618
11377
|
* resizing or rotation.
|
|
@@ -10641,6 +11400,154 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
|
|
|
10641
11400
|
keep?: number;
|
|
10642
11401
|
};
|
|
10643
11402
|
};
|
|
11403
|
+
/**
|
|
11404
|
+
* Background color to add underneath the image. Applies only to images with
|
|
11405
|
+
* transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
|
|
11406
|
+
* hsl(…), etc.)
|
|
11407
|
+
*/
|
|
11408
|
+
background?: string;
|
|
11409
|
+
/**
|
|
11410
|
+
* Flips the images horizontally, vertically, or both. Flipping is applied before
|
|
11411
|
+
* rotation, so if you apply flip=h,rotate=90 then the image will be flipped
|
|
11412
|
+
* horizontally, then rotated by 90 degrees.
|
|
11413
|
+
*/
|
|
11414
|
+
flip?: 'h' | 'v' | 'hv';
|
|
11415
|
+
/**
|
|
11416
|
+
* Number of degrees (90, 180, 270) to rotate the image by. width and height
|
|
11417
|
+
* options refer to axes after rotation.
|
|
11418
|
+
*/
|
|
11419
|
+
rotate?: 0 | 90 | 180 | 270 | 360;
|
|
11420
|
+
/**
|
|
11421
|
+
* Strength of sharpening filter to apply to the image. Floating-point
|
|
11422
|
+
* number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
|
|
11423
|
+
* recommended value for downscaled images.
|
|
11424
|
+
*/
|
|
11425
|
+
sharpen?: number;
|
|
11426
|
+
/**
|
|
11427
|
+
* Radius of a blur filter (approximate gaussian). Maximum supported radius
|
|
11428
|
+
* is 250.
|
|
11429
|
+
*/
|
|
11430
|
+
blur?: number;
|
|
11431
|
+
/**
|
|
11432
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
11433
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
11434
|
+
* ignored.
|
|
11435
|
+
*/
|
|
11436
|
+
contrast?: number;
|
|
11437
|
+
/**
|
|
11438
|
+
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
11439
|
+
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
11440
|
+
* 0 is ignored.
|
|
11441
|
+
*/
|
|
11442
|
+
brightness?: number;
|
|
11443
|
+
/**
|
|
11444
|
+
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
11445
|
+
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
11446
|
+
*/
|
|
11447
|
+
gamma?: number;
|
|
11448
|
+
/**
|
|
11449
|
+
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
11450
|
+
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
11451
|
+
* ignored.
|
|
11452
|
+
*/
|
|
11453
|
+
saturation?: number;
|
|
11454
|
+
/**
|
|
11455
|
+
* Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
|
|
11456
|
+
* easier to specify higher-DPI sizes in <img srcset>.
|
|
11457
|
+
*/
|
|
11458
|
+
dpr?: number;
|
|
11459
|
+
/**
|
|
11460
|
+
* Adds a border around the image. The border is added after resizing. Border
|
|
11461
|
+
* width takes dpr into account, and can be specified either using a single
|
|
11462
|
+
* width property, or individually for each side.
|
|
11463
|
+
*/
|
|
11464
|
+
border?: {
|
|
11465
|
+
color: string;
|
|
11466
|
+
width: number;
|
|
11467
|
+
} | {
|
|
11468
|
+
color: string;
|
|
11469
|
+
top: number;
|
|
11470
|
+
right: number;
|
|
11471
|
+
bottom: number;
|
|
11472
|
+
left: number;
|
|
11473
|
+
};
|
|
11474
|
+
/**
|
|
11475
|
+
* Image segmentation using artificial intelligence models. Sets pixels not
|
|
11476
|
+
* within selected segment area to transparent e.g "foreground" sets every
|
|
11477
|
+
* background pixel as transparent.
|
|
11478
|
+
*/
|
|
11479
|
+
segment?: "foreground";
|
|
11480
|
+
/**
|
|
11481
|
+
* Controls the algorithm used when an image needs to be enlarged. This
|
|
11482
|
+
* parameter works with any fit mode that upscales, such as `contain`,
|
|
11483
|
+
* `cover`, and `scale-up`. It has no effect when `fit=scale-down` or when
|
|
11484
|
+
* the target dimensions are smaller than the source.
|
|
11485
|
+
* - interpolate: Uses bicubic interpolation, which may reduce image quality.
|
|
11486
|
+
* This is the default behavior when `upscale` is not specified.
|
|
11487
|
+
* - generate: Uses AI upscaling to produce sharper, more detailed results
|
|
11488
|
+
* when enlarging images.
|
|
11489
|
+
*/
|
|
11490
|
+
upscale?: "interpolate" | "generate";
|
|
11491
|
+
}
|
|
11492
|
+
interface BasicImageTransformationsGravityCoordinates {
|
|
11493
|
+
x?: number;
|
|
11494
|
+
y?: number;
|
|
11495
|
+
mode?: 'remainder' | 'box-center';
|
|
11496
|
+
}
|
|
11497
|
+
interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
|
|
11498
|
+
/**
|
|
11499
|
+
* Absolute URL of the image file to use for the drawing. It can be any of
|
|
11500
|
+
* the supported file formats. For drawing of watermarks or non-rectangular
|
|
11501
|
+
* overlays we recommend using PNG or WebP images.
|
|
11502
|
+
*/
|
|
11503
|
+
url: string;
|
|
11504
|
+
/**
|
|
11505
|
+
* Floating-point number between 0 (transparent) and 1 (opaque).
|
|
11506
|
+
* For example, opacity: 0.5 makes overlay semitransparent.
|
|
11507
|
+
*/
|
|
11508
|
+
opacity?: number;
|
|
11509
|
+
/**
|
|
11510
|
+
* - If set to true, the overlay image will be tiled to cover the entire
|
|
11511
|
+
* area. This is useful for stock-photo-like watermarks.
|
|
11512
|
+
* - If set to "x", the overlay image will be tiled horizontally only
|
|
11513
|
+
* (form a line).
|
|
11514
|
+
* - If set to "y", the overlay image will be tiled vertically only
|
|
11515
|
+
* (form a line).
|
|
11516
|
+
*/
|
|
11517
|
+
repeat?: true | "x" | "y";
|
|
11518
|
+
/**
|
|
11519
|
+
* How to combine the foreground and backdrop pixels to create the result
|
|
11520
|
+
*/
|
|
11521
|
+
composite?:
|
|
11522
|
+
/** Foreground drawn on top of backdrop (default) */
|
|
11523
|
+
'over'
|
|
11524
|
+
/** Foreground shown only where backdrop is opaque */
|
|
11525
|
+
| 'in'
|
|
11526
|
+
/** Foreground drawn on top, but clipped to the backdrop's shape */
|
|
11527
|
+
| 'atop'
|
|
11528
|
+
/** Foreground shown only where backdrop is transparent */
|
|
11529
|
+
| 'out'
|
|
11530
|
+
/** Foreground and backdrop visible only where the other is not */
|
|
11531
|
+
| 'xor'
|
|
11532
|
+
/** Foreground and backdrop channels added (brightening) */
|
|
11533
|
+
| 'lighter';
|
|
11534
|
+
/**
|
|
11535
|
+
* Position of the overlay image relative to a given edge. Each property is
|
|
11536
|
+
* an offset in pixels. 0 aligns exactly to the edge. For example, left: 10
|
|
11537
|
+
* positions left side of the overlay 10 pixels from the left edge of the
|
|
11538
|
+
* image it's drawn over. bottom: 0 aligns bottom of the overlay with bottom
|
|
11539
|
+
* of the background image.
|
|
11540
|
+
*
|
|
11541
|
+
* Setting both left & right, or both top & bottom is an error.
|
|
11542
|
+
*
|
|
11543
|
+
* If no position is specified, the image will be centered.
|
|
11544
|
+
*/
|
|
11545
|
+
top?: number;
|
|
11546
|
+
left?: number;
|
|
11547
|
+
bottom?: number;
|
|
11548
|
+
right?: number;
|
|
11549
|
+
}
|
|
11550
|
+
interface RequestInitCfPropertiesImage extends BasicImageTransformations {
|
|
10644
11551
|
/**
|
|
10645
11552
|
* Quality setting from 1-100 (useful values are in 60-90 range). Lower values
|
|
10646
11553
|
* make images look worse, but load faster. The default is 85. It applies only
|
|
@@ -10682,17 +11589,6 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
|
|
|
10682
11589
|
* output formats always discard metadata.
|
|
10683
11590
|
*/
|
|
10684
11591
|
metadata?: "keep" | "copyright" | "none";
|
|
10685
|
-
/**
|
|
10686
|
-
* Strength of sharpening filter to apply to the image. Floating-point
|
|
10687
|
-
* number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
|
|
10688
|
-
* recommended value for downscaled images.
|
|
10689
|
-
*/
|
|
10690
|
-
sharpen?: number;
|
|
10691
|
-
/**
|
|
10692
|
-
* Radius of a blur filter (approximate gaussian). Maximum supported radius
|
|
10693
|
-
* is 250.
|
|
10694
|
-
*/
|
|
10695
|
-
blur?: number;
|
|
10696
11592
|
/**
|
|
10697
11593
|
* Overlays are drawn in the order they appear in the array (last array
|
|
10698
11594
|
* entry is the topmost layer).
|
|
@@ -10704,50 +11600,6 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
|
|
|
10704
11600
|
* the origin.
|
|
10705
11601
|
*/
|
|
10706
11602
|
"origin-auth"?: "share-publicly";
|
|
10707
|
-
/**
|
|
10708
|
-
* Adds a border around the image. The border is added after resizing. Border
|
|
10709
|
-
* width takes dpr into account, and can be specified either using a single
|
|
10710
|
-
* width property, or individually for each side.
|
|
10711
|
-
*/
|
|
10712
|
-
border?: {
|
|
10713
|
-
color: string;
|
|
10714
|
-
width: number;
|
|
10715
|
-
} | {
|
|
10716
|
-
color: string;
|
|
10717
|
-
top: number;
|
|
10718
|
-
right: number;
|
|
10719
|
-
bottom: number;
|
|
10720
|
-
left: number;
|
|
10721
|
-
};
|
|
10722
|
-
/**
|
|
10723
|
-
* Increase brightness by a factor. A value of 1.0 equals no change, a value
|
|
10724
|
-
* of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
|
|
10725
|
-
* 0 is ignored.
|
|
10726
|
-
*/
|
|
10727
|
-
brightness?: number;
|
|
10728
|
-
/**
|
|
10729
|
-
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
10730
|
-
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
10731
|
-
* ignored.
|
|
10732
|
-
*/
|
|
10733
|
-
contrast?: number;
|
|
10734
|
-
/**
|
|
10735
|
-
* Increase exposure by a factor. A value of 1.0 equals no change, a value of
|
|
10736
|
-
* 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
|
|
10737
|
-
*/
|
|
10738
|
-
gamma?: number;
|
|
10739
|
-
/**
|
|
10740
|
-
* Increase contrast by a factor. A value of 1.0 equals no change, a value of
|
|
10741
|
-
* 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
|
|
10742
|
-
* ignored.
|
|
10743
|
-
*/
|
|
10744
|
-
saturation?: number;
|
|
10745
|
-
/**
|
|
10746
|
-
* Flips the images horizontally, vertically, or both. Flipping is applied before
|
|
10747
|
-
* rotation, so if you apply flip=h,rotate=90 then the image will be flipped
|
|
10748
|
-
* horizontally, then rotated by 90 degrees.
|
|
10749
|
-
*/
|
|
10750
|
-
flip?: 'h' | 'v' | 'hv';
|
|
10751
11603
|
/**
|
|
10752
11604
|
* Slightly reduces latency on a cache miss by selecting a
|
|
10753
11605
|
* quickest-to-compress file format, at a cost of increased file size and
|
|
@@ -11128,6 +11980,32 @@ interface IncomingRequestCfPropertiesTLSClientAuth {
|
|
|
11128
11980
|
* @example "Dec 22 19:39:00 2018 GMT"
|
|
11129
11981
|
*/
|
|
11130
11982
|
certNotAfter: string;
|
|
11983
|
+
/**
|
|
11984
|
+
* The client leaf certificate in [RFC 9440](https://www.rfc-editor.org/rfc/rfc9440)
|
|
11985
|
+
* format (`:base64-DER:`). Empty if no client certificate was presented or if
|
|
11986
|
+
* the leaf certificate exceeded 10 KB (see {@link certRFC9440TooLarge}).
|
|
11987
|
+
*
|
|
11988
|
+
* Suitable for forwarding to an origin via the `Client-Cert` HTTP header.
|
|
11989
|
+
*/
|
|
11990
|
+
certRFC9440: string;
|
|
11991
|
+
/**
|
|
11992
|
+
* `true` if the leaf certificate exceeded 10 KB and was omitted from
|
|
11993
|
+
* {@link certRFC9440}.
|
|
11994
|
+
*/
|
|
11995
|
+
certRFC9440TooLarge: boolean;
|
|
11996
|
+
/**
|
|
11997
|
+
* The intermediate certificate chain in [RFC 9440](https://www.rfc-editor.org/rfc/rfc9440)
|
|
11998
|
+
* format as a comma-separated list. Empty if no intermediates were sent or
|
|
11999
|
+
* if the chain exceeded 16 KB (see {@link certChainRFC9440TooLarge}).
|
|
12000
|
+
*
|
|
12001
|
+
* Suitable for forwarding to an origin via the `Client-Cert-Chain` HTTP header.
|
|
12002
|
+
*/
|
|
12003
|
+
certChainRFC9440: string;
|
|
12004
|
+
/**
|
|
12005
|
+
* `true` if the intermediate chain exceeded 16 KB and was omitted from
|
|
12006
|
+
* {@link certChainRFC9440}.
|
|
12007
|
+
*/
|
|
12008
|
+
certChainRFC9440TooLarge: boolean;
|
|
11131
12009
|
}
|
|
11132
12010
|
/** Placeholder values for TLS Client Authorization */
|
|
11133
12011
|
interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
|
|
@@ -11148,6 +12026,10 @@ interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
|
|
|
11148
12026
|
certFingerprintSHA256: "";
|
|
11149
12027
|
certNotBefore: "";
|
|
11150
12028
|
certNotAfter: "";
|
|
12029
|
+
certRFC9440: "";
|
|
12030
|
+
certRFC9440TooLarge: false;
|
|
12031
|
+
certChainRFC9440: "";
|
|
12032
|
+
certChainRFC9440TooLarge: false;
|
|
11151
12033
|
}
|
|
11152
12034
|
/** Possible outcomes of TLS verification */
|
|
11153
12035
|
declare type CertVerificationStatus =
|
|
@@ -11602,11 +12484,25 @@ type ImageTransform = {
|
|
|
11602
12484
|
type ImageDrawOptions = {
|
|
11603
12485
|
opacity?: number;
|
|
11604
12486
|
repeat?: boolean | string;
|
|
12487
|
+
composite?: ImageCompositeMode;
|
|
11605
12488
|
top?: number;
|
|
11606
12489
|
left?: number;
|
|
11607
12490
|
bottom?: number;
|
|
11608
12491
|
right?: number;
|
|
11609
12492
|
};
|
|
12493
|
+
type ImageCompositeMode =
|
|
12494
|
+
/** Foreground drawn on top of backdrop (default) */
|
|
12495
|
+
'over'
|
|
12496
|
+
/** Foreground shown only where backdrop is opaque */
|
|
12497
|
+
| 'in'
|
|
12498
|
+
/** Foreground drawn on top, but clipped to the backdrop's shape */
|
|
12499
|
+
| 'atop'
|
|
12500
|
+
/** Foreground shown only where backdrop is transparent */
|
|
12501
|
+
| 'out'
|
|
12502
|
+
/** Foreground and backdrop visible only where the other is not */
|
|
12503
|
+
| 'xor'
|
|
12504
|
+
/** Foreground and backdrop channels added (brightening) */
|
|
12505
|
+
| 'lighter';
|
|
11610
12506
|
type ImageInputOptions = {
|
|
11611
12507
|
encoding?: 'base64';
|
|
11612
12508
|
};
|
|
@@ -12182,6 +13078,7 @@ declare namespace CloudflareWorkersModule {
|
|
|
12182
13078
|
export type WorkflowTimeoutDuration = WorkflowSleepDuration;
|
|
12183
13079
|
export type WorkflowRetentionDuration = WorkflowSleepDuration;
|
|
12184
13080
|
export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';
|
|
13081
|
+
export type WorkflowStepSensitivity = 'output';
|
|
12185
13082
|
export type WorkflowStepConfig = {
|
|
12186
13083
|
retries?: {
|
|
12187
13084
|
limit: number;
|
|
@@ -12189,16 +13086,27 @@ declare namespace CloudflareWorkersModule {
|
|
|
12189
13086
|
backoff?: WorkflowBackoff;
|
|
12190
13087
|
};
|
|
12191
13088
|
timeout?: WorkflowTimeoutDuration | number;
|
|
13089
|
+
sensitive?: WorkflowStepSensitivity;
|
|
13090
|
+
};
|
|
13091
|
+
export type WorkflowStepRollbackConfig = Pick<WorkflowStepConfig, 'retries' | 'timeout'>;
|
|
13092
|
+
export type WorkflowCronSchedule = {
|
|
13093
|
+
/** Cron expression that triggered this event. */
|
|
13094
|
+
cron: string;
|
|
13095
|
+
/** Timestamp of the scheduled trigger, in milliseconds since the Unix epoch. */
|
|
13096
|
+
scheduledTime: number;
|
|
12192
13097
|
};
|
|
12193
13098
|
export type WorkflowEvent<T> = {
|
|
12194
13099
|
payload: Readonly<T>;
|
|
12195
13100
|
timestamp: Date;
|
|
12196
13101
|
instanceId: string;
|
|
13102
|
+
workflowName: string;
|
|
13103
|
+
schedule?: WorkflowCronSchedule;
|
|
12197
13104
|
};
|
|
12198
13105
|
export type WorkflowStepEvent<T> = {
|
|
12199
13106
|
payload: Readonly<T>;
|
|
12200
13107
|
timestamp: Date;
|
|
12201
13108
|
type: string;
|
|
13109
|
+
sensitive?: WorkflowStepSensitivity;
|
|
12202
13110
|
};
|
|
12203
13111
|
export type WorkflowStepContext = {
|
|
12204
13112
|
step: {
|
|
@@ -12209,14 +13117,16 @@ declare namespace CloudflareWorkersModule {
|
|
|
12209
13117
|
config: WorkflowStepConfig;
|
|
12210
13118
|
};
|
|
12211
13119
|
export type WorkflowRollbackContext<T = unknown> = {
|
|
13120
|
+
ctx: WorkflowStepContext;
|
|
12212
13121
|
error: Error;
|
|
12213
13122
|
output: T | undefined;
|
|
13123
|
+
/** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
|
|
12214
13124
|
stepName: string;
|
|
12215
13125
|
};
|
|
12216
13126
|
export type WorkflowRollbackHandler<T = unknown> = (ctx: WorkflowRollbackContext<T>) => Promise<void>;
|
|
12217
13127
|
export type WorkflowStepRollbackOptions<T = unknown> = {
|
|
12218
|
-
rollback
|
|
12219
|
-
rollbackConfig?:
|
|
13128
|
+
rollback: WorkflowRollbackHandler<T>;
|
|
13129
|
+
rollbackConfig?: WorkflowStepRollbackConfig;
|
|
12220
13130
|
};
|
|
12221
13131
|
export abstract class WorkflowStep {
|
|
12222
13132
|
do<T extends Rpc.Serializable<T>>(name: string, callback: (ctx: WorkflowStepContext) => Promise<T>, rollbackOptions?: WorkflowStepRollbackOptions<T>): Promise<T>;
|
|
@@ -13111,7 +14021,7 @@ declare namespace TailStream {
|
|
|
13111
14021
|
interface ConnectEventInfo {
|
|
13112
14022
|
readonly type: "connect";
|
|
13113
14023
|
}
|
|
13114
|
-
type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError";
|
|
14024
|
+
type EventOutcome = "ok" | "canceled" | "exception" | "unknown" | "killSwitch" | "daemonDown" | "exceededCpu" | "exceededMemory" | "loadShed" | "responseStreamDisconnected" | "scriptNotFound" | "internalError" | "exceededWallTime";
|
|
13115
14025
|
interface ScriptVersion {
|
|
13116
14026
|
readonly id: string;
|
|
13117
14027
|
readonly tag?: string;
|