@ckeditor/ckeditor5-cloud-services 48.2.0 → 48.3.0-alpha.1

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.
@@ -1,114 +1,115 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- import type { TokenUrl } from '../cloudservicesconfig.js';
6
- declare const Token_base: {
7
- new (): import("@ckeditor/ckeditor5-utils").Observable;
8
- prototype: import("@ckeditor/ckeditor5-utils").Observable;
9
- };
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module cloud-services/token/token
7
+ */
8
+ import { type ObservableMixinConstructor } from "@ckeditor/ckeditor5-utils";
9
+ import type { TokenUrl } from "../cloudservicesconfig.js";
10
+ declare const TokenBase: ObservableMixinConstructor;
10
11
  /**
11
- * The class representing the token used for communication with CKEditor Cloud Services.
12
- * The value of the token is retrieved from the specified URL and refreshed every 1 hour by default.
13
- * If the token retrieval fails, the token will automatically retry in 5 seconds intervals.
14
- */
15
- export declare class Token extends /* #__PURE__ */ Token_base {
16
- /**
17
- * Value of the token.
18
- * The value of the token is undefined if `initValue` is not provided or `init` method was not called.
19
- * `create` method creates token with initialized value from url.
20
- *
21
- * @see module:cloud-services/token/token~InitializedToken
22
- * @observable
23
- * @readonly
24
- */
25
- value: string | undefined;
26
- /**
27
- * Base refreshing function.
28
- */
29
- private _refresh;
30
- /**
31
- * Cached token options.
32
- */
33
- private _options;
34
- /**
35
- * `setTimeout()` id for a token refresh when {@link module:cloud-services/token/token~CloudServicesTokenOptions auto refresh}
36
- * is enabled.
37
- */
38
- private _tokenRefreshTimeout?;
39
- /**
40
- * Flag indicating whether the token has been destroyed.
41
- */
42
- private _isDestroyed;
43
- /**
44
- * Creates `Token` instance.
45
- * Method `init` should be called after using the constructor or use `create` method instead.
46
- *
47
- * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the
48
- * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.
49
- */
50
- constructor(tokenUrlOrRefreshToken: TokenUrl, options?: CloudServicesTokenOptions);
51
- /**
52
- * Initializes the token.
53
- */
54
- init(): Promise<InitializedToken>;
55
- /**
56
- * Refresh token method. Useful in a method form as it can be overridden in tests.
57
- *
58
- * This method will be invoked periodically based on the token expiry date after first call to keep the token up-to-date
59
- * (requires {@link module:cloud-services/token/token~CloudServicesTokenOptions auto refresh option} to be set).
60
- *
61
- * If the token refresh fails, the method will retry in 5 seconds intervals until success or the token gets
62
- * {@link #destroy destroyed}.
63
- */
64
- refreshToken(): Promise<InitializedToken>;
65
- /**
66
- * Destroys token instance. Stops refreshing.
67
- */
68
- destroy(): void;
69
- /**
70
- * Checks whether the provided token follows the JSON Web Tokens (JWT) format.
71
- *
72
- * @param tokenValue The token to validate.
73
- */
74
- private _validateTokenValue;
75
- /**
76
- * Registers a refresh token timeout for the time taken from token.
77
- */
78
- private _registerRefreshTokenTimeout;
79
- /**
80
- * Returns token refresh timeout time calculated from expire time in the token payload.
81
- *
82
- * If the token parse fails or the token payload doesn't contain, the default DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME is returned.
83
- */
84
- private _getTokenRefreshTimeoutTime;
85
- /**
86
- * Creates a initialized {@link module:cloud-services/token/token~Token} instance.
87
- *
88
- * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the
89
- * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.
90
- */
91
- static create(tokenUrlOrRefreshToken: TokenUrl, options?: CloudServicesTokenOptions): Promise<InitializedToken>;
12
+ * The class representing the token used for communication with CKEditor Cloud Services.
13
+ * The value of the token is retrieved from the specified URL and refreshed every 1 hour by default.
14
+ * If the token retrieval fails, the token will automatically retry in 5 seconds intervals.
15
+ */
16
+ export declare class Token extends TokenBase {
17
+ /**
18
+ * Value of the token.
19
+ * The value of the token is undefined if `initValue` is not provided or `init` method was not called.
20
+ * `create` method creates token with initialized value from url.
21
+ *
22
+ * @see module:cloud-services/token/token~InitializedToken
23
+ * @observable
24
+ * @readonly
25
+ */
26
+ value: string | undefined;
27
+ /**
28
+ * Base refreshing function.
29
+ */
30
+ private _refresh;
31
+ /**
32
+ * Cached token options.
33
+ */
34
+ private _options;
35
+ /**
36
+ * `setTimeout()` id for a token refresh when {@link module:cloud-services/token/token~CloudServicesTokenOptions auto refresh}
37
+ * is enabled.
38
+ */
39
+ private _tokenRefreshTimeout?;
40
+ /**
41
+ * Flag indicating whether the token has been destroyed.
42
+ */
43
+ private _isDestroyed;
44
+ /**
45
+ * Creates `Token` instance.
46
+ * Method `init` should be called after using the constructor or use `create` method instead.
47
+ *
48
+ * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the
49
+ * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.
50
+ */
51
+ constructor(tokenUrlOrRefreshToken: TokenUrl, options?: CloudServicesTokenOptions);
52
+ /**
53
+ * Initializes the token.
54
+ */
55
+ init(): Promise<InitializedToken>;
56
+ /**
57
+ * Refresh token method. Useful in a method form as it can be overridden in tests.
58
+ *
59
+ * This method will be invoked periodically based on the token expiry date after first call to keep the token up-to-date
60
+ * (requires {@link module:cloud-services/token/token~CloudServicesTokenOptions auto refresh option} to be set).
61
+ *
62
+ * If the token refresh fails, the method will retry in 5 seconds intervals until success or the token gets
63
+ * {@link #destroy destroyed}.
64
+ */
65
+ refreshToken(): Promise<InitializedToken>;
66
+ /**
67
+ * Destroys token instance. Stops refreshing.
68
+ */
69
+ destroy(): void;
70
+ /**
71
+ * Checks whether the provided token follows the JSON Web Tokens (JWT) format.
72
+ *
73
+ * @param tokenValue The token to validate.
74
+ */
75
+ private _validateTokenValue;
76
+ /**
77
+ * Registers a refresh token timeout for the time taken from token.
78
+ */
79
+ private _registerRefreshTokenTimeout;
80
+ /**
81
+ * Returns token refresh timeout time calculated from expire time in the token payload.
82
+ *
83
+ * If the token parse fails or the token payload doesn't contain, the default DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME is returned.
84
+ */
85
+ private _getTokenRefreshTimeoutTime;
86
+ /**
87
+ * Creates a initialized {@link module:cloud-services/token/token~Token} instance.
88
+ *
89
+ * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the
90
+ * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.
91
+ */
92
+ static create(tokenUrlOrRefreshToken: TokenUrl, options?: CloudServicesTokenOptions): Promise<InitializedToken>;
92
93
  }
93
94
  /**
94
- * A {@link ~Token} instance that has been initialized.
95
- */
95
+ * A {@link ~Token} instance that has been initialized.
96
+ */
96
97
  export type InitializedToken = Token & {
97
- value: string;
98
+ value: string;
98
99
  };
99
100
  /**
100
- * Options for creating tokens.
101
- */
101
+ * Options for creating tokens.
102
+ */
102
103
  export interface CloudServicesTokenOptions {
103
- /**
104
- * Initial value of the token.
105
- */
106
- initValue?: string;
107
- /**
108
- * Specifies whether to start the refresh automatically.
109
- *
110
- * @default true
111
- */
112
- autoRefresh?: boolean;
104
+ /**
105
+ * Initial value of the token.
106
+ */
107
+ initValue?: string;
108
+ /**
109
+ * Specifies whether to start the refresh automatically.
110
+ *
111
+ * @default true
112
+ */
113
+ autoRefresh?: boolean;
113
114
  }
114
115
  export {};
@@ -1,94 +1,92 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module cloud-services/uploadgateway/fileuploader
7
- */
8
- import type { UploadResponse } from '@ckeditor/ckeditor5-upload';
9
- import type { InitializedToken } from '../token/token.js';
10
- declare const FileUploader_base: {
11
- new (): import("@ckeditor/ckeditor5-utils").Emitter;
12
- prototype: import("@ckeditor/ckeditor5-utils").Emitter;
13
- };
6
+ * @module cloud-services/uploadgateway/fileuploader
7
+ */
8
+ import type { UploadResponse } from "@ckeditor/ckeditor5-upload";
9
+ import { type EmitterMixinConstructor } from "@ckeditor/ckeditor5-utils";
10
+ import type { InitializedToken } from "../token/token.js";
11
+ declare const FileUploaderBase: EmitterMixinConstructor;
14
12
  /**
15
- * FileUploader class used to upload single file.
16
- */
17
- export declare class FileUploader extends /* #__PURE__ */ FileUploader_base {
18
- /**
19
- * A file that is being uploaded.
20
- */
21
- readonly file: Blob;
22
- xhr?: XMLHttpRequest;
23
- /**
24
- * CKEditor Cloud Services access token.
25
- */
26
- private readonly _token;
27
- /**
28
- * CKEditor Cloud Services API address.
29
- */
30
- private readonly _apiAddress;
31
- /**
32
- * Creates `FileUploader` instance.
33
- *
34
- * @param fileOrData A blob object or a data string encoded with Base64.
35
- * @param token Token used for authentication.
36
- * @param apiAddress API address.
37
- */
38
- constructor(fileOrData: string | Blob, token: InitializedToken, apiAddress: string);
39
- /**
40
- * Registers callback on `progress` event.
41
- */
42
- onProgress(callback: (status: {
43
- total: number;
44
- uploaded: number;
45
- }) => void): this;
46
- /**
47
- * Registers callback on `error` event. Event is called once when error occurs.
48
- */
49
- onError(callback: (error: string) => void): this;
50
- /**
51
- * Aborts upload process.
52
- */
53
- abort(): void;
54
- /**
55
- * Sends XHR request to API.
56
- */
57
- send(): Promise<UploadResponse>;
58
- /**
59
- * Prepares XHR request.
60
- */
61
- private _prepareRequest;
62
- /**
63
- * Attaches listeners to the XHR.
64
- */
65
- private _attachXHRListeners;
66
- /**
67
- * Sends XHR request.
68
- */
69
- private _sendRequest;
13
+ * FileUploader class used to upload single file.
14
+ */
15
+ export declare class FileUploader extends FileUploaderBase {
16
+ /**
17
+ * A file that is being uploaded.
18
+ */
19
+ readonly file: Blob;
20
+ xhr?: XMLHttpRequest;
21
+ /**
22
+ * CKEditor Cloud Services access token.
23
+ */
24
+ private readonly _token;
25
+ /**
26
+ * CKEditor Cloud Services API address.
27
+ */
28
+ private readonly _apiAddress;
29
+ /**
30
+ * Creates `FileUploader` instance.
31
+ *
32
+ * @param fileOrData A blob object or a data string encoded with Base64.
33
+ * @param token Token used for authentication.
34
+ * @param apiAddress API address.
35
+ */
36
+ constructor(fileOrData: string | Blob, token: InitializedToken, apiAddress: string);
37
+ /**
38
+ * Registers callback on `progress` event.
39
+ */
40
+ onProgress(callback: (status: {
41
+ total: number;
42
+ uploaded: number;
43
+ }) => void): this;
44
+ /**
45
+ * Registers callback on `error` event. Event is called once when error occurs.
46
+ */
47
+ onError(callback: (error: string) => void): this;
48
+ /**
49
+ * Aborts upload process.
50
+ */
51
+ abort(): void;
52
+ /**
53
+ * Sends XHR request to API.
54
+ */
55
+ send(): Promise<UploadResponse>;
56
+ /**
57
+ * Prepares XHR request.
58
+ */
59
+ private _prepareRequest;
60
+ /**
61
+ * Attaches listeners to the XHR.
62
+ */
63
+ private _attachXHRListeners;
64
+ /**
65
+ * Sends XHR request.
66
+ */
67
+ private _sendRequest;
70
68
  }
71
69
  /**
72
- * Fired when error occurs.
73
- *
74
- * @eventName ~FileUploader#error
75
- * @param error Error message
76
- */
70
+ * Fired when error occurs.
71
+ *
72
+ * @eventName ~FileUploader#error
73
+ * @param error Error message
74
+ */
77
75
  export type CloudServicesFileUploaderErrorEvent = {
78
- name: 'error';
79
- args: [error: string];
76
+ name: "error";
77
+ args: [error: string];
80
78
  };
81
79
  /**
82
- * Fired on upload progress.
83
- *
84
- * @eventName ~FileUploader#progress
85
- * @param status Total and uploaded status
86
- */
80
+ * Fired on upload progress.
81
+ *
82
+ * @eventName ~FileUploader#progress
83
+ * @param status Total and uploaded status
84
+ */
87
85
  export type CloudServicesFileUploaderProgressErrorEvent = {
88
- name: 'progress';
89
- args: [status: {
90
- total: number;
91
- uploaded: number;
92
- }];
86
+ name: "progress";
87
+ args: [status: {
88
+ total: number;
89
+ uploaded: number;
90
+ }];
93
91
  };
94
92
  export {};
@@ -1,47 +1,47 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module cloud-services/uploadgateway/uploadgateway
7
- */
8
- import { FileUploader } from './fileuploader.js';
9
- import type { InitializedToken } from '../token/token.js';
6
+ * @module cloud-services/uploadgateway/uploadgateway
7
+ */
8
+ import { FileUploader } from "./fileuploader.js";
9
+ import type { InitializedToken } from "../token/token.js";
10
10
  /**
11
- * UploadGateway abstracts file uploads to CKEditor Cloud Services.
12
- */
11
+ * UploadGateway abstracts file uploads to CKEditor Cloud Services.
12
+ */
13
13
  export declare class UploadGateway {
14
- /**
15
- * CKEditor Cloud Services access token.
16
- */
17
- private readonly _token;
18
- /**
19
- * CKEditor Cloud Services API address.
20
- */
21
- private readonly _apiAddress;
22
- /**
23
- * Creates `UploadGateway` instance.
24
- *
25
- * @param token Token used for authentication.
26
- * @param apiAddress API address.
27
- */
28
- constructor(token: InitializedToken, apiAddress: string);
29
- /**
30
- * Creates a {@link module:cloud-services/uploadgateway/fileuploader~FileUploader} instance that wraps
31
- * file upload process. The file is being sent at a time when the
32
- * {@link module:cloud-services/uploadgateway/fileuploader~FileUploader#send} method is called.
33
- *
34
- * ```ts
35
- * const token = await Token.create( 'https://token-endpoint' );
36
- * new UploadGateway( token, 'https://example.org' )
37
- * .upload( 'FILE' )
38
- * .onProgress( ( data ) => console.log( data ) )
39
- * .send()
40
- * .then( ( response ) => console.log( response ) );
41
- * ```
42
- *
43
- * @param {Blob|String} fileOrData A blob object or a data string encoded with Base64.
44
- * @returns {module:cloud-services/uploadgateway/fileuploader~FileUploader} Returns `FileUploader` instance.
45
- */
46
- upload(fileOrData: string | Blob): FileUploader;
14
+ /**
15
+ * CKEditor Cloud Services access token.
16
+ */
17
+ private readonly _token;
18
+ /**
19
+ * CKEditor Cloud Services API address.
20
+ */
21
+ private readonly _apiAddress;
22
+ /**
23
+ * Creates `UploadGateway` instance.
24
+ *
25
+ * @param token Token used for authentication.
26
+ * @param apiAddress API address.
27
+ */
28
+ constructor(token: InitializedToken, apiAddress: string);
29
+ /**
30
+ * Creates a {@link module:cloud-services/uploadgateway/fileuploader~FileUploader} instance that wraps
31
+ * file upload process. The file is being sent at a time when the
32
+ * {@link module:cloud-services/uploadgateway/fileuploader~FileUploader#send} method is called.
33
+ *
34
+ * ```ts
35
+ * const token = await Token.create( 'https://token-endpoint' );
36
+ * new UploadGateway( token, 'https://example.org' )
37
+ * .upload( 'FILE' )
38
+ * .onProgress( ( data ) => console.log( data ) )
39
+ * .send()
40
+ * .then( ( response ) => console.log( response ) );
41
+ * ```
42
+ *
43
+ * @param {Blob|String} fileOrData A blob object or a data string encoded with Base64.
44
+ * @returns {module:cloud-services/uploadgateway/fileuploader~FileUploader} Returns `FileUploader` instance.
45
+ */
46
+ upload(fileOrData: string | Blob): FileUploader;
47
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-cloud-services",
3
- "version": "48.2.0",
3
+ "version": "48.3.0-alpha.1",
4
4
  "description": "CKEditor 5's Cloud Services integration layer.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "CKSource (http://cksource.com/)",
@@ -25,9 +25,9 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@ckeditor/ckeditor5-core": "48.2.0",
29
- "@ckeditor/ckeditor5-upload": "48.2.0",
30
- "@ckeditor/ckeditor5-utils": "48.2.0"
28
+ "@ckeditor/ckeditor5-core": "48.3.0-alpha.1",
29
+ "@ckeditor/ckeditor5-upload": "48.3.0-alpha.1",
30
+ "@ckeditor/ckeditor5-utils": "48.3.0-alpha.1"
31
31
  },
32
32
  "files": [
33
33
  "dist",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.css"],"names":[],"mappings":";;;;;;AAEA,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC","file":"index.css.map","sourcesContent":["\n\n/*# sourceMappingURL=index.css.map */"]}