@atlaskit/media-client 37.3.0 → 37.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/media-client
2
2
 
3
+ ## 37.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`bcd2b3a9ab05b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bcd2b3a9ab05b) -
8
+ Added a fallback for file size: if `size` is not supplied by the integrator, it is now inferred
9
+ from the Blob content.
10
+
3
11
  ## 37.3.0
4
12
 
5
13
  ### Minor Changes
@@ -99,12 +99,15 @@ var createProcessingFunction = function createProcessingFunction(store, deferred
99
99
  };
100
100
  var createFileFromUpload = /*#__PURE__*/function () {
101
101
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(file, store, uploadableFileUpfrontIds, uploadId, traceContext) {
102
- var collection, name, mimeType, id, occurrenceKey, body;
102
+ var collection, name, mimeType, content, id, occurrenceKey, body;
103
103
  return _regenerator.default.wrap(function (_context4) {
104
104
  while (1) switch (_context4.prev = _context4.next) {
105
105
  case 0:
106
- collection = file.collection, name = file.name, mimeType = file.mimeType;
107
- id = uploadableFileUpfrontIds.id, occurrenceKey = uploadableFileUpfrontIds.occurrenceKey;
106
+ collection = file.collection, name = file.name, mimeType = file.mimeType, content = file.content;
107
+ id = uploadableFileUpfrontIds.id, occurrenceKey = uploadableFileUpfrontIds.occurrenceKey; // If the file is a Blob and the size is not passed from consumer, set the file size from file content
108
+ if (content instanceof Blob && !file.size) {
109
+ file.size = content === null || content === void 0 ? void 0 : content.size;
110
+ }
108
111
  body = file.size ? {
109
112
  uploadId: uploadId,
110
113
  name: name,
@@ -31,12 +31,18 @@ const createFileFromUpload = async (file, store, uploadableFileUpfrontIds, uploa
31
31
  const {
32
32
  collection,
33
33
  name,
34
- mimeType
34
+ mimeType,
35
+ content
35
36
  } = file;
36
37
  const {
37
38
  id,
38
39
  occurrenceKey
39
40
  } = uploadableFileUpfrontIds;
41
+
42
+ // If the file is a Blob and the size is not passed from consumer, set the file size from file content
43
+ if (content instanceof Blob && !file.size) {
44
+ file.size = content === null || content === void 0 ? void 0 : content.size;
45
+ }
40
46
  const body = file.size ? {
41
47
  uploadId,
42
48
  name,
@@ -93,12 +93,15 @@ var createProcessingFunction = function createProcessingFunction(store, deferred
93
93
  };
94
94
  var createFileFromUpload = /*#__PURE__*/function () {
95
95
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(file, store, uploadableFileUpfrontIds, uploadId, traceContext) {
96
- var collection, name, mimeType, id, occurrenceKey, body;
96
+ var collection, name, mimeType, content, id, occurrenceKey, body;
97
97
  return _regeneratorRuntime.wrap(function (_context4) {
98
98
  while (1) switch (_context4.prev = _context4.next) {
99
99
  case 0:
100
- collection = file.collection, name = file.name, mimeType = file.mimeType;
101
- id = uploadableFileUpfrontIds.id, occurrenceKey = uploadableFileUpfrontIds.occurrenceKey;
100
+ collection = file.collection, name = file.name, mimeType = file.mimeType, content = file.content;
101
+ id = uploadableFileUpfrontIds.id, occurrenceKey = uploadableFileUpfrontIds.occurrenceKey; // If the file is a Blob and the size is not passed from consumer, set the file size from file content
102
+ if (content instanceof Blob && !file.size) {
103
+ file.size = content === null || content === void 0 ? void 0 : content.size;
104
+ }
102
105
  body = file.size ? {
103
106
  uploadId: uploadId,
104
107
  name: name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "37.3.0",
3
+ "version": "37.4.0",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"