@imagekit/nodejs 7.3.0 → 7.4.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 (66) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/client.d.mts +2 -1
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -1
  5. package/client.d.ts.map +1 -1
  6. package/client.js +23 -19
  7. package/client.js.map +1 -1
  8. package/client.mjs +23 -19
  9. package/client.mjs.map +1 -1
  10. package/internal/parse.d.mts.map +1 -1
  11. package/internal/parse.d.ts.map +1 -1
  12. package/internal/parse.js +5 -0
  13. package/internal/parse.js.map +1 -1
  14. package/internal/parse.mjs +5 -0
  15. package/internal/parse.mjs.map +1 -1
  16. package/internal/utils/query.d.mts +5 -0
  17. package/internal/utils/query.d.mts.map +1 -0
  18. package/internal/utils/query.d.ts +5 -0
  19. package/internal/utils/query.d.ts.map +1 -0
  20. package/internal/utils/query.js +23 -0
  21. package/internal/utils/query.js.map +1 -0
  22. package/internal/utils/query.mjs +20 -0
  23. package/internal/utils/query.mjs.map +1 -0
  24. package/internal/utils.d.mts +1 -0
  25. package/internal/utils.d.ts +1 -0
  26. package/internal/utils.js +1 -0
  27. package/internal/utils.js.map +1 -1
  28. package/internal/utils.mjs +1 -0
  29. package/package.json +12 -1
  30. package/resources/beta/v2/files.d.mts +5 -4
  31. package/resources/beta/v2/files.d.mts.map +1 -1
  32. package/resources/beta/v2/files.d.ts +5 -4
  33. package/resources/beta/v2/files.d.ts.map +1 -1
  34. package/resources/beta/v2/files.js +5 -4
  35. package/resources/beta/v2/files.js.map +1 -1
  36. package/resources/beta/v2/files.mjs +5 -4
  37. package/resources/beta/v2/files.mjs.map +1 -1
  38. package/resources/files/files.d.mts +5 -4
  39. package/resources/files/files.d.mts.map +1 -1
  40. package/resources/files/files.d.ts +5 -4
  41. package/resources/files/files.d.ts.map +1 -1
  42. package/resources/files/files.js +5 -4
  43. package/resources/files/files.js.map +1 -1
  44. package/resources/files/files.mjs +5 -4
  45. package/resources/files/files.mjs.map +1 -1
  46. package/resources/helper.js +10 -1
  47. package/resources/helper.js.map +1 -1
  48. package/resources/helper.mjs +10 -1
  49. package/resources/helper.mjs.map +1 -1
  50. package/resources/shared.d.mts +41 -8
  51. package/resources/shared.d.mts.map +1 -1
  52. package/resources/shared.d.ts +41 -8
  53. package/resources/shared.d.ts.map +1 -1
  54. package/src/client.ts +28 -24
  55. package/src/internal/parse.ts +6 -0
  56. package/src/internal/utils/query.ts +23 -0
  57. package/src/internal/utils.ts +1 -0
  58. package/src/resources/beta/v2/files.ts +5 -4
  59. package/src/resources/files/files.ts +5 -4
  60. package/src/resources/helper.ts +10 -1
  61. package/src/resources/shared.ts +53 -8
  62. package/src/version.ts +1 -1
  63. package/version.d.mts +1 -1
  64. package/version.d.ts +1 -1
  65. package/version.js +1 -1
  66. package/version.mjs +1 -1
@@ -0,0 +1,23 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { ImageKitError } from '../../core/error';
4
+
5
+ /**
6
+ * Basic re-implementation of `qs.stringify` for primitive types.
7
+ */
8
+ export function stringifyQuery(query: object | Record<string, unknown>) {
9
+ return Object.entries(query)
10
+ .filter(([_, value]) => typeof value !== 'undefined')
11
+ .map(([key, value]) => {
12
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
13
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
14
+ }
15
+ if (value === null) {
16
+ return `${encodeURIComponent(key)}=`;
17
+ }
18
+ throw new ImageKitError(
19
+ `Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
20
+ );
21
+ })
22
+ .join('&');
23
+ }
@@ -6,3 +6,4 @@ export * from './utils/env';
6
6
  export * from './utils/log';
7
7
  export * from './utils/uuid';
8
8
  export * from './utils/sleep';
9
+ export * from './utils/query';
@@ -22,10 +22,11 @@ export class Files extends APIResource {
22
22
  * about how to implement secure client-side file upload.
23
23
  *
24
24
  * **File size limit** \
25
- * On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw
26
- * files, and 100MB for videos. On the paid plan, these limits increase to 40MB for
27
- * images, audio, and raw files, and 2GB for videos. These limits can be further increased
28
- * with higher-tier plans.
25
+ * On the free plan, the maximum upload file sizes are 25MB for images, audio, and raw
26
+ * files, and 100MB for videos. On the Lite paid plan, these limits increase to 40MB
27
+ * for images, audio, and raw files and 300MB for videos, whereas on the Pro paid plan,
28
+ * these limits increase to 50MB for images, audio, and raw files and 2GB for videos.
29
+ * These limits can be further increased with enterprise plans.
29
30
  *
30
31
  * **Version limit** \
31
32
  * A file can have a maximum of 100 versions.
@@ -152,10 +152,11 @@ export class Files extends APIResource {
152
152
  * by verifying the entire payload using JWT.
153
153
  *
154
154
  * **File size limit** \
155
- * On the free plan, the maximum upload file sizes are 20MB for images, audio, and raw
156
- * files and 100MB for videos. On the paid plan, these limits increase to 40MB for images,
157
- * audio, and raw files and 2GB for videos. These limits can be further increased with
158
- * higher-tier plans.
155
+ * On the free plan, the maximum upload file sizes are 25MB for images, audio, and raw
156
+ * files and 100MB for videos. On the Lite paid plan, these limits increase to 40MB
157
+ * for images, audio, and raw files and 300MB for videos, whereas on the Pro paid plan,
158
+ * these limits increase to 50MB for images, audio, and raw files and 2GB for videos.
159
+ * These limits can be further increased with enterprise plans.
159
160
  *
160
161
  * **Version limit** \
161
162
  * A file can have a maximum of 100 versions.
@@ -314,16 +314,25 @@ function processOverlay(overlay: Transformation['overlay']): string | undefined
314
314
  entries.push(`lm-${overlay.layerMode}`);
315
315
  }
316
316
 
317
- const { x, y, focus } = position;
317
+ const { x, y, xCenter, yCenter, focus, anchorPoint } = position;
318
318
  if (x) {
319
319
  entries.push(`lx-${x}`);
320
320
  }
321
321
  if (y) {
322
322
  entries.push(`ly-${y}`);
323
323
  }
324
+ if (xCenter) {
325
+ entries.push(`lxc-${xCenter}`);
326
+ }
327
+ if (yCenter) {
328
+ entries.push(`lyc-${yCenter}`);
329
+ }
324
330
  if (focus) {
325
331
  entries.push(`lfo-${focus}`);
326
332
  }
333
+ if (anchorPoint) {
334
+ entries.push(`lap-${anchorPoint}`);
335
+ }
327
336
 
328
337
  const { start, end, duration } = timing;
329
338
  if (start) {
@@ -147,8 +147,10 @@ export namespace ExtensionConfig {
147
147
  min_selections?: number;
148
148
 
149
149
  /**
150
- * Array of possible tag values. Combined length of all strings must not exceed 500
151
- * characters. Cannot contain the `%` character.
150
+ * Array of possible tag values. The combined length of all strings must not exceed
151
+ * 500 characters, and values cannot include the `%` character. When providing
152
+ * large vocabularies (more than 30 items), the AI may not follow the list
153
+ * strictly.
152
154
  */
153
155
  vocabulary?: Array<string>;
154
156
  }
@@ -181,7 +183,10 @@ export namespace ExtensionConfig {
181
183
  min_selections?: number;
182
184
 
183
185
  /**
184
- * Array of possible values matching the custom metadata field type.
186
+ * An array of possible values matching the custom metadata field type. If not
187
+ * provided for SingleSelect or MultiSelect field types, all values from the custom
188
+ * metadata field definition will be used. When providing large vocabularies (above
189
+ * 30 items), the AI may not strictly adhere to the list.
185
190
  */
186
191
  vocabulary?: Array<string | number | boolean>;
187
192
  }
@@ -468,8 +473,10 @@ export namespace Extensions {
468
473
  min_selections?: number;
469
474
 
470
475
  /**
471
- * Array of possible tag values. Combined length of all strings must not exceed 500
472
- * characters. Cannot contain the `%` character.
476
+ * Array of possible tag values. The combined length of all strings must not exceed
477
+ * 500 characters, and values cannot include the `%` character. When providing
478
+ * large vocabularies (more than 30 items), the AI may not follow the list
479
+ * strictly.
473
480
  */
474
481
  vocabulary?: Array<string>;
475
482
  }
@@ -502,7 +509,10 @@ export namespace Extensions {
502
509
  min_selections?: number;
503
510
 
504
511
  /**
505
- * Array of possible values matching the custom metadata field type.
512
+ * An array of possible values matching the custom metadata field type. If not
513
+ * provided for SingleSelect or MultiSelect field types, all values from the custom
514
+ * metadata field definition will be used. When providing large vocabularies (above
515
+ * 30 items), the AI may not strictly adhere to the list.
506
516
  */
507
517
  vocabulary?: Array<string | number | boolean>;
508
518
  }
@@ -782,8 +792,25 @@ export type Overlay = TextOverlay | ImageOverlay | VideoOverlay | SubtitleOverla
782
792
 
783
793
  export interface OverlayPosition {
784
794
  /**
785
- * Specifies the position of the overlay relative to the parent image or video.
786
- * Maps to `lfo` in the URL.
795
+ * Sets the anchor point on the base asset from which the overlay offset is
796
+ * calculated. The default value is `top_left`. Maps to `lap` in the URL. Can only
797
+ * be used with one or more of `x`, `y`, `xCenter`, or `yCenter`.
798
+ */
799
+ anchorPoint?:
800
+ | 'top'
801
+ | 'left'
802
+ | 'right'
803
+ | 'bottom'
804
+ | 'top_left'
805
+ | 'top_right'
806
+ | 'bottom_left'
807
+ | 'bottom_right'
808
+ | 'center';
809
+
810
+ /**
811
+ * Specifies the position of the overlay relative to the parent image or video. If
812
+ * one or more of `x`, `y`, `xCenter`, or `yCenter` parameters are specified, this
813
+ * parameter is ignored. Maps to `lfo` in the URL.
787
814
  */
788
815
  focus?:
789
816
  | 'center'
@@ -805,6 +832,15 @@ export interface OverlayPosition {
805
832
  */
806
833
  x?: number | string;
807
834
 
835
+ /**
836
+ * Specifies the x-coordinate on the base asset where the overlay's center will be
837
+ * positioned. It also accepts arithmetic expressions such as `bw_mul_0.4` or
838
+ * `bw_sub_cw`. Maps to `lxc` in the URL. Cannot be used together with `x`, but can
839
+ * be used with `y`. Learn about
840
+ * [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations).
841
+ */
842
+ xCenter?: number | string;
843
+
808
844
  /**
809
845
  * Specifies the y-coordinate of the top-left corner of the base asset where the
810
846
  * overlay's top-left corner will be positioned. It also accepts arithmetic
@@ -813,6 +849,15 @@ export interface OverlayPosition {
813
849
  * [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations).
814
850
  */
815
851
  y?: number | string;
852
+
853
+ /**
854
+ * Specifies the y-coordinate on the base asset where the overlay's center will be
855
+ * positioned. It also accepts arithmetic expressions such as `bh_mul_0.4` or
856
+ * `bh_sub_ch`. Maps to `lyc` in the URL. Cannot be used together with `y`, but can
857
+ * be used with `x`. Learn about
858
+ * [Arithmetic expressions](https://imagekit.io/docs/arithmetic-expressions-in-transformations).
859
+ */
860
+ yCenter?: number | string;
816
861
  }
817
862
 
818
863
  export interface OverlayTiming {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '7.3.0'; // x-release-please-version
1
+ export const VERSION = '7.4.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "7.3.0";
1
+ export declare const VERSION = "7.4.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "7.3.0";
1
+ export declare const VERSION = "7.4.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '7.3.0'; // x-release-please-version
4
+ exports.VERSION = '7.4.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '7.3.0'; // x-release-please-version
1
+ export const VERSION = '7.4.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map