@ckeditor/ckeditor5-cloud-services 48.2.0-alpha.7 → 48.3.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/dist/augmentation.d.ts +17 -17
- package/dist/cloudservices.d.ts +87 -87
- package/dist/cloudservicesconfig.d.ts +139 -139
- package/dist/cloudservicescore.d.ts +35 -35
- package/dist/index-content.css +1 -0
- package/dist/index-editor.css +1 -0
- package/dist/index.css +0 -2
- package/dist/index.d.ts +12 -12
- package/dist/index.js +608 -582
- package/dist/index.js.map +1 -1
- package/dist/token/token.d.ts +105 -104
- package/dist/uploadgateway/fileuploader.d.ts +81 -83
- package/dist/uploadgateway/uploadgateway.d.ts +42 -42
- package/package.json +4 -4
- package/dist/index.css.map +0 -1
package/dist/token/token.d.ts
CHANGED
|
@@ -1,114 +1,115 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export declare class Token extends
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
95
|
-
|
|
95
|
+
* A {@link ~Token} instance that has been initialized.
|
|
96
|
+
*/
|
|
96
97
|
export type InitializedToken = Token & {
|
|
97
|
-
|
|
98
|
+
value: string;
|
|
98
99
|
};
|
|
99
100
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
* Options for creating tokens.
|
|
102
|
+
*/
|
|
102
103
|
export interface CloudServicesTokenOptions {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
3
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
import type { UploadResponse } from
|
|
9
|
-
import type
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
export declare class FileUploader extends
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
* Fired when error occurs.
|
|
71
|
+
*
|
|
72
|
+
* @eventName ~FileUploader#error
|
|
73
|
+
* @param error Error message
|
|
74
|
+
*/
|
|
77
75
|
export type CloudServicesFileUploaderErrorEvent = {
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
name: "error";
|
|
77
|
+
args: [error: string];
|
|
80
78
|
};
|
|
81
79
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
3
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
import { FileUploader } from
|
|
9
|
-
import type { InitializedToken } from
|
|
6
|
+
* @module cloud-services/uploadgateway/uploadgateway
|
|
7
|
+
*/
|
|
8
|
+
import { FileUploader } from "./fileuploader.js";
|
|
9
|
+
import type { InitializedToken } from "../token/token.js";
|
|
10
10
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
* UploadGateway abstracts file uploads to CKEditor Cloud Services.
|
|
12
|
+
*/
|
|
13
13
|
export declare class UploadGateway {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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.
|
|
3
|
+
"version": "48.3.0-alpha.0",
|
|
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.
|
|
29
|
-
"@ckeditor/ckeditor5-upload": "48.
|
|
30
|
-
"@ckeditor/ckeditor5-utils": "48.
|
|
28
|
+
"@ckeditor/ckeditor5-core": "48.3.0-alpha.0",
|
|
29
|
+
"@ckeditor/ckeditor5-upload": "48.3.0-alpha.0",
|
|
30
|
+
"@ckeditor/ckeditor5-utils": "48.3.0-alpha.0"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"dist",
|
package/dist/index.css.map
DELETED
|
@@ -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 */"]}
|