@atlaskit/media-client 20.2.1 → 21.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 +35 -0
- package/dist/cjs/client/file-fetcher/error.js +4 -4
- package/dist/cjs/client/file-fetcher/index.js +275 -287
- package/dist/cjs/client/media-client.js +48 -34
- package/dist/cjs/client/media-store/index.js +367 -314
- package/dist/cjs/client/media-store/resolveAuth.js +30 -32
- package/dist/cjs/client/stargate-client.js +14 -16
- package/dist/cjs/index.js +6 -13
- package/dist/cjs/models/media.js +8 -9
- package/dist/cjs/uploader/error.js +4 -4
- package/dist/cjs/uploader/index.js +88 -96
- package/dist/cjs/utils/convertBase64ToBlob.js +2 -2
- package/dist/cjs/utils/createFileDataLoader.js +67 -70
- package/dist/cjs/utils/getDimensionsFromBlob.js +23 -25
- package/dist/cjs/utils/getVideoDimensionsFromBlob.js +24 -26
- package/dist/cjs/utils/hashing/hasherCreator.js +32 -34
- package/dist/cjs/utils/mediaSubscribable/fromObservable.js +2 -2
- package/dist/cjs/utils/mobileUpload/error.js +4 -4
- package/dist/cjs/utils/mobileUpload/helpers.js +41 -43
- package/dist/cjs/utils/mobileUpload/stateMachine/index.js +14 -16
- package/dist/cjs/utils/parseJwt.js +52 -0
- package/dist/cjs/utils/polling/index.js +40 -42
- package/dist/cjs/utils/request/errors.js +9 -9
- package/dist/cjs/utils/request/helpers.js +143 -155
- package/dist/cjs/utils/request/index.js +24 -26
- package/dist/cjs/utils/shouldFetchRemoteFileStates.js +39 -41
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/file-fetcher/index.js +1 -3
- package/dist/es2019/client/media-client.js +3 -2
- package/dist/es2019/client/media-store/index.js +58 -15
- package/dist/es2019/index.js +2 -3
- package/dist/es2019/models/media.js +6 -4
- package/dist/es2019/uploader/index.js +3 -0
- package/dist/es2019/utils/mediaSubscribable/fromObservable.js +2 -2
- package/dist/es2019/utils/mediaSubscribable/toPromise.js +10 -12
- package/dist/es2019/utils/parseJwt.js +46 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/client/file-fetcher/error.js +4 -4
- package/dist/esm/client/file-fetcher/index.js +273 -286
- package/dist/esm/client/media-client.js +46 -32
- package/dist/esm/client/media-store/index.js +367 -314
- package/dist/esm/client/media-store/resolveAuth.js +30 -32
- package/dist/esm/client/stargate-client.js +14 -16
- package/dist/esm/index.js +2 -3
- package/dist/esm/models/media.js +6 -6
- package/dist/esm/uploader/error.js +4 -4
- package/dist/esm/uploader/index.js +89 -96
- package/dist/esm/utils/convertBase64ToBlob.js +2 -2
- package/dist/esm/utils/createFileDataLoader.js +65 -69
- package/dist/esm/utils/getDimensionsFromBlob.js +23 -25
- package/dist/esm/utils/getVideoDimensionsFromBlob.js +24 -26
- package/dist/esm/utils/hashing/hasherCreator.js +28 -30
- package/dist/esm/utils/mediaSubscribable/fromObservable.js +2 -2
- package/dist/esm/utils/mobileUpload/error.js +4 -4
- package/dist/esm/utils/mobileUpload/helpers.js +41 -43
- package/dist/esm/utils/mobileUpload/stateMachine/index.js +14 -16
- package/dist/esm/utils/parseJwt.js +46 -0
- package/dist/esm/utils/polling/index.js +40 -42
- package/dist/esm/utils/request/errors.js +9 -9
- package/dist/esm/utils/request/helpers.js +143 -155
- package/dist/esm/utils/request/index.js +24 -26
- package/dist/esm/utils/shouldFetchRemoteFileStates.js +39 -41
- package/dist/esm/version.json +1 -1
- package/dist/types/client/__mocks__/media-client.d.ts +0 -2
- package/dist/types/client/file-fetcher/index.d.ts +4 -4
- package/dist/types/client/media-client.d.ts +1 -2
- package/dist/types/client/media-store/index.d.ts +17 -13
- package/dist/types/index.d.ts +4 -6
- package/dist/types/models/file-state.d.ts +2 -2
- package/dist/types/models/media.d.ts +1 -21
- package/dist/types/utils/createFileDataLoader.d.ts +2 -2
- package/dist/types/utils/createMediaSubject.d.ts +2 -2
- package/dist/types/utils/detectEmptyFile.d.ts +2 -2
- package/dist/types/utils/mediaSubscribable/fromObservable.d.ts +3 -3
- package/dist/types/utils/mediaSubscribable/toPromise.d.ts +2 -2
- package/dist/types/utils/mediaSubscribable/types.d.ts +9 -8
- package/dist/types/utils/parseJwt.d.ts +1 -0
- package/package.json +2 -2
- package/report.api.md +77 -126
- package/dist/cjs/client/collection-fetcher.js +0 -98
- package/dist/cjs/models/media-subscribable.js +0 -5
- package/dist/cjs/utils/deprecatedEndpointError.js +0 -43
- package/dist/es2019/client/collection-fetcher.js +0 -38
- package/dist/es2019/models/media-subscribable.js +0 -1
- package/dist/es2019/utils/deprecatedEndpointError.js +0 -20
- package/dist/esm/client/collection-fetcher.js +0 -89
- package/dist/esm/models/media-subscribable.js +0 -1
- package/dist/esm/utils/deprecatedEndpointError.js +0 -34
- package/dist/types/client/collection-fetcher.d.ts +0 -42
- package/dist/types/models/media-subscribable.d.ts +0 -3
- package/dist/types/utils/deprecatedEndpointError.d.ts +0 -16
|
@@ -4,7 +4,6 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
4
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
5
|
import { EventEmitter2 } from 'eventemitter2';
|
|
6
6
|
import { MediaStore } from './media-store';
|
|
7
|
-
import { CollectionFetcher } from './collection-fetcher';
|
|
8
7
|
import { FileFetcherImpl } from './file-fetcher';
|
|
9
8
|
import { StargateClient } from './stargate-client';
|
|
10
9
|
export var MediaClient = /*#__PURE__*/function () {
|
|
@@ -21,7 +20,6 @@ export var MediaClient = /*#__PURE__*/function () {
|
|
|
21
20
|
initialAuth: mediaClientConfig.initialAuth
|
|
22
21
|
}, featureFlags);
|
|
23
22
|
this.config = mediaClientConfig;
|
|
24
|
-
this.collection = new CollectionFetcher(this.mediaStore);
|
|
25
23
|
this.file = new FileFetcherImpl(this.mediaStore, featureFlags);
|
|
26
24
|
this.eventEmitter = new EventEmitter2();
|
|
27
25
|
this.stargate = new StargateClient(mediaClientConfig.stargateBaseUrl);
|
|
@@ -46,17 +44,15 @@ export var MediaClient = /*#__PURE__*/function () {
|
|
|
46
44
|
value: function () {
|
|
47
45
|
var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(id, params) {
|
|
48
46
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
49
|
-
while (1) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return _context.stop();
|
|
59
|
-
}
|
|
47
|
+
while (1) switch (_context.prev = _context.next) {
|
|
48
|
+
case 0:
|
|
49
|
+
_context.next = 2;
|
|
50
|
+
return this.mediaStore.getImageMetadata(id, params);
|
|
51
|
+
case 2:
|
|
52
|
+
return _context.abrupt("return", _context.sent.metadata);
|
|
53
|
+
case 3:
|
|
54
|
+
case "end":
|
|
55
|
+
return _context.stop();
|
|
60
56
|
}
|
|
61
57
|
}, _callee, this);
|
|
62
58
|
}));
|
|
@@ -71,25 +67,23 @@ export var MediaClient = /*#__PURE__*/function () {
|
|
|
71
67
|
var _mobileUploadPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
72
68
|
var module;
|
|
73
69
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
74
|
-
while (1) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return _context2.stop();
|
|
92
|
-
}
|
|
70
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
71
|
+
case 0:
|
|
72
|
+
if (!this.mobileUpload) {
|
|
73
|
+
_context2.next = 2;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
return _context2.abrupt("return", this.mobileUpload);
|
|
77
|
+
case 2:
|
|
78
|
+
_context2.next = 4;
|
|
79
|
+
return import( /* webpackChunkName: "@atlaskit-internal_media-client-mobile-upload" */'./mobile-upload');
|
|
80
|
+
case 4:
|
|
81
|
+
module = _context2.sent;
|
|
82
|
+
this.mobileUpload = new module.MobileUploadImpl(this.mediaStore);
|
|
83
|
+
return _context2.abrupt("return", this.mobileUpload);
|
|
84
|
+
case 7:
|
|
85
|
+
case "end":
|
|
86
|
+
return _context2.stop();
|
|
93
87
|
}
|
|
94
88
|
}, _callee2, this);
|
|
95
89
|
}));
|
|
@@ -98,6 +92,26 @@ export var MediaClient = /*#__PURE__*/function () {
|
|
|
98
92
|
}
|
|
99
93
|
return mobileUploadPromise;
|
|
100
94
|
}()
|
|
95
|
+
}, {
|
|
96
|
+
key: "removeFileFromCollection",
|
|
97
|
+
value: function () {
|
|
98
|
+
var _removeFileFromCollection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id, collectionName, occurrenceKey, traceContext) {
|
|
99
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
100
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
101
|
+
case 0:
|
|
102
|
+
_context3.next = 2;
|
|
103
|
+
return this.mediaStore.removeCollectionFile(id, collectionName, occurrenceKey, traceContext);
|
|
104
|
+
case 2:
|
|
105
|
+
case "end":
|
|
106
|
+
return _context3.stop();
|
|
107
|
+
}
|
|
108
|
+
}, _callee3, this);
|
|
109
|
+
}));
|
|
110
|
+
function removeFileFromCollection(_x3, _x4, _x5, _x6) {
|
|
111
|
+
return _removeFileFromCollection.apply(this, arguments);
|
|
112
|
+
}
|
|
113
|
+
return removeFileFromCollection;
|
|
114
|
+
}()
|
|
101
115
|
}, {
|
|
102
116
|
key: "on",
|
|
103
117
|
value: function on(event, listener) {
|