@atlaskit/media-client 33.4.1 → 33.5.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 +9 -0
- package/dist/cjs/client/media-store/MediaStore.js +8 -4
- package/dist/es2019/client/media-store/MediaStore.js +6 -2
- package/dist/esm/client/media-store/MediaStore.js +8 -4
- package/dist/types/models/document.d.ts +37 -0
- package/dist/types-ts4.5/models/document.d.ts +37 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/media-client
|
|
2
2
|
|
|
3
|
+
## 33.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#172332](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/172332)
|
|
8
|
+
[`d257b57972216`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d257b57972216) -
|
|
9
|
+
Updating the response type of document content endpoint to add the new annotation and links from
|
|
10
|
+
documents
|
|
11
|
+
|
|
3
12
|
## 33.4.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -665,26 +665,28 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
665
665
|
key: "getDocumentContent",
|
|
666
666
|
value: function () {
|
|
667
667
|
var _getDocumentContent = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(id, options) {
|
|
668
|
-
var metadata, requestOptions;
|
|
668
|
+
var endpoint, metadata, requestOptions;
|
|
669
669
|
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
670
670
|
while (1) switch (_context12.prev = _context12.next) {
|
|
671
671
|
case 0:
|
|
672
|
+
endpoint = cdnFeatureFlag('contents');
|
|
672
673
|
metadata = {
|
|
673
674
|
method: 'GET',
|
|
674
|
-
endpoint:
|
|
675
|
+
endpoint: "/file/{fileId}/document/".concat(endpoint)
|
|
675
676
|
};
|
|
676
677
|
requestOptions = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
677
678
|
authContext: {
|
|
678
679
|
collectionName: options.collectionName
|
|
679
680
|
},
|
|
680
681
|
params: {
|
|
682
|
+
collection: options.collectionName,
|
|
681
683
|
pageStart: options.pageStart,
|
|
682
684
|
pageEnd: options.pageEnd,
|
|
683
685
|
'max-age': _constants.FILE_CACHE_MAX_AGE
|
|
684
686
|
}
|
|
685
687
|
});
|
|
686
|
-
return _context12.abrupt("return", this.request("/file/".concat(id, "/document/
|
|
687
|
-
case
|
|
688
|
+
return _context12.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then((0, _helpers.createMapResponseToJson)(metadata)));
|
|
689
|
+
case 4:
|
|
688
690
|
case "end":
|
|
689
691
|
return _context12.stop();
|
|
690
692
|
}
|
|
@@ -703,6 +705,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
703
705
|
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
704
706
|
while (1) switch (_context13.prev = _context13.next) {
|
|
705
707
|
case 0:
|
|
708
|
+
// Temporarily disabling CDN for document due to bug of CDN not forwarding query params
|
|
706
709
|
endpoint = cdnFeatureFlag('page');
|
|
707
710
|
metadata = {
|
|
708
711
|
method: 'GET',
|
|
@@ -713,6 +716,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
|
|
|
713
716
|
collectionName: options.collectionName
|
|
714
717
|
},
|
|
715
718
|
params: {
|
|
719
|
+
collection: options.collectionName,
|
|
716
720
|
page: options.page,
|
|
717
721
|
zoom: options.zoom,
|
|
718
722
|
'max-age': _constants.FILE_CACHE_MAX_AGE
|
|
@@ -395,9 +395,10 @@ export class MediaStore {
|
|
|
395
395
|
return this.request(`/file/${id}/image/metadata`, options).then(createMapResponseToJson(metadata));
|
|
396
396
|
}
|
|
397
397
|
async getDocumentContent(id, options) {
|
|
398
|
+
const endpoint = cdnFeatureFlag('contents');
|
|
398
399
|
const metadata = {
|
|
399
400
|
method: 'GET',
|
|
400
|
-
endpoint:
|
|
401
|
+
endpoint: `/file/{fileId}/document/${endpoint}`
|
|
401
402
|
};
|
|
402
403
|
const requestOptions = {
|
|
403
404
|
...metadata,
|
|
@@ -405,14 +406,16 @@ export class MediaStore {
|
|
|
405
406
|
collectionName: options.collectionName
|
|
406
407
|
},
|
|
407
408
|
params: {
|
|
409
|
+
collection: options.collectionName,
|
|
408
410
|
pageStart: options.pageStart,
|
|
409
411
|
pageEnd: options.pageEnd,
|
|
410
412
|
'max-age': FILE_CACHE_MAX_AGE
|
|
411
413
|
}
|
|
412
414
|
};
|
|
413
|
-
return this.request(`/file/${id}/document
|
|
415
|
+
return this.request(`/file/${id}/document/${endpoint}`, requestOptions).then(createMapResponseToJson(metadata));
|
|
414
416
|
}
|
|
415
417
|
async getDocumentPageImage(id, options) {
|
|
418
|
+
// Temporarily disabling CDN for document due to bug of CDN not forwarding query params
|
|
416
419
|
const endpoint = cdnFeatureFlag('page');
|
|
417
420
|
const metadata = {
|
|
418
421
|
method: 'GET',
|
|
@@ -424,6 +427,7 @@ export class MediaStore {
|
|
|
424
427
|
collectionName: options.collectionName
|
|
425
428
|
},
|
|
426
429
|
params: {
|
|
430
|
+
collection: options.collectionName,
|
|
427
431
|
page: options.page,
|
|
428
432
|
zoom: options.zoom,
|
|
429
433
|
'max-age': FILE_CACHE_MAX_AGE
|
|
@@ -659,26 +659,28 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
659
659
|
key: "getDocumentContent",
|
|
660
660
|
value: function () {
|
|
661
661
|
var _getDocumentContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(id, options) {
|
|
662
|
-
var metadata, requestOptions;
|
|
662
|
+
var endpoint, metadata, requestOptions;
|
|
663
663
|
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
664
664
|
while (1) switch (_context12.prev = _context12.next) {
|
|
665
665
|
case 0:
|
|
666
|
+
endpoint = cdnFeatureFlag('contents');
|
|
666
667
|
metadata = {
|
|
667
668
|
method: 'GET',
|
|
668
|
-
endpoint:
|
|
669
|
+
endpoint: "/file/{fileId}/document/".concat(endpoint)
|
|
669
670
|
};
|
|
670
671
|
requestOptions = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
671
672
|
authContext: {
|
|
672
673
|
collectionName: options.collectionName
|
|
673
674
|
},
|
|
674
675
|
params: {
|
|
676
|
+
collection: options.collectionName,
|
|
675
677
|
pageStart: options.pageStart,
|
|
676
678
|
pageEnd: options.pageEnd,
|
|
677
679
|
'max-age': FILE_CACHE_MAX_AGE
|
|
678
680
|
}
|
|
679
681
|
});
|
|
680
|
-
return _context12.abrupt("return", this.request("/file/".concat(id, "/document/
|
|
681
|
-
case
|
|
682
|
+
return _context12.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then(createMapResponseToJson(metadata)));
|
|
683
|
+
case 4:
|
|
682
684
|
case "end":
|
|
683
685
|
return _context12.stop();
|
|
684
686
|
}
|
|
@@ -697,6 +699,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
697
699
|
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
698
700
|
while (1) switch (_context13.prev = _context13.next) {
|
|
699
701
|
case 0:
|
|
702
|
+
// Temporarily disabling CDN for document due to bug of CDN not forwarding query params
|
|
700
703
|
endpoint = cdnFeatureFlag('page');
|
|
701
704
|
metadata = {
|
|
702
705
|
method: 'GET',
|
|
@@ -707,6 +710,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
707
710
|
collectionName: options.collectionName
|
|
708
711
|
},
|
|
709
712
|
params: {
|
|
713
|
+
collection: options.collectionName,
|
|
710
714
|
page: options.page,
|
|
711
715
|
zoom: options.zoom,
|
|
712
716
|
'max-age': FILE_CACHE_MAX_AGE
|
|
@@ -27,11 +27,48 @@ export type Line = {
|
|
|
27
27
|
r: number;
|
|
28
28
|
spans: readonly Span[];
|
|
29
29
|
};
|
|
30
|
+
export type DocumentAnnotations = {
|
|
31
|
+
text_form_fields: readonly TextField[];
|
|
32
|
+
combobox_form_fields: readonly ComboBoxField[];
|
|
33
|
+
};
|
|
34
|
+
export type TextField = {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
w: number;
|
|
38
|
+
h: number;
|
|
39
|
+
f: number;
|
|
40
|
+
text: string;
|
|
41
|
+
};
|
|
42
|
+
export type ComboBoxField = {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
w: number;
|
|
46
|
+
h: number;
|
|
47
|
+
f: number;
|
|
48
|
+
text: string;
|
|
49
|
+
};
|
|
50
|
+
export type DocumentLink = {
|
|
51
|
+
type: 'uri';
|
|
52
|
+
dest: string;
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
w: number;
|
|
56
|
+
h: number;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'local';
|
|
59
|
+
p_num: number;
|
|
60
|
+
x: number;
|
|
61
|
+
y: number;
|
|
62
|
+
w: number;
|
|
63
|
+
h: number;
|
|
64
|
+
};
|
|
30
65
|
export type DocumentPageContent = {
|
|
31
66
|
rotation: number;
|
|
32
67
|
width: number;
|
|
33
68
|
height: number;
|
|
34
69
|
lines: readonly Line[];
|
|
70
|
+
annotations: DocumentAnnotations;
|
|
71
|
+
links: readonly DocumentLink[];
|
|
35
72
|
};
|
|
36
73
|
export type DocumentPageRangeContent = {
|
|
37
74
|
total_pages: number;
|
|
@@ -27,11 +27,48 @@ export type Line = {
|
|
|
27
27
|
r: number;
|
|
28
28
|
spans: readonly Span[];
|
|
29
29
|
};
|
|
30
|
+
export type DocumentAnnotations = {
|
|
31
|
+
text_form_fields: readonly TextField[];
|
|
32
|
+
combobox_form_fields: readonly ComboBoxField[];
|
|
33
|
+
};
|
|
34
|
+
export type TextField = {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
w: number;
|
|
38
|
+
h: number;
|
|
39
|
+
f: number;
|
|
40
|
+
text: string;
|
|
41
|
+
};
|
|
42
|
+
export type ComboBoxField = {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
w: number;
|
|
46
|
+
h: number;
|
|
47
|
+
f: number;
|
|
48
|
+
text: string;
|
|
49
|
+
};
|
|
50
|
+
export type DocumentLink = {
|
|
51
|
+
type: 'uri';
|
|
52
|
+
dest: string;
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
w: number;
|
|
56
|
+
h: number;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'local';
|
|
59
|
+
p_num: number;
|
|
60
|
+
x: number;
|
|
61
|
+
y: number;
|
|
62
|
+
w: number;
|
|
63
|
+
h: number;
|
|
64
|
+
};
|
|
30
65
|
export type DocumentPageContent = {
|
|
31
66
|
rotation: number;
|
|
32
67
|
width: number;
|
|
33
68
|
height: number;
|
|
34
69
|
lines: readonly Line[];
|
|
70
|
+
annotations: DocumentAnnotations;
|
|
71
|
+
links: readonly DocumentLink[];
|
|
35
72
|
};
|
|
36
73
|
export type DocumentPageRangeContent = {
|
|
37
74
|
total_pages: number;
|