@cloudflare/workers-types 4.20260615.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.
@@ -12141,87 +12141,6 @@ declare abstract class BrowserRun {
12141
12141
  options: BrowserRunMarkdownOptions,
12142
12142
  ): Promise<Response>;
12143
12143
  }
12144
- interface BasicImageTransformations {
12145
- /**
12146
- * Maximum width in image pixels. The value must be an integer.
12147
- */
12148
- width?: number;
12149
- /**
12150
- * Maximum height in image pixels. The value must be an integer.
12151
- */
12152
- height?: number;
12153
- /**
12154
- * Resizing mode as a string. It affects interpretation of width and height
12155
- * options:
12156
- * - scale-down: Similar to contain, but the image is never enlarged. If
12157
- * the image is larger than given width or height, it will be resized.
12158
- * Otherwise its original size will be kept.
12159
- * - contain: Resizes to maximum size that fits within the given width and
12160
- * height. If only a single dimension is given (e.g. only width), the
12161
- * image will be shrunk or enlarged to exactly match that dimension.
12162
- * Aspect ratio is always preserved.
12163
- * - cover: Resizes (shrinks or enlarges) to fill the entire area of width
12164
- * and height. If the image has an aspect ratio different from the ratio
12165
- * of width and height, it will be cropped to fit.
12166
- * - crop: The image will be shrunk and cropped to fit within the area
12167
- * specified by width and height. The image will not be enlarged. For images
12168
- * smaller than the given dimensions it's the same as scale-down. For
12169
- * images larger than the given dimensions, it's the same as cover.
12170
- * See also trim.
12171
- * - pad: Resizes to the maximum size that fits within the given width and
12172
- * height, and then fills the remaining area with a background color
12173
- * (white by default). Use of this mode is not recommended, as the same
12174
- * effect can be more efficiently achieved with the contain mode and the
12175
- * CSS object-fit: contain property.
12176
- * - squeeze: Stretches and deforms to the width and height given, even if it
12177
- * breaks aspect ratio
12178
- */
12179
- fit?: "scale-down" | "contain" | "cover" | "crop" | "pad" | "squeeze";
12180
- /**
12181
- * Image segmentation using artificial intelligence models. Sets pixels not
12182
- * within selected segment area to transparent e.g "foreground" sets every
12183
- * background pixel as transparent.
12184
- */
12185
- segment?: "foreground";
12186
- /**
12187
- * When cropping with fit: "cover", this defines the side or point that should
12188
- * be left uncropped. The value is either a string
12189
- * "left", "right", "top", "bottom", "auto", or "center" (the default),
12190
- * or an object {x, y} containing focal point coordinates in the original
12191
- * image expressed as fractions ranging from 0.0 (top or left) to 1.0
12192
- * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
12193
- * crop bottom or left and right sides as necessary, but won’t crop anything
12194
- * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
12195
- * preserve as much as possible around a point at 20% of the height of the
12196
- * source image.
12197
- */
12198
- gravity?:
12199
- | "face"
12200
- | "left"
12201
- | "right"
12202
- | "top"
12203
- | "bottom"
12204
- | "center"
12205
- | "auto"
12206
- | "entropy"
12207
- | BasicImageTransformationsGravityCoordinates;
12208
- /**
12209
- * Background color to add underneath the image. Applies only to images with
12210
- * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
12211
- * hsl(…), etc.)
12212
- */
12213
- background?: string;
12214
- /**
12215
- * Number of degrees (90, 180, 270) to rotate the image by. width and height
12216
- * options refer to axes after rotation.
12217
- */
12218
- rotate?: 0 | 90 | 180 | 270 | 360;
12219
- }
12220
- interface BasicImageTransformationsGravityCoordinates {
12221
- x?: number;
12222
- y?: number;
12223
- mode?: "remainder" | "box-center";
12224
- }
12225
12144
  /**
12226
12145
  * In addition to the properties you can set in the RequestInit dict
12227
12146
  * that you pass as an argument to the Request constructor, you can
@@ -12317,6 +12236,209 @@ interface RequestInitCfProperties extends Record<string, unknown> {
12317
12236
  */
12318
12237
  resolveOverride?: string;
12319
12238
  }
