@atlaskit/media-test-helpers 31.0.0 → 32.1.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 +21 -0
- package/dist/cjs/authProvider.js +25 -27
- package/dist/cjs/await-error.js +17 -19
- package/dist/cjs/docs-content-tabs.js +1 -0
- package/dist/cjs/fakeMediaClient.js +0 -5
- package/dist/cjs/fileStateFactory/{createFileState.js → factory/createFileState.js} +8 -15
- package/dist/cjs/fileStateFactory/{factory.js → factory/factory.js} +34 -25
- package/dist/cjs/fileStateFactory/factory/index.js +38 -0
- package/dist/cjs/fileStateFactory/fileSimulation/fileSimulation.js +89 -0
- package/dist/cjs/fileStateFactory/fileSimulation/index.js +79 -0
- package/dist/cjs/fileStateFactory/fileSimulation/simulations.js +399 -0
- package/dist/cjs/fileStateFactory/index.js +76 -4
- package/dist/cjs/getAuthFromContextProvider.js +21 -23
- package/dist/cjs/index.js +72 -0
- package/dist/cjs/mediaPickerAuthProvider.js +22 -24
- package/dist/cjs/mocks/database/collection-item.js +5 -0
- package/dist/cjs/mocks/database/index.js +6 -0
- package/dist/cjs/mocks/routers/api-router.js +92 -98
- package/dist/cjs/story-list.js +1 -1
- package/dist/cjs/utils/logging.js +4 -4
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/waitUntil.js +19 -21
- package/dist/es2019/fakeMediaClient.js +0 -5
- package/dist/es2019/fileStateFactory/{createFileState.js → factory/createFileState.js} +8 -17
- package/dist/es2019/fileStateFactory/{factory.js → factory/factory.js} +12 -2
- package/dist/es2019/fileStateFactory/factory/index.js +3 -0
- package/dist/es2019/fileStateFactory/fileSimulation/fileSimulation.js +63 -0
- package/dist/es2019/fileStateFactory/fileSimulation/index.js +2 -0
- package/dist/es2019/fileStateFactory/fileSimulation/simulations.js +148 -0
- package/dist/es2019/fileStateFactory/index.js +4 -2
- package/dist/es2019/index.js +5 -1
- package/dist/es2019/mocks/database/collection-item.js +1 -0
- package/dist/es2019/mocks/database/index.js +1 -1
- package/dist/es2019/mocks/routers/api-router.js +3 -3
- package/dist/es2019/utils/logging.js +3 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/authProvider.js +25 -27
- package/dist/esm/await-error.js +17 -19
- package/dist/esm/fakeMediaClient.js +0 -5
- package/dist/esm/fileStateFactory/{createFileState.js → factory/createFileState.js} +8 -15
- package/dist/esm/fileStateFactory/{factory.js → factory/factory.js} +34 -25
- package/dist/esm/fileStateFactory/factory/index.js +3 -0
- package/dist/esm/fileStateFactory/fileSimulation/fileSimulation.js +81 -0
- package/dist/esm/fileStateFactory/fileSimulation/index.js +2 -0
- package/dist/esm/fileStateFactory/fileSimulation/simulations.js +382 -0
- package/dist/esm/fileStateFactory/index.js +4 -2
- package/dist/esm/getAuthFromContextProvider.js +21 -23
- package/dist/esm/index.js +5 -1
- package/dist/esm/mediaPickerAuthProvider.js +22 -24
- package/dist/esm/mocks/database/collection-item.js +3 -0
- package/dist/esm/mocks/database/index.js +1 -1
- package/dist/esm/mocks/routers/api-router.js +93 -99
- package/dist/esm/utils/logging.js +3 -3
- package/dist/esm/version.json +1 -1
- package/dist/esm/waitUntil.js +19 -21
- package/dist/types/fileStateFactory/{factory.d.ts → factory/factory.d.ts} +3 -0
- package/dist/types/fileStateFactory/factory/index.d.ts +4 -0
- package/dist/types/fileStateFactory/fileSimulation/fileSimulation.d.ts +18 -0
- package/dist/types/fileStateFactory/fileSimulation/index.d.ts +4 -0
- package/dist/types/fileStateFactory/fileSimulation/simulations.d.ts +35 -0
- package/dist/types/fileStateFactory/index.d.ts +7 -3
- package/dist/types/index.d.ts +2 -2
- package/dist/types/mocks/database/collection-item.d.ts +13 -1
- package/dist/types/mocks/database/collection.d.ts +4 -1
- package/dist/types/mocks/database/index.d.ts +2 -2
- package/package.json +4 -3
- package/report.api.md +90 -0
- /package/dist/cjs/fileStateFactory/{helpers.js → factory/helpers.js} +0 -0
- /package/dist/es2019/fileStateFactory/{helpers.js → factory/helpers.js} +0 -0
- /package/dist/esm/fileStateFactory/{helpers.js → factory/helpers.js} +0 -0
- /package/dist/types/fileStateFactory/{createFileState.d.ts → factory/createFileState.d.ts} +0 -0
- /package/dist/types/fileStateFactory/{helpers.d.ts → factory/helpers.d.ts} +0 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { sleep } from '../../nextTick';
|
|
4
|
+
var speed = 1500;
|
|
5
|
+
/**
|
|
6
|
+
* Normal File Flow
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export var simulateProcessed = function simulateProcessed() {
|
|
10
|
+
var withRemotePreview = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
11
|
+
return {
|
|
12
|
+
simulation: function () {
|
|
13
|
+
var _simulation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(factory) {
|
|
14
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
15
|
+
while (1) switch (_context.prev = _context.next) {
|
|
16
|
+
case 0:
|
|
17
|
+
_context.next = 2;
|
|
18
|
+
return sleep(speed);
|
|
19
|
+
case 2:
|
|
20
|
+
factory.next('processed', {
|
|
21
|
+
withRemotePreview: withRemotePreview
|
|
22
|
+
});
|
|
23
|
+
case 3:
|
|
24
|
+
case "end":
|
|
25
|
+
return _context.stop();
|
|
26
|
+
}
|
|
27
|
+
}, _callee);
|
|
28
|
+
}));
|
|
29
|
+
function simulation(_x) {
|
|
30
|
+
return _simulation.apply(this, arguments);
|
|
31
|
+
}
|
|
32
|
+
return simulation;
|
|
33
|
+
}(),
|
|
34
|
+
description: "File state is processed ".concat(withRemotePreview ? 'with' : 'without', " remote preview")
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export var simulateProcessing = function simulateProcessing() {
|
|
38
|
+
var suceeded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
39
|
+
var withRemotePreview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
40
|
+
return {
|
|
41
|
+
description: "File is processing, then ".concat(suceeded ? 'succeeds' : 'fails', " ").concat(withRemotePreview ? 'with' : 'without', " remote preview"),
|
|
42
|
+
simulation: function () {
|
|
43
|
+
var _simulation2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(factory) {
|
|
44
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
45
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
46
|
+
case 0:
|
|
47
|
+
_context2.next = 2;
|
|
48
|
+
return sleep(speed);
|
|
49
|
+
case 2:
|
|
50
|
+
factory.next('processing');
|
|
51
|
+
_context2.next = 5;
|
|
52
|
+
return sleep(speed);
|
|
53
|
+
case 5:
|
|
54
|
+
factory.next('processing');
|
|
55
|
+
_context2.next = 8;
|
|
56
|
+
return sleep(speed * 0.5);
|
|
57
|
+
case 8:
|
|
58
|
+
if (!suceeded) {
|
|
59
|
+
factory.next('failed-processing', {
|
|
60
|
+
withRemotePreview: withRemotePreview
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
factory.next('processed', {
|
|
64
|
+
withRemotePreview: withRemotePreview
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
case 9:
|
|
68
|
+
case "end":
|
|
69
|
+
return _context2.stop();
|
|
70
|
+
}
|
|
71
|
+
}, _callee2);
|
|
72
|
+
}));
|
|
73
|
+
function simulation(_x2) {
|
|
74
|
+
return _simulation2.apply(this, arguments);
|
|
75
|
+
}
|
|
76
|
+
return simulation;
|
|
77
|
+
}()
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
export var simulateImmediateFailProcessing = function simulateImmediateFailProcessing() {
|
|
81
|
+
return {
|
|
82
|
+
description: 'The first sate is failed-processing with no preview',
|
|
83
|
+
simulation: function () {
|
|
84
|
+
var _simulation3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(factory) {
|
|
85
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
86
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
87
|
+
case 0:
|
|
88
|
+
_context3.next = 2;
|
|
89
|
+
return sleep(speed);
|
|
90
|
+
case 2:
|
|
91
|
+
factory.next('failed-processing');
|
|
92
|
+
case 3:
|
|
93
|
+
case "end":
|
|
94
|
+
return _context3.stop();
|
|
95
|
+
}
|
|
96
|
+
}, _callee3);
|
|
97
|
+
}));
|
|
98
|
+
function simulation(_x3) {
|
|
99
|
+
return _simulation3.apply(this, arguments);
|
|
100
|
+
}
|
|
101
|
+
return simulation;
|
|
102
|
+
}()
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export var simulateUpload = function simulateUpload(withLocalPreview) {
|
|
106
|
+
var suceeded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
107
|
+
return {
|
|
108
|
+
description: '',
|
|
109
|
+
simulation: function () {
|
|
110
|
+
var _simulation4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(factory) {
|
|
111
|
+
var chunks, chunkUploadDelay, processingTime, uploadUpTo, index;
|
|
112
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
113
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
114
|
+
case 0:
|
|
115
|
+
chunks = 3;
|
|
116
|
+
chunkUploadDelay = 500;
|
|
117
|
+
processingTime = speed;
|
|
118
|
+
_context4.next = 5;
|
|
119
|
+
return sleep(speed);
|
|
120
|
+
case 5:
|
|
121
|
+
factory.next('uploading', {
|
|
122
|
+
withLocalPreview: withLocalPreview
|
|
123
|
+
});
|
|
124
|
+
uploadUpTo = !suceeded ? chunks / 2 : chunks;
|
|
125
|
+
index = 0;
|
|
126
|
+
case 8:
|
|
127
|
+
if (!(index <= uploadUpTo)) {
|
|
128
|
+
_context4.next = 15;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
factory.next('uploading', {
|
|
132
|
+
uploadProgress: index / chunks,
|
|
133
|
+
withLocalPreview: withLocalPreview
|
|
134
|
+
});
|
|
135
|
+
_context4.next = 12;
|
|
136
|
+
return sleep(chunkUploadDelay);
|
|
137
|
+
case 12:
|
|
138
|
+
index++;
|
|
139
|
+
_context4.next = 8;
|
|
140
|
+
break;
|
|
141
|
+
case 15:
|
|
142
|
+
if (!suceeded) {
|
|
143
|
+
factory.error(new Error('some-error'));
|
|
144
|
+
}
|
|
145
|
+
factory.next('processing', {
|
|
146
|
+
withLocalPreview: withLocalPreview
|
|
147
|
+
});
|
|
148
|
+
_context4.next = 19;
|
|
149
|
+
return sleep(processingTime);
|
|
150
|
+
case 19:
|
|
151
|
+
factory.next('processed', {
|
|
152
|
+
withLocalPreview: withLocalPreview
|
|
153
|
+
});
|
|
154
|
+
case 20:
|
|
155
|
+
case "end":
|
|
156
|
+
return _context4.stop();
|
|
157
|
+
}
|
|
158
|
+
}, _callee4);
|
|
159
|
+
}));
|
|
160
|
+
function simulation(_x4) {
|
|
161
|
+
return _simulation4.apply(this, arguments);
|
|
162
|
+
}
|
|
163
|
+
return simulation;
|
|
164
|
+
}()
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
export var simulateErrorState = function simulateErrorState() {
|
|
168
|
+
return {
|
|
169
|
+
description: 'File state is error',
|
|
170
|
+
simulation: function () {
|
|
171
|
+
var _simulation5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(factory) {
|
|
172
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
173
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
174
|
+
case 0:
|
|
175
|
+
_context5.next = 2;
|
|
176
|
+
return sleep(speed);
|
|
177
|
+
case 2:
|
|
178
|
+
factory.next('error');
|
|
179
|
+
case 3:
|
|
180
|
+
case "end":
|
|
181
|
+
return _context5.stop();
|
|
182
|
+
}
|
|
183
|
+
}, _callee5);
|
|
184
|
+
}));
|
|
185
|
+
function simulation(_x5) {
|
|
186
|
+
return _simulation5.apply(this, arguments);
|
|
187
|
+
}
|
|
188
|
+
return simulation;
|
|
189
|
+
}()
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
export var simulateError = function simulateError() {
|
|
193
|
+
return {
|
|
194
|
+
description: 'Subscription throws an error through the observer',
|
|
195
|
+
simulation: function () {
|
|
196
|
+
var _simulation6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(factory) {
|
|
197
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
198
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
199
|
+
case 0:
|
|
200
|
+
_context6.next = 2;
|
|
201
|
+
return sleep(speed);
|
|
202
|
+
case 2:
|
|
203
|
+
factory.error(new Error('error thrown from client'));
|
|
204
|
+
case 3:
|
|
205
|
+
case "end":
|
|
206
|
+
return _context6.stop();
|
|
207
|
+
}
|
|
208
|
+
}, _callee6);
|
|
209
|
+
}));
|
|
210
|
+
function simulation(_x6) {
|
|
211
|
+
return _simulation6.apply(this, arguments);
|
|
212
|
+
}
|
|
213
|
+
return simulation;
|
|
214
|
+
}()
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Rare Cases
|
|
220
|
+
*/
|
|
221
|
+
|
|
222
|
+
export var simulateManyProcessed = function simulateManyProcessed() {
|
|
223
|
+
var withRemotePreview = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
224
|
+
return {
|
|
225
|
+
description: '',
|
|
226
|
+
simulation: function () {
|
|
227
|
+
var _simulation7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(factory) {
|
|
228
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
229
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
230
|
+
case 0:
|
|
231
|
+
_context7.next = 2;
|
|
232
|
+
return sleep(speed);
|
|
233
|
+
case 2:
|
|
234
|
+
factory.next('processed', {
|
|
235
|
+
withRemotePreview: withRemotePreview
|
|
236
|
+
});
|
|
237
|
+
_context7.next = 5;
|
|
238
|
+
return sleep(speed);
|
|
239
|
+
case 5:
|
|
240
|
+
factory.next('processed', {
|
|
241
|
+
withRemotePreview: withRemotePreview
|
|
242
|
+
});
|
|
243
|
+
_context7.next = 8;
|
|
244
|
+
return sleep(speed);
|
|
245
|
+
case 8:
|
|
246
|
+
factory.next('processed', {
|
|
247
|
+
withRemotePreview: withRemotePreview
|
|
248
|
+
});
|
|
249
|
+
case 9:
|
|
250
|
+
case "end":
|
|
251
|
+
return _context7.stop();
|
|
252
|
+
}
|
|
253
|
+
}, _callee7);
|
|
254
|
+
}));
|
|
255
|
+
function simulation(_x7) {
|
|
256
|
+
return _simulation7.apply(this, arguments);
|
|
257
|
+
}
|
|
258
|
+
return simulation;
|
|
259
|
+
}()
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
export var simulateEmptyDetails = function simulateEmptyDetails() {
|
|
263
|
+
return {
|
|
264
|
+
description: 'Incomplete uploads return empty file details and a processing status pending',
|
|
265
|
+
simulation: function () {
|
|
266
|
+
var _simulation8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(factory) {
|
|
267
|
+
var emptyDetails;
|
|
268
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
269
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
270
|
+
case 0:
|
|
271
|
+
emptyDetails = {
|
|
272
|
+
createdAt: 1630986510989
|
|
273
|
+
};
|
|
274
|
+
_context8.next = 3;
|
|
275
|
+
return sleep(speed);
|
|
276
|
+
case 3:
|
|
277
|
+
factory.next('processing', {
|
|
278
|
+
fileDetails: emptyDetails
|
|
279
|
+
});
|
|
280
|
+
case 4:
|
|
281
|
+
case "end":
|
|
282
|
+
return _context8.stop();
|
|
283
|
+
}
|
|
284
|
+
}, _callee8);
|
|
285
|
+
}));
|
|
286
|
+
function simulation(_x8) {
|
|
287
|
+
return _simulation8.apply(this, arguments);
|
|
288
|
+
}
|
|
289
|
+
return simulation;
|
|
290
|
+
}()
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
export var simulateUpdateFileId = function simulateUpdateFileId() {
|
|
294
|
+
return {
|
|
295
|
+
description: 'First File Id: video with processing issue. Next File Id: PDF sucessfully processed',
|
|
296
|
+
simulation: function () {
|
|
297
|
+
var _simulation9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(factory, _ref) {
|
|
298
|
+
var updateIdentifier;
|
|
299
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
300
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
301
|
+
case 0:
|
|
302
|
+
updateIdentifier = _ref.updateIdentifier;
|
|
303
|
+
_context9.next = 3;
|
|
304
|
+
return sleep(speed);
|
|
305
|
+
case 3:
|
|
306
|
+
factory.next('failed-processing');
|
|
307
|
+
_context9.next = 6;
|
|
308
|
+
return sleep(speed);
|
|
309
|
+
case 6:
|
|
310
|
+
updateIdentifier('doc');
|
|
311
|
+
_context9.next = 9;
|
|
312
|
+
return sleep(speed);
|
|
313
|
+
case 9:
|
|
314
|
+
factory.next('processing');
|
|
315
|
+
_context9.next = 12;
|
|
316
|
+
return sleep(speed);
|
|
317
|
+
case 12:
|
|
318
|
+
factory.next('processed');
|
|
319
|
+
case 13:
|
|
320
|
+
case "end":
|
|
321
|
+
return _context9.stop();
|
|
322
|
+
}
|
|
323
|
+
}, _callee9);
|
|
324
|
+
}));
|
|
325
|
+
function simulation(_x9, _x10) {
|
|
326
|
+
return _simulation9.apply(this, arguments);
|
|
327
|
+
}
|
|
328
|
+
return simulation;
|
|
329
|
+
}()
|
|
330
|
+
};
|
|
331
|
+
};
|
|
332
|
+
export var simulateAlwaysLoading = function simulateAlwaysLoading() {
|
|
333
|
+
return {
|
|
334
|
+
description: 'File state never fetched',
|
|
335
|
+
simulation: function () {
|
|
336
|
+
var _simulation10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
337
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
338
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
339
|
+
case 0:
|
|
340
|
+
case "end":
|
|
341
|
+
return _context10.stop();
|
|
342
|
+
}
|
|
343
|
+
}, _callee10);
|
|
344
|
+
}));
|
|
345
|
+
function simulation() {
|
|
346
|
+
return _simulation10.apply(this, arguments);
|
|
347
|
+
}
|
|
348
|
+
return simulation;
|
|
349
|
+
}()
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
export var simulateAlwaysProcessing = function simulateAlwaysProcessing() {
|
|
353
|
+
return {
|
|
354
|
+
description: 'File state is permanently processing',
|
|
355
|
+
simulation: function () {
|
|
356
|
+
var _simulation11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(factory) {
|
|
357
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
358
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
359
|
+
case 0:
|
|
360
|
+
_context11.next = 2;
|
|
361
|
+
return sleep(speed);
|
|
362
|
+
case 2:
|
|
363
|
+
factory.next('processing');
|
|
364
|
+
_context11.next = 5;
|
|
365
|
+
return sleep(speed);
|
|
366
|
+
case 5:
|
|
367
|
+
factory.next('processing');
|
|
368
|
+
_context11.next = 8;
|
|
369
|
+
return sleep(speed * 0.5);
|
|
370
|
+
case 8:
|
|
371
|
+
case "end":
|
|
372
|
+
return _context11.stop();
|
|
373
|
+
}
|
|
374
|
+
}, _callee11);
|
|
375
|
+
}));
|
|
376
|
+
function simulation(_x11) {
|
|
377
|
+
return _simulation11.apply(this, arguments);
|
|
378
|
+
}
|
|
379
|
+
return simulation;
|
|
380
|
+
}()
|
|
381
|
+
};
|
|
382
|
+
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { FileStateFactory, MediaClientMock } from './factory';
|
|
2
|
-
export { createIdentifier, createFileDetails } from './
|
|
3
|
-
export { createFileState } from './createFileState';
|
|
2
|
+
export { createIdentifier, createFileDetails } from './factory';
|
|
3
|
+
export { createFileState } from './factory/createFileState';
|
|
4
|
+
export { useRunSimulation } from './fileSimulation';
|
|
5
|
+
export { simulateProcessed, simulateProcessing, simulateImmediateFailProcessing, simulateUpload, simulateError, simulateErrorState, simulateManyProcessed, simulateEmptyDetails, simulateUpdateFileId, simulateAlwaysLoading, simulateAlwaysProcessing } from './fileSimulation';
|
|
@@ -14,29 +14,27 @@ export var getAuthFromContextProvider = /*#__PURE__*/function () {
|
|
|
14
14
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
15
15
|
var url, body, headers, response;
|
|
16
16
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
17
|
-
while (1) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return _context.stop();
|
|
39
|
-
}
|
|
17
|
+
while (1) switch (_context.prev = _context.next) {
|
|
18
|
+
case 0:
|
|
19
|
+
url = 'https://media-playground.dev.atl-paas.net/token/tenant?environment=asap';
|
|
20
|
+
body = JSON.stringify({
|
|
21
|
+
access: access
|
|
22
|
+
});
|
|
23
|
+
headers = new Headers();
|
|
24
|
+
headers.append('Content-Type', 'application/json; charset=utf-8');
|
|
25
|
+
headers.append('Accept', 'text/plain, */*; q=0.01');
|
|
26
|
+
_context.next = 7;
|
|
27
|
+
return fetch(url, {
|
|
28
|
+
method: 'POST',
|
|
29
|
+
body: body,
|
|
30
|
+
headers: headers
|
|
31
|
+
});
|
|
32
|
+
case 7:
|
|
33
|
+
response = _context.sent;
|
|
34
|
+
return _context.abrupt("return", response.json());
|
|
35
|
+
case 9:
|
|
36
|
+
case "end":
|
|
37
|
+
return _context.stop();
|
|
40
38
|
}
|
|
41
39
|
}, _callee);
|
|
42
40
|
}));
|
package/dist/esm/index.js
CHANGED
|
@@ -37,5 +37,9 @@ export { dataURItoBlob } from './mockData/utils';
|
|
|
37
37
|
export { mapDataUriToBlob } from './utils/index';
|
|
38
38
|
export { createPollingMaxAttemptsError, createRateLimitedError, createMediaStoreError } from './mediaClientErrors';
|
|
39
39
|
export { default as FeatureFlagsWrapper } from './featureFlagsWrapper';
|
|
40
|
-
export {
|
|
40
|
+
export {
|
|
41
|
+
// Simulation tools
|
|
42
|
+
FileStateFactory, MediaClientMock, createIdentifier, createFileDetails, createFileState, useRunSimulation,
|
|
43
|
+
// Predefined simulations
|
|
44
|
+
simulateProcessed, simulateProcessing, simulateImmediateFailProcessing, simulateUpload, simulateError, simulateErrorState, simulateManyProcessed, simulateEmptyDetails, simulateUpdateFileId, simulateAlwaysLoading, simulateAlwaysProcessing } from './fileStateFactory';
|
|
41
45
|
export { DocsContentTabs } from './docs-content-tabs';
|
|
@@ -31,30 +31,28 @@ var requestAuthProvider = /*#__PURE__*/function () {
|
|
|
31
31
|
response,
|
|
32
32
|
_args = arguments;
|
|
33
33
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
34
|
-
while (1) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return _context.stop();
|
|
57
|
-
}
|
|
34
|
+
while (1) switch (_context.prev = _context.next) {
|
|
35
|
+
case 0:
|
|
36
|
+
env = _args.length > 2 && _args[2] !== undefined ? _args[2] : 'dev';
|
|
37
|
+
url = "https://media-playground.".concat(env, ".atl-paas.net/token/tenant?environment=").concat(authEnvironment);
|
|
38
|
+
body = JSON.stringify({
|
|
39
|
+
access: accessUrns[collectionName] || {}
|
|
40
|
+
});
|
|
41
|
+
headers = new Headers();
|
|
42
|
+
headers.append('Content-Type', 'application/json; charset=utf-8');
|
|
43
|
+
headers.append('Accept', 'text/plain, */*; q=0.01');
|
|
44
|
+
_context.next = 8;
|
|
45
|
+
return fetch(url, {
|
|
46
|
+
method: 'POST',
|
|
47
|
+
body: body,
|
|
48
|
+
headers: headers
|
|
49
|
+
});
|
|
50
|
+
case 8:
|
|
51
|
+
response = _context.sent;
|
|
52
|
+
return _context.abrupt("return", response.json());
|
|
53
|
+
case 10:
|
|
54
|
+
case "end":
|
|
55
|
+
return _context.stop();
|
|
58
56
|
}
|
|
59
57
|
}, _callee);
|
|
60
58
|
}));
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as uuid from 'uuid';
|
|
2
2
|
import { getHackerNoun, getPastDate, fakeImage, getFakeFileName, getTextFileType } from '../../utils/mockData';
|
|
3
3
|
import { mapDataUriToBlob } from '../../utils';
|
|
4
|
+
export var isMediaItemDetails = function isMediaItemDetails(mediaCollectionItem) {
|
|
5
|
+
return !!mediaCollectionItem['mediaType'] && !!mediaCollectionItem['mimeType'] && !!mediaCollectionItem['processingStatus'];
|
|
6
|
+
};
|
|
4
7
|
export function createEmptyCollectionItem(_ref) {
|
|
5
8
|
var id = _ref.id,
|
|
6
9
|
collectionName = _ref.collectionName,
|
|
@@ -8,7 +8,7 @@ import { defaultBaseUrl } from '../../mediaClientProvider';
|
|
|
8
8
|
import { defaultCollectionName } from '../../collectionNames';
|
|
9
9
|
import { RECENTS_COLLECTION } from '@atlaskit/media-client/constants';
|
|
10
10
|
export { createCollection } from './collection';
|
|
11
|
-
export { createCollectionItem, createEmptyCollectionItem } from './collection-item';
|
|
11
|
+
export { createCollectionItem, createEmptyCollectionItem, isMediaItemDetails } from './collection-item';
|
|
12
12
|
export var tenantAuth = {
|
|
13
13
|
clientId: uuidV4(),
|
|
14
14
|
token: 'some-tenant-token',
|