@atlaskit/media-client 35.3.5 → 35.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,19 @@
1
1
  # @atlaskit/media-client
2
2
 
3
+ ## 35.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`a3ad3feab3758`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a3ad3feab3758) -
8
+ Updated types to add mulitline text support for document endpoints
9
+
10
+ ## 35.3.6
11
+
12
+ ### Patch Changes
13
+
14
+ - [`36e7fbbaff0f8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/36e7fbbaff0f8) -
15
+ Fixed path based routes for binary URL
16
+
3
17
  ## 35.3.5
4
18
 
5
19
  ### Patch Changes
package/compass.yml CHANGED
@@ -9,16 +9,6 @@ fields:
9
9
  tier: 4
10
10
  labels:
11
11
  - atlassian-platform
12
- customFields:
13
- - name: Dev Owner
14
- type: user
15
- value: null
16
- - name: Product
17
- type: text
18
- value: null
19
- - name: Test
20
- type: text
21
- value: null
22
12
  links:
23
13
  - name: ''
24
14
  type: REPOSITORY
@@ -37,7 +27,7 @@ links:
37
27
  url: 'https://atlassian.slack.com/archives/C05J5GNHPLN'
38
28
  - name: ''
39
29
  type: ON_CALL
40
- url: 'https://hello.jira.atlassian.cloud/jira/ops/teams/og-be5b1a51-de22-4e74-9f81-727cf8b8a0cb/on-call'
30
+ url: 'https://atlassian.app.opsgenie.com/settings/schedule/detail/b62291ff-4029-4f26-b7fc-d75d46d7aebc'
41
31
  - name: ''
42
32
  type: PROJECT
43
33
  url: 'https://product-fabric.atlassian.net/jira/software/c/projects/BMPT/boards/5090'
@@ -282,6 +282,7 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
282
282
  }());
283
283
  (0, _defineProperty2.default)(this, "getDurationOfVideo", /*#__PURE__*/function () {
284
284
  var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(id, collectionName) {
285
+ var _fileState$mediaMetad;
285
286
  var fileState, artifactUrlString, artifactUrl, artifactPath, res, arrayBuffer, uint8Array, mvhdBytes, mvhdIndex, i, j, dataView, start, timeScale, duration, videoLength;
286
287
  return _regenerator.default.wrap(function _callee5$(_context5) {
287
288
  while (1) switch (_context5.prev = _context5.next) {
@@ -296,90 +297,96 @@ var FileFetcherImpl = exports.FileFetcherImpl = /*#__PURE__*/function () {
296
297
  }
297
298
  throw new Error('File is not a video');
298
299
  case 5:
299
- _context5.next = 7;
300
- return _this.getArtifactURL(fileState.artifacts, 'video.mp4');
300
+ if (!((_fileState$mediaMetad = fileState.mediaMetadata) !== null && _fileState$mediaMetad !== void 0 && _fileState$mediaMetad.duration)) {
301
+ _context5.next = 7;
302
+ break;
303
+ }
304
+ return _context5.abrupt("return", fileState.mediaMetadata.duration);
301
305
  case 7:
306
+ _context5.next = 9;
307
+ return _this.getArtifactURL(fileState.artifacts, 'video.mp4', collectionName);
308
+ case 9:
302
309
  artifactUrlString = _context5.sent;
303
310
  artifactUrl = new URL(artifactUrlString);
304
311
  artifactPath = "".concat(artifactUrl.pathname).concat(artifactUrl.search);
305
- _context5.next = 12;
312
+ _context5.next = 14;
306
313
  return _this.mediaApi.request(artifactPath, {
307
314
  headers: {
308
315
  Range: 'bytes=0-199'
309
316
  }
310
317
  });
311
- case 12:
318
+ case 14:
312
319
  res = _context5.sent;
313
- _context5.next = 15;
320
+ _context5.next = 17;
314
321
  return res.arrayBuffer();
315
- case 15:
322
+ case 17:
316
323
  arrayBuffer = _context5.sent;
317
324
  uint8Array = new Uint8Array(arrayBuffer);
318
325
  mvhdBytes = new Uint8Array([109, 118, 104, 100]); // "mvhd" in ASCII
319
326
  mvhdIndex = -1;
320
327
  i = 0;
321
- case 20:
328
+ case 22:
322
329
  if (!(i <= uint8Array.length - mvhdBytes.length)) {
323
- _context5.next = 35;
330
+ _context5.next = 37;
324
331
  break;
325
332
  }
326
333
  mvhdIndex = i;
327
334
  j = 0;
328
- case 23:
335
+ case 25:
329
336
  if (!(j < mvhdBytes.length)) {
330
- _context5.next = 30;
337
+ _context5.next = 32;
331
338
  break;
332
339
  }
333
340
  if (!(uint8Array[i + j] !== mvhdBytes[j])) {
334
- _context5.next = 27;
341
+ _context5.next = 29;
335
342
  break;
336
343
  }
337
344
  mvhdIndex = -1;
338
- return _context5.abrupt("break", 30);
339
- case 27:
345
+ return _context5.abrupt("break", 32);
346
+ case 29:
340
347
  j++;
341
- _context5.next = 23;
348
+ _context5.next = 25;
342
349
  break;
343
- case 30:
350
+ case 32:
344
351
  if (!(mvhdIndex !== -1)) {
345
- _context5.next = 32;
352
+ _context5.next = 34;
346
353
  break;
347
354
  }
348
- return _context5.abrupt("break", 35);
349
- case 32:
355
+ return _context5.abrupt("break", 37);
356
+ case 34:
350
357
  i++;
351
- _context5.next = 20;
358
+ _context5.next = 22;
352
359
  break;
353
- case 35:
360
+ case 37:
354
361
  if (!(mvhdIndex === -1)) {
355
- _context5.next = 37;
362
+ _context5.next = 39;
356
363
  break;
357
364
  }
358
365
  throw new Error('Unable to find mvhd bytes');
359
- case 37:
366
+ case 39:
360
367
  // Create DataView for reading big-endian integers
361
368
  dataView = new DataView(arrayBuffer);
362
369
  start = mvhdIndex + 16; // Skip atom header and version/flags
363
370
  // Check if we have enough bytes to read timescale and duration
364
371
  if (!(start + 8 > arrayBuffer.byteLength)) {
365
- _context5.next = 41;
372
+ _context5.next = 43;
366
373
  break;
367
374
  }
368
375
  return _context5.abrupt("return", 0);
369
- case 41:
376
+ case 43:
370
377
  // flase as second parameter indicates big-endian 32-bit integers
371
378
  timeScale = dataView.getUint32(start, false);
372
379
  duration = dataView.getUint32(start + 4, false);
373
380
  if (!(timeScale === 0)) {
374
- _context5.next = 45;
381
+ _context5.next = 47;
375
382
  break;
376
383
  }
377
384
  throw new Error('Timescale is invalid');
378
- case 45:
385
+ case 47:
379
386
  // get the video length in seconds
380
387
  videoLength = Math.floor(duration / timeScale);
381
388
  return _context5.abrupt("return", videoLength);
382
- case 47:
389
+ case 49:
383
390
  case "end":
384
391
  return _context5.stop();
385
392
  }
@@ -486,8 +486,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
486
486
  auth: auth
487
487
  };
488
488
  binaryEndpoint = cdnFeatureFlag('binary');
489
+ if (!(0, _platformFeatureFlags.fg)('platform_media_path_based_route')) {
490
+ _context9.next = 8;
491
+ break;
492
+ }
493
+ return _context9.abrupt("return", (0, _pathBasedUrl.mapToPathBasedUrl)((0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options)));
494
+ case 8:
489
495
  return _context9.abrupt("return", (0, _mediaCdn.mapToMediaCdnUrl)((0, _helpers.createUrl)("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options), auth.token));
490
- case 7:
496
+ case 9:
491
497
  case "end":
492
498
  return _context9.stop();
493
499
  }
@@ -179,11 +179,17 @@ export class FileFetcherImpl {
179
179
  });
180
180
  });
181
181
  _defineProperty(this, "getDurationOfVideo", async (id, collectionName) => {
182
+ var _fileState$mediaMetad;
182
183
  const fileState = await this.getOrFetchFileState(id, collectionName);
183
184
  if (fileState.status !== 'processed' || fileState.mediaType !== 'video' || !fileState.artifacts['video.mp4']) {
184
185
  throw new Error('File is not a video');
185
186
  }
186
- const artifactUrlString = await this.getArtifactURL(fileState.artifacts, 'video.mp4');
187
+ if ((_fileState$mediaMetad = fileState.mediaMetadata) !== null && _fileState$mediaMetad !== void 0 && _fileState$mediaMetad.duration) {
188
+ return fileState.mediaMetadata.duration;
189
+ }
190
+
191
+ // If the duration is not present, we need to fetch it from the artifact
192
+ const artifactUrlString = await this.getArtifactURL(fileState.artifacts, 'video.mp4', collectionName);
187
193
  const artifactUrl = new URL(artifactUrlString);
188
194
  const artifactPath = `${artifactUrl.pathname}${artifactUrl.search}`;
189
195
  const res = await this.mediaApi.request(artifactPath, {
@@ -306,6 +306,9 @@ export class MediaStore {
306
306
  auth
307
307
  };
308
308
  const binaryEndpoint = cdnFeatureFlag('binary');
309
+ if (fg('platform_media_path_based_route')) {
310
+ return mapToPathBasedUrl(createUrl(`${auth.baseUrl}/file/${id}/${binaryEndpoint}`, options));
311
+ }
309
312
  return mapToMediaCdnUrl(createUrl(`${auth.baseUrl}/file/${id}/${binaryEndpoint}`, options), auth.token);
310
313
  }
311
314
  async getArtifactURL(artifacts, artifactName, collectionName, maxAge = FILE_CACHE_MAX_AGE) {
@@ -264,6 +264,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
264
264
  }());
265
265
  _defineProperty(this, "getDurationOfVideo", /*#__PURE__*/function () {
266
266
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id, collectionName) {
267
+ var _fileState$mediaMetad;
267
268
  var fileState, artifactUrlString, artifactUrl, artifactPath, res, arrayBuffer, uint8Array, mvhdBytes, mvhdIndex, i, j, dataView, start, timeScale, duration, videoLength;
268
269
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
269
270
  while (1) switch (_context5.prev = _context5.next) {
@@ -278,90 +279,96 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
278
279
  }
279
280
  throw new Error('File is not a video');
280
281
  case 5:
281
- _context5.next = 7;
282
- return _this.getArtifactURL(fileState.artifacts, 'video.mp4');
282
+ if (!((_fileState$mediaMetad = fileState.mediaMetadata) !== null && _fileState$mediaMetad !== void 0 && _fileState$mediaMetad.duration)) {
283
+ _context5.next = 7;
284
+ break;
285
+ }
286
+ return _context5.abrupt("return", fileState.mediaMetadata.duration);
283
287
  case 7:
288
+ _context5.next = 9;
289
+ return _this.getArtifactURL(fileState.artifacts, 'video.mp4', collectionName);
290
+ case 9:
284
291
  artifactUrlString = _context5.sent;
285
292
  artifactUrl = new URL(artifactUrlString);
286
293
  artifactPath = "".concat(artifactUrl.pathname).concat(artifactUrl.search);
287
- _context5.next = 12;
294
+ _context5.next = 14;
288
295
  return _this.mediaApi.request(artifactPath, {
289
296
  headers: {
290
297
  Range: 'bytes=0-199'
291
298
  }
292
299
  });
293
- case 12:
300
+ case 14:
294
301
  res = _context5.sent;
295
- _context5.next = 15;
302
+ _context5.next = 17;
296
303
  return res.arrayBuffer();
297
- case 15:
304
+ case 17:
298
305
  arrayBuffer = _context5.sent;
299
306
  uint8Array = new Uint8Array(arrayBuffer);
300
307
  mvhdBytes = new Uint8Array([109, 118, 104, 100]); // "mvhd" in ASCII
301
308
  mvhdIndex = -1;
302
309
  i = 0;
303
- case 20:
310
+ case 22:
304
311
  if (!(i <= uint8Array.length - mvhdBytes.length)) {
305
- _context5.next = 35;
312
+ _context5.next = 37;
306
313
  break;
307
314
  }
308
315
  mvhdIndex = i;
309
316
  j = 0;
310
- case 23:
317
+ case 25:
311
318
  if (!(j < mvhdBytes.length)) {
312
- _context5.next = 30;
319
+ _context5.next = 32;
313
320
  break;
314
321
  }
315
322
  if (!(uint8Array[i + j] !== mvhdBytes[j])) {
316
- _context5.next = 27;
323
+ _context5.next = 29;
317
324
  break;
318
325
  }
319
326
  mvhdIndex = -1;
320
- return _context5.abrupt("break", 30);
321
- case 27:
327
+ return _context5.abrupt("break", 32);
328
+ case 29:
322
329
  j++;
323
- _context5.next = 23;
330
+ _context5.next = 25;
324
331
  break;
325
- case 30:
332
+ case 32:
326
333
  if (!(mvhdIndex !== -1)) {
327
- _context5.next = 32;
334
+ _context5.next = 34;
328
335
  break;
329
336
  }
330
- return _context5.abrupt("break", 35);
331
- case 32:
337
+ return _context5.abrupt("break", 37);
338
+ case 34:
332
339
  i++;
333
- _context5.next = 20;
340
+ _context5.next = 22;
334
341
  break;
335
- case 35:
342
+ case 37:
336
343
  if (!(mvhdIndex === -1)) {
337
- _context5.next = 37;
344
+ _context5.next = 39;
338
345
  break;
339
346
  }
340
347
  throw new Error('Unable to find mvhd bytes');
341
- case 37:
348
+ case 39:
342
349
  // Create DataView for reading big-endian integers
343
350
  dataView = new DataView(arrayBuffer);
344
351
  start = mvhdIndex + 16; // Skip atom header and version/flags
345
352
  // Check if we have enough bytes to read timescale and duration
346
353
  if (!(start + 8 > arrayBuffer.byteLength)) {
347
- _context5.next = 41;
354
+ _context5.next = 43;
348
355
  break;
349
356
  }
350
357
  return _context5.abrupt("return", 0);
351
- case 41:
358
+ case 43:
352
359
  // flase as second parameter indicates big-endian 32-bit integers
353
360
  timeScale = dataView.getUint32(start, false);
354
361
  duration = dataView.getUint32(start + 4, false);
355
362
  if (!(timeScale === 0)) {
356
- _context5.next = 45;
363
+ _context5.next = 47;
357
364
  break;
358
365
  }
359
366
  throw new Error('Timescale is invalid');
360
- case 45:
367
+ case 47:
361
368
  // get the video length in seconds
362
369
  videoLength = Math.floor(duration / timeScale);
363
370
  return _context5.abrupt("return", videoLength);
364
- case 47:
371
+ case 49:
365
372
  case "end":
366
373
  return _context5.stop();
367
374
  }
@@ -480,8 +480,14 @@ export var MediaStore = /*#__PURE__*/function () {
480
480
  auth: auth
481
481
  };
482
482
  binaryEndpoint = cdnFeatureFlag('binary');
483
+ if (!fg('platform_media_path_based_route')) {
484
+ _context9.next = 8;
485
+ break;
486
+ }
487
+ return _context9.abrupt("return", mapToPathBasedUrl(createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options)));
488
+ case 8:
483
489
  return _context9.abrupt("return", mapToMediaCdnUrl(createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/").concat(binaryEndpoint), options), auth.token));
484
- case 7:
490
+ case 9:
485
491
  case "end":
486
492
  return _context9.stop();
487
493
  }
@@ -38,6 +38,7 @@ export type TextField = {
38
38
  h: number;
39
39
  f: number;
40
40
  text: string;
41
+ multiline: boolean;
41
42
  };
42
43
  export type ComboBoxField = {
43
44
  x: number;
@@ -38,6 +38,7 @@ export type TextField = {
38
38
  h: number;
39
39
  f: number;
40
40
  text: string;
41
+ multiline: boolean;
41
42
  };
42
43
  export type ComboBoxField = {
43
44
  x: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "35.3.5",
3
+ "version": "35.4.0",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/media-core": "^37.0.0",
54
54
  "@atlaskit/media-state": "^1.8.0",
55
55
  "@atlaskit/ssr": "workspace:^",
56
- "@atlaskit/tokens": "^6.3.0",
56
+ "@atlaskit/tokens": "^6.4.0",
57
57
  "@atlassian/feature-flags-test-utils": "^0.3.0",
58
58
  "@emotion/react": "^11.7.1",
59
59
  "@types/deep-equal": "^1.0.1",
@@ -87,9 +87,6 @@
87
87
  },
88
88
  "platform_media_retry_edge_error": {
89
89
  "type": "boolean"
90
- },
91
- "platform_disable_isolated_cloud_media_cdn_delivery": {
92
- "type": "boolean"
93
90
  }
94
91
  }
95
92
  }