@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.
package/index.d.ts CHANGED
@@ -12074,87 +12074,6 @@ declare abstract class BrowserRun {
12074
12074
  options: BrowserRunMarkdownOptions,
12075
12075
  ): Promise<Response>;
12076
12076
  }
12077
- interface BasicImageTransformations {
12078
- /**
12079
- * Maximum width in image pixels. The value must be an integer.
12080
- */
12081
- width?: number;
12082
- /**
12083
- * Maximum height in image pixels. The value must be an integer.
12084
- */
12085
- height?: number;
12086
- /**
12087
- * Resizing mode as a string. It affects interpretation of width and height
12088
- * options:
12089
- * - scale-down: Similar to contain, but the image is never enlarged. If
12090
- * the image is larger than given width or height, it will be resized.
12091
- * Otherwise its original size will be kept.
12092
- * - contain: Resizes to maximum size that fits within the given width and
12093
- * height. If only a single dimension is given (e.g. only width), the
12094
- * image will be shrunk or enlarged to exactly match that dimension.
12095
- * Aspect ratio is always preserved.
12096
- * - cover: Resizes (shrinks or enlarges) to fill the entire area of width
12097
- * and height. If the image has an aspect ratio different from the ratio
12098
- * of width and height, it will be cropped to fit.
12099
- * - crop: The image will be shrunk and cropped to fit within the area
12100
- * specified by width and height. The image will not be enlarged. For images
12101
- * smaller than the given dimensions it's the same as scale-down. For
12102
- * images larger than the given dimensions, it's the same as cover.
12103
- * See also trim.
12104
- * - pad: Resizes to the maximum size that fits within the given width and
12105
- * height, and then fills the remaining area with a background color
12106
- * (white by default). Use of this mode is not recommended, as the same
12107
- * effect can be more efficiently achieved with the contain mode and the
12108
- * CSS object-fit: contain property.
12109
- * - squeeze: Stretches and deforms to the width and height given, even if it
12110
- * breaks aspect ratio
12111
- */
12112
- fit?: "scale-down" | "contain" | "cover" | "crop" | "pad" | "squeeze";
12113
- /**
12114
- * Image segmentation using artificial intelligence models. Sets pixels not
12115
- * within selected segment area to transparent e.g "foreground" sets every
12116
- * background pixel as transparent.
12117
- */
12118
- segment?: "foreground";
12119
- /**
12120
- * When cropping with fit: "cover", this defines the side or point that should
12121
- * be left uncropped. The value is either a string
12122
- * "left", "right", "top", "bottom", "auto", or "center" (the default),
12123
- * or an object {x, y} containing focal point coordinates in the original
12124
- * image expressed as fractions ranging from 0.0 (top or left) to 1.0
12125
- * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
12126
- * crop bottom or left and right sides as necessary, but won’t crop anything
12127
- * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
12128
- * preserve as much as possible around a point at 20% of the height of the
12129
- * source image.
12130
- */
12131
- gravity?:
12132
- | "face"
12133
- | "left"
12134
- | "right"
12135
- | "top"
12136
- | "bottom"
12137
- | "center"
12138
- | "auto"
12139
- | "entropy"
12140
- | BasicImageTransformationsGravityCoordinates;
12141
- /**
12142
- * Background color to add underneath the image. Applies only to images with
12143
- * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
12144
- * hsl(…), etc.)
12145
- */
12146
- background?: string;
12147
- /**
12148
- * Number of degrees (90, 180, 270) to rotate the image by. width and height
12149
- * options refer to axes after rotation.
12150
- */
12151
- rotate?: 0 | 90 | 180 | 270 | 360;
12152
- }
12153
- interface BasicImageTransformationsGravityCoordinates {
12154
- x?: number;
12155
- y?: number;
12156
- mode?: "remainder" | "box-center";
12157
- }
12158
12077
  /**
12159
12078
  * In addition to the properties you can set in the RequestInit dict
12160
12079
  * that you pass as an argument to the Request constructor, you can
@@ -12250,6 +12169,209 @@ interface RequestInitCfProperties extends Record<string, unknown> {
12250
12169
  */
12251
12170
  resolveOverride?: string;
12252
12171
  }
