@ckeditor/ckeditor5-cloud-services 41.3.0 → 41.4.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.
@@ -0,0 +1,4 @@
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
+ */
@@ -0,0 +1,4 @@
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
+ */
package/dist/index.css ADDED
@@ -0,0 +1,4 @@
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
+ */
package/dist/index.js ADDED
@@ -0,0 +1,471 @@
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
+ import { ContextPlugin } from '@ckeditor/ckeditor5-core/dist/index.js';
6
+ import { ObservableMixin, CKEditorError, EmitterMixin } from '@ckeditor/ckeditor5-utils/dist/index.js';
7
+
8
+ const DEFAULT_OPTIONS = {
9
+ autoRefresh: true
10
+ };
11
+ const DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME = 3600000;
12
+ class Token extends ObservableMixin() {
13
+ /**
14
+ * Initializes the token.
15
+ */ init() {
16
+ return new Promise((resolve, reject)=>{
17
+ if (!this.value) {
18
+ this.refreshToken().then(resolve).catch(reject);
19
+ return;
20
+ }
21
+ if (this._options.autoRefresh) {
22
+ this._registerRefreshTokenTimeout();
23
+ }
24
+ resolve(this);
25
+ });
26
+ }
27
+ /**
28
+ * Refresh token method. Useful in a method form as it can be override in tests.
29
+ */ refreshToken() {
30
+ return this._refresh().then((value)=>{
31
+ this._validateTokenValue(value);
32
+ this.set('value', value);
33
+ if (this._options.autoRefresh) {
34
+ this._registerRefreshTokenTimeout();
35
+ }
36
+ return this;
37
+ });
38
+ }
39
+ /**
40
+ * Destroys token instance. Stops refreshing.
41
+ */ destroy() {
42
+ clearTimeout(this._tokenRefreshTimeout);
43
+ }
44
+ /**
45
+ * Checks whether the provided token follows the JSON Web Tokens (JWT) format.
46
+ *
47
+ * @param tokenValue The token to validate.
48
+ */ _validateTokenValue(tokenValue) {
49
+ // The token must be a string.
50
+ const isString = typeof tokenValue === 'string';
51
+ // The token must be a plain string without quotes ("").
52
+ const isPlainString = !/^".*"$/.test(tokenValue);
53
+ // JWT token contains 3 parts: header, payload, and signature.
54
+ // Each part is separated by a dot.
55
+ const isJWTFormat = isString && tokenValue.split('.').length === 3;
56
+ if (!(isPlainString && isJWTFormat)) {
57
+ /**
58
+ * The provided token must follow the [JSON Web Tokens](https://jwt.io/introduction/) format.
59
+ *
60
+ * @error token-not-in-jwt-format
61
+ */ throw new CKEditorError('token-not-in-jwt-format', this);
62
+ }
63
+ }
64
+ /**
65
+ * Registers a refresh token timeout for the time taken from token.
66
+ */ _registerRefreshTokenTimeout() {
67
+ const tokenRefreshTimeoutTime = this._getTokenRefreshTimeoutTime();
68
+ clearTimeout(this._tokenRefreshTimeout);
69
+ this._tokenRefreshTimeout = setTimeout(()=>{
70
+ this.refreshToken();
71
+ }, tokenRefreshTimeoutTime);
72
+ }
73
+ /**
74
+ * Returns token refresh timeout time calculated from expire time in the token payload.
75
+ *
76
+ * If the token parse fails or the token payload doesn't contain, the default DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME is returned.
77
+ */ _getTokenRefreshTimeoutTime() {
78
+ try {
79
+ const [, binaryTokenPayload] = this.value.split('.');
80
+ const { exp: tokenExpireTime } = JSON.parse(atob(binaryTokenPayload));
81
+ if (!tokenExpireTime) {
82
+ return DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME;
83
+ }
84
+ const tokenRefreshTimeoutTime = Math.floor((tokenExpireTime * 1000 - Date.now()) / 2);
85
+ return tokenRefreshTimeoutTime;
86
+ } catch (err) {
87
+ return DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME;
88
+ }
89
+ }
90
+ /**
91
+ * Creates a initialized {@link module:cloud-services/token/token~Token} instance.
92
+ *
93
+ * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the
94
+ * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.
95
+ */ static create(tokenUrlOrRefreshToken, options = {}) {
96
+ const token = new Token(tokenUrlOrRefreshToken, options);
97
+ return token.init();
98
+ }
99
+ /**
100
+ * Creates `Token` instance.
101
+ * Method `init` should be called after using the constructor or use `create` method instead.
102
+ *
103
+ * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the
104
+ * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.
105
+ */ constructor(tokenUrlOrRefreshToken, options = {}){
106
+ super();
107
+ if (!tokenUrlOrRefreshToken) {
108
+ /**
109
+ * A `tokenUrl` must be provided as the first constructor argument.
110
+ *
111
+ * @error token-missing-token-url
112
+ */ throw new CKEditorError('token-missing-token-url', this);
113
+ }
114
+ if (options.initValue) {
115
+ this._validateTokenValue(options.initValue);
116
+ }
117
+ this.set('value', options.initValue);
118
+ if (typeof tokenUrlOrRefreshToken === 'function') {
119
+ this._refresh = tokenUrlOrRefreshToken;
120
+ } else {
121
+ this._refresh = ()=>defaultRefreshToken(tokenUrlOrRefreshToken);
122
+ }
123
+ this._options = {
124
+ ...DEFAULT_OPTIONS,
125
+ ...options
126
+ };
127
+ }
128
+ }
129
+ /**
130
+ * This function is called in a defined interval by the {@link ~Token} class. It also can be invoked manually.
131
+ * It should return a promise, which resolves with the new token value.
132
+ * If any error occurs it should return a rejected promise with an error message.
133
+ */ function defaultRefreshToken(tokenUrl) {
134
+ return new Promise((resolve, reject)=>{
135
+ const xhr = new XMLHttpRequest();
136
+ xhr.open('GET', tokenUrl);
137
+ xhr.addEventListener('load', ()=>{
138
+ const statusCode = xhr.status;
139
+ const xhrResponse = xhr.response;
140
+ if (statusCode < 200 || statusCode > 299) {
141
+ /**
142
+ * Cannot download new token from the provided url.
143
+ *
144
+ * @error token-cannot-download-new-token
145
+ */ return reject(new CKEditorError('token-cannot-download-new-token', null));
146
+ }
147
+ return resolve(xhrResponse);
148
+ });
149
+ xhr.addEventListener('error', ()=>reject(new Error('Network Error')));
150
+ xhr.addEventListener('abort', ()=>reject(new Error('Abort')));
151
+ xhr.send();
152
+ });
153
+ }
154
+
155
+ const BASE64_HEADER_REG_EXP = /^data:(\S*?);base64,/;
156
+ class FileUploader extends EmitterMixin() {
157
+ /**
158
+ * Registers callback on `progress` event.
159
+ */ onProgress(callback) {
160
+ this.on('progress', (event, data)=>callback(data));
161
+ return this;
162
+ }
163
+ /**
164
+ * Registers callback on `error` event. Event is called once when error occurs.
165
+ */ onError(callback) {
166
+ this.once('error', (event, data)=>callback(data));
167
+ return this;
168
+ }
169
+ /**
170
+ * Aborts upload process.
171
+ */ abort() {
172
+ this.xhr.abort();
173
+ }
174
+ /**
175
+ * Sends XHR request to API.
176
+ */ send() {
177
+ this._prepareRequest();
178
+ this._attachXHRListeners();
179
+ return this._sendRequest();
180
+ }
181
+ /**
182
+ * Prepares XHR request.
183
+ */ _prepareRequest() {
184
+ const xhr = new XMLHttpRequest();
185
+ xhr.open('POST', this._apiAddress);
186
+ xhr.setRequestHeader('Authorization', this._token.value);
187
+ xhr.responseType = 'json';
188
+ this.xhr = xhr;
189
+ }
190
+ /**
191
+ * Attaches listeners to the XHR.
192
+ */ _attachXHRListeners() {
193
+ const xhr = this.xhr;
194
+ const onError = (message)=>{
195
+ return ()=>this.fire('error', message);
196
+ };
197
+ xhr.addEventListener('error', onError('Network Error'));
198
+ xhr.addEventListener('abort', onError('Abort'));
199
+ /* istanbul ignore else -- @preserve */ if (xhr.upload) {
200
+ xhr.upload.addEventListener('progress', (event)=>{
201
+ if (event.lengthComputable) {
202
+ this.fire('progress', {
203
+ total: event.total,
204
+ uploaded: event.loaded
205
+ });
206
+ }
207
+ });
208
+ }
209
+ xhr.addEventListener('load', ()=>{
210
+ const statusCode = xhr.status;
211
+ const xhrResponse = xhr.response;
212
+ if (statusCode < 200 || statusCode > 299) {
213
+ return this.fire('error', xhrResponse.message || xhrResponse.error);
214
+ }
215
+ });
216
+ }
217
+ /**
218
+ * Sends XHR request.
219
+ */ _sendRequest() {
220
+ const formData = new FormData();
221
+ const xhr = this.xhr;
222
+ formData.append('file', this.file);
223
+ return new Promise((resolve, reject)=>{
224
+ xhr.addEventListener('load', ()=>{
225
+ const statusCode = xhr.status;
226
+ const xhrResponse = xhr.response;
227
+ if (statusCode < 200 || statusCode > 299) {
228
+ if (xhrResponse.message) {
229
+ /**
230
+ * Uploading file failed.
231
+ *
232
+ * @error fileuploader-uploading-data-failed
233
+ */ return reject(new CKEditorError('fileuploader-uploading-data-failed', this, {
234
+ message: xhrResponse.message
235
+ }));
236
+ }
237
+ return reject(xhrResponse.error);
238
+ }
239
+ return resolve(xhrResponse);
240
+ });
241
+ xhr.addEventListener('error', ()=>reject(new Error('Network Error')));
242
+ xhr.addEventListener('abort', ()=>reject(new Error('Abort')));
243
+ xhr.send(formData);
244
+ });
245
+ }
246
+ /**
247
+ * Creates `FileUploader` instance.
248
+ *
249
+ * @param fileOrData A blob object or a data string encoded with Base64.
250
+ * @param token Token used for authentication.
251
+ * @param apiAddress API address.
252
+ */ constructor(fileOrData, token, apiAddress){
253
+ super();
254
+ if (!fileOrData) {
255
+ /**
256
+ * File must be provided as the first argument.
257
+ *
258
+ * @error fileuploader-missing-file
259
+ */ throw new CKEditorError('fileuploader-missing-file', null);
260
+ }
261
+ if (!token) {
262
+ /**
263
+ * Token must be provided as the second argument.
264
+ *
265
+ * @error fileuploader-missing-token
266
+ */ throw new CKEditorError('fileuploader-missing-token', null);
267
+ }
268
+ if (!apiAddress) {
269
+ /**
270
+ * Api address must be provided as the third argument.
271
+ *
272
+ * @error fileuploader-missing-api-address
273
+ */ throw new CKEditorError('fileuploader-missing-api-address', null);
274
+ }
275
+ this.file = _isBase64(fileOrData) ? _base64ToBlob(fileOrData) : fileOrData;
276
+ this._token = token;
277
+ this._apiAddress = apiAddress;
278
+ }
279
+ }
280
+ /**
281
+ * Transforms Base64 string data into file.
282
+ *
283
+ * @param base64 String data.
284
+ */ function _base64ToBlob(base64, sliceSize = 512) {
285
+ try {
286
+ const contentType = base64.match(BASE64_HEADER_REG_EXP)[1];
287
+ const base64Data = atob(base64.replace(BASE64_HEADER_REG_EXP, ''));
288
+ const byteArrays = [];
289
+ for(let offset = 0; offset < base64Data.length; offset += sliceSize){
290
+ const slice = base64Data.slice(offset, offset + sliceSize);
291
+ const byteNumbers = new Array(slice.length);
292
+ for(let i = 0; i < slice.length; i++){
293
+ byteNumbers[i] = slice.charCodeAt(i);
294
+ }
295
+ byteArrays.push(new Uint8Array(byteNumbers));
296
+ }
297
+ return new Blob(byteArrays, {
298
+ type: contentType
299
+ });
300
+ } catch (error) {
301
+ /**
302
+ * Problem with decoding Base64 image data.
303
+ *
304
+ * @error fileuploader-decoding-image-data-error
305
+ */ throw new CKEditorError('fileuploader-decoding-image-data-error', null);
306
+ }
307
+ }
308
+ /**
309
+ * Checks that string is Base64.
310
+ */ function _isBase64(string) {
311
+ if (typeof string !== 'string') {
312
+ return false;
313
+ }
314
+ const match = string.match(BASE64_HEADER_REG_EXP);
315
+ return !!(match && match.length);
316
+ }
317
+
318
+ class UploadGateway {
319
+ /**
320
+ * Creates a {@link module:cloud-services/uploadgateway/fileuploader~FileUploader} instance that wraps
321
+ * file upload process. The file is being sent at a time when the
322
+ * {@link module:cloud-services/uploadgateway/fileuploader~FileUploader#send} method is called.
323
+ *
324
+ * ```ts
325
+ * const token = await Token.create( 'https://token-endpoint' );
326
+ * new UploadGateway( token, 'https://example.org' )
327
+ * .upload( 'FILE' )
328
+ * .onProgress( ( data ) => console.log( data ) )
329
+ * .send()
330
+ * .then( ( response ) => console.log( response ) );
331
+ * ```
332
+ *
333
+ * @param {Blob|String} fileOrData A blob object or a data string encoded with Base64.
334
+ * @returns {module:cloud-services/uploadgateway/fileuploader~FileUploader} Returns `FileUploader` instance.
335
+ */ upload(fileOrData) {
336
+ return new FileUploader(fileOrData, this._token, this._apiAddress);
337
+ }
338
+ /**
339
+ * Creates `UploadGateway` instance.
340
+ *
341
+ * @param token Token used for authentication.
342
+ * @param apiAddress API address.
343
+ */ constructor(token, apiAddress){
344
+ if (!token) {
345
+ /**
346
+ * Token must be provided.
347
+ *
348
+ * @error uploadgateway-missing-token
349
+ */ throw new CKEditorError('uploadgateway-missing-token', null);
350
+ }
351
+ if (!apiAddress) {
352
+ /**
353
+ * Api address must be provided.
354
+ *
355
+ * @error uploadgateway-missing-api-address
356
+ */ throw new CKEditorError('uploadgateway-missing-api-address', null);
357
+ }
358
+ this._token = token;
359
+ this._apiAddress = apiAddress;
360
+ }
361
+ }
362
+
363
+ class CloudServicesCore extends ContextPlugin {
364
+ /**
365
+ * @inheritDoc
366
+ */ static get pluginName() {
367
+ return 'CloudServicesCore';
368
+ }
369
+ /**
370
+ * Creates the {@link module:cloud-services/token/token~Token} instance.
371
+ *
372
+ * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the
373
+ * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.
374
+ * @param options.initValue Initial value of the token.
375
+ * @param options.autoRefresh Specifies whether to start the refresh automatically.
376
+ */ createToken(tokenUrlOrRefreshToken, options) {
377
+ return new Token(tokenUrlOrRefreshToken, options);
378
+ }
379
+ /**
380
+ * Creates the {@link module:cloud-services/uploadgateway/uploadgateway~UploadGateway} instance.
381
+ *
382
+ * @param token Token used for authentication.
383
+ * @param apiAddress API address.
384
+ */ createUploadGateway(token, apiAddress) {
385
+ return new UploadGateway(token, apiAddress);
386
+ }
387
+ }
388
+
389
+ class CloudServices extends ContextPlugin {
390
+ /**
391
+ * @inheritDoc
392
+ */ static get pluginName() {
393
+ return 'CloudServices';
394
+ }
395
+ /**
396
+ * @inheritDoc
397
+ */ static get requires() {
398
+ return [
399
+ CloudServicesCore
400
+ ];
401
+ }
402
+ /**
403
+ * @inheritDoc
404
+ */ async init() {
405
+ const config = this.context.config;
406
+ const options = config.get('cloudServices') || {};
407
+ for (const [key, value] of Object.entries(options)){
408
+ this[key] = value;
409
+ }
410
+ if (!this.tokenUrl) {
411
+ this.token = null;
412
+ return;
413
+ }
414
+ const cloudServicesCore = this.context.plugins.get('CloudServicesCore');
415
+ this.token = await cloudServicesCore.createToken(this.tokenUrl).init();
416
+ this._tokens.set(this.tokenUrl, this.token);
417
+ }
418
+ /**
419
+ * Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
420
+ * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
421
+ *
422
+ * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
423
+ */ async registerTokenUrl(tokenUrl) {
424
+ // Reuse the token instance in case of multiple features using the same token URL.
425
+ if (this._tokens.has(tokenUrl)) {
426
+ return this.getTokenFor(tokenUrl);
427
+ }
428
+ const cloudServicesCore = this.context.plugins.get('CloudServicesCore');
429
+ const token = await cloudServicesCore.createToken(tokenUrl).init();
430
+ this._tokens.set(tokenUrl, token);
431
+ return token;
432
+ }
433
+ /**
434
+ * Returns an authentication token provider previously registered by {@link #registerTokenUrl}.
435
+ *
436
+ * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
437
+ */ getTokenFor(tokenUrl) {
438
+ const token = this._tokens.get(tokenUrl);
439
+ if (!token) {
440
+ /**
441
+ * The provided `tokenUrl` was not registered by {@link module:cloud-services/cloudservices~CloudServices#registerTokenUrl}.
442
+ *
443
+ * @error cloudservices-token-not-registered
444
+ */ throw new CKEditorError('cloudservices-token-not-registered', this);
445
+ }
446
+ return token;
447
+ }
448
+ /**
449
+ * @inheritDoc
450
+ */ destroy() {
451
+ super.destroy();
452
+ for (const token of this._tokens.values()){
453
+ token.destroy();
454
+ }
455
+ }
456
+ constructor(){
457
+ super(...arguments);
458
+ /**
459
+ * Other plugins use this token for the authorization process. It handles token requesting and refreshing.
460
+ * Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.
461
+ *
462
+ * @readonly
463
+ */ this.token = null;
464
+ /**
465
+ * A map of token object instances keyed by the token URLs.
466
+ */ this._tokens = new Map();
467
+ }
468
+ }
469
+
470
+ export { CloudServices, CloudServicesCore };
471
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.js","../src/token/token.ts","../src/uploadgateway/fileuploader.ts","../src/uploadgateway/uploadgateway.ts","../src/cloudservicescore.ts","../src/cloudservices.ts"],"names":["DEFAULT_OPTIONS","autoRefresh","DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME","Token","ObservableMixin","init","Promise","resolve","reject","value","refreshToken","then","catch","_options","_registerRefreshTokenTimeout","_refresh","_validateTokenValue","set","destroy","clearTimeout","_tokenRefreshTimeout","tokenValue","isString","isPlainString","test","isJWTFormat","split","length","CKEditorError","tokenRefreshTimeoutTime","_getTokenRefreshTimeoutTime","setTimeout","binaryTokenPayload","exp","tokenExpireTime","JSON","parse","atob","Math","floor","Date","now","err","create","tokenUrlOrRefreshToken","options","token","constructor","initValue","defaultRefreshToken","tokenUrl","xhr","XMLHttpRequest","open","addEventListener","statusCode","status","xhrResponse","response","Error","send","BASE64_HEADER_REG_EXP","FileUploader","EmitterMixin","onProgress","callback","on","event","data","onError","once","abort","_prepareRequest","_attachXHRListeners","_sendRequest","_apiAddress","setRequestHeader","_token","responseType","message","fire","upload","lengthComputable","total","uploaded","loaded","error","formData","FormData","append","file","fileOrData","apiAddress","_isBase64","_base64ToBlob","base64","sliceSize","contentType","match","base64Data","replace","byteArrays","offset","slice","byteNumbers","Array","i","charCodeAt","push","Uint8Array","Blob","type","string","UploadGateway","CloudServicesCore","ContextPlugin","pluginName","createToken","createUploadGateway","CloudServices","requires","config","context","get","key","Object","entries","cloudServicesCore","plugins","_tokens","registerTokenUrl","has","getTokenFor","values","Map"],"mappings":";;;;AAAA,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACvE,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,aAAa,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACvG;ACYA,KAAA,CAAMA,eAAkB,CAAA,CAAA,CAAA,CAAA;ADVxB,CCU0BC,CAAAA,CAAAA,CAAAA,WAAa,CAAA,CAAA,IAAA;ADTvC,CAAC,CAAC;ACUF,KAAMC,CAAAA,kCAAqC,CAAA,CAAA,CAAA,OAAA,CAAA;AAM7B,KAAA,CAAOC,KAAcC,CAAAA,OAAAA,CAAAA,eAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AA0DlC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;ADtED,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC;ACwEzB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACIC,IAAI,CAAA,CAAA,CAAA,CAAA;ADvEZ,CCwEE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAO,GAAA,CAAIC,OAAS,CAAA,CAAEC,OAASC,CAAAA,CAAAA,MAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAC9B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,C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CAAC,EAAE,CAAC,GAAG","file":"index.js.map","sourcesContent":["import { ContextPlugin } from '@ckeditor/ckeditor5-core/dist/index.js';\nimport { ObservableMixin, CKEditorError, EmitterMixin } from '@ckeditor/ckeditor5-utils/dist/index.js';\n\nconst DEFAULT_OPTIONS = {\n autoRefresh: true\n};\nconst DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME = 3600000;\nclass Token extends ObservableMixin() {\n /**\n * Initializes the token.\n */ init() {\n return new Promise((resolve, reject)=>{\n if (!this.value) {\n this.refreshToken().then(resolve).catch(reject);\n return;\n }\n if (this._options.autoRefresh) {\n this._registerRefreshTokenTimeout();\n }\n resolve(this);\n });\n }\n /**\n * Refresh token method. Useful in a method form as it can be override in tests.\n */ refreshToken() {\n return this._refresh().then((value)=>{\n this._validateTokenValue(value);\n this.set('value', value);\n if (this._options.autoRefresh) {\n this._registerRefreshTokenTimeout();\n }\n return this;\n });\n }\n /**\n * Destroys token instance. Stops refreshing.\n */ destroy() {\n clearTimeout(this._tokenRefreshTimeout);\n }\n /**\n * Checks whether the provided token follows the JSON Web Tokens (JWT) format.\n *\n * @param tokenValue The token to validate.\n */ _validateTokenValue(tokenValue) {\n // The token must be a string.\n const isString = typeof tokenValue === 'string';\n // The token must be a plain string without quotes (\"\").\n const isPlainString = !/^\".*\"$/.test(tokenValue);\n // JWT token contains 3 parts: header, payload, and signature.\n // Each part is separated by a dot.\n const isJWTFormat = isString && tokenValue.split('.').length === 3;\n if (!(isPlainString && isJWTFormat)) {\n /**\n * The provided token must follow the [JSON Web Tokens](https://jwt.io/introduction/) format.\n *\n * @error token-not-in-jwt-format\n */ throw new CKEditorError('token-not-in-jwt-format', this);\n }\n }\n /**\n * Registers a refresh token timeout for the time taken from token.\n */ _registerRefreshTokenTimeout() {\n const tokenRefreshTimeoutTime = this._getTokenRefreshTimeoutTime();\n clearTimeout(this._tokenRefreshTimeout);\n this._tokenRefreshTimeout = setTimeout(()=>{\n this.refreshToken();\n }, tokenRefreshTimeoutTime);\n }\n /**\n * Returns token refresh timeout time calculated from expire time in the token payload.\n *\n * If the token parse fails or the token payload doesn't contain, the default DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME is returned.\n */ _getTokenRefreshTimeoutTime() {\n try {\n const [, binaryTokenPayload] = this.value.split('.');\n const { exp: tokenExpireTime } = JSON.parse(atob(binaryTokenPayload));\n if (!tokenExpireTime) {\n return DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME;\n }\n const tokenRefreshTimeoutTime = Math.floor((tokenExpireTime * 1000 - Date.now()) / 2);\n return tokenRefreshTimeoutTime;\n } catch (err) {\n return DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME;\n }\n }\n /**\n * Creates a initialized {@link module:cloud-services/token/token~Token} instance.\n *\n * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the\n * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.\n */ static create(tokenUrlOrRefreshToken, options = {}) {\n const token = new Token(tokenUrlOrRefreshToken, options);\n return token.init();\n }\n /**\n * Creates `Token` instance.\n * Method `init` should be called after using the constructor or use `create` method instead.\n *\n * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the\n * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.\n */ constructor(tokenUrlOrRefreshToken, options = {}){\n super();\n if (!tokenUrlOrRefreshToken) {\n /**\n * A `tokenUrl` must be provided as the first constructor argument.\n *\n * @error token-missing-token-url\n */ throw new CKEditorError('token-missing-token-url', this);\n }\n if (options.initValue) {\n this._validateTokenValue(options.initValue);\n }\n this.set('value', options.initValue);\n if (typeof tokenUrlOrRefreshToken === 'function') {\n this._refresh = tokenUrlOrRefreshToken;\n } else {\n this._refresh = ()=>defaultRefreshToken(tokenUrlOrRefreshToken);\n }\n this._options = {\n ...DEFAULT_OPTIONS,\n ...options\n };\n }\n}\n/**\n * This function is called in a defined interval by the {@link ~Token} class. It also can be invoked manually.\n * It should return a promise, which resolves with the new token value.\n * If any error occurs it should return a rejected promise with an error message.\n */ function defaultRefreshToken(tokenUrl) {\n return new Promise((resolve, reject)=>{\n const xhr = new XMLHttpRequest();\n xhr.open('GET', tokenUrl);\n xhr.addEventListener('load', ()=>{\n const statusCode = xhr.status;\n const xhrResponse = xhr.response;\n if (statusCode < 200 || statusCode > 299) {\n /**\n * Cannot download new token from the provided url.\n *\n * @error token-cannot-download-new-token\n */ return reject(new CKEditorError('token-cannot-download-new-token', null));\n }\n return resolve(xhrResponse);\n });\n xhr.addEventListener('error', ()=>reject(new Error('Network Error')));\n xhr.addEventListener('abort', ()=>reject(new Error('Abort')));\n xhr.send();\n });\n}\n\nconst BASE64_HEADER_REG_EXP = /^data:(\\S*?);base64,/;\nclass FileUploader extends EmitterMixin() {\n /**\n * Registers callback on `progress` event.\n */ onProgress(callback) {\n this.on('progress', (event, data)=>callback(data));\n return this;\n }\n /**\n * Registers callback on `error` event. Event is called once when error occurs.\n */ onError(callback) {\n this.once('error', (event, data)=>callback(data));\n return this;\n }\n /**\n * Aborts upload process.\n */ abort() {\n this.xhr.abort();\n }\n /**\n * Sends XHR request to API.\n */ send() {\n this._prepareRequest();\n this._attachXHRListeners();\n return this._sendRequest();\n }\n /**\n * Prepares XHR request.\n */ _prepareRequest() {\n const xhr = new XMLHttpRequest();\n xhr.open('POST', this._apiAddress);\n xhr.setRequestHeader('Authorization', this._token.value);\n xhr.responseType = 'json';\n this.xhr = xhr;\n }\n /**\n * Attaches listeners to the XHR.\n */ _attachXHRListeners() {\n const xhr = this.xhr;\n const onError = (message)=>{\n return ()=>this.fire('error', message);\n };\n xhr.addEventListener('error', onError('Network Error'));\n xhr.addEventListener('abort', onError('Abort'));\n /* istanbul ignore else -- @preserve */ if (xhr.upload) {\n xhr.upload.addEventListener('progress', (event)=>{\n if (event.lengthComputable) {\n this.fire('progress', {\n total: event.total,\n uploaded: event.loaded\n });\n }\n });\n }\n xhr.addEventListener('load', ()=>{\n const statusCode = xhr.status;\n const xhrResponse = xhr.response;\n if (statusCode < 200 || statusCode > 299) {\n return this.fire('error', xhrResponse.message || xhrResponse.error);\n }\n });\n }\n /**\n * Sends XHR request.\n */ _sendRequest() {\n const formData = new FormData();\n const xhr = this.xhr;\n formData.append('file', this.file);\n return new Promise((resolve, reject)=>{\n xhr.addEventListener('load', ()=>{\n const statusCode = xhr.status;\n const xhrResponse = xhr.response;\n if (statusCode < 200 || statusCode > 299) {\n if (xhrResponse.message) {\n /**\n * Uploading file failed.\n *\n * @error fileuploader-uploading-data-failed\n */ return reject(new CKEditorError('fileuploader-uploading-data-failed', this, {\n message: xhrResponse.message\n }));\n }\n return reject(xhrResponse.error);\n }\n return resolve(xhrResponse);\n });\n xhr.addEventListener('error', ()=>reject(new Error('Network Error')));\n xhr.addEventListener('abort', ()=>reject(new Error('Abort')));\n xhr.send(formData);\n });\n }\n /**\n * Creates `FileUploader` instance.\n *\n * @param fileOrData A blob object or a data string encoded with Base64.\n * @param token Token used for authentication.\n * @param apiAddress API address.\n */ constructor(fileOrData, token, apiAddress){\n super();\n if (!fileOrData) {\n /**\n * File must be provided as the first argument.\n *\n * @error fileuploader-missing-file\n */ throw new CKEditorError('fileuploader-missing-file', null);\n }\n if (!token) {\n /**\n * Token must be provided as the second argument.\n *\n * @error fileuploader-missing-token\n */ throw new CKEditorError('fileuploader-missing-token', null);\n }\n if (!apiAddress) {\n /**\n * Api address must be provided as the third argument.\n *\n * @error fileuploader-missing-api-address\n */ throw new CKEditorError('fileuploader-missing-api-address', null);\n }\n this.file = _isBase64(fileOrData) ? _base64ToBlob(fileOrData) : fileOrData;\n this._token = token;\n this._apiAddress = apiAddress;\n }\n}\n/**\n * Transforms Base64 string data into file.\n *\n * @param base64 String data.\n */ function _base64ToBlob(base64, sliceSize = 512) {\n try {\n const contentType = base64.match(BASE64_HEADER_REG_EXP)[1];\n const base64Data = atob(base64.replace(BASE64_HEADER_REG_EXP, ''));\n const byteArrays = [];\n for(let offset = 0; offset < base64Data.length; offset += sliceSize){\n const slice = base64Data.slice(offset, offset + sliceSize);\n const byteNumbers = new Array(slice.length);\n for(let i = 0; i < slice.length; i++){\n byteNumbers[i] = slice.charCodeAt(i);\n }\n byteArrays.push(new Uint8Array(byteNumbers));\n }\n return new Blob(byteArrays, {\n type: contentType\n });\n } catch (error) {\n /**\n * Problem with decoding Base64 image data.\n *\n * @error fileuploader-decoding-image-data-error\n */ throw new CKEditorError('fileuploader-decoding-image-data-error', null);\n }\n}\n/**\n * Checks that string is Base64.\n */ function _isBase64(string) {\n if (typeof string !== 'string') {\n return false;\n }\n const match = string.match(BASE64_HEADER_REG_EXP);\n return !!(match && match.length);\n}\n\nclass UploadGateway {\n /**\n * Creates a {@link module:cloud-services/uploadgateway/fileuploader~FileUploader} instance that wraps\n * file upload process. The file is being sent at a time when the\n * {@link module:cloud-services/uploadgateway/fileuploader~FileUploader#send} method is called.\n *\n * ```ts\n * const token = await Token.create( 'https://token-endpoint' );\n * new UploadGateway( token, 'https://example.org' )\n * \t.upload( 'FILE' )\n * \t.onProgress( ( data ) => console.log( data ) )\n * \t.send()\n * \t.then( ( response ) => console.log( response ) );\n * ```\n *\n * @param {Blob|String} fileOrData A blob object or a data string encoded with Base64.\n * @returns {module:cloud-services/uploadgateway/fileuploader~FileUploader} Returns `FileUploader` instance.\n */ upload(fileOrData) {\n return new FileUploader(fileOrData, this._token, this._apiAddress);\n }\n /**\n * Creates `UploadGateway` instance.\n *\n * @param token Token used for authentication.\n * @param apiAddress API address.\n */ constructor(token, apiAddress){\n if (!token) {\n /**\n * Token must be provided.\n *\n * @error uploadgateway-missing-token\n */ throw new CKEditorError('uploadgateway-missing-token', null);\n }\n if (!apiAddress) {\n /**\n * Api address must be provided.\n *\n * @error uploadgateway-missing-api-address\n */ throw new CKEditorError('uploadgateway-missing-api-address', null);\n }\n this._token = token;\n this._apiAddress = apiAddress;\n }\n}\n\nclass CloudServicesCore extends ContextPlugin {\n /**\n * @inheritDoc\n */ static get pluginName() {\n return 'CloudServicesCore';\n }\n /**\n * Creates the {@link module:cloud-services/token/token~Token} instance.\n *\n * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the\n * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.\n * @param options.initValue Initial value of the token.\n * @param options.autoRefresh Specifies whether to start the refresh automatically.\n */ createToken(tokenUrlOrRefreshToken, options) {\n return new Token(tokenUrlOrRefreshToken, options);\n }\n /**\n * Creates the {@link module:cloud-services/uploadgateway/uploadgateway~UploadGateway} instance.\n *\n * @param token Token used for authentication.\n * @param apiAddress API address.\n */ createUploadGateway(token, apiAddress) {\n return new UploadGateway(token, apiAddress);\n }\n}\n\nclass CloudServices extends ContextPlugin {\n /**\n * @inheritDoc\n */ static get pluginName() {\n return 'CloudServices';\n }\n /**\n * @inheritDoc\n */ static get requires() {\n return [\n CloudServicesCore\n ];\n }\n /**\n * @inheritDoc\n */ async init() {\n const config = this.context.config;\n const options = config.get('cloudServices') || {};\n for (const [key, value] of Object.entries(options)){\n this[key] = value;\n }\n if (!this.tokenUrl) {\n this.token = null;\n return;\n }\n const cloudServicesCore = this.context.plugins.get('CloudServicesCore');\n this.token = await cloudServicesCore.createToken(this.tokenUrl).init();\n this._tokens.set(this.tokenUrl, this.token);\n }\n /**\n * Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the\n * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.\n *\n * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.\n */ async registerTokenUrl(tokenUrl) {\n // Reuse the token instance in case of multiple features using the same token URL.\n if (this._tokens.has(tokenUrl)) {\n return this.getTokenFor(tokenUrl);\n }\n const cloudServicesCore = this.context.plugins.get('CloudServicesCore');\n const token = await cloudServicesCore.createToken(tokenUrl).init();\n this._tokens.set(tokenUrl, token);\n return token;\n }\n /**\n * Returns an authentication token provider previously registered by {@link #registerTokenUrl}.\n *\n * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.\n */ getTokenFor(tokenUrl) {\n const token = this._tokens.get(tokenUrl);\n if (!token) {\n /**\n * The provided `tokenUrl` was not registered by {@link module:cloud-services/cloudservices~CloudServices#registerTokenUrl}.\n *\n * @error cloudservices-token-not-registered\n */ throw new CKEditorError('cloudservices-token-not-registered', this);\n }\n return token;\n }\n /**\n * @inheritDoc\n */ destroy() {\n super.destroy();\n for (const token of this._tokens.values()){\n token.destroy();\n }\n }\n constructor(){\n super(...arguments);\n /**\n * Other plugins use this token for the authorization process. It handles token requesting and refreshing.\n * Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.\n *\n * @readonly\n */ this.token = null;\n /**\n * A map of token object instances keyed by the token URLs.\n */ this._tokens = new Map();\n }\n}\n\nexport { CloudServices, CloudServicesCore };\n//# sourceMappingURL=index.js.map\n","/**\n * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module cloud-services/token/token\n */\n\n/* globals XMLHttpRequest, setTimeout, clearTimeout, atob */\n\nimport { ObservableMixin, CKEditorError } from 'ckeditor5/src/utils.js';\nimport type { TokenUrl } from '../cloudservicesconfig.js';\n\nconst DEFAULT_OPTIONS = { autoRefresh: true };\nconst DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME = 3600000;\n\n/**\n * Class representing the token used for communication with CKEditor Cloud Services.\n * Value of the token is retrieving from the specified URL and is refreshed every 1 hour by default.\n */\nexport default class Token extends ObservableMixin() {\n\t/**\n\t * Value of the token.\n\t * The value of the token is undefined if `initValue` is not provided or `init` method was not called.\n\t * `create` method creates token with initialized value from url.\n\t *\n\t * @see module:cloud-services/token/token~InitializedToken\n\t * @observable\n\t * @readonly\n\t */\n\tdeclare public value: string | undefined;\n\n\t/**\n\t * Base refreshing function.\n\t */\n\tprivate _refresh: () => Promise<string>;\n\n\tprivate _options: { initValue?: string; autoRefresh: boolean };\n\n\tprivate _tokenRefreshTimeout?: ReturnType<typeof setTimeout>;\n\n\t/**\n\t * Creates `Token` instance.\n\t * Method `init` should be called after using the constructor or use `create` method instead.\n\t *\n\t * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the\n\t * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.\n\t */\n\tconstructor( tokenUrlOrRefreshToken: TokenUrl, options: TokenOptions = {} ) {\n\t\tsuper();\n\n\t\tif ( !tokenUrlOrRefreshToken ) {\n\t\t\t/**\n\t\t\t * A `tokenUrl` must be provided as the first constructor argument.\n\t\t\t *\n\t\t\t * @error token-missing-token-url\n\t\t\t */\n\t\t\tthrow new CKEditorError(\n\t\t\t\t'token-missing-token-url',\n\t\t\t\tthis\n\t\t\t);\n\t\t}\n\n\t\tif ( options.initValue ) {\n\t\t\tthis._validateTokenValue( options.initValue );\n\t\t}\n\n\t\tthis.set( 'value', options.initValue );\n\n\t\tif ( typeof tokenUrlOrRefreshToken === 'function' ) {\n\t\t\tthis._refresh = tokenUrlOrRefreshToken;\n\t\t} else {\n\t\t\tthis._refresh = () => defaultRefreshToken( tokenUrlOrRefreshToken );\n\t\t}\n\n\t\tthis._options = { ...DEFAULT_OPTIONS, ...options };\n\t}\n\n\t/**\n\t * Initializes the token.\n\t */\n\tpublic init(): Promise<InitializedToken> {\n\t\treturn new Promise( ( resolve, reject ) => {\n\t\t\tif ( !this.value ) {\n\t\t\t\tthis.refreshToken()\n\t\t\t\t\t.then( resolve )\n\t\t\t\t\t.catch( reject );\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( this._options.autoRefresh ) {\n\t\t\t\tthis._registerRefreshTokenTimeout();\n\t\t\t}\n\n\t\t\tresolve( this as InitializedToken );\n\t\t} );\n\t}\n\n\t/**\n\t * Refresh token method. Useful in a method form as it can be override in tests.\n\t */\n\tpublic refreshToken(): Promise<InitializedToken> {\n\t\treturn this._refresh()\n\t\t\t.then( value => {\n\t\t\t\tthis._validateTokenValue( value );\n\t\t\t\tthis.set( 'value', value );\n\n\t\t\t\tif ( this._options.autoRefresh ) {\n\t\t\t\t\tthis._registerRefreshTokenTimeout();\n\t\t\t\t}\n\n\t\t\t\treturn this as InitializedToken;\n\t\t\t} );\n\t}\n\n\t/**\n\t * Destroys token instance. Stops refreshing.\n\t */\n\tpublic destroy(): void {\n\t\tclearTimeout( this._tokenRefreshTimeout );\n\t}\n\n\t/**\n\t * Checks whether the provided token follows the JSON Web Tokens (JWT) format.\n\t *\n\t * @param tokenValue The token to validate.\n\t */\n\tprivate _validateTokenValue( tokenValue: string ) {\n\t\t// The token must be a string.\n\t\tconst isString = typeof tokenValue === 'string';\n\n\t\t// The token must be a plain string without quotes (\"\").\n\t\tconst isPlainString = !/^\".*\"$/.test( tokenValue );\n\n\t\t// JWT token contains 3 parts: header, payload, and signature.\n\t\t// Each part is separated by a dot.\n\t\tconst isJWTFormat = isString && tokenValue.split( '.' ).length === 3;\n\n\t\tif ( !( isPlainString && isJWTFormat ) ) {\n\t\t\t/**\n\t\t\t * The provided token must follow the [JSON Web Tokens](https://jwt.io/introduction/) format.\n\t\t\t *\n\t\t\t * @error token-not-in-jwt-format\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'token-not-in-jwt-format', this );\n\t\t}\n\t}\n\n\t/**\n\t * Registers a refresh token timeout for the time taken from token.\n\t */\n\tprivate _registerRefreshTokenTimeout() {\n\t\tconst tokenRefreshTimeoutTime = this._getTokenRefreshTimeoutTime();\n\n\t\tclearTimeout( this._tokenRefreshTimeout );\n\n\t\tthis._tokenRefreshTimeout = setTimeout( () => {\n\t\t\tthis.refreshToken();\n\t\t}, tokenRefreshTimeoutTime );\n\t}\n\n\t/**\n\t * Returns token refresh timeout time calculated from expire time in the token payload.\n\t *\n\t * If the token parse fails or the token payload doesn't contain, the default DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME is returned.\n\t */\n\tprivate _getTokenRefreshTimeoutTime() {\n\t\ttry {\n\t\t\tconst [ , binaryTokenPayload ] = this.value!.split( '.' );\n\t\t\tconst { exp: tokenExpireTime } = JSON.parse( atob( binaryTokenPayload ) );\n\n\t\t\tif ( !tokenExpireTime ) {\n\t\t\t\treturn DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME;\n\t\t\t}\n\n\t\t\tconst tokenRefreshTimeoutTime = Math.floor( ( ( tokenExpireTime * 1000 ) - Date.now() ) / 2 );\n\n\t\t\treturn tokenRefreshTimeoutTime;\n\t\t} catch ( err ) {\n\t\t\treturn DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME;\n\t\t}\n\t}\n\n\t/**\n\t * Creates a initialized {@link module:cloud-services/token/token~Token} instance.\n\t *\n\t * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the\n\t * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.\n\t */\n\tpublic static create( tokenUrlOrRefreshToken: TokenUrl, options: TokenOptions = {} ): Promise<InitializedToken> {\n\t\tconst token = new Token( tokenUrlOrRefreshToken, options );\n\n\t\treturn token.init();\n\t}\n}\n\n/**\n * A {@link ~Token} instance that has been initialized.\n */\nexport type InitializedToken = Token & { value: string };\n\n/**\n * Options for creating tokens.\n */\nexport interface TokenOptions {\n\n\t/**\n\t * Initial value of the token.\n\t */\n\tinitValue?: string;\n\n\t/**\n\t * Specifies whether to start the refresh automatically.\n\t *\n\t * @default true\n\t */\n\tautoRefresh?: boolean;\n}\n\n/**\n * This function is called in a defined interval by the {@link ~Token} class. It also can be invoked manually.\n * It should return a promise, which resolves with the new token value.\n * If any error occurs it should return a rejected promise with an error message.\n */\nfunction defaultRefreshToken( tokenUrl: string ) {\n\treturn new Promise<string>( ( resolve, reject ) => {\n\t\tconst xhr = new XMLHttpRequest();\n\n\t\txhr.open( 'GET', tokenUrl );\n\n\t\txhr.addEventListener( 'load', () => {\n\t\t\tconst statusCode = xhr.status;\n\t\t\tconst xhrResponse = xhr.response;\n\n\t\t\tif ( statusCode < 200 || statusCode > 299 ) {\n\t\t\t\t/**\n\t\t\t\t * Cannot download new token from the provided url.\n\t\t\t\t *\n\t\t\t\t * @error token-cannot-download-new-token\n\t\t\t\t */\n\t\t\t\treturn reject(\n\t\t\t\t\tnew CKEditorError( 'token-cannot-download-new-token', null )\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn resolve( xhrResponse );\n\t\t} );\n\n\t\txhr.addEventListener( 'error', () => reject( new Error( 'Network Error' ) ) );\n\t\txhr.addEventListener( 'abort', () => reject( new Error( 'Abort' ) ) );\n\n\t\txhr.send();\n\t} );\n}\n","/**\n * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module cloud-services/uploadgateway/fileuploader\n */\n\n/* globals XMLHttpRequest, FormData, Blob, atob */\n\nimport type { UploadResponse } from 'ckeditor5/src/upload.js';\nimport { EmitterMixin, CKEditorError } from 'ckeditor5/src/utils.js';\nimport type { InitializedToken } from '../token/token.js';\n\nconst BASE64_HEADER_REG_EXP = /^data:(\\S*?);base64,/;\n\n/**\n * FileUploader class used to upload single file.\n */\nexport default class FileUploader extends EmitterMixin() {\n\t/**\n\t * A file that is being uploaded.\n\t */\n\tpublic readonly file: Blob;\n\n\tpublic xhr?: XMLHttpRequest;\n\n\t/**\n\t * CKEditor Cloud Services access token.\n\t */\n\tprivate readonly _token: InitializedToken;\n\n\t/**\n\t * CKEditor Cloud Services API address.\n\t */\n\tprivate readonly _apiAddress: string;\n\n\t/**\n\t * Creates `FileUploader` instance.\n\t *\n\t * @param fileOrData A blob object or a data string encoded with Base64.\n\t * @param token Token used for authentication.\n\t * @param apiAddress API address.\n\t */\n\tconstructor(\n\t\tfileOrData: string | Blob,\n\t\ttoken: InitializedToken,\n\t\tapiAddress: string\n\t) {\n\t\tsuper();\n\n\t\tif ( !fileOrData ) {\n\t\t\t/**\n\t\t\t * File must be provided as the first argument.\n\t\t\t *\n\t\t\t * @error fileuploader-missing-file\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'fileuploader-missing-file', null );\n\t\t}\n\n\t\tif ( !token ) {\n\t\t\t/**\n\t\t\t * Token must be provided as the second argument.\n\t\t\t *\n\t\t\t * @error fileuploader-missing-token\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'fileuploader-missing-token', null );\n\t\t}\n\n\t\tif ( !apiAddress ) {\n\t\t\t/**\n\t\t\t * Api address must be provided as the third argument.\n\t\t\t *\n\t\t\t * @error fileuploader-missing-api-address\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'fileuploader-missing-api-address', null );\n\t\t}\n\n\t\tthis.file = _isBase64( fileOrData ) ? _base64ToBlob( fileOrData ) : fileOrData;\n\n\t\tthis._token = token;\n\t\tthis._apiAddress = apiAddress;\n\t}\n\n\t/**\n\t * Registers callback on `progress` event.\n\t */\n\tpublic onProgress( callback: ( status: { total: number; uploaded: number } ) => void ): this {\n\t\tthis.on<FileUploaderProgressErrorEvent>( 'progress', ( event, data ) => callback( data ) );\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Registers callback on `error` event. Event is called once when error occurs.\n\t */\n\tpublic onError( callback: ( error: string ) => void ): this {\n\t\tthis.once<FileUploaderErrorEvent>( 'error', ( event, data ) => callback( data ) );\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Aborts upload process.\n\t */\n\tpublic abort(): void {\n\t\tthis.xhr!.abort();\n\t}\n\n\t/**\n\t * Sends XHR request to API.\n\t */\n\tpublic send(): Promise<UploadResponse> {\n\t\tthis._prepareRequest();\n\t\tthis._attachXHRListeners();\n\n\t\treturn this._sendRequest();\n\t}\n\n\t/**\n\t * Prepares XHR request.\n\t */\n\tprivate _prepareRequest() {\n\t\tconst xhr = new XMLHttpRequest();\n\n\t\txhr.open( 'POST', this._apiAddress );\n\t\txhr.setRequestHeader( 'Authorization', this._token.value );\n\t\txhr.responseType = 'json';\n\n\t\tthis.xhr = xhr;\n\t}\n\n\t/**\n\t * Attaches listeners to the XHR.\n\t */\n\tprivate _attachXHRListeners() {\n\t\tconst xhr = this.xhr!;\n\n\t\tconst onError = ( message: string ) => {\n\t\t\treturn () => this.fire<FileUploaderErrorEvent>( 'error', message );\n\t\t};\n\n\t\txhr.addEventListener( 'error', onError( 'Network Error' ) );\n\t\txhr.addEventListener( 'abort', onError( 'Abort' ) );\n\n\t\t/* istanbul ignore else -- @preserve */\n\t\tif ( xhr.upload ) {\n\t\t\txhr.upload.addEventListener( 'progress', event => {\n\t\t\t\tif ( event.lengthComputable ) {\n\t\t\t\t\tthis.fire<FileUploaderProgressErrorEvent>( 'progress', {\n\t\t\t\t\t\ttotal: event.total,\n\t\t\t\t\t\tuploaded: event.loaded\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\txhr.addEventListener( 'load', () => {\n\t\t\tconst statusCode = xhr.status;\n\t\t\tconst xhrResponse = xhr.response;\n\n\t\t\tif ( statusCode < 200 || statusCode > 299 ) {\n\t\t\t\treturn this.fire<FileUploaderErrorEvent>( 'error', xhrResponse.message || xhrResponse.error );\n\t\t\t}\n\t\t} );\n\t}\n\n\t/**\n\t * Sends XHR request.\n\t */\n\tprivate _sendRequest() {\n\t\tconst formData = new FormData();\n\t\tconst xhr = this.xhr!;\n\n\t\tformData.append( 'file', this.file );\n\n\t\treturn new Promise<UploadResponse>( ( resolve, reject ) => {\n\t\t\txhr.addEventListener( 'load', () => {\n\t\t\t\tconst statusCode = xhr.status;\n\t\t\t\tconst xhrResponse = xhr.response;\n\n\t\t\t\tif ( statusCode < 200 || statusCode > 299 ) {\n\t\t\t\t\tif ( xhrResponse.message ) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Uploading file failed.\n\t\t\t\t\t\t *\n\t\t\t\t\t\t * @error fileuploader-uploading-data-failed\n\t\t\t\t\t\t */\n\t\t\t\t\t\treturn reject( new CKEditorError(\n\t\t\t\t\t\t\t'fileuploader-uploading-data-failed',\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t{ message: xhrResponse.message }\n\t\t\t\t\t\t) );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn reject( xhrResponse.error );\n\t\t\t\t}\n\n\t\t\t\treturn resolve( xhrResponse );\n\t\t\t} );\n\n\t\t\txhr.addEventListener( 'error', () => reject( new Error( 'Network Error' ) ) );\n\t\t\txhr.addEventListener( 'abort', () => reject( new Error( 'Abort' ) ) );\n\n\t\t\txhr.send( formData );\n\t\t} );\n\t}\n}\n\n/**\n * Fired when error occurs.\n *\n * @eventName ~FileUploader#error\n * @param error Error message\n */\nexport type FileUploaderErrorEvent = {\n\tname: 'error';\n\targs: [ error: string ];\n};\n\n/**\n * Fired on upload progress.\n *\n * @eventName ~FileUploader#progress\n * @param status Total and uploaded status\n */\nexport type FileUploaderProgressErrorEvent = {\n\tname: 'progress';\n\targs: [ status: { total: number; uploaded: number } ];\n};\n\n/**\n * Transforms Base64 string data into file.\n *\n * @param base64 String data.\n */\nfunction _base64ToBlob( base64: string, sliceSize = 512 ) {\n\ttry {\n\t\tconst contentType = base64.match( BASE64_HEADER_REG_EXP )![ 1 ];\n\t\tconst base64Data = atob( base64.replace( BASE64_HEADER_REG_EXP, '' ) );\n\n\t\tconst byteArrays: Array<Uint8Array> = [];\n\n\t\tfor ( let offset = 0; offset < base64Data.length; offset += sliceSize ) {\n\t\t\tconst slice = base64Data.slice( offset, offset + sliceSize );\n\t\t\tconst byteNumbers = new Array<number>( slice.length );\n\n\t\t\tfor ( let i = 0; i < slice.length; i++ ) {\n\t\t\t\tbyteNumbers[ i ] = slice.charCodeAt( i );\n\t\t\t}\n\n\t\t\tbyteArrays.push( new Uint8Array( byteNumbers ) );\n\t\t}\n\n\t\treturn new Blob( byteArrays, { type: contentType } );\n\t} catch ( error ) {\n\t\t/**\n\t\t * Problem with decoding Base64 image data.\n\t\t *\n\t\t * @error fileuploader-decoding-image-data-error\n\t\t */\n\t\tthrow new CKEditorError( 'fileuploader-decoding-image-data-error', null );\n\t}\n}\n\n/**\n * Checks that string is Base64.\n */\nfunction _isBase64( string: string | Blob ): string is string {\n\tif ( typeof string !== 'string' ) {\n\t\treturn false;\n\t}\n\n\tconst match = string.match( BASE64_HEADER_REG_EXP );\n\treturn !!( match && match.length );\n}\n","/**\n * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module cloud-services/uploadgateway/uploadgateway\n */\n\nimport FileUploader from './fileuploader.js';\nimport type { InitializedToken } from '../token/token.js';\nimport { CKEditorError } from 'ckeditor5/src/utils.js';\n\n/**\n * UploadGateway abstracts file uploads to CKEditor Cloud Services.\n */\nexport default class UploadGateway {\n\t/**\n\t * CKEditor Cloud Services access token.\n\t */\n\tprivate readonly _token: InitializedToken;\n\n\t/**\n\t * CKEditor Cloud Services API address.\n\t */\n\tprivate readonly _apiAddress: string;\n\n\t/**\n\t * Creates `UploadGateway` instance.\n\t *\n\t * @param token Token used for authentication.\n\t * @param apiAddress API address.\n\t */\n\tconstructor( token: InitializedToken, apiAddress: string ) {\n\t\tif ( !token ) {\n\t\t\t/**\n\t\t\t * Token must be provided.\n\t\t\t *\n\t\t\t * @error uploadgateway-missing-token\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'uploadgateway-missing-token', null );\n\t\t}\n\n\t\tif ( !apiAddress ) {\n\t\t\t/**\n\t\t\t * Api address must be provided.\n\t\t\t *\n\t\t\t * @error uploadgateway-missing-api-address\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'uploadgateway-missing-api-address', null );\n\t\t}\n\n\t\tthis._token = token;\n\t\tthis._apiAddress = apiAddress;\n\t}\n\n\t/**\n\t * Creates a {@link module:cloud-services/uploadgateway/fileuploader~FileUploader} instance that wraps\n\t * file upload process. The file is being sent at a time when the\n\t * {@link module:cloud-services/uploadgateway/fileuploader~FileUploader#send} method is called.\n\t *\n\t * ```ts\n\t * const token = await Token.create( 'https://token-endpoint' );\n\t * new UploadGateway( token, 'https://example.org' )\n\t * \t.upload( 'FILE' )\n\t * \t.onProgress( ( data ) => console.log( data ) )\n\t * \t.send()\n\t * \t.then( ( response ) => console.log( response ) );\n\t * ```\n\t *\n\t * @param {Blob|String} fileOrData A blob object or a data string encoded with Base64.\n\t * @returns {module:cloud-services/uploadgateway/fileuploader~FileUploader} Returns `FileUploader` instance.\n\t */\n\tpublic upload( fileOrData: string | Blob ): FileUploader {\n\t\treturn new FileUploader( fileOrData, this._token, this._apiAddress );\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module cloud-services/cloudservicescore\n */\n\nimport { ContextPlugin } from 'ckeditor5/src/core.js';\nimport type { TokenUrl } from './cloudservicesconfig.js';\nimport Token, { type InitializedToken, type TokenOptions } from './token/token.js';\nimport UploadGateway from './uploadgateway/uploadgateway.js';\n\n/**\n * The `CloudServicesCore` plugin exposes the base API for communication with CKEditor Cloud Services.\n */\nexport default class CloudServicesCore extends ContextPlugin {\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic static get pluginName() {\n\t\treturn 'CloudServicesCore' as const;\n\t}\n\n\t/**\n\t * Creates the {@link module:cloud-services/token/token~Token} instance.\n\t *\n\t * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the\n\t * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.\n\t * @param options.initValue Initial value of the token.\n\t * @param options.autoRefresh Specifies whether to start the refresh automatically.\n\t */\n\tpublic createToken( tokenUrlOrRefreshToken: TokenUrl, options?: TokenOptions ): Token {\n\t\treturn new Token( tokenUrlOrRefreshToken, options );\n\t}\n\n\t/**\n\t * Creates the {@link module:cloud-services/uploadgateway/uploadgateway~UploadGateway} instance.\n\t *\n\t * @param token Token used for authentication.\n\t * @param apiAddress API address.\n\t */\n\tpublic createUploadGateway( token: InitializedToken, apiAddress: string ): UploadGateway {\n\t\treturn new UploadGateway( token, apiAddress );\n\t}\n}\n","/**\n * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.\n * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license\n */\n\n/**\n * @module cloud-services/cloudservices\n */\n\nimport { ContextPlugin } from 'ckeditor5/src/core.js';\nimport { CKEditorError } from 'ckeditor5/src/utils.js';\nimport CloudServicesCore from './cloudservicescore.js';\nimport type { CloudServicesConfig, TokenUrl } from './cloudservicesconfig.js';\nimport type { InitializedToken } from './token/token.js';\n\n/**\n * Plugin introducing the integration between CKEditor 5 and CKEditor Cloud Services .\n *\n * It initializes the token provider based on\n * the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig `config.cloudService`}.\n */\nexport default class CloudServices extends ContextPlugin implements CloudServicesConfig {\n\t/**\n\t * The authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the\n\t * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.\n\t */\n\tpublic readonly tokenUrl?: TokenUrl;\n\n\t/**\n\t * The URL to which the files should be uploaded.\n\t */\n\tpublic readonly uploadUrl?: string;\n\n\t/**\n\t * The URL for web socket communication, used by the `RealTimeCollaborativeEditing` plugin. Every customer (organization in the CKEditor\n\t * Ecosystem dashboard) has their own, unique URLs to communicate with CKEditor Cloud Services. The URL can be found in the\n\t * CKEditor Ecosystem customer dashboard.\n\t *\n\t * Note: Unlike most plugins, `RealTimeCollaborativeEditing` is not included in any CKEditor 5 build and needs to be installed manually.\n\t * Check [Collaboration overview](https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/overview.html) for more details.\n\t */\n\tpublic readonly webSocketUrl?: string;\n\n\t/**\n\t * An optional parameter used for integration with CKEditor Cloud Services when uploading the editor build to cloud services.\n\t *\n\t * Whenever the editor build or the configuration changes, this parameter should be set to a new, unique value to differentiate\n\t * the new bundle (build + configuration) from the old ones.\n\t */\n\tpublic readonly bundleVersion?: string;\n\n\t/**\n\t * Other plugins use this token for the authorization process. It handles token requesting and refreshing.\n\t * Its value is `null` when {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} is not provided.\n\t *\n\t * @readonly\n\t */\n\tpublic token: InitializedToken | null = null;\n\n\t/**\n\t * A map of token object instances keyed by the token URLs.\n\t */\n\tprivate readonly _tokens = new Map<TokenUrl, InitializedToken>();\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic static get pluginName() {\n\t\treturn 'CloudServices' as const;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic static get requires() {\n\t\treturn [ CloudServicesCore ] as const;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic async init(): Promise<void> {\n\t\tconst config = this.context.config;\n\n\t\tconst options = config.get( 'cloudServices' ) || {};\n\n\t\tfor ( const [ key, value ] of Object.entries( options ) as Array<[key: keyof CloudServicesConfig, value: any]> ) {\n\t\t\t( this as CloudServicesConfig )[ key ] = value;\n\t\t}\n\n\t\tif ( !this.tokenUrl ) {\n\t\t\tthis.token = null;\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst cloudServicesCore: CloudServicesCore = this.context.plugins.get( 'CloudServicesCore' );\n\n\t\tthis.token = await cloudServicesCore.createToken( this.tokenUrl ).init();\n\n\t\tthis._tokens.set( this.tokenUrl, this.token );\n\t}\n\n\t/**\n\t * Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the\n\t * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.\n\t *\n\t * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.\n\t */\n\tpublic async registerTokenUrl( tokenUrl: TokenUrl ): Promise<InitializedToken> {\n\t\t// Reuse the token instance in case of multiple features using the same token URL.\n\t\tif ( this._tokens.has( tokenUrl ) ) {\n\t\t\treturn this.getTokenFor( tokenUrl );\n\t\t}\n\n\t\tconst cloudServicesCore: CloudServicesCore = this.context.plugins.get( 'CloudServicesCore' );\n\t\tconst token = await cloudServicesCore.createToken( tokenUrl ).init();\n\n\t\tthis._tokens.set( tokenUrl, token );\n\n\t\treturn token;\n\t}\n\n\t/**\n\t * Returns an authentication token provider previously registered by {@link #registerTokenUrl}.\n\t *\n\t * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.\n\t */\n\tpublic getTokenFor( tokenUrl: TokenUrl ): InitializedToken {\n\t\tconst token = this._tokens.get( tokenUrl );\n\n\t\tif ( !token ) {\n\t\t\t/**\n\t\t\t * The provided `tokenUrl` was not registered by {@link module:cloud-services/cloudservices~CloudServices#registerTokenUrl}.\n\t\t\t *\n\t\t\t * @error cloudservices-token-not-registered\n\t\t\t */\n\t\t\tthrow new CKEditorError( 'cloudservices-token-not-registered', this );\n\t\t}\n\n\t\treturn token;\n\t}\n\n\t/**\n\t * @inheritDoc\n\t */\n\tpublic override destroy(): void {\n\t\tsuper.destroy();\n\n\t\tfor ( const token of this._tokens.values() ) {\n\t\t\ttoken.destroy();\n\t\t}\n\t}\n}\n"]}
@@ -0,0 +1,23 @@
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-oss-license
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
+ }
@@ -0,0 +1,88 @@
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-oss-license
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 requires(): readonly [typeof CloudServicesCore];
67
+ /**
68
+ * @inheritDoc
69
+ */
70
+ init(): Promise<void>;
71
+ /**
72
+ * Registers an additional authentication token URL for CKEditor Cloud Services or a callback to the token value promise. See the
73
+ * {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} for more details.
74
+ *
75
+ * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
76
+ */
77
+ registerTokenUrl(tokenUrl: TokenUrl): Promise<InitializedToken>;
78
+ /**
79
+ * Returns an authentication token provider previously registered by {@link #registerTokenUrl}.
80
+ *
81
+ * @param tokenUrl The authentication token URL for CKEditor Cloud Services or a callback to the token value promise.
82
+ */
83
+ getTokenFor(tokenUrl: TokenUrl): InitializedToken;
84
+ /**
85
+ * @inheritDoc
86
+ */
87
+ destroy(): void;
88
+ }
@@ -0,0 +1,125 @@
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-oss-license
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
+ * You can find more information about token endpoints in the
92
+ * {@glink @cs guides/easy-image/quick-start#create-token-endpoint Cloud Services - Quick start}
93
+ * and {@glink @cs developer-resources/security/token-endpoint Cloud Services - Token endpoint} documentation.
94
+ *
95
+ * Without a properly working token endpoint (token URL) CKEditor plugins will not be able to connect to CKEditor Cloud Services.
96
+ */
97
+ tokenUrl?: TokenUrl;
98
+ /**
99
+ * The endpoint URL for [CKEditor Cloud Services](https://ckeditor.com/ckeditor-cloud-services) uploads.
100
+ * This option must be set for Easy Image to work correctly.
101
+ *
102
+ * The upload URL is unique for each customer and can be found in the
103
+ * [CKEditor Ecosystem customer dashboard](https://dashboard.ckeditor.com) after subscribing to the Easy Image service.
104
+ * To learn how to start using Easy Image, check the {@glink @cs guides/easy-image/quick-start Easy Image - Quick start} documentation.
105
+ *
106
+ * Note: Make sure to also set the {@link module:cloud-services/cloudservicesconfig~CloudServicesConfig#tokenUrl} configuration option.
107
+ */
108
+ uploadUrl?: string;
109
+ /**
110
+ * The URL for web socket communication, used by the `RealTimeCollaborativeEditing` plugin. Every customer (organization in the CKEditor
111
+ * Ecosystem dashboard) has their own, unique URLs to communicate with CKEditor Cloud Services. The URL can be found in the
112
+ * CKEditor Ecosystem customer dashboard.
113
+ *
114
+ * Note: Unlike most plugins, `RealTimeCollaborativeEditing` is not included in any CKEditor 5 build and needs to be installed manually.
115
+ * Check [Collaboration overview](https://ckeditor.com/docs/ckeditor5/latest/features/collaboration/overview.html) for more details.
116
+ */
117
+ webSocketUrl?: string;
118
+ /**
119
+ * An optional parameter used for integration with CKEditor Cloud Services when uploading the editor build to cloud services.
120
+ *
121
+ * Whenever the editor build or the configuration changes, this parameter should be set to a new, unique value to differentiate
122
+ * the new bundle (build + configuration) from the old ones.
123
+ */
124
+ bundleVersion?: string;
125
+ }
@@ -0,0 +1,40 @@
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-oss-license
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
+ * Creates the {@link module:cloud-services/token/token~Token} instance.
26
+ *
27
+ * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the
28
+ * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.
29
+ * @param options.initValue Initial value of the token.
30
+ * @param options.autoRefresh Specifies whether to start the refresh automatically.
31
+ */
32
+ createToken(tokenUrlOrRefreshToken: TokenUrl, options?: TokenOptions): Token;
33
+ /**
34
+ * Creates the {@link module:cloud-services/uploadgateway/uploadgateway~UploadGateway} instance.
35
+ *
36
+ * @param token Token used for authentication.
37
+ * @param apiAddress API address.
38
+ */
39
+ createUploadGateway(token: InitializedToken, apiAddress: string): UploadGateway;
40
+ }
@@ -0,0 +1,18 @@
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-oss-license
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 type { default as Token, 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';
@@ -0,0 +1,100 @@
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-oss-license
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
+ * Class representing the token used for communication with CKEditor Cloud Services.
16
+ * Value of the token is retrieving from the specified URL and is refreshed every 1 hour by default.
17
+ */
18
+ export default class Token extends Token_base {
19
+ /**
20
+ * Value of the token.
21
+ * The value of the token is undefined if `initValue` is not provided or `init` method was not called.
22
+ * `create` method creates token with initialized value from url.
23
+ *
24
+ * @see module:cloud-services/token/token~InitializedToken
25
+ * @observable
26
+ * @readonly
27
+ */
28
+ value: string | undefined;
29
+ /**
30
+ * Base refreshing function.
31
+ */
32
+ private _refresh;
33
+ private _options;
34
+ private _tokenRefreshTimeout?;
35
+ /**
36
+ * Creates `Token` instance.
37
+ * Method `init` should be called after using the constructor or use `create` method instead.
38
+ *
39
+ * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the
40
+ * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.
41
+ */
42
+ constructor(tokenUrlOrRefreshToken: TokenUrl, options?: TokenOptions);
43
+ /**
44
+ * Initializes the token.
45
+ */
46
+ init(): Promise<InitializedToken>;
47
+ /**
48
+ * Refresh token method. Useful in a method form as it can be override in tests.
49
+ */
50
+ refreshToken(): Promise<InitializedToken>;
51
+ /**
52
+ * Destroys token instance. Stops refreshing.
53
+ */
54
+ destroy(): void;
55
+ /**
56
+ * Checks whether the provided token follows the JSON Web Tokens (JWT) format.
57
+ *
58
+ * @param tokenValue The token to validate.
59
+ */
60
+ private _validateTokenValue;
61
+ /**
62
+ * Registers a refresh token timeout for the time taken from token.
63
+ */
64
+ private _registerRefreshTokenTimeout;
65
+ /**
66
+ * Returns token refresh timeout time calculated from expire time in the token payload.
67
+ *
68
+ * If the token parse fails or the token payload doesn't contain, the default DEFAULT_TOKEN_REFRESH_TIMEOUT_TIME is returned.
69
+ */
70
+ private _getTokenRefreshTimeoutTime;
71
+ /**
72
+ * Creates a initialized {@link module:cloud-services/token/token~Token} instance.
73
+ *
74
+ * @param tokenUrlOrRefreshToken Endpoint address to download the token or a callback that provides the token. If the
75
+ * value is a function it has to match the {@link module:cloud-services/token/token~Token#refreshToken} interface.
76
+ */
77
+ static create(tokenUrlOrRefreshToken: TokenUrl, options?: TokenOptions): Promise<InitializedToken>;
78
+ }
79
+ /**
80
+ * A {@link ~Token} instance that has been initialized.
81
+ */
82
+ export type InitializedToken = Token & {
83
+ value: string;
84
+ };
85
+ /**
86
+ * Options for creating tokens.
87
+ */
88
+ export interface TokenOptions {
89
+ /**
90
+ * Initial value of the token.
91
+ */
92
+ initValue?: string;
93
+ /**
94
+ * Specifies whether to start the refresh automatically.
95
+ *
96
+ * @default true
97
+ */
98
+ autoRefresh?: boolean;
99
+ }
100
+ export {};
@@ -0,0 +1,98 @@
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-oss-license
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 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 {};
@@ -0,0 +1,51 @@
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-oss-license
8
+ */
9
+ /**
10
+ * @module cloud-services/uploadgateway/uploadgateway
11
+ */
12
+ import FileUploader from './fileuploader.js';
13
+ import type { InitializedToken } from '../token/token.js';
14
+ /**
15
+ * UploadGateway abstracts file uploads to CKEditor Cloud Services.
16
+ */
17
+ export default class UploadGateway {
18
+ /**
19
+ * CKEditor Cloud Services access token.
20
+ */
21
+ private readonly _token;
22
+ /**
23
+ * CKEditor Cloud Services API address.
24
+ */
25
+ private readonly _apiAddress;
26
+ /**
27
+ * Creates `UploadGateway` instance.
28
+ *
29
+ * @param token Token used for authentication.
30
+ * @param apiAddress API address.
31
+ */
32
+ constructor(token: InitializedToken, apiAddress: string);
33
+ /**
34
+ * Creates a {@link module:cloud-services/uploadgateway/fileuploader~FileUploader} instance that wraps
35
+ * file upload process. The file is being sent at a time when the
36
+ * {@link module:cloud-services/uploadgateway/fileuploader~FileUploader#send} method is called.
37
+ *
38
+ * ```ts
39
+ * const token = await Token.create( 'https://token-endpoint' );
40
+ * new UploadGateway( token, 'https://example.org' )
41
+ * .upload( 'FILE' )
42
+ * .onProgress( ( data ) => console.log( data ) )
43
+ * .send()
44
+ * .then( ( response ) => console.log( response ) );
45
+ * ```
46
+ *
47
+ * @param {Blob|String} fileOrData A blob object or a data string encoded with Base64.
48
+ * @returns {module:cloud-services/uploadgateway/fileuploader~FileUploader} Returns `FileUploader` instance.
49
+ */
50
+ upload(fileOrData: string | Blob): FileUploader;
51
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-cloud-services",
3
- "version": "41.3.0",
3
+ "version": "41.4.0-alpha.0",
4
4
  "description": "CKEditor 5's Cloud Services integration layer.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,7 +12,7 @@
12
12
  "type": "module",
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "ckeditor5": "41.3.0"
15
+ "ckeditor5": "41.4.0-alpha.0"
16
16
  },
17
17
  "author": "CKSource (http://cksource.com/)",
18
18
  "license": "GPL-2.0-or-later",
@@ -24,6 +24,7 @@
24
24
  "directory": "packages/ckeditor5-cloud-services"
25
25
  },
26
26
  "files": [
27
+ "dist",
27
28
  "lang",
28
29
  "src/**/*.js",
29
30
  "src/**/*.d.ts",
package/src/index.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  export { default as CloudServices } from './cloudservices.js';
9
9
  export { default as CloudServicesCore } from './cloudservicescore.js';
10
- export { TokenUrl, type CloudServicesConfig } from './cloudservicesconfig.js';
10
+ export type { TokenUrl, CloudServicesConfig } from './cloudservicesconfig.js';
11
11
  export type { default as Token, InitializedToken } from './token/token.js';
12
12
  export type { default as UploadGateway } from './uploadgateway/uploadgateway.js';
13
13
  export type { default as FileUploader } from './uploadgateway/fileuploader.js';