@atlaskit/media-client 19.0.0 → 19.1.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 +19 -0
- package/dist/cjs/client/media-store/index.js +1 -1
- package/dist/cjs/models/file-state.js +4 -2
- package/dist/cjs/uploader/index.js +24 -56
- package/dist/cjs/utils/createFileDataLoader.js +32 -15
- package/dist/cjs/utils/request/index.js +2 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/media-store/index.js +1 -1
- package/dist/es2019/models/file-state.js +4 -2
- package/dist/es2019/uploader/index.js +4 -8
- package/dist/es2019/utils/createFileDataLoader.js +13 -3
- package/dist/es2019/utils/request/index.js +2 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/client/media-store/index.js +1 -1
- package/dist/esm/models/file-state.js +4 -2
- package/dist/esm/uploader/index.js +24 -55
- package/dist/esm/utils/createFileDataLoader.js +31 -13
- package/dist/esm/utils/request/index.js +2 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/client/media-store/index.d.ts +1 -0
- package/dist/types/models/file-state.d.ts +9 -6
- package/dist/types/models/media.d.ts +3 -1
- package/dist/types/utils/request/types.d.ts +1 -0
- package/package.json +6 -6
- package/report.api.md +16 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/media-client
|
|
2
2
|
|
|
3
|
+
## 19.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6455cf006b3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6455cf006b3) - Builds for this package now pass through a tokens babel plugin, removing runtime invocations of the tokens() function and improving performance.
|
|
8
|
+
|
|
9
|
+
## 19.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`81573c1dfa7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/81573c1dfa7) - Items call creates a batched metadata trace Id
|
|
14
|
+
- [`0bccac57db6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0bccac57db6) - remove mediaUploadApiV2 Feature flag
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`a8eeb045e3a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a8eeb045e3a) - adding media only callouts to docs
|
|
19
|
+
- [`3d40d5e9b37`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3d40d5e9b37) - Adopt updated version of getRandomHex function for generating traceId
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 19.0.0
|
|
4
23
|
|
|
5
24
|
### Major Changes
|
|
@@ -733,7 +733,7 @@ var MediaStore = /*#__PURE__*/function () {
|
|
|
733
733
|
case 5:
|
|
734
734
|
auth = _context11.sent;
|
|
735
735
|
extendedTraceContext = traceContext ? _objectSpread(_objectSpread({}, traceContext), {}, {
|
|
736
|
-
spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || (0, _mediaCommon.getRandomHex)(
|
|
736
|
+
spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || (0, _mediaCommon.getRandomHex)(8)
|
|
737
737
|
}) : undefined;
|
|
738
738
|
_context11.next = 9;
|
|
739
739
|
return (0, _request3.request)("".concat(auth.baseUrl).concat(path), {
|
|
@@ -73,7 +73,8 @@ var mapMediaFileToFileState = function mapMediaFileToFileState(mediaFile) {
|
|
|
73
73
|
mediaType = _mediaFile$data.mediaType,
|
|
74
74
|
mimeType = _mediaFile$data.mimeType,
|
|
75
75
|
representations = _mediaFile$data.representations,
|
|
76
|
-
createdAt = _mediaFile$data.createdAt
|
|
76
|
+
createdAt = _mediaFile$data.createdAt,
|
|
77
|
+
metadataTraceContext = _mediaFile$data.metadataTraceContext;
|
|
77
78
|
var baseState = {
|
|
78
79
|
id: id,
|
|
79
80
|
name: name,
|
|
@@ -82,7 +83,8 @@ var mapMediaFileToFileState = function mapMediaFileToFileState(mediaFile) {
|
|
|
82
83
|
mimeType: mimeType,
|
|
83
84
|
artifacts: artifacts,
|
|
84
85
|
representations: representations,
|
|
85
|
-
createdAt: createdAt
|
|
86
|
+
createdAt: createdAt,
|
|
87
|
+
metadataTraceContext: metadataTraceContext
|
|
86
88
|
};
|
|
87
89
|
|
|
88
90
|
switch (processingStatus) {
|
|
@@ -9,8 +9,6 @@ exports.uploadFile = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
13
|
|
|
16
14
|
var _chunkinator = require("@atlaskit/chunkinator");
|
|
@@ -27,12 +25,6 @@ var _constants = require("../constants");
|
|
|
27
25
|
|
|
28
26
|
var _calculateChunkSize = require("./calculateChunkSize");
|
|
29
27
|
|
|
30
|
-
var _mediaCommon = require("@atlaskit/media-common");
|
|
31
|
-
|
|
32
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
-
|
|
34
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
35
|
-
|
|
36
28
|
var hashingFunction = /*#__PURE__*/function () {
|
|
37
29
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(blob) {
|
|
38
30
|
var hasher;
|
|
@@ -71,41 +63,27 @@ var createProbingFunction = function createProbingFunction(store, deferredUpload
|
|
|
71
63
|
_context2.t0 = store;
|
|
72
64
|
_context2.t1 = hashedChunks(chunks);
|
|
73
65
|
_context2.t2 = collectionName;
|
|
74
|
-
|
|
75
|
-
if (!(0, _mediaCommon.getMediaFeatureFlag)('mediaUploadApiV2', store.featureFlags)) {
|
|
76
|
-
_context2.next = 9;
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
_context2.next = 6;
|
|
66
|
+
_context2.next = 5;
|
|
81
67
|
return deferredUploadId;
|
|
82
68
|
|
|
83
|
-
case
|
|
69
|
+
case 5:
|
|
84
70
|
_context2.t3 = _context2.sent;
|
|
85
|
-
_context2.
|
|
86
|
-
break;
|
|
87
|
-
|
|
88
|
-
case 9:
|
|
89
|
-
_context2.t3 = undefined;
|
|
90
|
-
|
|
91
|
-
case 10:
|
|
92
|
-
_context2.t4 = _context2.t3;
|
|
93
|
-
_context2.t5 = {
|
|
71
|
+
_context2.t4 = {
|
|
94
72
|
collectionName: _context2.t2,
|
|
95
|
-
uploadId: _context2.
|
|
73
|
+
uploadId: _context2.t3
|
|
96
74
|
};
|
|
97
|
-
_context2.
|
|
98
|
-
_context2.next =
|
|
99
|
-
return _context2.t0.probeChunks.call(_context2.t0, _context2.t1, _context2.
|
|
75
|
+
_context2.t5 = traceContext;
|
|
76
|
+
_context2.next = 10;
|
|
77
|
+
return _context2.t0.probeChunks.call(_context2.t0, _context2.t1, _context2.t4, _context2.t5);
|
|
100
78
|
|
|
101
|
-
case
|
|
79
|
+
case 10:
|
|
102
80
|
response = _context2.sent;
|
|
103
81
|
results = response.data.results;
|
|
104
82
|
return _context2.abrupt("return", Object.values(results).map(function (result) {
|
|
105
83
|
return result.exists;
|
|
106
84
|
}));
|
|
107
85
|
|
|
108
|
-
case
|
|
86
|
+
case 13:
|
|
109
87
|
case "end":
|
|
110
88
|
return _context2.stop();
|
|
111
89
|
}
|
|
@@ -122,38 +100,28 @@ var createProbingFunction = function createProbingFunction(store, deferredUpload
|
|
|
122
100
|
var createUploadingFunction = function createUploadingFunction(store, deferredUploadId, collectionName, traceContext) {
|
|
123
101
|
return /*#__PURE__*/function () {
|
|
124
102
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(chunk) {
|
|
125
|
-
var options;
|
|
126
103
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
127
104
|
while (1) {
|
|
128
105
|
switch (_context3.prev = _context3.next) {
|
|
129
106
|
case 0:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
_context3.
|
|
136
|
-
_context3.next = 4;
|
|
107
|
+
_context3.t0 = store;
|
|
108
|
+
_context3.t1 = chunk.hash;
|
|
109
|
+
_context3.t2 = chunk.blob;
|
|
110
|
+
_context3.t3 = collectionName;
|
|
111
|
+
_context3.t4 = chunk.partNumber;
|
|
112
|
+
_context3.next = 7;
|
|
137
113
|
return deferredUploadId;
|
|
138
114
|
|
|
139
|
-
case
|
|
140
|
-
_context3.
|
|
141
|
-
_context3.
|
|
142
|
-
|
|
143
|
-
|
|
115
|
+
case 7:
|
|
116
|
+
_context3.t5 = _context3.sent;
|
|
117
|
+
_context3.t6 = {
|
|
118
|
+
collectionName: _context3.t3,
|
|
119
|
+
partNumber: _context3.t4,
|
|
120
|
+
uploadId: _context3.t5
|
|
144
121
|
};
|
|
145
|
-
_context3.
|
|
146
|
-
break;
|
|
147
|
-
|
|
148
|
-
case 8:
|
|
149
|
-
_context3.t0 = {};
|
|
150
|
-
|
|
151
|
-
case 9:
|
|
152
|
-
options = _context3.t0;
|
|
122
|
+
_context3.t7 = traceContext;
|
|
153
123
|
_context3.next = 12;
|
|
154
|
-
return
|
|
155
|
-
collectionName: collectionName
|
|
156
|
-
}, options), traceContext);
|
|
124
|
+
return _context3.t0.uploadChunk.call(_context3.t0, _context3.t1, _context3.t2, _context3.t6, _context3.t7);
|
|
157
125
|
|
|
158
126
|
case 12:
|
|
159
127
|
return _context3.abrupt("return", _context3.sent);
|
|
@@ -253,7 +221,7 @@ var uploadFile = function uploadFile(file, store, uploadableFileUpfrontIds, call
|
|
|
253
221
|
var chunkSize = _constants.CHUNK_SIZE;
|
|
254
222
|
|
|
255
223
|
try {
|
|
256
|
-
if (content instanceof Blob
|
|
224
|
+
if (content instanceof Blob) {
|
|
257
225
|
chunkSize = (0, _calculateChunkSize.calculateChunkSize)(content.size);
|
|
258
226
|
}
|
|
259
227
|
} catch (err) {
|
|
@@ -16,12 +16,18 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
16
16
|
|
|
17
17
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
18
18
|
|
|
19
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
|
+
|
|
19
21
|
require("setimmediate");
|
|
20
22
|
|
|
21
23
|
var _dataloader = _interopRequireDefault(require("dataloader"));
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
var _mediaCommon = require("@atlaskit/media-common");
|
|
26
|
+
|
|
27
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
28
|
+
|
|
29
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
30
|
+
|
|
25
31
|
var MAX_BATCH_SIZE = 100;
|
|
26
32
|
exports.MAX_BATCH_SIZE = MAX_BATCH_SIZE;
|
|
27
33
|
|
|
@@ -38,7 +44,9 @@ var getItemsFromKeys = function getItemsFromKeys(dataloaderKeys, fileItems) {
|
|
|
38
44
|
var id = fileItem.id,
|
|
39
45
|
collection = fileItem.collection;
|
|
40
46
|
var key = makeCacheKey(id, collection);
|
|
41
|
-
prev[key] = isBatchLoadingErrorResult(fileItem) ? fileItem.error : fileItem.details
|
|
47
|
+
prev[key] = isBatchLoadingErrorResult(fileItem) ? fileItem.error : _objectSpread(_objectSpread({}, fileItem.details), {}, {
|
|
48
|
+
metadataTraceContext: fileItem.metadataTraceContext
|
|
49
|
+
});
|
|
42
50
|
return prev;
|
|
43
51
|
}, {});
|
|
44
52
|
return dataloaderKeys.map(function (dataloaderKey) {
|
|
@@ -84,26 +92,35 @@ function createBatchLoadingFunc(mediaStore) {
|
|
|
84
92
|
_context2.next = 5;
|
|
85
93
|
return Promise.all(Object.keys(fileIdsByCollection).map( /*#__PURE__*/function () {
|
|
86
94
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(collectionNameKey) {
|
|
87
|
-
var fileIds, collectionName, response;
|
|
95
|
+
var metadataTraceContext, fileIds, collectionName, response, itemsWithMetadataTraceContext;
|
|
88
96
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
89
97
|
while (1) {
|
|
90
98
|
switch (_context.prev = _context.next) {
|
|
91
99
|
case 0:
|
|
100
|
+
metadataTraceContext = {
|
|
101
|
+
traceId: (0, _mediaCommon.getRandomHex)(8),
|
|
102
|
+
spanId: (0, _mediaCommon.getRandomHex)(8)
|
|
103
|
+
};
|
|
92
104
|
fileIds = fileIdsByCollection[collectionNameKey];
|
|
93
105
|
collectionName = collectionNameKey === nonCollectionName ? undefined : collectionNameKey;
|
|
94
|
-
_context.prev =
|
|
95
|
-
_context.next =
|
|
96
|
-
return mediaStore.getItems(fileIds, collectionName);
|
|
106
|
+
_context.prev = 3;
|
|
107
|
+
_context.next = 6;
|
|
108
|
+
return mediaStore.getItems(fileIds, collectionName, metadataTraceContext);
|
|
97
109
|
|
|
98
|
-
case
|
|
110
|
+
case 6:
|
|
99
111
|
response = _context.sent;
|
|
100
|
-
|
|
101
|
-
|
|
112
|
+
itemsWithMetadataTraceContext = response.data.items.map(function (item) {
|
|
113
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
114
|
+
metadataTraceContext: metadataTraceContext
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
items.push.apply(items, (0, _toConsumableArray2.default)(itemsWithMetadataTraceContext));
|
|
118
|
+
_context.next = 14;
|
|
102
119
|
break;
|
|
103
120
|
|
|
104
|
-
case
|
|
105
|
-
_context.prev =
|
|
106
|
-
_context.t0 = _context["catch"](
|
|
121
|
+
case 11:
|
|
122
|
+
_context.prev = 11;
|
|
123
|
+
_context.t0 = _context["catch"](3);
|
|
107
124
|
fileIds.forEach(function (fileId) {
|
|
108
125
|
items.push({
|
|
109
126
|
id: fileId,
|
|
@@ -112,12 +129,12 @@ function createBatchLoadingFunc(mediaStore) {
|
|
|
112
129
|
});
|
|
113
130
|
});
|
|
114
131
|
|
|
115
|
-
case
|
|
132
|
+
case 14:
|
|
116
133
|
case "end":
|
|
117
134
|
return _context.stop();
|
|
118
135
|
}
|
|
119
136
|
}
|
|
120
|
-
}, _callee, null, [[
|
|
137
|
+
}, _callee, null, [[3, 11]]);
|
|
121
138
|
}));
|
|
122
139
|
|
|
123
140
|
return function (_x2) {
|
|
@@ -66,7 +66,8 @@ function _request() {
|
|
|
66
66
|
retryOptions = clientOptions.retryOptions;
|
|
67
67
|
metadata = {
|
|
68
68
|
method: method,
|
|
69
|
-
endpoint: endpoint
|
|
69
|
+
endpoint: endpoint,
|
|
70
|
+
traceContext: traceContext
|
|
70
71
|
}; // TODO BMPT-918: add client timeout feature behing a FF (using clientOptions.clientTimeout + Promise.race)
|
|
71
72
|
|
|
72
73
|
doFetch = function doFetch() {
|
package/dist/cjs/version.json
CHANGED
|
@@ -395,7 +395,7 @@ export class MediaStore {
|
|
|
395
395
|
} = options;
|
|
396
396
|
const auth = await this.resolveAuth(authContext);
|
|
397
397
|
const extendedTraceContext = traceContext ? { ...traceContext,
|
|
398
|
-
spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || getRandomHex(
|
|
398
|
+
spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || getRandomHex(8)
|
|
399
399
|
} : undefined;
|
|
400
400
|
const response = await request(`${auth.baseUrl}${path}`, {
|
|
401
401
|
method,
|
|
@@ -25,7 +25,8 @@ export const mapMediaFileToFileState = mediaFile => {
|
|
|
25
25
|
mediaType,
|
|
26
26
|
mimeType,
|
|
27
27
|
representations,
|
|
28
|
-
createdAt
|
|
28
|
+
createdAt,
|
|
29
|
+
metadataTraceContext
|
|
29
30
|
} = mediaFile.data;
|
|
30
31
|
const baseState = {
|
|
31
32
|
id,
|
|
@@ -35,7 +36,8 @@ export const mapMediaFileToFileState = mediaFile => {
|
|
|
35
36
|
mimeType,
|
|
36
37
|
artifacts,
|
|
37
38
|
representations,
|
|
38
|
-
createdAt
|
|
39
|
+
createdAt,
|
|
40
|
+
metadataTraceContext
|
|
39
41
|
};
|
|
40
42
|
|
|
41
43
|
switch (processingStatus) {
|
|
@@ -5,7 +5,6 @@ import { createHasher } from '../utils/hashing/hasherCreator';
|
|
|
5
5
|
import { UploaderError } from './error';
|
|
6
6
|
import { CHUNK_SIZE, PROCESSING_BATCH_SIZE } from '../constants';
|
|
7
7
|
import { calculateChunkSize, fileSizeError } from './calculateChunkSize';
|
|
8
|
-
import { getMediaFeatureFlag } from '@atlaskit/media-common'; // TODO: Allow to pass multiple files
|
|
9
8
|
|
|
10
9
|
const hashingFunction = async blob => {
|
|
11
10
|
const hasher = await createHasher();
|
|
@@ -15,20 +14,17 @@ const hashingFunction = async blob => {
|
|
|
15
14
|
const createProbingFunction = (store, deferredUploadId, collectionName, traceContext) => async chunks => {
|
|
16
15
|
const response = await store.probeChunks(hashedChunks(chunks), {
|
|
17
16
|
collectionName,
|
|
18
|
-
uploadId:
|
|
17
|
+
uploadId: await deferredUploadId
|
|
19
18
|
}, traceContext);
|
|
20
19
|
const results = response.data.results;
|
|
21
20
|
return Object.values(results).map(result => result.exists);
|
|
22
21
|
};
|
|
23
22
|
|
|
24
23
|
const createUploadingFunction = (store, deferredUploadId, collectionName, traceContext) => async chunk => {
|
|
25
|
-
const options = getMediaFeatureFlag('mediaUploadApiV2', store.featureFlags) ? {
|
|
26
|
-
partNumber: chunk.partNumber,
|
|
27
|
-
uploadId: await deferredUploadId
|
|
28
|
-
} : {};
|
|
29
24
|
return await store.uploadChunk(chunk.hash, chunk.blob, {
|
|
30
25
|
collectionName,
|
|
31
|
-
|
|
26
|
+
partNumber: chunk.partNumber,
|
|
27
|
+
uploadId: await deferredUploadId
|
|
32
28
|
}, traceContext);
|
|
33
29
|
};
|
|
34
30
|
|
|
@@ -77,7 +73,7 @@ export const uploadFile = (file, store, uploadableFileUpfrontIds, callbacks, tra
|
|
|
77
73
|
let chunkSize = CHUNK_SIZE;
|
|
78
74
|
|
|
79
75
|
try {
|
|
80
|
-
if (content instanceof Blob
|
|
76
|
+
if (content instanceof Blob) {
|
|
81
77
|
chunkSize = calculateChunkSize(content.size);
|
|
82
78
|
}
|
|
83
79
|
} catch (err) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// @see https://github.com/graphql/dataloader/issues/249
|
|
3
3
|
import 'setimmediate';
|
|
4
4
|
import Dataloader from 'dataloader';
|
|
5
|
+
import { getRandomHex } from '@atlaskit/media-common';
|
|
5
6
|
export const MAX_BATCH_SIZE = 100;
|
|
6
7
|
|
|
7
8
|
const isBatchLoadingErrorResult = result => {
|
|
@@ -17,7 +18,9 @@ export const getItemsFromKeys = (dataloaderKeys, fileItems) => {
|
|
|
17
18
|
collection
|
|
18
19
|
} = fileItem;
|
|
19
20
|
const key = makeCacheKey(id, collection);
|
|
20
|
-
prev[key] = isBatchLoadingErrorResult(fileItem) ? fileItem.error : fileItem.details
|
|
21
|
+
prev[key] = isBatchLoadingErrorResult(fileItem) ? fileItem.error : { ...fileItem.details,
|
|
22
|
+
metadataTraceContext: fileItem.metadataTraceContext
|
|
23
|
+
};
|
|
21
24
|
return prev;
|
|
22
25
|
}, {});
|
|
23
26
|
return dataloaderKeys.map(dataloaderKey => {
|
|
@@ -55,12 +58,19 @@ export function createBatchLoadingFunc(mediaStore) {
|
|
|
55
58
|
}, {});
|
|
56
59
|
const items = [];
|
|
57
60
|
await Promise.all(Object.keys(fileIdsByCollection).map(async collectionNameKey => {
|
|
61
|
+
const metadataTraceContext = {
|
|
62
|
+
traceId: getRandomHex(8),
|
|
63
|
+
spanId: getRandomHex(8)
|
|
64
|
+
};
|
|
58
65
|
const fileIds = fileIdsByCollection[collectionNameKey];
|
|
59
66
|
const collectionName = collectionNameKey === nonCollectionName ? undefined : collectionNameKey;
|
|
60
67
|
|
|
61
68
|
try {
|
|
62
|
-
const response = await mediaStore.getItems(fileIds, collectionName);
|
|
63
|
-
|
|
69
|
+
const response = await mediaStore.getItems(fileIds, collectionName, metadataTraceContext);
|
|
70
|
+
const itemsWithMetadataTraceContext = response.data.items.map(item => ({ ...item,
|
|
71
|
+
metadataTraceContext
|
|
72
|
+
}));
|
|
73
|
+
items.push(...itemsWithMetadataTraceContext);
|
|
64
74
|
} catch (error) {
|
|
65
75
|
fileIds.forEach(fileId => {
|
|
66
76
|
items.push({
|
|
@@ -17,7 +17,8 @@ export async function request(url, options = {}, controller) {
|
|
|
17
17
|
} = clientOptions;
|
|
18
18
|
const metadata = {
|
|
19
19
|
method,
|
|
20
|
-
endpoint
|
|
20
|
+
endpoint,
|
|
21
|
+
traceContext
|
|
21
22
|
}; // TODO BMPT-918: add client timeout feature behing a FF (using clientOptions.clientTimeout + Promise.race)
|
|
22
23
|
|
|
23
24
|
const doFetch = () => fetch(createUrl(url, {
|
package/dist/es2019/version.json
CHANGED
|
@@ -702,7 +702,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
702
702
|
case 5:
|
|
703
703
|
auth = _context11.sent;
|
|
704
704
|
extendedTraceContext = traceContext ? _objectSpread(_objectSpread({}, traceContext), {}, {
|
|
705
|
-
spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || getRandomHex(
|
|
705
|
+
spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || getRandomHex(8)
|
|
706
706
|
}) : undefined;
|
|
707
707
|
_context11.next = 9;
|
|
708
708
|
return _request("".concat(auth.baseUrl).concat(path), {
|
|
@@ -43,7 +43,8 @@ export var mapMediaFileToFileState = function mapMediaFileToFileState(mediaFile)
|
|
|
43
43
|
mediaType = _mediaFile$data.mediaType,
|
|
44
44
|
mimeType = _mediaFile$data.mimeType,
|
|
45
45
|
representations = _mediaFile$data.representations,
|
|
46
|
-
createdAt = _mediaFile$data.createdAt
|
|
46
|
+
createdAt = _mediaFile$data.createdAt,
|
|
47
|
+
metadataTraceContext = _mediaFile$data.metadataTraceContext;
|
|
47
48
|
var baseState = {
|
|
48
49
|
id: id,
|
|
49
50
|
name: name,
|
|
@@ -52,7 +53,8 @@ export var mapMediaFileToFileState = function mapMediaFileToFileState(mediaFile)
|
|
|
52
53
|
mimeType: mimeType,
|
|
53
54
|
artifacts: artifacts,
|
|
54
55
|
representations: representations,
|
|
55
|
-
createdAt: createdAt
|
|
56
|
+
createdAt: createdAt,
|
|
57
|
+
metadataTraceContext: metadataTraceContext
|
|
56
58
|
};
|
|
57
59
|
|
|
58
60
|
switch (processingStatus) {
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
-
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
-
|
|
6
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
-
|
|
8
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
3
|
import { chunkinator } from '@atlaskit/chunkinator';
|
|
10
4
|
import { from } from 'rxjs/observable/from';
|
|
@@ -13,7 +7,6 @@ import { createHasher } from '../utils/hashing/hasherCreator';
|
|
|
13
7
|
import { UploaderError } from './error';
|
|
14
8
|
import { CHUNK_SIZE, PROCESSING_BATCH_SIZE } from '../constants';
|
|
15
9
|
import { calculateChunkSize, fileSizeError } from './calculateChunkSize';
|
|
16
|
-
import { getMediaFeatureFlag } from '@atlaskit/media-common'; // TODO: Allow to pass multiple files
|
|
17
10
|
|
|
18
11
|
var hashingFunction = /*#__PURE__*/function () {
|
|
19
12
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(blob) {
|
|
@@ -53,41 +46,27 @@ var createProbingFunction = function createProbingFunction(store, deferredUpload
|
|
|
53
46
|
_context2.t0 = store;
|
|
54
47
|
_context2.t1 = hashedChunks(chunks);
|
|
55
48
|
_context2.t2 = collectionName;
|
|
56
|
-
|
|
57
|
-
if (!getMediaFeatureFlag('mediaUploadApiV2', store.featureFlags)) {
|
|
58
|
-
_context2.next = 9;
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
_context2.next = 6;
|
|
49
|
+
_context2.next = 5;
|
|
63
50
|
return deferredUploadId;
|
|
64
51
|
|
|
65
|
-
case
|
|
52
|
+
case 5:
|
|
66
53
|
_context2.t3 = _context2.sent;
|
|
67
|
-
_context2.
|
|
68
|
-
break;
|
|
69
|
-
|
|
70
|
-
case 9:
|
|
71
|
-
_context2.t3 = undefined;
|
|
72
|
-
|
|
73
|
-
case 10:
|
|
74
|
-
_context2.t4 = _context2.t3;
|
|
75
|
-
_context2.t5 = {
|
|
54
|
+
_context2.t4 = {
|
|
76
55
|
collectionName: _context2.t2,
|
|
77
|
-
uploadId: _context2.
|
|
56
|
+
uploadId: _context2.t3
|
|
78
57
|
};
|
|
79
|
-
_context2.
|
|
80
|
-
_context2.next =
|
|
81
|
-
return _context2.t0.probeChunks.call(_context2.t0, _context2.t1, _context2.
|
|
58
|
+
_context2.t5 = traceContext;
|
|
59
|
+
_context2.next = 10;
|
|
60
|
+
return _context2.t0.probeChunks.call(_context2.t0, _context2.t1, _context2.t4, _context2.t5);
|
|
82
61
|
|
|
83
|
-
case
|
|
62
|
+
case 10:
|
|
84
63
|
response = _context2.sent;
|
|
85
64
|
results = response.data.results;
|
|
86
65
|
return _context2.abrupt("return", Object.values(results).map(function (result) {
|
|
87
66
|
return result.exists;
|
|
88
67
|
}));
|
|
89
68
|
|
|
90
|
-
case
|
|
69
|
+
case 13:
|
|
91
70
|
case "end":
|
|
92
71
|
return _context2.stop();
|
|
93
72
|
}
|
|
@@ -104,38 +83,28 @@ var createProbingFunction = function createProbingFunction(store, deferredUpload
|
|
|
104
83
|
var createUploadingFunction = function createUploadingFunction(store, deferredUploadId, collectionName, traceContext) {
|
|
105
84
|
return /*#__PURE__*/function () {
|
|
106
85
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(chunk) {
|
|
107
|
-
var options;
|
|
108
86
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
109
87
|
while (1) {
|
|
110
88
|
switch (_context3.prev = _context3.next) {
|
|
111
89
|
case 0:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
_context3.
|
|
118
|
-
_context3.next = 4;
|
|
90
|
+
_context3.t0 = store;
|
|
91
|
+
_context3.t1 = chunk.hash;
|
|
92
|
+
_context3.t2 = chunk.blob;
|
|
93
|
+
_context3.t3 = collectionName;
|
|
94
|
+
_context3.t4 = chunk.partNumber;
|
|
95
|
+
_context3.next = 7;
|
|
119
96
|
return deferredUploadId;
|
|
120
97
|
|
|
121
|
-
case
|
|
122
|
-
_context3.
|
|
123
|
-
_context3.
|
|
124
|
-
|
|
125
|
-
|
|
98
|
+
case 7:
|
|
99
|
+
_context3.t5 = _context3.sent;
|
|
100
|
+
_context3.t6 = {
|
|
101
|
+
collectionName: _context3.t3,
|
|
102
|
+
partNumber: _context3.t4,
|
|
103
|
+
uploadId: _context3.t5
|
|
126
104
|
};
|
|
127
|
-
_context3.
|
|
128
|
-
break;
|
|
129
|
-
|
|
130
|
-
case 8:
|
|
131
|
-
_context3.t0 = {};
|
|
132
|
-
|
|
133
|
-
case 9:
|
|
134
|
-
options = _context3.t0;
|
|
105
|
+
_context3.t7 = traceContext;
|
|
135
106
|
_context3.next = 12;
|
|
136
|
-
return
|
|
137
|
-
collectionName: collectionName
|
|
138
|
-
}, options), traceContext);
|
|
107
|
+
return _context3.t0.uploadChunk.call(_context3.t0, _context3.t1, _context3.t2, _context3.t6, _context3.t7);
|
|
139
108
|
|
|
140
109
|
case 12:
|
|
141
110
|
return _context3.abrupt("return", _context3.sent);
|
|
@@ -235,7 +204,7 @@ export var uploadFile = function uploadFile(file, store, uploadableFileUpfrontId
|
|
|
235
204
|
var chunkSize = CHUNK_SIZE;
|
|
236
205
|
|
|
237
206
|
try {
|
|
238
|
-
if (content instanceof Blob
|
|
207
|
+
if (content instanceof Blob) {
|
|
239
208
|
chunkSize = calculateChunkSize(content.size);
|
|
240
209
|
}
|
|
241
210
|
} catch (err) {
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
+
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
|
+
|
|
4
10
|
// import setimmediate to temporary fix dataloader 2.0.0 bug
|
|
5
11
|
// @see https://github.com/graphql/dataloader/issues/249
|
|
6
12
|
import 'setimmediate';
|
|
7
13
|
import Dataloader from 'dataloader';
|
|
14
|
+
import { getRandomHex } from '@atlaskit/media-common';
|
|
8
15
|
export var MAX_BATCH_SIZE = 100;
|
|
9
16
|
|
|
10
17
|
var isBatchLoadingErrorResult = function isBatchLoadingErrorResult(result) {
|
|
@@ -20,7 +27,9 @@ export var getItemsFromKeys = function getItemsFromKeys(dataloaderKeys, fileItem
|
|
|
20
27
|
var id = fileItem.id,
|
|
21
28
|
collection = fileItem.collection;
|
|
22
29
|
var key = makeCacheKey(id, collection);
|
|
23
|
-
prev[key] = isBatchLoadingErrorResult(fileItem) ? fileItem.error : fileItem.details
|
|
30
|
+
prev[key] = isBatchLoadingErrorResult(fileItem) ? fileItem.error : _objectSpread(_objectSpread({}, fileItem.details), {}, {
|
|
31
|
+
metadataTraceContext: fileItem.metadataTraceContext
|
|
32
|
+
});
|
|
24
33
|
return prev;
|
|
25
34
|
}, {});
|
|
26
35
|
return dataloaderKeys.map(function (dataloaderKey) {
|
|
@@ -64,26 +73,35 @@ export function createBatchLoadingFunc(mediaStore) {
|
|
|
64
73
|
_context2.next = 5;
|
|
65
74
|
return Promise.all(Object.keys(fileIdsByCollection).map( /*#__PURE__*/function () {
|
|
66
75
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(collectionNameKey) {
|
|
67
|
-
var fileIds, collectionName, response;
|
|
76
|
+
var metadataTraceContext, fileIds, collectionName, response, itemsWithMetadataTraceContext;
|
|
68
77
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
69
78
|
while (1) {
|
|
70
79
|
switch (_context.prev = _context.next) {
|
|
71
80
|
case 0:
|
|
81
|
+
metadataTraceContext = {
|
|
82
|
+
traceId: getRandomHex(8),
|
|
83
|
+
spanId: getRandomHex(8)
|
|
84
|
+
};
|
|
72
85
|
fileIds = fileIdsByCollection[collectionNameKey];
|
|
73
86
|
collectionName = collectionNameKey === nonCollectionName ? undefined : collectionNameKey;
|
|
74
|
-
_context.prev =
|
|
75
|
-
_context.next =
|
|
76
|
-
return mediaStore.getItems(fileIds, collectionName);
|
|
87
|
+
_context.prev = 3;
|
|
88
|
+
_context.next = 6;
|
|
89
|
+
return mediaStore.getItems(fileIds, collectionName, metadataTraceContext);
|
|
77
90
|
|
|
78
|
-
case
|
|
91
|
+
case 6:
|
|
79
92
|
response = _context.sent;
|
|
80
|
-
|
|
81
|
-
|
|
93
|
+
itemsWithMetadataTraceContext = response.data.items.map(function (item) {
|
|
94
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
95
|
+
metadataTraceContext: metadataTraceContext
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
items.push.apply(items, _toConsumableArray(itemsWithMetadataTraceContext));
|
|
99
|
+
_context.next = 14;
|
|
82
100
|
break;
|
|
83
101
|
|
|
84
|
-
case
|
|
85
|
-
_context.prev =
|
|
86
|
-
_context.t0 = _context["catch"](
|
|
102
|
+
case 11:
|
|
103
|
+
_context.prev = 11;
|
|
104
|
+
_context.t0 = _context["catch"](3);
|
|
87
105
|
fileIds.forEach(function (fileId) {
|
|
88
106
|
items.push({
|
|
89
107
|
id: fileId,
|
|
@@ -92,12 +110,12 @@ export function createBatchLoadingFunc(mediaStore) {
|
|
|
92
110
|
});
|
|
93
111
|
});
|
|
94
112
|
|
|
95
|
-
case
|
|
113
|
+
case 14:
|
|
96
114
|
case "end":
|
|
97
115
|
return _context.stop();
|
|
98
116
|
}
|
|
99
117
|
}
|
|
100
|
-
}, _callee, null, [[
|
|
118
|
+
}, _callee, null, [[3, 11]]);
|
|
101
119
|
}));
|
|
102
120
|
|
|
103
121
|
return function (_x2) {
|
|
@@ -36,7 +36,8 @@ function _request() {
|
|
|
36
36
|
retryOptions = clientOptions.retryOptions;
|
|
37
37
|
metadata = {
|
|
38
38
|
method: method,
|
|
39
|
-
endpoint: endpoint
|
|
39
|
+
endpoint: endpoint,
|
|
40
|
+
traceContext: traceContext
|
|
40
41
|
}; // TODO BMPT-918: add client timeout feature behing a FF (using clientOptions.clientTimeout + Promise.race)
|
|
41
42
|
|
|
42
43
|
doFetch = function doFetch() {
|
package/dist/esm/version.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { FileStatus as CommonFileStatus } from '@atlaskit/media-common';
|
|
1
|
+
import { FileStatus as CommonFileStatus, MediaTraceContext } from '@atlaskit/media-common';
|
|
2
2
|
import { MediaStoreResponse } from '../client/media-store';
|
|
3
3
|
import { MediaFileArtifacts } from './artifacts';
|
|
4
4
|
import { MediaCollectionItemFullDetails, MediaFile, MediaRepresentations, MediaType } from './media';
|
|
5
|
+
export declare type BaseFileState = {
|
|
6
|
+
metadataTraceContext?: MediaTraceContext;
|
|
7
|
+
};
|
|
5
8
|
export declare type FileStatus = CommonFileStatus;
|
|
6
9
|
export interface FilePreview {
|
|
7
10
|
value: Blob | string;
|
|
@@ -18,7 +21,7 @@ export interface GetFileOptions {
|
|
|
18
21
|
collectionName?: string;
|
|
19
22
|
occurrenceKey?: string;
|
|
20
23
|
}
|
|
21
|
-
export interface UploadingFileState {
|
|
24
|
+
export interface UploadingFileState extends BaseFileState {
|
|
22
25
|
status: 'uploading';
|
|
23
26
|
id: string;
|
|
24
27
|
occurrenceKey?: string;
|
|
@@ -33,7 +36,7 @@ export interface UploadingFileState {
|
|
|
33
36
|
export interface PreviewableFileState {
|
|
34
37
|
preview: FilePreview | Promise<FilePreview>;
|
|
35
38
|
}
|
|
36
|
-
export interface ProcessingFileState {
|
|
39
|
+
export interface ProcessingFileState extends BaseFileState {
|
|
37
40
|
status: 'processing';
|
|
38
41
|
id: string;
|
|
39
42
|
occurrenceKey?: string;
|
|
@@ -46,7 +49,7 @@ export interface ProcessingFileState {
|
|
|
46
49
|
representations?: MediaRepresentations;
|
|
47
50
|
createdAt?: number;
|
|
48
51
|
}
|
|
49
|
-
export interface ProcessedFileState {
|
|
52
|
+
export interface ProcessedFileState extends BaseFileState {
|
|
50
53
|
status: 'processed';
|
|
51
54
|
id: string;
|
|
52
55
|
occurrenceKey?: string;
|
|
@@ -59,7 +62,7 @@ export interface ProcessedFileState {
|
|
|
59
62
|
representations?: MediaRepresentations;
|
|
60
63
|
createdAt?: number;
|
|
61
64
|
}
|
|
62
|
-
export interface ProcessingFailedState {
|
|
65
|
+
export interface ProcessingFailedState extends BaseFileState {
|
|
63
66
|
status: 'failed-processing';
|
|
64
67
|
id: string;
|
|
65
68
|
occurrenceKey?: string;
|
|
@@ -72,7 +75,7 @@ export interface ProcessingFailedState {
|
|
|
72
75
|
representations?: MediaRepresentations;
|
|
73
76
|
createdAt?: number;
|
|
74
77
|
}
|
|
75
|
-
export interface ErrorFileState {
|
|
78
|
+
export interface ErrorFileState extends BaseFileState {
|
|
76
79
|
status: 'error';
|
|
77
80
|
id: string;
|
|
78
81
|
occurrenceKey?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MediaFeatureFlags, MediaType } from '@atlaskit/media-common';
|
|
1
|
+
import { MediaFeatureFlags, MediaTraceContext, MediaType } from '@atlaskit/media-common';
|
|
2
2
|
import type { MediaFileArtifacts } from './artifacts';
|
|
3
3
|
export declare type MediaFileProcessingStatus = 'pending' | 'succeeded' | 'failed';
|
|
4
4
|
export type { MediaType } from '@atlaskit/media-common';
|
|
@@ -13,6 +13,7 @@ export declare type MediaFile = {
|
|
|
13
13
|
readonly artifacts: MediaFileArtifacts;
|
|
14
14
|
readonly representations: MediaRepresentations;
|
|
15
15
|
readonly createdAt?: number;
|
|
16
|
+
readonly metadataTraceContext?: MediaTraceContext;
|
|
16
17
|
};
|
|
17
18
|
export declare type MediaCollection = {
|
|
18
19
|
readonly name: string;
|
|
@@ -41,6 +42,7 @@ export declare type MediaCollectionItemFullDetails = {
|
|
|
41
42
|
readonly artifacts: MediaFileArtifacts;
|
|
42
43
|
readonly representations: MediaRepresentations;
|
|
43
44
|
readonly createdAt?: number;
|
|
45
|
+
readonly metadataTraceContext?: MediaTraceContext;
|
|
44
46
|
};
|
|
45
47
|
export declare type MediaRepresentations = {
|
|
46
48
|
image?: Object;
|
|
@@ -21,6 +21,7 @@ export declare type RequestMetadata = {
|
|
|
21
21
|
readonly endpoint?: string;
|
|
22
22
|
readonly mediaRegion?: string;
|
|
23
23
|
readonly mediaEnv?: string;
|
|
24
|
+
readonly traceContext?: MediaTraceContext;
|
|
24
25
|
};
|
|
25
26
|
export declare type RequestOptions = RequestMetadata & {
|
|
26
27
|
readonly auth?: Auth;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-client",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.1.1",
|
|
4
4
|
"description": "Media API Web Client Library",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/chunkinator": "^4.1.0",
|
|
31
|
-
"@atlaskit/media-common": "^2.
|
|
31
|
+
"@atlaskit/media-common": "^2.18.0",
|
|
32
32
|
"@babel/runtime": "^7.0.0",
|
|
33
33
|
"dataloader": "^2.0.0",
|
|
34
34
|
"deep-equal": "^1.0.1",
|
|
@@ -42,18 +42,18 @@
|
|
|
42
42
|
"xstate": "^4.20.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@atlaskit/media-core": "^34.0.
|
|
45
|
+
"@atlaskit/media-core": "^34.0.1",
|
|
46
46
|
"@emotion/react": "^11.7.1",
|
|
47
47
|
"react": "^16.8.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@atlaskit/button": "^16.5.0",
|
|
51
51
|
"@atlaskit/docs": "*",
|
|
52
|
-
"@atlaskit/media-card": "^74.
|
|
52
|
+
"@atlaskit/media-card": "^74.4.0",
|
|
53
53
|
"@atlaskit/media-core": "^34.0.0",
|
|
54
|
-
"@atlaskit/media-test-helpers": "^30.
|
|
54
|
+
"@atlaskit/media-test-helpers": "^30.1.0",
|
|
55
55
|
"@atlaskit/ssr": "*",
|
|
56
|
-
"@atlaskit/tokens": "^0.
|
|
56
|
+
"@atlaskit/tokens": "^0.13.0",
|
|
57
57
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
58
58
|
"@emotion/react": "^11.7.1",
|
|
59
59
|
"@types/deep-equal": "^1.0.1",
|
package/report.api.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- API Report Version: 2.
|
|
1
|
+
<!-- API Report Version: 2.3 -->
|
|
2
2
|
|
|
3
3
|
## API Report File for "@atlaskit/media-client"
|
|
4
4
|
|
|
@@ -50,6 +50,11 @@ export type Artifacts = {
|
|
|
50
50
|
[name: string]: MediaArtifact;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
// @public (undocumented)
|
|
54
|
+
type BaseFileState = {
|
|
55
|
+
metadataTraceContext?: MediaTraceContext;
|
|
56
|
+
};
|
|
57
|
+
|
|
53
58
|
// @public
|
|
54
59
|
abstract class BaseMediaClientError<
|
|
55
60
|
Attributes extends MediaClientErrorAttributes,
|
|
@@ -186,7 +191,7 @@ export interface EmptyFile {
|
|
|
186
191
|
}
|
|
187
192
|
|
|
188
193
|
// @public (undocumented)
|
|
189
|
-
export interface ErrorFileState {
|
|
194
|
+
export interface ErrorFileState extends BaseFileState {
|
|
190
195
|
// (undocumented)
|
|
191
196
|
id: string;
|
|
192
197
|
// (undocumented)
|
|
@@ -866,6 +871,7 @@ export type MediaCollectionItemFullDetails = {
|
|
|
866
871
|
readonly artifacts: MediaFileArtifacts;
|
|
867
872
|
readonly representations: MediaRepresentations;
|
|
868
873
|
readonly createdAt?: number;
|
|
874
|
+
readonly metadataTraceContext?: MediaTraceContext;
|
|
869
875
|
};
|
|
870
876
|
|
|
871
877
|
// @public (undocumented)
|
|
@@ -891,6 +897,7 @@ export type MediaFile = {
|
|
|
891
897
|
readonly artifacts: MediaFileArtifacts;
|
|
892
898
|
readonly representations: MediaRepresentations;
|
|
893
899
|
readonly createdAt?: number;
|
|
900
|
+
readonly metadataTraceContext?: MediaTraceContext;
|
|
894
901
|
};
|
|
895
902
|
|
|
896
903
|
// @public (undocumented)
|
|
@@ -1363,7 +1370,7 @@ export interface PreviewableFileState {
|
|
|
1363
1370
|
export interface PreviewOptions {}
|
|
1364
1371
|
|
|
1365
1372
|
// @public (undocumented)
|
|
1366
|
-
export interface ProcessedFileState {
|
|
1373
|
+
export interface ProcessedFileState extends BaseFileState {
|
|
1367
1374
|
// (undocumented)
|
|
1368
1375
|
artifacts: MediaFileArtifacts;
|
|
1369
1376
|
// (undocumented)
|
|
@@ -1389,7 +1396,7 @@ export interface ProcessedFileState {
|
|
|
1389
1396
|
}
|
|
1390
1397
|
|
|
1391
1398
|
// @public (undocumented)
|
|
1392
|
-
export interface ProcessingFailedState {
|
|
1399
|
+
export interface ProcessingFailedState extends BaseFileState {
|
|
1393
1400
|
// (undocumented)
|
|
1394
1401
|
artifacts: Object;
|
|
1395
1402
|
// (undocumented)
|
|
@@ -1415,7 +1422,7 @@ export interface ProcessingFailedState {
|
|
|
1415
1422
|
}
|
|
1416
1423
|
|
|
1417
1424
|
// @public (undocumented)
|
|
1418
|
-
export interface ProcessingFileState {
|
|
1425
|
+
export interface ProcessingFileState extends BaseFileState {
|
|
1419
1426
|
// (undocumented)
|
|
1420
1427
|
artifacts?: MediaFileArtifacts;
|
|
1421
1428
|
// (undocumented)
|
|
@@ -1515,6 +1522,7 @@ export type RequestMetadata = {
|
|
|
1515
1522
|
readonly endpoint?: string;
|
|
1516
1523
|
readonly mediaRegion?: string;
|
|
1517
1524
|
readonly mediaEnv?: string;
|
|
1525
|
+
readonly traceContext?: MediaTraceContext;
|
|
1518
1526
|
};
|
|
1519
1527
|
|
|
1520
1528
|
// @public (undocumented)
|
|
@@ -1544,6 +1552,8 @@ export interface ResponseFileItem {
|
|
|
1544
1552
|
// (undocumented)
|
|
1545
1553
|
id: string;
|
|
1546
1554
|
// (undocumented)
|
|
1555
|
+
metadataTraceContext?: MediaTraceContext;
|
|
1556
|
+
// (undocumented)
|
|
1547
1557
|
type: 'file';
|
|
1548
1558
|
}
|
|
1549
1559
|
|
|
@@ -1651,7 +1661,7 @@ export interface UploadFileResult {
|
|
|
1651
1661
|
}
|
|
1652
1662
|
|
|
1653
1663
|
// @public (undocumented)
|
|
1654
|
-
export interface UploadingFileState {
|
|
1664
|
+
export interface UploadingFileState extends BaseFileState {
|
|
1655
1665
|
// (undocumented)
|
|
1656
1666
|
createdAt?: number;
|
|
1657
1667
|
// (undocumented)
|