12172
+ interface BasicImageTransformations {
12173
+ /**
12174
+ * Maximum width in image pixels. The value must be an integer.
12175
+ */
12176
+ width?: number;
12177
+ /**
12178
+ * Maximum height in image pixels. The value must be an integer.
12179
+ */
12180
+ height?: number;
12181
+ /**
12182
+ * When cropping with fit: "cover", this defines the side or point that should
12183
+ * be left uncropped. The value is either a string
12184
+ * "left", "right", "top", "bottom", "auto", or "center" (the default),
12185
+ * or an object {x, y} containing focal point coordinates in the original
12186
+ * image expressed as fractions ranging from 0.0 (top or left) to 1.0
12187
+ * (bottom or right), 0.5 being the center. {fit: "cover", gravity: "top"} will
12188
+ * crop bottom or left and right sides as necessary, but won’t crop anything
12189
+ * from the top. {fit: "cover", gravity: {x:0.5, y:0.2}} will crop each side to
12190
+ * preserve as much as possible around a point at 20% of the height of the
12191
+ * source image.
12192
+ */
12193
+ gravity?:
12194
+ | "face"
12195
+ | "left"
12196
+ | "right"
12197
+ | "top"
12198
+ | "bottom"
12199
+ | "center"
12200
+ | "auto"
12201
+ | "entropy"
12202
+ | BasicImageTransformationsGravityCoordinates;
12203
+ /**
12204
+ * Specifies how closely the image is cropped toward detected faces when combined
12205
+ * with the gravity=face option. Accepts a valid range between 0.0 (includes as much
12206
+ * of the background as possible) and 1.0 (crops the image as closely to the face as
12207
+ * possible). The default is 0.
12208
+ */
12209
+ zoom?: number;
12210
+ /**
12211
+ * Resizing mode as a string. It affects interpretation of width and height
12212
+ * options:
12213
+ * - scale-down: Similar to contain, but the image is never enlarged. If
12214
+ * the image is larger than given width or height, it will be resized.
12215
+ * Otherwise its original size will be kept.
12216
+ * - scale-up: Similar to contain, but the image is never shrunk. If the
12217
+ * image is smaller than the given width or height, it will be resized.
12218
+ * Otherwise its original size will be kept.
12219
+ * - contain: Resizes to maximum size that fits within the given width and
12220
+ * height. If only a single dimension is given (e.g. only width), the
12221
+ * image will be shrunk or enlarged to exactly match that dimension.
12222
+ * Aspect ratio is always preserved.
12223
+ * - cover: Resizes (shrinks or enlarges) to fill the entire area of width
12224
+ * and height. If the image has an aspect ratio different from the ratio
12225
+ * of width and height, it will be cropped to fit.
12226
+ * - crop: The image will be shrunk and cropped to fit within the area
12227
+ * specified by width and height. The image will not be enlarged. For images
12228
+ * smaller than the given dimensions it's the same as scale-down. For
12229
+ * images larger than the given dimensions, it's the same as cover.
12230
+ * See also trim.
12231
+ * - pad: Resizes to the maximum size that fits within the given width and
12232
+ * height, and then fills the remaining area with a background color
12233
+ * (white by default). Use of this mode is not recommended, as the same
12234
+ * effect can be more efficiently achieved with the contain mode and the
12235
+ * CSS object-fit: contain property.
12236
+ * - squeeze: Stretches and deforms to the width and height given, even if it
12237
+ * breaks aspect ratio
12238
+ */
12239
+ fit?:
12240
+ | "scale-down"
12241
+ | "scale-up"
12242
+ | "contain"
12243
+ | "cover"
12244
+ | "crop"
12245
+ | "pad"
12246
+ | "squeeze";
12247
+ /**
12248
+ * Allows you to trim your image. Takes dpr into account and is performed before
12249
+ * resizing or rotation.
12250
+ *
12251
+ * It can be used as:
12252
+ * - left, top, right, bottom - it will specify the number of pixels to cut
12253
+ * off each side
12254
+ * - width, height - the width/height you'd like to end up with - can be used
12255
+ * in combination with the properties above
12256
+ * - border - this will automatically trim the surroundings of an image based on
12257
+ * it's color. It consists of three properties:
12258
+ * - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)
12259
+ * - tolerance: difference from color to treat as color
12260
+ * - keep: the number of pixels of border to keep
12261
+ */
12262
+ trim?:
12263
+ | "border"
12264
+ | {
12265
+ top?: number;
12266
+ bottom?: number;
12267
+ left?: number;
12268
+ right?: number;
12269
+ width?: number;
12270
+ height?: number;
12271
+ border?:
12272
+ | boolean
12273
+ | {
12274
+ color?: string;
12275
+ tolerance?: number;
12276
+ keep?: number;
12277
+ };
12278
+ };
12279
+ /**
12280
+ * Background color to add underneath the image. Applies only to images with
12281
+ * transparency (such as PNG). Accepts any CSS color (#RRGGBB, rgba(…),
12282
+ * hsl(…), etc.)
12283
+ */
12284
+ background?: string;
12285
+ /**
12286
+ * Flips the images horizontally, vertically, or both. Flipping is applied before
12287
+ * rotation, so if you apply flip=h,rotate=90 then the image will be flipped
12288
+ * horizontally, then rotated by 90 degrees.
12289
+ */
12290
+ flip?: "h" | "v" | "hv";
12291
+ /**
12292
+ * Number of degrees (90, 180, 270) to rotate the image by. width and height
12293
+ * options refer to axes after rotation.
12294
+ */
12295
+ rotate?: 0 | 90 | 180 | 270 | 360;
12296
+ /**
12297
+ * Strength of sharpening filter to apply to the image. Floating-point
12298
+ * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
12299
+ * recommended value for downscaled images.
12300
+ */
12301
+ sharpen?: number;
12302
+ /**
12303
+ * Radius of a blur filter (approximate gaussian). Maximum supported radius
12304
+ * is 250.
12305
+ */
12306
+ blur?: number;
12307
+ /**
12308
+ * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12309
+ * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12310
+ * ignored.
12311
+ */
12312
+ contrast?: number;
12313
+ /**
12314
+ * Increase brightness by a factor. A value of 1.0 equals no change, a value
12315
+ * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
12316
+ * 0 is ignored.
12317
+ */
12318
+ brightness?: number;
12319
+ /**
12320
+ * Increase exposure by a factor. A value of 1.0 equals no change, a value of
12321
+ * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
12322
+ */
12323
+ gamma?: number;
12324
+ /**
12325
+ * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12326
+ * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12327
+ * ignored.
12328
+ */
12329
+ saturation?: number;
12330
+ /**
12331
+ * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
12332
+ * easier to specify higher-DPI sizes in <img srcset>.
12333
+ */
12334
+ dpr?: number;
12335
+ /**
12336
+ * Adds a border around the image. The border is added after resizing. Border
12337
+ * width takes dpr into account, and can be specified either using a single
12338
+ * width property, or individually for each side.
12339
+ */
12340
+ border?:
12341
+ | {
12342
+ color: string;
12343
+ width: number;
12344
+ }
12345
+ | {
12346
+ color: string;
12347
+ top: number;
12348
+ right: number;
12349
+ bottom: number;
12350
+ left: number;
12351
+ };
12352
+ /**
12353
+ * Image segmentation using artificial intelligence models. Sets pixels not
12354
+ * within selected segment area to transparent e.g "foreground" sets every
12355
+ * background pixel as transparent.
12356
+ */
12357
+ segment?: "foreground";
12358
+ /**
12359
+ * Controls the algorithm used when an image needs to be enlarged. This
12360
+ * parameter works with any fit mode that upscales, such as `contain`,
12361
+ * `cover`, and `scale-up`. It has no effect when `fit=scale-down` or when
12362
+ * the target dimensions are smaller than the source.
12363
+ * - interpolate: Uses bicubic interpolation, which may reduce image quality.
12364
+ * This is the default behavior when `upscale` is not specified.
12365
+ * - generate: Uses AI upscaling to produce sharper, more detailed results
12366
+ * when enlarging images.
12367
+ */
12368
+ upscale?: "interpolate" | "generate";
12369
+ }
12370
+ interface BasicImageTransformationsGravityCoordinates {
12371
+ x?: number;
12372
+ y?: number;
12373
+ mode?: "remainder" | "box-center";
12374
+ }
12253
12375
  interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
