@imagekit/nodejs 7.1.0 → 7.2.0

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.
Files changed (98) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/LICENSE +1 -1
  3. package/README.md +73 -8
  4. package/client.d.mts +8 -1
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +8 -1
  7. package/client.d.ts.map +1 -1
  8. package/client.js +3 -0
  9. package/client.js.map +1 -1
  10. package/client.mjs +3 -0
  11. package/client.mjs.map +1 -1
  12. package/internal/to-file.d.mts +1 -1
  13. package/internal/to-file.d.ts +1 -1
  14. package/internal/to-file.js +1 -1
  15. package/internal/to-file.mjs +1 -1
  16. package/lib/crypto-utils.d.mts.map +1 -1
  17. package/lib/crypto-utils.d.ts.map +1 -1
  18. package/lib/crypto-utils.js +6 -5
  19. package/lib/crypto-utils.js.map +1 -1
  20. package/lib/crypto-utils.mjs +4 -5
  21. package/lib/crypto-utils.mjs.map +1 -1
  22. package/lib/transformation-utils.d.mts.map +1 -1
  23. package/lib/transformation-utils.d.ts.map +1 -1
  24. package/lib/transformation-utils.js +3 -0
  25. package/lib/transformation-utils.js.map +1 -1
  26. package/lib/transformation-utils.mjs +3 -0
  27. package/lib/transformation-utils.mjs.map +1 -1
  28. package/package.json +1 -1
  29. package/resources/beta/v2/files.d.mts +1 -0
  30. package/resources/beta/v2/files.d.mts.map +1 -1
  31. package/resources/beta/v2/files.d.ts +1 -0
  32. package/resources/beta/v2/files.d.ts.map +1 -1
  33. package/resources/custom-metadata-fields.d.mts +1 -5
  34. package/resources/custom-metadata-fields.d.mts.map +1 -1
  35. package/resources/custom-metadata-fields.d.ts +1 -5
  36. package/resources/custom-metadata-fields.d.ts.map +1 -1
  37. package/resources/custom-metadata-fields.js +1 -5
  38. package/resources/custom-metadata-fields.js.map +1 -1
  39. package/resources/custom-metadata-fields.mjs +1 -5
  40. package/resources/custom-metadata-fields.mjs.map +1 -1
  41. package/resources/files/files.d.mts +2 -0
  42. package/resources/files/files.d.mts.map +1 -1
  43. package/resources/files/files.d.ts +2 -0
  44. package/resources/files/files.d.ts.map +1 -1
  45. package/resources/files/files.js.map +1 -1
  46. package/resources/files/files.mjs.map +1 -1
  47. package/resources/files/metadata.js +1 -1
  48. package/resources/files/metadata.js.map +1 -1
  49. package/resources/files/metadata.mjs +1 -1
  50. package/resources/files/metadata.mjs.map +1 -1
  51. package/resources/helper.d.mts.map +1 -1
  52. package/resources/helper.d.ts.map +1 -1
  53. package/resources/helper.js +26 -20
  54. package/resources/helper.js.map +1 -1
  55. package/resources/helper.mjs +26 -20
  56. package/resources/helper.mjs.map +1 -1
  57. package/resources/index.d.mts +1 -0
  58. package/resources/index.d.mts.map +1 -1
  59. package/resources/index.d.ts +1 -0
  60. package/resources/index.d.ts.map +1 -1
  61. package/resources/index.js +3 -1
  62. package/resources/index.js.map +1 -1
  63. package/resources/index.mjs +1 -0
  64. package/resources/index.mjs.map +1 -1
  65. package/resources/saved-extensions.d.mts +112 -0
  66. package/resources/saved-extensions.d.mts.map +1 -0
  67. package/resources/saved-extensions.d.ts +112 -0
  68. package/resources/saved-extensions.d.ts.map +1 -0
  69. package/resources/saved-extensions.js +95 -0
  70. package/resources/saved-extensions.js.map +1 -0
  71. package/resources/saved-extensions.mjs +91 -0
  72. package/resources/saved-extensions.mjs.map +1 -0
  73. package/resources/shared.d.mts +703 -23
  74. package/resources/shared.d.mts.map +1 -1
  75. package/resources/shared.d.ts +703 -23
  76. package/resources/shared.d.ts.map +1 -1
  77. package/resources/webhooks.d.mts +1 -0
  78. package/resources/webhooks.d.mts.map +1 -1
  79. package/resources/webhooks.d.ts +1 -0
  80. package/resources/webhooks.d.ts.map +1 -1
  81. package/src/client.ts +20 -1
  82. package/src/internal/to-file.ts +1 -1
  83. package/src/lib/crypto-utils.ts +7 -5
  84. package/src/lib/transformation-utils.ts +3 -0
  85. package/src/resources/beta/v2/files.ts +2 -0
  86. package/src/resources/custom-metadata-fields.ts +1 -5
  87. package/src/resources/files/files.ts +4 -0
  88. package/src/resources/files/metadata.ts +1 -1
  89. package/src/resources/helper.ts +33 -19
  90. package/src/resources/index.ts +6 -0
  91. package/src/resources/saved-extensions.ts +149 -0
  92. package/src/resources/shared.ts +819 -23
  93. package/src/resources/webhooks.ts +2 -0
  94. package/src/version.ts +1 -1
  95. package/version.d.mts +1 -1
  96. package/version.d.ts +1 -1
  97. package/version.js +1 -1
  98. package/version.mjs +1 -1
