diff --git a/README.md b/README.md index 937b53d..16d982d 100644 --- a/README.md +++ b/README.md @@ -638,6 +638,7 @@ The SDK provides the `IKUpload` component to upload files to the [ImageKit Media | urlEndpoint | String | Optional. If not specified, the URL-endpoint specified in the parent `IKContext` component is used. For example, https://ik.imagekit.io/your_imagekit_id/endpoint/ | | publicKey | String | Optional. If not specified, the `publicKey` specified in the parent `IKContext` component is used.| | authenticator | ()=>Promise<{signature:string,token:string,expiry:number}> | Optional. If not specified, the `authenticator` specified in the parent `IKContext` component is used. | +| checks | String | Optional. Run server-side checks before uploading files. For example, `"'file.size' < '1mb'"` will check if the file size is less than 1 MB. Check [Upload API docs](https://imagekit.io/docs/api-reference/upload-file/upload-file#upload-api-checks) to learn more. Notice the quotes around `file.size` and `1mb`; otherwise, you will get an error `Your request contains invalid syntax for the checks parameter.` | > Make sure that you have specified authenticator and publicKey in IKUpload or in the parent IKContext component as a prop. The authenticator expects an asynchronous function that resolves with an object containing the necessary security parameters i.e signature, token, and expire. @@ -662,6 +663,7 @@ Sample file upload: } ] }" + checks= "'file.size' < '1mb'" /> @@ -721,6 +723,7 @@ Example Usage } ] }" + checks= "'file.size' < '1mb'" /> diff --git a/package-lock.json b/package-lock.json index 8ba2e47..52636d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,17 @@ { "name": "imagekitio-vue", - "version": "3.0.0", + "version": "3.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "imagekitio-vue", - "version": "3.0.0", + "version": "3.1.0", "license": "MIT", "dependencies": { "babel-eslint": "^10.1.0", "cypress-file-upload": "^5.0.8", - "imagekit-javascript": "^3.0.0" + "imagekit-javascript": "^3.0.2" }, "devDependencies": { "@babel/core": "^7.12.16", @@ -9333,9 +9333,9 @@ } }, "node_modules/imagekit-javascript": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/imagekit-javascript/-/imagekit-javascript-3.0.0.tgz", - "integrity": "sha512-39Q54v1fwRlCYnVyalfRi9UFuUq4t+vnktWUzqjBHRguOB+wLNnAEuPbNbm0NUBJAUw5He4C1k/0vbNLOvU/4g==" + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/imagekit-javascript/-/imagekit-javascript-3.0.2.tgz", + "integrity": "sha512-lTlLBrb+96eDy20zz3AIZtSs4nhozoa+kRcz3Yhl/TLAvciMmKXQe2kFOWM/j8KurvG5jLeDuMI6sCp+w7y2IA==" }, "node_modules/import-fresh": { "version": "3.3.0", diff --git a/package.json b/package.json index 6ba48f7..c89abc6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "imagekitio-vue", - "version": "3.0.1", + "version": "3.1.0", "scripts": { "build:lib": "./node_modules/.bin/vue-cli-service build --target lib src/index.js", "build": "./node_modules/.bin/vue-cli-service lint --fix; npm run build:lib", @@ -21,7 +21,7 @@ "dependencies": { "babel-eslint": "^10.1.0", "cypress-file-upload": "^5.0.8", - "imagekit-javascript": "^3.0.0" + "imagekit-javascript": "^3.0.2" }, "devDependencies": { "@babel/core": "^7.12.16", diff --git a/src/components/IKUpload.vue b/src/components/IKUpload.vue index 71d8d05..633c5f0 100644 --- a/src/components/IKUpload.vue +++ b/src/components/IKUpload.vue @@ -35,6 +35,7 @@ export default { onUploadStart: { type: Function, required: false }, onUploadProgress: { type: Function, required: false }, transformation: { type: Object, required: false }, + checks: { type: String, required: false }, }, setup(props) { const xhrRef = ref(null); @@ -159,7 +160,8 @@ export default { token, expire, xhr, - transformation: props.transformation + transformation: props.transformation, + checks: props.checks }, (err, result) => { if (err && typeof props.onError === "function") {