12254
12376
  /**
12255
12377
  * Absolute URL of the image file to use for the drawing. It can be any of
@@ -12303,43 +12425,6 @@ interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
12303
12425
  right?: number;
12304
12426
  }
12305
12427
  interface RequestInitCfPropertiesImage extends BasicImageTransformations {
12306
- /**
12307
- * Device Pixel Ratio. Default 1. Multiplier for width/height that makes it
12308
- * easier to specify higher-DPI sizes in <img srcset>.
12309
- */
12310
- dpr?: number;
12311
- /**
12312
- * Allows you to trim your image. Takes dpr into account and is performed before
12313
- * resizing or rotation.
12314
- *
12315
- * It can be used as:
12316
- * - left, top, right, bottom - it will specify the number of pixels to cut
12317
- * off each side
12318
- * - width, height - the width/height you'd like to end up with - can be used
12319
- * in combination with the properties above
12320
- * - border - this will automatically trim the surroundings of an image based on
12321
- * it's color. It consists of three properties:
12322
- * - color: rgb or hex representation of the color you wish to trim (todo: verify the rgba bit)
12323
- * - tolerance: difference from color to treat as color
12324
- * - keep: the number of pixels of border to keep
12325
- */
12326
- trim?:
12327
- | "border"
12328
- | {
12329
- top?: number;
12330
- bottom?: number;
12331
- left?: number;
12332
- right?: number;
12333
- width?: number;
12334
- height?: number;
12335
- border?:
12336
- | boolean
12337
- | {
12338
- color?: string;
12339
- tolerance?: number;
12340
- keep?: number;
12341
- };
12342
- };
12343
12428
  /**
12344
12429
  * Quality setting from 1-100 (useful values are in 60-90 range). Lower values
12345
12430
  * make images look worse, but load faster. The default is 85. It applies only
@@ -12389,17 +12474,6 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
12389
12474
  * output formats always discard metadata.
12390
12475
  */
