@aws-amplify/ui-react-storage 3.1.5 → 3.1.6
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.
|
@@ -8,23 +8,31 @@ const getInput = ({ accessLevel, file, key, onProcessFileSuccess, onProgress, pa
|
|
|
8
8
|
const hasStringPath = isString(path);
|
|
9
9
|
const hasKeyInput = !!accessLevel && !hasCallbackPath;
|
|
10
10
|
const { file: data, key: processedKey, ...rest } = await resolveFile({ file, key, processFile });
|
|
11
|
-
if (processFile) {
|
|
12
|
-
// provide post-processing value of target `key`
|
|
13
|
-
onProcessFileSuccess({ processedKey });
|
|
14
|
-
}
|
|
15
11
|
const contentType = file.type || 'binary/octet-stream';
|
|
16
12
|
// IMPORTANT: always pass `...rest` here for backwards compatibility
|
|
17
13
|
const options = { contentType, onProgress, ...rest };
|
|
14
|
+
let inputResult;
|
|
18
15
|
if (hasKeyInput) {
|
|
19
16
|
// legacy handling of `path` is to prefix to `fileKey`
|
|
20
17
|
const resolvedKey = hasStringPath
|
|
21
18
|
? `${path}${processedKey}`
|
|
22
19
|
: processedKey;
|
|
23
|
-
|
|
20
|
+
inputResult = {
|
|
21
|
+
data,
|
|
22
|
+
key: resolvedKey,
|
|
23
|
+
options: { ...options, accessLevel },
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const { identityId } = await fetchAuthSession();
|
|
28
|
+
const resolvedPath = `${hasCallbackPath ? path({ identityId }) : path}${processedKey}`;
|
|
29
|
+
inputResult = { data: file, path: resolvedPath, options };
|
|
30
|
+
}
|
|
31
|
+
if (processFile) {
|
|
32
|
+
// provide post-processing value of target `key`
|
|
33
|
+
onProcessFileSuccess({ processedKey });
|
|
24
34
|
}
|
|
25
|
-
|
|
26
|
-
const resolvedPath = `${hasCallbackPath ? path({ identityId }) : path}${processedKey}`;
|
|
27
|
-
return { data: file, path: resolvedPath, options };
|
|
35
|
+
return inputResult;
|
|
28
36
|
};
|
|
29
37
|
};
|
|
30
38
|
|
package/dist/esm/version.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ function _interopNamespace(e) {
|
|
|
33
33
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
34
34
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
35
35
|
|
|
36
|
-
const VERSION = '3.1.
|
|
36
|
+
const VERSION = '3.1.6';
|
|
37
37
|
|
|
38
38
|
const MISSING_REQUIRED_PROP_MESSAGE = '`StorageImage` requires either an `imgKey` or `path` prop.';
|
|
39
39
|
const HAS_DEPRECATED_PROPS_MESSAGE = '`imgKey`, `accessLevel`, and `identityId` will be replaced with `path` in a future major version. See https://ui.docs.amplify.aws/react/connected-components/storage/storageimage#props';
|
|
@@ -410,23 +410,31 @@ const getInput = ({ accessLevel, file, key, onProcessFileSuccess, onProgress, pa
|
|
|
410
410
|
const hasStringPath = ui.isString(path);
|
|
411
411
|
const hasKeyInput = !!accessLevel && !hasCallbackPath;
|
|
412
412
|
const { file: data, key: processedKey, ...rest } = await resolveFile({ file, key, processFile });
|
|
413
|
-
if (processFile) {
|
|
414
|
-
// provide post-processing value of target `key`
|
|
415
|
-
onProcessFileSuccess({ processedKey });
|
|
416
|
-
}
|
|
417
413
|
const contentType = file.type || 'binary/octet-stream';
|
|
418
414
|
// IMPORTANT: always pass `...rest` here for backwards compatibility
|
|
419
415
|
const options = { contentType, onProgress, ...rest };
|
|
416
|
+
let inputResult;
|
|
420
417
|
if (hasKeyInput) {
|
|
421
418
|
// legacy handling of `path` is to prefix to `fileKey`
|
|
422
419
|
const resolvedKey = hasStringPath
|
|
423
420
|
? `${path}${processedKey}`
|
|
424
421
|
: processedKey;
|
|
425
|
-
|
|
422
|
+
inputResult = {
|
|
423
|
+
data,
|
|
424
|
+
key: resolvedKey,
|
|
425
|
+
options: { ...options, accessLevel },
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
const { identityId } = await auth.fetchAuthSession();
|
|
430
|
+
const resolvedPath = `${hasCallbackPath ? path({ identityId }) : path}${processedKey}`;
|
|
431
|
+
inputResult = { data: file, path: resolvedPath, options };
|
|
432
|
+
}
|
|
433
|
+
if (processFile) {
|
|
434
|
+
// provide post-processing value of target `key`
|
|
435
|
+
onProcessFileSuccess({ processedKey });
|
|
426
436
|
}
|
|
427
|
-
|
|
428
|
-
const resolvedPath = `${hasCallbackPath ? path({ identityId }) : path}${processedKey}`;
|
|
429
|
-
return { data: file, path: resolvedPath, options };
|
|
437
|
+
return inputResult;
|
|
430
438
|
};
|
|
431
439
|
};
|
|
432
440
|
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "3.1.
|
|
1
|
+
export declare const VERSION = "3.1.6";
|