@ckeditor/ckeditor5-cloud-services 44.1.0 → 44.2.0-alpha.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/LICENSE.md +1 -1
- package/build/cloud-services.js +2 -2
- package/dist/index-content.css +2 -2
- package/dist/index-editor.css +2 -2
- package/dist/index.css +2 -2
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/package.json +25 -5
- package/src/augmentation.d.ts +1 -1
- package/src/augmentation.js +1 -1
- package/src/cloudservices.d.ts +1 -1
- package/src/cloudservices.js +15 -3
- package/src/cloudservicesconfig.d.ts +1 -1
- package/src/cloudservicesconfig.js +1 -1
- package/src/cloudservicescore.d.ts +1 -1
- package/src/cloudservicescore.js +1 -1
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -1
- package/src/token/token.d.ts +1 -1
- package/src/token/token.js +1 -1
- package/src/uploadgateway/fileuploader.d.ts +1 -1
- package/src/uploadgateway/fileuploader.js +1 -1
- package/src/uploadgateway/uploadgateway.d.ts +1 -1
- package/src/uploadgateway/uploadgateway.js +1 -1
- package/dist/augmentation.d.ts +0 -23
- package/dist/cloudservices.d.ts +0 -92
- package/dist/cloudservicesconfig.d.ts +0 -131
- package/dist/cloudservicescore.d.ts +0 -44
- package/dist/index.d.ts +0 -18
- package/dist/token/token.d.ts +0 -117
- package/dist/uploadgateway/fileuploader.d.ts +0 -98
- package/dist/uploadgateway/uploadgateway.d.ts +0 -51
package/src/cloudservices.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -60,9 +60,21 @@ export default class CloudServices extends ContextPlugin {
|
|
|
60
60
|
this.token = null;
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
|
+
// Initialization of the token may fail. By default, the token is being refreshed on the failure.
|
|
64
|
+
// The problem is that if this happens here, then the token refresh interval will be executed even
|
|
65
|
+
// after destroying the editor (as the exception was thrown from `init` method). To prevent that
|
|
66
|
+
// behavior we need to catch the exception and destroy the uninitialized token instance.
|
|
67
|
+
// See: https://github.com/ckeditor/ckeditor5/issues/17531
|
|
63
68
|
const cloudServicesCore = this.context.plugins.get('CloudServicesCore');
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
const uninitializedToken = cloudServicesCore.createToken(this.tokenUrl);
|
|
70
|
+
try {
|
|
71
|
+
this.token = await uninitializedToken.init();
|
|
72
|
+
this._tokens.set(this.tokenUrl, this.token);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
uninitializedToken.destroy();
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
66
78
|
}
|
|
67
79
|
/**
|
|
68
80
|
* Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
/**
|
package/src/cloudservicescore.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
/**
|
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
/**
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
/**
|
package/src/token/token.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
import type { TokenUrl } from '../cloudservicesconfig.js';
|
package/src/token/token.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
import { EmitterMixin, CKEditorError } from 'ckeditor5/src/utils.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
2
|
+
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
5
|
/**
|
package/dist/augmentation.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
import type { CloudServices, CloudServicesConfig, CloudServicesCore } from './index.js';
|
|
10
|
-
declare module '@ckeditor/ckeditor5-core' {
|
|
11
|
-
interface EditorConfig {
|
|
12
|
-
/**
|
|
13
|
-
* The configuration of CKEditor Cloud Services. Introduced by the {@link module:cloud-services/cloudservices~CloudServices} plugin.
|
|
14
|
-
*
|
|
15
|
-
* Read more in {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig}.
|
|
16
|
-
*/
|
|
17
|
-
cloudServices?: CloudServicesConfig;
|
|
18
|
-
}
|
|
19
|
-
interface PluginsMap {
|
|
20
|
-
[CloudServices.pluginName]: CloudServices;
|
|
21
|
-
[CloudServicesCore.pluginName]: CloudServicesCore;
|
|
22
|
-
}
|
|
23
|
-
}
|
package/dist/cloudservices.d.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module cloud-services/cloudservices
|
|
11
|
-
*/
|
|
12
|
-
import { ContextPlugin } from 'ckeditor5/src/core.js';
|
|
13
|
-
import CloudServicesCore from './cloudservicescore.js';
|
|
14
|
-
import type { CloudServicesConfig, TokenUrl } from './cloudservicesconfig.js';
|
|
15
|
-
import type { InitializedToken } from './token/token.js';
|
|
16
|
-
/**
|
|
17
|
-
* Plugin introducing the integration between CKEditor 5 and CKEditor Cloud Services .
|
|
18
|
-
*
|
|
19
|
-
* It initializes the token provider based on
|
|
20
|
-
* the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudService`}.
|
|
21
|
-
*/
|
|
22
|
-
export default class CloudServices extends ContextPlugin implements CloudServicesConfig {
|
|
23
|
-
/**
|
|
24
|
-
* The authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
|
|
25
|
-
* {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
|
|
26
|
-
*/
|
|
27
|
-
readonly tokenUrl?: TokenUrl;
|
|
28
|
-
/**
|
|
29
|
-
* The URL to which the files should be uploaded.
|
|
30
|
-
*/
|
|
31
|
-
readonly uploadUrl?: string;
|
|
32
|
-
/**
|
|
33
|
-
* The URL for web socket communication, used by the `RealTimeCollaborativeEditing` plugin. Every customer (organization in the CKEditor
|
|
34
|
-
* Ecosystem dashboard) has their own, unique URLs to communicate with CKEditor Cloud Services. The URL can be found in the
|
|
35
|
-
* CKEditor Ecosystem customer dashboard.
|
|
36
|
-
*
|
|
37
|
-
* Note: Unlike most plugins, `RealTimeCollaborativeEditing` is not included in any CKEditor 5 build and needs to be installed manually.
|
|
38
|
-
* Check [Collaboration overview](https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/overview.html) for more details.
|
|
39
|
-
*/
|
|
40
|
-
readonly webSocketUrl?: string;
|
|
41
|
-
/**
|
|
42
|
-
* An optional parameter used for integration with CKEditor Cloud Services when uploading the editor build to cloud services.
|
|
43
|
-
*
|
|
44
|
-
* Whenever the editor build or the configuration changes, this parameter should be set to a new, unique value to differentiate
|
|
45
|
-
* the new bundle (build + configuration) from the old ones.
|
|
46
|
-
*/
|
|
47
|
-
readonly bundleVersion?: string;
|
|
48
|
-
/**
|
|
49
|
-
* Other plugins use this token for the authorization process. It handles token requesting and refreshing.
|
|
50
|
-
* Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.
|
|
51
|
-
*
|
|
52
|
-
* @readonly
|
|
53
|
-
*/
|
|
54
|
-
token: InitializedToken | null;
|
|
55
|
-
/**
|
|
56
|
-
* A map of token object instances keyed by the token URLs.
|
|
57
|
-
*/
|
|
58
|
-
private readonly _tokens;
|
|
59
|
-
/**
|
|
60
|
-
* @inheritDoc
|
|
61
|
-
*/
|
|
62
|
-
static get pluginName(): "CloudServices";
|
|
63
|
-
/**
|
|
64
|
-
* @inheritDoc
|
|
65
|
-
*/
|
|
66
|
-
static get isOfficialPlugin(): true;
|
|
67
|
-
/**
|
|
68
|
-
* @inheritDoc
|
|
69
|
-
*/
|
|
70
|
-
static get requires(): readonly [typeof CloudServicesCore];
|
|
71
|
-
/**
|
|
72
|
-
* @inheritDoc
|
|
73
|
-
*/
|
|
74
|
-
init(): Promise<void>;
|
|
75
|
-
/**
|
|
76
|
-
* Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
|
|
77
|
-
* {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
|
|
78
|
-
*
|
|
79
|
-
* @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
|
|
80
|
-
*/
|
|
81
|
-
registerTokenUrl(tokenUrl: TokenUrl): Promise<InitializedToken>;
|
|
82
|
-
/**
|
|
83
|
-
* Returns an authentication token provider previously registered by {@link #registerTokenUrl}.
|
|
84
|
-
*
|
|
85
|
-
* @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
|
|
86
|
-
*/
|
|
87
|
-
getTokenFor(tokenUrl: TokenUrl): InitializedToken;
|
|
88
|
-
/**
|
|
89
|
-
* @inheritDoc
|
|
90
|
-
*/
|
|
91
|
-
destroy(): void;
|
|
92
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module cloud-services/cloudservicesconfig
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Endpoint address to download the token or a callback that provides the token.
|
|
14
|
-
*/
|
|
15
|
-
export type TokenUrl = string | (() => Promise<string>);
|
|
16
|
-
/**
|
|
17
|
-
* The configuration for all plugins using CKEditor Cloud Services.
|
|
18
|
-
*
|
|
19
|
-
* ```ts
|
|
20
|
-
* ClassicEditor
|
|
21
|
-
* .create( document.querySelector( '#editor' ), {
|
|
22
|
-
* cloudServices: {
|
|
23
|
-
* tokenUrl: 'https://example.com/cs-token-endpoint',
|
|
24
|
-
* uploadUrl: 'https://your-organization-id.cke-cs.com/easyimage/upload/'
|
|
25
|
-
* }
|
|
26
|
-
* } )
|
|
27
|
-
* .then( ... )
|
|
28
|
-
* .catch( ... );
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
|
32
|
-
*/
|
|
33
|
-
export interface CloudServicesConfig {
|
|
34
|
-
/**
|
|
35
|
-
* A token URL or a token request function.
|
|
36
|
-
*
|
|
37
|
-
* As a string, it should be a URL to the security token endpoint in your application.
|
|
38
|
-
* The role of this endpoint is to securely authorize
|
|
39
|
-
* the end users of your application to use [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services) only
|
|
40
|
-
* if they should have access e.g. to upload files with {@glink features/file-management/ckbox CKBox} or to use the
|
|
41
|
-
* {@glink @cs guides/collaboration/quick-start Collaboration} service.
|
|
42
|
-
*
|
|
43
|
-
* ```ts
|
|
44
|
-
* ClassicEditor
|
|
45
|
-
* .create( document.querySelector( '#editor' ), {
|
|
46
|
-
* cloudServices: {
|
|
47
|
-
* tokenUrl: 'https://example.com/cs-token-endpoint',
|
|
48
|
-
* ...
|
|
49
|
-
* }
|
|
50
|
-
* } )
|
|
51
|
-
* .then( ... )
|
|
52
|
-
* .catch( ... );
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
* As a function, it should provide a promise to the token value,
|
|
56
|
-
* so you can highly customize the token and provide your token URL endpoint.
|
|
57
|
-
* By using this approach you can set your own headers for the request.
|
|
58
|
-
*
|
|
59
|
-
* ```ts
|
|
60
|
-
* ClassicEditor
|
|
61
|
-
* .create( document.querySelector( '#editor' ), {
|
|
62
|
-
* cloudServices: {
|
|
63
|
-
* tokenUrl: () => new Promise( ( resolve, reject ) => {
|
|
64
|
-
* const xhr = new XMLHttpRequest();
|
|
65
|
-
*
|
|
66
|
-
* xhr.open( 'GET', 'https://example.com/cs-token-endpoint' );
|
|
67
|
-
*
|
|
68
|
-
* xhr.addEventListener( 'load', () => {
|
|
69
|
-
* const statusCode = xhr.status;
|
|
70
|
-
* const xhrResponse = xhr.response;
|
|
71
|
-
*
|
|
72
|
-
* if ( statusCode < 200 || statusCode > 299 ) {
|
|
73
|
-
* return reject( new Error( 'Cannot download new token!' ) );
|
|
74
|
-
* }
|
|
75
|
-
*
|
|
76
|
-
* return resolve( xhrResponse );
|
|
77
|
-
* } );
|
|
78
|
-
*
|
|
79
|
-
* xhr.addEventListener( 'error', () => reject( new Error( 'Network Error' ) ) );
|
|
80
|
-
* xhr.addEventListener( 'abort', () => reject( new Error( 'Abort' ) ) );
|
|
81
|
-
*
|
|
82
|
-
* xhr.setRequestHeader( customHeader, customValue );
|
|
83
|
-
*
|
|
84
|
-
* xhr.send();
|
|
85
|
-
* } ),
|
|
86
|
-
* ...
|
|
87
|
-
* }
|
|
88
|
-
* } )
|
|
89
|
-
* ```
|
|
90
|
-
*
|
|
91
|
-
* If the request to the token endpoint fails, the editor will call the token request function every 5 seconds in attempt
|
|
92
|
-
* to refresh the token.
|
|
93
|
-
*
|
|
94
|
-
* You can find more information about token endpoints in the
|
|
95
|
-
* {@glink @cs developer-resources/easy-image/service-details Easy Image} guide
|
|
96
|
-
* and {@glink @cs developer-resources/security/token-endpoint Cloud Services - Token endpoint} documentation.
|
|
97
|
-
*
|
|
98
|
-
* Without a properly working token endpoint (token URL) CKEditor plugins will not be able to connect to CKEditor Cloud Services.
|
|
99
|
-
*/
|
|
100
|
-
tokenUrl?: TokenUrl;
|
|
101
|
-
/**
|
|
102
|
-
* The endpoint URL for [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services) uploads.
|
|
103
|
-
* This option must be set for Easy Image to work correctly.
|
|
104
|
-
*
|
|
105
|
-
* The upload URL is unique for each customer and can be found in the
|
|
106
|
-
* [CKEditor Ecosystem customer dashboard](https://dashboard.ckeditor.com) after subscribing to the Easy Image service.
|
|
107
|
-
* To learn more, check the {@glink @cs developer-resources/easy-image/service-details
|
|
108
|
-
* Easy Image} guide.
|
|
109
|
-
*
|
|
110
|
-
* Note: Easy Image is a legacy product and only maintained for existing clients.
|
|
111
|
-
*
|
|
112
|
-
* Note: Make sure to also set the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} configuration option.
|
|
113
|
-
*/
|
|
114
|
-
uploadUrl?: string;
|
|
115
|
-
/**
|
|
116
|
-
* The URL for web socket communication, used by the `RealTimeCollaborativeEditing` plugin. Every customer (organization in the CKEditor
|
|
117
|
-
* Ecosystem dashboard) has their own, unique URLs to communicate with CKEditor Cloud Services. The URL can be found in the
|
|
118
|
-
* CKEditor Ecosystem customer dashboard.
|
|
119
|
-
*
|
|
120
|
-
* Note: Unlike most plugins, `RealTimeCollaborativeEditing` is not included in any CKEditor 5 build and needs to be installed manually.
|
|
121
|
-
* Check [Collaboration overview](https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/overview.html) for more details.
|
|
122
|
-
*/
|
|
123
|
-
webSocketUrl?: string;
|
|
124
|
-
/**
|
|
125
|
-
* An optional parameter used for integration with CKEditor Cloud Services when uploading the editor build to cloud services.
|
|
126
|
-
*
|
|
127
|
-
* Whenever the editor build or the configuration changes, this parameter should be set to a new, unique value to differentiate
|
|
128
|
-
* the new bundle (build + configuration) from the old ones.
|
|
129
|
-
*/
|
|
130
|
-
bundleVersion?: string;
|
|
131
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module cloud-services/cloudservicescore
|
|
11
|
-
*/
|
|
12
|
-
import { ContextPlugin } from 'ckeditor5/src/core.js';
|
|
13
|
-
import type { TokenUrl } from './cloudservicesconfig.js';
|
|
14
|
-
import Token, { type InitializedToken, type TokenOptions } from './token/token.js';
|
|
15
|
-
import UploadGateway from './uploadgateway/uploadgateway.js';
|
|
16
|
-
/**
|
|
17
|
-
* The `CloudServicesCore` plugin exposes the base API for communication with CKEditor Cloud Services.
|
|
18
|
-
*/
|
|
19
|
-
export default class CloudServicesCore extends ContextPlugin {
|
|
20
|
-
/**
|
|
21
|
-
* @inheritDoc
|
|
22
|
-
*/
|
|
23
|
-
static get pluginName(): "CloudServicesCore";
|
|
24
|
-
/**
|
|
25
|
-
* @inheritDoc
|
|
26
|
-
*/
|
|
27
|
-
static get isOfficialPlugin(): true;
|
|
28
|
-
/**
|
|
29
|
-
* Creates the {@link module:cloud-services/token/token~Token} instance.
|
|
30
|
-
*
|
|
31
|
-
* @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the
|
|
32
|
-
* value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.
|
|
33
|
-
* @param options.initValue Initial value of the token.
|
|
34
|
-
* @param options.autoRefresh Specifies whether to start the refresh automatically.
|
|
35
|
-
*/
|
|
36
|
-
createToken(tokenUrlOrRefreshToken: TokenUrl, options?: TokenOptions): Token;
|
|
37
|
-
/**
|
|
38
|
-
* Creates the {@link module:cloud-services/uploadgateway/uploadgateway~UploadGateway} instance.
|
|
39
|
-
*
|
|
40
|
-
* @param token Token used for authentication.
|
|
41
|
-
* @param apiAddress API address.
|
|
42
|
-
*/
|
|
43
|
-
createUploadGateway(token: InitializedToken, apiAddress: string): UploadGateway;
|
|
44
|
-
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module cloud-services
|
|
11
|
-
*/
|
|
12
|
-
export { default as CloudServices } from './cloudservices.js';
|
|
13
|
-
export { default as CloudServicesCore } from './cloudservicescore.js';
|
|
14
|
-
export type { TokenUrl, CloudServicesConfig } from './cloudservicesconfig.js';
|
|
15
|
-
export { default as Token, type InitializedToken } from './token/token.js';
|
|
16
|
-
export type { default as UploadGateway } from './uploadgateway/uploadgateway.js';
|
|
17
|
-
export type { default as FileUploader } from './uploadgateway/fileuploader.js';
|
|
18
|
-
import './augmentation.js';
|
package/dist/token/token.d.ts
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
import type { TokenUrl } from '../cloudservicesconfig.js';
|
|
10
|
-
declare const Token_base: {
|
|
11
|
-
new (): import("ckeditor5/src/utils.js").Observable;
|
|
12
|
-
prototype: import("ckeditor5/src/utils.js").Observable;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* The class representing the token used for communication with CKEditor Cloud Services.
|
|
16
|
-
* The value of the token is retrieved from the specified URL and refreshed every 1 hour by default.
|
|
17
|
-
* If the token retrieval fails, the token will automatically retry in 5 seconds intervals.
|
|
18
|
-
*/
|
|
19
|
-
export default class Token extends /* #__PURE__ */ Token_base {
|
|
20
|
-
/**
|
|
21
|
-
* Value of the token.
|
|
22
|
-
* The value of the token is undefined if `initValue` is not provided or `init` method was not called.
|
|
23
|
-
* `create` method creates token with initialized value from url.
|
|
24
|
-
*
|
|
25
|
-
* @see module:cloud-services/token/token~InitializedToken
|
|
26
|
-
* @observable
|
|
27
|
-
* @readonly
|
|
28
|
-
*/
|
|
29
|
-
value: string | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Base refreshing function.
|
|
32
|
-
*/
|
|
33
|
-
private _refresh;
|
|
34
|
-
/**
|
|
35
|
-
* Cached token options.
|
|
36
|
-
*/
|
|
37
|
-
private _options;
|
|
38
|
-
/**
|
|
39
|
-
* `setTimeout()` id for a token refresh when {@link module:cloud-services/token/token~TokenOptions auto refresh} is enabled.
|
|
40
|
-
*/
|
|
41
|
-
private _tokenRefreshTimeout?;
|
|
42
|
-
/**
|
|
43
|
-
* Flag indicating whether the token has been destroyed.
|
|
44
|
-
*/
|
|
45
|
-
private _isDestroyed;
|
|
46
|
-
/**
|
|
47
|
-
* Creates `Token` instance.
|
|
48
|
-
* Method `init` should be called after using the constructor or use `create` method instead.
|
|
49
|
-
*
|
|
50
|
-
* @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the
|
|
51
|
-
* value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.
|
|
52
|
-
*/
|
|
53
|
-
constructor(tokenUrlOrRefreshToken: TokenUrl, options?: TokenOptions);
|
|
54
|
-
/**
|
|
55
|
-
* Initializes the token.
|
|
56
|
-
*/
|
|
57
|
-
init(): Promise<InitializedToken>;
|
|
58
|
-
/**
|
|
59
|
-
* Refresh token method. Useful in a method form as it can be overridden in tests.
|
|
60
|
-
*
|
|
61
|
-
* This method will be invoked periodically based on the token expiry date after first call to keep the token up-to-date
|
|
62
|
-
* (requires {@link module:cloud-services/token/token~TokenOptions auto refresh option} to be set).
|
|
63
|
-
*
|
|
64
|
-
* If the token refresh fails, the method will retry in 5 seconds intervals until success or the token gets
|
|
65
|
-
* {@link #destroy destroyed}.
|
|
66
|
-
*/
|
|
67
|
-
refreshToken(): Promise<InitializedToken>;
|
|
68
|
-
/**
|
|
69
|
-
* Destroys token instance. Stops refreshing.
|
|
70
|
-
*/
|
|
71
|
-
destroy(): void;
|
|
72
|
-
/**
|
|
73
|
-
* Checks whether the provided token follows the JSON Web Tokens (JWT) format.
|
|
74
|
-
*
|
|
75
|
-
* @param tokenValue The token to validate.
|
|
76
|
-
*/
|
|
77
|
-
private _validateTokenValue;
|
|
78
|
-
/**
|
|
79
|
-
* Registers a refresh token timeout for the time taken from token.
|
|
80
|
-
*/
|
|
81
|
-
private _registerRefreshTokenTimeout;
|
|
82
|
-
/**
|
|
83
|
-
* Returns token refresh timeout time calculated from expire time in the token payload.
|
|
84
|
-
*
|
|
85
|
-
* If the token parse fails or the token payload doesn't contain, the default DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME is returned.
|
|
86
|
-
*/
|
|
87
|
-
private _getTokenRefreshTimeoutTime;
|
|
88
|
-
/**
|
|
89
|
-
* Creates a initialized {@link module:cloud-services/token/token~Token} instance.
|
|
90
|
-
*
|
|
91
|
-
* @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the
|
|
92
|
-
* value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.
|
|
93
|
-
*/
|
|
94
|
-
static create(tokenUrlOrRefreshToken: TokenUrl, options?: TokenOptions): Promise<InitializedToken>;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* A {@link ~Token} instance that has been initialized.
|
|
98
|
-
*/
|
|
99
|
-
export type InitializedToken = Token & {
|
|
100
|
-
value: string;
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* Options for creating tokens.
|
|
104
|
-
*/
|
|
105
|
-
export interface TokenOptions {
|
|
106
|
-
/**
|
|
107
|
-
* Initial value of the token.
|
|
108
|
-
*/
|
|
109
|
-
initValue?: string;
|
|
110
|
-
/**
|
|
111
|
-
* Specifies whether to start the refresh automatically.
|
|
112
|
-
*
|
|
113
|
-
* @default true
|
|
114
|
-
*/
|
|
115
|
-
autoRefresh?: boolean;
|
|
116
|
-
}
|
|
117
|
-
export {};
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module cloud-services/uploadgateway/fileuploader
|
|
11
|
-
*/
|
|
12
|
-
import type { UploadResponse } from 'ckeditor5/src/upload.js';
|
|
13
|
-
import type { InitializedToken } from '../token/token.js';
|
|
14
|
-
declare const FileUploader_base: {
|
|
15
|
-
new (): import("ckeditor5/src/utils.js").Emitter;
|
|
16
|
-
prototype: import("ckeditor5/src/utils.js").Emitter;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* FileUploader class used to upload single file.
|
|
20
|
-
*/
|
|
21
|
-
export default class FileUploader extends /* #__PURE__ */ FileUploader_base {
|
|
22
|
-
/**
|
|
23
|
-
* A file that is being uploaded.
|
|
24
|
-
*/
|
|
25
|
-
readonly file: Blob;
|
|
26
|
-
xhr?: XMLHttpRequest;
|
|
27
|
-
/**
|
|
28
|
-
* CKEditor Cloud Services access token.
|
|
29
|
-
*/
|
|
30
|
-
private readonly _token;
|
|
31
|
-
/**
|
|
32
|
-
* CKEditor Cloud Services API address.
|
|
33
|
-
*/
|
|
34
|
-
private readonly _apiAddress;
|
|
35
|
-
/**
|
|
36
|
-
* Creates `FileUploader` instance.
|
|
37
|
-
*
|
|
38
|
-
* @param fileOrData A blob object or a data string encoded with Base64.
|
|
39
|
-
* @param token Token used for authentication.
|
|
40
|
-
* @param apiAddress API address.
|
|
41
|
-
*/
|
|
42
|
-
constructor(fileOrData: string | Blob, token: InitializedToken, apiAddress: string);
|
|
43
|
-
/**
|
|
44
|
-
* Registers callback on `progress` event.
|
|
45
|
-
*/
|
|
46
|
-
onProgress(callback: (status: {
|
|
47
|
-
total: number;
|
|
48
|
-
uploaded: number;
|
|
49
|
-
}) => void): this;
|
|
50
|
-
/**
|
|
51
|
-
* Registers callback on `error` event. Event is called once when error occurs.
|
|
52
|
-
*/
|
|
53
|
-
onError(callback: (error: string) => void): this;
|
|
54
|
-
/**
|
|
55
|
-
* Aborts upload process.
|
|
56
|
-
*/
|
|
57
|
-
abort(): void;
|
|
58
|
-
/**
|
|
59
|
-
* Sends XHR request to API.
|
|
60
|
-
*/
|
|
61
|
-
send(): Promise<UploadResponse>;
|
|
62
|
-
/**
|
|
63
|
-
* Prepares XHR request.
|
|
64
|
-
*/
|
|
65
|
-
private _prepareRequest;
|
|
66
|
-
/**
|
|
67
|
-
* Attaches listeners to the XHR.
|
|
68
|
-
*/
|
|
69
|
-
private _attachXHRListeners;
|
|
70
|
-
/**
|
|
71
|
-
* Sends XHR request.
|
|
72
|
-
*/
|
|
73
|
-
private _sendRequest;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Fired when error occurs.
|
|
77
|
-
*
|
|
78
|
-
* @eventName ~FileUploader#error
|
|
79
|
-
* @param error Error message
|
|
80
|
-
*/
|
|
81
|
-
export type FileUploaderErrorEvent = {
|
|
82
|
-
name: 'error';
|
|
83
|
-
args: [error: string];
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Fired on upload progress.
|
|
87
|
-
*
|
|
88
|
-
* @eventName ~FileUploader#progress
|
|
89
|
-
* @param status Total and uploaded status
|
|
90
|
-
*/
|
|
91
|
-
export type FileUploaderProgressErrorEvent = {
|
|
92
|
-
name: 'progress';
|
|
93
|
-
args: [status: {
|
|
94
|
-
total: number;
|
|
95
|
-
uploaded: number;
|
|
96
|
-
}];
|
|
97
|
-
};
|
|
98
|
-
export {};
|