@ckeditor/ckeditor5-cloud-services 40.0.0 → 40.1.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 CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
2
2
  ==========================
3
3
 
4
4
  **CKEditor&nbsp;5 Cloud Services integration** – https://github.com/ckeditor/ckeditor5-cloud-services <br>
5
- Copyright (c) 2003-2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
5
+ Copyright (c) 20032023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
6
6
 
7
7
  Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
8
8
 
@@ -14,4 +14,4 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
14
14
  Trademarks
15
15
  ----------
16
16
 
17
- **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
17
+ **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-cloud-services",
3
- "version": "40.0.0",
3
+ "version": "40.1.0",
4
4
  "description": "CKEditor 5's Cloud Services integration layer.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "main": "src/index.js",
13
13
  "dependencies": {
14
- "ckeditor5": "40.0.0"
14
+ "ckeditor5": "40.1.0"
15
15
  },
16
16
  "author": "CKSource (http://cksource.com/)",
17
17
  "license": "GPL-2.0-or-later",
@@ -1,19 +1,19 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, 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
- import type { CloudServices, CloudServicesConfig, CloudServicesCore } from './index';
6
- declare module '@ckeditor/ckeditor5-core' {
7
- interface EditorConfig {
8
- /**
9
- * The configuration of CKEditor Cloud Services. Introduced by the {@link module:cloud-services/cloudservices~CloudServices} plugin.
10
- *
11
- * Read more in {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig}.
12
- */
13
- cloudServices?: CloudServicesConfig;
14
- }
15
- interface PluginsMap {
16
- [CloudServices.pluginName]: CloudServices;
17
- [CloudServicesCore.pluginName]: CloudServicesCore;
18
- }
19
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ import type { CloudServices, CloudServicesConfig, CloudServicesCore } from './index';
6
+ declare module '@ckeditor/ckeditor5-core' {
7
+ interface EditorConfig {
8
+ /**
9
+ * The configuration of CKEditor Cloud Services. Introduced by the {@link module:cloud-services/cloudservices~CloudServices} plugin.
10
+ *
11
+ * Read more in {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig}.
12
+ */
13
+ cloudServices?: CloudServicesConfig;
14
+ }
15
+ interface PluginsMap {
16
+ [CloudServices.pluginName]: CloudServices;
17
+ [CloudServicesCore.pluginName]: CloudServicesCore;
18
+ }
19
+ }
@@ -1,5 +1,5 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, 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
- export {};
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ export {};
@@ -1,84 +1,84 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, 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
- * @module cloud-services/cloudservices
7
- */
8
- import { ContextPlugin } from 'ckeditor5/src/core';
9
- import CloudServicesCore from './cloudservicescore';
10
- import type { CloudServicesConfig, TokenUrl } from './cloudservicesconfig';
11
- import type { InitializedToken } from './token/token';
12
- /**
13
- * Plugin introducing the integration between CKEditor 5 and CKEditor Cloud Services .
14
- *
15
- * It initializes the token provider based on
16
- * the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudService`}.
17
- */
18
- export default class CloudServices extends ContextPlugin implements CloudServicesConfig {
19
- /**
20
- * The authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
21
- * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
22
- */
23
- readonly tokenUrl?: TokenUrl;
24
- /**
25
- * The URL to which the files should be uploaded.
26
- */
27
- readonly uploadUrl?: string;
28
- /**
29
- * The URL for web socket communication, used by the `RealTimeCollaborativeEditing` plugin. Every customer (organization in the CKEditor
30
- * Ecosystem dashboard) has their own, unique URLs to communicate with CKEditor Cloud Services. The URL can be found in the
31
- * CKEditor Ecosystem customer dashboard.
32
- *
33
- * Note: Unlike most plugins, `RealTimeCollaborativeEditing` is not included in any CKEditor 5 build and needs to be installed manually.
34
- * Check [Collaboration overview](https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/overview.html) for more details.
35
- */
36
- readonly webSocketUrl?: string;
37
- /**
38
- * An optional parameter used for integration with CKEditor Cloud Services when uploading the editor build to cloud services.
39
- *
40
- * Whenever the editor build or the configuration changes, this parameter should be set to a new, unique value to differentiate
41
- * the new bundle (build + configuration) from the old ones.
42
- */
43
- readonly bundleVersion?: string;
44
- /**
45
- * Other plugins use this token for the authorization process. It handles token requesting and refreshing.
46
- * Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.
47
- *
48
- * @readonly
49
- */
50
- token: InitializedToken | null;
51
- /**
52
- * A map of token object instances keyed by the token URLs.
53
- */
54
- private readonly _tokens;
55
- /**
56
- * @inheritDoc
57
- */
58
- static get pluginName(): "CloudServices";
59
- /**
60
- * @inheritDoc
61
- */
62
- static get requires(): readonly [typeof CloudServicesCore];
63
- /**
64
- * @inheritDoc
65
- */
66
- init(): Promise<void>;
67
- /**
68
- * Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
69
- * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
70
- *
71
- * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
72
- */
73
- registerTokenUrl(tokenUrl: TokenUrl): Promise<InitializedToken>;
74
- /**
75
- * Returns an authentication token provider previously registered by {@link #registerTokenUrl}.
76
- *
77
- * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
78
- */
79
- getTokenFor(tokenUrl: TokenUrl): InitializedToken;
80
- /**
81
- * @inheritDoc
82
- */
83
- destroy(): void;
84
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module cloud-services/cloudservices
7
+ */
8
+ import { ContextPlugin } from 'ckeditor5/src/core';
9
+ import CloudServicesCore from './cloudservicescore';
10
+ import type { CloudServicesConfig, TokenUrl } from './cloudservicesconfig';
11
+ import type { InitializedToken } from './token/token';
12
+ /**
13
+ * Plugin introducing the integration between CKEditor 5 and CKEditor Cloud Services .
14
+ *
15
+ * It initializes the token provider based on
16
+ * the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudService`}.
17
+ */
18
+ export default class CloudServices extends ContextPlugin implements CloudServicesConfig {
19
+ /**
20
+ * The authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
21
+ * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
22
+ */
23
+ readonly tokenUrl?: TokenUrl;
24
+ /**
25
+ * The URL to which the files should be uploaded.
26
+ */
27
+ readonly uploadUrl?: string;
28
+ /**
29
+ * The URL for web socket communication, used by the `RealTimeCollaborativeEditing` plugin. Every customer (organization in the CKEditor
30
+ * Ecosystem dashboard) has their own, unique URLs to communicate with CKEditor Cloud Services. The URL can be found in the
31
+ * CKEditor Ecosystem customer dashboard.
32
+ *
33
+ * Note: Unlike most plugins, `RealTimeCollaborativeEditing` is not included in any CKEditor 5 build and needs to be installed manually.
34
+ * Check [Collaboration overview](https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/overview.html) for more details.
35
+ */
36
+ readonly webSocketUrl?: string;
37
+ /**
38
+ * An optional parameter used for integration with CKEditor Cloud Services when uploading the editor build to cloud services.
39
+ *
40
+ * Whenever the editor build or the configuration changes, this parameter should be set to a new, unique value to differentiate
41
+ * the new bundle (build + configuration) from the old ones.
42
+ */
43
+ readonly bundleVersion?: string;
44
+ /**
45
+ * Other plugins use this token for the authorization process. It handles token requesting and refreshing.
46
+ * Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.
47
+ *
48
+ * @readonly
49
+ */
50
+ token: InitializedToken | null;
51
+ /**
52
+ * A map of token object instances keyed by the token URLs.
53
+ */
54
+ private readonly _tokens;
55
+ /**
56
+ * @inheritDoc
57
+ */
58
+ static get pluginName(): "CloudServices";
59
+ /**
60
+ * @inheritDoc
61
+ */
62
+ static get requires(): readonly [typeof CloudServicesCore];
63
+ /**
64
+ * @inheritDoc
65
+ */
66
+ init(): Promise<void>;
67
+ /**
68
+ * Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
69
+ * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
70
+ *
71
+ * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
72
+ */
73
+ registerTokenUrl(tokenUrl: TokenUrl): Promise<InitializedToken>;
74
+ /**
75
+ * Returns an authentication token provider previously registered by {@link #registerTokenUrl}.
76
+ *
77
+ * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
78
+ */
79
+ getTokenFor(tokenUrl: TokenUrl): InitializedToken;
80
+ /**
81
+ * @inheritDoc
82
+ */
83
+ destroy(): void;
84
+ }
@@ -1,103 +1,103 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, 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
- * @module cloud-services/cloudservices
7
- */
8
- import { ContextPlugin } from 'ckeditor5/src/core';
9
- import { CKEditorError } from 'ckeditor5/src/utils';
10
- import CloudServicesCore from './cloudservicescore';
11
- /**
12
- * Plugin introducing the integration between CKEditor 5 and CKEditor Cloud Services .
13
- *
14
- * It initializes the token provider based on
15
- * the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudService`}.
16
- */
17
- export default class CloudServices extends ContextPlugin {
18
- constructor() {
19
- super(...arguments);
20
- /**
21
- * Other plugins use this token for the authorization process. It handles token requesting and refreshing.
22
- * Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.
23
- *
24
- * @readonly
25
- */
26
- this.token = null;
27
- /**
28
- * A map of token object instances keyed by the token URLs.
29
- */
30
- this._tokens = new Map();
31
- }
32
- /**
33
- * @inheritDoc
34
- */
35
- static get pluginName() {
36
- return 'CloudServices';
37
- }
38
- /**
39
- * @inheritDoc
40
- */
41
- static get requires() {
42
- return [CloudServicesCore];
43
- }
44
- /**
45
- * @inheritDoc
46
- */
47
- async init() {
48
- const config = this.context.config;
49
- const options = config.get('cloudServices') || {};
50
- for (const [key, value] of Object.entries(options)) {
51
- this[key] = value;
52
- }
53
- if (!this.tokenUrl) {
54
- this.token = null;
55
- return;
56
- }
57
- const cloudServicesCore = this.context.plugins.get('CloudServicesCore');
58
- this.token = await cloudServicesCore.createToken(this.tokenUrl).init();
59
- this._tokens.set(this.tokenUrl, this.token);
60
- }
61
- /**
62
- * Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
63
- * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
64
- *
65
- * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
66
- */
67
- async registerTokenUrl(tokenUrl) {
68
- // Reuse the token instance in case of multiple features using the same token URL.
69
- if (this._tokens.has(tokenUrl)) {
70
- return this.getTokenFor(tokenUrl);
71
- }
72
- const cloudServicesCore = this.context.plugins.get('CloudServicesCore');
73
- const token = await cloudServicesCore.createToken(tokenUrl).init();
74
- this._tokens.set(tokenUrl, token);
75
- return token;
76
- }
77
- /**
78
- * Returns an authentication token provider previously registered by {@link #registerTokenUrl}.
79
- *
80
- * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
81
- */
82
- getTokenFor(tokenUrl) {
83
- const token = this._tokens.get(tokenUrl);
84
- if (!token) {
85
- /**
86
- * The provided `tokenUrl` was not registered by {@link module:cloud-services/cloudservices~CloudServices#registerTokenUrl}.
87
- *
88
- * @error cloudservices-token-not-registered
89
- */
90
- throw new CKEditorError('cloudservices-token-not-registered', this);
91
- }
92
- return token;
93
- }
94
- /**
95
- * @inheritDoc
96
- */
97
- destroy() {
98
- super.destroy();
99
- for (const token of this._tokens.values()) {
100
- token.destroy();
101
- }
102
- }
103
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, 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
+ * @module cloud-services/cloudservices
7
+ */
8
+ import { ContextPlugin } from 'ckeditor5/src/core';
9
+ import { CKEditorError } from 'ckeditor5/src/utils';
10
+ import CloudServicesCore from './cloudservicescore';
11
+ /**
12
+ * Plugin introducing the integration between CKEditor 5 and CKEditor Cloud Services .
13
+ *
14
+ * It initializes the token provider based on
15
+ * the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudService`}.
16
+ */
17
+ export default class CloudServices extends ContextPlugin {
18
+ constructor() {
19
+ super(...arguments);
20
+ /**
21
+ * Other plugins use this token for the authorization process. It handles token requesting and refreshing.
22
+ * Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.
23
+ *
24
+ * @readonly
25
+ */
26
+ this.token = null;
27
+ /**
28
+ * A map of token object instances keyed by the token URLs.
29
+ */
30
+ this._tokens = new Map();
31
+ }
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ static get pluginName() {
36
+ return 'CloudServices';
37
+ }
38
+ /**
39
+ * @inheritDoc
40
+ */
41
+ static get requires() {
42
+ return [CloudServicesCore];
43
+ }
44
+ /**
45
+ * @inheritDoc
46
+ */
47
+ async init() {
48
+ const config = this.context.config;
49
+ const options = config.get('cloudServices') || {};
50
+ for (const [key, value] of Object.entries(options)) {
51
+ this[key] = value;
52
+ }
53
+ if (!this.tokenUrl) {
54
+ this.token = null;
55
+ return;
56
+ }
57
+ const cloudServicesCore = this.context.plugins.get('CloudServicesCore');
58
+ this.token = await cloudServicesCore.createToken(this.tokenUrl).init();
59
+ this._tokens.set(this.tokenUrl, this.token);
60
+ }
61
+ /**
62
+ * Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
63
+ * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
64
+ *
65
+ * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
66
+ */
67
+ async registerTokenUrl(tokenUrl) {
68
+ // Reuse the token instance in case of multiple features using the same token URL.
69
+ if (this._tokens.has(tokenUrl)) {
70
+ return this.getTokenFor(tokenUrl);
71
+ }
72
+ const cloudServicesCore = this.context.plugins.get('CloudServicesCore');
73
+ const token = await cloudServicesCore.createToken(tokenUrl).init();
74
+ this._tokens.set(tokenUrl, token);
75
+ return token;
76
+ }
77
+ /**
78
+ * Returns an authentication token provider previously registered by {@link #registerTokenUrl}.
79
+ *
80
+ * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
81
+ */
82
+ getTokenFor(tokenUrl) {
83
+ const token = this._tokens.get(tokenUrl);
84
+ if (!token) {
85
+ /**
86
+ * The provided `tokenUrl` was not registered by {@link module:cloud-services/cloudservices~CloudServices#registerTokenUrl}.
87
+ *
88
+ * @error cloudservices-token-not-registered
89
+ */
90
+ throw new CKEditorError('cloudservices-token-not-registered', this);
91
+ }
92
+ return token;
93
+ }
94
+ /**
95
+ * @inheritDoc
96
+ */
97
+ destroy() {
98
+ super.destroy();
99
+ for (const token of this._tokens.values()) {
100
+ token.destroy();
101
+ }
102
+ }
103
+ }