@@ -1,12 +1,309 @@
1
1
  export interface BaseOverlay {
2
+ /**
3
+ * Controls how the layer blends with the base image or underlying content. Maps to
4
+ * `lm` in the URL. By default, layers completely cover the base image beneath
5
+ * them. Layer modes change this behavior:
6
+ *
7
+ * - `multiply`: Multiplies the pixel values of the layer with the base image. The
8
+ * result is always darker than the original images. This is ideal for applying
9
+ * shadows or color tints.
10
+ * - `displace`: Uses the layer as a displacement map to distort pixels in the base
11
+ * image. The red channel controls horizontal displacement, and the green channel
12
+ * controls vertical displacement. Requires `x` or `y` parameter to control
13
+ * displacement magnitude.
14
+ * - `cutout`: Acts as an inverse mask where opaque areas of the layer turn the
15
+ * base image transparent, while transparent areas leave the base image
16
+ * unchanged. This mode functions like a hole-punch, effectively cutting the
17
+ * shape of the layer out of the underlying image.
18
+ * - `cutter`: Acts as a shape mask where only the parts of the base image that
19
+ * fall inside the opaque area of the layer are preserved. This mode functions
20
+ * like a cookie-cutter, trimming the base image to match the specific dimensions
21
+ * and shape of the layer. See
22
+ * [Layer modes](https://imagekit.io/docs/add-overlays-on-images#layer-modes).
23
+ */
24
+ layerMode?: 'multiply' | 'cutter' | 'cutout' | 'displace';
25
+ /**
26
+ * Specifies the overlay's position relative to the parent asset. See
27
+ * [Position of Layer](https://imagekit.io/docs/transformations#position-of-layer).
28
+ */
2
29
  position?: OverlayPosition;
30
+ /**
31
+ * Specifies timing information for the overlay (only applicable if the base asset
32
+ * is a video). See
33
+ * [Position of Layer](https://imagekit.io/docs/transformations#position-of-layer).
34
+ */
3
35
  timing?: OverlayTiming;
4
36
  }
