Socket
Socket
Sign inDemoInstall

@ckeditor/ckeditor5-cloud-services

Package Overview
Dependencies
Maintainers
1
Versions
638
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-cloud-services - npm Package Compare versions

Comparing version 23.1.0 to 24.0.0

9

package.json
{
"name": "@ckeditor/ckeditor5-cloud-services",
"version": "23.1.0",
"version": "24.0.0",
"description": "CKEditor 5's Cloud Services integration layer.",

@@ -12,7 +12,8 @@ "keywords": [

"dependencies": {
"@ckeditor/ckeditor-cloud-services-core": "^23.1.0",
"@ckeditor/ckeditor5-core": "^23.1.0"
"@ckeditor/ckeditor-cloud-services-core": "^24.0.0",
"@ckeditor/ckeditor5-core": "^24.0.0",
"@ckeditor/ckeditor5-utils": "^24.0.0"
},
"devDependencies": {
"@ckeditor/ckeditor5-editor-classic": "^23.1.0"
"@ckeditor/ckeditor5-editor-classic": "^24.0.0"
},

@@ -19,0 +20,0 @@ "engines": {

@@ -12,2 +12,3 @@ /**

import Token from '@ckeditor/ckeditor-cloud-services-core/src/token/token';
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';

@@ -43,2 +44,10 @@ /**

/**
* Map of `Token` object instances keyed by `tokenUrl`s.
*
* @private
* @type {Map.<String, module:cloud-services-core/token~Token>}
*/
this._tokens = new Map();
/**
* The authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the

@@ -63,3 +72,3 @@ * {@link module:cloud-services/cloudservices~CloudServicesConfig#tokenUrl} for more details.

* @readonly
* @member {Object|null} #token
* @member {module:cloud-services-core/token~Token|null} #token
*/

@@ -75,2 +84,4 @@

this._tokens.set( this.tokenUrl, this.token );
return this.token.init();

@@ -80,2 +91,43 @@ }

/**
* Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
* {@link module:cloud-services/cloudservices~CloudServicesConfig#tokenUrl} for more details.
*
* @param {String|Function} tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
* @returns {Promise.<module:cloud-services-core/token~Token>}
*/
registerTokenUrl( tokenUrl ) {
// Reuse Token instance in case of multiple features using the same tokenUrl.
if ( this._tokens.has( tokenUrl ) ) {
return Promise.resolve( this.getTokenFor( tokenUrl ) );
}
const token = new CloudServices.Token( tokenUrl );
this._tokens.set( tokenUrl, token );
return token.init();
}
/**
* Returns authentication token provider previously registered by {@link #registerTokenUrl}.
*
* @param {String|Function} tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
* @returns {module:cloud-services-core/token~Token}
*/
getTokenFor( tokenUrl ) {
const token = this._tokens.get( tokenUrl );
if ( !token ) {
/**
* Provided `tokenUrl` was not registered by {@link module:cloud-services/cloudservices~CloudServices#registerTokenUrl}.
*
* @error cloudservices-token-not-registered
*/
throw new CKEditorError( 'cloudservices-token-not-registered', this );
}
return token;
}
/**
* @inheritDoc

@@ -86,4 +138,4 @@ */

if ( this.token ) {
this.token.destroy();
for ( const token of this._tokens.values() ) {
token.destroy();
}

@@ -90,0 +142,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc