@imagekit/javascript 5.0.0-beta.7 → 5.0.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.
package/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  # ImageKit.io JavaScript SDK
4
4
 
5
- ![gzip size](https://img.badgesize.io/https://unpkg.com/@imagekit/javascript/dist/imagekit.min.js?compression=gzip&label=gzip)
6
- ![brotli size](https://img.badgesize.io/https://unpkg.com/@imagekit/javascript/dist/imagekit.min.js?compression=brotli&label=brotli)
7
5
  ![Node CI](https://github.com/imagekit-developer/imagekit-javascript/workflows/Node%20CI/badge.svg)
8
6
  [![npm version](https://img.shields.io/npm/v/@imagekit/javascript)](https://www.npmjs.com/package/@imagekit/javascript)
9
7
  [![codecov](https://codecov.io/gh/imagekit-developer/imagekit-javascript/branch/master/graph/badge.svg)](https://codecov.io/gh/imagekit-developer/imagekit-javascript)
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { SrcOptions, Transformation, UploadOptions, UploadResponse } from "./interfaces";
1
+ import type { SrcOptions, Transformation, UploadOptions, UploadResponse } from "./interfaces";
2
2
  import { ImageKitAbortError, ImageKitInvalidRequestError, ImageKitServerError, ImageKitUploadNetworkError, upload } from "./upload";
3
3
  import { buildSrc, buildTransformationString } from "./url";
4
4
  export { buildSrc, buildTransformationString, upload, ImageKitInvalidRequestError, ImageKitAbortError, ImageKitServerError, ImageKitUploadNetworkError };
@@ -16,6 +16,8 @@ interface Transformation {
16
16
  /**
17
17
  * Specifies pre-transformations to be applied. Must be a valid string of transformations like "w-300,h-300".
18
18
  * Refer to the docs for more details on transformations.
19
+ *
20
+ * {@link https://imagekit.io/docs/dam/pre-and-post-transformation-on-upload#pre-transformation}
19
21
  */
20
22
  pre?: string;
21
23
  /**
@@ -25,6 +27,8 @@ interface Transformation {
25
27
  * - protocol: Used only when type is "abs". Can be "hls" or "dash".
26
28
  *
27
29
  * Refer to the docs for more details on transformations and usage in post.
30
+ *
31
+ * {@link https://imagekit.io/docs/dam/pre-and-post-transformation-on-upload#post-transformation}
28
32
  */
29
33
  post?: PostTransformation[];
30
34
  }
package/dist/upload.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ResponseMetadata, UploadOptions, UploadResponse } from "./interfaces";
1
+ import type { ResponseMetadata, UploadOptions, UploadResponse } from "./interfaces";
2
2
  /**
3
3
  * Represents an error when a request to ImageKit is invalid.
4
4
  */
package/dist/url.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { SrcOptions } from "./interfaces";
2
- import { Transformation } from "./interfaces/Transformation";
1
+ import type { SrcOptions } from "./interfaces";
2
+ import type { Transformation } from "./interfaces/Transformation";
3
3
  /**
4
4
  * Builds a source URL with the given options.
5
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imagekit/javascript",
3
- "version": "5.0.0-beta.7",
3
+ "version": "5.0.0",
4
4
  "description": "ImageKit Javascript SDK",
5
5
  "main": "dist/imagekit.cjs.js",
6
6
  "module": "dist/imagekit.esm.js",
@@ -8,8 +8,7 @@
8
8
  "unpkg": "dist/imagekit.min.js",
9
9
  "types": "dist/index.d.ts",
10
10
  "files": [
11
- "dist",
12
- "src"
11
+ "dist"
13
12
  ],
14
13
  "devDependencies": {
15
14
  "@babel/cli": "^7.10.5",
@@ -1,14 +0,0 @@
1
- export default {
2
- MISSING_UPLOAD_FILE_PARAMETER: { message: "Missing file parameter for upload" },
3
- MISSING_UPLOAD_FILENAME_PARAMETER: { message: "Missing fileName parameter for upload" },
4
- MISSING_PUBLIC_KEY: { message: "Missing public key for upload" },
5
- UPLOAD_ENDPOINT_NETWORK_ERROR: {
6
- message: "Request to ImageKit upload endpoint failed due to network error"
7
- },
8
- MISSING_SIGNATURE: { message: "Missing signature for upload. The SDK expects token, signature and expire for authentication." },
9
- MISSING_TOKEN: { message: "Missing token for upload. The SDK expects token, signature and expire for authentication." },
10
- MISSING_EXPIRE: { message: "Missing expire for upload. The SDK expects token, signature and expire for authentication." },
11
- INVALID_TRANSFORMATION: { message: "Invalid transformation parameter. Please include at least pre, post, or both." },
12
- INVALID_PRE_TRANSFORMATION: { message: "Invalid pre transformation parameter." },
13
- INVALID_POST_TRANSFORMATION: { message: "Invalid post transformation parameter." }
14
- };
@@ -1,80 +0,0 @@
1
- /**
2
- * {@link https://imagekit.io/docs/transformations}
3
- */
4
- export const supportedTransforms: { [key: string]: string } = {
5
- // Basic sizing & layout
6
- width: "w",
7
- height: "h",
8
- aspectRatio: "ar",
9
- background: "bg",
10
- border: "b",
11
- crop: "c",
12
- cropMode: "cm",
13
- dpr: "dpr",
14
- focus: "fo",
15
- quality: "q",
16
- x: "x",
17
- xCenter: "xc",
18
- y: "y",
19
- yCenter: "yc",
20
- format: "f",
21
- videoCodec: "vc",
22
- audioCodec: "ac",
23
- radius: "r",
24
- rotation: "rt",
25
- blur: "bl",
26
- named: "n",
27
- defaultImage: "di",
28
- flip: "fl",
29
- original: "orig",
30
- startOffset: "so",
31
- endOffset: "eo",
32
- duration: "du",
33
- streamingResolutions: "sr",
34
-
35
- // AI & advanced effects
36
- grayscale: "e-grayscale",
37
- aiUpscale: "e-upscale",
38
- aiRetouch: "e-retouch",
39
- aiVariation: "e-genvar",
40
- aiDropShadow: "e-dropshadow",
41
- aiChangeBackground: "e-changebg",
42
- aiRemoveBackground: "e-bgremove",
43
- aiRemoveBackgroundExternal: "e-removedotbg",
44
- contrastStretch: "e-contrast",
45
- shadow: "e-shadow",
46
- sharpen: "e-sharpen",
47
- unsharpMask: "e-usm",
48
- gradient: "e-gradient",
49
-
50
- // Other flags & finishing
51
- progressive: "pr",
52
- lossless: "lo",
53
- colorProfile: "cp",
54
- metadata: "md",
55
- opacity: "o",
56
- trim: "t",
57
- zoom: "z",
58
- page: "pg",
59
-
60
- // Text overlay transformations which are not defined yet
61
- fontSize: "fs",
62
- fontFamily: "ff",
63
- fontColor: "co",
64
- innerAlignment: "ia",
65
- padding: "pa",
66
- alpha: "al",
67
- typography: "tg",
68
- lineHeight: "lh",
69
-
70
- // Subtitles transformations which are not defined
71
- fontOutline: "fol",
72
- fontShadow: "fsh",
73
-
74
- // Raw pass-through
75
- raw: "raw",
76
- };
77
-
78
-
79
-
80
- export default supportedTransforms
package/src/index.ts DELETED
@@ -1,13 +0,0 @@
1
- import { SrcOptions, Transformation, UploadOptions, UploadResponse } from "./interfaces";
2
- import { ImageKitAbortError, ImageKitInvalidRequestError, ImageKitServerError, ImageKitUploadNetworkError, upload } from "./upload";
3
- import { buildSrc, buildTransformationString } from "./url";
4
-
5
- export { buildSrc, buildTransformationString, upload, ImageKitInvalidRequestError, ImageKitAbortError, ImageKitServerError, ImageKitUploadNetworkError };
6
- export type {
7
- Transformation,
8
- SrcOptions,
9
- UploadOptions,
10
- UploadResponse
11
- };
12
-
13
-
@@ -1,35 +0,0 @@
1
- import { Transformation } from "./Transformation";
2
- import { TransformationPosition } from ".";
3
-
4
- export interface SrcOptions {
5
- /**
6
- * Accepts a relative or absolute path of the resource. If a relative path is provided, it is appended to the `urlEndpoint`.
7
- * If an absolute path is provided, `urlEndpoint` is ignored.
8
- */
9
- src: string;
10
-
11
- /**
12
- * Get your urlEndpoint from the [ImageKit dashboard](https://imagekit.io/dashboard/url-endpoints).
13
- */
14
- urlEndpoint: string;
15
-
16
- /**
17
- * An array of objects specifying the transformations to be applied in the URL. If more than one transformation is specified, they are applied in the order they are specified as chained transformations.
18
- *
19
- * {@link https://imagekit.io/docs/transformations#chained-transformations}
20
- */
21
- transformation?: Array<Transformation>;
22
-
23
- /**
24
- * These are additional query parameters that you want to add to the final URL.
25
- * They can be any query parameters and not necessarily related to ImageKit.
26
- * This is especially useful if you want to add a versioning parameter to your URLs.
27
- */
28
- queryParameters?: { [key: string]: string | number };
29
-
30
- /**
31
- * By default, the transformation string is added as a query parameter in the URL, e.g., `?tr=w-100,h-100`.
32
- * If you want to add the transformation string in the path of the URL, set this to `path`.
33
- */
34
- transformationPosition?: TransformationPosition;
35
- }