12239
+ interface BasicImageTransformations {
12240
+ /**
12241
+ * Maximum width in image pixels. The value must be an integer.
12242
+ */
12243
+ width?: number;
12244
+ /**
12245
+ * Maximum height in image pixels. The value must be an integer.
12246
+ */
12247
+ height?: number;
12248
+ /**
12249
+ * When cropping with fit: "cover", this defines the side or point that should
12250
+ * be left uncropped. The value is either a string
12251
+ * "left", "right", "top", "bottom", "auto", or "center" (the default),
12252
+ * or an object {x, y} containing focal point coordinates in the original
12253
+ * image expressed as fractions ranging from 0.0 (top or left) to 1.0
12254
+ * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
12255
+ * crop bottom or left and right sides as necessary, but won’t crop anything
12256
+ * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
12257
+ * preserve as much as possible around a point at 20% of the height of the
12258
+ * source image.
12259
+ */
12260
+ gravity?:
12261
+ | "face"
12262
+ | "left"
12263
+ | "right"
12264
+ | "top"
12265
+ | "bottom"
12266
+ | "center"
12267
+ | "auto"
12268
+ | "entropy"
12269
+ | BasicImageTransformationsGravityCoordinates;
12270
+ /**
12271
+ * Specifies how closely the image is cropped toward detected faces when combined
12272
+ * with the gravity=face option. Accepts a valid range between 0.0 (includes as much
12273
+ * of the background as possible) and 1.0 (crops the image as closely to the face as
12274
+ * possible). The default is 0.
12275
+ */
12276
+ zoom?: number;
12277
+ /**
12278
+ * Resizing mode as a string. It affects interpretation of width and height
12279
+ * options:
12280
+ * - scale-down: Similar to contain, but the image is never enlarged. If
12281
+ * the image is larger than given width or height, it will be resized.
12282
+ * Otherwise its original size will be kept.
12283
+ * - scale-up: Similar to contain, but the image is never shrunk. If the
12284
+ * image is smaller than the given width or height, it will be resized.
12285
+ * Otherwise its original size will be kept.
12286
+ * - contain: Resizes to maximum size that fits within the given width and
12287
+ * height. If only a single dimension is given (e.g. only width), the
12288
+ * image will be shrunk or enlarged to exactly match that dimension.
12289
+ * Aspect ratio is always preserved.
12290
+ * - cover: Resizes (shrinks or enlarges) to fill the entire area of width
12291
+ * and height. If the image has an aspect ratio different from the ratio
12292
+ * of width and height, it will be cropped to fit.
12293
+ * - crop: The image will be shrunk and cropped to fit within the area
12294
+ * specified by width and height. The image will not be enlarged. For images
12295
+ * smaller than the given dimensions it's the same as scale-down. For
12296
+ * images larger than the given dimensions, it's the same as cover.
12297
+ * See also trim.
12298
+ * - pad: Resizes to the maximum size that fits within the given width and
12299
+ * height, and then fills the remaining area with a background color
12300
+ * (white by default). Use of this mode is not recommended, as the same
12301
+ * effect can be more efficiently achieved with the contain mode and the
12302
+ * CSS object-fit: contain property.
12303
+ * - squeeze: Stretches and deforms to the width and height given, even if it
12304
+ * breaks aspect ratio
12305
+ */
12306
+ fit?:
12307
+ | "scale-down"
12308
+ | "scale-up"
12309
+ | "contain"
12310
+ | "cover"
12311
+ | "crop"
12312
+ | "pad"
12313
+ | "squeeze";
12314
+ /**
12315
+ * Allows you to trim your image. Takes dpr into account and is performed before
12316
+ * resizing or rotation.
12317
+ *
12318
+ * It can be used as:
12319
+ * - left, top, right, bottom - it will specify the number of pixels to cut
12320
+ * off each side
12321
+ * - width, height - the width/height you'd like to end up with - can be used
12322
+ * in combination with the properties above
12323
+ * - border - this will automatically trim the surroundings of an image based on
12324
+ * it's color. It consists of three properties:
12325
+ * - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)
12326
+ * - tolerance: difference from color to treat as color
12327
+ * - keep: the number of pixels of border to keep
12328
+ */
12329
+ trim?:
12330
+ | "border"
12331
+ | {
12332
+ top?: number;
12333
+ bottom?: number;
12334
+ left?: number;
12335
+ right?: number;
12336
+ width?: number;
12337
+ height?: number;
12338
+ border?:
12339
+ | boolean
12340
+ | {
12341
+ color?: string;
12342
+ tolerance?: number;
12343
+ keep?: number;
12344
+ };
12345
+ };
12346
+ /**
12347
+ * Background color to add underneath the image. Applies only to images with
12348
+ * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
12349
+ * hsl(…), etc.)
12350
+ */
12351
+ background?: string;
12352
+ /**
12353
+ * Flips the images horizontally, vertically, or both. Flipping is applied before
12354
+ * rotation, so if you apply flip=h,rotate=90 then the image will be flipped
12355
+ * horizontally, then rotated by 90 degrees.
12356
+ */
12357
+ flip?: "h" | "v" | "hv";
12358
+ /**
12359
+ * Number of degrees (90, 180, 270) to rotate the image by. width and height
12360
+ * options refer to axes after rotation.
12361
+ */
12362
+ rotate?: 0 | 90 | 180 | 270 | 360;
12363
+ /**
12364
+ * Strength of sharpening filter to apply to the image. Floating-point
12365
+ * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
12366
+ * recommended value for downscaled images.
12367
+ */
12368
+ sharpen?: number;
12369
+ /**
12370
+ * Radius of a blur filter (approximate gaussian). Maximum supported radius
12371
+ * is 250.
12372
+ */
12373
+ blur?: number;
12374
+ /**
12375
+ * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12376
+ * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12377
+ * ignored.
12378
+ */
12379
+ contrast?: number;
12380
+ /**
12381
+ * Increase brightness by a factor. A value of 1.0 equals no change, a value
12382
+ * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
12383
+ * 0 is ignored.
12384
+ */
12385
+ brightness?: number;
12386
+ /**
12387
+ * Increase exposure by a factor. A value of 1.0 equals no change, a value of
12388
+ * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
12389
+ */
12390
+ gamma?: number;
12391
+ /**
12392
+ * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12393
+ * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12394
+ * ignored.
12395
+ */
12396
+ saturation?: number;
12397
+ /**
12398
+ * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
12399
+ * easier to specify higher-DPI sizes in <img srcset>.
12400
+ */
12401
+ dpr?: number;
12402
+ /**
12403
+ * Adds a border around the image. The border is added after resizing. Border
12404
+ * width takes dpr into account, and can be specified either using a single
12405
+ * width property, or individually for each side.
12406
+ */
12407
+ border?:
12408
+ | {
12409
+ color: string;
12410
+ width: number;
12411
+ }
12412
+ | {
12413
+ color: string;
12414
+ top: number;
12415
+ right: number;
12416
+ bottom: number;
12417
+ left: number;
12418
+ };
12419
+ /**
12420
+ * Image segmentation using artificial intelligence models. Sets pixels not
12421
+ * within selected segment area to transparent e.g "foreground" sets every
12422
+ * background pixel as transparent.
12423
+ */
12424
+ segment?: "foreground";
12425
+ /**
12426
+ * Controls the algorithm used when an image needs to be enlarged. This
12427
+ * parameter works with any fit mode that upscales, such as `contain`,
12428
+ * `cover`, and `scale-up`. It has no effect when `fit=scale-down` or when
12429
+ * the target dimensions are smaller than the source.
12430
+ * - interpolate: Uses bicubic interpolation, which may reduce image quality.
12431
+ * This is the default behavior when `upscale` is not specified.
12432
+ * - generate: Uses AI upscaling to produce sharper, more detailed results
12433
+ * when enlarging images.
12434
+ */
12435
+ upscale?: "interpolate" | "generate";
12436
+ }
12437
+ interface BasicImageTransformationsGravityCoordinates {
12438
+ x?: number;
12439
+ y?: number;
12440
+ mode?: "remainder" | "box-center";
12441
+ }
12320
12442
  interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
