@cloudflare/workers-types 4.20260616.1 → 4.20260617.1

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/latest/index.d.ts CHANGED
@@ -12215,87 +12215,6 @@ declare abstract class BrowserRun {
12215
12215
  options: BrowserRunMarkdownOptions,
12216
12216
  ): Promise<Response>;
12217
12217
  }
12218
- interface BasicImageTransformations {
12219
- /**
12220
- * Maximum width in image pixels. The value must be an integer.
12221
- */
12222
- width?: number;
12223
- /**
12224
- * Maximum height in image pixels. The value must be an integer.
12225
- */
12226
- height?: number;
12227
- /**
12228
- * Resizing mode as a string. It affects interpretation of width and height
12229
- * options:
12230
- * - scale-down: Similar to contain, but the image is never enlarged. If
12231
- * the image is larger than given width or height, it will be resized.
12232
- * Otherwise its original size will be kept.
12233
- * - contain: Resizes to maximum size that fits within the given width and
12234
- * height. If only a single dimension is given (e.g. only width), the
12235
- * image will be shrunk or enlarged to exactly match that dimension.
12236
- * Aspect ratio is always preserved.
12237
- * - cover: Resizes (shrinks or enlarges) to fill the entire area of width
12238
- * and height. If the image has an aspect ratio different from the ratio
12239
- * of width and height, it will be cropped to fit.
12240
- * - crop: The image will be shrunk and cropped to fit within the area
12241
- * specified by width and height. The image will not be enlarged. For images
12242
- * smaller than the given dimensions it's the same as scale-down. For
12243
- * images larger than the given dimensions, it's the same as cover.
12244
- * See also trim.
12245
- * - pad: Resizes to the maximum size that fits within the given width and
12246
- * height, and then fills the remaining area with a background color
12247
- * (white by default). Use of this mode is not recommended, as the same
12248
- * effect can be more efficiently achieved with the contain mode and the
12249
- * CSS object-fit: contain property.
12250
- * - squeeze: Stretches and deforms to the width and height given, even if it
12251
- * breaks aspect ratio
12252
- */
12253
- fit?: "scale-down" | "contain" | "cover" | "crop" | "pad" | "squeeze";
12254
- /**
12255
- * Image segmentation using artificial intelligence models. Sets pixels not
12256
- * within selected segment area to transparent e.g "foreground" sets every
12257
- * background pixel as transparent.
12258
- */
12259
- segment?: "foreground";
12260
- /**
12261
- * When cropping with fit: "cover", this defines the side or point that should
12262
- * be left uncropped. The value is either a string
12263
- * "left", "right", "top", "bottom", "auto", or "center" (the default),
12264
- * or an object {x, y} containing focal point coordinates in the original
12265
- * image expressed as fractions ranging from 0.0 (top or left) to 1.0
12266
- * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
12267
- * crop bottom or left and right sides as necessary, but won’t crop anything
12268
- * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
12269
- * preserve as much as possible around a point at 20% of the height of the
12270
- * source image.
12271
- */
12272
- gravity?:
12273
- | "face"
12274
- | "left"
12275
- | "right"
12276
- | "top"
12277
- | "bottom"
12278
- | "center"
12279
- | "auto"
12280
- | "entropy"
12281
- | BasicImageTransformationsGravityCoordinates;
12282
- /**
12283
- * Background color to add underneath the image. Applies only to images with
12284
- * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
12285
- * hsl(…), etc.)
12286
- */
12287
- background?: string;
12288
- /**
12289
- * Number of degrees (90, 180, 270) to rotate the image by. width and height
12290
- * options refer to axes after rotation.
12291
- */
12292
- rotate?: 0 | 90 | 180 | 270 | 360;
12293
- }
12294
- interface BasicImageTransformationsGravityCoordinates {
12295
- x?: number;
12296
- y?: number;
12297
- mode?: "remainder" | "box-center";
12298
- }
12299
12218
  /**
12300
12219
  * In addition to the properties you can set in the RequestInit dict
12301
12220
  * that you pass as an argument to the Request constructor, you can
@@ -12391,6 +12310,209 @@ interface RequestInitCfProperties extends Record<string, unknown> {
12391
12310
  */
12392
12311
  resolveOverride?: string;
12393
12312
  }
