@atlaskit/media-client 25.1.0 → 26.0.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 +12 -0
- package/dist/cjs/client/media-store/MediaStore.js +0 -22
- package/dist/cjs/test-helpers/MockedMediaApi/MockedMediaApi.js +88 -105
- package/dist/cjs/uploader/index.js +36 -72
- package/dist/es2019/client/media-store/MediaStore.js +0 -21
- package/dist/es2019/test-helpers/MockedMediaApi/MockedMediaApi.js +0 -3
- package/dist/es2019/uploader/index.js +0 -7
- package/dist/esm/client/media-store/MediaStore.js +0 -22
- package/dist/esm/test-helpers/MockedMediaApi/MockedMediaApi.js +88 -105
- package/dist/esm/uploader/index.js +36 -72
- package/dist/types/client/media-store/MediaStore.d.ts +1 -2
- package/dist/types/client/media-store/types.d.ts +1 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/models/media.d.ts +0 -7
- package/dist/types-ts4.5/client/media-store/MediaStore.d.ts +1 -2
- package/dist/types-ts4.5/client/media-store/types.d.ts +1 -2
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/models/media.d.ts +0 -7
- package/package.json +2 -2
- package/tmp/api-report-tmp.d.ts +0 -1199
|
@@ -100,27 +100,6 @@ export class MediaStore {
|
|
|
100
100
|
};
|
|
101
101
|
await this.request(`/chunk/${etag}`, options);
|
|
102
102
|
}
|
|
103
|
-
probeChunks(chunks, uploadId, collectionName, traceContext) {
|
|
104
|
-
const metadata = {
|
|
105
|
-
method: 'POST',
|
|
106
|
-
endpoint: '/chunk/probe'
|
|
107
|
-
};
|
|
108
|
-
const options = {
|
|
109
|
-
...metadata,
|
|
110
|
-
params: {
|
|
111
|
-
uploadId
|
|
112
|
-
},
|
|
113
|
-
authContext: {
|
|
114
|
-
collectionName
|
|
115
|
-
},
|
|
116
|
-
headers: jsonHeaders,
|
|
117
|
-
body: JSON.stringify({
|
|
118
|
-
chunks
|
|
119
|
-
}),
|
|
120
|
-
traceContext
|
|
121
|
-
};
|
|
122
|
-
return this.request(`/chunk/probe`, options).then(createMapResponseToJson(metadata));
|
|
123
|
-
}
|
|
124
103
|
createFileFromUpload(body, params = {}, traceContext) {
|
|
125
104
|
const metadata = {
|
|
126
105
|
method: 'POST',
|
|
@@ -11,9 +11,6 @@ const getMediaApi = ({
|
|
|
11
11
|
}) => {
|
|
12
12
|
throw new Error('500 - MockedMediaApi.touchFiles: method not implemented');
|
|
13
13
|
},
|
|
14
|
-
probeChunks: async (...args) => {
|
|
15
|
-
throw new Error('500 - MockedMediaApi.probeChunks: method not implemented');
|
|
16
|
-
},
|
|
17
14
|
uploadChunk: async (_etag, _blob, uploadId) => {
|
|
18
15
|
throw new Error('500 - MockedMediaApi.uploadChunk: method not implemented');
|
|
19
16
|
},
|
|
@@ -12,11 +12,6 @@ const hashingFunction = async blob => {
|
|
|
12
12
|
const hasher = await createHasher();
|
|
13
13
|
return hasher.hash(blob);
|
|
14
14
|
};
|
|
15
|
-
const createProbingFunction = (store, deferredUploadId, collectionName, traceContext) => async chunks => {
|
|
16
|
-
const response = await store.probeChunks(hashedChunks(chunks), await deferredUploadId, collectionName, traceContext);
|
|
17
|
-
const results = response.data.results;
|
|
18
|
-
return Object.values(results).map(result => result.exists);
|
|
19
|
-
};
|
|
20
15
|
const createUploadingFunction = (store, deferredUploadId, collectionName, traceContext) => async chunk => {
|
|
21
16
|
return await store.uploadChunk(chunk.hash, chunk.blob, await deferredUploadId, chunk.partNumber, collectionName, traceContext);
|
|
22
17
|
};
|
|
@@ -89,11 +84,9 @@ export const uploadFile = (file, store, uploadableFileUpfrontIds, callbacks, tra
|
|
|
89
84
|
const chunkinatorObservable = chunkinator(content, {
|
|
90
85
|
hashingFunction,
|
|
91
86
|
hashingConcurrency: 5,
|
|
92
|
-
probingBatchSize: 100,
|
|
93
87
|
chunkSize,
|
|
94
88
|
uploadingConcurrency: 3,
|
|
95
89
|
uploadingFunction: createUploadingFunction(store, deferredUploadId, collection, traceContext),
|
|
96
|
-
probingFunction: createProbingFunction(store, deferredUploadId, collection, traceContext),
|
|
97
90
|
processingBatchSize: PROCESSING_BATCH_SIZE,
|
|
98
91
|
processingFunction: createProcessingFunction(store, deferredUploadId, collection, traceContext)
|
|
99
92
|
}, {
|
|
@@ -147,28 +147,6 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
147
147
|
}
|
|
148
148
|
return uploadChunk;
|
|
149
149
|
}()
|
|
150
|
-
}, {
|
|
151
|
-
key: "probeChunks",
|
|
152
|
-
value: function probeChunks(chunks, uploadId, collectionName, traceContext) {
|
|
153
|
-
var metadata = {
|
|
154
|
-
method: 'POST',
|
|
155
|
-
endpoint: '/chunk/probe'
|
|
156
|
-
};
|
|
157
|
-
var options = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
158
|
-
params: {
|
|
159
|
-
uploadId: uploadId
|
|
160
|
-
},
|
|
161
|
-
authContext: {
|
|
162
|
-
collectionName: collectionName
|
|
163
|
-
},
|
|
164
|
-
headers: jsonHeaders,
|
|
165
|
-
body: JSON.stringify({
|
|
166
|
-
chunks: chunks
|
|
167
|
-
}),
|
|
168
|
-
traceContext: traceContext
|
|
169
|
-
});
|
|
170
|
-
return this.request("/chunk/probe", options).then(createMapResponseToJson(metadata));
|
|
171
|
-
}
|
|
172
150
|
}, {
|
|
173
151
|
key: "createFileFromUpload",
|
|
174
152
|
value: function createFileFromUpload(body) {
|
|
@@ -27,51 +27,34 @@ var getMediaApi = function getMediaApi(_ref) {
|
|
|
27
27
|
}
|
|
28
28
|
return touchFiles;
|
|
29
29
|
}(),
|
|
30
|
-
|
|
31
|
-
var
|
|
30
|
+
uploadChunk: function () {
|
|
31
|
+
var _uploadChunk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_etag, _blob, uploadId) {
|
|
32
32
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
33
33
|
while (1) switch (_context2.prev = _context2.next) {
|
|
34
34
|
case 0:
|
|
35
|
-
throw new Error('500 - MockedMediaApi.
|
|
35
|
+
throw new Error('500 - MockedMediaApi.uploadChunk: method not implemented');
|
|
36
36
|
case 1:
|
|
37
37
|
case "end":
|
|
38
38
|
return _context2.stop();
|
|
39
39
|
}
|
|
40
40
|
}, _callee2);
|
|
41
41
|
}));
|
|
42
|
-
function probeChunks() {
|
|
43
|
-
return _probeChunks.apply(this, arguments);
|
|
44
|
-
}
|
|
45
|
-
return probeChunks;
|
|
46
|
-
}(),
|
|
47
|
-
uploadChunk: function () {
|
|
48
|
-
var _uploadChunk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_etag, _blob, uploadId) {
|
|
49
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
50
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
51
|
-
case 0:
|
|
52
|
-
throw new Error('500 - MockedMediaApi.uploadChunk: method not implemented');
|
|
53
|
-
case 1:
|
|
54
|
-
case "end":
|
|
55
|
-
return _context3.stop();
|
|
56
|
-
}
|
|
57
|
-
}, _callee3);
|
|
58
|
-
}));
|
|
59
42
|
function uploadChunk(_x2, _x3, _x4) {
|
|
60
43
|
return _uploadChunk.apply(this, arguments);
|
|
61
44
|
}
|
|
62
45
|
return uploadChunk;
|
|
63
46
|
}(),
|
|
64
47
|
appendChunksToUpload: function () {
|
|
65
|
-
var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
66
|
-
return _regeneratorRuntime.wrap(function
|
|
67
|
-
while (1) switch (
|
|
48
|
+
var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
49
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
50
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
68
51
|
case 0:
|
|
69
52
|
throw new Error('500 - MockedMediaApi.appendChunksToUpload: method not implemented');
|
|
70
53
|
case 1:
|
|
71
54
|
case "end":
|
|
72
|
-
return
|
|
55
|
+
return _context3.stop();
|
|
73
56
|
}
|
|
74
|
-
},
|
|
57
|
+
}, _callee3);
|
|
75
58
|
}));
|
|
76
59
|
function appendChunksToUpload() {
|
|
77
60
|
return _appendChunksToUpload.apply(this, arguments);
|
|
@@ -79,19 +62,19 @@ var getMediaApi = function getMediaApi(_ref) {
|
|
|
79
62
|
return appendChunksToUpload;
|
|
80
63
|
}(),
|
|
81
64
|
createFileFromUpload: function () {
|
|
82
|
-
var _createFileFromUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
65
|
+
var _createFileFromUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref3, _ref4) {
|
|
83
66
|
var uploadId, collection;
|
|
84
|
-
return _regeneratorRuntime.wrap(function
|
|
85
|
-
while (1) switch (
|
|
67
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
68
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
86
69
|
case 0:
|
|
87
70
|
uploadId = _ref3.uploadId;
|
|
88
71
|
collection = _ref4.collection;
|
|
89
72
|
throw new Error('500 - MockedMediaApi.createFileFromUpload: method not implemented');
|
|
90
73
|
case 3:
|
|
91
74
|
case "end":
|
|
92
|
-
return
|
|
75
|
+
return _context4.stop();
|
|
93
76
|
}
|
|
94
|
-
},
|
|
77
|
+
}, _callee4);
|
|
95
78
|
}));
|
|
96
79
|
function createFileFromUpload(_x5, _x6) {
|
|
97
80
|
return _createFileFromUpload.apply(this, arguments);
|
|
@@ -100,16 +83,16 @@ var getMediaApi = function getMediaApi(_ref) {
|
|
|
100
83
|
}(),
|
|
101
84
|
// Used by Media Picker as a fallback for conflicted file Ids
|
|
102
85
|
createUpload: function () {
|
|
103
|
-
var _createUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
104
|
-
return _regeneratorRuntime.wrap(function
|
|
105
|
-
while (1) switch (
|
|
86
|
+
var _createUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
87
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
88
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
106
89
|
case 0:
|
|
107
90
|
throw new Error('500 - MockedMediaApi.createUpload: method not implemented');
|
|
108
91
|
case 1:
|
|
109
92
|
case "end":
|
|
110
|
-
return
|
|
93
|
+
return _context5.stop();
|
|
111
94
|
}
|
|
112
|
-
},
|
|
95
|
+
}, _callee5);
|
|
113
96
|
}));
|
|
114
97
|
function createUpload() {
|
|
115
98
|
return _createUpload.apply(this, arguments);
|
|
@@ -125,26 +108,26 @@ var getMediaApi = function getMediaApi(_ref) {
|
|
|
125
108
|
// --------------------------------------------------------
|
|
126
109
|
|
|
127
110
|
getFile: function () {
|
|
128
|
-
var _getFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
111
|
+
var _getFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(fileId) {
|
|
129
112
|
var fileItem;
|
|
130
|
-
return _regeneratorRuntime.wrap(function
|
|
131
|
-
while (1) switch (
|
|
113
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
114
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
132
115
|
case 0:
|
|
133
116
|
fileItem = getFileItem(fileId);
|
|
134
117
|
if (fileItem) {
|
|
135
|
-
|
|
118
|
+
_context6.next = 3;
|
|
136
119
|
break;
|
|
137
120
|
}
|
|
138
121
|
throw new Error('404 - MockedMediaApi.getFile: file not found');
|
|
139
122
|
case 3:
|
|
140
|
-
return
|
|
123
|
+
return _context6.abrupt("return", {
|
|
141
124
|
data: getMediaFile(fileItem)
|
|
142
125
|
});
|
|
143
126
|
case 4:
|
|
144
127
|
case "end":
|
|
145
|
-
return
|
|
128
|
+
return _context6.stop();
|
|
146
129
|
}
|
|
147
|
-
},
|
|
130
|
+
}, _callee6);
|
|
148
131
|
}));
|
|
149
132
|
function getFile(_x7) {
|
|
150
133
|
return _getFile.apply(this, arguments);
|
|
@@ -152,26 +135,26 @@ var getMediaApi = function getMediaApi(_ref) {
|
|
|
152
135
|
return getFile;
|
|
153
136
|
}(),
|
|
154
137
|
getItems: function () {
|
|
155
|
-
var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
138
|
+
var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(ids) {
|
|
156
139
|
var items;
|
|
157
|
-
return _regeneratorRuntime.wrap(function
|
|
158
|
-
while (1) switch (
|
|
140
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
141
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
159
142
|
case 0:
|
|
160
143
|
items = ids.map(function (id) {
|
|
161
144
|
return getFileItem(id);
|
|
162
145
|
}).filter(function (fileState) {
|
|
163
146
|
return !!fileState;
|
|
164
147
|
});
|
|
165
|
-
return
|
|
148
|
+
return _context7.abrupt("return", {
|
|
166
149
|
data: {
|
|
167
150
|
items: items
|
|
168
151
|
}
|
|
169
152
|
});
|
|
170
153
|
case 2:
|
|
171
154
|
case "end":
|
|
172
|
-
return
|
|
155
|
+
return _context7.stop();
|
|
173
156
|
}
|
|
174
|
-
},
|
|
157
|
+
}, _callee7);
|
|
175
158
|
}));
|
|
176
159
|
function getItems(_x8) {
|
|
177
160
|
return _getItems.apply(this, arguments);
|
|
@@ -180,16 +163,16 @@ var getMediaApi = function getMediaApi(_ref) {
|
|
|
180
163
|
}(),
|
|
181
164
|
// TODO
|
|
182
165
|
getImageMetadata: function () {
|
|
183
|
-
var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
184
|
-
return _regeneratorRuntime.wrap(function
|
|
185
|
-
while (1) switch (
|
|
166
|
+
var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
167
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
168
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
186
169
|
case 0:
|
|
187
170
|
throw new Error('500 - MockedMediaApi.getImageMetadata: method not implemented');
|
|
188
171
|
case 1:
|
|
189
172
|
case "end":
|
|
190
|
-
return
|
|
173
|
+
return _context8.stop();
|
|
191
174
|
}
|
|
192
|
-
},
|
|
175
|
+
}, _callee8);
|
|
193
176
|
}));
|
|
194
177
|
function getImageMetadata() {
|
|
195
178
|
return _getImageMetadata.apply(this, arguments);
|
|
@@ -202,16 +185,16 @@ var getMediaApi = function getMediaApi(_ref) {
|
|
|
202
185
|
|
|
203
186
|
// TODO
|
|
204
187
|
getFileImageURL: function () {
|
|
205
|
-
var _getFileImageURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
206
|
-
return _regeneratorRuntime.wrap(function
|
|
207
|
-
while (1) switch (
|
|
188
|
+
var _getFileImageURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
189
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
190
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
208
191
|
case 0:
|
|
209
192
|
throw new Error('500 - MockedMediaApi.getFileImageURL: method not implemented');
|
|
210
193
|
case 1:
|
|
211
194
|
case "end":
|
|
212
|
-
return
|
|
195
|
+
return _context9.stop();
|
|
213
196
|
}
|
|
214
|
-
},
|
|
197
|
+
}, _callee9);
|
|
215
198
|
}));
|
|
216
199
|
function getFileImageURL() {
|
|
217
200
|
return _getFileImageURL.apply(this, arguments);
|
|
@@ -223,30 +206,30 @@ var getMediaApi = function getMediaApi(_ref) {
|
|
|
223
206
|
throw new Error('500 - MockedMediaApi.getFileImageURLSync: method not implemented');
|
|
224
207
|
},
|
|
225
208
|
getFileBinaryURL: function () {
|
|
226
|
-
var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
209
|
+
var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(id) {
|
|
227
210
|
var fileItem;
|
|
228
|
-
return _regeneratorRuntime.wrap(function
|
|
229
|
-
while (1) switch (
|
|
211
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
212
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
230
213
|
case 0:
|
|
231
214
|
fileItem = getFileItem(id);
|
|
232
215
|
if (fileItem) {
|
|
233
|
-
|
|
216
|
+
_context10.next = 3;
|
|
234
217
|
break;
|
|
235
218
|
}
|
|
236
219
|
throw new Error('404 - MockedMediaApi.getFileBinaryURL: file not found');
|
|
237
220
|
case 3:
|
|
238
221
|
if (!(fileItem.details.size === 0)) {
|
|
239
|
-
|
|
222
|
+
_context10.next = 5;
|
|
240
223
|
break;
|
|
241
224
|
}
|
|
242
225
|
throw new Error('404 - MockedMediaApi.getFileBinaryURL: file is empty');
|
|
243
226
|
case 5:
|
|
244
|
-
return
|
|
227
|
+
return _context10.abrupt("return", "/file/".concat(id, "/binary"));
|
|
245
228
|
case 6:
|
|
246
229
|
case "end":
|
|
247
|
-
return
|
|
230
|
+
return _context10.stop();
|
|
248
231
|
}
|
|
249
|
-
},
|
|
232
|
+
}, _callee10);
|
|
250
233
|
}));
|
|
251
234
|
function getFileBinaryURL(_x9) {
|
|
252
235
|
return _getFileBinaryURL.apply(this, arguments);
|
|
@@ -254,25 +237,25 @@ var getMediaApi = function getMediaApi(_ref) {
|
|
|
254
237
|
return getFileBinaryURL;
|
|
255
238
|
}(),
|
|
256
239
|
getArtifactURL: function () {
|
|
257
|
-
var _getArtifactURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
240
|
+
var _getArtifactURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(artifacts, artifactName) {
|
|
258
241
|
var _artifacts$artifactNa;
|
|
259
242
|
var artifactUrl;
|
|
260
|
-
return _regeneratorRuntime.wrap(function
|
|
261
|
-
while (1) switch (
|
|
243
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
244
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
262
245
|
case 0:
|
|
263
246
|
artifactUrl = (_artifacts$artifactNa = artifacts[artifactName]) === null || _artifacts$artifactNa === void 0 ? void 0 : _artifacts$artifactNa.url;
|
|
264
247
|
if (artifactUrl) {
|
|
265
|
-
|
|
248
|
+
_context11.next = 3;
|
|
266
249
|
break;
|
|
267
250
|
}
|
|
268
251
|
throw new Error("404 - MockedMediaApi.getArtifactURL: artifact ".concat(artifactName, " not found"));
|
|
269
252
|
case 3:
|
|
270
|
-
return
|
|
253
|
+
return _context11.abrupt("return", artifactUrl);
|
|
271
254
|
case 4:
|
|
272
255
|
case "end":
|
|
273
|
-
return
|
|
256
|
+
return _context11.stop();
|
|
274
257
|
}
|
|
275
|
-
},
|
|
258
|
+
}, _callee11);
|
|
276
259
|
}));
|
|
277
260
|
function getArtifactURL(_x10, _x11) {
|
|
278
261
|
return _getArtifactURL.apply(this, arguments);
|
|
@@ -283,30 +266,30 @@ var getMediaApi = function getMediaApi(_ref) {
|
|
|
283
266
|
// BINARY ENDPOINTS
|
|
284
267
|
// --------------------------------------------------------
|
|
285
268
|
getImage: function () {
|
|
286
|
-
var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
269
|
+
var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(fileId) {
|
|
287
270
|
var fileItem;
|
|
288
|
-
return _regeneratorRuntime.wrap(function
|
|
289
|
-
while (1) switch (
|
|
271
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
272
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
290
273
|
case 0:
|
|
291
274
|
fileItem = getFileItem(fileId);
|
|
292
275
|
if (fileItem) {
|
|
293
|
-
|
|
276
|
+
_context12.next = 3;
|
|
294
277
|
break;
|
|
295
278
|
}
|
|
296
279
|
throw new Error('404 - MockedMediaApi.getImage: file not found');
|
|
297
280
|
case 3:
|
|
298
281
|
if (fileItem.details.representations.image) {
|
|
299
|
-
|
|
282
|
+
_context12.next = 5;
|
|
300
283
|
break;
|
|
301
284
|
}
|
|
302
285
|
throw new Error('404 - MockedMediaApi.getImage: image not found');
|
|
303
286
|
case 5:
|
|
304
|
-
return
|
|
287
|
+
return _context12.abrupt("return", new Blob());
|
|
305
288
|
case 6:
|
|
306
289
|
case "end":
|
|
307
|
-
return
|
|
290
|
+
return _context12.stop();
|
|
308
291
|
}
|
|
309
|
-
},
|
|
292
|
+
}, _callee12);
|
|
310
293
|
}));
|
|
311
294
|
function getImage(_x12) {
|
|
312
295
|
return _getImage.apply(this, arguments);
|
|
@@ -319,27 +302,27 @@ var getMediaApi = function getMediaApi(_ref) {
|
|
|
319
302
|
|
|
320
303
|
// TODO
|
|
321
304
|
copyFileWithToken: function () {
|
|
322
|
-
var _copyFileWithToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
305
|
+
var _copyFileWithToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(body) {
|
|
323
306
|
var fileId, fileItem;
|
|
324
|
-
return _regeneratorRuntime.wrap(function
|
|
325
|
-
while (1) switch (
|
|
307
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
308
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
326
309
|
case 0:
|
|
327
310
|
fileId = body.sourceFile.id;
|
|
328
311
|
fileItem = getFileItem(fileId);
|
|
329
312
|
if (fileItem) {
|
|
330
|
-
|
|
313
|
+
_context13.next = 4;
|
|
331
314
|
break;
|
|
332
315
|
}
|
|
333
316
|
throw new Error('404 - MockedMediaApi.copyFileWithToken: file not found');
|
|
334
317
|
case 4:
|
|
335
|
-
return
|
|
318
|
+
return _context13.abrupt("return", {
|
|
336
319
|
data: getMediaFile(fileItem)
|
|
337
320
|
});
|
|
338
321
|
case 5:
|
|
339
322
|
case "end":
|
|
340
|
-
return
|
|
323
|
+
return _context13.stop();
|
|
341
324
|
}
|
|
342
|
-
},
|
|
325
|
+
}, _callee13);
|
|
343
326
|
}));
|
|
344
327
|
function copyFileWithToken(_x13) {
|
|
345
328
|
return _copyFileWithToken.apply(this, arguments);
|
|
@@ -348,14 +331,14 @@ var getMediaApi = function getMediaApi(_ref) {
|
|
|
348
331
|
}(),
|
|
349
332
|
// TODO
|
|
350
333
|
removeCollectionFile: function () {
|
|
351
|
-
var _removeCollectionFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
352
|
-
return _regeneratorRuntime.wrap(function
|
|
353
|
-
while (1) switch (
|
|
334
|
+
var _removeCollectionFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
335
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
336
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
354
337
|
case 0:
|
|
355
338
|
case "end":
|
|
356
|
-
return
|
|
339
|
+
return _context14.stop();
|
|
357
340
|
}
|
|
358
|
-
},
|
|
341
|
+
}, _callee14);
|
|
359
342
|
}));
|
|
360
343
|
function removeCollectionFile() {
|
|
361
344
|
return _removeCollectionFile.apply(this, arguments);
|
|
@@ -366,16 +349,16 @@ var getMediaApi = function getMediaApi(_ref) {
|
|
|
366
349
|
// OTHER ENDPOINTS
|
|
367
350
|
// --------------------------------------------------------
|
|
368
351
|
request: function () {
|
|
369
|
-
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
370
|
-
return _regeneratorRuntime.wrap(function
|
|
371
|
-
while (1) switch (
|
|
352
|
+
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
|
|
353
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
354
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
372
355
|
case 0:
|
|
373
|
-
return
|
|
356
|
+
return _context15.abrupt("return", new Response());
|
|
374
357
|
case 1:
|
|
375
358
|
case "end":
|
|
376
|
-
return
|
|
359
|
+
return _context15.stop();
|
|
377
360
|
}
|
|
378
|
-
},
|
|
361
|
+
}, _callee15);
|
|
379
362
|
}));
|
|
380
363
|
function request() {
|
|
381
364
|
return _request.apply(this, arguments);
|
|
@@ -383,20 +366,20 @@ var getMediaApi = function getMediaApi(_ref) {
|
|
|
383
366
|
return request;
|
|
384
367
|
}(),
|
|
385
368
|
resolveAuth: function () {
|
|
386
|
-
var _resolveAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
387
|
-
return _regeneratorRuntime.wrap(function
|
|
388
|
-
while (1) switch (
|
|
369
|
+
var _resolveAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() {
|
|
370
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
371
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
389
372
|
case 0:
|
|
390
|
-
return
|
|
373
|
+
return _context16.abrupt("return", {
|
|
391
374
|
asapIssuer: '',
|
|
392
375
|
token: '',
|
|
393
376
|
baseUrl: ''
|
|
394
377
|
});
|
|
395
378
|
case 1:
|
|
396
379
|
case "end":
|
|
397
|
-
return
|
|
380
|
+
return _context16.stop();
|
|
398
381
|
}
|
|
399
|
-
},
|
|
382
|
+
}, _callee16);
|
|
400
383
|
}));
|
|
401
384
|
function resolveAuth() {
|
|
402
385
|
return _resolveAuth.apply(this, arguments);
|