12321
12443
  /**
12322
12444
  * Absolute URL of the image file to use for the drawing. It can be any of
@@ -12370,43 +12492,6 @@ interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
12370
12492
  right?: number;
12371
12493
  }
12372
12494
  interface RequestInitCfPropertiesImage extends BasicImageTransformations {
12373
- /**
12374
- * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
12375
- * easier to specify higher-DPI sizes in <img srcset>.
12376
- */
12377
- dpr?: number;
12378
- /**
12379
- * Allows you to trim your image. Takes dpr into account and is performed before
12380
- * resizing or rotation.
12381
- *
12382
- * It can be used as:
12383
- * - left, top, right, bottom - it will specify the number of pixels to cut
12384
- * off each side
12385
- * - width, height - the width/height you'd like to end up with - can be used
12386
- * in combination with the properties above
12387
- * - border - this will automatically trim the surroundings of an image based on
12388
- * it's color. It consists of three properties:
12389
- * - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)
12390
- * - tolerance: difference from color to treat as color
12391
- * - keep: the number of pixels of border to keep
12392
- */
12393
- trim?:
12394
- | "border"
12395
- | {
12396
- top?: number;
12397
- bottom?: number;
12398
- left?: number;
12399
- right?: number;
12400
- width?: number;
12401
- height?: number;
12402
- border?:
12403
- | boolean
12404
- | {
12405
- color?: string;
12406
- tolerance?: number;
12407
- keep?: number;
12408
- };
12409
- };
12410
12495
  /**
12411
12496
  * Quality setting from 1-100 (useful values are in 60-90 range). Lower values
12412
12497
  * make images look worse, but load faster. The default is 85. It applies only
@@ -12456,17 +12541,6 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
12456
12541
  * output formats always discard metadata.
12457
12542
  */
