@atlaskit/media-client 22.0.1 → 22.0.3
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/CHANGELOG.md +16 -0
- package/dist/cjs/client/file-fetcher/index.js +3 -103
- package/dist/cjs/client/media-client.js +1 -1
- package/dist/cjs/client/media-store/index.js +13 -80
- package/dist/cjs/utils/shouldFetchRemoteFileStates.js +0 -5
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/file-fetcher/index.js +3 -104
- package/dist/es2019/client/media-client.js +1 -1
- package/dist/es2019/client/media-store/index.js +5 -45
- package/dist/es2019/utils/shouldFetchRemoteFileStates.js +0 -4
- package/dist/es2019/version.json +1 -1
- package/dist/esm/client/file-fetcher/index.js +4 -104
- package/dist/esm/client/media-client.js +1 -1
- package/dist/esm/client/media-store/index.js +13 -80
- package/dist/esm/utils/shouldFetchRemoteFileStates.js +0 -4
- package/dist/esm/version.json +1 -1
- package/dist/types/client/file-fetcher/error.d.ts +1 -1
- package/dist/types/client/file-fetcher/index.d.ts +4 -7
- package/dist/types/client/media-store/index.d.ts +1 -2
- package/dist/types/models/errors/types.d.ts +1 -1
- package/dist/types/utils/shouldFetchRemoteFileStates.d.ts +0 -2
- package/dist/types-ts4.5/client/__mocks__/collection-fetcher.d.ts +8 -0
- package/dist/types-ts4.5/client/__mocks__/file-fetcher.d.ts +10 -0
- package/dist/types-ts4.5/client/__mocks__/media-client.d.ts +11 -0
- package/dist/types-ts4.5/client/events.d.ts +14 -0
- package/dist/types-ts4.5/client/file-fetcher/error.d.ts +29 -0
- package/dist/types-ts4.5/client/file-fetcher/index.d.ts +58 -0
- package/dist/types-ts4.5/client/media-client.d.ts +27 -0
- package/dist/types-ts4.5/client/media-store/error.d.ts +16 -0
- package/dist/types-ts4.5/client/media-store/index.d.ts +169 -0
- package/dist/types-ts4.5/client/media-store/resolveAuth.d.ts +4 -0
- package/dist/types-ts4.5/client/mobile-upload.d.ts +11 -0
- package/dist/types-ts4.5/client/stargate-client.d.ts +15 -0
- package/dist/types-ts4.5/constants.d.ts +6 -0
- package/dist/types-ts4.5/file-streams-cache.d.ts +15 -0
- package/dist/types-ts4.5/globalMediaEventEmitter.d.ts +6 -0
- package/dist/types-ts4.5/identifier.d.ts +15 -0
- package/dist/types-ts4.5/index.d.ts +87 -0
- package/dist/types-ts4.5/models/artifacts.d.ts +12 -0
- package/dist/types-ts4.5/models/auth-headers.d.ts +11 -0
- package/dist/types-ts4.5/models/auth-query-parameters.d.ts +11 -0
- package/dist/types-ts4.5/models/errors/helpers.d.ts +6 -0
- package/dist/types-ts4.5/models/errors/index.d.ts +11 -0
- package/dist/types-ts4.5/models/errors/types.d.ts +15 -0
- package/dist/types-ts4.5/models/file-state.d.ts +94 -0
- package/dist/types-ts4.5/models/item.d.ts +25 -0
- package/dist/types-ts4.5/models/media.d.ts +48 -0
- package/dist/types-ts4.5/models/mobile-upload.d.ts +28 -0
- package/dist/types-ts4.5/upload-controller.d.ts +7 -0
- package/dist/types-ts4.5/uploader/calculateChunkSize.d.ts +11 -0
- package/dist/types-ts4.5/uploader/error.d.ts +29 -0
- package/dist/types-ts4.5/uploader/index.d.ts +22 -0
- package/dist/types-ts4.5/utils/checkWebpSupport.d.ts +1 -0
- package/dist/types-ts4.5/utils/convertBase64ToBlob.d.ts +1 -0
- package/dist/types-ts4.5/utils/createFileDataLoader.d.ts +30 -0
- package/dist/types-ts4.5/utils/createMediaSubject.d.ts +3 -0
- package/dist/types-ts4.5/utils/detectEmptyFile.d.ts +16 -0
- package/dist/types-ts4.5/utils/getDimensionsFromBlob.d.ts +6 -0
- package/dist/types-ts4.5/utils/getImageDimensionsFromBlob.d.ts +5 -0
- package/dist/types-ts4.5/utils/getMediaTypeFromUploadableFile.d.ts +3 -0
- package/dist/types-ts4.5/utils/getVideoDimensionsFromBlob.d.ts +5 -0
- package/dist/types-ts4.5/utils/hashing/hasher.d.ts +3 -0
- package/dist/types-ts4.5/utils/hashing/hasherCreator.d.ts +3 -0
- package/dist/types-ts4.5/utils/hashing/simpleHasher.d.ts +4 -0
- package/dist/types-ts4.5/utils/hashing/workerHasher.d.ts +16 -0
- package/dist/types-ts4.5/utils/imageResizeModeToFileImageMode.d.ts +3 -0
- package/dist/types-ts4.5/utils/isImageRemote.d.ts +1 -0
- package/dist/types-ts4.5/utils/mediaSubscribable/fromObservable.d.ts +5 -0
- package/dist/types-ts4.5/utils/mediaSubscribable/index.d.ts +3 -0
- package/dist/types-ts4.5/utils/mediaSubscribable/toPromise.d.ts +10 -0
- package/dist/types-ts4.5/utils/mediaSubscribable/types.d.ts +17 -0
- package/dist/types-ts4.5/utils/mobileUpload/error.d.ts +29 -0
- package/dist/types-ts4.5/utils/mobileUpload/helpers.d.ts +8 -0
- package/dist/types-ts4.5/utils/mobileUpload/index.d.ts +5 -0
- package/dist/types-ts4.5/utils/mobileUpload/servicesCache.d.ts +4 -0
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/index.d.ts +7 -0
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/error.d.ts +3 -0
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/processed.d.ts +3 -0
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/processing.d.ts +3 -0
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/processingFailed.d.ts +3 -0
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/states/uploading.d.ts +3 -0
- package/dist/types-ts4.5/utils/mobileUpload/stateMachine/types.d.ts +69 -0
- package/dist/types-ts4.5/utils/overrideMediaTypeIfUnknown.d.ts +5 -0
- package/dist/types-ts4.5/utils/polling/errors.d.ts +12 -0
- package/dist/types-ts4.5/utils/polling/index.d.ts +33 -0
- package/dist/types-ts4.5/utils/polling/types.d.ts +7 -0
- package/dist/types-ts4.5/utils/request/errors.d.ts +20 -0
- package/dist/types-ts4.5/utils/request/helpers.d.ts +46 -0
- package/dist/types-ts4.5/utils/request/index.d.ts +5 -0
- package/dist/types-ts4.5/utils/request/types.d.ts +46 -0
- package/dist/types-ts4.5/utils/safeUnsubscribe.d.ts +2 -0
- package/dist/types-ts4.5/utils/setTimeoutPromise.d.ts +2 -0
- package/dist/types-ts4.5/utils/shouldFetchRemoteFileStates.d.ts +14 -0
- package/dist/types-ts4.5/utils/url.d.ts +17 -0
- package/dist/types-ts4.5/utils/with-media-client-hoc.d.ts +16 -0
- package/package.json +4 -4
- package/report.api.md +11 -15
- package/dist/cjs/utils/parseJwt.js +0 -52
- package/dist/es2019/utils/parseJwt.js +0 -46
- package/dist/esm/utils/parseJwt.js +0 -46
- package/dist/types/utils/parseJwt.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.3",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@atlaskit/chunkinator": "^4.2.0",
|
|
39
|
-
"@atlaskit/media-common": "^
|
|
39
|
+
"@atlaskit/media-common": "^5.0.0",
|
|
40
40
|
"@babel/runtime": "^7.0.0",
|
|
41
41
|
"dataloader": "^2.0.0",
|
|
42
42
|
"deep-equal": "^1.0.1",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
"xstate": "4.20.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@atlaskit/media-core": "^34.1.
|
|
53
|
+
"@atlaskit/media-core": "^34.1.2",
|
|
54
54
|
"@emotion/react": "^11.7.1",
|
|
55
55
|
"react": "^16.8.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@atlaskit/button": "^16.7.0",
|
|
59
59
|
"@atlaskit/docs": "*",
|
|
60
|
-
"@atlaskit/media-card": "^
|
|
60
|
+
"@atlaskit/media-card": "^76.0.0",
|
|
61
61
|
"@atlaskit/media-core": "^34.1.0",
|
|
62
62
|
"@atlaskit/media-test-helpers": "^33.0.0",
|
|
63
63
|
"@atlaskit/ssr": "*",
|
package/report.api.md
CHANGED
|
@@ -272,7 +272,6 @@ export interface FileFetcher {
|
|
|
272
272
|
controller?: UploadController,
|
|
273
273
|
uploadableFileUpfrontIds?: UploadableFileUpfrontIds,
|
|
274
274
|
traceContext?: MediaTraceContext,
|
|
275
|
-
featureFlags?: MediaFeatureFlags,
|
|
276
275
|
): MediaSubscribable;
|
|
277
276
|
// (undocumented)
|
|
278
277
|
uploadExternal(
|
|
@@ -326,16 +325,14 @@ export type FileFetcherErrorAttributes = {
|
|
|
326
325
|
|
|
327
326
|
// @public (undocumented)
|
|
328
327
|
export type FileFetcherErrorReason =
|
|
328
|
+
| 'emptyFileName'
|
|
329
329
|
| 'emptyItems'
|
|
330
330
|
| 'invalidFileId'
|
|
331
331
|
| 'zeroVersionFile';
|
|
332
332
|
|
|
333
333
|
// @public (undocumented)
|
|
334
334
|
export class FileFetcherImpl implements FileFetcher {
|
|
335
|
-
constructor(
|
|
336
|
-
mediaStore: MediaStore,
|
|
337
|
-
featureFlags?: MediaFeatureFlags | undefined,
|
|
338
|
-
);
|
|
335
|
+
constructor(mediaStore: MediaStore);
|
|
339
336
|
// (undocumented)
|
|
340
337
|
copyFile(
|
|
341
338
|
source: CopySourceFile,
|
|
@@ -373,7 +370,6 @@ export class FileFetcherImpl implements FileFetcher {
|
|
|
373
370
|
controller?: UploadController,
|
|
374
371
|
uploadableFileUpfrontIds?: UploadableFileUpfrontIds,
|
|
375
372
|
traceContext?: MediaTraceContext,
|
|
376
|
-
featureFlags?: MediaFeatureFlags,
|
|
377
373
|
): MediaSubscribable;
|
|
378
374
|
// (undocumented)
|
|
379
375
|
uploadExternal(
|
|
@@ -469,7 +465,7 @@ export interface GetFileOptions {
|
|
|
469
465
|
// @public (undocumented)
|
|
470
466
|
export const getMediaClient: (
|
|
471
467
|
mediaClientConfig: MediaClientConfig,
|
|
472
|
-
featureFlags?: MediaFeatureFlags
|
|
468
|
+
featureFlags?: MediaFeatureFlags,
|
|
473
469
|
) => MediaClient;
|
|
474
470
|
|
|
475
471
|
// @public (undocumented)
|
|
@@ -528,7 +524,7 @@ export type ImageResizeMode = 'crop' | 'fit' | 'full-fit' | 'stretchy-fit';
|
|
|
528
524
|
|
|
529
525
|
// @public (undocumented)
|
|
530
526
|
export const imageResizeModeToFileImageMode: (
|
|
531
|
-
resizeMode?: ImageResizeMode
|
|
527
|
+
resizeMode?: ImageResizeMode,
|
|
532
528
|
) => MediaStoreGetFileImageParams['mode'];
|
|
533
529
|
|
|
534
530
|
// @public (undocumented)
|
|
@@ -620,7 +616,7 @@ export const isPreviewableFileState: (
|
|
|
620
616
|
// @public (undocumented)
|
|
621
617
|
export const isPreviewableType: (
|
|
622
618
|
type: MediaType,
|
|
623
|
-
featureFlags?: MediaFeatureFlags
|
|
619
|
+
featureFlags?: MediaFeatureFlags,
|
|
624
620
|
) => boolean;
|
|
625
621
|
|
|
626
622
|
// @public (undocumented)
|
|
@@ -803,6 +799,7 @@ export type MediaClientErrorReason =
|
|
|
803
799
|
| 'clientTimeoutRequest'
|
|
804
800
|
| 'deprecatedEndpoint'
|
|
805
801
|
| 'emptyAuth'
|
|
802
|
+
| 'emptyFileName'
|
|
806
803
|
| 'emptyItems'
|
|
807
804
|
| 'failedAuthProvider'
|
|
808
805
|
| 'fileSizeExceedsLimit'
|
|
@@ -989,7 +986,7 @@ export class MediaStore {
|
|
|
989
986
|
controller?: AbortController,
|
|
990
987
|
): Promise<Response>;
|
|
991
988
|
// (undocumented)
|
|
992
|
-
resolveAuth: (authContext?: AuthContext
|
|
989
|
+
resolveAuth: (authContext?: AuthContext) => Promise<Auth>;
|
|
993
990
|
// (undocumented)
|
|
994
991
|
resolveInitialAuth: () => Auth;
|
|
995
992
|
// (undocumented)
|
|
@@ -1115,7 +1112,6 @@ export type MediaStoreRequestOptions = RequestMetadata & {
|
|
|
1115
1112
|
readonly body?: any;
|
|
1116
1113
|
readonly clientOptions?: ClientOptions;
|
|
1117
1114
|
readonly traceContext?: MediaTraceContext;
|
|
1118
|
-
readonly resolvedAuth?: Auth;
|
|
1119
1115
|
};
|
|
1120
1116
|
|
|
1121
1117
|
// @public (undocumented)
|
|
@@ -1533,7 +1529,7 @@ export class StargateClient {
|
|
|
1533
1529
|
// @public (undocumented)
|
|
1534
1530
|
export type TouchedFiles = {
|
|
1535
1531
|
created: CreatedTouchedFile[];
|
|
1536
|
-
rejected
|
|
1532
|
+
rejected?: RejectedTouchFile[];
|
|
1537
1533
|
};
|
|
1538
1534
|
|
|
1539
1535
|
// @public (undocumented)
|
|
@@ -1589,8 +1585,8 @@ export const uploadFile: (
|
|
|
1589
1585
|
file: UploadableFile,
|
|
1590
1586
|
store: MediaStore,
|
|
1591
1587
|
uploadableFileUpfrontIds: UploadableFileUpfrontIds,
|
|
1592
|
-
callbacks?: UploadFileCallbacks
|
|
1593
|
-
traceContext?: MediaTraceContext
|
|
1588
|
+
callbacks?: UploadFileCallbacks,
|
|
1589
|
+
traceContext?: MediaTraceContext,
|
|
1594
1590
|
) => UploadFileResult;
|
|
1595
1591
|
|
|
1596
1592
|
// @public (undocumented)
|
|
@@ -1670,7 +1666,7 @@ export type WithMediaClientFunction = <P extends WithMediaClient>(
|
|
|
1670
1666
|
|
|
1671
1667
|
```json
|
|
1672
1668
|
{
|
|
1673
|
-
"@atlaskit/media-core": "^34.
|
|
1669
|
+
"@atlaskit/media-core": "^34.1.2",
|
|
1674
1670
|
"@emotion/react": "^11.7.1",
|
|
1675
1671
|
"react": "^16.8.0"
|
|
1676
1672
|
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = _default;
|
|
7
|
-
// Implementation obtained from https://github.com/auth0/jwt-decode
|
|
8
|
-
// Copied from https://bitbucket.org/atlassian/%7Bc8e2f021-38d2-46d0-9b7a-b3f7b428f724%7D/pull-requests/13080
|
|
9
|
-
|
|
10
|
-
/* Decodes base64 string into unicode */
|
|
11
|
-
var b64DecodeUnicode = function b64DecodeUnicode(str) {
|
|
12
|
-
return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {
|
|
13
|
-
var code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
14
|
-
if (code.length < 2) {
|
|
15
|
-
code = '0' + code;
|
|
16
|
-
}
|
|
17
|
-
return '%' + code;
|
|
18
|
-
}));
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/* Decodes base64url string into unicode */
|
|
22
|
-
var b64Decode = function b64Decode(str) {
|
|
23
|
-
var output = str.replace(/-/g, '+').replace(/_/g, '/');
|
|
24
|
-
switch (output.length % 4) {
|
|
25
|
-
case 0:
|
|
26
|
-
break;
|
|
27
|
-
case 2:
|
|
28
|
-
output += '==';
|
|
29
|
-
break;
|
|
30
|
-
case 3:
|
|
31
|
-
output += '=';
|
|
32
|
-
break;
|
|
33
|
-
default:
|
|
34
|
-
throw new Error('Illegal base64url string!');
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
return b64DecodeUnicode(output);
|
|
38
|
-
} catch (err) {
|
|
39
|
-
return atob(output);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
function _default(token) {
|
|
43
|
-
try {
|
|
44
|
-
var body = token.split('.')[1];
|
|
45
|
-
return JSON.parse(b64Decode(body));
|
|
46
|
-
} catch (e) {
|
|
47
|
-
if (e instanceof Error) {
|
|
48
|
-
throw new Error('Invalid token specified: ' + e.message);
|
|
49
|
-
}
|
|
50
|
-
throw e;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// Implementation obtained from https://github.com/auth0/jwt-decode
|
|
2
|
-
// Copied from https://bitbucket.org/atlassian/%7Bc8e2f021-38d2-46d0-9b7a-b3f7b428f724%7D/pull-requests/13080
|
|
3
|
-
|
|
4
|
-
/* Decodes base64 string into unicode */
|
|
5
|
-
const b64DecodeUnicode = str => {
|
|
6
|
-
return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {
|
|
7
|
-
let code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
8
|
-
if (code.length < 2) {
|
|
9
|
-
code = '0' + code;
|
|
10
|
-
}
|
|
11
|
-
return '%' + code;
|
|
12
|
-
}));
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/* Decodes base64url string into unicode */
|
|
16
|
-
const b64Decode = str => {
|
|
17
|
-
let output = str.replace(/-/g, '+').replace(/_/g, '/');
|
|
18
|
-
switch (output.length % 4) {
|
|
19
|
-
case 0:
|
|
20
|
-
break;
|
|
21
|
-
case 2:
|
|
22
|
-
output += '==';
|
|
23
|
-
break;
|
|
24
|
-
case 3:
|
|
25
|
-
output += '=';
|
|
26
|
-
break;
|
|
27
|
-
default:
|
|
28
|
-
throw new Error('Illegal base64url string!');
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
return b64DecodeUnicode(output);
|
|
32
|
-
} catch (err) {
|
|
33
|
-
return atob(output);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
export default function (token) {
|
|
37
|
-
try {
|
|
38
|
-
const body = token.split('.')[1];
|
|
39
|
-
return JSON.parse(b64Decode(body));
|
|
40
|
-
} catch (e) {
|
|
41
|
-
if (e instanceof Error) {
|
|
42
|
-
throw new Error('Invalid token specified: ' + e.message);
|
|
43
|
-
}
|
|
44
|
-
throw e;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// Implementation obtained from https://github.com/auth0/jwt-decode
|
|
2
|
-
// Copied from https://bitbucket.org/atlassian/%7Bc8e2f021-38d2-46d0-9b7a-b3f7b428f724%7D/pull-requests/13080
|
|
3
|
-
|
|
4
|
-
/* Decodes base64 string into unicode */
|
|
5
|
-
var b64DecodeUnicode = function b64DecodeUnicode(str) {
|
|
6
|
-
return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {
|
|
7
|
-
var code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
8
|
-
if (code.length < 2) {
|
|
9
|
-
code = '0' + code;
|
|
10
|
-
}
|
|
11
|
-
return '%' + code;
|
|
12
|
-
}));
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/* Decodes base64url string into unicode */
|
|
16
|
-
var b64Decode = function b64Decode(str) {
|
|
17
|
-
var output = str.replace(/-/g, '+').replace(/_/g, '/');
|
|
18
|
-
switch (output.length % 4) {
|
|
19
|
-
case 0:
|
|
20
|
-
break;
|
|
21
|
-
case 2:
|
|
22
|
-
output += '==';
|
|
23
|
-
break;
|
|
24
|
-
case 3:
|
|
25
|
-
output += '=';
|
|
26
|
-
break;
|
|
27
|
-
default:
|
|
28
|
-
throw new Error('Illegal base64url string!');
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
return b64DecodeUnicode(output);
|
|
32
|
-
} catch (err) {
|
|
33
|
-
return atob(output);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
export default function (token) {
|
|
37
|
-
try {
|
|
38
|
-
var body = token.split('.')[1];
|
|
39
|
-
return JSON.parse(b64Decode(body));
|
|
40
|
-
} catch (e) {
|
|
41
|
-
if (e instanceof Error) {
|
|
42
|
-
throw new Error('Invalid token specified: ' + e.message);
|
|
43
|
-
}
|
|
44
|
-
throw e;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function (token: string): unknown;
|