37
+ /**
38
+ * Configuration object for an extension (base extensions only, not saved extension
39
+ * references).
40
+ */
41
+ export type ExtensionConfig = ExtensionConfig.RemoveBg | ExtensionConfig.AutoTaggingExtension | ExtensionConfig.AIAutoDescription | ExtensionConfig.AITasks;
42
+ export declare namespace ExtensionConfig {
43
+ interface RemoveBg {
44
+ /**
45
+ * Specifies the background removal extension.
46
+ */
47
+ name: 'remove-bg';
48
+ options?: RemoveBg.Options;
49
+ }
50
+ namespace RemoveBg {
51
+ interface Options {
52
+ /**
53
+ * Whether to add an artificial shadow to the result. Default is false. Note:
54
+ * Adding shadows is currently only supported for car photos.
55
+ */
56
+ add_shadow?: boolean;
57
+ /**
58
+ * Specifies a solid color background using hex code (e.g., "81d4fa", "fff") or
59
+ * color name (e.g., "green"). If this parameter is set, `bg_image_url` must be
60
+ * empty.
61
+ */
62
+ bg_color?: string;
63
+ /**
64
+ * Sets a background image from a URL. If this parameter is set, `bg_color` must be
65
+ * empty.
66
+ */
67
+ bg_image_url?: string;
68
+ /**
69
+ * Allows semi-transparent regions in the result. Default is true. Note:
70
+ * Semitransparency is currently only supported for car windows.
71
+ */
72
+ semitransparency?: boolean;
73
+ }
74
+ }
75
+ interface AutoTaggingExtension {
76
+ /**
77
+ * Maximum number of tags to attach to the asset.
78
+ */
79
+ maxTags: number;
80
+ /**
81
+ * Minimum confidence level for tags to be considered valid.
82
+ */
83
+ minConfidence: number;
84
+ /**
85
+ * Specifies the auto-tagging extension used.
86
+ */
87
+ name: 'google-auto-tagging' | 'aws-auto-tagging';
88
+ }
89
+ interface AIAutoDescription {
90
+ /**
91
+ * Specifies the auto description extension.
92
+ */
93
+ name: 'ai-auto-description';
94
+ }
95
+ interface AITasks {
96
+ /**
97
+ * Specifies the AI tasks extension for automated image analysis using AI models.
98
+ */
99
+ name: 'ai-tasks';
100
+ /**
101
+ * Array of task objects defining AI operations to perform on the asset.
102
+ */
103
+ tasks: Array<AITasks.SelectTags | AITasks.SelectMetadata | AITasks.YesNo>;
104
+ }
105
+ namespace AITasks {
106
+ interface SelectTags {
107
+ /**
108
+ * The question or instruction for the AI to analyze the image.
109
+ */
110
+ instruction: string;
111
+ /**
112
+ * Task type that analyzes the image and adds matching tags from a vocabulary.
113
+ */
114
+ type: 'select_tags';
115
+ /**
116
+ * Array of possible tag values. Combined length of all strings must not exceed 500
117
+ * characters. Cannot contain the `%` character.
118
+ */
119
+ vocabulary: Array<string>;
120
+ /**
121
+ * Maximum number of tags to select from the vocabulary.
122
+ */
123
+ max_selections?: number;
124
+ /**
125
+ * Minimum number of tags to select from the vocabulary.
126
+ */
127
+ min_selections?: number;
128
+ }
129
+ interface SelectMetadata {
130
+ /**
131
+ * Name of the custom metadata field to set. The field must exist in your account.
132
+ */
133
+ field: string;
134
+ /**
135
+ * The question or instruction for the AI to analyze the image.
136
+ */
137
+ instruction: string;
138
+ /**
139
+ * Task type that analyzes the image and sets a custom metadata field value from a
140
+ * vocabulary.
141
+ */
142
+ type: 'select_metadata';
143
+ /**
144
+ * Maximum number of values to select from the vocabulary.
145
+ */
146
+ max_selections?: number;
147
+ /**
148
+ * Minimum number of values to select from the vocabulary.
149
+ */
150
+ min_selections?: number;
151
+ /**
152
+ * Array of possible values matching the custom metadata field type.
153
+ */
154
+ vocabulary?: Array<string | number | boolean>;
155
+ }
156
+ interface YesNo {
157
+ /**
158
+ * The yes/no question for the AI to answer about the image.
159
+ */
160
+ instruction: string;
161
+ /**
162
+ * Task type that asks a yes/no question and executes actions based on the answer.
163
+ */
164
+ type: 'yes_no';
165
+ /**
166
+ * Actions to execute if the AI answers no.
167
+ */
168
+ on_no?: YesNo.OnNo;
169
+ /**
170
+ * Actions to execute if the AI cannot determine the answer.
171
+ */
172
+ on_unknown?: YesNo.OnUnknown;
173
+ /**
174
+ * Actions to execute if the AI answers yes.
175
+ */
176
+ on_yes?: YesNo.OnYes;
177
+ }
178
+ namespace YesNo {
179
+ /**
180
+ * Actions to execute if the AI answers no.
181
+ */
182
+ interface OnNo {
183
+ /**
184
+ * Array of tag strings to add to the asset.
185
+ */
186
+ add_tags?: Array<string>;
187
+ /**
188
+ * Array of tag strings to remove from the asset.
189
+ */
190
+ remove_tags?: Array<string>;
191
+ /**
192
+ * Array of custom metadata field updates.
193
+ */
194
+ set_metadata?: Array<OnNo.SetMetadata>;
195
+ /**
196
+ * Array of custom metadata fields to remove.
197
+ */
198
+ unset_metadata?: Array<OnNo.UnsetMetadata>;
199
+ }
200
+ namespace OnNo {
201
+ interface SetMetadata {
202
+ /**
203
+ * Name of the custom metadata field to set.
204
+ */
205
+ field: string;
206
+ /**
207
+ * Value to set for the custom metadata field. The value type should match the
208
+ * custom metadata field type.
209
+ */
210
+ value: string | number | boolean | Array<string | number | boolean>;
211
+ }
212
+ interface UnsetMetadata {
213
+ /**
214
+ * Name of the custom metadata field to remove.
215
+ */
216
+ field: string;
217
+ }
218
+ }
219
+ /**
220
+ * Actions to execute if the AI cannot determine the answer.
221
+ */
222
+ interface OnUnknown {
223
+ /**
224
+ * Array of tag strings to add to the asset.
225
+ */
226
+ add_tags?: Array<string>;
227
+ /**
228
+ * Array of tag strings to remove from the asset.
229
+ */
230
+ remove_tags?: Array<string>;
231
+ /**
232
+ * Array of custom metadata field updates.
233
+ */
234
+ set_metadata?: Array<OnUnknown.SetMetadata>;
235
+ /**
236
+ * Array of custom metadata fields to remove.
237
+ */
238
+ unset_metadata?: Array<OnUnknown.UnsetMetadata>;
239
+ }
240
+ namespace OnUnknown {
241
+ interface SetMetadata {
242
+ /**
243
+ * Name of the custom metadata field to set.
244
+ */
245
+ field: string;
246
+ /**
247
+ * Value to set for the custom metadata field. The value type should match the
248
+ * custom metadata field type.
249
+ */
250
+ value: string | number | boolean | Array<string | number | boolean>;
251
+ }
252
+ interface UnsetMetadata {
253
+ /**
254
+ * Name of the custom metadata field to remove.
255
+ */
256
+ field: string;
257
+ }
258
+ }
259
+ /**
260
+ * Actions to execute if the AI answers yes.
261
+ */
262
+ interface OnYes {
263
+ /**
264
+ * Array of tag strings to add to the asset.
265
+ */
266
+ add_tags?: Array<string>;
267
+ /**
268
+ * Array of tag strings to remove from the asset.
269
+ */
270
+ remove_tags?: Array<string>;
271
+ /**
272
+ * Array of custom metadata field updates.
273
+ */
274
+ set_metadata?: Array<OnYes.SetMetadata>;
275
+ /**
276
+ * Array of custom metadata fields to remove.
277
+ */
278
+ unset_metadata?: Array<OnYes.UnsetMetadata>;
279
+ }
280
+ namespace OnYes {
281
+ interface SetMetadata {
282
+ /**
283
+ * Name of the custom metadata field to set.
284
+ */
285
+ field: string;
286
+ /**
287
+ * Value to set for the custom metadata field. The value type should match the
288
+ * custom metadata field type.
289
+ */
290
+ value: string | number | boolean | Array<string | number | boolean>;
291
+ }
292
+ interface UnsetMetadata {
293
+ /**
294
+ * Name of the custom metadata field to remove.
295
+ */
296
+ field: string;
297
+ }
298
+ }
299
+ }
300
+ }
301
+ }
5
302
  /**
6
303
  * Array of extensions to be applied to the asset. Each extension can be configured
7
304
  * with specific parameters based on the extension type.
8
305
  */