12458
12543
  metadata?: "keep" | "copyright" | "none";
12459
- /**
12460
- * Strength of sharpening filter to apply to the image. Floating-point
12461
- * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
12462
- * recommended value for downscaled images.
12463
- */
12464
- sharpen?: number;
12465
- /**
12466
- * Radius of a blur filter (approximate gaussian). Maximum supported radius
12467
- * is 250.
12468
- */
12469
- blur?: number;
12470
12544
  /**
12471
12545
  * Overlays are drawn in the order they appear in the array (last array
12472
12546
  * entry is the topmost layer).
@@ -12478,52 +12552,6 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
12478
12552
  * the origin.
12479
12553
  */
12480
12554
  "origin-auth"?: "share-publicly";
12481
- /**
12482
- * Adds a border around the image. The border is added after resizing. Border
12483
- * width takes dpr into account, and can be specified either using a single
12484
- * width property, or individually for each side.
12485
- */
12486
- border?:
12487
- | {
12488
- color: string;
12489
- width: number;
12490
- }
12491
- | {
12492
- color: string;
12493
- top: number;
12494
- right: number;
12495
- bottom: number;
12496
- left: number;
12497
- };
12498
- /**
12499
- * Increase brightness by a factor. A value of 1.0 equals no change, a value
12500
- * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
12501
- * 0 is ignored.
12502
- */
12503
- brightness?: number;
12504
- /**
12505
- * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12506
- * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12507
- * ignored.
12508
- */
12509
- contrast?: number;
12510
- /**
12511
- * Increase exposure by a factor. A value of 1.0 equals no change, a value of
12512
- * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
12513
- */
12514
- gamma?: number;
12515
- /**
12516
- * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12517
- * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12518
- * ignored.
12519
- */
12520
- saturation?: number;
12521
- /**
12522
- * Flips the images horizontally, vertically, or both. Flipping is applied before
12523
- * rotation, so if you apply flip=h,rotate=90 then the image will be flipped
12524
- * horizontally, then rotated by 90 degrees.
12525
- */
12526
- flip?: "h" | "v" | "hv";
12527
12555
  /**
12528
12556
  * Slightly reduces latency on a cache miss by selecting a
12529
12557
  * quickest-to-compress file format, at a cost of increased file size and
@@ -14463,6 +14491,10 @@ declare namespace CloudflareWorkersModule {
14463
14491
  timeout?: WorkflowTimeoutDuration | number;
14464
14492
  sensitive?: WorkflowStepSensitivity;
14465
14493
  };
14494
+ export type WorkflowStepRollbackConfig = Pick<
14495
+ WorkflowStepConfig,
14496
+ "retries" | "timeout"
14497
+ >;
14466
14498
  export type WorkflowCronSchedule = {
14467
14499
  /** Cron expression that triggered this event. */
14468
14500
  cron: string;
@@ -14491,16 +14523,18 @@ declare namespace CloudflareWorkersModule {
14491
14523
  config: WorkflowStepConfig;
14492
14524
  };
14493
14525
  export type WorkflowRollbackContext<T = unknown> = {
14526
+ ctx: WorkflowStepContext;
14494
14527
  error: Error;
14495
14528
  output: T | undefined;
14529
+ /** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
14496
14530
  stepName: string;
14497
14531
  };
14498
14532
  export type WorkflowRollbackHandler<T = unknown> = (
14499
14533
  ctx: WorkflowRollbackContext<T>,
14500
14534
  ) => Promise<void>;
14501
14535
  export type WorkflowStepRollbackOptions<T = unknown> = {
14502
- rollback?: WorkflowRollbackHandler<T>;
14503
- rollbackConfig?: WorkflowStepConfig;
14536
+ rollback: WorkflowRollbackHandler<T>;
14537
+ rollbackConfig?: WorkflowStepRollbackConfig;
14504
14538
  };
14505
14539
  export abstract class WorkflowStep {
14506
14540
  do<T extends Rpc.Serializable<T>>(