12313
+ interface BasicImageTransformations {
12314
+ /**
12315
+ * Maximum width in image pixels. The value must be an integer.
12316
+ */
12317
+ width?: number;
12318
+ /**
12319
+ * Maximum height in image pixels. The value must be an integer.
12320
+ */
12321
+ height?: number;
12322
+ /**
12323
+ * When cropping with fit: "cover", this defines the side or point that should
12324
+ * be left uncropped. The value is either a string
12325
+ * "left", "right", "top", "bottom", "auto", or "center" (the default),
12326
+ * or an object {x, y} containing focal point coordinates in the original
12327
+ * image expressed as fractions ranging from 0.0 (top or left) to 1.0
12328
+ * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
12329
+ * crop bottom or left and right sides as necessary, but won’t crop anything
12330
+ * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
12331
+ * preserve as much as possible around a point at 20% of the height of the
12332
+ * source image.
12333
+ */
12334
+ gravity?:
12335
+ | "face"
12336
+ | "left"
12337
+ | "right"
12338
+ | "top"
12339
+ | "bottom"
12340
+ | "center"
12341
+ | "auto"
12342
+ | "entropy"
12343
+ | BasicImageTransformationsGravityCoordinates;
12344
+ /**
12345
+ * Specifies how closely the image is cropped toward detected faces when combined
12346
+ * with the gravity=face option. Accepts a valid range between 0.0 (includes as much
12347
+ * of the background as possible) and 1.0 (crops the image as closely to the face as
12348
+ * possible). The default is 0.
12349
+ */
12350
+ zoom?: number;
12351
+ /**
12352
+ * Resizing mode as a string. It affects interpretation of width and height
12353
+ * options:
12354
+ * - scale-down: Similar to contain, but the image is never enlarged. If
12355
+ * the image is larger than given width or height, it will be resized.
12356
+ * Otherwise its original size will be kept.
12357
+ * - scale-up: Similar to contain, but the image is never shrunk. If the
12358
+ * image is smaller than the given width or height, it will be resized.
12359
+ * Otherwise its original size will be kept.
12360
+ * - contain: Resizes to maximum size that fits within the given width and
12361
+ * height. If only a single dimension is given (e.g. only width), the
12362
+ * image will be shrunk or enlarged to exactly match that dimension.
12363
+ * Aspect ratio is always preserved.
12364
+ * - cover: Resizes (shrinks or enlarges) to fill the entire area of width
12365
+ * and height. If the image has an aspect ratio different from the ratio
12366
+ * of width and height, it will be cropped to fit.
12367
+ * - crop: The image will be shrunk and cropped to fit within the area
12368
+ * specified by width and height. The image will not be enlarged. For images
12369
+ * smaller than the given dimensions it's the same as scale-down. For
12370
+ * images larger than the given dimensions, it's the same as cover.
12371
+ * See also trim.
12372
+ * - pad: Resizes to the maximum size that fits within the given width and
12373
+ * height, and then fills the remaining area with a background color
12374
+ * (white by default). Use of this mode is not recommended, as the same
12375
+ * effect can be more efficiently achieved with the contain mode and the
12376
+ * CSS object-fit: contain property.
12377
+ * - squeeze: Stretches and deforms to the width and height given, even if it
12378
+ * breaks aspect ratio
12379
+ */
12380
+ fit?:
12381
+ | "scale-down"
12382
+ | "scale-up"
12383
+ | "contain"
12384
+ | "cover"
12385
+ | "crop"
12386
+ | "pad"
12387
+ | "squeeze";
12388
+ /**
12389
+ * Allows you to trim your image. Takes dpr into account and is performed before
12390
+ * resizing or rotation.
12391
+ *
12392
+ * It can be used as:
12393
+ * - left, top, right, bottom - it will specify the number of pixels to cut
12394
+ * off each side
12395
+ * - width, height - the width/height you'd like to end up with - can be used
12396
+ * in combination with the properties above
12397
+ * - border - this will automatically trim the surroundings of an image based on
12398
+ * it's color. It consists of three properties:
12399
+ * - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)
12400
+ * - tolerance: difference from color to treat as color
12401
+ * - keep: the number of pixels of border to keep
12402
+ */
12403
+ trim?:
12404
+ | "border"
12405
+ | {
12406
+ top?: number;
12407
+ bottom?: number;
12408
+ left?: number;
12409
+ right?: number;
12410
+ width?: number;
12411
+ height?: number;
12412
+ border?:
12413
+ | boolean
12414
+ | {
12415
+ color?: string;
12416
+ tolerance?: number;
12417
+ keep?: number;
12418
+ };
12419
+ };
12420
+ /**
12421
+ * Background color to add underneath the image. Applies only to images with
12422
+ * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
12423
+ * hsl(…), etc.)
12424
+ */
12425
+ background?: string;
12426
+ /**
12427
+ * Flips the images horizontally, vertically, or both. Flipping is applied before
12428
+ * rotation, so if you apply flip=h,rotate=90 then the image will be flipped
12429
+ * horizontally, then rotated by 90 degrees.
12430
+ */
12431
+ flip?: "h" | "v" | "hv";
12432
+ /**
12433
+ * Number of degrees (90, 180, 270) to rotate the image by. width and height
12434
+ * options refer to axes after rotation.
12435
+ */
12436
+ rotate?: 0 | 90 | 180 | 270 | 360;
12437
+ /**
12438
+ * Strength of sharpening filter to apply to the image. Floating-point
12439
+ * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
12440
+ * recommended value for downscaled images.
12441
+ */
12442
+ sharpen?: number;
12443
+ /**
12444
+ * Radius of a blur filter (approximate gaussian). Maximum supported radius
12445
+ * is 250.
12446
+ */
12447
+ blur?: number;
12448
+ /**
12449
+ * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12450
+ * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12451
+ * ignored.
12452
+ */
12453
+ contrast?: number;
12454
+ /**
12455
+ * Increase brightness by a factor. A value of 1.0 equals no change, a value
12456
+ * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
12457
+ * 0 is ignored.
12458
+ */
12459
+ brightness?: number;
12460
+ /**
12461
+ * Increase exposure by a factor. A value of 1.0 equals no change, a value of
12462
+ * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
12463
+ */
12464
+ gamma?: number;
12465
+ /**
12466
+ * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12467
+ * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12468
+ * ignored.
12469
+ */
12470
+ saturation?: number;
12471
+ /**
12472
+ * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
12473
+ * easier to specify higher-DPI sizes in <img srcset>.
12474
+ */
12475
+ dpr?: number;
12476
+ /**
12477
+ * Adds a border around the image. The border is added after resizing. Border
12478
+ * width takes dpr into account, and can be specified either using a single
12479
+ * width property, or individually for each side.
12480
+ */
12481
+ border?:
12482
+ | {
12483
+ color: string;
12484
+ width: number;
12485
+ }
12486
+ | {
12487
+ color: string;
12488
+ top: number;
12489
+ right: number;
12490
+ bottom: number;
12491
+ left: number;
12492
+ };
12493
+ /**
12494
+ * Image segmentation using artificial intelligence models. Sets pixels not
12495
+ * within selected segment area to transparent e.g "foreground" sets every
12496
+ * background pixel as transparent.
12497
+ */
12498
+ segment?: "foreground";
12499
+ /**
12500
+ * Controls the algorithm used when an image needs to be enlarged. This
12501
+ * parameter works with any fit mode that upscales, such as `contain`,
12502
+ * `cover`, and `scale-up`. It has no effect when `fit=scale-down` or when
12503
+ * the target dimensions are smaller than the source.
12504
+ * - interpolate: Uses bicubic interpolation, which may reduce image quality.
12505
+ * This is the default behavior when `upscale` is not specified.
12506
+ * - generate: Uses AI upscaling to produce sharper, more detailed results
12507
+ * when enlarging images.
12508
+ */
12509
+ upscale?: "interpolate" | "generate";
12510
+ }
12511
+ interface BasicImageTransformationsGravityCoordinates {
12512
+ x?: number;
12513
+ y?: number;
12514
+ mode?: "remainder" | "box-center";
12515
+ }
12394
12516
  interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