9
- export type Extensions = Array<Extensions.RemoveBg | Extensions.AutoTaggingExtension | Extensions.AIAutoDescription>;
306
+ export type Extensions = Array<Extensions.RemoveBg | Extensions.AutoTaggingExtension | Extensions.AIAutoDescription | Extensions.AITasks | Extensions.SavedExtension>;
10
307
  export declare namespace Extensions {
11
308
  interface RemoveBg {
12
309
  /**
@@ -60,6 +357,266 @@ export declare namespace Extensions {
60
357
  */
61
358
  name: 'ai-auto-description';
62
359
  }
360
+ interface AITasks {
361
+ /**
362
+ * Specifies the AI tasks extension for automated image analysis using AI models.
363
+ */
364
+ name: 'ai-tasks';
365
+ /**
366
+ * Array of task objects defining AI operations to perform on the asset.
367
+ */
368
+ tasks: Array<AITasks.SelectTags | AITasks.SelectMetadata | AITasks.YesNo>;
369
+ }
370
+ namespace AITasks {
371
+ interface SelectTags {
372
+ /**
373
+ * The question or instruction for the AI to analyze the image.
374
+ */
375
+ instruction: string;
376
+ /**
377
+ * Task type that analyzes the image and adds matching tags from a vocabulary.
378
+ */
379
+ type: 'select_tags';
380
+ /**
381
+ * Array of possible tag values. Combined length of all strings must not exceed 500
382
+ * characters. Cannot contain the `%` character.
383
+ */
384
+ vocabulary: Array<string>;
385
+ /**
386
+ * Maximum number of tags to select from the vocabulary.
387
+ */
388
+ max_selections?: number;
389
+ /**
390
+ * Minimum number of tags to select from the vocabulary.
391
+ */
392
+ min_selections?: number;
393
+ }
394
+ interface SelectMetadata {
395
+ /**
396
+ * Name of the custom metadata field to set. The field must exist in your account.
397
+ */
398
+ field: string;
399
+ /**
400
+ * The question or instruction for the AI to analyze the image.
401
+ */
402
+ instruction: string;
403
+ /**
404
+ * Task type that analyzes the image and sets a custom metadata field value from a
405
+ * vocabulary.
406
+ */
407
+ type: 'select_metadata';
408
+ /**
409
+ * Maximum number of values to select from the vocabulary.
410
+ */
411
+ max_selections?: number;
412
+ /**
413
+ * Minimum number of values to select from the vocabulary.
414
+ */
415
+ min_selections?: number;
416
+ /**
417
+ * Array of possible values matching the custom metadata field type.
418
+ */
419
+ vocabulary?: Array<string | number | boolean>;
420
+ }
421
+ interface YesNo {
422
+ /**
423
+ * The yes/no question for the AI to answer about the image.
424
+ */
425
+ instruction: string;
426
+ /**
427
+ * Task type that asks a yes/no question and executes actions based on the answer.
428
+ */
429
+ type: 'yes_no';
430
+ /**
431
+ * Actions to execute if the AI answers no.
432
+ */
433
+ on_no?: YesNo.OnNo;
434
+ /**
435
+ * Actions to execute if the AI cannot determine the answer.
436
+ */
437
+ on_unknown?: YesNo.OnUnknown;
438
+ /**
439
+ * Actions to execute if the AI answers yes.
440
+ */
441
+ on_yes?: YesNo.OnYes;
442
+ }
443
+ namespace YesNo {
444
+ /**
445
+ * Actions to execute if the AI answers no.
446
+ */
447
+ interface OnNo {
448
+ /**
449
+ * Array of tag strings to add to the asset.
450
+ */
451
+ add_tags?: Array<string>;
452
+ /**
453
+ * Array of tag strings to remove from the asset.
454
+ */
455
+ remove_tags?: Array<string>;
456
+ /**
457
+ * Array of custom metadata field updates.
458
+ */
459
+ set_metadata?: Array<OnNo.SetMetadata>;
460
+ /**
461
+ * Array of custom metadata fields to remove.
462
+ */
463
+ unset_metadata?: Array<OnNo.UnsetMetadata>;
464
+ }
465
+ namespace OnNo {
466
+ interface SetMetadata {
467
+ /**
468
+ * Name of the custom metadata field to set.
469
+ */
470
+ field: string;
471
+ /**
472
+ * Value to set for the custom metadata field. The value type should match the
473
+ * custom metadata field type.
474
+ */
475
+ value: string | number | boolean | Array<string | number | boolean>;
476
+ }
477
+ interface UnsetMetadata {
478
+ /**
479
+ * Name of the custom metadata field to remove.
480
+ */
481
+ field: string;
482
+ }
483
+ }
484
+ /**
485
+ * Actions to execute if the AI cannot determine the answer.
486
+ */
487
+ interface OnUnknown {
488
+ /**
489
+ * Array of tag strings to add to the asset.
490
+ */
491
+ add_tags?: Array<string>;
492
+ /**
493
+ * Array of tag strings to remove from the asset.
494
+ */
495
+ remove_tags?: Array<string>;
496
+ /**
497
+ * Array of custom metadata field updates.
498
+ */
499
+ set_metadata?: Array<OnUnknown.SetMetadata>;
500
+ /**
501
+ * Array of custom metadata fields to remove.
502
+ */
503
+ unset_metadata?: Array<OnUnknown.UnsetMetadata>;
504
+ }
505
+ namespace OnUnknown {
506
+ interface SetMetadata {
507
+ /**
508
+ * Name of the custom metadata field to set.
509
+ */
510
+ field: string;
511
+ /**
512
+ * Value to set for the custom metadata field. The value type should match the
513
+ * custom metadata field type.
514
+ */
515
+ value: string | number | boolean | Array<string | number | boolean>;
516
+ }
517
+ interface UnsetMetadata {
518
+ /**
519
+ * Name of the custom metadata field to remove.
520
+ */
521
+ field: string;
522
+ }
523
+ }
524
+ /**
525
+ * Actions to execute if the AI answers yes.
526
+ */
527
+ interface OnYes {
528
+ /**
529
+ * Array of tag strings to add to the asset.
530
+ */
531
+ add_tags?: Array<string>;
532
+ /**
533
+ * Array of tag strings to remove from the asset.
534
+ */
535
+ remove_tags?: Array<string>;
536
+ /**
537
+ * Array of custom metadata field updates.
538
+ */
539
+ set_metadata?: Array<OnYes.SetMetadata>;
540
+ /**
541
+ * Array of custom metadata fields to remove.
542
+ */
543
+ unset_metadata?: Array<OnYes.UnsetMetadata>;
544
+ }
545
+ namespace OnYes {
546
+ interface SetMetadata {
547
+ /**
548
+ * Name of the custom metadata field to set.
549
+ */
550
+ field: string;
551
+ /**
552
+ * Value to set for the custom metadata field. The value type should match the
553
+ * custom metadata field type.
554
+ */
555
+ value: string | number | boolean | Array<string | number | boolean>;
556
+ }
557
+ interface UnsetMetadata {
558
+ /**
559
+ * Name of the custom metadata field to remove.
560
+ */
561
+ field: string;
562
+ }
563
+ }
564
+ }
565
+ }
566
+ interface SavedExtension {
567
+ /**
568
+ * The unique ID of the saved extension to apply.
569
+ */
570
+ id: string;
571
+ /**
572
+ * Indicates this is a reference to a saved extension.
573
+ */
574
+ name: 'saved-extension';
575
+ }
576
+ }
577
+ /**
578
+ * Options for generating responsive image attributes including `src`, `srcSet`,
579
+ * and `sizes` for HTML `<img>` elements. This schema extends `SrcOptions` to add
580
+ * support for responsive image generation with breakpoints.
581
+ */
582
+ export interface GetImageAttributesOptions extends SrcOptions {
583
+ /**
584
+ * Custom list of **device-width breakpoints** in pixels. These define common
585
+ * screen widths for responsive image generation.
586
+ *
587
+ * Defaults to `[640, 750, 828, 1080, 1200, 1920, 2048, 3840]`. Sorted
588
+ * automatically.
589
+ */
590
+ deviceBreakpoints?: Array<number>;
591
+ /**
592
+ * Custom list of **image-specific breakpoints** in pixels. Useful for generating
593
+ * small variants (e.g., placeholders or thumbnails).
594
+ *
595
+ * Merged with `deviceBreakpoints` before calculating `srcSet`. Defaults to
596
+ * `[16, 32, 48, 64, 96, 128, 256, 384]`. Sorted automatically.
597
+ */
598
+ imageBreakpoints?: Array<number>;
599
+ /**
600
+ * The value for the HTML `sizes` attribute (e.g., `"100vw"` or
601
+ * `"(min-width:768px) 50vw, 100vw"`).
602
+ *
603
+ * - If it includes one or more `vw` units, breakpoints smaller than the
604
+ * corresponding percentage of the smallest device width are excluded.
605
+ * - If it contains no `vw` units, the full breakpoint list is used.
606
+ *
607
+ * Enables a width-based strategy and generates `w` descriptors in `srcSet`.
608
+ */
609
+ sizes?: string;
610
+ /**
611
+ * The intended display width of the image in pixels, used **only when the `sizes`
612
+ * attribute is not provided**.
613
+ *
614
+ * Triggers a DPR-based strategy (1x and 2x variants) and generates `x` descriptors
615
+ * in `srcSet`.
616
+ *
617
+ * Ignored if `sizes` is present.
618
+ */
619
+ width?: number;
63
620
  }
