@atlaskit/media-client 37.2.0 → 37.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/client/file-fetcher/index.js +3 -3
- package/dist/cjs/client/media-store/MediaStore.js +7 -2
- package/dist/es2019/client/file-fetcher/index.js +3 -3
- package/dist/es2019/client/media-store/MediaStore.js +6 -2
- package/dist/esm/client/file-fetcher/index.js +3 -3
- package/dist/esm/client/media-store/MediaStore.js +7 -2
- package/dist/types/client/file-fetcher/index.d.ts +2 -2
- package/dist/types/client/media-store/MediaStore.d.ts +1 -1
- package/dist/types/client/media-store/types.d.ts +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/media-client
|
|
2
2
|
|
|
3
|
+
## 37.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`bea4da79c297d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bea4da79c297d) -
|
|
8
|
+
[ux] EDITOR-7679 use fallback media name for filename in download
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 37.2.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -516,8 +516,8 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
516
516
|
}
|
|
517
517
|
}, {
|
|
518
518
|
key: "getFileBinaryURL",
|
|
519
|
-
value: function getFileBinaryURL(id, collectionName, maxAge) {
|
|
520
|
-
return this.mediaApi.getFileBinaryURL(id, collectionName, maxAge);
|
|
519
|
+
value: function getFileBinaryURL(id, collectionName, maxAge, name) {
|
|
520
|
+
return this.mediaApi.getFileBinaryURL(id, collectionName, maxAge, name);
|
|
521
521
|
}
|
|
522
522
|
}, {
|
|
523
523
|
key: "touchFiles",
|
|
@@ -764,7 +764,7 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
764
764
|
collectionName = _args1.length > 2 ? _args1[2] : undefined;
|
|
765
765
|
traceContext = _args1.length > 3 ? _args1[3] : undefined;
|
|
766
766
|
_context1.next = 1;
|
|
767
|
-
return this.mediaApi.getFileBinaryURL(id, collectionName);
|
|
767
|
+
return this.mediaApi.getFileBinaryURL(id, collectionName, undefined, name);
|
|
768
768
|
case 1:
|
|
769
769
|
url = _context1.sent;
|
|
770
770
|
(0, _downloadUrl.downloadUrl)(url, {
|
|
@@ -10,6 +10,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
14
|
var _mediaCore = require("@atlaskit/media-core");
|
|
14
15
|
var _constants = require("../../constants");
|
|
15
16
|
var _artifacts = require("../../models/artifacts");
|
|
@@ -519,6 +520,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
519
520
|
value: function () {
|
|
520
521
|
var _getFileBinaryURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee0(id, collectionName) {
|
|
521
522
|
var maxAge,
|
|
523
|
+
name,
|
|
522
524
|
auth,
|
|
523
525
|
options,
|
|
524
526
|
binaryEndpoint,
|
|
@@ -527,6 +529,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
527
529
|
while (1) switch (_context0.prev = _context0.next) {
|
|
528
530
|
case 0:
|
|
529
531
|
maxAge = _args0.length > 2 && _args0[2] !== undefined ? _args0[2] : _constants.FILE_CACHE_MAX_AGE;
|
|
532
|
+
name = _args0.length > 3 ? _args0[3] : undefined;
|
|
530
533
|
_context0.next = 1;
|
|
531
534
|
return this.resolveAuth({
|
|
532
535
|
collectionName: collectionName
|
|
@@ -534,11 +537,13 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
534
537
|
case 1:
|
|
535
538
|
auth = _context0.sent;
|
|
536
539
|
options = {
|
|
537
|
-
params: {
|
|
540
|
+
params: _objectSpread({
|
|
538
541
|
dl: true,
|
|
539
542
|
collection: collectionName,
|
|
540
543
|
'max-age': maxAge
|
|
541
|
-
},
|
|
544
|
+
}, name && (0, _expValEquals.expValEquals)('platform_editor_media_download_fallback_name', 'isEnabled', true) ? {
|
|
545
|
+
name: name
|
|
546
|
+
} : {}),
|
|
542
547
|
auth: auth
|
|
543
548
|
};
|
|
544
549
|
binaryEndpoint = cdnFeatureFlag('binary');
|
|
@@ -319,8 +319,8 @@ export class FileFetcherImpl {
|
|
|
319
319
|
getArtifactURL(artifacts, artifactName, collectionName) {
|
|
320
320
|
return this.mediaApi.getArtifactURL(artifacts, artifactName, collectionName);
|
|
321
321
|
}
|
|
322
|
-
getFileBinaryURL(id, collectionName, maxAge) {
|
|
323
|
-
return this.mediaApi.getFileBinaryURL(id, collectionName, maxAge);
|
|
322
|
+
getFileBinaryURL(id, collectionName, maxAge, name) {
|
|
323
|
+
return this.mediaApi.getFileBinaryURL(id, collectionName, maxAge, name);
|
|
324
324
|
}
|
|
325
325
|
touchFiles(descriptors, collection, traceContext, expectedFileSize) {
|
|
326
326
|
return this.mediaApi.touchFiles({
|
|
@@ -494,7 +494,7 @@ export class FileFetcherImpl {
|
|
|
494
494
|
return fromObservable(subject);
|
|
495
495
|
}
|
|
496
496
|
async downloadBinary(id, name = 'download', collectionName, traceContext) {
|
|
497
|
-
const url = await this.mediaApi.getFileBinaryURL(id, collectionName);
|
|
497
|
+
const url = await this.mediaApi.getFileBinaryURL(id, collectionName, undefined, name);
|
|
498
498
|
downloadUrl(url, {
|
|
499
499
|
name
|
|
500
500
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
3
|
import { isClientBasedAuth } from '@atlaskit/media-core';
|
|
3
4
|
import { FILE_CACHE_MAX_AGE, MAX_RESOLUTION } from '../../constants';
|
|
4
5
|
import { getArtifactUrl } from '../../models/artifacts';
|
|
@@ -343,7 +344,7 @@ export class MediaStore {
|
|
|
343
344
|
};
|
|
344
345
|
return this.request(`/file/${id}/${binaryEndpoint}`, options, abortController, true).then(createMapResponseToBlob(metadata));
|
|
345
346
|
}
|
|
346
|
-
async getFileBinaryURL(id, collectionName, maxAge = FILE_CACHE_MAX_AGE) {
|
|
347
|
+
async getFileBinaryURL(id, collectionName, maxAge = FILE_CACHE_MAX_AGE, name) {
|
|
347
348
|
const auth = await this.resolveAuth({
|
|
348
349
|
collectionName
|
|
349
350
|
});
|
|
@@ -351,7 +352,10 @@ export class MediaStore {
|
|
|
351
352
|
params: {
|
|
352
353
|
dl: true,
|
|
353
354
|
collection: collectionName,
|
|
354
|
-
'max-age': maxAge
|
|
355
|
+
'max-age': maxAge,
|
|
356
|
+
...(name && expValEquals('platform_editor_media_download_fallback_name', 'isEnabled', true) ? {
|
|
357
|
+
name
|
|
358
|
+
} : {})
|
|
355
359
|
},
|
|
356
360
|
auth
|
|
357
361
|
};
|
|
@@ -499,8 +499,8 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
499
499
|
}
|
|
500
500
|
}, {
|
|
501
501
|
key: "getFileBinaryURL",
|
|
502
|
-
value: function getFileBinaryURL(id, collectionName, maxAge) {
|
|
503
|
-
return this.mediaApi.getFileBinaryURL(id, collectionName, maxAge);
|
|
502
|
+
value: function getFileBinaryURL(id, collectionName, maxAge, name) {
|
|
503
|
+
return this.mediaApi.getFileBinaryURL(id, collectionName, maxAge, name);
|
|
504
504
|
}
|
|
505
505
|
}, {
|
|
506
506
|
key: "touchFiles",
|
|
@@ -747,7 +747,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
|
|
|
747
747
|
collectionName = _args1.length > 2 ? _args1[2] : undefined;
|
|
748
748
|
traceContext = _args1.length > 3 ? _args1[3] : undefined;
|
|
749
749
|
_context1.next = 1;
|
|
750
|
-
return this.mediaApi.getFileBinaryURL(id, collectionName);
|
|
750
|
+
return this.mediaApi.getFileBinaryURL(id, collectionName, undefined, name);
|
|
751
751
|
case 1:
|
|
752
752
|
url = _context1.sent;
|
|
753
753
|
downloadUrl(url, {
|
|
@@ -5,6 +5,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
9
|
import { isClientBasedAuth } from '@atlaskit/media-core';
|
|
9
10
|
import { FILE_CACHE_MAX_AGE, MAX_RESOLUTION } from '../../constants';
|
|
10
11
|
import { getArtifactUrl } from '../../models/artifacts';
|
|
@@ -513,6 +514,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
513
514
|
value: function () {
|
|
514
515
|
var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee0(id, collectionName) {
|
|
515
516
|
var maxAge,
|
|
517
|
+
name,
|
|
516
518
|
auth,
|
|
517
519
|
options,
|
|
518
520
|
binaryEndpoint,
|
|
@@ -521,6 +523,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
521
523
|
while (1) switch (_context0.prev = _context0.next) {
|
|
522
524
|
case 0:
|
|
523
525
|
maxAge = _args0.length > 2 && _args0[2] !== undefined ? _args0[2] : FILE_CACHE_MAX_AGE;
|
|
526
|
+
name = _args0.length > 3 ? _args0[3] : undefined;
|
|
524
527
|
_context0.next = 1;
|
|
525
528
|
return this.resolveAuth({
|
|
526
529
|
collectionName: collectionName
|
|
@@ -528,11 +531,13 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
528
531
|
case 1:
|
|
529
532
|
auth = _context0.sent;
|
|
530
533
|
options = {
|
|
531
|
-
params: {
|
|
534
|
+
params: _objectSpread({
|
|
532
535
|
dl: true,
|
|
533
536
|
collection: collectionName,
|
|
534
537
|
'max-age': maxAge
|
|
535
|
-
},
|
|
538
|
+
}, name && expValEquals('platform_editor_media_download_fallback_name', 'isEnabled', true) ? {
|
|
539
|
+
name: name
|
|
540
|
+
} : {}),
|
|
536
541
|
auth: auth
|
|
537
542
|
};
|
|
538
543
|
binaryEndpoint = cdnFeatureFlag('binary');
|
|
@@ -40,7 +40,7 @@ export interface FileFetcher {
|
|
|
40
40
|
downloadBinary(id: string, name?: string, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
41
41
|
getCurrentState(id: string, options?: GetFileOptions): Promise<FileState>;
|
|
42
42
|
copyFile(source: CopySourceFile, destination: CopyDestination, options?: CopyFileOptions, traceContext?: MediaTraceContext): Promise<MediaFile>;
|
|
43
|
-
getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
|
|
43
|
+
getFileBinaryURL(id: string, collectionName?: string, maxAge?: number, name?: string): Promise<string>;
|
|
44
44
|
registerCopyIntent(id: string, collectionName?: string): Promise<void>;
|
|
45
45
|
uploadArtifact(id: string, file: File, params: UploadArtifactParams, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaItemDetails>;
|
|
46
46
|
deleteArtifact(id: string, artifactName: string, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
|
|
@@ -63,7 +63,7 @@ export declare class FileFetcherImpl implements FileFetcher {
|
|
|
63
63
|
getFileState(id: string, options?: GetFileOptions): MediaSubscribable;
|
|
64
64
|
getCurrentState(id: string, options?: GetFileOptions): Promise<FileState>;
|
|
65
65
|
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string): Promise<string>;
|
|
66
|
-
getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
|
|
66
|
+
getFileBinaryURL(id: string, collectionName?: string, maxAge?: number, name?: string): Promise<string>;
|
|
67
67
|
private createDownloadFileStream;
|
|
68
68
|
touchFiles(descriptors: TouchFileDescriptor[], collection?: string, traceContext?: MediaTraceContext, expectedFileSize?: number): Promise<TouchedFiles>;
|
|
69
69
|
private generateUploadableFileUpfrontIds;
|
|
@@ -27,7 +27,7 @@ export declare class MediaStore implements MediaApi {
|
|
|
27
27
|
getFileImageURLSync(id: string, params?: MediaStoreGetFileImageParams): string;
|
|
28
28
|
private createFileImageURL;
|
|
29
29
|
getFileBinary(id: string, collectionName?: string, abortController?: AbortController, maxAge?: number): Promise<Blob>;
|
|
30
|
-
getFileBinaryURL(id: string, collectionName?: string, maxAge?: number): Promise<string>;
|
|
30
|
+
getFileBinaryURL(id: string, collectionName?: string, maxAge?: number, name?: string): Promise<string>;
|
|
31
31
|
getArtifactURL(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string, maxAge?: number): Promise<string>;
|
|
32
32
|
getArtifactBinary: MediaApi['getArtifactBinary'];
|
|
33
33
|
uploadArtifact: MediaApi['uploadArtifact'];
|
|
@@ -179,7 +179,7 @@ export interface MediaApi {
|
|
|
179
179
|
getFileImageURL: (id: string, params?: MediaStoreGetFileImageParams) => Promise<string>;
|
|
180
180
|
getFileImageURLSync: (id: string, params?: MediaStoreGetFileImageParams) => string;
|
|
181
181
|
getFileBinary: (id: string, collectionName?: string, abortController?: AbortController) => Promise<Blob>;
|
|
182
|
-
getFileBinaryURL: (id: string, collectionName?: string) => Promise<string>;
|
|
182
|
+
getFileBinaryURL: (id: string, collectionName?: string, maxAge?: number, name?: string) => Promise<string>;
|
|
183
183
|
getArtifactURL: (artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, collectionName?: string) => Promise<string>;
|
|
184
184
|
getArtifactBinary(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, options: GetArtifactBinaryOptions): Promise<Blob>;
|
|
185
185
|
uploadArtifact(id: string, file: File, params: UploadArtifactParams, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaItemDetails>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "37.2.
|
|
3
|
+
"version": "37.2.1",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"@atlaskit/chunkinator": "^8.0.0",
|
|
26
26
|
"@atlaskit/media-common": "^14.2.0",
|
|
27
27
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
28
|
+
"@atlaskit/tmp-editor-statsig": "^121.1.0",
|
|
28
29
|
"@babel/runtime": "^7.0.0",
|
|
29
30
|
"dataloader": "^2.1.0",
|
|
30
31
|
"deep-equal": "^1.0.1",
|