@atlaskit/media-client 20.2.1 → 21.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 +29 -0
- package/dist/cjs/client/file-fetcher/index.js +15 -13
- package/dist/cjs/client/media-client.js +27 -7
- package/dist/cjs/client/media-store/index.js +86 -112
- package/dist/cjs/client/media-store/resolveAuth.js +4 -3
- package/dist/cjs/client/stargate-client.js +4 -3
- package/dist/cjs/index.js +0 -13
- package/dist/cjs/models/media.js +4 -5
- package/dist/cjs/uploader/index.js +14 -11
- package/dist/cjs/utils/createFileDataLoader.js +8 -6
- package/dist/cjs/utils/getDimensionsFromBlob.js +4 -3
- package/dist/cjs/utils/getVideoDimensionsFromBlob.js +4 -3
- package/dist/cjs/utils/hashing/hasherCreator.js +3 -3
- package/dist/cjs/utils/mediaSubscribable/fromObservable.js +2 -2
- package/dist/cjs/utils/mobileUpload/helpers.js +4 -3
- package/dist/cjs/utils/mobileUpload/stateMachine/index.js +4 -3
- package/dist/cjs/utils/polling/index.js +4 -3
- package/dist/cjs/utils/request/helpers.js +14 -13
- package/dist/cjs/utils/request/index.js +4 -3
- package/dist/cjs/utils/shouldFetchRemoteFileStates.js +4 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/client/media-client.js +3 -2
- package/dist/es2019/client/media-store/index.js +0 -9
- package/dist/es2019/index.js +1 -2
- package/dist/es2019/models/media.js +3 -1
- 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/version.json +1 -1
- package/dist/esm/client/file-fetcher/index.js +14 -13
- package/dist/esm/client/media-client.js +28 -7
- package/dist/esm/client/media-store/index.js +86 -112
- package/dist/esm/client/media-store/resolveAuth.js +4 -3
- package/dist/esm/client/stargate-client.js +4 -3
- package/dist/esm/index.js +1 -2
- package/dist/esm/models/media.js +3 -3
- package/dist/esm/uploader/index.js +15 -11
- package/dist/esm/utils/createFileDataLoader.js +6 -5
- package/dist/esm/utils/getDimensionsFromBlob.js +4 -3
- package/dist/esm/utils/getVideoDimensionsFromBlob.js +4 -3
- package/dist/esm/utils/hashing/hasherCreator.js +4 -3
- package/dist/esm/utils/mediaSubscribable/fromObservable.js +2 -2
- package/dist/esm/utils/mobileUpload/helpers.js +4 -3
- package/dist/esm/utils/mobileUpload/stateMachine/index.js +4 -3
- package/dist/esm/utils/polling/index.js +4 -3
- package/dist/esm/utils/request/helpers.js +14 -13
- package/dist/esm/utils/request/index.js +4 -3
- package/dist/esm/utils/shouldFetchRemoteFileStates.js +4 -3
- 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 +2 -13
- package/dist/types/index.d.ts +3 -5
- 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/package.json +2 -2
- package/report.api.md +46 -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
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
6
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
9
|
import { getRandomHex } from '@atlaskit/media-common';
|
|
@@ -11,7 +12,6 @@ import { getArtifactUrl } from '../../models/artifacts';
|
|
|
11
12
|
import { request as _request } from '../../utils/request';
|
|
12
13
|
import { createUrl, createMapResponseToJson, createMapResponseToBlob } from '../../utils/request/helpers';
|
|
13
14
|
import { resolveAuth, resolveInitialAuth } from './resolveAuth';
|
|
14
|
-
import { DeprecatedError } from '../../utils/deprecatedEndpointError';
|
|
15
15
|
export { MediaStoreError, isMediaStoreError } from './error';
|
|
16
16
|
var MEDIA_API_REGION = 'media-api-region';
|
|
17
17
|
var MEDIA_API_ENVIRONMENT = 'media-api-environment';
|
|
@@ -44,40 +44,14 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
44
44
|
this.config = config;
|
|
45
45
|
this.featureFlags = featureFlags;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-170 Internal documentation for deprecation (no external access)}
|
|
50
|
-
* This method is no longer working. Will be removed in the next release
|
|
51
|
-
*/
|
|
52
47
|
_createClass(MediaStore, [{
|
|
53
|
-
key: "getCollectionItems",
|
|
54
|
-
value: function () {
|
|
55
|
-
var _getCollectionItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(collectionName, params, traceContext) {
|
|
56
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
57
|
-
while (1) {
|
|
58
|
-
switch (_context.prev = _context.next) {
|
|
59
|
-
case 0:
|
|
60
|
-
throw new DeprecatedError('collection/:name/items');
|
|
61
|
-
case 1:
|
|
62
|
-
case "end":
|
|
63
|
-
return _context.stop();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}, _callee);
|
|
67
|
-
}));
|
|
68
|
-
function getCollectionItems(_x, _x2, _x3) {
|
|
69
|
-
return _getCollectionItems.apply(this, arguments);
|
|
70
|
-
}
|
|
71
|
-
return getCollectionItems;
|
|
72
|
-
}()
|
|
73
|
-
}, {
|
|
74
48
|
key: "removeCollectionFile",
|
|
75
49
|
value: function () {
|
|
76
|
-
var _removeCollectionFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
50
|
+
var _removeCollectionFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(id, collectionName, occurrenceKey, traceContext) {
|
|
77
51
|
var metadata, body, options;
|
|
78
|
-
return _regeneratorRuntime.wrap(function
|
|
52
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
79
53
|
while (1) {
|
|
80
|
-
switch (
|
|
54
|
+
switch (_context.prev = _context.next) {
|
|
81
55
|
case 0:
|
|
82
56
|
metadata = {
|
|
83
57
|
method: 'PUT',
|
|
@@ -104,16 +78,16 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
104
78
|
body: JSON.stringify(body),
|
|
105
79
|
traceContext: traceContext
|
|
106
80
|
});
|
|
107
|
-
|
|
81
|
+
_context.next = 5;
|
|
108
82
|
return this.request("/collection/".concat(collectionName), options);
|
|
109
83
|
case 5:
|
|
110
84
|
case "end":
|
|
111
|
-
return
|
|
85
|
+
return _context.stop();
|
|
112
86
|
}
|
|
113
87
|
}
|
|
114
|
-
},
|
|
88
|
+
}, _callee, this);
|
|
115
89
|
}));
|
|
116
|
-
function removeCollectionFile(
|
|
90
|
+
function removeCollectionFile(_x, _x2, _x3, _x4) {
|
|
117
91
|
return _removeCollectionFile.apply(this, arguments);
|
|
118
92
|
}
|
|
119
93
|
return removeCollectionFile;
|
|
@@ -145,11 +119,11 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
145
119
|
}, {
|
|
146
120
|
key: "uploadChunk",
|
|
147
121
|
value: function () {
|
|
148
|
-
var _uploadChunk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
122
|
+
var _uploadChunk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(etag, blob, uploadId, partNumber, collectionName, traceContext) {
|
|
149
123
|
var metadata, options;
|
|
150
|
-
return _regeneratorRuntime.wrap(function
|
|
124
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
151
125
|
while (1) {
|
|
152
|
-
switch (
|
|
126
|
+
switch (_context2.prev = _context2.next) {
|
|
153
127
|
case 0:
|
|
154
128
|
metadata = {
|
|
155
129
|
method: 'PUT',
|
|
@@ -166,16 +140,16 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
166
140
|
body: blob,
|
|
167
141
|
traceContext: traceContext
|
|
168
142
|
});
|
|
169
|
-
|
|
143
|
+
_context2.next = 4;
|
|
170
144
|
return this.request("/chunk/".concat(etag), options);
|
|
171
145
|
case 4:
|
|
172
146
|
case "end":
|
|
173
|
-
return
|
|
147
|
+
return _context2.stop();
|
|
174
148
|
}
|
|
175
149
|
}
|
|
176
|
-
},
|
|
150
|
+
}, _callee2, this);
|
|
177
151
|
}));
|
|
178
|
-
function uploadChunk(
|
|
152
|
+
function uploadChunk(_x5, _x6, _x7, _x8, _x9, _x10) {
|
|
179
153
|
return _uploadChunk.apply(this, arguments);
|
|
180
154
|
}
|
|
181
155
|
return uploadChunk;
|
|
@@ -262,28 +236,28 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
262
236
|
}, {
|
|
263
237
|
key: "getFileImageURL",
|
|
264
238
|
value: function () {
|
|
265
|
-
var _getFileImageURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
239
|
+
var _getFileImageURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(id, params) {
|
|
266
240
|
var _ref, collectionName, auth;
|
|
267
|
-
return _regeneratorRuntime.wrap(function
|
|
241
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
268
242
|
while (1) {
|
|
269
|
-
switch (
|
|
243
|
+
switch (_context3.prev = _context3.next) {
|
|
270
244
|
case 0:
|
|
271
245
|
_ref = params || {}, collectionName = _ref.collection;
|
|
272
|
-
|
|
246
|
+
_context3.next = 3;
|
|
273
247
|
return this.resolveAuth({
|
|
274
248
|
collectionName: collectionName
|
|
275
249
|
});
|
|
276
250
|
case 3:
|
|
277
|
-
auth =
|
|
278
|
-
return
|
|
251
|
+
auth = _context3.sent;
|
|
252
|
+
return _context3.abrupt("return", this.createFileImageURL(id, auth, params));
|
|
279
253
|
case 5:
|
|
280
254
|
case "end":
|
|
281
|
-
return
|
|
255
|
+
return _context3.stop();
|
|
282
256
|
}
|
|
283
257
|
}
|
|
284
|
-
},
|
|
258
|
+
}, _callee3, this);
|
|
285
259
|
}));
|
|
286
|
-
function getFileImageURL(
|
|
260
|
+
function getFileImageURL(_x11, _x12) {
|
|
287
261
|
return _getFileImageURL.apply(this, arguments);
|
|
288
262
|
}
|
|
289
263
|
return getFileImageURL;
|
|
@@ -306,18 +280,18 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
306
280
|
}, {
|
|
307
281
|
key: "getFileBinaryURL",
|
|
308
282
|
value: function () {
|
|
309
|
-
var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
283
|
+
var _getFileBinaryURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(id, collectionName) {
|
|
310
284
|
var auth, options;
|
|
311
|
-
return _regeneratorRuntime.wrap(function
|
|
285
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
312
286
|
while (1) {
|
|
313
|
-
switch (
|
|
287
|
+
switch (_context4.prev = _context4.next) {
|
|
314
288
|
case 0:
|
|
315
|
-
|
|
289
|
+
_context4.next = 2;
|
|
316
290
|
return this.resolveAuth({
|
|
317
291
|
collectionName: collectionName
|
|
318
292
|
});
|
|
319
293
|
case 2:
|
|
320
|
-
auth =
|
|
294
|
+
auth = _context4.sent;
|
|
321
295
|
options = {
|
|
322
296
|
params: {
|
|
323
297
|
dl: true,
|
|
@@ -326,15 +300,15 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
326
300
|
},
|
|
327
301
|
auth: auth
|
|
328
302
|
};
|
|
329
|
-
return
|
|
303
|
+
return _context4.abrupt("return", createUrl("".concat(auth.baseUrl, "/file/").concat(id, "/binary"), options));
|
|
330
304
|
case 5:
|
|
331
305
|
case "end":
|
|
332
|
-
return
|
|
306
|
+
return _context4.stop();
|
|
333
307
|
}
|
|
334
308
|
}
|
|
335
|
-
},
|
|
309
|
+
}, _callee4, this);
|
|
336
310
|
}));
|
|
337
|
-
function getFileBinaryURL(
|
|
311
|
+
function getFileBinaryURL(_x13, _x14) {
|
|
338
312
|
return _getFileBinaryURL.apply(this, arguments);
|
|
339
313
|
}
|
|
340
314
|
return getFileBinaryURL;
|
|
@@ -342,25 +316,25 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
342
316
|
}, {
|
|
343
317
|
key: "getArtifactURL",
|
|
344
318
|
value: function () {
|
|
345
|
-
var _getArtifactURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
319
|
+
var _getArtifactURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(artifacts, artifactName, collectionName) {
|
|
346
320
|
var artifactUrl, auth, options;
|
|
347
|
-
return _regeneratorRuntime.wrap(function
|
|
321
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
348
322
|
while (1) {
|
|
349
|
-
switch (
|
|
323
|
+
switch (_context5.prev = _context5.next) {
|
|
350
324
|
case 0:
|
|
351
325
|
artifactUrl = getArtifactUrl(artifacts, artifactName);
|
|
352
326
|
if (artifactUrl) {
|
|
353
|
-
|
|
327
|
+
_context5.next = 3;
|
|
354
328
|
break;
|
|
355
329
|
}
|
|
356
330
|
throw new Error("artifact ".concat(artifactName, " not found"));
|
|
357
331
|
case 3:
|
|
358
|
-
|
|
332
|
+
_context5.next = 5;
|
|
359
333
|
return this.resolveAuth({
|
|
360
334
|
collectionName: collectionName
|
|
361
335
|
});
|
|
362
336
|
case 5:
|
|
363
|
-
auth =
|
|
337
|
+
auth = _context5.sent;
|
|
364
338
|
options = {
|
|
365
339
|
params: {
|
|
366
340
|
collection: collectionName,
|
|
@@ -368,15 +342,15 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
368
342
|
},
|
|
369
343
|
auth: auth
|
|
370
344
|
};
|
|
371
|
-
return
|
|
345
|
+
return _context5.abrupt("return", createUrl("".concat(auth.baseUrl).concat(artifactUrl), options));
|
|
372
346
|
case 8:
|
|
373
347
|
case "end":
|
|
374
|
-
return
|
|
348
|
+
return _context5.stop();
|
|
375
349
|
}
|
|
376
350
|
}
|
|
377
|
-
},
|
|
351
|
+
}, _callee5, this);
|
|
378
352
|
}));
|
|
379
|
-
function getArtifactURL(
|
|
353
|
+
function getArtifactURL(_x15, _x16, _x17) {
|
|
380
354
|
return _getArtifactURL.apply(this, arguments);
|
|
381
355
|
}
|
|
382
356
|
return getArtifactURL;
|
|
@@ -384,11 +358,11 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
384
358
|
}, {
|
|
385
359
|
key: "getImage",
|
|
386
360
|
value: function () {
|
|
387
|
-
var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
361
|
+
var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(id, params, controller, fetchMaxRes, traceContext) {
|
|
388
362
|
var isWebpSupported, headers, metadata, options;
|
|
389
|
-
return _regeneratorRuntime.wrap(function
|
|
363
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
390
364
|
while (1) {
|
|
391
|
-
switch (
|
|
365
|
+
switch (_context6.prev = _context6.next) {
|
|
392
366
|
case 0:
|
|
393
367
|
// TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
|
|
394
368
|
isWebpSupported = false;
|
|
@@ -408,15 +382,15 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
408
382
|
headers: headers,
|
|
409
383
|
traceContext: traceContext
|
|
410
384
|
});
|
|
411
|
-
return
|
|
385
|
+
return _context6.abrupt("return", this.request("/file/".concat(id, "/image"), options, controller).then(createMapResponseToBlob(metadata)));
|
|
412
386
|
case 6:
|
|
413
387
|
case "end":
|
|
414
|
-
return
|
|
388
|
+
return _context6.stop();
|
|
415
389
|
}
|
|
416
390
|
}
|
|
417
|
-
},
|
|
391
|
+
}, _callee6, this);
|
|
418
392
|
}));
|
|
419
|
-
function getImage(
|
|
393
|
+
function getImage(_x18, _x19, _x20, _x21, _x22) {
|
|
420
394
|
return _getImage.apply(this, arguments);
|
|
421
395
|
}
|
|
422
396
|
return getImage;
|
|
@@ -424,11 +398,11 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
424
398
|
}, {
|
|
425
399
|
key: "getItems",
|
|
426
400
|
value: function () {
|
|
427
|
-
var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
401
|
+
var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(ids, collectionName, traceContext) {
|
|
428
402
|
var descriptors, metadata, options;
|
|
429
|
-
return _regeneratorRuntime.wrap(function
|
|
403
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
430
404
|
while (1) {
|
|
431
|
-
switch (
|
|
405
|
+
switch (_context7.prev = _context7.next) {
|
|
432
406
|
case 0:
|
|
433
407
|
descriptors = ids.map(function (id) {
|
|
434
408
|
return {
|
|
@@ -451,15 +425,15 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
451
425
|
}),
|
|
452
426
|
traceContext: traceContext
|
|
453
427
|
});
|
|
454
|
-
return
|
|
428
|
+
return _context7.abrupt("return", this.request('/items', options).then(createMapResponseToJson(metadata)));
|
|
455
429
|
case 4:
|
|
456
430
|
case "end":
|
|
457
|
-
return
|
|
431
|
+
return _context7.stop();
|
|
458
432
|
}
|
|
459
433
|
}
|
|
460
|
-
},
|
|
434
|
+
}, _callee7, this);
|
|
461
435
|
}));
|
|
462
|
-
function getItems(
|
|
436
|
+
function getItems(_x23, _x24, _x25) {
|
|
463
437
|
return _getItems.apply(this, arguments);
|
|
464
438
|
}
|
|
465
439
|
return getItems;
|
|
@@ -467,11 +441,11 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
467
441
|
}, {
|
|
468
442
|
key: "getImageMetadata",
|
|
469
443
|
value: function () {
|
|
470
|
-
var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
444
|
+
var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(id, params, traceContext) {
|
|
471
445
|
var metadata, options;
|
|
472
|
-
return _regeneratorRuntime.wrap(function
|
|
446
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
473
447
|
while (1) {
|
|
474
|
-
switch (
|
|
448
|
+
switch (_context8.prev = _context8.next) {
|
|
475
449
|
case 0:
|
|
476
450
|
metadata = {
|
|
477
451
|
method: 'GET',
|
|
@@ -484,15 +458,15 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
484
458
|
params: params,
|
|
485
459
|
traceContext: traceContext
|
|
486
460
|
});
|
|
487
|
-
return
|
|
461
|
+
return _context8.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then(createMapResponseToJson(metadata)));
|
|
488
462
|
case 3:
|
|
489
463
|
case "end":
|
|
490
|
-
return
|
|
464
|
+
return _context8.stop();
|
|
491
465
|
}
|
|
492
466
|
}
|
|
493
|
-
},
|
|
467
|
+
}, _callee8, this);
|
|
494
468
|
}));
|
|
495
|
-
function getImageMetadata(
|
|
469
|
+
function getImageMetadata(_x26, _x27, _x28) {
|
|
496
470
|
return _getImageMetadata.apply(this, arguments);
|
|
497
471
|
}
|
|
498
472
|
return getImageMetadata;
|
|
@@ -500,11 +474,11 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
500
474
|
}, {
|
|
501
475
|
key: "appendChunksToUpload",
|
|
502
476
|
value: function () {
|
|
503
|
-
var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
477
|
+
var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(uploadId, body, collectionName, traceContext) {
|
|
504
478
|
var metadata, options;
|
|
505
|
-
return _regeneratorRuntime.wrap(function
|
|
479
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
506
480
|
while (1) {
|
|
507
|
-
switch (
|
|
481
|
+
switch (_context9.prev = _context9.next) {
|
|
508
482
|
case 0:
|
|
509
483
|
metadata = {
|
|
510
484
|
method: 'PUT',
|
|
@@ -518,16 +492,16 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
518
492
|
body: JSON.stringify(body),
|
|
519
493
|
traceContext: traceContext
|
|
520
494
|
});
|
|
521
|
-
|
|
495
|
+
_context9.next = 4;
|
|
522
496
|
return this.request("/upload/".concat(uploadId, "/chunks"), options);
|
|
523
497
|
case 4:
|
|
524
498
|
case "end":
|
|
525
|
-
return
|
|
499
|
+
return _context9.stop();
|
|
526
500
|
}
|
|
527
501
|
}
|
|
528
|
-
},
|
|
502
|
+
}, _callee9, this);
|
|
529
503
|
}));
|
|
530
|
-
function appendChunksToUpload(
|
|
504
|
+
function appendChunksToUpload(_x29, _x30, _x31, _x32) {
|
|
531
505
|
return _appendChunksToUpload.apply(this, arguments);
|
|
532
506
|
}
|
|
533
507
|
return appendChunksToUpload;
|
|
@@ -556,7 +530,7 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
556
530
|
}, {
|
|
557
531
|
key: "request",
|
|
558
532
|
value: function () {
|
|
559
|
-
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
533
|
+
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(path) {
|
|
560
534
|
var options,
|
|
561
535
|
controller,
|
|
562
536
|
method,
|
|
@@ -570,26 +544,26 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
570
544
|
auth,
|
|
571
545
|
extendedTraceContext,
|
|
572
546
|
response,
|
|
573
|
-
|
|
574
|
-
return _regeneratorRuntime.wrap(function
|
|
547
|
+
_args10 = arguments;
|
|
548
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
575
549
|
while (1) {
|
|
576
|
-
switch (
|
|
550
|
+
switch (_context10.prev = _context10.next) {
|
|
577
551
|
case 0:
|
|
578
|
-
options =
|
|
552
|
+
options = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {
|
|
579
553
|
method: 'GET',
|
|
580
554
|
endpoint: undefined,
|
|
581
555
|
authContext: {}
|
|
582
556
|
};
|
|
583
|
-
controller =
|
|
557
|
+
controller = _args10.length > 2 ? _args10[2] : undefined;
|
|
584
558
|
method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions, traceContext = options.traceContext;
|
|
585
|
-
|
|
559
|
+
_context10.next = 5;
|
|
586
560
|
return this.resolveAuth(authContext);
|
|
587
561
|
case 5:
|
|
588
|
-
auth =
|
|
562
|
+
auth = _context10.sent;
|
|
589
563
|
extendedTraceContext = traceContext ? _objectSpread(_objectSpread({}, traceContext), {}, {
|
|
590
564
|
spanId: (traceContext === null || traceContext === void 0 ? void 0 : traceContext.spanId) || getRandomHex(8)
|
|
591
565
|
}) : undefined;
|
|
592
|
-
|
|
566
|
+
_context10.next = 9;
|
|
593
567
|
return _request("".concat(auth.baseUrl).concat(path), {
|
|
594
568
|
method: method,
|
|
595
569
|
endpoint: endpoint,
|
|
@@ -601,18 +575,18 @@ export var MediaStore = /*#__PURE__*/function () {
|
|
|
601
575
|
traceContext: extendedTraceContext
|
|
602
576
|
}, controller);
|
|
603
577
|
case 9:
|
|
604
|
-
response =
|
|
578
|
+
response = _context10.sent;
|
|
605
579
|
setKeyValueInSessionStorage(MEDIA_API_REGION, response.headers.get('x-media-region'));
|
|
606
580
|
setKeyValueInSessionStorage(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
|
|
607
|
-
return
|
|
581
|
+
return _context10.abrupt("return", response);
|
|
608
582
|
case 13:
|
|
609
583
|
case "end":
|
|
610
|
-
return
|
|
584
|
+
return _context10.stop();
|
|
611
585
|
}
|
|
612
586
|
}
|
|
613
|
-
},
|
|
587
|
+
}, _callee10, this);
|
|
614
588
|
}));
|
|
615
|
-
function request(
|
|
589
|
+
function request(_x33) {
|
|
616
590
|
return _request2.apply(this, arguments);
|
|
617
591
|
}
|
|
618
592
|
return request;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
4
|
import { MediaStoreError } from './error';
|
|
4
5
|
import { rejectTimeout } from '../../utils/setTimeoutPromise';
|
|
5
6
|
export var DEFAULT_AUTH_PROVIDER_TIMEOUT = 10000;
|
|
6
7
|
export var resolveAuth = /*#__PURE__*/function () {
|
|
7
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(authProvider, authContext) {
|
|
8
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(authProvider, authContext) {
|
|
8
9
|
var authProviderTimeout,
|
|
9
10
|
auth,
|
|
10
11
|
_args = arguments;
|
|
11
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
12
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
12
13
|
while (1) {
|
|
13
14
|
switch (_context.prev = _context.next) {
|
|
14
15
|
case 0:
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
5
6
|
export var StargateClient = /*#__PURE__*/function () {
|
|
6
7
|
function StargateClient(baseUrl) {
|
|
7
8
|
_classCallCheck(this, StargateClient);
|
|
@@ -10,8 +11,8 @@ export var StargateClient = /*#__PURE__*/function () {
|
|
|
10
11
|
_createClass(StargateClient, [{
|
|
11
12
|
key: "fetchToken",
|
|
12
13
|
value: function () {
|
|
13
|
-
var _fetchToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(clientId) {
|
|
14
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
14
|
+
var _fetchToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(clientId) {
|
|
15
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
15
16
|
while (1) {
|
|
16
17
|
switch (_context.prev = _context.next) {
|
|
17
18
|
case 0:
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { MediaStore, MediaStoreError, isMediaStoreError, getMediaEnvironment, getMediaRegion } from './client/media-store';
|
|
2
2
|
export { UploadController } from './upload-controller';
|
|
3
|
-
export { isPreviewableType
|
|
3
|
+
export { isPreviewableType } from './models/media';
|
|
4
4
|
export { getArtifactUrl } from './models/artifacts';
|
|
5
5
|
export { isMediaClientError, getMediaClientErrorReason } from './models/errors';
|
|
6
6
|
export { isUploadingFileState, isProcessingFileState, isProcessedFileState, isErrorFileState, isPreviewableFileState, isFinalFileState, isImageRepresentationReady, mapMediaFileToFileState, mapMediaItemToFileState } from './models/file-state';
|
|
@@ -11,7 +11,6 @@ export { PollingFunction } from './utils/polling';
|
|
|
11
11
|
export { isPollingError, PollingError } from './utils/polling/errors';
|
|
12
12
|
export { imageResizeModeToFileImageMode } from './utils/imageResizeModeToFileImageMode';
|
|
13
13
|
export { FileFetcherImpl, FileFetcherError, isFileFetcherError } from './client/file-fetcher';
|
|
14
|
-
export { CollectionFetcher } from './client/collection-fetcher';
|
|
15
14
|
export { MediaClient } from './client/media-client';
|
|
16
15
|
export { StargateClient } from './client/stargate-client';
|
|
17
16
|
export { isImageRemote } from './utils/isImageRemote';
|
package/dist/esm/models/media.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
2
|
+
|
|
3
|
+
// Warning! You can't add new media file processing status!
|
|
4
|
+
// See packages/media/media-core/src/__tests__/cache-backward-compatibility.spec.ts
|
|
2
5
|
export var isPreviewableType = function isPreviewableType(type, featureFlags) {
|
|
3
6
|
// in classic experience, only audio/video/image are previewable
|
|
4
7
|
var defaultPreviewableTypes = ['audio', 'video', 'image'];
|
|
@@ -9,9 +12,6 @@ export var isPreviewableType = function isPreviewableType(type, featureFlags) {
|
|
|
9
12
|
}
|
|
10
13
|
return defaultPreviewableTypes.indexOf(type) > -1;
|
|
11
14
|
};
|
|
12
|
-
export var isMediaCollectionItemFullDetails = function isMediaCollectionItemFullDetails(mediaCollectionItem) {
|
|
13
|
-
return !!mediaCollectionItem['mediaType'] && !!mediaCollectionItem['mimeType'] && !!mediaCollectionItem['processingStatus'];
|
|
14
|
-
};
|
|
15
15
|
export var DATA_UNIT;
|
|
16
16
|
(function (DATA_UNIT) {
|
|
17
17
|
DATA_UNIT[DATA_UNIT["MB"] = 1048576] = "MB";
|