12395
12517
  /**
12396
12518
  * Absolute URL of the image file to use for the drawing. It can be any of
@@ -12444,43 +12566,6 @@ interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
12444
12566
  right?: number;
12445
12567
  }
12446
12568
  interface RequestInitCfPropertiesImage extends BasicImageTransformations {
12447
- /**
12448
- * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
12449
- * easier to specify higher-DPI sizes in <img srcset>.
12450
- */
12451
- dpr?: number;
12452
- /**
12453
- * Allows you to trim your image. Takes dpr into account and is performed before
12454
- * resizing or rotation.
12455
- *
12456
- * It can be used as:
12457
- * - left, top, right, bottom - it will specify the number of pixels to cut
12458
- * off each side
12459
- * - width, height - the width/height you'd like to end up with - can be used
12460
- * in combination with the properties above
12461
- * - border - this will automatically trim the surroundings of an image based on
12462
- * it's color. It consists of three properties:
12463
- * - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)
12464
- * - tolerance: difference from color to treat as color
12465
- * - keep: the number of pixels of border to keep
12466
- */
12467
- trim?:
12468
- | "border"
12469
- | {
12470
- top?: number;
12471
- bottom?: number;
12472
- left?: number;
12473
- right?: number;
12474
- width?: number;
12475
- height?: number;
12476
- border?:
12477
- | boolean
12478
- | {
12479
- color?: string;
12480
- tolerance?: number;
12481
- keep?: number;
12482
- };
12483
- };
12484
12569
  /**
12485
12570
  * Quality setting from 1-100 (useful values are in 60-90 range). Lower values
12486
12571
  * make images look worse, but load faster. The default is 85. It applies only
@@ -12530,17 +12615,6 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
12530
12615
  * output formats always discard metadata.
12531
12616
  */