12391
12476
  metadata?: "keep" | "copyright" | "none";
12392
- /**
12393
- * Strength of sharpening filter to apply to the image. Floating-point
12394
- * number between 0 (no sharpening, default) and 10 (maximum). 1.0 is a
12395
- * recommended value for downscaled images.
12396
- */
12397
- sharpen?: number;
12398
- /**
12399
- * Radius of a blur filter (approximate gaussian). Maximum supported radius
12400
- * is 250.
12401
- */
12402
- blur?: number;
12403
12477
  /**
12404
12478
  * Overlays are drawn in the order they appear in the array (last array
12405
12479
  * entry is the topmost layer).
@@ -12411,52 +12485,6 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
12411
12485
  * the origin.
12412
12486
  */
12413
12487
  "origin-auth"?: "share-publicly";
12414
- /**
12415
- * Adds a border around the image. The border is added after resizing. Border
12416
- * width takes dpr into account, and can be specified either using a single
12417
- * width property, or individually for each side.
12418
- */
12419
- border?:
12420
- | {
12421
- color: string;
12422
- width: number;
12423
- }
12424
- | {
12425
- color: string;
12426
- top: number;
12427
- right: number;
12428
- bottom: number;
12429
- left: number;
12430
- };
12431
- /**
12432
- * Increase brightness by a factor. A value of 1.0 equals no change, a value
12433
- * of 0.5 equals half brightness, and a value of 2.0 equals twice as bright.
12434
- * 0 is ignored.
12435
- */
12436
- brightness?: number;
12437
- /**
12438
- * Increase contrast by a factor. A value of 1.0 equals no change, a value of
12439
- * 0.5 equals low contrast, and a value of 2.0 equals high contrast. 0 is
12440
- * ignored.
12441
- */
12442
- contrast?: number;
12443
- /**
12444
- * Increase exposure by a factor. A value of 1.0 equals no change, a value of
12445
- * 0.5 darkens the image, and a value of 2.0 lightens the image. 0 is ignored.
12446
- */
12447
- gamma?: 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
- saturation?: number;
12454
- /**
12455
- * Flips the images horizontally, vertically, or both. Flipping is applied before
12456
- * rotation, so if you apply flip=h,rotate=90 then the image will be flipped
12457
- * horizontally, then rotated by 90 degrees.
12458
- */
12459
- flip?: "h" | "v" | "hv";
12460
12488
  /**
12461
12489
  * Slightly reduces latency on a cache miss by selecting a
12462
12490
  * quickest-to-compress file format, at a cost of increased file size and
@@ -14396,6 +14424,10 @@ declare namespace CloudflareWorkersModule {
14396
14424
  timeout?: WorkflowTimeoutDuration | number;
14397
14425
  sensitive?: WorkflowStepSensitivity;
14398
14426
  };
14427
+ export type WorkflowStepRollbackConfig = Pick<
14428
+ WorkflowStepConfig,
14429
+ "retries" | "timeout"
14430
+ >;
14399
14431
  export type WorkflowCronSchedule = {
14400
14432
  /** Cron expression that triggered this event. */
14401
14433
  cron: string;
@@ -14424,16 +14456,18 @@ declare namespace CloudflareWorkersModule {
14424
14456
  config: WorkflowStepConfig;
14425
14457
  };
14426
14458
  export type WorkflowRollbackContext<T = unknown> = {
14459
+ ctx: WorkflowStepContext;
14427
14460
  error: Error;
14428
14461
  output: T | undefined;
14462
+ /** @deprecated Use `ctx.step.name` and `ctx.step.count` instead. */
14429
14463
  stepName: string;
14430
14464
  };
14431
14465
  export type WorkflowRollbackHandler<T = unknown> = (
14432
14466
  ctx: WorkflowRollbackContext<T>,
14433
14467
  ) => Promise<void>;
14434
14468
  export type WorkflowStepRollbackOptions<T = unknown> = {
14435
- rollback?: WorkflowRollbackHandler<T>;
14436
- rollbackConfig?: WorkflowStepConfig;
14469
+ rollback: WorkflowRollbackHandler<T>;
14470
+ rollbackConfig?: WorkflowStepRollbackConfig;
14437
14471
  };
14438
14472
  export abstract class WorkflowStep {
14439
14473
  do<T extends Rpc.Serializable<T>>(