64
621
  export interface ImageOverlay extends BaseOverlay {
65
622
  /**
@@ -73,6 +630,12 @@ export interface ImageOverlay extends BaseOverlay {
73
630
  * format automatically. To always use base64 encoding (`ie-{base64}`), set this
74
631
  * parameter to `base64`. To always use plain text (`i-{input}`), set it to
75
632
  * `plain`.
633
+ *
634
+ * Regardless of the encoding method:
635
+ *
636
+ * - Leading and trailing slashes are removed.
637
+ * - Remaining slashes within the path are replaced with `@@` when using plain
638
+ * text.
76
639
  */
77
640
  encoding?: 'auto' | 'plain' | 'base64';
78
641
  /**
@@ -138,6 +701,60 @@ export interface OverlayTiming {
138
701
  */
139
702
  start?: number | string;
140
703
  }
704
+ /**
705
+ * Resulting set of attributes suitable for an HTML `<img>` element. Useful for
706
+ * enabling responsive image loading with `srcSet` and `sizes`.
707
+ */
708
+ export interface ResponsiveImageAttributes {
709
+ /**
710
+ * URL for the _largest_ candidate (assigned to plain `src`).
711
+ */
712
+ src: string;
713
+ /**
714
+ * `sizes` returned (or synthesised as `100vw`). The value for the HTML `sizes`
715
+ * attribute.
716
+ */
717
+ sizes?: string;
718
+ /**
719
+ * Candidate set with `w` or `x` descriptors. Multiple image URLs separated by
720
+ * commas, each with a descriptor.
721
+ */
722
+ srcSet?: string;
723
+ /**
724
+ * Width as a number (if `width` was provided in the input options).
725
+ */
726
+ width?: number;
727
+ }
728
+ /**
729
+ * Saved extension object containing extension configuration.
730
+ */
731
+ export interface SavedExtension {
732
+ /**
733
+ * Unique identifier of the saved extension.
734
+ */
735
+ id?: string;
736
+ /**
737
+ * Configuration object for an extension (base extensions only, not saved extension
738
+ * references).
739
+ */
740
+ config?: ExtensionConfig;
741
+ /**
742
+ * Timestamp when the saved extension was created.
743
+ */
744
+ createdAt?: string;
745
+ /**
746
+ * Description of the saved extension.
747
+ */
748
+ description?: string;
749
+ /**
750
+ * Name of the saved extension.
751
+ */
752
+ name?: string;
753
+ /**
754
+ * Timestamp when the saved extension was last updated.
755
+ */
756
+ updatedAt?: string;
757
+ }
141
758
  export interface SolidColorOverlay extends BaseOverlay {
142
759
  /**
143
760
  * Specifies the color of the block using an RGB hex code (e.g., `FF0000`), an RGBA
@@ -158,8 +775,8 @@ export interface SolidColorOverlay extends BaseOverlay {
158
775
  }
159
776
  export interface SolidColorOverlayTransformation {
160
777
  /**
161
- * Specifies the transparency level of the solid color overlay. Accepts integers
162
- * from `1` to `9`.
778
+ * Specifies the transparency level of the overlaid solid color layer. Supports
779
+ * integers from `1` to `9`.
163
780
  */
164
781
  alpha?: number;
165
782
  /**
@@ -181,11 +798,16 @@ export interface SolidColorOverlayTransformation {
181
798
  */
182
799
  height?: number | string;
183
800
  /**
184
- * Specifies the corner radius of the solid color overlay. Set to `max` for
185
- * circular or oval shape. See
186
- * [radius](https://imagekit.io/docs/effects-and-enhancements#radius---r).
801
+ * Specifies the corner radius of the solid color overlay.
802
+ *
803
+ * - Single value (positive integer): Applied to all corners (e.g., `20`).
804
+ * - `max`: Creates a circular or oval shape.
805
+ * - Per-corner array: Provide four underscore-separated values representing
806
+ * top-left, top-right, bottom-right, and bottom-left corners respectively (e.g.,
807
+ * `10_20_30_40`). See
808
+ * [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r).
187
809
  */
188
- radius?: number | 'max';
810
+ radius?: number | 'max' | string;
189
811
  /**
190
812
  * Controls the width of the solid color overlay. Accepts a numeric value or an
191
813
  * arithmetic expression (e.g., `bw_mul_0.2` or `bh_div_2`). Learn about
@@ -270,6 +892,12 @@ export interface SubtitleOverlay extends BaseOverlay {
270
892
  * format automatically. To always use base64 encoding (`ie-{base64}`), set this
271
893
  * parameter to `base64`. To always use plain text (`i-{input}`), set it to
272
894
  * `plain`.
895
+ *
896
+ * Regardless of the encoding method:
897
+ *
898
+ * - Leading and trailing slashes are removed.
899
+ * - Remaining slashes within the path are replaced with `@@` when using plain
900
+ * text.
273
901
  */
274
902
  encoding?: 'auto' | 'plain' | 'base64';
275
903
  /**
@@ -299,8 +927,9 @@ export interface SubtitleOverlayTransformation {
299
927
  */
300
928
  color?: string;
301
929
  /**
302
- * Font family for subtitles. Refer to the
303
- * [supported fonts](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list).
930
+ * Sets the font family of subtitle text. Refer to the
931
+ * [supported fonts documented](https://imagekit.io/docs/add-overlays-on-images#supported-text-font-list)
932
+ * in the ImageKit transformations guide.
304
933
  */
305
934
  fontFamily?: string;
306
935
  /**
@@ -351,6 +980,9 @@ export interface TextOverlay extends BaseOverlay {
351
980
  * appropriate format based on the input text. To always use base64
352
981
  * (`ie-{base64}`), set this parameter to `base64`. To always use plain text
353
982
  * (`i-{input}`), set it to `plain`.
983
+ *
984
+ * Regardless of the encoding method, the input text is always percent-encoded to
985
+ * ensure it is URL-safe.
354
986
  */
355
987
  encoding?: 'auto' | 'plain' | 'base64';
356
988
  /**
@@ -371,7 +1003,9 @@ export interface TextOverlayTransformation {
371
1003
  */
372
1004
  background?: string;
373
1005
  /**
374
- * Flip the text overlay horizontally, vertically, or both.
1006
+ * Flip/mirror the text horizontally, vertically, or in both directions. Acceptable
1007
+ * values: `h` (horizontal), `v` (vertical), `h_v` (horizontal and vertical), or
1008
+ * `v_h`.
375
1009
  */
376
1010
  flip?: 'h' | 'v' | 'h_v' | 'v_h';
377
1011
  /**
@@ -398,10 +1032,9 @@ export interface TextOverlayTransformation {
398
1032
  */
399
1033
  innerAlignment?: 'left' | 'right' | 'center';
400
1034
  /**
401
- * Specifies the line height of the text overlay. Accepts integer values
402
- * representing line height in points. It can also accept
403
- * [arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations)
404
- * such as `bw_mul_0.2`, or `bh_div_20`.
1035
+ * Specifies the line height for multi-line text overlays. It will come into effect
1036
+ * only if the text wraps over multiple lines. Accepts either an integer value or
1037
+ * an arithmetic expression.
405
1038
  */
406
1039
  lineHeight?: number | string;
407
1040
  /**
@@ -411,10 +1044,16 @@ export interface TextOverlayTransformation {
411
1044
  */
412
1045
  padding?: number | string;
413
1046
  /**
414
- * Specifies the corner radius of the text overlay. Set to `max` to achieve a
415
- * circular or oval shape.
1047
+ * Specifies the corner radius:
1048
+ *
1049
+ * - Single value (positive integer): Applied to all corners (e.g., `20`).
1050
+ * - `max`: Creates a circular or oval shape.
1051
+ * - Per-corner array: Provide four underscore-separated values representing
1052
+ * top-left, top-right, bottom-right, and bottom-left corners respectively (e.g.,
1053
+ * `10_20_30_40`). See
1054
+ * [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r).
416
1055
  */
417
- radius?: number | 'max';
1056
+ radius?: number | 'max' | string;
418
1057
  /**
419
1058
  * Specifies the rotation angle of the text overlay. Accepts a numeric value for
420
1059
  * clockwise rotation or a string prefixed with "N" for counter-clockwise rotation.
@@ -518,6 +1157,12 @@ export interface Transformation {
518
1157
  *
519
1158
  * - A solid color: e.g., `red`, `F3F3F3`, `AAFF0010`. See
520
1159
  * [Solid color background](https://imagekit.io/docs/effects-and-enhancements#solid-color-background).
1160
+ * - Dominant color: `dominant` extracts the dominant color from the image. See
1161
+ * [Dominant color background](https://imagekit.io/docs/effects-and-enhancements#dominant-color-background).
1162
+ * - Gradient: `gradient_dominant` or `gradient_dominant_2` creates a gradient
1163
+ * using the dominant colors. Optionally specify palette size (2 or 4), e.g.,
1164
+ * `gradient_dominant_4`. See
1165
+ * [Gradient background](https://imagekit.io/docs/effects-and-enhancements#gradient-background).
521
1166
  * - A blurred background: e.g., `blurred`, `blurred_25_N15`, etc. See
522
1167
  * [Blurred background](https://imagekit.io/docs/effects-and-enhancements#blurred-background).
523
1168
  * - Expand the image boundaries using generative fill: `genfill`. Not supported
@@ -545,6 +1190,17 @@ export interface Transformation {
545
1190
  * [Color profile](https://imagekit.io/docs/image-optimization#color-profile---cp).
546
1191
  */
547
1192
  colorProfile?: boolean;
1193
+ /**
1194
+ * Replaces colors in the image. Supports three formats:
1195
+ *
1196
+ * - `toColor` - Replace dominant color with the specified color.
1197
+ * - `toColor_tolerance` - Replace dominant color with specified tolerance (0-100).
1198
+ * - `toColor_tolerance_fromColor` - Replace a specific color with another within
1199
+ * tolerance range. Colors can be hex codes (e.g., `FF0022`) or names (e.g.,
1200
+ * `red`, `blue`). See
1201
+ * [Color replacement](https://imagekit.io/docs/effects-and-enhancements#color-replace---cr).
1202
+ */
1203
+ colorReplace?: string;
548
1204
  /**
549
1205
  * Automatically enhances the contrast of an image (contrast stretch). See
550
1206
  * [Contrast Stretch](https://imagekit.io/docs/effects-and-enhancements#contrast-stretch---e-contrast).
@@ -566,10 +1222,23 @@ export interface Transformation {
566
1222
  * [Default image](https://imagekit.io/docs/image-transformation#default-image---di).
567
1223
  */
568
1224
  defaultImage?: string;
1225
+ /**
1226
+ * Distorts the shape of an image. Supports two modes:
1227
+ *
1228
+ * - Perspective distortion: `p-x1_y1_x2_y2_x3_y3_x4_y4` changes the position of
1229
+ * the four corners starting clockwise from top-left.
1230
+ * - Arc distortion: `a-degrees` curves the image upwards (positive values) or
1231
+ * downwards (negative values). See
1232
+ * [Distort effect](https://imagekit.io/docs/effects-and-enhancements#distort---e-distort).
1233
+ */
1234
+ distort?: string;
569
1235
  /**
570
1236
  * Accepts values between 0.1 and 5, or `auto` for automatic device pixel ratio
571
- * (DPR) calculation. See
572
- * [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr).
1237
+ * (DPR) calculation. Also accepts arithmetic expressions.
1238
+ *
1239
+ * - Learn about
1240
+ * [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations).
1241
+ * - See [DPR](https://imagekit.io/docs/image-resize-and-crop#dpr---dpr).
573
1242
  */
574
1243
  dpr?: number;
575
1244
  /**
@@ -690,11 +1359,16 @@ export interface Transformation {
690
1359
  */
691
1360
  quality?: number;
692
1361
  /**
693
- * Specifies the corner radius for rounded corners (e.g., 20) or `max` for circular
694
- * or oval shape. See
695
- * [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r).
1362
+ * Specifies the corner radius for rounded corners.
1363
+ *
1364
+ * - Single value (positive integer): Applied to all corners (e.g., `20`).
1365
+ * - `max`: Creates a circular or oval shape.
1366
+ * - Per-corner array: Provide four underscore-separated values representing
1367
+ * top-left, top-right, bottom-right, and bottom-left corners respectively (e.g.,
1368
+ * `10_20_30_40`). See
1369
+ * [Radius](https://imagekit.io/docs/effects-and-enhancements#radius---r).
696
1370
  */
697
- radius?: number | 'max';
1371
+ radius?: number | 'max' | string;
698
1372
  /**
699
1373
  * Pass any transformation not directly supported by the SDK. This transformation
700
1374
  * string is appended to the URL as provided.
@@ -805,6 +1479,12 @@ export interface VideoOverlay extends BaseOverlay {
805
1479
  * format automatically. To always use base64 encoding (`ie-{base64}`), set this
806
1480
  * parameter to `base64`. To always use plain text (`i-{input}`), set it to
807
1481
  * `plain`.
1482
+ *
1483
+ * Regardless of the encoding method:
1484
+ *
1485
+ * - Leading and trailing slashes are removed.
1486
+ * - Remaining slashes within the path are replaced with `@@` when using plain
1487
+ * text.
808
1488
  */
809
1489
  encoding?: 'auto' | 'plain' | 'base64';
810
1490
  /**