12532
12617
  metadata?: "keep" | "copyright" | "none";
12533
- /**
12534
- * Strength of sharpening filter to apply to the image. Floating-point
12535
- * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
12536
- * recommended value for downscaled images.
12537
- */
12538
- sharpen?: number;
12539
- /**
12540
- * Radius of a blur filter (approximate gaussian). Maximum supported radius
12541
- * is 250.
12542
- */
12543
- blur?: number;
12544
12618
  /**
12545
12619
  * Overlays are drawn in the order they appear in the array (last array
12546
12620
  * entry is the topmost layer).
@@ -12552,52 +12626,6 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
12552
12626
  * the origin.
12553
12627
  */
12554
12628
  "origin-auth"?: "share-publicly";
12555
- /**
12556
- * Adds a border around the image. The border is added after resizing. Border
12557
- * width takes dpr into account, and can be specified either using a single
12558
- * width property, or individually for each side.
12559
- */
12560
- border?:
12561
- | {
12562
- color: string;
12563
- width: number;
12564
- }
12565
- | {
12566
- color: string;
12567
- top: number;
12568
- right: number;
12569
- bottom: number;
12570
- left: number;
12571
- };
12572
- /**
12573
- * Increase brightness by a factor. A value of 1.0 equals no change, a value
12574
- * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
12575
- * 0 is ignored.
12576
- */
12577
- brightness?: number;
12578
- /**
12579
- * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12580
- * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12581
- * ignored.
12582
- */
12583
- contrast?: number;
12584
- /**
12585
- * Increase exposure by a factor. A value of 1.0 equals no change, a value of
12586
- * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
12587
- */
12588
- gamma?: number;
12589
- /**
12590
- * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12591
- * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12592
- * ignored.
12593
- */
12594
- saturation?: number;
12595
- /**
12596
- * Flips the images horizontally, vertically, or both. Flipping is applied before
12597
- * rotation, so if you apply flip=h,rotate=90 then the image will be flipped
12598
- * horizontally, then rotated by 90 degrees.
12599
- */
12600
- flip?: "h" | "v" | "hv";
12601
12629
  /**
12602
12630
  * Slightly reduces latency on a cache miss by selecting a
12603
12631
  * quickest-to-compress file format, at a cost of increased file size and
@@ -14537,6 +14565,10 @@ declare namespace CloudflareWorkersModule {
14537
14565
  timeout?: WorkflowTimeoutDuration | number;
14538
14566
  sensitive?: WorkflowStepSensitivity;
14539
14567
  };
14568
+ export type WorkflowStepRollbackConfig = Pick<
14569
+ WorkflowStepConfig,
14570
+ "retries" | "timeout"
14571
+ >;
14540
14572
  export type WorkflowCronSchedule = {
14541
14573
  /** Cron expression that triggered this event. */
14542
14574
  cron: string;
@@ -14565,16 +14597,18 @@ declare namespace CloudflareWorkersModule {
14565
14597
  config: WorkflowStepConfig;
14566
14598
  };
14567
14599
  export type WorkflowRollbackContext<T = unknown> = {
14600
+ ctx: WorkflowStepContext;
14568
14601
  error: Error;
14569
14602
  output: T | undefined;
14603
+ /** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
14570
14604
  stepName: string;
14571
14605
  };
14572
14606
  export type WorkflowRollbackHandler<T = unknown> = (
14573
14607
  ctx: WorkflowRollbackContext<T>,
14574
14608
  ) => Promise<void>;
14575
14609
  export type WorkflowStepRollbackOptions<T = unknown> = {
14576
- rollback?: WorkflowRollbackHandler<T>;
14577
- rollbackConfig?: WorkflowStepConfig;
14610
+ rollback: WorkflowRollbackHandler<T>;
14611
+ rollbackConfig?: WorkflowStepRollbackConfig;
14578
14612
  };
14579
14613
  export abstract class WorkflowStep {
14580
14614
  do<T extends Rpc.Serializable<T>>(