@ckeditor/ckeditor-cloud-services-core
Advanced tools
Comparing version 3.0.1 to 4.0.0
{ | ||
"name": "@ckeditor/ckeditor-cloud-services-core", | ||
"version": "3.0.1", | ||
"version": "4.0.0", | ||
"description": "CKEditor Cloud Services Core API", | ||
@@ -18,3 +18,3 @@ "license": "GPL-2.0-or-later", | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-utils": "^12.0.0" | ||
"@ckeditor/ckeditor5-utils": "^13.0.0" | ||
}, | ||
@@ -21,0 +21,0 @@ "devDependencies": { |
@@ -12,2 +12,3 @@ /** | ||
import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin'; | ||
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; | ||
@@ -36,3 +37,11 @@ const DEFAULT_OPTIONS = { refreshInterval: 3600000, autoRefresh: true }; | ||
if ( !tokenUrlOrRefreshToken ) { | ||
throw new Error( 'A `tokenUrl` must be provided as the first constructor argument.' ); | ||
/** | ||
* A `tokenUrl` must be provided as the first constructor argument. | ||
* | ||
* @error token-missing-token-url | ||
*/ | ||
throw new CKEditorError( | ||
'token-missing-token-url: A `tokenUrl` must be provided as the first constructor argument.', | ||
this | ||
); | ||
} | ||
@@ -174,3 +183,8 @@ | ||
if ( statusCode < 200 || statusCode > 299 ) { | ||
return reject( new Error( 'Cannot download new token!' ) ); | ||
/** | ||
* Cannot download new token from the provided url. | ||
* | ||
* @error token-cannot-download-new-token | ||
*/ | ||
return reject( new CKEditorError( 'token-cannot-download-new-token: Cannot download new token from the provided url.', null ) ); | ||
} | ||
@@ -177,0 +191,0 @@ |
@@ -12,2 +12,3 @@ /** | ||
import EmitterMixin from '@ckeditor/ckeditor5-utils/src/emittermixin'; | ||
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; | ||
@@ -19,3 +20,3 @@ const BASE64_HEADER_REG_EXP = /^data:(\S*?);base64,/; | ||
*/ | ||
class FileUploader { | ||
export default class FileUploader { | ||
/** | ||
@@ -30,11 +31,26 @@ * Creates `FileUploader` instance. | ||
if ( !fileOrData ) { | ||
throw new Error( 'File must be provided' ); | ||
/** | ||
* File must be provided as the first argument. | ||
* | ||
* @error fileuploader-missing-file | ||
*/ | ||
throw new CKEditorError( 'fileuploader-missing-file: File must be provided as the first argument', null ); | ||
} | ||
if ( !token ) { | ||
throw new Error( 'Token must be provided' ); | ||
/** | ||
* Token must be provided as the second argument. | ||
* | ||
* @error fileuploader-missing-token | ||
*/ | ||
throw new CKEditorError( 'fileuploader-missing-token: Token must be provided as the second argument.', null ); | ||
} | ||
if ( !apiAddress ) { | ||
throw new Error( 'Api address must be provided' ); | ||
/** | ||
* Api address must be provided as the third argument. | ||
* | ||
* @error fileuploader-missing-api-address | ||
*/ | ||
throw new CKEditorError( 'fileuploader-missing-api-address: Api address must be provided as the third argument.', null ); | ||
} | ||
@@ -183,3 +199,12 @@ | ||
if ( xhrResponse.message ) { | ||
return reject( new Error( xhrResponse.message ) ); | ||
/** | ||
* Uploading file failed. | ||
* | ||
* @error fileuploader-uploading-data-failed | ||
*/ | ||
return reject( new CKEditorError( | ||
'fileuploader-uploading-data-failed: Uploading file failed.', | ||
this, | ||
{ message: xhrResponse.message } | ||
) ); | ||
} | ||
@@ -245,3 +270,8 @@ | ||
} catch ( error ) { | ||
throw new Error( 'Problem with decoding Base64 image data.' ); | ||
/** | ||
* Problem with decoding Base64 image data. | ||
* | ||
* @error fileuploader-decoding-image-data-error | ||
*/ | ||
throw new CKEditorError( 'fileuploader-decoding-image-data-error: Problem with decoding Base64 image data.', null ); | ||
} | ||
@@ -265,3 +295,1 @@ } | ||
} | ||
export default FileUploader; |
@@ -9,2 +9,3 @@ /** | ||
import FileUploader from './fileuploader'; | ||
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror'; | ||
@@ -23,7 +24,17 @@ /** | ||
if ( !token ) { | ||
throw new Error( 'Token must be provided' ); | ||
/** | ||
* Token must be provided. | ||
* | ||
* @error uploadgateway-missing-token | ||
*/ | ||
throw new CKEditorError( 'uploadgateway-missing-token: Token must be provided.', null ); | ||
} | ||
if ( !apiAddress ) { | ||
throw new Error( 'Api address must be provided' ); | ||
/** | ||
* Api address must be provided. | ||
* | ||
* @error uploadgateway-missing-api-address | ||
*/ | ||
throw new CKEditorError( 'uploadgateway-missing-api-address: Api address must be provided.', null ); | ||
} | ||
@@ -30,0 +41,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16964
492
+ Added@ckeditor/ckeditor5-utils@13.0.1(transitive)
- Removed@ckeditor/ckeditor5-utils@12.1.1(transitive)